From 517393d903089f921915530ffa689a7a1d113420 Mon Sep 17 00:00:00 2001 From: Andrew Geissler Date: Fri, 13 Jan 2023 08:55:19 -0600 Subject: subtree updates Jan-13-2023 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit meta-openembedded: d04444509a..cd13881611: Alex Kiernan (10): mdns: Upgrade 1310.140.1 -> 1790.40.31 mdns: Set MDNS_VERSIONSTR_NODTS mdns: Upgrade 1790.40.31 -> 1790.60.25 ostree: Upgrade 2022.5 -> 2022.7 ostree: Use systemd_system_unitdir for systemd units ostree: Switch to fuse3 which is supported in ostree now ostree: Fix comments for configuration/ptest ostree: Handle musl's ERANGE mapping usbguard: Remove pegtl from DEPENDS usbguard: Upgrade 1.1.1 -> 1.1.2 Alex Stewart (2): gvfs: stylize DEPENDS gvfs: obviate the ssh-client requirement for gvfs Alexander Kanavin (5): frr: add a patch to correctly check presence of python from pkg-config lirc: correctly use PYTHONPATH libportal: move to oe-core packagegroup-meta-python: drop python3-strict-rfc3339 nftables: fix builds with latest setuptools Alexander Stein (1): dool: Add patch to fix rebuild Archana Polampalli (1): Nodejs - Upgrade to 16.18.1 Bartosz Golaszewski (3): python3-kmod: new package python3-watchdogdev: new package packagegroup-meta-python: add missing packages Bruce Ashfield (1): zfs: update to 2.1.7 Changqing Li (5): linuxptp: fix do_compile error keyutils: fix ptest failed since "+++ Can't Determine Endianness" graphviz: Do not build tcl support for native redis: 6.2.7 -> 6.2.8 redis: 7.0.5 -> 7.0.7 Chen Pei (2): suitesparse:fix git branch in SRC_URI botan: upgrade 2.19.2 -> 2.19.3 Chen Qi (4): xfce4-verve-plugin: fix do_configure faiure about missing libpcre networkmanager: fix dhcpcd PACKAGECONFIG networkmanager: install config files into correct place networkmanager: fix /etc/resolv.conf handling Christian Eggers (1): boost-url: remove recipe Clément Péron (3): navigation: bump proj to 9.1.0 library proj: add a packageconfig to build as a static library proj: avoid leaking host path in libproj Devendra Tewari (1): android-tools: Use echo instead of bbnote Dmitry Baryshkov (1): nss: fix cross-compilation error Erwann Roussy (3): python3-schedutils: add recipe python3-linux-procfs: add recipe tuna: add recipe Fabio Estevam (2): remmina: Update to 1.4.28 crucible: Upgrade to 2022.12.06 Geoff Parker (1): python3-yappi: upgrade 1.3.6 -> 1.4.0, python 3.11 compatible Gerbrand De Laender (1): python3-aioserial: new package Gianfranco Costamagna (2): vbxguestdrivers: upgrade 7.0.2 -> 7.0.4 boinc-client: Update boinc from 7.18.1 to 7.20.4 Gianluigi Spagnuolo (1): libbpf: add native and nativesdk BBCLASSEXTEND Hains van den Bosch (2): python3-twisted: Add python3-asyncio to RDEPENDS python3-twisted: Add python3-typing-extensions to RDEPENDS He Zhe (1): protobuf: upgrade 3.21.5 -> 3.21.10 Jose Quaresma (1): lshw: bump to 42fef565 Kai Kang (31): freeradius: fix multilib systemd service start failure wxwidgets: 3.1.5 -> 3.2.1 python3-attrdict3: add recipe with version 2.0.2 python3-wxgtk4: 4.1.1 -> 4.2.0 xfce4-settings: 4.16.3 -> 4.16.5 python3-m2crypto: fix CVE-2020-25657 and buildpaths qa issue fixup! wxwidgets: 3.1.5 -> 3.2.1 postfix: fix multilib conflict of sample-main.cf python3-wxgtk4: replace deprecated inspect.getargspec libxfce4ui: 4.16.1 -> 4.18.0 thunar-volman: 4.16.0 -> 4.18.0 xfce4-cpufreq-plugin: 1.2.7 -> 1.2.8 xfce4-wavelan-plugin: 0.6.2 -> 0.6.3 xfce4-cpugraph-plugin: 1.2.6 -> 1.2.7 xfce4-sensors-plugin: 1.4.3 -> 1.4.4 thunar-shares-plugin: Bump GLib minimum required to 2.26 xfce4-dev-tools: 4.16.0 -> 4.18.0 libxfce4util: 4.16.0 -> 4.18.0 exo: 4.16.4 -> 4.18.0 garcon: 4.16.1 -> 4.18.0 xfce4-panel: 4.16.3 -> 4.18.0 thunar: 4.16.9 -> 4.18.0 tumbler: 4.16.0 -> 4.18.0 xfconf: 4.16.0 -> 4.18.0 xfce4-appfinder: 4.16.1 -> 4.18.0 xfce4-settings: 4.16.5 -> 4.18.0 xfce4-power-manager: 4.16.0 -> 4.18.0 xfce4-session: 4.16.0 -> 4.18.0 xfwm4: 4.16.1 -> 4.18.0 xfdesktop: 4.16.0 -> 4.18.0 xorg-lib: set XORG_EXT for recipes Khem Raj (91): gnome-text-editor: Add missing libpcre build time depenedency ettercap: Add missing dependency on libpcre xcb-util-cursor: Update to 0.1.4 lldpd: Use github release assets for SRC_URI aufs-util: Fix build with large file support enabled systems volume-key: Inherit python3targetconfig proj: Enable apps when building native variant python3-pyproj: Export PROJ_DIR satyr: Inherit python3targetconfig rest: Re-add 0.8.1 gfbgraph: Use rest 0.8.1 audit: Inherit python3targetconfig opensaf: Check for _FILE_OFFSET_BITS instead of __TIMESIZE flite: Add missing deps on alsa-lib and chrpath python3-pystemd: Regenerate .c sources using newer cython libreport: Inherit python3targetconfig uw-imap: Disable parallelism gnome-calendar: Upgrade to 43.1 gnome-photos: Upgrade to 43.0 libgweather: Remove 40.0 waf-samba.bbclass: point PYTHON_CONFIG to target python3-config amtk: Add missing dep on python3-pygments-native fontforge: Inherit python3targetconfig tepl: Add missing dep on python3-pygments-native alsa-oss: Remove recipe opencv: Check for commercial_ffmpeg as well to enable ffmpeg opencv: Fix build with ffmpeg 5.1+ fwts: Upgrade to 22.11.00 minio: Disable on mips sip: Add recipe for 6.7.5 imapfilter: Upgrade to 2.7.6 perfetto: Do not pass TUNE_CCARGS to native/host compiler stressapptest: Upgrade to latest tip mariadb: Upgrade to 10.11.1 surf: Depend on gcr3 fatcat: Enable 64bit off_t stressapptest: Fix build with largefile support and musl nspr: Upgrade to 4.35 cryptsetup: Upgrade to 2.6.0 libyui,libyui-ncurses: Upgrade to 4.2.3 inotify-tools: Fix build on musl and lfs64 sdbus-c++-libsystemd: Upgrade to 250.9 systemd release xfsprogs: Upgrade to 6.0.0 drbd,drbd-utils: Upgrade to 9.2.1 and drbd-utils to 9.22.0 libtraceevent: Add recipe libtracefs: Add recipe trace-cmd: Remove use of off64_t and lseek64 xfsdump: Add -D_LARGEFILE64_SOURCE on musl xfstests: Add -D_LARGEFILE64_SOURCE on musl mariadb: Alias lseek64/open64/ftruncate64 on musl systems gperftools: Define off64_t on musl android-tools: Define lseek64 = lseek on musl php: Add -D_LARGEFILE64_SOURCE to cflags spice-gtk: Use libucontext for coroutines on musl wxwidgets: Fix build with musl wxwidgets: Fix locale on musl wxwidgets: Set HAVE_LARGEFILE_SUPPORT python3-wxgtk4: Do not use GetAssertStackTrace with USE_STACKWALKER disabled f2fs-tools: Upgrade to 1.15.0 trace-cmd: Pass ldflags to compiler parole: Define DATADIRNAME abseil-cpp: Replace off64_t with off_t vsftpd_3.0.5.bb: Define _LARGEFILE64_SOURCE on musl mozjs-102: Disable mozilla stackwalk on musl fatresize: Fix build when 64bit time_t is enabled boinc-client: Fix build when using 64bit time_t python3-grpcio: Define -D_LARGEFILE64_SOURCE only for musl gnome-online-accounts: Fix build race seen on musl systems imagemagick: Do not set ac_cv_sys_file_offset_bits spdlog: Do not use LFS64 functions with musl mongodb: Do not use off64_t on musl dracut: Do not undefine _FILE_OFFSET_BITS libcamera: Diable 64bit time_t on glibc targets v4l-utils: Diable 64bit time_t on glibc targets opensaf: Fix the check for __fsblkcnt64_t size libcereal,poco: Link with -latomic on ppc32 as well sshpass: Use SPDX identified string for GPLv2 nftables: Upgrade to 1.0.6 mycroft: Check for pulseaudio in distro features trace-cmd: Build libs before building rest open-vm-tools: Fix build with 64-bit time_t libtraceevent: Move plugins into package of its own trace-cmd: Upgrade to 3.1.5 luajit: Update to latest on v2.1 branch concurrencykit: Update to 0.7.0 concurrencykit: Set correct PLAT value for riscv32 concurrencykit: Fix build on riscv32 and riscv64 sysbench: Enable only on architectures supporting LuaJIT packagegroup-meta-oe: Ensure sysbench is included in limited arches hwloc: Update to 2.9.0 fluentbit: Link with libatomic on ppc32 Lei Maohui (1): polkit: Fix multilib builds Leon Anavi (9): python3-watchdog: Upgrade 2.2.0 -> 2.2.1 python3-zeroconf: Upgrade 0.39.4 -> 0.47.1 python3-croniter: Upgrade 1.3.7 -> 1.3.8 python3-coverage: Upgrade 7.0.1 -> 7.0.3 python3-prompt-toolkit: Upgrade 3.0.31 -> 3.0.36 python3-simplejson: Upgrade 3.18.0 -> 3.18.1 python3-termcolor: Upgrade 2.1.1 -> 2.2.0 python3-cantools: Upgrade 37.2.0 -> 38.0.0 python3-marshmallow: Upgrade 3.18.0 -> 3.19.0 Livin Sunny (1): libwebsockets: add ipv6 in PACKAGECONFIG Markus Volk (88): blueman: add RDEPEND on python3-fcntl hwdata: add patch to use sysroot prefix for pkgdatadir pipewire: upgrade 0.3.59 -> 0.3.60 spirv-cross: upgrade; fix build blueman: upgrade 2.34 -> 2.35 pipewire: upgrade 0.3.60 -> 0.3.61 iwd: upgrade 1.30 -> 2.0 libgdata: use gcr3 libgweather: update 4.0.0 -> 4.2.0 gnome-online-accounts: use gcr3 geary: build with gcr3 gnome-keyring: use gcr3 evolution-data-server: update 3.44.2 -> 3.46.1 gnome-settings-daemon: update 42.1 -> 43.0 libnma: update 1.8.38 -> 1.10.4 geocode-glib: build with libsoup-3.0 gjs: update 1.72.2 -> 1.75.1 gnome-shell: update 42.0 -> 43.1 mutter: update 42.0 -> 43.1 polkit: add recipe for v122 mozjs: update 98 -> 102 appstream-glib: update 0.7.18 -> 0.8.2 gthumb: build with libsoup-3 amtk: update 5.3.1 -> 5.6.1 gedit: update 42.2 -> 43.2 evolution-data-server: remove libgdata dependency tepl: update 6.0.0 -> 6.2.0 perfetto: pass TUNE_CCARGS to use machine tune gnome-photos: update dependencies thunar-archive-plugin: update 0.4.0 -> 0.5.0 libadwaita: remove deprecated sassc-native dependency gnome-shell: remove deprecated sassc-native dependency spice-gtk: add missing license information pipewire: update 0.3.61 -> 0.3.62 gdm: update 42.0 -> 43.0 gnome-session: update 42.0 -> 43-0 geoclue: update to latest commit to allow to build with libsoup-3.0 gvfs: fix polkit homedir editorconfig: add recipe tracker: update 3.4.1 -> 3.4.2 gvfs: fix dependencies gnome-calculator: update 42.2 -> 43.0.1 tracker-miners: update 3.4.1 -> 3.4.2 gnome-photos: add missing runtime dependency on tracker-miners gtksourceview5: update 5.4.2 -> 5.6.1 remmina: build with libsoup-3.0 ostree: replace libsoup-2.4 by curl gnome-text-editor: update 42.2 -> 43.1 gtk4: remove recipe libxmlb: allow to build native pipewire: update 0.3.62 -> 0.3.63 gnome-shell-extensions: update SRC_URI and remove sassc-native dep grilo: update 0.3.14 -> 0.3.15 libstemmer: move recipe to meta-oe xdg-desktop-portal: add recipe bubblewrap: import recipe from meta-security gnome-software: add recipe basu: import recipe from meta-wayland xdg-desktop-portal-wlr: add recipe appstream: add recipe flatpak: add recipe flatpak-xdg-utils: add recipe flatpak: add runtime dependency on flatpak-xdg-utils wireplumber: update 0.4.12 -> 0.4.13 wireplumber: build with dbus support by default xdg-desktop-portal-gnome: add recipe libcloudproviders: add recipe evince: update 42.3 -> 43.1 libportal: build libportal-gtk4 and vala support nautilus: update 42.2 -> 43.1 gnome-desktop: update 42.0 -> 43 file-roller: update 3.42.0 -> 43.0 wireplumber: dont start systemd system service by default gnome-bluetooth: update 42.4 -> 42.5 gnome-flashback: update 3.44.0 -> 3.46.0 libwnck3: update 40.1 -> 43.0 gnome-panel: update 3.44.0 -> 3.47.1 gnome-terminal: update 3.42.2 -> 3.46.7 dconf-editor: update 3.38.3 -> 43.0 gnome-shell: add missing RDEPENDS gnome-control-center: update 42.0 -> 43.2 gnome-shell: add runtime dependency on adwaita-icon-theme xdg-desktop-portal-gtk: add recipe thunar: add tumbler to RRECOMMENDS gnome:terminal add missing inherit meson gnome-disk-utility: update 42.0 -> 43.0 eog: add recipe libdecor: import recipe Martin Jansa (3): nss: fix SRC_URI geoclue: fix polkit files only with modem-gps PACKAGECONFIG layer.conf: update LAYERSERIES_COMPAT for mickledore Mathieu Dubois-Briand (2): nss: Add missing CVE product nss: Whitelist CVEs related to libnssdbm Matthias Klein (1): paho-mqtt-c: upgrade 1.3.11 -> 1.3.12 Max Krummenacher (1): opencv: follow changed name license_flags_accepted Mingli Yu (25): gnome-calculator: add opengl to REQUIRED_DISTRO_FEATURES waylandpp: add opengl to REQUIRED_DISTRO_FEATURES libnma: add opengl to REQUIRED_DISTRO_FEATURES network-manager-applet: add opengl to REQUIRED_DISTRO_FEATURES gssdp: check opengl is enabled or not gtksourceview5: add opengl to REQUIRED_DISTRO_FEATURES gnome-font-viewer: add opengl to REQUIRED_DISTRO_FEATURES libxfce4ui: check opengl DISTRO_FEATURES gnome-desktop: add opengl to REQUIRED_DISTRO_FEATURES ibus: add opengl related check nautilus: add opengl to REQUIRED_DISTRO_FEATURES gnome-bluetooth: add opengl to REQUIRED_DISTRO_FEATURES evince: add opengl to REQUIRED_DISTRO_FEATURES gnome-calendar: add opengl to REQUIRED_DISTRO_FEATURES xf86-video-amdgpu: add opengl to REQUIRED_DISTRO_FEATURES spice-gtk: add opengl to REQUIRED_DISTRO_FEATURES grail: add opengl to REQUIRED_DISTRO_FEATURES frame: add opengl to REQUIRED_DISTRO_FEATURES geis: add opengl to REQUIRED_DISTRO_FEATURES evolution-data-server: add opengl to REQUIRED_DISTRO_FEATURES libgweather4: add opengl to REQUIRED_DISTRO_FEATURES geary: add opengl to REQUIRED_DISTRO_FEATURES file-roller: add opengl to REQUIRED_DISTRO_FEATURES gnome-photos: add opengl to REQUIRED_DISTRO_FEATURES xdg-desktop-portal-wlr: add opengl to REQUIRED_DISTRO_FEATURES Naveen Saini (3): opencl-headers: add native and nativesdk tcsh: add native nativesdk BBCLASSEXTEND tbb: upgrade 2021.5.0 -> 2021.7.0 Omkar Patil (1): ntfs-3g-ntfsprogs: Upgrade 2022.5.17 to 2022.10.3 Ovidiu Panait (1): multipath-tools: upgrade 0.8.4 -> 0.9.3 Peter Bergin (1): sysbench: Upgrade 0.4.12 -> 1.0.20 Peter Kjellerstedt (4): chrony: Make it possible to enable editline support again chrony: Remove the libcap and nss PACKAGECONFIGs Revert "lldpd: Use github release assets for SRC_URI" lldpd: Correct the checksum for the tar ball to match 1.0.16 Preeti Sachan (1): fluidsynth: update SRC_URI to remove non-existing 2.2.x branch Roger Knecht (1): python3-rapidjson: add recipe Sakib Sajal (1): minio: fix license information Samuli Piippo (1): protobuf: stage protoc binary to sysroot Tim Orling (4): libio-pty-perl: upgrade 1.16 -> 1.17; enable ptest libmozilla-ca-perl: add recipe for 20221114 libio-socket-ssl-perl: upgrade 2.075 -> 2.076 libtest-warnings-perl: move to oe-core Tomasz Żyjewski (2): python3-binwalk: add recipe for version 2.3.3 python3-uefi-firmware: add recipe for version 1.9 Wang Mingyu (190): byacc: upgrade 20220128 -> 20221106 libforms: upgrade 1.2.4 -> 1.2.5pre1 libnftnl: upgrade 1.2.3 -> 1.2.4 mpich: upgrade 4.0.2 -> 4.0.3 python3-u-msgpack-python: upgrade 2.7.1 -> 2.7.2 python3-aiosignal: upgrade 1.2.0 -> 1.3.1 python3-eth-hash: upgrade 0.5.0 -> 0.5.1 python3-frozenlist: upgrade 1.3.1 -> 1.3.3 python3-google-auth: upgrade 2.14.0 -> 2.14.1 python3-greenlet: upgrade 2.0.0 -> 2.0.1 python3-imageio: upgrade 2.22.3 -> 2.22.4 python3-pycocotools: upgrade 2.0.5 -> 2.0.6 babl: upgrade 0.1.96 -> 0.1.98 ctags: upgrade 5.9.20221106.0 -> 5.9.20221113.0 gegl: upgrade 0.4.38 -> 0.4.40 freerdp: upgrade 2.8.1 -> 2.9.0 glibmm-2.68: upgrade 2.72.1 -> 2.74.0 googlebenchmark: upgrade 1.7.0 -> 1.7.1 gnome-backgrounds: upgrade 42.0 -> 43 nano: upgrade 6.4 -> 7.0 networkmanager-openvpn: upgrade 1.10.0 -> 1.10.2 python3-django: upgrade 4.1 -> 4.1.3 python3-flask-migrate: upgrade 3.1.0 -> 4.0.0 python3-eth-utils: upgrade 2.0.0 -> 2.1.0 python3-eventlet: upgrade 0.33.1 -> 0.33.2 python3-googleapis-common-protos: upgrade 1.56.4 -> 1.57.0 python3-google-api-python-client: upgrade 2.65.0 -> 2.66.0 python3-pymongo: upgrade 4.3.2 -> 4.3.3 lldpd: upgrade 1.0.15 -> 1.0.16 audit: upgrade 3.0.8 -> 3.0.9 ccid: upgrade 1.5.0 -> 1.5.1 colord: upgrade 1.4.5 -> 1.4.6 ctags: upgrade 5.9.20221113.0 -> 5.9.20221120.0 flatbuffers: upgrade 22.10.26 -> 22.11.23 libglvnd: upgrade 1.5.0 -> 1.6.0 gensio: upgrade 2.5.2 -> 2.6.1 mg: upgrade 20220614 -> 20221112 nbdkit: upgrade 1.33.2 -> 1.33.3 xfstests: upgrade 2022.10.30 -> 2022.11.06 pcsc-lite: upgrade 1.9.8 -> 1.9.9 python3-matplotlib-inline: upgrade 0.1.2 -> 0.1.6 python3-astroid: upgrade 2.12.12 -> 2.12.13 python3-asyncinotify: upgrade 2.0.5 -> 2.0.8 python3-charset-normalizer: upgrade 3.0.0 -> 3.0.1 python3-dateparser: upgrade 1.1.0 -> 1.1.4 python3-can: upgrade 4.0.0 -> 4.1.0 python3-flask-socketio: upgrade 5.3.1 -> 5.3.2 python3-ipython: upgrade 8.2.0 -> 8.6.0 python3-langtable: upgrade 0.0.60 -> 0.0.61 python3-jedi: upgrade 0.18.1 -> 0.18.2 python3-grpcio-tools: upgrade 1.50.0 -> 1.51.0 python3-grpcio: upgrade 1.50.0 -> 1.51.0 python3-networkx: upgrade 2.8.7 -> 2.8.8 python3-pyatspi: upgrade 2.38.2 -> 2.46.0 python3-pandas: upgrade 1.5.1 -> 1.5.2 python3-pybind11-json: upgrade 0.2.11 -> 0.2.13 python3-pychromecast: upgrade 12.1.4 -> 13.0.1 python3-pycodestyle: upgrade 2.9.1 -> 2.10.0 xterm: upgrade 373 -> 377 smarty: upgrade 4.2.1 -> 4.3.0 spdlog: upgrade 1.10.0 -> 1.11.0 python3-pyperf: upgrade 2.4.1 -> 2.5.0 python3-pyflakes: upgrade 2.5.0 -> 3.0.1 python3-pymisp: upgrade 2.4.157 -> 2.4.165.1 capnproto: upgrade 0.10.2 -> 0.10.3 libass: upgrade 0.16.0 -> 0.17.0 ctags: upgrade 5.9.20221120.0 -> 5.9.20221127.0 libio-socket-ssl-perl: upgrade 2.076 -> 2.077 python3-grpcio-tools: upgrade 1.51.0 -> 1.51.1 python3-asyncinotify: upgrade 2.0.8 -> 3.0.1 python3-grpcio: upgrade 1.51.0 -> 1.51.1 opensc: upgrade 0.22.0 -> 0.23.0 python3-ipython: upgrade 8.6.0 -> 8.7.0 ply: upgrade 2.2.0 -> 2.3.0 python3-apt: upgrade 2.3.0 -> 2.5.0 poppler: upgrade 22.11.0 -> 22.12.0 python3-asttokens: upgrade 2.1.0 -> 2.2.0 python3-cbor2: upgrade 5.4.3 -> 5.4.5 python3-geomet: upgrade 0.3.0 -> 1.0.0 python3-google-api-core: upgrade 2.10.2 -> 2.11.0 python3-google-api-python-client: upgrade 2.66.0 -> 2.68.0 python3-path: upgrade 16.5.0 -> 16.6.0 python3-google-auth: upgrade 2.14.1 -> 2.15.0 zabbix: upgrade 6.2.4 -> 6.2.5 xmlsec1: upgrade 1.2.36 -> 1.2.37 smcroute: upgrade 2.5.5 -> 2.5.6 python3-protobuf: upgrade 4.21.9 -> 4.21.10 python3-traitlets: upgrade 5.5.0 -> 5.6.0 python3-twine: upgrade 4.0.1 -> 4.0.2 python3-web3: upgrade 5.31.1 -> 5.31.2 python3-ujson: upgrade 5.5.0 -> 5.6.0 ctags: upgrade 5.9.20221127.0 -> 5.9.20221204.0 dnsmasq: upgrade 2.87 -> 2.88 flatbuffers: upgrade 22.11.23 -> 22.12.06 nbdkit: upgrade 1.33.3 -> 1.33.4 hwdata: upgrade 0.364 -> 0.365 evolution-data-server: update 3.46.1 -> 3.46.2 xfstests: upgrade 2022.11.06 -> 2022.11.27 python3-protobuf: upgrade 4.21.10 -> 4.21.11 python3-traitlets: upgrade 5.6.0 -> 5.7.0 python3-redis: upgrade 4.3.5 -> 4.4.0 python3-web3: upgrade 5.31.2 -> 5.31.3 python3-asttokens: upgrade 2.2.0 -> 2.2.1 python3-cbor2: upgrade 5.4.5 -> 5.4.6 python3-google-api-python-client: upgrade 2.68.0 -> 2.69.0 python3-gmpy2: upgrade 2.1.2 -> 2.1.3 python3-multidict: upgrade 6.0.2 -> 6.0.3 python3-watchdog: upgrade 2.1.9 -> 2.2.0 python3-pychromecast: upgrade 13.0.1 -> 13.0.2 python3-pymisp: upgrade 2.4.165.1 -> 2.4.166 python3-pytest-xdist: upgrade 3.0.2 -> 3.1.0 python3-yarl: upgrade 1.8.1 -> 1.8.2 zabbix: upgrade 6.2.5 -> 6.2.6 python3-yamlloader: upgrade 1.1.0 -> 1.2.2 tio: upgrade 2.3 -> 2.4 ctags: upgrade 5.9.20221204.0 -> 6.0.20221218.0 dash: upgrade 0.5.11.5 -> 0.5.12 nanopb: upgrade 0.4.6.4 -> 0.4.7 libio-socket-ssl-perl: upgrade 2.077 -> 2.078 libfile-slurper-perl: upgrade 0.013 -> 0.014 protobuf: upgrade 3.21.10 -> 3.21.12 python3-alembic: upgrade 1.8.1 -> 1.9.0 nano: upgrade 7.0 -> 7.1 python3-gmpy2: upgrade 2.1.3 -> 2.1.5 python3-eth-account: upgrade 0.7.0 -> 0.8.0 python3-google-api-python-client: upgrade 2.69.0 -> 2.70.0 python3-protobuf: upgrade 4.21.11 -> 4.21.12 python3-pycares: upgrade 4.2.2 -> 4.3.0 python3-pycurl: upgrade 7.45.1 -> 7.45.2 python3-pychromecast: upgrade 13.0.2 -> 13.0.4 python3-pyproj: upgrade 3.4.0 -> 3.4.1 python3-pydicti: upgrade 1.1.6 -> 1.2.0 python3-sentry-sdk: upgrade 1.11.1 -> 1.12.0 python3-traitlets: upgrade 5.7.0 -> 5.7.1 tio: upgrade 2.4 -> 2.5 python3-sqlalchemy: upgrade 1.4.44 -> 1.4.45 xfsdump: upgrade 3.1.11 -> 3.1.12 python3-isort: upgrade 5.10.1 -> 5.11.3 xfstests: upgrade 2022.11.27 -> 2022.12.11 ctags: upgrade 6.0.20221218.0 -> 6.0.20221225.0 gst-editing-services: upgrade 1.20.4 -> 1.20.5 logcheck: upgrade 1.3.24 -> 1.4.0 memtester: upgrade 4.5.1 -> 4.6.0 libmime-types-perl: upgrade 2.22 -> 2.23 metacity: upgrade 3.46.0 -> 3.46.1 python3-alembic: upgrade 1.9.0 -> 1.9.1 xfstests: upgrade 2022.12.11 -> 2022.12.18 python3-cytoolz: upgrade 0.12.0 -> 0.12.1 python3-asgiref: upgrade 3.5.2 -> 3.6.0 python3-autobahn: upgrade 22.7.1 -> 22.12.1 python3-coverage: upgrade 6.5.0 -> 7.0.1 python3-bitarray: upgrade 2.6.0 -> 2.6.1 python3-imageio: upgrade 2.22.4 -> 2.23.0 python3-isort: upgrade 5.11.3 -> 5.11.4 python3-multidict: upgrade 6.0.3 -> 6.0.4 python3-traitlets: upgrade 5.7.1 -> 5.8.0 python3-pymisp: upgrade 2.4.166 -> 2.4.167 python3-sentry-sdk: upgrade 1.12.0 -> 1.12.1 python3-supervisor: upgrade 4.2.4 -> 4.2.5 wolfssl: upgrade 5.5.3 -> 5.5.4 remmina: upgrade 1.4.28 -> 1.4.29 ser2net: upgrade 4.3.10 -> 4.3.11 tesseract: upgrade 5.2.0 -> 5.3.0 network-manager-applet: upgrade 1.26.0 -> 1.30.0 byacc: upgrade 20221106 -> 20221229 ctags: upgrade 6.0.20221225.0 -> 6.0.20230101.0 flashrom: upgrade 1.2 -> 1.2.1 fontforge: upgrade 20220308 -> 20230101 hunspell: upgrade 1.7.1 -> 1.7.2 libmime-types-perl: upgrade 2.23 -> 2.24 libnet-dns-perl: upgrade 1.35 -> 1.36 tepl: upgrade 6.2.0 -> 6.4.0 tcpdump: upgrade 4.99.1 -> 4.99.2 traceroute: upgrade 2.1.0 -> 2.1.1 openwsman: upgrade 2.7.1 -> 2.7.2 pcsc-tools: upgrade 1.6.0 -> 1.6.1 poppler: upgrade 22.12.0 -> 23.01.0 rsnapshot: upgrade 1.4.4 -> 1.4.5 tree: upgrade 2.0.4 -> 2.1.0 python3-bidict: upgrade 0.22.0 -> 0.22.1 python3-bitarray: upgrade 2.6.1 -> 2.6.2 python3-dateparser: upgrade 1.1.4 -> 1.1.5 python3-lz4: upgrade 4.0.2 -> 4.3.2 python3-mock: upgrade 4.0.3 -> 5.0.0 python3-pillow: upgrade 9.3.0 -> 9.4.0 python3-pydantic: upgrade 1.10.2 -> 1.10.4 python3-pyephem: upgrade 4.1.3 -> 4.1.4 python3-xlsxwriter: upgrade 3.0.3 -> 3.0.5 python3-xxhash: upgrade 3.1.0 -> 3.2.0 dnf-plugins/rpm.py: Fix grammar when RPM_PREFER_ELF_ARCH doesn't exit. Xiangyu Chen (1): lldpd: add ptest for lldpd package Yi Zhao (13): libpwquality: set correct pam plugin directory ostree: add runtime dependency bubblewrap for PACKAGECONFIG[selinux] ostree: fix selinux policy rebuild error on first deployment frr: upgrade 8.3.1 -> 8.4.1 open-vm-tools: upgrade 12.1.0 -> 12.1.5 libtdb: upgrade 1.4.3 -> 1.4.7 libldb: upgrade 2.3.4 -> 2.6.1 libtalloc: upgrade 2.3.3 -> 2.3.4 libtevent: upgrade 0.10.2 -> 0.13.0 samba upgrade 4.14.14 -> 4.17.4 krb5: upgrade 1.17.2 -> 1.20.1 grubby: update to latest git rev grubby: drop version 8.40 Zheng Qiu (1): python3-inotify: add ptest persianpros (1): samba: Remove samba related PYTHONHASHSEED patches and use export function zhengrq.fnst@fujitsu.com (15): python3-pymodbus: upgrade 3.0.0 -> 3.0.2 python3-pywbemtools: upgrade 1.0.1 -> 1.1.0 python3-stevedore: upgrade 4.1.0 -> 4.1.1 ser2net: upgrade 4.3.9 -> 4.3.10 yelp-tools: upgrade 42.0 -> 42.1 python3-python-vlc: upgrade 3.0.16120 -> 3.0.18121 python3-sqlalchemy: upgrade 1.4.43 -> 1.4.44 python3-zopeinterface: upgrade 5.5.1 -> 5.5.2 python3-simplejson: upgrade 3.17.6 -> 3.18.0 python3-pywbemtools: upgrade 1.0.1 -> 1.1.1 python3-redis: upgrade 4.3.4 -> 4.3.5 python3-texttable: upgrade 1.6.4 -> 1.6.7 python3-sentry-sdk: upgrade 1.9.10 -> 1.11.1 python3-twitter: upgrade 4.10.1 -> 4.12.1 python3-termcolor: upgrade 2.1.0 -> 2.1.1 meta-security: 2aa48e6f4e..f991b20f56: Alex Kiernan (1): bubblewrap: Update 0.6.2 -> 0.7.0 Armin Kuster (2): python3-privacyidea: update to 2.7.4 chipsec: update to 1.9.1 Michael Haener (1): tpm2-tools: update to 5.3 meta-arm: d5f132b199..5c42f084f7: Adam Johnston (1): arm/trusted-services: Fix 'no such file' when building libts Adrian Herrera (2): atp: decouple m5readfile from m5ops atp: move m5readfile to meta-gem5 Adrián Herrera Arcila (5): atp: fix failing test_readme gem5: support for EXTRAS atp: separate recipe for gem5 models atp: fix machine overrides in recipes ci: add meta-atp to check-layers David Bagonyi (1): meta-arm-toolchain: Drop calls to datastore finalize Diego Sueiro (2): arm/classes: Introduce apply_local_src_patches bbclass arm/trusted-firmware-m: Fix local source patches application Emekcan (1): arm/fvp: Upgrade Corstone1000 FVP Emekcan Aras (6): arm-bsp/documentation: corstone1000: update the user guide arm/optee: Move optee-3.18 patches arm/optee: support optee 3.19 arm-bsp/optee-os: Adds 3.19 bbappend arm-bsp/optee-os: N1SDP support for optee-os 3.19 arm/qemuarm-secureboot: pin optee-os version Jon Mason (5): arm-bsp/trusted-services: rename bbappends with git version arm/trusted-services: limit the ts compatible machines arm-bsp/trusted-services: add n1sdp support arm/trusted-firmware-m: update to 1.6.1 CI: define DEFAULT_TAG and CPU_REQUEST Khem Raj (1): gn: Replace lfs64 functions with original counterparts Mohamed Omar Asaker (5): arm-bsp/trusted-services: corstone1000: Use the stateless platform service calls arm-bsp/trusted-firmware-m: Bump TFM to v1.7 arm-bsp/trusted-firmware-m: corstone1000: TFM 1.7 arm-bsp/musca_b1: Edit the platform name arm-bsp/trusted-firmware-m: Remove TF-M 1.6 recipe Peter Hoyes (3): arm/fvp: Backport shlex.join from Python 3.8 arm/fvpboot: Disable timing annotation by default arm/classes: Ensure patch files are sorted in apply_local_src_patches Robbie Cao (1): arm/fvp-base-r-aem: upgrade to version 11.20.15 Ross Burton (17): CI: revert a meta-clang change which breaks pixman (thus, xserver) CI: add variables needed for k8s runners CI: add tags to all jobs CI: no need to install telnet CI: fix builds with clang CI: use the .setup fragment in machine-coverage arm/fvp-base-a-aem: upgrade to 11.20.15 arm-bsp/edk2-firmware: allow clang builds on juno ci/get-binary-toolchains: rewrite, slightly arm-bsp/documentation: update fvp-base documentation to use runfvp CI: use qemuarm64 for pending-updates report job meta-atp: remove meta-gem5: remove arm/fvp-envelope: name the FVP tarballs for checksums arm/fvp-envelope: update HOMEPAGE arm/fvp-base-a-aem: add support for aarch64 binaries CI: don't pin fvp-base jobs to x86-64 poky: 44bb88cc86..0ce159991d: Alejandro Hernandez Samaniego (6): baremetal-image: Avoid overriding qemu variables from IMAGE_CLASSES rust: Enable building rust from stable, beta and nightly channels rust: Enable baremetal targets baremetal-helloworld: Enable x86 and x86-64 ports baremetal-helloworld: Move from skeleton to recipes-extended matching what rust-hello-world is doing oe-selftest: Add baremetal toolchain test Alex Kiernan (20): rust: Install target.json for target rustc rust: update 1.65.0 -> 1.66.0 oeqa/runtime/rust: Add basic compile/run test libstd-rs: Merge .inc into .bb libstd-rs: Move source directory to library/test rust-llvm: Merge .inc into .bb rust-llvm: Update LLVM_VERSION to match embedded version packagegroup-rust-sdk-target: Add Rust SDK target packagegroup packagegroup-core-sdk: Add SDK toolchain language selection support rust: Merge .inc into .bb rust: Move musl-x86 fix for `__stack_chk_fail_local` to rust-source cargo: Merge .inc into .bb cargo: Extend DEBUG_PREFIX_MAP to cover vendor cargo: Include crossbeam-utils patch cargo: Drop exclude from world packagegroup-rust-sdk-target: Add cargo oeqa/runtime/rust: Add cargo test classes: image: Set empty weak default IMAGE_LINGUAS default-distrovars: Include "c" in IMAGE_LINGUAS for glibc rust: Merge all rustc-source patches into rust-source.inc Alex Stewart (2): lsof: add update-alternatives logic opkg: upgrade to version 0.6.1 Alexander Kanavin (155): elfutils: update 0.187 -> 0.188 rsync: update 3.2.5 -> 3.2.7 swig: update 4.0.2 -> 4.1.0 tcl: update 8.6.11 -> 8.6.12 quota: update 4.06 -> 4.09 shadow: update 4.12.3 -> 4.13 texinfo: update 6.8 -> 7.0 libhandy: update 1.6.3 -> 1.8.0 xf86-input-mouse: update 1.9.3 -> 1.9.4 flac: update 1.4.0 -> 1.4.2 icu: update 71.1 -> 72-1 libgpg-error: update 1.45 -> 1.46 popt: update 1.18 -> 1.19 vte: update 0.68.0 -> 0.70.1 webkitgtk: update 2.36.7 -> 2.38.2 man-db: update 2.10.2 -> 2.11.1 gawk: update 5.1.1 -> 5.2.1 unfs: update 0.9.22 -> 0.10.0 qemu-helper: depend on unfs3 and pseudo directly runqemu: do not hardcode the ip address of the nfs server when using tap selftest/runqemu: reenable the nfs rootfs test glibc-tests: correctly pull in the actual tests when installing -ptest package python3: fix tests on x86 (32 bit) ptest-packagelists.inc: do not run valgrind ptests on 32 bit x86 python3: use the standard shell version of python3-config python3targetconfig.bbclass: use PYTHONPATH to point to the target config bitbake: fetch2/wget.py: correctly match versioned directories devtool/upgrade: correctly handle recipes where S is a subdir of upstream tree python3-numpy: fix upstream version check python3-poetry-core: update 1.3.2 -> 1.4.0 tcl: update 8.6.12 -> 8.6.13 libnewt: update 0.52.21 -> 0.52.23 libxdmcp: update 1.1.3 -> 1.1.4 libxpm: update 3.5.13 -> 3.5.14 libxrandr: update 1.5.2 -> 1.5.3 bluez: update 5.65 -> 5.66 libxcrypt: update PV to match SRCREV python3-dbusmock: update 0.28.4 -> 0.28.6 ruby: merge .inc into .bb ruby: update 3.1.2 -> 3.1.3 ghostscript: update 9.56.1 -> 10.0.0 tzdata: update 2022d -> 2022g systemtap: upgrade 4.7 -> 4.8 gnupg: upgrade 2.3.7 -> 2.3.8 ptest-packagelists.inc: correctly assign fast and slow tests ovmf: update edk2-stable202208 -> edk2-stable202211 llvm: update 15.0.4 -> 15.0.6 tcmode-default.inc: set LLVMVERSION to a major version wildcard cmake: update 3.24.2 -> 3.25.1 python3-native: further tweak to sysconfig.py to find python includes correctly libslirp: add recipe to continue slirp support in qemu qemu: update 7.1.0 -> 7.2.0 systemd: update 251.8 -> 252.4 dpkg: update 1.21.9 -> 1.21.13 python3-installer: update 0.5.1 -> 0.6.0 python3: update 3.11.0 -> 3.11.1 weston: update 11.0.0 -> 11.0.1 xhost: update 1.0.8 -> 1.0.9 xinit: update 1.4.1 -> 1.4.2 xkbcomp: update 1.4.5 -> 1.4.6 xprop: update 1.2.5 -> 1.2.6 xset: update 1.2.4 -> 1.2.5 xvinfo: update 1.1.4 -> 1.1.5 xf86-video-vesa: update 2.5.0 -> 2.6.0 libice: update 1.0.10 -> 1.1.1 libxcomposite: update 0.4.5 -> 0.4.6 libxdamage: update 1.1.5 -> 1.1.6 libxres: update 1.2.1 -> 1.2.2 libxscrnsaver: update 1.2.3 -> 1.2.4 libxv: update 1.0.11 -> 1.0.12 jquery: upgrade 3.6.1 -> 3.6.2 libmodule-build-perl: update 0.4231 -> 0.4232 python3-chardet: upgrade 5.0.0 -> 5.1.0 libarchive: upgrade 3.6.1 -> 3.6.2 stress-ng: upgrade 0.15.00 -> 0.15.01 vulkan: upgrade 1.3.231.1 -> 1.3.236.0 Revert "python3-native: further tweak to sysconfig.py to find python includes correctly" conf/machine/include: add x86-64-v3 tunes (AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE) go: update 1.19.3 -> 1.19.4 vulkan-samples: update to latest revision boost-build-native: update 1.80.0 -> 1.81.0 qemu: disable sporadically failing test-io-channel-command devtool: process local files only for the main branch libportal: add from meta-openembedded/meta-gnome libportal: convert from gtk-doc to gi-docgen epiphany: update 42.4 -> 43.0 qemux86-64: build for x86-64-v3 (2013 Haswell and later) rather than Core 2 from 2006 valgrind: disable tests that started failing after switching to x86-64-v3 target glib-2.0: upgrade 2.74.3 -> 2.74.4 jquery: upgrade 3.6.2 -> 3.6.3 nasm: update 2.15.05 -> 2.16.01 ffmpeg: use nasm patched-in debug-prefix-map option to restore reproducibility gtk+3: update 3.24.35 -> 3.24.36 libva-utils: update 2.16.0 -> 2.17.0 xcb-util: update 0.4.0 -> 0.4.1 gnupg: update 2.3.8 -> 2.4.0 libksba: update 1.6.2 -> 1.6.3 python3-pycryptodomex: upgrade 3.15.0 -> 3.16.0 piglit: upgrade to latest revision python3-setuptools-scm: upgrade 7.0.5 -> 7.1.0 python3-attrs: upgrade 22.1.0 -> 22.2.0 webkitgtk: upgrade 2.38.2 -> 2.38.3 linux-firmware: upgrade 20221109 -> 20221214 harfbuzz: upgrade 5.3.1 -> 6.0.0 python3-pytz: upgrade 2022.6 -> 2022.7 strace: upgrade 6.0 -> 6.1 python3-pycryptodome: upgrade 3.15.0 -> 3.16.0 meson: upgrade 0.64.0 -> 1.0.0 xwayland: upgrade 22.1.5 -> 22.1.7 python3-pyrsistent: upgrade 0.19.2 -> 0.19.3 file: upgrade 5.43 -> 5.44 python3-subunit: upgrade 1.4.1 -> 1.4.2 python3-zipp: upgrade 3.10.0 -> 3.11.0 python3-cryptography: upgrade 38.0.3 -> 38.0.4 logrotate: upgrade 3.20.1 -> 3.21.0 python3-importlib-metadata: upgrade 5.0.0 -> 5.2.0 python3-numpy: upgrade 1.23.4 -> 1.24.1 xserver-xorg: upgrade 21.1.4 -> 21.1.6 puzzles: upgrade to latest revision vte: upgrade 0.70.1 -> 0.70.2 libpsl: upgrade 0.21.1 -> 0.21.2 libtest-fatal-perl: upgrade 0.016 -> 0.017 python3-urllib3: upgrade 1.26.12 -> 1.26.13 python3-cryptography-vectors: upgrade 38.0.3 -> 38.0.4 python3-setuptools: upgrade 65.5.1 -> 65.6.3 libsdl2: upgrade 2.26.0 -> 2.26.1 python3-gitdb: upgrade 4.0.9 -> 4.0.10 diffoscope: upgrade 224 -> 230 python3-mako: upgrade 1.2.3 -> 1.2.4 python3-sphinx: upgrade 5.3.0 -> 6.0.0 libsolv: upgrade 0.7.22 -> 0.7.23 ruby: upgrade 3.1.3 -> 3.2.0 python3-lxml: upgrade 4.9.1 -> 4.9.2 python3-git: upgrade 3.1.29 -> 3.1.30 curl: upgrade 7.86.0 -> 7.87.0 kmscube: upgrade to latest revision gobject-introspection: upgrade 1.72.0 -> 1.74.0 python3-dtschema: upgrade 2022.11 -> 2022.12 bash: upgrade 5.2.9 -> 5.2.15 kexec-tools: upgrade 2.0.25 -> 2.0.26 python3-jsonschema: upgrade 4.17.0 -> 4.17.3 python3-pycairo: upgrade 1.21.0 -> 1.23.0 nghttp2: upgrade 1.50.0 -> 1.51.0 python3-certifi: upgrade 2022.9.24 -> 2022.12.7 python3-hypothesis: upgrade 6.57.1 -> 6.61.0 libsndfile1: upgrade 1.1.0 -> 1.2.0 repo: upgrade 2.29.9 -> 2.31 libpcap: upgrade 1.10.1 -> 1.10.2 python3-jsonschema: depend on rfc3339-validator in all cases python3-strict-rfc3339: remove the recipe elfutils: do not error out on deprecated declarations gcr3: limit version check to 3.x versions without odd-even rule ncurses: restore version check as it's now again working due to release of 6.4 tiff: update 4.4.0 -> 4.5.0 qemu: fix recent reproducibility issues Alexey Smirnov (1): classes: make TOOLCHAIN more permissive for kernel Anton Antonov (1): rust: Do not use default compiler flags defined in CC crate Antonin Godard (2): busybox: always start do_compile with orig config files busybox: rm temporary files if do_compile was interrupted Atanas Bunchev (1): qemu.rst: slirp port forwarding details Bruce Ashfield (30): linux-yocto-dev: bump to v6.0+ linux-yocto/5.19: update to v5.19.16 linux-yocto/5.15: update to v5.15.74 linux-yocto/5.19: update to v5.19.17 linux-yocto/5.15: update to v5.15.76 linux-yocto/5.19: cfg: intel and vesa updates kern-tools: integrate ZFS speedup patch linux-yocto-dev: bump to v6.1 kernel-devsrc: fix for v6.1+ lttng-modules: fix build for v6.1+ linux-yocto/5.19: security.cfg: remove configs which have been dropped linux-yocto/5.15: update to v5.15.78 linux-yocto/5.19: fix CONFIG_CRYPTO_CCM mismatch warnings linux-yocto/5.15: fix CONFIG_CRYPTO_CCM mismatch warnings linux-yocto/5.19: fix elfutils run-backtrace-native-core ptest failure linux-libc-headers: add 6.x fetch location linux-libc-headers: bump to 6.1 linux-yocto/5.19: fix perf build with clang linux-yocto/5.15: ltp and squashfs fixes linux-yocto: introduce v6.1 reference kernel recipes linux-yocto/5.15: fix perf build with clang linux-yocto/5.15: libbpf: Fix build warning on ref_ctr_off linux-yocto/5.15: update to v5.15.84 linux-yocto/6.1: update to v6.1.1 linux-yocto/5.15: powerpc: Fix reschedule bug in KUAP-unlocked user copy linux-yocto/5.19: powerpc: Fix reschedule bug in KUAP-unlocked user copy linux-yocto/6.1: update to v6.1.3 linux-yocto/6.1: cfg: remove CONFIG_ARM_CRYPTO yocto-bsps/5.15: update to v5.15.78 linux-yocto/5.15: update to v5.15.80 Carlos Alberto Lopez Perez (3): xwayland: libxshmfence is needed when dri3 is enabled recipes: Enable nativesdk for gperf, unifdef, gi-docgen and its dependencies mesa-gl: gallium is required when enabling x11 Changqing Li (2): base.bbclass: Fix way to check ccache path sqlite3: upgrade 3.40.0 -> 3.40.1 Charlie Johnston (1): opkg: ensure opkg uses private gpg.conf when applying keys. Chee Yang Lee (1): migration-guides: add release-notes for 4.1.1 Chen Qi (10): kernel.bbclass: make KERNEL_DEBUG_TIMESTAMPS work at rebuild resolvconf: make it work dhcpcd: fix to work with systemd bitbake: command.py: cleanup bb.cache.parse_recipe psplash: consider the situation of psplash not exist for systemd bc: extend to nativesdk rm_work: adjust dependency to make do_rm_work_all depend on do_rm_work selftest: allow '-R' and '-r' be used together dhcpcd: backport two patches to fix runtime error libseccomp: fix typo in DESCRIPTION Christian Eggers (1): boost: add url lib David Bagonyi (1): u-boot: Fix u-boot signing when building with multiple u-boot configs Dmitry Baryshkov (2): linux-firmware: upgrade 20221012 -> 20221109 linux-firmware: add new fw file to ${PN}-qcom-adreno-a530 Enguerrand de Ribaucourt (1): bitbake-layers: fix a typo Enrico Jörns (1): sstatesig: emit more helpful error message when not finding sstate manifest Enrico Scholz (1): sstate: show progress bar again Fabre Sébastien (1): u-boot: Add /boot in SYSROOT_DIRS Frank de Brabander (4): bitbake: README: Improve explanation about running the testsuite bitbake: bin/utils: Ensure locale en_US.UTF-8 is available on the system bitbake: process: log odd unlink events with bitbake.sock bitbake: README: add required python version for bitbake Harald Seiler (1): opkg: Set correct info_dir and status_file in opkg.conf Jagadeesh Krishnanjanappa (1): qemuboot.bbclass: make sure runqemu boots bundled initramfs kernel image Jan Kircher (1): toolchain-scripts: compatibility with unbound variable protection Javier Tia (1): poky.conf: Add Fedora 36 as supported distro Joe Slater (2): python3: Fix CVE-2022-37460 libarchive: fix CVE-2022-36227 Jose Quaresma (2): Revert "gstreamer1.0: disable flaky gstbin:test_watch_for_state_change test" gstreamer1.0: Fix race conditions in gstbin tests Joshua Watt (4): qemu-helper-native: Correctly pass program name as argv[0] bitbake: cooker: Use event to terminate parser threads bitbake: cooker: Start sync thread a little earlier bitbake: bitbake: Convert to argparse Kai Kang (4): xorg-lib-common.inc: set default value of XORG_EXT libx11-compose-data: 1.6.8 -> 1.8.3 libx11: 1.8.1 -> 1.8.3 libsm: 1.2.3 > 1.2.4 Kasper Revsbech (1): bitbake: fetch2/wget: handle username/password in uri Khem Raj (47): rsync: Delete pedantic errors re-ordering patch pseudo: Disable LFS on 32bit arches libxkbcommon: Extend to build native package iso-codes: Extend to build native packages xkeyboard-config: Extend to build native package bluez5: enable position independent executables flag rpcsvc-proto: Use autoconf knob to enable largefile support gptfdisk: Enable largefile support functions libpcre2: Upgrade to 10.42 erofs-utils: Convert from off64_t to off_t pseudo: Remove 64bit time_t flags unfs3: Define off64_t in terms of off_t on musl acpid: Fix largefile enabled build efivar: Replace off64_t with off_t ltp: Fix largefile support acl: Enable largefile support by default libpciaccess: Do not use 64bit functions for largefile support mdadm: Use _FILE_OFFSET_BITS to use largefile support btrfs-tools: Do not use 64bit functions for largefile support e2fsprogs: Do not use 64bit functions for largefile support libbsd: Fix build with largefile support gpgme: Fix with with largefile support virglrenderer: Replace lseek64 with lseek nfs-utils: Replace statfs64 with statfs alsa-utils: Replace off64_t with off_t lttng-tools: Fix build with largefile support strace: Add knob to enable largefile support numactl: Enable largefile support qemu: Fix build with largefile support systemd: Fix 252 release build on musl rust: Do not use open64 on musl in getrandom crate rust,libstd-rs: Fix build with latest musl rust-llvm: Fix build on latest musl cargo: Do not use open64 on musl anymore llvm: Do not use lseek64 strace: Replace off64_t with off_t in sync_file_range.c test vulkan-samples: Do not use LFS64 APIs in spdlog pulseaudio: Do not use 64bit time_t flags musl: Update to latest on tip of trunk rust: Fix build with 64bit time_t stress-ng: Do not enforce gold linker time64.inc: Add GLIBC_64BIT_TIME_FLAGS on ppc/x86 as well time64: Remove leading whitespace from GLIBC_64BIT_TIME_FLAGS mpg123: Enable largefile support site/powerpc32-linux: Do not cache statvfs64 across glibc and musl tiff: Add packageconfig knob for webp site/common-musl: Set ac_cv_sys_file_offset_bits default to 64 Lee Chee Yang (1): migration-guides: add release-notes for 4.0.6 Luca Boccassi (2): systemd: refresh patch to remove fuzz introduced by rebase on v252 systemd: ship pcrphase/measure tools and units in systemd-extra-utils Luis (1): rm_work.bbclass: use HOSTTOOLS 'rm' binary exclusively Marek Vasut (5): bitbake: fetch2/git: Prevent git fetcher from fetching gitlab repository metadata package_rpm: Fix Linux 6.1.0 perf 1.0 version mistranslation systemd: Make importd depend on glib-2.0 again bitbake: bitbake-user-manual: Document override :append, :prepend, :remove order bitbake: fetch2/git: Clarify the meaning of namespace Markus Volk (12): ell: upgrade 0.53 -> 0.54 libsdl2: update 2.24.2 -> 2.26.0 graphene: import from meta-oe gtk4: import recipe from meta-gnome gcr: rename gcr -> gcr3 gcr: add recipe for gcr-4, needed to build with gtk4 epiphany: use gcr3 gtk4: add tracker-miners runtime dependency python3-dbusmock: allow to build native gtk4: update 4.8.2 -> 4.8.3 gcr3: update 3.40.0 -> 3.41.1 librsvg: enable vapi build Marta Rybczynska (2): efibootmgr: update compilation with musl cve-update-db-native: avoid incomplete updates Martin Jansa (4): libxml2: upgrade test data from 20080827 to 20130923 nativesdk-rpm: export RPM_ETCCONFIGDIR and MAGIC in environment like RPM_CONFIGDIR nativesdk-rpm: don't create wrappers for WRAPPER_TOOLS tune-x86-64-v3.inc: set QEMU_EXTRAOPTIONS like other tune-* files Mathieu Dubois-Briand (1): dbus: Add missing CVE product name Michael Halstead (1): uninative: Upgrade to 3.8.1 to include libgcc Michael Opdenacker (34): manuals: add missing references to classes manuals: fix paragraphs with the "inherit" word ref-manual/classes.rst: remove reference to sip.bbclass manuals: simplify .gitignore files manuals: split dev-manual/common-tasks.rst dev-manual/sbom.rst: minor corrections bitbake: bitbake-user-manual: update references to Yocto Project manual bitbake.conf: remove SERIAL_CONSOLE variable bitbake: bitbake-user-manual: add reference to bitbake git repository ref-manual: add references to variables only documented in the BitBake manual manuals: add reference to yocto-docs git repository to page footer manuals: add missing references to variables manuals: add missing SPDX license header to source files manuals: fix double colons ref-manual/resources.rst: fix formating ref-manual: update references to release notes manual: improve documentation about using external toolchains ref-manual/images.rst: fix unnumbered list manuals: define proper numbered lists manuals: final removal of SERIAL_CONSOLE variable ref-manual/resources.rst: improve description of mailing lists ref-manual/system-requirements.rst: update buildtools instructions manuals: create references to buildtools documentation/poky.yaml.in: update minimum python version to 3.8 manuals: prepare 4.2 migration notes bitbake: bitbake-user-manual: double colon fix bitbake: bitbake-user-manual: remove "OEBasic" signature generator migration-guides: fix 4.2 migration note issues toaster-manual: fix description of introduction video ref-manual/classes.rst: remove .bbclass from section titles manuals: simplify references to classes migration-1.6.rst: fix redundant reference ref-manual/system-requirements.rst: recommend buildtools for not supported distros .gitignore: ignore files generated by Toaster Mikko Rapeli (5): qemurunner.py: support setting slirp host IP address runqemu: limit slirp host port forwarding to localhost 127.0.0.1 qemurunner.py: use IP address from command line dev-manual/runtime-testing.rst: fix oeqa runtime test path runqemu: add QB_SETUP_CMD and QB_CLEANUP_CMD Mingli Yu (8): tcl: correct the header location in tcl.pc python3: make tkinter available when enabled sudo: add selinux and audit PACKAGECONFIG iproute2: add selinux PACKAGECONFIG util-linux: add selinux PACKAGECONFIG cronie: add selinux PACKAGECONFIG psmisc: add selinux PACKAGECONFIG gcr: add opengl to REQUIRED_DISTRO_FEATURES Narpat Mali (2): ffmpeg: fix for CVE-2022-3964 ffmpeg: fix for CVE-2022-3965 Ola x Nilsson (4): kbd: Don't build tests glibc: Add ppoll fortify symbol for 64 bit time_t insane: Add QA check for 32 bit time and file offset functions time64.conf: Include to enable 64 bit time flags Ovidiu Panait (1): kernel.bbclass: remove empty module directories to prevent QA issues Patrick Williams (1): kernel-fitimage: reduce dependency to the cpio Pavel Zhukov (1): oeqa/rpm.py: Increase timeout and add debug output Peter Kjellerstedt (1): recipes, classes: Avoid adding extra whitespace to PACKAGESPLITFUNCS Peter Marko (2): externalsrc: fix lookup for .gitmodules oeqa/selftest/externalsrc: add test for srctree_hash_files Petr Kubizňák (1): harfbuzz: remove bindir only if it exists Petr Vorel (1): iputils: update to 20221126 Polampalli, Archana (1): libpam: fix CVE-2022-28321 Qiu, Zheng (3): valgrind: remove most hidden tests for arm64 tiff: Security fix for CVE-2022-3970 vim: upgrade 9.0.0820 -> 9.0.0947 Quentin Schulz (4): cairo: update patch for CVE-2019-6461 with upstream solution cairo: fix CVE patches assigned wrong CVE number docs: kernel-dev: faq: update tip on how to not include kernel in image docs: migration-guides: migration-4.0: specify variable name change for kernel inclusion in image recipe Randy MacLeod (1): valgrind: skip the boost_thread test on arm Ranjitsinh Rathod (1): curl: Correct LICENSE from MIT-open-group to curl Ravula Adhitya Siddartha (2): linux-yocto/5.15: update genericx86* machines to v5.15.78 linux-yocto/5.19: update genericx86* machines to v5.19.17 Richard Purdie (97): bitbake: cache/cookerdata: Move recipe parsing functions from cache to databuilder bitbake: cache: Drop broken/unused code bitbake: cache: Drop unused function bitbake: server: Ensure cooker profiling works bitbake: worker/runqueue: Reduce initial data transfer in workerdata bitbake: cache: Drop support for not saving the cache file bitbake: runqueue: Add further debug for sstate reuse issues bitbake: runqueue: Fix race issues around hash equivalence and sstate reuse bitbake: data/siggen: Switch to use frozensets and optimize bitbake: data_smart: Add debugging for overrides stability issue bitbake: utils: Allow to_boolean to support int values base: Drop do_package base definition bitbake: data: Drop obsolete pydoc/path code bitbake: BBHandler: Remove pointless global variable declarations bitbake: runqueue: Improve error message for missing multiconfig bitbake: data_smart: Small cache reuse optimization bitbake.conf: Simplify CACHE setting oeqa/selftest/tinfoil: Add test for separate config_data with recipe_parse_file() qemu: Ensure libpng dependency is deterministic bitbake: data: Tweak code layout bitbake: cache/siggen: Simplify passing basehash data into the cache bitbake: siggen/cache: Optionally allow adding siggen hash data to the bitbake cache bitbake: parse: Add support for addpylib conf file directive and BB_GLOBAL_PYMODULES bitbake: cookerdata: Ensure layers use LAYERSERIES_COMPAT fairly base: Switch to use addpylib directive and BB_GLOBAL_PYMODULES devtool/friends: Use LAYERSERIES_CORENAMES when generating LAYERSERIES_COMPAT entries scripts/checklayer: Update to match bitbake changes yocto-check-layer: Allow OE-Core to be tested bitbake: main: Add timestamp to server retry messages bitbake: main/server: Add lockfile debugging upon server retry poky/poky-tiny: Drop largefile mentions lib/sstatesig: Drop OEBasic siggen bitbake: siggen: Drop non-multiconfig aware siggen support bitbake: build/siggen/runqueue: Drop do_setscene references bitbake: bitbake: Bump minimum python version requirement to 3.8 sanity: Update minimum python version to 3.8 bitbake: main/process: Add extra sockname debugging Revert "kernel-fitimage: reduce dependency to the cpio" bitbake: siggen: Directly store datacaches reference bitbake: bitbake: siggen/runqueue: Switch to using RECIPE_SIGGEN_INFO feature for signature dumping bitbake: siggen: Add dummy dataCaches from task context/datastore bitbake: build/siggen: Rework stamps functions bitbake: siggen: Clarify which fn is meant bitbake: ast/data/codeparser: Add dependencies from python module functions bitbake: codeparser/data: Add vardepsexclude support to module dependency code bitbake.conf: Add module function vardepsexclude entries time64: Rename to a .inc file to match the others bitbake: command: Add ping command bitbake: cache: Allow compression of the data in SiggenRecipeInfo bitbake: siggen: Minor code improvement bitbake: server/process: Add bitbake.sock race handling oeqa/concurrencytest: Add number of failures to summary output python3-poetry-core: Fix determinism issue breaking reproducibility bitbake: cache/siggen: Fix cache issues with signature handling bitbake: event: builtins fix for 'd' deletion bitbake: cooker: Ensure cache is cleared for partial resets bitbake: tinfoil: Ensure CommandExit is handled bitbake: cache: Drop reciever side counting for SiggenRecipeInfo bitbake: knotty: Avoid looping with tracebacks bitbake: event: Add enable/disable heartbeat code bitbake: cooker/cookerdata: Rework the way the datastores are reset bitbake: server/process: Improve exception and idle function logging bitbake: command: Tweak finishAsyncCommand ordering to avoid races bitbake: cooker: Ensure commands clean up any parser processes bitbake: server/process: Improve idle loop exit code bitbake: event: Always use threadlock bitbake: server/process: Add locking around idle functions accesses bitbake: server/process: Run idle commands in a separate idle thread bitbake: knotty: Ping the server/cooker periodically bitbake: cookerdata: Fix cache/reparsing issue bitbake: cookerdata: Fix previous commit to use a string, not a generator bitbake: command: Ensure that failure cases call finishAsyncComand layer.conf: Update to use mickledore as the layer series name layer.conf: Mark master as compatible with mickledore bitbake: lib/bb: Update thread/process locks to use a timeout package: Move fixup_perms function to bb function library package: Move get_conffiles/files_from_filevars functions to lib package: Move pkgdata handling functions to oe.packagedata package: Move emit_pkgdata to packagedata.py package: Move package functions to function library package: Drop unused function and obsolete comment package: Move mapping_rename_hook to packagedata function library python3-cython: Use PACKAGESPLITFUNCS instead of PACKAGEBUILDPKGD package: Drop support for PACKAGEBUILDPKGD function customisation recipes/classes: Drop prepend/append usage with PACKAGESPLITFUNCS bitbake: cooker: Rework the parsing results submission bitbake: cooker: Clean up inotify idle handler uninative-tarball: Add libgcc patchelf: Add fix submitted upstream for uninative segfaults bitbake: cooker/command: Drop async command handler indirection via cooker bitbake: process/cooker/command: Fix currentAsyncCommand locking/races uninative: Ensure uninative is enabled in all cases for BuildStarted event qemux86-64: Reduce tuning to core2-64 bitbake: tinfoil: Don't wait for events indefinitely bitbake: knotty: Improve shutdown handling bitbake: cooker: Fix exit handling issues bitbake: server/process: Move heartbeat to idle thread Robert Andersson (1): go-crosssdk: avoid host contamination by GOCACHE Ross Burton (28): build-appliance-image: Update to master head revision lib/buildstats: fix parsing of trees with reduced_proc_pressure directories combo-layer: remove unused import combo-layer: dont use bb.utils.rename combo-layer: add sync-revs command libxml2: upgrade 2.9.14 -> 2.10.3 libxml2: add more testing python3-packaging: upgrade to 22.0 python3-hatchling: remove python3-tomli DEPENDS python3-cryptography: remove python3-tomli RDEPENDS meson: drop redundant is_debianlike() patch meson: always use meson subcommands libepoxy: remove upstreamed patch gtk+3: upgrade 3.24.34 -> 3.24.35 gtk+3: port to Meson meson: no need to rebuild on install at-spi2-core: clean up x11 enabling at-spi2-core: disable API docs if x11 is disabled gtk+3: fix reproducible builds lsof: upgrade 4.96.4 -> 4.96.5 pango: upgrade 1.50.11 -> 1.50.12 python3-hatch-vcs: upgrade 0.2.0 -> 0.3.0 python3-hatchling: upgrade 1.11.1 -> 1.12.1 python3-pathspec: upgrade 0.10.1 -> 0.10.3 rm_work: handle non-existant stamps directory oeqa/selftest/debuginfod: improve testcase elfutils: disable deprecation errors in all builds, not just native curl: don't enable debug builds Ryan Eatmon (1): go: Update reproducibility patch to fix panic errors Sandeep Gundlupet Raju (3): libdrm: Remove libdrm-kms package kernel-fitimage: Adjust order of dtb/dtbo files kernel-fitimage: Allow user to select dtb when multiple dtb exists Saul Wold (1): at: Change when files are copied Sergei Zhmylev (1): oeqa/qemurunner: implement vmdk images support Tim Orling (7): python3-hypothesis: upgrade 6.56.4 -> 6.57.1 at-spi2-core: upgrade 2.44.1 -> 2.46.0 mirrors.bbclass: update CPAN_MIRROR libtry-tiny-perl: add recipe for 0.31 libtest-fatal-perl: add recipe for 0.016 libtest-warnings-perl: move from meta-perl liburi-perl: upgrade 5.08 -> 5.17 Trevor Woerner (1): local.conf.sample: update bbclass locations Vincent Davis Jr (1): mesa: enable glvnd support Wang Mingyu (49): btrfs-tools: upgrade 6.0 -> 6.0.1 libpipeline: upgrade 1.5.6 -> 1.5.7 btrfs-tools: upgrade 6.0.1 -> 6.0.2 bind: upgrade 9.18.8 -> 9.18.9 ccache: upgrade 4.7.2 -> 4.7.4 dropbear: upgrade 2022.82 -> 2022.83 libinput: upgrade 1.21.0 -> 1.22.0 libxft: upgrade 2.3.6 -> 2.3.7 mpfr: upgrade 4.1.0 -> 4.1.1 glib-2.0: upgrade 2.74.1 -> 2.74.3 libxcrypt-compat: upgrade 4.4.30 -> 4.4.33 patchelf: upgrade 0.16.1 -> 0.17.0 pciutils: upgrade 3.8.0 -> 3.9.0 shaderc: upgrade 2022.3 -> 2022.4 sqlite3: upgrade 3.39.4 -> 3.40.0 stress-ng: upgrade 0.14.06 -> 0.15.00 swig: upgrade 4.1.0 -> 4.1.1 texinfo: upgrade 7.0 -> 7.0.1 usbutils: upgrade 014 -> 015 xz: upgrade 5.2.7 -> 5.2.9 wayland-protocols: upgrade 1.28 -> 1.31 gnu-config: upgrade to latest revision libfontenc: upgrade 1.1.6 -> 1.1.7 libpcre2: upgrade 10.40 -> 10.41 libpng: upgrade 1.6.38 -> 1.6.39 libxau: upgrade 1.0.10 -> 1.0.11 libxkbfile: upgrade 1.1.1 -> 1.1.2 libxshmfence: upgrade 1.3.1 -> 1.3.2 xrandr: upgrade 1.5.1 -> 1.5.2 boost: upgrade 1.80.0 -> 1.81.0 ell: upgrade 0.54 -> 0.55 git: upgrade 2.38.1 -> 2.39.0 help2man: upgrade 1.49.2 -> 1.49.3 iproute2: upgrade 6.0.0 -> 6.1.0 libmpc: upgrade 1.2.1 -> 1.3.1 makedepend: upgrade 1.0.7 -> 1.0.8 psmisc: upgrade 23.5 -> 23.6 xz: upgrade 5.2.9 -> 5.4.0 gstreamer1.0: upgrade 1.20.4 -> 1.20.5 bind: upgrade 9.18.9 -> 9.18.10 btrfs-tools: upgrade 6.0.2 -> 6.1 librepo: upgrade 1.14.5 -> 1.15.1 libsdl2: upgrade 2.26.1 -> 2.26.2 libva-utils: upgrade 2.17.0 -> 2.17.1 libxkbcommon: upgrade 1.4.1 -> 1.5.0 mpfr: upgrade 4.1.1 -> 4.2.0 dpkg: upgrade 1.21.13 -> 1.21.17 rxvt-unicode: upgrade 9.30 -> 9.31 virglrenderer: upgrade 0.10.3 -> 0.10.4 Xiangyu Chen (3): grub: backport patches to fix CVE-2022-28736 openssh: remove RRECOMMENDS to rng-tools for sshd package grub2: backport patch to fix CVE-2022-2601 CVE-2022-3775 Yoann Congal (2): bitbake: Group and reorder options in bitbake help bitbake: main: Move --buildfile help at the end of "Execution" group leimaohui (1): libpng: Enable NEON for aarch64 to enensure consistency with arm32. pgowda (1): binutils: Add patch to fix CVE-2022-4285 张忠山 (1): bitbake: data_smart: Use regex consistently for override matching meta-raspberrypi: 93dadf336c..896566aa92: Carlos Alberto Lopez Perez (1): weston: disablepackageconfig options that fail to build with userland drivers Khem Raj (2): lirc: Drop upstreamed patch linux-raspberrypi.inc: Weakly assign COMPATIBLE_MACHINE Martin Jansa (2): bluez5: update patches to apply on 5.66 version layer.conf: update LAYERSERIES_COMPAT for mickledore Vincent Davis Jr (5): rpidistro-vlc,rpidistro-ffmpeg: update COMPATIBLE_HOST regex rpidistro-vlc: upgrade 3.0.12 -> 3.0.17 rpi-default-providers: add libav and libpostproc rpidistro-ffmpeg: upgrade 4.3.2 -> 4.3.4 rpidistro-ffmpeg: remove --enable-v4l2-request flag Signed-off-by: Andrew Geissler Change-Id: Ied8537beedde0f83790e6e3595057db45f408107 --- meta-arm/.gitlab-ci.yml | 38 +- meta-arm/README.md | 9 - ...pixman-Do-not-use-clang-assembler-for-now.patch | 26 + meta-arm/ci/clang.yml | 10 +- meta-arm/ci/gem5-arm64.yml | 16 - meta-arm/ci/gem5-atp-arm64.yml | 15 - meta-arm/ci/get-binary-toolchains | 42 +- meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf | 2 +- .../documentation/corstone1000/change-log.rst | 2 +- .../documentation/corstone1000/release-notes.rst | 22 +- .../documentation/corstone1000/user-guide.rst | 82 +- .../meta-arm-bsp/documentation/fvp-base-arm32.md | 53 +- meta-arm/meta-arm-bsp/documentation/fvp-base.md | 41 +- .../documentation/fvp-baser-aemv8r64.md | 4 +- ...rstone1000-platform-secure-test-framework.patch | 359 - ...000-make-external-system-support-optional.patch | 77 - ...0-enable-secure-enclave-run-without-host-.patch | 298 - ...rtition-Allow-configuration-of-input-and-.patch | 72 - ...00-support-for-UEFI-FMP-image-Information.patch | 573 - ...ne1000-remove-two-partition-configuration.patch | 51 - ...orstone1000-adjust-PS-asset-configuration.patch | 27 - .../trusted-firmware-m-1.7.0-corstone1000.inc | 40 + .../trusted-firmware-m-corstone1000.inc | 44 - .../trusted-firmware-m_1.6.%.bbappend | 6 - .../trusted-firmware-m_1.7.%.bbappend | 6 + .../recipes-bsp/uefi/edk2-firmware-juno.inc | 4 - ...dp-add-external-device-tree-base-and-size.patch | 44 + .../recipes-security/optee/optee-os-n1sdp.inc | 7 + .../optee/optee-os_3.19.0.bbappend | 6 + .../packagegroups/packagegroup-ts-tests.bbappend | 2 + .../0023-Use-the-stateless-platform-service.patch | 140 + .../trusted-services/libts_%.bbappend | 5 + .../trusted-services/libts_git.bbappend | 10 - .../trusted-services/ts-arm-platforms.inc | 30 + .../trusted-services/ts-corstone1000.inc | 26 - .../trusted-services/ts-demo_%.bbappend | 1 + .../trusted-services/ts-newlib_%.bbappend | 4 +- .../trusted-services/ts-psa-api-test.inc | 4 +- .../ts-psa-crypto-api-test_%.bbappend | 1 + .../ts-psa-crypto-api-test_git.bbappend | 1 - .../ts-psa-iat-api-test_%.bbappend | 1 + .../ts-psa-iat-api-test_git.bbappend | 1 - .../ts-psa-its-api-test_%.bbappend | 1 + .../ts-psa-its-api-test_git.bbappend | 1 - .../trusted-services/ts-psa-ps-api-test_%.bbappend | 1 + .../ts-psa-ps-api-test_git.bbappend | 1 - .../trusted-services/ts-service-test_%.bbappend | 1 + .../trusted-services/ts-sp-attestation_%.bbappend | 1 + .../trusted-services/ts-sp-crypto_%.bbappend | 1 + .../trusted-services/ts-sp-its_%.bbappend | 1 + .../trusted-services/ts-sp-se-proxy_%.bbappend | 6 +- .../trusted-services/ts-sp-smm-gateway_%.bbappend | 6 +- .../trusted-services/ts-sp-storage_%.bbappend | 1 + .../trusted-services/ts-uefi-test_%.bbappend | 1 + .../include/external-arm-toolchain-versions.inc | 1 - .../conf/distro/include/tcmode-external-arm.inc | 2 - .../classes/apply_local_src_patches.bbclass | 48 + meta-arm/meta-arm/classes/fvpboot.bbclass | 4 +- .../meta-arm/conf/machine/qemuarm-secureboot.conf | 3 + .../conf/machine/qemuarm64-secureboot.conf | 3 + meta-arm/meta-arm/lib/fvp/runner.py | 9 +- .../trusted-firmware-m/trusted-firmware-m_1.6.0.bb | 145 - .../trusted-firmware-m/trusted-firmware-m_1.7.0.bb | 142 + .../fvp/fvp-base-a-aem_11.18.16.bb | 10 - .../fvp/fvp-base-a-aem_11.20.15.bb | 13 + .../fvp/fvp-base-r-aem_11.19.14.bb | 10 - .../fvp/fvp-base-r-aem_11.20.15.bb | 10 + .../recipes-devtools/fvp/fvp-corstone1000.bb | 8 +- .../meta-arm/recipes-devtools/fvp/fvp-envelope.inc | 4 +- ...Replace-lstat64-stat64-functions-on-linux.patch | 60 + meta-arm/meta-arm/recipes-devtools/gn/gn_git.bb | 3 +- ...-core-Define-section-attributes-for-clang.patch | 230 + ...6-allow-setting-sysroot-for-libgcc-lookup.patch | 35 + .../0007-allow-setting-sysroot-for-clang.patch | 30 + .../0008-no-warn-rwx-segments.patch | 65 + .../optee-os-3.18.0/0009-add-z-execstack.patch | 94 + .../0010-add-note-GNU-stack-section.patch | 128 + ...-core-Define-section-attributes-for-clang.patch | 243 + ...6-allow-setting-sysroot-for-libgcc-lookup.patch | 35 + .../0007-allow-setting-sysroot-for-clang.patch | 30 + .../0008-no-warn-rwx-segments.patch | 38 + .../optee-os-3.19.0/0009-add-z-execstack.patch | 94 + .../0010-add-note-GNU-stack-section.patch | 128 + .../recipes-security/optee/optee-os-3_19.inc | 82 + ...-core-Define-section-attributes-for-clang.patch | 230 + ...6-allow-setting-sysroot-for-libgcc-lookup.patch | 35 + .../0007-allow-setting-sysroot-for-clang.patch | 30 + .../0008-no-warn-rwx-segments.patch | 65 + .../0009-add-z-execstack.patch | 94 + .../0010-add-note-GNU-stack-section.patch | 128 + ...-core-Define-section-attributes-for-clang.patch | 230 - ...6-allow-setting-sysroot-for-libgcc-lookup.patch | 35 - .../0007-allow-setting-sysroot-for-clang.patch | 30 - .../optee/optee-os/0008-no-warn-rwx-segments.patch | 65 - .../optee/optee-os/0009-add-z-execstack.patch | 94 - .../optee-os/0010-add-note-GNU-stack-section.patch | 128 - .../recipes-security/optee/optee-os_3.18.0.bb | 2 + .../recipes-security/optee/optee-os_3.19.0.bb | 9 + .../packagegroups/packagegroup-ts-tests.bb | 2 + .../recipes-security/trusted-services/libts_git.bb | 7 +- .../trusted-services/trusted-services.inc | 2 + meta-arm/meta-atp/README.md | 76 - meta-arm/meta-atp/conf/layer.conf | 9 - meta-arm/meta-atp/conf/machine/gem5-atp-arm64.conf | 11 - .../recipes-devtools/atp/atp-native_3.1.bb | 18 - .../recipes-devtools/atp/atp-source_3.1.inc | 9 - .../recipes-devtools/atp/files/no-werror.patch | 18 - .../gem5/gem5-aarch64-dtb.bbappend | 3 - .../gem5/gem5-aarch64-native/start-gem5-atp.sh | 13 - .../gem5/gem5-aarch64-native_20.bbappend | 24 - .../gem5/gem5-m5ops/m5-readfile.sh | 9 - .../recipes-devtools/gem5/gem5-m5ops_20.bbappend | 14 - .../meta-atp/recipes-kernel/atp/atp-module_3.1.bb | 24 - .../meta-atp/recipes-kernel/atp/atp-test_3.1.bb | 20 - .../meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb | 23 - .../recipes-kernel/linux/files/no_ftrace.cfg | 1 - .../meta-atp/recipes-kernel/linux/files/smmuv3.cfg | 4 - .../recipes-kernel/linux/linux-yocto_%.bbappend | 2 - meta-arm/meta-gem5/COPYING.MIT | 17 - meta-arm/meta-gem5/README.md | 1 - meta-arm/meta-gem5/conf/layer.conf | 19 - meta-arm/meta-gem5/conf/machine/gem5-arm64.conf | 54 - meta-arm/meta-gem5/documentation/gem5-arm64.md | 32 - .../boot-wrapper-aarch64_%.bbappend | 32 - .../gem5/gem5-aarch64-native_20.bbappend | 7 - .../xen/files/gem5-arm64/early-printk.cfg | 2 - .../recipes-extended/xen/xen_%.bbappend | 4 - .../recipes-kernel/linux/linux-%.bbappend | 14 - .../features/disable-arm64-sve.cfg | 4 - .../features/disable-arm64-sve.scc | 3 - .../boot-wrapper-aarch64_%.bbappend | 16 - .../recipes-devtools/gem5/files/mapping.patch | 37 - .../recipes-devtools/gem5/files/start-gem5.sh | 39 - .../gem5/gem5-aarch64-bootloader.inc | 30 - .../gem5/gem5-aarch64-bootloader_20.bb | 7 - .../recipes-devtools/gem5/gem5-aarch64-dtb.bb | 30 - .../recipes-devtools/gem5/gem5-aarch64-native.inc | 40 - ...dev-arm-SMMUv3-enable-interrupt-interface.patch | 97 - .../gem5/gem5-aarch64-native_20.bb | 22 - ...001-util-m5ops-optional-extra-build-flags.patch | 59 - .../recipes-devtools/gem5/gem5-m5ops_20.bb | 26 - .../recipes-devtools/gem5/gem5-m5term-native_20.bb | 24 - .../gem5/gem5-m5term/0001-add-makefile-flags.patch | 34 - .../recipes-devtools/gem5/gem5-native.inc | 52 - .../recipes-devtools/gem5/gem5-source_20.inc | 11 - ...d_OID_registry-fix-reproducibility-issues.patch | 46 - ...02-vt-conmakehash-improve-reproducibility.patch | 56 - .../files/dts/gem5-arm64/armv8_gem5_v2_1cpu.dts | 95 - .../files/dts/gem5-arm64/armv8_gem5_v2_2cpu.dts | 103 - .../files/dts/gem5-arm64/armv8_gem5_v2_4cpu.dts | 119 - .../files/dts/gem5-arm64/armv8_gem5_v2_8cpu.dts | 151 - .../files/dts/gem5-arm64/vexpress_gem5_v2.dtsi | 46 - .../dts/gem5-arm64/vexpress_gem5_v2_base.dtsi | 202 - ...signature-changes-causes-compile-failures.patch | 99 - .../bsp/gem5-platforms/gem5-arm64-standard.scc | 11 - .../gem5-kmeta/bsp/gem5-platforms/gem5-arm64.scc | 14 - .../gem5-platforms/gem5-arm64/gem5-arm64-board.cfg | 23 - .../gem5-platforms/gem5-arm64/gem5-arm64-cfi.cfg | 3 - .../gem5-platforms/gem5-arm64/gem5-arm64-drm.cfg | 4 - .../gem5-platforms/gem5-arm64/gem5-arm64-net.cfg | 2 - .../gem5-platforms/gem5-arm64/gem5-arm64-pata.cfg | 12 - .../gem5-platforms/gem5-arm64/gem5-arm64-pci.cfg | 2 - .../gem5-platforms/gem5-arm64/gem5-arm64-rtc.cfg | 2 - .../gem5-arm64/gem5-arm64-serial.cfg | 3 - .../gem5-arm64/gem5-arm64-virtio.cfg | 9 - .../recipes-kernel/linux/linux-yocto_%.bbappend | 12 - .../recipes-kernel/linux/linux-yocto_5.4.bb | 25 - .../recipes-kernel/linux/linux-yocto_5.4.bbappend | 1 - meta-arm/scripts/machine-summary.py | 2 +- meta-openembedded/meta-filesystems/conf/layer.conf | 2 +- .../ntfs-3g-ntfsprogs_2022.10.3.bb | 53 + .../ntfs-3g-ntfsprogs_2022.5.17.bb | 53 - .../recipes-filesystems/zfs/zfs_2.1.5.bb | 61 - .../recipes-filesystems/zfs/zfs_2.1.7.bb | 61 + ...libau-Do-not-build-LFS-version-of-readdir.patch | 32 + .../recipes-utils/aufs-util/aufs-util_git.bb | 1 + .../0001-f2fs_io-Fix-out-of-tree-builds.patch | 27 + .../0002-f2fs_io-Define-_FILE_OFFSET_BITS-64.patch | 183 + .../recipes-utils/f2fs-tools/f2fs-tools_1.14.0.bb | 19 - .../recipes-utils/f2fs-tools/f2fs-tools_1.15.0.bb | 21 + ...unistd.h-not-argp.h-for-all-POSIX-systems.patch | 2 +- .../fatcat/fatcat/0002-Enable-64bit-off_t.patch | 71 + .../recipes-utils/fatcat/fatcat_1.1.1.bb | 1 + ...e-Do-not-add-D_FILE_OFFSET_BITS-to-CFLAGS.patch | 34 + .../recipes-utils/fatresize/fatresize_1.1.0.bb | 3 +- .../recipes-utils/xfsdump/xfsdump_3.1.11.bb | 38 - .../recipes-utils/xfsdump/xfsdump_3.1.12.bb | 39 + .../0001-Check-for-MAP_SYNC-in-sys-mman.h.patch | 52 - ...gure-Use-AC_SYS_LARGERFILE-autoconf-macro.patch | 27 + ...05-Replace-off64_t-stat64-with-off_t-stat.patch | 723 + .../recipes-utils/xfsprogs/xfsprogs_5.13.0.bb | 73 - .../recipes-utils/xfsprogs/xfsprogs_6.0.0.bb | 74 + .../recipes-utils/xfstests/xfstests_2022.10.30.bb | 63 - .../recipes-utils/xfstests/xfstests_2022.12.18.bb | 64 + meta-openembedded/meta-gnome/conf/layer.conf | 2 +- .../recipes-connectivity/geary/geary_43.0.bb | 4 +- .../recipes-connectivity/libnma/libnma_1.10.4.bb | 29 + .../recipes-connectivity/libnma/libnma_1.8.38.bb | 29 - .../network-manager-applet_1.26.0.bb | 29 - .../network-manager-applet_1.30.0.bb | 29 + .../meta-gnome/recipes-gimp/babl/babl_0.1.96.bb | 20 - .../meta-gnome/recipes-gimp/babl/babl_0.1.98.bb | 20 + .../meta-gnome/recipes-gimp/gegl/gegl_0.4.38.bb | 59 - .../meta-gnome/recipes-gimp/gegl/gegl_0.4.40.bb | 59 + .../meta-gnome/recipes-gnome/amtk/amtk_5.3.1.bb | 18 - .../meta-gnome/recipes-gnome/amtk/amtk_5.6.1.bb | 22 + ...-editor-meson.build-fix-meson-0.61-errors.patch | 31 - .../recipes-gnome/dconf/dconf-editor_3.38.3.bb | 17 - .../recipes-gnome/dconf/dconf-editor_43.0.bb | 21 + .../meta-gnome/recipes-gnome/eog/eog_43.1.bb | 30 + .../meta-gnome/recipes-gnome/evince/evince_42.3.bb | 51 - .../meta-gnome/recipes-gnome/evince/evince_43.1.bb | 53 + .../evolution-data-server/evolution-data-server.bb | 18 +- .../evolution-data-server.inc | 4 +- .../file-roller/file-roller_3.42.0.bb | 28 - .../recipes-gnome/file-roller/file-roller_43.0.bb | 35 + .../meta-gnome/recipes-gnome/gdm/gdm_42.0.bb | 58 - .../meta-gnome/recipes-gnome/gdm/gdm_43.0.bb | 60 + .../meta-gnome/recipes-gnome/gedit/gedit_42.2.bb | 46 - .../meta-gnome/recipes-gnome/gedit/gedit_43.2.bb | 46 + .../geocode-glib/geocode-glib_3.26.4.bb | 4 +- .../0001-Update-rest-requirement-to-rest-1.0.patch | 58 - .../recipes-gnome/gfbgraph/gfbgraph_0.2.5.bb | 5 +- .../meta-gnome/recipes-gnome/gjs/gjs_1.72.2.bb | 40 - .../meta-gnome/recipes-gnome/gjs/gjs_1.75.1.bb | 40 + .../gnome-backgrounds/gnome-backgrounds_42.0.bb | 16 - .../gnome-backgrounds/gnome-backgrounds_43.bb | 16 + .../gnome-bluetooth/gnome-bluetooth_42.4.bb | 44 - .../gnome-bluetooth/gnome-bluetooth_42.5.bb | 44 + .../gnome-calculator/gnome-calculator_42.2.bb | 37 - .../gnome-calculator/gnome-calculator_43.0.1.bb | 38 + .../gnome-calendar/gnome-calendar_42.0.bb | 32 - .../gnome-calendar/gnome-calendar_43.1.bb | 33 + .../0001-Add-meson-option-to-pass-sysroot.patch | 1 - .../gnome-control-center_42.0.bb | 61 - .../gnome-control-center_43.2.bb | 68 + ...on.build-Disable-libseccomp-for-all-archs.patch | 40 - .../gnome-desktop/gnome-desktop_42.0.bb | 47 - .../gnome-desktop/gnome-desktop_43.bb | 48 + .../gnome-disk-utility/gnome-disk-utility_42.0.bb | 38 - .../gnome-disk-utility/gnome-disk-utility_43.0.bb | 40 + .../gnome-flashback/gnome-flashback_3.44.0.bb | 38 - .../gnome-flashback/gnome-flashback_3.46.0.bb | 38 + .../gnome-font-viewer/gnome-font-viewer_43.0.bb | 2 +- .../gnome-keyring/gnome-keyring_42.1.bb | 2 +- ...ild-Use-the-appropriate-dependency-object.patch | 35 + .../gnome-online-accounts_3.46.0.bb | 3 +- .../gnome-panel/gnome-panel_3.44.0.bb | 24 - .../gnome-panel/gnome-panel_3.47.1.bb | 24 + .../gnome-photos/gnome-photos_42.0.bb | 46 - .../gnome-photos/gnome-photos_43.0.bb | 60 + .../gnome-session/gnome-session_42.0.bb | 38 - .../gnome-session/gnome-session_43.0.bb | 38 + .../gnome-settings-daemon_42.1.bb | 46 - .../gnome-settings-daemon_43.0.bb | 46 + .../gnome-shell/gnome-shell-extensions_42.0.bb | 29 - .../gnome-shell/gnome-shell-extensions_43.1.bb | 25 + ...ptions-gjs_path-to-optionally-set-path-to.patch | 27 +- .../recipes-gnome/gnome-shell/gnome-shell_42.0.bb | 71 - .../recipes-gnome/gnome-shell/gnome-shell_43.1.bb | 87 + .../gnome-software/gnome-software_43.2.bb | 44 + .../gnome-terminal/gnome-terminal_3.42.2.bb | 40 - .../gnome-terminal/gnome-terminal_3.46.7.bb | 38 + .../gnome-text-editor/gnome-text-editor_42.2.bb | 27 - .../gnome-text-editor/gnome-text-editor_43.1.bb | 27 + .../meta-gnome/recipes-gnome/grilo/grilo_0.3.14.bb | 28 - .../meta-gnome/recipes-gnome/grilo/grilo_0.3.15.bb | 28 + .../recipes-gnome/gthumb/gthumb_3.12.2.bb | 2 +- .../meta-gnome/recipes-gnome/gtk4/gtk4_4.6.7.bb | 142 - .../gtksourceview/gtksourceview5_5.4.2.bb | 34 - .../gtksourceview/gtksourceview5_5.6.1.bb | 38 + ...n-PATH-expand-the-sftp-backend-ssh-client.patch | 60 + .../meta-gnome/recipes-gnome/gvfs/gvfs_1.50.2.bb | 27 +- .../recipes-gnome/libadwaita/libadwaita_1.2.0.bb | 1 - .../recipes-gnome/libgdata/libgdata_0.18.1.bb | 2 +- ...-Allow-building-gir-in-cross-environments.patch | 21 +- .../libgweather/libgweather4_4.0.0.bb | 28 - .../libgweather/libgweather4_4.2.0.bb | 30 + .../recipes-gnome/libgweather/libgweather_40.0.bb | 24 - .../recipes-gnome/libportal/libportal_0.6.bb | 19 - .../recipes-gnome/libwnck/libwnck3_40.1.bb | 27 - .../recipes-gnome/libwnck/libwnck3_43.0.bb | 27 + .../recipes-gnome/metacity/metacity_3.46.0.bb | 39 - .../recipes-gnome/metacity/metacity_3.46.1.bb | 39 + .../meta-gnome/recipes-gnome/mutter/mutter_42.0.bb | 98 - .../meta-gnome/recipes-gnome/mutter/mutter_43.1.bb | 99 + .../recipes-gnome/nautilus/nautilus_42.2.bb | 46 - .../recipes-gnome/nautilus/nautilus_43.1.bb | 50 + .../meta-gnome/recipes-gnome/rest/librest_0.8.1.bb | 35 + .../meta-gnome/recipes-gnome/tepl/tepl_6.00.0.bb | 26 - .../meta-gnome/recipes-gnome/tepl/tepl_6.4.0.bb | 31 + .../recipes-gnome/tracker/tracker-miners_3.4.1.bb | 76 - .../recipes-gnome/tracker/tracker-miners_3.4.2.bb | 76 + .../recipes-gnome/tracker/tracker_3.4.1.bb | 53 - .../recipes-gnome/tracker/tracker_3.4.2.bb | 54 + .../recipes-gnome/yelp/yelp-tools_42.0.bb | 23 - .../recipes-gnome/yelp/yelp-tools_42.1.bb | 23 + .../appstream-glib/appstream-glib_0.7.18.bb | 39 - .../appstream-glib/appstream-glib_0.8.2.bb | 39 + .../meta-gnome/recipes-support/ibus/ibus.bb | 4 +- .../libcloudproviders/libcloudproviders_0.3.1.bb | 11 + .../libstemmer/libstemmer/0001-Build-so-lib.patch | 63 - .../recipes-support/libstemmer/libstemmer_git.bb | 38 - .../xdg-desktop-portal-gnome_43.1.bb | 34 + .../xdg-desktop-portal-gtk_1.14.1.bb | 42 + meta-openembedded/meta-initramfs/conf/layer.conf | 2 +- ...01-install-Do-not-undef-_FILE_OFFSET_BITS.patch | 32 + .../recipes-devtools/dracut/dracut_056.bb | 1 + ...-variable-LIBS-to-provides-libraries-from.patch | 24 - ...0001-rename-grub2-editenv-to-grub-editenv.patch | 78 + ...-variable-LIBS-to-provides-libraries-from.patch | 38 + .../0002-include-paths.h-for-_PATH_MOUNTED.patch | 25 - .../0003-include-paths.h-for-_PATH_MOUNTED.patch | 27 + ...-rpm-sort-include-string.h-for-strverscmp.patch | 33 + ...ubby-rename-grub2-editenv-to-grub-editenv.patch | 76 - .../recipes-devtools/grubby/grubby_8.40.bb | 41 - .../recipes-devtools/grubby/grubby_git.bb | 19 +- meta-openembedded/meta-multimedia/conf/layer.conf | 2 +- .../recipes-connectivity/gupnp/gssdp_1.4.0.1.bb | 6 +- .../recipes-multimedia/flite/flite_2.2.bb | 8 + .../recipes-multimedia/fluidsynth/fluidsynth.inc | 2 +- .../libcamera/libcamera_0.0.1.bb | 5 + .../recipes-multimedia/mycroft/mycroft_19.8.1.bb | 4 +- .../recipes-multimedia/pipewire/pipewire_0.3.59.bb | 365 - .../recipes-multimedia/pipewire/pipewire_0.3.63.bb | 368 + .../wireplumber/wireplumber_0.4.12.bb | 145 - .../wireplumber/wireplumber_0.4.13.bb | 146 + .../xdg-desktop-portal-wlr_0.6.0.bb | 30 + .../meta-networking/classes/waf-samba.bbclass | 1 + meta-openembedded/meta-networking/conf/layer.conf | 2 +- .../waf-cross-answers/cross-answers-aarch64.txt | 1 + .../waf-cross-answers/cross-answers-aarch64_be.txt | 1 + .../files/waf-cross-answers/cross-answers-arm.txt | 1 + .../waf-cross-answers/cross-answers-armeb.txt | 1 + .../files/waf-cross-answers/cross-answers-i586.txt | 1 + .../files/waf-cross-answers/cross-answers-i686.txt | 1 + .../files/waf-cross-answers/cross-answers-mips.txt | 1 + .../waf-cross-answers/cross-answers-mips64.txt | 1 + .../waf-cross-answers/cross-answers-mips64el.txt | 1 + .../waf-cross-answers/cross-answers-mipsel.txt | 1 + .../waf-cross-answers/cross-answers-powerpc.txt | 1 + .../waf-cross-answers/cross-answers-powerpc64.txt | 1 + .../cross-answers-powerpc64le.txt | 1 + .../waf-cross-answers/cross-answers-riscv32.txt | 1 + .../waf-cross-answers/cross-answers-riscv64.txt | 1 + .../waf-cross-answers/cross-answers-x86_64.txt | 1 + .../recipes-connectivity/blueman/blueman_2.3.4.bb | 59 - .../recipes-connectivity/blueman/blueman_2.3.5.bb | 60 + .../freeradius/files/radiusd.service | 3 +- .../freeradius/freeradius_3.0.21.bb | 30 + .../networkmanager-openvpn_1.10.0.bb | 52 - .../networkmanager-openvpn_1.10.2.bb | 52 + .../networkmanager/networkmanager_1.40.0.bb | 16 +- ...tiong-of-python-to-fix-the-install-confli.patch | 122 - .../samba/0001-Don-t-check-xsltproc-manpages.patch | 12 +- ...1-Fix-pyext_PATTERN-for-cross-compilation.patch | 63 - ...-smbtorture-skip-test-case-tfork_cmd_send.patch | 38 - ...ors-with-Werror-implicit-function-declara.patch | 32 - ...-import-target-module-while-cross-compile.patch | 10 +- .../0003-Add-config-option-without-valgrind.patch | 12 +- ...dd-options-to-configure-the-use-of-libbsd.patch | 14 +- ...5-Fix-pyext_PATTERN-for-cross-compilation.patch | 63 + .../0005-samba-build-dnsserver_common-code.patch | 30 - ...-smbtorture-skip-test-case-tfork_cmd_send.patch | 38 + ...ors-with-Werror-implicit-function-declara.patch | 32 + ...tiong-of-python-to-fix-the-install-confli.patch | 123 + .../samba/samba/cmocka-uintptr_t.patch | 10 +- .../samba/samba/netdb_defines.patch | 19 - .../samba/samba-4.3.9-remove-getpwent_r.patch | 22 +- .../samba/samba-fix-musl-lib-without-innetgr.patch | 42 - .../samba/samba/samba-pam.patch | 12 +- .../recipes-connectivity/samba/samba_4.14.14.bb | 352 - .../recipes-connectivity/samba/samba_4.17.4.bb | 362 + .../recipes-connectivity/sshpass/sshpass_1.09.bb | 2 +- .../recipes-connectivity/wolfssl/wolfssl_5.5.3.bb | 22 - .../recipes-connectivity/wolfssl/wolfssl_5.5.4.bb | 22 + .../recipes-daemons/lldpd/files/run-ptest | 16 + .../recipes-daemons/lldpd/lldpd_1.0.15.bb | 63 - .../recipes-daemons/lldpd/lldpd_1.0.16.bb | 81 + ...se-correct-printf-format-for-__fsblkcnt_t.patch | 9 +- .../recipes-daemons/postfix/postfix.inc | 2 +- .../recipes-daemons/vsftpd/vsftpd_3.0.5.bb | 2 +- .../recipes-filter/libnftnl/libnftnl_1.2.3.bb | 39 - .../recipes-filter/libnftnl/libnftnl_1.2.4.bb | 39 + ...01-nftables-python-Split-root-from-prefix.patch | 44 - .../recipes-filter/nftables/nftables_1.0.5.bb | 55 - .../recipes-filter/nftables/nftables_1.0.6.bb | 58 + ...ure-hdr-length-is-at-a-minimum-of-what-is.patch | 43 - ...-notify-race-between-io-and-main-pthreads.patch | 151 - ...heck-for-readline-function-instead-of-mai.patch | 32 - ...n.m4-check-for-python-x.y-emded.pc-not-py.patch | 33 + ...ing-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch | 48 - .../recipes-protocols/frr/frr_8.3.1.bb | 132 - .../recipes-protocols/frr/frr_8.4.1.bb | 129 + ...subroutine-for-cleaning-recent-interfaces.patch | 59 - .../0001-dns-sd-Include-missing-headers.patch | 41 - .../0001-mdns-include-stddef.h-for-NULL.patch | 40 - ...-subroutine-for-tearing-down-an-interface.patch | 58 - ...-mdns-cross-compilation-fixes-for-bitbake.patch | 145 - .../files/0003-Track-interface-socket-family.patch | 50 - .../0004-Use-list-for-changed-interfaces.patch | 177 - .../mdns/files/0006-Remove-unneeded-function.patch | 51 - ...-Mark-deleted-interfaces-as-being-changed.patch | 39 - .../files/0009-Fix-possible-NULL-dereference.patch | 45 - .../0010-Handle-errors-from-socket-calls.patch | 62 - ...dynamic-allocation-to-file-scope-variable.patch | 53 - .../recipes-protocols/mdns/files/mdns.service | 15 - ...subroutine-for-cleaning-recent-interfaces.patch | 61 + .../mdns/0001-dns-sd-Include-missing-headers.patch | 30 + ...-subroutine-for-tearing-down-an-interface.patch | 59 + ...02-make-Set-libdns_sd.so-soname-correctly.patch | 27 + .../mdns/0003-Track-interface-socket-family.patch | 51 + ...red-Drop-MacOS-specific-__block-qualifier.patch | 30 + ...-Indicate-loopback-interface-to-mDNS-core.patch | 58 + ...-make-Separate-TLS-targets-from-libraries.patch | 64 + .../0005-Use-list-for-changed-interfaces.patch | 169 + .../0005-mDNSCore-Fix-broken-debug-parameter.patch | 26 + .../mdns/0006-Handle-noisy-netlink-sockets.patch | 252 + .../mdns/0006-make-Add-top-level-Makefile.patch | 25 + ...-Mark-deleted-interfaces-as-being-changed.patch | 40 + .../0008-Handle-errors-from-socket-calls.patch | 63 + .../recipes-protocols/mdns/mdns/mdns.service | 15 + .../recipes-protocols/mdns/mdns_1310.140.1.bb | 115 - .../recipes-protocols/mdns/mdns_1790.60.25.bb | 134 + .../recipes-support/chrony/chrony_4.3.bb | 13 +- .../recipes-support/dnsmasq/dnsmasq_2.87.bb | 7 - .../recipes-support/dnsmasq/dnsmasq_2.88.bb | 7 + .../0001-replace-off64_t-with-off_t.patch | 48 + ...p-use-of-GLOB_MAGCHAR-use-strchr-heuristi.patch | 96 + .../recipes-support/drbd/drbd-utils_9.20.2.bb | 73 - .../recipes-support/drbd/drbd-utils_9.22.0.bb | 74 + .../recipes-support/drbd/drbd_9.0.24-1.bb | 24 - .../recipes-support/drbd/drbd_9.2.1.bb | 24 + .../recipes-support/ettercap/ettercap_0.8.3.1.bb | 1 + ...1-Fix-pyext_PATTERN-for-cross-compilation.patch | 59 - ...-import-target-module-while-cross-compile.patch | 10 +- ...02-ldb-Add-configure-options-for-packages.patch | 14 +- ...3-Fix-pyext_PATTERN-for-cross-compilation.patch | 59 + .../libldb/0003-avoid-openldap-unless-wanted.patch | 30 - .../libldb/avoid-openldap-unless-wanted.patch | 31 + ...cka-fix-musl-libc-conflicting-types-error.patch | 45 + .../libldb-fix-musl-libc-conflict-type-error.patch | 45 - .../recipes-support/libldb/libldb_2.3.4.bb | 81 - .../recipes-support/libldb/libldb_2.6.1.bb | 84 + ...1-Fix-pyext_PATTERN-for-cross-compilation.patch | 57 - ...talloc-Add-configure-options-for-packages.patch | 172 + ...2-Fix-pyext_PATTERN-for-cross-compilation.patch | 57 + .../libtalloc/avoid-attr-unless-wanted.patch | 19 +- .../libtalloc/libtalloc/options-2.2.0.patch | 172 - .../recipes-support/libtalloc/libtalloc_2.3.3.bb | 54 - .../recipes-support/libtalloc/libtalloc_2.3.4.bb | 55 + ...1-Fix-pyext_PATTERN-for-cross-compilation.patch | 42 - ...01-tdb-Add-configure-options-for-packages.patch | 171 + ...2-Fix-pyext_PATTERN-for-cross-compilation.patch | 42 + .../tdb-Add-configure-options-for-packages.patch | 172 - .../recipes-support/libtdb/libtdb_1.4.3.bb | 51 - .../recipes-support/libtdb/libtdb_1.4.7.bb | 54 + .../0001-Add-configure-options-for-packages.patch | 169 + ...1-Fix-pyext_PATTERN-for-cross-compilation.patch | 42 - ...001-libtevent-fix-musl-libc-compile-error.patch | 32 - ...2-Fix-pyext_PATTERN-for-cross-compilation.patch | 42 + .../libtevent/avoid-attr-unless-wanted.patch | 12 +- ...cka-fix-musl-libc-conflicting-types-error.patch | 45 + .../libtevent/libtevent/options-0.10.0.patch | 169 - .../recipes-support/libtevent/libtevent_0.10.2.bb | 53 - .../recipes-support/libtevent/libtevent_0.13.0.bb | 59 + .../recipes-support/nbdkit/nbdkit_1.33.2.bb | 33 - .../recipes-support/nbdkit/nbdkit_1.33.4.bb | 33 + ...meSync-Portable-way-to-print-64bit-time_t.patch | 54 + .../open-vm-tools/open-vm-tools_12.1.0.bb | 119 - .../open-vm-tools/open-vm-tools_12.1.5.bb | 120 + .../recipes-support/smcroute/smcroute_2.5.5.bb | 13 - .../recipes-support/smcroute/smcroute_2.5.6.bb | 13 + .../recipes-support/spice/spice-gtk_0.4.1.bb | 16 +- .../recipes-support/tcpdump/tcpdump_4.99.1.bb | 53 - .../recipes-support/tcpdump/tcpdump_4.99.2.bb | 52 + .../recipes-support/traceroute/traceroute_2.1.0.bb | 45 - .../recipes-support/traceroute/traceroute_2.1.1.bb | 44 + meta-openembedded/meta-oe/conf/layer.conf | 2 +- ...-do-not-clobber-PYTHONPATH-from-build-env.patch | 55 + .../recipes-connectivity/lirc/lirc_0.10.2.bb | 21 +- .../0001-wiredtiger-Avoid-using-off64_t.patch | 30 + .../meta-python/recipes-dbs/mongodb/mongodb_git.bb | 1 + .../recipes-devtools/nanopb/nanopb_0.4.6.4.bb | 29 - .../recipes-devtools/nanopb/nanopb_0.4.7.bb | 29 + .../recipes-benchmark/memtester/memtester_4.5.1.bb | 25 - .../recipes-benchmark/memtester/memtester_4.6.0.bb | 24 + .../0001-configure-Add-with-cpu.patch | 37 + .../0002-Replace-lfs64-functions-and-defines.patch | 103 + ...heck-for-pthread_rwlockattr_setkind_np-be.patch | 43 + .../stressapptest/libcplusplus-compat.patch | 2 +- .../stressapptest/read_sysfs_for_cachesize.patch | 2 +- .../stressapptest/stressapptest_1.0.9.bb | 14 +- ...tile-modifier-to-tmp-variable-in-memory-t.patch | 40 - .../recipes-benchmark/sysbench/sysbench_0.4.12.bb | 28 - .../recipes-benchmark/sysbench/sysbench_1.0.20.bb | 30 + ...0001-typecast-enum-conversions-explicitly.patch | 45 - .../meta-oe/recipes-bsp/flashrom/flashrom_1.2.1.bb | 20 + .../meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb | 22 - ...heck-for-request_init-API-when-probing-fo.patch | 31 - .../0001-tools-gensiot-Fix-build-with-musl.patch | 29 - .../recipes-connectivity/gensio/gensio_2.5.2.bb | 27 - .../recipes-connectivity/gensio/gensio_2.6.1.bb | 24 + .../meta-oe/recipes-connectivity/iwd/iwd_1.30.bb | 55 - .../meta-oe/recipes-connectivity/iwd/iwd_2.0.bb | 55 + ...d-parameter-to-disable-keyutils-detection.patch | 32 - .../krb5/krb5/CVE-2021-36222.patch | 121 - .../krb5/krb5/CVE-2021-37750.patch | 53 - .../recipes-connectivity/krb5/krb5_1.17.2.bb | 199 - .../recipes-connectivity/krb5/krb5_1.20.1.bb | 198 + .../libwebsockets/libwebsockets_4.3.2.bb | 2 +- ...e-conditional-assignment-for-KBUILD_OUTPU.patch | 42 + .../linuxptp/linuxptp_3.1.1.bb | 1 + .../paho-mqtt-c/paho-mqtt-c_1.3.11.bb | 34 - .../paho-mqtt-c/paho-mqtt-c_1.3.12.bb | 34 + .../recipes-connectivity/ser2net/ser2net_4.3.11.bb | 18 + .../recipes-connectivity/ser2net/ser2net_4.3.9.bb | 18 - .../recipes-connectivity/zabbix/zabbix_6.2.4.bb | 78 - .../recipes-connectivity/zabbix/zabbix_6.2.6.bb | 78 + .../meta-oe/recipes-core/basu/basu_0.2.1.bb | 21 + .../recipes-core/glib-2.0/glibmm-2.68_2.72.1.bb | 29 - .../recipes-core/glib-2.0/glibmm-2.68_2.74.0.bb | 29 + .../recipes-core/opencl/opencl-headers_git.bb | 1 + .../packagegroups/packagegroup-meta-oe.bb | 13 +- ...nt-util-Remove-asserts-on-dirent64-dirent.patch | 38 + ...e-include-linux-fs.h-to-resolve-fsconfig_.patch | 74 - ...001-pass-correct-parameters-to-getdents64.patch | 50 - .../sdbus-c++/sdbus-c++-libsystemd_250.3.bb | 80 - .../sdbus-c++/sdbus-c++-libsystemd_250.9.bb | 79 + .../meta-oe/recipes-crypto/botan/botan_2.19.2.bb | 52 - .../meta-oe/recipes-crypto/botan/botan_2.19.3.bb | 52 + .../0001-Replace-off64_t-with-off_t.patch | 101 + .../recipes-crypto/cryptsetup/cryptsetup_2.4.3.bb | 116 - .../recipes-crypto/cryptsetup/cryptsetup_2.6.0.bb | 119 + .../recipes-dbs/mysql/mariadb-native_10.11.1.bb | 23 + .../recipes-dbs/mysql/mariadb-native_10.8.3.bb | 22 - .../meta-oe/recipes-dbs/mysql/mariadb.inc | 4 +- .../meta-oe/recipes-dbs/mysql/mariadb/lfs64.patch | 19 + .../meta-oe/recipes-dbs/mysql/mariadb_10.11.1.bb | 26 + .../meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb | 26 - .../0001-direct_mmap-Use-off_t-on-linux.patch | 42 + .../recipes-devtools/abseil-cpp/abseil-cpp_git.bb | 1 + .../android-gadget-start | 2 +- .../android-tools/core/0006-adb-Musl-fixes.patch | 27 +- .../recipes-devtools/boost-url/boost-url_git.bb | 20 - .../recipes-devtools/capnproto/capnproto_0.10.2.bb | 29 - .../recipes-devtools/capnproto/capnproto_0.10.3.bb | 28 + ...e-ilp32d-abi-on-riscv32-and-lp64d-on-rv64.patch | 32 + ...ix-compoiler-detection-logic-for-cross-co.patch | 84 + .../concurrencykit/concurrencykit/cross.patch | 62 - .../concurrencykit/concurrencykit_git.bb | 12 +- .../recipes-devtools/ctags/ctags_5.9.20221106.0.bb | 34 - .../recipes-devtools/ctags/ctags_6.0.20230101.0.bb | 34 + .../dnf-plugin-tui/dnf-plugin-tui_git.bb | 2 +- .../editorconfig/editorconfig-core-c_0.12.5.bb | 15 + .../recipes-devtools/flatbuffers/flatbuffers.inc | 4 +- .../gst-editing-services_1.20.4.bb | 26 - .../gst-editing-services_1.20.5.bb | 26 + .../lshw/files/0001-Fix-musl-build.patch | 125 - .../lshw/files/0001-disable-docbook2man.patch | 30 + .../meta-oe/recipes-devtools/lshw/lshw_02.19.2.bb | 23 +- .../meta-oe/recipes-devtools/luajit/luajit_git.bb | 4 +- .../meta-oe/recipes-devtools/mpich/mpich_4.0.2.bb | 58 - .../meta-oe/recipes-devtools/mpich/mpich_4.0.3.bb | 58 + .../nodejs/nodejs-oe-cache-16.14/oe-npm-cache | 77 - .../nodejs/nodejs-oe-cache-16.18/oe-npm-cache | 77 + .../nodejs/nodejs-oe-cache-native_16.14.bb | 21 - .../nodejs/nodejs-oe-cache-native_16.18.bb | 21 + .../nodejs/nodejs/0001-Using-native-binaries.patch | 78 + ...0002-Install-both-binaries-and-use-libdir.patch | 96 - .../nodejs/nodejs/0002-Using-native-binaries.patch | 70 - .../0005-add-openssl-legacy-provider-option.patch | 151 - .../recipes-devtools/nodejs/nodejs_16.14.2.bb | 186 - .../recipes-devtools/nodejs/nodejs_16.18.1.bb | 184 + .../meta-oe/recipes-devtools/perfetto/perfetto.bb | 25 +- .../recipes-devtools/perl/libio-pty-perl_1.16.bb | 18 - .../recipes-devtools/perl/libio-pty-perl_1.17.bb | 28 + .../meta-oe/recipes-devtools/php/php_8.1.11.bb | 2 +- .../meta-oe/recipes-devtools/ply/ply_git.bb | 4 +- .../recipes-devtools/protobuf/protobuf_3.21.12.bb | 108 + .../recipes-devtools/protobuf/protobuf_3.21.5.bb | 106 - .../recipes-devtools/python/python3-apt_2.3.0.bb | 17 - .../recipes-devtools/python/python3-apt_2.5.0.bb | 17 + .../meta-oe/recipes-devtools/sip/sip_6.7.5.bb | 16 + .../suitesparse/suitesparse_5.10.1.bb | 2 +- .../recipes-devtools/uw-imap/uw-imap_2007f.bb | 2 + .../0001-Do-not-undefine-_FILE_OFFSET_BITS.patch | 59 + .../recipes-extended/boinc/boinc-client/4563.patch | 36 - .../boinc/boinc-client/gtk-configure.patch | 28 - .../recipes-extended/boinc/boinc-client_7.18.1.bb | 91 - .../recipes-extended/boinc/boinc-client_7.20.4.bb | 82 + .../recipes-extended/byacc/byacc_20220128.bb | 10 - .../recipes-extended/byacc/byacc_20221229.bb | 10 + .../flatpak/flatpak-xdg-utils_1.0.5.bb | 14 + .../0001-flatpak-pc-add-pc_sysrootdir.patch | 26 + .../recipes-extended/flatpak/flatpak_1.15.1.bb | 65 + .../recipes-extended/fluentbit/fluentbit_1.9.7.bb | 1 + .../recipes-extended/hwloc/hwloc_1.11.13.bb | 31 - .../meta-oe/recipes-extended/hwloc/hwloc_2.9.0.bb | 28 + .../libpwquality/libpwquality_1.4.4.bb | 9 +- .../recipes-extended/libreport/libreport_2.10.0.bb | 2 +- .../meta-oe/recipes-extended/minio/minio_git.bb | 5 +- .../0001-Cargo.toml-do-not-abort-on-panic.patch | 32 + ...t-use-autoconf-s-config.sub-to-canonicali.patch | 29 + ...0001-rewrite-cargo-host-linker-in-python3.patch | 54 + ...ure-fix-one-occasionally-reproduced-confi.patch | 48 + ...oz.configure-do-not-look-for-llvm-objdump.patch | 44 + ...ure-do-not-try-to-find-a-suitable-upstrea.patch | 66 + .../mozjs/mozjs-102/0004-use-asm-sgidefs.h.patch | 38 + .../mozjs/mozjs-102/fix-musl-build.patch | 27 + .../mozjs/mozjs-102/musl-disable-stackwalk.patch | 18 + .../recipes-extended/mozjs/mozjs-102/py-3.11.patch | 139 + .../recipes-extended/mozjs/mozjs-102/riscv32.patch | 60 + .../recipes-extended/mozjs/mozjs-102_102.5.0.bb | 79 + .../0001-Cargo.toml-do-not-abort-on-panic.patch | 29 - ...t-use-autoconf-s-config.sub-to-canonicali.patch | 28 - ...0001-rewrite-cargo-host-linker-in-python3.patch | 56 - ...ure-fix-one-occasionally-reproduced-confi.patch | 50 - ...oz.configure-do-not-look-for-llvm-objdump.patch | 43 - ...ure-do-not-try-to-find-a-suitable-upstrea.patch | 65 - .../mozjs/mozjs-91/0004-use-asm-sgidefs.h.patch | 35 - .../mozjs/mozjs-91/0005-nojit-32bit-arch-fix.patch | 21 - .../mozjs/mozjs-91/0006-Fix-build-on-powerpc.patch | 36 - .../mozjs/mozjs-91/fix-musl-build.patch | 15 - .../recipes-extended/mozjs/mozjs-91/py-3.11.patch | 211 - .../recipes-extended/mozjs/mozjs-91/riscv32.patch | 45 - .../recipes-extended/mozjs/mozjs-91_91.13.0.bb | 80 - .../recipes-extended/openwsman/openwsman_2.7.1.bb | 72 - .../recipes-extended/openwsman/openwsman_2.7.2.bb | 72 + .../0001-Remove-unused-linux-fs.h-includes.patch | 42 - ...1-lib-repo-checkout-Add-ALLPERMS-for-musl.patch | 32 + ...01-libostree-Remove-including-sys-mount.h.patch | 29 - ...s390x-se-luks-gencpio-There-is-no-bashism.patch | 25 - .../0001-tests-Handle-musl-s-ERANGE-mapping.patch | 29 + .../recipes-extended/ostree/ostree_2022.5.bb | 213 - .../recipes-extended/ostree/ostree_2022.7.bb | 221 + .../meta-oe/recipes-extended/polkit/polkit_122.bb | 49 + .../0006-Define-correct-gregs-for-RISCV32.patch | 20 +- .../0006-Define-correct-gregs-for-RISCV32.patch | 15 +- .../meta-oe/recipes-extended/redis/redis_6.2.7.bb | 66 - .../meta-oe/recipes-extended/redis/redis_6.2.8.bb | 66 + .../meta-oe/recipes-extended/redis/redis_7.0.5.bb | 72 - .../meta-oe/recipes-extended/redis/redis_7.0.7.bb | 72 + .../volume_key/volume-key_0.3.12.bb | 2 +- ...et-HAVE_LARGEFILE_SUPPORT-to-1-explicitly.patch | 30 + ...void-using-glibc-specific-defines-on-musl.patch | 26 + .../create-links-with-relative-path.patch | 52 + .../wxwidgets/fix-libdir-for-multilib.patch | 100 +- .../wxwidgets/wxwidgets/musl-locale-l.patch | 32 + .../not-append-system-name-to-lib-name.patch | 30 +- .../respect-DESTDIR-when-create-link.patch | 55 - .../wx-config-fix-libdir-for-multilib.patch | 6 +- .../recipes-extended/wxwidgets/wxwidgets_3.1.5.bb | 120 - .../recipes-extended/wxwidgets/wxwidgets_3.2.1.bb | 123 + .../recipes-gnome/libxmlb/libxmlb_0.3.10.bb | 2 + ...01-cmake-Use-alternate-way-to-detect-libm.patch | 24 +- .../fontforge/fontforge_20220308.bb | 49 - .../fontforge/fontforge_20230101.bb | 49 + .../recipes-graphics/graphviz/graphviz_2.50.0.bb | 3 + .../recipes-graphics/libdecor/libdecor_0.1.1.bb | 29 + .../recipes-graphics/libforms/libforms_1.2.4.bb | 26 - .../libforms/libforms_1.2.5pre1.bb | 26 + .../recipes-graphics/libglvnd/libglvnd_1.5.0.bb | 30 - .../recipes-graphics/libglvnd/libglvnd_1.6.0.bb | 30 + ...ses-Replace-off64_t-with-off_t-and-stat64.patch | 176 + .../libyui/libyui-ncurses_4.1.1.bb | 48 - .../libyui/libyui-ncurses_4.2.3.bb | 50 + .../recipes-graphics/libyui/libyui_4.1.1.bb | 36 - .../recipes-graphics/libyui/libyui_4.2.3.bb | 36 + ...0001-Add-install-PHONY-target-in-Makefile.patch | 31 - .../0001-Avoid-pessimizing-std-move-3124.patch | 50 - ...KE_INSTALL_LIBDIR-in-installed-CMake-file.patch | 35 - .../spir/spirv-shader-generator_git.bb | 18 +- .../meta-oe/recipes-graphics/surf/surf_2.1.bb | 2 +- .../recipes-graphics/tesseract/tesseract_5.2.0.bb | 22 - .../recipes-graphics/tesseract/tesseract_5.3.0.bb | 22 + .../recipes-graphics/wayland/waylandpp_1.0.0.bb | 4 +- .../meta-oe/recipes-graphics/xorg-app/xterm_373.bb | 50 - .../meta-oe/recipes-graphics/xorg-app/xterm_377.bb | 50 + .../xorg-driver/xf86-video-amdgpu_22.0.0.bb | 2 + .../recipes-graphics/xorg-lib/liblbxutil_1.1.0.bb | 2 + .../recipes-graphics/xorg-lib/libxaw_1.0.14.bb | 5 +- .../recipes-graphics/xorg-lib/libxkbui_1.0.2.bb | 2 + .../recipes-graphics/xorg-lib/libxpresent_1.0.1.bb | 2 + .../xorg-lib/xcb-util-cursor_0.1.3.bb | 11 - .../xorg-lib/xcb-util-cursor_0.1.4.bb | 10 + .../meta-oe/recipes-kernel/libbpf/libbpf_0.8.0.bb | 2 + ...e-Do-not-preserve-ownership-in-cp-command.patch | 40 + .../libtraceevent/libtraceevent_1.7.0.bb | 25 + ...e-Do-not-preserve-ownership-in-cp-command.patch | 31 + .../recipes-kernel/libtracefs/libtracefs_1.6.3.bb | 22 + .../files/0001-Do-not-emit-useless-rpath.patch | 34 + ...lace-LFS64-interfaces-off64_t-and-lseek64.patch | 1136 + .../0001-trace-cmd-make-it-build-with-musl.patch | 132 - .../recipes-kernel/trace-cmd/trace-cmd_2.9.1.bb | 19 - .../recipes-kernel/trace-cmd/trace-cmd_3.1.5.bb | 31 + .../recipes-multimedia/alsa/alsa-oss_1.1.8.bb | 22 - .../recipes-multimedia/libass/libass_0.16.0.bb | 27 - .../recipes-multimedia/libass/libass_0.17.0.bb | 27 + .../v4l2apps/v4l-utils_1.23.0.bb | 4 + .../recipes-navigation/geoclue/geoclue_2.5.7.bb | 47 - .../recipes-navigation/geoclue/geoclue_2.6.0.bb | 59 + .../meta-oe/recipes-navigation/proj/proj_8.2.1.bb | 22 - .../meta-oe/recipes-navigation/proj/proj_9.1.0.bb | 25 + .../meta-oe/recipes-security/audit/audit_3.0.8.bb | 116 - .../meta-oe/recipes-security/audit/audit_3.0.9.bb | 116 + .../bubblewrap/bubblewrap_0.7.0.bb | 24 + ...ox.inc.sh-update-regex-for-getting-endian.patch | 35 + .../recipes-security/keyutils/keyutils_1.6.1.bb | 1 + .../recipes-security/usbguard/usbguard_1.1.1.bb | 68 - .../recipes-security/usbguard/usbguard_1.1.2.bb | 68 + .../meta-oe/recipes-shells/dash/dash_0.5.11.5.bb | 26 - .../meta-oe/recipes-shells/dash/dash_0.5.12.bb | 26 + .../meta-oe/recipes-shells/tcsh/tcsh_6.22.04.bb | 1 + .../appstream/0001-fix-crosscompile.patch | 43 + .../recipes-support/appstream/appstream_0.15.5.bb | 44 + .../canonical-multitouch/frame_2.5.0.bb | 4 +- .../canonical-multitouch/geis_2.2.17.bb | 2 +- .../canonical-multitouch/grail_3.1.1.bb | 4 +- .../meta-oe/recipes-support/ccid/ccid_1.5.0.bb | 19 - .../meta-oe/recipes-support/ccid/ccid_1.5.1.bb | 18 + .../meta-oe/recipes-support/colord/colord.inc | 4 +- .../crucible/crucible_2022.05.25.bb | 19 - .../crucible/crucible_2022.12.06.bb | 19 + .../dool/dool/0001-Fix-rename-in-docs.patch | 261 + .../meta-oe/recipes-support/dool/dool_1.1.0.bb | 1 + .../recipes-support/freerdp/freerdp_2.8.1.bb | 85 - .../recipes-support/freerdp/freerdp_2.9.0.bb | 85 + .../googlebenchmark/googlebenchmark_1.7.0.bb | 20 - .../googlebenchmark/googlebenchmark_1.7.1.bb | 20 + .../0001-Define-off64_t-as-off_t-on-musl.patch | 33 + .../gperftools/0001-fix-build-with-musl-libc.patch | 34 - .../recipes-support/gperftools/gperftools_2.10.bb | 2 +- .../recipes-support/hunspell/hunspell_1.7.1.bb | 18 - .../recipes-support/hunspell/hunspell_1.7.2.bb | 18 + .../meta-oe/recipes-support/hwdata/hwdata_0.364.bb | 25 - .../meta-oe/recipes-support/hwdata/hwdata_0.365.bb | 26 + .../imagemagick/imagemagick_7.0.10.bb | 1 - .../recipes-support/imapfilter/imapfilter_2.7.5.bb | 21 - .../recipes-support/imapfilter/imapfilter_2.7.6.bb | 23 + ...igure-Add-AC_SYS_LARGEFILE-autoconf-macro.patch | 28 + ...03-replace-stat64-lstat64-with-stat-lstat.patch | 119 + .../inotify-tools/inotify-tools_3.22.6.0.bb | 4 +- .../recipes-support/libcereal/libcereal_1.3.2.bb | 1 + .../libstemmer/libstemmer/0001-Build-so-lib.patch | 63 + .../recipes-support/libstemmer/libstemmer_git.bb | 38 + .../meta-oe/recipes-support/mg/mg_20220614.bb | 38 - .../meta-oe/recipes-support/mg/mg_20221112.bb | 38 + ...0001-add-explicit-dependency-on-libraries.patch | 24 +- .../0001-fix-boolean-value-with-json-c-0.14.patch | 42 - ...0001-fix-bug-of-do_compile-and-do_install.patch | 33 +- ...h-uevent.c-fix-error-handling-for-udev_mo.patch | 39 - .../0021-RH-fixup-udev-rules-for-redhat.patch | 40 +- ...-the-property-blacklist-exception-builtin.patch | 25 +- ...0023-RH-don-t-start-without-a-config-file.patch | 58 +- .../0024-RH-use-rpm-optflags-if-present.patch | 44 +- .../files/0025-RH-add-mpathconf.patch | 61 +- ...ds-from-kernel-cmdline-mpath.wwids-with-A.patch | 17 +- ...-warn-on-invalid-regex-instead-of-failing.patch | 82 +- ...ools-modify-Makefile.inc-for-cross-compil.patch | 14 +- .../files/0030-Always-use-devmapper.patch | 59 +- .../0031-Always-use-devmapper-for-kpartx.patch | 16 +- ...efile-replace-perl-with-sed-in-install-ta.patch | 14 +- .../multipath-tools/multipath-tools_0.8.4.bb | 122 - .../multipath-tools/multipath-tools_0.9.3.bb | 125 + .../meta-oe/recipes-support/nano/nano_6.4.bb | 22 - .../meta-oe/recipes-support/nano/nano_7.1.bb | 22 + .../nspr/nspr/0001-md-Fix-build-with-musl.patch | 17 +- .../nspr/nspr/0002-Add-nios2-support.patch | 39 +- .../nspr/remove-srcdir-from-configure-in.patch | 19 - .../meta-oe/recipes-support/nspr/nspr_4.29.bb | 200 - .../meta-oe/recipes-support/nspr/nspr_4.35.bb | 198 + .../nss/0001-nss-fix-support-cross-compiling.patch | 7 +- .../meta-oe/recipes-support/nss/nss_3.74.bb | 8 +- ...missing-header-for-LIBAVCODEC_VERSION_INT.patch | 26 + .../meta-oe/recipes-support/opencv/opencv_4.6.0.bb | 3 +- .../recipes-support/opensc/opensc_0.22.0.bb | 49 - .../recipes-support/opensc/opensc_0.23.0.bb | 49 + .../recipes-support/pcsc-lite/pcsc-lite_1.9.8.bb | 57 - .../recipes-support/pcsc-lite/pcsc-lite_1.9.9.bb | 56 + .../recipes-support/pcsc-tools/pcsc-tools_1.6.0.bb | 16 - .../recipes-support/pcsc-tools/pcsc-tools_1.6.1.bb | 16 + .../meta-oe/recipes-support/poco/poco_1.12.4.bb | 1 + .../recipes-support/poppler/poppler_22.11.0.bb | 55 - .../recipes-support/poppler/poppler_23.01.0.bb | 55 + .../recipes-support/remmina/remmina_1.4.27.bb | 46 - .../recipes-support/remmina/remmina_1.4.29.bb | 46 + .../recipes-support/rsnapshot/rsnapshot_git.bb | 4 +- .../meta-oe/recipes-support/satyr/satyr_0.40.bb | 2 +- .../meta-oe/recipes-support/smarty/smarty_4.2.1.bb | 26 - .../meta-oe/recipes-support/smarty/smarty_4.3.0.bb | 26 + ...-Do-not-use-LFS64-functions-on-linux-musl.patch | 30 + .../recipes-support/spdlog/spdlog_1.10.0.bb | 17 - .../recipes-support/spdlog/spdlog_1.11.0.bb | 19 + .../tbb/0001-Disable-LTO-on-clang-riscv32.patch | 29 - .../0001-Disable-use-of-_tpause-instruction.patch | 29 - ...0001-Musl-linux-can-not-use-RTLD_DEEPBIND.patch | 33 - ...mallinfo-is-glibc-specific-API-mark-it-so.patch | 33 - .../meta-oe/recipes-support/tbb/tbb_2021.5.0.bb | 54 - .../meta-oe/recipes-support/tbb/tbb_2021.7.0.bb | 53 + .../meta-oe/recipes-support/tio/tio_2.3.bb | 19 - .../meta-oe/recipes-support/tio/tio_2.5.bb | 19 + .../meta-oe/recipes-support/tree/tree_2.0.4.bb | 20 - .../meta-oe/recipes-support/tree/tree_2.1.0.bb | 20 + .../vboxguestdrivers/vboxguestdrivers_7.0.2.bb | 91 - .../vboxguestdrivers/vboxguestdrivers_7.0.4.bb | 91 + ...esktop-portal-pc-in-add-pc_sysrootdir-dir.patch | 25 + .../xdg-desktop-portal_1.16.0.bb | 41 + .../recipes-support/xmlsec1/xmlsec1_1.2.36.bb | 67 - .../recipes-support/xmlsec1/xmlsec1_1.2.37.bb | 67 + ...-Disable-parallel-builds-of-lex-bison-fil.patch | 68 + .../fwts/fwts/0003-Remove-Werror-from-build.patch | 8 +- .../meta-oe/recipes-test/fwts/fwts_22.01.00.bb | 34 - .../meta-oe/recipes-test/fwts/fwts_22.11.00.bb | 35 + meta-openembedded/meta-perl/conf/layer.conf | 2 +- .../recipes-extended/logcheck/logcheck_1.3.24.bb | 77 - .../recipes-extended/logcheck/logcheck_1.4.0.bb | 77 + .../libfile/libfile-slurper-perl_0.013.bb | 35 - .../libfile/libfile-slurper-perl_0.014.bb | 35 + .../meta-perl/recipes-perl/libio/files/run-ptest | 16 - .../libio/libio-socket-ssl-perl_2.075.bb | 46 - .../libio/libio-socket-ssl-perl_2.078.bb | 56 + .../libmime/libmime-types-perl_2.22.bb | 46 - .../libmime/libmime-types-perl_2.24.bb | 46 + .../libmozilla/libmozilla-ca-perl_20221114.bb | 22 + .../recipes-perl/libnet/libnet-dns-perl_1.35.bb | 65 - .../recipes-perl/libnet/libnet-dns-perl_1.36.bb | 65 + .../libtest/libtest-warnings-perl_0.031.bb | 28 - .../packagegroups/packagegroup-meta-perl.bb | 1 - meta-openembedded/meta-python/conf/layer.conf | 2 +- .../packagegroups/packagegroup-meta-python.bb | 3 +- .../python/python3-aioserial_1.3.1.bb | 17 + .../python/python3-aiosignal_1.2.0.bb | 14 - .../python/python3-aiosignal_1.3.1.bb | 14 + .../python/python3-alembic_1.8.1.bb | 19 - .../python/python3-alembic_1.9.1.bb | 19 + .../python/python3-asgiref_3.5.2.bb | 29 - .../python/python3-asgiref_3.6.0.bb | 29 + .../python/python3-astroid_2.12.12.bb | 32 - .../python/python3-astroid_2.12.13.bb | 32 + .../python/python3-asttokens_2.1.0.bb | 18 - .../python/python3-asttokens_2.2.1.bb | 18 + .../python/python3-asyncinotify_2.0.5.bb | 15 - .../python/python3-asyncinotify_3.0.1.bb | 15 + .../python/python3-autobahn_22.12.1.bb | 23 + .../python/python3-autobahn_22.7.1.bb | 23 - .../python/python3-bidict_0.22.0.bb | 11 - .../python/python3-bidict_0.22.1.bb | 11 + .../python/python3-binwalk_2.3.3.bb | 17 + .../python/python3-bitarray_2.6.0.bb | 10 - .../python/python3-bitarray_2.6.2.bb | 10 + .../recipes-devtools/python/python3-can_4.0.0.bb | 27 - .../recipes-devtools/python/python3-can_4.1.0.bb | 27 + .../python/python3-cantools_37.2.0.bb | 22 - .../python/python3-cantools_38.0.0.bb | 22 + .../recipes-devtools/python/python3-cbor2_5.4.3.bb | 31 - .../recipes-devtools/python/python3-cbor2_5.4.6.bb | 31 + .../python/python3-charset-normalizer_3.0.0.bb | 15 - .../python/python3-charset-normalizer_3.0.1.bb | 15 + .../python/python3-coverage_6.5.0.bb | 19 - .../python/python3-coverage_7.0.3.bb | 21 + .../python/python3-croniter_1.3.7.bb | 12 - .../python/python3-croniter_1.3.8.bb | 12 + .../python/python3-cytoolz_0.12.0.bb | 13 - .../python/python3-cytoolz_0.12.1.bb | 13 + .../python/python3-dateparser_1.1.0.bb | 20 - .../python/python3-dateparser_1.1.5.bb | 20 + .../python/python3-django_4.1.3.bb | 9 + .../recipes-devtools/python/python3-django_4.1.bb | 9 - .../python/python3-eth-account_0.7.0.bb | 18 - .../python/python3-eth-account_0.8.0.bb | 18 + .../python/python3-eth-hash_0.5.0.bb | 14 - .../python/python3-eth-hash_0.5.1.bb | 14 + .../python/python3-eth-utils_2.0.0.bb | 16 - .../python/python3-eth-utils_2.1.0.bb | 16 + .../python/python3-eventlet_0.33.1.bb | 16 - .../python/python3-eventlet_0.33.2.bb | 16 + .../python/python3-flask-migrate_3.1.0.bb | 15 - .../python/python3-flask-migrate_4.0.0.bb | 15 + .../python/python3-flask-socketio_5.3.1.bb | 17 - .../python/python3-flask-socketio_5.3.2.bb | 17 + .../python/python3-frozenlist_1.3.1.bb | 11 - .../python/python3-frozenlist_1.3.3.bb | 11 + .../python/python3-geomet_0.3.0.bb | 26 - .../python/python3-geomet_1.0.0.bb | 25 + .../recipes-devtools/python/python3-gmpy2_2.1.2.bb | 14 - .../recipes-devtools/python/python3-gmpy2_2.1.5.bb | 14 + .../python/python3-google-api-core_2.10.2.bb | 26 - .../python/python3-google-api-core_2.11.0.bb | 26 + .../python3-google-api-python-client_2.65.0.bb | 20 - .../python3-google-api-python-client_2.70.0.bb | 20 + .../python/python3-google-auth_2.14.0.bb | 27 - .../python/python3-google-auth_2.15.0.bb | 27 + .../python3-googleapis-common-protos_1.56.4.bb | 14 - .../python3-googleapis-common-protos_1.57.0.bb | 14 + .../python/python3-greenlet_2.0.0.bb | 9 - .../python/python3-greenlet_2.0.1.bb | 9 + .../python/python3-grpcio-tools_1.50.0.bb | 19 - .../python/python3-grpcio-tools_1.51.1.bb | 19 + .../python/python3-grpcio_1.50.0.bb | 47 - .../python/python3-grpcio_1.51.1.bb | 47 + .../python/python3-imageio_2.22.3.bb | 12 - .../python/python3-imageio_2.23.0.bb | 12 + .../python/python3-inotify/run-ptest | 3 + .../python/python3-inotify_0.2.10.bb | 14 - .../recipes-devtools/python/python3-inotify_git.bb | 35 + .../python/python3-ipython_8.2.0.bb | 28 - .../python/python3-ipython_8.7.0.bb | 28 + .../python/python3-isort_5.10.1.bb | 20 - .../python/python3-isort_5.11.4.bb | 20 + .../recipes-devtools/python/python3-jedi_0.18.1.bb | 20 - .../recipes-devtools/python/python3-jedi_0.18.2.bb | 20 + .../recipes-devtools/python/python3-kmod_0.9.1.bb | 14 + .../python/python3-langtable_0.0.60.bb | 23 - .../python/python3-langtable_0.0.61.bb | 23 + .../python/python3-linux-procfs_0.7.1.bb | 12 + .../recipes-devtools/python/python3-lz4_4.0.2.bb | 26 - .../recipes-devtools/python/python3-lz4_4.3.2.bb | 26 + .../python/python3-m2crypto/CVE-2020-25657.patch | 176 + .../avoid-host-contamination.patch | 2 +- .../python/python3-m2crypto_0.38.0.bb | 11 +- .../python/python3-marshmallow_3.18.0.bb | 28 - .../python/python3-marshmallow_3.19.0.bb | 28 + .../python/python3-matplotlib-inline_0.1.2.bb | 8 - .../python/python3-matplotlib-inline_0.1.6.bb | 8 + .../recipes-devtools/python/python3-mock_4.0.3.bb | 16 - .../recipes-devtools/python/python3-mock_5.0.0.bb | 16 + .../python/python3-multidict_6.0.2.bb | 24 - .../python/python3-multidict_6.0.4.bb | 24 + .../python/python3-networkx_2.8.7.bb | 21 - .../python/python3-networkx_2.8.8.bb | 21 + .../python/python3-pandas_1.5.1.bb | 26 - .../python/python3-pandas_1.5.2.bb | 26 + .../recipes-devtools/python/python3-path_16.5.0.bb | 11 - .../recipes-devtools/python/python3-path_16.6.0.bb | 11 + .../python/python3-pillow_9.3.0.bb | 42 - .../python/python3-pillow_9.4.0.bb | 42 + .../python/python3-prompt-toolkit_3.0.31.bb | 25 - .../python/python3-prompt-toolkit_3.0.36.bb | 25 + .../python/python3-protobuf_4.21.12.bb | 39 + .../python/python3-protobuf_4.21.9.bb | 39 - .../python/python3-pyatspi_2.38.2.bb | 21 - .../python/python3-pyatspi_2.46.0.bb | 21 + .../python/python3-pybind11-json_0.2.11.bb | 12 - .../python/python3-pybind11-json_0.2.13.bb | 12 + .../python/python3-pycares_4.2.2.bb | 20 - .../python/python3-pycares_4.3.0.bb | 20 + .../python/python3-pychromecast_12.1.4.bb | 19 - .../python/python3-pychromecast_13.0.4.bb | 19 + .../python/python3-pycocotools_2.0.5.bb | 11 - .../python/python3-pycocotools_2.0.6.bb | 11 + .../python/python3-pycodestyle_2.10.0.bb | 11 + .../python/python3-pycodestyle_2.9.1.bb | 11 - .../python/python3-pycurl_7.45.1.bb | 19 - .../python/python3-pycurl_7.45.2.bb | 19 + .../python/python3-pydantic_1.10.2.bb | 20 - .../python/python3-pydantic_1.10.4.bb | 20 + .../python/python3-pydicti_1.1.6.bb | 8 - .../python/python3-pydicti_1.2.0.bb | 8 + .../python/python3-pyflakes_2.5.0.bb | 10 - .../python/python3-pyflakes_3.0.1.bb | 10 + .../python/python3-pymisp_2.4.157.bb | 26 - .../python/python3-pymisp_2.4.167.bb | 26 + .../python/python3-pymodbus_3.0.0.bb | 35 - .../python/python3-pymodbus_3.0.2.bb | 35 + .../python/python3-pymongo_4.3.2.bb | 30 - .../python/python3-pymongo_4.3.3.bb | 30 + .../python/python3-pyperf_2.4.1.bb | 23 - .../python/python3-pyperf_2.5.0.bb | 23 + .../python/python3-pyproj_3.4.0.bb | 16 - .../python/python3-pyproj_3.4.1.bb | 17 + .../python/python3-pystemd_0.10.0.bb | 6 +- .../python/python3-pytest-xdist_3.0.2.bb | 17 - .../python/python3-pytest-xdist_3.1.0.bb | 17 + .../python/python3-python-vlc_3.0.16120.bb | 8 - .../python/python3-python-vlc_3.0.18121.bb | 8 + .../python/python3-rapidjson_1.9.bb | 22 + .../recipes-devtools/python/python3-redis_4.3.4.bb | 16 - .../recipes-devtools/python/python3-redis_4.4.0.bb | 16 + .../python/python3-schedutils_0.6.bb | 12 + .../python/python3-sentry-sdk_1.12.1.bb | 22 + .../python/python3-sentry-sdk_1.9.10.bb | 22 - .../python/python3-simplejson_3.17.6.bb | 24 - .../python/python3-simplejson_3.18.1.bb | 24 + .../python/python3-sqlalchemy_1.4.43.bb | 23 - .../python/python3-sqlalchemy_1.4.45.bb | 23 + .../python/python3-stevedore_4.1.0.bb | 14 - .../python/python3-stevedore_4.1.1.bb | 14 + .../python/python3-supervisor_4.2.4.bb | 34 - .../python/python3-supervisor_4.2.5.bb | 34 + .../python/python3-termcolor_2.1.0.bb | 16 - .../python/python3-termcolor_2.2.0.bb | 16 + .../python/python3-texttable_1.6.4.bb | 10 - .../python/python3-texttable_1.6.7.bb | 10 + .../python/python3-traitlets_5.5.0.bb | 14 - .../python/python3-traitlets_5.8.0.bb | 14 + .../recipes-devtools/python/python3-twine_4.0.1.bb | 18 - .../recipes-devtools/python/python3-twine_4.0.2.bb | 18 + .../python/python3-twisted_22.10.0.bb | 2 + .../python/python3-twitter_4.10.1.bb | 19 - .../python/python3-twitter_4.12.1.bb | 19 + .../python/python3-u-msgpack-python_2.7.1.bb | 27 - .../python/python3-u-msgpack-python_2.7.2.bb | 26 + .../python/python3-uefi-firmware_1.9.bb | 17 + .../recipes-devtools/python/python3-ujson_5.5.0.bb | 34 - .../recipes-devtools/python/python3-ujson_5.6.0.bb | 34 + .../python/python3-watchdog_2.1.9.bb | 18 - .../python/python3-watchdog_2.2.1.bb | 18 + .../python/python3-watchdogdev_1.0.0.bb | 9 + .../recipes-devtools/python/python3-web3_5.31.1.bb | 20 - .../recipes-devtools/python/python3-web3_5.31.3.bb | 20 + .../python/python3-xlsxwriter_3.0.3.bb | 21 - .../python/python3-xlsxwriter_3.0.5.bb | 21 + .../python/python3-xxhash_3.1.0.bb | 21 - .../python/python3-xxhash_3.2.0.bb | 21 + .../python/python3-yamlloader_1.1.0.bb | 12 - .../python/python3-yamlloader_1.2.2.bb | 12 + .../0001-Fix-imports-for-ptests.patch | 16 +- .../python3-yappi/0002-add-3.11-to-the-setup.patch | 24 + .../recipes-devtools/python/python3-yappi_1.3.6.bb | 36 - .../recipes-devtools/python/python3-yappi_1.4.0.bb | 36 + .../recipes-devtools/python/python3-yarl_1.8.1.bb | 27 - .../recipes-devtools/python/python3-yarl_1.8.2.bb | 27 + .../python/python3-zeroconf_0.39.4.bb | 14 - .../python/python3-zeroconf_0.47.1.bb | 14 + .../python/python3-zopeinterface_5.5.1.bb | 23 - .../python/python3-zopeinterface_5.5.2.bb | 23 + .../python3-attrdict3/python3-attrdict3_2.0.2.bb | 12 + ...on-version-to-fix-NanoSVG-issues-with-Pyt.patch | 861 - ...sub-Replace-deprecated-inspect.getargspec.patch | 65 + ...onally-use-GetAssertStackTrace-under-USE_.patch | 32 + .../not-overwrite-cflags-cxxflags.patch | 28 + .../sip-fix-override-functions.patch | 35 - .../python3-wxgtk4/python3-wxgtk4_4.1.1.bb | 37 - .../python3-wxgtk4/python3-wxgtk4_4.2.0.bb | 39 + .../0001-Don-t-set-tp_print-on-Python-3.patch | 44 - .../python-pyephem/python3-pyephem_4.1.3.bb | 17 - .../python-pyephem/python3-pyephem_4.1.4.bb | 16 + .../pywbemtools/python3-pywbemtools_1.0.1.bb | 39 - .../pywbemtools/python3-pywbemtools_1.1.1.bb | 39 + .../meta-python/recipes-extended/tuna/tuna_git.bb | 24 + meta-openembedded/meta-webserver/conf/layer.conf | 2 +- meta-openembedded/meta-xfce/conf/layer.conf | 2 +- .../recipes-multimedia/parole/parole_4.16.0.bb | 2 +- .../cpufreq/xfce4-cpufreq-plugin_1.2.7.bb | 8 - .../cpufreq/xfce4-cpufreq-plugin_1.2.8.bb | 8 + .../cpugraph/xfce4-cpugraph-plugin_1.2.6.bb | 8 - .../cpugraph/xfce4-cpugraph-plugin_1.2.7.bb | 8 + .../sensors/xfce4-sensors-plugin_1.4.3.bb | 26 - .../sensors/xfce4-sensors-plugin_1.4.4.bb | 26 + .../verve/xfce4-verve-plugin_2.0.1.bb | 1 + .../wavelan/xfce4-wavelan-plugin_0.6.2.bb | 8 - .../wavelan/xfce4-wavelan-plugin_0.6.3.bb | 8 + .../archive/thunar-archive-plugin_0.4.0.bb | 12 - .../archive/thunar-archive-plugin_0.5.0.bb | 11 + ...-build-Bump-GLib-minimum-required-to-2.26.patch | 34 + .../shares/thunar-shares-plugin_0.3.1.bb | 2 +- .../meta-xfce/recipes-xfce/exo/exo/configure.patch | 57 - .../recipes-xfce/exo/exo/exo-no-tests-0.8.patch | 9 +- .../exo/exo/reduce-build-to-exo-csource-only.patch | 90 - .../meta-xfce/recipes-xfce/exo/exo_4.16.4.bb | 26 - .../meta-xfce/recipes-xfce/exo/exo_4.18.0.bb | 25 + .../meta-xfce/recipes-xfce/garcon/garcon_4.16.1.bb | 22 - .../meta-xfce/recipes-xfce/garcon/garcon_4.18.0.bb | 22 + ...-private-xfce4-keyboard-shortcuts.xml-fix.patch | 10 +- .../recipes-xfce/libxfce4ui/libxfce4ui_4.16.1.bb | 31 - .../recipes-xfce/libxfce4ui/libxfce4ui_4.18.0.bb | 31 + .../libxfce4util/libxfce4util_4.16.0.bb | 9 - .../libxfce4util/libxfce4util_4.18.0.bb | 9 + .../thunar-volman/thunar-volman_4.16.0.bb | 16 - .../thunar-volman/thunar-volman_4.18.0.bb | 16 + .../meta-xfce/recipes-xfce/thunar/thunar_4.16.9.bb | 31 - .../meta-xfce/recipes-xfce/thunar/thunar_4.18.0.bb | 35 + .../recipes-xfce/tumbler/tumbler_4.16.0.bb | 30 - .../recipes-xfce/tumbler/tumbler_4.18.0.bb | 31 + .../xfce4-appfinder/xfce4-appfinder_4.16.1.bb | 13 - .../xfce4-appfinder/xfce4-appfinder_4.18.0.bb | 13 + .../xfce4-dev-tools/xfce4-dev-tools_4.16.0.bb | 27 - .../xfce4-dev-tools/xfce4-dev-tools_4.18.0.bb | 27 + ...do-not-display-desktop-icon-when-no-windo.patch | 15 +- .../recipes-xfce/xfce4-panel/xfce4-panel_4.16.3.bb | 44 - .../recipes-xfce/xfce4-panel/xfce4-panel_4.18.0.bb | 44 + .../xfce4-power-manager_4.16.0.bb | 42 - .../xfce4-power-manager_4.18.0.bb | 42 + .../xfce4-session/xfce4-session_4.16.0.bb | 37 - .../xfce4-session/xfce4-session_4.18.0.bb | 37 + .../xfce4-settings/xfce4-settings_4.16.3.bb | 31 - .../xfce4-settings/xfce4-settings_4.18.0.bb | 31 + .../meta-xfce/recipes-xfce/xfconf/xfconf_4.16.0.bb | 19 - .../meta-xfce/recipes-xfce/xfconf/xfconf_4.18.0.bb | 19 + .../recipes-xfce/xfdesktop/xfdesktop_4.16.0.bb | 16 - .../recipes-xfce/xfdesktop/xfdesktop_4.18.0.bb | 16 + .../meta-xfce/recipes-xfce/xfwm4/xfwm4_4.16.1.bb | 37 - .../meta-xfce/recipes-xfce/xfwm4/xfwm4_4.18.0.bb | 37 + meta-raspberrypi/conf/layer.conf | 2 +- .../conf/machine/include/rpi-default-providers.inc | 2 + .../lirc/lirc/lirc-gpio-ir-0.10.patch | 175 - .../recipes-connectivity/lirc/lirc_0.10.%.bbappend | 1 - .../0001-configure-fix-linking-on-RISC-V-ISA.patch | 8 +- ...Revert-configure-Require-libmodplug-0.8.9.patch | 9 +- .../rpidistro-vlc/files/0003-CVE-2022-41325.patch | 83 + .../rpidistro-vlc/files/0003-mmal_20.patch | 13823 ---- .../rpidistro-vlc/files/0004-mmal_20.patch | 13826 ++++ .../rpidistro-vlc/files/0004-mmal_exit_fix.patch | 16 - .../rpidistro-vlc/files/0005-mmal_chain.patch | 16 - .../rpidistro-vlc/files/0005-mmal_exit_fix.patch | 19 + ...-Use-packageconfig-to-detect-mmal-support.patch | 56 - .../rpidistro-vlc/files/0006-mmal_chain.patch | 19 + .../rpidistro-vlc/files/0007-armv6.patch | 53 + .../rpidistro-vlc/files/0007-use-vorbisidec.patch | 18 - .../files/0008-fix-luaL-checkint.patch | 233 - ...-fix-EGL-macro-undeclared-and-EGLImageKHR.patch | 58 - ...fix-numeric_limits-is-not-a-member-of-std.patch | 35 - .../files/2001-fix-luaL-checkint.patch | 236 + .../rpidistro-vlc/files/2002-use-vorbisidec.patch | 33 + .../3001-configure.ac-setup-for-OE-usage.patch | 124 + ...-fix-EGL-macro-undeclared-and-EGLImageKHR.patch | 61 + ...xil_core-replace-opt-vc-path-with-usr-lib.patch | 43 + .../3004-use-GLESv2-headers-over-GL-headers.patch | 60 + .../3005-modules-remove-glspectrum-usage.patch | 149 + ...c-omxil_core.h-fix-multiple-definition-of.patch | 43 + .../files/3007-remove-xorg-related-link-libs.patch | 36 + .../3008-vo-Makefile.am-exclude-libgl_plugin.patch | 97 + ...-converter_vaapi-Fix-EGL-macro-undeclared.patch | 59 + .../rpidistro-vlc/rpidistro-vlc_3.0.12.bb | 159 - .../rpidistro-vlc/rpidistro-vlc_3.0.17.bb | 162 + .../0001-bcm43xx-Add-bcm43xx-3wire-variant.patch | 11 +- ...-UART-speed-must-be-reset-after-the-firmw.patch | 14 +- ...003-Increase-firmware-load-timeout-to-30s.patch | 11 +- ...-Move-the-43xx-firmware-into-lib-firmware.patch | 25 - ...-the-hciattach-firmware-into-lib-firmware.patch | 29 + .../recipes-connectivity/bluez5/bluez5_%.bbappend | 2 +- .../recipes-graphics/wayland/weston_%.bbappend | 2 +- .../recipes-kernel/linux/linux-raspberrypi.inc | 2 +- ...-sbcenc-avoid-callee-preserved-vfp-regist.patch | 40 +- .../0002-Fix-build-on-powerpc-and-ppc64.patch | 7 +- ...pngenc-remove-monowhite-from-apng-formats.patch | 8 +- .../files/0004-ffmpeg-4.3.2-rpi_10.patch | 60569 ---------------- .../files/0004-ffmpeg-4.3.4-rpi_14.patch | 68341 +++++++++++++++++++ .../rpidistro-ffmpeg/files/0005-fix-flags.diff | 22 + .../rpidistro-ffmpeg/files/0005-fix_flags.diff | 19 - .../2001-configure-setup-for-OE-core-usage.patch | 82 + ...opengl_enc-update-dynamic-function-loader.patch | 111 + .../2003-libavcodec-fix-v4l2_req_devscan.patch | 45 + ...odec-omx-replace-opt-vc-path-with-usr-lib.patch | 35 + .../rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.2.bb | 194 - .../rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.4.bb | 195 + .../mfa/python3-privacyidea_3.7.3.bb | 38 - .../mfa/python3-privacyidea_3.7.4.bb | 38 + .../recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb | 23 - .../recipes-tpm2/tpm2-tools/tpm2-tools_5.3.bb | 23 + .../bubblewrap/bubblewrap_0.6.2.bb | 23 - .../bubblewrap/bubblewrap_0.7.0.bb | 22 + .../recipes-security/chipsec/chipsec_1.8.8.bb | 34 - .../recipes-security/chipsec/chipsec_1.9.1.bb | 34 + poky/.gitignore | 6 +- poky/bitbake/README | 15 +- poky/bitbake/bin/bitbake | 3 +- poky/bitbake/bin/bitbake-server | 12 +- poky/bitbake/bin/bitbake-worker | 48 +- poky/bitbake/doc/_templates/footer.html | 9 + .../bitbake-user-manual-execution.rst | 17 +- .../bitbake-user-manual-fetching.rst | 8 +- .../bitbake-user-manual-metadata.rst | 28 +- .../bitbake-user-manual-ref-variables.rst | 3 +- poky/bitbake/lib/bb/__init__.py | 4 +- poky/bitbake/lib/bb/build.py | 149 +- poky/bitbake/lib/bb/cache.py | 267 +- poky/bitbake/lib/bb/codeparser.py | 49 +- poky/bitbake/lib/bb/command.py | 57 +- poky/bitbake/lib/bb/cooker.py | 159 +- poky/bitbake/lib/bb/cookerdata.py | 114 +- poky/bitbake/lib/bb/data.py | 84 +- poky/bitbake/lib/bb/data_smart.py | 16 +- poky/bitbake/lib/bb/event.py | 100 +- poky/bitbake/lib/bb/fetch2/git.py | 9 +- poky/bitbake/lib/bb/fetch2/wget.py | 7 +- poky/bitbake/lib/bb/main.py | 398 +- poky/bitbake/lib/bb/parse/__init__.py | 4 +- poky/bitbake/lib/bb/parse/ast.py | 39 + poky/bitbake/lib/bb/parse/parse_py/BBHandler.py | 8 +- poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py | 14 +- poky/bitbake/lib/bb/runqueue.py | 160 +- poky/bitbake/lib/bb/server/process.py | 259 +- poky/bitbake/lib/bb/server/xmlrpcserver.py | 2 +- poky/bitbake/lib/bb/siggen.py | 257 +- poky/bitbake/lib/bb/tests/codeparser.py | 14 +- poky/bitbake/lib/bb/tests/color.py | 2 +- poky/bitbake/lib/bb/tests/event.py | 38 +- .../software/libxml2/2.10/index.html | 20 + .../fetch-testdata/software/libxml2/2.9/index.html | 40 + .../fetch-testdata/software/libxml2/index.html | 19 + poky/bitbake/lib/bb/tests/fetch.py | 3 + poky/bitbake/lib/bb/tests/runqueue.py | 2 +- poky/bitbake/lib/bb/tinfoil.py | 10 +- poky/bitbake/lib/bb/ui/knotty.py | 27 +- poky/bitbake/lib/bb/ui/uievent.py | 28 +- poky/bitbake/lib/bb/utils.py | 32 + poky/documentation/.gitignore | 1 + poky/documentation/_templates/footer.html | 2 +- poky/documentation/boilerplate.rst | 2 + poky/documentation/brief-yoctoprojectqs/index.rst | 4 +- poky/documentation/bsp-guide/bsp.rst | 24 +- poky/documentation/dev-manual/bmaptool.rst | 59 + poky/documentation/dev-manual/build-quality.rst | 409 + poky/documentation/dev-manual/building.rst | 939 + poky/documentation/dev-manual/changes.rst | 525 + poky/documentation/dev-manual/common-tasks.rst | 11875 ---- .../dev-manual/custom-distribution.rst | 108 + .../custom-template-configuration-directory.rst | 52 + .../dev-manual/customizing-images.rst | 223 + poky/documentation/dev-manual/debugging.rst | 1249 + .../documentation/dev-manual/development-shell.rst | 82 + poky/documentation/dev-manual/device-manager.rst | 72 + poky/documentation/dev-manual/disk-space.rst | 39 + .../dev-manual/efficiently-fetching-sources.rst | 68 + .../dev-manual/error-reporting-tool.rst | 84 + poky/documentation/dev-manual/external-scm.rst | 67 + .../dev-manual/external-toolchain.rst | 40 + .../dev-manual/gobject-introspection.rst | 155 + poky/documentation/dev-manual/index.rst | 38 +- poky/documentation/dev-manual/init-manager.rst | 89 + poky/documentation/dev-manual/layers.rst | 905 + poky/documentation/dev-manual/libraries.rst | 267 + poky/documentation/dev-manual/licenses.rst | 518 + poky/documentation/dev-manual/new-machine.rst | 118 + poky/documentation/dev-manual/new-recipe.rst | 1657 + poky/documentation/dev-manual/packages.rst | 1250 + .../dev-manual/prebuilt-libraries.rst | 209 + .../dev-manual/python-development-shell.rst | 50 + poky/documentation/dev-manual/qemu.rst | 57 +- poky/documentation/dev-manual/quilt.rst | 89 + poky/documentation/dev-manual/read-only-rootfs.rst | 89 + poky/documentation/dev-manual/runtime-testing.rst | 598 + poky/documentation/dev-manual/sbom.rst | 69 + poky/documentation/dev-manual/securing-images.rst | 156 + .../documentation/dev-manual/speeding-up-build.rst | 109 + poky/documentation/dev-manual/start.rst | 100 +- .../dev-manual/temporary-source-code.rst | 66 + .../documentation/dev-manual/upgrading-recipes.rst | 397 + poky/documentation/dev-manual/vulnerabilities.rst | 214 + poky/documentation/dev-manual/wayland.rst | 90 + poky/documentation/dev-manual/wic.rst | 729 + poky/documentation/dev-manual/x32-psabi.rst | 54 + poky/documentation/genindex.rst | 2 + poky/documentation/kernel-dev/advanced.rst | 15 +- poky/documentation/kernel-dev/common.rst | 179 +- poky/documentation/kernel-dev/faq.rst | 4 +- poky/documentation/kernel-dev/intro.rst | 12 +- poky/documentation/kernel-dev/maint-appx.rst | 16 +- poky/documentation/migration-guides/index.rst | 1 + .../migration-guides/migration-1.3.rst | 21 +- .../migration-guides/migration-1.4.rst | 4 +- .../migration-guides/migration-1.5.rst | 23 +- .../migration-guides/migration-1.6.rst | 23 +- .../migration-guides/migration-1.7.rst | 19 +- .../migration-guides/migration-1.8.rst | 34 +- .../migration-guides/migration-2.0.rst | 4 +- .../migration-guides/migration-2.1.rst | 40 +- .../migration-guides/migration-2.2.rst | 16 +- .../migration-guides/migration-2.3.rst | 37 +- .../migration-guides/migration-2.4.rst | 14 +- .../migration-guides/migration-2.5.rst | 14 +- .../migration-guides/migration-2.6.rst | 37 +- .../migration-guides/migration-2.7.rst | 5 +- .../migration-guides/migration-3.0.rst | 16 +- .../migration-guides/migration-3.1.rst | 8 +- .../migration-guides/migration-3.2.rst | 43 +- .../migration-guides/migration-3.3.rst | 29 +- .../migration-guides/migration-3.4.rst | 8 +- .../migration-guides/migration-4.0.rst | 28 +- .../migration-guides/migration-4.1.rst | 18 +- .../migration-guides/migration-4.2.rst | 48 + .../migration-guides/migration-general.rst | 35 +- .../documentation/migration-guides/release-3.4.rst | 2 + .../documentation/migration-guides/release-4.0.rst | 3 + .../documentation/migration-guides/release-4.1.rst | 3 + .../documentation/migration-guides/release-4.2.rst | 9 + .../migration-guides/release-notes-3.4.1.rst | 24 +- .../migration-guides/release-notes-3.4.2.rst | 12 +- .../migration-guides/release-notes-3.4.3.rst | 8 +- .../migration-guides/release-notes-3.4.4.rst | 12 +- .../migration-guides/release-notes-3.4.rst | 80 +- .../migration-guides/release-notes-4.0.1.rst | 22 +- .../migration-guides/release-notes-4.0.2.rst | 16 +- .../migration-guides/release-notes-4.0.3.rst | 36 +- .../migration-guides/release-notes-4.0.4.rst | 24 +- .../migration-guides/release-notes-4.0.5.rst | 14 +- .../migration-guides/release-notes-4.0.6.rst | 313 + .../migration-guides/release-notes-4.0.rst | 48 +- .../migration-guides/release-notes-4.1.1.rst | 319 + .../migration-guides/release-notes-4.1.rst | 41 +- .../migration-guides/release-notes-4.2.rst | 28 + poky/documentation/overview-manual/concepts.rst | 84 +- .../overview-manual/development-environment.rst | 12 +- poky/documentation/overview-manual/yp-intro.rst | 30 +- poky/documentation/poky.yaml.in | 2 +- poky/documentation/profile-manual/intro.rst | 4 +- poky/documentation/profile-manual/usage.rst | 2 +- poky/documentation/ref-manual/classes.rst | 1284 +- .../documentation/ref-manual/devtool-reference.rst | 11 +- poky/documentation/ref-manual/faq.rst | 25 +- poky/documentation/ref-manual/features.rst | 10 +- poky/documentation/ref-manual/images.rst | 10 +- poky/documentation/ref-manual/kickstart.rst | 2 +- poky/documentation/ref-manual/qa-checks.rst | 28 +- poky/documentation/ref-manual/release-process.rst | 4 +- poky/documentation/ref-manual/resources.rst | 58 +- poky/documentation/ref-manual/structure.rst | 17 +- .../ref-manual/system-requirements.rst | 94 +- poky/documentation/ref-manual/tasks.rst | 20 +- poky/documentation/ref-manual/terms.rst | 26 +- poky/documentation/ref-manual/variables.rst | 1177 +- .../sdk-manual/appendix-customizing.rst | 31 +- poky/documentation/sdk-manual/appendix-obtain.rst | 31 +- poky/documentation/sdk-manual/extensible.rst | 94 +- poky/documentation/sdk-manual/intro.rst | 6 +- poky/documentation/sdk-manual/using.rst | 21 +- poky/documentation/sdk-manual/working-projects.rst | 37 +- poky/documentation/test-manual/intro.rst | 28 +- .../test-manual/reproducible-builds.rst | 2 +- .../test-manual/understand-autobuilder.rst | 6 +- .../test-manual/yocto-project-compatible.rst | 2 +- poky/documentation/toaster-manual/intro.rst | 5 +- poky/documentation/toaster-manual/reference.rst | 10 +- .../transitioning-to-a-custom-environment.rst | 8 +- poky/documentation/what-i-wish-id-known.rst | 2 +- poky/meta-poky/conf/distro/poky-tiny.conf | 3 - poky/meta-poky/conf/distro/poky.conf | 3 +- poky/meta-poky/conf/layer.conf | 2 +- .../conf/templates/default/local.conf.sample | 5 +- poky/meta-selftest/conf/layer.conf | 4 +- .../recipes-test/devtool/devtool-test-local/file3 | 1 + .../devtool/devtool-test-local_6.03.bb | 3 + .../recipes-test/devtool/devtool-test-localonly.bb | 3 + .../devtool/devtool-test-localonly/file3 | 1 + poky/meta-skeleton/conf/layer.conf | 2 +- .../baremetal-examples/baremetal-helloworld_git.bb | 53 - poky/meta-yocto-bsp/conf/layer.conf | 2 +- .../recipes-kernel/linux/linux-yocto_5.15.bbappend | 16 +- .../recipes-kernel/linux/linux-yocto_5.19.bbappend | 8 +- poky/meta/classes-global/base.bbclass | 31 +- poky/meta/classes-global/insane.bbclass | 128 + poky/meta/classes-global/mirrors.bbclass | 3 +- poky/meta/classes-global/package.bbclass | 2002 +- poky/meta/classes-global/package_deb.bbclass | 6 +- poky/meta/classes-global/package_ipk.bbclass | 6 +- poky/meta/classes-global/package_rpm.bbclass | 12 +- poky/meta/classes-global/sanity.bbclass | 6 +- poky/meta/classes-global/sstate.bbclass | 6 +- poky/meta/classes-global/uninative.bbclass | 2 + poky/meta/classes-recipe/baremetal-image.bbclass | 25 +- poky/meta/classes-recipe/image.bbclass | 10 +- poky/meta/classes-recipe/kernel-arch.bbclass | 2 +- poky/meta/classes-recipe/kernel-fitimage.bbclass | 21 +- .../classes-recipe/kernel-module-split.bbclass | 2 +- poky/meta/classes-recipe/kernel.bbclass | 14 +- poky/meta/classes-recipe/meson.bbclass | 8 +- poky/meta/classes-recipe/populate_sdk_base.bbclass | 9 +- poky/meta/classes-recipe/populate_sdk_ext.bbclass | 3 +- .../classes-recipe/python3targetconfig.bbclass | 18 +- poky/meta/classes-recipe/qemuboot.bbclass | 3 +- poky/meta/classes-recipe/rust-common.bbclass | 34 +- .../meta/classes-recipe/rust-target-config.bbclass | 21 +- .../meta/classes-recipe/setuptools3_legacy.bbclass | 2 +- poky/meta/classes-recipe/systemd.bbclass | 2 +- poky/meta/classes-recipe/toolchain-scripts.bbclass | 2 +- poky/meta/classes-recipe/uboot-sign.bbclass | 4 +- .../classes-recipe/update-alternatives.bbclass | 2 +- poky/meta/classes-recipe/update-rc.d.bbclass | 4 +- poky/meta/classes/externalsrc.bbclass | 2 +- poky/meta/classes/rm_work.bbclass | 114 +- poky/meta/conf/bitbake.conf | 11 +- .../conf/distro/include/default-distrovars.inc | 5 +- .../meta/conf/distro/include/default-providers.inc | 1 + poky/meta/conf/distro/include/maintainers.inc | 12 +- .../conf/distro/include/ptest-packagelists.inc | 26 +- poky/meta/conf/distro/include/tcmode-default.inc | 10 +- poky/meta/conf/distro/include/time64.inc | 28 + poky/meta/conf/distro/include/yocto-uninative.inc | 8 +- poky/meta/conf/documentation.conf | 1 - poky/meta/conf/layer.conf | 11 +- .../conf/machine/include/x86/tune-x86-64-v3.inc | 31 + poky/meta/conf/machine/qemux86-64.conf | 2 +- poky/meta/lib/bblayers/create.py | 2 +- poky/meta/lib/bblayers/makesetup.py | 2 +- poky/meta/lib/oe/__init__.py | 4 + poky/meta/lib/oe/package.py | 1721 + poky/meta/lib/oe/packagedata.py | 239 + poky/meta/lib/oe/sstatesig.py | 16 +- poky/meta/lib/oeqa/core/utils/concurrencytest.py | 4 +- poky/meta/lib/oeqa/files/test.rs | 2 + poky/meta/lib/oeqa/runtime/cases/rpm.py | 23 +- poky/meta/lib/oeqa/runtime/cases/rust.py | 41 + poky/meta/lib/oeqa/selftest/cases/baremetal.py | 14 + poky/meta/lib/oeqa/selftest/cases/debuginfod.py | 67 +- poky/meta/lib/oeqa/selftest/cases/devtool.py | 5 +- poky/meta/lib/oeqa/selftest/cases/externalsrc.py | 44 + poky/meta/lib/oeqa/selftest/cases/runqemu.py | 14 +- poky/meta/lib/oeqa/selftest/cases/tinfoil.py | 14 + poky/meta/lib/oeqa/selftest/context.py | 6 +- poky/meta/lib/oeqa/utils/commands.py | 3 +- poky/meta/lib/oeqa/utils/nfs.py | 2 +- poky/meta/lib/oeqa/utils/qemurunner.py | 11 +- poky/meta/recipes-bsp/acpid/acpid.inc | 3 +- .../acpid/0001-Replace-stat64-with-stat.patch | 31 + poky/meta/recipes-bsp/efibootmgr/efibootmgr_18.bb | 3 - .../efivar/0001-Use-off_t-instead-of-off64_t.patch | 39 + poky/meta/recipes-bsp/efivar/efivar_38.bb | 1 + ...ze-overflow-in-grub_font_get_glyph_intern.patch | 115 + .../recipes-bsp/grub/files/CVE-2022-2601.patch | 85 + ...er-efi-chainloader-Use-grub_loader_set_ex.patch | 86 + .../recipes-bsp/grub/files/CVE-2022-3775.patch | 95 + ...ds-boot-Add-API-to-pass-context-to-loader.patch | 168 + ...efi-chainloader-Simplify-the-loader-state.patch | 129 + poky/meta/recipes-bsp/grub/grub2.inc | 6 + .../recipes-bsp/pciutils/pciutils/configure.patch | 12 +- poky/meta/recipes-bsp/pciutils/pciutils_3.8.0.bb | 64 - poky/meta/recipes-bsp/pciutils/pciutils_3.9.0.bb | 64 + poky/meta/recipes-bsp/u-boot/u-boot.inc | 1 + poky/meta/recipes-bsp/usbutils/usbutils_014.bb | 32 - poky/meta/recipes-bsp/usbutils/usbutils_015.bb | 32 + .../0001-avoid-start-failure-with-bind-user.patch | 27 + ...lwresd-V-and-start-log-hide-build-options.patch | 35 + ...-searching-for-json-headers-searches-sysr.patch | 47 + .../recipes-connectivity/bind/bind-9.18.10/bind9 | 2 + .../bind/bind-9.18.10/conf.patch | 330 + .../bind/bind-9.18.10/generate-rndc-key.sh | 8 + .../init.d-add-support-for-read-only-rootfs.patch | 65 + .../make-etc-initd-bind-stop-work.patch | 42 + .../bind/bind-9.18.10/named.service | 22 + .../0001-avoid-start-failure-with-bind-user.patch | 27 - ...lwresd-V-and-start-log-hide-build-options.patch | 35 - ...-searching-for-json-headers-searches-sysr.patch | 47 - .../recipes-connectivity/bind/bind-9.18.8/bind9 | 2 - .../bind/bind-9.18.8/conf.patch | 330 - .../bind/bind-9.18.8/generate-rndc-key.sh | 8 - .../init.d-add-support-for-read-only-rootfs.patch | 65 - .../make-etc-initd-bind-stop-work.patch | 42 - .../bind/bind-9.18.8/named.service | 22 - .../meta/recipes-connectivity/bind/bind_9.18.10.bb | 114 + poky/meta/recipes-connectivity/bind/bind_9.18.8.bb | 114 - poky/meta/recipes-connectivity/bluez5/bluez5.inc | 2 + ...-src-shared-util.c-include-linux-limits.h.patch | 26 + .../recipes-connectivity/bluez5/bluez5_5.65.bb | 70 - .../recipes-connectivity/bluez5/bluez5_5.66.bb | 70 + .../recipes-connectivity/dhcpcd/dhcpcd_9.4.1.bb | 3 + ...onf-improve-the-sitation-of-working-with-.patch | 82 + ...ep-Allow-getrandom-sysctl-for-newer-glibc.patch | 30 + ...-privsep-Allow-newfstatat-syscall-as-well.patch | 31 + .../iproute2/iproute2_6.0.0.bb | 98 - .../iproute2/iproute2_6.1.0.bb | 99 + .../recipes-connectivity/libpcap/libpcap_1.10.1.bb | 43 - .../recipes-connectivity/libpcap/libpcap_1.10.2.bb | 43 + .../0001-Replace-statfs64-with-statfs.patch | 171 + .../nfs-utils/nfs-utils_2.6.2.bb | 1 + .../recipes-connectivity/openssh/openssh_9.1p1.bb | 9 +- .../0001-avoid-using-m-option-for-readlink.patch | 37 + .../resolvconf/resolvconf_1.91.bb | 9 +- .../recipes-connectivity/slirp/libslirp_git.bb | 18 + .../wpa-supplicant/wpa-supplicant_2.10.bb | 2 +- poky/meta/recipes-core/busybox/busybox.inc | 26 +- poky/meta/recipes-core/dbus/dbus_1.14.4.bb | 2 + ...-build-failure-use-DROPBEAR_PRIO_LOWDELAY.patch | 28 - .../meta/recipes-core/dropbear/dropbear_2022.82.bb | 133 - .../meta/recipes-core/dropbear/dropbear_2022.83.bb | 133 + poky/meta/recipes-core/ell/ell_0.53.bb | 22 - poky/meta/recipes-core/ell/ell_0.55.bb | 22 + .../recipes-core/glib-2.0/glib-2.0/fix-errno.patch | 31 + .../glib-2.0/glib-2.0/relocate-modules.patch | 4 +- poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.1.bb | 55 - poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb | 56 + poky/meta/recipes-core/glibc/glibc-tests_2.36.bb | 2 +- ...poll-fortify-symbol-for-64-bit-time_t-BZ-.patch | 528 + poky/meta/recipes-core/glibc/glibc_2.36.bb | 1 + .../images/build-appliance-image_15.0.0.bb | 2 +- poky/meta/recipes-core/kbd/kbd_2.5.1.bb | 1 + .../libxcrypt/libxcrypt-compat_4.4.30.bb | 18 - .../libxcrypt/libxcrypt-compat_4.4.33.bb | 18 + poky/meta/recipes-core/libxcrypt/libxcrypt.inc | 2 +- .../recipes-core/libxcrypt/libxcrypt_4.4.30.bb | 2 - .../recipes-core/libxcrypt/libxcrypt_4.4.33.bb | 2 + ...run-the-python-tests-if-python-is-enabled.patch | 86 - .../libxml2/0001-Port-gentest.py-to-Python-3.patch | 814 - .../libxml/libxml2/fix-execution-of-ptests.patch | 33 - .../recipes-core/libxml/libxml2/fix-tests.patch | 222 + .../libxml/libxml2/install-tests.patch | 38 + .../libxml/libxml2/libxml-m4-use-pkgconfig.patch | 24 +- .../libxml/libxml2/python-sitepackages-dir.patch | 35 - .../libxml/libxml2/remove-fuzz-from-ptests.patch | 44 - poky/meta/recipes-core/libxml/libxml2/run-ptest | 18 +- .../meta/recipes-core/libxml/libxml2/runtest.patch | 849 - poky/meta/recipes-core/libxml/libxml2_2.10.3.bb | 96 + poky/meta/recipes-core/libxml/libxml2_2.9.14.bb | 128 - .../meta/recipes-core/meta/cve-update-db-native.bb | 83 +- poky/meta/recipes-core/meta/uninative-tarball.bb | 1 + poky/meta/recipes-core/musl/musl_git.bb | 2 +- .../recipes-core/ncurses/ncurses_6.3+20220423.bb | 1 - .../ovmf/ovmf/0005-debug-prefix-map.patch | 26 +- poky/meta/recipes-core/ovmf/ovmf_git.bb | 4 +- .../packagegroups/packagegroup-core-sdk.bb | 10 +- .../packagegroups/packagegroup-rust-sdk-target.bb | 14 + .../psplash/files/psplash-start.service | 1 + .../psplash/files/psplash-systemd.service | 1 + .../recipes-core/systemd/systemd-boot_251.8.bb | 73 - .../recipes-core/systemd/systemd-boot_252.4.bb | 73 + poky/meta/recipes-core/systemd/systemd.inc | 4 +- .../systemd/0001-Adjust-for-musl-headers.patch | 84 +- ...t-install-dependency-links-at-install-tim.patch | 4 +- ...ror-strerror-is-assumed-to-be-GNU-specifi.patch | 42 + .../systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch | 4 +- ...llback-parse_printf_format-implementation.patch | 22 +- ...asic-missing.h-check-for-missing-strndupa.patch | 158 +- ...if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch | 29 +- .../0010-Use-uintmax_t-for-handling-rlim_t.patch | 14 +- ...ass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch | 14 +- ...c-compatible-basename-for-non-glibc-syste.patch | 8 +- ...ble-buffering-when-writing-to-oom_score_a.patch | 4 +- ...-XSI-compliant-strerror_r-from-GNU-specif.patch | 22 +- ...22-do-not-disable-buffer-in-writing-files.patch | 106 +- .../systemd/0026-Handle-missing-gshadow.patch | 14 +- poky/meta/recipes-core/systemd/systemd_251.8.bb | 801 - poky/meta/recipes-core/systemd/systemd_252.4.bb | 812 + .../recipes-core/util-linux/util-linux_2.38.1.bb | 1 + .../recipes-devtools/binutils/binutils-2.39.inc | 1 + .../binutils/binutils/0015-CVE-2022-4285.patch | 37 + ...write-ftruncate-stat-instead-of-64bit-equ.patch | 903 + .../btrfs-tools/btrfs-tools_6.0.bb | 72 - .../btrfs-tools/btrfs-tools_6.1.bb | 73 + poky/meta/recipes-devtools/cargo/cargo.inc | 69 - poky/meta/recipes-devtools/cargo/cargo_1.65.0.bb | 5 - poky/meta/recipes-devtools/ccache/ccache_4.7.2.bb | 26 - poky/meta/recipes-devtools/ccache/ccache_4.7.4.bb | 26 + .../recipes-devtools/cmake/cmake-native_3.24.2.bb | 65 - .../recipes-devtools/cmake/cmake-native_3.25.1.bb | 65 + poky/meta/recipes-devtools/cmake/cmake.inc | 4 +- ...ineSystem-use-oe-environment-vars-to-load.patch | 4 +- poky/meta/recipes-devtools/cmake/cmake_3.24.2.bb | 67 - poky/meta/recipes-devtools/cmake/cmake_3.25.1.bb | 67 + poky/meta/recipes-devtools/dpkg/dpkg.inc | 4 +- ...01-build.c-ignore-return-of-1-from-tar-cf.patch | 7 +- ...tinsts-expect-D-to-be-set-when-running-in.patch | 18 +- poky/meta/recipes-devtools/dpkg/dpkg_1.21.17.bb | 23 + poky/meta/recipes-devtools/dpkg/dpkg_1.21.9.bb | 23 - ...ption-to-enable-disable-largefile-support.patch | 57 + ...-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch | 37 + ...s-fix-missing-check-for-permission-denied.patch | 2 +- .../e2fsprogs/e2fsprogs/quiet-debugfs.patch | 2 +- .../recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb | 4 +- .../recipes-devtools/elfutils/elfutils_0.187.bb | 172 - .../recipes-devtools/elfutils/elfutils_0.188.bb | 173 + ...ests-Add-libeu-to-tests-needing-error-API.patch | 147 - ...ile.am-compile-test_nlist-with-standard-C.patch | 8 +- .../0001-configure-use-AC_SYS_LARGEFILE.patch | 43 + ...ofs-replace-l-stat64-by-equivalent-l-stat.patch | 109 + ...nal.h-Make-LFS-mandatory-for-all-usecases.patch | 41 + .../erofs-utils/erofs-utils_1.5.bb | 8 +- ...-crash-of-sgdisk-when-compiled-with-lates.patch | 59 + .../0001-Use-64bit-time_t-on-linux-as-well.patch | 32 + poky/meta/recipes-devtools/fdisk/gptfdisk_1.0.9.bb | 2 + poky/meta/recipes-devtools/file/file_5.43.bb | 54 - poky/meta/recipes-devtools/file/file_5.44.bb | 54 + poky/meta/recipes-devtools/git/git_2.38.1.bb | 169 - poky/meta/recipes-devtools/git/git_2.39.0.bb | 169 + .../recipes-devtools/gnu-config/gnu-config_git.bb | 4 +- poky/meta/recipes-devtools/go/go-1.19.3.inc | 18 - poky/meta/recipes-devtools/go/go-1.19.4.inc | 18 + .../recipes-devtools/go/go-binary-native_1.19.3.bb | 48 - .../recipes-devtools/go/go-binary-native_1.19.4.bb | 48 + .../go/go-cross-canadian_1.19.3.bb | 2 - .../go/go-cross-canadian_1.19.4.bb | 2 + poky/meta/recipes-devtools/go/go-cross_1.19.3.bb | 2 - poky/meta/recipes-devtools/go/go-cross_1.19.4.bb | 2 + poky/meta/recipes-devtools/go/go-crosssdk.inc | 2 + .../meta/recipes-devtools/go/go-crosssdk_1.19.3.bb | 2 - .../meta/recipes-devtools/go/go-crosssdk_1.19.4.bb | 2 + poky/meta/recipes-devtools/go/go-native_1.19.3.bb | 58 - poky/meta/recipes-devtools/go/go-native_1.19.4.bb | 58 + poky/meta/recipes-devtools/go/go-runtime_1.19.3.bb | 3 - poky/meta/recipes-devtools/go/go-runtime_1.19.4.bb | 3 + ...-content-based-hash-generation-less-pedan.patch | 30 +- poky/meta/recipes-devtools/go/go_1.19.3.bb | 18 - poky/meta/recipes-devtools/go/go_1.19.4.bb | 18 + .../recipes-devtools/help2man/help2man_1.49.2.bb | 24 - .../recipes-devtools/help2man/help2man_1.49.3.bb | 24 + poky/meta/recipes-devtools/jquery/jquery_3.6.1.bb | 39 - poky/meta/recipes-devtools/jquery/jquery_3.6.3.bb | 39 + .../recipes-devtools/librepo/librepo_1.14.5.bb | 29 - .../recipes-devtools/librepo/librepo_1.15.1.bb | 29 + ...Enable-64bit-off_t-on-32bit-glibc-systems.patch | 79 + poky/meta/recipes-devtools/llvm/llvm_git.bb | 5 +- poky/meta/recipes-devtools/m4/m4-1.4.19.inc | 1 + .../0001-is_debianlike-always-return-False.patch | 27 - poky/meta/recipes-devtools/meson/meson_0.64.0.bb | 156 - poky/meta/recipes-devtools/meson/meson_1.0.0.bb | 155 + .../nasm/nasm/0001-stdlib-Add-strlcat.patch | 18 +- .../nasm/0002-Add-debug-prefix-map-option.patch | 74 +- poky/meta/recipes-devtools/nasm/nasm_2.15.05.bb | 23 - poky/meta/recipes-devtools/nasm/nasm_2.16.01.bb | 23 + ...key-remove-no-options-flag-from-gpg-calls.patch | 34 + poky/meta/recipes-devtools/opkg/opkg_0.6.0.bb | 73 - poky/meta/recipes-devtools/opkg/opkg_0.6.1.bb | 76 + .../8d2cb4f9ab8d564904c292099a022ffb3cccd52d.patch | 104 + .../recipes-devtools/patchelf/patchelf_0.16.1.bb | 17 - .../recipes-devtools/patchelf/patchelf_0.17.0.bb | 18 + .../perl/libmodule-build-perl_0.4231.bb | 124 - .../perl/libmodule-build-perl_0.4232.bb | 123 + .../perl/libtest-fatal-perl_0.017.bb | 36 + .../perl/libtest-warnings-perl_0.031.bb | 39 + .../recipes-devtools/perl/libtry-tiny-perl_0.31.bb | 36 + .../0001-Skip-TODO-test-cases-that-fail.patch | 110 + .../meta/recipes-devtools/perl/liburi-perl_5.08.bb | 50 - .../meta/recipes-devtools/perl/liburi-perl_5.17.bb | 56 + poky/meta/recipes-devtools/perl/perl_5.36.0.bb | 2 +- poky/meta/recipes-devtools/pseudo/pseudo_git.bb | 7 + poky/meta/recipes-devtools/python/python-gitdb.inc | 2 +- .../python/python3-attrs_22.1.0.bb | 19 - .../python/python3-attrs_22.2.0.bb | 19 + .../python/python3-certifi_2022.12.7.bb | 14 + .../python/python3-certifi_2022.9.24.bb | 14 - .../python/python3-chardet_5.0.0.bb | 24 - .../python/python3-chardet_5.1.0.bb | 24 + .../python/python3-cryptography-vectors_38.0.3.bb | 29 - .../python/python3-cryptography-vectors_38.0.4.bb | 29 + .../python/python3-cryptography_38.0.3.bb | 72 - .../python/python3-cryptography_38.0.4.bb | 71 + .../python/python3-cython_0.29.32.bb | 2 +- .../python/python3-dbusmock_0.28.4.bb | 18 - .../python/python3-dbusmock_0.28.6.bb | 21 + .../python/python3-dtschema_2022.11.bb | 15 - .../python/python3-dtschema_2022.12.bb | 15 + .../recipes-devtools/python/python3-git_3.1.29.bb | 32 - .../recipes-devtools/python/python3-git_3.1.30.bb | 32 + .../python/python3-gitdb_4.0.10.bb | 3 + .../recipes-devtools/python/python3-gitdb_4.0.9.bb | 3 - .../python/python3-hatch-vcs_0.2.0.bb | 14 - .../python/python3-hatch-vcs_0.3.0.bb | 14 + .../python/python3-hatchling_1.11.1.bb | 17 - .../python/python3-hatchling_1.12.1.bb | 17 + .../python/python3-hypothesis_6.56.4.bb | 38 - .../python/python3-hypothesis_6.61.0.bb | 38 + .../python/python3-importlib-metadata_5.0.0.bb | 20 - .../python/python3-importlib-metadata_5.2.0.bb | 20 + .../python/python3-installer/interpreter.patch | 24 +- .../python/python3-installer_0.5.1.bb | 28 - .../python/python3-installer_0.6.0.bb | 28 + .../python/python3-jsonschema_4.17.0.bb | 48 - .../python/python3-jsonschema_4.17.3.bb | 48 + .../recipes-devtools/python/python3-lxml_4.9.1.bb | 42 - .../recipes-devtools/python/python3-lxml_4.9.2.bb | 42 + .../recipes-devtools/python/python3-mako_1.2.3.bb | 20 - .../recipes-devtools/python/python3-mako_1.2.4.bb | 20 + .../python/python3-markdown_3.4.1.bb | 2 +- ...ath.py-do-not-write-full-path-to-output-f.patch | 28 - .../python/python3-numpy_1.23.4.bb | 72 - .../python/python3-numpy_1.24.1.bb | 72 + .../python/python3-packaging_21.3.bb | 12 - .../python/python3-packaging_22.0.bb | 10 + .../python/python3-pathspec_0.10.1.bb | 11 - .../python/python3-pathspec_0.10.3.bb | 11 + .../python/python3-poetry-core/deterministic.patch | 23 + .../python/python3-poetry-core_1.3.2.bb | 45 - .../python/python3-poetry-core_1.4.0.bb | 49 + .../python/python3-pycairo_1.21.0.bb | 26 - .../python/python3-pycairo_1.23.0.bb | 26 + .../python/python3-pycryptodome_3.15.0.bb | 5 - .../python/python3-pycryptodome_3.16.0.bb | 5 + .../python/python3-pycryptodomex_3.15.0.bb | 9 - .../python/python3-pycryptodomex_3.16.0.bb | 9 + .../python/python3-pyrsistent_0.19.2.bb | 14 - .../python/python3-pyrsistent_0.19.3.bb | 14 + .../recipes-devtools/python/python3-pytz_2022.6.bb | 35 - .../recipes-devtools/python/python3-pytz_2022.7.bb | 35 + .../python/python3-setuptools-scm_7.0.5.bb | 30 - .../python/python3-setuptools-scm_7.1.0.bb | 30 + ...ionally-do-not-fetch-code-by-easy_install.patch | 2 +- .../python/python3-setuptools_65.5.1.bb | 55 - .../python/python3-setuptools_65.6.3.bb | 55 + .../python/python3-smartypants_2.0.0.bb | 2 +- .../python/python3-sphinx_5.3.0.bb | 37 - .../python/python3-sphinx_6.0.0.bb | 37 + .../0001-setup.py-use-vendored-_distutils.patch | 27 - .../python/python3-strict-rfc3339_0.7.bb | 11 - .../python/python3-subunit_1.4.1.bb | 15 - .../python/python3-subunit_1.4.2.bb | 15 + .../python/python3-typogrify_2.0.7.bb | 2 +- .../python/python3-urllib3_1.26.12.bb | 23 - .../python/python3-urllib3_1.26.13.bb | 23 + .../recipes-devtools/python/python3-zipp_3.10.0.bb | 18 - .../recipes-devtools/python/python3-zipp_3.11.0.bb | 18 + ...void-shebang-overflow-on-python-config.py.patch | 14 +- ...the-shell-version-of-python-config-that-w.patch | 36 - ...Don-t-search-system-for-headers-libraries.patch | 2 +- ...ig.py-use-prefix-value-from-build-configu.patch | 2 +- ...roper-detection-of-mips-architecture-for-.patch | 227 - ...ysconfig-append-STAGING_LIBDIR-python-sys.patch | 28 - ...-cc_basename-to-replace-CC-for-checking-c.patch | 24 +- ...2-distutils-prefix-is-inside-staging-area.patch | 2 +- .../python/python3/python-config.patch | 55 - .../python/python3/python3-manifest.json | 1 + .../meta/recipes-devtools/python/python3_3.11.0.bb | 430 - .../meta/recipes-devtools/python/python3_3.11.1.bb | 443 + .../qemu/nativesdk-qemu-helper_1.0.bb | 2 +- .../qemu/qemu-helper-native_1.0.bb | 2 +- .../qemu/qemu-helper/qemu-oe-bridge-helper.c | 15 +- .../recipes-devtools/qemu/qemu-native_7.1.0.bb | 9 - .../recipes-devtools/qemu/qemu-native_7.2.0.bb | 9 + .../qemu/qemu-system-native_7.1.0.bb | 33 - .../qemu/qemu-system-native_7.2.0.bb | 33 + poky/meta/recipes-devtools/qemu/qemu.inc | 20 +- ...ure-Fix-check-tcg-not-executing-any-tests.patch | 56 + ...vhost-user-blk-Replace-lseek64-with-lseek.patch | 37 + ...net-tulip-Restrict-DMA-engine-to-memories.patch | 64 - ...Replace-use-of-lfs64-related-functions-an.patch | 358 + .../recipes-devtools/qemu/qemu/CVE-2022-3165.patch | 59 - .../recipes-devtools/qemu/qemu/arm-cpreg-fix.patch | 27 - poky/meta/recipes-devtools/qemu/qemu_7.1.0.bb | 27 - poky/meta/recipes-devtools/qemu/qemu_7.2.0.bb | 27 + poky/meta/recipes-devtools/repo/repo_2.29.9.bb | 31 - poky/meta/recipes-devtools/repo/repo_2.31.bb | 31 + .../rpm/files/environment.d-rpm.sh | 1 - poky/meta/recipes-devtools/rpm/rpm_4.18.0.bb | 18 +- ...ssing-prototypes-to-function-declarations.patch | 28 +- ...n-pedantic-errors-at-the-end-of-configure.patch | 68 - poky/meta/recipes-devtools/rsync/rsync_3.2.5.bb | 71 - poky/meta/recipes-devtools/rsync/rsync_3.2.7.bb | 70 + poky/meta/recipes-devtools/ruby/ruby.inc | 39 - .../0001-Remove-dependency-on-libcapstone.patch | 36 - ...0002-Obey-LDFLAGS-for-the-link-of-libruby.patch | 8 +- .../ruby/0006-Make-gemspecs-reproducible.patch | 17 +- poky/meta/recipes-devtools/ruby/ruby_3.1.2.bb | 108 - poky/meta/recipes-devtools/ruby/ruby_3.2.0.bb | 143 + poky/meta/recipes-devtools/rust/cargo_1.66.0.bb | 73 + .../0001-Do-not-use-LFS64-on-linux-with-musl.patch | 168 + .../rust/files/crossbeam_atomic.patch | 81 + .../rust/files/getrandom-open64.patch | 29 + .../rust/files/hardcodepaths.patch | 70 + .../recipes-devtools/rust/files/zlib-off64_t.patch | 31 + poky/meta/recipes-devtools/rust/libstd-rs.inc | 40 - .../meta/recipes-devtools/rust/libstd-rs_1.65.0.bb | 7 - .../meta/recipes-devtools/rust/libstd-rs_1.66.0.bb | 47 + .../rust/rust-cross-canadian_1.65.0.bb | 2 - .../rust/rust-cross-canadian_1.66.0.bb | 2 + poky/meta/recipes-devtools/rust/rust-llvm.inc | 78 - ...Enable-64bit-off_t-on-32bit-glibc-systems.patch | 79 + .../meta/recipes-devtools/rust/rust-llvm_1.65.0.bb | 6 - .../meta/recipes-devtools/rust/rust-llvm_1.66.0.bb | 85 + poky/meta/recipes-devtools/rust/rust-snapshot.inc | 27 +- poky/meta/recipes-devtools/rust/rust-source.inc | 26 +- poky/meta/recipes-devtools/rust/rust-target.inc | 10 - poky/meta/recipes-devtools/rust/rust.inc | 219 - ...001-Add-ENOTSUP-constant-for-riscv32-musl.patch | 32 - .../rust/rust/crossbeam_atomic.patch | 81 - .../recipes-devtools/rust/rust/hardcodepaths.patch | 70 - poky/meta/recipes-devtools/rust/rust_1.65.0.bb | 86 - poky/meta/recipes-devtools/rust/rust_1.66.0.bb | 297 + ...se-autoconf-macro-to-detect-largefile-sup.patch | 27 + .../0002-tests-Replace-off64_t-with-off_t.patch | 52 + poky/meta/recipes-devtools/strace/strace_6.0.bb | 57 - poky/meta/recipes-devtools/strace/strace_6.1.bb | 59 + poky/meta/recipes-devtools/swig/swig.inc | 2 +- ...nfigure-use-pkg-config-for-pcre-detection.patch | 44 +- poky/meta/recipes-devtools/swig/swig_4.0.2.bb | 7 - poky/meta/recipes-devtools/swig/swig_4.1.1.bb | 7 + .../tcltk/tcl/alter-includedir.patch | 46 +- .../tcltk/tcl/fix_non_native_build_issue.patch | 30 +- .../tcltk/tcl/tcl-add-soname.patch | 50 +- poky/meta/recipes-devtools/tcltk/tcl_8.6.11.bb | 104 - poky/meta/recipes-devtools/tcltk/tcl_8.6.13.bb | 104 + .../0001-Add-listen-action-for-a-tcp-socket.patch | 54 - ...-off64_t-to-off_t-on-linux-if-not-defined.patch | 28 + .../unfs3/0001-attr-fix-utime-for-symlink.patch | 85 - ...x-race-window-for-writing-of-the-pid-file.patch | 68 + .../0001-daemon.c-Libtirpc-porting-fixes.patch | 37 - .../unfs3/unfs3/alternate_rpc_ports.patch | 158 - .../unfs3/unfs3/fix_compile_warning.patch | 25 - .../fix_pid_race_parent_writes_child_pid.patch | 61 - .../recipes-devtools/unfs3/unfs3/no-yywrap.patch | 14 - .../unfs3/unfs3/relative_max_socket_path_len.patch | 74 - .../unfs3/unfs3/rename_fh_cache.patch | 64 - .../unfs3/unfs3/tcp_no_delay.patch | 56 - .../unfs3/unfs3/unfs3_parallel_build.patch | 37 - poky/meta/recipes-devtools/unfs3/unfs3_git.bb | 30 +- poky/meta/recipes-devtools/unifdef/unifdef_2.12.bb | 2 +- .../valgrind/valgrind/remove-for-aarch64 | 228 +- .../recipes-devtools/valgrind/valgrind_3.20.0.bb | 9 + poky/meta/recipes-extended/at/at_3.2.5.bb | 6 +- .../baremetal-example/baremetal-helloworld_git.bb | 72 + poky/meta/recipes-extended/bash/bash_5.2.15.bb | 22 + poky/meta/recipes-extended/bash/bash_5.2.9.bb | 22 - poky/meta/recipes-extended/bc/bc_1.07.1.bb | 2 +- poky/meta/recipes-extended/cronie/cronie_1.6.1.bb | 1 + .../gawk/gawk/remove-sensitive-tests.patch | 35 +- poky/meta/recipes-extended/gawk/gawk/run-ptest | 2 +- poky/meta/recipes-extended/gawk/gawk_5.1.1.bb | 64 - poky/meta/recipes-extended/gawk/gawk_5.2.1.bb | 69 + .../files/do-not-check-local-libpng-source.patch | 31 - .../ghostscript/ghostscript/cross-compile.patch | 40 + .../do-not-check-local-libpng-source.patch | 31 + .../ghostscript/ghostscript_10.0.0.bb | 129 + .../ghostscript/ghostscript_9.56.1.bb | 128 - poky/meta/recipes-extended/gperf/gperf_3.1.bb | 2 +- .../0001-rarpd-rdisc-Drop-PrivateUsers.patch | 27 - .../recipes-extended/iputils/iputils_20211215.bb | 66 - .../recipes-extended/iputils/iputils_20221126.bb | 49 + ...Do-not-include-sys-mount.h-when-linux-fs..patch | 47 - .../libarchive/libarchive_3.6.1.bb | 69 - .../libarchive/libarchive_3.6.2.bb | 67 + .../libpipeline/libpipeline_1.5.6.bb | 14 - .../libpipeline/libpipeline_1.5.7.bb | 14 + .../recipes-extended/libsolv/libsolv_0.7.22.bb | 33 - .../recipes-extended/libsolv/libsolv_0.7.23.bb | 33 + .../recipes-extended/logrotate/logrotate_3.20.1.bb | 88 - .../recipes-extended/logrotate/logrotate_3.21.0.bb | 88 + poky/meta/recipes-extended/lsof/lsof_4.96.4.bb | 39 - poky/meta/recipes-extended/lsof/lsof_4.96.5.bb | 48 + .../ltp/0001-testcases-Fix-largefile-support.patch | 426 + poky/meta/recipes-extended/ltp/ltp_20220930.bb | 1 + poky/meta/recipes-extended/man-db/man-db_2.10.2.bb | 68 - poky/meta/recipes-extended/man-db/man-db_2.11.1.bb | 70 + ...Use-_FILE_OFFSET_BITS-to-enable-largefile.patch | 147 + poky/meta/recipes-extended/mdadm/mdadm_4.2.bb | 1 + .../files/0001-detect-gold-as-GNU-linker-too.patch | 14 +- ...2-don-t-ignore-CFLAGS-when-building-snack.patch | 29 - poky/meta/recipes-extended/newt/libnewt_0.52.21.bb | 58 - poky/meta/recipes-extended/newt/libnewt_0.52.23.bb | 56 + .../pam/libpam/CVE-2022-28321-0002.patch | 205 + poky/meta/recipes-extended/psmisc/psmisc.inc | 1 + poky/meta/recipes-extended/psmisc/psmisc_23.5.bb | 9 - poky/meta/recipes-extended/psmisc/psmisc_23.6.bb | 9 + ...a-Use-realloc-3-instead-of-reallocarray-3.patch | 34 - poky/meta/recipes-extended/quota/quota/fcntl.patch | 27 +- poky/meta/recipes-extended/quota/quota_4.06.bb | 35 - poky/meta/recipes-extended/quota/quota_4.09.bb | 34 + .../recipes-extended/rpcsvc-proto/rpcsvc-proto.bb | 3 +- ...LARGEFILE-macro-to-control-largefile-supp.patch | 80 + .../0001-Disable-use-of-syslog-for-sysroot.patch | 6 +- ...h.conf-message-when-not-in-place-eg.-musl.patch | 27 - .../files/0001-shadow-use-relaxed-usernames.patch | 104 - ...fix-unexpected-open-failure-in-chroot-env.patch | 6 +- poky/meta/recipes-extended/shadow/shadow.inc | 4 +- poky/meta/recipes-extended/shadow/shadow_4.12.3.bb | 11 - poky/meta/recipes-extended/shadow/shadow_4.13.bb | 11 + ...GOLD-1-via-makefile-to-enable-gold-linker.patch | 65 + .../stress-ng/stress-ng_0.14.06.bb | 32 - .../stress-ng/stress-ng_0.15.01.bb | 33 + poky/meta/recipes-extended/sudo/sudo.inc | 2 + .../texinfo/texinfo/0001-gnulib-Update.patch | 11765 ---- .../texinfo/texinfo/disable-native-tools.patch | 19 +- .../texinfo/texinfo/dont-depend-on-help2man.patch | 8 +- .../texinfo/texinfo/link-zip.patch | 2 +- .../texinfo/texinfo/use_host_makedoc.patch | 19 +- poky/meta/recipes-extended/texinfo/texinfo_6.8.bb | 90 - .../meta/recipes-extended/texinfo/texinfo_7.0.1.bb | 90 + poky/meta/recipes-extended/timezone/timezone.inc | 7 +- poky/meta/recipes-extended/xz/xz_5.2.7.bb | 44 - poky/meta/recipes-extended/xz/xz_5.4.0.bb | 44 + poky/meta/recipes-gnome/epiphany/epiphany_42.4.bb | 43 - poky/meta/recipes-gnome/epiphany/epiphany_43.0.bb | 40 + ...eson.build-fix-one-parallel-build-failure.patch | 37 - ...-correctly-handle-disabled-ssh_agent-opti.patch | 49 + .../b3ca1d02bb0148ca787ac4aead164d7c8ce2c4d8.patch | 61 - ...-correctly-handle-disabled-ssh_agent-opti.patch | 36 + poky/meta/recipes-gnome/gcr/gcr3_3.41.1.bb | 59 + poky/meta/recipes-gnome/gcr/gcr_3.40.0.bb | 50 - poky/meta/recipes-gnome/gcr/gcr_4.0.0.bb | 59 + poky/meta/recipes-gnome/gi-docgen/gi-docgen_git.bb | 2 +- ...he-repository-directory-for-native-builds.patch | 4 +- .../gobject-introspection_1.72.0.bb | 194 - .../gobject-introspection_1.74.0.bb | 194 + poky/meta/recipes-gnome/gtk+/gtk+3.inc | 41 +- ...-build-introspection-according-to-option-.patch | 34 + ...Do-not-try-to-initialize-GL-without-libGL.patch | 57 - .../0003-Add-disable-opengl-configure-option.patch | 872 - .../recipes-gnome/gtk+/gtk+3/link_fribidi.patch | 19 - poky/meta/recipes-gnome/gtk+/gtk+3/opengl.patch | 737 + poky/meta/recipes-gnome/gtk+/gtk+3_3.24.34.bb | 17 - poky/meta/recipes-gnome/gtk+/gtk+3_3.24.36.bb | 16 + poky/meta/recipes-gnome/gtk+/gtk4_4.8.3.bb | 128 + poky/meta/recipes-gnome/libhandy/libhandy_1.6.3.bb | 27 - poky/meta/recipes-gnome/libhandy/libhandy_1.8.0.bb | 27 + poky/meta/recipes-gnome/libportal/libportal_0.6.bb | 20 + poky/meta/recipes-gnome/librsvg/librsvg_2.54.5.bb | 2 + .../cairo/cairo/CVE-2019-6461.patch | 21 +- .../cairo/cairo/CVE-2019-6462.patch | 46 +- poky/meta/recipes-graphics/drm/libdrm_2.4.114.bb | 3 +- .../recipes-graphics/glslang/glslang_1.3.231.1.bb | 32 - .../recipes-graphics/glslang/glslang_1.3.236.0.bb | 32 + .../recipes-graphics/graphene/graphene_1.10.8.bb | 22 + .../recipes-graphics/harfbuzz/harfbuzz_5.3.1.bb | 45 - .../recipes-graphics/harfbuzz/harfbuzz_6.0.0.bb | 45 + poky/meta/recipes-graphics/kmscube/kmscube_git.bb | 2 +- ...-dispatch_common.h-define-also-EGL_NO_X11.patch | 27 - .../recipes-graphics/libepoxy/libepoxy_1.5.10.bb | 4 +- ...unwind-in-native-OE-builds-by-not-looking.patch | 36 - .../recipes-graphics/libsdl2/libsdl2_2.24.2.bb | 85 - .../recipes-graphics/libsdl2/libsdl2_2.26.2.bb | 85 + .../recipes-graphics/libva/libva-utils_2.16.0.bb | 32 - .../recipes-graphics/libva/libva-utils_2.17.1.bb | 32 + poky/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb | 4 +- poky/meta/recipes-graphics/mesa/mesa.inc | 24 +- ....build-install-nofonts-fonts.conf-as-it-i.patch | 35 - poky/meta/recipes-graphics/pango/pango_1.50.11.bb | 55 - poky/meta/recipes-graphics/pango/pango_1.50.12.bb | 54 + ...ke-Don-t-enable-GLX-if-tests-are-disabled.patch | 32 - poky/meta/recipes-graphics/piglit/piglit_git.bb | 3 +- .../recipes-graphics/shaderc/shaderc_2022.3.bb | 30 - .../recipes-graphics/shaderc/shaderc_2022.4.bb | 30 + .../spir/spirv-headers_1.3.231.1.bb | 18 - .../spir/spirv-headers_1.3.236.0.bb | 18 + .../recipes-graphics/spir/spirv-tools_1.3.231.1.bb | 42 - .../recipes-graphics/spir/spirv-tools_1.3.236.0.bb | 42 + .../virglrenderer/virglrenderer_0.10.3.bb | 33 - .../virglrenderer/virglrenderer_0.10.4.bb | 33 + .../vulkan/vulkan-headers_1.3.231.1.bb | 22 - .../vulkan/vulkan-headers_1.3.236.0.bb | 22 + .../vulkan/vulkan-loader_1.3.231.1.bb | 38 - .../vulkan/vulkan-loader_1.3.236.0.bb | 38 + ...-Do-not-use-LFS64-functions-on-linux-musl.patch | 37 + .../recipes-graphics/vulkan/vulkan-samples_git.bb | 3 +- .../vulkan/vulkan-tools_1.3.231.1.bb | 32 - .../vulkan/vulkan-tools_1.3.236.0.bb | 32 + .../recipes-graphics/wayland/libinput_1.21.0.bb | 50 - .../recipes-graphics/wayland/libinput_1.22.0.bb | 50 + .../wayland/wayland-protocols_1.28.bb | 25 - .../wayland/wayland-protocols_1.31.bb | 25 + .../meta/recipes-graphics/wayland/weston_11.0.0.bb | 139 - .../meta/recipes-graphics/wayland/weston_11.0.1.bb | 139 + poky/meta/recipes-graphics/xorg-app/xhost_1.0.8.bb | 20 - poky/meta/recipes-graphics/xorg-app/xhost_1.0.9.bb | 21 + poky/meta/recipes-graphics/xorg-app/xinit_1.4.1.bb | 25 - poky/meta/recipes-graphics/xorg-app/xinit_1.4.2.bb | 26 + .../recipes-graphics/xorg-app/xkbcomp_1.4.5.bb | 18 - .../recipes-graphics/xorg-app/xkbcomp_1.4.6.bb | 19 + poky/meta/recipes-graphics/xorg-app/xprop_1.2.5.bb | 17 - poky/meta/recipes-graphics/xorg-app/xprop_1.2.6.bb | 18 + .../meta/recipes-graphics/xorg-app/xrandr_1.5.1.bb | 18 - .../meta/recipes-graphics/xorg-app/xrandr_1.5.2.bb | 17 + .../xorg-app/xset/disable-xkb.patch | 23 +- poky/meta/recipes-graphics/xorg-app/xset_1.2.4.bb | 19 - poky/meta/recipes-graphics/xorg-app/xset_1.2.5.bb | 20 + .../meta/recipes-graphics/xorg-app/xvinfo_1.1.4.bb | 14 - .../meta/recipes-graphics/xorg-app/xvinfo_1.1.5.bb | 14 + .../xorg-driver/xf86-input-mouse_1.9.3.bb | 14 - .../xorg-driver/xf86-input-mouse_1.9.4.bb | 14 + .../xorg-driver/xf86-video-vesa_2.5.0.bb | 19 - .../xorg-driver/xf86-video-vesa_2.6.0.bb | 20 + .../meta/recipes-graphics/xorg-lib/libdmx_1.1.4.bb | 3 +- .../recipes-graphics/xorg-lib/libfontenc_1.1.6.bb | 18 - .../recipes-graphics/xorg-lib/libfontenc_1.1.7.bb | 16 + .../recipes-graphics/xorg-lib/libice_1.0.10.bb | 28 - .../meta/recipes-graphics/xorg-lib/libice_1.1.1.bb | 27 + ...-Use-pwrite-pread-instead-of-64bit-versio.patch | 39 + .../recipes-graphics/xorg-lib/libpciaccess_0.17.bb | 3 +- poky/meta/recipes-graphics/xorg-lib/libsm_1.2.3.bb | 31 - poky/meta/recipes-graphics/xorg-lib/libsm_1.2.4.bb | 30 + .../0001-Drop-x11-dependencies.patch | 12 +- .../xorg-lib/libx11-compose-data_1.6.8.bb | 36 - .../xorg-lib/libx11-compose-data_1.8.3.bb | 35 + .../meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb | 49 - .../meta/recipes-graphics/xorg-lib/libx11_1.8.3.bb | 45 + .../recipes-graphics/xorg-lib/libxau_1.0.10.bb | 24 - .../recipes-graphics/xorg-lib/libxau_1.0.11.bb | 23 + .../xorg-lib/libxcomposite_0.4.5.bb | 28 - .../xorg-lib/libxcomposite_0.4.6.bb | 27 + .../recipes-graphics/xorg-lib/libxdamage_1.1.5.bb | 29 - .../recipes-graphics/xorg-lib/libxdamage_1.1.6.bb | 28 + .../recipes-graphics/xorg-lib/libxdmcp_1.1.3.bb | 29 - .../recipes-graphics/xorg-lib/libxdmcp_1.1.4.bb | 28 + .../recipes-graphics/xorg-lib/libxext_1.3.5.bb | 1 - .../recipes-graphics/xorg-lib/libxfixes_6.0.0.bb | 1 + .../recipes-graphics/xorg-lib/libxfont2_2.0.6.bb | 1 - .../recipes-graphics/xorg-lib/libxfont_1.5.4.bb | 1 + .../meta/recipes-graphics/xorg-lib/libxft_2.3.6.bb | 33 - .../meta/recipes-graphics/xorg-lib/libxft_2.3.7.bb | 32 + poky/meta/recipes-graphics/xorg-lib/libxi_1.8.bb | 1 + .../recipes-graphics/xorg-lib/libxinerama_1.1.5.bb | 1 - .../xorg-lib/libxkbcommon_1.4.1.bb | 36 - .../xorg-lib/libxkbcommon_1.5.0.bb | 38 + .../recipes-graphics/xorg-lib/libxkbfile_1.1.1.bb | 17 - .../recipes-graphics/xorg-lib/libxkbfile_1.1.2.bb | 16 + .../meta/recipes-graphics/xorg-lib/libxmu_1.1.4.bb | 1 - .../recipes-graphics/xorg-lib/libxpm_3.5.13.bb | 27 - .../recipes-graphics/xorg-lib/libxpm_3.5.14.bb | 26 + .../recipes-graphics/xorg-lib/libxrandr_1.5.2.bb | 23 - .../recipes-graphics/xorg-lib/libxrandr_1.5.3.bb | 22 + .../recipes-graphics/xorg-lib/libxrender_0.9.11.bb | 1 - .../recipes-graphics/xorg-lib/libxres_1.2.1.bb | 19 - .../recipes-graphics/xorg-lib/libxres_1.2.2.bb | 19 + .../xorg-lib/libxscrnsaver_1.2.3.bb | 23 - .../xorg-lib/libxscrnsaver_1.2.4.bb | 22 + .../xorg-lib/libxshmfence_1.3.1.bb | 21 - .../xorg-lib/libxshmfence_1.3.2.bb | 20 + poky/meta/recipes-graphics/xorg-lib/libxt_1.2.1.bb | 1 + .../recipes-graphics/xorg-lib/libxtst_1.2.4.bb | 1 - .../meta/recipes-graphics/xorg-lib/libxv_1.0.11.bb | 19 - .../meta/recipes-graphics/xorg-lib/libxv_1.0.12.bb | 18 + .../recipes-graphics/xorg-lib/libxxf86vm_1.1.5.bb | 1 - .../recipes-graphics/xorg-lib/xcb-util_0.4.0.bb | 10 - .../recipes-graphics/xorg-lib/xcb-util_0.4.1.bb | 9 + .../xorg-lib/xkeyboard-config_2.37.bb | 2 + .../recipes-graphics/xorg-lib/xorg-lib-common.inc | 2 +- .../meta/recipes-graphics/xorg-lib/xtrans_1.4.0.bb | 2 + .../recipes-graphics/xorg-util/makedepend_1.0.7.bb | 20 - .../recipes-graphics/xorg-util/makedepend_1.0.8.bb | 20 + ...some-possible-memleaks-in-XkbGetKbdByName.patch | 63 - ...etCountedString-against-request-length-at.patch | 38 - .../xorg-xserver/xserver-xorg_21.1.4.bb | 30 - .../xorg-xserver/xserver-xorg_21.1.6.bb | 28 + .../recipes-graphics/xwayland/xwayland_22.1.5.bb | 45 - .../recipes-graphics/xwayland/xwayland_22.1.7.bb | 45 + .../kern-tools/kern-tools-native_git.bb | 2 +- .../recipes-kernel/kexec/kexec-tools_2.0.25.bb | 86 - .../recipes-kernel/kexec/kexec-tools_2.0.26.bb | 86 + .../linux-firmware/linux-firmware_20221012.bb | 1126 - .../linux-firmware/linux-firmware_20221214.bb | 1126 + .../linux-libc-headers/linux-libc-headers.inc | 2 + ...-fixed-input-and-output-files-instead-of-.patch | 67 - .../linux-libc-headers/linux-libc-headers_5.19.bb | 20 - .../linux-libc-headers/linux-libc-headers_6.1.bb | 18 + poky/meta/recipes-kernel/linux/kernel-devsrc.bb | 25 +- poky/meta/recipes-kernel/linux/linux-yocto-dev.bb | 4 +- .../recipes-kernel/linux/linux-yocto-rt_5.15.bb | 6 +- .../recipes-kernel/linux/linux-yocto-rt_5.19.bb | 6 +- .../recipes-kernel/linux/linux-yocto-rt_6.1.bb | 45 + .../recipes-kernel/linux/linux-yocto-tiny_5.15.bb | 6 +- .../recipes-kernel/linux/linux-yocto-tiny_5.19.bb | 6 +- .../recipes-kernel/linux/linux-yocto-tiny_6.1.bb | 30 + poky/meta/recipes-kernel/linux/linux-yocto_5.15.bb | 26 +- poky/meta/recipes-kernel/linux/linux-yocto_5.19.bb | 26 +- poky/meta/recipes-kernel/linux/linux-yocto_6.1.bb | 70 + ..._common-drop-kmem_alloc-avoid-dereferenci.patch | 278 + .../recipes-kernel/lttng/lttng-modules_2.13.7.bb | 1 + ...1-compat-Define-off64_t-as-off_t-on-linux.patch | 35 + .../recipes-kernel/lttng/lttng-tools_2.13.8.bb | 1 + .../systemtap/systemtap/python-3.11.patch | 37 - .../recipes-kernel/systemtap/systemtap_git.inc | 5 +- ...01-aplay-axfer-Replace-off64_t-with-off_t.patch | 272 + .../recipes-multimedia/alsa/alsa-utils_1.2.8.bb | 4 +- ...pzaenc-stop-accessing-out-of-bounds-frame.patch | 89 + ...smcenc-stop-accessing-out-of-bounds-frame.patch | 108 + .../meta/recipes-multimedia/ffmpeg/ffmpeg_5.1.2.bb | 7 +- poky/meta/recipes-multimedia/flac/flac_1.4.0.bb | 43 - poky/meta/recipes-multimedia/flac/flac_1.4.2.bb | 39 + .../gstreamer/gst-devtools_1.20.4.bb | 52 - .../gstreamer/gst-devtools_1.20.5.bb | 52 + .../gstreamer/gstreamer1.0-libav_1.20.4.bb | 28 - .../gstreamer/gstreamer1.0-libav_1.20.5.bb | 28 + .../gstreamer/gstreamer1.0-omx_1.20.4.bb | 47 - .../gstreamer/gstreamer1.0-omx_1.20.5.bb | 47 + .../gstreamer/gstreamer1.0-plugins-bad_1.20.4.bb | 165 - .../gstreamer/gstreamer1.0-plugins-bad_1.20.5.bb | 165 + .../gstreamer/gstreamer1.0-plugins-base_1.20.4.bb | 94 - .../gstreamer/gstreamer1.0-plugins-base_1.20.5.bb | 94 + .../gstreamer/gstreamer1.0-plugins-good_1.20.4.bb | 85 - .../gstreamer/gstreamer1.0-plugins-good_1.20.5.bb | 85 + .../gstreamer/gstreamer1.0-plugins-license.inc | 2 +- .../gstreamer/gstreamer1.0-plugins-packaging.inc | 4 +- .../gstreamer/gstreamer1.0-plugins-ugly_1.20.4.bb | 46 - .../gstreamer/gstreamer1.0-plugins-ugly_1.20.5.bb | 46 + .../gstreamer/gstreamer1.0-python_1.20.4.bb | 30 - .../gstreamer/gstreamer1.0-python_1.20.5.bb | 30 + .../gstreamer/gstreamer1.0-rtsp-server_1.20.4.bb | 31 - .../gstreamer/gstreamer1.0-rtsp-server_1.20.5.bb | 31 + .../gstreamer/gstreamer1.0-vaapi_1.20.4.bb | 53 - .../gstreamer/gstreamer1.0-vaapi_1.20.5.bb | 53 + .../0005-bin-Fix-race-conditions-in-tests.patch | 300 + ...e-gstbin-test_watch_for_state_change-test.patch | 107 - .../gstreamer/gstreamer1.0_1.20.4.bb | 73 - .../gstreamer/gstreamer1.0_1.20.5.bb | 73 + .../recipes-multimedia/libpng/libpng_1.6.38.bb | 34 - .../recipes-multimedia/libpng/libpng_1.6.39.bb | 36 + .../libsndfile/libsndfile1_1.1.0.bb | 32 - .../libsndfile/libsndfile1_1.2.0.bb | 32 + ...dling-of-TIFFTAG_INKNAMES-and-related-TIF.patch | 266 - ...1-fix-the-FPE-in-tiffcrop-415-427-and-428.patch | 184 - ...1-tiffcrop-S-option-Make-decision-simpler.patch | 36 - ...sable-incompatibility-of-Z-X-Y-z-options-.patch | 59 - ...broutines-require-a-larger-buffer-fixes-2.patch | 653 - .../libtiff/files/CVE-2022-2953.patch | 86 - .../libtiff/files/CVE-2022-34526.patch | 32 - poky/meta/recipes-multimedia/libtiff/tiff_4.4.0.bb | 71 - poky/meta/recipes-multimedia/libtiff/tiff_4.5.0.bb | 64 + .../recipes-multimedia/mpg123/mpg123_1.31.1.bb | 2 + poky/meta/recipes-sato/puzzles/puzzles_git.bb | 2 +- .../recipes-sato/rxvt-unicode/rxvt-unicode_9.30.bb | 8 - .../recipes-sato/rxvt-unicode/rxvt-unicode_9.31.bb | 8 + ...Introspection.cmake-prefix-variables-obta.patch | 39 +- .../0001-Fix-build-without-opengl-or-es.patch | 133 - ...c-settings-so-that-gtkdoc-generation-work.patch | 47 - ...ng-introspection-files-do-not-quote-CFLAG.patch | 67 +- .../webkitgtk/fix-gstreamer-include-paths.patch | 51 - poky/meta/recipes-sato/webkit/webkitgtk_2.36.7.bb | 168 - poky/meta/recipes-sato/webkit/webkitgtk_2.38.3.bb | 165 + .../meta/recipes-support/atk/at-spi2-atk_2.38.0.bb | 20 - .../recipes-support/atk/at-spi2-core_2.44.1.bb | 39 - .../recipes-support/atk/at-spi2-core_2.46.0.bb | 45 + poky/meta/recipes-support/atk/atk_2.38.0.bb | 20 - ...se-portable-version-of-dirent-and-readdir.patch | 39 + poky/meta/recipes-support/attr/acl_2.3.1.bb | 3 + poky/meta/recipes-support/boost/boost-1.80.0.inc | 20 - poky/meta/recipes-support/boost/boost-1.81.0.inc | 20 + .../boost/boost-build-native_1.80.0.bb | 28 - .../boost/boost-build-native_1.81.0.bb | 28 + poky/meta/recipes-support/boost/boost.inc | 1 + ...-unary-binary_function-base-classes-are-d.patch | 34 - poky/meta/recipes-support/boost/boost_1.80.0.bb | 8 - poky/meta/recipes-support/boost/boost_1.81.0.bb | 7 + poky/meta/recipes-support/curl/curl_7.86.0.bb | 116 - poky/meta/recipes-support/curl/curl_7.87.0.bb | 116 + .../recipes-support/diffoscope/diffoscope_224.bb | 30 - .../recipes-support/diffoscope/diffoscope_230.bb | 30 + ...c-use-a-custom-value-for-the-location-of-.patch | 6 +- ...0002-use-pkgconfig-instead-of-npth-config.patch | 6 +- .../recipes-support/gnupg/gnupg/relocate.patch | 18 +- poky/meta/recipes-support/gnupg/gnupg_2.3.7.bb | 87 - poky/meta/recipes-support/gnupg/gnupg_2.4.0.bb | 87 + ...1-posix-io.c-Use-off_t-instead-of-off64_t.patch | 42 + poky/meta/recipes-support/gpgme/gpgme_1.18.0.bb | 1 + poky/meta/recipes-support/icu/icu_71.1.bb | 146 - poky/meta/recipes-support/icu/icu_72-1.bb | 150 + .../recipes-support/iso-codes/iso-codes_4.12.0.bb | 2 + ...eplace-off64_t-with-off_t-in-funopen_seek.patch | 34 + poky/meta/recipes-support/libbsd/libbsd_0.11.7.bb | 4 +- .../recipes-support/libevent/libevent_2.1.12.bb | 2 +- ...1-Do-not-fail-when-testing-config-scripts.patch | 8 +- .../libgpg-error/libgpg-error/pkgconfig.patch | 16 +- .../libgpg-error/libgpg-error_1.45.bb | 53 - .../libgpg-error/libgpg-error_1.46.bb | 53 + .../libksba/ksba-add-pkgconfig-support.patch | 6 +- poky/meta/recipes-support/libksba/libksba_1.6.2.bb | 34 - poky/meta/recipes-support/libksba/libksba_1.6.3.bb | 34 + poky/meta/recipes-support/libmpc/libmpc_1.2.1.bb | 12 - poky/meta/recipes-support/libmpc/libmpc_1.3.1.bb | 12 + .../meta/recipes-support/libpcre/libpcre2_10.40.bb | 55 - .../meta/recipes-support/libpcre/libpcre2_10.42.bb | 55 + poky/meta/recipes-support/libpsl/libpsl_0.21.1.bb | 25 - poky/meta/recipes-support/libpsl/libpsl_0.21.2.bb | 26 + .../recipes-support/libseccomp/libseccomp_2.5.4.bb | 2 +- poky/meta/recipes-support/mpfr/mpfr_4.1.0.bb | 19 - poky/meta/recipes-support/mpfr/mpfr_4.2.0.bb | 19 + .../meta/recipes-support/nghttp2/nghttp2_1.50.0.bb | 33 - .../meta/recipes-support/nghttp2/nghttp2_1.51.0.bb | 33 + ...001-configure-Check-for-largefile-support.patch | 27 + ...ce-stat64-fstat64-ftruncate64mmap64-with-.patch | 64 + poky/meta/recipes-support/numactl/numactl_git.bb | 2 + .../0001-popt-test-output-format-for-ptest.patch | 68 - poky/meta/recipes-support/popt/popt_1.18.bb | 33 - poky/meta/recipes-support/popt/popt_1.19.bb | 31 + poky/meta/recipes-support/sqlite/sqlite3_3.39.4.bb | 14 - poky/meta/recipes-support/sqlite/sqlite3_3.40.1.bb | 14 + poky/meta/recipes-support/vim/vim.inc | 4 +- ...cs-correctly-substitute-gtkdoc-qemu-wrapp.patch | 24 - poky/meta/recipes-support/vte/vte_0.68.0.bb | 62 - poky/meta/recipes-support/vte/vte_0.70.2.bb | 54 + poky/meta/site/common-musl | 2 + poky/meta/site/powerpc32-linux | 1 - poky/scripts/combo-layer | 30 +- poky/scripts/devtool | 17 +- poky/scripts/lib/buildstats.py | 4 +- poky/scripts/lib/checklayer/__init__.py | 13 +- poky/scripts/lib/checklayer/cases/bsp.py | 2 +- poky/scripts/lib/checklayer/cases/common.py | 3 + poky/scripts/lib/checklayer/cases/distro.py | 2 +- poky/scripts/lib/devtool/standard.py | 57 +- poky/scripts/lib/devtool/upgrade.py | 18 +- poky/scripts/runqemu | 21 +- poky/scripts/runqemu-export-rootfs | 25 +- poky/scripts/runqemu-extract-sdk | 2 +- poky/scripts/yocto-check-layer | 5 +- 2170 files changed, 147276 insertions(+), 146850 deletions(-) create mode 100644 meta-arm/ci/0001-Revert-pixman-Do-not-use-clang-assembler-for-now.patch delete mode 100644 meta-arm/ci/gem5-arm64.yml delete mode 100644 meta-arm/ci/gem5-atp-arm64.yml delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0001-corstone1000-platform-secure-test-framework.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0002-corstone1000-make-external-system-support-optional.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0003-corstone1000-enable-secure-enclave-run-without-host-.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0004-Platform-Partition-Allow-configuration-of-input-and-.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0005-corstone1000-support-for-UEFI-FMP-image-Information.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0006-corstone1000-remove-two-partition-configuration.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0007-corstone1000-adjust-PS-asset-configuration.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.%.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.%.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/optee/files/optee-os/n1sdp/0006-plat-n1sdp-add-external-device-tree-base-and-size.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-security/optee/optee-os_3.19.0.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/packagegroups/packagegroup-ts-tests.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0023-Use-the-stateless-platform-service.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/libts_%.bbappend delete mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/libts_git.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc delete mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-corstone1000.inc create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-demo_%.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-crypto-api-test_%.bbappend delete mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-crypto-api-test_git.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-iat-api-test_%.bbappend delete mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-iat-api-test_git.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-its-api-test_%.bbappend delete mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-its-api-test_git.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-ps-api-test_%.bbappend delete mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-ps-api-test_git.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-service-test_%.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-attestation_%.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-crypto_%.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-its_%.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-storage_%.bbappend create mode 100644 meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-uefi-test_%.bbappend create mode 100644 meta-arm/meta-arm/classes/apply_local_src_patches.bbclass delete mode 100644 meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.0.bb create mode 100644 meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.0.bb delete mode 100644 meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-a-aem_11.18.16.bb create mode 100644 meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-a-aem_11.20.15.bb delete mode 100644 meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-r-aem_11.19.14.bb create mode 100644 meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-r-aem_11.20.15.bb create mode 100644 meta-arm/meta-arm/recipes-devtools/gn/gn/0001-Replace-lstat64-stat64-functions-on-linux.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0001-core-Define-section-attributes-for-clang.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0007-allow-setting-sysroot-for-clang.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0008-no-warn-rwx-segments.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0009-add-z-execstack.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0010-add-note-GNU-stack-section.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0001-core-Define-section-attributes-for-clang.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0007-allow-setting-sysroot-for-clang.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0008-no-warn-rwx-segments.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0009-add-z-execstack.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0010-add-note-GNU-stack-section.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-3_19.inc create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0001-core-Define-section-attributes-for-clang.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0007-allow-setting-sysroot-for-clang.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0008-no-warn-rwx-segments.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0009-add-z-execstack.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0010-add-note-GNU-stack-section.patch delete mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os/0001-core-Define-section-attributes-for-clang.patch delete mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch delete mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os/0007-allow-setting-sysroot-for-clang.patch delete mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os/0008-no-warn-rwx-segments.patch delete mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os/0009-add-z-execstack.patch delete mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os/0010-add-note-GNU-stack-section.patch create mode 100644 meta-arm/meta-arm/recipes-security/optee/optee-os_3.19.0.bb delete mode 100644 meta-arm/meta-atp/README.md delete mode 100644 meta-arm/meta-atp/conf/layer.conf delete mode 100644 meta-arm/meta-atp/conf/machine/gem5-atp-arm64.conf delete mode 100644 meta-arm/meta-atp/recipes-devtools/atp/atp-native_3.1.bb delete mode 100644 meta-arm/meta-atp/recipes-devtools/atp/atp-source_3.1.inc delete mode 100644 meta-arm/meta-atp/recipes-devtools/atp/files/no-werror.patch delete mode 100644 meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend delete mode 100755 meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh delete mode 100644 meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend delete mode 100755 meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh delete mode 100644 meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend delete mode 100644 meta-arm/meta-atp/recipes-kernel/atp/atp-module_3.1.bb delete mode 100644 meta-arm/meta-atp/recipes-kernel/atp/atp-test_3.1.bb delete mode 100644 meta-arm/meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb delete mode 100644 meta-arm/meta-atp/recipes-kernel/linux/files/no_ftrace.cfg delete mode 100644 meta-arm/meta-atp/recipes-kernel/linux/files/smmuv3.cfg delete mode 100644 meta-arm/meta-atp/recipes-kernel/linux/linux-yocto_%.bbappend delete mode 100644 meta-arm/meta-gem5/COPYING.MIT delete mode 100644 meta-arm/meta-gem5/README.md delete mode 100644 meta-arm/meta-gem5/conf/layer.conf delete mode 100644 meta-arm/meta-gem5/conf/machine/gem5-arm64.conf delete mode 100644 meta-arm/meta-gem5/documentation/gem5-arm64.md delete mode 100644 meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-bsp/boot-wrapper-aaarch64/boot-wrapper-aarch64_%.bbappend delete mode 100644 meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend delete mode 100644 meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-extended/xen/files/gem5-arm64/early-printk.cfg delete mode 100644 meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-extended/xen/xen_%.bbappend delete mode 100644 meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/linux-%.bbappend delete mode 100644 meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/virtualization-kmeta-extra-gem5/features/disable-arm64-sve.cfg delete mode 100644 meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/virtualization-kmeta-extra-gem5/features/disable-arm64-sve.scc delete mode 100644 meta-arm/meta-gem5/recipes-bsp/boot-wrapper-aarch64/boot-wrapper-aarch64_%.bbappend delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/files/mapping.patch delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/files/start-gem5.sh delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-bootloader.inc delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-bootloader_20.bb delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-dtb.bb delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native.inc delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native/0001-dev-arm-SMMUv3-enable-interrupt-interface.patch delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native_20.bb delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5ops/0001-util-m5ops-optional-extra-build-flags.patch delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5ops_20.bb delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5term-native_20.bb delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5term/0001-add-makefile-flags.patch delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-native.inc delete mode 100644 meta-arm/meta-gem5/recipes-devtools/gem5/gem5-source_20.inc delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/0001-lib-build_OID_registry-fix-reproducibility-issues.patch delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/0002-vt-conmakehash-improve-reproducibility.patch delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_1cpu.dts delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_2cpu.dts delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_4cpu.dts delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_8cpu.dts delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/vexpress_gem5_v2.dtsi delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/vexpress_gem5_v2_base.dtsi delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/files/init_disassemble_info-signature-changes-causes-compile-failures.patch delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64-standard.scc delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64.scc delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-board.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-cfi.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-drm.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-net.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-pata.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-pci.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-rtc.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-serial.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-virtio.cfg delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_%.bbappend delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_5.4.bb delete mode 100644 meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_5.4.bbappend create mode 100644 meta-openembedded/meta-filesystems/recipes-filesystems/ntfs-3g-ntfsprogs/ntfs-3g-ntfsprogs_2022.10.3.bb delete mode 100644 meta-openembedded/meta-filesystems/recipes-filesystems/ntfs-3g-ntfsprogs/ntfs-3g-ntfsprogs_2022.5.17.bb delete mode 100644 meta-openembedded/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.5.bb create mode 100644 meta-openembedded/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.7.bb create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/aufs-util/aufs-util/0001-libau-Do-not-build-LFS-version-of-readdir.patch create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0001-f2fs_io-Fix-out-of-tree-builds.patch create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0002-f2fs_io-Define-_FILE_OFFSET_BITS-64.patch delete mode 100644 meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.14.0.bb create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.15.0.bb create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat/0002-Enable-64bit-off_t.patch create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/fatresize/fatresize/0001-configure-Do-not-add-D_FILE_OFFSET_BITS-to-CFLAGS.patch delete mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfsdump/xfsdump_3.1.11.bb create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfsdump/xfsdump_3.1.12.bb delete mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0001-Check-for-MAP_SYNC-in-sys-mman.h.patch create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0004-configure-Use-AC_SYS_LARGERFILE-autoconf-macro.patch create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0005-Replace-off64_t-stat64-with-off_t-stat.patch delete mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/xfsprogs_5.13.0.bb create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/xfsprogs_6.0.0.bb delete mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.10.30.bb create mode 100644 meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.12.18.bb create mode 100644 meta-openembedded/meta-gnome/recipes-connectivity/libnma/libnma_1.10.4.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-connectivity/libnma/libnma_1.8.38.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_1.26.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_1.30.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gimp/babl/babl_0.1.96.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gimp/babl/babl_0.1.98.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gimp/gegl/gegl_0.4.38.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gimp/gegl/gegl_0.4.40.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/amtk/amtk_5.3.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/amtk/amtk_5.6.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor/0001-editor-meson.build-fix-meson-0.61-errors.patch delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor_3.38.3.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor_43.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/eog/eog_43.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/evince/evince_42.3.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/evince/evince_43.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/file-roller/file-roller_3.42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/file-roller/file-roller_43.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gdm/gdm_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gdm/gdm_43.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gedit/gedit_42.2.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gedit/gedit_43.2.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph/0001-Update-rest-requirement-to-rest-1.0.patch delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.72.2.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.75.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-backgrounds/gnome-backgrounds_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-backgrounds/gnome-backgrounds_43.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-bluetooth/gnome-bluetooth_42.4.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-bluetooth/gnome-bluetooth_42.5.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-calculator/gnome-calculator_42.2.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-calculator/gnome-calculator_43.0.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_43.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center_43.2.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop/0001-meson.build-Disable-libseccomp-for-all-archs.patch delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop_43.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-disk-utility/gnome-disk-utility_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-disk-utility/gnome-disk-utility_43.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-flashback/gnome-flashback_3.44.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-flashback/gnome-flashback_3.46.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts/0001-build-Use-the-appropriate-dependency-object.patch delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-panel/gnome-panel_3.44.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-panel/gnome-panel_3.47.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-photos/gnome-photos_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-photos/gnome-photos_43.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-session/gnome-session_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-session/gnome-session_43.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-settings-daemon/gnome-settings-daemon_42.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-settings-daemon/gnome-settings-daemon_43.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell-extensions_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell-extensions_43.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell_43.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-software/gnome-software_43.2.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-terminal/gnome-terminal_3.42.2.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-terminal/gnome-terminal_3.46.7.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-text-editor/gnome-text-editor_42.2.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gnome-text-editor/gnome-text-editor_43.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/grilo/grilo_0.3.14.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/grilo/grilo_0.3.15.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gtk4/gtk4_4.6.7.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gtksourceview/gtksourceview5_5.4.2.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gtksourceview/gtksourceview5_5.6.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/gvfs/gvfs/0001-daemon-PATH-expand-the-sftp-backend-ssh-client.patch delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4_4.0.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4_4.2.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather_40.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/libportal/libportal_0.6.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/libwnck/libwnck3_40.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/libwnck/libwnck3_43.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_43.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/nautilus/nautilus_42.2.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/nautilus/nautilus_43.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/rest/librest_0.8.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/tepl/tepl_6.00.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/tepl/tepl_6.4.0.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker-miners_3.4.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker-miners_3.4.2.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker_3.4.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker_3.4.2.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_42.0.bb create mode 100644 meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_42.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-support/appstream-glib/appstream-glib_0.7.18.bb create mode 100644 meta-openembedded/meta-gnome/recipes-support/appstream-glib/appstream-glib_0.8.2.bb create mode 100644 meta-openembedded/meta-gnome/recipes-support/libcloudproviders/libcloudproviders_0.3.1.bb delete mode 100644 meta-openembedded/meta-gnome/recipes-support/libstemmer/libstemmer/0001-Build-so-lib.patch delete mode 100644 meta-openembedded/meta-gnome/recipes-support/libstemmer/libstemmer_git.bb create mode 100644 meta-openembedded/meta-gnome/recipes-support/xdg-desktop-portal/xdg-desktop-portal-gnome_43.1.bb create mode 100644 meta-openembedded/meta-gnome/recipes-support/xdg-desktop-portal/xdg-desktop-portal-gtk_1.14.1.bb create mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut/0001-install-Do-not-undef-_FILE_OFFSET_BITS.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0001-Add-another-variable-LIBS-to-provides-libraries-from.patch create mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0001-rename-grub2-editenv-to-grub-editenv.patch create mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0002-Add-another-variable-LIBS-to-provides-libraries-from.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0002-include-paths.h-for-_PATH_MOUNTED.patch create mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0003-include-paths.h-for-_PATH_MOUNTED.patch create mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0004-rpm-sort-include-string.h-for-strverscmp.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/grubby-rename-grub2-editenv-to-grub-editenv.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_8.40.bb delete mode 100644 meta-openembedded/meta-multimedia/recipes-multimedia/pipewire/pipewire_0.3.59.bb create mode 100644 meta-openembedded/meta-multimedia/recipes-multimedia/pipewire/pipewire_0.3.63.bb delete mode 100644 meta-openembedded/meta-multimedia/recipes-multimedia/wireplumber/wireplumber_0.4.12.bb create mode 100644 meta-openembedded/meta-multimedia/recipes-multimedia/wireplumber/wireplumber_0.4.13.bb create mode 100644 meta-openembedded/meta-multimedia/recipes-support/xdg-desktop-portal-wlr/xdg-desktop-portal-wlr_0.6.0.bb delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.4.bb create mode 100644 meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.5.bb delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager-openvpn_1.10.0.bb create mode 100644 meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager-openvpn_1.10.2.bb delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Deleted-settiong-of-python-to-fix-the-install-confli.patch delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Fix-pyext_PATTERN-for-cross-compilation.patch delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-smbtorture-skip-test-case-tfork_cmd_send.patch delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-waf-Fix-errors-with-Werror-implicit-function-declara.patch create mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0005-Fix-pyext_PATTERN-for-cross-compilation.patch delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0005-samba-build-dnsserver_common-code.patch create mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0006-smbtorture-skip-test-case-tfork_cmd_send.patch create mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0007-waf-Fix-errors-with-Werror-implicit-function-declara.patch create mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0008-Deleted-settiong-of-python-to-fix-the-install-confli.patch delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/netdb_defines.patch delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-fix-musl-lib-without-innetgr.patch delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba_4.14.14.bb create mode 100644 meta-openembedded/meta-networking/recipes-connectivity/samba/samba_4.17.4.bb delete mode 100644 meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.3.bb create mode 100644 meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.4.bb create mode 100755 meta-openembedded/meta-networking/recipes-daemons/lldpd/files/run-ptest delete mode 100644 meta-openembedded/meta-networking/recipes-daemons/lldpd/lldpd_1.0.15.bb create mode 100644 meta-openembedded/meta-networking/recipes-daemons/lldpd/lldpd_1.0.16.bb delete mode 100644 meta-openembedded/meta-networking/recipes-filter/libnftnl/libnftnl_1.2.3.bb create mode 100644 meta-openembedded/meta-networking/recipes-filter/libnftnl/libnftnl_1.2.4.bb delete mode 100644 meta-openembedded/meta-networking/recipes-filter/nftables/nftables/0001-nftables-python-Split-root-from-prefix.patch delete mode 100644 meta-openembedded/meta-networking/recipes-filter/nftables/nftables_1.0.5.bb create mode 100644 meta-openembedded/meta-networking/recipes-filter/nftables/nftables_1.0.6.bb delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-m4-ax_python.m4-check-for-python-x.y-emded.pc-not-py.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.3.1.bb create mode 100644 meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.4.1.bb delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-dns-sd-Include-missing-headers.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-mdns-include-stddef.h-for-NULL.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0002-mdns-cross-compilation-fixes-for-bitbake.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0003-Track-interface-socket-family.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0006-Remove-unneeded-function.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0008-Mark-deleted-interfaces-as-being-changed.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0009-Fix-possible-NULL-dereference.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0010-Handle-errors-from-socket-calls.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/files/mdns.service create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/mdns.service delete mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_1310.140.1.bb create mode 100644 meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_1790.60.25.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/dnsmasq/dnsmasq_2.87.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/dnsmasq/dnsmasq_2.88.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils/0001-replace-off64_t-with-off_t.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils/0002-drbdadm-drop-use-of-GLOB_MAGCHAR-use-strchr-heuristi.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils_9.20.2.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils_9.22.0.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/drbd/drbd_9.0.24-1.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/drbd/drbd_9.2.1.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/libldb/libldb/0001-Fix-pyext_PATTERN-for-cross-compilation.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libldb/libldb/0003-Fix-pyext_PATTERN-for-cross-compilation.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libldb/libldb/0003-avoid-openldap-unless-wanted.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libldb/libldb/avoid-openldap-unless-wanted.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libldb/libldb/cmocka-fix-musl-libc-conflicting-types-error.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libldb/libldb/libldb-fix-musl-libc-conflict-type-error.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libldb/libldb_2.3.4.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/libldb/libldb_2.6.1.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0001-Fix-pyext_PATTERN-for-cross-compilation.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0001-talloc-Add-configure-options-for-packages.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0002-Fix-pyext_PATTERN-for-cross-compilation.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/options-2.2.0.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.3.3.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.3.4.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0001-Fix-pyext_PATTERN-for-cross-compilation.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0001-tdb-Add-configure-options-for-packages.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0002-Fix-pyext_PATTERN-for-cross-compilation.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/tdb-Add-configure-options-for-packages.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.4.3.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.4.7.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-Add-configure-options-for-packages.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-Fix-pyext_PATTERN-for-cross-compilation.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-libtevent-fix-musl-libc-compile-error.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0002-Fix-pyext_PATTERN-for-cross-compilation.patch create mode 100644 meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/cmocka-fix-musl-libc-conflicting-types-error.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/options-0.10.0.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/libtevent/libtevent_0.10.2.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/libtevent/libtevent_0.13.0.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/nbdkit/nbdkit_1.33.2.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/nbdkit/nbdkit_1.33.4.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-timeSync-Portable-way-to-print-64bit-time_t.patch delete mode 100644 meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.0.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.5.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/smcroute/smcroute_2.5.5.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/smcroute/smcroute_2.5.6.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/tcpdump/tcpdump_4.99.1.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/tcpdump/tcpdump_4.99.2.bb delete mode 100644 meta-openembedded/meta-networking/recipes-support/traceroute/traceroute_2.1.0.bb create mode 100644 meta-openembedded/meta-networking/recipes-support/traceroute/traceroute_2.1.1.bb create mode 100644 meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-Makefile.am-do-not-clobber-PYTHONPATH-from-build-env.patch create mode 100644 meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-wiredtiger-Avoid-using-off64_t.patch delete mode 100644 meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.6.4.bb create mode 100644 meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb delete mode 100644 meta-openembedded/meta-oe/recipes-benchmark/memtester/memtester_4.5.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-benchmark/memtester/memtester_4.6.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0001-configure-Add-with-cpu.patch create mode 100644 meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0002-Replace-lfs64-functions-and-defines.patch create mode 100644 meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch delete mode 100644 meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench/0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch delete mode 100644 meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench_0.4.12.bb create mode 100644 meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench_1.0.20.bb delete mode 100644 meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom/0001-typecast-enum-conversions-explicitly.patch create mode 100644 meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom_1.2.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/gensio/files/0001-configure-Check-for-request_init-API-when-probing-fo.patch delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/gensio/files/0001-tools-gensiot-Fix-build-with-musl.patch delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/gensio/gensio_2.5.2.bb create mode 100644 meta-openembedded/meta-oe/recipes-connectivity/gensio/gensio_2.6.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/iwd/iwd_1.30.bb create mode 100644 meta-openembedded/meta-oe/recipes-connectivity/iwd/iwd_2.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/0001-aclocal-Add-parameter-to-disable-keyutils-detection.patch delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/CVE-2021-36222.patch delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/CVE-2021-37750.patch delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5_1.17.2.bb create mode 100644 meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5_1.20.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp/0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.11.bb create mode 100644 meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.12.bb create mode 100644 meta-openembedded/meta-oe/recipes-connectivity/ser2net/ser2net_4.3.11.bb delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/ser2net/ser2net_4.3.9.bb delete mode 100644 meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.4.bb create mode 100644 meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.6.bb create mode 100644 meta-openembedded/meta-oe/recipes-core/basu/basu_0.2.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-core/glib-2.0/glibmm-2.68_2.72.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-core/glib-2.0/glibmm-2.68_2.74.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-dirent-util-Remove-asserts-on-dirent64-dirent.patch delete mode 100644 meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-glibc-Remove-include-linux-fs.h-to-resolve-fsconfig_.patch delete mode 100644 meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-pass-correct-parameters-to-getdents64.patch delete mode 100644 meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_250.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_250.9.bb delete mode 100644 meta-openembedded/meta-oe/recipes-crypto/botan/botan_2.19.2.bb create mode 100644 meta-openembedded/meta-oe/recipes-crypto/botan/botan_2.19.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup/0001-Replace-off64_t-with-off_t.patch delete mode 100644 meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup_2.4.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup_2.6.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.11.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.8.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/lfs64.patch create mode 100644 meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.11.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-direct_mmap-Use-off_t-on-linux.patch delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/boost-url/boost-url_git.bb delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/capnproto/capnproto_0.10.2.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/capnproto/capnproto_0.10.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-build-Use-ilp32d-abi-on-riscv32-and-lp64d-on-rv64.patch create mode 100644 meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-configure-Fix-compoiler-detection-logic-for-cross-co.patch delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/cross.patch delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20221106.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_6.0.20230101.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/editorconfig/editorconfig-core-c_0.12.5.bb delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/gst-editing-services/gst-editing-services_1.20.4.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/gst-editing-services/gst-editing-services_1.20.5.bb delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/lshw/files/0001-Fix-musl-build.patch create mode 100644 meta-openembedded/meta-oe/recipes-devtools/lshw/files/0001-disable-docbook2man.patch delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/mpich/mpich_4.0.2.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/mpich/mpich_4.0.3.bb delete mode 100755 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.14/oe-npm-cache create mode 100755 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.18/oe-npm-cache delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.14.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.18.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0002-Install-both-binaries-and-use-libdir.patch delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0005-add-openssl-legacy-provider-option.patch delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs_16.14.2.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs_16.18.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/perl/libio-pty-perl_1.16.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/perl/libio-pty-perl_1.17.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/protobuf/protobuf_3.21.5.bb delete mode 100644 meta-openembedded/meta-oe/recipes-devtools/python/python3-apt_2.3.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/python/python3-apt_2.5.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-devtools/sip/sip_6.7.5.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/boinc/boinc-client/0001-Do-not-undefine-_FILE_OFFSET_BITS.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/boinc/boinc-client/4563.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/boinc/boinc-client/gtk-configure.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/boinc/boinc-client_7.18.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/boinc/boinc-client_7.20.4.bb delete mode 100644 meta-openembedded/meta-oe/recipes-extended/byacc/byacc_20220128.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/byacc/byacc_20221229.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/flatpak/flatpak-xdg-utils_1.0.5.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/flatpak/flatpak/0001-flatpak-pc-add-pc_sysrootdir.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/flatpak/flatpak_1.15.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-extended/hwloc/hwloc_1.11.13.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/hwloc/hwloc_2.9.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/0001-Cargo.toml-do-not-abort-on-panic.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/0001-build-do-not-use-autoconf-s-config.sub-to-canonicali.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/0001-rewrite-cargo-host-linker-in-python3.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/0001-util.configure-fix-one-occasionally-reproduced-confi.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/0002-moz.configure-do-not-look-for-llvm-objdump.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/0003-rust.configure-do-not-try-to-find-a-suitable-upstrea.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/0004-use-asm-sgidefs.h.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/fix-musl-build.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/musl-disable-stackwalk.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/py-3.11.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102/riscv32.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-102_102.5.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0001-Cargo.toml-do-not-abort-on-panic.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0001-build-do-not-use-autoconf-s-config.sub-to-canonicali.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0001-rewrite-cargo-host-linker-in-python3.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0001-util.configure-fix-one-occasionally-reproduced-confi.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0002-moz.configure-do-not-look-for-llvm-objdump.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0003-rust.configure-do-not-try-to-find-a-suitable-upstrea.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0004-use-asm-sgidefs.h.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0005-nojit-32bit-arch-fix.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/0006-Fix-build-on-powerpc.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/fix-musl-build.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/py-3.11.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91/riscv32.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs-91_91.13.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-extended/openwsman/openwsman_2.7.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/openwsman/openwsman_2.7.2.bb delete mode 100644 meta-openembedded/meta-oe/recipes-extended/ostree/ostree/0001-Remove-unused-linux-fs.h-includes.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/ostree/ostree/0001-lib-repo-checkout-Add-ALLPERMS-for-musl.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/ostree/ostree/0001-libostree-Remove-including-sys-mount.h.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/ostree/ostree/0001-s390x-se-luks-gencpio-There-is-no-bashism.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/ostree/ostree/0001-tests-Handle-musl-s-ERANGE-mapping.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2022.5.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2022.7.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/polkit/polkit_122.bb delete mode 100644 meta-openembedded/meta-oe/recipes-extended/redis/redis_6.2.7.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/redis/redis_6.2.8.bb delete mode 100644 meta-openembedded/meta-oe/recipes-extended/redis/redis_7.0.5.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/redis/redis_7.0.7.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/wxwidgets/wxwidgets/0001-Set-HAVE_LARGEFILE_SUPPORT-to-1-explicitly.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/wxwidgets/wxwidgets/0001-locale-Avoid-using-glibc-specific-defines-on-musl.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/wxwidgets/wxwidgets/create-links-with-relative-path.patch create mode 100644 meta-openembedded/meta-oe/recipes-extended/wxwidgets/wxwidgets/musl-locale-l.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/wxwidgets/wxwidgets/respect-DESTDIR-when-create-link.patch delete mode 100644 meta-openembedded/meta-oe/recipes-extended/wxwidgets/wxwidgets_3.1.5.bb create mode 100644 meta-openembedded/meta-oe/recipes-extended/wxwidgets/wxwidgets_3.2.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/fontforge/fontforge_20220308.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/fontforge/fontforge_20230101.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/libdecor/libdecor_0.1.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/libforms/libforms_1.2.4.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/libforms/libforms_1.2.5pre1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/libglvnd/libglvnd_1.5.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/libglvnd/libglvnd_1.6.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/libyui/libyui-ncurses/0001-libyui-ncurses-Replace-off64_t-with-off_t-and-stat64.patch delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/libyui/libyui-ncurses_4.1.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/libyui/libyui-ncurses_4.2.3.bb delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/libyui/libyui_4.1.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/libyui/libyui_4.2.3.bb delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/spir/files/0001-Add-install-PHONY-target-in-Makefile.patch delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/spir/files/0001-Avoid-pessimizing-std-move-3124.patch delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/spir/files/0001-Respect-CMAKE_INSTALL_LIBDIR-in-installed-CMake-file.patch delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/tesseract/tesseract_5.2.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/tesseract/tesseract_5.3.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/xorg-app/xterm_373.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/xorg-app/xterm_377.bb delete mode 100644 meta-openembedded/meta-oe/recipes-graphics/xorg-lib/xcb-util-cursor_0.1.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-graphics/xorg-lib/xcb-util-cursor_0.1.4.bb create mode 100644 meta-openembedded/meta-oe/recipes-kernel/libtraceevent/libtraceevent/0001-makefile-Do-not-preserve-ownership-in-cp-command.patch create mode 100644 meta-openembedded/meta-oe/recipes-kernel/libtraceevent/libtraceevent_1.7.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-kernel/libtracefs/libtracefs/0001-makefile-Do-not-preserve-ownership-in-cp-command.patch create mode 100644 meta-openembedded/meta-oe/recipes-kernel/libtracefs/libtracefs_1.6.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-kernel/trace-cmd/files/0001-Do-not-emit-useless-rpath.patch create mode 100644 meta-openembedded/meta-oe/recipes-kernel/trace-cmd/files/0001-Replace-LFS64-interfaces-off64_t-and-lseek64.patch delete mode 100644 meta-openembedded/meta-oe/recipes-kernel/trace-cmd/files/0001-trace-cmd-make-it-build-with-musl.patch delete mode 100644 meta-openembedded/meta-oe/recipes-kernel/trace-cmd/trace-cmd_2.9.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-kernel/trace-cmd/trace-cmd_3.1.5.bb delete mode 100644 meta-openembedded/meta-oe/recipes-multimedia/alsa/alsa-oss_1.1.8.bb delete mode 100644 meta-openembedded/meta-oe/recipes-multimedia/libass/libass_0.16.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-multimedia/libass/libass_0.17.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-navigation/geoclue/geoclue_2.5.7.bb create mode 100644 meta-openembedded/meta-oe/recipes-navigation/geoclue/geoclue_2.6.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-navigation/proj/proj_8.2.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-navigation/proj/proj_9.1.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-security/audit/audit_3.0.8.bb create mode 100644 meta-openembedded/meta-oe/recipes-security/audit/audit_3.0.9.bb create mode 100644 meta-openembedded/meta-oe/recipes-security/bubblewrap/bubblewrap_0.7.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-security/keyutils/files/0001-tests-toolbox.inc.sh-update-regex-for-getting-endian.patch delete mode 100644 meta-openembedded/meta-oe/recipes-security/usbguard/usbguard_1.1.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-security/usbguard/usbguard_1.1.2.bb delete mode 100644 meta-openembedded/meta-oe/recipes-shells/dash/dash_0.5.11.5.bb create mode 100644 meta-openembedded/meta-oe/recipes-shells/dash/dash_0.5.12.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/appstream/appstream/0001-fix-crosscompile.patch create mode 100644 meta-openembedded/meta-oe/recipes-support/appstream/appstream_0.15.5.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/ccid/ccid_1.5.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/ccid/ccid_1.5.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/crucible/crucible_2022.05.25.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/crucible/crucible_2022.12.06.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/dool/dool/0001-Fix-rename-in-docs.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/freerdp/freerdp_2.8.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/freerdp/freerdp_2.9.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/googlebenchmark/googlebenchmark_1.7.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/googlebenchmark/googlebenchmark_1.7.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/gperftools/gperftools/0001-fix-build-with-musl-libc.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/hunspell/hunspell_1.7.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/hunspell/hunspell_1.7.2.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/hwdata/hwdata_0.364.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/hwdata/hwdata_0.365.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/imapfilter/imapfilter_2.7.5.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/imapfilter/imapfilter_2.7.6.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/inotify-tools/inotify-tools/0002-configure-Add-AC_SYS_LARGEFILE-autoconf-macro.patch create mode 100644 meta-openembedded/meta-oe/recipes-support/inotify-tools/inotify-tools/0003-replace-stat64-lstat64-with-stat-lstat.patch create mode 100644 meta-openembedded/meta-oe/recipes-support/libstemmer/libstemmer/0001-Build-so-lib.patch create mode 100644 meta-openembedded/meta-oe/recipes-support/libstemmer/libstemmer_git.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/mg/mg_20220614.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/mg/mg_20221112.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/multipath-tools/files/0001-fix-boolean-value-with-json-c-0.14.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/multipath-tools/files/0001-libmultipath-uevent.c-fix-error-handling-for-udev_mo.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/multipath-tools/multipath-tools_0.8.4.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/multipath-tools/multipath-tools_0.9.3.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/nano/nano_6.4.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/nano/nano_7.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/nspr/nspr/remove-srcdir-from-configure-in.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/nspr/nspr_4.29.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/nspr/nspr_4.35.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/opencv/opencv/0001-Add-missing-header-for-LIBAVCODEC_VERSION_INT.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/opensc/opensc_0.22.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/opensc/opensc_0.23.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/pcsc-lite/pcsc-lite_1.9.8.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/pcsc-lite/pcsc-lite_1.9.9.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/pcsc-tools/pcsc-tools_1.6.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/pcsc-tools/pcsc-tools_1.6.1.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/poppler/poppler_22.11.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/poppler/poppler_23.01.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/remmina/remmina_1.4.27.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/remmina/remmina_1.4.29.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/smarty/smarty_4.2.1.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/smarty/smarty_4.3.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/spdlog/spdlog/0001-Do-not-use-LFS64-functions-on-linux-musl.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/spdlog/spdlog_1.10.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/spdlog/spdlog_1.11.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/tbb/tbb/0001-Disable-LTO-on-clang-riscv32.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/tbb/tbb/0001-Disable-use-of-_tpause-instruction.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/tbb/tbb/0001-Musl-linux-can-not-use-RTLD_DEEPBIND.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/tbb/tbb/0001-mallinfo-is-glibc-specific-API-mark-it-so.patch delete mode 100644 meta-openembedded/meta-oe/recipes-support/tbb/tbb_2021.5.0.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/tbb/tbb_2021.7.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/tio/tio_2.3.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/tio/tio_2.5.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/tree/tree_2.0.4.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/tree/tree_2.1.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/vboxguestdrivers/vboxguestdrivers_7.0.2.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/vboxguestdrivers/vboxguestdrivers_7.0.4.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/xdg-desktop-portal/xdg-desktop-portal/0001-xdg-desktop-portal-pc-in-add-pc_sysrootdir-dir.patch create mode 100644 meta-openembedded/meta-oe/recipes-support/xdg-desktop-portal/xdg-desktop-portal_1.16.0.bb delete mode 100644 meta-openembedded/meta-oe/recipes-support/xmlsec1/xmlsec1_1.2.36.bb create mode 100644 meta-openembedded/meta-oe/recipes-support/xmlsec1/xmlsec1_1.2.37.bb create mode 100644 meta-openembedded/meta-oe/recipes-test/fwts/fwts/0001-libfwtsiasl-Disable-parallel-builds-of-lex-bison-fil.patch delete mode 100644 meta-openembedded/meta-oe/recipes-test/fwts/fwts_22.01.00.bb create mode 100644 meta-openembedded/meta-oe/recipes-test/fwts/fwts_22.11.00.bb delete mode 100644 meta-openembedded/meta-perl/recipes-extended/logcheck/logcheck_1.3.24.bb create mode 100644 meta-openembedded/meta-perl/recipes-extended/logcheck/logcheck_1.4.0.bb delete mode 100644 meta-openembedded/meta-perl/recipes-perl/libfile/libfile-slurper-perl_0.013.bb create mode 100644 meta-openembedded/meta-perl/recipes-perl/libfile/libfile-slurper-perl_0.014.bb delete mode 100644 meta-openembedded/meta-perl/recipes-perl/libio/files/run-ptest delete mode 100644 meta-openembedded/meta-perl/recipes-perl/libio/libio-socket-ssl-perl_2.075.bb create mode 100644 meta-openembedded/meta-perl/recipes-perl/libio/libio-socket-ssl-perl_2.078.bb delete mode 100644 meta-openembedded/meta-perl/recipes-perl/libmime/libmime-types-perl_2.22.bb create mode 100644 meta-openembedded/meta-perl/recipes-perl/libmime/libmime-types-perl_2.24.bb create mode 100644 meta-openembedded/meta-perl/recipes-perl/libmozilla/libmozilla-ca-perl_20221114.bb delete mode 100644 meta-openembedded/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.35.bb create mode 100644 meta-openembedded/meta-perl/recipes-perl/libnet/libnet-dns-perl_1.36.bb delete mode 100644 meta-openembedded/meta-perl/recipes-perl/libtest/libtest-warnings-perl_0.031.bb create mode 100755 meta-openembedded/meta-python/recipes-devtools/python/python3-aioserial_1.3.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-aiosignal_1.2.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-aiosignal_1.3.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-alembic_1.8.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-alembic_1.9.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-asgiref_3.5.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-asgiref_3.6.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-astroid_2.12.12.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-astroid_2.12.13.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-asttokens_2.1.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-asttokens_2.2.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-asyncinotify_2.0.5.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-asyncinotify_3.0.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-autobahn_22.12.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-autobahn_22.7.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-bidict_0.22.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-bidict_0.22.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-binwalk_2.3.3.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-bitarray_2.6.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-bitarray_2.6.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-can_4.0.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-can_4.1.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-cantools_37.2.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-cantools_38.0.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-cbor2_5.4.3.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-cbor2_5.4.6.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-charset-normalizer_3.0.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-charset-normalizer_3.0.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-coverage_6.5.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-coverage_7.0.3.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-croniter_1.3.7.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-croniter_1.3.8.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-cytoolz_0.12.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-cytoolz_0.12.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-dateparser_1.1.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-dateparser_1.1.5.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-django_4.1.3.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-django_4.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-eth-account_0.7.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-eth-account_0.8.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-eth-hash_0.5.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-eth-hash_0.5.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-eth-utils_2.0.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-eth-utils_2.1.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-eventlet_0.33.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-eventlet_0.33.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-flask-migrate_3.1.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-flask-migrate_4.0.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-flask-socketio_5.3.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-flask-socketio_5.3.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-frozenlist_1.3.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-frozenlist_1.3.3.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-geomet_0.3.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-geomet_1.0.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-gmpy2_2.1.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-gmpy2_2.1.5.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-google-api-core_2.10.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-google-api-core_2.11.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-google-api-python-client_2.65.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-google-api-python-client_2.70.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-google-auth_2.14.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-google-auth_2.15.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-googleapis-common-protos_1.56.4.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-googleapis-common-protos_1.57.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-greenlet_2.0.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-greenlet_2.0.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-grpcio-tools_1.50.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-grpcio-tools_1.51.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-grpcio_1.50.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-grpcio_1.51.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-imageio_2.22.3.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-imageio_2.23.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-inotify/run-ptest delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-inotify_0.2.10.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-inotify_git.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-ipython_8.2.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-ipython_8.7.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-isort_5.10.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-isort_5.11.4.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-jedi_0.18.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-jedi_0.18.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-kmod_0.9.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-langtable_0.0.60.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-langtable_0.0.61.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-linux-procfs_0.7.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-lz4_4.0.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-lz4_4.3.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-m2crypto/CVE-2020-25657.patch delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-marshmallow_3.18.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-marshmallow_3.19.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-matplotlib-inline_0.1.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-matplotlib-inline_0.1.6.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-mock_4.0.3.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-mock_5.0.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-multidict_6.0.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-multidict_6.0.4.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-networkx_2.8.7.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-networkx_2.8.8.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pandas_1.5.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pandas_1.5.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-path_16.5.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-path_16.6.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pillow_9.3.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pillow_9.4.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-prompt-toolkit_3.0.31.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-prompt-toolkit_3.0.36.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-protobuf_4.21.12.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-protobuf_4.21.9.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pyatspi_2.38.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pyatspi_2.46.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pybind11-json_0.2.11.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pybind11-json_0.2.13.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pycares_4.2.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pycares_4.3.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pychromecast_12.1.4.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pychromecast_13.0.4.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pycocotools_2.0.5.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pycocotools_2.0.6.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pycodestyle_2.10.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pycodestyle_2.9.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pycurl_7.45.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pycurl_7.45.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pydantic_1.10.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pydantic_1.10.4.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pydicti_1.1.6.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pydicti_1.2.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pyflakes_2.5.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pyflakes_3.0.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pymisp_2.4.157.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pymisp_2.4.167.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pymodbus_3.0.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pymodbus_3.0.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pymongo_4.3.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pymongo_4.3.3.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pyperf_2.4.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pyperf_2.5.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pyproj_3.4.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pyproj_3.4.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pytest-xdist_3.0.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-pytest-xdist_3.1.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-python-vlc_3.0.16120.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-python-vlc_3.0.18121.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-rapidjson_1.9.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-redis_4.3.4.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-redis_4.4.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-schedutils_0.6.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-sentry-sdk_1.12.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-sentry-sdk_1.9.10.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-simplejson_3.17.6.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-simplejson_3.18.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-sqlalchemy_1.4.43.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-sqlalchemy_1.4.45.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-stevedore_4.1.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-stevedore_4.1.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-supervisor_4.2.4.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-supervisor_4.2.5.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-termcolor_2.1.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-termcolor_2.2.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-texttable_1.6.4.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-texttable_1.6.7.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-traitlets_5.5.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-traitlets_5.8.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-twine_4.0.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-twine_4.0.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-twitter_4.10.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-twitter_4.12.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-u-msgpack-python_2.7.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-u-msgpack-python_2.7.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-uefi-firmware_1.9.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-ujson_5.5.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-ujson_5.6.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-watchdog_2.1.9.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-watchdog_2.2.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-watchdogdev_1.0.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-web3_5.31.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-web3_5.31.3.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-xlsxwriter_3.0.3.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-xlsxwriter_3.0.5.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-xxhash_3.1.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-xxhash_3.2.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-yamlloader_1.1.0.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-yamlloader_1.2.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-yappi/0002-add-3.11-to-the-setup.patch delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-yappi_1.3.6.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-yappi_1.4.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-yarl_1.8.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-yarl_1.8.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-zeroconf_0.39.4.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-zeroconf_0.47.1.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-zopeinterface_5.5.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python/python3-zopeinterface_5.5.2.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python3-attrdict3/python3-attrdict3_2.0.2.bb delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python3-wxgtk4/python3-wxgtk4/0001-Update-Cython-version-to-fix-NanoSVG-issues-with-Pyt.patch create mode 100644 meta-openembedded/meta-python/recipes-devtools/python3-wxgtk4/python3-wxgtk4/0001-pypubsub-Replace-deprecated-inspect.getargspec.patch create mode 100644 meta-openembedded/meta-python/recipes-devtools/python3-wxgtk4/python3-wxgtk4/0001-sip-Conditionally-use-GetAssertStackTrace-under-USE_.patch create mode 100644 meta-openembedded/meta-python/recipes-devtools/python3-wxgtk4/python3-wxgtk4/not-overwrite-cflags-cxxflags.patch delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python3-wxgtk4/python3-wxgtk4/sip-fix-override-functions.patch delete mode 100644 meta-openembedded/meta-python/recipes-devtools/python3-wxgtk4/python3-wxgtk4_4.1.1.bb create mode 100644 meta-openembedded/meta-python/recipes-devtools/python3-wxgtk4/python3-wxgtk4_4.2.0.bb delete mode 100644 meta-openembedded/meta-python/recipes-extended/python-pyephem/python3-pyephem/0001-Don-t-set-tp_print-on-Python-3.patch delete mode 100644 meta-openembedded/meta-python/recipes-extended/python-pyephem/python3-pyephem_4.1.3.bb create mode 100644 meta-openembedded/meta-python/recipes-extended/python-pyephem/python3-pyephem_4.1.4.bb delete mode 100644 meta-openembedded/meta-python/recipes-extended/pywbemtools/python3-pywbemtools_1.0.1.bb create mode 100644 meta-openembedded/meta-python/recipes-extended/pywbemtools/python3-pywbemtools_1.1.1.bb create mode 100644 meta-openembedded/meta-python/recipes-extended/tuna/tuna_git.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-panel-plugins/cpufreq/xfce4-cpufreq-plugin_1.2.7.bb create mode 100644 meta-openembedded/meta-xfce/recipes-panel-plugins/cpufreq/xfce4-cpufreq-plugin_1.2.8.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-panel-plugins/cpugraph/xfce4-cpugraph-plugin_1.2.6.bb create mode 100644 meta-openembedded/meta-xfce/recipes-panel-plugins/cpugraph/xfce4-cpugraph-plugin_1.2.7.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-panel-plugins/sensors/xfce4-sensors-plugin_1.4.3.bb create mode 100644 meta-openembedded/meta-xfce/recipes-panel-plugins/sensors/xfce4-sensors-plugin_1.4.4.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-panel-plugins/wavelan/xfce4-wavelan-plugin_0.6.2.bb create mode 100644 meta-openembedded/meta-xfce/recipes-panel-plugins/wavelan/xfce4-wavelan-plugin_0.6.3.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-thunar-plugins/archive/thunar-archive-plugin_0.4.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-thunar-plugins/archive/thunar-archive-plugin_0.5.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-thunar-plugins/shares/files/0001-build-Bump-GLib-minimum-required-to-2.26.patch delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/exo/exo/configure.patch delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/exo/exo/reduce-build-to-exo-csource-only.patch delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/exo/exo_4.16.4.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/exo/exo_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/garcon/garcon_4.16.1.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/garcon/garcon_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/libxfce4ui/libxfce4ui_4.16.1.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/libxfce4ui/libxfce4ui_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/libxfce4util/libxfce4util_4.16.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/libxfce4util/libxfce4util_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/thunar-volman/thunar-volman_4.16.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/thunar-volman/thunar-volman_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/thunar/thunar_4.16.9.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/thunar/thunar_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/tumbler/tumbler_4.16.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/tumbler/tumbler_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-appfinder/xfce4-appfinder_4.16.1.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-appfinder/xfce4-appfinder_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-dev-tools/xfce4-dev-tools_4.16.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-dev-tools/xfce4-dev-tools_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-panel/xfce4-panel_4.16.3.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-panel/xfce4-panel_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-power-manager/xfce4-power-manager_4.16.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-power-manager/xfce4-power-manager_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-session/xfce4-session_4.16.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-session/xfce4-session_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings_4.16.3.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfce4-settings/xfce4-settings_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfconf/xfconf_4.16.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfconf/xfconf_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfdesktop/xfdesktop_4.16.0.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfdesktop/xfdesktop_4.18.0.bb delete mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfwm4/xfwm4_4.16.1.bb create mode 100644 meta-openembedded/meta-xfce/recipes-xfce/xfwm4/xfwm4_4.18.0.bb delete mode 100644 meta-raspberrypi/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0003-CVE-2022-41325.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0003-mmal_20.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0004-mmal_20.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0004-mmal_exit_fix.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0005-mmal_chain.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0005-mmal_exit_fix.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0006-Use-packageconfig-to-detect-mmal-support.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0006-mmal_chain.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0007-armv6.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0007-use-vorbisidec.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0008-fix-luaL-checkint.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0009-fix-EGL-macro-undeclared-and-EGLImageKHR.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/0010-fix-numeric_limits-is-not-a-member-of-std.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/2001-fix-luaL-checkint.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/2002-use-vorbisidec.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3001-configure.ac-setup-for-OE-usage.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3002-fix-EGL-macro-undeclared-and-EGLImageKHR.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3003-codec-omxil_core-replace-opt-vc-path-with-usr-lib.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3004-use-GLESv2-headers-over-GL-headers.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3005-modules-remove-glspectrum-usage.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3006-codec-omxil_core.h-fix-multiple-definition-of.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3007-remove-xorg-related-link-libs.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3008-vo-Makefile.am-exclude-libgl_plugin.patch create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/files/3009-vo-converter_vaapi-Fix-EGL-macro-undeclared.patch delete mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/rpidistro-vlc_3.0.12.bb create mode 100644 meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/rpidistro-vlc/rpidistro-vlc_3.0.17.bb delete mode 100644 meta-raspberrypi/recipes-connectivity/bluez5/bluez5/0004-Move-the-43xx-firmware-into-lib-firmware.patch create mode 100644 meta-raspberrypi/recipes-connectivity/bluez5/bluez5/0004-Move-the-hciattach-firmware-into-lib-firmware.patch delete mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/0004-ffmpeg-4.3.2-rpi_10.patch create mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/0004-ffmpeg-4.3.4-rpi_14.patch create mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/0005-fix-flags.diff delete mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/0005-fix_flags.diff create mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2001-configure-setup-for-OE-core-usage.patch create mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2002-libavdevice-opengl_enc-update-dynamic-function-loader.patch create mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2003-libavcodec-fix-v4l2_req_devscan.patch create mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2004-libavcodec-omx-replace-opt-vc-path-with-usr-lib.patch delete mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.2.bb create mode 100644 meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.4.bb delete mode 100644 meta-security/dynamic-layers/meta-python/recipes-security/mfa/python3-privacyidea_3.7.3.bb create mode 100644 meta-security/dynamic-layers/meta-python/recipes-security/mfa/python3-privacyidea_3.7.4.bb delete mode 100644 meta-security/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb create mode 100644 meta-security/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.3.bb delete mode 100644 meta-security/recipes-security/bubblewrap/bubblewrap_0.6.2.bb create mode 100644 meta-security/recipes-security/bubblewrap/bubblewrap_0.7.0.bb delete mode 100644 meta-security/recipes-security/chipsec/chipsec_1.8.8.bb create mode 100644 meta-security/recipes-security/chipsec/chipsec_1.9.1.bb create mode 100644 poky/bitbake/doc/_templates/footer.html create mode 100644 poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/2.10/index.html create mode 100644 poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/2.9/index.html create mode 100644 poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/index.html create mode 100644 poky/documentation/dev-manual/bmaptool.rst create mode 100644 poky/documentation/dev-manual/build-quality.rst create mode 100644 poky/documentation/dev-manual/building.rst create mode 100644 poky/documentation/dev-manual/changes.rst delete mode 100644 poky/documentation/dev-manual/common-tasks.rst create mode 100644 poky/documentation/dev-manual/custom-distribution.rst create mode 100644 poky/documentation/dev-manual/custom-template-configuration-directory.rst create mode 100644 poky/documentation/dev-manual/customizing-images.rst create mode 100644 poky/documentation/dev-manual/debugging.rst create mode 100644 poky/documentation/dev-manual/development-shell.rst create mode 100644 poky/documentation/dev-manual/device-manager.rst create mode 100644 poky/documentation/dev-manual/disk-space.rst create mode 100644 poky/documentation/dev-manual/efficiently-fetching-sources.rst create mode 100644 poky/documentation/dev-manual/error-reporting-tool.rst create mode 100644 poky/documentation/dev-manual/external-scm.rst create mode 100644 poky/documentation/dev-manual/external-toolchain.rst create mode 100644 poky/documentation/dev-manual/gobject-introspection.rst create mode 100644 poky/documentation/dev-manual/init-manager.rst create mode 100644 poky/documentation/dev-manual/layers.rst create mode 100644 poky/documentation/dev-manual/libraries.rst create mode 100644 poky/documentation/dev-manual/licenses.rst create mode 100644 poky/documentation/dev-manual/new-machine.rst create mode 100644 poky/documentation/dev-manual/new-recipe.rst create mode 100644 poky/documentation/dev-manual/packages.rst create mode 100644 poky/documentation/dev-manual/prebuilt-libraries.rst create mode 100644 poky/documentation/dev-manual/python-development-shell.rst create mode 100644 poky/documentation/dev-manual/quilt.rst create mode 100644 poky/documentation/dev-manual/read-only-rootfs.rst create mode 100644 poky/documentation/dev-manual/runtime-testing.rst create mode 100644 poky/documentation/dev-manual/sbom.rst create mode 100644 poky/documentation/dev-manual/securing-images.rst create mode 100644 poky/documentation/dev-manual/speeding-up-build.rst create mode 100644 poky/documentation/dev-manual/temporary-source-code.rst create mode 100644 poky/documentation/dev-manual/upgrading-recipes.rst create mode 100644 poky/documentation/dev-manual/vulnerabilities.rst create mode 100644 poky/documentation/dev-manual/wayland.rst create mode 100644 poky/documentation/dev-manual/wic.rst create mode 100644 poky/documentation/dev-manual/x32-psabi.rst create mode 100644 poky/documentation/migration-guides/migration-4.2.rst create mode 100644 poky/documentation/migration-guides/release-4.2.rst create mode 100644 poky/documentation/migration-guides/release-notes-4.0.6.rst create mode 100644 poky/documentation/migration-guides/release-notes-4.1.1.rst create mode 100644 poky/documentation/migration-guides/release-notes-4.2.rst create mode 100644 poky/meta-selftest/recipes-test/devtool/devtool-test-local/file3 create mode 100644 poky/meta-selftest/recipes-test/devtool/devtool-test-localonly/file3 delete mode 100644 poky/meta-skeleton/recipes-baremetal/baremetal-examples/baremetal-helloworld_git.bb create mode 100644 poky/meta/conf/distro/include/time64.inc create mode 100644 poky/meta/conf/machine/include/x86/tune-x86-64-v3.inc create mode 100644 poky/meta/lib/oeqa/files/test.rs create mode 100644 poky/meta/lib/oeqa/selftest/cases/baremetal.py create mode 100644 poky/meta/lib/oeqa/selftest/cases/externalsrc.py create mode 100644 poky/meta/recipes-bsp/acpid/acpid/0001-Replace-stat64-with-stat.patch create mode 100644 poky/meta/recipes-bsp/efivar/efivar/0001-Use-off_t-instead-of-off64_t.patch create mode 100644 poky/meta/recipes-bsp/grub/files/0001-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch create mode 100644 poky/meta/recipes-bsp/grub/files/CVE-2022-2601.patch create mode 100644 poky/meta/recipes-bsp/grub/files/CVE-2022-28736-loader-efi-chainloader-Use-grub_loader_set_ex.patch create mode 100644 poky/meta/recipes-bsp/grub/files/CVE-2022-3775.patch create mode 100644 poky/meta/recipes-bsp/grub/files/commands-boot-Add-API-to-pass-context-to-loader.patch create mode 100644 poky/meta/recipes-bsp/grub/files/loader-efi-chainloader-Simplify-the-loader-state.patch delete mode 100644 poky/meta/recipes-bsp/pciutils/pciutils_3.8.0.bb create mode 100644 poky/meta/recipes-bsp/pciutils/pciutils_3.9.0.bb delete mode 100644 poky/meta/recipes-bsp/usbutils/usbutils_014.bb create mode 100644 poky/meta/recipes-bsp/usbutils/usbutils_015.bb create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/0001-avoid-start-failure-with-bind-user.patch create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/0001-named-lwresd-V-and-start-log-hide-build-options.patch create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/bind-ensure-searching-for-json-headers-searches-sysr.patch create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/bind9 create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/conf.patch create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/generate-rndc-key.sh create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/init.d-add-support-for-read-only-rootfs.patch create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/make-etc-initd-bind-stop-work.patch create mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.10/named.service delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/0001-avoid-start-failure-with-bind-user.patch delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/0001-named-lwresd-V-and-start-log-hide-build-options.patch delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/bind-ensure-searching-for-json-headers-searches-sysr.patch delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/bind9 delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/conf.patch delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/generate-rndc-key.sh delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/init.d-add-support-for-read-only-rootfs.patch delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/make-etc-initd-bind-stop-work.patch delete mode 100644 poky/meta/recipes-connectivity/bind/bind-9.18.8/named.service create mode 100644 poky/meta/recipes-connectivity/bind/bind_9.18.10.bb delete mode 100644 poky/meta/recipes-connectivity/bind/bind_9.18.8.bb create mode 100644 poky/meta/recipes-connectivity/bluez5/bluez5/0004-src-shared-util.c-include-linux-limits.h.patch delete mode 100644 poky/meta/recipes-connectivity/bluez5/bluez5_5.65.bb create mode 100644 poky/meta/recipes-connectivity/bluez5/bluez5_5.66.bb create mode 100644 poky/meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch create mode 100644 poky/meta/recipes-connectivity/dhcpcd/files/0001-privsep-Allow-getrandom-sysctl-for-newer-glibc.patch create mode 100644 poky/meta/recipes-connectivity/dhcpcd/files/0002-privsep-Allow-newfstatat-syscall-as-well.patch delete mode 100644 poky/meta/recipes-connectivity/iproute2/iproute2_6.0.0.bb create mode 100644 poky/meta/recipes-connectivity/iproute2/iproute2_6.1.0.bb delete mode 100644 poky/meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb create mode 100644 poky/meta/recipes-connectivity/libpcap/libpcap_1.10.2.bb create mode 100644 poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch create mode 100644 poky/meta/recipes-connectivity/resolvconf/resolvconf/0001-avoid-using-m-option-for-readlink.patch create mode 100644 poky/meta/recipes-connectivity/slirp/libslirp_git.bb delete mode 100644 poky/meta/recipes-core/dropbear/dropbear/0007-Fix-X11-build-failure-use-DROPBEAR_PRIO_LOWDELAY.patch delete mode 100644 poky/meta/recipes-core/dropbear/dropbear_2022.82.bb create mode 100644 poky/meta/recipes-core/dropbear/dropbear_2022.83.bb delete mode 100644 poky/meta/recipes-core/ell/ell_0.53.bb create mode 100644 poky/meta/recipes-core/ell/ell_0.55.bb create mode 100644 poky/meta/recipes-core/glib-2.0/glib-2.0/fix-errno.patch delete mode 100644 poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.1.bb create mode 100644 poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb create mode 100644 poky/meta/recipes-core/glibc/glibc/0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch delete mode 100644 poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.30.bb create mode 100644 poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.33.bb delete mode 100644 poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.30.bb create mode 100644 poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.33.bb delete mode 100644 poky/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch delete mode 100644 poky/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch delete mode 100644 poky/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch create mode 100644 poky/meta/recipes-core/libxml/libxml2/fix-tests.patch create mode 100644 poky/meta/recipes-core/libxml/libxml2/install-tests.patch delete mode 100644 poky/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch delete mode 100644 poky/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch mode change 100644 => 100755 poky/meta/recipes-core/libxml/libxml2/run-ptest delete mode 100644 poky/meta/recipes-core/libxml/libxml2/runtest.patch create mode 100644 poky/meta/recipes-core/libxml/libxml2_2.10.3.bb delete mode 100644 poky/meta/recipes-core/libxml/libxml2_2.9.14.bb create mode 100644 poky/meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb delete mode 100644 poky/meta/recipes-core/systemd/systemd-boot_251.8.bb create mode 100644 poky/meta/recipes-core/systemd/systemd-boot_252.4.bb create mode 100644 poky/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch delete mode 100644 poky/meta/recipes-core/systemd/systemd_251.8.bb create mode 100644 poky/meta/recipes-core/systemd/systemd_252.4.bb create mode 100644 poky/meta/recipes-devtools/binutils/binutils/0015-CVE-2022-4285.patch create mode 100644 poky/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch delete mode 100644 poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb create mode 100644 poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.1.bb delete mode 100644 poky/meta/recipes-devtools/cargo/cargo.inc delete mode 100644 poky/meta/recipes-devtools/cargo/cargo_1.65.0.bb delete mode 100644 poky/meta/recipes-devtools/ccache/ccache_4.7.2.bb create mode 100644 poky/meta/recipes-devtools/ccache/ccache_4.7.4.bb delete mode 100644 poky/meta/recipes-devtools/cmake/cmake-native_3.24.2.bb create mode 100644 poky/meta/recipes-devtools/cmake/cmake-native_3.25.1.bb delete mode 100644 poky/meta/recipes-devtools/cmake/cmake_3.24.2.bb create mode 100644 poky/meta/recipes-devtools/cmake/cmake_3.25.1.bb create mode 100644 poky/meta/recipes-devtools/dpkg/dpkg_1.21.17.bb delete mode 100644 poky/meta/recipes-devtools/dpkg/dpkg_1.21.9.bb create mode 100644 poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch create mode 100644 poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch delete mode 100644 poky/meta/recipes-devtools/elfutils/elfutils_0.187.bb create mode 100644 poky/meta/recipes-devtools/elfutils/elfutils_0.188.bb delete mode 100644 poky/meta/recipes-devtools/elfutils/files/0001-tests-Add-libeu-to-tests-needing-error-API.patch create mode 100644 poky/meta/recipes-devtools/erofs-utils/erofs-utils/0001-configure-use-AC_SYS_LARGEFILE.patch create mode 100644 poky/meta/recipes-devtools/erofs-utils/erofs-utils/0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch create mode 100644 poky/meta/recipes-devtools/erofs-utils/erofs-utils/0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch create mode 100644 poky/meta/recipes-devtools/fdisk/gptfdisk/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch create mode 100644 poky/meta/recipes-devtools/fdisk/gptfdisk/0001-Use-64bit-time_t-on-linux-as-well.patch delete mode 100644 poky/meta/recipes-devtools/file/file_5.43.bb create mode 100644 poky/meta/recipes-devtools/file/file_5.44.bb delete mode 100644 poky/meta/recipes-devtools/git/git_2.38.1.bb create mode 100644 poky/meta/recipes-devtools/git/git_2.39.0.bb delete mode 100644 poky/meta/recipes-devtools/go/go-1.19.3.inc create mode 100644 poky/meta/recipes-devtools/go/go-1.19.4.inc delete mode 100644 poky/meta/recipes-devtools/go/go-binary-native_1.19.3.bb create mode 100644 poky/meta/recipes-devtools/go/go-binary-native_1.19.4.bb delete mode 100644 poky/meta/recipes-devtools/go/go-cross-canadian_1.19.3.bb create mode 100644 poky/meta/recipes-devtools/go/go-cross-canadian_1.19.4.bb delete mode 100644 poky/meta/recipes-devtools/go/go-cross_1.19.3.bb create mode 100644 poky/meta/recipes-devtools/go/go-cross_1.19.4.bb delete mode 100644 poky/meta/recipes-devtools/go/go-crosssdk_1.19.3.bb create mode 100644 poky/meta/recipes-devtools/go/go-crosssdk_1.19.4.bb delete mode 100644 poky/meta/recipes-devtools/go/go-native_1.19.3.bb create mode 100644 poky/meta/recipes-devtools/go/go-native_1.19.4.bb delete mode 100644 poky/meta/recipes-devtools/go/go-runtime_1.19.3.bb create mode 100644 poky/meta/recipes-devtools/go/go-runtime_1.19.4.bb delete mode 100644 poky/meta/recipes-devtools/go/go_1.19.3.bb create mode 100644 poky/meta/recipes-devtools/go/go_1.19.4.bb delete mode 100644 poky/meta/recipes-devtools/help2man/help2man_1.49.2.bb create mode 100644 poky/meta/recipes-devtools/help2man/help2man_1.49.3.bb delete mode 100644 poky/meta/recipes-devtools/jquery/jquery_3.6.1.bb create mode 100644 poky/meta/recipes-devtools/jquery/jquery_3.6.3.bb delete mode 100644 poky/meta/recipes-devtools/librepo/librepo_1.14.5.bb create mode 100644 poky/meta/recipes-devtools/librepo/librepo_1.15.1.bb create mode 100644 poky/meta/recipes-devtools/llvm/llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch delete mode 100644 poky/meta/recipes-devtools/meson/meson/0001-is_debianlike-always-return-False.patch delete mode 100644 poky/meta/recipes-devtools/meson/meson_0.64.0.bb create mode 100644 poky/meta/recipes-devtools/meson/meson_1.0.0.bb delete mode 100644 poky/meta/recipes-devtools/nasm/nasm_2.15.05.bb create mode 100644 poky/meta/recipes-devtools/nasm/nasm_2.16.01.bb create mode 100644 poky/meta/recipes-devtools/opkg/opkg/0002-opkg-key-remove-no-options-flag-from-gpg-calls.patch delete mode 100644 poky/meta/recipes-devtools/opkg/opkg_0.6.0.bb create mode 100644 poky/meta/recipes-devtools/opkg/opkg_0.6.1.bb create mode 100644 poky/meta/recipes-devtools/patchelf/patchelf/8d2cb4f9ab8d564904c292099a022ffb3cccd52d.patch delete mode 100644 poky/meta/recipes-devtools/patchelf/patchelf_0.16.1.bb create mode 100644 poky/meta/recipes-devtools/patchelf/patchelf_0.17.0.bb delete mode 100644 poky/meta/recipes-devtools/perl/libmodule-build-perl_0.4231.bb create mode 100644 poky/meta/recipes-devtools/perl/libmodule-build-perl_0.4232.bb create mode 100644 poky/meta/recipes-devtools/perl/libtest-fatal-perl_0.017.bb create mode 100644 poky/meta/recipes-devtools/perl/libtest-warnings-perl_0.031.bb create mode 100644 poky/meta/recipes-devtools/perl/libtry-tiny-perl_0.31.bb create mode 100644 poky/meta/recipes-devtools/perl/liburi-perl/0001-Skip-TODO-test-cases-that-fail.patch delete mode 100644 poky/meta/recipes-devtools/perl/liburi-perl_5.08.bb create mode 100644 poky/meta/recipes-devtools/perl/liburi-perl_5.17.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-attrs_22.1.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-attrs_22.2.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-certifi_2022.12.7.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-certifi_2022.9.24.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-chardet_5.0.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-chardet_5.1.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-cryptography-vectors_38.0.3.bb create mode 100644 poky/meta/recipes-devtools/python/python3-cryptography-vectors_38.0.4.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-cryptography_38.0.3.bb create mode 100644 poky/meta/recipes-devtools/python/python3-cryptography_38.0.4.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-dbusmock_0.28.4.bb create mode 100644 poky/meta/recipes-devtools/python/python3-dbusmock_0.28.6.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-dtschema_2022.11.bb create mode 100644 poky/meta/recipes-devtools/python/python3-dtschema_2022.12.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-git_3.1.29.bb create mode 100644 poky/meta/recipes-devtools/python/python3-git_3.1.30.bb create mode 100644 poky/meta/recipes-devtools/python/python3-gitdb_4.0.10.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-gitdb_4.0.9.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-hatch-vcs_0.2.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-hatch-vcs_0.3.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-hatchling_1.11.1.bb create mode 100644 poky/meta/recipes-devtools/python/python3-hatchling_1.12.1.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-hypothesis_6.56.4.bb create mode 100644 poky/meta/recipes-devtools/python/python3-hypothesis_6.61.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-importlib-metadata_5.0.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-importlib-metadata_5.2.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-installer_0.5.1.bb create mode 100644 poky/meta/recipes-devtools/python/python3-installer_0.6.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-jsonschema_4.17.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-jsonschema_4.17.3.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-lxml_4.9.1.bb create mode 100644 poky/meta/recipes-devtools/python/python3-lxml_4.9.2.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-mako_1.2.3.bb create mode 100644 poky/meta/recipes-devtools/python/python3-mako_1.2.4.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-numpy/0001-generate_umath.py-do-not-write-full-path-to-output-f.patch delete mode 100644 poky/meta/recipes-devtools/python/python3-numpy_1.23.4.bb create mode 100644 poky/meta/recipes-devtools/python/python3-numpy_1.24.1.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-packaging_21.3.bb create mode 100644 poky/meta/recipes-devtools/python/python3-packaging_22.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-pathspec_0.10.1.bb create mode 100644 poky/meta/recipes-devtools/python/python3-pathspec_0.10.3.bb create mode 100644 poky/meta/recipes-devtools/python/python3-poetry-core/deterministic.patch delete mode 100644 poky/meta/recipes-devtools/python/python3-poetry-core_1.3.2.bb create mode 100644 poky/meta/recipes-devtools/python/python3-poetry-core_1.4.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-pycairo_1.21.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-pycairo_1.23.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-pycryptodome_3.15.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-pycryptodome_3.16.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-pycryptodomex_3.15.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-pycryptodomex_3.16.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-pyrsistent_0.19.2.bb create mode 100644 poky/meta/recipes-devtools/python/python3-pyrsistent_0.19.3.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-pytz_2022.6.bb create mode 100644 poky/meta/recipes-devtools/python/python3-pytz_2022.7.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-setuptools-scm_7.0.5.bb create mode 100644 poky/meta/recipes-devtools/python/python3-setuptools-scm_7.1.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-setuptools_65.5.1.bb create mode 100644 poky/meta/recipes-devtools/python/python3-setuptools_65.6.3.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-sphinx_5.3.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-sphinx_6.0.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-strict-rfc3339/0001-setup.py-use-vendored-_distutils.patch delete mode 100644 poky/meta/recipes-devtools/python/python3-strict-rfc3339_0.7.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-subunit_1.4.1.bb create mode 100644 poky/meta/recipes-devtools/python/python3-subunit_1.4.2.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-urllib3_1.26.12.bb create mode 100644 poky/meta/recipes-devtools/python/python3-urllib3_1.26.13.bb delete mode 100644 poky/meta/recipes-devtools/python/python3-zipp_3.10.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3-zipp_3.11.0.bb delete mode 100644 poky/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch delete mode 100644 poky/meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch delete mode 100644 poky/meta/recipes-devtools/python/python3/0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch delete mode 100644 poky/meta/recipes-devtools/python/python3/python-config.patch delete mode 100644 poky/meta/recipes-devtools/python/python3_3.11.0.bb create mode 100644 poky/meta/recipes-devtools/python/python3_3.11.1.bb delete mode 100644 poky/meta/recipes-devtools/qemu/qemu-native_7.1.0.bb create mode 100644 poky/meta/recipes-devtools/qemu/qemu-native_7.2.0.bb delete mode 100644 poky/meta/recipes-devtools/qemu/qemu-system-native_7.1.0.bb create mode 100644 poky/meta/recipes-devtools/qemu/qemu-system-native_7.2.0.bb create mode 100644 poky/meta/recipes-devtools/qemu/qemu/0001-configure-Fix-check-tcg-not-executing-any-tests.patch create mode 100644 poky/meta/recipes-devtools/qemu/qemu/0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch delete mode 100644 poky/meta/recipes-devtools/qemu/qemu/0001-net-tulip-Restrict-DMA-engine-to-memories.patch create mode 100644 poky/meta/recipes-devtools/qemu/qemu/0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch delete mode 100644 poky/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch delete mode 100644 poky/meta/recipes-devtools/qemu/qemu/arm-cpreg-fix.patch delete mode 100644 poky/meta/recipes-devtools/qemu/qemu_7.1.0.bb create mode 100644 poky/meta/recipes-devtools/qemu/qemu_7.2.0.bb delete mode 100644 poky/meta/recipes-devtools/repo/repo_2.29.9.bb create mode 100644 poky/meta/recipes-devtools/repo/repo_2.31.bb delete mode 100644 poky/meta/recipes-devtools/rpm/files/environment.d-rpm.sh delete mode 100644 poky/meta/recipes-devtools/rsync/files/0001-Turn-on-pedantic-errors-at-the-end-of-configure.patch delete mode 100644 poky/meta/recipes-devtools/rsync/rsync_3.2.5.bb create mode 100644 poky/meta/recipes-devtools/rsync/rsync_3.2.7.bb delete mode 100644 poky/meta/recipes-devtools/ruby/ruby.inc delete mode 100644 poky/meta/recipes-devtools/ruby/ruby/0001-Remove-dependency-on-libcapstone.patch delete mode 100644 poky/meta/recipes-devtools/ruby/ruby_3.1.2.bb create mode 100644 poky/meta/recipes-devtools/ruby/ruby_3.2.0.bb create mode 100644 poky/meta/recipes-devtools/rust/cargo_1.66.0.bb create mode 100644 poky/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch create mode 100644 poky/meta/recipes-devtools/rust/files/crossbeam_atomic.patch create mode 100644 poky/meta/recipes-devtools/rust/files/getrandom-open64.patch create mode 100644 poky/meta/recipes-devtools/rust/files/hardcodepaths.patch create mode 100644 poky/meta/recipes-devtools/rust/files/zlib-off64_t.patch delete mode 100644 poky/meta/recipes-devtools/rust/libstd-rs.inc delete mode 100644 poky/meta/recipes-devtools/rust/libstd-rs_1.65.0.bb create mode 100644 poky/meta/recipes-devtools/rust/libstd-rs_1.66.0.bb delete mode 100644 poky/meta/recipes-devtools/rust/rust-cross-canadian_1.65.0.bb create mode 100644 poky/meta/recipes-devtools/rust/rust-cross-canadian_1.66.0.bb delete mode 100644 poky/meta/recipes-devtools/rust/rust-llvm.inc create mode 100644 poky/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch delete mode 100644 poky/meta/recipes-devtools/rust/rust-llvm_1.65.0.bb create mode 100644 poky/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb delete mode 100644 poky/meta/recipes-devtools/rust/rust-target.inc delete mode 100644 poky/meta/recipes-devtools/rust/rust.inc delete mode 100644 poky/meta/recipes-devtools/rust/rust/0001-Add-ENOTSUP-constant-for-riscv32-musl.patch delete mode 100644 poky/meta/recipes-devtools/rust/rust/crossbeam_atomic.patch delete mode 100644 poky/meta/recipes-devtools/rust/rust/hardcodepaths.patch delete mode 100644 poky/meta/recipes-devtools/rust/rust_1.65.0.bb create mode 100644 poky/meta/recipes-devtools/rust/rust_1.66.0.bb create mode 100644 poky/meta/recipes-devtools/strace/strace/0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch create mode 100644 poky/meta/recipes-devtools/strace/strace/0002-tests-Replace-off64_t-with-off_t.patch delete mode 100644 poky/meta/recipes-devtools/strace/strace_6.0.bb create mode 100644 poky/meta/recipes-devtools/strace/strace_6.1.bb delete mode 100644 poky/meta/recipes-devtools/swig/swig_4.0.2.bb create mode 100644 poky/meta/recipes-devtools/swig/swig_4.1.1.bb delete mode 100644 poky/meta/recipes-devtools/tcltk/tcl_8.6.11.bb create mode 100644 poky/meta/recipes-devtools/tcltk/tcl_8.6.13.bb delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/0001-Add-listen-action-for-a-tcp-socket.patch create mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch create mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/0001-daemon.c-Fix-race-window-for-writing-of-the-pid-file.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/0001-daemon.c-Libtirpc-porting-fixes.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/fix_compile_warning.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/no-yywrap.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/tcp_no_delay.patch delete mode 100644 poky/meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch create mode 100644 poky/meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb create mode 100644 poky/meta/recipes-extended/bash/bash_5.2.15.bb delete mode 100644 poky/meta/recipes-extended/bash/bash_5.2.9.bb delete mode 100644 poky/meta/recipes-extended/gawk/gawk_5.1.1.bb create mode 100644 poky/meta/recipes-extended/gawk/gawk_5.2.1.bb delete mode 100644 poky/meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch create mode 100644 poky/meta/recipes-extended/ghostscript/ghostscript/cross-compile.patch create mode 100644 poky/meta/recipes-extended/ghostscript/ghostscript/do-not-check-local-libpng-source.patch create mode 100644 poky/meta/recipes-extended/ghostscript/ghostscript_10.0.0.bb delete mode 100644 poky/meta/recipes-extended/ghostscript/ghostscript_9.56.1.bb delete mode 100644 poky/meta/recipes-extended/iputils/iputils/0001-rarpd-rdisc-Drop-PrivateUsers.patch delete mode 100644 poky/meta/recipes-extended/iputils/iputils_20211215.bb create mode 100644 poky/meta/recipes-extended/iputils/iputils_20221126.bb delete mode 100644 poky/meta/recipes-extended/libarchive/libarchive/0001-libarchive-Do-not-include-sys-mount.h-when-linux-fs..patch delete mode 100644 poky/meta/recipes-extended/libarchive/libarchive_3.6.1.bb create mode 100644 poky/meta/recipes-extended/libarchive/libarchive_3.6.2.bb delete mode 100644 poky/meta/recipes-extended/libpipeline/libpipeline_1.5.6.bb create mode 100644 poky/meta/recipes-extended/libpipeline/libpipeline_1.5.7.bb delete mode 100644 poky/meta/recipes-extended/libsolv/libsolv_0.7.22.bb create mode 100644 poky/meta/recipes-extended/libsolv/libsolv_0.7.23.bb delete mode 100644 poky/meta/recipes-extended/logrotate/logrotate_3.20.1.bb create mode 100644 poky/meta/recipes-extended/logrotate/logrotate_3.21.0.bb delete mode 100644 poky/meta/recipes-extended/lsof/lsof_4.96.4.bb create mode 100644 poky/meta/recipes-extended/lsof/lsof_4.96.5.bb create mode 100644 poky/meta/recipes-extended/ltp/ltp/0001-testcases-Fix-largefile-support.patch delete mode 100644 poky/meta/recipes-extended/man-db/man-db_2.10.2.bb create mode 100644 poky/meta/recipes-extended/man-db/man-db_2.11.1.bb create mode 100644 poky/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch delete mode 100644 poky/meta/recipes-extended/newt/files/0002-don-t-ignore-CFLAGS-when-building-snack.patch delete mode 100644 poky/meta/recipes-extended/newt/libnewt_0.52.21.bb create mode 100644 poky/meta/recipes-extended/newt/libnewt_0.52.23.bb create mode 100644 poky/meta/recipes-extended/pam/libpam/CVE-2022-28321-0002.patch delete mode 100644 poky/meta/recipes-extended/psmisc/psmisc_23.5.bb create mode 100644 poky/meta/recipes-extended/psmisc/psmisc_23.6.bb delete mode 100644 poky/meta/recipes-extended/quota/quota/0001-quota-Use-realloc-3-instead-of-reallocarray-3.patch delete mode 100644 poky/meta/recipes-extended/quota/quota_4.06.bb create mode 100644 poky/meta/recipes-extended/quota/quota_4.09.bb create mode 100644 poky/meta/recipes-extended/rpcsvc-proto/rpcsvc-proto/0001-Use-AC_SYS_LARGEFILE-macro-to-control-largefile-supp.patch delete mode 100644 poky/meta/recipes-extended/shadow/files/0001-Drop-nsswitch.conf-message-when-not-in-place-eg.-musl.patch delete mode 100644 poky/meta/recipes-extended/shadow/files/0001-shadow-use-relaxed-usernames.patch delete mode 100644 poky/meta/recipes-extended/shadow/shadow_4.12.3.bb create mode 100644 poky/meta/recipes-extended/shadow/shadow_4.13.bb create mode 100644 poky/meta/recipes-extended/stress-ng/stress-ng/0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch delete mode 100644 poky/meta/recipes-extended/stress-ng/stress-ng_0.14.06.bb create mode 100644 poky/meta/recipes-extended/stress-ng/stress-ng_0.15.01.bb delete mode 100644 poky/meta/recipes-extended/texinfo/texinfo/0001-gnulib-Update.patch delete mode 100644 poky/meta/recipes-extended/texinfo/texinfo_6.8.bb create mode 100644 poky/meta/recipes-extended/texinfo/texinfo_7.0.1.bb delete mode 100644 poky/meta/recipes-extended/xz/xz_5.2.7.bb create mode 100644 poky/meta/recipes-extended/xz/xz_5.4.0.bb delete mode 100644 poky/meta/recipes-gnome/epiphany/epiphany_42.4.bb create mode 100644 poky/meta/recipes-gnome/epiphany/epiphany_43.0.bb delete mode 100644 poky/meta/recipes-gnome/gcr/gcr/0001-gcr-meson.build-fix-one-parallel-build-failure.patch create mode 100644 poky/meta/recipes-gnome/gcr/gcr/0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch delete mode 100644 poky/meta/recipes-gnome/gcr/gcr/b3ca1d02bb0148ca787ac4aead164d7c8ce2c4d8.patch create mode 100644 poky/meta/recipes-gnome/gcr/gcr3/0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch create mode 100644 poky/meta/recipes-gnome/gcr/gcr3_3.41.1.bb delete mode 100644 poky/meta/recipes-gnome/gcr/gcr_3.40.0.bb create mode 100644 poky/meta/recipes-gnome/gcr/gcr_4.0.0.bb delete mode 100644 poky/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.72.0.bb create mode 100644 poky/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.74.0.bb create mode 100644 poky/meta/recipes-gnome/gtk+/gtk+3/0001-meson.build-build-introspection-according-to-option-.patch delete mode 100644 poky/meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch delete mode 100644 poky/meta/recipes-gnome/gtk+/gtk+3/0003-Add-disable-opengl-configure-option.patch delete mode 100644 poky/meta/recipes-gnome/gtk+/gtk+3/link_fribidi.patch create mode 100644 poky/meta/recipes-gnome/gtk+/gtk+3/opengl.patch delete mode 100644 poky/meta/recipes-gnome/gtk+/gtk+3_3.24.34.bb create mode 100644 poky/meta/recipes-gnome/gtk+/gtk+3_3.24.36.bb create mode 100644 poky/meta/recipes-gnome/gtk+/gtk4_4.8.3.bb delete mode 100644 poky/meta/recipes-gnome/libhandy/libhandy_1.6.3.bb create mode 100644 poky/meta/recipes-gnome/libhandy/libhandy_1.8.0.bb create mode 100644 poky/meta/recipes-gnome/libportal/libportal_0.6.bb delete mode 100644 poky/meta/recipes-graphics/glslang/glslang_1.3.231.1.bb create mode 100644 poky/meta/recipes-graphics/glslang/glslang_1.3.236.0.bb create mode 100644 poky/meta/recipes-graphics/graphene/graphene_1.10.8.bb delete mode 100644 poky/meta/recipes-graphics/harfbuzz/harfbuzz_5.3.1.bb create mode 100644 poky/meta/recipes-graphics/harfbuzz/harfbuzz_6.0.0.bb delete mode 100644 poky/meta/recipes-graphics/libepoxy/files/0001-dispatch_common.h-define-also-EGL_NO_X11.patch delete mode 100644 poky/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch delete mode 100644 poky/meta/recipes-graphics/libsdl2/libsdl2_2.24.2.bb create mode 100644 poky/meta/recipes-graphics/libsdl2/libsdl2_2.26.2.bb delete mode 100644 poky/meta/recipes-graphics/libva/libva-utils_2.16.0.bb create mode 100644 poky/meta/recipes-graphics/libva/libva-utils_2.17.1.bb delete mode 100644 poky/meta/recipes-graphics/pango/pango/0001-tests-meson.build-install-nofonts-fonts.conf-as-it-i.patch delete mode 100644 poky/meta/recipes-graphics/pango/pango_1.50.11.bb create mode 100644 poky/meta/recipes-graphics/pango/pango_1.50.12.bb delete mode 100644 poky/meta/recipes-graphics/piglit/piglit/0005-cmake-Don-t-enable-GLX-if-tests-are-disabled.patch delete mode 100644 poky/meta/recipes-graphics/shaderc/shaderc_2022.3.bb create mode 100644 poky/meta/recipes-graphics/shaderc/shaderc_2022.4.bb delete mode 100644 poky/meta/recipes-graphics/spir/spirv-headers_1.3.231.1.bb create mode 100644 poky/meta/recipes-graphics/spir/spirv-headers_1.3.236.0.bb delete mode 100644 poky/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb create mode 100644 poky/meta/recipes-graphics/spir/spirv-tools_1.3.236.0.bb delete mode 100644 poky/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb create mode 100644 poky/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.4.bb delete mode 100644 poky/meta/recipes-graphics/vulkan/vulkan-headers_1.3.231.1.bb create mode 100644 poky/meta/recipes-graphics/vulkan/vulkan-headers_1.3.236.0.bb delete mode 100644 poky/meta/recipes-graphics/vulkan/vulkan-loader_1.3.231.1.bb create mode 100644 poky/meta/recipes-graphics/vulkan/vulkan-loader_1.3.236.0.bb create mode 100644 poky/meta/recipes-graphics/vulkan/vulkan-samples/0001-Do-not-use-LFS64-functions-on-linux-musl.patch delete mode 100644 poky/meta/recipes-graphics/vulkan/vulkan-tools_1.3.231.1.bb create mode 100644 poky/meta/recipes-graphics/vulkan/vulkan-tools_1.3.236.0.bb delete mode 100644 poky/meta/recipes-graphics/wayland/libinput_1.21.0.bb create mode 100644 poky/meta/recipes-graphics/wayland/libinput_1.22.0.bb delete mode 100644 poky/meta/recipes-graphics/wayland/wayland-protocols_1.28.bb create mode 100644 poky/meta/recipes-graphics/wayland/wayland-protocols_1.31.bb delete mode 100644 poky/meta/recipes-graphics/wayland/weston_11.0.0.bb create mode 100644 poky/meta/recipes-graphics/wayland/weston_11.0.1.bb delete mode 100644 poky/meta/recipes-graphics/xorg-app/xhost_1.0.8.bb create mode 100644 poky/meta/recipes-graphics/xorg-app/xhost_1.0.9.bb delete mode 100644 poky/meta/recipes-graphics/xorg-app/xinit_1.4.1.bb create mode 100644 poky/meta/recipes-graphics/xorg-app/xinit_1.4.2.bb delete mode 100644 poky/meta/recipes-graphics/xorg-app/xkbcomp_1.4.5.bb create mode 100644 poky/meta/recipes-graphics/xorg-app/xkbcomp_1.4.6.bb delete mode 100644 poky/meta/recipes-graphics/xorg-app/xprop_1.2.5.bb create mode 100644 poky/meta/recipes-graphics/xorg-app/xprop_1.2.6.bb delete mode 100644 poky/meta/recipes-graphics/xorg-app/xrandr_1.5.1.bb create mode 100644 poky/meta/recipes-graphics/xorg-app/xrandr_1.5.2.bb delete mode 100644 poky/meta/recipes-graphics/xorg-app/xset_1.2.4.bb create mode 100644 poky/meta/recipes-graphics/xorg-app/xset_1.2.5.bb delete mode 100644 poky/meta/recipes-graphics/xorg-app/xvinfo_1.1.4.bb create mode 100644 poky/meta/recipes-graphics/xorg-app/xvinfo_1.1.5.bb delete mode 100644 poky/meta/recipes-graphics/xorg-driver/xf86-input-mouse_1.9.3.bb create mode 100644 poky/meta/recipes-graphics/xorg-driver/xf86-input-mouse_1.9.4.bb delete mode 100644 poky/meta/recipes-graphics/xorg-driver/xf86-video-vesa_2.5.0.bb create mode 100644 poky/meta/recipes-graphics/xorg-driver/xf86-video-vesa_2.6.0.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libfontenc_1.1.6.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libfontenc_1.1.7.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libice_1.0.10.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libice_1.1.1.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libsm_1.2.3.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libsm_1.2.4.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libx11-compose-data_1.6.8.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libx11-compose-data_1.8.3.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libx11_1.8.3.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxau_1.0.10.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxau_1.0.11.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxcomposite_0.4.5.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxcomposite_0.4.6.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxdamage_1.1.5.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxdamage_1.1.6.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxdmcp_1.1.3.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxdmcp_1.1.4.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxft_2.3.6.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxft_2.3.7.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.4.1.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.5.0.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxkbfile_1.1.1.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxkbfile_1.1.2.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxpm_3.5.13.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxpm_3.5.14.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxrandr_1.5.2.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxrandr_1.5.3.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxres_1.2.1.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxres_1.2.2.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxscrnsaver_1.2.3.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxscrnsaver_1.2.4.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.1.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.2.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/libxv_1.0.11.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/libxv_1.0.12.bb delete mode 100644 poky/meta/recipes-graphics/xorg-lib/xcb-util_0.4.0.bb create mode 100644 poky/meta/recipes-graphics/xorg-lib/xcb-util_0.4.1.bb delete mode 100644 poky/meta/recipes-graphics/xorg-util/makedepend_1.0.7.bb create mode 100644 poky/meta/recipes-graphics/xorg-util/makedepend_1.0.8.bb delete mode 100644 poky/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch delete mode 100644 poky/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-xkb-proof-GetCountedString-against-request-length-at.patch delete mode 100644 poky/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.4.bb create mode 100644 poky/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.6.bb delete mode 100644 poky/meta/recipes-graphics/xwayland/xwayland_22.1.5.bb create mode 100644 poky/meta/recipes-graphics/xwayland/xwayland_22.1.7.bb delete mode 100644 poky/meta/recipes-kernel/kexec/kexec-tools_2.0.25.bb create mode 100644 poky/meta/recipes-kernel/kexec/kexec-tools_2.0.26.bb delete mode 100644 poky/meta/recipes-kernel/linux-firmware/linux-firmware_20221012.bb create mode 100644 poky/meta/recipes-kernel/linux-firmware/linux-firmware_20221214.bb delete mode 100644 poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch delete mode 100644 poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_5.19.bb create mode 100644 poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_6.1.bb create mode 100644 poky/meta/recipes-kernel/linux/linux-yocto-rt_6.1.bb create mode 100644 poky/meta/recipes-kernel/linux/linux-yocto-tiny_6.1.bb create mode 100644 poky/meta/recipes-kernel/linux/linux-yocto_6.1.bb create mode 100644 poky/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch create mode 100644 poky/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch delete mode 100644 poky/meta/recipes-kernel/systemtap/systemtap/python-3.11.patch create mode 100644 poky/meta/recipes-multimedia/alsa/alsa-utils/0001-aplay-axfer-Replace-off64_t-with-off_t.patch create mode 100644 poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch create mode 100644 poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch delete mode 100644 poky/meta/recipes-multimedia/flac/flac_1.4.0.bb create mode 100644 poky/meta/recipes-multimedia/flac/flac_1.4.2.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gst-devtools_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gst-devtools_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.20.5.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-bin-Fix-race-conditions-in-tests.patch delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-tests-remove-gstbin-test_watch_for_state_change-test.patch delete mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.20.4.bb create mode 100644 poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.20.5.bb delete mode 100644 poky/meta/recipes-multimedia/libpng/libpng_1.6.38.bb create mode 100644 poky/meta/recipes-multimedia/libpng/libpng_1.6.39.bb delete mode 100644 poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.1.0.bb create mode 100644 poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.2.0.bb delete mode 100644 poky/meta/recipes-multimedia/libtiff/files/0001-Revised-handling-of-TIFFTAG_INKNAMES-and-related-TIF.patch delete mode 100644 poky/meta/recipes-multimedia/libtiff/files/0001-fix-the-FPE-in-tiffcrop-415-427-and-428.patch delete mode 100644 poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-S-option-Make-decision-simpler.patch delete mode 100644 poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-disable-incompatibility-of-Z-X-Y-z-options-.patch delete mode 100644 poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-subroutines-require-a-larger-buffer-fixes-2.patch delete mode 100644 poky/meta/recipes-multimedia/libtiff/files/CVE-2022-2953.patch delete mode 100644 poky/meta/recipes-multimedia/libtiff/files/CVE-2022-34526.patch delete mode 100644 poky/meta/recipes-multimedia/libtiff/tiff_4.4.0.bb create mode 100644 poky/meta/recipes-multimedia/libtiff/tiff_4.5.0.bb delete mode 100644 poky/meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.30.bb create mode 100644 poky/meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.31.bb delete mode 100644 poky/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-without-opengl-or-es.patch delete mode 100644 poky/meta/recipes-sato/webkit/webkitgtk/0001-Tweak-gtkdoc-settings-so-that-gtkdoc-generation-work.patch delete mode 100644 poky/meta/recipes-sato/webkit/webkitgtk/fix-gstreamer-include-paths.patch delete mode 100644 poky/meta/recipes-sato/webkit/webkitgtk_2.36.7.bb create mode 100644 poky/meta/recipes-sato/webkit/webkitgtk_2.38.3.bb delete mode 100644 poky/meta/recipes-support/atk/at-spi2-atk_2.38.0.bb delete mode 100644 poky/meta/recipes-support/atk/at-spi2-core_2.44.1.bb create mode 100644 poky/meta/recipes-support/atk/at-spi2-core_2.46.0.bb delete mode 100644 poky/meta/recipes-support/atk/atk_2.38.0.bb create mode 100644 poky/meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch delete mode 100644 poky/meta/recipes-support/boost/boost-1.80.0.inc create mode 100644 poky/meta/recipes-support/boost/boost-1.81.0.inc delete mode 100644 poky/meta/recipes-support/boost/boost-build-native_1.80.0.bb create mode 100644 poky/meta/recipes-support/boost/boost-build-native_1.81.0.bb delete mode 100644 poky/meta/recipes-support/boost/boost/0001-The-std-lib-unary-binary_function-base-classes-are-d.patch delete mode 100644 poky/meta/recipes-support/boost/boost_1.80.0.bb create mode 100644 poky/meta/recipes-support/boost/boost_1.81.0.bb delete mode 100644 poky/meta/recipes-support/curl/curl_7.86.0.bb create mode 100644 poky/meta/recipes-support/curl/curl_7.87.0.bb delete mode 100644 poky/meta/recipes-support/diffoscope/diffoscope_224.bb create mode 100644 poky/meta/recipes-support/diffoscope/diffoscope_230.bb delete mode 100644 poky/meta/recipes-support/gnupg/gnupg_2.3.7.bb create mode 100644 poky/meta/recipes-support/gnupg/gnupg_2.4.0.bb create mode 100644 poky/meta/recipes-support/gpgme/gpgme/0001-posix-io.c-Use-off_t-instead-of-off64_t.patch delete mode 100644 poky/meta/recipes-support/icu/icu_71.1.bb create mode 100644 poky/meta/recipes-support/icu/icu_72-1.bb create mode 100644 poky/meta/recipes-support/libbsd/libbsd/0001-funopen-Replace-off64_t-with-off_t-in-funopen_seek.patch delete mode 100644 poky/meta/recipes-support/libgpg-error/libgpg-error_1.45.bb create mode 100644 poky/meta/recipes-support/libgpg-error/libgpg-error_1.46.bb delete mode 100644 poky/meta/recipes-support/libksba/libksba_1.6.2.bb create mode 100644 poky/meta/recipes-support/libksba/libksba_1.6.3.bb delete mode 100644 poky/meta/recipes-support/libmpc/libmpc_1.2.1.bb create mode 100644 poky/meta/recipes-support/libmpc/libmpc_1.3.1.bb delete mode 100644 poky/meta/recipes-support/libpcre/libpcre2_10.40.bb create mode 100644 poky/meta/recipes-support/libpcre/libpcre2_10.42.bb delete mode 100644 poky/meta/recipes-support/libpsl/libpsl_0.21.1.bb create mode 100644 poky/meta/recipes-support/libpsl/libpsl_0.21.2.bb delete mode 100644 poky/meta/recipes-support/mpfr/mpfr_4.1.0.bb create mode 100644 poky/meta/recipes-support/mpfr/mpfr_4.2.0.bb delete mode 100644 poky/meta/recipes-support/nghttp2/nghttp2_1.50.0.bb create mode 100644 poky/meta/recipes-support/nghttp2/nghttp2_1.51.0.bb create mode 100644 poky/meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch create mode 100644 poky/meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch delete mode 100644 poky/meta/recipes-support/popt/popt/0001-popt-test-output-format-for-ptest.patch delete mode 100644 poky/meta/recipes-support/popt/popt_1.18.bb create mode 100644 poky/meta/recipes-support/popt/popt_1.19.bb delete mode 100644 poky/meta/recipes-support/sqlite/sqlite3_3.39.4.bb create mode 100644 poky/meta/recipes-support/sqlite/sqlite3_3.40.1.bb delete mode 100644 poky/meta/recipes-support/vte/vte/0001-Makefile.docs-correctly-substitute-gtkdoc-qemu-wrapp.patch delete mode 100644 poky/meta/recipes-support/vte/vte_0.68.0.bb create mode 100644 poky/meta/recipes-support/vte/vte_0.70.2.bb diff --git a/meta-arm/.gitlab-ci.yml b/meta-arm/.gitlab-ci.yml index 7d050a551b..09ca8c41d7 100644 --- a/meta-arm/.gitlab-ci.yml +++ b/meta-arm/.gitlab-ci.yml @@ -1,11 +1,21 @@ image: ghcr.io/siemens/kas/kas:latest-release +variables: + CPU_REQUEST: "" + DEFAULT_TAG: "" + # These are needed as the k8s executor doesn't respect the container entrypoint + # by default + FF_KUBERNETES_HONOR_ENTRYPOINT: 1 + FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: 0 + stages: - prep - build # Common job fragment to get a worker ready .setup: + tags: + - $DEFAULT_TAG stage: build interruptible: true variables: @@ -25,11 +35,14 @@ stages: - mkdir --verbose --parents $KAS_WORK_DIR $KAS_REPO_REF_DIR $SSTATE_DIR $DL_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR # Must do this here, as it's the only way to make sure the toolchain is installed on the same builder - ./ci/get-binary-toolchains $DL_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR - - sudo apt-get update && sudo apt-get install --yes telnet python3-subunit + # This can be removed with Kas 3.2 + - sudo apt-get update && sudo apt-get install --yes python3-subunit # Generalised fragment to do a Kas build .build: extends: .setup + variables: + KUBERNETES_CPU_REQUEST: $CPU_REQUEST script: - KASFILES=$(./ci/jobs-to-kas "$CI_JOB_NAME") - kas shell --update --force-checkout $KASFILES -c 'cat conf/*.conf' @@ -84,8 +97,6 @@ fvp-base: parallel: matrix: - TESTING: testimage - tags: - - x86_64 fvp-base-arm32: extends: .build @@ -93,8 +104,6 @@ fvp-base-arm32: matrix: - TOOLCHAINS: [gcc, external-gccarm] TESTING: testimage - tags: - - x86_64 fvp-baser-aemv8r64: extends: .build @@ -107,15 +116,6 @@ fvp-baser-aemv8r64: fvps: extends: .build -gem5-arm64: - extends: .build - parallel: - matrix: - - VIRT: [none, xen] - -gem5-atp-arm64: - extends: .build - generic-arm64: extends: .build @@ -137,6 +137,7 @@ n1sdp: parallel: matrix: - TOOLCHAINS: [gcc, armgcc] + TS: [none, trusted-services] qemu-generic-arm64: extends: .build @@ -210,7 +211,7 @@ check-layers: "yocto-check-layer-wrapper $CI_PROJECT_DIR/$LAYER --dependency $CI_PROJECT_DIR/meta-* $KAS_WORK_DIR/meta-openembedded/meta-oe --no-auto-dependency" parallel: matrix: - - LAYER: [meta-arm, meta-arm-bsp, meta-arm-toolchain, meta-gem5] + - LAYER: [meta-arm, meta-arm-bsp, meta-arm-toolchain] pending-updates: extends: .setup @@ -220,16 +221,15 @@ pending-updates: script: - rm -fr update-report # This configuration has all of the layers we need enabled - - kas shell ci/gem5-arm64.yml --command \ - "$CI_PROJECT_DIR/scripts/machine-summary.py -t report -o $CI_PROJECT_DIR/update-report $($CI_PROJECT_DIR/ci/listmachines.py meta-arm meta-arm-bsp meta-gem5)" + - kas shell ci/qemuarm64.yml:ci/meta-openembedded.yml --command \ + "$CI_PROJECT_DIR/scripts/machine-summary.py -t report -o $CI_PROJECT_DIR/update-report $($CI_PROJECT_DIR/ci/listmachines.py meta-arm meta-arm-bsp)" # Do this on x86 whilst the compilers are x86-only tags: - x86_64 # What percentage of machines in the layer do we build machine-coverage: - stage: build - interruptible: true + extends: .setup script: - ./ci/check-machine-coverage coverage: '/Coverage: \d+/' diff --git a/meta-arm/README.md b/meta-arm/README.md index 221633e05d..7779258551 100644 --- a/meta-arm/README.md +++ b/meta-arm/README.md @@ -18,15 +18,6 @@ This repository contains the Arm layers for OpenEmbedded. This layer contains recipes for Arm's binary toolchains (GCC and Clang for -A and -M), and a recipe to build Arm's GCC. -* meta-atp - - This layer contains recipes for the Adaptive Traffic Generation integration into meta-gem5. - -* meta-gem5 - - This layer contains recipes and machines for gem5, a system-level and processor simulator. - - Other Directories ----------------- diff --git a/meta-arm/ci/0001-Revert-pixman-Do-not-use-clang-assembler-for-now.patch b/meta-arm/ci/0001-Revert-pixman-Do-not-use-clang-assembler-for-now.patch new file mode 100644 index 0000000000..4ad6607842 --- /dev/null +++ b/meta-arm/ci/0001-Revert-pixman-Do-not-use-clang-assembler-for-now.patch @@ -0,0 +1,26 @@ +This causes illegal instruction faults in pixman, so xserver crashes. +https://github.com/kraj/meta-clang/issues/696 + +From 8659c5c5bec39dd43a1988b19d4cf30507a44679 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Mon, 28 Nov 2022 16:52:50 +0000 +Subject: [PATCH] Revert "pixman: Do not use clang assembler for now" + +This reverts commit 84dbafa42d8141b00da75d6664aef07c252a52ee. +--- + conf/nonclangable.conf | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/conf/nonclangable.conf b/conf/nonclangable.conf +index 04112f4..b5db848 100644 +--- a/conf/nonclangable.conf ++++ b/conf/nonclangable.conf +@@ -347,5 +347,4 @@ DEPENDS:append:pn-pixman:mips:toolchain-clang = " openmp" + #| .endfunc + #| ^ + CFLAGS:append:pn-pixman:arm:toolchain-clang = " -no-integrated-as" +-CFLAGS:append:pn-pixman:aarch64:toolchain-clang = " -no-integrated-as" + +-- +2.34.1 + diff --git a/meta-arm/ci/clang.yml b/meta-arm/ci/clang.yml index e5e7dd5f3f..6c909023c7 100644 --- a/meta-arm/ci/clang.yml +++ b/meta-arm/ci/clang.yml @@ -4,8 +4,16 @@ header: repos: meta-clang: url: https://github.com/kraj/meta-clang - refspec: master + patches: + pixman: + repo: meta-arm + path: ci/0001-Revert-pixman-Do-not-use-clang-assembler-for-now.patch local_conf_header: clang: | TOOLCHAIN = "clang" + # Backport d89e06ad94a46f6810d0a8787004b71b8ecaf87d to langdale + OBJCOPY:pn-linux-yocto:toolchain-clang = "${HOST_PREFIX}objcopy" + # Perf needs fixes backported, use GCC for now + # https://lore.kernel.org/linux-perf-users/Y5d4k7fDxfRP7hcN@kernel.org/T/#t + TOOLCHAIN:pn-perf = "gcc" diff --git a/meta-arm/ci/gem5-arm64.yml b/meta-arm/ci/gem5-arm64.yml deleted file mode 100644 index 90913f37c2..0000000000 --- a/meta-arm/ci/gem5-arm64.yml +++ /dev/null @@ -1,16 +0,0 @@ -header: - version: 11 - includes: - - ci/base.yml - - ci/meta-openembedded.yml - -repos: - meta-arm: - layers: - meta-gem5: - -machine: gem5-arm64 - -target: - - core-image-minimal - - gem5-aarch64-native diff --git a/meta-arm/ci/gem5-atp-arm64.yml b/meta-arm/ci/gem5-atp-arm64.yml deleted file mode 100644 index 626947b5bb..0000000000 --- a/meta-arm/ci/gem5-atp-arm64.yml +++ /dev/null @@ -1,15 +0,0 @@ -header: - version: 11 - includes: - - ci/gem5-arm64.yml - -repos: - meta-arm: - layers: - meta-atp: - -machine: gem5-atp-arm64 - -target: - - atp-native - - core-image-minimal diff --git a/meta-arm/ci/get-binary-toolchains b/meta-arm/ci/get-binary-toolchains index ed334bf34e..bf8bf3e719 100755 --- a/meta-arm/ci/get-binary-toolchains +++ b/meta-arm/ci/get-binary-toolchains @@ -1,8 +1,9 @@ #!/bin/bash -set -u +set -u -e -HOST_ARCH=$(uname -m) -VER="11.3.rel1" +BASENAME=arm-gnu-toolchain +VER=${VER:-11.3.rel1} +HOST_ARCH=${HOST_ARCH:-$(uname -m)} DOWNLOAD_DIR=$1 TOOLCHAIN_DIR=$2 @@ -11,36 +12,39 @@ TOOLCHAIN_LINK_DIR=$3 # These should be already created by .gitlab-ci.yml, but do here if run outside of that env mkdir -p $DOWNLOAD_DIR $TOOLCHAIN_DIR $TOOLCHAIN_LINK_DIR +download() { + TRIPLE=$1 + URL=https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/$BASENAME-$VER-$HOST_ARCH-$TRIPLE.tar.xz + wget -P $DOWNLOAD_DIR -nc $URL +} + if [ $HOST_ARCH = "aarch64" ]; then - #AArch64 Linux hosted cross compilers + # AArch64 Linux hosted cross compilers - #AArch32 target with hard float (arm-none-linux-gnueabihf) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz + # AArch32 target with hard float + download arm-none-linux-gnueabihf elif [ $HOST_ARCH = "x86_64" ]; then - #x86_64 Linux hosted cross compilers - - #AArch32 target with hard float (arm-linux-none-gnueabihf) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-arm-none-linux-gnueabihf.tar.xz + # x86_64 Linux hosted cross compilers - #AArch64 GNU/Linux target (aarch64-none-linux-gnu) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-aarch64-none-linux-gnu.tar.xz + # AArch32 target with hard float + download arm-none-linux-gnueabihf - #AArch64 GNU/Linux target (aarch64_be-none-linux-gnu) - wget -P $DOWNLOAD_DIR -nc https://developer.arm.com/-/media/Files/downloads/gnu/$VER/binrel/arm-gnu-toolchain-$VER-$HOST_ARCH-aarch64_be-none-linux-gnu.tar.xz + # AArch64 GNU/Linux target + download aarch64-none-linux-gnu else echo "ERROR - Unknown build arch of $HOST_ARCH" exit 1 fi -for i in arm aarch64 aarch64_be; do - if [ ! -d $TOOLCHAIN_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then - if [ ! -f $DOWNLOAD_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then +for i in arm aarch64; do + if [ ! -d $TOOLCHAIN_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*/ ]; then + if [ ! -f $DOWNLOAD_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz ]; then continue fi - tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz + tar -C $TOOLCHAIN_DIR -axvf $DOWNLOAD_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu*.tar.xz fi # Setup a link for the toolchain to use local to the building machine (e.g., not in a shared location) - ln -s $TOOLCHAIN_DIR/arm-gnu-toolchain-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i + ln -s $TOOLCHAIN_DIR/$BASENAME-$VER-$HOST_ARCH-$i-none-linux-gnu* $TOOLCHAIN_LINK_DIR/$i done diff --git a/meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf b/meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf index c5ef32331c..4e9cf82942 100644 --- a/meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf +++ b/meta-arm/meta-arm-bsp/conf/machine/musca-b1.conf @@ -20,4 +20,4 @@ QB_GRAPHICS = "-nographic -vga none" QB_MEM = "512k" QB_RNG = "" -TFM_PLATFORM = "arm/musca_b1/sse_200" +TFM_PLATFORM = "arm/musca_b1" diff --git a/meta-arm/meta-arm-bsp/documentation/corstone1000/change-log.rst b/meta-arm/meta-arm-bsp/documentation/corstone1000/change-log.rst index 7cdcd28d78..64e82aac98 100644 --- a/meta-arm/meta-arm-bsp/documentation/corstone1000/change-log.rst +++ b/meta-arm/meta-arm-bsp/documentation/corstone1000/change-log.rst @@ -11,7 +11,7 @@ This document contains a summary of the new features, changes and fixes in each release of Corstone-1000 software stack. ****************** -Version 2022.11.10 +Version 2022.11.23 ****************** Changes diff --git a/meta-arm/meta-arm-bsp/documentation/corstone1000/release-notes.rst b/meta-arm/meta-arm-bsp/documentation/corstone1000/release-notes.rst index f657c26bc2..89a4fa9ab2 100644 --- a/meta-arm/meta-arm-bsp/documentation/corstone1000/release-notes.rst +++ b/meta-arm/meta-arm-bsp/documentation/corstone1000/release-notes.rst @@ -7,8 +7,21 @@ Release notes ############# + +************************* +Disclaimer +************************* + +You expressly assume all liabilities and risks relating to your use or operation +of Your Software and Your Hardware designed or modified using the Arm Tools, +including without limitation, Your software or Your Hardware designed or +intended for safety-critical applications. Should Your Software or Your Hardware +prove defective, you assume the entire cost of all necessary servicing, repair +or correction. + + ************************** -Release notes - 2022.11.10 +Release notes - 2022.11.23 ************************** Known Issues or Limitations @@ -18,10 +31,13 @@ Known Issues or Limitations - Due to the performance uplimit of MPS3 FPGA and FVP, some Linux distros like Fedora Rawhide can not boot on Corstone-1000 (i.e. user may experience timeouts or boot hang). - Below SCT FAILURE is a known issues in the FVP: UEFI Compliant - Boot from network protocols must be implemented -- FAILURE + - Below SCT FAILURE is a known issue when a terminal emulator (in the system where the user connects to serial ports) does not support 80x25 or 80x50 mode: + EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetMode - SetMode() with valid mode -- FAILURE - Known limitations regarding ACS tests: The behavior after running ACS tests on FVP is not consistent. Both behaviors are expected and are valid; The system might boot till the Linux prompt. Or, the system might wait after finishing the ACS tests. In both cases, the system executes the entire test suite and writes the results as stated in the user guide. + Platform Support ----------------- - This software release is tested on Corstone-1000 FPGA version AN550_v1 @@ -152,7 +168,9 @@ Known Issues or Limitations Support ------- -For support email: support-subsystem-iot@arm.com +For technical support email: support-subsystem-iot@arm.com + +For all security issues, contact Arm by email at arm-security@arm.com. -------------- diff --git a/meta-arm/meta-arm-bsp/documentation/corstone1000/user-guide.rst b/meta-arm/meta-arm-bsp/documentation/corstone1000/user-guide.rst index a6350bb8b0..e173f244b4 100644 --- a/meta-arm/meta-arm-bsp/documentation/corstone1000/user-guide.rst +++ b/meta-arm/meta-arm-bsp/documentation/corstone1000/user-guide.rst @@ -18,9 +18,7 @@ for more information. Prerequisites ------------- -These instructions assume your host PC is running Ubuntu Linux 18.04 or 20.04 LTS, with -at least 32GB of free disk space and 16GB of RAM as minimum requirement. The -following instructions expect that you are using a bash shell. +These instructions assume your host PC is running Ubuntu Linux 18.04 or 20.04 LTS, with at least 32GB of free disk space and 16GB of RAM as minimum requirement. The following instructions expect that you are using a bash shell. All the paths stated in this document are absolute paths. The following prerequisites must be available on the host system. To resolve these dependencies, run: @@ -146,11 +144,13 @@ commands to build the stack. To install kas tool, run: pip3 install kas +If 'kas' command is not found in command-line, please make sure the user installation directories are visible on $PATH. If you have sudo rights, try 'sudo pip3 install kas'. + In the top directory of the workspace ``<_workspace>``, run: :: - git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2022.11.10 + git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2022.11.23 To build a Corstone-1000 image for MPS3 FPGA, run: @@ -215,9 +215,10 @@ The directory structure of the FPGA bundle is shown below. └── config.txt Depending upon the MPS3 board version (printed on the MPS3 board) you should update the images.txt file -(in corresponding HBI0309x folder) so that the file points to the images under SOFTWARE directory. +(in corresponding HBI0309x folder. Boardfiles/MB/HBI0309/AN550/images.txt) so that the file points to the images under SOFTWARE directory. -Here is an example +The images.txt file that is compatible with the latest version of the software +stack can be seen below; :: @@ -289,6 +290,9 @@ logs on the serial port terminals. Once the HOST(Cortex-A35) is booted completely, user can login to the shell using **"root"** login. +If system does not boot and only the ttyUSB1 logs are visible, please follow the steps in `Clean Secure Flash Before Testing (applicable to FPGA only)`_ under `SystemReady-IR tests`_ section. The previous image used in FPGA (MPS3) might have filled the Secure Flash completely. The best practice is to clean the secure flash in this case. + + Running the software on FVP --------------------------- @@ -299,8 +303,11 @@ A Yocto recipe is provided and allows to download the latest supported FVP versi The recipe is located at <_workspace>/meta-arm/meta-arm/recipes-devtools/fvp/fvp-corstone1000.bb -The latest supported Fixed Virtual Platform (FVP) version is 11.19_21 and is automatically downloaded -and installed when using the runfvp command as detailed below. +The latest supported Fixed Virtual Platform (FVP) version is 11.19_21 and is automatically downloaded and installed when using the runfvp command as detailed below. The FVP version can be checked by running the following command: + +:: + +<_workspace>/meta-arm/scripts/runfvp <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- --version The FVP can also be manually downloaded from the `Arm Ecosystem FVPs`_ page. On this page, navigate to "Corstone IoT FVPs" section to download the Corstone-1000 platform FVP installer. Follow the @@ -361,8 +368,8 @@ boot. Run following commands to build such image. :: cd <_workspace> - git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2022.11.10 - git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git + git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2022.11.23 + git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git -b CORSTONE1000-2022.11.23 cp -f systemready-patch/embedded-a/corstone1000/erase_flash/0001-arm-bsp-trusted-firmware-m-corstone1000-Clean-Secure.patch meta-arm cd meta-arm git apply 0001-arm-bsp-trusted-firmware-m-corstone1000-Clean-Secure.patch @@ -374,7 +381,8 @@ Replace the bl1.bin and cs1000.bin files on the SD card with following files: - The flash image: <_workspace>/build/tmp/deploy/images/corstone1000-mps3/corstone1000-image-corstone1000-mps3.wic.nopt Now reboot the board. This step erases the Corstone-1000 SecureEnclave flash -completely, the user should expect following message from TF-M log: +completely, the user should expect following message from TF-M log (can be seen +in ttyUSB1): :: @@ -388,7 +396,7 @@ software stack and flash the FPGA as normal. And continue the testing. Run SystemReady-IR ACS tests ============================= -ACS image contains two partitions. BOOT partition and RESULTS partition. +ACS image contains two partitions. BOOT partition and RESULT partition. Following packages are under BOOT partition * SCT @@ -398,8 +406,8 @@ Following packages are under BOOT partition * grub * uefi manual capsule application -RESULTS partition is used to store the test results. -PLEASE MAKE SURE THAT THE RESULTS PARTITION IS EMPTY BEFORE YOU START THE TESTING. OTHERWISE THE TEST RESULTS +RESULT partition is used to store the test results. +PLEASE MAKE SURE THAT THE RESULT PARTITION IS EMPTY BEFORE YOU START THE TESTING. OTHERWISE THE TEST RESULTS WILL NOT BE CONSISTENT FPGA instructions for ACS image @@ -441,6 +449,8 @@ Once the USB stick with ACS image is prepared, the user should make sure that ensure that only the USB stick with the ACS image is connected to the board, and then boot the board. +The FPGA will reset multiple times during the test, and it might take approx. 24-36 hours to finish the test. At the end of test, the FPGA host terminal will halt showing a shell prompt. Once test is finished the result can be copied following above instructions. + FVP instructions for ACS image and run ============================================ @@ -456,7 +466,7 @@ SD card. tmux - <_workspace>/meta-arm/scripts/runfvp <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf – -C board.msd_mmc.p_mmc_file="${/ir_acs_live_image.img}" + <_workspace>/meta-arm/scripts/runfvp <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file="${/ir_acs_live_image.img}" The test results can be fetched using following commands: @@ -488,7 +498,7 @@ automatically in the following sequence: - FWTS - BSA Linux -The results can be fetched from the ``acs_results`` partition of the USB stick (FPGA) / SD Card (FVP). +The results can be fetched from the ``acs_results`` folder in the RESULT partition of the USB stick (FPGA) / SD Card (FVP). ##################################################### @@ -757,11 +767,29 @@ In the Linux command-line run the following: Negative scenario ================= -In the negative case scenario, the user should see appropriate logs in -the secure enclave terminal. If capsule pass initial verification, but fails -verifications performed during boot time, secure enclave will try new images -predetermined number of times (defined in the code), before reverting back to -the previous good bank. +In the negative case scenario (rollback the capsule version), the user should +see appropriate logs in the secure enclave terminal. + +:: + + ... + uefi_capsule_retrieve_images: image 0 at 0xa0000070, size=15654928 + uefi_capsule_retrieve_images: exit + flash_full_capsule: enter: image = 0x0xa0000070, size = 15654928, version = 10 + ERROR: flash_full_capsule: version error + private_metadata_write: enter: boot_index = 1 + private_metadata_write: success + fmp_set_image_info:133 Enter + FMP image update: image id = 0 + FMP image update: status = 1version=11 last_attempt_version=10. + fmp_set_image_info:157 Exit. + corstone1000_fwu_flash_image: exit: ret = -1 + ... + + +If capsule pass initial verification, but fails verifications performed during +boot time, secure enclave will try new images predetermined number of times +(defined in the code), before reverting back to the previous good bank. :: @@ -803,7 +831,7 @@ Linux distros tests Debian/OpenSUSE install and boot (applicable to FPGA only) *************************************************************************************** -To test Linux distro install and boot, the user should prepare two empty USB sticks. +To test Linux distro install and boot, the user should prepare two empty USB sticks (minimum size should be 4GB and formatted with FAT32). Download one of following Linux distro images: - Debian installer image: https://cdimage.debian.org/cdimage/weekly-builds/arm64/iso-dvd/ @@ -819,7 +847,7 @@ file into the first USB stick, run: :: - sudo dd if= of=/dev/sdb iflag=direct oflag=direct status=progress bs=1M; sync; + sudo dd if= of=/dev/sdb iflag=direct oflag=direct status=progress bs=1M; sync; Boot the MSP3 board with the first USB stick connected. Open following minicom sessions: @@ -828,9 +856,7 @@ Boot the MSP3 board with the first USB stick connected. Open following minicom s sudo picocom -b 115200 /dev/ttyUSB0 # in one terminal sudo picocom -b 115200 /dev/ttyUSB2 # in another terminal. -Press . - -Now plug in the second USB stick, the distro installation process will start. +Now plug in the second USB stick (once installation screen is visible), the distro installation process will start. The installation prompt can be seen in ttyUSB2. If installer does not start, please try to reboot the board with both USB sticks connected and repeat the process. **NOTE:** Due to the performance limitation of Corstone-1000 MPS3 FPGA, the distro installation process can take up to 24 hours to complete. @@ -922,7 +948,7 @@ First, load FF-A TEE kernel module: :: - insmod /lib/modules/5.19.9-yocto-standard/extra/arm-ffa-tee.ko + insmod /lib/modules/5.19.14-yocto-standard/extra/arm-ffa-tee.ko Then, check whether the FF-A TEE driver is loaded correctly by using the following command: @@ -1034,7 +1060,7 @@ The output on the Host terminal should be: Tests results ----------------------------------- -As a reference for the end user, reports for various tests for `Corstone-1000 software (CORSTONE1000-2022.11.10) `__ +As a reference for the end user, reports for various tests for `Corstone-1000 software (CORSTONE1000-2022.11.23) `__ can be found in `here `__. Running the software on FVP on Windows diff --git a/meta-arm/meta-arm-bsp/documentation/fvp-base-arm32.md b/meta-arm/meta-arm-bsp/documentation/fvp-base-arm32.md index 54408b0d86..141e61f3ab 100644 --- a/meta-arm/meta-arm-bsp/documentation/fvp-base-arm32.md +++ b/meta-arm/meta-arm-bsp/documentation/fvp-base-arm32.md @@ -1,55 +1,24 @@ -# Armv7-A Base Platform FVP Support in meta-arm-bsp +# Armv8-A Base Platform FVP (32-bit) Support in meta-arm-bsp -## How to build and run +## Howto Build and Run ### Configuration: -In the local.conf file, MACHINE should be set as follows: -MACHINE ?= "fvp-base-arm32" +In the local.conf file, `MACHINE` should be set: +``` +MACHINE = "fvp-base-arm32" +``` ### Build: -```bash$ bitbake core-image-minimal``` +``` +$ bitbake core-image-base +``` ### Run: -To Run the Fixed Virtual Platform simulation tool you must download "Armv8-A -Base Platform FVP" from Arm developer (This might require the user to -register) from this address: -https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms -and install it on your host PC. - -Fast Models Fixed Virtual Platforms (FVP) Reference Guide: -https://developer.arm.com/docs/100966/latest - -Armv8‑A Foundation Platform User Guide: -https://developer.arm.com/docs/100961/latest/ +The `fvp-base` machine has support for the `runfvp` script, so running is simple: - -Once done, do the following to build and run an image: -```bash$ bitbake core-image-minimal``` -```bash$ export YOCTO_DEPLOY_IMGS_DIR=""``` -```bash$ cd ``` ``` -bash$ ./FVP_Base_RevC-2xAEMv8A -C bp.virtio_net.enabled=1 \ - -C cache_state_modelled=0 \ - -C bp.secureflashloader.fname=${YOCTO_DEPLOY_IMGS_DIR}/bl1-fvp.bin \ - -C bp.flashloader0.fname=${YOCTO_DEPLOY_IMGS_DIR}/fip-fvp.bin \ - --data cluster0.cpu0=${YOCTO_DEPLOY_IMGS_DIR}/Image@0x80080000 \ - -C bp.virtioblockdevice.image_path=${YOCTO_DEPLOY_IMGS_DIR}/core-image-minimal-fvp-base-arm32.wic \ - -C cluster0.cpu0.CONFIG64=0 \ - -C cluster0.cpu1.CONFIG64=0 \ - -C cluster0.cpu2.CONFIG64=0 \ - -C cluster0.cpu3.CONFIG64=0 \ - -C cluster1.cpu0.CONFIG64=0 \ - -C cluster1.cpu1.CONFIG64=0 \ - -C cluster1.cpu2.CONFIG64=0 \ - -C cluster1.cpu3.CONFIG64=0 \ - +$ runfvp tmp/deploy/images/fvp-base-arm32/core-image-base-fvp-base-arm32.fvpconf ``` - - -If you have built a configuration without a ramdisk, you can use the following -command in U-boot to start Linux: -```fvp32# bootz 0x80080000 - 0x82000000``` - ## Devices supported in the kernel - serial - virtio disk diff --git a/meta-arm/meta-arm-bsp/documentation/fvp-base.md b/meta-arm/meta-arm-bsp/documentation/fvp-base.md index b0026de488..7eda8d34fa 100644 --- a/meta-arm/meta-arm-bsp/documentation/fvp-base.md +++ b/meta-arm/meta-arm-bsp/documentation/fvp-base.md @@ -3,45 +3,22 @@ ## Howto Build and Run ### Configuration: -In the local.conf file, MACHINE should be set as follow: -MACHINE ?= "fvp-base" +In the local.conf file, `MACHINE` should be set: +``` +MACHINE = "fvp-base" +``` ### Build: -```bash$ bitbake core-image-minimal``` +``` +$ bitbake core-image-base +``` ### Run: -To Run the Fixed Virtual Platform simulation tool you must download "Armv8-A -Base Platform FVP" from Arm developer (This might require the user to -register) from this address: -https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms -and install it on your host PC. - -Fast Models Fixed Virtual Platforms (FVP) Reference Guide: -https://developer.arm.com/docs/100966/latest +The `fvp-base` machine has support for the `runfvp` script, so running is simple: -Armv8‑A Foundation Platform User Guide: -https://developer.arm.com/docs/100961/latest/ - - -Once done, do the following to build and run an image: -```bash$ bitbake core-image-minimal``` -```bash$ export YOCTO_DEPLOY_IMGS_DIR=""``` -```bash$ cd ``` ``` -bash$ ./FVP_Base_RevC-2xAEMv8A -C bp.virtio_net.enabled=1 \ - -C cache_state_modelled=0 \ - -C bp.secureflashloader.fname=${YOCTO_DEPLOY_IMGS_DIR}/bl1-fvp.bin \ - -C bp.flashloader0.fname=${YOCTO_DEPLOY_IMGS_DIR}/fip-fvp.bin \ - --data cluster0.cpu0=${YOCTO_DEPLOY_IMGS_DIR}/Image@0x80080000 \ - --data cluster0.cpu0=${YOCTO_DEPLOY_IMGS_DIR}/fvp-base-gicv3-psci-custom.dtb@0x83000000 \ - -C bp.virtioblockdevice.image_path=${YOCTO_DEPLOY_IMGS_DIR}/core-image-minimal-fvp-base.wic +$ runfvp tmp/deploy/images/fvp-base/core-image-base-fvp-base.fvpconf ``` - - -If you have built a configuration without a ramdisk, you can use the following -command in U-boot to start Linux: -```VExpress64# booti 0x80080000 - 0x83000000``` - ## Devices supported in the kernel - serial - virtio disk diff --git a/meta-arm/meta-arm-bsp/documentation/fvp-baser-aemv8r64.md b/meta-arm/meta-arm-bsp/documentation/fvp-baser-aemv8r64.md index 9127a6ce72..e29aad34d6 100644 --- a/meta-arm/meta-arm-bsp/documentation/fvp-baser-aemv8r64.md +++ b/meta-arm/meta-arm-bsp/documentation/fvp-baser-aemv8r64.md @@ -27,9 +27,9 @@ The fvp-baser-aemv8r64 Yocto MACHINE supports the following BSP components, where either a standard or Real-Time Linux kernel (PREEMPT\_RT) can be built and run: - - FVP_Base_AEMv8R: v11.19.14 + - FVP_Base_AEMv8R: v11.20.15 - boot-wrapper-aarch64: provides PSCI support - - U-Boot: v2022.04 - provides UEFI services + - U-Boot: v2022.07 - provides UEFI services - Linux kernel: linux-yocto-5.15 - Linux kernel with PREEMPT\_RT support: linux-yocto-rt-5.15 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0001-corstone1000-platform-secure-test-framework.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0001-corstone1000-platform-secure-test-framework.patch deleted file mode 100644 index 8f63319149..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0001-corstone1000-platform-secure-test-framework.patch +++ /dev/null @@ -1,359 +0,0 @@ -From 6ab17eeb8225cdf4afc6956c9a2774d60866c36d Mon Sep 17 00:00:00 2001 -From: Satish Kumar -Date: Mon, 28 Mar 2022 05:16:50 +0100 -Subject: [PATCH 1/6] corstone1000: platform secure test framework - -Change-Id: Ib781927f0add93ec9c06515d251e79518ee1db6e -Signed-off-by: Satish Kumar -Upstream-Status: Accepted [TF-Mv1.7.0] ---- - .../arm/corstone1000/Native_Driver/firewall.c | 15 ++ - .../arm/corstone1000/Native_Driver/firewall.h | 5 + - .../ci_regression_tests/CMakeLists.txt | 45 +++++ - .../corstone1000/ci_regression_tests/s_test.c | 186 ++++++++++++++++++ - .../corstone1000/ci_regression_tests/s_test.h | 30 +++ - .../ci_regression_tests/s_test_config.cmake | 8 + - 6 files changed, 289 insertions(+) - create mode 100644 platform/ext/target/arm/corstone1000/ci_regression_tests/CMakeLists.txt - create mode 100644 platform/ext/target/arm/corstone1000/ci_regression_tests/s_test.c - create mode 100644 platform/ext/target/arm/corstone1000/ci_regression_tests/s_test.h - create mode 100644 platform/ext/target/arm/corstone1000/ci_regression_tests/s_test_config.cmake - -diff --git a/platform/ext/target/arm/corstone1000/Native_Driver/firewall.c b/platform/ext/target/arm/corstone1000/Native_Driver/firewall.c -index 788cc3ec92..356b85e9d5 100755 ---- a/platform/ext/target/arm/corstone1000/Native_Driver/firewall.c -+++ b/platform/ext/target/arm/corstone1000/Native_Driver/firewall.c -@@ -293,6 +293,21 @@ void fc_enable_mpl(enum rgn_mpe_t mpe, enum rgn_mpl_t mpl) - ptr->rgn_mpl3 |= (mpl & RGN_MPL_EN_MASK); - } - -+void fc_read_mpl(enum rgn_mpe_t mpe, enum rgn_mpl_t* mpl) -+{ -+ struct _firewall_pe_rwe_reg_map_t *ptr = -+ (struct _firewall_pe_rwe_reg_map_t *)fw_data.rwe_ptr; -+ if (mpe == RGN_MPE0) -+ *mpl = (ptr->rgn_mpl0 & RGN_MPL_EN_MASK); -+ else if (mpe == RGN_MPE1) -+ *mpl = (ptr->rgn_mpl1 & RGN_MPL_EN_MASK); -+ else if (mpe == RGN_MPE2) -+ *mpl = (ptr->rgn_mpl2 & RGN_MPL_EN_MASK); -+ else if (mpe == RGN_MPE3) -+ *mpl = (ptr->rgn_mpl3 & RGN_MPL_EN_MASK); -+} -+ -+ - void fc_disable_mpl(enum rgn_mpe_t mpe, enum rgn_mpl_t mpl) - { - struct _firewall_pe_rwe_reg_map_t *ptr = -diff --git a/platform/ext/target/arm/corstone1000/Native_Driver/firewall.h b/platform/ext/target/arm/corstone1000/Native_Driver/firewall.h -index 48c86725ef..17afe6a92f 100755 ---- a/platform/ext/target/arm/corstone1000/Native_Driver/firewall.h -+++ b/platform/ext/target/arm/corstone1000/Native_Driver/firewall.h -@@ -247,6 +247,11 @@ void fc_init_mpl(enum rgn_mpe_t mpe); - */ - void fc_enable_mpl(enum rgn_mpe_t mpe, enum rgn_mpl_t mpl); - -+/** -+ * \brief Reads Master Permission List in the selected Firewall Component -+ */ -+void fc_read_mpl(enum rgn_mpe_t mpe, enum rgn_mpl_t* mpl); -+ - /** - * \brief Disables Master Permission List in the selected Firewall Component - */ -diff --git a/platform/ext/target/arm/corstone1000/ci_regression_tests/CMakeLists.txt b/platform/ext/target/arm/corstone1000/ci_regression_tests/CMakeLists.txt -new file mode 100644 -index 0000000000..70e1c20e4e ---- /dev/null -+++ b/platform/ext/target/arm/corstone1000/ci_regression_tests/CMakeLists.txt -@@ -0,0 +1,45 @@ -+#------------------------------------------------------------------------------- -+# Copyright (c) 2021-22, Arm Limited. All rights reserved. -+# -+# SPDX-License-Identifier: BSD-3-Clause -+# -+#------------------------------------------------------------------------------- -+ -+cmake_policy(SET CMP0079 NEW) -+ -+include(${CMAKE_CURRENT_SOURCE_DIR}/s_test_config.cmake) -+ -+####################### Secure ################################################# -+ -+add_library(corstone1000_test_s STATIC EXCLUDE_FROM_ALL) -+ -+target_sources(corstone1000_test_s -+ PRIVATE -+ ${CMAKE_CURRENT_SOURCE_DIR}/s_test.c -+ ../Native_Driver/firewall.c -+) -+ -+target_include_directories(corstone1000_test_s -+ PRIVATE -+ ${CMAKE_CURRENT_SOURCE_DIR} -+ ../Device/Include -+ ../Native_Driver -+) -+ -+# Example test links tfm_test_suite_extra_common to use related interface -+target_link_libraries(corstone1000_test_s -+ PRIVATE -+ tfm_test_suite_extra_common -+ tfm_log -+) -+ -+target_compile_definitions(corstone1000_test_s -+ PRIVATE -+ $<$:PLATFORM_IS_FVP> -+) -+ -+# The corstone1000_test_s library is linked by tfm_test_suite_extra_s -+target_link_libraries(tfm_test_suite_extra_s -+ PRIVATE -+ corstone1000_test_s -+) -diff --git a/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test.c b/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test.c -new file mode 100644 -index 0000000000..963f46d2ab ---- /dev/null -+++ b/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test.c -@@ -0,0 +1,186 @@ -+/* -+ * Copyright (c) 2021-22, Arm Limited. All rights reserved. -+ * -+ * SPDX-License-Identifier: BSD-3-Clause -+ * -+ */ -+ -+#include "s_test.h" -+#include "platform_base_address.h" -+#include "firewall.h" -+#include "tfm_log_raw.h" -+ -+#define DISABLED_TEST 0 -+ -+enum host_firewall_host_comp_id_t { -+ HOST_FCTRL = (0x00u), -+ COMP_SYSPERIPH, -+ COMP_DBGPERIPH, -+ COMP_AONPERIPH, -+ COMP_XNVM, -+ COMP_CVM, -+ COMP_HOSTCPU, -+ COMP_EXTSYS0, -+ COMP_EXTSYS1, -+ COMP_EXPSLV0, -+ COMP_EXPSLV1, -+ COMP_EXPMST0, -+ COMP_EXPMST1, -+ COMP_OCVM, -+ COMP_DEBUG, -+}; -+ -+const struct extra_tests_t plat_s_t = { -+ .test_entry = s_test, -+ .expected_ret = EXTRA_TEST_SUCCESS -+}; -+ -+static int test_host_firewall_status(void) -+{ -+ enum fw_lockdown_status_t status; -+ uint32_t any_component_id = 2; -+ -+ fc_select((void *)CORSTONE1000_HOST_FIREWALL_BASE, any_component_id); -+ status = fw_get_lockdown_status(); -+ if (status != FW_LOCKED) { -+ tfm_log_printf("FAIL: %s.\n\r", __func__); -+ return EXTRA_TEST_FAILED; -+ } -+ -+ tfm_log_printf("PASS: %s\n\r", __func__); -+ return EXTRA_TEST_SUCCESS; -+} -+ -+static int test_host_firewall_external_flash_configurations(void) -+{ -+ enum rgn_mpl_t mpl_rights = 0; -+ enum rgn_mpl_t expected_rights = 0; -+ -+#if !(PLATFORM_IS_FVP) -+ /* External flash */ -+ fc_select((void *)CORSTONE1000_HOST_FIREWALL_BASE, COMP_EXPMST0); -+ fc_select_region(3); -+ fc_read_mpl(RGN_MPE0, &mpl_rights); -+ expected_rights = (RGN_MPL_ANY_MST_MASK | RGN_MPL_SECURE_READ_MASK | -+ RGN_MPL_SECURE_WRITE_MASK); -+ if (mpl_rights != expected_rights) { -+ tfm_log_printf("FAIL1: %s.\n\r", __func__); -+ return EXTRA_TEST_FAILED; -+ } -+ /* XIP Permissions */ -+ fc_select((void *)CORSTONE1000_HOST_FIREWALL_BASE, COMP_XNVM); -+ fc_select_region(1); -+ fc_read_mpl(RGN_MPE0, &mpl_rights); -+ expected_rights = (RGN_MPL_ANY_MST_MASK | -+ RGN_MPL_SECURE_READ_MASK | -+ RGN_MPL_NONSECURE_READ_MASK); -+ if (mpl_rights != expected_rights) { -+ tfm_log_printf("FAIL2: %s.\n\r", __func__); -+ return EXTRA_TEST_FAILED; -+ } -+#else -+ /* Enable the below test when FVP Host Firewall is configured. */ -+ /* -+ fc_select((void *)CORSTONE1000_HOST_FIREWALL_BASE, COMP_XNVM); -+ fc_select_region(1); -+ fc_read_mpl(RGN_MPE0, &mpl_rights); -+ tfm_log_printf("mpl rights = %d\n\r", mpl_rights); -+ expected_rights = (RGN_MPL_ANY_MST_MASK | -+ RGN_MPL_SECURE_READ_MASK | -+ RGN_MPL_SECURE_WRITE_MASK | -+ RGN_MPL_NONSECURE_READ_MASK | -+ RGN_MPL_NONSECURE_WRITE_MASK); -+ if (mpl_rights != expected_rights) { -+ tfm_log_printf("FAIL1: %s.\n\r", __func__); -+ return EXTRA_TEST_FAILED; -+ } -+ */ -+#endif -+ -+ tfm_log_printf("PASS: %s\n\r", __func__); -+ return EXTRA_TEST_SUCCESS; -+} -+ -+static int test_host_firewall_secure_flash_configurations(void) -+{ -+ enum rgn_mpl_t mpl_rights = 0; -+ enum rgn_mpl_t expected_rights = 0; -+ -+#if !(PLATFORM_IS_FVP) -+ /* External flash */ -+ fc_select((void *)CORSTONE1000_HOST_FIREWALL_BASE, COMP_EXPMST1); -+ fc_select_region(1); -+ fc_read_mpl(RGN_MPE0, &mpl_rights); -+ expected_rights = (RGN_MPL_ANY_MST_MASK | RGN_MPL_SECURE_READ_MASK | -+ RGN_MPL_SECURE_WRITE_MASK); -+ if (mpl_rights != expected_rights) { -+ tfm_log_printf("FAIL: %s.\n\r", __func__); -+ return EXTRA_TEST_FAILED; -+ } -+#endif -+ -+ tfm_log_printf("PASS: %s\n\r", __func__); -+ return EXTRA_TEST_SUCCESS; -+} -+ -+static int test_bir_programming(void) -+{ -+ /* BIR is expected to bhaive like write once register */ -+ -+ volatile uint32_t *bir_base = (uint32_t *)CORSTONE1000_HOST_BIR_BASE; -+ -+ bir_base[0] = 0x1; -+ bir_base[0] = 0x2; -+ if (bir_base[0] != 0x1) { -+ tfm_log_printf("FAIL: %s : (%u)\n\r", __func__, bir_base[0]); -+ return EXTRA_TEST_FAILED; -+ } -+ -+ tfm_log_printf("PASS: %s\n\r", __func__); -+ return EXTRA_TEST_SUCCESS; -+} -+ -+int32_t s_test(void) -+{ -+ int status; -+ int failures = 0; -+ -+#if (DISABLED_TEST == 1) -+ status = test_host_firewall_status(); -+ if (status) { -+ failures++; -+ } -+#endif -+ -+ status = test_host_firewall_secure_flash_configurations(); -+ if (status) { -+ failures++; -+ } -+ -+ status = test_host_firewall_external_flash_configurations(); -+ if (status) { -+ failures++; -+ } -+ -+#if (DISABLED_TEST == 1) -+ status = test_bir_programming(); -+ if (status) { -+ failures++; -+ } -+#endif -+ -+ if (failures) { -+ tfm_log_printf("Not all platform test could pass: failures=%d\n\r", failures); -+ return EXTRA_TEST_FAILED; -+ } -+ -+ tfm_log_printf("ALL_PASS: corstone1000 platform test cases passed.\n\r"); -+ return EXTRA_TEST_SUCCESS; -+} -+ -+int32_t extra_tests_init(struct extra_tests_t *internal_test_t) -+{ -+ /* Add platform init code here. */ -+ -+ return register_extra_tests(internal_test_t, &plat_s_t); -+} -diff --git a/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test.h b/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test.h -new file mode 100644 -index 0000000000..8aff4d679c ---- /dev/null -+++ b/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test.h -@@ -0,0 +1,30 @@ -+/* -+ * Copyright (c) 2021-22, Arm Limited. All rights reserved. -+ * -+ * SPDX-License-Identifier: BSD-3-Clause -+ * -+ */ -+ -+#ifndef __S_TESTS_H__ -+#define __S_TESTS_H__ -+ -+#include "extra_tests_common.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+const struct extra_tests_t plat_s_t; -+ -+/** -+ * \brief Platform specific secure test function. -+ * -+ * \returns Returns error code as specified in \ref int32_t -+ */ -+int32_t s_test(void); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* __S_TESTS_H__ */ -diff --git a/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test_config.cmake b/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test_config.cmake -new file mode 100644 -index 0000000000..bb8d26bf1c ---- /dev/null -+++ b/platform/ext/target/arm/corstone1000/ci_regression_tests/s_test_config.cmake -@@ -0,0 +1,8 @@ -+#------------------------------------------------------------------------------- -+# Copyright (c) 2021-22, Arm Limited. All rights reserved. -+# -+# SPDX-License-Identifier: BSD-3-Clause -+# -+#------------------------------------------------------------------------------- -+ -+############ Define secure test specific cmake configurations here ############# --- -2.25.1 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0002-corstone1000-make-external-system-support-optional.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0002-corstone1000-make-external-system-support-optional.patch deleted file mode 100644 index c6bacb49f9..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0002-corstone1000-make-external-system-support-optional.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 6fd49ab55c3419429e437845864c5bb2d731da29 Mon Sep 17 00:00:00 2001 -From: Satish Kumar -Date: Mon, 25 Apr 2022 05:26:38 +0100 -Subject: [PATCH 2/6] corstone1000: make external system support optional - -The commits introduce build time variables to make -external system support in the platform optional. - -Change-Id: I593014e0da4ac553c105c66ae55f6fd83ffe427e -Signed-off-by: Satish Kumar -Upstream-Status: Accepted [TF-Mv1.7.0] ---- - .../ext/target/arm/corstone1000/CMakeLists.txt | 1 + - platform/ext/target/arm/corstone1000/config.cmake | 1 + - .../target/arm/corstone1000/tfm_hal_multi_core.c | 15 +++++++++++++++ - 3 files changed, 17 insertions(+) - -diff --git a/platform/ext/target/arm/corstone1000/CMakeLists.txt b/platform/ext/target/arm/corstone1000/CMakeLists.txt -index 16bc708964..39d7b03455 100644 ---- a/platform/ext/target/arm/corstone1000/CMakeLists.txt -+++ b/platform/ext/target/arm/corstone1000/CMakeLists.txt -@@ -97,6 +97,7 @@ target_compile_definitions(platform_s - PRIVATE - $<$:PLATFORM_IS_FVP> - $<$:TEST_S> -+ $<$:EXTERNAL_SYSTEM_SUPPORT> - ) - - #========================= Platform BL2 =======================================# -diff --git a/platform/ext/target/arm/corstone1000/config.cmake b/platform/ext/target/arm/corstone1000/config.cmake -index e5f91108ee..a3399db318 100644 ---- a/platform/ext/target/arm/corstone1000/config.cmake -+++ b/platform/ext/target/arm/corstone1000/config.cmake -@@ -21,6 +21,7 @@ set(CRYPTO_HW_ACCELERATOR ON CACHE BOOL "Whether to en - set(CRYPTO_NV_SEED OFF CACHE BOOL "Use stored NV seed to provide entropy") - set(TFM_CRYPTO_TEST_ALG_CFB OFF CACHE BOOL "Test CFB cryptography mode") - set(NS FALSE CACHE BOOL "Whether to build NS app") -+set(EXTERNAL_SYSTEM_SUPPORT OFF CACHE BOOL "Whether to include external system support.") - - # FVP is not integrated/tested with CC312. - if (${PLATFORM_IS_FVP}) -diff --git a/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c b/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c -index 8e1b455086..8622844d91 100644 ---- a/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c -+++ b/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c -@@ -16,6 +16,16 @@ - #define HOST_CPU_PE0_CONFIG_OFFSET 0x010 - #define AA64nAA32_MASK (1 << 3) - -+#ifdef EXTERNAL_SYSTEM_SUPPORT -+void tfm_external_system_boot() -+{ -+ volatile uint32_t *ext_sys_reset_ctl_reg = (uint32_t *)(CORSTONE1000_EXT_SYS_RESET_REG); -+ -+ /* de-assert CPU_WAIT signal*/ -+ *ext_sys_reset_ctl_reg = 0x0; -+} -+#endif -+ - void tfm_hal_boot_ns_cpu(uintptr_t start_addr) - { - /* Switch the shared flash to XiP mode for the host */ -@@ -53,6 +63,11 @@ void tfm_hal_boot_ns_cpu(uintptr_t start_addr) - *reset_ctl_reg = 0; - - (void) start_addr; -+ -+#ifdef EXTERNAL_SYSTEM_SUPPORT -+ /*release EXT SYS out of reset*/ -+ tfm_external_system_boot(); -+#endif - } - - void tfm_hal_wait_for_ns_cpu_ready(void) --- -2.25.1 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0003-corstone1000-enable-secure-enclave-run-without-host-.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0003-corstone1000-enable-secure-enclave-run-without-host-.patch deleted file mode 100644 index 6422952264..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0003-corstone1000-enable-secure-enclave-run-without-host-.patch +++ /dev/null @@ -1,298 +0,0 @@ -From 2e56f2601249243f2fb3ba67caf9febe4bfc8371 Mon Sep 17 00:00:00 2001 -From: Satish Kumar -Date: Tue, 26 Apr 2022 20:17:13 +0100 -Subject: [PATCH 3/6] corstone1000: enable secure enclave run without host - binaries - -In TEST_S configuration, the build disables part of the code which -assumes that the host binaries are present in the flash. This change -will allow secure enclave's part of the platforms software to build -and run without the host support. The configuration can be used to run -CI and test secure enclave software independently. - -Change-Id: I29325750a3bea270fe5b3b8b47932a7071a59482 -Signed-off-by: Satish Kumar -Upstream-Status: Accepted [TF-Mv1.7.0] ---- - .../ext/target/arm/corstone1000/readme.rst | 88 +++++++++++++++---- - .../target/arm/corstone1000/CMakeLists.txt | 8 +- - .../arm/corstone1000/bl1/CMakeLists.txt | 2 +- - .../target/arm/corstone1000/bl2_flash_map.c | 2 + - .../target/arm/corstone1000/boot_hal_bl2.c | 2 + - .../ext/target/arm/corstone1000/config.cmake | 11 ++- - .../arm/corstone1000/partition/flash_layout.h | 2 +- - .../arm/corstone1000/tfm_hal_multi_core.c | 2 + - 8 files changed, 94 insertions(+), 23 deletions(-) - -diff --git a/docs/platform/ext/target/arm/corstone1000/readme.rst b/docs/platform/ext/target/arm/corstone1000/readme.rst -index 94b58ac6fc..10c9c58f78 100644 ---- a/docs/platform/ext/target/arm/corstone1000/readme.rst -+++ b/docs/platform/ext/target/arm/corstone1000/readme.rst -@@ -7,22 +7,27 @@ Introduction - ************ - - The ARM's Corstone-1000 platform is a reference implementation of PSA FF-M --architecture where NSPE and SPE environments are partitioned into -+architecture where NSPE and SPE environments are partitioned/isolated into - Cortex-A35 and Cortex-M0+ respectively. - - Cortex-M0+ acting as Secure Enclave is the Root-of-trust of SoC. Its --software comprises of two boot loading stages, i.e. Bl1 and Bl2, based on --mcuboot, and TF-M as run time software. Cortex-A35, also referred as host, --is completely treated as non-secure from the Secure Enclave perspective. -+software comprises of two boot loading stages, i.e. Bl1 and Bl2 (based on -+mcuboot) and TF-M as run time software. Cortex-A35, also referred as host, -+is treated as non-secure from the Secure Enclave perspective. - The Cortex-A35 is brought out of rest by Secure Enclave in aarch64 bit mode, - and boots the software ecosystem based on linux, u-boot, UEFI run time --services, TF-A and Optee. -+services, TF-A, Secure Partitions and Optee. - - The communication between NSPE and SPE is based on PSA IPC protocol running on --top of OpenAMP. -+top of FF-A/OpenAMP. - - The secure enclave subsystem has ARM's CC-312 (Crypto Cell) hardware to --accelerate cryptographic operations. -+accelerate cryptographic operations. Additionaly, platform supports Secure Debug -+using SDC-600 as the communication interface between host debugger and platform -+target. The platform has the build option to enable secure debug protocol to -+unlock debug ports during boot time. The protocol is based on ARM's ADAC -+(Authenticated Debug Access Control) standard. -+ - - *********** - System boot -@@ -33,23 +38,76 @@ System boot - - BL1 load, verifies and transfer execution to BL2 which is again based on mcuboot. - - BL2 loads and verifies TF-M and host's initial boot loader image. - - BL2 transfer the execution to the TF-M. --- During TF-M initialization, the host is reset. -+- During TF-M initialization, the host is taken out of rest. -+- Hashes of the keys used for image verification are stored in the OTP memory. - - ***** - Build - ***** - --.. code-block:: -+Platform solution -+================= -+ -+The platform binaries are build using Yocto. Below is the user guide: -+ -+`Arm Corstone-1000 User Guide`_ -+ -+Secure Test -+=========== -+ -+This section can be used to test the secure enclave software indedendently from -+the host. The below configuration builds the secure enclave binaries with CI test -+frame integrated. On boot, secure enclave softwares stack is brought up, and -+CI tests starts executing at the end of the initialization process. In the -+below configuration, host software support is disabled, and meant only -+to test/verify the secure enclave softwares. -+ -+FVP -+--- - -- cmake -B build/ -S / -DCMAKE_BUILD_TYPE=Debug -DTFM_TOOLCHAIN_FILE=/toolchain_GNUARM.cmake -DTFM_PLATFORM=arm/corstone1000 -+- Download Corstone-1000 FVP from : `Arm Ecosystem FVPs`_ -+- Install FVP by running the shell script. -+- Running of the binary will boot secure enclave software stack and at the end all CI test -+ from tf-m-test along with platform specific tests are executed. -+ -+.. code-block:: bash -+ -+ cmake -B build/ -S / -DCMAKE_BUILD_TYPE=Debug -DTFM_TOOLCHAIN_FILE=/toolchain_GNUARM.cmake -DTFM_PLATFORM=arm/corstone1000 -DPLATFORM_IS_FVP=TRUE -DTEST_NS=OFF -DTEST_S=ON -DEXTRA_S_TEST_SUITES_PATHS=/trusted-firmware-m/platform/ext/target/arm/corstone1000/ci_regression_tests/ - cmake --build build -- install -+ cd ./build/install/outputs/ -+ cat bl2_signed.bin bl2_signed.bin tfm_s_signed.bin > cs1000.bin -+ cd /models/Linux64_GCC-9.3/ -+ ./FVP_Corstone-1000 -C board.flashloader0.fname="none" -C se.trustedBootROMloader.fname=".//install/outputs/bl1.bin" -C board.xnvm_size=64 -C se.trustedSRAM_config=6 -C se.BootROM_config="3" -C board.smsc_91c111.enabled=0 -C board.hostbridge.userNetworking=true --data board.flash0=.//install/outputs/cs1000.bin@0x68100000 -C diagnostics=4 -C disable_visualisation=true -C board.se_flash_size=8192 -C diagnostics=4 -C disable_visualisation=true -+ -+FPGA -+---- - --The binaries will be installed inside: -+- Follow the above pointed platform user guide to setup the FPGA board. -+- Use the BL1 generated from the below commands to place it inside FPGA board SD Card. -+- Use the cs1000.bin created from the below commands to place it inside FPGA board SD Card. -+ -+.. code-block:: bash -+ -+ cmake -B build/ -S / -DCMAKE_BUILD_TYPE=Debug -DTFM_TOOLCHAIN_FILE=/toolchain_GNUARM.cmake -DTFM_PLATFORM=arm/corstone1000 -DTEST_NS=OFF -DTEST_S=ON -DEXTRA_S_TEST_SUITES_PATHS=/trusted-firmware-m/platform/ext/target/arm/corstone1000/ci_regression_tests/ -DTEST_S_PS=OFF -DTEST_S_PLATFORM=OFF -+ cmake --build build -- install -+ cd ./build/install/outputs/ -+ cat bl2_signed.bin bl2_signed.bin tfm_s_signed.bin > cs1000.bin -+ cp bl1.bin /SOFTWARE/ -+ cp cs1000.bin /SOFTWARE/ - --.. code-block:: -+FPGA build can not compile all the CI tests into a single build as it exceeds -+the available RAM size. So there is a need to select few tests but not all. -+The above configuration disable build of -DTEST_S_PS and -DTEST_S_PLATFORM. -+Other test configurations are: - -- ./build/install/outputs/ARM/CORSTONE1000 -+- -DTEST_S_ATTESTATION=ON/OFF -+- -DTEST_S_AUDIT=ON/OFF -+- -DTEST_S_CRYPTO=ON/OFF -+- -DTEST_S_ITS=ON/OFF -+- -DTEST_S_PS=ON/OFF -+- -DTEST_S_PLATFORM=ON/OFF - ---------------- -+*Copyright (c) 2021-2022, Arm Limited. All rights reserved.* - --*Copyright (c) 2021, Arm Limited. All rights reserved.* -+.. _Arm Ecosystem FVPs: https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps -+.. _Arm Corstone-1000 User Guide: https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-docs/-/blob/CORSTONE1000-2022.04.19/docs/embedded-a/corstone1000/user-guide.rst -diff --git a/platform/ext/target/arm/corstone1000/CMakeLists.txt b/platform/ext/target/arm/corstone1000/CMakeLists.txt -index 39d7b03455..81522c7cf0 100644 ---- a/platform/ext/target/arm/corstone1000/CMakeLists.txt -+++ b/platform/ext/target/arm/corstone1000/CMakeLists.txt -@@ -18,7 +18,7 @@ target_include_directories(platform_region_defs - - target_compile_definitions(platform_region_defs - INTERFACE -- $<$:TEST_S> -+ $<$:TFM_S_REG_TEST> - ) - #========================= Platform common defs ===============================# - -@@ -75,7 +75,7 @@ target_sources(platform_s - $<$:${CMAKE_CURRENT_SOURCE_DIR}/services/src/tfm_platform_system.c> - fw_update_agent/uefi_capsule_parser.c - fw_update_agent/fwu_agent.c -- $<$:${CMAKE_CURRENT_SOURCE_DIR}/target_cfg.c> -+ $<$:${CMAKE_CURRENT_SOURCE_DIR}/target_cfg.c> - ) - - if (PLATFORM_IS_FVP) -@@ -96,7 +96,7 @@ endif() - target_compile_definitions(platform_s - PRIVATE - $<$:PLATFORM_IS_FVP> -- $<$:TEST_S> -+ $<$:TFM_S_REG_TEST> - $<$:EXTERNAL_SYSTEM_SUPPORT> - ) - -@@ -136,7 +136,7 @@ endif() - target_compile_definitions(platform_bl2 - PRIVATE - $<$:PLATFORM_IS_FVP> -- $<$:TEST_S> -+ $<$:TFM_S_REG_TEST> - ) - - # boot_hal_bl2.c is compiled as part of 'bl2' target and not inside -diff --git a/platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt b/platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt -index 369695f148..d39c5ae91d 100644 ---- a/platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt -+++ b/platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt -@@ -291,7 +291,7 @@ target_compile_definitions(signing_layout_for_bl2 - PRIVATE - MCUBOOT_IMAGE_NUMBER=${BL1_IMAGE_NUMBER} - BL1 -- $<$:TEST_S> -+ $<$:TFM_S_REG_TEST> - ) - - target_include_directories(signing_layout_for_bl2 -diff --git a/platform/ext/target/arm/corstone1000/bl2_flash_map.c b/platform/ext/target/arm/corstone1000/bl2_flash_map.c -index 6bffa274df..0a6a592d94 100644 ---- a/platform/ext/target/arm/corstone1000/bl2_flash_map.c -+++ b/platform/ext/target/arm/corstone1000/bl2_flash_map.c -@@ -38,6 +38,7 @@ struct flash_area flash_map[] = { - .fa_off = FLASH_AREA_1_OFFSET, - .fa_size = FLASH_AREA_1_SIZE, - }, -+#ifndef TFM_S_REG_TEST - { - .fa_id = FLASH_AREA_2_ID, - .fa_device_id = FLASH_DEVICE_ID, -@@ -52,6 +53,7 @@ struct flash_area flash_map[] = { - .fa_off = FLASH_INVALID_OFFSET, - .fa_size = FLASH_INVALID_SIZE, - }, -+#endif - }; - - const int flash_map_entry_num = ARRAY_SIZE(flash_map); -diff --git a/platform/ext/target/arm/corstone1000/boot_hal_bl2.c b/platform/ext/target/arm/corstone1000/boot_hal_bl2.c -index 792e06f81e..134315a17b 100644 ---- a/platform/ext/target/arm/corstone1000/boot_hal_bl2.c -+++ b/platform/ext/target/arm/corstone1000/boot_hal_bl2.c -@@ -100,10 +100,12 @@ int32_t boot_platform_init(void) - return 1; - } - -+#ifndef TFM_S_REG_TEST - result = fill_bl2_flash_map_by_parsing_fips(BANK_0_PARTITION_OFFSET); - if (result) { - return 1; - } -+#endif - - result = FLASH_DEV_NAME.Initialize(NULL); - if (result != ARM_DRIVER_OK) { -diff --git a/platform/ext/target/arm/corstone1000/config.cmake b/platform/ext/target/arm/corstone1000/config.cmake -index a3399db318..a6a1a33c42 100644 ---- a/platform/ext/target/arm/corstone1000/config.cmake -+++ b/platform/ext/target/arm/corstone1000/config.cmake -@@ -13,8 +13,15 @@ set(DEFAULT_MCUBOOT_FLASH_MAP OFF CACHE BOOL "Whether to us - set(MCUBOOT_UPGRADE_STRATEGY "RAM_LOAD" CACHE STRING "Upgrade strategy when multiple boot images are loaded") - set(MCUBOOT_SECURITY_COUNTER_S "1" CACHE STRING "Security counter for S image. auto sets it to IMAGE_VERSION_S") - --set(TFM_ISOLATION_LEVEL 2 CACHE STRING "Isolation level") --set(MCUBOOT_IMAGE_NUMBER 2 CACHE STRING "Whether to combine S and NS into either 1 image, or sign each separately") -+if (TEST_S OR TEST_S_ATTESTATION OR TEST_S_AUDIT OR TEST_S_CRYPTO OR TEST_S_ITS OR TEST_S_PS OR TEST_S_PLATFORM OR EXTRA_S_TEST_SUITES_PATHS) -+ # Test configuration: host images are not needed and work only with isolation level 1 -+ set(MCUBOOT_IMAGE_NUMBER 1 CACHE STRING "Whether to combine S and NS into either 1 image, or sign each separately") -+ set(TFM_ISOLATION_LEVEL 1 CACHE STRING "Isolation level") -+else() -+ set(MCUBOOT_IMAGE_NUMBER 2 CACHE STRING "Whether to combine S and NS into either 1 image, or sign each separately") -+ set(TFM_ISOLATION_LEVEL 2 CACHE STRING "Isolation level") -+endif() -+ - set(TFM_MULTI_CORE_TOPOLOGY ON CACHE BOOL "Whether to build for a dual-cpu architecture") - set(TFM_PLAT_SPECIFIC_MULTI_CORE_COMM ON CACHE BOOL "Whether to use a platform specific inter core communication instead of mailbox in dual-cpu topology") - set(CRYPTO_HW_ACCELERATOR ON CACHE BOOL "Whether to enable the crypto hardware accelerator on supported platforms") -diff --git a/platform/ext/target/arm/corstone1000/partition/flash_layout.h b/platform/ext/target/arm/corstone1000/partition/flash_layout.h -index aa5a8fe463..b0319bb319 100644 ---- a/platform/ext/target/arm/corstone1000/partition/flash_layout.h -+++ b/platform/ext/target/arm/corstone1000/partition/flash_layout.h -@@ -119,7 +119,7 @@ - * - */ - #define SE_BL2_PARTITION_SIZE (0x19000) /* 100 KB */ --#ifdef TEST_S -+#ifdef TFM_S_REG_TEST - #define TFM_PARTITION_SIZE (0x61C00) /* 391 KB */ - #else - #define TFM_PARTITION_SIZE (0x5E000) /* 376 KB */ -diff --git a/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c b/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c -index 8622844d91..1146ffe22a 100644 ---- a/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c -+++ b/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c -@@ -31,6 +31,7 @@ void tfm_hal_boot_ns_cpu(uintptr_t start_addr) - /* Switch the shared flash to XiP mode for the host */ - Select_XIP_Mode_For_Shared_Flash(); - -+#ifndef TFM_S_REG_TEST - volatile uint32_t *bir_base = (uint32_t *)CORSTONE1000_HOST_BIR_BASE; - - /* Program Boot Instruction Register to jump to BL2 (TF-A) base address -@@ -68,6 +69,7 @@ void tfm_hal_boot_ns_cpu(uintptr_t start_addr) - /*release EXT SYS out of reset*/ - tfm_external_system_boot(); - #endif -+#endif /* !TFM_S_REG_TEST */ - } - - void tfm_hal_wait_for_ns_cpu_ready(void) --- -2.25.1 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0004-Platform-Partition-Allow-configuration-of-input-and-.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0004-Platform-Partition-Allow-configuration-of-input-and-.patch deleted file mode 100644 index 211fb9e669..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0004-Platform-Partition-Allow-configuration-of-input-and-.patch +++ /dev/null @@ -1,72 +0,0 @@ -From f3686dfb8fb97cb42c3d4f8ee2d7aa736d5cb760 Mon Sep 17 00:00:00 2001 -From: Satish Kumar -Date: Wed, 3 Aug 2022 15:50:27 +0100 -Subject: [PATCH 4/6] Platform Partition: Allow configuration of input and - output buffer - -The change makes input and output buffer size macros used by -the platform partition to be configured by cmake. This will -allow platforms to set the buffer size accordingly. - -Change-Id: Ia492ce02f8744b0157228d9be51a9ec5b7c88ef6 -Signed-off-by: Satish Kumar -Upstream-Status: Accepted [TF-Mv1.7.0] ---- - config/config_default.cmake | 2 ++ - secure_fw/partitions/platform/CMakeLists.txt | 6 ++++++ - secure_fw/partitions/platform/platform_sp.c | 9 +++++++-- - 3 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/config/config_default.cmake b/config/config_default.cmake -index 3112b707bc..497c972dc9 100755 ---- a/config/config_default.cmake -+++ b/config/config_default.cmake -@@ -141,6 +141,8 @@ set(ATTEST_INCLUDE_OPTIONAL_CLAIMS ON CACHE BOOL "Include opt - set(ATTEST_INCLUDE_COSE_KEY_ID OFF CACHE BOOL "Include COSE key-id in initial attestation token") - - set(TFM_PARTITION_PLATFORM ON CACHE BOOL "Enable Platform partition") -+set(PLATFORM_SERVICE_INPUT_BUFFER_SIZE 64 CACHE STRING "Size of input buffer in platform service.") -+set(PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE 64 CACHE STRING "Size of output buffer in platform service.") - - set(TFM_PARTITION_AUDIT_LOG OFF CACHE BOOL "Enable Audit Log partition") - -diff --git a/secure_fw/partitions/platform/CMakeLists.txt b/secure_fw/partitions/platform/CMakeLists.txt -index 4b37cd780c..3070f89d6d 100644 ---- a/secure_fw/partitions/platform/CMakeLists.txt -+++ b/secure_fw/partitions/platform/CMakeLists.txt -@@ -47,6 +47,12 @@ target_link_libraries(tfm_psa_rot_partition_platform - tfm_spm - ) - -+target_compile_definitions(tfm_psa_rot_partition_platform -+ PRIVATE -+ INPUT_BUFFER_SIZE=${PLATFORM_SERVICE_INPUT_BUFFER_SIZE} -+ OUTPUT_BUFFER_SIZE=${PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE} -+) -+ - ############################ Secure API ######################################## - - target_sources(tfm_sprt -diff --git a/secure_fw/partitions/platform/platform_sp.c b/secure_fw/partitions/platform/platform_sp.c -index 673cb0ee06..87bd434720 100644 ---- a/secure_fw/partitions/platform/platform_sp.c -+++ b/secure_fw/partitions/platform/platform_sp.c -@@ -38,8 +38,13 @@ static const int32_t nv_counter_access_map[NV_COUNTER_MAP_SIZE] = { - #include "psa/service.h" - #include "region_defs.h" - --#define INPUT_BUFFER_SIZE 64 --#define OUTPUT_BUFFER_SIZE 64 -+#ifndef INPUT_BUFFER_SIZE -+#define INPUT_BUFFER_SIZE 64 -+#endif -+ -+#ifndef OUTPUT_BUFFER_SIZE -+#define OUTPUT_BUFFER_SIZE 64 -+#endif - - typedef enum tfm_platform_err_t (*plat_func_t)(const psa_msg_t *msg); - #endif /* TFM_PSA_API */ --- -2.25.1 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0005-corstone1000-support-for-UEFI-FMP-image-Information.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0005-corstone1000-support-for-UEFI-FMP-image-Information.patch deleted file mode 100644 index 14e4b7ff8e..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0005-corstone1000-support-for-UEFI-FMP-image-Information.patch +++ /dev/null @@ -1,573 +0,0 @@ -From 9d70628b7dc1dbc3c1ac7f4f3c0f6aa6b237510d Mon Sep 17 00:00:00 2001 -From: Satish Kumar -Date: Wed, 6 Jul 2022 11:19:39 +0100 -Subject: [PATCH 5/6] corstone1000: support for UEFI FMP image Information - -The commit provides the support for UEFI FMP (Firmware Management -Protocol) SET and GET Image info APIs. - -The APIs to SET and GET image info is implemented. In current design, -SET is called by secure encalve and GET is called by the host. - -FMP image information is initialized on every boot and retained -in SRAM. The updatable values of the FMP are stored in private -metadata section of the flash. - -Change-Id: Iaf0b4a13a9c24f05e4a32509e61a8b96ee8e9e4b -Signed-off-by: Satish Kumar -Upstream-Status: Accepted [TF-Mv1.7.0] ---- - .../target/arm/corstone1000/CMakeLists.txt | 2 + - .../ext/target/arm/corstone1000/config.cmake | 8 +- - .../corstone1000/fw_update_agent/fwu_agent.c | 61 ++++- - .../corstone1000/fw_update_agent/fwu_agent.h | 3 + - .../corstone1000/fw_update_agent/uefi_fmp.c | 240 ++++++++++++++++++ - .../corstone1000/fw_update_agent/uefi_fmp.h | 56 ++++ - .../include/corstone1000_ioctl_requests.h | 14 +- - .../services/src/tfm_platform_system.c | 9 + - 8 files changed, 374 insertions(+), 19 deletions(-) - create mode 100644 platform/ext/target/arm/corstone1000/fw_update_agent/uefi_fmp.c - create mode 100644 platform/ext/target/arm/corstone1000/fw_update_agent/uefi_fmp.h - -diff --git a/platform/ext/target/arm/corstone1000/CMakeLists.txt b/platform/ext/target/arm/corstone1000/CMakeLists.txt -index 81522c7cf0..3602312a3a 100644 ---- a/platform/ext/target/arm/corstone1000/CMakeLists.txt -+++ b/platform/ext/target/arm/corstone1000/CMakeLists.txt -@@ -76,6 +76,8 @@ target_sources(platform_s - fw_update_agent/uefi_capsule_parser.c - fw_update_agent/fwu_agent.c - $<$:${CMAKE_CURRENT_SOURCE_DIR}/target_cfg.c> -+ fw_update_agent/uefi_fmp.c -+ $<$>:${PLATFORM_DIR}/ext/accelerator/cc312/otp_cc312.c> - ) - - if (PLATFORM_IS_FVP) -diff --git a/platform/ext/target/arm/corstone1000/config.cmake b/platform/ext/target/arm/corstone1000/config.cmake -index a6a1a33c42..ab0fe17ba8 100644 ---- a/platform/ext/target/arm/corstone1000/config.cmake -+++ b/platform/ext/target/arm/corstone1000/config.cmake -@@ -50,7 +50,9 @@ else() - set(PLATFORM_PSA_ADAC_SECURE_DEBUG FALSE CACHE BOOL "Whether to use psa-adac secure debug.") - endif() - --set(DEFAULT_MCUBOOT_SECURITY_COUNTERS OFF CACHE BOOL "Whether to use the default security counter configuration defined by TF-M project") -+set(DEFAULT_MCUBOOT_SECURITY_COUNTERS OFF CACHE BOOL "Whether to use the default security counter configuration defined by TF-M project") - --set(PS_ENCRYPTION OFF CACHE BOOL "Enable encryption for Protected Storage partition") --set(PS_ROLLBACK_PROTECTION OFF CACHE BOOL "Enable rollback protection for Protected Storage partition") -+set(PS_ENCRYPTION OFF CACHE BOOL "Enable encryption for Protected Storage partition") -+set(PS_ROLLBACK_PROTECTION OFF CACHE BOOL "Enable rollback protection for Protected Storage partition") -+ -+set(PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE 256 CACHE STRING "Size of output buffer in platform service.") -diff --git a/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.c b/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.c -index 3abb5dd0dc..72a5fc9c1d 100644 ---- a/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.c -+++ b/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.c -@@ -18,6 +18,7 @@ - #include "platform_description.h" - #include "tfm_plat_nv_counters.h" - #include "tfm_plat_defs.h" -+#include "uefi_fmp.h" - - /* Properties of image in a bank */ - struct fwu_image_properties { -@@ -84,6 +85,11 @@ struct fwu_private_metadata { - /* staged nv_counter: temprary location before written to the otp */ - uint32_t nv_counter[NR_OF_IMAGES_IN_FW_BANK]; - -+ /* FMP information */ -+ uint32_t fmp_version; -+ uint32_t fmp_last_attempt_version; -+ uint32_t fmp_last_attempt_status; -+ - } __packed; - - #define MAX_BOOT_ATTEMPTS_PER_BANK 3 -@@ -278,7 +284,7 @@ enum fwu_agent_error_t fwu_metadata_provision(void) - { - enum fwu_agent_error_t ret; - struct fwu_private_metadata priv_metadata; -- uint32_t image_version = 0; -+ uint32_t image_version = FWU_IMAGE_INITIAL_VERSION; - - FWU_LOG_MSG("%s: enter\n\r", __func__); - -@@ -302,8 +308,8 @@ enum fwu_agent_error_t fwu_metadata_provision(void) - memset(&_metadata, 0, sizeof(struct fwu_metadata)); - - _metadata.version = 1; -- _metadata.active_index = 0; -- _metadata.previous_active_index = 1; -+ _metadata.active_index = BANK_0; -+ _metadata.previous_active_index = BANK_1; - - /* bank 0 is the place where images are located at the - * start of device lifecycle */ -@@ -339,6 +345,10 @@ enum fwu_agent_error_t fwu_metadata_provision(void) - priv_metadata.boot_index = BANK_0; - priv_metadata.boot_attempted = 0; - -+ priv_metadata.fmp_version = FWU_IMAGE_INITIAL_VERSION; -+ priv_metadata.fmp_last_attempt_version = FWU_IMAGE_INITIAL_VERSION; -+ priv_metadata.fmp_last_attempt_status = LAST_ATTEMPT_STATUS_SUCCESS; -+ - ret = private_metadata_write(&priv_metadata); - if (ret) { - return ret; -@@ -540,9 +550,25 @@ enum fwu_agent_error_t corstone1000_fwu_flash_image(void) - &image_bank_offset); - switch(image_index) { - case IMAGE_ALL: -+ - ret = flash_full_capsule(&_metadata, capsule_info.image[i], - capsule_info.size[i], - capsule_info.version[i]); -+ -+ if (ret != FWU_AGENT_SUCCESS) { -+ -+ priv_metadata.fmp_last_attempt_version = capsule_info.version[i]; -+ priv_metadata.fmp_last_attempt_status = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL; -+ -+ private_metadata_write(&priv_metadata); -+ -+ fmp_set_image_info(&full_capsule_image_guid, -+ priv_metadata.fmp_version, -+ priv_metadata.fmp_last_attempt_version, -+ priv_metadata.fmp_last_attempt_status); -+ } -+ -+ - break; - default: - FWU_LOG_MSG("%s: sent image not recognized\n\r", __func__); -@@ -866,17 +892,42 @@ enum fwu_agent_error_t corstone1000_fwu_host_ack(void) - - current_state = get_fwu_agent_state(&_metadata, &priv_metadata); - if (current_state == FWU_AGENT_STATE_REGULAR) { -+ - ret = FWU_AGENT_SUCCESS; /* nothing to be done */ -+ -+ fmp_set_image_info(&full_capsule_image_guid, -+ priv_metadata.fmp_version, -+ priv_metadata.fmp_last_attempt_version, -+ priv_metadata.fmp_last_attempt_status); -+ - goto out; -+ - } else if (current_state != FWU_AGENT_STATE_TRIAL) { - FWU_ASSERT(0); - } - - if (_metadata.active_index != priv_metadata.boot_index) { -+ - /* firmware update failed, revert back to previous bank */ -+ -+ priv_metadata.fmp_last_attempt_version = -+ _metadata.img_entry[IMAGE_0].img_props[_metadata.active_index].version; -+ -+ priv_metadata.fmp_last_attempt_status = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL; -+ - ret = fwu_select_previous(&_metadata, &priv_metadata); -+ - } else { -+ - /* firmware update successful */ -+ -+ priv_metadata.fmp_version = -+ _metadata.img_entry[IMAGE_0].img_props[_metadata.active_index].version; -+ priv_metadata.fmp_last_attempt_version = -+ _metadata.img_entry[IMAGE_0].img_props[_metadata.active_index].version; -+ -+ priv_metadata.fmp_last_attempt_status = LAST_ATTEMPT_STATUS_SUCCESS; -+ - ret = fwu_accept_image(&full_capsule_image_guid, &_metadata, - &priv_metadata); - if (!ret) { -@@ -886,6 +937,10 @@ enum fwu_agent_error_t corstone1000_fwu_host_ack(void) - - if (ret == FWU_AGENT_SUCCESS) { - disable_host_ack_timer(); -+ fmp_set_image_info(&full_capsule_image_guid, -+ priv_metadata.fmp_version, -+ priv_metadata.fmp_last_attempt_version, -+ priv_metadata.fmp_last_attempt_status); - } - - out: -diff --git a/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.h b/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.h -index 57b07e8d2c..aa18179024 100644 ---- a/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.h -+++ b/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.h -@@ -30,6 +30,9 @@ enum fwu_agent_error_t { - } \ - - -+/* Version used for the very first image of the device. */ -+#define FWU_IMAGE_INITIAL_VERSION 0 -+ - enum fwu_agent_error_t fwu_metadata_provision(void); - enum fwu_agent_error_t fwu_metadata_init(void); - -diff --git a/platform/ext/target/arm/corstone1000/fw_update_agent/uefi_fmp.c b/platform/ext/target/arm/corstone1000/fw_update_agent/uefi_fmp.c -new file mode 100644 -index 0000000000..ce576e1794 ---- /dev/null -+++ b/platform/ext/target/arm/corstone1000/fw_update_agent/uefi_fmp.c -@@ -0,0 +1,240 @@ -+/* -+ * Copyright (c) 2022, Arm Limited. All rights reserved. -+ * -+ * SPDX-License-Identifier: BSD-3-Clause -+ * -+ */ -+ -+#include -+#include -+#include "cmsis.h" -+#include "uefi_fmp.h" -+ -+/* The count will increase when partial update is supported. -+ * At present, only full WIC is considered as updatable image. -+ */ -+#define NUMBER_OF_FMP_IMAGES 1 -+#define NO_OF_FMP_VARIABLES_PER_IMAGE 6 -+ -+#define UEFI_ARCHITECTURE_64 -+ -+#ifdef UEFI_ARCHITECTURE_64 -+typedef uint64_t uefi_ptr_t; -+typedef uint64_t efi_uintn_t; -+#else -+typedef uint32_t uefi_ptr_t; -+typedef uint32_t efi_uintn_t; -+#endif -+ -+/* Below macro definations and struct declarations taken from UEFI spec 2.9 */ -+ -+/* -+ * Image Attribute Definitions -+ */ -+#define IMAGE_ATTRIBUTE_IMAGE_UPDATABLE 0x00000001 -+#define IMAGE_ATTRIBUTE_RESET_REQUIRED 0x00000002 -+#define IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED 0x00000004 -+#define IMAGE_ATTRIBUTE_IN_USE 0x00000008 -+#define IMAGE_ATTRIBUTE_UEFI_IMAGE 0x00000010 -+#define IMAGE_ATTRIBUTE_DEPENDENCY 0x00000020 -+ -+typedef uint32_t DescriptorVersion_t; -+typedef uint32_t DescriptorSize_t; -+typedef uint8_t DescriptorCount_t; -+ -+typedef __PACKED_STRUCT { -+ uint8_t ImageIndex; -+ struct efi_guid ImageTypeId; -+ uint64_t ImageId; -+ uefi_ptr_t PtrImageIdName; -+ uint32_t Version; -+ uefi_ptr_t PtrVersionName; -+ efi_uintn_t Size; -+ uint64_t AttributesSupported; -+ uint64_t AttributesSetting; -+ uint64_t Compatibilities; -+ /* Introduced with DescriptorVersion 2+ */ -+ uint32_t LowestSupportedImageVersion; -+ /* Introduced with DescriptorVersion 3+ */ -+ uint32_t LastAttemptVersion; -+ uint32_t LastAttemptStatus; -+ uint64_t HardwareInstance; -+ /* Introduced with DescriptorVersion 4+ */ -+ uefi_ptr_t PtrDependencies; -+} EFI_FIRMWARE_IMAGE_DESCRIPTOR; -+ -+typedef __PACKED_STRUCT { -+ DescriptorVersion_t DescriptorVersion; -+ DescriptorSize_t DescriptorsSize; -+ DescriptorCount_t DescriptorCount; -+ EFI_FIRMWARE_IMAGE_DESCRIPTOR ImageDescriptor; -+ uint16_t *ImageName; -+ uint32_t ImageNameSize; -+ uint16_t *ImageVersionName; -+ uint32_t ImageVersionNameSize; -+} EFI_FIRMWARE_MANAGEMENT_PROTOCOL_IMAGE_INFO; -+ -+ -+static uint16_t corstone_image_name0[] = { 'C', 'O', 'R', 'S', 'T', 'O', 'N', 'E', '1', '0', '0', '0', '_', 'W', 'I', 'C', '\0' }; -+static uint16_t corstone_version_name0[] = { 'C', 'O', 'R', 'S', 'T', 'O', 'N', 'E', '1', '0', '0', '0', '_', 'B', 'E', 'S', 'T', '\0'}; -+ -+static EFI_FIRMWARE_MANAGEMENT_PROTOCOL_IMAGE_INFO fmp_info[NUMBER_OF_FMP_IMAGES]; -+ -+extern struct efi_guid full_capsule_image_guid; -+ -+static bool is_fmp_info_initialized = false; -+ -+static void init_fmp_info(void) -+{ -+ memset(fmp_info, 0, -+ sizeof(EFI_FIRMWARE_MANAGEMENT_PROTOCOL_IMAGE_INFO) * NUMBER_OF_FMP_IMAGES); -+ -+ /* Fill information for the WIC. -+ * Add further details when partial image is supported. -+ */ -+ -+ fmp_info[0].DescriptorVersion = 4; -+ fmp_info[0].DescriptorCount = NUMBER_OF_FMP_IMAGES; -+ fmp_info[0].DescriptorsSize = -+ sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR) + -+ sizeof(corstone_image_name0) + sizeof(corstone_version_name0); -+ -+ fmp_info[0].ImageDescriptor.ImageIndex = 1; -+ -+ memcpy(&fmp_info[0].ImageDescriptor.ImageTypeId, &full_capsule_image_guid, -+ sizeof(struct efi_guid)); -+ -+ fmp_info[0].ImageDescriptor.ImageId = 1; -+ fmp_info[0].ImageDescriptor.Version = FWU_IMAGE_INITIAL_VERSION; -+ fmp_info[0].ImageDescriptor.AttributesSupported = 1; -+ fmp_info[0].ImageDescriptor.AttributesSetting = ( -+ IMAGE_ATTRIBUTE_IMAGE_UPDATABLE | IMAGE_ATTRIBUTE_RESET_REQUIRED); -+ fmp_info[0].ImageDescriptor.LowestSupportedImageVersion = -+ FWU_IMAGE_INITIAL_VERSION; -+ fmp_info[0].ImageDescriptor.LastAttemptVersion = FWU_IMAGE_INITIAL_VERSION; -+ fmp_info[0].ImageDescriptor.LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS; -+ -+ fmp_info[0].ImageName = corstone_image_name0; -+ fmp_info[0].ImageNameSize = sizeof(corstone_image_name0); -+ fmp_info[0].ImageVersionName = corstone_version_name0; -+ fmp_info[0].ImageVersionNameSize = sizeof(corstone_version_name0); -+ -+ is_fmp_info_initialized = true; -+ -+ return; -+} -+ -+enum fwu_agent_error_t fmp_set_image_info(struct efi_guid *guid, -+ uint32_t current_version, uint32_t attempt_version, -+ uint32_t last_attempt_status) -+{ -+ enum fwu_agent_error_t status = FWU_AGENT_ERROR; -+ -+ FWU_LOG_MSG("%s:%d Enter\n\r", __func__, __LINE__); -+ -+ if (is_fmp_info_initialized == false) { -+ init_fmp_info(); -+ } -+ -+ for (int i = 0; i < NUMBER_OF_FMP_IMAGES; i++) { -+ if ((memcmp(guid, &fmp_info[i].ImageDescriptor.ImageTypeId, -+ sizeof(struct efi_guid))) == 0) -+ { -+ FWU_LOG_MSG("FMP image update: image id = %u\n\r", -+ fmp_info[i].ImageDescriptor.ImageId); -+ fmp_info[i].ImageDescriptor.Version = current_version; -+ fmp_info[i].ImageDescriptor.LastAttemptVersion = attempt_version; -+ fmp_info[i].ImageDescriptor.LastAttemptStatus = last_attempt_status; -+ FWU_LOG_MSG("FMP image update: status = %u" -+ "version=%u last_attempt_version=%u.\n\r", -+ last_attempt_status, current_version, -+ attempt_version); -+ status = FWU_AGENT_SUCCESS; -+ break; -+ } -+ } -+ -+ FWU_LOG_MSG("%s:%d Exit.\n\r", __func__, __LINE__); -+ return status; -+} -+ -+ -+#define NO_OF_FMP_VARIABLES (NUMBER_OF_FMP_IMAGES * NO_OF_FMP_VARIABLES_PER_IMAGE) -+ -+static enum fwu_agent_error_t pack_image_info(void *buffer, uint32_t size) -+{ -+ typedef __PACKED_STRUCT { -+ uint32_t variable_count; -+ uint32_t variable_size[NO_OF_FMP_VARIABLES]; -+ uint8_t variable[]; -+ } packed_buffer_t; -+ -+ packed_buffer_t *packed_buffer = buffer; -+ int runner = 0; -+ int index = 0; -+ int current_size = sizeof(packed_buffer_t); -+ int size_requirement_1 = 0; -+ int size_requirement_2 = 0; -+ -+ if (size < current_size) { -+ FWU_LOG_MSG("%s:%d Buffer too small.\n\r", __func__, __LINE__); -+ return FWU_AGENT_ERROR; -+ } -+ -+ packed_buffer->variable_count = NO_OF_FMP_VARIABLES; -+ -+ for (int i = 0; i < NUMBER_OF_FMP_IMAGES; i++) { -+ -+ packed_buffer->variable_size[index++] = sizeof(DescriptorVersion_t); -+ packed_buffer->variable_size[index++] = sizeof(DescriptorSize_t); -+ packed_buffer->variable_size[index++] = sizeof(DescriptorCount_t); -+ packed_buffer->variable_size[index++] = sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR); -+ packed_buffer->variable_size[index++] = fmp_info[i].ImageNameSize; -+ packed_buffer->variable_size[index++] = fmp_info[i].ImageVersionNameSize; -+ -+ size_requirement_1 = sizeof(DescriptorVersion_t) + sizeof(DescriptorSize_t) + -+ sizeof(DescriptorCount_t) + sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR); -+ -+ size_requirement_2 = fmp_info[i].ImageNameSize + fmp_info[i].ImageVersionNameSize; -+ -+ current_size += size_requirement_1 + size_requirement_2; -+ -+ if (size < current_size) { -+ FWU_LOG_MSG("%s:%d Buffer too small.\n\r", __func__, __LINE__); -+ return FWU_AGENT_ERROR; -+ } -+ -+ FWU_LOG_MSG("%s:%d ImageInfo size = %u, ImageName size = %u, " -+ "ImageVersionName size = %u\n\r", __func__, __LINE__, -+ sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR), fmp_info[i].ImageNameSize, -+ fmp_info[i].ImageVersionNameSize); -+ -+ memcpy(&packed_buffer->variable[runner], &fmp_info[i], size_requirement_1); -+ runner += size_requirement_1; -+ -+ memcpy(&packed_buffer->variable[runner], fmp_info[i].ImageName, -+ fmp_info[i].ImageNameSize); -+ runner += fmp_info[i].ImageNameSize; -+ -+ memcpy(&packed_buffer->variable[runner], fmp_info[i].ImageVersionName, -+ fmp_info[i].ImageVersionNameSize); -+ runner += fmp_info[i].ImageVersionNameSize; -+ -+ } -+ -+ return FWU_AGENT_SUCCESS; -+} -+ -+enum fwu_agent_error_t fmp_get_image_info(void *buffer, uint32_t size) -+{ -+ enum fwu_agent_error_t status; -+ -+ FWU_LOG_MSG("%s:%d Enter\n\r", __func__, __LINE__); -+ -+ status = pack_image_info(buffer, size); -+ -+ FWU_LOG_MSG("%s:%d Exit\n\r", __func__, __LINE__); -+ -+ return status; -+} -+ -diff --git a/platform/ext/target/arm/corstone1000/fw_update_agent/uefi_fmp.h b/platform/ext/target/arm/corstone1000/fw_update_agent/uefi_fmp.h -new file mode 100644 -index 0000000000..d876bd7cff ---- /dev/null -+++ b/platform/ext/target/arm/corstone1000/fw_update_agent/uefi_fmp.h -@@ -0,0 +1,56 @@ -+/* -+ * Copyright (c) 2022, Arm Limited. All rights reserved. -+ * -+ * SPDX-License-Identifier: BSD-3-Clause -+ * -+ */ -+ -+#ifndef UEFI_FMP_H -+#define UEFI_FMP_H -+ -+ -+#include -+#include "fwu_agent.h" -+#include "../fip_parser/external/uuid.h" -+ -+/* -+ * Last Attempt Status Value -+ */ -+ -+#define LAST_ATTEMPT_STATUS_SUCCESS 0x00000000 -+#define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL 0x00000001 -+#define LAST_ATTEMPT_STATUS_ERROR_INSUFFICIENT_RESOURCES 0x00000002 -+#define LAST_ATTEMPT_STATUS_ERROR_INCORRECT_VERSION 0x00000003 -+#define LAST_ATTEMPT_STATUS_ERROR_INVALID_FORMAT 0x00000004 -+#define LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR 0x00000005 -+#define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_AC 0x00000006 -+#define LAST_ATTEMPT_STATUS_ERROR_PWR_EVT_BATT 0x00000007 -+#define LAST_ATTEMPT_STATUS_ERROR_UNSATISFIED_DEPENDENCIES 0x00000008 -+/* The LastAttemptStatus values of 0x1000 - 0x4000 are reserved for vendor usage. */ -+#define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MIN 0x00001000 -+#define LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MAX 0x00004000 -+ -+ -+ -+/* -+ * Updates FMP information for the image matched by guid. -+ * -+ * guid : guid of the image -+ * current_version: current versions for the image -+ * attempt_version: attempted versions for the image -+ * -+ */ -+enum fwu_agent_error_t fmp_set_image_info(struct efi_guid *guid, -+ uint32_t current_version, uint32_t attempt_version, -+ uint32_t last_attempt_status); -+ -+/* -+ * Return fmp image information for all the updable images. -+ * -+ * buffer : pointer to the out buffer -+ * size : size of the buffer -+ * -+ */ -+enum fwu_agent_error_t fmp_get_image_info(void *buffer, uint32_t size); -+ -+#endif /* UEFI_FMP_H */ -diff --git a/platform/ext/target/arm/corstone1000/services/include/corstone1000_ioctl_requests.h b/platform/ext/target/arm/corstone1000/services/include/corstone1000_ioctl_requests.h -index 8ac67346b6..c5f3537e9d 100644 ---- a/platform/ext/target/arm/corstone1000/services/include/corstone1000_ioctl_requests.h -+++ b/platform/ext/target/arm/corstone1000/services/include/corstone1000_ioctl_requests.h -@@ -14,19 +14,7 @@ - enum corstone1000_ioctl_id_t { - IOCTL_CORSTONE1000_FWU_FLASH_IMAGES = 0, - IOCTL_CORSTONE1000_FWU_HOST_ACK, -+ IOCTL_CORSTONE1000_FMP_GET_IMAGE_INFO, - }; - -- --typedef struct corstone1000_ioctl_in_params { -- -- uint32_t ioctl_id; -- --} corstone1000_ioctl_in_params_t; -- --typedef struct corstone1000_ioctl_out_params { -- -- int32_t result; -- --} corstone1000_ioctl_out_params_t; -- - #endif /* CORSTONE1000_IOCTL_REQUESTS_H */ -diff --git a/platform/ext/target/arm/corstone1000/services/src/tfm_platform_system.c b/platform/ext/target/arm/corstone1000/services/src/tfm_platform_system.c -index 5b3f3e14a2..41305ed966 100644 ---- a/platform/ext/target/arm/corstone1000/services/src/tfm_platform_system.c -+++ b/platform/ext/target/arm/corstone1000/services/src/tfm_platform_system.c -@@ -9,6 +9,7 @@ - #include "platform_description.h" - #include "corstone1000_ioctl_requests.h" - #include "fwu_agent.h" -+#include "uefi_fmp.h" - - void tfm_platform_hal_system_reset(void) - { -@@ -36,6 +37,14 @@ enum tfm_platform_err_t tfm_platform_hal_ioctl(tfm_platform_ioctl_req_t request, - corstone1000_fwu_host_ack(); - break; - -+ case IOCTL_CORSTONE1000_FMP_GET_IMAGE_INFO: -+ if (out_vec == NULL) { -+ ret = TFM_PLATFORM_ERR_INVALID_PARAM; -+ break; -+ } -+ fmp_get_image_info(out_vec[0].base, out_vec[0].len); -+ break; -+ - default: - ret = TFM_PLATFORM_ERR_NOT_SUPPORTED; - break; --- -2.25.1 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0006-corstone1000-remove-two-partition-configuration.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0006-corstone1000-remove-two-partition-configuration.patch deleted file mode 100644 index ade2c8c8f5..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0006-corstone1000-remove-two-partition-configuration.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 492c887c8dff97ea1b8a11b4e729620d3744ac38 Mon Sep 17 00:00:00 2001 -From: Satish Kumar -Date: Mon, 30 May 2022 12:38:23 +0100 -Subject: [PATCH 6/6] corstone1000: remove two partition configuration - -Previously to run tf-m test, a larger partition was created -which allowed all default test binaries to be included. -The patch revert the change because any partition might -not be enough to hold all test binaries in the future. -So its better to run few test at a time instead of creating -a larger partition. - -Signed-off-by: Satish Kumar -Change-Id: I223fe45f2de014dbcadc6ac12c321c524701116a -Upstream-Status: Accepted [TF-Mv1.7.0] ---- - platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt | 1 - - platform/ext/target/arm/corstone1000/partition/flash_layout.h | 4 ---- - 2 files changed, 5 deletions(-) - -diff --git a/platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt b/platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt -index d39c5ae91d..f1ae1ebd47 100644 ---- a/platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt -+++ b/platform/ext/target/arm/corstone1000/bl1/CMakeLists.txt -@@ -291,7 +291,6 @@ target_compile_definitions(signing_layout_for_bl2 - PRIVATE - MCUBOOT_IMAGE_NUMBER=${BL1_IMAGE_NUMBER} - BL1 -- $<$:TFM_S_REG_TEST> - ) - - target_include_directories(signing_layout_for_bl2 -diff --git a/platform/ext/target/arm/corstone1000/partition/flash_layout.h b/platform/ext/target/arm/corstone1000/partition/flash_layout.h -index b0319bb319..50a0a11fc8 100644 ---- a/platform/ext/target/arm/corstone1000/partition/flash_layout.h -+++ b/platform/ext/target/arm/corstone1000/partition/flash_layout.h -@@ -119,11 +119,7 @@ - * - */ - #define SE_BL2_PARTITION_SIZE (0x19000) /* 100 KB */ --#ifdef TFM_S_REG_TEST --#define TFM_PARTITION_SIZE (0x61C00) /* 391 KB */ --#else - #define TFM_PARTITION_SIZE (0x5E000) /* 376 KB */ --#endif - #define FIP_PARTITION_SIZE (0x200000) /* 2 MB */ - #define KERNEL_PARTITION_SIZE (0xC00000) /* 12 MB */ - --- -2.25.1 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0007-corstone1000-adjust-PS-asset-configuration.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0007-corstone1000-adjust-PS-asset-configuration.patch deleted file mode 100644 index 7fae7b69b0..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/corstone1000/0007-corstone1000-adjust-PS-asset-configuration.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 5be42e1c05205209fc3988f0df30a02da95c2448 Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Wed, 2 Nov 2022 00:12:35 +0000 -Subject: [PATCH] corstone1000: adjust PS asset configuration - -Adjust protected storage asset configuration to be more inline -with the one in trusted service side, that would make thinks -work when testing and using more than the default variables. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - platform/ext/target/arm/corstone1000/config.cmake | 1 ++ - 1 file changed, 1 insertions(+) - -diff --git a/platform/ext/target/arm/corstone1000/config.cmake b/platform/ext/target/arm/corstone1000/config.cmake -index ab0fe17ba886..c2b4b646e6b0 100644 ---- a/platform/ext/target/arm/corstone1000/config.cmake -+++ b/platform/ext/target/arm/corstone1000/config.cmake -@@ -56,3 +56,4 @@ set(PS_ENCRYPTION OFF CACHE BOOL "Enable - set(PS_ROLLBACK_PROTECTION OFF CACHE BOOL "Enable rollback protection for Protected Storage partition") - - set(PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE 256 CACHE STRING "Size of output buffer in platform service.") -+set(PS_NUM_ASSETS "40" CACHE STRING "The maximum number of assets to be stored in the Protected Storage area") --- -2.38.1 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc new file mode 100644 index 0000000000..861dcff856 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc @@ -0,0 +1,40 @@ +# Corstone1000 machines specific TFM support + +COMPATIBLE_MACHINE = "(corstone1000)" + +TFM_PLATFORM = "arm/corstone1000" + +TFM_DEBUG = "1" + + + +## Default is the MPS3 board +TFM_PLATFORM_IS_FVP ?= "FALSE" +EXTRA_OECMAKE += "-DPLATFORM_IS_FVP=${TFM_PLATFORM_IS_FVP}" +EXTRA_OECMAKE += "-DCC312_LEGACY_DRIVER_API_ENABLED=OFF" + +# libmetal +LICENSE += "& BSD-3-Clause" +LIC_FILES_CHKSUM += "file://../libmetal/LICENSE.md;md5=fe0b8a4beea8f0813b606d15a3df3d3c" +SRC_URI += "git://github.com/OpenAMP/libmetal.git;protocol=https;branch=main;name=libmetal;destsuffix=git/libmetal" +SRCREV_libmetal = "f252f0e007fbfb8b3a52b1d5901250ddac96baad" +EXTRA_OECMAKE += "-DLIBMETAL_SRC_PATH=${S}/../libmetal -DLIBMETAL_BIN_PATH=${B}/libmetal-build" + +# OpenAMP +LICENSE += "& BSD-2-Clause & BSD-3-Clause" +LIC_FILES_CHKSUM += "file://../openamp/LICENSE.md;md5=a8d8cf662ef6bf9936a1e1413585ecbf" +SRC_URI += "git://github.com/OpenAMP/open-amp.git;protocol=https;branch=main;name=openamp;destsuffix=git/openamp" +SRCREV_openamp = "347397decaa43372fc4d00f965640ebde042966d" +EXTRA_OECMAKE += "-DLIBOPENAMP_SRC_PATH=${S}/../openamp -DLIBOPENAMP_BIN_PATH=${B}/libopenamp-build" + + +# Uncomment to apply patches +# FILESEXTRAPATHS:prepend := "${THISDIR}/corstone1000:" +# SRC_URI:append:corstone1000 = " \ +# " + +do_install() { + install -D -p -m 0644 ${B}/install/outputs/tfm_s_signed.bin ${D}/firmware/tfm_s_signed.bin + install -D -p -m 0644 ${B}/install/outputs/bl2_signed.bin ${D}/firmware/bl2_signed.bin + install -D -p -m 0644 ${B}/install/outputs/bl1.bin ${D}/firmware/bl1.bin +} diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc deleted file mode 100644 index 58ad103262..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc +++ /dev/null @@ -1,44 +0,0 @@ -# Corstone1000 machines specific TFM support - -COMPATIBLE_MACHINE = "(corstone1000)" - -TFM_PLATFORM = "arm/corstone1000" - -TFM_DEBUG = "1" - -## Default is the MPS3 board -TFM_PLATFORM_IS_FVP ?= "FALSE" -EXTRA_OECMAKE += "-DPLATFORM_IS_FVP=${TFM_PLATFORM_IS_FVP}" -EXTRA_OECMAKE += "-DCC312_LEGACY_DRIVER_API_ENABLED=OFF" - -# libmetal -LICENSE += "& BSD-3-Clause" -LIC_FILES_CHKSUM += "file://../libmetal/LICENSE.md;md5=fe0b8a4beea8f0813b606d15a3df3d3c" -SRC_URI += "git://github.com/OpenAMP/libmetal.git;protocol=https;branch=main;name=libmetal;destsuffix=git/libmetal" -SRCREV_libmetal = "f252f0e007fbfb8b3a52b1d5901250ddac96baad" -EXTRA_OECMAKE += "-DLIBMETAL_SRC_PATH=${S}/../libmetal -DLIBMETAL_BIN_PATH=${B}/libmetal-build" - -# OpenAMP -LICENSE += "& BSD-2-Clause & BSD-3-Clause" -LIC_FILES_CHKSUM += "file://../openamp/LICENSE.md;md5=a8d8cf662ef6bf9936a1e1413585ecbf" -SRC_URI += "git://github.com/OpenAMP/open-amp.git;protocol=https;branch=main;name=openamp;destsuffix=git/openamp" -SRCREV_openamp = "347397decaa43372fc4d00f965640ebde042966d" -EXTRA_OECMAKE += "-DLIBOPENAMP_SRC_PATH=${S}/../openamp -DLIBOPENAMP_BIN_PATH=${B}/libopenamp-build" - -# Apply the necessary changes for supporting FMP image info -FILESEXTRAPATHS:prepend := "${THISDIR}/corstone1000:" -SRC_URI:append:corstone1000 = " \ - file://0001-corstone1000-platform-secure-test-framework.patch \ - file://0002-corstone1000-make-external-system-support-optional.patch \ - file://0003-corstone1000-enable-secure-enclave-run-without-host-.patch \ - file://0004-Platform-Partition-Allow-configuration-of-input-and-.patch \ - file://0005-corstone1000-support-for-UEFI-FMP-image-Information.patch \ - file://0006-corstone1000-remove-two-partition-configuration.patch \ - file://0007-corstone1000-adjust-PS-asset-configuration.patch \ - " - -do_install() { - install -D -p -m 0644 ${B}/install/outputs/tfm_s_signed.bin ${D}/firmware/tfm_s_signed.bin - install -D -p -m 0644 ${B}/install/outputs/bl2_signed.bin ${D}/firmware/bl2_signed.bin - install -D -p -m 0644 ${B}/install/outputs/bl1.bin ${D}/firmware/bl1.bin -} diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.%.bbappend b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.%.bbappend deleted file mode 100644 index da70bc7806..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.%.bbappend +++ /dev/null @@ -1,6 +0,0 @@ -# Machine specific configurations - -MACHINE_TFM_REQUIRE ?= "" -MACHINE_TFM_REQUIRE:corstone1000 = "trusted-firmware-m-corstone1000.inc" - -require ${MACHINE_TFM_REQUIRE} diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.%.bbappend b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.%.bbappend new file mode 100644 index 0000000000..ec0e483b97 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.%.bbappend @@ -0,0 +1,6 @@ +# Machine specific configurations + +MACHINE_TFM_REQUIRE ?= "" +MACHINE_TFM_REQUIRE:corstone1000 = "trusted-firmware-m-1.7.0-corstone1000.inc" + +require ${MACHINE_TFM_REQUIRE} diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/uefi/edk2-firmware-juno.inc b/meta-arm/meta-arm-bsp/recipes-bsp/uefi/edk2-firmware-juno.inc index aac0d1cb5b..44613f134a 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/uefi/edk2-firmware-juno.inc +++ b/meta-arm/meta-arm-bsp/recipes-bsp/uefi/edk2-firmware-juno.inc @@ -3,7 +3,3 @@ EDK2_PLATFORM_DSC = "Platform/ARM/JunoPkg/ArmJuno.dsc" EDK2_BIN_NAME = "BL33_AP_UEFI.fd" COMPATIBLE_MACHINE = "juno" - -# As of 2022-06-14 with 2022.05, clang builds fail: -# "The required fv image size 0x104048 exceeds the set fv image size 0xf9000" -TOOLCHAIN = "gcc" diff --git a/meta-arm/meta-arm-bsp/recipes-security/optee/files/optee-os/n1sdp/0006-plat-n1sdp-add-external-device-tree-base-and-size.patch b/meta-arm/meta-arm-bsp/recipes-security/optee/files/optee-os/n1sdp/0006-plat-n1sdp-add-external-device-tree-base-and-size.patch new file mode 100644 index 0000000000..74c94e0afe --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/optee/files/optee-os/n1sdp/0006-plat-n1sdp-add-external-device-tree-base-and-size.patch @@ -0,0 +1,44 @@ +Upstream-Status: Pending [Not submitted to upstream yet] +Signed-off-by: Emekcan Aras + +From 1a9aeedda58228893add545e49d2d6cd4c316b4f Mon Sep 17 00:00:00 2001 +From: Emekcan +Date: Tue, 13 Dec 2022 13:45:06 +0000 +Subject: [PATCH] plat-n1sdp: add external device tree base and size + +Adds external device tree address and size. It also +register this physical memory so optee can read the device tree. +--- + core/arch/arm/plat-n1sdp/main.c | 1 + + core/arch/arm/plat-n1sdp/platform_config.h | 3 +++ + 2 files changed, 4 insertions(+) + +diff --git a/core/arch/arm/plat-n1sdp/main.c b/core/arch/arm/plat-n1sdp/main.c +index bb951ce6b..ab76f60c6 100644 +--- a/core/arch/arm/plat-n1sdp/main.c ++++ b/core/arch/arm/plat-n1sdp/main.c +@@ -31,6 +31,7 @@ static struct gic_data gic_data __nex_bss; + static struct pl011_data console_data __nex_bss; + + register_phys_mem_pgdir(MEM_AREA_IO_SEC, CONSOLE_UART_BASE, PL011_REG_SIZE); ++register_phys_mem_pgdir(MEM_AREA_EXT_DT, EXT_DT_BASE, EXT_DT_SIZE); + + register_ddr(DRAM0_BASE, DRAM0_SIZE); + register_ddr(DRAM1_BASE, DRAM1_SIZE); +diff --git a/core/arch/arm/plat-n1sdp/platform_config.h b/core/arch/arm/plat-n1sdp/platform_config.h +index bf0a3c834..8741a2503 100644 +--- a/core/arch/arm/plat-n1sdp/platform_config.h ++++ b/core/arch/arm/plat-n1sdp/platform_config.h +@@ -42,6 +42,9 @@ + #define GICC_BASE 0x2C000000 + #define GICR_BASE 0x300C0000 + ++#define EXT_DT_BASE 0x04001600 ++#define EXT_DT_SIZE 0x200 ++ + #ifndef UART_BAUDRATE + #define UART_BAUDRATE 115200 + #endif +-- +2.17.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os-n1sdp.inc b/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os-n1sdp.inc index 2719e4c047..a40c93dcba 100644 --- a/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os-n1sdp.inc +++ b/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os-n1sdp.inc @@ -11,6 +11,7 @@ SRC_URI:append = " \ file://0003-HACK-disable-instruction-cache-and-data-cache.patch \ file://0004-Handle-logging-syscall.patch \ file://0005-plat-n1sdp-register-DRAM1-to-optee-os.patch \ + file://0006-plat-n1sdp-add-external-device-tree-base-and-size.patch \ " EXTRA_OEMAKE += " CFG_TEE_CORE_LOG_LEVEL=4" @@ -20,3 +21,9 @@ EXTRA_OEMAKE += " CFG_TEE_BENCHMARK=n" EXTRA_OEMAKE += " CFG_CORE_SEL1_SPMC=y CFG_CORE_FFA=y" EXTRA_OEMAKE += " CFG_WITH_SP=y" + +EXTRA_OEMAKE += " CFG_DT=y" + +EXTRA_OEMAKE += " CFG_SECURE_PARTITION=y" + +EXTRA_OEMAKE += " CFG_MAP_EXT_DT_SECURE=y" diff --git a/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os_3.19.0.bbappend b/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os_3.19.0.bbappend new file mode 100644 index 0000000000..f80e09f82d --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os_3.19.0.bbappend @@ -0,0 +1,6 @@ +# Machine specific configurations + +MACHINE_OPTEE_OS_REQUIRE ?= "" +MACHINE_OPTEE_OS_REQUIRE:n1sdp = "optee-os-n1sdp.inc" + +require ${MACHINE_OPTEE_OS_REQUIRE} diff --git a/meta-arm/meta-arm-bsp/recipes-security/packagegroups/packagegroup-ts-tests.bbappend b/meta-arm/meta-arm-bsp/recipes-security/packagegroups/packagegroup-ts-tests.bbappend new file mode 100644 index 0000000000..20612cb1a1 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/packagegroups/packagegroup-ts-tests.bbappend @@ -0,0 +1,2 @@ +COMPATIBLE_MACHINE:corstone1000 = "corstone1000" +COMPATIBLE_MACHINE:n1sdp = "n1sdp" diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0023-Use-the-stateless-platform-service.patch b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0023-Use-the-stateless-platform-service.patch new file mode 100644 index 0000000000..824196c11a --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0023-Use-the-stateless-platform-service.patch @@ -0,0 +1,140 @@ +From 956b8a8e1dd5702b9c1657f4ec27a7aeddb0758e Mon Sep 17 00:00:00 2001 +From: Mohamed Omar Asaker +Date: Mon, 21 Nov 2022 00:08:20 +0000 +Subject: [PATCH] Use the stateless platform service calls + +Calls to psa_connect is not needed and psa_call can be called +directly with a pre defined handle. + +Signed-off-by: Satish Kumar +Signed-off-by: Mohamed Omar Asaker +Upstream-Status: Inappropriate [Design is to revisted] + +--- + .../provider/capsule_update_provider.c | 24 ++++--------------- + .../provider/corstone1000_fmp_service.c | 10 ++++---- + .../provider/corstone1000_fmp_service.h | 3 +-- + components/service/common/include/psa/sid.h | 6 +++++ + 4 files changed, 16 insertions(+), 27 deletions(-) + +diff --git a/components/service/capsule_update/provider/capsule_update_provider.c b/components/service/capsule_update/provider/capsule_update_provider.c +index 991a2235..6809249f 100644 +--- a/components/service/capsule_update/provider/capsule_update_provider.c ++++ b/components/service/capsule_update/provider/capsule_update_provider.c +@@ -61,7 +61,6 @@ void capsule_update_provider_deinit(struct capsule_update_provider *context) + static rpc_status_t event_handler(uint32_t opcode, struct rpc_caller *caller) + { + uint32_t ioctl_id; +- psa_handle_t handle; + rpc_status_t rpc_status = TS_RPC_CALL_ACCEPTED; + + struct psa_invec in_vec[] = { +@@ -79,31 +78,18 @@ static rpc_status_t event_handler(uint32_t opcode, struct rpc_caller *caller) + case CAPSULE_UPDATE_REQUEST: + /* Openamp call with IOCTL for firmware update*/ + ioctl_id = IOCTL_CORSTONE1000_FWU_FLASH_IMAGES; +- handle = psa_connect(caller, TFM_SP_PLATFORM_IOCTL_SID, +- TFM_SP_PLATFORM_IOCTL_VERSION); +- if (handle <= 0) { +- EMSG("%s Invalid handle", __func__); +- rpc_status = TS_RPC_ERROR_INVALID_PARAMETER; +- return rpc_status; +- } +- psa_call(caller,handle, PSA_IPC_CALL, ++ psa_call(caller,TFM_PLATFORM_SERVICE_HANDLE, TFM_PLATFORM_API_ID_IOCTL, + in_vec,IOVEC_LEN(in_vec), NULL, 0); +- set_fmp_image_info(caller, handle); ++ set_fmp_image_info(caller); + break; + + case KERNEL_STARTED_EVENT: + ioctl_id = IOCTL_CORSTONE1000_FWU_HOST_ACK; + /*openamp call with IOCTL for kernel start*/ +- handle = psa_connect(caller, TFM_SP_PLATFORM_IOCTL_SID, +- TFM_SP_PLATFORM_IOCTL_VERSION); +- if (handle <= 0) { +- EMSG("%s Invalid handle", __func__); +- rpc_status = TS_RPC_ERROR_INVALID_PARAMETER; +- return rpc_status; +- } +- psa_call(caller,handle, PSA_IPC_CALL, ++ ++ psa_call(caller,TFM_PLATFORM_SERVICE_HANDLE, TFM_PLATFORM_API_ID_IOCTL, + in_vec,IOVEC_LEN(in_vec), NULL, 0); +- set_fmp_image_info(caller, handle); ++ set_fmp_image_info(caller); + break; + default: + EMSG("%s unsupported opcode", __func__); +diff --git a/components/service/capsule_update/provider/corstone1000_fmp_service.c b/components/service/capsule_update/provider/corstone1000_fmp_service.c +index 6a7a47a7..d811af9f 100644 +--- a/components/service/capsule_update/provider/corstone1000_fmp_service.c ++++ b/components/service/capsule_update/provider/corstone1000_fmp_service.c +@@ -238,8 +238,7 @@ static psa_status_t unpack_image_info(void *buffer, uint32_t size) + return PSA_SUCCESS; + } + +-static psa_status_t get_image_info(struct rpc_caller *caller, +- psa_handle_t platform_service_handle) ++static psa_status_t get_image_info(struct rpc_caller *caller) + { + psa_status_t status; + psa_handle_t handle; +@@ -255,7 +254,7 @@ static psa_status_t get_image_info(struct rpc_caller *caller, + + memset(image_info_buffer, 0, IMAGE_INFO_BUFFER_SIZE); + +- psa_call(caller, platform_service_handle, PSA_IPC_CALL, ++ psa_call(caller, TFM_PLATFORM_SERVICE_HANDLE, TFM_PLATFORM_API_ID_IOCTL, + in_vec, IOVEC_LEN(in_vec), out_vec, IOVEC_LEN(out_vec)); + + status = unpack_image_info(image_info_buffer, IMAGE_INFO_BUFFER_SIZE); +@@ -288,12 +287,11 @@ static psa_status_t set_image_info(struct rpc_caller *caller) + return PSA_SUCCESS; + } + +-void set_fmp_image_info(struct rpc_caller *caller, +- psa_handle_t platform_service_handle) ++void set_fmp_image_info(struct rpc_caller *caller) + { + psa_status_t status; + +- status = get_image_info(caller, platform_service_handle); ++ status = get_image_info(caller); + if (status != PSA_SUCCESS) { + return; + } +diff --git a/components/service/capsule_update/provider/corstone1000_fmp_service.h b/components/service/capsule_update/provider/corstone1000_fmp_service.h +index 95fba2a0..963223e8 100644 +--- a/components/service/capsule_update/provider/corstone1000_fmp_service.h ++++ b/components/service/capsule_update/provider/corstone1000_fmp_service.h +@@ -16,8 +16,7 @@ extern "C" { + + void provision_fmp_variables_metadata(struct rpc_caller *caller); + +-void set_fmp_image_info(struct rpc_caller *caller, +- psa_handle_t platform_service_handle); ++void set_fmp_image_info(struct rpc_caller *caller); + + #ifdef __cplusplus + } /* extern "C" */ +diff --git a/components/service/common/include/psa/sid.h b/components/service/common/include/psa/sid.h +index 7a29cc25..8103a9af 100644 +--- a/components/service/common/include/psa/sid.h ++++ b/components/service/common/include/psa/sid.h +@@ -37,6 +37,12 @@ extern "C" { + #define TFM_CRYPTO_VERSION (1U) + #define TFM_CRYPTO_HANDLE (0x40000100U) + ++ ++/******** TFM_PLATFORM_SERVICE *******/ ++#define TFM_PLATFORM_API_ID_IOCTL (1013) ++#define TFM_PLATFORM_SERVICE_HANDLE (0x40000105U) ++ ++ + /** + * \brief Define a progressive numerical value for each SID which can be used + * when dispatching the requests to the service +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/libts_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/libts_%.bbappend new file mode 100644 index 0000000000..99c03f69fd --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/libts_%.bbappend @@ -0,0 +1,5 @@ +require ts-arm-platforms.inc + +EXTRA_OECMAKE:append:corstone1000 = "-DMM_COMM_BUFFER_ADDRESS=0x02000000 \ + -DMM_COMM_BUFFER_PAGE_COUNT=1 \ + " diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/libts_git.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/libts_git.bbappend deleted file mode 100644 index a885d38797..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/libts_git.bbappend +++ /dev/null @@ -1,10 +0,0 @@ -MACHINE_TS_REQUIRE ?= "" -MACHINE_TS_REQUIRE:corstone1000 = "ts-corstone1000.inc" - -require ${MACHINE_TS_REQUIRE} - - -EXTRA_OECMAKE:append:corstone1000 = "-DMM_COMM_BUFFER_ADDRESS=0x02000000 \ - -DMM_COMM_BUFFER_PAGE_COUNT=1 \ - " - diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc new file mode 100644 index 0000000000..59009555d3 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc @@ -0,0 +1,30 @@ +FILESEXTRAPATHS:prepend:corstone1000 := "${THISDIR}/corstone1000:" + +COMPATIBLE_MACHINE:corstone1000 = "corstone1000" +SRC_URI:append:corstone1000 = " \ + file://0001-Add-openamp-to-SE-proxy-deployment.patch;patchdir=../trusted-services \ + file://0002-Implement-mhu-driver-and-the-OpenAmp-conversion-laye.patch;patchdir=../trusted-services \ + file://0003-Add-openamp-rpc-caller.patch;patchdir=../trusted-services \ + file://0004-add-psa-client-definitions-for-ff-m.patch;patchdir=../trusted-services \ + file://0005-Add-common-service-component-to-ipc-support.patch;patchdir=../trusted-services \ + file://0006-Add-secure-storage-ipc-backend.patch;patchdir=../trusted-services \ + file://0007-Use-secure-storage-ipc-and-openamp-for-se_proxy.patch;patchdir=../trusted-services \ + file://0008-Run-psa-arch-test.patch;patchdir=../trusted-services \ + file://0009-Use-address-instead-of-pointers.patch;patchdir=../trusted-services \ + file://0010-Add-psa-ipc-attestation-to-se-proxy.patch;patchdir=../trusted-services \ + file://0011-Setup-its-backend-as-openamp-rpc-using-secure-storag.patch;patchdir=../trusted-services;patchdir=../trusted-services \ + file://0012-add-psa-ipc-crypto-backend.patch;patchdir=../trusted-services \ + file://0013-Add-stub-capsule-update-service-components.patch;patchdir=../trusted-services \ + file://0014-Configure-storage-size.patch;patchdir=../trusted-services \ + file://0015-Fix-Crypto-interface-structure-aligned-with-tf-m-cha.patch;patchdir=../trusted-services;patchdir=../trusted-services \ + file://0016-Integrate-remaining-psa-ipc-client-APIs.patch;patchdir=../trusted-services \ + file://0017-Fix-update-psa_set_key_usage_flags-definition-to-the.patch;patchdir=../trusted-services;patchdir=../trusted-services \ + file://0018-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch;patchdir=../trusted-services \ + file://0019-plat-corstone1000-change-default-smm-values.patch;patchdir=../trusted-services \ + file://0020-FMP-Support-in-Corstone1000.patch;patchdir=../trusted-services \ + file://0021-smm_gateway-add-checks-for-null-attributes.patch;patchdir=../trusted-services \ + file://0022-GetNextVariableName-Fix.patch;patchdir=../trusted-services \ + file://0023-Use-the-stateless-platform-service.patch;patchdir=../trusted-services \ + " + +COMPATIBLE_MACHINE:n1sdp = "n1sdp" diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-corstone1000.inc b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-corstone1000.inc deleted file mode 100644 index e97fb5937a..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-corstone1000.inc +++ /dev/null @@ -1,26 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/corstone1000:" - -SRC_URI:append:corstone1000 = " \ - file://0001-Add-openamp-to-SE-proxy-deployment.patch;patchdir=../trusted-services \ - file://0002-Implement-mhu-driver-and-the-OpenAmp-conversion-laye.patch;patchdir=../trusted-services \ - file://0003-Add-openamp-rpc-caller.patch;patchdir=../trusted-services \ - file://0004-add-psa-client-definitions-for-ff-m.patch;patchdir=../trusted-services \ - file://0005-Add-common-service-component-to-ipc-support.patch;patchdir=../trusted-services \ - file://0006-Add-secure-storage-ipc-backend.patch;patchdir=../trusted-services \ - file://0007-Use-secure-storage-ipc-and-openamp-for-se_proxy.patch;patchdir=../trusted-services \ - file://0008-Run-psa-arch-test.patch;patchdir=../trusted-services \ - file://0009-Use-address-instead-of-pointers.patch;patchdir=../trusted-services \ - file://0010-Add-psa-ipc-attestation-to-se-proxy.patch;patchdir=../trusted-services \ - file://0011-Setup-its-backend-as-openamp-rpc-using-secure-storag.patch;patchdir=../trusted-services;patchdir=../trusted-services \ - file://0012-add-psa-ipc-crypto-backend.patch;patchdir=../trusted-services \ - file://0013-Add-stub-capsule-update-service-components.patch;patchdir=../trusted-services \ - file://0014-Configure-storage-size.patch;patchdir=../trusted-services \ - file://0015-Fix-Crypto-interface-structure-aligned-with-tf-m-cha.patch;patchdir=../trusted-services;patchdir=../trusted-services \ - file://0016-Integrate-remaining-psa-ipc-client-APIs.patch;patchdir=../trusted-services \ - file://0017-Fix-update-psa_set_key_usage_flags-definition-to-the.patch;patchdir=../trusted-services;patchdir=../trusted-services \ - file://0018-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch;patchdir=../trusted-services \ - file://0019-plat-corstone1000-change-default-smm-values.patch;patchdir=../trusted-services \ - file://0020-FMP-Support-in-Corstone1000.patch;patchdir=../trusted-services \ - file://0021-smm_gateway-add-checks-for-null-attributes.patch;patchdir=../trusted-services \ - file://0022-GetNextVariableName-Fix.patch;patchdir=../trusted-services \ - " diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-demo_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-demo_%.bbappend new file mode 100644 index 0000000000..5c9ef210ec --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-demo_%.bbappend @@ -0,0 +1 @@ +require ts-arm-platforms.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-newlib_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-newlib_%.bbappend index 845f883493..7417d9b0ba 100644 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-newlib_%.bbappend +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-newlib_%.bbappend @@ -1,6 +1,8 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/corstone1000/${PN}:" +FILESEXTRAPATHS:prepend:corstone1000 := "${THISDIR}/corstone1000/${PN}:" +COMPATIBLE_MACHINE:corstone1000 = "corstone1000" SRC_URI:append:corstone1000 = " \ file://0001-newlib-memcpy-remove-optimized-version.patch;patchdir=../newlib \ " +COMPATIBLE_MACHINE:n1sdp = "n1sdp" diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-api-test.inc b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-api-test.inc index 50ff960df5..a1f43d415c 100644 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-api-test.inc +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-api-test.inc @@ -1,6 +1,6 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/corstone1000/psa-apitest:" +FILESEXTRAPATHS:prepend:corstone1000 := "${THISDIR}/corstone1000/psa-apitest:" -include ts-corstone1000.inc +include ts-arm-platforms.inc SRC_URI:append:corstone1000 = " \ file://0001-corstone1000-port-crypto-config.patch;patchdir=../psatest \ diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-crypto-api-test_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-crypto-api-test_%.bbappend new file mode 100644 index 0000000000..ea49213e89 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-crypto-api-test_%.bbappend @@ -0,0 +1 @@ +require ts-psa-api-test.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-crypto-api-test_git.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-crypto-api-test_git.bbappend deleted file mode 100644 index ea49213e89..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-crypto-api-test_git.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ts-psa-api-test.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-iat-api-test_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-iat-api-test_%.bbappend new file mode 100644 index 0000000000..ea49213e89 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-iat-api-test_%.bbappend @@ -0,0 +1 @@ +require ts-psa-api-test.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-iat-api-test_git.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-iat-api-test_git.bbappend deleted file mode 100644 index ea49213e89..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-iat-api-test_git.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ts-psa-api-test.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-its-api-test_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-its-api-test_%.bbappend new file mode 100644 index 0000000000..ea49213e89 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-its-api-test_%.bbappend @@ -0,0 +1 @@ +require ts-psa-api-test.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-its-api-test_git.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-its-api-test_git.bbappend deleted file mode 100644 index ea49213e89..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-its-api-test_git.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ts-psa-api-test.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-ps-api-test_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-ps-api-test_%.bbappend new file mode 100644 index 0000000000..ea49213e89 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-ps-api-test_%.bbappend @@ -0,0 +1 @@ +require ts-psa-api-test.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-ps-api-test_git.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-ps-api-test_git.bbappend deleted file mode 100644 index ea49213e89..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-psa-ps-api-test_git.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ts-psa-api-test.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-service-test_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-service-test_%.bbappend new file mode 100644 index 0000000000..5c9ef210ec --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-service-test_%.bbappend @@ -0,0 +1 @@ +require ts-arm-platforms.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-attestation_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-attestation_%.bbappend new file mode 100644 index 0000000000..5c9ef210ec --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-attestation_%.bbappend @@ -0,0 +1 @@ +require ts-arm-platforms.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-crypto_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-crypto_%.bbappend new file mode 100644 index 0000000000..5c9ef210ec --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-crypto_%.bbappend @@ -0,0 +1 @@ +require ts-arm-platforms.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-its_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-its_%.bbappend new file mode 100644 index 0000000000..5c9ef210ec --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-its_%.bbappend @@ -0,0 +1 @@ +require ts-arm-platforms.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-se-proxy_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-se-proxy_%.bbappend index f39d2395f5..eba1553235 100644 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-se-proxy_%.bbappend +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-se-proxy_%.bbappend @@ -1,9 +1,5 @@ -MACHINE_TS_REQUIRE ?= "" -MACHINE_TS_REQUIRE:corstone1000 = "ts-corstone1000.inc" - -require ${MACHINE_TS_REQUIRE} +require ts-arm-platforms.inc EXTRA_OECMAKE:append:corstone1000 = " -DMM_COMM_BUFFER_ADDRESS="0x00000000 0x02000000" \ -DMM_COMM_BUFFER_PAGE_COUNT="1" \ " - diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-smm-gateway_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-smm-gateway_%.bbappend index f39d2395f5..eba1553235 100644 --- a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-smm-gateway_%.bbappend +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-smm-gateway_%.bbappend @@ -1,9 +1,5 @@ -MACHINE_TS_REQUIRE ?= "" -MACHINE_TS_REQUIRE:corstone1000 = "ts-corstone1000.inc" - -require ${MACHINE_TS_REQUIRE} +require ts-arm-platforms.inc EXTRA_OECMAKE:append:corstone1000 = " -DMM_COMM_BUFFER_ADDRESS="0x00000000 0x02000000" \ -DMM_COMM_BUFFER_PAGE_COUNT="1" \ " - diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-storage_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-storage_%.bbappend new file mode 100644 index 0000000000..5c9ef210ec --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-sp-storage_%.bbappend @@ -0,0 +1 @@ +require ts-arm-platforms.inc diff --git a/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-uefi-test_%.bbappend b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-uefi-test_%.bbappend new file mode 100644 index 0000000000..5c9ef210ec --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-security/trusted-services/ts-uefi-test_%.bbappend @@ -0,0 +1 @@ +require ts-arm-platforms.inc diff --git a/meta-arm/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc b/meta-arm/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc index 92fb038c80..675457d12f 100644 --- a/meta-arm/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc +++ b/meta-arm/meta-arm-toolchain/conf/distro/include/external-arm-toolchain-versions.inc @@ -123,7 +123,6 @@ python external_arm_toolchain_version_handler () { return d = e.data ld = d.createCopy() - ld.finalize() d.setVar('EAT_VER_MAIN', eat_get_main_version(ld)) d.setVar('EAT_VER_GCC', eat_get_gcc_version(ld)) diff --git a/meta-arm/meta-arm-toolchain/conf/distro/include/tcmode-external-arm.inc b/meta-arm/meta-arm-toolchain/conf/distro/include/tcmode-external-arm.inc index 178fb71e43..6d2189196e 100644 --- a/meta-arm/meta-arm-toolchain/conf/distro/include/tcmode-external-arm.inc +++ b/meta-arm/meta-arm-toolchain/conf/distro/include/tcmode-external-arm.inc @@ -74,7 +74,6 @@ python toolchain_metadata_setup () { d = e.data l = d.createCopy() - l.finalize() oe_import(l) external_toolchain = l.getVar('EXTERNAL_TOOLCHAIN', True) @@ -99,7 +98,6 @@ def populate_toolchain_links(d): from glob import glob d = d.createCopy() - d.finalize() pattern = bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*', d) files = glob(pattern) diff --git a/meta-arm/meta-arm/classes/apply_local_src_patches.bbclass b/meta-arm/meta-arm/classes/apply_local_src_patches.bbclass new file mode 100644 index 0000000000..e193935383 --- /dev/null +++ b/meta-arm/meta-arm/classes/apply_local_src_patches.bbclass @@ -0,0 +1,48 @@ +# This class is to be inherited by recipes where there are patches located inside +# the fetched source code which need to be applied. + +# The following variables need to be set: +# LOCAL_SRC_PATCHES_INPUT_DIR is the directory from where the patches are located +# LOCAL_SRC_PATCHES_DEST_DIR is the directory where the patches will be applied + +do_patch[depends] += "quilt-native:do_populate_sysroot" + +LOCAL_SRC_PATCHES_INPUT_DIR ??= "" +LOCAL_SRC_PATCHES_DEST_DIR ??= "${LOCAL_SRC_PATCHES_INPUT_DIR}" + +python() { + if not d.getVar('LOCAL_SRC_PATCHES_INPUT_DIR'): + bb.warn("LOCAL_SRC_PATCHES_INPUT_DIR variable needs to be set.") +} + +apply_local_src_patches() { + + input_dir="${LOCAL_SRC_PATCHES_INPUT_DIR}" + dest_dir="${LOCAL_SRC_PATCHES_DEST_DIR}" + + if [ ! -d "$input_dir" ] ; then + bbfatal "LOCAL_SRC_PATCHES_INPUT_DIR=$input_dir not found." + fi + + if [ ! -d "$dest_dir" ] ; then + bbfatal "LOCAL_SRC_PATCHES_DEST_DIR=$dest_dir not found." + fi + + cd $dest_dir + export QUILT_PATCHES=./patches-extra + mkdir -p patches-extra + + for patch in $(find $input_dir -type f -name *.patch -or -name *.diff | sort) + do + patch_basename=`basename $patch` + if ! quilt applied $patch_basename >/dev/null ; then + bbdebug 1 "Applying $patch_basename in $dest_dir." + echo $patch_basename >> patches-extra/series + cp $patch patches-extra + quilt push $patch_basename + else + bbdebug 1 "$patch_basename already applied." + fi + done +} +do_patch[postfuncs] += "apply_local_src_patches" diff --git a/meta-arm/meta-arm/classes/fvpboot.bbclass b/meta-arm/meta-arm/classes/fvpboot.bbclass index 78dabd7369..508deb29c9 100644 --- a/meta-arm/meta-arm/classes/fvpboot.bbclass +++ b/meta-arm/meta-arm/classes/fvpboot.bbclass @@ -24,7 +24,9 @@ FVP_CONSOLES[default] ?= "${FVP_CONSOLE}" # Arbitrary extra arguments FVP_EXTRA_ARGS ?= "" # Bitbake variables to pass to the FVP environment -FVP_ENV_PASSTHROUGH ?= "" +FVP_ENV_PASSTHROUGH ?= "FASTSIM_DISABLE_TA" +# Disable timing annotation by default +FASTSIM_DISABLE_TA ?= "1" EXTRA_IMAGEDEPENDS += "${FVP_PROVIDER}" diff --git a/meta-arm/meta-arm/conf/machine/qemuarm-secureboot.conf b/meta-arm/meta-arm/conf/machine/qemuarm-secureboot.conf index f08b84fe5e..db02dc6891 100644 --- a/meta-arm/meta-arm/conf/machine/qemuarm-secureboot.conf +++ b/meta-arm/meta-arm/conf/machine/qemuarm-secureboot.conf @@ -21,3 +21,6 @@ WKS_FILE_DEPENDS = "trusted-firmware-a" IMAGE_BOOT_FILES = "${KERNEL_IMAGETYPE}" MACHINE_FEATURES += "optee-ftpm" + +PREFERRED_VERSION_optee-os ?= "3.18.%" + diff --git a/meta-arm/meta-arm/conf/machine/qemuarm64-secureboot.conf b/meta-arm/meta-arm/conf/machine/qemuarm64-secureboot.conf index 55c4cab457..7277817ddf 100644 --- a/meta-arm/meta-arm/conf/machine/qemuarm64-secureboot.conf +++ b/meta-arm/meta-arm/conf/machine/qemuarm64-secureboot.conf @@ -23,3 +23,6 @@ WKS_FILE_DEPENDS = "trusted-firmware-a" IMAGE_BOOT_FILES = "${KERNEL_IMAGETYPE}" MACHINE_FEATURES += "optee-ftpm" + +PREFERRED_VERSION_optee-os ?= "3.18.%" + diff --git a/meta-arm/meta-arm/lib/fvp/runner.py b/meta-arm/meta-arm/lib/fvp/runner.py index f55c579d7e..4fd624ba67 100644 --- a/meta-arm/meta-arm/lib/fvp/runner.py +++ b/meta-arm/meta-arm/lib/fvp/runner.py @@ -70,6 +70,13 @@ class ConsolePortParser: pass +# This function is backported from Python 3.8. Remove it and replace call sites +# with shlex.join once OE-core support for earlier Python versions is dropped. +def shlex_join(split_command): + """Return a shell-escaped string from *split_command*.""" + return ' '.join(shlex.quote(arg) for arg in split_command) + + class FVPRunner: def __init__(self, logger): self._logger = logger @@ -88,7 +95,7 @@ class FVPRunner: if name in os.environ: env[name] = os.environ[name] - self._logger.debug(f"Constructed FVP call: {shlex.join(cli)}") + self._logger.debug(f"Constructed FVP call: {shlex_join(cli)}") self._fvp_process = subprocess.Popen( cli, stdin=subprocess.DEVNULL, stdout=stdout, stderr=subprocess.STDOUT, diff --git a/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.0.bb b/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.0.bb deleted file mode 100644 index c10efd5a62..0000000000 --- a/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.0.bb +++ /dev/null @@ -1,145 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (c) 2020 Arm Limited -# - -SUMMARY = "Trusted Firmware for Cortex-M" -DESCRIPTION = "Trusted Firmware-M" -HOMEPAGE = "https://git.trustedfirmware.org/trusted-firmware-m.git" -PROVIDES = "virtual/trusted-firmware-m" - -LICENSE = "BSD-3-Clause & Apache-2.0" - -LIC_FILES_CHKSUM = "file://license.rst;md5=07f368487da347f3c7bd0fc3085f3afa \ - file://../tf-m-tests/license.rst;md5=02d06ffb8d9f099ff4961c0cb0183a18 \ - file://../mbedtls/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \ - file://../mcuboot/LICENSE;md5=b6ee33f1d12a5e6ee3de1e82fb51eeb8" - -SRC_URI = "git://git.trustedfirmware.org/TF-M/trusted-firmware-m.git;protocol=https;branch=${SRCBRANCH_tfm};name=tfm;destsuffix=git/tfm \ - git://git.trustedfirmware.org/TF-M/tf-m-tests.git;protocol=https;branch=${SRCBRANCH_tfm-tests};name=tfm-tests;destsuffix=git/tf-m-tests \ - git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=${SRCBRANCH_mbedtls};name=mbedtls;destsuffix=git/mbedtls \ - git://github.com/mcu-tools/mcuboot.git;protocol=https;branch=${SRCBRANCH_mcuboot};name=mcuboot;destsuffix=git/mcuboot \ - " - -# The required dependencies are documented in tf-m/config/config_default.cmake -# TF-Mv1.6.0 -SRCBRANCH_tfm ?= "release/1.6.x" -SRCREV_tfm = "7387d88158701a3c51ad51c90a05326ee12847a8" -# mbedtls-3.1.0 -SRCBRANCH_mbedtls ?= "master" -SRCREV_mbedtls = "d65aeb37349ad1a50e0f6c9b694d4b5290d60e49" -# TF-Mv1.6.0 -SRCBRANCH_tfm-tests ?= "release/1.6.x" -SRCREV_tfm-tests = "723905d46019596f3f2df66d79b5d6bff6f3f213" -# v1.9.0 -SRCBRANCH_mcuboot ?= "main" -SRCREV_mcuboot = "c657cbea75f2bb1faf1fceacf972a0537a8d26dd" - -UPSTREAM_CHECK_GITTAGREGEX = "^TF-Mv(?P\d+(\.\d+)+)$" - -# Note to future readers of this recipe: until the CMakeLists don't abuse -# installation (see do_install) there is no point in trying to inherit -# cmake here. You can easily short-circuit the toolchain but the install -# is so convoluted there's no gain. - -inherit python3native deploy - -# Baremetal and we bring a compiler below -INHIBIT_DEFAULT_DEPS = "1" - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -DEPENDS += "cmake-native \ - ninja-native \ - gcc-arm-none-eabi-native \ - python3-intelhex-native \ - python3-jinja2-native \ - python3-pyyaml-native \ - python3-click-native \ - python3-cryptography-native \ - python3-cbor2-native" - -S = "${WORKDIR}/git/tfm" -B = "${WORKDIR}/build" - -# Build for debug (set TFM_DEBUG to 1 to activate) -TFM_DEBUG ?= "0" - -# Platform must be set, ideally in the machine configuration. -TFM_PLATFORM ?= "" -python() { - if not d.getVar("TFM_PLATFORM"): - raise bb.parse.SkipRecipe("TFM_PLATFORM needs to be set") -} - -PACKAGECONFIG ??= "" -# Whether to integrate the test suite -PACKAGECONFIG[test-secure] = "-DTEST_S=ON,-DTEST_S=OFF" -PACKAGECONFIG[test-nonsecure] = "-DTEST_NS=ON,-DTEST_NS=OFF" - -# Currently we only support using the Arm binary GCC -EXTRA_OECMAKE += "-DTFM_TOOLCHAIN_FILE=${S}/toolchain_GNUARM.cmake" - -# Don't let FetchContent download more sources during do_configure -EXTRA_OECMAKE += "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" - -# Add platform parameters -EXTRA_OECMAKE += "-DTFM_PLATFORM=${TFM_PLATFORM}" - -# Handle TFM_DEBUG parameter -EXTRA_OECMAKE += "${@bb.utils.contains('TFM_DEBUG', '1', '-DCMAKE_BUILD_TYPE=Debug', '', d)}" - -# Verbose builds -EXTRA_OECMAKE += "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" - -EXTRA_OECMAKE += "-DMBEDCRYPTO_PATH=${S}/../mbedtls -DTFM_TEST_REPO_PATH=${S}/../tf-m-tests -DMCUBOOT_PATH=${S}/../mcuboot" - -export CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, False)}" - -# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application -CFLAGS[unexport] = "1" -LDFLAGS[unexport] = "1" -AS[unexport] = "1" -LD[unexport] = "1" - -# python3-cryptography needs the legacy provider, so set OPENSSL_MODULES to the -# right path until this is relocated automatically. -export OPENSSL_MODULES="${STAGING_LIBDIR_NATIVE}/ossl-modules" - -# TF-M ships patches that it needs applied to mbedcrypto, so apply them -# as part of do_patch. -apply_local_patches() { - cat ${S}/lib/ext/mbedcrypto/*.patch | patch -p1 -d ${S}/../mbedtls -} -do_patch[postfuncs] += "apply_local_patches" - -do_configure[cleandirs] = "${B}" -do_configure() { - cmake -GNinja -S ${S} -B ${B} ${EXTRA_OECMAKE} ${PACKAGECONFIG_CONFARGS} -} - -# Invoke install here as there's no point in splitting compile from install: the -# first thing the build does is 'install' inside the build tree thus causing a -# rebuild. It also overrides the install prefix to be in the build tree, so you -# can't use the usual install prefix variables. -do_compile() { - cmake --build ${B} -- install -} -do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+" - -do_install() { - # TODO install headers and static libraries when we know how they're used - install -d -m 755 ${D}/firmware - install -m 0644 ${B}/bin/* ${D}/firmware/ -} - -FILES:${PN} = "/firmware" -SYSROOT_DIRS += "/firmware" - -addtask deploy after do_install -do_deploy() { - cp -rf ${D}/firmware/* ${DEPLOYDIR}/ -} - -# Build paths are currently embedded -INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.0.bb b/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.0.bb new file mode 100644 index 0000000000..3b4469d097 --- /dev/null +++ b/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.0.bb @@ -0,0 +1,142 @@ +# SPDX-License-Identifier: MIT +# +# Copyright (c) 2020 Arm Limited +# + +SUMMARY = "Trusted Firmware for Cortex-M" +DESCRIPTION = "Trusted Firmware-M" +HOMEPAGE = "https://git.trustedfirmware.org/trusted-firmware-m.git" +PROVIDES = "virtual/trusted-firmware-m" + +LICENSE = "BSD-2-Clause & BSD-3-Clause & Apache-2.0" + +LIC_FILES_CHKSUM = "file://license.rst;md5=07f368487da347f3c7bd0fc3085f3afa \ + file://../tf-m-tests/license.rst;md5=02d06ffb8d9f099ff4961c0cb0183a18 \ + file://../mbedtls/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \ + file://../mcuboot/LICENSE;md5=b6ee33f1d12a5e6ee3de1e82fb51eeb8" + +SRC_URI = "git://git.trustedfirmware.org/TF-M/trusted-firmware-m.git;protocol=https;branch=${SRCBRANCH_tfm};name=tfm;destsuffix=git/tfm \ + git://git.trustedfirmware.org/TF-M/tf-m-tests.git;protocol=https;branch=${SRCBRANCH_tfm-tests};name=tfm-tests;destsuffix=git/tf-m-tests \ + git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=${SRCBRANCH_mbedtls};name=mbedtls;destsuffix=git/mbedtls \ + git://github.com/mcu-tools/mcuboot.git;protocol=https;branch=${SRCBRANCH_mcuboot};name=mcuboot;destsuffix=git/mcuboot \ + git://github.com/laurencelundblade/QCBOR.git;protocol=https;branch=${SRCBRANCH_qcbor};name=qcbor;destsuffix=git/qcbor \ + " + +# The required dependencies are documented in tf-m/config/config_default.cmake +# TF-Mv1.7.0 +SRCBRANCH_tfm ?= "release/1.7.x" +SRCREV_tfm = "b725a1346cdb9ec75b1adcdc4c84705881e8fd4e" +# mbedtls-3.2.0 +SRCBRANCH_mbedtls ?= "master" +SRCREV_mbedtls = "869298bffeea13b205343361b7a7daf2b210e33d" +# TF-Mv1.6.0 +SRCBRANCH_tfm-tests ?= "release/1.7.x" +SRCREV_tfm-tests = "4972e8df3fcbd386a5b0c18613d8a803f4dda082" +# v1.9.0 +SRCBRANCH_mcuboot ?= "main" +SRCREV_mcuboot = "c657cbea75f2bb1faf1fceacf972a0537a8d26dd" +# qcbor +SRCBRANCH_qcbor ?= "master" +SRCREV_qcbor = "b0e7033268e88c9f27146fa9a1415ef4c19ebaff" + +UPSTREAM_CHECK_GITTAGREGEX = "^TF-Mv(?P\d+(\.\d+)+)$" + +# Note to future readers of this recipe: until the CMakeLists don't abuse +# installation (see do_install) there is no point in trying to inherit +# cmake here. You can easily short-circuit the toolchain but the install +# is so convoluted there's no gain. + +inherit python3native deploy + +# Baremetal and we bring a compiler below +INHIBIT_DEFAULT_DEPS = "1" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +DEPENDS += "cmake-native \ + ninja-native \ + gcc-arm-none-eabi-native \ + python3-intelhex-native \ + python3-jinja2-native \ + python3-pyyaml-native \ + python3-click-native \ + python3-cryptography-native \ + python3-cbor2-native" + +S = "${WORKDIR}/git/tfm" +B = "${WORKDIR}/build" + +# Build for debug (set TFM_DEBUG to 1 to activate) +TFM_DEBUG ?= "0" + +# Platform must be set, ideally in the machine configuration. +TFM_PLATFORM ?= "" +python() { + if not d.getVar("TFM_PLATFORM"): + raise bb.parse.SkipRecipe("TFM_PLATFORM needs to be set") +} + +PACKAGECONFIG ??= "" +# Whether to integrate the test suite +PACKAGECONFIG[test-secure] = "-DTEST_S=ON,-DTEST_S=OFF" +PACKAGECONFIG[test-nonsecure] = "-DTEST_NS=ON,-DTEST_NS=OFF" + +# Currently we only support using the Arm binary GCC +EXTRA_OECMAKE += "-DTFM_TOOLCHAIN_FILE=${S}/toolchain_GNUARM.cmake" + +# Don't let FetchContent download more sources during do_configure +EXTRA_OECMAKE += "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" + +# Add platform parameters +EXTRA_OECMAKE += "-DTFM_PLATFORM=${TFM_PLATFORM}" + +# Handle TFM_DEBUG parameter +EXTRA_OECMAKE += "${@bb.utils.contains('TFM_DEBUG', '1', '-DCMAKE_BUILD_TYPE=Debug', '-DCMAKE_BUILD_TYPE=Release', d)}" + +# Verbose builds +EXTRA_OECMAKE += "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" + +EXTRA_OECMAKE += "-DMBEDCRYPTO_PATH=${S}/../mbedtls -DTFM_TEST_REPO_PATH=${S}/../tf-m-tests -DMCUBOOT_PATH=${S}/../mcuboot -DQCBOR_PATH=${S}/../qcbor" + +export CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, False)}" + +# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application +CFLAGS[unexport] = "1" +LDFLAGS[unexport] = "1" +AS[unexport] = "1" +LD[unexport] = "1" + +# python3-cryptography needs the legacy provider, so set OPENSSL_MODULES to the +# right path until this is relocated automatically. +export OPENSSL_MODULES="${STAGING_LIBDIR_NATIVE}/ossl-modules" + +do_configure[cleandirs] = "${B}" +do_configure() { + cmake -GNinja -S ${S} -B ${B} ${EXTRA_OECMAKE} ${PACKAGECONFIG_CONFARGS} +} + +# Invoke install here as there's no point in splitting compile from install: the +# first thing the build does is 'install' inside the build tree thus causing a +# rebuild. It also overrides the install prefix to be in the build tree, so you +# can't use the usual install prefix variables. +do_compile() { + cmake --build ${B} -- install +} +do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+" + +do_install() { + # TODO install headers and static libraries when we know how they're used + install -d -m 755 ${D}/firmware + install -m 0644 ${B}/bin/* ${D}/firmware/ +} + +FILES:${PN} = "/firmware" +SYSROOT_DIRS += "/firmware" + +addtask deploy after do_install +do_deploy() { + cp -rf ${D}/firmware/* ${DEPLOYDIR}/ +} + +# Build paths are currently embedded +INSANE_SKIP:${PN} += "buildpaths" diff --git a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-a-aem_11.18.16.bb b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-a-aem_11.18.16.bb deleted file mode 100644 index 4d8519e3f4..0000000000 --- a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-a-aem_11.18.16.bb +++ /dev/null @@ -1,10 +0,0 @@ -require fvp-envelope.inc - -SUMMARY = "Arm Fixed Virtual Platform - Armv-A Base RevC Architecture Envelope Model FVP" -LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=1a33828e132ba71861c11688dbb0bd16 \ - file://license_terms/third_party_licenses/third_party_licenses.txt;md5=34a1ba318d745f05e6197def68ea5411 \ - file://license_terms/third_party_licenses/arm_license_management_utilities/third_party_licenses.txt;md5=2e53bda6ff2db4c35d69944b93926c9f" - -SRC_URI[sha256sum] = "fe76f9ff217a44ed7680a0a6ccd6bd19758f5e0466ff98ccd82b2ae62289b9fe" - -MODEL_CODE = "FVP_Base_RevC-2xAEMvA" diff --git a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-a-aem_11.20.15.bb b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-a-aem_11.20.15.bb new file mode 100644 index 0000000000..4c62822ed1 --- /dev/null +++ b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-a-aem_11.20.15.bb @@ -0,0 +1,13 @@ +require fvp-envelope.inc + +SUMMARY = "Arm Fixed Virtual Platform - Armv-A Base RevC Architecture Envelope Model FVP" +LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=1a33828e132ba71861c11688dbb0bd16 \ + file://license_terms/third_party_licenses/third_party_licenses.txt;md5=34a1ba318d745f05e6197def68ea5411 \ + file://license_terms/third_party_licenses/arm_license_management_utilities/third_party_licenses.txt;md5=2e53bda6ff2db4c35d69944b93926c9f" + +SRC_URI[fvp-aarch64.sha256sum] = "e14e6cbd5c3ec8e1e2e79965e994c9235e136480e102f5c43de31162263b6361" +SRC_URI[fvp-x86_64.sha256sum] = "f9db2076e3a63e2f8eb2ea9ed60f30db04e5f81f535bc7e3ed24e270d857ea6f" + +MODEL_CODE = "FVP_Base_RevC-2xAEMvA" + +COMPATIBLE_HOST = "(aarch64|x86_64).*-linux" diff --git a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-r-aem_11.19.14.bb b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-r-aem_11.19.14.bb deleted file mode 100644 index 3ef089121e..0000000000 --- a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-r-aem_11.19.14.bb +++ /dev/null @@ -1,10 +0,0 @@ -require fvp-envelope.inc - -SUMMARY = "Arm Fixed Virtual Platform - Armv8-R Base Architecture Envelope Model FVP" -LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=1a33828e132ba71861c11688dbb0bd16 \ - file://license_terms/third_party_licenses/third_party_licenses.txt;md5=34a1ba318d745f05e6197def68ea5411 \ - file://license_terms/third_party_licenses/arm_license_management_utilities/third_party_licenses.txt;md5=2e53bda6ff2db4c35d69944b93926c9f" - -SRC_URI[sha256sum] = "788ede659414af36a2d09489e400c4d822c859b726565f1f171bc3102a9413d0" - -MODEL_CODE = "FVP_Base_AEMv8R" diff --git a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-r-aem_11.20.15.bb b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-r-aem_11.20.15.bb new file mode 100644 index 0000000000..3f8139ca4a --- /dev/null +++ b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-base-r-aem_11.20.15.bb @@ -0,0 +1,10 @@ +require fvp-envelope.inc + +SUMMARY = "Arm Fixed Virtual Platform - Armv8-R Base Architecture Envelope Model FVP" +LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=1a33828e132ba71861c11688dbb0bd16 \ + file://license_terms/third_party_licenses/third_party_licenses.txt;md5=34a1ba318d745f05e6197def68ea5411 \ + file://license_terms/third_party_licenses/arm_license_management_utilities/third_party_licenses.txt;md5=2e53bda6ff2db4c35d69944b93926c9f" + +SRC_URI[fvp-x86_64.sha256sum] = "c252616489b79fffa3bb721255b1c99ff4ee8c38e4beebce4fa05862a3195fe9" + +MODEL_CODE = "FVP_Base_AEMv8R" diff --git a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-corstone1000.bb b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-corstone1000.bb index 35ffe0b797..7d556616f0 100644 --- a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-corstone1000.bb +++ b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-corstone1000.bb @@ -2,10 +2,10 @@ require fvp-ecosystem.inc MODEL = "Corstone-1000-23" MODEL_CODE = "FVP_Corstone_1000" -PV = "11.17_23" +PV = "11.19_21" -SRC_URI = "https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/${MODEL}/Linux/${MODEL_CODE}_${PV}.tgz;subdir=${BP}" -SRC_URI[sha256sum] = "00ccb72d02c90e2424d24a625d275cabf8ea8dc024713985208f618bb88d1934" +SRC_URI = "https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/${MODEL}/Linux/${MODEL_CODE}_${PV}_${FVP_ARCH}.tgz;subdir=${BP}" +SRC_URI[sha256sum] = "dbdcb8b0c206fd56fd2296fe338a62902eb978883ba07f4da28440e180383b24" LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=1a33828e132ba71861c11688dbb0bd16 \ - file://license_terms/third_party_licenses.txt;md5=41029e71051b1c786bae3112a29905a7" + file://license_terms/third_party_licenses/third_party_licenses.txt;md5=34a1ba318d745f05e6197def68ea5411" diff --git a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-envelope.inc b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-envelope.inc index 887d9d27fb..1e8bb40728 100644 --- a/meta-arm/meta-arm/recipes-devtools/fvp/fvp-envelope.inc +++ b/meta-arm/meta-arm/recipes-devtools/fvp/fvp-envelope.inc @@ -1,8 +1,8 @@ require fvp-common.inc -HOMEPAGE = "https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms/arm-ecosystem-models" +HOMEPAGE = "https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms" -SRC_URI = "https://developer.arm.com/-/media/Files/downloads/ecosystem-models/${MODEL_CODE}_${PV_URL}_${FVP_ARCH}.tgz;subdir=${BP}" +SRC_URI = "https://developer.arm.com/-/media/Files/downloads/ecosystem-models/${MODEL_CODE}_${PV_URL}_${FVP_ARCH}.tgz;subdir=${BP};name=fvp-${HOST_ARCH}" UPSTREAM_CHECK_URI = "${HOMEPAGE}" UPSTREAM_CHECK_REGEX = "${MODEL_CODE}_(?P(\d+[\.\-_]*)+).tgz" diff --git a/meta-arm/meta-arm/recipes-devtools/gn/gn/0001-Replace-lstat64-stat64-functions-on-linux.patch b/meta-arm/meta-arm/recipes-devtools/gn/gn/0001-Replace-lstat64-stat64-functions-on-linux.patch new file mode 100644 index 0000000000..159fbaaf96 --- /dev/null +++ b/meta-arm/meta-arm/recipes-devtools/gn/gn/0001-Replace-lstat64-stat64-functions-on-linux.patch @@ -0,0 +1,60 @@ +From 25786d356ac391124489f2e55690281c03fa83db Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 22 Dec 2022 00:30:55 -0800 +Subject: [PATCH] Replace lstat64/stat64 functions on linux + +we define -D_FILE_OFFSET_BITS=64 which means lstat is operating on 64bit +off_t and is same as lstat64, same for stat and stat64 case. + +This fixes build with musl where off_t has always been 64bit + +Upstream-Status: Submitted [https://gn-review.googlesource.com/c/gn/+/14960] +Signed-off-by: Khem Raj +--- + src/base/files/file.h | 2 +- + src/base/files/file_posix.cc | 2 +- + src/base/files/file_util_posix.cc | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/base/files/file.h b/src/base/files/file.h +index 2c94eb4e..99e87ed9 100644 +--- a/src/base/files/file.h ++++ b/src/base/files/file.h +@@ -23,7 +23,7 @@ namespace base { + + #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \ + defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) || \ +- defined(OS_ANDROID) && __ANDROID_API__ < 21 ++ defined(OS_LINUX) || defined(OS_ANDROID) && __ANDROID_API__ < 21 + typedef struct stat stat_wrapper_t; + #elif defined(OS_POSIX) || defined(OS_FUCHSIA) + typedef struct stat64 stat_wrapper_t; +diff --git a/src/base/files/file_posix.cc b/src/base/files/file_posix.cc +index b1f9f5e8..049568f0 100644 +--- a/src/base/files/file_posix.cc ++++ b/src/base/files/file_posix.cc +@@ -26,7 +26,7 @@ namespace { + + #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \ + defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) || \ +- defined(OS_ANDROID) && __ANDROID_API__ < 21 ++ defined(OS_LINUX) || defined(OS_ANDROID) && __ANDROID_API__ < 21 + int CallFstat(int fd, stat_wrapper_t* sb) { + return fstat(fd, sb); + } +diff --git a/src/base/files/file_util_posix.cc b/src/base/files/file_util_posix.cc +index aa54731d..53be3d3b 100644 +--- a/src/base/files/file_util_posix.cc ++++ b/src/base/files/file_util_posix.cc +@@ -61,7 +61,7 @@ namespace { + + #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \ + defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) || \ +- defined(OS_ANDROID) && __ANDROID_API__ < 21 ++ defined(OS_LINUX) || defined(OS_ANDROID) && __ANDROID_API__ < 21 + int CallStat(const char* path, stat_wrapper_t* sb) { + return stat(path, sb); + } +-- +2.39.0 + diff --git a/meta-arm/meta-arm/recipes-devtools/gn/gn_git.bb b/meta-arm/meta-arm/recipes-devtools/gn/gn_git.bb index 8d1efb6508..521e33e9ae 100644 --- a/meta-arm/meta-arm/recipes-devtools/gn/gn_git.bb +++ b/meta-arm/meta-arm/recipes-devtools/gn/gn_git.bb @@ -4,7 +4,8 @@ DEPENDS += "ninja-native" LICENSE = "BSD-3-Clause" LIC_FILES_CHKSUM = "file://LICENSE;md5=0fca02217a5d49a14dfe2d11837bb34d" -SRC_URI = "git://gn.googlesource.com/gn;protocol=https;branch=main" +SRC_URI = "git://gn.googlesource.com/gn;protocol=https;branch=main \ + file://0001-Replace-lstat64-stat64-functions-on-linux.patch" SRCREV = "bf4e17dc67b2a2007475415e3f9e1d1cf32f6e35" PV = "0+git${SRCPV}" diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0001-core-Define-section-attributes-for-clang.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0001-core-Define-section-attributes-for-clang.patch new file mode 100644 index 0000000000..a69d77761d --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0001-core-Define-section-attributes-for-clang.patch @@ -0,0 +1,230 @@ +From f189457b79989543f65b8a4e8729eff2cdf9a758 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 13 Aug 2022 19:24:55 -0700 +Subject: [PATCH] core: Define section attributes for clang + +Clang's attribute section is not same as gcc, here we need to add flags +to sections so they can be eventually collected by linker into final +output segments. Only way to do so with clang is to use + +pragma clang section ... + +The behavious is described here [1], this allows us to define names bss +sections. This was not an issue until clang-15 where LLD linker starts +to detect the section flags before merging them and throws the following +errors + +| ld.lld: error: section type mismatch for .nozi.kdata_page +| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/kernel/thread.o:(.nozi.kdata_page): SHT_PROGBITS +| >>> output section .nozi: SHT_NOBITS +| +| ld.lld: error: section type mismatch for .nozi.mmu.l2 +| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/mm/core_mmu_lpae.o:(.nozi.mmu.l2): SHT_PROGBITS +| >>> output section .nozi: SHT_NOBITS + +These sections should be carrying SHT_NOBITS but so far it was not +possible to do so, this patch tries to use clangs pragma to get this +going and match the functionality with gcc. + +[1] https://intel.github.io/llvm-docs/clang/LanguageExtensions.html#specifying-section-names-for-global-objects-pragma-clang-section + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + core/arch/arm/kernel/thread.c | 19 +++++++++++++++-- + core/arch/arm/mm/core_mmu_lpae.c | 35 ++++++++++++++++++++++++++++---- + core/arch/arm/mm/pgt_cache.c | 12 ++++++++++- + core/kernel/thread.c | 13 +++++++++++- + 4 files changed, 71 insertions(+), 8 deletions(-) + +--- a/core/arch/arm/kernel/thread.c ++++ b/core/arch/arm/kernel/thread.c +@@ -44,16 +44,31 @@ static size_t thread_user_kcode_size __n + #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \ + defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64) + long thread_user_kdata_sp_offset __nex_bss; ++#ifdef __clang__ ++#ifndef CFG_VIRTUALIZATION ++#pragma clang section bss=".nozi.kdata_page" ++#else ++#pragma clang section bss=".nex_nozi.kdata_page" ++#endif ++#endif + static uint8_t thread_user_kdata_page[ + ROUNDUP(sizeof(struct thread_core_local) * CFG_TEE_CORE_NB_CORE, + SMALL_PAGE_SIZE)] + __aligned(SMALL_PAGE_SIZE) ++#ifndef __clang__ + #ifndef CFG_VIRTUALIZATION +- __section(".nozi.kdata_page"); ++ __section(".nozi.kdata_page") + #else +- __section(".nex_nozi.kdata_page"); ++ __section(".nex_nozi.kdata_page") + #endif + #endif ++ ; ++#endif ++ ++/* reset BSS section to default ( .bss ) */ ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + #ifdef ARM32 + uint32_t __nostackcheck thread_get_exceptions(void) +--- a/core/arch/arm/mm/core_mmu_lpae.c ++++ b/core/arch/arm/mm/core_mmu_lpae.c +@@ -233,19 +233,46 @@ typedef uint16_t l1_idx_t; + typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES]; + typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES]; + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.base_table" ++#endif + static base_xlat_tbls_t base_xlation_table[NUM_BASE_TABLES] + __aligned(NUM_BASE_LEVEL_ENTRIES * XLAT_ENTRY_SIZE) +- __section(".nozi.mmu.base_table"); ++#ifndef __clang__ ++ __section(".nozi.mmu.base_table") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static xlat_tbl_t xlat_tables[MAX_XLAT_TABLES] +- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); ++ __aligned(XLAT_TABLE_SIZE) ++#ifndef __clang__ ++ __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + #define XLAT_TABLES_SIZE (sizeof(xlat_tbl_t) * MAX_XLAT_TABLES) + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + /* MMU L2 table for TAs, one for each thread */ + static xlat_tbl_t xlat_tables_ul1[CFG_NUM_THREADS] +- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); +- ++#ifndef __clang__ ++ __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + /* + * TAs page table entry inside a level 1 page table. + * +--- a/core/arch/arm/mm/pgt_cache.c ++++ b/core/arch/arm/mm/pgt_cache.c +@@ -104,8 +104,18 @@ void pgt_init(void) + * has a large alignment, while .bss has a small alignment. The current + * link script is optimized for small alignment in .bss + */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE] +- __aligned(PGT_SIZE) __section(".nozi.pgt_cache"); ++ __aligned(PGT_SIZE) ++#ifndef __clang__ ++ __section(".nozi.pgt_cache") ++#endif ++ ; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + size_t n; + + for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) { +--- a/core/kernel/thread.c ++++ b/core/kernel/thread.c +@@ -37,13 +37,24 @@ struct thread_core_local thread_core_loc + name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1] + #endif + ++#define DO_PRAGMA(x) _Pragma (#x) ++ ++#ifdef __clang__ ++#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ ++DO_PRAGMA (clang section bss=".nozi_stack." #name) \ ++linkage uint32_t name[num_stacks] \ ++ [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ ++ STACK_ALIGNMENT) / sizeof(uint32_t)] \ ++ __attribute__((aligned(STACK_ALIGNMENT))); \ ++DO_PRAGMA(clang section bss="") ++#else + #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ + linkage uint32_t name[num_stacks] \ + [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ + STACK_ALIGNMENT) / sizeof(uint32_t)] \ + __attribute__((section(".nozi_stack." # name), \ + aligned(STACK_ALIGNMENT))) +- ++#endif + #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack)) + + DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, +--- a/core/arch/arm/mm/core_mmu_v7.c ++++ b/core/arch/arm/mm/core_mmu_v7.c +@@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_EN + typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES]; + typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES]; + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l1" ++#endif + static l1_xlat_tbl_t main_mmu_l1_ttb +- __aligned(L1_ALIGNMENT) __section(".nozi.mmu.l1"); ++ __aligned(L1_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.l1") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + /* L2 MMU tables */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static l2_xlat_tbl_t main_mmu_l2_ttb[MAX_XLAT_TABLES] +- __aligned(L2_ALIGNMENT) __section(".nozi.mmu.l2"); ++ __aligned(L2_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + /* MMU L1 table for TAs, one for each thread */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.ul1" ++#endif + static ul1_xlat_tbl_t main_mmu_ul1_ttb[CFG_NUM_THREADS] +- __aligned(UL1_ALIGNMENT) __section(".nozi.mmu.ul1"); ++ __aligned(UL1_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.ul1") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + struct mmu_partition { + l1_xlat_tbl_t *l1_table; diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch new file mode 100644 index 0000000000..ab4a6dbc0a --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch @@ -0,0 +1,35 @@ +From 528aeb42652a3159c1bfd51d6c1442c3ff27b84c Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Tue, 26 May 2020 14:38:02 -0500 +Subject: [PATCH] allow setting sysroot for libgcc lookup + +Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching +for the compiler libraries as there's no easy way to reliably pass --sysroot +otherwise. + +Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188] +Signed-off-by: Ross Burton + +--- + mk/gcc.mk | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/mk/gcc.mk b/mk/gcc.mk +index adc77a24..81bfa78a 100644 +--- a/mk/gcc.mk ++++ b/mk/gcc.mk +@@ -13,11 +13,11 @@ nostdinc$(sm) := -nostdinc -isystem $(shell $(CC$(sm)) \ + -print-file-name=include 2> /dev/null) + + # Get location of libgcc from gcc +-libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ ++libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ + -print-libgcc-file-name 2> /dev/null) +-libstdc++$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ ++libstdc++$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ + -print-file-name=libstdc++.a 2> /dev/null) +-libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ ++libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ + -print-file-name=libgcc_eh.a 2> /dev/null) + + # Define these to something to discover accidental use diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0007-allow-setting-sysroot-for-clang.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0007-allow-setting-sysroot-for-clang.patch new file mode 100644 index 0000000000..067ba6ebfb --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0007-allow-setting-sysroot-for-clang.patch @@ -0,0 +1,30 @@ +From db9e44af75c7cfd3316cab15aaa387383df3e57e Mon Sep 17 00:00:00 2001 +From: Brett Warren +Date: Wed, 23 Sep 2020 09:27:34 +0100 +Subject: [PATCH] optee: enable clang support + +When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used +to provide a sysroot wasn't included, which results in not locating +compiler-rt. This is mitigated by including the variable as ammended. + +Upstream-Status: Pending +ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 +Signed-off-by: Brett Warren + +--- + mk/clang.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mk/clang.mk b/mk/clang.mk +index c141a3f2..7d067cc0 100644 +--- a/mk/clang.mk ++++ b/mk/clang.mk +@@ -27,7 +27,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \ + + # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of + # libgcc for clang +-libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ ++libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ + -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) + + # Core ASLR relies on the executable being ready to run from its preferred load diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0008-no-warn-rwx-segments.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0008-no-warn-rwx-segments.patch new file mode 100644 index 0000000000..6d48a7601b --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0008-no-warn-rwx-segments.patch @@ -0,0 +1,65 @@ +From cf2a2451f4e9300532d677bb3a8315494a3b3a82 Mon Sep 17 00:00:00 2001 +From: Jerome Forissier +Date: Fri, 5 Aug 2022 09:48:03 +0200 +Subject: [PATCH] core: link: add --no-warn-rwx-segments + +Signed-off-by: Anton Antonov +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5474] + +binutils ld.bfd generates one RWX LOAD segment by merging several sections +with mixed R/W/X attributes (.text, .rodata, .data). After version 2.38 it +also warns by default when that happens [1], which breaks the build due to +--fatal-warnings. The RWX segment is not a problem for the TEE core, since +that information is not used to set memory permissions. Therefore, silence +the warning. + +Link: [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 +Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29448 +Reported-by: Dominique Martinet +Signed-off-by: Jerome Forissier +Acked-by: Jens Wiklander + +--- + core/arch/arm/kernel/link.mk | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk +index 7eed333a..c39d43cb 100644 +--- a/core/arch/arm/kernel/link.mk ++++ b/core/arch/arm/kernel/link.mk +@@ -31,6 +31,7 @@ link-ldflags += -T $(link-script-pp) -Map=$(link-out-dir)/tee.map + link-ldflags += --sort-section=alignment + link-ldflags += --fatal-warnings + link-ldflags += --gc-sections ++link-ldflags += $(call ld-option,--no-warn-rwx-segments) + + link-ldadd = $(LDADD) + link-ldadd += $(ldflags-external) +@@ -55,6 +56,7 @@ link-script-cppflags := \ + $(cppflagscore)) + + ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ ++ $(call ld-option,--no-warn-rwx-segments) \ + $(link-objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/all_objs.o + $(link-out-dir)/all_objs.o: $(objs) $(libdeps) $(MAKEFILE_LIST) +@@ -67,7 +69,8 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o + $(q)$(NMcore) $< | \ + $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ + +-unpaged-ldargs = -T $(link-script-dummy) --no-check-sections --gc-sections ++unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ ++ $(call ld-option,--no-warn-rwx-segments) + unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/unpaged.o + $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt +@@ -95,7 +98,8 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o + $(q)$(NMcore) $< | \ + $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ + +-init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections ++init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ ++ $(call ld-option,--no-warn-rwx-segments) + init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ + $(libgcccore) + cleanfiles += $(link-out-dir)/init.o diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0009-add-z-execstack.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0009-add-z-execstack.patch new file mode 100644 index 0000000000..3ba6c4ef38 --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0009-add-z-execstack.patch @@ -0,0 +1,94 @@ +From ea932656461865ab9ac4036245c756c082aeb3e1 Mon Sep 17 00:00:00 2001 +From: Jerome Forissier +Date: Tue, 23 Aug 2022 11:41:00 +0000 +Subject: [PATCH] core, ldelf: link: add -z execstack + +When building for arm32 with GNU binutils 2.39, the linker outputs +warnings when generating some TEE core binaries (all_obj.o, init.o, +unpaged.o and tee.elf) as well as ldelf.elf: + + arm-poky-linux-gnueabi-ld.bfd: warning: atomic_a32.o: missing .note.GNU-stack section implies executable stack + arm-poky-linux-gnueabi-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker + +The permissions used when mapping the TEE core stacks do not depend on +any metadata found in the ELF file. Similarly when the TEE core loads +ldelf it already creates a non-executable stack regardless of ELF +information. Therefore we can safely ignore the warnings. This is done +by adding the '-z execstack' option. + +Signed-off-by: Jerome Forissier + +Signed-off-by: Anton Antonov +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] + +--- + core/arch/arm/kernel/link.mk | 13 +++++++++---- + ldelf/link.mk | 3 +++ + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk +index c39d43cb..0e96e606 100644 +--- a/core/arch/arm/kernel/link.mk ++++ b/core/arch/arm/kernel/link.mk +@@ -9,6 +9,11 @@ link-script-dep = $(link-out-dir)/.kern.ld.d + + AWK = awk + ++link-ldflags-common += $(call ld-option,--no-warn-rwx-segments) ++ifeq ($(CFG_ARM32_core),y) ++link-ldflags-common += $(call ld-option,--no-warn-execstack) ++endif ++ + link-ldflags = $(LDFLAGS) + ifeq ($(CFG_CORE_ASLR),y) + link-ldflags += -pie -Bsymbolic -z norelro $(ldflag-apply-dynamic-relocs) +@@ -31,7 +36,7 @@ link-ldflags += -T $(link-script-pp) -Map=$(link-out-dir)/tee.map + link-ldflags += --sort-section=alignment + link-ldflags += --fatal-warnings + link-ldflags += --gc-sections +-link-ldflags += $(call ld-option,--no-warn-rwx-segments) ++link-ldflags += $(link-ldflags-common) + + link-ldadd = $(LDADD) + link-ldadd += $(ldflags-external) +@@ -56,7 +61,7 @@ link-script-cppflags := \ + $(cppflagscore)) + + ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ +- $(call ld-option,--no-warn-rwx-segments) \ ++ $(link-ldflags-common) \ + $(link-objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/all_objs.o + $(link-out-dir)/all_objs.o: $(objs) $(libdeps) $(MAKEFILE_LIST) +@@ -70,7 +75,7 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o + $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ + + unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ +- $(call ld-option,--no-warn-rwx-segments) ++ $(link-ldflags-common) + unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/unpaged.o + $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt +@@ -99,7 +104,7 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o + $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ + + init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ +- $(call ld-option,--no-warn-rwx-segments) ++ $(link-ldflags-common) + init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ + $(libgcccore) + cleanfiles += $(link-out-dir)/init.o +diff --git a/ldelf/link.mk b/ldelf/link.mk +index 64c8212a..bd49551e 100644 +--- a/ldelf/link.mk ++++ b/ldelf/link.mk +@@ -20,6 +20,9 @@ link-ldflags += -z max-page-size=4096 # OP-TEE always uses 4K alignment + ifeq ($(CFG_CORE_BTI),y) + link-ldflags += $(call ld-option,-z force-bti) --fatal-warnings + endif ++ifeq ($(CFG_ARM32_$(sm)), y) ++link-ldflags += $(call ld-option,--no-warn-execstack) ++endif + link-ldflags += $(link-ldflags$(sm)) + + link-ldadd = $(addprefix -L,$(libdirs)) diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0010-add-note-GNU-stack-section.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0010-add-note-GNU-stack-section.patch new file mode 100644 index 0000000000..4ea65d88cc --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.18.0/0010-add-note-GNU-stack-section.patch @@ -0,0 +1,128 @@ +From ec30e84671aac9a2e9549754eb7bc6201728db4c Mon Sep 17 00:00:00 2001 +From: Jerome Forissier +Date: Tue, 23 Aug 2022 12:31:46 +0000 +Subject: [PATCH] arm32: libutils, libutee, ta: add .note.GNU-stack section to + + .S files + +When building for arm32 with GNU binutils 2.39, the linker outputs +warnings when linking Trusted Applications: + + arm-unknown-linux-uclibcgnueabihf-ld.bfd: warning: utee_syscalls_a32.o: missing .note.GNU-stack section implies executable stack + arm-unknown-linux-uclibcgnueabihf-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker + +We could silence the warning by adding the '-z execstack' option to the +TA link flags, like we did in the parent commit for the TEE core and +ldelf. Indeed, ldelf always allocates a non-executable piece of memory +for the TA to use as a stack. + +However it seems preferable to comply with the common ELF practices in +this case. A better fix is therefore to add the missing .note.GNU-stack +sections in the assembler files. + +Signed-off-by: Jerome Forissier + +Signed-off-by: Anton Antonov +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] + +--- + lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++ + lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++ + lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/setjmp_a32.S | 2 ++ + ta/arch/arm/ta_entry_a32.S | 2 ++ + 7 files changed, 14 insertions(+) + +diff --git a/lib/libutee/arch/arm/utee_syscalls_a32.S b/lib/libutee/arch/arm/utee_syscalls_a32.S +index 6e621ca6..af405f62 100644 +--- a/lib/libutee/arch/arm/utee_syscalls_a32.S ++++ b/lib/libutee/arch/arm/utee_syscalls_a32.S +@@ -7,6 +7,8 @@ + #include + #include + ++ .section .note.GNU-stack,"",%progbits ++ + .section .text + .balign 4 + .code 32 +diff --git a/lib/libutils/ext/arch/arm/atomic_a32.S b/lib/libutils/ext/arch/arm/atomic_a32.S +index eaef6914..2be73ffa 100644 +--- a/lib/libutils/ext/arch/arm/atomic_a32.S ++++ b/lib/libutils/ext/arch/arm/atomic_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* uint32_t atomic_inc32(uint32_t *v); */ + FUNC atomic_inc32 , : + ldrex r1, [r0] +diff --git a/lib/libutils/ext/arch/arm/mcount_a32.S b/lib/libutils/ext/arch/arm/mcount_a32.S +index 51439a23..54dc3c02 100644 +--- a/lib/libutils/ext/arch/arm/mcount_a32.S ++++ b/lib/libutils/ext/arch/arm/mcount_a32.S +@@ -7,6 +7,8 @@ + + #if defined(CFG_TA_GPROF_SUPPORT) || defined(CFG_FTRACE_SUPPORT) + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * Convert return address to call site address by subtracting the size of the + * mcount call instruction (blx __gnu_mcount_nc). +diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S +index a600c879..37ae9ec6 100644 +--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S ++++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * signed ret_idivmod_values(signed quot, signed rem); + * return quotient and remaining the EABI way (regs r0,r1) +diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S +index 2dc50bc9..5c3353e2 100644 +--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S ++++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d) + */ +diff --git a/lib/libutils/isoc/arch/arm/setjmp_a32.S b/lib/libutils/isoc/arch/arm/setjmp_a32.S +index 43ea5937..f8a0b70d 100644 +--- a/lib/libutils/isoc/arch/arm/setjmp_a32.S ++++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S +@@ -51,6 +51,8 @@ + #define SIZE(x) + #endif + ++ .section .note.GNU-stack,"",%progbits ++ + /* Arm/Thumb interworking support: + + The interworking scheme expects functions to use a BX instruction +diff --git a/ta/arch/arm/ta_entry_a32.S b/ta/arch/arm/ta_entry_a32.S +index d2f8a69d..cd9a12f9 100644 +--- a/ta/arch/arm/ta_entry_a32.S ++++ b/ta/arch/arm/ta_entry_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * This function is the bottom of the user call stack. Mark it as such so that + * the unwinding code won't try to go further down. diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0001-core-Define-section-attributes-for-clang.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0001-core-Define-section-attributes-for-clang.patch new file mode 100644 index 0000000000..a1dc251a2d --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0001-core-Define-section-attributes-for-clang.patch @@ -0,0 +1,243 @@ +From ff1b556ac2cd6bbb857a1ac03e0557eb490bc845 Mon Sep 17 00:00:00 2001 +From: Emekcan Aras +Date: Wed, 21 Dec 2022 10:55:58 +0000 +Subject: [PATCH] [PATCH] core: Define section attributes for clang + +Clang's attribute section is not same as gcc, here we need to add flags +to sections so they can be eventually collected by linker into final +output segments. Only way to do so with clang is to use + +pragma clang section ... + +The behavious is described here [1], this allows us to define names bss +sections. This was not an issue until clang-15 where LLD linker starts +to detect the section flags before merging them and throws the following +errors + +| ld.lld: error: section type mismatch for .nozi.kdata_page +| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/kernel/thread.o:(.nozi.kdata_page): SHT_PROGBITS +| >>> output section .nozi: SHT_NOBITS +| +| ld.lld: error: section type mismatch for .nozi.mmu.l2 +| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/mm/core_mmu_lpae.o:(.nozi.mmu.l2): SHT_PROGBITS +| >>> output section .nozi: SHT_NOBITS + +These sections should be carrying SHT_NOBITS but so far it was not +possible to do so, this patch tries to use clangs pragma to get this +going and match the functionality with gcc. + +[1] https://intel.github.io/llvm-docs/clang/LanguageExtensions.html#specifying-section-names-for-global-objects-pragma-clang-section + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + core/arch/arm/kernel/thread.c | 19 +++++++++++++++-- + core/arch/arm/mm/core_mmu_lpae.c | 35 +++++++++++++++++++++++++++---- + core/arch/arm/mm/core_mmu_v7.c | 36 +++++++++++++++++++++++++++++--- + core/arch/arm/mm/pgt_cache.c | 12 ++++++++++- + core/kernel/thread.c | 13 +++++++++++- + 5 files changed, 104 insertions(+), 11 deletions(-) + +diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c +index 05dbbe56..8e6ea034 100644 +--- a/core/arch/arm/kernel/thread.c ++++ b/core/arch/arm/kernel/thread.c +@@ -44,15 +44,30 @@ static size_t thread_user_kcode_size __nex_bss; + #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \ + defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64) + long thread_user_kdata_sp_offset __nex_bss; ++#ifdef __clang__ ++#ifndef CFG_VIRTUALIZATION ++#pragma clang section bss=".nozi.kdata_page" ++#else ++#pragma clang section bss=".nex_nozi.kdata_page" ++#endif ++#endif + static uint8_t thread_user_kdata_page[ + ROUNDUP(sizeof(struct thread_core_local) * CFG_TEE_CORE_NB_CORE, + SMALL_PAGE_SIZE)] + __aligned(SMALL_PAGE_SIZE) ++#ifndef __clang__ + #ifndef CFG_VIRTUALIZATION +- __section(".nozi.kdata_page"); ++ __section(".nozi.kdata_page") + #else +- __section(".nex_nozi.kdata_page"); ++ __section(".nex_nozi.kdata_page") + #endif ++#endif ++ ; ++#endif ++ ++/* reset BSS section to default ( .bss ) */ ++#ifdef __clang__ ++#pragma clang section bss="" + #endif + + #ifdef ARM32 +diff --git a/core/arch/arm/mm/core_mmu_lpae.c b/core/arch/arm/mm/core_mmu_lpae.c +index 3f08eec6..e6dc9261 100644 +--- a/core/arch/arm/mm/core_mmu_lpae.c ++++ b/core/arch/arm/mm/core_mmu_lpae.c +@@ -233,19 +233,46 @@ typedef uint16_t l1_idx_t; + typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES]; + typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES]; + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.base_table" ++#endif + static base_xlat_tbls_t base_xlation_table[NUM_BASE_TABLES] + __aligned(NUM_BASE_LEVEL_ENTRIES * XLAT_ENTRY_SIZE) +- __section(".nozi.mmu.base_table"); ++#ifndef __clang__ ++ __section(".nozi.mmu.base_table") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static xlat_tbl_t xlat_tables[MAX_XLAT_TABLES] +- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); ++ __aligned(XLAT_TABLE_SIZE) ++#ifndef __clang__ ++ __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + #define XLAT_TABLES_SIZE (sizeof(xlat_tbl_t) * MAX_XLAT_TABLES) + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + /* MMU L2 table for TAs, one for each thread */ + static xlat_tbl_t xlat_tables_ul1[CFG_NUM_THREADS] +- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); +- ++#ifndef __clang__ ++ __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + /* + * TAs page table entry inside a level 1 page table. + * +diff --git a/core/arch/arm/mm/core_mmu_v7.c b/core/arch/arm/mm/core_mmu_v7.c +index cd85bd22..3e18f54f 100644 +--- a/core/arch/arm/mm/core_mmu_v7.c ++++ b/core/arch/arm/mm/core_mmu_v7.c +@@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_ENTRIES]; + typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES]; + typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES]; + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l1" ++#endif + static l1_xlat_tbl_t main_mmu_l1_ttb +- __aligned(L1_ALIGNMENT) __section(".nozi.mmu.l1"); ++ __aligned(L1_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.l1") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + /* L2 MMU tables */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static l2_xlat_tbl_t main_mmu_l2_ttb[MAX_XLAT_TABLES] +- __aligned(L2_ALIGNMENT) __section(".nozi.mmu.l2"); ++ __aligned(L2_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + /* MMU L1 table for TAs, one for each thread */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.ul1" ++#endif + static ul1_xlat_tbl_t main_mmu_ul1_ttb[CFG_NUM_THREADS] +- __aligned(UL1_ALIGNMENT) __section(".nozi.mmu.ul1"); ++ __aligned(UL1_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.ul1") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + struct mmu_partition { + l1_xlat_tbl_t *l1_table; +diff --git a/core/arch/arm/mm/pgt_cache.c b/core/arch/arm/mm/pgt_cache.c +index a7b1b10e..489859ce 100644 +--- a/core/arch/arm/mm/pgt_cache.c ++++ b/core/arch/arm/mm/pgt_cache.c +@@ -410,8 +410,18 @@ void pgt_init(void) + * has a large alignment, while .bss has a small alignment. The current + * link script is optimized for small alignment in .bss + */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE] +- __aligned(PGT_SIZE) __section(".nozi.pgt_cache"); ++ __aligned(PGT_SIZE) ++#ifndef __clang__ ++ __section(".nozi.pgt_cache") ++#endif ++ ; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + size_t n; + + for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) { +diff --git a/core/kernel/thread.c b/core/kernel/thread.c +index d1f2f382..8de124ae 100644 +--- a/core/kernel/thread.c ++++ b/core/kernel/thread.c +@@ -38,13 +38,24 @@ struct thread_core_local thread_core_local[CFG_TEE_CORE_NB_CORE] __nex_bss; + name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1] + #endif + ++#define DO_PRAGMA(x) _Pragma (#x) ++ ++#ifdef __clang__ ++#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ ++DO_PRAGMA (clang section bss=".nozi_stack." #name) \ ++linkage uint32_t name[num_stacks] \ ++ [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ ++ STACK_ALIGNMENT) / sizeof(uint32_t)] \ ++ __attribute__((aligned(STACK_ALIGNMENT))); \ ++DO_PRAGMA(clang section bss="") ++#else + #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ + linkage uint32_t name[num_stacks] \ + [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ + STACK_ALIGNMENT) / sizeof(uint32_t)] \ + __attribute__((section(".nozi_stack." # name), \ + aligned(STACK_ALIGNMENT))) +- ++#endif + #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack)) + + DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, STACK_TMP_SIZE, +-- +2.17.1 + diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch new file mode 100644 index 0000000000..ab4a6dbc0a --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch @@ -0,0 +1,35 @@ +From 528aeb42652a3159c1bfd51d6c1442c3ff27b84c Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Tue, 26 May 2020 14:38:02 -0500 +Subject: [PATCH] allow setting sysroot for libgcc lookup + +Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching +for the compiler libraries as there's no easy way to reliably pass --sysroot +otherwise. + +Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188] +Signed-off-by: Ross Burton + +--- + mk/gcc.mk | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/mk/gcc.mk b/mk/gcc.mk +index adc77a24..81bfa78a 100644 +--- a/mk/gcc.mk ++++ b/mk/gcc.mk +@@ -13,11 +13,11 @@ nostdinc$(sm) := -nostdinc -isystem $(shell $(CC$(sm)) \ + -print-file-name=include 2> /dev/null) + + # Get location of libgcc from gcc +-libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ ++libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ + -print-libgcc-file-name 2> /dev/null) +-libstdc++$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ ++libstdc++$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ + -print-file-name=libstdc++.a 2> /dev/null) +-libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ ++libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ + -print-file-name=libgcc_eh.a 2> /dev/null) + + # Define these to something to discover accidental use diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0007-allow-setting-sysroot-for-clang.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0007-allow-setting-sysroot-for-clang.patch new file mode 100644 index 0000000000..067ba6ebfb --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0007-allow-setting-sysroot-for-clang.patch @@ -0,0 +1,30 @@ +From db9e44af75c7cfd3316cab15aaa387383df3e57e Mon Sep 17 00:00:00 2001 +From: Brett Warren +Date: Wed, 23 Sep 2020 09:27:34 +0100 +Subject: [PATCH] optee: enable clang support + +When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used +to provide a sysroot wasn't included, which results in not locating +compiler-rt. This is mitigated by including the variable as ammended. + +Upstream-Status: Pending +ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 +Signed-off-by: Brett Warren + +--- + mk/clang.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mk/clang.mk b/mk/clang.mk +index c141a3f2..7d067cc0 100644 +--- a/mk/clang.mk ++++ b/mk/clang.mk +@@ -27,7 +27,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \ + + # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of + # libgcc for clang +-libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ ++libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ + -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) + + # Core ASLR relies on the executable being ready to run from its preferred load diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0008-no-warn-rwx-segments.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0008-no-warn-rwx-segments.patch new file mode 100644 index 0000000000..2dc797b36f --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0008-no-warn-rwx-segments.patch @@ -0,0 +1,38 @@ +diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk +index 0e96e606c..3fbcb6804 100644 +--- a/core/arch/arm/kernel/link.mk ++++ b/core/arch/arm/kernel/link.mk +@@ -37,6 +37,7 @@ link-ldflags += --sort-section=alignment + link-ldflags += --fatal-warnings + link-ldflags += --gc-sections + link-ldflags += $(link-ldflags-common) ++link-ldflags += $(call ld-option,--no-warn-rwx-segments) + + link-ldadd = $(LDADD) + link-ldadd += $(ldflags-external) +@@ -61,6 +62,7 @@ link-script-cppflags := \ + $(cppflagscore)) + + ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ ++ $(call ld-option,--no-warn-rwx-segments) \ + $(link-ldflags-common) \ + $(link-objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/all_objs.o +@@ -75,7 +77,7 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o + $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ + + unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ +- $(link-ldflags-common) ++ $(link-ldflags-common) $(call ld-option,--no-warn-rwx-segments) + unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/unpaged.o + $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt +@@ -104,7 +106,7 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o + $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ + + init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ +- $(link-ldflags-common) ++ $(link-ldflags-common) $(call ld-option,--no-warn-rwx-segments) + init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ + $(libgcccore) + cleanfiles += $(link-out-dir)/init.o diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0009-add-z-execstack.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0009-add-z-execstack.patch new file mode 100644 index 0000000000..3ba6c4ef38 --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0009-add-z-execstack.patch @@ -0,0 +1,94 @@ +From ea932656461865ab9ac4036245c756c082aeb3e1 Mon Sep 17 00:00:00 2001 +From: Jerome Forissier +Date: Tue, 23 Aug 2022 11:41:00 +0000 +Subject: [PATCH] core, ldelf: link: add -z execstack + +When building for arm32 with GNU binutils 2.39, the linker outputs +warnings when generating some TEE core binaries (all_obj.o, init.o, +unpaged.o and tee.elf) as well as ldelf.elf: + + arm-poky-linux-gnueabi-ld.bfd: warning: atomic_a32.o: missing .note.GNU-stack section implies executable stack + arm-poky-linux-gnueabi-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker + +The permissions used when mapping the TEE core stacks do not depend on +any metadata found in the ELF file. Similarly when the TEE core loads +ldelf it already creates a non-executable stack regardless of ELF +information. Therefore we can safely ignore the warnings. This is done +by adding the '-z execstack' option. + +Signed-off-by: Jerome Forissier + +Signed-off-by: Anton Antonov +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] + +--- + core/arch/arm/kernel/link.mk | 13 +++++++++---- + ldelf/link.mk | 3 +++ + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk +index c39d43cb..0e96e606 100644 +--- a/core/arch/arm/kernel/link.mk ++++ b/core/arch/arm/kernel/link.mk +@@ -9,6 +9,11 @@ link-script-dep = $(link-out-dir)/.kern.ld.d + + AWK = awk + ++link-ldflags-common += $(call ld-option,--no-warn-rwx-segments) ++ifeq ($(CFG_ARM32_core),y) ++link-ldflags-common += $(call ld-option,--no-warn-execstack) ++endif ++ + link-ldflags = $(LDFLAGS) + ifeq ($(CFG_CORE_ASLR),y) + link-ldflags += -pie -Bsymbolic -z norelro $(ldflag-apply-dynamic-relocs) +@@ -31,7 +36,7 @@ link-ldflags += -T $(link-script-pp) -Map=$(link-out-dir)/tee.map + link-ldflags += --sort-section=alignment + link-ldflags += --fatal-warnings + link-ldflags += --gc-sections +-link-ldflags += $(call ld-option,--no-warn-rwx-segments) ++link-ldflags += $(link-ldflags-common) + + link-ldadd = $(LDADD) + link-ldadd += $(ldflags-external) +@@ -56,7 +61,7 @@ link-script-cppflags := \ + $(cppflagscore)) + + ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ +- $(call ld-option,--no-warn-rwx-segments) \ ++ $(link-ldflags-common) \ + $(link-objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/all_objs.o + $(link-out-dir)/all_objs.o: $(objs) $(libdeps) $(MAKEFILE_LIST) +@@ -70,7 +75,7 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o + $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ + + unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ +- $(call ld-option,--no-warn-rwx-segments) ++ $(link-ldflags-common) + unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/unpaged.o + $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt +@@ -99,7 +104,7 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o + $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ + + init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ +- $(call ld-option,--no-warn-rwx-segments) ++ $(link-ldflags-common) + init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ + $(libgcccore) + cleanfiles += $(link-out-dir)/init.o +diff --git a/ldelf/link.mk b/ldelf/link.mk +index 64c8212a..bd49551e 100644 +--- a/ldelf/link.mk ++++ b/ldelf/link.mk +@@ -20,6 +20,9 @@ link-ldflags += -z max-page-size=4096 # OP-TEE always uses 4K alignment + ifeq ($(CFG_CORE_BTI),y) + link-ldflags += $(call ld-option,-z force-bti) --fatal-warnings + endif ++ifeq ($(CFG_ARM32_$(sm)), y) ++link-ldflags += $(call ld-option,--no-warn-execstack) ++endif + link-ldflags += $(link-ldflags$(sm)) + + link-ldadd = $(addprefix -L,$(libdirs)) diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0010-add-note-GNU-stack-section.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0010-add-note-GNU-stack-section.patch new file mode 100644 index 0000000000..4ea65d88cc --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3.19.0/0010-add-note-GNU-stack-section.patch @@ -0,0 +1,128 @@ +From ec30e84671aac9a2e9549754eb7bc6201728db4c Mon Sep 17 00:00:00 2001 +From: Jerome Forissier +Date: Tue, 23 Aug 2022 12:31:46 +0000 +Subject: [PATCH] arm32: libutils, libutee, ta: add .note.GNU-stack section to + + .S files + +When building for arm32 with GNU binutils 2.39, the linker outputs +warnings when linking Trusted Applications: + + arm-unknown-linux-uclibcgnueabihf-ld.bfd: warning: utee_syscalls_a32.o: missing .note.GNU-stack section implies executable stack + arm-unknown-linux-uclibcgnueabihf-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker + +We could silence the warning by adding the '-z execstack' option to the +TA link flags, like we did in the parent commit for the TEE core and +ldelf. Indeed, ldelf always allocates a non-executable piece of memory +for the TA to use as a stack. + +However it seems preferable to comply with the common ELF practices in +this case. A better fix is therefore to add the missing .note.GNU-stack +sections in the assembler files. + +Signed-off-by: Jerome Forissier + +Signed-off-by: Anton Antonov +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] + +--- + lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++ + lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++ + lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/setjmp_a32.S | 2 ++ + ta/arch/arm/ta_entry_a32.S | 2 ++ + 7 files changed, 14 insertions(+) + +diff --git a/lib/libutee/arch/arm/utee_syscalls_a32.S b/lib/libutee/arch/arm/utee_syscalls_a32.S +index 6e621ca6..af405f62 100644 +--- a/lib/libutee/arch/arm/utee_syscalls_a32.S ++++ b/lib/libutee/arch/arm/utee_syscalls_a32.S +@@ -7,6 +7,8 @@ + #include + #include + ++ .section .note.GNU-stack,"",%progbits ++ + .section .text + .balign 4 + .code 32 +diff --git a/lib/libutils/ext/arch/arm/atomic_a32.S b/lib/libutils/ext/arch/arm/atomic_a32.S +index eaef6914..2be73ffa 100644 +--- a/lib/libutils/ext/arch/arm/atomic_a32.S ++++ b/lib/libutils/ext/arch/arm/atomic_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* uint32_t atomic_inc32(uint32_t *v); */ + FUNC atomic_inc32 , : + ldrex r1, [r0] +diff --git a/lib/libutils/ext/arch/arm/mcount_a32.S b/lib/libutils/ext/arch/arm/mcount_a32.S +index 51439a23..54dc3c02 100644 +--- a/lib/libutils/ext/arch/arm/mcount_a32.S ++++ b/lib/libutils/ext/arch/arm/mcount_a32.S +@@ -7,6 +7,8 @@ + + #if defined(CFG_TA_GPROF_SUPPORT) || defined(CFG_FTRACE_SUPPORT) + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * Convert return address to call site address by subtracting the size of the + * mcount call instruction (blx __gnu_mcount_nc). +diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S +index a600c879..37ae9ec6 100644 +--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S ++++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * signed ret_idivmod_values(signed quot, signed rem); + * return quotient and remaining the EABI way (regs r0,r1) +diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S +index 2dc50bc9..5c3353e2 100644 +--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S ++++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d) + */ +diff --git a/lib/libutils/isoc/arch/arm/setjmp_a32.S b/lib/libutils/isoc/arch/arm/setjmp_a32.S +index 43ea5937..f8a0b70d 100644 +--- a/lib/libutils/isoc/arch/arm/setjmp_a32.S ++++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S +@@ -51,6 +51,8 @@ + #define SIZE(x) + #endif + ++ .section .note.GNU-stack,"",%progbits ++ + /* Arm/Thumb interworking support: + + The interworking scheme expects functions to use a BX instruction +diff --git a/ta/arch/arm/ta_entry_a32.S b/ta/arch/arm/ta_entry_a32.S +index d2f8a69d..cd9a12f9 100644 +--- a/ta/arch/arm/ta_entry_a32.S ++++ b/ta/arch/arm/ta_entry_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * This function is the bottom of the user call stack. Mark it as such so that + * the unwinding code won't try to go further down. diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-3_19.inc b/meta-arm/meta-arm/recipes-security/optee/optee-os-3_19.inc new file mode 100644 index 0000000000..8adb6996d0 --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-3_19.inc @@ -0,0 +1,82 @@ +SUMMARY = "OP-TEE Trusted OS" +DESCRIPTION = "Open Portable Trusted Execution Environment - Trusted side of the TEE" +HOMEPAGE = "https://www.op-tee.org/" + +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173" + +inherit deploy python3native +require optee.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os-3_19:" + +CVE_PRODUCT = "linaro:op-tee op-tee:op-tee_os" + +DEPENDS = "python3-pyelftools-native python3-cryptography-native" + +DEPENDS:append:toolchain-clang = " compiler-rt" + +SRC_URI = "git://github.com/OP-TEE/optee_os.git;branch=master;protocol=https" + +SRC_URI:append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ + file://0008-no-warn-rwx-segments.patch \ + " + +S = "${WORKDIR}/git" +B = "${WORKDIR}/build" + +EXTRA_OEMAKE += " \ + PLATFORM=${OPTEEMACHINE} \ + CFG_${OPTEE_CORE}_core=y \ + CROSS_COMPILE_core=${HOST_PREFIX} \ + CROSS_COMPILE_ta_${OPTEE_ARCH}=${HOST_PREFIX} \ + NOWERROR=1 \ + ta-targets=ta_${OPTEE_ARCH} \ + O=${B} \ +" +EXTRA_OEMAKE += " HOST_PREFIX=${HOST_PREFIX}" +EXTRA_OEMAKE += " CROSS_COMPILE64=${HOST_PREFIX}" + +CFLAGS[unexport] = "1" +LDFLAGS[unexport] = "1" +CPPFLAGS[unexport] = "1" +AS[unexport] = "1" +LD[unexport] = "1" + +do_compile:prepend() { + PLAT_LIBGCC_PATH=$(${CC} -print-libgcc-file-name) +} + +do_compile() { + oe_runmake -C ${S} all +} +do_compile[cleandirs] = "${B}" + +do_install() { + #install core in firmware + install -d ${D}${nonarch_base_libdir}/firmware/ + install -m 644 ${B}/core/*.bin ${B}/core/tee.elf ${D}${nonarch_base_libdir}/firmware/ +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_deploy() { + install -d ${DEPLOYDIR}/${MLPREFIX}optee + install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/${MLPREFIX}optee +} + +addtask deploy before do_build after do_install + +SYSROOT_DIRS += "${nonarch_base_libdir}/firmware" + +FILES:${PN} = "${nonarch_base_libdir}/firmware/" + +# note: "textrel" is not triggered on all archs +INSANE_SKIP:${PN} = "textrel" +# Build paths are currently embedded +INSANE_SKIP:${PN} += "buildpaths" +INSANE_SKIP:${PN}-dev = "staticdev" +INHIBIT_PACKAGE_STRIP = "1" + diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0001-core-Define-section-attributes-for-clang.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0001-core-Define-section-attributes-for-clang.patch new file mode 100644 index 0000000000..a69d77761d --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0001-core-Define-section-attributes-for-clang.patch @@ -0,0 +1,230 @@ +From f189457b79989543f65b8a4e8729eff2cdf9a758 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 13 Aug 2022 19:24:55 -0700 +Subject: [PATCH] core: Define section attributes for clang + +Clang's attribute section is not same as gcc, here we need to add flags +to sections so they can be eventually collected by linker into final +output segments. Only way to do so with clang is to use + +pragma clang section ... + +The behavious is described here [1], this allows us to define names bss +sections. This was not an issue until clang-15 where LLD linker starts +to detect the section flags before merging them and throws the following +errors + +| ld.lld: error: section type mismatch for .nozi.kdata_page +| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/kernel/thread.o:(.nozi.kdata_page): SHT_PROGBITS +| >>> output section .nozi: SHT_NOBITS +| +| ld.lld: error: section type mismatch for .nozi.mmu.l2 +| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/mm/core_mmu_lpae.o:(.nozi.mmu.l2): SHT_PROGBITS +| >>> output section .nozi: SHT_NOBITS + +These sections should be carrying SHT_NOBITS but so far it was not +possible to do so, this patch tries to use clangs pragma to get this +going and match the functionality with gcc. + +[1] https://intel.github.io/llvm-docs/clang/LanguageExtensions.html#specifying-section-names-for-global-objects-pragma-clang-section + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + core/arch/arm/kernel/thread.c | 19 +++++++++++++++-- + core/arch/arm/mm/core_mmu_lpae.c | 35 ++++++++++++++++++++++++++++---- + core/arch/arm/mm/pgt_cache.c | 12 ++++++++++- + core/kernel/thread.c | 13 +++++++++++- + 4 files changed, 71 insertions(+), 8 deletions(-) + +--- a/core/arch/arm/kernel/thread.c ++++ b/core/arch/arm/kernel/thread.c +@@ -44,16 +44,31 @@ static size_t thread_user_kcode_size __n + #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \ + defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64) + long thread_user_kdata_sp_offset __nex_bss; ++#ifdef __clang__ ++#ifndef CFG_VIRTUALIZATION ++#pragma clang section bss=".nozi.kdata_page" ++#else ++#pragma clang section bss=".nex_nozi.kdata_page" ++#endif ++#endif + static uint8_t thread_user_kdata_page[ + ROUNDUP(sizeof(struct thread_core_local) * CFG_TEE_CORE_NB_CORE, + SMALL_PAGE_SIZE)] + __aligned(SMALL_PAGE_SIZE) ++#ifndef __clang__ + #ifndef CFG_VIRTUALIZATION +- __section(".nozi.kdata_page"); ++ __section(".nozi.kdata_page") + #else +- __section(".nex_nozi.kdata_page"); ++ __section(".nex_nozi.kdata_page") + #endif + #endif ++ ; ++#endif ++ ++/* reset BSS section to default ( .bss ) */ ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + #ifdef ARM32 + uint32_t __nostackcheck thread_get_exceptions(void) +--- a/core/arch/arm/mm/core_mmu_lpae.c ++++ b/core/arch/arm/mm/core_mmu_lpae.c +@@ -233,19 +233,46 @@ typedef uint16_t l1_idx_t; + typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES]; + typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES]; + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.base_table" ++#endif + static base_xlat_tbls_t base_xlation_table[NUM_BASE_TABLES] + __aligned(NUM_BASE_LEVEL_ENTRIES * XLAT_ENTRY_SIZE) +- __section(".nozi.mmu.base_table"); ++#ifndef __clang__ ++ __section(".nozi.mmu.base_table") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static xlat_tbl_t xlat_tables[MAX_XLAT_TABLES] +- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); ++ __aligned(XLAT_TABLE_SIZE) ++#ifndef __clang__ ++ __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + #define XLAT_TABLES_SIZE (sizeof(xlat_tbl_t) * MAX_XLAT_TABLES) + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + /* MMU L2 table for TAs, one for each thread */ + static xlat_tbl_t xlat_tables_ul1[CFG_NUM_THREADS] +- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); +- ++#ifndef __clang__ ++ __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + /* + * TAs page table entry inside a level 1 page table. + * +--- a/core/arch/arm/mm/pgt_cache.c ++++ b/core/arch/arm/mm/pgt_cache.c +@@ -104,8 +104,18 @@ void pgt_init(void) + * has a large alignment, while .bss has a small alignment. The current + * link script is optimized for small alignment in .bss + */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE] +- __aligned(PGT_SIZE) __section(".nozi.pgt_cache"); ++ __aligned(PGT_SIZE) ++#ifndef __clang__ ++ __section(".nozi.pgt_cache") ++#endif ++ ; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + size_t n; + + for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) { +--- a/core/kernel/thread.c ++++ b/core/kernel/thread.c +@@ -37,13 +37,24 @@ struct thread_core_local thread_core_loc + name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1] + #endif + ++#define DO_PRAGMA(x) _Pragma (#x) ++ ++#ifdef __clang__ ++#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ ++DO_PRAGMA (clang section bss=".nozi_stack." #name) \ ++linkage uint32_t name[num_stacks] \ ++ [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ ++ STACK_ALIGNMENT) / sizeof(uint32_t)] \ ++ __attribute__((aligned(STACK_ALIGNMENT))); \ ++DO_PRAGMA(clang section bss="") ++#else + #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ + linkage uint32_t name[num_stacks] \ + [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ + STACK_ALIGNMENT) / sizeof(uint32_t)] \ + __attribute__((section(".nozi_stack." # name), \ + aligned(STACK_ALIGNMENT))) +- ++#endif + #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack)) + + DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, +--- a/core/arch/arm/mm/core_mmu_v7.c ++++ b/core/arch/arm/mm/core_mmu_v7.c +@@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_EN + typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES]; + typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES]; + ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l1" ++#endif + static l1_xlat_tbl_t main_mmu_l1_ttb +- __aligned(L1_ALIGNMENT) __section(".nozi.mmu.l1"); ++ __aligned(L1_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.l1") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + /* L2 MMU tables */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.l2" ++#endif + static l2_xlat_tbl_t main_mmu_l2_ttb[MAX_XLAT_TABLES] +- __aligned(L2_ALIGNMENT) __section(".nozi.mmu.l2"); ++ __aligned(L2_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.l2") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + /* MMU L1 table for TAs, one for each thread */ ++#ifdef __clang__ ++#pragma clang section bss=".nozi.mmu.ul1" ++#endif + static ul1_xlat_tbl_t main_mmu_ul1_ttb[CFG_NUM_THREADS] +- __aligned(UL1_ALIGNMENT) __section(".nozi.mmu.ul1"); ++ __aligned(UL1_ALIGNMENT) ++#ifndef __clang__ ++ __section(".nozi.mmu.ul1") ++#endif ++; ++#ifdef __clang__ ++#pragma clang section bss="" ++#endif + + struct mmu_partition { + l1_xlat_tbl_t *l1_table; diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch new file mode 100644 index 0000000000..ab4a6dbc0a --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0006-allow-setting-sysroot-for-libgcc-lookup.patch @@ -0,0 +1,35 @@ +From 528aeb42652a3159c1bfd51d6c1442c3ff27b84c Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Tue, 26 May 2020 14:38:02 -0500 +Subject: [PATCH] allow setting sysroot for libgcc lookup + +Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching +for the compiler libraries as there's no easy way to reliably pass --sysroot +otherwise. + +Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188] +Signed-off-by: Ross Burton + +--- + mk/gcc.mk | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/mk/gcc.mk b/mk/gcc.mk +index adc77a24..81bfa78a 100644 +--- a/mk/gcc.mk ++++ b/mk/gcc.mk +@@ -13,11 +13,11 @@ nostdinc$(sm) := -nostdinc -isystem $(shell $(CC$(sm)) \ + -print-file-name=include 2> /dev/null) + + # Get location of libgcc from gcc +-libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ ++libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ + -print-libgcc-file-name 2> /dev/null) +-libstdc++$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ ++libstdc++$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ + -print-file-name=libstdc++.a 2> /dev/null) +-libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ ++libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ + -print-file-name=libgcc_eh.a 2> /dev/null) + + # Define these to something to discover accidental use diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0007-allow-setting-sysroot-for-clang.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0007-allow-setting-sysroot-for-clang.patch new file mode 100644 index 0000000000..067ba6ebfb --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0007-allow-setting-sysroot-for-clang.patch @@ -0,0 +1,30 @@ +From db9e44af75c7cfd3316cab15aaa387383df3e57e Mon Sep 17 00:00:00 2001 +From: Brett Warren +Date: Wed, 23 Sep 2020 09:27:34 +0100 +Subject: [PATCH] optee: enable clang support + +When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used +to provide a sysroot wasn't included, which results in not locating +compiler-rt. This is mitigated by including the variable as ammended. + +Upstream-Status: Pending +ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 +Signed-off-by: Brett Warren + +--- + mk/clang.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mk/clang.mk b/mk/clang.mk +index c141a3f2..7d067cc0 100644 +--- a/mk/clang.mk ++++ b/mk/clang.mk +@@ -27,7 +27,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \ + + # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of + # libgcc for clang +-libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ ++libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ + -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) + + # Core ASLR relies on the executable being ready to run from its preferred load diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0008-no-warn-rwx-segments.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0008-no-warn-rwx-segments.patch new file mode 100644 index 0000000000..6d48a7601b --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0008-no-warn-rwx-segments.patch @@ -0,0 +1,65 @@ +From cf2a2451f4e9300532d677bb3a8315494a3b3a82 Mon Sep 17 00:00:00 2001 +From: Jerome Forissier +Date: Fri, 5 Aug 2022 09:48:03 +0200 +Subject: [PATCH] core: link: add --no-warn-rwx-segments + +Signed-off-by: Anton Antonov +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5474] + +binutils ld.bfd generates one RWX LOAD segment by merging several sections +with mixed R/W/X attributes (.text, .rodata, .data). After version 2.38 it +also warns by default when that happens [1], which breaks the build due to +--fatal-warnings. The RWX segment is not a problem for the TEE core, since +that information is not used to set memory permissions. Therefore, silence +the warning. + +Link: [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 +Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29448 +Reported-by: Dominique Martinet +Signed-off-by: Jerome Forissier +Acked-by: Jens Wiklander + +--- + core/arch/arm/kernel/link.mk | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk +index 7eed333a..c39d43cb 100644 +--- a/core/arch/arm/kernel/link.mk ++++ b/core/arch/arm/kernel/link.mk +@@ -31,6 +31,7 @@ link-ldflags += -T $(link-script-pp) -Map=$(link-out-dir)/tee.map + link-ldflags += --sort-section=alignment + link-ldflags += --fatal-warnings + link-ldflags += --gc-sections ++link-ldflags += $(call ld-option,--no-warn-rwx-segments) + + link-ldadd = $(LDADD) + link-ldadd += $(ldflags-external) +@@ -55,6 +56,7 @@ link-script-cppflags := \ + $(cppflagscore)) + + ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ ++ $(call ld-option,--no-warn-rwx-segments) \ + $(link-objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/all_objs.o + $(link-out-dir)/all_objs.o: $(objs) $(libdeps) $(MAKEFILE_LIST) +@@ -67,7 +69,8 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o + $(q)$(NMcore) $< | \ + $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ + +-unpaged-ldargs = -T $(link-script-dummy) --no-check-sections --gc-sections ++unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ ++ $(call ld-option,--no-warn-rwx-segments) + unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/unpaged.o + $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt +@@ -95,7 +98,8 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o + $(q)$(NMcore) $< | \ + $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ + +-init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections ++init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ ++ $(call ld-option,--no-warn-rwx-segments) + init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ + $(libgcccore) + cleanfiles += $(link-out-dir)/init.o diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0009-add-z-execstack.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0009-add-z-execstack.patch new file mode 100644 index 0000000000..3ba6c4ef38 --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0009-add-z-execstack.patch @@ -0,0 +1,94 @@ +From ea932656461865ab9ac4036245c756c082aeb3e1 Mon Sep 17 00:00:00 2001 +From: Jerome Forissier +Date: Tue, 23 Aug 2022 11:41:00 +0000 +Subject: [PATCH] core, ldelf: link: add -z execstack + +When building for arm32 with GNU binutils 2.39, the linker outputs +warnings when generating some TEE core binaries (all_obj.o, init.o, +unpaged.o and tee.elf) as well as ldelf.elf: + + arm-poky-linux-gnueabi-ld.bfd: warning: atomic_a32.o: missing .note.GNU-stack section implies executable stack + arm-poky-linux-gnueabi-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker + +The permissions used when mapping the TEE core stacks do not depend on +any metadata found in the ELF file. Similarly when the TEE core loads +ldelf it already creates a non-executable stack regardless of ELF +information. Therefore we can safely ignore the warnings. This is done +by adding the '-z execstack' option. + +Signed-off-by: Jerome Forissier + +Signed-off-by: Anton Antonov +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] + +--- + core/arch/arm/kernel/link.mk | 13 +++++++++---- + ldelf/link.mk | 3 +++ + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk +index c39d43cb..0e96e606 100644 +--- a/core/arch/arm/kernel/link.mk ++++ b/core/arch/arm/kernel/link.mk +@@ -9,6 +9,11 @@ link-script-dep = $(link-out-dir)/.kern.ld.d + + AWK = awk + ++link-ldflags-common += $(call ld-option,--no-warn-rwx-segments) ++ifeq ($(CFG_ARM32_core),y) ++link-ldflags-common += $(call ld-option,--no-warn-execstack) ++endif ++ + link-ldflags = $(LDFLAGS) + ifeq ($(CFG_CORE_ASLR),y) + link-ldflags += -pie -Bsymbolic -z norelro $(ldflag-apply-dynamic-relocs) +@@ -31,7 +36,7 @@ link-ldflags += -T $(link-script-pp) -Map=$(link-out-dir)/tee.map + link-ldflags += --sort-section=alignment + link-ldflags += --fatal-warnings + link-ldflags += --gc-sections +-link-ldflags += $(call ld-option,--no-warn-rwx-segments) ++link-ldflags += $(link-ldflags-common) + + link-ldadd = $(LDADD) + link-ldadd += $(ldflags-external) +@@ -56,7 +61,7 @@ link-script-cppflags := \ + $(cppflagscore)) + + ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ +- $(call ld-option,--no-warn-rwx-segments) \ ++ $(link-ldflags-common) \ + $(link-objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/all_objs.o + $(link-out-dir)/all_objs.o: $(objs) $(libdeps) $(MAKEFILE_LIST) +@@ -70,7 +75,7 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o + $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ + + unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ +- $(call ld-option,--no-warn-rwx-segments) ++ $(link-ldflags-common) + unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) + cleanfiles += $(link-out-dir)/unpaged.o + $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt +@@ -99,7 +104,7 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o + $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ + + init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ +- $(call ld-option,--no-warn-rwx-segments) ++ $(link-ldflags-common) + init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ + $(libgcccore) + cleanfiles += $(link-out-dir)/init.o +diff --git a/ldelf/link.mk b/ldelf/link.mk +index 64c8212a..bd49551e 100644 +--- a/ldelf/link.mk ++++ b/ldelf/link.mk +@@ -20,6 +20,9 @@ link-ldflags += -z max-page-size=4096 # OP-TEE always uses 4K alignment + ifeq ($(CFG_CORE_BTI),y) + link-ldflags += $(call ld-option,-z force-bti) --fatal-warnings + endif ++ifeq ($(CFG_ARM32_$(sm)), y) ++link-ldflags += $(call ld-option,--no-warn-execstack) ++endif + link-ldflags += $(link-ldflags$(sm)) + + link-ldadd = $(addprefix -L,$(libdirs)) diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0010-add-note-GNU-stack-section.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0010-add-note-GNU-stack-section.patch new file mode 100644 index 0000000000..4ea65d88cc --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os-tadevkit-3.18.0/0010-add-note-GNU-stack-section.patch @@ -0,0 +1,128 @@ +From ec30e84671aac9a2e9549754eb7bc6201728db4c Mon Sep 17 00:00:00 2001 +From: Jerome Forissier +Date: Tue, 23 Aug 2022 12:31:46 +0000 +Subject: [PATCH] arm32: libutils, libutee, ta: add .note.GNU-stack section to + + .S files + +When building for arm32 with GNU binutils 2.39, the linker outputs +warnings when linking Trusted Applications: + + arm-unknown-linux-uclibcgnueabihf-ld.bfd: warning: utee_syscalls_a32.o: missing .note.GNU-stack section implies executable stack + arm-unknown-linux-uclibcgnueabihf-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker + +We could silence the warning by adding the '-z execstack' option to the +TA link flags, like we did in the parent commit for the TEE core and +ldelf. Indeed, ldelf always allocates a non-executable piece of memory +for the TA to use as a stack. + +However it seems preferable to comply with the common ELF practices in +this case. A better fix is therefore to add the missing .note.GNU-stack +sections in the assembler files. + +Signed-off-by: Jerome Forissier + +Signed-off-by: Anton Antonov +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] + +--- + lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++ + lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++ + lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | 2 ++ + lib/libutils/isoc/arch/arm/setjmp_a32.S | 2 ++ + ta/arch/arm/ta_entry_a32.S | 2 ++ + 7 files changed, 14 insertions(+) + +diff --git a/lib/libutee/arch/arm/utee_syscalls_a32.S b/lib/libutee/arch/arm/utee_syscalls_a32.S +index 6e621ca6..af405f62 100644 +--- a/lib/libutee/arch/arm/utee_syscalls_a32.S ++++ b/lib/libutee/arch/arm/utee_syscalls_a32.S +@@ -7,6 +7,8 @@ + #include + #include + ++ .section .note.GNU-stack,"",%progbits ++ + .section .text + .balign 4 + .code 32 +diff --git a/lib/libutils/ext/arch/arm/atomic_a32.S b/lib/libutils/ext/arch/arm/atomic_a32.S +index eaef6914..2be73ffa 100644 +--- a/lib/libutils/ext/arch/arm/atomic_a32.S ++++ b/lib/libutils/ext/arch/arm/atomic_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* uint32_t atomic_inc32(uint32_t *v); */ + FUNC atomic_inc32 , : + ldrex r1, [r0] +diff --git a/lib/libutils/ext/arch/arm/mcount_a32.S b/lib/libutils/ext/arch/arm/mcount_a32.S +index 51439a23..54dc3c02 100644 +--- a/lib/libutils/ext/arch/arm/mcount_a32.S ++++ b/lib/libutils/ext/arch/arm/mcount_a32.S +@@ -7,6 +7,8 @@ + + #if defined(CFG_TA_GPROF_SUPPORT) || defined(CFG_FTRACE_SUPPORT) + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * Convert return address to call site address by subtracting the size of the + * mcount call instruction (blx __gnu_mcount_nc). +diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S +index a600c879..37ae9ec6 100644 +--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S ++++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * signed ret_idivmod_values(signed quot, signed rem); + * return quotient and remaining the EABI way (regs r0,r1) +diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S +index 2dc50bc9..5c3353e2 100644 +--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S ++++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d) + */ +diff --git a/lib/libutils/isoc/arch/arm/setjmp_a32.S b/lib/libutils/isoc/arch/arm/setjmp_a32.S +index 43ea5937..f8a0b70d 100644 +--- a/lib/libutils/isoc/arch/arm/setjmp_a32.S ++++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S +@@ -51,6 +51,8 @@ + #define SIZE(x) + #endif + ++ .section .note.GNU-stack,"",%progbits ++ + /* Arm/Thumb interworking support: + + The interworking scheme expects functions to use a BX instruction +diff --git a/ta/arch/arm/ta_entry_a32.S b/ta/arch/arm/ta_entry_a32.S +index d2f8a69d..cd9a12f9 100644 +--- a/ta/arch/arm/ta_entry_a32.S ++++ b/ta/arch/arm/ta_entry_a32.S +@@ -5,6 +5,8 @@ + + #include + ++ .section .note.GNU-stack,"",%progbits ++ + /* + * This function is the bottom of the user call stack. Mark it as such so that + * the unwinding code won't try to go further down. diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os/0001-core-Define-section-attributes-for-clang.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os/0001-core-Define-section-attributes-for-clang.patch deleted file mode 100644 index a69d77761d..0000000000 --- a/meta-arm/meta-arm/recipes-security/optee/optee-os/0001-core-Define-section-attributes-for-clang.patch +++ /dev/null @@ -1,230 +0,0 @@ -From f189457b79989543f65b8a4e8729eff2cdf9a758 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 13 Aug 2022 19:24:55 -0700 -Subject: [PATCH] core: Define section attributes for clang - -Clang's attribute section is not same as gcc, here we need to add flags -to sections so they can be eventually collected by linker into final -output segments. Only way to do so with clang is to use - -pragma clang section ... - -The behavious is described here [1], this allows us to define names bss -sections. This was not an issue until clang-15 where LLD linker starts -to detect the section flags before merging them and throws the following -errors - -| ld.lld: error: section type mismatch for .nozi.kdata_page -| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/kernel/thread.o:(.nozi.kdata_page): SHT_PROGBITS -| >>> output section .nozi: SHT_NOBITS -| -| ld.lld: error: section type mismatch for .nozi.mmu.l2 -| >>> /mnt/b/yoe/master/build/tmp/work/qemuarm64-yoe-linux/optee-os-tadevkit/3.17.0-r0/build/core/arch/arm/mm/core_mmu_lpae.o:(.nozi.mmu.l2): SHT_PROGBITS -| >>> output section .nozi: SHT_NOBITS - -These sections should be carrying SHT_NOBITS but so far it was not -possible to do so, this patch tries to use clangs pragma to get this -going and match the functionality with gcc. - -[1] https://intel.github.io/llvm-docs/clang/LanguageExtensions.html#specifying-section-names-for-global-objects-pragma-clang-section - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - core/arch/arm/kernel/thread.c | 19 +++++++++++++++-- - core/arch/arm/mm/core_mmu_lpae.c | 35 ++++++++++++++++++++++++++++---- - core/arch/arm/mm/pgt_cache.c | 12 ++++++++++- - core/kernel/thread.c | 13 +++++++++++- - 4 files changed, 71 insertions(+), 8 deletions(-) - ---- a/core/arch/arm/kernel/thread.c -+++ b/core/arch/arm/kernel/thread.c -@@ -44,16 +44,31 @@ static size_t thread_user_kcode_size __n - #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \ - defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64) - long thread_user_kdata_sp_offset __nex_bss; -+#ifdef __clang__ -+#ifndef CFG_VIRTUALIZATION -+#pragma clang section bss=".nozi.kdata_page" -+#else -+#pragma clang section bss=".nex_nozi.kdata_page" -+#endif -+#endif - static uint8_t thread_user_kdata_page[ - ROUNDUP(sizeof(struct thread_core_local) * CFG_TEE_CORE_NB_CORE, - SMALL_PAGE_SIZE)] - __aligned(SMALL_PAGE_SIZE) -+#ifndef __clang__ - #ifndef CFG_VIRTUALIZATION -- __section(".nozi.kdata_page"); -+ __section(".nozi.kdata_page") - #else -- __section(".nex_nozi.kdata_page"); -+ __section(".nex_nozi.kdata_page") - #endif - #endif -+ ; -+#endif -+ -+/* reset BSS section to default ( .bss ) */ -+#ifdef __clang__ -+#pragma clang section bss="" -+#endif - - #ifdef ARM32 - uint32_t __nostackcheck thread_get_exceptions(void) ---- a/core/arch/arm/mm/core_mmu_lpae.c -+++ b/core/arch/arm/mm/core_mmu_lpae.c -@@ -233,19 +233,46 @@ typedef uint16_t l1_idx_t; - typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES]; - typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES]; - -+#ifdef __clang__ -+#pragma clang section bss=".nozi.mmu.base_table" -+#endif - static base_xlat_tbls_t base_xlation_table[NUM_BASE_TABLES] - __aligned(NUM_BASE_LEVEL_ENTRIES * XLAT_ENTRY_SIZE) -- __section(".nozi.mmu.base_table"); -+#ifndef __clang__ -+ __section(".nozi.mmu.base_table") -+#endif -+; -+#ifdef __clang__ -+#pragma clang section bss="" -+#endif - -+#ifdef __clang__ -+#pragma clang section bss=".nozi.mmu.l2" -+#endif - static xlat_tbl_t xlat_tables[MAX_XLAT_TABLES] -- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); -+ __aligned(XLAT_TABLE_SIZE) -+#ifndef __clang__ -+ __section(".nozi.mmu.l2") -+#endif -+; -+#ifdef __clang__ -+#pragma clang section bss="" -+#endif - - #define XLAT_TABLES_SIZE (sizeof(xlat_tbl_t) * MAX_XLAT_TABLES) - -+#ifdef __clang__ -+#pragma clang section bss=".nozi.mmu.l2" -+#endif - /* MMU L2 table for TAs, one for each thread */ - static xlat_tbl_t xlat_tables_ul1[CFG_NUM_THREADS] -- __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2"); -- -+#ifndef __clang__ -+ __aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2") -+#endif -+; -+#ifdef __clang__ -+#pragma clang section bss="" -+#endif - /* - * TAs page table entry inside a level 1 page table. - * ---- a/core/arch/arm/mm/pgt_cache.c -+++ b/core/arch/arm/mm/pgt_cache.c -@@ -104,8 +104,18 @@ void pgt_init(void) - * has a large alignment, while .bss has a small alignment. The current - * link script is optimized for small alignment in .bss - */ -+#ifdef __clang__ -+#pragma clang section bss=".nozi.mmu.l2" -+#endif - static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE] -- __aligned(PGT_SIZE) __section(".nozi.pgt_cache"); -+ __aligned(PGT_SIZE) -+#ifndef __clang__ -+ __section(".nozi.pgt_cache") -+#endif -+ ; -+#ifdef __clang__ -+#pragma clang section bss="" -+#endif - size_t n; - - for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) { ---- a/core/kernel/thread.c -+++ b/core/kernel/thread.c -@@ -37,13 +37,24 @@ struct thread_core_local thread_core_loc - name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1] - #endif - -+#define DO_PRAGMA(x) _Pragma (#x) -+ -+#ifdef __clang__ -+#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ -+DO_PRAGMA (clang section bss=".nozi_stack." #name) \ -+linkage uint32_t name[num_stacks] \ -+ [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ -+ STACK_ALIGNMENT) / sizeof(uint32_t)] \ -+ __attribute__((aligned(STACK_ALIGNMENT))); \ -+DO_PRAGMA(clang section bss="") -+#else - #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \ - linkage uint32_t name[num_stacks] \ - [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \ - STACK_ALIGNMENT) / sizeof(uint32_t)] \ - __attribute__((section(".nozi_stack." # name), \ - aligned(STACK_ALIGNMENT))) -- -+#endif - #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack)) - - DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, ---- a/core/arch/arm/mm/core_mmu_v7.c -+++ b/core/arch/arm/mm/core_mmu_v7.c -@@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_EN - typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES]; - typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES]; - -+#ifdef __clang__ -+#pragma clang section bss=".nozi.mmu.l1" -+#endif - static l1_xlat_tbl_t main_mmu_l1_ttb -- __aligned(L1_ALIGNMENT) __section(".nozi.mmu.l1"); -+ __aligned(L1_ALIGNMENT) -+#ifndef __clang__ -+ __section(".nozi.mmu.l1") -+#endif -+; -+#ifdef __clang__ -+#pragma clang section bss="" -+#endif - - /* L2 MMU tables */ -+#ifdef __clang__ -+#pragma clang section bss=".nozi.mmu.l2" -+#endif - static l2_xlat_tbl_t main_mmu_l2_ttb[MAX_XLAT_TABLES] -- __aligned(L2_ALIGNMENT) __section(".nozi.mmu.l2"); -+ __aligned(L2_ALIGNMENT) -+#ifndef __clang__ -+ __section(".nozi.mmu.l2") -+#endif -+; -+#ifdef __clang__ -+#pragma clang section bss="" -+#endif - - /* MMU L1 table for TAs, one for each thread */ -+#ifdef __clang__ -+#pragma clang section bss=".nozi.mmu.ul1" -+#endif - static ul1_xlat_tbl_t main_mmu_ul1_ttb[CFG_NUM_THREADS] -- __aligned(UL1_ALIGNMENT) __section(".nozi.mmu.ul1"); -+ __aligned(UL1_ALIGNMENT) -+#ifndef __clang__ -+ __section(".nozi.mmu.ul1") -+#endif -+; -+#ifdef __clang__ -+#pragma clang section bss="" -+#endif - - struct mmu_partition { - l1_xlat_tbl_t *l1_table; diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch deleted file mode 100644 index ab4a6dbc0a..0000000000 --- a/meta-arm/meta-arm/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 528aeb42652a3159c1bfd51d6c1442c3ff27b84c Mon Sep 17 00:00:00 2001 -From: Ross Burton -Date: Tue, 26 May 2020 14:38:02 -0500 -Subject: [PATCH] allow setting sysroot for libgcc lookup - -Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching -for the compiler libraries as there's no easy way to reliably pass --sysroot -otherwise. - -Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188] -Signed-off-by: Ross Burton - ---- - mk/gcc.mk | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/mk/gcc.mk b/mk/gcc.mk -index adc77a24..81bfa78a 100644 ---- a/mk/gcc.mk -+++ b/mk/gcc.mk -@@ -13,11 +13,11 @@ nostdinc$(sm) := -nostdinc -isystem $(shell $(CC$(sm)) \ - -print-file-name=include 2> /dev/null) - - # Get location of libgcc from gcc --libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ -+libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ - -print-libgcc-file-name 2> /dev/null) --libstdc++$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ -+libstdc++$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ - -print-file-name=libstdc++.a 2> /dev/null) --libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ -+libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \ - -print-file-name=libgcc_eh.a 2> /dev/null) - - # Define these to something to discover accidental use diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os/0007-allow-setting-sysroot-for-clang.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os/0007-allow-setting-sysroot-for-clang.patch deleted file mode 100644 index 067ba6ebfb..0000000000 --- a/meta-arm/meta-arm/recipes-security/optee/optee-os/0007-allow-setting-sysroot-for-clang.patch +++ /dev/null @@ -1,30 +0,0 @@ -From db9e44af75c7cfd3316cab15aaa387383df3e57e Mon Sep 17 00:00:00 2001 -From: Brett Warren -Date: Wed, 23 Sep 2020 09:27:34 +0100 -Subject: [PATCH] optee: enable clang support - -When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used -to provide a sysroot wasn't included, which results in not locating -compiler-rt. This is mitigated by including the variable as ammended. - -Upstream-Status: Pending -ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 -Signed-off-by: Brett Warren - ---- - mk/clang.mk | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mk/clang.mk b/mk/clang.mk -index c141a3f2..7d067cc0 100644 ---- a/mk/clang.mk -+++ b/mk/clang.mk -@@ -27,7 +27,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \ - - # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of - # libgcc for clang --libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ -+libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ - -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) - - # Core ASLR relies on the executable being ready to run from its preferred load diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os/0008-no-warn-rwx-segments.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os/0008-no-warn-rwx-segments.patch deleted file mode 100644 index 6d48a7601b..0000000000 --- a/meta-arm/meta-arm/recipes-security/optee/optee-os/0008-no-warn-rwx-segments.patch +++ /dev/null @@ -1,65 +0,0 @@ -From cf2a2451f4e9300532d677bb3a8315494a3b3a82 Mon Sep 17 00:00:00 2001 -From: Jerome Forissier -Date: Fri, 5 Aug 2022 09:48:03 +0200 -Subject: [PATCH] core: link: add --no-warn-rwx-segments - -Signed-off-by: Anton Antonov -Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5474] - -binutils ld.bfd generates one RWX LOAD segment by merging several sections -with mixed R/W/X attributes (.text, .rodata, .data). After version 2.38 it -also warns by default when that happens [1], which breaks the build due to ---fatal-warnings. The RWX segment is not a problem for the TEE core, since -that information is not used to set memory permissions. Therefore, silence -the warning. - -Link: [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 -Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29448 -Reported-by: Dominique Martinet -Signed-off-by: Jerome Forissier -Acked-by: Jens Wiklander - ---- - core/arch/arm/kernel/link.mk | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk -index 7eed333a..c39d43cb 100644 ---- a/core/arch/arm/kernel/link.mk -+++ b/core/arch/arm/kernel/link.mk -@@ -31,6 +31,7 @@ link-ldflags += -T $(link-script-pp) -Map=$(link-out-dir)/tee.map - link-ldflags += --sort-section=alignment - link-ldflags += --fatal-warnings - link-ldflags += --gc-sections -+link-ldflags += $(call ld-option,--no-warn-rwx-segments) - - link-ldadd = $(LDADD) - link-ldadd += $(ldflags-external) -@@ -55,6 +56,7 @@ link-script-cppflags := \ - $(cppflagscore)) - - ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ -+ $(call ld-option,--no-warn-rwx-segments) \ - $(link-objs) $(link-ldadd) $(libgcccore) - cleanfiles += $(link-out-dir)/all_objs.o - $(link-out-dir)/all_objs.o: $(objs) $(libdeps) $(MAKEFILE_LIST) -@@ -67,7 +69,8 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o - $(q)$(NMcore) $< | \ - $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ - --unpaged-ldargs = -T $(link-script-dummy) --no-check-sections --gc-sections -+unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ -+ $(call ld-option,--no-warn-rwx-segments) - unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) - cleanfiles += $(link-out-dir)/unpaged.o - $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt -@@ -95,7 +98,8 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o - $(q)$(NMcore) $< | \ - $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ - --init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections -+init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ -+ $(call ld-option,--no-warn-rwx-segments) - init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ - $(libgcccore) - cleanfiles += $(link-out-dir)/init.o diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os/0009-add-z-execstack.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os/0009-add-z-execstack.patch deleted file mode 100644 index 3ba6c4ef38..0000000000 --- a/meta-arm/meta-arm/recipes-security/optee/optee-os/0009-add-z-execstack.patch +++ /dev/null @@ -1,94 +0,0 @@ -From ea932656461865ab9ac4036245c756c082aeb3e1 Mon Sep 17 00:00:00 2001 -From: Jerome Forissier -Date: Tue, 23 Aug 2022 11:41:00 +0000 -Subject: [PATCH] core, ldelf: link: add -z execstack - -When building for arm32 with GNU binutils 2.39, the linker outputs -warnings when generating some TEE core binaries (all_obj.o, init.o, -unpaged.o and tee.elf) as well as ldelf.elf: - - arm-poky-linux-gnueabi-ld.bfd: warning: atomic_a32.o: missing .note.GNU-stack section implies executable stack - arm-poky-linux-gnueabi-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker - -The permissions used when mapping the TEE core stacks do not depend on -any metadata found in the ELF file. Similarly when the TEE core loads -ldelf it already creates a non-executable stack regardless of ELF -information. Therefore we can safely ignore the warnings. This is done -by adding the '-z execstack' option. - -Signed-off-by: Jerome Forissier - -Signed-off-by: Anton Antonov -Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] - ---- - core/arch/arm/kernel/link.mk | 13 +++++++++---- - ldelf/link.mk | 3 +++ - 2 files changed, 12 insertions(+), 4 deletions(-) - -diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk -index c39d43cb..0e96e606 100644 ---- a/core/arch/arm/kernel/link.mk -+++ b/core/arch/arm/kernel/link.mk -@@ -9,6 +9,11 @@ link-script-dep = $(link-out-dir)/.kern.ld.d - - AWK = awk - -+link-ldflags-common += $(call ld-option,--no-warn-rwx-segments) -+ifeq ($(CFG_ARM32_core),y) -+link-ldflags-common += $(call ld-option,--no-warn-execstack) -+endif -+ - link-ldflags = $(LDFLAGS) - ifeq ($(CFG_CORE_ASLR),y) - link-ldflags += -pie -Bsymbolic -z norelro $(ldflag-apply-dynamic-relocs) -@@ -31,7 +36,7 @@ link-ldflags += -T $(link-script-pp) -Map=$(link-out-dir)/tee.map - link-ldflags += --sort-section=alignment - link-ldflags += --fatal-warnings - link-ldflags += --gc-sections --link-ldflags += $(call ld-option,--no-warn-rwx-segments) -+link-ldflags += $(link-ldflags-common) - - link-ldadd = $(LDADD) - link-ldadd += $(ldflags-external) -@@ -56,7 +61,7 @@ link-script-cppflags := \ - $(cppflagscore)) - - ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \ -- $(call ld-option,--no-warn-rwx-segments) \ -+ $(link-ldflags-common) \ - $(link-objs) $(link-ldadd) $(libgcccore) - cleanfiles += $(link-out-dir)/all_objs.o - $(link-out-dir)/all_objs.o: $(objs) $(libdeps) $(MAKEFILE_LIST) -@@ -70,7 +75,7 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o - $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@ - - unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ -- $(call ld-option,--no-warn-rwx-segments) -+ $(link-ldflags-common) - unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore) - cleanfiles += $(link-out-dir)/unpaged.o - $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt -@@ -99,7 +104,7 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o - $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@ - - init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \ -- $(call ld-option,--no-warn-rwx-segments) -+ $(link-ldflags-common) - init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \ - $(libgcccore) - cleanfiles += $(link-out-dir)/init.o -diff --git a/ldelf/link.mk b/ldelf/link.mk -index 64c8212a..bd49551e 100644 ---- a/ldelf/link.mk -+++ b/ldelf/link.mk -@@ -20,6 +20,9 @@ link-ldflags += -z max-page-size=4096 # OP-TEE always uses 4K alignment - ifeq ($(CFG_CORE_BTI),y) - link-ldflags += $(call ld-option,-z force-bti) --fatal-warnings - endif -+ifeq ($(CFG_ARM32_$(sm)), y) -+link-ldflags += $(call ld-option,--no-warn-execstack) -+endif - link-ldflags += $(link-ldflags$(sm)) - - link-ldadd = $(addprefix -L,$(libdirs)) diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os/0010-add-note-GNU-stack-section.patch b/meta-arm/meta-arm/recipes-security/optee/optee-os/0010-add-note-GNU-stack-section.patch deleted file mode 100644 index 4ea65d88cc..0000000000 --- a/meta-arm/meta-arm/recipes-security/optee/optee-os/0010-add-note-GNU-stack-section.patch +++ /dev/null @@ -1,128 +0,0 @@ -From ec30e84671aac9a2e9549754eb7bc6201728db4c Mon Sep 17 00:00:00 2001 -From: Jerome Forissier -Date: Tue, 23 Aug 2022 12:31:46 +0000 -Subject: [PATCH] arm32: libutils, libutee, ta: add .note.GNU-stack section to - - .S files - -When building for arm32 with GNU binutils 2.39, the linker outputs -warnings when linking Trusted Applications: - - arm-unknown-linux-uclibcgnueabihf-ld.bfd: warning: utee_syscalls_a32.o: missing .note.GNU-stack section implies executable stack - arm-unknown-linux-uclibcgnueabihf-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker - -We could silence the warning by adding the '-z execstack' option to the -TA link flags, like we did in the parent commit for the TEE core and -ldelf. Indeed, ldelf always allocates a non-executable piece of memory -for the TA to use as a stack. - -However it seems preferable to comply with the common ELF practices in -this case. A better fix is therefore to add the missing .note.GNU-stack -sections in the assembler files. - -Signed-off-by: Jerome Forissier - -Signed-off-by: Anton Antonov -Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] - ---- - lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++ - lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++ - lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++ - lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | 2 ++ - lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | 2 ++ - lib/libutils/isoc/arch/arm/setjmp_a32.S | 2 ++ - ta/arch/arm/ta_entry_a32.S | 2 ++ - 7 files changed, 14 insertions(+) - -diff --git a/lib/libutee/arch/arm/utee_syscalls_a32.S b/lib/libutee/arch/arm/utee_syscalls_a32.S -index 6e621ca6..af405f62 100644 ---- a/lib/libutee/arch/arm/utee_syscalls_a32.S -+++ b/lib/libutee/arch/arm/utee_syscalls_a32.S -@@ -7,6 +7,8 @@ - #include - #include - -+ .section .note.GNU-stack,"",%progbits -+ - .section .text - .balign 4 - .code 32 -diff --git a/lib/libutils/ext/arch/arm/atomic_a32.S b/lib/libutils/ext/arch/arm/atomic_a32.S -index eaef6914..2be73ffa 100644 ---- a/lib/libutils/ext/arch/arm/atomic_a32.S -+++ b/lib/libutils/ext/arch/arm/atomic_a32.S -@@ -5,6 +5,8 @@ - - #include - -+ .section .note.GNU-stack,"",%progbits -+ - /* uint32_t atomic_inc32(uint32_t *v); */ - FUNC atomic_inc32 , : - ldrex r1, [r0] -diff --git a/lib/libutils/ext/arch/arm/mcount_a32.S b/lib/libutils/ext/arch/arm/mcount_a32.S -index 51439a23..54dc3c02 100644 ---- a/lib/libutils/ext/arch/arm/mcount_a32.S -+++ b/lib/libutils/ext/arch/arm/mcount_a32.S -@@ -7,6 +7,8 @@ - - #if defined(CFG_TA_GPROF_SUPPORT) || defined(CFG_FTRACE_SUPPORT) - -+ .section .note.GNU-stack,"",%progbits -+ - /* - * Convert return address to call site address by subtracting the size of the - * mcount call instruction (blx __gnu_mcount_nc). -diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S -index a600c879..37ae9ec6 100644 ---- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S -+++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S -@@ -5,6 +5,8 @@ - - #include - -+ .section .note.GNU-stack,"",%progbits -+ - /* - * signed ret_idivmod_values(signed quot, signed rem); - * return quotient and remaining the EABI way (regs r0,r1) -diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S -index 2dc50bc9..5c3353e2 100644 ---- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S -+++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S -@@ -5,6 +5,8 @@ - - #include - -+ .section .note.GNU-stack,"",%progbits -+ - /* - * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d) - */ -diff --git a/lib/libutils/isoc/arch/arm/setjmp_a32.S b/lib/libutils/isoc/arch/arm/setjmp_a32.S -index 43ea5937..f8a0b70d 100644 ---- a/lib/libutils/isoc/arch/arm/setjmp_a32.S -+++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S -@@ -51,6 +51,8 @@ - #define SIZE(x) - #endif - -+ .section .note.GNU-stack,"",%progbits -+ - /* Arm/Thumb interworking support: - - The interworking scheme expects functions to use a BX instruction -diff --git a/ta/arch/arm/ta_entry_a32.S b/ta/arch/arm/ta_entry_a32.S -index d2f8a69d..cd9a12f9 100644 ---- a/ta/arch/arm/ta_entry_a32.S -+++ b/ta/arch/arm/ta_entry_a32.S -@@ -5,6 +5,8 @@ - - #include - -+ .section .note.GNU-stack,"",%progbits -+ - /* - * This function is the bottom of the user call stack. Mark it as such so that - * the unwinding code won't try to go further down. diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os_3.18.0.bb b/meta-arm/meta-arm/recipes-security/optee/optee-os_3.18.0.bb index 59e58ed30f..31da5dedf4 100644 --- a/meta-arm/meta-arm/recipes-security/optee/optee-os_3.18.0.bb +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os_3.18.0.bb @@ -2,6 +2,8 @@ require optee-os.inc DEPENDS += "dtc-native" +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-3.18.0:" + SRCREV = "1ee647035939e073a2e8dddb727c0f019cc035f1" SRC_URI:append = " \ file://0001-core-Define-section-attributes-for-clang.patch \ diff --git a/meta-arm/meta-arm/recipes-security/optee/optee-os_3.19.0.bb b/meta-arm/meta-arm/recipes-security/optee/optee-os_3.19.0.bb new file mode 100644 index 0000000000..656a09748c --- /dev/null +++ b/meta-arm/meta-arm/recipes-security/optee/optee-os_3.19.0.bb @@ -0,0 +1,9 @@ +require optee-os-3_19.inc + +DEPENDS += "dtc-native" + +SRCREV = "afacf356f9593a7f83cae9f96026824ec242ff52" + +SRC_URI:append = " \ + file://0001-core-Define-section-attributes-for-clang.patch \ + " diff --git a/meta-arm/meta-arm/recipes-security/packagegroups/packagegroup-ts-tests.bb b/meta-arm/meta-arm/recipes-security/packagegroups/packagegroup-ts-tests.bb index b9c6507ce7..25ee2f5a87 100644 --- a/meta-arm/meta-arm/recipes-security/packagegroups/packagegroup-ts-tests.bb +++ b/meta-arm/meta-arm/recipes-security/packagegroups/packagegroup-ts-tests.bb @@ -5,6 +5,8 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" inherit packagegroup COMPATIBLE_HOST = "aarch64.*-linux" +COMPATIBLE_MACHINE ?= "invalid" +COMPATIBLE_MACHINE:qemuarm64-secureboot = "qemuarm64-secureboot" PACKAGES = "${PN} ${PN}-psa" diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/libts_git.bb b/meta-arm/meta-arm/recipes-security/trusted-services/libts_git.bb index 598b281bac..aafe85160c 100644 --- a/meta-arm/meta-arm/recipes-security/trusted-services/libts_git.bb +++ b/meta-arm/meta-arm/recipes-security/trusted-services/libts_git.bb @@ -24,11 +24,14 @@ do_install:append () { fi # Move the dynamic libraries into the standard place. - # Update a cmake file to use correct paths. install -d ${D}${libdir} mv ${D}${TS_INSTALL}/lib/libts* ${D}${libdir} - sed -i -e "s#/${TS_ENV}##g" ${D}${TS_INSTALL}/lib/cmake/libts/libtsTargets-noconfig.cmake + # Update generated cmake file to use correct paths. + target_cmake=$(find ${D}${TS_INSTALL}/lib/cmake/libts -type f -iname "libtsTargets-*.cmake") + if [ ! -z "$target_cmake" ]; then + sed -i -e "s#/${TS_ENV}##g" $target_cmake + fi } inherit ${@oe.utils.conditional('VIRTUAL-RUNTIME_dev_manager', 'busybox-mdev', '', 'useradd', d)} diff --git a/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services.inc b/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services.inc index 59f461d3b0..c64a1d4100 100644 --- a/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services.inc +++ b/meta-arm/meta-arm/recipes-security/trusted-services/trusted-services.inc @@ -6,6 +6,8 @@ LICENSE = "Apache-2.0 & BSD-3-Clause & Zlib" inherit python3native cmake COMPATIBLE_HOST = "aarch64.*-linux" +COMPATIBLE_MACHINE ?= "invalid" +COMPATIBLE_MACHINE:qemuarm64-secureboot = "qemuarm64-secureboot" require trusted-services-src.inc diff --git a/meta-arm/meta-atp/README.md b/meta-arm/meta-atp/README.md deleted file mode 100644 index 15d0e29b81..0000000000 --- a/meta-arm/meta-atp/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# meta-atp layer - -The meta-atp layer supports building environments with traffic generation capabilities based on [AMBA Adaptive Traffic Profiles (ATP)](https://developer.arm.com/documentation/ihi0082/latest). - -## Recipes - -The meta-atp layer supports building the following software components: - -- Arm's implementation of the AMBA ATP specification, namely the [AMBA ATP Engine](https://github.com/ARM-software/ATP-Engine). -- Linux kernel modules and user API (UAPI) for programming ATP devices. -- Integration test suite for verification of kernel modules and UAPI. - -It is also possible to build the AMBA ATP Engine as part of the final [gem5](https://www.gem5.org/) executable. For this, meta-atp extends the `gem5-aarch64-native` recipe to add the AMBA ATP engine code as extra sources. - -## Machines - -The `gem5-atp-arm64` machine extends the `gem5-arm64` machine to instantiate a simulated platform with support for programmable AMBA ATP traffic generation. The platform includes the following models: - -- `ProfileGen` model. This is the adapter layer between gem5 and the AMBA ATP Engine. It is the source of traffic into the gem5 host platform. -- `ATPDevice` model. Software can program it using the Linux kernel modules and UAPI to control traffic generation. - -## Usage - -Users should add the meta-atp layer and layer dependencies to `conf/bblayers.conf`. See `conf/layer.conf` for dependencies. - -### Standalone Engine executable - -Users can build the AMBA ATP Engine as a standalone native executable as follows: - -```bash -bitbake atp-native -``` - -Users can run the executable through standard build scripts: - -```bash -oe-run-native atp-native atpeng [--help | args...] -``` - -## Integration of the Engine in gem5 - -Users should select the `gem5-atp-arm64` platform in their `conf/local.conf` file. - -Users can build the target image of preference, for example: - -```bash -bitbake core-image-minimal -``` - -The resulting gem5 native executable contains the AMBA ATP Engine. The resulting target image contains the kernel modules, UAPI and test suite. - -Users should run the environment as follows: - -```bash -./tmp/deploy/tools/start-gem5-atp.sh -``` - -This script launches a fast simulation to fast-forward Linux boot. Once Linux boot is completed, the fast simulation switches into a detailed simulation for the final usable environment. Users can connect and interact with the environment as follows: - -```bash -oe-run-native gem5-m5term-native m5term -``` - -The connection PORT is announced by the deploy script as: - -```bash -system.terminal: Listening for connections on port -``` - -This is usually port 3456. - -Users can verify access to the ATP device by running the integration test suite from within the simulated environment as follows: - -```bash -test_atp.out -``` diff --git a/meta-arm/meta-atp/conf/layer.conf b/meta-arm/meta-atp/conf/layer.conf deleted file mode 100644 index 8e48b26fef..0000000000 --- a/meta-arm/meta-atp/conf/layer.conf +++ /dev/null @@ -1,9 +0,0 @@ -BBPATH .= ":${LAYERDIR}" -BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ - ${LAYERDIR}/recipes-*/*/*.bbappend" - -BBFILE_COLLECTIONS += "meta-atp" -BBFILE_PATTERN_meta-atp = "^${LAYERDIR}/" - -LAYERDEPENDS_meta-atp = "core openembedded-layer meta-gem5" -LAYERSERIES_COMPAT_meta-atp = "langdale mickledore" diff --git a/meta-arm/meta-atp/conf/machine/gem5-atp-arm64.conf b/meta-arm/meta-atp/conf/machine/gem5-atp-arm64.conf deleted file mode 100644 index d5fe22a7c0..0000000000 --- a/meta-arm/meta-atp/conf/machine/gem5-atp-arm64.conf +++ /dev/null @@ -1,11 +0,0 @@ -require conf/machine/gem5-arm64.conf -MACHINEOVERRIDES =. "gem5-arm64:" - -# Use baremetal_atp.py as machine configuration -GEM5_RUN_PROFILE = "configs/baremetal_atp.py" -# Require m5term -EXTRA_IMAGEDEPENDS += "gem5-m5term-native" -# Require ATP kernel modules, user API and gem5 m5ops -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-atp atp-uapi gem5-m5ops" -# Optionally provide ATP kernel tests -MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "atp-test" diff --git a/meta-arm/meta-atp/recipes-devtools/atp/atp-native_3.1.bb b/meta-arm/meta-atp/recipes-devtools/atp/atp-native_3.1.bb deleted file mode 100644 index 31b58bf947..0000000000 --- a/meta-arm/meta-atp/recipes-devtools/atp/atp-native_3.1.bb +++ /dev/null @@ -1,18 +0,0 @@ -require atp-source_3.1.inc -inherit pkgconfig native - -SUMMARY = "AMBA ATP Engine: synthetic traffic interface modelling framework" - -S = "${WORKDIR}/git" -SRC_URI = "${ATP_SRC} \ - file://no-werror.patch" - -EXTRA_OEMAKE += "EXTRA_CXX_FLAGS='${CXXFLAGS}' EXTRA_LD_FLAGS='${LDFLAGS}'" - -do_install() { - oe_runmake install -} - -DEPENDS = "protobuf-native cppunit-native" - -addtask addto_recipe_sysroot before do_build diff --git a/meta-arm/meta-atp/recipes-devtools/atp/atp-source_3.1.inc b/meta-arm/meta-atp/recipes-devtools/atp/atp-source_3.1.inc deleted file mode 100644 index de24ef8361..0000000000 --- a/meta-arm/meta-atp/recipes-devtools/atp/atp-source_3.1.inc +++ /dev/null @@ -1,9 +0,0 @@ -ATP_SRC = "git://github.com/ARM-software/ATP-Engine.git;protocol=https;branch=master" -ATP_REV = "be1066029d6256626b37be004e2a663fbc29f37e" -ATP_LIC = "BSD-3-Clause-Clear" -ATP_LIC_MD5 = "e836b5992257064f488715d9a59752c3" - -HOMEPAGE ?= "https://github.com/ARM-software/ATP-Engine" -SRCREV ?= "${ATP_REV}" -LICENSE ?= "${ATP_LIC}" -LIC_FILES_CHKSUM ?= "file://LICENSE;md5=${ATP_LIC_MD5}" diff --git a/meta-arm/meta-atp/recipes-devtools/atp/files/no-werror.patch b/meta-arm/meta-atp/recipes-devtools/atp/files/no-werror.patch deleted file mode 100644 index 4be143afa7..0000000000 --- a/meta-arm/meta-atp/recipes-devtools/atp/files/no-werror.patch +++ /dev/null @@ -1,18 +0,0 @@ -Don't pass -Werror, as new compilers introduce new warnings. - -Upstream-Status: Pending -Signed-off-by: Ross Burton - -diff --git a/Makefile b/Makefile -index c01b120..1d3c30a 100644 ---- a/Makefile -+++ b/Makefile -@@ -18,7 +18,7 @@ PROTOBUF_C_FLAGS:= $(shell pkg-config --cflags protobuf) - CPPUNIT_C_FLAGS := $(shell pkg-config --cflags cppunit) - PROTOBUF_L_FLAGS:= $(shell pkg-config --libs protobuf) - CPPUNIT_L_FLAGS := $(shell pkg-config --libs cppunit) --CXX_FLAGS := $(PROTOBUF_C_FLAGS) -std=c++11 -Wall -Werror -Wextra -Wno-unused-parameter -Wno-unused-variable $(CPPUNIT_C_FLAGS) -fPIC $(EXTRA_CXX_FLAGS) -+CXX_FLAGS := $(PROTOBUF_C_FLAGS) -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable $(CPPUNIT_C_FLAGS) -fPIC $(EXTRA_CXX_FLAGS) - LD_FLAGS := $(PROTOBUF_L_FLAGS) $(CPPUNIT_L_FLAGS) $(EXTRA_LD_FLAGS) - PROTO_SRC_DIR := ./proto/ - PROTO_SRC := $(wildcard $(PROTO_SRC_DIR)tp*.proto) diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend deleted file mode 100644 index 2b55b8928a..0000000000 --- a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-dtb.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -# Export datadir paths for baremetal_atp.py script -export GEM5_DATADIR = "${STAGING_DATADIR_NATIVE}/gem5" -export ATP_DATADIR = "${STAGING_DATADIR_NATIVE}/gem5" diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh deleted file mode 100755 index 16dac47714..0000000000 --- a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native/start-gem5-atp.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -source <(bitbake -e gem5-aarch64-native | grep \ - -e "^STAGING_DATADIR_NATIVE=" -e "^DEPLOY_DIR_TOOLS=") - -# Used by baremetal_atp.py -export GEM5_DATADIR=${STAGING_DATADIR_NATIVE}/gem5 -export ATP_DATADIR=${STAGING_DATADIR_NATIVE}/gem5 - -# Fast-forward Linux boot and restore into timing simulation -${DEPLOY_DIR_TOOLS}/start-gem5.sh --checkpoint $@ -${DEPLOY_DIR_TOOLS}/start-gem5.sh --restore-with-cpu TimingSimpleCPU \ - --checkpoint-restore 1 $@ diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend deleted file mode 100644 index 6607f0f8b7..0000000000 --- a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend +++ /dev/null @@ -1,24 +0,0 @@ -require recipes-devtools/atp/atp-source_3.1.inc - -FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" - -SRC_URI += "${ATP_SRC};destsuffix=git/atp;name=atp \ - file://start-gem5-atp.sh" -SRCREV_FORMAT = "gem5_atp" -SRCREV_atp = "${ATP_REV}" -LICENSE += "& ${ATP_LIC}" -LIC_FILES_CHKSUM += "file://atp/LICENSE;md5=${ATP_LIC_MD5}" - -EXTRA_OESCONS += "EXTRAS=${S}/atp" - -do_install:append() { - # baremetal_atp.py machine configuration and sample stream.atp file - install -m 644 ${B}/atp/gem5/baremetal_atp.py \ - ${B}/atp/configs/stream.atp \ - ${D}${datadir}/gem5/configs -} - -do_deploy:append() { - # start-gem5-atp.sh launch script - install -m 755 ${WORKDIR}/start-gem5-atp.sh ${DEPLOYDIR} -} diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh deleted file mode 100755 index 44477e9640..0000000000 --- a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops/m5-readfile.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: m5-readfile -# Required-Start: $all -# Default-Start: 5 -# Description: Enables reading any script at simulation launch time. -### END INIT INFO - -m5 readfile | sh diff --git a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend b/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend deleted file mode 100644 index 3ba0c3cacd..0000000000 --- a/meta-arm/meta-atp/recipes-devtools/gem5/gem5-m5ops_20.bbappend +++ /dev/null @@ -1,14 +0,0 @@ -inherit update-rc.d - -FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" - -# Add startup script calling m5 readfile for automatic checkpoint and restore -SRC_URI += "file://m5-readfile.sh" - -INITSCRIPT_NAME = "m5-readfile.sh" -INITSCRIPT_PARAMS = "defaults 99" - -do_install:append() { - install -d ${D}/${INIT_D_DIR} - install -m 755 ${WORKDIR}/m5-readfile.sh ${D}/${INIT_D_DIR} -} diff --git a/meta-arm/meta-atp/recipes-kernel/atp/atp-module_3.1.bb b/meta-arm/meta-atp/recipes-kernel/atp/atp-module_3.1.bb deleted file mode 100644 index 0bf4949b6f..0000000000 --- a/meta-arm/meta-atp/recipes-kernel/atp/atp-module_3.1.bb +++ /dev/null @@ -1,24 +0,0 @@ -require recipes-devtools/atp/atp-source_3.1.inc -inherit module - -SUMMARY = "Kernel modules for interacting wih ATP Engine and devices" -SECTION = "kernel/modules" - -S = "${WORKDIR}/git" -SRC_URI = "${ATP_SRC}" - -ATP_MOD_DIR = "linux" - -EXTRA_OEMAKE += "-C ${ATP_MOD_DIR}" - -PROVIDES = "kernel-module-atp" -RPROVIDES:${PN} = "kernel-module-atp" -KERNEL_MODULE_AUTOLOAD += "atp_buffer_manager atp_device" -MODULES_MODULE_SYMVERS_LOCATION = "${ATP_MOD_DIR}" - -do_install:append() { - install -d ${D}${includedir}/linux - install -m 644 ${ATP_MOD_DIR}/atp_buffer_manager_user.h \ - ${ATP_MOD_DIR}/atp_device_user.h \ - ${D}${includedir}/linux -} diff --git a/meta-arm/meta-atp/recipes-kernel/atp/atp-test_3.1.bb b/meta-arm/meta-atp/recipes-kernel/atp/atp-test_3.1.bb deleted file mode 100644 index e98e13cd17..0000000000 --- a/meta-arm/meta-atp/recipes-kernel/atp/atp-test_3.1.bb +++ /dev/null @@ -1,20 +0,0 @@ -require recipes-devtools/atp/atp-source_3.1.inc - -SUMMARY = "End-to-end tests evaluating ATP kernel modules service correctness" -SECTION = "kernel/userland" - -S = "${WORKDIR}/git" -SRC_URI = "${ATP_SRC}" - -EXTRA_OEMAKE += "-C linux/test" - -do_compile() { - oe_runmake -} - -do_install() { - oe_runmake DESTDIR=${D} PREFIX=${prefix} install -} - -DEPENDS = "atp-uapi cppunit" -RDEPENDS:${PN} = "atp-uapi" diff --git a/meta-arm/meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb b/meta-arm/meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb deleted file mode 100644 index 140105f817..0000000000 --- a/meta-arm/meta-atp/recipes-kernel/atp/atp-uapi_3.1.bb +++ /dev/null @@ -1,23 +0,0 @@ -require recipes-devtools/atp/atp-source_3.1.inc - -SUMMARY = "User API for accessing services from ATP kernel modules" -SECTION = "kernel/userland" - -S = "${WORKDIR}/git" -SRC_URI = "${ATP_SRC}" - -# Unversioned library -SOLIBS = ".so" -FILES_SOLIBSDEV = "" - -EXTRA_OEMAKE += "-C linux/uapi" - -do_compile() { - oe_runmake KERNEL_HDR_PATH=${STAGING_INCDIR} -} - -do_install() { - oe_runmake DESTDIR=${D} PREFIX=${prefix} install -} - -DEPENDS = "linux-libc-headers kernel-module-atp" diff --git a/meta-arm/meta-atp/recipes-kernel/linux/files/no_ftrace.cfg b/meta-arm/meta-atp/recipes-kernel/linux/files/no_ftrace.cfg deleted file mode 100644 index 870eeaf67a..0000000000 --- a/meta-arm/meta-atp/recipes-kernel/linux/files/no_ftrace.cfg +++ /dev/null @@ -1 +0,0 @@ -# CONFIG_FTRACE is not set diff --git a/meta-arm/meta-atp/recipes-kernel/linux/files/smmuv3.cfg b/meta-arm/meta-atp/recipes-kernel/linux/files/smmuv3.cfg deleted file mode 100644 index 2d0a87d956..0000000000 --- a/meta-arm/meta-atp/recipes-kernel/linux/files/smmuv3.cfg +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_IOMMU_IO_PGTABLE=y -CONFIG_IOMMU_IO_PGTABLE_LPAE=y -# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set -CONFIG_ARM_SMMU_V3=y diff --git a/meta-arm/meta-atp/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-arm/meta-atp/recipes-kernel/linux/linux-yocto_%.bbappend deleted file mode 100644 index f59f8d44b6..0000000000 --- a/meta-arm/meta-atp/recipes-kernel/linux/linux-yocto_%.bbappend +++ /dev/null @@ -1,2 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" -SRC_URI += "file://no_ftrace.cfg file://smmuv3.cfg" diff --git a/meta-arm/meta-gem5/COPYING.MIT b/meta-arm/meta-gem5/COPYING.MIT deleted file mode 100644 index fb950dc69f..0000000000 --- a/meta-arm/meta-gem5/COPYING.MIT +++ /dev/null @@ -1,17 +0,0 @@ -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/meta-arm/meta-gem5/README.md b/meta-arm/meta-gem5/README.md deleted file mode 100644 index 490ddca97e..0000000000 --- a/meta-arm/meta-gem5/README.md +++ /dev/null @@ -1 +0,0 @@ -See ../README.md diff --git a/meta-arm/meta-gem5/conf/layer.conf b/meta-arm/meta-gem5/conf/layer.conf deleted file mode 100644 index db378b3812..0000000000 --- a/meta-arm/meta-gem5/conf/layer.conf +++ /dev/null @@ -1,19 +0,0 @@ -# We have a conf and classes directory, add to BBPATH -BBPATH .= ":${LAYERDIR}" - -# We have recipes-* directories, add to BBFILES -BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ - ${LAYERDIR}/recipes-*/*/*.bbappend" - -BBFILE_COLLECTIONS += "meta-gem5" -BBFILE_PATTERN_meta-gem5 = "^${LAYERDIR}/" -BBFILE_PRIORITY_meta-gem5 = "5" - -LAYERDEPENDS_meta-gem5 = "core openembedded-layer meta-arm" -LAYERSERIES_COMPAT_meta-gem5 = "langdale mickledore" - -BBFILES_DYNAMIC += " \ - virtualization-layer:${LAYERDIR}/dynamic-layers/meta-virtualization/*/*/*.bbappend \ -" - -DISTRO_FEATURES_NATIVE:append = " ${@bb.utils.filter('DISTRO_FEATURES', 'xen', d)}" diff --git a/meta-arm/meta-gem5/conf/machine/gem5-arm64.conf b/meta-arm/meta-gem5/conf/machine/gem5-arm64.conf deleted file mode 100644 index fa931da870..0000000000 --- a/meta-arm/meta-gem5/conf/machine/gem5-arm64.conf +++ /dev/null @@ -1,54 +0,0 @@ -# Configuration for gem5 running on ARM64 - -#@TYPE: Machine -#@NAME: Gem5 arm64 machine -#@DESCRIPTION: Machine configuration for Gem5 arm64 - -TUNE_FEATURES = "aarch64" - -require conf/machine/include/arm/arch-armv8a.inc - -MACHINE_FEATURES = "optee pci" - -KERNEL_IMAGETYPES = "Image vmlinux" -KERNEL_IMAGETYPE = "Image" - -IMAGE_FSTYPES += "tar.bz2 ext4" - -SERIAL_CONSOLES = "115200;ttyAMA0" - -EXTRA_IMAGEDEPENDS += "virtual/gem5-bootloader" - -PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto" -PREFERRED_VERSION_linux-yocto ?= "5.4%" - - -# Uncomment the following if you need to build gem5 provided bootloader, else -# using standard bootloader by Linux aarch64 -# Use gem5 provided bootloader -# PREFERRED_PROVIDER_virtual/gem5-bootloader = "gem5-aarch64-bootloader" - -# use the dtb stored in the kernel recipe -# KERNEL_DEVICETREE ?= "gem5-arm64/armv8_gem5_v2_4cpu.dtb" - -# Use Linux aarch64 boot wrapper with FDT support and generated -# dtb (gem5-aarch64-dtb.bb) -PREFERRED_PROVIDER_virtual/gem5-bootloader = "boot-wrapper-aarch64" - -BOOT_WRAPPER_AARCH64_CMDLINE ?= "\ - earlyprintk=pl011,0x1c090000 console=ttyAMA0 root=/dev/vda rw mem=1G \ - " -# Use baremetal profile and axf file so dtb is in axf file -GEM5_RUN_PROFILE = "configs/example/arm/baremetal.py" -GEM5_RUN_KERNEL = "linux-system.axf" -GEM5_RUN_EXTRA = "" -GEM5_RUN_DTB = "" -GEM5_RUN_CMDLINE = "" - -EXTRA_IMAGEDEPENDS += "gem5-aarch64-native" - -# As this is a virtual target that will not be used in the real world there is -# no need for real SSH keys. Disable rng-tools (which takes too long to -# initialise) and install the pre-generated keys. -PACKAGECONFIG:remove:pn-openssh = "rng-tools" -MACHINE_EXTRA_RRECOMMENDS += "ssh-pregen-hostkeys" diff --git a/meta-arm/meta-gem5/documentation/gem5-arm64.md b/meta-arm/meta-gem5/documentation/gem5-arm64.md deleted file mode 100644 index 137676b3eb..0000000000 --- a/meta-arm/meta-gem5/documentation/gem5-arm64.md +++ /dev/null @@ -1,32 +0,0 @@ -# Gem5 Arm64 Platform Support in meta-gem5 - -## Howto Build and Run - -### Configuration: -In the local.conf file, MACHINE should be set as follow: -MACHINE ?= "gem5-arm64" - -And in the bblayers.conf the following layers need to be added: -##OEROOT##/meta-arm/meta-arm-toolchain -##OEROOT##/meta-arm/meta-arm - -### Build: -```bash$ bitbake core-image-minimal``` - -### Run: -After compilation of an image, you can execute it using the compiled gem5 -with the followin command: -```./tmp/deploy/tools/start-gem5.sh``` - -You can modify the script to change the command line options of gem5. - -## Devices supported in the kernel -- serial - -### Untested: -- pci -- sata -- ide - - -## Devices not supported or not functional diff --git a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-bsp/boot-wrapper-aaarch64/boot-wrapper-aarch64_%.bbappend b/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-bsp/boot-wrapper-aaarch64/boot-wrapper-aarch64_%.bbappend deleted file mode 100644 index e4b97e948f..0000000000 --- a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-bsp/boot-wrapper-aaarch64/boot-wrapper-aarch64_%.bbappend +++ /dev/null @@ -1,32 +0,0 @@ -# Use OVERRIDES to minimize the usage of -# ${@bb.utils.contains('DISTRO_FEATURES', 'xen', ... -OVERRIDES:append = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ':xen', '', d)}" - -# Xen image to put in the image -# This should point to a file in the deploy image directory -BOOT_WRAPPER_AARCH64_XEN ??= "xen-${MACHINE}" - -# Xen command line for the image -BOOT_WRAPPER_AARCH64_XEN_CMDLINE ??= "noreboot dom0_mem=256M" - -BOOT_WRAPPER_AARCH64_XEN_CMDLINE:gem5-arm64 = "noreboot dom0_mem=256M console=dtuart \ - dtuart=/uart@1c090000 bootscrub=0" - -# Fix command line in the axf file for gem5-arm64 when Xen is present -BOOT_WRAPPER_AARCH64_CMDLINE_xen:gem5-arm64 = "console=hvc0 root=/dev/vda rw" - -# Image generated by boot wrapper when Xen is present -BOOT_WRAPPER_AARCH64_IMAGE:xen ?= "xen-system.axf" - -EXTRA_OECONF:append:xen = " \ ---with-xen=${WORKDIR}/kernel/arch/arm64/boot/Image \ ---with-xen-cmdline="" \ -" - -EXTRA_OEMAKE:append:xen = " \ -XEN_IMAGE=${DEPLOY_DIR_IMAGE}/${BOOT_WRAPPER_AARCH64_XEN} \ -XEN_CMDLINE="${BOOT_WRAPPER_AARCH64_XEN_CMDLINE}" \ -" - -# We need xen if it is activated -do_deploy[depends] += "${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen:do_deploy', '', d)}" diff --git a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend b/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend deleted file mode 100644 index 5c38bdd668..0000000000 --- a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-devtools/gem5/gem5-aarch64-native_20.bbappend +++ /dev/null @@ -1,7 +0,0 @@ -# When booting gem5-arm64 with Xen we need to set the cpu as Cortex A53 and -# remove support for pointer authentification -GEM5_RUN_EXTRA:append = " \ -${@bb.utils.contains('DISTRO_FEATURES_NATIVE', 'xen', \ -'--param=system.cpu_cluster[0].cpus[0].isa[0].midr=0x410fd030 \ ---param=system.cpu_cluster[0].cpus[0].isa[0].id_aa64isar1_el1=0x0', \ -'', d)}" diff --git a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-extended/xen/files/gem5-arm64/early-printk.cfg b/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-extended/xen/files/gem5-arm64/early-printk.cfg deleted file mode 100644 index e89e546cef..0000000000 --- a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-extended/xen/files/gem5-arm64/early-printk.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_DEBUG=y -CONFIG_EARLY_PRINTK_VEXPRESS=y diff --git a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-extended/xen/xen_%.bbappend b/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-extended/xen/xen_%.bbappend deleted file mode 100644 index 6ee4dbde21..0000000000 --- a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-extended/xen/xen_%.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -# gem5-arm64 support -COMPATIBLE_MACHINE:gem5-arm64 = "gem5-arm64" -FILESEXTRAPATHS:prepend:gem5-arm64 := "${THISDIR}/files:" -SRC_URI:append:gem5-arm64 = " file://early-printk.cfg" diff --git a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/linux-%.bbappend b/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/linux-%.bbappend deleted file mode 100644 index 7ff3fe2b12..0000000000 --- a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/linux-%.bbappend +++ /dev/null @@ -1,14 +0,0 @@ -FILESEXTRAPATHS:prepend:gem5-arm64 := "${THISDIR}:" - -# -# virtualization kmeta extra -# -SRC_URI:append:gem5-arm64 = " file://virtualization-kmeta-extra-gem5;type=kmeta;name=virtualization-kmeta-extra-gem5;destsuffix=virtualization-kmeta-extra-gem5" - -# We need to turn off SVE support in the Linux kernel otherwise Xen is stopping -# Linux kernel with a coredump while trying to access XEN bit of CPACR1 core -# register. -LINUX_VIRTUALIZATION_DISABLE_ARM64_SVE:gem5-arm64 = "${@bb.utils.contains('DISTRO_FEATURES', \ - 'xen', ' features/disable-arm64-sve.scc','',d)}" - -KERNEL_FEATURES:append:gem5-arm64 = "${LINUX_VIRTUALIZATION_DISABLE_ARM64_SVE}" diff --git a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/virtualization-kmeta-extra-gem5/features/disable-arm64-sve.cfg b/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/virtualization-kmeta-extra-gem5/features/disable-arm64-sve.cfg deleted file mode 100644 index 7e87cab419..0000000000 --- a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/virtualization-kmeta-extra-gem5/features/disable-arm64-sve.cfg +++ /dev/null @@ -1,4 +0,0 @@ -# We need to turn off SVE support in the Linux kernel otherwise Xen is stopping -# Linux kernel with a coredump while trying to access ZEN bit of CPACR1 core -# register. -# CONFIG_ARM64_SVE is not set diff --git a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/virtualization-kmeta-extra-gem5/features/disable-arm64-sve.scc b/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/virtualization-kmeta-extra-gem5/features/disable-arm64-sve.scc deleted file mode 100644 index 6bc769ccc4..0000000000 --- a/meta-arm/meta-gem5/dynamic-layers/meta-virtualization/recipes-kernel/linux/virtualization-kmeta-extra-gem5/features/disable-arm64-sve.scc +++ /dev/null @@ -1,3 +0,0 @@ -define KFEATURE_DESCRIPTION "Disable SVE support" - -kconf non-hardware disable-arm64-sve.cfg diff --git a/meta-arm/meta-gem5/recipes-bsp/boot-wrapper-aarch64/boot-wrapper-aarch64_%.bbappend b/meta-arm/meta-gem5/recipes-bsp/boot-wrapper-aarch64/boot-wrapper-aarch64_%.bbappend deleted file mode 100644 index 3dd2cba264..0000000000 --- a/meta-arm/meta-gem5/recipes-bsp/boot-wrapper-aarch64/boot-wrapper-aarch64_%.bbappend +++ /dev/null @@ -1,16 +0,0 @@ -# Gem5 aarch64 support -COMPATIBLE_MACHINE:gem5-arm64 = "gem5-arm64" - -PROVIDES:gem5-arm64 += "virtual/gem5-bootloader" - -# For gem5 we use the dtb generated by gem5 directly -DEPENDS:append:gem5-arm64 = " gem5-aarch64-dtb" -BOOT_WRAPPER_AARCH64_DEVICETREE:gem5-arm64 = "gem5-aarch64.dtb" - -# The dtb must be generated for us to generate the axf -DEPLOY_DEPEND_LIST ?= "" -DEPLOY_DEPEND_LIST:gem5-arm64 = " gem5-aarch64-dtb:do_deploy" -do_deploy[depends] += "${DEPLOY_DEPEND_LIST}" - -# The base recipe has been upgraded, so hold back at known working revision -SRCREV = "8d5a765251d9113c3c0f9fa14de42a9e7486fe8a" diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/files/mapping.patch b/meta-arm/meta-gem5/recipes-devtools/gem5/files/mapping.patch deleted file mode 100644 index 3a7cb4379f..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/files/mapping.patch +++ /dev/null @@ -1,37 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 89958f7f30ec722e30e1bcffdeab547c874fa475 Mon Sep 17 00:00:00 2001 -From: Adrian Herrera -Date: Mon, 15 Mar 2021 13:14:44 +0000 -Subject: [PATCH] python: debug, fix Mapping import - -Change "collections.Mapping" to "collections.abc.Mapping". -"collections.Mapping" was an alias, it is deprecated starting from Python 3.3, and it will be removed in Python 3.10. - -Change-Id: Ic257e3c5206eb3d48d4eed85a93fac48bd3b8dc4 -Signed-off-by: Adrian Herrera -Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43023 -Reviewed-by: Jason Lowe-Power -Maintainer: Jason Lowe-Power -Tested-by: kokoro ---- - src/python/m5/debug.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py -index d808850cc..787a39ece 100644 ---- a/src/python/m5/debug.py -+++ b/src/python/m5/debug.py -@@ -26,7 +26,7 @@ - - from __future__ import print_function - --from collections import Mapping -+from collections.abc import Mapping - - import _m5.debug - from _m5.debug import SimpleFlag, CompoundFlag --- -2.25.1 - diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/files/start-gem5.sh b/meta-arm/meta-gem5/recipes-devtools/gem5/files/start-gem5.sh deleted file mode 100644 index 633541161d..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/files/start-gem5.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# Get parameters from bitbake configuration - -source <(bitbake -e gem5-aarch64-native | grep \ - -e "^STAGING_.*_NATIVE=" \ - -e "^DEPLOY_DIR.*=" \ - -e "^GEM5_RUN.*=") - -export M5_PATH="${DEPLOY_DIR_IMAGE}" - -args="" - -if [ -n "${GEM5_RUN_KERNEL}" ]; then - kernfile=$(readlink -f ${DEPLOY_DIR_IMAGE}/${GEM5_RUN_KERNEL}) - args="$args --kernel=$kernfile" -fi - -if [ -n "${GEM5_RUN_DISK}" ]; then - diskfile=$(readlink -f ${DEPLOY_DIR_IMAGE}/${GEM5_RUN_DISK}) - args="$args --disk-image=$diskfile" -fi - -if [ -n "${GEM5_RUN_DTB}" ]; then - dtbfile=$(readlink -f ${DEPLOY_DIR_IMAGE}/${GEM5_RUN_DTB}) - args="$args --dtb=$dtbfile" -fi - -if [ -n "${GEM5_RUN_CMDLINE}" ]; then - args="$args --command-line='${GEM5_RUN_CMDLINE}'" -fi - -if [ -n "${GEM5_RUN_EXTRA}" ]; then - args="$args ${GEM5_RUN_EXTRA}" -fi - -oe-run-native gem5-aarch64-native ${GEM5_RUN_CONFIG} \ - ${STAGING_DATADIR_NATIVE}/gem5/${GEM5_RUN_PROFILE} ${args} "$@" - diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-bootloader.inc b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-bootloader.inc deleted file mode 100644 index c4fd3a1d2c..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-bootloader.inc +++ /dev/null @@ -1,30 +0,0 @@ -# Build instructions for gem5 custom bootloader - -SUMMARY = "Gem5 AARCH64 boot loader" -LICENSE = "BSD-3-Clause" - -inherit deploy - -PROVIDES += "virtual/gem5-bootloader" - -COMPATIBLE_MACHINE = "gem5-arm64" - -BOOTLOADER_SRC_PATH ?= "${S}/system/arm/bootloader/arm64" - -# no configure step -do_configure[noexec] = "1" - -# no install -do_install[noexec] = "1" - -do_compile() { - oe_runmake -C ${BOOTLOADER_SRC_PATH} all CROSS_COMPILE=${TARGET_PREFIX} -} - -do_deploy() { - oe_runmake -C ${BOOTLOADER_SRC_PATH} install \ - CROSS_COMPILE=${TARGET_PREFIX} DESTDIR=${DEPLOYDIR}/binaries -} - -addtask deploy before do_build after do_compile - diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-bootloader_20.bb b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-bootloader_20.bb deleted file mode 100644 index 67570f6337..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-bootloader_20.bb +++ /dev/null @@ -1,7 +0,0 @@ -# gem5 custom bootloader - -require gem5-source_20.inc - -BPN = "gem5-aarch64-bootloader" - -require gem5-aarch64-bootloader.inc diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-dtb.bb b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-dtb.bb deleted file mode 100644 index 50ac030061..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-dtb.bb +++ /dev/null @@ -1,30 +0,0 @@ -# Use gem5 executable to produce a dtb - -LICENSE = "MIT" - -inherit deploy - -DEPENDS = "gem5-aarch64-native" - -do_configure[noexec] = "1" - -do_compile() { - # generate a dtb using gem5 - gem5.opt \ - ${STAGING_DATADIR_NATIVE}/gem5/${GEM5_RUN_PROFILE} \ - --dtb-gen - - if [ ! -f m5out/system.dtb ]; then - echo "No dtb generated !!!" - exit 1 - fi -} - -do_install[noexec] = "1" - -do_deploy() { - install --d ${DEPLOYDIR} - cp m5out/system.dtb ${DEPLOYDIR}/gem5-aarch64.dtb -} -addtask deploy before do_build after do_compile - diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native.inc b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native.inc deleted file mode 100644 index 2fd5206e0f..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native.inc +++ /dev/null @@ -1,40 +0,0 @@ -# gem5 aarch64 specific configuration - -# Build arm64 gem5 -GEM5_BUILD_CONFIGS ?= "build/ARM/gem5.${GEM5_BUILD_VARIANT}" - -SRC_URI += "file://start-gem5.sh" - -inherit deploy - -# Parameters for the start script - -GEM5_RUN_CONFIG ?= "gem5.${GEM5_BUILD_VARIANT}" - -# Linux kernel file to boot -GEM5_RUN_KERNEL ?= "vmlinux" - -# Disk Image to use -GEM5_RUN_DISK ?= "*-${MACHINE}.ext4" - -# DTB to use -GEM5_RUN_DTB ?= "${@os.path.basename(d.getVar('KERNEL_DEVICETREE'))}" - -# Linux command line to pass -GEM5_RUN_CMDLINE ?= "earlyprintk=pl011,0x1c090000 console=ttyAMA0 rw mem=512MB root=/dev/sda rootwait" - -# Extra arguments to pass to gem5 -GEM5_RUN_EXTRA ?= "--mem-size=512MB -n 4 --machine-type=VExpress_GEM5_V2" - -#This is required so that our binaries are in the sysroot. We need this -# to have both gem5 required libraries and gem5 in the same sysroot. -addtask addto_recipe_sysroot after do_populate_sysroot before do_build - -do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_TOOLS}" -do_deploy() { - install -d ${DEPLOYDIR} - - install -m 755 ${WORKDIR}/start-gem5.sh ${DEPLOYDIR}/. -} -addtask deploy before do_build after do_compile - diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native/0001-dev-arm-SMMUv3-enable-interrupt-interface.patch b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native/0001-dev-arm-SMMUv3-enable-interrupt-interface.patch deleted file mode 100644 index 6d00cc26db..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native/0001-dev-arm-SMMUv3-enable-interrupt-interface.patch +++ /dev/null @@ -1,97 +0,0 @@ -From be710c5657b03bc9a9ce18ecf7ce1956265bae47 Mon Sep 17 00:00:00 2001 -From: Adrian Herrera -Date: Thu, 10 Dec 2020 18:07:21 +0000 -Subject: [PATCH] dev-arm: SMMUv3, enable interrupt interface - -Users can set "irq_interface_enable" to allow software to program -SMMU_IRQ_CTRL and SMMU_IRQ_CTRLACK. This is required to boot Linux v5.4+ -in a reasonable time. Notice the model does not implement architectural -interrupt sources, so no assertions will happen. - -Change-Id: Ie138befdf5a204fe8fce961081c575c2166e22b9 -Signed-off-by: Adrian Herrera -Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38555 -Tested-by: kokoro -Reviewed-by: Andreas Sandberg -Maintainer: Andreas Sandberg - -Upstream-Status: Accepted [https://gem5-review.googlesource.com/c/public/gem5/+/38555] -Expected version: v20.2 ---- - src/dev/arm/SMMUv3.py | 5 +++++ - src/dev/arm/smmu_v3.cc | 10 +++++++++- - src/dev/arm/smmu_v3.hh | 4 +++- - 3 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/src/dev/arm/SMMUv3.py b/src/dev/arm/SMMUv3.py -index 29c15682bf..f57be896f9 100644 ---- a/src/dev/arm/SMMUv3.py -+++ b/src/dev/arm/SMMUv3.py -@@ -91,6 +91,11 @@ class SMMUv3(ClockedObject): - reg_map = Param.AddrRange('Address range for control registers') - system = Param.System(Parent.any, "System this device is part of") - -+ irq_interface_enable = Param.Bool(False, -+ "This flag enables software to program SMMU_IRQ_CTRL and " -+ "SMMU_IRQ_CTRLACK as if the model implemented architectural " -+ "interrupt sources") -+ - device_interfaces = VectorParam.SMMUv3DeviceInterface([], - "Responder interfaces") - -diff --git a/src/dev/arm/smmu_v3.cc b/src/dev/arm/smmu_v3.cc -index f9bdc277c6..d73f270170 100644 ---- a/src/dev/arm/smmu_v3.cc -+++ b/src/dev/arm/smmu_v3.cc -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2013, 2018-2019 ARM Limited -+ * Copyright (c) 2013, 2018-2020 ARM Limited - * All rights reserved - * - * The license below extends only to copyright in the software and shall -@@ -58,6 +58,7 @@ SMMUv3::SMMUv3(SMMUv3Params *params) : - requestPort(name() + ".request", *this), - tableWalkPort(name() + ".walker", *this), - controlPort(name() + ".control", *this, params->reg_map), -+ irqInterfaceEnable(params->irq_interface_enable), - tlb(params->tlb_entries, params->tlb_assoc, params->tlb_policy), - configCache(params->cfg_entries, params->cfg_assoc, params->cfg_policy), - ipaCache(params->ipa_entries, params->ipa_assoc, params->ipa_policy), -@@ -626,6 +627,13 @@ SMMUv3::writeControl(PacketPtr pkt) - assert(pkt->getSize() == sizeof(uint32_t)); - regs.cr0 = regs.cr0ack = pkt->getLE(); - break; -+ case offsetof(SMMURegs, irq_ctrl): -+ assert(pkt->getSize() == sizeof(uint32_t)); -+ if (irqInterfaceEnable) { -+ warn("SMMUv3::%s No support for interrupt sources", __func__); -+ regs.irq_ctrl = regs.irq_ctrlack = pkt->getLE(); -+ } -+ break; - - case offsetof(SMMURegs, cr1): - case offsetof(SMMURegs, cr2): -diff --git a/src/dev/arm/smmu_v3.hh b/src/dev/arm/smmu_v3.hh -index 6b3f3982b8..a001d71178 100644 ---- a/src/dev/arm/smmu_v3.hh -+++ b/src/dev/arm/smmu_v3.hh -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2013, 2018-2019 ARM Limited -+ * Copyright (c) 2013, 2018-2020 ARM Limited - * All rights reserved - * - * The license below extends only to copyright in the software and shall -@@ -94,6 +94,8 @@ class SMMUv3 : public ClockedObject - SMMUTableWalkPort tableWalkPort; - SMMUControlPort controlPort; - -+ const bool irqInterfaceEnable; -+ - ARMArchTLB tlb; - ConfigCache configCache; - IPACache ipaCache; --- -2.17.1 - diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native_20.bb b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native_20.bb deleted file mode 100644 index 057aad878c..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-aarch64-native_20.bb +++ /dev/null @@ -1,22 +0,0 @@ -require gem5-source_20.inc - -SRC_URI += "file://0001-dev-arm-SMMUv3-enable-interrupt-interface.patch" - -BPN = "gem5-aarch64-native" - -require gem5-aarch64-native.inc -require gem5-native.inc - -# Get rid of compiler errors when building protobuf -GEM5_SCONS_ARGS:append = " CCFLAGS_EXTRA='-Wno-error=unused-variable' --verbose" - -# Get rid of linker errors and have a faster link process -GEM5_SCONS_ARGS:append = " LDFLAGS_EXTRA='${BUILD_LDFLAGS}' \ -MARSHAL_LDFLAGS_EXTRA='${BUILD_LDFLAGS}' --force-lto " - -do_compile:prepend() { - # Gem5 expect to have python in the path (can be python2 or 3) - # Create a link named python to python3 - real=$(which ${PYTHON}) - ln -snf $real $(dirname $real)/python -} diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5ops/0001-util-m5ops-optional-extra-build-flags.patch b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5ops/0001-util-m5ops-optional-extra-build-flags.patch deleted file mode 100644 index b446a2fe01..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5ops/0001-util-m5ops-optional-extra-build-flags.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 32e35a2f179d1b036d2eb699d77f869f7787f36b Mon Sep 17 00:00:00 2001 -From: Adrian Herrera -Date: Tue, 8 Dec 2020 20:12:55 +0000 -Subject: [PATCH] util: m5ops, optional extra build flags - -This increases compilation control for users. Main use case is building -m5ops as part of an image distribution. Specifying a different sysroot -or dynamic linker may be required when the cross toolchain is built as -part of the process. - -Change-Id: Icbd3faa92ea6e084fc4a9b2db83129bce73faf21 -Signed-off-by: Adrian Herrera -Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38416 -Reviewed-by: Jason Lowe-Power -Reviewed-by: Gabe Black -Maintainer: Jason Lowe-Power -Tested-by: kokoro - -Upstream-Status: Accepted [https://gem5-review.googlesource.com/c/public/gem5/+/38416] -Expected version: v20.2 ---- - util/m5/SConstruct | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/util/m5/SConstruct b/util/m5/SConstruct -index bbae8d9bbf..a37573d763 100644 ---- a/util/m5/SConstruct -+++ b/util/m5/SConstruct -@@ -136,16 +136,24 @@ for root, dirs, files in os.walk(abspath(src_dir)): - # - # This also considers scons command line settings which may look like - # environment variables, but are set after "scons" on the command line. -- def get_abi_opt(name, default): -+ def _extract_abi_opt_val(name, default): - var_name = env.subst('${ABI}.%s' % name) -- env[name] = os.environ.get( -- var_name, ARGUMENTS.get(var_name, default)) -+ return os.environ.get(var_name, ARGUMENTS.get(var_name, default)) -+ def get_abi_opt(name, default): -+ env[name] = _extract_abi_opt_val(name, default) -+ def append_abi_opt(name): -+ env.Append(**{ name: _extract_abi_opt_val(name, '') }) - - # Process the ABI's settings in the SConsopts file, storing them - # in a copy of the primary environment. - env.SConscript(Dir(root).File('SConsopts'), - exports=[ 'env', 'get_abi_opt' ]) - -+ # The user can pass extra build flags for each ABI -+ append_abi_opt('CCFLAGS') -+ append_abi_opt('CXXFLAGS') -+ append_abi_opt('LINKFLAGS') -+ - # Once all the options have been configured, set up build targets for - # this abi. - abi_dir = build_dir.Dir(env.subst('${ABI}')) --- -2.17.1 - diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5ops_20.bb b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5ops_20.bb deleted file mode 100644 index d55ed8575c..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5ops_20.bb +++ /dev/null @@ -1,26 +0,0 @@ -require gem5-source_20.inc -inherit scons - -HOMEPAGE = "https://www.gem5.org/documentation/general_docs/m5ops" -SUMMARY = "m5ops provide pseudo-instructions to trigger gem5 functionality" -LICENSE = "BSD-3-Clause" - -M5OPS_DIR = "util/m5" - -SRC_URI += "file://0001-util-m5ops-optional-extra-build-flags.patch" - -OUT_DIR = "build/${TARGET_ARCH}/out" - -EXTRA_OESCONS += "${TARGET_ARCH}.CROSS_COMPILE=${TARGET_PREFIX} \ - ${TARGET_ARCH}.CCFLAGS=--sysroot=${STAGING_DIR_TARGET} \ - ${TARGET_ARCH}.LINKFLAGS=--sysroot=${STAGING_DIR_TARGET} \ - -C ${S}/${M5OPS_DIR} ${OUT_DIR}/m5" - -# The SConstruct file for m5ops does not provide a "install" target -# We do the install process within the recipe -do_install() { - install -d ${D}${bindir} ${D}${libdir} ${D}${includedir} - install -m 755 ${B}/${M5OPS_DIR}/${OUT_DIR}/m5 ${D}${bindir} - install -m 644 ${B}/${M5OPS_DIR}/${OUT_DIR}/libm5.a ${D}${libdir} - install -m 644 ${B}/include/gem5/m5ops.h ${D}${includedir} -} diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5term-native_20.bb b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5term-native_20.bb deleted file mode 100644 index b91dbbc72b..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5term-native_20.bb +++ /dev/null @@ -1,24 +0,0 @@ -require gem5-source_20.inc - -SUMMARY = "m5term allows users to connect to gem5's simulated console" -HOMEPAGE = "https://www.gem5.org/documentation/general_docs/fullsystem/m5term" -LICENSE = "BSD-3-Clause" - -inherit native - -M5TERM_DIR = "util/term" - -SRC_URI += "file://0001-add-makefile-flags.patch" - -do_compile() { - oe_runmake -C ${S}/${M5TERM_DIR} -} - -# The Makefile for m5term does not provide a "install" target -# We do the install process within the recipe -do_install() { - install -d ${D}${bindir} - install -m 755 ${B}/${M5TERM_DIR}/m5term ${D}${bindir} -} - -addtask addto_recipe_sysroot before do_build diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5term/0001-add-makefile-flags.patch b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5term/0001-add-makefile-flags.patch deleted file mode 100644 index d13ef4ceb8..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-m5term/0001-add-makefile-flags.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 688f7103e08318edbd48cf830c0ab3a048761bbb Mon Sep 17 00:00:00 2001 -From: Adrian Herrera -Date: Thu, 03 Dec 2020 16:45:59 +0000 -Subject: [PATCH] util: m5term, fix LDFLAGS, standard make variables - -Enables build systems to provide necessary flags to build m5term. -Useful specially if a different linker is intended to be used. - -Change-Id: If7f867cc0965d6ad4627b5421e00a99cc3d64989 -Signed-off-by: Adrian Herrera - -Upstream-Status: Accepted [https://gem5-review.googlesource.com/c/public/gem5/+/38256] -Expected version: v20.2 ---- - -diff --git a/util/term/Makefile b/util/term/Makefile -index 658b961..4aa1c52 100644 ---- a/util/term/Makefile -+++ b/util/term/Makefile -@@ -24,12 +24,12 @@ - # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --CCFLAGS= -g -O0 -+CFLAGS ?= -g -O0 - - default: m5term - - m5term: term.c -- $(CC) $(LFLAGS) -o $@ $^ -+ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) - - install: m5term - $(SUDO) install -o root -m 555 m5term /usr/local/bin diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-native.inc b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-native.inc deleted file mode 100644 index 91a554bbbc..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-native.inc +++ /dev/null @@ -1,52 +0,0 @@ -# gem5 platform independent build information - -SUMMARY = "A modular platform for computer-system architecture research" -HOMEPAGE = "http://gem5.org" -LICENSE = "BSD-3-Clause & MIT & LGPL-2.1-only" - -# Gem5 build and run parameter - -# See http://www.gem5.org/documentation/general_docs/building for the list of variants -GEM5_BUILD_VARIANT ?= "opt" - -# What gem5 binary are we building -GEM5_BUILD_CONFIGS ?= "build/X86/gem5.{GEM5_BUILD_VARIANT}" - -# Scons build arguments -GEM5_SCONS_ARGS ?= "CC=${BUILD_CC} CXX=${BUILD_CXX} \ - AS=${BUILD_AS} AR=${BUILD_AR} ${GEM5_BUILD_CONFIGS} \ - PYTHON_CONFIG=python3-config" - -# Default profile to run -GEM5_RUN_PROFILE ?= "configs/example/fs.py" - -# We are building a native package and we need to use scons -inherit scons native - -# the build is using several tools: -# python3: scons and six -# google protobuf -# pkgconfig -# hdf5 -DEPENDS += "m4-native python3-six-native protobuf-native hdf5-native pkgconfig-native \ - boost-native libpng-native" - -EXTRA_OESCONS = "${GEM5_SCONS_ARGS}" - -do_install() { - - install -d ${D}${datadir}/gem5 - cp -a --no-preserve=ownership -rf configs ${D}${datadir}/gem5/. - - for f in ${GEM5_BUILD_CONFIGS}; do - destname=$(basename $f) - install -d ${D}${bindir} - install -m 755 $f ${D}${bindir}/$destname - done -} - -FILES:${PN} = "${datadir}/gem5/* ${bindir}/*" -INSANE_SKIP:${PN} += "already-stripped" -RDEPENDS:${PN} += "python3-native hdf5-native protobuf-native libpng-native" - -addtask addto_recipe_sysroot before do_build diff --git a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-source_20.inc b/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-source_20.inc deleted file mode 100644 index bf448fef4b..0000000000 --- a/meta-arm/meta-gem5/recipes-devtools/gem5/gem5-source_20.inc +++ /dev/null @@ -1,11 +0,0 @@ -LIC_FILES_CHKSUM = "file://COPYING;md5=2d9514d69d8abf88b6e9125e759bf0ab \ - file://LICENSE;md5=a585e2893cee63d16a1d8bc16c6297ec" - -SRC_URI = "git://gem5.googlesource.com/public/gem5;protocol=https;nobranch=1 \ - file://mapping.patch" -RELEASE_TAG = "v20.1.0.5" -SRCREV = "31cd81fdec46bae4b48d4f3788776936389dbdec" - -PV = "${RELEASE_TAG}" - -S = "${WORKDIR}/git" diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/0001-lib-build_OID_registry-fix-reproducibility-issues.patch b/meta-arm/meta-gem5/recipes-kernel/linux/files/0001-lib-build_OID_registry-fix-reproducibility-issues.patch deleted file mode 100644 index 4c95a415a2..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/0001-lib-build_OID_registry-fix-reproducibility-issues.patch +++ /dev/null @@ -1,46 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From f678d79b3bede48c9e095e6e9c46bd3542f23077 Mon Sep 17 00:00:00 2001 -From: Bruce Ashfield -Date: Sun, 10 Jul 2022 22:56:53 -0400 -Subject: [PATCH 1/2] lib/build_OID_registry: fix reproducibility issues - -The script build_OID_registry captures the full path of itself -in the generated data. This causes reproduciblity issues as the -path is captured and packaged. - -We use the basename of the script instead, and that allows us -to be reprodicible, with slightly less information captured in -the output data (but the generating script can still easily -be found). - -Signed-off-by: Bruce Ashfield ---- - lib/build_OID_registry | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/lib/build_OID_registry b/lib/build_OID_registry -index d7fc32ea8ac2..f6de0a7f7457 100755 ---- a/lib/build_OID_registry -+++ b/lib/build_OID_registry -@@ -8,6 +8,7 @@ - # - - use strict; -+use File::Basename; - - my @names = (); - my @oids = (); -@@ -35,7 +36,7 @@ close IN_FILE || die; - # - open C_FILE, ">$ARGV[1]" or die; - print C_FILE "/*\n"; --print C_FILE " * Automatically generated by ", $0, ". Do not edit\n"; -+print C_FILE " * Automatically generated by ", basename $0, ". Do not edit\n"; - print C_FILE " */\n"; - - # --- -2.34.1 - diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/0002-vt-conmakehash-improve-reproducibility.patch b/meta-arm/meta-gem5/recipes-kernel/linux/files/0002-vt-conmakehash-improve-reproducibility.patch deleted file mode 100644 index 74156afe8e..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/0002-vt-conmakehash-improve-reproducibility.patch +++ /dev/null @@ -1,56 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 10a09290f97d0435b9b304d3ef980b0cafa87bd2 Mon Sep 17 00:00:00 2001 -From: Bruce Ashfield -Date: Sun, 10 Jul 2022 21:37:07 -0400 -Subject: [PATCH 2/2] vt/conmakehash: improve reproducibility - -The file generated by conmakehash capture the application -path used to generate the file. While that can be informative, -it varies based on where the kernel was built, as the full -path is captured. - -We tweak the application to use a second input as the "capture -name", and then modify the Makefile to pass the basename of -the source, making it reproducible. - -This could be improved by using some sort of path mapping, -or the application manipualing argv[1] itself, but for now -this solves the reprodicibility issue. - -Signed-off-by: Bruce Ashfield ---- - drivers/tty/vt/Makefile | 2 +- - scripts/conmakehash.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/tty/vt/Makefile b/drivers/tty/vt/Makefile -index edbbe0ccdb83..19e21968f8de 100644 ---- a/drivers/tty/vt/Makefile -+++ b/drivers/tty/vt/Makefile -@@ -13,7 +13,7 @@ obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o - clean-files := consolemap_deftbl.c defkeymap.c - - quiet_cmd_conmk = CONMK $@ -- cmd_conmk = scripts/conmakehash $< > $@ -+ cmd_conmk = scripts/conmakehash $< $(shell basename $<) > $@ - - $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) - $(call cmd,conmk) -diff --git a/scripts/conmakehash.c b/scripts/conmakehash.c -index cddd789fe46e..d62510b280e9 100644 ---- a/scripts/conmakehash.c -+++ b/scripts/conmakehash.c -@@ -253,7 +253,7 @@ int main(int argc, char *argv[]) - #include \n\ - \n\ - u8 dfont_unicount[%d] = \n\ --{\n\t", argv[1], fontlen); -+{\n\t", argv[2], fontlen); - - for ( i = 0 ; i < fontlen ; i++ ) - { --- -2.34.1 - diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_1cpu.dts b/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_1cpu.dts deleted file mode 100644 index 0e59fdf890..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_1cpu.dts +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2015-2016 ARM Limited - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Andreas Sandberg - */ - -/dts-v1/; - -/memreserve/ 0x80000000 0x00010000; - -/include/ "vexpress_gem5_v2.dtsi" - -/ { - model = "V2P-AARCH64"; - compatible = "arm,vexpress,v2p-aarch64", "arm,vexpress"; - - memory@80000000 { - device_type = "memory"; - reg = <0 0x80000000 0x4 0x00000000>; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 0 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - }; - - virt-encoder { - compatible = "drm,virtual-encoder"; - port { - dp0_virt_input: endpoint@0 { - remote-endpoint = <&dp0_output>; - }; - }; - - display-timings { - native-mode = <&timing0>; - - timing0: timing_1080p60 { - /* 1920x1080-60 */ - clock-frequency = <148500000>; - hactive = <1920>; - vactive = <1080>; - hfront-porch = <148>; - hback-porch = <88>; - hsync-len = <44>; - vfront-porch = <36>; - vback-porch = <4>; - vsync-len = <5>; - }; - }; - }; -}; - -&dp0 { - status = "ok"; - - port { - dp0_output: endpoint@0 { - remote-endpoint = <&dp0_virt_input>; - }; - }; -}; diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_2cpu.dts b/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_2cpu.dts deleted file mode 100644 index 441d3df2a1..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_2cpu.dts +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2015-2016 ARM Limited - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Andreas Sandberg - */ - -/dts-v1/; - -/memreserve/ 0x80000000 0x00010000; - -/include/ "vexpress_gem5_v2.dtsi" - -/ { - model = "V2P-AARCH64"; - compatible = "arm,vexpress,v2p-aarch64", "arm,vexpress"; - - memory@80000000 { - device_type = "memory"; - reg = <0 0x80000000 0x4 0x00000000>; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 0 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@1 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 1 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - }; - - virt-encoder { - compatible = "drm,virtual-encoder"; - port { - dp0_virt_input: endpoint@0 { - remote-endpoint = <&dp0_output>; - }; - }; - - display-timings { - native-mode = <&timing0>; - - timing0: timing_1080p60 { - /* 1920x1080-60 */ - clock-frequency = <148500000>; - hactive = <1920>; - vactive = <1080>; - hfront-porch = <148>; - hback-porch = <88>; - hsync-len = <44>; - vfront-porch = <36>; - vback-porch = <4>; - vsync-len = <5>; - }; - }; - }; -}; - -&dp0 { - status = "ok"; - - port { - dp0_output: endpoint@0 { - remote-endpoint = <&dp0_virt_input>; - }; - }; -}; diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_4cpu.dts b/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_4cpu.dts deleted file mode 100644 index 2d0311a5f8..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_4cpu.dts +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2015-2016 ARM Limited - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Andreas Sandberg - */ - -/dts-v1/; - -/memreserve/ 0x80000000 0x00010000; - -/include/ "vexpress_gem5_v2.dtsi" - -/ { - model = "V2P-AARCH64"; - compatible = "arm,vexpress,v2p-aarch64", "arm,vexpress"; - - memory@80000000 { - device_type = "memory"; - reg = <0 0x80000000 0x4 0x00000000>; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 0 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@1 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 1 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@2 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 2 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@3 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 3 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - }; - - virt-encoder { - compatible = "drm,virtual-encoder"; - port { - dp0_virt_input: endpoint@0 { - remote-endpoint = <&dp0_output>; - }; - }; - - display-timings { - native-mode = <&timing0>; - - timing0: timing_1080p60 { - /* 1920x1080-60 */ - clock-frequency = <148500000>; - hactive = <1920>; - vactive = <1080>; - hfront-porch = <148>; - hback-porch = <88>; - hsync-len = <44>; - vfront-porch = <36>; - vback-porch = <4>; - vsync-len = <5>; - }; - }; - }; -}; - -&dp0 { - status = "ok"; - - port { - dp0_output: endpoint@0 { - remote-endpoint = <&dp0_virt_input>; - }; - }; -}; diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_8cpu.dts b/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_8cpu.dts deleted file mode 100644 index ba94d07469..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/armv8_gem5_v2_8cpu.dts +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2015-2016 ARM Limited - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Andreas Sandberg - */ - -/dts-v1/; - -/memreserve/ 0x80000000 0x00010000; - -/include/ "vexpress_gem5_v2.dtsi" - -/ { - model = "V2P-AARCH64"; - compatible = "arm,vexpress,v2p-aarch64", "arm,vexpress"; - - memory@80000000 { - device_type = "memory"; - reg = <0 0x80000000 0x4 0x00000000>; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 0 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@1 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 1 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@2 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 2 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@3 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 3 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@4 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 4 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@5 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 5 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@6 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 6 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - cpu@7 { - device_type = "cpu"; - compatible = "gem5,armv8", "arm,armv8"; - reg = < 7 >; - enable-method = "spin-table"; - cpu-release-addr = <0 0x8000fff8>; - }; - - }; - - virt-encoder { - compatible = "drm,virtual-encoder"; - port { - dp0_virt_input: endpoint@0 { - remote-endpoint = <&dp0_output>; - }; - }; - - display-timings { - native-mode = <&timing0>; - - timing0: timing_1080p60 { - /* 1920x1080-60 */ - clock-frequency = <148500000>; - hactive = <1920>; - vactive = <1080>; - hfront-porch = <148>; - hback-porch = <88>; - hsync-len = <44>; - vfront-porch = <36>; - vback-porch = <4>; - vsync-len = <5>; - }; - }; - }; -}; - -&dp0 { - status = "ok"; - - port { - dp0_output: endpoint@0 { - remote-endpoint = <&dp0_virt_input>; - }; - }; -}; diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/vexpress_gem5_v2.dtsi b/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/vexpress_gem5_v2.dtsi deleted file mode 100644 index e53e6e84b3..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/vexpress_gem5_v2.dtsi +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2015-2018 ARM Limited - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Andreas Sandberg - */ - -/include/ "vexpress_gem5_v2_base.dtsi" - -/ { - /* The display processor needs custom configuration to setup its - * output ports. Disable it by default in the platform until the - * DT bindings have stabilize. - */ - dp0: hdlcd@2b000000 { - compatible = "arm,hdlcd"; - reg = <0x0 0x2b000000 0x0 0x1000>; - interrupts = <0 63 4>; - clocks = <&osc_pxl>; - clock-names = "pxlclk"; - status = "disabled"; - }; -}; diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/vexpress_gem5_v2_base.dtsi b/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/vexpress_gem5_v2_base.dtsi deleted file mode 100644 index eba0db2526..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/dts/gem5-arm64/vexpress_gem5_v2_base.dtsi +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2015-2017, 2019 ARM Limited - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Andreas Sandberg - */ - -/ { - arm,hbi = <0x0>; - arm,vexpress,site = <0xf>; - interrupt-parent = <&gic>; - #address-cells = <2>; - #size-cells = <2>; - - gic: interrupt-controller@2c000000 { - compatible = "arm,gic-v3"; - #interrupt-cells = <0x3>; - #address-cells = <0x2>; - ranges; - interrupt-controller; - redistributor-stride = <0x0 0x40000>; // 256kB stride - reg = <0x0 0x2c000000 0x0 0x10000 - 0x0 0x2c010000 0x0 0x2000000 // room for 128 redistributors using 128K each (256K strided...) - 0x0 0x0 0x0 0x0>; - interrupts = <1 9 0xf04>; - #size-cells = <0x2>; - linux,phandle = <0x1>; - phandle = <0x1>; - - gic-its@2e010000 { - compatible = "arm,gic-v3-its"; - msi-controller; - #msi-cells = <1>; - reg = <0x0 0x2e010000 0 0x20000>; - }; - }; - - timer { - compatible = "arm,cortex-a15-timer", - "arm,armv7-timer"; - interrupts = <1 13 0xf08>, - <1 14 0xf08>, - <1 11 0xf08>, - <1 10 0xf08>; - clocks = <&osc_sys>; - clock-names="apb_pclk"; - }; - - pci { - compatible = "pci-host-ecam-generic"; - device_type = "pci"; - #address-cells = <0x3>; - #size-cells = <0x2>; - #interrupt-cells = <0x1>; - - reg = <0x0 0x30000000 0x0 0x10000000>; - - ranges = <0x01000000 0x0 0x00000000 0x0 0x2f000000 0x0 0x00010000>, - <0x02000000 0x0 0x40000000 0x0 0x40000000 0x0 0x40000000>; - - /* - child unit address, #cells = #address-cells - child interrupt specifier, #cells = #interrupt-cells (INTA = 1, INTB = 2, INTC = 3 and INTD = 4) - interrupt-parent, phandle - parent unit address, #cells = #address-cells@gic - parent interrupt specifier, #cells = #interrupt-cells@gic - */ - interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0x0 0x0 0x44 0x1 - 0x800 0x0 0x0 0x1 &gic 0x0 0x0 0x0 0x45 0x1 - 0x1000 0x0 0x0 0x1 &gic 0x0 0x0 0x0 0x46 0x1 - 0x1800 0x0 0x0 0x1 &gic 0x0 0x0 0x0 0x47 0x1>; - - interrupt-map-mask = <0x001800 0x0 0x0 0x0>; - dma-coherent; - }; - - kmi@1c060000 { - compatible = "arm,pl050", "arm,primecell"; - reg = <0x0 0x1c060000 0x0 0x1000>; - interrupts = <0 12 4>; - clocks = <&v2m_clk24mhz>, <&osc_smb>; - clock-names = "KMIREFCLK", "apb_pclk"; - }; - - kmi@1c070000 { - compatible = "arm,pl050", "arm,primecell"; - reg = <0x0 0x1c070000 0x0 0x1000>; - interrupts = <0 13 4>; - clocks = <&v2m_clk24mhz>, <&osc_smb>; - clock-names = "KMIREFCLK", "apb_pclk"; - }; - - uart0: uart@1c090000 { - compatible = "arm,pl011", "arm,primecell"; - reg = <0x0 0x1c090000 0x0 0x1000>; - interrupts = <0 5 4>; - clocks = <&osc_peripheral>, <&osc_smb>; - clock-names = "uartclk", "apb_pclk"; - }; - - rtc@1c170000 { - compatible = "arm,pl031", "arm,primecell"; - reg = <0x0 0x1c170000 0x0 0x1000>; - interrupts = <0 4 4>; - clocks = <&osc_smb>; - clock-names = "apb_pclk"; - }; - - v2m_clk24mhz: clk24mhz { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <24000000>; - clock-output-names = "v2m:clk24mhz"; - }; - - - v2m_sysreg: sysreg@1c010000 { - compatible = "arm,vexpress-sysreg"; - reg = <0 0x1c010000 0x0 0x1000>; - gpio-controller; - #gpio-cells = <2>; - }; - - vio@1c130000 { - compatible = "virtio,mmio"; - reg = <0 0x1c130000 0x0 0x1000>; - interrupts = <0 42 4>; - }; - - vio@1c140000 { - compatible = "virtio,mmio"; - reg = <0 0x1c140000 0x0 0x1000>; - interrupts = <0 43 4>; - }; - - dcc { - compatible = "arm,vexpress,config-bus"; - arm,vexpress,config-bridge = <&v2m_sysreg>; - - osc_pxl: osc@5 { - compatible = "arm,vexpress-osc"; - arm,vexpress-sysreg,func = <1 5>; - freq-range = <23750000 1000000000>; - #clock-cells = <0>; - clock-output-names = "oscclk5"; - }; - - osc_smb: osc@6 { - compatible = "arm,vexpress-osc"; - arm,vexpress-sysreg,func = <1 6>; - freq-range = <20000000 50000000>; - #clock-cells = <0>; - clock-output-names = "oscclk6"; - }; - - osc_sys: osc@7 { - compatible = "arm,vexpress-osc"; - arm,vexpress-sysreg,func = <1 7>; - freq-range = <20000000 60000000>; - #clock-cells = <0>; - clock-output-names = "oscclk7"; - }; - }; - - - mcc { - compatible = "arm,vexpress,config-bus"; - arm,vexpress,config-bridge = <&v2m_sysreg>; - arm,vexpress,site = <0>; - - osc_peripheral: osc@2 { - compatible = "arm,vexpress-osc"; - arm,vexpress-sysreg,func = <1 2>; - freq-range = <24000000 24000000>; - #clock-cells = <0>; - clock-output-names = "v2m:oscclk2"; - }; - }; -}; diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/files/init_disassemble_info-signature-changes-causes-compile-failures.patch b/meta-arm/meta-gem5/recipes-kernel/linux/files/init_disassemble_info-signature-changes-causes-compile-failures.patch deleted file mode 100644 index 3d7ac92eaa..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/files/init_disassemble_info-signature-changes-causes-compile-failures.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 4af28e8e58b6c461a3b85960b222dade8b6891ce Mon Sep 17 00:00:00 2001 -From: Andres Freund -Date: Wed, 22 Jun 2022 11:19:18 -0700 -Subject: [PATCH] init_disassemble_info() signature changes causes compile - failures -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Hi, - -binutils changed the signature of init_disassemble_info(), which now causes -perf and bpftool to fail to compile (e.g. on debian unstable). - -Relevant binutils commit: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=60a3da00bd5407f07d64dff82a4dae98230dfaac - -util/annotate.c: In function ‘symbol__disassemble_bpf’: -util/annotate.c:1765:9: error: too few arguments to function ‘init_disassemble_info’ - 1765 | init_disassemble_info(&info, s, - | ^~~~~~~~~~~~~~~~~~~~~ -In file included from util/annotate.c:1718: -/usr/include/dis-asm.h:472:13: note: declared here - 472 | extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream, - | ^~~~~~~~~~~~~~~~~~~~~ - -with equivalent failures in - -tools/bpf/bpf_jit_disasm.c -tools/bpf/bpftool/jit_disasm.c - -The fix is easy enough, add a wrapper around fprintf() that conforms to the -new signature. - -However I assume the necessary feature test and wrapper should only be added -once? I don't know the kernel stuff well enough to choose the right structure -here. - -Attached is my local fix for perf. Obviously would need work to be a real -solution. - -Greetings, - -Andres Freund ---- - -binutils 2.39 changed the signature of init_disassemble_info(), -which now causes perf and bpftool to fail to compile. - -Relevant binutils commit: [1] - -There is a proper fix in development upstream[2]. -This is a work-around for older kernels. - -[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=60a3da00bd5407f07d64dff82a4dae98230dfaac -[2] https://patchwork.kernel.org/project/netdevbpf/cover/20220801013834.156015-1-andres@anarazel.de/ - -Upstream-Status: Pending -Signed-off-by: Anton Antonov - - - tools/perf/util/annotate.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c -index 0c5e4ce390ef..1151c029f714 100644 ---- a/tools/perf/util/annotate.c -+++ b/tools/perf/util/annotate.c -@@ -1708,6 +1708,18 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil - #include - #include - -+static int fprintf_styled(void *, enum disassembler_style, const char* fmt, ...) -+{ -+ va_list args; -+ int r; -+ -+ va_start(args, fmt); -+ r = vprintf(fmt, args); -+ va_end(args); -+ -+ return r; -+} -+ - static int symbol__disassemble_bpf(struct symbol *sym, - struct annotate_args *args) - { -@@ -1750,7 +1762,8 @@ static int symbol__disassemble_bpf(struct symbol *sym, - goto out; - } - init_disassemble_info(&info, s, -- (fprintf_ftype) fprintf); -+ (fprintf_ftype) fprintf, -+ fprintf_styled); - - info.arch = bfd_get_arch(bfdf); - info.mach = bfd_get_mach(bfdf); --- -2.30.2 - diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64-standard.scc b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64-standard.scc deleted file mode 100644 index 0fb69e4076..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64-standard.scc +++ /dev/null @@ -1,11 +0,0 @@ -define KMACHINE gem5-arm64 -define KTYPE standard -define KARCH arm64 - -include ktypes/standard/standard.scc - -include gem5-arm64.scc - -# default policy for standard kernels -#include features/latencytop/latencytop.scc -#include features/profiling/profiling.scc diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64.scc b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64.scc deleted file mode 100644 index a24a3af2b9..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64.scc +++ /dev/null @@ -1,14 +0,0 @@ -include features/input/input.scc -include features/net/net.scc -include cfg/timer/no_hz.scc - -kconf hardware gem5-arm64/gem5-arm64-board.cfg -kconf hardware gem5-arm64/gem5-arm64-drm.cfg -kconf hardware gem5-arm64/gem5-arm64-net.cfg -kconf hardware gem5-arm64/gem5-arm64-rtc.cfg -kconf hardware gem5-arm64/gem5-arm64-serial.cfg -kconf hardware gem5-arm64/gem5-arm64-virtio.cfg -kconf hardware gem5-arm64/gem5-arm64-cfi.cfg -kconf hardware gem5-arm64/gem5-arm64-virtio.cfg -kconf hardware gem5-arm64/gem5-arm64-pci.cfg -kconf hardware gem5-arm64/gem5-arm64-pata.cfg diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-board.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-board.cfg deleted file mode 100644 index 56bb9e6d35..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-board.cfg +++ /dev/null @@ -1,23 +0,0 @@ -CONFIG_ARM64=y -CONFIG_ARCH_VEXPRESS=y -CONFIG_SMP=y -CONFIG_NR_CPUS=256 -CONFIG_HOTPLUG_CPU=y - -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y - -CONFIG_CPU_IDLE=y -CONFIG_ARM_CPUIDLE=y - -CONFIG_VEXPRESS_CONFIG=y - -# Keyboard over AMBA -CONFIG_SERIO=y -CONFIG_SERIO_AMBAKMI=y - -CONFIG_MFD_VEXPRESS_SYSREG=y - -# Turn off RAID to speed up boot -CONFIG_MD=n -CONFIG_BTRFS_FS=n diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-cfi.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-cfi.cfg deleted file mode 100644 index f28e0d9205..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-cfi.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# CFI Flash -CONFIG_MTD=y -CONFIG_MTD_CFI=y diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-drm.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-drm.cfg deleted file mode 100644 index 34b0141395..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-drm.cfg +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_DRM=y -CONFIG_DRM_HDLCD=y -CONFIG_FB=y -CONFIG_FB_ARMCLCD=y diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-net.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-net.cfg deleted file mode 100644 index 54e3686d37..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-net.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_SMSC911X=y -CONFIG_SMC91X=y diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-pata.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-pata.cfg deleted file mode 100644 index 62722880dc..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-pata.cfg +++ /dev/null @@ -1,12 +0,0 @@ -CONFIG_ATA=y -CONFIG_ATA_GENERIC=y -CONFIG_PATA_PLATFORM=y -CONFIG_PATA_OF_PLATFORM=y -CONFIG_SATA_AHCI=y -CONFIG_SATA_AHCI_PLATFORM=y -CONFIG_ATA_PIIX=y -CONFIG_PATA_OLDPIIX=y -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -CONFIG_BLK_DEV_SD=y -CONFIG_CHR_DEV_SG=y diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-pci.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-pci.cfg deleted file mode 100644 index c8ae9d4844..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-pci.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_PCI=y -CONFIG_PCI_HOST_GENERIC=y diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-rtc.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-rtc.cfg deleted file mode 100644 index 5d377b396a..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-rtc.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_PL031=y diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-serial.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-serial.cfg deleted file mode 100644 index f58e3c2efd..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-serial.cfg +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST=y diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-virtio.cfg b/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-virtio.cfg deleted file mode 100644 index b4a53da1be..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/gem5-kmeta/bsp/gem5-platforms/gem5-arm64/gem5-arm64-virtio.cfg +++ /dev/null @@ -1,9 +0,0 @@ -CONFIG_VIRTIO=y -CONFIG_VIRTIO_MMIO=y -CONFIG_BLOCK=y -CONFIG_VIRTIO_BLK=y -CONFIG_BLK_MQ_VIRTIO=y -CONFIG_SCSI_VIRTIO=y -CONFIG_VIRTIO_BLK_SCSI=y -CONFIG_VIRTIO_PCI=y -CONFIG_VIRTIO_PCI_LEGACY=y diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_%.bbappend deleted file mode 100644 index e66dd21bf3..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_%.bbappend +++ /dev/null @@ -1,12 +0,0 @@ -FILESEXTRAPATHS:prepend:gem5-arm64 := "${THISDIR}:${THISDIR}/files:" - -COMPATIBLE_MACHINE:gem5-arm64 = "gem5-arm64" -KMACHINE:gem5-arm64 = "gem5-arm64" -SRC_URI:append:gem5-arm64 = " file://gem5-kmeta;type=kmeta;name=gem5-kmeta;destsuffix=gem5-kmeta \ - file://dts/gem5-arm64;subdir=add-files \ - file://init_disassemble_info-signature-changes-causes-compile-failures.patch" - -do_patch:append:gem5-arm64() { - tar -C ${WORKDIR}/add-files/dts -cf - gem5-arm64 | \ - tar -C arch/arm64/boot/dts -xf - -} diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_5.4.bb b/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_5.4.bb deleted file mode 100644 index a1a301ccba..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_5.4.bb +++ /dev/null @@ -1,25 +0,0 @@ -KBRANCH ?= "v5.4/standard/base" - -require recipes-kernel/linux/linux-yocto.inc - -SRCREV_machine ?= "8a59dfded81659402005acfb06fbb00b71c8ce86" -SRCREV_meta ?= "e8c675c7e11fbd96cd812dfb9f4f6fb6f92b6abb" - -SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}; \ - git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA} \ - file://0001-lib-build_OID_registry-fix-reproducibility-issues.patch \ - file://0002-vt-conmakehash-improve-reproducibility.patch \ - " - -LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" -LINUX_VERSION ?= "5.4.205" - -DEPENDS += "openssl-native util-linux-native" - -PV = "${LINUX_VERSION}+git${SRCPV}" - -KMETA = "kernel-meta" -KCONF_BSP_AUDIT_LEVEL = "1" - -# Functionality flags -KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" diff --git a/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_5.4.bbappend b/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_5.4.bbappend deleted file mode 100644 index 078b684fdd..0000000000 --- a/meta-arm/meta-gem5/recipes-kernel/linux/linux-yocto_5.4.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', 'recipes-kernel/linux/linux-yocto_virtualization.inc', '', d)} diff --git a/meta-arm/scripts/machine-summary.py b/meta-arm/scripts/machine-summary.py index c2b43dae18..8bd0fa789b 100755 --- a/meta-arm/scripts/machine-summary.py +++ b/meta-arm/scripts/machine-summary.py @@ -56,7 +56,7 @@ def get_url_for_patch(layer: str, localpath: pathlib.Path, d) -> str: # TODO: assumes default branch if layer == "core": return f"https://git.openembedded.org/openembedded-core/tree/meta/{relative}" - elif layer in ("meta-arm", "meta-arm-bsp", "arm-toolchain", "meta-atp", "meta-gem5"): + elif layer in ("meta-arm", "meta-arm-bsp", "arm-toolchain"): return f"https://git.yoctoproject.org/meta-arm/tree/{layer}/{relative}" else: print(f"WARNING: Don't know web URL for layer {layer}", file=sys.stderr) diff --git a/meta-openembedded/meta-filesystems/conf/layer.conf b/meta-openembedded/meta-filesystems/conf/layer.conf index 205768e637..9602aa9e1a 100644 --- a/meta-openembedded/meta-filesystems/conf/layer.conf +++ b/meta-openembedded/meta-filesystems/conf/layer.conf @@ -15,4 +15,4 @@ LAYERVERSION_filesystems-layer = "1" LAYERDEPENDS_filesystems-layer = "core openembedded-layer" -LAYERSERIES_COMPAT_filesystems-layer = "kirkstone langdale" +LAYERSERIES_COMPAT_filesystems-layer = "mickledore" diff --git a/meta-openembedded/meta-filesystems/recipes-filesystems/ntfs-3g-ntfsprogs/ntfs-3g-ntfsprogs_2022.10.3.bb b/meta-openembedded/meta-filesystems/recipes-filesystems/ntfs-3g-ntfsprogs/ntfs-3g-ntfsprogs_2022.10.3.bb new file mode 100644 index 0000000000..37a8106bb0 --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-filesystems/ntfs-3g-ntfsprogs/ntfs-3g-ntfsprogs_2022.10.3.bb @@ -0,0 +1,53 @@ +DESCRIPTION = "The NTFS-3G driver is an open source, freely available NTFS driver for Linux with read and write support." +HOMEPAGE = "http://www.ntfs-3g.org/" +DEPENDS = "fuse libgcrypt" +PROVIDES = "ntfsprogs ntfs-3g" +LICENSE = "GPL-2.0-only & LGPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ + file://COPYING.LIB;md5=f30a9716ef3762e3467a2f62bf790f0a" + +SRC_URI = "http://tuxera.com/opensource/ntfs-3g_ntfsprogs-${PV}.tgz \ + file://0001-libntfs-3g-Makefile.am-fix-install-failed-while-host.patch \ +" +S = "${WORKDIR}/ntfs-3g_ntfsprogs-${PV}" +SRC_URI[sha256sum] = "f20e36ee68074b845e3629e6bced4706ad053804cbaf062fbae60738f854170c" + +UPSTREAM_CHECK_URI = "https://www.tuxera.com/community/open-source-ntfs-3g/" +UPSTREAM_CHECK_REGEX = "ntfs-3g_ntfsprogs-(?P\d+(\.\d+)+)\.tgz" + +inherit autotools pkgconfig + +PACKAGECONFIG ??= "" +PACKAGECONFIG[uuid] = "--with-uuid,--without-uuid,util-linux" + +# required or it calls ldconfig at install step +EXTRA_OEMAKE = "LDCONFIG=echo" + +PACKAGES =+ "ntfs-3g ntfsprogs libntfs-3g" + +FILES:ntfs-3g = "${base_sbindir}/*.ntfs-3g ${bindir}/ntfs-3g* ${base_sbindir}/mount.ntfs" +RDEPENDS:ntfs-3g += "fuse" +RRECOMMENDS:ntfs-3g = "util-linux-mount" + +FILES:ntfsprogs = "${base_sbindir}/* ${bindir}/* ${sbindir}/*" +FILES:libntfs-3g = "${libdir}/*${SOLIBS}" + +do_install:append() { + # Standard mount will execute the program /sbin/mount.TYPE when called. + # Add a symbolic link to let mount find ntfs. + ln -sf mount.ntfs-3g ${D}${base_sbindir}/mount.ntfs + rmdir ${D}${libdir}/ntfs-3g + + # Handle when usrmerge is in effect. Some files are installed to /sbin + # regardless of the value of ${base_sbindir}. + if [ "${base_sbindir}" != /sbin ] && [ -d ${D}/sbin ]; then + mkdir -p ${D}${base_sbindir} + mv ${D}/sbin/* ${D}${base_sbindir} + rmdir ${D}/sbin + fi +} + +# Satisfy the -dev runtime dependency +ALLOW_EMPTY:${PN} = "1" + +CVE_PRODUCT = "tuxera:ntfs-3g" diff --git a/meta-openembedded/meta-filesystems/recipes-filesystems/ntfs-3g-ntfsprogs/ntfs-3g-ntfsprogs_2022.5.17.bb b/meta-openembedded/meta-filesystems/recipes-filesystems/ntfs-3g-ntfsprogs/ntfs-3g-ntfsprogs_2022.5.17.bb deleted file mode 100644 index b29716ad49..0000000000 --- a/meta-openembedded/meta-filesystems/recipes-filesystems/ntfs-3g-ntfsprogs/ntfs-3g-ntfsprogs_2022.5.17.bb +++ /dev/null @@ -1,53 +0,0 @@ -DESCRIPTION = "The NTFS-3G driver is an open source, freely available NTFS driver for Linux with read and write support." -HOMEPAGE = "http://www.ntfs-3g.org/" -DEPENDS = "fuse libgcrypt" -PROVIDES = "ntfsprogs ntfs-3g" -LICENSE = "GPL-2.0-only & LGPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ - file://COPYING.LIB;md5=f30a9716ef3762e3467a2f62bf790f0a" - -SRC_URI = "http://tuxera.com/opensource/ntfs-3g_ntfsprogs-${PV}.tgz \ - file://0001-libntfs-3g-Makefile.am-fix-install-failed-while-host.patch \ -" -S = "${WORKDIR}/ntfs-3g_ntfsprogs-${PV}" -SRC_URI[sha256sum] = "0489fbb6972581e1b417ab578d543f6ae522e7fa648c3c9b49c789510fd5eb93" - -UPSTREAM_CHECK_URI = "https://www.tuxera.com/community/open-source-ntfs-3g/" -UPSTREAM_CHECK_REGEX = "ntfs-3g_ntfsprogs-(?P\d+(\.\d+)+)\.tgz" - -inherit autotools pkgconfig - -PACKAGECONFIG ??= "" -PACKAGECONFIG[uuid] = "--with-uuid,--without-uuid,util-linux" - -# required or it calls ldconfig at install step -EXTRA_OEMAKE = "LDCONFIG=echo" - -PACKAGES =+ "ntfs-3g ntfsprogs libntfs-3g" - -FILES:ntfs-3g = "${base_sbindir}/*.ntfs-3g ${bindir}/ntfs-3g* ${base_sbindir}/mount.ntfs" -RDEPENDS:ntfs-3g += "fuse" -RRECOMMENDS:ntfs-3g = "util-linux-mount" - -FILES:ntfsprogs = "${base_sbindir}/* ${bindir}/* ${sbindir}/*" -FILES:libntfs-3g = "${libdir}/*${SOLIBS}" - -do_install:append() { - # Standard mount will execute the program /sbin/mount.TYPE when called. - # Add a symbolic link to let mount find ntfs. - ln -sf mount.ntfs-3g ${D}${base_sbindir}/mount.ntfs - rmdir ${D}${libdir}/ntfs-3g - - # Handle when usrmerge is in effect. Some files are installed to /sbin - # regardless of the value of ${base_sbindir}. - if [ "${base_sbindir}" != /sbin ] && [ -d ${D}/sbin ]; then - mkdir -p ${D}${base_sbindir} - mv ${D}/sbin/* ${D}${base_sbindir} - rmdir ${D}/sbin - fi -} - -# Satisfy the -dev runtime dependency -ALLOW_EMPTY:${PN} = "1" - -CVE_PRODUCT = "tuxera:ntfs-3g" diff --git a/meta-openembedded/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.5.bb b/meta-openembedded/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.5.bb deleted file mode 100644 index 6aa674c790..0000000000 --- a/meta-openembedded/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.5.bb +++ /dev/null @@ -1,61 +0,0 @@ -SUMMARY = "OpenZFS on Linux and FreeBSD" -DESCRIPTION = "OpenZFS on Linux and FreeBSD" -LICENSE = "CDDL-1.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=7087caaf1dc8a2856585619f4a787faa" -HOMEPAGE ="https://github.com/openzfs/zfs" - -SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \ - file://0001-Define-strndupa-if-it-does-not-exist.patch \ -" -SRC_URI[sha256sum] = "1913041e5c44ff07ca384346ad8145aeedf77e77cd1cea9ec5d533246691e10c" - -# Using both 'module' and 'autotools' classes seems a bit odd, they both -# define a do_compile function. -# That's why we opt for module-base, also this prevents module splitting. -inherit module-base pkgconfig autotools - -DEPENDS = "virtual/kernel zlib util-linux libtirpc openssl curl" - -PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd sysvinit', d)}" - -PACKAGECONFIG[pam] = "--enable-pam --with-pamconfigsdir=${datadir}/pam-configs --with-pammoduledir=${libdir}/security, --disable-pam" -PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd," -PACKAGECONFIG[sysvinit] = "--enable-sysvinit,--disable-sysvinit," - -EXTRA_OECONF:append = " \ - --disable-pyzfs \ - --with-linux=${STAGING_KERNEL_DIR} --with-linux-obj=${STAGING_KERNEL_BUILDDIR} \ - --with-mounthelperdir=${base_sbin} \ - --with-udevdir=${base_libdir}/udev \ - --without-dracutdir \ - " - -EXTRA_OEMAKE:append = " \ - INSTALL_MOD_PATH=${D}${root_prefix} \ - " - -do_install:append() { - # /usr/share/zfs contains the zfs-tests folder which we do not need: - rm -rf ${D}${datadir}/zfs - - rm -rf ${D}${datadir}/initramfs-tools -} - -FILES:${PN} += "\ - ${base_sbindir}/* \ - ${base_libdir}/* \ - ${sysconfdir}/* \ - ${sbindir}/* \ - ${bindir}/* \ - ${libexecdir}/${BPN}/* \ - ${libdir}/* \ - " - -FILES:${PN}-dev += "\ - ${prefix}/src/zfs-${PV}/* \ - ${prefix}/src/spl-${PV}/* \ - " -# Not yet ported to rv32 -COMPATIBLE_HOST:riscv32 = "null" -# conflicting definition of ABS macro from asm/asm.h from kernel -COMPATIBLE_HOST:mips = "null" diff --git a/meta-openembedded/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.7.bb b/meta-openembedded/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.7.bb new file mode 100644 index 0000000000..d328cbc27e --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.7.bb @@ -0,0 +1,61 @@ +SUMMARY = "OpenZFS on Linux and FreeBSD" +DESCRIPTION = "OpenZFS on Linux and FreeBSD" +LICENSE = "CDDL-1.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=7087caaf1dc8a2856585619f4a787faa" +HOMEPAGE ="https://github.com/openzfs/zfs" + +SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \ + file://0001-Define-strndupa-if-it-does-not-exist.patch \ +" +SRC_URI[sha256sum] = "6462e63e185de6ff10c64ffa6ed773201a082f9dd13e603d7e8136fcb4aca71b" + +# Using both 'module' and 'autotools' classes seems a bit odd, they both +# define a do_compile function. +# That's why we opt for module-base, also this prevents module splitting. +inherit module-base pkgconfig autotools + +DEPENDS = "virtual/kernel zlib util-linux libtirpc openssl curl" + +PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd sysvinit', d)}" + +PACKAGECONFIG[pam] = "--enable-pam --with-pamconfigsdir=${datadir}/pam-configs --with-pammoduledir=${libdir}/security, --disable-pam" +PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd," +PACKAGECONFIG[sysvinit] = "--enable-sysvinit,--disable-sysvinit," + +EXTRA_OECONF:append = " \ + --disable-pyzfs \ + --with-linux=${STAGING_KERNEL_DIR} --with-linux-obj=${STAGING_KERNEL_BUILDDIR} \ + --with-mounthelperdir=${base_sbin} \ + --with-udevdir=${base_libdir}/udev \ + --without-dracutdir \ + " + +EXTRA_OEMAKE:append = " \ + INSTALL_MOD_PATH=${D}${root_prefix} \ + " + +do_install:append() { + # /usr/share/zfs contains the zfs-tests folder which we do not need: + rm -rf ${D}${datadir}/zfs + + rm -rf ${D}${datadir}/initramfs-tools +} + +FILES:${PN} += "\ + ${base_sbindir}/* \ + ${base_libdir}/* \ + ${sysconfdir}/* \ + ${sbindir}/* \ + ${bindir}/* \ + ${libexecdir}/${BPN}/* \ + ${libdir}/* \ + " + +FILES:${PN}-dev += "\ + ${prefix}/src/zfs-${PV}/* \ + ${prefix}/src/spl-${PV}/* \ + " +# Not yet ported to rv32 +COMPATIBLE_HOST:riscv32 = "null" +# conflicting definition of ABS macro from asm/asm.h from kernel +COMPATIBLE_HOST:mips = "null" diff --git a/meta-openembedded/meta-filesystems/recipes-utils/aufs-util/aufs-util/0001-libau-Do-not-build-LFS-version-of-readdir.patch b/meta-openembedded/meta-filesystems/recipes-utils/aufs-util/aufs-util/0001-libau-Do-not-build-LFS-version-of-readdir.patch new file mode 100644 index 0000000000..c983733dcb --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/aufs-util/aufs-util/0001-libau-Do-not-build-LFS-version-of-readdir.patch @@ -0,0 +1,32 @@ +From 12ba95281d0bbea3576350d635b4dee0f953b94a Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 29 Nov 2022 18:38:07 -0800 +Subject: [PATCH] libau: Do not build LFS version of readdir + +rdu64 is providing largefile supported version of readdir and readdir_r +however, we enable largefile support unconditionally in OE therefore its +not needed since readdir() and readdir_r() are already LFS capable + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Khem Raj +--- + libau/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libau/Makefile b/libau/Makefile +index 9ada831..1fd1ccc 100644 +--- a/libau/Makefile ++++ b/libau/Makefile +@@ -30,7 +30,7 @@ STRIP ?= strip + all: ${LibSo} + + ifeq (${Glibc},yes) +-LibSoObj += rdu64.o ++#LibSoObj += rdu64.o + + # this is unnecessary on 64bit system? + rdu64.c: rdu.c +-- +2.38.1 + diff --git a/meta-openembedded/meta-filesystems/recipes-utils/aufs-util/aufs-util_git.bb b/meta-openembedded/meta-filesystems/recipes-utils/aufs-util/aufs-util_git.bb index f565be3f7e..fbf7753b02 100644 --- a/meta-openembedded/meta-filesystems/recipes-utils/aufs-util/aufs-util_git.bb +++ b/meta-openembedded/meta-filesystems/recipes-utils/aufs-util/aufs-util_git.bb @@ -12,6 +12,7 @@ SRC_URI = "git://git.code.sf.net/p/aufs/aufs-util;protocol=git;branch=aufs4.9 \ https://raw.githubusercontent.com/sfjro/aufs4-linux/aufs4.9/include/uapi/linux/aufs_type.h;name=aufs_type \ file://aufs-util-don-t-strip-executables.patch \ file://aufs-util-add-tool-concept-to-Makefile-for-cross-com.patch \ + file://0001-libau-Do-not-build-LFS-version-of-readdir.patch \ " SRC_URI[aufs_type.md5sum] = "b37129ef0703de72a852db7e48bdedc6" SRC_URI[aufs_type.sha256sum] = "7ff6566adb9c7a3b6862cdc85a690ab546f1d0bc81ddd595fd663c0a69031683" diff --git a/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0001-f2fs_io-Fix-out-of-tree-builds.patch b/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0001-f2fs_io-Fix-out-of-tree-builds.patch new file mode 100644 index 0000000000..aa243bd9c0 --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0001-f2fs_io-Fix-out-of-tree-builds.patch @@ -0,0 +1,27 @@ +From f110e34d7a4929cdea647b98fa177cf1bccf8b1e Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 21 Dec 2022 18:21:42 -0800 +Subject: [PATCH] f2fs_io: Fix out of tree builds + +Relative path does not work when searching for include files +when srcdir != builddir + +Upstream-Status: Submitted [https://lore.kernel.org/linux-f2fs-devel/20221222022830.976309-1-raj.khem@gmail.com/T/#t] +Signed-off-by: Khem Raj +--- + tools/f2fs_io/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/f2fs_io/Makefile.am b/tools/f2fs_io/Makefile.am +index 6c17db1..bc4f9d0 100644 +--- a/tools/f2fs_io/Makefile.am ++++ b/tools/f2fs_io/Makefile.am +@@ -1,7 +1,7 @@ + ## Makefile.am + + if LINUX +-AM_CPPFLAGS = -I../../include ++AM_CPPFLAGS = -I$(top_srcdir)/include + AM_CFLAGS = -Wall + sbin_PROGRAMS = f2fs_io + f2fs_io_SOURCES = f2fs_io.c diff --git a/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0002-f2fs_io-Define-_FILE_OFFSET_BITS-64.patch b/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0002-f2fs_io-Define-_FILE_OFFSET_BITS-64.patch new file mode 100644 index 0000000000..d4e3194e62 --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0002-f2fs_io-Define-_FILE_OFFSET_BITS-64.patch @@ -0,0 +1,183 @@ +From 3c0314e1820afc9a98e890cc5f7973c3c81877f8 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 21 Dec 2022 18:23:03 -0800 +Subject: [PATCH] f2fs_io: Define _FILE_OFFSET_BITS=64 + +Remove _LARGEFILE64_SOURCE, this is redundant when _FILE_OFFSET_BITS=64 +additionally it fixes build with musl because the detection logic for +lseek64 fails because when using _LARGEFILE64_SOURCE musl also define's +lseek64 as an alias to lseek + +Upstream-Status: Submitted [https://lore.kernel.org/linux-f2fs-devel/20221222022830.976309-2-raj.khem@gmail.com/T/#u] +Signed-off-by: Khem Raj +--- + lib/libf2fs_io.c | 4 +++- + tools/f2fs_io/f2fs_io.c | 4 ++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +--- a/lib/libf2fs_io.c ++++ b/lib/libf2fs_io.c +@@ -11,7 +11,9 @@ + * + * Dual licensed under the GPL or LGPL version 2 licenses. + */ +-#define _LARGEFILE64_SOURCE ++#ifndef _FILE_OFFSET_BITS ++#define _FILE_OFFSET_BITS 64 ++#endif + + #include + #include +@@ -67,22 +69,13 @@ static int __get_device_fd(__u64 *offset + return -1; + } + +-#ifndef HAVE_LSEEK64 +-typedef off_t off64_t; +- +-static inline off64_t lseek64(int fd, __u64 offset, int set) +-{ +- return lseek(fd, offset, set); +-} +-#endif +- + /* ---------- dev_cache, Least Used First (LUF) policy ------------------- */ + /* + * Least used block will be the first victim to be replaced when max hash + * collision exceeds + */ + static bool *dcache_valid; /* is the cached block valid? */ +-static off64_t *dcache_blk; /* which block it cached */ ++static off_t *dcache_blk; /* which block it cached */ + static uint64_t *dcache_lastused; /* last used ticks for cache entries */ + static char *dcache_buf; /* cached block data */ + static uint64_t dcache_usetick; /* current use tick */ +@@ -172,7 +165,7 @@ static int dcache_alloc_all(long n) + { + if (n <= 0) + return -1; +- if ((dcache_blk = (off64_t *) malloc(sizeof(off64_t) * n)) == NULL ++ if ((dcache_blk = (off_t *) malloc(sizeof(off_t) * n)) == NULL + || (dcache_lastused = (uint64_t *) + malloc(sizeof(uint64_t) * n)) == NULL + || (dcache_buf = (char *) malloc (F2FS_BLKSIZE * n)) == NULL +@@ -257,7 +250,7 @@ static inline long dcache_relocate(long + dcache_config.num_cache_entry; + } + +-static long dcache_find(off64_t blk) ++static long dcache_find(off_t blk) + { + register long n = dcache_config.num_cache_entry; + register unsigned m = dcache_config.max_hash_collision; +@@ -278,10 +271,10 @@ static long dcache_find(off64_t blk) + } + + /* Physical read into cache */ +-static int dcache_io_read(int fd, long entry, off64_t offset, off64_t blk) ++static int dcache_io_read(int fd, long entry, off_t offset, off_t blk) + { +- if (lseek64(fd, offset, SEEK_SET) < 0) { +- MSG(0, "\n lseek64 fail.\n"); ++ if (lseek(fd, offset, SEEK_SET) < 0) { ++ MSG(0, "\n lseek fail.\n"); + return -1; + } + if (read(fd, dcache_buf + entry * F2FS_BLKSIZE, F2FS_BLKSIZE) < 0) { +@@ -308,12 +301,12 @@ static int dcache_io_read(int fd, long e + * 1: cache not available (uninitialized) + * -1: error + */ +-static int dcache_update_rw(int fd, void *buf, off64_t offset, ++static int dcache_update_rw(int fd, void *buf, off_t offset, + size_t byte_count, bool is_write) + { +- off64_t blk; ++ off_t blk; + int addr_in_blk; +- off64_t start; ++ off_t start; + + if (!dcache_initialized) + dcache_init(); /* auto initialize */ +@@ -377,13 +370,13 @@ static int dcache_update_rw(int fd, void + * return value: 1: cache not available + * 0: success, -1: I/O error + */ +-int dcache_update_cache(int fd, void *buf, off64_t offset, size_t count) ++int dcache_update_cache(int fd, void *buf, off_t offset, size_t count) + { + return dcache_update_rw(fd, buf, offset, count, true); + } + + /* handles read into cache + read into buffer */ +-int dcache_read(int fd, void *buf, off64_t offset, size_t count) ++int dcache_read(int fd, void *buf, off_t offset, size_t count) + { + return dcache_update_rw(fd, buf, offset, count, false); + } +@@ -395,7 +388,7 @@ int dev_read_version(void *buf, __u64 of + { + if (c.sparse_mode) + return 0; +- if (lseek64(c.kd, (off64_t)offset, SEEK_SET) < 0) ++ if (lseek(c.kd, (off_t)offset, SEEK_SET) < 0) + return -1; + if (read(c.kd, buf, len) < 0) + return -1; +@@ -537,10 +530,10 @@ int dev_read(void *buf, __u64 offset, si + + /* err = 1: cache not available, fall back to non-cache R/W */ + /* err = 0: success, err=-1: I/O error */ +- err = dcache_read(fd, buf, (off64_t)offset, len); ++ err = dcache_read(fd, buf, (off_t)offset, len); + if (err <= 0) + return err; +- if (lseek64(fd, (off64_t)offset, SEEK_SET) < 0) ++ if (lseek(fd, (off_t)offset, SEEK_SET) < 0) + return -1; + if (read(fd, buf, len) < 0) + return -1; +@@ -586,9 +579,9 @@ int dev_write(void *buf, __u64 offset, s + * dcache_update_cache() just update cache, won't do I/O. + * Thus even no error, we need normal non-cache I/O for actual write + */ +- if (dcache_update_cache(fd, buf, (off64_t)offset, len) < 0) ++ if (dcache_update_cache(fd, buf, (off_t)offset, len) < 0) + return -1; +- if (lseek64(fd, (off64_t)offset, SEEK_SET) < 0) ++ if (lseek(fd, (off_t)offset, SEEK_SET) < 0) + return -1; + if (write(fd, buf, len) < 0) + return -1; +@@ -602,7 +595,7 @@ int dev_write_block(void *buf, __u64 blk + + int dev_write_dump(void *buf, __u64 offset, size_t len) + { +- if (lseek64(c.dump_fd, (off64_t)offset, SEEK_SET) < 0) ++ if (lseek(c.dump_fd, (off_t)offset, SEEK_SET) < 0) + return -1; + if (write(c.dump_fd, buf, len) < 0) + return -1; +@@ -627,7 +620,7 @@ int dev_fill(void *buf, __u64 offset, si + /* Only allow fill to zero */ + if (*((__u8*)buf)) + return -1; +- if (lseek64(fd, (off64_t)offset, SEEK_SET) < 0) ++ if (lseek(fd, (off_t)offset, SEEK_SET) < 0) + return -1; + if (write(fd, buf, len) < 0) + return -1; +--- a/tools/f2fs_io/f2fs_io.c ++++ b/tools/f2fs_io/f2fs_io.c +@@ -12,8 +12,8 @@ + #ifndef _LARGEFILE_SOURCE + #define _LARGEFILE_SOURCE + #endif +-#ifndef _LARGEFILE64_SOURCE +-#define _LARGEFILE64_SOURCE ++#ifndef _FILE_OFFSET_BITS ++#define _FILE_OFFSET_BITS 64 + #endif + #ifndef O_LARGEFILE + #define O_LARGEFILE 0 diff --git a/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.14.0.bb b/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.14.0.bb deleted file mode 100644 index fb71b18b60..0000000000 --- a/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.14.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "Tools for Flash-Friendly File System (F2FS)" -HOMEPAGE = "https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git" - -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=362b4b2594cd362b874a97718faa51d3" - -# to provide libuuid -DEPENDS = "util-linux" - -SRCREV = "d41dcbdf46dc3841cd0a0507e6573e38cb6c55bb" -SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git;branch=master \ - " -UPSTREAM_CHECK_GITTAGREGEX = "v(?P\d+(\.\d+)+)" - -S = "${WORKDIR}/git" - -inherit pkgconfig autotools - -BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.15.0.bb b/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.15.0.bb new file mode 100644 index 0000000000..5da059f738 --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.15.0.bb @@ -0,0 +1,21 @@ +SUMMARY = "Tools for Flash-Friendly File System (F2FS)" +HOMEPAGE = "https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git" + +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=362b4b2594cd362b874a97718faa51d3" + +# to provide libuuid +DEPENDS = "util-linux" + +SRCREV = "64f2596142800c215cb40a658ebd5793ed37c936" +SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git;branch=master \ + file://0001-f2fs_io-Fix-out-of-tree-builds.patch \ + file://0002-f2fs_io-Define-_FILE_OFFSET_BITS-64.patch \ + " +UPSTREAM_CHECK_GITTAGREGEX = "v(?P\d+(\.\d+)+)" + +S = "${WORKDIR}/git" + +inherit pkgconfig autotools + +BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat/0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch b/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat/0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch index fd8e22abca..7e215e3080 100644 --- a/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat/0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch +++ b/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat/0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch @@ -8,8 +8,8 @@ of any of the GNU specific argp extensions. Include unistd.h directly to allow building with musl on linux, whilst retaining compatibility with glibc and other unices. +Upstream-status: Submitted [https://github.com/Gregwar/fatcat/pull/34] Signed-off-by: Alex Kiernan -Upstream-status: Pending --- src/fatcat.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat/0002-Enable-64bit-off_t.patch b/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat/0002-Enable-64bit-off_t.patch new file mode 100644 index 0000000000..caaf105eea --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat/0002-Enable-64bit-off_t.patch @@ -0,0 +1,71 @@ +From 0383fff94471278c92ef2ad5edc14abbb40a9acd Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 16 Dec 2022 18:54:55 -0800 +Subject: [PATCH] Enable 64bit off_t + +Ensure that off_t is always 64-bit by specifying -D_LARGEFILE_SOURCE +-D_FILE_OFFSET_BITS=64 this will ensure that normal lseek() function is +same as lseek64 + +This helps compiling on latest musl where lseek64 and friends are not +available + +Upstream-status: Submitted [https://github.com/Gregwar/fatcat/pull/34] +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 2 ++ + src/core/FatSystem.cpp | 4 ++-- + src/core/FatSystem.h | 2 -- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d6a2649..4cdd1fb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -34,6 +34,8 @@ IF(DEFINE_WIN) + add_definitions(-D__WIN__) + ENDIF(DEFINE_WIN) + ++add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64) ++ + include_directories("${CMAKE_SOURCE_DIR}/src") + + add_executable(fatcat "src/fatcat.cpp" ${ALL_SOURCES}) +diff --git a/src/core/FatSystem.cpp b/src/core/FatSystem.cpp +index 79cda8c..1f52e82 100644 +--- a/src/core/FatSystem.cpp ++++ b/src/core/FatSystem.cpp +@@ -90,7 +90,7 @@ int FatSystem::readData(unsigned long long address, char *buffer, int size) + cerr << "! Trying to read outside the disk" << endl; + } + +- lseek64(fd, globalOffset+address, SEEK_SET); ++ lseek(fd, globalOffset+address, SEEK_SET); + + int n; + int pos = 0; +@@ -112,7 +112,7 @@ int FatSystem::writeData(unsigned long long address, const char *buffer, int siz + throw string("Trying to write data while write mode is disabled"); + } + +- lseek64(fd, globalOffset+address, SEEK_SET); ++ lseek(fd, globalOffset+address, SEEK_SET); + + int n; + int pos = 0; +diff --git a/src/core/FatSystem.h b/src/core/FatSystem.h +index cd3c914..f9f2ca3 100644 +--- a/src/core/FatSystem.h ++++ b/src/core/FatSystem.h +@@ -11,11 +11,9 @@ + + #ifdef __APPLE__ + #define O_LARGEFILE 0 +-#define lseek64 lseek + #endif + #ifdef __WIN__ + #define O_LARGEFILE 0 +-#define lseek64 lseek + #endif + using namespace std; + diff --git a/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat_1.1.1.bb b/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat_1.1.1.bb index e344eda154..982a52d62f 100644 --- a/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat_1.1.1.bb +++ b/meta-openembedded/meta-filesystems/recipes-utils/fatcat/fatcat_1.1.1.bb @@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=57fbbfebd0dd1d6ff21b8cecb552a03f" SRC_URI = "git://github.com/Gregwar/fatcat.git;branch=master;protocol=https \ file://0001-Use-unistd.h-not-argp.h-for-all-POSIX-systems.patch \ + file://0002-Enable-64bit-off_t.patch \ " SRCREV = "99cb99fc86eb1601ac7ae27f5bba23add04d2543" diff --git a/meta-openembedded/meta-filesystems/recipes-utils/fatresize/fatresize/0001-configure-Do-not-add-D_FILE_OFFSET_BITS-to-CFLAGS.patch b/meta-openembedded/meta-filesystems/recipes-utils/fatresize/fatresize/0001-configure-Do-not-add-D_FILE_OFFSET_BITS-to-CFLAGS.patch new file mode 100644 index 0000000000..d0ecdcba4e --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/fatresize/fatresize/0001-configure-Do-not-add-D_FILE_OFFSET_BITS-to-CFLAGS.patch @@ -0,0 +1,34 @@ +From 69647e5d393a52ed3892eccc172ee750d6aaa45d Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 30 Dec 2022 21:08:25 -0800 +Subject: [PATCH] configure: Do not add -D_FILE_OFFSET_BITS to CFLAGS + +AC_SYS_LARGEFILE macro is in use and this will add a definition for +_FILE_OFFSET_BITS in generated config.h which is already included as +first include file in fatresize.c hence its not required to be added via +CFLAGS, this also fixes a case when -D_FILE_OFFSET_BITS=64 is passed via +CC from environment, where the autoconf macros set +ac_cv_sys_file_offset_bits=no and that means we will have +-D_FILE_OFFSET_BITS=no added to CFLAGS which messes up builds. + +Upstream-Status: Submitted [https://salsa.debian.org/parted-team/fatresize/-/merge_requests/3] +Signed-off-by: Khem Raj +--- + configure.ac | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index d6e6cb2..4dcec28 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -29,7 +29,6 @@ AC_CHECK_FUNCS([memset strtoll]) + + # Check for LFS + AC_SYS_LARGEFILE +-CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=${ac_cv_sys_file_offset_bits}" + + dnl libparted + # hack +-- +2.39.0 + diff --git a/meta-openembedded/meta-filesystems/recipes-utils/fatresize/fatresize_1.1.0.bb b/meta-openembedded/meta-filesystems/recipes-utils/fatresize/fatresize_1.1.0.bb index 1ca8bb3fe9..cf7ac62be8 100644 --- a/meta-openembedded/meta-filesystems/recipes-utils/fatresize/fatresize_1.1.0.bb +++ b/meta-openembedded/meta-filesystems/recipes-utils/fatresize/fatresize_1.1.0.bb @@ -5,11 +5,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" SRC_URI = "git://salsa.debian.org/parted-team/fatresize.git;protocol=https;branch=master \ file://0001-build-Do-not-build-.sgml-file.patch \ + file://0001-configure-Do-not-add-D_FILE_OFFSET_BITS-to-CFLAGS.patch \ " SRCREV = "12da22087de2ec43f0fe5af1237389e94619c483" -PV = "1.1.0" - S = "${WORKDIR}/git" DEPENDS = "parted" diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfsdump/xfsdump_3.1.11.bb b/meta-openembedded/meta-filesystems/recipes-utils/xfsdump/xfsdump_3.1.11.bb deleted file mode 100644 index 2e5977cce7..0000000000 --- a/meta-openembedded/meta-filesystems/recipes-utils/xfsdump/xfsdump_3.1.11.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "XFS Filesystem Dump Utility" -DESCRIPTION = "The xfsdump package contains xfsdump, xfsrestore and a \ - number of other utilities for administering XFS filesystems.\ - xfsdump examines files in a filesystem, determines which \ - need to be backed up, and copies those files to a \ - specified disk, tape or other storage medium." -HOMEPAGE = "http://oss.sgi.com/projects/xfs" -SECTION = "base" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://doc/COPYING;md5=15c832894d10ddd00dfcf57bee490ecc" -DEPENDS = "xfsprogs attr" - -SRC_URI = "https://www.kernel.org/pub/linux/utils/fs/xfs/xfsdump/${BP}.tar.xz \ - file://remove-install-as-user.patch \ - ${@bb.utils.contains('DISTRO_FEATURES','usrmerge','file://0001-xfsdump-support-usrmerge.patch','',d)} \ - " -SRC_URI[sha256sum] = "5657a2ca26a55682dc9724fb0331c860fe362c778225cbfc8c710f1375f458a3" - -inherit autotools-brokensep - -PARALLEL_MAKE = "" -PACKAGECONFIG ??= "" -PACKAGECONFIG[gettext] = "--enable-gettext=yes,--enable-gettext=no,gettext" - -CFLAGS += "-D_FILE_OFFSET_BITS=64" - -do_configure () { - export DEBUG="-DNDEBUG" - install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S} - install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S} - oe_runconf -} - -do_install () { - export DIST_ROOT=${D} - oe_runmake install - oe_runmake install-dev -} diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfsdump/xfsdump_3.1.12.bb b/meta-openembedded/meta-filesystems/recipes-utils/xfsdump/xfsdump_3.1.12.bb new file mode 100644 index 0000000000..9e595b9521 --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/xfsdump/xfsdump_3.1.12.bb @@ -0,0 +1,39 @@ +SUMMARY = "XFS Filesystem Dump Utility" +DESCRIPTION = "The xfsdump package contains xfsdump, xfsrestore and a \ + number of other utilities for administering XFS filesystems.\ + xfsdump examines files in a filesystem, determines which \ + need to be backed up, and copies those files to a \ + specified disk, tape or other storage medium." +HOMEPAGE = "http://oss.sgi.com/projects/xfs" +SECTION = "base" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://doc/COPYING;md5=15c832894d10ddd00dfcf57bee490ecc" +DEPENDS = "xfsprogs attr" + +SRC_URI = "https://www.kernel.org/pub/linux/utils/fs/xfs/xfsdump/${BP}.tar.xz \ + file://remove-install-as-user.patch \ + ${@bb.utils.contains('DISTRO_FEATURES','usrmerge','file://0001-xfsdump-support-usrmerge.patch','',d)} \ + " +SRC_URI[sha256sum] = "f39c4c1b306b2dd7ec979c0e94d60fe69083d2ecf9af051cac5ef3bed772c74a" + +inherit autotools-brokensep + +PARALLEL_MAKE = "" +PACKAGECONFIG ??= "" +PACKAGECONFIG[gettext] = "--enable-gettext=yes,--enable-gettext=no,gettext" + +CFLAGS += "-D_FILE_OFFSET_BITS=64" +TARGET_CC_ARCH:append:libc-musl = " -D_LARGEFILE64_SOURCE" + +do_configure () { + export DEBUG="-DNDEBUG" + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S} + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S} + oe_runconf +} + +do_install () { + export DIST_ROOT=${D} + oe_runmake install + oe_runmake install-dev +} diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0001-Check-for-MAP_SYNC-in-sys-mman.h.patch b/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0001-Check-for-MAP_SYNC-in-sys-mman.h.patch deleted file mode 100644 index 75b227ac19..0000000000 --- a/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0001-Check-for-MAP_SYNC-in-sys-mman.h.patch +++ /dev/null @@ -1,52 +0,0 @@ -From f41ef1f06d428c81fcdef73d896dfc7ceda1809c Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 23 Aug 2018 04:59:39 +0000 -Subject: [PATCH] Check for MAP_SYNC in sys/mman.h - -Not all arches have wired MAP_SYNC e.g. mips -which have conflicts with definition, so checking -a generic file is going to mis-configure xfsprogs -for such arches. - -libc now has added the relevant macros to -sys/mman.h, and returns the right values for arches -where its implemented and nothing for others -unlike asm-generic/mman.h which only checks -for kernel headers and ignored arches - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - include/linux.h | 3 +-- - m4/package_libcdev.m4 | 3 +-- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/include/linux.h b/include/linux.h -index 1998941..7e5c9ab 100644 ---- a/include/linux.h -+++ b/include/linux.h -@@ -331,8 +331,7 @@ fsmap_advance( - #define MAP_SYNC 0 - #define MAP_SHARED_VALIDATE 0 - #else --#include --#include -+#include - #endif /* HAVE_MAP_SYNC */ - - #endif /* __XFS_LINUX_H__ */ -diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4 -index 0a6b514..2b47d2f 100644 ---- a/m4/package_libcdev.m4 -+++ b/m4/package_libcdev.m4 -@@ -335,8 +335,7 @@ AC_DEFUN([AC_HAVE_STATFS_FLAGS], - AC_DEFUN([AC_HAVE_MAP_SYNC], - [ AC_MSG_CHECKING([for MAP_SYNC]) - AC_TRY_COMPILE([ --#include --#include -+#include - ], [ - int flags = MAP_SYNC | MAP_SHARED_VALIDATE; - ], have_map_sync=yes diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0004-configure-Use-AC_SYS_LARGERFILE-autoconf-macro.patch b/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0004-configure-Use-AC_SYS_LARGERFILE-autoconf-macro.patch new file mode 100644 index 0000000000..60be8bfa34 --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0004-configure-Use-AC_SYS_LARGERFILE-autoconf-macro.patch @@ -0,0 +1,27 @@ +From f62d3e5cc1d4e416b97778059f0b3c20d777a4c2 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 21 Dec 2022 17:40:11 -0800 +Subject: [PATCH] configure: Use AC_SYS_LARGERFILE autoconf macro + +Helps define largefile support on relevant platforms + +Upstream-Status: Submitted [https://lore.kernel.org/linux-xfs/20221222015327.939932-1-raj.khem@gmail.com/T/#t] +Signed-off-by: Khem Raj +--- + configure.ac | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 5a6bf185..a6f556ec 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -10,6 +10,9 @@ AC_PROG_INSTALL + LT_INIT + + AC_PROG_CC ++ ++AC_SYS_LARGEFILE ++ + AC_ARG_VAR(BUILD_CC, [C compiler for build tools]) + if test "${BUILD_CC+set}" != "set"; then + if test $cross_compiling = no; then diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0005-Replace-off64_t-stat64-with-off_t-stat.patch b/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0005-Replace-off64_t-stat64-with-off_t-stat.patch new file mode 100644 index 0000000000..e10364a20e --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/files/0005-Replace-off64_t-stat64-with-off_t-stat.patch @@ -0,0 +1,723 @@ +From 1ff0d95604c406ddfc764c97ed2cb147d155f608 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 21 Dec 2022 17:43:07 -0800 +Subject: [PATCH] Replace off64_t/stat64 with off_t/stat + +When using AC_SYS_LARGEFILE, it will automatically add +-D_FILE_OFFSET_BITS=64 to enable 64bit off_t and all lfs64 support + +helps compile on musl where off_t was always 64bit and lfs64 were never +needed + +Upstream-Status: Submitted [https://lore.kernel.org/linux-xfs/20221222015327.939932-1-raj.khem@gmail.com/T/#t] +Signed-off-by: Khem Raj +--- + copy/xfs_copy.c | 2 +- + fsr/xfs_fsr.c | 2 +- + io/bmap.c | 6 +++--- + io/copy_file_range.c | 4 ++-- + io/cowextsize.c | 6 +++--- + io/fadvise.c | 2 +- + io/fiemap.c | 6 +++--- + io/fsmap.c | 6 +++--- + io/io.h | 10 +++++----- + io/madvise.c | 2 +- + io/mincore.c | 2 +- + io/mmap.c | 12 ++++++------ + io/pread.c | 22 +++++++++++----------- + io/pwrite.c | 20 ++++++++++---------- + io/reflink.c | 4 ++-- + io/seek.c | 6 +++--- + io/sendfile.c | 6 +++--- + io/stat.c | 2 +- + io/sync_file_range.c | 2 +- + io/truncate.c | 2 +- + libxfs/rdwr.c | 8 ++++---- + mdrestore/xfs_mdrestore.c | 2 +- + repair/prefetch.c | 2 +- + scrub/spacemap.c | 6 +++--- + spaceman/freesp.c | 4 ++-- + spaceman/trim.c | 2 +- + 26 files changed, 74 insertions(+), 74 deletions(-) + +diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c +index 79f65946..854fd7f4 100644 +--- a/copy/xfs_copy.c ++++ b/copy/xfs_copy.c +@@ -888,7 +888,7 @@ main(int argc, char **argv) + } + } else { + char *lb[XFS_MAX_SECTORSIZE] = { NULL }; +- off64_t off; ++ off_t off; + + /* ensure device files are sufficiently large */ + +diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c +index ba02506d..12fffbd8 100644 +--- a/fsr/xfs_fsr.c ++++ b/fsr/xfs_fsr.c +@@ -1148,7 +1148,7 @@ packfile(char *fname, char *tname, int fd, + struct dioattr dio; + static xfs_swapext_t sx; + struct xfs_flock64 space; +- off64_t cnt, pos; ++ off_t cnt, pos; + void *fbuf = NULL; + int ct, wc, wc_b4; + char ffname[SMBUFSZ]; +diff --git a/io/bmap.c b/io/bmap.c +index 27383ca6..0b14bb7b 100644 +--- a/io/bmap.c ++++ b/io/bmap.c +@@ -257,7 +257,7 @@ bmap_f( + #define FLG_BSW 0000010 /* Not on begin of stripe width */ + #define FLG_ESW 0000001 /* Not on end of stripe width */ + int agno; +- off64_t agoff, bbperag; ++ off_t agoff, bbperag; + int foff_w, boff_w, aoff_w, tot_w, agno_w; + char rbuf[32], bbuf[32], abuf[32]; + int sunit, swidth; +@@ -267,8 +267,8 @@ bmap_f( + if (is_rt) + sunit = swidth = bbperag = 0; + else { +- bbperag = (off64_t)fsgeo.agblocks * +- (off64_t)fsgeo.blocksize / BBSIZE; ++ bbperag = (off_t)fsgeo.agblocks * ++ (off_t)fsgeo.blocksize / BBSIZE; + sunit = (fsgeo.sunit * fsgeo.blocksize) / BBSIZE; + swidth = (fsgeo.swidth * fsgeo.blocksize) / BBSIZE; + } +diff --git a/io/copy_file_range.c b/io/copy_file_range.c +index d154fa76..422e691a 100644 +--- a/io/copy_file_range.c ++++ b/io/copy_file_range.c +@@ -54,7 +54,7 @@ copy_file_range_cmd(int fd, long long *src_off, long long *dst_off, size_t len) + return 0; + } + +-static off64_t ++static off_t + copy_src_filesize(int fd) + { + struct stat st; +@@ -154,7 +154,7 @@ copy_range_f(int argc, char **argv) + } + + if (!len_specified) { +- off64_t sz; ++ off_t sz; + + sz = copy_src_filesize(fd); + if (sz < 0 || (unsigned long long)sz > SIZE_MAX) { +diff --git a/io/cowextsize.c b/io/cowextsize.c +index f6b134df..00e40c6f 100644 +--- a/io/cowextsize.c ++++ b/io/cowextsize.c +@@ -50,10 +50,10 @@ static int + set_cowextsize(const char *path, int fd, long extsz) + { + struct fsxattr fsx; +- struct stat64 stat; ++ struct stat stat; + +- if (fstat64(fd, &stat) < 0) { +- perror("fstat64"); ++ if (fstat(fd, &stat) < 0) { ++ perror("fstat"); + exitcode = 1; + return 0; + } +diff --git a/io/fadvise.c b/io/fadvise.c +index 60cc0f08..0966c41b 100644 +--- a/io/fadvise.c ++++ b/io/fadvise.c +@@ -39,7 +39,7 @@ fadvise_f( + int argc, + char **argv) + { +- off64_t offset = 0, length = 0; ++ off_t offset = 0, length = 0; + int c, range = 0, advise = POSIX_FADV_NORMAL; + + while ((c = getopt(argc, argv, "dnrsw")) != EOF) { +diff --git a/io/fiemap.c b/io/fiemap.c +index f0c74dfe..b41f71bf 100644 +--- a/io/fiemap.c ++++ b/io/fiemap.c +@@ -234,9 +234,9 @@ fiemap_f( + int tot_w = 5; /* 5 since its just one number */ + int flg_w = 5; + __u64 last_logical = 0; /* last extent offset handled */ +- off64_t start_offset = 0; /* mapping start */ +- off64_t length = -1LL; /* mapping length */ +- off64_t range_end = -1LL; /* mapping end*/ ++ off_t start_offset = 0; /* mapping start */ ++ off_t length = -1LL; /* mapping length */ ++ off_t range_end = -1LL; /* mapping end*/ + size_t fsblocksize, fssectsize; + struct stat st; + +diff --git a/io/fsmap.c b/io/fsmap.c +index 9dd19cc0..dfdaa1b4 100644 +--- a/io/fsmap.c ++++ b/io/fsmap.c +@@ -170,7 +170,7 @@ dump_map_verbose( + unsigned long long i; + struct fsmap *p; + int agno; +- off64_t agoff, bperag; ++ off_t agoff, bperag; + int foff_w, boff_w, aoff_w, tot_w, agno_w, own_w; + int nr_w, dev_w; + char rbuf[40], bbuf[40], abuf[40], obuf[40]; +@@ -183,8 +183,8 @@ dump_map_verbose( + dev_w = 3; + nr_w = 4; + tot_w = MINTOT_WIDTH; +- bperag = (off64_t)fsgeo->agblocks * +- (off64_t)fsgeo->blocksize; ++ bperag = (off_t)fsgeo->agblocks * ++ (off_t)fsgeo->blocksize; + sunit = (fsgeo->sunit * fsgeo->blocksize); + swidth = (fsgeo->swidth * fsgeo->blocksize); + +diff --git a/io/io.h b/io/io.h +index 64b7a663..5f423016 100644 +--- a/io/io.h ++++ b/io/io.h +@@ -53,7 +53,7 @@ extern int stat_f(int argc, char **argv); + typedef struct mmap_region { + void *addr; /* address of start of mapping */ + size_t length; /* length of mapping */ +- off64_t offset; /* start offset into backing file */ ++ off_t offset; /* start offset into backing file */ + int prot; /* protection mode of the mapping */ + int flags; /* MAP_* flags passed to mmap() */ + char *name; /* name of backing file */ +@@ -63,13 +63,13 @@ extern mmap_region_t *maptable; /* mmap'd region array */ + extern int mapcount; /* #entries in the mapping table */ + extern mmap_region_t *mapping; /* active mapping table entry */ + extern int maplist_f(void); +-extern void *check_mapping_range(mmap_region_t *, off64_t, size_t, int); ++extern void *check_mapping_range(mmap_region_t *, off_t, size_t, int); + + /* + * Various xfs_io helper routines/globals + */ + +-extern off64_t filesize(void); ++extern off_t filesize(void); + extern int openfile(char *, struct xfs_fsop_geom *, int, mode_t, + struct fs_path *); + extern int addfile(char *, int , struct xfs_fsop_geom *, int, +@@ -84,9 +84,9 @@ extern size_t io_buffersize; + extern int vectors; + extern struct iovec *iov; + extern int alloc_buffer(size_t, int, unsigned int); +-extern int read_buffer(int, off64_t, long long, long long *, ++extern int read_buffer(int, off_t, long long, long long *, + int, int); +-extern void dump_buffer(off64_t, ssize_t); ++extern void dump_buffer(off_t, ssize_t); + + extern void attr_init(void); + extern void bmap_init(void); +diff --git a/io/madvise.c b/io/madvise.c +index bde31539..6e9c5b12 100644 +--- a/io/madvise.c ++++ b/io/madvise.c +@@ -39,7 +39,7 @@ madvise_f( + int argc, + char **argv) + { +- off64_t offset, llength; ++ off_t offset, llength; + size_t length; + void *start; + int advise = MADV_NORMAL, c; +diff --git a/io/mincore.c b/io/mincore.c +index 67f1d6c4..24147ac2 100644 +--- a/io/mincore.c ++++ b/io/mincore.c +@@ -17,7 +17,7 @@ mincore_f( + int argc, + char **argv) + { +- off64_t offset, llength; ++ off_t offset, llength; + size_t length; + size_t blocksize, sectsize; + void *start; +diff --git a/io/mmap.c b/io/mmap.c +index 7114404b..128a2c06 100644 +--- a/io/mmap.c ++++ b/io/mmap.c +@@ -64,11 +64,11 @@ print_mapping( + void * + check_mapping_range( + mmap_region_t *map, +- off64_t offset, ++ off_t offset, + size_t length, + int pagealign) + { +- off64_t relative; ++ off_t relative; + + if (offset < mapping->offset) { + printf(_("offset (%lld) is before start of mapping (%lld)\n"), +@@ -156,7 +156,7 @@ mmap_f( + int argc, + char **argv) + { +- off64_t offset; ++ off_t offset; + ssize_t length = 0, length2 = 0; + void *address = NULL; + char *filename; +@@ -309,7 +309,7 @@ msync_f( + int argc, + char **argv) + { +- off64_t offset; ++ off_t offset; + ssize_t length; + void *start; + int c, flags = 0; +@@ -402,7 +402,7 @@ mread_f( + int argc, + char **argv) + { +- off64_t offset, tmp, dumpoffset, printoffset; ++ off_t offset, tmp, dumpoffset, printoffset; + ssize_t length; + size_t dumplen, cnt = 0; + char *bp; +@@ -567,7 +567,7 @@ mwrite_f( + int argc, + char **argv) + { +- off64_t offset, tmp; ++ off_t offset, tmp; + ssize_t length; + void *start; + char *sp; +diff --git a/io/pread.c b/io/pread.c +index 458a78b8..89fab81d 100644 +--- a/io/pread.c ++++ b/io/pread.c +@@ -116,7 +116,7 @@ alloc_buffer( + void + __dump_buffer( + void *buf, +- off64_t offset, ++ off_t offset, + ssize_t len) + { + int i, j; +@@ -141,7 +141,7 @@ __dump_buffer( + + void + dump_buffer( +- off64_t offset, ++ off_t offset, + ssize_t len) + { + int i, l; +@@ -164,7 +164,7 @@ dump_buffer( + static ssize_t + do_preadv( + int fd, +- off64_t offset, ++ off_t offset, + long long count) + { + int vecs = 0; +@@ -199,7 +199,7 @@ do_preadv( + static ssize_t + do_pread( + int fd, +- off64_t offset, ++ off_t offset, + long long count, + size_t buffer_size) + { +@@ -212,13 +212,13 @@ do_pread( + static int + read_random( + int fd, +- off64_t offset, ++ off_t offset, + long long count, + long long *total, + unsigned int seed, + int eof) + { +- off64_t end, off, range; ++ off_t end, off, range; + ssize_t bytes; + int ops = 0; + +@@ -259,12 +259,12 @@ read_random( + static int + read_backward( + int fd, +- off64_t *offset, ++ off_t *offset, + long long *count, + long long *total, + int eof) + { +- off64_t end, off = *offset; ++ off_t end, off = *offset; + ssize_t bytes = 0, bytes_requested; + long long cnt = *count; + int ops = 0; +@@ -319,7 +319,7 @@ read_backward( + static int + read_forward( + int fd, +- off64_t offset, ++ off_t offset, + long long count, + long long *total, + int verbose, +@@ -353,7 +353,7 @@ read_forward( + int + read_buffer( + int fd, +- off64_t offset, ++ off_t offset, + long long count, + long long *total, + int verbose, +@@ -368,7 +368,7 @@ pread_f( + char **argv) + { + size_t bsize; +- off64_t offset; ++ off_t offset; + unsigned int zeed = 0; + long long count, total, tmp; + size_t fsblocksize, fssectsize; +diff --git a/io/pwrite.c b/io/pwrite.c +index 467bfa9f..8d134c56 100644 +--- a/io/pwrite.c ++++ b/io/pwrite.c +@@ -54,7 +54,7 @@ pwrite_help(void) + static ssize_t + do_pwritev( + int fd, +- off64_t offset, ++ off_t offset, + long long count, + int pwritev2_flags) + { +@@ -97,7 +97,7 @@ do_pwritev( + static ssize_t + do_pwrite( + int fd, +- off64_t offset, ++ off_t offset, + long long count, + size_t buffer_size, + int pwritev2_flags) +@@ -110,13 +110,13 @@ do_pwrite( + + static int + write_random( +- off64_t offset, ++ off_t offset, + long long count, + unsigned int seed, + long long *total, + int pwritev2_flags) + { +- off64_t off, range; ++ off_t off, range; + ssize_t bytes; + int ops = 0; + +@@ -155,12 +155,12 @@ write_random( + + static int + write_backward( +- off64_t offset, ++ off_t offset, + long long *count, + long long *total, + int pwritev2_flags) + { +- off64_t end, off = offset; ++ off_t end, off = offset; + ssize_t bytes = 0, bytes_requested; + long long cnt = *count; + int ops = 0; +@@ -214,11 +214,11 @@ write_backward( + + static int + write_buffer( +- off64_t offset, ++ off_t offset, + long long count, + size_t bs, + int fd, +- off64_t skip, ++ off_t skip, + long long *total, + int pwritev2_flags) + { +@@ -253,7 +253,7 @@ write_buffer( + + static int + write_once( +- off64_t offset, ++ off_t offset, + long long count, + long long *total, + int pwritev2_flags) +@@ -275,7 +275,7 @@ pwrite_f( + char **argv) + { + size_t bsize; +- off64_t offset, skip = 0; ++ off_t offset, skip = 0; + long long count, total, tmp; + unsigned int zeed = 0, seed = 0xcdcdcdcd; + size_t fsblocksize, fssectsize; +diff --git a/io/reflink.c b/io/reflink.c +index 8e4f3899..b6a3c05a 100644 +--- a/io/reflink.c ++++ b/io/reflink.c +@@ -98,7 +98,7 @@ dedupe_f( + int argc, + char **argv) + { +- off64_t soffset, doffset; ++ off_t soffset, doffset; + long long count, total; + char *infile; + int condensed, quiet_flag; +@@ -226,7 +226,7 @@ reflink_f( + int argc, + char **argv) + { +- off64_t soffset, doffset; ++ off_t soffset, doffset; + long long count = 0, total; + char *infile = NULL; + int condensed, quiet_flag; +diff --git a/io/seek.c b/io/seek.c +index 6734ecb5..ffe7439c 100644 +--- a/io/seek.c ++++ b/io/seek.c +@@ -63,8 +63,8 @@ static void + seek_output( + int startflag, + char *type, +- off64_t start, +- off64_t offset) ++ off_t start, ++ off_t offset) + { + if (offset == -1) { + if (errno == ENXIO) { +@@ -92,7 +92,7 @@ seek_f( + int argc, + char **argv) + { +- off64_t offset, start; ++ off_t offset, start; + size_t fsblocksize, fssectsize; + int c; + int current; /* specify data or hole */ +diff --git a/io/sendfile.c b/io/sendfile.c +index a003bb55..2ce569c2 100644 +--- a/io/sendfile.c ++++ b/io/sendfile.c +@@ -34,12 +34,12 @@ sendfile_help(void) + + static int + send_buffer( +- off64_t offset, ++ off_t offset, + size_t count, + int fd, + long long *total) + { +- off64_t off = offset; ++ off_t off = offset; + ssize_t bytes, bytes_remaining = count; + int ops = 0; + +@@ -66,7 +66,7 @@ sendfile_f( + int argc, + char **argv) + { +- off64_t offset = 0; ++ off_t offset = 0; + long long count, total; + size_t blocksize, sectsize; + struct timeval t1, t2; +diff --git a/io/stat.c b/io/stat.c +index b57f9eef..e8f68dc3 100644 +--- a/io/stat.c ++++ b/io/stat.c +@@ -21,7 +21,7 @@ static cmdinfo_t stat_cmd; + static cmdinfo_t statfs_cmd; + static cmdinfo_t statx_cmd; + +-off64_t ++off_t + filesize(void) + { + struct stat st; +diff --git a/io/sync_file_range.c b/io/sync_file_range.c +index 94285c22..2375a060 100644 +--- a/io/sync_file_range.c ++++ b/io/sync_file_range.c +@@ -30,7 +30,7 @@ sync_range_f( + int argc, + char **argv) + { +- off64_t offset = 0, length = 0; ++ off_t offset = 0, length = 0; + int c, sync_mode = 0; + size_t blocksize, sectsize; + +diff --git a/io/truncate.c b/io/truncate.c +index 1d049194..a74b6131 100644 +--- a/io/truncate.c ++++ b/io/truncate.c +@@ -16,7 +16,7 @@ truncate_f( + int argc, + char **argv) + { +- off64_t offset; ++ off_t offset; + size_t blocksize, sectsize; + + init_cvtnum(&blocksize, §size); +diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c +index 20e0793c..0e67b7b0 100644 +--- a/libxfs/rdwr.c ++++ b/libxfs/rdwr.c +@@ -568,7 +568,7 @@ libxfs_balloc( + + + static int +-__read_buf(int fd, void *buf, int len, off64_t offset, int flags) ++__read_buf(int fd, void *buf, int len, off_t offset, int flags) + { + int sts; + +@@ -631,7 +631,7 @@ libxfs_readbufr_map(struct xfs_buftarg *btp, struct xfs_buf *bp, int flags) + fd = libxfs_device_to_fd(btp->bt_bdev); + buf = bp->b_addr; + for (i = 0; i < bp->b_nmaps; i++) { +- off64_t offset = LIBXFS_BBTOOFF64(bp->b_maps[i].bm_bn); ++ off_t offset = LIBXFS_BBTOOFF64(bp->b_maps[i].bm_bn); + int len = BBTOB(bp->b_maps[i].bm_len); + + error = __read_buf(fd, buf, len, offset, flags); +@@ -790,7 +790,7 @@ err: + } + + static int +-__write_buf(int fd, void *buf, int len, off64_t offset, int flags) ++__write_buf(int fd, void *buf, int len, off_t offset, int flags) + { + int sts; + +@@ -856,7 +856,7 @@ libxfs_bwrite( + void *buf = bp->b_addr; + + for (i = 0; i < bp->b_nmaps; i++) { +- off64_t offset = LIBXFS_BBTOOFF64(bp->b_maps[i].bm_bn); ++ off_t offset = LIBXFS_BBTOOFF64(bp->b_maps[i].bm_bn); + int len = BBTOB(bp->b_maps[i].bm_len); + + bp->b_error = __write_buf(fd, buf, len, offset, +diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c +index 7c1a66c4..bb54e382 100644 +--- a/mdrestore/xfs_mdrestore.c ++++ b/mdrestore/xfs_mdrestore.c +@@ -116,7 +116,7 @@ perform_restore( + /* ensure device is sufficiently large enough */ + + char *lb[XFS_MAX_SECTORSIZE] = { NULL }; +- off64_t off; ++ off_t off; + + off = sb.sb_dblocks * sb.sb_blocksize - sizeof(lb); + if (pwrite(dst_fd, lb, sizeof(lb), off) < 0) +diff --git a/repair/prefetch.c b/repair/prefetch.c +index 017750e9..35b50134 100644 +--- a/repair/prefetch.c ++++ b/repair/prefetch.c +@@ -475,7 +475,7 @@ pf_batch_read( + { + struct xfs_buf *bplist[MAX_BUFS]; + unsigned int num; +- off64_t first_off, last_off, next_off; ++ off_t first_off, last_off, next_off; + int len, size; + int i; + int inode_bufs; +diff --git a/scrub/spacemap.c b/scrub/spacemap.c +index 03440d3a..00bee179 100644 +--- a/scrub/spacemap.c ++++ b/scrub/spacemap.c +@@ -97,11 +97,11 @@ scan_ag_rmaps( + struct scrub_ctx *ctx = (struct scrub_ctx *)wq->wq_ctx; + struct scan_blocks *sbx = arg; + struct fsmap keys[2]; +- off64_t bperag; ++ off_t bperag; + int ret; + +- bperag = (off64_t)ctx->mnt.fsgeom.agblocks * +- (off64_t)ctx->mnt.fsgeom.blocksize; ++ bperag = (off_t)ctx->mnt.fsgeom.agblocks * ++ (off_t)ctx->mnt.fsgeom.blocksize; + + memset(keys, 0, sizeof(struct fsmap) * 2); + keys->fmr_device = ctx->fsinfo.fs_datadev; +diff --git a/spaceman/freesp.c b/spaceman/freesp.c +index 423568a4..df878ce8 100644 +--- a/spaceman/freesp.c ++++ b/spaceman/freesp.c +@@ -62,7 +62,7 @@ static void + addtohist( + xfs_agnumber_t agno, + xfs_agblock_t agbno, +- off64_t len) ++ off_t len) + { + long i; + +@@ -152,7 +152,7 @@ scan_ag( + struct fsmap *l, *h; + struct fsmap *p; + struct xfs_fd *xfd = &file->xfd; +- off64_t aglen; ++ off_t aglen; + xfs_agblock_t agbno; + unsigned long long freeblks = 0; + unsigned long long freeexts = 0; +diff --git a/spaceman/trim.c b/spaceman/trim.c +index e9ed47e4..727dd818 100644 +--- a/spaceman/trim.c ++++ b/spaceman/trim.c +@@ -26,7 +26,7 @@ trim_f( + struct xfs_fd *xfd = &file->xfd; + struct xfs_fsop_geom *fsgeom = &xfd->fsgeom; + xfs_agnumber_t agno = 0; +- off64_t offset = 0; ++ off_t offset = 0; + ssize_t length = 0; + ssize_t minlen = 0; + int aflag = 0; diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/xfsprogs_5.13.0.bb b/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/xfsprogs_5.13.0.bb deleted file mode 100644 index fae7a93a1f..0000000000 --- a/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/xfsprogs_5.13.0.bb +++ /dev/null @@ -1,73 +0,0 @@ -SUMMARY = "XFS Filesystem Utilities" -HOMEPAGE = "http://oss.sgi.com/projects/xfs" -SECTION = "base" -LICENSE = "GPL-2.0-only & LGPL-2.1-only" -LICENSE:libhandle = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://LICENSES/GPL-2.0;md5=e6a75371ba4d16749254a51215d13f97 \ - file://LICENSES/LGPL-2.1;md5=b370887980db5dd40659b50909238dbd" -DEPENDS = "util-linux util-linux-native" -SRC_URI = "https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/${BP}.tar.xz \ - file://remove_flags_from_build_flags.patch \ - file://0001-Check-for-MAP_SYNC-in-sys-mman.h.patch \ - file://0002-include-include-xfs-linux.h-after-sys-mman.h.patch \ - file://0001-support-usrmerge.patch \ - " -SRC_URI[sha256sum] = "4e142d4babe086adf9016d8c606c805829da08e46389a4433f40346204f90cdb" -inherit autotools-brokensep pkgconfig - -PACKAGES =+ "${PN}-fsck ${PN}-mkfs ${PN}-repair libhandle" - -DEPENDS += "util-linux libinih" - -RDEPENDS:${PN} = "${PN}-fsck ${PN}-mkfs ${PN}-repair" - -FILES:${PN}-fsck = "${base_sbindir}/fsck.xfs" -FILES:${PN}-mkfs = "${base_sbindir}/mkfs.xfs" -FILES:${PN}-repair = "${base_sbindir}/xfs_repair" - -FILES:libhandle = "${base_libdir}/libhandle${SOLIBS}" - -EXTRA_OECONF = "--enable-gettext=no \ - --enable-scrub=no \ - INSTALL_USER=root \ - INSTALL_GROUP=root \ - ac_cv_header_aio_h=yes \ - ac_cv_lib_rt_lio_listio=yes \ - OPTIMIZER='${SELECTED_OPTIMIZATION}' \ -" - -DISABLE_STATIC = "" -EXTRA_AUTORECONF += "-I ${S}/m4 --exclude=autoheader" - -PACKAGECONFIG ??= "blkid" - -PACKAGECONFIG[blkid] = "--enable-blkid=yes,--enable-blkid=no,util-linux" - -export DEBUG="-DNDEBUG" -export BUILD_VERBOSE="1" -export tagname="CC" - -EXTRA_OEMAKE = "DIST_ROOT='${D}'" - -do_configure () { - export BUILD_CC="${BUILD_CC} ${BUILD_CFLAGS}" - # Prevent Makefile from calling configure without arguments, - # when do_configure gets called for a second time. - rm -f ${B}/include/builddefs ${B}/include/platform_defs.h ${B}/configure - # Recreate configure script. - oe_runmake configure - install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S} - install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S} - oe_runconf -} - -do_install:append() { - oe_runmake 'DESTDIR=${D}' install-dev - rm ${D}${libdir}/*.la - rmdir --ignore-fail-on-non-empty ${D}${libdir} - - if [ ${libdir} != ${base_libdir} ];then - ln -sf -r ${D}${libdir}/libhandle.a ${D}${base_libdir}/libhandle.a - ln -sf -r ${D}${base_libdir}/libhandle.so ${D}${libdir}/libhandle.so - fi -} diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/xfsprogs_6.0.0.bb b/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/xfsprogs_6.0.0.bb new file mode 100644 index 0000000000..bb8c55d9d5 --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/xfsprogs/xfsprogs_6.0.0.bb @@ -0,0 +1,74 @@ +SUMMARY = "XFS Filesystem Utilities" +HOMEPAGE = "http://oss.sgi.com/projects/xfs" +SECTION = "base" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" +LICENSE:libhandle = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://LICENSES/GPL-2.0;md5=e6a75371ba4d16749254a51215d13f97 \ + file://LICENSES/LGPL-2.1;md5=b370887980db5dd40659b50909238dbd" +DEPENDS = "util-linux util-linux-native" +SRC_URI = "https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/${BP}.tar.xz \ + file://remove_flags_from_build_flags.patch \ + file://0002-include-include-xfs-linux.h-after-sys-mman.h.patch \ + file://0001-support-usrmerge.patch \ + file://0004-configure-Use-AC_SYS_LARGERFILE-autoconf-macro.patch \ + file://0005-Replace-off64_t-stat64-with-off_t-stat.patch \ + " +SRC_URI[sha256sum] = "b77cec2364aab0b8ae8d8c67daac7fdb3801e0979f1d8328d9c3469e57ca9ca0" +inherit autotools-brokensep pkgconfig + +PACKAGES =+ "${PN}-fsck ${PN}-mkfs ${PN}-repair libhandle" + +DEPENDS += "util-linux libinih liburcu" + +RDEPENDS:${PN} = "${PN}-fsck ${PN}-mkfs ${PN}-repair" + +FILES:${PN}-fsck = "${base_sbindir}/fsck.xfs" +FILES:${PN}-mkfs = "${base_sbindir}/mkfs.xfs" +FILES:${PN}-repair = "${base_sbindir}/xfs_repair" + +FILES:libhandle = "${base_libdir}/libhandle${SOLIBS}" + +EXTRA_OECONF = "--enable-gettext=no \ + --enable-scrub=no \ + INSTALL_USER=root \ + INSTALL_GROUP=root \ + ac_cv_header_aio_h=yes \ + ac_cv_lib_rt_lio_listio=yes \ + OPTIMIZER='${SELECTED_OPTIMIZATION}' \ +" + +DISABLE_STATIC = "" +EXTRA_AUTORECONF += "-I ${S}/m4 --exclude=autoheader" + +PACKAGECONFIG ??= "blkid" + +PACKAGECONFIG[blkid] = "--enable-blkid=yes,--enable-blkid=no,util-linux" + +export DEBUG="-DNDEBUG" +export BUILD_VERBOSE="1" +export tagname="CC" + +EXTRA_OEMAKE = "DIST_ROOT='${D}'" + +do_configure () { + export BUILD_CC="${BUILD_CC} ${BUILD_CFLAGS}" + # Prevent Makefile from calling configure without arguments, + # when do_configure gets called for a second time. + rm -f ${B}/include/builddefs ${B}/include/platform_defs.h ${B}/configure + # Recreate configure script. + oe_runmake configure + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S} + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S} + oe_runconf +} + +do_install:append() { + oe_runmake 'DESTDIR=${D}' install-dev + rm ${D}${libdir}/*.la + rmdir --ignore-fail-on-non-empty ${D}${libdir} + + if [ ${libdir} != ${base_libdir} ];then + ln -sf -r ${D}${libdir}/libhandle.a ${D}${base_libdir}/libhandle.a + ln -sf -r ${D}${base_libdir}/libhandle.so ${D}${libdir}/libhandle.so + fi +} diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.10.30.bb b/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.10.30.bb deleted file mode 100644 index 19e16c5910..0000000000 --- a/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.10.30.bb +++ /dev/null @@ -1,63 +0,0 @@ -SUMMARY = "File system QA test suite" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://LICENSES/GPL-2.0;md5=74274e8a218423e49eefdea80bc55038" - -SRCREV_FORMAT = "xfstests_unionmount" - -SRC_URI = "git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git;branch=master;name=xfstests \ - git://github.com/amir73il/unionmount-testsuite.git;branch=master;protocol=https;name=unionmount;destsuffix=unionmount-testsuite \ - file://0001-Add-a-return-type-to-aio_rw.patch \ - file://0002-Drop-detached_mounts_propagation-and-remove-sys-moun.patch \ - " - -SRCREV_xfstests = "7d839ccc1a13148d1a41d32fb9be83a0c8d31496" -SRCREV_unionmount = "e3825b16b46f4c4574a1a69909944c059835f914" - -S = "${WORKDIR}/git" - -inherit autotools-brokensep useradd - -DEPENDS += "xfsprogs acl" -RDEPENDS:${PN} += "\ - bash \ - bc \ - coreutils \ - e2fsprogs \ - e2fsprogs-tune2fs \ - e2fsprogs-resize2fs \ - libaio \ - libcap-bin \ - overlayfs-progs \ - perl \ - python3 \ - python3-core \ - xfsprogs \ - acl \ -" - -USERADD_PACKAGES = "${PN}" -# these users are necessary to run the tests -USERADD_PARAM:${PN} = "-U -m fsgqa; -N 123456-fsgqa; -N fsgqa2" - -EXTRA_OECONF = "INSTALL_USER=root INSTALL_GROUP=root" - -# install-sh script in the project is outdated -# we use the one from the latest libtool to solve installation issues -# It looks like the upstream is not interested in having it fixed :( -# https://www.spinics.net/lists/fstests/msg16981.html -do_configure:prepend() { - cp ${STAGING_DIR_NATIVE}${datadir}/libtool/build-aux/install-sh ${B} -} - -do_install:append() { - unionmount_target_dir=${D}/usr/xfstests/unionmount-testsuite - install -d ${D}/usr/xfstests/unionmount-testsuite/tests - install -D ${WORKDIR}/unionmount-testsuite/tests/* -t $unionmount_target_dir/tests - install ${WORKDIR}/unionmount-testsuite/*.py -t $unionmount_target_dir - install ${WORKDIR}/unionmount-testsuite/run -t $unionmount_target_dir - install ${WORKDIR}/unionmount-testsuite/README -t $unionmount_target_dir -} - -FILES:${PN} += "\ - /usr/xfstests \ -" diff --git a/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.12.18.bb b/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.12.18.bb new file mode 100644 index 0000000000..b1cb9d0521 --- /dev/null +++ b/meta-openembedded/meta-filesystems/recipes-utils/xfstests/xfstests_2022.12.18.bb @@ -0,0 +1,64 @@ +SUMMARY = "File system QA test suite" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSES/GPL-2.0;md5=74274e8a218423e49eefdea80bc55038" + +SRCREV_FORMAT = "xfstests_unionmount" + +SRC_URI = "git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git;branch=master;name=xfstests \ + git://github.com/amir73il/unionmount-testsuite.git;branch=master;protocol=https;name=unionmount;destsuffix=unionmount-testsuite \ + file://0001-Add-a-return-type-to-aio_rw.patch \ + file://0002-Drop-detached_mounts_propagation-and-remove-sys-moun.patch \ + " + +SRCREV_xfstests = "e263104046712af5fb5dcc7d289ac3fa5f14b764" +SRCREV_unionmount = "e3825b16b46f4c4574a1a69909944c059835f914" + +S = "${WORKDIR}/git" + +inherit autotools-brokensep useradd + +DEPENDS += "xfsprogs acl" +RDEPENDS:${PN} += "\ + bash \ + bc \ + coreutils \ + e2fsprogs \ + e2fsprogs-tune2fs \ + e2fsprogs-resize2fs \ + libaio \ + libcap-bin \ + overlayfs-progs \ + perl \ + python3 \ + python3-core \ + xfsprogs \ + acl \ +" + +USERADD_PACKAGES = "${PN}" +# these users are necessary to run the tests +USERADD_PARAM:${PN} = "-U -m fsgqa; -N 123456-fsgqa; -N fsgqa2" + +EXTRA_OECONF = "INSTALL_USER=root INSTALL_GROUP=root" + +TARGET_CC_ARCH:append:libc-musl = " -D_LARGEFILE64_SOURCE" +# install-sh script in the project is outdated +# we use the one from the latest libtool to solve installation issues +# It looks like the upstream is not interested in having it fixed :( +# https://www.spinics.net/lists/fstests/msg16981.html +do_configure:prepend() { + cp ${STAGING_DIR_NATIVE}${datadir}/libtool/build-aux/install-sh ${B} +} + +do_install:append() { + unionmount_target_dir=${D}/usr/xfstests/unionmount-testsuite + install -d ${D}/usr/xfstests/unionmount-testsuite/tests + install -D ${WORKDIR}/unionmount-testsuite/tests/* -t $unionmount_target_dir/tests + install ${WORKDIR}/unionmount-testsuite/*.py -t $unionmount_target_dir + install ${WORKDIR}/unionmount-testsuite/run -t $unionmount_target_dir + install ${WORKDIR}/unionmount-testsuite/README -t $unionmount_target_dir +} + +FILES:${PN} += "\ + /usr/xfstests \ +" diff --git a/meta-openembedded/meta-gnome/conf/layer.conf b/meta-openembedded/meta-gnome/conf/layer.conf index d4d167d0fe..d7286edab5 100644 --- a/meta-openembedded/meta-gnome/conf/layer.conf +++ b/meta-openembedded/meta-gnome/conf/layer.conf @@ -17,7 +17,7 @@ LAYERVERSION_gnome-layer = "1" LAYERDEPENDS_gnome-layer = "core openembedded-layer networking-layer meta-python" -LAYERSERIES_COMPAT_gnome-layer = "kirkstone langdale" +LAYERSERIES_COMPAT_gnome-layer = "mickledore" SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += "\ faenza-icon-theme->gdk-pixbuf \ diff --git a/meta-openembedded/meta-gnome/recipes-connectivity/geary/geary_43.0.bb b/meta-openembedded/meta-gnome/recipes-connectivity/geary/geary_43.0.bb index 8dd0ea67d0..08899fd4a1 100644 --- a/meta-openembedded/meta-gnome/recipes-connectivity/geary/geary_43.0.bb +++ b/meta-openembedded/meta-gnome/recipes-connectivity/geary/geary_43.0.bb @@ -10,7 +10,7 @@ DEPENDS = " \ enchant2 \ evolution-data-server \ folks \ - gcr \ + gcr3 \ gmime \ gnome-online-accounts \ gsound \ @@ -41,7 +41,7 @@ S = "${WORKDIR}/git" SRCREV = "94d6bec861daffb27efea85a296f347db7a5af6d" ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" -REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" +REQUIRED_DISTRO_FEATURES = "gobject-introspection-data opengl" GIR_MESON_OPTION = "" EXTRA_OEMESON = "-Dprofile=release" diff --git a/meta-openembedded/meta-gnome/recipes-connectivity/libnma/libnma_1.10.4.bb b/meta-openembedded/meta-gnome/recipes-connectivity/libnma/libnma_1.10.4.bb new file mode 100644 index 0000000000..6adb7ec295 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-connectivity/libnma/libnma_1.10.4.bb @@ -0,0 +1,29 @@ +SUMMARY = "NetworkManager GUI library" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS = "glib-2.0 gtk+3 gtk4 networkmanager" + +GNOMEBASEBUILDCLASS = "meson" +inherit gnomebase gobject-introspection gtk-doc gettext vala features_check + +REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('PACKAGECONFIG','gcr','x11','',d)} opengl" +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" + +SRC_URI[archive.sha256sum] = "79e730dda19f9b34886f4064aa170f1a2326b08329d655d80b67e906c7f78b7c" + +PACKAGECONFIG ?= "gcr iso_codes mobile_broadband_provider_info" +PACKAGECONFIG[gcr] = "-Dgcr=true,-Dgcr=false,gcr" +PACKAGECONFIG[iso_codes] = "-Diso_codes=true,-Diso_codes=false,iso-codes,iso-codes" +PACKAGECONFIG[mobile_broadband_provider_info] = "-Dmobile_broadband_provider_info=true,-Dmobile_broadband_provider_info=false,mobile-broadband-provider-info,mobile-broadband-provider-info" + +# for gnome-control-center >= 42 +EXTRA_OEMESON = "-Dlibnma_gtk4=true" + +# go introspection is not supported for mipsn32/riscv32, but vapi needs it +# +EXTRA_OEMESON:append:mipsarchn32 = " -Dvapi=false" +EXTRA_OEMESON:append:riscv32 = " -Dvapi=false" +EXTRA_OEMESON:append:powerpc64le = " -Dvapi=false" + +GTKDOC_MESON_OPTION = "gtk_doc" diff --git a/meta-openembedded/meta-gnome/recipes-connectivity/libnma/libnma_1.8.38.bb b/meta-openembedded/meta-gnome/recipes-connectivity/libnma/libnma_1.8.38.bb deleted file mode 100644 index 75c704bc27..0000000000 --- a/meta-openembedded/meta-gnome/recipes-connectivity/libnma/libnma_1.8.38.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "NetworkManager GUI library" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -DEPENDS = "glib-2.0 gtk+3 gtk4 networkmanager" - -GNOMEBASEBUILDCLASS = "meson" -inherit gnomebase gobject-introspection gtk-doc gettext vala features_check - -REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('PACKAGECONFIG','gcr','x11','',d)}" -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -SRC_URI[archive.sha256sum] = "5ed93eae18456ff5a8a4f408178c1ee198dc8d3a46c65f9075b101916e64e8b4" - -PACKAGECONFIG ?= "gcr iso_codes mobile_broadband_provider_info" -PACKAGECONFIG[gcr] = "-Dgcr=true,-Dgcr=false,gcr" -PACKAGECONFIG[iso_codes] = "-Diso_codes=true,-Diso_codes=false,iso-codes,iso-codes" -PACKAGECONFIG[mobile_broadband_provider_info] = "-Dmobile_broadband_provider_info=true,-Dmobile_broadband_provider_info=false,mobile-broadband-provider-info,mobile-broadband-provider-info" - -# for gnome-control-center >= 42 -EXTRA_OEMESON = "-Dlibnma_gtk4=true" - -# go introspection is not supported for mipsn32/riscv32, but vapi needs it -# -EXTRA_OEMESON:append:mipsarchn32 = " -Dvapi=false" -EXTRA_OEMESON:append:riscv32 = " -Dvapi=false" -EXTRA_OEMESON:append:powerpc64le = " -Dvapi=false" - -GTKDOC_MESON_OPTION = "gtk_doc" diff --git a/meta-openembedded/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_1.26.0.bb b/meta-openembedded/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_1.26.0.bb deleted file mode 100644 index 8046b139c0..0000000000 --- a/meta-openembedded/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_1.26.0.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "GTK+ applet for NetworkManager" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -DEPENDS = "gtk+3 libnma libnotify libsecret libgudev networkmanager iso-codes nss" - -GNOMEBASEBUILDCLASS = "meson" -inherit features_check gnomebase gsettings gtk-icon-cache gettext - -REQUIRED_DISTRO_FEATURES = "x11" - -SRC_URI[archive.sha256sum] = "69611b29064adbd57395fe3e51a9ebde1ea794615f776900453a2bbe3d8cddfd" - -# We don't not have ubuntu's appindicator (yet?) -EXTRA_OEMESON = "-Dappindicator=no" -# We currently don't build NetworkManager with libteamdctl support -EXTRA_OEMESON += "-Dteam=false" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" -PACKAGECONFIG[modemmanager] = "-Dwwan=true, -Dwwan=false, modemmanager" -PACKAGECONFIG[selinux] = "-Dselinux=true, -Dselinux=false, libselinux" - -RDEPENDS:${PN} =+ "networkmanager" - -FILES:${PN} += " \ - ${datadir}/nm-applet/ \ - ${datadir}/libnma/wifi.ui \ - ${datadir}/metainfo \ -" diff --git a/meta-openembedded/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_1.30.0.bb b/meta-openembedded/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_1.30.0.bb new file mode 100644 index 0000000000..8c7564a8e3 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-connectivity/network-manager-applet/network-manager-applet_1.30.0.bb @@ -0,0 +1,29 @@ +SUMMARY = "GTK+ applet for NetworkManager" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS = "gtk+3 libnma libnotify libsecret libgudev networkmanager iso-codes nss" + +GNOMEBASEBUILDCLASS = "meson" +inherit features_check gnomebase gsettings gtk-icon-cache gettext + +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +SRC_URI[archive.sha256sum] = "9516b84e9d9f100db89a0c67cbfe57cedb0562310d45caafb6332e27bbeb5cd3" + +# We don't not have ubuntu's appindicator (yet?) +EXTRA_OEMESON = "-Dappindicator=no" +# We currently don't build NetworkManager with libteamdctl support +EXTRA_OEMESON += "-Dteam=false" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" +PACKAGECONFIG[modemmanager] = "-Dwwan=true, -Dwwan=false, modemmanager" +PACKAGECONFIG[selinux] = "-Dselinux=true, -Dselinux=false, libselinux" + +RDEPENDS:${PN} =+ "networkmanager" + +FILES:${PN} += " \ + ${datadir}/nm-applet/ \ + ${datadir}/libnma/wifi.ui \ + ${datadir}/metainfo \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gimp/babl/babl_0.1.96.bb b/meta-openembedded/meta-gnome/recipes-gimp/babl/babl_0.1.96.bb deleted file mode 100644 index 85cc7793cc..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gimp/babl/babl_0.1.96.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "Babl is a dynamic, any to any, pixel format conversion library" -LICENSE = "LGPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=6a6a8e020838b23406c81b19c1d46df6" - -GNOMEBASEBUILDCLASS = "meson" - -GIR_MESON_OPTION = "enable-gir" - -inherit setuptools3 gnomebase gobject-introspection vala - -DEPENDS += "lcms" - -# https://bugs.llvm.org/show_bug.cgi?id=45555 -CFLAGS:append:toolchain-clang:mipsarch = " -ffp-exception-behavior=ignore " -CFLAGS:append:toolchain-clang:riscv64 = " -ffp-exception-behavior=ignore " - -SRC_URI = "https://download.gimp.org/pub/${BPN}/0.1/${BP}.tar.xz" -SRC_URI[sha256sum] = "33673fe459a983f411245a49f81fd7f1966af1ea8eca9b095a940c542b8545f6" - -BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-gnome/recipes-gimp/babl/babl_0.1.98.bb b/meta-openembedded/meta-gnome/recipes-gimp/babl/babl_0.1.98.bb new file mode 100644 index 0000000000..a9e192b753 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gimp/babl/babl_0.1.98.bb @@ -0,0 +1,20 @@ +SUMMARY = "Babl is a dynamic, any to any, pixel format conversion library" +LICENSE = "LGPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=6a6a8e020838b23406c81b19c1d46df6" + +GNOMEBASEBUILDCLASS = "meson" + +GIR_MESON_OPTION = "enable-gir" + +inherit setuptools3 gnomebase gobject-introspection vala + +DEPENDS += "lcms" + +# https://bugs.llvm.org/show_bug.cgi?id=45555 +CFLAGS:append:toolchain-clang:mipsarch = " -ffp-exception-behavior=ignore " +CFLAGS:append:toolchain-clang:riscv64 = " -ffp-exception-behavior=ignore " + +SRC_URI = "https://download.gimp.org/pub/${BPN}/0.1/${BP}.tar.xz" +SRC_URI[sha256sum] = "f3b222f84e462735de63fa9c3651942f2b78fd314c73a22e05ff7c73afd23af1" + +BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-gnome/recipes-gimp/gegl/gegl_0.4.38.bb b/meta-openembedded/meta-gnome/recipes-gimp/gegl/gegl_0.4.38.bb deleted file mode 100644 index 5415658094..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gimp/gegl/gegl_0.4.38.bb +++ /dev/null @@ -1,59 +0,0 @@ -SUMMARY = "GEGL (Generic Graphics Library) is a graph based image processing framework" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=f1a8bfcbc85304df454b65d378b299c7" - -DEPENDS = " \ - intltool-native \ - babl \ - glib-2.0 \ - cairo \ - expat \ - zlib \ - \ - json-glib \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit features_check gnomebase vala gobject-introspection - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -SHPV = "${@gnome_verdir("${PV}")}" - -SRC_URI = "https://download.gimp.org/pub/${BPN}/${SHPV}/${BP}.tar.xz" -SRC_URI[sha256sum] = "e4a33c8430a5042fba8439b595348e71870f0d95fbf885ff553f9020c1bed750" - -PACKAGECONFIG ??= "gexiv2 jpeg libpng libraw librsvg pango poppler sdl2" -PACKAGECONFIG:class-native = "libpng librsvg" - -PACKAGECONFIG[jasper] = "-Djasper=enabled,-Djasper=disabled,jasper" -PACKAGECONFIG[gexiv2] = "-Dgexiv2=enabled,-Dgexiv2=disabled,gexiv2" -PACKAGECONFIG[graphviz] = "-Dgraphviz=enabled,-Dgraphviz=disabled,graphviz" -PACKAGECONFIG[jpeg] = "-Dlibjpeg=enabled,-Dlibjpeg=disabled,jpeg" -PACKAGECONFIG[lcms] = "-Dlcms=enabled,-Dlcms=disabled,lcms" -PACKAGECONFIG[libav] = "-Dlibav=enabled,-Dlibav=disabled,libav" -PACKAGECONFIG[libpng] = "-Dlibpng=enabled,-Dlibpng=disabled,libpng" -PACKAGECONFIG[libraw] = "-Dlibraw=enabled,-Dlibraw=disabled,libraw" -PACKAGECONFIG[librsvg] = "-Dlibrsvg=enabled,-Dlibrsvg=disabled,librsvg" -PACKAGECONFIG[pango] = "-Dpango=enabled -Dpangocairo=enabled,-Dpango=disabled -Dpangocairo=disabled,pango" -PACKAGECONFIG[poppler] = "-Dpoppler=enabled,-Dpoppler=disabled,poppler" -PACKAGECONFIG[sdl] = "-Dsdl1=enabled,-Dsdl1=disabled,libsdl" -PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,libsdl2" -PACKAGECONFIG[tiff] = "-Dlibtiff=enabled,-Dlibtiff=disabled,tiff" -PACKAGECONFIG[webp] = "-Dwebp=enabled,-Dwebp=disabled,webp" - -# There are a couple of non-symlink .so files installed into libdir, which need to go into main package -FILES:${PN} += " \ - ${libdir}/*.so \ - ${libdir}/gegl-${SHPV}/*.json \ - ${libdir}/gegl-${SHPV}/*.so \ -" -FILES_SOLIBSDEV = "${libdir}/libgegl-${SHPV}${SOLIBSDEV}" - -# Fails to build with thumb-1 (qemuarm) -# gegl-0.2.0/operations/common/matting-global.c: In function 'matting_process': -# gegl-0.2.0/operations/common/matting-global.c:463:1: internal compiler error: in patch_jump_insn, at cfgrtl.c:1275 -ARM_INSTRUCTION_SET = "arm" - -BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-gnome/recipes-gimp/gegl/gegl_0.4.40.bb b/meta-openembedded/meta-gnome/recipes-gimp/gegl/gegl_0.4.40.bb new file mode 100644 index 0000000000..335ce24aa9 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gimp/gegl/gegl_0.4.40.bb @@ -0,0 +1,59 @@ +SUMMARY = "GEGL (Generic Graphics Library) is a graph based image processing framework" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=f1a8bfcbc85304df454b65d378b299c7" + +DEPENDS = " \ + intltool-native \ + babl \ + glib-2.0 \ + cairo \ + expat \ + zlib \ + \ + json-glib \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit features_check gnomebase vala gobject-introspection + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" + +SHPV = "${@gnome_verdir("${PV}")}" + +SRC_URI = "https://download.gimp.org/pub/${BPN}/${SHPV}/${BP}.tar.xz" +SRC_URI[sha256sum] = "cdde80d15a49dab9a614ef98f804c8ce6e4cfe1339a3c240c34f3fb45436b85d" + +PACKAGECONFIG ??= "gexiv2 jpeg libpng libraw librsvg pango poppler sdl2" +PACKAGECONFIG:class-native = "libpng librsvg" + +PACKAGECONFIG[jasper] = "-Djasper=enabled,-Djasper=disabled,jasper" +PACKAGECONFIG[gexiv2] = "-Dgexiv2=enabled,-Dgexiv2=disabled,gexiv2" +PACKAGECONFIG[graphviz] = "-Dgraphviz=enabled,-Dgraphviz=disabled,graphviz" +PACKAGECONFIG[jpeg] = "-Dlibjpeg=enabled,-Dlibjpeg=disabled,jpeg" +PACKAGECONFIG[lcms] = "-Dlcms=enabled,-Dlcms=disabled,lcms" +PACKAGECONFIG[libav] = "-Dlibav=enabled,-Dlibav=disabled,libav" +PACKAGECONFIG[libpng] = "-Dlibpng=enabled,-Dlibpng=disabled,libpng" +PACKAGECONFIG[libraw] = "-Dlibraw=enabled,-Dlibraw=disabled,libraw" +PACKAGECONFIG[librsvg] = "-Dlibrsvg=enabled,-Dlibrsvg=disabled,librsvg" +PACKAGECONFIG[pango] = "-Dpango=enabled -Dpangocairo=enabled,-Dpango=disabled -Dpangocairo=disabled,pango" +PACKAGECONFIG[poppler] = "-Dpoppler=enabled,-Dpoppler=disabled,poppler" +PACKAGECONFIG[sdl] = "-Dsdl1=enabled,-Dsdl1=disabled,libsdl" +PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,libsdl2" +PACKAGECONFIG[tiff] = "-Dlibtiff=enabled,-Dlibtiff=disabled,tiff" +PACKAGECONFIG[webp] = "-Dwebp=enabled,-Dwebp=disabled,webp" + +# There are a couple of non-symlink .so files installed into libdir, which need to go into main package +FILES:${PN} += " \ + ${libdir}/*.so \ + ${libdir}/gegl-${SHPV}/*.json \ + ${libdir}/gegl-${SHPV}/*.so \ +" +FILES_SOLIBSDEV = "${libdir}/libgegl-${SHPV}${SOLIBSDEV}" + +# Fails to build with thumb-1 (qemuarm) +# gegl-0.2.0/operations/common/matting-global.c: In function 'matting_process': +# gegl-0.2.0/operations/common/matting-global.c:463:1: internal compiler error: in patch_jump_insn, at cfgrtl.c:1275 +ARM_INSTRUCTION_SET = "arm" + +BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/amtk/amtk_5.3.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/amtk/amtk_5.3.1.bb deleted file mode 100644 index f6d8739dae..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/amtk/amtk_5.3.1.bb +++ /dev/null @@ -1,18 +0,0 @@ -SUMMARY = "Actions, Menus and Toolbars Kit" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" - -DEPENDS = " \ - glib-2.0-native \ - gtk+3 \ -" - -GNOMEBASEBUILDCLASS = "meson" - -GIR_MESON_OPTION = "" - -inherit gnomebase gettext features_check gobject-introspection - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -SRC_URI[archive.sha256sum] = "d5aa236c5d71dc41aa4674f345560a67a27f21c0efc97c9b3da09cb582b4638b" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/amtk/amtk_5.6.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/amtk/amtk_5.6.1.bb new file mode 100644 index 0000000000..fbc8f38454 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/amtk/amtk_5.6.1.bb @@ -0,0 +1,22 @@ +SUMMARY = "Actions, Menus and Toolbars Kit" +LICENSE = "LGPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSES/LGPL-3.0-or-later.txt;md5=c51d3eef3be114124d11349ca0d7e117" + +DEPENDS = " \ + glib-2.0-native \ + gtk+3 \ + gtk-doc-native \ + libxslt-native \ + docbook-xsl-stylesheets-native \ + python3-pygments-native \ +" + +GNOMEBASEBUILDCLASS = "meson" + +GIR_MESON_OPTION = "" + +inherit gnomebase gettext features_check gobject-introspection + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" + +SRC_URI[archive.sha256sum] = "d50115b85c872aac296934b5ee726a3fa156c6f5ad96d27e0edd0aa5ad173228" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor/0001-editor-meson.build-fix-meson-0.61-errors.patch b/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor/0001-editor-meson.build-fix-meson-0.61-errors.patch deleted file mode 100644 index 850d8a9d47..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor/0001-editor-meson.build-fix-meson-0.61-errors.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 86379a220a4eb00c309f514d2ca57ed6c1c8b35c Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Fri, 21 Jan 2022 22:22:58 +0100 -Subject: [PATCH] editor/meson.build: fix meson 0.61 errors - -Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/dconf-editor/-/merge_requests/21] -Signed-off-by: Alexander Kanavin ---- - editor/meson.build | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/editor/meson.build b/editor/meson.build -index 4c89ab99..0eb3bb1a 100644 ---- a/editor/meson.build -+++ b/editor/meson.build -@@ -1,7 +1,6 @@ - desktop = dconf_editor_namespace + '.desktop' - - i18n.merge_file ( -- desktop, - type: 'desktop', - input: desktop + '.in', - output: desktop, -@@ -26,7 +25,6 @@ configure_file( - appdata = dconf_editor_namespace + '.appdata.xml' - - i18n.merge_file( -- appdata, - input: appdata + '.in', - output: appdata, - po_dir: po_dir, diff --git a/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor_3.38.3.bb b/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor_3.38.3.bb deleted file mode 100644 index ef26caa144..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor_3.38.3.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "Configuration editor for dconf" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" - -GNOMEBASEBUILDCLASS = "meson" - -DEPENDS = "dconf gtk+3" - -inherit gnomebase vala gettext gsettings bash-completion - -SRC_URI += " file://0001-editor-meson.build-fix-meson-0.61-errors.patch" -SRC_URI[archive.sha256sum] = "571af4c7dad4f049b53e6cd728b79addf08c27ddab6bc57b396d211866ee79e3" - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/metainfo \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor_43.0.bb new file mode 100644 index 0000000000..5b37645604 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/dconf/dconf-editor_43.0.bb @@ -0,0 +1,21 @@ +SUMMARY = "Configuration editor for dconf" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" + +GNOMEBASEBUILDCLASS = "meson" + +DEPENDS = " \ + dconf \ + gtk+3 \ + glib-2.0 \ + libhandy\ +" + +inherit gnomebase vala gsettings bash-completion pkgconfig gtk-icon-cache + +SRC_URI[archive.sha256sum] = "935a3c2dd76cc2a93cd5aee9a54d3947fb111eb396f4b63dc5f0ba8f8d099136" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/metainfo \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/eog/eog_43.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/eog/eog_43.1.bb new file mode 100644 index 0000000000..24701bcb3c --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/eog/eog_43.1.bb @@ -0,0 +1,30 @@ +SUMMARY = "This is the Eye of GNOME, an image viewer program." +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS = " \ + librsvg \ + gnome-desktop \ + gsettings-desktop-schemas \ + gdk-pixbuf \ + gtk+3 \ + libhandy \ + libpeas \ + libportal \ + libexif \ + lcms \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase pkgconfig gsettings gobject-introspection gettext mime-xdg features_check gtk-icon-cache + +REQUIRED_DISTRO_FEATURES = "opengl" + +SRC_URI[archive.sha256sum] = "fed79ff3ca19bac62f27155c9bdd69eef875870b971e6dcb0aa38c093d131971" + +GTKDOC_MESON_OPTION = "gtk_doc" + +EXTRA_OEMESON = "-Dxmp=false" + +FILES:${PN} += "${datadir}" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/evince/evince_42.3.bb b/meta-openembedded/meta-gnome/recipes-gnome/evince/evince_42.3.bb deleted file mode 100644 index 0c97f75e90..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/evince/evince_42.3.bb +++ /dev/null @@ -1,51 +0,0 @@ -SUMMARY = "Evince is a document viewer for document formats like pdf, ps, djvu" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=96f2f8d5ee576a2163977938ea36fa7b" -SECTION = "x11/office" -DEPENDS = " \ - gnome-common-native \ - yelp-tools-native \ - appstream-glib \ - gtk+3 \ - gspell \ - libsecret \ - poppler \ - gstreamer1.0-plugins-base \ - orc \ - adwaita-icon-theme \ - libhandy \ - ${@bb.utils.contains('DISTRO_FEATURES','x11','gnome-desktop','dbus',d)} \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase itstool gnome-help pkgconfig gsettings gobject-introspection gettext mime-xdg gtk-doc - -def gnome_verdir(v): - return oe.utils.trim_version(v, 1) - -SRC_URI[archive.sha256sum] = "49aecf845c946c96db17ba89d75c8002c5ae8963f504a9b0626d12675914645e" - -GTKDOC_MESON_OPTION = "gtk_doc" - -EXTRA_OEMESON = " \ - -Dsystemduserunitdir=no \ -" - -do_compile:prepend() { - export GIR_EXTRA_LIBS_PATH="${B}/libdocument/.libs" -} - -PACKAGECONFIG ??= "" -PACKAGECONFIG[nautilus] = "-Dnautilus=true,-Dnautilus=false,nautilus" - -RDEPENDS:${PN} += "glib-2.0-utils" -RRECOMMENDS:${PN} = "adwaita-icon-theme" - -PACKAGES =+ "${PN}-nautilus-extension" - -FILES:${PN} += "${datadir}/dbus-1 \ - ${datadir}/metainfo \ - ${datadir}/thumbnailers \ -" -FILES:${PN}-nautilus-extension = "${libdir}/nautilus/*/*so" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/evince/evince_43.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/evince/evince_43.1.bb new file mode 100644 index 0000000000..b83c411923 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/evince/evince_43.1.bb @@ -0,0 +1,53 @@ +SUMMARY = "Evince is a document viewer for document formats like pdf, ps, djvu" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=96f2f8d5ee576a2163977938ea36fa7b" +SECTION = "x11/office" +DEPENDS = " \ + adwaita-icon-theme \ + appstream-glib \ + cairo \ + dbus \ + gdk-pixbuf \ + glib-2.0 \ + gnome-common-native \ + gnome-desktop \ + gsettings-desktop-schemas \ + gspell \ + gstreamer1.0-plugins-base \ + gtk+3 \ + libarchive \ + libhandy \ + libsecret \ + libxml2 \ + poppler \ + yelp-tools-native \ + zlib \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase itstool gnome-help pkgconfig gsettings gobject-introspection gettext mime-xdg gtk-doc features_check gtk-icon-cache + +REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'opengl', '', d)}" + +def gnome_verdir(v): + return oe.utils.trim_version(v, 1) + +SRC_URI[archive.sha256sum] = "6d75ca62b73bfbb600f718a098103dc6b813f9050b9594be929e29b4589d2335" + +GTKDOC_MESON_OPTION = "gtk_doc" + +PACKAGECONFIG ??= "" +PACKAGECONFIG[nautilus] = "-Dnautilus=true,-Dnautilus=false,nautilus" + +RDEPENDS:${PN} += "glib-2.0-utils" +RRECOMMENDS:${PN} = "adwaita-icon-theme" + +PACKAGES =+ "${PN}-nautilus-extension" + +FILES:${PN} += "${datadir}/dbus-1 \ + ${datadir}/metainfo \ + ${datadir}/thumbnailers \ + ${systemd_user_unitdir} \ +" +FILES:${PN}-nautilus-extension = "${libdir}/nautilus/*/*so" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/evolution-data-server/evolution-data-server.bb b/meta-openembedded/meta-gnome/recipes-gnome/evolution-data-server/evolution-data-server.bb index 64774b0fe8..a271152678 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/evolution-data-server/evolution-data-server.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/evolution-data-server/evolution-data-server.bb @@ -2,13 +2,14 @@ require ${BPN}.inc DEPENDS = " \ ${BPN}-native intltool-native gperf-native \ - glib-2.0 gtk+3 libgdata libxml2 icu \ - dbus db virtual/libiconv zlib libsoup-2.4 libical nss libsecret \ + glib-2.0 gtk+3 gtk4 libxml2 icu \ + dbus db virtual/libiconv zlib libsoup-3.0 libical nss libsecret \ " inherit pkgconfig gsettings gobject-introspection features_check cmake gtk-doc gettext perlnative vala ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" +REQUIRED_DISTRO_FEATURES = "opengl" SRC_URI += " \ file://0001-cmake-Do-not-export-CC-into-gir-compiler.patch \ @@ -24,10 +25,6 @@ LKSTRFTIME:libc-musl = "HAVE_LKSTRFTIME=OFF" EXTRA_OECMAKE = " \ -DSYSCONF_INSTALL_DIR=${sysconfdir} \ - -DWITH_KRB5=OFF \ - -DENABLE_GOA=OFF \ - -DENABLE_GOOGLE_AUTH=OFF \ - -DENABLE_WEATHER=OFF \ -DVAPIGEN=${STAGING_BINDIR_NATIVE}/vapigen \ ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DENABLE_INTROSPECTION=ON -DENABLE_VALA_BINDINGS=ON', '-DENABLE_INTROSPECTION=OFF', d)} \ -D${LKSTRFTIME} \ @@ -37,13 +34,18 @@ EXTRA_OECMAKE = " \ EXTRA_OECMAKE:append:class-target = " -DG_IR_COMPILER=${STAGING_BINDIR}/g-ir-compiler-wrapper" EXTRA_OECMAKE:append:class-target = " -DG_IR_SCANNER=${STAGING_BINDIR}/g-ir-scanner-wrapper" +PACKAGECONFIG ?= "oauth" + PACKAGECONFIG[canberra] = "-DENABLE_CANBERRA=ON,-DENABLE_CANBERRA=OFF,libcanberra" -PACKAGECONFIG[oauth] = "-DENABLE_OAUTH2=ON,-DENABLE_OAUTH2=OFF,webkitgtk json-glib" +# ENABLE_OAUTH2_WEBKITGTK4 would require webkit to be built with gtk4 +PACKAGECONFIG[oauth] = "-DENABLE_OAUTH2_WEBKITGTK=ON -DENABLE_OAUTH2_WEBKITGTK4=OFF,-DENABLE_OAUTH2_WEBKITGTK=OFF,webkitgtk json-glib" PACKAGECONFIG[goa] = "-DENABLE_GOA=ON,-DENABLE_GOA=OFF,gnome-online-accounts" - +PACKAGECONFIG[kerberos] = "-DWITH_KRB5=ON,-DWITH_KRB5=OFF,krb5" # BROKEN: due missing pkg-config in openldap eds' cmake finds host-libs when # searching for openldap-libs PACKAGECONFIG[openldap] = "-DWITH_OPENLDAP=ON,-DWITH_OPENLDAP=OFF,openldap" +PACKAGECONFIG[weather] = "-DENABLE_WEATHER=ON,-DENABLE_WEATHER=OFF,libgweather4" + # -ldb needs this on some platforms LDFLAGS += "-lpthread -lgmodule-2.0 -lgthread-2.0" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/evolution-data-server/evolution-data-server.inc b/meta-openembedded/meta-gnome/recipes-gnome/evolution-data-server/evolution-data-server.inc index 78efee0040..86f01ab377 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/evolution-data-server/evolution-data-server.inc +++ b/meta-openembedded/meta-gnome/recipes-gnome/evolution-data-server/evolution-data-server.inc @@ -9,5 +9,5 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=6a6e689d19255cf0557f3fe7d7068212 \ inherit gnomebase upstream-version-is-even -SRC_URI[archive.sha256sum] = "2ed72afe4d6bb170f8728faea0907fee10212dfde7a9fab82fbcc83d0f22f028" -PV = "3.44.2" +SRC_URI[archive.sha256sum] = "f9bd52008b7e535d816920cfcec70a0e5562bde28af71f996e203ff6a86e46e0" +PV = "3.46.2" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/file-roller/file-roller_3.42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/file-roller/file-roller_3.42.0.bb deleted file mode 100644 index f77400564e..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/file-roller/file-roller_3.42.0.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "An archive manager utility for the GNOME Environment" -LICENSE="GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" - -GNOMEBASEBUILDCLASS = "meson" - -DEPENDS = " \ - glib-2.0-native \ - gtk+3 \ - libarchive \ - libnotify \ - libhandy \ -" - -inherit gnomebase gsettings itstool gnome-help gettext upstream-version-is-even mime-xdg - -SRC_URI[archive.sha256sum] = "1c438e6d53ec10ff4f2eb5b22d7bbf28a7c2a84957ab64a751c1cdf3c52302c7" - -PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'packagekit', '', d)}" - -PACKAGECONFIG[nautilus] = "-Dnautilus-actions=enabled,-Dnautilus-actions=disabled,nautilus" -PACKAGECONFIG[packagekit] = "-Dpackagekit=true,-Dpackagekit=false," - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/metainfo \ - ${libdir}/nautilus \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/file-roller/file-roller_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/file-roller/file-roller_43.0.bb new file mode 100644 index 0000000000..6d0f1f7463 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/file-roller/file-roller_43.0.bb @@ -0,0 +1,35 @@ +SUMMARY = "An archive manager utility for the GNOME Environment" +LICENSE="GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" + +GNOMEBASEBUILDCLASS = "meson" + +DEPENDS = " \ + desktop-file-utils-native \ + glib-2.0-native \ + glib-2.0 \ + json-glib \ + gtk+3 \ + libarchive \ + libhandy \ + libportal \ +" + +inherit gnomebase gsettings itstool gobject-introspection gnome-help gettext upstream-version-is-even mime-xdg gtk-icon-cache features_check + +REQUIRED_DISTRO_FEATURES = "opengl" + +EXTRA_OEMESON += "-Dintrospection=enabled" + +SRC_URI[archive.sha256sum] = "298729fdbdb9da8132c0bbc60907517d65685b05618ae05167335e6484f573a1" + +PACKAGECONFIG ??= "" + +PACKAGECONFIG[nautilus] = "-Dnautilus-actions=enabled,-Dnautilus-actions=disabled,nautilus" +PACKAGECONFIG[packagekit] = "-Dpackagekit=true,-Dpackagekit=false,,packagekit" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/metainfo \ + ${libdir}/nautilus \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gdm/gdm_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gdm/gdm_42.0.bb deleted file mode 100644 index 00fb56b2b1..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gdm/gdm_42.0.bb +++ /dev/null @@ -1,58 +0,0 @@ -SUMMARY = "GNOME Display Manager" -LICENSE="GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -DEPENDS = " \ - dconf-native \ - gtk+3 \ - accountsservice \ - libcanberra \ - libpam \ - libgudev \ -" - -REQUIRED_DISTRO_FEATURES = "x11 systemd pam polkit gobject-introspection-data" -GIR_MESON_OPTION = "" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gobject-introspection gettext systemd useradd itstool gnome-help features_check - -SRC_URI[archive.sha256sum] = "a328ac976937bec179971ff07829a1246b98ce724181c128ae32a0ba47ad3855" - -EXTRA_OEMESON = " \ - -Dplymouth=disabled \ - -Ddefault-pam-config=openembedded \ - -Dpam-mod-dir=${base_libdir}/security \ -" - -do_install:append() { - rm -rf ${D}/run ${D}${localstatedir}/run -} - -USERADD_PACKAGES = "${PN}" -USERADD_PARAM:${PN} = "--system --no-create-home --home ${localstatedir}/lib/gdm --user-group gdm" - -SYSTEMD_SERVICE:${PN} = "${BPN}.service" - -# Some gnome components - as gnome-panel and gnome-shell (!!) - require gdm -# components. To allow gnome-images using different display-manager, split them -# out into a seperate package. -PACKAGE_BEFORE_PN = "${PN}-base" -FILES:${PN}-base = " \ - ${datadir}/glib-2.0 \ - ${datadir}/gnome-session \ - ${libdir}/lib*${SOLIBS} \ - ${libdir}/girepository-1.0 \ -" - -CONFFILES:${PN} += "${sysconfdir}/gdm/custom.conf" -FILES:${PN} += " \ - ${datadir}/dconf \ - ${base_libdir}/security/pam_gdm.so \ - ${localstatedir} \ - ${systemd_unitdir} ${systemd_user_unitdir} \ -" - -RDEPENDS:${PN} += "${PN}-base" - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gdm/gdm_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gdm/gdm_43.0.bb new file mode 100644 index 0000000000..1b09c20d4c --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gdm/gdm_43.0.bb @@ -0,0 +1,60 @@ +SUMMARY = "GNOME Display Manager" +LICENSE="GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS = " \ + accountsservice \ + audit \ + dconf-native \ + gtk+3 \ + keyutils \ + libcanberra \ + libgudev \ + libpam \ + xserver-xorg \ +" + +REQUIRED_DISTRO_FEATURES = "x11 systemd pam polkit gobject-introspection-data" +GIR_MESON_OPTION = "" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gsettings pkgconfig gobject-introspection gettext systemd useradd itstool gnome-help features_check + +SRC_URI[archive.sha256sum] = "94d70d6ed7df59fa7fde4fd02fed1168593a8adce10fcee113c148d52b392294" + +EXTRA_OEMESON = " \ + -Dplymouth=disabled \ + -Ddefault-pam-config=openembedded \ + -Dpam-mod-dir=${base_libdir}/security \ +" + +do_install:append() { + rm -rf ${D}/run ${D}${localstatedir}/run +} + +USERADD_PACKAGES = "${PN}" +USERADD_PARAM:${PN} = "--system --no-create-home --home ${localstatedir}/lib/gdm --user-group gdm" + +SYSTEMD_SERVICE:${PN} = "${BPN}.service" + +# Some gnome components - as gnome-panel and gnome-shell (!!) - require gdm +# components. To allow gnome-images using different display-manager, split them +# out into a seperate package. +PACKAGE_BEFORE_PN = "${PN}-base" +FILES:${PN}-base = " \ + ${datadir}/glib-2.0 \ + ${datadir}/gnome-session \ + ${libdir}/lib*${SOLIBS} \ + ${libdir}/girepository-1.0 \ +" + +CONFFILES:${PN} += "${sysconfdir}/gdm/custom.conf" +FILES:${PN} += " \ + ${datadir}/dconf \ + ${base_libdir}/security/pam_gdm.so \ + ${localstatedir} \ + ${systemd_unitdir} ${systemd_user_unitdir} \ +" + +RDEPENDS:${PN} += "${PN}-base" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gedit/gedit_42.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gedit/gedit_42.2.bb deleted file mode 100644 index 13d3e0af79..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gedit/gedit_42.2.bb +++ /dev/null @@ -1,46 +0,0 @@ -SUMMARY = "GNOME editor" -SECTION = "x11/gnome" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=75859989545e37968a99b631ef42722e" - -GNOMEBASEBUILDCLASS = "meson" - -DEPENDS = " \ - gdk-pixbuf-native \ - gtk+3 \ - gsettings-desktop-schemas \ - libpeas \ - libsoup-2.4 \ - gspell \ - gtksourceview4 \ - tepl \ -" - -inherit gnomebase gsettings itstool gnome-help gobject-introspection gtk-doc vala gettext features_check mime-xdg python3targetconfig - -def gnome_verdir(v): - return oe.utils.trim_version(v, 1) - -SRC_URI[archive.sha256sum] = "3c6229111f0ac066ae44964920791d1265f5bbb56b0bd949a69b7b1261fc8fca" - -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -GIR_MESON_OPTION = "" - -GTKDOC_MESON_OPTION = "gtk_doc" - -PACKAGES += "${PN}-python" - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/metainfo \ -" - -FILES:${PN}-python += " \ - ${PYTHON_SITEPACKAGES_DIR} \ -" - -RDEPENDS:${PN} += "gsettings-desktop-schemas" -RRECOMMENDS:${PN} += "source-code-pro-fonts" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gedit/gedit_43.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gedit/gedit_43.2.bb new file mode 100644 index 0000000000..1c1803d5e7 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gedit/gedit_43.2.bb @@ -0,0 +1,46 @@ +SUMMARY = "GNOME editor" +SECTION = "x11/gnome" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=75859989545e37968a99b631ef42722e" + +GNOMEBASEBUILDCLASS = "meson" + +DEPENDS = " \ + gdk-pixbuf-native \ + gtk+3 \ + gsettings-desktop-schemas \ + libpeas \ + libsoup \ + gspell \ + gtksourceview4 \ + tepl \ +" + +inherit gnomebase gsettings itstool gnome-help gobject-introspection gtk-doc vala gettext features_check mime-xdg python3targetconfig + +def gnome_verdir(v): + return oe.utils.trim_version(v, 1) + +SRC_URI[archive.sha256sum] = "f950d2d35c594bb6c8dbc9f5440cad7788ca0a8688e2b07846f83de9a4e3fc25" + +# gobject-introspection is mandatory and cannot be configured +REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" + +GIR_MESON_OPTION = "" + +GTKDOC_MESON_OPTION = "gtk_doc" + +PACKAGES += "${PN}-python" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/metainfo \ +" + +FILES:${PN}-python += " \ + ${PYTHON_SITEPACKAGES_DIR} \ +" + +RDEPENDS:${PN} += "gsettings-desktop-schemas" +RRECOMMENDS:${PN} += "source-code-pro-fonts" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/geocode-glib/geocode-glib_3.26.4.bb b/meta-openembedded/meta-gnome/recipes-gnome/geocode-glib/geocode-glib_3.26.4.bb index 2b1ecad97c..42659d0f61 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/geocode-glib/geocode-glib_3.26.4.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/geocode-glib/geocode-glib_3.26.4.bb @@ -11,9 +11,9 @@ inherit gnomebase gobject-introspection gettext gtk-doc upstream-version-is-even DEPENDS = " \ json-glib \ - libsoup-2.4 \ + libsoup-3.0 \ " SRC_URI[archive.sha256sum] = "2d9a6826d158470449a173871221596da0f83ebdcff98b90c7049089056a37aa" -EXTRA_OEMESON = "-Denable-installed-tests=false" +EXTRA_OEMESON = "-Denable-installed-tests=false -Dsoup2=false" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph/0001-Update-rest-requirement-to-rest-1.0.patch b/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph/0001-Update-rest-requirement-to-rest-1.0.patch deleted file mode 100644 index 21c623ea5b..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph/0001-Update-rest-requirement-to-rest-1.0.patch +++ /dev/null @@ -1,58 +0,0 @@ -From d058e6eb6c9ebf5f4fff89ec0ac93323fc64c1ba Mon Sep 17 00:00:00 2001 -From: Tim Orling -Date: Mon, 18 Oct 2021 08:42:35 -0700 -Subject: [PATCH] Update rest requirement to rest-1.0 - -librest 0.8.1 declares rest-1.0 and was released four years ago. - -https://gitlab.gnome.org/GNOME/librest/-/commit/2971b3b92701f70fc368ad64bd25cefaea043f87 - -Upstream-Status: Submitted -[https://gitlab.gnome.org/GNOME/libgfbgraph/-/merge_requests/6] - -Signed-off-by: Tim Orling - ---- - configure.ac | 2 +- - gfbgraph/Makefile.am | 2 +- - libgfbgraph.pc.in | 2 +- - 4 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/configure.ac b/configure.ac -index fd1231f..9b49f3f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -40,7 +40,7 @@ AM_CONDITIONAL([ENABLE_GTK_DOC], false) - - GOBJECT_INTROSPECTION_CHECK([1.30.0]) - --PKG_CHECK_MODULES(LIBGFBGRAPH, [glib-2.0 gio-2.0 gobject-2.0 rest-0.7 json-glib-1.0]) -+PKG_CHECK_MODULES(LIBGFBGRAPH, [glib-2.0 gio-2.0 gobject-2.0 rest-1.0 json-glib-1.0]) - - PKG_CHECK_MODULES(SOUP, [libsoup-2.4]) - SOUP_UNSTABLE_CPPFLAGS=-DLIBSOUP_USE_UNSTABLE_REQUEST_API -diff --git a/gfbgraph/Makefile.am b/gfbgraph/Makefile.am -index d07b90d..b993ab7 100644 ---- a/gfbgraph/Makefile.am -+++ b/gfbgraph/Makefile.am -@@ -60,7 +60,7 @@ GFBGraph_@API_MAJOR@_@API_MINOR@_gir_INCLUDES = \ - GLib-2.0 \ - Gio-2.0 \ - GObject-2.0 \ -- Rest-0.7 \ -+ Rest-1.0 \ - Json-1.0 \ - Soup-2.4 - -diff --git a/libgfbgraph.pc.in b/libgfbgraph.pc.in -index f87073e..d4f4e3a 100644 ---- a/libgfbgraph.pc.in -+++ b/libgfbgraph.pc.in -@@ -9,6 +9,6 @@ apiversion=@API_VERSION@ - Name: libgfbgraph - Description: GObject library for Facebook Graph API - Version: @VERSION@ --Requires: gio-2.0 glib-2.0 goa-1.0 json-glib-1.0 libsoup-2.4 rest-0.7 -+Requires: gio-2.0 glib-2.0 goa-1.0 json-glib-1.0 libsoup-2.4 rest-1.0 - Libs: -L${libdir} -lgfbgraph-${apiversion} - Cflags: -I${includedir}/gfbgraph-@API_VERSION@ diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph_0.2.5.bb b/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph_0.2.5.bb index f3b54e7d05..faeaa8ccb9 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph_0.2.5.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph_0.2.5.bb @@ -6,7 +6,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5804fe91d3294da4ac47c02b454bbc8a" DEPENDS = " \ glib-2.0 \ json-glib \ - rest \ + librest \ + libsoup-2.4 \ gnome-online-accounts \ " @@ -15,7 +16,7 @@ inherit gnomebase gtk-doc gobject-introspection pkgconfig features_check # for gnome-online-accounts REQUIRED_DISTRO_FEATURES = "x11" -SRC_URI += " file://0001-Update-rest-requirement-to-rest-1.0.patch" +#SRC_URI += " file://0001-Update-rest-requirement-to-rest-1.0.patch" SRC_URI[archive.sha256sum] = "9cb381b3f78ba1136df97af3f06e3b11dcc2ab339ac08f74eda0f8057d6603e3" do_install:append() { diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.72.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.72.2.bb deleted file mode 100644 index 3170341560..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.72.2.bb +++ /dev/null @@ -1,40 +0,0 @@ -SUMMARY = "Javascript bindings for GNOME" -LICENSE = "MIT & LGPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=8dcea832f6acf45d856abfeb2d51ec48" - -GNOMEBASEBUILDCLASS = "meson" - -DEPENDS = "mozjs-91 cairo" - -inherit gnomebase gsettings gobject-introspection vala gettext features_check upstream-version-is-even pkgconfig - -SRC_URI[archive.sha256sum] = "ddee379bdc5a7d303a5d894be2b281beb8ac54508604e7d3f20781a869da3977" -SRC_URI += " \ - file://0001-Support-cross-builds-a-bit-better.patch \ - file://0002-meson.build-Do-not-add-dir-installed-tests-when-inst.patch \ -" - -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" -GIR_MESON_OPTION = "" - -EXTRA_OEMESON = " \ - -Dinstalled_tests=false \ - -Dskip_dbus_tests=true \ - -Dskip_gtk_tests=true \ -" - -LDFLAGS:append:mipsarch = " -latomic" -LDFLAGS:append:powerpc = " -latomic" -LDFLAGS:append:powerpc64 = " -latomic" -LDFLAGS:append:riscv32 = " -latomic" - -FILES:${PN} += "${datadir}/gjs-1.0/lsan" - -PACKAGES =+ "${PN}-valgrind" -FILES:${PN}-valgrind = "${datadir}/gjs-1.0/valgrind" -RDEPENDS:${PN}-valgrind += "valgrind" - -# Valgrind not yet available on rv32/rv64 -RDEPENDS:${PN}-valgrind:remove:riscv32 = "valgrind" -RDEPENDS:${PN}-valgrind:remove:riscv64 = "valgrind" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.75.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.75.1.bb new file mode 100644 index 0000000000..b2c2b583b0 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.75.1.bb @@ -0,0 +1,40 @@ +SUMMARY = "Javascript bindings for GNOME" +LICENSE = "MIT & LGPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=8dcea832f6acf45d856abfeb2d51ec48" + +GNOMEBASEBUILDCLASS = "meson" + +DEPENDS = "mozjs-102 cairo" + +inherit gnomebase gsettings gobject-introspection vala gettext features_check upstream-version-is-even pkgconfig + +SRC_URI[archive.sha256sum] = "81dcdf49d2665d08fa7e251700ea36466d77877418e9186d3a7e7efcd31aa960" +SRC_URI += " \ + file://0001-Support-cross-builds-a-bit-better.patch \ + file://0002-meson.build-Do-not-add-dir-installed-tests-when-inst.patch \ +" + +# gobject-introspection is mandatory and cannot be configured +REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" +GIR_MESON_OPTION = "" + +EXTRA_OEMESON = " \ + -Dinstalled_tests=false \ + -Dskip_dbus_tests=true \ + -Dskip_gtk_tests=true \ +" + +LDFLAGS:append:mipsarch = " -latomic" +LDFLAGS:append:powerpc = " -latomic" +LDFLAGS:append:powerpc64 = " -latomic" +LDFLAGS:append:riscv32 = " -latomic" + +FILES:${PN} += "${datadir}/gjs-1.0/lsan" + +PACKAGES =+ "${PN}-valgrind" +FILES:${PN}-valgrind = "${datadir}/gjs-1.0/valgrind" +RDEPENDS:${PN}-valgrind += "valgrind" + +# Valgrind not yet available on rv32/rv64 +RDEPENDS:${PN}-valgrind:remove:riscv32 = "valgrind" +RDEPENDS:${PN}-valgrind:remove:riscv64 = "valgrind" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-backgrounds/gnome-backgrounds_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-backgrounds/gnome-backgrounds_42.0.bb deleted file mode 100644 index d700c1bcb0..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-backgrounds/gnome-backgrounds_42.0.bb +++ /dev/null @@ -1,16 +0,0 @@ -SUMMARY = "GNOME wallpapers" -LICENSE = "CC-BY-SA-3.0" -LIC_FILES_CHKSUM = "file://COPYING;md5=b52fb0a6df395efb7047cb6fc56bfd7e" - -SECTION = "x11/gnome" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gettext allarch - -SRC_URI[archive.sha256sum] = "4c7fe1a09f459c5f77189a5982524fce05d888944955d679910f234606c1295d" - -FILES:${PN} += " \ - ${datadir}/backgrounds \ - ${datadir}/gnome-background-properties \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-backgrounds/gnome-backgrounds_43.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-backgrounds/gnome-backgrounds_43.bb new file mode 100644 index 0000000000..9f94378d8c --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-backgrounds/gnome-backgrounds_43.bb @@ -0,0 +1,16 @@ +SUMMARY = "GNOME wallpapers" +LICENSE = "CC-BY-SA-3.0" +LIC_FILES_CHKSUM = "file://COPYING;md5=b52fb0a6df395efb7047cb6fc56bfd7e" + +SECTION = "x11/gnome" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gettext allarch + +SRC_URI[archive.sha256sum] = "19f749d8c37f872f155bb69a2bbe7aca381175e6929f1998047d775cbc637244" + +FILES:${PN} += " \ + ${datadir}/backgrounds \ + ${datadir}/gnome-background-properties \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-bluetooth/gnome-bluetooth_42.4.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-bluetooth/gnome-bluetooth_42.4.bb deleted file mode 100644 index 75e1244f8f..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-bluetooth/gnome-bluetooth_42.4.bb +++ /dev/null @@ -1,44 +0,0 @@ -SUMMARY = "GNOME bluetooth manager" -LICENSE = "GPL-2.0-only & LGPL-2.1-only" -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=eb723b61539feef013de476e68b5c50a \ - file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \ -" - -SECTION = "x11/gnome" - -DEPENDS = " \ - udev \ - libnotify \ - libcanberra \ - bluez5 \ - upower \ - gtk4 \ - gsound \ - libadwaita \ -" - -GNOMEBASEBUILDCLASS = "meson" -GTKDOC_MESON_OPTION = "gtk_doc" -GTKIC_VERSION = "4" - -inherit features_check gnomebase gtk-icon-cache gtk-doc gobject-introspection - -REQUIRED_DISTRO_FEATURES = "x11" - -SRC_URI[archive.sha256sum] = "1d6fcf1cdb6cc9923ab334a2c0bc37a2c1bba9d18de153d484eedc04f3c0bcdc" - -BT_PULSE_PACKS = " \ - pulseaudio-lib-bluez5-util \ - pulseaudio-module-bluetooth-discover \ - pulseaudio-module-bluetooth-policy \ - pulseaudio-module-bluez5-device \ - pulseaudio-module-bluez5-discover \ -" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)}" -PACKAGECONFIG[pulseaudio] = ",,,${BT_PULSE_PACKS}" - -FILES:${PN} += "${datadir}/gnome-bluetooth-3.0" - -RDEPENDS:${PN} += "bluez5" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-bluetooth/gnome-bluetooth_42.5.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-bluetooth/gnome-bluetooth_42.5.bb new file mode 100644 index 0000000000..fa4f9cb78f --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-bluetooth/gnome-bluetooth_42.5.bb @@ -0,0 +1,44 @@ +SUMMARY = "GNOME bluetooth manager" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=eb723b61539feef013de476e68b5c50a \ + file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \ +" + +SECTION = "x11/gnome" + +DEPENDS = " \ + udev \ + libnotify \ + libcanberra \ + bluez5 \ + upower \ + gtk4 \ + gsound \ + libadwaita \ +" + +GNOMEBASEBUILDCLASS = "meson" +GTKDOC_MESON_OPTION = "gtk_doc" +GTKIC_VERSION = "4" + +inherit features_check gnomebase gtk-icon-cache gtk-doc gobject-introspection + +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +SRC_URI[archive.sha256sum] = "a4f5f1ac2dbb7b7b92f7d6d2b42c030f62aed9b5426b9dc116946041f3cba8f7" + +BT_PULSE_PACKS = " \ + pulseaudio-lib-bluez5-util \ + pulseaudio-module-bluetooth-discover \ + pulseaudio-module-bluetooth-policy \ + pulseaudio-module-bluez5-device \ + pulseaudio-module-bluez5-discover \ +" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)}" +PACKAGECONFIG[pulseaudio] = ",,,${BT_PULSE_PACKS}" + +FILES:${PN} += "${datadir}/gnome-bluetooth-3.0" + +RDEPENDS:${PN} += "bluez5" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calculator/gnome-calculator_42.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calculator/gnome-calculator_42.2.bb deleted file mode 100644 index 31513a5f61..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calculator/gnome-calculator_42.2.bb +++ /dev/null @@ -1,37 +0,0 @@ -SUMMARY = "GNOME calculator" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -SECTION = "x11/gnome" - -DEPENDS = " \ - yelp-tools-native \ - gtk4 \ - libsoup-2.4 \ - libgee \ - libmpc \ - gtksourceview5 \ - libadwaita \ -" - -GIR_MESON_OPTION = 'disable-introspection' -GIR_MESON_ENABLE_FLAG = 'false' -GIR_MESON_DISABLE_FLAG = 'true' - -GNOMEBASEBUILDCLASS = "meson" -GTKIC_VERSION = '4' - -inherit gnomebase gobject-introspection gnome-help vala gtk-icon-cache gettext features_check - -def gnome_verdir(v): - return oe.utils.trim_version(v, 1) - -REQUIRED_DISTRO_FEATURES = "x11" - -SRC_URI[archive.sha256sum] = "33dab1bca43658d66520958b0f674cb0ad3185cfd30c12e459e7f69481c5c6a0" - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/metainfo \ - ${datadir}/gnome-shell \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calculator/gnome-calculator_43.0.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calculator/gnome-calculator_43.0.1.bb new file mode 100644 index 0000000000..3459b6d5f0 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calculator/gnome-calculator_43.0.1.bb @@ -0,0 +1,38 @@ +SUMMARY = "GNOME calculator" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +SECTION = "x11/gnome" + +DEPENDS = " \ + yelp-tools-native \ + gtk4 \ + libsoup-3.0 \ + libgee \ + libxml2 \ + libmpc \ + gtksourceview5 \ + libadwaita \ +" + +GIR_MESON_OPTION = 'disable-introspection' +GIR_MESON_ENABLE_FLAG = 'false' +GIR_MESON_DISABLE_FLAG = 'true' + +GNOMEBASEBUILDCLASS = "meson" +GTKIC_VERSION = '4' + +inherit gnomebase gobject-introspection gnome-help vala gtk-icon-cache gettext features_check + +def gnome_verdir(v): + return oe.utils.trim_version(v, 1) + +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +SRC_URI[archive.sha256sum] = "02c12ded3cf5053d17537d95ec69587f4b919899d7726eceecdb4b47ffb1c90f" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/metainfo \ + ${datadir}/gnome-shell \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_42.0.bb deleted file mode 100644 index 7b32be611d..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_42.0.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "GNOME calendar" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=8f0e2cd40e05189ec81232da84bd6e1a" - -SECTION = "x11/gnome" - -DEPENDS = " \ - gtk4 \ - libical \ - gsettings-desktop-schemas \ - evolution-data-server \ - libsoup-2.4 \ - libdazzle \ - libadwaita \ - libgweather4 \ - geoclue \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gtk-icon-cache gettext features_check upstream-version-is-even mime-xdg - -REQUIRED_DISTRO_FEATURES = "x11" - -SRC_URI[archive.sha256sum] = "b63f73f55032fc1390442f94cdf6b3cab9c91c774ddd2e5c61ecfec9d2c5e9aa" - -FILES:${PN} += " \ - ${datadir}/gnome-shell \ - ${datadir}/metainfo \ - ${datadir}/dbus-1 \ -" - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_43.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_43.1.bb new file mode 100644 index 0000000000..06e06e9bd3 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_43.1.bb @@ -0,0 +1,33 @@ +SUMMARY = "GNOME calendar" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=8f0e2cd40e05189ec81232da84bd6e1a" + +SECTION = "x11/gnome" + +DEPENDS = " \ + gtk4 \ + libical \ + gsettings-desktop-schemas \ + evolution-data-server \ + libsoup \ + libdazzle \ + libadwaita \ + libgweather4 \ + geoclue \ + geocode-glib \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gsettings gtk-icon-cache gettext features_check upstream-version-is-even mime-xdg + +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +SRC_URI[archive.sha256sum] = "afa5fc66e2f691553cc7d517db2363cff2d62cd1b5df455e5f4f7133139d21f2" + +FILES:${PN} += " \ + ${datadir}/gnome-shell \ + ${datadir}/metainfo \ + ${datadir}/dbus-1 \ +" + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center/0001-Add-meson-option-to-pass-sysroot.patch b/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center/0001-Add-meson-option-to-pass-sysroot.patch index 768ba54390..11ad30eda6 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center/0001-Add-meson-option-to-pass-sysroot.patch +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center/0001-Add-meson-option-to-pass-sysroot.patch @@ -42,4 +42,3 @@ index 3634c47..459ccfe 100644 -- 2.34.1 - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center_42.0.bb deleted file mode 100644 index 6fe999a191..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center_42.0.bb +++ /dev/null @@ -1,61 +0,0 @@ -SUMMARY = "GNOME Settings" -DESCRIPTION = "GNOME Settings is GNOME's main interface for configuration of various aspects of your desktop" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=75859989545e37968a99b631ef42722e" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gettext vala upstream-version-is-even bash-completion features_check - -DEPENDS = " \ - gdk-pixbuf-native \ - colord-gtk \ - udisks2 \ - upower \ - polkit \ - pulseaudio \ - accountsservice \ - samba \ - gsettings-desktop-schemas \ - gnome-settings-daemon \ - gnome-desktop \ - gnome-online-accounts \ - libnma \ - gnome-bluetooth \ - grilo \ - libgtop \ - gsound \ - libpwquality \ - libadwaita \ -" - -REQUIRED_DISTRO_FEATURES += "polkit pulseaudio systemd x11" - -SRC_URI[archive.sha256sum] = "0732efa7c4171ce0a0ed4106580b4ce35a57b10152c0ea36d239134913777eda" -SRC_URI += "file://0001-Add-meson-option-to-pass-sysroot.patch" - -PACKAGECONFIG ??= "ibus ${@bb.utils.filter('DISTRO_FEATURES', 'wayland', d)}" -PACKAGECONFIG[ibus] = "-Dibus=true, -Dibus=false, ibus" -PACKAGECONFIG[wayland] = "-Dwayland=true, -Dwayland=false, wayland" - -EXTRA_OEMESON = " \ - -Doe_sysroot=${STAGING_DIR_HOST} \ -" - -do_install:append() { - # If polkit is setup fixup permissions and ownership - if [ -d ${D}${datadir}/polkit-1/rules.d ]; then - chmod 700 ${D}${datadir}/polkit-1/rules.d - chown polkitd:root ${D}${datadir}/polkit-1/rules.d - fi -} - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/gnome-shell \ - ${datadir}/metainfo \ -" - -FILES:${PN}-dev += "${datadir}/gettext" - -RDEPENDS:${PN} += "gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center_43.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center_43.2.bb new file mode 100644 index 0000000000..830f3ec684 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-control-center/gnome-control-center_43.2.bb @@ -0,0 +1,68 @@ +SUMMARY = "GNOME Settings" +DESCRIPTION = "GNOME Settings is GNOME's main interface for configuration of various aspects of your desktop" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=75859989545e37968a99b631ef42722e" + +GNOMEBASEBUILDCLASS = "meson" +GTKIC_VERSION = "4" + +DEPENDS = " \ + accountsservice \ + colord-gtk \ + gcr3 \ + gdk-pixbuf \ + glib-2.0 \ + gnome-bluetooth \ + gnome-desktop \ + gnome-online-accounts \ + gnome-settings-daemon \ + gsettings-desktop-schemas \ + gtk4 \ + libadwaita \ + libepoxy \ + libgtop \ + libgudev \ + libnma \ + libpwquality \ + libxml2 \ + polkit \ + pulseaudio \ + samba \ + udisks2 \ + upower \ +" + +inherit gtk-icon-cache pkgconfig gnomebase gsettings gettext upstream-version-is-even bash-completion features_check useradd + +REQUIRED_DISTRO_FEATURES += "opengl polkit pulseaudio systemd x11" + +SRC_URI += "file://0001-Add-meson-option-to-pass-sysroot.patch" +SRC_URI[archive.sha256sum] = "d7f256aba80a92c727b329fd01c8602da4b78f0fddaec93fcd91096964700563" + +PACKAGECONFIG ??= "ibus ${@bb.utils.filter('DISTRO_FEATURES', 'wayland', d)}" +PACKAGECONFIG[ibus] = "-Dibus=true, -Dibus=false, ibus" +PACKAGECONFIG[wayland] = "-Dwayland=true, -Dwayland=false, wayland" + +EXTRA_OEMESON = " \ + -Doe_sysroot=${STAGING_DIR_HOST} \ +" + +USERADD_PACKAGES = "${PN}" +USERADD_PARAM:${PN} = "--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd" + +do_install:append() { + if [ -d ${D}${datadir}/polkit-1/rules.d ]; then + chmod 700 ${D}${datadir}/polkit-1/rules.d + chown polkitd:root ${D}${datadir}/polkit-1/rules.d + fi +} + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/gnome-shell \ + ${datadir}/metainfo \ +" + +FILES:${PN}-dev += "${datadir}/gettext" + +RDEPENDS:${PN} += "gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop/0001-meson.build-Disable-libseccomp-for-all-archs.patch b/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop/0001-meson.build-Disable-libseccomp-for-all-archs.patch deleted file mode 100644 index 8ae1d82b6a..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop/0001-meson.build-Disable-libseccomp-for-all-archs.patch +++ /dev/null @@ -1,40 +0,0 @@ -From de0d33b068a5d8e61cc0c82d88d15b9a8aa97977 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andreas=20M=C3=BCller?= -Date: Sat, 6 Apr 2019 18:07:17 +0200 -Subject: [PATCH] meson.build: Disable libseccomp for all archs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It does not seem mandatory and can cause unsatisfied dependency [1]. - -[1] https://errors.yoctoproject.org/Errors/Details/235565/ - -Upstream-Status: Inappropriate [configuration] - -Signed-off-by: Andreas Müller ---- - meson.build | 7 +------ - 1 file changed, 1 insertion(+), 6 deletions(-) - -diff --git a/meson.build b/meson.build -index 1dc8a73..87d72fe 100644 ---- a/meson.build -+++ b/meson.build -@@ -65,12 +65,7 @@ udev_dep = dependency('libudev', required: get_option('udev')) - host_os = host_machine.system() - host_cpu = host_machine.cpu() - supported_os = ['linux'] --unsupported_cpus = ['alpha', 'ia64', 'm68k', 'sh4', 'sparc', 'sparc64'] --if supported_os.contains(host_os) and not unsupported_cpus.contains(host_cpu) -- seccomp_dep = dependency('libseccomp') --else -- seccomp_dep = dependency('', required: false) --endif -+seccomp_dep = dependency('', required: false) - - fontconfig_cache_path = fontconfig_dep.get_variable(pkgconfig: 'cachedir') - xkb_base = xkb_config_dep.get_variable(pkgconfig: 'xkb_base') --- -2.34.1 - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop_42.0.bb deleted file mode 100644 index aae927a70b..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop_42.0.bb +++ /dev/null @@ -1,47 +0,0 @@ -SUMMARY = "GNOME library for reading .desktop files" -SECTION = "x11/gnome" -LICENSE = "GPL-2.0-only & LGPL-2.0-only" -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.LIB;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase itstool pkgconfig upstream-version-is-even gobject-introspection features_check gtk-doc - -REQUIRED_DISTRO_FEATURES = "x11" -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES += "gobject-introspection-data" - -GIR_MESON_OPTION = "" - -SRC_URI[archive.sha256sum] = "f3caa293a5e86f6ccad18f817273db1c67061e680d79d839aa8a7528e5bb26d6" -SRC_URI += " \ - file://gnome-desktop-thumbnail-don-t-assume-time_t-is-long.patch \ - file://0001-meson.build-Disable-libseccomp-for-all-archs.patch \ -" - -DEPENDS += " \ - gsettings-desktop-schemas \ - virtual/libx11 \ - gtk+3 \ - gtk4 \ - startup-notification \ - xkeyboard-config \ - iso-codes \ - udev \ -" - -GTKDOC_MESON_OPTION = "gtk_doc" -EXTRA_OEMESON = "-Ddesktop_docs=false" - -PACKAGES =+ "libgnome-desktop" -RDEPENDS:${PN} += "libgnome-desktop" -FILES:libgnome-desktop = " \ - ${libdir}/lib*${SOLIBS} \ - ${datadir}/libgnome-desktop*/pnp.ids \ - ${datadir}/gnome/*xml \ -" - -RRECOMMENDS:libgnome-desktop += "gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop_43.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop_43.bb new file mode 100644 index 0000000000..7695056eaa --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-desktop/gnome-desktop_43.bb @@ -0,0 +1,48 @@ +SUMMARY = "GNOME library for reading .desktop files" +SECTION = "x11/gnome" +LICENSE = "GPL-2.0-only & LGPL-2.0-only" +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.LIB;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase itstool pkgconfig upstream-version-is-even gobject-introspection features_check gtk-doc + +REQUIRED_DISTRO_FEATURES = "x11 opengl" +# gobject-introspection is mandatory and cannot be configured +REQUIRED_DISTRO_FEATURES += "gobject-introspection-data" + +GIR_MESON_OPTION = "" + +SRC_URI += "file://gnome-desktop-thumbnail-don-t-assume-time_t-is-long.patch" +SRC_URI[archive.sha256sum] = "3d6e153317486157596aa3802f87676414c570738f450a94a041fe8835420a69" + +DEPENDS += " \ + fontconfig \ + gdk-pixbuf \ + glib-2.0 \ + gsettings-desktop-schemas \ + gtk+3 \ + gtk4 \ + iso-codes \ + xext \ + libseccomp \ + libxkbcommon \ + xkeyboard-config \ + xrandr \ +" + +GTKDOC_MESON_OPTION = "gtk_doc" +EXTRA_OEMESON = "-Ddesktop_docs=false" + +PACKAGES =+ "libgnome-desktop" +RDEPENDS:${PN} += "libgnome-desktop" +FILES:libgnome-desktop = " \ + ${libdir}/lib*${SOLIBS} \ + ${datadir}/libgnome-desktop*/pnp.ids \ + ${datadir}/gnome/*xml \ +" + +RRECOMMENDS:libgnome-desktop += "gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-disk-utility/gnome-disk-utility_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-disk-utility/gnome-disk-utility_42.0.bb deleted file mode 100644 index c3789b0c1a..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-disk-utility/gnome-disk-utility_42.0.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "GNOME disk utility" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -SECTION = "x11/gnome" - -DEPENDS = " \ - gtk+3 \ - libdvdread \ - libnotify \ - libsecret \ - libpwquality \ - udisks2 \ - libhandy \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gtk-icon-cache gettext features_check mime-xdg - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" -REQUIRED_DISTRO_FEATURES = "polkit" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)}" - -# As soon as elogind is of interest this needs rework: meson option is combo -PACKAGECONFIG[systemd] = "-Dlogind=libsystemd,-Dlogind=none,systemd" -PACKAGECONFIG[x11] = ",,libcanberra" - -SRC_URI:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'file://0001-gnome-disk-utility-remove-libcanberra-dependency.patch', '', d)}" -SRC_URI[archive.sha256sum] = "1b6564454d67426322cb3bfc5a5558653bfc7dfeea2ae0825b1d08629f01090b" - -EXTRA_OEMESON = "-Dman=false" - -FILES:${PN} += " \ - ${datadir}/metainfo \ - ${datadir}/dbus-1 \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-disk-utility/gnome-disk-utility_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-disk-utility/gnome-disk-utility_43.0.bb new file mode 100644 index 0000000000..247bf141c5 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-disk-utility/gnome-disk-utility_43.0.bb @@ -0,0 +1,40 @@ +SUMMARY = "GNOME disk utility" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +SECTION = "x11/gnome" + +DEPENDS = " \ + desktop-file-utils-native \ + gtk+3 \ + libdvdread \ + libnotify \ + libsecret \ + libpwquality \ + udisks2 \ + libhandy \ + xz \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gsettings gtk-icon-cache gettext features_check mime-xdg + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" +REQUIRED_DISTRO_FEATURES = "polkit" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)}" + +# As soon as elogind is of interest this needs rework: meson option is combo +PACKAGECONFIG[systemd] = "-Dlogind=libsystemd,-Dlogind=none,systemd" +PACKAGECONFIG[x11] = ",,libcanberra" + +SRC_URI:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'file://0001-gnome-disk-utility-remove-libcanberra-dependency.patch', '', d)}" +SRC_URI[archive.sha256sum] = "7afca9805a6b92db6933dd7efcec4af8386c01bbc1f871e2dae4def7e192a2c5" + +EXTRA_OEMESON = "-Dman=false" + +FILES:${PN} += " \ + ${datadir}/metainfo \ + ${datadir}/dbus-1 \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-flashback/gnome-flashback_3.44.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-flashback/gnome-flashback_3.44.0.bb deleted file mode 100644 index 1e357af875..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-flashback/gnome-flashback_3.44.0.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "GNOME Flashback (GNOME 2) session" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -inherit gnomebase gsettings gtk-icon-cache gettext upstream-version-is-even features_check - -REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam" - -DEPENDS += " \ - upower \ - ibus \ - libxkbfile \ - polkit \ - metacity \ - gdm \ - gnome-desktop \ - gnome-bluetooth3 \ - gnome-panel \ -" - -SRC_URI[archive.sha256sum] = "1df0838127c6246eecd89d1c50ff88fc82abf6de3b3068e52dde495a42bd550a" - -do_install:append() { - # no oe-layer has compiz -> remove dead session - rm -f ${D}${datadir}/xsessions/gnome-flashback-compiz.desktop -} - -FILES:${PN} += " \ - ${datadir}/desktop-directories \ - ${datadir}/gnome-control-center \ - ${datadir}/gnome-panel \ - ${datadir}/gnome-session \ - ${datadir}/xsessions \ - ${libdir}/gnome-panel \ - ${systemd_user_unitdir} \ -" - -RDEPENDS:${PN} += "metacity" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-flashback/gnome-flashback_3.46.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-flashback/gnome-flashback_3.46.0.bb new file mode 100644 index 0000000000..597cdbab95 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-flashback/gnome-flashback_3.46.0.bb @@ -0,0 +1,38 @@ +SUMMARY = "GNOME Flashback (GNOME 2) session" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +inherit gnomebase gsettings gtk-icon-cache gettext upstream-version-is-even features_check + +REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam" + +DEPENDS += " \ + upower \ + ibus \ + libxkbfile \ + polkit \ + metacity \ + gdm \ + gnome-desktop \ + gnome-bluetooth \ + gnome-panel \ +" + +SRC_URI[archive.sha256sum] = "7a8d5c03310e4dfadd18a65e00a37741032afeea5418dd6804a975c4b0980045" + +do_install:append() { + # no oe-layer has compiz -> remove dead session + rm -f ${D}${datadir}/xsessions/gnome-flashback-compiz.desktop +} + +FILES:${PN} += " \ + ${datadir}/desktop-directories \ + ${datadir}/gnome-control-center \ + ${datadir}/gnome-panel \ + ${datadir}/gnome-session \ + ${datadir}/xsessions \ + ${libdir}/gnome-panel \ + ${systemd_user_unitdir} \ +" + +RDEPENDS:${PN} += "metacity" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-font-viewer/gnome-font-viewer_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-font-viewer/gnome-font-viewer_43.0.bb index 50fd034af5..130c26924d 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-font-viewer/gnome-font-viewer_43.0.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-font-viewer/gnome-font-viewer_43.0.bb @@ -14,7 +14,7 @@ GNOMEBASEBUILDCLASS = "meson" inherit gnomebase gtk-icon-cache gettext features_check mime-xdg -REQUIRED_DISTRO_FEATURES = "x11" +REQUIRED_DISTRO_FEATURES = "x11 opengl" SRC_URI[archive.sha256sum] = "81c6bffb06d5332346e00eaecaec1bdcfd617c51dfd95bcd058d6c76c76dd2b9" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-keyring/gnome-keyring_42.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-keyring/gnome-keyring_42.1.bb index 5937e74423..241a94cd70 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-keyring/gnome-keyring_42.1.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-keyring/gnome-keyring_42.1.bb @@ -12,7 +12,7 @@ LIC_FILES_CHKSUM = " \ DEPENDS = " \ glib-2.0-native \ gtk+3 \ - gcr \ + gcr3 \ libgcrypt \ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)} \ " diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts/0001-build-Use-the-appropriate-dependency-object.patch b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts/0001-build-Use-the-appropriate-dependency-object.patch new file mode 100644 index 0000000000..838ca1a7d4 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts/0001-build-Use-the-appropriate-dependency-object.patch @@ -0,0 +1,35 @@ +From 06240574626eb21af37cf7dde5bf81e892dff467 Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Wed, 5 Oct 2022 22:15:37 +0100 +Subject: [PATCH] build: Use the appropriate dependency object + +Just using `link_with` will not ensure that the GOA web extension shared +module is properly built against libgoa-backend and libgoa; the +generated headers must be transitively available by the time we build +the shared module. + +Fixes: #226 +Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/commit/fe86bfb0271735c8130367c46536b08dad5c20d8] +Signed-off-by: Khem Raj +--- + src/goabackend/meson.build | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/goabackend/meson.build b/src/goabackend/meson.build +index f5382b3..865b2d2 100644 +--- a/src/goabackend/meson.build ++++ b/src/goabackend/meson.build +@@ -157,9 +157,8 @@ libgoa_web_extension = shared_module( + 'goawebextension', + libgoawebextension_sources, + include_directories: common_incs + [goa_inc], +- dependencies: deps, ++ dependencies: [deps, libgoa_backend_dep], + c_args: cflags, +- link_with: libgoa_backend, + install: true, + install_dir: join_paths(goa_pkglibdir, 'web-extensions') + ) +-- +2.39.0 + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts_3.46.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts_3.46.0.bb index 0603a2d89b..ce02a507da 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts_3.46.0.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts_3.46.0.bb @@ -8,12 +8,13 @@ inherit gnomebase gsettings gobject-introspection gtk-icon-cache vala features_c DEPENDS = "gtk+3 gtk+3-native gdk-pixbuf dbus json-glib libxml2 webkitgtk glib-2.0 rest libsecret" +SRC_URI += "file://0001-build-Use-the-appropriate-dependency-object.patch" SRC_URI[archive.sha256sum] = "5e7859ce4858a6b99d3995ed70527d66e297bb90bbf75ec8780fe9da22c1fcaa" PACKAGECONFIG_SOUP ?= "soup3" PACKAGECONFIG ?= "kerberos owncloud lastfm google windows_live ${PACKAGECONFIG_SOUP}" -PACKAGECONFIG[kerberos] = "-Dkerberos=true, -Dkerberos=false,krb5 gcr" +PACKAGECONFIG[kerberos] = "-Dkerberos=true, -Dkerberos=false,krb5 gcr3" PACKAGECONFIG[exchange] = "-Dexchange=true, -Dexchange=false" PACKAGECONFIG[google] = "-Dgoogle=true, -Dgoogle=false" PACKAGECONFIG[owncloud] = "-Downcloud=true, -Downcloud=false" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-panel/gnome-panel_3.44.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-panel/gnome-panel_3.44.0.bb deleted file mode 100644 index 67bdf58f81..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-panel/gnome-panel_3.44.0.bb +++ /dev/null @@ -1,24 +0,0 @@ -SUMMARY = "GNOME flashback panel" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -inherit gnomebase gsettings itstool gnome-help gtk-icon-cache gtk-doc gettext upstream-version-is-even features_check - -REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam" - -DEPENDS += " \ - yelp-tools-native \ - libwnck3 \ - polkit \ - dconf \ - libgweather4 \ - gnome-menus \ - gnome-desktop \ - gdm \ -" - -SRC_URI[archive.sha256sum] = "99655f75d031876c130ed23c4da22c099e7bcc4048b0255a3c3a3bbc787b31aa" - -PACKAGECONFIG[eds] = "--enable-eds,--disable-eds,evolution-data-server" - -RDEPENDS:${PN} += "gdm-base" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-panel/gnome-panel_3.47.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-panel/gnome-panel_3.47.1.bb new file mode 100644 index 0000000000..8380c51edf --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-panel/gnome-panel_3.47.1.bb @@ -0,0 +1,24 @@ +SUMMARY = "GNOME flashback panel" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +inherit gnomebase gsettings itstool gnome-help gtk-icon-cache gettext upstream-version-is-even features_check + +REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam" + +DEPENDS += " \ + yelp-tools-native \ + libwnck3 \ + polkit \ + dconf \ + libgweather4 \ + gnome-menus \ + gnome-desktop \ + gdm \ +" + +SRC_URI[archive.sha256sum] = "d8f6e2c659668c77df82c3dd95ba04fcef8c40c228e2c22605f9a17a9161ec83" + +PACKAGECONFIG[eds] = "--enable-eds,--disable-eds,evolution-data-server" + +RDEPENDS:${PN} += "gdm-base" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-photos/gnome-photos_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-photos/gnome-photos_42.0.bb deleted file mode 100644 index 5af3088e3a..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-photos/gnome-photos_42.0.bb +++ /dev/null @@ -1,46 +0,0 @@ -SUMMARY = "Access, organize and share your photos on GNOME" -SECTION = "x11/gnome" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" - -DEPENDS = " \ - glib-2.0-native \ - gdk-pixbuf-native \ - librsvg-native \ - gtk+3 \ - babl \ - gegl \ - geocode-glib \ - gnome-online-accounts \ - grilo \ - gsettings-desktop-schemas \ - libdazzle \ - libgdata \ - gfbgraph \ - tracker \ - libhandy \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gettext gnome-help features_check - -def gnome_verdir(v): - return oe.utils.trim_version(v, 1) - -REQUIRED_DISTRO_FEATURES = "x11" - -SRC_URI[archive.sha256sum] = "25cb281425199dec7b045f13f32f8f96034cb0cb8b94d96f9dffaf4f5be68551" - -do_install:append() { - # make gnome-photos available on all desktops - sed -i 's:OnlyShowIn=:#OnlyShowIn=:g' ${D}${datadir}/applications/org.gnome.Photos.desktop -} - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/metainfo \ - ${datadir}/gnome-shell \ -" - -RRECOMMENDS:${PN} = "grilo-plugins" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-photos/gnome-photos_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-photos/gnome-photos_43.0.bb new file mode 100644 index 0000000000..72ab2eaaf8 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-photos/gnome-photos_43.0.bb @@ -0,0 +1,60 @@ +SUMMARY = "Access, organize and share your photos on GNOME" +SECTION = "x11/gnome" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" + +DEPENDS = " \ + cairo \ + glib-2.0-native \ + gdk-pixbuf-native \ + librsvg-native \ + gtk+3 \ + babl \ + dbus \ + gegl \ + geocode-glib \ + gexiv2 \ + gnome-online-accounts \ + gsettings-desktop-schemas \ + libdazzle \ + tracker \ + libhandy \ + libportal \ +" + +RDEPENDS:${PN} = "tracker-miners" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gettext gnome-help features_check + +def gnome_verdir(v): + return oe.utils.trim_version(v, 1) + +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +PACKAGECONFIG ?= "" +PACKAGECONFIG[doc] = "-Dmanuals=true,-Dmanuals=false,libxslt-native docbook-xsl-stylesheets-native" + +SRC_URI[archive.sha256sum] = "c7ac7458d533f29d955011c74b76224d79ea31bcc12e9d6d0ce7b6c3704d08e1" + +do_install:append() { + # make gnome-photos available on all desktops + sed -i 's:OnlyShowIn=:#OnlyShowIn=:g' ${D}${datadir}/applications/org.gnome.Photos.desktop +} + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/metainfo \ + ${datadir}/gnome-shell \ +" + +do_compile:append() { + # glib-mkenums is embedding full paths into this file. There's no + # option to it to use a sysroot style variable. So to avoid QA + # errors, we sed WORKDIR out and make its includes relative + sed -i "s|${B}||" src/photos-enums.h + sed -i "s|${B}||" src/photos-enums.c + sed -i "s|${B}||" src/photos-enums-gegl.c + sed -i "s|${B}||" src/photos-enums-gegl.h +} diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-session/gnome-session_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-session/gnome-session_42.0.bb deleted file mode 100644 index 9407c25a55..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-session/gnome-session_42.0.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "GNOME session" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -DEPENDS = " \ - glib-2.0-native \ - libxslt-native \ - xmlto-native \ - xtrans \ - libice \ - libsm \ - virtual/libx11 \ - gtk+3 \ - gnome-desktop \ - gsettings-desktop-schemas \ - json-glib \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gettext gsettings upstream-version-is-even features_check - -REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam gobject-introspection-data" - -SRC_URI[archive.sha256sum] = "3cca06053ab682926920951a7da95f8cc6d72da74c682c46d0a0653332969caa" - -PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'consolekit',d)}" - -PACKAGECONFIG[consolekit] = "-Dconsolekit=true, -Dconsolekit=false, consolekit" -PACKAGECONFIG[systemd] = "-Dsystemd=true -Dsystemd_journal=true, -Dsystemd=false -Dsystemd_journal=false, systemd" - -FILES:${PN} += " \ - ${datadir}/xsessions \ - ${datadir}/wayland-sessions \ - ${systemd_user_unitdir} \ -" - -RDEPENDS:${PN} += "gnome-shell gnome-settings-daemon gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-session/gnome-session_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-session/gnome-session_43.0.bb new file mode 100644 index 0000000000..12f48bc823 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-session/gnome-session_43.0.bb @@ -0,0 +1,38 @@ +SUMMARY = "GNOME session" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS = " \ + glib-2.0-native \ + libxslt-native \ + xmlto-native \ + xtrans \ + libice \ + libsm \ + virtual/libx11 \ + gtk+3 \ + gnome-desktop \ + gsettings-desktop-schemas \ + json-glib \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gettext gsettings upstream-version-is-even features_check + +REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam gobject-introspection-data" + +SRC_URI[archive.sha256sum] = "3fb9949501385c8c14618e78f178d952df98ad8c91080f4c5e1568c7393ae1f2" + +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'consolekit',d)}" + +PACKAGECONFIG[consolekit] = "-Dconsolekit=true, -Dconsolekit=false, dbus-glib" +PACKAGECONFIG[systemd] = "-Dsystemd=true -Dsystemd_journal=true, -Dsystemd=false -Dsystemd_journal=false, systemd" + +FILES:${PN} += " \ + ${datadir}/xsessions \ + ${datadir}/wayland-sessions \ + ${systemd_user_unitdir} \ +" + +RDEPENDS:${PN} += "gnome-shell gnome-settings-daemon gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-settings-daemon/gnome-settings-daemon_42.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-settings-daemon/gnome-settings-daemon_42.1.bb deleted file mode 100644 index 3d5913ac06..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-settings-daemon/gnome-settings-daemon_42.1.bb +++ /dev/null @@ -1,46 +0,0 @@ -SUMMARY = "Window navigation construction toolkit" -LICENSE = "LGPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gobject-introspection gettext features_check upstream-version-is-even - -DEPENDS = " \ - colord \ - geocode-glib \ - gcr \ - gnome-desktop \ - libgweather4 \ - lcms \ - libcanberra \ - geoclue \ - libnotify \ - upower \ - libwacom \ - virtual/libx11 \ -" - -# all these are mandatory -REQUIRED_DISTRO_FEATURES = "x11 polkit pulseaudio systemd gobject-introspection-data" -GIR_MESON_OPTION = "" - -SRC_URI[archive.sha256sum] = "ed65851ae54adcd58a24c86837d624fc6a14bd84ab22e94df40a3a4cfd19ffdb" - -PACKAGECONFIG ??= " \ - cups nm \ - alsa gudev \ - smartcard \ - ${@bb.utils.filter('DISTRO_FEATURES', 'wayland', d)} \ -" -PACKAGECONFIG[alsa] = "-Dalsa=true,-Dalsa=false,alsa-lib" -PACKAGECONFIG[cups] = "-Dcups=true,-Dcups=false,cups" -PACKAGECONFIG[gudev] = "-Dgudev=true,-Dgudev=false,libgudev" -PACKAGECONFIG[nm] = "-Dnetwork_manager=true,-Dnetwork_manager=false,networkmanager" -PACKAGECONFIG[smartcard] = "-Dsmartcard=true,-Dsmartcard=false,nss" -PACKAGECONFIG[wayland] = "-Dwayland=true,-Dwayland=false,wayland" - -FILES:${PN} += " \ - ${systemd_user_unitdir} \ - ${libdir}/gnome-settings-daemon-42/libgsd.so \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-settings-daemon/gnome-settings-daemon_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-settings-daemon/gnome-settings-daemon_43.0.bb new file mode 100644 index 0000000000..fe246953fe --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-settings-daemon/gnome-settings-daemon_43.0.bb @@ -0,0 +1,46 @@ +SUMMARY = "Window navigation construction toolkit" +LICENSE = "LGPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gsettings gobject-introspection gettext features_check upstream-version-is-even + +DEPENDS = " \ + colord \ + geocode-glib \ + gcr \ + gnome-desktop \ + libgweather4 \ + lcms \ + libcanberra \ + geoclue \ + libnotify \ + upower \ + libwacom \ + virtual/libx11 \ +" + +# all these are mandatory +REQUIRED_DISTRO_FEATURES = "x11 polkit pulseaudio systemd gobject-introspection-data" +GIR_MESON_OPTION = "" + +SRC_URI[archive.sha256sum] = "3513bb24fc6f8181667223a64a067534fdccf3bf66326a9403d38b0f0d6013d0" + +PACKAGECONFIG ??= " \ + cups nm \ + alsa gudev \ + smartcard \ + ${@bb.utils.filter('DISTRO_FEATURES', 'wayland', d)} \ +" +PACKAGECONFIG[alsa] = "-Dalsa=true,-Dalsa=false,alsa-lib" +PACKAGECONFIG[cups] = "-Dcups=true,-Dcups=false,cups" +PACKAGECONFIG[gudev] = "-Dgudev=true,-Dgudev=false,libgudev" +PACKAGECONFIG[nm] = "-Dnetwork_manager=true,-Dnetwork_manager=false,networkmanager" +PACKAGECONFIG[smartcard] = "-Dsmartcard=true,-Dsmartcard=false,nss" +PACKAGECONFIG[wayland] = "-Dwayland=true,-Dwayland=false,wayland" + +FILES:${PN} += " \ + ${systemd_user_unitdir} \ + /usr/lib/gnome-settings-daemon-43/libgsd.so \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell-extensions_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell-extensions_42.0.bb deleted file mode 100644 index e8c95d6fb2..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell-extensions_42.0.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "GNOME Shell Extensions" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=4cb3a392cbf81a9e685ec13b88c4c101" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gettext gsettings features_check - -REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam gobject-introspection-data" - -SRC_URI[archive.sha256sum] = "3ee65b75b1afd8bcca0a2a03da9b2884787ed40e257a881d9aa6ef7c8727602f" - -DEPENDS += " \ - sassc-native \ -" - -EXTRA_OEMESON += " \ - -Dextension_set=all \ - -Dclassic_mode=true \ -" - -RDEPENDS:${PN} += "gnome-shell" - -FILES:${PN} += " \ - ${datadir}/gnome-shell \ - ${datadir}/gnome-session \ - ${datadir}/wayland-sessions \ - ${datadir}/xsessions \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell-extensions_43.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell-extensions_43.1.bb new file mode 100644 index 0000000000..93d791a6b6 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell-extensions_43.1.bb @@ -0,0 +1,25 @@ +SUMMARY = "GNOME Shell Extensions" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=4cb3a392cbf81a9e685ec13b88c4c101" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gettext gsettings features_check + +REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam gobject-introspection-data" + +SRC_URI[archive.sha256sum] = "adde04bd946a13113557e4c34c890bbe9077505a6a3f0755f17bea1c6e4a2d17" + +EXTRA_OEMESON += " \ + -Dextension_set=all \ + -Dclassic_mode=true \ +" + +RDEPENDS:${PN} += "gnome-shell" + +FILES:${PN} += " \ + ${datadir}/gnome-shell \ + ${datadir}/gnome-session \ + ${datadir}/wayland-sessions \ + ${datadir}/xsessions \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell/0001-Introduce-options-gjs_path-to-optionally-set-path-to.patch b/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell/0001-Introduce-options-gjs_path-to-optionally-set-path-to.patch index 4a36625184..b583199e98 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell/0001-Introduce-options-gjs_path-to-optionally-set-path-to.patch +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell/0001-Introduce-options-gjs_path-to-optionally-set-path-to.patch @@ -1,4 +1,4 @@ -From 3bf597b16e23cd2ce0ee3b05c23b46add5e26cd4 Mon Sep 17 00:00:00 2001 +From 9f11c9e53d91b23113202b40500540242bcabdb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Thu, 28 Oct 2021 18:57:24 +0200 Subject: [PATCH] Introduce options 'gjs_path' to optionally set path to gjs @@ -6,9 +6,15 @@ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + Upstream-Status: Pending Signed-off-by: Andreas Müller + --- js/dbusServices/meson.build | 2 +- meson.build | 6 +++++- @@ -19,10 +25,10 @@ Signed-off-by: Andreas Müller 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/js/dbusServices/meson.build b/js/dbusServices/meson.build -index eb941ed..16efaeb 100644 +index 48b7f89..700b590 100644 --- a/js/dbusServices/meson.build +++ b/js/dbusServices/meson.build -@@ -27,7 +27,7 @@ foreach service, dir : dbus_services +@@ -22,7 +22,7 @@ foreach service, dir : dbus_services serviceconf = configuration_data() serviceconf.set('service', service) @@ -32,10 +38,10 @@ index eb941ed..16efaeb 100644 configure_file( diff --git a/meson.build b/meson.build -index 8d7478f..7c9cc6a 100644 +index 252fb1e..250f722 100644 --- a/meson.build +++ b/meson.build -@@ -138,7 +138,11 @@ endif +@@ -125,7 +125,11 @@ endif mutter_typelibdir = mutter_dep.get_variable('typelibdir') python = find_program('python3') @@ -49,11 +55,11 @@ index 8d7478f..7c9cc6a 100644 cc = meson.get_compiler('c') diff --git a/meson_options.txt b/meson_options.txt -index f0f2ecf..a45f2e4 100644 +index 46ca8e7..3e9a31f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -45,3 +45,9 @@ option('soup2', - value: true, + value: false, description: 'Use Soup 2.4 instead of Soup 3. Must be in sync with libgweather' ) + @@ -76,10 +82,10 @@ index ce2a776..8f7bba4 100644 configure_file( input: prgname + '.in', diff --git a/subprojects/extensions-app/meson.build b/subprojects/extensions-app/meson.build -index c260d7a..c5b7554 100644 +index 66a39e9..331dc1d 100644 --- a/subprojects/extensions-app/meson.build +++ b/subprojects/extensions-app/meson.build -@@ -44,7 +44,12 @@ localedir = join_paths(datadir, 'locale') +@@ -46,7 +46,12 @@ localedir = join_paths(datadir, 'locale') metainfodir = join_paths(datadir, 'metainfo') servicedir = join_paths(datadir, 'dbus-1', 'services') @@ -107,6 +113,3 @@ index ca2eb41..2787785 100644 + value: '', + description: 'Instead of searching gjs executable, configure path' +) --- -2.34.1 - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell_42.0.bb deleted file mode 100644 index f54d966c73..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell_42.0.bb +++ /dev/null @@ -1,71 +0,0 @@ -SUMMARY = "GNOME Shell is the graphical shell of the GNOME desktop environment" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -GNOMEBASEBUILDCLASS = "meson" - -DEPENDS = " \ - libxml2-native \ - sassc-native \ - gtk4 \ - mutter \ - evolution-data-server \ - gcr \ - gjs \ - gnome-autoar \ - polkit \ - libcroco \ - startup-notification \ - ibus \ - gsettings-desktop-schemas \ -" - -inherit gnomebase gsettings gettext gobject-introspection gtk-icon-cache features_check bash-completion - -REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam" - -GTKIC_VERSION = "4" -GTKDOC_MESON_OPTION = "gtk_doc" -GIR_MESON_OPTION = "" - -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES += "gobject-introspection-data" - -SRC_URI[archive.sha256sum] = "33d404fb3c93b9de42984f0110a2969d6a4a7247c27fe7f5e24c67ecfec75094" -SRC_URI += "file://0001-Introduce-options-gjs_path-to-optionally-set-path-to.patch" - -PACKAGECONFIG ??= "bluetooth nm ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" -PACKAGECONFIG[bluetooth] = ",,gnome-bluetooth" -PACKAGECONFIG[nm] = "-Dnetworkmanager=true, -Dnetworkmanager=false, networkmanager" -PACKAGECONFIG[systemd] = "-Dsystemd=true, -Dsystemd=false, systemd" - -EXTRA_OEMESON = " \ - -Dgjs_path=${bindir}/gjs \ - -Dextensions-app:gjs_path=${bindir}/gjs \ - -Dtests=false \ - -Dman=false \ -" - -do_install:append() { - # fix shebangs - for tool in `find ${D}${bindir} -name '*-tool'`; do - sed -i 's:#!${PYTHON}:#!${bindir}/${PYTHON_PN}:' $tool - done -} - -GSETTINGS_PACKAGE = "${PN}-gsettings" - -FILES:${PN} += " \ - ${datadir}/metainfo \ - ${datadir}/dbus-1 \ - ${datadir}/gnome-control-center \ - ${datadir}/xdg-desktop-portal \ - ${systemd_user_unitdir} \ -" - -RDEPENDS:${PN} += "gnome-desktop gsettings-desktop-schemas gdm-base librsvg-gtk ${PN}-gsettings" - -PACKAGES =+ "${PN}-tools ${PN}-gsettings" -FILES:${PN}-tools = "${bindir}/*-tool" -RDEPENDS:${PN}-tools = "python3-core" - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell_43.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell_43.1.bb new file mode 100644 index 0000000000..14163a1866 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-shell/gnome-shell_43.1.bb @@ -0,0 +1,87 @@ +SUMMARY = "GNOME Shell is the graphical shell of the GNOME desktop environment" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +GNOMEBASEBUILDCLASS = "meson" + +DEPENDS = " \ + libxml2-native \ + gtk4 \ + mutter \ + evolution-data-server \ + gcr \ + geocode-glib \ + gjs \ + gnome-autoar \ + polkit \ + libcroco \ + libsoup-3.0 \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', '', 'startup-notification', d)} \ + ibus \ + gsettings-desktop-schemas \ +" + +inherit gnomebase gsettings gettext gobject-introspection gtk-icon-cache features_check bash-completion + +REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam" + +GTKIC_VERSION = "4" +GTKDOC_MESON_OPTION = "gtk_doc" +GIR_MESON_OPTION = "" + +# gobject-introspection is mandatory and cannot be configured +REQUIRED_DISTRO_FEATURES += "gobject-introspection-data" + +SRC_URI[archive.sha256sum] = "df0444765def1bd0afee9617d2b5919bc79b4db86e7e757ac0e1f73748ec1bdc" +SRC_URI += "file://0001-Introduce-options-gjs_path-to-optionally-set-path-to.patch" + +PACKAGECONFIG ??= "bluetooth nm ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +PACKAGECONFIG[bluetooth] = ",,gnome-bluetooth" +PACKAGECONFIG[nm] = "-Dnetworkmanager=true, -Dnetworkmanager=false,networkmanager,networkmanager" +PACKAGECONFIG[systemd] = "-Dsystemd=true, -Dsystemd=false, systemd" + +EXTRA_OEMESON = " \ + -Dgjs_path=${bindir}/gjs \ + -Dextensions-app:gjs_path=${bindir}/gjs \ + -Dtests=false \ + -Dman=false \ + -Dsoup2=false \ +" + +do_install:append() { + # fix shebangs + for tool in `find ${D}${bindir} -name '*-tool'`; do + sed -i 's:#!${PYTHON}:#!${bindir}/${PYTHON_PN}:' $tool + done +} + +GSETTINGS_PACKAGE = "${PN}-gsettings" + +FILES:${PN} += " \ + ${datadir}/metainfo \ + ${datadir}/dbus-1 \ + ${datadir}/gnome-control-center \ + ${datadir}/xdg-desktop-portal \ + ${systemd_user_unitdir} \ +" + +RDEPENDS:${PN} += " \ + accountsservice \ + adwaita-icon-theme \ + adwaita-icon-theme-cursors \ + gdm-base \ + gnome-control-center \ + gnome-backgrounds \ + gnome-bluetooth \ + gnome-desktop \ + gnome-session \ + gnome-settings-daemon \ + gnome-shell-gsettings \ + gsettings-desktop-schemas \ + librsvg-gtk \ +" + +PACKAGES =+ "${PN}-tools ${PN}-gsettings" +FILES:${PN}-tools = "${bindir}/*-tool" +RDEPENDS:${PN}-tools = "python3-core" + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-software/gnome-software_43.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-software/gnome-software_43.2.bb new file mode 100644 index 0000000000..183a2d107a --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-software/gnome-software_43.2.bb @@ -0,0 +1,44 @@ +SUMMARY = "GNOME Software allows users to easily find, discover and install apps." +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +GNOMEBASEBUILDCLASS = "meson" +GTKDOC_MESON_OPTION ?= "gtk_doc" + +inherit gnomebase gsettings itstool gnome-help gtk-icon-cache gtk-doc mime mime-xdg gettext upstream-version-is-even features_check + +REQUIRED_DISTRO_FEATURES = "x11 polkit systemd pam" + +DEPENDS += " \ + appstream \ + gdk-pixbuf \ + glib-2.0 \ + glib-2.0-native \ + gsettings-desktop-schemas \ + gtk4 \ + iso-codes \ + json-glib \ + libadwaita \ + libgudev \ + libsoup-3.0 \ + libxmlb-native \ + polkit \ +" + +RDEPENDS:${PN} = "iso-codes" + +EXTRA_OEMESON += "-Dtests=false -Dsoup2=false" + +SRC_URI[archive.sha256sum] = "22aa7f0a317c770f68b897e9e512b2cbedb181b695ffdb0b658d99bbd64f368d" + +PACKAGECONFIG ?= "flatpak" +PACKAGECONFIG[flatpak] = "-Dflatpak=true,-Dflatpak=false,flatpak ostree" +PACKAGECONFIG[snap] = "-Dsnap=true,-Dsnap=false,snapd-glib" +PACKAGECONFIG[gtk_doc] = "-Dgtk_doc=true,-Dgtk_doc=false,libxslt-native docbook-xsl-stylesheets" +PACKAGECONFIG[man] = "-Dman=true,-Dman=false,libxslt-native docbook-xsl-stylesheets" +PACKAGECONFIG[packagekit] = "-Dpackagekit=true,-Dpackagekit=false,gnome-packagekit,gnome-packagekit" +PACKAGECONFIG[fwupd] = "-Dfwupd=true,-Dfwupd=false,fwupd,fwupd" +PACKAGECONFIG[malcontent] = "-Dmalcontent=true,-Dmalcontent=false,malcontent" + +FILES:${PN} += "${datadir}" +FILES:${PN}-dev += "${libdir}/gnome-software/libgnomesoftware.so" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-terminal/gnome-terminal_3.42.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-terminal/gnome-terminal_3.42.2.bb deleted file mode 100644 index 061da27f60..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-terminal/gnome-terminal_3.42.2.bb +++ /dev/null @@ -1,40 +0,0 @@ -SUMMARY = "GNOME terminal" -LICENSE = "GPL-3.0-only & GFDL-1.3" -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949 \ - file://COPYING.GFDL;md5=a22d0be1ce2284b67950a4d1673dd1b0 \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gnome-help gettext itstool upstream-version-is-even - -DEPENDS = " \ - glib-2.0-native \ - intltool-native \ - yelp-tools-native \ - docbook-xsl-stylesheets-native libxslt-native \ - desktop-file-utils-native \ - gtk+3 \ - gsettings-desktop-schemas \ - vte \ - dconf \ - libpcre2 \ -" - -SRC_URI[archive.sha256sum] = "8a9c8e5ef7a3a73b246a947e1190bb08ec98935af860cf0b3aa2fbf4606817a0" -SRC_URI += "file://0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch" -SRC_URI += " file://0001-build-Fix-for-newer-meson.patch" - -EXTRA_OEMESON += " \ - -Dsearch_provider=false \ - -Dnautilus_extension=false \ -" - -FILES:${PN} += " \ - ${datadir}/metainfo \ - ${datadir}/dbus-1 \ - ${systemd_user_unitdir} \ -" - -RRECOMMENDS:${PN} += "vte-prompt gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-terminal/gnome-terminal_3.46.7.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-terminal/gnome-terminal_3.46.7.bb new file mode 100644 index 0000000000..d9afeec46a --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-terminal/gnome-terminal_3.46.7.bb @@ -0,0 +1,38 @@ +SUMMARY = "GNOME terminal" +LICENSE = "GPL-3.0-only & GFDL-1.3" +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949 \ + file://COPYING.GFDL;md5=a22d0be1ce2284b67950a4d1673dd1b0 \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit pkgconfig meson gsettings gnome-help gettext itstool upstream-version-is-even + +DEPENDS = " \ + glib-2.0 \ + docbook-xsl-stylesheets-native libxslt-native \ + desktop-file-utils-native \ + gtk+3 \ + gsettings-desktop-schemas \ + vte \ + dconf \ + libpcre2 \ +" + +SRC_URI = "git://gitlab.gnome.org/GNOME/gnome-terminal.git;protocol=https;nobranch=1" +SRC_URI += "file://0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch" +SRCREV = "816edf80cd7bf7f253366099ea9fcaf361676139" +S = "${WORKDIR}/git" + +PACKAGECONFIG ?= "" +PACKAGECONFIG[nautilus] = "-Dnautilus_extension=true,-Dnautilus_extension=false,nautilus,nautilus" +PACKAGECONFIG[search_provider] = "-Dsearch_provider=true,-Dsearch_provider=false,,gnome-shell" + +FILES:${PN} += " \ + ${datadir} \ + ${libdir}/nautilus/extensions-4 \ + ${systemd_user_unitdir} \ +" + +RRECOMMENDS:${PN} += "vte-prompt gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-text-editor/gnome-text-editor_42.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-text-editor/gnome-text-editor_42.2.bb deleted file mode 100644 index 1446b151c5..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-text-editor/gnome-text-editor_42.2.bb +++ /dev/null @@ -1,27 +0,0 @@ -SUMMARY = "A simple text editor" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=8f0e2cd40e05189ec81232da84bd6e1a" - -GNOMEBASEBUILDCLASS = "meson" - -DEPENDS = " \ - desktop-file-utils-native \ - libadwaita \ - gtk4 \ - gtksourceview5 \ - enchant2 \ -" - -GTKIC_VERSION = "4" - -inherit gnomebase gtk-icon-cache itstool gnome-help mime-xdg features_check - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" -REQUIRED_DISTRO_FEATURES = "opengl" - -SRC_URI[archive.sha256sum] = "e56d4a8cdcbce8a8f1c0881b45de799f8b25205ec0cbf2269e532025761cc5da" - -FILES:${PN} += " \ - ${datadir}/metainfo \ - ${datadir}/dbus-1 \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-text-editor/gnome-text-editor_43.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-text-editor/gnome-text-editor_43.1.bb new file mode 100644 index 0000000000..a2ac710a01 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-text-editor/gnome-text-editor_43.1.bb @@ -0,0 +1,27 @@ +SUMMARY = "A simple text editor" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=8f0e2cd40e05189ec81232da84bd6e1a" + +GNOMEBASEBUILDCLASS = "meson" + +DEPENDS = " \ + desktop-file-utils-native \ + libadwaita \ + gtk4 \ + gtksourceview5 \ + editorconfig-core-c \ + enchant2 \ +" + +GTKIC_VERSION = "4" + +inherit gnomebase gtk-icon-cache itstool gnome-help mime-xdg features_check + +REQUIRED_DISTRO_FEATURES = "opengl" + +SRC_URI[archive.sha256sum] = "973a4b0deb68f9f91a54a4dd415b6afde9b5ae3ee684bc761471f94290f9f6cb" + +FILES:${PN} += " \ + ${datadir}/metainfo \ + ${datadir}/dbus-1 \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/grilo/grilo_0.3.14.bb b/meta-openembedded/meta-gnome/recipes-gnome/grilo/grilo_0.3.14.bb deleted file mode 100644 index 7ceb26d7a2..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/grilo/grilo_0.3.14.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "Grilo is a framework forsearching media content from various sources" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" - -DEPENDS = " \ - libxml2 \ - glib-2.0 \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gobject-introspection gtk-doc gettext vala - -SRC_URI[archive.sha256sum] = "0369d0b00bb0f59ba5f7aea8cfc665f38df14a5b4182d28c7c1e2cd15b518743" - -GIR_MESON_OPTION = "enable-introspection" -GTKDOC_MESON_OPTION = "enable-gtk-doc" - -# Note: removing 'net' from PACKAGECONFIG causes -# | bindings/vala/meson.build:15:0: ERROR: Unknown variable "grlnet_gir". -PACKAGECONFIG ??= "net" - -PACKAGECONFIG[net] = "-Denable-grl-net=true, -Denable-grl-net=false, libsoup-2.4" -PACKAGECONFIG[test-ui] = "-Denable-test-ui=true, -Denable-test-ui=false, gtk+3 liboauth" - -# Once we have a recipe for 'totem-plparser' this can turn into a PACKAGECONFIG -EXTRA_OEMESON = "-Denable-grl-pls=false" - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/grilo/grilo_0.3.15.bb b/meta-openembedded/meta-gnome/recipes-gnome/grilo/grilo_0.3.15.bb new file mode 100644 index 0000000000..d51a27f01a --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/grilo/grilo_0.3.15.bb @@ -0,0 +1,28 @@ +SUMMARY = "Grilo is a framework forsearching media content from various sources" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" + +DEPENDS = " \ + libxml2 \ + glib-2.0 \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gobject-introspection gtk-doc gettext vala + +SRC_URI[archive.sha256sum] = "f352acf73665669934270636fede66b52da6801fe20f638c4048ab2678577b2d" + +GIR_MESON_OPTION = "enable-introspection" +GTKDOC_MESON_OPTION = "enable-gtk-doc" + +# Note: removing 'net' from PACKAGECONFIG causes +# | bindings/vala/meson.build:15:0: ERROR: Unknown variable "grlnet_gir". +PACKAGECONFIG ??= "net" + +PACKAGECONFIG[net] = "-Denable-grl-net=true, -Denable-grl-net=false, libsoup-3.0" +PACKAGECONFIG[test-ui] = "-Denable-test-ui=true, -Denable-test-ui=false, gtk+3 liboauth" + +# Once we have a recipe for 'totem-plparser' this can turn into a PACKAGECONFIG +EXTRA_OEMESON = "-Denable-grl-pls=false" + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gthumb/gthumb_3.12.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gthumb/gthumb_3.12.2.bb index 0c5b71f5b6..92152aca69 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gthumb/gthumb_3.12.2.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gthumb/gthumb_3.12.2.bb @@ -19,7 +19,7 @@ DEPENDS = " \ lcms \ libraw \ librsvg \ - libsoup-2.4 \ + libsoup \ json-glib \ libsecret \ " diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gtk4/gtk4_4.6.7.bb b/meta-openembedded/meta-gnome/recipes-gnome/gtk4/gtk4_4.6.7.bb deleted file mode 100644 index c71be23a7d..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gtk4/gtk4_4.6.7.bb +++ /dev/null @@ -1,142 +0,0 @@ -SUMMARY = "Multi-platform toolkit for creating GUIs" -DESCRIPTION = "GTK is a multi-platform toolkit for creating graphical user interfaces. Offering a complete \ -set of widgets, GTK is suitable for projects ranging from small one-off projects to complete application suites." -HOMEPAGE = "http://www.gtk.org" -BUGTRACKER = "https://bugzilla.gnome.org/" -SECTION = "libs" - -DEPENDS = " \ - sassc-native \ - glib-2.0 \ - libepoxy \ - graphene \ - cairo \ - pango \ - atk \ - jpeg \ - libpng \ - librsvg \ - tiff \ - gdk-pixbuf-native gdk-pixbuf \ -" - -LICENSE = "LGPL-2.0-only & LGPL-2.0-or-later & LGPL-2.1-or-later" -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ - file://gtk/gtk.h;endline=25;md5=1d8dc0fccdbfa26287a271dce88af737 \ - file://gdk/gdk.h;endline=25;md5=c920ce39dc88c6f06d3e7c50e08086f2 \ - file://tests/testgtk.c;endline=25;md5=49d06770681b8322466b52ed19d29fb2 \ -" - -MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" - -UPSTREAM_CHECK_REGEX = "gtk-(?P\d+\.(\d*[02468])+(\.\d+)+)\.tar.xz" - -SRC_URI = "http://ftp.gnome.org/pub/gnome/sources/gtk/${MAJ_VER}/gtk-${PV}.tar.xz" -SRC_URI[sha256sum] = "effd2e7c4b5e2a5c7fad43e0f24adea68baa4092abb0b752caff278e6bb010e8" - -S = "${WORKDIR}/gtk-${PV}" - -inherit meson gettext pkgconfig gtk-doc update-alternatives gsettings features_check gobject-introspection - -# TBD: nativesdk -# gobject-introspection.bbclass pins introspection off for nativesk. As long as -# we do not remove this wisdom or hack gtk4, it is not possible to build -# nativesdk-gtk4 -BBCLASSEXTEND = "native" - -GSETTINGS_PACKAGE:class-native = "" - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" -REQUIRED_DISTRO_FEATURES = "opengl" - -GIR_MESON_ENABLE_FLAG = 'enabled' -GIR_MESON_DISABLE_FLAG = 'disabled' -GTKDOC_MESON_OPTION = 'gtk_doc' - -EXTRA_OEMESON = " -Dbuild-tests=false" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" -PACKAGECONFIG:class-native = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" -PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" - -PACKAGECONFIG[x11] = "-Dx11-backend=true,-Dx11-backend=false,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes xinerama" -PACKAGECONFIG[wayland] = "-Dwayland-backend=true,-Dwayland-backend=false,wayland wayland-protocols libxkbcommon virtual/egl virtual/libgles2 wayland-native" -PACKAGECONFIG[cups] = "-Dprint-cups=enabled,-Dprint-cups=disabled,cups" -PACKAGECONFIG[colord] = "-Dcolord=enabled,-Dcolord=disabled,colord" -# gtk4 wants gstreamer-player-1.0 -> gstreamer1.0-plugins-bad -PACKAGECONFIG[gstreamer] = "-Dmedia-gstreamer=enabled,-Dmedia-gstreamer=disabled,gstreamer1.0-plugins-bad" -PACKAGECONFIG[tracker] = "-Dtracker=enabled,-Dtracker=disabled,tracker" - - -do_compile:prepend() { - export GIR_EXTRA_LIBS_PATH="${B}/gdk/.libs" -} - - -PACKAGES =+ "${PN}-demo" -LIBV = "4.0.0" - -FILES:${PN}-demo = " \ - ${datadir}/applications/org.gtk.Demo4.desktop \ - ${datadir}/applications/org.gtk.IconBrowser4.desktop \ - ${datadir}/applications/org.gtk.WidgetFactory4.desktop \ - ${datadir}/icons/hicolor/*/apps/org.gtk.Demo4*.* \ - ${datadir}/icons/hicolor/*/apps/org.gtk.IconBrowser4*.* \ - ${datadir}/icons/hicolor/*/apps/org.gtk.WidgetFactory4*.* \ - ${bindir}/gtk4-demo \ - ${bindir}/gtk4-demo-application \ - ${bindir}/gtk4-icon-browser \ - ${bindir}/gtk4-widget-factory \ -" - -FILES:${PN}:append = " \ - ${datadir}/glib-2.0/schemas/ \ - ${datadir}/gtk-4.0/emoji/ \ - ${datadir}/metainfo/ \ - ${datadir}/icons/hicolor/*/apps/org.gtk.PrintEditor4*.* \ - ${libdir}/gtk-4.0/${LIBV}/printbackends \ - ${bindir}/gtk4-update-icon-cache \ - ${bindir}/gtk4-launch \ -" - -FILES:${PN}-dev += " \ - ${datadir}/gtk-4.0/gtk4builder.rng \ - ${datadir}/gtk-4.0/include \ - ${datadir}/gtk-4.0/valgrind \ - ${datadir}/gettext/its \ - ${bindir}/gtk4-builder-tool \ - ${bindir}/gtk4-encode-symbolic-svg \ - ${bindir}/gtk4-query-settings \ -" - -GTKBASE_RRECOMMENDS ?= " \ - liberation-fonts \ - gdk-pixbuf-loader-png \ - gdk-pixbuf-loader-jpeg \ - gdk-pixbuf-loader-gif \ - gdk-pixbuf-loader-xpm \ - shared-mime-info \ - adwaita-icon-theme-symbolic \ -" - -GTKBASE_RRECOMMENDS:class-native ?= "" - -GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1" - -RRECOMMENDS:${PN} = "${GTKBASE_RRECOMMENDS}" -RRECOMMENDS:${PN}:libc-glibc = "${GTKGLIBC_RRECOMMENDS}" -RDEPENDS:${PN}-dev += "${@bb.utils.contains("PACKAGECONFIG", "wayland", "wayland-protocols", "", d)}" - -PACKAGES_DYNAMIC += "^gtk4-printbackend-.*" -python populate_packages:prepend () { - import os.path - - gtk_libdir = d.expand('${libdir}/gtk-3.0/${LIBV}') - printmodules_root = os.path.join(gtk_libdir, 'printbackends'); - - do_split_packages(d, printmodules_root, r'^libprintbackend-(.*)\.so$', 'gtk4-printbackend-%s', 'GTK printbackend module for %s') - - if (d.getVar('DEBIAN_NAMES')): - d.setVar(d.expand('PKG:${PN}'), '${MLPREFIX}libgtk-4.0') -} diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gtksourceview/gtksourceview5_5.4.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gtksourceview/gtksourceview5_5.4.2.bb deleted file mode 100644 index 52c270e6a0..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gtksourceview/gtksourceview5_5.4.2.bb +++ /dev/null @@ -1,34 +0,0 @@ -SUMMARY = "Portable C library for multiline text editing" -HOMEPAGE = "http://projects.gnome.org/gtksourceview/" - -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" - -DEPENDS = " \ - glib-2.0-native \ - gnome-common-native \ - intltool-native \ - gtk+3 \ - gtk4 \ - libxml2 \ - libpcre2 \ -" - -PNAME = "gtksourceview" - -S = "${WORKDIR}/${PNAME}-${PV}" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase lib_package gettext features_check gtk-doc gtk-icon-cache gobject-introspection vala - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -SRC_URI = "https://download.gnome.org/sources/gtksourceview/5.4/${PNAME}-${PV}.tar.xz" -SRC_URI[sha256sum] = "ad140e07eb841910de483c092bd4885abd29baadd6e95fa22d93ed2df0b79de7" - -GIR_MESON_ENABLE_FLAG = 'enabled' -GIR_MESON_DISABLE_FLAG = 'disabled' -GTKDOC_MESON_OPTION = "gtk_doc" - -FILES:${PN} += "${datadir}/gtksourceview-5" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gtksourceview/gtksourceview5_5.6.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gtksourceview/gtksourceview5_5.6.1.bb new file mode 100644 index 0000000000..2fb64325ce --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gtksourceview/gtksourceview5_5.6.1.bb @@ -0,0 +1,38 @@ +SUMMARY = "Portable C library for multiline text editing" +HOMEPAGE = "http://projects.gnome.org/gtksourceview/" + +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" + +DEPENDS = " \ + fribidi \ + glib-2.0-native \ + gnome-common-native \ + fontconfig \ + gtk4 \ + libxml2 \ + libpcre2 \ + pango \ +" + +PNAME = "gtksourceview" + +S = "${WORKDIR}/${PNAME}-${PV}" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase lib_package gettext features_check gtk-doc gtk-icon-cache gobject-introspection vala + +REQUIRED_DISTRO_FEATURES = "opengl" + +SRC_URI = "https://download.gnome.org/sources/gtksourceview/5.6/${PNAME}-${PV}.tar.xz" +SRC_URI[sha256sum] = "659d9cc9d034a114f07e7e134ee80d77dec0497cb1516ae5369119c2fcb9da16" + +GIR_MESON_ENABLE_FLAG = 'enabled' +GIR_MESON_DISABLE_FLAG = 'disabled' +GTKDOC_MESON_OPTION = "gtk_doc" + +PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'vulkan', d)}" +PACKAGECONFIG[vulkan] = ",,vulkan-loader vulkan-headers" + +FILES:${PN} += "${datadir}/gtksourceview-5" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gvfs/gvfs/0001-daemon-PATH-expand-the-sftp-backend-ssh-client.patch b/meta-openembedded/meta-gnome/recipes-gnome/gvfs/gvfs/0001-daemon-PATH-expand-the-sftp-backend-ssh-client.patch new file mode 100644 index 0000000000..011858e80c --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gvfs/gvfs/0001-daemon-PATH-expand-the-sftp-backend-ssh-client.patch @@ -0,0 +1,60 @@ +From 8327383e262e1e7f32750a8a2d3dd708195b0f53 Mon Sep 17 00:00:00 2001 +From: Alex Stewart +Date: Wed, 14 Dec 2022 03:05:45 -0600 +Subject: [PATCH] daemon: PATH-expand the sftp backend ssh client + +Meson is currently configured to search the gvfs builder's PATH for an +ssh client, and hardcode its fullpath as the canonical ssh client for +the gvfs sftp backend. + +This setup breaks in cases where the builder has a different ssh client +from the final runtime root, or where the client's pathes differ. +Builders using OpenEmbedded or buildroot workspaces are particularly +affected. + +Instead, set SSH_PROGRAM to `ssh` so that it gets PATH-expanded at +runtime. + +Closes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/465 +Signed-off-by: Alex Stewart + +Upstream-Status: Accepted +* https://gitlab.gnome.org/GNOME/gvfs/-/merge_requests/157 + * Expect upstream merge in GNOME 44 + +--- + daemon/meson.build | 2 +- + meson.build | 4 ---- + 2 files changed, 1 insertion(+), 5 deletions(-) + +diff --git a/daemon/meson.build b/daemon/meson.build +index e20ada29..72a16890 100644 +--- a/daemon/meson.build ++++ b/daemon/meson.build +@@ -256,7 +256,7 @@ if enable_sftp + '-DDEFAULT_BACKEND_TYPE=sftp', + '-DBACKEND_TYPES="sftp", G_VFS_TYPE_BACKEND_SFTP,', + '-DMAX_JOB_THREADS=1', +- '-DSSH_PROGRAM="@0@"'.format(ssh.full_path()), ++ '-DSSH_PROGRAM="ssh"', + ] + + programs += {'gvfsd-sftp': {'sources': sources, 'dependencies': deps, 'c_args': cflags}} +diff --git a/meson.build b/meson.build +index 7fd67427..a84c0104 100644 +--- a/meson.build ++++ b/meson.build +@@ -457,10 +457,6 @@ endif + + # *** SFTP backend *** + enable_sftp = get_option('sftp') +-if enable_sftp +- ssh = find_program('ssh', required: false) +- assert(ssh.found(), 'SFTP backend requested but a ssh client is required') +-endif + + # *** Enable development utils *** + enable_devel_utils = get_option('devel_utils') +-- +2.38.1 + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gvfs/gvfs_1.50.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/gvfs/gvfs_1.50.2.bb index e8d9f16de1..6ea8727539 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gvfs/gvfs_1.50.2.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gvfs/gvfs_1.50.2.bb @@ -5,12 +5,23 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=05df38dd77c35ec8431f212410a3329e" GNOMEBASEBUILDCLASS = "meson" inherit gnomebase gsettings bash-completion gettext upstream-version-is-even features_check useradd -DEPENDS += "libsecret glib-2.0 glib-2.0-native libgudev shadow-native \ - gsettings-desktop-schemas dbus" +DEPENDS += "\ + dbus \ + glib-2.0 \ + glib-2.0-native \ + gsettings-desktop-schemas \ + libgudev \ + libsecret \ + libxml2 \ + shadow-native \ +" RDEPENDS:${PN} += "gsettings-desktop-schemas" -SRC_URI = "https://download.gnome.org/sources/${BPN}/${@gnome_verdir("${PV}")}/${BPN}-${PV}.tar.xz;name=archive" +SRC_URI = "\ + https://download.gnome.org/sources/${BPN}/${@gnome_verdir("${PV}")}/${BPN}-${PV}.tar.xz;name=archive \ + file://0001-daemon-PATH-expand-the-sftp-backend-ssh-client.patch \ +" SRC_URI[archive.sha256sum] = "03d72b8c15ef438110f0cf457b5655266c8b515d0412b30f4d55cfa0da06ac5e" @@ -54,8 +65,8 @@ PACKAGECONFIG[admin] = "-Dadmin=true, -Dadmin=false, libcap polkit" PACKAGECONFIG[afc] = "-Dafc=true, -Dafc=false, libimobiledevice libplist" PACKAGECONFIG[archive] = "-Darchive=true, -Darchive=false, libarchive" PACKAGECONFIG[dnssd] = "-Ddnssd=true, -Ddnssd=false, avahi" -PACKAGECONFIG[gcr] = "-Dgcr=true, -Dgcr=false, gcr" -PACKAGECONFIG[http] = "-Dhttp=true, -Dhttp=false, libsoup-2.4" +PACKAGECONFIG[gcr] = "-Dgcr=true, -Dgcr=false, gcr3" +PACKAGECONFIG[http] = "-Dhttp=true, -Dhttp=false, libsoup-3.0" PACKAGECONFIG[libmtp] = "-Dmtp=true, -Dmtp=false, libmtp" PACKAGECONFIG[logind] = "-Dlogind=true, -Dlogind=false, systemd" PACKAGECONFIG[libgphoto2] = "-Dgphoto2=true, -Dgphoto2=false, libgphoto2" @@ -69,13 +80,13 @@ PACKAGECONFIG[fuse] = "-Dfuse=true, -Dfuse=false, fuse3" PACKAGECONFIG[cdda] = "-Dcdda=true, -Dcdda=false, libcdio-paranoia" USERADD_PACKAGES = "${PN}" -USERADD_PARAM:${PN} = "--system --no-create-home --user-group --home-dir ${sysconfdir}/${BPN}-1 polkitd" +USERADD_PARAM:${PN} = "--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd" do_install:append() { if ${@bb.utils.contains('DISTRO_FEATURES', 'polkit', 'true', 'false', d)}; then # Fix up permissions on polkit rules.d to work with rpm4 constraints - chmod 700 ${D}/${datadir}/polkit-1/rules.d - chown polkitd:root ${D}/${datadir}/polkit-1/rules.d + chmod 700 ${D}${datadir}/polkit-1/rules.d + chown polkitd:root ${D}${datadir}/polkit-1/rules.d fi # After rebuilds (not from scracth) it can happen that the executables in diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libadwaita/libadwaita_1.2.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/libadwaita/libadwaita_1.2.0.bb index 7a1f86a73d..a518f251b8 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/libadwaita/libadwaita_1.2.0.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/libadwaita/libadwaita_1.2.0.bb @@ -5,7 +5,6 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" GNOMEBASEBUILDCLASS = "meson" DEPENDS = " \ - sassc-native \ gtk4 \ " diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb index bd9180e8a1..126ef712d6 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/libgdata/libgdata_0.18.1.bb @@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24 \ file://gdata/gdata.h;endline=20;md5=079a554efcf65d46f96a515806e7e99a \ file://gdata/gdata-types.h;endline=20;md5=7399b111aac8718da13888fc634be6ef" -DEPENDS = "libxml2 glib-2.0 libsoup-2.4 intltool-native liboauth gcr json-glib" +DEPENDS = "libxml2 glib-2.0 libsoup-2.4 intltool-native liboauth gcr3 json-glib" GTKDOC_MESON_OPTION = "gtk_doc" GNOMEBASEBUILDCLASS = "meson" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4/0001-Allow-building-gir-in-cross-environments.patch b/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4/0001-Allow-building-gir-in-cross-environments.patch index 6c6a643edf..3a075de651 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4/0001-Allow-building-gir-in-cross-environments.patch +++ b/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4/0001-Allow-building-gir-in-cross-environments.patch @@ -11,23 +11,16 @@ For us this works perfectly fine Upstream-Status: Inappropriate [OE-specific] Signed-off-by: Andreas Müller ---- - libgweather/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) +Signed-off-by: Markus Volk -diff --git a/libgweather/meson.build b/libgweather/meson.build -index 08311af..ef554f2 100644 ---- a/libgweather/meson.build -+++ b/libgweather/meson.build -@@ -208,7 +208,7 @@ lib_libgweather = library('gweather-4', - ) +--- a/meson.build 2022-09-18 14:48:53.000000000 +0200 ++++ b/meson.build 2022-11-26 14:05:13.302487232 +0100 +@@ -51,7 +51,7 @@ + gen_locations_variant = find_program('build-aux/meson/gen_locations_variant.py') g_ir_scanner = find_program('g-ir-scanner', required: get_option('introspection')) -build_gir = get_option('introspection') and g_ir_scanner.found() and not meson.is_cross_build() +build_gir = get_option('introspection') and g_ir_scanner.found() + build_docs = get_option('gtk_doc') and build_gir - enable_vala = get_option('enable_vala') - vapigen = find_program('vapigen', required: enable_vala == 'true') --- -2.34.1 - + schemas_srcdir = meson.project_source_root() / 'schemas' diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4_4.0.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4_4.0.0.bb deleted file mode 100644 index 708d27a61f..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4_4.0.0.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "A library to access weather information from online services" - -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -GNOMEBASEBUILDCLASS = "meson" -GNOMEBN = "libgweather" -S = "${WORKDIR}/${GNOMEBN}-${PV}" - -inherit gnomebase gsettings gobject-introspection gettext gtk-doc vala - -SRC_URI += "file://0001-Allow-building-gir-in-cross-environments.patch" -SRC_URI[archive.sha256sum] = "440d44801b6f72b48c676e5e37f9109cfee1394fd74cc92725e1b1ba4fae834c" - -GTKDOC_MESON_OPTION = "gtk_doc" - -DEPENDS = " \ - geocode-glib \ - gtk+3 \ - json-glib \ - libsoup-2.4 \ - python3-pygobject-native \ -" - -FILES:${PN} += " \ - ${datadir}/libgweather-4 \ - ${libdir}/libgweather-4 \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4_4.2.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4_4.2.0.bb new file mode 100644 index 0000000000..824269e68a --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather4_4.2.0.bb @@ -0,0 +1,30 @@ +SUMMARY = "A library to access weather information from online services" + +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +GNOMEBASEBUILDCLASS = "meson" +GNOMEBN = "libgweather" +S = "${WORKDIR}/${GNOMEBN}-${PV}" + +inherit gnomebase gsettings gobject-introspection gettext gtk-doc vala features_check + +REQUIRED_DISTRO_FEATURES = "opengl" + +SRC_URI += "file://0001-Allow-building-gir-in-cross-environments.patch" +SRC_URI[archive.sha256sum] = "af8a812da0d8976a000e1d62572c256086a817323fbf35b066dbfdd8d2ca6203" + +GTKDOC_MESON_OPTION = "gtk_doc" + +DEPENDS = " \ + geocode-glib \ + gtk4 \ + json-glib \ + libsoup-3.0 \ + python3-pygobject-native \ +" + +FILES:${PN} += " \ + ${datadir}/libgweather-4 \ + ${libdir}/libgweather-4 \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather_40.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather_40.0.bb deleted file mode 100644 index 771fc62e1e..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather_40.0.bb +++ /dev/null @@ -1,24 +0,0 @@ -SUMMARY = "A library to access weather information from online services" - -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gobject-introspection gettext gtk-doc vala features_check upstream-version-is-even - -SRC_URI[archive.sha256sum] = "ca4e8f2a4baaa9fc6d75d8856adb57056ef1cd6e55c775ba878ae141b6276ee6" - -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" -GIR_MESON_OPTION = "" - -GTKDOC_MESON_OPTION = "gtk_doc" - -DEPENDS = " \ - geocode-glib \ - gtk+3 \ - json-glib \ - libsoup-2.4 \ - python3-pygobject-native \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libportal/libportal_0.6.bb b/meta-openembedded/meta-gnome/recipes-gnome/libportal/libportal_0.6.bb deleted file mode 100644 index 9784f04818..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/libportal/libportal_0.6.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "libportal provides GIO-style async APIs for most Flatpak portals." -DESCRIPTION = "It provides simple asynchronous wrappers for most Flatpak portals \ -with a familiar GObject API along side the D-Bus API" -HOMEPAGE = "https://github.com/flatpak/libportal" -BUGTRACKER = "https://github.com/flatpak/libportal/issues" -LICENSE = "LGPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=3000208d539ec061b899bce1d9ce9404" - -SRC_URI = "git://github.com/flatpak/${BPN}.git;protocol=https;branch=main" -SRCREV = "13df0b887a7eb7b0f9b14069561a41f62e813155" -S = "${WORKDIR}/git" - -inherit meson gtk-doc gobject-introspection features_check - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -DEPENDS += "glib-2.0 glib-2.0-native gtk+3" - -EXTRA_OEMESON = "-Dbackends=gtk3 -Dvapi=false" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libwnck/libwnck3_40.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/libwnck/libwnck3_40.1.bb deleted file mode 100644 index a6c82b2cb7..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/libwnck/libwnck3_40.1.bb +++ /dev/null @@ -1,27 +0,0 @@ -SUMMARY = "Window navigation construction toolkit" -LICENSE = "LGPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" - -BPN = "libwnck" - -SECTION = "x11/libs" -DEPENDS = "intltool-native gnome-common-native gtk+3 gdk-pixbuf-native" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" -PACKAGECONFIG[x11] = "-Dstartup_notification=enabled,-Dstartup_notification=disabled,startup-notification libxres" - -GNOMEBASEBUILDCLASS = "meson" -GTKDOC_MESON_OPTION = "gtk_doc" -GIR_MESON_ENABLE_FLAG = 'enabled' -GIR_MESON_DISABLE_FLAG = 'disabled' - -inherit gnomebase gobject-introspection gtk-doc gettext features_check - -def gnome_verdir(v): - return oe.utils.trim_version(v, 1) - -SRC_URI[archive.sha256sum] = "03134fa114ef3fbe34075aa83678f58aa2debe9fcef4ea23c0779e28601d6611" - -# gtk+3 and libepoxy need to be built with x11 PACKAGECONFIG. -# cairo would at least needed to be built with xlib. -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libwnck/libwnck3_43.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/libwnck/libwnck3_43.0.bb new file mode 100644 index 0000000000..5b4de3290d --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/libwnck/libwnck3_43.0.bb @@ -0,0 +1,27 @@ +SUMMARY = "Window navigation construction toolkit" +LICENSE = "LGPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" + +BPN = "libwnck" + +SECTION = "x11/libs" +DEPENDS = "cairo glib-2.0 gtk+3" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" +PACKAGECONFIG[x11] = "-Dstartup_notification=enabled,-Dstartup_notification=disabled,startup-notification libxres" + +GNOMEBASEBUILDCLASS = "meson" +GTKDOC_MESON_OPTION = "gtk_doc" +GIR_MESON_ENABLE_FLAG = 'enabled' +GIR_MESON_DISABLE_FLAG = 'disabled' + +inherit gnomebase gobject-introspection gtk-doc gettext features_check + +def gnome_verdir(v): + return oe.utils.trim_version(v, 1) + +SRC_URI[archive.sha256sum] = "905bcdb85847d6b8f8861e56b30cd6dc61eae67ecef4cd994a9f925a26a2c1fe" + +# gtk+3 and libepoxy need to be built with x11 PACKAGECONFIG. +# cairo would at least needed to be built with xlib. +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.0.bb deleted file mode 100644 index 2760d73dff..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.0.bb +++ /dev/null @@ -1,39 +0,0 @@ -SECTION = "x11/wm" -SUMMARY = "Metacity is the boring window manager for the adult in you" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=b4cce53560b8e619ffa7c830fb8761aa \ - file://src/include/main.h;endline=24;md5=72148ede07a6dadd01de6a882d20a9ad" - -PE = "1" - -DEPENDS = " \ - gdk-pixbuf-native \ - gtk+3 \ - gsettings-desktop-schemas \ - startup-notification \ - libcanberra \ - libgtop \ - libxres \ - libxpresent \ -" - - -# depends on startup-notification which depends on virtual/libx11 -REQUIRED_DISTRO_FEATURES = "x11" - -inherit gnomebase gsettings gettext upstream-version-is-even features_check - -SRC_URI[archive.sha256sum] = "4ba777e938547bfccbf9acca0967574c46643022e054c93a033419cb3cc7c1ec" -SRC_URI += "file://0001-drop-zenity-detection.patch" - -PACKAGECONFIG[xinerama] = "--enable-xinerama,--disable-xinerama,libxinerama" -# enable as neccessary until new warnings are dealt with -PACKAGECONFIG[werror] = "--enable-Werror,--disable-Werror,," - -FILES:${PN} += " \ - ${datadir}/themes \ - ${datadir}/gnome-control-center \ - ${datadir}/gnome\ -" - -RDEPENDS:${PN} += "gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.1.bb new file mode 100644 index 0000000000..3ada6515f8 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/metacity/metacity_3.46.1.bb @@ -0,0 +1,39 @@ +SECTION = "x11/wm" +SUMMARY = "Metacity is the boring window manager for the adult in you" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=b4cce53560b8e619ffa7c830fb8761aa \ + file://src/include/main.h;endline=24;md5=72148ede07a6dadd01de6a882d20a9ad" + +PE = "1" + +DEPENDS = " \ + gdk-pixbuf-native \ + gtk+3 \ + gsettings-desktop-schemas \ + startup-notification \ + libcanberra \ + libgtop \ + libxres \ + libxpresent \ +" + + +# depends on startup-notification which depends on virtual/libx11 +REQUIRED_DISTRO_FEATURES = "x11" + +inherit gnomebase gsettings gettext upstream-version-is-even features_check + +SRC_URI[archive.sha256sum] = "00ba49f7612088f2b3baeca79c45eb2a30423c2e4a7bea4015872beae25dd6c5" +SRC_URI += "file://0001-drop-zenity-detection.patch" + +PACKAGECONFIG[xinerama] = "--enable-xinerama,--disable-xinerama,libxinerama" +# enable as neccessary until new warnings are dealt with +PACKAGECONFIG[werror] = "--enable-Werror,--disable-Werror,," + +FILES:${PN} += " \ + ${datadir}/themes \ + ${datadir}/gnome-control-center \ + ${datadir}/gnome\ +" + +RDEPENDS:${PN} += "gsettings-desktop-schemas" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_42.0.bb deleted file mode 100644 index 7855362800..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_42.0.bb +++ /dev/null @@ -1,98 +0,0 @@ -SUMMARY = "Window and compositing manager based on Clutter" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -DEPENDS = " \ - xserver-xorg-cvt-native \ - wayland-native \ - virtual/libx11 \ - graphene \ - gtk+3 \ - gdk-pixbuf \ - cairo \ - pango \ - gsettings-desktop-schemas \ - json-glib \ - gnome-desktop \ - gnome-settings-daemon \ - libxtst \ - libxkbfile \ - xinerama \ - xwayland \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gobject-introspection gettext features_check - -SRC_URI[archive.sha256sum] = "d1e240446b7f8cd8a3ff9daae336c1c9016193ba7e0769c79a5e6c03849022e5" - -# x11 is still manadatory - see meson.build -REQUIRED_DISTRO_FEATURES = "wayland x11 polkit" - -# systemd can be replaced by libelogind (not available atow - make systemd -# mandatory distro feature) -LOGIND ?= "systemd" -REQUIRED_DISTRO_FEATURES += "systemd" - -# profiler requires sysprof 3.34 which is not willing to build atow -PACKAGECONFIG ??= " \ - native-backend \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'opengl glx', '', d)} \ - sm \ - startup-notification \ -" - -EXTRA_OEMESON += " \ - -Dtests=false \ - -Dnative_tests=false \ - -Dxwayland_path=${bindir}/Xwayland \ -" - -# combi-config - see meson_options.txt for more details -PACKAGECONFIG[native-backend] = "-Dnative_backend=true -Dudev=true, -Dnative_backend=false -Dudev=false, libdrm virtual/libgbm libinput ${LOGIND} virtual/egl virtual/libgles2 udev" -PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=true, virtual/libgl" -PACKAGECONFIG[glx] = "-Dglx=true, -Dglx=false" -PACKAGECONFIG[libwacom] = "-Dlibwacom=true, -Dlibwacom=false, libwacom" -# Remove depending on pipewire-0.2 when mutter is upgraded to 3.36+ -PACKAGECONFIG[remote-desktop] = "-Dremote_desktop=true, -Dremote_desktop=false, pipewire" -PACKAGECONFIG[sm] = "-Dsm=true, -Dsm=false, libsm" -PACKAGECONFIG[profiler] = "-Dprofiler=true,-Dprofiler=false,sysprof" -PACKAGECONFIG[startup-notification] = "-Dstartup_notification=true, -Dstartup_notification=false, startup-notification, startup-notification" - -MUTTER_API_NAME = "mutter-10" - -do_install:append() { - # Add gir links in standard paths. That makes dependents life much easier - # to find them - install -d ${D}${datadir}/gir-1.0 - for gir_full in `find ${D}${libdir}/${MUTTER_API_NAME} -name '*.gir'`; do - gir=`basename "$gir_full"` - ln -sr "${D}${libdir}/${MUTTER_API_NAME}/$gir" "${D}${datadir}/gir-1.0/$gir" - done -} - -GSETTINGS_PACKAGE = "${PN}-gsettings" - -PACKAGES =+ "${PN}-tests ${PN}-gsettings" - -FILES:${PN} += " \ - ${datadir}/gnome-control-center \ - ${libdir}/${MUTTER_API_NAME}/lib*${SOLIBS} \ - ${libdir}/${MUTTER_API_NAME}/*.typelib \ - ${libdir}/${MUTTER_API_NAME}/plugins \ -" - -FILES:${PN}-tests += " \ - ${datadir}/installed-tests \ - ${datadir}/${MUTTER_API_NAME}/tests \ - ${libexecdir}/installed-tests/${MUTTER_API_NAME} \ -" - -FILES:${PN}-dev += " \ - ${libdir}/${MUTTER_API_NAME}/*.gir \ - ${libdir}/${MUTTER_API_NAME}/lib*.so \ -" - -RDEPENDS:${PN} += "zenity ${PN}-gsettings" - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_43.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_43.1.bb new file mode 100644 index 0000000000..9b764c666b --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_43.1.bb @@ -0,0 +1,99 @@ +SUMMARY = "Window and compositing manager based on Clutter" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS = " \ + xserver-xorg-cvt-native \ + wayland-native \ + virtual/libx11 \ + graphene \ + gtk4 \ + gdk-pixbuf \ + cairo \ + pango \ + gsettings-desktop-schemas \ + json-glib \ + gnome-desktop \ + gnome-settings-daemon \ + libxtst \ + libxkbfile \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xinerama', '', d)} \ + xwayland \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gsettings gobject-introspection gettext features_check + +SRC_URI[archive.sha256sum] = "f2f08b252783948a5ecc82f00e9e935a61ebbf8564844bdd92788ab44aa78264" + +# x11 is still manadatory - see meson.build +REQUIRED_DISTRO_FEATURES = "wayland x11 polkit" + +# systemd can be replaced by libelogind (not available atow - make systemd +# mandatory distro feature) +LOGIND ?= "systemd" +REQUIRED_DISTRO_FEATURES += "systemd" + +# profiler requires sysprof 3.34 which is not willing to build atow +PACKAGECONFIG ??= " \ + native-backend \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'opengl glx', '', d)} \ + sm \ + startup-notification \ +" + +EXTRA_OEMESON += " \ + -Dtests=false \ + -Dnative_tests=false \ + -Dxwayland_path=${bindir}/Xwayland \ +" + +# combi-config - see meson_options.txt for more details +PACKAGECONFIG[native-backend] = "-Dnative_backend=true -Dudev=true, -Dnative_backend=false -Dudev=false, libdrm virtual/libgbm libinput ${LOGIND} virtual/egl virtual/libgles2 udev" +PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=true, virtual/libgl" +PACKAGECONFIG[glx] = "-Dglx=true, -Dglx=false" +PACKAGECONFIG[libwacom] = "-Dlibwacom=true, -Dlibwacom=false, libwacom" +# Remove depending on pipewire-0.2 when mutter is upgraded to 3.36+ +PACKAGECONFIG[remote-desktop] = "-Dremote_desktop=true, -Dremote_desktop=false, pipewire" +PACKAGECONFIG[sm] = "-Dsm=true, -Dsm=false, libsm" +PACKAGECONFIG[profiler] = "-Dprofiler=true,-Dprofiler=false,sysprof" +PACKAGECONFIG[startup-notification] = "-Dstartup_notification=true, -Dstartup_notification=false, startup-notification, startup-notification" + +MUTTER_API_NAME = "mutter-11" + +do_install:append() { + # Add gir links in standard paths. That makes dependents life much easier + # to find them + install -d ${D}${datadir}/gir-1.0 + for gir_full in `find ${D}${libdir}/${MUTTER_API_NAME} -name '*.gir'`; do + gir=`basename "$gir_full"` + ln -sr "${D}${libdir}/${MUTTER_API_NAME}/$gir" "${D}${datadir}/gir-1.0/$gir" + done +} + +GSETTINGS_PACKAGE = "${PN}-gsettings" + +PACKAGES =+ "${PN}-tests ${PN}-gsettings" + +FILES:${PN} += " \ + ${datadir}/gnome-control-center \ + ${datadir}/gir-1.0 \ + ${libdir}/${MUTTER_API_NAME}/lib*${SOLIBS} \ + ${libdir}/${MUTTER_API_NAME}/*.typelib \ + ${libdir}/${MUTTER_API_NAME}/plugins \ +" + +FILES:${PN}-tests += " \ + ${datadir}/installed-tests \ + ${datadir}/${MUTTER_API_NAME}/tests \ + ${libexecdir}/installed-tests/${MUTTER_API_NAME} \ +" + +FILES:${PN}-dev += " \ + ${libdir}/${MUTTER_API_NAME}/*.gir \ + ${libdir}/${MUTTER_API_NAME}/lib*.so \ +" + +RDEPENDS:${PN} += "zenity ${PN}-gsettings" + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/nautilus/nautilus_42.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/nautilus/nautilus_42.2.bb deleted file mode 100644 index a0f928ce25..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/nautilus/nautilus_42.2.bb +++ /dev/null @@ -1,46 +0,0 @@ -SUMMARY = "File manager for GNOME" -SECTION = "x11/gnome" - -LICENSE="GPL-3.0-only" -LIC_FILES_CHKSUM = "file://LICENSE;md5=d32239bcb673463ab874e80d47fae504" - -GNOMEBASEBUILDCLASS = "meson" - -DEPENDS = " \ - fontconfig \ - gtk+3 \ - gnome-desktop \ - gsettings-desktop-schemas \ - gnome-autoar \ - tracker \ - libhandy \ -" - -inherit gnomebase gsettings gobject-introspection gtk-doc gettext features_check mime-xdg - -def gnome_verdir(v): - return oe.utils.trim_version(v, 1) - -SRC_URI += " file://0001-Provide-parameter-prototype-for-functions-without-pa.patch" -SRC_URI[archive.sha256sum] = "99212d2eb75996f181728ad04a2e2d86f2577b064e68a34c8b81a7037df4ccb2" - -REQUIRED_DISTRO_FEATURES = "x11" - -EXTRA_OEMESON += " \ - -Dtests=none \ -" - -PACKAGECONFIG = "extensions" -PACKAGECONFIG[extensions] = "-Dextensions=true,-Dextensions=false, gexiv2 gstreamer1.0-plugins-base" -PACKAGECONFIG[libportal] = "-Dlibportal=true,-Dlibportal=false, libportal" - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/metainfo \ - ${datadir}/gnome-shell \ - ${datadir}/tracker3 \ -" - -# mandatory - not checked during configuration: -# | (org.gnome.Nautilus:863): GLib-GIO-ERROR **: 21:03:52.326: Settings schema 'org.freedesktop.Tracker.Miner.Files' is not installed -RDEPENDS:${PN} += "tracker-miners" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/nautilus/nautilus_43.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/nautilus/nautilus_43.1.bb new file mode 100644 index 0000000000..a567e5fe76 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/nautilus/nautilus_43.1.bb @@ -0,0 +1,50 @@ +SUMMARY = "File manager for GNOME" +SECTION = "x11/gnome" + +LICENSE="GPL-3.0-only" +LIC_FILES_CHKSUM = "file://LICENSE;md5=d32239bcb673463ab874e80d47fae504" + +GNOMEBASEBUILDCLASS = "meson" + +DEPENDS = " \ + appstream-glib-native \ + desktop-file-utils-native \ + glib-2.0 \ + gnome-autoar \ + gnome-desktop \ + gtk4 \ + libadwaita \ + libcloudproviders \ + libhandy \ + libportal \ + libxml2 \ + tracker \ +" + +inherit gnomebase gsettings gobject-introspection gtk-doc gettext features_check mime-xdg gtk-icon-cache + +def gnome_verdir(v): + return oe.utils.trim_version(v, 1) + +SRC_URI[archive.sha256sum] = "0da1003c0cda08ac0546a4c143ed3a1697e36823c60fa73f4d2f4da7723bccaf" + +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +EXTRA_OEMESON += " \ + -Dtests=none \ +" + +PACKAGECONFIG = "extensions" +PACKAGECONFIG[extensions] = "-Dextensions=true,-Dextensions=false, gexiv2 gstreamer1.0-plugins-base gdk-pixbuf" +PACKAGECONFIG[packagekit] = "-Dpackagekit=true,-Dpackagekit=false,packagekit" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/metainfo \ + ${datadir}/gnome-shell \ + ${datadir}/tracker3 \ +" + +# mandatory - not checked during configuration: +# | (org.gnome.Nautilus:863): GLib-GIO-ERROR **: 21:03:52.326: Settings schema 'org.freedesktop.Tracker.Miner.Files' is not installed +RDEPENDS:${PN} += "tracker-miners bubblewrap" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/rest/librest_0.8.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/rest/librest_0.8.1.bb new file mode 100644 index 0000000000..23849783cc --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/rest/librest_0.8.1.bb @@ -0,0 +1,35 @@ +SUMMARY = "library to access web services that claim to be "RESTful"" +HOMEPAGE = "https://wiki.gnome.org/Projects/Librest" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=2d5025d4aa3495befef8f17206a5b0a1" + +DEPENDS = " \ + gi-docgen \ + gi-docgen-native \ + glib-2.0 \ + glib-2.0-native \ + json-glib \ + libsoup-2.4 \ + libxml2-native \ +" + +inherit gnomebase gobject-introspection vala pkgconfig + +GNOMEBN = "rest" + +SRC_URI[archive.sha256sum] = "0513aad38e5d3cedd4ae3c551634e3be1b9baaa79775e53b2dba9456f15b01c9" + +S = "${WORKDIR}/${GNOMEBN}-${PV}" +# * gnome environment requires libsoup build with in gnome PACKAGECONFIG +# * libsoup-gnome support was removed upstream three years ago [1] +# [1] https://gitlab.gnome.org/GNOME/librest/commit/8f904a8e2bb38a7bf72245cdf2f1ecad17e9a720 +EXTRA_OECONF = "--without-gnome" + +do_configure:prepend() { + # rest expects introspection.m4 at custom location (see aclocal.m4). + cp -f ${STAGING_DIR_TARGET}/${datadir}/aclocal/introspection.m4 ${S}/build +} + +do_compile:prepend() { + export GIR_EXTRA_LIBS_PATH="${B}/rest/.libs" +} diff --git a/meta-openembedded/meta-gnome/recipes-gnome/tepl/tepl_6.00.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/tepl/tepl_6.00.0.bb deleted file mode 100644 index 66de215cfa..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/tepl/tepl_6.00.0.bb +++ /dev/null @@ -1,26 +0,0 @@ -SUMMARY = "Tepl library eases the development of GtkSourceView-based projects" -LICENSE = "LGPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://LICENSES/LGPL-3.0-or-later.txt;md5=c51d3eef3be114124d11349ca0d7e117" - -DEPENDS = " \ - glib-2.0-native \ - gtk+3 \ - gtksourceview4 \ - amtk \ - libxml2 \ - uchardet \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gobject-introspection gettext features_check - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -SRC_URI[archive.sha256sum] = "a86397a895dca9c0de7a5ccb063bda8f7ef691cccb950ce2cfdee367903e7a63" - -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES += "gobject-introspection-data" -GIR_MESON_OPTION = "" - -GTKDOC_MESON_OPTION = "gtk_doc" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/tepl/tepl_6.4.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/tepl/tepl_6.4.0.bb new file mode 100644 index 0000000000..1eecfff4b0 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/tepl/tepl_6.4.0.bb @@ -0,0 +1,31 @@ +SUMMARY = "Tepl library eases the development of GtkSourceView-based projects" +LICENSE = "LGPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSES/LGPL-3.0-or-later.txt;md5=c51d3eef3be114124d11349ca0d7e117" + +DEPENDS = " \ + gsettings-desktop-schemas \ + glib-2.0 \ + gtk+3 \ + gtksourceview4 \ + amtk \ + libxml2 \ + uchardet \ + gtk-doc-native \ + libxslt-native \ + docbook-xsl-stylesheets-native \ + python3-pygments-native \ +" + +inherit meson gobject-introspection gettext features_check pkgconfig + + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" +SRC_URI = "git://gitlab.gnome.org/swilmet/tepl;protocol=https;branch=main" +SRCREV = "d1e9cc2e4a0738f68d9002f13724b7239f075844" +S = "${WORKDIR}/git" + +# gobject-introspection is mandatory and cannot be configured +REQUIRED_DISTRO_FEATURES += "gobject-introspection-data" +GIR_MESON_OPTION = "" + +GTKDOC_MESON_OPTION = "gtk_doc" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker-miners_3.4.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker-miners_3.4.1.bb deleted file mode 100644 index 273110e8ef..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker-miners_3.4.1.bb +++ /dev/null @@ -1,76 +0,0 @@ -SUMMARY = "Tracker miners and metadata extractors" -LICENSE = "GPL-2.0-only & LGPL-2.1-only" -LIC_FILES_CHKSUM = " \ - file://COPYING.GPL;md5=ee31012bf90e7b8c108c69f197f3e3a4 \ - file://COPYING.LGPL;md5=2d5025d4aa3495befef8f17206a5b0a1 \ -" - -DEPENDS = " \ - intltool-native \ - tracker \ - zlib \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gobject-introspection vala bash-completion features_check - -SRC_URI += "file://0001-meson.build-Just-warn-if-we-build-without-libseccomp.patch \ - file://0001-Set-header-file-to-a-fixed-path-instead-of-a-host-pa.patch \ - " - -SRC_URI[archive.sha256sum] = "2fce0ec85fb7617c8b2887c22797740d5dec84ec036db74d6c208bbab5c58c24" - -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" -GIR_MESON_OPTION = "" - -PACKAGECONFIG ??= " \ - ${@bb.utils.contains("LICENSE_FLAGS_ACCEPTED", "commercial", "ffmpeg", "", d)} \ - gexiv2 \ - gstreamer \ - icu \ - libexif \ - libgsf \ - jpeg \ - pdf \ - png \ - tiff \ - xml \ - ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ -" - -PACKAGECONFIG[battery] = "-Dbattery_detection=upower,-Dbattery_detection=none,upower" -PACKAGECONFIG[ffmpeg] = ",,ffmpeg" -PACKAGECONFIG[gexiv2] = ",,gexiv2" -PACKAGECONFIG[gstreamer] = ",,gstreamer1.0 gstreamer1.0-plugins-base" -PACKAGECONFIG[gupnp] = ",,gupnp-dlna" -PACKAGECONFIG[gif] = "-Dgif=enabled,-Dgif=disabled,giflib" -PACKAGECONFIG[icu] = ",,icu" -PACKAGECONFIG[jpeg] = "-Djpeg=enabled,-Djpeg=disabled,jpeg" -PACKAGECONFIG[libexif] = "-Dexif=enabled,-Dexif=disabled,libexif" -PACKAGECONFIG[libgsf] = "-Dgsf=enabled,-Dgsf=disabled,libgsf" -PACKAGECONFIG[pdf] = "-Dpdf=enabled,-Dpdf=disabled,poppler" -PACKAGECONFIG[png] = "-Dpng=enabled,-Dpng=disabled,libpng" -PACKAGECONFIG[tiff] = "-Dtiff=enabled,-Dtiff=disabled,tiff" -PACKAGECONFIG[xml] = "-Dxml=enabled,-Dxml=disabled,libxml2" -PACKAGECONFIG[networkmanager] = "-Dnetwork_manager=enabled,-Dnetwork_manager=disabled,networkmanger" - -# For security reasons it is strongly recommended to set add meta-security in -# your layers and 'libseccomp' to PACKAGECONFIG". -PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" -# not yet in meta-gnome -PACKAGECONFIG[rss] = "-Dminer_rss=true,-Dminer_rss=false,libgrss" - -EXTRA_OEMESON += " \ - -Dman=false \ - -Dsystemd_user_services=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)} \ - -Dsystemd_user_services_dir=${systemd_user_unitdir} \ -" - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/tracker3-miners \ - ${libdir}/tracker-miners-3.0 \ - ${systemd_user_unitdir} \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker-miners_3.4.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker-miners_3.4.2.bb new file mode 100644 index 0000000000..cbd1d0ddb4 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker-miners_3.4.2.bb @@ -0,0 +1,76 @@ +SUMMARY = "Tracker miners and metadata extractors" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" +LIC_FILES_CHKSUM = " \ + file://COPYING.GPL;md5=ee31012bf90e7b8c108c69f197f3e3a4 \ + file://COPYING.LGPL;md5=2d5025d4aa3495befef8f17206a5b0a1 \ +" + +DEPENDS = " \ + intltool-native \ + tracker \ + zlib \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gsettings gobject-introspection vala bash-completion features_check + +SRC_URI += "file://0001-meson.build-Just-warn-if-we-build-without-libseccomp.patch \ + file://0001-Set-header-file-to-a-fixed-path-instead-of-a-host-pa.patch \ + " + +SRC_URI[archive.sha256sum] = "101e3608f1c28bfed8ae25522f7a720b559f889a76e280afbe50a4d8b064f92c" + +# gobject-introspection is mandatory and cannot be configured +REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" +GIR_MESON_OPTION = "" + +PACKAGECONFIG ??= " \ + ${@bb.utils.contains("LICENSE_FLAGS_ACCEPTED", "commercial", "ffmpeg", "", d)} \ + gexiv2 \ + gstreamer \ + icu \ + libexif \ + libgsf \ + jpeg \ + pdf \ + png \ + tiff \ + xml \ + ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ +" + +PACKAGECONFIG[battery] = "-Dbattery_detection=upower,-Dbattery_detection=none,upower" +PACKAGECONFIG[ffmpeg] = ",,ffmpeg" +PACKAGECONFIG[gexiv2] = ",,gexiv2" +PACKAGECONFIG[gstreamer] = ",,gstreamer1.0 gstreamer1.0-plugins-base" +PACKAGECONFIG[gupnp] = ",,gupnp-dlna" +PACKAGECONFIG[gif] = "-Dgif=enabled,-Dgif=disabled,giflib" +PACKAGECONFIG[icu] = ",,icu" +PACKAGECONFIG[jpeg] = "-Djpeg=enabled,-Djpeg=disabled,jpeg" +PACKAGECONFIG[libexif] = "-Dexif=enabled,-Dexif=disabled,libexif" +PACKAGECONFIG[libgsf] = "-Dgsf=enabled,-Dgsf=disabled,libgsf" +PACKAGECONFIG[pdf] = "-Dpdf=enabled,-Dpdf=disabled,poppler" +PACKAGECONFIG[png] = "-Dpng=enabled,-Dpng=disabled,libpng" +PACKAGECONFIG[tiff] = "-Dtiff=enabled,-Dtiff=disabled,tiff" +PACKAGECONFIG[xml] = "-Dxml=enabled,-Dxml=disabled,libxml2" +PACKAGECONFIG[networkmanager] = "-Dnetwork_manager=enabled,-Dnetwork_manager=disabled,networkmanger" + +# For security reasons it is strongly recommended to set add meta-security in +# your layers and 'libseccomp' to PACKAGECONFIG". +PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" +# not yet in meta-gnome +PACKAGECONFIG[rss] = "-Dminer_rss=true,-Dminer_rss=false,libgrss" + +EXTRA_OEMESON += " \ + -Dman=false \ + -Dsystemd_user_services=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)} \ + -Dsystemd_user_services_dir=${systemd_user_unitdir} \ +" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/tracker3-miners \ + ${libdir}/tracker-miners-3.0 \ + ${systemd_user_unitdir} \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker_3.4.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker_3.4.1.bb deleted file mode 100644 index 1428159ce3..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker_3.4.1.bb +++ /dev/null @@ -1,53 +0,0 @@ -SUMMARY = "Tracker is a file search engine" -LICENSE = "GPL-2.0-only & LGPL-2.1-only" -LIC_FILES_CHKSUM = " \ - file://COPYING.GPL;md5=ee31012bf90e7b8c108c69f197f3e3a4 \ - file://COPYING.LGPL;md5=2d5025d4aa3495befef8f17206a5b0a1 \ -" - -DEPENDS = " \ - dbus-native \ - python3-pygobject-native \ - glib-2.0 \ - sqlite3 \ - libarchive \ - dbus \ - icu \ - json-glib \ - libsoup-2.4 \ - libstemmer \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gsettings gobject-introspection vala gtk-doc manpages bash-completion features_check python3native - -SRC_URI[archive.sha256sum] = "ea9d41a9fb9c2b42ad80fc2c82327b5c713d594c969b09e1a49be63fb74f4fae" - -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" -GIR_MESON_OPTION = "" - -# text search is not an option anymore and requires sqlite3 build with -# PACKAGECONFIG[fts5] set (default) - -# set required cross property sqlite3_has_fts5 -do_write_config[vardeps] += "PACKAGECONFIG" -do_write_config:append() { - echo "[properties]" > ${WORKDIR}/meson-tracker.cross - echo "sqlite3_has_fts5 = 'true'" >> ${WORKDIR}/meson-tracker.cross -} - -EXTRA_OEMESON = " \ - --cross-file ${WORKDIR}/meson-tracker.cross \ - -Dman=false \ - -Dsystemd_user_services=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)} \ - -Dsystemd_user_services_dir=${systemd_user_unitdir} \ -" - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/tracker3 \ - ${libdir}/tracker-3.0 \ - ${systemd_user_unitdir} \ -" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker_3.4.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker_3.4.2.bb new file mode 100644 index 0000000000..0cc6089ae4 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/tracker/tracker_3.4.2.bb @@ -0,0 +1,54 @@ +SUMMARY = "Tracker is a file search engine" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" +LIC_FILES_CHKSUM = " \ + file://COPYING.GPL;md5=ee31012bf90e7b8c108c69f197f3e3a4 \ + file://COPYING.LGPL;md5=2d5025d4aa3495befef8f17206a5b0a1 \ +" + +DEPENDS = " \ + dbus-native \ + python3-pygobject-native \ + glib-2.0 \ + sqlite3 \ + libarchive \ + dbus \ + icu \ + json-glib \ + libsoup-3.0 \ + libstemmer \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gsettings gobject-introspection vala gtk-doc manpages bash-completion features_check python3native + +SRC_URI[archive.sha256sum] = "4e6df142a4f704878fca98ebb5a224750e5ea546aa2aaabaa726a73540bd1731" + +# gobject-introspection is mandatory and cannot be configured +REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" +GIR_MESON_OPTION = "" + +# text search is not an option anymore and requires sqlite3 build with +# PACKAGECONFIG[fts5] set (default) + +# set required cross property sqlite3_has_fts5 +do_write_config[vardeps] += "PACKAGECONFIG" +do_write_config:append() { + echo "[properties]" > ${WORKDIR}/meson-tracker.cross + echo "sqlite3_has_fts5 = 'true'" >> ${WORKDIR}/meson-tracker.cross +} + +EXTRA_OEMESON = " \ + --cross-file ${WORKDIR}/meson-tracker.cross \ + -Dman=false \ + -Dsystemd_user_services=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)} \ + -Dsystemd_user_services_dir=${systemd_user_unitdir} \ + -Dsoup=soup3 \ +" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/tracker3 \ + ${libdir}/tracker-3.0 \ + ${systemd_user_unitdir} \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_42.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_42.0.bb deleted file mode 100644 index a5da8590ff..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_42.0.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "Collection of scripts and build utilities for documentation" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=d67c6f9f1515506abfea4f0d920c0774 \ - file://COPYING.GPL;md5=eb723b61539feef013de476e68b5c50a \ -" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase itstool - -DEPENDS += " \ - libxslt-native \ - libxml2-native \ - python3-lxml-native \ - yelp-xsl \ -" - -SRC_URI[archive.sha256sum] = "2cd43063ffa7262df15dd8d379aa3ea3999d42661f07563f4802daa1149f7df4" - -RDEPENDS:${PN} += "python3-core yelp-xsl" - -BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_42.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_42.1.bb new file mode 100644 index 0000000000..28ba392884 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_42.1.bb @@ -0,0 +1,23 @@ +SUMMARY = "Collection of scripts and build utilities for documentation" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=d67c6f9f1515506abfea4f0d920c0774 \ + file://COPYING.GPL;md5=eb723b61539feef013de476e68b5c50a \ +" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase itstool + +DEPENDS += " \ + libxslt-native \ + libxml2-native \ + python3-lxml-native \ + yelp-xsl \ +" + +SRC_URI[archive.sha256sum] = "3e496a4020d4145b99fd508a25fa09336a503a4e8900028421e72c6a4b11f905" + +RDEPENDS:${PN} += "python3-core yelp-xsl" + +BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-gnome/recipes-support/appstream-glib/appstream-glib_0.7.18.bb b/meta-openembedded/meta-gnome/recipes-support/appstream-glib/appstream-glib_0.7.18.bb deleted file mode 100644 index c56e9e3dd9..0000000000 --- a/meta-openembedded/meta-gnome/recipes-support/appstream-glib/appstream-glib_0.7.18.bb +++ /dev/null @@ -1,39 +0,0 @@ -SUMMARY = "Objects and helper methods to help reading and writing AppStream metadata" -HOMEPAGE = "https://people.freedesktop.org/~hughsient/appstream-glib/index.htm" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" - -DEPENDS = " \ - gperf-native \ - glib-2.0 \ - gtk+3 \ - libyaml \ - libarchive \ - libsoup-2.4 \ - json-glib \ - gdk-pixbuf \ - freetype \ - fontconfig \ - libstemmer \ -" - -inherit meson gobject-introspection gettext bash-completion pkgconfig manpages - -SRC_URI = "https://people.freedesktop.org/~hughsient/${BPN}/releases/${BP}.tar.xz" -SRC_URI[sha256sum] = "ca1ed22e3bde3912cb903aaa7de085d55771da454f1c0573fd9608e1de9c4002" - -EXTRA_OEMESON = " \ - -Drpm=false \ -" - -PACKAGECONFIG ?= "" -PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,docbook-xml-dtd4-native docbook-xsl-stylesheets-native libxslt-native" - -FILES:${PN} += "${libdir}/asb-plugins-5" - -FILES:${PN}-dev += " \ - ${datadir}/installed-tests \ - ${datadir}/gettext \ -" - -BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-gnome/recipes-support/appstream-glib/appstream-glib_0.8.2.bb b/meta-openembedded/meta-gnome/recipes-support/appstream-glib/appstream-glib_0.8.2.bb new file mode 100644 index 0000000000..efb85d77c5 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-support/appstream-glib/appstream-glib_0.8.2.bb @@ -0,0 +1,39 @@ +SUMMARY = "Objects and helper methods to help reading and writing AppStream metadata" +HOMEPAGE = "https://people.freedesktop.org/~hughsient/appstream-glib/index.htm" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" + +DEPENDS = " \ + curl \ + gperf-native \ + glib-2.0 \ + gtk+3 \ + libyaml \ + libarchive \ + json-glib \ + gdk-pixbuf \ + freetype \ + fontconfig \ + libstemmer \ +" + +inherit meson gobject-introspection gettext bash-completion pkgconfig manpages + +SRC_URI = "https://people.freedesktop.org/~hughsient/${BPN}/releases/${BP}.tar.xz" +SRC_URI[sha256sum] = "71256500add5048d6f08878904708b3d0c3875f402e0adcd358e91d47dcd8b96" + +EXTRA_OEMESON = " \ + -Drpm=false \ +" + +PACKAGECONFIG ?= "" +PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,docbook-xml-dtd4-native docbook-xsl-stylesheets-native libxslt-native" + +FILES:${PN} += "${libdir}/asb-plugins-5" + +FILES:${PN}-dev += " \ + ${datadir}/installed-tests \ + ${datadir}/gettext \ +" + +BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-gnome/recipes-support/ibus/ibus.bb b/meta-openembedded/meta-gnome/recipes-support/ibus/ibus.bb index be43d0d500..7156081499 100644 --- a/meta-openembedded/meta-gnome/recipes-support/ibus/ibus.bb +++ b/meta-openembedded/meta-gnome/recipes-support/ibus/ibus.bb @@ -8,7 +8,7 @@ DEPENDS += " \ iso-codes \ " -inherit gtk-icon-cache bash-completion +inherit gtk-icon-cache bash-completion features_check # for unicode-ucd EXTRA_OECONF += "--with-ucd-dir=${STAGING_DATADIR}/unicode/ucd" @@ -19,6 +19,8 @@ PACKAGECONFIG ??= " \ ${@bb.utils.filter('DISTRO_FEATURES', 'systemd wayland x11', d)} \ " +REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('PACKAGECONFIG', 'gtk4', 'opengl', '', d)}" + do_configure:prepend() { # run native unicode-parser sed -i 's:$(builddir)/unicode-parser:unicode-parser:g' ${S}/src/Makefile.am diff --git a/meta-openembedded/meta-gnome/recipes-support/libcloudproviders/libcloudproviders_0.3.1.bb b/meta-openembedded/meta-gnome/recipes-support/libcloudproviders/libcloudproviders_0.3.1.bb new file mode 100644 index 0000000000..b6448b9398 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-support/libcloudproviders/libcloudproviders_0.3.1.bb @@ -0,0 +1,11 @@ +SUMMARY = "libcloudproviders is a DBus API that allows cloud storage sync clients to expose their services." +LICENSE="LGPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e6a600fd5e1d9cbde2d983680233ad02" + +GNOMEBASEBUILDCLASS = "meson" + +DEPENDS = "glib-2.0" + +inherit gnomebase gobject-introspection vala + +SRC_URI[archive.sha256sum] = "4763213ca1e1fe30d422f5ae3b4f02a454f63414c1860ad142d6385f89d05929" diff --git a/meta-openembedded/meta-gnome/recipes-support/libstemmer/libstemmer/0001-Build-so-lib.patch b/meta-openembedded/meta-gnome/recipes-support/libstemmer/libstemmer/0001-Build-so-lib.patch deleted file mode 100644 index 37c5c3dc02..0000000000 --- a/meta-openembedded/meta-gnome/recipes-support/libstemmer/libstemmer/0001-Build-so-lib.patch +++ /dev/null @@ -1,63 +0,0 @@ -From eacc9e9c62a3857ce1e2e24b81fc22d8ae91f422 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andreas=20M=C3=BCller?= -Date: Thu, 9 May 2019 22:06:48 +0200 -Subject: [PATCH] Build so-lib -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Stolen from [1] - -[1] https://aur.archlinux.org/cgit/aur.git/commit/dynamiclib.patch?h=snowball-git&id=a9cbf4f42f3661e4b8f791cd4374233821716ea1 - -Upstream-Status: Pending - -Signed-off-by: Andreas Müller ---- - GNUmakefile | 7 +++++-- - libstemmer/symbol.map | 6 ++++++ - 2 files changed, 11 insertions(+), 2 deletions(-) - create mode 100644 libstemmer/symbol.map - -diff --git a/GNUmakefile b/GNUmakefile -index cbd6ff7..a85230b 100644 ---- a/GNUmakefile -+++ b/GNUmakefile -@@ -162,10 +162,10 @@ C_OTHER_OBJECTS = $(C_OTHER_SOURCES:.c=.o) - JAVA_CLASSES = $(JAVA_SOURCES:.java=.class) - JAVA_RUNTIME_CLASSES=$(JAVARUNTIME_SOURCES:.java=.class) - --CFLAGS=-O2 -W -Wall -Wmissing-prototypes -Wmissing-declarations -+CFLAGS=-O2 -fPIC -W -Wall -Wmissing-prototypes -Wmissing-declarations - CPPFLAGS=-Iinclude - --all: snowball libstemmer.o stemwords $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS) -+all: snowball libstemmer.o libstemmer.so stemwords $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS) - - clean: - rm -f $(COMPILER_OBJECTS) $(RUNTIME_OBJECTS) \ -@@ -212,6 +212,9 @@ libstemmer/libstemmer.o: libstemmer/modules.h $(C_LIB_HEADERS) - libstemmer.o: libstemmer/libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS) - $(AR) -cru $@ $^ - -+libstemmer.so: libstemmer/libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS) -+ $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname,libstemmer.so.0,-version-script,libstemmer/symbol.map -o $@.0.0.0 $^ -+ - stemwords: $(STEMWORDS_OBJECTS) libstemmer.o - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ - -diff --git a/libstemmer/symbol.map b/libstemmer/symbol.map -new file mode 100644 -index 0000000..7a3d423 ---- /dev/null -+++ b/libstemmer/symbol.map -@@ -0,0 +1,6 @@ -+SB_STEMMER_0 { -+ global: -+ sb_stemmer_*; -+ local: -+ *; -+}; --- -2.20.1 - diff --git a/meta-openembedded/meta-gnome/recipes-support/libstemmer/libstemmer_git.bb b/meta-openembedded/meta-gnome/recipes-support/libstemmer/libstemmer_git.bb deleted file mode 100644 index 7f0706e207..0000000000 --- a/meta-openembedded/meta-gnome/recipes-support/libstemmer/libstemmer_git.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "Snowball compiler and stemming algorithms" -HOMEPAGE = "https://snowballstem.org/" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://COPYING;md5=19139aaf3c8c8fa1ca6edd59c072fb9f" - -DEPENDS:class-target = "${BPN}-native" - -SRC_URI = "\ - git://github.com/snowballstem/snowball.git;branch=master;protocol=https \ - file://0001-Build-so-lib.patch \ -" -SRCREV = "4764395431c8f2a0b4fe18b816ab1fc966a45837" -S = "${WORKDIR}/git" -PV = "2.1.0" -LIBVER = "0.0.0" - -inherit lib_package - -BBCLASSEXTEND = "native" - -do_compile:prepend:class-target() { - # use native tools - sed -i 's:./snowball :snowball :g' ${S}/GNUmakefile -} - -do_install() { - install -d ${D}${bindir} - install -m 755 ${S}/snowball ${D}${bindir} - install -m 755 ${S}/stemwords ${D}${bindir} - - install -d ${D}${libdir} - install -m 755 ${S}/libstemmer.so.${LIBVER} ${D}${libdir}/ - ln -s libstemmer.so.${LIBVER} ${D}${libdir}/libstemmer.so.0 - ln -s libstemmer.so.${LIBVER} ${D}${libdir}/libstemmer.so - - install -d ${D}${includedir} - install -m 644 ${S}/include/*.h ${D}${includedir} -} diff --git a/meta-openembedded/meta-gnome/recipes-support/xdg-desktop-portal/xdg-desktop-portal-gnome_43.1.bb b/meta-openembedded/meta-gnome/recipes-support/xdg-desktop-portal/xdg-desktop-portal-gnome_43.1.bb new file mode 100644 index 0000000000..050ce1a04c --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-support/xdg-desktop-portal/xdg-desktop-portal-gnome_43.1.bb @@ -0,0 +1,34 @@ +SUMMARY = "A xdg-desktop-portal backend for gnome." +HOMEPAGE = "https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" + +DEPENDS = " \ + glib-2.0-native \ + gtk4\ + xdg-desktop-portal \ + xdg-desktop-portal-gtk \ + libadwaita \ + fontconfig \ + gsettings-desktop-schemas \ + gnome-desktop \ + dconf \ +" + +RDEPENDS:${PN} = "xdg-desktop-portal xdg-desktop-portal-gtk" + +inherit meson pkgconfig gsettings features_check + +REQUIRED_DISTRO_FEATURES = "polkit" + +SRC_URI = "git://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome.git;protocol=https;nobranch=1" + +S = "${WORKDIR}/git" +SRCREV = "4fd5a8bf16b01c78ed19764415cb26d29aaf7eab" + +PACKAGECONFIG ?= "" + +PACKAGECONFIG[screenshot] = ",,,gnome-shell" +PACKAGECONFIG[screencast] = ",,,mutter" + +FILES:${PN} += "${systemd_user_unitdir} ${datadir}" diff --git a/meta-openembedded/meta-gnome/recipes-support/xdg-desktop-portal/xdg-desktop-portal-gtk_1.14.1.bb b/meta-openembedded/meta-gnome/recipes-support/xdg-desktop-portal/xdg-desktop-portal-gtk_1.14.1.bb new file mode 100644 index 0000000000..1e0a906184 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-support/xdg-desktop-portal/xdg-desktop-portal-gtk_1.14.1.bb @@ -0,0 +1,42 @@ +SUMMARY = "A backend implementation for xdg-desktop-portal that is using GTK and various pieces of GNOME infrastructure." +HOMEPAGE = "https://github.com/flatpak/xdg-desktop-portal-gtk" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" + +DEPENDS = " \ + glib-2.0-native \ + gtk+3\ + xdg-desktop-portal \ + libadwaita \ + fontconfig \ + gsettings-desktop-schemas \ + gnome-desktop \ + dconf \ +" + +inherit gettext autotools pkgconfig gsettings features_check + +REQUIRED_DISTRO_FEATURES = "polkit" + +SRC_URI = "git://github.com/flatpak/xdg-desktop-portal-gtk.git;protocol=https;nobranch=1" + +S = "${WORKDIR}/git" +SRCREV = "952005f6a7850a247d286f14838202f506b402b7" + +# gdbus-codegen wants to create files in ${B}/src and fails because of missing directory +do_configure:append() { + mkdir -p ${B}/src +} + +# Note: wlroots has its own implementation for screenshot and screencast, but +# you may want to include the according PACKAGECONFIGS for gnome. +PACKAGECONFIG ?= "wallpaper appchooser lockdown" + +PACKAGECONFIG[screenshot] = "--enable-screenshot,--disable-screenshot,gnome-shell" +PACKAGECONFIG[screencast] = "--enable-screencast,--disable-screencast,mutter" +PACKAGECONFIG[wallpaper] = "--enable-wallpaper,--disable-wallpaper,gnome-desktop" +PACKAGECONFIG[background] = "--enable-background,--disable-background,gnome-shell" +PACKAGECONFIG[appchooser] = "--enable-appchooser,--disable-appchooser" +PACKAGECONFIG[lockdown] = "--enable-lockdown,--disable-lockdown" + +FILES:${PN} += "${systemd_user_unitdir} ${datadir}" diff --git a/meta-openembedded/meta-initramfs/conf/layer.conf b/meta-openembedded/meta-initramfs/conf/layer.conf index 6aa64f1e18..b4cd74398d 100644 --- a/meta-openembedded/meta-initramfs/conf/layer.conf +++ b/meta-openembedded/meta-initramfs/conf/layer.conf @@ -16,7 +16,7 @@ BBFILE_PATTERN_meta-initramfs := "^${LAYERDIR}/" BBFILE_PRIORITY_meta-initramfs = "5" LAYERDEPENDS_meta-initramfs = "core" -LAYERSERIES_COMPAT_meta-initramfs = "kirkstone langdale" +LAYERSERIES_COMPAT_meta-initramfs = "mickledore" SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \ dracut->virtual/kernel \ diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut/0001-install-Do-not-undef-_FILE_OFFSET_BITS.patch b/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut/0001-install-Do-not-undef-_FILE_OFFSET_BITS.patch new file mode 100644 index 0000000000..170df7119f --- /dev/null +++ b/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut/0001-install-Do-not-undef-_FILE_OFFSET_BITS.patch @@ -0,0 +1,32 @@ +From 7f8ef553b7c433af153d48c6a16b2943780abf67 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 31 Dec 2022 14:41:52 -0800 +Subject: [PATCH] install: Do not undef _FILE_OFFSET_BITS + +_FILE_OFFSET_BITS is a feature test macro to determine largefile +support. Usually its set to 64 on systems supporting LFS. Its also +needed to be set to 64 for supporting 64bit time_t on glibc on 32bit +systems. If its undefined explicitly, then 64bit time_t can not be +enabled. + +Upstream-Status: Submitted [https://github.com/dracutdevs/dracut/pull/2157] +Signed-off-by: Khem Raj +--- + src/install/dracut-install.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/install/dracut-install.c b/src/install/dracut-install.c +index dda0caca..05a67a03 100644 +--- a/src/install/dracut-install.c ++++ b/src/install/dracut-install.c +@@ -22,7 +22,6 @@ + #ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif +-#undef _FILE_OFFSET_BITS + #include + #include + #include +-- +2.39.0 + diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut_056.bb b/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut_056.bb index 7b89006103..364beec5d8 100644 --- a/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut_056.bb +++ b/meta-openembedded/meta-initramfs/recipes-devtools/dracut/dracut_056.bb @@ -11,6 +11,7 @@ SRCREV = "631d5f72a223288aa1f48bb8e8d0313e75947400" SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http;branch=master \ file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \ file://0001-Guard-against-__GLIBC_PREREQ-for-musl-libc.patch \ + file://0001-install-Do-not-undef-_FILE_OFFSET_BITS.patch \ " DEPENDS += "kmod" diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0001-Add-another-variable-LIBS-to-provides-libraries-from.patch b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0001-Add-another-variable-LIBS-to-provides-libraries-from.patch deleted file mode 100644 index dfbe7ba6b4..0000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0001-Add-another-variable-LIBS-to-provides-libraries-from.patch +++ /dev/null @@ -1,24 +0,0 @@ -From b7b3caa9b5c8abcd3c371d0683001cd681e104b3 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 15 Jul 2017 10:19:22 -0700 -Subject: [PATCH 1/2] Add another variable LIBS to provides libraries from env - -Signed-off-by: Khem Raj - ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index cc7e823..ae30a07 100644 ---- a/Makefile -+++ b/Makefile -@@ -31,7 +31,7 @@ ifneq ($(VERBOSE_TEST),) - VERBOSE_TEST="--verbose" - endif - --grubby_LIBS = -lblkid -lpopt -+grubby_LIBS = -lblkid -lpopt ${LIBS} - - all: grubby - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0001-rename-grub2-editenv-to-grub-editenv.patch b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0001-rename-grub2-editenv-to-grub-editenv.patch new file mode 100644 index 0000000000..7e1615c5b5 --- /dev/null +++ b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0001-rename-grub2-editenv-to-grub-editenv.patch @@ -0,0 +1,78 @@ +From 7a72139d2e3cc80f64090a823afe7bcea76e4792 Mon Sep 17 00:00:00 2001 +From: Jackie Huang +Date: Tue, 4 Aug 2015 23:54:41 -0700 +Subject: [PATCH] rename grub2-editenv to grub-editenv + +We don't use the name grub2-editenv for grub2. + +Upstream-Status: Inactive-Upstream [lastcommit: 2022 lastrelease: 2016] + +Signed-off-by: Jackie Huang +--- + grubby.c | 4 ++-- + test.sh | 8 ++++---- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/grubby.c b/grubby.c +index 98c1516..be832f6 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -301,7 +301,7 @@ static char *grub2GetEnv(struct configFileInfo *info, char *name) + char *ret = NULL; + char *envFile = info->envFile ? info->envFile : "/boot/grub2/grubenv"; + int rc = +- asprintf(&s, "grub2-editenv %s list | grep '^%s='", envFile, name); ++ asprintf(&s, "grub-editenv %s list | grep '^%s='", envFile, name); + + if (rc < 0) + return NULL; +@@ -373,7 +373,7 @@ static int grub2SetEnv(struct configFileInfo *info, char *name, char *value) + if (!value) + return -1; + +- rc = asprintf(&s, "grub2-editenv %s set '%s=%s'", envFile, name, value); ++ rc = asprintf(&s, "grub-editenv %s set '%s=%s'", envFile, name, value); + free(value); + if (rc < 0) + return -1; +diff --git a/test.sh b/test.sh +index 33d24cf..009479c 100755 +--- a/test.sh ++++ b/test.sh +@@ -573,7 +573,7 @@ if [ "$testgrub2" == "y" ]; then + --remove-kernel=/boot/vmlinuz-2.6.38.2-9.fc15.x86_64 \ + --boot-filesystem=/boot/ + commandTest "saved_default output" \ +- "grub2-editenv test/grub2-support_files/env_temp list" \ ++ "grub-editenv test/grub2-support_files/env_temp list" \ + "saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64" + + # copy a stanza and add arguments as well, while using --set-index= +@@ -627,7 +627,7 @@ if [ "$testgrub2" == "y" ]; then + --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ + --copy-default + commandTest "saved_default output" \ +- "grub2-editenv test/grub2-support_files/env_temp list" \ ++ "grub-editenv test/grub2-support_files/env_temp list" \ + "saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64" + + testing="GRUB2 add kernel with default=saved_entry and a terrible title" +@@ -640,13 +640,13 @@ if [ "$testgrub2" == "y" ]; then + testing="GRUB2 set default with default=saved_entry and a terrible name" + grub2Test grub2.9 add/g2-1.9 --env grubenv.1 --set-default-index=0 + commandTest "saved_default output" \ +- "grub2-editenv test/grub2-support_files/env_temp list" \ ++ "grub-editenv test/grub2-support_files/env_temp list" \ + 'saved_entry=Fedora (3.10.3-300.fc19.x86_64) 19 (Schrödinger’s Cat)' + + testing="GRUB2 set default with default=saved_entry" + grub2Test grub2.8 add/g2-1.8 --env grubenv.1 --set-default-index=0 + commandTest "saved_default output" \ +- "grub2-editenv test/grub2-support_files/env_temp list" \ ++ "grub-editenv test/grub2-support_files/env_temp list" \ + "saved_entry=title" + + testing="GRUB2 --default-index with default=saved_entry" +-- +2.25.1 + diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0002-Add-another-variable-LIBS-to-provides-libraries-from.patch b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0002-Add-another-variable-LIBS-to-provides-libraries-from.patch new file mode 100644 index 0000000000..967a4c94fb --- /dev/null +++ b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0002-Add-another-variable-LIBS-to-provides-libraries-from.patch @@ -0,0 +1,38 @@ +From c02d1bf46174656cdb6f7c08fa3e8fa520edcd8e Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 15 Jul 2017 10:19:22 -0700 +Subject: [PATCH] Add another variable LIBS to provides libraries from env + +Upstream-Status: Inactive-Upstream [lastcommit: 2022 lastrelease: 2016] + +Signed-off-by: Khem Raj +--- + Makefile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 968c276..75abe44 100644 +--- a/Makefile ++++ b/Makefile +@@ -31,7 +31,8 @@ ifneq ($(VERBOSE_TEST),) + VERBOSE_TEST="--verbose" + endif + +-grubby_LIBS = -lblkid -lpopt ++grubby_LIBS = -lblkid -lpopt ${LIBS} ++rpm-sort_LIBS = ${LIBS} + + all: grubby rpm-sort + +@@ -63,7 +64,7 @@ grubby:: $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(grubby_LIBS) + + rpm-sort::rpm-sort.o +- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpmio ++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpmio $(rpm-sort_LIBS) + + clean: + rm -f *.o grubby rpm-sort *~ +-- +2.25.1 + diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0002-include-paths.h-for-_PATH_MOUNTED.patch b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0002-include-paths.h-for-_PATH_MOUNTED.patch deleted file mode 100644 index de8133a3a4..0000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0002-include-paths.h-for-_PATH_MOUNTED.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 8f844ac7f44b8dc428d06cd6958c5f32d383d01c Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 15 Jul 2017 10:19:50 -0700 -Subject: [PATCH 2/2] include paths.h for _PATH_MOUNTED - -Signed-off-by: Khem Raj ---- - grubby.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/grubby.c b/grubby.c -index 47a1a15..59f74a9 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - #include - - #include "log.h" --- -2.13.3 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0003-include-paths.h-for-_PATH_MOUNTED.patch b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0003-include-paths.h-for-_PATH_MOUNTED.patch new file mode 100644 index 0000000000..86ae01021f --- /dev/null +++ b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0003-include-paths.h-for-_PATH_MOUNTED.patch @@ -0,0 +1,27 @@ +From 7e68976eb6edd766471c11382f5bf57940ba9315 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 15 Jul 2017 10:19:50 -0700 +Subject: [PATCH] include paths.h for _PATH_MOUNTED + +Upstream-Status: Inactive-Upstream [lastcommit: 2022 lastrelease: 2016] + +Signed-off-by: Khem Raj +--- + grubby.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/grubby.c b/grubby.c +index be832f6..4825797 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + #include + + #include "log.h" +-- +2.25.1 + diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0004-rpm-sort-include-string.h-for-strverscmp.patch b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0004-rpm-sort-include-string.h-for-strverscmp.patch new file mode 100644 index 0000000000..c68b492ebe --- /dev/null +++ b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/0004-rpm-sort-include-string.h-for-strverscmp.patch @@ -0,0 +1,33 @@ +From 45bc228090b3adfc0a5058b9cd019d91831e110a Mon Sep 17 00:00:00 2001 +From: Yi Zhao +Date: Tue, 3 Jan 2023 13:59:48 +0800 +Subject: [PATCH] rpm-sort: include string.h for strverscmp + +Include string.h to fix build error: +rpm-sort.c: In function 'package_version_compare': +rpm-sort.c:156:13: error: 'strverscmp' undeclared (first use in this function) + 156 | cmp = strverscmp; + | ^~~~~~~~~~ + +Upstream-Status: Inactive-Upstream [lastcommit: 2022 lastrelease: 2016] + +Signed-off-by: Yi Zhao +--- + rpm-sort.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/rpm-sort.c b/rpm-sort.c +index f196356..2eb91ce 100644 +--- a/rpm-sort.c ++++ b/rpm-sort.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + + typedef enum { + RPMNVRCMP, +-- +2.25.1 + diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/grubby-rename-grub2-editenv-to-grub-editenv.patch b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/grubby-rename-grub2-editenv-to-grub-editenv.patch deleted file mode 100644 index e693916e1d..0000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby/grubby-rename-grub2-editenv-to-grub-editenv.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 15f0572f2f456c2c1b700bc790d9ce7a5c13cc74 Mon Sep 17 00:00:00 2001 -From: Jackie Huang -Date: Tue, 4 Aug 2015 23:54:41 -0700 -Subject: [PATCH] rename grub2-editenv to grub-editenv - -We don't use the name grub2-editenv for grub2. - -Upstream-Status: Inappropriate - -Signed-off-by: Jackie Huang - ---- - grubby.c | 4 ++-- - test.sh | 8 ++++---- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/grubby.c b/grubby.c -index 396041a..3ceae69 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -301,7 +301,7 @@ static char *grub2GetEnv(struct configFileInfo *info, char *name) - char *ret = NULL; - char *envFile = info->envFile ? info->envFile : "/boot/grub2/grubenv"; - int rc = -- asprintf(&s, "grub2-editenv %s list | grep '^%s='", envFile, name); -+ asprintf(&s, "grub-editenv %s list | grep '^%s='", envFile, name); - - if (rc < 0) - return NULL; -@@ -373,7 +373,7 @@ static int grub2SetEnv(struct configFileInfo *info, char *name, char *value) - if (!value) - return -1; - -- rc = asprintf(&s, "grub2-editenv %s set '%s=%s'", envFile, name, value); -+ rc = asprintf(&s, "grub-editenv %s set '%s=%s'", envFile, name, value); - free(value); - if (rc < 0) - return -1; -diff --git a/test.sh b/test.sh -index 33d24cf..009479c 100755 ---- a/test.sh -+++ b/test.sh -@@ -573,7 +573,7 @@ if [ "$testgrub2" == "y" ]; then - --remove-kernel=/boot/vmlinuz-2.6.38.2-9.fc15.x86_64 \ - --boot-filesystem=/boot/ - commandTest "saved_default output" \ -- "grub2-editenv test/grub2-support_files/env_temp list" \ -+ "grub-editenv test/grub2-support_files/env_temp list" \ - "saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64" - - # copy a stanza and add arguments as well, while using --set-index= -@@ -627,7 +627,7 @@ if [ "$testgrub2" == "y" ]; then - --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ - --copy-default - commandTest "saved_default output" \ -- "grub2-editenv test/grub2-support_files/env_temp list" \ -+ "grub-editenv test/grub2-support_files/env_temp list" \ - "saved_entry=Linux, with Fedora 2.6.38.8-32.fc15.x86_64" - - testing="GRUB2 add kernel with default=saved_entry and a terrible title" -@@ -640,13 +640,13 @@ if [ "$testgrub2" == "y" ]; then - testing="GRUB2 set default with default=saved_entry and a terrible name" - grub2Test grub2.9 add/g2-1.9 --env grubenv.1 --set-default-index=0 - commandTest "saved_default output" \ -- "grub2-editenv test/grub2-support_files/env_temp list" \ -+ "grub-editenv test/grub2-support_files/env_temp list" \ - 'saved_entry=Fedora (3.10.3-300.fc19.x86_64) 19 (Schrödinger’s Cat)' - - testing="GRUB2 set default with default=saved_entry" - grub2Test grub2.8 add/g2-1.8 --env grubenv.1 --set-default-index=0 - commandTest "saved_default output" \ -- "grub2-editenv test/grub2-support_files/env_temp list" \ -+ "grub-editenv test/grub2-support_files/env_temp list" \ - "saved_entry=title" - - testing="GRUB2 --default-index with default=saved_entry" diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_8.40.bb b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_8.40.bb deleted file mode 100644 index 307c0e85d8..0000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_8.40.bb +++ /dev/null @@ -1,41 +0,0 @@ -SUMMARY = "A command line tool for updating and displaying info about boot loaders" -DESCRIPTION = "grubby is a command line tool for updating and displaying information \ -about the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc) and \ -zipl (s390) boot loaders. It is primarily designed to be used from scripts which install \ -new kernels and need to find information about the current boot environment. \ -" -HOMEPAGE = "https://github.com/rhboot/grubby" -LICENSE = "GPL-2.0-or-later" - -LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a" - -DEPENDS = "popt util-linux" -DEPENDS:append:libc-musl = " libexecinfo" - -S = "${WORKDIR}/git" -SRCREV = "79c5cfa02c567efdc5bb18cdd584789e2e35aa23" -SRC_URI = "git://github.com/rhboot/grubby.git;protocol=https;;branch=master \ - file://grubby-rename-grub2-editenv-to-grub-editenv.patch \ - file://run-ptest \ - file://0001-Add-another-variable-LIBS-to-provides-libraries-from.patch \ - file://0002-include-paths.h-for-_PATH_MOUNTED.patch \ - " - -RDEPENDS:${PN} += "dracut" - -inherit autotools-brokensep ptest - -EXTRA_OEMAKE = "-e 'CC=${CC}' 'LDFLAGS=${LDFLAGS}' LIBS='${LIBS}'" - -LIBS:libc-musl = "-lexecinfo" -LIBS ?= "" -do_install_ptest() { - install -d ${D}${PTEST_PATH} - cp -r ${S}/test ${S}/test.sh ${D}${PTEST_PATH} - sed -i 's|./grubby|grubby|' ${D}${PTEST_PATH}/test.sh -} - -RDEPENDS:${PN} += "bash" -RDEPENDS:${PN}-ptest = "util-linux-getopt bash" - -COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)' diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_git.bb b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_git.bb index bbfabf0209..ff673e21bb 100644 --- a/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_git.bb +++ b/meta-openembedded/meta-initramfs/recipes-devtools/grubby/grubby_git.bb @@ -9,25 +9,26 @@ LICENSE = "GPL-2.0-or-later" LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a" -DEPENDS = "popt util-linux" -DEPENDS:append:libc-musl = " libexecinfo" +DEPENDS = "popt util-linux rpm" +DEPENDS:append:libc-musl = " libexecinfo argp-standalone" S = "${WORKDIR}/git" -SRCREV = "a1d2ae93408c3408e672d7eba4550fdf27fb0201" -SRC_URI = "git://github.com/rhboot/grubby.git;protocol=https;;branch=master \ - file://grubby-rename-grub2-editenv-to-grub-editenv.patch \ +SRCREV = "c01b0d5bb182bde35b464d14996acf354a3ada2e" +SRC_URI = "git://github.com/rhboot/grubby.git;protocol=https;;branch=main \ + file://0001-rename-grub2-editenv-to-grub-editenv.patch \ + file://0002-Add-another-variable-LIBS-to-provides-libraries-from.patch \ + file://0003-include-paths.h-for-_PATH_MOUNTED.patch \ + file://0004-rpm-sort-include-string.h-for-strverscmp.patch \ file://run-ptest \ - file://0001-Add-another-variable-LIBS-to-provides-libraries-from.patch \ - file://0002-include-paths.h-for-_PATH_MOUNTED.patch \ " RDEPENDS:${PN} += "dracut" inherit autotools-brokensep ptest -EXTRA_OEMAKE = "-e 'CC=${CC}' 'LDFLAGS=${LDFLAGS}' LIBS='${LIBS}' 'PREFIX'=${@bb.utils.contains('DISTRO_FEATURES','usrmerge','/usr','',d)}" +EXTRA_OEMAKE = "-e 'CC=${CC}' 'LDFLAGS=${LDFLAGS}' 'LIBS=${LIBS}'" -LIBS:libc-musl = "-lexecinfo" +LIBS:libc-musl = "-lexecinfo -largp" LIBS ?= "" do_install_ptest() { install -d ${D}${PTEST_PATH} diff --git a/meta-openembedded/meta-multimedia/conf/layer.conf b/meta-openembedded/meta-multimedia/conf/layer.conf index ee6694cdf8..5f9f471428 100644 --- a/meta-openembedded/meta-multimedia/conf/layer.conf +++ b/meta-openembedded/meta-multimedia/conf/layer.conf @@ -31,4 +31,4 @@ LAYERVERSION_multimedia-layer = "1" LAYERDEPENDS_multimedia-layer = "core openembedded-layer meta-python" -LAYERSERIES_COMPAT_multimedia-layer = "kirkstone langdale" +LAYERSERIES_COMPAT_multimedia-layer = "mickledore" diff --git a/meta-openembedded/meta-multimedia/recipes-connectivity/gupnp/gssdp_1.4.0.1.bb b/meta-openembedded/meta-multimedia/recipes-connectivity/gupnp/gssdp_1.4.0.1.bb index 1d8cbb1aea..ad99bbffa3 100644 --- a/meta-openembedded/meta-multimedia/recipes-connectivity/gupnp/gssdp_1.4.0.1.bb +++ b/meta-openembedded/meta-multimedia/recipes-connectivity/gupnp/gssdp_1.4.0.1.bb @@ -16,14 +16,16 @@ DEPENDS = " \ libsoup-2.4 \ " -inherit meson pkgconfig gobject-introspection vala gtk-doc +inherit meson pkgconfig gobject-introspection vala gtk-doc features_check SNIFFER = "${@bb.utils.contains("BBFILE_COLLECTIONS", "gnome-layer", "sniffer", "", d)}" -PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', "${SNIFFER}", "", d)}" +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', "${SNIFFER}", "", d)}" PACKAGECONFIG[sniffer] = "-Dsniffer=true,-Dsniffer=false,gtk4," +REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('PACKAGECONFIG', 'sniffer', 'opengl', '', d)}" + PACKAGES =+ "gssdp-tools" FILES:gssdp-tools = "${bindir}/gssdp* ${datadir}/gssdp/*.glade" diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/flite/flite_2.2.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/flite/flite_2.2.bb index 9ab9c0208d..0a7680a8c4 100644 --- a/meta-openembedded/meta-multimedia/recipes-multimedia/flite/flite_2.2.bb +++ b/meta-openembedded/meta-multimedia/recipes-multimedia/flite/flite_2.2.bb @@ -6,6 +6,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b3b732d1349633a53e69356607fd2d6c" inherit autotools-brokensep +DEPENDS += "alsa-lib chrpath-replacement-native" + SRC_URI = "git://github.com/festvox/flite.git;protocol=https;branch=master" SRCREV = "e9e2e37c329dbe98bfeb27a1828ef9a71fa84f88" @@ -14,6 +16,12 @@ S = "${WORKDIR}/git" EXTRA_OECONF += "--enable-shared" +do_configure:append() { + sed -i '/$(INSTALL) -m 755 $(BINDIR)\/flite_time $(DESTDIR)$(INSTALLBINDIR)/d' ${S}/main/Makefile +} + do_install:append() { chown -R root:root ${D}${libdir}/* } +# | make[1]: *** No rule to make target 'flite_voice_list.c', needed by 'all'. Stop. +PARALLEL_MAKE = "" diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth.inc b/meta-openembedded/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth.inc index 14d09e5f0b..a4590d61a9 100644 --- a/meta-openembedded/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth.inc +++ b/meta-openembedded/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth.inc @@ -4,7 +4,7 @@ SECTION = "libs/multimedia" LICENSE = "LGPL-2.1-only" LIC_FILES_CHKSUM = "file://LICENSE;md5=fc178bcd425090939a8b634d1d6a9594" -SRC_URI = "git://github.com/FluidSynth/fluidsynth.git;branch=2.2.x;protocol=https" +SRC_URI = "git://github.com/FluidSynth/fluidsynth.git;branch=master;protocol=https" SRCREV = "8b00644751578ba67b709a827cbe5133d849d339" S = "${WORKDIR}/git" PV = "2.2.6" diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.0.1.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.0.1.bb index 2b77d99371..483fe1507e 100644 --- a/meta-openembedded/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.0.1.bb +++ b/meta-openembedded/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.0.1.bb @@ -64,3 +64,8 @@ do_recalculate_ipa_signatures_package() { FILES:${PN} += " ${libdir}/v4l2-compat.so" FILES:${PN}-gst = "${libdir}/gstreamer-1.0" + +# libcamera-v4l2 explicitly sets _FILE_OFFSET_BITS=32 to get access to +# both 32 and 64 bit file APIs. +GLIBC_64BIT_TIME_FLAGS = "" + diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/mycroft/mycroft_19.8.1.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/mycroft/mycroft_19.8.1.bb index aab43ea297..6797899808 100644 --- a/meta-openembedded/meta-multimedia/recipes-multimedia/mycroft/mycroft_19.8.1.bb +++ b/meta-openembedded/meta-multimedia/recipes-multimedia/mycroft/mycroft_19.8.1.bb @@ -22,7 +22,7 @@ SRC_URI = "git://github.com/MycroftAI/mycroft-core.git;branch=master;protocol=ht S = "${WORKDIR}/git" -inherit systemd +inherit systemd features_check # Mycroft installs itself on the host # Just copy the setup files to the rootfs @@ -91,3 +91,5 @@ RDEPENDS:${PN} += "procps" RDEPENDS:${PN} += "bash jq libnotify" SYSTEMD_SERVICE:${PN} = "mycroft-setup.service mycroft.service" + +REQUIRED_DISTRO_FEATURES += "pulseaudio" diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/pipewire/pipewire_0.3.59.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/pipewire/pipewire_0.3.59.bb deleted file mode 100644 index 757c88c956..0000000000 --- a/meta-openembedded/meta-multimedia/recipes-multimedia/pipewire/pipewire_0.3.59.bb +++ /dev/null @@ -1,365 +0,0 @@ -SUMMARY = "Multimedia processing server for Linux" -DESCRIPTION = "Linux server for handling and routing audio and video streams between applications and multimedia I/O devices" -HOMEPAGE = "https://pipewire.org/" -BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/pipewire/issues" -AUTHOR = "Wim Taymans " -SECTION = "multimedia" - -LICENSE = "MIT & LGPL-2.1-or-later & GPL-2.0-only" -LIC_FILES_CHKSUM = " \ - file://LICENSE;md5=2158739e172e58dc9ab1bdd2d6ec9c72 \ - file://COPYING;md5=97be96ca4fab23e9657ffa590b931c1a \ -" - -DEPENDS = "dbus ncurses" - -SRCREV = "f54a72fd9a67eeb8d1502d6d75979dbddb00fdf2" -SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https" - -S = "${WORKDIR}/git" - -inherit meson pkgconfig systemd gettext useradd - -USERADD_PACKAGES = "${PN}" - -GROUPADD_PARAM:${PN} = "--system pipewire" - -USERADD_PARAM:${PN} = "--system --home / --no-create-home \ - --comment 'PipeWire multimedia daemon' \ - --gid pipewire --groups audio,video \ - pipewire" - -SYSTEMD_PACKAGES = "${PN}" - -# For "EVL", look up https://evlproject.org/ . It involves -# a specially prepared kernel, and is currently unavailable -# in Yocto. -# -# Vulkan support is currently (as of version 0.3.44) not functional. -# -# manpage generation requires xmltoman, which is not available. -# -# The session-managers list specifies which session managers Meson -# shall download (via git clone) and build as subprojects. In OE, -# this is not how a session manager should be built. Instead, they -# should be integrated as separate OE recipes. To prevent PipeWire -# from using this Meson feature, set an empty list. -# This does not disable support or the need for session managers, -# it just prevents this subproject feature. -# -# AptX and LDAC are not available in OE. Currently, neither -# are lv2 and ROC. -# -# The RTKit module is deprecated in favor of the newer RT module. -# It still exists for legacy setups that still include it in -# their PipeWire configuration files. -EXTRA_OEMESON += " \ - -Devl=disabled \ - -Dtests=disabled \ - -Dudevrulesdir=${nonarch_base_libdir}/udev/rules.d/ \ - -Dsystemd-system-unit-dir=${systemd_system_unitdir} \ - -Dsystemd-user-unit-dir=${systemd_user_unitdir} \ - -Dman=disabled \ - -Dsession-managers='[]' \ - -Dlv2=disabled \ - -Droc=disabled \ - -Dbluez5-codec-aptx=disabled \ - -Dbluez5-codec-ldac=disabled \ - -Dlegacy-rtkit=false \ -" - -# spa alsa plugin code uses typedef redefinition, which is officially a C11 feature. -# Pipewire builds with 'c_std=gnu99' by default. Recent versions of gcc don't issue this warning in gnu99 -# mode but it looks like clang still does -CFLAGS:append = " -Wno-typedef-redefinition" - -# According to wireplumber documentation only one session manager should be installed at a time -# Possible options are media-session, which has fewer dependencies but is very simple, -# or wireplumber, which is more powerful. -PIPEWIRE_SESSION_MANAGER ??= "media-session" - -FFMPEG_AVAILABLE = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'ffmpeg', '', d)}" -BLUETOOTH_AAC = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'bluez-aac', '', d)}" - -PACKAGECONFIG:class-target ??= " \ - ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez bluez-opus ${BLUETOOTH_AAC}', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'alsa vulkan pulseaudio', d)} \ - ${PIPEWIRE_SESSION_MANAGER} \ - ${FFMPEG_AVAILABLE} gstreamer jack libusb pw-cat raop sndfile v4l2 udev volume \ -" - -# "jack" and "pipewire-jack" packageconfigs cannot be both enabled, -# since "jack" imports libjack, and "pipewire-jack" generates -# libjack.so* files, thus colliding with the libpack package. This -# is why these two are marked in their respective packageconfigs -# as being in conflict. -PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib udev,,pipewire-alsa pipewire-alsa-card-profile" -PACKAGECONFIG[avahi] = "-Davahi=enabled,-Davahi=disabled,avahi" -PACKAGECONFIG[bluez] = "-Dbluez5=enabled,-Dbluez5=disabled,bluez5 sbc" -PACKAGECONFIG[bluez-aac] = "-Dbluez5-codec-aac=enabled,-Dbluez5-codec-aac=disabled,fdk-aac" -PACKAGECONFIG[bluez-opus] = "-Dbluez5-codec-opus=enabled,-Dbluez5-codec-opus=disabled,libopus" -PACKAGECONFIG[docs] = "-Ddocs=enabled,-Ddocs=disabled,doxygen-native graphviz-native" -PACKAGECONFIG[ffmpeg] = "-Dffmpeg=enabled,-Dffmpeg=disabled,ffmpeg" -PACKAGECONFIG[gstreamer] = "-Dgstreamer=enabled,-Dgstreamer=disabled,glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base,,gstreamer1.0-pipewire" -PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack,,,pipewire-jack" -PACKAGECONFIG[libcamera] = "-Dlibcamera=enabled,-Dlibcamera=disabled,libcamera libdrm" -PACKAGECONFIG[libcanberra] = "-Dlibcanberra=enabled,-Dlibcanberra=disabled,libcanberra" -PACKAGECONFIG[libusb] = "-Dlibusb=enabled,-Dlibusb=disabled,libusb" -PACKAGECONFIG[media-session] = ",,,pipewire-media-session,,wireplumber" -PACKAGECONFIG[pulseaudio] = "-Dlibpulse=enabled,-Dlibpulse=disabled,pulseaudio,,pipewire-pulse" -PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=enabled,-Dpipewire-alsa=disabled,alsa-lib" -PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=disabled,jack,,pipewire-jack,jack" -PACKAGECONFIG[pw-cat] = "-Dpw-cat=enabled,-Dpw-cat=disabled" -PACKAGECONFIG[raop] = "-Draop=enabled,-Draop=disabled,openssl" -PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,libsdl2" -PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1" -PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd" -PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=enabled,-Dsystemd-system-service=disabled,systemd" -# "systemd-user-service" packageconfig will only install service -# files to rootfs but not enable them as systemd.bbclass -# currently lacks the feature of enabling user services. -PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=enabled,-Dsystemd-user-service=disabled,systemd" -# pw-cat needs sndfile packageconfig to be enabled -PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev" -PACKAGECONFIG[v4l2] = "-Dv4l2=enabled,-Dv4l2=disabled,udev" -PACKAGECONFIG[volume] = "-Dvolume=enabled,-Dvolume=disabled" -PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled,vulkan-headers vulkan-loader" -PACKAGECONFIG[webrtc-echo-cancelling] = "-Decho-cancel-webrtc=enabled,-Decho-cancel-webrtc=disabled,webrtc-audio-processing" -PACKAGECONFIG[wireplumber] = ",,,wireplumber,,media-session" - -PACKAGESPLITFUNCS:prepend = " split_dynamic_packages " -PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends " - -SPA_SUBDIR = "spa-0.2" -PW_MODULE_SUBDIR = "pipewire-0.3" - -remove_unused_installed_files() { - # jack.conf is used by pipewire-jack (not the JACK SPA plugin). - # Remove it if pipewire-jack is not built to avoid creating the - # pipewire-jack package. - if ${@bb.utils.contains('PACKAGECONFIG', 'pipewire-jack', 'false', 'true', d)}; then - rm -f "${D}${datadir}/pipewire/jack.conf" - fi - - # minimal.conf is an example of how to minimally configure the - # daemon and is not meant to be used for production. - rm -f "${D}${datadir}/pipewire/minimal.conf" -} - -do_install[postfuncs] += "remove_unused_installed_files" - -python split_dynamic_packages () { - # Create packages for each SPA plugin. These plugins are located - # in individual subdirectories, so a recursive search is needed. - spa_libdir = d.expand('${libdir}/${SPA_SUBDIR}') - do_split_packages(d, spa_libdir, r'^libspa-(.*)\.so$', d.expand('${PN}-spa-plugins-%s'), 'PipeWire SPA plugin for %s', extra_depends='', recursive=True) - - # Create packages for each PipeWire module. - pw_module_libdir = d.expand('${libdir}/${PW_MODULE_SUBDIR}') - do_split_packages(d, pw_module_libdir, r'^libpipewire-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'PipeWire %s module', extra_depends='', recursive=False) -} - -python set_dynamic_metapkg_rdepends () { - import os - import oe.utils - - # Go through all generated SPA plugin and PipeWire module packages - # (excluding the main package and the -meta package itself) and - # add them to the -meta package as RDEPENDS. - - base_pn = d.getVar('PN') - - spa_pn = base_pn + '-spa-plugins' - spa_metapkg = spa_pn + '-meta' - - pw_module_pn = base_pn + '-modules' - pw_module_metapkg = pw_module_pn + '-meta' - - d.setVar('ALLOW_EMPTY:' + spa_metapkg, "1") - d.setVar('FILES:' + spa_metapkg, "") - - d.setVar('ALLOW_EMPTY:' + pw_module_metapkg, "1") - d.setVar('FILES:' + pw_module_metapkg, "") - - blacklist = [ spa_pn, spa_metapkg, pw_module_pn, pw_module_metapkg ] - spa_metapkg_rdepends = [] - pw_module_metapkg_rdepends = [] - pkgdest = d.getVar('PKGDEST') - - for pkg in oe.utils.packages_filter_out_system(d): - if pkg in blacklist: - continue - - is_spa_pkg = pkg.startswith(spa_pn) - is_pw_module_pkg = pkg.startswith(pw_module_pn) - if not is_spa_pkg and not is_pw_module_pkg: - continue - - if pkg in spa_metapkg_rdepends or pkg in pw_module_metapkg_rdepends: - continue - - # See if the package is empty by looking at the contents of its - # PKGDEST subdirectory. If this subdirectory is empty, then then - # package is empty as well. Empty packages do not get added to - # the meta package's RDEPENDS. - pkgdir = os.path.join(pkgdest, pkg) - if os.path.exists(pkgdir): - dir_contents = os.listdir(pkgdir) or [] - else: - dir_contents = [] - is_empty = len(dir_contents) == 0 - if not is_empty: - if is_spa_pkg: - spa_metapkg_rdepends.append(pkg) - if is_pw_module_pkg: - pw_module_metapkg_rdepends.append(pkg) - - d.setVar('RDEPENDS:' + spa_metapkg, ' '.join(spa_metapkg_rdepends)) - d.setVar('DESCRIPTION:' + spa_metapkg, spa_pn + ' meta package') - - d.setVar('RDEPENDS:' + pw_module_metapkg, ' '.join(pw_module_metapkg_rdepends)) - d.setVar('DESCRIPTION:' + pw_module_metapkg, pw_module_pn + ' meta package') -} - -PACKAGES =+ "\ - libpipewire \ - ${PN}-tools \ - ${PN}-pulse \ - ${PN}-alsa \ - ${PN}-jack \ - ${PN}-spa-plugins \ - ${PN}-spa-plugins-meta \ - ${PN}-spa-tools \ - ${PN}-modules \ - ${PN}-modules-meta \ - ${PN}-alsa-card-profile \ - ${PN}-v4l2 \ - gstreamer1.0-pipewire \ -" - -PACKAGES_DYNAMIC = "^${PN}-spa-plugins.* ^${PN}-modules.*" - -SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd-system-service', 'pipewire.service', '', d)}" -CONFFILES:${PN} += "${datadir}/pipewire/pipewire.conf" -FILES:${PN} = " \ - ${datadir}/pipewire \ - ${systemd_system_unitdir}/pipewire* \ - ${systemd_user_unitdir} \ - ${bindir}/pipewire \ - ${bindir}/pipewire-avb \ -" - -RRECOMMENDS:${PN}:class-target += " \ - pipewire-modules-meta \ - pipewire-spa-plugins-meta \ -" - -FILES:${PN}-dev += " \ - ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so \ -" - -CONFFILES:libpipewire += "${datadir}/pipewire/client.conf" -FILES:libpipewire = " \ - ${datadir}/pipewire/client.conf \ - ${libdir}/libpipewire-*.so.* \ -" -# Add the bare minimum modules and plugins required to be able -# to use libpipewire. Without these, it is essentially unusable. -RDEPENDS:libpipewire += " \ - ${PN}-modules-client-node \ - ${PN}-modules-protocol-native \ - ${PN}-spa-plugins-support \ -" - -FILES:${PN}-tools = " \ - ${bindir}/pw-cat \ - ${bindir}/pw-cli \ - ${bindir}/pw-dot \ - ${bindir}/pw-dsdplay \ - ${bindir}/pw-dump \ - ${bindir}/pw-link \ - ${bindir}/pw-loopback \ - ${bindir}/pw-metadata \ - ${bindir}/pw-mididump \ - ${bindir}/pw-midiplay \ - ${bindir}/pw-midirecord \ - ${bindir}/pw-mon \ - ${bindir}/pw-play \ - ${bindir}/pw-profiler \ - ${bindir}/pw-record \ - ${bindir}/pw-reserve \ - ${bindir}/pw-top \ -" - -# This is a shim daemon that is intended to be used as a -# drop-in PulseAudio replacement, providing a pulseaudio-compatible -# socket that can be used by applications that use libpulse. -CONFFILES:${PN}-pulse += "${datadir}/pipewire/pipewire-pulse.conf" -FILES:${PN}-pulse = " \ - ${datadir}/pipewire/pipewire-pulse.conf \ - ${systemd_system_unitdir}/pipewire-pulse.* \ - ${systemd_user_unitdir}/pipewire-pulse.* \ - ${bindir}/pipewire-pulse \ -" -RDEPENDS:${PN}-pulse += " \ - ${PN}-modules-protocol-pulse \ -" - -# ALSA plugin to redirect audio to pipewire. -FILES:${PN}-alsa = "\ - ${libdir}/alsa-lib/* \ - ${datadir}/alsa/alsa.conf.d/* \ -" - -# JACK drop-in libraries to redirect audio to pipewire. -CONFFILES:${PN}-jack = "${datadir}/pipewire/jack.conf" -FILES:${PN}-jack = "\ - ${bindir}/pw-jack \ - ${datadir}/pipewire/jack.conf \ - ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \ -" - -# Dynamic SPA plugin packages (see set_dynamic_metapkg_rdepends). -FILES:${PN}-spa-plugins = "" -RRECOMMENDS:${PN}-spa-plugins += "${PN}-spa-plugins-meta" - -FILES:${PN}-spa-plugins-bluez5 += " \ - ${datadir}/${SPA_SUBDIR}/bluez5/* \ -" - -FILES:${PN}-spa-tools = " \ - ${bindir}/spa-* \ -" - -# Dynamic PipeWire module packages (see set_dynamic_metapkg_rdepends). -FILES:${PN}-modules = "" -RRECOMMENDS:${PN}-modules += "${PN}-modules-meta" - -CONFFILES:${PN}-modules-rt = "${datadir}/pipewire/client-rt.conf" -FILES:${PN}-modules-rt += " \ - ${datadir}/pipewire/client-rt.conf \ - " - -CONFFILES:${PN}-modules-filter-chain = "${datadir}/pipewire/filter-chain/*" -FILES:${PN}-modules-filter-chain += " \ - ${datadir}/pipewire/filter-chain/* \ -" - -FILES:${PN}-alsa-card-profile = " \ - ${datadir}/alsa-card-profile/* \ - ${nonarch_base_libdir}/udev/rules.d/90-pipewire-alsa.rules \ -" - -# V4L2 interface emulator for sending/receiving data between PipeWire and V4L2 applications. -FILES:${PN}-v4l2 += " \ - ${bindir}/pw-v4l2 \ - ${libdir}/${PW_MODULE_SUBDIR}/v4l2/libpw-v4l2.so \ -" - -FILES:gstreamer1.0-pipewire = " \ - ${libdir}/gstreamer-1.0/* \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/pipewire/pipewire_0.3.63.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/pipewire/pipewire_0.3.63.bb new file mode 100644 index 0000000000..f7acb8db42 --- /dev/null +++ b/meta-openembedded/meta-multimedia/recipes-multimedia/pipewire/pipewire_0.3.63.bb @@ -0,0 +1,368 @@ +SUMMARY = "Multimedia processing server for Linux" +DESCRIPTION = "Linux server for handling and routing audio and video streams between applications and multimedia I/O devices" +HOMEPAGE = "https://pipewire.org/" +BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/pipewire/issues" +AUTHOR = "Wim Taymans " +SECTION = "multimedia" + +LICENSE = "MIT & LGPL-2.1-or-later & GPL-2.0-only" +LIC_FILES_CHKSUM = " \ + file://LICENSE;md5=2158739e172e58dc9ab1bdd2d6ec9c72 \ + file://COPYING;md5=97be96ca4fab23e9657ffa590b931c1a \ +" + +DEPENDS = "dbus ncurses" + +SRCREV = "5ff00f40b9d3ecfc38305edc27e9c2b01629802c" +SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https" + +S = "${WORKDIR}/git" + +inherit meson pkgconfig systemd gettext useradd + +USERADD_PACKAGES = "${PN}" + +GROUPADD_PARAM:${PN} = "--system pipewire" + +USERADD_PARAM:${PN} = "--system --home / --no-create-home \ + --comment 'PipeWire multimedia daemon' \ + --gid pipewire --groups audio,video \ + pipewire" + +SYSTEMD_PACKAGES = "${PN}" + +# For "EVL", look up https://evlproject.org/ . It involves +# a specially prepared kernel, and is currently unavailable +# in Yocto. +# +# Vulkan support is currently (as of version 0.3.44) not functional. +# +# manpage generation requires xmltoman, which is not available. +# +# The session-managers list specifies which session managers Meson +# shall download (via git clone) and build as subprojects. In OE, +# this is not how a session manager should be built. Instead, they +# should be integrated as separate OE recipes. To prevent PipeWire +# from using this Meson feature, set an empty list. +# This does not disable support or the need for session managers, +# it just prevents this subproject feature. +# +# AptX and LDAC are not available in OE. Currently, neither +# are lv2 and ROC. +# +# The RTKit module is deprecated in favor of the newer RT module. +# It still exists for legacy setups that still include it in +# their PipeWire configuration files. +EXTRA_OEMESON += " \ + -Devl=disabled \ + -Dtests=disabled \ + -Dudevrulesdir=${nonarch_base_libdir}/udev/rules.d/ \ + -Dsystemd-system-unit-dir=${systemd_system_unitdir} \ + -Dsystemd-user-unit-dir=${systemd_user_unitdir} \ + -Dman=disabled \ + -Dsession-managers='[]' \ + -Dlv2=disabled \ + -Droc=disabled \ + -Dbluez5-codec-aptx=disabled \ + -Dbluez5-codec-ldac=disabled \ + -Dlegacy-rtkit=false \ +" + +# spa alsa plugin code uses typedef redefinition, which is officially a C11 feature. +# Pipewire builds with 'c_std=gnu99' by default. Recent versions of gcc don't issue this warning in gnu99 +# mode but it looks like clang still does +CFLAGS:append = " -Wno-typedef-redefinition" + +# According to wireplumber documentation only one session manager should be installed at a time +# Possible options are media-session, which has fewer dependencies but is very simple, +# or wireplumber, which is more powerful. +PIPEWIRE_SESSION_MANAGER ??= "wireplumber" + +FFMPEG_AVAILABLE = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'ffmpeg', '', d)}" +BLUETOOTH_AAC = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'bluez-aac', '', d)}" + +PACKAGECONFIG:class-target ??= " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez bluez-opus ${BLUETOOTH_AAC}', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio gtk', 'gsettings', '', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'alsa vulkan pulseaudio', d)} \ + ${PIPEWIRE_SESSION_MANAGER} \ + ${FFMPEG_AVAILABLE} avahi flatpak gstreamer jack libusb pw-cat raop sndfile v4l2 udev volume webrtc-echo-cancelling \ +" + +# "jack" and "pipewire-jack" packageconfigs cannot be both enabled, +# since "jack" imports libjack, and "pipewire-jack" generates +# libjack.so* files, thus colliding with the libpack package. This +# is why these two are marked in their respective packageconfigs +# as being in conflict. +PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib udev,,pipewire-alsa pipewire-alsa-card-profile" +PACKAGECONFIG[avahi] = "-Davahi=enabled,-Davahi=disabled,avahi" +PACKAGECONFIG[bluez] = "-Dbluez5=enabled,-Dbluez5=disabled,bluez5 sbc" +PACKAGECONFIG[bluez-aac] = "-Dbluez5-codec-aac=enabled,-Dbluez5-codec-aac=disabled,fdk-aac" +PACKAGECONFIG[bluez-opus] = "-Dbluez5-codec-opus=enabled,-Dbluez5-codec-opus=disabled,libopus" +PACKAGECONFIG[docs] = "-Ddocs=enabled,-Ddocs=disabled,doxygen-native graphviz-native" +PACKAGECONFIG[ffmpeg] = "-Dffmpeg=enabled,-Dffmpeg=disabled,ffmpeg" +PACKAGECONFIG[flatpak] = "-Dflatpak=enabled,-Dflatpak=disabled,glib-2.0" +PACKAGECONFIG[gsettings] = "-Dgsettings=enabled,-Dgsettings=disabled,glib-2.0" +PACKAGECONFIG[gstreamer] = "-Dgstreamer=enabled,-Dgstreamer=disabled,glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base,,gstreamer1.0-pipewire" +PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack,,,pipewire-jack" +PACKAGECONFIG[libcamera] = "-Dlibcamera=enabled,-Dlibcamera=disabled,libcamera libdrm" +PACKAGECONFIG[libcanberra] = "-Dlibcanberra=enabled,-Dlibcanberra=disabled,libcanberra" +PACKAGECONFIG[libusb] = "-Dlibusb=enabled,-Dlibusb=disabled,libusb" +PACKAGECONFIG[media-session] = ",,,pipewire-media-session,,wireplumber" +PACKAGECONFIG[pulseaudio] = "-Dlibpulse=enabled,-Dlibpulse=disabled,pulseaudio,,pipewire-pulse" +PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=enabled,-Dpipewire-alsa=disabled,alsa-lib" +PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=disabled,jack,,pipewire-jack,jack" +PACKAGECONFIG[pw-cat] = "-Dpw-cat=enabled,-Dpw-cat=disabled" +PACKAGECONFIG[raop] = "-Draop=enabled,-Draop=disabled,openssl" +PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,libsdl2" +PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1" +PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd" +PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=enabled,-Dsystemd-system-service=disabled,systemd" +# "systemd-user-service" packageconfig will only install service +# files to rootfs but not enable them as systemd.bbclass +# currently lacks the feature of enabling user services. +PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=enabled,-Dsystemd-user-service=disabled,systemd" +# pw-cat needs sndfile packageconfig to be enabled +PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev" +PACKAGECONFIG[v4l2] = "-Dv4l2=enabled,-Dv4l2=disabled,udev" +PACKAGECONFIG[volume] = "-Dvolume=enabled,-Dvolume=disabled" +PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled,vulkan-headers vulkan-loader" +PACKAGECONFIG[webrtc-echo-cancelling] = "-Decho-cancel-webrtc=enabled,-Decho-cancel-webrtc=disabled,webrtc-audio-processing" +PACKAGECONFIG[wireplumber] = ",,,wireplumber,,media-session" + +PACKAGESPLITFUNCS:prepend = " split_dynamic_packages " +PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends " + +SPA_SUBDIR = "spa-0.2" +PW_MODULE_SUBDIR = "pipewire-0.3" + +remove_unused_installed_files() { + # jack.conf is used by pipewire-jack (not the JACK SPA plugin). + # Remove it if pipewire-jack is not built to avoid creating the + # pipewire-jack package. + if ${@bb.utils.contains('PACKAGECONFIG', 'pipewire-jack', 'false', 'true', d)}; then + rm -f "${D}${datadir}/pipewire/jack.conf" + fi + + # minimal.conf is an example of how to minimally configure the + # daemon and is not meant to be used for production. + rm -f "${D}${datadir}/pipewire/minimal.conf" +} + +do_install[postfuncs] += "remove_unused_installed_files" + +python split_dynamic_packages () { + # Create packages for each SPA plugin. These plugins are located + # in individual subdirectories, so a recursive search is needed. + spa_libdir = d.expand('${libdir}/${SPA_SUBDIR}') + do_split_packages(d, spa_libdir, r'^libspa-(.*)\.so$', d.expand('${PN}-spa-plugins-%s'), 'PipeWire SPA plugin for %s', extra_depends='', recursive=True) + + # Create packages for each PipeWire module. + pw_module_libdir = d.expand('${libdir}/${PW_MODULE_SUBDIR}') + do_split_packages(d, pw_module_libdir, r'^libpipewire-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'PipeWire %s module', extra_depends='', recursive=False) +} + +python set_dynamic_metapkg_rdepends () { + import os + import oe.utils + + # Go through all generated SPA plugin and PipeWire module packages + # (excluding the main package and the -meta package itself) and + # add them to the -meta package as RDEPENDS. + + base_pn = d.getVar('PN') + + spa_pn = base_pn + '-spa-plugins' + spa_metapkg = spa_pn + '-meta' + + pw_module_pn = base_pn + '-modules' + pw_module_metapkg = pw_module_pn + '-meta' + + d.setVar('ALLOW_EMPTY:' + spa_metapkg, "1") + d.setVar('FILES:' + spa_metapkg, "") + + d.setVar('ALLOW_EMPTY:' + pw_module_metapkg, "1") + d.setVar('FILES:' + pw_module_metapkg, "") + + blacklist = [ spa_pn, spa_metapkg, pw_module_pn, pw_module_metapkg ] + spa_metapkg_rdepends = [] + pw_module_metapkg_rdepends = [] + pkgdest = d.getVar('PKGDEST') + + for pkg in oe.utils.packages_filter_out_system(d): + if pkg in blacklist: + continue + + is_spa_pkg = pkg.startswith(spa_pn) + is_pw_module_pkg = pkg.startswith(pw_module_pn) + if not is_spa_pkg and not is_pw_module_pkg: + continue + + if pkg in spa_metapkg_rdepends or pkg in pw_module_metapkg_rdepends: + continue + + # See if the package is empty by looking at the contents of its + # PKGDEST subdirectory. If this subdirectory is empty, then then + # package is empty as well. Empty packages do not get added to + # the meta package's RDEPENDS. + pkgdir = os.path.join(pkgdest, pkg) + if os.path.exists(pkgdir): + dir_contents = os.listdir(pkgdir) or [] + else: + dir_contents = [] + is_empty = len(dir_contents) == 0 + if not is_empty: + if is_spa_pkg: + spa_metapkg_rdepends.append(pkg) + if is_pw_module_pkg: + pw_module_metapkg_rdepends.append(pkg) + + d.setVar('RDEPENDS:' + spa_metapkg, ' '.join(spa_metapkg_rdepends)) + d.setVar('DESCRIPTION:' + spa_metapkg, spa_pn + ' meta package') + + d.setVar('RDEPENDS:' + pw_module_metapkg, ' '.join(pw_module_metapkg_rdepends)) + d.setVar('DESCRIPTION:' + pw_module_metapkg, pw_module_pn + ' meta package') +} + +PACKAGES =+ "\ + libpipewire \ + ${PN}-tools \ + ${PN}-pulse \ + ${PN}-alsa \ + ${PN}-jack \ + ${PN}-spa-plugins \ + ${PN}-spa-plugins-meta \ + ${PN}-spa-tools \ + ${PN}-modules \ + ${PN}-modules-meta \ + ${PN}-alsa-card-profile \ + ${PN}-v4l2 \ + gstreamer1.0-pipewire \ +" + +PACKAGES_DYNAMIC = "^${PN}-spa-plugins.* ^${PN}-modules.*" + +SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd-system-service', 'pipewire.service', '', d)}" +CONFFILES:${PN} += "${datadir}/pipewire/pipewire.conf" +FILES:${PN} = " \ + ${datadir}/pipewire \ + ${systemd_system_unitdir}/pipewire* \ + ${systemd_user_unitdir} \ + ${bindir}/pipewire \ + ${bindir}/pipewire-avb \ +" + +RRECOMMENDS:${PN}:class-target += " \ + pipewire-modules-meta \ + pipewire-spa-plugins-meta \ +" + +FILES:${PN}-dev += " \ + ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so \ +" + +CONFFILES:libpipewire += "${datadir}/pipewire/client.conf" +FILES:libpipewire = " \ + ${datadir}/pipewire/client.conf \ + ${libdir}/libpipewire-*.so.* \ +" +# Add the bare minimum modules and plugins required to be able +# to use libpipewire. Without these, it is essentially unusable. +RDEPENDS:libpipewire += " \ + ${PN}-modules-client-node \ + ${PN}-modules-protocol-native \ + ${PN}-spa-plugins-support \ +" + +FILES:${PN}-tools = " \ + ${bindir}/pw-cat \ + ${bindir}/pw-cli \ + ${bindir}/pw-dot \ + ${bindir}/pw-dsdplay \ + ${bindir}/pw-dump \ + ${bindir}/pw-link \ + ${bindir}/pw-loopback \ + ${bindir}/pw-metadata \ + ${bindir}/pw-mididump \ + ${bindir}/pw-midiplay \ + ${bindir}/pw-midirecord \ + ${bindir}/pw-mon \ + ${bindir}/pw-play \ + ${bindir}/pw-profiler \ + ${bindir}/pw-record \ + ${bindir}/pw-reserve \ + ${bindir}/pw-top \ +" + +# This is a shim daemon that is intended to be used as a +# drop-in PulseAudio replacement, providing a pulseaudio-compatible +# socket that can be used by applications that use libpulse. +CONFFILES:${PN}-pulse += "${datadir}/pipewire/pipewire-pulse.conf" +FILES:${PN}-pulse = " \ + ${datadir}/pipewire/pipewire-pulse.conf \ + ${systemd_system_unitdir}/pipewire-pulse.* \ + ${systemd_user_unitdir}/pipewire-pulse.* \ + ${bindir}/pipewire-pulse \ +" +RDEPENDS:${PN}-pulse += " \ + ${PN}-modules-protocol-pulse \ +" + +# ALSA plugin to redirect audio to pipewire. +FILES:${PN}-alsa = "\ + ${libdir}/alsa-lib/* \ + ${datadir}/alsa/alsa.conf.d/* \ +" + +# JACK drop-in libraries to redirect audio to pipewire. +CONFFILES:${PN}-jack = "${datadir}/pipewire/jack.conf" +FILES:${PN}-jack = "\ + ${bindir}/pw-jack \ + ${datadir}/pipewire/jack.conf \ + ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \ +" + +# Dynamic SPA plugin packages (see set_dynamic_metapkg_rdepends). +FILES:${PN}-spa-plugins = "" +RRECOMMENDS:${PN}-spa-plugins += "${PN}-spa-plugins-meta" + +FILES:${PN}-spa-plugins-bluez5 += " \ + ${datadir}/${SPA_SUBDIR}/bluez5/* \ +" + +FILES:${PN}-spa-tools = " \ + ${bindir}/spa-* \ +" + +# Dynamic PipeWire module packages (see set_dynamic_metapkg_rdepends). +FILES:${PN}-modules = "" +RRECOMMENDS:${PN}-modules += "${PN}-modules-meta" + +CONFFILES:${PN}-modules-rt = "${datadir}/pipewire/client-rt.conf" +FILES:${PN}-modules-rt += " \ + ${datadir}/pipewire/client-rt.conf \ + " + +CONFFILES:${PN}-modules-filter-chain = "${datadir}/pipewire/filter-chain/*" +FILES:${PN}-modules-filter-chain += " \ + ${datadir}/pipewire/filter-chain/* \ +" + +FILES:${PN}-alsa-card-profile = " \ + ${datadir}/alsa-card-profile/* \ + ${nonarch_base_libdir}/udev/rules.d/90-pipewire-alsa.rules \ +" + +# V4L2 interface emulator for sending/receiving data between PipeWire and V4L2 applications. +FILES:${PN}-v4l2 += " \ + ${bindir}/pw-v4l2 \ + ${libdir}/${PW_MODULE_SUBDIR}/v4l2/libpw-v4l2.so \ +" + +FILES:gstreamer1.0-pipewire = " \ + ${libdir}/gstreamer-1.0/* \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/wireplumber/wireplumber_0.4.12.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/wireplumber/wireplumber_0.4.12.bb deleted file mode 100644 index d80d9348a2..0000000000 --- a/meta-openembedded/meta-multimedia/recipes-multimedia/wireplumber/wireplumber_0.4.12.bb +++ /dev/null @@ -1,145 +0,0 @@ -SUMMARY = "Session / policy manager implementation for PipeWire" -HOMEPAGE = "https://gitlab.freedesktop.org/pipewire/wireplumber" -BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/wireplumber/issues" -AUTHOR = "George Kiagiadakis " -SECTION = "multimedia" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=17d1fe479cdec331eecbc65d26bc7e77" - -DEPENDS = "glib-2.0 glib-2.0-native lua pipewire \ - ${@bb.utils.contains("DISTRO_FEATURES", "gobject-introspection-data", "python3-native python3-lxml-native doxygen-native", "", d)} \ -" - -SRCREV = "6f6e5df9c1b223907efa8dcbfcd538821d0dabc4" -SRC_URI = "git://gitlab.freedesktop.org/pipewire/wireplumber.git;branch=master;protocol=https \ - file://90-OE-disable-session-dbus-dependent-features.lua \ - " - -S = "${WORKDIR}/git" - -inherit meson pkgconfig gobject-introspection systemd - -GIR_MESON_ENABLE_FLAG = 'enabled' -GIR_MESON_DISABLE_FLAG = 'disabled' - -# Enable system-lua to let wireplumber use OE's lua. -# Documentation needs python-sphinx, which is not in oe-core or meta-python2 for now. -# elogind is not (yet) available in OE, so disable support. -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - -Dsystem-lua=true \ - -Delogind=disabled \ - -Dsystemd-system-unit-dir=${systemd_system_unitdir} \ - -Dsystemd-user-unit-dir=${systemd_user_unitdir} \ - -Dtests=false \ -" - -PACKAGECONFIG ??= "\ - ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \ -" - -PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd" -PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=true,-Dsystemd-system-service=false,systemd" -# "systemd-user-service" packageconfig will only install service -# files to rootfs but not enable them as systemd.bbclass -# currently lacks the feature of enabling user services. -PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=true,-Dsystemd-user-service=false,systemd" - -PACKAGESPLITFUNCS:prepend = " split_dynamic_packages " -PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends " - -WP_MODULE_SUBDIR = "wireplumber-0.4" - -add_custom_lua_config_scripts() { - install -m 0644 ${WORKDIR}/90-OE-disable-session-dbus-dependent-features.lua ${D}${datadir}/wireplumber/main.lua.d -} - -do_install[postfuncs] += "add_custom_lua_config_scripts" - -python split_dynamic_packages () { - # Create packages for each WirePlumber module. - wp_module_libdir = d.expand('${libdir}/${WP_MODULE_SUBDIR}') - do_split_packages(d, wp_module_libdir, r'^libwireplumber-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'WirePlumber %s module', extra_depends='', recursive=False) -} - -python set_dynamic_metapkg_rdepends () { - import os - import oe.utils - - # Go through all generated WirePlumber module packages - # (excluding the main package and the -meta package itself) - # and add them to the -meta package as RDEPENDS. - - base_pn = d.getVar('PN') - - wp_module_pn = base_pn + '-modules' - wp_module_metapkg = wp_module_pn + '-meta' - - d.setVar('ALLOW_EMPTY:' + wp_module_metapkg, "1") - d.setVar('FILES:' + wp_module_metapkg, "") - - blacklist = [ wp_module_pn, wp_module_metapkg ] - wp_module_metapkg_rdepends = [] - pkgdest = d.getVar('PKGDEST') - - for pkg in oe.utils.packages_filter_out_system(d): - if pkg in blacklist: - continue - - is_wp_module_pkg = pkg.startswith(wp_module_pn) - if not is_wp_module_pkg: - continue - - if pkg in wp_module_metapkg_rdepends: - continue - - # See if the package is empty by looking at the contents of its - # PKGDEST subdirectory. If this subdirectory is empty, then then - # package is empty as well. Empty packages do not get added to - # the meta package's RDEPENDS. - pkgdir = os.path.join(pkgdest, pkg) - if os.path.exists(pkgdir): - dir_contents = os.listdir(pkgdir) or [] - else: - dir_contents = [] - is_empty = len(dir_contents) == 0 - if not is_empty: - if is_wp_module_pkg: - wp_module_metapkg_rdepends.append(pkg) - - d.setVar('RDEPENDS:' + wp_module_metapkg, ' '.join(wp_module_metapkg_rdepends)) - d.setVar('DESCRIPTION:' + wp_module_metapkg, wp_module_pn + ' meta package') -} - -PACKAGES =+ "\ - libwireplumber \ - ${PN}-default-config \ - ${PN}-scripts \ - ${PN}-modules \ - ${PN}-modules-meta \ -" - -PACKAGES_DYNAMIC = "^${PN}-modules.*" - -SYSTEMD_SERVICE:${PN} = "wireplumber.service" -CONFFILES:${PN} += " \ - ${datadir}/wireplumber/wireplumber.conf \ - ${datadir}/wireplumber/*.lua.d/* \ -" -# Add pipewire to RRECOMMENDS, since WirePlumber expects a PipeWire daemon to -# be present. While in theory any application that uses libpipewire can configure -# itself to become a daemon, in practice, the PipeWire daemon is used. -RRECOMMENDS:${PN} += "pipewire ${PN}-scripts ${PN}-modules-meta" - -FILES:${PN} += "${systemd_user_unitdir}" - -FILES:libwireplumber = " \ - ${libdir}/libwireplumber-*.so.* \ -" - -FILES:${PN}-scripts += "${datadir}/wireplumber/scripts/*" - -# Dynamic packages (see set_dynamic_metapkg_rdepends). -FILES:${PN}-modules = "" -RRECOMMENDS:${PN}-modules += "${PN}-modules-meta" diff --git a/meta-openembedded/meta-multimedia/recipes-multimedia/wireplumber/wireplumber_0.4.13.bb b/meta-openembedded/meta-multimedia/recipes-multimedia/wireplumber/wireplumber_0.4.13.bb new file mode 100644 index 0000000000..0203f8bf50 --- /dev/null +++ b/meta-openembedded/meta-multimedia/recipes-multimedia/wireplumber/wireplumber_0.4.13.bb @@ -0,0 +1,146 @@ +SUMMARY = "Session / policy manager implementation for PipeWire" +HOMEPAGE = "https://gitlab.freedesktop.org/pipewire/wireplumber" +BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/wireplumber/issues" +AUTHOR = "George Kiagiadakis " +SECTION = "multimedia" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=17d1fe479cdec331eecbc65d26bc7e77" + +DEPENDS = "glib-2.0 glib-2.0-native lua pipewire \ + ${@bb.utils.contains("DISTRO_FEATURES", "gobject-introspection-data", "python3-native python3-lxml-native doxygen-native", "", d)} \ +" + +SRCREV = "7cb1b8b92e96ebd1b7e632cda32715fed713d333" +SRC_URI = " \ + git://gitlab.freedesktop.org/pipewire/wireplumber.git;branch=master;protocol=https \ + file://90-OE-disable-session-dbus-dependent-features.lua \ +" + +S = "${WORKDIR}/git" + +inherit meson pkgconfig gobject-introspection systemd + +GIR_MESON_ENABLE_FLAG = 'enabled' +GIR_MESON_DISABLE_FLAG = 'disabled' + +# Enable system-lua to let wireplumber use OE's lua. +# Documentation needs python-sphinx, which is not in oe-core or meta-python2 for now. +# elogind is not (yet) available in OE, so disable support. +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + -Dsystem-lua=true \ + -Delogind=disabled \ + -Dsystemd-system-unit-dir=${systemd_system_unitdir} \ + -Dsystemd-user-unit-dir=${systemd_user_unitdir} \ + -Dtests=false \ +" + +PACKAGECONFIG ??= " dbus \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \ +" + +PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd" +PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=true,-Dsystemd-system-service=false,systemd" +# "systemd-user-service" packageconfig will only install service +# files to rootfs but not enable them as systemd.bbclass +# currently lacks the feature of enabling user services. +PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=true,-Dsystemd-user-service=false,systemd" +PACKAGECONFIG[dbus] = "" + +PACKAGESPLITFUNCS:prepend = " split_dynamic_packages " +PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends " + +WP_MODULE_SUBDIR = "wireplumber-0.4" + +do_install:append() { + if ${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'false', 'true', d)}; then + install -m 0644 ${WORKDIR}/90-OE-disable-session-dbus-dependent-features.lua ${D}${datadir}/wireplumber/main.lua.d + fi +} + +python split_dynamic_packages () { + # Create packages for each WirePlumber module. + wp_module_libdir = d.expand('${libdir}/${WP_MODULE_SUBDIR}') + do_split_packages(d, wp_module_libdir, r'^libwireplumber-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'WirePlumber %s module', extra_depends='', recursive=False) +} + +python set_dynamic_metapkg_rdepends () { + import os + import oe.utils + + # Go through all generated WirePlumber module packages + # (excluding the main package and the -meta package itself) + # and add them to the -meta package as RDEPENDS. + + base_pn = d.getVar('PN') + + wp_module_pn = base_pn + '-modules' + wp_module_metapkg = wp_module_pn + '-meta' + + d.setVar('ALLOW_EMPTY:' + wp_module_metapkg, "1") + d.setVar('FILES:' + wp_module_metapkg, "") + + blacklist = [ wp_module_pn, wp_module_metapkg ] + wp_module_metapkg_rdepends = [] + pkgdest = d.getVar('PKGDEST') + + for pkg in oe.utils.packages_filter_out_system(d): + if pkg in blacklist: + continue + + is_wp_module_pkg = pkg.startswith(wp_module_pn) + if not is_wp_module_pkg: + continue + + if pkg in wp_module_metapkg_rdepends: + continue + + # See if the package is empty by looking at the contents of its + # PKGDEST subdirectory. If this subdirectory is empty, then then + # package is empty as well. Empty packages do not get added to + # the meta package's RDEPENDS. + pkgdir = os.path.join(pkgdest, pkg) + if os.path.exists(pkgdir): + dir_contents = os.listdir(pkgdir) or [] + else: + dir_contents = [] + is_empty = len(dir_contents) == 0 + if not is_empty: + if is_wp_module_pkg: + wp_module_metapkg_rdepends.append(pkg) + + d.setVar('RDEPENDS:' + wp_module_metapkg, ' '.join(wp_module_metapkg_rdepends)) + d.setVar('DESCRIPTION:' + wp_module_metapkg, wp_module_pn + ' meta package') +} + +PACKAGES =+ "\ + libwireplumber \ + ${PN}-default-config \ + ${PN}-scripts \ + ${PN}-modules \ + ${PN}-modules-meta \ +" + +PACKAGES_DYNAMIC = "^${PN}-modules.*" + +CONFFILES:${PN} += " \ + ${datadir}/wireplumber/wireplumber.conf \ + ${datadir}/wireplumber/*.lua.d/* \ +" +# Add pipewire to RRECOMMENDS, since WirePlumber expects a PipeWire daemon to +# be present. While in theory any application that uses libpipewire can configure +# itself to become a daemon, in practice, the PipeWire daemon is used. +RRECOMMENDS:${PN} += "pipewire ${PN}-scripts ${PN}-modules-meta" + +FILES:${PN} += "${systemd_user_unitdir} ${systemd_system_unitdir}" + +FILES:libwireplumber = " \ + ${libdir}/libwireplumber-*.so.* \ +" + +FILES:${PN}-scripts += "${datadir}/wireplumber/scripts/*" + +# Dynamic packages (see set_dynamic_metapkg_rdepends). +FILES:${PN}-modules = "" +RRECOMMENDS:${PN}-modules += "${PN}-modules-meta" diff --git a/meta-openembedded/meta-multimedia/recipes-support/xdg-desktop-portal-wlr/xdg-desktop-portal-wlr_0.6.0.bb b/meta-openembedded/meta-multimedia/recipes-support/xdg-desktop-portal-wlr/xdg-desktop-portal-wlr_0.6.0.bb new file mode 100644 index 0000000000..7e1b7b9d26 --- /dev/null +++ b/meta-openembedded/meta-multimedia/recipes-support/xdg-desktop-portal-wlr/xdg-desktop-portal-wlr_0.6.0.bb @@ -0,0 +1,30 @@ +SUMMARY = "This provides screenshot/screencast xdg-desktop-portal backends for wlroots." +HOMEPAGE = "https://github.com/emersion/xdg-desktop-portal-wlr" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e316e9609dd7672b87ff25b46b2cf3e1" + +DEPENDS = " \ + wayland \ + wayland-native \ + wayland-protocols \ + libdrm \ + libinih \ + pipewire \ + virtual/libgbm \ +" + +inherit meson pkgconfig features_check +REQUIRED_DISTRO_FEATURES = "opengl" + +SRC_URI = "git://github.com/emersion/xdg-desktop-portal-wlr.git;protocol=https;nobranch=1" + +S = "${WORKDIR}/git" +SRCREV = "0a8bfa14607022a080f8b6eabc4757d1918d3cd9" + +PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'basu', d)}" + +PACKAGECONFIG[man-pages] = "-Dman-pages=enabled,-Dman-pages=disabled,scdoc-native" +PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsd-bus-provider=libsystemd,-Dsystemd=disabled" +PACKAGECONFIG[basu] = "-Dsd-bus-provider=basu,,basu" + +FILES:${PN} += "${systemd_user_unitdir} ${datadir}" diff --git a/meta-openembedded/meta-networking/classes/waf-samba.bbclass b/meta-openembedded/meta-networking/classes/waf-samba.bbclass index 9c32952f6a..41909788f7 100644 --- a/meta-openembedded/meta-networking/classes/waf-samba.bbclass +++ b/meta-openembedded/meta-networking/classes/waf-samba.bbclass @@ -95,6 +95,7 @@ do_configure() { export STAGING_LIBDIR=${STAGING_LIBDIR} export STAGING_INCDIR=${STAGING_INCDIR} export PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} + export PYTHON_CONFIG=${STAGING_EXECPREFIXDIR}/python-target-config/python3-config CONFIG_CMD="./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} --cross-compile" if [ "${CROSS_METHOD}" = "answer" ]; then diff --git a/meta-openembedded/meta-networking/conf/layer.conf b/meta-openembedded/meta-networking/conf/layer.conf index fd28f30033..c643e889c0 100644 --- a/meta-openembedded/meta-networking/conf/layer.conf +++ b/meta-openembedded/meta-networking/conf/layer.conf @@ -16,7 +16,7 @@ LAYERVERSION_networking-layer = "1" LAYERDEPENDS_networking-layer = "core" LAYERDEPENDS_networking-layer += "openembedded-layer" -LAYERSERIES_COMPAT_networking-layer = "kirkstone langdale" +LAYERSERIES_COMPAT_networking-layer = "mickledore" LICENSE_PATH += "${LAYERDIR}/licenses" diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-aarch64.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-aarch64.txt index e91df71ea2..fa960ea2b9 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-aarch64.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-aarch64.txt @@ -44,3 +44,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-aarch64_be.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-aarch64_be.txt index e91df71ea2..fa960ea2b9 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-aarch64_be.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-aarch64_be.txt @@ -44,3 +44,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-arm.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-arm.txt index b670e4ac44..19d0b6f765 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-arm.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-arm.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-armeb.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-armeb.txt index b670e4ac44..19d0b6f765 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-armeb.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-armeb.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-i586.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-i586.txt index b670e4ac44..19d0b6f765 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-i586.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-i586.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-i686.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-i686.txt index b670e4ac44..19d0b6f765 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-i686.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-i686.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips.txt index ad52b4a9ab..aa87368802 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips64.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips64.txt index c799942d4b..407e4154c2 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips64.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips64.txt @@ -44,3 +44,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips64el.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips64el.txt index c799942d4b..407e4154c2 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips64el.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mips64el.txt @@ -44,3 +44,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mipsel.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mipsel.txt index ad52b4a9ab..aa87368802 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mipsel.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-mipsel.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc.txt index ac857d46ed..e94a5a4731 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc64.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc64.txt index dfc48754cb..a5c0d0d61e 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc64.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc64.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc64le.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc64le.txt index dfc48754cb..a5c0d0d61e 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc64le.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-powerpc64le.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-riscv32.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-riscv32.txt index b670e4ac44..19d0b6f765 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-riscv32.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-riscv32.txt @@ -45,3 +45,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-riscv64.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-riscv64.txt index e91df71ea2..fa960ea2b9 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-riscv64.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-riscv64.txt @@ -44,3 +44,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-x86_64.txt b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-x86_64.txt index e91df71ea2..fa960ea2b9 100644 --- a/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-x86_64.txt +++ b/meta-openembedded/meta-networking/files/waf-cross-answers/cross-answers-x86_64.txt @@ -44,3 +44,4 @@ Checking value of GNUTLS_MAC_AES_CMAC_128: OK Checking whether fcntl supports flags to send direct I/O availability signals: NO Checking whether fcntl supports setting/geting hints: NO Checking for readlink breakage: NO +Checking for gnutls fips mode support: NO diff --git a/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.4.bb b/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.4.bb deleted file mode 100644 index c3cde1f27a..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.4.bb +++ /dev/null @@ -1,59 +0,0 @@ -DESCRIPTION = "Blueman is a GTK+ Bluetooth Manager" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -DEPENDS = "gtk+3 glib-2.0 bluez5 python3-pygobject python3-cython-native" - -inherit meson gettext systemd gsettings pkgconfig python3native gtk-icon-cache - -SRC_URI = " \ - git://github.com/blueman-project/blueman.git;protocol=https;branch=2-3-stable \ - file://0001-Search-for-cython3.patch \ - file://0002-fix-fail-to-enable-bluetooth.patch \ - file://0001-meson-add-pythoninstalldir-option.patch \ -" -S = "${WORKDIR}/git" -SRCREV = "89bb5313a7cc24ca6fdbeaf2b02f6142dc1a8e60" - -EXTRA_OEMESON = "-Druntime_deps_check=false -Dpythoninstalldir=${@noprefix('PYTHON_SITEPACKAGES_DIR', d)}" - -SYSTEMD_SERVICE:${PN} = "${BPN}-mechanism.service" -SYSTEMD_AUTO_ENABLE:${PN} = "disable" - -RRECOMMENDS:${PN} += "adwaita-icon-theme" -RDEPENDS:${PN} += " \ - python3-core \ - python3-dbus \ - python3-pygobject \ - python3-terminal \ - packagegroup-tools-bluetooth \ -" - -PACKAGECONFIG ??= " \ - ${@bb.utils.filter('DISTRO_FEATURES', 'polkit pulseaudio ', d)} \ - thunar \ -" -PACKAGECONFIG[thunar] = "-Dthunar-sendto=true,-Dthunar-sendto=false" -PACKAGECONFIG[pulseaudio] = "-Dpulseaudio=true,-Dpulseaudio=false" -PACKAGECONFIG[polkit] = "-Dpolicykit=true,-Dpolicykit=false" - -FILES:${PN} += " \ - ${datadir} \ - ${systemd_user_unitdir} \ - ${PYTHON_SITEPACKAGES_DIR} \ -" - -# In code, path to python is a variable that is replaced with path to native version of it -# during the configure stage, e.g ../recipe-sysroot-native/usr/bin/python3-native/python3. -# Replace it with #!/usr/bin/env python3 -do_install:append() { - sed -i "1s/.*/#!\/usr\/bin\/env python3/" ${D}${prefix}/libexec/blueman-rfcomm-watcher \ - ${D}${prefix}/libexec/blueman-mechanism \ - ${D}${bindir}/blueman-adapters \ - ${D}${bindir}/blueman-applet \ - ${D}${bindir}/blueman-manager \ - ${D}${bindir}/blueman-sendto \ - ${D}${bindir}/blueman-services \ - ${D}${bindir}/blueman-tray -} - diff --git a/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.5.bb b/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.5.bb new file mode 100644 index 0000000000..2343cec71a --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-connectivity/blueman/blueman_2.3.5.bb @@ -0,0 +1,60 @@ +DESCRIPTION = "Blueman is a GTK+ Bluetooth Manager" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +DEPENDS = "gtk+3 glib-2.0 bluez5 python3-pygobject python3-cython-native" + +inherit meson gettext systemd gsettings pkgconfig python3native gtk-icon-cache + +SRC_URI = " \ + git://github.com/blueman-project/blueman.git;protocol=https;branch=2-3-stable \ + file://0001-Search-for-cython3.patch \ + file://0002-fix-fail-to-enable-bluetooth.patch \ + file://0001-meson-add-pythoninstalldir-option.patch \ +" +S = "${WORKDIR}/git" +SRCREV = "c85e7afb8d6547d4c35b7b639124de8e999c3650" + +EXTRA_OEMESON = "-Druntime_deps_check=false -Dpythoninstalldir=${@noprefix('PYTHON_SITEPACKAGES_DIR', d)}" + +SYSTEMD_SERVICE:${PN} = "${BPN}-mechanism.service" +SYSTEMD_AUTO_ENABLE:${PN} = "disable" + +RRECOMMENDS:${PN} += "adwaita-icon-theme" +RDEPENDS:${PN} += " \ + python3-core \ + python3-dbus \ + python3-pygobject \ + python3-terminal \ + python3-fcntl \ + packagegroup-tools-bluetooth \ +" + +PACKAGECONFIG ??= " \ + ${@bb.utils.filter('DISTRO_FEATURES', 'polkit pulseaudio ', d)} \ + thunar \ +" +PACKAGECONFIG[thunar] = "-Dthunar-sendto=true,-Dthunar-sendto=false" +PACKAGECONFIG[pulseaudio] = "-Dpulseaudio=true,-Dpulseaudio=false" +PACKAGECONFIG[polkit] = "-Dpolicykit=true,-Dpolicykit=false" + +FILES:${PN} += " \ + ${datadir} \ + ${systemd_user_unitdir} \ + ${PYTHON_SITEPACKAGES_DIR} \ +" + +# In code, path to python is a variable that is replaced with path to native version of it +# during the configure stage, e.g ../recipe-sysroot-native/usr/bin/python3-native/python3. +# Replace it with #!/usr/bin/env python3 +do_install:append() { + sed -i "1s/.*/#!\/usr\/bin\/env python3/" ${D}${prefix}/libexec/blueman-rfcomm-watcher \ + ${D}${prefix}/libexec/blueman-mechanism \ + ${D}${bindir}/blueman-adapters \ + ${D}${bindir}/blueman-applet \ + ${D}${bindir}/blueman-manager \ + ${D}${bindir}/blueman-sendto \ + ${D}${bindir}/blueman-services \ + ${D}${bindir}/blueman-tray +} + diff --git a/meta-openembedded/meta-networking/recipes-connectivity/freeradius/files/radiusd.service b/meta-openembedded/meta-networking/recipes-connectivity/freeradius/files/radiusd.service index 37a2eb3d7d..7969bfb690 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/freeradius/files/radiusd.service +++ b/meta-openembedded/meta-networking/recipes-connectivity/freeradius/files/radiusd.service @@ -4,10 +4,11 @@ After=syslog.target network.target [Service] Type=forking +EnvironmentFile=-/etc/sysconfig/radiusd PIDFile=/run/radiusd/radiusd.pid ExecStartPre=-@BASE_BINDIR@/chown -R radiusd:radiusd /run/radiusd ExecStartPre=@SBINDIR@/radiusd -C -ExecStart=@SBINDIR@/radiusd -d @SYSCONFDIR@/raddb +ExecStart=@SBINDIR@/radiusd -d @SYSCONFDIR@/${MLPREFIX}raddb ExecReload=@SBINDIR@/radiusd -C ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID diff --git a/meta-openembedded/meta-networking/recipes-connectivity/freeradius/freeradius_3.0.21.bb b/meta-openembedded/meta-networking/recipes-connectivity/freeradius/freeradius_3.0.21.bb index 1407b798b5..b459412e04 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/freeradius/freeradius_3.0.21.bb +++ b/meta-openembedded/meta-networking/recipes-connectivity/freeradius/freeradius_3.0.21.bb @@ -199,7 +199,37 @@ pkg_postinst:${PN} () { # Fix ownership for /etc/raddb/*, /var/lib/radiusd chown -R radiusd:radiusd ${raddbdir} chown -R radiusd:radiusd ${localstatedir}/lib/radiusd + + # for radiusd.service with multilib + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${sysconfdir}/sysconfig + echo "MLPREFIX=${MLPREFIX}" > ${sysconfdir}/sysconfig/radiusd + fi + else + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d $D${sysconfdir}/sysconfig + echo "MLPREFIX=${MLPREFIX}" > $D${sysconfdir}/sysconfig/radiusd + fi + fi +} + +pkg_postrm:${PN} () { + # only try to remove ${sysconfdir}/sysconfig/radiusd for systemd + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'false', 'true', d)}; then + exit 0 + fi + + if [ -d ${sysconfdir}/raddb ]; then + exit 0 fi + for variant in ${MULTILIB_GLOBAL_VARIANTS}; do + if [ -d ${sysconfdir}/${variant}-raddb ]; then + exit 0 + fi + done + + rm -f ${sysconfdir}/sysconfig/radiusd + rmdir --ignore-fail-on-non-empty ${sysconfdir}/sysconfig } # We really need the symlink :( diff --git a/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager-openvpn_1.10.0.bb b/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager-openvpn_1.10.0.bb deleted file mode 100644 index 1fcb435395..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager-openvpn_1.10.0.bb +++ /dev/null @@ -1,52 +0,0 @@ -SUMMARY = "NetworkManager-openvpn-plugin" -SECTION = "net/misc" - -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=100d5a599bead70ddcd70dcd73f2e29c" - -DEPENDS = "dbus dbus-glib networkmanager openvpn intltool-native glib-2.0-native" - -inherit gnomebase useradd gettext systemd - -SRC_URI = "${GNOME_MIRROR}/NetworkManager-openvpn/${@gnome_verdir("${PV}")}/NetworkManager-openvpn-${PV}.tar.xz" - -SRC_URI[sha256sum] = "5745d4107f3398a97afbb93f69239b510c9e45eb7fb62d60d9ed0a7297f4d101" - -S = "${WORKDIR}/NetworkManager-openvpn-${PV}" - -# meta-gnome in layers is required using gnome: -PACKAGECONFIG[gnome] = "--with-gnome,--without-gnome,gtk+3 libnma libsecret" - -do_configure:append() { - # network-manager-openvpn.metainfo.xml is created in source folder but - # compile expects it in build folder. As long as nobody comes up with a - # better solution just support build: - if [ -e ${S}/appdata/network-manager-openvpn.metainfo.xml ]; then - mkdir -p ${B}/appdata - cp -f ${S}/appdata/network-manager-openvpn.metainfo.xml ${B}/appdata/ - fi -} - -do_install:append () { - rm -rf ${D}${libdir}/NetworkManager/*.la -} - -# Create user and group nm-openvpn that are needed since version 1.0.6 -USERADD_PACKAGES = "${PN}" -USERADD_PARAM:${PN} = "--system nm-openvpn" - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${datadir}/metainfo \ - ${libdir}/NetworkManager/*.so \ - ${nonarch_libdir}/NetworkManager/VPN/nm-openvpn-service.name \ -" - -FILES:${PN}-staticdev += " \ - ${libdir}/NetworkManager/*.a \ -" - -RDEPENDS:${PN} = " \ - networkmanager \ - openvpn \ -" diff --git a/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager-openvpn_1.10.2.bb b/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager-openvpn_1.10.2.bb new file mode 100644 index 0000000000..3114731f2a --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager-openvpn_1.10.2.bb @@ -0,0 +1,52 @@ +SUMMARY = "NetworkManager-openvpn-plugin" +SECTION = "net/misc" + +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=100d5a599bead70ddcd70dcd73f2e29c" + +DEPENDS = "dbus dbus-glib networkmanager openvpn intltool-native glib-2.0-native" + +inherit gnomebase useradd gettext systemd + +SRC_URI = "${GNOME_MIRROR}/NetworkManager-openvpn/${@gnome_verdir("${PV}")}/NetworkManager-openvpn-${PV}.tar.xz" + +SRC_URI[sha256sum] = "62f0f2a8782221b923f212ac2a8ebbc1002efd6a90ee945dad4adfb56d076d21" + +S = "${WORKDIR}/NetworkManager-openvpn-${PV}" + +# meta-gnome in layers is required using gnome: +PACKAGECONFIG[gnome] = "--with-gnome,--without-gnome,gtk+3 libnma libsecret" + +do_configure:append() { + # network-manager-openvpn.metainfo.xml is created in source folder but + # compile expects it in build folder. As long as nobody comes up with a + # better solution just support build: + if [ -e ${S}/appdata/network-manager-openvpn.metainfo.xml ]; then + mkdir -p ${B}/appdata + cp -f ${S}/appdata/network-manager-openvpn.metainfo.xml ${B}/appdata/ + fi +} + +do_install:append () { + rm -rf ${D}${libdir}/NetworkManager/*.la +} + +# Create user and group nm-openvpn that are needed since version 1.0.6 +USERADD_PACKAGES = "${PN}" +USERADD_PARAM:${PN} = "--system nm-openvpn" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/metainfo \ + ${libdir}/NetworkManager/*.so \ + ${nonarch_libdir}/NetworkManager/VPN/nm-openvpn-service.name \ +" + +FILES:${PN}-staticdev += " \ + ${libdir}/NetworkManager/*.a \ +" + +RDEPENDS:${PN} = " \ + networkmanager \ + openvpn \ +" diff --git a/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.40.0.bb b/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.40.0.bb index 10241e12a6..801739170b 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.40.0.bb +++ b/meta-openembedded/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.40.0.bb @@ -104,9 +104,11 @@ PACKAGECONFIG[ovs] = "-Dovs=true,-Dovs=false,jansson" PACKAGECONFIG[audit] = "-Dlibaudit=yes,-Dlibaudit=no" PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux" PACKAGECONFIG[vala] = "-Dvapi=true,-Dvapi=false" -PACKAGECONFIG[dhcpcd] = "-Ddhcpcd=yes,-Ddhcpcd=no,,dhcpcd" +PACKAGECONFIG[dhcpcd] = "-Ddhcpcd=${base_sbindir}/dhcpcd,-Ddhcpcd=no,,dhcpcd" PACKAGECONFIG[dhclient] = "-Ddhclient=yes,-Ddhclient=no,,dhcp" PACKAGECONFIG[concheck] = "-Dconcheck=true,-Dconcheck=false" +# The following PACKAGECONFIG is used to determine whether NM is managing /etc/resolv.conf itself or not +PACKAGECONFIG[man-resolv-conf] = ",," PACKAGES =+ " \ @@ -258,9 +260,9 @@ SYSTEMD_SERVICE:${PN}-daemon = "\ " RCONFLICTS:${PN}-daemon += "connman" ALTERNATIVE_PRIORITY = "100" -ALTERNATIVE:${PN}-daemon = "${@bb.utils.contains('DISTRO_FEATURES','systemd','resolv-conf','',d)}" -ALTERNATIVE_TARGET[resolv-conf] = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv-conf.NetworkManager','',d)}" -ALTERNATIVE_LINK_NAME[resolv-conf] = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${sysconfdir}/resolv.conf','',d)}" +ALTERNATIVE:${PN}-daemon = "${@bb.utils.contains('PACKAGECONFIG','man-resolv-conf','resolv-conf','',d)}" +ALTERNATIVE_TARGET[resolv-conf] = "${@bb.utils.contains('PACKAGECONFIG','man-resolv-conf','${sysconfdir}/resolv-conf.NetworkManager','',d)}" +ALTERNATIVE_LINK_NAME[resolv-conf] = "${@bb.utils.contains('PACKAGECONFIG','man-resolv-conf','${sysconfdir}/resolv.conf','',d)}" # The networkmanager package is an empty meta package which weakly depends on all the compiled features. @@ -285,7 +287,7 @@ do_install:append() { rm -rf ${D}/run ${D}${localstatedir}/run - if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + if ${@bb.utils.contains('PACKAGECONFIG','man-resolv-conf','true','false',d)}; then # For read-only filesystem, do not create links during bootup ln -sf ../run/NetworkManager/resolv.conf ${D}${sysconfdir}/resolv-conf.NetworkManager @@ -295,11 +297,11 @@ do_install:append() { # Enable iwd if compiled if ${@bb.utils.contains('PACKAGECONFIG','iwd','true','false',d)}; then - install -Dm 0644 ${WORKDIR}/enable-iwd.conf ${D}${libdir}/NetworkManager/conf.d/enable-iwd.conf + install -Dm 0644 ${WORKDIR}/enable-iwd.conf ${D}${nonarch_libdir}/NetworkManager/conf.d/enable-iwd.conf fi # Enable dhcpd if compiled if ${@bb.utils.contains('PACKAGECONFIG','dhcpcd','true','false',d)}; then - install -Dm 0644 ${WORKDIR}/enable-dhcpcd.conf ${D}${libdir}/NetworkManager/conf.d/enable-dhcpcd.conf + install -Dm 0644 ${WORKDIR}/enable-dhcpcd.conf ${D}${nonarch_libdir}/NetworkManager/conf.d/enable-dhcpcd.conf fi } diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Deleted-settiong-of-python-to-fix-the-install-confli.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Deleted-settiong-of-python-to-fix-the-install-confli.patch deleted file mode 100644 index 6e4cdf12d6..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Deleted-settiong-of-python-to-fix-the-install-confli.patch +++ /dev/null @@ -1,122 +0,0 @@ -From f8e1d71e702dfc6965ecb3109738b5d188af4267 Mon Sep 17 00:00:00 2001 -From: Lei Maohui -Date: Sun, 30 Oct 2022 11:59:31 +0900 -Subject: [PATCH] Deleted settiong of python to fix the install conflict error - when enable multilib. - - file /usr/bin/samba-tool conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 - file /usr/sbin/samba-gpupdate conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 - file /usr/sbin/samba_dnsupdate conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 - file /usr/sbin/samba_downgrade_db conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 - file /usr/sbin/samba_kcc conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 - file /usr/sbin/samba_spnupdate conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 - file /usr/sbin/samba_upgradedns conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 - -The conflict is because there is a difference between of lib32-samba-* and samba-* as the following: -64bit: -sys.path.insert(0, "/usr/lib64/python3.10/site-packages") - -32bit: -sys.path.insert(0, "/usr/lib/python3.10/site-packages") - -But this setting is for environment when running from source tree. There -is no necessary on target. - -Upstream-Status: Inappropriate -Signed-off-by: Lei Maohui ---- - source4/scripting/bin/samba-gpupdate | 1 - - source4/scripting/bin/samba-tool | 1 - - source4/scripting/bin/samba_dnsupdate | 1 - - source4/scripting/bin/samba_downgrade_db | 1 - - source4/scripting/bin/samba_kcc | 1 - - source4/scripting/bin/samba_spnupdate | 1 - - source4/scripting/bin/samba_upgradedns | 1 - - 7 files changed, 7 deletions(-) - -diff --git a/source4/scripting/bin/samba-gpupdate b/source4/scripting/bin/samba-gpupdate -index 85300e1..02f40cd 100755 ---- a/source4/scripting/bin/samba-gpupdate -+++ b/source4/scripting/bin/samba-gpupdate -@@ -25,7 +25,6 @@ applied, have changed, or is in the right container''' - import os - import sys - --sys.path.insert(0, "bin/python") - - import optparse - from samba import getopt as options -diff --git a/source4/scripting/bin/samba-tool b/source4/scripting/bin/samba-tool -index f8a70a6..3c818de 100755 ---- a/source4/scripting/bin/samba-tool -+++ b/source4/scripting/bin/samba-tool -@@ -22,7 +22,6 @@ - import sys - - # Find right direction when running from source tree --sys.path.insert(0, "bin/python") - - # make sure the script dies immediately when hitting control-C, - # rather than raising KeyboardInterrupt. As we do all database -diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate -index 518bb89..277f0ee 100755 ---- a/source4/scripting/bin/samba_dnsupdate -+++ b/source4/scripting/bin/samba_dnsupdate -@@ -36,7 +36,6 @@ os.environ['PYTHONUNBUFFERED'] = '1' - os.environ["TZ"] = "GMT" - - # Find right directory when running from source tree --sys.path.insert(0, "bin/python") - - import samba - import optparse -diff --git a/source4/scripting/bin/samba_downgrade_db b/source4/scripting/bin/samba_downgrade_db -index 87a989b..93a7f8c 100755 ---- a/source4/scripting/bin/samba_downgrade_db -+++ b/source4/scripting/bin/samba_downgrade_db -@@ -24,7 +24,6 @@ import optparse - import sys - - # Find right directory when running from source tree --sys.path.insert(0, "bin/python") - - - import samba -diff --git a/source4/scripting/bin/samba_kcc b/source4/scripting/bin/samba_kcc -index 122a5ed..79165f3 100755 ---- a/source4/scripting/bin/samba_kcc -+++ b/source4/scripting/bin/samba_kcc -@@ -37,7 +37,6 @@ os.environ['PYTHONUNBUFFERED'] = '1' - os.environ["TZ"] = "GMT" - - # Find right directory when running from source tree --sys.path.insert(0, "bin/python") - - import optparse - import time -diff --git a/source4/scripting/bin/samba_spnupdate b/source4/scripting/bin/samba_spnupdate -index 84ff771..b6fe041 100755 ---- a/source4/scripting/bin/samba_spnupdate -+++ b/source4/scripting/bin/samba_spnupdate -@@ -32,7 +32,6 @@ os.environ['PYTHONUNBUFFERED'] = '1' - os.environ["TZ"] = "GMT" - - # Find right directory when running from source tree --sys.path.insert(0, "bin/python") - - import samba, ldb - import optparse -diff --git a/source4/scripting/bin/samba_upgradedns b/source4/scripting/bin/samba_upgradedns -index 308dbb0..d00244f 100755 ---- a/source4/scripting/bin/samba_upgradedns -+++ b/source4/scripting/bin/samba_upgradedns -@@ -27,7 +27,6 @@ import grp - from base64 import b64encode - import shlex - --sys.path.insert(0, "bin/python") - - import ldb - import samba --- -2.25.1 diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Don-t-check-xsltproc-manpages.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Don-t-check-xsltproc-manpages.patch index f4668dc6fd..9f597bee2d 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Don-t-check-xsltproc-manpages.patch +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Don-t-check-xsltproc-manpages.patch @@ -1,4 +1,4 @@ -From 3bc1ebc3d2758af4067b3aace7ddd0ea0cb0b57b Mon Sep 17 00:00:00 2001 +From f6fa33bfc2e1272198db6ea08910b4162b364b18 Mon Sep 17 00:00:00 2001 From: Bian Naimeng Date: Mon, 18 Apr 2016 17:00:53 -0400 Subject: [PATCH] Don't check xsltproc manpages @@ -16,10 +16,10 @@ Signed-off-by: Yi Zhao 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ldb/wscript b/lib/ldb/wscript -index bf6129b..c515deb 100644 +index 60bb7cf..b7b0152 100644 --- a/lib/ldb/wscript +++ b/lib/ldb/wscript -@@ -143,7 +143,7 @@ def configure(conf): +@@ -144,7 +144,7 @@ def configure(conf): conf.DEFINE('EXPECTED_SYSTEM_LDB_VERSION_RELEASE', int(v[2])) if conf.env.standalone_ldb: @@ -29,7 +29,7 @@ index bf6129b..c515deb 100644 # we need this for the ldap backend if conf.CHECK_FUNCS_IN('ber_flush ldap_open ldap_initialize', 'lber ldap', headers='lber.h ldap.h'): diff --git a/lib/talloc/wscript b/lib/talloc/wscript -index a767477..f754819 100644 +index 3089663..76cd65e 100644 --- a/lib/talloc/wscript +++ b/lib/talloc/wscript @@ -48,7 +48,7 @@ def configure(conf): @@ -42,7 +42,7 @@ index a767477..f754819 100644 conf.CHECK_HEADERS('sys/auxv.h') conf.CHECK_FUNCS('getauxval') diff --git a/lib/tdb/wscript b/lib/tdb/wscript -index e56ddd0..467dd65 100644 +index 71ada31..accd474 100644 --- a/lib/tdb/wscript +++ b/lib/tdb/wscript @@ -95,7 +95,7 @@ def configure(conf): @@ -55,5 +55,5 @@ index e56ddd0..467dd65 100644 conf.SAMBA_CHECK_PYTHON() conf.SAMBA_CHECK_PYTHON_HEADERS() -- -2.17.1 +2.25.1 diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Fix-pyext_PATTERN-for-cross-compilation.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Fix-pyext_PATTERN-for-cross-compilation.patch deleted file mode 100644 index d497dd32ca..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-Fix-pyext_PATTERN-for-cross-compilation.patch +++ /dev/null @@ -1,63 +0,0 @@ -From a0547cacaddcb2fbef1fb9991c5ad522226e6817 Mon Sep 17 00:00:00 2001 -From: Yi Zhao -Date: Wed, 24 Nov 2021 13:33:35 +0800 -Subject: [PATCH] Fix pyext_PATTERN for cross compilation - -The pyext_PATTERN will add native arch as suffix when cross compiling. -For example, on qemuarm64, it is expanded to: -pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' -which will result in the incorrect library name. - -root@qemuarm64:~# find /usr/lib -name \*cpython\* -/usr/lib/pkgconfig/samba-policy.cpython-310-x86_64-linux-gnu.pc -/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so -/usr/lib/samba/libsamba-python.cpython-310-x86-64-linux-gnu-samba4.so -/usr/lib/samba/libsamba-net.cpython-310-x86-64-linux-gnu-samba4.so -/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so.0 -/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so.0.0.1 -/usr/lib/python3.10/site-packages/samba/dsdb_dns.cpython-310-x86_64-linux-gnu.so -/usr/lib/python3.10/site-packages/samba/dsdb.cpython-310-x86_64-linux-gnu.so -/usr/lib/python3.10/site-packages/samba/xattr_tdb.cpython-310-x86_64-linux-gnu.so -/usr/lib/python3.10/site-packages/samba/_ldb.cpython-310-x86_64-linux-gnu.so -/usr/lib/python3.10/site-packages/samba/gensec.cpython-310-x86_64-linux-gnu.so -[snip] - -Set pyext_PATTERN to '%s.so' to remove the suffix. -After the patch: -root@qemuarm64:~# find /usr/lib/ -/usr/lib/pkgconfig/samba-policy.pc -/usr/lib/libsamba-policy.so -/usr/lib/samba/libsamba-python-samba4.so -/usr/lib/samba/libsamba-net-samba4.so -/usr/lib/libsamba-policy.so.0 -/usr/lib/libsamba-policy.so.0.0.1 -/usr/lib/python3.10/site-packages/samba/dsdb_dns.so -/usr/lib/python3.10/site-packages/samba/dsdb.so -/usr/lib/python3.10/site-packages/samba/xattr_tdb.so -/usr/lib/python3.10/site-packages/samba/_ldb.so -/usr/lib/python3.10/site-packages/samba/gensec.so -[snip] - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Yi Zhao ---- - third_party/waf/waflib/Tools/python.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py -index b1c8dd0..24faa31 100644 ---- a/third_party/waf/waflib/Tools/python.py -+++ b/third_party/waf/waflib/Tools/python.py -@@ -328,7 +328,7 @@ def check_python_headers(conf, features='pyembed pyext'): - x = 'MACOSX_DEPLOYMENT_TARGET' - if dct[x]: - env[x] = conf.environ[x] = dct[x] -- env.pyext_PATTERN = '%s' + dct['SO'] # not a mistake -+ env.pyext_PATTERN = '%s.so' - - - # Try to get pythonX.Y-config --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-smbtorture-skip-test-case-tfork_cmd_send.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-smbtorture-skip-test-case-tfork_cmd_send.patch deleted file mode 100644 index 90ee317860..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-smbtorture-skip-test-case-tfork_cmd_send.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 059b517f9ef6cbdc696e0983ce255b1728042827 Mon Sep 17 00:00:00 2001 -From: Yi Zhao -Date: Thu, 25 Aug 2022 16:46:04 +0800 -Subject: [PATCH] smbtorture: skip test case tfork_cmd_send - -The test case tfork_cmd_send fails on target as it requires a script -located in the source directory: - -$ smbtorture ncalrpc:localhost local.tfork.tfork_cmd_send -test: tfork_cmd_send -/buildarea/build/tmp/work/core2-64-poky-linux/samba/4.14.14-r0/samba-4.14.14/testprogs/blackbox/tfork.sh: -Failed to exec child - No such file or directory - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Yi Zhao ---- - lib/util/tests/tfork.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/lib/util/tests/tfork.c b/lib/util/tests/tfork.c -index 70ae975..4826ce6 100644 ---- a/lib/util/tests/tfork.c -+++ b/lib/util/tests/tfork.c -@@ -839,10 +839,6 @@ struct torture_suite *torture_local_tfork(TALLOC_CTX *mem_ctx) - "tfork_threads", - test_tfork_threads); - -- torture_suite_add_simple_test(suite, -- "tfork_cmd_send", -- test_tfork_cmd_send); -- - torture_suite_add_simple_test(suite, - "tfork_event_file_handle", - test_tfork_event_file_handle); --- -2.25.1 - diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-waf-Fix-errors-with-Werror-implicit-function-declara.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-waf-Fix-errors-with-Werror-implicit-function-declara.patch deleted file mode 100644 index 4a89f76782..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0001-waf-Fix-errors-with-Werror-implicit-function-declara.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 28ec4c9323e67cd114a0465015c9f3c2e64e6829 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 27 Aug 2022 13:05:26 -0700 -Subject: [PATCH] waf: Fix errors with Werror=implicit-function-declaration - turned on - -Clang-15 turns this option into errors by default, and it results in -rpath check failures - -Upstream-Status: Pending - -Signed-off-by: Khem Raj ---- - buildtools/wafsamba/samba_waf18.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py -index 7a0a08e..c0d2c3e 100644 ---- a/buildtools/wafsamba/samba_waf18.py -+++ b/buildtools/wafsamba/samba_waf18.py -@@ -209,7 +209,7 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None): - lib_node.parent.mkdir() - lib_node.write('int lib_func(void) { return 42; }\n', 'w') - main_node = bld.srcnode.make_node('main.c') -- main_node.write('int main(void) {return !(lib_func() == 42);}', 'w') -+ main_node.write('int lib_func(void); int main(void) {return !(lib_func() == 42);}', 'w') - linkflags = [] - if version_script: - script = bld.srcnode.make_node('ldscript') --- -2.37.2 - diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0002-do-not-import-target-module-while-cross-compile.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0002-do-not-import-target-module-while-cross-compile.patch index 292e614ebf..186ee553a2 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0002-do-not-import-target-module-while-cross-compile.patch +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0002-do-not-import-target-module-while-cross-compile.patch @@ -1,4 +1,4 @@ -From 9ebea97a52e4f70e831dd6402b865c77753ce1cc Mon Sep 17 00:00:00 2001 +From f7b8e2e149b06a8033e31f4242c392573fa9ab52 Mon Sep 17 00:00:00 2001 From: Changqing Li Date: Tue, 25 Jun 2019 14:25:08 +0800 Subject: [PATCH] do not import target module while cross compile @@ -15,7 +15,7 @@ Signed-off-by: Changqing Li 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py -index 5f080dd..cdc115e 100644 +index 7d2d855..01dcb56 100644 --- a/buildtools/wafsamba/samba_bundled.py +++ b/buildtools/wafsamba/samba_bundled.py @@ -4,6 +4,7 @@ import sys @@ -24,9 +24,9 @@ index 5f080dd..cdc115e 100644 from wafsamba import samba_utils +import importlib.util, os - def PRIVATE_NAME(bld, name, private_extension, private_library): + def PRIVATE_NAME(bld, name): '''possibly rename a library to include a bundled extension''' -@@ -249,17 +250,27 @@ def CHECK_BUNDLED_SYSTEM_PYTHON(conf, libname, modulename, minversion='0.0.0'): +@@ -241,17 +242,27 @@ def CHECK_BUNDLED_SYSTEM_PYTHON(conf, libname, modulename, minversion='0.0.0'): # versions minversion = minimum_library_version(conf, libname, minversion) @@ -63,5 +63,5 @@ index 5f080dd..cdc115e 100644 Logs.error('ERROR: Python module %s of version %s not found, and bundling disabled' % (libname, minversion)) sys.exit(1) -- -2.17.1 +2.25.1 diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0003-Add-config-option-without-valgrind.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0003-Add-config-option-without-valgrind.patch index 93ca005d68..f2e25eb105 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0003-Add-config-option-without-valgrind.patch +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0003-Add-config-option-without-valgrind.patch @@ -1,4 +1,4 @@ -From 6455448eb060d03a534539f1a424e2d3e44319e1 Mon Sep 17 00:00:00 2001 +From 556bb3cf17ccdf0b0ee0d82801c4b20cf0990ae4 Mon Sep 17 00:00:00 2001 From: Changqing Li Date: Thu, 20 Jun 2019 14:11:16 +0800 Subject: [PATCH] Add config option without-valgrind @@ -15,10 +15,10 @@ Signed-off-by: Changqing Li 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/replace/wscript b/lib/replace/wscript -index 2c856b6..bc726f7 100644 +index 2f17999..9ef9bd9 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript -@@ -121,8 +121,9 @@ def configure(conf): +@@ -114,8 +114,9 @@ def configure(conf): conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h') conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h') @@ -31,10 +31,10 @@ index 2c856b6..bc726f7 100644 conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h') conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') diff --git a/wscript b/wscript -index 83d9421..969b07a 100644 +index 3af4207..54d7e9e 100644 --- a/wscript +++ b/wscript -@@ -123,6 +123,10 @@ def options(opt): +@@ -116,6 +116,10 @@ def options(opt): help=("Disable RELRO builds"), action="store_false", dest='enable_relro') @@ -46,5 +46,5 @@ index 83d9421..969b07a 100644 opt.load('python') # options for disabling pyc or pyo compilation -- -2.17.1 +2.25.1 diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0004-Add-options-to-configure-the-use-of-libbsd.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0004-Add-options-to-configure-the-use-of-libbsd.patch index 5fd32f3851..2b0fbff8e7 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0004-Add-options-to-configure-the-use-of-libbsd.patch +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0004-Add-options-to-configure-the-use-of-libbsd.patch @@ -1,4 +1,4 @@ -From 5abf3c2efa1cd4e16878b6b26068ff153973ebd3 Mon Sep 17 00:00:00 2001 +From 515f2455b4b69f5fcd2c61a532663280785db737 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Tue, 28 Apr 2020 02:05:33 +0200 Subject: [PATCH] Add options to configure the use of libbsd @@ -15,10 +15,10 @@ Signed-off-by: Yi Zhao 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript -index 1aadb95..e7b47c0 100644 +index 8729b08..1c55428 100644 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript -@@ -88,6 +88,13 @@ def options(opt): +@@ -145,6 +145,13 @@ Currently the only tested value is 'smbtorture,smbd/smbd' for Samba'''), help=("Disable use of gettext"), action="store_true", dest='disable_gettext', default=False) @@ -33,10 +33,10 @@ index 1aadb95..e7b47c0 100644 gr.add_option('-C', diff --git a/lib/replace/wscript b/lib/replace/wscript -index bc726f7..44ad0d6 100644 +index 9ef9bd9..d47de4f 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript -@@ -419,20 +419,21 @@ def configure(conf): +@@ -439,20 +439,21 @@ def configure(conf): strlcpy_in_bsd = False @@ -73,7 +73,7 @@ index bc726f7..44ad0d6 100644 conf.CHECK_CODE(''' struct ucred cred; diff --git a/lib/texpect/wscript b/lib/texpect/wscript -index 82f6b25..33eea64 100644 +index 44f92a8..79e8d09 100644 --- a/lib/texpect/wscript +++ b/lib/texpect/wscript @@ -1,7 +1,13 @@ @@ -92,5 +92,5 @@ index 82f6b25..33eea64 100644 def build(bld): bld.SAMBA_BINARY('texpect', -- -2.17.1 +2.25.1 diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0005-Fix-pyext_PATTERN-for-cross-compilation.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0005-Fix-pyext_PATTERN-for-cross-compilation.patch new file mode 100644 index 0000000000..e1b5fac0d0 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0005-Fix-pyext_PATTERN-for-cross-compilation.patch @@ -0,0 +1,63 @@ +From a8b4a40b535a2c69eb408f649e7169bcc1975fc1 Mon Sep 17 00:00:00 2001 +From: Yi Zhao +Date: Wed, 24 Nov 2021 13:33:35 +0800 +Subject: [PATCH] Fix pyext_PATTERN for cross compilation + +The pyext_PATTERN will add native arch as suffix when cross compiling. +For example, on qemuarm64, it is expanded to: +pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' +which will result in the incorrect library name. + +root@qemuarm64:~# find /usr/lib -name \*cpython\* +/usr/lib/pkgconfig/samba-policy.cpython-310-x86_64-linux-gnu.pc +/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so +/usr/lib/samba/libsamba-python.cpython-310-x86-64-linux-gnu-samba4.so +/usr/lib/samba/libsamba-net.cpython-310-x86-64-linux-gnu-samba4.so +/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so.0 +/usr/lib/libsamba-policy.cpython-310-x86-64-linux-gnu.so.0.0.1 +/usr/lib/python3.10/site-packages/samba/dsdb_dns.cpython-310-x86_64-linux-gnu.so +/usr/lib/python3.10/site-packages/samba/dsdb.cpython-310-x86_64-linux-gnu.so +/usr/lib/python3.10/site-packages/samba/xattr_tdb.cpython-310-x86_64-linux-gnu.so +/usr/lib/python3.10/site-packages/samba/_ldb.cpython-310-x86_64-linux-gnu.so +/usr/lib/python3.10/site-packages/samba/gensec.cpython-310-x86_64-linux-gnu.so +[snip] + +Set pyext_PATTERN to '%s.so' to remove the suffix. +After the patch: +root@qemuarm64:~# find /usr/lib/ +/usr/lib/pkgconfig/samba-policy.pc +/usr/lib/libsamba-policy.so +/usr/lib/samba/libsamba-python-samba4.so +/usr/lib/samba/libsamba-net-samba4.so +/usr/lib/libsamba-policy.so.0 +/usr/lib/libsamba-policy.so.0.0.1 +/usr/lib/python3.10/site-packages/samba/dsdb_dns.so +/usr/lib/python3.10/site-packages/samba/dsdb.so +/usr/lib/python3.10/site-packages/samba/xattr_tdb.so +/usr/lib/python3.10/site-packages/samba/_ldb.so +/usr/lib/python3.10/site-packages/samba/gensec.so +[snip] + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Yi Zhao +--- + third_party/waf/waflib/Tools/python.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py +index a23bd01..af202e0 100644 +--- a/third_party/waf/waflib/Tools/python.py ++++ b/third_party/waf/waflib/Tools/python.py +@@ -328,7 +328,7 @@ def check_python_headers(conf, features='pyembed pyext'): + x = 'MACOSX_DEPLOYMENT_TARGET' + if dct[x]: + env[x] = conf.environ[x] = str(dct[x]) +- env.pyext_PATTERN = '%s' + (dct['EXT_SUFFIX'] or dct['SO']) # SO is deprecated in 3.5 and removed in 3.11 ++ env.pyext_PATTERN = '%s.so' + + + # Try to get pythonX.Y-config +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0005-samba-build-dnsserver_common-code.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0005-samba-build-dnsserver_common-code.patch deleted file mode 100644 index 2abbe563ae..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0005-samba-build-dnsserver_common-code.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 10d7abc8f1aa99ae45209aeb704978d206f329c0 Mon Sep 17 00:00:00 2001 -From: Joe Slater -Date: Tue, 1 Jun 2021 11:09:19 +0800 -Subject: [PATCH] samba: build dnsserver_common code - -Just 'install' does not seem to do it. - -Upstream-Status: Pending - -Signed-off-by: Joe Slater ---- - source4/dns_server/wscript_build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/source4/dns_server/wscript_build b/source4/dns_server/wscript_build -index e97c85d..a49fbb9 100644 ---- a/source4/dns_server/wscript_build -+++ b/source4/dns_server/wscript_build -@@ -4,7 +4,7 @@ bld.SAMBA_LIBRARY('dnsserver_common', - source='dnsserver_common.c', - deps='samba-util samba-errors ldbsamba clidns', - private_library=True, -- install=bld.AD_DC_BUILD_IS_ENABLED() -+ enabled=bld.AD_DC_BUILD_IS_ENABLED() - ) - - bld.SAMBA_MODULE('service_dns', --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0006-smbtorture-skip-test-case-tfork_cmd_send.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0006-smbtorture-skip-test-case-tfork_cmd_send.patch new file mode 100644 index 0000000000..cc4c15e099 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0006-smbtorture-skip-test-case-tfork_cmd_send.patch @@ -0,0 +1,38 @@ +From 950b5977ea7e72343067d0070cc35fb0dc5163d4 Mon Sep 17 00:00:00 2001 +From: Yi Zhao +Date: Thu, 25 Aug 2022 16:46:04 +0800 +Subject: [PATCH] smbtorture: skip test case tfork_cmd_send + +The test case tfork_cmd_send fails on target as it requires a script +located in the source directory: + +$ smbtorture ncalrpc:localhost local.tfork.tfork_cmd_send +test: tfork_cmd_send +/buildarea/build/tmp/work/core2-64-poky-linux/samba/4.14.14-r0/samba-4.14.14/testprogs/blackbox/tfork.sh: +Failed to exec child - No such file or directory + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Yi Zhao +--- + lib/util/tests/tfork.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/lib/util/tests/tfork.c b/lib/util/tests/tfork.c +index 70ae975..4826ce6 100644 +--- a/lib/util/tests/tfork.c ++++ b/lib/util/tests/tfork.c +@@ -839,10 +839,6 @@ struct torture_suite *torture_local_tfork(TALLOC_CTX *mem_ctx) + "tfork_threads", + test_tfork_threads); + +- torture_suite_add_simple_test(suite, +- "tfork_cmd_send", +- test_tfork_cmd_send); +- + torture_suite_add_simple_test(suite, + "tfork_event_file_handle", + test_tfork_event_file_handle); +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0007-waf-Fix-errors-with-Werror-implicit-function-declara.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0007-waf-Fix-errors-with-Werror-implicit-function-declara.patch new file mode 100644 index 0000000000..91eb22967a --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0007-waf-Fix-errors-with-Werror-implicit-function-declara.patch @@ -0,0 +1,32 @@ +From 95946ce8b6317f68c51338d19d237ce6da61d1c3 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 27 Aug 2022 13:05:26 -0700 +Subject: [PATCH] waf: Fix errors with Werror=implicit-function-declaration + turned on + +Clang-15 turns this option into errors by default, and it results in +rpath check failures + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + buildtools/wafsamba/samba_waf18.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py +index e2a078b..e145c77 100644 +--- a/buildtools/wafsamba/samba_waf18.py ++++ b/buildtools/wafsamba/samba_waf18.py +@@ -209,7 +209,7 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None): + lib_node.parent.mkdir() + lib_node.write('int lib_func(void) { return 42; }\n', 'w') + main_node = bld.srcnode.make_node('main.c') +- main_node.write('int main(void) {return !(lib_func() == 42);}', 'w') ++ main_node.write('int lib_func(void); int main(void) {return !(lib_func() == 42);}', 'w') + linkflags = [] + if version_script: + script = bld.srcnode.make_node('ldscript') +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0008-Deleted-settiong-of-python-to-fix-the-install-confli.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0008-Deleted-settiong-of-python-to-fix-the-install-confli.patch new file mode 100644 index 0000000000..45a7c82d80 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/0008-Deleted-settiong-of-python-to-fix-the-install-confli.patch @@ -0,0 +1,123 @@ +From f783bb9c87ce11e824dfefca473d0dcf6edad238 Mon Sep 17 00:00:00 2001 +From: Lei Maohui +Date: Sun, 30 Oct 2022 11:59:31 +0900 +Subject: [PATCH] Deleted settiong of python to fix the install conflict error + when enable multilib. + + file /usr/bin/samba-tool conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 + file /usr/sbin/samba-gpupdate conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 + file /usr/sbin/samba_dnsupdate conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 + file /usr/sbin/samba_downgrade_db conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 + file /usr/sbin/samba_kcc conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 + file /usr/sbin/samba_spnupdate conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 + file /usr/sbin/samba_upgradedns conflicts between attempted installs of samba-4.14.14-r0.core2_64 and lib32-samba-4.14.14-r0.i686 + +The conflict is because there is a difference between of lib32-samba-* and samba-* as the following: +64bit: +sys.path.insert(0, "/usr/lib64/python3.10/site-packages") + +32bit: +sys.path.insert(0, "/usr/lib/python3.10/site-packages") + +But this setting is for environment when running from source tree. There +is no necessary on target. + +Upstream-Status: Inappropriate +Signed-off-by: Lei Maohui +--- + source4/scripting/bin/samba-gpupdate | 1 - + source4/scripting/bin/samba-tool | 1 - + source4/scripting/bin/samba_dnsupdate | 1 - + source4/scripting/bin/samba_downgrade_db | 1 - + source4/scripting/bin/samba_kcc | 1 - + source4/scripting/bin/samba_spnupdate | 1 - + source4/scripting/bin/samba_upgradedns | 1 - + 7 files changed, 7 deletions(-) + +diff --git a/source4/scripting/bin/samba-gpupdate b/source4/scripting/bin/samba-gpupdate +index 4b3f057..08fec2d 100755 +--- a/source4/scripting/bin/samba-gpupdate ++++ b/source4/scripting/bin/samba-gpupdate +@@ -25,7 +25,6 @@ applied, have changed, or is in the right container''' + import os + import sys + +-sys.path.insert(0, "bin/python") + + import optparse + from samba import getopt as options +diff --git a/source4/scripting/bin/samba-tool b/source4/scripting/bin/samba-tool +index f8a70a6..3c818de 100755 +--- a/source4/scripting/bin/samba-tool ++++ b/source4/scripting/bin/samba-tool +@@ -22,7 +22,6 @@ + import sys + + # Find right direction when running from source tree +-sys.path.insert(0, "bin/python") + + # make sure the script dies immediately when hitting control-C, + # rather than raising KeyboardInterrupt. As we do all database +diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate +index 1ce53f5..2cdfbf8 100755 +--- a/source4/scripting/bin/samba_dnsupdate ++++ b/source4/scripting/bin/samba_dnsupdate +@@ -36,7 +36,6 @@ os.environ['PYTHONUNBUFFERED'] = '1' + os.environ["TZ"] = "GMT" + + # Find right directory when running from source tree +-sys.path.insert(0, "bin/python") + + import samba + import optparse +diff --git a/source4/scripting/bin/samba_downgrade_db b/source4/scripting/bin/samba_downgrade_db +index b9a0909..80f581e 100755 +--- a/source4/scripting/bin/samba_downgrade_db ++++ b/source4/scripting/bin/samba_downgrade_db +@@ -23,7 +23,6 @@ import optparse + import sys + + # Find right directory when running from source tree +-sys.path.insert(0, "bin/python") + + + import samba +diff --git a/source4/scripting/bin/samba_kcc b/source4/scripting/bin/samba_kcc +index 67d801e..2fc0d6a 100755 +--- a/source4/scripting/bin/samba_kcc ++++ b/source4/scripting/bin/samba_kcc +@@ -36,7 +36,6 @@ os.environ['PYTHONUNBUFFERED'] = '1' + os.environ["TZ"] = "GMT" + + # Find right directory when running from source tree +-sys.path.insert(0, "bin/python") + + import optparse + import time +diff --git a/source4/scripting/bin/samba_spnupdate b/source4/scripting/bin/samba_spnupdate +index 84ff771..b6fe041 100755 +--- a/source4/scripting/bin/samba_spnupdate ++++ b/source4/scripting/bin/samba_spnupdate +@@ -32,7 +32,6 @@ os.environ['PYTHONUNBUFFERED'] = '1' + os.environ["TZ"] = "GMT" + + # Find right directory when running from source tree +-sys.path.insert(0, "bin/python") + + import samba, ldb + import optparse +diff --git a/source4/scripting/bin/samba_upgradedns b/source4/scripting/bin/samba_upgradedns +index afc5807..727a3cc 100755 +--- a/source4/scripting/bin/samba_upgradedns ++++ b/source4/scripting/bin/samba_upgradedns +@@ -27,7 +27,6 @@ import grp + from base64 import b64encode + import shlex + +-sys.path.insert(0, "bin/python") + + import ldb + import samba +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/cmocka-uintptr_t.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/cmocka-uintptr_t.patch index 5c299d617b..e6e8784338 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/cmocka-uintptr_t.patch +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/cmocka-uintptr_t.patch @@ -1,4 +1,4 @@ -From 5bd7b5d04435bd593349825973ce32290f5f604d Mon Sep 17 00:00:00 2001 +From 14f8ee7cd1318567b00e52217d57f0a528fd2cf7 Mon Sep 17 00:00:00 2001 From: Changqing Li Date: Wed, 25 Jul 2018 09:55:25 +0800 Subject: [PATCH] samba: cmocka.h: fix musl libc conflicting types error @@ -22,10 +22,10 @@ Signed-off-by: Andrea Adami 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/third_party/cmocka/cmocka.h b/third_party/cmocka/cmocka.h -index 4fd82a9..5443a08 100644 +index e6861c8..238201d 100644 --- a/third_party/cmocka/cmocka.h +++ b/third_party/cmocka/cmocka.h -@@ -110,7 +110,7 @@ typedef uintmax_t LargestIntegralType; +@@ -111,7 +111,7 @@ typedef uintmax_t LargestIntegralType; ((LargestIntegralType)(value)) /* Smallest integral type capable of holding a pointer. */ @@ -34,7 +34,7 @@ index 4fd82a9..5443a08 100644 # if defined(_WIN32) /* WIN32 is an ILP32 platform */ typedef unsigned int uintptr_t; -@@ -134,9 +134,8 @@ typedef uintmax_t LargestIntegralType; +@@ -135,9 +135,8 @@ typedef uintmax_t LargestIntegralType; # endif /* __WORDSIZE */ # endif /* _WIN32 */ @@ -47,5 +47,5 @@ index 4fd82a9..5443a08 100644 /* Perform an unsigned cast to uintptr_t. */ #define cast_to_pointer_integral_type(value) \ -- -2.7.4 +2.25.1 diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/netdb_defines.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/netdb_defines.patch deleted file mode 100644 index eb06866f46..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/netdb_defines.patch +++ /dev/null @@ -1,19 +0,0 @@ -Index: samba-4.6.2/nsswitch/wins.c -=================================================================== ---- samba-4.6.2.orig/nsswitch/wins.c -+++ samba-4.6.2/nsswitch/wins.c -@@ -39,6 +39,14 @@ static pthread_mutex_t wins_nss_mutex = - #define INADDRSZ 4 - #endif - -+#ifndef NETDB_INTERNAL -+#define NETDB_INTERNAL (-1) -+#endif -+ -+#ifndef NETDB_SUCCESS -+#define NETDB_SUCCESS 0 -+#endif -+ - NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, - struct hostent *he, - char *buffer, diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-4.3.9-remove-getpwent_r.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-4.3.9-remove-getpwent_r.patch index a75ac2bbae..22451a2d11 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-4.3.9-remove-getpwent_r.patch +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-4.3.9-remove-getpwent_r.patch @@ -1,4 +1,4 @@ -From 02e0b14d8fa025a5db410d60a7c0dfebd536aaeb Mon Sep 17 00:00:00 2001 +From 08003ea30d86a8b983be89f6a161d3baacdaa038 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 6 Nov 2016 23:40:54 -0800 Subject: [PATCH] Musl does not have _r versions of getent() and getpwent() @@ -8,13 +8,12 @@ Taken from gentoo http://data.gpo.zugaina.org/musl/net-fs/samba/files/samba-4.3.9-remove-getpwent_r.patch Signed-off-by: Khem Raj - --- source4/torture/local/nss_tests.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source4/torture/local/nss_tests.c b/source4/torture/local/nss_tests.c -index 2cd6122..04f13c6 100644 +index 2943122..bc185ca 100644 --- a/source4/torture/local/nss_tests.c +++ b/source4/torture/local/nss_tests.c @@ -247,7 +247,6 @@ static bool test_getgrnam_r(struct torture_context *tctx, @@ -33,7 +32,7 @@ index 2cd6122..04f13c6 100644 static bool test_enum_r_passwd(struct torture_context *tctx, struct passwd **pwd_array_p, size_t *num_pwd_p) -@@ -381,6 +381,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx, +@@ -383,6 +383,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx, return true; } @@ -41,7 +40,7 @@ index 2cd6122..04f13c6 100644 static bool torture_assert_passwd_equal(struct torture_context *tctx, const struct passwd *p1, -@@ -432,7 +433,7 @@ static bool test_passwd_r(struct torture_context *tctx) +@@ -434,7 +435,7 @@ static bool test_passwd_r(struct torture_context *tctx) struct passwd *pwd, pwd1, pwd2; size_t num_pwd; @@ -50,7 +49,7 @@ index 2cd6122..04f13c6 100644 "failed to enumerate passwd"); for (i=0; i < num_pwd; i++) { -@@ -460,7 +461,7 @@ static bool test_passwd_r_cross(struct torture_context *tctx) +@@ -462,7 +463,7 @@ static bool test_passwd_r_cross(struct torture_context *tctx) struct passwd *pwd, pwd1, pwd2, pwd3, pwd4; size_t num_pwd; @@ -59,7 +58,7 @@ index 2cd6122..04f13c6 100644 "failed to enumerate passwd"); for (i=0; i < num_pwd; i++) { -@@ -531,6 +532,7 @@ static bool test_enum_group(struct torture_context *tctx, +@@ -533,6 +534,7 @@ static bool test_enum_group(struct torture_context *tctx, return true; } @@ -67,7 +66,7 @@ index 2cd6122..04f13c6 100644 static bool test_enum_r_group(struct torture_context *tctx, struct group **grp_array_p, size_t *num_grp_p) -@@ -579,6 +581,7 @@ static bool test_enum_r_group(struct torture_context *tctx, +@@ -583,6 +585,7 @@ static bool test_enum_r_group(struct torture_context *tctx, return true; } @@ -75,7 +74,7 @@ index 2cd6122..04f13c6 100644 static bool torture_assert_group_equal(struct torture_context *tctx, const struct group *g1, -@@ -635,7 +638,7 @@ static bool test_group_r(struct torture_context *tctx) +@@ -639,7 +642,7 @@ static bool test_group_r(struct torture_context *tctx) struct group *grp, grp1, grp2; size_t num_grp; @@ -84,7 +83,7 @@ index 2cd6122..04f13c6 100644 "failed to enumerate group"); for (i=0; i < num_grp; i++) { -@@ -663,7 +666,7 @@ static bool test_group_r_cross(struct torture_context *tctx) +@@ -667,7 +670,7 @@ static bool test_group_r_cross(struct torture_context *tctx) struct group *grp, grp1, grp2, grp3, grp4; size_t num_grp; @@ -93,3 +92,6 @@ index 2cd6122..04f13c6 100644 "failed to enumerate group"); for (i=0; i < num_grp; i++) { +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-fix-musl-lib-without-innetgr.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-fix-musl-lib-without-innetgr.patch deleted file mode 100644 index fb12a10e26..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-fix-musl-lib-without-innetgr.patch +++ /dev/null @@ -1,42 +0,0 @@ -From fcb8ecd530b2d151e373974741601483326f7528 Mon Sep 17 00:00:00 2001 -From: Changqing Li -Date: Thu, 27 Jun 2019 11:09:47 +0800 -Subject: [PATCH] samba: fix musl lib without innetgr - -Upstream-Status: Pending - -Signed-off-by: Changqing Li ---- - lib/util/access.c | 2 +- - source3/auth/user_util.c | 2 +- - 2 file changed, 2 insertion(+), 2 deletion(-) - -diff --git a/lib/util/access.c b/lib/util/access.c -index 7da0573..b94949e 100644 ---- a/lib/util/access.c -+++ b/lib/util/access.c -@@ -112,7 +112,7 @@ static bool string_match(const char *tok,const char *s) - return true; - } - } else if (tok[0] == '@') { /* netgroup: look it up */ --#ifdef HAVE_NETGROUP -+#if defined(HAVE_NETGROUP) && defined(HAVE_INNETGR) - DATA_BLOB tmp; - char *mydomain = NULL; - char *hostname = NULL; -diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c -index a76b5d4..30f523d 100644 ---- a/source3/auth/user_util.c -+++ b/source3/auth/user_util.c -@@ -148,7 +148,7 @@ static void store_map_in_gencache(TALLOC_CTX *ctx, const char *from, const char - - bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname) - { --#ifdef HAVE_NETGROUP -+#if defined(HAVE_NETGROUP) && defined(HAVE_INNETGR) - static char *my_yp_domain = NULL; - char *lowercase_user = NULL; - --- -2.7.4 - diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-pam.patch b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-pam.patch index 27b40f2152..9e45459931 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-pam.patch +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba/samba-pam.patch @@ -1,4 +1,4 @@ -From 54a5279cb33abd23ef7c094d51f16078ece2da0c Mon Sep 17 00:00:00 2001 +From 6822c61ade5617c9f109e32ad4cdc115fa9e12c8 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 6 Nov 2016 23:40:54 -0800 Subject: [PATCH] Lifted from gentoo and ported to 4.4.5 @@ -6,16 +6,15 @@ Subject: [PATCH] Lifted from gentoo and ported to 4.4.5 http://data.gpo.zugaina.org/musl/net-fs/samba/files/samba-4.2.7-pam.patch Signed-off-by: Khem Raj - --- source3/wscript | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source3/wscript b/source3/wscript -index 5436db2..864f614 100644 +index 22be17a..ee9ce52 100644 --- a/source3/wscript +++ b/source3/wscript -@@ -879,7 +879,7 @@ msg.msg_accrightslen = sizeof(fd); +@@ -862,7 +862,7 @@ msg.msg_accrightslen = sizeof(fd); if conf.env.with_iconv: conf.DEFINE('HAVE_ICONV', 1) @@ -24,7 +23,7 @@ index 5436db2..864f614 100644 use_pam=True conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h') if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'): -@@ -956,6 +956,17 @@ int i; i = PAM_RADIO_TYPE; +@@ -939,6 +939,17 @@ int i; i = PAM_RADIO_TYPE; "or headers not found. Use --without-pam to disable " "PAM support."); @@ -42,3 +41,6 @@ index 5436db2..864f614 100644 seteuid = False # +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba_4.14.14.bb b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba_4.14.14.bb deleted file mode 100644 index 9d7259e96f..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba_4.14.14.bb +++ /dev/null @@ -1,352 +0,0 @@ -HOMEPAGE = "https://www.samba.org/" -SECTION = "console/network" - -LICENSE = "GPL-3.0-or-later & LGPL-3.0-or-later & GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ - file://${COREBASE}/meta/files/common-licenses/LGPL-3.0-or-later;md5=c51d3eef3be114124d11349ca0d7e117 \ - file://${COREBASE}/meta/files/common-licenses/GPL-2.0-or-later;md5=fed54355545ffd980b814dab4a3b312c" - -SAMBA_MIRROR = "http://samba.org/samba/ftp" -MIRRORS += "\ -${SAMBA_MIRROR} http://mirror.internode.on.net/pub/samba \n \ -${SAMBA_MIRROR} http://www.mirrorservice.org/sites/ftp.samba.org \n \ -" - -SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \ - file://smb.conf \ - file://volatiles.03_samba \ - file://0001-Don-t-check-xsltproc-manpages.patch \ - file://0002-do-not-import-target-module-while-cross-compile.patch \ - file://0003-Add-config-option-without-valgrind.patch \ - file://0004-Add-options-to-configure-the-use-of-libbsd.patch \ - file://0005-samba-build-dnsserver_common-code.patch \ - file://0001-Fix-pyext_PATTERN-for-cross-compilation.patch \ - file://0001-smbtorture-skip-test-case-tfork_cmd_send.patch \ - file://0001-waf-Fix-errors-with-Werror-implicit-function-declara.patch \ - file://0001-Deleted-settiong-of-python-to-fix-the-install-confli.patch \ - " - -SRC_URI:append:libc-musl = " \ - file://netdb_defines.patch \ - file://samba-pam.patch \ - file://samba-4.3.9-remove-getpwent_r.patch \ - file://cmocka-uintptr_t.patch \ - file://samba-fix-musl-lib-without-innetgr.patch \ - " - -SRC_URI[sha256sum] = "abd5e9e6aa45e55114b188ba189ebdfc8fd3d7718d43f749e477ce7f791e5519" - -UPSTREAM_CHECK_REGEX = "samba\-(?P4\.14(\.\d+)+).tar.gz" - -inherit systemd waf-samba cpan-base perlnative update-rc.d perl-version pkgconfig - -# CVE-2011-2411 is valnerble only on HP NonStop Servers. -CVE_CHECK_IGNORE += "CVE-2011-2411" - -# remove default added RDEPENDS on perl -RDEPENDS:${PN}:remove = "perl" - -DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb libaio libpam libtasn1 jansson libparse-yapp-perl-native gnutls" - -inherit features_check -REQUIRED_DISTRO_FEATURES = "pam" - -DEPENDS:append:libc-musl = " libtirpc" -CFLAGS:append:libc-musl = " -I${STAGING_INCDIR}/tirpc" -LDFLAGS:append:libc-musl = " -ltirpc" - -COMPATIBLE_HOST:riscv32 = "null" - -INITSCRIPT_NAME = "samba" -INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ." - -SYSTEMD_PACKAGES = "${PN}-base ${PN}-ad-dc winbind" -SYSTEMD_SERVICE:${PN}-base = "nmb.service smb.service" -SYSTEMD_SERVICE:${PN}-ad-dc = "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'samba.service', '', d)}" -SYSTEMD_SERVICE:winbind = "winbind.service" - -# There are prerequisite settings to enable ad-dc, so disable the service by default. -# Reference: -# https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller -SYSTEMD_AUTO_ENABLE:${PN}-ad-dc = "disable" - -#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen -#to cross Popen -export WAF_NO_PREFORK="yes" - -# Use krb5. Build active domain controller. -# -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd zeroconf', d)} \ - acl cups ad-dc ldap mitkrb5 \ -" - -RDEPENDS:${PN}-ctdb-tests += "bash util-linux-getopt" - -PACKAGECONFIG[acl] = "--with-acl-support,--without-acl-support,acl" -PACKAGECONFIG[fam] = "--with-fam,--without-fam,gamin" -PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups" -PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap" -PACKAGECONFIG[sasl] = ",,cyrus-sasl" -PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" -PACKAGECONFIG[dmapi] = "--with-dmapi,--without-dmapi,dmapi" -PACKAGECONFIG[zeroconf] = "--enable-avahi,--disable-avahi,avahi" -PACKAGECONFIG[valgrind] = ",--without-valgrind,valgrind," -PACKAGECONFIG[lttng] = "--with-lttng, --without-lttng,lttng-ust" -PACKAGECONFIG[archive] = "--with-libarchive, --without-libarchive, libarchive" -PACKAGECONFIG[libunwind] = ", , libunwind" -PACKAGECONFIG[gpgme] = ",--without-gpgme,," -PACKAGECONFIG[lmdb] = ",--without-ldb-lmdb,lmdb," -PACKAGECONFIG[libbsd] = "--with-libbsd, --without-libbsd, libbsd" -PACKAGECONFIG[ad-dc] = "--with-experimental-mit-ad-dc,--without-ad-dc,python3-markdown python3-dnspython," -PACKAGECONFIG[mitkrb5] = "--with-system-mitkrb5 --with-system-mitkdc=/usr/sbin/krb5kdc,,krb5," - -SAMBA4_IDMAP_MODULES="idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2" -SAMBA4_PDB_MODULES="pdb_tdbsam,${@bb.utils.contains('PACKAGECONFIG', 'ldap', 'pdb_ldap,', '', d)}pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4" -SAMBA4_AUTH_MODULES="auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4" -SAMBA4_MODULES="${SAMBA4_IDMAP_MODULES},${SAMBA4_PDB_MODULES},${SAMBA4_AUTH_MODULES}" - -# These libraries are supposed to replace others supplied by packages, but decorate the names of -# .so files so there will not be a conflict. This is not done consistantly, so be very careful -# when adding to this list. -# -SAMBA4_LIBS="heimdal,cmocka,NONE" - -EXTRA_OECONF += "--enable-fhs \ - --with-piddir=/run \ - --with-sockets-dir=/run/samba \ - --with-modulesdir=${libdir}/samba \ - --with-privatelibdir=${libdir}/samba \ - --with-lockdir=${localstatedir}/lib/samba \ - --with-cachedir=${localstatedir}/lib/samba \ - --disable-rpath-install \ - --disable-rpath \ - --with-shared-modules=${SAMBA4_MODULES} \ - --bundled-libraries=${SAMBA4_LIBS} \ - ${@oe.utils.conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs', d)} \ - --with-cluster-support \ - --with-profiling-data \ - --with-libiconv=${STAGING_DIR_HOST}${prefix} \ - --with-pam --with-pammodulesdir=${base_libdir}/security \ - " - -LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" - -do_configure:append () { - cd ${S}/pidl/ - perl Makefile.PL PREFIX=${prefix} - sed -e 's,VENDORPREFIX)/lib/perl,VENDORPREFIX)/${baselib}/perl,g' \ - -e 's,PERLPREFIX)/lib/perl,PERLPREFIX)/${baselib}/perl,g' -i Makefile - -} - -do_compile:append () { - oe_runmake -C ${S}/pidl -} - -do_install:append() { - for section in 1 5 7; do - install -d ${D}${mandir}/man$section - install -m 0644 ctdb/doc/*.$section ${D}${mandir}/man$section - done - for section in 1 5 7 8; do - install -d ${D}${mandir}/man$section - install -m 0644 docs/manpages/*.$section ${D}${mandir}/man$section - done - - install -d ${D}${systemd_system_unitdir} - install -m 0644 ${S}/bin/default/packaging/systemd/*.service ${D}${systemd_system_unitdir}/ - sed -e 's,\(ExecReload=\).*\(/kill\),\1${base_bindir}\2,' \ - -e 's,/etc/sysconfig/samba,${sysconfdir}/default/samba,' \ - -i ${D}${systemd_system_unitdir}/*.service - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'yes', 'no', d)}" = "no" ]; then - rm -f ${D}${systemd_system_unitdir}/samba.service - fi - - install -d ${D}${sysconfdir}/tmpfiles.d - install -m644 packaging/systemd/samba.conf.tmp ${D}${sysconfdir}/tmpfiles.d/samba.conf - echo "d ${localstatedir}/log/samba 0755 root root -" \ - >> ${D}${sysconfdir}/tmpfiles.d/samba.conf - install -d ${D}${sysconfdir}/init.d - install -m 0755 packaging/sysv/samba.init ${D}${sysconfdir}/init.d/samba - sed -e 's,/opt/samba/bin,${sbindir},g' \ - -e 's,/opt/samba/smb.conf,${sysconfdir}/samba/smb.conf,g' \ - -e 's,/opt/samba/log,${localstatedir}/log/samba,g' \ - -e 's,/etc/init.d/samba.server,${sysconfdir}/init.d/samba,g' \ - -e 's,/usr/bin,${base_bindir},g' \ - -i ${D}${sysconfdir}/init.d/samba - - install -d ${D}${sysconfdir}/samba - echo "127.0.0.1 localhost" > ${D}${sysconfdir}/samba/lmhosts - install -m644 ${WORKDIR}/smb.conf ${D}${sysconfdir}/samba/smb.conf - install -D -m 644 ${WORKDIR}/volatiles.03_samba ${D}${sysconfdir}/default/volatiles/03_samba - - install -d ${D}${sysconfdir}/default - install -m644 packaging/systemd/samba.sysconfig ${D}${sysconfdir}/default/samba - - # the items are from ctdb/tests/run_tests.sh - for d in cunit eventd eventscripts onnode shellcheck takeover takeover_helper tool; do - testdir=${D}${datadir}/ctdb-tests/UNIT/$d - install -d $testdir - cp ${S}/ctdb/tests/UNIT/$d/*.sh $testdir - cp -r ${S}/ctdb/tests/UNIT/$d/scripts ${S}/ctdb/tests/UNIT/$d/stubs $testdir || true - done - - # fix file-rdeps qa warning - if [ -f ${D}${bindir}/onnode ]; then - sed -i 's:\(#!/bin/\)bash:\1sh:' ${D}${bindir}/onnode - fi - - chmod 0750 ${D}${sysconfdir}/sudoers.d || true - rm -rf ${D}/run ${D}${localstatedir}/run ${D}${localstatedir}/log - - for f in samba-gpupdate samba_upgradedns samba_spnupdate samba_kcc samba_dnsupdate samba_downgrade_db; do - if [ -f "${D}${sbindir}/$f" ]; then - sed -i -e 's,${PYTHON},/usr/bin/env python3,g' ${D}${sbindir}/$f - fi - done - if [ -f "${D}${bindir}/samba-tool" ]; then - sed -i -e 's,${PYTHON},/usr/bin/env python3,g' ${D}${bindir}/samba-tool - fi - - oe_runmake -C ${S}/pidl DESTDIR=${D} install_vendor - find ${D}${libdir}/ -type f -name "perllocal.pod" | xargs rm -f - rm -rf ${D}${libdir}/perl5/vendor_perl/${PERLVERSION}/${BUILD_SYS}/auto/Parse/Pidl/.packlist - sed -i -e '1s,#!.*perl,#!${bindir}/env perl,' ${D}${bindir}/pidl -} - -PACKAGES =+ "${PN}-python3 ${PN}-pidl \ - ${PN}-dsdb-modules ${PN}-testsuite registry-tools \ - winbind \ - ${PN}-common ${PN}-base ${PN}-ad-dc ${PN}-ctdb-tests \ - smbclient ${PN}-client ${PN}-server ${PN}-test" - -python samba_populate_packages() { - def module_hook(file, pkg, pattern, format, basename): - pn = d.getVar('PN') - d.appendVar('RRECOMMENDS:%s-base' % pn, ' %s' % pkg) - - mlprefix = d.getVar('MLPREFIX') or '' - pam_libdir = d.expand('${base_libdir}/security') - pam_pkgname = mlprefix + 'pam-plugin%s' - do_split_packages(d, pam_libdir, r'^pam_(.*)\.so$', pam_pkgname, 'PAM plugin for %s', extra_depends='', prepend=True) - - libdir = d.getVar('libdir') - do_split_packages(d, libdir, r'^lib(.*)\.so\..*$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True, allow_links=True) - pkglibdir = '%s/samba' % libdir - do_split_packages(d, pkglibdir, r'^lib(.*)\.so$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True) - moduledir = '%s/samba/auth' % libdir - do_split_packages(d, moduledir, r'^(.*)\.so$', 'samba-auth-%s', 'Samba %s authentication backend', hook=module_hook, extra_depends='', prepend=True) - moduledir = '%s/samba/pdb' % libdir - do_split_packages(d, moduledir, r'^(.*)\.so$', 'samba-pdb-%s', 'Samba %s password backend', hook=module_hook, extra_depends='', prepend=True) -} - -PACKAGESPLITFUNCS:prepend = "samba_populate_packages " -PACKAGES_DYNAMIC = "samba-auth-.* samba-pdb-.*" - -RDEPENDS:${PN} += "${PN}-base ${PN}-python3 ${PN}-dsdb-modules python3" -RDEPENDS:${PN}-python3 += "pytalloc python3-tdb pyldb" - -FILES:${PN}-base = "${sbindir}/nmbd \ - ${sbindir}/smbd \ - ${sysconfdir}/init.d \ - ${systemd_system_unitdir}/nmb.service \ - ${systemd_system_unitdir}/smb.service" - -FILES:${PN}-ad-dc = "${sbindir}/samba \ - ${systemd_system_unitdir}/samba.service \ - ${libdir}/krb5/plugins/kdb/samba.so \ -" -RDEPENDS:${PN}-ad-dc = "krb5-kdc" - -FILES:${PN}-ctdb-tests = "${bindir}/ctdb_run_tests \ - ${bindir}/ctdb_run_cluster_tests \ - ${sysconfdir}/ctdb/nodes \ - ${datadir}/ctdb-tests \ - ${datadir}/ctdb/tests \ - ${localstatedir}/lib/ctdb \ - " - -FILES:${BPN}-common = "${sysconfdir}/default \ - ${sysconfdir}/samba \ - ${sysconfdir}/tmpfiles.d \ - ${localstatedir}/lib/samba \ - ${localstatedir}/spool/samba \ -" - -FILES:${PN} += "${libdir}/vfs/*.so \ - ${libdir}/charset/*.so \ - ${libdir}/*.dat \ - ${libdir}/auth/*.so \ - ${datadir}/ctdb/events/* \ -" - -FILES:${PN}-dsdb-modules = "${libdir}/samba/ldb" - -FILES:${PN}-testsuite = "${bindir}/gentest \ - ${bindir}/locktest \ - ${bindir}/masktest \ - ${bindir}/ndrdump \ - ${bindir}/smbtorture" - -FILES:registry-tools = "${bindir}/regdiff \ - ${bindir}/regpatch \ - ${bindir}/regshell \ - ${bindir}/regtree" - -FILES:winbind = "${sbindir}/winbindd \ - ${bindir}/wbinfo \ - ${bindir}/ntlm_auth \ - ${libdir}/samba/idmap \ - ${libdir}/samba/nss_info \ - ${libdir}/winbind_krb5_locator.so \ - ${libdir}/winbind-krb5-localauth.so \ - ${sysconfdir}/init.d/winbind \ - ${systemd_system_unitdir}/winbind.service" - -FILES:${PN}-python3 = "${PYTHON_SITEPACKAGES_DIR}" - -FILES:smbclient = "${bindir}/cifsdd \ - ${bindir}/rpcclient \ - ${bindir}/smbcacls \ - ${bindir}/smbclient \ - ${bindir}/smbcquotas \ - ${bindir}/smbget \ - ${bindir}/smbspool \ - ${bindir}/smbtar \ - ${bindir}/smbtree \ - ${libdir}/samba/smbspool_krb5_wrapper" - -RDEPENDS:${PN}-pidl:append = " perl libparse-yapp-perl" -FILES:${PN}-pidl = "${bindir}/pidl \ - ${libdir}/perl5 \ - " - -RDEPENDS:${PN}-client = "\ - smbclient \ - winbind \ - registry-tools \ - ${PN}-pidl \ - " - -ALLOW_EMPTY:${PN}-client = "1" - -RDEPENDS:${PN}-server = "\ - ${PN} \ - winbind \ - registry-tools \ - " - -ALLOW_EMPTY:${PN}-server = "1" - -RDEPENDS:${PN}-test = "\ - ${PN}-ctdb-tests \ - ${PN}-testsuite \ - " - -ALLOW_EMPTY:${PN}-test = "1" - -# Patch for CVE-2018-1050 is applied in version 4.5.15, 4.6.13, 4.7.5. -# Patch for CVE-2018-1057 is applied in version 4.3.13, 4.4.16. -CVE_CHECK_IGNORE += "CVE-2018-1050" -CVE_CHECK_IGNORE += "CVE-2018-1057" diff --git a/meta-openembedded/meta-networking/recipes-connectivity/samba/samba_4.17.4.bb b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba_4.17.4.bb new file mode 100644 index 0000000000..966eaf9bf9 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-connectivity/samba/samba_4.17.4.bb @@ -0,0 +1,362 @@ +HOMEPAGE = "https://www.samba.org/" +SECTION = "console/network" + +LICENSE = "GPL-3.0-or-later & LGPL-3.0-or-later & GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ + file://${COREBASE}/meta/files/common-licenses/LGPL-3.0-or-later;md5=c51d3eef3be114124d11349ca0d7e117 \ + file://${COREBASE}/meta/files/common-licenses/GPL-2.0-or-later;md5=fed54355545ffd980b814dab4a3b312c" + +SAMBA_MIRROR = "http://samba.org/samba/ftp" +MIRRORS += "\ +${SAMBA_MIRROR} http://mirror.internode.on.net/pub/samba \n \ +${SAMBA_MIRROR} http://www.mirrorservice.org/sites/ftp.samba.org \n \ +" + +export PYTHONHASHSEED="1" + +SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \ + file://smb.conf \ + file://volatiles.03_samba \ + file://0001-Don-t-check-xsltproc-manpages.patch \ + file://0002-do-not-import-target-module-while-cross-compile.patch \ + file://0003-Add-config-option-without-valgrind.patch \ + file://0004-Add-options-to-configure-the-use-of-libbsd.patch \ + file://0005-Fix-pyext_PATTERN-for-cross-compilation.patch \ + file://0006-smbtorture-skip-test-case-tfork_cmd_send.patch \ + file://0007-waf-Fix-errors-with-Werror-implicit-function-declara.patch \ + file://0008-Deleted-settiong-of-python-to-fix-the-install-confli.patch \ + " + +SRC_URI:append:libc-musl = " \ + file://samba-pam.patch \ + file://samba-4.3.9-remove-getpwent_r.patch \ + file://cmocka-uintptr_t.patch \ + " + +SRC_URI[sha256sum] = "c0512079db4cac707ccea4c18aebbd6b2eb3acf6e90735e7f645a326be1f4537" + +UPSTREAM_CHECK_REGEX = "samba\-(?P4\.17(\.\d+)+).tar.gz" + +inherit systemd waf-samba cpan-base perlnative update-rc.d perl-version pkgconfig + +# CVE-2011-2411 is valnerble only on HP NonStop Servers. +CVE_CHECK_IGNORE += "CVE-2011-2411" +# Patch for CVE-2018-1050 is applied in version 4.5.15, 4.6.13, 4.7.5. +CVE_CHECK_IGNORE += "CVE-2018-1050" +# Patch for CVE-2018-1057 is applied in version 4.3.13, 4.4.16. +CVE_CHECK_IGNORE += "CVE-2018-1057" + +# remove default added RDEPENDS on perl +RDEPENDS:${PN}:remove = "perl" + +DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb libaio libpam libtasn1 jansson libparse-yapp-perl-native gnutls" + +inherit features_check +REQUIRED_DISTRO_FEATURES = "pam" + +DEPENDS:append:libc-musl = " libtirpc" +CFLAGS:append:libc-musl = " -I${STAGING_INCDIR}/tirpc" +LDFLAGS:append:libc-musl = " -ltirpc" + +COMPATIBLE_HOST:riscv32 = "null" + +INITSCRIPT_NAME = "samba" +INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ." + +SYSTEMD_PACKAGES = "${PN}-base ${PN}-ad-dc winbind ctdb" +SYSTEMD_SERVICE:${PN}-base = "nmb.service smb.service" +SYSTEMD_SERVICE:${PN}-ad-dc = "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'samba.service', '', d)}" +SYSTEMD_SERVICE:winbind = "winbind.service" +SYSTEMD_SERVICE:ctdb = "ctdb.service" + +# There are prerequisite settings to enable ad-dc, so disable the service by default. +# Reference: +# https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller +SYSTEMD_AUTO_ENABLE:${PN}-ad-dc = "disable" + +#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen +#to cross Popen +export WAF_NO_PREFORK="yes" + +# Use krb5. Build active domain controller. +# +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd zeroconf', d)} \ + acl cups ad-dc ldap mitkrb5 \ +" + +PACKAGECONFIG[acl] = "--with-acl-support,--without-acl-support,acl" +PACKAGECONFIG[fam] = "--with-fam,--without-fam,gamin" +PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups" +PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap" +PACKAGECONFIG[sasl] = ",,cyrus-sasl" +PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd" +PACKAGECONFIG[dmapi] = "--with-dmapi,--without-dmapi,dmapi" +PACKAGECONFIG[zeroconf] = "--enable-avahi,--disable-avahi,avahi" +PACKAGECONFIG[valgrind] = ",--without-valgrind,valgrind," +PACKAGECONFIG[lttng] = "--with-lttng,--without-lttng,lttng-ust" +PACKAGECONFIG[archive] = "--with-libarchive,--without-libarchive,libarchive" +PACKAGECONFIG[libunwind] = "--with-libunwind,--without-libunwind,libunwind" +PACKAGECONFIG[gpgme] = "--with-gpgme,--without-gpgme,gpgme" +PACKAGECONFIG[lmdb] = ",--without-ldb-lmdb,lmdb" +PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd" +PACKAGECONFIG[ad-dc] = "--with-experimental-mit-ad-dc,--without-ad-dc,python3-markdown python3-dnspython," +PACKAGECONFIG[mitkrb5] = "--with-system-mitkrb5 --with-system-mitkdc=/usr/sbin/krb5kdc,,krb5," + +SAMBA4_IDMAP_MODULES="idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2" +SAMBA4_PDB_MODULES="pdb_tdbsam,${@bb.utils.contains('PACKAGECONFIG', 'ldap', 'pdb_ldap,', '', d)}pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4" +SAMBA4_AUTH_MODULES="auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4" +SAMBA4_MODULES="${SAMBA4_IDMAP_MODULES},${SAMBA4_PDB_MODULES},${SAMBA4_AUTH_MODULES}" + +# These libraries are supposed to replace others supplied by packages, but decorate the names of +# .so files so there will not be a conflict. This is not done consistantly, so be very careful +# when adding to this list. +# +SAMBA4_LIBS="heimdal,cmocka,NONE" + +EXTRA_OECONF += "--enable-fhs \ + --with-piddir=/run \ + --with-sockets-dir=/run/samba \ + --with-modulesdir=${libdir}/samba \ + --with-privatelibdir=${libdir}/samba \ + --with-lockdir=${localstatedir}/lib/samba \ + --with-cachedir=${localstatedir}/lib/samba \ + --disable-rpath-install \ + --disable-rpath \ + --with-shared-modules=${SAMBA4_MODULES} \ + --bundled-libraries=${SAMBA4_LIBS} \ + ${@oe.utils.conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs', d)} \ + --with-cluster-support \ + --with-profiling-data \ + --with-libiconv=${STAGING_DIR_HOST}${prefix} \ + --with-pam --with-pammodulesdir=${base_libdir}/security \ + " + +LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" + +do_configure:append() { + cd ${S}/pidl/ + perl Makefile.PL PREFIX=${prefix} + sed -e 's,VENDORPREFIX)/lib/perl,VENDORPREFIX)/${baselib}/perl,g' \ + -e 's,PERLPREFIX)/lib/perl,PERLPREFIX)/${baselib}/perl,g' -i Makefile +} + +do_compile:append() { + oe_runmake -C ${S}/pidl +} + +do_install:append() { + for section in 1 5 7; do + install -d ${D}${mandir}/man$section + install -m 0644 ctdb/doc/*.$section ${D}${mandir}/man$section + done + for section in 1 5 7 8; do + install -d ${D}${mandir}/man$section + install -m 0644 docs/manpages/*.$section ${D}${mandir}/man$section + done + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/bin/default/packaging/systemd/*.service ${D}${systemd_system_unitdir}/ + sed -e 's,\(ExecReload=\).*\(/kill\),\1${base_bindir}\2,' \ + -e 's,/etc/sysconfig/samba,${sysconfdir}/default/samba,' \ + -i ${D}${systemd_system_unitdir}/*.service + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'yes', 'no', d)}" = "no" ]; then + rm -f ${D}${systemd_system_unitdir}/samba.service + fi + + install -d ${D}${sysconfdir}/tmpfiles.d + install -m644 packaging/systemd/samba.conf.tmp ${D}${sysconfdir}/tmpfiles.d/samba.conf + echo "d ${localstatedir}/log/samba 0755 root root -" \ + >> ${D}${sysconfdir}/tmpfiles.d/samba.conf + install -d ${D}${sysconfdir}/init.d + install -m 0755 packaging/sysv/samba.init ${D}${sysconfdir}/init.d/samba + sed -e 's,/opt/samba/bin,${sbindir},g' \ + -e 's,/opt/samba/smb.conf,${sysconfdir}/samba/smb.conf,g' \ + -e 's,/opt/samba/log,${localstatedir}/log/samba,g' \ + -e 's,/etc/init.d/samba.server,${sysconfdir}/init.d/samba,g' \ + -e 's,/usr/bin,${base_bindir},g' \ + -i ${D}${sysconfdir}/init.d/samba + + install -d ${D}${sysconfdir}/samba + echo "127.0.0.1 localhost" > ${D}${sysconfdir}/samba/lmhosts + install -m644 ${WORKDIR}/smb.conf ${D}${sysconfdir}/samba/smb.conf + install -D -m 644 ${WORKDIR}/volatiles.03_samba ${D}${sysconfdir}/default/volatiles/03_samba + + install -d ${D}${sysconfdir}/default + install -m644 packaging/systemd/samba.sysconfig ${D}${sysconfdir}/default/samba + + # the items are from ctdb/tests/run_tests.sh + for d in cunit eventd eventscripts onnode shellcheck takeover takeover_helper tool; do + testdir=${D}${datadir}/ctdb-tests/UNIT/$d + install -d $testdir + cp ${S}/ctdb/tests/UNIT/$d/*.sh $testdir + cp -r ${S}/ctdb/tests/UNIT/$d/scripts ${S}/ctdb/tests/UNIT/$d/stubs $testdir || true + done + + # fix file-rdeps qa warning + if [ -f ${D}${bindir}/onnode ]; then + sed -i 's:\(#!/bin/\)bash:\1sh:' ${D}${bindir}/onnode + fi + + chmod 0750 ${D}${sysconfdir}/sudoers.d || true + rm -rf ${D}/run ${D}${localstatedir}/run ${D}${localstatedir}/log + + for f in samba-gpupdate samba_upgradedns samba_spnupdate samba_kcc samba_dnsupdate samba_downgrade_db; do + if [ -f "${D}${sbindir}/$f" ]; then + sed -i -e 's,${PYTHON},/usr/bin/env python3,g' ${D}${sbindir}/$f + fi + done + if [ -f "${D}${bindir}/samba-tool" ]; then + sed -i -e 's,${PYTHON},/usr/bin/env python3,g' ${D}${bindir}/samba-tool + fi + + oe_runmake -C ${S}/pidl DESTDIR=${D} install_vendor + find ${D}${libdir}/ -type f -name "perllocal.pod" | xargs rm -f + rm -rf ${D}${libdir}/perl5/vendor_perl/${PERLVERSION}/${BUILD_SYS}/auto/Parse/Pidl/.packlist + sed -i -e '1s,#!.*perl,#!${bindir}/env perl,' ${D}${bindir}/pidl +} + +PACKAGES =+ "${PN}-python3 ${PN}-pidl \ + ${PN}-dsdb-modules ${PN}-testsuite registry-tools \ + winbind ctdb ctdb-tests \ + ${PN}-common ${PN}-base ${PN}-ad-dc \ + smbclient ${PN}-client ${PN}-server ${PN}-test" + +python samba_populate_packages() { + def module_hook(file, pkg, pattern, format, basename): + pn = d.getVar('PN') + d.appendVar('RRECOMMENDS:%s-base' % pn, ' %s' % pkg) + + mlprefix = d.getVar('MLPREFIX') or '' + pam_libdir = d.expand('${base_libdir}/security') + pam_pkgname = mlprefix + 'pam-plugin%s' + do_split_packages(d, pam_libdir, r'^pam_(.*)\.so$', pam_pkgname, 'PAM plugin for %s', extra_depends='', prepend=True) + + libdir = d.getVar('libdir') + do_split_packages(d, libdir, r'^lib(.*)\.so\..*$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True, allow_links=True) + pkglibdir = '%s/samba' % libdir + do_split_packages(d, pkglibdir, r'^lib(.*)\.so$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True) + moduledir = '%s/samba/auth' % libdir + do_split_packages(d, moduledir, r'^(.*)\.so$', 'samba-auth-%s', 'Samba %s authentication backend', hook=module_hook, extra_depends='', prepend=True) + moduledir = '%s/samba/pdb' % libdir + do_split_packages(d, moduledir, r'^(.*)\.so$', 'samba-pdb-%s', 'Samba %s password backend', hook=module_hook, extra_depends='', prepend=True) +} + +PACKAGESPLITFUNCS:prepend = "samba_populate_packages " +PACKAGES_DYNAMIC = "samba-auth-.* samba-pdb-.*" + +RDEPENDS:${PN} += "${PN}-base ${PN}-python3 ${PN}-dsdb-modules python3" +RDEPENDS:${PN}-python3 += "pytalloc python3-tdb pyldb" + +FILES:${PN}-base = "${sbindir}/nmbd \ + ${sbindir}/smbd \ + ${sysconfdir}/init.d \ + ${systemd_system_unitdir}/nmb.service \ + ${systemd_system_unitdir}/smb.service" + +FILES:${PN}-ad-dc = "${sbindir}/samba \ + ${systemd_system_unitdir}/samba.service \ + ${libdir}/krb5/plugins/kdb/samba.so \ +" + +RDEPENDS:${PN}-ad-dc = "krb5-kdc" + +FILES:ctdb = "${bindir}/ctdb \ + ${bindir}/ctdb_diagnostics \ + ${bindir}/ltdbtool \ + ${bindir}/onnode \ + ${bindir}/ping_pong \ + ${sbindir}/ctdbd \ + ${datadir}/ctdb \ + ${libexecdir}/ctdb \ + ${localstatedir}/lib/ctdb \ + ${sysconfdir}/ctdb \ + ${sysconfdir}/sudoers.d/ctdb \ + ${systemd_system_unitdir}/ctdb.service \ +" + +FILES:ctdb-tests = "${bindir}/ctdb_run_tests \ + ${bindir}/ctdb_run_cluster_tests \ + ${datadir}/ctdb-tests \ + ${datadir}/ctdb/tests \ +" + +RDEPENDS:ctdb-tests += "bash util-linux-getopt ctdb" + +FILES:${BPN}-common = "${sysconfdir}/default \ + ${sysconfdir}/samba \ + ${sysconfdir}/tmpfiles.d \ + ${localstatedir}/lib/samba \ + ${localstatedir}/spool/samba \ +" + +FILES:${PN} += "${libdir}/vfs/*.so \ + ${libdir}/charset/*.so \ + ${libdir}/*.dat \ + ${libdir}/auth/*.so \ +" + +FILES:${PN}-dsdb-modules = "${libdir}/samba/ldb" + +FILES:${PN}-testsuite = "${bindir}/gentest \ + ${bindir}/locktest \ + ${bindir}/masktest \ + ${bindir}/ndrdump \ + ${bindir}/smbtorture" + +FILES:registry-tools = "${bindir}/regdiff \ + ${bindir}/regpatch \ + ${bindir}/regshell \ + ${bindir}/regtree" + +FILES:winbind = "${sbindir}/winbindd \ + ${bindir}/wbinfo \ + ${bindir}/ntlm_auth \ + ${libdir}/samba/idmap \ + ${libdir}/samba/nss_info \ + ${libdir}/winbind_krb5_locator.so \ + ${libdir}/winbind-krb5-localauth.so \ + ${sysconfdir}/init.d/winbind \ + ${systemd_system_unitdir}/winbind.service" + +FILES:${PN}-python3 = "${PYTHON_SITEPACKAGES_DIR}" + +FILES:smbclient = "${bindir}/cifsdd \ + ${bindir}/rpcclient \ + ${bindir}/smbcacls \ + ${bindir}/smbclient \ + ${bindir}/smbcquotas \ + ${bindir}/smbget \ + ${bindir}/smbspool \ + ${bindir}/smbtar \ + ${bindir}/smbtree \ + ${libdir}/samba/smbspool_krb5_wrapper" + +FILES:${PN}-pidl = "${bindir}/pidl \ + ${libdir}/perl5 \ + " +RDEPENDS:${PN}-pidl:append = " perl libparse-yapp-perl" + +RDEPENDS:${PN}-client = "\ + smbclient \ + winbind \ + registry-tools \ + ${PN}-pidl \ + " + +ALLOW_EMPTY:${PN}-client = "1" + +RDEPENDS:${PN}-server = "\ + ${PN} \ + winbind \ + registry-tools \ + " + +ALLOW_EMPTY:${PN}-server = "1" + +RDEPENDS:${PN}-test = "\ + ctdb-tests \ + ${PN}-testsuite \ + " + +ALLOW_EMPTY:${PN}-test = "1" diff --git a/meta-openembedded/meta-networking/recipes-connectivity/sshpass/sshpass_1.09.bb b/meta-openembedded/meta-networking/recipes-connectivity/sshpass/sshpass_1.09.bb index 5c52437af8..ad7b083100 100644 --- a/meta-openembedded/meta-networking/recipes-connectivity/sshpass/sshpass_1.09.bb +++ b/meta-openembedded/meta-networking/recipes-connectivity/sshpass/sshpass_1.09.bb @@ -1,7 +1,7 @@ DESCRIPTION = "Non-interactive ssh password auth" HOMEPAGE = "http://sshpass.sourceforge.net/" SECTION = "console/network" -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-or-later" LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.gz" diff --git a/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.3.bb b/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.3.bb deleted file mode 100644 index cef2b16620..0000000000 --- a/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.3.bb +++ /dev/null @@ -1,22 +0,0 @@ -SUMMARY = "wolfSSL Lightweight Embedded SSL/TLS Library" -DESCRIPTION = "wolfSSL, formerly CyaSSL, is a lightweight SSL library written \ - in C and optimized for embedded and RTOS environments. It can \ - be up to 20 times smaller than OpenSSL while still supporting \ - a full TLS client and server, up to TLS 1.3" -HOMEPAGE = "https://www.wolfssl.com/products/wolfssl" -BUGTRACKER = "https://github.com/wolfssl/wolfssl/issues" -SECTION = "libs" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -PROVIDES += "cyassl" -RPROVIDES:${PN} = "cyassl" - -SRC_URI = "git://github.com/wolfSSL/wolfssl.git;protocol=https;branch=master" -SRCREV = "a7635da9e64a43028d2f8f14bce75e4bed39f162" - -S = "${WORKDIR}/git" - -inherit autotools - -BBCLASSEXTEND += "native nativesdk" diff --git a/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.4.bb b/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.4.bb new file mode 100644 index 0000000000..9ac859f306 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-connectivity/wolfssl/wolfssl_5.5.4.bb @@ -0,0 +1,22 @@ +SUMMARY = "wolfSSL Lightweight Embedded SSL/TLS Library" +DESCRIPTION = "wolfSSL, formerly CyaSSL, is a lightweight SSL library written \ + in C and optimized for embedded and RTOS environments. It can \ + be up to 20 times smaller than OpenSSL while still supporting \ + a full TLS client and server, up to TLS 1.3" +HOMEPAGE = "https://www.wolfssl.com/products/wolfssl" +BUGTRACKER = "https://github.com/wolfssl/wolfssl/issues" +SECTION = "libs" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +PROVIDES += "cyassl" +RPROVIDES:${PN} = "cyassl" + +SRC_URI = "git://github.com/wolfSSL/wolfssl.git;protocol=https;branch=master" +SRCREV = "4fbd4fd36a21efd9d1a7e17aba390e91c78693b1" + +S = "${WORKDIR}/git" + +inherit autotools + +BBCLASSEXTEND += "native nativesdk" diff --git a/meta-openembedded/meta-networking/recipes-daemons/lldpd/files/run-ptest b/meta-openembedded/meta-networking/recipes-daemons/lldpd/files/run-ptest new file mode 100755 index 0000000000..da686eb465 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-daemons/lldpd/files/run-ptest @@ -0,0 +1,16 @@ +#!/bin/sh + +num_fail=0 + +for test in tests/check* +do + ./"$test" \ + && echo "PASS: $test" \ + || { + echo "FAIL: $test" + num_fail=$(( ${num_fail} + 1)) + } + +done + +exit $num_fail diff --git a/meta-openembedded/meta-networking/recipes-daemons/lldpd/lldpd_1.0.15.bb b/meta-openembedded/meta-networking/recipes-daemons/lldpd/lldpd_1.0.15.bb deleted file mode 100644 index 6a3687cf72..0000000000 --- a/meta-openembedded/meta-networking/recipes-daemons/lldpd/lldpd_1.0.15.bb +++ /dev/null @@ -1,63 +0,0 @@ -SUMMARY = "A 802.1ab implementation (LLDP) to help you locate neighbors of all your equipments" -SECTION = "net/misc" -LICENSE = "ISC" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d" - -DEPENDS = "libbsd libevent" - -SRC_URI = "\ - http://media.luffy.cx/files/${BPN}/${BPN}-${PV}.tar.gz \ - file://lldpd.init.d \ - file://lldpd.default \ - " - -SRC_URI[sha256sum] = "f7fe3a130be98a19c491479ef60f36b8ee41a9e6bc4d7f2c41033f63956a3126" - -inherit autotools update-rc.d useradd systemd pkgconfig bash-completion github-releases - -USERADD_PACKAGES = "${PN}" -USERADD_PARAM:${PN} = "--system -g lldpd --shell /bin/false lldpd" -GROUPADD_PARAM:${PN} = "--system lldpd" - -EXTRA_OECONF += "--without-embedded-libevent \ - --disable-oldies \ - --with-privsep-user=lldpd \ - --with-privsep-group=lldpd \ - --with-systemdsystemunitdir=${systemd_system_unitdir} \ - --without-sysusersdir \ -" - -PACKAGECONFIG ??= "cdp fdp edp sonmp lldpmed dot1 dot3" -PACKAGECONFIG[xml] = "--with-xml,--without-xml,libxm2" -PACKAGECONFIG[snmp] = "--with-snmp,--without-snmp,net-snmp" -PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" -PACKAGECONFIG[seccomp] = "--with-seccomp,--without-seccomp,libseccomp" -PACKAGECONFIG[cdp] = "--enable-cdp,--disable-cdp" -PACKAGECONFIG[fdp] = "--enable-fdp,--disable-fdp" -PACKAGECONFIG[edp] = "--enable-edp,--disable-edp" -PACKAGECONFIG[sonmp] = "--enable-sonmp,--disable-sonmp" -PACKAGECONFIG[lldpmed] = "--enable-lldpmed,--disable-lldpmed" -PACKAGECONFIG[dot1] = "--enable-dot1,--disable-dot1" -PACKAGECONFIG[dot3] = "--enable-dot3,--disable-dot3" -PACKAGECONFIG[custom] = "--enable-custom,--disable-custom" - -INITSCRIPT_NAME = "lldpd" -INITSCRIPT_PARAMS = "defaults" - -SYSTEMD_SERVICE:${PN} = "lldpd.service" - -do_install:append() { - install -Dm 0755 ${WORKDIR}/lldpd.init.d ${D}${sysconfdir}/init.d/lldpd - install -Dm 0644 ${WORKDIR}/lldpd.default ${D}${sysconfdir}/default/lldpd - # Make an empty configuration file - touch ${D}${sysconfdir}/lldpd.conf -} - -PACKAGES =+ "${PN}-zsh-completion" - -FILES:${PN} += "${libdir}/sysusers.d" -RDEPENDS:${PN} += "os-release" - -FILES:${PN}-zsh-completion += "${datadir}/zsh/" -# FIXME: zsh is broken in meta-oe so this cannot be enabled for now -#RDEPENDS:${PN}-zsh-completion += "zsh" diff --git a/meta-openembedded/meta-networking/recipes-daemons/lldpd/lldpd_1.0.16.bb b/meta-openembedded/meta-networking/recipes-daemons/lldpd/lldpd_1.0.16.bb new file mode 100644 index 0000000000..7992705108 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-daemons/lldpd/lldpd_1.0.16.bb @@ -0,0 +1,81 @@ +SUMMARY = "A 802.1ab implementation (LLDP) to help you locate neighbors of all your equipments" +SECTION = "net/misc" +LICENSE = "ISC" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d" + +DEPENDS = "libbsd libevent" + +SRC_URI = "\ + http://media.luffy.cx/files/${BPN}/${BP}.tar.gz \ + file://lldpd.init.d \ + file://lldpd.default \ + file://run-ptest \ + " + +SRC_URI[sha256sum] = "e3b391650c7ba67cea2fe84d67fdb4d7fc8aa1ec5cf86eb8bb984711df8465a9" + +inherit autotools update-rc.d useradd systemd pkgconfig bash-completion github-releases ptest + +USERADD_PACKAGES = "${PN}" +USERADD_PARAM:${PN} = "--system -g lldpd --shell /bin/false lldpd" +GROUPADD_PARAM:${PN} = "--system lldpd" + +EXTRA_OECONF += "--without-embedded-libevent \ + --disable-oldies \ + --with-privsep-user=lldpd \ + --with-privsep-group=lldpd \ + --with-systemdsystemunitdir=${systemd_system_unitdir} \ + --without-sysusersdir \ +" + +PACKAGECONFIG ??= "cdp fdp edp sonmp lldpmed dot1 dot3" +PACKAGECONFIG[xml] = "--with-xml,--without-xml,libxm2" +PACKAGECONFIG[snmp] = "--with-snmp,--without-snmp,net-snmp" +PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" +PACKAGECONFIG[seccomp] = "--with-seccomp,--without-seccomp,libseccomp" +PACKAGECONFIG[cdp] = "--enable-cdp,--disable-cdp" +PACKAGECONFIG[fdp] = "--enable-fdp,--disable-fdp" +PACKAGECONFIG[edp] = "--enable-edp,--disable-edp" +PACKAGECONFIG[sonmp] = "--enable-sonmp,--disable-sonmp" +PACKAGECONFIG[lldpmed] = "--enable-lldpmed,--disable-lldpmed" +PACKAGECONFIG[dot1] = "--enable-dot1,--disable-dot1" +PACKAGECONFIG[dot3] = "--enable-dot3,--disable-dot3" +PACKAGECONFIG[custom] = "--enable-custom,--disable-custom" + +INITSCRIPT_NAME = "lldpd" +INITSCRIPT_PARAMS = "defaults" + +SYSTEMD_SERVICE:${PN} = "lldpd.service" + +do_install:append() { + install -Dm 0755 ${WORKDIR}/lldpd.init.d ${D}${sysconfdir}/init.d/lldpd + install -Dm 0644 ${WORKDIR}/lldpd.default ${D}${sysconfdir}/default/lldpd + # Make an empty configuration file + touch ${D}${sysconfdir}/lldpd.conf +} + +PACKAGES =+ "${PN}-zsh-completion" + +FILES:${PN} += "${libdir}/sysusers.d" +RDEPENDS:${PN} += "os-release" + +FILES:${PN}-zsh-completion += "${datadir}/zsh/" +# FIXME: zsh is broken in meta-oe so this cannot be enabled for now +#RDEPENDS:${PN}-zsh-completion += "zsh" + +RDEPENDS:${PN}-ptest = "libcheck" +DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'libcheck', '', d)}" + +TESTDIR = "tests" +do_compile_ptest () { + # hack to remove the call to `make check-TESTS` + sed -i 's/$(MAKE) $(AM_MAKEFLAGS) check-TESTS//g' ${TESTDIR}/Makefile + oe_runmake check +} + +do_install_ptest () { + # install the tests + cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH} + # remove the object files + rm ${D}${PTEST_PATH}/${TESTDIR}/*.o +} diff --git a/meta-openembedded/meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch b/meta-openembedded/meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch index 0e113f533f..7e88c498ee 100644 --- a/meta-openembedded/meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch +++ b/meta-openembedded/meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch @@ -15,15 +15,13 @@ Signed-off-by: Khem Raj src/base/os_defs.c | 4 ++++ 1 file changed, 4 insertions(+) -diff --git a/src/base/os_defs.c b/src/base/os_defs.c -index 83458c2..655c190 100644 --- a/src/base/os_defs.c +++ b/src/base/os_defs.c -@@ -917,7 +917,11 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_SHM_REQ_INFO *req) +@@ -917,7 +917,11 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S ((statsvfs.f_bfree - 1) * statsvfs.f_frsize)) { syslog( LOG_ERR, -+#if __TIMESIZE == 64 && __WORDSIZE == 32 ++#if (_FILE_OFFSET_BITS == 64 || __TIMESIZE == 64) && __WORDSIZE == 32 + "Insufficient shared memory (%lld) to write the data of size: %" PRId64 +#else "Insufficient shared memory (%ld) to write the data of size: %" PRId64 @@ -31,6 +29,3 @@ index 83458c2..655c190 100644 "\n", (statsvfs.f_bfree * statsvfs.f_frsize), req->info.write.i_write_size); --- -2.29.2 - diff --git a/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix.inc b/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix.inc index 8a4428c504..5133caaa46 100644 --- a/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix.inc +++ b/meta-openembedded/meta-networking/recipes-daemons/postfix/postfix.inc @@ -115,7 +115,7 @@ do_install () { 'data_directory=${localstatedir}/lib/postfix' \ -non-interactive rm -rf ${D}${localstatedir}/spool/postfix - mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/sample-main.cf + mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/${MLPREFIX}sample-main.cf install -m 755 ${S}/bin/smtp-sink ${D}/${sbindir}/ install -d ${D}${sysconfdir}/init.d install -m 644 ${WORKDIR}/main.cf ${D}${sysconfdir}/postfix/main.cf diff --git a/meta-openembedded/meta-networking/recipes-daemons/vsftpd/vsftpd_3.0.5.bb b/meta-openembedded/meta-networking/recipes-daemons/vsftpd/vsftpd_3.0.5.bb index cce3e66adc..0ae52c8ddc 100644 --- a/meta-openembedded/meta-networking/recipes-daemons/vsftpd/vsftpd_3.0.5.bb +++ b/meta-openembedded/meta-networking/recipes-daemons/vsftpd/vsftpd_3.0.5.bb @@ -45,7 +45,7 @@ inherit update-rc.d useradd systemd CONFFILES:${PN} = "${sysconfdir}/vsftpd.conf" LDFLAGS:append =" -lcrypt -lcap" -CFLAGS:append:libc-musl = " -D_GNU_SOURCE -include fcntl.h" +CFLAGS:append:libc-musl = " -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -include fcntl.h" EXTRA_OEMAKE = "-e MAKEFLAGS=" do_configure() { diff --git a/meta-openembedded/meta-networking/recipes-filter/libnftnl/libnftnl_1.2.3.bb b/meta-openembedded/meta-networking/recipes-filter/libnftnl/libnftnl_1.2.3.bb deleted file mode 100644 index ab55767fee..0000000000 --- a/meta-openembedded/meta-networking/recipes-filter/libnftnl/libnftnl_1.2.3.bb +++ /dev/null @@ -1,39 +0,0 @@ -SUMMARY = "Library for low-level interaction with nftables Netlink's API over libmnl" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=79808397c3355f163c012616125c9e26" -SECTION = "libs" - -SRC_URI = "git://git.netfilter.org/libnftnl;branch=master \ - file://0001-configure.ac-Add-serial-tests.patch \ - file://run-ptest \ - " -SRCREV = "817c8b66f1ea8c223b7513d4cd7bff525d8a0a9f" - -S = "${WORKDIR}/git" - -inherit autotools pkgconfig ptest - -DEPENDS = "libmnl" -RDEPENDS:${PN}-ptest += " bash python3-core make" - -TESTDIR = "tests" - -do_compile_ptest() { - cp -rf ${S}/build-aux . - oe_runmake buildtest-TESTS -} - -do_install_ptest() { - cp -rf ${B}/build-aux ${D}${PTEST_PATH} - install -d ${D}${PTEST_PATH}/${TESTDIR} - cp -rf ${B}/${TESTDIR}/Makefile ${D}${PTEST_PATH}/${TESTDIR} - - # the binaries compiled in ${TESTDIR} will look for a compiler to - # use, which will cause failures. Substitute the binaries in - # ${TESTDIR}/.libs instead - cp -rf ${B}/${TESTDIR}/.libs/* ${D}${PTEST_PATH}/${TESTDIR} - - # Alter the Makefile so that it does not try and rebuild anything in - # other nonexistent paths before running the actual tests - sed -i 's/^Makefile/_Makefile/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile -} diff --git a/meta-openembedded/meta-networking/recipes-filter/libnftnl/libnftnl_1.2.4.bb b/meta-openembedded/meta-networking/recipes-filter/libnftnl/libnftnl_1.2.4.bb new file mode 100644 index 0000000000..ede35e7624 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-filter/libnftnl/libnftnl_1.2.4.bb @@ -0,0 +1,39 @@ +SUMMARY = "Library for low-level interaction with nftables Netlink's API over libmnl" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=79808397c3355f163c012616125c9e26" +SECTION = "libs" + +SRC_URI = "git://git.netfilter.org/libnftnl;branch=master \ + file://0001-configure.ac-Add-serial-tests.patch \ + file://run-ptest \ + " +SRCREV = "141cc997755dd91e94dd64c5497f2a23bd9a894c" + +S = "${WORKDIR}/git" + +inherit autotools pkgconfig ptest + +DEPENDS = "libmnl" +RDEPENDS:${PN}-ptest += " bash python3-core make" + +TESTDIR = "tests" + +do_compile_ptest() { + cp -rf ${S}/build-aux . + oe_runmake buildtest-TESTS +} + +do_install_ptest() { + cp -rf ${B}/build-aux ${D}${PTEST_PATH} + install -d ${D}${PTEST_PATH}/${TESTDIR} + cp -rf ${B}/${TESTDIR}/Makefile ${D}${PTEST_PATH}/${TESTDIR} + + # the binaries compiled in ${TESTDIR} will look for a compiler to + # use, which will cause failures. Substitute the binaries in + # ${TESTDIR}/.libs instead + cp -rf ${B}/${TESTDIR}/.libs/* ${D}${PTEST_PATH}/${TESTDIR} + + # Alter the Makefile so that it does not try and rebuild anything in + # other nonexistent paths before running the actual tests + sed -i 's/^Makefile/_Makefile/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile +} diff --git a/meta-openembedded/meta-networking/recipes-filter/nftables/nftables/0001-nftables-python-Split-root-from-prefix.patch b/meta-openembedded/meta-networking/recipes-filter/nftables/nftables/0001-nftables-python-Split-root-from-prefix.patch deleted file mode 100644 index 377b29fff8..0000000000 --- a/meta-openembedded/meta-networking/recipes-filter/nftables/nftables/0001-nftables-python-Split-root-from-prefix.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c7513195a72b2e5be5c9c439cc606eb5dcc3fb7a Mon Sep 17 00:00:00 2001 -From: Alex Kiernan -Date: Tue, 12 Jul 2022 17:44:34 +0100 -Subject: [PATCH] nftables: python: Split root from prefix - -The buildpaths QA check fails when python is enabled: - - WARNING: nftables-1.0.4-r0 do_package_qa: QA Issue: File /usr/lib/python3.10/site-packages/nftables/__pycache__/nftables.cpython-310.pyc in package nftables-python contains reference to TMPDIR - File /usr/lib/python3.10/site-packages/nftables/__pycache__/__init__.cpython-310.pyc in package nftables-python contains reference to TMPDIR [buildpaths] - -Upstream-Status: Pending -Signed-off-by: Alex Kiernan ---- - py/Makefile.am | 2 +- - py/setup.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/py/Makefile.am b/py/Makefile.am -index 215ecd9e4751..a827cca10135 100644 ---- a/py/Makefile.am -+++ b/py/Makefile.am -@@ -7,7 +7,7 @@ all-local: - install-exec-local: - cd $(srcdir) && \ - $(PYTHON_BIN) setup.py build --build-base $(abs_builddir) \ -- install --prefix $(DESTDIR)$(prefix) -+ install --root $(DESTDIR) --prefix $(prefix) - - uninstall-local: - rm -rf $(DESTDIR)$(prefix)/lib*/python*/site-packages/nftables -diff --git a/py/setup.py b/py/setup.py -index 72fc8fd98b26..976aec583b71 100755 ---- a/py/setup.py -+++ b/py/setup.py -@@ -1,5 +1,5 @@ - #!/usr/bin/env python --from distutils.core import setup -+from setuptools._distutils.core import setup - from nftables import NFTABLES_VERSION - - setup(name='nftables', --- -2.35.1 - diff --git a/meta-openembedded/meta-networking/recipes-filter/nftables/nftables_1.0.5.bb b/meta-openembedded/meta-networking/recipes-filter/nftables/nftables_1.0.5.bb deleted file mode 100644 index c5a2968d18..0000000000 --- a/meta-openembedded/meta-networking/recipes-filter/nftables/nftables_1.0.5.bb +++ /dev/null @@ -1,55 +0,0 @@ -SUMMARY = "Netfilter Tables userspace utillites" -SECTION = "net" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=d1a78fdd879a263a5e0b42d1fc565e79" - -DEPENDS = "libmnl libnftnl bison-native \ - ${@bb.utils.contains('PACKAGECONFIG', 'mini-gmp', '', 'gmp', d)}" - -SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.bz2 \ - file://0001-nftables-python-Split-root-from-prefix.patch \ - file://run-ptest \ - " - -SRC_URI[sha256sum] = "8d1b4b18393af43698d10baa25d2b9b6397969beecac7816c35dd0714e4de50a" - -inherit autotools manpages pkgconfig ptest - -PACKAGECONFIG ?= "python readline json" -PACKAGECONFIG[editline] = "--with-cli=editline, , libedit, , , linenoise readline" -PACKAGECONFIG[json] = "--with-json, --without-json, jansson" -PACKAGECONFIG[linenoise] = "--with-cli=linenoise, , linenoise, , , editline readline" -PACKAGECONFIG[manpages] = "--enable-man-doc, --disable-man-doc, asciidoc-native" -PACKAGECONFIG[mini-gmp] = "--with-mini-gmp, --without-mini-gmp" -PACKAGECONFIG[python] = "--enable-python --with-python-bin=${PYTHON}, --disable-python, python3-setuptools-native" -PACKAGECONFIG[readline] = "--with-cli=readline, , readline, , , editline linenoise" -PACKAGECONFIG[xtables] = "--with-xtables, --without-xtables, iptables" - -EXTRA_OECONF = "${@bb.utils.contains_any('PACKAGECONFIG', 'editline linenoise readline', '', '--without-cli', d)}" - -inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3native', '', d)} - -RRECOMMENDS:${PN} += "kernel-module-nf-tables" - -PACKAGES =+ "${PN}-python" -FILES:${PN}-python = "${nonarch_libdir}/${PYTHON_DIR}" -RDEPENDS:${PN}-python = "python3-core python3-json ${PN}" - -RDEPENDS:${PN}-ptest += " ${PN}-python bash make iproute2 iputils-ping procps python3-core python3-ctypes python3-json python3-misc sed util-linux" - -TESTDIR = "tests" - -PRIVATE_LIBS:${PN}-ptest:append = "libnftables.so.1" - -do_install_ptest() { - cp -rf ${S}/build-aux ${D}${PTEST_PATH} - cp -rf ${S}/src ${D}${PTEST_PATH} - mkdir -p ${D}${PTEST_PATH}/src/.libs - cp -rf ${B}/src/.libs/* ${D}${PTEST_PATH}/src/.libs - cp -rf ${B}/src/.libs/nft ${D}${PTEST_PATH}/src/ - cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}/${TESTDIR} - sed -i 's#/usr/bin/python#/usr/bin/python3#' ${D}${PTEST_PATH}/${TESTDIR}/json_echo/run-test.py - sed -i 's#/usr/bin/env python#/usr/bin/env python3#' ${D}${PTEST_PATH}/${TESTDIR}/py/nft-test.py - # handle multilib - sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest -} diff --git a/meta-openembedded/meta-networking/recipes-filter/nftables/nftables_1.0.6.bb b/meta-openembedded/meta-networking/recipes-filter/nftables/nftables_1.0.6.bb new file mode 100644 index 0000000000..fb9c6e7d62 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-filter/nftables/nftables_1.0.6.bb @@ -0,0 +1,58 @@ +SUMMARY = "Netfilter Tables userspace utillites" +SECTION = "net" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=d1a78fdd879a263a5e0b42d1fc565e79" + +DEPENDS = "libmnl libnftnl bison-native \ + ${@bb.utils.contains('PACKAGECONFIG', 'mini-gmp', '', 'gmp', d)}" + +SRC_URI = "http://www.netfilter.org/projects/nftables/files/${BP}.tar.xz \ + file://run-ptest \ + " +SRC_URI[sha256sum] = "2407430ddd82987670e48dc2fda9e280baa8307abec04ab18d609df3db005e4c" + +inherit autotools manpages pkgconfig ptest + +PACKAGECONFIG ?= "python readline json" +PACKAGECONFIG[editline] = "--with-cli=editline, , libedit, , , linenoise readline" +PACKAGECONFIG[json] = "--with-json, --without-json, jansson" +PACKAGECONFIG[linenoise] = "--with-cli=linenoise, , linenoise, , , editline readline" +PACKAGECONFIG[manpages] = "--enable-man-doc, --disable-man-doc, asciidoc-native" +PACKAGECONFIG[mini-gmp] = "--with-mini-gmp, --without-mini-gmp" +PACKAGECONFIG[python] = "--enable-python --with-python-bin=${PYTHON}, --disable-python, python3-setuptools-native" +PACKAGECONFIG[readline] = "--with-cli=readline, , readline, , , editline linenoise" +PACKAGECONFIG[xtables] = "--with-xtables, --without-xtables, iptables" + +EXTRA_OECONF = "${@bb.utils.contains_any('PACKAGECONFIG', 'editline linenoise readline', '', '--without-cli', d)}" + +inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3native', '', d)} + +RRECOMMENDS:${PN} += "kernel-module-nf-tables" + +PACKAGES =+ "${PN}-python" +FILES:${PN}-python = "${nonarch_libdir}/${PYTHON_DIR}" +RDEPENDS:${PN}-python = "python3-core python3-json ${PN}" + +RDEPENDS:${PN}-ptest += " ${PN}-python bash make iproute2 iputils-ping procps python3-core python3-ctypes python3-json python3-misc sed util-linux" + +TESTDIR = "tests" + +PRIVATE_LIBS:${PN}-ptest:append = "libnftables.so.1" + +do_install:append() { + # Avoid "contains reference to TMPDIR" warning + find ${D} -name *.pyc -delete +} + +do_install_ptest() { + cp -rf ${S}/build-aux ${D}${PTEST_PATH} + cp -rf ${S}/src ${D}${PTEST_PATH} + mkdir -p ${D}${PTEST_PATH}/src/.libs + cp -rf ${B}/src/.libs/* ${D}${PTEST_PATH}/src/.libs + cp -rf ${B}/src/.libs/nft ${D}${PTEST_PATH}/src/ + cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}/${TESTDIR} + sed -i 's#/usr/bin/python#/usr/bin/python3#' ${D}${PTEST_PATH}/${TESTDIR}/json_echo/run-test.py + sed -i 's#/usr/bin/env python#/usr/bin/env python3#' ${D}${PTEST_PATH}/${TESTDIR}/py/nft-test.py + # handle multilib + sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest +} diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch b/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch deleted file mode 100644 index 52b39c1e86..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 066770ac1c69ee5b484bb82581b22ad0423b004d Mon Sep 17 00:00:00 2001 -From: Donald Sharp -Date: Thu, 21 Jul 2022 08:11:58 -0400 -Subject: [PATCH] bgpd: Make sure hdr length is at a minimum of what is - expected - -Ensure that if the capability length specified is enough data. - -Signed-off-by: Donald Sharp -(cherry picked from commit ff6db1027f8f36df657ff2e5ea167773752537ed) - -CVE: CVE-2022-37032 - -Upstream-Status: Backport -[https://github.com/FRRouting/frr/commit/066770ac1c69ee5b484bb82581b22ad0423b004d] - -Signed-off-by: Yi Zhao ---- - bgpd/bgp_packet.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c -index 7613ccc7d..a5f065a15 100644 ---- a/bgpd/bgp_packet.c -+++ b/bgpd/bgp_packet.c -@@ -2621,6 +2621,14 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt, - "%s CAPABILITY has action: %d, code: %u, length %u", - peer->host, action, hdr->code, hdr->length); - -+ if (hdr->length < sizeof(struct capability_mp_data)) { -+ zlog_info( -+ "%pBP Capability structure is not properly filled out, expected at least %zu bytes but header length specified is %d", -+ peer, sizeof(struct capability_mp_data), -+ hdr->length); -+ return BGP_Stop; -+ } -+ - /* Capability length check. */ - if ((pnt + hdr->length + 3) > end) { - zlog_info("%s Capability length error", peer->host); --- -2.25.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch b/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch deleted file mode 100644 index 40284d6f4f..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 71ca5b09bc71e8cbe38177cf41e83fe164e52eee Mon Sep 17 00:00:00 2001 -From: Mark Stapp -Date: Thu, 8 Sep 2022 16:14:36 -0400 -Subject: [PATCH] bgpd: avoid notify race between io and main pthreads - -The "bgp_notify_" apis in bgp_packet.c generate a notification -to a peer, usually during error handling. The io pthread wants -to send notifications in a couple of cases during early -received-packet validation - but the existing api interacts -with the peer struct itself, and that's not safe. - -Add a new api for use by the io pthread, and adjust the main -notify api so that it can avoid touching the peer struct. - -Signed-off-by: Mark Stapp - -CVE: CVE-2022-37035 - -Upstream-Status: Backport -[https://github.com/FRRouting/frr/commit/71ca5b09bc71e8cbe38177cf41e83fe164e52eee] - -Signed-off-by: Yi Zhao ---- - bgpd/bgp_io.c | 17 ++++++++--------- - bgpd/bgp_packet.c | 32 ++++++++++++++++++++++++++++---- - bgpd/bgp_packet.h | 2 ++ - 3 files changed, 38 insertions(+), 13 deletions(-) - -diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c -index 7af1fae28..f9bb8d518 100644 ---- a/bgpd/bgp_io.c -+++ b/bgpd/bgp_io.c -@@ -37,7 +37,7 @@ - #include "bgpd/bgp_debug.h" // for bgp_debug_neighbor_events, bgp_type_str - #include "bgpd/bgp_errors.h" // for expanded error reference information - #include "bgpd/bgp_fsm.h" // for BGP_EVENT_ADD, bgp_event --#include "bgpd/bgp_packet.h" // for bgp_notify_send_with_data, bgp_notify... -+#include "bgpd/bgp_packet.h" // for bgp_notify_io_invalid... - #include "bgpd/bgp_trace.h" // for frrtraces - #include "bgpd/bgpd.h" // for peer, BGP_MARKER_SIZE, bgp_master, bm - /* clang-format on */ -@@ -526,8 +526,8 @@ static bool validate_header(struct peer *peer) - return false; - - if (memcmp(m_correct, m_rx, BGP_MARKER_SIZE) != 0) { -- bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR, -- BGP_NOTIFY_HEADER_NOT_SYNC); -+ bgp_notify_io_invalid(peer, BGP_NOTIFY_HEADER_ERR, -+ BGP_NOTIFY_HEADER_NOT_SYNC, NULL, 0); - return false; - } - -@@ -547,9 +547,8 @@ static bool validate_header(struct peer *peer) - zlog_debug("%s unknown message type 0x%02x", peer->host, - type); - -- bgp_notify_send_with_data(peer, BGP_NOTIFY_HEADER_ERR, -- BGP_NOTIFY_HEADER_BAD_MESTYPE, &type, -- 1); -+ bgp_notify_io_invalid(peer, BGP_NOTIFY_HEADER_ERR, -+ BGP_NOTIFY_HEADER_BAD_MESTYPE, &type, 1); - return false; - } - -@@ -574,9 +573,9 @@ static bool validate_header(struct peer *peer) - - uint16_t nsize = htons(size); - -- bgp_notify_send_with_data(peer, BGP_NOTIFY_HEADER_ERR, -- BGP_NOTIFY_HEADER_BAD_MESLEN, -- (unsigned char *)&nsize, 2); -+ bgp_notify_io_invalid(peer, BGP_NOTIFY_HEADER_ERR, -+ BGP_NOTIFY_HEADER_BAD_MESLEN, -+ (unsigned char *)&nsize, 2); - return false; - } - -diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c -index 7daac4494..90695219a 100644 ---- a/bgpd/bgp_packet.c -+++ b/bgpd/bgp_packet.c -@@ -871,8 +871,9 @@ bool bgp_notify_received_hard_reset(struct peer *peer, uint8_t code, - * @param data Data portion - * @param datalen length of data portion - */ --void bgp_notify_send_with_data(struct peer *peer, uint8_t code, -- uint8_t sub_code, uint8_t *data, size_t datalen) -+static void bgp_notify_send_internal(struct peer *peer, uint8_t code, -+ uint8_t sub_code, uint8_t *data, -+ size_t datalen, bool use_curr) - { - struct stream *s; - bool hard_reset = bgp_notify_send_hard_reset(peer, code, sub_code); -@@ -917,8 +918,11 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code, - * If possible, store last packet for debugging purposes. This check is - * in place because we are sometimes called with a doppelganger peer, - * who tends to have a plethora of fields nulled out. -+ * -+ * Some callers should not attempt this - the io pthread for example -+ * should not touch internals of the peer struct. - */ -- if (peer->curr) { -+ if (use_curr && peer->curr) { - size_t packetsize = stream_get_endp(peer->curr); - assert(packetsize <= peer->max_packet_size); - memcpy(peer->last_reset_cause, peer->curr->data, packetsize); -@@ -1001,7 +1005,27 @@ void bgp_notify_send_with_data(struct peer *peer, uint8_t code, - */ - void bgp_notify_send(struct peer *peer, uint8_t code, uint8_t sub_code) - { -- bgp_notify_send_with_data(peer, code, sub_code, NULL, 0); -+ bgp_notify_send_internal(peer, code, sub_code, NULL, 0, true); -+} -+ -+/* -+ * Enqueue notification; called from the main pthread, peer object access is ok. -+ */ -+void bgp_notify_send_with_data(struct peer *peer, uint8_t code, -+ uint8_t sub_code, uint8_t *data, size_t datalen) -+{ -+ bgp_notify_send_internal(peer, code, sub_code, data, datalen, true); -+} -+ -+/* -+ * For use by the io pthread, queueing a notification but avoiding access to -+ * the peer object. -+ */ -+void bgp_notify_io_invalid(struct peer *peer, uint8_t code, uint8_t sub_code, -+ uint8_t *data, size_t datalen) -+{ -+ /* Avoid touching the peer object */ -+ bgp_notify_send_internal(peer, code, sub_code, data, datalen, false); - } - - /* -diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h -index a0eb579db..9f6d772bc 100644 ---- a/bgpd/bgp_packet.h -+++ b/bgpd/bgp_packet.h -@@ -62,6 +62,8 @@ extern void bgp_open_send(struct peer *); - extern void bgp_notify_send(struct peer *, uint8_t, uint8_t); - extern void bgp_notify_send_with_data(struct peer *, uint8_t, uint8_t, - uint8_t *, size_t); -+void bgp_notify_io_invalid(struct peer *peer, uint8_t code, uint8_t sub_code, -+ uint8_t *data, size_t datalen); - extern void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi, - uint8_t orf_type, uint8_t when_to_refresh, - int remove, uint8_t subtype); --- -2.25.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch b/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch deleted file mode 100644 index 20e8472233..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-configure-Check-for-readline-function-instead-of-mai.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 9399d58c13257849179d3c2b3698a2b43bc1b2a0 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 1 Sep 2022 10:39:23 -0700 -Subject: [PATCH] configure: Check for readline() function instead of main - -main is not a function found in libreadline, its better to check for a -function thats provided by it. - -Upstream-Status: Backport -[https://github.com/FRRouting/frr/commit/9399d58c13257849179d3c2b3698a2b43bc1b2a0] - -Signed-off-by: Khem Raj ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index b7e17d356..8c1fab0ea 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1372,7 +1372,7 @@ case "${enable_vtysh}" in - AC_DEFINE([VTYSH], [1], [VTY shell]) - - prev_libs="$LIBS" -- AC_CHECK_LIB([readline], [main], [ -+ AC_CHECK_LIB([readline], [readline], [ - LIBREADLINE="-lreadline" - ], [ - dnl readline failed - it might be incorrectly linked and missing its --- -2.37.3 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-m4-ax_python.m4-check-for-python-x.y-emded.pc-not-py.patch b/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-m4-ax_python.m4-check-for-python-x.y-emded.pc-not-py.patch new file mode 100644 index 0000000000..872a67c784 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-m4-ax_python.m4-check-for-python-x.y-emded.pc-not-py.patch @@ -0,0 +1,33 @@ +From a82d704b1ec6ece47b01d12e0e067d4b62b10894 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Wed, 9 Nov 2022 20:24:45 +0100 +Subject: [PATCH] m4/ax_python.m4: check for python-x.y-emded.pc, not + python-x.y.pc + +Only the embed version includes necessary linker flags to link +with libpython. + +Upstream-Status: Backport +[https://github.com/FRRouting/frr/commit/a82d704b1ec6ece47b01d12e0e067d4b62b10894] + +Signed-off-by: Alexander Kanavin +--- + m4/ax_python.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/m4/ax_python.m4 b/m4/ax_python.m4 +index 91d12b99b..f5e603b96 100644 +--- a/m4/ax_python.m4 ++++ b/m4/ax_python.m4 +@@ -206,7 +206,7 @@ AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl + AC_MSG_CHECKING([whether pkg-config python-${tryver} is available]) + unset PYTHON_CFLAGS + unset PYTHON_LIBS +- pkg="python-${tryver}" ++ pkg="python-${tryver}-embed" + pkg="${pkg%-}" + _PKG_CONFIG([PYTHON_CFLAGS], [cflags], [${pkg}]) + _PKG_CONFIG([PYTHON_LIBS], [libs], [${pkg}]) +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch b/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch deleted file mode 100644 index 09988946b6..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/frr/frr/0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch +++ /dev/null @@ -1,48 +0,0 @@ -From ec3bb054c331f9d928ac21a1747e0f921b51dfbc Mon Sep 17 00:00:00 2001 -From: Michal Ruprich -Date: Tue, 6 Sep 2022 12:25:01 +0200 -Subject: [PATCH] ospfd: Adding SUPPORT_OSPF_API define in ospf_spf.c - -It is not possible to build ospf_spf.c file with --disable-ospfapi because -ospf_apiserver.c has SUPPORT_OSPF_API around all function definitions and -that results in an undefined reference to the ospf_apiserver_notify_reachable -function error while building. - -Signed-off-by: Michal Ruprich - -Upstream-Status: Backport -[https://github.com/FRRouting/frr/commit/ec3bb054c331f9d928ac21a1747e0f921b51dfbc] - -Signed-off-by: Yi Zhao ---- - ospfd/ospf_spf.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c -index 46492ff6b..4edc1de81 100644 ---- a/ospfd/ospf_spf.c -+++ b/ospfd/ospf_spf.c -@@ -48,7 +48,10 @@ - #include "ospfd/ospf_sr.h" - #include "ospfd/ospf_ti_lfa.h" - #include "ospfd/ospf_errors.h" -+ -+#ifdef SUPPORT_OSPF_API - #include "ospfd/ospf_apiserver.h" -+#endif - - /* Variables to ensure a SPF scheduled log message is printed only once */ - -@@ -1895,7 +1898,9 @@ static void ospf_spf_calculate_schedule_worker(struct thread *thread) - /* Update all routers routing table */ - ospf->oall_rtrs = ospf->all_rtrs; - ospf->all_rtrs = all_rtrs; -+#ifdef SUPPORT_OSPF_API - ospf_apiserver_notify_reachable(ospf->oall_rtrs, ospf->all_rtrs); -+#endif - - /* Free old ABR/ASBR routing table */ - if (ospf->old_rtrs) --- -2.25.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.3.1.bb b/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.3.1.bb deleted file mode 100644 index 1abea6345a..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.3.1.bb +++ /dev/null @@ -1,132 +0,0 @@ -SUMMARY = "BGP/OSPF/RIP routing daemon" -DESCRIPTION = "FRRouting is a free and open source Internet routing protocol suite for Linux \ -and Unix platforms. It implements BGP, OSPF, RIP, IS-IS, PIM, LDP, BFD, Babel, PBR, OpenFabric \ -and VRRP, with alpha support for EIGRP and NHRP." -HOMEPAGE = "https://frrouting.org/" -SECTION = "net" - -LICENSE = "GPL-2.0-only & LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING-LGPLv2.1;md5=4fbd65380cdd255951079008b364516c" - -SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/8.3 \ - file://0001-configure-Check-for-readline-function-instead-of-mai.patch \ - file://0001-ospfd-Adding-SUPPORT_OSPF_API-define-in-ospf_spf.c.patch \ - file://0001-bgpd-avoid-notify-race-between-io-and-main-pthreads.patch \ - file://0001-bgpd-Make-sure-hdr-length-is-at-a-minimum-of-what-is.patch \ - file://frr.pam \ - " - -SRCREV = "a74f7a9ad9623e6f9654fe4a7177e5da0b194828" - -S = "${WORKDIR}/git" - -# Due to libyang not supported on these arches: -COMPATIBLE_HOST:riscv32 = "null" -COMPATIBLE_HOST:riscv64 = "null" -COMPATIBLE_HOST:armv5 = "null" - -# Fail to build on mips64 with error: -# Error: PC-relative reference to a different section -COMPATIBLE_HOST:mips64 = "null" - -inherit autotools-brokensep python3native pkgconfig useradd systemd - -DEPENDS:class-native = "bison-native elfutils-native" -DEPENDS:class-target = "bison-native json-c readline c-ares libyang frr-native" - -RDEPENDS:${PN}:class-target = "iproute2 python3-core bash" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" -PACKAGECONFIG:class-native = "" - -PACKAGECONFIG[fpm] = "--enable-fpm,--disable-fpm" -PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam" -PACKAGECONFIG[grpc] = "--enable-grpc,--disable-grpc,grpc-native grpc" -PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp" -PACKAGECONFIG[zeromq] = "--enable-zeromq,--disable-zeromq,zeromq" -PACKAGECONFIG[protobuf] = "--enable-protobuf,--disable-protobuf,protobuf-c-native protobuf-c" -PACKAGECONFIG[capabilities] = "--enable-capabilities,--disable-capabilities,libcap" -PACKAGECONFIG[cumulus] = "--enable-cumulus,--disable-cumulus" -PACKAGECONFIG[datacenter] = "--enable-datacenter,--disable-datacenter" -PACKAGECONFIG[ospfclient] = "--enable-ospfapi --enable-ospfclient,--disable-ospfapi --disable-ospfclient" - -EXTRA_OECONF:class-native = "--enable-clippy-only" - -EXTRA_OECONF:class-target = "--sbindir=${libdir}/frr \ - --sysconfdir=${sysconfdir}/frr \ - --localstatedir=${localstatedir}/run/frr \ - --enable-vtysh \ - --enable-multipath=64 \ - --enable-user=frr \ - --enable-group=frr \ - --enable-vty-group=frrvty \ - --enable-configfile-mask=0640 \ - --enable-logfile-mask=0640 \ - --disable-doc \ - --with-clippy=${RECIPE_SYSROOT_NATIVE}/usr/lib/clippy \ - " - -CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" - -LDFLAGS:append:mips = " -latomic" -LDFLAGS:append:mipsel = " -latomic" -LDFLAGS:append:powerpc = " -latomic" - -SYSTEMD_PACKAGES = "${PN}" -SYSTEMD_SERVICE:${PN} = "frr.service" -SYSTEMD_AUTO_ENABLE = "disable" - -do_compile:prepend () { - sed -i -e 's#${RECIPE_SYSROOT_NATIVE}##g' \ - -e 's#${RECIPE_SYSROOT}##g' ${S}/lib/version.h -} - -do_compile:class-native () { - oe_runmake clippy-only -} - -do_install:class-native () { - install -d ${D}${libdir} - install -m 755 ${S}/lib/clippy ${D}${libdir}/clippy -} - -do_install:append:class-target () { - install -m 0755 -d ${D}${sysconfdir}/frr - install -m 0640 ${S}/tools/etc/frr/* ${D}${sysconfdir}/frr/ - chown frr:frrvty ${D}${sysconfdir}/frr - chown frr:frr ${D}${sysconfdir}/frr/* - chown frr:frrvty ${D}${sysconfdir}/frr/vtysh.conf - chmod 640 ${D}${sysconfdir}/frr/* - - if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then - install -d ${D}/${sysconfdir}/pam.d - install -m 644 ${WORKDIR}/frr.pam ${D}/${sysconfdir}/pam.d/frr - fi - - if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${B}/tools/frrinit.sh ${D}${sysconfdir}/init.d/frr - - install -d ${D}${sysconfdir}/default/volatiles - echo "d frr frr 0755 ${localstatedir}/run/frr none" \ - > ${D}${sysconfdir}/default/volatiles/99_frr - fi - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${systemd_system_unitdir} - install -m 0644 ${B}/tools/frr*.service ${D}${systemd_system_unitdir} - - install -d ${D}${sysconfdir}/tmpfiles.d - echo "d /run/frr 0755 frr frr -" \ - > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf - fi -} - -USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM:${PN} = "--system frr ; --system frrvty" -USERADD_PARAM:${PN} = "--system --home ${localstatedir}/run/frr/ -M -g frr -G frrvty --shell /bin/false frr" - -FILES:${PN} += "${datadir}/yang" - -BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.4.1.bb b/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.4.1.bb new file mode 100644 index 0000000000..d3c86e7d75 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/frr/frr_8.4.1.bb @@ -0,0 +1,129 @@ +SUMMARY = "BGP/OSPF/RIP routing daemon" +DESCRIPTION = "FRRouting is a free and open source Internet routing protocol suite for Linux \ +and Unix platforms. It implements BGP, OSPF, RIP, IS-IS, PIM, LDP, BFD, Babel, PBR, OpenFabric \ +and VRRP, with alpha support for EIGRP and NHRP." +HOMEPAGE = "https://frrouting.org/" +SECTION = "net" + +LICENSE = "GPL-2.0-only & LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING-LGPLv2.1;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/8.4 \ + file://frr.pam \ + file://0001-m4-ax_python.m4-check-for-python-x.y-emded.pc-not-py.patch \ + " + +SRCREV = "70151e264bbb697a10fed711aa8c937d4f0009b1" + +S = "${WORKDIR}/git" + +# Due to libyang not supported on these arches: +COMPATIBLE_HOST:riscv32 = "null" +COMPATIBLE_HOST:riscv64 = "null" +COMPATIBLE_HOST:armv5 = "null" + +# Fail to build on mips64 with error: +# Error: PC-relative reference to a different section +COMPATIBLE_HOST:mips64 = "null" + +inherit autotools-brokensep python3native pkgconfig useradd systemd + +DEPENDS:class-native = "bison-native elfutils-native" +DEPENDS:class-target = "bison-native json-c readline c-ares libyang frr-native" + +RDEPENDS:${PN}:class-target = "iproute2 python3-core bash" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" +PACKAGECONFIG:class-native = "" + +PACKAGECONFIG[fpm] = "--enable-fpm,--disable-fpm" +PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam" +PACKAGECONFIG[grpc] = "--enable-grpc,--disable-grpc,grpc-native grpc" +PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp" +PACKAGECONFIG[zeromq] = "--enable-zeromq,--disable-zeromq,zeromq" +PACKAGECONFIG[protobuf] = "--enable-protobuf,--disable-protobuf,protobuf-c-native protobuf-c" +PACKAGECONFIG[capabilities] = "--enable-capabilities,--disable-capabilities,libcap" +PACKAGECONFIG[cumulus] = "--enable-cumulus,--disable-cumulus" +PACKAGECONFIG[datacenter] = "--enable-datacenter,--disable-datacenter" +PACKAGECONFIG[ospfclient] = "--enable-ospfapi --enable-ospfclient,--disable-ospfapi --disable-ospfclient" + +EXTRA_OECONF:class-native = "--enable-clippy-only" + +EXTRA_OECONF:class-target = "--sbindir=${libdir}/frr \ + --sysconfdir=${sysconfdir}/frr \ + --localstatedir=${localstatedir}/run/frr \ + --enable-vtysh \ + --enable-multipath=64 \ + --enable-user=frr \ + --enable-group=frr \ + --enable-vty-group=frrvty \ + --enable-configfile-mask=0640 \ + --enable-logfile-mask=0640 \ + --disable-doc \ + --with-clippy=${RECIPE_SYSROOT_NATIVE}/usr/lib/clippy \ + " + +CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" + +LDFLAGS:append:mips = " -latomic" +LDFLAGS:append:mipsel = " -latomic" +LDFLAGS:append:powerpc = " -latomic" + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "frr.service" +SYSTEMD_AUTO_ENABLE = "disable" + +do_compile:prepend () { + sed -i -e 's#${RECIPE_SYSROOT_NATIVE}##g' \ + -e 's#${RECIPE_SYSROOT}##g' ${S}/lib/version.h +} + +do_compile:class-native () { + oe_runmake clippy-only +} + +do_install:class-native () { + install -d ${D}${libdir} + install -m 755 ${S}/lib/clippy ${D}${libdir}/clippy +} + +do_install:append:class-target () { + install -m 0755 -d ${D}${sysconfdir}/frr + install -m 0640 ${S}/tools/etc/frr/* ${D}${sysconfdir}/frr/ + chown frr:frrvty ${D}${sysconfdir}/frr + chown frr:frr ${D}${sysconfdir}/frr/* + chown frr:frrvty ${D}${sysconfdir}/frr/vtysh.conf + chmod 640 ${D}${sysconfdir}/frr/* + + if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then + install -d ${D}/${sysconfdir}/pam.d + install -m 644 ${WORKDIR}/frr.pam ${D}/${sysconfdir}/pam.d/frr + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${B}/tools/frrinit.sh ${D}${sysconfdir}/init.d/frr + + install -d ${D}${sysconfdir}/default/volatiles + echo "d frr frr 0755 ${localstatedir}/run/frr none" \ + > ${D}${sysconfdir}/default/volatiles/99_frr + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${B}/tools/frr*.service ${D}${systemd_system_unitdir} + + install -d ${D}${sysconfdir}/tmpfiles.d + echo "d /run/frr 0755 frr frr -" \ + > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf + fi +} + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM:${PN} = "--system frr ; --system frrvty" +USERADD_PARAM:${PN} = "--system --home ${localstatedir}/run/frr/ -M -g frr -G frrvty --shell /bin/false frr" + +FILES:${PN} += "${datadir}/yang" + +BBCLASSEXTEND = "native" diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch deleted file mode 100644 index f8efc10448..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-Create-subroutine-for-cleaning-recent-interfaces.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 6d90f9fdaf008f5c3b8fd8d91594fa1461437888 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Wed, 28 Jun 2017 17:30:00 -0500 -Subject: [PATCH] Create subroutine for cleaning recent interfaces - -Moves functionality for cleaning the list of recent -interfaces into its own subroutine. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 23 ++++++++++++++--------- - 1 file changed, 14 insertions(+), 9 deletions(-) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index a63cd19..7aeee7b 100755 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1199,6 +1199,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf - return err; - } - -+// Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute -+mDNSlocal void CleanRecentInterfaces(void) -+{ -+ PosixNetworkInterface **ri = &gRecentInterfaces; -+ const mDNSs32 utc = mDNSPlatformUTC(); -+ while (*ri) -+ { -+ PosixNetworkInterface *pi = *ri; -+ if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; -+ else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; free(pi); } -+ } -+} -+ - // Creates a PosixNetworkInterface for the interface whose IP address is - // intfAddr and whose name is intfName and registers it with mDNS core. - mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, const char *intfName, int intfIndex) -@@ -1388,15 +1401,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) - // Clean up. - if (intfList != NULL) freeifaddrs(intfList); - -- // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute -- PosixNetworkInterface **ri = &gRecentInterfaces; -- const mDNSs32 utc = mDNSPlatformUTC(); -- while (*ri) -- { -- PosixNetworkInterface *pi = *ri; -- if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; -- else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; free(pi); } -- } -+ CleanRecentInterfaces(); - - return err; - } --- -2.20.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-dns-sd-Include-missing-headers.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-dns-sd-Include-missing-headers.patch deleted file mode 100644 index c743b3eddb..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-dns-sd-Include-missing-headers.patch +++ /dev/null @@ -1,41 +0,0 @@ -From ea442b57f7a9bcd41d5b5bd1cafde4dbe5685d41 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 4 Nov 2021 07:31:32 -0700 -Subject: [PATCH] dns-sd: Include missing headers - -Fixes build on Musl - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - Clients/dns-sd.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/Clients/dns-sd.c -+++ b/Clients/dns-sd.c -@@ -58,11 +58,13 @@ - //#define TEST_NEW_CLIENTSTUB 1 - - #include -+#include // For va_args - #include // For stdout, stderr - #include // For exit() - #include // For strlen(), strcpy() - #include // For errno, EINTR - #include -+#include // For MIN - #include // For u_char - #ifdef APPLE_OSX_mDNSResponder - #include // For PRId64 ---- a/mDNSPosix/nss_mdns.c -+++ b/mDNSPosix/nss_mdns.c -@@ -89,6 +89,9 @@ - - #include - -+#if !defined(NETDB_INTERNAL) -+# define NETDB_INTERNAL (-1) -+#endif - - //---------- - // Public functions diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-mdns-include-stddef.h-for-NULL.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-mdns-include-stddef.h-for-NULL.patch deleted file mode 100644 index c57ce8fa53..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0001-mdns-include-stddef.h-for-NULL.patch +++ /dev/null @@ -1,40 +0,0 @@ -From d744609c56f9872e5aa71707f1f71feec9867f51 Mon Sep 17 00:00:00 2001 -From: Mikko Rapeli -Date: Tue, 14 Jul 2020 16:36:29 +0000 -Subject: [PATCH 1/2] mdns: include for NULL - -Fixes build error with version 1096.40.7: - -../mDNSCore/mDNS.c:11385:26: error: 'NULL' undeclared (first use in this function) -11385 | const char *reason = NULL; - | ^~~~ -../mDNSCore/mDNS.c:56:1: note: 'NULL' is defined in header ''; did you forget to '#include '? - 55 | #include "dns_sd_internal.h" - +++ |+#include - 56 | -../mDNSCore/mDNS.c:11385:26: note: each undeclared identifier is reported only once for each function it appears in -11385 | const char *reason = NULL; - | ^~~~ - -Upstream-Status: Pending - -Signed-off-by: Mikko Rapeli ---- - mDNSCore/mDNS.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/mDNSCore/mDNS.c b/mDNSCore/mDNS.c -index 2fbea04..d4b9af5 100755 ---- a/mDNSCore/mDNS.c -+++ b/mDNSCore/mDNS.c -@@ -23,6 +23,7 @@ - * routines, or types (which may or may not be present on any given platform). - */ - -+#include /* for NULL */ - #include "DNSCommon.h" // Defines general DNS utility routines - #include "uDNS.h" // Defines entry points into unicast-specific routines - --- -2.20.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch deleted file mode 100644 index 21ba318499..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0002-Create-subroutine-for-tearing-down-an-interface.patch +++ /dev/null @@ -1,58 +0,0 @@ -From a2148df99ddcd122247f95c4cbcce5c4118581a1 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Wed, 28 Jun 2017 17:30:00 -0500 -Subject: [PATCH 02/11] Create subroutine for tearing down an interface - -Creates a subroutine for tearing down an interface. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 22 ++++++++++++++++------ - 1 file changed, 16 insertions(+), 6 deletions(-) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index ffc9696..5e5b2cd 100644 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -591,6 +591,19 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) - gRecentInterfaces = intf; - } - -+mDNSlocal void TearDownInterface(mDNS *const m, PosixNetworkInterface *intf) -+{ -+ mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); -+ if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); -+ FreePosixNetworkInterface(intf); -+ -+ num_registered_interfaces--; -+ if (num_registered_interfaces == 0) { -+ num_pkts_accepted = 0; -+ num_pkts_rejected = 0; -+ } -+} -+ - // Grab the first interface, deregister it, free it, and repeat until done. - mDNSlocal void ClearInterfaceList(mDNS *const m) - { -@@ -599,13 +612,10 @@ mDNSlocal void ClearInterfaceList(mDNS *const m) - while (m->HostInterfaces) - { - PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces); -- mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); -- if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); -- FreePosixNetworkInterface(intf); -+ TearDownInterface(m, intf); - } -- num_registered_interfaces = 0; -- num_pkts_accepted = 0; -- num_pkts_rejected = 0; -+ -+ assert(num_registered_interfaces == 0); - } - - // Sets up a send/receive socket. --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0002-mdns-cross-compilation-fixes-for-bitbake.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0002-mdns-cross-compilation-fixes-for-bitbake.patch deleted file mode 100644 index 33590ffc57..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0002-mdns-cross-compilation-fixes-for-bitbake.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 72405143f9d16514e70b88bc4843c9634b88036a Mon Sep 17 00:00:00 2001 -From: Brendan Le Foll -Date: Tue, 3 Mar 2015 11:42:57 +0000 -Subject: [PATCH 2/2] mdns: cross compilation fixes for bitbake - -Fixes several build errors when incorrect compiler or -compiler flags are used. - -Upstream-Status: Inappropriate [OE-specific] - -Signed-off-by: Paul Eggleton -Signed-off-by: Mikko Rapeli ---- - mDNSPosix/Makefile | 44 ++++++++++++++++++++------------------------ - 1 file changed, 20 insertions(+), 24 deletions(-) - -diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile -index 78222e0..18a3af5 100755 ---- a/mDNSPosix/Makefile -+++ b/mDNSPosix/Makefile -@@ -50,6 +50,7 @@ - - LIBVERS = 1 - -+POSIXDIR = ../mDNSPosix - COREDIR = ../mDNSCore - SHAREDDIR ?= ../mDNSShared - DSODIR ?= ../DSO -@@ -62,16 +63,16 @@ else ifeq ($(SYSTEM), Linux) - os=linux - endif - --CC = cc --BISON = bison --FLEX = flex --ST = strip --LD = ld -+CC ?= cc -+BISON ?= bison -+FLEX ?= flex -+ST ?= strip -+LD ?= ld - SOOPTS = -shared - CP = cp - RM = rm - LN = ln -s -f --CFLAGS_COMMON = -I$(COREDIR) -I$(SHAREDDIR) -I$(DSODIR) -I$(PROXYDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" -+CFLAGS_COMMON = -I$(POSIXDIR) -I$(COREDIR) -I$(SHAREDDIR) -I$(DSODIR) -I$(PROXYDIR) -I$(OBJDIR) -fwrapv -W -Wall -DPID_FILE=\"/var/run/mdnsd.pid\" -DMDNS_UDS_SERVERPATH=\"/var/run/mdnsd\" - CFLAGS_PTHREAD = - LINKOPTS = - LINKOPTS_PTHREAD = -lpthread -@@ -85,6 +86,7 @@ CFLAGS_OPEN_SOURCE= - endif - - # Set up diverging paths for debug vs. prod builds -+DEBUG ?= 1 - ifeq "$(DEBUG)" "1" - CFLAGS_DEBUGGING = -g -DMDNS_DEBUGMSGS=2 - OBJDIR = objects/debug -@@ -101,8 +103,8 @@ else - # 1. We want to make small binaries, suitable for putting into hardware devices - # 2. Some of the code analysis warnings only work when some form of optimization is enabled - CFLAGS_DEBUGGING = -g -DMDNS_DEBUGMSGS=0 --OBJDIR ?= objects/prod --BUILDDIR ?= build/prod -+OBJDIR = objects/prod -+BUILDDIR = build/prod - STRIP = $(ST) -S - endif - endif -@@ -125,7 +127,7 @@ else - # any target that contains the string "linux" - ifeq ($(findstring linux,$(os)),linux) - CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -ftabstop=4 --LD = $(CC) -+LD ?= $(CC) - SOOPTS = -shared - FLEXFLAGS_OS = -l - JAVACFLAGS_OS += -I$(JDK)/include/linux -@@ -276,8 +278,7 @@ Daemon: setup $(BUILDDIR)/mdnsd - @echo "Responder daemon done" - - $(BUILDDIR)/mdnsd: $(DAEMONOBJS) -- $(CC) -o $@ $+ $(LINKOPTS) -- $(STRIP) $@ -+ $(LD) -o $@ $+ - - # libdns_sd target builds the client library - libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) -@@ -286,13 +287,9 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) - CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o - - $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS) -- $(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ -- $(STRIP) $@ -- --Clients: setup libdns_sd ../Clients/build/dns-sd -- @echo "Clients done" -+ $(LD) -shared $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+ - --../Clients/build/dns-sd: ../Clients/dns-sd.c -+Clients: setup libdns_sd - $(MAKE) -C ../Clients DEBUG=$(DEBUG) SUPMAKE_CFLAGS="$(MDNSCFLAGS)" - - # nss_mdns target builds the Name Service Switch module -@@ -300,8 +297,7 @@ nss_mdns: setup $(BUILDDIR)/$(NSSLIBFILE) - @echo "Name Service Switch module done" - - $(BUILDDIR)/$(NSSLIBFILE): $(CLIENTLIBOBJS) $(OBJDIR)/nss_mdns.c.so.o -- $(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ -- $(STRIP) $@ -+ $(LD) -shared $(LINKOPTS) -o $@ $+ - - ############################################################################# - -@@ -494,21 +490,21 @@ dnsextd: setup $(BUILDDIR)/dnsextd - @echo "dnsextd done" - - $(BUILDDIR)/mDNSClientPosix: $(APPOBJ) $(OBJDIR)/Client.c.o -- $(CC) $+ -o $@ $(LINKOPTS) -+ $(CC) $+ -o $@ - - $(BUILDDIR)/mDNSResponderPosix: $(COMMONOBJ) $(OBJDIR)/Responder.c.o -- $(CC) $+ -o $@ $(LINKOPTS) -+ $(CC) $+ -o $@ - - $(BUILDDIR)/mDNSProxyResponderPosix: $(COMMONOBJ) $(OBJDIR)/ProxyResponder.c.o -- $(CC) $+ -o $@ $(LINKOPTS) -+ $(CC) $+ -o $@ - - $(BUILDDIR)/mDNSNetMonitor: $(SPECIALOBJ) $(OBJDIR)/NetMonitor.c.o -- $(CC) $+ -o $@ $(LINKOPTS) -+ $(CC) $+ -o $@ - - $(OBJDIR)/NetMonitor.c.o: $(COREDIR)/mDNS.c # Note: NetMonitor.c textually imports mDNS.c - - $(BUILDDIR)/dnsextd: $(DNSEXTDOBJ) $(OBJDIR)/dnsextd.c.threadsafe.o -- $(CC) $+ -o $@ $(LINKOPTS) $(LINKOPTS_PTHREAD) -+ $(CC) $+ -o $@ $(LINKOPTS_PTHREAD) - - ############################################################################# - --- -2.20.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0003-Track-interface-socket-family.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0003-Track-interface-socket-family.patch deleted file mode 100644 index 8c0e6bf397..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0003-Track-interface-socket-family.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 71a7c728ae0d8143b66aa40decca74ebaa9aa2ce Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Wed, 28 Jun 2017 17:30:00 -0500 -Subject: [PATCH 03/11] Track interface socket family - -Tracks the socket family associated with the interface. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 1 + - mDNSPosix/mDNSPosix.h | 2 ++ - 2 files changed, 3 insertions(+) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index 5e5b2cd..8fe22be 100644 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -918,6 +918,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct - // Set up the extra fields in PosixNetworkInterface. - assert(intf->intfName != NULL); // intf->intfName already set up above - intf->index = intfIndex; -+ intf->sa_family = intfAddr->sa_family; - intf->multicastSocket4 = -1; - #if HAVE_IPV6 - intf->multicastSocket6 = -1; -diff --git a/mDNSPosix/mDNSPosix.h b/mDNSPosix/mDNSPosix.h -index ca60d80..f77c185 100644 ---- a/mDNSPosix/mDNSPosix.h -+++ b/mDNSPosix/mDNSPosix.h -@@ -19,6 +19,7 @@ - #define __mDNSPlatformPosix_h - - #include -+#include - #include - - #ifdef __cplusplus -@@ -40,6 +41,7 @@ struct PosixNetworkInterface - const char * intfName; - PosixNetworkInterface * aliasIntf; - int index; -+ sa_family_t sa_family; - int multicastSocket4; - #if HAVE_IPV6 - int multicastSocket6; --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch deleted file mode 100644 index db3a63ea48..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0004-Use-list-for-changed-interfaces.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 798bfb5e984845a27874d1a244686db6e384d7b8 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Thu, 13 Jul 2017 09:00:00 -0500 -Subject: [PATCH 04/11] Use list for changed interfaces - -Uses a linked list to store the index of changed network interfaces -instead of a bitfield. This allows for network interfaces with an -index greater than 31 (an index of 36 was seen on Android). - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 67 +++++++++++++++++++++++++++++++++---------- - 1 file changed, 52 insertions(+), 15 deletions(-) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index 195d04b..bb883c1 100755 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -67,6 +67,14 @@ struct IfChangeRec - }; - typedef struct IfChangeRec IfChangeRec; - -+// Used to build a list of network interface indices -+struct NetworkInterfaceIndex -+{ -+ int if_index; -+ struct NetworkInterfaceIndex *Next; -+}; -+typedef struct NetworkInterfaceIndex NetworkInterfaceIndex; -+ - // Note that static data is initialized to zero in (modern) C. - static PosixEventSource *gEventSources; // linked list of PosixEventSource's - static sigset_t gEventSignalSet; // Signals which event loop listens for -@@ -1458,6 +1466,32 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) - return err; - } - -+mDNSlocal mDNSBool ListContainsInterfaceIndex(GenLinkedList *list, int if_index) -+{ -+ NetworkInterfaceIndex *item; -+ -+ for (item = (NetworkInterfaceIndex*)list->Head; item != NULL; item = item->Next) -+ { -+ if (if_index == item->if_index) return mDNStrue; -+ } -+ -+ return mDNSfalse; -+} -+ -+mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) -+{ -+ NetworkInterfaceIndex *item; -+ -+ if (ListContainsInterfaceIndex(list, if_index)) return; -+ -+ item = malloc(sizeof *item); -+ if (item == NULL) return; -+ -+ item->if_index = if_index; -+ item->Next = NULL; -+ AddToTail(list, item); -+} -+ - #if MDNS_DEBUGMSGS - mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) - { -@@ -1485,14 +1519,13 @@ mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) - } - #endif - --mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) -+mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *changedInterfaces) - // Read through the messages on sd and if any indicate that any interface records should - // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. - { - ssize_t readCount; - char buff[4096]; - struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; -- mDNSu32 result = 0; - - // The structure here is more complex than it really ought to be because, - // unfortunately, there's no good way to size a buffer in advance large -@@ -1528,9 +1561,9 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) - - // Process the NetLink message - if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) -- result |= 1 << ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index; -+ AddInterfaceIndexToList(changedInterfaces, ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index); - else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) -- result |= 1 << ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index; -+ AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); - - // Advance pNLMsg to the next message in the buffer - if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) -@@ -1541,8 +1574,6 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) - else - break; // all done! - } -- -- return result; - } - - #else // USES_NETLINK -@@ -1574,14 +1605,13 @@ mDNSlocal void PrintRoutingSocketMsg(const struct ifa_msghdr *pRSMsg) - } - #endif - --mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) -+mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *changedInterfaces) - // Read through the messages on sd and if any indicate that any interface records should - // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. - { - ssize_t readCount; - char buff[4096]; - struct ifa_msghdr *pRSMsg = (struct ifa_msghdr*) buff; -- mDNSu32 result = 0; - - readCount = read(sd, buff, sizeof buff); - if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) -@@ -1596,12 +1626,10 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) - pRSMsg->ifam_type == RTM_IFINFO) - { - if (pRSMsg->ifam_type == RTM_IFINFO) -- result |= 1 << ((struct if_msghdr*) pRSMsg)->ifm_index; -+ AddInterfaceIndexToList(changedInterfaces, ((struct if_msghdr*) pRSMsg)->ifm_index); - else -- result |= 1 << pRSMsg->ifam_index; -+ AddInterfaceIndexToList(changedInterfaces, pRSMsg->ifam_index); - } -- -- return result; - } - - #endif // USES_NETLINK -@@ -1611,7 +1639,8 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) - { - IfChangeRec *pChgRec = (IfChangeRec*) context; - fd_set readFDs; -- mDNSu32 changedInterfaces = 0; -+ GenLinkedList changedInterfaces; -+ NetworkInterfaceIndex *changedInterface; - struct timeval zeroTimeout = { 0, 0 }; - - (void)fd; // Unused -@@ -1619,17 +1648,25 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) - FD_ZERO(&readFDs); - FD_SET(pChgRec->NotifySD, &readFDs); - -+ InitLinkedList(&changedInterfaces, offsetof(NetworkInterfaceIndex, Next)); -+ - do - { -- changedInterfaces |= ProcessRoutingNotification(pChgRec->NotifySD); -+ ProcessRoutingNotification(pChgRec->NotifySD, &changedInterfaces); - } - while (0 < select(pChgRec->NotifySD + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &zeroTimeout)); - - // Currently we rebuild the entire interface list whenever any interface change is - // detected. If this ever proves to be a performance issue in a multi-homed - // configuration, more care should be paid to changedInterfaces. -- if (changedInterfaces) -+ if (changedInterfaces.Head != NULL) - mDNSPlatformPosixRefreshInterfaceList(pChgRec->mDNS); -+ -+ while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) -+ { -+ RemoveFromList(&changedInterfaces, changedInterface); -+ free(changedInterface); -+ } - } - - // Register with either a Routing Socket or RtNetLink to listen for interface changes. --- -2.20.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0006-Remove-unneeded-function.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0006-Remove-unneeded-function.patch deleted file mode 100644 index b461a60df7..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0006-Remove-unneeded-function.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 157d67f152777754c059ced7511352102f23ffae Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Mon, 24 Jul 2017 09:39:18 -0500 -Subject: [PATCH 06/11] Remove unneeded function - -Removes a function we no longer need by integrating it into the only -function that calls it. This was originally separated so that we could -only process network interfaces that netlink indicated had been changed, -this has since been extended to test for all network intefaces. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 13 ++----------- - 1 file changed, 2 insertions(+), 11 deletions(-) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index 59a8b8c..3fc5451 100644 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1079,24 +1079,15 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) - return err; - } - --mDNSlocal mDNSBool ListContainsInterfaceIndex(GenLinkedList *list, int if_index) -+mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) - { - NetworkInterfaceIndex *item; - - for (item = (NetworkInterfaceIndex*)list->Head; item != NULL; item = item->Next) - { -- if (if_index == item->if_index) return mDNStrue; -+ if (if_index == item->if_index) return; - } - -- return mDNSfalse; --} -- --mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) --{ -- NetworkInterfaceIndex *item; -- -- if (ListContainsInterfaceIndex(list, if_index)) return; -- - item = malloc(sizeof *item); - if (item == NULL) return; - --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0008-Mark-deleted-interfaces-as-being-changed.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0008-Mark-deleted-interfaces-as-being-changed.patch deleted file mode 100644 index fdc5105cb9..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0008-Mark-deleted-interfaces-as-being-changed.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0fcc0f210f3a9310a1963de640b384ce866410fd Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Wed, 9 Aug 2017 09:16:58 -0500 -Subject: [PATCH 08/11] Mark deleted interfaces as being changed - -Netlink notification handling ignores messages for deleted links, -RTM_DELLINK. It does handle RTM_GETLINK. According to libnl docu- -mentation (http://www.infradead.org/~tgr/libnl/doc/route.html) -RTM_DELLINK can be sent by the kernel, but RTM_GETLINK cannot. -There was likely a mixup in the original implementation, so this -change replaces handling for RTM_GETLINK with RTM_DELLINK. - -Testing and Verification Instructions: - 1. Use ip-link to add and remove a VLAN interface and verify - that mDNSResponder handles the deleted link. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index 798ab10..a8a57df 100644 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1163,7 +1163,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change - #endif - - // Process the NetLink message -- if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) -+ if (pNLMsg->nlmsg_type == RTM_DELLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) - AddInterfaceIndexToList(changedInterfaces, ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index); - else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) - AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0009-Fix-possible-NULL-dereference.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0009-Fix-possible-NULL-dereference.patch deleted file mode 100644 index 362d69768e..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0009-Fix-possible-NULL-dereference.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 38cff19781f81586926b02f0fd1cb36c040395e0 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Thu, 10 Aug 2017 08:21:53 -0500 -Subject: [PATCH 09/11] Fix possible NULL dereference - -Fixes a possible NULL dereference if memory for -the PosixNetworkInterface could not be allocated. -Other logic seems to prevent dereferencing this -variable if NULL, but this instance seems to have -been overlooked. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index a8a57df..3243ed4 100644 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -951,12 +951,15 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct ifi_info *const ifi) - - // If interface is a direct link, address record will be marked as kDNSRecordTypeKnownUnique - // and skip the probe phase of the probe/announce packet sequence. -- intf->coreIntf.DirectLink = mDNSfalse; -+ if (err == 0) -+ { -+ intf->coreIntf.DirectLink = mDNSfalse; - #ifdef DIRECTLINK_INTERFACE_NAME -- if (strcmp(intfName, STRINGIFY(DIRECTLINK_INTERFACE_NAME)) == 0) -- intf->coreIntf.DirectLink = mDNStrue; -+ if (strcmp(intfName, STRINGIFY(DIRECTLINK_INTERFACE_NAME)) == 0) -+ intf->coreIntf.DirectLink = mDNStrue; - #endif -- intf->coreIntf.SupportsUnicastMDNSResponse = mDNStrue; -+ intf->coreIntf.SupportsUnicastMDNSResponse = mDNStrue; -+ } - - // The interface is all ready to go, let's register it with the mDNS core. - if (err == 0) --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0010-Handle-errors-from-socket-calls.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0010-Handle-errors-from-socket-calls.patch deleted file mode 100644 index b9b0157276..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0010-Handle-errors-from-socket-calls.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 382b3b924e43abd1bdc5792918161d0922666691 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Thu, 10 Aug 2017 08:27:32 -0500 -Subject: [PATCH 10/11] Handle errors from socket calls - -Adds handling for socket() or read() returning a -negative value (indicating an error has occurred). - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index 3243ed4..84af26b 100644 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -1129,7 +1129,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change - // Read through the messages on sd and if any indicate that any interface records should - // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. - { -- ssize_t readCount; -+ ssize_t readVal, readCount; - char buff[4096]; - struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; - -@@ -1138,7 +1138,10 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change - // enough to hold all pending data and so avoid message fragmentation. - // (Note that FIONREAD is not supported on AF_NETLINK.) - -- readCount = read(sd, buff, sizeof buff); -+ readVal = read(sd, buff, sizeof buff); -+ if (readVal < 0) return; -+ readCount = readVal; -+ - while (1) - { - // Make sure we've got an entire nlmsghdr in the buffer, and payload, too. -@@ -1154,7 +1157,9 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change - pNLMsg = (struct nlmsghdr*) buff; - - // read more data -- readCount += read(sd, buff + readCount, sizeof buff - readCount); -+ readVal = read(sd, buff + readCount, sizeof buff - readCount); -+ if (readVal < 0) return; -+ readCount += readVal; - continue; // spin around and revalidate with new readCount - } - else -@@ -1429,6 +1434,7 @@ mDNSlocal mDNSBool mDNSPlatformInit_CanReceiveUnicast(void) - int err; - int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - struct sockaddr_in s5353; -+ if (s < 0) return mDNSfalse; - s5353.sin_family = AF_INET; - s5353.sin_port = MulticastDNSPort.NotAnInteger; - s5353.sin_addr.s_addr = 0; --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch deleted file mode 100644 index d9adde04c2..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 9ff06108cd44e84ba6c68bfa6737e793f117e303 Mon Sep 17 00:00:00 2001 -From: Nate Karstens -Date: Thu, 10 Aug 2017 08:46:03 -0500 -Subject: [PATCH] Change a dynamic allocation to file-scope variable - -Changes a variable from being dynamically-allocated to being -statically-allocated at the file scope. Addresses a Coverity -issue where it appeared that the memory was being leaked. - -Upstream-Status: Submitted [dts@apple.com] - -Signed-off-by: Nate Karstens ---- - mDNSPosix/mDNSPosix.c | 14 ++++---------- - 1 file changed, 4 insertions(+), 10 deletions(-) - -diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c -index 7aeee7b..2d25016 100755 ---- a/mDNSPosix/mDNSPosix.c -+++ b/mDNSPosix/mDNSPosix.c -@@ -81,6 +81,7 @@ static sigset_t gEventSignalSet; // Signals which event loop list - static sigset_t gEventSignals; // Signals which were received while inside loop - - static PosixNetworkInterface *gRecentInterfaces; -+static IfChangeRec gChgRec; - - // *************************************************************************** - // Globals (for debugging) -@@ -1641,18 +1642,11 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) - mDNSlocal mStatus WatchForInterfaceChange(mDNS *const m) - { - mStatus err; -- IfChangeRec *pChgRec; - -- pChgRec = (IfChangeRec*) mDNSPlatformMemAllocateClear(sizeof *pChgRec); -- if (pChgRec == NULL) -- return mStatus_NoMemoryErr; -- -- pChgRec->mDNS = m; -- err = OpenIfNotifySocket(&pChgRec->NotifySD); -+ gChgRec.mDNS = m; -+ err = OpenIfNotifySocket(&gChgRec.NotifySD); - if (err == 0) -- err = mDNSPosixAddFDToEventLoop(pChgRec->NotifySD, InterfaceChangeCallback, pChgRec); -- if (err) -- mDNSPlatformMemFree(pChgRec); -+ err = mDNSPosixAddFDToEventLoop(gChgRec.NotifySD, InterfaceChangeCallback, &gChgRec); - - return err; - } --- -2.20.1 - diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/mdns.service b/meta-openembedded/meta-networking/recipes-protocols/mdns/files/mdns.service deleted file mode 100644 index 531d142dcd..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/files/mdns.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Zero-configuration networking -After=network.target - -[Service] -Type=forking -ExecStartPre=/bin/rm -f /var/run/mdnsd.pid -ExecStart=/usr/sbin/mdnsd -ExecReload=/bin/kill -HUP $MAINPID -PIDFile=/var/run/mdnsd.pid -Restart=always -RestartSec=10s - -[Install] -WantedBy=multi-user.target diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch new file mode 100644 index 0000000000..91198dea73 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0001-Create-subroutine-for-cleaning-recent-interfaces.patch @@ -0,0 +1,61 @@ +From c1f3e19d3cb0aa948248616eb1684a1e80aa39b4 Mon Sep 17 00:00:00 2001 +From: Nate Karstens +Date: Wed, 28 Jun 2017 17:30:00 -0500 +Subject: [PATCH 1/8] Create subroutine for cleaning recent interfaces + +Moves functionality for cleaning the list of recent +interfaces into its own subroutine. + +Upstream-Status: Submitted [dts@apple.com] + +Signed-off-by: Nate Karstens +Signed-off-by: Alex Kiernan +--- + mDNSPosix/mDNSPosix.c | 24 ++++++++++++++---------- + 1 file changed, 14 insertions(+), 10 deletions(-) + +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index 0a7c3dfa2475..fe7242d83599 100644 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -1322,6 +1322,19 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, mDNSIPPort port, int interf + return err; + } + ++// Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute ++mDNSlocal void CleanRecentInterfaces(void) ++{ ++ PosixNetworkInterface **ri = &gRecentInterfaces; ++ const mDNSs32 utc = mDNSPlatformUTC(); ++ while (*ri) ++ { ++ PosixNetworkInterface *pi = *ri; ++ if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; ++ else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; mdns_free(pi); } ++ } ++} ++ + // Creates a PosixNetworkInterface for the interface whose IP address is + // intfAddr and whose name is intfName and registers it with mDNS core. + mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, +@@ -1559,16 +1572,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) + + // Clean up. + if (intfList != NULL) freeifaddrs(intfList); +- +- // Clean up any interfaces that have been hanging around on the RecentInterfaces list for more than a minute +- PosixNetworkInterface **ri = &gRecentInterfaces; +- const mDNSs32 utc = mDNSPlatformUTC(); +- while (*ri) +- { +- PosixNetworkInterface *pi = *ri; +- if (utc - pi->LastSeen < 60) ri = (PosixNetworkInterface **)&pi->coreIntf.next; +- else { *ri = (PosixNetworkInterface *)pi->coreIntf.next; mdns_free(pi); } +- } ++ CleanRecentInterfaces(); + + return err; + } +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch new file mode 100644 index 0000000000..4a60a95728 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0001-dns-sd-Include-missing-headers.patch @@ -0,0 +1,30 @@ +From cea342c10731cb1c8c8b52f03d55f9d15fc3b091 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 4 Nov 2021 07:31:32 -0700 +Subject: [PATCH 1/6] dns-sd: Include missing headers + +Fixes build on Musl + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + mDNSPosix/nss_mdns.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/mDNSPosix/nss_mdns.c b/mDNSPosix/nss_mdns.c +index afadb3c6c33b..84c312759463 100644 +--- a/mDNSPosix/nss_mdns.c ++++ b/mDNSPosix/nss_mdns.c +@@ -89,6 +89,9 @@ + + #include + ++#if !defined(NETDB_INTERNAL) ++# define NETDB_INTERNAL (-1) ++#endif + + //---------- + // Public functions +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch new file mode 100644 index 0000000000..aa3dda8d55 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0002-Create-subroutine-for-tearing-down-an-interface.patch @@ -0,0 +1,59 @@ +From 40ef0241afbb49f84e76afd65eb3ee17466bb582 Mon Sep 17 00:00:00 2001 +From: Nate Karstens +Date: Wed, 28 Jun 2017 17:30:00 -0500 +Subject: [PATCH 2/8] Create subroutine for tearing down an interface + +Creates a subroutine for tearing down an interface. + +Upstream-Status: Submitted [dts@apple.com] + +Signed-off-by: Nate Karstens +Signed-off-by: Alex Kiernan +--- + mDNSPosix/mDNSPosix.c | 22 ++++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index fe7242d83599..a32a880c0ce5 100644 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -1043,6 +1043,19 @@ mDNSlocal void FreePosixNetworkInterface(PosixNetworkInterface *intf) + gRecentInterfaces = intf; + } + ++mDNSlocal void TearDownInterface(mDNS *const m, PosixNetworkInterface *intf) ++{ ++ mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); ++ if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); ++ FreePosixNetworkInterface(intf); ++ ++ num_registered_interfaces--; ++ if (num_registered_interfaces == 0) { ++ num_pkts_accepted = 0; ++ num_pkts_rejected = 0; ++ } ++} ++ + // Grab the first interface, deregister it, free it, and repeat until done. + mDNSlocal void ClearInterfaceList(mDNS *const m) + { +@@ -1051,13 +1064,10 @@ mDNSlocal void ClearInterfaceList(mDNS *const m) + while (m->HostInterfaces) + { + PosixNetworkInterface *intf = (PosixNetworkInterface*)(m->HostInterfaces); +- mDNS_DeregisterInterface(m, &intf->coreIntf, NormalActivation); +- if (gMDNSPlatformPosixVerboseLevel > 0) fprintf(stderr, "Deregistered interface %s\n", intf->intfName); +- FreePosixNetworkInterface(intf); ++ TearDownInterface(m, intf); + } +- num_registered_interfaces = 0; +- num_pkts_accepted = 0; +- num_pkts_rejected = 0; ++ ++ assert(num_registered_interfaces == 0); + } + + mDNSlocal int SetupIPv6Socket(int fd) +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch new file mode 100644 index 0000000000..7f660396b4 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0002-make-Set-libdns_sd.so-soname-correctly.patch @@ -0,0 +1,27 @@ +From a198bcd457abd04f2e22812ff3a37246aa564614 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Mon, 5 Dec 2022 15:14:12 +0000 +Subject: [PATCH 2/6] make: Set libdns_sd.so soname correctly + +Upstream-Status: Pending +Signed-off-by: Alex Kiernan +--- + mDNSPosix/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile +index 802a13dd70b6..5e74193c0e89 100755 +--- a/mDNSPosix/Makefile ++++ b/mDNSPosix/Makefile +@@ -276,7 +276,7 @@ libdns_sd: setup $(BUILDDIR)/libdns_sd.$(LDSUFFIX) + CLIENTLIBOBJS = $(OBJDIR)/dnssd_clientlib.c.so.o $(OBJDIR)/dnssd_clientstub.c.so.o $(OBJDIR)/dnssd_ipc.c.so.o $(OBJDIR)/dnssd_errstring.c.so.o + + $(BUILDDIR)/libdns_sd.$(LDSUFFIX): $(CLIENTLIBOBJS) +- $(LD) $(SOOPTS) $(LINKOPTS) -o $@ $+ ++ $(LD) $(SOOPTS) $(LINKOPTS) -Wl,-soname,libdns_sd.$(LDSUFFIX).1 -o $@ $+ + $(STRIP) $@ + + Clients: setup libdns_sd ../Clients/build/dns-sd +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch new file mode 100644 index 0000000000..d2a9995ffa --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0003-Track-interface-socket-family.patch @@ -0,0 +1,51 @@ +From deb3a2c51f32e0d2741be11a492e727129f770e2 Mon Sep 17 00:00:00 2001 +From: Nate Karstens +Date: Wed, 28 Jun 2017 17:30:00 -0500 +Subject: [PATCH 3/8] Track interface socket family + +Tracks the socket family associated with the interface. + +Upstream-Status: Submitted [dts@apple.com] + +Signed-off-by: Nate Karstens +Signed-off-by: Alex Kiernan +--- + mDNSPosix/mDNSPosix.c | 1 + + mDNSPosix/mDNSPosix.h | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index a32a880c0ce5..9a5b4d7ea4cb 100644 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -1415,6 +1415,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct + // Set up the extra fields in PosixNetworkInterface. + assert(intf->intfName != NULL); // intf->intfName already set up above + intf->index = intfIndex; ++ intf->sa_family = intfAddr->sa_family; + intf->multicastSocket4 = -1; + #if HAVE_IPV6 + intf->multicastSocket6 = -1; +diff --git a/mDNSPosix/mDNSPosix.h b/mDNSPosix/mDNSPosix.h +index 9675591b0434..dd7864cd0d5e 100644 +--- a/mDNSPosix/mDNSPosix.h ++++ b/mDNSPosix/mDNSPosix.h +@@ -19,6 +19,7 @@ + #define __mDNSPlatformPosix_h + + #include ++#include + #include + + #ifdef __cplusplus +@@ -40,6 +41,7 @@ struct PosixNetworkInterface + char * intfName; + PosixNetworkInterface * aliasIntf; + int index; ++ sa_family_t sa_family; + int multicastSocket4; + #if HAVE_IPV6 + int multicastSocket6; +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch new file mode 100644 index 0000000000..0ac0bb6a45 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch @@ -0,0 +1,30 @@ +From 4c0954f77ba05d77192ee1519929a39fbc978321 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Mon, 5 Dec 2022 15:14:22 +0000 +Subject: [PATCH 3/6] mDNSShared: Drop MacOS specific __block qualifier + +Support for this extension only exists in MacOS/Clang, also it's not +actually used here, so we can just drop it. + +Upstream-Status: Pending +Signed-off-by: Alex Kiernan +--- + mDNSShared/uds_daemon.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mDNSShared/uds_daemon.c b/mDNSShared/uds_daemon.c +index 9ae5f78542d6..8c006b71a4ea 100644 +--- a/mDNSShared/uds_daemon.c ++++ b/mDNSShared/uds_daemon.c +@@ -2912,7 +2912,7 @@ exit: + mDNSlocal mStatus add_domain_to_browser(request_state *info, const domainname *d) + { + browser_t *b, *p; +- __block mStatus err; ++ mStatus err; + + for (p = info->u.browser.browsers; p; p = p->next) + { +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch new file mode 100644 index 0000000000..a5f7f0136b --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0004-Indicate-loopback-interface-to-mDNS-core.patch @@ -0,0 +1,58 @@ +From beab76b5708862f44d9acbe7a92db45e2f99259f Mon Sep 17 00:00:00 2001 +From: Nate Karstens +Date: Tue, 1 Aug 2017 17:06:01 -0500 +Subject: [PATCH 4/8] Indicate loopback interface to mDNS core + +Tells the mDNS core if an interface is a loopback interface, +similar to AddInterfaceToList() in the MacOS implementation. + +Upstream-Status: Submitted [dts@apple.com] + +Signed-off-by: Nate Karstens +Signed-off-by: Alex Kiernan +--- + mDNSPosix/mDNSPosix.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index 9a5b4d7ea4cb..02a19b438e03 100644 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -1348,7 +1348,7 @@ mDNSlocal void CleanRecentInterfaces(void) + // Creates a PosixNetworkInterface for the interface whose IP address is + // intfAddr and whose name is intfName and registers it with mDNS core. + mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct sockaddr *intfMask, +- const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex) ++ const mDNSu8 *intfHaddr, mDNSu16 intfHlen, const char *intfName, int intfIndex, int intfFlags) + { + int err = 0; + PosixNetworkInterface *intf; +@@ -1411,6 +1411,7 @@ mDNSlocal int SetupOneInterface(mDNS *const m, struct sockaddr *intfAddr, struct + + intf->coreIntf.Advertise = m->AdvertiseLocalAddresses; + intf->coreIntf.McastTxRx = mDNStrue; ++ intf->coreIntf.Loopback = ((intfFlags & IFF_LOOPBACK) != 0) ? mDNStrue : mDNSfalse; + + // Set up the extra fields in PosixNetworkInterface. + assert(intf->intfName != NULL); // intf->intfName already set up above +@@ -1561,7 +1562,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) + } + #endif + if (SetupOneInterface(m, i->ifa_addr, i->ifa_netmask, +- hwaddr, hwaddr_len, i->ifa_name, ifIndex) == 0) ++ hwaddr, hwaddr_len, i->ifa_name, ifIndex, i->ifa_flags) == 0) + { + if (i->ifa_addr->sa_family == AF_INET) + foundav4 = mDNStrue; +@@ -1578,7 +1579,7 @@ mDNSlocal int SetupInterfaceList(mDNS *const m) + // if ((m->HostInterfaces == NULL) && (firstLoopback != NULL)) + if (!foundav4 && firstLoopback) + (void) SetupOneInterface(m, firstLoopback->ifa_addr, firstLoopback->ifa_netmask, +- NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex); ++ NULL, 0, firstLoopback->ifa_name, firstLoopbackIndex, firstLoopback->ifa_flags); + } + + // Clean up. +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch new file mode 100644 index 0000000000..a8e8dae60a --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0004-make-Separate-TLS-targets-from-libraries.patch @@ -0,0 +1,64 @@ +From 22316f200803225f2d375ae5c36ffead59e2f6b8 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Mon, 5 Dec 2022 15:14:26 +0000 +Subject: [PATCH 4/6] make: Separate TLS targets from libraries + +There are dependencies on TLSOBJS, which fails when `-lmbedtls` is +listed as a dependency, so separate it out. + +Upstream-Status: Pending +Signed-off-by: Alex Kiernan +--- + mDNSPosix/Makefile | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/mDNSPosix/Makefile b/mDNSPosix/Makefile +index 5e74193c0e89..b4313c36b035 100755 +--- a/mDNSPosix/Makefile ++++ b/mDNSPosix/Makefile +@@ -112,9 +112,11 @@ ifeq ($(findstring linux,$(os)),linux) + ifeq ($(tls), no) + CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -ftabstop=4 -Wno-expansion-to-defined + TLSOBJS = ++TLSLIBS = + else + CFLAGS_OS = -D_GNU_SOURCE -DHAVE_IPV6 -DNOT_HAVE_SA_LEN -DUSES_NETLINK -DHAVE_LINUX -DTARGET_OS_LINUX -DPOSIX_HAS_TLS -ftabstop=4 -Wno-expansion-to-defined +-TLSOBJS = $(OBJDIR)/mbedtls.c.o -lmbedtls -lmbedcrypto ++TLSOBJS = $(OBJDIR)/mbedtls.c.o ++TLSLIBS = -lmbedtls -lmbedcrypto + endif + LD = $(CC) + SOOPTS = -shared +@@ -266,7 +268,7 @@ Daemon: setup $(BUILDDIR)/mdnsd + @echo "Responder daemon done" + + $(BUILDDIR)/mdnsd: $(DAEMONOBJS) +- $(CC) -o $@ $+ $(LINKOPTS) ++ $(CC) -o $@ $+ $(LINKOPTS) $(TLSLIBS) + $(STRIP) $@ + + # libdns_sd target builds the client library +@@ -485,16 +487,16 @@ dnsextd: setup $(BUILDDIR)/dnsextd + @echo "dnsextd done" + + $(BUILDDIR)/mDNSClientPosix: $(APPOBJ) $(TLSOBJS) $(OBJDIR)/Client.c.o +- $(CC) $+ -o $@ $(LINKOPTS) ++ $(CC) $+ -o $@ $(LINKOPTS) $(TLSLIBS) + + $(BUILDDIR)/mDNSResponderPosix: $(COMMONOBJ) $(TLSOBJS) $(OBJDIR)/Responder.c.o +- $(CC) $+ -o $@ $(LINKOPTS) ++ $(CC) $+ -o $@ $(LINKOPTS) $(TLSLIBS) + + $(BUILDDIR)/mDNSProxyResponderPosix: $(COMMONOBJ) $(TLSOBJS) $(OBJDIR)/ProxyResponder.c.o +- $(CC) $+ -o $@ $(LINKOPTS) ++ $(CC) $+ -o $@ $(LINKOPTS) $(TLSLIBS) + + $(BUILDDIR)/mDNSNetMonitor: $(SPECIALOBJ) $(TLSOBJS) $(OBJDIR)/NetMonitor.c.o +- $(CC) $+ -o $@ $(LINKOPTS) ++ $(CC) $+ -o $@ $(LINKOPTS) $(TLSLIBS) + + $(OBJDIR)/NetMonitor.c.o: $(COREDIR)/mDNS.c # Note: NetMonitor.c textually imports mDNS.c + +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch new file mode 100644 index 0000000000..1aec34f243 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0005-Use-list-for-changed-interfaces.patch @@ -0,0 +1,169 @@ +From e79f81f5cd626ad77ec64de4325f6645cf253c5e Mon Sep 17 00:00:00 2001 +From: Nate Karstens +Date: Thu, 13 Jul 2017 09:00:00 -0500 +Subject: [PATCH 5/8] Use list for changed interfaces + +Uses a linked list to store the index of changed network interfaces +instead of a bitfield. This allows for network interfaces with an +index greater than 31 (an index of 36 was seen on Android). + +Upstream-Status: Submitted [dts@apple.com] + +Signed-off-by: Nate Karstens +Signed-off-by: Alex Kiernan +--- + mDNSPosix/mDNSPosix.c | 58 ++++++++++++++++++++++++++++++++----------- + 1 file changed, 43 insertions(+), 15 deletions(-) + +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index 02a19b438e03..e20adda92229 100644 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -74,6 +74,14 @@ struct IfChangeRec + }; + typedef struct IfChangeRec IfChangeRec; + ++// Used to build a list of network interface indices ++struct NetworkInterfaceIndex ++{ ++ int if_index; ++ struct NetworkInterfaceIndex *Next; ++}; ++typedef struct NetworkInterfaceIndex NetworkInterfaceIndex; ++ + // Note that static data is initialized to zero in (modern) C. + static PosixEventSource *gEventSources; // linked list of PosixEventSource's + static sigset_t gEventSignalSet; // Signals which event loop listens for +@@ -1621,6 +1629,23 @@ mDNSlocal mStatus OpenIfNotifySocket(int *pFD) + return err; + } + ++mDNSlocal void AddInterfaceIndexToList(GenLinkedList *list, int if_index) ++{ ++ NetworkInterfaceIndex *item; ++ ++ for (item = (NetworkInterfaceIndex*)list->Head; item != NULL; item = item->Next) ++ { ++ if (if_index == item->if_index) return; ++ } ++ ++ item = mdns_malloc(sizeof *item); ++ if (item == NULL) return; ++ ++ item->if_index = if_index; ++ item->Next = NULL; ++ AddToTail(list, item); ++} ++ + #if MDNS_DEBUGMSGS + mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) + { +@@ -1648,14 +1673,13 @@ mDNSlocal void PrintNetLinkMsg(const struct nlmsghdr *pNLMsg) + } + #endif + +-mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) ++mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *changedInterfaces) + // Read through the messages on sd and if any indicate that any interface records should + // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. + { + ssize_t readCount; + char buff[4096]; + struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; +- mDNSu32 result = 0; + + // The structure here is more complex than it really ought to be because, + // unfortunately, there's no good way to size a buffer in advance large +@@ -1691,9 +1715,9 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) + + // Process the NetLink message + if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) +- result |= 1 << ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index; ++ AddInterfaceIndexToList(changedInterfaces, ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index); + else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) +- result |= 1 << ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index; ++ AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); + + // Advance pNLMsg to the next message in the buffer + if ((pNLMsg->nlmsg_flags & NLM_F_MULTI) != 0 && pNLMsg->nlmsg_type != NLMSG_DONE) +@@ -1704,8 +1728,6 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) + else + break; // all done! + } +- +- return result; + } + + #else // USES_NETLINK +@@ -1737,14 +1759,13 @@ mDNSlocal void PrintRoutingSocketMsg(const struct ifa_msghdr *pRSMsg) + } + #endif + +-mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) ++mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *changedInterfaces) + // Read through the messages on sd and if any indicate that any interface records should + // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. + { + ssize_t readCount; + char buff[4096]; + struct ifa_msghdr *pRSMsg = (struct ifa_msghdr*) buff; +- mDNSu32 result = 0; + + readCount = read(sd, buff, sizeof buff); + if (readCount < (ssize_t) sizeof(struct ifa_msghdr)) +@@ -1759,12 +1780,10 @@ mDNSlocal mDNSu32 ProcessRoutingNotification(int sd) + pRSMsg->ifam_type == RTM_IFINFO) + { + if (pRSMsg->ifam_type == RTM_IFINFO) +- result |= 1 << ((struct if_msghdr*) pRSMsg)->ifm_index; ++ AddInterfaceIndexToList(changedInterfaces, ((struct if_msghdr*) pRSMsg)->ifm_index); + else +- result |= 1 << pRSMsg->ifam_index; ++ AddInterfaceIndexToList(changedInterfaces, pRSMsg->ifam_index); + } +- +- return result; + } + + #endif // USES_NETLINK +@@ -1774,7 +1793,8 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) + { + IfChangeRec *pChgRec = (IfChangeRec*) context; + fd_set readFDs; +- mDNSu32 changedInterfaces = 0; ++ GenLinkedList changedInterfaces; ++ NetworkInterfaceIndex *changedInterface; + struct timeval zeroTimeout = { 0, 0 }; + + (void)fd; // Unused +@@ -1782,17 +1802,25 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) + FD_ZERO(&readFDs); + FD_SET(pChgRec->NotifySD, &readFDs); + ++ InitLinkedList(&changedInterfaces, offsetof(NetworkInterfaceIndex, Next)); ++ + do + { +- changedInterfaces |= ProcessRoutingNotification(pChgRec->NotifySD); ++ ProcessRoutingNotification(pChgRec->NotifySD, &changedInterfaces); + } + while (0 < select(pChgRec->NotifySD + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &zeroTimeout)); + + // Currently we rebuild the entire interface list whenever any interface change is + // detected. If this ever proves to be a performance issue in a multi-homed + // configuration, more care should be paid to changedInterfaces. +- if (changedInterfaces) ++ if (changedInterfaces.Head != NULL) + mDNSPlatformPosixRefreshInterfaceList(pChgRec->mDNS); ++ ++ while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) ++ { ++ RemoveFromList(&changedInterfaces, changedInterface); ++ mdns_free(changedInterface); ++ } + } + + // Register with either a Routing Socket or RtNetLink to listen for interface changes. +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch new file mode 100644 index 0000000000..6553f6b983 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0005-mDNSCore-Fix-broken-debug-parameter.patch @@ -0,0 +1,26 @@ +From 60533a8947af714cc593bae6b20d47f3a4828589 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Mon, 5 Dec 2022 22:49:49 +0000 +Subject: [PATCH 5/6] mDNSCore: Fix broken debug parameter + +Signed-off-by: Alex Kiernan +--- + mDNSCore/mDNS.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mDNSCore/mDNS.c b/mDNSCore/mDNS.c +index 66979587ee82..e0a982fa1762 100644 +--- a/mDNSCore/mDNS.c ++++ b/mDNSCore/mDNS.c +@@ -9831,7 +9831,7 @@ mDNSlocal void mDNSCoreReceiveNoUnicastAnswers(mDNS *const m, const DNSMessage * + #else + const DNSServRef dnsserv = qptr->qDNSServer; + #endif +- debugf("mDNSCoreReceiveNoUnicastAnswers making negative cache entry TTL %d for %##s (%s)", negttl, name->c, DNSTypeName(q.qtype)); ++ debugf("mDNSCoreReceiveNoUnicastAnswers making negative cache entry TTL %d for %##s (%s)", negttl, currentQName->c, DNSTypeName(q.qtype)); + // Create a negative record for the current name in the CNAME chain. + MakeNegativeCacheRecord(m, &m->rec.r, currentQName, currentQNameHash, q.qtype, q.qclass, negttl, mDNSInterface_Any, + dnsserv, response->h.flags); +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch new file mode 100644 index 0000000000..882d08e6c6 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0006-Handle-noisy-netlink-sockets.patch @@ -0,0 +1,252 @@ +From bfa1d68bed863e22c40a6d9a19ffbcc8694bbff6 Mon Sep 17 00:00:00 2001 +From: Nate Karstens +Date: Mon, 24 Jul 2017 09:38:55 -0500 +Subject: [PATCH 6/8] Handle noisy netlink sockets + +The POSIX implementation currently clears all network interfaces +when netlink indicates that there has been a change. This causes +the following problems: + + 1) Applications are informed that all of the services they are + tracking have been removed. + 2) Increases network load because the client must re-query for + all records it is interested in. + +This changes netlink notification handling by: + + 1) Always comparing with the latest interface list returned + by the OS. + 2) Confirming that the interface has been changed in a way + that we care about. + +Upstream-Status: Submitted [dts@apple.com] + +Signed-off-by: Nate Karstens +Signed-off-by: Alex Kiernan +--- + mDNSPosix/mDNSPosix.c | 182 +++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 172 insertions(+), 10 deletions(-) + +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index e20adda92229..5d52de31f79b 100644 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -1788,14 +1788,43 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change + + #endif // USES_NETLINK + ++// Test whether the given PosixNetworkInterface matches the given struct ifaddrs ++mDNSlocal mDNSBool InterfacesMatch(PosixNetworkInterface *intf, struct ifaddrs *ifi) ++{ ++ mDNSBool match = mDNSfalse; ++ mDNSAddr ip, mask; ++ unsigned int if_index; ++ ++ if_index = if_nametoindex(ifi->ifa_name); ++ if (if_index == 0) ++ return mDNSfalse; ++ ++ if((intf->index == if_index) && ++ (intf->sa_family == ifi->ifa_addr->sa_family) && ++ (strcmp(intf->coreIntf.ifname, ifi->ifa_name) == 0)) ++ { ++ SockAddrTomDNSAddr(ifi->ifa_addr, &ip, NULL); ++ SockAddrTomDNSAddr(ifi->ifa_netmask, &mask, NULL); ++ ++ match = mDNSSameAddress(&intf->coreIntf.ip, &ip) && ++ mDNSSameAddress(&intf->coreIntf.mask, &mask); ++ } ++ ++ return match; ++} ++ + // Called when data appears on interface change notification socket + mDNSlocal void InterfaceChangeCallback(int fd, void *context) + { + IfChangeRec *pChgRec = (IfChangeRec*) context; ++ mDNS *m = pChgRec->mDNS; + fd_set readFDs; + GenLinkedList changedInterfaces; + NetworkInterfaceIndex *changedInterface; + struct timeval zeroTimeout = { 0, 0 }; ++ struct ifaddrs *ifa_list, **ifi, *ifa_loop4 = NULL; ++ PosixNetworkInterface *intf, *intfNext; ++ mDNSBool found, foundav4; + + (void)fd; // Unused + +@@ -1810,12 +1839,149 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) + } + while (0 < select(pChgRec->NotifySD + 1, &readFDs, (fd_set*) NULL, (fd_set*) NULL, &zeroTimeout)); + +- // Currently we rebuild the entire interface list whenever any interface change is +- // detected. If this ever proves to be a performance issue in a multi-homed +- // configuration, more care should be paid to changedInterfaces. +- if (changedInterfaces.Head != NULL) +- mDNSPlatformPosixRefreshInterfaceList(pChgRec->mDNS); ++ CleanRecentInterfaces(); ++ ++ if (changedInterfaces.Head == NULL) goto cleanup; ++ ++ if (getifaddrs(&ifa_list) < 0) goto cleanup; ++ ++ for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) ++ { ++ intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); ++ ++ // Loopback interface(s) are handled later ++ if (intf->coreIntf.Loopback) continue; ++ ++ found = mDNSfalse; ++ for (ifi = &ifa_list; *ifi != NULL; ifi = &(*ifi)->ifa_next) ++ { ++ if (InterfacesMatch(intf, *ifi)) ++ { ++ found = mDNStrue; ++ break; ++ } ++ } ++ ++ // Removes changed and old interfaces from m->HostInterfaces ++ if (!found) TearDownInterface(m, intf); ++ } ++ ++ // Add new and changed interfaces in ifa_list ++ // Save off loopback interface in case it is needed later ++ for (ifi = &ifa_list; *ifi != NULL; ifi = &(*ifi)->ifa_next) ++ { ++ found = mDNSfalse; ++ for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) ++ { ++ intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); ++ ++ // Loopback interface(s) are handled later ++ if (intf->coreIntf.Loopback) continue; ++ ++ if (InterfacesMatch(intf, *ifi)) ++ { ++ found = mDNStrue; ++ break; ++ } ++ ++ // Removes changed and old interfaces from m->HostInterfaces ++ } ++ if (found) ++ continue; ++ ++ if ((ifa_loop4 == NULL) && ++ ((*ifi)->ifa_addr->sa_family == AF_INET) && ++ ((*ifi)->ifa_flags & IFF_UP) && ++ ((*ifi)->ifa_flags & IFF_LOOPBACK)) ++ { ++ ifa_loop4 = *ifi; ++ continue; ++ } ++ ++ if ( (((*ifi)->ifa_addr->sa_family == AF_INET) ++#if HAVE_IPV6 ++ || ((*ifi)->ifa_addr->sa_family == AF_INET6) ++#endif ++ ) && ((*ifi)->ifa_flags & IFF_UP) ++ && !((*ifi)->ifa_flags & IFF_POINTOPOINT) ++ && !((*ifi)->ifa_flags & IFF_LOOPBACK)) ++ { ++ struct ifaddrs *i = *ifi; ++ ++#define ethernet_addr_len 6 ++ uint8_t hwaddr[ethernet_addr_len]; ++ int hwaddr_len = 0; ++ ++#if defined(TARGET_OS_LINUX) && TARGET_OS_LINUX ++ struct ifreq ifr; ++ int sockfd = socket(AF_INET6, SOCK_DGRAM, 0); ++ if (sockfd >= 0) ++ { ++ /* Add hardware address */ ++ memcpy(ifr.ifr_name, i->ifa_name, IFNAMSIZ); ++ if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) != -1) ++ { ++ if (ifr.ifr_hwaddr.sa_family == ARPHRD_ETHER) ++ { ++ memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, ethernet_addr_len); ++ hwaddr_len = ethernet_addr_len; ++ } ++ } ++ close(sockfd); ++ } ++ else ++ { ++ memset(hwaddr, 0, sizeof(hwaddr)); ++ } ++#endif // TARGET_OS_LINUX ++ SetupOneInterface(m, i->ifa_addr, i->ifa_netmask, ++ hwaddr, hwaddr_len, i->ifa_name, if_nametoindex(i->ifa_name), i->ifa_flags); ++ } ++ } ++ ++ // Determine if there is at least one non-loopback IPv4 interface. This is to work around issues ++ // with multicast loopback on IPv6 interfaces -- see corresponding logic in SetupInterfaceList(). ++ foundav4 = mDNSfalse; ++ for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = (PosixNetworkInterface*)(intf->coreIntf.next)) ++ { ++ if (intf->sa_family == AF_INET && !intf->coreIntf.Loopback) ++ { ++ foundav4 = mDNStrue; ++ break; ++ } ++ } ++ ++ if (foundav4) ++ { ++ for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = intfNext) ++ { ++ intfNext = (PosixNetworkInterface*)(intf->coreIntf.next); ++ if (intf->coreIntf.Loopback) TearDownInterface(m, intf); ++ } ++ } ++ else ++ { ++ found = mDNSfalse; ++ ++ for (intf = (PosixNetworkInterface*)(m->HostInterfaces); intf != NULL; intf = (PosixNetworkInterface*)(intf->coreIntf.next)) ++ { ++ if (intf->coreIntf.Loopback) ++ { ++ found = mDNStrue; ++ break; ++ } ++ } ++ ++ if (!found && (ifa_loop4 != NULL)) ++ { ++ SetupOneInterface(m, ifa_loop4->ifa_addr, ifa_loop4->ifa_netmask, ++ NULL, 0, ifa_loop4->ifa_name, if_nametoindex(ifa_loop4->ifa_name), ifa_loop4->ifa_flags); ++ } ++ } ++ ++ if (ifa_list != NULL) freeifaddrs(ifa_list); + ++cleanup: + while ((changedInterface = (NetworkInterfaceIndex*)changedInterfaces.Head) != NULL) + { + RemoveFromList(&changedInterfaces, changedInterface); +@@ -1947,15 +2113,11 @@ mDNSexport void mDNSPlatformClose(mDNS *const m) + #endif + } + +-// This is used internally by InterfaceChangeCallback. +-// It's also exported so that the Standalone Responder (mDNSResponderPosix) ++// This is exported so that the Standalone Responder (mDNSResponderPosix) + // can call it in response to a SIGHUP (mainly for debugging purposes). + mDNSexport mStatus mDNSPlatformPosixRefreshInterfaceList(mDNS *const m) + { + int err; +- // This is a pretty heavyweight way to process interface changes -- +- // destroying the entire interface list and then making fresh one from scratch. +- // We should make it like the OS X version, which leaves unchanged interfaces alone. + ClearInterfaceList(m); + err = SetupInterfaceList(m); + return PosixErrorToStatus(err); +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch new file mode 100644 index 0000000000..268e574c50 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0006-make-Add-top-level-Makefile.patch @@ -0,0 +1,25 @@ +From fa9ef50ab4c4225cf3ade4bafc38ddf93e6fe127 Mon Sep 17 00:00:00 2001 +From: Alex Kiernan +Date: Tue, 6 Dec 2022 13:28:31 +0000 +Subject: [PATCH 6/6] make: Add top-level Makefile + +Simple top level Makefile that just delegates to mDNSPosix. + +Upstream-Status: Inappropriate [oe-specific] +Signed-off-by: Alex Kiernan +--- + Makefile | 2 ++ + 1 file changed, 2 insertions(+) + create mode 100644 Makefile + +diff --git a/Makefile b/Makefile +new file mode 100644 +index 000000000000..feb6ac67ef47 +--- /dev/null ++++ b/Makefile +@@ -0,0 +1,2 @@ ++all clean: ++ cd mDNSPosix && $(MAKE) $@ +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch new file mode 100644 index 0000000000..e53b0fd3ae --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0007-Mark-deleted-interfaces-as-being-changed.patch @@ -0,0 +1,40 @@ +From a8accffb95267490b50401c8b65ec18db57b5ef5 Mon Sep 17 00:00:00 2001 +From: Nate Karstens +Date: Wed, 9 Aug 2017 09:16:58 -0500 +Subject: [PATCH 7/8] Mark deleted interfaces as being changed + +Netlink notification handling ignores messages for deleted links, +RTM_DELLINK. It does handle RTM_GETLINK. According to libnl docu- +mentation (http://www.infradead.org/~tgr/libnl/doc/route.html) +RTM_DELLINK can be sent by the kernel, but RTM_GETLINK cannot. +There was likely a mixup in the original implementation, so this +change replaces handling for RTM_GETLINK with RTM_DELLINK. + +Testing and Verification Instructions: + 1. Use ip-link to add and remove a VLAN interface and verify + that mDNSResponder handles the deleted link. + +Upstream-Status: Submitted [dts@apple.com] + +Signed-off-by: Nate Karstens +Signed-off-by: Alex Kiernan +--- + mDNSPosix/mDNSPosix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index 5d52de31f79b..77d982f4c50b 100644 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -1714,7 +1714,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change + #endif + + // Process the NetLink message +- if (pNLMsg->nlmsg_type == RTM_GETLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) ++ if (pNLMsg->nlmsg_type == RTM_DELLINK || pNLMsg->nlmsg_type == RTM_NEWLINK) + AddInterfaceIndexToList(changedInterfaces, ((struct ifinfomsg*) NLMSG_DATA(pNLMsg))->ifi_index); + else if (pNLMsg->nlmsg_type == RTM_DELADDR || pNLMsg->nlmsg_type == RTM_NEWADDR) + AddInterfaceIndexToList(changedInterfaces, ((struct ifaddrmsg*) NLMSG_DATA(pNLMsg))->ifa_index); +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch new file mode 100644 index 0000000000..e689f8c267 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/0008-Handle-errors-from-socket-calls.patch @@ -0,0 +1,63 @@ +From ed58146d3aeecdb9920fdc017f85c18b5b10f2db Mon Sep 17 00:00:00 2001 +From: Nate Karstens +Date: Thu, 10 Aug 2017 08:27:32 -0500 +Subject: [PATCH 8/8] Handle errors from socket calls + +Adds handling for socket() or read() returning a +negative value (indicating an error has occurred). + +Upstream-Status: Submitted [dts@apple.com] + +Signed-off-by: Nate Karstens +Signed-off-by: Alex Kiernan +--- + mDNSPosix/mDNSPosix.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c +index 77d982f4c50b..cab512160afb 100644 +--- a/mDNSPosix/mDNSPosix.c ++++ b/mDNSPosix/mDNSPosix.c +@@ -1677,7 +1677,7 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change + // Read through the messages on sd and if any indicate that any interface records should + // be torn down and rebuilt, return affected indices as a bitmask. Otherwise return 0. + { +- ssize_t readCount; ++ ssize_t readVal, readCount; + char buff[4096]; + struct nlmsghdr *pNLMsg = (struct nlmsghdr*) buff; + +@@ -1686,7 +1686,10 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change + // enough to hold all pending data and so avoid message fragmentation. + // (Note that FIONREAD is not supported on AF_NETLINK.) + +- readCount = read(sd, buff, sizeof buff); ++ readVal = read(sd, buff, sizeof buff); ++ if (readVal < 0) return; ++ readCount = readVal; ++ + while (1) + { + // Make sure we've got an entire nlmsghdr in the buffer, and payload, too. +@@ -1702,7 +1705,9 @@ mDNSlocal void ProcessRoutingNotification(int sd, GenLinkedList *change + pNLMsg = (struct nlmsghdr*) buff; + + // read more data +- readCount += read(sd, buff + readCount, sizeof buff - readCount); ++ readVal = read(sd, buff + readCount, sizeof buff - readCount); ++ if (readVal < 0) return; ++ readCount += readVal; + continue; // spin around and revalidate with new readCount + } + else +@@ -2017,6 +2022,7 @@ mDNSlocal mDNSBool mDNSPlatformInit_CanReceiveUnicast(void) + int err; + int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + struct sockaddr_in s5353; ++ if (s < 0) return mDNSfalse; + s5353.sin_family = AF_INET; + s5353.sin_port = MulticastDNSPort.NotAnInteger; + s5353.sin_addr.s_addr = 0; +-- +2.35.1 + diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/mdns.service b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/mdns.service new file mode 100644 index 0000000000..531d142dcd --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns/mdns.service @@ -0,0 +1,15 @@ +[Unit] +Description=Zero-configuration networking +After=network.target + +[Service] +Type=forking +ExecStartPre=/bin/rm -f /var/run/mdnsd.pid +ExecStart=/usr/sbin/mdnsd +ExecReload=/bin/kill -HUP $MAINPID +PIDFile=/var/run/mdnsd.pid +Restart=always +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_1310.140.1.bb b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_1310.140.1.bb deleted file mode 100644 index 205dc929be..0000000000 --- a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_1310.140.1.bb +++ /dev/null @@ -1,115 +0,0 @@ -SUMMARY = "Publishes & browses available services on a link according to the Zeroconf / Bonjour protocol" -DESCRIPTION = "Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks." -HOMEPAGE = "http://developer.apple.com/networking/bonjour/" -LICENSE = "Apache-2.0 & BSD-3-Clause" -LIC_FILES_CHKSUM = "file://../LICENSE;md5=31c50371921e0fb731003bbc665f29bf" - -DEPENDS:append:libc-musl = " musl-nscd" - -RPROVIDES:${PN} += "libdns_sd.so" - -SRC_URI = "https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-${PV}.tar.gz \ - file://mdns.service \ - file://0001-mdns-include-stddef.h-for-NULL.patch;patchdir=.. \ - file://0002-mdns-cross-compilation-fixes-for-bitbake.patch;patchdir=.. \ - file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch;patchdir=.. \ - file://0002-Create-subroutine-for-tearing-down-an-interface.patch;patchdir=.. \ - file://0003-Track-interface-socket-family.patch;patchdir=.. \ - file://0004-Use-list-for-changed-interfaces.patch;patchdir=.. \ - file://0006-Remove-unneeded-function.patch;patchdir=.. \ - file://0008-Mark-deleted-interfaces-as-being-changed.patch;patchdir=.. \ - file://0009-Fix-possible-NULL-dereference.patch;patchdir=.. \ - file://0010-Handle-errors-from-socket-calls.patch;patchdir=.. \ - file://0011-Change-a-dynamic-allocation-to-file-scope-variable.patch;patchdir=.. \ - file://0001-dns-sd-Include-missing-headers.patch;patchdir=.. \ - " -SRC_URI[sha256sum] = "040f6495c18b9f0557bcf9e00cbcfc82b03405f5ba6963dc147730ca0ca90d6f" - -CVE_PRODUCT = "apple:mdnsresponder" - -# CVE-2007-0613 is not applicable as it only affects Apple products -# i.e. ichat,mdnsresponder, instant message framework and MacOS. -# Also, https://www.exploit-db.com/exploits/3230 shows the part of code -# affected by CVE-2007-0613 which is not preset in upstream source code. -# Hence, CVE-2007-0613 does not affect other Yocto implementations and -# is not reported for other distros can be marked whitelisted. -# Links: -# https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 -# https://www.incibe-cert.es/en/early-warning/vulnerabilities/cve-2007-0613 -# https://security-tracker.debian.org/tracker/CVE-2007-0613 -# https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 -CVE_CHECK_IGNORE += "CVE-2007-0613" - -PARALLEL_MAKE = "" - -S = "${WORKDIR}/mDNSResponder-${PV}/mDNSPosix" - -EXTRA_OEMAKE += "os=linux DEBUG=0 'CC=${CC}' 'LD=${CCLD} ${LDFLAGS}'" - -TARGET_CC_ARCH += "${LDFLAGS}" - -do_install () { - install -d ${D}${sbindir} - install -m 0755 build/prod/mdnsd ${D}${sbindir} - - install -d ${D}${libdir} - cp build/prod/libdns_sd.so ${D}${libdir}/libdns_sd.so.1 - chmod 0644 ${D}${libdir}/libdns_sd.so.1 - ln -s libdns_sd.so.1 ${D}${libdir}/libdns_sd.so - - install -d ${D}${includedir} - install -m 0644 ../mDNSShared/dns_sd.h ${D}${includedir} - - install -d ${D}${mandir}/man8 - install -m 0644 ../mDNSShared/mDNSResponder.8 ${D}${mandir}/man8/mdnsd.8 - - install -d ${D}${bindir} - install -m 0755 ../Clients/build/dns-sd ${D}${bindir} - - install -d ${D}${libdir} - oe_libinstall -C build/prod -so libnss_mdns-0.2 ${D}${libdir} - ln -s libnss_mdns-0.2.so ${D}${libdir}/libnss_mdns.so.2 - - install -d ${D}${sysconfdir} - install -m 0644 nss_mdns.conf ${D}${sysconfdir} - - install -d ${D}${mandir}/man5 - install -m 0644 nss_mdns.conf.5 ${D}${mandir}/man5 - - install -d ${D}${mandir}/man8 - install -m 0644 libnss_mdns.8 ${D}${mandir}/man8 - - install -d ${D}${systemd_unitdir}/system/ - install -m 0644 ${WORKDIR}/mdns.service ${D}${systemd_unitdir}/system/ -} - -pkg_postinst:${PN} () { - sed -e '/^hosts:/s/\s*\//' \ - -e 's/\(^hosts:.*\)\(\\)\(.*\)\(\\)\(.*\)/\1\2 mdns\3\4\5/' \ - -i $D/etc/nsswitch.conf -} - -pkg_prerm:${PN} () { - sed -e '/^hosts:/s/\s*\//' \ - -e '/^hosts:/s/\s*mdns//' \ - -i $D/etc/nsswitch.conf -} - -inherit systemd - -SYSTEMD_SERVICE:${PN} = "mdns.service" - -FILES:${PN} += "${systemd_unitdir}/system/mdns.service" -FILES:${PN} += "${libdir}/libdns_sd.so.1 \ - ${bindir}/dns-sd \ - ${libdir}/libnss_mdns-0.2.so \ - ${sysconfdir}/nss_mdns.conf" - -FILES:${PN}-dev += "${libdir}/libdns_sd.so \ - ${includedir}/dns_sd.h " - -FILES:${PN}-man += "${mandir}/man8/mdnsd.8 \ - ${mandir}/man5/nss_mdns.conf.5 \ - ${mandir}/man8/libnss_mdns.8" - -PACKAGES = "${PN} ${PN}-dev ${PN}-man ${PN}-dbg" diff --git a/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_1790.60.25.bb b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_1790.60.25.bb new file mode 100644 index 0000000000..96eb4e50c7 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-protocols/mdns/mdns_1790.60.25.bb @@ -0,0 +1,134 @@ +SUMMARY = "Publishes & browses available services on a link according to the Zeroconf / Bonjour protocol" +DESCRIPTION = "Bonjour, also known as zero-configuration networking, enables automatic discovery of computers, devices, and services on IP networks." +HOMEPAGE = "http://developer.apple.com/networking/bonjour/" +LICENSE = "Apache-2.0 & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=31c50371921e0fb731003bbc665f29bf" + +DEPENDS:append:libc-musl = " musl-nscd" + +SRC_URI = "git://github.com/apple-oss-distributions/mDNSResponder;protocol=https;branch=rel/mDNSResponder-1790 \ + file://0001-dns-sd-Include-missing-headers.patch \ + file://0002-make-Set-libdns_sd.so-soname-correctly.patch \ + file://0003-mDNSShared-Drop-MacOS-specific-__block-qualifier.patch \ + file://0004-make-Separate-TLS-targets-from-libraries.patch \ + file://0005-mDNSCore-Fix-broken-debug-parameter.patch \ + file://0006-make-Add-top-level-Makefile.patch \ + file://0001-Create-subroutine-for-cleaning-recent-interfaces.patch \ + file://0002-Create-subroutine-for-tearing-down-an-interface.patch \ + file://0003-Track-interface-socket-family.patch \ + file://0004-Indicate-loopback-interface-to-mDNS-core.patch \ + file://0005-Use-list-for-changed-interfaces.patch \ + file://0006-Handle-noisy-netlink-sockets.patch \ + file://0007-Mark-deleted-interfaces-as-being-changed.patch \ + file://0008-Handle-errors-from-socket-calls.patch \ + file://mdns.service \ + " +SRCREV = "e48e3a58b763a0d7b76a14f7f309e24d7502e796" + +# We install a stub Makefile in the top directory so that the various checks +# in base.bbclass pass their tests for a Makefile, this ensures (that amongst +# other things) the sstate checks will clean the build directory when the +# task hashes changes. +# +# We can't use the approach of setting ${S} to mDNSPosix as we need +# DEBUG_PREFIX_MAP to cover files which come from the Clients directory too. +S = "${WORKDIR}/git" + +inherit github-releases manpages systemd update-rc.d + +PACKAGECONFIG ?= "tls \ + ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" +PACKAGECONFIG[debug] = "DEBUG=1,DEBUG=0" +PACKAGECONFIG[ipv6] = "HAVE_IPV6=1,HAVE_IPV6=0" +PACKAGECONFIG[manpages] = "" +PACKAGECONFIG[tls] = ",tls=no,mbedtls" + +CVE_PRODUCT = "apple:mdnsresponder" + +# CVE-2007-0613 is not applicable as it only affects Apple products +# i.e. ichat,mdnsresponder, instant message framework and MacOS. +# Also, https://www.exploit-db.com/exploits/3230 shows the part of code +# affected by CVE-2007-0613 which is not preset in upstream source code. +# Hence, CVE-2007-0613 does not affect other Yocto implementations and +# is not reported for other distros can be marked whitelisted. +# Links: +# https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 +# https://www.incibe-cert.es/en/early-warning/vulnerabilities/cve-2007-0613 +# https://security-tracker.debian.org/tracker/CVE-2007-0613 +# https://vulmon.com/vulnerabilitydetails?qid=CVE-2007-0613 +CVE_CHECK_IGNORE += "CVE-2007-0613" + +PARALLEL_MAKE = "" + +EXTRA_OEMAKE = "os=linux 'CC=${CCLD}' 'LD=${CCLD}' 'LINKOPTS=${LDFLAGS}' STRIP=: ${PACKAGECONFIG_CONFARGS}" + +# MDNS_VERSIONSTR_NODTS disables __DATE__ and __TIME__ in the version string, +# which are fixed anyway for build reproducibility. +TARGET_CPPFLAGS += "-DMDNS_VERSIONSTR_NODTS" + +TARGET_CC_ARCH += "${LDFLAGS}" + +MDNS_BUILDDIR = "build/${@bb.utils.contains('PACKAGECONFIG','debug','debug','prod', d)}" + +do_install () { + cd mDNSPosix + + install -d ${D}${sbindir} + install ${MDNS_BUILDDIR}/mdnsd ${D}${sbindir} + + install -d ${D}${libdir} + install -m 0644 ${MDNS_BUILDDIR}/libdns_sd.so ${D}${libdir}/libdns_sd.so.1 + ln -s libdns_sd.so.1 ${D}${libdir}/libdns_sd.so + + install -d ${D}${includedir} + install -m 0644 ../mDNSShared/dns_sd.h ${D}${includedir} + + install -d ${D}${mandir}/man8 + install -m 0644 ../mDNSShared/mDNSResponder.8 ${D}${mandir}/man8/mdnsd.8 + + install -d ${D}${bindir} + install -m 0755 ../Clients/build/dns-sd ${D}${bindir} + + install -d ${D}${libdir} + oe_libinstall -C ${MDNS_BUILDDIR} -so libnss_mdns-0.2 ${D}${libdir} + ln -s libnss_mdns-0.2.so ${D}${libdir}/libnss_mdns.so.2 + + install -d ${D}${sysconfdir} + install -m 0644 nss_mdns.conf ${D}${sysconfdir} + + install -d ${D}${mandir}/man5 + install -m 0644 nss_mdns.conf.5 ${D}${mandir}/man5 + + install -d ${D}${mandir}/man8 + install -m 0644 libnss_mdns.8 ${D}${mandir}/man8 + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/mdns.service ${D}${systemd_system_unitdir} + + install -d ${D}${INIT_D_DIR} + install mdnsd.sh ${D}${INIT_D_DIR}/mdns +} + +pkg_postinst:${PN} () { + if [ -r $D${sysconfdir}/nsswitch.conf ]; then + sed -e '/^hosts:/s/\s*\//' \ + -e 's/\(^hosts:.*\)\(\\)\(.*\)\(\\)\(.*\)/\1\2 mdns\3\4\5/' \ + -i $D${sysconfdir}/nsswitch.conf + fi +} + +pkg_prerm:${PN} () { + if [ -r $D${sysconfdir}/nsswitch.conf ]; then + sed -e '/^hosts:/s/\s*\//' \ + -e '/^hosts:/s/\s*mdns//' \ + -i $D${sysconfdir}/nsswitch.conf + fi +} + +SYSTEMD_SERVICE:${PN} = "mdns.service" +INITSCRIPT_NAME = "mdns" + +FILES_SOLIBSDEV = "${libdir}/libdns_sd.so" +FILES:${PN} += "${libdir}/libnss_mdns-0.2.so" + +RPROVIDES:${PN} += "libdns_sd.so" diff --git a/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.3.bb b/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.3.bb index d0e2c4b540..420cc78ca4 100644 --- a/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.3.bb +++ b/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.3.bb @@ -53,14 +53,6 @@ USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', ' USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}" # Configuration options: -# - For command line editing support in chronyc, you may specify either -# 'editline' or 'readline' but not both. editline is smaller, but -# many systems already have readline for other purposes so you might want -# to choose that instead. However, beware license incompatibility -# since chrony is GPLv2 and readline versions after 6.0 are GPLv3+. -# You can of course choose neither, but if you're that tight on space -# consider dropping chronyc entirely (you can use it remotely with -# appropriate chrony.conf options). # - Security-related: # - 'sechash' is omitted by default because it pulls in nss which is huge. # - 'privdrop' allows chronyd to run as non-root; would need changes to @@ -70,14 +62,11 @@ USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--sys PACKAGECONFIG ??= "editline \ ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ " -PACKAGECONFIG[readline] = "--without-editline,--disable-readline,readline" PACKAGECONFIG[editline] = ",--without-editline,libedit" PACKAGECONFIG[sechash] = "--without-tomcrypt,--disable-sechash,nss" -PACKAGECONFIG[privdrop] = "--with-libcap,--disable-privdrop --without-libcap,libcap" +PACKAGECONFIG[privdrop] = ",--disable-privdrop,libcap" PACKAGECONFIG[scfilter] = "--enable-scfilter,--without-seccomp,libseccomp" PACKAGECONFIG[ipv6] = ",--disable-ipv6," -PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss" -PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap" # --disable-static isn't supported by chrony's configure script. DISABLE_STATIC = "" diff --git a/meta-openembedded/meta-networking/recipes-support/dnsmasq/dnsmasq_2.87.bb b/meta-openembedded/meta-networking/recipes-support/dnsmasq/dnsmasq_2.87.bb deleted file mode 100644 index 793b61d712..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/dnsmasq/dnsmasq_2.87.bb +++ /dev/null @@ -1,7 +0,0 @@ -require dnsmasq.inc - -SRC_URI[dnsmasq-2.87.sha256sum] = "ae39bffde9c37e4d64849b528afeb060be6bad6d1044a3bd94a49fce41357284" -SRC_URI += "\ - file://lua.patch \ -" - diff --git a/meta-openembedded/meta-networking/recipes-support/dnsmasq/dnsmasq_2.88.bb b/meta-openembedded/meta-networking/recipes-support/dnsmasq/dnsmasq_2.88.bb new file mode 100644 index 0000000000..52ee9aa96e --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/dnsmasq/dnsmasq_2.88.bb @@ -0,0 +1,7 @@ +require dnsmasq.inc + +SRC_URI[dnsmasq-2.88.sha256sum] = "da9d26aa3f3fc15f3b58b94edbb9ddf744cbce487194ea480bd8e7381b3ca028" +SRC_URI += "\ + file://lua.patch \ +" + diff --git a/meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils/0001-replace-off64_t-with-off_t.patch b/meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils/0001-replace-off64_t-with-off_t.patch new file mode 100644 index 0000000000..2841d0feaf --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils/0001-replace-off64_t-with-off_t.patch @@ -0,0 +1,48 @@ +From 5adae6737e919d957a08df437951ccb6996f9882 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 21 Dec 2022 19:16:03 -0800 +Subject: [PATCH 1/2] replace off64_t with off_t + +off_t is already 64-bits when _FILE_OFFSET_BITS=64 +using off_t also makes it portable on musl systems + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + user/v9/drbdadm_main.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/user/v9/drbdadm_main.c b/user/v9/drbdadm_main.c +index 91e9507d..2030946c 100644 +--- a/user/v9/drbdadm_main.c ++++ b/user/v9/drbdadm_main.c +@@ -1264,11 +1264,11 @@ static int adm_resource(const struct cfg_ctx *ctx) + return ex; + } + +-static off64_t read_drbd_dev_size(int minor) ++static off_t read_drbd_dev_size(int minor) + { + char *path; + FILE *file; +- off64_t val; ++ off_t val; + int r; + + m_asprintf(&path, "/sys/block/drbd%d/size", minor); +@@ -1289,9 +1289,9 @@ int adm_resize(const struct cfg_ctx *ctx) + char *argv[MAX_ARGS]; + struct d_option *opt; + bool is_resize = !strcmp(ctx->cmd->name, "resize"); +- off64_t old_size = -1; +- off64_t target_size = 0; +- off64_t new_size; ++ off_t old_size = -1; ++ off_t target_size = 0; ++ off_t new_size; + int argc = 0; + int silent; + int ex; +-- +2.39.0 + diff --git a/meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils/0002-drbdadm-drop-use-of-GLOB_MAGCHAR-use-strchr-heuristi.patch b/meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils/0002-drbdadm-drop-use-of-GLOB_MAGCHAR-use-strchr-heuristi.patch new file mode 100644 index 0000000000..45f7d6d415 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/drbd/drbd-utils/0002-drbdadm-drop-use-of-GLOB_MAGCHAR-use-strchr-heuristi.patch @@ -0,0 +1,96 @@ +From b70e5bf5bfa5fa2c2fffe08bcf300da1d3583602 Mon Sep 17 00:00:00 2001 +From: Lars Ellenberg +Date: Wed, 9 Nov 2022 11:01:54 +0100 +Subject: [PATCH 2/2] drbdadm: drop use of GLOB_MAGCHAR, use strchr heuristic only + +Fixup for +2022-09-05 4a1b5900 drbdadm: allow files from an expanded include glob to vanish + +When using the `include` statement, if the glob did not match any file, +there is nothing to do, silently ignore. Unless it was no glob, but a literal, +which we would expect to exist. + +Also, there is a race between expanding a glob and accessing the file. +That also should not happen for literals, though. + +Since we still had the heuristic anyways, because apparently |GLOB_MAGCHAR +does not happen for GLOB_NOMATCH returns, and there exist non-GNU libc that +don't (and likely won't) implement that extension, just forget about +(gl_flags & GLOB_MAGCHAR) but use the incomplete strchr heuristic only. + +Sourced From Alpine: https://git.alpinelinux.org/aports/tree/main/drbd-utils/drop_use_of_GLOB_MAGCHAR.patch + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + user/v9/drbdadm_parser.c | 35 ++++++++++++++++++++--------------- + 1 file changed, 20 insertions(+), 15 deletions(-) + +diff --git a/user/v9/drbdadm_parser.c b/user/v9/drbdadm_parser.c +index b2f6ed8a..9a0a775d 100644 +--- a/user/v9/drbdadm_parser.c ++++ b/user/v9/drbdadm_parser.c +@@ -1947,14 +1947,29 @@ void include_stmt(char *str) + size_t i; + int r; + +- cwd = pushd_to_current_config_file_unless_stdin(); +- +- /* """ ++ /* ++ * If the glob did not match any file, ++ * there is nothing to do, silently ignore. ++ * Unless it was no glob, but a literal, ++ * which we would expect to exist. ++ * ++ * """ + * As a GNU extension, pglob->gl_flags is set to the + * flags specified, ored with GLOB_MAGCHAR if any + * metacharacters were found. + * """ ++ * ++ * But apparently |GLOB_MAGCHAR does not happen for GLOB_NOMATCH returns, ++ * at least not consistently :-( ++ * Also, there exist non-GNU libc ++ * So we have this incomplete strchr heuristic anyways. + */ ++ bool contains_glob_magic_char = ++ strchr(str, '*') || ++ strchr(str, '?') || ++ strchr(str, '['); ++ ++ cwd = pushd_to_current_config_file_unless_stdin(); + r = glob(str, 0, NULL, &glob_buf); + if (r == 0) { + for (i=0; i -Date: Wed, 24 Nov 2021 13:33:35 +0800 -Subject: [PATCH] Fix pyext_PATTERN for cross compilation - -The pyext_PATTERN will add native arch as suffix when cross compiling. -For example, on qemuarm64, it is expanded to: -pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' -which will result in the incorrect library name. - -root@qemuarm64:~# find /usr/lib -name \*talloc\* -/usr/lib/pkgconfig/talloc.pc -/usr/lib/pkgconfig/pytalloc-util.cpython-310-x86_64-linux-gnu.pc -/usr/lib/libpytalloc-util.cpython-310-x86-64-linux-gnu.so.2.3.3 -/usr/lib/libtalloc.so.2 -/usr/lib/libpytalloc-util.cpython-310-x86-64-linux-gnu.so.2 -/usr/lib/libpytalloc-util.cpython-310-x86-64-linux-gnu.so -/usr/lib/libtalloc.so -/usr/lib/libtalloc.so.2.3.3 -/usr/lib/python3.10/site-packages/talloc.cpython-310-x86_64-linux-gnu.so - -Set pyext_PATTERN to '%s.so' to remove the suffix. -After the patch: -root@qemuarm64:~# find /usr/lib -name \*talloc\* -/usr/lib/pkgconfig/talloc.pc -/usr/lib/pkgconfig/pytalloc-util.pc -/usr/lib/libpytalloc-util.so.2.3.3 -/usr/lib/libtalloc.so.2 -/usr/lib/libpytalloc-util.so.2 -/usr/lib/libpytalloc-util.so -/usr/lib/libtalloc.so -/usr/lib/libtalloc.so.2.3.3 -/usr/lib/python3.10/site-packages/talloc.so - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Yi Zhao ---- - third_party/waf/waflib/Tools/python.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py -index b1c8dd0..24faa31 100644 ---- a/third_party/waf/waflib/Tools/python.py -+++ b/third_party/waf/waflib/Tools/python.py -@@ -328,7 +328,7 @@ def check_python_headers(conf, features='pyembed pyext'): - x = 'MACOSX_DEPLOYMENT_TARGET' - if dct[x]: - env[x] = conf.environ[x] = dct[x] -- env.pyext_PATTERN = '%s' + dct['SO'] # not a mistake -+ env.pyext_PATTERN = '%s.so' - - - # Try to get pythonX.Y-config --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0001-talloc-Add-configure-options-for-packages.patch b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0001-talloc-Add-configure-options-for-packages.patch new file mode 100644 index 0000000000..026a348992 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0001-talloc-Add-configure-options-for-packages.patch @@ -0,0 +1,172 @@ +From 888bfe48236b4ce382dc3aa49791cadb70a1fbe4 Mon Sep 17 00:00:00 2001 +From: Wang Mingyu +Date: Fri, 25 Dec 2020 14:14:08 +0900 +Subject: [PATCH] talloc: Add configure options for packages + +Add configure options for the following packages: + - acl + - attr + - libaio + - libbsd + - libcap + - valgrind + +Upstream-Status: Inappropriate [oe deterministic build specific] + +Signed-off-by: Jackie Huang + +Modified to apply to version 2.1.10. + +Signed-off-by: Joe Slater + +Modified tp apply to version 2.2.0 +Signed-off-by: Changqing Li +--- + lib/replace/wscript | 89 +++++++++++++++++++++++++++++++++++---------- + wscript | 7 +++- + 2 files changed, 75 insertions(+), 21 deletions(-) + +diff --git a/lib/replace/wscript b/lib/replace/wscript +index 827d74f..0348715 100644 +--- a/lib/replace/wscript ++++ b/lib/replace/wscript +@@ -25,6 +25,41 @@ def options(opt): + opt.PRIVATE_EXTENSION_DEFAULT('') + opt.RECURSE('buildtools/wafsamba') + ++ opt.add_option('--with-acl', ++ help=("Enable use of acl"), ++ action="store_true", dest='enable_acl') ++ opt.add_option('--without-acl', ++ help=("Disable use of acl"), ++ action="store_false", dest='enable_acl', default=False) ++ ++ opt.add_option('--with-attr', ++ help=("Enable use of attr"), ++ action="store_true", dest='enable_attr') ++ opt.add_option('--without-attr', ++ help=("Disable use of attr"), ++ action="store_false", dest='enable_attr', default=False) ++ ++ opt.add_option('--with-libaio', ++ help=("Enable use of libaio"), ++ action="store_true", dest='enable_libaio') ++ opt.add_option('--without-libaio', ++ help=("Disable use of libaio"), ++ action="store_false", dest='enable_libaio', default=False) ++ ++ opt.add_option('--with-libbsd', ++ help=("Enable use of libbsd"), ++ action="store_true", dest='enable_libbsd') ++ opt.add_option('--without-libbsd', ++ help=("Disable use of libbsd"), ++ action="store_false", dest='enable_libbsd', default=False) ++ ++ opt.add_option('--with-libcap', ++ help=("Enable use of libcap"), ++ action="store_true", dest='enable_libcap') ++ opt.add_option('--without-libcap', ++ help=("Disable use of libcap"), ++ action="store_false", dest='enable_libcap', default=False) ++ + @Utils.run_once + def configure(conf): + conf.RECURSE('buildtools/wafsamba') +@@ -35,12 +70,25 @@ def configure(conf): + conf.DEFINE('HAVE_LIBREPLACE', 1) + conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) + +- conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h') +- conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h') ++ conf.CHECK_HEADERS('linux/types.h crypt.h locale.h compat.h') ++ conf.CHECK_HEADERS('attr/xattr.h compat.h ctype.h dustat.h') + conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h') + conf.CHECK_HEADERS('locale.h ndir.h pwd.h') +- conf.CHECK_HEADERS('shadow.h sys/acl.h') +- conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h') ++ conf.CHECK_HEADERS('shadow.h') ++ conf.CHECK_HEADERS('sys/attributes.h sys/dir.h sys/epoll.h') ++ ++ if Options.options.enable_acl: ++ conf.CHECK_HEADERS('acl/libacl.h sys/acl.h') ++ ++ if Options.options.enable_attr: ++ conf.CHECK_HEADERS('attr/attributes.h attr/xattr.h') ++ ++ if Options.options.enable_libaio: ++ conf.CHECK_HEADERS('libaio.h') ++ ++ if Options.options.enable_libcap: ++ conf.CHECK_HEADERS('sys/capability.h') ++ + conf.CHECK_HEADERS('port.h') + conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h') + conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') +@@ -110,8 +158,9 @@ def configure(conf): + conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h') + conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h') + +- conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') +- conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') ++ if Options.options.enable_valgrind: ++ conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') ++ conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') + conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h') + conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h') + conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') +@@ -431,20 +480,20 @@ def configure(conf): + + strlcpy_in_bsd = False + +- # libbsd on some platforms provides strlcpy and strlcat +- if not conf.CHECK_FUNCS('strlcpy strlcat'): +- if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', +- checklibc=True): +- strlcpy_in_bsd = True +- if not conf.CHECK_FUNCS('getpeereid'): +- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') +- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): +- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') +- if not conf.CHECK_FUNCS('setproctitle_init'): +- conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') +- +- if not conf.CHECK_FUNCS('closefrom'): +- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') ++ if Options.options.enable_libbsd: ++ # libbsd on some platforms provides strlcpy and strlcat ++ if not conf.CHECK_FUNCS('strlcpy strlcat'): ++ if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', ++ checklibc=True): ++ strlcpy_in_bsd = True ++ if not conf.CHECK_FUNCS('getpeereid'): ++ conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') ++ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): ++ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') ++ if not conf.CHECK_FUNCS('setproctitle_init'): ++ conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') ++ if not conf.CHECK_FUNCS('closefrom'): ++ conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') + + conf.CHECK_CODE(''' + struct ucred cred; +diff --git a/wscript b/wscript +index 3089663..fdf9510 100644 +--- a/wscript ++++ b/wscript +@@ -31,7 +31,12 @@ def options(opt): + opt.add_option('--enable-talloc-compat1', + help=("Build talloc 1.x.x compat library [False]"), + action="store_true", dest='TALLOC_COMPAT1', default=False) +- ++ opt.add_option('--with-valgrind', ++ help=("enable use of valgrind"), ++ action="store_true", dest='enable_valgrind') ++ opt.add_option('--without-valgrind', ++ help=("disable use of valgrind"), ++ action="store_false", dest='enable_valgrind', default=False) + + def configure(conf): + conf.RECURSE('lib/replace') +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0002-Fix-pyext_PATTERN-for-cross-compilation.patch b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0002-Fix-pyext_PATTERN-for-cross-compilation.patch new file mode 100644 index 0000000000..058ac34f81 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/0002-Fix-pyext_PATTERN-for-cross-compilation.patch @@ -0,0 +1,57 @@ +From 6580e8191c219909d50c991662310e668973722d Mon Sep 17 00:00:00 2001 +From: Yi Zhao +Date: Wed, 24 Nov 2021 13:33:35 +0800 +Subject: [PATCH] Fix pyext_PATTERN for cross compilation + +The pyext_PATTERN will add native arch as suffix when cross compiling. +For example, on qemuarm64, it is expanded to: +pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' +which will result in the incorrect library name. + +root@qemuarm64:~# find /usr/lib -name \*talloc\* +/usr/lib/pkgconfig/talloc.pc +/usr/lib/pkgconfig/pytalloc-util.cpython-310-x86_64-linux-gnu.pc +/usr/lib/libpytalloc-util.cpython-310-x86-64-linux-gnu.so.2.3.3 +/usr/lib/libtalloc.so.2 +/usr/lib/libpytalloc-util.cpython-310-x86-64-linux-gnu.so.2 +/usr/lib/libpytalloc-util.cpython-310-x86-64-linux-gnu.so +/usr/lib/libtalloc.so +/usr/lib/libtalloc.so.2.3.3 +/usr/lib/python3.10/site-packages/talloc.cpython-310-x86_64-linux-gnu.so + +Set pyext_PATTERN to '%s.so' to remove the suffix. +After the patch: +root@qemuarm64:~# find /usr/lib -name \*talloc\* +/usr/lib/pkgconfig/talloc.pc +/usr/lib/pkgconfig/pytalloc-util.pc +/usr/lib/libpytalloc-util.so.2.3.3 +/usr/lib/libtalloc.so.2 +/usr/lib/libpytalloc-util.so.2 +/usr/lib/libpytalloc-util.so +/usr/lib/libtalloc.so +/usr/lib/libtalloc.so.2.3.3 +/usr/lib/python3.10/site-packages/talloc.so + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Yi Zhao +--- + third_party/waf/waflib/Tools/python.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py +index a23bd01..af202e0 100644 +--- a/third_party/waf/waflib/Tools/python.py ++++ b/third_party/waf/waflib/Tools/python.py +@@ -328,7 +328,7 @@ def check_python_headers(conf, features='pyembed pyext'): + x = 'MACOSX_DEPLOYMENT_TARGET' + if dct[x]: + env[x] = conf.environ[x] = str(dct[x]) +- env.pyext_PATTERN = '%s' + (dct['EXT_SUFFIX'] or dct['SO']) # SO is deprecated in 3.5 and removed in 3.11 ++ env.pyext_PATTERN = '%s.so' + + + # Try to get pythonX.Y-config +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/avoid-attr-unless-wanted.patch b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/avoid-attr-unless-wanted.patch index 5b7f69ec07..3c85a8a2d4 100644 --- a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/avoid-attr-unless-wanted.patch +++ b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/avoid-attr-unless-wanted.patch @@ -1,6 +1,17 @@ +From e18370c204056de799064d8ac72a656eb3745f95 Mon Sep 17 00:00:00 2001 +From: Wang Mingyu +Date: Fri, 25 Dec 2020 15:10:58 +0900 +Subject: [PATCH] avoid attr unless wanted + +--- + lib/replace/wscript | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/lib/replace/wscript b/lib/replace/wscript +index 0348715..a8554d9 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript -@@ -947,8 +947,6 @@ def build(bld): +@@ -967,8 +967,6 @@ def build(bld): if not bld.CONFIG_SET('HAVE_INET_ATON'): REPLACE_SOURCE += ' inet_aton.c' if not bld.CONFIG_SET('HAVE_INET_NTOP'): REPLACE_SOURCE += ' inet_ntop.c' if not bld.CONFIG_SET('HAVE_INET_PTON'): REPLACE_SOURCE += ' inet_pton.c' @@ -9,13 +20,15 @@ if not bld.CONFIG_SET('HAVE_CLOSEFROM'): REPLACE_SOURCE += ' closefrom.c' -@@ -962,7 +960,7 @@ def build(bld): - # at the moment: +@@ -983,7 +981,7 @@ def build(bld): # hide_symbols=bld.BUILTIN_LIBRARY('replace'), private_library=True, + provide_builtin_linking=True, - deps='dl attr' + extra_libs) + deps='dl' + extra_libs) replace_test_cflags = '' if bld.CONFIG_SET('HAVE_WNO_FORMAT_TRUNCATION'): +-- +2.25.1 diff --git a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/options-2.2.0.patch b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/options-2.2.0.patch deleted file mode 100644 index 46fef1096b..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc/options-2.2.0.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 8a82056ba2f70137714f225d82993aa4b11042da Mon Sep 17 00:00:00 2001 -From: Wang Mingyu -Date: Fri, 25 Dec 2020 14:14:08 +0900 -Subject: [PATCH] talloc: Add configure options for packages - -Add configure options for the following packages: - - acl - - attr - - libaio - - libbsd - - libcap - - valgrind - -Upstream-Status: Inappropriate [oe deterministic build specific] - -Signed-off-by: Jackie Huang - -Modified to apply to version 2.1.10. - -Signed-off-by: Joe Slater - -Modified tp apply to version 2.2.0 -Signed-off-by: Changqing Li ---- - lib/replace/wscript | 89 +++++++++++++++++++++++++++++++++++---------- - wscript | 7 +++- - 2 files changed, 75 insertions(+), 21 deletions(-) - -diff --git a/lib/replace/wscript b/lib/replace/wscript -index a2bc604..2e2e7bf 100644 ---- a/lib/replace/wscript -+++ b/lib/replace/wscript -@@ -25,6 +25,41 @@ def options(opt): - opt.PRIVATE_EXTENSION_DEFAULT('') - opt.RECURSE('buildtools/wafsamba') - -+ opt.add_option('--with-acl', -+ help=("Enable use of acl"), -+ action="store_true", dest='enable_acl') -+ opt.add_option('--without-acl', -+ help=("Disable use of acl"), -+ action="store_false", dest='enable_acl', default=False) -+ -+ opt.add_option('--with-attr', -+ help=("Enable use of attr"), -+ action="store_true", dest='enable_attr') -+ opt.add_option('--without-attr', -+ help=("Disable use of attr"), -+ action="store_false", dest='enable_attr', default=False) -+ -+ opt.add_option('--with-libaio', -+ help=("Enable use of libaio"), -+ action="store_true", dest='enable_libaio') -+ opt.add_option('--without-libaio', -+ help=("Disable use of libaio"), -+ action="store_false", dest='enable_libaio', default=False) -+ -+ opt.add_option('--with-libbsd', -+ help=("Enable use of libbsd"), -+ action="store_true", dest='enable_libbsd') -+ opt.add_option('--without-libbsd', -+ help=("Disable use of libbsd"), -+ action="store_false", dest='enable_libbsd', default=False) -+ -+ opt.add_option('--with-libcap', -+ help=("Enable use of libcap"), -+ action="store_true", dest='enable_libcap') -+ opt.add_option('--without-libcap', -+ help=("Disable use of libcap"), -+ action="store_false", dest='enable_libcap', default=False) -+ - @Utils.run_once - def configure(conf): - conf.RECURSE('buildtools/wafsamba') -@@ -34,12 +69,25 @@ def configure(conf): - conf.DEFINE('HAVE_LIBREPLACE', 1) - conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) - -- conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h') -- conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h') -+ conf.CHECK_HEADERS('linux/types.h crypt.h locale.h compat.h') -+ conf.CHECK_HEADERS('attr/xattr.h compat.h ctype.h dustat.h') - conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h') - conf.CHECK_HEADERS('locale.h ndir.h pwd.h') -- conf.CHECK_HEADERS('shadow.h sys/acl.h') -- conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h') -+ conf.CHECK_HEADERS('shadow.h') -+ conf.CHECK_HEADERS('sys/attributes.h sys/dir.h sys/epoll.h') -+ -+ if Options.options.enable_acl: -+ conf.CHECK_HEADERS('acl/libacl.h sys/acl.h') -+ -+ if Options.options.enable_attr: -+ conf.CHECK_HEADERS('attr/attributes.h attr/xattr.h') -+ -+ if Options.options.enable_libaio: -+ conf.CHECK_HEADERS('libaio.h') -+ -+ if Options.options.enable_libcap: -+ conf.CHECK_HEADERS('sys/capability.h') -+ - conf.CHECK_HEADERS('port.h') - conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h') - conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') -@@ -121,8 +169,9 @@ def configure(conf): - conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h') - conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h') - -- conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') -- conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') -+ if Options.options.enable_valgrind: -+ conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') -+ conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') - conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h') - conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h') - conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') -@@ -418,20 +467,20 @@ def configure(conf): - - strlcpy_in_bsd = False - -- # libbsd on some platforms provides strlcpy and strlcat -- if not conf.CHECK_FUNCS('strlcpy strlcat'): -- if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', -- checklibc=True): -- strlcpy_in_bsd = True -- if not conf.CHECK_FUNCS('getpeereid'): -- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') -- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): -- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') -- if not conf.CHECK_FUNCS('setproctitle_init'): -- conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') -- -- if not conf.CHECK_FUNCS('closefrom'): -- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') -+ if Options.options.enable_libbsd: -+ # libbsd on some platforms provides strlcpy and strlcat -+ if not conf.CHECK_FUNCS('strlcpy strlcat'): -+ if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', -+ checklibc=True): -+ strlcpy_in_bsd = True -+ if not conf.CHECK_FUNCS('getpeereid'): -+ conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') -+ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): -+ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') -+ if not conf.CHECK_FUNCS('setproctitle_init'): -+ conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') -+ if not conf.CHECK_FUNCS('closefrom'): -+ conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') - - conf.CHECK_CODE(''' - struct ucred cred; -diff --git a/wscript b/wscript -index b955d21..4ac6e1e 100644 ---- a/wscript -+++ b/wscript -@@ -31,7 +31,12 @@ def options(opt): - opt.add_option('--enable-talloc-compat1', - help=("Build talloc 1.x.x compat library [False]"), - action="store_true", dest='TALLOC_COMPAT1', default=False) -- -+ opt.add_option('--with-valgrind', -+ help=("enable use of valgrind"), -+ action="store_true", dest='enable_valgrind') -+ opt.add_option('--without-valgrind', -+ help=("disable use of valgrind"), -+ action="store_false", dest='enable_valgrind', default=False) - - def configure(conf): - conf.RECURSE('lib/replace') --- -2.25.1 - diff --git a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.3.3.bb b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.3.3.bb deleted file mode 100644 index b3f8b2ce25..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.3.3.bb +++ /dev/null @@ -1,54 +0,0 @@ -SUMMARY = "Hierarchical, reference counted memory pool system with destructors" -HOMEPAGE = "http://talloc.samba.org" -SECTION = "libs" -LICENSE = "LGPL-3.0-or-later & GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://talloc.h;beginline=3;endline=27;md5=a301712782cad6dd6d5228bfa7825249 \ - file://pytalloc.h;beginline=1;endline=18;md5=21ab13bd853679d7d47a1739cb3b7db6 \ - " - - -SRC_URI = "https://www.samba.org/ftp/talloc/talloc-${PV}.tar.gz \ - file://options-2.2.0.patch \ - file://0001-Fix-pyext_PATTERN-for-cross-compilation.patch \ -" -SRC_URI[sha256sum] = "6be95b2368bd0af1c4cd7a88146eb6ceea18e46c3ffc9330bf6262b40d1d8aaa" - -inherit waf-samba - -PACKAGECONFIG ??= "\ - ${@bb.utils.filter('DISTRO_FEATURES', 'acl', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} \ -" -PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl" -PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr" -PACKAGECONFIG[libaio] = "--with-libaio,--without-libaio,libaio" -PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd" -PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap" -PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind" - -SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'attr', '', 'file://avoid-attr-unless-wanted.patch', d)}" - -S = "${WORKDIR}/talloc-${PV}" - -#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen -#to cross Popen -export WAF_NO_PREFORK="yes" - -EXTRA_OECONF += "--disable-rpath \ - --disable-rpath-install \ - --bundled-libraries=NONE \ - --builtin-libraries=replace \ - --disable-silent-rules \ - --with-libiconv=${STAGING_DIR_HOST}${prefix}\ - " - -PACKAGES += "pytalloc pytalloc-dev" - -RPROVIDES:${PN}-dbg += "pytalloc-dbg" - -FILES:pytalloc = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/* \ - ${libdir}/libpytalloc-util.so.2 \ - ${libdir}/libpytalloc-util.so.2.1.1 \ - " -FILES:pytalloc-dev = "${libdir}/libpytalloc-util.so" -RDEPENDS:pytalloc = "python3" diff --git a/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.3.4.bb b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.3.4.bb new file mode 100644 index 0000000000..1c5922205e --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtalloc/libtalloc_2.3.4.bb @@ -0,0 +1,55 @@ +SUMMARY = "Hierarchical, reference counted memory pool system with destructors" +HOMEPAGE = "https://talloc.samba.org" +SECTION = "libs" +LICENSE = "LGPL-3.0-or-later & GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://talloc.h;beginline=3;endline=27;md5=a301712782cad6dd6d5228bfa7825249 \ + file://pytalloc.h;beginline=1;endline=18;md5=21ab13bd853679d7d47a1739cb3b7db6 \ + " + +export PYTHONHASHSEED="1" + +SRC_URI = "https://www.samba.org/ftp/talloc/talloc-${PV}.tar.gz \ + file://0001-talloc-Add-configure-options-for-packages.patch \ + file://0002-Fix-pyext_PATTERN-for-cross-compilation.patch \ +" +SRC_URI[sha256sum] = "179f9ebe265e67e4ab2c26cad2b7de4b6a77c6c212f966903382869f06be6505" + +inherit waf-samba + +PACKAGECONFIG ??= "\ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} \ +" +PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl" +PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr" +PACKAGECONFIG[libaio] = "--with-libaio,--without-libaio,libaio" +PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd" +PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap" +PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind" + +SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'attr', '', 'file://avoid-attr-unless-wanted.patch', d)}" + +S = "${WORKDIR}/talloc-${PV}" + +#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen +#to cross Popen +export WAF_NO_PREFORK="yes" + +EXTRA_OECONF += "--disable-rpath \ + --disable-rpath-install \ + --bundled-libraries=NONE \ + --builtin-libraries=replace \ + --disable-silent-rules \ + --with-libiconv=${STAGING_DIR_HOST}${prefix}\ + " + +PACKAGES += "pytalloc pytalloc-dev" + +RPROVIDES:${PN}-dbg += "pytalloc-dbg" + +FILES:pytalloc = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/* \ + ${libdir}/libpytalloc-util.so.2 \ + ${libdir}/libpytalloc-util.so.2.1.1 \ + " +FILES:pytalloc-dev = "${libdir}/libpytalloc-util.so" +RDEPENDS:pytalloc = "python3" diff --git a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0001-Fix-pyext_PATTERN-for-cross-compilation.patch b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0001-Fix-pyext_PATTERN-for-cross-compilation.patch deleted file mode 100644 index 6f221989fa..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0001-Fix-pyext_PATTERN-for-cross-compilation.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 00bd6680ad38c20c95a35c963d7077269f3a3aa2 Mon Sep 17 00:00:00 2001 -From: Yi Zhao -Date: Wed, 24 Nov 2021 13:33:35 +0800 -Subject: [PATCH] Fix pyext_PATTERN for cross compilation - -The pyext_PATTERN will add native arch as suffix when cross compiling. -For example, on qemuarm64, it is expanded to: -pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' -which will result in the incorrect library name. - -root@qemuarm64:~# find /usr/lib/python3.10/ -name tdb\* -/usr/lib/python3.10/site-packages/tdb.so -/usr/lib/python3.10/site-packages/tdb.cpython-310-x86_64-linux-gnu.so - -Set pyext_PATTERN to '%s.so' to remove the suffix. -After the patch: -root@qemuarm64:~# find /usr/lib/python3.10/ -name tdb\* -/usr/lib/python3.10/site-packages/tdb.so - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Yi Zhao ---- - third_party/waf/waflib/Tools/python.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py -index 7c45a76..c9a90f7 100644 ---- a/third_party/waf/waflib/Tools/python.py -+++ b/third_party/waf/waflib/Tools/python.py -@@ -328,7 +328,7 @@ def check_python_headers(conf, features='pyembed pyext'): - x = 'MACOSX_DEPLOYMENT_TARGET' - if dct[x]: - env[x] = conf.environ[x] = dct[x] -- env.pyext_PATTERN = '%s' + dct['SO'] # not a mistake -+ env.pyext_PATTERN = '%s.so' - - - # Try to get pythonX.Y-config --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0001-tdb-Add-configure-options-for-packages.patch b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0001-tdb-Add-configure-options-for-packages.patch new file mode 100644 index 0000000000..93a85e8545 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0001-tdb-Add-configure-options-for-packages.patch @@ -0,0 +1,171 @@ +From d3b1d23e01e323b9610843ab6bef096512f6c244 Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Wed, 19 Jun 2019 17:53:34 +0800 +Subject: [PATCH] tdb: Add configure options for packages + +Add configure options for the following packages: + - acl + - attr + - libaio + - libbsd + - libcap + - valgrind + +Upstream-Status: Inappropriate [oe deterministic build specific] + +Signed-off-by: Jackie Huang + +Update to 1.4.0 + +Signed-off-by: Changqing Li +--- + lib/replace/wscript | 92 ++++++++++++++++++++++++++++++++++----------- + wscript | 6 +++ + 2 files changed, 77 insertions(+), 21 deletions(-) + +diff --git a/lib/replace/wscript b/lib/replace/wscript +index 827d74f..70cde6f 100644 +--- a/lib/replace/wscript ++++ b/lib/replace/wscript +@@ -25,6 +25,41 @@ def options(opt): + opt.PRIVATE_EXTENSION_DEFAULT('') + opt.RECURSE('buildtools/wafsamba') + ++ opt.add_option('--with-acl', ++ help=("Enable use of acl"), ++ action="store_true", dest='enable_acl') ++ opt.add_option('--without-acl', ++ help=("Disable use of acl"), ++ action="store_false", dest='enable_acl', default=False) ++ ++ opt.add_option('--with-attr', ++ help=("Enable use of attr"), ++ action="store_true", dest='enable_attr') ++ opt.add_option('--without-attr', ++ help=("Disable use of attr"), ++ action="store_false", dest='enable_attr', default=False) ++ ++ opt.add_option('--with-libaio', ++ help=("Enable use of libaio"), ++ action="store_true", dest='enable_libaio') ++ opt.add_option('--without-libaio', ++ help=("Disable use of libaio"), ++ action="store_false", dest='enable_libaio', default=False) ++ ++ opt.add_option('--with-libbsd', ++ help=("Enable use of libbsd"), ++ action="store_true", dest='enable_libbsd') ++ opt.add_option('--without-libbsd', ++ help=("Disable use of libbsd"), ++ action="store_false", dest='enable_libbsd', default=False) ++ ++ opt.add_option('--with-libcap', ++ help=("Enable use of libcap"), ++ action="store_true", dest='enable_libcap') ++ opt.add_option('--without-libcap', ++ help=("Disable use of libcap"), ++ action="store_false", dest='enable_libcap', default=False) ++ + @Utils.run_once + def configure(conf): + conf.RECURSE('buildtools/wafsamba') +@@ -35,12 +70,25 @@ def configure(conf): + conf.DEFINE('HAVE_LIBREPLACE', 1) + conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) + +- conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h') +- conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h') ++ conf.CHECK_HEADERS('linux/types.h crypt.h locale.h compat.h') ++ conf.CHECK_HEADERS('attr/xattr.h compat.h ctype.h dustat.h') + conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h') + conf.CHECK_HEADERS('locale.h ndir.h pwd.h') +- conf.CHECK_HEADERS('shadow.h sys/acl.h') +- conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h') ++ conf.CHECK_HEADERS('shadow.h') ++ conf.CHECK_HEADERS('sys/attributes.h sys/dir.h sys/epoll.h') ++ ++ if Options.options.enable_acl: ++ conf.CHECK_HEADERS('acl/libacl.h sys/acl.h') ++ ++ if Options.options.enable_attr: ++ conf.CHECK_HEADERS('attr/attributes.h attr/xattr.h') ++ ++ if Options.options.enable_libaio: ++ conf.CHECK_HEADERS('libaio.h') ++ ++ if Options.options.enable_libcap: ++ conf.CHECK_HEADERS('sys/capability.h') ++ + conf.CHECK_HEADERS('port.h') + conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h') + conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') +@@ -110,9 +158,10 @@ def configure(conf): + conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h') + conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h') + +- conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') +- conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') +- conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h') ++ if Options.options.enable_valgrind: ++ conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') ++ conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') ++ + conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h') + conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') + conf.CHECK_HEADERS('syscall.h sys/syscall.h inttypes.h') +@@ -431,20 +480,21 @@ def configure(conf): + + strlcpy_in_bsd = False + +- # libbsd on some platforms provides strlcpy and strlcat +- if not conf.CHECK_FUNCS('strlcpy strlcat'): +- if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', +- checklibc=True): +- strlcpy_in_bsd = True +- if not conf.CHECK_FUNCS('getpeereid'): +- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') +- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): +- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') +- if not conf.CHECK_FUNCS('setproctitle_init'): +- conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') +- +- if not conf.CHECK_FUNCS('closefrom'): +- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') ++ if Options.options.enable_libbsd: ++ # libbsd on some platforms provides strlcpy and strlcat ++ if not conf.CHECK_FUNCS('strlcpy strlcat'): ++ if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', ++ checklibc=True): ++ strlcpy_in_bsd = True ++ if not conf.CHECK_FUNCS('getpeereid'): ++ conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') ++ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): ++ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') ++ if not conf.CHECK_FUNCS('setproctitle_init'): ++ conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') ++ ++ if not conf.CHECK_FUNCS('closefrom'): ++ conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') + + conf.CHECK_CODE(''' + struct ucred cred; +diff --git a/wscript b/wscript +index 71ada31..10b16a7 100644 +--- a/wscript ++++ b/wscript +@@ -69,6 +69,12 @@ def options(opt): + action="store_true", dest='disable_tdb_mutex_locking', + default=False) + ++ opt.add_option('--with-valgrind', ++ help=("enable use of valgrind"), ++ action="store_true", dest='enable_valgrind') ++ opt.add_option('--without-valgrind', ++ help=("disable use of valgrind"), ++ action="store_false", dest='enable_valgrind', default=False) + + def configure(conf): + conf.env.disable_tdb_mutex_locking = getattr(Options.options, +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0002-Fix-pyext_PATTERN-for-cross-compilation.patch b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0002-Fix-pyext_PATTERN-for-cross-compilation.patch new file mode 100644 index 0000000000..6bd118b536 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/0002-Fix-pyext_PATTERN-for-cross-compilation.patch @@ -0,0 +1,42 @@ +From 10b4546edb194ede7a5e8bb5e4c9f5fdc67984eb Mon Sep 17 00:00:00 2001 +From: Yi Zhao +Date: Wed, 24 Nov 2021 13:33:35 +0800 +Subject: [PATCH] Fix pyext_PATTERN for cross compilation + +The pyext_PATTERN will add native arch as suffix when cross compiling. +For example, on qemuarm64, it is expanded to: +pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' +which will result in the incorrect library name. + +root@qemuarm64:~# find /usr/lib/python3.10/ -name tdb\* +/usr/lib/python3.10/site-packages/tdb.so +/usr/lib/python3.10/site-packages/tdb.cpython-310-x86_64-linux-gnu.so + +Set pyext_PATTERN to '%s.so' to remove the suffix. +After the patch: +root@qemuarm64:~# find /usr/lib/python3.10/ -name tdb\* +/usr/lib/python3.10/site-packages/tdb.so + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Yi Zhao +--- + third_party/waf/waflib/Tools/python.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py +index a23bd01..af202e0 100644 +--- a/third_party/waf/waflib/Tools/python.py ++++ b/third_party/waf/waflib/Tools/python.py +@@ -328,7 +328,7 @@ def check_python_headers(conf, features='pyembed pyext'): + x = 'MACOSX_DEPLOYMENT_TARGET' + if dct[x]: + env[x] = conf.environ[x] = str(dct[x]) +- env.pyext_PATTERN = '%s' + (dct['EXT_SUFFIX'] or dct['SO']) # SO is deprecated in 3.5 and removed in 3.11 ++ env.pyext_PATTERN = '%s.so' + + + # Try to get pythonX.Y-config +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/tdb-Add-configure-options-for-packages.patch b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/tdb-Add-configure-options-for-packages.patch deleted file mode 100644 index c35cab7c2f..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb/tdb-Add-configure-options-for-packages.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 71a10c176c34da898c0169371b3c1b032d2f88b1 Mon Sep 17 00:00:00 2001 -From: Changqing Li -Date: Wed, 19 Jun 2019 17:53:34 +0800 -Subject: [PATCH] tdb: Add configure options for packages - -Add configure options for the following packages: - - acl - - attr - - libaio - - libbsd - - libcap - - valgrind - -Upstream-Status: Inappropriate [oe deterministic build specific] - -Signed-off-by: Jackie Huang - -Update to 1.4.0 - -Signed-off-by: Changqing Li ---- - lib/replace/wscript | 94 ++++++++++++++++++++++++++++++++++++++++------------- - wscript | 6 ++++ - 2 files changed, 78 insertions(+), 22 deletions(-) - -diff --git a/lib/replace/wscript b/lib/replace/wscript -index 1d01e1e..2336dc3 100644 ---- a/lib/replace/wscript -+++ b/lib/replace/wscript -@@ -25,6 +25,41 @@ def options(opt): - opt.PRIVATE_EXTENSION_DEFAULT('') - opt.RECURSE('buildtools/wafsamba') - -+ opt.add_option('--with-acl', -+ help=("Enable use of acl"), -+ action="store_true", dest='enable_acl') -+ opt.add_option('--without-acl', -+ help=("Disable use of acl"), -+ action="store_false", dest='enable_acl', default=False) -+ -+ opt.add_option('--with-attr', -+ help=("Enable use of attr"), -+ action="store_true", dest='enable_attr') -+ opt.add_option('--without-attr', -+ help=("Disable use of attr"), -+ action="store_false", dest='enable_attr', default=False) -+ -+ opt.add_option('--with-libaio', -+ help=("Enable use of libaio"), -+ action="store_true", dest='enable_libaio') -+ opt.add_option('--without-libaio', -+ help=("Disable use of libaio"), -+ action="store_false", dest='enable_libaio', default=False) -+ -+ opt.add_option('--with-libbsd', -+ help=("Enable use of libbsd"), -+ action="store_true", dest='enable_libbsd') -+ opt.add_option('--without-libbsd', -+ help=("Disable use of libbsd"), -+ action="store_false", dest='enable_libbsd', default=False) -+ -+ opt.add_option('--with-libcap', -+ help=("Enable use of libcap"), -+ action="store_true", dest='enable_libcap') -+ opt.add_option('--without-libcap', -+ help=("Disable use of libcap"), -+ action="store_false", dest='enable_libcap', default=False) -+ - @Utils.run_once - def configure(conf): - conf.RECURSE('buildtools/wafsamba') -@@ -34,12 +69,25 @@ def configure(conf): - conf.DEFINE('HAVE_LIBREPLACE', 1) - conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) - -- conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h') -- conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h') -+ conf.CHECK_HEADERS('linux/types.h crypt.h locale.h compat.h') -+ conf.CHECK_HEADERS('attr/xattr.h compat.h ctype.h dustat.h') - conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h') -- conf.CHECK_HEADERS('locale.h ndir.h pwd.h') -- conf.CHECK_HEADERS('shadow.h sys/acl.h') -- conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h') -+ conf.CHECK_HEADERS('locale.h ndir.h pwd.h') -+ conf.CHECK_HEADERS('shadow.h') -+ conf.CHECK_HEADERS('sys/attributes.h sys/dir.h sys/epoll.h') -+ -+ if Options.options.enable_acl: -+ conf.CHECK_HEADERS('acl/libacl.h sys/acl.h') -+ -+ if Options.options.enable_attr: -+ conf.CHECK_HEADERS('attr/attributes.h attr/xattr.h') -+ -+ if Options.options.enable_libaio: -+ conf.CHECK_HEADERS('libaio.h') -+ -+ if Options.options.enable_libcap: -+ conf.CHECK_HEADERS('sys/capability.h') -+ - conf.CHECK_HEADERS('port.h') - conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h') - conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') -@@ -110,9 +158,10 @@ def configure(conf): - conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h') - conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h') - -- conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') -- conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') -- conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h') -+ if Options.options.enable_valgrind: -+ conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') -+ conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') -+ - conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h') - conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') - conf.CHECK_HEADERS('syscall.h sys/syscall.h inttypes.h') -@@ -380,20 +429,21 @@ def configure(conf): - - strlcpy_in_bsd = False - -- # libbsd on some platforms provides strlcpy and strlcat -- if not conf.CHECK_FUNCS('strlcpy strlcat'): -- if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', -- checklibc=True): -- strlcpy_in_bsd = True -- if not conf.CHECK_FUNCS('getpeereid'): -- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') -- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): -- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') -- if not conf.CHECK_FUNCS('setproctitle_init'): -- conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') -- -- if not conf.CHECK_FUNCS('closefrom'): -- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') -+ if Options.options.enable_libbsd: -+ # libbsd on some platforms provides strlcpy and strlcat -+ if not conf.CHECK_FUNCS('strlcpy strlcat'): -+ if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', -+ checklibc=True): -+ strlcpy_in_bsd = True -+ if not conf.CHECK_FUNCS('getpeereid'): -+ conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') -+ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): -+ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') -+ if not conf.CHECK_FUNCS('setproctitle_init'): -+ conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') -+ -+ if not conf.CHECK_FUNCS('closefrom'): -+ conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') - - conf.CHECK_CODE(''' - struct ucred cred; -diff --git a/wscript b/wscript -index 5598d02..8d47244 100644 ---- a/wscript -+++ b/wscript -@@ -69,6 +69,12 @@ def options(opt): - action="store_true", dest='disable_tdb_mutex_locking', - default=False) - -+ opt.add_option('--with-valgrind', -+ help=("enable use of valgrind"), -+ action="store_true", dest='enable_valgrind') -+ opt.add_option('--without-valgrind', -+ help=("disable use of valgrind"), -+ action="store_false", dest='enable_valgrind', default=False) - - def configure(conf): - conf.env.disable_tdb_mutex_locking = getattr(Options.options, --- -2.7.4 - diff --git a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.4.3.bb b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.4.3.bb deleted file mode 100644 index 2affcf754e..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.4.3.bb +++ /dev/null @@ -1,51 +0,0 @@ -SUMMARY = "The tdb library" -HOMEPAGE = "http://tdb.samba.org/" -SECTION = "libs" -LICENSE = "LGPL-3.0-or-later & GPL-3.0-or-later" - -LIC_FILES_CHKSUM = "file://tools/tdbdump.c;endline=18;md5=b59cd45aa8624578126a8c98f48018c4 \ - file://include/tdb.h;endline=27;md5=f5bb544641d3081821bcc1dd58310be6" - -SRC_URI = "https://samba.org/ftp/tdb/tdb-${PV}.tar.gz \ - file://tdb-Add-configure-options-for-packages.patch \ - file://0001-Fix-pyext_PATTERN-for-cross-compilation.patch \ -" - -SRC_URI[md5sum] = "e638e8890f743624a754304b3f994f4d" -SRC_URI[sha256sum] = "c8058393dfa15f47e11ebd2f1d132693f0b3b3b8bf22d0201bfb305026f88a1b" - -PACKAGECONFIG ??= "\ - ${@bb.utils.filter('DISTRO_FEATURES', 'acl', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} \ -" - -PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl" -PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr" -PACKAGECONFIG[libaio] = "--with-libaio,--without-libaio,libaio" -PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd" -PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap" -PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind" - -S = "${WORKDIR}/tdb-${PV}" - -inherit waf-samba - -#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen -#to cross Popen -export WAF_NO_PREFORK="yes" - -EXTRA_OECONF += "--disable-rpath \ - --bundled-libraries=NONE \ - --builtin-libraries=replace \ - --with-libiconv=${STAGING_DIR_HOST}${prefix}\ - " - -PACKAGES += "tdb-tools python3-tdb" - -RPROVIDES:${PN}-dbg += "python3-tdb-dbg" - -FILES:${PN} = "${libdir}/*.so.*" -FILES:tdb-tools = "${bindir}/*" -FILES:python3-tdb = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*" -RDEPENDS:python3-tdb = "python3" -INSANE_SKIP:${MLPREFIX}python3-tdb = "dev-so" diff --git a/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.4.7.bb b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.4.7.bb new file mode 100644 index 0000000000..d4c4f1c371 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtdb/libtdb_1.4.7.bb @@ -0,0 +1,54 @@ +SUMMARY = "The tdb library" +HOMEPAGE = "https://tdb.samba.org/" +SECTION = "libs" +LICENSE = "LGPL-3.0-or-later & GPL-3.0-or-later" + +LIC_FILES_CHKSUM = "file://tools/tdbdump.c;endline=18;md5=b59cd45aa8624578126a8c98f48018c4 \ + file://include/tdb.h;endline=27;md5=f5bb544641d3081821bcc1dd58310be6" + +export PYTHONHASHSEED="1" + +SRC_URI = "https://samba.org/ftp/tdb/tdb-${PV}.tar.gz \ + file://0001-tdb-Add-configure-options-for-packages.patch \ + file://0002-Fix-pyext_PATTERN-for-cross-compilation.patch \ +" + +SRC_URI[md5sum] = "bc27d5b20c7f013305c40b3bced43b3a" +SRC_URI[sha256sum] = "a4fb168def533f31ff2c07f7d9844bb3131e6799f094ebe77d0380adc987c20e" + +PACKAGECONFIG ??= "\ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} \ +" + +PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl" +PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr" +PACKAGECONFIG[libaio] = "--with-libaio,--without-libaio,libaio" +PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd" +PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap" +PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind" + +S = "${WORKDIR}/tdb-${PV}" + +inherit waf-samba + +#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen +#to cross Popen +export WAF_NO_PREFORK="yes" + +EXTRA_OECONF += "--disable-rpath \ + --disable-rpath-install \ + --bundled-libraries=NONE \ + --builtin-libraries=replace \ + --with-libiconv=${STAGING_DIR_HOST}${prefix}\ + " + +PACKAGES += "tdb-tools python3-tdb" + +RPROVIDES:${PN}-dbg += "python3-tdb-dbg" + +FILES:${PN} = "${libdir}/*.so.*" +FILES:tdb-tools = "${bindir}/*" +FILES:python3-tdb = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*" +RDEPENDS:python3-tdb = "python3" +INSANE_SKIP:${MLPREFIX}python3-tdb = "dev-so" diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-Add-configure-options-for-packages.patch b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-Add-configure-options-for-packages.patch new file mode 100644 index 0000000000..d98559b4ef --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-Add-configure-options-for-packages.patch @@ -0,0 +1,169 @@ +From d9fd1c52d1646254944bfee37be611e04d4daddb Mon Sep 17 00:00:00 2001 +From: Wang Mingyu +Date: Fri, 25 Dec 2020 15:03:17 +0900 +Subject: [PATCH] Add configure options for packages + +Add configure options for the following packages: + - acl + - attr + - libaio + - libbsd + - libcap + - valgrind + +Upstream-Status: Inappropriate [oe deterministic build specific] + +Signed-off-by: Jackie Huang + +Modified to apply to version 0.9.33. + +Signed-off-by: Joe Slater + +Update patch to version 0.10.0 +Signed-off-by: Changqing Li +--- + lib/replace/wscript | 87 ++++++++++++++++++++++++++++++++++----------- + wscript | 6 ++++ + 2 files changed, 73 insertions(+), 20 deletions(-) + +diff --git a/lib/replace/wscript b/lib/replace/wscript +index 4c774d9..21a746a 100644 +--- a/lib/replace/wscript ++++ b/lib/replace/wscript +@@ -25,6 +25,41 @@ def options(opt): + opt.PRIVATE_EXTENSION_DEFAULT('') + opt.RECURSE('buildtools/wafsamba') + ++ opt.add_option('--with-acl', ++ help=("Enable use of acl"), ++ action="store_true", dest='enable_acl') ++ opt.add_option('--without-acl', ++ help=("Disable use of acl"), ++ action="store_false", dest='enable_acl', default=False) ++ ++ opt.add_option('--with-attr', ++ help=("Enable use of attr"), ++ action="store_true", dest='enable_attr') ++ opt.add_option('--without-attr', ++ help=("Disable use of attr"), ++ action="store_false", dest='enable_attr', default=False) ++ ++ opt.add_option('--with-libaio', ++ help=("Enable use of libaio"), ++ action="store_true", dest='enable_libaio') ++ opt.add_option('--without-libaio', ++ help=("Disable use of libaio"), ++ action="store_false", dest='enable_libaio', default=False) ++ ++ opt.add_option('--with-libbsd', ++ help=("Enable use of libbsd"), ++ action="store_true", dest='enable_libbsd') ++ opt.add_option('--without-libbsd', ++ help=("Disable use of libbsd"), ++ action="store_false", dest='enable_libbsd', default=False) ++ ++ opt.add_option('--with-libcap', ++ help=("Enable use of libcap"), ++ action="store_true", dest='enable_libcap') ++ opt.add_option('--without-libcap', ++ help=("Disable use of libcap"), ++ action="store_false", dest='enable_libcap', default=False) ++ + @Utils.run_once + def configure(conf): + conf.RECURSE('buildtools/wafsamba') +@@ -35,12 +70,25 @@ def configure(conf): + conf.DEFINE('HAVE_LIBREPLACE', 1) + conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) + +- conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h') +- conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h') ++ conf.CHECK_HEADERS('linux/types.h crypt.h locale.h compat.h') ++ conf.CHECK_HEADERS('compat.h ctype.h dustat.h') + conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h') + conf.CHECK_HEADERS('locale.h ndir.h pwd.h') +- conf.CHECK_HEADERS('shadow.h sys/acl.h') +- conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h') ++ conf.CHECK_HEADERS('shadow.h') ++ conf.CHECK_HEADERS('sys/attributes.h sys/dir.h sys/epoll.h') ++ ++ if Options.options.enable_acl: ++ conf.CHECK_HEADERS('acl/libacl.h sys/acl.h') ++ ++ if Options.options.enable_attr: ++ conf.CHECK_HEADERS('attr/attributes.h attr/xattr.h') ++ ++ if Options.options.enable_libaio: ++ conf.CHECK_HEADERS('libaio.h') ++ ++ if Options.options.enable_libcap: ++ conf.CHECK_HEADERS('sys/capability.h') ++ + conf.CHECK_HEADERS('port.h') + conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h') + conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') +@@ -110,8 +158,9 @@ def configure(conf): + conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h') + conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h') + +- conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') +- conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') ++ if Options.options.enable_valgrind: ++ conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') ++ conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') + conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h') + conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h') + conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') +@@ -434,20 +483,18 @@ def configure(conf): + + strlcpy_in_bsd = False + +- # libbsd on some platforms provides strlcpy and strlcat +- if not conf.CHECK_FUNCS('strlcpy strlcat'): +- if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', +- checklibc=True): +- strlcpy_in_bsd = True +- if not conf.CHECK_FUNCS('getpeereid'): +- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') +- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): +- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') +- if not conf.CHECK_FUNCS('setproctitle_init'): +- conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') +- +- if not conf.CHECK_FUNCS('closefrom'): +- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') ++ if Options.options.enable_libbsd: ++ # libbsd on some platforms provides strlcpy and strlcat ++ if not conf.CHECK_FUNCS('strlcpy strlcat'): ++ conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', ++ checklibc=True) ++ if not conf.CHECK_FUNCS('getpeereid'): ++ conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') ++ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): ++ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') ++ ++ if not conf.CHECK_FUNCS('closefrom'): ++ conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') + + conf.CHECK_CODE(''' + struct ucred cred; +diff --git a/wscript b/wscript +index 5c6f02c..75eecd4 100644 +--- a/wscript ++++ b/wscript +@@ -28,6 +28,12 @@ def options(opt): + opt.RECURSE('lib/replace') + opt.RECURSE('lib/talloc') + ++ opt.add_option('--with-valgrind', ++ help=("enable use of valgrind"), ++ action="store_true", dest='enable_valgrind') ++ opt.add_option('--without-valgrind', ++ help=("disable use of valgrind"), ++ action="store_false", dest='enable_valgrind', default=False) + + def configure(conf): + conf.RECURSE('lib/replace') +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-Fix-pyext_PATTERN-for-cross-compilation.patch b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-Fix-pyext_PATTERN-for-cross-compilation.patch deleted file mode 100644 index 81abac83a4..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-Fix-pyext_PATTERN-for-cross-compilation.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 96ddbe6653f87670e4a0bbff229276bbe0aa822a Mon Sep 17 00:00:00 2001 -From: Yi Zhao -Date: Wed, 24 Nov 2021 13:33:35 +0800 -Subject: [PATCH] Fix pyext_PATTERN for cross compilation - -The pyext_PATTERN will add native arch as suffix when cross compiling. -For example, on qemuarm64, it is expanded to: -pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' -which will result in the incorrect library name. - -root@qemuarm64:~# find /usr/lib/python3.10/ -name \*tevent\*.so -/usr/lib/python3.10/site-packages/_tevent.cpython-310-x86_64-linux-gnu.so -/usr/lib/python3.10/site-packages/_tevent.so - -Set pyext_PATTERN to '%s.so' to remove the suffix. -After the patch: -root@qemuarm64:~# find /usr/lib/python3.10/ -name \*tevent\*.so -/usr/lib/python3.10/site-packages/_tevent.so - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Yi Zhao ---- - third_party/waf/waflib/Tools/python.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py -index 7c45a76..c9a90f7 100644 ---- a/third_party/waf/waflib/Tools/python.py -+++ b/third_party/waf/waflib/Tools/python.py -@@ -328,7 +328,7 @@ def check_python_headers(conf, features='pyembed pyext'): - x = 'MACOSX_DEPLOYMENT_TARGET' - if dct[x]: - env[x] = conf.environ[x] = dct[x] -- env.pyext_PATTERN = '%s' + dct['SO'] # not a mistake -+ env.pyext_PATTERN = '%s.so' - - - # Try to get pythonX.Y-config --- -2.17.1 - diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-libtevent-fix-musl-libc-compile-error.patch b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-libtevent-fix-musl-libc-compile-error.patch deleted file mode 100644 index e3aeda9c33..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0001-libtevent-fix-musl-libc-compile-error.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 7ba1de909c587b6773a39ba9f6f9890987f35b24 Mon Sep 17 00:00:00 2001 -From: Changqing Li -Date: Tue, 24 Jul 2018 11:30:53 +0800 -Subject: [PATCH] libtevent: fix musl libc compile error - -libldb depend on libtevent, build libldb with musl libc, -will report error: -tevent.h:1440:8: error: unknown type name 'pid_t'; did you mean 'div_t'? - -add missing headers to fix it. - -Signed-off-by: Changqing Li ---- - tevent.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/tevent.h b/tevent.h -index aa6fe0d..2572696 100644 ---- a/tevent.h -+++ b/tevent.h -@@ -32,6 +32,8 @@ - #include - #include - #include -+#include -+#include - - struct tevent_context; - struct tevent_ops; --- -2.7.4 - diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0002-Fix-pyext_PATTERN-for-cross-compilation.patch b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0002-Fix-pyext_PATTERN-for-cross-compilation.patch new file mode 100644 index 0000000000..ba3f4ca7a6 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/0002-Fix-pyext_PATTERN-for-cross-compilation.patch @@ -0,0 +1,42 @@ +From da1dc659fd351ff6283f843eeba5e0b3f7b2d584 Mon Sep 17 00:00:00 2001 +From: Yi Zhao +Date: Wed, 24 Nov 2021 13:33:35 +0800 +Subject: [PATCH] Fix pyext_PATTERN for cross compilation + +The pyext_PATTERN will add native arch as suffix when cross compiling. +For example, on qemuarm64, it is expanded to: +pyext_PATTERN ='%s.cpython-310-x86_64-linux-gnu.so' +which will result in the incorrect library name. + +root@qemuarm64:~# find /usr/lib/python3.10/ -name \*tevent\*.so +/usr/lib/python3.10/site-packages/_tevent.cpython-310-x86_64-linux-gnu.so +/usr/lib/python3.10/site-packages/_tevent.so + +Set pyext_PATTERN to '%s.so' to remove the suffix. +After the patch: +root@qemuarm64:~# find /usr/lib/python3.10/ -name \*tevent\*.so +/usr/lib/python3.10/site-packages/_tevent.so + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Yi Zhao +--- + third_party/waf/waflib/Tools/python.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/third_party/waf/waflib/Tools/python.py b/third_party/waf/waflib/Tools/python.py +index a23bd01..af202e0 100644 +--- a/third_party/waf/waflib/Tools/python.py ++++ b/third_party/waf/waflib/Tools/python.py +@@ -328,7 +328,7 @@ def check_python_headers(conf, features='pyembed pyext'): + x = 'MACOSX_DEPLOYMENT_TARGET' + if dct[x]: + env[x] = conf.environ[x] = str(dct[x]) +- env.pyext_PATTERN = '%s' + (dct['EXT_SUFFIX'] or dct['SO']) # SO is deprecated in 3.5 and removed in 3.11 ++ env.pyext_PATTERN = '%s.so' + + + # Try to get pythonX.Y-config +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/avoid-attr-unless-wanted.patch b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/avoid-attr-unless-wanted.patch index b71192b7d2..1e340f3692 100644 --- a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/avoid-attr-unless-wanted.patch +++ b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/avoid-attr-unless-wanted.patch @@ -1,17 +1,17 @@ -From 6c4a634cdf70147f773bb1806692c78bbb95c6f2 Mon Sep 17 00:00:00 2001 +From 82dc31b72e77f263574645092ba1597a8f1152e7 Mon Sep 17 00:00:00 2001 From: Wang Mingyu Date: Fri, 25 Dec 2020 15:10:58 +0900 -Subject: [PATCH] test +Subject: [PATCH] avoid attr unless wanted --- lib/replace/wscript | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/replace/wscript b/lib/replace/wscript -index e4642e8..163e94d 100644 +index 21a746a..6be3276 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript -@@ -945,8 +945,6 @@ def build(bld): +@@ -968,8 +968,6 @@ def build(bld): if not bld.CONFIG_SET('HAVE_INET_ATON'): REPLACE_SOURCE += ' inet_aton.c' if not bld.CONFIG_SET('HAVE_INET_NTOP'): REPLACE_SOURCE += ' inet_ntop.c' if not bld.CONFIG_SET('HAVE_INET_PTON'): REPLACE_SOURCE += ' inet_pton.c' @@ -20,10 +20,10 @@ index e4642e8..163e94d 100644 if not bld.CONFIG_SET('HAVE_CLOSEFROM'): REPLACE_SOURCE += ' closefrom.c' -@@ -960,7 +958,7 @@ def build(bld): - # at the moment: +@@ -984,7 +982,7 @@ def build(bld): # hide_symbols=bld.BUILTIN_LIBRARY('replace'), private_library=True, + provide_builtin_linking=True, - deps='dl attr' + extra_libs) + deps='dl' + extra_libs) diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/cmocka-fix-musl-libc-conflicting-types-error.patch b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/cmocka-fix-musl-libc-conflicting-types-error.patch new file mode 100644 index 0000000000..5795ff3bd1 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/cmocka-fix-musl-libc-conflicting-types-error.patch @@ -0,0 +1,45 @@ +From 1d4dedab5039bb671f44566d8573ee3532ba7176 Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Wed, 25 Jul 2018 09:55:25 +0800 +Subject: [PATCH] cmocka: fix musl libc conflicting types error + +/third_party/cmocka/cmocka.h:126:28: error: conflicting types for 'uintptr_t' + typedef unsigned int uintptr_t; + ^~~~~~~~~ +use __DEFINED_uintptr_t in alltypes.h to check if uintptr already defined + +Upstream-Status: Pending + +Signed-off-by: Changqing Li +--- + third_party/cmocka/cmocka.h | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/third_party/cmocka/cmocka.h b/third_party/cmocka/cmocka.h +index e6861c8..238201d 100644 +--- a/third_party/cmocka/cmocka.h ++++ b/third_party/cmocka/cmocka.h +@@ -111,7 +111,7 @@ typedef uintmax_t LargestIntegralType; + ((LargestIntegralType)(value)) + + /* Smallest integral type capable of holding a pointer. */ +-#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) ++#if !defined(__DEFINED_uintptr_t) + # if defined(_WIN32) + /* WIN32 is an ILP32 platform */ + typedef unsigned int uintptr_t; +@@ -135,9 +135,8 @@ typedef uintmax_t LargestIntegralType; + # endif /* __WORDSIZE */ + # endif /* _WIN32 */ + +-# define _UINTPTR_T +-# define _UINTPTR_T_DEFINED +-#endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */ ++# define __DEFINED_uintptr_t ++#endif /* !defined(__DEFINED_uintptr_t) */ + + /* Perform an unsigned cast to uintptr_t. */ + #define cast_to_pointer_integral_type(value) \ +-- +2.25.1 + diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/options-0.10.0.patch b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/options-0.10.0.patch deleted file mode 100644 index 42da2468f2..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent/options-0.10.0.patch +++ /dev/null @@ -1,169 +0,0 @@ -From c012aa03613e6e74a0598185b222c7b531df1e2d Mon Sep 17 00:00:00 2001 -From: Wang Mingyu -Date: Fri, 25 Dec 2020 15:03:17 +0900 -Subject: [PATCH] Add configure options for packages - -Add configure options for the following packages: - - acl - - attr - - libaio - - libbsd - - libcap - - valgrind - -Upstream-Status: Inappropriate [oe deterministic build specific] - -Signed-off-by: Jackie Huang - -Modified to apply to version 0.9.33. - -Signed-off-by: Joe Slater - -Update patch to version 0.10.0 -Signed-off-by: Changqing Li ---- - lib/replace/wscript | 87 ++++++++++++++++++++++++++++++++++----------- - wscript | 6 ++++ - 2 files changed, 73 insertions(+), 20 deletions(-) - -diff --git a/lib/replace/wscript b/lib/replace/wscript -index a2bc604..e4642e8 100644 ---- a/lib/replace/wscript -+++ b/lib/replace/wscript -@@ -25,6 +25,41 @@ def options(opt): - opt.PRIVATE_EXTENSION_DEFAULT('') - opt.RECURSE('buildtools/wafsamba') - -+ opt.add_option('--with-acl', -+ help=("Enable use of acl"), -+ action="store_true", dest='enable_acl') -+ opt.add_option('--without-acl', -+ help=("Disable use of acl"), -+ action="store_false", dest='enable_acl', default=False) -+ -+ opt.add_option('--with-attr', -+ help=("Enable use of attr"), -+ action="store_true", dest='enable_attr') -+ opt.add_option('--without-attr', -+ help=("Disable use of attr"), -+ action="store_false", dest='enable_attr', default=False) -+ -+ opt.add_option('--with-libaio', -+ help=("Enable use of libaio"), -+ action="store_true", dest='enable_libaio') -+ opt.add_option('--without-libaio', -+ help=("Disable use of libaio"), -+ action="store_false", dest='enable_libaio', default=False) -+ -+ opt.add_option('--with-libbsd', -+ help=("Enable use of libbsd"), -+ action="store_true", dest='enable_libbsd') -+ opt.add_option('--without-libbsd', -+ help=("Disable use of libbsd"), -+ action="store_false", dest='enable_libbsd', default=False) -+ -+ opt.add_option('--with-libcap', -+ help=("Enable use of libcap"), -+ action="store_true", dest='enable_libcap') -+ opt.add_option('--without-libcap', -+ help=("Disable use of libcap"), -+ action="store_false", dest='enable_libcap', default=False) -+ - @Utils.run_once - def configure(conf): - conf.RECURSE('buildtools/wafsamba') -@@ -34,12 +69,25 @@ def configure(conf): - conf.DEFINE('HAVE_LIBREPLACE', 1) - conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) - -- conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h') -- conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h') -+ conf.CHECK_HEADERS('linux/types.h crypt.h locale.h compat.h') -+ conf.CHECK_HEADERS('compat.h ctype.h dustat.h') - conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h') - conf.CHECK_HEADERS('locale.h ndir.h pwd.h') -- conf.CHECK_HEADERS('shadow.h sys/acl.h') -- conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h') -+ conf.CHECK_HEADERS('shadow.h') -+ conf.CHECK_HEADERS('sys/attributes.h sys/dir.h sys/epoll.h') -+ -+ if Options.options.enable_acl: -+ conf.CHECK_HEADERS('acl/libacl.h sys/acl.h') -+ -+ if Options.options.enable_attr: -+ conf.CHECK_HEADERS('attr/attributes.h attr/xattr.h') -+ -+ if Options.options.enable_libaio: -+ conf.CHECK_HEADERS('libaio.h') -+ -+ if Options.options.enable_libcap: -+ conf.CHECK_HEADERS('sys/capability.h') -+ - conf.CHECK_HEADERS('port.h') - conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h') - conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') -@@ -121,8 +169,9 @@ def configure(conf): - conf.CHECK_HEADERS('sys/fileio.h sys/filesys.h sys/dustat.h sys/sysmacros.h') - conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h') - -- conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') -- conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') -+ if Options.options.enable_valgrind: -+ conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') -+ conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') - conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h') - conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h') - conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') -@@ -418,20 +467,18 @@ def configure(conf): - - strlcpy_in_bsd = False - -- # libbsd on some platforms provides strlcpy and strlcat -- if not conf.CHECK_FUNCS('strlcpy strlcat'): -- if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', -- checklibc=True): -- strlcpy_in_bsd = True -- if not conf.CHECK_FUNCS('getpeereid'): -- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') -- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): -- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') -- if not conf.CHECK_FUNCS('setproctitle_init'): -- conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') -- -- if not conf.CHECK_FUNCS('closefrom'): -- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') -+ if Options.options.enable_libbsd: -+ # libbsd on some platforms provides strlcpy and strlcat -+ if not conf.CHECK_FUNCS('strlcpy strlcat'): -+ conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', -+ checklibc=True) -+ if not conf.CHECK_FUNCS('getpeereid'): -+ conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') -+ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): -+ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') -+ -+ if not conf.CHECK_FUNCS('closefrom'): -+ conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') - - conf.CHECK_CODE(''' - struct ucred cred; -diff --git a/wscript b/wscript -index 93af416..a0898b1 100644 ---- a/wscript -+++ b/wscript -@@ -25,6 +25,12 @@ def options(opt): - opt.RECURSE('lib/replace') - opt.RECURSE('lib/talloc') - -+ opt.add_option('--with-valgrind', -+ help=("enable use of valgrind"), -+ action="store_true", dest='enable_valgrind') -+ opt.add_option('--without-valgrind', -+ help=("disable use of valgrind"), -+ action="store_false", dest='enable_valgrind', default=False) - - def configure(conf): - conf.RECURSE('lib/replace') --- -2.25.1 - diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent_0.10.2.bb b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent_0.10.2.bb deleted file mode 100644 index 732880e96c..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent_0.10.2.bb +++ /dev/null @@ -1,53 +0,0 @@ -SUMMARY = "Hierarchical, reference counted memory pool system with destructors" -HOMEPAGE = "http://tevent.samba.org" -SECTION = "libs" -LICENSE = "LGPL-3.0-or-later" - -DEPENDS += "libtalloc libtirpc" -RDEPENDS:python3-tevent = "python3" - -SRC_URI = "https://samba.org/ftp/tevent/tevent-${PV}.tar.gz \ - file://options-0.10.0.patch \ - file://0001-libtevent-fix-musl-libc-compile-error.patch \ - file://0001-Fix-pyext_PATTERN-for-cross-compilation.patch \ -" -LIC_FILES_CHKSUM = "file://tevent.h;endline=26;md5=4e458d658cb25e21efc16f720e78b85a" - -SRC_URI[md5sum] = "105c7a4dbb96f1751eb27dfd05e7fa84" -SRC_URI[sha256sum] = "f8427822e5b2878fb8b28d6f50d96848734f3f3130612fb574fdd2d2148a6696" - -inherit pkgconfig waf-samba - -PACKAGECONFIG ??= "\ - ${@bb.utils.filter('DISTRO_FEATURES', 'acl', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} \ -" -PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl" -PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr" -PACKAGECONFIG[libaio] = "--with-libaio,--without-libaio,libaio" -PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd" -PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap" -PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind" - -SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'attr', '', 'file://avoid-attr-unless-wanted.patch', d)}" - -S = "${WORKDIR}/tevent-${PV}" - -#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen -#to cross Popen -export WAF_NO_PREFORK="yes" - -EXTRA_OECONF += "--disable-rpath \ - --bundled-libraries=NONE \ - --builtin-libraries=replace \ - --with-libiconv=${STAGING_DIR_HOST}${prefix}\ - --without-gettext \ - " - -PACKAGES += "python3-tevent" - -RPROVIDES:${PN}-dbg += "python3-tevent-dbg" - -FILES:python3-tevent = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*" - -INSANE_SKIP:${MLPREFIX}python3-tevent = "dev-so" diff --git a/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent_0.13.0.bb b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent_0.13.0.bb new file mode 100644 index 0000000000..b3ae63c489 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/libtevent/libtevent_0.13.0.bb @@ -0,0 +1,59 @@ +SUMMARY = "Hierarchical, reference counted memory pool system with destructors" +HOMEPAGE = "https://tevent.samba.org" +SECTION = "libs" +LICENSE = "LGPL-3.0-or-later" + +DEPENDS += "libtalloc libtirpc" +RDEPENDS:python3-tevent = "python3" + +export PYTHONHASHSEED="1" + +SRC_URI = "https://samba.org/ftp/tevent/tevent-${PV}.tar.gz \ + file://0001-Add-configure-options-for-packages.patch \ + file://0002-Fix-pyext_PATTERN-for-cross-compilation.patch \ + " + +SRC_URI:append:libc-musl = " file://cmocka-fix-musl-libc-conflicting-types-error.patch" + +LIC_FILES_CHKSUM = "file://tevent.h;endline=26;md5=47386b7c539bf2706b7ce52dc9341681" + +SRC_URI[md5sum] = "9f413f3184f79a4deecd9444242a5dca" +SRC_URI[sha256sum] = "b9437a917fa55344361beb64ec9e0042e99cae8879882a62dd38f6abe2371d0c" + +inherit pkgconfig waf-samba + +PACKAGECONFIG ??= "\ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} \ +" +PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl" +PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr" +PACKAGECONFIG[libaio] = "--with-libaio,--without-libaio,libaio" +PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd" +PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap" +PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind" + +SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'attr', '', 'file://avoid-attr-unless-wanted.patch', d)}" + +S = "${WORKDIR}/tevent-${PV}" + +#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen +#to cross Popen +export WAF_NO_PREFORK="yes" + +EXTRA_OECONF += "--disable-rpath \ + --disable-rpath-install \ + --bundled-libraries=cmocka \ + --builtin-libraries=replace \ + --with-libiconv=${STAGING_DIR_HOST}${prefix}\ + --without-gettext \ + " + +PACKAGES += "python3-tevent" + +RPROVIDES:${PN}-dbg += "python3-tevent-dbg" + +FILES:${PN} += "${libdir}/tevent/*" +FILES:python3-tevent = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*" + +INSANE_SKIP:${MLPREFIX}python3-tevent = "dev-so" diff --git a/meta-openembedded/meta-networking/recipes-support/nbdkit/nbdkit_1.33.2.bb b/meta-openembedded/meta-networking/recipes-support/nbdkit/nbdkit_1.33.2.bb deleted file mode 100644 index ad7b9a6fab..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/nbdkit/nbdkit_1.33.2.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "nbdkit is a toolkit for creating NBD servers." -DESCRIPTION = "NBD — Network Block Device — is a protocol \ -for accessing Block Devices (hard disks and disk-like things) \ -over a Network. \ -\ -nbdkit is a toolkit for creating NBD servers." - -HOMEPAGE = "https://github.com/libguestfs/nbdkit" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=f9dcc2d8acdde215fa4bd6ac12bb14f0" - -SRC_URI = "git://github.com/libguestfs/nbdkit.git;protocol=https;branch=master \ -" -SRCREV = "9e2fdefc1ba4c883c5e6aa4f32ab21777980a978" - -S = "${WORKDIR}/git" - -DEPENDS = "curl xz e2fsprogs zlib" - -# autotools-brokensep is needed as nbdkit does not support build in external directory -inherit pkgconfig python3native perlnative bash-completion autotools-brokensep - -# Those are required to build standalone -EXTRA_OECONF = " --without-libvirt --without-libguestfs --disable-perl" - -# Disable some extended support (not desired for small embedded systems) -#EXTRA_OECONF += " --disable-python" -#EXTRA_OECONF += " --disable-ocaml" -#EXTRA_OECONF += " --disable-rust" -#EXTRA_OECONF += " --disable-ruby" -#EXTRA_OECONF += " --disable-tcl" -#EXTRA_OECONF += " --disable-lua" -#EXTRA_OECONF += " --disable-vddk" diff --git a/meta-openembedded/meta-networking/recipes-support/nbdkit/nbdkit_1.33.4.bb b/meta-openembedded/meta-networking/recipes-support/nbdkit/nbdkit_1.33.4.bb new file mode 100644 index 0000000000..bc28eb84fe --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nbdkit/nbdkit_1.33.4.bb @@ -0,0 +1,33 @@ +SUMMARY = "nbdkit is a toolkit for creating NBD servers." +DESCRIPTION = "NBD — Network Block Device — is a protocol \ +for accessing Block Devices (hard disks and disk-like things) \ +over a Network. \ +\ +nbdkit is a toolkit for creating NBD servers." + +HOMEPAGE = "https://github.com/libguestfs/nbdkit" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=f9dcc2d8acdde215fa4bd6ac12bb14f0" + +SRC_URI = "git://github.com/libguestfs/nbdkit.git;protocol=https;branch=master \ +" +SRCREV = "eaca70ec362dcf745fc81188f6008528d1b17961" + +S = "${WORKDIR}/git" + +DEPENDS = "curl xz e2fsprogs zlib" + +# autotools-brokensep is needed as nbdkit does not support build in external directory +inherit pkgconfig python3native perlnative bash-completion autotools-brokensep + +# Those are required to build standalone +EXTRA_OECONF = " --without-libvirt --without-libguestfs --disable-perl" + +# Disable some extended support (not desired for small embedded systems) +#EXTRA_OECONF += " --disable-python" +#EXTRA_OECONF += " --disable-ocaml" +#EXTRA_OECONF += " --disable-rust" +#EXTRA_OECONF += " --disable-ruby" +#EXTRA_OECONF += " --disable-tcl" +#EXTRA_OECONF += " --disable-lua" +#EXTRA_OECONF += " --disable-vddk" diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-timeSync-Portable-way-to-print-64bit-time_t.patch b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-timeSync-Portable-way-to-print-64bit-time_t.patch new file mode 100644 index 0000000000..4a4fae116a --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools/0001-timeSync-Portable-way-to-print-64bit-time_t.patch @@ -0,0 +1,54 @@ +From dcb5d3e5d47b1e01fdcde575badc51825d4f4681 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 3 Jan 2023 13:36:01 -0800 +Subject: [PATCH] timeSync: Portable way to print 64bit time_t + +This ensures when 64bit time_t is used on 32bit architectures ( +-D_TIME_BITS=64 ) then it can print it correctly as well. + +Fixes +pllLinux.c:43:20: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat] +| prefix, tx->offset, tx->freq, tx->maxerror, tx->esterror, +| ^~~~~~~~~~ + +Upstream-Status: Submitted [https://github.com/vmware/open-vm-tools/pull/631] +Signed-off-by: Khem Raj +--- + open-vm-tools/services/plugins/timeSync/pllLinux.c | 8 ++++---- + open-vm-tools/services/plugins/timeSync/slewLinux.c | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/open-vm-tools/services/plugins/timeSync/pllLinux.c b/open-vm-tools/services/plugins/timeSync/pllLinux.c +index e9c8e61de..90ba8c63f 100644 +--- a/open-vm-tools/services/plugins/timeSync/pllLinux.c ++++ b/open-vm-tools/services/plugins/timeSync/pllLinux.c +@@ -38,10 +38,10 @@ + static void + TimeSyncLogPLLState(const char *prefix, struct timex *tx) + { +- g_debug("%s : off %ld freq %ld maxerr %ld esterr %ld status %d " +- "const %ld precision %ld tolerance %ld tick %ld\n", +- prefix, tx->offset, tx->freq, tx->maxerror, tx->esterror, +- tx->status, tx->constant, tx->precision, tx->tolerance, tx->tick); ++ g_debug("%s : off %jd freq %jd maxerr %jd esterr %jd status %d " ++ "const %jd precision %jd tolerance %jd tick %jd\n", ++ prefix, (intmax_t)tx->offset, (intmax_t)tx->freq, (intmax_t)tx->maxerror, (intmax_t)tx->esterror, ++ tx->status, (intmax_t)tx->constant, (intmax_t)tx->precision, (intmax_t)tx->tolerance, (intmax_t)tx->tick); + } + + /* +diff --git a/open-vm-tools/services/plugins/timeSync/slewLinux.c b/open-vm-tools/services/plugins/timeSync/slewLinux.c +index 1ab6e3584..0c304b5d7 100644 +--- a/open-vm-tools/services/plugins/timeSync/slewLinux.c ++++ b/open-vm-tools/services/plugins/timeSync/slewLinux.c +@@ -156,6 +156,6 @@ TimeSync_Slew(int64 delta, + g_debug("adjtimex failed: %s\n", strerror(errno)); + return FALSE; + } +- g_debug("time slew start: %ld\n", tx.tick); ++ g_debug("time slew start: %jd\n", (intmax_t)tx.tick); + return TRUE; + } +-- +2.39.0 + diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.0.bb b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.0.bb deleted file mode 100644 index 19e4ee11ed..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.0.bb +++ /dev/null @@ -1,119 +0,0 @@ -# This recipe is modified from the recipe originally found in the Open-Switch -# repository: -# -# https://github.com/open-switch/ops-build -# yocto/openswitch/meta-foss-openswitch/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.0.5.bb -# Commit 9008de2d8e100f3f868c66765742bca9fa98f3f9 -# -# The recipe packaging has been relicensed under the MIT license for inclusion -# in meta-openembedded by agreement of the author (Diego Dompe). -# - -SUMMARY = "Tools to enhance VMWare guest integration and performance" -HOMEPAGE = "https://github.com/vmware/open-vm-tools" -DESCRIPTION = "\ -open-vm-tools is a set of services and modules that enable several features in VMware products \ -for better management of and seamless user interactions with guests.\ -" -SECTION = "vmware-tools" - -LICENSE = "LGPL-2.0-only & GPL-2.0-only & BSD-2-Clause & CDDL-1.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=559317809c5444fb39ceaf6ac45c43ac" -LICENSE:modules/freebsd/vmblock = "BSD-2-Clause" -LICENSE:modules/freebsd/vmmemctl = "GPL-2.0-only" -LICENSE:modules/freebsd/vmxnet = "GPL-2.0-only" -LICENSE:modules/linux = "GPL-2.0-only" -LICENSE:modules/solaris = "CDDL-1.0" - -SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https;branch=master \ - file://tools.conf \ - file://vmtoolsd.service \ - file://vmtoolsd.init \ - file://0001-configure.ac-don-t-use-dnet-config.patch;patchdir=.. \ - file://0002-Use-configure-test-for-struct-timespec.patch;patchdir=.. \ - file://0003-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch;patchdir=.. \ - file://0004-Use-configure-to-test-for-feature-instead-of-platfor.patch;patchdir=.. \ - file://0005-Use-configure-test-for-sys-stat.h-include.patch;patchdir=.. \ - file://0006-Fix-subdir-objects-configure-error.patch;patchdir=.. \ - file://0007-include-poll.h-instead-of-sys-poll.h.patch;patchdir=.. \ - file://0008-Rename-poll.h-to-vm_poll.h.patch;patchdir=.. \ - file://0009-use-posix-strerror_r-unless-on-gnu-libc-system.patch;patchdir=.. \ - file://0010-Use-uintmax_t-for-handling-rlim_t.patch;patchdir=.. \ - file://0011-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \ - file://0012-hgfsServerLinux-Consider-64bit-time_t-possibility.patch;patchdir=.. \ - file://0013-open-vm-tools-Correct-include-path-for-poll.h.patch;patchdir=.. \ - " - -UPSTREAM_CHECK_GITTAGREGEX = "stable-(?P\d+(\.\d+)+)" - -SRC_URI:append:libc-musl = " file://0001-Add-resolv_compat.h-for-musl-builds.patch;patchdir=.. \ -" - -SRCREV = "6f5e4b13647b40a45c196dad76b1cb39cc6690b9" - -S = "${WORKDIR}/git/open-vm-tools" - -DEPENDS = "glib-2.0 glib-2.0-native util-linux libdnet procps libtirpc" - -# open-vm-tools is supported only on x86. -COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux' - -inherit autotools pkgconfig systemd update-rc.d - -SYSTEMD_SERVICE:${PN} = "vmtoolsd.service" - -EXTRA_OECONF = "--without-icu --disable-multimon --disable-docs \ - --disable-tests --without-gtkmm --without-xerces --without-pam \ - --disable-vgauth --disable-deploypkg --disable-containerinfo \ - --without-root-privileges --without-kernel-modules --with-tirpc \ - --with-udev-rules-dir=${nonarch_base_libdir}/udev/rules.d" - -NO_X11_FLAGS = "--without-x --without-gtk2 --without-gtk3" -X11_DEPENDS = "libxext libxi libxrender libxrandr libxtst gtk+ gdk-pixbuf" -PACKAGECONFIG[x11] = ",${NO_X11_FLAGS},${X11_DEPENDS}" - -# fuse gets implicitly detected; there is no --without-fuse option. -PACKAGECONFIG[fuse] = ",,fuse" - -CFLAGS:append:toolchain-clang = " -Wno-address-of-packed-member" -FILES:${PN} += "\ - ${libdir}/open-vm-tools/plugins/vmsvc/lib*.so \ - ${libdir}/open-vm-tools/plugins/common/lib*.so \ - ${sysconfdir}/vmware-tools/tools.conf \ -" -FILES:${PN}-locale += "${datadir}/open-vm-tools/messages" -FILES:${PN}-dev += "${libdir}/open-vm-tools/plugins/common/lib*.la" - -CONFFILES:${PN} += "${sysconfdir}/vmware-tools/tools.conf" - -RDEPENDS:${PN} = "util-linux libdnet fuse" - -do_install:append() { - if ! ${@bb.utils.contains('DISTRO_FEATURES','usrmerge','true','false',d)}; then - install -d ${D}/sbin - ln -sf ${sbindir}/mount.vmhgfs ${D}/sbin/mount.vmhgfs - fi - install -d ${D}${sysconfdir}/vmware-tools - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${systemd_unitdir}/system - install -m 644 ${WORKDIR}/*.service ${D}${systemd_unitdir}/system - else - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/vmtoolsd.init ${D}${sysconfdir}/init.d/vmtoolsd - fi - install -m 0644 ${WORKDIR}/tools.conf ${D}${sysconfdir}/vmware-tools/tools.conf -} - -do_configure:prepend() { - export CUSTOM_DNET_NAME=dnet - export CUSTOM_DNET_LIBS=-L${STAGING_LIBDIR}/libdnet.so -} - -INITSCRIPT_PACKAGES = "${PN}" -INITSCRIPT_NAME:${PN} = "vmtoolsd" -INITSCRIPT_PARAMS:${PN} = "start 90 2 3 4 5 . stop 60 0 1 6 ." - -python() { - if 'filesystems-layer' not in d.getVar('BBFILE_COLLECTIONS').split(): - raise bb.parse.SkipRecipe('Requires meta-filesystems to be present to provide fuse.') -} diff --git a/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.5.bb b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.5.bb new file mode 100644 index 0000000000..d389d2450c --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/open-vm-tools/open-vm-tools_12.1.5.bb @@ -0,0 +1,120 @@ +# This recipe is modified from the recipe originally found in the Open-Switch +# repository: +# +# https://github.com/open-switch/ops-build +# yocto/openswitch/meta-foss-openswitch/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.0.5.bb +# Commit 9008de2d8e100f3f868c66765742bca9fa98f3f9 +# +# The recipe packaging has been relicensed under the MIT license for inclusion +# in meta-openembedded by agreement of the author (Diego Dompe). +# + +SUMMARY = "Tools to enhance VMWare guest integration and performance" +HOMEPAGE = "https://github.com/vmware/open-vm-tools" +DESCRIPTION = "\ +open-vm-tools is a set of services and modules that enable several features in VMware products \ +for better management of and seamless user interactions with guests.\ +" +SECTION = "vmware-tools" + +LICENSE = "LGPL-2.0-only & GPL-2.0-only & BSD-2-Clause & CDDL-1.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=559317809c5444fb39ceaf6ac45c43ac" +LICENSE:modules/freebsd/vmblock = "BSD-2-Clause" +LICENSE:modules/freebsd/vmmemctl = "GPL-2.0-only" +LICENSE:modules/freebsd/vmxnet = "GPL-2.0-only" +LICENSE:modules/linux = "GPL-2.0-only" +LICENSE:modules/solaris = "CDDL-1.0" + +SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https;branch=stable-12.1.x \ + file://tools.conf \ + file://vmtoolsd.service \ + file://vmtoolsd.init \ + file://0001-configure.ac-don-t-use-dnet-config.patch;patchdir=.. \ + file://0002-Use-configure-test-for-struct-timespec.patch;patchdir=.. \ + file://0003-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch;patchdir=.. \ + file://0004-Use-configure-to-test-for-feature-instead-of-platfor.patch;patchdir=.. \ + file://0005-Use-configure-test-for-sys-stat.h-include.patch;patchdir=.. \ + file://0006-Fix-subdir-objects-configure-error.patch;patchdir=.. \ + file://0007-include-poll.h-instead-of-sys-poll.h.patch;patchdir=.. \ + file://0008-Rename-poll.h-to-vm_poll.h.patch;patchdir=.. \ + file://0009-use-posix-strerror_r-unless-on-gnu-libc-system.patch;patchdir=.. \ + file://0010-Use-uintmax_t-for-handling-rlim_t.patch;patchdir=.. \ + file://0011-Use-off64_t-instead-of-__off64_t.patch;patchdir=.. \ + file://0012-hgfsServerLinux-Consider-64bit-time_t-possibility.patch;patchdir=.. \ + file://0013-open-vm-tools-Correct-include-path-for-poll.h.patch;patchdir=.. \ + file://0001-timeSync-Portable-way-to-print-64bit-time_t.patch;patchdir=.. \ + " + +UPSTREAM_CHECK_GITTAGREGEX = "stable-(?P\d+(\.\d+)+)" + +SRC_URI:append:libc-musl = " file://0001-Add-resolv_compat.h-for-musl-builds.patch;patchdir=.. \ +" + +SRCREV = "30339ef6ded308f0147fe80f89b9bca3ace1aef9" + +S = "${WORKDIR}/git/open-vm-tools" + +DEPENDS = "glib-2.0 glib-2.0-native util-linux libdnet procps libtirpc" + +# open-vm-tools is supported only on x86. +COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux' + +inherit autotools pkgconfig systemd update-rc.d + +SYSTEMD_SERVICE:${PN} = "vmtoolsd.service" + +EXTRA_OECONF = "--without-icu --disable-multimon --disable-docs \ + --disable-tests --without-gtkmm --without-xerces --without-pam \ + --disable-vgauth --disable-deploypkg --disable-containerinfo \ + --without-root-privileges --without-kernel-modules --with-tirpc \ + --with-udev-rules-dir=${nonarch_base_libdir}/udev/rules.d" + +NO_X11_FLAGS = "--without-x --without-gtk2 --without-gtk3" +X11_DEPENDS = "libxext libxi libxrender libxrandr libxtst gtk+ gdk-pixbuf" +PACKAGECONFIG[x11] = ",${NO_X11_FLAGS},${X11_DEPENDS}" + +# fuse gets implicitly detected; there is no --without-fuse option. +PACKAGECONFIG[fuse] = ",,fuse" + +CFLAGS:append:toolchain-clang = " -Wno-address-of-packed-member" +FILES:${PN} += "\ + ${libdir}/open-vm-tools/plugins/vmsvc/lib*.so \ + ${libdir}/open-vm-tools/plugins/common/lib*.so \ + ${sysconfdir}/vmware-tools/tools.conf \ +" +FILES:${PN}-locale += "${datadir}/open-vm-tools/messages" +FILES:${PN}-dev += "${libdir}/open-vm-tools/plugins/common/lib*.la" + +CONFFILES:${PN} += "${sysconfdir}/vmware-tools/tools.conf" + +RDEPENDS:${PN} = "util-linux libdnet fuse" + +do_install:append() { + if ! ${@bb.utils.contains('DISTRO_FEATURES','usrmerge','true','false',d)}; then + install -d ${D}/sbin + ln -sf ${sbindir}/mount.vmhgfs ${D}/sbin/mount.vmhgfs + fi + install -d ${D}${sysconfdir}/vmware-tools + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 644 ${WORKDIR}/*.service ${D}${systemd_unitdir}/system + else + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/vmtoolsd.init ${D}${sysconfdir}/init.d/vmtoolsd + fi + install -m 0644 ${WORKDIR}/tools.conf ${D}${sysconfdir}/vmware-tools/tools.conf +} + +do_configure:prepend() { + export CUSTOM_DNET_NAME=dnet + export CUSTOM_DNET_LIBS=-L${STAGING_LIBDIR}/libdnet.so +} + +INITSCRIPT_PACKAGES = "${PN}" +INITSCRIPT_NAME:${PN} = "vmtoolsd" +INITSCRIPT_PARAMS:${PN} = "start 90 2 3 4 5 . stop 60 0 1 6 ." + +python() { + if 'filesystems-layer' not in d.getVar('BBFILE_COLLECTIONS').split(): + raise bb.parse.SkipRecipe('Requires meta-filesystems to be present to provide fuse.') +} diff --git a/meta-openembedded/meta-networking/recipes-support/smcroute/smcroute_2.5.5.bb b/meta-openembedded/meta-networking/recipes-support/smcroute/smcroute_2.5.5.bb deleted file mode 100644 index b0b96bed8f..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/smcroute/smcroute_2.5.5.bb +++ /dev/null @@ -1,13 +0,0 @@ -SUMMARY = "Static Multicast Routing Daemon" -DESCRIPTION = "SMCRoute is a daemon and command line tool to manipulate the multicast routing table in the UNIX kernel." -HOMEPAGE = "http://troglobit.github.io/smcroute.html" -SECTION = "net" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" - -SRCREV = "9ca7441add4427a91fe90c34ae4a178ed9a50553" -SRC_URI = "git://github.com/troglobit/smcroute.git;branch=master;protocol=https" - -S = "${WORKDIR}/git" - -inherit autotools pkgconfig diff --git a/meta-openembedded/meta-networking/recipes-support/smcroute/smcroute_2.5.6.bb b/meta-openembedded/meta-networking/recipes-support/smcroute/smcroute_2.5.6.bb new file mode 100644 index 0000000000..09752825c2 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/smcroute/smcroute_2.5.6.bb @@ -0,0 +1,13 @@ +SUMMARY = "Static Multicast Routing Daemon" +DESCRIPTION = "SMCRoute is a daemon and command line tool to manipulate the multicast routing table in the UNIX kernel." +HOMEPAGE = "http://troglobit.github.io/smcroute.html" +SECTION = "net" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" + +SRCREV = "999bdd724a1f963ac8bfd0598ffdd2a3d651646e" +SRC_URI = "git://github.com/troglobit/smcroute.git;branch=master;protocol=https" + +S = "${WORKDIR}/git" + +inherit autotools pkgconfig diff --git a/meta-openembedded/meta-networking/recipes-support/spice/spice-gtk_0.4.1.bb b/meta-openembedded/meta-networking/recipes-support/spice/spice-gtk_0.4.1.bb index 58089c0a2d..44b42a3313 100644 --- a/meta-openembedded/meta-networking/recipes-support/spice/spice-gtk_0.4.1.bb +++ b/meta-openembedded/meta-networking/recipes-support/spice/spice-gtk_0.4.1.bb @@ -1,7 +1,12 @@ SUMMARY = "A Gtk client and libraries for SPICE remote desktop servers." HOMEPAGE = "https://spice-space.org" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" +LICENSE = "LGPL-2.1-only & BSD-3-Clause & GPL-2.0-only" +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=4fbd65380cdd255951079008b364516c \ + file://subprojects/spice-common/COPYING;md5=4b54a1fd55a448865a0b32d41598759d \ + file://subprojects/keycodemapdb/LICENSE.BSD;md5=5ae30ba4123bc4f2fa49aa0b0dce887b \ + file://subprojects/keycodemapdb/LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ +" SRCREV = "74e673d7c3d9cd281d85c691fbc520107066da01" @@ -33,11 +38,16 @@ DEPENDS = " \ usbutils \ zlib \ " +DEPENDS:append:libc-musl = " libucontext" RDEPENDS:${PN} = "python3-pyparsing python3-six" -inherit meson pkgconfig vala gobject-introspection +inherit meson pkgconfig vala gobject-introspection features_check + +REQUIRED_DISTRO_FEATURES = "opengl" EXTRA_OEMESON = "-Dpie=true -Dvapi=enabled -Dintrospection=enabled" +EXTRA_OEMESON:append:libc-musl = " -Dcoroutine=libucontext" + FILES:${PN} += "${datadir}" diff --git a/meta-openembedded/meta-networking/recipes-support/tcpdump/tcpdump_4.99.1.bb b/meta-openembedded/meta-networking/recipes-support/tcpdump/tcpdump_4.99.1.bb deleted file mode 100644 index 322a826f07..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/tcpdump/tcpdump_4.99.1.bb +++ /dev/null @@ -1,53 +0,0 @@ -SUMMARY = "A sophisticated network protocol analyzer" -HOMEPAGE = "http://www.tcpdump.org/" -SECTION = "net" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5eb289217c160e2920d2e35bddc36453" - -DEPENDS = "libpcap" - -RDEPENDS:${PN}-ptest += " make perl \ - perl-module-file-basename \ - perl-module-file-spec \ - perl-module-file-spec-unix \ - perl-module-file-path \ - perl-module-file-glob \ - perl-module-data-dumper \ - perl-module-bytes \ - perl-module-posix \ - perl-module-carp \ - perl-module-cwd \ - perl-module-constant \ -" - -SRC_URI = " \ - http://www.tcpdump.org/release/${BP}.tar.gz \ - file://add-ptest.patch \ - file://run-ptest \ -" - -SRC_URI[md5sum] = "929a255c71a9933608bd7c31927760f7" -SRC_URI[sha256sum] = "79b36985fb2703146618d87c4acde3e068b91c553fb93f021a337f175fd10ebe" - -UPSTREAM_CHECK_REGEX = "tcpdump-(?P\d+(\.\d+)+)\.tar" - -inherit autotools-brokensep pkgconfig ptest - -PACKAGECONFIG ?= "openssl" - -PACKAGECONFIG[libcap-ng] = "--with-cap-ng,--without-cap-ng,libcap-ng" -PACKAGECONFIG[openssl] = "--with-crypto,--without-crypto,openssl" -PACKAGECONFIG[smi] = "--with-smi,--without-smi,libsmi" -# Note: CVE-2018-10103 (SMB - partially fixed, but SMB printing disabled) -PACKAGECONFIG[smb] = "--enable-smb,--disable-smb" - -EXTRA_AUTORECONF += "--exclude=aclocal" - -do_install:append() { - # make install installs an unneeded extra copy of the tcpdump binary - rm ${D}${bindir}/tcpdump.${PV} -} - -do_compile_ptest() { - oe_runmake buildtest-TESTS -} diff --git a/meta-openembedded/meta-networking/recipes-support/tcpdump/tcpdump_4.99.2.bb b/meta-openembedded/meta-networking/recipes-support/tcpdump/tcpdump_4.99.2.bb new file mode 100644 index 0000000000..0a541acfea --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/tcpdump/tcpdump_4.99.2.bb @@ -0,0 +1,52 @@ +SUMMARY = "A sophisticated network protocol analyzer" +HOMEPAGE = "http://www.tcpdump.org/" +SECTION = "net" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=5eb289217c160e2920d2e35bddc36453" + +DEPENDS = "libpcap" + +RDEPENDS:${PN}-ptest += " make perl \ + perl-module-file-basename \ + perl-module-file-spec \ + perl-module-file-spec-unix \ + perl-module-file-path \ + perl-module-file-glob \ + perl-module-data-dumper \ + perl-module-bytes \ + perl-module-posix \ + perl-module-carp \ + perl-module-cwd \ + perl-module-constant \ +" + +SRC_URI = " \ + http://www.tcpdump.org/release/${BP}.tar.gz \ + file://add-ptest.patch \ + file://run-ptest \ +" + +SRC_URI[sha256sum] = "f4304357d34b79d46f4e17e654f1f91f9ce4e3d5608a1badbd53295a26fb44d5" + +UPSTREAM_CHECK_REGEX = "tcpdump-(?P\d+(\.\d+)+)\.tar" + +inherit autotools-brokensep pkgconfig ptest + +PACKAGECONFIG ?= "openssl" + +PACKAGECONFIG[libcap-ng] = "--with-cap-ng,--without-cap-ng,libcap-ng" +PACKAGECONFIG[openssl] = "--with-crypto,--without-crypto,openssl" +PACKAGECONFIG[smi] = "--with-smi,--without-smi,libsmi" +# Note: CVE-2018-10103 (SMB - partially fixed, but SMB printing disabled) +PACKAGECONFIG[smb] = "--enable-smb,--disable-smb" + +EXTRA_AUTORECONF += "--exclude=aclocal" + +do_install:append() { + # make install installs an unneeded extra copy of the tcpdump binary + rm ${D}${bindir}/tcpdump.${PV} +} + +do_compile_ptest() { + oe_runmake buildtest-TESTS +} diff --git a/meta-openembedded/meta-networking/recipes-support/traceroute/traceroute_2.1.0.bb b/meta-openembedded/meta-networking/recipes-support/traceroute/traceroute_2.1.0.bb deleted file mode 100644 index 9cac204998..0000000000 --- a/meta-openembedded/meta-networking/recipes-support/traceroute/traceroute_2.1.0.bb +++ /dev/null @@ -1,45 +0,0 @@ -SUMMARY = "A new modern implementation of traceroute(8) utility for Linux systems" -DESCRIPTION = "The traceroute utility displays the route used by IP packets on \ -their way to a specified network (or Internet) host. Traceroute displays \ -the IP number and host name (if possible) of the machines along the \ -route taken by the packets. Traceroute is used as a network debugging \ -tool. If you're having network connectivity problems, traceroute will \ -show you where the trouble is coming from along the route." -SECTION = "net" -HOMEPAGE = "http://traceroute.sourceforge.net/" -LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" - -inherit update-alternatives - -UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/traceroute/files/traceroute/" - -SRC_URI = "${SOURCEFORGE_MIRROR}/traceroute/traceroute/${BP}/${BP}.tar.gz \ -" -SRC_URI[md5sum] = "84d329d67abc3fb83fc8cb12aeaddaba" -SRC_URI[sha256sum] = "3669d22a34d3f38ed50caba18cd525ba55c5c00d5465f2d20d7472e5d81603b6" - -EXTRA_OEMAKE = "VPATH=${STAGING_LIBDIR}" -LTOEXTRA += "-flto-partition=none" - -do_compile() { - oe_runmake "env=yes" -} - -do_install() { - install -d ${D}${bindir} - install -m755 ${BPN}/${BPN} ${D}${bindir} - - install -m755 wrappers/tcptraceroute ${D}${bindir} - - install -d ${D}${mandir}/man8 - install -p -m644 ${BPN}/${BPN}.8 ${D}${mandir}/man8 - ln -s ${BPN}.8 ${D}${mandir}/man8/${BPN}6.8 - ln -s ${BPN}.8 ${D}${mandir}/man8/tcptraceroute.8 - -} - -ALTERNATIVE_PRIORITY = "100" -ALTERNATIVE:${PN} = "traceroute" -ALTERNATIVE_LINK_NAME[traceroute] = "${bindir}/traceroute" diff --git a/meta-openembedded/meta-networking/recipes-support/traceroute/traceroute_2.1.1.bb b/meta-openembedded/meta-networking/recipes-support/traceroute/traceroute_2.1.1.bb new file mode 100644 index 0000000000..3892a0e21a --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/traceroute/traceroute_2.1.1.bb @@ -0,0 +1,44 @@ +SUMMARY = "A new modern implementation of traceroute(8) utility for Linux systems" +DESCRIPTION = "The traceroute utility displays the route used by IP packets on \ +their way to a specified network (or Internet) host. Traceroute displays \ +the IP number and host name (if possible) of the machines along the \ +route taken by the packets. Traceroute is used as a network debugging \ +tool. If you're having network connectivity problems, traceroute will \ +show you where the trouble is coming from along the route." +SECTION = "net" +HOMEPAGE = "http://traceroute.sourceforge.net/" +LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + +inherit update-alternatives + +UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/traceroute/files/traceroute/" + +SRC_URI = "${SOURCEFORGE_MIRROR}/traceroute/traceroute/${BP}/${BP}.tar.gz \ +" +SRC_URI[sha256sum] = "8fc8d5046e855d7588607bb319f5b82e3ba13e91d5d4636863262e6386bbaf76" + +EXTRA_OEMAKE = "VPATH=${STAGING_LIBDIR}" +LTOEXTRA += "-flto-partition=none" + +do_compile() { + oe_runmake "env=yes" +} + +do_install() { + install -d ${D}${bindir} + install -m755 ${BPN}/${BPN} ${D}${bindir} + + install -m755 wrappers/tcptraceroute ${D}${bindir} + + install -d ${D}${mandir}/man8 + install -p -m644 ${BPN}/${BPN}.8 ${D}${mandir}/man8 + ln -s ${BPN}.8 ${D}${mandir}/man8/${BPN}6.8 + ln -s ${BPN}.8 ${D}${mandir}/man8/tcptraceroute.8 + +} + +ALTERNATIVE_PRIORITY = "100" +ALTERNATIVE:${PN} = "traceroute" +ALTERNATIVE_LINK_NAME[traceroute] = "${bindir}/traceroute" diff --git a/meta-openembedded/meta-oe/conf/layer.conf b/meta-openembedded/meta-oe/conf/layer.conf index 6a0f05d930..a1f50879e8 100644 --- a/meta-openembedded/meta-oe/conf/layer.conf +++ b/meta-openembedded/meta-oe/conf/layer.conf @@ -42,7 +42,7 @@ LAYERVERSION_openembedded-layer = "1" LAYERDEPENDS_openembedded-layer = "core" -LAYERSERIES_COMPAT_openembedded-layer = "kirkstone langdale" +LAYERSERIES_COMPAT_openembedded-layer = "mickledore" LICENSE_PATH += "${LAYERDIR}/licenses" diff --git a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-Makefile.am-do-not-clobber-PYTHONPATH-from-build-env.patch b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-Makefile.am-do-not-clobber-PYTHONPATH-from-build-env.patch new file mode 100644 index 0000000000..089ed23c73 --- /dev/null +++ b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-Makefile.am-do-not-clobber-PYTHONPATH-from-build-env.patch @@ -0,0 +1,55 @@ +From 5e3b74927b4fef03d91518d235e9e3ba8cd7ab2e Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Wed, 9 Nov 2022 20:49:41 +0100 +Subject: [PATCH] Makefile.am: do not clobber PYTHONPATH from build environment + +This environment variable has special significance for python, +and so lirc's variable has to be named something else. + +Signed-off-by: Alexander Kanavin +--- + Makefile.am | 2 +- + pylint.mak | 2 +- + tools/Makefile.am | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 6718af1..fae423e 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -128,7 +128,7 @@ endif + + pylint: .phony + $(MAKE) -C tools pylint +- -PYTHONPATH=$(PYTHONPATH) $(PYLINT) --rcfile=pylint.conf \ ++ -PYTHONPATH=$(LIRCPYTHONPATH) $(PYLINT) --rcfile=pylint.conf \ + --msg-template='$(pylint_template)' $(py_PYTHON) + + pep8: $(py_PYTHON) +diff --git a/pylint.mak b/pylint.mak +index bf427ab..2692951 100644 +--- a/pylint.mak ++++ b/pylint.mak +@@ -1,5 +1,5 @@ + PYTHONPATH1 = $(abs_top_srcdir)/python-pkg/lirc: + PYTHONPATH2 = $(abs_top_srcdir)/python-pkg/lirc/lib/.libs +-PYTHONPATH = $(PYTHONPATH1):$(PYTHONPATH2) ++LIRCPYTHONPATH = $(PYTHONPATH1):$(PYTHONPATH2) + PYLINT = python3-pylint + pylint_template = {path}:{line}: [{msg_id}({symbol}), {obj}] {msg} +diff --git a/tools/Makefile.am b/tools/Makefile.am +index 85d1fd0..96b17f8 100644 +--- a/tools/Makefile.am ++++ b/tools/Makefile.am +@@ -142,7 +142,7 @@ force-pylint: .phony + + pylint: .pylint-stamp + .pylint-stamp: $(py_sources) +- -PYTHONPATH=$(PYTHONPATH) $(PYLINT) --rcfile=../pylint.conf \ ++ -PYTHONPATH=$(LIRCPYTHONPATH) $(PYLINT) --rcfile=../pylint.conf \ + --msg-template='$(pylint_template)' $? && touch $@ + + .phony: +-- +2.30.2 + diff --git a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.2.bb b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.2.bb index 234d347af7..458d9d7cdd 100644 --- a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.2.bb +++ b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.10.2.bb @@ -11,16 +11,17 @@ DEPENDS = "libxslt-native alsa-lib libftdi libusb1 libusb-compat jack portaudio- LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" SRC_URI = "http://prdownloads.sourceforge.net/lirc/lirc-${PV}.tar.bz2 \ - file://0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch \ - file://fix_build_errors.patch \ - file://0001-mplay-Fix-build-with-musl.patch \ - file://lircd.service \ - file://lircd.init \ - file://lircexec.init \ - file://lircd.conf \ - file://lirc_options.conf \ - file://lirc.tmpfiles \ -" + file://0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch \ + file://fix_build_errors.patch \ + file://0001-mplay-Fix-build-with-musl.patch \ + file://lircd.service \ + file://lircd.init \ + file://lircexec.init \ + file://lircd.conf \ + file://lirc_options.conf \ + file://lirc.tmpfiles \ + file://0001-Makefile.am-do-not-clobber-PYTHONPATH-from-build-env.patch \ + " SRC_URI[sha256sum] = "3d44ec8274881cf262f160805641f0827ffcc20ade0d85e7e6f3b90e0d3d222a" SYSTEMD_PACKAGES = "lirc lirc-exec" diff --git a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-wiredtiger-Avoid-using-off64_t.patch b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-wiredtiger-Avoid-using-off64_t.patch new file mode 100644 index 0000000000..abe6898554 --- /dev/null +++ b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-wiredtiger-Avoid-using-off64_t.patch @@ -0,0 +1,30 @@ +From 0508c1518c2e7c586a231d344e9f93b08507885b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 31 Dec 2022 14:23:40 -0800 +Subject: [PATCH] wiredtiger: Avoid using off64_t + +off64_t is not available on musl since off_t is already 64bit by +default. Therefore replace using off64_t with off_t + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + src/third_party/wiredtiger/src/os_posix/os_fs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/third_party/wiredtiger/src/os_posix/os_fs.c b/src/third_party/wiredtiger/src/os_posix/os_fs.c +index 3898eb74343..9ce2d5edb38 100644 +--- a/src/third_party/wiredtiger/src/os_posix/os_fs.c ++++ b/src/third_party/wiredtiger/src/os_posix/os_fs.c +@@ -533,7 +533,7 @@ __posix_file_sync_nowait(WT_FILE_HANDLE *file_handle, WT_SESSION *wt_session) + pfh = (WT_FILE_HANDLE_POSIX *)file_handle; + + /* See comment in __posix_sync(): sync cannot be retried or fail. */ +- WT_SYSCALL(sync_file_range(pfh->fd, (off64_t)0, (off64_t)0, SYNC_FILE_RANGE_WRITE), ret); ++ WT_SYSCALL(sync_file_range(pfh->fd, 0, 0, SYNC_FILE_RANGE_WRITE), ret); + if (ret == 0) + return (0); + +-- +2.39.0 + diff --git a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb index d040ab160b..6e93ec9b0c 100644 --- a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +++ b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb @@ -38,6 +38,7 @@ SRC_URI:append:libc-musl ="\ file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \ file://0002-Fix-default-stack-size-to-256K.patch \ file://0004-wiredtiger-Disable-strtouq-on-musl.patch \ + file://0001-wiredtiger-Avoid-using-off64_t.patch \ " SRC_URI:append:toolchain-clang = "\ diff --git a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.6.4.bb b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.6.4.bb deleted file mode 100644 index 691bbce9ac..0000000000 --- a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.6.4.bb +++ /dev/null @@ -1,29 +0,0 @@ -DESCRIPTION="Protocol Buffers with small code size" -LICENSE="Zlib" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f" - -DEPENDS = "protobuf-native" - -SRC_URI = "git://github.com/nanopb/nanopb.git;branch=master;protocol=https" -SRCREV = "afc499f9a410fc9bbf6c9c48cdd8d8b199d49eb4" - -S = "${WORKDIR}/git" - -inherit cmake python3native - -do_install:append() { - install -Dm 0755 ${S}/generator/nanopb_generator.py ${D}${bindir}/nanopb_generator.py - install -Dm 0755 ${S}/generator/protoc-gen-nanopb ${D}${bindir}/protoc-gen-nanopb - install -Dm 0755 ${S}/generator/proto/__init__.py ${D}${PYTHON_SITEPACKAGES_DIR}/proto/__init__.py -} - -FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" -FILES:${PN}-dev += "${libdir}/cmake/${BPN}" - -RDEPENDS:${PN} += "\ - ${PYTHON_PN}-protobuf \ - protobuf-compiler \ -" - -BBCLASSEXTEND = "native nativesdk" - diff --git a/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb new file mode 100644 index 0000000000..897caea2a7 --- /dev/null +++ b/meta-openembedded/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb @@ -0,0 +1,29 @@ +DESCRIPTION="Protocol Buffers with small code size" +LICENSE="Zlib" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f" + +DEPENDS = "protobuf-native" + +SRC_URI = "git://github.com/nanopb/nanopb.git;branch=master;protocol=https" +SRCREV = "b97aa657a706d3ba4a9a6ccca7043c9d6fe41cba" + +S = "${WORKDIR}/git" + +inherit cmake python3native + +do_install:append() { + install -Dm 0755 ${S}/generator/nanopb_generator.py ${D}${bindir}/nanopb_generator.py + install -Dm 0755 ${S}/generator/protoc-gen-nanopb ${D}${bindir}/protoc-gen-nanopb + install -Dm 0755 ${S}/generator/proto/__init__.py ${D}${PYTHON_SITEPACKAGES_DIR}/proto/__init__.py +} + +FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" +FILES:${PN}-dev += "${libdir}/cmake/${BPN}" + +RDEPENDS:${PN} += "\ + ${PYTHON_PN}-protobuf \ + protobuf-compiler \ +" + +BBCLASSEXTEND = "native nativesdk" + diff --git a/meta-openembedded/meta-oe/recipes-benchmark/memtester/memtester_4.5.1.bb b/meta-openembedded/meta-oe/recipes-benchmark/memtester/memtester_4.5.1.bb deleted file mode 100644 index 9df450cbaa..0000000000 --- a/meta-openembedded/meta-oe/recipes-benchmark/memtester/memtester_4.5.1.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "Utility to test for faulty memory subsystem" -HOMEPAGE = "http://pyropus.ca/software/memtester/" -SECTION = "console/utils" -LICENSE = "GPL-2.0-only" - -LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3" - -SRC_URI = "http://pyropus.ca/software/memtester/old-versions/${BP}.tar.gz \ - file://Makefile.patch \ - " -SRC_URI[md5sum] = "1bc22c01e987d6a67fac39dc5656a4d3" -SRC_URI[sha256sum] = "1c5fc2382576c084b314cfd334d127a66c20bd63892cac9f445bc1d8b4ca5a47" - -do_compile () { - echo '${CC} ${CFLAGS} -DPOSIX -c' > conf-cc - echo '${CC} ${LDFLAGS}' > conf-ld - oe_runmake -} - -do_install () { - install -d ${D}${bindir} - install -d ${D}${mandir}/man8 - install -m 0755 memtester ${D}${bindir}/ - install -m 0755 memtester.8 ${D}${mandir}/man8/ -} diff --git a/meta-openembedded/meta-oe/recipes-benchmark/memtester/memtester_4.6.0.bb b/meta-openembedded/meta-oe/recipes-benchmark/memtester/memtester_4.6.0.bb new file mode 100644 index 0000000000..42cee1108d --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-benchmark/memtester/memtester_4.6.0.bb @@ -0,0 +1,24 @@ +SUMMARY = "Utility to test for faulty memory subsystem" +HOMEPAGE = "http://pyropus.ca/software/memtester/" +SECTION = "console/utils" +LICENSE = "GPL-2.0-only" + +LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3" + +SRC_URI = "http://pyropus.ca/software/memtester/old-versions/${BP}.tar.gz \ + file://Makefile.patch \ + " +SRC_URI[sha256sum] = "c9fe4eb7e80c8cef5202f9065c4c0682f5616647c0455e916a5700f98e3dbb2e" + +do_compile () { + echo '${CC} ${CFLAGS} -DPOSIX -c' > conf-cc + echo '${CC} ${LDFLAGS}' > conf-ld + oe_runmake +} + +do_install () { + install -d ${D}${bindir} + install -d ${D}${mandir}/man8 + install -m 0755 memtester ${D}${bindir}/ + install -m 0755 memtester.8 ${D}${mandir}/man8/ +} diff --git a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0001-configure-Add-with-cpu.patch b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0001-configure-Add-with-cpu.patch new file mode 100644 index 0000000000..41fb456c6c --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0001-configure-Add-with-cpu.patch @@ -0,0 +1,37 @@ +From 73049e5a9e3698cc6d51471d70ac5e06bed803cc Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 17 Dec 2022 10:24:48 -0800 +Subject: [PATCH] configure: Add --with-cpu + +Some cross build systems e.g. yocto may use architectures different from cross compiler target tuple +arm-yoe-gnueabi but build for armv7a, AC_CANONICAL_HOST will fail in +this case even though target will be armv7a it will detect it as arm and +disable armv7a specific optimization paths. This option provides the +needed knob so it can be set explicitly e.g. --with-cpu=armv7a etc. if needed. + +Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] +Signed-off-by: Khem Raj +--- + configure.ac | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index c839c87..403728c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -11,7 +11,14 @@ else + AC_MSG_NOTICE([Compiling with dynamically linked libraries.]) + fi + +-AC_CANONICAL_HOST ++AC_ARG_WITH(cpu, [ --with-cpu define host cpu]) ++ ++if test -z "$with_cpu" ++then ++ AC_CANONICAL_HOST ++else ++ host_cpu=$with_cpu ++fi + # Checking for target cpu and setting custom configuration + # for the different platforms + AS_CASE(["$host_cpu"], diff --git a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0002-Replace-lfs64-functions-and-defines.patch b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0002-Replace-lfs64-functions-and-defines.patch new file mode 100644 index 0000000000..48ff3ef93b --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0002-Replace-lfs64-functions-and-defines.patch @@ -0,0 +1,103 @@ +From 9ab360fd018d267fe174713d7e14454408b26043 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 17 Dec 2022 10:33:01 -0800 +Subject: [PATCH] Replace lfs64 functions and defines + +AC_SYS_LARGEFILE is already in use in configure.ac which detects +enabling lfs64 functions as needed, it will define _FILE_OFFSET_BITS=64 +which should make lseek same as lseek64 since off_t is 64bit on most of +current 32bit linux platforms + +Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] +Signed-off-by: Khem Raj +--- + src/os.cc | 18 ++++++------------ + src/worker.cc | 6 +++--- + 2 files changed, 9 insertions(+), 15 deletions(-) + +diff --git a/src/os.cc b/src/os.cc +index 1928e0a..faa6068 100644 +--- a/src/os.cc ++++ b/src/os.cc +@@ -142,7 +142,7 @@ int OsLayer::AddressMode() { + uint64 OsLayer::VirtualToPhysical(void *vaddr) { + uint64 frame, paddr, pfnmask, pagemask; + int pagesize = sysconf(_SC_PAGESIZE); +- off64_t off = ((uintptr_t)vaddr) / pagesize * 8; ++ off_t off = ((uintptr_t)vaddr) / pagesize * 8; + int fd = open(kPagemapPath, O_RDONLY); + + /* +@@ -154,7 +154,7 @@ uint64 OsLayer::VirtualToPhysical(void *vaddr) { + if (fd < 0) + return 0; + +- if (lseek64(fd, off, SEEK_SET) != off || read(fd, &frame, 8) != 8) { ++ if (lseek(fd, off, SEEK_SET) != off || read(fd, &frame, 8) != 8) { + int err = errno; + string errtxt = ErrorString(err); + logprintf(0, "Process Error: failed to access %s with errno %d (%s)\n", +@@ -607,9 +607,9 @@ bool OsLayer::AllocateTestMem(int64 length, uint64 paddr_base) { + dynamic_mapped_shmem_ = true; + } else { + // Do a full mapping here otherwise. +- shmaddr = mmap64(NULL, length, PROT_READ | PROT_WRITE, +- MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE, +- shm_object, 0); ++ shmaddr = mmap(NULL, length, PROT_READ | PROT_WRITE, ++ MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE, ++ shm_object, 0); + if (shmaddr == reinterpret_cast(-1)) { + int err = errno; + string errtxt = ErrorString(err); +@@ -704,18 +704,12 @@ void *OsLayer::PrepareTestMem(uint64 offset, uint64 length) { + if (dynamic_mapped_shmem_) { + // TODO(nsanders): Check if we can support MAP_NONBLOCK, + // and evaluate performance hit from not using it. +-#ifdef HAVE_MMAP64 +- void * mapping = mmap64(NULL, length, PROT_READ | PROT_WRITE, +- MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE, +- shmid_, offset); +-#else + void * mapping = mmap(NULL, length, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE, + shmid_, offset); +-#endif + if (mapping == MAP_FAILED) { + string errtxt = ErrorString(errno); +- logprintf(0, "Process Error: PrepareTestMem mmap64(%llx, %llx) failed. " ++ logprintf(0, "Process Error: PrepareTestMem mmap(%llx, %llx) failed. " + "error: %s.\n", + offset, length, errtxt.c_str()); + sat_assert(0); +diff --git a/src/worker.cc b/src/worker.cc +index 745a816..41e93a0 100644 +--- a/src/worker.cc ++++ b/src/worker.cc +@@ -1705,7 +1705,7 @@ bool FileThread::WritePages(int fd) { + int strict = sat_->strict(); + + // Start fresh at beginning of file for each batch of pages. +- lseek64(fd, 0, SEEK_SET); ++ lseek(fd, 0, SEEK_SET); + for (int i = 0; i < sat_->disk_pages(); i++) { + struct page_entry src; + if (!GetValidPage(&src)) +@@ -1943,7 +1943,7 @@ bool FileThread::ReadPages(int fd) { + bool result = true; + + // Read our data back out of the file, into it's new location. +- lseek64(fd, 0, SEEK_SET); ++ lseek(fd, 0, SEEK_SET); + for (int i = 0; i < sat_->disk_pages(); i++) { + struct page_entry dst; + if (!GetEmptyPage(&dst)) +@@ -3153,7 +3153,7 @@ bool DiskThread::ValidateBlockOnDisk(int fd, BlockData *block) { + + // Read block from disk and time the read. If it takes longer than the + // threshold, complain. +- if (lseek64(fd, address * kSectorSize, SEEK_SET) == -1) { ++ if (lseek(fd, address * kSectorSize, SEEK_SET) == -1) { + logprintf(0, "Process Error: Unable to seek to sector %lld in " + "DiskThread::ValidateSectorsOnDisk on disk %s " + "(thread %d).\n", address, device_name_.c_str(), thread_num_); diff --git a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch new file mode 100644 index 0000000000..b21a534d94 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch @@ -0,0 +1,43 @@ +From d64a282b57352dde5f5b007947c005e504dc9a6b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 17 Dec 2022 10:46:31 -0800 +Subject: [PATCH] configure: Check for pthread_rwlockattr_setkind_np before use + +musl does not implement this therefore detect this non-posix API before +using it + +Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] +Signed-off-by: Khem Raj +--- + configure.ac | 1 + + src/worker.cc | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 403728c..47968cb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -157,6 +157,7 @@ AC_FUNC_STRERROR_R + AC_FUNC_VPRINTF + AC_CHECK_FUNCS([ftruncate gettimeofday memset munmap select socket strtol strtoull]) + AC_CHECK_FUNCS([mmap64 posix_memalign rand_r sched_getaffinity]) ++AC_CHECK_FUNCS([pthread_rwlockattr_setkind_np]) + + AC_CONFIG_FILES([Makefile src/Makefile]) + AC_OUTPUT +diff --git a/src/worker.cc b/src/worker.cc +index 41e93a0..c4abc87 100644 +--- a/src/worker.cc ++++ b/src/worker.cc +@@ -133,9 +133,11 @@ void WorkerStatus::Initialize() { + + pthread_rwlockattr_t attrs; + sat_assert(0 == pthread_rwlockattr_init(&attrs)); ++#ifdef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP + // Avoid writer lock starvation. + sat_assert(0 == pthread_rwlockattr_setkind_np( + &attrs, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)); ++#endif + sat_assert(0 == pthread_rwlock_init(&status_rwlock_, &attrs)); + + #ifdef HAVE_PTHREAD_BARRIERS diff --git a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/libcplusplus-compat.patch b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/libcplusplus-compat.patch index f5e7da359d..8754e40697 100644 --- a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/libcplusplus-compat.patch +++ b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/libcplusplus-compat.patch @@ -11,7 +11,7 @@ Fixes ./sattypes.h:33:17: error: expected namespace name using namespace __gnu_cxx; //NOLINT -Upstream-Status: Pending +Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] Signed-off-by: Khem Raj --- stressapptest-1.0.9.orig/src/sattypes.h diff --git a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/read_sysfs_for_cachesize.patch b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/read_sysfs_for_cachesize.patch index 8c251aeb97..19261657ac 100644 --- a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/read_sysfs_for_cachesize.patch +++ b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest/read_sysfs_for_cachesize.patch @@ -2,7 +2,7 @@ sysconf params like _SC_LEVEL1_DCACHE_LINESIZE are not universally implemented, therefore check for them being available, if not there then read the sysfs directly to get the value -Upstream-Status: Pending +Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] Signed-off-by: Khem Raj --- a/src/sat.cc +++ b/src/sat.cc diff --git a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest_1.0.9.bb b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest_1.0.9.bb index d30ea5a01b..02144c558a 100644 --- a/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest_1.0.9.bb +++ b/meta-openembedded/meta-oe/recipes-benchmark/stressapptest/stressapptest_1.0.9.bb @@ -9,12 +9,22 @@ SECTION = "benchmark" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://COPYING;md5=55ea9d559f985fb4834317d8ed6b9e58" -SRCREV = "fb72e5e5f0879231f38e0e826a98a6ca2d1ca38e" +SRCREV = "9146a8bfe3e3daefa95f7a61b75183e5fc64af2c" +PV .= "+1.0.10git${SRCPV}" + +EXTRA_AUTOCONF:append:armv7a = " --with-cpu=armv7a" +EXTRA_AUTOCONF:append:armv7ve = " --with-cpu=armv7a" + +GI_DATA_ENABLED:libc-musl:armv7a = "False" +GI_DATA_ENABLED:libc-musl:armv7ve = "False" SRC_URI = "git://github.com/stressapptest/stressapptest;branch=master;protocol=https \ file://libcplusplus-compat.patch \ file://read_sysfs_for_cachesize.patch \ - " + file://0001-configure-Add-with-cpu.patch \ + file://0002-Replace-lfs64-functions-and-defines.patch \ + file://0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch \ + " S = "${WORKDIR}/git" diff --git a/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench/0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch b/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench/0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch deleted file mode 100644 index d628e81b56..0000000000 --- a/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench/0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch +++ /dev/null @@ -1,40 +0,0 @@ -From c1ebf893e32a0a77e820484d48a903523fef7c1b Mon Sep 17 00:00:00 2001 -From: Vasily Tarasov -Date: Fri, 10 Jun 2016 14:33:48 -0400 -Subject: [PATCH] Adding volatile modifier to tmp variable in memory test - -Issue explanation: - -./sysbench/sysbench --test=memory --num-threads=16 \ - --memory-block-size=268435456 \ - --memory-total-size=137438953472 \ - --memory-oper=read \ - --memory-access-mode=seq \ - --memory-scope=local run - -Without this commit the time to run the above command is 0.0004 seconds. -With this commit the time is greater than 3 seconds. Essentially, -without the volatile modifier, the compiler optimizes read access so -that no real access happens. - -Upstream-Status: Backport [part of v1.0.0 https://github.com/akopytov/sysbench/commit/8753cb93be4c0b81a20b704ced91e7a422da52b1] - -(cherry picked from commit 8753cb93be4c0b81a20b704ced91e7a422da52b1) -Signed-off-by: massimo toscanelli ---- - sysbench/tests/memory/sb_memory.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sysbench/tests/memory/sb_memory.c b/sysbench/tests/memory/sb_memory.c -index 2e8998f..7d22bb9 100644 ---- a/sysbench/tests/memory/sb_memory.c -+++ b/sysbench/tests/memory/sb_memory.c -@@ -244,7 +244,7 @@ sb_request_t memory_get_request(int tid) - int memory_execute_request(sb_request_t *sb_req, int thread_id) - { - sb_mem_request_t *mem_req = &sb_req->u.mem_request; -- int tmp = 0; -+ volatile int tmp = 0; - int idx; - int *buf, *end; - log_msg_t msg; diff --git a/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench_0.4.12.bb b/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench_0.4.12.bb deleted file mode 100644 index 4ac78fb8fd..0000000000 --- a/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench_0.4.12.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "System performance benchmark" -HOMEPAGE = "http://github.com/akopytov/sysbench" -SECTION = "console/tests" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" - -inherit autotools - -# The project has moved from Sourceforge to Launchpad, to Github. Use the source tarball from -# Launchpad until the next release is available from Github. -SRC_URI = "https://launchpad.net/ubuntu/+archive/primary/+files/${BPN}_${PV}.orig.tar.gz \ - file://0001-Adding-volatile-modifier-to-tmp-variable-in-memory-t.patch \ - " - -SRC_URI[md5sum] = "3a6d54fdd3fe002328e4458206392b9d" -SRC_URI[sha256sum] = "83fa7464193e012c91254e595a89894d8e35b4a38324b52a5974777e3823ea9e" - -EXTRA_OECONF += "--enable-largefile" -PACKAGECONFIG ??= "" -PACKAGECONFIG[aio] = "--enable-aio,--disable-aio,libaio," -PACKAGECONFIG[mysql] = "--with-mysql \ - --with-mysql-includes=${STAGING_INCDIR}/mysql \ - --with-mysql-libs=${STAGING_LIBDIR}, \ - --without-mysql,mysql5" - -do_configure:prepend() { - touch ${S}/NEWS ${S}/AUTHORS -} diff --git a/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench_1.0.20.bb b/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench_1.0.20.bb new file mode 100644 index 0000000000..945e2c3274 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-benchmark/sysbench/sysbench_1.0.20.bb @@ -0,0 +1,30 @@ +SUMMARY = "System performance benchmark" +HOMEPAGE = "http://github.com/akopytov/sysbench" +SECTION = "console/tests" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +DEPENDS = "libtool libaio luajit concurrencykit" + +inherit autotools-brokensep pkgconfig + +# The project has moved from Sourceforge to Launchpad, to Github. Use the source tarball from +# Launchpad until the next release is available from Github. +SRC_URI = "git://github.com/akopytov/sysbench.git;protocol=https;branch=master" +SRCREV = "ebf1c90da05dea94648165e4f149abc20c979557" + +S = "${WORKDIR}/git" + +COMPATIBLE_HOST = "(arm|aarch64|i.86|x86_64).*-linux*" + +EXTRA_OECONF += "--enable-largefile --with-system-luajit --with-system-ck --without-gcc-arch" +PACKAGECONFIG ??= "" +PACKAGECONFIG[aio] = "--enable-aio,--disable-aio,libaio," +PACKAGECONFIG[mysql] = "--with-mysql \ + --with-mysql-includes=${STAGING_INCDIR}/mysql \ + --with-mysql-libs=${STAGING_LIBDIR}, \ + --without-mysql,mysql5" + +do_configure:prepend() { + touch ${S}/NEWS ${S}/AUTHORS +} diff --git a/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom/0001-typecast-enum-conversions-explicitly.patch b/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom/0001-typecast-enum-conversions-explicitly.patch deleted file mode 100644 index f2302dbcc3..0000000000 --- a/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom/0001-typecast-enum-conversions-explicitly.patch +++ /dev/null @@ -1,45 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 3a0c1966e4c66f91e6e8551e906b6db38002acb4 Mon Sep 17 00:00:00 2001 -From: Angel Pons -Date: Wed, 27 May 2020 12:15:51 +0200 -Subject: [PATCH] libflashrom.c: Use casts on enum conversions - -This allows flashrom to build with GCC 10. - -Change-Id: I2166cdf3681452631ef8e980face2924e9a6c81a -Signed-off-by: Angel Pons -Reviewed-on: https://review.coreboot.org/c/flashrom/+/41775 -Tested-by: build bot (Jenkins) -Reviewed-by: HAOUAS Elyes ---- - libflashrom.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/libflashrom.c b/libflashrom.c -index ab7e364..c20d9c7 100644 ---- a/libflashrom.c -+++ b/libflashrom.c -@@ -188,7 +188,8 @@ struct flashrom_board_info *flashrom_supported_boards(void) - for (; i < boards_known_size; ++i) { - supported_boards[i].vendor = binfo[i].vendor; - supported_boards[i].name = binfo[i].name; -- supported_boards[i].working = binfo[i].working; -+ supported_boards[i].working = -+ (enum flashrom_test_state) binfo[i].working; - } - } else { - msg_gerr("Memory allocation error!\n"); -@@ -226,7 +227,8 @@ struct flashrom_chipset_info *flashrom_supported_chipsets(void) - supported_chipsets[i].chipset = chipset[i].device_name; - supported_chipsets[i].vendor_id = chipset[i].vendor_id; - supported_chipsets[i].chipset_id = chipset[i].device_id; -- supported_chipsets[i].status = chipset[i].status; -+ supported_chipsets[i].status = -+ (enum flashrom_test_state) chipset[i].status; - } - } else { - msg_gerr("Memory allocation error!\n"); --- -2.25.1 diff --git a/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom_1.2.1.bb b/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom_1.2.1.bb new file mode 100644 index 0000000000..b2592d294b --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom_1.2.1.bb @@ -0,0 +1,20 @@ +DESCRIPTION = "flashrom is a utility for identifying, reading, writing, verifying and erasing flash chips" +LICENSE = "GPL-2.0-or-later" +HOMEPAGE = "http://flashrom.org" + +LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" +SRC_URI = "https://download.flashrom.org/releases/flashrom-v${PV}.tar.bz2 \ + file://meson-fixes.patch \ + file://0001-flashrom-Mark-RISCV-as-non-memory-mapped-I-O-archite.patch \ + file://0001-hwaccess-use-__asm__-as-is-done-elsewhere.patch \ + " +SRC_URI[sha256sum] = "89a7ff5beb08c89b8795bbd253a51b9453547a864c31793302296b56bbc56d65" + +S = "${WORKDIR}/flashrom-v${PV}" + +inherit meson pkgconfig + +PACKAGECONFIG ??= "pci usb ftdi" +PACKAGECONFIG[pci] = "-Dpciutils=true,-Dpciutils=false,pciutils" +PACKAGECONFIG[usb] = "-Dusb=true,-Dusb=false,libusb" +PACKAGECONFIG[ftdi] = "-Dftdi=true,-Dftdi=false,libftdi" diff --git a/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb b/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb deleted file mode 100644 index bdc3ca084c..0000000000 --- a/meta-openembedded/meta-oe/recipes-bsp/flashrom/flashrom_1.2.bb +++ /dev/null @@ -1,22 +0,0 @@ -DESCRIPTION = "flashrom is a utility for identifying, reading, writing, verifying and erasing flash chips" -LICENSE = "GPL-2.0-or-later" -HOMEPAGE = "http://flashrom.org" - -LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" -SRC_URI = "https://download.flashrom.org/releases/flashrom-v${PV}.tar.bz2 \ - file://0001-typecast-enum-conversions-explicitly.patch \ - file://meson-fixes.patch \ - file://0001-flashrom-Mark-RISCV-as-non-memory-mapped-I-O-archite.patch \ - file://0001-hwaccess-use-__asm__-as-is-done-elsewhere.patch \ - " -SRC_URI[md5sum] = "7f8e4b87087eb12ecee0fcc5445b4956" -SRC_URI[sha256sum] = "e1f8d95881f5a4365dfe58776ce821dfcee0f138f75d0f44f8a3cd032d9ea42b" - -S = "${WORKDIR}/flashrom-v${PV}" - -inherit meson pkgconfig - -PACKAGECONFIG ??= "pci usb ftdi" -PACKAGECONFIG[pci] = "-Dpciutils=true,-Dpciutils=false,pciutils" -PACKAGECONFIG[usb] = "-Dusb=true,-Dusb=false,libusb" -PACKAGECONFIG[ftdi] = "-Dftdi=true,-Dftdi=false,libftdi" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/gensio/files/0001-configure-Check-for-request_init-API-when-probing-fo.patch b/meta-openembedded/meta-oe/recipes-connectivity/gensio/files/0001-configure-Check-for-request_init-API-when-probing-fo.patch deleted file mode 100644 index 3b4caa2215..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/gensio/files/0001-configure-Check-for-request_init-API-when-probing-fo.patch +++ /dev/null @@ -1,31 +0,0 @@ -From f56e59712d8708c74a4cf66d24b5703fc16b22ae Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 1 Sep 2022 11:31:48 -0700 -Subject: [PATCH] configure: Check for request_init API when probing for - libwrap - -checking for main() is not right check, since this function is not part -of libwrap but the app. Newer autocof and toolchain may fail - -Upstream-Status: Submitted [https://github.com/cminyard/gensio/pull/48] -Signed-off-by: Khem Raj ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 90cfcb6b..1c06d918 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -109,7 +109,7 @@ AC_ARG_WITH(tcp-wrappers, - if test "$tcp_wrappers" != "no" - then - AC_CHECK_HEADERS([tcpd.h]) -- AC_CHECK_LIB(wrap,main) -+ AC_CHECK_LIB(wrap,request_init) - fi - - AC_ARG_ENABLE([doc], --- -2.37.3 - diff --git a/meta-openembedded/meta-oe/recipes-connectivity/gensio/files/0001-tools-gensiot-Fix-build-with-musl.patch b/meta-openembedded/meta-oe/recipes-connectivity/gensio/files/0001-tools-gensiot-Fix-build-with-musl.patch deleted file mode 100644 index 93831c380f..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/gensio/files/0001-tools-gensiot-Fix-build-with-musl.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 823b6754a4d7655480b6e8576a9d0037f842d653 Mon Sep 17 00:00:00 2001 -From: Jan Luebbe -Date: Thu, 25 Aug 2022 12:19:16 +0200 -Subject: [PATCH] tools:gensiot: Fix build with musl - -According to POSIX getpid() is available in unistd.h, not sys/unistd.h. - -Upstream-Status: Submitted [https://github.com/cminyard/gensio/pull/47] -Signed-off-by: Jan Luebbe ---- - tools/gensiotool.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/gensiotool.c b/tools/gensiotool.c -index cac531bb4b74..ab0bb9583f9f 100644 ---- a/tools/gensiotool.c -+++ b/tools/gensiotool.c -@@ -44,7 +44,7 @@ - #include - #include - #include --#include -+#include - #include - #endif - --- -2.30.2 - diff --git a/meta-openembedded/meta-oe/recipes-connectivity/gensio/gensio_2.5.2.bb b/meta-openembedded/meta-oe/recipes-connectivity/gensio/gensio_2.5.2.bb deleted file mode 100644 index d6b5f1987e..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/gensio/gensio_2.5.2.bb +++ /dev/null @@ -1,27 +0,0 @@ -SUMMARY = "A library to abstract stream I/O like serial port, TCP, telnet, etc" -HOMEPAGE = "https://github.com/cminyard/gensio" -LICENSE = "GPL-2.0-only & LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a0fd36908af843bcee10cb6dfc47fa67 \ - file://COPYING;md5=bae3019b4c6dc4138c217864bd04331f \ - " - -SRCREV = "b6cd354afe6d5f63bc859c94fd3a455a3cdf0449" - -SRC_URI = "git://github.com/cminyard/gensio;protocol=https;branch=master \ - file://0001-tools-gensiot-Fix-build-with-musl.patch \ - file://0001-configure-Check-for-request_init-API-when-probing-fo.patch \ -" - -S = "${WORKDIR}/git" - -inherit autotools - -PACKAGECONFIG ??= "openssl tcp-wrappers" - -PACKAGECONFIG[openssl] = "--with-openssl=${STAGING_DIR_HOST}${prefix},--without-openssl, openssl" -PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers, tcp-wrappers" -PACKAGECONFIG[swig] = "--with-swig,--without-swig, swig" - -EXTRA_OECONF = "--without-python" - -RDEPENDS:${PN} += "bash" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/gensio/gensio_2.6.1.bb b/meta-openembedded/meta-oe/recipes-connectivity/gensio/gensio_2.6.1.bb new file mode 100644 index 0000000000..91450e2c77 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-connectivity/gensio/gensio_2.6.1.bb @@ -0,0 +1,24 @@ +SUMMARY = "A library to abstract stream I/O like serial port, TCP, telnet, etc" +HOMEPAGE = "https://github.com/cminyard/gensio" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a0fd36908af843bcee10cb6dfc47fa67 \ + file://COPYING;md5=bae3019b4c6dc4138c217864bd04331f \ + " + +SRCREV = "d512218c4fa5667d4fe15977d3f15f05591f1f1a" + +SRC_URI = "git://github.com/cminyard/gensio;protocol=https;branch=master" + +S = "${WORKDIR}/git" + +inherit autotools + +PACKAGECONFIG ??= "openssl tcp-wrappers" + +PACKAGECONFIG[openssl] = "--with-openssl=${STAGING_DIR_HOST}${prefix},--without-openssl, openssl" +PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers, tcp-wrappers" +PACKAGECONFIG[swig] = "--with-swig,--without-swig, swig" + +EXTRA_OECONF = "--without-python" + +RDEPENDS:${PN} += "bash" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/iwd/iwd_1.30.bb b/meta-openembedded/meta-oe/recipes-connectivity/iwd/iwd_1.30.bb deleted file mode 100644 index 1f0bcd4f8e..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/iwd/iwd_1.30.bb +++ /dev/null @@ -1,55 +0,0 @@ -SUMMARY = "Wireless daemon for Linux" -HOMEPAGE = "https://iwd.wiki.kernel.org/" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09" - -DEPENDS = "ell" - -SRC_URI = "https://www.kernel.org/pub/linux/network/wireless/${BP}.tar.xz \ - file://0001-build-Use-abs_top_srcdir-instead-of-abs_srcdir-for-e.patch \ - " -SRC_URI[sha256sum] = "9fd13512dc27d83efb8d341f7df98f5488f70131686021fcd0d93fc97af013b8" - -inherit autotools manpages pkgconfig python3native systemd - -PACKAGECONFIG ??= " \ - client \ - monitor \ - ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \ -" -PACKAGECONFIG[client] = "--enable-client,--disable-client,readline" -PACKAGECONFIG[monitor] = "--enable-monitor,--disable-monitor" -PACKAGECONFIG[manpages] = "--enable-manual-pages,--disable-manual-pages,python3-docutils-native" -PACKAGECONFIG[wired] = "--enable-wired,--disable-wired" -PACKAGECONFIG[ofono] = "--enable-ofono,--disable-ofono" -PACKAGECONFIG[systemd] = "--with-systemd-unitdir=${systemd_system_unitdir},--disable-systemd-service,systemd" - -EXTRA_OECONF = "--enable-external-ell" - -SYSTEMD_SERVICE:${PN} = " \ - iwd.service \ - ${@bb.utils.contains('PACKAGECONFIG', 'wired', 'ead.service', '', d)} \ -" - -do_configure:prepend() { - install -d ${S}/build-aux -} - -do_install:append() { - # If client and monitor are disabled, bindir is empty, causing a QA error - rmdir --ignore-fail-on-non-empty ${D}/${bindir} -} - -FILES:${PN} += " \ - ${datadir}/dbus-1 \ - ${nonarch_libdir}/modules-load.d \ - ${systemd_unitdir}/network \ -" - -RDEPENDS:${PN} = "dbus" - -RRECOMMENDS:${PN} = "\ - kernel-module-pkcs7-message \ - kernel-module-pkcs8-key-parser \ - kernel-module-x509-key-parser \ -" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/iwd/iwd_2.0.bb b/meta-openembedded/meta-oe/recipes-connectivity/iwd/iwd_2.0.bb new file mode 100644 index 0000000000..8ec211bd6d --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-connectivity/iwd/iwd_2.0.bb @@ -0,0 +1,55 @@ +SUMMARY = "Wireless daemon for Linux" +HOMEPAGE = "https://iwd.wiki.kernel.org/" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09" + +DEPENDS = "ell" + +SRC_URI = "https://www.kernel.org/pub/linux/network/wireless/${BP}.tar.xz \ + file://0001-build-Use-abs_top_srcdir-instead-of-abs_srcdir-for-e.patch \ + " +SRC_URI[sha256sum] = "5a0bfbc567092476d60a8f9700f68a273e39fd46e7177ce2d69bbc74255a930c" + +inherit autotools manpages pkgconfig python3native systemd + +PACKAGECONFIG ??= " \ + client \ + monitor \ + ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \ +" +PACKAGECONFIG[client] = "--enable-client,--disable-client,readline" +PACKAGECONFIG[monitor] = "--enable-monitor,--disable-monitor" +PACKAGECONFIG[manpages] = "--enable-manual-pages,--disable-manual-pages,python3-docutils-native" +PACKAGECONFIG[wired] = "--enable-wired,--disable-wired" +PACKAGECONFIG[ofono] = "--enable-ofono,--disable-ofono" +PACKAGECONFIG[systemd] = "--with-systemd-unitdir=${systemd_system_unitdir},--disable-systemd-service,systemd" + +EXTRA_OECONF = "--enable-external-ell" + +SYSTEMD_SERVICE:${PN} = " \ + iwd.service \ + ${@bb.utils.contains('PACKAGECONFIG', 'wired', 'ead.service', '', d)} \ +" + +do_configure:prepend() { + install -d ${S}/build-aux +} + +do_install:append() { + # If client and monitor are disabled, bindir is empty, causing a QA error + rmdir --ignore-fail-on-non-empty ${D}/${bindir} +} + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${nonarch_libdir}/modules-load.d \ + ${systemd_unitdir}/network \ +" + +RDEPENDS:${PN} = "dbus" + +RRECOMMENDS:${PN} = "\ + kernel-module-pkcs7-message \ + kernel-module-pkcs8-key-parser \ + kernel-module-x509-key-parser \ +" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/0001-aclocal-Add-parameter-to-disable-keyutils-detection.patch b/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/0001-aclocal-Add-parameter-to-disable-keyutils-detection.patch deleted file mode 100644 index cbd5d71fdf..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/0001-aclocal-Add-parameter-to-disable-keyutils-detection.patch +++ /dev/null @@ -1,32 +0,0 @@ -From a9e4057bfda190ad365b503af058b460ab8c7616 Mon Sep 17 00:00:00 2001 -From: Martin Jansa -Date: Tue, 1 Oct 2013 22:22:57 +0200 -Subject: [PATCH] aclocal: Add parameter to disable keyutils detection - -Signed-off-by: Martin Jansa - ---- - aclocal.m4 | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/aclocal.m4 b/aclocal.m4 -index d6d1279..80ce604 100644 ---- a/aclocal.m4 -+++ b/aclocal.m4 -@@ -1679,12 +1679,16 @@ fi - dnl - dnl If libkeyutils exists (on Linux) include it and use keyring ccache - AC_DEFUN(KRB5_AC_KEYRING_CCACHE,[ -+AC_ARG_ENABLE([keyutils], -+AC_HELP_STRING([--disable-keyutils],don't enable using keyutils for keyring ccache @<:@enabled@:>@), , enable_keyutils=yes) -+if test "$enable_keyutils" = yes; then - AC_CHECK_HEADERS([keyutils.h], - AC_CHECK_LIB(keyutils, add_key, - [dnl Pre-reqs were found - AC_DEFINE(USE_KEYRING_CCACHE, 1, [Define if the keyring ccache should be enabled]) - LIBS="-lkeyutils $LIBS" - ])) -+fi - ])dnl - dnl - dnl If libkeyutils supports persistent keyrings, use them diff --git a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/CVE-2021-36222.patch b/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/CVE-2021-36222.patch deleted file mode 100644 index fee6e64c15..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/CVE-2021-36222.patch +++ /dev/null @@ -1,121 +0,0 @@ -From fc98f520caefff2e5ee9a0026fdf5109944b3562 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton -Date: Wed, 7 Jul 2021 11:47:44 +1200 -Subject: [PATCH] Fix KDC null deref on bad encrypted challenge - -The function ec_verify() in src/kdc/kdc_preauth_ec.c contains a check -to avoid further processing if the armor key is NULL. However, this -check is bypassed by a call to k5memdup0() which overwrites retval -with 0 if the allocation succeeds. If the armor key is NULL, a call -to krb5_c_fx_cf2_simple() will then dereference it, resulting in a -crash. Add a check before the k5memdup0() call to avoid overwriting -retval. - -CVE-2021-36222: - -In MIT krb5 releases 1.16 and later, an unauthenticated attacker can -cause a null dereference in the KDC by sending a request containing a -PA-ENCRYPTED-CHALLENGE padata element without using FAST. - -[ghudson@mit.edu: trimmed patch; added test case; edited commit -message] - -ticket: 9007 (new) -tags: pullup -target_version: 1.19-next -target_version: 1.18-next - -CVE: CVE-2021-36222 - -Upstream-Status: Backport -[https://github.com/krb5/krb5/commit/fc98f520caefff2e5ee9a0026fdf5109944b3562] - -Signed-off-by: Yi Zhao ---- - src/kdc/kdc_preauth_ec.c | 3 ++- - src/tests/Makefile.in | 1 + - src/tests/t_cve-2021-36222.py | 46 +++++++++++++++++++++++++++++++++++ - 3 files changed, 49 insertions(+), 1 deletion(-) - create mode 100644 src/tests/t_cve-2021-36222.py - -diff --git a/src/kdc/kdc_preauth_ec.c b/src/kdc/kdc_preauth_ec.c -index 7e636b3f9..43a9902cc 100644 ---- a/src/kdc/kdc_preauth_ec.c -+++ b/src/kdc/kdc_preauth_ec.c -@@ -87,7 +87,8 @@ ec_verify(krb5_context context, krb5_data *req_pkt, krb5_kdc_req *request, - } - - /* Check for a configured FAST ec auth indicator. */ -- realmstr = k5memdup0(realm.data, realm.length, &retval); -+ if (retval == 0) -+ realmstr = k5memdup0(realm.data, realm.length, &retval); - if (realmstr != NULL) - retval = profile_get_string(context->profile, KRB5_CONF_REALMS, - realmstr, -diff --git a/src/tests/Makefile.in b/src/tests/Makefile.in -index fc6fcc0c3..1a1938306 100644 ---- a/src/tests/Makefile.in -+++ b/src/tests/Makefile.in -@@ -166,6 +166,7 @@ check-pytests: unlockiter s4u2self - $(RUNPYTEST) $(srcdir)/t_cve-2012-1015.py $(PYTESTFLAGS) - $(RUNPYTEST) $(srcdir)/t_cve-2013-1416.py $(PYTESTFLAGS) - $(RUNPYTEST) $(srcdir)/t_cve-2013-1417.py $(PYTESTFLAGS) -+ $(RUNPYTEST) $(srcdir)/t_cve-2021-36222.py $(PYTESTFLAGS) - $(RM) au.log - $(RUNPYTEST) $(srcdir)/t_audit.py $(PYTESTFLAGS) - $(RUNPYTEST) $(srcdir)/jsonwalker.py -d $(srcdir)/au_dict.json \ -diff --git a/src/tests/t_cve-2021-36222.py b/src/tests/t_cve-2021-36222.py -new file mode 100644 -index 000000000..57e04993b ---- /dev/null -+++ b/src/tests/t_cve-2021-36222.py -@@ -0,0 +1,46 @@ -+import socket -+from k5test import * -+ -+realm = K5Realm() -+ -+# CVE-2021-36222 KDC null dereference on encrypted challenge preauth -+# without FAST -+ -+s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -+a = (hostname, realm.portbase) -+ -+m = ('6A81A0' '30819D' # [APPLICATION 10] SEQUENCE -+ 'A103' '0201' '05' # [1] pvno = 5 -+ 'A203' '0201' '0A' # [2] msg-type = 10 -+ 'A30E' '300C' # [3] padata = SEQUENCE OF -+ '300A' # SEQUENCE -+ 'A104' '0202' '008A' # [1] padata-type = PA-ENCRYPTED-CHALLENGE -+ 'A202' '0400' # [2] padata-value = "" -+ 'A48180' '307E' # [4] req-body = SEQUENCE -+ 'A007' '0305' '0000000000' # [0] kdc-options = 0 -+ 'A120' '301E' # [1] cname = SEQUENCE -+ 'A003' '0201' '01' # [0] name-type = NT-PRINCIPAL -+ 'A117' '3015' # [1] name-string = SEQUENCE-OF -+ '1B06' '6B7262746774' # krbtgt -+ '1B0B' '4B5242544553542E434F4D' -+ # KRBTEST.COM -+ 'A20D' '1B0B' '4B5242544553542E434F4D' -+ # [2] realm = KRBTEST.COM -+ 'A320' '301E' # [3] sname = SEQUENCE -+ 'A003' '0201' '01' # [0] name-type = NT-PRINCIPAL -+ 'A117' '3015' # [1] name-string = SEQUENCE-OF -+ '1B06' '6B7262746774' # krbtgt -+ '1B0B' '4B5242544553542E434F4D' -+ # KRBTEST.COM -+ 'A511' '180F' '31393934303631303036303331375A' -+ # [5] till = 19940610060317Z -+ 'A703' '0201' '00' # [7] nonce = 0 -+ 'A808' '3006' # [8] etype = SEQUENCE OF -+ '020112' '020111') # aes256-cts aes128-cts -+ -+s.sendto(bytes.fromhex(m), a) -+ -+# Make sure kinit still works. -+realm.kinit(realm.user_princ, password('user')) -+ -+success('CVE-2021-36222 regression test') --- -2.25.1 - diff --git a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/CVE-2021-37750.patch b/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/CVE-2021-37750.patch deleted file mode 100644 index c67bca32e7..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5/CVE-2021-37750.patch +++ /dev/null @@ -1,53 +0,0 @@ -From b3999be7ab59a5af4b2f1042ce0d6b03ecb17d4e Mon Sep 17 00:00:00 2001 -From: Greg Hudson -Date: Tue, 3 Aug 2021 01:15:27 -0400 -Subject: [PATCH] Fix KDC null deref on TGS inner body null server - -After the KDC decodes a FAST inner body, it does not check for a null -server. Prior to commit 39548a5b17bbda9eeb63625a201cfd19b9de1c5b this -would typically result in an error from krb5_unparse_name(), but with -the addition of get_local_tgt() it results in a null dereference. Add -a null check. - -Reported by Joseph Sutton of Catalyst. - -CVE-2021-37750: - -In MIT krb5 releases 1.14 and later, an authenticated attacker can -cause a null dereference in the KDC by sending a FAST TGS request with -no server field. - -ticket: 9008 (new) -tags: pullup -target_version: 1.19-next -target_version: 1.18-next - -CVE: CVE-2021-37750 - -Upstream-Status: Backport -[https://github.com/krb5/krb5/commit/d775c95af7606a51bf79547a94fa52ddd1cb7f49] - -Signed-off-by: Yi Zhao ---- - src/kdc/do_tgs_req.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/kdc/do_tgs_req.c b/src/kdc/do_tgs_req.c -index 587342a..622b48f 100644 ---- a/src/kdc/do_tgs_req.c -+++ b/src/kdc/do_tgs_req.c -@@ -201,6 +201,11 @@ process_tgs_req(krb5_kdc_req *request, krb5_data *pkt, - status = "FIND_FAST"; - goto cleanup; - } -+ if (sprinc == NULL) { -+ status = "NULL_SERVER"; -+ errcode = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN; -+ goto cleanup; -+ } - - errcode = get_local_tgt(kdc_context, &sprinc->realm, header_server, - &local_tgt, &local_tgt_storage); --- -2.17.1 - diff --git a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5_1.17.2.bb b/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5_1.17.2.bb deleted file mode 100644 index 6e0b2fdacb..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5_1.17.2.bb +++ /dev/null @@ -1,199 +0,0 @@ -SUMMARY = "A network authentication protocol" -DESCRIPTION = "Kerberos is a system for authenticating users and services on a network. \ - Kerberos is a trusted third-party service. That means that there is a \ - third party (the Kerberos server) that is trusted by all the entities on \ - the network (users and services, usually called "principals"). \ - . \ - This is the MIT reference implementation of Kerberos V5. \ - . \ - This package contains the Kerberos key server (KDC). The KDC manages all \ - authentication credentials for a Kerberos realm, holds the master keys \ - for the realm, and responds to authentication requests. This package \ - should be installed on both master and slave KDCs." - -HOMEPAGE = "http://web.mit.edu/Kerberos/" -SECTION = "console/network" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${S}/../NOTICE;md5=dd4d0ad4c5e98abb58aa0d312f276791" -DEPENDS = "bison-native ncurses util-linux e2fsprogs e2fsprogs-native openssl" - -inherit autotools-brokensep binconfig perlnative systemd update-rc.d - -SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" -SRC_URI = "http://web.mit.edu/kerberos/dist/${BPN}/${SHRT_VER}/${BP}.tar.gz \ - file://0001-aclocal-Add-parameter-to-disable-keyutils-detection.patch \ - file://debian-suppress-usr-lib-in-krb5-config.patch;striplevel=2 \ - file://crosscompile_nm.patch \ - file://etc/init.d/krb5-kdc \ - file://etc/init.d/krb5-admin-server \ - file://etc/default/krb5-kdc \ - file://etc/default/krb5-admin-server \ - file://krb5-kdc.service \ - file://krb5-admin-server.service \ - file://CVE-2021-36222.patch;striplevel=2 \ - file://CVE-2021-37750.patch;striplevel=2 \ -" -SRC_URI[md5sum] = "aa4337fffa3b61f22dbd0167f708818f" -SRC_URI[sha256sum] = "1a4bba94df92f6d39a197a10687653e8bfbc9a2076e129f6eb92766974f86134" - -CVE_PRODUCT = "kerberos" -CVE_VERSION = "5-${PV}" - -S = "${WORKDIR}/${BP}/src" - -PACKAGECONFIG ??= "pkinit" -PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" -PACKAGECONFIG[openssl] = "--with-crypto-impl=openssl,,openssl" -PACKAGECONFIG[keyutils] = "--enable-keyutils,--disable-keyutils,keyutils" -PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap" -PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" -PACKAGECONFIG[pkinit] = "--enable-pkinit, --disable-pkinit" - -EXTRA_OECONF += " --without-tcl --with-system-et --disable-rpath" -CACHED_CONFIGUREVARS += "krb5_cv_attr_constructor_destructor=yes ac_cv_func_regcomp=yes \ - ac_cv_printf_positional=yes ac_cv_file__etc_environment=yes \ - ac_cv_file__etc_TIMEZONE=no" - -CFLAGS:append = " -fPIC -DDESTRUCTOR_ATTR_WORKS=1 -I${STAGING_INCDIR}/et" -CFLAGS:append:riscv64 = " -D_REENTRANT -pthread" -LDFLAGS:append = " -pthread" - -do_configure() { - gnu-configize --force - autoreconf - oe_runconf -} - -do_install:append() { - rm -rf ${D}/${localstatedir}/run - rm -f ${D}${bindir}/sclient - rm -f ${D}${bindir}/sim_client - rm -f ${D}${bindir}/uuclient - rm -f ${D}${sbindir}/krb5-send-pr - rm -f ${D}${sbindir}/sim_server - rm -f ${D}${sbindir}/sserver - rm -f ${D}${sbindir}/uuserver - - if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then - mkdir -p ${D}/${sysconfdir}/init.d ${D}/${sysconfdir}/default - install -m 0755 ${WORKDIR}/etc/init.d/* ${D}/${sysconfdir}/init.d - install -m 0644 ${WORKDIR}/etc/default/* ${D}/${sysconfdir}/default - - mkdir -p ${D}/${sysconfdir}/default/volatiles - echo "d root root 0755 ${localstatedir}/run/krb5kdc none" \ - > ${D}${sysconfdir}/default/volatiles/87_krb5 - - echo "RUN_KADMIND=true" >> ${D}/${sysconfdir}/default/krb5-admin-server - fi - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${sysconfdir}/tmpfiles.d - echo "d /run/krb5kdc - - - -" \ - > ${D}${sysconfdir}/tmpfiles.d/krb5.conf - - mkdir -p ${D}/${sysconfdir}/default - install -m 0644 ${WORKDIR}/etc/default/* ${D}/${sysconfdir}/default - - install -d ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/krb5-admin-server.service ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/krb5-kdc.service ${D}${systemd_system_unitdir} - fi - - sed -e 's@[^ ]*-ffile-prefix-map=[^ "]*@@g' \ - -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \ - -e 's@[^ ]*-fmacro-prefix-map=[^ "]*@@g' \ - -i ${D}${bindir}/krb5-config -} - -PACKAGES =+ "${PN}-admin-server \ - ${PN}-gss-samples \ - ${PN}-k5tls \ - ${PN}-kdc \ - ${PN}-kdc-ldap \ - ${PN}-kpropd \ - ${PN}-otp \ - ${PN}-pkinit \ - ${PN}-spake \ - ${PN}-user \ - libgssapi-krb5 \ - libgssrpc \ - libk5crypto \ - libkadm5clnt-mit \ - libkadm5srv-mit \ - libkdb5 \ - libkrad \ - libkrb5 \ - libkrb5support \ - libverto" - -FILES:${PN} = "${libdir}/krb5/plugins/preauth/test.so" -FILES:${PN}-doc += "${datadir}/examples" -FILES:${PN}-dbg += "${libdir}/krb5/plugins/*/.debug" - -FILES:${PN}-admin-server = "${sbindir}/kadmin.local \ - ${sbindir}/kadmind \ - ${sbindir}/kprop \ - ${sysconfdir}/default/krb5-admin-server \ - ${sysconfdir}/init.d/krb5-admin-server \ - ${systemd_system_unitdir}/krb5-admin-server.service" - -FILES:${PN}-gss-samples = "${bindir}/gss-client \ - ${sbindir}/gss-server" - -FILES:${PN}-k5tls = "${libdir}/krb5/plugins/tls/k5tls.so" - -FILES:${PN}-kdc = "${libdir}/krb5/plugins/kdb/db2.so \ - ${localstatedir}/krb5kdc \ - ${sbindir}/kdb5_util \ - ${sbindir}/kproplog \ - ${sbindir}/krb5kdc \ - ${sysconfdir}/default/krb5-kdc \ - ${sysconfdir}/default/volatiles/87_krb5 \ - ${sysconfdir}/init.d/krb5-kdc \ - ${sysconfdir}/tmpfiles.d/krb5.conf \ - ${systemd_system_unitdir}/krb5-kdc.service" - -FILES:${PN}-kdc-ldap = "${libdir}/krb5/libkdb_ldap${SOLIBS} \ - ${libdir}/krb5/plugins/kdb/kldap.so \ - ${sbindir}/kdb5_ldap_util" - -FILES:${PN}-kpropd = "${sbindir}/kpropd" -FILES:${PN}-otp = "${libdir}/krb5/plugins/preauth/otp.so" -FILES:${PN}-pkinit = "${libdir}/krb5/plugins/preauth/pkinit.so" -FILES:${PN}-spake = "${libdir}/krb5/plugins/preauth/spake.so" -FILES:${PN}-user = "${bindir}/k*" - -FILES:libgssapi-krb5 = "${libdir}/libgssapi_krb5${SOLIBS}" -FILES:libgssrpc = "${libdir}/libgssrpc${SOLIBS}" -FILES:libk5crypto = "${libdir}/libk5crypto${SOLIBS}" -FILES:libkadm5clnt-mit = "${libdir}/libkadm5clnt_mit${SOLIBS}" -FILES:libkadm5srv-mit = "${libdir}/libkadm5srv_mit${SOLIBS}" -FILES:libkdb5 = "${libdir}/libkdb5${SOLIBS}" -FILES:libkrad = "${libdir}/libkrad${SOLIBS}" -FILES:libkrb5 = "${libdir}/libkrb5${SOLIBS} \ - ${libdir}/krb5/plugins/authdata \ - ${libdir}/krb5/plugins/libkrb5" -FILES:libkrb5support = "${libdir}/libkrb5support${SOLIBS}" -FILES:libverto = "${libdir}/libverto${SOLIBS}" - -RDEPENDS:${PN}-kadmin-server = "${PN}-kdc" -RDEPENDS:${PN}-kpropd = "${PN}-kdc" - -INITSCRIPT_PACKAGES = "${PN}-admin-server ${PN}-kdc" -INITSCRIPT_NAME:${PN}-admin-server = "krb5-admin-server" -INITSCRIPT_NAME:${PN}-kdc = "krb5-kdc" - -SYSTEMD_PACKAGES = "${PN}-admin-server ${PN}-kdc" -SYSTEMD_SERVICE:${PN}-admin-server = "krb5-admin-server.service" -SYSTEMD_SERVICE:${PN}-kdc = "krb5-kdc.service" - -pkg_postinst:${PN}-kdc () { - if [ -z "$D" ]; then - if command -v systemd-tmpfiles >/dev/null; then - systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/krb5.conf - elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then - ${sysconfdir}/init.d/populate-volatile.sh update - fi - fi -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5_1.20.1.bb b/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5_1.20.1.bb new file mode 100644 index 0000000000..2221000e3b --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-connectivity/krb5/krb5_1.20.1.bb @@ -0,0 +1,198 @@ +SUMMARY = "A network authentication protocol" +DESCRIPTION = "Kerberos is a system for authenticating users and services on a network. \ + Kerberos is a trusted third-party service. That means that there is a \ + third party (the Kerberos server) that is trusted by all the entities on \ + the network (users and services, usually called "principals"). \ + . \ + This is the MIT reference implementation of Kerberos V5. \ + . \ + This package contains the Kerberos key server (KDC). The KDC manages all \ + authentication credentials for a Kerberos realm, holds the master keys \ + for the realm, and responds to authentication requests. This package \ + should be installed on both master and slave KDCs." + +HOMEPAGE = "http://web.mit.edu/Kerberos/" +SECTION = "console/network" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${S}/../NOTICE;md5=1d31018dba5a0ef195eb426a1e61f02e" + +inherit autotools-brokensep binconfig perlnative systemd update-rc.d pkgconfig + +SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" +SRC_URI = "http://web.mit.edu/kerberos/dist/${BPN}/${SHRT_VER}/${BP}.tar.gz \ + file://debian-suppress-usr-lib-in-krb5-config.patch;striplevel=2 \ + file://crosscompile_nm.patch \ + file://etc/init.d/krb5-kdc \ + file://etc/init.d/krb5-admin-server \ + file://etc/default/krb5-kdc \ + file://etc/default/krb5-admin-server \ + file://krb5-kdc.service \ + file://krb5-admin-server.service \ +" +SRC_URI[md5sum] = "73f5780e7b587ccd8b8cfc10c965a686" +SRC_URI[sha256sum] = "704aed49b19eb5a7178b34b2873620ec299db08752d6a8574f95d41879ab8851" + +CVE_PRODUCT = "kerberos" +CVE_VERSION = "5-${PV}" + +S = "${WORKDIR}/${BP}/src" + +DEPENDS = "bison-native ncurses util-linux e2fsprogs e2fsprogs-native openssl" + +PACKAGECONFIG ??= "pkinit" +PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" +PACKAGECONFIG[openssl] = "--with-crypto-impl=openssl,,openssl" +PACKAGECONFIG[keyutils] = "--with-keyutils,--without-keyutils,keyutils" +PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap" +PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" +PACKAGECONFIG[pkinit] = "--enable-pkinit, --disable-pkinit" + +EXTRA_OECONF += "--with-system-et --disable-rpath" +CACHED_CONFIGUREVARS += "krb5_cv_attr_constructor_destructor=yes ac_cv_func_regcomp=yes \ + ac_cv_printf_positional=yes ac_cv_file__etc_environment=yes \ + ac_cv_file__etc_TIMEZONE=no" + +CFLAGS:append = " -fPIC -DDESTRUCTOR_ATTR_WORKS=1 -I${STAGING_INCDIR}/et" +CFLAGS:append:riscv64 = " -D_REENTRANT -pthread" +LDFLAGS:append = " -pthread" + +do_configure() { + gnu-configize --force + autoreconf + oe_runconf +} + +do_install:append() { + rm -rf ${D}/${localstatedir}/run + rm -f ${D}${bindir}/sclient + rm -f ${D}${bindir}/sim_client + rm -f ${D}${bindir}/uuclient + rm -f ${D}${sbindir}/krb5-send-pr + rm -f ${D}${sbindir}/sim_server + rm -f ${D}${sbindir}/sserver + rm -f ${D}${sbindir}/uuserver + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + mkdir -p ${D}/${sysconfdir}/init.d ${D}/${sysconfdir}/default + install -m 0755 ${WORKDIR}/etc/init.d/* ${D}/${sysconfdir}/init.d + install -m 0644 ${WORKDIR}/etc/default/* ${D}/${sysconfdir}/default + + mkdir -p ${D}/${sysconfdir}/default/volatiles + echo "d root root 0755 ${localstatedir}/run/krb5kdc none" \ + > ${D}${sysconfdir}/default/volatiles/87_krb5 + + echo "RUN_KADMIND=true" >> ${D}/${sysconfdir}/default/krb5-admin-server + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/tmpfiles.d + echo "d /run/krb5kdc - - - -" \ + > ${D}${sysconfdir}/tmpfiles.d/krb5.conf + + mkdir -p ${D}/${sysconfdir}/default + install -m 0644 ${WORKDIR}/etc/default/* ${D}/${sysconfdir}/default + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/krb5-admin-server.service ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/krb5-kdc.service ${D}${systemd_system_unitdir} + fi + + sed -e 's@[^ ]*-ffile-prefix-map=[^ "]*@@g' \ + -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \ + -e 's@[^ ]*-fmacro-prefix-map=[^ "]*@@g' \ + -i ${D}${bindir}/krb5-config +} + +PACKAGES =+ "${PN}-admin-server \ + ${PN}-gss-samples \ + ${PN}-k5tls \ + ${PN}-kdc \ + ${PN}-kdc-ldap \ + ${PN}-kpropd \ + ${PN}-otp \ + ${PN}-pkinit \ + ${PN}-spake \ + ${PN}-user \ + libgssapi-krb5 \ + libgssrpc \ + libk5crypto \ + libkadm5clnt-mit \ + libkadm5srv-mit \ + libkdb5 \ + libkrad \ + libkrb5 \ + libkrb5support \ + libverto" + +FILES:${PN} = "${libdir}/krb5/plugins/preauth/test.so" +FILES:${PN}-doc += "${datadir}/examples" +FILES:${PN}-dbg += "${libdir}/krb5/plugins/*/.debug" + +FILES:${PN}-admin-server = "${sbindir}/kadmin.local \ + ${sbindir}/kadmind \ + ${sbindir}/kprop \ + ${sysconfdir}/default/krb5-admin-server \ + ${sysconfdir}/init.d/krb5-admin-server \ + ${systemd_system_unitdir}/krb5-admin-server.service" + +FILES:${PN}-gss-samples = "${bindir}/gss-client \ + ${sbindir}/gss-server" + +FILES:${PN}-k5tls = "${libdir}/krb5/plugins/tls/k5tls.so" + +FILES:${PN}-kdc = "${libdir}/krb5/plugins/kdb/db2.so \ + ${localstatedir}/krb5kdc \ + ${sbindir}/kdb5_util \ + ${sbindir}/kproplog \ + ${sbindir}/krb5kdc \ + ${sysconfdir}/default/krb5-kdc \ + ${sysconfdir}/default/volatiles/87_krb5 \ + ${sysconfdir}/init.d/krb5-kdc \ + ${sysconfdir}/tmpfiles.d/krb5.conf \ + ${systemd_system_unitdir}/krb5-kdc.service" + +FILES:${PN}-kdc-ldap = "${libdir}/krb5/libkdb_ldap${SOLIBS} \ + ${libdir}/krb5/plugins/kdb/kldap.so \ + ${sbindir}/kdb5_ldap_util" + +FILES:${PN}-kpropd = "${sbindir}/kpropd" +FILES:${PN}-otp = "${libdir}/krb5/plugins/preauth/otp.so" +FILES:${PN}-pkinit = "${libdir}/krb5/plugins/preauth/pkinit.so" +FILES:${PN}-spake = "${libdir}/krb5/plugins/preauth/spake.so" +FILES:${PN}-user = "${bindir}/k*" + +FILES:libgssapi-krb5 = "${libdir}/libgssapi_krb5${SOLIBS}" +FILES:libgssrpc = "${libdir}/libgssrpc${SOLIBS}" +FILES:libk5crypto = "${libdir}/libk5crypto${SOLIBS}" +FILES:libkadm5clnt-mit = "${libdir}/libkadm5clnt_mit${SOLIBS}" +FILES:libkadm5srv-mit = "${libdir}/libkadm5srv_mit${SOLIBS}" +FILES:libkdb5 = "${libdir}/libkdb5${SOLIBS}" +FILES:libkrad = "${libdir}/libkrad${SOLIBS}" +FILES:libkrb5 = "${libdir}/libkrb5${SOLIBS} \ + ${libdir}/krb5/plugins/authdata \ + ${libdir}/krb5/plugins/libkrb5" +FILES:libkrb5support = "${libdir}/libkrb5support${SOLIBS}" +FILES:libverto = "${libdir}/libverto${SOLIBS}" + +RDEPENDS:${PN}-kadmin-server = "${PN}-kdc" +RDEPENDS:${PN}-kpropd = "${PN}-kdc" + +INITSCRIPT_PACKAGES = "${PN}-admin-server ${PN}-kdc" +INITSCRIPT_NAME:${PN}-admin-server = "krb5-admin-server" +INITSCRIPT_NAME:${PN}-kdc = "krb5-kdc" + +SYSTEMD_PACKAGES = "${PN}-admin-server ${PN}-kdc" +SYSTEMD_SERVICE:${PN}-admin-server = "krb5-admin-server.service" +SYSTEMD_SERVICE:${PN}-kdc = "krb5-kdc.service" + +pkg_postinst:${PN}-kdc () { + if [ -z "$D" ]; then + if command -v systemd-tmpfiles >/dev/null; then + systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/krb5.conf + elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then + ${sysconfdir}/init.d/populate-volatile.sh update + fi + fi +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.3.2.bb b/meta-openembedded/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.3.2.bb index 0ce0513f3b..d401a187e2 100644 --- a/meta-openembedded/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.3.2.bb +++ b/meta-openembedded/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.3.2.bb @@ -14,7 +14,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "v(?P\d+(\.\d+)+)" inherit cmake pkgconfig -PACKAGECONFIG ?= "libuv client server http2 ssl" +PACKAGECONFIG ?= "libuv client server http2 ssl ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" PACKAGECONFIG[client] = "-DLWS_WITHOUT_CLIENT=OFF,-DLWS_WITHOUT_CLIENT=ON," PACKAGECONFIG[http2] = "-DLWS_WITH_HTTP2=ON,-DLWS_WITH_HTTP2=OFF," PACKAGECONFIG[ipv6] = "-DLWS_IPV6=ON,-DLWS_IPV6=OFF," diff --git a/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp/0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch b/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp/0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch new file mode 100644 index 0000000000..fb51906521 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp/0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch @@ -0,0 +1,42 @@ +From dfd38cb29c0768692f886d3ab9158bd2b3132582 Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Tue, 22 Nov 2022 15:20:48 +0800 +Subject: [PATCH] makefile: use conditional assignment for KBUILD_OUTPUT + +Refer [1],from make 4.4, all variables that are marked as export will +also be passed to the shell started by the shell function. use "=" will +make KBUILD_OUTPUT always empty for shell function, use "?=" to make +"export KBUILD_OUTPUT" in enrironment can work. + +[snip of 4.4 NEWS] +* WARNING: Backward-incompatibility! + Previously makefile variables marked as export were not exported to commands + started by the $(shell ...) function. Now, all exported variables are + exported to $(shell ...). +[snip] + +[1] https://git.savannah.gnu.org/cgit/make.git/tree/NEWS?h=4.4&id=ed493f6c9116cc217b99c2cfa6a95f15803235a2#n74 + +Upstream-Status: Submitted [linuxptp-devel@lists.sourceforge.net] + +Signed-off-by: Changqing Li +--- + makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/makefile b/makefile +index 529d8a0..3db60fa 100644 +--- a/makefile ++++ b/makefile +@@ -15,7 +15,7 @@ + # with this program; if not, write to the Free Software Foundation, Inc., + # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +-KBUILD_OUTPUT = ++KBUILD_OUTPUT ?= + + DEBUG = + CC ?= $(CROSS_COMPILE)gcc +-- +2.25.1 + diff --git a/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb b/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb index bb4871e14f..5903cb38ca 100644 --- a/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb +++ b/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb @@ -7,6 +7,7 @@ SRC_URI = "http://sourceforge.net/projects/linuxptp/files/v3.1/linuxptp-${PV}.tg file://build-Allow-CC-and-prefix-to-be-overriden.patch \ file://Use-cross-cpp-in-incdefs.patch \ file://0001-include-string.h-for-strncpy.patch \ + file://0001-makefile-use-conditional-assignment-for-KBUILD_OUTPU.patch \ " UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/linuxptp/files/" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.11.bb b/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.11.bb deleted file mode 100644 index 218672e266..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.11.bb +++ /dev/null @@ -1,34 +0,0 @@ -SUMMARY = "Paho MQTT - C libraries for the MQTT and MQTT-SN protocols" -DESCRIPTION = "Client implementation of open and standard messaging protocols for Machine-to-Machine (M2M) and Internet of Things (IoT)." -HOMEPAGE = "http://www.eclipse.org/paho/" -SECTION = "console/network" -LICENSE = "EPL-2.0 | EDL-1.0" - -LIC_FILES_CHKSUM = " \ - file://edl-v10;md5=3adfcc70f5aeb7a44f3f9b495aa1fbf3 \ - file://epl-v20;md5=d9fc0efef5228704e7f5b37f27192723 \ - file://notice.html;md5=943f861069889acecebf51dfa24478e2 \ - file://about.html;md5=e5662cbb5f8fd5c9faac526e4077898e \ -" - -SRC_URI = "git://github.com/eclipse/paho.mqtt.c;protocol=http;branch=master;protocol=https" - -SRCREV = "0995176412616ae8f1cba51c8d609fe4b69687ea" - -DEPENDS = "openssl" - -S = "${WORKDIR}/git" - -inherit cmake - -do_configure:prepend() { - sed -i s:\ lib/cmake:\ ${baselib}/cmake:g ${S}/src/CMakeLists.txt -} - -do_install:append() { - # paho-mqtt installes some thing that we don't want. - rm -rf ${D}${prefix}/samples - find ${D}${prefix} -maxdepth 1 -type f -delete -} - -EXTRA_OECMAKE = "-DPAHO_WITH_SSL=ON" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.12.bb b/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.12.bb new file mode 100644 index 0000000000..d006ae7636 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-connectivity/paho-mqtt-c/paho-mqtt-c_1.3.12.bb @@ -0,0 +1,34 @@ +SUMMARY = "Paho MQTT - C libraries for the MQTT and MQTT-SN protocols" +DESCRIPTION = "Client implementation of open and standard messaging protocols for Machine-to-Machine (M2M) and Internet of Things (IoT)." +HOMEPAGE = "http://www.eclipse.org/paho/" +SECTION = "console/network" +LICENSE = "EPL-2.0 | EDL-1.0" + +LIC_FILES_CHKSUM = " \ + file://edl-v10;md5=3adfcc70f5aeb7a44f3f9b495aa1fbf3 \ + file://epl-v20;md5=d9fc0efef5228704e7f5b37f27192723 \ + file://notice.html;md5=943f861069889acecebf51dfa24478e2 \ + file://about.html;md5=e5662cbb5f8fd5c9faac526e4077898e \ +" + +SRC_URI = "git://github.com/eclipse/paho.mqtt.c;protocol=http;branch=master;protocol=https" + +SRCREV = "4157a27d39f1dd5b95750ecb6acd1481432785d8" + +DEPENDS = "openssl" + +S = "${WORKDIR}/git" + +inherit cmake + +do_configure:prepend() { + sed -i s:\ lib/cmake:\ ${baselib}/cmake:g ${S}/src/CMakeLists.txt +} + +do_install:append() { + # paho-mqtt installes some thing that we don't want. + rm -rf ${D}${prefix}/samples + find ${D}${prefix} -maxdepth 1 -type f -delete +} + +EXTRA_OECMAKE = "-DPAHO_WITH_SSL=ON" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/ser2net/ser2net_4.3.11.bb b/meta-openembedded/meta-oe/recipes-connectivity/ser2net/ser2net_4.3.11.bb new file mode 100644 index 0000000000..ca7982c0ac --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-connectivity/ser2net/ser2net_4.3.11.bb @@ -0,0 +1,18 @@ +SUMMARY = "A serial to network proxy" +SECTION = "console/network" +HOMEPAGE = "http://sourceforge.net/projects/ser2net/" + +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=bae3019b4c6dc4138c217864bd04331f" + +DEPENDS = "gensio libyaml" + +SRC_URI = "${SOURCEFORGE_MIRROR}/project/ser2net/ser2net/ser2net-${PV}.tar.gz" + +SRC_URI[sha256sum] = "8f831f11b67538280aa0e8787cb0785ff705cf90749aa175d32c337f29412ae3" + +UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/ser2net/files/ser2net" + +inherit autotools pkgconfig + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/ser2net/ser2net_4.3.9.bb b/meta-openembedded/meta-oe/recipes-connectivity/ser2net/ser2net_4.3.9.bb deleted file mode 100644 index e149bb568b..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/ser2net/ser2net_4.3.9.bb +++ /dev/null @@ -1,18 +0,0 @@ -SUMMARY = "A serial to network proxy" -SECTION = "console/network" -HOMEPAGE = "http://sourceforge.net/projects/ser2net/" - -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=bae3019b4c6dc4138c217864bd04331f" - -DEPENDS = "gensio libyaml" - -SRC_URI = "${SOURCEFORGE_MIRROR}/project/ser2net/ser2net/ser2net-${PV}.tar.gz" - -SRC_URI[sha256sum] = "bcb8ae31d00c6b4392d1cd1c9ecc9390a8b241029c42c5eb951af090edaf56db" - -UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/ser2net/files/ser2net" - -inherit autotools pkgconfig - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.4.bb b/meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.4.bb deleted file mode 100644 index 7332e28201..0000000000 --- a/meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.4.bb +++ /dev/null @@ -1,78 +0,0 @@ -SUMMARY = "Open-source monitoring solution for your IT infrastructure" -DESCRIPTION = "\ -ZABBIX is software that monitors numerous parameters of a network and the \ -health and integrity of servers. ZABBIX uses a flexible notification \ -mechanism that allows users to configure e-mail based alerts for virtually \ -any event. This allows a fast reaction to server problems. ZABBIX offers \ -excellent reporting and data visualisation features based on the stored \ -data. This makes ZABBIX ideal for capacity planning. \ -\ -ZABBIX supports both polling and trapping. All ZABBIX reports and \ -statistics, as well as configuration parameters are accessed through a \ -web-based front end. A web-based front end ensures that the status of \ -your network and the health of your servers can be assessed from any \ -location. Properly configured, ZABBIX can play an important role in \ -monitoring IT infrastructure. This is equally true for small \ -organisations with a few servers and for large companies with a \ -multitude of servers." -HOMEPAGE = "http://www.zabbix.com/" -SECTION = "Applications/Internet" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=300e938ad303147fede2294ed78fe02e" -DEPENDS = "libevent libpcre openldap virtual/libiconv zlib" - -PACKAGE_ARCH = "${MACHINE_ARCH}" - -SRC_URI = "https://cdn.zabbix.com/zabbix/sources/stable/6.2/${BPN}-${PV}.tar.gz \ - file://0001-Fix-configure.ac.patch \ - file://0001-initialize-msghdr-portably.patch \ - file://zabbix-agent.service \ -" -SRC_URI[sha256sum] = "e2526603d9b487a26046de3022e1722b66f4b25542886b3e40a8e2b3bbdbd3b5" - -inherit autotools-brokensep linux-kernel-base pkgconfig systemd useradd - -SYSTEMD_PACKAGES = "${PN}" -SYSTEMD_SERVICE:${PN} = "zabbix-agent.service" -SYSTEMD_AUTO_ENABLE = "enable" - -USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM:${PN} = "-r zabbix" -USERADD_PARAM:${PN} = "-r -g zabbix -d /var/lib/zabbix \ - -s /sbin/nologin -c \"Zabbix Monitoring System\" zabbix \ -" - -KERNEL_VERSION = "${@get_kernelversion_headers('${STAGING_KERNEL_DIR}')}" - -EXTRA_OECONF = " \ - --enable-dependency-tracking \ - --enable-agent \ - --enable-ipv6 \ - --with-net-snmp \ - --with-ldap=${STAGING_EXECPREFIXDIR} \ - --with-unixodbc \ - --with-ssh2 \ - --with-sqlite3 \ - --with-zlib \ - --with-libpthread \ - --with-libevent \ - --with-libpcre=${STAGING_EXECPREFIXDIR} \ - --with-iconv=${STAGING_EXECPREFIXDIR} \ -" -CFLAGS:append = " -lldap -llber -pthread" - -do_configure:prepend() { - export KERNEL_VERSION="${KERNEL_VERSION}" -} - -do_install:append() { - if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/zabbix-agent.service ${D}${systemd_unitdir}/system/ - sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/zabbix-agent.service - fi -} - -FILES:${PN} += "${libdir}" - -RDEPENDS:${PN} = "logrotate" diff --git a/meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.6.bb b/meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.6.bb new file mode 100644 index 0000000000..bafde31348 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-connectivity/zabbix/zabbix_6.2.6.bb @@ -0,0 +1,78 @@ +SUMMARY = "Open-source monitoring solution for your IT infrastructure" +DESCRIPTION = "\ +ZABBIX is software that monitors numerous parameters of a network and the \ +health and integrity of servers. ZABBIX uses a flexible notification \ +mechanism that allows users to configure e-mail based alerts for virtually \ +any event. This allows a fast reaction to server problems. ZABBIX offers \ +excellent reporting and data visualisation features based on the stored \ +data. This makes ZABBIX ideal for capacity planning. \ +\ +ZABBIX supports both polling and trapping. All ZABBIX reports and \ +statistics, as well as configuration parameters are accessed through a \ +web-based front end. A web-based front end ensures that the status of \ +your network and the health of your servers can be assessed from any \ +location. Properly configured, ZABBIX can play an important role in \ +monitoring IT infrastructure. This is equally true for small \ +organisations with a few servers and for large companies with a \ +multitude of servers." +HOMEPAGE = "http://www.zabbix.com/" +SECTION = "Applications/Internet" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=300e938ad303147fede2294ed78fe02e" +DEPENDS = "libevent libpcre openldap virtual/libiconv zlib" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +SRC_URI = "https://cdn.zabbix.com/zabbix/sources/stable/6.2/${BPN}-${PV}.tar.gz \ + file://0001-Fix-configure.ac.patch \ + file://0001-initialize-msghdr-portably.patch \ + file://zabbix-agent.service \ +" +SRC_URI[sha256sum] = "ae40c8cd4b24159466a7483e65f85836a8c963a0bc394a3dd890142aaf30ac17" + +inherit autotools-brokensep linux-kernel-base pkgconfig systemd useradd + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "zabbix-agent.service" +SYSTEMD_AUTO_ENABLE = "enable" + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM:${PN} = "-r zabbix" +USERADD_PARAM:${PN} = "-r -g zabbix -d /var/lib/zabbix \ + -s /sbin/nologin -c \"Zabbix Monitoring System\" zabbix \ +" + +KERNEL_VERSION = "${@get_kernelversion_headers('${STAGING_KERNEL_DIR}')}" + +EXTRA_OECONF = " \ + --enable-dependency-tracking \ + --enable-agent \ + --enable-ipv6 \ + --with-net-snmp \ + --with-ldap=${STAGING_EXECPREFIXDIR} \ + --with-unixodbc \ + --with-ssh2 \ + --with-sqlite3 \ + --with-zlib \ + --with-libpthread \ + --with-libevent \ + --with-libpcre=${STAGING_EXECPREFIXDIR} \ + --with-iconv=${STAGING_EXECPREFIXDIR} \ +" +CFLAGS:append = " -lldap -llber -pthread" + +do_configure:prepend() { + export KERNEL_VERSION="${KERNEL_VERSION}" +} + +do_install:append() { + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/zabbix-agent.service ${D}${systemd_unitdir}/system/ + sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/zabbix-agent.service + fi +} + +FILES:${PN} += "${libdir}" + +RDEPENDS:${PN} = "logrotate" diff --git a/meta-openembedded/meta-oe/recipes-core/basu/basu_0.2.1.bb b/meta-openembedded/meta-oe/recipes-core/basu/basu_0.2.1.bb new file mode 100644 index 0000000000..500408e11e --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/basu/basu_0.2.1.bb @@ -0,0 +1,21 @@ +SUMMARY = "The sd-bus library, extracted from systemd." +HOMEPAGE = "https://sr.ht/~emersion/basu" +SECTION = "base" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI = "git://git.sr.ht/~emersion/basu;protocol=https;branch=master" + +DEPENDS += "gperf-native" + +S = "${WORKDIR}/git" +PV = "0.2.1" +SRCREV = "684a41d68cfbb05e38aacb60a8548e21ddfbecdb" + +inherit meson pkgconfig + +PACKAGECONFIG ?= "" +PACKAGECONFIG[libcap] = "-Dlibcap=enabled,-Dlibcap=disabled,libcap" +PACKAGECONFIG[audit] = "-Daudit=enabled,-Daudit=disabled,audit" + +EXTRA_OEMESON += "--buildtype release" diff --git a/meta-openembedded/meta-oe/recipes-core/glib-2.0/glibmm-2.68_2.72.1.bb b/meta-openembedded/meta-oe/recipes-core/glib-2.0/glibmm-2.68_2.72.1.bb deleted file mode 100644 index f13cf9d50b..0000000000 --- a/meta-openembedded/meta-oe/recipes-core/glib-2.0/glibmm-2.68_2.72.1.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "C++ bindings for the glib library" -HOMEPAGE = "http://www.gtkmm.org/" -SECTION = "libs" -LICENSE = "LGPL-2.1-only & GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=42dfffebc56fec7527aac53b7a89d1d8 \ - file://COPYING.tools;md5=751419260aa954499f7abaabaa882bbe" - -DEPENDS = "mm-common glib-2.0 libsigc++-3 glib-2.0-native" - -GNOMEBASEBUILDCLASS = "meson" -GNOMEBN = "glibmm" -inherit gnomebase - -SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}" - -SRC_URI[archive.sha256sum] = "2a7649a28ab5dc53ac4dabb76c9f61599fbc628923ab6a7dd74bf675d9155cd8" - -S = "${WORKDIR}/${GNOMEBN}-${PV}" - -do_install:append() { - for i in generate_wrap_init.pl gmmproc; do - sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/glibmm-2.68/proc/$i - done -} - -FILES:${PN} = "${libdir}/lib*.so.*" -FILES:${PN}-dev += "${datadir}/glibmm-* ${libdir}/${BPN}/include/ ${libdir}/${BPN}/proc/ ${libdir}/giomm-2.68/include/" - -RDEPENDS:${PN}-dev = "perl" diff --git a/meta-openembedded/meta-oe/recipes-core/glib-2.0/glibmm-2.68_2.74.0.bb b/meta-openembedded/meta-oe/recipes-core/glib-2.0/glibmm-2.68_2.74.0.bb new file mode 100644 index 0000000000..5028a8bb8a --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/glib-2.0/glibmm-2.68_2.74.0.bb @@ -0,0 +1,29 @@ +SUMMARY = "C++ bindings for the glib library" +HOMEPAGE = "http://www.gtkmm.org/" +SECTION = "libs" +LICENSE = "LGPL-2.1-only & GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=42dfffebc56fec7527aac53b7a89d1d8 \ + file://COPYING.tools;md5=751419260aa954499f7abaabaa882bbe" + +DEPENDS = "mm-common glib-2.0 libsigc++-3 glib-2.0-native" + +GNOMEBASEBUILDCLASS = "meson" +GNOMEBN = "glibmm" +inherit gnomebase + +SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}" + +SRC_URI[archive.sha256sum] = "2b472696cbac79db8e405724118ec945219c5b9b18af63dc8cfb7f1d89b0f1fa" + +S = "${WORKDIR}/${GNOMEBN}-${PV}" + +do_install:append() { + for i in generate_wrap_init.pl gmmproc; do + sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/glibmm-2.68/proc/$i + done +} + +FILES:${PN} = "${libdir}/lib*.so.*" +FILES:${PN}-dev += "${datadir}/glibmm-* ${libdir}/${BPN}/include/ ${libdir}/${BPN}/proc/ ${libdir}/giomm-2.68/include/" + +RDEPENDS:${PN}-dev = "perl" diff --git a/meta-openembedded/meta-oe/recipes-core/opencl/opencl-headers_git.bb b/meta-openembedded/meta-oe/recipes-core/opencl/opencl-headers_git.bb index 8bbee5cc25..6374f45973 100644 --- a/meta-openembedded/meta-oe/recipes-core/opencl/opencl-headers_git.bb +++ b/meta-openembedded/meta-oe/recipes-core/opencl/opencl-headers_git.bb @@ -17,3 +17,4 @@ do_install () { install -d ${D}${includedir}/CL/ install -m 0644 ${S}/CL/*.h ${D}${includedir}/CL } +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-core/packagegroups/packagegroup-meta-oe.bb b/meta-openembedded/meta-oe/recipes-core/packagegroups/packagegroup-meta-oe.bb index a5a033cae4..65eaf6a88f 100644 --- a/meta-openembedded/meta-oe/recipes-core/packagegroups/packagegroup-meta-oe.bb +++ b/meta-openembedded/meta-oe/recipes-core/packagegroups/packagegroup-meta-oe.bb @@ -77,14 +77,16 @@ RDEPENDS:packagegroup-meta-oe-benchmarks = "\ qperf \ s-suite \ stressapptest \ - sysbench \ tinymembench \ tiobench \ whetstone \ " -RDEPENDS:packagegroup-meta-oe-benchmarks:append:armv7a = " cpuburn-arm" -RDEPENDS:packagegroup-meta-oe-benchmarks:append:armv7ve = " cpuburn-arm" -RDEPENDS:packagegroup-meta-oe-benchmarks:append:aarch64 = " cpuburn-arm" +RDEPENDS:packagegroup-meta-oe-benchmarks:append:armv7a = " cpuburn-arm sysbench" +RDEPENDS:packagegroup-meta-oe-benchmarks:append:armv7ve = " cpuburn-arm sysbench" +RDEPENDS:packagegroup-meta-oe-benchmarks:append:aarch64 = " cpuburn-arm sysbench" +RDEPENDS:packagegroup-meta-oe-benchmarks:append:x86 = " sysbench" +RDEPENDS:packagegroup-meta-oe-benchmarks:append:x86-64 = " sysbench" +RDEPENDS:packagegroup-meta-oe-benchmarks:append:mips = " sysbench" RDEPENDS:packagegroup-meta-oe-benchmarks:remove:mipsarch = "libhugetlbfs" RDEPENDS:packagegroup-meta-oe-benchmarks:remove:mips64 = "tinymembench" @@ -657,7 +659,6 @@ RDEPENDS:packagegroup-meta-oe-kernel:remove:riscv64 = "crash makedumpfile oprofi RDEPENDS:packagegroup-meta-oe-kernel:remove:riscv32 = "crash makedumpfile oprofile" RDEPENDS:packagegroup-meta-oe-multimedia ="\ - alsa-oss \ ${@bb.utils.contains("LICENSE_FLAGS_ACCEPTED", "commercial", "faad2", "", d)} \ dirsplit \ genisoimage \ @@ -691,8 +692,6 @@ RDEPENDS:packagegroup-meta-oe-multimedia ="\ libopusenc \ " -RDEPENDS:packagegroup-meta-oe-multimedia:remove:libc-musl = "alsa-oss" - RDEPENDS:packagegroup-meta-oe-navigation ="\ geos \ ${@bb.utils.contains("DISTRO_FEATURES", "bluz4", "gpsd-machine-conf gpsd", "", d)} \ diff --git a/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-dirent-util-Remove-asserts-on-dirent64-dirent.patch b/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-dirent-util-Remove-asserts-on-dirent64-dirent.patch new file mode 100644 index 0000000000..517886c727 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-dirent-util-Remove-asserts-on-dirent64-dirent.patch @@ -0,0 +1,38 @@ +From 19cc68d4a89b59889be442d2997ff030cdc3de73 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 20 Dec 2022 20:11:17 -0800 +Subject: [PATCH] dirent-util: Remove asserts on dirent64 == dirent + +We already have assert_cc(_FILE_OFFSET_BITS == 64) which ensures that 64bit LFS functions are same as their original counterparts + +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/25809] +Signed-off-by: Khem Raj +--- + src/basic/dirent-util.h | 11 ----------- + 1 file changed, 11 deletions(-) + +diff --git a/src/basic/dirent-util.h b/src/basic/dirent-util.h +index 04bc53003f..4cb317184d 100644 +--- a/src/basic/dirent-util.h ++++ b/src/basic/dirent-util.h +@@ -35,17 +35,6 @@ struct dirent *readdir_no_dot(DIR *dirp); + /* Only if 64bit off_t is enabled struct dirent + struct dirent64 are actually the same. We require this, and + * we want them to be interchangeable to make getdents64() work, hence verify that. */ + assert_cc(_FILE_OFFSET_BITS == 64); +-assert_cc(sizeof(struct dirent) == sizeof(struct dirent64)); +-assert_cc(offsetof(struct dirent, d_ino) == offsetof(struct dirent64, d_ino)); +-assert_cc(sizeof_field(struct dirent, d_ino) == sizeof_field(struct dirent64, d_ino)); +-assert_cc(offsetof(struct dirent, d_off) == offsetof(struct dirent64, d_off)); +-assert_cc(sizeof_field(struct dirent, d_off) == sizeof_field(struct dirent64, d_off)); +-assert_cc(offsetof(struct dirent, d_reclen) == offsetof(struct dirent64, d_reclen)); +-assert_cc(sizeof_field(struct dirent, d_reclen) == sizeof_field(struct dirent64, d_reclen)); +-assert_cc(offsetof(struct dirent, d_type) == offsetof(struct dirent64, d_type)); +-assert_cc(sizeof_field(struct dirent, d_type) == sizeof_field(struct dirent64, d_type)); +-assert_cc(offsetof(struct dirent, d_name) == offsetof(struct dirent64, d_name)); +-assert_cc(sizeof_field(struct dirent, d_name) == sizeof_field(struct dirent64, d_name)); + + #define FOREACH_DIRENT_IN_BUFFER(de, buf, sz) \ + for (void *_end = (uint8_t*) ({ (de) = (buf); }) + (sz); \ +-- +2.39.0 + diff --git a/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-glibc-Remove-include-linux-fs.h-to-resolve-fsconfig_.patch b/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-glibc-Remove-include-linux-fs.h-to-resolve-fsconfig_.patch deleted file mode 100644 index 01afd37a37..0000000000 --- a/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-glibc-Remove-include-linux-fs.h-to-resolve-fsconfig_.patch +++ /dev/null @@ -1,74 +0,0 @@ -From b0933e76c6f0594c10cf8a9a70b34e15b68066d1 Mon Sep 17 00:00:00 2001 -From: Rudi Heitbaum -Date: Sat, 23 Jul 2022 10:38:49 +0000 -Subject: [PATCH] glibc: Remove #include to resolve fsconfig_command/mount_attr conflict with glibc 2.36 - -Upstream-Status: Backport [https://github.com/systemd/systemd/pull/23992/commits/21c03ad5e9d8d0350e30dae92a5e15da318a1539] -Signed-off-by: Khem Raj ---- - meson.build | 13 ++++++++++++- - src/basic/fd-util.c | 2 ++ - src/core/namespace.c | 2 ++ - src/shared/mount-util.c | 2 ++ - 4 files changed, 18 insertions(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -474,7 +474,6 @@ decl_headers = ''' - #include - #include - #include --#include - ''' - - foreach decl : ['char16_t', -@@ -486,6 +485,17 @@ foreach decl : ['char16_t', - # We get -1 if the size cannot be determined - have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 - -+ if decl == 'struct mount_attr' -+ if have -+ want_linux_fs_h = false -+ else -+ have = cc.sizeof(decl, -+ prefix : decl_headers + '#include ', -+ args : '-D_GNU_SOURCE') > 0 -+ want_linux_fs_h = have -+ endif -+ endif -+ - if decl == 'struct statx' - if have - want_linux_stat_h = false -@@ -501,6 +511,7 @@ foreach decl : ['char16_t', - endforeach - - conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) -+conf.set10('WANT_LINUX_FS_H', want_linux_fs_h) - - foreach ident : ['secure_getenv', '__secure_getenv'] - conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) ---- a/src/core/namespace.c -+++ b/src/core/namespace.c -@@ -6,7 +6,9 @@ - #include - #include - #include -+#if WANT_LINUX_FS_H - #include -+#endif - - #include "alloc-util.h" - #include "base-filesystem.h" ---- a/src/shared/mount-util.c -+++ b/src/shared/mount-util.c -@@ -7,7 +7,9 @@ - #include - #include - #include -+#if WANT_LINUX_FS_H - #include -+#endif - - #include "alloc-util.h" - #include "chase-symlinks.h" diff --git a/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-pass-correct-parameters-to-getdents64.patch b/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-pass-correct-parameters-to-getdents64.patch deleted file mode 100644 index 03a29b5327..0000000000 --- a/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd/0001-pass-correct-parameters-to-getdents64.patch +++ /dev/null @@ -1,50 +0,0 @@ -From fbc10748c7c59d82024a4d35146b8dfef8d52927 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 21 Jan 2022 15:15:11 -0800 -Subject: [PATCH 1/2] pass correct parameters to getdents64 - -Fixes -../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] - n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] - n = getdents64(fd, &buffer, sizeof(buffer)); - ^~~~~~~ - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - src/basic/recurse-dir.c | 2 +- - src/basic/stat-util.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c -index efa1797b7b..797285e3be 100644 ---- a/src/basic/recurse-dir.c -+++ b/src/basic/recurse-dir.c -@@ -54,7 +54,7 @@ int readdir_all(int dir_fd, - bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX); - assert(bs > de->buffer_size); - -- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); -+ n = getdents64(dir_fd, de->buffer + de->buffer_size, bs - de->buffer_size); - if (n < 0) - return -errno; - if (n == 0) -diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c -index efac7b002e..9e1fe7f5a0 100644 ---- a/src/basic/stat-util.c -+++ b/src/basic/stat-util.c -@@ -99,7 +99,7 @@ int dir_is_empty_at(int dir_fd, const char *path) { - return fd; - } - -- n = getdents64(fd, &buffer, sizeof(buffer)); -+ n = getdents64(fd, (struct dirent *)&buffer, sizeof(buffer)); - if (n < 0) - return -errno; - --- -2.34.1 - diff --git a/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_250.3.bb b/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_250.3.bb deleted file mode 100644 index 853cc20b67..0000000000 --- a/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_250.3.bb +++ /dev/null @@ -1,80 +0,0 @@ -SUMMARY = "libsystemd static library" -DESCRIPTION = "libsystemd static library built specifically as an integral component of sdbus-c++" - -SECTION = "libs" - -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" - -inherit meson pkgconfig - -DEPENDS += "gperf-native gettext-native util-linux libcap util-linux python3-jinja2-native" - -SRCREV = "73be9643910c3f7f3ff84765d63060846c110016" -SRCBRANCH = "v250-stable" -SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} \ - file://static-libsystemd-pkgconfig.patch \ - file://0001-glibc-Remove-include-linux-fs.h-to-resolve-fsconfig_.patch \ - " - -# patches needed by musl -SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}" - -SRC_URI_MUSL = "\ - file://0002-don-t-use-glibc-specific-qsort_r.patch \ - file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \ - file://0004-add-fallback-parse_printf_format-implementation.patch \ - file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ - file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ - file://0008-add-missing-FTW_-macros-for-musl.patch \ - file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ - file://0010-Use-uintmax_t-for-handling-rlim_t.patch \ - file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ - file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ - file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ - file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ - file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ - file://0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ - file://0017-missing_type.h-add-__compar_d_fn_t-definition.patch \ - file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \ - file://0019-Handle-missing-LOCK_EX.patch \ - file://0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \ - file://0021-test-json.c-define-M_PIl.patch \ - file://0022-do-not-disable-buffer-in-writing-files.patch \ - file://0025-Handle-__cpu_mask-usage.patch \ - file://0026-Handle-missing-gshadow.patch \ - file://0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \ - file://0001-pass-correct-parameters-to-getdents64.patch \ - file://0002-Add-sys-stat.h-for-S_IFDIR.patch \ - file://0001-Adjust-for-musl-headers.patch \ - " - -PACKAGECONFIG ??= "gshadow idn" -PACKAGECONFIG:remove:libc-musl = " gshadow idn" -PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false" -PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" - -CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 " - -EXTRA_OEMESON += "-Dstatic-libsystemd=pic" - -S = "${WORKDIR}/git" - -RDEPENDS:${PN}-dev = "" - -do_compile() { - ninja -v ${PARALLEL_MAKE} version.h - ninja -v ${PARALLEL_MAKE} libsystemd.a - ninja -v ${PARALLEL_MAKE} src/libsystemd/libsystemd.pc -} - -do_install () { - install -d ${D}${libdir} - install ${B}/libsystemd.a ${D}${libdir} - - install -d ${D}${includedir}/systemd - install ${S}/src/systemd/*.h ${D}${includedir}/systemd - - install -d ${D}${libdir}/pkgconfig - install ${B}/src/libsystemd/libsystemd.pc ${D}${libdir}/pkgconfig -} diff --git a/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_250.9.bb b/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_250.9.bb new file mode 100644 index 0000000000..14e927d075 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd_250.9.bb @@ -0,0 +1,79 @@ +SUMMARY = "libsystemd static library" +DESCRIPTION = "libsystemd static library built specifically as an integral component of sdbus-c++" + +SECTION = "libs" + +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" + +inherit meson pkgconfig + +DEPENDS += "gperf-native gettext-native util-linux libcap util-linux python3-jinja2-native" + +SRCREV = "1d5e0e9910500f3c3584485f77bfc35e601036e3" +SRCBRANCH = "v250-stable" +SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} \ + file://static-libsystemd-pkgconfig.patch \ + file://0001-dirent-util-Remove-asserts-on-dirent64-dirent.patch \ + " + +# patches needed by musl +SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}" + +SRC_URI_MUSL = "\ + file://0002-don-t-use-glibc-specific-qsort_r.patch \ + file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \ + file://0004-add-fallback-parse_printf_format-implementation.patch \ + file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ + file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ + file://0008-add-missing-FTW_-macros-for-musl.patch \ + file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ + file://0010-Use-uintmax_t-for-handling-rlim_t.patch \ + file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ + file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ + file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ + file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ + file://0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ + file://0017-missing_type.h-add-__compar_d_fn_t-definition.patch \ + file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \ + file://0019-Handle-missing-LOCK_EX.patch \ + file://0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \ + file://0021-test-json.c-define-M_PIl.patch \ + file://0022-do-not-disable-buffer-in-writing-files.patch \ + file://0025-Handle-__cpu_mask-usage.patch \ + file://0026-Handle-missing-gshadow.patch \ + file://0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \ + file://0002-Add-sys-stat.h-for-S_IFDIR.patch \ + file://0001-Adjust-for-musl-headers.patch \ + " + +PACKAGECONFIG ??= "gshadow idn" +PACKAGECONFIG:remove:libc-musl = " gshadow idn" +PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false" +PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" + +CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 " + +EXTRA_OEMESON += "-Dstatic-libsystemd=pic" + +S = "${WORKDIR}/git" + +RDEPENDS:${PN}-dev = "" + +do_compile() { + ninja -v ${PARALLEL_MAKE} version.h + ninja -v ${PARALLEL_MAKE} libsystemd.a + ninja -v ${PARALLEL_MAKE} src/libsystemd/libsystemd.pc +} + +do_install () { + install -d ${D}${libdir} + install ${B}/libsystemd.a ${D}${libdir} + + install -d ${D}${includedir}/systemd + install ${S}/src/systemd/*.h ${D}${includedir}/systemd + + install -d ${D}${libdir}/pkgconfig + install ${B}/src/libsystemd/libsystemd.pc ${D}${libdir}/pkgconfig +} diff --git a/meta-openembedded/meta-oe/recipes-crypto/botan/botan_2.19.2.bb b/meta-openembedded/meta-oe/recipes-crypto/botan/botan_2.19.2.bb deleted file mode 100644 index 5261367db2..0000000000 --- a/meta-openembedded/meta-oe/recipes-crypto/botan/botan_2.19.2.bb +++ /dev/null @@ -1,52 +0,0 @@ -SUMMARY = "Crypto and TLS for C++11" -HOMEPAGE = "https://botan.randombit.net" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://license.txt;md5=f4ce98476c07c34e1793daa036960fad" -SECTION = "libs" - -SRC_URI = "https://botan.randombit.net/releases/Botan-${PV}.tar.xz" -SRC_URI[sha256sum] = "3af5f17615c6b5cd8b832d269fb6cb4d54ec64f9eb09ddbf1add5093941b4d75" - -S = "${WORKDIR}/Botan-${PV}" - -inherit python3native siteinfo lib_package - -CPU ?= "${TARGET_ARCH}" -CPU:x86 = "x86_32" -CPU:armv7a = "armv7" -CPU:armv7ve = "armv7" - -do_configure() { - python3 ${S}/configure.py \ - --prefix="${D}${exec_prefix}" \ - --libdir="${D}${libdir}" \ - --cpu="${CPU}" \ - --cc-bin="${CXX}" \ - --cxxflags="${CXXFLAGS}" \ - --ldflags="${LDFLAGS}" \ - --with-endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ - ${@bb.utils.contains("TUNE_FEATURES","neon","","--disable-neon",d)} \ - --with-sysroot-dir=${STAGING_DIR_HOST} \ - --with-build-dir="${B}" \ - --optimize-for-size \ - --with-stack-protector \ - --enable-shared-library \ - --with-python-versions=3 \ - ${EXTRA_OECONF} -} - -do_compile() { - oe_runmake -} -do_install() { - oe_runmake install - sed -i -e "s|${D}||g" ${D}${libdir}/pkgconfig/botan-2.pc -} - -PACKAGES += "${PN}-python3" - -FILES:${PN}-python3 = "${libdir}/python3" - -RDEPENDS:${PN}-python3 += "python3" - -COMPATIBLE_HOST:riscv32 = "null" diff --git a/meta-openembedded/meta-oe/recipes-crypto/botan/botan_2.19.3.bb b/meta-openembedded/meta-oe/recipes-crypto/botan/botan_2.19.3.bb new file mode 100644 index 0000000000..8d9d423ce7 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-crypto/botan/botan_2.19.3.bb @@ -0,0 +1,52 @@ +SUMMARY = "Crypto and TLS for C++11" +HOMEPAGE = "https://botan.randombit.net" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://license.txt;md5=f4ce98476c07c34e1793daa036960fad" +SECTION = "libs" + +SRC_URI = "https://botan.randombit.net/releases/Botan-${PV}.tar.xz" +SRC_URI[sha256sum] = "dae047f399c5a47f087db5d3d9d9e8f11ae4985d14c928d71da1aff801802d55" + +S = "${WORKDIR}/Botan-${PV}" + +inherit python3native siteinfo lib_package + +CPU ?= "${TARGET_ARCH}" +CPU:x86 = "x86_32" +CPU:armv7a = "armv7" +CPU:armv7ve = "armv7" + +do_configure() { + python3 ${S}/configure.py \ + --prefix="${D}${exec_prefix}" \ + --libdir="${D}${libdir}" \ + --cpu="${CPU}" \ + --cc-bin="${CXX}" \ + --cxxflags="${CXXFLAGS}" \ + --ldflags="${LDFLAGS}" \ + --with-endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ + ${@bb.utils.contains("TUNE_FEATURES","neon","","--disable-neon",d)} \ + --with-sysroot-dir=${STAGING_DIR_HOST} \ + --with-build-dir="${B}" \ + --optimize-for-size \ + --with-stack-protector \ + --enable-shared-library \ + --with-python-versions=3 \ + ${EXTRA_OECONF} +} + +do_compile() { + oe_runmake +} +do_install() { + oe_runmake install + sed -i -e "s|${D}||g" ${D}${libdir}/pkgconfig/botan-2.pc +} + +PACKAGES += "${PN}-python3" + +FILES:${PN}-python3 = "${libdir}/python3" + +RDEPENDS:${PN}-python3 += "python3" + +COMPATIBLE_HOST:riscv32 = "null" diff --git a/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup/0001-Replace-off64_t-with-off_t.patch b/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup/0001-Replace-off64_t-with-off_t.patch new file mode 100644 index 0000000000..23aa86c0fb --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup/0001-Replace-off64_t-with-off_t.patch @@ -0,0 +1,101 @@ +From 683d0c525765415be34c269edf9cc066276f9f65 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 18 Dec 2022 13:53:51 -0800 +Subject: [PATCH] Replace off64_t with off_t + +AC_SYS_LARGEFILE autoconf macro is in use in configure script which will +add needed feature macros on commandline to enable 64bit off_t. + +Also replace lseek64 with lseek, since it will be same when +_FILE_OFFSET_BITS=64 is defined on relevant platforms via AC_SYS_LARGEFILE + +Upstream-Status: Submitted [https://gitlab.com/cryptsetup/cryptsetup/-/merge_requests/467] +Signed-off-by: Khem Raj +--- + lib/utils.c | 4 ++-- + lib/utils_wipe.c | 4 ++-- + src/utils_reencrypt_luks1.c | 12 ++++++------ + 3 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/lib/utils.c b/lib/utils.c +index 9d79ee29..be5f5287 100644 +--- a/lib/utils.c ++++ b/lib/utils.c +@@ -102,9 +102,9 @@ static int keyfile_seek(int fd, uint64_t bytes) + char tmp[BUFSIZ]; + size_t next_read; + ssize_t bytes_r; +- off64_t r; ++ off_t r; + +- r = lseek64(fd, bytes, SEEK_CUR); ++ r = lseek(fd, bytes, SEEK_CUR); + if (r > 0) + return 0; + if (r < 0 && errno != ESPIPE) +diff --git a/lib/utils_wipe.c b/lib/utils_wipe.c +index 285a9e77..0c376f44 100644 +--- a/lib/utils_wipe.c ++++ b/lib/utils_wipe.c +@@ -150,7 +150,7 @@ static int wipe_block(struct crypt_device *cd, int devfd, crypt_wipe_pattern pat + if (blockdev && pattern == CRYPT_WIPE_ZERO && + !wipe_zeroout(cd, devfd, offset, wipe_block_size)) { + /* zeroout ioctl does not move offset */ +- if (lseek64(devfd, offset + wipe_block_size, SEEK_SET) < 0) { ++ if (lseek(devfd, offset + wipe_block_size, SEEK_SET) < 0) { + log_err(cd, _("Cannot seek to device offset.")); + return -EINVAL; + } +@@ -221,7 +221,7 @@ int crypt_wipe_device(struct crypt_device *cd, + if (r) + goto out; + +- if (lseek64(devfd, offset, SEEK_SET) < 0) { ++ if (lseek(devfd, offset, SEEK_SET) < 0) { + log_err(cd, _("Cannot seek to device offset.")); + r = -EINVAL; + goto out; +diff --git a/src/utils_reencrypt_luks1.c b/src/utils_reencrypt_luks1.c +index 96368bdb..d83a1da4 100644 +--- a/src/utils_reencrypt_luks1.c ++++ b/src/utils_reencrypt_luks1.c +@@ -729,8 +729,8 @@ static int copy_data_forward(struct reenc_ctx *rc, int fd_old, int fd_new, + + log_dbg("Reencrypting in forward direction."); + +- if (lseek64(fd_old, rc->device_offset, SEEK_SET) < 0 || +- lseek64(fd_new, rc->device_offset, SEEK_SET) < 0) { ++ if (lseek(fd_old, rc->device_offset, SEEK_SET) < 0 || ++ lseek(fd_new, rc->device_offset, SEEK_SET) < 0) { + log_err(_("Cannot seek to device offset.")); + goto out; + } +@@ -788,7 +788,7 @@ static int copy_data_backward(struct reenc_ctx *rc, int fd_old, int fd_new, + size_t block_size, void *buf, uint64_t *bytes) + { + ssize_t s1, s2, working_block; +- off64_t working_offset; ++ off_t working_offset; + int r = -EIO; + char *backing_file = NULL; + struct tools_progress_params prog_parms = { +@@ -827,8 +827,8 @@ static int copy_data_backward(struct reenc_ctx *rc, int fd_old, int fd_new, + working_block = block_size; + } + +- if (lseek64(fd_old, working_offset, SEEK_SET) < 0 || +- lseek64(fd_new, working_offset, SEEK_SET) < 0) { ++ if (lseek(fd_old, working_offset, SEEK_SET) < 0 || ++ lseek(fd_new, working_offset, SEEK_SET) < 0) { + log_err(_("Cannot seek to device offset.")); + goto out; + } +@@ -874,7 +874,7 @@ static void zero_rest_of_device(int fd, size_t block_size, void *buf, + + log_dbg("Zeroing rest of device."); + +- if (lseek64(fd, offset, SEEK_SET) < 0) { ++ if (lseek(fd, offset, SEEK_SET) < 0) { + log_dbg("Cannot seek to device offset."); + return; + } diff --git a/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup_2.4.3.bb b/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup_2.4.3.bb deleted file mode 100644 index 652fd66614..0000000000 --- a/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup_2.4.3.bb +++ /dev/null @@ -1,116 +0,0 @@ -SUMMARY = "Manage plain dm-crypt and LUKS encrypted volumes" -DESCRIPTION = "Cryptsetup is used to conveniently setup dm-crypt managed \ -device-mapper mappings. These include plain dm-crypt volumes and \ -LUKS volumes. The difference is that LUKS uses a metadata header \ -and can hence offer more features than plain dm-crypt. On the other \ -hand, the header is visible and vulnerable to damage." -HOMEPAGE = "https://gitlab.com/cryptsetup/cryptsetup" -SECTION = "console" -LICENSE = "GPL-2.0-with-OpenSSL-exception" -LIC_FILES_CHKSUM = "file://COPYING;md5=32107dd283b1dfeb66c9b3e6be312326" - -DEPENDS = " \ - json-c \ - libdevmapper \ - popt \ - util-linux-libuuid \ -" - -DEPENDS:append:libc-musl = " argp-standalone" -LDFLAGS:append:libc-musl = " -largp" - -SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/v${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}/${BP}.tar.xz" -SRC_URI[sha256sum] = "fc0df945188172264ec5bf1d0bda08264fadc8a3f856d47eba91f31fe354b507" - -inherit autotools gettext pkgconfig - -# Use openssl because libgcrypt drops root privileges -# if libgcrypt is linked with libcap support -PACKAGECONFIG ??= " \ - keyring \ - cryptsetup \ - veritysetup \ - cryptsetup-reencrypt \ - integritysetup \ - ${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)} \ - kernel_crypto \ - internal-argon2 \ - blkid \ - luks-adjust-xts-keysize \ - openssl \ - ssh-token \ -" -PACKAGECONFIG:append:class-target = " \ - udev \ -" - -PACKAGECONFIG[keyring] = "--enable-keyring,--disable-keyring" -PACKAGECONFIG[fips] = "--enable-fips,--disable-fips" -PACKAGECONFIG[pwquality] = "--enable-pwquality,--disable-pwquality,libpwquality" -PACKAGECONFIG[passwdqc] = "--enable-passwdqc,--disable-passwdqc,passwdqc" -PACKAGECONFIG[cryptsetup] = "--enable-cryptsetup,--disable-cryptsetup" -PACKAGECONFIG[veritysetup] = "--enable-veritysetup,--disable-veritysetup" -PACKAGECONFIG[cryptsetup-reencrypt] = "--enable-cryptsetup-reencrypt,--disable-cryptsetup-reencrypt" -PACKAGECONFIG[integritysetup] = "--enable-integritysetup,--disable-integritysetup" -PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux" -PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,,udev lvm2-udevrules" -PACKAGECONFIG[kernel_crypto] = "--enable-kernel_crypto,--disable-kernel_crypto" -# gcrypt-pkbdf2 requries --with-crypto_backend=gcrypt or the flag isn't -# recognized. -PACKAGECONFIG[gcrypt-pbkdf2] = "--enable-gcrypt-pbkdf2" -PACKAGECONFIG[internal-argon2] = "--enable-internal-argon2,--disable-internal-argon2" -PACKAGECONFIG[internal-sse-argon2] = "--enable-internal-sse-argon2,--disable-internal-sse-argon2" -PACKAGECONFIG[blkid] = "--enable-blkid,--disable-blkid,util-linux" -PACKAGECONFIG[dev-random] = "--enable-dev-random,--disable-dev-random" -PACKAGECONFIG[luks-adjust-xts-keysize] = "--enable-luks-adjust-xts-keysize,--disable-luks-adjust-xts-keysize" -PACKAGECONFIG[openssl] = "--with-crypto_backend=openssl,,openssl" -PACKAGECONFIG[gcrypt] = "--with-crypto_backend=gcrypt,,libgcrypt" -PACKAGECONFIG[nss] = "--with-crypto_backend=nss,,nss" -PACKAGECONFIG[kernel] = "--with-crypto_backend=kernel" -PACKAGECONFIG[nettle] = "--with-crypto_backend=nettle,,nettle" -PACKAGECONFIG[luks2] = "--with-default-luks-format=LUKS2,--with-default-luks-format=LUKS1" -PACKAGECONFIG[ssh-token] = "--enable-ssh-token,--disable-ssh-token,libssh" - -EXTRA_OECONF = "--enable-static" -# Building without largefile is not supported by upstream -EXTRA_OECONF += "--enable-largefile" -# Requires a static popt library -EXTRA_OECONF += "--disable-static-cryptsetup" -# There's no recipe for libargon2 yet -EXTRA_OECONF += "--disable-libargon2" - -# libcryptsetup default PBKDF algorithm, Argon2 memory cost (KB), parallel threads and iteration time (ms) -LUKS2_PBKDF ?= "argon2i" -LUKS2_MEMORYKB ?= "1048576" -LUKS2_PARALLEL_THREADS ?= "4" -LUKS2_ITERTIME ?= "2000" - -EXTRA_OECONF += "--with-luks2-pbkdf=${LUKS2_PBKDF} \ - --with-luks2-memory-kb=${LUKS2_MEMORYKB} \ - --with-luks2-parallel-threads=${LUKS2_PARALLEL_THREADS} \ - --with-luks2-iter-time=${LUKS2_ITERTIME}" - -do_install:append() { - # The /usr/lib/cryptsetup directory is always created, even when ssh-token - # is disabled. In that case it is empty and causes a packaging error. Since - # there is no reason to distribute the empty directory, the easiest solution - # is to remove it if it is empty. - rmdir -p --ignore-fail-on-non-empty ${D}${libdir}/${BPN} -} - -FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','${exec_prefix}/lib/tmpfiles.d/cryptsetup.conf', '', d)}" - -RDEPENDS:${PN} = " \ - libdevmapper \ -" - -RRECOMMENDS:${PN}:class-target = " \ - kernel-module-aes-generic \ - kernel-module-dm-crypt \ - kernel-module-md5 \ - kernel-module-cbc \ - kernel-module-sha256-generic \ - kernel-module-xts \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup_2.6.0.bb b/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup_2.6.0.bb new file mode 100644 index 0000000000..1d4f440871 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-crypto/cryptsetup/cryptsetup_2.6.0.bb @@ -0,0 +1,119 @@ +SUMMARY = "Manage plain dm-crypt and LUKS encrypted volumes" +DESCRIPTION = "Cryptsetup is used to conveniently setup dm-crypt managed \ +device-mapper mappings. These include plain dm-crypt volumes and \ +LUKS volumes. The difference is that LUKS uses a metadata header \ +and can hence offer more features than plain dm-crypt. On the other \ +hand, the header is visible and vulnerable to damage." +HOMEPAGE = "https://gitlab.com/cryptsetup/cryptsetup" +SECTION = "console" +LICENSE = "GPL-2.0-with-OpenSSL-exception" +LIC_FILES_CHKSUM = "file://COPYING;md5=32107dd283b1dfeb66c9b3e6be312326" + +DEPENDS = " \ + json-c \ + libdevmapper \ + popt \ + util-linux-libuuid \ +" + +DEPENDS:append:libc-musl = " argp-standalone" +LDFLAGS:append:libc-musl = " -largp" + +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/v${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}/${BP}.tar.xz \ + file://0001-Replace-off64_t-with-off_t.patch \ + " +SRC_URI[sha256sum] = "44397ba76e75a9cde5b02177bc63cd7af428a785788e3a7067733e7761842735" + +inherit autotools gettext pkgconfig + +# Use openssl because libgcrypt drops root privileges +# if libgcrypt is linked with libcap support +PACKAGECONFIG ??= " \ + keyring \ + cryptsetup \ + veritysetup \ + luks2-reencryption \ + integritysetup \ + ${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)} \ + kernel_crypto \ + internal-argon2 \ + blkid \ + luks-adjust-xts-keysize \ + openssl \ + ssh-token \ +" +PACKAGECONFIG:append:class-target = " \ + udev \ +" + +PACKAGECONFIG[keyring] = "--enable-keyring,--disable-keyring" +PACKAGECONFIG[fips] = "--enable-fips,--disable-fips" +PACKAGECONFIG[pwquality] = "--enable-pwquality,--disable-pwquality,libpwquality" +PACKAGECONFIG[passwdqc] = "--enable-passwdqc,--disable-passwdqc,passwdqc" +PACKAGECONFIG[cryptsetup] = "--enable-cryptsetup,--disable-cryptsetup" +PACKAGECONFIG[veritysetup] = "--enable-veritysetup,--disable-veritysetup" +PACKAGECONFIG[luks2-reencryption] = "--enable-luks2-reencryption,--disable-luks2-reencryption" +PACKAGECONFIG[integritysetup] = "--enable-integritysetup,--disable-integritysetup" +PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux" +PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,,udev lvm2-udevrules" +PACKAGECONFIG[kernel_crypto] = "--enable-kernel_crypto,--disable-kernel_crypto" +# gcrypt-pkbdf2 requries --with-crypto_backend=gcrypt or the flag isn't +# recognized. +PACKAGECONFIG[gcrypt-pbkdf2] = "--enable-gcrypt-pbkdf2" +PACKAGECONFIG[internal-argon2] = "--enable-internal-argon2,--disable-internal-argon2" +PACKAGECONFIG[internal-sse-argon2] = "--enable-internal-sse-argon2,--disable-internal-sse-argon2" +PACKAGECONFIG[blkid] = "--enable-blkid,--disable-blkid,util-linux" +PACKAGECONFIG[dev-random] = "--enable-dev-random,--disable-dev-random" +PACKAGECONFIG[luks-adjust-xts-keysize] = "--enable-luks-adjust-xts-keysize,--disable-luks-adjust-xts-keysize" +PACKAGECONFIG[openssl] = "--with-crypto_backend=openssl,,openssl" +PACKAGECONFIG[gcrypt] = "--with-crypto_backend=gcrypt,,libgcrypt" +PACKAGECONFIG[nss] = "--with-crypto_backend=nss,,nss" +PACKAGECONFIG[kernel] = "--with-crypto_backend=kernel" +PACKAGECONFIG[nettle] = "--with-crypto_backend=nettle,,nettle" +PACKAGECONFIG[luks2] = "--with-default-luks-format=LUKS2,--with-default-luks-format=LUKS1" +PACKAGECONFIG[ssh-token] = "--enable-ssh-token,--disable-ssh-token,libssh" + +EXTRA_OECONF = "--enable-static" +# Building without largefile is not supported by upstream +EXTRA_OECONF += "--enable-largefile" +# Requires a static popt library +EXTRA_OECONF += "--disable-static-cryptsetup" +# There's no recipe for libargon2 yet +EXTRA_OECONF += "--disable-libargon2" +# Disable documentation, there is no asciidoctor-native available in OE +EXTRA_OECONF += "--disable-asciidoc" +# libcryptsetup default PBKDF algorithm, Argon2 memory cost (KB), parallel threads and iteration time (ms) +LUKS2_PBKDF ?= "argon2i" +LUKS2_MEMORYKB ?= "1048576" +LUKS2_PARALLEL_THREADS ?= "4" +LUKS2_ITERTIME ?= "2000" + +EXTRA_OECONF += "--with-luks2-pbkdf=${LUKS2_PBKDF} \ + --with-luks2-memory-kb=${LUKS2_MEMORYKB} \ + --with-luks2-parallel-threads=${LUKS2_PARALLEL_THREADS} \ + --with-luks2-iter-time=${LUKS2_ITERTIME}" + +do_install:append() { + # The /usr/lib/cryptsetup directory is always created, even when ssh-token + # is disabled. In that case it is empty and causes a packaging error. Since + # there is no reason to distribute the empty directory, the easiest solution + # is to remove it if it is empty. + rmdir -p --ignore-fail-on-non-empty ${D}${libdir}/${BPN} +} + +FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','${exec_prefix}/lib/tmpfiles.d/cryptsetup.conf', '', d)}" + +RDEPENDS:${PN} = " \ + libdevmapper \ +" + +RRECOMMENDS:${PN}:class-target = " \ + kernel-module-aes-generic \ + kernel-module-dm-crypt \ + kernel-module-md5 \ + kernel-module-cbc \ + kernel-module-sha256-generic \ + kernel-module-xts \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.11.1.bb b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.11.1.bb new file mode 100644 index 0000000000..578357b480 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.11.1.bb @@ -0,0 +1,23 @@ +require mariadb.inc +inherit native + +PROVIDES += "mysql5-native" +DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native \ +gnutls-native fmt-native \ +" + +RDEPENDS:${PN} = "" +PACKAGES = "" +EXTRA_OEMAKE = "" + +do_install() { + oe_runmake 'DESTDIR=${D}' install + + install -d ${D}${bindir} + install -m 0755 sql/gen_lex_hash ${D}${bindir}/ + install -m 0755 sql/gen_lex_token ${D}${bindir}/ + install -m 0755 extra/comp_err ${D}${bindir}/ + install -m 0755 scripts/comp_sql ${D}${bindir}/ + install -m 0755 strings/uca-dump ${D}${bindir}/ +} + diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.8.3.bb b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.8.3.bb deleted file mode 100644 index 17a06349b0..0000000000 --- a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb-native_10.8.3.bb +++ /dev/null @@ -1,22 +0,0 @@ -require mariadb.inc -inherit native - -PROVIDES += "mysql5-native" -DEPENDS = "ncurses-native zlib-native bison-native libpcre2-native \ -gnutls-native fmt-native \ -" - -RDEPENDS:${PN} = "" -PACKAGES = "" -EXTRA_OEMAKE = "" - -do_install() { - oe_runmake 'DESTDIR=${D}' install - - install -d ${D}${bindir} - install -m 0755 sql/gen_lex_hash ${D}${bindir}/ - install -m 0755 sql/gen_lex_token ${D}${bindir}/ - install -m 0755 extra/comp_err ${D}${bindir}/ - install -m 0755 scripts/comp_sql ${D}${bindir}/ -} - diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb.inc b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb.inc index 2ef0d1aa3b..4e285aea7e 100644 --- a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb.inc +++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb.inc @@ -21,10 +21,10 @@ SRC_URI = "https://archive.mariadb.org/${BP}/source/${BP}.tar.gz \ file://sys_futex.patch \ file://cross-compiling.patch \ file://0001-sql-CMakeLists.txt-fix-gen_lex_hash-not-found.patch \ + file://lfs64.patch \ " SRC_URI:append:libc-musl = " file://ppc-remove-glibc-dep.patch" - -SRC_URI[sha256sum] = "887eadc55176ac1ead1fccfc89ade4b5990ef192745ad4dcd879acb41c050892" +SRC_URI[sha256sum] = "ffacf84e74daf249ad64b9573d79a4e882f66b004614f8b33bfcb14a8e25da1d" UPSTREAM_CHECK_URI = "https://github.com/MariaDB/server/releases" diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/lfs64.patch b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/lfs64.patch new file mode 100644 index 0000000000..9867908c6c --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb/lfs64.patch @@ -0,0 +1,19 @@ +--- a/storage/connect/os.h ++++ b/storage/connect/os.h +@@ -2,13 +2,15 @@ + #ifndef _OS_H_INCLUDED + #define _OS_H_INCLUDED + +-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) ++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) || (defined(__linux__) && !defined(__GLIBC__)) + typedef off_t off64_t; + #define lseek64(fd, offset, whence) lseek((fd), (offset), (whence)) + #define open64(path, flags, mode) open((path), (flags), (mode)) + #define ftruncate64(fd, length) ftruncate((fd), (length)) ++#ifndef O_LARGEFILE + #define O_LARGEFILE 0 + #endif ++#endif + + #ifdef _AIX + #ifndef O_LARGEFILE diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.11.1.bb b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.11.1.bb new file mode 100644 index 0000000000..87faabfa27 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.11.1.bb @@ -0,0 +1,26 @@ +require mariadb.inc + +DEPENDS += "mariadb-native bison-native boost libpcre2 curl ncurses \ + zlib libaio libedit libevent libxml2 gnutls fmt lzo zstd" + +PROVIDES += "mysql5 libmysqlclient" + +RPROVIDES:${PN} += "mysql5" +RREPLACES:${PN} += "mysql5" +RCONFLICTS:${PN} += "mysql5" + +RPROVIDES:${PN}-dbg += "mysql5-dbg" +RREPLACES:${PN}-dbg += "mysql5-dbg" +RCONFLICTS:${PN}-dbg += "mysql5-dbg" + +RPROVIDES:${PN}-leftovers += "mysql5-leftovers" +RREPLACES:${PN}-leftovers += "mysql5-leftovers" +RCONFLICTS:${PN}-leftovers += "mysql5-leftovers" + +RPROVIDES:${PN}-client += "mysql5-client" +RREPLACES:${PN}-client += "mysql5-client" +RCONFLICTS:${PN}-client += "mysql5-client" + +RPROVIDES:${PN}-server += "mysql5-server" +RREPLACES:${PN}-server += "mysql5-server" +RCONFLICTS:${PN}-server += "mysql5-server" diff --git a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb b/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb deleted file mode 100644 index 87faabfa27..0000000000 --- a/meta-openembedded/meta-oe/recipes-dbs/mysql/mariadb_10.8.3.bb +++ /dev/null @@ -1,26 +0,0 @@ -require mariadb.inc - -DEPENDS += "mariadb-native bison-native boost libpcre2 curl ncurses \ - zlib libaio libedit libevent libxml2 gnutls fmt lzo zstd" - -PROVIDES += "mysql5 libmysqlclient" - -RPROVIDES:${PN} += "mysql5" -RREPLACES:${PN} += "mysql5" -RCONFLICTS:${PN} += "mysql5" - -RPROVIDES:${PN}-dbg += "mysql5-dbg" -RREPLACES:${PN}-dbg += "mysql5-dbg" -RCONFLICTS:${PN}-dbg += "mysql5-dbg" - -RPROVIDES:${PN}-leftovers += "mysql5-leftovers" -RREPLACES:${PN}-leftovers += "mysql5-leftovers" -RCONFLICTS:${PN}-leftovers += "mysql5-leftovers" - -RPROVIDES:${PN}-client += "mysql5-client" -RREPLACES:${PN}-client += "mysql5-client" -RCONFLICTS:${PN}-client += "mysql5-client" - -RPROVIDES:${PN}-server += "mysql5-server" -RREPLACES:${PN}-server += "mysql5-server" -RCONFLICTS:${PN}-server += "mysql5-server" diff --git a/meta-openembedded/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-direct_mmap-Use-off_t-on-linux.patch b/meta-openembedded/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-direct_mmap-Use-off_t-on-linux.patch new file mode 100644 index 0000000000..49df528d7e --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-direct_mmap-Use-off_t-on-linux.patch @@ -0,0 +1,42 @@ +From 45fdade6c0415ec5af3f9312e6311a4ccc682a7b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 28 Dec 2022 18:24:21 -0800 +Subject: [PATCH] direct_mmap: Use off_t on linux + +off64_t is not provided without defining _LARGEFILE64_SOURCE on musl +this define is not defined automatically like glibc where it gets +defined when _GNU_SOURCE is defined. Using off_t makes it portable +across musl/glibc and for using 64bit off_t on glibc 32bit systems +-D_FILE_OFFSET_BITS=64 can be defined during build via CXXFLAGS + +Upstream-Status: Submitted [https://github.com/abseil/abseil-cpp/pull/1349] +Signed-off-by: Khem Raj +--- + absl/base/internal/direct_mmap.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/absl/base/internal/direct_mmap.h b/absl/base/internal/direct_mmap.h +index 815b8d23..fdf88f0b 100644 +--- a/absl/base/internal/direct_mmap.h ++++ b/absl/base/internal/direct_mmap.h +@@ -72,7 +72,7 @@ namespace base_internal { + // Platform specific logic extracted from + // https://chromium.googlesource.com/linux-syscall-support/+/master/linux_syscall_support.h + inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, +- off64_t offset) noexcept { ++ off_t offset) noexcept { + #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ + defined(__m68k__) || defined(__sh__) || \ + (defined(__hppa__) && !defined(__LP64__)) || \ +@@ -102,7 +102,7 @@ inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, + #else + return reinterpret_cast( + syscall(SYS_mmap2, start, length, prot, flags, fd, +- static_cast(offset / pagesize))); ++ offset / pagesize)); + #endif + #elif defined(__s390x__) + // On s390x, mmap() arguments are passed in memory. +-- +2.39.0 + diff --git a/meta-openembedded/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb b/meta-openembedded/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb index 9f8c48cfa4..f7f8fc848e 100644 --- a/meta-openembedded/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb +++ b/meta-openembedded/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb @@ -15,6 +15,7 @@ SRC_URI = "git://github.com/abseil/abseil-cpp;branch=${BRANCH};protocol=https \ file://0002-Remove-maes-option-from-cross-compilation.patch \ file://abseil-ppc-fixes.patch \ file://0003-Remove-neon-option-from-cross-compilation.patch \ + file://0001-direct_mmap-Use-off_t-on-linux.patch \ " S = "${WORKDIR}/git" diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-start b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-start index 479f14ae7e..76b5e29624 100644 --- a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-start +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-start @@ -6,4 +6,4 @@ sleep 10 ls /sys/class/udc/ | head -n 1 | xargs echo -n > /sys/kernel/config/usb_gadget/adb/UDC -bbnote "Setting UDC $(ls /sys/class/udc/ | head -n 1) for USB ADB Gadget usage" +echo "Setting UDC $(ls /sys/class/udc/ | head -n 1) for USB ADB Gadget usage" diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/core/0006-adb-Musl-fixes.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/core/0006-adb-Musl-fixes.patch index b5d383f383..53f7bcb8e8 100644 --- a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/core/0006-adb-Musl-fixes.patch +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/core/0006-adb-Musl-fixes.patch @@ -15,8 +15,6 @@ Signed-off-by: Khem Raj adb/sysdeps.h | 12 ++++++------ 4 files changed, 20 insertions(+), 14 deletions(-) -diff --git a/adb/adb.h b/adb/adb.h -index 44e5981bdc..bcdc49f63c 100644 --- a/adb/adb.h +++ b/adb/adb.h @@ -18,7 +18,9 @@ @@ -29,11 +27,9 @@ index 44e5981bdc..bcdc49f63c 100644 #include "adb_trace.h" #include "transport.h" /* readx(), writex() */ -diff --git a/adb/disable_verity_service.c b/adb/disable_verity_service.c -index ed3da52108..29fa3d65a9 100644 --- a/adb/disable_verity_service.c +++ b/adb/disable_verity_service.c -@@ -14,25 +14,28 @@ +@@ -14,25 +14,32 @@ * limitations under the License. */ @@ -51,13 +47,18 @@ index ed3da52108..29fa3d65a9 100644 #include #include #include -+#include -+#include -+#include - +- -#include "cutils/properties.h" -#include "ext4_sb.h" -#include ++#include ++#include ++#include ++ ++#if defined(__linux__) && !defined(__GLIBC__) ++#define lseek64 lseek ++#define off64_t off_t ++#endif #define FSTAB_PREFIX "/fstab." struct fstab *fstab; @@ -67,8 +68,6 @@ index ed3da52108..29fa3d65a9 100644 static void write_console(int fd, const char* format, ...) { char buffer[256]; -diff --git a/adb/framebuffer_service.c b/adb/framebuffer_service.c -index 8cbe8403cc..8f0ccfb7aa 100644 --- a/adb/framebuffer_service.c +++ b/adb/framebuffer_service.c @@ -14,6 +14,10 @@ @@ -92,11 +91,9 @@ index 8cbe8403cc..8f0ccfb7aa 100644 #include #include #include -diff --git a/adb/sysdeps.h b/adb/sysdeps.h -index cc1f839e9f..ea39ac39cc 100644 --- a/adb/sysdeps.h +++ b/adb/sysdeps.h -@@ -123,8 +123,8 @@ static __inline__ int unix_close(int fd) +@@ -123,8 +123,8 @@ static __inline__ int unix_close(int fd { return close(fd); } @@ -118,7 +115,7 @@ index cc1f839e9f..ea39ac39cc 100644 static __inline__ int adb_read(int fd, void* buf, size_t len) -@@ -392,8 +392,8 @@ static __inline__ int adb_lseek(int fd, int pos, int where) +@@ -392,8 +392,8 @@ static __inline__ int adb_lseek(int f { return lseek(fd, pos, where); } diff --git a/meta-openembedded/meta-oe/recipes-devtools/boost-url/boost-url_git.bb b/meta-openembedded/meta-oe/recipes-devtools/boost-url/boost-url_git.bb deleted file mode 100644 index 14da3ca3f1..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/boost-url/boost-url_git.bb +++ /dev/null @@ -1,20 +0,0 @@ -DESCRIPTION = "Boost.URL is a library for manipulating Uniform Resource Identifiers (URI) and Locators (URL)" -HOMEPAGE = "https://github.com/CPPAlliance/url" -SECTION = "libs" -LICENSE = "BSL-1.0" -LIC_FILES_CHKSUM = "file://LICENSE_1_0.txt;md5=e4224ccaecb14d942c71d31bef20d78c" - -SRC_URI = "git://github.com/CPPAlliance/url.git;branch=develop;protocol=https" - -SRCREV = "d740a92d38e3a8f4d5b2153f53b82f1c98e312ab" - -S = "${WORKDIR}/git" - -DEPENDS = "boost" - -BBCLASSEXTEND = "native nativesdk" - -do_install() { - mkdir -p ${D}/${includedir} - cp -r ${S}/include/** ${D}/${includedir}/ -} diff --git a/meta-openembedded/meta-oe/recipes-devtools/capnproto/capnproto_0.10.2.bb b/meta-openembedded/meta-oe/recipes-devtools/capnproto/capnproto_0.10.2.bb deleted file mode 100644 index 3d4f549b62..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/capnproto/capnproto_0.10.2.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "Cap'n Proto serialization/RPC system" -DESCRIPTION = "Cap’n Proto is an insanely fast data interchange format and capability-based RPC system. " -HOMEPAGE = "https://github.com/sandstorm-io/capnproto" -SECTION = "console/tools" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://../LICENSE;md5=a05663ae6cca874123bf667a60dca8c9" - -SRC_URI = "git://github.com/sandstorm-io/capnproto.git;branch=release-${PV};protocol=https \ - " -SRCREV = "2e88221d3dde22266bfccf40eaee6ff9b40d113d" - -S = "${WORKDIR}/git/c++" - -inherit cmake - -CXXFLAGS:append:mips = " -latomic" -CXXFLAGS:append:powerpc = " -latomic" -CXXFLAGS:append:riscv32 = " -latomic" - -EXTRA_OECMAKE += "\ - -DBUILD_TESTING=OFF \ -" - -FILES:${PN}-compiler = "${bindir}" - -PACKAGE_BEFORE_PN = "${PN}-compiler" -RDEPENDS:${PN}-dev += "${PN}-compiler" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-devtools/capnproto/capnproto_0.10.3.bb b/meta-openembedded/meta-oe/recipes-devtools/capnproto/capnproto_0.10.3.bb new file mode 100644 index 0000000000..bf98d561e6 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/capnproto/capnproto_0.10.3.bb @@ -0,0 +1,28 @@ +SUMMARY = "Cap'n Proto serialization/RPC system" +DESCRIPTION = "Cap’n Proto is an insanely fast data interchange format and capability-based RPC system. " +HOMEPAGE = "https://github.com/sandstorm-io/capnproto" +SECTION = "console/tools" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://../LICENSE;md5=a05663ae6cca874123bf667a60dca8c9" + +SRC_URI = "git://github.com/sandstorm-io/capnproto.git;branch=release-0.10.3;protocol=https" +SRCREV = "a16468f296a9584f4068072efecdee8a9eb9c2ed" + +S = "${WORKDIR}/git/c++" + +inherit cmake + +CXXFLAGS:append:mips = " -latomic" +CXXFLAGS:append:powerpc = " -latomic" +CXXFLAGS:append:riscv32 = " -latomic" + +EXTRA_OECMAKE += "\ + -DBUILD_TESTING=OFF \ +" + +FILES:${PN}-compiler = "${bindir}" + +PACKAGE_BEFORE_PN = "${PN}-compiler" +RDEPENDS:${PN}-dev += "${PN}-compiler" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-build-Use-ilp32d-abi-on-riscv32-and-lp64d-on-rv64.patch b/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-build-Use-ilp32d-abi-on-riscv32-and-lp64d-on-rv64.patch new file mode 100644 index 0000000000..a8ff77298f --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-build-Use-ilp32d-abi-on-riscv32-and-lp64d-on-rv64.patch @@ -0,0 +1,32 @@ +From 00f822ab79b6c06936147af4d832e439cecf0fc0 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 7 Jan 2023 19:31:58 -0800 +Subject: [PATCH] build: Use ilp32d abi on riscv32 and lp64d on rv64 + +ilp32d is common ABI used for linux distributions therefore a better +default, similarily lp64d is common ABI for rv64 linux + +Upstream-Status: Submitted [https://github.com/concurrencykit/ck/pull/204] +Signed-off-by: Khem Raj +--- + build/ck.build.riscv | 2 +- + build/ck.build.riscv64 | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/build/ck.build.riscv b/build/ck.build.riscv +index 61e0033..11ac840 100644 +--- a/build/ck.build.riscv ++++ b/build/ck.build.riscv +@@ -1 +1 @@ +-CFLAGS+=-mabi=ilp32 ++CFLAGS+=-mabi=ilp32d +diff --git a/build/ck.build.riscv64 b/build/ck.build.riscv64 +index 9f89791..7639bd6 100644 +--- a/build/ck.build.riscv64 ++++ b/build/ck.build.riscv64 +@@ -1 +1 @@ +-CFLAGS+=-mabi=lp64 ++CFLAGS+=-mabi=lp64d +-- +2.39.0 + diff --git a/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-configure-Fix-compoiler-detection-logic-for-cross-co.patch b/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-configure-Fix-compoiler-detection-logic-for-cross-co.patch new file mode 100644 index 0000000000..6be0246626 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/0001-configure-Fix-compoiler-detection-logic-for-cross-co.patch @@ -0,0 +1,84 @@ +From e1dcd27e816520bdabc69511d90c4a2ebc242831 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 6 Jan 2023 18:51:34 -0800 +Subject: [PATCH] configure: Fix compoiler detection logic for + cross-compilation + +We can not run binaries during cross compile, so poke at compiler to +figure out if it is clang or gcc, for OE we do not have other compilers +in opensource world if there are we can extend this logic + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Khem Raj +--- + configure | 56 ++++++++++++++++--------------------------------------- + 1 file changed, 16 insertions(+), 40 deletions(-) + +--- a/configure ++++ b/configure +@@ -661,48 +661,24 @@ if test "$PROFILE"; then + fi + + printf "Finding suitable compiler........" +-if test ! -x "${CC}"; then +- CC=`pathsearch "${CC:-cc}"` +- if test -z "$CC" -o ! -x "$CC"; then +- CC=`pathsearch "${CC:-gcc}"` +- fi ++if test -z "$CC"; then ++ if test ! -x "${CC}"; then ++ CC=`pathsearch "${CC:-cc}"` ++ if test -z "$CC" -o ! -x "$CC"; then ++ CC=`pathsearch "${CC:-gcc}"` ++ fi ++ fi ++ assert "$CC" "not found" ++fi ++if `$CC --version | grep gcc >& /dev/null`; then ++ COMPILER=gcc ++elif `$CC --version | grep clang >& /dev/null`; then ++ COMPILER=clang ++else ++ COMPILER="not-found" + fi +-assert "$CC" "not found" +- +-cat << EOF > .1.c +-#include +-int main(void) { +-#if defined(_WIN32) +-#if defined(__MINGW64__) +- puts("mingw64"); +- return (0); +-#elif defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION >= 3) +- puts("mingw32"); +- return (0); +-#else +- return (1); +-#endif /* __MINGW32__ && __MINGW32_MAJOR_VERSION >= 3 */ +-#elif defined(__clang__) && (__clang_major__ >= 3) +- puts("clang"); +- return (0); +-#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5110) +- puts("suncc"); +- return (0); +-#elif defined(__GNUC__) && (__GNUC__ >= 4) +- puts("gcc"); +- return (0); +-#else +- return (1); +-#endif +-} +-EOF +- +-$CC -o .1 .1.c +-COMPILER=`./.1 2> /dev/null` +-r=$? +-rm -f .1.c .1 + +-if test "$r" -ne 0; then ++if test "$COMPILER" = "not-found"; then + assert "" "update compiler" + else + echo "success [$CC]" diff --git a/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/cross.patch b/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/cross.patch deleted file mode 100644 index 9e5058f2ca..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit/cross.patch +++ /dev/null @@ -1,62 +0,0 @@ -From ab0eec78382bd00ce533aec2c84fd50c1733033d Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 5 Jan 2013 19:42:51 -0800 - ---- - configure | 32 ++++++++++++++++++-------------- - 1 file changed, 18 insertions(+), 14 deletions(-) - -diff --git a/configure b/configure -index 76c2812..78ce2ff 100755 ---- a/configure -+++ b/configure -@@ -535,14 +535,18 @@ else - GZIP_SUFFIX=".gz" - fi - --printf "Finding suitable compiler........" --CC=`pathsearch "${CC:-cc}"` --if test -z "$CC" -o ! -x "$CC"; then -- CC=`pathsearch "${CC:-gcc}"` -+if test -z "$CC"; then -+ printf "Finding suitable compiler........" -+ CC=`pathsearch "${CC:-cc}"` -+ if test -z "$CC" -o ! -x "$CC"; then -+ CC=`pathsearch "${CC:-gcc}"` -+ fi - fi - assert "$CC" "not found" - --cat << EOF > .1.c -+if test -z "$COMPILER"; then -+ -+ cat << EOF > .1.c - #include - int main(void) { - #if defined(_WIN32) -@@ -569,16 +573,16 @@ int main(void) { - #endif - } - EOF -+ $CC -o .1 .1.c -+ COMPILER=`./.1` -+ r=$? -+ rm -f .1.c .1 - --$CC -o .1 .1.c --COMPILER=`./.1` --r=$? --rm -f .1.c .1 -- --if test "$r" -ne 0; then -- assert "" "update compiler" --else -- echo "success [$CC]" -+ if test "$r" -ne 0; then -+ assert "" "update compiler" -+ else -+ echo "success [$CC]" -+ fi - fi - - if test "$COMPILER" = "suncc"; then diff --git a/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit_git.bb b/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit_git.bb index 0018064119..277fac9f7c 100644 --- a/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit_git.bb +++ b/meta-openembedded/meta-oe/recipes-devtools/concurrencykit/concurrencykit_git.bb @@ -7,26 +7,26 @@ LICENSE = "BSD-2-Clause & Apache-2.0" HOMEPAGE = "http://concurrencykit.org" SECTION = "base" -PV = "0.5.1+git${SRCPV}" -SRCREV = "f97d3da5c375ac2fc5a9173cdd36cb828915a2e1" +PV = "0.7.0+git${SRCPV}" +SRCREV = "6e8e5bec2e2f8cef2072a68579cbb07ababf3331" LIC_FILES_CHKSUM = "file://LICENSE;md5=a0b24c1a8f9ad516a297d055b0294231" SRC_URI = "git://github.com/concurrencykit/ck.git;branch=master;protocol=https \ - file://cross.patch \ -" + file://0001-configure-Fix-compoiler-detection-logic-for-cross-co.patch \ + file://0001-build-Use-ilp32d-abi-on-riscv32-and-lp64d-on-rv64.patch" S = "${WORKDIR}/git" -COMPATIBLE_HOST = "(arm|aarch64|i.86|x86_64|powerpc|powerpc64).*-linux*" +COMPATIBLE_HOST = "(arm|aarch64|i.86|x86_64|powerpc|powerpc64|riscv32|riscv64).*-linux*" inherit autotools-brokensep PLAT:powerpc64 = "ppc64" PLAT:powerpc64le = "ppc64" +PLAT:riscv32 = "riscv" PLAT ?= "${HOST_ARCH}" do_configure () { export PLATFORM=${PLAT} - export COMPILER='gcc' ${S}/configure \ --prefix=${prefix} \ --includedir=${includedir} \ diff --git a/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20221106.0.bb b/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20221106.0.bb deleted file mode 100644 index 6ef767710e..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_5.9.20221106.0.bb +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2015 Igor Santos -# Released under the MIT license (see COPYING.MIT for the terms) - -SUMMARY = "Universal Ctags" -DESCRIPTION = "Universal Ctags is a multilanguage reimplementation of the \ - Unix ctags utility. Ctags generates an index of source code \ - definitions which is used by numerous editors and utilities \ - to instantly locate the definitions." - -HOMEPAGE = "https://ctags.io/" - -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3" - -inherit autotools-brokensep pkgconfig manpages - -SRCREV = "bf0d53505856d4b3e662be22bbe5fcb740451ca1" -SRC_URI = "git://github.com/universal-ctags/ctags;branch=master;protocol=https" - -S = "${WORKDIR}/git" - -PACKAGECONFIG ??= " \ - readcmd \ - xml \ - json \ - yaml \ -" -PACKAGECONFIG[readcmd] = "--enable-readcmd,--disable-readcmd" -PACKAGECONFIG[etags] = "--enable-etags,--disable-etags" -PACKAGECONFIG[xml] = "--enable-xml,--disable-xml,libxml2" -PACKAGECONFIG[json] = "--enable-json,--disable-json,jansson" -PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" -PACKAGECONFIG[yaml] = "--enable-yaml,--disable-yaml,libyaml" -PACKAGECONFIG[manpages] = ",,python3-docutils-native" diff --git a/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_6.0.20230101.0.bb b/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_6.0.20230101.0.bb new file mode 100644 index 0000000000..faeca6ce8b --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/ctags/ctags_6.0.20230101.0.bb @@ -0,0 +1,34 @@ +# Copyright (C) 2015 Igor Santos +# Released under the MIT license (see COPYING.MIT for the terms) + +SUMMARY = "Universal Ctags" +DESCRIPTION = "Universal Ctags is a multilanguage reimplementation of the \ + Unix ctags utility. Ctags generates an index of source code \ + definitions which is used by numerous editors and utilities \ + to instantly locate the definitions." + +HOMEPAGE = "https://ctags.io/" + +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3" + +inherit autotools-brokensep pkgconfig manpages + +SRCREV = "c89b92d5622221be2e02e71092dcdbc72733b08a" +SRC_URI = "git://github.com/universal-ctags/ctags;branch=master;protocol=https" + +S = "${WORKDIR}/git" + +PACKAGECONFIG ??= " \ + readcmd \ + xml \ + json \ + yaml \ +" +PACKAGECONFIG[readcmd] = "--enable-readcmd,--disable-readcmd" +PACKAGECONFIG[etags] = "--enable-etags,--disable-etags" +PACKAGECONFIG[xml] = "--enable-xml,--disable-xml,libxml2" +PACKAGECONFIG[json] = "--enable-json,--disable-json,jansson" +PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" +PACKAGECONFIG[yaml] = "--enable-yaml,--disable-yaml,libyaml" +PACKAGECONFIG[manpages] = ",,python3-docutils-native" diff --git a/meta-openembedded/meta-oe/recipes-devtools/dnf-plugin-tui/dnf-plugin-tui_git.bb b/meta-openembedded/meta-oe/recipes-devtools/dnf-plugin-tui/dnf-plugin-tui_git.bb index 9f961882af..ca2b20108a 100644 --- a/meta-openembedded/meta-oe/recipes-devtools/dnf-plugin-tui/dnf-plugin-tui_git.bb +++ b/meta-openembedded/meta-oe/recipes-devtools/dnf-plugin-tui/dnf-plugin-tui_git.bb @@ -4,7 +4,7 @@ LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" SRC_URI = "git://github.com/ubinux/dnf-plugin-tui.git;branch=master;protocol=https" -SRCREV = "b0d80b7129f1d84cc563a4098d869e7420bcf4bc" +SRCREV = "8d21f52577aa03958732a5a346a678c699e98cb6" PV = "1.3" SRC_URI:append:class-target = " file://oe-remote.repo.sample" diff --git a/meta-openembedded/meta-oe/recipes-devtools/editorconfig/editorconfig-core-c_0.12.5.bb b/meta-openembedded/meta-oe/recipes-devtools/editorconfig/editorconfig-core-c_0.12.5.bb new file mode 100644 index 0000000000..da5c07ff28 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/editorconfig/editorconfig-core-c_0.12.5.bb @@ -0,0 +1,15 @@ +SUMMARY = "EditorConfig helps maintain consistent coding styles across various editors and IDEs." +HOMEPAGE = "https://https://editorconfig.org" +SECTION = "libs" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=f515fff3ea0a2b9797eda60d83c0e5ca" + +SRC_URI = "git://github.com/editorconfig/editorconfig-core-c.git;protocol=https;branch=master" + +S = "${WORKDIR}/git" +SRCREV = "f6b0ca395149b5a2fbd56a488cae30306a58170f" + +inherit cmake + +DEPENDS = "pcre2" + diff --git a/meta-openembedded/meta-oe/recipes-devtools/flatbuffers/flatbuffers.inc b/meta-openembedded/meta-oe/recipes-devtools/flatbuffers/flatbuffers.inc index 0700c5bd34..c87a449f0c 100644 --- a/meta-openembedded/meta-oe/recipes-devtools/flatbuffers/flatbuffers.inc +++ b/meta-openembedded/meta-oe/recipes-devtools/flatbuffers/flatbuffers.inc @@ -1,3 +1,3 @@ -PV = "22.10.26" -SRCREV = "203241ed3275625c8a25c4a1e7b86e3c0289c488" +PV = "22.12.06" +SRCREV = "acf39ff056df8c9e5bfa32cf6f7b5e6b87a90544" SRC_URI = "git://github.com/google/flatbuffers.git;branch=master;protocol=https" diff --git a/meta-openembedded/meta-oe/recipes-devtools/gst-editing-services/gst-editing-services_1.20.4.bb b/meta-openembedded/meta-oe/recipes-devtools/gst-editing-services/gst-editing-services_1.20.4.bb deleted file mode 100644 index 6f76013dbd..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/gst-editing-services/gst-editing-services_1.20.4.bb +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2022 Khem Raj -# Released under the MIT license (see COPYING.MIT for the terms) - -SUMMARY = "Gstreamer editing services" -HOMEPAGE = "http://cgit.freedesktop.org/gstreamer/gst-editing-services/" - -LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \ - file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d" - -DEPENDS = "flex-native gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad python3-pygobject" - -REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" -GIR_MESON_OPTION = "" - -inherit meson pkgconfig upstream-version-is-even gobject-introspection features_check bash-completion - -EXTRA_OEMESON = "-Dvalidate=disabled" - -SRC_URI = "http://gstreamer.freedesktop.org/src/gst-editing-services/gst-editing-services-${PV}.tar.xz" -SRC_URI[sha256sum] = "aa03e983af5d79c1befffe3575b034e60960619a96bf877447cb73c28016fc41" - -PACKAGES += "gst-validate-launcher libges" - -FILES:gst-validate-launcher = "${nonarch_libdir}/gst-validate-launcher ${datadir}/gstreamer-1.0/validate" -FILES:libges = "${libdir}/gstreamer-1.0/*.so" diff --git a/meta-openembedded/meta-oe/recipes-devtools/gst-editing-services/gst-editing-services_1.20.5.bb b/meta-openembedded/meta-oe/recipes-devtools/gst-editing-services/gst-editing-services_1.20.5.bb new file mode 100644 index 0000000000..6b7775c1c0 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/gst-editing-services/gst-editing-services_1.20.5.bb @@ -0,0 +1,26 @@ +# Copyright (C) 2022 Khem Raj +# Released under the MIT license (see COPYING.MIT for the terms) + +SUMMARY = "Gstreamer editing services" +HOMEPAGE = "http://cgit.freedesktop.org/gstreamer/gst-editing-services/" + +LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \ + file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d" + +DEPENDS = "flex-native gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad python3-pygobject" + +REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" +GIR_MESON_OPTION = "" + +inherit meson pkgconfig upstream-version-is-even gobject-introspection features_check bash-completion + +EXTRA_OEMESON = "-Dvalidate=disabled" + +SRC_URI = "http://gstreamer.freedesktop.org/src/gst-editing-services/gst-editing-services-${PV}.tar.xz" +SRC_URI[sha256sum] = "363f2b13675877b926b4be5259dbbeea8cc976805b40c871fc254bb8f382017d" + +PACKAGES += "gst-validate-launcher libges" + +FILES:gst-validate-launcher = "${nonarch_libdir}/gst-validate-launcher ${datadir}/gstreamer-1.0/validate" +FILES:libges = "${libdir}/gstreamer-1.0/*.so" diff --git a/meta-openembedded/meta-oe/recipes-devtools/lshw/files/0001-Fix-musl-build.patch b/meta-openembedded/meta-oe/recipes-devtools/lshw/files/0001-Fix-musl-build.patch deleted file mode 100644 index fa90aa1211..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/lshw/files/0001-Fix-musl-build.patch +++ /dev/null @@ -1,125 +0,0 @@ -From a5a4bb4254b2109bd3e272174946f0bb36ee99a8 Mon Sep 17 00:00:00 2001 -From: Leon Anavi -Date: Tue, 25 Aug 2020 11:45:45 +0300 -Subject: [PATCH] Fix musl build - -Apply the following fixes for musl: - -- Fix basename() is in libgen.h -- Fix wrong usage of LONG_BIT - -Same fixes have been submitted to the upstream of lshw by Sergio -Prado but they have not been merged yet. - -Upstream-Status: Submitted - -Co-Authored-By: Sergio Prado -Signed-off-by: Leon Anavi ---- - src/core/abi.cc | 4 +--- - src/core/sysfs.cc | 19 ++++++++++--------- - 2 files changed, 11 insertions(+), 12 deletions(-) - -diff --git a/src/core/abi.cc b/src/core/abi.cc -index adff7b5..76c664c 100644 ---- a/src/core/abi.cc -+++ b/src/core/abi.cc -@@ -20,9 +20,7 @@ __ID("@(#) $Id: mem.cc 1352 2006-05-27 23:54:13Z ezix $"); - bool scan_abi(hwNode & system) - { - // are we compiled as 32- or 64-bit process ? -- long sc = sysconf(LONG_BIT); -- if(sc==-1) sc = sysconf(_SC_LONG_BIT); -- if(sc!=-1) system.setWidth(sc); -+ system.setWidth(LONG_BIT); - - pushd(PROC_SYS); - -diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc -index 32d6564..c2fa84f 100644 ---- a/src/core/sysfs.cc -+++ b/src/core/sysfs.cc -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - - - __ID("@(#) $Id$"); -@@ -100,7 +101,7 @@ static string sysfs_getbustype(const string & path) - { - devname = - string(fs.path + "/bus/") + string(namelist[i]->d_name) + -- "/devices/" + basename(path.c_str()); -+ "/devices/" + basename(const_cast(path.c_str())); - - if (samefile(devname, path)) - return string(namelist[i]->d_name); -@@ -140,7 +141,7 @@ static string sysfstobusinfo(const string & path) - - if (bustype == "usb") - { -- string name = basename(path.c_str()); -+ string name = basename(const_cast(path.c_str())); - if (matches(name, "^[0-9]+-[0-9]+(\\.[0-9]+)*:[0-9]+\\.[0-9]+$")) - { - size_t colon = name.rfind(":"); -@@ -151,7 +152,7 @@ static string sysfstobusinfo(const string & path) - - if (bustype == "virtio") - { -- string name = basename(path.c_str()); -+ string name = basename(const_cast(path.c_str())); - if (name.compare(0, 6, "virtio") == 0) - return "virtio@" + name.substr(6); - else -@@ -159,10 +160,10 @@ static string sysfstobusinfo(const string & path) - } - - if (bustype == "vio") -- return string("vio@") + basename(path.c_str()); -+ return string("vio@") + basename(const_cast(path.c_str())); - - if (bustype == "ccw") -- return string("ccw@") + basename(path.c_str()); -+ return string("ccw@") + basename(const_cast(path.c_str())); - - if (bustype == "ccwgroup") - { -@@ -240,7 +241,7 @@ string entry::driver() const - string driverlink = This->devpath + "/driver"; - if (!exists(driverlink)) - return ""; -- return basename(readlink(driverlink).c_str()); -+ return basename(const_cast(readlink(driverlink).c_str())); - } - - -@@ -328,7 +329,7 @@ string entry::name_in_class(const string & classname) const - - string entry::name() const - { -- return basename(This->devpath.c_str()); -+ return basename(const_cast(This->devpath.c_str())); - } - - -@@ -340,12 +341,12 @@ entry entry::parent() const - - string entry::classname() const - { -- return basename(dirname(This->devpath).c_str()); -+ return basename(const_cast(dirname(This->devpath).c_str())); - } - - bool entry::isvirtual() const - { -- return string(basename(dirname(dirname(This->devpath)).c_str())) == "virtual"; -+ return string(basename(const_cast(dirname(dirname(This->devpath)).c_str()))) == "virtual"; - } - - string entry::string_attr(const string & name, const string & def) const --- -2.17.1 - diff --git a/meta-openembedded/meta-oe/recipes-devtools/lshw/files/0001-disable-docbook2man.patch b/meta-openembedded/meta-oe/recipes-devtools/lshw/files/0001-disable-docbook2man.patch new file mode 100644 index 0000000000..00f7b8674e --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/lshw/files/0001-disable-docbook2man.patch @@ -0,0 +1,30 @@ +From 544df0f5fd99925a3ce568c777413e0c31cb0028 Mon Sep 17 00:00:00 2001 +From: Jose Quaresma +Date: Mon, 2 Jan 2023 15:32:39 +0000 +Subject: [PATCH] build: Do not build .sgml file + +It needs docbook2man tool which we do not have recipe for + +Upstream-Status: OE-Specific [needs native docbook2man tool] + +Signed-off-by: Jose Quaresma +--- + src/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/Makefile b/src/Makefile +index ac726d0..af6281d 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -102,7 +102,7 @@ $(PACKAGENAME)-compressed: $(PACKAGENAME)-static + upx -9 -o $@ $< + + $(PACKAGENAME).1: $(PACKAGENAME).sgml +- docbook2man $< ++ @echo "Needs docbook2man" + + pci.ids: + wget http://pciids.sourceforge.net/pci.ids +-- +2.25.1 + diff --git a/meta-openembedded/meta-oe/recipes-devtools/lshw/lshw_02.19.2.bb b/meta-openembedded/meta-oe/recipes-devtools/lshw/lshw_02.19.2.bb index 8b3608a248..f2de593cf1 100644 --- a/meta-openembedded/meta-oe/recipes-devtools/lshw/lshw_02.19.2.bb +++ b/meta-openembedded/meta-oe/recipes-devtools/lshw/lshw_02.19.2.bb @@ -9,16 +9,27 @@ SECTION = "console/tools" LICENSE = "GPL-2.0-or-later" LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" -COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux" +COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64|riscv64).*-linux" +PV .= "+git${SRCPV}" +SRCREV = "42fef565731411a784101de614a54bff79d1858e" SRC_URI = " \ - http://ezix.org/software/files/lshw-B.${PV}.tar.gz \ - file://0001-Fix-musl-build.patch \ + git://github.com/lyonel/lshw.git;protocol=https;branch=master \ + file://0001-disable-docbook2man.patch \ " -SRC_URI[md5sum] = "8c70d46e906688309095c73ecb9396e3" -SRC_URI[sha256sum] = "9bb347ac87142339a366a1759ac845e3dbb337ec000aa1b99b50ac6758a80f80" -S = "${WORKDIR}/lshw-B.${PV}" +S = "${WORKDIR}/git" + +inherit pkgconfig + +DEPENDS = "gettext-native" + +PACKAGECONFIG ??= "zlib" +PACKAGECONFIG[sqlite] = "SQLITE=1,SQLITE=0,sqlite3" +PACKAGECONFIG[zlib] = "ZLIB=1,ZLIB=0,zlib gzip-native" + +# use the PACKAGECONFIG configurations arguments +EXTRA_OEMAKE = "${PACKAGECONFIG_CONFARGS}" do_compile() { # build core only - don't ship gui diff --git a/meta-openembedded/meta-oe/recipes-devtools/luajit/luajit_git.bb b/meta-openembedded/meta-oe/recipes-devtools/luajit/luajit_git.bb index dd1cd51698..06df0690ac 100644 --- a/meta-openembedded/meta-oe/recipes-devtools/luajit/luajit_git.bb +++ b/meta-openembedded/meta-oe/recipes-devtools/luajit/luajit_git.bb @@ -10,8 +10,8 @@ SRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1 \ " # Set PV to a version tag and date (YYMMDD) associated with SRCREV if it is later. -PV = "2.1.0~beta3-210112" -SRCREV = "43ebb949a249a16c49d232ad24dc9127cc4302bb" +PV = "2.1.0~beta3-220721" +SRCREV = "32984282ddae666b3c94cd27538e1c78b49a1877" S = "${WORKDIR}/git" diff --git a/meta-openembedded/meta-oe/recipes-devtools/mpich/mpich_4.0.2.bb b/meta-openembedded/meta-oe/recipes-devtools/mpich/mpich_4.0.2.bb deleted file mode 100644 index d277f7e71c..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/mpich/mpich_4.0.2.bb +++ /dev/null @@ -1,58 +0,0 @@ -SUMMARY = "Message Passing Interface (MPI) implementation" -HOMEPAGE = "http://www.mpich.org/" -SECTION = "devel" - -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=bd4d7ab13df98988b1ca2a4e01c8c163" - -SRC_URI = "http://www.mpich.org/static/downloads/${PV}/mpich-${PV}.tar.gz" -SRC_URI[sha256sum] = "5a42f1a889d4a2d996c26e48cbf9c595cbf4316c6814f7c181e3320d21dedd42" - -RDEPENDS:${PN} += "bash perl libxml2" - -EXTRA_OECONF = "--enable-debuginfo \ - --enable-fast \ - --enable-shared \ - --with-pm=gforker \ - --disable-rpath \ - --disable-f77 \ - --disable-fc \ - --disable-fortran \ - --disable-cxx \ - BASH_SHELL='${USRBINPATH}/env bash' \ - PERL='${USRBINPATH}/env perl' \ - --with-device=ch3:nemesis \ - --with-rdmacm=no \ - --disable-numa \ -" - -PACKAGECONFIG += " \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \ -" -PACKAGECONFIG[x11] = "--with-x --x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR},--without-x,virtual/libx11" - -# libmpi.so needs symbols like __multf3 and somehow it does not respect --rtlib option passed by clang -LDFLAGS:append:x86-64 = " -lgcc" -LDFLAGS:append:x86 = " -lgcc" - -inherit autotools gettext pkgconfig - -do_configure() { - for d in confdb test/mpi test/mpi/confdb src/pm/hydra/confdb \ - src/pm/hydra/tools/topo/hwloc/hwloc/config src/pm/hydra/mpl/confdb \ - modules/yaksa/m4 modules/json-c modules/ucx modules/hwloc/config \ - test/mpi/dtpools/confdb src/mpl/confdb src/mpi/romio/confdb; do - install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/$d - install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/$d - done -# cd ${S} -# autoupdate -# autoreconf --verbose --install --force -# cd ${B} - oe_runconf -} - -do_install:append() { - sed -i 's,${S}/,,g' ${D}/${libdir}/libmpi.la - sed -i 's,${DEBUG_PREFIX_MAP},,g' ${D}/${libdir}/pkgconfig/mpich.pc -} diff --git a/meta-openembedded/meta-oe/recipes-devtools/mpich/mpich_4.0.3.bb b/meta-openembedded/meta-oe/recipes-devtools/mpich/mpich_4.0.3.bb new file mode 100644 index 0000000000..000f739812 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/mpich/mpich_4.0.3.bb @@ -0,0 +1,58 @@ +SUMMARY = "Message Passing Interface (MPI) implementation" +HOMEPAGE = "http://www.mpich.org/" +SECTION = "devel" + +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=bd4d7ab13df98988b1ca2a4e01c8c163" + +SRC_URI = "http://www.mpich.org/static/downloads/${PV}/mpich-${PV}.tar.gz" +SRC_URI[sha256sum] = "17406ea90a6ed4ecd5be39c9ddcbfac9343e6ab4f77ac4e8c5ebe4a3e3b6c501" + +RDEPENDS:${PN} += "bash perl libxml2" + +EXTRA_OECONF = "--enable-debuginfo \ + --enable-fast \ + --enable-shared \ + --with-pm=gforker \ + --disable-rpath \ + --disable-f77 \ + --disable-fc \ + --disable-fortran \ + --disable-cxx \ + BASH_SHELL='${USRBINPATH}/env bash' \ + PERL='${USRBINPATH}/env perl' \ + --with-device=ch3:nemesis \ + --with-rdmacm=no \ + --disable-numa \ +" + +PACKAGECONFIG += " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \ +" +PACKAGECONFIG[x11] = "--with-x --x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR},--without-x,virtual/libx11" + +# libmpi.so needs symbols like __multf3 and somehow it does not respect --rtlib option passed by clang +LDFLAGS:append:x86-64 = " -lgcc" +LDFLAGS:append:x86 = " -lgcc" + +inherit autotools gettext pkgconfig + +do_configure() { + for d in confdb test/mpi test/mpi/confdb src/pm/hydra/confdb \ + src/pm/hydra/tools/topo/hwloc/hwloc/config src/pm/hydra/mpl/confdb \ + modules/yaksa/m4 modules/json-c modules/ucx modules/hwloc/config \ + test/mpi/dtpools/confdb src/mpl/confdb src/mpi/romio/confdb; do + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}/$d + install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}/$d + done +# cd ${S} +# autoupdate +# autoreconf --verbose --install --force +# cd ${B} + oe_runconf +} + +do_install:append() { + sed -i 's,${S}/,,g' ${D}/${libdir}/libmpi.la + sed -i 's,${DEBUG_PREFIX_MAP},,g' ${D}/${libdir}/pkgconfig/mpich.pc +} diff --git a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.14/oe-npm-cache b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.14/oe-npm-cache deleted file mode 100755 index f596207648..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.14/oe-npm-cache +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env node - -/// Usage: oe-npm-cache -/// ... meta - metainformation about package -/// tgz - tarball - -const process = require("node:process"); - -module.paths.unshift("@@libdir@@/node_modules/npm/node_modules"); - -const cacache = require('cacache') -const fs = require('fs') - -// argv[0] is 'node', argv[1] is this script -const cache_dir = process.argv[2] -const type = process.argv[3] -const key = process.argv[4] -const file = process.argv[5] - -const data = fs.readFileSync(file) - -// metadata content is highly nodejs dependent; when cache entries are not -// found, place debug statements in 'make-fetch-happen/lib/cache/policy.js' -// (CachePolicy::satisfies()) -const xlate = { - 'meta': { - 'key_prefix': 'make-fetch-happen:request-cache:', - 'metadata': function() { - return { - time: Date.now(), - url: key, - reqHeaders: { - 'accept': 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*', - }, - resHeaders: { - "content-type": "application/json", - "status": 200, - }, - options: { - compress: true, - } - }; - }, - }, - - 'tgz': { - 'key_prefix': 'make-fetch-happen:request-cache:', - 'metadata': function() { - return { - time: Date.now(), - url: key, - reqHeaders: { - 'accept': '*/*', - }, - resHeaders: { - "content-type": "application/octet-stream", - "status": 200, - }, - options: { - compress: true, - }, - }; - }, - }, -}; - -const info = xlate[type]; -let opts = {} - -if (info.metadata) { - opts['metadata'] = info.metadata(); -} - -cacache.put(cache_dir, info.key_prefix + key, data, opts) - .then(integrity => { - console.log(`Saved content of ${key} (${file}).`); -}) diff --git a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.18/oe-npm-cache b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.18/oe-npm-cache new file mode 100755 index 0000000000..f596207648 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.18/oe-npm-cache @@ -0,0 +1,77 @@ +#!/usr/bin/env node + +/// Usage: oe-npm-cache +/// ... meta - metainformation about package +/// tgz - tarball + +const process = require("node:process"); + +module.paths.unshift("@@libdir@@/node_modules/npm/node_modules"); + +const cacache = require('cacache') +const fs = require('fs') + +// argv[0] is 'node', argv[1] is this script +const cache_dir = process.argv[2] +const type = process.argv[3] +const key = process.argv[4] +const file = process.argv[5] + +const data = fs.readFileSync(file) + +// metadata content is highly nodejs dependent; when cache entries are not +// found, place debug statements in 'make-fetch-happen/lib/cache/policy.js' +// (CachePolicy::satisfies()) +const xlate = { + 'meta': { + 'key_prefix': 'make-fetch-happen:request-cache:', + 'metadata': function() { + return { + time: Date.now(), + url: key, + reqHeaders: { + 'accept': 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*', + }, + resHeaders: { + "content-type": "application/json", + "status": 200, + }, + options: { + compress: true, + } + }; + }, + }, + + 'tgz': { + 'key_prefix': 'make-fetch-happen:request-cache:', + 'metadata': function() { + return { + time: Date.now(), + url: key, + reqHeaders: { + 'accept': '*/*', + }, + resHeaders: { + "content-type": "application/octet-stream", + "status": 200, + }, + options: { + compress: true, + }, + }; + }, + }, +}; + +const info = xlate[type]; +let opts = {} + +if (info.metadata) { + opts['metadata'] = info.metadata(); +} + +cacache.put(cache_dir, info.key_prefix + key, data, opts) + .then(integrity => { + console.log(`Saved content of ${key} (${file}).`); +}) diff --git a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.14.bb b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.14.bb deleted file mode 100644 index a61dd5018f..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.14.bb +++ /dev/null @@ -1,21 +0,0 @@ -DESCRIPTION = "OE helper for manipulating npm cache" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -SRC_URI = "\ - file://oe-npm-cache \ -" - -inherit native - -B = "${WORKDIR}/build" - -do_configure() { - sed -e 's!@@libdir@@!${libdir}!g' < '${WORKDIR}/oe-npm-cache' > '${B}/oe-npm-cache' -} - -do_install() { - install -D -p -m 0755 ${B}/oe-npm-cache ${D}${bindir}/oe-npm-cache -} - -RDEPENDS:${PN} = "nodejs-native" diff --git a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.18.bb b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.18.bb new file mode 100644 index 0000000000..a61dd5018f --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.18.bb @@ -0,0 +1,21 @@ +DESCRIPTION = "OE helper for manipulating npm cache" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "\ + file://oe-npm-cache \ +" + +inherit native + +B = "${WORKDIR}/build" + +do_configure() { + sed -e 's!@@libdir@@!${libdir}!g' < '${WORKDIR}/oe-npm-cache' > '${B}/oe-npm-cache' +} + +do_install() { + install -D -p -m 0755 ${B}/oe-npm-cache ${D}${bindir}/oe-npm-cache +} + +RDEPENDS:${PN} = "nodejs-native" diff --git a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch new file mode 100644 index 0000000000..445aaf8398 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch @@ -0,0 +1,78 @@ +From 6c3ac20477a4bac643088f24df3c042e627fafa9 Mon Sep 17 00:00:00 2001 +From: Guillaume Burel +Date: Fri, 3 Jan 2020 11:25:54 +0100 +Subject: [PATCH] Using native binaries + +Signed-off-by: Archana Polampalli +--- + node.gyp | 2 ++ + tools/v8_gypfiles/v8.gyp | 5 +++++ + 2 files changed, 7 insertions(+) + +diff --git a/node.gyp b/node.gyp +index 24505da7ba..7d41bd52db 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -319,6 +319,7 @@ + 'action_name': 'run_mkcodecache', + 'process_outputs_as_sources': 1, + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(mkcodecache_exec)', + ], + 'outputs': [ +@@ -366,6 +367,7 @@ + 'action_name': 'node_mksnapshot', + 'process_outputs_as_sources': 1, + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(node_mksnapshot_exec)', + ], + 'outputs': [ +diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp +index ed042f8829..371b8e02c2 100644 +--- a/tools/v8_gypfiles/v8.gyp ++++ b/tools/v8_gypfiles/v8.gyp +@@ -68,6 +68,7 @@ + { + 'action_name': 'run_torque_action', + 'inputs': [ # Order matters. ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', + '<@(torque_files)', + ], +@@ -99,6 +100,7 @@ + '<@(torque_outputs_inc)', + ], + 'action': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', + '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated', + '-v8-root', '<(V8_ROOT)', +@@ -211,6 +213,7 @@ + { + 'action_name': 'generate_bytecode_builtins_list_action', + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)', + ], + 'outputs': [ +@@ -395,6 +398,7 @@ + ], + }, + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(mksnapshot_exec)', + ], + 'outputs': [ +@@ -1513,6 +1517,7 @@ + { + 'action_name': 'run_gen-regexp-special-case_action', + 'inputs': [ ++ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)', + ], + 'outputs': [ +-- +2.34.1 + diff --git a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0002-Install-both-binaries-and-use-libdir.patch b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0002-Install-both-binaries-and-use-libdir.patch deleted file mode 100644 index 5cb2e97015..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0002-Install-both-binaries-and-use-libdir.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 62ddf8499747fb1e366477d666c0634ad50039a9 Mon Sep 17 00:00:00 2001 -From: Elliott Sales de Andrade -Date: Tue, 19 Mar 2019 23:22:40 -0400 -Subject: [PATCH 2/2] Install both binaries and use libdir. - -This allows us to build with a shared library for other users while -still providing the normal executable. - -Taken from - https://src.fedoraproject.org/rpms/nodejs/raw/rawhide/f/0002-Install-both-binaries-and-use-libdir.patch - -Upstream-Status: Pending - -Signed-off-by: Elliott Sales de Andrade -Signed-off-by: Andreas Müller -Signed-off-by: Khem Raj ---- - configure.py | 7 +++++++ - tools/install.py | 21 +++++++++------------ - 2 files changed, 16 insertions(+), 12 deletions(-) - -diff --git a/configure.py b/configure.py -index 6efb98c2316f089f3167e486282593245373af3f..a6d2ec939e4480dfae703f3978067537abf9f0f0 100755 ---- a/configure.py -+++ b/configure.py -@@ -721,10 +721,16 @@ parser.add_argument('--shared', - dest='shared', - default=None, - help='compile shared library for embedding node in another project. ' + - '(This mode is not officially supported for regular applications)') - -+parser.add_argument('--libdir', -+ action='store', -+ dest='libdir', -+ default='lib', -+ help='a directory to install the shared library into') -+ - parser.add_argument('--without-v8-platform', - action='store_true', - dest='without_v8_platform', - default=False, - help='do not initialize v8 platform during node.js startup. ' + -@@ -1305,10 +1311,11 @@ def configure_node(o): - o['variables']['debug_nghttp2'] = 'false' - - o['variables']['node_no_browser_globals'] = b(options.no_browser_globals) - - o['variables']['node_shared'] = b(options.shared) -+ o['variables']['libdir'] = options.libdir - node_module_version = getmoduleversion.get_version() - - if options.dest_os == 'android': - shlib_suffix = 'so' - elif sys.platform == 'darwin': -diff --git a/tools/install.py b/tools/install.py -index 41cc1cbc60a9480cc08df3aa0ebe582c2becc3a2..11208f9e7166ab60da46d5ace2257c239a7e9263 100755 ---- a/tools/install.py -+++ b/tools/install.py -@@ -128,26 +128,23 @@ def subdir_files(path, dest, action): - for subdir, files_in_path in ret.items(): - action(files_in_path, subdir + '/') - - def files(action): - is_windows = sys.platform == 'win32' -- output_file = 'node' - output_prefix = 'out/Release/' -+ output_libprefix = output_prefix - -- if 'false' == variables.get('node_shared'): -- if is_windows: -- output_file += '.exe' -+ if is_windows: -+ output_bin = 'node.exe' -+ output_lib = 'node.dll' - else: -- if is_windows: -- output_file += '.dll' -- else: -- output_file = 'lib' + output_file + '.' + variables.get('shlib_suffix') -+ output_bin = 'node' -+ output_lib = 'libnode.' + variables.get('shlib_suffix') - -- if 'false' == variables.get('node_shared'): -- action([output_prefix + output_file], 'bin/' + output_file) -- else: -- action([output_prefix + output_file], 'lib/' + output_file) -+ action([output_prefix + output_bin], 'bin/' + output_bin) -+ if 'true' == variables.get('node_shared'): -+ action([output_libprefix + output_lib], variables.get('libdir') + '/' + output_lib) - - if 'true' == variables.get('node_use_dtrace'): - action(['out/Release/node.d'], 'lib/dtrace/node.d') - - # behave similarly for systemtap --- -2.33.0 - diff --git a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch deleted file mode 100644 index 8db1f1dd54..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 6c3ac20477a4bac643088f24df3c042e627fafa9 Mon Sep 17 00:00:00 2001 -From: Guillaume Burel -Date: Fri, 3 Jan 2020 11:25:54 +0100 -Subject: [PATCH] Using native binaries - ---- - node.gyp | 4 ++-- - tools/v8_gypfiles/v8.gyp | 11 ++++------- - 2 files changed, 6 insertions(+), 9 deletions(-) - ---- a/node.gyp -+++ b/node.gyp -@@ -294,6 +294,7 @@ - 'action_name': 'run_mkcodecache', - 'process_outputs_as_sources': 1, - 'inputs': [ -+ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', - '<(mkcodecache_exec)', - ], - 'outputs': [ -@@ -319,6 +320,7 @@ - 'action_name': 'node_mksnapshot', - 'process_outputs_as_sources': 1, - 'inputs': [ -+ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', - '<(node_mksnapshot_exec)', - ], - 'outputs': [ ---- a/tools/v8_gypfiles/v8.gyp -+++ b/tools/v8_gypfiles/v8.gyp -@@ -68,6 +68,7 @@ - { - 'action_name': 'run_torque_action', - 'inputs': [ # Order matters. -+ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', - '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', - '<@(torque_files)', - ], -@@ -99,6 +100,7 @@ - '<@(torque_outputs_inc)', - ], - 'action': [ -+ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', - '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', - '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated', - '-v8-root', '<(V8_ROOT)', -@@ -225,6 +227,7 @@ - { - 'action_name': 'generate_bytecode_builtins_list_action', - 'inputs': [ -+ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', - '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)', - ], - 'outputs': [ -@@ -415,6 +418,7 @@ - ], - }, - 'inputs': [ -+ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', - '<(mksnapshot_exec)', - ], - 'outputs': [ -@@ -1548,6 +1552,7 @@ - { - 'action_name': 'run_gen-regexp-special-case_action', - 'inputs': [ -+ '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', - '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)', - ], - 'outputs': [ diff --git a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0005-add-openssl-legacy-provider-option.patch b/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0005-add-openssl-legacy-provider-option.patch deleted file mode 100644 index 4d238c03f4..0000000000 --- a/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs/0005-add-openssl-legacy-provider-option.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 86d1c0cc6a5dcf57e413a1cc1c29203e87cf9a14 Mon Sep 17 00:00:00 2001 -From: Daniel Bevenius -Date: Sat, 16 Oct 2021 08:50:16 +0200 -Subject: [PATCH] src: add --openssl-legacy-provider option - -This commit adds an option to Node.js named --openssl-legacy-provider -and if specified will load OpenSSL 3.0 Legacy provider. - -$ ./node --help -... ---openssl-legacy-provider enable OpenSSL 3.0 legacy provider - -Example usage: - -$ ./node --openssl-legacy-provider -p 'crypto.createHash("md4")' -Hash { - _options: undefined, - [Symbol(kHandle)]: Hash {}, - [Symbol(kState)]: { [Symbol(kFinalized)]: false } -} - -Co-authored-by: Richard Lau -Signed-off-by: Signed-off-by: Andrej Valek -Upstream-Status: Backport [https://github.com/nodejs/node/issues/40455] ---- - doc/api/cli.md | 10 ++++++++++ - src/crypto/crypto_util.cc | 10 ++++++++++ - src/node_options.cc | 10 ++++++++++ - src/node_options.h | 7 +++++++ - .../test-process-env-allowed-flags-are-documented.js | 5 +++++ - 5 files changed, 42 insertions(+) - -diff --git a/doc/api/cli.md b/doc/api/cli.md -index 74057706bf8d..608b9cdeddf1 100644 ---- a/doc/api/cli.md -+++ b/doc/api/cli.md -@@ -687,6 +687,14 @@ Load an OpenSSL configuration file on startup. Among other uses, this can be - used to enable FIPS-compliant crypto if Node.js is built - against FIPS-enabled OpenSSL. - -+### `--openssl-legacy-provider` -+ -+ -+Enable OpenSSL 3.0 legacy provider. For more information please see -+[providers readme][]. -+ - ### `--pending-deprecation` - - -+:1 -+ add.setf -, ra_ef, ra_ef ; mul24 ra4, rb5, ra_ef -+ -+ max r2, ra_y, 0 ; mov r1, 0 -+ min r2, r2, rb_max_y ; mov r3, ra_k1 -+ add ra_y, ra_y, r3 ; mul24 r2, r2, rb_pitch ; ldtmu0 -+ add t0s, ra_base, r2 ; mov rb5, rb6 -+ shr r0, r4, ra_xshift ; mov rb6, rb7 -+ -+ max r2, ra_y2, r1 ; v8min r0, r0, rb_pmask ; ldtmu1 # ; masks out all but wanted bytes -+ shr r1, r4, rb_xshift2 ; mov rb7, ra8 -+ min r2, r2, rb_max_y ; v8min r1, r1, ra_pmax -+ add ra_y2, ra_y2, r3 ; mul24 r2, r2, rb_pitch -+ add t1s, rb_base2, r2 ; mov ra8, ra9 -+ -+# apply horizontal filter -+ add r5rep, r5, r3 ; mul24 r2, ra0.8a << 8, r1 << 8 @ "mul_used", 0 -+ mov r3, rb_fir_off_h ; mul24.ifnn r2, ra0.8a, r0 -+ sub r2, r3, r2 ; mul24 r3, ra0.8b << 1, r0 << 1 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra0.8b << 9, r1 << 9 @ "mul_used", 0 -+ add r2, r2, r3 ; mul24 r3, ra0.8c << 2, r0 << 2 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra0.8c << 10, r1 << 10 @ "mul_used", 0 -+ sub r2, r2, r3 ; mul24 r3, ra0.8d << 3, r0 << 3 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra0.8d << 11, r1 << 11 @ "mul_used", 0 -+ add r2, r2, r3 ; mul24 r3, ra1.8a << 4, r0 << 4 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra1.8a << 12, r1 << 12 @ "mul_used", 0 -+ add r2, r2, r3 ; mul24 r3, ra1.8b << 5, r0 << 5 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra1.8b << 13, r1 << 13 @ "mul_used", 0 -+ sub r2, r2, r3 ; mul24 r3, ra1.8c << 6, r0 << 6 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 -+ add r2, r2, r3 ; mul24 r3, ra1.8d << 7, r0 << 7 @ "mul_used", 0 -+ add.setf -, r5, r5 ; mul24.ifn r3, ra1.8d << 15, r1 << 15 @ "mul_used", 0 -+ -+ brr.anyn -, r:1b -+ sub r2, r2, r3 ; mul24 r1, rb5, ra2.8b -+ mov ra9, rb10 ; mul24 r0, rb10, ra3.8b -+ asr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 -+ # >>> .anyn 1b (r5 + r5) -+ -+ # apply vertical filter and write to VPM -+ # - r4* + r5 - r6 + r7 + r8 - r9 + r10 - r11 -+ -+ sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c -+ sub r1, r1, r0 ; mul24 r0, rb7, ra2.8d -+ add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ add r1, r1, r0 ; mul24 r0, rb10, ra3.8c -+ add r1, r1, r0 ; mul24 r0, ra11, rb11 -+# <--- to here -+ sub.setf -, r5, rb_i_tmu ; mov r3, ra_blk_height # ; NxtLoop: r3 = block height -+ sub r1, r1, ra4 ; mov.ifz rb_base2, rb_base2_next -+ sub r1, r1, r0 ; mov.ifz ra_base, ra_base_next -+ -+ asr r1, r1, 6 ; mov.ifz ra_y_y2, ra_y_y2_next -+ sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 -+ add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add -+ sub r1, r0, r1 ; v8subs r0, ra_height, r3 # ; NxtLoop: r0 = remaining height (0 saturate) -+ -+ brr.anyn -, r:1b -+ asr r1, r1, i_wt_den_p6 -+ min r1, r1, ra_pmax ; mov -, vw_wait -+ max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch # ; NxtLoop -+# >>> branch.anyn 1b (r5 - rb_lcount) -+ -+# r0 = remaining height (min 0) -+# r2 = r3 * rb_pitch -+# r3 = block_height -+ -+# If looping again then we consumed 16 height last loop -+# rb_dma1 (stride) remains constant -+# rb_i_tmu remains const (based on total height) -+# recalc ra_dma0, rb_lcount based on new segment height -+ -+ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # VDW setup 0 -+ -+# DMA out -+ bra.anyz -, ra_link -+ min r0, r0, r3 ; mov vw_setup, rb_dma1 # Stride -+ sub r1, r0, r3 ; mov vw_addr, ra_dest # start the VDW -+ shl r1, r1, i_shift23 -+# >>> .anyz ra_link -+ -+# Here r1 = cur_blk_height - 16 so it will be 0 or -ve -+# We add to dma0 to reduce the number of output lines in the final block -+ brr -, r:1b -+ add rb_lcount, rb_lcount, r0 -+ add ra_dma0, ra_dma0, r1 -+ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer -+# >>> 1b -+.endm -+ -+::mc_filter_y_pxx -+ m_filter_y_pxx 8 -+ -+ -+################################################################################ -+ -+# mc_filter_b(y_x, base, y2_x2, base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) -+# -+# Setup (& therefore uniform struct) shared with _pxx -+# Struct in m_luma_setup -+# -+# l0 calc in els 0-7, L1 in 8-15 -+# Only els 0-7 write data that is stored back to ram (els 8-15 may write tosh) -+# -+# At this point we have already issued PREREAD pairs of texture requests for the current block -+ -+.macro m_filter_y_bxx, v_bit_depth -+ -+# denom shift values -+.set i_wt_den_p5, (DENOM + 13 - v_bit_depth) -+.set i_wt_den_p6, (DENOM + 14 - v_bit_depth) -+ -+ m_luma_setup v_bit_depth -+ -+ shl r1, ra_wt_off_l0, i_wt_den_p6 -+ add ra_wt_mul_l0, ra_wt_mul_l0, r3 ; mul24 r0, r2, ra_wt_mul_l0 -+ sub r1, r1, r0 ; mul24 r0, r2, ra_wt_mul_l1 -+ sub rb_wt_off, r1, r0 ; mov ra_ef.8a, rb4 -+ -+# This loop is identical to the P loop from here ---> -+:1 -+ add.setf -, ra_ef, ra_ef ; mul24 ra4, rb5, ra_ef -+ -+ max r2, ra_y, 0 ; mov r1, 0 -+ min r2, r2, rb_max_y ; mov r3, ra_k1 -+ add ra_y, ra_y, r3 ; mul24 r2, r2, rb_pitch ; ldtmu0 -+ add t0s, ra_base, r2 ; mov rb5, rb6 -+ shr r0, r4, ra_xshift ; mov rb6, rb7 -+ -+ max r2, ra_y2, r1 ; v8min r0, r0, rb_pmask ; ldtmu1 # ; masks out all but wanted bytes -+ shr r1, r4, rb_xshift2 ; mov rb7, ra8 -+ min r2, r2, rb_max_y ; v8min r1, r1, ra_pmax -+ add ra_y2, ra_y2, r3 ; mul24 r2, r2, rb_pitch -+ add t1s, rb_base2, r2 ; mov ra8, ra9 -+ -+# apply horizontal filter -+ add r5rep, r5, r3 ; mul24 r2, ra0.8a << 8, r1 << 8 @ "mul_used", 0 -+ mov r3, rb_fir_off_h ; mul24.ifnn r2, ra0.8a, r0 -+ sub r2, r3, r2 ; mul24 r3, ra0.8b << 1, r0 << 1 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra0.8b << 9, r1 << 9 @ "mul_used", 0 -+ add r2, r2, r3 ; mul24 r3, ra0.8c << 2, r0 << 2 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra0.8c << 10, r1 << 10 @ "mul_used", 0 -+ sub r2, r2, r3 ; mul24 r3, ra0.8d << 3, r0 << 3 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra0.8d << 11, r1 << 11 @ "mul_used", 0 -+ add r2, r2, r3 ; mul24 r3, ra1.8a << 4, r0 << 4 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra1.8a << 12, r1 << 12 @ "mul_used", 0 -+ add r2, r2, r3 ; mul24 r3, ra1.8b << 5, r0 << 5 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra1.8b << 13, r1 << 13 @ "mul_used", 0 -+ sub r2, r2, r3 ; mul24 r3, ra1.8c << 6, r0 << 6 @ "mul_used", 0 -+ nop ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 -+ add r2, r2, r3 ; mul24 r3, ra1.8d << 7, r0 << 7 @ "mul_used", 0 -+ add.setf -, r5, r5 ; mul24.ifn r3, ra1.8d << 15, r1 << 15 @ "mul_used", 0 -+ -+ brr.anyn -, r:1b -+ sub r2, r2, r3 ; mul24 r1, rb5, ra2.8b -+ mov ra9, rb10 ; mul24 r0, rb10, ra3.8b -+ asr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 -+ # >>> .anyn 1b (r5 + r5) -+ -+ # apply vertical filter and write to VPM -+ # - r4* + r5 - r6 + r7 + r8 - r9 + r10 - r11 -+ -+ sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c -+ sub r1, r1, r0 ; mul24 r0, rb7, ra2.8d -+ add r1, r1, r0 ; mul24 r0, ra8, rb8 -+ add r1, r1, r0 ; mul24 r0, rb10, ra3.8c -+ add r1, r1, r0 ; mul24 r0, ra11, rb11 -+# <--- to here -+ sub r1, r1, ra4 -+ sub r1, r1, r0 ; mov r2, rb_wt_off -+ -+ asr r1, r1, 6 -+ sub.setf -, r5, rb_i_tmu ; mul24 r0, r1, ra_wt_mul_l0 -+ mov.ifz rb_base2, rb_base2_next ; mul24 r1, r1, ra_kmul_add -+ sub r1, r0, r1 ; mov.ifz ra_y_y2, ra_y_y2_next -+ sub.setf -, r5, rb_lcount ; mov.ifz ra_base, ra_base_next -+ add r1, r1, r2 ; mov r0, r1 << 8 -+ add r1, r1, r0 ; mov r3, ra_blk_height # ; NxtLoop: r3 = block height -+ -+ brr.anyn -, r:1b -+ asr r1, r1, ra_wt_den_p7 ; mul24 r2, r3, rb_pitch # ; NxtLoop -+ min r1, r1, ra_pmax ; mov -, vw_wait -+ max vpm, r1, 0 ; v8subs r0, ra_height, r3 # ; NxtLoop: r0 = remaining height (0 saturate) -+# >>> branch.anyn 1b (r5 - rb_lcount) -+ -+# r0 = remaining height (min 0) -+# r2 = r3 * rb_pitch -+# r3 = block_height -+ -+# If looping again then we consumed block_height last loop -+# rb_dma1 (stride) remains constant -+# rb_i_tmu remains const (based on total height) -+# recalc ra_dma0, rb_lcount based on new segment height -+ -+ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # VDW setup 0 -+ -+# DMA out -+ bra.anyz -, ra_link -+ min r0, r0, r3 ; mov vw_setup, rb_dma1 # Stride -+ sub r1, r0, r3 ; mov vw_addr, ra_dest # start the VDW -+ shl r1, r1, i_shift23 -+# >>> .anyz ra_link (ra_height - remaining height) -+ -+# Here r1 = cur_blk_height - blk_height so it will be 0 or -ve -+# We add to dma0 to reduce the number of output lines in the final block -+ brr -, r:1b -+ add rb_lcount, rb_lcount, r0 -+ add ra_dma0, ra_dma0, r1 -+ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer -+# >>> 1b -+.endm -+ -+::mc_filter_y_bxx -+ m_filter_y_bxx 8 -+ -+################################################################################ -+# -+# typedef struct qpu_mc_pred_y_p00_s { -+# qpu_mc_src_t next_src1; -+# uint16_t h; -+# uint16_t w; -+# uint32_t wo1; -+# uint32_t dst_addr; -+# uint32_t next_fn; -+# } qpu_mc_pred_y_p00_t; -+ -+.macro m_filter_y_p00, v_bit_depth -+ -+.if v_bit_depth <= 8 -+.set v_x_shift, 0 -+.set v_x_mul, 1 -+# Shifts to get width & height in the right place in ra_dma0 -+.set v_dma_h_shift, 7 -+.set v_dma_wh_shift, i_shift16 -+.else -+.set v_x_shift, 1 -+.set v_x_mul, 2 -+# Shifts to get width & height in the right place in ra_dma0 -+.set v_dma_h_shift, 8 -+.set v_dma_wh_shift, 15 -+.endif -+ -+ mov ra0, unif ; mov r0, elem_num # y_x -+ mov ra_xshift, ra_xshift_next ; v8subs r5rep, r5, r5 # [ra0 delay] ; r5 = 0 -+ add r0, ra0.16b, r0 ; mov ra_base_next, unif # ; src1.base -+.if v_x_shift != 0 -+ shl r0, r0, v_x_shift -+.endif -+ -+ max r0, r0, r5 ; mov ra_y_next, ra0.16a # ; width_height -+ min r0, r0, rb_max_x ; mov ra_width_height, unif -+ -+ shl ra_xshift_next, r0, 3 # Compute shifts -+ and r0, r0, -4 -+ sub r2, r5, rb_pitch ; mov ra_wt_off_mul_l0, unif # ; weight_offset -+ and r1, r0, r2 -+ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch -+ add r0, r0, r1 ; mov ra_dest, unif # Add stripe offsets ; dest addr -+ add ra_base_next, ra_base_next, r0 ; mov vw_setup, rb_vpm_init # [ra_width delay] ; set up VPM write -+ -+# get width,height of block (unif load above) -+# Compute vdw_setup1(dst_pitch-width) -+ shl r1, ra_width, v_x_shift -+ sub rb_dma1, rb_dma1_base, r1 ; mov r0, ra_height -+ sub rb_i_tmu, r0, PREREAD ; v8min r0, r0, ra_blk_height -+ shl r0, r0, v_dma_h_shift ; mov rb_lcount, r0 -+ add r0, r0, r1 # Combine width and height of destination area -+ shl rb_wt_off, ra_wt_off_l0, DENOM + 7 -+ shl r0, r0, v_dma_wh_shift ; mov ra_link, unif # Shift into bits 16 upwards of the vdw_setup0 register ; link -+ add ra_dma0, r0, rb_dma0_base -+ -+:1 -+ sub.setf -, r5, rb_i_tmu ; v8adds r5rep, r5, ra_k1 -+ nop ; mov.ifz ra_y, ra_y_next ; ldtmu0 -+ shr r0, r4, ra_xshift ; mov r3, rb_pitch -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_max_y ; mov.ifz ra_base, ra_base_next -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_base, r2 ; v8min r0, r0, rb_pmask -+ -+ sub.setf -, r5, rb_lcount ; mul24 r1, r0, ra_wt_mul_l0 -+ shl r1, r1, 8 ; mov r3, ra_blk_height -+ add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 -+ -+ brr.anyn -, r:1b -+ asr r1, r1, DENOM + 8 -+ min r1, r1, ra_pmax ; mov -, vw_wait -+ max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch -+# >>> branch.anyn 1b -+ -+# r0 = remaining height (min 0) -+# r2 = r3 * rb_pitch -+# r3 = block_height -+ -+# If looping again then we consumed 16 height last loop -+# rb_dma1 (stride) remains constant -+# rb_i_tmu remains const (based on total height) -+# recalc ra_dma0, rb_lcount based on new segment height -+ -+ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # VDW setup 0 -+ -+# DMA out -+ bra.anyz -, ra_link -+ min r0, r0, r3 ; mov vw_setup, rb_dma1 # Stride -+ sub r1, r0, r3 ; mov vw_addr, ra_dest # start the VDW -+ shl r1, r1, i_shift23 -+# >>> .anyz ra_link -+ -+# Here r1 = cur_blk_height - 16 so it will be 0 or -ve -+# We add to dma0 to reduce the number of output lines in the final block -+ brr -, r:1b -+ add rb_lcount, rb_lcount, r0 -+ add ra_dma0, ra_dma0, r1 -+ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer -+# >>> 1b -+.endm -+ -+::mc_filter_y_p00 -+ m_filter_y_p00 8 -+ -+################################################################################ -+ -+.macro m_filter_y_b00, v_bit_depth -+# luma setup does a fair bit more than we need calculating filter coeffs -+# that we will never use but it saves I-cache to use it (also simple!) -+ m_luma_setup v_bit_depth -+ -+# Fix up vals that were expecting a filter (somewhat icky) -+ mov r2, 1 -+ add rb_i_tmu, rb_i_tmu, r2 ; mov r1, ra_wt_off_mul_l0 # Need in rX rather than raX for <<8 to do what we want -+ shl rb_wt_off, ra_wt_off_l0, DENOM + 8 ; v8subs r5quad, r5, r5 # [r1 << delay] ; r5quad OK for zero -+ nop ; mov.ifnz ra_wt_off_mul_l0, r1 << 8 -+ -+:1 -+ sub.setf -, r5, rb_i_tmu ; nop ; ldtmu1 -+ shr r1, r4, rb_xshift2 ; mov.ifz ra_y_y2, ra_y_y2_next ; ldtmu0 -+ shr r0, r4, ra_xshift ; mov r3, rb_pitch -+ -+ max r2, ra_y, 0 # y -+ min r2, r2, rb_max_y ; mov.ifz ra_base, ra_base_next -+ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 -+ add t0s, ra_base, r2 ; mov.ifz rb_base2, rb_base2_next -+ -+ max r2, ra_y2, 0 -+ min r2, r2, rb_max_y -+ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 -+ add t1s, rb_base2, r2 ; v8min r0, r0, ra_pmax # v8subs masks out all but bottom byte -+ and r1, r1, rb_pmask ; mul24 r0, r0, ra_wt_mul_l0 -+ -+ sub.setf -, r5, rb_lcount ; mul24 r1, r1, ra_wt_mul_l1 -+ add r1, r0, r1 ; v8adds r5rep, r5, ra_k1 -+ -+ shl r1, r1, 8 ; mov r3, ra_blk_height -+ add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 -+ -+ brr.anyn -, r:1b -+ asr r1, r1, (DENOM + 9) - 32 # -32 to get valid shift immediate -+ min r1, r1, ra_pmax ; mov -, vw_wait -+ max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch -+# >>> branch.anyn 1b -+ -+# r0 = remaining height (min 0) -+# r2 = r3 * rb_pitch -+# r3 = block_height -+ -+# If looping again then we consumed 16 height last loop -+# rb_dma1 (stride) remains constant -+# rb_i_tmu remains const (based on total height) -+# recalc ra_dma0, rb_lcount based on new segment height -+ -+ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # ; VDW setup 0 -+ -+# DMA out -+ bra.anyz -, ra_link -+ min r0, r0, r3 ; mov vw_setup, rb_dma1 # ; Stride -+ sub r1, r0, r3 ; mov vw_addr, ra_dest # ; start the VDW -+ shl r1, r1, i_shift23 -+# >>> .anyz ra_link -+ -+# Here r1 = cur_blk_height - 16 so it will be 0 or -ve -+# We add to dma0 to reduce the number of output lines in the final block -+ brr -, r:1b -+ add rb_lcount, rb_lcount, r0 -+ add ra_dma0, ra_dma0, r1 -+ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer -+# >>> 1b -+.endm -+ -+::mc_filter_y_b00 -+ m_filter_y_b00 8 -+ -+################################################################################ -+################################################################################ -+# 10 BIT -+ -+::mc_setup_c10_q0 -+ m_setup_q0 -+::mc_setup_c10_qn -+ m_setup_c 10 -+ -+::mc_filter_c10_p -+ m_filter_c_p 0, 10 -+ -+::mc_filter_c10_p_l1 -+ m_filter_c_p 1, 10 -+ -+ -+::mc_filter_c10_b -+ m_filter_c_b 10 -+ -+# Even if these fns are the same as for other bit depths we want our own copy -+# to keep the code we are using in a single lump to avoid (direct map) cache -+# thrashing -+.set v_quads10, N_QPU_16 / 4 -+ -+::mc_sync10_q0 -+ m_sync_q 0, v_quads10 -+::mc_sync10_q1 -+ m_sync_q 1, v_quads10 -+::mc_sync10_q2 -+ m_sync_q 2, v_quads10 -+::mc_sync10_q3 -+ m_sync_q 3, v_quads10 -+::mc_sync10_q4 -+ m_sync_q 4, v_quads10 -+::mc_sync10_q5 -+ m_sync_q 5, v_quads10 -+::mc_sync10_q6 -+ m_sync_q 6, v_quads10 -+::mc_sync10_q7 -+ m_sync_q 7, v_quads10 -+::mc_sync10_q8 -+ m_sync_q 8, v_quads10 -+::mc_sync10_q9 -+ m_sync_q 9, v_quads10 -+::mc_sync10_q10 -+ m_sync_q 10, v_quads10 -+::mc_sync10_q11 -+ m_sync_q 11, v_quads10 -+ -+::mc_exit_y10_q0 -+::mc_exit_c10_q0 -+ m_exit_q0 -+ -+::mc_exit_y10_qn -+::mc_exit_c10_qn -+ m_exit_qn -+ -+::mc_setup_y10_q0 -+ m_setup_q0 -+::mc_setup_y10_qn -+ m_setup_y 10 -+ -+:per_block_setup_10 -+ m_per_block_setup 10 -+ -+::mc_filter_y10_pxx -+ m_filter_y_pxx 10 -+ -+::mc_filter_y10_p00 -+ m_filter_y_p00 10 -+ -+::mc_filter_y10_bxx -+ m_filter_y_bxx 10 -+ -+::mc_filter_y10_b00 -+ m_filter_y_b00 10 -+ -+ -+ -+::mc_end -+# Do not add code here because mc_end must appear after all other code. ---- /dev/null -+++ b/libavcodec/rpi_hevc_shader_cmd.h -@@ -0,0 +1,165 @@ -+/* -+Copyright (c) 2017 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#ifndef RPI_SHADER_CMD_H -+#define RPI_SHADER_CMD_H -+ -+#pragma pack(push, 4) -+ -+#if RPI_QPU_EMU_C && RPI_QPU_EMU_Y -+// If mixed then we are just confused and get a lot of warnings.... -+typedef const uint8_t * qpu_mc_src_addr_t; -+typedef uint8_t * qpu_mc_dst_addr_t; -+#else -+typedef uint32_t qpu_mc_src_addr_t; -+typedef uint32_t qpu_mc_dst_addr_t; -+#endif -+ -+typedef struct qpu_mc_src_s -+{ -+ int16_t y; -+ int16_t x; -+ qpu_mc_src_addr_t base; -+} qpu_mc_src_t; -+ -+ -+typedef struct qpu_mc_pred_c_p_s { -+ qpu_mc_src_t next_src; -+ uint16_t h; -+ uint16_t w; -+ uint32_t coeffs_x; -+ uint32_t coeffs_y; -+ uint32_t wo_u; -+ uint32_t wo_v; -+ qpu_mc_dst_addr_t dst_addr_c; -+ uint32_t next_fn; -+} qpu_mc_pred_c_p_t; -+ -+typedef struct qpu_mc_pred_c_b_s { -+ qpu_mc_src_t next_src1; -+ uint16_t h; -+ uint16_t w; -+ uint32_t coeffs_x1; -+ uint32_t coeffs_y1; -+ int16_t weight_u1; -+ int16_t weight_v1; -+ qpu_mc_src_t next_src2; -+ uint32_t coeffs_x2; -+ uint32_t coeffs_y2; -+ uint32_t wo_u2; -+ uint32_t wo_v2; -+ qpu_mc_dst_addr_t dst_addr_c; -+ uint32_t next_fn; -+} qpu_mc_pred_c_b_t; -+ -+typedef struct qpu_mc_pred_c_s_s { -+ qpu_mc_src_t next_src1; -+ uint32_t pic_cw; // C Width (== Y width / 2) -+ uint32_t pic_ch; // C Height (== Y Height / 2) -+ uint32_t stride2; -+ uint32_t stride1; -+ qpu_mc_src_t next_src2; -+ uint32_t next_fn; -+} qpu_mc_pred_c_s_t; -+ -+typedef struct qpu_mc_pred_c_s { -+ union { -+ qpu_mc_pred_c_p_t p; -+ qpu_mc_pred_c_b_t b; -+ qpu_mc_pred_c_s_t s; -+ }; -+} qpu_mc_pred_c_t; -+ -+ -+typedef struct qpu_mc_pred_y_p_s { -+ qpu_mc_src_t next_src1; -+ qpu_mc_src_t next_src2; -+ uint16_t h; -+ uint16_t w; -+ uint32_t mymx21; -+ uint32_t wo1; -+ uint32_t wo2; -+ qpu_mc_dst_addr_t dst_addr; -+ uint32_t next_fn; -+} qpu_mc_pred_y_p_t; -+ -+typedef struct qpu_mc_pred_y_p00_s { -+ qpu_mc_src_t next_src1; -+ uint16_t h; -+ uint16_t w; -+ uint32_t wo1; -+ qpu_mc_dst_addr_t dst_addr; -+ uint32_t next_fn; -+} qpu_mc_pred_y_p00_t; -+ -+typedef struct qpu_mc_pred_y_s_s { -+ qpu_mc_src_t next_src1; -+ qpu_mc_src_t next_src2; -+ uint16_t pic_h; -+ uint16_t pic_w; -+ uint32_t stride2; -+ uint32_t stride1; -+ uint32_t next_fn; -+} qpu_mc_pred_y_s_t; -+ -+typedef struct qpu_mc_pred_sync_s { -+ uint32_t next_fn; -+} qpu_mc_pred_sync_t; -+ -+// Only a useful structure in that it allows us to return something other than a void * -+typedef struct qpu_mc_pred_y_s { -+ union { -+ qpu_mc_pred_y_p_t p; -+ qpu_mc_pred_y_p00_t p00; -+ qpu_mc_pred_y_s_t s; -+ }; -+} qpu_mc_pred_y_t; -+ -+typedef union qpu_mc_pred_cmd_u { -+ qpu_mc_pred_y_t y; -+ qpu_mc_pred_c_t c; -+ qpu_mc_pred_sync_t sync; -+} qpu_mc_pred_cmd_t; -+ -+static void inline qpu_mc_link_set(qpu_mc_pred_cmd_t * const cmd, const uint32_t fn) -+{ -+ // Link is last el of previous cmd -+ ((uint32_t *)cmd)[-1] = fn; -+} -+ -+#define QPU_MC_PRED_N_Y8 12 -+#define QPU_MC_PRED_N_C8 12 -+ -+#define QPU_MC_PRED_N_Y10 12 -+#define QPU_MC_PRED_N_C10 12 -+ -+#define QPU_MC_DENOM 7 -+ -+#pragma pack(pop) -+ -+#endif -+ ---- /dev/null -+++ b/libavcodec/rpi_hevc_shader_template.c -@@ -0,0 +1,88 @@ -+/* -+Copyright (c) 2017 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include "hevc.h" -+#include "rpi_hevcdec.h" -+#include "libavutil/rpi_sand_fns.h" -+#include "rpi_hevc_shader_cmd.h" -+#include "rpi_hevc_shader_template.h" -+ -+typedef struct shader_track_s -+{ -+ const union qpu_mc_pred_cmd_u *qpu_mc_curr; -+ const struct qpu_mc_src_s *last_l0; -+ const struct qpu_mc_src_s *last_l1; -+ uint32_t width; // pic_width * PW -+ uint32_t height; -+ uint32_t stride2; -+ uint32_t stride1; -+} shader_track_t; -+ -+static int wtoidx(const unsigned int w) -+{ -+ static const uint8_t pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+ return pel_weight[w]; -+} -+ -+static const int fctom(uint32_t x) -+{ -+ int rv; -+ // As it happens we can take the 2nd filter term & divide it by 8 -+ // (dropping fractions) to get the fractional move -+ rv = 8 - ((x >> 11) & 0xf); -+ av_assert2(rv >= 0 && rv <= 7); -+ return rv; -+} -+ -+static inline int32_t ext(int32_t x, unsigned int shl, unsigned int shr) -+{ -+ return (x << shl) >> shr; -+} -+ -+static inline int woff_p(HEVCRpiContext *const s, int32_t x) -+{ -+ return ext(x, 0, 17 + s->ps.sps->bit_depth - 8); -+} -+ -+static inline int woff_b(HEVCRpiContext *const s, int32_t x) -+{ -+ return ext(x - 0x10000, 0, 16 + s->ps.sps->bit_depth - 8); -+} -+ -+static inline int wweight(int32_t x) -+{ -+ return ext(x, 16, 16); -+} -+ -+ -+#define PW 1 -+#include "rpi_hevc_shader_template_fn.h" -+ -+#undef PW -+#define PW 2 -+#include "rpi_hevc_shader_template_fn.h" -+ ---- /dev/null -+++ b/libavcodec/rpi_hevc_shader_template.h -@@ -0,0 +1,49 @@ -+/* -+Copyright (c) 2017 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#ifndef LIBAVCODEC_RPI_SHADER_TEMPLATE_H -+#define LIBAVCODEC_RPI_SHADER_TEMPLATE_H -+ -+struct HEVCRpiContext; -+struct HEVCRpiInterPredEnv; -+ -+void ff_hevc_rpi_shader_c8(struct HEVCRpiContext *const s, -+ const struct HEVCRpiInterPredEnv *const ipe_y, -+ const struct HEVCRpiInterPredEnv *const ipe_c); -+ -+void ff_hevc_rpi_shader_c16(struct HEVCRpiContext *const s, -+ const struct HEVCRpiInterPredEnv *const ipe_y, -+ const struct HEVCRpiInterPredEnv *const ipe_c); -+ -+void rpi_sand_dump8(const char * const name, -+ const uint8_t * const base, const int stride1, const int stride2, int x, int y, int w, int h, const int is_c); -+ -+void rpi_sand_dump16(const char * const name, -+ const uint8_t * const base, const int stride1, const int stride2, int x, int y, int w, int h, const int is_c); -+ -+#endif -+ ---- /dev/null -+++ b/libavcodec/rpi_hevc_shader_template_fn.h -@@ -0,0 +1,502 @@ -+/* -+Copyright (c) 2017 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#define STRCAT(x,y) x##y -+ -+#if PW == 1 -+#define pixel uint8_t -+#define FUNC(f) STRCAT(f, 8) -+#elif PW == 2 -+#define pixel uint16_t -+#define FUNC(f) STRCAT(f, 16) -+#else -+#error Unexpected PW -+#endif -+ -+#define PATCH_STRIDE (16 * PW) -+ -+static void FUNC(dup_lr)(uint8_t * dst, const uint8_t * src, unsigned int w, unsigned int h, unsigned int stride) -+{ -+ for (unsigned int i = 0; i != h; ++i, dst += stride, src += stride) { -+ const pixel s = *(const pixel *)src; -+ pixel * d = (pixel *)dst; -+ for (unsigned int j = 0; j < w; j += PW) { -+ *d++ = s; -+ } -+ } -+} -+ -+static void FUNC(dup_tb)(uint8_t * dst, const uint8_t * src, unsigned int w, unsigned int h, unsigned int stride) -+{ -+ for (unsigned int i = 0; i != h; ++i, dst += stride) { -+ memcpy(dst, src, w); -+ } -+} -+ -+static void FUNC(get_patch_y)(const shader_track_t * const st, -+ uint8_t * dst, const unsigned int dst_stride, -+ const qpu_mc_src_t *src, -+ unsigned int _w, unsigned int _h) -+{ -+ int x = src->x * PW; -+ int y = src->y; -+ int w = _w * PW; -+ int h = _h; -+ int dl = 0; -+ int dr = 0; -+ int dt = 0; -+ int db = 0; -+ -+ if (x < 0) { -+ if (-x >= w) -+ x = PW - w; -+ dl = -x; -+ w += x; -+ x = 0; -+ } -+ if (x + w > st->width) { -+ if (x >= st->width) -+ x = st->width - PW; -+ dr = (x + w) - st->width; -+ w = st->width - x; -+ } -+ -+ // Y -+ if (y < 0) { -+ if (-y >= h) -+ y = 1 - h; -+ dt = -y; -+ h += y; -+ y = 0; -+ } -+ if (y + h > st->height) { -+ if (y >= st->height) -+ y = st->height - 1; -+ db = (y + h) - st->height; -+ h = st->height - y; -+ } -+ -+ dst += dl + dt * dst_stride; -+ FUNC(av_rpi_sand_to_planar_y)(dst, dst_stride, (const uint8_t *)src->base, st->stride1, st->stride2, x, y, w, h); -+ -+ // Edge dup -+ if (dl != 0) -+ FUNC(dup_lr)(dst - dl, dst, dl, h, dst_stride); -+ if (dr != 0) -+ FUNC(dup_lr)(dst + w, dst + w - PW, dr, h, dst_stride); -+ w += dl + dr; -+ dst -= dl; -+ -+ if (dt != 0) -+ FUNC(dup_tb)(dst - dt * dst_stride, dst, w, dt, dst_stride); -+ if (db != 0) -+ FUNC(dup_tb)(dst + h * dst_stride, dst + (h - 1) * dst_stride, w, db, dst_stride); -+} -+ -+ -+ -+static void FUNC(get_patch_c)(const shader_track_t * const st, -+ uint8_t * dst_u, uint8_t * dst_v, const unsigned int dst_stride, -+ const qpu_mc_src_t *src, -+ unsigned int _w, unsigned int _h) -+{ -+ int x = src->x * PW; -+ int y = src->y; -+ int w = _w * PW; -+ int h = _h; -+ int dl = 0; -+ int dr = 0; -+ int dt = 0; -+ int db = 0; -+ const int width = st->width; -+ const int height = st->height; -+ -+ if (x < 0) { -+ if (-x >= w) -+ x = PW - w; -+ dl = -x; -+ w += x; -+ x = 0; -+ } -+ if (x + w > width) { -+ if (x >= width) -+ x = width - PW; -+ dr = (x + w) - width; -+ w = width - x; -+ } -+ -+ // Y -+ if (y < 0) { -+ if (-y >= h) -+ y = 1 - h; -+ dt = -y; -+ h += y; -+ y = 0; -+ } -+ if (y + h > height) { -+ if (y >= height) -+ y = height - 1; -+ db = (y + h) - height; -+ h = height - y; -+ } -+ -+ dst_u += dl + dt * dst_stride; -+ dst_v += dl + dt * dst_stride; -+ FUNC(av_rpi_sand_to_planar_c)(dst_u, dst_stride, dst_v, dst_stride, (const uint8_t *)src->base, st->stride1, st->stride2, x, y, w, h); -+ -+ // Edge dup -+ if (dl != 0) -+ { -+ FUNC(dup_lr)(dst_u - dl, dst_u, dl, h, dst_stride); -+ FUNC(dup_lr)(dst_v - dl, dst_v, dl, h, dst_stride); -+ } -+ if (dr != 0) -+ { -+ FUNC(dup_lr)(dst_u + w, dst_u + w - PW, dr, h, dst_stride); -+ FUNC(dup_lr)(dst_v + w, dst_v + w - PW, dr, h, dst_stride); -+ } -+ w += dl + dr; -+ dst_u -= dl; -+ dst_v -= dl; -+ -+ if (dt != 0) -+ { -+ FUNC(dup_tb)(dst_u - dt * dst_stride, dst_u, w, dt, dst_stride); -+ FUNC(dup_tb)(dst_v - dt * dst_stride, dst_v, w, dt, dst_stride); -+ } -+ if (db != 0) -+ { -+ FUNC(dup_tb)(dst_u + h * dst_stride, dst_u + (h - 1) * dst_stride, w, db, dst_stride); -+ FUNC(dup_tb)(dst_v + h * dst_stride, dst_v + (h - 1) * dst_stride, w, db, dst_stride); -+ } -+} -+ -+// w, y, w, h in pixels -+// stride1, stride2 in bytes -+void FUNC(rpi_sand_dump)(const char * const name, -+ const uint8_t * const base, const int stride1, const int stride2, int x, int y, int w, int h, const int is_c) -+{ -+ const int mask = stride2 == 0 ? ~0 : stride1 - 1; -+ -+ printf("%s (%d,%d) %dx%d\n", name, x, y, w, h); -+ -+ if (is_c) { -+ x *= 2; -+ w *= 2; -+ } -+ -+ for (int i = y; i != y + h; ++i) { -+ for (int j = x; j != x + w; ++j) { -+ const uint8_t * p = base + ((j*PW) & mask) + i * stride1 + ((j*PW) & ~mask) * stride2; -+ char sep = is_c && (j & 1) == 0 ? ':' : ' '; -+#if PW == 1 -+ if (j < 0 || i < 0) -+ printf("..%c", sep); -+ else -+ printf("%02x%c", *(const pixel*)p, sep); -+#else -+ if (j < 0 || i < 0) -+ printf("...%c", sep); -+ else -+ printf("%03x%c", *(const pixel*)p, sep); -+#endif -+ } -+ printf("\n"); -+ } -+} -+ -+ -+void FUNC(ff_hevc_rpi_shader_c)(HEVCRpiContext *const s, -+ const HEVCRpiInterPredEnv *const ipe_y, -+ const HEVCRpiInterPredEnv *const ipe_c) -+{ -+ for (int c_idx = 0; c_idx < 2; ++c_idx) -+ { -+ const HEVCRpiInterPredEnv *const ipe = c_idx == 0 ? ipe_y : ipe_c; -+ shader_track_t tracka[QPU_N_MAX] = {{NULL}}; -+ unsigned int exit_n = 0; -+ -+ if (ipe == NULL || !ipe->used) { -+ continue; -+ } -+ -+ do { -+ for (unsigned int i = 0; i != ipe->n; ++i) { -+ const HEVCRpiInterPredQ * const q = ipe->q + i; -+ shader_track_t * const st = tracka + i; -+ const qpu_mc_pred_cmd_t * cmd = st->qpu_mc_curr == NULL ? q->qpu_mc_base : st->qpu_mc_curr; -+ -+ for (;;) { -+ const uint32_t link = (cmd == q->qpu_mc_base) ? q->code_setup : ((uint32_t *)cmd)[-1]; -+ -+ if (link == q->code_setup) { -+ if (c_idx == 0) { -+ // Luma -+ const qpu_mc_pred_y_s_t *const c = &cmd->y.s; -+ -+ st->height = c->pic_h; -+ st->width = c->pic_w * PW; -+ st->stride1 = c->stride1; -+ st->stride2 = c->stride2; -+ st->last_l0 = &c->next_src1; -+ st->last_l1 = &c->next_src2; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ else { -+ // Chroma -+ const qpu_mc_pred_c_s_t *const c = &cmd->c.s; -+ -+ st->height = c->pic_ch; -+ st->width = c->pic_cw * PW; -+ st->stride1 = c->stride1; -+ st->stride2 = c->stride2; -+ st->last_l0 = &c->next_src1; -+ st->last_l1 = &c->next_src2; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ } -+ else if (link == s->qpu.y_pxx) { -+ const qpu_mc_pred_y_p_t *const c = &cmd->y.p; -+ const int w1 = FFMIN(c->w, 8); -+ const int w2 = c->w - w1; -+ -+ uint8_t patch_y1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ uint8_t patch_y2[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ -+ FUNC(get_patch_y)(st, -+ patch_y1, PATCH_STRIDE, -+ st->last_l0, -+ 16, c->h + 7); -+ if (w2 > 0) { -+ FUNC(get_patch_y)(st, -+ patch_y2, PATCH_STRIDE, -+ st->last_l1, -+ 16, c->h + 7); -+ } -+ -+ // wo[offset] = offset*2+1 -+ s->hevcdsp.put_hevc_qpel_uni_w[wtoidx(w1)][(c->mymx21 & 0xff00) != 0][(c->mymx21 & 0xff) != 0]( -+ (uint8_t *)c->dst_addr, st->stride1, patch_y1 + 3 * (PATCH_STRIDE + PW), PATCH_STRIDE, -+ c->h, QPU_MC_DENOM, wweight(c->wo1), woff_p(s, c->wo1), (c->mymx21 & 0xff), ((c->mymx21 >> 8) & 0xff), w1); -+ if (w2 > 0) { -+ s->hevcdsp.put_hevc_qpel_uni_w[wtoidx(w2)][(c->mymx21 & 0xff000000) != 0][(c->mymx21 & 0xff0000) != 0]( -+ (uint8_t *)c->dst_addr + 8 * PW, st->stride1, patch_y2 + 3 * (PATCH_STRIDE + PW), PATCH_STRIDE, -+ c->h, QPU_MC_DENOM, wweight(c->wo2), woff_p(s, c->wo2), ((c->mymx21 >> 16) & 0xff), ((c->mymx21 >> 24) & 0xff), w2); -+ } -+ st->last_l0 = &c->next_src1; -+ st->last_l1 = &c->next_src2; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ else if (link == s->qpu.y_bxx) { -+ const qpu_mc_pred_y_p_t *const c = &cmd->y.p; -+ -+ uint8_t patch_y1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ uint8_t patch_y2[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ int16_t patch_y3[MAX_PB_SIZE * MAX_PB_SIZE]; -+ -+ FUNC(get_patch_y)(st, -+ patch_y1, PATCH_STRIDE, -+ st->last_l0, -+ 16, c->h + 7); -+ FUNC(get_patch_y)(st, -+ patch_y2, PATCH_STRIDE, -+ st->last_l1, -+ 16, c->h + 7); -+ -+ s->hevcdsp.put_hevc_qpel[wtoidx(c->w)][(c->mymx21 & 0xff00) != 0][(c->mymx21 & 0xff) != 0]( -+ patch_y3, patch_y1+ 3 * (PATCH_STRIDE + PW), PATCH_STRIDE, -+ c->h, (c->mymx21 & 0xff), ((c->mymx21 >> 8) & 0xff), c->w); -+ -+ s->hevcdsp.put_hevc_qpel_bi_w[wtoidx(c->w)][(c->mymx21 & 0xff000000) != 0][(c->mymx21 & 0xff0000) != 0]( -+ (uint8_t *)c->dst_addr, st->stride1, patch_y2 + 3 * (PATCH_STRIDE + PW), PATCH_STRIDE, patch_y3, -+ c->h, QPU_MC_DENOM, wweight(c->wo1), wweight(c->wo2), -+ 0, woff_b(s, c->wo2), ((c->mymx21 >> 16) & 0xff), ((c->mymx21 >> 24) & 0xff), c->w); -+ st->last_l0 = &c->next_src1; -+ st->last_l1 = &c->next_src2; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ else if (link == s->qpu.y_p00) { -+ const qpu_mc_pred_y_p00_t *const c = &cmd->y.p00; -+ -+ uint8_t patch_y1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ -+ FUNC(get_patch_y)(st, -+ patch_y1, PATCH_STRIDE, -+ st->last_l0, -+ 16, c->h + 7); -+ -+ // wo[offset] = offset*2+1 -+ s->hevcdsp.put_hevc_qpel_uni_w[wtoidx(c->w)][0][0]( -+ (uint8_t *)c->dst_addr, st->stride1, patch_y1, PATCH_STRIDE, -+ c->h, QPU_MC_DENOM, wweight(c->wo1), woff_p(s, c->wo1), 0, 0, c->w); -+ -+ st->last_l0 = &c->next_src1; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ else if (link == s->qpu.y_b00) { -+ const qpu_mc_pred_y_p_t *const c = &cmd->y.p; -+ -+ uint8_t patch_y1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ uint8_t patch_y2[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ int16_t patch_y3[MAX_PB_SIZE * MAX_PB_SIZE]; -+ -+ av_assert0(c->w <= 16 && c->h <= 64); -+ -+ FUNC(get_patch_y)(st, -+ patch_y1, PATCH_STRIDE, -+ st->last_l0, -+ 16, c->h); -+ FUNC(get_patch_y)(st, -+ patch_y2, PATCH_STRIDE, -+ st->last_l1, -+ 16, c->h); -+ -+ s->hevcdsp.put_hevc_qpel[wtoidx(c->w)][0][0]( -+ patch_y3, patch_y1, PATCH_STRIDE, -+ c->h, 0, 0, c->w); -+ -+ s->hevcdsp.put_hevc_qpel_bi_w[wtoidx(c->w)][0][0]( -+ (uint8_t *)c->dst_addr, st->stride1, patch_y2, PATCH_STRIDE, patch_y3, -+ c->h, QPU_MC_DENOM, wweight(c->wo1), wweight(c->wo2), -+ 0, woff_b(s, c->wo2), 0, 0, c->w); -+ st->last_l0 = &c->next_src1; -+ st->last_l1 = &c->next_src2; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ else if (link == s->qpu.c_pxx) { -+ const qpu_mc_pred_c_p_t *const c = &cmd->c.p; -+ const int mx = fctom(c->coeffs_x); -+ const int my = fctom(c->coeffs_y); -+ -+ uint8_t patch_u1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ uint8_t patch_v1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ uint8_t patch_u3[8 * 16 * PW]; -+ uint8_t patch_v3[8 * 16 * PW]; -+ -+ FUNC(get_patch_c)(st, patch_u1, patch_v1, PATCH_STRIDE, st->last_l0, 8+3, c->h + 3); -+ -+ s->hevcdsp.put_hevc_epel_uni_w[wtoidx(c->w)][my != 0][mx != 0]( -+ patch_u3, 8 * PW, patch_u1 + PATCH_STRIDE + PW, PATCH_STRIDE, -+ c->h, QPU_MC_DENOM, wweight(c->wo_u), woff_p(s, c->wo_u), mx, my, c->w); -+ s->hevcdsp.put_hevc_epel_uni_w[wtoidx(c->w)][my != 0][mx != 0]( -+ patch_v3, 8 * PW, patch_v1 + PATCH_STRIDE + PW, PATCH_STRIDE, -+ c->h, QPU_MC_DENOM, wweight(c->wo_v), woff_p(s, c->wo_v), mx, my, c->w); -+ -+ FUNC(av_rpi_planar_to_sand_c)((uint8_t *)c->dst_addr_c, st->stride1, st->stride2, patch_u3, 8 * PW, patch_v3, 8 * PW, 0, 0, c->w * PW, c->h); -+ -+ st->last_l0 = &c->next_src; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ else if (link == s->qpu.c_pxx_l1) { -+ const qpu_mc_pred_c_p_t *const c = &cmd->c.p; -+ const int mx = fctom(c->coeffs_x); -+ const int my = fctom(c->coeffs_y); -+ -+ uint8_t patch_u1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ uint8_t patch_v1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) -+ uint8_t patch_u3[8 * 16 * PW]; -+ uint8_t patch_v3[8 * 16 * PW]; -+ -+ FUNC(get_patch_c)(st, patch_u1, patch_v1, PATCH_STRIDE, st->last_l1, 8+3, c->h + 3); -+ -+ s->hevcdsp.put_hevc_epel_uni_w[wtoidx(c->w)][my != 0][mx != 0]( -+ patch_u3, 8 * PW, patch_u1 + PATCH_STRIDE + PW, PATCH_STRIDE, -+ c->h, QPU_MC_DENOM, wweight(c->wo_u), woff_p(s, c->wo_u), mx, my, c->w); -+ s->hevcdsp.put_hevc_epel_uni_w[wtoidx(c->w)][my != 0][mx != 0]( -+ patch_v3, 8 * PW, patch_v1 + PATCH_STRIDE + PW, PATCH_STRIDE, -+ c->h, QPU_MC_DENOM, wweight(c->wo_v), woff_p(s, c->wo_v), mx, my, c->w); -+ -+ FUNC(av_rpi_planar_to_sand_c)((uint8_t *)c->dst_addr_c, st->stride1, st->stride2, patch_u3, 8 * PW, patch_v3, 8 * PW, 0, 0, c->w * PW, c->h); -+ -+ st->last_l1 = &c->next_src; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ else if (link == s->qpu.c_bxx) { -+ const qpu_mc_pred_c_b_t *const c = &cmd->c.b; -+ const int mx1 = fctom(c->coeffs_x1); -+ const int my1 = fctom(c->coeffs_y1); -+ const int mx2 = fctom(c->coeffs_x2); -+ const int my2 = fctom(c->coeffs_y2); -+ -+ uint8_t patch_u1[PATCH_STRIDE * 72]; -+ uint8_t patch_v1[PATCH_STRIDE * 72]; -+ uint8_t patch_u2[PATCH_STRIDE * 72]; -+ uint8_t patch_v2[PATCH_STRIDE * 72]; -+ uint8_t patch_u3[8 * 16 * PW]; -+ uint8_t patch_v3[8 * 16 * PW]; -+ uint16_t patch_u4[MAX_PB_SIZE * MAX_PB_SIZE]; -+ uint16_t patch_v4[MAX_PB_SIZE * MAX_PB_SIZE]; -+ -+ FUNC(get_patch_c)(st, patch_u1, patch_v1, PATCH_STRIDE, st->last_l0, 8+3, c->h + 3); -+ FUNC(get_patch_c)(st, patch_u2, patch_v2, PATCH_STRIDE, st->last_l1, 8+3, c->h + 3); -+ -+ s->hevcdsp.put_hevc_epel[wtoidx(c->w)][my1 != 0][mx1 != 0]( -+ patch_u4, patch_u1 + PATCH_STRIDE + PW, PATCH_STRIDE, -+ c->h, mx1, my1, c->w); -+ s->hevcdsp.put_hevc_epel[wtoidx(c->w)][my1 != 0][mx1 != 0]( -+ patch_v4, patch_v1 + PATCH_STRIDE + PW, PATCH_STRIDE, -+ c->h, mx1, my1, c->w); -+ -+ s->hevcdsp.put_hevc_epel_bi_w[wtoidx(c->w)][my2 != 0][mx2 != 0]( -+ patch_u3, 8 * PW, patch_u2 + PATCH_STRIDE + PW, PATCH_STRIDE, patch_u4, -+ c->h, QPU_MC_DENOM, c->weight_u1, wweight(c->wo_u2), -+ 0, woff_b(s, c->wo_u2), mx2, my2, c->w); -+ s->hevcdsp.put_hevc_epel_bi_w[wtoidx(c->w)][my2 != 0][mx2 != 0]( -+ patch_v3, 8 * PW, patch_v2 + PATCH_STRIDE + PW, PATCH_STRIDE, patch_v4, -+ c->h, QPU_MC_DENOM, c->weight_v1, wweight(c->wo_v2), -+ 0, woff_b(s, c->wo_v2), mx2, my2, c->w); -+ -+ FUNC(av_rpi_planar_to_sand_c)((uint8_t *)c->dst_addr_c, st->stride1, st->stride2, patch_u3, 8 * PW, patch_v3, 8 * PW, 0, 0, c->w * PW, c->h); -+ -+ st->last_l0 = &c->next_src1; -+ st->last_l1 = &c->next_src2; -+ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); -+ } -+ else if (link == q->code_sync) { -+ cmd = (const qpu_mc_pred_cmd_t *)((uint32_t *)cmd + 1); -+ break; -+ } -+ else if (link == q->code_exit) { -+ // We expect exit to occur without other sync -+ av_assert0(i == exit_n); -+ ++exit_n; -+ break; -+ } -+ else { -+ av_assert0(0); -+ } -+ } -+ -+ st->qpu_mc_curr = cmd; -+ } -+ } while (exit_n == 0); -+ } -+} -+ -+#undef FUNC -+#undef pixel -+ ---- /dev/null -+++ b/libavcodec/rpi_hevc_transform.s -@@ -0,0 +1,444 @@ -+# ****************************************************************************** -+# Argon Design Ltd. -+# (c) Copyright 2015 Argon Design Ltd. All rights reserved. -+# -+# Module : HEVC -+# Author : Peter de Rivaz -+# ****************************************************************************** -+ -+# USE_STACK = 1 means temporary data stored on the stack (requires build with larger stack) -+# USE_STACK = 0 means temporary data stored in fixed per-VPU data buffers (requires modifications to vasm to handle instruction encoding for PC relative instructions) -+.set USE_STACK, 0 -+ -+# Lines that fail to assemble start with #: -+# The script insert_magic_opcodes.sh inserts the machine code directly for these. -+# HEVC VPU Transform -+# -+# Transform matrix can be thought of as -+# output row vector = input row vector * transMatrix2 -+# -+# The even rows of the matrix are symmetric -+# The odd rows of the matrix are antisymmetric -+# -+# So only need to compute the first half of the results, then can compute the remainder with a butterfly -+# -+# EXAMPLE -+# (a b c d) (1 2 2 1) -+# (3 4 -4 -3) -+# (5 6 6 5) -+# (7 8 -8 -7) -+# -+# x=(a c)(1 2) = 1a+5c 2a+6c -+# (5 6) -+# -+# y=(b d)(3 4) = 3b+7d 4b+8d -+# (7 8) -+# -+# u=x+y = 1a+5c+3b+7d 2a+4b+6c+8d -+# v=x-y = 1a+5c-3b-7d 2a+6c-4b-8d -+# -+# Final results are (u , v[::-1]) -+# -+# -+# For 32x1 input, load even rows into HX(0++,0), odd rows into HX(16++,0) -+# Apply the even matrix first and stop before rounding -+# Then apply the odd matrix in a full manner: -+# -+# First step is to compute partial products with the first input (16 cycles) -+# 1a 3b 5c 7d 16x1 input coefficients produce 16x16 output -+# 2a 4b 6c 8d -+# 2a -4b 6c -8d -+# 1a -3b 5c -7d -+# -+# Second step is to sum partial products into final position (8 cycles) -+# 1a+3b+5c+7d -+# 2a+4b+6c+8d -+# 2a-4b+6c-8d -+# 1a-3b+5c-7d -+# -+# Then can apply butterfly to combine even results and odd results + rounding to produce 16 rows of output at a time (need to save in transposed format) -+# -+# For 16x16 no butterfly is required and can store final results in original location (Could do 2 16x16s in parallel to make use of the trick - saves on the adds) -+# -+# For 8x8 we could compute two in parallel. -+# -+# -+ -+# Columns are transformed first -+# -+# Store top left half of transMatrix2 in -+# Store bottom left half of transMatrix2 in HX(32,32) -+# -+# For 16x16 -+# HX(0:15,0) contains input data before transform -+# HY(0:15,0) contains 32bit output data after transform -+# HX(32,0) contains even rows of left half of transMatrix2 -+# HX(32,32) contains odd rows of left half of transMatrix2 -+# HY(48,0) contains partial products ready for summing -+# -+ -+ -+# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) # TODO add size so we can branch to correct implementation (or perhaps have coeffs32 and num32 as secondary inputs!) -+# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) -+# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -+# num: number of 16x16 transforms to be done -+# coeffs32 -+# num32: number of 32x32 transforms -+# command 0 for transform, 1 for memclear16(int16_t *dst,num16) -+# -+ -+.equ TRANS_SHIFT, 20 - BIT_DEPTH -+.equ TRANS_RND2, 1 << (TRANS_SHIFT - 1) -+.equ TRANS_ASL2, 16 - TRANS_SHIFT -+ -+ -+hevc_trans_16x16: -+ push r6-r15, lr # TODO cut down number of used registers -+ mov r14,r3 # coeffs32 -+ mov r15,r4 # num32 -+ mov r3, 16*2 # Stride of transMatrix2 in bytes -+ vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix -+ -+ add r0, 16*16*2 # For 32x32 transforms we also need this matrix -+ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -+ -+ # Now use r0 to describe which matrix we are working on. -+ # Allows us to prefetch the next block of coefficients for efficiency. -+ mov r0,0 # This describes the location where we read our coefficients from -+ mov r3,16*2 # Stride of coefficients in bytes (TODO remove) -+ mov r7,16*16*2 # Total block size -+ mov r8,64*16 # Value used to swap from current to next VRF location -+ mov r4,64 # Constant used for rounding first pass -+ mov r5,TRANS_RND2 # Constant used for rounding second pass -+ -+ sub sp,sp,64+16*16*2 # Move on stack pointer in case interrupt occurs and uses stack -+ -+ add r11,sp,64 # Space for 32 bytes before, and rounding -+ lsr r11,5 -+ lsl r11,5 # Make sure r11 is rounded to multiple of 2**5==32 -+ -+ lsr r10, r2, 16 # Number of compressed blocks stored in top short -+ extu r2,16 -+ # At start of block r0,r1 point to the current block (that has already been loaded) -+ # r0 VRF location of current block -+ # r1 address of current block -+ # r2 number of 16*16 transforms to do -+ # r3 Stride of coefficients (==32) -+ # r4 TRANS_RND1 (64) -+ # r5 TRANS_RND2 -+ # r6 temporary used inside col_trans16 -+ # r7 16*16*2 total bytes in block -+ # r8 64*16 VRF switch locations -+ # r9 temporary in unpack_coeff for index -+ # r10 number of 16x16 transforms using compression -+ # r11 unpacked data buffer (16*16 shorts) (preceded by 16 shorts of packed data buffer) -+ # r12 temporary counter in unpack_coeff -+ # r13 -+ # r14 Save information for 32 bit transform (coeffs location) -+ # r15 Save information for 32 bit transform (number of transforms) -+ cmp r2,0 -+ beq done16x16s -+block_loop: -+ # With compressed coefficients, we don't use prefetch as we don't want to issue unnecessary memory requests -+ cmp r10,0 -+ mov r6, r1 -+ beq not_compressed -+ sub r10, 1 -+ bl unpack16x16 -+not_compressed: -+ #mov r6,r1 # DEBUG without compress -+ vldh HX(0++,0)+r0,(r6 += r3) REP 16 -+ #eor r0,r8 -+ #add r1,r7 -+ # Prefetch the next block -+ #bl unpack16x16 -+ #vldh HX(0++,0)+r0,(r6 += r3) REP 16 -+ #vmov HX(0++,0)+r0,0 REP 16 # DEBUG -+ #eor r0,r8 -+ #sub r1,r7 -+ -+ # Transform the current block -+ bl col_trans_16 -+ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate -+ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. -+ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? -+ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # For simplicity transpose this back to the original position -+ -+ bl col_trans_16 -+ vadd HY(0++,0)+r0,HY(0++,0)+r0,r5 REP 16 # Now add on rounding, shift down by 7, and saturate -+ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # 4+12=16 so this ends up with the output saturated and in the top half of the word. -+ vasl HY(0++,0)+r0,HY(0++,0)+r0,TRANS_ASL2 REP 16 # This should be saturating, but the instruction above does not assemble? (Probably because it ends with ls which is interpreted as a condition flag) -+ -+ # Save results - note there has been a transposition during the processing so we save columns -+ vsth VX(0,32++)+r0, (r1 += r3) REP 16 -+ -+ # Move onto next block -+ eor r0,r8 -+ add r1,r7 -+ -+ addcmpbgt r2,-1,0,block_loop -+done16x16s: -+ -+ add sp,sp,64+16*16*2 # Move on stack pointer in case interrupt occurs and uses stack -+ # Now go and do any 32x32 transforms -+ b hevc_trans_32x32 -+ -+ pop r6-r15, pc -+# This returns a value in r6 that says where to load the data from. -+# We load data 16 shorts at a time from memory (uncached), and store to stack space to allow us to process it. -+unpack16x16: -+# Clear out destination -+ vmov HX(0,0)+r0,0 -+ mov r6, r11 -+ vsth HX(0,0)+r0,(r6 += r3) REP 16 -+ mov r5, r1 # Moving pointer to input coefficients -+unpack_outer_loop: -+ # Loop until we find the end -+ vldh HX(0,0)+r0,(r5) # TODO would prefetch help here while unpacking previous? -+ sub r6,r11,32 -+ #add r6,pc,packed_data-$ # Packed data -+ vsth HX(0,0)+r0,(r6) # Store into packed data -+ mov r12,0 -+unpack_loop: -+ ld r4,(r6) -+ add r6,r6,4 -+ lsr r9,r4,16 # r9 is destination value -+ cmp r4,0 # {value,index} -+ extu r4,8 -+ beq done_unpack -+ sth r9,(r11, r4) -+ addcmpblt r12,1,8,unpack_loop -+# # Read next 16 -+ add r5,32 -+ b unpack_outer_loop -+done_unpack: -+# # Set new load location -+ mov r6, r11 -+ #add r6,pc,unpacked_data-$ -+# # Restore constants -+ mov r4,64 -+ mov r5,TRANS_RND2 -+# pop r6-r15, pc -+ b lr -+ -+# r1,r2,r3 r7,r8 should be preserved -+# HX(0++,0)+r0 is the block to be transformed -+# HX(32++,0)+r6 is the 16x16 matrix of transform coefficients -+# Use HY(48,0) for intermediate results -+# r0 can be used, but should be returned to its original value at the end -+col_trans_16: -+ add r6,r0,16 # Final value for this loop -+col_trans_16_loop: -+ # First compute partial products for a single column -+ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+ addcmpblt r0,1,r6,col_trans_16_loop -+ sub r0,16 # put r0 back to its original value -+ b lr -+ -+col_trans_odd_16: -+ add r6,r0,16 # Final value for this loop -+col_trans_odd_16_loop: -+ # First compute partial products for a single column -+ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,32++) REP 16 -+ # Then sum up the results and place back -+ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC -+ addcmpblt r0,1,r6,col_trans_odd_16_loop -+ sub r0,16 # put r0 back to its original value -+ b lr -+ -+# r1/r10 input pointer -+# r0,r4,r5,r6 free -+# r8/r9 output storage -+# -+# Store packed coefficients at r9-32 -+# Store unpacked at r9+32*32 (because transform works on even/odd rows on input, but writes all rows) -+unpack32x32: -+# Clear out destination -+ vmov HX(0,0),0 -+ add r0, r9, 32*32*2 # Unpacked buffer -+ mov r4, 32 -+ vsth HX(0,0),(r0 += r4) REP 64 -+unpack_outer_loop32: -+ # Loop until we find the end -+ vldh HX(0,0),(r1) # TODO would prefetch help here while unpacking previous? -+ sub r6,r9,32 -+ #add r6,pc,packed_data-$ # Packed data -+ vsth HX(0,0),(r6) # Store into packed data -+ mov r8,0 -+unpack_loop32: -+ ld r4,(r6) -+ add r6,r6,4 -+ lsr r5,r4,16 # r5 is destination value -+ cmp r4,0 # {value,index} -+ extu r4,10 -+ beq done_unpack -+ sth r5,(r0, r4) -+ addcmpblt r8,1,8,unpack_loop32 -+# # Read next 16 -+ add r1,32 -+ b unpack_outer_loop32 -+done_unpack32: -+ b lr -+# hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) -+# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) Even followed by odd -+# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) -+# num: number of 16x16 transforms to be done in low 16, number of packed in high 16 -+# -+# Note that the 32x32 transforms are stored in reverse order, this means that the unpacked ones appear first! -+hevc_trans_32x32: -+ mov r1,r14 # coeffs -+ mov r2,r15 # num -+ lsr r15,r15,16 # Number that are packed -+ extu r2,16 # Total number -+ -+ # Fetch odd transform matrix -+ #mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) -+ #vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix -+ #add r0, 16*16*2 -+ #vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix -+ -+ mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer -+ mov r7, 16*16*2 # Total block size -+ -+.if USE_STACK -+ # Stack base allocation -+ sub sp,sp,32*32*4+64 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) and another 32*32 for unpacking -+ # set r8 to 32byte aligned stack pointer with 32 bytes of space before it -+ add r8,sp,63 -+ lsr r8,5 -+ lsl r8,5 -+.else -+#:version r8 -+ .half 0x00e8 #AUTOINSERTED -+ btst r8,16 -+#:add r8,pc,intermediate_results-$ -+ .half 0xbfe8 -+ .half intermediate_results-($-2) -+ beq on_vpu1 -+ add r8,r8,32*32*2*2+16*2 # Move to secondary storage -+on_vpu1: -+.endif -+ mov r9,r8 # Backup of the temporary storage -+ mov r10,r1 # Backup of the coefficient buffer -+ -+ cmp r2,0 -+ beq done32x32s -+block_loop32: -+ -+ # Transform the first 16 columns -+ mov r1,r10 # Input Coefficient buffer -+ mov r8,r9 # Output temporary storage -+ # Unpacked are first, so need to only do unpacking when r2(=num left) <= r15 (=num packed) -+ cmp r2,r15 -+ bgt not_compressed_32 -+ bl unpack32x32 -+ add r1,r9,32*32*2 # Uncompressed into temporary storage -+ mov r8,r9 # Transform into here -+not_compressed_32: -+ # COLUMN TRANSFORM -+ mov r4, 64 # Constant used for rounding first pass -+ mov r5, 9 # left shift used for rounding first pass -+ -+ bl trans32 -+ # Transform the second 16 columns -+ add r8,32*16*2 -+ add r1,32 -+ bl trans32 -+ -+ # ROW TRANSFORM -+ mov r4, TRANS_RND2 # Constant used for rounding second pass -+ mov r5, TRANS_ASL2 # left shift used for rounding second pass -+ -+ mov r1,r9 # Input temporary storage -+ mov r8,r10 # Output Coefficient buffer -+ bl trans32 -+ # Transform the second 16 columns -+ add r8,32*16*2 -+ add r1,32 -+ bl trans32 -+ -+ add r10, 32*32*2 # move onto next block of coefficients -+ addcmpbgt r2,-1,0,block_loop32 -+done32x32s: -+ -+.if USE_STACK -+ add sp,sp,32*32*4+64# Restore stack -+.endif -+ -+ pop r6-r15, pc -+ -+trans32: -+ push lr -+ # We can no longer afford the VRF space to do prefetching when doing 32x32 -+ # Fetch the even rows -+ vldh HX(0++,0),(r1 += r3) REP 16 -+ # Fetch the odd rows -+ vldh HX(16++,0),64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 -+ -+ # Transform the even rows using even matrix -+ mov r0, 0 # Even rows -+ bl col_trans_16 -+ -+ # Now transform the odd rows using odd matrix -+ mov r0, 64*16 # Odd rows -+ bl col_trans_odd_16 -+ -+ # Now apply butterfly to compute the first 16 results -+ vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 -+ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, -+ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate -+ # 16bit results now in HX(48,32) -+ mov r0,r8 -+ mov r6,32*2 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+ -+ # Now apply butterfly to compute the second 16 results (in reverse order) -+ vsub HY(63,0),HY(0 ,0),HY(16,0) -+ vsub HY(62,0),HY(1 ,0),HY(17,0) -+ vsub HY(61,0),HY(2 ,0),HY(18,0) -+ vsub HY(60,0),HY(3 ,0),HY(19,0) -+ vsub HY(59,0),HY(4 ,0),HY(20,0) -+ vsub HY(58,0),HY(5 ,0),HY(21,0) -+ vsub HY(57,0),HY(6 ,0),HY(22,0) -+ vsub HY(56,0),HY(7 ,0),HY(23,0) -+ vsub HY(55,0),HY(8 ,0),HY(24,0) -+ vsub HY(54,0),HY(9 ,0),HY(25,0) -+ vsub HY(53,0),HY(10,0),HY(26,0) -+ vsub HY(52,0),HY(11,0),HY(27,0) -+ vsub HY(51,0),HY(12,0),HY(28,0) -+ vsub HY(50,0),HY(13,0),HY(29,0) -+ vsub HY(49,0),HY(14,0),HY(30,0) -+ vsub HY(48,0),HY(15,0),HY(31,0) -+ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, -+ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate -+ add r0,r8,32 -+ vsth VX(48,32++),(r0+=r6) REP 16 -+ pop pc -+ -+.if USE_STACK == 0 -+ .balign 32 -+ -+# .space directives generate 0's in the bin so avoid unnecessary padding by -+# just setting to appropriate value -+.equ intermediate_results, $+16*2 -+ -+# Layout goes: -+# -+#packed_buffer: -+# .space 16*2 -+#intermediate_results: -+# .space 32*32*2 -+#unpacked_buffer: -+# .space 32*32*2 -+# -+#packed_buffer2: -+# .space 16*2 -+#intermediate_results2: -+# .space 32*32*2 -+#unpacked_buffer2: -+# .space 32*32*2 -+.endif -+ -+ ---- /dev/null -+++ b/libavcodec/rpi_hevc_transform10.h -@@ -0,0 +1,94 @@ -+static const unsigned char rpi_hevc_transform10 [] = { -+0xa9, 0x03, 0x3e, 0x40, 0x4f, 0x40, 0x03, 0xb0, // 0000 -+0x20, 0x00, 0x0c, 0xf8, 0x38, 0x88, 0x80, 0x03, // 0008 -+0xc0, 0xf8, 0x00, 0x00, 0x40, 0xb0, 0x00, 0x02, // 0010 -+0x0c, 0xf8, 0x38, 0xa8, 0x80, 0x03, 0xc0, 0xf8, // 0018 -+0x00, 0x00, 0x00, 0x60, 0x03, 0xb0, 0x20, 0x00, // 0020 -+0x07, 0xb0, 0x00, 0x02, 0x08, 0xb0, 0x00, 0x04, // 0028 -+0x04, 0xb0, 0x40, 0x00, 0x05, 0xb0, 0x00, 0x02, // 0030 -+0x59, 0xb0, 0xc0, 0xfd, 0x0b, 0x12, 0x5b, 0x7a, // 0038 -+0x5b, 0x7c, 0x4a, 0xc3, 0x50, 0x17, 0x02, 0x6f, // 0040 -+0x02, 0x6a, 0x32, 0x18, 0x0a, 0x6a, 0x16, 0x40, // 0048 -+0x04, 0x18, 0x1a, 0x66, 0x80, 0x90, 0x32, 0x00, // 0050 -+0x0c, 0xf8, 0x38, 0x80, 0x80, 0x03, 0xc0, 0x08, // 0058 -+0x18, 0x00, 0x80, 0x90, 0x51, 0x00, 0x04, 0xff, // 0060 -+0x30, 0xc0, 0x80, 0x03, 0x20, 0x08, 0x10, 0x00, // 0068 -+0x4c, 0xfe, 0x30, 0xc0, 0x09, 0x04, 0x20, 0x08, // 0070 -+0x00, 0x00, 0x04, 0xfc, 0x38, 0x90, 0x80, 0x02, // 0078 -+0xc0, 0x0b, 0x02, 0x00, 0x80, 0x90, 0x40, 0x00, // 0080 -+0x04, 0xff, 0x30, 0xc0, 0x80, 0x03, 0x20, 0x08, // 0088 -+0x14, 0x00, 0x4c, 0xfe, 0x30, 0xc0, 0x06, 0x04, // 0090 -+0x20, 0x08, 0x00, 0x00, 0x8c, 0xf8, 0x2c, 0xe0, // 0098 -+0x80, 0x03, 0x20, 0x30, 0x04, 0x00, 0x80, 0x45, // 00a0 -+0x71, 0x42, 0xf2, 0x8c, 0xd1, 0xc0, 0x59, 0xb0, // 00a8 -+0x40, 0x02, 0x00, 0x9e, 0x6d, 0x00, 0x29, 0x03, // 00b0 -+0x00, 0xf4, 0x38, 0x80, 0x00, 0x0c, 0xb6, 0x40, // 00b8 -+0x8c, 0xf8, 0x20, 0xe0, 0x80, 0x03, 0x00, 0x30, // 00c0 -+0x18, 0x00, 0x15, 0x40, 0x08, 0xf0, 0x38, 0x80, // 00c8 -+0x85, 0x0b, 0x66, 0xb5, 0xe0, 0xff, 0x88, 0xf0, // 00d0 -+0x24, 0xe0, 0x86, 0x03, 0x0c, 0x60, 0x64, 0x08, // 00d8 -+0x46, 0x62, 0x49, 0xc3, 0x50, 0x27, 0x04, 0x6a, // 00e0 -+0x84, 0x6e, 0x07, 0x18, 0x69, 0xa0, 0x04, 0x5f, // 00e8 -+0x1c, 0x8b, 0xf7, 0xc8, 0x45, 0x76, 0x6b, 0x1f, // 00f0 -+0xb6, 0x40, 0x04, 0xb0, 0x40, 0x00, 0x05, 0xb0, // 00f8 -+0x00, 0x02, 0x5a, 0x00, 0x06, 0xb4, 0x10, 0x00, // 0100 -+0xa4, 0xff, 0x24, 0xcc, 0x60, 0x02, 0x00, 0xf8, // 0108 -+0x3e, 0x00, 0x03, 0xff, 0x37, 0xd0, 0x78, 0x03, // 0110 -+0xe0, 0x03, 0xbe, 0x0b, 0x10, 0x8b, 0xf6, 0x5b, // 0118 -+0x00, 0x67, 0x5a, 0x00, 0x06, 0xb4, 0x10, 0x00, // 0120 -+0xa4, 0xff, 0x24, 0xcc, 0xe0, 0x02, 0x00, 0xf8, // 0128 -+0x3e, 0x00, 0x03, 0xff, 0x37, 0xd0, 0x78, 0x03, // 0130 -+0xe0, 0x03, 0xbe, 0x0b, 0x10, 0x8b, 0xf6, 0x5b, // 0138 -+0x00, 0x67, 0x5a, 0x00, 0x00, 0xf4, 0x38, 0x80, // 0140 -+0x00, 0x04, 0x20, 0xb5, 0x00, 0x08, 0x04, 0xb0, // 0148 -+0x20, 0x00, 0x8e, 0xf8, 0x20, 0xe0, 0x80, 0x03, // 0150 -+0xc0, 0x43, 0x00, 0x00, 0x08, 0xf0, 0x38, 0x80, // 0158 -+0x81, 0x03, 0x26, 0xb5, 0xe0, 0xff, 0x88, 0xf0, // 0160 -+0x20, 0xe0, 0x86, 0x03, 0x08, 0x60, 0x64, 0x08, // 0168 -+0x46, 0x62, 0x45, 0xc3, 0x50, 0x27, 0x04, 0x6a, // 0170 -+0xa4, 0x6e, 0x7f, 0x90, 0xbf, 0xff, 0x65, 0xa0, // 0178 -+0x04, 0x07, 0x18, 0x8b, 0xf6, 0xc8, 0x41, 0x76, // 0180 -+0x6a, 0x1f, 0x5a, 0x00, 0xe1, 0x40, 0xf2, 0x40, // 0188 -+0x0f, 0x7b, 0x02, 0x6f, 0x03, 0xb0, 0x80, 0x00, // 0190 -+0x07, 0xb0, 0x00, 0x02, 0xe8, 0x00, 0x08, 0x6d, // 0198 -+0xe8, 0xbf, 0x60, 0x01, 0x03, 0x18, 0x48, 0xb0, // 01a0 -+0x20, 0x10, 0x89, 0x40, 0x1a, 0x40, 0x02, 0x6a, // 01a8 -+0x24, 0x18, 0xa1, 0x40, 0x98, 0x40, 0xf2, 0x4a, // 01b0 -+0x06, 0x1e, 0xff, 0x9f, 0xc5, 0xff, 0x21, 0xb5, // 01b8 -+0x00, 0x08, 0x98, 0x40, 0x04, 0xb0, 0x40, 0x00, // 01c0 -+0x95, 0x60, 0x80, 0x90, 0x18, 0x00, 0x48, 0xb0, // 01c8 -+0x00, 0x04, 0x41, 0x76, 0x80, 0x90, 0x13, 0x00, // 01d0 -+0x04, 0xb0, 0x00, 0x02, 0x65, 0x60, 0x91, 0x40, // 01d8 -+0xa8, 0x40, 0x80, 0x90, 0x0c, 0x00, 0x48, 0xb0, // 01e0 -+0x00, 0x04, 0x41, 0x76, 0x80, 0x90, 0x07, 0x00, // 01e8 -+0x4a, 0xb0, 0x00, 0x08, 0xf2, 0x8c, 0xdf, 0xc0, // 01f0 -+0x29, 0x03, 0xef, 0x03, 0x0c, 0xf8, 0x38, 0x80, // 01f8 -+0x80, 0x03, 0xc0, 0xf8, 0x04, 0x00, 0x0c, 0xf8, // 0200 -+0x38, 0x84, 0xc0, 0x03, 0xc0, 0xf8, 0x04, 0x00, // 0208 -+0x00, 0x60, 0xff, 0x9f, 0x79, 0xff, 0x00, 0xb0, // 0210 -+0x00, 0x04, 0xff, 0x9f, 0x85, 0xff, 0x04, 0xff, // 0218 -+0x30, 0xcc, 0x10, 0x03, 0xe0, 0xfb, 0x3e, 0x00, // 0220 -+0x04, 0xff, 0x33, 0xcc, 0x80, 0x03, 0xe0, 0xfb, // 0228 -+0x10, 0x00, 0x4c, 0xfe, 0x33, 0xcc, 0x80, 0x03, // 0230 -+0xe0, 0xfb, 0x14, 0x00, 0x80, 0x40, 0x06, 0xb0, // 0238 -+0x40, 0x00, 0x8c, 0xf8, 0x2f, 0xe0, 0x80, 0x03, // 0240 -+0xe0, 0x63, 0x00, 0x00, 0x20, 0xf7, 0xf0, 0xcf, // 0248 -+0x10, 0x03, 0x20, 0xf7, 0xb0, 0xcf, 0x11, 0x13, // 0250 -+0x20, 0xf7, 0x70, 0xcf, 0x12, 0x23, 0x20, 0xf7, // 0258 -+0x30, 0xcf, 0x13, 0x33, 0x20, 0xf7, 0xf0, 0xce, // 0260 -+0x14, 0x43, 0x20, 0xf7, 0xb0, 0xce, 0x15, 0x53, // 0268 -+0x20, 0xf7, 0x70, 0xce, 0x16, 0x63, 0x20, 0xf7, // 0270 -+0x30, 0xce, 0x17, 0x73, 0x20, 0xf7, 0xf0, 0xcd, // 0278 -+0x18, 0x83, 0x20, 0xf7, 0xb0, 0xcd, 0x19, 0x93, // 0280 -+0x20, 0xf7, 0x70, 0xcd, 0x1a, 0xa3, 0x20, 0xf7, // 0288 -+0x30, 0xcd, 0x1b, 0xb3, 0x20, 0xf7, 0xf0, 0xcc, // 0290 -+0x1c, 0xc3, 0x20, 0xf7, 0xb0, 0xcc, 0x1d, 0xd3, // 0298 -+0x20, 0xf7, 0x70, 0xcc, 0x1e, 0xe3, 0x20, 0xf7, // 02a0 -+0x30, 0xcc, 0x1f, 0xf3, 0x04, 0xff, 0x33, 0xcc, // 02a8 -+0x80, 0x03, 0xe0, 0xfb, 0x10, 0x00, 0x4c, 0xfe, // 02b0 -+0x33, 0xcc, 0x80, 0x03, 0xe0, 0xfb, 0x14, 0x00, // 02b8 -+0x00, 0xb5, 0x20, 0x00, 0x8c, 0xf8, 0x2f, 0xe0, // 02c0 -+0x80, 0x03, 0xe0, 0x63, 0x00, 0x00, 0x6f, 0x03, // 02c8 -+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 02d0 -+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 02d8 -+}; ---- /dev/null -+++ b/libavcodec/rpi_hevc_transform8.h -@@ -0,0 +1,94 @@ -+static const unsigned char rpi_hevc_transform8 [] = { -+0xa9, 0x03, 0x3e, 0x40, 0x4f, 0x40, 0x03, 0xb0, // 0000 -+0x20, 0x00, 0x0c, 0xf8, 0x38, 0x88, 0x80, 0x03, // 0008 -+0xc0, 0xf8, 0x00, 0x00, 0x40, 0xb0, 0x00, 0x02, // 0010 -+0x0c, 0xf8, 0x38, 0xa8, 0x80, 0x03, 0xc0, 0xf8, // 0018 -+0x00, 0x00, 0x00, 0x60, 0x03, 0xb0, 0x20, 0x00, // 0020 -+0x07, 0xb0, 0x00, 0x02, 0x08, 0xb0, 0x00, 0x04, // 0028 -+0x04, 0xb0, 0x40, 0x00, 0x05, 0xb0, 0x00, 0x08, // 0030 -+0x59, 0xb0, 0xc0, 0xfd, 0x0b, 0x12, 0x5b, 0x7a, // 0038 -+0x5b, 0x7c, 0x4a, 0xc3, 0x50, 0x17, 0x02, 0x6f, // 0040 -+0x02, 0x6a, 0x32, 0x18, 0x0a, 0x6a, 0x16, 0x40, // 0048 -+0x04, 0x18, 0x1a, 0x66, 0x80, 0x90, 0x32, 0x00, // 0050 -+0x0c, 0xf8, 0x38, 0x80, 0x80, 0x03, 0xc0, 0x08, // 0058 -+0x18, 0x00, 0x80, 0x90, 0x51, 0x00, 0x04, 0xff, // 0060 -+0x30, 0xc0, 0x80, 0x03, 0x20, 0x08, 0x10, 0x00, // 0068 -+0x4c, 0xfe, 0x30, 0xc0, 0x09, 0x04, 0x20, 0x08, // 0070 -+0x00, 0x00, 0x04, 0xfc, 0x38, 0x90, 0x80, 0x02, // 0078 -+0xc0, 0x0b, 0x02, 0x00, 0x80, 0x90, 0x40, 0x00, // 0080 -+0x04, 0xff, 0x30, 0xc0, 0x80, 0x03, 0x20, 0x08, // 0088 -+0x14, 0x00, 0x4c, 0xfe, 0x30, 0xc0, 0x04, 0x04, // 0090 -+0x20, 0x08, 0x00, 0x00, 0x8c, 0xf8, 0x2c, 0xe0, // 0098 -+0x80, 0x03, 0x20, 0x30, 0x04, 0x00, 0x80, 0x45, // 00a0 -+0x71, 0x42, 0xf2, 0x8c, 0xd1, 0xc0, 0x59, 0xb0, // 00a8 -+0x40, 0x02, 0x00, 0x9e, 0x6d, 0x00, 0x29, 0x03, // 00b0 -+0x00, 0xf4, 0x38, 0x80, 0x00, 0x0c, 0xb6, 0x40, // 00b8 -+0x8c, 0xf8, 0x20, 0xe0, 0x80, 0x03, 0x00, 0x30, // 00c0 -+0x18, 0x00, 0x15, 0x40, 0x08, 0xf0, 0x38, 0x80, // 00c8 -+0x85, 0x0b, 0x66, 0xb5, 0xe0, 0xff, 0x88, 0xf0, // 00d0 -+0x24, 0xe0, 0x86, 0x03, 0x0c, 0x60, 0x64, 0x08, // 00d8 -+0x46, 0x62, 0x49, 0xc3, 0x50, 0x27, 0x04, 0x6a, // 00e0 -+0x84, 0x6e, 0x07, 0x18, 0x69, 0xa0, 0x04, 0x5f, // 00e8 -+0x1c, 0x8b, 0xf7, 0xc8, 0x45, 0x76, 0x6b, 0x1f, // 00f0 -+0xb6, 0x40, 0x04, 0xb0, 0x40, 0x00, 0x05, 0xb0, // 00f8 -+0x00, 0x08, 0x5a, 0x00, 0x06, 0xb4, 0x10, 0x00, // 0100 -+0xa4, 0xff, 0x24, 0xcc, 0x60, 0x02, 0x00, 0xf8, // 0108 -+0x3e, 0x00, 0x03, 0xff, 0x37, 0xd0, 0x78, 0x03, // 0110 -+0xe0, 0x03, 0xbe, 0x0b, 0x10, 0x8b, 0xf6, 0x5b, // 0118 -+0x00, 0x67, 0x5a, 0x00, 0x06, 0xb4, 0x10, 0x00, // 0120 -+0xa4, 0xff, 0x24, 0xcc, 0xe0, 0x02, 0x00, 0xf8, // 0128 -+0x3e, 0x00, 0x03, 0xff, 0x37, 0xd0, 0x78, 0x03, // 0130 -+0xe0, 0x03, 0xbe, 0x0b, 0x10, 0x8b, 0xf6, 0x5b, // 0138 -+0x00, 0x67, 0x5a, 0x00, 0x00, 0xf4, 0x38, 0x80, // 0140 -+0x00, 0x04, 0x20, 0xb5, 0x00, 0x08, 0x04, 0xb0, // 0148 -+0x20, 0x00, 0x8e, 0xf8, 0x20, 0xe0, 0x80, 0x03, // 0150 -+0xc0, 0x43, 0x00, 0x00, 0x08, 0xf0, 0x38, 0x80, // 0158 -+0x81, 0x03, 0x26, 0xb5, 0xe0, 0xff, 0x88, 0xf0, // 0160 -+0x20, 0xe0, 0x86, 0x03, 0x08, 0x60, 0x64, 0x08, // 0168 -+0x46, 0x62, 0x45, 0xc3, 0x50, 0x27, 0x04, 0x6a, // 0170 -+0xa4, 0x6e, 0x7f, 0x90, 0xbf, 0xff, 0x65, 0xa0, // 0178 -+0x04, 0x07, 0x18, 0x8b, 0xf6, 0xc8, 0x41, 0x76, // 0180 -+0x6a, 0x1f, 0x5a, 0x00, 0xe1, 0x40, 0xf2, 0x40, // 0188 -+0x0f, 0x7b, 0x02, 0x6f, 0x03, 0xb0, 0x80, 0x00, // 0190 -+0x07, 0xb0, 0x00, 0x02, 0xe8, 0x00, 0x08, 0x6d, // 0198 -+0xe8, 0xbf, 0x60, 0x01, 0x03, 0x18, 0x48, 0xb0, // 01a0 -+0x20, 0x10, 0x89, 0x40, 0x1a, 0x40, 0x02, 0x6a, // 01a8 -+0x24, 0x18, 0xa1, 0x40, 0x98, 0x40, 0xf2, 0x4a, // 01b0 -+0x06, 0x1e, 0xff, 0x9f, 0xc5, 0xff, 0x21, 0xb5, // 01b8 -+0x00, 0x08, 0x98, 0x40, 0x04, 0xb0, 0x40, 0x00, // 01c0 -+0x95, 0x60, 0x80, 0x90, 0x18, 0x00, 0x48, 0xb0, // 01c8 -+0x00, 0x04, 0x41, 0x76, 0x80, 0x90, 0x13, 0x00, // 01d0 -+0x04, 0xb0, 0x00, 0x08, 0x45, 0x60, 0x91, 0x40, // 01d8 -+0xa8, 0x40, 0x80, 0x90, 0x0c, 0x00, 0x48, 0xb0, // 01e0 -+0x00, 0x04, 0x41, 0x76, 0x80, 0x90, 0x07, 0x00, // 01e8 -+0x4a, 0xb0, 0x00, 0x08, 0xf2, 0x8c, 0xdf, 0xc0, // 01f0 -+0x29, 0x03, 0xef, 0x03, 0x0c, 0xf8, 0x38, 0x80, // 01f8 -+0x80, 0x03, 0xc0, 0xf8, 0x04, 0x00, 0x0c, 0xf8, // 0200 -+0x38, 0x84, 0xc0, 0x03, 0xc0, 0xf8, 0x04, 0x00, // 0208 -+0x00, 0x60, 0xff, 0x9f, 0x79, 0xff, 0x00, 0xb0, // 0210 -+0x00, 0x04, 0xff, 0x9f, 0x85, 0xff, 0x04, 0xff, // 0218 -+0x30, 0xcc, 0x10, 0x03, 0xe0, 0xfb, 0x3e, 0x00, // 0220 -+0x04, 0xff, 0x33, 0xcc, 0x80, 0x03, 0xe0, 0xfb, // 0228 -+0x10, 0x00, 0x4c, 0xfe, 0x33, 0xcc, 0x80, 0x03, // 0230 -+0xe0, 0xfb, 0x14, 0x00, 0x80, 0x40, 0x06, 0xb0, // 0238 -+0x40, 0x00, 0x8c, 0xf8, 0x2f, 0xe0, 0x80, 0x03, // 0240 -+0xe0, 0x63, 0x00, 0x00, 0x20, 0xf7, 0xf0, 0xcf, // 0248 -+0x10, 0x03, 0x20, 0xf7, 0xb0, 0xcf, 0x11, 0x13, // 0250 -+0x20, 0xf7, 0x70, 0xcf, 0x12, 0x23, 0x20, 0xf7, // 0258 -+0x30, 0xcf, 0x13, 0x33, 0x20, 0xf7, 0xf0, 0xce, // 0260 -+0x14, 0x43, 0x20, 0xf7, 0xb0, 0xce, 0x15, 0x53, // 0268 -+0x20, 0xf7, 0x70, 0xce, 0x16, 0x63, 0x20, 0xf7, // 0270 -+0x30, 0xce, 0x17, 0x73, 0x20, 0xf7, 0xf0, 0xcd, // 0278 -+0x18, 0x83, 0x20, 0xf7, 0xb0, 0xcd, 0x19, 0x93, // 0280 -+0x20, 0xf7, 0x70, 0xcd, 0x1a, 0xa3, 0x20, 0xf7, // 0288 -+0x30, 0xcd, 0x1b, 0xb3, 0x20, 0xf7, 0xf0, 0xcc, // 0290 -+0x1c, 0xc3, 0x20, 0xf7, 0xb0, 0xcc, 0x1d, 0xd3, // 0298 -+0x20, 0xf7, 0x70, 0xcc, 0x1e, 0xe3, 0x20, 0xf7, // 02a0 -+0x30, 0xcc, 0x1f, 0xf3, 0x04, 0xff, 0x33, 0xcc, // 02a8 -+0x80, 0x03, 0xe0, 0xfb, 0x10, 0x00, 0x4c, 0xfe, // 02b0 -+0x33, 0xcc, 0x80, 0x03, 0xe0, 0xfb, 0x14, 0x00, // 02b8 -+0x00, 0xb5, 0x20, 0x00, 0x8c, 0xf8, 0x2f, 0xe0, // 02c0 -+0x80, 0x03, 0xe0, 0x63, 0x00, 0x00, 0x6f, 0x03, // 02c8 -+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 02d0 -+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 02d8 -+}; ---- /dev/null -+++ b/libavcodec/rpi_hevcdec.c -@@ -0,0 +1,6134 @@ -+/* -+ * HEVC video Decoder -+ * -+ * Copyright (C) 2012 - 2013 Guillaume Martres -+ * Copyright (C) 2012 - 2013 Mickael Raulet -+ * Copyright (C) 2012 - 2013 Gildas Cocherel -+ * Copyright (C) 2012 - 2013 Wassim Hamidouche -+ * Copyright (C) 2018 John Cox, Ben Avison, Peter de Rivaz for Raspberry Pi (Trading) -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "libavutil/attributes.h" -+#include "libavutil/common.h" -+#include "libavutil/display.h" -+#include "libavutil/internal.h" -+#include "libavutil/mastering_display_metadata.h" -+#include "libavutil/md5.h" -+#include "libavutil/opt.h" -+#include "libavutil/pixdesc.h" -+#include "libavutil/stereo3d.h" -+ -+#include "decode.h" -+#include "bswapdsp.h" -+#include "bytestream.h" -+#include "golomb.h" -+#include "hevc.h" -+#include "rpi_hevc_data.h" -+#include "rpi_hevc_parse.h" -+#include "rpi_hevcdec.h" -+#include "rpi_hevc_cabac_fns.h" -+#include "profiles.h" -+#include "hwconfig.h" -+ -+#include "rpi_zc_frames.h" -+#include "rpi_qpu.h" -+#include "rpi_hevc_shader.h" -+#include "rpi_hevc_shader_cmd.h" -+#include "rpi_hevc_shader_template.h" -+#include "rpi_zc.h" -+#include "libavutil/rpi_sand_fns.h" -+ -+#include "pthread.h" -+#include -+ -+#define DEBUG_DECODE_N 0 // 0 = do all, n = frames idr onwards -+ -+#define PACK2(hi,lo) (((hi) << 16) | ((lo) & 0xffff)) -+ -+#ifndef av_mod_uintp2 -+static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) -+{ -+ return a & ((1 << p) - 1); -+} -+# define av_mod_uintp2 av_mod_uintp2_c -+#endif -+ -+const uint8_t ff_hevc_rpi_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; -+static void rpi_begin(const HEVCRpiContext * const s, HEVCRpiJob * const jb, const unsigned int ctu_ts_first); -+ -+#define MC_DUMMY_X (-32) -+#define MC_DUMMY_Y (-32) -+ -+// UV & Y both have min 4x4 pred (no 2x2 chroma) -+// Allow for even spread +1 for setup, +1 for rounding -+// As we have load sharing this can (in theory) be exceeded so we have to -+// check after each CTU, but it is a good base size -+ -+// Worst case (all 4x4) commands per CTU -+#define QPU_Y_CMD_PER_CTU_MAX (16 * 16) -+#define QPU_C_CMD_PER_CTU_MAX (8 * 8) -+ -+#define QPU_MAX_CTU_PER_LINE ((HEVC_RPI_MAX_WIDTH + 63) / 64) -+ -+#define QPU_GRPS (QPU_N_MAX / QPU_N_GRP) -+#define QPU_CTU_PER_GRP ((QPU_MAX_CTU_PER_LINE + QPU_GRPS - 1) / QPU_GRPS) -+ -+#define QPU_Y_CMD_SLACK_PER_Q (QPU_Y_CMD_PER_CTU_MAX / 2) -+#define QPU_C_CMD_SLACK_PER_Q (QPU_C_CMD_PER_CTU_MAX / 2) -+ -+// Total cmds to allocate - allow for slack & setup -+#define QPU_Y_COMMANDS (QPU_CTU_PER_GRP * QPU_GRPS * QPU_Y_CMD_PER_CTU_MAX + (1 + QPU_Y_CMD_SLACK_PER_Q) * QPU_N_MAX) -+#define QPU_C_COMMANDS (QPU_CTU_PER_GRP * QPU_GRPS * QPU_C_CMD_PER_CTU_MAX + (1 + QPU_C_CMD_SLACK_PER_Q) * QPU_N_MAX) -+ -+#define QPU_Y_SYNCS (QPU_N_MAX * (16 + 2)) -+#define QPU_C_SYNCS (QPU_N_MAX * (8 + 2)) -+ -+// The QPU code for UV blocks only works up to a block width of 8 -+#define RPI_CHROMA_BLOCK_WIDTH 8 -+ -+#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) -+ -+ -+// Actual filter goes -ve, +ve, +ve, -ve using these values -+static const uint32_t rpi_filter_coefs[8] = { -+ ENCODE_COEFFS( 0, 64, 0, 0), -+ ENCODE_COEFFS( 2, 58, 10, 2), -+ ENCODE_COEFFS( 4, 54, 16, 2), -+ ENCODE_COEFFS( 6, 46, 28, 4), -+ ENCODE_COEFFS( 4, 36, 36, 4), -+ ENCODE_COEFFS( 4, 28, 46, 6), -+ ENCODE_COEFFS( 2, 16, 54, 4), -+ ENCODE_COEFFS( 2, 10, 58, 2) -+}; -+ -+// Function arrays by QPU -+ -+static const int * const inter_pred_setup_c_qpu[12] = { -+ mc_setup_c_q0, mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn, -+ mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn, -+ mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn -+}; -+ -+static const int * const inter_pred_setup_c10_qpu[12] = { -+ mc_setup_c10_q0, mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn, -+ mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn, -+ mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn -+}; -+ -+static const int * const inter_pred_setup_y_qpu[12] = { -+ mc_setup_y_q0, mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn, -+ mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn, -+ mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn -+}; -+ -+static const int * const inter_pred_setup_y10_qpu[12] = { -+ mc_setup_y10_q0, mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn, -+ mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn, -+ mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn -+}; -+ -+static const int * const inter_pred_sync_qpu[12] = { -+ mc_sync_q0, mc_sync_q1, mc_sync_q2, mc_sync_q3, -+ mc_sync_q4, mc_sync_q5, mc_sync_q6, mc_sync_q7, -+ mc_sync_q8, mc_sync_q9, mc_sync_q10, mc_sync_q11 -+}; -+ -+static const int * const inter_pred_sync10_qpu[12] = { -+ mc_sync10_q0, mc_sync10_q1, mc_sync10_q2, mc_sync10_q3, -+ mc_sync10_q4, mc_sync10_q5, mc_sync10_q6, mc_sync10_q7, -+ mc_sync10_q8, mc_sync10_q9, mc_sync10_q10, mc_sync10_q11 -+}; -+ -+static const int * const inter_pred_exit_c_qpu[12] = { -+ mc_exit_c_q0, mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn, -+ mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn, -+ mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn -+}; -+ -+static const int * const inter_pred_exit_c10_qpu[12] = { -+ mc_exit_c10_q0, mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn, -+ mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn, -+ mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn -+}; -+ -+static const int * const inter_pred_exit_y_qpu[12] = { -+ mc_exit_y_q0, mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn, -+ mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn, -+ mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn -+}; -+ -+static const int * const inter_pred_exit_y10_qpu[12] = { -+ mc_exit_y10_q0, mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn, -+ mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn, -+ mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn -+}; -+ -+typedef struct ipe_chan_info_s -+{ -+ const uint8_t bit_depth; -+ const uint8_t n; -+ const int * const * setup_fns; -+ const int * const * sync_fns; -+ const int * const * exit_fns; -+} ipe_chan_info_t; -+ -+typedef struct ipe_init_info_s -+{ -+ ipe_chan_info_t luma; -+ ipe_chan_info_t chroma; -+} ipe_init_info_t; -+ -+static void set_bytes(uint8_t * b, const unsigned int stride, const int ln, unsigned int a) -+{ -+ switch (ln) -+ { -+ default: // normally 0 -+ *b = a; -+ break; -+ case 1: -+ a |= a << 8; -+ *(uint16_t *)b = a; -+ b += stride; -+ *(uint16_t *)b = a; -+ break; -+ case 2: -+ a |= a << 8; -+ a |= a << 16; -+ *(uint32_t *)b = a; -+ b += stride; -+ *(uint32_t *)b = a; -+ b += stride; -+ *(uint32_t *)b = a; -+ b += stride; -+ *(uint32_t *)b = a; -+ break; -+ case 3: -+ { -+ unsigned int i; -+ uint64_t d; -+ a |= a << 8; -+ a |= a << 16; -+ d = ((uint64_t)a << 32) | a; -+ for (i = 0; i != 8; ++i, b += stride) -+ *(uint64_t *)b = d; -+ break; -+ } -+ case 4: -+ { -+ unsigned int i; -+ uint64_t d; -+ a |= a << 8; -+ a |= a << 16; -+ d = ((uint64_t)a << 32) | a; -+ for (i = 0; i != 16; ++i, b += stride) -+ { -+ *(uint64_t *)b = d; -+ *(uint64_t *)(b + 8) = d; -+ } -+ break; -+ } -+ } -+} -+ -+// We expect this to be called with ln = (log2_cb_size - 3) so range = -1..3 -+// (4 not required) -+static void set_stash2(uint8_t * b_u, uint8_t * b_l, const int ln, unsigned int a) -+{ -+ switch (ln) -+ { -+ default: // 0 or -1 -+ *b_u = a; -+ *b_l = a; -+ break; -+ case 1: -+ a |= a << 8; -+ *(uint16_t *)b_u = a; -+ *(uint16_t *)b_l = a; -+ break; -+ case 2: -+ a |= a << 8; -+ a |= a << 16; -+ *(uint32_t *)b_u = a; -+ *(uint32_t *)b_l = a; -+ break; -+ case 3: -+ a |= a << 8; -+ a |= a << 16; -+ *(uint32_t *)b_u = a; -+ *(uint32_t *)(b_u + 4) = a; -+ *(uint32_t *)b_l = a; -+ *(uint32_t *)(b_l + 4) = a; -+ break; -+ case 4: -+ a |= a << 8; -+ a |= a << 16; -+ *(uint32_t *)b_u = a; -+ *(uint32_t *)(b_u + 4) = a; -+ *(uint32_t *)(b_u + 8) = a; -+ *(uint32_t *)(b_u + 12) = a; -+ *(uint32_t *)b_l = a; -+ *(uint32_t *)(b_l + 4) = a; -+ *(uint32_t *)(b_l + 8) = a; -+ *(uint32_t *)(b_l + 12) = a; -+ break; -+ } -+} -+ -+static void zap_cabac_stash(uint8_t * b, const int ln) -+{ -+ switch (ln) -+ { -+ default: // 0 -+ *b = 0; -+ break; -+ case 1: -+ *(uint16_t *)b = 0; -+ break; -+ case 2: -+ *(uint32_t *)b = 0; -+ break; -+ case 3: -+ *(uint32_t *)b = 0; -+ *(uint32_t *)(b + 4) = 0; -+ break; -+ } -+} -+ -+ -+ -+// Set a small square block of bits in a bitmap -+// Bits must be aligned on their size boundry (which will be true of all split CBs) -+static void set_bits(uint8_t * f, const unsigned int x, const unsigned int stride, const unsigned int ln) -+{ -+ unsigned int n; -+ const unsigned int sh = (x & 7); -+ -+ f += (x >> 3); -+ -+ av_assert2(ln <= 3); -+ av_assert2((x & ((1 << ln) - 1)) == 0); -+ -+ switch (ln) -+ { -+ default: // 1 -+ f[0] |= 1 << sh; -+ break; -+ case 1: // 3 * 2 -+ n = 3 << sh; -+ f[0] |= n; -+ f[stride] |= n; -+ break; -+ case 2: // 0xf * 4 -+ n = 0xf << sh; -+ f[0] |= n; -+ f[stride] |= n; -+ f[stride * 2] |= n; -+ f[stride * 3] |= n; -+ break; -+ case 3: // 0xff * 8 -+ for (n = 0; n != 8; ++n, f += stride) -+ *f = 0xff; -+ break; -+ } -+} -+ -+static const ipe_init_info_t ipe_init_infos[9] = { // Alloc for bit depths of 8-16 -+ { // 8 -+ .luma = {8, QPU_MC_PRED_N_Y8, inter_pred_setup_y_qpu, inter_pred_sync_qpu, inter_pred_exit_y_qpu}, -+ .chroma = {8, QPU_MC_PRED_N_C8, inter_pred_setup_c_qpu, inter_pred_sync_qpu, inter_pred_exit_c_qpu} -+ }, -+ { // 9 -+ .luma = {0}, -+ .chroma = {0} -+ }, -+ { // 10 -+ .luma = {10, QPU_MC_PRED_N_Y10, inter_pred_setup_y10_qpu, inter_pred_sync10_qpu, inter_pred_exit_y10_qpu}, -+ .chroma = {10, QPU_MC_PRED_N_C10, inter_pred_setup_c10_qpu, inter_pred_sync10_qpu, inter_pred_exit_c10_qpu} -+ } -+ -+}; -+ -+static void set_ipe_from_ici(HEVCRpiInterPredEnv * const ipe, const ipe_chan_info_t * const ici) -+{ -+ const unsigned int n = ici->n; -+ const unsigned int q1_size = (ipe->gptr.numbytes / n) & ~3; // Round down to word -+ -+ ipe->n = n; -+ ipe->max_fill = q1_size - ipe->min_gap; -+ for(unsigned int i = 0; i < n; i++) { -+ HEVCRpiInterPredQ * const q = ipe->q + i; -+ q->qpu_mc_curr = q->qpu_mc_base = -+ (qpu_mc_pred_cmd_t *)(ipe->gptr.arm + i * q1_size); -+ q->code_setup = qpu_fn(ici->setup_fns[i]); -+ q->code_sync = qpu_fn(ici->sync_fns[i]); -+ q->code_exit = qpu_fn(ici->exit_fns[i]); -+ } -+} -+ -+static void rpi_hevc_qpu_set_fns(HEVCRpiContext * const s, const unsigned int bit_depth) -+{ -+ av_assert0(bit_depth >= 8 && bit_depth <= 16); -+ -+ rpi_hevc_qpu_init_fn(&s->qpu, bit_depth); -+} -+ -+// Unsigned Trivial MOD -+static inline unsigned int utmod(const unsigned int x, const unsigned int n) -+{ -+ return x >= n ? x - n : x; -+} -+ -+// returns pq->job_n++ -+static inline unsigned int pass_queue_inc_job_n(HEVCRpiPassQueue * const pq) -+{ -+ unsigned int const x2 = pq->job_n; -+ pq->job_n = utmod(x2 + 1, RPI_MAX_JOBS); -+ return x2; -+} -+ -+static void pass_queue_init(HEVCRpiPassQueue * const pq, HEVCRpiContext * const s, HEVCRpiWorkerFn * const worker, sem_t * const psem_out, const int n) -+{ -+ pq->terminate = 0; -+ pq->job_n = 0; -+ pq->context = s; -+ pq->worker = worker; -+ pq->psem_out = psem_out; -+ pq->pass_n = n; -+ pq->started = 0; -+ sem_init(&pq->sem_in, 0, 0); -+} -+ -+static void pass_queue_kill(HEVCRpiPassQueue * const pq) -+{ -+ sem_destroy(&pq->sem_in); -+} -+ -+static inline void rpi_sem_wait(sem_t * const sem) -+{ -+ while (sem_wait(sem) != 0) { -+ av_assert0(errno == EINTR); -+ } -+} -+ -+static void pass_queue_submit_job(HEVCRpiPassQueue * const pq) -+{ -+ sem_post(&pq->sem_in); -+} -+ -+static inline void pass_queue_do_all(HEVCRpiContext * const s, HEVCRpiJob * const jb) -+{ -+ // Do the various passes - common with the worker code -+ for (unsigned int i = 0; i != RPI_PASSES; ++i) { -+ s->passq[i].worker(s, jb); -+ } -+} -+ -+ -+#if 0 -+static void dump_jbc(const HEVCRpiJobCtl *const jbc, const char * const func) -+{ -+ int x; -+ sem_getvalue((sem_t *)&jbc->sem_out, &x); -+ printf("%s: jbc: in=%d, out=%d, sum=%d\n", func, jbc->offload_in, jbc->offload_out, x); -+} -+#endif -+ -+ -+static HEVCRpiJob * job_alloc(HEVCRpiJobCtl * const jbc, HEVCRpiLocalContext * const lc) -+{ -+ HEVCRpiJob * jb; -+ HEVCRpiJobGlobal * const jbg = jbc->jbg; -+ -+ pthread_mutex_lock(&jbg->lock); -+ // Check local 1st -+ if ((jb = jbc->jb1) != NULL) -+ { -+ // Only 1 - very easy :-) -+ jbc->jb1 = NULL; -+ } -+ else -+ { -+ // Now look for global free chain -+ if ((jb = jbg->free1) != NULL) -+ { -+ // Found one - unlink it -+ jbg->free1 = jb->next; -+ jb->next = NULL; -+ } -+ else -+ { -+ // Out of places to look - wait for one to become free - add to Qs -+ -+ // Global -+ // If "good" lc then add after the last "good" el in the chain -+ // otherwise add to the tail -+ if (jbg->wait_tail == NULL || jbg->wait_tail->last_progress_good || !lc->last_progress_good) -+ { -+ // Add to end as we had to wait last time or wait Q empty -+ if ((lc->jw_prev = jbg->wait_tail) == NULL) -+ jbg->wait_head = lc; -+ else -+ lc->jw_prev->jw_next = lc; -+ lc->jw_next = NULL; -+ jbg->wait_tail = lc; -+ } -+ else -+ { -+ // This is a "good" lc that we need to poke into the middle -+ // of the Q -+ // We know that the Q isn't empty and there is at least one -+ // !last_progess_good el in it from the previous test -+ -+ HEVCRpiLocalContext * const p = jbg->wait_good; // Insert after -+ -+ if (p == NULL) -+ { -+ // No current good els - add to head -+ lc->jw_next = jbg->wait_head; -+ jbg->wait_head = lc; -+ } -+ else -+ { -+ lc->jw_next = p->jw_next; -+ p->jw_next = lc; -+ } -+ -+ lc->jw_next->jw_prev = lc; -+ lc->jw_prev = p; -+ } -+ -+ // If "good" then we are now the last good waiting el -+ if (lc->last_progress_good) -+ jbg->wait_good = lc; -+ -+ // Local -+ if ((lc->ljw_prev = jbc->lcw_tail) == NULL) -+ jbc->lcw_head = lc; -+ else -+ lc->ljw_prev->ljw_next = lc; -+ lc->ljw_next = NULL; -+ jbc->lcw_tail = lc; -+ } -+ } -+ -+ pthread_mutex_unlock(&jbg->lock); -+ -+ if (jb == NULL) // Need to wait -+ { -+ rpi_sem_wait(&lc->jw_sem); -+ jb = lc->jw_job; // Set by free code -+ } -+ -+ return jb; -+} -+ -+ -+static void job_free(HEVCRpiJobCtl * const jbc0, HEVCRpiJob * const jb) -+{ -+ HEVCRpiJobGlobal * const jbg = jbc0->jbg; // This jbc only used to find jbg so we can get the lock -+ HEVCRpiJobCtl * jbc = jb->jbc_local; -+ HEVCRpiLocalContext * lc = NULL; -+ -+ pthread_mutex_lock(&jbg->lock); -+ -+ if (jbc != NULL) -+ { -+ av_assert1(jbc->jb1 == NULL); -+ -+ // Release to Local if nothing waiting there -+ if ((lc = jbc->lcw_head) == NULL) -+ jbc->jb1 = jb; -+ } -+ else -+ { -+ // Release to global if nothing waiting there -+ if ((lc = jbg->wait_head) == NULL) -+ { -+ jb->next = jbg->free1; -+ jbg->free1 = jb; -+ } -+ else -+ { -+ // ? seems somehow mildy ugly... -+ jbc = lc->context->jbc; -+ } -+ } -+ -+ if (lc != NULL) -+ { -+ // Something was waiting -+ -+ // Unlink -+ // Global -+ if (lc->jw_next == NULL) -+ jbg->wait_tail = lc->jw_prev; -+ else -+ lc->jw_next->jw_prev = lc->jw_prev; -+ -+ if (lc->jw_prev == NULL) -+ jbg->wait_head = lc->jw_next; -+ else -+ lc->jw_prev->jw_next = lc->jw_next; -+ -+ // Local -+ if (lc->ljw_next == NULL) -+ jbc->lcw_tail = lc->ljw_prev; -+ else -+ lc->ljw_next->ljw_prev = lc->ljw_prev; -+ -+ if (lc->ljw_prev == NULL) -+ jbc->lcw_head = lc->ljw_next; -+ else -+ lc->ljw_prev->ljw_next = lc->ljw_next; -+ -+ // Update good if required -+ if (jbg->wait_good == lc) -+ jbg->wait_good = lc->jw_prev; -+ -+ // Prod -+ lc->jw_job = jb; -+ sem_post(&lc->jw_sem); -+ } -+ -+ pthread_mutex_unlock(&jbg->lock); -+} -+ -+static void job_lc_kill(HEVCRpiLocalContext * const lc) -+{ -+ sem_destroy(&lc->jw_sem); -+} -+ -+static void job_lc_init(HEVCRpiLocalContext * const lc) -+{ -+ lc->jw_next = NULL; -+ lc->jw_prev = NULL; -+ lc->ljw_next = NULL; -+ lc->ljw_prev = NULL; -+ lc->jw_job = NULL; -+ sem_init(&lc->jw_sem, 0, 0); -+} -+ -+// Returns: -+// 0 if we have waited for MV or expect to wait for recon -+// 1 if we haven't waited for MV & do not need to wait for recon -+static int progress_good(const HEVCRpiContext *const s, const HEVCRpiJob * const jb) -+{ -+ if (jb->waited) // reset by rpi_begin -+ return 0; -+ for (unsigned int i = 0; i != FF_ARRAY_ELEMS(jb->progress_req); ++i) -+ { -+ if (jb->progress_req[i] >= 0 && s->DPB[i].tf.progress != NULL && -+ ((volatile int *)(s->DPB[i].tf.progress->data))[0] < jb->progress_req[i]) -+ return 0; -+ } -+ return 1; -+} -+ -+// Submit job if it is full (indicated by having ctu_ts_last set >= 0) -+static inline void worker_submit_job(HEVCRpiContext *const s, HEVCRpiLocalContext * const lc) -+{ -+ HEVCRpiJobCtl *const jbc = s->jbc; -+ HEVCRpiJob * const jb = lc->jb0; -+ -+ av_assert1(jb != NULL); -+ -+ if (jb->ctu_ts_last < 0) { -+ return; -+ } -+ -+ lc->last_progress_good = progress_good(s, jb); -+ jb->waited = !lc->last_progress_good; -+ lc->jb0 = NULL; -+ -+ if (s->offload_recon) -+ { -+ pthread_mutex_lock(&jbc->in_lock); -+ jbc->offloadq[jbc->offload_in] = jb; -+ jbc->offload_in = utmod(jbc->offload_in + 1, RPI_MAX_JOBS); -+ pthread_mutex_unlock(&jbc->in_lock); -+ -+ pass_queue_submit_job(s->passq + 0); // Consumes job eventually -+ } -+ else -+ { -+ pass_queue_do_all(s, jb); // Consumes job before return -+ } -+} -+ -+ -+// Call worker_pass0_ready to wait until the s->pass0_job slot becomes -+// available to receive the next job. -+// -+// Now safe against multiple callers - needed for tiles -+// "normal" and WPP will only call here one at a time -+static inline void worker_pass0_ready(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) -+{ -+ HEVCRpiJobCtl * const jbc = s->jbc; -+ -+ // It is legit for us to already have a job allocated - do nothing in this case -+ if (lc->jb0 != NULL) -+ return; -+ -+ if (s->offload_recon) -+ rpi_sem_wait(&jbc->sem_out); // This sem will stop this frame grabbing too much -+ -+ lc->jb0 = job_alloc(jbc, lc); -+ -+ rpi_begin(s, lc->jb0, lc->ts); -+} -+ -+// Free up a job without submission -+static void worker_free(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) -+{ -+ HEVCRpiJobCtl * const jbc = s->jbc; -+ HEVCRpiJob * const jb = lc->jb0; -+ -+ if (jb == NULL) { -+ return; -+ } -+ -+ lc->jb0 = NULL; -+ -+ job_free(jbc, jb); -+ -+ // If offload then poke sem_out too -+ if (s->offload_recon) { -+ sem_post(&jbc->sem_out); -+ } -+} -+ -+ -+// Call this to wait for all jobs to have completed at the end of a frame -+// Slightly icky as there is no clean way to wait for a sem to count up -+// Not reentrant - call on main thread only -+static void worker_wait(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) -+{ -+ HEVCRpiJobCtl * const jbc = s->jbc; -+ int i = 0; -+ -+ // We shouldn't reach here with an unsubmitted job -+ av_assert1(lc->jb0 == NULL); -+ -+ // If no offload then there can't be anything to wait for -+ if (!s->offload_recon) { -+ return; -+ } -+ -+ if (sem_getvalue(&jbc->sem_out, &i) == 0 && i < RPI_MAX_JOBS) -+ { -+ for (i = 0; i != RPI_MAX_JOBS; ++i) { -+ rpi_sem_wait(&jbc->sem_out); -+ } -+ for (i = 0; i != RPI_MAX_JOBS; ++i) { -+ sem_post(&jbc->sem_out); -+ } -+ } -+} -+ -+static void * pass_worker(void *arg) -+{ -+ HEVCRpiPassQueue *const pq = (HEVCRpiPassQueue *)arg; -+ HEVCRpiContext *const s = pq->context; -+ -+ for (;;) -+ { -+ rpi_sem_wait(&pq->sem_in); -+ -+ if (pq->terminate) -+ break; -+ -+ pq->worker(s, s->jbc->offloadq[pass_queue_inc_job_n(pq)]); -+ // * should really set jb->passes_done here -+ -+ sem_post(pq->psem_out); -+ } -+ return NULL; -+} -+ -+static void pass_queues_start_all(HEVCRpiContext *const s) -+{ -+ unsigned int i; -+ HEVCRpiPassQueue * const pqs = s->passq; -+ -+ for (i = 0; i != RPI_PASSES; ++i) -+ { -+ av_assert0(pthread_create(&pqs[i].thread, NULL, pass_worker, pqs + i) == 0); -+ pqs[i].started = 1; -+ } -+} -+ -+static void pass_queues_term_all(HEVCRpiContext *const s) -+{ -+ unsigned int i; -+ HEVCRpiPassQueue * const pqs = s->passq; -+ -+ for (i = 0; i != RPI_PASSES; ++i) -+ pqs[i].terminate = 1; -+ for (i = 0; i != RPI_PASSES; ++i) -+ { -+ if (pqs[i].started) -+ sem_post(&pqs[i].sem_in); -+ } -+ for (i = 0; i != RPI_PASSES; ++i) -+ { -+ if (pqs[i].started) { -+ pthread_join(pqs[i].thread, NULL); -+ pqs[i].started = 0; -+ } -+ } -+} -+ -+static void pass_queues_kill_all(HEVCRpiContext *const s) -+{ -+ unsigned int i; -+ HEVCRpiPassQueue * const pqs = s->passq; -+ -+ for (i = 0; i != RPI_PASSES; ++i) -+ pass_queue_kill(pqs + i); -+} -+ -+ -+static void worker_pic_free_one(HEVCRpiJob * const jb) -+{ -+ // Free coeff stuff - allocation not the same for all buffers -+ HEVCRpiCoeffsEnv * const cf = &jb->coeffs; -+ -+ if (cf->s[0].buf != NULL) -+ av_freep(&cf->mptr); -+ if (cf->s[2].buf != NULL) -+ gpu_free(&cf->gptr); -+ memset(cf, 0, sizeof(*cf)); -+} -+ -+static int worker_pic_alloc_one(HEVCRpiJob * const jb, const unsigned int coeff_count) -+{ -+ HEVCRpiCoeffsEnv * const cf = &jb->coeffs; -+ -+ if (gpu_malloc_cached((coeff_count + 32*32) * sizeof(cf->s[2].buf[0]), &cf->gptr) != 0) -+ goto fail; -+ cf->s[2].buf = (int16_t *)cf->gptr.arm; -+ cf->s[3].buf = cf->s[2].buf + coeff_count; -+ -+ // Must be 64 byte aligned for our zero zapping code so over-allocate & -+ // round -+ if ((cf->mptr = av_malloc(coeff_count * sizeof(cf->s[0].buf[0]) + 63)) == NULL) -+ goto fail; -+ cf->s[0].buf = (void *)(((intptr_t)cf->mptr + 63) & ~63); -+ return 0; -+ -+fail: -+ av_log(NULL, AV_LOG_ERROR, "%s: Allocation failed\n", __func__); -+ worker_pic_free_one(jb); -+ return -1; -+} -+ -+static void worker_pic_reset(HEVCRpiCoeffsEnv * const cf) -+{ -+ unsigned int i; -+ for (i = 0; i != 4; ++i) { -+ cf->s[i].n = 0; -+#if RPI_COMPRESS_COEFFS -+ cf->s[i].packed = 1; -+ cf->s[i].packed_n = 0; -+#endif -+ } -+} -+ -+int16_t * rpi_alloc_coeff_buf(HEVCRpiJob * const jb, const int buf_no, const int n) -+{ -+ HEVCRpiCoeffEnv *const cfe = jb->coeffs.s + buf_no; -+ int16_t * const coeffs = (buf_no != 3) ? cfe->buf + cfe->n : cfe->buf - (cfe->n + n); -+ cfe->n += n; -+ return coeffs; -+} -+ -+void ff_hevc_rpi_progress_wait_field(const HEVCRpiContext * const s, HEVCRpiJob * const jb, -+ const HEVCRpiFrame * const ref, const int val, const int field) -+{ -+ if (ref->tf.progress != NULL && ((int *)ref->tf.progress->data)[field] < val) { -+ HEVCRpiContext *const fs = ref->tf.owner[field]->priv_data; -+ HEVCRpiFrameProgressState * const pstate = fs->progress_states + field; -+ sem_t * sem = NULL; -+ -+ av_assert0(pthread_mutex_lock(&pstate->lock) == 0); -+ if (((volatile int *)ref->tf.progress->data)[field] < val) { -+ HEVCRpiFrameProgressWait * const pwait = &jb->progress_wait; -+ -+ av_assert1(pwait->req == -1 && pwait->next == NULL); -+ jb->waited = 1; // Remember that we had to wait for later scheduling -+ -+ pwait->req = val; -+ pwait->next = NULL; -+ if (pstate->first == NULL) -+ pstate->first = pwait; -+ else -+ pstate->last->next = pwait; -+ pstate->last = pwait; -+ sem = &pwait->sem; -+ } -+ pthread_mutex_unlock(&pstate->lock); -+ -+ if (sem != NULL) { -+ rpi_sem_wait(sem); -+ } -+ } -+} -+ -+void ff_hevc_rpi_progress_signal_field(HEVCRpiContext * const s, const int val, const int field) -+{ -+ HEVCRpiFrameProgressState *const pstate = s->progress_states + field; -+ -+ ((int *)s->ref->tf.progress->data)[field] = val; -+ -+ av_assert0(pthread_mutex_lock(&pstate->lock) == 0); -+ { -+ HEVCRpiFrameProgressWait ** ppwait = &pstate->first; -+ HEVCRpiFrameProgressWait * pwait; -+ -+ while ((pwait = *ppwait) != NULL) { -+ if (pwait->req > val) -+ { -+ ppwait = &pwait->next; -+ pstate->last = pwait; -+ } -+ else -+ { -+ *ppwait = pwait->next; -+ pwait->req = -1; -+ pwait->next = NULL; -+ sem_post(&pwait->sem); -+ } -+ } -+ } -+ pthread_mutex_unlock(&pstate->lock); -+} -+ -+static void ff_hevc_rpi_progress_init_state(HEVCRpiFrameProgressState * const pstate) -+{ -+ pstate->first = NULL; -+ pstate->last = NULL; -+ pthread_mutex_init(&pstate->lock, NULL); -+} -+ -+static void ff_hevc_rpi_progress_init_wait(HEVCRpiFrameProgressWait * const pwait) -+{ -+ pwait->req = -1; -+ pwait->next = NULL; -+ sem_init(&pwait->sem, 0, 0); -+} -+ -+static void ff_hevc_rpi_progress_kill_state(HEVCRpiFrameProgressState * const pstate) -+{ -+ av_assert1(pstate->first == NULL); -+ pthread_mutex_destroy(&pstate->lock); -+} -+ -+static void ff_hevc_rpi_progress_kill_wait(HEVCRpiFrameProgressWait * const pwait) -+{ -+ sem_destroy(&pwait->sem); -+} -+ -+ -+/** -+ * NOTE: Each function hls_foo correspond to the function foo in the -+ * specification (HLS stands for High Level Syntax). -+ */ -+ -+/** -+ * Section 5.7 -+ */ -+ -+// Realloc the entry point arrays -+static int alloc_entry_points(RpiSliceHeader * const sh, const int n) -+{ -+ if (sh->entry_point_offset == NULL || n > sh->offsets_allocated || n == 0) -+ { -+ // Round up alloc to multiple of 32 -+ int a = (n + 31) & ~31; -+ -+ // We don't care about the previous contents so probably fastest to simply discard -+ av_freep(&sh->entry_point_offset); -+ av_freep(&sh->offset); -+ av_freep(&sh->size); -+ -+ if (a != 0) -+ { -+ sh->entry_point_offset = av_malloc_array(a, sizeof(unsigned)); -+ sh->offset = av_malloc_array(a, sizeof(int)); -+ sh->size = av_malloc_array(a, sizeof(int)); -+ -+ if (!sh->entry_point_offset || !sh->offset || !sh->size) { -+ sh->num_entry_point_offsets = 0; -+ sh->offsets_allocated = 0; -+ return AVERROR(ENOMEM); -+ } -+ } -+ -+ sh->offsets_allocated = a; -+ } -+ -+ return 0; -+} -+ -+/* free everything allocated by pic_arrays_init() */ -+static void pic_arrays_free(HEVCRpiContext *s) -+{ -+ av_freep(&s->sao); -+ av_freep(&s->deblock); -+ -+ av_freep(&s->cabac_stash_up); -+ s->cabac_stash_left = NULL; // freed with _up -+ -+ av_freep(&s->mvf_up); -+ av_freep(&s->mvf_left); -+ -+ av_freep(&s->is_pcm); -+ av_freep(&s->is_intra_store); -+ s->is_intra = NULL; -+ av_freep(&s->rpl_tab); -+ s->rpl_tab_size = 0; -+ -+ av_freep(&s->qp_y_tab); -+ av_freep(&s->tab_slice_address); -+ av_freep(&s->filter_slice_edges); -+ -+ av_freep(&s->bs_horizontal); -+ s->bs_vertical = NULL; // freed with H -+ av_freep(&s->bsf_stash_left); -+ av_freep(&s->bsf_stash_up); -+ -+ av_freep(&s->rpl_up); -+ av_freep(&s->rpl_left); -+ -+ alloc_entry_points(&s->sh, 0); -+ -+ av_buffer_pool_uninit(&s->col_mvf_pool); -+} -+ -+/* allocate arrays that depend on frame dimensions */ -+static int pic_arrays_init(HEVCRpiContext * const s, const HEVCRpiSPS * const sps) -+{ -+ const unsigned int log2_min_cb_size = sps->log2_min_cb_size; -+ const unsigned int width = sps->width; -+ const unsigned int height = sps->height; -+ const unsigned int pic_size_in_cb = ((width >> log2_min_cb_size) + 1) * -+ ((height >> log2_min_cb_size) + 1); -+ const unsigned int ctb_count = sps->ctb_size; -+ -+ { -+ unsigned int w = ((width + HEVC_RPI_BS_STRIDE1_PEL_MASK) & ~HEVC_RPI_BS_STRIDE1_PEL_MASK); -+ unsigned int h = ((height + 15) & ~15); -+ -+ s->bs_stride2 = h >> HEVC_RPI_BS_COL_BYTES_SHR; // Column size -+ s->bs_size = s->bs_stride2 * (w >> HEVC_RPI_BS_STRIDE1_PEL_SHIFT); // col size * cols -+ } -+ -+ s->sao = av_mallocz(ctb_count * sizeof(*s->sao) + 8); // Our sao code overreads this array slightly -+ s->deblock = av_mallocz_array(ctb_count, sizeof(*s->deblock)); -+ if (!s->sao || !s->deblock) -+ goto fail; -+ -+ s->cabac_stash_up = av_malloc((((width + 63) & ~63) >> 3) + (((height + 63) & ~63) >> 3)); -+ s->cabac_stash_left = s->cabac_stash_up + (((width + 63) & ~63) >> 3); -+ if (s->cabac_stash_up == NULL) -+ goto fail; -+ -+ // Round width up to max ctb size -+ s->mvf_up = av_malloc((((width + 63) & ~63) >> LOG2_MIN_PU_SIZE) * sizeof(*s->mvf_up)); -+ // * Only needed if we have H tiles -+ s->mvf_left = av_malloc((((height + 63) & ~63) >> LOG2_MIN_PU_SIZE) * sizeof(*s->mvf_up)); -+ -+ // We can overread by 1 line & one byte in deblock so alloc & zero -+ // We don't need to zero the extra @ start of frame as it will never be -+ // written -+ s->is_pcm = av_mallocz(sps->pcm_width * (sps->pcm_height + 1) + 1); -+ s->is_intra_store = av_mallocz(sps->pcm_width * (sps->pcm_height + 1) + 1); -+ if (s->is_pcm == NULL || s->is_intra_store == NULL) -+ goto fail; -+ -+ s->filter_slice_edges = av_mallocz(ctb_count); -+ s->tab_slice_address = av_malloc_array(ctb_count, -+ sizeof(*s->tab_slice_address)); -+ s->qp_y_tab = av_malloc_array(pic_size_in_cb, -+ sizeof(*s->qp_y_tab)); -+ if (!s->qp_y_tab || !s->filter_slice_edges || !s->tab_slice_address) -+ goto fail; -+ -+ s->bs_horizontal = av_mallocz(s->bs_size * 2); -+ s->bs_vertical = s->bs_horizontal + s->bs_size; -+ if (s->bs_horizontal == NULL) -+ goto fail; -+ -+ s->rpl_up = av_mallocz(sps->ctb_width * sizeof(*s->rpl_up)); -+ s->rpl_left = av_mallocz(sps->ctb_height * sizeof(*s->rpl_left)); -+ if (s->rpl_left == NULL || s->rpl_up == NULL) -+ goto fail; -+ -+ if ((s->bsf_stash_left = av_mallocz(((height + 63) & ~63) >> 4)) == NULL || -+ (s->bsf_stash_up = av_mallocz(((width + 63) & ~63) >> 4)) == NULL) -+ goto fail; -+ -+ s->col_mvf_stride = (width + 15) >> 4; -+ s->col_mvf_pool = av_buffer_pool_init(((height + 15) >> 4) * s->col_mvf_stride * sizeof(ColMvField), -+ av_buffer_allocz); -+ if (s->col_mvf_pool == NULL) -+ goto fail; -+ -+ return 0; -+ -+fail: -+ pic_arrays_free(s); -+ return AVERROR(ENOMEM); -+} -+ -+static void default_pred_weight_table(HEVCRpiContext * const s) -+{ -+ unsigned int i; -+ const unsigned int wt = 1 << QPU_MC_DENOM; -+ s->sh.luma_log2_weight_denom = 0; -+ s->sh.chroma_log2_weight_denom = 0; -+ for (i = 0; i < s->sh.nb_refs[L0]; i++) { -+ s->sh.luma_weight_l0[i] = wt; -+ s->sh.luma_offset_l0[i] = 0; -+ s->sh.chroma_weight_l0[i][0] = wt; -+ s->sh.chroma_weight_l0[i][1] = wt; -+ s->sh.chroma_offset_l0[i][0] = 0; -+ s->sh.chroma_offset_l0[i][1] = 0; -+ } -+ for (i = 0; i < s->sh.nb_refs[L1]; i++) { -+ s->sh.luma_weight_l1[i] = wt; -+ s->sh.luma_offset_l1[i] = 0; -+ s->sh.chroma_weight_l1[i][0] = wt; -+ s->sh.chroma_weight_l1[i][1] = wt; -+ s->sh.chroma_offset_l1[i][0] = 0; -+ s->sh.chroma_offset_l1[i][1] = 0; -+ } -+} -+ -+static int get_weights(HEVCRpiContext * const s, GetBitContext * const gb, -+ const unsigned int refs, -+ int16_t * luma_weight, int16_t * luma_offset, -+ int16_t * chroma_weight, int16_t * chroma_offset) -+{ -+ unsigned int luma_flags; -+ unsigned int chroma_flags; -+ unsigned int i; -+ const unsigned int wp_offset_bd_shift = s->ps.sps->high_precision_offsets_enabled_flag ? 0 : (s->ps.sps->bit_depth - 8); -+ const int wp_offset_half_range = s->ps.sps->wp_offset_half_range; -+ const unsigned int luma_weight_base = 1 << QPU_MC_DENOM; -+ const unsigned int chroma_weight_base = 1 << QPU_MC_DENOM; -+ const unsigned int luma_weight_shift = (QPU_MC_DENOM - s->sh.luma_log2_weight_denom); -+ const unsigned int chroma_weight_shift = (QPU_MC_DENOM - s->sh.chroma_log2_weight_denom); -+ -+ if (refs == 0) -+ return 0; -+ -+ luma_flags = get_bits(gb, refs); -+ chroma_flags = ctx_cfmt(s) == 0 ? 0 : get_bits(gb, refs); -+ i = 1 << (refs - 1); -+ -+ do -+ { -+ if ((luma_flags & i) != 0) -+ { -+ const int delta_weight = get_se_golomb(gb); -+ const int offset = get_se_golomb(gb); -+ if (delta_weight < -128 || delta_weight > 127 || -+ offset < -wp_offset_half_range || offset >= wp_offset_half_range) -+ { -+ return AVERROR_INVALIDDATA; -+ } -+ *luma_weight++ = luma_weight_base + (delta_weight << luma_weight_shift); -+ *luma_offset++ = offset << wp_offset_bd_shift; -+ } -+ else -+ { -+ *luma_weight++ = luma_weight_base; -+ *luma_offset++ = 0; -+ } -+ -+ if ((chroma_flags & i) != 0) -+ { -+ unsigned int j; -+ for (j = 0; j != 2; ++j) -+ { -+ const int delta_weight = get_se_golomb(gb); -+ const int delta_offset = get_se_golomb(gb); -+ -+ if (delta_weight < -128 || delta_weight > 127 || -+ delta_offset < -4 * wp_offset_half_range || delta_offset >= 4 * wp_offset_half_range) -+ { -+ return AVERROR_INVALIDDATA; -+ } -+ -+ *chroma_weight++ = chroma_weight_base + (delta_weight << chroma_weight_shift); -+ *chroma_offset++ = av_clip( -+ wp_offset_half_range + delta_offset - -+ ((wp_offset_half_range * ((1 << s->sh.chroma_log2_weight_denom) + delta_weight)) >> s->sh.chroma_log2_weight_denom), -+ -wp_offset_half_range, wp_offset_half_range - 1) << wp_offset_bd_shift; -+ } -+ } -+ else -+ { -+ *chroma_weight++ = chroma_weight_base; -+ *chroma_weight++ = chroma_weight_base; -+ *chroma_offset++ = 0; -+ *chroma_offset++ = 0; -+ } -+ } while ((i >>= 1) != 0); -+ -+ return 0; -+} -+ -+static int pred_weight_table(HEVCRpiContext *s, GetBitContext *gb) -+{ -+ int err; -+ const unsigned int luma_log2_weight_denom = get_ue_golomb_long(gb); -+ const unsigned int chroma_log2_weight_denom = (ctx_cfmt(s) == 0) ? 0 : luma_log2_weight_denom + get_se_golomb(gb); -+ -+ if (luma_log2_weight_denom > 7 || -+ chroma_log2_weight_denom > 7) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, "Invalid prediction weight denom: luma=%d, chroma=%d\n", -+ luma_log2_weight_denom, chroma_log2_weight_denom); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ s->sh.luma_log2_weight_denom = luma_log2_weight_denom; -+ s->sh.chroma_log2_weight_denom = chroma_log2_weight_denom; -+ -+ if ((err = get_weights(s, gb, s->sh.nb_refs[L0], -+ s->sh.luma_weight_l0, s->sh.luma_offset_l0, -+ s->sh.chroma_weight_l0[0], s->sh.chroma_offset_l0[0])) != 0 || -+ (err = get_weights(s, gb, s->sh.nb_refs[L1], -+ s->sh.luma_weight_l1, s->sh.luma_offset_l1, -+ s->sh.chroma_weight_l1[0], s->sh.chroma_offset_l1[0])) != 0) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, "Invalid prediction weight or offset\n"); -+ return err; -+ } -+ -+ return 0; -+} -+ -+static int decode_lt_rps(HEVCRpiContext *s, LongTermRPS *rps, GetBitContext *gb) -+{ -+ const HEVCRpiSPS *sps = s->ps.sps; -+ int max_poc_lsb = 1 << sps->log2_max_poc_lsb; -+ int prev_delta_msb = 0; -+ unsigned int nb_sps = 0, nb_sh; -+ int i; -+ -+ rps->nb_refs = 0; -+ if (!sps->long_term_ref_pics_present_flag) -+ return 0; -+ -+ if (sps->num_long_term_ref_pics_sps > 0) -+ nb_sps = get_ue_golomb_long(gb); -+ nb_sh = get_ue_golomb_long(gb); -+ -+ if (nb_sps > sps->num_long_term_ref_pics_sps) -+ return AVERROR_INVALIDDATA; -+ if (nb_sh + (uint64_t)nb_sps > FF_ARRAY_ELEMS(rps->poc)) -+ return AVERROR_INVALIDDATA; -+ -+ rps->nb_refs = nb_sh + nb_sps; -+ -+ for (i = 0; i < rps->nb_refs; i++) { -+ uint8_t delta_poc_msb_present; -+ -+ if (i < nb_sps) { -+ uint8_t lt_idx_sps = 0; -+ -+ if (sps->num_long_term_ref_pics_sps > 1) -+ lt_idx_sps = get_bits(gb, av_ceil_log2(sps->num_long_term_ref_pics_sps)); -+ -+ rps->poc[i] = sps->lt_ref_pic_poc_lsb_sps[lt_idx_sps]; -+ rps->used[i] = sps->used_by_curr_pic_lt_sps_flag[lt_idx_sps]; -+ } else { -+ rps->poc[i] = get_bits(gb, sps->log2_max_poc_lsb); -+ rps->used[i] = get_bits1(gb); -+ } -+ -+ delta_poc_msb_present = get_bits1(gb); -+ if (delta_poc_msb_present) { -+ int64_t delta = get_ue_golomb_long(gb); -+ int64_t poc; -+ -+ if (i && i != nb_sps) -+ delta += prev_delta_msb; -+ -+ poc = rps->poc[i] + s->poc - delta * max_poc_lsb - s->sh.pic_order_cnt_lsb; -+ if (poc != (int32_t)poc) -+ return AVERROR_INVALIDDATA; -+ rps->poc[i] = poc; -+ prev_delta_msb = delta; -+ } -+ } -+ -+ return 0; -+} -+ -+static void export_stream_params(AVCodecContext *avctx, const HEVCRpiParamSets *ps, -+ const HEVCRpiSPS *sps) -+{ -+ const HEVCRpiVPS *vps = (const HEVCRpiVPS*)ps->vps_list[sps->vps_id]->data; -+ const HEVCRpiWindow *ow = &sps->output_window; -+ unsigned int num = 0, den = 0; -+ -+ avctx->pix_fmt = sps->pix_fmt; -+ avctx->coded_width = sps->width; -+ avctx->coded_height = sps->height; -+ avctx->width = sps->width - ow->left_offset - ow->right_offset; -+ avctx->height = sps->height - ow->top_offset - ow->bottom_offset; -+ avctx->has_b_frames = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics; -+ avctx->profile = sps->ptl.general_ptl.profile_idc; -+ avctx->level = sps->ptl.general_ptl.level_idc; -+ -+ ff_set_sar(avctx, sps->vui.sar); -+ -+ if (sps->vui.video_signal_type_present_flag) -+ avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG -+ : AVCOL_RANGE_MPEG; -+ else -+ avctx->color_range = AVCOL_RANGE_MPEG; -+ -+ if (sps->vui.colour_description_present_flag) { -+ avctx->color_primaries = sps->vui.colour_primaries; -+ avctx->color_trc = sps->vui.transfer_characteristic; -+ avctx->colorspace = sps->vui.matrix_coeffs; -+ } else { -+ avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; -+ avctx->color_trc = AVCOL_TRC_UNSPECIFIED; -+ avctx->colorspace = AVCOL_SPC_UNSPECIFIED; -+ } -+ -+ if (vps->vps_timing_info_present_flag) { -+ num = vps->vps_num_units_in_tick; -+ den = vps->vps_time_scale; -+ } else if (sps->vui.vui_timing_info_present_flag) { -+ num = sps->vui.vui_num_units_in_tick; -+ den = sps->vui.vui_time_scale; -+ } -+ -+ if (num != 0 && den != 0) -+ av_reduce(&avctx->framerate.den, &avctx->framerate.num, -+ num, den, 1 << 30); -+} -+ -+static enum AVPixelFormat get_format(HEVCRpiContext *s, const HEVCRpiSPS *sps) -+{ -+ enum AVPixelFormat pix_fmts[4], *fmt = pix_fmts; -+ -+ // Admit to no h/w formats -+ -+ *fmt++ = sps->pix_fmt; -+ *fmt = AV_PIX_FMT_NONE; -+ -+ return pix_fmts[0] == AV_PIX_FMT_NONE ? AV_PIX_FMT_NONE: ff_thread_get_format(s->avctx, pix_fmts); -+} -+ -+static int is_sps_supported(const HEVCRpiSPS * const sps) -+{ -+ return av_rpi_is_sand_format(sps->pix_fmt) && -+ sps->width <= HEVC_RPI_MAX_WIDTH && -+ sps->height <= HEVC_RPI_MAX_HEIGHT; -+} -+ -+static int set_sps(HEVCRpiContext * const s, const HEVCRpiSPS * const sps, -+ const enum AVPixelFormat pix_fmt) -+{ -+ int ret; -+ -+ pic_arrays_free(s); -+ s->ps.sps = NULL; -+ s->ps.vps = NULL; -+ -+ if (sps == NULL) -+ return 0; -+ -+ if (!is_sps_supported(sps)) -+ return AVERROR_DECODER_NOT_FOUND; -+ -+ ret = pic_arrays_init(s, sps); -+ if (ret < 0) -+ goto fail; -+ -+ export_stream_params(s->avctx, &s->ps, sps); -+ -+ s->avctx->pix_fmt = pix_fmt; -+ -+ ff_hevc_rpi_pred_init(&s->hpc, sps->bit_depth); -+ ff_hevc_rpi_dsp_init (&s->hevcdsp, sps->bit_depth); -+ -+ // * We don't support cross_component_prediction_enabled_flag but as that -+ // must be 0 unless we have 4:4:4 there is no point testing for it as we -+ // only deal with sand which is never 4:4:4 -+ // [support wouldn't be hard] -+ -+ rpi_hevc_qpu_set_fns(s, sps->bit_depth); -+ -+ av_freep(&s->sao_pixel_buffer_h[0]); -+ av_freep(&s->sao_pixel_buffer_v[0]); -+ -+ if (sps->sao_enabled) -+ { -+ const unsigned int c_count = (ctx_cfmt(s) != 0) ? 3 : 1; -+ unsigned int c_idx; -+ size_t vsize[3] = {0}; -+ size_t hsize[3] = {0}; -+ -+ for(c_idx = 0; c_idx < c_count; c_idx++) { -+ int w = sps->width >> ctx_hshift(s, c_idx); -+ int h = sps->height >> ctx_vshift(s, c_idx); -+ // ctb height & width are a min of 8 so this must a multiple of 16 -+ // so no point rounding up! -+ hsize[c_idx] = (w * 2 * sps->ctb_height) << sps->pixel_shift; -+ vsize[c_idx] = (h * 2 * sps->ctb_width) << sps->pixel_shift; -+ } -+ -+ // Allocate as a single lump so we can extend h[1] & v[1] into h[2] & v[2] -+ // when we have plaited chroma -+ s->sao_pixel_buffer_h[0] = av_malloc(hsize[0] + hsize[1] + hsize[2]); -+ s->sao_pixel_buffer_v[0] = av_malloc(vsize[0] + vsize[1] + vsize[2]); -+ s->sao_pixel_buffer_h[1] = s->sao_pixel_buffer_h[0] + hsize[0]; -+ s->sao_pixel_buffer_h[2] = s->sao_pixel_buffer_h[1] + hsize[1]; -+ s->sao_pixel_buffer_v[1] = s->sao_pixel_buffer_v[0] + vsize[0]; -+ s->sao_pixel_buffer_v[2] = s->sao_pixel_buffer_v[1] + vsize[1]; -+ } -+ -+ s->ps.sps = sps; -+ s->ps.vps = (HEVCRpiVPS*) s->ps.vps_list[s->ps.sps->vps_id]->data; -+ -+ return 0; -+ -+fail: -+ pic_arrays_free(s); -+ s->ps.sps = NULL; -+ return ret; -+} -+ -+static inline int qp_offset_valid(const int qp_offset) -+{ -+ return qp_offset >= -12 && qp_offset <= 12; -+} -+ -+static int hls_slice_header(HEVCRpiContext * const s) -+{ -+ GetBitContext * const gb = &s->HEVClc->gb; -+ RpiSliceHeader * const sh = &s->sh; -+ int i, ret; -+ -+ // Coded parameters -+ sh->first_slice_in_pic_flag = get_bits1(gb); -+ if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) { -+ s->seq_decode = (s->seq_decode + 1) & 0xff; -+ s->max_ra = INT_MAX; -+ if (IS_IDR(s)) -+ ff_hevc_rpi_clear_refs(s); -+ } -+ sh->no_output_of_prior_pics_flag = 0; -+ if (IS_IRAP(s)) -+ sh->no_output_of_prior_pics_flag = get_bits1(gb); -+ -+ sh->pps_id = get_ue_golomb_long(gb); -+ if (sh->pps_id >= HEVC_MAX_PPS_COUNT || !s->ps.pps_list[sh->pps_id]) { -+ av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); -+ return AVERROR_INVALIDDATA; -+ } -+ if (!sh->first_slice_in_pic_flag && -+ s->ps.pps != (HEVCRpiPPS*)s->ps.pps_list[sh->pps_id]->data) { -+ av_log(s->avctx, AV_LOG_ERROR, "PPS changed between slices.\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ s->ps.pps = (HEVCRpiPPS*)s->ps.pps_list[sh->pps_id]->data; -+ if (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos == 1) -+ sh->no_output_of_prior_pics_flag = 1; -+ -+ if (s->ps.sps != (HEVCRpiSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data) { -+ const HEVCRpiSPS *sps = (HEVCRpiSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data; -+ const HEVCRpiSPS *last_sps = s->ps.sps; -+ enum AVPixelFormat pix_fmt; -+ -+ if (last_sps && IS_IRAP(s) && s->nal_unit_type != HEVC_NAL_CRA_NUT) { -+ if (sps->width != last_sps->width || sps->height != last_sps->height || -+ sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering != -+ last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering) -+ sh->no_output_of_prior_pics_flag = 0; -+ } -+ ff_hevc_rpi_clear_refs(s); -+ -+ ret = set_sps(s, sps, sps->pix_fmt); -+ if (ret < 0) -+ return ret; -+ -+ pix_fmt = get_format(s, sps); -+ if (pix_fmt < 0) -+ return pix_fmt; -+ -+// ret = set_sps(s, sps, pix_fmt); -+// if (ret < 0) -+// return ret; -+ -+ s->avctx->pix_fmt = pix_fmt; -+ -+ s->seq_decode = (s->seq_decode + 1) & 0xff; -+ s->max_ra = INT_MAX; -+ } -+ -+ sh->dependent_slice_segment_flag = 0; -+ if (!sh->first_slice_in_pic_flag) { -+ int slice_address_length; -+ -+ if (s->ps.pps->dependent_slice_segments_enabled_flag) -+ sh->dependent_slice_segment_flag = get_bits1(gb); -+ -+ slice_address_length = av_ceil_log2(s->ps.sps->ctb_size); -+ sh->slice_segment_addr = get_bitsz(gb, slice_address_length); -+ if (sh->slice_segment_addr >= s->ps.sps->ctb_size) { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "Invalid slice segment address: %u.\n", -+ sh->slice_segment_addr); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ if (!sh->dependent_slice_segment_flag) { -+ sh->slice_addr = sh->slice_segment_addr; -+ s->slice_idx++; -+ } -+ } else { -+ sh->slice_segment_addr = sh->slice_addr = 0; -+ s->slice_idx = 0; -+ s->slice_initialized = 0; -+ } -+ -+ if (!sh->dependent_slice_segment_flag) { -+ s->slice_initialized = 0; -+ -+ for (i = 0; i < s->ps.pps->num_extra_slice_header_bits; i++) -+ skip_bits(gb, 1); // slice_reserved_undetermined_flag[] -+ -+ sh->slice_type = get_ue_golomb_long(gb); -+ if (!(sh->slice_type == HEVC_SLICE_I || -+ sh->slice_type == HEVC_SLICE_P || -+ sh->slice_type == HEVC_SLICE_B)) { -+ av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", -+ sh->slice_type); -+ return AVERROR_INVALIDDATA; -+ } -+ if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { -+ av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ // when flag is not present, picture is inferred to be output -+ sh->pic_output_flag = 1; -+ if (s->ps.pps->output_flag_present_flag) -+ sh->pic_output_flag = get_bits1(gb); -+ -+ if (s->ps.sps->separate_colour_plane_flag) -+ sh->colour_plane_id = get_bits(gb, 2); -+ -+ if (!IS_IDR(s)) { -+ int poc, pos; -+ -+ sh->pic_order_cnt_lsb = get_bits(gb, s->ps.sps->log2_max_poc_lsb); -+ poc = ff_hevc_rpi_compute_poc(s->ps.sps, s->pocTid0, sh->pic_order_cnt_lsb, s->nal_unit_type); -+ if (!sh->first_slice_in_pic_flag && poc != s->poc) { -+ av_log(s->avctx, AV_LOG_WARNING, -+ "Ignoring POC change between slices: %d -> %d\n", s->poc, poc); -+ if (s->avctx->err_recognition & AV_EF_EXPLODE) -+ return AVERROR_INVALIDDATA; -+ poc = s->poc; -+ } -+ s->poc = poc; -+ -+ sh->short_term_ref_pic_set_sps_flag = get_bits1(gb); -+ pos = get_bits_left(gb); -+ if (!sh->short_term_ref_pic_set_sps_flag) { -+ ret = ff_hevc_rpi_decode_short_term_rps(gb, s->avctx, &sh->slice_rps, s->ps.sps, 1); -+ if (ret < 0) -+ return ret; -+ -+ sh->short_term_rps = &sh->slice_rps; -+ } else { -+ int numbits, rps_idx; -+ -+ if (!s->ps.sps->nb_st_rps) { -+ av_log(s->avctx, AV_LOG_ERROR, "No ref lists in the SPS.\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ numbits = av_ceil_log2(s->ps.sps->nb_st_rps); -+ rps_idx = numbits > 0 ? get_bits(gb, numbits) : 0; -+ sh->short_term_rps = &s->ps.sps->st_rps[rps_idx]; -+ } -+ sh->short_term_ref_pic_set_size = pos - get_bits_left(gb); -+ -+ pos = get_bits_left(gb); -+ ret = decode_lt_rps(s, &sh->long_term_rps, gb); -+ if (ret < 0) { -+ av_log(s->avctx, AV_LOG_WARNING, "Invalid long term RPS.\n"); -+ if (s->avctx->err_recognition & AV_EF_EXPLODE) -+ return AVERROR_INVALIDDATA; -+ } -+ sh->long_term_ref_pic_set_size = pos - get_bits_left(gb); -+ -+ if (s->ps.sps->sps_temporal_mvp_enabled_flag) -+ sh->slice_temporal_mvp_enabled_flag = get_bits1(gb); -+ else -+ sh->slice_temporal_mvp_enabled_flag = 0; -+ } else { -+ s->sh.short_term_rps = NULL; -+ s->poc = 0; -+ } -+ -+ /* 8.3.1 */ -+ if (sh->first_slice_in_pic_flag && s->temporal_id == 0 && -+ s->nal_unit_type != HEVC_NAL_TRAIL_N && -+ s->nal_unit_type != HEVC_NAL_TSA_N && -+ s->nal_unit_type != HEVC_NAL_STSA_N && -+ s->nal_unit_type != HEVC_NAL_RADL_N && -+ s->nal_unit_type != HEVC_NAL_RADL_R && -+ s->nal_unit_type != HEVC_NAL_RASL_N && -+ s->nal_unit_type != HEVC_NAL_RASL_R) -+ s->pocTid0 = s->poc; -+ -+ if (s->ps.sps->sao_enabled) { -+ sh->slice_sample_adaptive_offset_flag[0] = get_bits1(gb); -+ if (ctx_cfmt(s) != 0) { -+ sh->slice_sample_adaptive_offset_flag[1] = -+ sh->slice_sample_adaptive_offset_flag[2] = get_bits1(gb); -+ } -+ } else { -+ sh->slice_sample_adaptive_offset_flag[0] = 0; -+ sh->slice_sample_adaptive_offset_flag[1] = 0; -+ sh->slice_sample_adaptive_offset_flag[2] = 0; -+ } -+ -+ sh->nb_refs[L0] = sh->nb_refs[L1] = 0; -+ if (sh->slice_type == HEVC_SLICE_P || sh->slice_type == HEVC_SLICE_B) { -+ int nb_refs; -+ -+ sh->nb_refs[L0] = s->ps.pps->num_ref_idx_l0_default_active; -+ if (sh->slice_type == HEVC_SLICE_B) -+ sh->nb_refs[L1] = s->ps.pps->num_ref_idx_l1_default_active; -+ -+ if (get_bits1(gb)) { // num_ref_idx_active_override_flag -+ sh->nb_refs[L0] = get_ue_golomb_long(gb) + 1; -+ if (sh->slice_type == HEVC_SLICE_B) -+ sh->nb_refs[L1] = get_ue_golomb_long(gb) + 1; -+ } -+ if (sh->nb_refs[L0] > HEVC_MAX_REFS || sh->nb_refs[L1] > HEVC_MAX_REFS) { -+ av_log(s->avctx, AV_LOG_ERROR, "Too many refs: %d/%d.\n", -+ sh->nb_refs[L0], sh->nb_refs[L1]); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ sh->rpl_modification_flag[0] = 0; -+ sh->rpl_modification_flag[1] = 0; -+ nb_refs = ff_hevc_rpi_frame_nb_refs(s); -+ if (!nb_refs) { -+ av_log(s->avctx, AV_LOG_ERROR, "Zero refs for a frame with P or B slices.\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ if (s->ps.pps->lists_modification_present_flag && nb_refs > 1) { -+ sh->rpl_modification_flag[0] = get_bits1(gb); -+ if (sh->rpl_modification_flag[0]) { -+ for (i = 0; i < sh->nb_refs[L0]; i++) -+ sh->list_entry_lx[0][i] = get_bits(gb, av_ceil_log2(nb_refs)); -+ } -+ -+ if (sh->slice_type == HEVC_SLICE_B) { -+ sh->rpl_modification_flag[1] = get_bits1(gb); -+ if (sh->rpl_modification_flag[1] == 1) -+ for (i = 0; i < sh->nb_refs[L1]; i++) -+ sh->list_entry_lx[1][i] = get_bits(gb, av_ceil_log2(nb_refs)); -+ } -+ } -+ -+ if (sh->slice_type == HEVC_SLICE_B) -+ sh->mvd_l1_zero_flag = get_bits1(gb); -+ -+ if (s->ps.pps->cabac_init_present_flag) -+ sh->cabac_init_flag = get_bits1(gb); -+ else -+ sh->cabac_init_flag = 0; -+ -+ sh->collocated_ref_idx = 0; -+ if (sh->slice_temporal_mvp_enabled_flag) { -+ sh->collocated_list = L0; -+ if (sh->slice_type == HEVC_SLICE_B) -+ sh->collocated_list = !get_bits1(gb); -+ -+ if (sh->nb_refs[sh->collocated_list] > 1) { -+ sh->collocated_ref_idx = get_ue_golomb_long(gb); -+ if (sh->collocated_ref_idx >= sh->nb_refs[sh->collocated_list]) { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "Invalid collocated_ref_idx: %d.\n", -+ sh->collocated_ref_idx); -+ return AVERROR_INVALIDDATA; -+ } -+ } -+ } -+ -+ if ((s->ps.pps->weighted_pred_flag && sh->slice_type == HEVC_SLICE_P) || -+ (s->ps.pps->weighted_bipred_flag && sh->slice_type == HEVC_SLICE_B)) -+ { -+ if ((ret = pred_weight_table(s, gb)) != 0) -+ return ret; -+ } -+ else -+ { -+ // Give us unit weights -+ default_pred_weight_table(s); -+ } -+ -+ sh->max_num_merge_cand = 5 - get_ue_golomb_long(gb); -+ if (sh->max_num_merge_cand < 1 || sh->max_num_merge_cand > 5) { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "Invalid number of merging MVP candidates: %d.\n", -+ sh->max_num_merge_cand); -+ return AVERROR_INVALIDDATA; -+ } -+ } -+ -+ sh->slice_qp_delta = get_se_golomb(gb); -+ -+ if (s->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag) { -+ sh->slice_cb_qp_offset = get_se_golomb(gb); -+ sh->slice_cr_qp_offset = get_se_golomb(gb); -+ if (!qp_offset_valid(sh->slice_cb_qp_offset) || -+ !qp_offset_valid(s->ps.pps->cb_qp_offset + sh->slice_cb_qp_offset) || -+ !qp_offset_valid(sh->slice_cr_qp_offset) || -+ !qp_offset_valid(s->ps.pps->cr_qp_offset + sh->slice_cr_qp_offset)) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, "Bad chroma offset (pps:%d/%d; slice=%d/%d\n", -+ sh->slice_cr_qp_offset, sh->slice_cr_qp_offset, -+ s->ps.pps->cb_qp_offset, s->ps.pps->cr_qp_offset); -+ return AVERROR_INVALIDDATA; -+ } -+ } else -+ { -+ sh->slice_cb_qp_offset = 0; -+ sh->slice_cr_qp_offset = 0; -+ } -+ -+ if (s->ps.pps->chroma_qp_offset_list_enabled_flag) -+ sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); -+ else -+ sh->cu_chroma_qp_offset_enabled_flag = 0; -+ -+ if (s->ps.pps->deblocking_filter_control_present_flag) { -+ int deblocking_filter_override_flag = 0; -+ -+ if (s->ps.pps->deblocking_filter_override_enabled_flag) -+ deblocking_filter_override_flag = get_bits1(gb); -+ -+ if (deblocking_filter_override_flag) { -+ sh->disable_deblocking_filter_flag = get_bits1(gb); -+ if (!sh->disable_deblocking_filter_flag) { -+ int beta_offset_div2 = get_se_golomb(gb); -+ int tc_offset_div2 = get_se_golomb(gb) ; -+ if (beta_offset_div2 < -6 || beta_offset_div2 > 6 || -+ tc_offset_div2 < -6 || tc_offset_div2 > 6) { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "Invalid deblock filter offsets: %d, %d\n", -+ beta_offset_div2, tc_offset_div2); -+ return AVERROR_INVALIDDATA; -+ } -+ sh->beta_offset = beta_offset_div2 * 2; -+ sh->tc_offset = tc_offset_div2 * 2; -+ } -+ } else { -+ sh->disable_deblocking_filter_flag = s->ps.pps->disable_dbf; -+ sh->beta_offset = s->ps.pps->beta_offset; -+ sh->tc_offset = s->ps.pps->tc_offset; -+ } -+ } else { -+ sh->disable_deblocking_filter_flag = 0; -+ sh->beta_offset = 0; -+ sh->tc_offset = 0; -+ } -+ -+ if (s->ps.pps->seq_loop_filter_across_slices_enabled_flag && -+ (sh->slice_sample_adaptive_offset_flag[0] || -+ sh->slice_sample_adaptive_offset_flag[1] || -+ !sh->disable_deblocking_filter_flag)) { -+ sh->slice_loop_filter_across_slices_enabled_flag = get_bits1(gb); -+ } else { -+ sh->slice_loop_filter_across_slices_enabled_flag = s->ps.pps->seq_loop_filter_across_slices_enabled_flag; -+ } -+ sh->no_dblk_boundary_flags = -+ (sh->slice_loop_filter_across_slices_enabled_flag ? 0 : -+ BOUNDARY_UPPER_SLICE | BOUNDARY_LEFT_SLICE) | -+ (s->ps.pps->loop_filter_across_tiles_enabled_flag ? 0 : -+ BOUNDARY_UPPER_TILE | BOUNDARY_LEFT_TILE); -+ -+ -+ } else if (!s->slice_initialized) { -+ av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ sh->num_entry_point_offsets = 0; -+ sh->offload_wpp = 0; -+ sh->offload_tiles = 0; -+ -+ if (s->ps.pps->tiles_enabled_flag || s->ps.pps->entropy_coding_sync_enabled_flag) { -+ unsigned num_entry_point_offsets = get_ue_golomb_long(gb); -+ // It would be possible to bound this tighter but this here is simpler -+ if (num_entry_point_offsets > get_bits_left(gb)) { -+ av_log(s->avctx, AV_LOG_ERROR, "num_entry_point_offsets %d is invalid\n", num_entry_point_offsets); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ sh->num_entry_point_offsets = num_entry_point_offsets; -+ if (sh->num_entry_point_offsets > 0) { -+ int offset_len = get_ue_golomb_long(gb) + 1; -+ -+ if (offset_len < 1 || offset_len > 32) { -+ sh->num_entry_point_offsets = 0; -+ av_log(s->avctx, AV_LOG_ERROR, "offset_len %d is invalid\n", offset_len); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ if ((ret = alloc_entry_points(sh, sh->num_entry_point_offsets)) < 0) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate memory\n"); -+ return ret; -+ } -+ -+ for (i = 0; i < sh->num_entry_point_offsets; i++) { -+ uint32_t val_minus1 = get_bits_long(gb, offset_len); -+ if (val_minus1 > (1 << 28)) -+ { -+ // We can declare offsets of > 2^28 bad without loss of generality -+ // Will check actual bounds wrt NAL later, but this keeps -+ // the values within bounds we can deal with easily -+ av_log(s->avctx, AV_LOG_ERROR, "entry_point_offset_minus1 %d invalid\n", val_minus1); -+ return AVERROR_INVALIDDATA; -+ } -+ sh->entry_point_offset[i] = val_minus1 + 1; // +1 to get the size -+ } -+ -+ // Do we want to offload this -+ if (s->threads_type != 0) -+ { -+ sh->offload_tiles = (!s->ps.pps->tile_wpp_inter_disable || sh->slice_type == HEVC_SLICE_I) && -+ s->ps.pps->num_tile_columns > 1; -+ // * We only cope with WPP in a single column -+ // Probably want to deal with that case as tiles rather than WPP anyway -+ // ?? Not actually sure that the main code deals with WPP + multi-col correctly -+ sh->offload_wpp = s->ps.pps->entropy_coding_sync_enabled_flag && -+ s->ps.pps->num_tile_columns == 1; -+ } -+ } -+ } -+ -+ if (s->ps.pps->slice_header_extension_present_flag) { -+ unsigned int length = get_ue_golomb_long(gb); -+ if (length*8LL > get_bits_left(gb)) { -+ av_log(s->avctx, AV_LOG_ERROR, "too many slice_header_extension_data_bytes\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ for (i = 0; i < length; i++) -+ skip_bits(gb, 8); // slice_header_extension_data_byte -+ } -+ -+ // Inferred parameters -+ sh->slice_qp = 26U + s->ps.pps->pic_init_qp_minus26 + sh->slice_qp_delta; -+ if (sh->slice_qp > 51 || -+ sh->slice_qp < -s->ps.sps->qp_bd_offset) { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "The slice_qp %d is outside the valid range " -+ "[%d, 51].\n", -+ sh->slice_qp, -+ -s->ps.sps->qp_bd_offset); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ if (get_bits_left(gb) < 0) { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "Overread slice header by %d bits\n", -get_bits_left(gb)); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ s->slice_initialized = 1; -+ return 0; -+} -+ -+static void hls_sao_param(const HEVCRpiContext *s, HEVCRpiLocalContext * const lc, const int rx, const int ry) -+{ -+ RpiSAOParams * const sao = s->sao + rx + ry * s->ps.sps->ctb_width; -+ int c_idx, i; -+ -+ if (s->sh.slice_sample_adaptive_offset_flag[0] || -+ s->sh.slice_sample_adaptive_offset_flag[1]) { -+ if ((lc->ctb_avail & AVAIL_L) != 0) -+ { -+ const int sao_merge_left_flag = ff_hevc_rpi_sao_merge_flag_decode(lc); -+ if (sao_merge_left_flag) { -+ *sao = sao[-1]; -+ return; -+ } -+ } -+ if ((lc->ctb_avail & AVAIL_U) != 0) -+ { -+ const int sao_merge_up_flag = ff_hevc_rpi_sao_merge_flag_decode(lc); -+ if (sao_merge_up_flag) { -+ *sao = sao[-(int)s->ps.sps->ctb_width]; -+ return; -+ } -+ } -+ } -+ -+ for (c_idx = 0; c_idx < (ctx_cfmt(s) != 0 ? 3 : 1); c_idx++) { -+ const unsigned int log2_sao_offset_scale = c_idx == 0 ? s->ps.pps->log2_sao_offset_scale_luma : -+ s->ps.pps->log2_sao_offset_scale_chroma; -+ int offset_abs[4]; -+ char offset_sign[4] = {0}; -+ -+ if (!s->sh.slice_sample_adaptive_offset_flag[c_idx]) { -+ sao->type_idx[c_idx] = SAO_NOT_APPLIED; -+ continue; -+ } -+ -+ if (c_idx == 2) { -+ sao->type_idx[2] = sao->type_idx[1]; -+ sao->eo_class[2] = sao->eo_class[1]; -+ } else { -+ sao->type_idx[c_idx] = ff_hevc_rpi_sao_type_idx_decode(lc); -+ } -+ -+ // ** Could use BY22 here quite plausibly - this is all bypass stuff -+ // though only per CTB so not very timing critical -+ -+ if (sao->type_idx[c_idx] == SAO_NOT_APPLIED) -+ continue; -+ -+ for (i = 0; i < 4; i++) -+ offset_abs[i] = ff_hevc_rpi_sao_offset_abs_decode(s, lc); -+ -+ if (sao->type_idx[c_idx] == SAO_BAND) { -+ for (i = 0; i < 4; i++) { -+ if (offset_abs[i] != 0) -+ offset_sign[i] = ff_hevc_rpi_sao_offset_sign_decode(lc); -+ } -+ sao->band_position[c_idx] = ff_hevc_rpi_sao_band_position_decode(lc); -+ } else if (c_idx != 2) { -+ sao->eo_class[c_idx] = ff_hevc_rpi_sao_eo_class_decode(lc); -+ } -+ -+ // Inferred parameters -+ sao->offset_val[c_idx][0] = 0; -+ for (i = 0; i < 4; i++) { -+ sao->offset_val[c_idx][i + 1] = offset_abs[i] << log2_sao_offset_scale; -+ if (sao->type_idx[c_idx] == SAO_EDGE) { -+ if (i > 1) -+ sao->offset_val[c_idx][i + 1] = -sao->offset_val[c_idx][i + 1]; -+ } else if (offset_sign[i]) { -+ sao->offset_val[c_idx][i + 1] = -sao->offset_val[c_idx][i + 1]; -+ } -+ } -+ } -+} -+ -+#if 0 -+static int hls_cross_component_pred(HEVCRpiLocalContext * const lc, const int idx) { -+ int log2_res_scale_abs_plus1 = ff_hevc_rpi_log2_res_scale_abs(lc, idx); // 0..4 -+ -+ if (log2_res_scale_abs_plus1 != 0) { -+ int res_scale_sign_flag = ff_hevc_rpi_res_scale_sign_flag(lc, idx); -+ lc->tu.res_scale_val = (1 << (log2_res_scale_abs_plus1 - 1)) * -+ (1 - 2 * res_scale_sign_flag); -+ } else { -+ lc->tu.res_scale_val = 0; -+ } -+ -+ -+ return 0; -+} -+#endif -+ -+static inline HEVCPredCmd * rpi_new_intra_cmd(HEVCRpiJob * const jb) -+{ -+ return jb->intra.cmds + jb->intra.n++; -+} -+ -+#define A0(x, y, U, L, UL, UR, DL) \ -+ [(x)+(y)*16] = (((U) ? AVAIL_U : 0) | ((L) ? AVAIL_L : 0) | ((UL) ? AVAIL_UL : 0) | ((UR) ? AVAIL_UR : 0) | ((DL) ? AVAIL_DL : 0)) -+ -+#define A1(x, y, U, L, UL, UR, DL) \ -+ A0((x) + 0, (y) + 0, (U), (L), (UL), (U), (L) ), A0((x) + 1, (y) + 0, (U), 1, (U), (UR), 0 ),\ -+ A0((x) + 0, (y) + 1, 1, (L), (L), 1, (DL)), A0((x) + 1, (y) + 1, 1, 1, 1, 0, 0 ) -+ -+#define A2(x, y, U, L, UL, UR, DL) \ -+ A1((x) + 0, (y) + 0, (U), (L), (UL), (U), (L) ), A1((x) + 2, (y) + 0, (U), 1, (U), (UR), 0 ),\ -+ A1((x) + 0, (y) + 2, 1, (L), (L), 1, (DL)), A1((x) + 2, (y) + 2, 1, 1, 1, 0, 0 ) -+ -+#define A3(x, y, U, L, UL, UR, DL) \ -+ A2((x) + 0, (y) + 0, (U), (L), (UL), (U), (L) ), A2((x) + 4, (y) + 0, (U), 1, (U), (UR), 0 ),\ -+ A2((x) + 0, (y) + 4, 1, (L), (L), 1, (DL)), A2((x) + 4, (y) + 4, 1, 1, 1, 0, 0 ) -+ -+#define A4(x, y, U, L, UL, UR, DL) \ -+ A3((x) + 0, (y) + 0, (U), (L), (UL), (U), (L) ), A3((x) + 8, (y) + 0, (U), 1, (U), (UR), 0 ),\ -+ A3((x) + 0, (y) + 8, 1, (L), (L), 1, (DL)), A3((x) + 8, (y) + 8, 1, 1, 1, 0, 0 ) -+ -+static const uint8_t tb_flags[16 * 16] = {A4(0, 0, 0, 0, 0, 0, 0)}; -+ -+unsigned int ff_hevc_rpi_tb_avail_flags( -+ const HEVCRpiContext * const s, const HEVCRpiLocalContext * const lc, -+ const unsigned int x, const unsigned int y, const unsigned int w, const unsigned int h) -+{ -+ const unsigned int ctb_mask = ~0U << s->ps.sps->log2_ctb_size; -+ const unsigned int tb_x = x & ~ctb_mask; -+ const unsigned int tb_y = y & ~ctb_mask; -+ const unsigned int ctb_avail = lc->ctb_avail; -+ -+ const uint8_t * const tb_f = tb_flags + (tb_x >> 2) + (tb_y >> 2) * 16; -+ -+ unsigned int f = (ctb_avail | tb_f[0]) & (AVAIL_L | AVAIL_U | AVAIL_UL); -+ -+ // This deals with both the U & L edges -+ if ((tb_x | tb_y) != 0 && (~f & (AVAIL_L | AVAIL_U)) == 0) -+ f |= AVAIL_UL; -+ -+ if (x + w < lc->end_of_ctb_x) -+ f |= (tb_y == 0 ? ctb_avail >> (AVAIL_S_U - AVAIL_S_UR) : tb_f[(w - 1) >> 2]) & AVAIL_UR; -+ else if (tb_y == 0) -+ f |= (ctb_avail & AVAIL_UR); -+#if AVAIL_S_U - AVAIL_S_UR < 0 -+#error Shift problem -+#endif -+ -+ // Never any D if Y beyond eoctb -+ if (y + h < lc->end_of_ctb_y) -+ f |= (tb_x == 0 ? ctb_avail << (AVAIL_S_DL - AVAIL_S_L) : tb_f[((h - 1) >> 2) * 16]) & AVAIL_DL; -+#if AVAIL_S_DL - AVAIL_S_L < 0 -+#error Shift problem -+#endif -+ -+// printf("(%#x, %#x): %dx%d ca=%02x, ful=%02x, ftr=%02x, fdl=%02x, eox=%#x, eoy=%#x\n", x, y, w, h, -+// lc->ctb_avail, tb_f[0], tb_f[(w - 1) >> 2], tb_f[((h - 1) >> 2) * 16], -+// lc->end_of_ctb_x, lc->end_of_ctb_y); -+ -+ return f; -+} -+ -+#undef A0 -+#undef A1 -+#undef A2 -+#undef A3 -+#undef A4 -+ -+static void do_intra_pred(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, int log2_trafo_size, int x0, int y0, int c_idx, -+ unsigned int avail) -+{ -+ // If rpi_enabled then sand - U & V done on U call -+ if (c_idx <= 1) -+ { -+ HEVCPredCmd *const cmd = rpi_new_intra_cmd(lc->jb0); -+ cmd->type = RPI_PRED_INTRA + c_idx; -+ cmd->size = log2_trafo_size; -+ cmd->avail = avail; -+ cmd->i_pred.x = x0; -+ cmd->i_pred.y = y0; -+ cmd->i_pred.mode = c_idx ? lc->tu.intra_pred_mode_c : lc->tu.intra_pred_mode; -+ -+// printf("(%#x, %#x) c_idx=%d, s=%d, a=%#x\n", x0, y0, c_idx, 1 << log2_trafo_size, avail); -+ } -+} -+ -+#define CBF_CB0_S 0 -+#define CBF_CB1_S 1 // CB1 must be CB0 + 1 -+#define CBF_CR0_S 2 -+#define CBF_CR1_S 3 -+ -+#define CBF_CB0 (1 << CBF_CB0_S) -+#define CBF_CR0 (1 << CBF_CR0_S) -+#define CBF_CB1 (1 << CBF_CB1_S) -+#define CBF_CR1 (1 << CBF_CR1_S) -+ -+// * Only good for chroma_idx == 1 -+static int hls_transform_unit(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int log2_cb_size, const unsigned int log2_trafo_size, -+ const unsigned int blk_idx, const int cbf_luma, -+ const unsigned int cbf_chroma) -+{ -+ const unsigned int log2_trafo_size_c = FFMAX(2, log2_trafo_size - 1); -+ const unsigned int x0_c = x0 & ~7; -+ const unsigned int y0_c = y0 & ~7; -+ -+ enum ScanType scan_idx = SCAN_DIAG; -+ enum ScanType scan_idx_c = SCAN_DIAG; -+ -+ if (lc->cu.pred_mode == MODE_INTRA) -+ { -+ const unsigned int trafo_size = 1 << log2_trafo_size; -+ const unsigned int avail = ff_hevc_rpi_tb_avail_flags(s, lc, x0, y0, trafo_size, trafo_size); -+ -+ do_intra_pred(s, lc, log2_trafo_size, x0, y0, 0, avail); -+ -+ if (log2_trafo_size > 2) -+ do_intra_pred(s, lc, log2_trafo_size_c, x0_c, y0_c, 1, avail); -+ else if (blk_idx == 3) -+ do_intra_pred(s, lc, log2_trafo_size_c, x0_c, y0_c, 1, -+ ff_hevc_rpi_tb_avail_flags(s, lc, x0_c, y0_c, 8, 8)); -+ -+ if (log2_trafo_size < 4) { -+ if (lc->tu.intra_pred_mode >= 6 && -+ lc->tu.intra_pred_mode <= 14) { -+ scan_idx = SCAN_VERT; -+ } else if (lc->tu.intra_pred_mode >= 22 && -+ lc->tu.intra_pred_mode <= 30) { -+ scan_idx = SCAN_HORIZ; -+ } -+ -+ if (lc->tu.intra_pred_mode_c >= 6 && -+ lc->tu.intra_pred_mode_c <= 14) { -+ scan_idx_c = SCAN_VERT; -+ } else if (lc->tu.intra_pred_mode_c >= 22 && -+ lc->tu.intra_pred_mode_c <= 30) { -+ scan_idx_c = SCAN_HORIZ; -+ } -+ } -+ } -+ -+ if (!cbf_luma && cbf_chroma == 0) -+ return 0; -+ -+ if (lc->tu.is_cu_qp_delta_wanted) -+ { -+ const int qp_delta = ff_hevc_rpi_cu_qp_delta(lc); -+ const unsigned int cb_mask = ~0U << log2_cb_size; -+ -+ if (qp_delta < -(26 + (s->ps.sps->qp_bd_offset >> 1)) || -+ qp_delta > (25 + (s->ps.sps->qp_bd_offset >> 1))) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "The cu_qp_delta %d is outside the valid range " -+ "[%d, %d].\n", -+ qp_delta, -+ -(26 + (s->ps.sps->qp_bd_offset >> 1)), -+ (25 + (s->ps.sps->qp_bd_offset >> 1))); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ lc->tu.is_cu_qp_delta_wanted = 0; -+ lc->tu.cu_qp_delta = qp_delta; -+ ff_hevc_rpi_set_qPy(s, lc, x0 & cb_mask, y0 & cb_mask); -+ } -+ -+ // * Not main profile & untested due to no conform streams -+ if (lc->tu.cu_chroma_qp_offset_wanted && cbf_chroma && -+ !lc->cu.cu_transquant_bypass_flag) { -+ int cu_chroma_qp_offset_flag = ff_hevc_rpi_cu_chroma_qp_offset_flag(lc); -+ if (cu_chroma_qp_offset_flag) { -+ int cu_chroma_qp_offset_idx = 0; -+ if (s->ps.pps->chroma_qp_offset_list_len_minus1 > 0) { -+ cu_chroma_qp_offset_idx = ff_hevc_rpi_cu_chroma_qp_offset_idx(s, lc); -+ } -+ lc->tu.qp_divmod6[1] += s->ps.pps->cb_qp_offset_list[cu_chroma_qp_offset_idx]; -+ lc->tu.qp_divmod6[2] += s->ps.pps->cr_qp_offset_list[cu_chroma_qp_offset_idx]; -+ } -+ lc->tu.cu_chroma_qp_offset_wanted = 0; -+ } -+ -+ if (cbf_luma) -+ ff_hevc_rpi_hls_residual_coding(s, lc, x0, y0, log2_trafo_size, scan_idx, 0); -+ -+ if (log2_trafo_size > 2 || blk_idx == 3) -+ { -+ if ((cbf_chroma & CBF_CB0) != 0) -+ ff_hevc_rpi_hls_residual_coding(s, lc, x0_c, y0_c, -+ log2_trafo_size_c, scan_idx_c, 1); -+ if ((cbf_chroma & CBF_CR0) != 0) -+ ff_hevc_rpi_hls_residual_coding(s, lc, x0_c, y0_c, -+ log2_trafo_size_c, scan_idx_c, 2); -+ } -+ -+ return 0; -+} -+ -+static inline void set_deblocking_bypass(const HEVCRpiContext * const s, const int x0, const int y0, const int log2_cb_size) -+{ -+ set_bits(s->is_pcm + (y0 >> 3) * s->ps.sps->pcm_width, x0 >> 3, s->ps.sps->pcm_width, log2_cb_size - 3); -+} -+ -+ -+static int hls_transform_tree(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int log2_trafo_size, -+ const unsigned int trafo_depth, const unsigned int blk_idx, -+ const unsigned int cbf_c0) -+{ -+ // When trafo_size == 2 hls_transform_unit uses c0 so put in c1 -+ unsigned int cbf_c1 = cbf_c0; -+ int split_transform_flag; -+ int ret; -+ -+ if (lc->cu.intra_split_flag) { -+ if (trafo_depth == 1) { -+ lc->tu.intra_pred_mode = lc->pu.intra_pred_mode[blk_idx]; -+ if (ctx_cfmt(s) == 3) { -+ lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[blk_idx]; -+ lc->tu.chroma_mode_c = lc->pu.chroma_mode_c[blk_idx]; -+ } else { -+ lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[0]; -+ lc->tu.chroma_mode_c = lc->pu.chroma_mode_c[0]; -+ } -+ } -+ } else { -+ lc->tu.intra_pred_mode = lc->pu.intra_pred_mode[0]; -+ lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[0]; -+ lc->tu.chroma_mode_c = lc->pu.chroma_mode_c[0]; -+ } -+ -+ if (log2_trafo_size <= s->ps.sps->log2_max_trafo_size && -+ log2_trafo_size > s->ps.sps->log2_min_tb_size && -+ trafo_depth < lc->cu.max_trafo_depth && -+ !(lc->cu.intra_split_flag && trafo_depth == 0)) -+ { -+ split_transform_flag = ff_hevc_rpi_split_transform_flag_decode(lc, log2_trafo_size); -+ } else { -+ int inter_split = s->ps.sps->max_transform_hierarchy_depth_inter == 0 && -+ lc->cu.pred_mode == MODE_INTER && -+ lc->cu.part_mode != PART_2Nx2N && -+ trafo_depth == 0; -+ -+ split_transform_flag = log2_trafo_size > s->ps.sps->log2_max_trafo_size || -+ (lc->cu.intra_split_flag && trafo_depth == 0) || -+ inter_split; -+ } -+ -+ if (log2_trafo_size > 2 || ctx_cfmt(s) == 3) -+ { -+ const int wants_c1 = ctx_cfmt(s) == 2 && (!split_transform_flag || log2_trafo_size == 3); -+ cbf_c1 = 0; -+ -+ if ((cbf_c0 & CBF_CB0) != 0) -+ { -+ cbf_c1 = ff_hevc_rpi_cbf_cb_cr_decode(lc, trafo_depth) << CBF_CB0_S; -+ if (wants_c1) -+ cbf_c1 |= ff_hevc_rpi_cbf_cb_cr_decode(lc, trafo_depth) << CBF_CB1_S; -+ } -+ -+ if ((cbf_c0 & CBF_CR0) != 0) -+ { -+ cbf_c1 |= ff_hevc_rpi_cbf_cb_cr_decode(lc, trafo_depth) << CBF_CR0_S; -+ if (wants_c1) -+ cbf_c1 |= ff_hevc_rpi_cbf_cb_cr_decode(lc, trafo_depth) << CBF_CR1_S; -+ } -+ } -+ -+ if (split_transform_flag) { -+ const int trafo_size_split = 1 << (log2_trafo_size - 1); -+ const int x1 = x0 + trafo_size_split; -+ const int y1 = y0 + trafo_size_split; -+ -+#define SUBDIVIDE(x, y, idx) \ -+do { \ -+ ret = hls_transform_tree(s, lc, x, y, \ -+ log2_trafo_size - 1, trafo_depth + 1, idx, \ -+ cbf_c1); \ -+ if (ret < 0) \ -+ return ret; \ -+} while (0) -+ -+ SUBDIVIDE(x0, y0, 0); -+ SUBDIVIDE(x1, y0, 1); -+ SUBDIVIDE(x0, y1, 2); -+ SUBDIVIDE(x1, y1, 3); -+ -+#undef SUBDIVIDE -+ } else { -+ // If trafo_size == 2 then we should have cbf_c == 0 here but as we can't have -+ // trafo_size == 2 with depth == 0 the issue is moot -+ const int cbf_luma = ((lc->cu.pred_mode != MODE_INTRA && trafo_depth == 0 && cbf_c1 == 0) || -+ ff_hevc_rpi_cbf_luma_decode(lc, trafo_depth)); -+ -+ ret = hls_transform_unit(s, lc, x0, y0, -+ log2_trafo_size + trafo_depth, log2_trafo_size, -+ blk_idx, cbf_luma, cbf_c1); -+ if (ret < 0) -+ return ret; -+ -+ if (!s->sh.disable_deblocking_filter_flag) { -+ ff_hevc_rpi_deblocking_boundary_strengths(s, lc, x0, y0, log2_trafo_size, cbf_luma); -+ } -+ } -+ return 0; -+} -+ -+ -+static int pcm_extract(const HEVCRpiContext * const s, const uint8_t * pcm, const int length, const int x0, const int y0, const int cb_size) -+{ -+ GetBitContext gb; -+ int ret; -+ -+ ret = init_get_bits(&gb, pcm, length); -+ if (ret < 0) -+ return ret; -+ -+ s->hevcdsp.put_pcm(av_rpi_sand_frame_pos_y(s->frame, x0, y0), -+ frame_stride1(s->frame, 0), -+ cb_size, cb_size, &gb, s->ps.sps->pcm.bit_depth); -+ -+ s->hevcdsp.put_pcm_c(av_rpi_sand_frame_pos_c(s->frame, x0 >> ctx_hshift(s, 1), y0 >> ctx_vshift(s, 1)), -+ s->frame->linesize[1], -+ cb_size >> ctx_hshift(s, 1), -+ cb_size >> ctx_vshift(s, 1), -+ &gb, s->ps.sps->pcm.bit_depth_chroma); -+ -+ return 0; -+} -+ -+ -+// x * 2^(y*2) -+static inline unsigned int xyexp2(const unsigned int x, const unsigned int y) -+{ -+ return x << (y * 2); -+} -+ -+static int hls_pcm_sample(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const int x0, const int y0, unsigned int log2_cb_size) -+{ -+ // Length in bits -+ const unsigned int length = xyexp2(s->ps.sps->pcm.bit_depth, log2_cb_size) + -+ xyexp2(s->ps.sps->pcm.bit_depth_chroma, log2_cb_size - ctx_vshift(s, 1)) + -+ xyexp2(s->ps.sps->pcm.bit_depth_chroma, log2_cb_size - ctx_vshift(s, 2)); -+ -+ const uint8_t * const pcm = ff_hevc_rpi_cabac_skip_bytes(&lc->cc, (length + 7) >> 3); -+ -+ if (!s->sh.disable_deblocking_filter_flag) -+ ff_hevc_rpi_deblocking_boundary_strengths(s, lc, x0, y0, log2_cb_size, 0); -+ -+ // Copy coeffs -+ { -+ const int blen = (length + 7) >> 3; -+ // Round allocated bytes up to nearest 32 to avoid alignment confusion -+ // Allocation is in int16_t s -+ // As we are only using 1 byte per sample and the coeff buffer allows 2 per -+ // sample this rounding doesn't affect the total size we need to allocate for -+ // the coeff buffer -+ int16_t * const coeffs = rpi_alloc_coeff_buf(lc->jb0, 0, ((blen + 31) & ~31) >> 1); -+ memcpy(coeffs, pcm, blen); -+ -+ // Our coeff stash assumes that any partially allocated 64byte lump -+ // is zeroed so make that true. -+ { -+ uint8_t * const eopcm = (uint8_t *)coeffs + blen; -+ if ((-(intptr_t)eopcm & 63) != 0) -+ memset(eopcm, 0, -(intptr_t)eopcm & 63); -+ } -+ -+ // Add command -+ { -+ HEVCPredCmd *const cmd = rpi_new_intra_cmd(lc->jb0); -+ cmd->type = RPI_PRED_I_PCM; -+ cmd->size = log2_cb_size; -+ cmd->i_pcm.src = coeffs; -+ cmd->i_pcm.x = x0; -+ cmd->i_pcm.y = y0; -+ cmd->i_pcm.src_len = length; -+ } -+ return 0; -+ } -+} -+ -+ -+static void hevc_await_progress(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const HEVCRpiFrame * const ref, -+ const MvXY xy, const int y0, const int height) -+{ -+ if (s->threads_type != 0) { -+ const int y = FFMAX(0, (MV_Y(xy) >> 2) + y0 + height + 9); -+ -+ // Progress has to be attached to current job as the actual wait -+ // is in worker_core which can't use lc -+ int16_t *const pr = lc->jb0->progress_req + ref->dpb_no; -+ if (*pr < y) { -+ *pr = y; -+ } -+ } -+} -+ -+static void hevc_luma_mv_mvp_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const int x0, const int y0, const int nPbW, -+ const int nPbH, -+ HEVCRpiMvField * const mv) -+{ -+ enum InterPredIdc inter_pred_idc = PRED_L0; -+ int mvp_flag; -+ const unsigned int avail = ff_hevc_rpi_tb_avail_flags(s, lc, x0, y0, nPbW, nPbH); -+ -+ mv->pred_flag = 0; -+ if (s->sh.slice_type == HEVC_SLICE_B) -+ inter_pred_idc = ff_hevc_rpi_inter_pred_idc_decode(lc, nPbW, nPbH); -+ -+ if (inter_pred_idc != PRED_L1) { -+ MvXY mvd; -+ -+ if (s->sh.nb_refs[L0]) -+ mv->ref_idx[0]= ff_hevc_rpi_ref_idx_lx_decode(lc, s->sh.nb_refs[L0]); -+ -+ mv->pred_flag = PF_L0; -+ mvd = ff_hevc_rpi_hls_mvd_coding(lc); -+ mvp_flag = ff_hevc_rpi_mvp_lx_flag_decode(lc); -+ ff_hevc_rpi_luma_mv_mvp_mode(s, lc, x0, y0, nPbW, nPbH, avail, -+ mv, mvp_flag, 0); -+ mv->xy[0] = mvxy_add(mv->xy[0], mvd); -+ } -+ -+ if (inter_pred_idc != PRED_L0) { -+ MvXY mvd = 0; -+ -+ if (s->sh.nb_refs[L1]) -+ mv->ref_idx[1] = ff_hevc_rpi_ref_idx_lx_decode(lc, s->sh.nb_refs[L1]); -+ -+ if (s->sh.mvd_l1_zero_flag != 1 || inter_pred_idc != PRED_BI) -+ mvd = ff_hevc_rpi_hls_mvd_coding(lc); -+ -+ mv->pred_flag += PF_L1; -+ mvp_flag = ff_hevc_rpi_mvp_lx_flag_decode(lc); -+ ff_hevc_rpi_luma_mv_mvp_mode(s, lc, x0, y0, nPbW, nPbH, avail, -+ mv, mvp_flag, 1); -+ mv->xy[1] = mvxy_add(mv->xy[1], mvd); -+ } -+} -+ -+ -+static HEVCRpiInterPredQ * -+rpi_nxt_pred(HEVCRpiInterPredEnv * const ipe, const unsigned int load_val, const uint32_t fn) -+{ -+ HEVCRpiInterPredQ * yp = NULL; -+ HEVCRpiInterPredQ * ypt = ipe->q + ipe->curr; -+ const unsigned int max_fill = ipe->max_fill; -+ unsigned int load = UINT_MAX; -+ -+ for (unsigned int i = 0; i != ipe->n_grp; ++i, ++ypt) { -+ // We will always have enough room between the Qs but if we are -+ // running critically low due to poor scheduling then use fill size -+ // rather than load to determine QPU. This has obvious dire -+ // performance implications but (a) it is better than crashing -+ // and (b) it should (almost) never happen -+ const unsigned int tfill = (char *)ypt->qpu_mc_curr - (char *)ypt->qpu_mc_base; -+ const unsigned int tload = tfill > max_fill ? tfill + 0x1000000 : ypt->load; -+ -+ if (tload < load) -+ { -+ yp = ypt; -+ load = tload; -+ } -+ } -+ -+ yp->load += load_val; -+ ipe->used_grp = 1; -+ qpu_mc_link_set(yp->qpu_mc_curr, fn); -+ -+ return yp; -+} -+ -+ -+static void rpi_inter_pred_sync(HEVCRpiInterPredEnv * const ipe) -+{ -+ for (unsigned int i = 0; i != ipe->n; ++i) { -+ HEVCRpiInterPredQ * const q = ipe->q + i; -+ const unsigned int qfill = (char *)q->qpu_mc_curr - (char *)q->qpu_mc_base; -+ -+ qpu_mc_link_set(q->qpu_mc_curr, q->code_sync); -+ q->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(&q->qpu_mc_curr->sync + 1); -+ q->load = (qfill >> 7); // Have a mild preference for emptier Qs to balance memory usage -+ } -+} -+ -+// Returns 0 on success -+// We no longer check for Q fullness as wew have emergncy code in ctu alloc -+// * However it might be an idea to have some means of spotting that we've used it -+static int rpi_inter_pred_next_ctu(HEVCRpiInterPredEnv * const ipe) -+{ -+ if (!ipe->used_grp) -+ return 0; -+ -+ if ((ipe->curr += ipe->n_grp) >= ipe->n) -+ { -+ ipe->curr = 0; -+ rpi_inter_pred_sync(ipe); -+ } -+ ipe->used = 1; -+ ipe->used_grp = 0; -+ -+ return 0; -+} -+ -+static void rpi_inter_pred_reset(HEVCRpiInterPredEnv * const ipe) -+{ -+ unsigned int i; -+ -+ ipe->curr = 0; -+ ipe->used = 0; -+ ipe->used_grp = 0; -+ for (i = 0; i != ipe->n; ++i) { -+ HEVCRpiInterPredQ * const q = ipe->q + i; -+ q->qpu_mc_curr = q->qpu_mc_base; -+ q->load = 0; -+ q->last_l0 = NULL; -+ q->last_l1 = NULL; -+ } -+} -+ -+static int rpi_inter_pred_alloc(HEVCRpiInterPredEnv * const ipe, -+ const unsigned int n_max, const unsigned int n_grp, -+ const unsigned int total_size, const unsigned int min_gap) -+{ -+ int rv; -+ -+ memset(ipe, 0, sizeof(*ipe)); -+ if ((ipe->q = av_mallocz(n_max * sizeof(*ipe->q))) == NULL) -+ return AVERROR(ENOMEM); -+ -+ ipe->n_grp = n_grp; -+ ipe->min_gap = min_gap; -+ -+ if ((rv = gpu_malloc_cached(total_size, &ipe->gptr)) != 0) -+ av_freep(&ipe->q); -+ return rv; -+} -+ -+ -+#if RPI_QPU_EMU_Y -+#define get_mc_address_y(f) ((f)->data[0]) -+#else -+#define get_mc_address_y(f) get_vc_address_y(f) -+#endif -+#if RPI_QPU_EMU_C -+#define get_mc_address_u(f) ((f)->data[1]) -+#else -+#define get_mc_address_u(f) get_vc_address_u(f) -+#endif -+ -+static inline uint32_t pack_wo_p(const int off, const int mul) -+{ -+ return PACK2(off * 2 + 1, mul); -+} -+ -+static inline uint32_t pack_wo_b(const int off0, const int off1, const int mul) -+{ -+ return PACK2(off0 + off1 + 1, mul); -+} -+ -+ -+static void -+rpi_pred_y(const HEVCRpiContext *const s, HEVCRpiJob * const jb, -+ const int x0, const int y0, -+ const int nPbW, const int nPbH, -+ const MvXY mv_xy, -+ const int weight_mul, -+ const int weight_offset, -+ AVFrame *const src_frame) -+{ -+ const unsigned int y_off = av_rpi_sand_frame_off_y(s->frame, x0, y0); -+ const unsigned int mx = MV_X(mv_xy) & 3; -+ const unsigned int my = MV_Y(mv_xy) & 3; -+ const unsigned int my_mx = (my << 8) | mx; -+ const uint32_t my2_mx2_my_mx = (my_mx << 16) | my_mx; -+ const qpu_mc_src_addr_t src_vc_address_y = get_mc_address_y(src_frame); -+ qpu_mc_dst_addr_t dst_addr = get_mc_address_y(s->frame) + y_off; -+ const uint32_t wo = pack_wo_p(weight_offset, weight_mul); -+ HEVCRpiInterPredEnv * const ipe = &jb->luma_ip; -+ const unsigned int xshl = av_rpi_sand_frame_xshl(s->frame); -+ -+ if (my_mx == 0) -+ { -+ const int x1 = x0 + (MV_X(mv_xy) >> 2); -+ const int y1 = y0 + (MV_Y(mv_xy) >> 2); -+ const int bh = nPbH; -+ -+ for (int start_x = 0; start_x < nPbW; start_x += 16) -+ { -+ const int bw = FFMIN(nPbW - start_x, 16); -+ HEVCRpiInterPredQ *const yp = rpi_nxt_pred(ipe, bh, s->qpu.y_p00); -+ qpu_mc_src_t *const src1 = yp->last_l0; -+ qpu_mc_pred_y_p00_t *const cmd_y = &yp->qpu_mc_curr->y.p00; -+ -+#if RPI_TSTATS -+ { -+ HEVCRpiStats *const ts = (HEVCRpiStats *)&s->tstats; -+ ++ts->y_pred1_x0y0; -+ -+ if (nPbW > 8) -+ ++ts->y_pred1_wgt8; -+ else -+ ++ts->y_pred1_wle8; -+ -+ if (nPbH > 16) -+ ++ts->y_pred1_hgt16; -+ else -+ ++ts->y_pred1_hle16; -+ } -+#endif -+ -+ src1->x = x1 + start_x; -+ src1->y = y1; -+ src1->base = src_vc_address_y; -+ cmd_y->w = bw; -+ cmd_y->h = bh; -+ cmd_y->wo1 = wo; -+ cmd_y->dst_addr = dst_addr + (start_x << xshl); -+ yp->last_l0 = &cmd_y->next_src1; -+ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_y + 1); -+ } -+ } -+ else -+ { -+ const int x1_m3 = x0 + (MV_X(mv_xy) >> 2) - 3; -+ const int y1_m3 = y0 + (MV_Y(mv_xy) >> 2) - 3; -+ const unsigned int bh = nPbH; -+ int start_x = 0; -+ -+#if 1 -+ // As Y-pred operates on two independant 8-wide src blocks we can merge -+ // this pred with the previous one if it the previous one is 8 pel wide, -+ // the same height as the current block, immediately to the left of our -+ // current dest block and mono-pred. -+ -+ qpu_mc_pred_y_p_t *const last_y8_p = jb->last_y8_p; -+ if (last_y8_p != NULL && last_y8_p->h == bh && last_y8_p->dst_addr + (8 << xshl) == dst_addr) -+ { -+ const int bw = FFMIN(nPbW, 8); -+ qpu_mc_src_t *const last_y8_src2 = jb->last_y8_l1; -+ -+ last_y8_src2->x = x1_m3; -+ last_y8_src2->y = y1_m3; -+ last_y8_src2->base = src_vc_address_y; -+ last_y8_p->w += bw; -+ last_y8_p->mymx21 = PACK2(my2_mx2_my_mx, last_y8_p->mymx21); -+ last_y8_p->wo2 = wo; -+ -+ jb->last_y8_p = NULL; -+ jb->last_y8_l1 = NULL; -+ start_x = bw; -+#if RPI_TSTATS -+ ++((HEVCRpiStats *)&s->tstats)->y_pred1_y8_merge; -+#endif -+ } -+#endif -+ -+ for (; start_x < nPbW; start_x += 16) -+ { -+ const int bw = FFMIN(nPbW - start_x, 16); -+ HEVCRpiInterPredQ *const yp = rpi_nxt_pred(ipe, bh + 7, s->qpu.y_pxx); -+ qpu_mc_src_t *const src1 = yp->last_l0; -+ qpu_mc_src_t *const src2 = yp->last_l1; -+ qpu_mc_pred_y_p_t *const cmd_y = &yp->qpu_mc_curr->y.p; -+#if RPI_TSTATS -+ { -+ HEVCRpiStats *const ts = (HEVCRpiStats *)&s->tstats; -+ if (mx == 0 && my == 0) -+ ++ts->y_pred1_x0y0; -+ else if (mx == 0) -+ ++ts->y_pred1_x0; -+ else if (my == 0) -+ ++ts->y_pred1_y0; -+ else -+ ++ts->y_pred1_xy; -+ -+ if (nPbW > 8) -+ ++ts->y_pred1_wgt8; -+ else -+ ++ts->y_pred1_wle8; -+ -+ if (nPbH > 16) -+ ++ts->y_pred1_hgt16; -+ else -+ ++ts->y_pred1_hle16; -+ } -+#endif -+ src1->x = x1_m3 + start_x; -+ src1->y = y1_m3; -+ src1->base = src_vc_address_y; -+ if (bw <= 8) -+ { -+ src2->x = MC_DUMMY_X; -+ src2->y = MC_DUMMY_Y; -+#if RPI_QPU_EMU_Y -+ src2->base = s->qpu_dummy_frame_emu; -+#else -+ src2->base = s->qpu_dummy_frame_qpu; -+#endif -+ } -+ else -+ { -+ src2->x = x1_m3 + start_x + 8; -+ src2->y = y1_m3; -+ src2->base = src_vc_address_y; -+ } -+ cmd_y->w = bw; -+ cmd_y->h = bh; -+ cmd_y->mymx21 = my2_mx2_my_mx; -+ cmd_y->wo1 = wo; -+ cmd_y->wo2 = wo; -+ cmd_y->dst_addr = dst_addr + (start_x << xshl); -+ yp->last_l0 = &cmd_y->next_src1; -+ yp->last_l1 = &cmd_y->next_src2; -+ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_y + 1); -+ -+ if (bw == 8) { -+ jb->last_y8_l1 = src2; -+ jb->last_y8_p = cmd_y; -+ } -+ } -+ } -+} -+ -+static void -+rpi_pred_y_b(const HEVCRpiContext * const s, HEVCRpiJob * const jb, -+ const int x0, const int y0, -+ const int nPbW, const int nPbH, -+ const struct HEVCRpiMvField *const mv_field, -+ const AVFrame *const src_frame, -+ const AVFrame *const src_frame2) -+{ -+ const unsigned int y_off = av_rpi_sand_frame_off_y(s->frame, x0, y0); -+ const MvXY mv = mv_field->xy[0]; -+ const MvXY mv2 = mv_field->xy[1]; -+ -+ const unsigned int mx = MV_X(mv) & 3; -+ const unsigned int my = MV_Y(mv) & 3; -+ const unsigned int my_mx = (my<<8) | mx; -+ const unsigned int mx2 = MV_X(mv2) & 3; -+ const unsigned int my2 = MV_Y(mv2) & 3; -+ const unsigned int my2_mx2 = (my2<<8) | mx2; -+ const uint32_t my2_mx2_my_mx = (my2_mx2 << 16) | my_mx; -+ const unsigned int ref_idx0 = mv_field->ref_idx[0]; -+ const unsigned int ref_idx1 = mv_field->ref_idx[1]; -+ const uint32_t wo1 = pack_wo_b(s->sh.luma_offset_l0[ref_idx0], s->sh.luma_offset_l1[ref_idx1], s->sh.luma_weight_l0[ref_idx0]); -+ const uint32_t wo2 = pack_wo_b(s->sh.luma_offset_l0[ref_idx0], s->sh.luma_offset_l1[ref_idx1], s->sh.luma_weight_l1[ref_idx1]); -+ -+ const unsigned int xshl = av_rpi_sand_frame_xshl(s->frame); -+ qpu_mc_dst_addr_t dst = get_mc_address_y(s->frame) + y_off; -+ const qpu_mc_src_addr_t src1_base = get_mc_address_y(src_frame); -+ const qpu_mc_src_addr_t src2_base = get_mc_address_y(src_frame2); -+ HEVCRpiInterPredEnv * const ipe = &jb->luma_ip; -+ -+ if (my2_mx2_my_mx == 0) -+ { -+ const int x1 = x0 + (MV_X(mv) >> 2); -+ const int y1 = y0 + (MV_Y(mv) >> 2); -+ const int x2 = x0 + (MV_X(mv2) >> 2); -+ const int y2 = y0 + (MV_Y(mv2) >> 2); -+ const int bh = nPbH; -+ -+ // Can do chunks a full 16 wide if we don't want the H filter -+ for (int start_x=0; start_x < nPbW; start_x += 16) -+ { -+ HEVCRpiInterPredQ *const yp = rpi_nxt_pred(ipe, bh, s->qpu.y_b00); -+ qpu_mc_src_t *const src1 = yp->last_l0; -+ qpu_mc_src_t *const src2 = yp->last_l1; -+ qpu_mc_pred_y_p_t *const cmd_y = &yp->qpu_mc_curr->y.p; -+#if RPI_TSTATS -+ { -+ HEVCRpiStats *const ts = (HEVCRpiStats *)&s->tstats; -+ ++ts->y_pred2_x0y0; -+ -+ if (nPbH > 16) -+ ++ts->y_pred2_hgt16; -+ else -+ ++ts->y_pred2_hle16; -+ } -+#endif -+ src1->x = x1 + start_x; -+ src1->y = y1; -+ src1->base = src1_base; -+ src2->x = x2 + start_x; -+ src2->y = y2; -+ src2->base = src2_base; -+ cmd_y->w = FFMIN(nPbW - start_x, 16); -+ cmd_y->h = bh; -+ cmd_y->mymx21 = 0; -+ cmd_y->wo1 = wo1; -+ cmd_y->wo2 = wo2; -+ cmd_y->dst_addr = dst + (start_x << xshl); -+ yp->last_l0 = &cmd_y->next_src1; -+ yp->last_l1 = &cmd_y->next_src2; -+ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_y + 1); -+ } -+ } -+ else -+ { -+ // Filter requires a run-up of 3 -+ const int x1 = x0 + (MV_X(mv) >> 2) - 3; -+ const int y1 = y0 + (MV_Y(mv) >> 2) - 3; -+ const int x2 = x0 + (MV_X(mv2) >> 2) - 3; -+ const int y2 = y0 + (MV_Y(mv2) >> 2) - 3; -+ const int bh = nPbH; -+ -+ for (int start_x=0; start_x < nPbW; start_x += 8) -+ { // B blocks work 8 at a time -+ // B weights aren't doubled as the QPU code does the same -+ // amount of work as it does for P -+ HEVCRpiInterPredQ *const yp = rpi_nxt_pred(ipe, bh + 7, s->qpu.y_bxx); -+ qpu_mc_src_t *const src1 = yp->last_l0; -+ qpu_mc_src_t *const src2 = yp->last_l1; -+ qpu_mc_pred_y_p_t *const cmd_y = &yp->qpu_mc_curr->y.p; -+#if RPI_TSTATS -+ { -+ HEVCRpiStats *const ts = (HEVCRpiStats *)&s->tstats; -+ const unsigned int mmx = mx | mx2; -+ const unsigned int mmy = my | my2; -+ if (mmx == 0 && mmy == 0) -+ ++ts->y_pred2_x0y0; -+ else if (mmx == 0) -+ ++ts->y_pred2_x0; -+ else if (mmy == 0) -+ ++ts->y_pred2_y0; -+ else -+ ++ts->y_pred2_xy; -+ -+ if (nPbH > 16) -+ ++ts->y_pred2_hgt16; -+ else -+ ++ts->y_pred2_hle16; -+ } -+#endif -+ src1->x = x1 + start_x; -+ src1->y = y1; -+ src1->base = src1_base; -+ src2->x = x2 + start_x; -+ src2->y = y2; -+ src2->base = src2_base; -+ cmd_y->w = FFMIN(nPbW - start_x, 8); -+ cmd_y->h = bh; -+ cmd_y->mymx21 = my2_mx2_my_mx; -+ cmd_y->wo1 = wo1; -+ cmd_y->wo2 = wo2; -+ cmd_y->dst_addr = dst + (start_x << xshl); -+ yp->last_l0 = &cmd_y->next_src1; -+ yp->last_l1 = &cmd_y->next_src2; -+ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_y + 1); -+ } -+ } -+} -+ -+// h/v shifts fixed at one as that is all the qasm copes with -+static void -+rpi_pred_c(const HEVCRpiContext * const s, HEVCRpiJob * const jb, -+ const unsigned int lx, const int x0_c, const int y0_c, -+ const int nPbW_c, const int nPbH_c, -+ const MvXY mv, -+ const int16_t * const c_weights, -+ const int16_t * const c_offsets, -+ AVFrame * const src_frame) -+{ -+ const unsigned int c_off = av_rpi_sand_frame_off_c(s->frame, x0_c, y0_c); -+ const int hshift = 1; // = s->ps.sps->hshift[1]; -+ const int vshift = 1; // = s->ps.sps->vshift[1]; -+ -+ const int x1_c = x0_c + (MV_X(mv) >> (2 + hshift)) - 1; -+ const int y1_c = y0_c + (MV_Y(mv) >> (2 + hshift)) - 1; -+ const qpu_mc_src_addr_t src_base_u = get_mc_address_u(src_frame); -+ const uint32_t x_coeffs = rpi_filter_coefs[av_mod_uintp2(MV_X(mv), 2 + hshift) << (1 - hshift)]; -+ const uint32_t y_coeffs = rpi_filter_coefs[av_mod_uintp2(MV_Y(mv), 2 + vshift) << (1 - vshift)]; -+ const uint32_t wo_u = pack_wo_p(c_offsets[0], c_weights[0]); -+ const uint32_t wo_v = pack_wo_p(c_offsets[1], c_weights[1]); -+ qpu_mc_dst_addr_t dst_base_u = get_mc_address_u(s->frame) + c_off; -+ HEVCRpiInterPredEnv * const ipe = &jb->chroma_ip; -+ const unsigned int xshl = av_rpi_sand_frame_xshl(s->frame) + 1; -+ const unsigned int bh = nPbH_c; -+ const uint32_t qfn = lx == 0 ? s->qpu.c_pxx : s->qpu.c_pxx_l1; -+ -+ for(int start_x=0; start_x < nPbW_c; start_x+=RPI_CHROMA_BLOCK_WIDTH) -+ { -+ HEVCRpiInterPredQ * const cp = rpi_nxt_pred(ipe, bh + 3, qfn); -+ qpu_mc_pred_c_p_t * const cmd_c = &cp->qpu_mc_curr->c.p; -+ qpu_mc_src_t ** const plast_lx = (lx == 0) ? &cp->last_l0 : &cp->last_l1; -+ qpu_mc_src_t * const last_lx = *plast_lx; -+ const int bw = FFMIN(nPbW_c-start_x, RPI_CHROMA_BLOCK_WIDTH); -+ -+ last_lx->x = x1_c + start_x; -+ last_lx->y = y1_c; -+ last_lx->base = src_base_u; -+ cmd_c->h = bh; -+ cmd_c->w = bw; -+ cmd_c->coeffs_x = x_coeffs; -+ cmd_c->coeffs_y = y_coeffs; -+ cmd_c->wo_u = wo_u; -+ cmd_c->wo_v = wo_v; -+ cmd_c->dst_addr_c = dst_base_u + (start_x << xshl); -+ *plast_lx = &cmd_c->next_src; -+ cp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_c + 1); -+ } -+ return; -+} -+ -+// h/v shifts fixed at one as that is all the qasm copes with -+static void -+rpi_pred_c_b(const HEVCRpiContext * const s, HEVCRpiJob * const jb, -+ const int x0_c, const int y0_c, -+ const int nPbW_c, const int nPbH_c, -+ const struct HEVCRpiMvField * const mv_field, -+ const int16_t * const c_weights, -+ const int16_t * const c_offsets, -+ const int16_t * const c_weights2, -+ const int16_t * const c_offsets2, -+ AVFrame * const src_frame, -+ AVFrame * const src_frame2) -+{ -+ const unsigned int c_off = av_rpi_sand_frame_off_c(s->frame, x0_c, y0_c); -+ const int hshift = 1; // s->ps.sps->hshift[1]; -+ const int vshift = 1; // s->ps.sps->vshift[1]; -+ const MvXY mv = mv_field->xy[0]; -+ const MvXY mv2 = mv_field->xy[1]; -+ -+ const unsigned int mx = av_mod_uintp2(MV_X(mv), 2 + hshift); -+ const unsigned int my = av_mod_uintp2(MV_Y(mv), 2 + vshift); -+ const uint32_t coefs0_x = rpi_filter_coefs[mx << (1 - hshift)]; -+ const uint32_t coefs0_y = rpi_filter_coefs[my << (1 - vshift)]; // Fractional part of motion vector -+ const int x1_c = x0_c + (MV_X(mv) >> (2 + hshift)) - 1; -+ const int y1_c = y0_c + (MV_Y(mv) >> (2 + hshift)) - 1; -+ -+ const unsigned int mx2 = av_mod_uintp2(MV_X(mv2), 2 + hshift); -+ const unsigned int my2 = av_mod_uintp2(MV_Y(mv2), 2 + vshift); -+ const uint32_t coefs1_x = rpi_filter_coefs[mx2 << (1 - hshift)]; -+ const uint32_t coefs1_y = rpi_filter_coefs[my2 << (1 - vshift)]; // Fractional part of motion vector -+ -+ const int x2_c = x0_c + (MV_X(mv2) >> (2 + hshift)) - 1; -+ const int y2_c = y0_c + (MV_Y(mv2) >> (2 + hshift)) - 1; -+ -+ const uint32_t wo_u2 = pack_wo_b(c_offsets[0], c_offsets2[0], c_weights2[0]); -+ const uint32_t wo_v2 = pack_wo_b(c_offsets[1], c_offsets2[1], c_weights2[1]); -+ -+ const qpu_mc_dst_addr_t dst_base_u = get_mc_address_u(s->frame) + c_off; -+ const qpu_mc_src_addr_t src1_base = get_mc_address_u(src_frame); -+ const qpu_mc_src_addr_t src2_base = get_mc_address_u(src_frame2); -+ HEVCRpiInterPredEnv * const ipe = &jb->chroma_ip; -+ const unsigned int xshl = av_rpi_sand_frame_xshl(s->frame) + 1; -+ const unsigned int bh = nPbH_c; -+ -+ for (int start_x=0; start_x < nPbW_c; start_x += RPI_CHROMA_BLOCK_WIDTH) -+ { -+ const unsigned int bw = FFMIN(nPbW_c-start_x, RPI_CHROMA_BLOCK_WIDTH); -+ -+ HEVCRpiInterPredQ * const cp = rpi_nxt_pred(ipe, bh * 2 + 3, s->qpu.c_bxx); -+ qpu_mc_pred_c_b_t * const u = &cp->qpu_mc_curr->c.b; -+ qpu_mc_src_t * const src_l0 = cp->last_l0; -+ qpu_mc_src_t * const src_l1 = cp->last_l1; -+ -+ src_l0->x = x1_c + start_x; -+ src_l0->y = y1_c; -+ src_l0->base = src1_base; -+ src_l1->x = x2_c + start_x; -+ src_l1->y = y2_c; -+ src_l1->base = src2_base; -+ -+ u[0].h = bh; -+ u[0].w = bw; -+ u[0].coeffs_x1 = coefs0_x; -+ u[0].coeffs_y1 = coefs0_y; -+ u[0].weight_u1 = c_weights[0]; // Weight L0 U -+ u[0].weight_v1 = c_weights[1]; // Weight L0 V -+ u[0].coeffs_x2 = coefs1_x; -+ u[0].coeffs_y2 = coefs1_y; -+ u[0].wo_u2 = wo_u2; -+ u[0].wo_v2 = wo_v2; -+ u[0].dst_addr_c = dst_base_u + (start_x << xshl); -+ -+ cp->last_l0 = &u[0].next_src1; -+ cp->last_l1 = &u[0].next_src2; -+ cp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(u + 1); -+ } -+} -+ -+ -+static inline void -+col_stash(const HEVCRpiContext * const s, -+ const unsigned int x0, const unsigned int y0, const unsigned int w0, const unsigned int h0, -+ const HEVCRpiMvField * const mvf) -+{ -+ ColMvField * const col_mvf = s->ref->col_mvf; -+ const unsigned int x = (x0 + 15) >> 4; -+ const unsigned int y = (y0 + 15) >> 4; -+ const unsigned int w = ((x0 + 15 + w0) >> 4) - x; -+ const unsigned int h = ((y0 + 15 + h0) >> 4) - y; -+ -+ if (col_mvf != NULL && w != 0 && h != 0) -+ { -+ // Only record MV from the top left of the 16x16 block -+ -+ const RefPicList * const rpl = s->refPicList; -+ const ColMvField cmv = { -+ .L = { -+ { -+ .poc = (mvf->pred_flag & PF_L0) == 0 ? -+ COL_POC_INTRA : -+ COL_POC_MAKE_INTER(rpl[0].isLongTerm[mvf->ref_idx[0]], rpl[0].list[mvf->ref_idx[0]]), -+ .xy = mvf->xy[0] -+ }, -+ { -+ .poc = (mvf->pred_flag & PF_L1) == 0 ? -+ COL_POC_INTRA : -+ COL_POC_MAKE_INTER(rpl[1].isLongTerm[mvf->ref_idx[1]], rpl[1].list[mvf->ref_idx[1]]), -+ .xy = mvf->xy[1] -+ } -+ } -+ }; -+ -+ ColMvField * p = col_mvf + y * s->col_mvf_stride + x; -+ const unsigned int stride = s->col_mvf_stride - w; -+ unsigned int j = h; -+ -+ do -+ { -+ unsigned int k = w; -+ do -+ { -+ *p++ = cmv; -+ } while (--k != 0); -+ p += stride; -+ } while (--j != 0); -+ } -+} -+ -+static void hls_prediction_unit(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int nPbW, const unsigned int nPbH, -+ const unsigned int log2_cb_size, const unsigned int partIdx, const unsigned int idx) -+{ -+ HEVCRpiJob * const jb = lc->jb0; -+ -+ struct HEVCRpiMvField current_mv = {{0}}; -+ const RefPicList *const refPicList = s->refPicList; -+ const HEVCRpiFrame *ref0 = NULL, *ref1 = NULL; -+ -+ if (lc->cu.pred_mode != MODE_SKIP) -+ lc->pu.merge_flag = ff_hevc_rpi_merge_flag_decode(lc); -+ -+ if (lc->cu.pred_mode == MODE_SKIP || lc->pu.merge_flag) { -+ const unsigned int merge_idx = s->sh.max_num_merge_cand <= 1 ? 0 : -+ ff_hevc_rpi_merge_idx_decode(s, lc); -+ -+ ff_hevc_rpi_luma_mv_merge_mode(s, lc, x0, y0, nPbW, nPbH, log2_cb_size, -+ partIdx, merge_idx, ¤t_mv); -+ } else { -+ hevc_luma_mv_mvp_mode(s, lc, x0, y0, nPbW, nPbH, ¤t_mv); -+ } -+ -+ { -+ HEVCRpiMvField * p = mvf_stash_ptr(s, lc, x0, y0); -+ unsigned int i, j; -+ -+ for (j = 0; j < nPbH >> LOG2_MIN_PU_SIZE; j++) -+ { -+ for (i = 0; i < nPbW >> LOG2_MIN_PU_SIZE; i++) -+ p[i] = current_mv; -+ p += MVF_STASH_WIDTH_PU; -+ } -+ } -+ -+ col_stash(s, x0, y0, nPbW, nPbH, ¤t_mv); -+ -+ if (current_mv.pred_flag & PF_L0) { -+ ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; -+ if (!ref0) -+ return; -+ hevc_await_progress(s, lc, ref0, current_mv.xy[0], y0, nPbH); -+ } -+ if (current_mv.pred_flag & PF_L1) { -+ ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; -+ if (!ref1) -+ return; -+ hevc_await_progress(s, lc, ref1, current_mv.xy[1], y0, nPbH); -+ } -+ -+ if (current_mv.pred_flag == PF_L0) { -+ const int x0_c = x0 >> ctx_hshift(s, 1); -+ const int y0_c = y0 >> ctx_vshift(s, 1); -+ const int nPbW_c = nPbW >> ctx_hshift(s, 1); -+ const int nPbH_c = nPbH >> ctx_vshift(s, 1); -+ -+ rpi_pred_y(s, jb, x0, y0, nPbW, nPbH, current_mv.xy[0], -+ s->sh.luma_weight_l0[current_mv.ref_idx[0]], s->sh.luma_offset_l0[current_mv.ref_idx[0]], -+ ref0->frame); -+ -+ if (ctx_cfmt(s) != 0) { -+ rpi_pred_c(s, jb, 0, x0_c, y0_c, nPbW_c, nPbH_c, current_mv.xy[0], -+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]], s->sh.chroma_offset_l0[current_mv.ref_idx[0]], -+ ref0->frame); -+ return; -+ } -+ } else if (current_mv.pred_flag == PF_L1) { -+ const int x0_c = x0 >> ctx_hshift(s, 1); -+ const int y0_c = y0 >> ctx_vshift(s, 1); -+ const int nPbW_c = nPbW >> ctx_hshift(s, 1); -+ const int nPbH_c = nPbH >> ctx_vshift(s, 1); -+ -+ rpi_pred_y(s, jb, x0, y0, nPbW, nPbH, current_mv.xy[1], -+ s->sh.luma_weight_l1[current_mv.ref_idx[1]], s->sh.luma_offset_l1[current_mv.ref_idx[1]], -+ ref1->frame); -+ -+ if (ctx_cfmt(s) != 0) { -+ rpi_pred_c(s, jb, 1, x0_c, y0_c, nPbW_c, nPbH_c, current_mv.xy[1], -+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]], s->sh.chroma_offset_l1[current_mv.ref_idx[1]], -+ ref1->frame); -+ return; -+ } -+ } else if (current_mv.pred_flag == PF_BI) { -+ const int x0_c = x0 >> ctx_hshift(s, 1); -+ const int y0_c = y0 >> ctx_vshift(s, 1); -+ const int nPbW_c = nPbW >> ctx_hshift(s, 1); -+ const int nPbH_c = nPbH >> ctx_vshift(s, 1); -+ -+ rpi_pred_y_b(s, jb, x0, y0, nPbW, nPbH, ¤t_mv, ref0->frame, ref1->frame); -+ -+ if (ctx_cfmt(s) != 0) { -+ rpi_pred_c_b(s, jb, x0_c, y0_c, nPbW_c, nPbH_c, -+ ¤t_mv, -+ s->sh.chroma_weight_l0[current_mv.ref_idx[0]], -+ s->sh.chroma_offset_l0[current_mv.ref_idx[0]], -+ s->sh.chroma_weight_l1[current_mv.ref_idx[1]], -+ s->sh.chroma_offset_l1[current_mv.ref_idx[1]], -+ ref0->frame, -+ ref1->frame); -+ return; -+ } -+ } -+} -+ -+static void set_ipm(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int log2_cb_size, -+ const unsigned int ipm) -+{ -+ const unsigned int x_pu = x0 >> LOG2_MIN_PU_SIZE; -+ const unsigned int y_pu = y0 >> LOG2_MIN_PU_SIZE; -+ -+ { -+ const unsigned int ctb_mask = ~(~0U << (s->ps.sps->log2_ctb_size - LOG2_MIN_PU_SIZE)); -+ set_stash2(lc->ipm_left + (y_pu & ctb_mask), lc->ipm_up + (x_pu & ctb_mask), log2_cb_size - LOG2_MIN_PU_SIZE, ipm); -+ } -+ -+ // If IRAP then everything is Intra & we avoid ever looking at these -+ // stashes so don't bother setting them -+ if (!s->is_irap && lc->cu.pred_mode == MODE_INTRA) -+ { -+ if (s->is_intra != NULL) -+ { -+ set_bits(s->is_intra + (y0 >> LOG2_MIN_CU_SIZE) * s->ps.sps->pcm_width, x0 >> LOG2_MIN_CU_SIZE, s->ps.sps->pcm_width, log2_cb_size - LOG2_MIN_CU_SIZE); -+ } -+ -+ { -+ HEVCRpiMvField * p = mvf_stash_ptr(s, lc, x0, y0); -+ const unsigned int size_in_pus = (1 << log2_cb_size) >> LOG2_MIN_PU_SIZE; // min_pu <= log2_cb so >= 1 -+ unsigned int n = size_in_pus; -+ -+ do -+ { -+ memset(p, 0, size_in_pus * sizeof(*p)); -+ p += MVF_STASH_WIDTH_PU; -+ } while (--n != 0); -+ } -+ -+ -+ if (s->ref->col_mvf != NULL && ((x0 | y0) & 0xf) == 0) -+ { -+ // Only record top left stuff -+ // Blocks should always be alinged on size boundries -+ // so cannot have overflow from a small block -+ -+ ColMvField * p = s->ref->col_mvf + (y0 >> 4) * s->col_mvf_stride + (x0 >> 4); -+ const unsigned int size_in_col = log2_cb_size < 4 ? 1 : (1 << (log2_cb_size - 4)); -+ const unsigned int stride = s->col_mvf_stride - size_in_col; -+ unsigned int j = size_in_col; -+ -+ do -+ { -+ unsigned int k = size_in_col; -+ do -+ { -+ p->L[0].poc = COL_POC_INTRA; -+ p->L[0].xy = 0; -+ p->L[1].poc = COL_POC_INTRA; -+ p->L[1].xy = 0; -+ ++p; -+ } while (--k != 0); -+ p += stride; -+ } while (--j != 0); -+ } -+ } -+} -+ -+static inline void intra_prediction_unit_default_value(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int log2_cb_size) -+{ -+ set_ipm(s, lc, x0, y0, log2_cb_size, INTRA_DC); -+} -+ -+ -+/** -+ * 8.4.1 -+ */ -+static int luma_intra_pred_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ int x0, int y0, int log2_pu_size, -+ int prev_intra_luma_pred_flag, -+ const unsigned int idx) -+{ -+ const unsigned int ctb_mask = ~(~0U << s->ps.sps->log2_ctb_size); -+ const unsigned int xb_pu = (x0 & ctb_mask) >> LOG2_MIN_PU_SIZE; -+ const unsigned int yb_pu = (y0 & ctb_mask) >> LOG2_MIN_PU_SIZE; -+ -+ // Up does not cross boundries so as we always scan 1 slice-tile-line in an -+ // lc we can just keep 1 CTB lR stashes -+ // Left is reset to DC @ Start of Line/Tile/Slice in fill_job -+ const unsigned int cand_up = yb_pu == 0 ? INTRA_DC : lc->ipm_up[xb_pu]; -+ const unsigned int cand_left = lc->ipm_left[yb_pu]; -+ -+ unsigned int intra_pred_mode; -+ unsigned int a, b, c; -+ -+ if (cand_left == cand_up) { -+ if (cand_left < 2) { -+ a = INTRA_PLANAR; -+ b = INTRA_DC; -+ c = INTRA_ANGULAR_26; -+ } else { -+ a = cand_left; -+ b = 2 + ((cand_left - 2 - 1 + 32) & 31); -+ c = 2 + ((cand_left - 2 + 1) & 31); -+ } -+ } else { -+ a = cand_left; -+ b = cand_up; -+ c = (cand_left != INTRA_PLANAR && cand_up != INTRA_PLANAR) ? -+ INTRA_PLANAR : -+ (cand_left != INTRA_DC && cand_up != INTRA_DC) ? -+ INTRA_DC : -+ INTRA_ANGULAR_26; -+ } -+ -+ if (prev_intra_luma_pred_flag) { -+ intra_pred_mode = idx == 0 ? a : idx == 1 ? b : c; -+ } else { -+ // Sort lowest 1st -+ if (a > b) -+ FFSWAP(int, a, b); -+ if (a > c) -+ FFSWAP(int, a, c); -+ if (b > c) -+ FFSWAP(int, b, c); -+ -+ intra_pred_mode = idx; -+ if (intra_pred_mode >= a) -+ intra_pred_mode++; -+ if (intra_pred_mode >= b) -+ intra_pred_mode++; -+ if (intra_pred_mode >= c) -+ intra_pred_mode++; -+ } -+ -+ /* write the intra prediction units into the mv array */ -+ set_ipm(s, lc, x0, y0, log2_pu_size, intra_pred_mode); -+ return intra_pred_mode; -+} -+ -+static const uint8_t tab_mode_idx[] = { -+ 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20, -+ 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31}; -+ -+static void intra_prediction_unit(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int log2_cb_size) -+{ -+ static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 }; -+ uint8_t prev_intra_luma_pred_flag[4]; -+ int split = lc->cu.part_mode == PART_NxN; -+ const unsigned int split_size = (1 << (log2_cb_size - 1)); -+ int chroma_mode; -+ const unsigned int n = split ? 4 : 1; -+ unsigned int i; -+ -+ for (i = 0; i != n; i++) -+ prev_intra_luma_pred_flag[i] = ff_hevc_rpi_prev_intra_luma_pred_flag_decode(lc); -+ -+ for (i = 0; i < n; i++) { -+ // depending on mode idx is mpm or luma_pred_mode -+ const unsigned int idx = prev_intra_luma_pred_flag[i] ? -+ ff_hevc_rpi_mpm_idx_decode(lc) : -+ ff_hevc_rpi_rem_intra_luma_pred_mode_decode(lc); -+ -+ lc->pu.intra_pred_mode[i] = -+ luma_intra_pred_mode(s, lc, -+ x0 + ((i & 1) == 0 ? 0 : split_size), -+ y0 + ((i & 2) == 0 ? 0 : split_size), -+ log2_cb_size - split, -+ prev_intra_luma_pred_flag[i], idx); -+ } -+ -+ if (ctx_cfmt(s) == 3) { -+ for (i = 0; i < n; i++) { -+ lc->pu.chroma_mode_c[i] = chroma_mode = ff_hevc_rpi_intra_chroma_pred_mode_decode(lc); -+ if (chroma_mode != 4) { -+ if (lc->pu.intra_pred_mode[i] == intra_chroma_table[chroma_mode]) -+ lc->pu.intra_pred_mode_c[i] = 34; -+ else -+ lc->pu.intra_pred_mode_c[i] = intra_chroma_table[chroma_mode]; -+ } else { -+ lc->pu.intra_pred_mode_c[i] = lc->pu.intra_pred_mode[i]; -+ } -+ } -+ } else if (ctx_cfmt(s) == 2) { -+ int mode_idx; -+ lc->pu.chroma_mode_c[0] = chroma_mode = ff_hevc_rpi_intra_chroma_pred_mode_decode(lc); -+ if (chroma_mode != 4) { -+ if (lc->pu.intra_pred_mode[0] == intra_chroma_table[chroma_mode]) -+ mode_idx = 34; -+ else -+ mode_idx = intra_chroma_table[chroma_mode]; -+ } else { -+ mode_idx = lc->pu.intra_pred_mode[0]; -+ } -+ lc->pu.intra_pred_mode_c[0] = tab_mode_idx[mode_idx]; -+ } else if (ctx_cfmt(s) != 0) { -+ chroma_mode = ff_hevc_rpi_intra_chroma_pred_mode_decode(lc); -+ if (chroma_mode != 4) { -+ if (lc->pu.intra_pred_mode[0] == intra_chroma_table[chroma_mode]) -+ lc->pu.intra_pred_mode_c[0] = 34; -+ else -+ lc->pu.intra_pred_mode_c[0] = intra_chroma_table[chroma_mode]; -+ } else { -+ lc->pu.intra_pred_mode_c[0] = lc->pu.intra_pred_mode[0]; -+ } -+ } -+} -+ -+static int hls_coding_unit(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, const unsigned int log2_cb_size) -+{ -+ const unsigned int cb_size = 1 << log2_cb_size; -+ const unsigned int log2_min_cb_size = s->ps.sps->log2_min_cb_size; -+ const unsigned int min_cb_width = s->ps.sps->min_cb_width; -+ const unsigned int x_cb = x0 >> log2_min_cb_size; -+ const unsigned int y_cb = y0 >> log2_min_cb_size; -+ const unsigned int idx = log2_cb_size - 2; -+ const unsigned int qp_block_mask = (1 << s->ps.pps->log2_min_cu_qp_delta_size) - 1; -+ int skip_flag = 0; -+ -+ lc->cu.x = x0; -+ lc->cu.y = y0; -+ lc->cu.x_split = x0; -+ lc->cu.y_split = y0; -+ -+ lc->cu.pred_mode = MODE_INTRA; -+ lc->cu.part_mode = PART_2Nx2N; -+ lc->cu.intra_split_flag = 0; -+ lc->cu.cu_transquant_bypass_flag = 0; -+ lc->pu.intra_pred_mode[0] = 1; -+ lc->pu.intra_pred_mode[1] = 1; -+ lc->pu.intra_pred_mode[2] = 1; -+ lc->pu.intra_pred_mode[3] = 1; -+ -+ if (s->ps.pps->transquant_bypass_enable_flag) { -+ lc->cu.cu_transquant_bypass_flag = ff_hevc_rpi_cu_transquant_bypass_flag_decode(lc); -+ if (lc->cu.cu_transquant_bypass_flag) -+ set_deblocking_bypass(s, x0, y0, log2_cb_size); -+ } -+ -+ if (s->sh.slice_type != HEVC_SLICE_I) { -+ lc->cu.pred_mode = MODE_INTER; -+ skip_flag = ff_hevc_rpi_skip_flag_decode(s, lc, x0, y0, x_cb, y_cb); -+ } -+ -+ if (skip_flag) { -+ lc->cu.pred_mode = MODE_SKIP; -+ -+ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size, log2_cb_size, 0, idx); -+ intra_prediction_unit_default_value(s, lc, x0, y0, log2_cb_size); -+ -+ if (!s->sh.disable_deblocking_filter_flag) -+ ff_hevc_rpi_deblocking_boundary_strengths(s, lc, x0, y0, log2_cb_size, 0); -+ } else { -+ int pcm_flag = 0; -+ -+ if (s->sh.slice_type != HEVC_SLICE_I) -+ lc->cu.pred_mode = ff_hevc_rpi_pred_mode_decode(lc); -+ if (lc->cu.pred_mode != MODE_INTRA || -+ log2_cb_size == s->ps.sps->log2_min_cb_size) { -+ lc->cu.part_mode = ff_hevc_rpi_part_mode_decode(s, lc, log2_cb_size); -+ lc->cu.intra_split_flag = lc->cu.part_mode == PART_NxN && -+ lc->cu.pred_mode == MODE_INTRA; -+ } -+ -+ if (lc->cu.pred_mode == MODE_INTRA) { -+ if (lc->cu.part_mode == PART_2Nx2N && -+ log2_cb_size <= s->ps.sps->pcm.log2_max_pcm_cb_size && // 0 if not enabled -+ log2_cb_size >= s->ps.sps->pcm.log2_min_pcm_cb_size && -+ ff_hevc_rpi_pcm_flag_decode(lc) != 0) -+ { -+ int ret; -+ pcm_flag = 1; -+ intra_prediction_unit_default_value(s, lc, x0, y0, log2_cb_size); -+ if ((ret = hls_pcm_sample(s, lc, x0, y0, log2_cb_size)) < 0) -+ return ret; -+ -+ if (s->ps.sps->pcm.loop_filter_disable_flag) -+ set_deblocking_bypass(s, x0, y0, log2_cb_size); -+ } else { -+ intra_prediction_unit(s, lc, x0, y0, log2_cb_size); -+ } -+ } else { -+ intra_prediction_unit_default_value(s, lc, x0, y0, log2_cb_size); -+ switch (lc->cu.part_mode) { -+ case PART_2Nx2N: -+ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size, log2_cb_size, 0, idx); -+ break; -+ case PART_2NxN: -+ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size / 2, log2_cb_size, 0, idx); -+ lc->cu.y_split = y0 + cb_size / 2; -+ hls_prediction_unit(s, lc, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1, idx); -+ break; -+ case PART_Nx2N: -+ hls_prediction_unit(s, lc, x0, y0, cb_size / 2, cb_size, log2_cb_size, 0, idx - 1); -+ lc->cu.x_split = x0 + cb_size / 2; -+ hls_prediction_unit(s, lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1); -+ break; -+ case PART_2NxnU: -+ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size / 4, log2_cb_size, 0, idx); -+ lc->cu.y_split = y0 + cb_size / 4; -+ hls_prediction_unit(s, lc, x0, y0 + cb_size / 4, cb_size, cb_size / 4 * 3, log2_cb_size, 1, idx); -+ break; -+ case PART_2NxnD: -+ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size / 4 * 3, log2_cb_size, 0, idx); -+ lc->cu.y_split = y0 + cb_size / 4 * 3; -+ hls_prediction_unit(s, lc, x0, y0 + cb_size / 4 * 3, cb_size, cb_size / 4, log2_cb_size, 1, idx); -+ break; -+ case PART_nLx2N: -+ hls_prediction_unit(s, lc, x0, y0, cb_size / 4, cb_size, log2_cb_size, 0, idx - 2); -+ lc->cu.x_split = x0 + cb_size / 4; -+ hls_prediction_unit(s, lc, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2); -+ break; -+ case PART_nRx2N: -+ hls_prediction_unit(s, lc, x0, y0, cb_size / 4 * 3, cb_size, log2_cb_size, 0, idx - 2); -+ lc->cu.x_split = x0 + cb_size / 4 * 3; -+ hls_prediction_unit(s, lc, x0 + cb_size / 4 * 3, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2); -+ break; -+ case PART_NxN: -+ hls_prediction_unit(s, lc, x0, y0, cb_size / 2, cb_size / 2, log2_cb_size, 0, idx - 1); -+ lc->cu.x_split = x0 + cb_size / 2; -+ hls_prediction_unit(s, lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1); -+ lc->cu.y_split = y0 + cb_size / 2; -+ hls_prediction_unit(s, lc, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1); -+ hls_prediction_unit(s, lc, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1); -+ break; -+ } -+ } -+ -+ if (!pcm_flag) { -+ int rqt_root_cbf = 1; -+ -+ if (lc->cu.pred_mode != MODE_INTRA && -+ !(lc->cu.part_mode == PART_2Nx2N && lc->pu.merge_flag)) { -+ rqt_root_cbf = ff_hevc_rpi_no_residual_syntax_flag_decode(lc); -+ } -+ if (rqt_root_cbf) { -+ const unsigned int cbf_c = ctx_cfmt(s) == 0 ? 0 : (CBF_CR0 | CBF_CB0); -+ int ret; -+ -+ lc->cu.max_trafo_depth = lc->cu.pred_mode == MODE_INTRA ? -+ s->ps.sps->max_transform_hierarchy_depth_intra + lc->cu.intra_split_flag : -+ s->ps.sps->max_transform_hierarchy_depth_inter; -+ // transform_tree does deblock_boundary_strengths -+ ret = hls_transform_tree(s, lc, x0, y0, -+ log2_cb_size, 0, 0, cbf_c); -+ if (ret < 0) -+ return ret; -+ } else { -+ if (!s->sh.disable_deblocking_filter_flag) -+ ff_hevc_rpi_deblocking_boundary_strengths(s, lc, x0, y0, log2_cb_size, 0); -+ } -+ } -+ } -+ -+ // If the delta is still wanted then we haven't read the delta & therefore need to set qp here -+ if (lc->tu.is_cu_qp_delta_wanted) -+ ff_hevc_rpi_set_qPy(s, lc, x0, y0); -+ -+ if(((x0 + (1<qPy_pred = lc->qp_y; -+ } -+ -+ set_bytes(s->qp_y_tab + y_cb * min_cb_width + x_cb, min_cb_width, log2_cb_size - log2_min_cb_size, lc->qp_y & 0xff); -+ -+ set_stash2(s->cabac_stash_up + (x0 >> 3), s->cabac_stash_left + (y0 >> 3), log2_cb_size - 3, (lc->ct_depth << 1) | skip_flag); -+ -+ return 0; -+} -+ -+// Returns: -+// < 0 Error -+// 0 More data wanted -+// 1 EoSlice / EoPicture -+static int hls_coding_quadtree(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const int x0, const int y0, -+ const int log2_cb_size, const unsigned int cb_depth) -+{ -+ const int cb_size = 1 << log2_cb_size; -+ int ret; -+ int split_cu; -+ -+ lc->ct_depth = cb_depth; -+ split_cu = (log2_cb_size > s->ps.sps->log2_min_cb_size); -+ if (x0 + cb_size <= s->ps.sps->width && -+ y0 + cb_size <= s->ps.sps->height && -+ split_cu) -+ { -+ split_cu = ff_hevc_rpi_split_coding_unit_flag_decode(s, lc, cb_depth, x0, y0); -+ } -+ -+ // Qp delta (and offset) need to remain wanted if cb_size < min until -+ // a coded block is found so we still initial state at depth 0 (outside -+ // this fn) and only reset here -+ if (s->ps.pps->cu_qp_delta_enabled_flag && -+ log2_cb_size >= s->ps.pps->log2_min_cu_qp_delta_size) -+ { -+ lc->tu.is_cu_qp_delta_wanted = 1; -+ lc->tu.cu_qp_delta = 0; -+ } -+ if (s->sh.cu_chroma_qp_offset_enabled_flag && -+ log2_cb_size >= s->ps.pps->log2_min_cu_qp_delta_size) -+ { -+ lc->tu.cu_chroma_qp_offset_wanted = 1; -+ } -+ -+ lc->tu.qp_divmod6[0] = s->ps.pps->qp_bd_x[0]; -+ lc->tu.qp_divmod6[1] = s->ps.pps->qp_bd_x[1] + s->sh.slice_cb_qp_offset; -+ lc->tu.qp_divmod6[2] = s->ps.pps->qp_bd_x[2] + s->sh.slice_cr_qp_offset; -+ -+ if (split_cu) { -+ int qp_block_mask = (1 << s->ps.pps->log2_min_cu_qp_delta_size) - 1; -+ const int cb_size_split = cb_size >> 1; -+ const int x1 = x0 + cb_size_split; -+ const int y1 = y0 + cb_size_split; -+ -+ int more_data = 0; -+ -+ more_data = hls_coding_quadtree(s, lc, x0, y0, log2_cb_size - 1, cb_depth + 1); -+ if (more_data < 0) -+ return more_data; -+ -+ if (more_data && x1 < s->ps.sps->width) { -+ more_data = hls_coding_quadtree(s, lc, x1, y0, log2_cb_size - 1, cb_depth + 1); -+ if (more_data < 0) -+ return more_data; -+ } -+ if (more_data && y1 < s->ps.sps->height) { -+ more_data = hls_coding_quadtree(s, lc, x0, y1, log2_cb_size - 1, cb_depth + 1); -+ if (more_data < 0) -+ return more_data; -+ } -+ if (more_data && x1 < s->ps.sps->width && -+ y1 < s->ps.sps->height) { -+ more_data = hls_coding_quadtree(s, lc, x1, y1, log2_cb_size - 1, cb_depth + 1); -+ if (more_data < 0) -+ return more_data; -+ } -+ -+ if(((x0 + (1<qPy_pred = lc->qp_y; -+ -+ if (more_data) -+ return ((x1 + cb_size_split) < s->ps.sps->width || -+ (y1 + cb_size_split) < s->ps.sps->height); -+ else -+ return 0; -+ } else { -+ ret = hls_coding_unit(s, lc, x0, y0, log2_cb_size); -+ if (ret < 0) -+ return ret; -+ if ((!((x0 + cb_size) % -+ (1 << (s->ps.sps->log2_ctb_size))) || -+ (x0 + cb_size >= s->ps.sps->width)) && -+ (!((y0 + cb_size) % -+ (1 << (s->ps.sps->log2_ctb_size))) || -+ (y0 + cb_size >= s->ps.sps->height))) { -+ int end_of_slice_flag = ff_hevc_rpi_get_cabac_terminate(&lc->cc); -+ return !end_of_slice_flag; -+ } else { -+ return 1; -+ } -+ } -+ -+ return 0; // NEVER -+} -+ -+static void hls_decode_neighbour(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const int x_ctb, const int y_ctb, const int ctb_addr_ts) -+{ -+ const unsigned int ctb_size = 1 << s->ps.sps->log2_ctb_size; -+ const unsigned int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; -+ const unsigned int ctb_addr_rs_in_slice = ctb_addr_rs - s->sh.slice_addr; // slice_addr = RS addr of start of slice -+ const unsigned int ctb_flags = s->ps.pps->ctb_ts_flags[ctb_addr_ts]; -+ const unsigned int line_w = s->ps.sps->ctb_width; -+ -+ s->tab_slice_address[ctb_addr_rs] = s->sh.slice_addr; -+ -+ lc->end_of_ctb_x = FFMIN(x_ctb + ctb_size, s->ps.sps->width); -+ lc->end_of_ctb_y = FFMIN(y_ctb + ctb_size, s->ps.sps->height); -+ -+ lc->boundary_flags = 0; -+ -+ if ((ctb_flags & CTB_TS_FLAGS_SOTL) != 0) -+ lc->boundary_flags |= BOUNDARY_LEFT_TILE; -+ if (x_ctb > 0 && s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - 1]) -+ lc->boundary_flags |= BOUNDARY_LEFT_SLICE; -+ if ((ctb_flags & CTB_TS_FLAGS_TOT) != 0) -+ lc->boundary_flags |= BOUNDARY_UPPER_TILE; -+ if (y_ctb > 0 && s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - line_w]) -+ lc->boundary_flags |= BOUNDARY_UPPER_SLICE; -+ -+ // Use line width rather than tile width for addr_in_slice test as -+ // addr_in_slice is in raster units -+ -+ lc->ctb_avail = -+ ((lc->boundary_flags & (BOUNDARY_LEFT_SLICE | BOUNDARY_LEFT_TILE)) == 0 ? AVAIL_L : 0) | -+ ((lc->boundary_flags & (BOUNDARY_UPPER_SLICE | BOUNDARY_UPPER_TILE)) == 0 ? AVAIL_U : 0) | -+ ((lc->boundary_flags & (BOUNDARY_LEFT_TILE | BOUNDARY_UPPER_TILE)) == 0 && -+ (ctb_addr_rs_in_slice > line_w) ? AVAIL_UL : 0) | -+ ((ctb_flags & (CTB_TS_FLAGS_EOTL | CTB_TS_FLAGS_TOT)) == 0 && -+ (ctb_addr_rs_in_slice + 1 >= line_w) ? AVAIL_UR : 0); -+ // Down-left never avail at CTB level -+} -+ -+ -+static void rpi_execute_dblk_cmds(const HEVCRpiContext * const s, HEVCRpiJob * const jb) -+{ -+ int y = ff_hevc_rpi_hls_filter_blk(s, jb->bounds, -+ (s->ps.pps->ctb_ts_flags[jb->ctu_ts_last] & CTB_TS_FLAGS_EOT) != 0); -+ -+ // Signal -+ if (y > 0) { -+ // Cast away const as progress is held in s, but this really shouldn't confuse anything -+ ff_hevc_rpi_progress_signal_recon((HEVCRpiContext *)s, y - 1); -+ } -+ -+ // Job done now -+ // ? Move outside this fn -+ job_free(s->jbc, jb); -+} -+ -+// I-pred, transform_and_add for all blocks types done here -+// All ARM -+static void rpi_execute_pred_cmds(const HEVCRpiContext * const s, HEVCRpiJob * const jb) -+{ -+ unsigned int i; -+ HEVCRpiIntraPredEnv * const iap = &jb->intra; -+ const HEVCPredCmd *cmd = iap->cmds; -+ -+#if !RPI_WORKER_WAIT_PASS_0 -+ rpi_sem_wait(&jb->sem); -+ rpi_cache_flush_execute(jb->rfe); // Invalidate data set up in pass1 -+#endif -+ -+ for (i = iap->n; i > 0; i--, cmd++) -+ { -+ switch (cmd->type) -+ { -+ case RPI_PRED_INTRA: -+ s->hpc.intra_pred(s, cmd->i_pred.mode, cmd->i_pred.x, cmd->i_pred.y, cmd->avail, cmd->size); -+ break; -+ case RPI_PRED_INTRA_C: -+ s->hpc.intra_pred_c(s, cmd->i_pred.mode, cmd->i_pred.x, cmd->i_pred.y, cmd->avail, cmd->size); -+ break; -+ case RPI_PRED_ADD_RESIDUAL: -+ s->hevcdsp.add_residual[cmd->size - 2](cmd->ta.dst, (int16_t *)cmd->ta.buf, cmd->ta.stride); -+ break; -+ case RPI_PRED_ADD_DC: -+ s->hevcdsp.add_residual_dc[cmd->size - 2](cmd->dc.dst, cmd->dc.stride, cmd->dc.dc); -+ break; -+ case RPI_PRED_ADD_RESIDUAL_U: -+ s->hevcdsp.add_residual_u[cmd->size - 2](cmd->ta.dst, (int16_t *)cmd->ta.buf, cmd->ta.stride, cmd->ta.dc); -+ break; -+ case RPI_PRED_ADD_RESIDUAL_V: -+ s->hevcdsp.add_residual_v[cmd->size - 2](cmd->ta.dst, (int16_t *)cmd->ta.buf, cmd->ta.stride, cmd->ta.dc); -+ break; -+ case RPI_PRED_ADD_RESIDUAL_C: -+ s->hevcdsp.add_residual_c[cmd->size - 2](cmd->ta.dst, (int16_t *)cmd->ta.buf, cmd->ta.stride); -+ break; -+ case RPI_PRED_ADD_DC_U: -+ case RPI_PRED_ADD_DC_V: -+ s->hevcdsp.add_residual_dc_c[cmd->size - 2](cmd->dc.dst, cmd->dc.stride, cmd->dc.dc); -+ break; -+ -+ case RPI_PRED_I_PCM: -+ pcm_extract(s, cmd->i_pcm.src, cmd->i_pcm.src_len, cmd->i_pcm.x, cmd->i_pcm.y, 1 << cmd->size); -+ break; -+ -+ default: -+ av_log(s->avctx, AV_LOG_PANIC, "Bad command %d in worker pred Q\n", cmd->type); -+ abort(); -+ } -+ } -+ -+ // Mark done -+ iap->n = 0; -+} -+ -+ -+// Set initial uniform job values & zero ctu_count -+static void rpi_begin(const HEVCRpiContext * const s, HEVCRpiJob * const jb, const unsigned int ctu_ts_first) -+{ -+ unsigned int i; -+ HEVCRpiInterPredEnv *const cipe = &jb->chroma_ip; -+ HEVCRpiInterPredEnv *const yipe = &jb->luma_ip; -+ const HEVCRpiSPS * const sps = s->ps.sps; -+ -+ const uint16_t pic_width_y = sps->width; -+ const uint16_t pic_height_y = sps->height; -+ -+ const uint16_t pic_width_c = sps->width >> ctx_hshift(s, 1); -+ const uint16_t pic_height_c = sps->height >> ctx_vshift(s, 1); -+ -+ // We expect the pointer to change if we use another sps -+ if (sps != jb->sps) -+ { -+ worker_pic_free_one(jb); -+ -+ set_ipe_from_ici(cipe, &ipe_init_infos[s->ps.sps->bit_depth - 8].chroma); -+ set_ipe_from_ici(yipe, &ipe_init_infos[s->ps.sps->bit_depth - 8].luma); -+ -+ { -+ const int coefs_per_luma = HEVC_MAX_CTB_SIZE * HEVC_RPI_MAX_WIDTH; -+ const int coefs_per_chroma = (coefs_per_luma * 2) >> (ctx_vshift(s, 1) + ctx_hshift(s, 1)); -+ worker_pic_alloc_one(jb, coefs_per_luma + coefs_per_chroma); -+ } -+ -+ jb->sps = sps; -+ } -+ -+ jb->waited = 0; -+ jb->ctu_ts_first = ctu_ts_first; -+ jb->ctu_ts_last = -1; -+ -+ rpi_inter_pred_reset(cipe); -+ for (i = 0; i < cipe->n; i++) { -+ HEVCRpiInterPredQ * const cp = cipe->q + i; -+ qpu_mc_pred_c_s_t * const u = &cp->qpu_mc_base->c.s; -+ -+ u->next_src1.x = 0; -+ u->next_src1.y = 0; -+ u->next_src1.base = 0; -+ u->pic_cw = pic_width_c; -+ u->pic_ch = pic_height_c; -+ u->stride2 = av_rpi_sand_frame_stride2(s->frame); -+ u->stride1 = av_rpi_sand_frame_stride1(s->frame); -+ cp->last_l0 = &u->next_src1; -+ -+ u->next_fn = 0; -+ u->next_src2.x = 0; -+ u->next_src2.y = 0; -+ u->next_src2.base = 0; -+ cp->last_l1 = &u->next_src2; -+ -+ cp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(u + 1); -+ } -+ -+ rpi_inter_pred_reset(yipe); -+ for (i = 0; i < yipe->n; i++) { -+ HEVCRpiInterPredQ * const yp = yipe->q + i; -+ qpu_mc_pred_y_s_t * const y = &yp->qpu_mc_base->y.s; -+ -+ y->next_src1.x = 0; -+ y->next_src1.y = 0; -+ y->next_src1.base = 0; -+ y->next_src2.x = 0; -+ y->next_src2.y = 0; -+ y->next_src2.base = 0; -+ y->pic_h = pic_height_y; -+ y->pic_w = pic_width_y; -+ y->stride2 = av_rpi_sand_frame_stride2(s->frame); -+ y->stride1 = av_rpi_sand_frame_stride1(s->frame); -+ y->next_fn = 0; -+ yp->last_l0 = &y->next_src1; -+ yp->last_l1 = &y->next_src2; -+ -+ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(y + 1); -+ } -+ -+ jb->last_y8_p = NULL; -+ jb->last_y8_l1 = NULL; -+ -+ for (i = 0; i != FF_ARRAY_ELEMS(jb->progress_req); ++i) { -+ jb->progress_req[i] = -1; -+ } -+ -+ worker_pic_reset(&jb->coeffs); -+} -+ -+ -+#if !RPI_QPU_EMU_Y || !RPI_QPU_EMU_C -+static unsigned int mc_terminate_add_qpu(const HEVCRpiContext * const s, -+ const vpu_qpu_job_h vqj, -+ rpi_cache_flush_env_t * const rfe, -+ HEVCRpiInterPredEnv * const ipe) -+{ -+ unsigned int i; -+ uint32_t mail[QPU_N_MAX][QPU_MAIL_EL_VALS]; -+ unsigned int max_block = 0; -+ -+ if (!ipe->used) { -+ return 0; -+ } -+ -+ if (ipe->curr != 0) { -+ rpi_inter_pred_sync(ipe); -+ } -+ -+ // Add final commands to Q -+ for(i = 0; i != ipe->n; ++i) { -+ HEVCRpiInterPredQ * const yp = ipe->q + i; -+ qpu_mc_src_t *const p0 = yp->last_l0; -+ qpu_mc_src_t *const p1 = yp->last_l1; -+ const unsigned int block_size = (char *)yp->qpu_mc_curr - (char *)yp->qpu_mc_base; -+ -+ if (block_size > max_block) -+ max_block = block_size; -+ -+ qpu_mc_link_set(yp->qpu_mc_curr, yp->code_exit); -+ -+ // Need to set the srcs for L0 & L1 to something that can be (pointlessly) prefetched -+ p0->x = MC_DUMMY_X; -+ p0->y = MC_DUMMY_Y; -+ p0->base = s->qpu_dummy_frame_qpu; -+ p1->x = MC_DUMMY_X; -+ p1->y = MC_DUMMY_Y; -+ p1->base = s->qpu_dummy_frame_qpu; -+ -+ yp->last_l0 = NULL; -+ yp->last_l1 = NULL; -+ -+ // Add to mailbox list -+ mail[i][0] = ipe->gptr.vc + ((uint8_t *)yp->qpu_mc_base - ipe->gptr.arm); -+ mail[i][1] = yp->code_setup; -+ } -+ -+ // We don't need invalidate here as the uniforms aren't changed by the QPU -+ // and leaving them in ARM cache avoids (pointless) pre-reads when writing -+ // new values which seems to give us a small performance advantage -+ // -+ // In most cases we will not have a completely packed set of uniforms and as -+ // we have a 2d invalidate we writeback all uniform Qs to the depth of the -+ // fullest -+ rpi_cache_flush_add_gm_blocks(rfe, &ipe->gptr, RPI_CACHE_FLUSH_MODE_WRITEBACK, -+ (uint8_t *)ipe->q[0].qpu_mc_base - ipe->gptr.arm, max_block, -+ ipe->n, ipe->max_fill + ipe->min_gap); -+ vpu_qpu_job_add_qpu(vqj, ipe->n, (uint32_t *)mail); -+ -+ return 1; -+} -+#endif -+ -+#if RPI_QPU_EMU_Y || RPI_QPU_EMU_C -+static unsigned int mc_terminate_add_emu(const HEVCRpiContext * const s, -+ const vpu_qpu_job_h vqj, -+ rpi_cache_flush_env_t * const rfe, -+ HEVCRpiInterPredEnv * const ipe) -+{ -+ unsigned int i; -+ if (!ipe->used) { -+ return 0; -+ } -+ -+ if (ipe->curr != 0) { -+ rpi_inter_pred_sync(ipe); -+ } -+ -+ // Add final commands to Q -+ for(i = 0; i != ipe->n; ++i) { -+ HEVCRpiInterPredQ * const yp = ipe->q + i; -+ qpu_mc_src_t *const p0 = yp->last_l0; -+ qpu_mc_src_t *const p1 = yp->last_l1; -+ -+ yp->qpu_mc_curr->data[-1] = yp->code_exit; -+ -+ // Need to set the srcs for L0 & L1 to something that can be (pointlessly) prefetched -+ p0->x = MC_DUMMY_X; -+ p0->y = MC_DUMMY_Y; -+ p0->base = s->qpu_dummy_frame_emu; -+ p1->x = MC_DUMMY_X; -+ p1->y = MC_DUMMY_Y; -+ p1->base = s->qpu_dummy_frame_emu; -+ -+ yp->last_l0 = NULL; -+ yp->last_l1 = NULL; -+ } -+ -+ return 1; -+} -+#endif -+ -+ -+#if RPI_QPU_EMU_Y -+#define mc_terminate_add_y mc_terminate_add_emu -+#else -+#define mc_terminate_add_y mc_terminate_add_qpu -+#endif -+#if RPI_QPU_EMU_C -+#define mc_terminate_add_c mc_terminate_add_emu -+#else -+#define mc_terminate_add_c mc_terminate_add_qpu -+#endif -+ -+ -+static void flush_frame(HEVCRpiContext *s,AVFrame *frame) -+{ -+ rpi_cache_buf_t cbuf; -+ rpi_cache_flush_env_t * rfe = rpi_cache_flush_init(&cbuf); -+ rpi_cache_flush_add_frame(rfe, frame, RPI_CACHE_FLUSH_MODE_WB_INVALIDATE); -+ rpi_cache_flush_finish(rfe); -+} -+ -+static void job_gen_bounds(const HEVCRpiContext * const s, HEVCRpiJob * const jb) -+{ -+ const unsigned int rs0 = s->ps.pps->ctb_addr_ts_to_rs[jb->ctu_ts_first]; -+ const unsigned int rs1 = s->ps.pps->ctb_addr_ts_to_rs[jb->ctu_ts_last]; -+ const unsigned int ctb_width = s->ps.sps->ctb_width; -+ RpiBlk *const bounds = &jb->bounds; -+ av_assert1(jb->ctu_ts_first <= jb->ctu_ts_last); -+ bounds->x = (rs0 % ctb_width) << s->ps.sps->log2_ctb_size; -+ bounds->y = (rs0 / ctb_width) << s->ps.sps->log2_ctb_size; -+ bounds->w = ((rs1 - rs0) % ctb_width + 1) << s->ps.sps->log2_ctb_size; -+ bounds->h = ((rs1 - rs0) / ctb_width + 1) << s->ps.sps->log2_ctb_size; -+ -+ bounds->w = FFMIN(bounds->w, s->ps.sps->width - bounds->x); -+ bounds->h = FFMIN(bounds->h, s->ps.sps->height - bounds->y); -+} -+ -+#if RPI_PASSES == 2 -+static void worker_core2(HEVCRpiContext * const s, HEVCRpiJob * const jb) -+{ -+ // Perform intra prediction and residual reconstruction -+ rpi_execute_pred_cmds(s, jb); -+ -+ // Perform deblocking for CTBs in this row -+ rpi_execute_dblk_cmds(s, jb); -+} -+#endif -+ -+// Core execution tasks -+static void worker_core(const HEVCRpiContext * const s, HEVCRpiJob * const jb) -+{ -+ int pred_y, pred_c; -+ vpu_qpu_job_env_t qvbuf; -+ const vpu_qpu_job_h vqj = vpu_qpu_job_init(&qvbuf); -+#if RPI_WORKER_WAIT_PASS_0 -+ int do_wait; -+#endif -+ -+ { -+ const HEVCRpiCoeffsEnv * const cf = &jb->coeffs; -+ if (cf->s[3].n + cf->s[2].n != 0) -+ { -+ const unsigned int csize = sizeof(cf->s[3].buf[0]); -+ const unsigned int offset32 = ((cf->s[3].buf - cf->s[2].buf) - cf->s[3].n) * csize; -+ unsigned int n16 = (cf->s[2].n >> 8); -+ unsigned int n32 = (cf->s[3].n >> 10); -+#if RPI_COMPRESS_COEFFS -+ if (cf->s[2].packed) { -+ n16 = n16 | (n16<<16); -+ } else { -+ const unsigned int npack16 = (cf->s[2].packed_n>>8); -+ n16 = n16 | (npack16<<16); -+ } -+ if (cf->s[3].packed) { -+ n32 = n32 | (n32<<16); -+ } else { -+ const unsigned int npack32 = (cf->s[3].packed_n>>10); -+ n32 = n32 | (npack32<<16); -+ } -+#endif -+ vpu_qpu_job_add_vpu(vqj, -+ vpu_get_fn(s->ps.sps->bit_depth), -+ vpu_get_constants(), -+ cf->gptr.vc, -+ n16, -+ cf->gptr.vc + offset32, -+ n32, -+ 0); -+ -+ rpi_cache_flush_add_gm_range(jb->rfe, &cf->gptr, RPI_CACHE_FLUSH_MODE_WB_INVALIDATE, 0, cf->s[2].n * csize); -+ rpi_cache_flush_add_gm_range(jb->rfe, &cf->gptr, RPI_CACHE_FLUSH_MODE_WB_INVALIDATE, offset32, cf->s[3].n * csize); -+ } -+ } -+ -+ pred_c = mc_terminate_add_c(s, vqj, jb->rfe, &jb->chroma_ip); -+ -+// We could take a sync here and try to locally overlap QPU processing with ARM -+// but testing showed a slightly negative benefit with noticable extra complexity -+ -+ pred_y = mc_terminate_add_y(s, vqj, jb->rfe, &jb->luma_ip); -+ -+ // Returns 0 if nothing to do, 1 if sync added -+#if RPI_WORKER_WAIT_PASS_0 -+ do_wait = vpu_qpu_job_add_sync_sem(vqj, &jb->sem); -+#else -+ if (vpu_qpu_job_add_sync_sem(vqj, &jb->sem) == 0) -+ sem_post(&jb->sem); -+#endif -+ -+ rpi_cache_flush_execute(jb->rfe); -+ -+ // Await progress as required -+ // jb->waited will only be clear if we have already tested the progress values -+ // (in worker_submit_job) and found we don't have to wait -+ if (jb->waited) -+ { -+ unsigned int i; -+ for (i = 0; i != FF_ARRAY_ELEMS(jb->progress_req); ++i) { -+ if (jb->progress_req[i] >= 0) { -+ ff_hevc_rpi_progress_wait_recon(s, jb, s->DPB + i, jb->progress_req[i]); -+ } -+ } -+ } -+ -+ vpu_qpu_job_finish(vqj); -+ -+ // We always work on a rectangular block -+ if (pred_y || pred_c) -+ { -+ rpi_cache_flush_add_frame_block(jb->rfe, s->frame, RPI_CACHE_FLUSH_MODE_INVALIDATE, -+ jb->bounds.x, jb->bounds.y, jb->bounds.w, jb->bounds.h, -+ ctx_vshift(s, 1), pred_y, pred_c); -+ } -+ -+ // If we have emulated VPU ops - do it here -+#if RPI_QPU_EMU_Y || RPI_QPU_EMU_C -+ if (av_rpi_is_sand8_frame(s->frame)) -+ { -+#if RPI_QPU_EMU_Y && RPI_QPU_EMU_C -+ ff_hevc_rpi_shader_c8(s, &jb->luma_ip, &jb->chroma_ip); -+#elif RPI_QPU_EMU_Y -+ ff_hevc_rpi_shader_c8(s, &jb->luma_ip, NULL); -+#else -+ ff_hevc_rpi_shader_c8(s, NULL, &jb->chroma_ip); -+#endif -+ } -+ else -+ { -+#if RPI_QPU_EMU_Y && RPI_QPU_EMU_C -+ ff_hevc_rpi_shader_c16(s, &jb->luma_ip, &jb->chroma_ip); -+#elif RPI_QPU_EMU_Y -+ ff_hevc_rpi_shader_c16(s, &jb->luma_ip, NULL); -+#else -+ ff_hevc_rpi_shader_c16(s, NULL, &jb->chroma_ip); -+#endif -+ } -+#endif -+ -+#if RPI_WORKER_WAIT_PASS_0 -+ if (do_wait) -+ rpi_sem_wait(&jb->sem); -+ rpi_cache_flush_execute(jb->rfe); -+#endif -+} -+ -+ -+static void rpi_free_inter_pred(HEVCRpiInterPredEnv * const ipe) -+{ -+ av_freep(&ipe->q); -+ gpu_free(&ipe->gptr); -+} -+ -+static HEVCRpiJob * job_new(void) -+{ -+ HEVCRpiJob * const jb = av_mallocz(sizeof(HEVCRpiJob)); -+ -+ if (jb == NULL) -+ return NULL; -+ -+ sem_init(&jb->sem, 0, 0); -+ jb->rfe = rpi_cache_flush_init(&jb->flush_buf); -+ ff_hevc_rpi_progress_init_wait(&jb->progress_wait); -+ -+ jb->intra.n = 0; -+ if ((jb->intra.cmds = av_mallocz(sizeof(HEVCPredCmd) * RPI_MAX_PRED_CMDS)) == NULL) -+ goto fail1; -+ -+ // * Sizeof the union structure might be overkill but at the moment it -+ // is correct (it certainly isn't going to be too small) -+ // Set max fill to slack/2 from the end of the Q -+ // If we exceed this in any Q then we will schedule by size (which should -+ // mean that we never use that Q again part from syncs) -+ // * Given how agressive the overflow resonse is we could maybe put the -+ // threshold even nearer the end, but I don't expect us to ever hit -+ // it on any real stream anyway. -+ -+ if (rpi_inter_pred_alloc(&jb->chroma_ip, -+ QPU_N_MAX, QPU_N_GRP, -+ QPU_C_COMMANDS * sizeof(qpu_mc_pred_c_t) + QPU_C_SYNCS * sizeof(uint32_t), -+ QPU_C_CMD_SLACK_PER_Q * sizeof(qpu_mc_pred_c_t) / 2) != 0) -+ goto fail2; -+ if (rpi_inter_pred_alloc(&jb->luma_ip, -+ QPU_N_MAX, QPU_N_GRP, -+ QPU_Y_COMMANDS * sizeof(qpu_mc_pred_y_t) + QPU_Y_SYNCS * sizeof(uint32_t), -+ QPU_Y_CMD_SLACK_PER_Q * sizeof(qpu_mc_pred_y_t) / 2) != 0) -+ goto fail3; -+ -+ return jb; -+ -+fail3: -+ rpi_free_inter_pred(&jb->luma_ip); -+fail2: -+ av_freep(&jb->intra.cmds); -+fail1: -+ ff_hevc_rpi_progress_kill_wait(&jb->progress_wait); -+ rpi_cache_flush_finish(jb->rfe); -+ sem_destroy(&jb->sem); -+ return NULL; -+} -+ -+static void job_delete(HEVCRpiJob * const jb) -+{ -+ worker_pic_free_one(jb); -+ ff_hevc_rpi_progress_kill_wait(&jb->progress_wait); -+ rpi_free_inter_pred(&jb->chroma_ip); -+ rpi_free_inter_pred(&jb->luma_ip); -+ av_freep(&jb->intra.cmds); -+ rpi_cache_flush_finish(jb->rfe); // Not really needed - should do nothing -+ sem_destroy(&jb->sem); -+ av_free(jb); -+} -+ -+static void jbg_delete(HEVCRpiJobGlobal * const jbg) -+{ -+ HEVCRpiJob * jb; -+ -+ if (jbg == NULL) -+ return; -+ -+ jb = jbg->free1; -+ while (jb != NULL) -+ { -+ HEVCRpiJob * const jb2 = jb; -+ jb = jb2->next; -+ job_delete(jb2); -+ } -+ -+ pthread_mutex_destroy(&jbg->lock); -+ av_free(jbg); -+} -+ -+static HEVCRpiJobGlobal * jbg_new(unsigned int job_count) -+{ -+ HEVCRpiJobGlobal * const jbg = av_mallocz(sizeof(HEVCRpiJobGlobal)); -+ if (jbg == NULL) -+ return NULL; -+ -+ pthread_mutex_init(&jbg->lock, NULL); -+ -+ while (job_count-- != 0) -+ { -+ HEVCRpiJob * const jb = job_new(); -+ if (jb == NULL) -+ goto fail; -+ -+ jb->next = jbg->free1; -+ jbg->free1 = jb; -+ } -+ -+ return jbg; -+ -+fail: -+ jbg_delete(jbg); -+ return NULL; -+} -+ -+static void rpi_job_ctl_delete(HEVCRpiJobCtl * const jbc) -+{ -+ HEVCRpiJobGlobal * jbg; -+ -+ if (jbc == NULL) -+ return; -+ -+ jbg = jbc->jbg; -+ -+ if (jbc->jb1 != NULL) -+ job_delete(jbc->jb1); -+ -+ pthread_mutex_destroy(&jbc->in_lock); -+ sem_destroy(&jbc->sem_out); -+ av_free(jbc); -+ -+ // Deref the global job context -+ if (jbg != NULL && atomic_fetch_add(&jbg->ref_count, -1) == 1) -+ jbg_delete(jbg); -+} -+ -+static HEVCRpiJobCtl * rpi_job_ctl_new(HEVCRpiJobGlobal *const jbg) -+{ -+ HEVCRpiJobCtl * const jbc = av_mallocz(sizeof(HEVCRpiJobCtl)); -+ -+ if (jbc == NULL) -+ return NULL; -+ -+ jbc->jbg = jbg; -+ atomic_fetch_add(&jbg->ref_count, 1); -+ -+ sem_init(&jbc->sem_out, 0, RPI_MAX_JOBS); -+ pthread_mutex_init(&jbc->in_lock, NULL); -+ -+ if ((jbc->jb1 = job_new()) == NULL) -+ goto fail; -+ jbc->jb1->jbc_local = jbc; -+ -+ return jbc; -+ -+fail: -+ rpi_job_ctl_delete(jbc); -+ return NULL; -+} -+ -+ -+ -+static av_cold void hevc_init_worker(HEVCRpiContext * const s) -+{ -+#if RPI_PASSES == 2 -+ pass_queue_init(s->passq + 1, s, worker_core2, &s->jbc->sem_out, 1); -+#elif RPI_PASSES == 3 -+ pass_queue_init(s->passq + 2, s, rpi_execute_dblk_cmds, &s->jbc->sem_out, 2); -+ pass_queue_init(s->passq + 1, s, rpi_execute_pred_cmds, &s->passq[2].sem_in, 1); -+#else -+#error Passes confused -+#endif -+ pass_queue_init(s->passq + 0, s, worker_core, &s->passq[1].sem_in, 0); -+ -+ pass_queues_start_all(s); -+} -+ -+static av_cold void hevc_exit_worker(HEVCRpiContext *s) -+{ -+ pass_queues_term_all(s); -+ -+ pass_queues_kill_all(s); -+ -+ rpi_job_ctl_delete(s->jbc); -+ s->jbc = NULL; -+} -+ -+ -+static int slice_start(const HEVCRpiContext * const s, HEVCRpiLocalContext *const lc) -+{ -+ const int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr]; -+ const int tiles = s->ps.pps->num_tile_rows * s->ps.pps->num_tile_columns; -+ const unsigned int tile_id = s->ps.pps->tile_id[ctb_addr_ts]; -+ -+ // Check for obvious disasters -+ if (ctb_addr_ts == 0 && s->sh.dependent_slice_segment_flag) { -+ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ // If dependant then ctb_addr_ts != 0 from previous check -+ if (s->sh.dependent_slice_segment_flag) { -+ int prev_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1]; -+ if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) { -+ av_log(s->avctx, AV_LOG_ERROR, "Previous slice segment missing\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ } -+ -+ if (!s->ps.pps->entropy_coding_sync_enabled_flag && -+ tile_id + s->sh.num_entry_point_offsets >= tiles) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, "Entry points exceed tiles\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ // Tiled stuff must start at start of tile if it has multiple entry points -+ if (!s->ps.pps->entropy_coding_sync_enabled_flag && -+ s->sh.num_entry_point_offsets != 0 && -+ ctb_addr_ts != s->ps.pps->tile_pos_ts[tile_id]) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, "Multiple tiles in slice; slice start != tile start\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ ff_hevc_rpi_cabac_init_decoder(lc); -+ -+ // Setup any required decode vars -+ lc->cabac_init_req = !s->sh.dependent_slice_segment_flag; -+ -+// printf("SS: req=%d, sol=%d, sot=%d\n", lc->cabac_init_req, sol, sot); -+ lc->qp_y = s->sh.slice_qp; -+ -+ // General setup -+ lc->bt_line_no = 0; -+ lc->ts = ctb_addr_ts; -+ return 0; -+} -+ -+static int gen_entry_points(HEVCRpiContext * const s, const H2645NAL * const nal) -+{ -+ const GetBitContext * const gb = &s->HEVClc->gb; -+ RpiSliceHeader * const sh = &s->sh; -+ int i, j; -+ -+ const unsigned int length = nal->size; -+ unsigned int offset = ((gb->index) >> 3) + 1; // We have a bit & align still to come = +1 byte -+ unsigned int cmpt; -+ unsigned int startheader; -+ -+ if (sh->num_entry_point_offsets == 0) { -+ s->data = NULL; -+ return 0; -+ } -+ -+ // offset in slice header includes emulation prevention bytes. -+ // Unfortunately those have been removed by the time we get here so we -+ // have to compensate. The nal layer keeps a track of where they were. -+ for (j = 0, cmpt = 0, startheader = offset + sh->entry_point_offset[0]; j < nal->skipped_bytes; j++) { -+ if (nal->skipped_bytes_pos[j] >= offset && nal->skipped_bytes_pos[j] < startheader) { -+ startheader--; -+ cmpt++; -+ } -+ } -+ -+ for (i = 1; i < sh->num_entry_point_offsets; i++) { -+ offset += (sh->entry_point_offset[i - 1] - cmpt); -+ for (j = 0, cmpt = 0, startheader = offset + sh->entry_point_offset[i]; j < nal->skipped_bytes; j++) { -+ if (nal->skipped_bytes_pos[j] >= offset && nal->skipped_bytes_pos[j] < startheader) { -+ startheader--; -+ cmpt++; -+ } -+ } -+ if (sh->entry_point_offset[i] <= cmpt) { -+ av_log(s->avctx, AV_LOG_ERROR, "entry point offset <= skipped bytes\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ sh->size[i - 1] = sh->entry_point_offset[i] - cmpt; -+ sh->offset[i - 1] = offset; -+ } -+ -+ offset += sh->entry_point_offset[sh->num_entry_point_offsets - 1] - cmpt; -+ if (length < offset) { -+ av_log(s->avctx, AV_LOG_ERROR, "entry_point_offset table is corrupted\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ sh->size[sh->num_entry_point_offsets - 1] = length - offset; -+ sh->offset[sh->num_entry_point_offsets - 1] = offset; -+ -+ // Remember data start pointer as we won't have nal later -+ s->data = nal->data; -+ return 0; -+} -+ -+ -+// Return -+// < 0 Error -+// 0 OK -+// -+// jb->ctu_ts_last < 0 Job still filling -+// jb->ctu_ts_last >= 0 Job ready -+ -+static int fill_job(HEVCRpiContext * const s, HEVCRpiLocalContext *const lc, unsigned int max_blocks) -+{ -+ const unsigned int log2_ctb_size = s->ps.sps->log2_ctb_size; -+ const unsigned int ctb_size = (1 << log2_ctb_size); -+ HEVCRpiJob * const jb = lc->jb0; -+ int more_data = 1; -+ unsigned int ctb_addr_ts = lc->ts; -+ unsigned int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; -+ unsigned int x_ctb = (ctb_addr_rs % s->ps.sps->ctb_width) << log2_ctb_size; -+ const unsigned int y_ctb = (ctb_addr_rs / s->ps.sps->ctb_width) << log2_ctb_size; -+ -+ lc->unit_done = 0; -+ -+ while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) -+ { -+ int q_full; -+ const unsigned int ctb_flags = s->ps.pps->ctb_ts_flags[ctb_addr_ts]; -+ -+ hls_decode_neighbour(s, lc, x_ctb, y_ctb, ctb_addr_ts); -+ -+ ff_hevc_rpi_cabac_init(s, lc, ctb_flags); -+ -+ hls_sao_param(s, lc, x_ctb >> log2_ctb_size, y_ctb >> log2_ctb_size); -+ -+ s->deblock[ctb_addr_rs].beta_offset = s->sh.beta_offset; -+ s->deblock[ctb_addr_rs].tc_offset = s->sh.tc_offset; -+ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; -+ -+ // Zap stashes if navail -+ if ((lc->ctb_avail & AVAIL_U) == 0) -+ zap_cabac_stash(s->cabac_stash_up + (x_ctb >> 3), log2_ctb_size - 3); -+ if ((lc->ctb_avail & AVAIL_L) == 0) -+ { -+ memset(lc->ipm_left, INTRA_DC, IPM_TAB_SIZE); -+ zap_cabac_stash(s->cabac_stash_left + (y_ctb >> 3), log2_ctb_size - 3); -+ } -+#if MVF_STASH_WIDTH > 64 -+ // Restore left mvf stash at start of tile if not at start of line -+ if ((ctb_flags & CTB_TS_FLAGS_SOTL) != 0 && x_ctb != 0 && !s->is_irap) -+ { -+ unsigned int i; -+ HEVCRpiMvField * dst = mvf_stash_ptr(s, lc, x_ctb - 1, 0); -+ const HEVCRpiMvField * src = s->mvf_left + (y_ctb >> LOG2_MIN_PU_SIZE); -+ for (i = 0; i != ctb_size >> LOG2_MIN_PU_SIZE; ++i) -+ { -+ *dst = *src++; -+ dst += MVF_STASH_WIDTH_PU; -+ } -+ } -+#endif -+ -+ // Set initial tu states -+ lc->tu.cu_qp_delta = 0; -+ lc->tu.is_cu_qp_delta_wanted = 0; -+ lc->tu.cu_chroma_qp_offset_wanted = 0; -+ -+ // Decode -+ more_data = hls_coding_quadtree(s, lc, x_ctb, y_ctb, log2_ctb_size, 0); -+ -+ if (ff_hevc_rpi_cabac_overflow(lc)) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, "Quadtree bitstream overread\n "); -+ more_data = AVERROR_INVALIDDATA; -+ } -+ -+ if (more_data < 0) { -+ s->tab_slice_address[ctb_addr_rs] = TAB_SLICE_ADDR_BROKEN; // Mark slice as broken -+ return more_data; -+ } -+ -+ if (more_data && ((ctb_flags & CTB_TS_FLAGS_EOT) != 0 || -+ (s->ps.pps->entropy_coding_sync_enabled_flag && (ctb_flags & CTB_TS_FLAGS_EOTL) != 0))) -+ { -+ if (ff_hevc_rpi_get_cabac_terminate(&lc->cc) < 0 || -+ ff_hevc_rpi_cabac_skip_bytes(&lc->cc, 0) == NULL) -+ { -+ av_log(s->avctx, AV_LOG_ERROR, "Error reading terminate el\n "); -+ return -1; -+ } -+ } -+ -+ // --- Post CTB processing -+ -+ // Stash rpl top/left for deblock that needs to remember such things cross-slice -+ s->rpl_up[x_ctb >> log2_ctb_size] = s->refPicList; -+ s->rpl_left[y_ctb >> log2_ctb_size] = s->refPicList; -+ -+ if (!s->is_irap) -+ { -+ // Copy MVF up to up-left & stash to up -+ { -+ const HEVCRpiMvField * src = mvf_stash_ptr(s, lc, x_ctb, ctb_size - 1); -+ HEVCRpiMvField * dst = s->mvf_up + (x_ctb >> LOG2_MIN_PU_SIZE); -+ -+ // printf("Stash: %d,%d, ctb_size=%d, %p->%p\n", x_ctb, y_ctb, ctb_size, src, dst); -+ -+ lc->mvf_ul[0] = dst[(ctb_size - 1) >> LOG2_MIN_PU_SIZE]; -+ memcpy(dst, src, (sizeof(*src)*ctb_size) >> LOG2_MIN_PU_SIZE); -+ } -+ // Stash sideways if end of tile line but not end of line (no point) -+ // ** Could/should do this @ end of fn -+#if MVF_STASH_WIDTH > 64 -+ if ((ctb_flags & (CTB_TS_FLAGS_EOTL | CTB_TS_FLAGS_EOL)) == CTB_TS_FLAGS_EOTL) -+#endif -+ { -+ unsigned int i; -+ const HEVCRpiMvField * src = mvf_stash_ptr(s, lc, x_ctb + ctb_size - 1, 0); -+ HEVCRpiMvField * dst = s->mvf_left + (y_ctb >> LOG2_MIN_PU_SIZE); -+ for (i = 0; i != ctb_size >> LOG2_MIN_PU_SIZE; ++i) -+ { -+ *dst++ = *src; -+ src += MVF_STASH_WIDTH_PU; -+ } -+ } -+ } -+ -+ if ((ctb_flags & CTB_TS_FLAGS_CSAVE) != 0) -+ ff_hevc_rpi_save_states(s, lc); -+ -+ // Report progress so we can use our MVs in other frames -+ if ((ctb_flags & CTB_TS_FLAGS_EOL) != 0) -+ ff_hevc_rpi_progress_signal_mv(s, y_ctb + ctb_size - 1); -+ -+ // End of line || End of tile line || End of tile -+ // (EoL covers end of frame for our purposes here) -+ q_full = ((ctb_flags & CTB_TS_FLAGS_EOTL) != 0); -+ -+ // Allocate QPU chunks on fixed size 64 pel boundries rather than -+ // whatever ctb_size is today. -+ // * We might quite like to continue to 64 pel vertical too but that -+ // currently confuses WPP -+ if (((x_ctb + ctb_size) & 63) == 0 || q_full) -+ { -+ int overflow = 0; -+ if (rpi_inter_pred_next_ctu(&jb->luma_ip) != 0) -+ overflow = 1; -+ if (rpi_inter_pred_next_ctu(&jb->chroma_ip) != 0) -+ overflow = 1; -+ if (overflow) -+ { -+ // * This is very annoying (and slow) to cope with in WPP so -+ // we treat it as an error there (no known stream triggers this -+ // with the current buffer sizes). Non-wpp should cope fine. -+ av_log(s->avctx, AV_LOG_WARNING, "%s: Q full before EoL\n", __func__); -+ q_full = 1; -+ } -+ } -+ -+ // Inc TS to next. -+ ctb_addr_ts++; -+ ctb_addr_rs++; -+ x_ctb += ctb_size; -+ -+ if (q_full) -+ { -+ // Do job -+ // Prep for submission -+ jb->ctu_ts_last = ctb_addr_ts - 1; // Was pre-inced -+ job_gen_bounds(s, jb); -+ break; -+ } -+ -+ // If max_blocks started as 0 then this will never be true -+ if (--max_blocks == 0) -+ break; -+ } -+ -+ lc->unit_done = (more_data <= 0); -+ lc->ts = ctb_addr_ts; -+ return 0; -+} -+ -+static void bt_lc_init(HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const unsigned int n) -+{ -+ lc->context = s; -+ lc->jb0 = NULL; -+ lc->lc_n = n; -+ lc->bt_terminate = 0; -+ lc->bt_psem_out = NULL; -+ sem_init(&lc->bt_sem_in, 0, 0); -+} -+ -+#define TRACE_WPP 0 -+#if RPI_EXTRA_BIT_THREADS > 0 -+static inline unsigned int line_ts_width(const HEVCRpiContext * const s, unsigned int ts) -+{ -+ unsigned int rs = s->ps.pps->ctb_addr_ts_to_rs[ts]; -+ return s->ps.pps->column_width[s->ps.pps->col_idxX[rs % s->ps.sps->ctb_width]]; -+} -+ -+// Move local context parameters from an aux bit thread back to the main -+// thread at the end of a slice as processing is going to continue there. -+static void movlc(HEVCRpiLocalContext *const dst_lc, HEVCRpiLocalContext *const src_lc, const int is_dep) -+{ -+ if (src_lc == dst_lc) { -+ return; -+ } -+ -+ // Move the job -+ // We will still have an active job if the final line terminates early -+ // Dest should always be null by now -+ av_assert1(dst_lc->jb0 == NULL); -+ dst_lc->jb0 = src_lc->jb0; -+ src_lc->jb0 = NULL; -+ -+ // Always need to store where we are in the bitstream -+ dst_lc->ts = src_lc->ts; -+ dst_lc->gb = src_lc->gb; -+ // Cabac init request will be built at start of next slice -+ -+ // Need to store context if we might have a dependent seg -+ if (is_dep) -+ { -+ dst_lc->qPy_pred = src_lc->qPy_pred; -+ memcpy(dst_lc->ipm_left, src_lc->ipm_left, sizeof(src_lc->ipm_left)); -+ memcpy(dst_lc->cabac_state, src_lc->cabac_state, sizeof(src_lc->cabac_state)); -+ memcpy(dst_lc->stat_coeff, src_lc->stat_coeff, sizeof(src_lc->stat_coeff)); -+ } -+} -+ -+static inline int wait_bt_sem_in(HEVCRpiLocalContext * const lc) -+{ -+ rpi_sem_wait(&lc->bt_sem_in); -+ return lc->bt_terminate; -+} -+ -+// Do one WPP line -+// Will not work correctly over horizontal tile boundries - vertical should be OK -+static int rpi_run_one_line(HEVCRpiContext *const s, HEVCRpiLocalContext * const lc, const int is_first) -+{ -+ const int is_tile = lc->bt_is_tile; -+ const unsigned int tile_id = s->ps.pps->tile_id[lc->ts]; -+ const unsigned int line = lc->bt_line_no; -+ const unsigned int line_inc = lc->bt_line_inc; -+ const int is_last = (line >= lc->bt_last_line); -+ -+ const unsigned int ts_eol = lc->ts + (is_tile ? s->ps.pps->tile_size[tile_id] : lc->bt_line_width); -+ const unsigned int ts_next = -+ line + line_inc > (unsigned int)s->sh.num_entry_point_offsets ? -+ INT_MAX : -+ is_tile ? -+ s->ps.pps->tile_pos_ts[tile_id + line_inc] : -+ lc->ts + lc->bt_line_width * line_inc; -+ // Tile wants line, WPP a few CTUs (must be >= 2 for cabac context to work) -+ const unsigned int partial_size = is_tile ? line_ts_width(s, lc->ts) : 2; -+ unsigned int ts_prev; -+ int loop_n = 0; -+ int err = 0; -+ -+ av_assert1(line <= s->sh.num_entry_point_offsets); -+ -+#if TRACE_WPP -+ printf("%s[%d]: Start %s: tile=%d, line=%d/%d/%d, ts=%d/%d/%d, width=%d, jb=%p\n", __func__, -+ lc->lc_n, is_tile ? "Tile" : "WPP", tile_id, -+ line, lc->bt_last_line, s->sh.num_entry_point_offsets, -+ lc->ts, ts_eol, ts_next, partial_size, lc->jb0); -+#endif -+ if (line != 0) -+ { -+ const uint8_t * const data = s->data + s->sh.offset[line - 1]; -+ const unsigned int len = s->sh.size[line - 1]; -+ if ((err = init_get_bits8(&lc->gb, data, len)) < 0) -+ return err; -+ -+ ff_init_cabac_decoder(&lc->cc, data, len); -+ } -+ -+ // We should never be processing a dependent slice here so reset is good -+ // ?? These probably shouldn't be needed (as they should be set by later -+ // logic) but do seem to be required -+ lc->qp_y = s->sh.slice_qp; -+ -+ do -+ { -+ if (!is_last && loop_n > 1) { -+#if TRACE_WPP -+ printf("%s[%d]: %sPoke %p\n", __func__, lc->lc_n, err == 0 ? "" : "ERR: ", lc->bt_psem_out); -+#endif -+ sem_post(lc->bt_psem_out); -+ } -+ // The wait for loop_n == 0 has been done in bit_thread -+ if (!is_first && loop_n != 0) -+ { -+#if TRACE_WPP -+ printf("%s[%d]: %sWait %p\n", __func__, lc->lc_n, err == 0 ? "" : "ERR: ", &lc->bt_sem_in); -+#endif -+ if (wait_bt_sem_in(lc) != 0) -+ return AVERROR_EXIT; -+ } -+ -+#if TRACE_WPP -+ { -+ int n; -+ sem_getvalue(&lc->bt_sem_in, &n); -+ printf("%s[%d]: ts=%d, sem=%d %p\n", __func__, lc->lc_n, lc->ts, n, &lc->bt_sem_in); -+ } -+#endif -+ -+ ts_prev = lc->ts; -+ -+ // If we have had an error - do no further decode but do continue -+ // moving signals around so the other threads continue to operate -+ // correctly (or at least as correctly as they can with this line missing) -+ // -+ // Errors in WPP/Tile are less fatal than normal as we have a good idea -+ // of how to restart on the next line so there is no need to give up totally -+ if (err != 0) -+ { -+ lc->unit_done = 0; -+ lc->ts += partial_size; -+ } -+ else -+ { -+ worker_pass0_ready(s, lc); -+ -+ if ((err = fill_job(s, lc, partial_size)) < 0 || -+ (lc->ts < ts_eol && !is_last && (lc->ts != ts_prev + partial_size || lc->unit_done))) -+ { -+ if (err == 0) { -+ av_log(s->avctx, AV_LOG_ERROR, "Unexpected end of tile/wpp section\n"); -+ err = AVERROR_INVALIDDATA; -+ } -+ worker_free(s, lc); -+ lc->ts = ts_prev + partial_size; // Pretend we did all that -+ lc->unit_done = 0; -+ } -+ else if (is_tile) -+ { -+ worker_submit_job(s, lc); -+ } -+ } -+ -+ ++loop_n; -+ } while (lc->ts < ts_eol && !lc->unit_done); -+ -+ // If we are on the last line & we didn't get a whole line we must wait for -+ // and sink the sem_posts from the line above / tile to the left. -+ while ((ts_prev += partial_size) < ts_eol) -+ { -+#if TRACE_WPP -+ printf("%s[%d]: EOL Wait: ts=%d %p\n", __func__, lc->lc_n, ts_prev, &lc->bt_sem_in); -+#endif -+ if (wait_bt_sem_in(lc) != 0) -+ return AVERROR_EXIT; -+ } -+ -+ lc->bt_line_no += line_inc; -+ -+ if (!is_tile && err == 0) -+ worker_submit_job(s, lc); -+ -+ if (!is_last) { -+ lc->ts = ts_next; -+ -+#if TRACE_WPP -+ printf("%s[%d]: Poke post submit %p\n", __func__, lc->lc_n, lc->bt_psem_out); -+#endif -+ sem_post(lc->bt_psem_out); -+ if (loop_n > 1) { -+#if TRACE_WPP -+ printf("%s[%d]: Poke post submit2 %p\n", __func__, lc->lc_n, lc->bt_psem_out); -+#endif -+ sem_post(lc->bt_psem_out); -+ } -+ } -+ else -+ { -+ movlc(s->HEVClcList[0], lc, s->ps.pps->dependent_slice_segments_enabled_flag); // * & not EoT -+#if MVF_STASH_WIDTH > 64 -+ // Horrid calculations to work out what we want but luckily this should almost never execute -+ // **** Move to movlc -+ if (!s->is_irap) -+ { -+ const unsigned int ctb_flags = s->ps.pps->ctb_ts_flags[lc->ts]; -+ if ((ctb_flags & CTB_TS_FLAGS_EOTL) == 0) // If EOTL then we have already stashed mvf -+ { -+ const unsigned int x_ctb = ((s->ps.pps->ctb_addr_ts_to_rs[lc->ts] % s->ps.sps->ctb_width) << s->ps.sps->log2_ctb_size) - 1; -+ unsigned int i; -+ const HEVCRpiMvField *s_mvf = lc->mvf_stash + ((x_ctb >> LOG2_MIN_PU_SIZE) & (MVF_STASH_WIDTH_PU - 1)); -+ HEVCRpiMvField *d_mvf = s->HEVClcList[0]->mvf_stash + ((x_ctb >> LOG2_MIN_PU_SIZE) & (MVF_STASH_WIDTH_PU - 1)); -+ -+ for (i = 0; i != MVF_STASH_HEIGHT_PU; ++i) -+ { -+ *d_mvf = *s_mvf; -+ d_mvf += MVF_STASH_WIDTH_PU; -+ s_mvf += MVF_STASH_WIDTH_PU; -+ } -+ -+ } -+ } -+#endif -+ // When all done poke the thread 0 sem_in one final time -+#if TRACE_WPP -+ printf("%s[%d]: Poke final %p\n", __func__, lc->lc_n, &s->HEVClcList[0]->bt_sem_in); -+#endif -+ sem_post(&s->HEVClcList[0]->bt_sem_in); -+ } -+ -+#if TRACE_WPP -+ printf("%s[%d]: End. dep=%d\n", __func__, lc->lc_n, s->ps.pps->dependent_slice_segments_enabled_flag); -+#endif -+ return err; -+} -+ -+static void wpp_setup_lcs(HEVCRpiContext * const s) -+{ -+ unsigned int ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr]; -+ const unsigned int line_width = line_ts_width(s, ts); -+ -+ for (int i = 0; i <= s->sh.num_entry_point_offsets && i < RPI_BIT_THREADS; ++i) -+ { -+ HEVCRpiLocalContext * const lc = s->HEVClcList[i]; -+ lc->ts = ts; -+ lc->bt_is_tile = 0; -+ lc->bt_line_no = i; -+ lc->bt_line_width = line_width; -+ lc->bt_last_line = s->sh.num_entry_point_offsets; -+ lc->bt_line_inc = RPI_BIT_THREADS; -+ ts += line_width; -+ } -+} -+ -+ -+// Can only process tile single row at once -+static void tile_one_row_setup_lcs(HEVCRpiContext * const s, unsigned int slice_row) -+{ -+ const HEVCRpiPPS * const pps = s->ps.pps; -+ const unsigned int ts0 = pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr]; -+ const unsigned int tile0 = pps->tile_id[ts0]; -+ const unsigned int col0 = tile0 % pps->num_tile_columns; -+ -+ const unsigned int col = (slice_row == 0) ? col0 : 0; -+ unsigned int line = slice_row * pps->num_tile_columns - col0 + col; -+ const unsigned int last_line = FFMIN( -+ line + pps->num_tile_columns - 1 - col, s->sh.num_entry_point_offsets); -+ -+ const unsigned int par = -+ FFMIN(RPI_BIT_THREADS, last_line + 1 - line); -+#if TRACE_WPP -+ printf("ts0=%d, ents=%d, row=%d, tiles=%dx%d, col=%d, par=%d, line=%d/%d\n", ts0, s->sh.num_entry_point_offsets, slice_row, -+ pps->num_tile_columns, pps->num_tile_rows, col, par, line, last_line); -+#endif -+ for (unsigned int i = 0; i != par; ++i, ++line) -+ { -+ HEVCRpiLocalContext * const lc = s->HEVClcList[i]; -+ const unsigned int tile = tile0 + line; -+ -+ lc->ts = pps->tile_pos_ts[tile]; -+ lc->bt_line_no = line; -+ lc->bt_is_tile = 1; -+ lc->bt_line_width = line_ts_width(s, lc->ts); -+ lc->bt_last_line = last_line; -+ lc->bt_line_inc = par; -+ } -+} -+ -+ -+static void * bit_thread(void * v) -+{ -+ HEVCRpiLocalContext * const lc = v; -+ HEVCRpiContext *const s = lc->context; -+ -+ while (wait_bt_sem_in(lc) == 0) -+ { -+ int err; -+ -+ if ((err = rpi_run_one_line(s, lc, 0)) < 0) { // Never first tile/wpp -+ if (lc->bt_terminate) { -+ av_log(s->avctx, AV_LOG_ERROR, "%s: Unexpected termination\n", __func__); -+ break; -+ } -+ av_log(s->avctx, AV_LOG_WARNING, "%s: Decode failure: %d\n", __func__, err); -+ } -+ } -+ -+ return NULL; -+} -+ -+static int bit_threads_start(HEVCRpiContext * const s) -+{ -+ if (s->bt_started) -+ return 0; -+ -+ for (int i = 1; i < RPI_BIT_THREADS; ++i) -+ { -+ // lc[0] belongs to the main thread - this sets up lc[1..RPI_BIT_THREADS] -+ if (s->HEVClcList[i] == NULL) { -+ if ((s->HEVClcList[i] = av_mallocz(sizeof(*s->HEVClcList[0]))) == NULL) -+ return -1; -+ } -+ -+ bt_lc_init(s, s->HEVClcList[i], i); -+ job_lc_init(s->HEVClcList[i]); -+ } -+ -+ // Link the sems in a circle -+ for (int i = 0; i < RPI_BIT_THREADS - 1; ++i) -+ s->HEVClcList[i]->bt_psem_out = &s->HEVClcList[i + 1]->bt_sem_in; -+ s->HEVClcList[RPI_BIT_THREADS - 1]->bt_psem_out = &s->HEVClcList[0]->bt_sem_in; -+ -+ // Init all lc before starting any threads -+ for (int i = 0; i < RPI_EXTRA_BIT_THREADS; ++i) -+ { -+ if (pthread_create(s->bit_threads + i, NULL, bit_thread, s->HEVClcList[i + 1]) < 0) -+ return -1; -+ } -+ -+ s->bt_started = 1; -+ return 0; -+} -+ -+static int bit_threads_kill(HEVCRpiContext * const s) -+{ -+ if (!s->bt_started) -+ return 0; -+ s->bt_started = 0; -+ -+ for (int i = 0; i < RPI_EXTRA_BIT_THREADS; ++i) -+ { -+ HEVCRpiLocalContext *const lc = s->HEVClcList[i + 1]; -+ if (lc == NULL) -+ break; -+ -+ lc->bt_terminate = 1; -+ sem_post(&lc->bt_sem_in); -+ pthread_join(s->bit_threads[i], NULL); -+ -+ sem_destroy(&lc->bt_sem_in); -+ job_lc_kill(lc); -+ } -+ return 0; -+} -+#endif -+ -+ -+// If we are at EoT and the row is shorter than the number of jobs -+// we can Q we have to wait for it finish otherwise we risk cache/QPU -+// disasters -+static inline int tile_needs_wait(const HEVCRpiContext * const s, const int n) -+{ -+ return -+ s->ps.pps->tile_wpp_inter_disable >= 2 && -+ s->sh.slice_type != HEVC_SLICE_I && -+ n >= 0 && -+ (s->ps.pps->ctb_ts_flags[n] & (CTB_TS_FLAGS_EOT | CTB_TS_FLAGS_EOL)) == CTB_TS_FLAGS_EOT; -+} -+ -+static int rpi_decode_entry(AVCodecContext *avctxt, void *isFilterThread) -+{ -+ HEVCRpiContext * const s = avctxt->priv_data; -+ HEVCRpiLocalContext * const lc = s->HEVClc; -+ int err; -+ -+ // Start of slice -+ if ((err = slice_start(s, lc)) != 0) -+ return err; -+ -+#if RPI_EXTRA_BIT_THREADS > 0 -+ -+ if (s->sh.offload_tiles) -+ { -+ unsigned int slice_row = 0; -+ -+#if TRACE_WPP -+ printf("%s: Do Tiles\n", __func__); -+#endif -+ // Generate & start extra bit threads if they aren't already running -+ bit_threads_start(s); -+ -+ do -+ { -+ // Reset lc lines etc. -+ tile_one_row_setup_lcs(s, slice_row); -+ -+#if TRACE_WPP -+ printf("%s: Row %d: Do 1st: line=%d/%d/%d\n", -+ __func__, slice_row, lc->bt_line_no, lc->bt_last_line, s->sh.num_entry_point_offsets); -+#endif -+ -+ rpi_run_one_line(s, lc, 1); // Kicks off the other threads -+#if TRACE_WPP -+ printf("%s: Row %d: Done 1st: line=%d/%d/%d\n", -+ __func__, slice_row, lc->bt_line_no, lc->bt_last_line, s->sh.num_entry_point_offsets); -+#endif -+ -+ while (lc->bt_line_no <= lc->bt_last_line) { -+ rpi_sem_wait(&lc->bt_sem_in); -+ rpi_run_one_line(s, lc, 0); -+ } -+#if TRACE_WPP -+ printf("%s: Done body\n", __func__); -+#endif -+ -+ // Wait for everything else to finish -+ rpi_sem_wait(&lc->bt_sem_in); -+ -+ ++slice_row; -+ } while (lc->bt_last_line < s->sh.num_entry_point_offsets); -+ -+ -+#if TRACE_WPP -+ printf("%s: Done wait: ts=%d\n", __func__, lc->ts); -+#endif -+ } -+ else if (s->sh.offload_wpp) -+ { -+#if TRACE_WPP -+ printf("%s: Do WPP\n", __func__); -+#endif -+ // Generate & start extra bit threads if they aren't already running -+ bit_threads_start(s); -+ -+ // Reset lc lines etc. -+ wpp_setup_lcs(s); -+ -+ rpi_run_one_line(s, lc, 1); // Kicks off the other threads -+#if TRACE_WPP -+ printf("%s: Done 1st\n", __func__); -+#endif -+ -+ while (lc->bt_line_no <= s->sh.num_entry_point_offsets) { -+ rpi_sem_wait(&lc->bt_sem_in); -+ rpi_run_one_line(s, lc, 0); -+ } -+#if TRACE_WPP -+ printf("%s: Done body\n", __func__); -+#endif -+ -+ // Wait for everything else to finish -+ rpi_sem_wait(&lc->bt_sem_in); -+ -+#if TRACE_WPP -+ printf("%s: Done wait: ts=%d\n", __func__, lc->ts); -+#endif -+ } -+ else -+#endif -+ { -+#if TRACE_WPP -+ printf("%s: Single start: ts=%d\n", __func__, lc->ts); -+#endif -+ // Single bit thread -+ do { -+ // Make sure we have space to prepare the next job -+ worker_pass0_ready(s, lc); -+ -+ if ((err = fill_job(s, lc, 0)) < 0) -+ goto fail; -+ -+ worker_submit_job(s, lc); -+ -+ if (tile_needs_wait(s, lc->ts - 1)) -+ worker_wait(s, lc); -+ -+ } while (!lc->unit_done); -+ -+#if TRACE_WPP -+ printf("%s: Single end: ts=%d\n", __func__, lc->ts); -+#endif -+ } -+ -+ // If we have reached the end of the frame or -+ // then wait for the worker to finish all its jobs -+ if (lc->ts >= s->ps.sps->ctb_size) -+ worker_wait(s, lc); -+ -+#if RPI_TSTATS -+ { -+ HEVCRpiStats *const ts = &s->tstats; -+ -+ printf("=== P: xy00:%5d/%5d/%5d/%5d h16gl:%5d/%5d w8gl:%5d/%5d y8m:%d\n B: xy00:%5d/%5d/%5d/%5d h16gl:%5d/%5d\n", -+ ts->y_pred1_xy, ts->y_pred1_x0, ts->y_pred1_y0, ts->y_pred1_x0y0, -+ ts->y_pred1_hgt16, ts->y_pred1_hle16, ts->y_pred1_wgt8, ts->y_pred1_wle8, ts->y_pred1_y8_merge, -+ ts->y_pred2_xy, ts->y_pred2_x0, ts->y_pred2_y0, ts->y_pred2_x0y0, -+ ts->y_pred2_hgt16, ts->y_pred2_hle16); -+ memset(ts, 0, sizeof(*ts)); -+ } -+#endif -+ -+ return lc->ts; -+ -+fail: -+ // Cleanup -+ av_log(s->avctx, AV_LOG_ERROR, "%s failed: err=%d\n", __func__, err); -+ // Free our job & wait for temination -+ worker_free(s, lc); -+ worker_wait(s, lc); -+ return err; -+} -+ -+ -+static void set_no_backward_pred(HEVCRpiContext * const s) -+{ -+ int i, j; -+ const RefPicList *const refPicList = s->refPicList; -+ -+ s->no_backward_pred_flag = 0; -+ if (s->sh.slice_type != HEVC_SLICE_B || !s->sh.slice_temporal_mvp_enabled_flag) -+ return; -+ -+ for (j = 0; j < 2; j++) { -+ for (i = 0; i < refPicList[j].nb_refs; i++) { -+ if (refPicList[j].list[i] > s->poc) { -+ s->no_backward_pred_flag = 1; -+ return; -+ } -+ } -+ } -+} -+ -+static int hls_slice_data(HEVCRpiContext * const s, const H2645NAL * const nal) -+{ -+ int err; -+ if ((err = gen_entry_points(s, nal)) < 0) -+ return err; -+ -+ set_no_backward_pred(s); -+ -+ return rpi_decode_entry(s->avctx, NULL); -+} -+ -+static int set_side_data(HEVCRpiContext *s) -+{ -+ AVFrame *out = s->ref->frame; -+ -+ if (s->sei.frame_packing.present && -+ s->sei.frame_packing.arrangement_type >= 3 && -+ s->sei.frame_packing.arrangement_type <= 5 && -+ s->sei.frame_packing.content_interpretation_type > 0 && -+ s->sei.frame_packing.content_interpretation_type < 3) { -+ AVStereo3D *stereo = av_stereo3d_create_side_data(out); -+ if (!stereo) -+ return AVERROR(ENOMEM); -+ -+ switch (s->sei.frame_packing.arrangement_type) { -+ case 3: -+ if (s->sei.frame_packing.quincunx_subsampling) -+ stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX; -+ else -+ stereo->type = AV_STEREO3D_SIDEBYSIDE; -+ break; -+ case 4: -+ stereo->type = AV_STEREO3D_TOPBOTTOM; -+ break; -+ case 5: -+ stereo->type = AV_STEREO3D_FRAMESEQUENCE; -+ break; -+ } -+ -+ if (s->sei.frame_packing.content_interpretation_type == 2) -+ stereo->flags = AV_STEREO3D_FLAG_INVERT; -+ -+ if (s->sei.frame_packing.arrangement_type == 5) { -+ if (s->sei.frame_packing.current_frame_is_frame0_flag) -+ stereo->view = AV_STEREO3D_VIEW_LEFT; -+ else -+ stereo->view = AV_STEREO3D_VIEW_RIGHT; -+ } -+ } -+ -+ if (s->sei.display_orientation.present && -+ (s->sei.display_orientation.anticlockwise_rotation || -+ s->sei.display_orientation.hflip || s->sei.display_orientation.vflip)) { -+ double angle = s->sei.display_orientation.anticlockwise_rotation * 360 / (double) (1 << 16); -+ AVFrameSideData *rotation = av_frame_new_side_data(out, -+ AV_FRAME_DATA_DISPLAYMATRIX, -+ sizeof(int32_t) * 9); -+ if (!rotation) -+ return AVERROR(ENOMEM); -+ -+ av_display_rotation_set((int32_t *)rotation->data, angle); -+ av_display_matrix_flip((int32_t *)rotation->data, -+ s->sei.display_orientation.hflip, -+ s->sei.display_orientation.vflip); -+ } -+ -+ // Decrement the mastering display flag when IRAP frame has no_rasl_output_flag=1 -+ // so the side data persists for the entire coded video sequence. -+ if (s->sei.mastering_display.present > 0 && -+ IS_IRAP(s) && s->no_rasl_output_flag) { -+ s->sei.mastering_display.present--; -+ } -+ if (s->sei.mastering_display.present) { -+ // HEVC uses a g,b,r ordering, which we convert to a more natural r,g,b -+ const int mapping[3] = {2, 0, 1}; -+ const int chroma_den = 50000; -+ const int luma_den = 10000; -+ int i; -+ AVMasteringDisplayMetadata *metadata = -+ av_mastering_display_metadata_create_side_data(out); -+ if (!metadata) -+ return AVERROR(ENOMEM); -+ -+ for (i = 0; i < 3; i++) { -+ const int j = mapping[i]; -+ metadata->display_primaries[i][0].num = s->sei.mastering_display.display_primaries[j][0]; -+ metadata->display_primaries[i][0].den = chroma_den; -+ metadata->display_primaries[i][1].num = s->sei.mastering_display.display_primaries[j][1]; -+ metadata->display_primaries[i][1].den = chroma_den; -+ } -+ metadata->white_point[0].num = s->sei.mastering_display.white_point[0]; -+ metadata->white_point[0].den = chroma_den; -+ metadata->white_point[1].num = s->sei.mastering_display.white_point[1]; -+ metadata->white_point[1].den = chroma_den; -+ -+ metadata->max_luminance.num = s->sei.mastering_display.max_luminance; -+ metadata->max_luminance.den = luma_den; -+ metadata->min_luminance.num = s->sei.mastering_display.min_luminance; -+ metadata->min_luminance.den = luma_den; -+ metadata->has_luminance = 1; -+ metadata->has_primaries = 1; -+ -+ av_log(s->avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); -+ av_log(s->avctx, AV_LOG_DEBUG, -+ "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", -+ av_q2d(metadata->display_primaries[0][0]), -+ av_q2d(metadata->display_primaries[0][1]), -+ av_q2d(metadata->display_primaries[1][0]), -+ av_q2d(metadata->display_primaries[1][1]), -+ av_q2d(metadata->display_primaries[2][0]), -+ av_q2d(metadata->display_primaries[2][1]), -+ av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); -+ av_log(s->avctx, AV_LOG_DEBUG, -+ "min_luminance=%f, max_luminance=%f\n", -+ av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance)); -+ } -+ // Decrement the mastering display flag when IRAP frame has no_rasl_output_flag=1 -+ // so the side data persists for the entire coded video sequence. -+ if (s->sei.content_light.present > 0 && -+ IS_IRAP(s) && s->no_rasl_output_flag) { -+ s->sei.content_light.present--; -+ } -+ if (s->sei.content_light.present) { -+ AVContentLightMetadata *metadata = -+ av_content_light_metadata_create_side_data(out); -+ if (!metadata) -+ return AVERROR(ENOMEM); -+ metadata->MaxCLL = s->sei.content_light.max_content_light_level; -+ metadata->MaxFALL = s->sei.content_light.max_pic_average_light_level; -+ -+ av_log(s->avctx, AV_LOG_DEBUG, "Content Light Level Metadata:\n"); -+ av_log(s->avctx, AV_LOG_DEBUG, "MaxCLL=%d, MaxFALL=%d\n", -+ metadata->MaxCLL, metadata->MaxFALL); -+ } -+ -+ if (s->sei.a53_caption.a53_caption) { -+ AVFrameSideData* sd = av_frame_new_side_data(out, -+ AV_FRAME_DATA_A53_CC, -+ s->sei.a53_caption.a53_caption_size); -+ if (sd) -+ memcpy(sd->data, s->sei.a53_caption.a53_caption, s->sei.a53_caption.a53_caption_size); -+ av_freep(&s->sei.a53_caption.a53_caption); -+ s->sei.a53_caption.a53_caption_size = 0; -+ s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS; -+ } -+ -+ if (s->sei.alternative_transfer.present && -+ av_color_transfer_name(s->sei.alternative_transfer.preferred_transfer_characteristics) && -+ s->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) { -+ s->avctx->color_trc = out->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics; -+ } -+ -+ return 0; -+} -+ -+static int hevc_frame_start(HEVCRpiContext * const s) -+{ -+ int ret; -+ -+ memset(s->bs_horizontal, 0, s->bs_size * 2); // Does V too -+ memset(s->is_pcm, 0, s->ps.sps->pcm_width * s->ps.sps->pcm_height); -+ memset(s->tab_slice_address, -1, s->ps.sps->ctb_size * sizeof(*s->tab_slice_address)); -+ -+ // Only need to remember intra for CIP -+ if (!s->ps.pps->constrained_intra_pred_flag || s->is_irap) -+ s->is_intra = NULL; -+ else -+ { -+ s->is_intra = s->is_intra_store; -+ memset(s->is_intra, 0, s->ps.sps->pcm_width * s->ps.sps->pcm_height); -+ } -+ -+ s->is_decoded = 0; -+ s->first_nal_type = s->nal_unit_type; -+ -+ s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos); -+ -+ if (s->pkt.nb_nals > s->rpl_tab_size) -+ { -+ // In most cases it will be faster to free & realloc as that doesn't -+ // require (an unwanted) copy -+ av_freep(&s->rpl_tab); -+ s->rpl_tab_size = 0; -+ if ((s->rpl_tab = av_malloc(s->pkt.nb_nals * sizeof(*s->rpl_tab))) == NULL) -+ goto fail; -+ s->rpl_tab_size = s->pkt.nb_nals; -+ } -+ memset(s->rpl_tab, 0, s->pkt.nb_nals * sizeof(*s->rpl_tab)); -+ -+ ret = ff_hevc_rpi_set_new_ref(s, &s->frame, s->poc); -+ if (ret < 0) -+ goto fail; -+ -+ // Resize rpl_tab to max that we might want -+ ret = ff_hevc_rpi_frame_rps(s); -+ if (ret < 0) { -+ av_log(s->avctx, AV_LOG_ERROR, "Error constructing the frame RPS.\n"); -+ goto fail; -+ } -+ -+ s->ref->frame->key_frame = IS_IRAP(s); -+ -+ ret = set_side_data(s); -+ if (ret < 0) -+ goto fail; -+ -+ s->frame->pict_type = 3 - s->sh.slice_type; -+ -+ if (!IS_IRAP(s)) -+ ff_hevc_rpi_bump_frame(s); -+ -+ av_frame_unref(s->output_frame); -+ ret = ff_hevc_rpi_output_frame(s, s->output_frame, 0); -+ if (ret < 0) -+ goto fail; -+ -+ ff_thread_finish_setup(s->avctx); -+ -+ return 0; -+ -+fail: -+ if (s->ref) -+ ff_hevc_rpi_unref_frame(s, s->ref, ~0); -+ s->ref = NULL; -+ return ret; -+} -+ -+static inline int is_non_ref_unit_type(const unsigned int nal_unit_type) -+{ -+ // From Table 7-1 -+ return (nal_unit_type & ~0xe) == 0; // True for 0, 2, 4, 6, 8, 10, 12, 14 -+} -+ -+static int decode_nal_unit(HEVCRpiContext *s, const H2645NAL *nal) -+{ -+ GetBitContext * const gb = &s->HEVClc->gb; -+ int ctb_addr_ts, ret; -+ -+ *gb = nal->gb; -+ s->nal_unit_type = nal->type; -+ s->temporal_id = nal->temporal_id; -+ -+ switch (s->nal_unit_type) { -+ case HEVC_NAL_VPS: -+ ret = ff_hevc_rpi_decode_nal_vps(gb, s->avctx, &s->ps); -+ if (ret < 0) -+ goto fail; -+ break; -+ case HEVC_NAL_SPS: -+ ret = ff_hevc_rpi_decode_nal_sps(gb, s->avctx, &s->ps, -+ s->apply_defdispwin); -+ if (ret < 0) -+ goto fail; -+ break; -+ case HEVC_NAL_PPS: -+ ret = ff_hevc_rpi_decode_nal_pps(gb, s->avctx, &s->ps); -+ if (ret < 0) -+ goto fail; -+ break; -+ case HEVC_NAL_SEI_PREFIX: -+ case HEVC_NAL_SEI_SUFFIX: -+ ret = ff_hevc_rpi_decode_nal_sei(gb, s->avctx, &s->sei, &s->ps, s->nal_unit_type); -+ if (ret < 0) -+ goto fail; -+ break; -+ case HEVC_NAL_TRAIL_R: -+ case HEVC_NAL_TRAIL_N: -+ case HEVC_NAL_TSA_N: -+ case HEVC_NAL_TSA_R: -+ case HEVC_NAL_STSA_N: -+ case HEVC_NAL_STSA_R: -+ case HEVC_NAL_BLA_W_LP: -+ case HEVC_NAL_BLA_W_RADL: -+ case HEVC_NAL_BLA_N_LP: -+ case HEVC_NAL_IDR_W_RADL: -+ case HEVC_NAL_IDR_N_LP: -+ case HEVC_NAL_CRA_NUT: -+ case HEVC_NAL_RADL_N: -+ case HEVC_NAL_RADL_R: -+ case HEVC_NAL_RASL_N: -+ case HEVC_NAL_RASL_R: -+ ret = hls_slice_header(s); -+ if (ret < 0) -+ return ret; -+ -+ // The definition of _N unit types is "non-reference for other frames -+ // with the same temporal_id" so they may/will be ref frames for pics -+ // with a higher temporal_id. -+ s->used_for_ref = s->ps.sps->max_sub_layers > s->temporal_id + 1 || -+ !is_non_ref_unit_type(s->nal_unit_type); -+ s->offload_recon = s->threads_type != 0 && s->used_for_ref; -+ s->is_irap = IS_IRAP(s); -+ -+#if DEBUG_DECODE_N -+ { -+ static int z = 0; -+ if (IS_IDR(s)) { -+ z = 1; -+ } -+ if (z != 0 && z++ > DEBUG_DECODE_N) { -+ s->is_decoded = 0; -+ break; -+ } -+ } -+#endif -+ if ( -+ (s->avctx->skip_frame >= AVDISCARD_NONREF && !s->used_for_ref) || -+ (s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || -+ (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) || -+ (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IRAP(s))) -+ { -+ s->is_decoded = 0; -+ break; -+ } -+ -+ if (s->sh.first_slice_in_pic_flag) { -+ if (s->max_ra == INT_MAX) { -+ if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { -+ s->max_ra = s->poc; -+ } else { -+ if (IS_IDR(s)) -+ s->max_ra = INT_MIN; -+ } -+ } -+ -+ if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && -+ s->poc <= s->max_ra) { -+ s->is_decoded = 0; -+ break; -+ } else { -+ if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra) -+ s->max_ra = INT_MIN; -+ } -+ -+ ret = hevc_frame_start(s); -+ if (ret < 0) -+ return ret; -+ } else if (!s->ref) { -+ av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n"); -+ goto fail; -+ } -+ -+ if (s->nal_unit_type != s->first_nal_type) { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "Non-matching NAL types of the VCL NALUs: %d %d\n", -+ s->first_nal_type, s->nal_unit_type); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ if (!s->sh.dependent_slice_segment_flag && -+ s->sh.slice_type != HEVC_SLICE_I) { -+ ret = ff_hevc_rpi_slice_rpl(s); -+ if (ret < 0) { -+ av_log(s->avctx, AV_LOG_WARNING, -+ "Error constructing the reference lists for the current slice.\n"); -+ goto fail; -+ } -+ } -+ -+ ctb_addr_ts = hls_slice_data(s, nal); -+ if (ctb_addr_ts >= s->ps.sps->ctb_size) { -+ s->is_decoded = 1; -+ } -+ -+ if (ctb_addr_ts < 0) { -+ ret = ctb_addr_ts; -+ goto fail; -+ } -+ break; -+ case HEVC_NAL_EOS_NUT: -+ case HEVC_NAL_EOB_NUT: -+ s->seq_decode = (s->seq_decode + 1) & 0xff; -+ s->max_ra = INT_MAX; -+ break; -+ case HEVC_NAL_AUD: -+ case HEVC_NAL_FD_NUT: -+ break; -+ default: -+ av_log(s->avctx, AV_LOG_INFO, -+ "Skipping NAL unit %d\n", s->nal_unit_type); -+ } -+ -+ return 0; -+fail: -+ if (s->avctx->err_recognition & AV_EF_EXPLODE) -+ return ret; -+ return 0; -+} -+ -+static int decode_nal_units(HEVCRpiContext *s, const uint8_t *buf, int length) -+{ -+ int i, ret = 0; -+ int eos_at_start = 1; -+ -+ s->ref = NULL; -+ s->last_eos = s->eos; -+ s->eos = 0; -+ -+ /* split the input packet into NAL units, so we know the upper bound on the -+ * number of slices in the frame */ -+ ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx, s->is_nalff, -+ s->nal_length_size, s->avctx->codec_id, 0, 0); -+ if (ret < 0) { -+ av_log(s->avctx, AV_LOG_ERROR, -+ "Error splitting the input into NAL units.\n"); -+ return ret; -+ } -+ -+ for (i = 0; i < s->pkt.nb_nals; i++) { -+ if (s->pkt.nals[i].type == HEVC_NAL_EOB_NUT || -+ s->pkt.nals[i].type == HEVC_NAL_EOS_NUT) { -+ if (eos_at_start) { -+ s->last_eos = 1; -+ } else { -+ s->eos = 1; -+ } -+ } else { -+ eos_at_start = 0; -+ } -+ } -+ -+ /* decode the NAL units */ -+ for (i = 0; i < s->pkt.nb_nals; i++) { -+ ret = decode_nal_unit(s, &s->pkt.nals[i]); -+ if (ret < 0) { -+ av_log(s->avctx, AV_LOG_WARNING, -+ "Error parsing NAL unit #%d.\n", i); -+ goto fail; -+ } -+ } -+ -+fail: // Also success path -+ if (s->ref != NULL) { -+ if (s->used_for_ref && s->threads_type != 0) { -+ ff_hevc_rpi_progress_signal_all_done(s); -+ } -+ else { -+ // Flush frame to real memory as we expect to be able to pass -+ // it straight on to mmal -+ flush_frame(s, s->frame); -+ } -+ } -+ return ret; -+} -+ -+static void print_md5(void *log_ctx, int level, uint8_t md5[16]) -+{ -+ int i; -+ for (i = 0; i < 16; i++) -+ av_log(log_ctx, level, "%02"PRIx8, md5[i]); -+} -+ -+static int verify_md5(HEVCRpiContext *s, AVFrame *frame) -+{ -+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); -+ int pixel_shift; -+ int i, j; -+ -+ if (!desc) -+ return AVERROR(EINVAL); -+ -+ pixel_shift = desc->comp[0].depth > 8; -+ -+ av_log(s->avctx, AV_LOG_DEBUG, "Verifying checksum for frame with POC %d: ", -+ s->poc); -+ -+ /* the checksums are LE, so we have to byteswap for >8bpp formats -+ * on BE arches */ -+#if HAVE_BIGENDIAN -+ if (pixel_shift && !s->checksum_buf) { -+ av_fast_malloc(&s->checksum_buf, &s->checksum_buf_size, -+ FFMAX3(frame->linesize[0], frame->linesize[1], -+ frame->linesize[2])); -+ if (!s->checksum_buf) -+ return AVERROR(ENOMEM); -+ } -+#endif -+ -+ for (i = 0; frame->data[i]; i++) { -+ int width = s->avctx->coded_width; -+ int height = s->avctx->coded_height; -+ int w = (i == 1 || i == 2) ? (width >> desc->log2_chroma_w) : width; -+ int h = (i == 1 || i == 2) ? (height >> desc->log2_chroma_h) : height; -+ uint8_t md5[16]; -+ -+ av_md5_init(s->md5_ctx); -+ for (j = 0; j < h; j++) { -+ const uint8_t *src = frame->data[i] + j * frame_stride1(frame, 1); -+#if HAVE_BIGENDIAN -+ if (pixel_shift) { -+ s->bdsp.bswap16_buf((uint16_t *) s->checksum_buf, -+ (const uint16_t *) src, w); -+ src = s->checksum_buf; -+ } -+#endif -+ av_md5_update(s->md5_ctx, src, w << pixel_shift); -+ } -+ av_md5_final(s->md5_ctx, md5); -+ -+ if (!memcmp(md5, s->sei.picture_hash.md5[i], 16)) { -+ av_log (s->avctx, AV_LOG_DEBUG, "plane %d - correct ", i); -+ print_md5(s->avctx, AV_LOG_DEBUG, md5); -+ av_log (s->avctx, AV_LOG_DEBUG, "; "); -+ } else { -+ av_log (s->avctx, AV_LOG_ERROR, "mismatching checksum of plane %d - ", i); -+ print_md5(s->avctx, AV_LOG_ERROR, md5); -+ av_log (s->avctx, AV_LOG_ERROR, " != "); -+ print_md5(s->avctx, AV_LOG_ERROR, s->sei.picture_hash.md5[i]); -+ av_log (s->avctx, AV_LOG_ERROR, "\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ } -+ -+ av_log(s->avctx, AV_LOG_DEBUG, "\n"); -+ -+ return 0; -+} -+ -+static int all_sps_supported(const HEVCRpiContext * const s) -+{ -+ for (unsigned int i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) { -+ if (s->ps.sps_list[i] != NULL) -+ { -+ const HEVCRpiSPS * const sps = (const HEVCRpiSPS*)s->ps.sps_list[i]->data; -+ if (!is_sps_supported(sps)) -+ return 0; -+ } -+ } -+ return 1; -+} -+ -+static int hevc_rpi_decode_extradata(HEVCRpiContext *s, uint8_t *buf, int length, int first) -+{ -+ int ret, i; -+ -+ ret = ff_hevc_rpi_decode_extradata(buf, length, &s->ps, &s->sei, &s->is_nalff, -+ &s->nal_length_size, s->avctx->err_recognition, -+ s->apply_defdispwin, s->avctx); -+ if (ret < 0) -+ return ret; -+ -+ /* export stream parameters from the first SPS */ -+ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) { -+ if (first && s->ps.sps_list[i]) { -+ const HEVCRpiSPS *sps = (const HEVCRpiSPS*)s->ps.sps_list[i]->data; -+ export_stream_params(s->avctx, &s->ps, sps); -+ break; -+ } -+ } -+ -+ return 0; -+} -+ -+static int hevc_rpi_decode_frame(AVCodecContext *avctx, void *data, int *got_output, -+ AVPacket *avpkt) -+{ -+ int ret; -+ int new_extradata_size; -+ uint8_t *new_extradata; -+ HEVCRpiContext *s = avctx->priv_data; -+ -+ if (!avpkt->size) { -+ ret = ff_hevc_rpi_output_frame(s, data, 1); -+ if (ret < 0) -+ return ret; -+ -+ *got_output = ret; -+ return 0; -+ } -+ -+ new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, -+ &new_extradata_size); -+ if (new_extradata && new_extradata_size > 0) { -+ ret = hevc_rpi_decode_extradata(s, new_extradata, new_extradata_size, 0); -+ if (ret < 0) -+ return ret; -+ } -+ -+ s->ref = NULL; -+ ret = decode_nal_units(s, avpkt->data, avpkt->size); -+ if (ret < 0) -+ return ret; -+ -+ /* verify the SEI checksum */ -+ if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded && -+ s->sei.picture_hash.is_md5) { -+ ret = verify_md5(s, s->ref->frame); -+ if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) { -+ ff_hevc_rpi_unref_frame(s, s->ref, ~0); -+ return ret; -+ } -+ } -+ s->sei.picture_hash.is_md5 = 0; -+ -+ if (s->is_decoded) { -+ av_log(avctx, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc); -+ s->is_decoded = 0; -+ } -+ -+ if (s->output_frame->buf[0]) { -+ av_frame_move_ref(data, s->output_frame); -+ *got_output = 1; -+ } -+ -+ return avpkt->size; -+} -+ -+static int hevc_ref_frame(HEVCRpiContext *s, HEVCRpiFrame *dst, HEVCRpiFrame *src) -+{ -+ int ret; -+ -+ ret = ff_thread_ref_frame(&dst->tf, &src->tf); -+ if (ret < 0) -+ return ret; -+ -+ if (src->col_mvf_buf != NULL) -+ { -+ dst->col_mvf_buf = av_buffer_ref(src->col_mvf_buf); -+ if (!dst->col_mvf_buf) -+ goto fail; -+ } -+ dst->col_mvf = src->col_mvf; -+ -+ dst->poc = src->poc; -+ dst->flags = src->flags; -+ dst->sequence = src->sequence; -+ return 0; -+ -+fail: -+ ff_hevc_rpi_unref_frame(s, dst, ~0); -+ return AVERROR(ENOMEM); -+} -+ -+ -+static av_cold int hevc_decode_free(AVCodecContext *avctx) -+{ -+ HEVCRpiContext * const s = avctx->priv_data; -+ int i; -+ -+ pic_arrays_free(s); -+ -+ av_freep(&s->md5_ctx); -+ -+ av_freep(&s->cabac_save); -+ -+#if RPI_EXTRA_BIT_THREADS -+ bit_threads_kill(s); -+#endif -+ -+ hevc_exit_worker(s); -+ for (i = 0; i != 2; ++i) { -+ ff_hevc_rpi_progress_kill_state(s->progress_states + i); -+ } -+ job_lc_kill(s->HEVClc); -+ -+ av_freep(&s->sao_pixel_buffer_h[0]); // [1] & [2] allocated with [0] -+ av_freep(&s->sao_pixel_buffer_v[0]); -+ av_frame_free(&s->output_frame); -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { -+ ff_hevc_rpi_unref_frame(s, &s->DPB[i], ~0); -+ av_frame_free(&s->DPB[i].frame); -+ } -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.vps_list); i++) -+ av_buffer_unref(&s->ps.vps_list[i]); -+ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) -+ av_buffer_unref(&s->ps.sps_list[i]); -+ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++) -+ av_buffer_unref(&s->ps.pps_list[i]); -+ s->ps.sps = NULL; -+ s->ps.pps = NULL; -+ s->ps.vps = NULL; -+ -+ // Free separately from sLists as used that way by RPI WPP -+ for (i = 0; i < MAX_NB_THREADS && s->HEVClcList[i] != NULL; ++i) { -+ av_freep(s->HEVClcList + i); -+ } -+ s->HEVClc = NULL; // Allocated as part of HEVClcList -+ -+ ff_h2645_packet_uninit(&s->pkt); -+ -+ if (s->qpu_init_ok) -+ vpu_qpu_term(); -+ s->qpu_init_ok = 0; -+ -+ return 0; -+} -+ -+ -+static av_cold int hevc_init_context(AVCodecContext *avctx) -+{ -+ HEVCRpiContext *s = avctx->priv_data; -+ int i; -+ -+ s->avctx = avctx; -+ -+ s->HEVClc = av_mallocz(sizeof(HEVCRpiLocalContext)); -+ if (!s->HEVClc) -+ goto fail; -+ s->HEVClcList[0] = s->HEVClc; -+ -+ if (vpu_qpu_init() != 0) -+ goto fail; -+ s->qpu_init_ok = 1; -+ -+#if RPI_QPU_EMU_Y || RPI_QPU_EMU_C -+ { -+ static const uint32_t dframe[1] = {0x80808080}; -+ s->qpu_dummy_frame_emu = (const uint8_t *)dframe; -+ } -+#endif -+#if !RPI_QPU_EMU_Y || !RPI_QPU_EMU_C -+ s->qpu_dummy_frame_qpu = qpu_dummy(); -+#endif -+ -+ bt_lc_init(s, s->HEVClc, 0); -+ job_lc_init(s->HEVClc); -+ -+ for (i = 0; i != 2; ++i) { -+ ff_hevc_rpi_progress_init_state(s->progress_states + i); -+ } -+ -+ if ((s->cabac_save = av_malloc(sizeof(*s->cabac_save))) == NULL) -+ goto fail; -+ -+ if ((s->output_frame = av_frame_alloc()) == NULL) -+ goto fail; -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { -+ s->DPB[i].frame = av_frame_alloc(); -+ if (!s->DPB[i].frame) -+ goto fail; -+ s->DPB[i].tf.f = s->DPB[i].frame; -+ s->DPB[i].dpb_no = i; -+ } -+ -+ s->max_ra = INT_MAX; -+ -+ if ((s->md5_ctx = av_md5_alloc()) == NULL) -+ goto fail; -+ -+ s->context_initialized = 1; -+ s->eos = 0; -+ -+ ff_hevc_rpi_reset_sei(&s->sei); -+ -+ return 0; -+ -+fail: -+ av_log(s->avctx, AV_LOG_ERROR, "%s: Failed\n", __func__); -+ hevc_decode_free(avctx); -+ return AVERROR(ENOMEM); -+} -+ -+#if HAVE_THREADS -+static int hevc_update_thread_context(AVCodecContext *dst, -+ const AVCodecContext *src) -+{ -+ HEVCRpiContext *s = dst->priv_data; -+ HEVCRpiContext *s0 = src->priv_data; -+ int i, ret; -+ -+ av_assert0(s->context_initialized); -+ -+ // dst == src can happen according to the comments and in that case -+ // there is nothing to do here -+ if (dst == src) -+ return 0; -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { -+ ff_hevc_rpi_unref_frame(s, &s->DPB[i], ~0); -+ if (s0->DPB[i].frame->buf[0]) { -+ ret = hevc_ref_frame(s, &s->DPB[i], &s0->DPB[i]); -+ if (ret < 0) -+ return ret; -+ } -+ } -+ -+ if (s->ps.sps != s0->ps.sps) -+ s->ps.sps = NULL; -+ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.vps_list); i++) { -+ av_buffer_unref(&s->ps.vps_list[i]); -+ if (s0->ps.vps_list[i]) { -+ s->ps.vps_list[i] = av_buffer_ref(s0->ps.vps_list[i]); -+ if (!s->ps.vps_list[i]) -+ return AVERROR(ENOMEM); -+ } -+ } -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) { -+ av_buffer_unref(&s->ps.sps_list[i]); -+ if (s0->ps.sps_list[i]) { -+ s->ps.sps_list[i] = av_buffer_ref(s0->ps.sps_list[i]); -+ if (!s->ps.sps_list[i]) -+ return AVERROR(ENOMEM); -+ } -+ } -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++) { -+ av_buffer_unref(&s->ps.pps_list[i]); -+ if (s0->ps.pps_list[i]) { -+ s->ps.pps_list[i] = av_buffer_ref(s0->ps.pps_list[i]); -+ if (!s->ps.pps_list[i]) -+ return AVERROR(ENOMEM); -+ } -+ } -+ -+ if (s->ps.sps != s0->ps.sps) -+ if ((ret = set_sps(s, s0->ps.sps, src->pix_fmt)) < 0) -+ return ret; -+ -+ s->seq_decode = s0->seq_decode; -+ s->seq_output = s0->seq_output; -+ s->pocTid0 = s0->pocTid0; -+ s->max_ra = s0->max_ra; -+ s->eos = s0->eos; -+ s->no_rasl_output_flag = s0->no_rasl_output_flag; -+ -+ s->is_nalff = s0->is_nalff; -+ s->nal_length_size = s0->nal_length_size; -+ -+ s->threads_type = s0->threads_type; -+ -+ if (s0->eos) { -+ s->seq_decode = (s->seq_decode + 1) & 0xff; -+ s->max_ra = INT_MAX; -+ } -+ -+ s->sei.frame_packing = s0->sei.frame_packing; -+ s->sei.display_orientation = s0->sei.display_orientation; -+ s->sei.mastering_display = s0->sei.mastering_display; -+ s->sei.content_light = s0->sei.content_light; -+ s->sei.alternative_transfer = s0->sei.alternative_transfer; -+ -+ // * We do this here as it allows us to easily locate our parents -+ // global job pool, but there really should be a less nasty way -+ if (s->jbc == NULL) -+ { -+ av_assert0((s->jbc = rpi_job_ctl_new(s0->jbc->jbg)) != NULL); -+ hevc_init_worker(s); -+ } -+ -+ return 0; -+} -+#endif -+ -+#include -+static int qpu_ok(void) -+{ -+ static int is_pi3 = -1; -+ if (is_pi3 == -1) -+ { -+ struct stat sb; -+ is_pi3 = (stat("/dev/rpivid-intcmem", &sb) != 0); -+ } -+ return is_pi3; -+} -+ -+static av_cold int hevc_decode_init(AVCodecContext *avctx) -+{ -+ HEVCRpiContext *s = avctx->priv_data; -+ int ret; -+ -+ if (!qpu_ok()) -+ return AVERROR_DECODER_NOT_FOUND; -+ -+ if ((ret = hevc_init_context(avctx)) < 0) -+ return ret; -+ -+ // If we are a child context then stop now -+ // Everything after this point is either 1st decode setup or global alloc -+ // that must not be repeated -+ // Global info will be copied into children in update_thread_context (we -+ // can't do it here as we have no way of finding the parent context) -+ if (avctx->internal->is_copy) -+ return 0; -+ -+ // Job allocation requires VCSM alloc to work so ensure that we have it -+ // initialised by this point -+ { -+ HEVCRpiJobGlobal * const jbg = jbg_new(FFMAX(avctx->thread_count * 3, 5)); -+ if (jbg == NULL) { -+ av_log(s->avctx, AV_LOG_ERROR, "%s: Job global init failed\n", __func__); -+ ret = AVERROR(ENOMEM); -+ goto fail; -+ } -+ -+ if ((s->jbc = rpi_job_ctl_new(jbg)) == NULL) { -+ av_log(s->avctx, AV_LOG_ERROR, "%s: Job ctl init failed\n", __func__); -+ ret = AVERROR(ENOMEM); -+ goto fail; -+ } -+ } -+ -+ hevc_init_worker(s); -+ -+ s->eos = 1; -+ -+ if (avctx->extradata_size > 0 && avctx->extradata) { -+ if ((ret = hevc_rpi_decode_extradata(s, avctx->extradata, avctx->extradata_size, 1)) < 0) -+ goto fail; -+ -+ if (!all_sps_supported(s)) { -+ ret = AVERROR_DECODER_NOT_FOUND; -+ goto fail; -+ } -+ } -+ -+ if((avctx->active_thread_type & FF_THREAD_FRAME) && avctx->thread_count > 1) -+ s->threads_type = FF_THREAD_FRAME; -+ else -+ s->threads_type = 0; -+ -+ return 0; -+ -+fail: -+ hevc_decode_free(avctx); -+ return ret; -+} -+ -+static void hevc_decode_flush(AVCodecContext *avctx) -+{ -+ HEVCRpiContext *s = avctx->priv_data; -+ ff_hevc_rpi_flush_dpb(s); -+ s->max_ra = INT_MAX; -+ s->eos = 1; -+} -+ -+typedef struct hwaccel_rpi3_qpu_env_s { -+ const AVClass *av_class; -+ AVZcEnvPtr zc; -+} hwaccel_rpi3_qpu_env_t; -+ -+static int hwaccel_alloc_frame(AVCodecContext *s, AVFrame *frame) -+{ -+ hwaccel_rpi3_qpu_env_t * const r3 = s->internal->hwaccel_priv_data; -+ int rv; -+ -+ if (av_rpi_zc_in_use(s)) -+ { -+ rv = s->get_buffer2(s, frame, 0); -+ } -+ else -+ { -+ rv = av_rpi_zc_get_buffer(r3->zc, frame); -+ if (rv == 0) -+ rv = av_rpi_zc_resolve_frame(frame, ZC_RESOLVE_ALLOC_VALID); // actually do the alloc -+ } -+ -+ if (rv == 0 && -+ (rv = ff_attach_decode_data(frame)) < 0) -+ { -+ av_frame_unref(frame); -+ } -+ -+ return rv; -+} -+ -+static int hwaccel_rpi3_qpu_free(AVCodecContext *avctx) -+{ -+ hwaccel_rpi3_qpu_env_t * const r3 = avctx->internal->hwaccel_priv_data; -+ av_rpi_zc_int_env_freep(&r3->zc); -+ return 0; -+} -+ -+static int hwaccel_rpi3_qpu_init(AVCodecContext *avctx) -+{ -+ hwaccel_rpi3_qpu_env_t * const r3 = avctx->internal->hwaccel_priv_data; -+ -+ if ((r3->zc = av_rpi_zc_int_env_alloc(avctx)) == NULL) -+ goto fail; -+ -+ return 0; -+ -+fail: -+ av_log(avctx, AV_LOG_ERROR, "Rpi3 QPU init failed\n"); -+ hwaccel_rpi3_qpu_free(avctx); -+ return AVERROR(ENOMEM); -+} -+ -+ -+#define OFFSET(x) offsetof(HEVCRpiContext, x) -+#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) -+ -+ -+static const AVOption options[] = { -+ { "apply_defdispwin", "Apply default display window from VUI", OFFSET(apply_defdispwin), -+ AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, PAR }, -+ { "strict-displaywin", "stricly apply default display window size", OFFSET(apply_defdispwin), -+ AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, PAR }, -+ { NULL }, -+}; -+ -+static const AVClass hevc_rpi_decoder_class = { -+ .class_name = "HEVC RPI decoder", -+ .item_name = av_default_item_name, -+ .option = options, -+ .version = LIBAVUTIL_VERSION_INT, -+}; -+ -+static const enum AVPixelFormat hevc_rpi_pix_fmts[] = { -+ AV_PIX_FMT_SAND128, -+ AV_PIX_FMT_SAND64_10, -+ AV_PIX_FMT_NONE -+}; -+ -+ -+static const AVHWAccel hwaccel_rpi3_qpu = { -+ .name = "Pi3 QPU Hwaccel", -+ .alloc_frame = hwaccel_alloc_frame, -+ .init = hwaccel_rpi3_qpu_init, -+ .uninit = hwaccel_rpi3_qpu_free, -+ .priv_data_size = sizeof(hwaccel_rpi3_qpu_env_t), -+ .caps_internal = HWACCEL_CAP_ASYNC_SAFE | HWACCEL_CAP_MT_SAFE, -+}; -+ -+static const AVCodecHWConfigInternal hevc_rpi_hw_config_sand128 = -+{ -+ .public = { -+ .pix_fmt = AV_PIX_FMT_SAND128, -+ .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC, -+ .device_type = AV_HWDEVICE_TYPE_NONE, -+ }, -+ .hwaccel = &hwaccel_rpi3_qpu -+}; -+static const AVCodecHWConfigInternal hevc_rpi_hw_config_sand64_10 = -+{ -+ .public = { -+ .pix_fmt = AV_PIX_FMT_SAND64_10, -+ .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC, -+ .device_type = AV_HWDEVICE_TYPE_NONE, -+ }, -+ .hwaccel = &hwaccel_rpi3_qpu -+}; -+ -+ -+static const AVCodecHWConfigInternal *hevc_rpi_hw_configs[] = { -+ &hevc_rpi_hw_config_sand128, -+ &hevc_rpi_hw_config_sand64_10, -+ NULL -+}; -+ -+ -+AVCodec ff_hevc_rpi_decoder = { -+ .name = "hevc_rpi", -+ .long_name = NULL_IF_CONFIG_SMALL("HEVC (rpi)"), -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = AV_CODEC_ID_HEVC, -+ .priv_data_size = sizeof(HEVCRpiContext), -+ .priv_class = &hevc_rpi_decoder_class, -+ .init = hevc_decode_init, -+ .close = hevc_decode_free, -+ .decode = hevc_rpi_decode_frame, -+ .flush = hevc_decode_flush, -+ .update_thread_context = ONLY_IF_THREADS_ENABLED(hevc_update_thread_context), -+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | -+ AV_CODEC_CAP_HARDWARE | -+ AV_CODEC_CAP_AVOID_PROBING | -+#if 0 -+ // Debugging is often easier without threads getting in the way -+ 0, -+#warning H265 threading turned off -+#else -+ // We only have decent optimisation for frame - so only admit to that -+ AV_CODEC_CAP_FRAME_THREADS, -+#endif -+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | -+ FF_CODEC_CAP_EXPORTS_CROPPING | -+ FF_CODEC_CAP_ALLOCATE_PROGRESS, -+ .pix_fmts = hevc_rpi_pix_fmts, -+ .profiles = NULL_IF_CONFIG_SMALL(ff_hevc_profiles), -+ .hw_configs = hevc_rpi_hw_configs, -+// .wrapper_name = "hevc_rpi", -+}; -+ ---- /dev/null -+++ b/libavcodec/rpi_hevcdec.h -@@ -0,0 +1,1091 @@ -+/* -+ * HEVC video decoder -+ * -+ * Copyright (C) 2012 - 2013 Guillaume Martres -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifndef AVCODEC_RPI_HEVCDEC_H -+#define AVCODEC_RPI_HEVCDEC_H -+ -+#include "config.h" -+ -+#include -+ -+#include "libavutil/buffer.h" -+ -+#include "avcodec.h" -+#include "bswapdsp.h" -+#include "cabac.h" -+#include "get_bits.h" -+#include "rpi_hevcpred.h" -+#include "h2645_parse.h" -+#include "hevc.h" -+#include "rpi_hevc_mv.h" -+#include "rpi_hevc_ps.h" -+#include "rpi_hevc_sei.h" -+#include "rpi_hevcdsp.h" -+#include "internal.h" -+#include "thread.h" -+#include "videodsp.h" -+ -+#if ARCH_ARM -+#include "arm/rpi_hevc_misc_neon.h" -+#endif -+ -+#define MAX_NB_THREADS 16 -+#define SHIFT_CTB_WPP 2 -+ -+//TODO: check if this is really the maximum -+#define MAX_TRANSFORM_DEPTH 5 -+ -+#define MAX_TB_SIZE 32 -+#define MAX_QP 51 -+#define DEFAULT_INTRA_TC_OFFSET 2 -+ -+#define HEVC_CONTEXTS 199 -+ -+#define MRG_MAX_NUM_CANDS 5 -+ -+#define HEVC_MAX_CTB_SIZE (1 << HEVC_MAX_LOG2_CTB_SIZE) // 64 -+ -+// Size of DPB array -+#define HEVC_DPB_ELS 32 -+ -+#define L0 0 -+#define L1 1 -+ -+#define EPEL_EXTRA_BEFORE 1 -+#define EPEL_EXTRA_AFTER 2 -+#define EPEL_EXTRA 3 -+#define QPEL_EXTRA_BEFORE 3 -+#define QPEL_EXTRA_AFTER 4 -+#define QPEL_EXTRA 7 -+ -+#define EDGE_EMU_BUFFER_STRIDE 80 -+ -+#include -+#include "rpi_qpu.h" -+ -+// Max jobs per frame thread. Actual usage will be limited by the size -+// of the global job pool -+// ?? Limits -+#define RPI_MAX_JOBS 8 -+ -+// This is the number of _extra_ bit threads - we will have -+// RPI_EXTRA_BIT_THREADS+1 threads actually doing the processing -+// -+// 0 is legitimate and will disable our WPP processing -+//#define RPI_EXTRA_BIT_THREADS 0 -+#define RPI_EXTRA_BIT_THREADS 2 -+ -+// Number of separate threads/passes in worker -+// 2 and 3 are the currently valid numbers -+// At the moment 3 seems fractionally faster -+//#define RPI_PASSES 2 -+#define RPI_PASSES 3 -+ -+// Print out various usage stats -+#define RPI_TSTATS 0 -+ -+// Define RPI_COMPRESS_COEFFS to 1 to send coefficients in compressed form -+#define RPI_COMPRESS_COEFFS 1 -+ -+// Wait for VPU/QPU to finish in worker pass 0 -+// If 0 then the wait is in pass 1 -+// -+// One might expect the better place to wait would be in pass 1 however -+// testing shows that pass 0 produces overall faster decode. -+// Interestingly it is QPU/VPU limited streams that seem to suffer -+// from pass 1 waits, CPU limited ones tend to show a very mild gain. -+// This define exists so it is easy to test this. -+#define RPI_WORKER_WAIT_PASS_0 1 -+ -+// Use ARM emulation of QPU pred -+// These are for debug only as the emulation makes only limited -+// effort to be fast -+#define RPI_QPU_EMU_Y 0 -+#define RPI_QPU_EMU_C 0 -+ -+// Max width & height we are prepared to consider -+// Sand frame shape calc becomes confused with large frames -+// Some buffer alloc also depends on this -+#define HEVC_RPI_MAX_WIDTH 2048 -+#define HEVC_RPI_MAX_HEIGHT 1088 -+ -+ -+// Min CTB size is 16 -+#define HEVC_RPI_MAX_CTBS ((HEVC_RPI_MAX_WIDTH + 15) / 16) * ((HEVC_RPI_MAX_HEIGHT + 15) / 16) -+ -+/** -+ * Value of the luma sample at position (x, y) in the 2D array tab. -+ */ -+#define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)]) -+#define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)]) -+ -+#define IS_IDR(s) ((s)->nal_unit_type == HEVC_NAL_IDR_W_RADL || (s)->nal_unit_type == HEVC_NAL_IDR_N_LP) -+#define IS_BLA(s) ((s)->nal_unit_type == HEVC_NAL_BLA_W_RADL || (s)->nal_unit_type == HEVC_NAL_BLA_W_LP || \ -+ (s)->nal_unit_type == HEVC_NAL_BLA_N_LP) -+#define IS_IRAP(s) ((s)->nal_unit_type >= 16 && (s)->nal_unit_type <= 23) -+ -+enum RPSType { -+ ST_CURR_BEF = 0, -+ ST_CURR_AFT, -+ ST_FOLL, -+ LT_CURR, -+ LT_FOLL, -+ NB_RPS_TYPE, -+}; -+ -+enum SyntaxElement { -+ SAO_MERGE_FLAG = 0, -+ SAO_TYPE_IDX, -+ SAO_EO_CLASS, -+ SAO_BAND_POSITION, -+ SAO_OFFSET_ABS, -+ SAO_OFFSET_SIGN, -+ END_OF_SLICE_FLAG, -+ SPLIT_CODING_UNIT_FLAG, -+ CU_TRANSQUANT_BYPASS_FLAG, -+ SKIP_FLAG, -+ CU_QP_DELTA, -+ PRED_MODE_FLAG, -+ PART_MODE, -+ PCM_FLAG, -+ PREV_INTRA_LUMA_PRED_FLAG, -+ MPM_IDX, -+ REM_INTRA_LUMA_PRED_MODE, -+ INTRA_CHROMA_PRED_MODE, -+ MERGE_FLAG, -+ MERGE_IDX, -+ INTER_PRED_IDC, -+ REF_IDX_L0, -+ REF_IDX_L1, -+ ABS_MVD_GREATER0_FLAG, -+ ABS_MVD_GREATER1_FLAG, -+ ABS_MVD_MINUS2, -+ MVD_SIGN_FLAG, -+ MVP_LX_FLAG, -+ NO_RESIDUAL_DATA_FLAG, -+ SPLIT_TRANSFORM_FLAG, -+ CBF_LUMA, -+ CBF_CB_CR, -+ TRANSFORM_SKIP_FLAG, -+ EXPLICIT_RDPCM_FLAG, -+ EXPLICIT_RDPCM_DIR_FLAG, -+ LAST_SIGNIFICANT_COEFF_X_PREFIX, -+ LAST_SIGNIFICANT_COEFF_Y_PREFIX, -+ LAST_SIGNIFICANT_COEFF_X_SUFFIX, -+ LAST_SIGNIFICANT_COEFF_Y_SUFFIX, -+ SIGNIFICANT_COEFF_GROUP_FLAG, -+ SIGNIFICANT_COEFF_FLAG, -+ COEFF_ABS_LEVEL_GREATER1_FLAG, -+ COEFF_ABS_LEVEL_GREATER2_FLAG, -+ COEFF_ABS_LEVEL_REMAINING, -+ COEFF_SIGN_FLAG, -+ LOG2_RES_SCALE_ABS, -+ RES_SCALE_SIGN_FLAG, -+ CU_CHROMA_QP_OFFSET_FLAG, -+ CU_CHROMA_QP_OFFSET_IDX, -+}; -+ -+enum PartMode { -+ PART_2Nx2N = 0, -+ PART_2NxN = 1, -+ PART_Nx2N = 2, -+ PART_NxN = 3, -+ PART_2NxnU = 4, -+ PART_2NxnD = 5, -+ PART_nLx2N = 6, -+ PART_nRx2N = 7, -+}; -+ -+enum PredMode { -+ MODE_INTER = 0, -+ MODE_INTRA, -+ MODE_SKIP, -+}; -+ -+enum InterPredIdc { -+ PRED_L0 = 0, -+ PRED_L1, -+ PRED_BI, -+}; -+ -+enum PredFlag { -+ PF_INTRA = 0, -+ PF_L0, -+ PF_L1, -+ PF_BI, -+}; -+ -+enum SAOType { -+ SAO_NOT_APPLIED = 0, -+ SAO_BAND, -+ SAO_EDGE, -+ SAO_APPLIED -+}; -+ -+enum SAOEOClass { -+ SAO_EO_HORIZ = 0, -+ SAO_EO_VERT, -+ SAO_EO_135D, -+ SAO_EO_45D, -+}; -+ -+enum ScanType { -+ SCAN_DIAG = 0, -+ SCAN_HORIZ, -+ SCAN_VERT, -+}; -+ -+typedef struct RefPicList { -+ struct HEVCRpiFrame *ref[HEVC_MAX_REFS]; -+ int list[HEVC_MAX_REFS]; -+ uint8_t isLongTerm[HEVC_MAX_REFS]; -+ int nb_refs; -+} RefPicList; -+ -+typedef struct RefPicListTab { -+ RefPicList refPicList[2]; -+} RefPicListTab; -+ -+typedef struct RpiCodingUnit { -+ unsigned int x; // Passed to deblock -+ unsigned int y; -+ unsigned int x_split; -+ unsigned int y_split; -+ -+ enum PredMode pred_mode; ///< PredMode -+ enum PartMode part_mode; ///< PartMode -+ -+ // Inferred parameters -+ uint8_t intra_split_flag; ///< IntraSplitFlag -+ uint8_t max_trafo_depth; ///< MaxTrafoDepth -+ uint8_t cu_transquant_bypass_flag; -+} RpiCodingUnit; -+ -+typedef struct RpiPredictionUnit { -+ uint8_t intra_pred_mode[4]; -+ uint8_t intra_pred_mode_c[4]; -+ uint8_t chroma_mode_c[4]; -+ uint8_t merge_flag; -+} RpiPredictionUnit; -+ -+typedef struct HEVCRpiTransformUnit { -+ int8_t cu_qp_delta; -+ -+ // Inferred parameters; -+ uint8_t intra_pred_mode; -+ uint8_t intra_pred_mode_c; -+ uint8_t chroma_mode_c; -+ uint8_t is_cu_qp_delta_wanted; -+ uint8_t cu_chroma_qp_offset_wanted; -+ const int8_t * qp_divmod6[3]; -+} HEVCRpiTransformUnit; -+ -+typedef struct DBParams { -+ int8_t beta_offset; // -12 to +12 -+ int8_t tc_offset; // -12 to +12 -+} DBParams; -+ -+#define HEVC_FRAME_FLAG_OUTPUT (1 << 0) -+#define HEVC_FRAME_FLAG_SHORT_REF (1 << 1) -+#define HEVC_FRAME_FLAG_LONG_REF (1 << 2) -+#define HEVC_FRAME_FLAG_BUMPING (1 << 3) -+ -+struct HEVCRpiJob; -+ -+typedef struct HEVCRpiFrame { -+ AVFrame *frame; -+ ThreadFrame tf; -+ ColMvField *col_mvf; -+ int poc; -+ struct HEVCRpiFrame *collocated_ref; -+ -+ AVBufferRef *col_mvf_buf; -+ -+ /** -+ * A sequence counter, so that old frames are output first -+ * after a POC reset -+ */ -+ uint16_t sequence; -+ -+ /** -+ * A combination of HEVC_FRAME_FLAG_* -+ */ -+ uint8_t flags; -+ -+ // Entry no in DPB - can be used as a small unique -+ // frame identifier (within the current thread) -+ uint8_t dpb_no; -+} HEVCRpiFrame; -+ -+typedef struct HEVCRpiLocalContext { -+ HEVCRpiTransformUnit tu; -+ -+ CABACContext cc; -+ -+ // Vars that allow us to locate everything from just an lc -+ struct HEVCRpiContext * context; // ??? make const ??? -+ unsigned int lc_n; // lc list el no -+ -+ // Job wait links -+ struct HEVCRpiLocalContext * jw_next; -+ struct HEVCRpiLocalContext * jw_prev; -+ struct HEVCRpiLocalContext * ljw_next; -+ struct HEVCRpiLocalContext * ljw_prev; -+ struct HEVCRpiJob * volatile jw_job; -+ sem_t jw_sem; -+ -+ // ?? Wrap in structure ?? -+ sem_t bt_sem_in; -+ sem_t * bt_psem_out; -+ volatile int bt_terminate; -+ unsigned int ts; -+ unsigned int bt_last_line; // Last line in this bit_thread chunk -+ unsigned int bt_line_no; -+ unsigned int bt_line_width; -+ unsigned int bt_line_inc; -+ -+ struct HEVCRpiJob * jb0; -+ char unit_done; // Set once we have dealt with this slice -+ char bt_is_tile; -+ char last_progress_good; -+ char cabac_init_req; -+ -+ uint8_t cabac_state[HEVC_CONTEXTS]; -+ uint8_t stat_coeff[4]; -+ GetBitContext gb; -+ -+ uint8_t ct_depth; -+ int8_t qp_y; -+ int8_t curr_qp_y; -+ int8_t qPy_pred; -+ -+// N.B. Used by asm (neon) - do not change -+#define AVAIL_S_UR 0 -+#define AVAIL_S_U 1 -+#define AVAIL_S_UL 2 -+#define AVAIL_S_L 3 -+#define AVAIL_S_DL 4 -+ -+#define AVAIL_U (1 << AVAIL_S_U) -+#define AVAIL_L (1 << AVAIL_S_L) -+#define AVAIL_UL (1 << AVAIL_S_UL) -+#define AVAIL_UR (1 << AVAIL_S_UR) -+#define AVAIL_DL (1 << AVAIL_S_DL) -+ -+// Intra filters - same number space as avail -+#define FILTER_LIGHT 0x40 -+#define FILTER_STRONG 0x80 -+#define FILTER_EITHER (FILTER_LIGHT | FILTER_STRONG) -+ -+ uint8_t ctb_avail; -+ int end_of_ctb_x; -+ int end_of_ctb_y; -+ -+ RpiCodingUnit cu; -+ RpiPredictionUnit pu; -+ -+#define BOUNDARY_LEFT_SLICE (1 << 0) -+#define BOUNDARY_LEFT_TILE (1 << 1) -+#define BOUNDARY_UPPER_SLICE (1 << 2) -+#define BOUNDARY_UPPER_TILE (1 << 3) -+ /* properties of the boundary of the current CTB for the purposes -+ * of the deblocking filter */ -+ unsigned int boundary_flags; -+ -+#define IPM_TAB_SIZE (HEVC_MAX_CTB_SIZE >> LOG2_MIN_PU_SIZE) -+ uint8_t ipm_left[IPM_TAB_SIZE]; -+ uint8_t ipm_up[IPM_TAB_SIZE]; -+ -+//#define MVF_STASH_WIDTH 128 -+#define MVF_STASH_WIDTH 64 -+#define MVF_STASH_HEIGHT 64 -+#define MVF_STASH_WIDTH_PU (MVF_STASH_WIDTH >> LOG2_MIN_PU_SIZE) -+#define MVF_STASH_HEIGHT_PU (MVF_STASH_HEIGHT >> LOG2_MIN_PU_SIZE) -+ HEVCRpiMvField mvf_ul[1]; -+ HEVCRpiMvField mvf_stash[MVF_STASH_WIDTH_PU * MVF_STASH_HEIGHT_PU]; -+ -+ /* +7 is for subpixel interpolation, *2 for high bit depths */ -+// DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2]; -+ /* The extended size between the new edge emu buffer is abused by SAO */ -+// DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer2)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2]; -+// DECLARE_ALIGNED(32, int16_t, tmp [MAX_PB_SIZE * MAX_PB_SIZE]); -+ -+} HEVCRpiLocalContext; -+ -+// Each block can have an intra prediction and an add_residual command -+// noof-cmds(2) * max-ctu height(64) / min-transform(4) * planes(3) * MAX_WIDTH -+ -+// Sand only has 2 planes (Y/C) -+#define RPI_MAX_PRED_CMDS (2*(HEVC_MAX_CTB_SIZE/4)*2*(HEVC_RPI_MAX_WIDTH/4)) -+ -+// Command for intra prediction and transform_add of predictions to coefficients -+enum rpi_pred_cmd_e -+{ -+ RPI_PRED_ADD_RESIDUAL, -+ RPI_PRED_ADD_RESIDUAL_U, // = RPI_PRED_TRANSFORM_ADD + c_idx -+ RPI_PRED_ADD_RESIDUAL_V, // = RPI_PRED_TRANSFORM_ADD + c_idx -+ RPI_PRED_ADD_RESIDUAL_C, // Merged U+V -+ RPI_PRED_ADD_DC, -+ RPI_PRED_ADD_DC_U, // Both U & V are effectively C -+ RPI_PRED_ADD_DC_V, -+ RPI_PRED_INTRA, -+ RPI_PRED_INTRA_C, -+ RPI_PRED_I_PCM, -+ RPI_PRED_CMD_MAX -+}; -+ -+typedef struct HEVCPredCmd { -+ uint8_t type; -+ uint8_t size; // log2 "size" used by all variants -+ uint8_t avail; // i_pred - but left here as they pack well -+ uint8_t dummy; -+ union { -+ struct { // TRANSFORM_ADD -+ uint8_t * dst; -+ const int16_t * buf; -+ uint16_t stride; // Should be good enough for all pic fmts we use -+ int16_t dc; -+ } ta; -+ struct { -+ uint8_t * dst; -+ uint32_t stride; -+ int dc; -+ } dc; -+ struct { // INTRA -+ uint16_t x; -+ uint16_t y; -+ enum IntraPredMode mode; -+ } i_pred; -+ struct { // I_PCM -+ uint16_t x; -+ uint16_t y; -+ const void * src; -+ uint32_t src_len; -+ } i_pcm; -+ }; -+} HEVCPredCmd; -+ -+union qpu_mc_pred_cmd_s; -+struct qpu_mc_pred_y_p_s; -+struct qpu_mc_src_s; -+ -+typedef struct HEVCRpiInterPredQ -+{ -+ union qpu_mc_pred_cmd_u *qpu_mc_base; -+ union qpu_mc_pred_cmd_u *qpu_mc_curr; -+ struct qpu_mc_src_s *last_l0; -+ struct qpu_mc_src_s *last_l1; -+ unsigned int load; -+ uint32_t code_setup; -+ uint32_t code_sync; -+ uint32_t code_exit; -+} HEVCRpiInterPredQ; -+ -+typedef struct HEVCRpiInterPredEnv -+{ -+ HEVCRpiInterPredQ * q; -+ uint8_t n; // Number of Qs -+ uint8_t n_grp; // Number of Q in a group -+ uint8_t curr; // Current Q number (0..n-1) -+ uint8_t used; // 0 if nothing in any Q, 1 otherwise -+ uint8_t used_grp; // 0 if nothing in any Q in the current group -+ unsigned int max_fill; -+ unsigned int min_gap; -+ GPU_MEM_PTR_T gptr; -+} HEVCRpiInterPredEnv; -+ -+typedef struct HEVCRpiIntraPredEnv { -+ unsigned int n; // Number of commands -+ HEVCPredCmd * cmds; -+} HEVCRpiIntraPredEnv; -+ -+typedef struct HEVCRpiCoeffEnv { -+ unsigned int n; -+#if RPI_COMPRESS_COEFFS -+ unsigned int packed; // Equal to 1 if coefficients should be being packed -+ unsigned int packed_n; // Value of n when packed was set equal to 0 (i.e. the amount that is sent compressed). Only valid if packed==0 -+#endif -+ int16_t * buf; -+} HEVCRpiCoeffEnv; -+ -+typedef struct HEVCRpiCoeffsEnv { -+ HEVCRpiCoeffEnv s[4]; -+ GPU_MEM_PTR_T gptr; -+ void * mptr; -+} HEVCRpiCoeffsEnv; -+ -+typedef struct HEVCRpiFrameProgressWait { -+ int req; -+ struct HEVCRpiFrameProgressWait * next; -+ sem_t sem; -+} HEVCRpiFrameProgressWait; -+ -+typedef struct HEVCRpiFrameProgressState { -+ struct HEVCRpiFrameProgressWait * first; -+ struct HEVCRpiFrameProgressWait * last; -+ pthread_mutex_t lock; -+} HEVCRpiFrameProgressState; -+ -+typedef struct RpiBlk -+{ -+ unsigned int x; -+ unsigned int y; -+ unsigned int w; -+ unsigned int h; -+} RpiBlk; -+ -+typedef struct HEVCRpiJob { -+ struct HEVCRpiJob * next; // Free chain -+ struct HEVCRpiJobCtl * jbc_local; -+ const HEVCRpiSPS * sps; // sps used to set up this job -+ -+ int waited; -+ int ctu_ts_first; -+ int ctu_ts_last; -+ RpiBlk bounds; // Bounding box of job -+ -+ struct qpu_mc_pred_y_p_s * last_y8_p; -+ struct qpu_mc_src_s * last_y8_l1; -+ rpi_cache_flush_env_t * rfe; -+ -+ HEVCRpiInterPredEnv chroma_ip; -+ HEVCRpiInterPredEnv luma_ip; -+ int16_t progress_req[HEVC_DPB_ELS]; // index by dpb_no -+ HEVCRpiIntraPredEnv intra; -+ HEVCRpiCoeffsEnv coeffs; -+ HEVCRpiFrameProgressWait progress_wait; -+ sem_t sem; -+ rpi_cache_buf_t flush_buf; -+} HEVCRpiJob; -+ -+struct HEVCRpiContext; -+ -+typedef void HEVCRpiWorkerFn(const struct HEVCRpiContext * const s, HEVCRpiJob * const jb); -+ -+typedef struct HEVCRpiPassQueue -+{ -+// int pending; -+ volatile int terminate; -+ sem_t sem_in; -+ sem_t * psem_out; -+ unsigned int job_n; -+ struct HEVCRpiContext * context; // Context pointer as we get to pass a single "void * this" to the thread -+ HEVCRpiWorkerFn * worker; -+ pthread_t thread; -+ uint8_t pass_n; // Pass number - debug -+ uint8_t started; -+} HEVCRpiPassQueue; -+ -+ -+struct HEVCRpiJobGlobal; -+ -+typedef struct HEVCRpiJobCtl -+{ -+ sem_t sem_out; -+ -+ HEVCRpiJob * volatile jb1; // The job associated with this frame if unallocated - NULL if allocated -+ struct HEVCRpiJobGlobal * jbg; -+ -+ HEVCRpiLocalContext * lcw_head; -+ HEVCRpiLocalContext * lcw_tail; -+ -+ pthread_mutex_t in_lock; -+ int offload_in; -+ -+ HEVCRpiJob *offloadq[RPI_MAX_JOBS]; -+} HEVCRpiJobCtl; -+ -+ -+typedef struct HEVCRpiJobGlobal -+{ -+ intptr_t ref_count; -+ pthread_mutex_t lock; -+ HEVCRpiJob * free1; // Singly linked list of free jobs -+ HEVCRpiLocalContext * wait_head; // Double linked list of lcs waiting for a job -+ HEVCRpiLocalContext * wait_good; // Last good tail -+ HEVCRpiLocalContext * wait_tail; -+ -+} HEVCRpiJobGlobal; -+ -+#define RPI_BIT_THREADS (RPI_EXTRA_BIT_THREADS + 1) -+ -+#if RPI_TSTATS -+typedef struct HEVCRpiStats { -+ int y_pred1_y8_merge; -+ int y_pred1_xy; -+ int y_pred1_x0; -+ int y_pred1_y0; -+ int y_pred1_x0y0; -+ int y_pred1_wle8; -+ int y_pred1_wgt8; -+ int y_pred1_hle16; -+ int y_pred1_hgt16; -+ int y_pred2_xy; -+ int y_pred2_x0; -+ int y_pred2_y0; -+ int y_pred2_x0y0; -+ int y_pred2_hle16; -+ int y_pred2_hgt16; -+} HEVCRpiStats; -+#endif -+ -+typedef struct HEVCRpiCabacState -+{ -+ uint8_t rice[4]; -+ uint8_t state[HEVC_CONTEXTS]; -+} HEVCRpiCabacState; -+ -+#define HEVC_RPI_BS_STRIDE1_PEL_SHIFT 6 // 64 pels -+#define HEVC_RPI_BS_STRIDE1_PELS (1U << HEVC_RPI_BS_STRIDE1_PEL_SHIFT) -+#define HEVC_RPI_BS_STRIDE1_PEL_MASK (HEVC_RPI_BS_STRIDE1_PELS - 1) -+#define HEVC_RPI_BS_ELS_PER_BYTE_SHIFT 2 // 4 els per byte -+#define HEVC_RPI_BS_PELS_PER_EL_SHIFT 2 // 4 pels per el -+#define HEVC_RPI_BS_PELS_PER_BYTE_SHIFT (HEVC_RPI_BS_PELS_PER_EL_SHIFT + HEVC_RPI_BS_ELS_PER_BYTE_SHIFT) -+#define HEVC_RPI_BS_STRIDE1_BYTE_SHIFT (HEVC_RPI_BS_STRIDE1_PEL_SHIFT - HEVC_RPI_BS_PELS_PER_BYTE_SHIFT) -+#define HEVC_RPI_BS_STRIDE1_BYTES (1U << HEVC_RPI_BS_STRIDE1_BYTE_SHIFT) -+#define HEVC_RPI_BS_Y_SHR 3 // 8 vertical pels per row -+#define HEVC_RPI_BS_COL_BYTES_SHR (HEVC_RPI_BS_Y_SHR - HEVC_RPI_BS_STRIDE1_BYTE_SHIFT) -+ -+typedef struct HEVCRpiContext { -+ const AVClass *c; // needed by private avoptions -+ AVCodecContext *avctx; -+ -+ uint8_t threads_type; -+ char qpu_init_ok; -+ -+ /** 1 if the independent slice segment header was successfully parsed */ -+ uint8_t slice_initialized; -+ char used_for_ref; // rpi -+ char is_irap; -+ char offload_recon; -+ uint8_t eos; ///< current packet contains an EOS/EOB NAL -+ uint8_t last_eos; ///< last packet contains an EOS/EOB NAL -+ uint8_t no_backward_pred_flag; -+ uint8_t is_decoded; -+ uint8_t no_rasl_output_flag; -+ -+ -+ /** -+ * Sequence counters for decoded and output frames, so that old -+ * frames are output first after a POC reset -+ */ -+ uint16_t seq_decode; -+ uint16_t seq_output; -+ -+ int width; -+ int height; -+ -+ HEVCRpiJobCtl * jbc; -+ // cabac stash -+ // b0 skip flag -+ // b1+ ct_depth -+ uint8_t * cabac_stash_left; -+ uint8_t * cabac_stash_up; -+ -+ // Function pointers -+#if RPI_QPU_EMU_Y || RPI_QPU_EMU_C -+ const uint8_t * qpu_dummy_frame_emu; -+#endif -+#if !RPI_QPU_EMU_Y || !RPI_QPU_EMU_C -+ uint32_t qpu_dummy_frame_qpu; // Not a frame - just a bit of memory -+#endif -+ HEVCRpiQpu qpu; -+ -+ HEVCRpiFrameProgressState progress_states[2]; -+ -+ HEVCRpiCabacState *cabac_save; -+ -+ AVFrame *frame; -+ AVFrame *output_frame; -+ uint8_t *sao_pixel_buffer_h[3]; -+ uint8_t *sao_pixel_buffer_v[3]; -+ -+ unsigned int col_mvf_stride; -+ AVBufferPool *col_mvf_pool; -+ -+ RpiSAOParams *sao; -+ DBParams *deblock; -+ enum HEVCNALUnitType nal_unit_type; -+ int temporal_id; ///< temporal_id_plus1 - 1 -+ HEVCRpiFrame *ref; -+ int poc; -+ int pocTid0; -+ int slice_idx; ///< number of the slice being currently decoded -+ int max_ra; -+ -+ int8_t *qp_y_tab; -+ -+ // Deblocking block strength bitmaps -+ unsigned int bs_stride2; -+ unsigned int bs_size; -+ uint8_t *bs_horizontal; -+ uint8_t *bs_vertical; -+ uint8_t *bsf_stash_up; -+ uint8_t *bsf_stash_left; -+ -+#if HEVC_RPI_MAX_CTBS >= 0xffff -+#define TAB_SLICE_ADDR_BROKEN ~(uint32_t)0 -+ uint32_t *tab_slice_address; -+#else -+#define TAB_SLICE_ADDR_BROKEN ~(uint16_t)0 -+ uint16_t *tab_slice_address; -+#endif -+ -+ // Bitfield 1 bit per 8 pels (min pcm size) -+ uint8_t *is_pcm; -+ // Bitfield 1 bit per 8 pels (min cb size) -+ // Only needed for CIP as CIP processing is async to the main thread -+ uint8_t *is_intra; -+ -+ // PU -+ HEVCRpiMvField *mvf_up; -+ HEVCRpiMvField *mvf_left; -+ -+ const RefPicList **rpl_up; -+ const RefPicList **rpl_left; -+ RefPicList * refPicList; -+ -+ // CTB-level flags affecting loop filter operation -+ uint8_t *filter_slice_edges; -+ -+ /** used on BE to byteswap the lines for checksumming */ -+ uint8_t *checksum_buf; -+ int checksum_buf_size; -+ -+ const uint8_t *data; -+ -+ H2645Packet pkt; -+ // type of the first VCL NAL of the current frame -+ enum HEVCNALUnitType first_nal_type; -+ -+ uint8_t context_initialized; -+ int is_nalff; ///< this flag is != 0 if bitstream is encapsulated -+ ///< as a format defined in 14496-15 -+ int apply_defdispwin; -+ -+ int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4) -+ int nuh_layer_id; -+ -+ struct AVMD5 *md5_ctx; -+ -+ RefPicListTab * rpl_tab; -+ unsigned int rpl_tab_size; -+ -+ uint8_t *is_intra_store; -+ -+ RpiSliceHeader sh; -+ -+ HEVCRpiParamSets ps; -+ -+ HEVCRpiLocalContext *HEVClc; -+ HEVCRpiLocalContext *HEVClcList[MAX_NB_THREADS]; -+ -+ HEVCRpiFrame DPB[HEVC_DPB_ELS]; -+ -+ ///< candidate references for the current frame -+ RefPicList rps[5]; -+ -+ HEVCRpiPredContext hpc; -+ HEVCDSPContext hevcdsp; -+ -+ HEVCSEIContext sei; -+ -+ // Put structures that allocate non-trivial storage at the end -+ // These are mostly used indirectly so position in the structure doesn't matter -+ HEVCRpiPassQueue passq[RPI_PASSES]; -+#if RPI_EXTRA_BIT_THREADS > 0 -+ int bt_started; -+ // This simply contains thread descriptors - task setup is held elsewhere -+ pthread_t bit_threads[RPI_EXTRA_BIT_THREADS]; -+#endif -+#if RPI_TSTATS -+ HEVCRpiStats tstats; -+#endif -+} HEVCRpiContext; -+ -+/** -+ * Mark all frames in DPB as unused for reference. -+ */ -+void ff_hevc_rpi_clear_refs(HEVCRpiContext *s); -+ -+/** -+ * Drop all frames currently in DPB. -+ */ -+void ff_hevc_rpi_flush_dpb(HEVCRpiContext *s); -+ -+/** -+ * Construct the reference picture sets for the current frame. -+ */ -+int ff_hevc_rpi_frame_rps(HEVCRpiContext *s); -+ -+/** -+ * Construct the reference picture list(s) for the current slice. -+ */ -+int ff_hevc_rpi_slice_rpl(HEVCRpiContext *s); -+ -+ -+/** -+ * Get the number of candidate references for the current frame. -+ */ -+int ff_hevc_rpi_frame_nb_refs(HEVCRpiContext *s); -+ -+int ff_hevc_rpi_set_new_ref(HEVCRpiContext *s, AVFrame **frame, int poc); -+ -+/** -+ * Find next frame in output order and put a reference to it in frame. -+ * @return 1 if a frame was output, 0 otherwise -+ */ -+int ff_hevc_rpi_output_frame(HEVCRpiContext *s, AVFrame *frame, int flush); -+ -+void ff_hevc_rpi_bump_frame(HEVCRpiContext *s); -+ -+void ff_hevc_rpi_unref_frame(HEVCRpiContext *s, HEVCRpiFrame *frame, int flags); -+ -+unsigned int ff_hevc_rpi_tb_avail_flags( -+ const HEVCRpiContext * const s, const HEVCRpiLocalContext * const lc, -+ const unsigned int x, const unsigned int y, const unsigned int w, const unsigned int h); -+ -+void ff_hevc_rpi_luma_mv_merge_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, int x0, int y0, int nPbW, -+ int nPbH, int log2_cb_size, int part_idx, -+ int merge_idx, HEVCRpiMvField * const mv); -+void ff_hevc_rpi_luma_mv_mvp_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int nPbW, const unsigned int nPbH, -+ const unsigned int avail, -+ HEVCRpiMvField * const mv, -+ const unsigned int mvp_lx_flag, const unsigned int LX); -+void ff_hevc_rpi_set_qPy(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, int xBase, int yBase); -+void ff_hevc_rpi_deblocking_boundary_strengths(const HEVCRpiContext * const s, const HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int log2_trafo_size, const int is_coded_block); -+int ff_hevc_rpi_hls_filter_blk(const HEVCRpiContext * const s, const RpiBlk bounds, const int eot); -+ -+extern const uint8_t ff_hevc_rpi_qpel_extra_before[4]; -+extern const uint8_t ff_hevc_rpi_qpel_extra_after[4]; -+extern const uint8_t ff_hevc_rpi_qpel_extra[4]; -+ -+int16_t * rpi_alloc_coeff_buf(HEVCRpiJob * const jb, const int buf_no, const int n); -+ -+// arm/hevc_misc_neon.S -+// Neon coeff zap fn -+#if HAVE_NEON -+extern void rpi_zap_coeff_vals_neon(int16_t * dst, unsigned int l2ts_m2); -+#endif -+ -+void ff_hevc_rpi_progress_wait_field(const HEVCRpiContext * const s, HEVCRpiJob * const jb, -+ const HEVCRpiFrame * const ref, const int val, const int field); -+ -+void ff_hevc_rpi_progress_signal_field(HEVCRpiContext * const s, const int val, const int field); -+ -+// All of these expect that s->threads_type == FF_THREAD_FRAME -+ -+static inline void ff_hevc_rpi_progress_wait_mv(const HEVCRpiContext * const s, HEVCRpiJob * const jb, -+ const HEVCRpiFrame * const ref, const int y) -+{ -+ if (s->threads_type != 0) -+ ff_hevc_rpi_progress_wait_field(s, jb, ref, y, 1); -+} -+ -+static inline void ff_hevc_rpi_progress_signal_mv(HEVCRpiContext * const s, const int y) -+{ -+ if (s->used_for_ref && s->threads_type != 0) -+ ff_hevc_rpi_progress_signal_field(s, y, 1); -+} -+ -+static inline void ff_hevc_rpi_progress_wait_recon(const HEVCRpiContext * const s, HEVCRpiJob * const jb, -+ const HEVCRpiFrame * const ref, const int y) -+{ -+ ff_hevc_rpi_progress_wait_field(s, jb, ref, y, 0); -+} -+ -+static inline void ff_hevc_rpi_progress_signal_recon(HEVCRpiContext * const s, const int y) -+{ -+ if (s->used_for_ref && s->threads_type != 0) -+ { -+ ff_hevc_rpi_progress_signal_field(s, y, 0); -+ } -+} -+ -+static inline void ff_hevc_rpi_progress_signal_all_done(HEVCRpiContext * const s) -+{ -+ ff_hevc_rpi_progress_signal_field(s, INT_MAX, 0); -+ ff_hevc_rpi_progress_signal_field(s, INT_MAX, 1); -+} -+ -+ -+// Set all done - signal nothing (used in missing refs) -+// Works for both rpi & non-rpi -+static inline void ff_hevc_rpi_progress_set_all_done(HEVCRpiFrame * const ref) -+{ -+ if (ref->tf.progress != NULL) -+ { -+ int * const p = (int *)ref->tf.progress->data; -+ p[0] = INT_MAX; -+ p[1] = INT_MAX; -+ } -+} -+ -+#define HEVC_RPI_420_ONLY 1 -+#define HEVC_RPI_SAND128_ONLY 1 -+ -+static inline unsigned int ctx_hshift(const HEVCRpiContext * const s, const int cidx) -+{ -+#if HEVC_RPI_420_ONLY -+ return cidx == 0 ? 0 : 1; -+#else -+ return s->ps.sps->hshift[cidx]; -+#endif -+} -+ -+static inline unsigned int ctx_vshift(const HEVCRpiContext * const s, const int cidx) -+{ -+#if HEVC_RPI_420_ONLY -+ return cidx == 0 ? 0 : 1; -+#else -+ return s->ps.sps->vshift[cidx]; -+#endif -+} -+ -+static inline int ctx_cfmt(const HEVCRpiContext * const s) -+{ -+#if HEVC_RPI_420_ONLY -+ return 1; -+#else -+ return s->ps.sps->chroma_format_idc; -+#endif -+} -+ -+static inline int frame_stride1(const AVFrame * const frame, const int c_idx) -+{ -+#if HEVC_RPI_SAND128_ONLY -+ return 128; -+#else -+ return frame->linesize[c_idx]; -+#endif -+} -+ -+#if HEVC_RPI_SAND128_ONLY -+// Propagate this decision to later zc includes -+#define RPI_ZC_SAND128_ONLY 1 -+#endif -+ -+#ifndef ff_hevc_rpi_copy_vert -+static inline void ff_hevc_rpi_copy_vert(uint8_t *dst, const uint8_t *src, -+ int pixel_shift, int height, -+ ptrdiff_t stride_dst, ptrdiff_t stride_src) -+{ -+ int i; -+ switch (pixel_shift) -+ { -+ case 2: -+ for (i = 0; i < height; i++) { -+ *(uint32_t *)dst = *(uint32_t *)src; -+ dst += stride_dst; -+ src += stride_src; -+ } -+ break; -+ case 1: -+ for (i = 0; i < height; i++) { -+ *(uint16_t *)dst = *(uint16_t *)src; -+ dst += stride_dst; -+ src += stride_src; -+ } -+ break; -+ default: -+ for (i = 0; i < height; i++) { -+ *dst = *src; -+ dst += stride_dst; -+ src += stride_src; -+ } -+ break; -+ } -+} -+#endif -+ -+ -+#if MVF_STASH_WIDTH == 64 -+static inline HEVCRpiMvField* mvf_stash_ptr(const HEVCRpiContext *const s, const HEVCRpiLocalContext * const lc, -+ const unsigned int x, const unsigned int y) -+{ -+ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); -+ return (HEVCRpiMvField*)(lc->mvf_stash + ((y & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE) * MVF_STASH_WIDTH_PU + ((x & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE)); -+} -+ -+static inline HEVCRpiMvField* mvf_ptr(const HEVCRpiContext *const s, const HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int x, const unsigned int y) -+{ -+ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); -+ const unsigned int x0_ctb = x0 & mask_cs_hi; -+ const unsigned int y0_ctb = y0 & mask_cs_hi; -+ -+ return (HEVCRpiMvField *)((y < y0_ctb) ? -+ (x < x0_ctb ? lc->mvf_ul : s->mvf_up + (x >> LOG2_MIN_PU_SIZE)) : -+ (x < x0_ctb ? s->mvf_left + (y >> LOG2_MIN_PU_SIZE) : -+ lc->mvf_stash + -+ ((y & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE) * MVF_STASH_WIDTH_PU + -+ ((x & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE))); -+} -+ -+static inline unsigned int mvf_left_stride(const HEVCRpiContext *const s, -+ const unsigned int x0, -+ const unsigned int x) -+{ -+ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); -+ const unsigned int x0_ctb = x0 & mask_cs_hi; -+ return x < x0_ctb ? 1 : MVF_STASH_WIDTH_PU; -+} -+ -+#else -+static inline HEVCRpiMvField* mvf_stash_ptr(const HEVCRpiContext *const s, const HEVCRpiLocalContext * const lc, -+ const unsigned int x, const unsigned int y) -+{ -+ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); -+ return (HEVCRpiMvField*)(lc->mvf_stash + ((y & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE) * MVF_STASH_WIDTH_PU + ((x >> LOG2_MIN_PU_SIZE) & (MVF_STASH_WIDTH_PU - 1))); -+} -+ -+static inline HEVCRpiMvField* mvf_ptr(const HEVCRpiContext *const s, const HEVCRpiLocalContext * const lc, -+ const unsigned int x0, const unsigned int y0, -+ const unsigned int x, const unsigned int y) -+{ -+ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); -+ -+ const unsigned int x0_ctb = x0 & mask_cs_hi; -+ const unsigned int y0_ctb = y0 & mask_cs_hi; -+ -+ // If not in the same CTB for Y assume up -+ if (y < y0_ctb) { -+ // If not in the same CTB for X too assume up-left -+ return (HEVCRpiMvField *)(x < x0_ctb ? lc->mvf_ul : s->mvf_up + (x >> LOG2_MIN_PU_SIZE)); -+ } -+ return mvf_stash_ptr(s, lc, x, y); -+} -+ -+static inline unsigned int mvf_left_stride(const HEVCRpiContext *const s, -+ const unsigned int x0, -+ const unsigned int x) -+{ -+ return MVF_STASH_WIDTH_PU; -+} -+#endif -+ -+#endif /* AVCODEC_RPI_HEVCDEC_H */ ---- /dev/null -+++ b/libavcodec/rpi_hevcdsp.c -@@ -0,0 +1,450 @@ -+/* -+ * HEVC video decoder -+ * -+ * Copyright (C) 2012 - 2013 Guillaume Martres -+ * Copyright (C) 2013 - 2014 Pierre-Edouard Lepere -+ * Copyright (C) 2018 John Cox, Ben Avison for Raspberry Pi (Trading) -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "rpi_hevcdsp.h" -+#include "rpi_hevc_mv.h" -+ -+static const int8_t transform[32][32] = { -+ { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, -+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 }, -+ { 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4, -+ -4, -13, -22, -31, -38, -46, -54, -61, -67, -73, -78, -82, -85, -88, -90, -90 }, -+ { 90, 87, 80, 70, 57, 43, 25, 9, -9, -25, -43, -57, -70, -80, -87, -90, -+ -90, -87, -80, -70, -57, -43, -25, -9, 9, 25, 43, 57, 70, 80, 87, 90 }, -+ { 90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13, -+ 13, 38, 61, 78, 88, 90, 85, 73, 54, 31, 4, -22, -46, -67, -82, -90 }, -+ { 89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89, -+ 89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89 }, -+ { 88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22, -+ -22, -61, -85, -90, -73, -38, 4, 46, 78, 90, 82, 54, 13, -31, -67, -88 }, -+ { 87, 57, 9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87, -+ -87, -57, -9, 43, 80, 90, 70, 25, -25, -70, -90, -80, -43, 9, 57, 87 }, -+ { 85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31, -+ 31, 78, 90, 61, 4, -54, -88, -82, -38, 22, 73, 90, 67, 13, -46, -85 }, -+ { 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83, -+ 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83 }, -+ { 82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67, 4, 73, 88, 38, -+ -38, -88, -73, -4, 67, 90, 46, -31, -85, -78, -13, 61, 90, 54, -22, -82 }, -+ { 80, 9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80, -+ -80, -9, 70, 87, 25, -57, -90, -43, 43, 90, 57, -25, -87, -70, 9, 80 }, -+ { 78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46, -+ 46, 90, 38, -54, -90, -31, 61, 88, 22, -67, -85, -13, 73, 82, 4, -78 }, -+ { 75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75, -+ 75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75 }, -+ { 73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54, -+ -54, -85, 4, 88, 46, -61, -82, 13, 90, 38, -67, -78, 22, 90, 31, -73 }, -+ { 70, -43, -87, 9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70, -+ -70, 43, 87, -9, -90, -25, 80, 57, -57, -80, 25, 90, 9, -87, -43, 70 }, -+ { 67, -54, -78, 38, 85, -22, -90, 4, 90, 13, -88, -31, 82, 46, -73, -61, -+ 61, 73, -46, -82, 31, 88, -13, -90, -4, 90, 22, -85, -38, 78, 54, -67 }, -+ { 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, -+ 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64 }, -+ { 61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67, -+ -67, -54, 78, 38, -85, -22, 90, 4, -90, 13, 88, -31, -82, 46, 73, -61 }, -+ { 57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87, 9, -90, 25, 80, -57, -+ -57, 80, 25, -90, 9, 87, -43, -70, 70, 43, -87, -9, 90, -25, -80, 57 }, -+ { 54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73, -+ 73, 31, -90, 22, 78, -67, -38, 90, -13, -82, 61, 46, -88, 4, 85, -54 }, -+ { 50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50, -+ 50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50 }, -+ { 46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82, 4, 78, -+ -78, -4, 82, -73, -13, 85, -67, -22, 88, -61, -31, 90, -54, -38, 90, -46 }, -+ { 43, -90, 57, 25, -87, 70, 9, -80, 80, -9, -70, 87, -25, -57, 90, -43, -+ -43, 90, -57, -25, 87, -70, -9, 80, -80, 9, 70, -87, 25, 57, -90, 43 }, -+ { 38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82, -+ 82, -22, -54, 90, -61, -13, 78, -85, 31, 46, -90, 67, 4, -73, 88, -38 }, -+ { 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36, -+ 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36 }, -+ { 31, -78, 90, -61, 4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85, -+ -85, 46, 13, -67, 90, -73, 22, 38, -82, 88, -54, -4, 61, -90, 78, -31 }, -+ { 25, -70, 90, -80, 43, 9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25, -+ -25, 70, -90, 80, -43, -9, 57, -87, 87, -57, 9, 43, -80, 90, -70, 25 }, -+ { 22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88, -+ 88, -67, 31, 13, -54, 82, -90, 78, -46, 4, 38, -73, 90, -85, 61, -22 }, -+ { 18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18, -+ 18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18 }, -+ { 13, -38, 61, -78, 88, -90, 85, -73, 54, -31, 4, 22, -46, 67, -82, 90, -+ -90, 82, -67, 46, -22, -4, 31, -54, 73, -85, 90, -88, 78, -61, 38, -13 }, -+ { 9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9, -+ -9, 25, -43, 57, -70, 80, -87, 90, -90, 87, -80, 70, -57, 43, -25, 9 }, -+ { 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90, -+ 90, -90, 88, -85, 82, -78, 73, -67, 61, -54, 46, -38, 31, -22, 13, -4 }, -+}; -+ -+DECLARE_ALIGNED(16, const int8_t, ff_hevc_rpi_epel_filters[7][4]) = { -+ { -2, 58, 10, -2}, -+ { -4, 54, 16, -2}, -+ { -6, 46, 28, -4}, -+ { -4, 36, 36, -4}, -+ { -4, 28, 46, -6}, -+ { -2, 16, 54, -4}, -+ { -2, 10, 58, -2}, -+}; -+ -+DECLARE_ALIGNED(16, const int8_t, ff_hevc_rpi_qpel_filters[3][16]) = { -+ { -1, 4,-10, 58, 17, -5, 1, 0, -1, 4,-10, 58, 17, -5, 1, 0}, -+ { -1, 4,-11, 40, 40,-11, 4, -1, -1, 4,-11, 40, 40,-11, 4, -1}, -+ { 0, 1, -5, 17, 58,-10, 4, -1, 0, 1, -5, 17, 58,-10, 4, -1} -+}; -+ -+#define BIT_DEPTH 8 -+#include "rpi_hevcdsp_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 9 -+#include "rpi_hevcdsp_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 10 -+#include "rpi_hevcdsp_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 12 -+#include "rpi_hevcdsp_template.c" -+#undef BIT_DEPTH -+ -+static uint32_t hevc_deblocking_boundary_strengths(int pus, int dup, const HEVCRpiMvField *curr, const HEVCRpiMvField *neigh, -+ const int *curr_rpl0, const int *curr_rpl1, const int *neigh_rpl0, const int *neigh_rpl1, -+ int in_inc0, int in_inc1) -+{ -+ int shift = 32; -+ uint32_t bs = 0; -+ for (; pus > 0; pus--) { -+ int strength, out; -+ int curr_refL0 = curr_rpl0[curr->ref_idx[0]]; -+ int curr_refL1 = curr_rpl1[curr->ref_idx[1]]; -+ int nr_idx0 = neigh->ref_idx[0]; -+ int nr_idx1 = neigh->ref_idx[1]; -+ int neigh_refL0 = neigh_rpl0[nr_idx0]; -+ int neigh_refL1 = neigh_rpl1[nr_idx1]; -+ -+ av_assert0(nr_idx0 >= 0 && nr_idx0 <=31); -+ av_assert0(nr_idx1 >= 0 && nr_idx1 <=31); -+ -+#if 1 // This more directly matches the original implementation -+ if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { -+ // same L0 and L1 -+ if (curr_refL0 == neigh_refL0 && -+ curr_refL0 == curr_refL1 && -+ neigh_refL0 == neigh_refL1) { -+ if ((FFABS(MV_X(neigh->xy[0]) - MV_X(curr->xy[0])) >= 4 || FFABS(MV_Y(neigh->xy[0]) - MV_Y(curr->xy[0])) >= 4 || -+ FFABS(MV_X(neigh->xy[1]) - MV_X(curr->xy[1])) >= 4 || FFABS(MV_Y(neigh->xy[1]) - MV_Y(curr->xy[1])) >= 4) && -+ (FFABS(MV_X(neigh->xy[1]) - MV_X(curr->xy[0])) >= 4 || FFABS(MV_Y(neigh->xy[1]) - MV_Y(curr->xy[0])) >= 4 || -+ FFABS(MV_X(neigh->xy[0]) - MV_X(curr->xy[1])) >= 4 || FFABS(MV_Y(neigh->xy[0]) - MV_Y(curr->xy[1])) >= 4)) -+ strength = 1; -+ else -+ strength = 0; -+ } else if (neigh_refL0 == curr_refL0 && -+ neigh_refL1 == curr_refL1) { -+ if (FFABS(MV_X(neigh->xy[0]) - MV_X(curr->xy[0])) >= 4 || FFABS(MV_Y(neigh->xy[0]) - MV_Y(curr->xy[0])) >= 4 || -+ FFABS(MV_X(neigh->xy[1]) - MV_X(curr->xy[1])) >= 4 || FFABS(MV_Y(neigh->xy[1]) - MV_Y(curr->xy[1])) >= 4) -+ strength = 1; -+ else -+ strength = 0; -+ } else if (neigh_refL1 == curr_refL0 && -+ neigh_refL0 == curr_refL1) { -+ if (FFABS(MV_X(neigh->xy[1]) - MV_X(curr->xy[0])) >= 4 || FFABS(MV_Y(neigh->xy[1]) - MV_Y(curr->xy[0])) >= 4 || -+ FFABS(MV_X(neigh->xy[0]) - MV_X(curr->xy[1])) >= 4 || FFABS(MV_Y(neigh->xy[0]) - MV_Y(curr->xy[1])) >= 4) -+ strength = 1; -+ else -+ strength = 0; -+ } else { -+ strength = 1; -+ } -+ } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV -+ MvXY curr_mv0, neigh_mv0; -+ -+ if (curr->pred_flag & 1) { -+ curr_mv0 = curr->xy[0]; -+ } else { -+ curr_mv0 = curr->xy[1]; -+ curr_refL0 = curr_refL1; -+ } -+ -+ if (neigh->pred_flag & 1) { -+ neigh_mv0 = neigh->xy[0]; -+ } else { -+ neigh_mv0 = neigh->xy[1]; -+ neigh_refL0 = neigh_refL1; -+ } -+ -+ if (curr_refL0 == neigh_refL0) { -+ if (FFABS(MV_X(curr_mv0) - MV_X(neigh_mv0)) >= 4 || FFABS(MV_Y(curr_mv0) - MV_Y(neigh_mv0)) >= 4) -+ strength = 1; -+ else -+ strength = 0; -+ } else -+ strength = 1; -+ } else -+ strength = 1; -+#else // This has exactly the same effect, but is more suitable for vectorisation -+ MvXY curr_mv[2]; -+ MvXY neigh_mv[2]; -+ memcpy(curr_mv, curr->xy, sizeof curr_mv); -+ memcpy(neigh_mv, neigh->xy, sizeof neigh_mv); -+ -+ if (!(curr->pred_flag & 2)) { -+ curr_mv[1] = curr_mv[0]; -+ curr_refL1 = curr_refL0; -+ } -+ if (!(neigh->pred_flag & 2)) { -+ neigh_mv[1] = neigh_mv[0]; -+ neigh_refL1 = neigh_refL0; -+ } -+ if (!(curr->pred_flag & 1)) { -+ curr_mv[0] = curr_mv[1]; -+ curr_refL0 = curr_refL1; -+ } -+ if (!(neigh->pred_flag & 1)) { -+ neigh_mv[0] = neigh_mv[1]; -+ neigh_refL0 = neigh_refL1; -+ } -+ -+ strength = 1; -+ -+ strength &= (neigh_refL0 != curr_refL0) | (neigh_refL1 != curr_refL1) | -+ (FFABS(MV_X(neigh_mv[0]) - MV_X(curr_mv[0])) >= 4) | (FFABS(MV_Y(neigh_mv[0]) - MV_Y(curr_mv[0])) >= 4) | -+ (FFABS(MV_X(neigh_mv[1]) - MV_X(curr_mv[1])) >= 4) | (FFABS(MV_Y(neigh_mv[1]) - MV_Y(curr_mv[1])) >= 4); -+ -+ strength &= (neigh_refL1 != curr_refL0) | (neigh_refL0 != curr_refL1) | -+ (FFABS(MV_X(neigh_mv[1]) - MV_X(curr_mv[0])) >= 4) | (FFABS(MV_Y(neigh_mv[1]) - MV_Y(curr_mv[0])) >= 4) | -+ (FFABS(MV_X(neigh_mv[0]) - MV_X(curr_mv[1])) >= 4) | (FFABS(MV_Y(neigh_mv[0]) - MV_Y(curr_mv[1])) >= 4); -+ -+ strength |= (((curr->pred_flag + 1) ^ (neigh->pred_flag + 1)) >> 2); -+#endif -+ -+ curr += in_inc0 / sizeof (HEVCRpiMvField); -+ neigh += in_inc1 / sizeof (HEVCRpiMvField); -+ -+ for (out = dup; out > 0; out--) -+ { -+ bs = (bs >> 2) | (strength << 30); -+ shift -= 2; -+ } -+ } -+ return bs >> shift; -+} -+ -+ -+static void cpy_blk(uint8_t *dst, unsigned int stride_dst, const uint8_t *src, unsigned stride_src, unsigned int width, unsigned int height) -+{ -+ unsigned int i, j; -+ -+ if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) { -+ for (i = 0; i < height; i++) { -+ for (j = 0; j < width; j+=8) -+ AV_COPY64U(dst+j, src+j); -+ dst += stride_dst; -+ src += stride_src; -+ } -+ } else { -+ for (i = 0; i < height; i++) { -+ for (j = 0; j < width; j+=16) -+ AV_COPY128(dst+j, src+j); -+ dst += stride_dst; -+ src += stride_src; -+ } -+ } -+} -+ -+ -+ -+void ff_hevc_rpi_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth) -+{ -+#undef FUNC -+#define FUNC(a, depth) a ## _ ## depth -+ -+#undef PEL_FUNC -+#define PEL_FUNC(dst1, idx1, idx2, a, depth) \ -+ for(i = 0 ; i < 10 ; i++) \ -+{ \ -+ hevcdsp->dst1[i][idx1][idx2] = a ## _ ## depth; \ -+} -+ -+#undef EPEL_FUNCS -+#define EPEL_FUNCS(depth) \ -+ PEL_FUNC(put_hevc_epel, 0, 0, put_hevc_pel_pixels, depth); \ -+ PEL_FUNC(put_hevc_epel, 0, 1, put_hevc_epel_h, depth); \ -+ PEL_FUNC(put_hevc_epel, 1, 0, put_hevc_epel_v, depth); \ -+ PEL_FUNC(put_hevc_epel, 1, 1, put_hevc_epel_hv, depth) -+ -+#undef EPEL_UNI_FUNCS -+#define EPEL_UNI_FUNCS(depth) \ -+ PEL_FUNC(put_hevc_epel_uni, 0, 0, put_hevc_pel_uni_pixels, depth); \ -+ PEL_FUNC(put_hevc_epel_uni, 0, 1, put_hevc_epel_uni_h, depth); \ -+ PEL_FUNC(put_hevc_epel_uni, 1, 0, put_hevc_epel_uni_v, depth); \ -+ PEL_FUNC(put_hevc_epel_uni, 1, 1, put_hevc_epel_uni_hv, depth); \ -+ PEL_FUNC(put_hevc_epel_uni_w, 0, 0, put_hevc_pel_uni_w_pixels, depth); \ -+ PEL_FUNC(put_hevc_epel_uni_w, 0, 1, put_hevc_epel_uni_w_h, depth); \ -+ PEL_FUNC(put_hevc_epel_uni_w, 1, 0, put_hevc_epel_uni_w_v, depth); \ -+ PEL_FUNC(put_hevc_epel_uni_w, 1, 1, put_hevc_epel_uni_w_hv, depth) -+ -+#undef EPEL_BI_FUNCS -+#define EPEL_BI_FUNCS(depth) \ -+ PEL_FUNC(put_hevc_epel_bi, 0, 0, put_hevc_pel_bi_pixels, depth); \ -+ PEL_FUNC(put_hevc_epel_bi, 0, 1, put_hevc_epel_bi_h, depth); \ -+ PEL_FUNC(put_hevc_epel_bi, 1, 0, put_hevc_epel_bi_v, depth); \ -+ PEL_FUNC(put_hevc_epel_bi, 1, 1, put_hevc_epel_bi_hv, depth); \ -+ PEL_FUNC(put_hevc_epel_bi_w, 0, 0, put_hevc_pel_bi_w_pixels, depth); \ -+ PEL_FUNC(put_hevc_epel_bi_w, 0, 1, put_hevc_epel_bi_w_h, depth); \ -+ PEL_FUNC(put_hevc_epel_bi_w, 1, 0, put_hevc_epel_bi_w_v, depth); \ -+ PEL_FUNC(put_hevc_epel_bi_w, 1, 1, put_hevc_epel_bi_w_hv, depth) -+ -+#undef QPEL_FUNCS -+#define QPEL_FUNCS(depth) \ -+ PEL_FUNC(put_hevc_qpel, 0, 0, put_hevc_pel_pixels, depth); \ -+ PEL_FUNC(put_hevc_qpel, 0, 1, put_hevc_qpel_h, depth); \ -+ PEL_FUNC(put_hevc_qpel, 1, 0, put_hevc_qpel_v, depth); \ -+ PEL_FUNC(put_hevc_qpel, 1, 1, put_hevc_qpel_hv, depth) -+ -+#undef QPEL_UNI_FUNCS -+#define QPEL_UNI_FUNCS(depth) \ -+ PEL_FUNC(put_hevc_qpel_uni, 0, 0, put_hevc_pel_uni_pixels, depth); \ -+ PEL_FUNC(put_hevc_qpel_uni, 0, 1, put_hevc_qpel_uni_h, depth); \ -+ PEL_FUNC(put_hevc_qpel_uni, 1, 0, put_hevc_qpel_uni_v, depth); \ -+ PEL_FUNC(put_hevc_qpel_uni, 1, 1, put_hevc_qpel_uni_hv, depth); \ -+ PEL_FUNC(put_hevc_qpel_uni_w, 0, 0, put_hevc_pel_uni_w_pixels, depth); \ -+ PEL_FUNC(put_hevc_qpel_uni_w, 0, 1, put_hevc_qpel_uni_w_h, depth); \ -+ PEL_FUNC(put_hevc_qpel_uni_w, 1, 0, put_hevc_qpel_uni_w_v, depth); \ -+ PEL_FUNC(put_hevc_qpel_uni_w, 1, 1, put_hevc_qpel_uni_w_hv, depth) -+ -+#undef QPEL_BI_FUNCS -+#define QPEL_BI_FUNCS(depth) \ -+ PEL_FUNC(put_hevc_qpel_bi, 0, 0, put_hevc_pel_bi_pixels, depth); \ -+ PEL_FUNC(put_hevc_qpel_bi, 0, 1, put_hevc_qpel_bi_h, depth); \ -+ PEL_FUNC(put_hevc_qpel_bi, 1, 0, put_hevc_qpel_bi_v, depth); \ -+ PEL_FUNC(put_hevc_qpel_bi, 1, 1, put_hevc_qpel_bi_hv, depth); \ -+ PEL_FUNC(put_hevc_qpel_bi_w, 0, 0, put_hevc_pel_bi_w_pixels, depth); \ -+ PEL_FUNC(put_hevc_qpel_bi_w, 0, 1, put_hevc_qpel_bi_w_h, depth); \ -+ PEL_FUNC(put_hevc_qpel_bi_w, 1, 0, put_hevc_qpel_bi_w_v, depth); \ -+ PEL_FUNC(put_hevc_qpel_bi_w, 1, 1, put_hevc_qpel_bi_w_hv, depth) -+ -+#define SLICED_ADD_RESIDUAL(depth)\ -+ hevcdsp->add_residual_u[0] = FUNC(add_residual4x4_u, depth); \ -+ hevcdsp->add_residual_u[1] = FUNC(add_residual8x8_u, depth); \ -+ hevcdsp->add_residual_u[2] = FUNC(add_residual16x16_u, depth); \ -+ hevcdsp->add_residual_u[3] = FUNC(add_residual32x32_u, depth); \ -+ hevcdsp->add_residual_v[0] = FUNC(add_residual4x4_v, depth); \ -+ hevcdsp->add_residual_v[1] = FUNC(add_residual8x8_v, depth); \ -+ hevcdsp->add_residual_v[2] = FUNC(add_residual16x16_v, depth); \ -+ hevcdsp->add_residual_v[3] = FUNC(add_residual32x32_v, depth); \ -+ hevcdsp->add_residual_c[0] = FUNC(add_residual4x4_c, depth); \ -+ hevcdsp->add_residual_c[1] = FUNC(add_residual8x8_c, depth); \ -+ hevcdsp->add_residual_c[2] = FUNC(add_residual16x16_c, depth); \ -+ hevcdsp->add_residual_c[3] = FUNC(add_residual32x32_c, depth); \ -+ hevcdsp->add_residual_dc_c[0] = FUNC(add_residual4x4_dc_c, depth); \ -+ hevcdsp->add_residual_dc_c[1] = FUNC(add_residual8x8_dc_c, depth); \ -+ hevcdsp->add_residual_dc_c[2] = FUNC(add_residual16x16_dc_c, depth); \ -+ hevcdsp->add_residual_dc_c[3] = FUNC(add_residual32x32_dc_c, depth); \ -+ hevcdsp->put_pcm_c = FUNC(put_pcm_c, depth) -+#define SLICED_LOOP_FILTERS(depth)\ -+ hevcdsp->hevc_h_loop_filter_luma2 = FUNC(hevc_h_loop_filter_luma2, depth); \ -+ hevcdsp->hevc_v_loop_filter_luma2 = FUNC(hevc_v_loop_filter_luma2, depth); \ -+ hevcdsp->hevc_h_loop_filter_uv = FUNC(hevc_h_loop_filter_uv, depth); \ -+ hevcdsp->hevc_v_loop_filter_uv2 = FUNC(hevc_v_loop_filter_uv2, depth) -+#define SLICED_SAO(depth)\ -+ for (i = 0; i != SAO_FILTER_N; ++i) { \ -+ hevcdsp->sao_band_filter_c[i] = FUNC(sao_band_filter_c, depth); \ -+ hevcdsp->sao_edge_filter_c[i] = FUNC(sao_edge_filter_c, depth); \ -+ } \ -+ hevcdsp->sao_edge_restore_c[0] = FUNC(sao_edge_restore_c_0, depth); \ -+ hevcdsp->sao_edge_restore_c[1] = FUNC(sao_edge_restore_c_1, depth) -+ -+#define HEVC_DSP(depth) \ -+ hevcdsp->put_pcm = FUNC(put_pcm, depth); \ -+ hevcdsp->add_residual[0] = FUNC(add_residual4x4, depth); \ -+ hevcdsp->add_residual[1] = FUNC(add_residual8x8, depth); \ -+ hevcdsp->add_residual[2] = FUNC(add_residual16x16, depth); \ -+ hevcdsp->add_residual[3] = FUNC(add_residual32x32, depth); \ -+ hevcdsp->add_residual_dc[0] = FUNC(add_residual4x4_dc, depth); \ -+ hevcdsp->add_residual_dc[1] = FUNC(add_residual8x8_dc, depth); \ -+ hevcdsp->add_residual_dc[2] = FUNC(add_residual16x16_dc, depth); \ -+ hevcdsp->add_residual_dc[3] = FUNC(add_residual32x32_dc, depth); \ -+ SLICED_ADD_RESIDUAL(depth); \ -+ hevcdsp->dequant = FUNC(dequant, depth); \ -+ hevcdsp->transform_rdpcm = FUNC(transform_rdpcm, depth); \ -+ hevcdsp->transform_4x4_luma = FUNC(transform_4x4_luma, depth); \ -+ hevcdsp->idct[0] = FUNC(idct_4x4, depth); \ -+ hevcdsp->idct[1] = FUNC(idct_8x8, depth); \ -+ hevcdsp->idct[2] = FUNC(idct_16x16, depth); \ -+ hevcdsp->idct[3] = FUNC(idct_32x32, depth); \ -+ \ -+ hevcdsp->idct_dc[0] = FUNC(idct_4x4_dc, depth); \ -+ hevcdsp->idct_dc[1] = FUNC(idct_8x8_dc, depth); \ -+ hevcdsp->idct_dc[2] = FUNC(idct_16x16_dc, depth); \ -+ hevcdsp->idct_dc[3] = FUNC(idct_32x32_dc, depth); \ -+ \ -+ for (i = 0; i != SAO_FILTER_N; ++i) { \ -+ hevcdsp->sao_band_filter[i] = FUNC(sao_band_filter, depth); \ -+ hevcdsp->sao_edge_filter[i] = FUNC(sao_edge_filter, depth); \ -+ } \ -+ hevcdsp->sao_edge_restore[0] = FUNC(sao_edge_restore_0, depth); \ -+ hevcdsp->sao_edge_restore[1] = FUNC(sao_edge_restore_1, depth); \ -+ SLICED_SAO(depth); \ -+ \ -+ QPEL_FUNCS(depth); \ -+ QPEL_UNI_FUNCS(depth); \ -+ QPEL_BI_FUNCS(depth); \ -+ EPEL_FUNCS(depth); \ -+ EPEL_UNI_FUNCS(depth); \ -+ EPEL_BI_FUNCS(depth); \ -+ \ -+ SLICED_LOOP_FILTERS(depth); \ -+ hevcdsp->hevc_h_loop_filter_luma = FUNC(hevc_h_loop_filter_luma, depth); \ -+ hevcdsp->hevc_v_loop_filter_luma = FUNC(hevc_v_loop_filter_luma, depth); \ -+ hevcdsp->hevc_h_loop_filter_chroma = FUNC(hevc_h_loop_filter_chroma, depth); \ -+ hevcdsp->hevc_v_loop_filter_chroma = FUNC(hevc_v_loop_filter_chroma, depth); \ -+ hevcdsp->hevc_h_loop_filter_luma_c = FUNC(hevc_h_loop_filter_luma, depth); \ -+ hevcdsp->hevc_v_loop_filter_luma_c = FUNC(hevc_v_loop_filter_luma, depth); \ -+ hevcdsp->hevc_h_loop_filter_chroma_c = FUNC(hevc_h_loop_filter_chroma, depth); \ -+ hevcdsp->hevc_v_loop_filter_chroma_c = FUNC(hevc_v_loop_filter_chroma, depth) -+int i = 0; -+ -+ switch (bit_depth) { -+ case 9: -+ HEVC_DSP(9); -+ break; -+ case 10: -+ HEVC_DSP(10); -+ break; -+ case 12: -+ HEVC_DSP(12); -+ break; -+ default: -+ HEVC_DSP(8); -+ break; -+ } -+ -+ hevcdsp->hevc_deblocking_boundary_strengths = hevc_deblocking_boundary_strengths; -+ hevcdsp->cpy_blk = cpy_blk; -+ -+ if (ARCH_PPC) -+ ff_hevc_rpi_dsp_init_ppc(hevcdsp, bit_depth); -+ if (ARCH_X86) -+ ff_hevc_rpi_dsp_init_x86(hevcdsp, bit_depth); -+ if (ARCH_ARM) -+ ff_hevcdsp_rpi_init_arm(hevcdsp, bit_depth); -+ if (ARCH_MIPS) -+ ff_hevc_rpi_dsp_init_mips(hevcdsp, bit_depth); -+} ---- /dev/null -+++ b/libavcodec/rpi_hevcdsp.h -@@ -0,0 +1,177 @@ -+/* -+ * HEVC video decoder -+ * -+ * Copyright (C) 2012 - 2013 Guillaume Martres -+ * Copyright (C) 2013 - 2014 Pierre-Edouard Lepere -+ * -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifndef AVCODEC_RPI_HEVCDSP_H -+#define AVCODEC_RPI_HEVCDSP_H -+ -+#include "hevc.h" -+#include "get_bits.h" -+ -+struct HEVCRpiMvField; -+ -+#define MAX_PB_SIZE 64 -+ -+#define RPI_HEVC_SAO_BUF_STRIDE 160 -+ -+ -+typedef struct RpiSAOParams { -+ uint8_t band_position[3]; ///< sao_band_position (Y,U,V) -+ uint8_t eo_class[3]; ///< sao_eo_class (Y,U=V) -+ uint8_t type_idx[3]; ///< sao_type_idx (Y,U=V) -+ -+ int16_t offset_val[3][5]; ///> 16; -+ const int dc_u = (dc << 16) >> 16; -+ -+ stride /= sizeof(pixel); -+ -+ for (y = 0; y < size; y++) { -+ for (x = 0; x < size * 2; x += 2) { -+ dst[x] = av_clip_pixel(dst[x] + dc_u); -+ dst[x + 1] = av_clip_pixel(dst[x + 1] + dc_v); -+ } -+ dst += stride; -+ } -+} -+ -+ -+static void FUNC(add_residual4x4)(uint8_t *_dst, int16_t *res, -+ ptrdiff_t stride) -+{ -+ FUNC(add_residual)(_dst, res, stride, 4); -+} -+ -+static void FUNC(add_residual8x8)(uint8_t *_dst, int16_t *res, -+ ptrdiff_t stride) -+{ -+ FUNC(add_residual)(_dst, res, stride, 8); -+} -+ -+static void FUNC(add_residual16x16)(uint8_t *_dst, int16_t *res, -+ ptrdiff_t stride) -+{ -+ FUNC(add_residual)(_dst, res, stride, 16); -+} -+ -+static void FUNC(add_residual32x32)(uint8_t *_dst, int16_t *res, -+ ptrdiff_t stride) -+{ -+ FUNC(add_residual)(_dst, res, stride, 32); -+} -+ -+static void FUNC(add_residual4x4_dc)(uint8_t *_dst, ptrdiff_t stride, int dc) -+{ -+ FUNC(add_residual_dc)(_dst, stride, dc, 4); -+} -+ -+static void FUNC(add_residual8x8_dc)(uint8_t *_dst, ptrdiff_t stride, int dc) -+{ -+ FUNC(add_residual_dc)(_dst, stride, dc, 8); -+} -+ -+static void FUNC(add_residual16x16_dc)(uint8_t *_dst, ptrdiff_t stride, int dc) -+{ -+ FUNC(add_residual_dc)(_dst, stride, dc, 16); -+} -+ -+static void FUNC(add_residual32x32_dc)(uint8_t *_dst, ptrdiff_t stride, int dc) -+{ -+ FUNC(add_residual_dc)(_dst, stride, dc, 32); -+} -+ -+// -- U -- (plaited) -+ -+static void FUNC(add_residual4x4_u)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride, int dc_u) -+{ -+ FUNC(add_residual_u)(_dst, res, stride, dc_u, 4); -+} -+ -+static void FUNC(add_residual8x8_u)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride, int dc_u) -+{ -+ FUNC(add_residual_u)(_dst, res, stride, dc_u, 8); -+} -+ -+static void FUNC(add_residual16x16_u)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride, int dc_u) -+{ -+ FUNC(add_residual_u)(_dst, res, stride, dc_u, 16); -+} -+ -+static void FUNC(add_residual32x32_u)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride, int dc_u) -+{ -+ // Should never occur for 420, which is all that sand supports -+ av_assert0(0); -+} -+ -+// -- V -- (plaited) -+ -+static void FUNC(add_residual4x4_v)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride, int dc_v) -+{ -+ FUNC(add_residual_v)(_dst, res, stride, dc_v, 4); -+} -+ -+static void FUNC(add_residual8x8_v)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride, int dc_v) -+{ -+ FUNC(add_residual_v)(_dst, res, stride, dc_v, 8); -+} -+ -+static void FUNC(add_residual16x16_v)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride, int dc_v) -+{ -+ FUNC(add_residual_v)(_dst, res, stride, dc_v, 16); -+} -+ -+static void FUNC(add_residual32x32_v)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride, int dc_v) -+{ -+ // Should never occur for 420, which is all that sand supports -+ av_assert0(0); -+} -+ -+// -- C -- (plaited - both U & V) -+ -+static void FUNC(add_residual4x4_c)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride) -+{ -+ FUNC(add_residual_c)(_dst, res, stride, 4); -+} -+ -+static void FUNC(add_residual8x8_c)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride) -+{ -+ FUNC(add_residual_c)(_dst, res, stride, 8); -+} -+ -+static void FUNC(add_residual16x16_c)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride) -+{ -+ FUNC(add_residual_c)(_dst, res, stride, 16); -+} -+ -+static void FUNC(add_residual32x32_c)(uint8_t *_dst, const int16_t * res, -+ ptrdiff_t stride) -+{ -+ // Should never occur for 420, which is all that sand supports -+ av_assert0(0); -+} -+ -+static void FUNC(add_residual4x4_dc_c)(uint8_t *_dst, ptrdiff_t stride, int32_t dc) -+{ -+ FUNC(add_residual_dc_c)(_dst, stride, dc, 4); -+} -+ -+static void FUNC(add_residual8x8_dc_c)(uint8_t *_dst, ptrdiff_t stride, int32_t dc) -+{ -+ FUNC(add_residual_dc_c)(_dst, stride, dc, 8); -+} -+ -+static void FUNC(add_residual16x16_dc_c)(uint8_t *_dst, ptrdiff_t stride, int32_t dc) -+{ -+ FUNC(add_residual_dc_c)(_dst, stride, dc, 16); -+} -+ -+static void FUNC(add_residual32x32_dc_c)(uint8_t *_dst, ptrdiff_t stride, int32_t dc) -+{ -+ // Should never occur for 420, which is all that sand supports -+ av_assert0(0); -+} -+ -+ -+static void FUNC(transform_rdpcm)(int16_t *_coeffs, int16_t log2_size, int mode) -+{ -+ int16_t *coeffs = (int16_t *) _coeffs; -+ int x, y; -+ int size = 1 << log2_size; -+ -+ if (mode) { -+ coeffs += size; -+ for (y = 0; y < size - 1; y++) { -+ for (x = 0; x < size; x++) -+ coeffs[x] += coeffs[x - size]; -+ coeffs += size; -+ } -+ } else { -+ for (y = 0; y < size; y++) { -+ for (x = 1; x < size; x++) -+ coeffs[x] += coeffs[x - 1]; -+ coeffs += size; -+ } -+ } -+} -+ -+static void FUNC(dequant)(int16_t *coeffs, int16_t log2_size) -+{ -+ int shift = 15 - BIT_DEPTH - log2_size; -+ int x, y; -+ int size = 1 << log2_size; -+ -+ if (shift > 0) { -+ int offset = 1 << (shift - 1); -+ for (y = 0; y < size; y++) { -+ for (x = 0; x < size; x++) { -+ *coeffs = (*coeffs + offset) >> shift; -+ coeffs++; -+ } -+ } -+ } else { -+ for (y = 0; y < size; y++) { -+ for (x = 0; x < size; x++) { -+ *coeffs = *coeffs << -shift; -+ coeffs++; -+ } -+ } -+ } -+} -+ -+#define SET(dst, x) (dst) = (x) -+#define SCALE(dst, x) (dst) = av_clip_int16(((x) + add) >> shift) -+ -+#define TR_4x4_LUMA(dst, src, step, assign) \ -+ do { \ -+ int c0 = src[0 * step] + src[2 * step]; \ -+ int c1 = src[2 * step] + src[3 * step]; \ -+ int c2 = src[0 * step] - src[3 * step]; \ -+ int c3 = 74 * src[1 * step]; \ -+ \ -+ assign(dst[2 * step], 74 * (src[0 * step] - \ -+ src[2 * step] + \ -+ src[3 * step])); \ -+ assign(dst[0 * step], 29 * c0 + 55 * c1 + c3); \ -+ assign(dst[1 * step], 55 * c2 - 29 * c1 + c3); \ -+ assign(dst[3 * step], 55 * c0 + 29 * c2 - c3); \ -+ } while (0) -+ -+static void FUNC(transform_4x4_luma)(int16_t *coeffs) -+{ -+ int i; -+ int shift = 7; -+ int add = 1 << (shift - 1); -+ int16_t *src = coeffs; -+ -+ for (i = 0; i < 4; i++) { -+ TR_4x4_LUMA(src, src, 4, SCALE); -+ src++; -+ } -+ -+ shift = 20 - BIT_DEPTH; -+ add = 1 << (shift - 1); -+ for (i = 0; i < 4; i++) { -+ TR_4x4_LUMA(coeffs, coeffs, 1, SCALE); -+ coeffs += 4; -+ } -+} -+ -+#undef TR_4x4_LUMA -+ -+#define TR_4(dst, src, dstep, sstep, assign, end) \ -+ do { \ -+ const int e0 = 64 * src[0 * sstep] + 64 * src[2 * sstep]; \ -+ const int e1 = 64 * src[0 * sstep] - 64 * src[2 * sstep]; \ -+ const int o0 = 83 * src[1 * sstep] + 36 * src[3 * sstep]; \ -+ const int o1 = 36 * src[1 * sstep] - 83 * src[3 * sstep]; \ -+ \ -+ assign(dst[0 * dstep], e0 + o0); \ -+ assign(dst[1 * dstep], e1 + o1); \ -+ assign(dst[2 * dstep], e1 - o1); \ -+ assign(dst[3 * dstep], e0 - o0); \ -+ } while (0) -+ -+#define TR_8(dst, src, dstep, sstep, assign, end) \ -+ do { \ -+ int i, j; \ -+ int e_8[4]; \ -+ int o_8[4] = { 0 }; \ -+ for (i = 0; i < 4; i++) \ -+ for (j = 1; j < end; j += 2) \ -+ o_8[i] += transform[4 * j][i] * src[j * sstep]; \ -+ TR_4(e_8, src, 1, 2 * sstep, SET, 4); \ -+ \ -+ for (i = 0; i < 4; i++) { \ -+ assign(dst[i * dstep], e_8[i] + o_8[i]); \ -+ assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]); \ -+ } \ -+ } while (0) -+ -+#define TR_16(dst, src, dstep, sstep, assign, end) \ -+ do { \ -+ int i, j; \ -+ int e_16[8]; \ -+ int o_16[8] = { 0 }; \ -+ for (i = 0; i < 8; i++) \ -+ for (j = 1; j < end; j += 2) \ -+ o_16[i] += transform[2 * j][i] * src[j * sstep]; \ -+ TR_8(e_16, src, 1, 2 * sstep, SET, 8); \ -+ \ -+ for (i = 0; i < 8; i++) { \ -+ assign(dst[i * dstep], e_16[i] + o_16[i]); \ -+ assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]); \ -+ } \ -+ } while (0) -+ -+#define TR_32(dst, src, dstep, sstep, assign, end) \ -+ do { \ -+ int i, j; \ -+ int e_32[16]; \ -+ int o_32[16] = { 0 }; \ -+ for (i = 0; i < 16; i++) \ -+ for (j = 1; j < end; j += 2) \ -+ o_32[i] += transform[j][i] * src[j * sstep]; \ -+ TR_16(e_32, src, 1, 2 * sstep, SET, end / 2); \ -+ \ -+ for (i = 0; i < 16; i++) { \ -+ assign(dst[i * dstep], e_32[i] + o_32[i]); \ -+ assign(dst[(31 - i) * dstep], e_32[i] - o_32[i]); \ -+ } \ -+ } while (0) -+ -+#define IDCT_VAR4(H) \ -+ int limit2 = FFMIN(col_limit + 4, H) -+#define IDCT_VAR8(H) \ -+ int limit = FFMIN(col_limit, H); \ -+ int limit2 = FFMIN(col_limit + 4, H) -+#define IDCT_VAR16(H) IDCT_VAR8(H) -+#define IDCT_VAR32(H) IDCT_VAR8(H) -+ -+#define IDCT(H) \ -+static void FUNC(idct_ ## H ## x ## H )(int16_t *coeffs, \ -+ int col_limit) \ -+{ \ -+ int i; \ -+ int shift = 7; \ -+ int add = 1 << (shift - 1); \ -+ int16_t *src = coeffs; \ -+ IDCT_VAR ## H(H); \ -+ \ -+ for (i = 0; i < H; i++) { \ -+ TR_ ## H(src, src, H, H, SCALE, limit2); \ -+ if (limit2 < H && i%4 == 0 && !!i) \ -+ limit2 -= 4; \ -+ src++; \ -+ } \ -+ \ -+ shift = 20 - BIT_DEPTH; \ -+ add = 1 << (shift - 1); \ -+ for (i = 0; i < H; i++) { \ -+ TR_ ## H(coeffs, coeffs, 1, 1, SCALE, limit); \ -+ coeffs += H; \ -+ } \ -+} -+ -+#define IDCT_DC(H) \ -+static void FUNC(idct_ ## H ## x ## H ## _dc)(int16_t *coeffs) \ -+{ \ -+ int i, j; \ -+ int shift = 14 - BIT_DEPTH; \ -+ int add = 1 << (shift - 1); \ -+ int coeff = (((coeffs[0] + 1) >> 1) + add) >> shift; \ -+ \ -+ for (j = 0; j < H; j++) { \ -+ for (i = 0; i < H; i++) { \ -+ coeffs[i + j * H] = coeff; \ -+ } \ -+ } \ -+} -+ -+IDCT( 4) -+IDCT( 8) -+IDCT(16) -+IDCT(32) -+ -+IDCT_DC( 4) -+IDCT_DC( 8) -+IDCT_DC(16) -+IDCT_DC(32) -+ -+#undef TR_4 -+#undef TR_8 -+#undef TR_16 -+#undef TR_32 -+ -+#undef SET -+#undef SCALE -+ -+static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src, -+ ptrdiff_t stride_dst, ptrdiff_t stride_src, -+ int16_t *sao_offset_val, int sao_left_class, -+ int width, int height) -+{ -+ pixel *dst = (pixel *)_dst; -+ pixel *src = (pixel *)_src; -+ int offset_table[32] = { 0 }; -+ int k, y, x; -+ int shift = BIT_DEPTH - 5; -+ -+ stride_dst /= sizeof(pixel); -+ stride_src /= sizeof(pixel); -+ -+ for (k = 0; k < 4; k++) -+ offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); -+ dst += stride_dst; -+ src += stride_src; -+ } -+} -+ -+#define CMP(a, b) (((a) > (b)) - ((a) < (b))) -+ -+static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, -+ int eo, int width, int height) { -+ -+ static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; -+ static const int8_t pos[4][2][2] = { -+ { { -1, 0 }, { 1, 0 } }, // horizontal -+ { { 0, -1 }, { 0, 1 } }, // vertical -+ { { -1, -1 }, { 1, 1 } }, // 45 degree -+ { { 1, -1 }, { -1, 1 } }, // 135 degree -+ }; -+ pixel *dst = (pixel *)_dst; -+ pixel *src = (pixel *)_src; -+ int a_stride, b_stride; -+ int x, y; -+ const ptrdiff_t stride_src = RPI_HEVC_SAO_BUF_STRIDE / sizeof(pixel); -+ stride_dst /= sizeof(pixel); -+ -+ a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; -+ b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) { -+ int diff0 = CMP(src[x], src[x + a_stride]); -+ int diff1 = CMP(src[x], src[x + b_stride]); -+ int offset_val = edge_idx[2 + diff0 + diff1]; -+ dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); -+ } -+ src += stride_src; -+ dst += stride_dst; -+ } -+} -+ -+ -+#if BIT_DEPTH == 10 -+// We need a 32 bit variation for the _c restores so hijack bit depth 10 -+#undef pixel -+#undef BIT_DEPTH -+#define pixel uint32_t -+#define BIT_DEPTH 32 -+// All 16 bit variations are the same -+#define sao_edge_restore_0_10 sao_edge_restore_0_9 -+#define sao_edge_restore_1_10 sao_edge_restore_1_9 -+#define sao_edge_restore_0_11 sao_edge_restore_0_9 -+#define sao_edge_restore_1_11 sao_edge_restore_1_9 -+#define sao_edge_restore_0_12 sao_edge_restore_0_9 -+#define sao_edge_restore_1_12 sao_edge_restore_1_9 -+#define sao_edge_restore_0_13 sao_edge_restore_0_9 -+#define sao_edge_restore_1_13 sao_edge_restore_1_9 -+#define sao_edge_restore_0_14 sao_edge_restore_0_9 -+#define sao_edge_restore_1_14 sao_edge_restore_1_9 -+#define sao_edge_restore_0_15 sao_edge_restore_0_9 -+#define sao_edge_restore_1_15 sao_edge_restore_1_9 -+#define sao_edge_restore_0_16 sao_edge_restore_0_9 -+#define sao_edge_restore_1_16 sao_edge_restore_1_9 -+#endif -+#if BIT_DEPTH <= 9 || BIT_DEPTH == 32 -+static void FUNC(sao_edge_restore_0)(uint8_t *_dst, uint8_t *_src, -+ ptrdiff_t stride_dst, ptrdiff_t stride_src, RpiSAOParams *sao, -+ int *borders, int _width, int _height, -+ int c_idx, uint8_t *vert_edge, -+ uint8_t *horiz_edge, uint8_t *diag_edge) -+{ -+ int x, y; -+ pixel *dst = (pixel *)_dst; -+ pixel *src = (pixel *)_src; -+ int sao_eo_class = sao->eo_class[c_idx]; -+ int init_x = 0, width = _width, height = _height; -+ -+ stride_dst /= sizeof(pixel); -+ stride_src /= sizeof(pixel); -+ -+ if (sao_eo_class != SAO_EO_VERT) { -+ if (borders[0]) { -+ for (y = 0; y < height; y++) { -+ dst[y * stride_dst] = src[y * stride_src]; -+ } -+ init_x = 1; -+ } -+ if (borders[2]) { -+ int offset = width - 1; -+ for (x = 0; x < height; x++) { -+ dst[x * stride_dst + offset] = src[x * stride_src + offset]; -+ } -+ width--; -+ } -+ } -+ if (sao_eo_class != SAO_EO_HORIZ) { -+ if (borders[1]) { -+ for (x = init_x; x < width; x++) -+ dst[x] = src[x]; -+ } -+ if (borders[3]) { -+ ptrdiff_t y_stride_dst = stride_dst * (height - 1); -+ ptrdiff_t y_stride_src = stride_src * (height - 1); -+ for (x = init_x; x < width; x++) -+ dst[x + y_stride_dst] = src[x + y_stride_src]; -+ height--; -+ } -+ } -+} -+ -+static void FUNC(sao_edge_restore_1)(uint8_t *_dst, uint8_t *_src, -+ ptrdiff_t stride_dst, ptrdiff_t stride_src, RpiSAOParams *sao, -+ int *borders, int _width, int _height, -+ int c_idx, uint8_t *vert_edge, -+ uint8_t *horiz_edge, uint8_t *diag_edge) -+{ -+ int x, y; -+ pixel *dst = (pixel *)_dst; -+ pixel *src = (pixel *)_src; -+ int sao_eo_class = sao->eo_class[c_idx]; -+ int init_x = 0, init_y = 0, width = _width, height = _height; -+ -+ stride_dst /= sizeof(pixel); -+ stride_src /= sizeof(pixel); -+ -+ if (sao_eo_class != SAO_EO_VERT) { -+ if (borders[0]) { -+ for (y = 0; y < height; y++) { -+ dst[y * stride_dst] = src[y * stride_src]; -+ } -+ init_x = 1; -+ } -+ if (borders[2]) { -+ int offset = width - 1; -+ for (x = 0; x < height; x++) { -+ dst[x * stride_dst + offset] = src[x * stride_src + offset]; -+ } -+ width--; -+ } -+ } -+ if (sao_eo_class != SAO_EO_HORIZ) { -+ if (borders[1]) { -+ for (x = init_x; x < width; x++) -+ dst[x] = src[x]; -+ init_y = 1; -+ } -+ if (borders[3]) { -+ ptrdiff_t y_stride_dst = stride_dst * (height - 1); -+ ptrdiff_t y_stride_src = stride_src * (height - 1); -+ for (x = init_x; x < width; x++) -+ dst[x + y_stride_dst] = src[x + y_stride_src]; -+ height--; -+ } -+ } -+ -+ { -+ int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; -+ int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; -+ int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; -+ int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; -+ -+ // Restore pixels that can't be modified -+ if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { -+ for(y = init_y+save_upper_left; y< height-save_lower_left; y++) -+ dst[y*stride_dst] = src[y*stride_src]; -+ } -+ if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { -+ for(y = init_y+save_upper_right; y< height-save_lower_right; y++) -+ dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; -+ } -+ -+ if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { -+ for(x = init_x+save_upper_left; x < width-save_upper_right; x++) -+ dst[x] = src[x]; -+ } -+ if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { -+ for(x = init_x+save_lower_left; x < width-save_lower_right; x++) -+ dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; -+ } -+ if(diag_edge[0] && sao_eo_class == SAO_EO_135D) -+ dst[0] = src[0]; -+ if(diag_edge[1] && sao_eo_class == SAO_EO_45D) -+ dst[width-1] = src[width-1]; -+ if(diag_edge[2] && sao_eo_class == SAO_EO_135D) -+ dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; -+ if(diag_edge[3] && sao_eo_class == SAO_EO_45D) -+ dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; -+ -+ } -+} -+#endif -+#if BIT_DEPTH == 32 -+#undef BIT_DEPTH -+#undef pixel -+#define BIT_DEPTH 10 -+#define pixel uint16_t -+#endif -+ -+// --- Plaited chroma versions -+ -+static void FUNC(sao_band_filter_c)(uint8_t *_dst, const uint8_t *_src, -+ ptrdiff_t stride_dst, ptrdiff_t stride_src, -+ const int16_t *sao_offset_val_u, int sao_left_class_u, -+ const int16_t *sao_offset_val_v, int sao_left_class_v, -+ int width, int height) -+{ -+ pixel *dst = (pixel *)_dst; -+ pixel *src = (pixel *)_src; -+ int offset_table_u[32] = { 0 }; -+ int offset_table_v[32] = { 0 }; -+ int k, y, x; -+ int shift = BIT_DEPTH - 5; -+ -+ stride_dst /= sizeof(pixel); -+ stride_src /= sizeof(pixel); -+ width *= 2; -+ -+ for (k = 0; k < 4; k++) -+ { -+ offset_table_u[(k + sao_left_class_u) & 31] = sao_offset_val_u[k + 1]; -+ offset_table_v[(k + sao_left_class_v) & 31] = sao_offset_val_v[k + 1]; -+ } -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x += 2) -+ { -+// printf("dst=%p, src=%p, x=%d, shift=%d\n", dst, src, x, shift); -+// printf("offsets=%x,%x\n", src[x + 0], src[x + 1]); -+ // *** & 31 shouldn't be wanted but just now we generate broken input that -+ // crashes us in 10-bit world -+ dst[x + 0] = av_clip_pixel(src[x + 0] + offset_table_u[(src[x + 0] >> shift) & 31]); -+ dst[x + 1] = av_clip_pixel(src[x + 1] + offset_table_v[(src[x + 1] >> shift) & 31]); -+ } -+ dst += stride_dst; -+ src += stride_src; -+ } -+} -+ -+static void FUNC(sao_edge_filter_c)(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, -+ const int16_t *sao_offset_val_u, const int16_t *sao_offset_val_v, -+ int eo, int width, int height) { -+ -+ static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; -+ static const int8_t pos[4][2][2] = { -+ { { -1, 0 }, { 1, 0 } }, // horizontal -+ { { 0, -1 }, { 0, 1 } }, // vertical -+ { { -1, -1 }, { 1, 1 } }, // 45 degree -+ { { 1, -1 }, { -1, 1 } }, // 135 degree -+ }; -+ pixel *dst = (pixel *)_dst; -+ pixel *src = (pixel *)_src; -+ int a_stride, b_stride; -+ int x, y; -+ const ptrdiff_t stride_src = RPI_HEVC_SAO_BUF_STRIDE / sizeof(pixel); -+ -+ stride_dst /= sizeof(pixel); -+ width *= 2; -+ -+ av_assert0(width <= 64); -+ -+ a_stride = pos[eo][0][0] * 2 + pos[eo][0][1] * stride_src; -+ b_stride = pos[eo][1][0] * 2 + pos[eo][1][1] * stride_src; -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x += 2) { -+ int diff0u = CMP(src[x], src[x + a_stride]); -+ int diff1u = CMP(src[x], src[x + b_stride]); -+ int offset_valu = edge_idx[2 + diff0u + diff1u]; -+ int diff0v = CMP(src[x+1], src[x+1 + a_stride]); -+ int diff1v = CMP(src[x+1], src[x+1 + b_stride]); -+ int offset_valv = edge_idx[2 + diff0v + diff1v]; -+ dst[x] = av_clip_pixel(src[x] + sao_offset_val_u[offset_valu]); -+ dst[x+1] = av_clip_pixel(src[x+1] + sao_offset_val_v[offset_valv]); -+ } -+ src += stride_src; -+ dst += stride_dst; -+ } -+} -+ -+// Do once -+#if BIT_DEPTH == 8 -+// Any old 2 byte 'normal' restore will work for these -+#define sao_edge_restore_c_0_8 sao_edge_restore_0_16 -+#define sao_edge_restore_c_1_8 sao_edge_restore_1_16 -+// We need 32 bit for 9 bit+ -+#define sao_edge_restore_c_0_9 sao_edge_restore_0_32 -+#define sao_edge_restore_c_1_9 sao_edge_restore_1_32 -+#define sao_edge_restore_c_0_10 sao_edge_restore_0_32 -+#define sao_edge_restore_c_1_10 sao_edge_restore_1_32 -+#define sao_edge_restore_c_0_11 sao_edge_restore_0_32 -+#define sao_edge_restore_c_1_11 sao_edge_restore_1_32 -+#define sao_edge_restore_c_0_12 sao_edge_restore_0_32 -+#define sao_edge_restore_c_1_12 sao_edge_restore_1_32 -+#define sao_edge_restore_c_0_13 sao_edge_restore_0_32 -+#define sao_edge_restore_c_1_13 sao_edge_restore_1_32 -+#define sao_edge_restore_c_0_14 sao_edge_restore_0_32 -+#define sao_edge_restore_c_1_14 sao_edge_restore_1_32 -+#define sao_edge_restore_c_0_15 sao_edge_restore_0_32 -+#define sao_edge_restore_c_1_15 sao_edge_restore_1_32 -+#define sao_edge_restore_c_0_16 sao_edge_restore_0_32 -+#define sao_edge_restore_c_1_16 sao_edge_restore_1_32 -+#endif -+ -+#undef CMP -+ -+//////////////////////////////////////////////////////////////////////////////// -+// -+//////////////////////////////////////////////////////////////////////////////// -+static void FUNC(put_hevc_pel_pixels)(int16_t *dst, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = src[x] << (14 - BIT_DEPTH); -+ src += srcstride; -+ dst += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_pel_uni_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ -+ for (y = 0; y < height; y++) { -+ memcpy(dst, src, width * sizeof(pixel)); -+ src += srcstride; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_pel_bi_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ -+ int shift = 14 + 1 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((src[x] << (14 - BIT_DEPTH)) + src2[x] + offset) >> shift); -+ src += srcstride; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_pel_uni_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ int shift = denom + 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ ox = ox * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel((((src[x] << (14 - BIT_DEPTH)) * wx + offset) >> shift) + ox); -+ src += srcstride; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_pel_bi_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, int denom, int wx0, int wx1, -+ int ox0, int ox1, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ -+ int shift = 14 + 1 - BIT_DEPTH; -+ int log2Wd = denom + shift - 1; -+ -+ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); -+ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) { -+ dst[x] = av_clip_pixel(( (src[x] << (14 - BIT_DEPTH)) * wx1 + src2[x] * wx0 + (ox0 + ox1 + 1) * (1 << log2Wd)) >> (log2Wd + 1)); -+ } -+ src += srcstride; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+//////////////////////////////////////////////////////////////////////////////// -+// -+//////////////////////////////////////////////////////////////////////////////// -+#define QPEL_FILTER(src, stride) \ -+ (filter[0] * src[x - 3 * stride] + \ -+ filter[1] * src[x - 2 * stride] + \ -+ filter[2] * src[x - stride] + \ -+ filter[3] * src[x ] + \ -+ filter[4] * src[x + stride] + \ -+ filter[5] * src[x + 2 * stride] + \ -+ filter[6] * src[x + 3 * stride] + \ -+ filter[7] * src[x + 4 * stride]) -+ -+static void FUNC(put_hevc_qpel_h)(int16_t *dst, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ dst += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_v)(int16_t *dst, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ dst += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_hv)(int16_t *dst, -+ uint8_t *_src, -+ ptrdiff_t _srcstride, -+ int height, intptr_t mx, -+ intptr_t my, int width) -+{ -+ int x, y; -+ const int8_t *filter; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ -+ src -= QPEL_EXTRA_BEFORE * srcstride; -+ filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ for (y = 0; y < height + QPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6; -+ tmp += MAX_PB_SIZE; -+ dst += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_uni_h)(uint8_t *_dst, ptrdiff_t _dststride, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ int shift = 14 - BIT_DEPTH; -+ -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + offset) >> shift); -+ src += srcstride; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ -+ int shift = 14 + 1 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift); -+ src += srcstride; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_uni_v)(uint8_t *_dst, ptrdiff_t _dststride, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ int shift = 14 - BIT_DEPTH; -+ -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + offset) >> shift); -+ src += srcstride; -+ dst += dststride; -+ } -+} -+ -+ -+static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ -+ int shift = 14 + 1 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift); -+ src += srcstride; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_uni_hv)(uint8_t *_dst, ptrdiff_t _dststride, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ const int8_t *filter; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ int shift = 14 - BIT_DEPTH; -+ -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ src -= QPEL_EXTRA_BEFORE * srcstride; -+ filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ for (y = 0; y < height + QPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + offset) >> shift); -+ tmp += MAX_PB_SIZE; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ const int8_t *filter; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ int shift = 14 + 1 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ src -= QPEL_EXTRA_BEFORE * srcstride; -+ filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ for (y = 0; y < height + QPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + src2[x] + offset) >> shift); -+ tmp += MAX_PB_SIZE; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_uni_w_h)(uint8_t *_dst, ptrdiff_t _dststride, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, int denom, int wx, int ox, -+ intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ int shift = denom + 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ ox = ox * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel((((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); -+ src += srcstride; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, int denom, int wx0, int wx1, -+ int ox0, int ox1, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ -+ int shift = 14 + 1 - BIT_DEPTH; -+ int log2Wd = denom + shift - 1; -+ -+ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); -+ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + -+ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); -+ src += srcstride; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_uni_w_v)(uint8_t *_dst, ptrdiff_t _dststride, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, int denom, int wx, int ox, -+ intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ int shift = denom + 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ ox = ox * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel((((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); -+ src += srcstride; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, int denom, int wx0, int wx1, -+ int ox0, int ox1, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ -+ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ -+ int shift = 14 + 1 - BIT_DEPTH; -+ int log2Wd = denom + shift - 1; -+ -+ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); -+ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + -+ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); -+ src += srcstride; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_uni_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, int denom, int wx, int ox, -+ intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ const int8_t *filter; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ int shift = denom + 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ src -= QPEL_EXTRA_BEFORE * srcstride; -+ filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ for (y = 0; y < height + QPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ -+ ox = ox * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel((((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx + offset) >> shift) + ox); -+ tmp += MAX_PB_SIZE; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, int denom, int wx0, int wx1, -+ int ox0, int ox1, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ const int8_t *filter; -+ pixel *src = (pixel*)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ int shift = 14 + 1 - BIT_DEPTH; -+ int log2Wd = denom + shift - 1; -+ -+ src -= QPEL_EXTRA_BEFORE * srcstride; -+ filter = ff_hevc_rpi_qpel_filters[mx - 1]; -+ for (y = 0; y < height + QPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_qpel_filters[my - 1]; -+ -+ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); -+ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 + -+ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); -+ tmp += MAX_PB_SIZE; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+//////////////////////////////////////////////////////////////////////////////// -+// -+//////////////////////////////////////////////////////////////////////////////// -+#define EPEL_FILTER(src, stride) \ -+ (filter[0] * src[x - stride] + \ -+ filter[1] * src[x] + \ -+ filter[2] * src[x + stride] + \ -+ filter[3] * src[x + 2 * stride]) -+ -+static void FUNC(put_hevc_epel_h)(int16_t *dst, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ dst += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_epel_v)(int16_t *dst, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ dst += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_epel_hv)(int16_t *dst, -+ uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ -+ src -= EPEL_EXTRA_BEFORE * srcstride; -+ -+ for (y = 0; y < height + EPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_epel_filters[my - 1]; -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6; -+ tmp += MAX_PB_SIZE; -+ dst += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_epel_uni_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int shift = 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + offset) >> shift); -+ src += srcstride; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_epel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int shift = 14 + 1 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) { -+ dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift); -+ } -+ dst += dststride; -+ src += srcstride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_epel_uni_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; -+ int shift = 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + offset) >> shift); -+ src += srcstride; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_epel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ int shift = 14 + 1 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift); -+ dst += dststride; -+ src += srcstride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_epel_uni_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ int shift = 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ src -= EPEL_EXTRA_BEFORE * srcstride; -+ -+ for (y = 0; y < height + EPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_epel_filters[my - 1]; -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + offset) >> shift); -+ tmp += MAX_PB_SIZE; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ int shift = 14 + 1 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ src -= EPEL_EXTRA_BEFORE * srcstride; -+ -+ for (y = 0; y < height + EPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_epel_filters[my - 1]; -+ -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + src2[x] + offset) >> shift); -+ tmp += MAX_PB_SIZE; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_epel_uni_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int shift = denom + 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ ox = ox * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) { -+ dst[x] = av_clip_pixel((((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); -+ } -+ dst += dststride; -+ src += srcstride; -+ } -+} -+ -+static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, int denom, int wx0, int wx1, -+ int ox0, int ox1, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int shift = 14 + 1 - BIT_DEPTH; -+ int log2Wd = denom + shift - 1; -+ -+ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); -+ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + -+ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); -+ src += srcstride; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_epel_uni_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; -+ int shift = denom + 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ ox = ox * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) { -+ dst[x] = av_clip_pixel((((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); -+ } -+ dst += dststride; -+ src += srcstride; -+ } -+} -+ -+static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, int denom, int wx0, int wx1, -+ int ox0, int ox1, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ int shift = 14 + 1 - BIT_DEPTH; -+ int log2Wd = denom + shift - 1; -+ -+ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); -+ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + -+ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); -+ src += srcstride; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+static void FUNC(put_hevc_epel_uni_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ int shift = denom + 14 - BIT_DEPTH; -+#if BIT_DEPTH < 14 -+ int offset = 1 << (shift - 1); -+#else -+ int offset = 0; -+#endif -+ -+ src -= EPEL_EXTRA_BEFORE * srcstride; -+ -+ for (y = 0; y < height + EPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_epel_filters[my - 1]; -+ -+ ox = ox * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel((((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx + offset) >> shift) + ox); -+ tmp += MAX_PB_SIZE; -+ dst += dststride; -+ } -+} -+ -+static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, -+ int16_t *src2, -+ int height, int denom, int wx0, int wx1, -+ int ox0, int ox1, intptr_t mx, intptr_t my, int width) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ ptrdiff_t srcstride = _srcstride / sizeof(pixel); -+ pixel *dst = (pixel *)_dst; -+ ptrdiff_t dststride = _dststride / sizeof(pixel); -+ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; -+ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; -+ int16_t *tmp = tmp_array; -+ int shift = 14 + 1 - BIT_DEPTH; -+ int log2Wd = denom + shift - 1; -+ -+ src -= EPEL_EXTRA_BEFORE * srcstride; -+ -+ for (y = 0; y < height + EPEL_EXTRA; y++) { -+ for (x = 0; x < width; x++) -+ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); -+ src += srcstride; -+ tmp += MAX_PB_SIZE; -+ } -+ -+ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; -+ filter = ff_hevc_rpi_epel_filters[my - 1]; -+ -+ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); -+ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); -+ for (y = 0; y < height; y++) { -+ for (x = 0; x < width; x++) -+ dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 + -+ ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1)); -+ tmp += MAX_PB_SIZE; -+ dst += dststride; -+ src2 += MAX_PB_SIZE; -+ } -+} -+ -+// line zero -+#define P3 pix[-4 * xstride] -+#define P2 pix[-3 * xstride] -+#define P1 pix[-2 * xstride] -+#define P0 pix[-1 * xstride] -+#define Q0 pix[0 * xstride] -+#define Q1 pix[1 * xstride] -+#define Q2 pix[2 * xstride] -+#define Q3 pix[3 * xstride] -+ -+// line three. used only for deblocking decision -+#define TP3 pix[-4 * xstride + 3 * ystride] -+#define TP2 pix[-3 * xstride + 3 * ystride] -+#define TP1 pix[-2 * xstride + 3 * ystride] -+#define TP0 pix[-1 * xstride + 3 * ystride] -+#define TQ0 pix[0 * xstride + 3 * ystride] -+#define TQ1 pix[1 * xstride + 3 * ystride] -+#define TQ2 pix[2 * xstride + 3 * ystride] -+#define TQ3 pix[3 * xstride + 3 * ystride] -+ -+static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix, -+ ptrdiff_t _xstride, ptrdiff_t _ystride, -+ int beta, int *_tc, -+ uint8_t *_no_p, uint8_t *_no_q) -+{ -+ int d, j; -+ pixel *pix = (pixel *)_pix; -+ ptrdiff_t xstride = _xstride / sizeof(pixel); -+ ptrdiff_t ystride = _ystride / sizeof(pixel); -+ -+ beta <<= BIT_DEPTH - 8; -+ -+ for (j = 0; j < 2; j++) { -+ const int dp0 = abs(P2 - 2 * P1 + P0); -+ const int dq0 = abs(Q2 - 2 * Q1 + Q0); -+ const int dp3 = abs(TP2 - 2 * TP1 + TP0); -+ const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0); -+ const int d0 = dp0 + dq0; -+ const int d3 = dp3 + dq3; -+ const int tc = _tc[j] << (BIT_DEPTH - 8); -+ const int no_p = _no_p[j]; -+ const int no_q = _no_q[j]; -+ -+ if (d0 + d3 >= beta) { -+ pix += 4 * ystride; -+ continue; -+ } else { -+ const int beta_3 = beta >> 3; -+ const int beta_2 = beta >> 2; -+ const int tc25 = ((tc * 5 + 1) >> 1); -+ -+ if (abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 && -+ abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 && -+ (d0 << 1) < beta_2 && (d3 << 1) < beta_2) { -+ // strong filtering -+ const int tc2 = tc << 1; -+ for (d = 0; d < 4; d++) { -+ const int p3 = P3; -+ const int p2 = P2; -+ const int p1 = P1; -+ const int p0 = P0; -+ const int q0 = Q0; -+ const int q1 = Q1; -+ const int q2 = Q2; -+ const int q3 = Q3; -+ if (!no_p) { -+ P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc2, tc2); -+ P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2); -+ P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc2, tc2); -+ } -+ if (!no_q) { -+ Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc2, tc2); -+ Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2); -+ Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc2, tc2); -+ } -+ pix += ystride; -+ } -+ } else { // normal filtering -+ int nd_p = 1; -+ int nd_q = 1; -+ const int tc_2 = tc >> 1; -+ if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3)) -+ nd_p = 2; -+ if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3)) -+ nd_q = 2; -+ -+ for (d = 0; d < 4; d++) { -+ const int p2 = P2; -+ const int p1 = P1; -+ const int p0 = P0; -+ const int q0 = Q0; -+ const int q1 = Q1; -+ const int q2 = Q2; -+ int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4; -+ if (abs(delta0) < 10 * tc) { -+ delta0 = av_clip(delta0, -tc, tc); -+ if (!no_p) -+ P0 = av_clip_pixel(p0 + delta0); -+ if (!no_q) -+ Q0 = av_clip_pixel(q0 - delta0); -+ if (!no_p && nd_p > 1) { -+ const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2); -+ P1 = av_clip_pixel(p1 + deltap1); -+ } -+ if (!no_q && nd_q > 1) { -+ const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2); -+ Q1 = av_clip_pixel(q1 + deltaq1); -+ } -+ } -+ pix += ystride; -+ } -+ } -+ } -+ } -+} -+ -+static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride, -+ ptrdiff_t _ystride, int *_tc, -+ uint8_t *_no_p, uint8_t *_no_q) -+{ -+ int d, j, no_p, no_q; -+ pixel *pix = (pixel *)_pix; -+ ptrdiff_t xstride = _xstride / sizeof(pixel); -+ ptrdiff_t ystride = _ystride / sizeof(pixel); -+ -+ for (j = 0; j < 2; j++) { -+ const int tc = _tc[j] << (BIT_DEPTH - 8); -+ if (tc <= 0) { -+ pix += 4 * ystride; -+ continue; -+ } -+ no_p = _no_p[j]; -+ no_q = _no_q[j]; -+ -+ for (d = 0; d < 4; d++) { -+ int delta0; -+ const int p1 = P1; -+ const int p0 = P0; -+ const int q0 = Q0; -+ const int q1 = Q1; -+ delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc); -+ if (!no_p) -+ P0 = av_clip_pixel(p0 + delta0); -+ if (!no_q) -+ Q0 = av_clip_pixel(q0 - delta0); -+ pix += ystride; -+ } -+ } -+} -+ -+static void FUNC(hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride, -+ int32_t *tc, uint8_t *no_p, -+ uint8_t *no_q) -+{ -+ FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel), tc, no_p, no_q); -+} -+ -+static void FUNC(hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride, -+ int32_t *tc, uint8_t *no_p, -+ uint8_t *no_q) -+{ -+ FUNC(hevc_loop_filter_chroma)(pix, sizeof(pixel), stride, tc, no_p, no_q); -+} -+ -+static void FUNC(hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, -+ int beta, int32_t *tc, uint8_t *no_p, -+ uint8_t *no_q) -+{ -+ FUNC(hevc_loop_filter_luma)(pix, stride, sizeof(pixel), -+ beta, tc, no_p, no_q); -+} -+ -+static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, -+ int beta, int32_t *tc, uint8_t *no_p, -+ uint8_t *no_q) -+{ -+ FUNC(hevc_loop_filter_luma)(pix, sizeof(pixel), stride, -+ beta, tc, no_p, no_q); -+} -+ -+#undef P3 -+#undef P2 -+#undef P1 -+#undef P0 -+#undef Q0 -+#undef Q1 -+#undef Q2 -+#undef Q3 -+ -+#undef TP3 -+#undef TP2 -+#undef TP1 -+#undef TP0 -+#undef TQ0 -+#undef TQ1 -+#undef TQ2 -+#undef TQ3 -+ -+// line zero -+#define P3 pix_l[0 * xstride] -+#define P2 pix_l[1 * xstride] -+#define P1 pix_l[2 * xstride] -+#define P0 pix_l[3 * xstride] -+#define Q0 pix_r[0 * xstride] -+#define Q1 pix_r[1 * xstride] -+#define Q2 pix_r[2 * xstride] -+#define Q3 pix_r[3 * xstride] -+ -+// line three. used only for deblocking decision -+#define TP3 pix_l[0 * xstride + 3 * ystride] -+#define TP2 pix_l[1 * xstride + 3 * ystride] -+#define TP1 pix_l[2 * xstride + 3 * ystride] -+#define TP0 pix_l[3 * xstride + 3 * ystride] -+#define TQ0 pix_r[0 * xstride + 3 * ystride] -+#define TQ1 pix_r[1 * xstride + 3 * ystride] -+#define TQ2 pix_r[2 * xstride + 3 * ystride] -+#define TQ3 pix_r[3 * xstride + 3 * ystride] -+ -+// This is identical to hevc_loop_filter_luma except that the P/Q -+// components are on separate pointers -+static void FUNC(hevc_v_loop_filter_luma2)(uint8_t * _pix_r, -+ unsigned int _stride, unsigned int beta, unsigned int tc2, unsigned int no_f, -+ uint8_t * _pix_l) -+{ -+ int d, j; -+ pixel *pix_l = (pixel *)_pix_l; -+ pixel *pix_r = (pixel *)_pix_r; -+ const ptrdiff_t xstride = 1; -+ const ptrdiff_t ystride = _stride / sizeof(pixel); -+ -+ beta <<= BIT_DEPTH - 8; -+ -+ for (j = 0; j < 2; j++) { -+ const int dp0 = abs(P2 - 2 * P1 + P0); -+ const int dq0 = abs(Q2 - 2 * Q1 + Q0); -+ const int dp3 = abs(TP2 - 2 * TP1 + TP0); -+ const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0); -+ const int d0 = dp0 + dq0; -+ const int d3 = dp3 + dq3; -+ const int tc = ((tc2 >> (j << 4)) & 0xffff) << (BIT_DEPTH - 8); -+ const int no_p = no_f & 1; -+ const int no_q = no_f & 2; -+ -+ if (d0 + d3 >= beta) { -+ pix_l += 4 * ystride; -+ pix_r += 4 * ystride; -+ continue; -+ } else { -+ const int beta_3 = beta >> 3; -+ const int beta_2 = beta >> 2; -+ const int tc25 = ((tc * 5 + 1) >> 1); -+ -+ if (abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 && -+ abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 && -+ (d0 << 1) < beta_2 && (d3 << 1) < beta_2) { -+ // strong filtering -+ const int tc2 = tc << 1; -+ for (d = 0; d < 4; d++) { -+ const int p3 = P3; -+ const int p2 = P2; -+ const int p1 = P1; -+ const int p0 = P0; -+ const int q0 = Q0; -+ const int q1 = Q1; -+ const int q2 = Q2; -+ const int q3 = Q3; -+ if (!no_p) { -+ P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc2, tc2); -+ P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2); -+ P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc2, tc2); -+ } -+ if (!no_q) { -+ Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc2, tc2); -+ Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2); -+ Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc2, tc2); -+ } -+ pix_l += ystride; -+ pix_r += ystride; -+ } -+ } else { // normal filtering -+ int nd_p = 1; -+ int nd_q = 1; -+ const int tc_2 = tc >> 1; -+ if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3)) -+ nd_p = 2; -+ if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3)) -+ nd_q = 2; -+ -+ for (d = 0; d < 4; d++) { -+ const int p2 = P2; -+ const int p1 = P1; -+ const int p0 = P0; -+ const int q0 = Q0; -+ const int q1 = Q1; -+ const int q2 = Q2; -+ int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4; -+ if (abs(delta0) < 10 * tc) { -+ delta0 = av_clip(delta0, -tc, tc); -+ if (!no_p) -+ P0 = av_clip_pixel(p0 + delta0); -+ if (!no_q) -+ Q0 = av_clip_pixel(q0 - delta0); -+ if (!no_p && nd_p > 1) { -+ const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2); -+ P1 = av_clip_pixel(p1 + deltap1); -+ } -+ if (!no_q && nd_q > 1) { -+ const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2); -+ Q1 = av_clip_pixel(q1 + deltaq1); -+ } -+ } -+ pix_l += ystride; -+ pix_r += ystride; -+ } -+ } -+ } -+ } -+} -+ -+static void FUNC(hevc_h_loop_filter_luma2)(uint8_t * _pix_r, -+ unsigned int _stride, unsigned int beta, unsigned int tc2, unsigned int no_f) -+{ -+ // Just call the non-2 function having massaged the parameters -+ int32_t tc[2] = {tc2 & 0xffff, tc2 >> 16}; -+ uint8_t no_p[2] = {no_f & 1, no_f & 1}; -+ uint8_t no_q[2] = {no_f & 2, no_f & 2}; -+ FUNC(hevc_h_loop_filter_luma)(_pix_r, _stride, beta, tc, no_p, no_q); -+} -+ -+#undef TP3 -+#undef TP2 -+#undef TP1 -+#undef TP0 -+#undef TQ0 -+#undef TQ1 -+#undef TQ2 -+#undef TQ3 -+ -+#undef P3 -+#undef P2 -+#undef P1 -+#undef P0 -+#undef Q0 -+#undef Q1 -+#undef Q2 -+#undef Q3 -+ -+#define P1 pix_l[0 * xstride] -+#define P0 pix_l[1 * xstride] -+#define Q0 pix_r[0 * xstride] -+#define Q1 pix_r[1 * xstride] -+ -+static void FUNC(hevc_loop_filter_uv2)(uint8_t *_pix_l, ptrdiff_t _xstride, -+ ptrdiff_t _ystride, const int32_t *_tc, -+ const uint8_t *_no_p, const uint8_t *_no_q, uint8_t *_pix_r) -+{ -+ int d, j, no_p, no_q; -+ pixel *pix_l = (pixel *)_pix_l; -+ pixel *pix_r = (pixel *)_pix_r; -+ ptrdiff_t xstride = _xstride / sizeof(pixel); -+ ptrdiff_t ystride = _ystride / sizeof(pixel); -+ -+ for (j = 0; j < 2; j++) { -+ const int tc = _tc[j] << (BIT_DEPTH - 8); -+ if (tc <= 0) { -+ pix_l += 4 * ystride; -+ pix_r += 4 * ystride; -+ continue; -+ } -+ no_p = _no_p[j]; -+ no_q = _no_q[j]; -+ -+ for (d = 0; d < 4; d++) { -+ int delta0; -+ const int p1 = P1; -+ const int p0 = P0; -+ const int q0 = Q0; -+ const int q1 = Q1; -+ delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc); -+ if (!no_p) -+ P0 = av_clip_pixel(p0 + delta0); -+ if (!no_q) -+ Q0 = av_clip_pixel(q0 - delta0); -+ pix_l += ystride; -+ pix_r += ystride; -+ } -+ } -+} -+ -+static void FUNC(hevc_h_loop_filter_uv)(uint8_t * pix, unsigned int stride, uint32_t tc4, -+ unsigned int no_f) -+{ -+ uint8_t no_p[2] = {no_f & 1, no_f & 2}; -+ uint8_t no_q[2] = {no_f & 4, no_f & 8}; -+ int32_t tc[4] = {tc4 & 0xff, (tc4 >> 8) & 0xff, (tc4 >> 16) & 0xff, tc4 >> 24}; -+ FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel) * 2, tc, no_p, no_q); -+ FUNC(hevc_loop_filter_chroma)(pix + sizeof(pixel), stride, sizeof(pixel) * 2, tc + 2, no_p, no_q); -+} -+ -+static void FUNC(hevc_v_loop_filter_uv2)(uint8_t * src_r, unsigned int stride, uint32_t tc4, -+ uint8_t * src_l, -+ unsigned int no_f) -+{ -+ uint8_t no_p[2] = {no_f & 1, no_f & 2}; -+ uint8_t no_q[2] = {no_f & 4, no_f & 8}; -+ int32_t tc[4] = {tc4 & 0xff, (tc4 >> 8) & 0xff, (tc4 >> 16) & 0xff, tc4 >> 24}; -+ FUNC(hevc_loop_filter_uv2)(src_l, sizeof(pixel) * 2, stride, tc, no_p, no_q, src_r); -+ FUNC(hevc_loop_filter_uv2)(src_l + sizeof(pixel), sizeof(pixel) * 2, stride, tc + 2, no_p, no_q, src_r + sizeof(pixel)); -+} -+ -+#undef P1 -+#undef P0 -+#undef Q0 -+#undef Q1 -+ ---- /dev/null -+++ b/libavcodec/rpi_hevcpred.c -@@ -0,0 +1,161 @@ -+/* -+ * HEVC video Decoder -+ * -+ * Copyright (C) 2012 - 2013 Guillaume Martres -+ * Copyright (C) 2018 John Cox for Raspberry Pi (Trading) -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "rpi_hevcdec.h" -+ -+#include "rpi_hevcpred.h" -+#if (ARCH_ARM) -+#include "arm/rpi_hevcpred_arm.h" -+#endif -+ -+#define PRED_C 0 -+#define BIT_DEPTH 8 -+#include "rpi_hevcpred_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 9 -+#include "rpi_hevcpred_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 10 -+#include "rpi_hevcpred_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 12 -+#include "rpi_hevcpred_template.c" -+#undef BIT_DEPTH -+#undef PRED_C -+ -+#define PRED_C 1 -+#define BIT_DEPTH 8 -+#include "rpi_hevcpred_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 9 -+#include "rpi_hevcpred_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 10 -+#include "rpi_hevcpred_template.c" -+#undef BIT_DEPTH -+ -+#define BIT_DEPTH 12 -+#include "rpi_hevcpred_template.c" -+#undef BIT_DEPTH -+#undef PRED_C -+ -+void ff_hevc_rpi_pred_init(HEVCRpiPredContext *hpc, int bit_depth) -+{ -+#undef FUNC -+#define FUNC(a, depth) a ## _ ## depth -+ -+#undef FUNCC -+#define FUNCC(a, depth) a ## _ ## depth ## _c -+ -+#define HEVC_PRED_Y(depth) \ -+ hpc->intra_pred = FUNC(intra_pred, depth); \ -+ hpc->intra_filter[0] = FUNC(intra_filter_2, depth); \ -+ hpc->intra_filter[1] = FUNC(intra_filter_3, depth); \ -+ hpc->intra_filter[2] = FUNC(intra_filter_4, depth); \ -+ hpc->intra_filter[3] = FUNC(intra_filter_5, depth); \ -+ hpc->pred_planar[0] = FUNC(pred_planar_0, depth); \ -+ hpc->pred_planar[1] = FUNC(pred_planar_1, depth); \ -+ hpc->pred_planar[2] = FUNC(pred_planar_2, depth); \ -+ hpc->pred_planar[3] = FUNC(pred_planar_3, depth); \ -+ hpc->pred_dc[0] = FUNC(pred_dc_0, depth); \ -+ hpc->pred_dc[1] = FUNC(pred_dc_1, depth); \ -+ hpc->pred_dc[2] = FUNC(pred_dc_2, depth); \ -+ hpc->pred_dc[3] = FUNC(pred_dc_3, depth); \ -+ hpc->pred_vertical[0] = FUNC(pred_angular_0, depth); \ -+ hpc->pred_vertical[1] = FUNC(pred_angular_1, depth); \ -+ hpc->pred_vertical[2] = FUNC(pred_angular_2, depth); \ -+ hpc->pred_vertical[3] = FUNC(pred_angular_3, depth); \ -+ hpc->pred_horizontal[0] = FUNC(pred_angular_0, depth); \ -+ hpc->pred_horizontal[1] = FUNC(pred_angular_1, depth); \ -+ hpc->pred_horizontal[2] = FUNC(pred_angular_2, depth); \ -+ hpc->pred_horizontal[3] = FUNC(pred_angular_3, depth); \ -+ hpc->pred_angular[0] = FUNC(pred_angular_0, depth); \ -+ hpc->pred_angular[1] = FUNC(pred_angular_1, depth); \ -+ hpc->pred_angular[2] = FUNC(pred_angular_2, depth); \ -+ hpc->pred_angular[3] = FUNC(pred_angular_3, depth); \ -+ hpc->pred_dc0[0] = FUNC(pred_dc0_0, depth); \ -+ hpc->pred_dc0[1] = FUNC(pred_dc0_1, depth); \ -+ hpc->pred_dc0[2] = FUNC(pred_dc0_2, depth); \ -+ hpc->pred_dc0[3] = FUNC(pred_dc0_3, depth); -+ -+#define HEVC_PRED_C(depth) \ -+ hpc->intra_pred_c = FUNCC(intra_pred, depth); \ -+ hpc->intra_filter_c[0] = FUNCC(intra_filter_2, depth); \ -+ hpc->intra_filter_c[1] = FUNCC(intra_filter_3, depth); \ -+ hpc->intra_filter_c[2] = FUNCC(intra_filter_4, depth); \ -+ hpc->intra_filter_c[3] = FUNCC(intra_filter_5, depth); \ -+ hpc->pred_planar_c[0] = FUNCC(pred_planar_0, depth); \ -+ hpc->pred_planar_c[1] = FUNCC(pred_planar_1, depth); \ -+ hpc->pred_planar_c[2] = FUNCC(pred_planar_2, depth); \ -+ hpc->pred_planar_c[3] = FUNCC(pred_planar_3, depth); \ -+ hpc->pred_dc_c[0] = FUNCC(pred_dc_0, depth); \ -+ hpc->pred_dc_c[1] = FUNCC(pred_dc_1, depth); \ -+ hpc->pred_dc_c[2] = FUNCC(pred_dc_2, depth); \ -+ hpc->pred_dc_c[3] = FUNCC(pred_dc_3, depth); \ -+ hpc->pred_vertical_c[0] = FUNCC(pred_angular_0, depth); \ -+ hpc->pred_vertical_c[1] = FUNCC(pred_angular_1, depth); \ -+ hpc->pred_vertical_c[2] = FUNCC(pred_angular_2, depth); \ -+ hpc->pred_vertical_c[3] = FUNCC(pred_angular_3, depth); \ -+ hpc->pred_horizontal_c[0] = FUNCC(pred_angular_0, depth); \ -+ hpc->pred_horizontal_c[1] = FUNCC(pred_angular_1, depth); \ -+ hpc->pred_horizontal_c[2] = FUNCC(pred_angular_2, depth); \ -+ hpc->pred_horizontal_c[3] = FUNCC(pred_angular_3, depth); \ -+ hpc->pred_angular_c[0] = FUNCC(pred_angular_0, depth); \ -+ hpc->pred_angular_c[1] = FUNCC(pred_angular_1, depth); \ -+ hpc->pred_angular_c[2] = FUNCC(pred_angular_2, depth); \ -+ hpc->pred_angular_c[3] = FUNCC(pred_angular_3, depth); \ -+ hpc->pred_dc0_c[0] = FUNCC(pred_dc0_0, depth); \ -+ hpc->pred_dc0_c[1] = FUNCC(pred_dc0_1, depth); \ -+ hpc->pred_dc0_c[2] = FUNCC(pred_dc0_2, depth); \ -+ hpc->pred_dc0_c[3] = FUNCC(pred_dc0_3, depth); -+ -+#define HEVC_PRED(depth) \ -+ HEVC_PRED_Y(depth); \ -+ HEVC_PRED_C(depth); -+ -+ switch (bit_depth) { -+ case 9: -+ HEVC_PRED(9); -+ break; -+ case 10: -+ HEVC_PRED(10); -+ break; -+ case 12: -+ HEVC_PRED(12); -+ break; -+ default: -+ HEVC_PRED(8); -+ break; -+ } -+ -+#if (ARCH_ARM) -+ ff_hevc_rpi_pred_init_arm(hpc, bit_depth); -+#elif (ARCH_MIPS) -+ ff_hevc_rpi_pred_init_mips(hpc, bit_depth); -+#endif -+} ---- /dev/null -+++ b/libavcodec/rpi_hevcpred.h -@@ -0,0 +1,123 @@ -+/* -+ * HEVC video Decoder -+ * -+ * Copyright (C) 2012 - 2013 Guillaume Martres -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#ifndef AVCODEC_RPI_HEVCPRED_H -+#define AVCODEC_RPI_HEVCPRED_H -+ -+#include -+#include -+#include "config.h" -+ -+struct HEVCRpiContext; -+struct HEVCRpiLocalContext; -+ -+enum IntraPredMode { -+ INTRA_PLANAR = 0, -+ INTRA_DC, -+ INTRA_ANGULAR_2, -+ INTRA_ANGULAR_3, -+ INTRA_ANGULAR_4, -+ INTRA_ANGULAR_5, -+ INTRA_ANGULAR_6, -+ INTRA_ANGULAR_7, -+ INTRA_ANGULAR_8, -+ INTRA_ANGULAR_9, -+ INTRA_ANGULAR_10, -+ INTRA_ANGULAR_11, -+ INTRA_ANGULAR_12, -+ INTRA_ANGULAR_13, -+ INTRA_ANGULAR_14, -+ INTRA_ANGULAR_15, -+ INTRA_ANGULAR_16, -+ INTRA_ANGULAR_17, -+ INTRA_ANGULAR_18, -+ INTRA_ANGULAR_19, -+ INTRA_ANGULAR_20, -+ INTRA_ANGULAR_21, -+ INTRA_ANGULAR_22, -+ INTRA_ANGULAR_23, -+ INTRA_ANGULAR_24, -+ INTRA_ANGULAR_25, -+ INTRA_ANGULAR_26, -+ INTRA_ANGULAR_27, -+ INTRA_ANGULAR_28, -+ INTRA_ANGULAR_29, -+ INTRA_ANGULAR_30, -+ INTRA_ANGULAR_31, -+ INTRA_ANGULAR_32, -+ INTRA_ANGULAR_33, -+ INTRA_ANGULAR_34, -+}; -+#define INTRA_ANGULAR_HORIZONTAL INTRA_ANGULAR_10 -+#define INTRA_ANGULAR_VERTICAL INTRA_ANGULAR_26 -+ -+typedef void intra_filter_fn_t( -+ uint8_t * const left, uint8_t * const top, -+ const unsigned int req, const unsigned int avail, -+ const uint8_t * const src_l, const uint8_t * const src_u, const uint8_t * const src_ur, -+ const unsigned int stride, -+ const unsigned int top_right_size, const unsigned int down_left_size); -+ -+typedef struct HEVCRpiPredContext { -+ void (*intra_pred)(const struct HEVCRpiContext * const s, -+ const enum IntraPredMode mode, const unsigned int x0, const unsigned int y0, -+ const unsigned int avail, const unsigned int log2_size); -+ -+ intra_filter_fn_t *intra_filter[4]; -+ void (*pred_planar[4])(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, ptrdiff_t stride); -+ void (*pred_dc[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, -+ ptrdiff_t stride); -+ void (*pred_angular[4])(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, ptrdiff_t stride, -+ int mode); -+ void (*pred_vertical[4])(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, ptrdiff_t stride, -+ int mode); -+ void (*pred_horizontal[4])(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, ptrdiff_t stride, -+ int mode); -+ void (*pred_dc0[4])(uint8_t *src, ptrdiff_t stride); -+ -+ void (*intra_pred_c)(const struct HEVCRpiContext * const s, -+ const enum IntraPredMode mode, const unsigned int x0, const unsigned int y0, -+ const unsigned int avail, const unsigned int log2_size); -+ intra_filter_fn_t *intra_filter_c[4]; -+ void (*pred_planar_c[4])(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, ptrdiff_t stride); -+ void (*pred_dc_c[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, -+ ptrdiff_t stride); -+ void (*pred_angular_c[4])(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, ptrdiff_t stride, -+ int mode); -+ void (*pred_vertical_c[4])(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, ptrdiff_t stride, -+ int mode); -+ void (*pred_horizontal_c[4])(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, ptrdiff_t stride, -+ int mode); -+ void (*pred_dc0_c[4])(uint8_t *src, ptrdiff_t stride); -+} HEVCRpiPredContext; -+ -+void ff_hevc_rpi_pred_init(HEVCRpiPredContext *hpc, int bit_depth); -+ -+#endif /* AVCODEC_RPI_HEVCPRED_H */ ---- /dev/null -+++ b/libavcodec/rpi_hevcpred_template.c -@@ -0,0 +1,1407 @@ -+/* -+ * HEVC video decoder -+ * -+ * Copyright (C) 2012 - 2013 Guillaume Martres -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "config.h" -+#include "libavutil/pixdesc.h" -+#include "libavutil/rpi_sand_fns.h" -+#include "bit_depth_template.c" -+ -+#include "rpi_hevcdec.h" -+#include "rpi_hevcpred.h" -+ -+#define DUMP_PRED 0 -+ -+#define POS(x, y) src[(x) + stride * (y)] -+ -+// INCLUDED_ONCE defined at EOF -+#ifndef INCLUDED_ONCE -+typedef uint8_t (* c8_dst_ptr_t)[2]; -+typedef const uint8_t (* c8_src_ptr_t)[2]; -+typedef uint16_t (* c16_dst_ptr_t)[2]; -+typedef const uint16_t (* c16_src_ptr_t)[2]; -+ -+// *** On ARM make these NEON registers -+typedef struct pixel4_16 { -+ uint16_t x[4]; -+} pixel4_16; -+typedef struct pixel4_32 { -+ uint32_t x[4]; -+} pixel4_32; -+static inline pixel4_16 PIXEL_SPLAT_X4_16(const uint16_t x) -+{ -+ pixel4_16 t = {{x, x, x, x}}; -+ return t; -+} -+static inline pixel4_32 PIXEL_SPLAT_X4_32(const uint32_t x) -+{ -+ pixel4_32 t = {{x, x, x, x}}; -+ return t; -+} -+#endif -+ -+#if PRED_C -+// For chroma we double pixel size so we copy pairs -+#undef pixel -+#undef pixel2 -+#undef pixel4 -+#undef dctcoef -+#undef INIT_CLIP -+#undef no_rnd_avg_pixel4 -+#undef rnd_avg_pixel4 -+#undef AV_RN2P -+#undef AV_RN4P -+#undef AV_RN4PA -+#undef AV_WN2P -+#undef AV_WN4P -+#undef AV_WN4PA -+#undef CLIP -+#undef FUNC -+#undef FUNCC -+#undef av_clip_pixel -+#undef PIXEL_SPLAT_X4 -+ -+#if BIT_DEPTH == 8 -+#define pixel uint16_t -+#define pixel4 pixel4_16 -+#define PIXEL_SPLAT_X4 PIXEL_SPLAT_X4_16 -+#define cpel uint8_t -+#define c_src_ptr_t c8_src_ptr_t -+#define c_dst_ptr_t c8_dst_ptr_t -+#else -+#define pixel uint32_t -+#define pixel4 pixel4_32 -+#define PIXEL_SPLAT_X4 PIXEL_SPLAT_X4_32 -+#define cpel uint16_t -+#define c_src_ptr_t c16_dst_ptr_t -+#define c_dst_ptr_t c16_dst_ptr_t -+#endif -+#define AV_RN4P(p) (*(pixel4*)(p)) -+#define AV_WN4P(p,x) (*(pixel4*)(p) = (x)) -+#define FUNC(a) FUNC2(a, BIT_DEPTH, _c) -+#endif -+ -+ -+// Get PW prior to horrid PRED_C trickery -+#if BIT_DEPTH == 8 -+#define PW 1 -+#else -+#define PW 2 -+#endif -+ -+ -+#if DUMP_PRED && !defined(INCLUDED_ONCE) -+static void dump_pred_uv(const uint8_t * data, const unsigned int stride, const unsigned int size) -+{ -+ for (unsigned int y = 0; y != size; y++, data += stride * 2) { -+ for (unsigned int x = 0; x != size; x++) { -+ printf("%4d", data[x * 2]); -+ } -+ printf("\n"); -+ } -+ printf("\n"); -+} -+#endif -+ -+#ifndef INCLUDED_ONCE -+static inline void extend_8(void * ptr, const unsigned int v, unsigned int n) -+{ -+ if ((n >>= 2) != 0) { -+ uint32_t v4 = v | (v << 8); -+ uint32_t * p = (uint32_t *)ptr; -+ v4 = v4 | (v4 << 16); -+ do { -+ *p++ = v4; -+ } while (--n != 0); -+ } -+} -+ -+static inline void extend_16(void * ptr, const unsigned int v, unsigned int n) -+{ -+ if ((n >>= 2) != 0) { -+ uint32_t v2 = v | (v << 16); -+ uint32_t * p = (uint32_t *)ptr; -+ do { -+ *p++ = v2; -+ *p++ = v2; -+ } while (--n != 0); -+ } -+} -+ -+static inline void extend_32(void * ptr, const unsigned int v, unsigned int n) -+{ -+ if ((n >>= 2) != 0) { -+ uint32_t * p = (uint32_t *)ptr; -+ do { -+ *p++ = v; -+ *p++ = v; -+ *p++ = v; -+ *p++ = v; -+ } while (--n != 0); -+ } -+} -+ -+// Beware that this inverts the avail ordering -+// For CIP it seems easier this way round -+static unsigned int cip_avail_l(const uint8_t * is_intra, const int i_stride, const unsigned int i_mask, -+ const unsigned int log2_intra_bits, const unsigned int avail, unsigned int size, -+ unsigned int s0, unsigned int odd_s) -+{ -+ const unsigned int n = 1 << log2_intra_bits; -+ unsigned int fa = 0; -+ unsigned int i; -+ -+ size >>= 2; // Now in 4-pel units -+ s0 >>= 2; -+ -+ if ((avail & AVAIL_DL) != 0) -+ fa |= ((1 << s0) - 1) << (size - s0); -+ if ((avail & AVAIL_L) != 0) -+ fa |= ((1 << size) - 1) << size; -+ if ((avail & AVAIL_UL) != 0) -+ fa |= 1 << (size << 1); -+ -+ if (odd_s) { -+ if ((fa & 1) != 0 && (*is_intra & i_mask) == 0) -+ fa &= ~1; -+ is_intra += i_stride; -+ } -+ -+ for (i = odd_s; (fa >> i) != 0; i += n, is_intra += i_stride) { -+ const unsigned int m = ((1 << n) - 1) << i; -+ if ((fa & m) != 0 && (*is_intra & i_mask) == 0) -+ fa &= ~m; -+ } -+ -+ return fa; -+} -+ -+static unsigned int cip_avail_u(const uint8_t * is_intra, unsigned int i_shift, -+ const unsigned int log2_intra_bits, const unsigned int avail, unsigned int size, -+ unsigned int s1, unsigned int odd_s) -+{ -+ if ((avail & (AVAIL_U | AVAIL_UR)) == 0) -+ { -+ return 0; -+ } -+ else -+ { -+ const unsigned int n = 1 << log2_intra_bits; -+ unsigned int fa = 0; -+ unsigned int i; -+ unsigned int im = ((is_intra[1] << 8) | (is_intra[0])) >> i_shift; -+ -+ size >>= 2; // Now in 4-pel units -+ s1 >>= 2; -+ -+ if ((avail & AVAIL_U) != 0) -+ fa |= ((1 << size) - 1); -+ if ((avail & AVAIL_UR) != 0) -+ fa |= ((1 << s1) - 1) << size; -+ -+ if (odd_s) { -+ fa &= im | ~1; -+ im >>= 1; -+ } -+ -+ for (i = odd_s; (fa >> i) != 0; i += n, im >>= 1) { -+ const unsigned int m = ((1 << n) - 1) << i; -+ if ((im & 1) == 0) -+ fa &= ~m; -+ } -+ return fa; -+ } -+} -+ -+ -+ -+static inline unsigned int rmbd(unsigned int x) -+{ -+#if 1 -+ return __builtin_ctz(x); -+#else -+ unsigned int n = 0; -+ if ((x & 0xffff) == 0) { -+ x >>= 16; -+ n += 16; -+ } -+ if ((x & 0xff) == 0) { -+ x >>= 8; -+ n += 8; -+ } -+ if ((x & 0xf) == 0) { -+ x >>= 4; -+ n += 4; -+ } -+ if ((x & 0x3) == 0) { -+ x >>= 2; -+ n += 2; -+ } -+ -+ return (x & 1) == 0 ? n + 1 : n; -+#endif -+} -+#endif -+ -+ -+static void FUNC(cip_fill)(pixel * const left, pixel * const top, -+ const unsigned int avail_l, const unsigned int avail_u, -+ const pixel * const src_l, const pixel * const src_u, const pixel * const src_ur, -+ const unsigned int stride, -+ const unsigned int size) -+{ -+ pixel a; -+ unsigned int i; -+ -+ // 1st find DL value -+ if ((avail_l & 1) == 0) { -+ if (avail_l != 0) -+ a = src_l[((int)size * 2 - 1 - (int)rmbd(avail_l)*4) * (int)stride]; -+ else -+ { -+ // (avail_l | avail_u) != 0 so this must be good -+ const unsigned int n = rmbd(avail_u)*4; -+ a = (n >= size) ? src_ur[n - size] : src_u[n]; -+ } -+ } -+ -+ // L -+ { -+ pixel * d = left + size * 2 - 1; -+ const pixel * s = src_l + (size * 2 - 1) * stride; -+ unsigned int x = avail_l; -+ for (i = 0; i < size * 2; i += 4, x >>= 1) -+ { -+ if ((x & 1) != 0) { -+ // Avail -+ *d-- = *s; -+ s -= stride; -+ *d-- = *s; -+ s -= stride; -+ *d-- = *s; -+ s -= stride; -+ *d-- = a = *s; -+ s -= stride; -+ } -+ else -+ { -+ *d-- = a; -+ *d-- = a; -+ *d-- = a; -+ *d-- = a; -+ s -= stride * 4; -+ } -+ } -+ // UL -+ *d = a = (x & 1) != 0 ? *s : a; -+ } -+ -+ // U -+ { -+ pixel * d = top; -+ const pixel * s = src_u; -+ unsigned int x = avail_u; -+ -+ for (i = 0; i < size; i += 4, x >>= 1) -+ { -+ if ((x & 1) != 0) { -+ // Avail -+ *d++ = *s++; -+ *d++ = *s++; -+ *d++ = *s++; -+ *d++ = a = *s++; -+ } -+ else -+ { -+ *d++ = a; -+ *d++ = a; -+ *d++ = a; -+ *d++ = a; -+ s += 4; -+ } -+ } -+ -+ // UR -+ s = src_ur; -+ for (i = 0; i < size; i += 4, x >>= 1) -+ { -+ if ((x & 1) != 0) { -+ // Avail -+ *d++ = *s++; -+ *d++ = *s++; -+ *d++ = *s++; -+ *d++ = a = *s++; -+ } -+ else -+ { -+ *d++ = a; -+ *d++ = a; -+ *d++ = a; -+ *d++ = a; -+ s += 4; -+ } -+ } -+ } -+} -+ -+ -+#if !PRED_C && PW == 1 -+#define EXTEND(ptr, val, len) extend_8(ptr, val, len) -+#elif (!PRED_C && PW == 2) || (PRED_C && PW == 1) -+#define EXTEND(ptr, val, len) extend_16(ptr, val, len) -+#else -+#define EXTEND(ptr, val, len) extend_32(ptr, val, len) -+#endif -+ -+// Reqs: -+// -+// Planar: DL[0], L, ul, U, UR[0] -+// DC: dl, L, ul, U, ur -+// A2-9: DL, L, ul, u, ur -+// A10: dl, L, ul, u, ur -+// A11-17 dl, L, UL, U, ur -+// A18-25 dl, L, Ul, U, ur -+// A26 dl, l, ul, U, ur -+// A27-34 dl, l, ul, U, UR -+ -+#ifndef INCLUDED_ONCE -+ -+intra_filter_fn_t ff_hevc_rpi_intra_filter_8_neon_8; -+intra_filter_fn_t ff_hevc_rpi_intra_filter_4_neon_16; -+intra_filter_fn_t ff_hevc_rpi_intra_filter_8_neon_16; -+ -+static const uint8_t req_avail_c[35] = -+{ -+ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR, // Planar (DL[0] & UR[0] only needed) -+ AVAIL_L | 0 | AVAIL_U, // DC -+ AVAIL_DL | AVAIL_L, // 2 -+ AVAIL_DL | AVAIL_L, // 3 -+ AVAIL_DL | AVAIL_L, // 4 -+ AVAIL_DL | AVAIL_L, // 5 -+ AVAIL_DL | AVAIL_L, // 6 -+ AVAIL_DL | AVAIL_L, // 7 -+ AVAIL_DL | AVAIL_L, // 8 -+ AVAIL_DL | AVAIL_L, // 9 -+ AVAIL_L, // 10 (H) -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 11 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 12 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 13 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 14 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 15 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 16 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 17 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 18 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 19 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 20 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 21 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 22 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 23 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 24 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 25 -+ AVAIL_U, // 26 (V) -+ AVAIL_U | AVAIL_UR, // 27 -+ AVAIL_U | AVAIL_UR, // 28 -+ AVAIL_U | AVAIL_UR, // 29 -+ AVAIL_U | AVAIL_UR, // 30 -+ AVAIL_U | AVAIL_UR, // 31 -+ AVAIL_U | AVAIL_UR, // 32 -+ AVAIL_U | AVAIL_UR, // 33 -+ AVAIL_U | AVAIL_UR // 34 -+}; -+ -+static const uint8_t req_avail[4][35] = { -+{ -+ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR, // Planar (DL[0] & UR[0] only needed) -+ AVAIL_L | 0 | AVAIL_U, // DC -+ AVAIL_DL | AVAIL_L, // 2 -+ AVAIL_DL | AVAIL_L, // 3 -+ AVAIL_DL | AVAIL_L, // 4 -+ AVAIL_DL | AVAIL_L, // 5 -+ AVAIL_DL | AVAIL_L, // 6 -+ AVAIL_DL | AVAIL_L, // 7 -+ AVAIL_DL | AVAIL_L, // 8 -+ AVAIL_DL | AVAIL_L, // 9 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 10 (H) -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 11 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 12 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 13 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 14 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 15 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 16 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 17 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 18 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 19 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 20 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 21 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 22 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 23 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 24 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 25 -+ AVAIL_L | AVAIL_UL | AVAIL_U, // 26 (V) -+ AVAIL_U | AVAIL_UR, // 27 -+ AVAIL_U | AVAIL_UR, // 28 -+ AVAIL_U | AVAIL_UR, // 29 -+ AVAIL_U | AVAIL_UR, // 30 -+ AVAIL_U | AVAIL_UR, // 31 -+ AVAIL_U | AVAIL_UR, // 32 -+ AVAIL_U | AVAIL_UR, // 33 -+ AVAIL_U | AVAIL_UR // 34 -+}, -+{ // 3 -+ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR | FILTER_LIGHT, // Planar (DL[0] & UR[0] only needed) -+ AVAIL_L | 0 | AVAIL_U, // DC -+ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 2 -+ AVAIL_DL | AVAIL_L | 0, // 3 -+ AVAIL_DL | AVAIL_L | 0, // 4 -+ AVAIL_DL | AVAIL_L | 0, // 5 -+ AVAIL_DL | AVAIL_L | 0, // 6 -+ AVAIL_DL | AVAIL_L | 0, // 7 -+ AVAIL_DL | AVAIL_L | 0, // 8 -+ AVAIL_DL | AVAIL_L | 0, // 9 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 10 (H) -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 11 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 12 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 13 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 14 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 15 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 16 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 17 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 18 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 19 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 20 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 21 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 22 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 23 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 24 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 25 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 26 (V) -+ AVAIL_U | AVAIL_UR | 0, // 27 -+ AVAIL_U | AVAIL_UR | 0, // 28 -+ AVAIL_U | AVAIL_UR | 0, // 29 -+ AVAIL_U | AVAIL_UR | 0, // 30 -+ AVAIL_U | AVAIL_UR | 0, // 31 -+ AVAIL_U | AVAIL_UR | 0, // 32 -+ AVAIL_U | AVAIL_UR | 0, // 33 -+ AVAIL_U | AVAIL_UR | FILTER_LIGHT // 34 -+}, -+{ // 4 -+ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR | FILTER_LIGHT, // Planar (DL[0] & UR[0] only needed) -+ AVAIL_L | 0 | AVAIL_U, // DC -+ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 2 -+ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 3 -+ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 4 -+ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 5 -+ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 6 -+ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 7 -+ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 8 -+ AVAIL_DL | AVAIL_L | 0, // 9 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 10 (H) -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 11 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 12 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 13 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 14 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 15 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 16 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 17 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 18 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 19 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 20 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 21 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 22 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 23 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 24 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 25 -+ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 26 (V) -+ AVAIL_U | AVAIL_UR | 0, // 27 -+ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 28 -+ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 29 -+ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 30 -+ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 31 -+ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 32 -+ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 33 -+ AVAIL_U | AVAIL_UR | FILTER_LIGHT // 34 -+}, -+{ // 5 -+ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR | FILTER_EITHER, // Planar (DL[0] & UR[0] only needed) -+ AVAIL_L | 0 | AVAIL_U, // DC -+ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 2 -+ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 3 -+ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 4 -+ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 5 -+ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 6 -+ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 7 -+ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 8 -+ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 9 -+ AVAIL_L | 0, // 10 (H) -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 11 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 12 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 13 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 14 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 15 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 16 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 17 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 18 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 19 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 20 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 21 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 22 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 23 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 24 -+ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 25 -+ AVAIL_U | 0, // 26 (V) -+ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 27 -+ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 28 -+ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 29 -+ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 30 -+ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 31 -+ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 32 -+ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 33 -+ AVAIL_U | AVAIL_UR | FILTER_EITHER // 34 -+} -+}; -+ -+ -+#endif -+ -+#define filter_light1 FUNC(filter_light1) -+static inline pixel filter_light1(pixel a, pixel b, pixel c) -+{ -+ return (a + b*2 + c + 2) >> 2; -+} -+ -+#define filter_light FUNC(filter_light) -+static inline void filter_light(pixel * dst, pixel p1, const pixel * src, const pixel pn, const int sstride, const unsigned int n) -+{ -+ pixel p0; -+ pixel p2 = *src; -+ // Allow for final pel - it is just clearer to to have the call take the actual number of output pels -+ unsigned int n_minus_1 = n - 1; -+ -+ do -+ { -+ src += sstride; -+ p0 = p1; -+ p1 = p2; -+ p2 = *src; -+ *dst++ = filter_light1(p0, p1, p2); -+ } while (--n_minus_1 != 0); -+ *dst = filter_light1(p1, p2, pn); -+} -+ -+#define filter_strong FUNC(filter_strong) -+static inline void filter_strong(pixel * dst, const unsigned int p0, const unsigned int p1, unsigned int n) -+{ -+ unsigned int a = 64 * p0 + 32; -+ const int v = p1 - p0; -+ -+ do -+ { -+ *dst++ = (a += v) >> 6; -+ } while (--n != 0); -+} -+ -+#define intra_filter FUNC(intra_filter) -+static av_always_inline void intra_filter( -+ pixel * const left, pixel * const top, -+ const unsigned int req, const unsigned int avail, -+ const pixel * const src_l, const pixel * const src_u, const pixel * const src_ur, -+ const unsigned int stride, -+ const unsigned int top_right_size, const unsigned int down_left_size, -+ const unsigned int log2_size) -+{ -+ const unsigned int strong_threshold = 1 << (BIT_DEPTH - 5); -+ const unsigned int size = 1 << log2_size; -+ -+ // a_ is the first pel in a section working round dl -> ur -+ // b_ is the last -+ // Beware that top & left work out from UL so usage of a_ & b_ may -+ // swap between them. It is a bad naming scheme but I have found no -+ // better -+ const pixel * a_dl = src_l + (down_left_size + size - 1) * stride; -+ const pixel * b_dl = src_l + size * stride; -+ const pixel * a_l = src_l + (size - 1) * stride; -+ const pixel * b_l = src_l; -+ const pixel * ab_ul = src_l - stride; -+ const pixel * a_u = src_u; -+ const pixel * b_u = src_u + size - 1; -+ const pixel * a_ur = src_ur; -+ const pixel * b_ur = src_ur + top_right_size - 1; -+ -+ const unsigned int want = req & ~avail; -+ const unsigned int have = req & avail; -+ unsigned int i; -+ -+ if ((avail & AVAIL_DL) == 0) -+ { -+ a_dl = a_ur; -+ if ((avail & AVAIL_U) != 0) -+ a_dl = a_u; -+ if ((avail & AVAIL_UL) != 0) -+ a_dl = ab_ul; -+ if ((avail & AVAIL_L) != 0) -+ a_dl = a_l; -+ b_dl = a_dl; -+ } -+ -+ if ((avail & AVAIL_L) == 0) -+ { -+ a_l = b_dl; -+ b_l = b_dl; -+ } -+ if ((avail & AVAIL_UL) == 0) -+ { -+ ab_ul = b_l; -+ } -+ if ((avail & AVAIL_U) == 0) -+ { -+ a_u = ab_ul; -+ b_u = ab_ul; -+ } -+ if ((avail & AVAIL_UR) == 0) -+ { -+ a_ur = b_u; -+ b_ur = b_u; -+ } -+ -+ if ((req & FILTER_LIGHT) == 0 || PRED_C || log2_size == 2) // PRED_C, log2_size compiler opt hints -+ { -+ if ((req & AVAIL_UL) != 0) -+ left[-1] = *ab_ul; -+ -+ if ((want & AVAIL_L) != 0) -+ EXTEND(left, *a_l, size); -+ if ((want & AVAIL_DL) != 0) -+ EXTEND(left + size, *a_dl, size); -+ if ((want & AVAIL_U) != 0) -+ EXTEND(top, *a_u, size); -+ if ((want & AVAIL_UR) != 0) -+ EXTEND(top + size, *a_ur, size); -+ -+ if ((have & AVAIL_U) != 0) -+ // Always good - even with sand -+ memcpy(top, a_u, size * sizeof(pixel)); -+ if ((have & AVAIL_UR) != 0) -+ { -+ memcpy(top + size, a_ur, top_right_size * sizeof(pixel)); -+ EXTEND(top + size + top_right_size, *b_ur, -+ size - top_right_size); -+ } -+ if ((have & AVAIL_L) != 0) -+ { -+ for (i = 0; i < size; i++) -+ left[i] = b_l[stride * i]; -+ } -+ if ((have & AVAIL_DL) != 0) -+ { -+ for (i = 0; i < down_left_size; i++) -+ left[i + size] = b_dl[stride * i]; -+ EXTEND(left + size + down_left_size, *a_dl, -+ size - down_left_size); -+ } -+ } -+ else if ((req & FILTER_STRONG) != 0 && log2_size == 5 && // log2_size compiler opt hint -+ FFABS((int)(*a_dl - *a_l * 2 + *ab_ul)) < strong_threshold && -+ FFABS((int)(*ab_ul - *b_u * 2 + *b_ur)) < strong_threshold) -+ { -+ if ((req & (AVAIL_U | AVAIL_UR)) != 0) -+ filter_strong(top, *ab_ul, *b_ur, size * 2); -+ left[-1] = *ab_ul; -+ if ((req & (AVAIL_L | AVAIL_DL)) != 0) -+ filter_strong(left, *ab_ul, *a_dl, size*2); -+ } -+ else -+ { -+ // Same code for both have & want for UL -+ if ((req & AVAIL_UL) != 0) -+ { -+ left[-1] = filter_light1(*b_l, *ab_ul, *a_u); -+ } -+ -+ if ((want & AVAIL_L) != 0) -+ { -+ EXTEND(left, *a_l, size); -+ left[0] = (*a_l * 3 + *ab_ul + 2) >> 2; -+ } -+ if ((want & AVAIL_DL) != 0) -+ { -+ // If we want DL then it cannot be avail so a_dl = a_l so no edge rounding -+ EXTEND(left + size, *a_l, size); -+ } -+ if ((want & AVAIL_U) != 0) -+ { -+ EXTEND(top, *a_u, size); -+ top[size - 1] = (*a_u * 3 + *a_ur + 2) >> 2; -+ } -+ if ((want & AVAIL_UR) != 0) -+ { -+ // If we want UR then it cannot be avail so a_ur = b_u so no edge rounding -+ EXTEND(top + size, *a_ur, size); -+ } -+ -+ if ((have & AVAIL_U) != 0) -+ { -+ filter_light(top, *ab_ul, a_u, *a_ur, 1, size); -+ } -+ if ((have & AVAIL_UR) != 0) { -+ filter_light(top + size, *b_u, a_ur, *b_ur, 1, top_right_size); -+ top[size*2 - 1] = *b_ur; -+ EXTEND(top + size + top_right_size, *b_ur, size - top_right_size); -+ } -+ if ((have & AVAIL_L) != 0) -+ { -+ filter_light(left, *ab_ul, b_l, *b_dl, stride, size); -+ } -+ if ((have & AVAIL_DL) != 0) -+ { -+ filter_light(left + size, *a_l, b_dl, *a_dl, stride, down_left_size); -+ left[size*2 - 1] = *a_dl; -+ EXTEND(left + size + down_left_size, *a_dl, size - down_left_size); -+ } -+ } -+} -+ -+#define INTRA_FILTER(log2_size) \ -+static void FUNC(intra_filter_ ## log2_size)( \ -+ uint8_t * const left, uint8_t * const top, \ -+ const unsigned int req, const unsigned int avail, \ -+ const uint8_t * const src_l, const uint8_t * const src_u, const uint8_t * const src_ur, \ -+ const unsigned int stride, \ -+ const unsigned int top_right_size, const unsigned int down_left_size) \ -+{ \ -+ intra_filter((pixel *)left, (pixel *)top, req, avail, \ -+ (const pixel *)src_l, (const pixel *)src_u, (const pixel *)src_ur, stride / sizeof(pixel), top_right_size, down_left_size, log2_size); \ -+} -+ -+INTRA_FILTER(2) -+INTRA_FILTER(3) -+INTRA_FILTER(4) -+INTRA_FILTER(5) -+ -+#undef intra_filter -+#undef INTRA_FILTER -+ -+static void FUNC(intra_pred)(const HEVCRpiContext * const s, -+ const enum IntraPredMode mode, const unsigned int x0, const unsigned int y0, const unsigned int avail, -+ const unsigned int log2_size) -+{ -+ // c_idx will alaways be 1 for _c versions and 0 for y -+ const unsigned int c_idx = PRED_C; -+ const unsigned int hshift = ctx_hshift(s, c_idx); -+ const unsigned int vshift = ctx_vshift(s, c_idx); -+ const unsigned int size = (1 << log2_size); -+ const unsigned int x = x0 >> hshift; -+ const unsigned int y = y0 >> vshift; -+ -+ const ptrdiff_t stride = frame_stride1(s->frame, c_idx) / sizeof(pixel); -+ pixel *const src = c_idx == 0 ? -+ (pixel *)av_rpi_sand_frame_pos_y(s->frame, x, y) : -+ (pixel *)av_rpi_sand_frame_pos_c(s->frame, x, y); -+ -+ // Align so we can do multiple loads in the asm -+ // Padded to 16 byte boundary so as not to confuse anything -+ DECLARE_ALIGNED(16, pixel, top[2 * MAX_TB_SIZE]); -+ DECLARE_ALIGNED(16, pixel, left_array[2 * MAX_TB_SIZE + 16 / sizeof(pixel)]); -+ -+ pixel * const left = left_array + 16 / sizeof(pixel); -+ const pixel * top_pred = top; -+ -+ const pixel * src_l = src - 1; -+ const pixel * src_u = src - stride; -+ const pixel * src_ur = src_u + size; -+#if !PRED_C -+ const unsigned int req = req_avail[log2_size - 2][mode] & ~s->ps.sps->intra_filters_disable; -+#else -+ const unsigned int req = req_avail_c[mode]; -+#endif -+ -+ // If we have nothing to pred from then fill with grey -+ // This isn't a common case but dealing with it here means we don't have to -+ // test for it later -+ if (avail == 0) -+ { -+dc_only: -+#if !PRED_C -+ s->hpc.pred_dc0[log2_size - 2]((uint8_t *)src, stride); -+#else -+ s->hpc.pred_dc0_c[log2_size - 2]((uint8_t *)src, stride); -+#endif -+ return; -+ } -+ -+ { -+ // N.B. stride is in pixels (not bytes) or in the case of chroma pixel-pairs -+ const AVFrame * const frame = s->frame; -+ const unsigned int mask = stride - 1; // For chroma pixel=uint16 so stride_c is stride_y / 2 -+ const unsigned int stripe_adj = (av_rpi_sand_frame_stride2(frame) - 1) * stride; -+ if ((x & mask) == 0) -+ src_l -= stripe_adj; -+ if (((x + size) & mask) == 0) -+ src_ur += stripe_adj; -+ } -+ -+ // Can deal with I-slices in 'normal' code even if CIP -+ // This also means that we don't need to generate (elsewhere) is_intra -+ // for IRAP frames -+ if (s->ps.pps->constrained_intra_pred_flag == 1 && -+ s->sh.slice_type != HEVC_SLICE_I) -+ { -+ // * If we ever actually care about CIP performance then we should -+ // special case out size 4 stuff (can be done by 'normal') and -+ // have 8-pel avail masks -+ unsigned int avail_l = cip_avail_l(s->is_intra + ((y + size * 2 - 1) >> (3 - vshift)) * s->ps.sps->pcm_width + ((x - 1) >> (6 - hshift)), -+ -(int)(s->ps.sps->pcm_width), -+ 1 << (((x - 1) >> (3 - hshift)) & 7), -+ 1 - hshift, -+ avail, -+ size, -+ FFMIN(size, ((s->ps.sps->height - y0) >> vshift) - size), -+ vshift != 0 ? 0 : (y >> 2) & 1); -+ -+ unsigned int avail_u = cip_avail_u(s->is_intra + ((y - 1) >> (3 - vshift)) * s->ps.sps->pcm_width + (x >> (6 - hshift)), -+ (x >> (3 - hshift)) & 7, -+ 1 - hshift, -+ avail, -+ size, -+ FFMIN(size, ((s->ps.sps->width - x0) >> hshift) - size), -+ hshift != 0 ? 0 : (x >> 2) & 1); -+ -+ // Anything left? -+ if ((avail_l | avail_u) == 0) -+ goto dc_only; -+ -+ FUNC(cip_fill)(left, top, avail_l, avail_u, src_l, src_u, src_ur, stride, size); -+ -+#if !PRED_C -+ if ((req & FILTER_LIGHT) != 0) -+ { -+ const unsigned threshold = 1 << (BIT_DEPTH - 5); -+ if ((req & FILTER_STRONG) != 0 && -+ (int)(FFABS(left[-1] + top[63] - 2 * top[31])) < threshold && -+ (int)(FFABS(left[-1] + left[63] - 2 * left[31])) < threshold) -+ { -+ filter_strong(top, left[-1], top[63], 64); -+ filter_strong(left, left[-1], left[63], 64); -+ } else -+ { -+ // LHS writes UL too so copy for top -+ const pixel p_ul = left[-1]; -+ filter_light(left - 1, top[0], left - 1, left[2*size - 1], 1, 2*size); -+ filter_light(top, p_ul, top, top[2*size - 1], 1, 2*size - 1); -+ } -+ } -+#endif -+ } -+ else -+ { -+ const unsigned int ur_size = FFMIN(size, ((s->ps.sps->width - x0) >> hshift) - size); -+ if ((req & ~((AVAIL_UR | AVAIL_U) & avail)) == 0 && -+ ((req & AVAIL_UR) == 0 || src_u + 2*size == src_ur + ur_size)) -+ { -+ top_pred = src_u; -+ } -+ else -+ { -+#if !PRED_C -+ s->hpc.intra_filter[log2_size - 2] -+#else -+ s->hpc.intra_filter_c[log2_size - 2] -+#endif -+ ((uint8_t *)left, (uint8_t *)top, req, avail, -+ (const uint8_t *)src_l, (const uint8_t *)src_u, (const uint8_t *)src_ur, stride * sizeof(pixel), -+ ur_size, -+ FFMIN(size, ((s->ps.sps->height - y0) >> vshift) - size)); -+ } -+ } -+ -+ -+#if !PRED_C -+ switch (mode) { -+ case INTRA_PLANAR: -+ s->hpc.pred_planar[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride); -+ break; -+ case INTRA_DC: -+ s->hpc.pred_dc[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride); -+ break; -+ case INTRA_ANGULAR_HORIZONTAL: -+ s->hpc.pred_horizontal[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride, -+ mode); -+ break; -+ case INTRA_ANGULAR_VERTICAL: -+ s->hpc.pred_vertical[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride, -+ mode); -+ break; -+ default: -+ s->hpc.pred_angular[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride, -+ mode); -+ break; -+ } -+#else -+ switch (mode) { -+ case INTRA_PLANAR: -+ s->hpc.pred_planar_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride); -+ break; -+ case INTRA_DC: -+ s->hpc.pred_dc_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride); -+ break; -+ case INTRA_ANGULAR_HORIZONTAL: -+ s->hpc.pred_horizontal_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride, -+ mode); -+ break; -+ case INTRA_ANGULAR_VERTICAL: -+ s->hpc.pred_vertical_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride, -+ mode); -+ break; -+ default: -+ s->hpc.pred_angular_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, -+ (uint8_t *)left, stride, -+ mode); -+ break; -+ } -+ -+#if DUMP_PRED -+ printf("U pred @ %d, %d: mode=%d\n", x, y, mode); -+ dump_pred_uv((uint8_t *)src, stride, 1 << log2_size); -+ printf("V pred @ %d, %d: mode=%d\n", x, y, mode); -+ dump_pred_uv((uint8_t *)src + 1, stride, 1 << log2_size); -+#endif -+#endif -+} -+ -+#if !PRED_C -+static av_always_inline void FUNC(pred_planar)(uint8_t *_src, const uint8_t *_top, -+ const uint8_t *_left, ptrdiff_t stride, -+ int trafo_size) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ const pixel *top = (const pixel *)_top; -+ const pixel *left = (const pixel *)_left; -+ int size = 1 << trafo_size; -+ for (y = 0; y < size; y++) -+ for (x = 0; x < size; x++) -+ POS(x, y) = ((size - 1 - x) * left[y] + (x + 1) * top[size] + -+ (size - 1 - y) * top[x] + (y + 1) * left[size] + size) >> (trafo_size + 1); -+} -+#else -+static av_always_inline void FUNC(pred_planar)(uint8_t * _src, const uint8_t * _top, -+ const uint8_t * _left, ptrdiff_t stride, -+ int trafo_size) -+{ -+ int x, y; -+ int size = 1 << trafo_size; -+ c_dst_ptr_t src = (c_dst_ptr_t)_src; -+ const c_src_ptr_t top = (c_src_ptr_t)_top; -+ const c_src_ptr_t left = (c_src_ptr_t)_left; -+ -+ for (y = 0; y < size; y++, src += stride) -+ { -+ for (x = 0; x < size; x++) -+ { -+ src[x][0] = ((size - 1 - x) * left[y][0] + (x + 1) * top[size][0] + -+ (size - 1 - y) * top[x][0] + (y + 1) * left[size][0] + size) >> (trafo_size + 1); -+ src[x][1] = ((size - 1 - x) * left[y][1] + (x + 1) * top[size][1] + -+ (size - 1 - y) * top[x][1] + (y + 1) * left[size][1] + size) >> (trafo_size + 1); -+ } -+ } -+} -+#endif -+ -+#define PRED_PLANAR(size)\ -+static void FUNC(pred_planar_ ## size)(uint8_t *src, const uint8_t *top, \ -+ const uint8_t *left, ptrdiff_t stride) \ -+{ \ -+ FUNC(pred_planar)(src, top, left, stride, size + 2); \ -+} -+ -+PRED_PLANAR(0) -+PRED_PLANAR(1) -+PRED_PLANAR(2) -+PRED_PLANAR(3) -+ -+#undef PRED_PLANAR -+ -+#if !PRED_C -+static void FUNC(pred_dc)(uint8_t *_src, const uint8_t *_top, -+ const uint8_t *_left, -+ ptrdiff_t stride, int log2_size) -+{ -+ int i, j, x, y; -+ int size = (1 << log2_size); -+ pixel *src = (pixel *)_src; -+ const pixel *top = (const pixel *)_top; -+ const pixel *left = (const pixel *)_left; -+ int dc = size; -+ pixel4 a; -+ for (i = 0; i < size; i++) -+ dc += left[i] + top[i]; -+ -+ dc >>= log2_size + 1; -+ -+ a = PIXEL_SPLAT_X4(dc); -+ -+ for (i = 0; i < size; i++) -+ for (j = 0; j < size; j+=4) -+ AV_WN4P(&POS(j, i), a); -+ -+// if (c_idx == 0 && size < 32) -+// As we now have separate fns for y & c - no need to test that -+ if (size < 32) -+ { -+ POS(0, 0) = (left[0] + 2 * dc + top[0] + 2) >> 2; -+ for (x = 1; x < size; x++) -+ POS(x, 0) = (top[x] + 3 * dc + 2) >> 2; -+ for (y = 1; y < size; y++) -+ POS(0, y) = (left[y] + 3 * dc + 2) >> 2; -+ } -+} -+#else -+static void FUNC(pred_dc)(uint8_t *_src, const uint8_t *_top, -+ const uint8_t *_left, -+ ptrdiff_t stride, int log2_size) -+{ -+ unsigned int i, j; -+ const unsigned int size = (1 << log2_size); -+ c_dst_ptr_t src = (c_dst_ptr_t)_src; -+ const c_src_ptr_t top = (c_src_ptr_t)_top; -+ const c_src_ptr_t left = (c_src_ptr_t)_left; -+ unsigned int dc0 = size; -+ unsigned int dc1 = size; -+ -+ for (i = 0; i < size; i++) -+ { -+ dc0 += left[i][0] + top[i][0]; -+ dc1 += left[i][1] + top[i][1]; -+ } -+ -+ dc0 >>= log2_size + 1; -+ dc1 >>= log2_size + 1; -+ -+ for (i = 0; i < size; i++, src += stride) -+ { -+ for (j = 0; j < size; ++j) -+ { -+ src[j][0] = dc0; -+ src[j][1] = dc1; -+ -+ } -+ } -+} -+#endif -+ -+#define PRED_DC(size)\ -+static void FUNC(pred_dc_ ## size)(uint8_t *src, const uint8_t *top, \ -+ const uint8_t *left, ptrdiff_t stride) \ -+{ \ -+ FUNC(pred_dc)(src, top, left, stride, size + 2); \ -+} -+ -+PRED_DC(0) -+PRED_DC(1) -+PRED_DC(2) -+PRED_DC(3) -+ -+#undef PRED_DC -+ -+ -+ -+ -+#if !PRED_C -+static void FUNC(pred_dc0)(uint8_t *_src, ptrdiff_t stride, int log2_size) -+{ -+ int i, j; -+ int size = (1 << log2_size); -+ pixel *src = (pixel *)_src; -+ pixel4 a = PIXEL_SPLAT_X4(1 << (BIT_DEPTH - 1)); -+ -+ for (i = 0; i < size; i++) -+ for (j = 0; j < size; j+=4) -+ AV_WN4P(&POS(j, i), a); -+} -+#else -+static void FUNC(pred_dc0)(uint8_t *_src, ptrdiff_t stride, int log2_size) -+{ -+ unsigned int i, j; -+ const unsigned int size = (1 << log2_size); -+ c_dst_ptr_t src = (c_dst_ptr_t)_src; -+ const pixel a = (1 << (BIT_DEPTH - 1)); -+ -+ for (i = 0; i < size; i++, src += stride) -+ { -+ for (j = 0; j < size; ++j) -+ { -+ src[j][0] = a; -+ src[j][1] = a; -+ } -+ } -+} -+#endif -+ -+#define PRED_DC0(size)\ -+static void FUNC(pred_dc0_ ## size)(uint8_t *src, ptrdiff_t stride) \ -+{ \ -+ FUNC(pred_dc0)(src, stride, size + 2); \ -+} -+ -+PRED_DC0(0) -+PRED_DC0(1) -+PRED_DC0(2) -+PRED_DC0(3) -+ -+#undef PRED_DC0 -+ -+ -+ -+ -+#ifndef ANGLE_CONSTS -+#define ANGLE_CONSTS -+static const int intra_pred_angle[] = { -+ 32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32, -+ -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32 -+}; -+static const int inv_angle[] = { -+ -4096, -1638, -910, -630, -482, -390, -315, -256, -315, -390, -482, -+ -630, -910, -1638, -4096 -+}; -+#endif -+ -+#if !PRED_C -+static av_always_inline void FUNC(pred_angular)(uint8_t *_src, -+ const uint8_t *_top, -+ const uint8_t *_left, -+ ptrdiff_t stride, -+ int mode, int size) -+{ -+ int x, y; -+ pixel *src = (pixel *)_src; -+ const pixel *top = (const pixel *)_top; -+ const pixel *left = (const pixel *)_left; -+ -+ int angle = intra_pred_angle[mode - 2]; -+ pixel ref_array[3 * MAX_TB_SIZE + 4]; -+ pixel *ref_tmp = ref_array + size; -+ const pixel *ref; -+ int last = (size * angle) >> 5; -+ -+ if (mode >= 18) { -+ ref = top - 1; -+ -+ if (angle < 0) -+ { -+ memcpy(ref_tmp + 1, top, size * PW); -+ ref_tmp[0] = left[-1]; -+ -+ for (x = last; x <= -1; x++) -+ ref_tmp[x] = left[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)]; -+ ref = ref_tmp; -+ } -+ -+ for (y = 0; y < size; y++) { -+ int idx = ((y + 1) * angle) >> 5; -+ int fact = ((y + 1) * angle) & 31; -+ if (fact) { -+ for (x = 0; x < size; x += 4) { -+ POS(x , y) = ((32 - fact) * ref[x + idx + 1] + -+ fact * ref[x + idx + 2] + 16) >> 5; -+ POS(x + 1, y) = ((32 - fact) * ref[x + 1 + idx + 1] + -+ fact * ref[x + 1 + idx + 2] + 16) >> 5; -+ POS(x + 2, y) = ((32 - fact) * ref[x + 2 + idx + 1] + -+ fact * ref[x + 2 + idx + 2] + 16) >> 5; -+ POS(x + 3, y) = ((32 - fact) * ref[x + 3 + idx + 1] + -+ fact * ref[x + 3 + idx + 2] + 16) >> 5; -+ } -+ } else { -+ for (x = 0; x < size; x += 4) -+ AV_WN4P(&POS(x, y), AV_RN4P(&ref[x + idx + 1])); -+ } -+ } -+ if (mode == 26 && size < 32) { -+ for (y = 0; y < size; y++) -+ POS(0, y) = av_clip_pixel(top[0] + ((left[y] - left[-1]) >> 1)); -+ } -+ -+ } else { -+ ref = left - 1; -+ if (angle < 0 && last < -1) { -+ for (x = 0; x <= size; x += 4) -+ AV_WN4P(&ref_tmp[x], AV_RN4P(&left[x - 1])); -+ // Inv angle <= -256 so top offset >= 0 -+ for (x = last; x <= -1; x++) -+ ref_tmp[x] = top[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)]; -+ ref = ref_tmp; -+ } -+ -+ for (x = 0; x < size; x++) { -+ int idx = ((x + 1) * angle) >> 5; -+ int fact = ((x + 1) * angle) & 31; -+ if (fact) { -+ for (y = 0; y < size; y++) { -+ POS(x, y) = ((32 - fact) * ref[y + idx + 1] + -+ fact * ref[y + idx + 2] + 16) >> 5; -+ } -+ } else { -+ for (y = 0; y < size; y++) -+ POS(x, y) = ref[y + idx + 1]; -+ } -+ } -+ if (mode == 10 && size < 32) { -+ for (x = 0; x < size; x += 4) { -+ POS(x, 0) = av_clip_pixel(left[0] + ((top[x ] - left[-1]) >> 1)); -+ POS(x + 1, 0) = av_clip_pixel(left[0] + ((top[x + 1] - left[-1]) >> 1)); -+ POS(x + 2, 0) = av_clip_pixel(left[0] + ((top[x + 2] - left[-1]) >> 1)); -+ POS(x + 3, 0) = av_clip_pixel(left[0] + ((top[x + 3] - left[-1]) >> 1)); -+ } -+ } -+ } -+} -+#else -+static av_always_inline void FUNC(pred_angular)(uint8_t *_src, -+ const uint8_t *_top, -+ const uint8_t *_left, -+ ptrdiff_t stride, -+ int mode, int size) -+{ -+ int x, y; -+ c_dst_ptr_t src = (c_dst_ptr_t)_src; -+ c_src_ptr_t top = (c_src_ptr_t)_top; -+ c_src_ptr_t left = (c_src_ptr_t)_left; -+ -+ const int angle = intra_pred_angle[mode - 2]; -+ cpel ref_array[3 * MAX_TB_SIZE + 4][2]; -+ c_dst_ptr_t ref_tmp = ref_array + size; -+ c_src_ptr_t ref; -+ const int last = (size * angle) >> 5; -+ -+ if (mode >= 18) { -+ ref = top - 1; -+ if (angle < 0) { -+ memcpy(ref_tmp + 1, top, size * 2 * PW); -+ ref_tmp[0][0] = left[-1][0]; -+ ref_tmp[0][1] = left[-1][1]; -+ for (x = last; x <= -1; x++) -+ { -+ ref_tmp[x][0] = left[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)][0]; -+ ref_tmp[x][1] = left[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)][1]; -+ } -+ ref = (c_src_ptr_t)ref_tmp; -+ } -+ -+ for (y = 0; y < size; y++, src += stride) { -+ const int idx = ((y + 1) * angle) >> 5; -+ const int fact = ((y + 1) * angle) & 31; -+ if (fact) { -+ for (x = 0; x < size; ++x) { -+ src[x][0] = ((32 - fact) * ref[x + idx + 1][0] + -+ fact * ref[x + idx + 2][0] + 16) >> 5; -+ src[x][1] = ((32 - fact) * ref[x + idx + 1][1] + -+ fact * ref[x + idx + 2][1] + 16) >> 5; -+ } -+ } else { -+ memcpy(src, ref + idx + 1, size * 2 * PW); -+ } -+ } -+ } else { -+ ref = left - 1; -+ if (angle < 0 && last < -1) { -+ memcpy(ref_tmp, left - 1, (size + 1) * 2 * PW); -+ for (x = last; x <= -1; x++) -+ { -+ ref_tmp[x][0] = top[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)][0]; -+ ref_tmp[x][1] = top[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)][1]; -+ } -+ ref = (c_src_ptr_t)ref_tmp; -+ } -+ -+ for (x = 0; x < size; x++, src++) { -+ const int idx = ((x + 1) * angle) >> 5; -+ const int fact = ((x + 1) * angle) & 31; -+ if (fact) { -+ for (y = 0; y < size; y++) { -+ src[y * stride][0] = ((32 - fact) * ref[y + idx + 1][0] + -+ fact * ref[y + idx + 2][0] + 16) >> 5; -+ src[y * stride][1] = ((32 - fact) * ref[y + idx + 1][1] + -+ fact * ref[y + idx + 2][1] + 16) >> 5; -+ } -+ } else { -+ for (y = 0; y < size; y++) -+ { -+ src[y * stride][0] = ref[y + idx + 1][0]; -+ src[y * stride][1] = ref[y + idx + 1][1]; -+ } -+ } -+ } -+ } -+} -+#endif -+ -+static void FUNC(pred_angular_0)(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, -+ ptrdiff_t stride, int mode) -+{ -+ FUNC(pred_angular)(src, top, left, stride, mode, 1 << 2); -+} -+ -+static void FUNC(pred_angular_1)(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, -+ ptrdiff_t stride, int mode) -+{ -+ FUNC(pred_angular)(src, top, left, stride, mode, 1 << 3); -+} -+ -+static void FUNC(pred_angular_2)(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, -+ ptrdiff_t stride, int mode) -+{ -+ FUNC(pred_angular)(src, top, left, stride, mode, 1 << 4); -+} -+ -+static void FUNC(pred_angular_3)(uint8_t *src, const uint8_t *top, -+ const uint8_t *left, -+ ptrdiff_t stride, int mode) -+{ -+ FUNC(pred_angular)(src, top, left, stride, mode, 1 << 5); -+} -+ -+#undef cpel -+#undef c_src_ptr_t -+#undef c_dst_ptr_t -+ -+#undef EXTEND -+#undef POS -+#undef PW -+ -+#undef filter_light1 -+#undef filter_light -+#undef filter_strong -+#undef ref_gen -+ -+#ifndef INCLUDED_ONCE -+#define INCLUDED_ONCE -+#endif -+ ---- /dev/null -+++ b/libavcodec/rpi_mailbox.c -@@ -0,0 +1,155 @@ -+/* -+Copyright (c) 2012, Broadcom Europe Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+*/ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#define MAJOR_NUM 100 -+#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) -+#define DEVICE_FILE_NAME "/dev/vcio" -+ -+#include "rpi_mailbox.h" -+//#include -+ -+/* -+ * use ioctl to send mbox property message -+ */ -+ -+static int mbox_property(int file_desc, void *buf) -+{ -+ int ret_val = ioctl(file_desc, IOCTL_MBOX_PROPERTY, buf); -+ -+ if (ret_val < 0) { -+ printf("ioctl_set_msg failed:%d\n", ret_val); -+ } -+ -+#ifdef DEBUG -+ unsigned *p = buf; int i; unsigned size = *(unsigned *)buf; -+ for (i=0; i -+#include -+#include -+#include -+ -+#include "config.h" -+ -+#include "libavutil/avassert.h" -+#include "libavutil/rpi_sand_fns.h" -+ -+#pragma GCC diagnostic push -+// Many many redundant decls in the header files -+#pragma GCC diagnostic ignored "-Wredundant-decls" -+#include -+#include -+#include -+#pragma GCC diagnostic pop -+ -+#include "rpi_mem.h" -+#include "rpi_zc_frames.h" -+ -+ -+#define OPT_PREFER_CMA 0 -+ -+struct rpi_cache_flush_env_s { -+ struct vcsm_user_clean_invalid2_s v; -+}; -+ -+ -+// GPU memory alloc fns (internal) -+ -+static void gpu_free_internal(GPU_MEM_PTR_T * const p) -+{ -+ if (p->arm != NULL) -+ vcsm_unlock_ptr(p->arm); -+ if (p->vcsm_handle != 0) -+ vcsm_free(p->vcsm_handle); -+ memset(p, 0, sizeof(*p)); // Ensure we crash hard if we try and use this again -+} -+ -+ -+static int gpu_malloc_internal(GPU_MEM_PTR_T * const p, -+ const int numbytes, const unsigned int cache_type, const char * const name) -+{ -+ memset(p, 0, sizeof(*p)); -+ p->numbytes = (numbytes + 255) & ~255; // Round up -+ -+ if ((p->vcsm_handle = vcsm_malloc_cache(p->numbytes, cache_type | 0x80, (char *)name)) == 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "Unable to alloc %d bytes from VCSM for %s\n", p->numbytes, name); -+ goto fail; -+ } -+ if ((p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle)) == 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "Unable to VC handle from VCSM for %s\n", name); -+ goto fail; -+ } -+ if ((p->arm = vcsm_lock(p->vcsm_handle)) == NULL) -+ { -+ av_log(NULL, AV_LOG_ERROR, "Unable to lock handle from VCSM for %s\n", name); -+ goto fail; -+ } -+ if ((p->vc = vcsm_vc_addr_from_hdl(p->vcsm_handle)) == 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "Unable to get VC addr from VCSM for %s\n", name); -+ goto fail; -+ } -+ -+ return 0; -+ -+fail: -+ gpu_free_internal(p); -+ return AVERROR(ENOMEM); -+} -+ -+// Public gpu fns -+ -+// Allocate memory on GPU -+// Fills in structure

containing ARM pointer, videocore handle, videocore memory address, numbytes -+// Returns 0 on success. -+// This allocates memory that will not be cached in ARM's data cache. -+// Therefore safe to use without data cache flushing. -+int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) -+{ -+ return gpu_malloc_internal(p, numbytes, VCSM_CACHE_TYPE_NONE, "ffmpeg uncached"); -+} -+ -+// This allocates data that will be -+// Cached in ARM L2 -+// Uncached in VPU L2 -+int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) -+{ -+ return gpu_malloc_internal(p, numbytes, VCSM_CACHE_TYPE_HOST, "ffmpeg cached"); -+} -+ -+void gpu_free(GPU_MEM_PTR_T * const p) { -+ gpu_free_internal(p); -+} -+ -+void rpi_mem_gpu_uninit(void) -+{ -+ vcsm_exit(); -+ bcm_host_deinit(); -+} -+ -+int rpi_mem_gpu_init(const unsigned int flags) -+{ -+ const int wants_cma = bcm_host_is_fkms_active(); -+ int use_cma; -+ -+ (void)flags; -+ -+ if (vcsm_init_ex(wants_cma ? 1 : 0, -1) == 0) -+ use_cma = 1; -+ else if (vcsm_init_ex(wants_cma ? 0 : 1, -1) == 0) -+ use_cma = 0; -+ else -+ return AVERROR(EINVAL); -+ -+ bcm_host_init(); -+ -+ return use_cma + 1; -+} -+ -+// ---------------------------------------------------------------------------- -+// -+// Cache flush functions -+ -+#define CACHE_EL_MAX ((sizeof(rpi_cache_buf_t) - sizeof (struct vcsm_user_clean_invalid2_s)) / sizeof (struct vcsm_user_clean_invalid2_block_s)) -+ -+rpi_cache_flush_env_t * rpi_cache_flush_init(rpi_cache_buf_t * const buf) -+{ -+ rpi_cache_flush_env_t * const rfe = (rpi_cache_flush_env_t *)buf; -+ *rfe = (rpi_cache_flush_env_t){.v={.op_count = 0}}; -+ return rfe; -+} -+ -+void rpi_cache_flush_abort(rpi_cache_flush_env_t * const rfe) -+{ -+ // Nothing needed -+} -+ -+int rpi_cache_flush_execute(rpi_cache_flush_env_t * const rfe) -+{ -+ int rc = 0; -+ if (rfe->v.op_count != 0) { -+ if (vcsm_clean_invalid2(&rfe->v) != 0) -+ { -+ const int err = errno; -+ av_log(NULL, AV_LOG_ERROR, "vcsm_clean_invalid2 failed: errno=%d\n", err); -+ rc = AVERROR(err); -+ } -+ rfe->v.op_count = 0; -+ } -+ return rc; -+} -+ -+int rpi_cache_flush_finish(rpi_cache_flush_env_t * const rfe) -+{ -+ int rc = rpi_cache_flush_execute(rfe);; -+ -+ return rc; -+} -+ -+inline void rpi_cache_flush_add_gm_blocks(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const unsigned int mode, -+ const unsigned int offset0, const unsigned int block_size, const unsigned int blocks, const unsigned int block_stride) -+{ -+ struct vcsm_user_clean_invalid2_block_s * const b = rfe->v.s + rfe->v.op_count++; -+ -+ av_assert1(rfe->v.op_count <= CACHE_EL_MAX); -+ -+ b->invalidate_mode = mode; -+ b->block_count = blocks; -+ b->start_address = gm->arm + offset0; -+ b->block_size = block_size; -+ b->inter_block_stride = block_stride; -+} -+ -+void rpi_cache_flush_add_gm_range(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const unsigned int mode, -+ const unsigned int offset, const unsigned int size) -+{ -+ // Deal with empty pointer trivially -+ if (gm == NULL || size == 0) -+ return; -+ -+ av_assert1(offset <= gm->numbytes); -+ av_assert1(size <= gm->numbytes); -+ av_assert1(offset + size <= gm->numbytes); -+ -+ rpi_cache_flush_add_gm_blocks(rfe, gm, mode, offset, size, 1, 0); -+} -+ -+void rpi_cache_flush_add_gm_ptr(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const unsigned int mode) -+{ -+ rpi_cache_flush_add_gm_blocks(rfe, gm, mode, 0, gm->numbytes, 1, 0); -+} -+ -+ -+void rpi_cache_flush_add_frame(rpi_cache_flush_env_t * const rfe, const AVFrame * const frame, const unsigned int mode) -+{ -+#if !RPI_ONE_BUF -+#error Fixme! (NIF) -+#endif -+ if (gpu_is_buf1(frame)) { -+ rpi_cache_flush_add_gm_ptr(rfe, gpu_buf1_gmem(frame), mode); -+ } -+ else -+ { -+ rpi_cache_flush_add_gm_ptr(rfe, gpu_buf3_gmem(frame, 0), mode); -+ rpi_cache_flush_add_gm_ptr(rfe, gpu_buf3_gmem(frame, 1), mode); -+ rpi_cache_flush_add_gm_ptr(rfe, gpu_buf3_gmem(frame, 2), mode); -+ } -+} -+ -+// Flush an area of a frame -+// Width, height, x0, y0 in luma pels -+void rpi_cache_flush_add_frame_block(rpi_cache_flush_env_t * const rfe, const AVFrame * const frame, const unsigned int mode, -+ const unsigned int x0, const unsigned int y0, const unsigned int width, const unsigned int height, -+ const unsigned int uv_shift, const int do_luma, const int do_chroma) -+{ -+ const unsigned int y_offset = frame->linesize[0] * y0; -+ const unsigned int y_size = frame->linesize[0] * height; -+ // Round UV up/down to get everything -+ const unsigned int uv_rnd = (1U << uv_shift) >> 1; -+ const unsigned int uv_offset = frame->linesize[1] * (y0 >> uv_shift); -+ const unsigned int uv_size = frame->linesize[1] * ((y0 + height + uv_rnd) >> uv_shift) - uv_offset; -+ -+#if 0 -+ // *** frame->height is cropped height so not good -+ // As all unsigned they will also reject -ve -+ // Test individually as well as added to reject overflow -+ av_assert0(start_line <= (unsigned int)frame->height); // ***** frame height cropped -+ av_assert0(n <= (unsigned int)frame->height); -+ av_assert0(start_line + n <= (unsigned int)frame->height); -+#endif -+ -+ if (!gpu_is_buf1(frame)) -+ { -+ if (do_luma) { -+ rpi_cache_flush_add_gm_range(rfe, gpu_buf3_gmem(frame, 0), mode, y_offset, y_size); -+ } -+ if (do_chroma) { -+ rpi_cache_flush_add_gm_range(rfe, gpu_buf3_gmem(frame, 1), mode, uv_offset, uv_size); -+ rpi_cache_flush_add_gm_range(rfe, gpu_buf3_gmem(frame, 2), mode, uv_offset, uv_size); -+ } -+ } -+ else if (!av_rpi_is_sand_frame(frame)) -+ { -+ const GPU_MEM_PTR_T * const gm = gpu_buf1_gmem(frame); -+ if (do_luma) { -+ rpi_cache_flush_add_gm_range(rfe, gm, mode, (frame->data[0] - gm->arm) + y_offset, y_size); -+ } -+ if (do_chroma) { -+ rpi_cache_flush_add_gm_range(rfe, gm, mode, (frame->data[1] - gm->arm) + uv_offset, uv_size); -+ rpi_cache_flush_add_gm_range(rfe, gm, mode, (frame->data[2] - gm->arm) + uv_offset, uv_size); -+ } -+ } -+ else -+ { -+ const unsigned int stride1 = av_rpi_sand_frame_stride1(frame); -+ const unsigned int stride2 = av_rpi_sand_frame_stride2(frame); -+ const unsigned int xshl = av_rpi_sand_frame_xshl(frame); -+ const unsigned int xleft = x0 & ~((stride1 >> xshl) - 1); -+ const unsigned int block_count = (((x0 + width - xleft) << xshl) + stride1 - 1) / stride1; // Same for Y & C -+ av_assert1(rfe->v.op_count + do_chroma + do_luma < CACHE_EL_MAX); -+ -+ if (do_chroma) -+ { -+ struct vcsm_user_clean_invalid2_block_s * const b = rfe->v.s + rfe->v.op_count++; -+ b->invalidate_mode = mode; -+ b->block_count = block_count; -+ b->start_address = av_rpi_sand_frame_pos_c(frame, xleft >> 1, y0 >> 1); -+ b->block_size = uv_size; -+ b->inter_block_stride = stride1 * stride2; -+ } -+ if (do_luma) -+ { -+ struct vcsm_user_clean_invalid2_block_s * const b = rfe->v.s + rfe->v.op_count++; -+ b->invalidate_mode = mode; -+ b->block_count = block_count; -+ b->start_address = av_rpi_sand_frame_pos_y(frame, xleft, y0); -+ b->block_size = y_size; -+ b->inter_block_stride = stride1 * stride2; -+ } -+ } -+} -+ -+// Call this to clean and invalidate a region of memory -+void rpi_cache_flush_one_gm_ptr(const GPU_MEM_PTR_T *const p, const rpi_cache_flush_mode_t mode) -+{ -+ rpi_cache_buf_t cbuf; -+ rpi_cache_flush_env_t * rfe = rpi_cache_flush_init(&cbuf); -+ rpi_cache_flush_add_gm_ptr(rfe, p, mode); -+ rpi_cache_flush_finish(rfe); -+} -+ ---- /dev/null -+++ b/libavcodec/rpi_mem.h -@@ -0,0 +1,88 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox, Ben Avison -+*/ -+ -+#ifndef RPI_MEM_H -+#define RPI_MEM_H -+ -+typedef struct gpu_mem_ptr_s { -+ unsigned char *arm; // Pointer to memory mapped on ARM side -+ int vc_handle; // Videocore handle of relocatable memory -+ int vcsm_handle; // Handle for use by VCSM -+ int vc; // Address for use in GPU code -+ int numbytes; // Size of memory block -+} GPU_MEM_PTR_T; -+ -+// General GPU functions -+ -+#define GPU_INIT_GPU 1 -+#define GPU_INIT_CMA 2 -+ -+extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); -+extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); -+extern void gpu_free(GPU_MEM_PTR_T * const p); -+int rpi_mem_gpu_init(const unsigned int flags); -+void rpi_mem_gpu_uninit(void); -+ -+// Cache flush stuff -+ -+struct rpi_cache_flush_env_s; -+typedef struct rpi_cache_flush_env_s rpi_cache_flush_env_t; -+ -+typedef struct {uint32_t t[33];} rpi_cache_buf_t; -+ -+rpi_cache_flush_env_t * rpi_cache_flush_init(rpi_cache_buf_t * const buf); -+// Free env without flushing -+void rpi_cache_flush_abort(rpi_cache_flush_env_t * const rfe); -+// Do the accumulated flush & clear but do not free the env -+int rpi_cache_flush_execute(rpi_cache_flush_env_t * const rfe); -+// Do the accumulated flush & free the env -+int rpi_cache_flush_finish(rpi_cache_flush_env_t * const rfe); -+ -+typedef enum -+{ -+ RPI_CACHE_FLUSH_MODE_INVALIDATE = 1, -+ RPI_CACHE_FLUSH_MODE_WRITEBACK = 2, -+ RPI_CACHE_FLUSH_MODE_WB_INVALIDATE = 3 -+} rpi_cache_flush_mode_t; -+ -+struct AVFrame; -+void rpi_cache_flush_add_gm_ptr(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const rpi_cache_flush_mode_t mode); -+void rpi_cache_flush_add_gm_range(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const rpi_cache_flush_mode_t mode, -+ const unsigned int offset, const unsigned int size); -+void rpi_cache_flush_add_gm_blocks(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const unsigned int mode, -+ const unsigned int offset0, const unsigned int block_size, const unsigned int blocks, const unsigned int block_stride); -+void rpi_cache_flush_add_frame(rpi_cache_flush_env_t * const rfe, const struct AVFrame * const frame, const rpi_cache_flush_mode_t mode); -+void rpi_cache_flush_add_frame_block(rpi_cache_flush_env_t * const rfe, const struct AVFrame * const frame, const rpi_cache_flush_mode_t mode, -+ const unsigned int x0, const unsigned int y0, const unsigned int width, const unsigned int height, -+ const unsigned int uv_shift, const int do_luma, const int do_chroma); -+ -+// init, add, finish for one gm ptr -+void rpi_cache_flush_one_gm_ptr(const GPU_MEM_PTR_T * const p, const rpi_cache_flush_mode_t mode); -+ -+#endif ---- /dev/null -+++ b/libavcodec/rpi_qpu.c -@@ -0,0 +1,776 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox -+*/ -+ -+ -+#include -+#include -+#include -+#include -+#include -+#include "libavutil/avassert.h" -+ -+#include "config.h" -+ -+#include -+#include -+ -+#include -+ -+#include "rpi_mailbox.h" -+#include "rpi_mem.h" -+#include "rpi_qpu.h" -+#include "rpi_hevc_shader.h" -+#include "rpi_hevc_transform8.h" -+#include "rpi_hevc_transform10.h" -+#include "libavutil/rpi_sand_fns.h" -+ -+// Trace time spent waiting for GPU (VPU/QPU) (1=Yes, 0=No) -+#define RPI_TRACE_TIME_VPU_QPU_WAIT 0 -+ -+// Add profile flags to all QPU requests - generates output in "vcdbg log msg" -+// Beware this is expensive and will probably throw off all other timing by >10% -+#define RPI_TRACE_QPU_PROFILE_ALL 0 -+ -+// QPU "noflush" flags -+// a mixture of flushing & profiling -+ -+#define QPU_FLAGS_NO_FLUSH_VPU 1 // If unset VPU cache will be flushed -+#define QPU_FLAGS_PROF_CLEAR_AND_ENABLE 2 // Clear & Enable detailed QPU profiling registers -+#define QPU_FLAGS_PROF_OUTPUT_COUNTS 4 // Print the results -+#define QPU_FLAGS_OUTPUT_QPU_TIMES 8 // Print QPU times - independant of the profiling -+#define QPU_FLAGS_NO_FLUSH_QPU 16 // If unset flush QPU caches & TMUs (uniforms always flushed) -+ -+#define vcos_verify_ge0(x) ((x)>=0) -+ -+// Size in 32bit words -+#define QPU_CODE_SIZE 4098 -+#define VPU_CODE_SIZE 16384 -+ -+static const short rpi_transMatrix2even[32][16] = { // Even rows first -+{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, -+{90, 87, 80, 70, 57, 43, 25, 9, -9, -25, -43, -57, -70, -80, -87, -90}, -+{89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89}, -+{87, 57, 9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87}, -+{83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83}, -+{80, 9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80}, -+{75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75}, -+{70, -43, -87, 9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70}, -+{64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64}, -+{57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87, 9, -90, 25, 80, -57}, -+{50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50}, -+{43, -90, 57, 25, -87, 70, 9, -80, 80, -9, -70, 87, -25, -57, 90, -43}, -+{36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36}, -+{25, -70, 90, -80, 43, 9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25}, -+{18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18}, -+{ 9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9}, -+// Odd rows -+{90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4}, -+{90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13}, -+{88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22}, -+{85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31}, -+{82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67, 4, 73, 88, 38}, -+{78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46}, -+{73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54}, -+{67, -54, -78, 38, 85, -22, -90, 4, 90, 13, -88, -31, 82, 46, -73, -61}, -+{61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67}, -+{54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73}, -+{46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82, 4, 78}, -+{38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82}, -+{31, -78, 90, -61, 4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85}, -+{22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88}, -+{13, -38, 61, -78, 88, -90, 85, -73, 54, -31, 4, 22, -46, 67, -82, 90}, -+{ 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90} -+}; -+ -+// Code/constants on GPU -+struct GPU -+{ -+// unsigned int qpu_code[QPU_CODE_SIZE]; -+ unsigned int vpu_code8[VPU_CODE_SIZE]; -+ unsigned int vpu_code10[VPU_CODE_SIZE]; -+ short transMatrix2even[16*16*2]; -+}; -+ -+#define WAIT_COUNT_MAX 16 -+ -+typedef struct trace_time_one_s -+{ -+ int count; -+ int64_t start[WAIT_COUNT_MAX]; -+ int64_t total[WAIT_COUNT_MAX]; -+} trace_time_one_t; -+ -+typedef struct trace_time_wait_s -+{ -+ unsigned int jcount; -+ int64_t start0; -+ int64_t last_update; -+ trace_time_one_t active; -+ trace_time_one_t wait; -+} trace_time_wait_t; -+ -+typedef struct vq_wait_s -+{ -+ sem_t sem; -+ struct vq_wait_s * next; -+} vq_wait_t; -+ -+#define VQ_WAIT_POOL_SIZE 16 -+typedef struct vq_wait_pool_s -+{ -+ vq_wait_t * head; -+ vq_wait_t pool[VQ_WAIT_POOL_SIZE]; -+} vq_wait_pool_t; -+ -+static void vq_wait_pool_init(vq_wait_pool_t * const pool); -+static void vq_wait_pool_deinit(vq_wait_pool_t * const pool); -+ -+typedef struct gpu_env_s -+{ -+ int open_count; -+ int init_count; -+ int vpu_i_cache_flushed; -+ GPU_MEM_PTR_T qpu_code_gm_ptr; -+ GPU_MEM_PTR_T code_gm_ptr; -+ GPU_MEM_PTR_T dummy_gm_ptr; -+ vq_wait_pool_t wait_pool; -+#if RPI_TRACE_TIME_VPU_QPU_WAIT -+ trace_time_wait_t ttw; -+#endif -+} gpu_env_t; -+ -+// Stop more than one thread trying to allocate memory or use the processing resources at once -+static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; -+static gpu_env_t * gpu = NULL; -+ -+#if RPI_TRACE_TIME_VPU_QPU_WAIT -+ -+static int64_t ns_time(void) -+{ -+ struct timespec ts; -+ clock_gettime(CLOCK_MONOTONIC, &ts); -+ return (int64_t)ts.tv_sec * (int64_t)1000000000 + ts.tv_nsec; -+} -+ -+ -+#define WAIT_TIME_PRINT_PERIOD (int64_t)2000000000 -+ -+#define T_MS(t) ((unsigned int)((t)/(int64_t)1000000) % 1000U) -+#define T_SEC(t) (unsigned int)((t)/(int64_t)1000000000) -+#define T_ARG(t) T_SEC(t), T_MS(t) -+#define T_FMT "%u.%03u" -+ -+static void tto_print(trace_time_one_t * tto, const int64_t now, const int64_t start0, const char * const prefix) -+{ -+ // Update totals for levels that are still pending -+ for (int i = 0; i < tto->count; ++i) { -+ tto->total[i] += now - tto->start[i]; -+ tto->start[i] = now; -+ } -+ -+ printf("%s: Idle:" T_FMT ", 1:" T_FMT ", 2:" T_FMT ", 3:" T_FMT ", 4:" T_FMT "\n", -+ prefix, -+ T_ARG(now - start0 - tto->total[0]), -+ T_ARG(tto->total[0]), -+ T_ARG(tto->total[1]), -+ T_ARG(tto->total[2]), -+ T_ARG(tto->total[3])); -+} -+ -+ -+static void tto_start(trace_time_one_t * const tto, const int64_t now) -+{ -+ av_assert0(tto->count < WAIT_COUNT_MAX); -+ tto->start[tto->count++] = now; -+} -+ -+static void tto_end(trace_time_one_t * const tto, const int64_t now) -+{ -+ const int n = --tto->count; -+ av_assert0(n >= 0); -+ tto->total[n] += now - tto->start[n]; -+} -+ -+static void ttw_print(trace_time_wait_t * const ttw, const int64_t now) -+{ -+ printf("Jobs:%d, Total time=" T_FMT "\n", ttw->jcount, T_ARG(now - ttw->start0)); -+ tto_print(&ttw->active, now, ttw->start0, "Active"); -+ tto_print(&ttw->wait, now, ttw->start0, " Wait"); -+} -+ -+#endif -+ -+// GPU memory alloc fns (internal) -+ -+static void gpu_free_internal(GPU_MEM_PTR_T * const p) -+{ -+ if (p->arm != NULL) -+ vcsm_unlock_ptr(p->arm); -+ if (p->vcsm_handle != 0) -+ vcsm_free(p->vcsm_handle); -+ memset(p, 0, sizeof(*p)); // Ensure we crash hard if we try and use this again -+} -+ -+ -+static int gpu_malloc_internal(GPU_MEM_PTR_T * const p, -+ const int numbytes, const unsigned int cache_type, const char * const name) -+{ -+ memset(p, 0, sizeof(*p)); -+ p->numbytes = (numbytes + 255) & ~255; // Round up -+ -+ if ((p->vcsm_handle = vcsm_malloc_cache(p->numbytes, cache_type | 0x80, (char *)name)) == 0 || -+ (p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle)) == 0 || -+ (p->arm = vcsm_lock(p->vcsm_handle)) == NULL || -+ (p->vc = vcsm_vc_addr_from_hdl(p->vcsm_handle)) == 0) -+ { -+ gpu_free_internal(p); -+ return AVERROR(ENOMEM); -+ } -+ return 0; -+} -+ -+ -+// GPU init, free, lock, unlock -+ -+static void gpu_term(void) -+{ -+ gpu_env_t * const ge = gpu; -+ -+ // We have to hope that eveything has terminated... -+ gpu = NULL; -+ -+ vc_gpuserv_deinit(); -+ -+ gpu_free_internal(&ge->code_gm_ptr); -+ gpu_free_internal(&ge->qpu_code_gm_ptr); -+ gpu_free_internal(&ge->dummy_gm_ptr); -+ -+ vcsm_exit(); -+ -+ vq_wait_pool_deinit(&ge->wait_pool); -+ -+ free(ge); -+} -+ -+ -+// Connect to QPU, returns 0 on success. -+static int gpu_init(gpu_env_t ** const gpu) { -+ volatile struct GPU* ptr; -+ gpu_env_t * const ge = calloc(1, sizeof(gpu_env_t)); -+ int rv; -+ *gpu = NULL; -+ -+ if (ge == NULL) -+ return -1; -+ -+ vq_wait_pool_init(&ge->wait_pool); -+ -+ vcsm_init(); -+ -+ // Now copy over the QPU code into GPU memory -+ if ((rv = gpu_malloc_internal(&ge->qpu_code_gm_ptr, QPU_CODE_SIZE * 4, VCSM_CACHE_TYPE_NONE, "ffmpeg qpu code")) != 0) -+ return rv; -+ -+ { -+ int num_bytes = (char *)mc_end - (char *)ff_hevc_rpi_shader; -+ av_assert0(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy(ge->qpu_code_gm_ptr.arm, ff_hevc_rpi_shader, num_bytes); -+ memset(ge->qpu_code_gm_ptr.arm + num_bytes, 0, QPU_CODE_SIZE*4 - num_bytes); -+ } -+ -+ // And the VPU code -+ if ((rv = gpu_malloc_internal(&ge->code_gm_ptr, sizeof(struct GPU), VCSM_CACHE_TYPE_VC, "ffmpeg vpu code")) != 0) -+ return rv; -+ ptr = (volatile struct GPU*)ge->code_gm_ptr.arm; -+ -+ // Zero everything so we have zeros between the code bits -+ memset((void *)ptr, 0, sizeof(*ptr)); -+ { -+ int num_bytes = sizeof(rpi_hevc_transform8); -+ av_assert0(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->vpu_code8, rpi_hevc_transform8, num_bytes); -+ } -+ { -+ int num_bytes = sizeof(rpi_hevc_transform10); -+ av_assert0(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); -+ memcpy((void*)ptr->vpu_code10, rpi_hevc_transform10, num_bytes); -+ } -+ // And the transform coefficients -+ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); -+ -+ // Generate a dummy "frame" & fill with 0x80 -+ // * Could reset to 1 <dummy_gm_ptr, 0x4000, VCSM_CACHE_TYPE_NONE, "ffmpeg dummy frame")) != 0) -+ return rv; -+ memset(ge->dummy_gm_ptr.arm, 0x80, 0x4000); -+ -+ *gpu = ge; -+ return 0; -+} -+ -+ -+ -+static void gpu_unlock(void) { -+ pthread_mutex_unlock(&gpu_mutex); -+} -+ -+// Make sure we have exclusive access to the mailbox, and enable qpu if necessary. -+static gpu_env_t * gpu_lock(void) { -+ pthread_mutex_lock(&gpu_mutex); -+ -+ av_assert1(gpu != NULL); -+ return gpu; -+} -+ -+static gpu_env_t * gpu_lock_ref(void) -+{ -+ pthread_mutex_lock(&gpu_mutex); -+ -+ if (gpu == NULL) { -+ int rv = gpu_init(&gpu); -+ if (rv != 0) { -+ gpu_unlock(); -+ return NULL; -+ } -+ } -+ -+ ++gpu->open_count; -+ return gpu; -+} -+ -+static void gpu_unlock_unref(gpu_env_t * const ge) -+{ -+ if (--ge->open_count == 0) -+ gpu_term(); -+ -+ gpu_unlock(); -+} -+ -+static inline gpu_env_t * gpu_ptr(void) -+{ -+ av_assert1(gpu != NULL); -+ return gpu; -+} -+ -+unsigned int vpu_get_fn(const unsigned int bit_depth) { -+ uint32_t a = 0; -+ -+ // Make sure that the gpu is initialized -+ av_assert1(gpu != NULL); -+ switch (bit_depth){ -+ case 8: -+ a = gpu->code_gm_ptr.vc + offsetof(struct GPU, vpu_code8); -+ break; -+ case 10: -+ a = gpu->code_gm_ptr.vc + offsetof(struct GPU, vpu_code10); -+ break; -+ default: -+ av_assert0(0); -+ } -+ return a; -+} -+ -+unsigned int vpu_get_constants(void) { -+ av_assert1(gpu != NULL); -+ return (gpu->code_gm_ptr.vc + offsetof(struct GPU,transMatrix2even)); -+} -+ -+void gpu_ref(void) -+{ -+ gpu_lock_ref(); -+ gpu_unlock(); -+} -+ -+void gpu_unref(void) -+{ -+ gpu_env_t * const ge = gpu_lock(); -+ gpu_unlock_unref(ge); -+} -+ -+// ---------------------------------------------------------------------------- -+ -+ -+// Wait abstractions - mostly so we can easily add profile code -+static void vq_wait_pool_init(vq_wait_pool_t * const wp) -+{ -+ unsigned int i; -+ for (i = 0; i != VQ_WAIT_POOL_SIZE; ++i) { -+ sem_init(&wp->pool[i].sem, 0, 0); -+ wp->pool[i].next = wp->pool + i + 1; -+ } -+ wp->head = wp->pool + 0; -+ wp->pool[VQ_WAIT_POOL_SIZE - 1].next = NULL; -+} -+ -+static void vq_wait_pool_deinit(vq_wait_pool_t * const wp) -+{ -+ unsigned int i; -+ wp->head = NULL; -+ for (i = 0; i != VQ_WAIT_POOL_SIZE; ++i) { -+ sem_destroy(&wp->pool[i].sem); -+ wp->pool[i].next = NULL; -+ } -+} -+ -+ -+// If sem_init actually takes time then maybe we want a pool... -+static vq_wait_t * vq_wait_new(void) -+{ -+ gpu_env_t * const ge = gpu_lock_ref(); -+ vq_wait_t * const wait = ge->wait_pool.head; -+ ge->wait_pool.head = wait->next; -+ wait->next = NULL; -+ -+#if RPI_TRACE_TIME_VPU_QPU_WAIT -+ tto_start(&ge->ttw.active, ns_time()); -+#endif -+ -+ gpu_unlock(); -+ return wait; -+} -+ -+static void vq_wait_delete(vq_wait_t * const wait) -+{ -+ gpu_env_t * const ge = gpu_lock(); -+ wait->next = ge->wait_pool.head; -+ ge->wait_pool.head = wait; -+ -+#if RPI_TRACE_TIME_VPU_QPU_WAIT -+ { -+ trace_time_wait_t * const ttw = &ge->ttw; -+ const int64_t now = ns_time(); -+ ++ttw->jcount; -+ tto_end(&ttw->wait, now); -+ -+ if (ttw->start0 == 0) -+ { -+ ttw->start0 = ttw->active.start[0]; -+ ttw->last_update = ttw->start0; -+ } -+ if (now - ttw->last_update > WAIT_TIME_PRINT_PERIOD) -+ { -+ ttw->last_update += WAIT_TIME_PRINT_PERIOD; -+ ttw_print(ttw, now); -+ } -+ } -+#endif -+ gpu_unlock_unref(ge); -+} -+ -+static void vq_wait_wait(vq_wait_t * const wait) -+{ -+#if RPI_TRACE_TIME_VPU_QPU_WAIT -+ { -+ const int64_t now = ns_time(); -+ gpu_env_t * const ge = gpu_lock(); -+ tto_start(&ge->ttw.wait, now); -+ gpu_unlock(); -+ } -+#endif -+ -+ while (sem_wait(&wait->sem) == -1 && errno == EINTR) -+ /* loop */; -+} -+ -+static void vq_wait_post(vq_wait_t * const wait) -+{ -+#if RPI_TRACE_TIME_VPU_QPU_WAIT -+ { -+ gpu_env_t *const ge = gpu_lock(); -+ tto_end(&ge->ttw.active, ns_time()); -+ gpu_unlock(); -+ } -+#endif -+ -+ sem_post(&wait->sem); -+} -+ -+ -+ -+// Header comments were wrong for these two -+#define VPU_QPU_MASK_QPU 1 -+#define VPU_QPU_MASK_VPU 2 -+ -+typedef struct vpu_qpu_job_env_s vpu_qpu_job_env_t; -+ -+vpu_qpu_job_env_t * vpu_qpu_job_init(vpu_qpu_job_env_t * const buf) -+{ -+// vpu_qpu_job_env_t * vqj = calloc(1, sizeof(vpu_qpu_job_env_t)); -+ vpu_qpu_job_env_t * vqj = buf; -+// memset(vqj, 0, sizeof(*vqj)); -+ vqj->n = 0; -+ vqj->mask = 0; -+ return vqj; -+} -+ -+void vpu_qpu_job_delete(vpu_qpu_job_env_t * const vqj) -+{ -+// memset(vqj, 0, sizeof(*vqj)); -+// free(vqj); -+} -+ -+static inline struct gpu_job_s * new_job(vpu_qpu_job_env_t * const vqj) -+{ -+ struct gpu_job_s * const j = vqj->j + vqj->n++; -+ av_assert1(vqj->n <= VPU_QPU_JOB_MAX); -+ return j; -+} -+ -+void vpu_qpu_job_add_vpu(vpu_qpu_job_env_t * const vqj, const uint32_t vpu_code, -+ const unsigned r0, const unsigned r1, const unsigned r2, const unsigned r3, const unsigned r4, const unsigned r5) -+{ -+ if (vpu_code != 0) { -+ struct gpu_job_s *const j = new_job(vqj); -+ vqj->mask |= VPU_QPU_MASK_VPU; -+ -+ j->command = EXECUTE_VPU; -+ j->callback.func = 0; -+ j->callback.cookie = NULL; -+ // The bottom two bits of the execute address contain no-flush flags -+ // b0 will flush the VPU I-cache if unset so we nearly always want that set -+ // as we never reload code -+ j->u.v.q[0] = vpu_code | gpu->vpu_i_cache_flushed; -+ j->u.v.q[1] = r0; -+ j->u.v.q[2] = r1; -+ j->u.v.q[3] = r2; -+ j->u.v.q[4] = r3; -+ j->u.v.q[5] = r4; -+ j->u.v.q[6] = r5; -+ gpu->vpu_i_cache_flushed = 1; -+ } -+} -+ -+// flags are QPU_FLAGS_xxx -+void vpu_qpu_job_add_qpu(vpu_qpu_job_env_t * const vqj, const unsigned int n, const uint32_t * const mail) -+{ -+ if (n != 0) { -+ struct gpu_job_s *const j = new_job(vqj); -+ vqj->mask |= VPU_QPU_MASK_QPU; -+ -+ j->command = EXECUTE_QPU; -+ j->callback.func = 0; -+ j->callback.cookie = NULL; -+ -+ j->u.q.jobs = n; -+#if RPI_TRACE_QPU_PROFILE_ALL -+ j->u.q.noflush = QPU_FLAGS_NO_FLUSH_VPU | QPU_FLAGS_PROF_CLEAR_AND_ENABLE | QPU_FLAGS_PROF_OUTPUT_COUNTS; -+#else -+ j->u.q.noflush = QPU_FLAGS_NO_FLUSH_VPU; -+#endif -+ j->u.q.timeout = 5000; -+ memcpy(j->u.q.control, mail, n * QPU_MAIL_EL_VALS * sizeof(uint32_t)); -+ } -+} -+ -+// Convert callback to sem post -+static void vpu_qpu_job_callback_wait(void * v) -+{ -+ vq_wait_post(v); -+} -+ -+// Poke a user-supplied sem -+static void vpu_qpu_job_callback_sem(void * v) -+{ -+ sem_post((sem_t *)v); -+} -+ -+void vpu_qpu_job_add_sync_this(vpu_qpu_job_env_t * const vqj, vpu_qpu_wait_h * const wait_h) -+{ -+ vq_wait_t * wait; -+ -+ if (vqj->mask == 0) { -+ *wait_h = NULL; -+ return; -+ } -+ -+ // We are going to want a sync object -+ wait = vq_wait_new(); -+ -+ // There are 2 VPU Qs & 1 QPU Q so we can collapse sync -+ // If we only posted one thing or only QPU jobs -+ if (vqj->n == 1 || vqj->mask == VPU_QPU_MASK_QPU) -+ { -+ struct gpu_job_s * const j = vqj->j + (vqj->n - 1); -+ av_assert1(j->callback.func == 0); -+ -+ j->callback.func = vpu_qpu_job_callback_wait; -+ j->callback.cookie = wait; -+ } -+ else -+ { -+ struct gpu_job_s *const j = new_job(vqj); -+ -+ j->command = EXECUTE_SYNC; -+ j->u.s.mask = vqj->mask; -+ j->callback.func = vpu_qpu_job_callback_wait; -+ j->callback.cookie = wait; -+ } -+ -+ vqj->mask = 0; -+ *wait_h = wait; -+} -+ -+// Returns 0 if no sync added ('cos Q empty), 1 if sync added -+int vpu_qpu_job_add_sync_sem(vpu_qpu_job_env_t * const vqj, sem_t * const sem) -+{ -+ // If nothing on q then just return -+ if (vqj->mask == 0) -+ return 0; -+ -+ // There are 2 VPU Qs & 1 QPU Q so we can collapse sync -+ // If we only posted one thing or only QPU jobs -+ if (vqj->n == 1 || vqj->mask == VPU_QPU_MASK_QPU) -+ { -+ struct gpu_job_s * const j = vqj->j + (vqj->n - 1); -+ av_assert1(j->callback.func == 0); -+ -+ j->callback.func = vpu_qpu_job_callback_sem; -+ j->callback.cookie = sem; -+ } -+ else -+ { -+ struct gpu_job_s *const j = new_job(vqj); -+ -+ j->command = EXECUTE_SYNC; -+ j->u.s.mask = vqj->mask; -+ j->callback.func = vpu_qpu_job_callback_sem; -+ j->callback.cookie = sem; -+ } -+ -+ vqj->mask = 0; -+ return 1; -+} -+ -+ -+int vpu_qpu_job_start(vpu_qpu_job_env_t * const vqj) -+{ -+ if (vqj->n == 0) -+ return 0; -+ -+ return vc_gpuserv_execute_code(vqj->n, vqj->j); -+} -+ -+// Simple wrapper of start + delete -+int vpu_qpu_job_finish(vpu_qpu_job_env_t * const vqj) -+{ -+ int rv; -+ rv = vpu_qpu_job_start(vqj); -+ vpu_qpu_job_delete(vqj); -+ return rv; -+} -+ -+void vpu_qpu_wait(vpu_qpu_wait_h * const wait_h) -+{ -+ if (wait_h != NULL) -+ { -+ vq_wait_t * const wait = *wait_h; -+ if (wait != NULL) { -+ *wait_h = NULL; -+ vq_wait_wait(wait); -+ vq_wait_delete(wait); -+ } -+ } -+} -+ -+int vpu_qpu_init() -+{ -+ gpu_env_t * const ge = gpu_lock_ref(); -+ if (ge == NULL) -+ return -1; -+ -+ if (ge->init_count++ == 0) -+ { -+ vc_gpuserv_init(); -+ } -+ -+ gpu_unlock(); -+ return 0; -+} -+ -+void vpu_qpu_term() -+{ -+ gpu_env_t * const ge = gpu_lock(); -+ -+ if (--ge->init_count == 0) { -+ vc_gpuserv_deinit(); -+ -+#if RPI_TRACE_TIME_VPU_QPU_WAIT -+ ttw_print(&ge->ttw, ns_time()); -+#endif -+ } -+ -+ gpu_unlock_unref(ge); -+} -+ -+uint32_t qpu_fn(const int * const mc_fn) -+{ -+ return gpu->qpu_code_gm_ptr.vc + ((const char *)mc_fn - (const char *)ff_hevc_rpi_shader); -+} -+ -+uint32_t qpu_dummy(void) -+{ -+ return gpu->dummy_gm_ptr.vc; -+} -+ -+int rpi_hevc_qpu_init_fn(HEVCRpiQpu * const qf, const unsigned int bit_depth) -+{ -+ // Dummy values we can catch with emulation -+ qf->y_pxx = ~1U; -+ qf->y_bxx = ~2U; -+ qf->y_p00 = ~3U; -+ qf->y_b00 = ~4U; -+ qf->c_pxx = ~5U; -+ qf->c_bxx = ~6U; -+ -+ switch (bit_depth) { -+ case 8: -+ qf->y_pxx = qpu_fn(mc_filter_y_pxx); -+ qf->y_pxx = qpu_fn(mc_filter_y_pxx); -+ qf->y_bxx = qpu_fn(mc_filter_y_bxx); -+ qf->y_p00 = qpu_fn(mc_filter_y_p00); -+ qf->y_b00 = qpu_fn(mc_filter_y_b00); -+ qf->c_pxx = qpu_fn(mc_filter_c_p); -+ qf->c_pxx_l1 = qpu_fn(mc_filter_c_p_l1); -+ qf->c_bxx = qpu_fn(mc_filter_c_b); -+ break; -+ case 10: -+ qf->c_pxx = qpu_fn(mc_filter_c10_p); -+ qf->c_pxx_l1 = qpu_fn(mc_filter_c10_p_l1); -+ qf->c_bxx = qpu_fn(mc_filter_c10_b); -+ qf->y_pxx = qpu_fn(mc_filter_y10_pxx); -+ qf->y_bxx = qpu_fn(mc_filter_y10_bxx); -+ qf->y_p00 = qpu_fn(mc_filter_y10_p00); -+ qf->y_b00 = qpu_fn(mc_filter_y10_b00); -+ break; -+ default: -+ return -1; -+ } -+ return 0; -+} -+ ---- /dev/null -+++ b/libavcodec/rpi_qpu.h -@@ -0,0 +1,103 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox, Ben Avison -+*/ -+ -+#ifndef RPI_QPU_H -+#define RPI_QPU_H -+ -+#include "rpi_mem.h" -+#include "rpi_zc_frames.h" -+ -+#pragma GCC diagnostic push -+// Many many redundant decls in the header files -+#pragma GCC diagnostic ignored "-Wredundant-decls" -+#pragma GCC diagnostic ignored "-Wstrict-prototypes" -+#include "interface/vmcs_host/vc_vchi_gpuserv.h" // for gpu_job_s -+#pragma GCC diagnostic pop -+ -+// QPU specific functions -+ -+typedef struct HEVCRpiQpu { -+ uint32_t c_pxx; -+ uint32_t c_pxx_l1; -+ uint32_t c_bxx; -+ uint32_t y_pxx; -+ uint32_t y_bxx; -+ uint32_t y_p00; -+ uint32_t y_b00; -+} HEVCRpiQpu; -+ -+int rpi_hevc_qpu_init_fn(HEVCRpiQpu * const qf, const unsigned int bit_depth); -+ -+uint32_t qpu_fn(const int * const mc_fn); -+uint32_t qpu_dummy(void); -+ -+#define QPU_N_GRP 4 -+#define QPU_N_MAX 12 -+ -+#define QPU_MAIL_EL_VALS 2 -+ -+struct vpu_qpu_wait_s; -+typedef struct vq_wait_s * vpu_qpu_wait_h; -+ -+// VPU specific functions -+ -+struct vpu_qpu_job_env_s; -+typedef struct vpu_qpu_job_env_s * vpu_qpu_job_h; -+ -+#define VPU_QPU_JOB_MAX 4 -+struct vpu_qpu_job_env_s -+{ -+ unsigned int n; -+ unsigned int mask; -+ struct gpu_job_s j[VPU_QPU_JOB_MAX]; -+}; -+typedef struct vpu_qpu_job_env_s vpu_qpu_job_env_t; -+ -+vpu_qpu_job_h vpu_qpu_job_init(vpu_qpu_job_env_t * const buf); -+void vpu_qpu_job_delete(const vpu_qpu_job_h vqj); -+void vpu_qpu_job_add_vpu(const vpu_qpu_job_h vqj, const uint32_t vpu_code, -+ const unsigned r0, const unsigned r1, const unsigned r2, const unsigned r3, const unsigned r4, const unsigned r5); -+void vpu_qpu_job_add_qpu(const vpu_qpu_job_h vqj, const unsigned int n, const uint32_t * const mail); -+void vpu_qpu_job_add_sync_this(const vpu_qpu_job_h vqj, vpu_qpu_wait_h * const wait_h); -+int vpu_qpu_job_add_sync_sem(vpu_qpu_job_env_t * const vqj, sem_t * const sem); -+int vpu_qpu_job_start(const vpu_qpu_job_h vqj); -+int vpu_qpu_job_finish(const vpu_qpu_job_h vqj); -+ -+extern unsigned int vpu_get_fn(const unsigned int bit_depth); -+extern unsigned int vpu_get_constants(void); -+ -+// Waits for previous post_codee to complete and Will null out *wait_h after use -+void vpu_qpu_wait(vpu_qpu_wait_h * const wait_h); -+int vpu_qpu_init(void); -+void vpu_qpu_term(void); -+ -+void gpu_ref(void); -+void gpu_unref(void); -+ -+#endif ---- /dev/null -+++ b/libavcodec/rpi_zc.c -@@ -0,0 +1,1227 @@ -+#include "config.h" -+ -+#include "libavcodec/avcodec.h" -+#include "rpi_mem.h" -+#include "rpi_mailbox.h" -+#include "rpi_zc.h" -+#include "libavutil/avassert.h" -+#include -+ -+#include "libavutil/buffer_internal.h" -+ -+#pragma GCC diagnostic push -+// Many many redundant decls in the header files -+#pragma GCC diagnostic ignored "-Wredundant-decls" -+#include -+#include -+#pragma GCC diagnostic pop -+ -+#define TRACE_ALLOC 0 -+#define DEBUG_ALWAYS_KEEP_LOCKED 0 -+ -+struct ZcPoolEnt; -+ -+typedef struct ZcPool -+{ -+ size_t numbytes; -+ struct ZcPoolEnt * head; -+ pthread_mutex_t lock; -+} ZcPool; -+ -+typedef struct ZcPoolEnt -+{ -+ size_t numbytes; -+ -+ unsigned int vcsm_handle; -+ unsigned int vc_handle; -+ void * map_arm; -+ unsigned int map_vc; -+ -+ struct ZcPoolEnt * next; -+ struct ZcPool * pool; -+} ZcPoolEnt; -+ -+typedef struct ZcOldCtxVals -+{ -+ int thread_safe_callbacks; -+ int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); -+ void * opaque; -+} ZcOldCtxVals; -+ -+typedef struct AVZcEnv -+{ -+ unsigned int refcount; -+ ZcOldCtxVals old; -+ -+ void * pool_env; -+ av_rpi_zc_alloc_buf_fn_t * alloc_buf; -+ av_rpi_zc_free_pool_fn_t * free_pool; -+ -+ unsigned int pool_size; -+} ZcEnv; -+ -+typedef struct ZcUserBufEnv { -+ void * v; -+ const av_rpi_zc_buf_fn_tab_t * fn; -+ size_t numbytes; -+ int offset; -+} ZcUserBufEnv; -+ -+#define ZC_BUF_INVALID 0 -+#define ZC_BUF_VALID 1 -+#define ZC_BUF_NEVER 2 -+ -+typedef struct ZcBufEnv { -+ GPU_MEM_PTR_T gmem; -+ AVZcEnvPtr zc; -+ int is_valid; -+ AVBufferRef * user; -+ AVRpiZcFrameGeometry geo; -+ size_t size_y; -+ size_t size_c; -+ size_t size_pic; -+ ssize_t offset; -+ pthread_mutex_t lock; -+ pthread_cond_t cond; -+} ZcBufEnv; -+ -+ -+ -+ -+ -+ -+#define ALLOC_PAD 0 -+#define ALLOC_ROUND 0x1000 -+#define STRIDE_ROUND 64 -+#define STRIDE_OR 0 -+ -+#define DEBUG_ZAP0_BUFFERS 0 -+ -+static inline int av_rpi_is_sand_format(const int format) -+{ -+ return (format >= AV_PIX_FMT_SAND128 && format <= AV_PIX_FMT_SAND64_16) || -+ (format == AV_PIX_FMT_RPI4_8 || format == AV_PIX_FMT_RPI4_10); -+} -+ -+static inline int av_rpi_is_sand_frame(const AVFrame * const frame) -+{ -+ return av_rpi_is_sand_format(frame->format); -+} -+ -+//---------------------------------------------------------------------------- -+// -+// Internal pool stuff -+ -+// Pool entry functions -+ -+static ZcPoolEnt * zc_pool_ent_alloc(ZcPool * const pool, const size_t req_size) -+{ -+ ZcPoolEnt * const zp = av_mallocz(sizeof(ZcPoolEnt)); -+ -+ // Round up to 4k & add 4k -+ const unsigned int alloc_size = (req_size + ALLOC_PAD + ALLOC_ROUND - 1) & ~(ALLOC_ROUND - 1); -+ -+ if (zp == NULL) { -+ av_log(NULL, AV_LOG_ERROR, "av_malloc(ZcPoolEnt) failed\n"); -+ goto fail0; -+ } -+ -+ // The 0x80 here maps all pages here rather than waiting for lazy mapping -+ // BEWARE that in GPU land a later unlock/lock pair will put us back into -+ // lazy mode - which will also break cache invalidate calls. -+ if ((zp->vcsm_handle = vcsm_malloc_cache(alloc_size, VCSM_CACHE_TYPE_HOST | 0x80, "ffmpeg_rpi_zc")) == 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "av_gpu_malloc_cached(%d) failed\n", alloc_size); -+ goto fail1; -+ } -+ -+#if TRACE_ALLOC -+ printf("%s: Alloc %#x bytes @ h=%d\n", __func__, alloc_size, zp->vcsm_handle); -+#endif -+ -+ zp->numbytes = alloc_size; -+ zp->pool = pool; -+ return zp; -+ -+fail1: -+ av_free(zp); -+fail0: -+ return NULL; -+} -+ -+static void zc_pool_ent_free(ZcPoolEnt * const zp) -+{ -+#if TRACE_ALLOC -+ printf("%s: Free %#x bytes @ h=%d\n", __func__, zp->numbytes, zp->vcsm_handle); -+#endif -+ -+ if (zp->vcsm_handle != 0) -+ { -+ // VC addr & handle need no dealloc -+ if (zp->map_arm != NULL) -+ vcsm_unlock_hdl(zp->vcsm_handle); -+ vcsm_free(zp->vcsm_handle); -+ } -+ av_free(zp); -+} -+ -+//---------------------------------------------------------------------------- -+// -+// Pool functions -+ -+static void zc_pool_free_ent_list(ZcPoolEnt * p) -+{ -+ while (p != NULL) -+ { -+ ZcPoolEnt * const zp = p; -+ p = p->next; -+ zc_pool_ent_free(zp); -+ } -+} -+ -+static void zc_pool_flush(ZcPool * const pool) -+{ -+ ZcPoolEnt * p = pool->head; -+ pool->head = NULL; -+ pool->numbytes = ~0U; -+ zc_pool_free_ent_list(p); -+} -+ -+static ZcPoolEnt * zc_pool_get_ent(ZcPool * const pool, const size_t req_bytes) -+{ -+ ZcPoolEnt * zp = NULL; -+ ZcPoolEnt * flush_list = NULL; -+ size_t numbytes; -+ -+ pthread_mutex_lock(&pool->lock); -+ -+ numbytes = pool->numbytes; -+ -+ // If size isn't close then dump the pool -+ // Close in this context means within 128k -+ if (req_bytes > numbytes || req_bytes + 0x20000 < numbytes) -+ { -+ flush_list = pool->head; -+ pool->head = NULL; -+ pool->numbytes = numbytes = req_bytes; -+ } -+ else if (pool->head != NULL) -+ { -+ zp = pool->head; -+ pool->head = zp->next; -+ } -+ -+ pthread_mutex_unlock(&pool->lock); -+ -+ zc_pool_free_ent_list(flush_list); -+ -+ if (zp == NULL) -+ zp = zc_pool_ent_alloc(pool, numbytes); -+ -+ return zp; -+} -+ -+static void zc_pool_put_ent(ZcPoolEnt * const zp) -+{ -+ ZcPool * const pool = zp == NULL ? NULL : zp->pool; -+ if (zp != NULL) -+ { -+ pthread_mutex_lock(&pool->lock); -+#if TRACE_ALLOC -+ printf("%s: Recycle %#x, %#x\n", __func__, pool->numbytes, zp->numbytes); -+#endif -+ -+ if (pool->numbytes == zp->numbytes) -+ { -+ zp->next = pool->head; -+ pool->head = zp; -+ pthread_mutex_unlock(&pool->lock); -+ } -+ else -+ { -+ pthread_mutex_unlock(&pool->lock); -+ zc_pool_ent_free(zp); -+ } -+ } -+} -+ -+static ZcPool * -+zc_pool_new(void) -+{ -+ ZcPool * const pool = av_mallocz(sizeof(*pool)); -+ if (pool == NULL) -+ return NULL; -+ -+ pool->numbytes = -1; -+ pool->head = NULL; -+ pthread_mutex_init(&pool->lock, NULL); -+ return pool; -+} -+ -+static void -+zc_pool_delete(ZcPool * const pool) -+{ -+ if (pool != NULL) -+ { -+ pool->numbytes = -1; -+ zc_pool_flush(pool); -+ pthread_mutex_destroy(&pool->lock); -+ av_free(pool); -+ } -+} -+ -+//============================================================================ -+// -+// ZC implementation using above pool implementation -+// -+// Fn table fns... -+ -+static void zc_pool_free_v(void * v) -+{ -+ zc_pool_put_ent(v); -+} -+ -+static unsigned int zc_pool_ent_vcsm_handle_v(void * v) -+{ -+ ZcPoolEnt * zp = v; -+ return zp->vcsm_handle; -+} -+ -+static unsigned int zc_pool_ent_vc_handle_v(void * v) -+{ -+ ZcPoolEnt * zp = v; -+ if (zp->vc_handle == 0) -+ { -+ if ((zp->vc_handle = vcsm_vc_hdl_from_hdl(zp->vcsm_handle)) == 0) -+ av_log(NULL, AV_LOG_ERROR, "%s: Failed to map VCSM handle %d to VC handle\n", -+ __func__, zp->vcsm_handle); -+ } -+ return zp->vc_handle; -+} -+ -+static void * zc_pool_ent_map_arm_v(void * v) -+{ -+ ZcPoolEnt * zp = v; -+ if (zp->map_arm == NULL) -+ { -+ if ((zp->map_arm = vcsm_lock(zp->vcsm_handle)) == NULL) -+ av_log(NULL, AV_LOG_ERROR, "%s: Failed to map VCSM handle %d to ARM address\n", -+ __func__, zp->vcsm_handle); -+ } -+ return zp->map_arm; -+} -+ -+static unsigned int zc_pool_ent_map_vc_v(void * v) -+{ -+ ZcPoolEnt * zp = v; -+ if (zp->map_vc == 0) -+ { -+ if ((zp->map_vc = vcsm_vc_addr_from_hdl(zp->vcsm_handle)) == 0) -+ av_log(NULL, AV_LOG_ERROR, "%s: Failed to map VCSM handle %d to VC address\n", -+ __func__, zp->vcsm_handle); -+ } -+ return zp->map_vc; -+} -+ -+static const av_rpi_zc_buf_fn_tab_t zc_pool_buf_fns = { -+ .free = zc_pool_free_v, -+ .vcsm_handle = zc_pool_ent_vcsm_handle_v, -+ .vc_handle = zc_pool_ent_vc_handle_v, -+ .map_arm = zc_pool_ent_map_arm_v, -+ .map_vc = zc_pool_ent_map_vc_v, -+}; -+ -+// ZC Env fns -+ -+// Delete pool -+// All buffers guaranteed freed by now -+static void -+zc_pool_delete_v(void * v) -+{ -+ zc_pool_delete((ZcPool *)v); -+ rpi_mem_gpu_uninit(); -+} -+ -+// Allocate a new ZC buffer -+static AVBufferRef * -+zc_pool_buf_alloc(void * v, size_t size, const AVRpiZcFrameGeometry * geo) -+{ -+ ZcPool * const pool = v; -+ ZcPoolEnt *const zp = zc_pool_get_ent(pool, size); -+ AVBufferRef * buf; -+ -+ (void)geo; // geo ignored here -+ -+ if (zp == NULL) { -+ av_log(NULL, AV_LOG_ERROR, "zc_pool_alloc(%d) failed\n", size); -+ goto fail0; -+ } -+ -+ if ((buf = av_rpi_zc_buf(size, 0, zp, &zc_pool_buf_fns)) == NULL) -+ { -+ av_log(NULL, AV_LOG_ERROR, "av_rpi_zc_buf() failed\n"); -+ goto fail2; -+ } -+ -+ return buf; -+ -+fail2: -+ zc_pool_put_ent(zp); -+fail0: -+ return NULL; -+} -+ -+// Init wrappers - the public fns -+ -+AVZcEnvPtr -+av_rpi_zc_int_env_alloc(void * logctx) -+{ -+ ZcEnv * zc; -+ ZcPool * pool_env; -+ -+ if (rpi_mem_gpu_init(0) < 0) -+ return NULL; -+ -+ if ((pool_env = zc_pool_new()) == NULL) -+ goto fail1; -+ -+ if ((zc = av_rpi_zc_env_alloc(logctx, pool_env, zc_pool_buf_alloc, zc_pool_delete_v)) == NULL) -+ goto fail2; -+ -+ return zc; -+ -+fail2: -+ zc_pool_delete(pool_env); -+fail1: -+ rpi_mem_gpu_uninit(); -+ return NULL; -+} -+ -+void -+av_rpi_zc_int_env_freep(AVZcEnvPtr * zcp) -+{ -+ const AVZcEnvPtr zc = *zcp; -+ *zcp = NULL; -+ if (zc != NULL) -+ av_rpi_zc_env_release(zc); -+} -+ -+//============================================================================ -+// -+// Geometry -+// -+// This is a separate chunck to the rest -+ -+// Get mailbox fd - should be in a lock when called -+// Rely on process close to close it -+static int mbox_fd(void) -+{ -+ static int fd = -1; -+ if (fd != -1) -+ return fd; -+ return (fd = mbox_open()); -+} -+ -+AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( -+ const int format, const unsigned int video_width, const unsigned int video_height) -+{ -+ static pthread_mutex_t sand_lock = PTHREAD_MUTEX_INITIALIZER; -+ -+ AVRpiZcFrameGeometry geo = { -+ .format = format, -+ .video_width = video_width, -+ .video_height = video_height -+ }; -+ -+ switch (format) -+ { -+ case AV_PIX_FMT_YUV420P: -+ geo.stride_y = ((video_width + 32 + STRIDE_ROUND - 1) & ~(STRIDE_ROUND - 1)) | STRIDE_OR; -+ geo.stride_c = geo.stride_y / 2; -+ geo.height_y = (video_height + 32 + 31) & ~31; -+ geo.height_c = geo.height_y / 2; -+ geo.planes_c = 2; -+ geo.stripes = 1; -+ geo.bytes_per_pel = 1; -+ geo.stripe_is_yc = 1; -+ break; -+ -+ case AV_PIX_FMT_YUV420P10: -+ geo.stride_y = ((video_width * 2 + 64 + STRIDE_ROUND - 1) & ~(STRIDE_ROUND - 1)) | STRIDE_OR; -+ geo.stride_c = geo.stride_y / 2; -+ geo.height_y = (video_height + 32 + 31) & ~31; -+ geo.height_c = geo.height_y / 2; -+ geo.planes_c = 2; -+ geo.stripes = 1; -+ geo.bytes_per_pel = 2; -+ geo.stripe_is_yc = 1; -+ break; -+ -+ case AV_PIX_FMT_SAND128: -+ case AV_PIX_FMT_RPI4_8: -+ { -+ const unsigned int stripe_w = 128; -+ -+ static VC_IMAGE_T img = {0}; -+ -+ // Given the overhead of calling the mailbox keep a stashed -+ // copy as we will almost certainly just want the same numbers again -+ // but that means we need a lock -+ pthread_mutex_lock(&sand_lock); -+ -+ if (img.width != video_width || img.height != video_height) -+ { -+ VC_IMAGE_T new_img = { -+ .type = VC_IMAGE_YUV_UV, -+ .width = video_width, -+ .height = video_height -+ }; -+ -+ mbox_get_image_params(mbox_fd(), &new_img); -+ img = new_img; -+ } -+ -+ geo.stride_y = stripe_w; -+ geo.stride_c = stripe_w; -+ geo.height_y = ((intptr_t)img.extra.uv.u - (intptr_t)img.image_data) / stripe_w; -+ geo.height_c = img.pitch / stripe_w - geo.height_y; -+ geo.stripe_is_yc = 1; -+ if (geo.height_y * stripe_w > img.pitch) -+ { -+ // "tall" sand - all C blocks now follow Y -+ geo.height_y = img.pitch / stripe_w; -+ geo.height_c = geo.height_y; -+ geo.stripe_is_yc = 0; -+ } -+ geo.planes_c = 1; -+ geo.stripes = (video_width + stripe_w - 1) / stripe_w; -+ geo.bytes_per_pel = 1; -+ -+ pthread_mutex_unlock(&sand_lock); -+#if 0 -+ printf("Req: %dx%d: stride=%d/%d, height=%d/%d, stripes=%d, img.pitch=%d\n", -+ video_width, video_height, -+ geo.stride_y, geo.stride_c, -+ geo.height_y, geo.height_c, -+ geo.stripes, img.pitch); -+#endif -+ av_assert0((int)geo.height_y > 0 && (int)geo.height_c > 0); -+ av_assert0(geo.height_y >= video_height && geo.height_c >= video_height / 2); -+ break; -+ } -+ -+ case AV_PIX_FMT_RPI4_10: -+ { -+ const unsigned int stripe_w = 128; // bytes -+ -+ static pthread_mutex_t sand_lock = PTHREAD_MUTEX_INITIALIZER; -+ static VC_IMAGE_T img = {0}; -+ -+ // Given the overhead of calling the mailbox keep a stashed -+ // copy as we will almost certainly just want the same numbers again -+ // but that means we need a lock -+ pthread_mutex_lock(&sand_lock); -+ -+ if (img.width != video_width || img.height != video_height) -+ { -+ VC_IMAGE_T new_img = { -+ .type = VC_IMAGE_YUV10COL, -+ .width = video_width, -+ .height = video_height -+ }; -+ -+ mbox_get_image_params(mbox_fd(), &new_img); -+ img = new_img; -+ } -+ -+ geo.stride_y = stripe_w; -+ geo.stride_c = stripe_w; -+ geo.height_y = ((intptr_t)img.extra.uv.u - (intptr_t)img.image_data) / stripe_w; -+ geo.height_c = img.pitch / stripe_w - geo.height_y; -+ geo.planes_c = 1; -+ geo.stripes = ((video_width * 4 + 2) / 3 + stripe_w - 1) / stripe_w; -+ geo.bytes_per_pel = 1; -+ geo.stripe_is_yc = 1; -+ -+ pthread_mutex_unlock(&sand_lock); -+ -+#if 0 -+ printf("Req: %dx%d: stride=%d/%d, height=%d/%d, stripes=%d, img.pitch=%d\n", -+ video_width, video_height, -+ geo.stride_y, geo.stride_c, -+ geo.height_y, geo.height_c, -+ geo.stripes, img.pitch); -+#endif -+ av_assert0((int)geo.height_y > 0 && (int)geo.height_c > 0); -+ av_assert0(geo.height_y >= video_height && geo.height_c >= video_height / 2); -+ break; -+ } -+ -+ case AV_PIX_FMT_SAND64_16: -+ case AV_PIX_FMT_SAND64_10: -+ { -+ const unsigned int stripe_w = 128; // bytes -+ -+ static pthread_mutex_t sand_lock = PTHREAD_MUTEX_INITIALIZER; -+ static VC_IMAGE_T img = {0}; -+ -+ // Given the overhead of calling the mailbox keep a stashed -+ // copy as we will almost certainly just want the same numbers again -+ // but that means we need a lock -+ pthread_mutex_lock(&sand_lock); -+ -+ if (img.width != video_width || img.height != video_height) -+ { -+ VC_IMAGE_T new_img = { -+ .type = VC_IMAGE_YUV_UV_16, -+ .width = video_width, -+ .height = video_height -+ }; -+ -+ mbox_get_image_params(mbox_fd(), &new_img); -+ img = new_img; -+ } -+ -+ geo.stride_y = stripe_w; -+ geo.stride_c = stripe_w; -+ geo.height_y = ((intptr_t)img.extra.uv.u - (intptr_t)img.image_data) / stripe_w; -+ geo.height_c = img.pitch / stripe_w - geo.height_y; -+ geo.planes_c = 1; -+ geo.stripes = (video_width * 2 + stripe_w - 1) / stripe_w; -+ geo.bytes_per_pel = 2; -+ geo.stripe_is_yc = 1; -+ -+ pthread_mutex_unlock(&sand_lock); -+ break; -+ } -+ -+ default: -+ break; -+ } -+ return geo; -+} -+ -+//============================================================================ -+// -+// ZC Env fns -+// -+// Frame copy fns -+ -+static AVBufferRef * zc_copy(const AVZcEnvPtr zc, -+ const AVFrame * const src) -+{ -+ AVFrame dest_frame; -+ AVFrame * const dest = &dest_frame; -+ unsigned int i; -+ uint8_t * psrc, * pdest; -+ -+ dest->format = src->format; -+ dest->width = src->width; -+ dest->height = src->height; -+ -+ if (av_rpi_zc_get_buffer(zc, dest) != 0 || -+ av_rpi_zc_resolve_frame(dest, ZC_RESOLVE_ALLOC_VALID) != 0) -+ { -+ return NULL; -+ } -+ -+ for (i = 0, psrc = src->data[0], pdest = dest->data[0]; -+ i != dest->height; -+ ++i, psrc += src->linesize[0], pdest += dest->linesize[0]) -+ { -+ memcpy(pdest, psrc, dest->width); -+ } -+ for (i = 0, psrc = src->data[1], pdest = dest->data[1]; -+ i != dest->height / 2; -+ ++i, psrc += src->linesize[1], pdest += dest->linesize[1]) -+ { -+ memcpy(pdest, psrc, dest->width / 2); -+ } -+ for (i = 0, psrc = src->data[2], pdest = dest->data[2]; -+ i != dest->height / 2; -+ ++i, psrc += src->linesize[2], pdest += dest->linesize[2]) -+ { -+ memcpy(pdest, psrc, dest->width / 2); -+ } -+ -+ return dest->buf[0]; -+} -+ -+ -+static AVBufferRef * zc_420p10_to_sand128(const AVZcEnvPtr zc, -+ const AVFrame * const src) -+{ -+ assert(0); -+ return NULL; -+} -+ -+ -+static AVBufferRef * zc_sand64_16_to_sand128(const AVZcEnvPtr zc, -+ const AVFrame * const src, const unsigned int src_bits) -+{ -+ assert(0); -+ return NULL; -+} -+ -+//---------------------------------------------------------------------------- -+// -+// Public info extraction calls -+ -+static void zc_buf_env_free_cb(void * opaque, uint8_t * data); -+ -+static inline ZcBufEnv * pic_zbe_ptr(AVBufferRef *const buf) -+{ -+ // Kludge where we check the free fn to check this is really -+ // one of our buffers - can't think of a better way -+ return buf == NULL || buf->buffer->free != zc_buf_env_free_cb ? NULL : -+ av_buffer_get_opaque(buf); -+} -+ -+static inline GPU_MEM_PTR_T * pic_gm_ptr(AVBufferRef * const buf) -+{ -+ // As gmem is the first el NULL should be preserved -+ return &pic_zbe_ptr(buf)->gmem; -+} -+ -+unsigned int av_rpi_zc_vcsm_handle(const AVRpiZcRefPtr fr_ref) -+{ -+ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -+ return p == NULL ? 0 : p->vcsm_handle; -+} -+ -+int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref) -+{ -+ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -+ return p == NULL ? -1 : p->vc_handle; -+} -+ -+int av_rpi_zc_offset(const AVRpiZcRefPtr fr_ref) -+{ -+ const ZcBufEnv * const zbe = pic_zbe_ptr(fr_ref); -+ return zbe == NULL ? 0 : zbe->offset; -+} -+ -+int av_rpi_zc_length(const AVRpiZcRefPtr fr_ref) -+{ -+ const ZcBufEnv * const zbe = pic_zbe_ptr(fr_ref); -+ return zbe == NULL ? 0 : zbe->size_pic; -+} -+ -+int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref) -+{ -+ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); -+ return p == NULL ? 0 : p->numbytes; -+} -+ -+const AVRpiZcFrameGeometry * av_rpi_zc_geometry(const AVRpiZcRefPtr fr_ref) -+{ -+ const ZcBufEnv * const zbe = pic_zbe_ptr(fr_ref); -+ return zbe == NULL ? NULL : &zbe->geo; -+} -+ -+AVRpiZcRefPtr av_rpi_zc_ref(void * const logctx, const AVZcEnvPtr zc, -+ const AVFrame * const frame, const enum AVPixelFormat expected_format, const int maycopy) -+{ -+ av_assert0(!maycopy || zc != NULL); -+ -+ if (frame->format != AV_PIX_FMT_YUV420P && -+ frame->format != AV_PIX_FMT_YUV420P10 && -+ !av_rpi_is_sand_frame(frame)) -+ { -+ av_log(logctx, AV_LOG_WARNING, "%s: *** Format not SAND/YUV420P: %d\n", __func__, frame->format); -+ return NULL; -+ } -+ -+ if (frame->buf[1] != NULL || frame->format != expected_format) -+ { -+#if RPI_ZC_SAND_8_IN_10_BUF -+ if (frame->format == AV_PIX_FMT_SAND64_10 && expected_format == AV_PIX_FMT_SAND128 && frame->buf[RPI_ZC_SAND_8_IN_10_BUF] != NULL) -+ { -+// av_log(s, AV_LOG_INFO, "%s: --- found buf[4]\n", __func__); -+ return av_buffer_ref(frame->buf[RPI_ZC_SAND_8_IN_10_BUF]); -+ } -+#endif -+ -+ if (maycopy) -+ { -+ if (frame->buf[1] != NULL) -+ av_log(logctx, AV_LOG_INFO, "%s: *** Not a single buf frame: copying\n", __func__); -+ else -+ av_log(logctx, AV_LOG_INFO, "%s: *** Unexpected frame format %d: copying to %d\n", __func__, frame->format, expected_format); -+ -+ switch (frame->format) -+ { -+ case AV_PIX_FMT_YUV420P10: -+ return zc_420p10_to_sand128(zc, frame); -+ -+ case AV_PIX_FMT_SAND64_10: -+ return zc_sand64_16_to_sand128(zc, frame, 10); -+ -+ default: -+ return zc_copy(zc, frame); -+ } -+ } -+ else -+ { -+ if (frame->buf[1] != NULL) -+ av_log(logctx, AV_LOG_WARNING, "%s: *** Not a single buf frame: buf[1] != NULL\n", __func__); -+ else -+ av_log(logctx, AV_LOG_INFO, "%s: *** Unexpected frame format: %d != %d\n", __func__, frame->format, expected_format); -+ return NULL; -+ } -+ } -+ -+ if (pic_gm_ptr(frame->buf[0]) == NULL) -+ { -+ if (maycopy) -+ { -+ av_log(logctx, AV_LOG_INFO, "%s: *** Not one of our buffers: copying\n", __func__); -+ return zc_copy(zc, frame); -+ } -+ else -+ { -+ av_log(logctx, AV_LOG_WARNING, "%s: *** Not one of our buffers: NULL\n", __func__); -+ return NULL; -+ } -+ } -+ -+ return av_buffer_ref(frame->buf[0]); -+} -+ -+void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref) -+{ -+ if (fr_ref != NULL) -+ { -+ av_buffer_unref(&fr_ref); -+ } -+} -+ -+//---------------------------------------------------------------------------- -+ -+// Extract user environment from an AVBufferRef -+void * av_rpi_zc_buf_v(AVBufferRef * const buf) -+{ -+ ZcBufEnv * const zbe = pic_zbe_ptr(buf); -+ if (zbe != NULL && zbe->user != NULL) -+ { -+ const ZcUserBufEnv * const zub = (const ZcUserBufEnv *)zbe->user->data; -+ return zub == NULL ? NULL : zub->v; -+ } -+ return NULL; -+} -+ -+// AV buffer pre-free callback -+static void zc_user_buf_free_cb(void * opaque, uint8_t * data) -+{ -+ if (opaque != NULL) -+ { -+ ZcUserBufEnv * const zub = opaque; -+ -+ if (zub->fn->free) -+ zub->fn->free(zub->v); -+ -+ av_free(zub); -+ } -+} -+ -+static void zc_buf_env_free_cb(void * opaque, uint8_t * data) -+{ -+ if (opaque != NULL) -+ { -+ ZcBufEnv * const zbe = opaque; -+ -+ av_buffer_unref(&zbe->user); -+ -+ if (zbe->zc != NULL) -+ av_rpi_zc_env_release(zbe->zc); -+ -+ pthread_cond_destroy(&zbe->cond); -+ pthread_mutex_destroy(&zbe->lock); -+ av_free(zbe); -+ } -+} -+ -+ -+// Wrap the various ZC bits in an AV Buffer and resolve those things we want -+// resolved now. -+// Currently we resolve everything, but in future we might not -+AVBufferRef * av_rpi_zc_buf(size_t numbytes, int addr_offset, void * v, const av_rpi_zc_buf_fn_tab_t * fn_tab) -+{ -+ AVBufferRef *buf; -+ ZcUserBufEnv * zub; -+ -+ if ((zub = av_malloc(sizeof(ZcUserBufEnv))) == NULL) -+ return NULL; -+ -+ zub->fn = fn_tab; -+ zub->v = v; -+ zub->numbytes = numbytes; -+ zub->offset = addr_offset; -+ -+ if ((buf = av_buffer_create((uint8_t*)zub, sizeof(*zub), zc_user_buf_free_cb, zub, 0)) == NULL) -+ { -+ av_log(NULL, AV_LOG_ERROR, "ZC: Failed av_buffer_create\n"); -+ av_free(zub); -+ return NULL; -+ } -+ -+ return buf; -+} -+ -+int av_rpi_zc_resolve_buffer(AVBufferRef * const buf, const int alloc_mode) -+{ -+ ZcBufEnv * const zbe = pic_zbe_ptr(buf); -+ -+ if (zbe == NULL) -+ return AVERROR(EINVAL); -+ -+ if (alloc_mode == ZC_RESOLVE_FAIL && !zbe->is_valid) -+ return AVERROR(EAGAIN); -+ -+ if (alloc_mode == ZC_RESOLVE_WAIT_VALID && !zbe->is_valid) -+ { -+ pthread_mutex_lock(&zbe->lock); -+ while (!zbe->is_valid) -+ pthread_cond_wait(&zbe->cond, &zbe->lock); -+ pthread_mutex_unlock(&zbe->lock); -+ } -+ -+ if (zbe->is_valid == ZC_BUF_NEVER) -+ return AVERROR(EINVAL); -+ -+ // Do alloc if we need it -+ if (zbe->user == NULL) -+ { -+ ZcEnv * const zc = zbe->zc; -+ const ZcUserBufEnv * zub; -+ -+ av_assert0(alloc_mode == ZC_RESOLVE_ALLOC || alloc_mode == ZC_RESOLVE_ALLOC_VALID); -+ -+ if ((zbe->user = zc->alloc_buf(zc->pool_env, zbe->size_pic, &zbe->geo)) == NULL) -+ { -+ av_log(NULL, AV_LOG_ERROR, "rpi_get_display_buffer: Failed to get buffer from pool\n"); -+ goto fail; -+ } -+ zub = (const ZcUserBufEnv *)zbe->user->data; -+ -+ // Track -+ -+ zbe->offset = zub->offset; -+ zbe->gmem.numbytes = zub->numbytes; -+ if ((zbe->gmem.arm = zub->fn->map_arm(zub->v)) == NULL) -+ { -+ av_log(NULL, AV_LOG_ERROR, "ZC: Failed to lock vcsm_handle %u\n", zbe->gmem.vcsm_handle); -+ goto fail; -+ } -+ -+ if ((zbe->gmem.vcsm_handle = zub->fn->vcsm_handle(zub->v)) == 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "ZC: Failed to get vcsm_handle\n"); -+ goto fail; -+ } -+ -+ if ((zbe->gmem.vc_handle = zub->fn->vc_handle(zub->v)) == 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "ZC: Failed to get vc handle from vcsm_handle %u\n", zbe->gmem.vcsm_handle); -+ goto fail; -+ } -+ if ((zbe->gmem.vc = zub->fn->map_vc(zub->v)) == 0) -+ { -+ av_log(NULL, AV_LOG_ERROR, "ZC: Failed to get vc addr from vcsm_handle %u\n", zbe->gmem.vcsm_handle); -+ goto fail; -+ } -+ -+ buf->buffer->data = zbe->gmem.arm + zbe->offset; -+ buf->buffer->size = zbe->size_pic; -+ -+ // In this mode we shouldn't have anyone waiting for us -+ // so no need to signal -+ if (alloc_mode == ZC_RESOLVE_ALLOC_VALID) -+ zbe->is_valid = 1; -+ } -+ -+ // Just overwrite - no point in testing -+ buf->data = zbe->gmem.arm + zbe->offset; -+ buf->size = zbe->size_pic; -+ return 0; -+ -+fail: -+ av_buffer_unref(&zbe->user); -+ return AVERROR(ENOMEM); -+} -+ -+int av_rpi_zc_resolve_frame(AVFrame * const frame, const int may_alloc) -+{ -+ int rv; -+ -+ // Do alloc if we need it -+ if ((rv = av_rpi_zc_resolve_buffer(frame->buf[0], may_alloc)) != 0) -+ return rv; -+ -+ // If we are a framebuf copy then the alloc can be done but we haven't -+ // imported its results yet -+ if (frame->data[0] == NULL) -+ { -+ const ZcBufEnv * const zbe = pic_zbe_ptr(frame->buf[0]); -+ -+ frame->linesize[0] = zbe->geo.stride_y; -+ frame->linesize[1] = zbe->geo.stride_c; -+ frame->linesize[2] = zbe->geo.stride_c; -+ // abuse: linesize[3] = "stripe stride" -+ // stripe_stride is NOT the stride between slices it is (that / geo.stride_y). -+ // In a general case this makes the calculation an xor and multiply rather -+ // than a divide and multiply -+ if (zbe->geo.stripes > 1) -+ frame->linesize[3] = zbe->geo.stripe_is_yc ? zbe->geo.height_y + zbe->geo.height_c : zbe->geo.height_y; -+ -+ frame->data[0] = frame->buf[0]->data; -+ frame->data[1] = frame->data[0] + (zbe->geo.stripe_is_yc ? zbe->size_y : zbe->size_y * zbe->geo.stripes); -+ if (zbe->geo.planes_c > 1) -+ frame->data[2] = frame->data[1] + zbe->size_c; -+ -+ frame->extended_data = frame->data; -+ // Leave extended buf alone -+ } -+ -+ return 0; -+} -+ -+int av_rpi_zc_set_valid_frame(AVFrame * const frame) -+{ -+ ZcBufEnv * const zbe = pic_zbe_ptr(frame->buf[0]); -+ -+ if (zbe == NULL) -+ return AVERROR(EINVAL); -+ -+ zbe->is_valid = ZC_BUF_VALID; -+ pthread_cond_broadcast(&zbe->cond); -+ -+ return 0; -+} -+ -+int av_rpi_zc_set_broken_frame(AVFrame * const frame) -+{ -+ ZcBufEnv * const zbe = pic_zbe_ptr(frame->buf[0]); -+ -+ if (zbe == NULL) -+ return AVERROR(EINVAL); -+ -+ zbe->is_valid = ZC_BUF_NEVER; -+ pthread_cond_broadcast(&zbe->cond); -+ -+ return 0; -+} -+ -+void av_rpi_zc_set_decoder_pool_size(ZcEnv *const zc, const unsigned int pool_size) -+{ -+ zc->pool_size = pool_size; -+} -+ -+unsigned int av_rpi_zc_get_decoder_pool_size(ZcEnv *const zc) -+{ -+ return zc->pool_size; -+} -+ -+int av_rpi_zc_get_buffer(ZcEnv *const zc, AVFrame * const frame) -+{ -+#if 1 -+ ZcBufEnv * zbe = av_mallocz(sizeof(*zbe)); -+ -+ for (unsigned int i = 0; i < AV_NUM_DATA_POINTERS; i++) { -+ frame->buf[i] = NULL; -+ frame->data[i] = NULL; -+ frame->linesize[i] = 0; -+ } -+ -+ if (zbe == NULL) -+ return AVERROR(ENOMEM); -+ -+ if ((frame->buf[0] = av_buffer_create((uint8_t *)zbe, sizeof(*zbe), zc_buf_env_free_cb, zbe, 0)) == NULL) -+ { -+ av_free(zbe); -+ return AVERROR(ENOMEM); -+ } -+ -+ pthread_mutex_init(&zbe->lock, NULL); -+ pthread_cond_init(&zbe->cond, NULL); -+ zbe->zc = zc; -+ atomic_fetch_add(&zc->refcount, 1); -+ -+ zbe->geo = av_rpi_zc_frame_geometry(frame->format, frame->width, frame->height); // Note geometry for later use -+ zbe->size_y = zbe->geo.stride_y * zbe->geo.height_y; -+ zbe->size_c = zbe->geo.stride_c * zbe->geo.height_c; -+ zbe->size_pic = (zbe->size_y + zbe->size_c * zbe->geo.planes_c) * zbe->geo.stripes; -+ -+#else -+ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(frame->format, frame->width, frame->height); -+ const unsigned int size_y = geo.stride_y * geo.height_y; -+ const unsigned int size_c = geo.stride_c * geo.height_c; -+ const unsigned int size_pic = (size_y + size_c * geo.planes_c) * geo.stripes; -+ AVBufferRef * buf; -+ unsigned int i; -+ -+// printf("Do local alloc: format=%#x, %dx%d: %u\n", frame->format, frame->width, frame->height, size_pic); -+ -+ if ((buf = zc->alloc_buf(zc->pool_env, size_pic, &geo)) == NULL) -+ { -+ av_log(NULL, AV_LOG_ERROR, "rpi_get_display_buffer: Failed to get buffer from pool\n"); -+ return AVERROR(ENOMEM); -+ } -+ -+ // Track -+ atomic_fetch_add(&zc->refcount, 1); -+ pic_zbe_ptr(buf)->zc = zc; -+ -+ for (i = 0; i < AV_NUM_DATA_POINTERS; i++) { -+ frame->buf[i] = NULL; -+ frame->data[i] = NULL; -+ frame->linesize[i] = 0; -+ } -+ -+ frame->buf[0] = buf; -+ -+ frame->linesize[0] = geo.stride_y; -+ frame->linesize[1] = geo.stride_c; -+ frame->linesize[2] = geo.stride_c; -+ // abuse: linesize[3] = "stripe stride" -+ // stripe_stride is NOT the stride between slices it is (that / geo.stride_y). -+ // In a general case this makes the calculation an xor and multiply rather -+ // than a divide and multiply -+ if (geo.stripes > 1) -+ frame->linesize[3] = geo.stripe_is_yc ? geo.height_y + geo.height_c : geo.height_y; -+ -+ frame->data[0] = buf->data; -+ frame->data[1] = frame->data[0] + (geo.stripe_is_yc ? size_y : size_y * geo.stripes); -+ if (geo.planes_c > 1) -+ frame->data[2] = frame->data[1] + size_c; -+ -+ frame->extended_data = frame->data; -+ // Leave extended buf alone -+ -+#if RPI_ZC_SAND_8_IN_10_BUF != 0 -+ // *** If we intend to use this for real we will want a 2nd buffer pool -+ frame->buf[RPI_ZC_SAND_8_IN_10_BUF] = zc_pool_buf_alloc(&zc->pool, size_pic); // *** 2 * wanted size - kludge -+#endif -+#endif -+ -+ return 0; -+} -+ -+void av_rpi_zc_env_release(const AVZcEnvPtr zc) -+{ -+ const int n = atomic_fetch_add(&zc->refcount, -1); -+ if (n == 1) // was 1, now 0 -+ { -+ zc->free_pool(zc->pool_env); -+ av_free(zc); -+ } -+} -+ -+AVZcEnvPtr av_rpi_zc_env_alloc(void * logctx, -+ void * pool_env, -+ av_rpi_zc_alloc_buf_fn_t * alloc_buf_fn, -+ av_rpi_zc_free_pool_fn_t * free_pool_fn) -+{ -+ ZcEnv * zc; -+ -+ if ((zc = av_mallocz(sizeof(ZcEnv))) == NULL) -+ { -+ av_log(logctx, AV_LOG_ERROR, "av_rpi_zc_env_alloc: Context allocation failed\n"); -+ return NULL; -+ } -+ -+ *zc = (ZcEnv){ -+ .refcount = ATOMIC_VAR_INIT(1), -+ .pool_env = pool_env, -+ .alloc_buf = alloc_buf_fn, -+ .free_pool = free_pool_fn, -+ .pool_size = 0 -+ }; -+ -+ return zc; -+} -+ -+//============================================================================ -+// -+// External ZC initialisation -+ -+#define RPI_GET_BUFFER2 1 -+ -+ -+static int zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags) -+{ -+#if !RPI_GET_BUFFER2 -+ return avcodec_default_get_buffer2(s, frame, flags); -+#else -+ int rv; -+ -+ if ((s->codec->capabilities & AV_CODEC_CAP_DR1) == 0) -+ { -+// printf("Do default alloc: format=%#x\n", frame->format); -+ rv = avcodec_default_get_buffer2(s, frame, flags); -+ } -+ else if (frame->format == AV_PIX_FMT_YUV420P || -+ av_rpi_is_sand_frame(frame)) -+ { -+ if ((rv = av_rpi_zc_get_buffer(s->opaque, frame)) == 0) -+ rv = av_rpi_zc_resolve_frame(frame, ZC_RESOLVE_ALLOC_VALID); -+ } -+ else -+ { -+ rv = avcodec_default_get_buffer2(s, frame, flags); -+ } -+ -+#if 0 -+ printf("%s: fmt:%d, %dx%d lsize=%d/%d/%d/%d data=%p/%p/%p bref=%p/%p/%p opaque[0]=%p\n", __func__, -+ frame->format, frame->width, frame->height, -+ frame->linesize[0], frame->linesize[1], frame->linesize[2], frame->linesize[3], -+ frame->data[0], frame->data[1], frame->data[2], -+ frame->buf[0], frame->buf[1], frame->buf[2], -+ av_buffer_get_opaque(frame->buf[0])); -+#endif -+ return rv; -+#endif -+} -+ -+int av_rpi_zc_in_use(const struct AVCodecContext * const s) -+{ -+ return s->get_buffer2 == zc_get_buffer2; -+} -+ -+int av_rpi_zc_init2(struct AVCodecContext * const s, -+ void * pool_env, -+ av_rpi_zc_alloc_buf_fn_t * alloc_buf_fn, -+ av_rpi_zc_free_pool_fn_t * free_pool_fn) -+{ -+ ZcEnv * zc; -+ -+ av_assert0(!av_rpi_zc_in_use(s)); -+ -+ if ((zc = av_rpi_zc_env_alloc(s, pool_env, alloc_buf_fn, free_pool_fn)) == NULL) -+ return AVERROR(ENOMEM); -+ -+ zc->old = (ZcOldCtxVals){ -+ .opaque = s->opaque, -+ .get_buffer2 = s->get_buffer2, -+ .thread_safe_callbacks = s->thread_safe_callbacks -+ }; -+ -+ s->opaque = zc; -+ s->get_buffer2 = zc_get_buffer2; -+ s->thread_safe_callbacks = 1; -+ return 0; -+} -+ -+void av_rpi_zc_uninit2(struct AVCodecContext * const s) -+{ -+ ZcEnv * const zc = s->opaque; -+ -+ av_assert0(av_rpi_zc_in_use(s)); -+ -+ s->get_buffer2 = zc->old.get_buffer2; -+ s->opaque = zc->old.opaque; -+ s->thread_safe_callbacks = zc->old.thread_safe_callbacks; -+ -+ av_rpi_zc_env_release(zc); -+} -+ ---- /dev/null -+++ b/libavcodec/rpi_zc.h -@@ -0,0 +1,228 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox -+*/ -+ -+#ifndef LIBAVCODEC_RPI_ZC_H -+#define LIBAVCODEC_RPI_ZC_H -+ -+// Zero-Copy frame code for RPi -+// RPi needs Y/U/V planes to be contiguous for display. By default -+// ffmpeg will allocate separated planes so a memcpy is needed before -+// display. This code provides a method a making ffmpeg allocate a single -+// bit of memory for the frame when can then be reference counted until -+// display has finished with it. -+ -+// Frame buffer number in which to stuff an 8-bit copy of a 16-bit frame -+// 0 disables -+// *** This option still in development -+// Only works if SAO active -+// Allocates buffers that are twice the required size -+#define RPI_ZC_SAND_8_IN_10_BUF 0 -+ -+struct AVBufferRef; -+struct AVFrame; -+struct AVCodecContext; -+enum AVPixelFormat; -+ -+// "Opaque" pointer to whatever we are using as a buffer reference -+typedef struct AVBufferRef * AVRpiZcRefPtr; -+ -+struct AVZcEnv; -+typedef struct AVZcEnv * AVZcEnvPtr; -+ -+typedef struct AVRpiZcFrameGeometry -+{ -+ unsigned int stride_y; // Luma stride (bytes) -+ unsigned int height_y; // Luma height (lines) -+ unsigned int stride_c; // Chroma stride (bytes) -+ unsigned int height_c; // Chroma stride (lines) -+ unsigned int planes_c; // Chroma plane count (U, V = 2, interleaved = 1) -+ unsigned int stripes; // Number of stripes (sand) -+ unsigned int bytes_per_pel; -+ int stripe_is_yc; // A single stripe is Y then C (false for tall sand) -+ -+ int format; // Requested format -+ unsigned int video_width; // Requested width -+ unsigned int video_height; // Requested height -+} AVRpiZcFrameGeometry; -+ -+// Get expected MMAL geometry for a given format, width & height -+AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( -+ const int format, -+ const unsigned int video_width, const unsigned int video_height); -+ -+//---------------------------------------------------------------------------- -+// -+// Calls that extract info from a ZC frame whether internally or externally -+// allocated -+ -+// Generate a ZC reference to the buffer(s) in this frame -+// If the buffer doesn't appear to be one allocated by ZC -+// then the behaviour depends on maycopy: -+// If maycopy=0 then return NULL -+// If maycopy=1 && the src frame is in a form where we can easily copy -+// the data, then allocate a new buffer and copy the data into it -+// Otherwise return NULL -+// If maycopy == 0 then ZC may be NULL -+AVRpiZcRefPtr av_rpi_zc_ref(void * const logging_context, const AVZcEnvPtr zc, -+ const struct AVFrame * const frame, const enum AVPixelFormat expected_format, const int maycopy); -+ -+// Unreference the buffer refed/allocated by _zc_ref -+// If fr_ref is NULL then this will NOP -+void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref); -+ -+// Get the vc_handle from the frame ref -+// Returns -1 if ref doesn't look valid -+int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref); -+// Get the vcsm_handle from the frame ref -+// Returns 0 if ref doesn't look valid -+unsigned int av_rpi_zc_vcsm_handle(const AVRpiZcRefPtr fr_ref); -+// Get offset from the start of the memory referenced -+// by the vc_handle to valid data -+int av_rpi_zc_offset(const AVRpiZcRefPtr fr_ref); -+// Length of buffer data -+int av_rpi_zc_length(const AVRpiZcRefPtr fr_ref); -+// Get the number of bytes allocated from the frame ref -+// Returns 0 if ref doesn't look valid -+int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref); -+// Geometry this frame was allocated with -+const AVRpiZcFrameGeometry * av_rpi_zc_geometry(const AVRpiZcRefPtr fr_ref); -+ -+//---------------------------------------------------------------------------- -+// -+// Calls for external frame allocation -+ -+// Callbacks registered in av_rpi_zc_init2 -+ -+// Callback to allocate a buf for a frame -+// The frame itself is generated in the calling code -+// -+// Parameters: -+// pool_env value passed to av-rpi_zc_init2 -+// size size wanted -+// geo geometry of the frame to be allocated -+// Returns: -+// NULL Alloc failed -+// ptr AVBufferBuf* of allocated buffer -+// In most cases av_rpi_zc_buf will be called by this function -+// and this will be the buf returned by that. -+typedef AVBufferRef * av_rpi_zc_alloc_buf_fn_t(void * pool_env, size_t size, -+ const AVRpiZcFrameGeometry * geo); -+ -+// Callback once ffmpeg is completely done with this pool -+// Called once all allocated buffers have been derefed and ffmpegs ref to this -+// pool has been dropped -+typedef void av_rpi_zc_free_pool_fn_t(void * pool_env); -+ -+// Init ZC into a context -+// Sets opaque, get_buffer2, thread_safe_callbacks -+// Use if you want to allocate your own pools and/or create ZC buffers for -+// all decoders -+// RPI HEVC decoders will allocate appropriate VCSM buffers which can be taken -+// apart by av_rpi_zc_xxx calls without this -+int av_rpi_zc_init2(struct AVCodecContext * const s, -+ void * pool_env, av_rpi_zc_alloc_buf_fn_t * alloc_buf_fn, -+ av_rpi_zc_free_pool_fn_t * free_pool_fn); -+ -+// Free ZC from a context -+void av_rpi_zc_uninit2(struct AVCodecContext * const s); -+ -+// Get minimum pool size in frames - valid by the time the first alloc request -+// occurs. Takes into account thread requests and DPB sizes derived from SPS -+// rather than just adding a worst case DPB size. -+unsigned int av_rpi_zc_get_decoder_pool_size(const AVZcEnvPtr zc); -+ -+typedef struct av_rpi_zc_buf_fn_tab_s { -+ // This AVBuffer is being freed by ffmpeg - return memory -+ // to external pool. Memory may be, but need not be, unmapped. -+ // v is the ptr passed in av_rpi_zc_buf -+ void (* free)(void * v); -+ -+ // Return appropriate handles / mappings -+ // v is the ptr passed in av_rpi_zc_buf -+ unsigned int (* vcsm_handle)(void * v); -+ unsigned int (* vc_handle)(void * v); -+ void * (* map_arm)(void * v); -+ unsigned int (* map_vc)(void * v); -+} av_rpi_zc_buf_fn_tab_t; -+ -+// Allocate a ZC AVBufferRef and set its callback table -+// Doesn't take a buffer address directly - relies on callbacks to return -+// addresses as they are required. Mappings need not be generated until -+// the map callbacks are called but they should persist from then until -+// the buffer is freed. -+// -+// Parameters: -+// numbytes Size of the buffer -+// addr_offset Offset to first usable byte of buffer (for alignment) -+// normally 0 -+// v Pointer passed to callbacks -+// fn_tab Function table -+AVBufferRef * av_rpi_zc_buf(size_t numbytes, int addr_offset, void * v, const av_rpi_zc_buf_fn_tab_t * fn_tab); -+ -+// Get v ptr set in in av_rpi_zc_buf -+void * av_rpi_zc_buf_v(AVBufferRef * const buf); -+ -+//---------------------------------------------------------------------------- -+// -+// Mostly internal calls but might possibly be wanted by outside code -+ -+void av_rpi_zc_int_env_freep(AVZcEnvPtr * zc); -+AVZcEnvPtr av_rpi_zc_int_env_alloc(void * const logctx); -+void av_rpi_zc_set_decoder_pool_size(const AVZcEnvPtr zc, const unsigned int pool_size); -+ -+// Test to see if the context is using zc (checks get_buffer2) -+int av_rpi_zc_in_use(const struct AVCodecContext * const s); -+ -+// Get buffer generates placeholders for later alloc -+int av_rpi_zc_get_buffer(const AVZcEnvPtr zc, AVFrame * const frame); -+// Resolve actually does the alloc (noop if already alloced) -+// Set data pointers on a buffer/frame that was copied before the alloc -+// accured -+#define ZC_RESOLVE_FAIL 0 // return error on invalid -+#define ZC_RESOLVE_ALLOC 1 // alloc as invalid -+#define ZC_RESOLVE_WAIT_VALID 2 // wait for valid -+#define ZC_RESOLVE_ALLOC_VALID 3 // alloc as valid -+int av_rpi_zc_resolve_buffer(AVBufferRef * const buf, const int may_alloc); -+int av_rpi_zc_resolve_frame(AVFrame * const frame, const int may_alloc); -+ -+int av_rpi_zc_set_valid_frame(AVFrame * const frame); -+int av_rpi_zc_set_broken_frame(AVFrame * const frame); -+ -+ -+ -+ -+AVZcEnvPtr av_rpi_zc_env_alloc(void * logctx, -+ void * pool_env, -+ av_rpi_zc_alloc_buf_fn_t * alloc_buf_fn, -+ av_rpi_zc_free_pool_fn_t * free_pool_fn); -+void av_rpi_zc_env_release(const AVZcEnvPtr zc); -+ -+ -+#endif -+ ---- /dev/null -+++ b/libavcodec/rpi_zc_frames.h -@@ -0,0 +1,142 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox, Ben Avison -+*/ -+ -+#ifndef RPI_ZC_FRAMES_H -+#define RPI_ZC_FRAMES_H -+ -+#define RPI_ONE_BUF 1 -+ -+#include "rpi_mem.h" // for GPU_MEM_PTR_T -+#include "libavutil/frame.h" -+ -+#if !RPI_ONE_BUF -+static inline uint32_t get_vc_address_y(const AVFrame * const frame) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_buffer_get_opaque(frame->buf[0]); -+ return p->vc; -+} -+ -+static inline uint32_t get_vc_address_u(const AVFrame * const frame) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_buffer_get_opaque(frame->buf[1]); -+ return p->vc; -+} -+ -+static inline uint32_t get_vc_address_v(const AVFrame * const frame) { -+ GPU_MEM_PTR_T *p = av_buffer_pool_buffer_get_opaque(frame->buf[2]); -+ return p->vc; -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { -+ return *(GPU_MEM_PTR_T *)av_buffer_pool_buffer_get_opaque(frame->buf[0]); -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { -+ return *(GPU_MEM_PTR_T *)av_buffer_pool_buffer_get_opaque(frame->buf[1]); -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { -+ return *(GPU_MEM_PTR_T *)av_buffer_pool_buffer_get_opaque(frame->buf[2]); -+} -+ -+#else -+ -+static inline int gpu_is_buf1(const AVFrame * const frame) -+{ -+ return frame->buf[1] == NULL; -+} -+ -+static inline GPU_MEM_PTR_T * gpu_buf1_gmem(const AVFrame * const frame) -+{ -+ return av_buffer_get_opaque(frame->buf[0]); -+} -+ -+static inline GPU_MEM_PTR_T * gpu_buf3_gmem(const AVFrame * const frame, const unsigned int n) -+{ -+ return av_buffer_pool_buffer_get_opaque(frame->buf[n]); -+} -+ -+static inline uint32_t get_vc_address3(const AVFrame * const frame, const unsigned int n) -+{ -+ const GPU_MEM_PTR_T * const gm = gpu_is_buf1(frame) ? gpu_buf1_gmem(frame) : gpu_buf3_gmem(frame, n); -+ return gm->vc + (frame->data[n] - gm->arm); -+} -+ -+ -+static inline uint32_t get_vc_address_y(const AVFrame * const frame) { -+ return get_vc_address3(frame, 0); -+} -+ -+static inline uint32_t get_vc_address_u(const AVFrame * const frame) { -+ return get_vc_address3(frame, 1); -+} -+ -+static inline uint32_t get_vc_address_v(const AVFrame * const frame) { -+ return get_vc_address3(frame, 2); -+} -+ -+#if 0 -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { -+ if (gpu_is_buf1(frame)) -+ { -+ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -+ g.numbytes = frame->data[1] - frame->data[0]; -+ return g; -+ } -+ else -+ return *gpu_buf3_gmem(frame, 0); -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { -+ if (gpu_is_buf1(frame)) -+ { -+ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -+ g.arm += frame->data[1] - frame->data[0]; -+ g.vc += frame->data[1] - frame->data[0]; -+ g.numbytes = frame->data[2] - frame->data[1]; // chroma size -+ return g; -+ } -+ else -+ return *gpu_buf3_gmem(frame, 1); -+} -+ -+static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { -+ if (gpu_is_buf1(frame)) -+ { -+ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); -+ g.arm += frame->data[2] - frame->data[0]; -+ g.vc += frame->data[2] - frame->data[0]; -+ g.numbytes = frame->data[2] - frame->data[1]; // chroma size -+ return g; -+ } -+ else -+ return *gpu_buf3_gmem(frame, 2); -+} -+#endif -+#endif -+ -+#endif ---- /dev/null -+++ b/libavcodec/rpivid_hevc.c -@@ -0,0 +1,2128 @@ -+// FFMPEG HEVC decoder hardware accelerator -+// Andrew Holme, Argon Design Ltd -+// Copyright (c) June 2017 Raspberry Pi Ltd -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fftools/ffmpeg.h" -+#include "libavutil/avassert.h" -+#include "libavutil/imgutils.h" -+#include "avcodec.h" -+#include "hwconfig.h" -+#include "decode.h" -+ -+#include "hevc.h" -+#include "hevcdec.h" -+#include "rpi_zc.h" -+#include "rpi_mem.h" -+#include "rpi_zc_frames.h" -+#include "rpi_mailbox.h" -+ -+ -+#define OPT_PHASE_TIMING 0 // Generate stats for phase usage -+ -+#define OPT_EMU 0 -+ -+#define TRACE_DEV 0 -+#define TRACE_ENTRY 0 -+ -+#define NUM_SCALING_FACTORS 4064 -+ -+#define AXI_BASE64 0 -+ -+#define PROB_BACKUP ((20<<12) + (20<<6) + (0<<0)) -+#define PROB_RELOAD ((20<<12) + (20<<0) + (0<<6)) -+ -+#define RPIVID_COL_PICS 17 // 16 ref & current -+ -+#define RPIVID_BITBUFS 2 // Bit + Cmd bufs (phase 0 & 1) -+#define RPIVID_BITBUF_SIZE (4 << 20) // Bit + Cmd buf size -+ -+#define RPIVID_COEFFBUFS 3 // PU + Coeff bufs (phase 1 & 2) -+#define RPIVID_COEFFBUF_SIZE (16 << 20) // PU + Coeff buf size -+ -+////////////////////////////////////////////////////////////////////////////// -+// -+// Register offsets -+ -+#define RPI_SPS0 0 -+#define RPI_SPS1 4 -+#define RPI_PPS 8 -+#define RPI_SLICE 12 -+#define RPI_TILESTART 16 -+#define RPI_TILEEND 20 -+#define RPI_SLICESTART 24 -+#define RPI_MODE 28 -+#define RPI_LEFT0 32 -+#define RPI_LEFT1 36 -+#define RPI_LEFT2 40 -+#define RPI_LEFT3 44 -+#define RPI_QP 48 -+#define RPI_CONTROL 52 -+#define RPI_STATUS 56 -+#define RPI_VERSION 60 -+#define RPI_BFBASE 64 -+#define RPI_BFNUM 68 -+#define RPI_BFCONTROL 72 -+#define RPI_BFSTATUS 76 -+#define RPI_PUWBASE 80 -+#define RPI_PUWSTRIDE 84 -+#define RPI_COEFFWBASE 88 -+#define RPI_COEFFWSTRIDE 92 -+#define RPI_SLICECMDS 96 -+#define RPI_BEGINTILEEND 100 -+#define RPI_TRANSFER 104 -+#define RPI_CFBASE 108 -+#define RPI_CFNUM 112 -+#define RPI_CFSTATUS 116 -+ -+#define RPI_PURBASE 0x8000 -+#define RPI_PURSTRIDE 0x8004 -+#define RPI_COEFFRBASE 0x8008 -+#define RPI_COEFFRSTRIDE 0x800C -+#define RPI_NUMROWS 0x8010 -+#define RPI_CONFIG2 0x8014 -+#define RPI_OUTYBASE 0x8018 -+#define RPI_OUTYSTRIDE 0x801C -+#define RPI_OUTCBASE 0x8020 -+#define RPI_OUTCSTRIDE 0x8024 -+#define RPI_STATUS2 0x8028 -+#define RPI_FRAMESIZE 0x802C -+#define RPI_MVBASE 0x8030 -+#define RPI_MVSTRIDE 0x8034 -+#define RPI_COLBASE 0x8038 -+#define RPI_COLSTRIDE 0x803C -+#define RPI_CURRPOC 0x8040 -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+// Unused but left here to illustrate the diffrences between FFmpegs prob -+// structure and the rpivid one -+ -+struct FFM_PROB { -+ uint8_t sao_merge_flag [ 1]; -+ uint8_t sao_type_idx [ 1]; -+ uint8_t split_coding_unit_flag [ 3]; -+ uint8_t cu_transquant_bypass_flag [ 1]; -+ uint8_t skip_flag [ 3]; -+ uint8_t cu_qp_delta [ 3]; -+ uint8_t pred_mode_flag [ 1]; -+ uint8_t part_mode [ 4]; -+ uint8_t prev_intra_luma_pred_flag [ 1]; -+ uint8_t intra_chroma_pred_mode [ 2]; -+ uint8_t merge_flag [ 1]; -+ uint8_t merge_idx [ 1]; -+ uint8_t inter_pred_idc [ 5]; -+ uint8_t ref_idx_l0 [ 2]; -+ uint8_t ref_idx_l1 [ 2]; -+ uint8_t abs_mvd_greater0_flag [ 2]; -+ uint8_t abs_mvd_greater1_flag [ 2]; -+ uint8_t mvp_lx_flag [ 1]; -+ uint8_t no_residual_data_flag [ 1]; -+ uint8_t split_transform_flag [ 3]; -+ uint8_t cbf_luma [ 2]; -+ uint8_t cbf_cb_cr [ 4]; -+ uint8_t transform_skip_flag/*[][]*/ [ 2]; -+ uint8_t explicit_rdpcm_flag/*[][]*/ [ 2]; -+ uint8_t explicit_rdpcm_dir_flag/*[][]*/ [ 2]; -+ uint8_t last_significant_coeff_x_prefix [18]; -+ uint8_t last_significant_coeff_y_prefix [18]; -+ uint8_t significant_coeff_group_flag [ 4]; -+ uint8_t significant_coeff_flag [44]; -+ uint8_t coeff_abs_level_greater1_flag [24]; -+ uint8_t coeff_abs_level_greater2_flag [ 6]; -+ uint8_t log2_res_scale_abs [ 8]; -+ uint8_t res_scale_sign_flag [ 2]; -+ uint8_t cu_chroma_qp_offset_flag [ 1]; -+ uint8_t cu_chroma_qp_offset_idx [ 1]; -+} __attribute__((packed)); -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+struct RPI_PROB { -+ uint8_t SAO_MERGE_FLAG [ 1]; -+ uint8_t SAO_TYPE_IDX [ 1]; -+ uint8_t SPLIT_FLAG [ 3]; -+ uint8_t CU_SKIP_FLAG [ 3]; -+ uint8_t CU_TRANSQUANT_BYPASS_FLAG [ 1]; -+ uint8_t PRED_MODE [ 1]; -+ uint8_t PART_SIZE [ 4]; -+ uint8_t INTRA_PRED_MODE [ 1]; -+ uint8_t CHROMA_PRED_MODE [ 1]; -+ uint8_t MERGE_FLAG_EXT [ 1]; -+ uint8_t MERGE_IDX_EXT [ 1]; -+ uint8_t INTER_DIR [ 5]; -+ uint8_t REF_PIC [ 2]; -+ uint8_t MVP_IDX [ 1]; -+ uint8_t MVD [ 2]; -+ uint8_t QT_ROOT_CBF [ 1]; -+ uint8_t TRANS_SUBDIV_FLAG [ 3]; -+ uint8_t QT_CBF [ 6]; -+ uint8_t DQP [ 2]; -+ uint8_t ONE_FLAG [24]; -+ uint8_t LASTX [18]; -+ uint8_t LASTY [18]; -+ uint8_t SIG_CG_FLAG [ 4]; -+ uint8_t ABS_FLAG [ 6]; -+ uint8_t TRANSFORMSKIP_FLAG [ 2]; -+ uint8_t SIG_FLAG [42]; -+ uint8_t SIG_FLAG_unused [ 2]; -+} __attribute__((packed)); -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+struct RPI_CMD { -+ uint32_t addr; -+ uint32_t data; -+} __attribute__((packed)); -+ -+struct RPI_BIT { -+ int cmd; -+ const void *ptr; -+ int len; -+}; -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+struct RPI_T; -+ -+// Actual addressability is 38bits but we can only alloc in the bottom 32 -+// currently - when passed to rpivid h/w the address is always >> 6 so will -+// fit in 32 bit there -+// At some point we may weant to make this uint64_t -+typedef uint32_t vid_vc_addr_t; -+ -+typedef enum rpivid_decode_state_e { -+ RPIVID_DECODE_NEW = 0, -+ RPIVID_DECODE_START, -+ RPIVID_DECODE_SLICE, -+ RPIVID_DECODE_END, -+} rpivid_decode_state_t; -+ -+#define RPI_PROB_VALS 154U -+#define RPI_PROB_ARRAY_SIZE ((154 + 3) & ~3) -+ -+typedef struct dec_env_s { -+ const AVCodecContext * avctx; -+ -+ rpivid_decode_state_t state; -+ unsigned int decode_order; -+ -+ int phase_no; // Current phase (i.e. the last one we waited for) -+ struct dec_env_s * phase_wait_q_next; -+ sem_t phase_wait; -+ -+ struct RPI_BIT *bit_fifo; -+ struct RPI_CMD *cmd_fifo; -+ unsigned int bit_len, bit_max; -+ unsigned int cmd_len, cmd_max; -+ unsigned int num_slice_msgs; -+ unsigned int PicWidthInCtbsY; -+ unsigned int PicHeightInCtbsY; -+ unsigned int dpbno_col; -+ uint32_t reg_slicestart; -+ unsigned int wpp_entry_x; -+ unsigned int wpp_entry_y; -+ -+ const uint8_t * nal_buffer; -+ size_t nal_size; -+ -+ uint16_t slice_msgs[2*HEVC_MAX_REFS*8+3]; -+ uint8_t scaling_factors[NUM_SCALING_FACTORS]; -+// unsigned int RefPicList[2][HEVC_MAX_REFS]; -+} dec_env_t; -+ -+#define RPIVID_PHASES 3 -+#define RPIVID_PHASE_NEW (RPIVID_PHASES) // Phase before we have inced decode order -+#define RPIVID_PHASE_START (-1) // Phase after we have inced decode_order -+ -+#if OPT_PHASE_TIMING -+static const unsigned int time_thresholds[8] = { -+ 10, 15, 20, 30, 45, 60, 75, 90 -+}; -+#endif -+ -+typedef struct phase_wait_env_s { -+ unsigned int last_order; -+ dec_env_t * q; -+#if OPT_PHASE_TIMING -+ uint64_t phase_time; -+ uint64_t max_phase_time; -+ uint64_t time_in_phase; -+ uint64_t time_out_phase; -+ unsigned int max_time_decode_order; -+ unsigned int time_bins[9]; -+ unsigned int time_bins3[9]; -+ unsigned int time_bins5[9]; -+ uint64_t time_stash[16]; -+ unsigned int i3; -+#endif -+} phase_wait_env_t; // Single linked list of threads waiting for this phase -+ -+typedef struct RPI_T { -+ atomic_int ref_count; -+ sem_t ref_zero; -+ -+ dec_env_t ** dec_envs; -+ AVZcEnvPtr zc; -+ -+ pthread_mutex_t phase_lock; -+ phase_wait_env_t phase_reqs[RPIVID_PHASES]; -+ -+ volatile uint32_t * regs; -+ volatile uint32_t * ints; -+ -+ GPU_MEM_PTR_T gcolbuf; -+ unsigned int col_stride; -+ size_t col_picsize; -+ -+ unsigned int bitbuf_no; -+ sem_t bitbuf_sem; -+ GPU_MEM_PTR_T gbitbufs[RPIVID_BITBUFS]; -+ -+ unsigned int max_pu_msgs; -+ unsigned int coeffbuf_no; -+ sem_t coeffbuf_sem; -+ GPU_MEM_PTR_T gcoeffbufs[RPIVID_COEFFBUFS]; -+ -+ unsigned int decode_order; -+ int mbox_fd; -+ int gpu_init_type; -+} RPI_T; -+ -+#if OPT_PHASE_TIMING -+static uint64_t tus64(void) -+{ -+ struct timespec ts; -+ clock_gettime(CLOCK_MONOTONIC, &ts); -+ return (uint64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; -+} -+#endif -+ -+static inline unsigned int rnd64(unsigned int x) -+{ -+ return (x + 63) & ~63; -+} -+ -+static inline int rpi_sem_wait(sem_t * const sem) -+{ -+ int rv; -+ while ((rv = sem_wait(sem)) != 0 && errno == EINTR) -+ /* Loop */; -+ return rv; -+} -+ -+//============================================================================ -+ -+#define REGS_NAME "/dev/rpivid-hevcmem" -+#define REGS_SIZE 0x10000 -+#define INTS_NAME "/dev/rpivid-intcmem" -+#define INTS_SIZE 0x10000 // 4 is probably enough but we are going to alloc a page anyway -+ -+static volatile uint32_t * map_dev(AVCodecContext * const avctx, const char * const dev_name, size_t size) -+{ -+ void *gpio_map; -+ int mem_fd; -+ -+ /* open /dev/mem */ -+ if ((mem_fd = open(dev_name, O_RDWR|O_SYNC) ) < 0) { -+ av_log(avctx, AV_LOG_WARNING, "can't open %s\n", dev_name); -+ return NULL; -+ } -+ -+ // Now map it -+ gpio_map = mmap( -+ NULL, -+ size, -+ PROT_READ|PROT_WRITE, -+ MAP_SHARED, -+ mem_fd, -+ 0 -+ ); -+ -+ close(mem_fd); // No longer need the FD -+ -+ if (gpio_map == MAP_FAILED) { -+ av_log(avctx, AV_LOG_WARNING, "GPIO mapping failed"); -+ return NULL; -+ } -+ -+ return (volatile uint32_t *)gpio_map; -+} -+ -+static void unmap_devp(volatile uint32_t ** const p_gpio_map, size_t size) -+{ -+ volatile uint32_t * const gpio_map = *p_gpio_map; -+ if (gpio_map != NULL) { -+ *p_gpio_map = NULL; -+ munmap((void *)gpio_map, size); -+ } -+} -+ -+#define MANGLE(x) ((x) &~0xc0000000) // ** If x is ever a 64 bit thing this will need fixing! -+#define MANGLE64(x) (uint32_t)(MANGLE(x)>>6) -+ -+static inline void apb_write_vc_addr(const RPI_T *const rpi, const uint32_t addr, const vid_vc_addr_t data) -+{ -+#if TRACE_DEV -+ printf("W %x %08x\n", addr, MANGLE64(data)); -+#endif -+ -+ rpi->regs[addr >> 2] = MANGLE64(data); -+} -+ -+static inline void apb_write_vc_len(const RPI_T *const rpi, const uint32_t addr, const unsigned int data) -+{ -+#if TRACE_DEV -+ printf("W %x %08x\n", addr, data >> 6); -+#endif -+ -+ rpi->regs[addr >> 2] = data >> 6; // ?? rnd64 - but not currently needed -+} -+ -+static inline void apb_write(const RPI_T * const rpi, const uint32_t addr, const uint32_t data) -+{ -+#if TRACE_DEV -+ printf("W %x %08x\n", addr, data); -+#endif -+ -+ rpi->regs[addr >> 2] = data; -+} -+ -+static inline uint32_t apb_read(const RPI_T * const rpi, const uint32_t addr) -+{ -+ const uint32_t v = rpi->regs[addr >> 2]; -+#if TRACE_DEV -+ printf("R %x (=%x)\n", addr, v); -+#endif -+ return v; -+} -+ -+#define ARG_IC_ICTRL_ACTIVE1_INT_SET 0x00000001 -+#define ARG_IC_ICTRL_ACTIVE1_EDGE_SET 0x00000002 -+#define ARG_IC_ICTRL_ACTIVE1_EN_SET 0x00000004 -+#define ARG_IC_ICTRL_ACTIVE1_STATUS_SET 0x00000008 -+#define ARG_IC_ICTRL_ACTIVE2_INT_SET 0x00000010 -+#define ARG_IC_ICTRL_ACTIVE2_EDGE_SET 0x00000020 -+#define ARG_IC_ICTRL_ACTIVE2_EN_SET 0x00000040 -+#define ARG_IC_ICTRL_ACTIVE2_STATUS_SET 0x00000080 -+ -+static inline void int_wait(const RPI_T * const rpi, const unsigned int phase) -+{ -+ const uint32_t mask_reset = phase == 1 ? ~ARG_IC_ICTRL_ACTIVE2_INT_SET : ~ARG_IC_ICTRL_ACTIVE1_INT_SET; -+ const uint32_t mask_done = phase == 1 ? ARG_IC_ICTRL_ACTIVE1_INT_SET : ARG_IC_ICTRL_ACTIVE2_INT_SET; -+ uint32_t ival; -+ while (((ival = rpi->ints[0]) & mask_done) == 0) { -+ usleep(1000); -+ } -+ rpi->ints[0] = ival & mask_reset; -+} -+ -+#if TRACE_DEV && 0 -+static void apb_dump_regs(const RPI_T * const rpi, uint16_t addr, int num) { -+ int i; -+ -+ for (i=0; iregs[(addr>>2)+i]); -+ -+ if ((i%4)==3 || i+1 == num) -+ printf("\n"); -+ else -+ printf(" "); -+ } -+} -+ -+static void axi_dump(const dec_env_t * const de, uint64_t addr, uint32_t size) { -+ int i; -+ -+ for (i=0; i>2; i++) -+ { -+ if ((i%4)==0) -+ printf("%08x: ", MANGLE(de->gbuf.vc) + (uint32_t)addr + 4*i); -+ -+ printf("%08x", ((uint32_t*)de->gbuf.arm)[(addr>>2)+i]); -+ -+ if ((i%4)==3 || i+1 == size>>2) -+ printf("\n"); -+ else -+ printf(" "); -+ } -+} -+#endif -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+static inline size_t round_up_size(const size_t x) -+{ -+ /* Admit no size < 256 */ -+ const unsigned int n = x < 256 ? 8 : av_log2(x) - 1; -+ -+ return x >= (3 << n) ? 4 << n : (3 << n); -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Scaling factors -+ -+static void expand_scaling_list( -+ const unsigned int sizeID, -+ const unsigned int matrixID, -+ uint8_t * const dst0, -+ const uint8_t * const src0, -+ uint8_t dc) -+{ -+ switch (sizeID) { -+ case 0: -+ memcpy(dst0, src0, 16); -+ break; -+ case 1: -+ memcpy(dst0, src0, 64); -+ break; -+ case 2: -+ { -+ uint8_t * d = dst0; -+ for (unsigned int y=0; y != 16; y++) { -+ const uint8_t * s = src0 + (y >> 1) * 8; -+ for (unsigned int x = 0; x != 8; ++x) { -+ *d++ = *s; -+ *d++ = *s++; -+ } -+ } -+ dst0[0] = dc; -+ break; -+ } -+ default: -+ { -+ uint8_t * d = dst0; -+ for (unsigned int y=0; y != 32; y++) { -+ const uint8_t * s = src0 + (y >> 2) * 8; -+ for (unsigned int x = 0; x != 8; ++x) { -+ *d++ = *s; -+ *d++ = *s; -+ *d++ = *s; -+ *d++ = *s++; -+ } -+ } -+ dst0[0] = dc; -+ break; -+ } -+ } -+} -+ -+static void populate_scaling_factors(dec_env_t * const de, const HEVCContext * const s) { -+ // Array of constants for scaling factors -+ static const uint32_t scaling_factor_offsets[4][6] = { -+ // MID0 MID1 MID2 MID3 MID4 MID5 -+ {0x0000, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050}, // SID0 (4x4) -+ {0x0060, 0x00A0, 0x00E0, 0x0120, 0x0160, 0x01A0}, // SID1 (8x8) -+ {0x01E0, 0x02E0, 0x03E0, 0x04E0, 0x05E0, 0x06E0}, // SID2 (16x16) -+ {0x07E0, 0, 0, 0x0BE0, 0, 0}}; // SID3 (32x32) -+ -+ // ffmpeg places SID3,MID1 where matrixID 3 normally is -+ const ScalingList * const sl = -+ s->ps.pps->scaling_list_data_present_flag ? &s->ps.pps->scaling_list -+ : &s->ps.sps->scaling_list; -+ unsigned int mid; -+ -+ for (mid=0; mid<6; mid++) -+ expand_scaling_list(0, mid, -+ de->scaling_factors + scaling_factor_offsets[0][mid], -+ sl->sl[0][mid], 0); -+ for (mid=0; mid<6; mid++) -+ expand_scaling_list(1, mid, -+ de->scaling_factors + scaling_factor_offsets[1][mid], -+ sl->sl[1][mid], 0); -+ for (mid=0; mid<6; mid++) -+ expand_scaling_list(2, mid, -+ de->scaling_factors + scaling_factor_offsets[2][mid], -+ sl->sl[2][mid], -+ sl->sl_dc[0][mid]); -+ // second scaling matrix for 32x32 is at matrixID 3 not 1 in ffmpeg -+ for (mid=0; mid<6; mid += 3) -+ expand_scaling_list(3, mid, -+ de->scaling_factors + scaling_factor_offsets[3][mid], -+ sl->sl[3][mid], -+ sl->sl_dc[1][mid]); -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Probabilities -+ -+static const uint8_t prob_init[3][156] = { -+ { -+ 153, 200, 139, 141, 157, 154, 154, 154, -+ 154, 154, 184, 154, 154, 154, 184, 63, -+ 154, 154, 154, 154, 154, 154, 154, 154, -+ 154, 154, 154, 154, 154, 153, 138, 138, -+ 111, 141, 94, 138, 182, 154, 154, 154, -+ 140, 92, 137, 138, 140, 152, 138, 139, -+ 153, 74, 149, 92, 139, 107, 122, 152, -+ 140, 179, 166, 182, 140, 227, 122, 197, -+ 110, 110, 124, 125, 140, 153, 125, 127, -+ 140, 109, 111, 143, 127, 111, 79, 108, -+ 123, 63, 110, 110, 124, 125, 140, 153, -+ 125, 127, 140, 109, 111, 143, 127, 111, -+ 79, 108, 123, 63, 91, 171, 134, 141, -+ 138, 153, 136, 167, 152, 152, 139, 139, -+ 111, 111, 125, 110, 110, 94, 124, 108, -+ 124, 107, 125, 141, 179, 153, 125, 107, -+ 125, 141, 179, 153, 125, 107, 125, 141, -+ 179, 153, 125, 140, 139, 182, 182, 152, -+ 136, 152, 136, 153, 136, 139, 111, 136, -+ 139, 111, 0, 0, }, -+ { -+ 153, 185, 107, 139, 126, 197, 185, 201, -+ 154, 149, 154, 139, 154, 154, 154, 152, -+ 110, 122, 95, 79, 63, 31, 31, 153, -+ 153, 168, 140, 198, 79, 124, 138, 94, -+ 153, 111, 149, 107, 167, 154, 154, 154, -+ 154, 196, 196, 167, 154, 152, 167, 182, -+ 182, 134, 149, 136, 153, 121, 136, 137, -+ 169, 194, 166, 167, 154, 167, 137, 182, -+ 125, 110, 94, 110, 95, 79, 125, 111, -+ 110, 78, 110, 111, 111, 95, 94, 108, -+ 123, 108, 125, 110, 94, 110, 95, 79, -+ 125, 111, 110, 78, 110, 111, 111, 95, -+ 94, 108, 123, 108, 121, 140, 61, 154, -+ 107, 167, 91, 122, 107, 167, 139, 139, -+ 155, 154, 139, 153, 139, 123, 123, 63, -+ 153, 166, 183, 140, 136, 153, 154, 166, -+ 183, 140, 136, 153, 154, 166, 183, 140, -+ 136, 153, 154, 170, 153, 123, 123, 107, -+ 121, 107, 121, 167, 151, 183, 140, 151, -+ 183, 140, 0, 0, }, -+ { -+ 153, 160, 107, 139, 126, 197, 185, 201, -+ 154, 134, 154, 139, 154, 154, 183, 152, -+ 154, 137, 95, 79, 63, 31, 31, 153, -+ 153, 168, 169, 198, 79, 224, 167, 122, -+ 153, 111, 149, 92, 167, 154, 154, 154, -+ 154, 196, 167, 167, 154, 152, 167, 182, -+ 182, 134, 149, 136, 153, 121, 136, 122, -+ 169, 208, 166, 167, 154, 152, 167, 182, -+ 125, 110, 124, 110, 95, 94, 125, 111, -+ 111, 79, 125, 126, 111, 111, 79, 108, -+ 123, 93, 125, 110, 124, 110, 95, 94, -+ 125, 111, 111, 79, 125, 126, 111, 111, -+ 79, 108, 123, 93, 121, 140, 61, 154, -+ 107, 167, 91, 107, 107, 167, 139, 139, -+ 170, 154, 139, 153, 139, 123, 123, 63, -+ 124, 166, 183, 140, 136, 153, 154, 166, -+ 183, 140, 136, 153, 154, 166, 183, 140, -+ 136, 153, 154, 170, 153, 138, 138, 122, -+ 121, 122, 121, 167, 151, 183, 140, 151, -+ 183, 140, 0, 0, }, -+}; -+ -+ -+////////////////////////////////////////////////////////////////////////////// -+// Phase 1 command and bit FIFOs -+ -+// ???? uint16_t addr - put in uint32_t -+static int p1_apb_write(dec_env_t * const de, const uint16_t addr, const uint32_t data) { -+ if (de->cmd_len==de->cmd_max) -+ av_assert0(de->cmd_fifo = realloc(de->cmd_fifo, (de->cmd_max*=2)*sizeof(struct RPI_CMD))); -+ -+#if TRACE_DEV -+ printf("[%02x] %x %x\n", de->cmd_len, addr, data); -+#endif -+ -+ de->cmd_fifo[de->cmd_len].addr = addr; -+ de->cmd_fifo[de->cmd_len].data = data; -+ return de->cmd_len++; -+} -+ -+static void p1_axi_write(dec_env_t * const de, const uint32_t len, const void * const ptr, const int cmd_idx) { -+ if (de->bit_len==de->bit_max) -+ av_assert0(de->bit_fifo = realloc(de->bit_fifo, (de->bit_max*=2)*sizeof(struct RPI_BIT))); -+ de->bit_fifo[de->bit_len].cmd = cmd_idx; -+ de->bit_fifo[de->bit_len].ptr = ptr; -+ de->bit_fifo[de->bit_len].len = len; -+ de->bit_len++; -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Write probability and scaling factor memories -+ -+#if 0 -+static void WriteProb(dec_env_t * const de) { -+ int i; -+ const uint8_t *p = (uint8_t *) &de->probabilities; -+ for (i=0; ish.cabac_init_flag && s->sh.slice_type != HEVC_SLICE_I) ? -+ s->sh.slice_type + 1 : 2 - s->sh.slice_type; -+ const uint8_t * p = prob_init[init_type]; -+ const int q = av_clip(s->sh.slice_qp, 0, 51); -+ unsigned int i; -+ -+ for (i = 0; i < RPI_PROB_VALS; i++) { -+ int init_value = p[i]; -+ int m = (init_value >> 4) * 5 - 45; -+ int n = ((init_value & 15) << 3) - 16; -+ int pre = 2 * (((m * q) >> 4) + n) - 127; -+ -+ pre ^= pre >> 31; -+ if (pre > 124) -+ pre = 124 + (pre & 1); -+ dst[i] = pre; -+ } -+ for (i = RPI_PROB_VALS; i != RPI_PROB_ARRAY_SIZE; ++i) { -+ dst[i] = 0; -+ } -+ -+ for (i=0; i < RPI_PROB_ARRAY_SIZE; i+=4) -+ p1_apb_write(de, 0x1000+i, dst[i] + (dst[i+1]<<8) + (dst[i+2]<<16) + (dst[i+3]<<24)); -+ -+} -+ -+ -+static void WriteScalingFactors(dec_env_t * const de) { -+ int i; -+ const uint8_t *p = (uint8_t *) de->scaling_factors; -+ for (i=0; i= bd[i]; i++); // bd[] has num+1 elements; bd[0]=0; see hevc_ps.c -+ return i-1; -+} -+ -+static int ctb_to_slice_w_h (unsigned int ctb, int ctb_size, int width, unsigned int *bd, int num) { -+ if (ctb < bd[num-1]) return ctb_size; -+ else if (width % ctb_size) return width % ctb_size; -+ else return ctb_size; -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Handle PU and COEFF stream overflow -+ -+ -+// Returns: -+// -2 Other error -+// -1 Out of coeff space -+// 0 OK -+// 1 Out of PU space -+ -+static int check_status(const RPI_T * const rpi, dec_env_t * const de) { -+ uint32_t status; -+ -+ // this is the definition of successful completion of phase 1 -+ // it assures that status register is zero and all blocks in each tile have completed -+ if (apb_read(rpi, RPI_CFSTATUS) == apb_read(rpi, RPI_CFNUM)) -+ return 0; -+ -+ status = apb_read(rpi, RPI_STATUS); -+ -+ if ((status & 8) != 0) -+ return -1; -+ -+ if ((status & 0x10) != 0) -+ return 1; -+ -+ return -2; -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Write STATUS register with expected end CTU address of previous slice -+ -+static void end_previous_slice(dec_env_t * const de, const HEVCContext * const s, const int ctb_addr_ts) { -+ const HEVCPPS * const pps = s->ps.pps; -+ int last_x = pps->ctb_addr_ts_to_rs[ctb_addr_ts-1] % de->PicWidthInCtbsY; -+ int last_y = pps->ctb_addr_ts_to_rs[ctb_addr_ts-1] / de->PicWidthInCtbsY; -+ p1_apb_write(de, RPI_STATUS, 1 + (last_x<<5) + (last_y<<18)); -+} -+ -+static void wpp_pause(dec_env_t * const de, int ctb_row) { -+ p1_apb_write(de, RPI_STATUS, (ctb_row<<18) + 0x25); -+ p1_apb_write(de, RPI_TRANSFER, PROB_BACKUP); -+ p1_apb_write(de, RPI_MODE, ctb_row==de->PicHeightInCtbsY-1 ? 0x70000 : 0x30000); -+ p1_apb_write(de, RPI_CONTROL, (ctb_row<<16) + 2); -+} -+ -+static void wpp_end_previous_slice(dec_env_t * const de, const HEVCContext * const s, int ctb_addr_ts) { -+ const HEVCPPS *pps = s->ps.pps; -+ int new_x = s->sh.slice_ctb_addr_rs % de->PicWidthInCtbsY; -+ int new_y = s->sh.slice_ctb_addr_rs / de->PicWidthInCtbsY; -+ int last_x = pps->ctb_addr_ts_to_rs[ctb_addr_ts-1] % de->PicWidthInCtbsY; -+ int last_y = pps->ctb_addr_ts_to_rs[ctb_addr_ts-1] / de->PicWidthInCtbsY; -+ if (de->wpp_entry_x<2 && (de->wpp_entry_y2) && de->PicWidthInCtbsY>2) -+ wpp_pause(de, last_y); -+ p1_apb_write(de, RPI_STATUS, 1 + (last_x<<5) + (last_y<<18)); -+ if (new_x==2 || de->PicWidthInCtbsY==2 && de->wpp_entry_yps.sps; -+ const HEVCPPS *pps = s->ps.pps; -+ -+ p1_apb_write(de, RPI_SPS0, -+ (sps->log2_min_cb_size << 0) + -+ (sps->log2_ctb_size << 4) + -+ (sps->log2_min_tb_size << 8) + -+ (sps->log2_max_trafo_size << 12) + -+ (sps->bit_depth << 16) + -+ (sps->bit_depth << 20) + -+ (sps->max_transform_hierarchy_depth_intra << 24) + -+ (sps->max_transform_hierarchy_depth_inter << 28)); -+ -+ p1_apb_write(de, RPI_SPS1, -+ (sps->pcm.bit_depth << 0) + -+ (sps->pcm.bit_depth_chroma << 4) + -+ (sps->pcm.log2_min_pcm_cb_size << 8) + -+ (sps->pcm.log2_max_pcm_cb_size << 12) + -+ (sps->separate_colour_plane_flag? 0:sps->chroma_format_idc << 16) + -+ (sps->amp_enabled_flag << 18) + -+ (sps->pcm_enabled_flag << 19) + -+ (sps->scaling_list_enable_flag << 20) + -+ (sps->sps_strong_intra_smoothing_enable_flag << 21)); -+ -+ p1_apb_write(de, RPI_PPS, -+ (sps->log2_ctb_size - pps->diff_cu_qp_delta_depth << 0) + -+ (pps->cu_qp_delta_enabled_flag << 4) + -+ (pps->transquant_bypass_enable_flag << 5) + -+ (pps->transform_skip_enabled_flag << 6) + -+ (pps->sign_data_hiding_flag << 7) + -+ (((pps->cb_qp_offset + s->sh.slice_cb_qp_offset)&255) << 8) + -+ (((pps->cr_qp_offset + s->sh.slice_cr_qp_offset)&255) << 16) + -+ (pps->constrained_intra_pred_flag << 24)); -+ -+ if (s->ps.sps->scaling_list_enable_flag) WriteScalingFactors(de); -+ -+ if (!s->sh.dependent_slice_segment_flag) { -+ int ctb_col = s->sh.slice_ctb_addr_rs % de->PicWidthInCtbsY; -+ int ctb_row = s->sh.slice_ctb_addr_rs / de->PicWidthInCtbsY; -+ de->reg_slicestart = (ctb_col<<0) + (ctb_row<<16); -+ } -+ -+ p1_apb_write(de, RPI_SLICESTART, de->reg_slicestart); -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+static void write_slice(dec_env_t * const de, const HEVCContext * const s, -+ const unsigned int slice_w, const unsigned int slice_h) { -+ uint32_t u32 = -+ (s->sh.slice_type << 12) -+ + (s->sh.slice_sample_adaptive_offset_flag[0] << 14) -+ + (s->sh.slice_sample_adaptive_offset_flag[1] << 15) -+ + (slice_w << 17) -+ + (slice_h << 24); -+ -+ if (s->sh.slice_type==HEVC_SLICE_B || s->sh.slice_type==HEVC_SLICE_P) u32 |= -+ (s->sh.max_num_merge_cand << 0) -+ + (s->sh.nb_refs[L0] << 4) -+ + (s->sh.nb_refs[L1] << 8); -+ -+ if (s->sh.slice_type==HEVC_SLICE_B) -+ u32 |= s->sh.mvd_l1_zero_flag<<16; -+ p1_apb_write(de, RPI_SLICE, u32); -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Wavefront mode -+ -+static void wpp_entry_point(dec_env_t * const de, const HEVCContext * const s, -+ const int do_bte, const int resetQPY, const int ctb_addr_ts) { -+ const HEVCSPS * const sps = s->ps.sps; -+ const HEVCPPS * const pps = s->ps.pps; -+ -+ int ctb_size = 1<log2_ctb_size; -+ int ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts]; -+ -+ int ctb_col = de->wpp_entry_x = ctb_addr_rs % de->PicWidthInCtbsY; -+ int ctb_row = de->wpp_entry_y = ctb_addr_rs / de->PicWidthInCtbsY; -+ -+ int endx = de->PicWidthInCtbsY-1; -+ int endy = ctb_row; -+ -+ uint8_t slice_w = ctb_to_slice_w_h(ctb_col, ctb_size, sps->width, pps->col_bd, pps->num_tile_columns); -+ uint8_t slice_h = ctb_to_slice_w_h(ctb_row, ctb_size, sps->height, pps->row_bd, pps->num_tile_rows); -+ -+ p1_apb_write(de, RPI_TILESTART, 0); -+ p1_apb_write(de, RPI_TILEEND, endx + (endy<<16)); -+ -+ if (do_bte) -+ p1_apb_write(de, RPI_BEGINTILEEND, endx + (endy<<16)); -+ -+ write_slice(de, s, slice_w, ctb_row==de->PicHeightInCtbsY-1? slice_h : ctb_size); -+ -+ if (resetQPY) p1_apb_write(de, RPI_QP, sps->qp_bd_offset + s->sh.slice_qp); -+ -+ p1_apb_write(de, RPI_MODE, ctb_row==de->PicHeightInCtbsY-1? 0x60001 : 0x20001); -+ p1_apb_write(de, RPI_CONTROL, (ctb_col<<0) + (ctb_row<<16)); -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Tiles mode -+ -+static void new_entry_point(dec_env_t * const de, const HEVCContext * const s, -+ const int do_bte, const int resetQPY, const int ctb_addr_ts) { -+ const HEVCSPS * const sps = s->ps.sps; -+ const HEVCPPS * const pps = s->ps.pps; -+ -+ int ctb_col = pps->ctb_addr_ts_to_rs[ctb_addr_ts] % de->PicWidthInCtbsY; -+ int ctb_row = pps->ctb_addr_ts_to_rs[ctb_addr_ts] / de->PicWidthInCtbsY; -+ -+ int tile_x = ctb_to_tile (ctb_col, pps->col_bd, pps->num_tile_columns); -+ int tile_y = ctb_to_tile (ctb_row, pps->row_bd, pps->num_tile_rows); -+ -+ int endx = pps->col_bd[tile_x+1] - 1; -+ int endy = pps->row_bd[tile_y+1] - 1; -+ -+ uint8_t slice_w = ctb_to_slice_w_h(ctb_col, 1<log2_ctb_size, sps->width, pps->col_bd, pps->num_tile_columns); -+ uint8_t slice_h = ctb_to_slice_w_h(ctb_row, 1<log2_ctb_size, sps->height, pps->row_bd, pps->num_tile_rows); -+ -+ p1_apb_write(de, RPI_TILESTART, pps->col_bd[tile_x] + (pps->row_bd[tile_y]<<16)); -+ p1_apb_write(de, RPI_TILEEND, endx + (endy<<16)); -+ -+ if (do_bte) -+ p1_apb_write(de, RPI_BEGINTILEEND, endx + (endy<<16)); -+ -+ write_slice(de, s, slice_w, slice_h); -+ -+ if (resetQPY) -+ p1_apb_write(de, RPI_QP, sps->qp_bd_offset + s->sh.slice_qp); -+ -+ p1_apb_write(de, RPI_MODE, (0xFFFF << 0) -+ + (0x0 << 16) -+ + ((tile_x==pps->num_tile_columns-1) << 17) -+ + ((tile_y==pps->num_tile_rows-1) << 18)); -+ -+ p1_apb_write(de, RPI_CONTROL, (ctb_col<<0) + (ctb_row<<16)); -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+// Doesn't attempt to remove from context as we should only do this at the end -+// of time or on create error -+static void -+dec_env_delete(dec_env_t * const de) -+{ -+// gpu_free(&de->gbuf); -+ -+ av_freep(&de->cmd_fifo); -+ av_freep(&de->bit_fifo); -+ -+ sem_destroy(&de->phase_wait); -+ av_free(de); -+} -+ -+static dec_env_t * -+dec_env_new(AVCodecContext * const avctx, RPI_T * const rpi) -+{ -+ dec_env_t * const de = av_mallocz(sizeof(*de)); -+ int i; -+ -+ if (de == NULL) -+ return NULL; -+ -+ de->avctx = avctx; -+ de->phase_no = RPIVID_PHASE_NEW; -+ -+ sem_init(&de->phase_wait, 0, 0); -+ -+ if ((de->cmd_fifo = malloc((de->cmd_max=1024)*sizeof(struct RPI_CMD))) == NULL) -+ goto fail; -+ -+ if ((de->bit_fifo = malloc((de->bit_max=1024)*sizeof(struct RPI_BIT))) == NULL) -+ goto fail; -+ -+ pthread_mutex_lock(&rpi->phase_lock); // Abuse - not worth creating a lock just for this -+ for (i = 0; i != avctx->thread_count; ++i) { -+ if (rpi->dec_envs[i] == NULL) -+ { -+ rpi->dec_envs[i] = de; -+ break; -+ } -+ } -+ pthread_mutex_unlock(&rpi->phase_lock); -+ -+ if (i == avctx->thread_count) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to find a slot for hw thread context\n"); -+ goto fail; -+ } -+ -+ return de; -+ -+fail: -+ dec_env_delete(de); -+ return NULL; -+} -+ -+ -+static dec_env_t * -+dec_env_get(AVCodecContext * const avctx, RPI_T * const rpi) -+{ -+ dec_env_t * de = NULL; -+ const int ref_count = atomic_fetch_add(&rpi->ref_count, 1); -+ -+ if (ref_count <= 0) { -+ // Already dead -+ av_log(avctx, AV_LOG_ERROR, "RPIVID called whilst dead\n");; -+ return NULL; -+ } -+ -+ for (int i = 0; i != avctx->thread_count; ++i) { -+ if (rpi->dec_envs[i] == NULL) -+ { -+ de = dec_env_new(avctx, rpi); -+ break; -+ } -+ if (rpi->dec_envs[i]->avctx == avctx) -+ { -+ de = rpi->dec_envs[i]; -+ break; -+ } -+ } -+ return de; -+} -+ -+// Call at end of fn -+// Used to ensure we aren't in a worker thead when killed -+static void -+dec_env_release(RPI_T * const rpi, dec_env_t * const de) -+{ -+ const int n = atomic_fetch_sub(&rpi->ref_count, 1); -+ if (n == 1) { -+ sem_post(&rpi->ref_zero); -+ } -+} -+ -+//---------------------------------------------------------------------------- -+ -+// Wait for a slot in the given phase -+// Any error return is probably fatal -+static int -+wait_phase(RPI_T * const rpi, dec_env_t * const de, const int phase_no) -+{ -+ int needs_wait = 0; -+ phase_wait_env_t *const p = rpi->phase_reqs + phase_no; -+ -+ pthread_mutex_lock(&rpi->phase_lock); -+ if (p->last_order + 1 != de->decode_order) { -+ de->phase_wait_q_next = p->q; -+ p->q = de; -+ needs_wait = 1; -+ } -+ pthread_mutex_unlock(&rpi->phase_lock); -+ -+ if (needs_wait) { -+ while (sem_wait(&de->phase_wait) == -1) -+ { -+ int err; -+ if ((err = errno) != EINTR) -+ return AVERROR(err); -+ } -+ } -+ -+ de->phase_no = phase_no; -+ return 0; -+} -+ -+static void -+post_phase(RPI_T * const rpi, dec_env_t * const de, const int phase_no) -+{ -+ dec_env_t * next_de = NULL; -+ phase_wait_env_t *const p = rpi->phase_reqs + phase_no; -+ dec_env_t ** q = &p->q; -+ -+ pthread_mutex_lock(&rpi->phase_lock); -+ -+ p->last_order = de->decode_order; -+ while (*q != NULL) { -+ dec_env_t * const t_de = *q; -+ -+ if (t_de->decode_order == p->last_order + 1) { -+ // This is us - remove from Q -+ *q = t_de->phase_wait_q_next; -+ t_de->phase_wait_q_next = NULL; // Tidy -+ next_de = t_de; -+ break; -+ } -+ q = &t_de->phase_wait_q_next; -+ } -+ -+ pthread_mutex_unlock(&rpi->phase_lock); -+ -+ if (next_de != NULL) -+ sem_post(&next_de->phase_wait); -+} -+ -+// Wait & signal stuff s.t. threads in other phases can continue -+static void -+abort_phases(RPI_T * const rpi, dec_env_t * const de) -+{ -+ for (int i = de->phase_no + 1; i < RPIVID_PHASE_NEW; ++i) { -+ wait_phase(rpi, de, i); -+ post_phase(rpi, de, i); -+ } -+ de->phase_no = RPIVID_PHASE_NEW; -+} -+ -+// Start timing for phase -+// Stats only - no actual effect -+static inline void tstart_phase(RPI_T * const rpi, const int phase_no) -+{ -+#if OPT_PHASE_TIMING -+ phase_wait_env_t *const p = rpi->phase_reqs + phase_no; -+ const int64_t now = tus64(); -+ if (p->phase_time != 0) -+ p->time_out_phase += now - p->phase_time; -+ p->phase_time = now; -+#endif -+} -+ -+#if OPT_PHASE_TIMING -+static unsigned int tavg_bin_phase(phase_wait_env_t *const p, const unsigned int avg_n) -+{ -+ uint64_t tsum = 0; -+ unsigned int i; -+ for (i = 0; i != avg_n; ++i) -+ tsum += p->time_stash[(p->i3 - i) & 15]; -+ for (i = 0; i != 9; ++i) { -+ if (time_thresholds[i] * 1000 * avg_n > tsum) -+ break; -+ } -+ return i; -+} -+#endif -+ -+// End timing for phase -+// Stats only - no actual effect -+static inline void tend_phase(RPI_T * const rpi, const int phase_no) -+{ -+#if OPT_PHASE_TIMING -+ phase_wait_env_t *const p = rpi->phase_reqs + phase_no; -+ const uint64_t now = tus64(); -+ const uint64_t in_time = now - p->phase_time; -+ -+ p->time_in_phase += in_time; -+ p->phase_time = now; -+ p->time_stash[p->i3] = in_time; -+ if (in_time > p->max_phase_time) { -+ p->max_phase_time = in_time; -+ p->max_time_decode_order = p->last_order; -+ } -+ ++p->time_bins[tavg_bin_phase(p, 1)]; -+ ++p->time_bins3[tavg_bin_phase(p, 3)]; -+ ++p->time_bins5[tavg_bin_phase(p, 5)]; -+ -+ p->i3 = (p->i3 + 1) & 15; -+#endif -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Start frame -+ -+static int rpi_hevc_start_frame( -+ AVCodecContext * avctx, -+ const uint8_t *buffer, -+ uint32_t size) { -+ -+ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; -+ dec_env_t * const de = dec_env_get(avctx, rpi); -+ const HEVCContext * const s = avctx->priv_data; -+ const HEVCSPS * const sps = s->ps.sps; -+ const unsigned int CtbSizeY = 1U << sps->log2_ctb_size; -+ -+#if TRACE_ENTRY -+ printf("<<< %s[%p]\n", __func__, de); -+#endif -+ -+ if (de == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Cannot find find context for thread\n", __func__); -+ return -1; -+ } -+ -+ de->phase_no = RPIVID_PHASE_START; -+ de->decode_order = ++rpi->decode_order; // *** atomic? -+ -+ ff_thread_finish_setup(avctx); // Allow next thread to enter rpi_hevc_start_frame -+ -+ if (de->state != RPIVID_DECODE_NEW && de->state != RPIVID_DECODE_END) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected state transition: %d", __func__, de->state); -+ return -1; -+ } -+ de->state = RPIVID_DECODE_START; -+ -+ de->PicWidthInCtbsY = (sps->width + CtbSizeY - 1) / CtbSizeY; //7-15 -+ de->PicHeightInCtbsY = (sps->height + CtbSizeY - 1) / CtbSizeY; //7-17 -+ de->bit_len = 0; -+ de->cmd_len = 0; -+ -+#if TRACE_ENTRY -+ printf(">>> %s[%p]\n", __func__, de); -+#endif -+ -+ dec_env_release(rpi, de); -+ return 0; -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Slice messages -+ -+static void msg_slice(dec_env_t * const de, const uint16_t msg) { -+ de->slice_msgs[de->num_slice_msgs++] = msg; -+} -+ -+static void program_slicecmds(dec_env_t * const de, const int sliceid) { -+ int i; -+ p1_apb_write(de, RPI_SLICECMDS, de->num_slice_msgs+(sliceid<<8)); -+ for(i=0; i < de->num_slice_msgs; i++) { -+ p1_apb_write(de, 0x4000+4*i, de->slice_msgs[i] & 0xffff); -+ } -+} -+ -+static void pre_slice_decode(dec_env_t * const de, const HEVCContext * const s) { -+ const HEVCSPS * const sps = s->ps.sps; -+ const HEVCPPS * const pps = s->ps.pps; -+ const SliceHeader *sh = &s->sh; -+ -+ int weightedPredFlag, i, rIdx; -+ uint16_t cmd_slice; -+ unsigned int collocated_from_l0_flag; -+ -+ de->num_slice_msgs=0; -+ de->dpbno_col = 0; -+ cmd_slice = 0; -+ if (sh->slice_type==HEVC_SLICE_I) cmd_slice = 1; -+ if (sh->slice_type==HEVC_SLICE_P) cmd_slice = 2; -+ if (sh->slice_type==HEVC_SLICE_B) cmd_slice = 3; -+ -+ if (sh->slice_type!=HEVC_SLICE_I) { -+ cmd_slice += sh->nb_refs[L0]<<2; -+ cmd_slice += sh->nb_refs[L1]<<6; -+ } -+ -+ if (sh->slice_type==HEVC_SLICE_P || sh->slice_type==HEVC_SLICE_B) -+ cmd_slice |= sh->max_num_merge_cand<<11; -+ -+ collocated_from_l0_flag = -+ !sh->slice_temporal_mvp_enabled_flag ? -+ 0 : -+ sh->slice_type == HEVC_SLICE_B ? -+ (sh->collocated_list == L0) : -+ (sh->slice_type==HEVC_SLICE_P); -+ cmd_slice |= collocated_from_l0_flag<<14; -+ -+ if (sh->slice_type==HEVC_SLICE_P || sh->slice_type==HEVC_SLICE_B) { -+ -+ int NoBackwardPredFlag = 1; // Flag to say all reference pictures are from the past -+ for(i=L0; i<=L1; i++) { -+ for(rIdx=0; rIdx nb_refs[i]; rIdx++) { -+ HEVCFrame *f = s->ref->refPicList[i].ref[rIdx]; -+ HEVCFrame *c = s->ref; // CurrentPicture -+ if (c->poc < f->poc) NoBackwardPredFlag = 0; -+ } -+ } -+ -+ if (sps->sps_temporal_mvp_enabled_flag) -+ { -+ const RefPicList *rpl = (sh->slice_type != HEVC_SLICE_B || collocated_from_l0_flag) ? -+ s->ref->refPicList + 0 : -+ s->ref->refPicList + 1; -+ de->dpbno_col = rpl->ref[sh->collocated_ref_idx] - s->DPB; -+ } -+ -+ cmd_slice += NoBackwardPredFlag<<10; -+ msg_slice(de, cmd_slice); -+ -+ // Write reference picture descriptions -+ weightedPredFlag = sh->slice_type==HEVC_SLICE_P? pps->weighted_pred_flag : pps->weighted_bipred_flag; -+ -+ for(i=L0; i<=L1; i++) -+ for(rIdx=0; rIdx nb_refs[i]; rIdx++) { -+ HEVCFrame *f = s->ref->refPicList[i].ref[rIdx]; -+ HEVCFrame *c = s->ref; // CurrentPicture -+ int pic = f - s->DPB; -+ // Make sure pictures are in range 0 to 15 -+ int adjusted_pic = fref->refPicList[i].isLongTerm[rIdx]; -+ msg_slice(de, adjusted_pic+(lt<<4)+(weightedPredFlag<<5)+(weightedPredFlag<<6)); -+ msg_slice(de, f->poc); -+ if (weightedPredFlag) { -+ msg_slice(de, s->sh.luma_log2_weight_denom+(((i?s-> sh.luma_weight_l1: s->sh.luma_weight_l0)[rIdx] &0x1ff)<<3)); -+ msg_slice(de, (i?s-> sh.luma_offset_l1: s->sh.luma_offset_l0)[rIdx] & 0xff); -+ msg_slice(de, s->sh.chroma_log2_weight_denom+(((i?s->sh.chroma_weight_l1:s->sh.chroma_weight_l0)[rIdx][0]&0x1ff)<<3)); -+ msg_slice(de, (i?s->sh.chroma_offset_l1:s->sh.chroma_offset_l0)[rIdx][0]& 0xff); -+ msg_slice(de, s->sh.chroma_log2_weight_denom+(((i?s->sh.chroma_weight_l1:s->sh.chroma_weight_l0)[rIdx][1]&0x1ff)<<3)); -+ msg_slice(de, (i?s->sh.chroma_offset_l1:s->sh.chroma_offset_l0)[rIdx][1]& 0xff); -+ } -+ } -+ } -+ else -+ msg_slice(de, cmd_slice); -+ -+ msg_slice(de, ((sh->beta_offset/2)&15) -+ + (((sh->tc_offset/2)&15) << 4) -+ + (sh->disable_deblocking_filter_flag << 8) -+ + (sh->slice_loop_filter_across_slices_enabled_flag << 9) -+ + (pps->loop_filter_across_tiles_enabled_flag << 10)); // CMD_DEBLOCK -+ -+ msg_slice(de, ((sh->slice_cr_qp_offset&31)<<5) + (sh->slice_cb_qp_offset&31)); // CMD_QPOFF -+} -+ -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+static void rpi_hevc_abort_frame(AVCodecContext * const avctx) { -+ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; -+ dec_env_t * const de = dec_env_get(avctx, rpi); -+ -+#if TRACE_ENTRY -+ printf("<<< %s[%p]\n", __func__, de); -+#endif -+ -+ if (de == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Cannot find find context for thread\n", __func__); -+ return; -+ } -+ -+ switch (de->state) { -+ case RPIVID_DECODE_NEW: -+ case RPIVID_DECODE_END: -+ // Expected transition -+ break; -+ -+ case RPIVID_DECODE_SLICE: -+ // Error transition -+ av_log(avctx, AV_LOG_INFO, "Error in decode - aborting\n"); -+ break; -+ -+ case RPIVID_DECODE_START: -+ default: -+ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected state transition: %d", __func__, de->state); -+ break; -+ } -+ -+ abort_phases(rpi, de); -+ de->state = RPIVID_DECODE_NEW; -+ -+ dec_env_release(rpi, de); -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// End frame -+ -+static int rpi_hevc_end_frame(AVCodecContext * const avctx) { -+ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; -+ const HEVCContext * const s = avctx->priv_data; -+ const HEVCPPS * const pps = s->ps.pps; -+ const HEVCSPS * const sps = s->ps.sps; -+ dec_env_t * const de = dec_env_get(avctx, rpi); -+ AVFrame * const f = s->ref->frame; -+ const unsigned int dpbno_cur = s->ref - s->DPB; -+ vid_vc_addr_t cmds_vc; -+ vid_vc_addr_t pu_base_vc; -+ unsigned int pu_stride; -+ vid_vc_addr_t coeff_base_vc; -+ unsigned int coeff_stride; -+ unsigned int i; -+ int rv = 0; -+ int status = 0; -+ int coeffbuf_sem_claimed = 0; -+ -+#if TRACE_ENTRY -+ fprintf("<<< %s[%p]\n", __func__, de); -+#endif -+ -+ if (de == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Cannot find find context for thread\n", __func__); -+ return AVERROR_BUG; // Should never happen -+ } -+ -+ if (de->state != RPIVID_DECODE_SLICE) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected state: %d\n", __func__, de->state); -+ rv = AVERROR_UNKNOWN; -+ goto fail; -+ } -+ de->state = RPIVID_DECODE_END; -+ -+ // End of command compilation -+ { -+ const unsigned int last_x = pps->col_bd[pps->num_tile_columns]-1; -+ const unsigned int last_y = pps->row_bd[pps->num_tile_rows]-1; -+ if (pps->entropy_coding_sync_enabled_flag) { -+ if (de->wpp_entry_x<2 && de->PicWidthInCtbsY>2) -+ wpp_pause(de, last_y); -+ } -+ p1_apb_write(de, RPI_STATUS, 1 + (last_x<<5) + (last_y<<18)); -+ } -+ -+ // Phase 0 --------------------------------------------------------------- -+ -+ wait_phase(rpi, de, 0); -+ rpi_sem_wait(&rpi->bitbuf_sem); -+ tstart_phase(rpi, 0); -+ -+ // Copy cmds & bits into gpu side buffer -+ // Layout: CMDS, BITS -+ { -+ uint8_t * const armbase = rpi->gbitbufs[rpi->bitbuf_no].arm; -+ vid_vc_addr_t vcbase = rpi->gbitbufs[rpi->bitbuf_no].vc; -+ unsigned int cmd_bytes = de->cmd_len * sizeof(struct RPI_CMD); -+ -+ uint8_t * p = armbase + rnd64(cmd_bytes); -+ uint8_t * const eobits = armbase + rpi->gbitbufs[rpi->bitbuf_no].numbytes; -+ -+ cmds_vc = vcbase; -+ -+ // Copy all the bits & update bitstream cmds to point at the right bits -+ for (i = 0; i < de->bit_len; ++i) -+ { -+ const unsigned int seg_len = de->bit_fifo[i].len; -+ -+ if (p + seg_len > eobits) { -+ status = -1; -+ break; -+ } -+ -+ memcpy(p, de->bit_fifo[i].ptr, seg_len); -+ de->cmd_fifo[de->bit_fifo[i].cmd].data = MANGLE64((p - armbase) + vcbase); -+ -+ p += rnd64(seg_len); -+ } -+ -+ memcpy(armbase, de->cmd_fifo, cmd_bytes); -+ } -+ -+ if (status == 0) -+ { -+ if (++rpi->bitbuf_no >= RPIVID_BITBUFS) -+ rpi->bitbuf_no = 0; -+ } -+ else -+ { -+ sem_post(&rpi->bitbuf_sem); -+ av_log(avctx, AV_LOG_ERROR, "Out of HEVC bit/cmd memory\n"); -+ rv = AVERROR_BUFFER_TOO_SMALL; -+ } -+ -+ tend_phase(rpi, 0); -+ post_phase(rpi, de, 0); -+ -+ if (status < 0) -+ goto fail; -+ -+ // Phase 1 --------------------------------------------------------------- -+ -+ wait_phase(rpi, de, 1); -+ rpi_sem_wait(&rpi->coeffbuf_sem); -+ coeffbuf_sem_claimed = 1; -+ tstart_phase(rpi, 1); -+ -+ status = 0; -+ for (;;) -+ { -+ // (Re-)allocate PU/COEFF stream space -+ const unsigned int total_size = rpi->gcoeffbufs[rpi->coeffbuf_no].numbytes; -+ unsigned int pu_size; -+ -+ pu_base_vc = rpi->gcoeffbufs[rpi->coeffbuf_no].vc; -+ pu_stride = rnd64(rpi->max_pu_msgs * 2 * de->PicWidthInCtbsY); -+ pu_size = pu_stride * de->PicHeightInCtbsY; -+ -+ if (pu_size >= total_size || status == -1) { -+ GPU_MEM_PTR_T newbuf; -+ -+ if (gpu_malloc_uncached(round_up_size(total_size + 1), &newbuf) != 0) -+ { -+ av_log(avctx, AV_LOG_ERROR, "Failed to reallocate coeffbuf\n"); -+ status = -1; -+ break; -+ } -+ gpu_free(rpi->gcoeffbufs + rpi->coeffbuf_no); -+ rpi->gcoeffbufs[rpi->coeffbuf_no] = newbuf; -+ status = 0; -+ continue; -+ } -+ -+ // Allocate all remaining space to coeff -+ coeff_base_vc = pu_base_vc + pu_size; -+ coeff_stride = ((total_size - pu_size) / de->PicHeightInCtbsY) & ~63; // Round down to multiple of 64 -+ -+ apb_write_vc_addr(rpi, RPI_PUWBASE, pu_base_vc); -+ apb_write_vc_len(rpi, RPI_PUWSTRIDE, pu_stride); -+ apb_write_vc_addr(rpi, RPI_COEFFWBASE, coeff_base_vc); -+ apb_write_vc_len(rpi, RPI_COEFFWSTRIDE, coeff_stride); -+ -+ // Trigger command FIFO -+ apb_write(rpi, RPI_CFNUM, de->cmd_len); -+#if TRACE_DEV && 0 -+ apb_dump_regs(rpi, 0x0, 32); -+ apb_dump_regs(rpi, 0x8000, 24); -+ axi_dump(de, ((uint64_t)a64)<<6, de->cmd_len * sizeof(struct RPI_CMD)); -+#endif -+ apb_write_vc_addr(rpi, RPI_CFBASE, cmds_vc); -+ -+ int_wait(rpi, 1); -+ -+ status = check_status(rpi, de); -+ -+ if (status == -1) -+ continue; -+ else if (status != 1) -+ break; -+ -+ // Status 1 means out of PU space so try again with more -+ // If we ran out of Coeff space then we are out of memory - we could possibly realloc? -+ rpi->max_pu_msgs += rpi->max_pu_msgs / 2; -+ } -+ -+ // Inc inside the phase 1 lock, but only inc if we succeeded otherwise we -+ // may reuse a live buffer when we kick the coeff sem -+ if (status == 0) -+ { -+ if (++rpi->coeffbuf_no >= RPIVID_COEFFBUFS) -+ rpi->coeffbuf_no = 0; -+ } -+ else -+ { -+ if (status == -1) -+ { -+ av_log(avctx, AV_LOG_ERROR, "Out of pu + coeff intermediate memory: pus=%d\n", rpi->max_pu_msgs); -+ rv = AVERROR_BUFFER_TOO_SMALL; -+ } -+ else -+ { -+ av_log(avctx, AV_LOG_WARNING, "Phase 1 decode error\n"); -+ rv = AVERROR_INVALIDDATA; -+ } -+ } -+ -+ tend_phase(rpi, 1); -+ sem_post(&rpi->bitbuf_sem); -+ post_phase(rpi, de, 1); -+ -+ if (status != 0) -+ goto fail; -+ -+ // Phase 2 --------------------------------------------------------------- -+ -+ wait_phase(rpi, de, 2); -+ -+ if ((rv = av_rpi_zc_resolve_frame(f, ZC_RESOLVE_ALLOC)) != 0) -+ { -+ // As we are in phase 2 already here we don't need to worry about -+ // ceoffbuf_no despite the early exit -+ post_phase(rpi, de, 2); -+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate output frame\n"); -+ goto fail; -+ } -+ -+ tstart_phase(rpi, 2); -+ -+ apb_write_vc_addr(rpi, RPI_PURBASE, pu_base_vc); -+ apb_write_vc_len(rpi, RPI_PURSTRIDE, pu_stride); -+ apb_write_vc_addr(rpi, RPI_COEFFRBASE, coeff_base_vc); -+ apb_write_vc_len(rpi, RPI_COEFFRSTRIDE, coeff_stride); -+ -+ apb_write_vc_addr(rpi, RPI_OUTYBASE, get_vc_address_y(f)); -+ apb_write_vc_addr(rpi, RPI_OUTCBASE, get_vc_address_u(f)); -+ apb_write_vc_len(rpi, RPI_OUTYSTRIDE, f->linesize[3] * 128); -+ apb_write_vc_len(rpi, RPI_OUTCSTRIDE, f->linesize[3] * 128); -+ -+ // Keep the last thing we resolved as fallback for any ref we fail to -+ // resolve. As a final fallback use our current frame. The pels might -+ // not be there yet but at least the memory is valid. -+ // -+ // Attempt to resolve the entire DPB - we could note what we have used -+ // in ref lists but probably simpler and more reliable to set the whole thing -+ { -+ AVFrame * fallback_frame = f; -+ for (i = 0; i != 16; ++i) { -+ // Avoid current frame -+ const HEVCFrame * hevc_fr = (s->DPB + i >= s->ref) ? s->DPB + i + 1 : s->DPB + i; -+ AVFrame * fr = hevc_fr->frame; -+ -+ if (fr != NULL && -+ av_rpi_zc_resolve_frame(fr, ZC_RESOLVE_FAIL) == 0) -+ { -+ fallback_frame = fr; -+ } -+ else -+ { -+ fr = fallback_frame; -+ } -+ -+ apb_write_vc_addr(rpi, 0x9000+16*i, get_vc_address_y(fr)); -+ apb_write(rpi, 0x9004+16*i, 0); -+ apb_write_vc_addr(rpi, 0x9008+16*i, get_vc_address_u(fr)); -+ apb_write(rpi, 0x900C+16*i, 0); -+ } -+ } -+ -+ apb_write(rpi, RPI_CONFIG2, -+ (sps->bit_depth << 0) // BitDepthY -+ + (sps->bit_depth << 4) // BitDepthC -+ + ((sps->bit_depth>8) << 8) // BitDepthY -+ + ((sps->bit_depth>8) << 9) // BitDepthC -+ + (sps->log2_ctb_size <<10) -+ + (pps->constrained_intra_pred_flag <<13) -+ + (sps->sps_strong_intra_smoothing_enable_flag<<14) -+ + (sps->sps_temporal_mvp_enabled_flag <<15) -+ + (pps->log2_parallel_merge_level <<16) -+ + (s->sh.slice_temporal_mvp_enabled_flag <<19) -+ + (sps->pcm.loop_filter_disable_flag <<20) -+ + ((pps->cb_qp_offset&31) <<21) -+ + ((pps->cr_qp_offset&31) <<26)); -+ -+ apb_write(rpi, RPI_FRAMESIZE, (sps->height<<16) + sps->width); -+ apb_write(rpi, RPI_CURRPOC, s->poc); -+ -+ // collocated reads/writes -+ if (sps->sps_temporal_mvp_enabled_flag) { -+ av_assert0(de->dpbno_col < RPIVID_COL_PICS); -+ av_assert0(dpbno_cur < RPIVID_COL_PICS); -+ -+ apb_write_vc_len(rpi, RPI_COLSTRIDE, rpi->col_stride); -+ apb_write_vc_len(rpi, RPI_MVSTRIDE, rpi->col_stride); -+ apb_write_vc_addr(rpi, RPI_MVBASE, rpi->gcolbuf.vc + dpbno_cur * rpi->col_picsize); -+ apb_write_vc_addr(rpi, RPI_COLBASE, rpi->gcolbuf.vc + de->dpbno_col * rpi->col_picsize); -+ } -+ -+#if TRACE_DEV && 0 -+ apb_dump_regs(rpi, 0x0, 32); -+ apb_dump_regs(rpi, 0x8000, 24); -+#endif -+ -+ apb_write(rpi, RPI_NUMROWS, de->PicHeightInCtbsY); -+ apb_read(rpi, RPI_NUMROWS); // Read back to confirm write has reached block -+ -+ int_wait(rpi, 2); -+ -+ tend_phase(rpi, 2); -+ coeffbuf_sem_claimed = 0; -+ sem_post(&rpi->coeffbuf_sem); -+ // Set valid here to avoid race in resolving in any pending phase 2 -+ av_rpi_zc_set_valid_frame(f); -+ -+ post_phase(rpi, de, 2); -+ -+ // Flush frame for CPU access -+ // Arguably the best place would be at the start of phase 2 but here -+ // will overlap with the wait -+ // -+ // * Even better would be to have better lock/unlock control in ZC for external access -+ if (rpi->gpu_init_type == GPU_INIT_GPU) // * CMA is currently always uncached -+ { -+ rpi_cache_buf_t cbuf; -+ rpi_cache_flush_env_t * const fe = rpi_cache_flush_init(&cbuf); -+ rpi_cache_flush_add_frame(fe, f, RPI_CACHE_FLUSH_MODE_INVALIDATE); -+ rpi_cache_flush_finish(fe); -+ } -+ -+#if TRACE_ENTRY -+ printf(">>> %s[%p] OK\n", __func__, de); -+#endif -+ -+ dec_env_release(rpi, de); -+ return 0; -+ -+fail: -+ av_rpi_zc_set_broken_frame(f); -+ if (coeffbuf_sem_claimed) -+ sem_post(&rpi->coeffbuf_sem); -+ abort_phases(rpi, de); // Dummy any unresolved phases -+ -+#if TRACE_ENTRY -+ printf(">>> %s[%p] FAIL\n", __func__, de); -+#endif -+ -+ dec_env_release(rpi, de); -+ return rv; -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+ -+#if TRACE_DEV -+static void dump_data(const uint8_t * p, size_t len) -+{ -+ size_t i; -+ for (i = 0; i < len; i += 16) { -+ size_t j; -+ printf("%04x", i); -+ for (j = 0; j != 16; ++j) { -+ printf("%c%02x", i == 8 ? '-' : ' ', p[i+j]); -+ } -+ printf("\n"); -+ } -+} -+#endif -+ -+#if OPT_EMU -+static const uint8_t * ptr_from_index(const uint8_t * b, unsigned int idx) -+{ -+ unsigned int z = 0; -+ while (idx--) { -+ if (*b++ == 0) { -+ ++z; -+ if (z >= 2 && *b == 3) { -+ ++b; -+ z = 0; -+ } -+ } -+ else { -+ z = 0; -+ } -+ } -+ return b; -+} -+#endif -+ -+static void WriteBitstream(dec_env_t * const de, const HEVCContext * const s) { -+ const int rpi_use_emu = OPT_EMU; // FFmpeg removes emulation prevention bytes -+ const int offset = 0; // Always 64-byte aligned in sim, need not be on real hardware -+ const GetBitContext *gb = &s->HEVClc->gb; -+ -+#if OPT_EMU -+ const uint8_t *ptr = ptr_from_index(de->nal_buffer, gb->index/8 + 1); -+ const int len = de->nal_size - (ptr - de->nal_buffer); -+#else -+ const int len = 1 + gb->size_in_bits/8 - gb->index/8; -+ const void *ptr = &gb->buffer[gb->index/8]; -+#endif -+ -+#if TRACE_DEV -+ printf("Index=%d, /8=%#x\n", gb->index, gb->index/8); -+ dump_data(de->nal_buffer, 128); -+#endif -+ -+ p1_axi_write(de, len, ptr, p1_apb_write(de, RPI_BFBASE, 0)); // BFBASE set later -+ p1_apb_write(de, RPI_BFNUM, len); -+ p1_apb_write(de, RPI_BFCONTROL, offset + (1<<7)); // Stop -+ p1_apb_write(de, RPI_BFCONTROL, offset + (rpi_use_emu<<6)); -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Wavefront mode -+ -+static void wpp_decode_slice(dec_env_t * const de, const HEVCContext * const s, int ctb_addr_ts) -+{ -+ const HEVCPPS * const pps = s->ps.pps; -+ -+ int i, resetQPY=1; -+ int indep = !s->sh.dependent_slice_segment_flag; -+ int ctb_col = s->sh.slice_ctb_addr_rs % de->PicWidthInCtbsY; -+ -+ if (ctb_addr_ts) -+ wpp_end_previous_slice(de, s, ctb_addr_ts); -+ pre_slice_decode(de, s); -+ WriteBitstream(de, s); -+ if (ctb_addr_ts==0 || indep || de->PicWidthInCtbsY==1) -+ WriteProb(de, s); -+ else if (ctb_col==0) -+ p1_apb_write(de, RPI_TRANSFER, PROB_RELOAD); -+ else -+ resetQPY=0; -+ program_slicecmds(de, s->slice_idx); -+ new_slice_segment(de, s); -+ wpp_entry_point(de, s, indep, resetQPY, ctb_addr_ts); -+ for (i=0; ish.num_entry_point_offsets; i++) { -+ int ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts]; -+ int ctb_row = ctb_addr_rs / de->PicWidthInCtbsY; -+ int last_x = de->PicWidthInCtbsY-1; -+ if (de->PicWidthInCtbsY>2) -+ wpp_pause(de, ctb_row); -+ p1_apb_write(de, RPI_STATUS, (ctb_row<<18) + (last_x<<5) + 2); -+ if (de->PicWidthInCtbsY==2) -+ p1_apb_write(de, RPI_TRANSFER, PROB_BACKUP); -+ if (de->PicWidthInCtbsY==1) -+ WriteProb(de, s); -+ else -+ p1_apb_write(de, RPI_TRANSFER, PROB_RELOAD); -+ ctb_addr_ts += pps->column_width[0]; -+ wpp_entry_point(de, s, 0, 1, ctb_addr_ts); -+ } -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+// Tiles mode -+ -+static void decode_slice(dec_env_t * const de, const HEVCContext * const s, int ctb_addr_ts) { -+ const HEVCPPS * const pps = s->ps.pps; -+ int i, resetQPY; -+ -+ if (ctb_addr_ts) end_previous_slice(de, s, ctb_addr_ts); -+ pre_slice_decode(de, s); -+ WriteBitstream(de, s); -+ resetQPY = ctb_addr_ts==0 -+ || pps->tile_id[ctb_addr_ts]!=pps->tile_id[ctb_addr_ts-1] -+ || !s->sh.dependent_slice_segment_flag; -+ if (resetQPY) WriteProb(de, s); -+ program_slicecmds(de, s->slice_idx); -+ new_slice_segment(de, s); -+ new_entry_point(de, s, !s->sh.dependent_slice_segment_flag, resetQPY, ctb_addr_ts); -+ for (i=0; ish.num_entry_point_offsets; i++) { -+ int ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts]; -+ int ctb_col = ctb_addr_rs % de->PicWidthInCtbsY; -+ int ctb_row = ctb_addr_rs / de->PicWidthInCtbsY; -+ int tile_x = ctb_to_tile (ctb_col, pps->col_bd, pps->num_tile_columns); -+ int tile_y = ctb_to_tile (ctb_row, pps->row_bd, pps->num_tile_rows); -+ int last_x = pps->col_bd[tile_x+1]-1; -+ int last_y = pps->row_bd[tile_y+1]-1; -+ p1_apb_write(de, RPI_STATUS, 2 + (last_x<<5) + (last_y<<18)); -+ WriteProb(de, s); -+ ctb_addr_ts += pps->column_width[tile_x] * pps->row_height[tile_y]; -+ new_entry_point(de, s, 0, 1, ctb_addr_ts); -+ } -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+static int cabac_start_align(HEVCContext *s) -+{ -+ GetBitContext *gb = &s->HEVClc->gb; -+ skip_bits(gb, 1); -+ align_get_bits(gb); -+ // Should look at getting rid of this -+ return ff_init_cabac_decoder(&s->HEVClc->cc, -+ gb->buffer + get_bits_count(gb) / 8, -+ (get_bits_left(gb) + 7) / 8); -+} -+ -+static int rpi_hevc_decode_slice( -+ AVCodecContext *avctx, -+ const uint8_t *buffer, -+ uint32_t size) -+{ -+ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; -+ HEVCContext * const s = avctx->priv_data; -+ dec_env_t * const de = dec_env_get(avctx, rpi); -+ const HEVCPPS *pps = s->ps.pps; -+ int ctb_addr_ts = pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; -+ -+#if TRACE_ENTRY -+ printf("<<< %s[%p]\n", __func__, de); -+#endif -+ if (de == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Cannot find find context for thread\n", __func__); -+ return -1; -+ } -+ -+ if (de->state != RPIVID_DECODE_START && de->state != RPIVID_DECODE_SLICE) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected state: %d\n", __func__, de->state); -+ return -1; -+ } -+ de->state = RPIVID_DECODE_SLICE; -+ -+ de->nal_buffer = buffer; -+ de->nal_size = size; -+ -+#if !OPT_EMU -+// ff_hevc_cabac_init(s, ctb_addr_ts); -+ cabac_start_align(s); -+#endif -+ if (s->ps.sps->scaling_list_enable_flag) -+ populate_scaling_factors(de, s); -+ pps->entropy_coding_sync_enabled_flag? wpp_decode_slice(de, s, ctb_addr_ts) -+ : decode_slice(de, s, ctb_addr_ts); -+#if TRACE_ENTRY -+ printf(">>> %s[%p]\n", __func__, de); -+#endif -+ dec_env_release(rpi, de); -+ return 0; -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+static int rpivid_retrieve_data(void *logctx, AVFrame *frame) -+{ -+ int rv; -+ if ((rv = av_rpi_zc_resolve_frame(frame, ZC_RESOLVE_WAIT_VALID)) != 0) -+ av_log(logctx, AV_LOG_ERROR, "Unable to resolve output frame\n"); -+ return rv; -+} -+ -+static int rpivid_hevc_alloc_frame(AVCodecContext * avctx, AVFrame *frame) -+{ -+ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; -+ HEVCContext * const s = avctx->priv_data; -+ // Frame buffering + 1 output. Would need thread_count extra but we now -+ // alloc at the start of phase 2 so that is the only thread we need the -+ // extra buffer for. -+ const unsigned int pool_req = s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].max_dec_pic_buffering + 1; -+ int rv; -+ -+ if (av_rpi_zc_in_use(avctx)) -+ { -+ const AVZcEnvPtr zc = avctx->opaque; -+ av_rpi_zc_set_decoder_pool_size(zc, pool_req); -+ rv = av_rpi_zc_get_buffer(zc, frame); // get_buffer2 would alloc -+ } -+ else -+ { -+ if (rpi->zc == NULL) { -+ pthread_mutex_lock(&rpi->phase_lock); // Abuse - not worth creating a lock just for this -+ // Alloc inside lock to make sure we only ever alloc one -+ if (rpi->zc == NULL) { -+ rpi->zc = av_rpi_zc_int_env_alloc(s); -+ } -+ pthread_mutex_unlock(&rpi->phase_lock); -+ } -+ av_rpi_zc_set_decoder_pool_size(rpi->zc, pool_req); // Ignored by local allocator, but set anyway :-) -+ rv = (rpi->zc == NULL) ? AVERROR(ENOMEM) : -+ av_rpi_zc_get_buffer(rpi->zc, frame); -+ } -+ -+ if (rv == 0 && -+ (rv = ff_attach_decode_data(frame)) < 0) -+ { -+ av_frame_unref(frame); -+ } -+ -+ if (rv == 0) -+ { -+ FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data; -+ fdd->post_process = rpivid_retrieve_data; -+ } -+ -+ return rv; -+} -+ -+#if OPT_PHASE_TIMING -+static void log_bin_phase(AVCodecContext * const avctx, const unsigned int * const bins) -+{ -+ av_log(avctx, AV_LOG_INFO, "%7d %7d %7d %7d %7d %7d %7d %7d %7d\n", -+ bins[0], bins[1], bins[2], bins[3], -+ bins[4], bins[5], bins[6], bins[7], bins[8]); -+} -+#endif -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+static int rpi_hevc_free(AVCodecContext *avctx) { -+ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; -+ -+#if TRACE_ENTRY -+ printf("<<< %s\n", __func__); -+#endif -+ -+ dec_env_release(rpi, NULL); -+ -+ // Wait for everything else to stop -+ { -+ struct timespec tt; -+ clock_gettime(CLOCK_REALTIME, &tt); -+ tt.tv_sec += 2; -+ while (sem_timedwait(&rpi->ref_zero, &tt) == -1) { -+ const int err = errno; -+ if (err == ETIMEDOUT) { -+ av_log(avctx, AV_LOG_FATAL, "Rpivid worker threads still running\n"); -+ return -1; -+ } -+ if (err != EINTR) { -+ av_log(avctx, AV_LOG_ERROR, "Unexpected error %d waiting for work thread to stop\n", err); -+ break; -+ } -+ } -+ } -+ -+#if OPT_PHASE_TIMING -+ { -+ unsigned int i; -+ for (i = 0; i != RPIVID_PHASES; ++i) { -+ const phase_wait_env_t * const p = rpi->phase_reqs + i; -+ av_log(avctx, AV_LOG_INFO, "Phase %u: In %3u.%06u, Out %3u.%06u\n", i, -+ (unsigned int)(p->time_in_phase / 1000000), (unsigned int)(p->time_in_phase % 1000000), -+ (unsigned int)(p->time_out_phase / 1000000), (unsigned int)(p->time_out_phase % 1000000)); -+ av_log(avctx, AV_LOG_INFO, "%7d %7d %7d %7d %7d %7d %7d %7d >\n", -+ time_thresholds[0], time_thresholds[1], time_thresholds[2], time_thresholds[3], -+ time_thresholds[4], time_thresholds[5], time_thresholds[6], time_thresholds[7]); -+ log_bin_phase(avctx, p->time_bins); -+ log_bin_phase(avctx, p->time_bins3); -+ log_bin_phase(avctx, p->time_bins5); -+ av_log(avctx, AV_LOG_INFO, "Longest duraction: %ums @ frame %u\n", -+ (unsigned int)(p->max_phase_time / 1000), -+ p->max_time_decode_order); -+ } -+ av_log(avctx, AV_LOG_INFO, "PU max=%d\n", rpi->max_pu_msgs); -+ } -+#endif -+ -+ if (rpi->dec_envs != NULL) -+ { -+ for (int i; i < avctx->thread_count && rpi->dec_envs[i] != NULL; ++i) { -+ dec_env_delete(rpi->dec_envs[i]); -+ } -+ av_freep(&rpi->dec_envs); -+ } -+ -+ av_rpi_zc_int_env_freep(&rpi->zc); -+ -+ gpu_free(&rpi->gcolbuf); -+ -+ for (unsigned int i = 0; i != RPIVID_BITBUFS; ++i) { -+ gpu_free(rpi->gbitbufs + i); -+ } -+ for (unsigned int i = 0; i != RPIVID_COEFFBUFS; ++i) { -+ gpu_free(rpi->gcoeffbufs + i); -+ } -+ -+ unmap_devp(&rpi->regs, REGS_SIZE); -+ unmap_devp(&rpi->ints, INTS_SIZE); -+ -+ if (rpi->gpu_init_type > 0) -+ rpi_mem_gpu_uninit(); -+ -+ if (rpi->mbox_fd >= 0) { -+ mbox_release_clock(rpi->mbox_fd); -+ mbox_close(rpi->mbox_fd); -+ } -+ -+ sem_destroy(&rpi->ref_zero); -+ sem_destroy(&rpi->coeffbuf_sem); -+ sem_destroy(&rpi->bitbuf_sem); -+ -+#if TRACE_ENTRY -+ printf(">>> %s\n", __func__); -+#endif -+ return 0; -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+static int rpi_hevc_init(AVCodecContext *avctx) { -+ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; -+// const char *err; -+ -+#if TRACE_ENTRY -+ printf("<<< %s\n", __func__); -+#endif -+ -+ if (avctx->width>4096 || avctx->height>4096) { -+ av_log(NULL, AV_LOG_FATAL, "Picture size %dx%d exceeds 4096x4096 maximum for HWAccel\n", avctx->width, avctx->height); -+ return AVERROR(ENOTSUP); -+ } -+ -+ memset(rpi, 0, sizeof(*rpi)); -+ -+ rpi->mbox_fd = -1; -+ rpi->decode_order = 0; -+ -+ // Initial PU/COEFF stream buffer split chosen as worst case seen so far -+ rpi->max_pu_msgs = 768; // 7.2 says at most 1611 messages per CTU -+ -+ -+ atomic_store(&rpi->ref_count, 1); -+ sem_init(&rpi->ref_zero, 0, 0); -+ -+ sem_init(&rpi->bitbuf_sem, 0, RPIVID_BITBUFS); -+ sem_init(&rpi->coeffbuf_sem, 0, RPIVID_COEFFBUFS); -+ -+ pthread_mutex_init(&rpi->phase_lock, NULL); -+ -+ if ((rpi->mbox_fd = mbox_open()) < 0) -+ { -+ av_log(avctx, AV_LOG_ERROR, "Failed to open mailbox\n"); -+ goto fail; -+ } -+ mbox_request_clock(rpi->mbox_fd); -+ -+ if ((rpi->regs = map_dev(avctx, REGS_NAME, REGS_SIZE)) == NULL || -+ (rpi->ints = map_dev(avctx, INTS_NAME, INTS_SIZE)) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to open rpivid devices\n"); -+ goto fail; -+ } -+ -+ if ((rpi->gpu_init_type = rpi_mem_gpu_init(0)) < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to init GPU\n"); -+ goto fail; -+ } -+ -+ if ((rpi->dec_envs = av_mallocz(sizeof(dec_env_t *) * avctx->thread_count)) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to alloc %d dec envs\n", avctx->thread_count); -+ goto fail; -+ } -+ -+ rpi->col_stride = rnd64(avctx->width); -+ rpi->col_picsize = rpi->col_stride * (((avctx->height + 63) & ~63) >> 4); -+ if (gpu_malloc_uncached(rpi->col_picsize * RPIVID_COL_PICS, &rpi->gcolbuf) != 0) -+ { -+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate col mv buffer\n"); -+ goto fail; -+ } -+ -+ for (unsigned int i = 0; i != RPIVID_BITBUFS; ++i) { -+ if (gpu_malloc_uncached(RPIVID_BITBUF_SIZE, rpi->gbitbufs + i) != 0) -+ { -+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate bitbuf %d\n", i); -+ goto fail; -+ } -+ } -+ -+ for (unsigned int i = 0; i != RPIVID_COEFFBUFS; ++i) { -+ if (gpu_malloc_uncached(RPIVID_COEFFBUF_SIZE, rpi->gcoeffbufs + i) != 0) -+ { -+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate coeffbuf %d\n", i); -+ goto fail; -+ } -+ } -+ -+ av_log(avctx, AV_LOG_INFO, "RPI HEVC h/w accel init OK\n"); -+ -+ return 0; -+ -+fail: -+ rpi_hevc_free(avctx); -+ return AVERROR_EXTERNAL; -+} -+ -+////////////////////////////////////////////////////////////////////////////// -+ -+const AVHWAccel ff_hevc_rpi4_8_hwaccel = { -+ .name = "hevc_rpi4_8", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = AV_CODEC_ID_HEVC, -+ .pix_fmt = AV_PIX_FMT_RPI4_8, -+ .alloc_frame = rpivid_hevc_alloc_frame, -+ .start_frame = rpi_hevc_start_frame, -+ .end_frame = rpi_hevc_end_frame, -+ .abort_frame = rpi_hevc_abort_frame, -+ .decode_slice = rpi_hevc_decode_slice, -+ .init = rpi_hevc_init, -+ .uninit = rpi_hevc_free, -+ .priv_data_size = sizeof(RPI_T), -+ .caps_internal = HWACCEL_CAP_ASYNC_SAFE | HWACCEL_CAP_MT_SAFE, -+}; -+ -+const AVHWAccel ff_hevc_rpi4_10_hwaccel = { -+ .name = "hevc_rpi4_10", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = AV_CODEC_ID_HEVC, -+ .pix_fmt = AV_PIX_FMT_RPI4_10, -+ .alloc_frame = rpivid_hevc_alloc_frame, -+ .start_frame = rpi_hevc_start_frame, -+ .end_frame = rpi_hevc_end_frame, -+ .abort_frame = rpi_hevc_abort_frame, -+ .decode_slice = rpi_hevc_decode_slice, -+ .init = rpi_hevc_init, -+ .uninit = rpi_hevc_free, -+ .priv_data_size = sizeof(RPI_T), -+ .caps_internal = HWACCEL_CAP_ASYNC_SAFE | HWACCEL_CAP_MT_SAFE, -+}; -+ ---- a/libavcodec/v4l2_buffers.c -+++ b/libavcodec/v4l2_buffers.c -@@ -21,6 +21,7 @@ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+#include - #include - #include - #include -@@ -30,12 +31,14 @@ - #include "libavcodec/avcodec.h" - #include "libavcodec/internal.h" - #include "libavutil/pixdesc.h" -+#include "libavutil/hwcontext.h" - #include "v4l2_context.h" - #include "v4l2_buffers.h" - #include "v4l2_m2m.h" -+#include "weak_link.h" - - #define USEC_PER_SEC 1000000 --static AVRational v4l2_timebase = { 1, USEC_PER_SEC }; -+static const AVRational v4l2_timebase = { 1, USEC_PER_SEC }; - - static inline V4L2m2mContext *buf_to_m2mctx(V4L2Buffer *buf) - { -@@ -52,34 +55,44 @@ static inline AVCodecContext *logger(V4L - static inline AVRational v4l2_get_timebase(V4L2Buffer *avbuf) - { - V4L2m2mContext *s = buf_to_m2mctx(avbuf); -- -- if (s->avctx->pkt_timebase.num) -- return s->avctx->pkt_timebase; -- return s->avctx->time_base; -+ const AVRational tb = s->avctx->pkt_timebase.num ? -+ s->avctx->pkt_timebase : -+ s->avctx->time_base; -+ return tb.num && tb.den ? tb : v4l2_timebase; - } - --static inline void v4l2_set_pts(V4L2Buffer *out, int64_t pts) -+static inline void v4l2_set_pts(V4L2Buffer *out, int64_t pts, int no_rescale) - { -- int64_t v4l2_pts; -- -- if (pts == AV_NOPTS_VALUE) -- pts = 0; -- - /* convert pts to v4l2 timebase */ -- v4l2_pts = av_rescale_q(pts, v4l2_get_timebase(out), v4l2_timebase); -+ const int64_t v4l2_pts = -+ no_rescale ? pts : -+ pts == AV_NOPTS_VALUE ? 0 : -+ av_rescale_q(pts, v4l2_get_timebase(out), v4l2_timebase); - out->buf.timestamp.tv_usec = v4l2_pts % USEC_PER_SEC; - out->buf.timestamp.tv_sec = v4l2_pts / USEC_PER_SEC; - } - --static inline int64_t v4l2_get_pts(V4L2Buffer *avbuf) -+static inline int64_t v4l2_get_pts(V4L2Buffer *avbuf, int no_rescale) - { -- int64_t v4l2_pts; -- - /* convert pts back to encoder timebase */ -- v4l2_pts = (int64_t)avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + -+ const int64_t v4l2_pts = (int64_t)avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + - avbuf->buf.timestamp.tv_usec; - -- return av_rescale_q(v4l2_pts, v4l2_timebase, v4l2_get_timebase(avbuf)); -+ return -+ no_rescale ? v4l2_pts : -+ v4l2_pts == 0 ? AV_NOPTS_VALUE : -+ av_rescale_q(v4l2_pts, v4l2_timebase, v4l2_get_timebase(avbuf)); -+} -+ -+static void set_buf_length(V4L2Buffer *out, unsigned int plane, uint32_t bytesused, uint32_t length) -+{ -+ if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { -+ out->planes[plane].bytesused = bytesused; -+ out->planes[plane].length = length; -+ } else { -+ out->buf.bytesused = bytesused; -+ out->buf.length = length; -+ } - } - - static enum AVColorPrimaries v4l2_get_color_primaries(V4L2Buffer *buf) -@@ -116,6 +129,105 @@ static enum AVColorPrimaries v4l2_get_co - return AVCOL_PRI_UNSPECIFIED; - } - -+static void v4l2_set_color(V4L2Buffer *buf, -+ const enum AVColorPrimaries avcp, -+ const enum AVColorSpace avcs, -+ const enum AVColorTransferCharacteristic avxc) -+{ -+ enum v4l2_ycbcr_encoding ycbcr = V4L2_YCBCR_ENC_DEFAULT; -+ enum v4l2_colorspace cs = V4L2_COLORSPACE_DEFAULT; -+ enum v4l2_xfer_func xfer = V4L2_XFER_FUNC_DEFAULT; -+ -+ switch (avcp) { -+ case AVCOL_PRI_BT709: -+ cs = V4L2_COLORSPACE_REC709; -+ ycbcr = V4L2_YCBCR_ENC_709; -+ break; -+ case AVCOL_PRI_BT470M: -+ cs = V4L2_COLORSPACE_470_SYSTEM_M; -+ ycbcr = V4L2_YCBCR_ENC_601; -+ break; -+ case AVCOL_PRI_BT470BG: -+ cs = V4L2_COLORSPACE_470_SYSTEM_BG; -+ break; -+ case AVCOL_PRI_SMPTE170M: -+ cs = V4L2_COLORSPACE_SMPTE170M; -+ break; -+ case AVCOL_PRI_SMPTE240M: -+ cs = V4L2_COLORSPACE_SMPTE240M; -+ break; -+ case AVCOL_PRI_BT2020: -+ cs = V4L2_COLORSPACE_BT2020; -+ break; -+ case AVCOL_PRI_SMPTE428: -+ case AVCOL_PRI_SMPTE431: -+ case AVCOL_PRI_SMPTE432: -+ case AVCOL_PRI_EBU3213: -+ case AVCOL_PRI_RESERVED: -+ case AVCOL_PRI_FILM: -+ case AVCOL_PRI_UNSPECIFIED: -+ default: -+ break; -+ } -+ -+ switch (avcs) { -+ case AVCOL_SPC_RGB: -+ cs = V4L2_COLORSPACE_SRGB; -+ break; -+ case AVCOL_SPC_BT709: -+ cs = V4L2_COLORSPACE_REC709; -+ break; -+ case AVCOL_SPC_FCC: -+ cs = V4L2_COLORSPACE_470_SYSTEM_M; -+ break; -+ case AVCOL_SPC_BT470BG: -+ cs = V4L2_COLORSPACE_470_SYSTEM_BG; -+ break; -+ case AVCOL_SPC_SMPTE170M: -+ cs = V4L2_COLORSPACE_SMPTE170M; -+ break; -+ case AVCOL_SPC_SMPTE240M: -+ cs = V4L2_COLORSPACE_SMPTE240M; -+ break; -+ case AVCOL_SPC_BT2020_CL: -+ cs = V4L2_COLORSPACE_BT2020; -+ ycbcr = V4L2_YCBCR_ENC_BT2020_CONST_LUM; -+ break; -+ case AVCOL_SPC_BT2020_NCL: -+ cs = V4L2_COLORSPACE_BT2020; -+ break; -+ default: -+ break; -+ } -+ -+ switch (xfer) { -+ case AVCOL_TRC_BT709: -+ xfer = V4L2_XFER_FUNC_709; -+ break; -+ case AVCOL_TRC_IEC61966_2_1: -+ xfer = V4L2_XFER_FUNC_SRGB; -+ break; -+ case AVCOL_TRC_SMPTE240M: -+ xfer = V4L2_XFER_FUNC_SMPTE240M; -+ break; -+ case AVCOL_TRC_SMPTE2084: -+ xfer = V4L2_XFER_FUNC_SMPTE2084; -+ break; -+ default: -+ break; -+ } -+ -+ if (V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type)) { -+ buf->context->format.fmt.pix_mp.colorspace = cs; -+ buf->context->format.fmt.pix_mp.ycbcr_enc = ycbcr; -+ buf->context->format.fmt.pix_mp.xfer_func = xfer; -+ } else { -+ buf->context->format.fmt.pix.colorspace = cs; -+ buf->context->format.fmt.pix.ycbcr_enc = ycbcr; -+ buf->context->format.fmt.pix.xfer_func = xfer; -+ } -+} -+ - static enum AVColorRange v4l2_get_color_range(V4L2Buffer *buf) - { - enum v4l2_quantization qt; -@@ -134,6 +246,20 @@ static enum AVColorRange v4l2_get_color_ - return AVCOL_RANGE_UNSPECIFIED; - } - -+static void v4l2_set_color_range(V4L2Buffer *buf, const enum AVColorRange avcr) -+{ -+ const enum v4l2_quantization q = -+ avcr == AVCOL_RANGE_MPEG ? V4L2_QUANTIZATION_LIM_RANGE : -+ avcr == AVCOL_RANGE_JPEG ? V4L2_QUANTIZATION_FULL_RANGE : -+ V4L2_QUANTIZATION_DEFAULT; -+ -+ if (V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type)) { -+ buf->context->format.fmt.pix_mp.quantization = q; -+ } else { -+ buf->context->format.fmt.pix.quantization = q; -+ } -+} -+ - static enum AVColorSpace v4l2_get_color_space(V4L2Buffer *buf) - { - enum v4l2_ycbcr_encoding ycbcr; -@@ -210,73 +336,165 @@ static enum AVColorTransferCharacteristi - return AVCOL_TRC_UNSPECIFIED; - } - --static void v4l2_free_buffer(void *opaque, uint8_t *unused) -+static int v4l2_buf_is_interlaced(const V4L2Buffer * const buf) - { -- V4L2Buffer* avbuf = opaque; -- V4L2m2mContext *s = buf_to_m2mctx(avbuf); -- -- if (atomic_fetch_sub(&avbuf->context_refcount, 1) == 1) { -- atomic_fetch_sub_explicit(&s->refcount, 1, memory_order_acq_rel); -+ return V4L2_FIELD_IS_INTERLACED(buf->buf.field); -+} - -- if (s->reinit) { -- if (!atomic_load(&s->refcount)) -- sem_post(&s->refsync); -- } else { -- if (s->draining && V4L2_TYPE_IS_OUTPUT(avbuf->context->type)) { -- /* no need to queue more buffers to the driver */ -- avbuf->status = V4L2BUF_AVAILABLE; -- } -- else if (avbuf->context->streamon) -- ff_v4l2_buffer_enqueue(avbuf); -- } -+static int v4l2_buf_is_top_first(const V4L2Buffer * const buf) -+{ -+ return buf->buf.field == V4L2_FIELD_INTERLACED_TB; -+} - -- av_buffer_unref(&avbuf->context_ref); -- } -+static void v4l2_set_interlace(V4L2Buffer * const buf, const int is_interlaced, const int is_tff) -+{ -+ buf->buf.field = !is_interlaced ? V4L2_FIELD_NONE : -+ is_tff ? V4L2_FIELD_INTERLACED_TB : V4L2_FIELD_INTERLACED_BT; - } - --static int v4l2_buf_increase_ref(V4L2Buffer *in) -+static uint8_t * v4l2_get_drm_frame(V4L2Buffer *avbuf) - { -- V4L2m2mContext *s = buf_to_m2mctx(in); -+ AVDRMFrameDescriptor *drm_desc = &avbuf->drm_frame; -+ AVDRMLayerDescriptor *layer; - -- if (in->context_ref) -- atomic_fetch_add(&in->context_refcount, 1); -- else { -- in->context_ref = av_buffer_ref(s->self_ref); -- if (!in->context_ref) -- return AVERROR(ENOMEM); -+ /* fill the DRM frame descriptor */ -+ drm_desc->nb_objects = avbuf->num_planes; -+ drm_desc->nb_layers = 1; - -- in->context_refcount = 1; -+ layer = &drm_desc->layers[0]; -+ layer->nb_planes = avbuf->num_planes; -+ -+ for (int i = 0; i < avbuf->num_planes; i++) { -+ layer->planes[i].object_index = i; -+ layer->planes[i].offset = 0; -+ layer->planes[i].pitch = avbuf->plane_info[i].bytesperline; - } - -- in->status = V4L2BUF_RET_USER; -- atomic_fetch_add_explicit(&s->refcount, 1, memory_order_relaxed); -+ switch (avbuf->context->av_pix_fmt) { -+ case AV_PIX_FMT_YUYV422: -+ -+ layer->format = DRM_FORMAT_YUYV; -+ layer->nb_planes = 1; - -- return 0; -+ break; -+ -+ case AV_PIX_FMT_NV12: -+ case AV_PIX_FMT_NV21: -+ -+ layer->format = avbuf->context->av_pix_fmt == AV_PIX_FMT_NV12 ? -+ DRM_FORMAT_NV12 : DRM_FORMAT_NV21; -+ -+ if (avbuf->num_planes > 1) -+ break; -+ -+ layer->nb_planes = 2; -+ -+ layer->planes[1].object_index = 0; -+ layer->planes[1].offset = avbuf->plane_info[0].bytesperline * -+ avbuf->context->format.fmt.pix.height; -+ layer->planes[1].pitch = avbuf->plane_info[0].bytesperline; -+ break; -+ -+ case AV_PIX_FMT_YUV420P: -+ -+ layer->format = DRM_FORMAT_YUV420; -+ -+ if (avbuf->num_planes > 1) -+ break; -+ -+ layer->nb_planes = 3; -+ -+ layer->planes[1].object_index = 0; -+ layer->planes[1].offset = avbuf->plane_info[0].bytesperline * -+ avbuf->context->format.fmt.pix.height; -+ layer->planes[1].pitch = avbuf->plane_info[0].bytesperline >> 1; -+ -+ layer->planes[2].object_index = 0; -+ layer->planes[2].offset = layer->planes[1].offset + -+ ((avbuf->plane_info[0].bytesperline * -+ avbuf->context->format.fmt.pix.height) >> 2); -+ layer->planes[2].pitch = avbuf->plane_info[0].bytesperline >> 1; -+ break; -+ -+ default: -+ drm_desc->nb_layers = 0; -+ break; -+ } -+ -+ return (uint8_t *) drm_desc; - } - --static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf) -+static void v4l2_free_bufref(void *opaque, uint8_t *data) - { -- int ret; -+ AVBufferRef * bufref = (AVBufferRef *)data; -+ V4L2Buffer *avbuf = (V4L2Buffer *)bufref->data; -+ struct V4L2Context *ctx = ff_weak_link_lock(&avbuf->context_wl); - -- if (plane >= in->num_planes) -- return AVERROR(EINVAL); -+ if (ctx != NULL) { -+ // Buffer still attached to context -+ V4L2m2mContext *s = buf_to_m2mctx(avbuf); - -- /* even though most encoders return 0 in data_offset encoding vp8 does require this value */ -- *buf = av_buffer_create((char *)in->plane_info[plane].mm_addr + in->planes[plane].data_offset, -- in->plane_info[plane].length, v4l2_free_buffer, in, 0); -- if (!*buf) -- return AVERROR(ENOMEM); -+ ff_mutex_lock(&ctx->lock); - -- ret = v4l2_buf_increase_ref(in); -- if (ret) -- av_buffer_unref(buf); -+ avbuf->status = V4L2BUF_AVAILABLE; - -- return ret; -+ if (s->draining && V4L2_TYPE_IS_OUTPUT(ctx->type)) { -+ av_log(logger(avbuf), AV_LOG_DEBUG, "%s: Buffer avail\n", ctx->name); -+ /* no need to queue more buffers to the driver */ -+ } -+ else if (ctx->streamon) { -+ av_log(logger(avbuf), AV_LOG_DEBUG, "%s: Buffer requeue\n", ctx->name); -+ avbuf->buf.timestamp.tv_sec = 0; -+ avbuf->buf.timestamp.tv_usec = 0; -+ ff_v4l2_buffer_enqueue(avbuf); // will set to IN_DRIVER -+ } -+ else { -+ av_log(logger(avbuf), AV_LOG_DEBUG, "%s: Buffer freed but streamoff\n", ctx->name); -+ } -+ -+ ff_mutex_unlock(&ctx->lock); -+ } -+ -+ ff_weak_link_unlock(avbuf->context_wl); -+ av_buffer_unref(&bufref); -+} -+ -+static int v4l2_buffer_export_drm(V4L2Buffer* avbuf) -+{ -+ struct v4l2_exportbuffer expbuf; -+ int i, ret; -+ -+ for (i = 0; i < avbuf->num_planes; i++) { -+ memset(&expbuf, 0, sizeof(expbuf)); -+ -+ expbuf.index = avbuf->buf.index; -+ expbuf.type = avbuf->buf.type; -+ expbuf.plane = i; -+ -+ ret = ioctl(buf_to_m2mctx(avbuf)->fd, VIDIOC_EXPBUF, &expbuf); -+ if (ret < 0) -+ return AVERROR(errno); -+ -+ if (V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type)) { -+ /* drm frame */ -+ avbuf->drm_frame.objects[i].size = avbuf->buf.m.planes[i].length; -+ avbuf->drm_frame.objects[i].fd = expbuf.fd; -+ avbuf->drm_frame.objects[i].format_modifier = DRM_FORMAT_MOD_LINEAR; -+ } else { -+ /* drm frame */ -+ avbuf->drm_frame.objects[0].size = avbuf->buf.length; -+ avbuf->drm_frame.objects[0].fd = expbuf.fd; -+ avbuf->drm_frame.objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; -+ } -+ } -+ -+ return 0; - } - --static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, int offset, AVBufferRef* bref) -+static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, int offset) - { - unsigned int bytesused, length; -+ int rv = 0; - - if (plane >= out->num_planes) - return AVERROR(EINVAL); -@@ -284,32 +502,57 @@ static int v4l2_bufref_to_buf(V4L2Buffer - length = out->plane_info[plane].length; - bytesused = FFMIN(size+offset, length); - -- memcpy((uint8_t*)out->plane_info[plane].mm_addr+offset, data, FFMIN(size, length-offset)); -- -- if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { -- out->planes[plane].bytesused = bytesused; -- out->planes[plane].length = length; -- } else { -- out->buf.bytesused = bytesused; -- out->buf.length = length; -+ if (size > length - offset) { -+ size = length - offset; -+ rv = AVERROR(ENOMEM); - } - -- return 0; -+ memcpy((uint8_t*)out->plane_info[plane].mm_addr+offset, data, size); -+ -+ set_buf_length(out, plane, bytesused, length); -+ -+ return rv; -+} -+ -+static AVBufferRef * wrap_avbuf(V4L2Buffer * const avbuf) -+{ -+ AVBufferRef * bufref = av_buffer_ref(avbuf->context->bufrefs[avbuf->buf.index]); -+ AVBufferRef * newbuf; -+ -+ if (!bufref) -+ return NULL; -+ -+ newbuf = av_buffer_create((uint8_t *)bufref, sizeof(*bufref), v4l2_free_bufref, NULL, 0); -+ if (newbuf == NULL) -+ av_buffer_unref(&bufref); -+ -+ avbuf->status = V4L2BUF_RET_USER; -+ return newbuf; - } - - static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf) - { -- int i, ret; -+ int i; - - frame->format = avbuf->context->av_pix_fmt; - -- for (i = 0; i < avbuf->num_planes; i++) { -- ret = v4l2_buf_to_bufref(avbuf, i, &frame->buf[i]); -- if (ret) -- return ret; -+ frame->buf[0] = wrap_avbuf(avbuf); -+ if (frame->buf[0] == NULL) -+ return AVERROR(ENOMEM); - -+ if (buf_to_m2mctx(avbuf)->output_drm) { -+ /* 1. get references to the actual data */ -+ frame->data[0] = (uint8_t *) v4l2_get_drm_frame(avbuf); -+ frame->format = AV_PIX_FMT_DRM_PRIME; -+ frame->hw_frames_ctx = av_buffer_ref(avbuf->context->frames_ref); -+ return 0; -+ } -+ -+ -+ /* 1. get references to the actual data */ -+ for (i = 0; i < avbuf->num_planes; i++) { -+ frame->data[i] = (uint8_t *)avbuf->plane_info[i].mm_addr + avbuf->planes[i].data_offset; - frame->linesize[i] = avbuf->plane_info[i].bytesperline; -- frame->data[i] = frame->buf[i]->data; - } - - /* fixup special cases */ -@@ -318,17 +561,17 @@ static int v4l2_buffer_buf_to_swframe(AV - case AV_PIX_FMT_NV21: - if (avbuf->num_planes > 1) - break; -- frame->linesize[1] = avbuf->plane_info[0].bytesperline; -- frame->data[1] = frame->buf[0]->data + avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height; -+ frame->linesize[1] = frame->linesize[0]; -+ frame->data[1] = frame->data[0] + frame->linesize[0] * ff_v4l2_get_format_height(&avbuf->context->format); - break; - - case AV_PIX_FMT_YUV420P: - if (avbuf->num_planes > 1) - break; -- frame->linesize[1] = avbuf->plane_info[0].bytesperline >> 1; -- frame->linesize[2] = avbuf->plane_info[0].bytesperline >> 1; -- frame->data[1] = frame->buf[0]->data + avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height; -- frame->data[2] = frame->data[1] + ((avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height) >> 2); -+ frame->linesize[1] = frame->linesize[0] / 2; -+ frame->linesize[2] = frame->linesize[1]; -+ frame->data[1] = frame->data[0] + frame->linesize[0] * ff_v4l2_get_format_height(&avbuf->context->format); -+ frame->data[2] = frame->data[1] + frame->linesize[1] * ff_v4l2_get_format_height(&avbuf->context->format) / 2; - break; - - default: -@@ -338,68 +581,95 @@ static int v4l2_buffer_buf_to_swframe(AV - return 0; - } - -+static void cpy_2d(uint8_t * dst, int dst_stride, const uint8_t * src, int src_stride, int w, int h) -+{ -+ if (dst_stride == src_stride && w + 32 >= dst_stride) { -+ memcpy(dst, src, dst_stride * h); -+ } -+ else { -+ while (--h >= 0) { -+ memcpy(dst, src, w); -+ dst += dst_stride; -+ src += src_stride; -+ } -+ } -+} -+ -+static int is_chroma(const AVPixFmtDescriptor *desc, int i, int num_planes) -+{ -+ return i != 0 && !(i == num_planes - 1 && (desc->flags & AV_PIX_FMT_FLAG_ALPHA)); -+} -+ - static int v4l2_buffer_swframe_to_buf(const AVFrame *frame, V4L2Buffer *out) - { -- int i, ret; -- struct v4l2_format fmt = out->context->format; -- int pixel_format = V4L2_TYPE_IS_MULTIPLANAR(fmt.type) ? -- fmt.fmt.pix_mp.pixelformat : fmt.fmt.pix.pixelformat; -- int height = V4L2_TYPE_IS_MULTIPLANAR(fmt.type) ? -- fmt.fmt.pix_mp.height : fmt.fmt.pix.height; -- int is_planar_format = 0; -- -- switch (pixel_format) { -- case V4L2_PIX_FMT_YUV420M: -- case V4L2_PIX_FMT_YVU420M: --#ifdef V4L2_PIX_FMT_YUV422M -- case V4L2_PIX_FMT_YUV422M: --#endif --#ifdef V4L2_PIX_FMT_YVU422M -- case V4L2_PIX_FMT_YVU422M: --#endif --#ifdef V4L2_PIX_FMT_YUV444M -- case V4L2_PIX_FMT_YUV444M: --#endif --#ifdef V4L2_PIX_FMT_YVU444M -- case V4L2_PIX_FMT_YVU444M: --#endif -- case V4L2_PIX_FMT_NV12M: -- case V4L2_PIX_FMT_NV21M: -- case V4L2_PIX_FMT_NV12MT_16X16: -- case V4L2_PIX_FMT_NV12MT: -- case V4L2_PIX_FMT_NV16M: -- case V4L2_PIX_FMT_NV61M: -- is_planar_format = 1; -- } -- -- if (!is_planar_format) { -- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); -- int planes_nb = 0; -- int offset = 0; -- -- for (i = 0; i < desc->nb_components; i++) -- planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1); -- -- for (i = 0; i < planes_nb; i++) { -- int size, h = height; -- if (i == 1 || i == 2) { -+ int i; -+ int num_planes = 0; -+ int pel_strides[4] = {0}; -+ -+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); -+ -+ if ((desc->flags & AV_PIX_FMT_FLAG_HWACCEL) != 0) { -+ av_log(NULL, AV_LOG_ERROR, "%s: HWACCEL cannot be copied\n", __func__); -+ return -1; -+ } -+ -+ for (i = 0; i != desc->nb_components; ++i) { -+ if (desc->comp[i].plane >= num_planes) -+ num_planes = desc->comp[i].plane + 1; -+ pel_strides[desc->comp[i].plane] = desc->comp[i].step; -+ } -+ -+ if (out->num_planes > 1) { -+ if (num_planes != out->num_planes) { -+ av_log(NULL, AV_LOG_ERROR, "%s: Num planes mismatch: %d != %d\n", __func__, num_planes, out->num_planes); -+ return -1; -+ } -+ for (i = 0; i != num_planes; ++i) { -+ int w = frame->width; -+ int h = frame->height; -+ if (is_chroma(desc, i, num_planes)) { -+ w = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); - h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); - } -- size = frame->linesize[i] * h; -- ret = v4l2_bufref_to_buf(out, 0, frame->data[i], size, offset, frame->buf[i]); -- if (ret) -- return ret; -- offset += size; -+ -+ cpy_2d(out->plane_info[i].mm_addr, out->plane_info[i].bytesperline, -+ frame->data[i], frame->linesize[i], -+ w * pel_strides[i], h); -+ set_buf_length(out, i, out->plane_info[i].bytesperline * h, out->plane_info[i].length); - } -- return 0; - } -+ else -+ { -+ unsigned int offset = 0; -+ -+ for (i = 0; i != num_planes; ++i) { -+ int w = frame->width; -+ int h = frame->height; -+ int dst_stride = out->plane_info[0].bytesperline; -+ uint8_t * const dst = (uint8_t *)out->plane_info[0].mm_addr + offset; -+ -+ if (is_chroma(desc, i, num_planes)) { -+ // Is chroma -+ dst_stride >>= desc->log2_chroma_w; -+ offset += dst_stride * (out->context->height >> desc->log2_chroma_h); -+ w = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); -+ h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); -+ } -+ else { -+ // Is luma or alpha -+ offset += dst_stride * out->context->height; -+ } -+ if (offset > out->plane_info[0].length) { -+ av_log(NULL, AV_LOG_ERROR, "%s: Plane total %u > buffer size %zu\n", __func__, offset, out->plane_info[0].length); -+ return -1; -+ } - -- for (i = 0; i < out->num_planes; i++) { -- ret = v4l2_bufref_to_buf(out, i, frame->buf[i]->data, frame->buf[i]->size, 0, frame->buf[i]); -- if (ret) -- return ret; -+ cpy_2d(dst, dst_stride, -+ frame->data[i], frame->linesize[i], -+ w * pel_strides[i], h); -+ } -+ set_buf_length(out, 0, offset, out->plane_info[0].length); - } -- - return 0; - } - -@@ -411,14 +681,22 @@ static int v4l2_buffer_swframe_to_buf(co - - int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer *out) - { -- v4l2_set_pts(out, frame->pts); -+ out->buf.flags = frame->key_frame ? (out->buf.flags & ~V4L2_BUF_FLAG_KEYFRAME) : (out->buf.flags | V4L2_BUF_FLAG_KEYFRAME); -+ // Beware that colour info is held in format rather than the actual -+ // v4l2 buffer struct so this may not be as useful as you might hope -+ v4l2_set_color(out, frame->color_primaries, frame->colorspace, frame->color_trc); -+ v4l2_set_color_range(out, frame->color_range); -+ // PTS & interlace are buffer vars -+ v4l2_set_pts(out, frame->pts, 0); -+ v4l2_set_interlace(out, frame->interlaced_frame, frame->top_field_first); - - return v4l2_buffer_swframe_to_buf(frame, out); - } - --int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) -+int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf, int no_rescale_pts) - { - int ret; -+ V4L2Context * const ctx = avbuf->context; - - av_frame_unref(frame); - -@@ -433,13 +711,24 @@ int ff_v4l2_buffer_buf_to_avframe(AVFram - frame->colorspace = v4l2_get_color_space(avbuf); - frame->color_range = v4l2_get_color_range(avbuf); - frame->color_trc = v4l2_get_color_trc(avbuf); -- frame->pts = v4l2_get_pts(avbuf); -+ frame->pts = v4l2_get_pts(avbuf, no_rescale_pts); - frame->pkt_dts = AV_NOPTS_VALUE; -+ frame->interlaced_frame = v4l2_buf_is_interlaced(avbuf); -+ frame->top_field_first = v4l2_buf_is_top_first(avbuf); - - /* these values are updated also during re-init in v4l2_process_driver_event */ -- frame->height = avbuf->context->height; -- frame->width = avbuf->context->width; -- frame->sample_aspect_ratio = avbuf->context->sample_aspect_ratio; -+ frame->height = ctx->height; -+ frame->width = ctx->width; -+ frame->sample_aspect_ratio = ctx->sample_aspect_ratio; -+ -+ if (ctx->selection.height && ctx->selection.width) { -+ frame->crop_left = ctx->selection.left < frame->width ? ctx->selection.left : 0; -+ frame->crop_top = ctx->selection.top < frame->height ? ctx->selection.top : 0; -+ frame->crop_right = ctx->selection.left + ctx->selection.width < frame->width ? -+ frame->width - (ctx->selection.left + ctx->selection.width) : 0; -+ frame->crop_bottom = ctx->selection.top + ctx->selection.height < frame->height ? -+ frame->width - (ctx->selection.top + ctx->selection.height) : 0; -+ } - - /* 3. report errors upstream */ - if (avbuf->buf.flags & V4L2_BUF_FLAG_ERROR) { -@@ -452,15 +741,16 @@ int ff_v4l2_buffer_buf_to_avframe(AVFram - - int ff_v4l2_buffer_buf_to_avpkt(AVPacket *pkt, V4L2Buffer *avbuf) - { -- int ret; -+ av_log(logger(avbuf), AV_LOG_INFO, "%s\n", __func__); - - av_packet_unref(pkt); -- ret = v4l2_buf_to_bufref(avbuf, 0, &pkt->buf); -- if (ret) -- return ret; -+ -+ pkt->buf = wrap_avbuf(avbuf); -+ if (pkt->buf == NULL) -+ return AVERROR(ENOMEM); - - pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused; -- pkt->data = pkt->buf->data; -+ pkt->data = (uint8_t*)avbuf->plane_info[0].mm_addr + avbuf->planes[0].data_offset; - - if (avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME) - pkt->flags |= AV_PKT_FLAG_KEY; -@@ -470,36 +760,89 @@ int ff_v4l2_buffer_buf_to_avpkt(AVPacket - pkt->flags |= AV_PKT_FLAG_CORRUPT; - } - -- pkt->dts = pkt->pts = v4l2_get_pts(avbuf); -+ pkt->dts = pkt->pts = v4l2_get_pts(avbuf, 0); - - return 0; - } - --int ff_v4l2_buffer_avpkt_to_buf(const AVPacket *pkt, V4L2Buffer *out) -+int ff_v4l2_buffer_avpkt_to_buf_ext(const AVPacket *pkt, V4L2Buffer *out, -+ const void *extdata, size_t extlen, int no_rescale_pts) - { - int ret; - -- ret = v4l2_bufref_to_buf(out, 0, pkt->data, pkt->size, 0, pkt->buf); -- if (ret) -+ if (extlen) { -+ ret = v4l2_bufref_to_buf(out, 0, extdata, extlen, 0); -+ if (ret) -+ return ret; -+ } -+ -+ ret = v4l2_bufref_to_buf(out, 0, pkt->data, pkt->size, extlen); -+ if (ret && ret != AVERROR(ENOMEM)) - return ret; - -- v4l2_set_pts(out, pkt->pts); -+ v4l2_set_pts(out, pkt->pts, no_rescale_pts); - - if (pkt->flags & AV_PKT_FLAG_KEY) - out->flags = V4L2_BUF_FLAG_KEYFRAME; - -- return 0; -+ return ret; - } - --int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) -+int ff_v4l2_buffer_avpkt_to_buf(const AVPacket *pkt, V4L2Buffer *out) -+{ -+ return ff_v4l2_buffer_avpkt_to_buf_ext(pkt, out, NULL, 0, 0); -+} -+ -+ -+static void v4l2_buffer_buffer_free(void *opaque, uint8_t *data) -+{ -+ V4L2Buffer * const avbuf = (V4L2Buffer *)data; -+ int i; -+ -+ for (i = 0; i != FF_ARRAY_ELEMS(avbuf->plane_info); ++i) { -+ struct V4L2Plane_info *p = avbuf->plane_info + i; -+ if (p->mm_addr != NULL) -+ munmap(p->mm_addr, p->length); -+ } -+ -+ for (i = 0; i != FF_ARRAY_ELEMS(avbuf->drm_frame.objects); ++i) { -+ if (avbuf->drm_frame.objects[i].fd != -1) -+ close(avbuf->drm_frame.objects[i].fd); -+ } -+ -+ ff_weak_link_unref(&avbuf->context_wl); -+ -+ av_free(avbuf); -+} -+ -+ -+int ff_v4l2_buffer_initialize(AVBufferRef ** pbufref, int index, V4L2Context *ctx) - { -- V4L2Context *ctx = avbuf->context; - int ret, i; -+ V4L2Buffer * const avbuf = av_mallocz(sizeof(*avbuf)); -+ AVBufferRef * bufref; -+ -+ *pbufref = NULL; -+ if (avbuf == NULL) -+ return AVERROR(ENOMEM); - -+ bufref = av_buffer_create((uint8_t*)avbuf, sizeof(*avbuf), v4l2_buffer_buffer_free, NULL, 0); -+ if (bufref == NULL) { -+ av_free(avbuf); -+ return AVERROR(ENOMEM); -+ } -+ -+ avbuf->context = ctx; - avbuf->buf.memory = V4L2_MEMORY_MMAP; - avbuf->buf.type = ctx->type; - avbuf->buf.index = index; - -+ for (i = 0; i != FF_ARRAY_ELEMS(avbuf->drm_frame.objects); ++i) { -+ avbuf->drm_frame.objects[i].fd = -1; -+ } -+ -+ avbuf->context_wl = ff_weak_link_ref(ctx->wl_master); -+ - if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { - avbuf->buf.length = VIDEO_MAX_PLANES; - avbuf->buf.m.planes = avbuf->planes; -@@ -507,7 +850,7 @@ int ff_v4l2_buffer_initialize(V4L2Buffer - - ret = ioctl(buf_to_m2mctx(avbuf)->fd, VIDIOC_QUERYBUF, &avbuf->buf); - if (ret < 0) -- return AVERROR(errno); -+ goto fail; - - if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { - avbuf->num_planes = 0; -@@ -527,25 +870,33 @@ int ff_v4l2_buffer_initialize(V4L2Buffer - - if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { - avbuf->plane_info[i].length = avbuf->buf.m.planes[i].length; -- avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, -- PROT_READ | PROT_WRITE, MAP_SHARED, -- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.planes[i].m.mem_offset); -+ -+ if ((V4L2_TYPE_IS_OUTPUT(ctx->type) && buf_to_m2mctx(avbuf)->output_drm) || -+ !buf_to_m2mctx(avbuf)->output_drm) { -+ avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, -+ PROT_READ | PROT_WRITE, MAP_SHARED, -+ buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.planes[i].m.mem_offset); -+ } - } else { - avbuf->plane_info[i].length = avbuf->buf.length; -- avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, -- PROT_READ | PROT_WRITE, MAP_SHARED, -- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.offset); -+ -+ if ((V4L2_TYPE_IS_OUTPUT(ctx->type) && buf_to_m2mctx(avbuf)->output_drm) || -+ !buf_to_m2mctx(avbuf)->output_drm) { -+ avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, -+ PROT_READ | PROT_WRITE, MAP_SHARED, -+ buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.offset); -+ } - } - -- if (avbuf->plane_info[i].mm_addr == MAP_FAILED) -- return AVERROR(ENOMEM); -+ if (avbuf->plane_info[i].mm_addr == MAP_FAILED) { -+ avbuf->plane_info[i].mm_addr = NULL; -+ ret = AVERROR(ENOMEM); -+ goto fail; -+ } - } - - avbuf->status = V4L2BUF_AVAILABLE; - -- if (V4L2_TYPE_IS_OUTPUT(ctx->type)) -- return 0; -- - if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { - avbuf->buf.m.planes = avbuf->planes; - avbuf->buf.length = avbuf->num_planes; -@@ -555,7 +906,20 @@ int ff_v4l2_buffer_initialize(V4L2Buffer - avbuf->buf.length = avbuf->planes[0].length; - } - -- return ff_v4l2_buffer_enqueue(avbuf); -+ if (!V4L2_TYPE_IS_OUTPUT(ctx->type)) { -+ if (buf_to_m2mctx(avbuf)->output_drm) { -+ ret = v4l2_buffer_export_drm(avbuf); -+ if (ret) -+ goto fail; -+ } -+ } -+ -+ *pbufref = bufref; -+ return 0; -+ -+fail: -+ av_buffer_unref(&bufref); -+ return ret; - } - - int ff_v4l2_buffer_enqueue(V4L2Buffer* avbuf) -@@ -564,9 +928,27 @@ int ff_v4l2_buffer_enqueue(V4L2Buffer* a - - avbuf->buf.flags = avbuf->flags; - -+ if (avbuf->buf.timestamp.tv_sec || avbuf->buf.timestamp.tv_usec) { -+ av_log(logger(avbuf), AV_LOG_DEBUG, "--- %s pre VIDIOC_QBUF: index %d, ts=%ld.%06ld count=%d\n", -+ avbuf->context->name, avbuf->buf.index, -+ avbuf->buf.timestamp.tv_sec, avbuf->buf.timestamp.tv_usec, -+ avbuf->context->q_count); -+ } -+ - ret = ioctl(buf_to_m2mctx(avbuf)->fd, VIDIOC_QBUF, &avbuf->buf); -- if (ret < 0) -- return AVERROR(errno); -+ if (ret < 0) { -+ int err = errno; -+ av_log(logger(avbuf), AV_LOG_ERROR, "--- %s VIDIOC_QBUF: index %d FAIL err %d (%s)\n", -+ avbuf->context->name, avbuf->buf.index, -+ err, strerror(err)); -+ return AVERROR(err); -+ } -+ -+ ++avbuf->context->q_count; -+ av_log(logger(avbuf), AV_LOG_DEBUG, "--- %s VIDIOC_QBUF: index %d, ts=%ld.%06ld count=%d\n", -+ avbuf->context->name, avbuf->buf.index, -+ avbuf->buf.timestamp.tv_sec, avbuf->buf.timestamp.tv_usec, -+ avbuf->context->q_count); - - avbuf->status = V4L2BUF_IN_DRIVER; - ---- a/libavcodec/v4l2_buffers.h -+++ b/libavcodec/v4l2_buffers.h -@@ -27,25 +27,34 @@ - #include - #include - -+#include "libavutil/hwcontext_drm.h" - #include "avcodec.h" - - enum V4L2Buffer_status { - V4L2BUF_AVAILABLE, - V4L2BUF_IN_DRIVER, -+ V4L2BUF_IN_USE, - V4L2BUF_RET_USER, - }; - - /** - * V4L2Buffer (wrapper for v4l2_buffer management) - */ -+struct V4L2Context; -+struct ff_weak_link_client; -+ - typedef struct V4L2Buffer { -- /* each buffer needs to have a reference to its context */ -+ /* each buffer needs to have a reference to its context -+ * The pointer is good enough for most operation but once the buffer has -+ * been passed to the user the buffer may become orphaned so for free ops -+ * the weak link must be used to ensure that the context is actually -+ * there -+ */ - struct V4L2Context *context; -+ struct ff_weak_link_client *context_wl; - -- /* This object is refcounted per-plane, so we need to keep track -- * of how many context-refs we are holding. */ -- AVBufferRef *context_ref; -- atomic_uint context_refcount; -+ /* DRM descriptor */ -+ AVDRMFrameDescriptor drm_frame; - - /* keep track of the mmap address and mmap length */ - struct V4L2Plane_info { -@@ -70,11 +79,12 @@ typedef struct V4L2Buffer { - * - * @param[in] frame The AVFRame to push the information to - * @param[in] buf The V4L2Buffer to get the information from -+ * @param[in] no_rescale_pts If non-zero do not rescale PTS - * - * @returns 0 in case of success, AVERROR(EINVAL) if the number of planes is incorrect, - * AVERROR(ENOMEM) if the AVBufferRef can't be created. - */ --int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *buf); -+int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *buf, int no_rescale_pts); - - /** - * Extracts the data from a V4L2Buffer to an AVPacket -@@ -98,6 +108,9 @@ int ff_v4l2_buffer_buf_to_avpkt(AVPacket - */ - int ff_v4l2_buffer_avpkt_to_buf(const AVPacket *pkt, V4L2Buffer *out); - -+int ff_v4l2_buffer_avpkt_to_buf_ext(const AVPacket *pkt, V4L2Buffer *out, -+ const void *extdata, size_t extlen, int no_rescale_pts); -+ - /** - * Extracts the data from an AVFrame to a V4L2Buffer - * -@@ -116,7 +129,7 @@ int ff_v4l2_buffer_avframe_to_buf(const - * - * @returns 0 in case of success, a negative AVERROR code otherwise - */ --int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index); -+int ff_v4l2_buffer_initialize(AVBufferRef **avbuf, int index, struct V4L2Context *ctx); - - /** - * Enqueues a V4L2Buffer ---- a/libavcodec/v4l2_context.c -+++ b/libavcodec/v4l2_context.c -@@ -27,11 +27,13 @@ - #include - #include - #include -+#include "libavutil/avassert.h" - #include "libavcodec/avcodec.h" - #include "libavcodec/internal.h" - #include "v4l2_buffers.h" - #include "v4l2_fmt.h" - #include "v4l2_m2m.h" -+#include "weak_link.h" - - struct v4l2_format_update { - uint32_t v4l2_fmt; -@@ -53,16 +55,6 @@ static inline AVCodecContext *logger(V4L - return ctx_to_m2mctx(ctx)->avctx; - } - --static inline unsigned int v4l2_get_width(struct v4l2_format *fmt) --{ -- return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.width : fmt->fmt.pix.width; --} -- --static inline unsigned int v4l2_get_height(struct v4l2_format *fmt) --{ -- return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.height : fmt->fmt.pix.height; --} -- - static AVRational v4l2_get_sar(V4L2Context *ctx) - { - struct AVRational sar = { 0, 1 }; -@@ -94,8 +86,8 @@ static inline unsigned int v4l2_resoluti - if (ret) - av_log(logger(ctx), AV_LOG_DEBUG, "%s changed (%dx%d) -> (%dx%d)\n", - ctx->name, -- v4l2_get_width(fmt1), v4l2_get_height(fmt1), -- v4l2_get_width(fmt2), v4l2_get_height(fmt2)); -+ ff_v4l2_get_format_width(fmt1), ff_v4l2_get_format_height(fmt1), -+ ff_v4l2_get_format_width(fmt2), ff_v4l2_get_format_height(fmt2)); - - return ret; - } -@@ -153,58 +145,67 @@ static inline void v4l2_save_to_context( - } - } - --/** -- * handle resolution change event and end of stream event -- * returns 1 if reinit was successful, negative if it failed -- * returns 0 if reinit was not executed -- */ --static int v4l2_handle_event(V4L2Context *ctx) -+static int get_default_selection(V4L2Context * const ctx, struct v4l2_rect *r) - { -- V4L2m2mContext *s = ctx_to_m2mctx(ctx); -- struct v4l2_format cap_fmt = s->capture.format; -- struct v4l2_format out_fmt = s->output.format; -- struct v4l2_event evt = { 0 }; -- int full_reinit, reinit, ret; -+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); -+ struct v4l2_selection selection = { -+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, -+ .target = V4L2_SEL_TGT_COMPOSE -+ }; - -- ret = ioctl(s->fd, VIDIOC_DQEVENT, &evt); -- if (ret < 0) { -- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_DQEVENT\n", ctx->name); -- return 0; -- } -+ memset(r, 0, sizeof(*r)); -+ if (ioctl(s->fd, VIDIOC_G_SELECTION, &selection)) -+ return AVERROR(errno); - -- if (evt.type == V4L2_EVENT_EOS) { -- ctx->done = 1; -- return 0; -- } -+ *r = selection.r; -+ return 0; -+} - -- if (evt.type != V4L2_EVENT_SOURCE_CHANGE) -- return 0; -+static int do_source_change(V4L2m2mContext * const s) -+{ -+ AVCodecContext *const avctx = s->avctx; -+ -+ int ret; -+ int reinit; -+ int full_reinit; -+ struct v4l2_format cap_fmt = s->capture.format; -+ struct v4l2_format out_fmt = s->output.format; -+ -+ s->resize_pending = 0; -+ s->capture.done = 0; - - ret = ioctl(s->fd, VIDIOC_G_FMT, &out_fmt); - if (ret) { -- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", s->output.name); -+ av_log(avctx, AV_LOG_ERROR, "%s VIDIOC_G_FMT failed\n", s->output.name); - return 0; - } - - ret = ioctl(s->fd, VIDIOC_G_FMT, &cap_fmt); - if (ret) { -- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", s->capture.name); -+ av_log(avctx, AV_LOG_ERROR, "%s VIDIOC_G_FMT failed\n", s->capture.name); - return 0; - } - - full_reinit = v4l2_resolution_changed(&s->output, &out_fmt); - if (full_reinit) { -- s->output.height = v4l2_get_height(&out_fmt); -- s->output.width = v4l2_get_width(&out_fmt); -- s->output.sample_aspect_ratio = v4l2_get_sar(&s->output); -+ s->output.height = ff_v4l2_get_format_height(&out_fmt); -+ s->output.width = ff_v4l2_get_format_width(&out_fmt); - } -+ s->output.sample_aspect_ratio = v4l2_get_sar(&s->output); -+ -+ get_default_selection(&s->capture, &s->capture.selection); - - reinit = v4l2_resolution_changed(&s->capture, &cap_fmt); - if (reinit) { -- s->capture.height = v4l2_get_height(&cap_fmt); -- s->capture.width = v4l2_get_width(&cap_fmt); -- s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture); -+ s->capture.height = ff_v4l2_get_format_height(&cap_fmt); -+ s->capture.width = ff_v4l2_get_format_width(&cap_fmt); - } -+ s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture); -+ -+ av_log(avctx, AV_LOG_DEBUG, "Source change: SAR: %d/%d, crop %dx%d @ %d,%d\n", -+ s->capture.sample_aspect_ratio.num, s->capture.sample_aspect_ratio.den, -+ s->capture.selection.width, s->capture.selection.height, -+ s->capture.selection.left, s->capture.selection.top); - - if (full_reinit || reinit) - s->reinit = 1; -@@ -212,34 +213,88 @@ static int v4l2_handle_event(V4L2Context - if (full_reinit) { - ret = ff_v4l2_m2m_codec_full_reinit(s); - if (ret) { -- av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_full_reinit\n"); -+ av_log(avctx, AV_LOG_ERROR, "v4l2_m2m_codec_full_reinit failed\n"); - return AVERROR(EINVAL); - } - goto reinit_run; - } - - if (reinit) { -- if (s->avctx) -+ if (avctx) - ret = ff_set_dimensions(s->avctx, s->capture.width, s->capture.height); - if (ret < 0) -- av_log(logger(ctx), AV_LOG_WARNING, "update avcodec height and width\n"); -+ av_log(avctx, AV_LOG_WARNING, "update avcodec height and width failed\n"); - - ret = ff_v4l2_m2m_codec_reinit(s); - if (ret) { -- av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_reinit\n"); -+ av_log(avctx, AV_LOG_ERROR, "v4l2_m2m_codec_reinit failed\n"); - return AVERROR(EINVAL); - } - goto reinit_run; - } - -- /* dummy event received */ -- return 0; -+ /* Buffers are OK so just stream off to ack */ -+ av_log(avctx, AV_LOG_DEBUG, "%s: Parameters only\n", __func__); -+ -+ ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); -+ if (ret) -+ av_log(avctx, AV_LOG_ERROR, "capture VIDIOC_STREAMOFF failed\n"); -+ s->draining = 0; - - /* reinit executed */ - reinit_run: -+ ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMON); - return 1; - } - -+static int ctx_done(V4L2Context * const ctx) -+{ -+ int rv = 0; -+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); -+ -+ ctx->done = 1; -+ -+ if (s->resize_pending && !V4L2_TYPE_IS_OUTPUT(ctx->type)) -+ rv = do_source_change(s); -+ -+ return rv; -+} -+ -+/** -+ * handle resolution change event and end of stream event -+ * returns 1 if reinit was successful, negative if it failed -+ * returns 0 if reinit was not executed -+ */ -+static int v4l2_handle_event(V4L2Context *ctx) -+{ -+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); -+ struct v4l2_event evt = { 0 }; -+ int ret; -+ -+ ret = ioctl(s->fd, VIDIOC_DQEVENT, &evt); -+ if (ret < 0) { -+ av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_DQEVENT\n", ctx->name); -+ return 0; -+ } -+ -+ av_log(logger(ctx), AV_LOG_INFO, "Dq event %d\n", evt.type); -+ -+ if (evt.type == V4L2_EVENT_EOS) { -+// ctx->done = 1; -+ av_log(logger(ctx), AV_LOG_TRACE, "%s VIDIOC_EVENT_EOS\n", ctx->name); -+ return 0; -+ } -+ -+ if (evt.type != V4L2_EVENT_SOURCE_CHANGE) -+ return 0; -+ -+ s->resize_pending = 1; -+ if (!ctx->done) -+ return 0; -+ -+ return do_source_change(s); -+} -+ - static int v4l2_stop_decode(V4L2Context *ctx) - { - struct v4l2_decoder_cmd cmd = { -@@ -280,8 +335,26 @@ static int v4l2_stop_encode(V4L2Context - return 0; - } - -+static int count_in_driver(const V4L2Context * const ctx) -+{ -+ int i; -+ int n = 0; -+ -+ if (!ctx->bufrefs) -+ return -1; -+ -+ for (i = 0; i < ctx->num_buffers; ++i) { -+ V4L2Buffer *const avbuf = (V4L2Buffer *)ctx->bufrefs[i]->data; -+ if (avbuf->status == V4L2BUF_IN_DRIVER) -+ ++n; -+ } -+ return n; -+} -+ - static V4L2Buffer* v4l2_dequeue_v4l2buf(V4L2Context *ctx, int timeout) - { -+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); -+ const int is_capture = !V4L2_TYPE_IS_OUTPUT(ctx->type); - struct v4l2_plane planes[VIDEO_MAX_PLANES]; - struct v4l2_buffer buf = { 0 }; - V4L2Buffer *avbuf; -@@ -290,50 +363,84 @@ static V4L2Buffer* v4l2_dequeue_v4l2buf( - .fd = ctx_to_m2mctx(ctx)->fd, - }; - int i, ret; -+ int no_rx_means_done = 0; - -- if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx->buffers) { -+ if (is_capture && ctx->bufrefs) { - for (i = 0; i < ctx->num_buffers; i++) { -- if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER) -+ avbuf = (V4L2Buffer *)ctx->bufrefs[i]->data; -+ if (avbuf->status == V4L2BUF_IN_DRIVER) - break; - } - if (i == ctx->num_buffers) -- av_log(logger(ctx), AV_LOG_WARNING, "All capture buffers returned to " -+ av_log(logger(ctx), AV_LOG_WARNING, "All capture buffers (%d) returned to " - "userspace. Increase num_capture_buffers " - "to prevent device deadlock or dropped " -- "packets/frames.\n"); -+ "packets/frames.\n", i); - } - -+#if 0 -+ // I think this is true but pointless -+ // we will get some other form of EOF signal -+ - /* if we are draining and there are no more capture buffers queued in the driver we are done */ -- if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx_to_m2mctx(ctx)->draining) { -+ if (is_capture && ctx_to_m2mctx(ctx)->draining) { - for (i = 0; i < ctx->num_buffers; i++) { - /* capture buffer initialization happens during decode hence - * detection happens at runtime - */ -- if (!ctx->buffers) -+ if (!ctx->bufrefs) - break; - -- if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER) -+ avbuf = (V4L2Buffer *)ctx->bufrefs[i]->data; -+ if (avbuf->status == V4L2BUF_IN_DRIVER) - goto start; - } - ctx->done = 1; - return NULL; - } -+#endif - - start: -- if (V4L2_TYPE_IS_OUTPUT(ctx->type)) -- pfd.events = POLLOUT | POLLWRNORM; -- else { -+ if (is_capture) { - /* no need to listen to requests for more input while draining */ - if (ctx_to_m2mctx(ctx)->draining) - pfd.events = POLLIN | POLLRDNORM | POLLPRI; -+ } else { -+ pfd.events = POLLOUT | POLLWRNORM; - } -+ no_rx_means_done = s->resize_pending && is_capture; - - for (;;) { -- ret = poll(&pfd, 1, timeout); -+ // If we have a resize pending then all buffers should be Qed -+ // With a resize pending we should be in drain but evidence suggests -+ // that not all decoders do this so poll to clear -+ int t2 = no_rx_means_done ? 0 : timeout < 0 ? 3000 : timeout; -+ const int e = pfd.events; -+ -+ ret = poll(&pfd, 1, t2); -+ - if (ret > 0) - break; -- if (errno == EINTR) -- continue; -+ -+ if (ret < 0) { -+ int err = errno; -+ if (err == EINTR) -+ continue; -+ av_log(logger(ctx), AV_LOG_ERROR, "=== poll error %d (%s): events=%#x, cap buffers=%d\n", -+ err, strerror(err), -+ e, count_in_driver(ctx)); -+ return NULL; -+ } -+ -+ // ret == 0 (timeout) -+ if (no_rx_means_done) { -+ av_log(logger(ctx), AV_LOG_DEBUG, "Ctx done on timeout\n"); -+ ret = ctx_done(ctx); -+ if (ret > 0) -+ goto start; -+ } -+ if (timeout == -1) -+ av_log(logger(ctx), AV_LOG_ERROR, "=== poll unexpected TIMEOUT: events=%#x, cap buffers=%d\n", e, count_in_driver(ctx));; - return NULL; - } - -@@ -343,7 +450,8 @@ start: - no need to raise a warning */ - if (timeout == 0) { - for (i = 0; i < ctx->num_buffers; i++) { -- if (ctx->buffers[i].status != V4L2BUF_AVAILABLE) -+ avbuf = (V4L2Buffer *)ctx->bufrefs[i]->data; -+ if (avbuf->status != V4L2BUF_AVAILABLE) - av_log(logger(ctx), AV_LOG_WARNING, "%s POLLERR\n", ctx->name); - } - } -@@ -361,22 +469,25 @@ start: - ctx->done = 1; - return NULL; - } -- if (ret) { -- /* if re-init was successful drop the buffer (if there was one) -- * since we had to reconfigure capture (unmap all buffers) -- */ -- return NULL; -- } -+ if (ret > 0) -+ goto start; - } - - /* 2. dequeue the buffer */ - if (pfd.revents & (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM)) { - -- if (!V4L2_TYPE_IS_OUTPUT(ctx->type)) { -+ if (is_capture) { - /* there is a capture buffer ready */ - if (pfd.revents & (POLLIN | POLLRDNORM)) - goto dequeue; - -+ // CAPTURE Q drained -+ if (no_rx_means_done) { -+ if (ctx_done(ctx) > 0) -+ goto start; -+ return NULL; -+ } -+ - /* the driver is ready to accept more input; instead of waiting for the capture - * buffer to complete we return NULL so input can proceed (we are single threaded) - */ -@@ -394,37 +505,58 @@ dequeue: - buf.m.planes = planes; - } - -- ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_DQBUF, &buf); -- if (ret) { -- if (errno != EAGAIN) { -- ctx->done = 1; -- if (errno != EPIPE) -+ while ((ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_DQBUF, &buf)) == -1) { -+ const int err = errno; -+ if (err == EINTR) -+ continue; -+ if (err != EAGAIN) { -+ // EPIPE on CAPTURE can be used instead of BUF_FLAG_LAST -+ if (err != EPIPE || !is_capture) - av_log(logger(ctx), AV_LOG_DEBUG, "%s VIDIOC_DQBUF, errno (%s)\n", -- ctx->name, av_err2str(AVERROR(errno))); -+ ctx->name, av_err2str(AVERROR(err))); -+ if (ctx_done(ctx) > 0) -+ goto start; - } - return NULL; - } -+ --ctx->q_count; -+ av_log(logger(ctx), AV_LOG_DEBUG, "--- %s VIDIOC_DQBUF OK: index=%d, ts=%ld.%06ld, count=%d, dq=%d\n", -+ ctx->name, buf.index, -+ buf.timestamp.tv_sec, buf.timestamp.tv_usec, -+ ctx->q_count, ++ctx->dq_count); -+ -+ avbuf = (V4L2Buffer *)ctx->bufrefs[buf.index]->data; -+ avbuf->status = V4L2BUF_AVAILABLE; -+ avbuf->buf = buf; -+ if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { -+ memcpy(avbuf->planes, planes, sizeof(planes)); -+ avbuf->buf.m.planes = avbuf->planes; -+ } - -- if (ctx_to_m2mctx(ctx)->draining && !V4L2_TYPE_IS_OUTPUT(ctx->type)) { -+ if (ctx_to_m2mctx(ctx)->draining && is_capture) { - int bytesused = V4L2_TYPE_IS_MULTIPLANAR(buf.type) ? - buf.m.planes[0].bytesused : buf.bytesused; - if (bytesused == 0) { -- ctx->done = 1; -+ av_log(logger(ctx), AV_LOG_DEBUG, "Buffer empty - reQ\n"); -+ -+ // Must reQ so we don't leak -+ // May not matter if the next thing we do is release all the -+ // buffers but better to be tidy. -+ ff_v4l2_buffer_enqueue(avbuf); -+ -+ if (ctx_done(ctx) > 0) -+ goto start; - return NULL; - } - #ifdef V4L2_BUF_FLAG_LAST -- if (buf.flags & V4L2_BUF_FLAG_LAST) -- ctx->done = 1; -+ if (buf.flags & V4L2_BUF_FLAG_LAST) { -+ av_log(logger(ctx), AV_LOG_TRACE, "FLAG_LAST set\n"); -+ avbuf->status = V4L2BUF_IN_USE; // Avoid flushing this buffer -+ ctx_done(ctx); -+ } - #endif - } - -- avbuf = &ctx->buffers[buf.index]; -- avbuf->status = V4L2BUF_AVAILABLE; -- avbuf->buf = buf; -- if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { -- memcpy(avbuf->planes, planes, sizeof(planes)); -- avbuf->buf.m.planes = avbuf->planes; -- } - return avbuf; - } - -@@ -443,8 +575,9 @@ static V4L2Buffer* v4l2_getfree_v4l2buf( - } - - for (i = 0; i < ctx->num_buffers; i++) { -- if (ctx->buffers[i].status == V4L2BUF_AVAILABLE) -- return &ctx->buffers[i]; -+ V4L2Buffer * const avbuf = (V4L2Buffer *)ctx->bufrefs[i]->data; -+ if (avbuf->status == V4L2BUF_AVAILABLE) -+ return avbuf; - } - - return NULL; -@@ -452,25 +585,45 @@ static V4L2Buffer* v4l2_getfree_v4l2buf( - - static int v4l2_release_buffers(V4L2Context* ctx) - { -- struct v4l2_requestbuffers req = { -- .memory = V4L2_MEMORY_MMAP, -- .type = ctx->type, -- .count = 0, /* 0 -> unmaps buffers from the driver */ -- }; -- int i, j; -+ int i; -+ int ret = 0; -+ const int fd = ctx_to_m2mctx(ctx)->fd; - -- for (i = 0; i < ctx->num_buffers; i++) { -- V4L2Buffer *buffer = &ctx->buffers[i]; -+ // Orphan any buffers in the wild -+ ff_weak_link_break(&ctx->wl_master); - -- for (j = 0; j < buffer->num_planes; j++) { -- struct V4L2Plane_info *p = &buffer->plane_info[j]; -- if (p->mm_addr && p->length) -- if (munmap(p->mm_addr, p->length) < 0) -- av_log(logger(ctx), AV_LOG_ERROR, "%s unmap plane (%s))\n", ctx->name, av_err2str(AVERROR(errno))); -+ if (ctx->bufrefs) { -+ for (i = 0; i < ctx->num_buffers; i++) -+ av_buffer_unref(ctx->bufrefs + i); -+ } -+ -+ if (fd != -1) { -+ struct v4l2_requestbuffers req = { -+ .memory = V4L2_MEMORY_MMAP, -+ .type = ctx->type, -+ .count = 0, /* 0 -> unmap all buffers from the driver */ -+ }; -+ -+ while ((ret = ioctl(fd, VIDIOC_REQBUFS, &req)) == -1) { -+ if (errno == EINTR) -+ continue; -+ -+ ret = AVERROR(errno); -+ -+ av_log(logger(ctx), AV_LOG_ERROR, "release all %s buffers (%s)\n", -+ ctx->name, av_err2str(AVERROR(errno))); -+ -+ if (ctx_to_m2mctx(ctx)->output_drm) -+ av_log(logger(ctx), AV_LOG_ERROR, -+ "Make sure the DRM client releases all FB/GEM objects before closing the codec (ie):\n" -+ "for all buffers: \n" -+ " 1. drmModeRmFB(..)\n" -+ " 2. drmIoctl(.., DRM_IOCTL_GEM_CLOSE,... )\n"); - } - } -+ ctx->q_count = 0; - -- return ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_REQBUFS, &req); -+ return ret; - } - - static inline int v4l2_try_raw_format(V4L2Context* ctx, enum AVPixelFormat pixfmt) -@@ -499,6 +652,8 @@ static inline int v4l2_try_raw_format(V4 - - static int v4l2_get_raw_format(V4L2Context* ctx, enum AVPixelFormat *p) - { -+ V4L2m2mContext* s = ctx_to_m2mctx(ctx); -+ V4L2m2mPriv *priv = s->avctx->priv_data; - enum AVPixelFormat pixfmt = ctx->av_pix_fmt; - struct v4l2_fmtdesc fdesc; - int ret; -@@ -517,6 +672,13 @@ static int v4l2_get_raw_format(V4L2Conte - if (ret) - return AVERROR(EINVAL); - -+ if (priv->pix_fmt != AV_PIX_FMT_NONE) { -+ if (fdesc.pixelformat != ff_v4l2_format_avfmt_to_v4l2(priv->pix_fmt)) { -+ fdesc.index++; -+ continue; -+ } -+ } -+ - pixfmt = ff_v4l2_format_v4l2_to_avfmt(fdesc.pixelformat, AV_CODEC_ID_RAWVIDEO); - ret = v4l2_try_raw_format(ctx, pixfmt); - if (ret){ -@@ -569,18 +731,77 @@ static int v4l2_get_coded_format(V4L2Con - * - *****************************************************************************/ - -+ -+static void flush_all_buffers_status(V4L2Context* const ctx) -+{ -+ int i; -+ -+ if (!ctx->bufrefs) -+ return; -+ -+ for (i = 0; i < ctx->num_buffers; ++i) { -+ struct V4L2Buffer * const buf = (struct V4L2Buffer *)ctx->bufrefs[i]->data; -+ if (buf->status == V4L2BUF_IN_DRIVER) -+ buf->status = V4L2BUF_AVAILABLE; -+ } -+ ctx->q_count = 0; -+} -+ -+static int stuff_all_buffers(AVCodecContext * avctx, V4L2Context* ctx) -+{ -+ int i; -+ int rv; -+ -+ if (!ctx->bufrefs) { -+ rv = ff_v4l2_context_init(ctx); -+ if (rv) { -+ av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n"); -+ return rv; -+ } -+ } -+ -+ for (i = 0; i < ctx->num_buffers; ++i) { -+ struct V4L2Buffer * const buf = (struct V4L2Buffer *)ctx->bufrefs[i]->data; -+ if (buf->status == V4L2BUF_AVAILABLE) { -+ rv = ff_v4l2_buffer_enqueue(buf); -+ if (rv < 0) -+ return rv; -+ } -+ } -+ return 0; -+} -+ - int ff_v4l2_context_set_status(V4L2Context* ctx, uint32_t cmd) - { - int type = ctx->type; - int ret; -+ AVCodecContext * const avctx = logger(ctx); -+ -+ ff_mutex_lock(&ctx->lock); -+ -+ if (cmd == VIDIOC_STREAMON && !V4L2_TYPE_IS_OUTPUT(ctx->type)) -+ stuff_all_buffers(avctx, ctx); - - ret = ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type); -- if (ret < 0) -- return AVERROR(errno); -+ if (ret < 0) { -+ const int err = errno; -+ av_log(avctx, AV_LOG_ERROR, "%s set status %d (%s) failed: err=%d\n", ctx->name, -+ cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF", err); -+ ret = AVERROR(err); -+ } -+ else -+ { -+ if (cmd == VIDIOC_STREAMOFF) -+ flush_all_buffers_status(ctx); - -- ctx->streamon = (cmd == VIDIOC_STREAMON); -+ ctx->streamon = (cmd == VIDIOC_STREAMON); -+ av_log(avctx, AV_LOG_DEBUG, "%s set status %d (%s) OK\n", ctx->name, -+ cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF"); -+ } - -- return 0; -+ ff_mutex_unlock(&ctx->lock); -+ -+ return ret; - } - - int ff_v4l2_context_enqueue_frame(V4L2Context* ctx, const AVFrame* frame) -@@ -608,7 +829,8 @@ int ff_v4l2_context_enqueue_frame(V4L2Co - return ff_v4l2_buffer_enqueue(avbuf); - } - --int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt) -+int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt, -+ const void * extdata, size_t extlen, int no_rescale_pts) - { - V4L2m2mContext *s = ctx_to_m2mctx(ctx); - V4L2Buffer* avbuf; -@@ -616,8 +838,9 @@ int ff_v4l2_context_enqueue_packet(V4L2C - - if (!pkt->size) { - ret = v4l2_stop_decode(ctx); -+ // Log but otherwise ignore stop failure - if (ret) -- av_log(logger(ctx), AV_LOG_ERROR, "%s stop_decode\n", ctx->name); -+ av_log(logger(ctx), AV_LOG_ERROR, "%s stop_decode failed: err=%d\n", ctx->name, ret); - s->draining = 1; - return 0; - } -@@ -626,14 +849,17 @@ int ff_v4l2_context_enqueue_packet(V4L2C - if (!avbuf) - return AVERROR(EAGAIN); - -- ret = ff_v4l2_buffer_avpkt_to_buf(pkt, avbuf); -- if (ret) -+ ret = ff_v4l2_buffer_avpkt_to_buf_ext(pkt, avbuf, extdata, extlen, no_rescale_pts); -+ if (ret == AVERROR(ENOMEM)) -+ av_log(logger(ctx), AV_LOG_ERROR, "Buffer overflow in %s: pkt->size=%d > buf->length=%d\n", -+ __func__, pkt->size, avbuf->planes[0].length); -+ else if (ret) - return ret; - - return ff_v4l2_buffer_enqueue(avbuf); - } - --int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame, int timeout) -+int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame, int timeout, int no_rescale_pts) - { - V4L2Buffer *avbuf; - -@@ -650,7 +876,7 @@ int ff_v4l2_context_dequeue_frame(V4L2Co - return AVERROR(EAGAIN); - } - -- return ff_v4l2_buffer_buf_to_avframe(frame, avbuf); -+ return ff_v4l2_buffer_buf_to_avframe(frame, avbuf, no_rescale_pts); - } - - int ff_v4l2_context_dequeue_packet(V4L2Context* ctx, AVPacket* pkt) -@@ -702,78 +928,155 @@ int ff_v4l2_context_get_format(V4L2Conte - - int ff_v4l2_context_set_format(V4L2Context* ctx) - { -- return ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_S_FMT, &ctx->format); -+ int ret; -+ -+ ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_S_FMT, &ctx->format); -+ if (ret != 0) -+ return ret; -+ -+ // Check returned size against min size and if smaller have another go -+ // Only worry about plane[0] as this is meant to enforce limits for -+ // encoded streams where we might know a bit more about the shape -+ // than the driver -+ if (V4L2_TYPE_IS_MULTIPLANAR(ctx->format.type)) { -+ if (ctx->min_buf_size <= ctx->format.fmt.pix_mp.plane_fmt[0].sizeimage) -+ return 0; -+ ctx->format.fmt.pix_mp.plane_fmt[0].sizeimage = ctx->min_buf_size; -+ } -+ else { -+ if (ctx->min_buf_size <= ctx->format.fmt.pix.sizeimage) -+ return 0; -+ ctx->format.fmt.pix.sizeimage = ctx->min_buf_size; -+ } -+ -+ ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_S_FMT, &ctx->format); -+ return ret; - } - - void ff_v4l2_context_release(V4L2Context* ctx) - { - int ret; - -- if (!ctx->buffers) -+ if (!ctx->bufrefs) - return; - - ret = v4l2_release_buffers(ctx); - if (ret) - av_log(logger(ctx), AV_LOG_WARNING, "V4L2 failed to unmap the %s buffers\n", ctx->name); - -- av_freep(&ctx->buffers); -+ av_freep(&ctx->bufrefs); -+ av_buffer_unref(&ctx->frames_ref); -+ -+ ff_mutex_destroy(&ctx->lock); - } - --int ff_v4l2_context_init(V4L2Context* ctx) -+ -+static int create_buffers(V4L2Context* const ctx, const unsigned int req_buffers) - { -- V4L2m2mContext *s = ctx_to_m2mctx(ctx); -+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); - struct v4l2_requestbuffers req; -- int ret, i; -- -- if (!v4l2_type_supported(ctx)) { -- av_log(logger(ctx), AV_LOG_ERROR, "type %i not supported\n", ctx->type); -- return AVERROR_PATCHWELCOME; -- } -- -- ret = ioctl(s->fd, VIDIOC_G_FMT, &ctx->format); -- if (ret) -- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT failed\n", ctx->name); -+ int ret; -+ int i; - - memset(&req, 0, sizeof(req)); -- req.count = ctx->num_buffers; -+ req.count = req_buffers; - req.memory = V4L2_MEMORY_MMAP; - req.type = ctx->type; -- ret = ioctl(s->fd, VIDIOC_REQBUFS, &req); -- if (ret < 0) { -- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_REQBUFS failed: %s\n", ctx->name, strerror(errno)); -- return AVERROR(errno); -+ while ((ret = ioctl(s->fd, VIDIOC_REQBUFS, &req)) == -1) { -+ if (errno != EINTR) { -+ ret = AVERROR(errno); -+ av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_REQBUFS failed: %s\n", ctx->name, av_err2str(ret)); -+ return ret; -+ } - } - - ctx->num_buffers = req.count; -- ctx->buffers = av_mallocz(ctx->num_buffers * sizeof(V4L2Buffer)); -- if (!ctx->buffers) { -+ ctx->bufrefs = av_mallocz(ctx->num_buffers * sizeof(*ctx->bufrefs)); -+ if (!ctx->bufrefs) { - av_log(logger(ctx), AV_LOG_ERROR, "%s malloc enomem\n", ctx->name); -- return AVERROR(ENOMEM); -+ goto fail_release; - } - -- for (i = 0; i < req.count; i++) { -- ctx->buffers[i].context = ctx; -- ret = ff_v4l2_buffer_initialize(&ctx->buffers[i], i); -- if (ret < 0) { -+ ctx->wl_master = ff_weak_link_new(ctx); -+ if (!ctx->wl_master) { -+ ret = AVERROR(ENOMEM); -+ goto fail_release; -+ } -+ -+ for (i = 0; i < ctx->num_buffers; i++) { -+ ret = ff_v4l2_buffer_initialize(&ctx->bufrefs[i], i, ctx); -+ if (ret) { - av_log(logger(ctx), AV_LOG_ERROR, "%s buffer[%d] initialization (%s)\n", ctx->name, i, av_err2str(ret)); -- goto error; -+ goto fail_release; - } - } - - av_log(logger(ctx), AV_LOG_DEBUG, "%s: %s %02d buffers initialized: %04ux%04u, sizeimage %08u, bytesperline %08u\n", ctx->name, - V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? av_fourcc2str(ctx->format.fmt.pix_mp.pixelformat) : av_fourcc2str(ctx->format.fmt.pix.pixelformat), - req.count, -- v4l2_get_width(&ctx->format), -- v4l2_get_height(&ctx->format), -+ ff_v4l2_get_format_width(&ctx->format), -+ ff_v4l2_get_format_height(&ctx->format), - V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? ctx->format.fmt.pix_mp.plane_fmt[0].sizeimage : ctx->format.fmt.pix.sizeimage, - V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? ctx->format.fmt.pix_mp.plane_fmt[0].bytesperline : ctx->format.fmt.pix.bytesperline); - - return 0; - --error: -+fail_release: - v4l2_release_buffers(ctx); -+ av_freep(&ctx->bufrefs); -+ return ret; -+} -+ -+int ff_v4l2_context_init(V4L2Context* ctx) -+{ -+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); -+ int ret; -+ -+ // It is not valid to reinit a context without a previous release -+ av_assert0(ctx->bufrefs == NULL); -+ -+ if (!v4l2_type_supported(ctx)) { -+ av_log(logger(ctx), AV_LOG_ERROR, "type %i not supported\n", ctx->type); -+ return AVERROR_PATCHWELCOME; -+ } - -- av_freep(&ctx->buffers); -+ ff_mutex_init(&ctx->lock, NULL); -+ -+ if (s->output_drm) { -+ AVHWFramesContext *hwframes; -+ -+ ctx->frames_ref = av_hwframe_ctx_alloc(s->device_ref); -+ if (!ctx->frames_ref) { -+ ret = AVERROR(ENOMEM); -+ goto fail_unlock; -+ } -+ -+ hwframes = (AVHWFramesContext*)ctx->frames_ref->data; -+ hwframes->format = AV_PIX_FMT_DRM_PRIME; -+ hwframes->sw_format = ctx->av_pix_fmt; -+ hwframes->width = ctx->width; -+ hwframes->height = ctx->height; -+ ret = av_hwframe_ctx_init(ctx->frames_ref); -+ if (ret < 0) -+ goto fail_unref_hwframes; -+ } -+ -+ ret = ioctl(s->fd, VIDIOC_G_FMT, &ctx->format); -+ if (ret) { -+ ret = AVERROR(errno); -+ av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT failed: %s\n", ctx->name, av_err2str(ret)); -+ goto fail_unref_hwframes; -+ } -+ -+ ret = create_buffers(ctx, ctx->num_buffers); -+ if (ret < 0) -+ goto fail_unref_hwframes; -+ -+ return 0; - -+fail_unref_hwframes: -+ av_buffer_unref(&ctx->frames_ref); -+fail_unlock: -+ ff_mutex_destroy(&ctx->lock); - return ret; - } ---- a/libavcodec/v4l2_context.h -+++ b/libavcodec/v4l2_context.h -@@ -31,6 +31,7 @@ - #include "libavutil/pixfmt.h" - #include "libavutil/frame.h" - #include "libavutil/buffer.h" -+#include "libavutil/thread.h" - #include "v4l2_buffers.h" - - typedef struct V4L2Context { -@@ -70,11 +71,18 @@ typedef struct V4L2Context { - */ - int width, height; - AVRational sample_aspect_ratio; -+ struct v4l2_rect selection; - - /** -- * Indexed array of V4L2Buffers -+ * If the default size of buffer is less than this then try to -+ * set to this. - */ -- V4L2Buffer *buffers; -+ uint32_t min_buf_size; -+ -+ /** -+ * Indexed array of pointers to V4L2Buffers -+ */ -+ AVBufferRef **bufrefs; - - /** - * Readonly after init. -@@ -92,6 +100,12 @@ typedef struct V4L2Context { - */ - int done; - -+ AVBufferRef *frames_ref; -+ int q_count; -+ int dq_count; -+ struct ff_weak_link_master *wl_master; -+ -+ AVMutex lock; - } V4L2Context; - - /** -@@ -156,9 +170,12 @@ int ff_v4l2_context_dequeue_packet(V4L2C - * @param[in] ctx The V4L2Context to dequeue from. - * @param[inout] f The AVFrame to dequeue to. - * @param[in] timeout The timeout for dequeue (-1 to block, 0 to return immediately, or milliseconds) -+ * @param[in] no_rescale_pts (0 rescale pts, 1 use pts as -+ * timestamp directly) -+ * - * @return 0 in case of success, AVERROR(EAGAIN) if no buffer was ready, another negative error in case of error. - */ --int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* f, int timeout); -+int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* f, int timeout, int no_rescale_pts); - - /** - * Enqueues a buffer to a V4L2Context from an AVPacket -@@ -170,7 +187,7 @@ int ff_v4l2_context_dequeue_frame(V4L2Co - * @param[in] pkt A pointer to an AVPacket. - * @return 0 in case of success, a negative error otherwise. - */ --int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt); -+int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt, const void * ext_data, size_t ext_size, int no_rescale_pts); - - /** - * Enqueues a buffer to a V4L2Context from an AVFrame ---- a/libavcodec/v4l2_m2m.c -+++ b/libavcodec/v4l2_m2m.c -@@ -215,13 +215,7 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mCont - av_log(log_ctx, AV_LOG_ERROR, "capture VIDIOC_STREAMOFF\n"); - - /* 2. unmap the capture buffers (v4l2 and ffmpeg): -- * we must wait for all references to be released before being allowed -- * to queue new buffers. - */ -- av_log(log_ctx, AV_LOG_DEBUG, "waiting for user to release AVBufferRefs\n"); -- if (atomic_load(&s->refcount)) -- while(sem_wait(&s->refsync) == -1 && errno == EINTR); -- - ff_v4l2_context_release(&s->capture); - - /* 3. get the new capture format */ -@@ -328,7 +322,10 @@ static void v4l2_m2m_destroy_context(voi - ff_v4l2_context_release(&s->capture); - sem_destroy(&s->refsync); - -- close(s->fd); -+ if (s->fd != -1) -+ close(s->fd); -+ -+ av_log(s->avctx, AV_LOG_DEBUG, "V4L2 Context destroyed\n"); - - av_free(s); - } -@@ -338,17 +335,34 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *p - V4L2m2mContext *s = priv->context; - int ret; - -- ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF); -- if (ret) -- av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name); -+ if (!s) -+ return 0; - -- ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); -- if (ret) -- av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name); -+ av_log(s->avctx, AV_LOG_DEBUG, "V4L2 Codec end\n"); -+ -+ if (av_codec_is_decoder(s->avctx->codec)) -+ av_packet_unref(&s->buf_pkt); -+ -+ if (s->fd >= 0) { -+ ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF); -+ if (ret) -+ av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name); -+ -+ ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); -+ if (ret) -+ av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name); -+ } - - ff_v4l2_context_release(&s->output); - -+ close(s->fd); -+ s->fd = -1; -+ - s->self_ref = NULL; -+ // This is only called on avctx close so after this point we don't have that -+ // Crash sooner if we find we are using it (can still log with avctx = NULL) -+ s->avctx = NULL; -+ priv->context = NULL; - av_buffer_unref(&priv->context_ref); - - return 0; ---- a/libavcodec/v4l2_m2m.h -+++ b/libavcodec/v4l2_m2m.h -@@ -30,6 +30,7 @@ - #include - - #include "libavcodec/avcodec.h" -+#include "libavutil/pixfmt.h" - #include "v4l2_context.h" - - #define container_of(ptr, type, member) ({ \ -@@ -38,7 +39,18 @@ - - #define V4L_M2M_DEFAULT_OPTS \ - { "num_output_buffers", "Number of buffers in the output context",\ -- OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 6, INT_MAX, FLAGS } -+ OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 2, INT_MAX, FLAGS } -+ -+#define FF_V4L2_M2M_TRACK_SIZE 128 -+typedef struct V4L2m2mTrackEl { -+ int discard; // If we see this buffer its been flushed, so discard -+ int pkt_size; -+ int64_t pts; -+ int64_t reordered_opaque; -+ int64_t pkt_pos; -+ int64_t pkt_duration; -+ int64_t track_pts; -+} V4L2m2mTrackEl; - - typedef struct V4L2m2mContext { - char devname[PATH_MAX]; -@@ -53,6 +65,7 @@ typedef struct V4L2m2mContext { - sem_t refsync; - atomic_uint refcount; - int reinit; -+ int resize_pending; - - /* null frame/packet received */ - int draining; -@@ -63,6 +76,23 @@ typedef struct V4L2m2mContext { - - /* reference back to V4L2m2mPriv */ - void *priv; -+ -+ AVBufferRef *device_ref; -+ -+ /* generate DRM frames */ -+ int output_drm; -+ -+ /* Frame tracking */ -+ int64_t last_pkt_dts; -+ int64_t last_opaque; -+ unsigned int track_no; -+ V4L2m2mTrackEl track_els[FF_V4L2_M2M_TRACK_SIZE]; -+ -+ /* req pkt */ -+ int req_pkt; -+ -+ /* Ext data sent */ -+ int extdata_sent; - } V4L2m2mContext; - - typedef struct V4L2m2mPriv { -@@ -73,6 +103,7 @@ typedef struct V4L2m2mPriv { - - int num_output_buffers; - int num_capture_buffers; -+ enum AVPixelFormat pix_fmt; - } V4L2m2mPriv; - - /** -@@ -126,4 +157,16 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mCont - */ - int ff_v4l2_m2m_codec_full_reinit(V4L2m2mContext *ctx); - -+ -+static inline unsigned int ff_v4l2_get_format_width(struct v4l2_format *fmt) -+{ -+ return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.width : fmt->fmt.pix.width; -+} -+ -+static inline unsigned int ff_v4l2_get_format_height(struct v4l2_format *fmt) -+{ -+ return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.height : fmt->fmt.pix.height; -+} -+ -+ - #endif /* AVCODEC_V4L2_M2M_H */ ---- a/libavcodec/v4l2_m2m_dec.c -+++ b/libavcodec/v4l2_m2m_dec.c -@@ -23,6 +23,10 @@ - - #include - #include -+ -+#include "libavutil/avassert.h" -+#include "libavutil/hwcontext.h" -+#include "libavutil/hwcontext_drm.h" - #include "libavutil/pixfmt.h" - #include "libavutil/pixdesc.h" - #include "libavutil/opt.h" -@@ -30,26 +34,51 @@ - #include "libavcodec/decode.h" - #include "libavcodec/internal.h" - -+#include "libavcodec/hwaccels.h" -+#include "libavcodec/internal.h" -+#include "libavcodec/hwconfig.h" -+ - #include "v4l2_context.h" - #include "v4l2_m2m.h" - #include "v4l2_fmt.h" - -+static int check_output_streamon(AVCodecContext *const avctx, V4L2m2mContext *const s) -+{ -+ int ret; -+ struct v4l2_decoder_cmd cmd = { -+ .cmd = V4L2_DEC_CMD_START, -+ .flags = 0, -+ }; -+ -+ if (s->output.streamon) -+ return 0; -+ -+ ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMON); -+ if (ret < 0) -+ av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMON on output context\n"); -+ -+ if (!s->capture.streamon || ret < 0) -+ return ret; -+ -+ ret = ioctl(s->fd, VIDIOC_DECODER_CMD, &cmd); -+ if (ret < 0) -+ av_log(avctx, AV_LOG_ERROR, "VIDIOC_DECODER_CMD start error: %d\n", errno); -+ else -+ av_log(avctx, AV_LOG_DEBUG, "VIDIOC_DECODER_CMD start OK\n"); -+ -+ return ret; -+} -+ - static int v4l2_try_start(AVCodecContext *avctx) - { - V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context; - V4L2Context *const capture = &s->capture; -- V4L2Context *const output = &s->output; - struct v4l2_selection selection = { 0 }; - int ret; - - /* 1. start the output process */ -- if (!output->streamon) { -- ret = ff_v4l2_context_set_status(output, VIDIOC_STREAMON); -- if (ret < 0) { -- av_log(avctx, AV_LOG_DEBUG, "VIDIOC_STREAMON on output context\n"); -- return ret; -- } -- } -+ if ((ret = check_output_streamon(avctx, s)) != 0) -+ return ret; - - if (capture->streamon) - return 0; -@@ -63,15 +92,29 @@ static int v4l2_try_start(AVCodecContext - } - - /* 2.1 update the AVCodecContext */ -- avctx->pix_fmt = ff_v4l2_format_v4l2_to_avfmt(capture->format.fmt.pix_mp.pixelformat, AV_CODEC_ID_RAWVIDEO); -- capture->av_pix_fmt = avctx->pix_fmt; -+ capture->av_pix_fmt = -+ ff_v4l2_format_v4l2_to_avfmt(capture->format.fmt.pix_mp.pixelformat, AV_CODEC_ID_RAWVIDEO); -+ if (s->output_drm) { -+ avctx->pix_fmt = AV_PIX_FMT_DRM_PRIME; -+ avctx->sw_pix_fmt = capture->av_pix_fmt; -+ } -+ else -+ avctx->pix_fmt = capture->av_pix_fmt; - - /* 3. set the crop parameters */ -+#if 1 -+ selection.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ selection.target = V4L2_SEL_TGT_CROP_DEFAULT; -+ ret = ioctl(s->fd, VIDIOC_G_SELECTION, &selection); -+ av_log(avctx, AV_LOG_INFO, "Post G selection ret=%d, err=%d %dx%d\n", ret, errno, selection.r.width, selection.r.height); -+#else - selection.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - selection.r.height = avctx->coded_height; - selection.r.width = avctx->coded_width; -+ av_log(avctx, AV_LOG_INFO, "Try selection %dx%d\n", avctx->coded_width, avctx->coded_height); - ret = ioctl(s->fd, VIDIOC_S_SELECTION, &selection); -- if (!ret) { -+ av_log(avctx, AV_LOG_INFO, "Post S selection ret=%d, err=%d %dx%d\n", ret, errno, selection.r.width, selection.r.height); -+ if (1) { - ret = ioctl(s->fd, VIDIOC_G_SELECTION, &selection); - if (ret) { - av_log(avctx, AV_LOG_WARNING, "VIDIOC_G_SELECTION ioctl\n"); -@@ -82,15 +125,7 @@ static int v4l2_try_start(AVCodecContext - capture->width = selection.r.width; - } - } -- -- /* 4. init the capture context now that we have the capture format */ -- if (!capture->buffers) { -- ret = ff_v4l2_context_init(capture); -- if (ret) { -- av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n"); -- return AVERROR(ENOMEM); -- } -- } -+#endif - - /* 5. start the capture process */ - ret = ff_v4l2_context_set_status(capture, VIDIOC_STREAMON); -@@ -133,52 +168,312 @@ static int v4l2_prepare_decoder(V4L2m2mC - return 0; - } - --static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) -+static inline int64_t track_to_pts(AVCodecContext *avctx, unsigned int n) -+{ -+ return (int64_t)n; -+} -+ -+static inline unsigned int pts_to_track(AVCodecContext *avctx, const int64_t pts) -+{ -+ return (unsigned int)pts; -+} -+ -+// FFmpeg requires us to propagate a number of vars from the coded pkt into -+// the decoded frame. The only thing that tracks like that in V4L2 stateful -+// is timestamp. PTS maps to timestamp for this decode. FFmpeg makes no -+// guarantees about PTS being unique or specified for every frame so replace -+// the supplied PTS with a simple incrementing number and keep a circular -+// buffer of all the things we want preserved (including the original PTS) -+// indexed by the tracking no. -+static void -+xlat_pts_in(AVCodecContext *const avctx, V4L2m2mContext *const s, AVPacket *const avpkt) -+{ -+ int64_t track_pts; -+ -+ // Avoid 0 -+ if (++s->track_no == 0) -+ s->track_no = 1; -+ -+ track_pts = track_to_pts(avctx, s->track_no); -+ -+ av_log(avctx, AV_LOG_TRACE, "In PTS=%" PRId64 ", DTS=%" PRId64 ", track=%" PRId64 ", n=%u\n", avpkt->pts, avpkt->dts, track_pts, s->track_no); -+ s->last_pkt_dts = avpkt->dts; -+ s->track_els[s->track_no % FF_V4L2_M2M_TRACK_SIZE] = (V4L2m2mTrackEl){ -+ .discard = 0, -+ .pkt_size = avpkt->size, -+ .pts = avpkt->pts, -+ .reordered_opaque = avctx->reordered_opaque, -+ .pkt_pos = avpkt->pos, -+ .pkt_duration = avpkt->duration, -+ .track_pts = track_pts -+ }; -+ avpkt->pts = track_pts; -+} -+ -+// Returns -1 if we should discard the frame -+static int -+xlat_pts_out(AVCodecContext *const avctx, V4L2m2mContext *const s, AVFrame *const frame) -+{ -+ unsigned int n = pts_to_track(avctx, frame->pts) % FF_V4L2_M2M_TRACK_SIZE; -+ const V4L2m2mTrackEl *const t = s->track_els + n; -+ if (frame->pts == AV_NOPTS_VALUE || frame->pts != t->track_pts) -+ { -+ av_log(avctx, AV_LOG_INFO, "Tracking failure: pts=%" PRId64 ", track[%d]=%" PRId64 "\n", frame->pts, n, t->track_pts); -+ frame->pts = AV_NOPTS_VALUE; -+ frame->pkt_dts = s->last_pkt_dts; -+ frame->reordered_opaque = s->last_opaque; -+ frame->pkt_pos = -1; -+ frame->pkt_duration = 0; -+ frame->pkt_size = -1; -+ } -+ else if (!t->discard) -+ { -+ frame->pts = t->pts; -+ frame->pkt_dts = s->last_pkt_dts; -+ frame->reordered_opaque = t->reordered_opaque; -+ frame->pkt_pos = t->pkt_pos; -+ frame->pkt_duration = t->pkt_duration; -+ frame->pkt_size = t->pkt_size; -+ -+ s->last_opaque = s->track_els[n].reordered_opaque; -+ s->track_els[n].pts = AV_NOPTS_VALUE; // If we hit this again deny accurate knowledge of PTS -+ } -+ else -+ { -+ av_log(avctx, AV_LOG_DEBUG, "Discard frame (flushed): pts=%" PRId64 ", track[%d]=%" PRId64 "\n", frame->pts, n, t->track_pts); -+ return -1; -+ } -+ -+#if FF_API_PKT_PTS -+FF_DISABLE_DEPRECATION_WARNINGS -+ frame->pkt_pts = frame->pts; -+FF_ENABLE_DEPRECATION_WARNINGS -+#endif -+ frame->best_effort_timestamp = frame->pts; -+ frame->pkt_dts = frame->pts; // We can't emulate what s/w does in a useful manner? -+ av_log(avctx, AV_LOG_TRACE, "Out PTS=%" PRId64 ", DTS=%" PRId64 "\n", frame->pts, frame->pkt_dts); -+ return 0; -+} -+ -+static inline int stream_started(const V4L2m2mContext * const s) { -+ return s->capture.streamon && s->output.streamon; -+} -+ -+#define NQ_OK 0 -+#define NQ_Q_FULL 1 -+#define NQ_SRC_EMPTY 2 -+#define NQ_DRAINING 3 -+#define NQ_DEAD 4 -+ -+#define TRY_DQ(nq_status) ((nq_status) >= NQ_OK && (nq_status) <= NQ_DRAINING) -+ -+// AVERROR_EOF Flushing an already flushed stream -+// -ve Error (all errors except EOF are unexpected) -+// NQ_OK (0) OK -+// NQ_Q_FULL Dst full (retry if we think V4L2 Q has space now) -+// NQ_SRC_EMPTY Src empty (do not retry) -+// NQ_DRAINING At EOS, dQ dest until EOS there too -+// NQ_DEAD Not running (do not retry, do not attempt capture dQ) -+ -+static int try_enqueue_src(AVCodecContext * const avctx, V4L2m2mContext * const s) - { -- V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context; -- V4L2Context *const capture = &s->capture; -- V4L2Context *const output = &s->output; -- AVPacket avpkt = {0}; - int ret; - -- if (s->buf_pkt.size) { -- avpkt = s->buf_pkt; -- memset(&s->buf_pkt, 0, sizeof(AVPacket)); -- } else { -- ret = ff_decode_get_packet(avctx, &avpkt); -- if (ret < 0 && ret != AVERROR_EOF) -+ // If we don't already have a coded packet - get a new one -+ // We will already have a coded pkt if the output Q was full last time we -+ // tried to Q it -+ if (!s->buf_pkt.size) { -+ ret = ff_decode_get_packet(avctx, &s->buf_pkt); -+ -+ if (ret == AVERROR(EAGAIN)) { -+ if (!stream_started(s)) { -+ av_log(avctx, AV_LOG_TRACE, "%s: receive_frame before 1st coded packet\n", __func__); -+ return NQ_DEAD; -+ } -+ return NQ_SRC_EMPTY; -+ } -+ -+ if (ret == AVERROR_EOF) { -+ // EOF - enter drain mode -+ av_log(avctx, AV_LOG_TRACE, "--- EOS req: ret=%d, size=%d, started=%d, drain=%d\n", -+ ret, s->buf_pkt.size, stream_started(s), s->draining); -+ if (!stream_started(s)) { -+ av_log(avctx, AV_LOG_DEBUG, "EOS on flushed stream\n"); -+ s->draining = 1; -+ s->capture.done = 1; -+ return AVERROR_EOF; -+ } -+ -+ if (!s->draining) { -+ // Calling enqueue with an empty pkt starts drain -+ av_assert0(s->buf_pkt.size == 0); -+ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, NULL, 0, 1); -+ if (ret) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to start drain: ret=%d\n", ret); -+ return ret; -+ } -+ } -+ return NQ_DRAINING; -+ } -+ -+ if (ret < 0) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to get coded packet: err=%d\n", ret); - return ret; -+ } -+ -+ xlat_pts_in(avctx, s, &s->buf_pkt); - } - -- if (s->draining) -- goto dequeue; -+ if ((ret = check_output_streamon(avctx, s)) != 0) -+ return ret; - -- ret = ff_v4l2_context_enqueue_packet(output, &avpkt); -- if (ret < 0) { -- if (ret != AVERROR(EAGAIN)) -- return ret; -+ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, -+ avctx->extradata, s->extdata_sent ? 0 : avctx->extradata_size, -+ 1); -+ -+ if (ret == AVERROR(EAGAIN)) { -+ // Out of input buffers - keep packet -+ ret = NQ_Q_FULL; -+ } -+ else { -+ // In all other cases we are done with this packet -+ av_packet_unref(&s->buf_pkt); -+ s->extdata_sent = 1; - -- s->buf_pkt = avpkt; -- /* no input buffers available, continue dequeing */ -+ if (ret) { -+ av_log(avctx, AV_LOG_ERROR, "Packet enqueue failure: err=%d\n", ret); -+ return ret; -+ } - } - -- if (avpkt.size) { -- ret = v4l2_try_start(avctx); -- if (ret) { -- av_packet_unref(&avpkt); -+ // Start if we haven't -+ { -+ const int ret2 = v4l2_try_start(avctx); -+ if (ret2) { -+ av_log(avctx, AV_LOG_DEBUG, "Start failure: err=%d\n", ret2); -+ ret = (ret2 == AVERROR(ENOMEM)) ? ret2 : NQ_DEAD; -+ } -+ } - -- /* cant recover */ -- if (ret == AVERROR(ENOMEM)) -- return ret; -+ return ret; -+} - -- return 0; -+static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) -+{ -+ V4L2m2mContext *const s = ((V4L2m2mPriv*)avctx->priv_data)->context; -+ int src_rv; -+ int dst_rv = 1; // Non-zero (done), non-negative (error) number -+ -+ do { -+ src_rv = try_enqueue_src(avctx, s); -+ -+ // If we got a frame last time and we have nothing to enqueue then -+ // return now. rv will be AVERROR(EAGAIN) indicating that we want more input -+ // This should mean that once decode starts we enter a stable state where -+ // we alternately ask for input and produce output -+ if (s->req_pkt && src_rv == NQ_SRC_EMPTY) -+ break; -+ -+ if (src_rv == NQ_Q_FULL && dst_rv == AVERROR(EAGAIN)) { -+ av_log(avctx, AV_LOG_WARNING, "Poll says src Q has space but enqueue fail"); -+ src_rv = NQ_SRC_EMPTY; // If we can't enqueue pretend that there is nothing to enqueue -+ } -+ -+ // Try to get a new frame if -+ // (a) we haven't already got one AND -+ // (b) enqueue returned a status indicating that decode should be attempted -+ if (dst_rv != 0 && TRY_DQ(src_rv)) { -+ do { -+ // Dequeue frame will unref any previous contents of frame -+ // if it returns success so we don't need an explicit unref -+ // when discarding -+ // This returns AVERROR(EAGAIN) if there isn't a frame ready yet -+ // but there is room in the input Q -+ dst_rv = ff_v4l2_context_dequeue_frame(&s->capture, frame, -1, 1); -+ -+ if (dst_rv == AVERROR_EOF && (s->draining || s->capture.done)) -+ av_log(avctx, AV_LOG_DEBUG, "Dequeue EOF: draining=%d, cap.done=%d\n", -+ s->draining, s->capture.done); -+ else if (dst_rv && dst_rv != AVERROR(EAGAIN)) -+ av_log(avctx, AV_LOG_ERROR, "Packet dequeue failure: draining=%d, cap.done=%d, err=%d\n", -+ s->draining, s->capture.done, dst_rv); -+ -+ // Go again if we got a frame that we need to discard -+ } while (dst_rv == 0 && xlat_pts_out(avctx, s, frame)); -+ } -+ -+ // Continue trying to enqueue packets if either -+ // (a) we succeeded last time OR -+ // (b) enqueue failed due to input Q full AND there is now room -+ } while (src_rv == NQ_OK || (src_rv == NQ_Q_FULL && dst_rv == AVERROR(EAGAIN)) ); -+ -+ // Ensure that the frame contains nothing if we aren't returning a frame -+ // (might happen when discarding) -+ if (dst_rv) -+ av_frame_unref(frame); -+ -+ // If we got a frame this time ask for a pkt next time -+ s->req_pkt = (dst_rv == 0); -+ -+#if 0 -+ if (dst_rv == 0) -+ { -+ static int z = 0; -+ if (++z > 50) { -+ av_log(avctx, AV_LOG_ERROR, "Streamoff and die?\n"); -+ ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); -+ return -1; - } - } -+#endif -+ -+ return dst_rv == 0 ? 0 : -+ src_rv < 0 ? src_rv : -+ dst_rv < 0 ? dst_rv : -+ AVERROR(EAGAIN); -+} -+ -+#if 0 -+#include -+static int64_t us_time(void) -+{ -+ struct timespec ts; -+ clock_gettime(CLOCK_MONOTONIC, &ts); -+ return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; -+} -+ -+static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) -+{ -+ int ret; -+ const int64_t now = us_time(); -+ int64_t done; -+ av_log(avctx, AV_LOG_TRACE, "<<< %s\n", __func__); -+ ret = v4l2_receive_frame2(avctx, frame); -+ done = us_time(); -+ av_log(avctx, AV_LOG_TRACE, ">>> %s: rx time=%" PRId64 ", rv=%d\n", __func__, done - now, ret); -+ return ret; -+} -+#endif -+ -+static uint32_t max_coded_size(const AVCodecContext * const avctx) -+{ -+ uint32_t wxh = avctx->coded_width * avctx->coded_height; -+ uint32_t size; - --dequeue: -- if (!s->buf_pkt.size) -- av_packet_unref(&avpkt); -- return ff_v4l2_context_dequeue_frame(capture, frame, -1); -+ // Currently the only thing we try to set our own limits for is H264 -+ if (avctx->codec_id != AV_CODEC_ID_H264) -+ return 0; -+ -+ size = wxh * 3 / 2; -+ // H.264 Annex A table A-1 gives minCR which is either 2 or 4 -+ // unfortunately that doesn't yield an actually useful limit -+ // and it should be noted that frame 0 is special cased to allow -+ // a bigger number which really isn't helpful for us. So just pick -+ // frame_size / 2 -+ size /= 2; -+ // Add 64k to allow for any overheads and/or encoder hopefulness -+ // with small WxH -+ return size + (1 << 16); - } - - static av_cold int v4l2_decode_init(AVCodecContext *avctx) -@@ -186,8 +481,12 @@ static av_cold int v4l2_decode_init(AVCo - V4L2Context *capture, *output; - V4L2m2mContext *s; - V4L2m2mPriv *priv = avctx->priv_data; -+ int gf_pix_fmt; - int ret; - -+ av_log(avctx, AV_LOG_TRACE, "<<< %s\n", __func__); -+ -+ av_log(avctx, AV_LOG_INFO, "level=%d\n", avctx->level); - ret = ff_v4l2_m2m_create_context(priv, &s); - if (ret < 0) - return ret; -@@ -204,17 +503,43 @@ static av_cold int v4l2_decode_init(AVCo - - output->av_codec_id = avctx->codec_id; - output->av_pix_fmt = AV_PIX_FMT_NONE; -+ output->min_buf_size = max_coded_size(avctx); - - capture->av_codec_id = AV_CODEC_ID_RAWVIDEO; - capture->av_pix_fmt = avctx->pix_fmt; -+ capture->min_buf_size = 0; -+ -+ /* the client requests the codec to generate DRM frames: -+ * - data[0] will therefore point to the returned AVDRMFrameDescriptor -+ * check the ff_v4l2_buffer_to_avframe conversion function. -+ * - the DRM frame format is passed in the DRM frame descriptor layer. -+ * check the v4l2_get_drm_frame function. -+ */ -+ -+ gf_pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); -+ av_log(avctx, AV_LOG_DEBUG, "avctx requested=%d (%s); get_format requested=%d (%s)\n", -+ avctx->pix_fmt, av_get_pix_fmt_name(avctx->pix_fmt), gf_pix_fmt, av_get_pix_fmt_name(gf_pix_fmt)); -+ -+ s->output_drm = 0; -+ if (gf_pix_fmt == AV_PIX_FMT_DRM_PRIME || avctx->pix_fmt == AV_PIX_FMT_DRM_PRIME) { -+ avctx->pix_fmt = AV_PIX_FMT_DRM_PRIME; -+ s->output_drm = 1; -+ } -+ -+ s->device_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_DRM); -+ if (!s->device_ref) { -+ ret = AVERROR(ENOMEM); -+ return ret; -+ } -+ -+ ret = av_hwdevice_ctx_init(s->device_ref); -+ if (ret < 0) -+ return ret; - - s->avctx = avctx; - ret = ff_v4l2_m2m_codec_init(priv); - if (ret) { - av_log(avctx, AV_LOG_ERROR, "can't configure decoder\n"); -- s->self_ref = NULL; -- av_buffer_unref(&priv->context_ref); -- - return ret; - } - -@@ -223,10 +548,53 @@ static av_cold int v4l2_decode_init(AVCo - - static av_cold int v4l2_decode_close(AVCodecContext *avctx) - { -- V4L2m2mPriv *priv = avctx->priv_data; -- V4L2m2mContext *s = priv->context; -- av_packet_unref(&s->buf_pkt); -- return ff_v4l2_m2m_codec_end(priv); -+ int rv; -+ av_log(avctx, AV_LOG_TRACE, "<<< %s\n", __func__); -+ rv = ff_v4l2_m2m_codec_end(avctx->priv_data); -+ av_log(avctx, AV_LOG_TRACE, ">>> %s: rv=%d\n", __func__, rv); -+ return rv; -+} -+ -+static void v4l2_decode_flush(AVCodecContext *avctx) -+{ -+ // An alternatve and more drastic form of flush is to simply do this: -+ // v4l2_decode_close(avctx); -+ // v4l2_decode_init(avctx); -+ // The downside is that this keeps a decoder open until all the frames -+ // associated with it have been returned. This is a bit wasteful on -+ // possibly limited h/w resources and fails on a Pi for this reason unless -+ // more GPU mem is allocated than is the default. -+ -+ V4L2m2mPriv * const priv = avctx->priv_data; -+ V4L2m2mContext * const s = priv->context; -+ V4L2Context * const output = &s->output; -+ V4L2Context * const capture = &s->capture; -+ int ret, i; -+ -+ av_log(avctx, AV_LOG_TRACE, "<<< %s: streamon=%d\n", __func__, output->streamon); -+ -+ // Reflushing everything is benign, quick and avoids having to worry about -+ // states like EOS processing so don't try to optimize out (having got it -+ // wrong once) -+ -+ ret = ff_v4l2_context_set_status(output, VIDIOC_STREAMOFF); -+ if (ret < 0) -+ av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s error: %d\n", output->name, ret); -+ -+ // V4L2 makes no guarantees about whether decoded frames are flushed or not -+ // so mark all frames we are tracking to be discarded if they appear -+ for (i = 0; i != FF_V4L2_M2M_TRACK_SIZE; ++i) -+ s->track_els[i].discard = 1; -+ -+ // resend extradata -+ s->extdata_sent = 0; -+ // clear EOS status vars -+ s->draining = 0; -+ output->done = 0; -+ capture->done = 0; -+ -+ // Stream on will occur when we actually submit a new frame -+ av_log(avctx, AV_LOG_TRACE, ">>> %s\n", __func__); - } - - #define OFFSET(x) offsetof(V4L2m2mPriv, x) -@@ -235,10 +603,16 @@ static av_cold int v4l2_decode_close(AVC - static const AVOption options[] = { - V4L_M2M_DEFAULT_OPTS, - { "num_capture_buffers", "Number of buffers in the capture context", -- OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = 20}, 20, INT_MAX, FLAGS }, -+ OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = 20}, 2, INT_MAX, FLAGS }, -+ { "pixel_format", "Pixel format to be used by the decoder", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, AV_PIX_FMT_NONE, AV_PIX_FMT_NB, FLAGS }, - { NULL}, - }; - -+static const AVCodecHWConfigInternal *v4l2_m2m_hw_configs[] = { -+ HW_CONFIG_INTERNAL(DRM_PRIME), -+ NULL -+}; -+ - #define M2MDEC_CLASS(NAME) \ - static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \ - .class_name = #NAME "_v4l2m2m_decoder", \ -@@ -259,9 +633,15 @@ static const AVOption options[] = { - .init = v4l2_decode_init, \ - .receive_frame = v4l2_receive_frame, \ - .close = v4l2_decode_close, \ -+ .flush = v4l2_decode_flush, \ - .bsfs = bsf_name, \ - .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \ -- .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \ -+ .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS | FF_CODEC_CAP_INIT_CLEANUP, \ -+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_DRM_PRIME, \ -+ AV_PIX_FMT_NV12, \ -+ AV_PIX_FMT_YUV420P, \ -+ AV_PIX_FMT_NONE}, \ -+ .hw_configs = v4l2_m2m_hw_configs, \ - .wrapper_name = "v4l2m2m", \ - } - ---- /dev/null -+++ b/libavcodec/v4l2_req_decode_q.c -@@ -0,0 +1,84 @@ -+#include -+#include -+#include -+ -+#include "v4l2_req_decode_q.h" -+ -+int decode_q_in_q(const req_decode_ent * const d) -+{ -+ return d->in_q; -+} -+ -+void decode_q_add(req_decode_q * const q, req_decode_ent * const d) -+{ -+ pthread_mutex_lock(&q->q_lock); -+ if (!q->head) { -+ q->head = d; -+ q->tail = d; -+ d->prev = NULL; -+ } -+ else { -+ q->tail->next = d; -+ d->prev = q->tail; -+ q->tail = d; -+ } -+ d->next = NULL; -+ d->in_q = 1; -+ pthread_mutex_unlock(&q->q_lock); -+} -+ -+// Remove entry from Q - if head wake-up anything that was waiting -+void decode_q_remove(req_decode_q * const q, req_decode_ent * const d) -+{ -+ int try_signal = 0; -+ -+ if (!d->in_q) -+ return; -+ -+ pthread_mutex_lock(&q->q_lock); -+ if (d->prev) -+ d->prev->next = d->next; -+ else { -+ try_signal = 1; // Only need to signal if we were head -+ q->head = d->next; -+ } -+ -+ if (d->next) -+ d->next->prev = d->prev; -+ else -+ q->tail = d->prev; -+ -+ // Not strictly needed but makes debug easier -+ d->next = NULL; -+ d->prev = NULL; -+ d->in_q = 0; -+ pthread_mutex_unlock(&q->q_lock); -+ -+ if (try_signal) -+ pthread_cond_broadcast(&q->q_cond); -+} -+ -+void decode_q_wait(req_decode_q * const q, req_decode_ent * const d) -+{ -+ pthread_mutex_lock(&q->q_lock); -+ -+ while (q->head != d) -+ pthread_cond_wait(&q->q_cond, &q->q_lock); -+ -+ pthread_mutex_unlock(&q->q_lock); -+} -+ -+void decode_q_uninit(req_decode_q * const q) -+{ -+ pthread_mutex_destroy(&q->q_lock); -+ pthread_cond_destroy(&q->q_cond); -+} -+ -+void decode_q_init(req_decode_q * const q) -+{ -+ memset(q, 0, sizeof(*q)); -+ pthread_mutex_init(&q->q_lock, NULL); -+ pthread_cond_init(&q->q_cond, NULL); -+} -+ -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_decode_q.h -@@ -0,0 +1,25 @@ -+#ifndef AVCODEC_V4L2_REQ_DECODE_Q_H -+#define AVCODEC_V4L2_REQ_DECODE_Q_H -+ -+typedef struct req_decode_ent { -+ struct req_decode_ent * next; -+ struct req_decode_ent * prev; -+ int in_q; -+} req_decode_ent; -+ -+typedef struct req_decode_q { -+ pthread_mutex_t q_lock; -+ pthread_cond_t q_cond; -+ req_decode_ent * head; -+ req_decode_ent * tail; -+} req_decode_q; -+ -+int decode_q_in_q(const req_decode_ent * const d); -+void decode_q_add(req_decode_q * const q, req_decode_ent * const d); -+void decode_q_remove(req_decode_q * const q, req_decode_ent * const d); -+void decode_q_wait(req_decode_q * const q, req_decode_ent * const d); -+void decode_q_uninit(req_decode_q * const q); -+void decode_q_init(req_decode_q * const q); -+ -+#endif -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_devscan.c -@@ -0,0 +1,449 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+ -+#include "v4l2_req_devscan.h" -+#include "v4l2_req_utils.h" -+ -+struct decdev { -+ enum v4l2_buf_type src_type; -+ uint32_t src_fmt_v4l2; -+ const char * vname; -+ const char * mname; -+}; -+ -+struct devscan { -+ struct decdev env; -+ unsigned int dev_size; -+ unsigned int dev_count; -+ struct decdev *devs; -+}; -+ -+static int video_src_pixfmt_supported(uint32_t fmt) -+{ -+ return 1; -+} -+ -+static void v4l2_setup_format(struct v4l2_format *format, unsigned int type, -+ unsigned int width, unsigned int height, -+ unsigned int pixelformat) -+{ -+ unsigned int sizeimage; -+ -+ memset(format, 0, sizeof(*format)); -+ format->type = type; -+ -+ sizeimage = V4L2_TYPE_IS_OUTPUT(type) ? 4 * 1024 * 1024 : 0; -+ -+ if (V4L2_TYPE_IS_MULTIPLANAR(type)) { -+ format->fmt.pix_mp.width = width; -+ format->fmt.pix_mp.height = height; -+ format->fmt.pix_mp.plane_fmt[0].sizeimage = sizeimage; -+ format->fmt.pix_mp.pixelformat = pixelformat; -+ } else { -+ format->fmt.pix.width = width; -+ format->fmt.pix.height = height; -+ format->fmt.pix.sizeimage = sizeimage; -+ format->fmt.pix.pixelformat = pixelformat; -+ } -+} -+ -+static int v4l2_set_format(int video_fd, unsigned int type, unsigned int pixelformat, -+ unsigned int width, unsigned int height) -+{ -+ struct v4l2_format format; -+ -+ v4l2_setup_format(&format, type, width, height, pixelformat); -+ -+ return ioctl(video_fd, VIDIOC_S_FMT, &format) ? -errno : 0; -+} -+ -+static int v4l2_query_capabilities(int video_fd, unsigned int *capabilities) -+{ -+ struct v4l2_capability capability = { 0 }; -+ int rc; -+ -+ rc = ioctl(video_fd, VIDIOC_QUERYCAP, &capability); -+ if (rc < 0) -+ return -errno; -+ -+ if (capabilities != NULL) { -+ if ((capability.capabilities & V4L2_CAP_DEVICE_CAPS) != 0) -+ *capabilities = capability.device_caps; -+ else -+ *capabilities = capability.capabilities; -+ } -+ -+ return 0; -+} -+ -+static int devscan_add(struct devscan *const scan, -+ enum v4l2_buf_type src_type, -+ uint32_t src_fmt_v4l2, -+ const char * vname, -+ const char * mname) -+{ -+ struct decdev *d; -+ -+ if (scan->dev_size <= scan->dev_count) { -+ unsigned int n = !scan->dev_size ? 4 : scan->dev_size * 2; -+ d = realloc(scan->devs, n * sizeof(*d)); -+ if (!d) -+ return -ENOMEM; -+ scan->devs = d; -+ scan->dev_size = n; -+ } -+ -+ d = scan->devs + scan->dev_count; -+ d->src_type = src_type; -+ d->src_fmt_v4l2 = src_fmt_v4l2; -+ d->vname = strdup(vname); -+ if (!d->vname) -+ return -ENOMEM; -+ d->mname = strdup(mname); -+ if (!d->mname) { -+ free((char *)d->vname); -+ return -ENOMEM; -+ } -+ ++scan->dev_count; -+ return 0; -+} -+ -+void devscan_delete(struct devscan **const pScan) -+{ -+ unsigned int i; -+ struct devscan * const scan = *pScan; -+ -+ if (!scan) -+ return; -+ *pScan = NULL; -+ -+ for (i = 0; i < scan->dev_count; ++i) { -+ free((char*)scan->devs[i].mname); -+ free((char*)scan->devs[i].vname); -+ } -+ free(scan->devs); -+ free(scan); -+} -+ -+#define REQ_BUF_CAPS (\ -+ V4L2_BUF_CAP_SUPPORTS_DMABUF |\ -+ V4L2_BUF_CAP_SUPPORTS_REQUESTS |\ -+ V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF) -+ -+static void probe_formats(void * const dc, -+ struct devscan *const scan, -+ const int fd, -+ const unsigned int type_v4l2, -+ const char *const mpath, -+ const char *const vpath) -+{ -+ unsigned int i; -+ for (i = 0;; ++i) { -+ struct v4l2_fmtdesc fmtdesc = { -+ .index = i, -+ .type = type_v4l2 -+ }; -+ struct v4l2_requestbuffers rbufs = { -+ .count = 0, -+ .type = type_v4l2, -+ .memory = V4L2_MEMORY_MMAP -+ }; -+ while (ioctl(fd, VIDIOC_ENUM_FMT, &fmtdesc)) { -+ if (errno == EINTR) -+ continue; -+ if (errno != EINVAL) -+ request_err(dc, "Enum[%d] failed for type=%d\n", i, type_v4l2); -+ return; -+ } -+ if (!video_src_pixfmt_supported(fmtdesc.pixelformat)) -+ continue; -+ -+ if (v4l2_set_format(fd, type_v4l2, fmtdesc.pixelformat, 720, 480)) { -+ request_debug(dc, "Set failed for type=%d, pf=%.4s\n", type_v4l2, (char*)&fmtdesc.pixelformat); -+ continue; -+ } -+ -+ while (ioctl(fd, VIDIOC_REQBUFS, &rbufs)) { -+ if (errno != EINTR) { -+ request_debug(dc, "%s: Reqbufs failed\n", vpath); -+ continue; -+ } -+ } -+ -+ if ((rbufs.capabilities & REQ_BUF_CAPS) != REQ_BUF_CAPS) { -+ request_debug(dc, "%s: Buf caps %#x insufficient\n", vpath, rbufs.capabilities); -+ continue; -+ } -+ -+ request_debug(dc, "Adding: %s,%s pix=%#x, type=%d\n", -+ mpath, vpath, fmtdesc.pixelformat, type_v4l2); -+ devscan_add(scan, type_v4l2, fmtdesc.pixelformat, vpath, mpath); -+ } -+} -+ -+ -+static int probe_video_device(void * const dc, -+ struct udev_device *const device, -+ struct devscan *const scan, -+ const char *const mpath) -+{ -+ int ret; -+ unsigned int capabilities = 0; -+ int video_fd = -1; -+ -+ const char *path = udev_device_get_devnode(device); -+ if (!path) { -+ request_err(dc, "%s: get video device devnode failed\n", __func__); -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ video_fd = open(path, O_RDWR, 0); -+ if (video_fd == -1) { -+ ret = -errno; -+ request_err(dc, "%s: opening %s failed, %s (%d)\n", __func__, path, strerror(errno), errno); -+ goto fail; -+ } -+ -+ ret = v4l2_query_capabilities(video_fd, &capabilities); -+ if (ret < 0) { -+ request_err(dc, "%s: get video capability failed, %s (%d)\n", __func__, strerror(-ret), -ret); -+ goto fail; -+ } -+ -+ request_debug(dc, "%s: path=%s capabilities=%#x\n", __func__, path, capabilities); -+ -+ if (!(capabilities & V4L2_CAP_STREAMING)) { -+ request_debug(dc, "%s: missing required streaming capability\n", __func__); -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ if (!(capabilities & (V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M))) { -+ request_debug(dc, "%s: missing required mem2mem capability\n", __func__); -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ /* Should check capture formats too... */ -+ if ((capabilities & V4L2_CAP_VIDEO_M2M) != 0) -+ probe_formats(dc, scan, video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT, mpath, path); -+ if ((capabilities & V4L2_CAP_VIDEO_M2M_MPLANE) != 0) -+ probe_formats(dc, scan, video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, mpath, path); -+ -+ close(video_fd); -+ return 0; -+ -+fail: -+ if (video_fd >= 0) -+ close(video_fd); -+ return ret; -+} -+ -+static int probe_media_device(void * const dc, -+ struct udev_device *const device, -+ struct devscan *const scan) -+{ -+ int ret; -+ int rv; -+ struct media_device_info device_info = { 0 }; -+ struct media_v2_topology topology = { 0 }; -+ struct media_v2_interface *interfaces = NULL; -+ struct udev *udev = udev_device_get_udev(device); -+ struct udev_device *video_device; -+ dev_t devnum; -+ int media_fd = -1; -+ -+ const char *path = udev_device_get_devnode(device); -+ if (!path) { -+ request_err(dc, "%s: get media device devnode failed\n", __func__); -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ media_fd = open(path, O_RDWR, 0); -+ if (media_fd < 0) { -+ ret = -errno; -+ request_err(dc, "%s: opening %s failed, %s (%d)\n", __func__, path, strerror(-ret), -ret); -+ goto fail; -+ } -+ -+ rv = ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &device_info); -+ if (rv < 0) { -+ ret = -errno; -+ request_err(dc, "%s: get media device info failed, %s (%d)\n", __func__, strerror(-ret), -ret); -+ goto fail; -+ } -+ -+ rv = ioctl(media_fd, MEDIA_IOC_G_TOPOLOGY, &topology); -+ if (rv < 0) { -+ ret = -errno; -+ request_err(dc, "%s: get media topology failed, %s (%d)\n", __func__, strerror(-ret), -ret); -+ goto fail; -+ } -+ -+ if (topology.num_interfaces <= 0) { -+ request_err(dc, "%s: media device has no interfaces\n", __func__); -+ ret = -EINVAL; -+ goto fail; -+ } -+ -+ interfaces = calloc(topology.num_interfaces, sizeof(*interfaces)); -+ if (!interfaces) { -+ request_err(dc, "%s: allocating media interface struct failed\n", __func__); -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ topology.ptr_interfaces = (__u64)(uintptr_t)interfaces; -+ rv = ioctl(media_fd, MEDIA_IOC_G_TOPOLOGY, &topology); -+ if (rv < 0) { -+ ret = -errno; -+ request_err(dc, "%s: get media topology failed, %s (%d)\n", __func__, strerror(-ret), -ret); -+ goto fail; -+ } -+ -+ for (int i = 0; i < topology.num_interfaces; i++) { -+ if (interfaces[i].intf_type != MEDIA_INTF_T_V4L_VIDEO) -+ continue; -+ -+ devnum = makedev(interfaces[i].devnode.major, interfaces[i].devnode.minor); -+ video_device = udev_device_new_from_devnum(udev, 'c', devnum); -+ if (!video_device) { -+ ret = -errno; -+ request_err(dc, "%s: video_device[%d]=%p\n", __func__, i, video_device); -+ continue; -+ } -+ -+ ret = probe_video_device(dc, video_device, scan, path); -+ udev_device_unref(video_device); -+ -+ if (ret != 0) -+ goto fail; -+ } -+ -+fail: -+ free(interfaces); -+ if (media_fd != -1) -+ close(media_fd); -+ return ret; -+} -+ -+const char *decdev_media_path(const struct decdev *const dev) -+{ -+ return !dev ? NULL : dev->mname; -+} -+ -+const char *decdev_video_path(const struct decdev *const dev) -+{ -+ return !dev ? NULL : dev->vname; -+} -+ -+enum v4l2_buf_type decdev_src_type(const struct decdev *const dev) -+{ -+ return !dev ? 0 : dev->src_type; -+} -+ -+uint32_t decdev_src_pixelformat(const struct decdev *const dev) -+{ -+ return !dev ? 0 : dev->src_fmt_v4l2; -+} -+ -+ -+const struct decdev *devscan_find(struct devscan *const scan, -+ const uint32_t src_fmt_v4l2) -+{ -+ unsigned int i; -+ -+ if (scan->env.mname && scan->env.vname) -+ return &scan->env; -+ -+ if (!src_fmt_v4l2) -+ return scan->dev_count ? scan->devs + 0 : NULL; -+ -+ for (i = 0; i != scan->dev_count; ++i) { -+ if (scan->devs[i].src_fmt_v4l2 == src_fmt_v4l2) -+ return scan->devs + i; -+ } -+ return NULL; -+} -+ -+int devscan_build(void * const dc, struct devscan **pscan) -+{ -+ int ret; -+ struct udev *udev; -+ struct udev_enumerate *enumerate; -+ struct udev_list_entry *devices; -+ struct udev_list_entry *entry; -+ struct udev_device *device; -+ struct devscan * scan; -+ -+ *pscan = NULL; -+ -+ scan = calloc(1, sizeof(*scan)); -+ if (!scan) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ scan->env.mname = getenv("LIBVA_V4L2_REQUEST_MEDIA_PATH"); -+ scan->env.vname = getenv("LIBVA_V4L2_REQUEST_VIDEO_PATH"); -+ if (scan->env.mname && scan->env.vname) { -+ request_info(dc, "Media/video device env overrides found: %s,%s\n", -+ scan->env.mname, scan->env.vname); -+ *pscan = scan; -+ return 0; -+ } -+ -+ udev = udev_new(); -+ if (!udev) { -+ request_err(dc, "%s: allocating udev context failed\n", __func__); -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ enumerate = udev_enumerate_new(udev); -+ if (!enumerate) { -+ request_err(dc, "%s: allocating udev enumerator failed\n", __func__); -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ udev_enumerate_add_match_subsystem(enumerate, "media"); -+ udev_enumerate_scan_devices(enumerate); -+ -+ devices = udev_enumerate_get_list_entry(enumerate); -+ udev_list_entry_foreach(entry, devices) { -+ const char *path = udev_list_entry_get_name(entry); -+ if (!path) -+ continue; -+ -+ device = udev_device_new_from_syspath(udev, path); -+ if (!device) -+ continue; -+ -+ probe_media_device(dc, device, scan); -+ udev_device_unref(device); -+ } -+ -+ udev_enumerate_unref(enumerate); -+ -+ *pscan = scan; -+ return 0; -+ -+fail: -+ udev_unref(udev); -+ devscan_delete(&scan); -+ return ret; -+} -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_devscan.h -@@ -0,0 +1,21 @@ -+#ifndef _DEVSCAN_H_ -+#define _DEVSCAN_H_ -+ -+struct devscan; -+struct decdev; -+enum v4l2_buf_type; -+ -+/* These return pointers to data in the devscan structure and so are vaild -+ * for the lifetime of that -+ */ -+const char *decdev_media_path(const struct decdev *const dev); -+const char *decdev_video_path(const struct decdev *const dev); -+enum v4l2_buf_type decdev_src_type(const struct decdev *const dev); -+uint32_t decdev_src_pixelformat(const struct decdev *const dev); -+ -+const struct decdev *devscan_find(struct devscan *const scan, const uint32_t src_fmt_v4l2); -+ -+int devscan_build(void * const dc, struct devscan **pscan); -+void devscan_delete(struct devscan **const pScan); -+ -+#endif ---- /dev/null -+++ b/libavcodec/v4l2_req_dmabufs.c -@@ -0,0 +1,266 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "v4l2_req_dmabufs.h" -+#include "v4l2_req_utils.h" -+ -+#define DMABUF_NAME1 "/dev/dma_heap/linux,cma" -+#define DMABUF_NAME2 "/dev/dma_heap/reserved" -+ -+#define TRACE_ALLOC 0 -+ -+struct dmabufs_ctl { -+ int fd; -+ size_t page_size; -+}; -+ -+struct dmabuf_h { -+ int fd; -+ size_t size; -+ size_t len; -+ void * mapptr; -+}; -+ -+#if TRACE_ALLOC -+static unsigned int total_bufs = 0; -+static size_t total_size = 0; -+#endif -+ -+struct dmabuf_h * dmabuf_import(int fd, size_t size) -+{ -+ struct dmabuf_h *dh; -+ -+ fd = dup(fd); -+ if (fd < 0 || size == 0) -+ return NULL; -+ -+ dh = malloc(sizeof(*dh)); -+ if (!dh) { -+ close(fd); -+ return NULL; -+ } -+ -+ *dh = (struct dmabuf_h) { -+ .fd = fd, -+ .size = size, -+ .mapptr = MAP_FAILED -+ }; -+ -+#if TRACE_ALLOC -+ ++total_bufs; -+ total_size += dh->size; -+ request_log("%s: Import: %zd, total=%zd, bufs=%d\n", __func__, dh->size, total_size, total_bufs); -+#endif -+ -+ return dh; -+} -+ -+struct dmabuf_h * dmabuf_realloc(struct dmabufs_ctl * dbsc, struct dmabuf_h * old, size_t size) -+{ -+ struct dmabuf_h * dh; -+ struct dma_heap_allocation_data data = { -+ .len = (size + dbsc->page_size - 1) & ~(dbsc->page_size - 1), -+ .fd = 0, -+ .fd_flags = O_RDWR, -+ .heap_flags = 0 -+ }; -+ -+ if (old != NULL) { -+ if (old->size == data.len) { -+ return old; -+ } -+ dmabuf_free(old); -+ } -+ -+ if (size == 0 || -+ (dh = malloc(sizeof(*dh))) == NULL) -+ return NULL; -+ -+ while (ioctl(dbsc->fd, DMA_HEAP_IOCTL_ALLOC, &data)) { -+ int err = errno; -+ request_log("Failed to alloc %" PRIu64 " from dma-heap(fd=%d): %d (%s)\n", -+ (uint64_t)data.len, -+ dbsc->fd, -+ err, -+ strerror(err)); -+ if (err == EINTR) -+ continue; -+ goto fail; -+ } -+ -+ *dh = (struct dmabuf_h){ -+ .fd = data.fd, -+ .size = (size_t)data.len, -+ .mapptr = MAP_FAILED -+ }; -+ -+#if TRACE_ALLOC -+ ++total_bufs; -+ total_size += dh->size; -+ request_log("%s: Alloc: %zd, total=%zd, bufs=%d\n", __func__, dh->size, total_size, total_bufs); -+#endif -+ -+ return dh; -+ -+fail: -+ free(dh); -+ return NULL; -+} -+ -+int dmabuf_sync(struct dmabuf_h * const dh, unsigned int flags) -+{ -+ struct dma_buf_sync sync = { -+ .flags = flags -+ }; -+ while (ioctl(dh->fd, DMA_BUF_IOCTL_SYNC, &sync) == -1) { -+ const int err = errno; -+ if (errno == EINTR) -+ continue; -+ request_log("%s: ioctl failed: flags=%#x\n", __func__, flags); -+ return -err; -+ } -+ return 0; -+} -+ -+int dmabuf_write_start(struct dmabuf_h * const dh) -+{ -+ return dmabuf_sync(dh, DMA_BUF_SYNC_START | DMA_BUF_SYNC_WRITE); -+} -+ -+int dmabuf_write_end(struct dmabuf_h * const dh) -+{ -+ return dmabuf_sync(dh, DMA_BUF_SYNC_END | DMA_BUF_SYNC_WRITE); -+} -+ -+int dmabuf_read_start(struct dmabuf_h * const dh) -+{ -+ if (!dmabuf_map(dh)) -+ return -1; -+ return dmabuf_sync(dh, DMA_BUF_SYNC_START | DMA_BUF_SYNC_READ); -+} -+ -+int dmabuf_read_end(struct dmabuf_h * const dh) -+{ -+ return dmabuf_sync(dh, DMA_BUF_SYNC_END | DMA_BUF_SYNC_READ); -+} -+ -+ -+void * dmabuf_map(struct dmabuf_h * const dh) -+{ -+ if (!dh) -+ return NULL; -+ if (dh->mapptr != MAP_FAILED) -+ return dh->mapptr; -+ dh->mapptr = mmap(NULL, dh->size, -+ PROT_READ | PROT_WRITE, -+ MAP_SHARED | MAP_POPULATE, -+ dh->fd, 0); -+ if (dh->mapptr == MAP_FAILED) { -+ request_log("%s: Map failed\n", __func__); -+ return NULL; -+ } -+ return dh->mapptr; -+} -+ -+int dmabuf_fd(const struct dmabuf_h * const dh) -+{ -+ if (!dh) -+ return -1; -+ return dh->fd; -+} -+ -+size_t dmabuf_size(const struct dmabuf_h * const dh) -+{ -+ if (!dh) -+ return 0; -+ return dh->size; -+} -+ -+size_t dmabuf_len(const struct dmabuf_h * const dh) -+{ -+ if (!dh) -+ return 0; -+ return dh->len; -+} -+ -+void dmabuf_len_set(struct dmabuf_h * const dh, const size_t len) -+{ -+ dh->len = len; -+} -+ -+ -+ -+void dmabuf_free(struct dmabuf_h * dh) -+{ -+ if (!dh) -+ return; -+ -+#if TRACE_ALLOC -+ --total_bufs; -+ total_size -= dh->size; -+ request_log("%s: Free: %zd, total=%zd, bufs=%d\n", __func__, dh->size, total_size, total_bufs); -+#endif -+ -+ if (dh->mapptr != MAP_FAILED) -+ munmap(dh->mapptr, dh->size); -+ while (close(dh->fd) == -1 && errno == EINTR) -+ /* loop */; -+ free(dh); -+} -+ -+struct dmabufs_ctl * dmabufs_ctl_new(void) -+{ -+ struct dmabufs_ctl * dbsc = malloc(sizeof(*dbsc)); -+ -+ if (!dbsc) -+ return NULL; -+ -+ while ((dbsc->fd = open(DMABUF_NAME1, O_RDWR)) == -1 && -+ errno == EINTR) -+ /* Loop */; -+ -+ if (dbsc->fd == -1) { -+ while ((dbsc->fd = open(DMABUF_NAME2, O_RDWR)) == -1 && -+ errno == EINTR) -+ /* Loop */; -+ if (dbsc->fd == -1) { -+ request_log("Unable to open either %s or %s\n", -+ DMABUF_NAME1, DMABUF_NAME2); -+ goto fail; -+ } -+ } -+ -+ dbsc->page_size = (size_t)sysconf(_SC_PAGE_SIZE); -+ -+ return dbsc; -+ -+fail: -+ free(dbsc); -+ return NULL; -+} -+ -+void dmabufs_ctl_delete(struct dmabufs_ctl ** const pDbsc) -+{ -+ struct dmabufs_ctl * const dbsc = *pDbsc; -+ -+ if (!dbsc) -+ return; -+ *pDbsc = NULL; -+ -+ while (close(dbsc->fd) == -1 && errno == EINTR) -+ /* loop */; -+ -+ free(dbsc); -+} -+ -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_dmabufs.h -@@ -0,0 +1,38 @@ -+#ifndef DMABUFS_H -+#define DMABUFS_H -+ -+struct dmabufs_ctl; -+struct dmabuf_h; -+ -+struct dmabufs_ctl * dmabufs_ctl_new(void); -+void dmabufs_ctl_delete(struct dmabufs_ctl ** const pdbsc); -+ -+// Need not preserve old contents -+// On NULL return old buffer is freed -+struct dmabuf_h * dmabuf_realloc(struct dmabufs_ctl * dbsc, struct dmabuf_h *, size_t size); -+ -+static inline struct dmabuf_h * dmabuf_alloc(struct dmabufs_ctl * dbsc, size_t size) { -+ return dmabuf_realloc(dbsc, NULL, size); -+} -+/* Create from existing fd - dups(fd) */ -+struct dmabuf_h * dmabuf_import(int fd, size_t size); -+void * dmabuf_map(struct dmabuf_h * const dh); -+ -+/* flags from linux/dmabuf.h DMA_BUF_SYNC_xxx */ -+int dmabuf_sync(struct dmabuf_h * const dh, unsigned int flags); -+ -+int dmabuf_write_start(struct dmabuf_h * const dh); -+int dmabuf_write_end(struct dmabuf_h * const dh); -+int dmabuf_read_start(struct dmabuf_h * const dh); -+int dmabuf_read_end(struct dmabuf_h * const dh); -+ -+int dmabuf_fd(const struct dmabuf_h * const dh); -+/* Allocated size */ -+size_t dmabuf_size(const struct dmabuf_h * const dh); -+/* Bytes in use */ -+size_t dmabuf_len(const struct dmabuf_h * const dh); -+/* Set bytes in use */ -+void dmabuf_len_set(struct dmabuf_h * const dh, const size_t len); -+void dmabuf_free(struct dmabuf_h * dh); -+ -+#endif ---- /dev/null -+++ b/libavcodec/v4l2_req_hevc_v1.c -@@ -0,0 +1,3 @@ -+#define HEVC_CTRLS_VERSION 1 -+#include "v4l2_req_hevc_vx.c" -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_hevc_v2.c -@@ -0,0 +1,3 @@ -+#define HEVC_CTRLS_VERSION 2 -+#include "v4l2_req_hevc_vx.c" -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_hevc_vx.c -@@ -0,0 +1,1188 @@ -+// File included by v4l2_req_hevc_v* - not compiled on its own -+ -+#include "decode.h" -+#include "hevcdec.h" -+#include "hwconfig.h" -+ -+#include "v4l2_request_hevc.h" -+ -+#if HEVC_CTRLS_VERSION == 1 -+#include "hevc-ctrls-v1.h" -+ -+// Fixup renamed entries -+#define V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT -+ -+#elif HEVC_CTRLS_VERSION == 2 -+#include "hevc-ctrls-v2.h" -+#else -+#error Unknown HEVC_CTRLS_VERSION -+#endif -+ -+#include "libavutil/hwcontext_drm.h" -+ -+#include -+#include -+ -+#include "v4l2_req_devscan.h" -+#include "v4l2_req_dmabufs.h" -+#include "v4l2_req_pollqueue.h" -+#include "v4l2_req_media.h" -+#include "v4l2_req_utils.h" -+ -+// Attached to buf[0] in frame -+// Pooled in hwcontext so generally create once - 1/frame -+typedef struct V4L2MediaReqDescriptor { -+ AVDRMFrameDescriptor drm; -+ -+ // Media -+ uint64_t timestamp; -+ struct qent_dst * qe_dst; -+ -+ // Decode only - should be NULL by the time we emit the frame -+ struct req_decode_ent decode_ent; -+ -+ struct media_request *req; -+ struct qent_src *qe_src; -+ -+#if HEVC_CTRLS_VERSION >= 2 -+ struct v4l2_ctrl_hevc_decode_params dec; -+#endif -+ -+ size_t num_slices; -+ size_t alloced_slices; -+ struct v4l2_ctrl_hevc_slice_params * slice_params; -+ struct slice_info * slices; -+ -+} V4L2MediaReqDescriptor; -+ -+struct slice_info { -+ const uint8_t * ptr; -+ size_t len; // bytes -+}; -+ -+// Handy container for accumulating controls before setting -+struct req_controls { -+ int has_scaling; -+ struct timeval tv; -+ struct v4l2_ctrl_hevc_sps sps; -+ struct v4l2_ctrl_hevc_pps pps; -+ struct v4l2_ctrl_hevc_scaling_matrix scaling_matrix; -+}; -+ -+//static uint8_t nalu_slice_start_code[] = { 0x00, 0x00, 0x01 }; -+ -+ -+// Get an FFmpeg format from the v4l2 format -+static enum AVPixelFormat pixel_format_from_format(const struct v4l2_format *const format) -+{ -+ switch (V4L2_TYPE_IS_MULTIPLANAR(format->type) ? -+ format->fmt.pix_mp.pixelformat : format->fmt.pix.pixelformat) { -+ case V4L2_PIX_FMT_YUV420: -+ return AV_PIX_FMT_YUV420P; -+ case V4L2_PIX_FMT_NV12: -+ return AV_PIX_FMT_NV12; -+#if CONFIG_SAND -+ case V4L2_PIX_FMT_NV12_COL128: -+ return AV_PIX_FMT_RPI4_8; -+ case V4L2_PIX_FMT_NV12_10_COL128: -+ return AV_PIX_FMT_RPI4_10; -+#endif -+ default: -+ break; -+ } -+ return AV_PIX_FMT_NONE; -+} -+ -+static inline uint64_t frame_capture_dpb(const AVFrame * const frame) -+{ -+ const V4L2MediaReqDescriptor *const rd = (V4L2MediaReqDescriptor *)frame->data[0]; -+ return rd->timestamp; -+} -+ -+static inline void frame_set_capture_dpb(AVFrame * const frame, const uint64_t dpb_stamp) -+{ -+ V4L2MediaReqDescriptor *const rd = (V4L2MediaReqDescriptor *)frame->data[0]; -+ rd->timestamp = dpb_stamp; -+} -+ -+static void fill_pred_table(const HEVCContext *h, struct v4l2_hevc_pred_weight_table *table) -+{ -+ int32_t luma_weight_denom, chroma_weight_denom; -+ const SliceHeader *sh = &h->sh; -+ -+ if (sh->slice_type == HEVC_SLICE_I || -+ (sh->slice_type == HEVC_SLICE_P && !h->ps.pps->weighted_pred_flag) || -+ (sh->slice_type == HEVC_SLICE_B && !h->ps.pps->weighted_bipred_flag)) -+ return; -+ -+ table->luma_log2_weight_denom = sh->luma_log2_weight_denom; -+ -+ if (h->ps.sps->chroma_format_idc) -+ table->delta_chroma_log2_weight_denom = sh->chroma_log2_weight_denom - sh->luma_log2_weight_denom; -+ -+ luma_weight_denom = (1 << sh->luma_log2_weight_denom); -+ chroma_weight_denom = (1 << sh->chroma_log2_weight_denom); -+ -+ for (int i = 0; i < 15 && i < sh->nb_refs[L0]; i++) { -+ table->delta_luma_weight_l0[i] = sh->luma_weight_l0[i] - luma_weight_denom; -+ table->luma_offset_l0[i] = sh->luma_offset_l0[i]; -+ table->delta_chroma_weight_l0[i][0] = sh->chroma_weight_l0[i][0] - chroma_weight_denom; -+ table->delta_chroma_weight_l0[i][1] = sh->chroma_weight_l0[i][1] - chroma_weight_denom; -+ table->chroma_offset_l0[i][0] = sh->chroma_offset_l0[i][0]; -+ table->chroma_offset_l0[i][1] = sh->chroma_offset_l0[i][1]; -+ } -+ -+ if (sh->slice_type != HEVC_SLICE_B) -+ return; -+ -+ for (int i = 0; i < 15 && i < sh->nb_refs[L1]; i++) { -+ table->delta_luma_weight_l1[i] = sh->luma_weight_l1[i] - luma_weight_denom; -+ table->luma_offset_l1[i] = sh->luma_offset_l1[i]; -+ table->delta_chroma_weight_l1[i][0] = sh->chroma_weight_l1[i][0] - chroma_weight_denom; -+ table->delta_chroma_weight_l1[i][1] = sh->chroma_weight_l1[i][1] - chroma_weight_denom; -+ table->chroma_offset_l1[i][0] = sh->chroma_offset_l1[i][0]; -+ table->chroma_offset_l1[i][1] = sh->chroma_offset_l1[i][1]; -+ } -+} -+ -+static int find_frame_rps_type(const HEVCContext *h, uint64_t timestamp) -+{ -+ const HEVCFrame *frame; -+ int i; -+ -+ for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) { -+ frame = h->rps[ST_CURR_BEF].ref[i]; -+ if (frame && timestamp == frame_capture_dpb(frame->frame)) -+ return V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE; -+ } -+ -+ for (i = 0; i < h->rps[ST_CURR_AFT].nb_refs; i++) { -+ frame = h->rps[ST_CURR_AFT].ref[i]; -+ if (frame && timestamp == frame_capture_dpb(frame->frame)) -+ return V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_AFTER; -+ } -+ -+ for (i = 0; i < h->rps[LT_CURR].nb_refs; i++) { -+ frame = h->rps[LT_CURR].ref[i]; -+ if (frame && timestamp == frame_capture_dpb(frame->frame)) -+ return V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR; -+ } -+ -+ return 0; -+} -+ -+static unsigned int -+get_ref_pic_index(const HEVCContext *h, const HEVCFrame *frame, -+ const struct v4l2_hevc_dpb_entry * const entries, -+ const unsigned int num_entries) -+{ -+ uint64_t timestamp; -+ -+ if (!frame) -+ return 0; -+ -+ timestamp = frame_capture_dpb(frame->frame); -+ -+ for (unsigned int i = 0; i < num_entries; i++) { -+ if (entries[i].timestamp == timestamp) -+ return i; -+ } -+ -+ return 0; -+} -+ -+static const uint8_t * ptr_from_index(const uint8_t * b, unsigned int idx) -+{ -+ unsigned int z = 0; -+ while (idx--) { -+ if (*b++ == 0) { -+ ++z; -+ if (z >= 2 && *b == 3) { -+ ++b; -+ z = 0; -+ } -+ } -+ else { -+ z = 0; -+ } -+ } -+ return b; -+} -+ -+static int slice_add(V4L2MediaReqDescriptor * const rd) -+{ -+ if (rd->num_slices >= rd->alloced_slices) { -+ struct v4l2_ctrl_hevc_slice_params * p2; -+ struct slice_info * s2; -+ size_t n2 = rd->num_slices == 0 ? 8 : rd->num_slices * 2; -+ -+ p2 = av_realloc_array(rd->slice_params, n2, sizeof(*p2)); -+ if (p2 == NULL) -+ return AVERROR(ENOMEM); -+ rd->slice_params = p2; -+ -+ s2 = av_realloc_array(rd->slices, n2, sizeof(*s2)); -+ if (s2 == NULL) -+ return AVERROR(ENOMEM); -+ rd->slices = s2; -+ -+ rd->alloced_slices = n2; -+ } -+ ++rd->num_slices; -+ return 0; -+} -+ -+static unsigned int -+fill_dpb_entries(const HEVCContext * const h, struct v4l2_hevc_dpb_entry * const entries) -+{ -+ unsigned int i; -+ unsigned int n = 0; -+ const HEVCFrame * const pic = h->ref; -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(h->DPB); i++) { -+ const HEVCFrame * const frame = &h->DPB[i]; -+ if (frame != pic && (frame->flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) { -+ struct v4l2_hevc_dpb_entry * const entry = entries + n++; -+ -+ entry->timestamp = frame_capture_dpb(frame->frame); -+ entry->rps = find_frame_rps_type(h, entry->timestamp); -+ entry->field_pic = frame->frame->interlaced_frame; -+ -+ /* TODO: Interleaved: Get the POC for each field. */ -+ entry->pic_order_cnt[0] = frame->poc; -+ entry->pic_order_cnt[1] = frame->poc; -+ } -+ } -+ return n; -+} -+ -+static void fill_slice_params(const HEVCContext * const h, -+#if HEVC_CTRLS_VERSION >= 2 -+ const struct v4l2_ctrl_hevc_decode_params * const dec, -+#endif -+ struct v4l2_ctrl_hevc_slice_params *slice_params, -+ uint32_t bit_size, uint32_t bit_offset) -+{ -+ const SliceHeader * const sh = &h->sh; -+#if HEVC_CTRLS_VERSION >= 2 -+ const struct v4l2_hevc_dpb_entry *const dpb = dec->dpb; -+ const unsigned int dpb_n = dec->num_active_dpb_entries; -+#else -+ struct v4l2_hevc_dpb_entry *const dpb = slice_params->dpb; -+ unsigned int dpb_n; -+#endif -+ unsigned int i; -+ RefPicList *rpl; -+ -+ *slice_params = (struct v4l2_ctrl_hevc_slice_params) { -+ .bit_size = bit_size, -+ .data_bit_offset = bit_offset, -+ -+ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ -+ .slice_segment_addr = sh->slice_segment_addr, -+ -+ /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */ -+ .nal_unit_type = h->nal_unit_type, -+ .nuh_temporal_id_plus1 = h->temporal_id + 1, -+ -+ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ -+ .slice_type = sh->slice_type, -+ .colour_plane_id = sh->colour_plane_id, -+ .slice_pic_order_cnt = h->ref->poc, -+ .num_ref_idx_l0_active_minus1 = sh->nb_refs[L0] ? sh->nb_refs[L0] - 1 : 0, -+ .num_ref_idx_l1_active_minus1 = sh->nb_refs[L1] ? sh->nb_refs[L1] - 1 : 0, -+ .collocated_ref_idx = sh->slice_temporal_mvp_enabled_flag ? sh->collocated_ref_idx : 0, -+ .five_minus_max_num_merge_cand = sh->slice_type == HEVC_SLICE_I ? 0 : 5 - sh->max_num_merge_cand, -+ .slice_qp_delta = sh->slice_qp_delta, -+ .slice_cb_qp_offset = sh->slice_cb_qp_offset, -+ .slice_cr_qp_offset = sh->slice_cr_qp_offset, -+ .slice_act_y_qp_offset = 0, -+ .slice_act_cb_qp_offset = 0, -+ .slice_act_cr_qp_offset = 0, -+ .slice_beta_offset_div2 = sh->beta_offset / 2, -+ .slice_tc_offset_div2 = sh->tc_offset / 2, -+ -+ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture timing SEI message */ -+ .pic_struct = h->sei.picture_timing.picture_struct, -+ -+#if HEVC_CTRLS_VERSION < 2 -+ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ -+ .num_rps_poc_st_curr_before = h->rps[ST_CURR_BEF].nb_refs, -+ .num_rps_poc_st_curr_after = h->rps[ST_CURR_AFT].nb_refs, -+ .num_rps_poc_lt_curr = h->rps[LT_CURR].nb_refs, -+#endif -+ }; -+ -+ if (sh->slice_sample_adaptive_offset_flag[0]) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_LUMA; -+ -+ if (sh->slice_sample_adaptive_offset_flag[1]) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_CHROMA; -+ -+ if (sh->slice_temporal_mvp_enabled_flag) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_TEMPORAL_MVP_ENABLED; -+ -+ if (sh->mvd_l1_zero_flag) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_MVD_L1_ZERO; -+ -+ if (sh->cabac_init_flag) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_CABAC_INIT; -+ -+ if (sh->collocated_list == L0) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_COLLOCATED_FROM_L0; -+ -+ if (sh->disable_deblocking_filter_flag) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED; -+ -+ if (sh->slice_loop_filter_across_slices_enabled_flag) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED; -+ -+ if (sh->dependent_slice_segment_flag) -+ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT; -+ -+#if HEVC_CTRLS_VERSION < 2 -+ dpb_n = fill_dpb_entries(h, dpb); -+ slice_params->num_active_dpb_entries = dpb_n; -+#endif -+ -+ if (sh->slice_type != HEVC_SLICE_I) { -+ rpl = &h->ref->refPicList[0]; -+ for (i = 0; i < rpl->nb_refs; i++) -+ slice_params->ref_idx_l0[i] = get_ref_pic_index(h, rpl->ref[i], dpb, dpb_n); -+ } -+ -+ if (sh->slice_type == HEVC_SLICE_B) { -+ rpl = &h->ref->refPicList[1]; -+ for (i = 0; i < rpl->nb_refs; i++) -+ slice_params->ref_idx_l1[i] = get_ref_pic_index(h, rpl->ref[i], dpb, dpb_n); -+ } -+ -+ fill_pred_table(h, &slice_params->pred_weight_table); -+ -+ slice_params->num_entry_point_offsets = sh->num_entry_point_offsets; -+ if (slice_params->num_entry_point_offsets > 256) { -+ slice_params->num_entry_point_offsets = 256; -+ av_log(NULL, AV_LOG_ERROR, "%s: Currently only 256 entry points are supported, but slice has %d entry points.\n", __func__, sh->num_entry_point_offsets); -+ } -+ -+ for (i = 0; i < slice_params->num_entry_point_offsets; i++) -+ slice_params->entry_point_offset_minus1[i] = sh->entry_point_offset[i] - 1; -+} -+ -+#if HEVC_CTRLS_VERSION >= 2 -+static void -+fill_decode_params(const HEVCContext * const h, -+ struct v4l2_ctrl_hevc_decode_params * const dec) -+{ -+ unsigned int i; -+ -+ *dec = (struct v4l2_ctrl_hevc_decode_params){ -+ .pic_order_cnt_val = h->poc, -+ .num_poc_st_curr_before = h->rps[ST_CURR_BEF].nb_refs, -+ .num_poc_st_curr_after = h->rps[ST_CURR_AFT].nb_refs, -+ .num_poc_lt_curr = h->rps[LT_CURR].nb_refs, -+ }; -+ -+ dec->num_active_dpb_entries = fill_dpb_entries(h, dec->dpb); -+ -+ // The docn does seem to ask that we fit our 32 bit signed POC into -+ // a U8 so... (To be fair 16 bits would be enough) -+ // Luckily we (Pi) don't use these fields -+ for (i = 0; i != h->rps[ST_CURR_BEF].nb_refs; ++i) -+ dec->poc_st_curr_before[i] = h->rps[ST_CURR_BEF].ref[i]->poc; -+ for (i = 0; i != h->rps[ST_CURR_AFT].nb_refs; ++i) -+ dec->poc_st_curr_after[i] = h->rps[ST_CURR_AFT].ref[i]->poc; -+ for (i = 0; i != h->rps[LT_CURR].nb_refs; ++i) -+ dec->poc_lt_curr[i] = h->rps[LT_CURR].ref[i]->poc; -+ -+ if (IS_IRAP(h)) -+ dec->flags |= V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC; -+ if (IS_IDR(h)) -+ dec->flags |= V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC; -+ if (h->sh.no_output_of_prior_pics_flag) -+ dec->flags |= V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR; -+ -+} -+#endif -+ -+static void fill_sps(struct v4l2_ctrl_hevc_sps *ctrl, const HEVCSPS *sps) -+{ -+ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */ -+ *ctrl = (struct v4l2_ctrl_hevc_sps) { -+ .chroma_format_idc = sps->chroma_format_idc, -+ .pic_width_in_luma_samples = sps->width, -+ .pic_height_in_luma_samples = sps->height, -+ .bit_depth_luma_minus8 = sps->bit_depth - 8, -+ .bit_depth_chroma_minus8 = sps->bit_depth - 8, -+ .log2_max_pic_order_cnt_lsb_minus4 = sps->log2_max_poc_lsb - 4, -+ .sps_max_dec_pic_buffering_minus1 = sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering - 1, -+ .sps_max_num_reorder_pics = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics, -+ .sps_max_latency_increase_plus1 = sps->temporal_layer[sps->max_sub_layers - 1].max_latency_increase + 1, -+ .log2_min_luma_coding_block_size_minus3 = sps->log2_min_cb_size - 3, -+ .log2_diff_max_min_luma_coding_block_size = sps->log2_diff_max_min_coding_block_size, -+ .log2_min_luma_transform_block_size_minus2 = sps->log2_min_tb_size - 2, -+ .log2_diff_max_min_luma_transform_block_size = sps->log2_max_trafo_size - sps->log2_min_tb_size, -+ .max_transform_hierarchy_depth_inter = sps->max_transform_hierarchy_depth_inter, -+ .max_transform_hierarchy_depth_intra = sps->max_transform_hierarchy_depth_intra, -+ .pcm_sample_bit_depth_luma_minus1 = sps->pcm.bit_depth - 1, -+ .pcm_sample_bit_depth_chroma_minus1 = sps->pcm.bit_depth_chroma - 1, -+ .log2_min_pcm_luma_coding_block_size_minus3 = sps->pcm.log2_min_pcm_cb_size - 3, -+ .log2_diff_max_min_pcm_luma_coding_block_size = sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size, -+ .num_short_term_ref_pic_sets = sps->nb_st_rps, -+ .num_long_term_ref_pics_sps = sps->num_long_term_ref_pics_sps, -+ .chroma_format_idc = sps->chroma_format_idc, -+ .sps_max_sub_layers_minus1 = sps->max_sub_layers - 1, -+ }; -+ -+ if (sps->separate_colour_plane_flag) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_SEPARATE_COLOUR_PLANE; -+ -+ if (sps->scaling_list_enable_flag) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED; -+ -+ if (sps->amp_enabled_flag) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_AMP_ENABLED; -+ -+ if (sps->sao_enabled) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET; -+ -+ if (sps->pcm_enabled_flag) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_PCM_ENABLED; -+ -+ if (sps->pcm.loop_filter_disable_flag) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED; -+ -+ if (sps->long_term_ref_pics_present_flag) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT; -+ -+ if (sps->sps_temporal_mvp_enabled_flag) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED; -+ -+ if (sps->sps_strong_intra_smoothing_enable_flag) -+ ctrl->flags |= V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED; -+} -+ -+static void fill_scaling_matrix(const ScalingList * const sl, -+ struct v4l2_ctrl_hevc_scaling_matrix * const sm) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < 6; i++) { -+ unsigned int j; -+ -+ for (j = 0; j < 16; j++) -+ sm->scaling_list_4x4[i][j] = sl->sl[0][i][j]; -+ for (j = 0; j < 64; j++) { -+ sm->scaling_list_8x8[i][j] = sl->sl[1][i][j]; -+ sm->scaling_list_16x16[i][j] = sl->sl[2][i][j]; -+ if (i < 2) -+ sm->scaling_list_32x32[i][j] = sl->sl[3][i * 3][j]; -+ } -+ sm->scaling_list_dc_coef_16x16[i] = sl->sl_dc[0][i]; -+ if (i < 2) -+ sm->scaling_list_dc_coef_32x32[i] = sl->sl_dc[1][i * 3]; -+ } -+} -+ -+static void fill_pps(struct v4l2_ctrl_hevc_pps * const ctrl, const HEVCPPS * const pps) -+{ -+ uint64_t flags = 0; -+ -+ if (pps->dependent_slice_segments_enabled_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED; -+ -+ if (pps->output_flag_present_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT; -+ -+ if (pps->sign_data_hiding_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED; -+ -+ if (pps->cabac_init_present_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT; -+ -+ if (pps->constrained_intra_pred_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED; -+ -+ if (pps->transform_skip_enabled_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED; -+ -+ if (pps->cu_qp_delta_enabled_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED; -+ -+ if (pps->pic_slice_level_chroma_qp_offsets_present_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT; -+ -+ if (pps->weighted_pred_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED; -+ -+ if (pps->weighted_bipred_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED; -+ -+ if (pps->transquant_bypass_enable_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED; -+ -+ if (pps->tiles_enabled_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_TILES_ENABLED; -+ -+ if (pps->entropy_coding_sync_enabled_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED; -+ -+ if (pps->loop_filter_across_tiles_enabled_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED; -+ -+ if (pps->seq_loop_filter_across_slices_enabled_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED; -+ -+ if (pps->deblocking_filter_override_enabled_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED; -+ -+ if (pps->disable_dbf) -+ flags |= V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER; -+ -+ if (pps->lists_modification_present_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT; -+ -+ if (pps->slice_header_extension_present_flag) -+ flags |= V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT; -+ -+ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */ -+ *ctrl = (struct v4l2_ctrl_hevc_pps) { -+ .num_extra_slice_header_bits = pps->num_extra_slice_header_bits, -+ .init_qp_minus26 = pps->pic_init_qp_minus26, -+ .diff_cu_qp_delta_depth = pps->diff_cu_qp_delta_depth, -+ .pps_cb_qp_offset = pps->cb_qp_offset, -+ .pps_cr_qp_offset = pps->cr_qp_offset, -+ .pps_beta_offset_div2 = pps->beta_offset / 2, -+ .pps_tc_offset_div2 = pps->tc_offset / 2, -+ .log2_parallel_merge_level_minus2 = pps->log2_parallel_merge_level - 2, -+ .flags = flags -+ }; -+ -+ -+ if (pps->tiles_enabled_flag) { -+ ctrl->num_tile_columns_minus1 = pps->num_tile_columns - 1; -+ ctrl->num_tile_rows_minus1 = pps->num_tile_rows - 1; -+ -+ for (int i = 0; i < pps->num_tile_columns; i++) -+ ctrl->column_width_minus1[i] = pps->column_width[i] - 1; -+ -+ for (int i = 0; i < pps->num_tile_rows; i++) -+ ctrl->row_height_minus1[i] = pps->row_height[i] - 1; -+ } -+} -+ -+// Called before finally returning the frame to the user -+// Set corrupt flag here as this is actually the frame structure that -+// is going to the user (in MT land each thread has its own pool) -+static int frame_post_process(void *logctx, AVFrame *frame) -+{ -+ V4L2MediaReqDescriptor *rd = (V4L2MediaReqDescriptor*)frame->data[0]; -+ -+// av_log(NULL, AV_LOG_INFO, "%s\n", __func__); -+ frame->flags &= ~AV_FRAME_FLAG_CORRUPT; -+ if (rd->qe_dst) { -+ MediaBufsStatus stat = qent_dst_wait(rd->qe_dst); -+ if (stat != MEDIABUFS_STATUS_SUCCESS) { -+ av_log(logctx, AV_LOG_ERROR, "%s: Decode fail\n", __func__); -+ frame->flags |= AV_FRAME_FLAG_CORRUPT; -+ } -+ } -+ -+ return 0; -+} -+ -+static inline struct timeval cvt_dpb_to_tv(uint64_t t) -+{ -+ t /= 1000; -+ return (struct timeval){ -+ .tv_usec = t % 1000000, -+ .tv_sec = t / 1000000 -+ }; -+} -+ -+static inline uint64_t cvt_timestamp_to_dpb(const unsigned int t) -+{ -+ return (uint64_t)t * 1000; -+} -+ -+static int v4l2_request_hevc_start_frame(AVCodecContext *avctx, -+ av_unused const uint8_t *buffer, -+ av_unused uint32_t size) -+{ -+ const HEVCContext *h = avctx->priv_data; -+ V4L2MediaReqDescriptor *const rd = (V4L2MediaReqDescriptor *)h->ref->frame->data[0]; -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ -+// av_log(NULL, AV_LOG_INFO, "%s\n", __func__); -+ decode_q_add(&ctx->decode_q, &rd->decode_ent); -+ -+ rd->num_slices = 0; -+ ctx->timestamp++; -+ rd->timestamp = cvt_timestamp_to_dpb(ctx->timestamp); -+ -+ { -+ FrameDecodeData * const fdd = (FrameDecodeData*)h->ref->frame->private_ref->data; -+ fdd->post_process = frame_post_process; -+ } -+ -+ // qe_dst needs to be bound to the data buffer and only returned when that is -+ if (!rd->qe_dst) -+ { -+ if ((rd->qe_dst = mediabufs_dst_qent_alloc(ctx->mbufs, ctx->dbufs)) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Failed to get dst buffer\n", __func__); -+ return AVERROR(ENOMEM); -+ } -+ } -+ -+ ff_thread_finish_setup(avctx); // Allow next thread to enter rpi_hevc_start_frame -+ -+ return 0; -+} -+ -+// Object fd & size will be zapped by this & need setting later -+static int drm_from_format(AVDRMFrameDescriptor * const desc, const struct v4l2_format * const format) -+{ -+ AVDRMLayerDescriptor *layer = &desc->layers[0]; -+ unsigned int width; -+ unsigned int height; -+ unsigned int bpl; -+ uint32_t pixelformat; -+ -+ if (V4L2_TYPE_IS_MULTIPLANAR(format->type)) { -+ width = format->fmt.pix_mp.width; -+ height = format->fmt.pix_mp.height; -+ pixelformat = format->fmt.pix_mp.pixelformat; -+ bpl = format->fmt.pix_mp.plane_fmt[0].bytesperline; -+ } -+ else { -+ width = format->fmt.pix.width; -+ height = format->fmt.pix.height; -+ pixelformat = format->fmt.pix.pixelformat; -+ bpl = format->fmt.pix.bytesperline; -+ } -+ -+ switch (pixelformat) { -+ case V4L2_PIX_FMT_NV12: -+ layer->format = DRM_FORMAT_NV12; -+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; -+ break; -+#if CONFIG_SAND -+ case V4L2_PIX_FMT_NV12_COL128: -+ layer->format = DRM_FORMAT_NV12; -+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(bpl); -+ break; -+ case V4L2_PIX_FMT_NV12_10_COL128: -+ layer->format = DRM_FORMAT_P030; -+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(bpl); -+ break; -+#endif -+#ifdef DRM_FORMAT_MOD_ALLWINNER_TILED -+ case V4L2_PIX_FMT_SUNXI_TILED_NV12: -+ layer->format = DRM_FORMAT_NV12; -+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_ALLWINNER_TILED; -+ break; -+#endif -+#if defined(V4L2_PIX_FMT_NV15) && defined(DRM_FORMAT_NV15) -+ case V4L2_PIX_FMT_NV15: -+ layer->format = DRM_FORMAT_NV15; -+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; -+ break; -+#endif -+ case V4L2_PIX_FMT_NV16: -+ layer->format = DRM_FORMAT_NV16; -+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; -+ break; -+#if defined(V4L2_PIX_FMT_NV20) && defined(DRM_FORMAT_NV20) -+ case V4L2_PIX_FMT_NV20: -+ layer->format = DRM_FORMAT_NV20; -+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; -+ break; -+#endif -+ default: -+ return -1; -+ } -+ -+ desc->nb_objects = 1; -+ desc->objects[0].fd = -1; -+ desc->objects[0].size = 0; -+ -+ desc->nb_layers = 1; -+ layer->nb_planes = 2; -+ -+ layer->planes[0].object_index = 0; -+ layer->planes[0].offset = 0; -+ layer->planes[0].pitch = bpl; -+#if CONFIG_SAND -+ if (pixelformat == V4L2_PIX_FMT_NV12_COL128) { -+ layer->planes[1].object_index = 0; -+ layer->planes[1].offset = height * 128; -+ layer->planes[0].pitch = width; -+ layer->planes[1].pitch = width; -+ } -+ else if (pixelformat == V4L2_PIX_FMT_NV12_10_COL128) { -+ layer->planes[1].object_index = 0; -+ layer->planes[1].offset = height * 128; -+ layer->planes[0].pitch = width * 2; // Lies but it keeps DRM import happy -+ layer->planes[1].pitch = width * 2; -+ } -+ else -+#endif -+ { -+ layer->planes[1].object_index = 0; -+ layer->planes[1].offset = layer->planes[0].pitch * height; -+ layer->planes[1].pitch = layer->planes[0].pitch; -+ } -+ -+ return 0; -+} -+ -+static int -+set_req_ctls(V4L2RequestContextHEVC *ctx, struct media_request * const mreq, -+ struct req_controls *const controls, -+#if HEVC_CTRLS_VERSION >= 2 -+ struct v4l2_ctrl_hevc_decode_params * const dec, -+#endif -+ struct v4l2_ctrl_hevc_slice_params * const slices, -+ const unsigned int slice_no, -+ const unsigned int slice_count) -+{ -+ int rv; -+ -+ struct v4l2_ext_control control[] = { -+ { -+ .id = V4L2_CID_MPEG_VIDEO_HEVC_SPS, -+ .ptr = &controls->sps, -+ .size = sizeof(controls->sps), -+ }, -+ { -+ .id = V4L2_CID_MPEG_VIDEO_HEVC_PPS, -+ .ptr = &controls->pps, -+ .size = sizeof(controls->pps), -+ }, -+#if HEVC_CTRLS_VERSION >= 2 -+ { -+ .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS, -+ .ptr = dec, -+ .size = sizeof(*dec), -+ }, -+#endif -+ { -+ .id = V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS, -+ .ptr = slices + slice_no, -+ .size = sizeof(*slices) * slice_count, -+ }, -+ // Optional -+ { -+ .id = V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX, -+ .ptr = &controls->scaling_matrix, -+ .size = sizeof(controls->scaling_matrix), -+ }, -+ }; -+ -+ rv = mediabufs_ctl_set_ext_ctrls(ctx->mbufs, mreq, control, -+ controls->has_scaling ? -+ FF_ARRAY_ELEMS(control) : -+ FF_ARRAY_ELEMS(control) - 1); -+ -+ return rv; -+} -+ -+static int v4l2_request_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) -+{ -+ const HEVCContext * const h = avctx->priv_data; -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ V4L2MediaReqDescriptor * const rd = (V4L2MediaReqDescriptor*)h->ref->frame->data[0]; -+ int bcount = get_bits_count(&h->HEVClc->gb); -+ uint32_t boff = (ptr_from_index(buffer, bcount/8 + 1) - (buffer + bcount/8 + 1)) * 8 + bcount; -+ -+ int rv; -+ struct slice_info * si; -+ -+ if ((rv = slice_add(rd)) != 0) -+ return rv; -+ -+ si = rd->slices + rd->num_slices - 1; -+ si->ptr = buffer; -+ si->len = size; -+ -+ if (ctx->multi_slice && rd->num_slices > 1) { -+ struct slice_info *const si0 = rd->slices; -+ const size_t offset = (buffer - si0->ptr); -+ boff += offset * 8; -+ size += offset; -+ si0->len = si->len + offset; -+ } -+ -+#if HEVC_CTRLS_VERSION >= 2 -+ if (rd->num_slices == 1) -+ fill_decode_params(h, &rd->dec); -+ fill_slice_params(h, &rd->dec, rd->slice_params + rd->num_slices - 1, size * 8, boff); -+#else -+ fill_slice_params(h, rd->slice_params + rd->num_slices - 1, size * 8, boff); -+#endif -+ -+ return 0; -+} -+ -+static void v4l2_request_hevc_abort_frame(AVCodecContext * const avctx) -+{ -+ const HEVCContext * const h = avctx->priv_data; -+ if (h->ref != NULL) { -+ V4L2MediaReqDescriptor *const rd = (V4L2MediaReqDescriptor *)h->ref->frame->data[0]; -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ -+ media_request_abort(&rd->req); -+ mediabufs_src_qent_abort(ctx->mbufs, &rd->qe_src); -+ -+ decode_q_remove(&ctx->decode_q, &rd->decode_ent); -+ } -+} -+ -+static int send_slice(AVCodecContext * const avctx, -+ V4L2MediaReqDescriptor * const rd, -+ struct req_controls *const controls, -+ const unsigned int i, const unsigned int j) -+{ -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ -+ struct slice_info *const si = rd->slices + i; -+ struct media_request * req = NULL; -+ struct qent_src * src = NULL; -+ MediaBufsStatus stat; -+ -+ if ((req = media_request_get(ctx->mpool)) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Failed to alloc media request\n", __func__); -+ return AVERROR(ENOMEM); -+ } -+ -+ if (set_req_ctls(ctx, req, -+ controls, -+#if HEVC_CTRLS_VERSION >= 2 -+ &rd->dec, -+#endif -+ rd->slice_params, -+ i, j - i)) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Failed to set req ctls\n", __func__); -+ goto fail1; -+ } -+ -+ if ((src = mediabufs_src_qent_get(ctx->mbufs)) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Failed to get src buffer\n", __func__); -+ goto fail1; -+ } -+ -+ if (qent_src_data_copy(src, 0, si->ptr, si->len, ctx->dbufs) != 0) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Failed data copy\n", __func__); -+ goto fail2; -+ } -+ -+ if (qent_src_params_set(src, &controls->tv)) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Failed src param set\n", __func__); -+ goto fail2; -+ } -+ -+#warning ANNEX_B start code -+// if (ctx->start_code == V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B) { -+// } -+ -+ stat = mediabufs_start_request(ctx->mbufs, &req, &src, -+ i == 0 ? rd->qe_dst : NULL, -+ j == rd->num_slices); -+ -+ if (stat != MEDIABUFS_STATUS_SUCCESS) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Failed to start request\n", __func__); -+ return AVERROR_UNKNOWN; -+ } -+ return 0; -+ -+fail2: -+ mediabufs_src_qent_abort(ctx->mbufs, &src); -+fail1: -+ media_request_abort(&req); -+ return AVERROR_UNKNOWN; -+} -+ -+static int v4l2_request_hevc_end_frame(AVCodecContext *avctx) -+{ -+ const HEVCContext * const h = avctx->priv_data; -+ V4L2MediaReqDescriptor *rd = (V4L2MediaReqDescriptor*)h->ref->frame->data[0]; -+ V4L2RequestContextHEVC *ctx = avctx->internal->hwaccel_priv_data; -+ struct req_controls rc; -+ unsigned int i; -+ int rv; -+ -+ // It is possible, though maybe a bug, to get an end_frame without -+ // a previous start_frame. If we do then give up. -+ if (!decode_q_in_q(&rd->decode_ent)) { -+ av_log(avctx, AV_LOG_DEBUG, "%s: Frame not in decode Q\n", __func__); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ { -+ const ScalingList *sl = h->ps.pps->scaling_list_data_present_flag ? -+ &h->ps.pps->scaling_list : -+ h->ps.sps->scaling_list_enable_flag ? -+ &h->ps.sps->scaling_list : NULL; -+ -+ -+ memset(&rc, 0, sizeof(rc)); -+ rc.tv = cvt_dpb_to_tv(rd->timestamp); -+ fill_sps(&rc.sps, h->ps.sps); -+ fill_pps(&rc.pps, h->ps.pps); -+ if (sl) { -+ rc.has_scaling = 1; -+ fill_scaling_matrix(sl, &rc.scaling_matrix); -+ } -+ } -+ -+ decode_q_wait(&ctx->decode_q, &rd->decode_ent); -+ -+ // qe_dst needs to be bound to the data buffer and only returned when that is -+ // Alloc almost certainly wants to be serialised if there is any chance of blocking -+ // so we get the next frame to be free in the thread that needs it for decode first. -+ // -+ // In our current world this probably isn't a concern but put it here anyway -+ if (!rd->qe_dst) -+ { -+ if ((rd->qe_dst = mediabufs_dst_qent_alloc(ctx->mbufs, ctx->dbufs)) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "%s: Failed to get dst buffer\n", __func__); -+ rv = AVERROR(ENOMEM); -+ goto fail; -+ } -+ } -+ -+ // Send as slices -+ if (ctx->multi_slice) -+ { -+ if ((rv = send_slice(avctx, rd, &rc, 0, rd->num_slices)) != 0) -+ goto fail; -+ } -+ else -+ { -+ for (i = 0; i != rd->num_slices; ++i) { -+ if ((rv = send_slice(avctx, rd, &rc, i, i + 1)) != 0) -+ goto fail; -+ } -+ } -+ -+ // Set the drm_prime desriptor -+ drm_from_format(&rd->drm, mediabufs_dst_fmt(ctx->mbufs)); -+ rd->drm.objects[0].fd = dmabuf_fd(qent_dst_dmabuf(rd->qe_dst, 0)); -+ rd->drm.objects[0].size = dmabuf_size(qent_dst_dmabuf(rd->qe_dst, 0)); -+ -+ decode_q_remove(&ctx->decode_q, &rd->decode_ent); -+ return 0; -+ -+fail: -+ decode_q_remove(&ctx->decode_q, &rd->decode_ent); -+ return rv; -+} -+ -+// Initial check & init -+static int -+probe(AVCodecContext * const avctx, V4L2RequestContextHEVC * const ctx) -+{ -+ const HEVCContext *h = avctx->priv_data; -+ const HEVCSPS * const sps = h->ps.sps; -+ struct v4l2_ctrl_hevc_sps ctrl_sps; -+ unsigned int i; -+ -+ // Check for var slice array -+ struct v4l2_query_ext_ctrl qc[] = { -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS }, -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_SPS }, -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_PPS }, -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX }, -+#if HEVC_CTRLS_VERSION >= 2 -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS }, -+#endif -+ }; -+ // Order & size must match! -+ static const size_t ctrl_sizes[] = { -+ sizeof(struct v4l2_ctrl_hevc_slice_params), -+ sizeof(struct v4l2_ctrl_hevc_sps), -+ sizeof(struct v4l2_ctrl_hevc_pps), -+ sizeof(struct v4l2_ctrl_hevc_scaling_matrix), -+#if HEVC_CTRLS_VERSION >= 2 -+ sizeof(struct v4l2_ctrl_hevc_decode_params), -+#endif -+ }; -+ const unsigned int noof_ctrls = FF_ARRAY_ELEMS(qc); -+ -+ if (mediabufs_ctl_query_ext_ctrls(ctx->mbufs, qc, noof_ctrls)) { -+ av_log(avctx, AV_LOG_DEBUG, "Probed V%d control missing\n", HEVC_CTRLS_VERSION); -+ return AVERROR(EINVAL); -+ } -+ for (i = 0; i != noof_ctrls; ++i) { -+ if (ctrl_sizes[i] != qc[i].elem_size) { -+ av_log(avctx, AV_LOG_DEBUG, "Probed V%d control %d size mismatch %u != %u\n", -+ HEVC_CTRLS_VERSION, i, ctrl_sizes[i], qc[i].elem_size); -+ return AVERROR(EINVAL); -+ } -+ } -+ -+ fill_sps(&ctrl_sps, sps); -+ -+ if (mediabufs_set_ext_ctrl(ctx->mbufs, NULL, V4L2_CID_MPEG_VIDEO_HEVC_SPS, &ctrl_sps, sizeof(ctrl_sps))) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to set initial SPS\n"); -+ return AVERROR(EINVAL); -+ } -+ -+ ctx->multi_slice = (qc[0].flags & V4L2_CTRL_FLAG_DYNAMIC_ARRAY) != 0; -+ return 0; -+} -+ -+// Final init -+static int -+set_controls(AVCodecContext * const avctx, V4L2RequestContextHEVC * const ctx) -+{ -+ int ret; -+ -+ struct v4l2_query_ext_ctrl querys[] = { -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE, }, -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_START_CODE, }, -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS, }, -+ }; -+ -+ struct v4l2_ext_control ctrls[] = { -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE, }, -+ { .id = V4L2_CID_MPEG_VIDEO_HEVC_START_CODE, }, -+ }; -+ -+ mediabufs_ctl_query_ext_ctrls(ctx->mbufs, querys, FF_ARRAY_ELEMS(querys)); -+ -+ ctx->decode_mode = querys[0].default_value; -+ -+ if (ctx->decode_mode != V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED && -+ ctx->decode_mode != V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED) { -+ av_log(avctx, AV_LOG_ERROR, "%s: unsupported decode mode, %d\n", __func__, ctx->decode_mode); -+ return AVERROR(EINVAL); -+ } -+ -+ ctx->start_code = querys[1].default_value; -+ if (ctx->start_code != V4L2_MPEG_VIDEO_HEVC_START_CODE_NONE && -+ ctx->start_code != V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B) { -+ av_log(avctx, AV_LOG_ERROR, "%s: unsupported start code, %d\n", __func__, ctx->start_code); -+ return AVERROR(EINVAL); -+ } -+ -+ ctx->max_slices = querys[2].elems; -+ if (ctx->max_slices > MAX_SLICES) { -+ av_log(avctx, AV_LOG_ERROR, "%s: unsupported max slices, %d\n", __func__, ctx->max_slices); -+ return AVERROR(EINVAL); -+ } -+ -+ ctrls[0].value = ctx->decode_mode; -+ ctrls[1].value = ctx->start_code; -+ -+ ret = mediabufs_ctl_set_ext_ctrls(ctx->mbufs, NULL, ctrls, FF_ARRAY_ELEMS(ctrls)); -+ return !ret ? 0 : AVERROR(-ret); -+} -+ -+static void v4l2_req_frame_free(void *opaque, uint8_t *data) -+{ -+ AVCodecContext *avctx = opaque; -+ V4L2MediaReqDescriptor * const rd = (V4L2MediaReqDescriptor*)data; -+ -+ av_log(NULL, AV_LOG_DEBUG, "%s: avctx=%p data=%p\n", __func__, avctx, data); -+ -+ qent_dst_unref(&rd->qe_dst); -+ -+ // We don't expect req or qe_src to be set -+ if (rd->req || rd->qe_src) -+ av_log(NULL, AV_LOG_ERROR, "%s: qe_src %p or req %p not NULL\n", __func__, rd->req, rd->qe_src); -+ -+ av_freep(&rd->slices); -+ av_freep(&rd->slice_params); -+ -+ av_free(rd); -+} -+ -+static AVBufferRef *v4l2_req_frame_alloc(void *opaque, int size) -+{ -+ AVCodecContext *avctx = opaque; -+// V4L2RequestContextHEVC *ctx = avctx->internal->hwaccel_priv_data; -+// V4L2MediaReqDescriptor *req; -+ AVBufferRef *ref; -+ uint8_t *data; -+// int ret; -+ -+ data = av_mallocz(size); -+ if (!data) -+ return NULL; -+ -+ av_log(avctx, AV_LOG_DEBUG, "%s: avctx=%p size=%d data=%p\n", __func__, avctx, size, data); -+ ref = av_buffer_create(data, size, v4l2_req_frame_free, avctx, 0); -+ if (!ref) { -+ av_freep(&data); -+ return NULL; -+ } -+ return ref; -+} -+ -+static void v4l2_req_pool_free(void *opaque) -+{ -+ av_log(NULL, AV_LOG_DEBUG, "%s: opaque=%p\n", __func__, opaque); -+} -+ -+static void v4l2_req_hwframe_ctx_free(AVHWFramesContext *hwfc) -+{ -+ av_log(NULL, AV_LOG_DEBUG, "%s: hwfc=%p pool=%p\n", __func__, hwfc, hwfc->pool); -+ -+ av_buffer_pool_uninit(&hwfc->pool); -+} -+ -+static int frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) -+{ -+ V4L2RequestContextHEVC *ctx = avctx->internal->hwaccel_priv_data; -+ AVHWFramesContext *hwfc = (AVHWFramesContext*)hw_frames_ctx->data; -+ const struct v4l2_format *vfmt = mediabufs_dst_fmt(ctx->mbufs); -+ -+ hwfc->format = AV_PIX_FMT_DRM_PRIME; -+ hwfc->sw_format = pixel_format_from_format(vfmt); -+ if (V4L2_TYPE_IS_MULTIPLANAR(vfmt->type)) { -+ hwfc->width = vfmt->fmt.pix_mp.width; -+ hwfc->height = vfmt->fmt.pix_mp.height; -+ } else { -+ hwfc->width = vfmt->fmt.pix.width; -+ hwfc->height = vfmt->fmt.pix.height; -+ } -+ -+ hwfc->pool = av_buffer_pool_init2(sizeof(V4L2MediaReqDescriptor), avctx, v4l2_req_frame_alloc, v4l2_req_pool_free); -+ if (!hwfc->pool) -+ return AVERROR(ENOMEM); -+ -+ hwfc->free = v4l2_req_hwframe_ctx_free; -+ -+ hwfc->initial_pool_size = 1; -+ -+ switch (avctx->codec_id) { -+ case AV_CODEC_ID_VP9: -+ hwfc->initial_pool_size += 8; -+ break; -+ case AV_CODEC_ID_VP8: -+ hwfc->initial_pool_size += 3; -+ break; -+ default: -+ hwfc->initial_pool_size += 2; -+ } -+ -+ av_log(avctx, AV_LOG_DEBUG, "%s: avctx=%p ctx=%p hw_frames_ctx=%p hwfc=%p pool=%p width=%d height=%d initial_pool_size=%d\n", __func__, avctx, ctx, hw_frames_ctx, hwfc, hwfc->pool, hwfc->width, hwfc->height, hwfc->initial_pool_size); -+ -+ return 0; -+} -+ -+ -+const v4l2_req_decode_fns V(ff_v4l2_req_hevc) = { -+ .src_pix_fmt_v4l2 = V4L2_PIX_FMT_HEVC_SLICE, -+ .name = "V4L2 HEVC stateless V" STR(HEVC_CTRLS_VERSION), -+ .probe = probe, -+ .set_controls = set_controls, -+ -+ .start_frame = v4l2_request_hevc_start_frame, -+ .decode_slice = v4l2_request_hevc_decode_slice, -+ .end_frame = v4l2_request_hevc_end_frame, -+ .abort_frame = v4l2_request_hevc_abort_frame, -+ .frame_params = frame_params, -+}; -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_media.c -@@ -0,0 +1,1569 @@ -+/* -+ * Copyright (C) 2018 Paul Kocialkowski -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sub license, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the -+ * next paragraph) shall be included in all copies or substantial portions -+ * of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include "v4l2_req_dmabufs.h" -+#include "v4l2_req_media.h" -+#include "v4l2_req_pollqueue.h" -+#include "v4l2_req_utils.h" -+#include "weak_link.h" -+ -+ -+/* floor(log2(x)) */ -+static unsigned int log2_size(size_t x) -+{ -+ unsigned int n = 0; -+ -+ if (x & ~0xffff) { -+ n += 16; -+ x >>= 16; -+ } -+ if (x & ~0xff) { -+ n += 8; -+ x >>= 8; -+ } -+ if (x & ~0xf) { -+ n += 4; -+ x >>= 4; -+ } -+ if (x & ~3) { -+ n += 2; -+ x >>= 2; -+ } -+ return (x & ~1) ? n + 1 : n; -+} -+ -+static size_t round_up_size(const size_t x) -+{ -+ /* Admit no size < 256 */ -+ const unsigned int n = x < 256 ? 8 : log2_size(x) - 1; -+ -+ return x >= (3 << n) ? 4 << n : (3 << n); -+} -+ -+struct media_request; -+ -+struct media_pool { -+ int fd; -+ sem_t sem; -+ pthread_mutex_t lock; -+ struct media_request * free_reqs; -+ struct pollqueue * pq; -+}; -+ -+struct media_request { -+ struct media_request * next; -+ struct media_pool * mp; -+ int fd; -+ struct polltask * pt; -+}; -+ -+ -+static inline int do_trywait(sem_t *const sem) -+{ -+ while (sem_trywait(sem)) { -+ if (errno != EINTR) -+ return -errno; -+ } -+ return 0; -+} -+ -+static inline int do_wait(sem_t *const sem) -+{ -+ while (sem_wait(sem)) { -+ if (errno != EINTR) -+ return -errno; -+ } -+ return 0; -+} -+ -+static int request_buffers(int video_fd, unsigned int type, -+ enum v4l2_memory memory, unsigned int buffers_count) -+{ -+ struct v4l2_requestbuffers buffers; -+ int rc; -+ -+ memset(&buffers, 0, sizeof(buffers)); -+ buffers.type = type; -+ buffers.memory = memory; -+ buffers.count = buffers_count; -+ -+ rc = ioctl(video_fd, VIDIOC_REQBUFS, &buffers); -+ if (rc < 0) { -+ rc = -errno; -+ request_log("Unable to request %d type %d buffers: %s\n", buffers_count, type, strerror(-rc)); -+ return rc; -+ } -+ -+ return 0; -+} -+ -+ -+static int set_stream(int video_fd, unsigned int type, bool enable) -+{ -+ enum v4l2_buf_type buf_type = type; -+ int rc; -+ -+ rc = ioctl(video_fd, enable ? VIDIOC_STREAMON : VIDIOC_STREAMOFF, -+ &buf_type); -+ if (rc < 0) { -+ rc = -errno; -+ request_log("Unable to %sable stream: %s\n", -+ enable ? "en" : "dis", strerror(-rc)); -+ return rc; -+ } -+ -+ return 0; -+} -+ -+ -+ -+struct media_request * media_request_get(struct media_pool * const mp) -+{ -+ struct media_request *req = NULL; -+ -+ /* Timeout handled by poll code */ -+ if (do_wait(&mp->sem)) -+ return NULL; -+ -+ pthread_mutex_lock(&mp->lock); -+ req = mp->free_reqs; -+ if (req) { -+ mp->free_reqs = req->next; -+ req->next = NULL; -+ } -+ pthread_mutex_unlock(&mp->lock); -+ return req; -+} -+ -+int media_request_fd(const struct media_request * const req) -+{ -+ return req->fd; -+} -+ -+int media_request_start(struct media_request * const req) -+{ -+ while (ioctl(req->fd, MEDIA_REQUEST_IOC_QUEUE, NULL) == -1) -+ { -+ const int err = errno; -+ if (err == EINTR) -+ continue; -+ request_log("%s: Failed to Q media: (%d) %s\n", __func__, err, strerror(err)); -+ return -err; -+ } -+ -+ pollqueue_add_task(req->pt, 2000); -+ return 0; -+} -+ -+static void media_request_done(void *v, short revents) -+{ -+ struct media_request *const req = v; -+ struct media_pool *const mp = req->mp; -+ -+ /* ** Not sure what to do about timeout */ -+ -+ if (ioctl(req->fd, MEDIA_REQUEST_IOC_REINIT, NULL) < 0) -+ request_log("Unable to reinit media request: %s\n", -+ strerror(errno)); -+ -+ pthread_mutex_lock(&mp->lock); -+ req->next = mp->free_reqs; -+ mp->free_reqs = req; -+ pthread_mutex_unlock(&mp->lock); -+ sem_post(&mp->sem); -+} -+ -+int media_request_abort(struct media_request ** const preq) -+{ -+ struct media_request * const req = *preq; -+ -+ if (req == NULL) -+ return 0; -+ *preq = NULL; -+ -+ media_request_done(req, 0); -+ return 0; -+} -+ -+static void delete_req_chain(struct media_request * const chain) -+{ -+ struct media_request * next = chain; -+ while (next) { -+ struct media_request * const req = next; -+ next = req->next; -+ if (req->pt) -+ polltask_delete(&req->pt); -+ if (req->fd != -1) -+ close(req->fd); -+ free(req); -+ } -+} -+ -+struct media_pool * media_pool_new(const char * const media_path, -+ struct pollqueue * const pq, -+ const unsigned int n) -+{ -+ struct media_pool * const mp = calloc(1, sizeof(*mp)); -+ unsigned int i; -+ -+ if (!mp) -+ goto fail0; -+ -+ mp->pq = pq; -+ pthread_mutex_init(&mp->lock, NULL); -+ mp->fd = open(media_path, O_RDWR | O_NONBLOCK); -+ if (mp->fd == -1) { -+ request_log("Failed to open '%s': %s\n", media_path, strerror(errno)); -+ goto fail1; -+ } -+ -+ for (i = 0; i != n; ++i) { -+ struct media_request * req = malloc(sizeof(*req)); -+ if (!req) -+ goto fail4; -+ -+ *req = (struct media_request){ -+ .next = mp->free_reqs, -+ .mp = mp, -+ .fd = -1 -+ }; -+ mp->free_reqs = req; -+ -+ if (ioctl(mp->fd, MEDIA_IOC_REQUEST_ALLOC, &req->fd) == -1) { -+ request_log("Failed to alloc request %d: %s\n", i, strerror(errno)); -+ goto fail4; -+ } -+ -+ req->pt = polltask_new(pq, req->fd, POLLPRI, media_request_done, req); -+ if (!req->pt) -+ goto fail4; -+ } -+ -+ sem_init(&mp->sem, 0, n); -+ -+ return mp; -+ -+fail4: -+ delete_req_chain(mp->free_reqs); -+ close(mp->fd); -+ pthread_mutex_destroy(&mp->lock); -+fail1: -+ free(mp); -+fail0: -+ return NULL; -+} -+ -+void media_pool_delete(struct media_pool ** pMp) -+{ -+ struct media_pool * const mp = *pMp; -+ -+ if (!mp) -+ return; -+ *pMp = NULL; -+ -+ delete_req_chain(mp->free_reqs); -+ close(mp->fd); -+ sem_destroy(&mp->sem); -+ pthread_mutex_destroy(&mp->lock); -+ free(mp); -+} -+ -+ -+#define INDEX_UNSET (~(uint32_t)0) -+ -+enum qent_status { -+ QENT_NEW = 0, // Initial state - shouldn't last -+ QENT_FREE, // On free chain -+ QENT_PENDING, // User has ent -+ QENT_WAITING, // On inuse -+ QENT_DONE, // Frame rx -+ QENT_ERROR, // Error -+ QENT_IMPORT -+}; -+ -+struct qent_base { -+ atomic_int ref_count; -+ struct qent_base *next; -+ struct qent_base *prev; -+ enum qent_status status; -+ uint32_t index; -+ struct dmabuf_h *dh[VIDEO_MAX_PLANES]; -+ struct timeval timestamp; -+}; -+ -+struct qent_src { -+ struct qent_base base; -+ int fixed_size; -+}; -+ -+struct qent_dst { -+ struct qent_base base; -+ bool waiting; -+ pthread_mutex_t lock; -+ pthread_cond_t cond; -+ struct ff_weak_link_client * mbc_wl; -+}; -+ -+struct qe_list_head { -+ struct qent_base *head; -+ struct qent_base *tail; -+}; -+ -+struct buf_pool { -+ pthread_mutex_t lock; -+ sem_t free_sem; -+ enum v4l2_buf_type buf_type; -+ struct qe_list_head free; -+ struct qe_list_head inuse; -+}; -+ -+ -+static inline struct qent_dst *base_to_dst(struct qent_base *be) -+{ -+ return (struct qent_dst *)be; -+} -+ -+static inline struct qent_src *base_to_src(struct qent_base *be) -+{ -+ return (struct qent_src *)be; -+} -+ -+ -+#define QENT_BASE_INITIALIZER {\ -+ .ref_count = ATOMIC_VAR_INIT(0),\ -+ .status = QENT_NEW,\ -+ .index = INDEX_UNSET\ -+} -+ -+static void qe_base_uninit(struct qent_base *const be) -+{ -+ unsigned int i; -+ for (i = 0; i != VIDEO_MAX_PLANES; ++i) { -+ dmabuf_free(be->dh[i]); -+ be->dh[i] = NULL; -+ } -+} -+ -+static void qe_src_free(struct qent_src *const be_src) -+{ -+ if (!be_src) -+ return; -+ qe_base_uninit(&be_src->base); -+ free(be_src); -+} -+ -+static struct qent_src * qe_src_new(void) -+{ -+ struct qent_src *const be_src = malloc(sizeof(*be_src)); -+ if (!be_src) -+ return NULL; -+ *be_src = (struct qent_src){ -+ .base = QENT_BASE_INITIALIZER -+ }; -+ return be_src; -+} -+ -+static void qe_dst_free(struct qent_dst *const be_dst) -+{ -+ if (!be_dst) -+ return; -+ -+ ff_weak_link_unref(&be_dst->mbc_wl); -+ pthread_cond_destroy(&be_dst->cond); -+ pthread_mutex_destroy(&be_dst->lock); -+ qe_base_uninit(&be_dst->base); -+ free(be_dst); -+} -+ -+static struct qent_dst * qe_dst_new(void) -+{ -+ struct qent_dst *const be_dst = malloc(sizeof(*be_dst)); -+ if (!be_dst) -+ return NULL; -+ *be_dst = (struct qent_dst){ -+ .base = QENT_BASE_INITIALIZER, -+ .lock = PTHREAD_MUTEX_INITIALIZER, -+ .cond = PTHREAD_COND_INITIALIZER -+ }; -+ return be_dst; -+} -+ -+static void ql_add_tail(struct qe_list_head * const ql, struct qent_base * be) -+{ -+ if (ql->tail) -+ ql->tail->next = be; -+ else -+ ql->head = be; -+ be->prev = ql->tail; -+ be->next = NULL; -+ ql->tail = be; -+} -+ -+static struct qent_base * ql_extract(struct qe_list_head * const ql, struct qent_base * be) -+{ -+ if (!be) -+ return NULL; -+ -+ if (be->next) -+ be->next->prev = be->prev; -+ else -+ ql->tail = be->prev; -+ if (be->prev) -+ be->prev->next = be->next; -+ else -+ ql->head = be->next; -+ be->next = NULL; -+ be->prev = NULL; -+ return be; -+} -+ -+ -+static void bq_put_free(struct buf_pool *const bp, struct qent_base * be) -+{ -+ ql_add_tail(&bp->free, be); -+} -+ -+static struct qent_base * bq_get_free(struct buf_pool *const bp) -+{ -+ return ql_extract(&bp->free, bp->free.head); -+} -+ -+static struct qent_base * bq_extract_inuse(struct buf_pool *const bp, struct qent_base *const be) -+{ -+ return ql_extract(&bp->inuse, be); -+} -+ -+static struct qent_base * bq_get_inuse(struct buf_pool *const bp) -+{ -+ return ql_extract(&bp->inuse, bp->inuse.head); -+} -+ -+static void bq_free_all_free_src(struct buf_pool *const bp) -+{ -+ struct qent_base *be; -+ while ((be = bq_get_free(bp)) != NULL) -+ qe_src_free(base_to_src(be)); -+} -+ -+static void bq_free_all_inuse_src(struct buf_pool *const bp) -+{ -+ struct qent_base *be; -+ while ((be = bq_get_inuse(bp)) != NULL) -+ qe_src_free(base_to_src(be)); -+} -+ -+static void bq_free_all_free_dst(struct buf_pool *const bp) -+{ -+ struct qent_base *be; -+ while ((be = bq_get_free(bp)) != NULL) -+ qe_dst_free(base_to_dst(be)); -+} -+ -+static void queue_put_free(struct buf_pool *const bp, struct qent_base *be) -+{ -+ unsigned int i; -+ -+ pthread_mutex_lock(&bp->lock); -+ /* Clear out state vars */ -+ be->timestamp.tv_sec = 0; -+ be->timestamp.tv_usec = 0; -+ be->status = QENT_FREE; -+ for (i = 0; i < VIDEO_MAX_PLANES && be->dh[i]; ++i) -+ dmabuf_len_set(be->dh[i], 0); -+ bq_put_free(bp, be); -+ pthread_mutex_unlock(&bp->lock); -+ sem_post(&bp->free_sem); -+} -+ -+static bool queue_is_inuse(const struct buf_pool *const bp) -+{ -+ return bp->inuse.tail != NULL; -+} -+ -+static void queue_put_inuse(struct buf_pool *const bp, struct qent_base *be) -+{ -+ if (!be) -+ return; -+ pthread_mutex_lock(&bp->lock); -+ ql_add_tail(&bp->inuse, be); -+ be->status = QENT_WAITING; -+ pthread_mutex_unlock(&bp->lock); -+} -+ -+static struct qent_base *queue_get_free(struct buf_pool *const bp) -+{ -+ struct qent_base *buf; -+ -+ if (do_wait(&bp->free_sem)) -+ return NULL; -+ pthread_mutex_lock(&bp->lock); -+ buf = bq_get_free(bp); -+ pthread_mutex_unlock(&bp->lock); -+ return buf; -+} -+ -+static struct qent_base *queue_tryget_free(struct buf_pool *const bp) -+{ -+ struct qent_base *buf; -+ -+ if (do_trywait(&bp->free_sem)) -+ return NULL; -+ pthread_mutex_lock(&bp->lock); -+ buf = bq_get_free(bp); -+ pthread_mutex_unlock(&bp->lock); -+ return buf; -+} -+ -+static struct qent_base * queue_find_extract_fd(struct buf_pool *const bp, const int fd) -+{ -+ struct qent_base *be; -+ -+ pthread_mutex_lock(&bp->lock); -+ /* Expect 1st in Q, but allow anywhere */ -+ for (be = bp->inuse.head; be; be = be->next) { -+ if (dmabuf_fd(be->dh[0]) == fd) { -+ bq_extract_inuse(bp, be); -+ break; -+ } -+ } -+ pthread_mutex_unlock(&bp->lock); -+ -+ return be; -+} -+ -+static void queue_delete(struct buf_pool *const bp) -+{ -+ sem_destroy(&bp->free_sem); -+ pthread_mutex_destroy(&bp->lock); -+ free(bp); -+} -+ -+static struct buf_pool* queue_new(const int vfd) -+{ -+ struct buf_pool *bp = calloc(1, sizeof(*bp)); -+ if (!bp) -+ return NULL; -+ pthread_mutex_init(&bp->lock, NULL); -+ sem_init(&bp->free_sem, 0, 0); -+ return bp; -+} -+ -+ -+struct mediabufs_ctl { -+ atomic_int ref_count; /* 0 is single ref for easier atomics */ -+ void * dc; -+ int vfd; -+ bool stream_on; -+ bool polling; -+ pthread_mutex_t lock; -+ struct buf_pool * src; -+ struct buf_pool * dst; -+ struct polltask * pt; -+ struct pollqueue * pq; -+ struct ff_weak_link_master * this_wlm; -+ -+ struct v4l2_format src_fmt; -+ struct v4l2_format dst_fmt; -+}; -+ -+static int qe_v4l2_queue(struct qent_base *const be, -+ const int vfd, struct media_request *const mreq, -+ const struct v4l2_format *const fmt, -+ const bool is_dst, const bool hold_flag) -+{ -+ struct v4l2_buffer buffer = { -+ .type = fmt->type, -+ .memory = V4L2_MEMORY_DMABUF, -+ .index = be->index -+ }; -+ struct v4l2_plane planes[VIDEO_MAX_PLANES] = {{0}}; -+ -+ if (V4L2_TYPE_IS_MULTIPLANAR(fmt->type)) { -+ unsigned int i; -+ for (i = 0; i < VIDEO_MAX_PLANES && be->dh[i]; ++i) { -+ if (is_dst) -+ dmabuf_len_set(be->dh[i], 0); -+ -+ /* *** Really need a pixdesc rather than a format so we can fill in data_offset */ -+ planes[i].length = dmabuf_size(be->dh[i]); -+ planes[i].bytesused = dmabuf_len(be->dh[i]); -+ planes[i].m.fd = dmabuf_fd(be->dh[i]); -+ } -+ buffer.m.planes = planes; -+ buffer.length = i; -+ } -+ else { -+ if (is_dst) -+ dmabuf_len_set(be->dh[0], 0); -+ -+ buffer.bytesused = dmabuf_len(be->dh[0]); -+ buffer.length = dmabuf_size(be->dh[0]); -+ buffer.m.fd = dmabuf_fd(be->dh[0]); -+ } -+ -+ if (!is_dst && mreq) { -+ buffer.flags |= V4L2_BUF_FLAG_REQUEST_FD; -+ buffer.request_fd = media_request_fd(mreq); -+ if (hold_flag) -+ buffer.flags |= V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF; -+ } -+ -+ if (is_dst) -+ be->timestamp = (struct timeval){0,0}; -+ -+ buffer.timestamp = be->timestamp; -+ -+ while (ioctl(vfd, VIDIOC_QBUF, &buffer)) { -+ const int err = errno; -+ if (err != EINTR) { -+ request_log("%s: Failed to Q buffer: err=%d (%s)\n", __func__, err, strerror(err)); -+ return -err; -+ } -+ } -+ return 0; -+} -+ -+static struct qent_base * qe_dequeue(struct buf_pool *const bp, -+ const int vfd, -+ const struct v4l2_format * const f) -+{ -+ int fd; -+ struct qent_base *be; -+ int rc; -+ const bool mp = V4L2_TYPE_IS_MULTIPLANAR(f->type); -+ struct v4l2_plane planes[VIDEO_MAX_PLANES] = {{0}}; -+ struct v4l2_buffer buffer = { -+ .type = f->type, -+ .memory = V4L2_MEMORY_DMABUF -+ }; -+ if (mp) { -+ buffer.length = f->fmt.pix_mp.num_planes; -+ buffer.m.planes = planes; -+ } -+ -+ while ((rc = ioctl(vfd, VIDIOC_DQBUF, &buffer)) != 0 && -+ errno == EINTR) -+ /* Loop */; -+ if (rc) { -+ request_log("Error DQing buffer type %d: %s\n", f->type, strerror(errno)); -+ return NULL; -+ } -+ -+ fd = mp ? planes[0].m.fd : buffer.m.fd; -+ be = queue_find_extract_fd(bp, fd); -+ if (!be) { -+ request_log("Failed to find fd %d in Q\n", fd); -+ return NULL; -+ } -+ -+ be->timestamp = buffer.timestamp; -+ be->status = (buffer.flags & V4L2_BUF_FLAG_ERROR) ? QENT_ERROR : QENT_DONE; -+ return be; -+} -+ -+static void qe_dst_done(struct qent_dst * dst_be) -+{ -+ pthread_mutex_lock(&dst_be->lock); -+ dst_be->waiting = false; -+ pthread_cond_broadcast(&dst_be->cond); -+ pthread_mutex_unlock(&dst_be->lock); -+ -+ qent_dst_unref(&dst_be); -+} -+ -+static bool qe_dst_waiting(struct qent_dst *const dst_be) -+{ -+ bool waiting; -+ pthread_mutex_lock(&dst_be->lock); -+ waiting = dst_be->waiting; -+ dst_be->waiting = true; -+ pthread_mutex_unlock(&dst_be->lock); -+ return waiting; -+} -+ -+ -+static bool mediabufs_wants_poll(const struct mediabufs_ctl *const mbc) -+{ -+ return queue_is_inuse(mbc->src) || queue_is_inuse(mbc->dst); -+} -+ -+static void mediabufs_poll_cb(void * v, short revents) -+{ -+ struct mediabufs_ctl *mbc = v; -+ struct qent_src *src_be = NULL; -+ struct qent_dst *dst_be = NULL; -+ -+ if (!revents) -+ request_err(mbc->dc, "%s: Timeout\n", __func__); -+ -+ pthread_mutex_lock(&mbc->lock); -+ mbc->polling = false; -+ -+ if ((revents & POLLOUT) != 0) -+ src_be = base_to_src(qe_dequeue(mbc->src, mbc->vfd, &mbc->src_fmt)); -+ if ((revents & POLLIN) != 0) -+ dst_be = base_to_dst(qe_dequeue(mbc->dst, mbc->vfd, &mbc->dst_fmt)); -+ -+ /* Reschedule */ -+ if (mediabufs_wants_poll(mbc)) { -+ mbc->polling = true; -+ pollqueue_add_task(mbc->pt, 2000); -+ } -+ pthread_mutex_unlock(&mbc->lock); -+ -+ if (src_be) -+ queue_put_free(mbc->src, &src_be->base); -+ if (dst_be) -+ qe_dst_done(dst_be); -+} -+ -+int qent_src_params_set(struct qent_src *const be_src, const struct timeval * timestamp) -+{ -+ struct qent_base *const be = &be_src->base; -+ -+ be->timestamp = *timestamp; -+ return 0; -+} -+ -+struct timeval qent_dst_timestamp_get(const struct qent_dst *const be_dst) -+{ -+ return be_dst->base.timestamp; -+} -+ -+static int qent_base_realloc(struct qent_base *const be, const size_t len, struct dmabufs_ctl * dbsc) -+{ -+ if (!be->dh[0] || len > dmabuf_size(be->dh[0])) { -+ size_t newsize = round_up_size(len); -+ request_log("%s: Overrun %d > %d; trying %d\n", __func__, len, dmabuf_size(be->dh[0]), newsize); -+ if (!dbsc) { -+ request_log("%s: No dmbabuf_ctrl for realloc\n", __func__); -+ return -ENOMEM; -+ } -+ if ((be->dh[0] = dmabuf_realloc(dbsc, be->dh[0], newsize)) == NULL) { -+ request_log("%s: Realloc %d failed\n", __func__, newsize); -+ return -ENOMEM; -+ } -+ } -+ return 0; -+} -+ -+int qent_src_alloc(struct qent_src *const be_src, const size_t len, struct dmabufs_ctl * dbsc) -+{ -+ struct qent_base *const be = &be_src->base; -+ return qent_base_realloc(be, len, dbsc); -+} -+ -+ -+int qent_src_data_copy(struct qent_src *const be_src, const size_t offset, const void *const src, const size_t len, struct dmabufs_ctl * dbsc) -+{ -+ void * dst; -+ struct qent_base *const be = &be_src->base; -+ int rv; -+ -+ // Realloc doesn't copy so don't alloc if offset != 0 -+ if ((rv = qent_base_realloc(be, offset + len, -+ be_src->fixed_size || offset ? NULL : dbsc)) != 0) -+ return rv; -+ -+ dmabuf_write_start(be->dh[0]); -+ dst = dmabuf_map(be->dh[0]); -+ if (!dst) -+ return -1; -+ memcpy((char*)dst + offset, src, len); -+ dmabuf_len_set(be->dh[0], len); -+ dmabuf_write_end(be->dh[0]); -+ return 0; -+} -+ -+const struct dmabuf_h * qent_dst_dmabuf(const struct qent_dst *const be_dst, unsigned int plane) -+{ -+ const struct qent_base *const be = &be_dst->base; -+ -+ return (plane >= sizeof(be->dh)/sizeof(be->dh[0])) ? NULL : be->dh[plane]; -+} -+ -+int qent_dst_dup_fd(const struct qent_dst *const be_dst, unsigned int plane) -+{ -+ return dup(dmabuf_fd(qent_dst_dmabuf(be_dst, plane))); -+} -+ -+MediaBufsStatus mediabufs_start_request(struct mediabufs_ctl *const mbc, -+ struct media_request **const pmreq, -+ struct qent_src **const psrc_be, -+ struct qent_dst *const dst_be, -+ const bool is_final) -+{ -+ struct media_request * mreq = *pmreq; -+ struct qent_src *const src_be = *psrc_be; -+ -+ // Req & src are always both "consumed" -+ *pmreq = NULL; -+ *psrc_be = NULL; -+ -+ pthread_mutex_lock(&mbc->lock); -+ -+ if (!src_be) -+ goto fail1; -+ -+ if (dst_be) { -+ if (qe_dst_waiting(dst_be)) { -+ request_info(mbc->dc, "Request buffer already waiting on start\n"); -+ goto fail1; -+ } -+ dst_be->base.timestamp = (struct timeval){0,0}; -+ if (qe_v4l2_queue(&dst_be->base, mbc->vfd, NULL, &mbc->dst_fmt, true, false)) -+ goto fail1; -+ -+ qent_dst_ref(dst_be); -+ queue_put_inuse(mbc->dst, &dst_be->base); -+ } -+ -+ if (qe_v4l2_queue(&src_be->base, mbc->vfd, mreq, &mbc->src_fmt, false, !is_final)) -+ goto fail1; -+ queue_put_inuse(mbc->src, &src_be->base); -+ -+ if (!mbc->polling && mediabufs_wants_poll(mbc)) { -+ mbc->polling = true; -+ pollqueue_add_task(mbc->pt, 2000); -+ } -+ pthread_mutex_unlock(&mbc->lock); -+ -+ if (media_request_start(mreq)) -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+ -+ return MEDIABUFS_STATUS_SUCCESS; -+ -+fail1: -+ media_request_abort(&mreq); -+ if (src_be) -+ queue_put_free(mbc->src, &src_be->base); -+ -+// *** TODO: If src Q fails this doesnt unwind properly - separate dst Q from src Q -+ if (dst_be) { -+ dst_be->base.status = QENT_ERROR; -+ qe_dst_done(dst_be); -+ } -+ pthread_mutex_unlock(&mbc->lock); -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+} -+ -+ -+static int qe_alloc_from_fmt(struct qent_base *const be, -+ struct dmabufs_ctl *const dbsc, -+ const struct v4l2_format *const fmt) -+{ -+ if (V4L2_TYPE_IS_MULTIPLANAR(fmt->type)) { -+ unsigned int i; -+ for (i = 0; i != fmt->fmt.pix_mp.num_planes; ++i) { -+ be->dh[i] = dmabuf_realloc(dbsc, be->dh[i], -+ fmt->fmt.pix_mp.plane_fmt[i].sizeimage); -+ /* On failure tidy up and die */ -+ if (!be->dh[i]) { -+ while (i--) { -+ dmabuf_free(be->dh[i]); -+ be->dh[i] = NULL; -+ } -+ return -1; -+ } -+ } -+ } -+ else { -+// be->dh[0] = dmabuf_alloc(dbsc, fmt->fmt.pix.sizeimage); -+ size_t size = fmt->fmt.pix.sizeimage; -+ be->dh[0] = dmabuf_realloc(dbsc, be->dh[0], size); -+ if (!be->dh[0]) -+ return -1; -+ } -+ return 0; -+} -+ -+static MediaBufsStatus fmt_set(struct v4l2_format *const fmt, const int fd, -+ const enum v4l2_buf_type buftype, -+ uint32_t pixfmt, -+ const unsigned int width, const unsigned int height, -+ const size_t bufsize) -+{ -+ *fmt = (struct v4l2_format){.type = buftype}; -+ -+ if (V4L2_TYPE_IS_MULTIPLANAR(buftype)) { -+ fmt->fmt.pix_mp.width = width; -+ fmt->fmt.pix_mp.height = height; -+ fmt->fmt.pix_mp.pixelformat = pixfmt; -+ if (bufsize) { -+ fmt->fmt.pix_mp.num_planes = 1; -+ fmt->fmt.pix_mp.plane_fmt[0].sizeimage = bufsize; -+ } -+ } -+ else { -+ fmt->fmt.pix.width = width; -+ fmt->fmt.pix.height = height; -+ fmt->fmt.pix.pixelformat = pixfmt; -+ fmt->fmt.pix.sizeimage = bufsize; -+ } -+ -+ while (ioctl(fd, VIDIOC_S_FMT, fmt)) -+ if (errno != EINTR) -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+ -+ // Treat anything where we don't get at least what we asked for as a fail -+ if (V4L2_TYPE_IS_MULTIPLANAR(buftype)) { -+ if (fmt->fmt.pix_mp.width < width || -+ fmt->fmt.pix_mp.height < height || -+ fmt->fmt.pix_mp.pixelformat != pixfmt) { -+ return MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE; -+ } -+ } -+ else { -+ if (fmt->fmt.pix.width < width || -+ fmt->fmt.pix.height < height || -+ fmt->fmt.pix.pixelformat != pixfmt) { -+ return MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE; -+ } -+ } -+ -+ return MEDIABUFS_STATUS_SUCCESS; -+} -+ -+static MediaBufsStatus find_fmt_flags(struct v4l2_format *const fmt, -+ const int fd, -+ const unsigned int type_v4l2, -+ const uint32_t flags_must, -+ const uint32_t flags_not, -+ const unsigned int width, -+ const unsigned int height, -+ mediabufs_dst_fmt_accept_fn *const accept_fn, -+ void *const accept_v) -+{ -+ unsigned int i; -+ -+ for (i = 0;; ++i) { -+ struct v4l2_fmtdesc fmtdesc = { -+ .index = i, -+ .type = type_v4l2 -+ }; -+ while (ioctl(fd, VIDIOC_ENUM_FMT, &fmtdesc)) { -+ if (errno != EINTR) -+ return MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE; -+ } -+ if ((fmtdesc.flags & flags_must) != flags_must || -+ (fmtdesc.flags & flags_not)) -+ continue; -+ if (!accept_fn(accept_v, &fmtdesc)) -+ continue; -+ -+ if (fmt_set(fmt, fd, fmtdesc.type, fmtdesc.pixelformat, -+ width, height, 0) == MEDIABUFS_STATUS_SUCCESS) -+ return MEDIABUFS_STATUS_SUCCESS; -+ } -+ return 0; -+} -+ -+ -+/* Wait for qent done */ -+ -+MediaBufsStatus qent_dst_wait(struct qent_dst *const be_dst) -+{ -+ struct qent_base *const be = &be_dst->base; -+ enum qent_status estat; -+ -+ pthread_mutex_lock(&be_dst->lock); -+ while (be_dst->waiting && -+ !pthread_cond_wait(&be_dst->cond, &be_dst->lock)) -+ /* Loop */; -+ estat = be->status; -+ pthread_mutex_unlock(&be_dst->lock); -+ -+ return estat == QENT_DONE ? MEDIABUFS_STATUS_SUCCESS : -+ estat == QENT_ERROR ? MEDIABUFS_ERROR_DECODING_ERROR : -+ MEDIABUFS_ERROR_OPERATION_FAILED; -+} -+ -+const uint8_t * qent_dst_data(struct qent_dst *const be_dst, unsigned int buf_no) -+{ -+ struct qent_base *const be = &be_dst->base; -+ return dmabuf_map(be->dh[buf_no]); -+} -+ -+MediaBufsStatus qent_dst_read_start(struct qent_dst *const be_dst) -+{ -+ struct qent_base *const be = &be_dst->base; -+ unsigned int i; -+ for (i = 0; i != VIDEO_MAX_PLANES && be->dh[i]; ++i) { -+ if (dmabuf_read_start(be->dh[i])) { -+ while (i--) -+ dmabuf_read_end(be->dh[i]); -+ return MEDIABUFS_ERROR_ALLOCATION_FAILED; -+ } -+ } -+ return MEDIABUFS_STATUS_SUCCESS; -+} -+ -+MediaBufsStatus qent_dst_read_stop(struct qent_dst *const be_dst) -+{ -+ struct qent_base *const be = &be_dst->base; -+ unsigned int i; -+ MediaBufsStatus status = MEDIABUFS_STATUS_SUCCESS; -+ -+ for (i = 0; i != VIDEO_MAX_PLANES && be->dh[i]; ++i) { -+ if (dmabuf_read_end(be->dh[i])) -+ status = MEDIABUFS_ERROR_OPERATION_FAILED; -+ } -+ return status; -+} -+ -+struct qent_dst * qent_dst_ref(struct qent_dst * const be_dst) -+{ -+ if (be_dst) -+ atomic_fetch_add(&be_dst->base.ref_count, 1); -+ return be_dst; -+} -+ -+void qent_dst_unref(struct qent_dst ** const pbe_dst) -+{ -+ struct qent_dst * const be_dst = *pbe_dst; -+ struct mediabufs_ctl * mbc; -+ if (!be_dst) -+ return; -+ *pbe_dst = NULL; -+ -+ if (atomic_fetch_sub(&be_dst->base.ref_count, 1) != 0) -+ return; -+ -+ if ((mbc = ff_weak_link_lock(&be_dst->mbc_wl)) != NULL) { -+ queue_put_free(mbc->dst, &be_dst->base); -+ ff_weak_link_unlock(be_dst->mbc_wl); -+ } -+ else { -+ qe_dst_free(be_dst); -+ } -+} -+ -+MediaBufsStatus qent_dst_import_fd(struct qent_dst *const be_dst, -+ unsigned int plane, -+ int fd, size_t size) -+{ -+ struct qent_base *const be = &be_dst->base; -+ struct dmabuf_h * dh; -+ -+ if (be->status != QENT_IMPORT || be->dh[plane]) -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+ -+ dh = dmabuf_import(fd, size); -+ if (!dh) -+ return MEDIABUFS_ERROR_ALLOCATION_FAILED; -+ -+ be->dh[plane] = dh; -+ return MEDIABUFS_STATUS_SUCCESS; -+} -+ -+static int create_dst_buf(struct mediabufs_ctl *const mbc) -+{ -+ struct v4l2_create_buffers cbuf = { -+ .count = 1, -+ .memory = V4L2_MEMORY_DMABUF, -+ .format = mbc->dst_fmt, -+ }; -+ -+ while (ioctl(mbc->vfd, VIDIOC_CREATE_BUFS, &cbuf)) { -+ const int err = -errno; -+ if (err != EINTR) { -+ request_err(mbc->dc, "%s: Failed to create V4L2 buffer\n", __func__); -+ return -err; -+ } -+ } -+ return cbuf.index; -+} -+ -+struct qent_dst* mediabufs_dst_qent_alloc(struct mediabufs_ctl *const mbc, struct dmabufs_ctl *const dbsc) -+{ -+ struct qent_dst * be_dst; -+ -+ if (mbc == NULL) { -+ be_dst = qe_dst_new(); -+ if (be_dst) -+ be_dst->base.status = QENT_IMPORT; -+ return be_dst; -+ } -+ -+ be_dst = base_to_dst(queue_tryget_free(mbc->dst)); -+ if (!be_dst) { -+ int index; -+ -+ be_dst = qe_dst_new(); -+ if (!be_dst) -+ return NULL; -+ -+ if ((be_dst->mbc_wl = ff_weak_link_ref(mbc->this_wlm)) == NULL || -+ (index = create_dst_buf(mbc)) < 0) { -+ qe_dst_free(be_dst); -+ return NULL; -+ } -+ -+ be_dst->base.index = (uint32_t)index; -+ } -+ -+ if (qe_alloc_from_fmt(&be_dst->base, dbsc, &mbc->dst_fmt)) { -+ /* Given how create buf works we can't uncreate it on alloc failure -+ * all we can do is put it on the free Q -+ */ -+ queue_put_free(mbc->dst, &be_dst->base); -+ return NULL; -+ } -+ -+ be_dst->base.status = QENT_PENDING; -+ atomic_store(&be_dst->base.ref_count, 0); -+ return be_dst; -+} -+ -+const struct v4l2_format *mediabufs_dst_fmt(struct mediabufs_ctl *const mbc) -+{ -+ return &mbc->dst_fmt; -+} -+ -+MediaBufsStatus mediabufs_dst_fmt_set(struct mediabufs_ctl *const mbc, -+ const unsigned int width, -+ const unsigned int height, -+ mediabufs_dst_fmt_accept_fn *const accept_fn, -+ void *const accept_v) -+{ -+ MediaBufsStatus status; -+ unsigned int i; -+ const enum v4l2_buf_type buf_type = mbc->dst_fmt.type; -+ static const struct { -+ unsigned int flags_must; -+ unsigned int flags_not; -+ } trys[] = { -+ {0, V4L2_FMT_FLAG_EMULATED}, -+ {V4L2_FMT_FLAG_EMULATED, 0}, -+ }; -+ for (i = 0; i != sizeof(trys)/sizeof(trys[0]); ++i) { -+ status = find_fmt_flags(&mbc->dst_fmt, mbc->vfd, -+ buf_type, -+ trys[i].flags_must, -+ trys[i].flags_not, -+ width, height, accept_fn, accept_v); -+ if (status != MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE) -+ return status; -+ } -+ -+ if (status != MEDIABUFS_STATUS_SUCCESS) -+ return status; -+ -+ /* Try to create a buffer - don't alloc */ -+ return status; -+} -+ -+MediaBufsStatus mediabufs_dst_slots_create(struct mediabufs_ctl *const mbc, unsigned int n) -+{ -+ // **** request buffers -+ unsigned int i; -+ -+ for (i = 0; i != n; ++i) -+ { -+ int index; -+ struct qent_dst * const be_dst = qe_dst_new(); -+ if (!be_dst) -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+ -+ index = create_dst_buf(mbc); -+ if (index < 0) { -+ qe_dst_free(be_dst); -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+ } -+ -+ // Add index to free chain -+ be_dst->base.index = (uint32_t)index; -+ queue_put_free(mbc->dst, &be_dst->base); -+ } -+ return MEDIABUFS_STATUS_SUCCESS; -+} -+ -+struct qent_src *mediabufs_src_qent_get(struct mediabufs_ctl *const mbc) -+{ -+ struct qent_base * buf = queue_get_free(mbc->src); -+ buf->status = QENT_PENDING; -+ return base_to_src(buf); -+} -+ -+void mediabufs_src_qent_abort(struct mediabufs_ctl *const mbc, struct qent_src **const pqe_src) -+{ -+ struct qent_src *const qe_src = *pqe_src; -+ if (!qe_src) -+ return; -+ *pqe_src = NULL; -+ queue_put_free(mbc->src, &qe_src->base); -+} -+ -+/* src format must have been set up before this */ -+MediaBufsStatus mediabufs_src_pool_create(struct mediabufs_ctl *const mbc, -+ struct dmabufs_ctl * const dbsc, -+ unsigned int n) -+{ -+ unsigned int i; -+ struct v4l2_requestbuffers req = { -+ .count = n, -+ .type = mbc->src_fmt.type, -+ .memory = V4L2_MEMORY_DMABUF -+ }; -+ -+ bq_free_all_free_src(mbc->src); -+ while (ioctl(mbc->vfd, VIDIOC_REQBUFS, &req) == -1) { -+ if (errno != EINTR) { -+ request_err(mbc->dc, "%s: Failed to request src bufs\n", __func__); -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+ } -+ } -+ -+ if (n > req.count) { -+ request_info(mbc->dc, "Only allocated %d of %d src buffers requested\n", req.count, n); -+ n = req.count; -+ } -+ -+ for (i = 0; i != n; ++i) { -+ struct qent_src *const be_src = qe_src_new(); -+ if (!be_src) { -+ request_err(mbc->dc, "Failed to create src be %d\n", i); -+ goto fail; -+ } -+ if (qe_alloc_from_fmt(&be_src->base, dbsc, &mbc->src_fmt)) { -+ qe_src_free(be_src); -+ goto fail; -+ } -+ be_src->base.index = i; -+ be_src->fixed_size = !mediabufs_src_resizable(mbc); -+ -+ queue_put_free(mbc->src, &be_src->base); -+ } -+ -+ return MEDIABUFS_STATUS_SUCCESS; -+ -+fail: -+ bq_free_all_free_src(mbc->src); -+ req.count = 0; -+ while (ioctl(mbc->vfd, VIDIOC_REQBUFS, &req) == -1 && -+ errno == EINTR) -+ /* Loop */; -+ -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+} -+ -+ -+ -+/* -+ * Set stuff order: -+ * Set src fmt -+ * Set parameters (sps) on vfd -+ * Negotiate dst format (dst_fmt_set) -+ * Create src buffers -+ * Alloc a dst buffer or Create dst slots -+*/ -+MediaBufsStatus mediabufs_stream_on(struct mediabufs_ctl *const mbc) -+{ -+ if (mbc->stream_on) -+ return MEDIABUFS_STATUS_SUCCESS; -+ -+ if (set_stream(mbc->vfd, mbc->src_fmt.type, true) < 0) { -+ request_log("Failed to set stream on src type %d\n", mbc->src_fmt.type); -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+ } -+ -+ if (set_stream(mbc->vfd, mbc->dst_fmt.type, true) < 0) { -+ request_log("Failed to set stream on dst type %d\n", mbc->dst_fmt.type); -+ set_stream(mbc->vfd, mbc->src_fmt.type, false); -+ return MEDIABUFS_ERROR_OPERATION_FAILED; -+ } -+ -+ mbc->stream_on = true; -+ return MEDIABUFS_STATUS_SUCCESS; -+} -+ -+MediaBufsStatus mediabufs_stream_off(struct mediabufs_ctl *const mbc) -+{ -+ MediaBufsStatus status = MEDIABUFS_STATUS_SUCCESS; -+ -+ if (!mbc->stream_on) -+ return MEDIABUFS_STATUS_SUCCESS; -+ -+ if (set_stream(mbc->vfd, mbc->dst_fmt.type, false) < 0) { -+ request_log("Failed to set stream off dst type %d\n", mbc->dst_fmt.type); -+ status = MEDIABUFS_ERROR_OPERATION_FAILED; -+ } -+ -+ if (set_stream(mbc->vfd, mbc->src_fmt.type, false) < 0) { -+ request_log("Failed to set stream off src type %d\n", mbc->src_fmt.type); -+ status = MEDIABUFS_ERROR_OPERATION_FAILED; -+ } -+ -+ mbc->stream_on = false; -+ return status; -+} -+ -+int mediabufs_ctl_set_ext_ctrls(struct mediabufs_ctl * mbc, struct media_request * const mreq, struct v4l2_ext_control control_array[], unsigned int n) -+{ -+ struct v4l2_ext_controls controls = { -+ .controls = control_array, -+ .count = n -+ }; -+ -+ if (mreq) { -+ controls.which = V4L2_CTRL_WHICH_REQUEST_VAL; -+ controls.request_fd = media_request_fd(mreq); -+ } -+ -+ while (ioctl(mbc->vfd, VIDIOC_S_EXT_CTRLS, &controls)) -+ { -+ const int err = errno; -+ if (err != EINTR) { -+ request_err(mbc->dc, "Unable to set controls: %s\n", strerror(err)); -+ return -err; -+ } -+ } -+ -+ return 0; -+} -+ -+MediaBufsStatus mediabufs_set_ext_ctrl(struct mediabufs_ctl *const mbc, -+ struct media_request * const mreq, -+ unsigned int id, void *data, -+ unsigned int size) -+{ -+ struct v4l2_ext_control control = { -+ .id = id, -+ .ptr = data, -+ .size = size -+ }; -+ -+ int rv = mediabufs_ctl_set_ext_ctrls(mbc, mreq, &control, 1); -+ return !rv ? MEDIABUFS_STATUS_SUCCESS : MEDIABUFS_ERROR_OPERATION_FAILED; -+} -+ -+MediaBufsStatus mediabufs_src_fmt_set(struct mediabufs_ctl *const mbc, -+ enum v4l2_buf_type buf_type, -+ const uint32_t pixfmt, -+ const uint32_t width, const uint32_t height, -+ const size_t bufsize) -+{ -+ MediaBufsStatus rv = fmt_set(&mbc->src_fmt, mbc->vfd, buf_type, pixfmt, width, height, bufsize); -+ if (rv != MEDIABUFS_STATUS_SUCCESS) -+ request_err(mbc->dc, "Failed to set src buftype %d, format %#x %dx%d\n", buf_type, pixfmt, width, height); -+ -+ return rv; -+} -+ -+int mediabufs_ctl_query_ext_ctrls(struct mediabufs_ctl * mbc, struct v4l2_query_ext_ctrl ctrls[], unsigned int n) -+{ -+ int rv = 0; -+ while (n--) { -+ while (ioctl(mbc->vfd, VIDIOC_QUERY_EXT_CTRL, ctrls)) { -+ const int err = errno; -+ if (err != EINTR) { -+ // Often used for probing - errors are to be expected -+ request_debug(mbc->dc, "Failed to query ext id=%#x, err=%d\n", ctrls->id, err); -+ ctrls->type = 0; // 0 is invalid -+ rv = -err; -+ break; -+ } -+ } -+ ++ctrls; -+ } -+ return rv; -+} -+ -+int mediabufs_src_resizable(const struct mediabufs_ctl *const mbc) -+{ -+ // Single planar OUTPUT can only take exact size buffers -+ // Multiplanar will take larger than negotiated -+ return V4L2_TYPE_IS_MULTIPLANAR(mbc->src_fmt.type); -+} -+ -+static void mediabufs_ctl_delete(struct mediabufs_ctl *const mbc) -+{ -+ if (!mbc) -+ return; -+ -+ // Break the weak link first -+ ff_weak_link_break(&mbc->this_wlm); -+ -+ polltask_delete(&mbc->pt); -+ -+ mediabufs_stream_off(mbc); -+ -+ // Empty v4l2 buffer stash -+ request_buffers(mbc->vfd, mbc->src_fmt.type, V4L2_MEMORY_MMAP, 0); -+ request_buffers(mbc->vfd, mbc->dst_fmt.type, V4L2_MEMORY_MMAP, 0); -+ -+ bq_free_all_free_src(mbc->src); -+ bq_free_all_inuse_src(mbc->src); -+ bq_free_all_free_dst(mbc->dst); -+ -+ { -+ struct qent_dst *dst_be; -+ while ((dst_be = base_to_dst(bq_get_inuse(mbc->dst))) != NULL) { -+ dst_be->base.timestamp = (struct timeval){0}; -+ dst_be->base.status = QENT_ERROR; -+ qe_dst_done(dst_be); -+ } -+ } -+ -+ queue_delete(mbc->dst); -+ queue_delete(mbc->src); -+ close(mbc->vfd); -+ pthread_mutex_destroy(&mbc->lock); -+ -+ free(mbc); -+} -+ -+struct mediabufs_ctl * mediabufs_ctl_ref(struct mediabufs_ctl *const mbc) -+{ -+ atomic_fetch_add(&mbc->ref_count, 1); -+ return mbc; -+} -+ -+void mediabufs_ctl_unref(struct mediabufs_ctl **const pmbc) -+{ -+ struct mediabufs_ctl *const mbc = *pmbc; -+ int n; -+ -+ if (!mbc) -+ return; -+ *pmbc = NULL; -+ n = atomic_fetch_sub(&mbc->ref_count, 1); -+ if (n) -+ return; -+ mediabufs_ctl_delete(mbc); -+} -+ -+static int set_capabilities(struct mediabufs_ctl *const mbc) -+{ -+ struct v4l2_capability capability = { 0 }; -+ uint32_t caps; -+ -+ if (ioctl(mbc->vfd, VIDIOC_QUERYCAP, &capability)) { -+ int err = errno; -+ request_err(mbc->dc, "Failed to get capabilities: %s\n", strerror(err)); -+ return -err; -+ } -+ -+ caps = (capability.capabilities & V4L2_CAP_DEVICE_CAPS) != 0 ? -+ capability.device_caps : -+ capability.capabilities; -+ -+ if ((caps & V4L2_CAP_VIDEO_M2M_MPLANE) != 0) { -+ mbc->src_fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; -+ mbc->dst_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; -+ } -+ else if ((caps & V4L2_CAP_VIDEO_M2M) != 0) { -+ mbc->src_fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; -+ mbc->dst_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; -+ } -+ else { -+ request_err(mbc->dc, "No M2M capabilities (%#x)\n", caps); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/* One of these per context */ -+struct mediabufs_ctl * mediabufs_ctl_new(void * const dc, const char * vpath, struct pollqueue *const pq) -+{ -+ struct mediabufs_ctl *const mbc = calloc(1, sizeof(*mbc)); -+ -+ if (!mbc) -+ return NULL; -+ -+ mbc->dc = dc; -+ // Default mono planar -+ mbc->pq = pq; -+ pthread_mutex_init(&mbc->lock, NULL); -+ -+ /* Pick a default - could we scan for this? */ -+ if (vpath == NULL) -+ vpath = "/dev/media0"; -+ -+ while ((mbc->vfd = open(vpath, O_RDWR)) == -1) -+ { -+ const int err = errno; -+ if (err != EINTR) { -+ request_err(dc, "Failed to open video dev '%s': %s\n", vpath, strerror(err)); -+ goto fail0; -+ } -+ } -+ -+ if (set_capabilities(mbc)) { -+ request_err(dc, "Bad capabilities for video dev '%s'\n", vpath); -+ goto fail1; -+ } -+ -+ mbc->src = queue_new(mbc->vfd); -+ if (!mbc->src) -+ goto fail1; -+ mbc->dst = queue_new(mbc->vfd); -+ if (!mbc->dst) -+ goto fail2; -+ mbc->pt = polltask_new(pq, mbc->vfd, POLLIN | POLLOUT, mediabufs_poll_cb, mbc); -+ if (!mbc->pt) -+ goto fail3; -+ mbc->this_wlm = ff_weak_link_new(mbc); -+ if (!mbc->this_wlm) -+ goto fail4; -+ -+ /* Cannot add polltask now - polling with nothing pending -+ * generates infinite error polls -+ */ -+ return mbc; -+ -+fail4: -+ polltask_delete(&mbc->pt); -+fail3: -+ queue_delete(mbc->dst); -+fail2: -+ queue_delete(mbc->src); -+fail1: -+ close(mbc->vfd); -+fail0: -+ free(mbc); -+ request_info(dc, "%s: FAILED\n", __func__); -+ return NULL; -+} -+ -+ -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_media.h -@@ -0,0 +1,148 @@ -+/* -+e.h -+* -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sub license, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the -+ * next paragraph) shall be included in all copies or substantial portions -+ * of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+#ifndef _MEDIA_H_ -+#define _MEDIA_H_ -+ -+#include -+#include -+ -+struct v4l2_format; -+struct v4l2_fmtdesc; -+struct v4l2_query_ext_ctrl; -+ -+struct pollqueue; -+struct media_request; -+struct media_pool; -+ -+typedef enum media_buf_status { -+ MEDIABUFS_STATUS_SUCCESS = 0, -+ MEDIABUFS_ERROR_OPERATION_FAILED, -+ MEDIABUFS_ERROR_DECODING_ERROR, -+ MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE, -+ MEDIABUFS_ERROR_UNSUPPORTED_RT_FORMAT, -+ MEDIABUFS_ERROR_ALLOCATION_FAILED, -+} MediaBufsStatus; -+ -+struct media_pool * media_pool_new(const char * const media_path, -+ struct pollqueue * const pq, -+ const unsigned int n); -+void media_pool_delete(struct media_pool ** pmp); -+ -+// Obtain a media request -+// Will block if none availible - has a 2sec timeout -+struct media_request * media_request_get(struct media_pool * const mp); -+int media_request_fd(const struct media_request * const req); -+ -+// Start this request -+// Request structure is returned to pool once done -+int media_request_start(struct media_request * const req); -+ -+// Return an *unstarted* media_request to the pool -+// May later be upgraded to allow for aborting a started req -+int media_request_abort(struct media_request ** const preq); -+ -+ -+struct mediabufs_ctl; -+struct qent_src; -+struct qent_dst; -+struct dmabuf_h; -+struct dmabufs_ctl; -+ -+int qent_src_params_set(struct qent_src *const be, const struct timeval * timestamp); -+struct timeval qent_dst_timestamp_get(const struct qent_dst *const be_dst); -+ -+// prealloc -+int qent_src_alloc(struct qent_src *const be_src, const size_t len, struct dmabufs_ctl * dbsc); -+// dbsc may be NULL if realloc not required -+int qent_src_data_copy(struct qent_src *const be_src, const size_t offset, const void *const src, const size_t len, struct dmabufs_ctl * dbsc); -+const struct dmabuf_h * qent_dst_dmabuf(const struct qent_dst *const be, unsigned int plane); -+int qent_dst_dup_fd(const struct qent_dst *const be, unsigned int plane); -+MediaBufsStatus qent_dst_wait(struct qent_dst *const be); -+void qent_dst_delete(struct qent_dst *const be); -+// Returns a qent_dst to its mbc free Q or deletes it if the mbc is dead -+void qent_dst_unref(struct qent_dst ** const pbe_dst); -+struct qent_dst * qent_dst_ref(struct qent_dst * const be_dst); -+ -+const uint8_t * qent_dst_data(struct qent_dst *const be, unsigned int buf_no); -+MediaBufsStatus qent_dst_read_start(struct qent_dst *const be); -+MediaBufsStatus qent_dst_read_stop(struct qent_dst *const be); -+/* Import an fd unattached to any mediabuf */ -+MediaBufsStatus qent_dst_import_fd(struct qent_dst *const be_dst, -+ unsigned int plane, -+ int fd, size_t size); -+ -+MediaBufsStatus mediabufs_start_request(struct mediabufs_ctl *const mbc, -+ struct media_request **const pmreq, -+ struct qent_src **const psrc_be, -+ struct qent_dst *const dst_be, -+ const bool is_final); -+// Get / alloc a dst buffer & associate with a slot -+// * BEWARE * Currently has no alloc limit -+struct qent_dst* mediabufs_dst_qent_alloc(struct mediabufs_ctl *const mbc, -+ struct dmabufs_ctl *const dbsc); -+// Create dst slots without alloc -+MediaBufsStatus mediabufs_dst_slots_create(struct mediabufs_ctl *const mbc, unsigned int n); -+ -+MediaBufsStatus mediabufs_stream_on(struct mediabufs_ctl *const mbc); -+MediaBufsStatus mediabufs_stream_off(struct mediabufs_ctl *const mbc); -+const struct v4l2_format *mediabufs_dst_fmt(struct mediabufs_ctl *const mbc); -+ -+typedef int mediabufs_dst_fmt_accept_fn(void * v, const struct v4l2_fmtdesc *fmtdesc); -+ -+MediaBufsStatus mediabufs_dst_fmt_set(struct mediabufs_ctl *const mbc, -+ const unsigned int width, -+ const unsigned int height, -+ mediabufs_dst_fmt_accept_fn *const accept_fn, -+ void *const accept_v); -+struct qent_src *mediabufs_src_qent_get(struct mediabufs_ctl *const mbc); -+void mediabufs_src_qent_abort(struct mediabufs_ctl *const mbc, struct qent_src **const pqe_src); -+ -+int mediabufs_ctl_set_ext_ctrls(struct mediabufs_ctl * mbc, struct media_request * const mreq, -+ struct v4l2_ext_control control_array[], unsigned int n); -+MediaBufsStatus mediabufs_set_ext_ctrl(struct mediabufs_ctl *const mbc, -+ struct media_request * const mreq, -+ unsigned int id, void *data, -+ unsigned int size); -+int mediabufs_ctl_query_ext_ctrls(struct mediabufs_ctl * mbc, struct v4l2_query_ext_ctrl ctrls[], unsigned int n); -+ -+int mediabufs_src_resizable(const struct mediabufs_ctl *const mbc); -+ -+MediaBufsStatus mediabufs_src_fmt_set(struct mediabufs_ctl *const mbc, -+ enum v4l2_buf_type buf_type, -+ const uint32_t pixfmt, -+ const uint32_t width, const uint32_t height, -+ const size_t bufsize); -+ -+MediaBufsStatus mediabufs_src_pool_create(struct mediabufs_ctl *const rw, -+ struct dmabufs_ctl * const dbsc, -+ unsigned int n); -+ -+struct mediabufs_ctl * mediabufs_ctl_new(void * const dc, -+ const char *vpath, struct pollqueue *const pq); -+void mediabufs_ctl_unref(struct mediabufs_ctl **const pmbc); -+struct mediabufs_ctl * mediabufs_ctl_ref(struct mediabufs_ctl *const mbc); -+ -+ -+#endif ---- /dev/null -+++ b/libavcodec/v4l2_req_pollqueue.c -@@ -0,0 +1,363 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "v4l2_req_pollqueue.h" -+#include "v4l2_req_utils.h" -+ -+ -+struct pollqueue; -+ -+enum polltask_state { -+ POLLTASK_UNQUEUED = 0, -+ POLLTASK_QUEUED, -+ POLLTASK_RUNNING, -+ POLLTASK_Q_KILL, -+ POLLTASK_RUN_KILL, -+}; -+ -+struct polltask { -+ struct polltask *next; -+ struct polltask *prev; -+ struct pollqueue *q; -+ enum polltask_state state; -+ -+ int fd; -+ short events; -+ -+ void (*fn)(void *v, short revents); -+ void * v; -+ -+ uint64_t timeout; /* CLOCK_MONOTONIC time, 0 => never */ -+ sem_t kill_sem; -+}; -+ -+struct pollqueue { -+ atomic_int ref_count; -+ pthread_mutex_t lock; -+ -+ struct polltask *head; -+ struct polltask *tail; -+ -+ bool kill; -+ bool no_prod; -+ int prod_fd; -+ struct polltask *prod_pt; -+ pthread_t worker; -+}; -+ -+struct polltask *polltask_new(struct pollqueue *const pq, -+ const int fd, const short events, -+ void (*const fn)(void *v, short revents), -+ void *const v) -+{ -+ struct polltask *pt; -+ -+ if (!events) -+ return NULL; -+ -+ pt = malloc(sizeof(*pt)); -+ if (!pt) -+ return NULL; -+ -+ *pt = (struct polltask){ -+ .next = NULL, -+ .prev = NULL, -+ .q = pollqueue_ref(pq), -+ .fd = fd, -+ .events = events, -+ .fn = fn, -+ .v = v -+ }; -+ -+ sem_init(&pt->kill_sem, 0, 0); -+ -+ return pt; -+} -+ -+static void pollqueue_rem_task(struct pollqueue *const pq, struct polltask *const pt) -+{ -+ if (pt->prev) -+ pt->prev->next = pt->next; -+ else -+ pq->head = pt->next; -+ if (pt->next) -+ pt->next->prev = pt->prev; -+ else -+ pq->tail = pt->prev; -+ pt->next = NULL; -+ pt->prev = NULL; -+} -+ -+static void polltask_free(struct polltask * const pt) -+{ -+ sem_destroy(&pt->kill_sem); -+ free(pt); -+} -+ -+static int pollqueue_prod(const struct pollqueue *const pq) -+{ -+ static const uint64_t one = 1; -+ return write(pq->prod_fd, &one, sizeof(one)); -+} -+ -+void polltask_delete(struct polltask **const ppt) -+{ -+ struct polltask *const pt = *ppt; -+ struct pollqueue * pq; -+ enum polltask_state state; -+ bool prodme; -+ -+ if (!pt) -+ return; -+ -+ pq = pt->q; -+ pthread_mutex_lock(&pq->lock); -+ state = pt->state; -+ pt->state = (state == POLLTASK_RUNNING) ? POLLTASK_RUN_KILL : POLLTASK_Q_KILL; -+ prodme = !pq->no_prod; -+ pthread_mutex_unlock(&pq->lock); -+ -+ if (state != POLLTASK_UNQUEUED) { -+ if (prodme) -+ pollqueue_prod(pq); -+ while (sem_wait(&pt->kill_sem) && errno == EINTR) -+ /* loop */; -+ } -+ -+ // Leave zapping the ref until we have DQed the PT as might well be -+ // legitimately used in it -+ *ppt = NULL; -+ polltask_free(pt); -+ pollqueue_unref(&pq); -+} -+ -+static uint64_t pollqueue_now(int timeout) -+{ -+ struct timespec now; -+ uint64_t now_ms; -+ -+ if (clock_gettime(CLOCK_MONOTONIC, &now)) -+ return 0; -+ now_ms = (now.tv_nsec / 1000000) + (uint64_t)now.tv_sec * 1000 + timeout; -+ return now_ms ? now_ms : (uint64_t)1; -+} -+ -+void pollqueue_add_task(struct polltask *const pt, const int timeout) -+{ -+ bool prodme = false; -+ struct pollqueue * const pq = pt->q; -+ -+ pthread_mutex_lock(&pq->lock); -+ if (pt->state != POLLTASK_Q_KILL && pt->state != POLLTASK_RUN_KILL) { -+ if (pq->tail) -+ pq->tail->next = pt; -+ else -+ pq->head = pt; -+ pt->prev = pq->tail; -+ pt->next = NULL; -+ pt->state = POLLTASK_QUEUED; -+ pt->timeout = timeout < 0 ? 0 : pollqueue_now(timeout); -+ pq->tail = pt; -+ prodme = !pq->no_prod; -+ } -+ pthread_mutex_unlock(&pq->lock); -+ if (prodme) -+ pollqueue_prod(pq); -+} -+ -+static void *poll_thread(void *v) -+{ -+ struct pollqueue *const pq = v; -+ struct pollfd *a = NULL; -+ size_t asize = 0; -+ -+ pthread_mutex_lock(&pq->lock); -+ do { -+ unsigned int i; -+ unsigned int n = 0; -+ struct polltask *pt; -+ uint64_t now = pollqueue_now(0); -+ int timeout = -1; -+ int rv; -+ -+ for (pt = pq->head; pt; pt = pt->next) { -+ int64_t t; -+ -+ if (pt->state == POLLTASK_Q_KILL) { -+ struct polltask * const prev = pt->prev; -+ pollqueue_rem_task(pq, pt); -+ sem_post(&pt->kill_sem); -+ if ((pt = prev) == NULL) -+ break; -+ continue; -+ } -+ -+ if (n >= asize) { -+ asize = asize ? asize * 2 : 4; -+ a = realloc(a, asize * sizeof(*a)); -+ if (!a) { -+ request_log("Failed to realloc poll array to %zd\n", asize); -+ goto fail_locked; -+ } -+ } -+ -+ a[n++] = (struct pollfd){ -+ .fd = pt->fd, -+ .events = pt->events -+ }; -+ -+ t = (int64_t)(pt->timeout - now); -+ if (pt->timeout && t < INT_MAX && -+ (timeout < 0 || (int)t < timeout)) -+ timeout = (t < 0) ? 0 : (int)t; -+ } -+ pthread_mutex_unlock(&pq->lock); -+ -+ if ((rv = poll(a, n, timeout)) == -1) { -+ if (errno != EINTR) { -+ request_log("Poll error: %s\n", strerror(errno)); -+ goto fail_unlocked; -+ } -+ } -+ -+ pthread_mutex_lock(&pq->lock); -+ now = pollqueue_now(0); -+ -+ /* Prodding in this loop is pointless and might lead to -+ * infinite looping -+ */ -+ pq->no_prod = true; -+ for (i = 0, pt = pq->head; i < n; ++i) { -+ struct polltask *const pt_next = pt->next; -+ -+ /* Pending? */ -+ if (a[i].revents || -+ (pt->timeout && (int64_t)(now - pt->timeout) >= 0)) { -+ pollqueue_rem_task(pq, pt); -+ if (pt->state == POLLTASK_QUEUED) -+ pt->state = POLLTASK_RUNNING; -+ if (pt->state == POLLTASK_Q_KILL) -+ pt->state = POLLTASK_RUN_KILL; -+ pthread_mutex_unlock(&pq->lock); -+ -+ /* This can add new entries to the Q but as -+ * those are added to the tail our existing -+ * chain remains intact -+ */ -+ pt->fn(pt->v, a[i].revents); -+ -+ pthread_mutex_lock(&pq->lock); -+ if (pt->state == POLLTASK_RUNNING) -+ pt->state = POLLTASK_UNQUEUED; -+ if (pt->state == POLLTASK_RUN_KILL) -+ sem_post(&pt->kill_sem); -+ } -+ -+ pt = pt_next; -+ } -+ pq->no_prod = false; -+ -+ } while (!pq->kill); -+ -+fail_locked: -+ pthread_mutex_unlock(&pq->lock); -+fail_unlocked: -+ free(a); -+ return NULL; -+} -+ -+static void prod_fn(void *v, short revents) -+{ -+ struct pollqueue *const pq = v; -+ char buf[8]; -+ if (revents) -+ read(pq->prod_fd, buf, 8); -+ if (!pq->kill) -+ pollqueue_add_task(pq->prod_pt, -1); -+} -+ -+struct pollqueue * pollqueue_new(void) -+{ -+ struct pollqueue *pq = malloc(sizeof(*pq)); -+ if (!pq) -+ return NULL; -+ *pq = (struct pollqueue){ -+ .ref_count = ATOMIC_VAR_INIT(0), -+ .lock = PTHREAD_MUTEX_INITIALIZER, -+ .head = NULL, -+ .tail = NULL, -+ .kill = false, -+ .prod_fd = -1 -+ }; -+ -+ pq->prod_fd = eventfd(0, EFD_NONBLOCK); -+ if (pq->prod_fd == 1) -+ goto fail1; -+ pq->prod_pt = polltask_new(pq, pq->prod_fd, POLLIN, prod_fn, pq); -+ if (!pq->prod_pt) -+ goto fail2; -+ pollqueue_add_task(pq->prod_pt, -1); -+ if (pthread_create(&pq->worker, NULL, poll_thread, pq)) -+ goto fail3; -+ // Reset ref count which will have been inced by the add_task -+ atomic_store(&pq->ref_count, 0); -+ return pq; -+ -+fail3: -+ polltask_free(pq->prod_pt); -+fail2: -+ close(pq->prod_fd); -+fail1: -+ free(pq); -+ return NULL; -+} -+ -+static void pollqueue_free(struct pollqueue *const pq) -+{ -+ void *rv; -+ -+ pthread_mutex_lock(&pq->lock); -+ pq->kill = true; -+ pollqueue_prod(pq); -+ pthread_mutex_unlock(&pq->lock); -+ -+ pthread_join(pq->worker, &rv); -+ polltask_free(pq->prod_pt); -+ pthread_mutex_destroy(&pq->lock); -+ close(pq->prod_fd); -+ free(pq); -+} -+ -+struct pollqueue * pollqueue_ref(struct pollqueue *const pq) -+{ -+ atomic_fetch_add(&pq->ref_count, 1); -+ return pq; -+} -+ -+void pollqueue_unref(struct pollqueue **const ppq) -+{ -+ struct pollqueue * const pq = *ppq; -+ -+ if (!pq) -+ return; -+ *ppq = NULL; -+ -+ if (atomic_fetch_sub(&pq->ref_count, 1) != 0) -+ return; -+ -+ pollqueue_free(pq); -+} -+ -+ -+ ---- /dev/null -+++ b/libavcodec/v4l2_req_pollqueue.h -@@ -0,0 +1,18 @@ -+#ifndef POLLQUEUE_H_ -+#define POLLQUEUE_H_ -+ -+struct polltask; -+struct pollqueue; -+ -+struct polltask *polltask_new(struct pollqueue *const pq, -+ const int fd, const short events, -+ void (*const fn)(void *v, short revents), -+ void *const v); -+void polltask_delete(struct polltask **const ppt); -+ -+void pollqueue_add_task(struct polltask *const pt, const int timeout); -+struct pollqueue * pollqueue_new(void); -+void pollqueue_unref(struct pollqueue **const ppq); -+struct pollqueue * pollqueue_ref(struct pollqueue *const pq); -+ -+#endif /* POLLQUEUE_H_ */ ---- /dev/null -+++ b/libavcodec/v4l2_req_utils.h -@@ -0,0 +1,21 @@ -+#include "libavutil/log.h" -+ -+#define request_log(...) av_log(NULL, AV_LOG_INFO, __VA_ARGS__) -+ -+#define request_err(_ctx, ...) av_log(_ctx, AV_LOG_ERROR, __VA_ARGS__) -+#define request_info(_ctx, ...) av_log(_ctx, AV_LOG_INFO, __VA_ARGS__) -+#define request_debug(_ctx, ...) av_log(_ctx, AV_LOG_DEBUG, __VA_ARGS__) -+ -+static inline char safechar(char c) { -+ return c > 0x20 && c < 0x7f ? c : '.'; -+} -+ -+static inline const char * strfourcc(char tbuf[5], uint32_t fcc) { -+ tbuf[0] = safechar((fcc >> 0) & 0xff); -+ tbuf[1] = safechar((fcc >> 8) & 0xff); -+ tbuf[2] = safechar((fcc >> 16) & 0xff); -+ tbuf[3] = safechar((fcc >> 24) & 0xff); -+ tbuf[4] = '\0'; -+ return tbuf; -+} -+ ---- /dev/null -+++ b/libavcodec/v4l2_request_hevc.c -@@ -0,0 +1,280 @@ -+/* -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+ -+ -+#include "decode.h" -+#include "hevcdec.h" -+#include "hwconfig.h" -+ -+#include "v4l2_request_hevc.h" -+ -+#include "libavutil/hwcontext_drm.h" -+ -+#include "v4l2_req_devscan.h" -+#include "v4l2_req_dmabufs.h" -+#include "v4l2_req_pollqueue.h" -+#include "v4l2_req_media.h" -+#include "v4l2_req_utils.h" -+ -+static size_t bit_buf_size(unsigned int w, unsigned int h, unsigned int bits_minus8) -+{ -+ const size_t wxh = w * h; -+ size_t bits_alloc; -+ -+ /* Annex A gives a min compression of 2 @ lvl 3.1 -+ * (wxh <= 983040) and min 4 thereafter but avoid -+ * the odity of 983041 having a lower limit than -+ * 983040. -+ * Multiply by 3/2 for 4:2:0 -+ */ -+ bits_alloc = wxh < 983040 ? wxh * 3 / 4 : -+ wxh < 983040 * 2 ? 983040 * 3 / 4 : -+ wxh * 3 / 8; -+ /* Allow for bit depth */ -+ bits_alloc += (bits_alloc * bits_minus8) / 8; -+ /* Add a few bytes (16k) for overhead */ -+ bits_alloc += 0x4000; -+ return bits_alloc; -+} -+ -+static int v4l2_req_hevc_start_frame(AVCodecContext *avctx, -+ av_unused const uint8_t *buffer, -+ av_unused uint32_t size) -+{ -+ const V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ return ctx->fns->start_frame(avctx, buffer, size); -+} -+ -+static int v4l2_req_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) -+{ -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ return ctx->fns->decode_slice(avctx, buffer, size); -+} -+ -+static int v4l2_req_hevc_end_frame(AVCodecContext *avctx) -+{ -+ V4L2RequestContextHEVC *ctx = avctx->internal->hwaccel_priv_data; -+ return ctx->fns->end_frame(avctx); -+} -+ -+static void v4l2_req_hevc_abort_frame(AVCodecContext * const avctx) -+{ -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ ctx->fns->abort_frame(avctx); -+} -+ -+static int v4l2_req_hevc_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) -+{ -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ return ctx->fns->frame_params(avctx, hw_frames_ctx); -+} -+ -+static int v4l2_request_hevc_uninit(AVCodecContext *avctx) -+{ -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ -+ av_log(avctx, AV_LOG_DEBUG, "<<< %s\n", __func__); -+ -+ decode_q_wait(&ctx->decode_q, NULL); // Wait for all other threads to be out of decode -+ -+ mediabufs_ctl_unref(&ctx->mbufs); -+ media_pool_delete(&ctx->mpool); -+ pollqueue_unref(&ctx->pq); -+ dmabufs_ctl_delete(&ctx->dbufs); -+ devscan_delete(&ctx->devscan); -+ -+ decode_q_uninit(&ctx->decode_q); -+ -+// if (avctx->hw_frames_ctx) { -+// AVHWFramesContext *hwfc = (AVHWFramesContext*)avctx->hw_frames_ctx->data; -+// av_buffer_pool_flush(hwfc->pool); -+// } -+ return 0; -+} -+ -+static int dst_fmt_accept_cb(void * v, const struct v4l2_fmtdesc *fmtdesc) -+{ -+ AVCodecContext *const avctx = v; -+ const HEVCContext *const h = avctx->priv_data; -+ -+ if (h->ps.sps->bit_depth == 8) { -+ if (fmtdesc->pixelformat == V4L2_PIX_FMT_NV12_COL128 || -+ fmtdesc->pixelformat == V4L2_PIX_FMT_NV12) { -+ return 1; -+ } -+ } -+ else if (h->ps.sps->bit_depth == 10) { -+ if (fmtdesc->pixelformat == V4L2_PIX_FMT_NV12_10_COL128) { -+ return 1; -+ } -+ } -+ return 0; -+} -+ -+static int v4l2_request_hevc_init(AVCodecContext *avctx) -+{ -+ const HEVCContext *h = avctx->priv_data; -+ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; -+ const HEVCSPS * const sps = h->ps.sps; -+ int ret; -+ const struct decdev * decdev; -+ const uint32_t src_pix_fmt = V2(ff_v4l2_req_hevc, 1).src_pix_fmt_v4l2; // Assuming constant for all APIs but avoiding V4L2 includes -+ size_t src_size; -+ -+ av_log(avctx, AV_LOG_DEBUG, "<<< %s\n", __func__); -+ -+ if ((ret = devscan_build(avctx, &ctx->devscan)) != 0) { -+ av_log(avctx, AV_LOG_WARNING, "Failed to find any V4L2 devices\n"); -+ return (AVERROR(-ret)); -+ } -+ ret = AVERROR(ENOMEM); // Assume mem fail by default for these -+ -+ if ((decdev = devscan_find(ctx->devscan, src_pix_fmt)) == NULL) -+ { -+ av_log(avctx, AV_LOG_WARNING, "Failed to find a V4L2 device for H265\n"); -+ ret = AVERROR(ENODEV); -+ goto fail0; -+ } -+ av_log(avctx, AV_LOG_DEBUG, "Trying V4L2 devices: %s,%s\n", -+ decdev_media_path(decdev), decdev_video_path(decdev)); -+ -+ if ((ctx->dbufs = dmabufs_ctl_new()) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "Unable to open dmabufs\n"); -+ goto fail0; -+ } -+ -+ if ((ctx->pq = pollqueue_new()) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "Unable to create pollqueue\n"); -+ goto fail1; -+ } -+ -+ if ((ctx->mpool = media_pool_new(decdev_media_path(decdev), ctx->pq, 4)) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "Unable to create media pool\n"); -+ goto fail2; -+ } -+ -+ if ((ctx->mbufs = mediabufs_ctl_new(avctx, decdev_video_path(decdev), ctx->pq)) == NULL) { -+ av_log(avctx, AV_LOG_ERROR, "Unable to create media controls\n"); -+ goto fail3; -+ } -+ -+ // Ask for an initial bitbuf size of max size / 4 -+ // We will realloc if we need more -+ // Must use sps->h/w as avctx contains cropped size -+ src_size = bit_buf_size(sps->width, sps->height, sps->bit_depth - 8); -+ if (mediabufs_src_resizable(ctx->mbufs)) -+ src_size /= 4; -+ // Kludge for conformance tests which break Annex A limits -+ else if (src_size < 0x40000) -+ src_size = 0x40000; -+ -+ if (mediabufs_src_fmt_set(ctx->mbufs, decdev_src_type(decdev), src_pix_fmt, -+ sps->width, sps->height, src_size)) { -+ char tbuf1[5]; -+ av_log(avctx, AV_LOG_ERROR, "Failed to set source format: %s %dx%d\n", strfourcc(tbuf1, src_pix_fmt), sps->width, sps->height); -+ goto fail4; -+ } -+ -+ if (V2(ff_v4l2_req_hevc, 2).probe(avctx, ctx) == 0) { -+ av_log(avctx, AV_LOG_DEBUG, "HEVC API version 2 probed successfully\n"); -+ ctx->fns = &V2(ff_v4l2_req_hevc, 2); -+ } -+ else if (V2(ff_v4l2_req_hevc, 1).probe(avctx, ctx) == 0) { -+ av_log(avctx, AV_LOG_DEBUG, "HEVC API version 1 probed successfully\n"); -+ ctx->fns = &V2(ff_v4l2_req_hevc, 1); -+ } -+ else { -+ av_log(avctx, AV_LOG_ERROR, "No HEVC version probed successfully\n"); -+ ret = AVERROR(EINVAL); -+ goto fail4; -+ } -+ -+ if (mediabufs_dst_fmt_set(ctx->mbufs, sps->width, sps->height, dst_fmt_accept_cb, avctx)) { -+ char tbuf1[5]; -+ av_log(avctx, AV_LOG_ERROR, "Failed to set destination format: %s %dx%d\n", strfourcc(tbuf1, src_pix_fmt), sps->width, sps->height); -+ goto fail4; -+ } -+ -+ if (mediabufs_src_pool_create(ctx->mbufs, ctx->dbufs, 6)) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to create source pool\n"); -+ goto fail4; -+ } -+ -+ if (mediabufs_dst_slots_create(ctx->mbufs, 1)) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to create destination slots\n"); -+ goto fail4; -+ } -+ -+ if (mediabufs_stream_on(ctx->mbufs)) { -+ av_log(avctx, AV_LOG_ERROR, "Failed stream on\n"); -+ goto fail4; -+ } -+ -+ if ((ret = ff_decode_get_hw_frames_ctx(avctx, AV_HWDEVICE_TYPE_DRM)) != 0) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to create frame ctx\n"); -+ goto fail4; -+ } -+ -+ if ((ret = ctx->fns->set_controls(avctx, ctx)) != 0) { -+ av_log(avctx, AV_LOG_ERROR, "Failed set controls\n"); -+ goto fail5; -+ } -+ -+ decode_q_init(&ctx->decode_q); -+ -+ // Set our s/w format -+ avctx->sw_pix_fmt = ((AVHWFramesContext *)avctx->hw_frames_ctx->data)->sw_format; -+ -+ av_log(avctx, AV_LOG_INFO, "Hwaccel %s; devices: %s,%s\n", -+ ctx->fns->name, -+ decdev_media_path(decdev), decdev_video_path(decdev)); -+ -+ return 0; -+ -+fail5: -+ av_buffer_unref(&avctx->hw_frames_ctx); -+fail4: -+ mediabufs_ctl_unref(&ctx->mbufs); -+fail3: -+ media_pool_delete(&ctx->mpool); -+fail2: -+ pollqueue_unref(&ctx->pq); -+fail1: -+ dmabufs_ctl_delete(&ctx->dbufs); -+fail0: -+ devscan_delete(&ctx->devscan); -+ return ret; -+} -+ -+const AVHWAccel ff_hevc_v4l2request_hwaccel = { -+ .name = "hevc_v4l2request", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .id = AV_CODEC_ID_HEVC, -+ .pix_fmt = AV_PIX_FMT_DRM_PRIME, -+// .alloc_frame = v4l2_request_hevc_alloc_frame, -+ .start_frame = v4l2_req_hevc_start_frame, -+ .decode_slice = v4l2_req_hevc_decode_slice, -+ .end_frame = v4l2_req_hevc_end_frame, -+ .abort_frame = v4l2_req_hevc_abort_frame, -+ .init = v4l2_request_hevc_init, -+ .uninit = v4l2_request_hevc_uninit, -+ .priv_data_size = sizeof(V4L2RequestContextHEVC), -+ .frame_params = v4l2_req_hevc_frame_params, -+ .caps_internal = HWACCEL_CAP_ASYNC_SAFE | HWACCEL_CAP_MT_SAFE, -+}; ---- /dev/null -+++ b/libavcodec/v4l2_request_hevc.h -@@ -0,0 +1,100 @@ -+#ifndef AVCODEC_V4L2_REQUEST_HEVC_H -+#define AVCODEC_V4L2_REQUEST_HEVC_H -+ -+#include -+#include "v4l2_req_decode_q.h" -+ -+#ifndef DRM_FORMAT_NV15 -+#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') -+#endif -+ -+#ifndef DRM_FORMAT_NV20 -+#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') -+#endif -+ -+// P030 should be defined in drm_fourcc.h and hopefully will be sometime -+// in the future but until then... -+#ifndef DRM_FORMAT_P030 -+#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') -+#endif -+ -+#ifndef DRM_FORMAT_NV15 -+#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') -+#endif -+ -+#ifndef DRM_FORMAT_NV20 -+#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') -+#endif -+ -+#include -+#ifndef V4L2_CID_CODEC_BASE -+#define V4L2_CID_CODEC_BASE V4L2_CID_MPEG_BASE -+#endif -+ -+// V4L2_PIX_FMT_NV12_10_COL128 and V4L2_PIX_FMT_NV12_COL128 should be defined -+// in drm_fourcc.h hopefully will be sometime in the future but until then... -+#ifndef V4L2_PIX_FMT_NV12_10_COL128 -+#define V4L2_PIX_FMT_NV12_10_COL128 v4l2_fourcc('N', 'C', '3', '0') -+#endif -+ -+#ifndef V4L2_PIX_FMT_NV12_COL128 -+#define V4L2_PIX_FMT_NV12_COL128 v4l2_fourcc('N', 'C', '1', '2') /* 12 Y/CbCr 4:2:0 128 pixel wide column */ -+#endif -+ -+#ifndef V4L2_CTRL_FLAG_DYNAMIC_ARRAY -+#define V4L2_CTRL_FLAG_DYNAMIC_ARRAY 0x0800 -+#endif -+ -+#define MAX_SLICES 128 -+ -+#define VCAT(name, version) name##_v##version -+#define V2(n,v) VCAT(n, v) -+#define V(n) V2(n, HEVC_CTRLS_VERSION) -+ -+#define S2(x) #x -+#define STR(x) S2(x) -+ -+// 1 per decoder -+struct v4l2_req_decode_fns; -+ -+typedef struct V4L2RequestContextHEVC { -+// V4L2RequestContext base; -+ const struct v4l2_req_decode_fns * fns; -+ -+ unsigned int timestamp; // ?? maybe uint64_t -+ -+ int multi_slice; -+ int decode_mode; -+ int start_code; -+ int max_slices; -+ -+ req_decode_q decode_q; -+ -+ struct devscan *devscan; -+ struct dmabufs_ctl *dbufs; -+ struct pollqueue *pq; -+ struct media_pool * mpool; -+ struct mediabufs_ctl *mbufs; -+} V4L2RequestContextHEVC; -+ -+typedef struct v4l2_req_decode_fns { -+ int src_pix_fmt_v4l2; -+ const char * name; -+ -+ // Init setup -+ int (*probe)(AVCodecContext * const avctx, V4L2RequestContextHEVC * const ctx); -+ int (*set_controls)(AVCodecContext * const avctx, V4L2RequestContextHEVC * const ctx); -+ -+ // Passthrough of hwaccel fns -+ int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); -+ int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); -+ int (*end_frame)(AVCodecContext *avctx); -+ void (*abort_frame)(AVCodecContext *avctx); -+ int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx); -+} v4l2_req_decode_fns; -+ -+ -+extern const v4l2_req_decode_fns V2(ff_v4l2_req_hevc, 1); -+extern const v4l2_req_decode_fns V2(ff_v4l2_req_hevc, 2); -+ -+#endif ---- /dev/null -+++ b/libavcodec/weak_link.c -@@ -0,0 +1,100 @@ -+#include -+#include -+#include -+#include "weak_link.h" -+ -+struct ff_weak_link_master { -+ atomic_int ref_count; /* 0 is single ref for easier atomics */ -+ pthread_rwlock_t lock; -+ void * ptr; -+}; -+ -+static inline struct ff_weak_link_master * weak_link_x(struct ff_weak_link_client * c) -+{ -+ return (struct ff_weak_link_master *)c; -+} -+ -+struct ff_weak_link_master * ff_weak_link_new(void * p) -+{ -+ struct ff_weak_link_master * w = malloc(sizeof(*w)); -+ if (!w) -+ return NULL; -+ w->ptr = p; -+ if (pthread_rwlock_init(&w->lock, NULL)) { -+ free(w); -+ return NULL; -+ } -+ return w; -+} -+ -+static void weak_link_do_unref(struct ff_weak_link_master * const w) -+{ -+ int n = atomic_fetch_sub(&w->ref_count, 1); -+ if (n) -+ return; -+ -+ pthread_rwlock_destroy(&w->lock); -+ free(w); -+} -+ -+// Unref & break link -+void ff_weak_link_break(struct ff_weak_link_master ** ppLink) -+{ -+ struct ff_weak_link_master * const w = *ppLink; -+ if (!w) -+ return; -+ -+ *ppLink = NULL; -+ pthread_rwlock_wrlock(&w->lock); -+ w->ptr = NULL; -+ pthread_rwlock_unlock(&w->lock); -+ -+ weak_link_do_unref(w); -+} -+ -+struct ff_weak_link_client* ff_weak_link_ref(struct ff_weak_link_master * w) -+{ -+ atomic_fetch_add(&w->ref_count, 1); -+ return (struct ff_weak_link_client*)w; -+} -+ -+void ff_weak_link_unref(struct ff_weak_link_client ** ppLink) -+{ -+ struct ff_weak_link_master * const w = weak_link_x(*ppLink); -+ if (!w) -+ return; -+ -+ *ppLink = NULL; -+ weak_link_do_unref(w); -+} -+ -+void * ff_weak_link_lock(struct ff_weak_link_client ** ppLink) -+{ -+ struct ff_weak_link_master * const w = weak_link_x(*ppLink); -+ -+ if (!w) -+ return NULL; -+ -+ if (pthread_rwlock_rdlock(&w->lock)) -+ goto broken; -+ -+ if (w->ptr) -+ return w->ptr; -+ -+ pthread_rwlock_unlock(&w->lock); -+ -+broken: -+ *ppLink = NULL; -+ weak_link_do_unref(w); -+ return NULL; -+} -+ -+// Ignores a NULL c (so can be on the return path of both broken & live links) -+void ff_weak_link_unlock(struct ff_weak_link_client * c) -+{ -+ struct ff_weak_link_master * const w = weak_link_x(c); -+ if (w) -+ pthread_rwlock_unlock(&w->lock); -+} -+ -+ ---- /dev/null -+++ b/libavcodec/weak_link.h -@@ -0,0 +1,23 @@ -+struct ff_weak_link_master; -+struct ff_weak_link_client; -+ -+struct ff_weak_link_master * ff_weak_link_new(void * p); -+void ff_weak_link_break(struct ff_weak_link_master ** ppLink); -+ -+struct ff_weak_link_client* ff_weak_link_ref(struct ff_weak_link_master * w); -+void ff_weak_link_unref(struct ff_weak_link_client ** ppLink); -+ -+// Returns NULL if link broken - in this case it will also zap -+// *ppLink and unref the weak_link. -+// Returns NULL if *ppLink is NULL (so a link once broken stays broken) -+// -+// The above does mean that there is a race if this is called simultainiously -+// by two threads using the same weak_link_client (so don't do that) -+void * ff_weak_link_lock(struct ff_weak_link_client ** ppLink); -+void ff_weak_link_unlock(struct ff_weak_link_client * c); -+ -+ -+ -+ -+ -+ ---- a/libavdevice/Makefile -+++ b/libavdevice/Makefile -@@ -46,6 +46,9 @@ OBJS-$(CONFIG_SNDIO_OUTDEV) - OBJS-$(CONFIG_V4L2_INDEV) += v4l2.o v4l2-common.o timefilter.o - OBJS-$(CONFIG_V4L2_OUTDEV) += v4l2enc.o v4l2-common.o - OBJS-$(CONFIG_VFWCAP_INDEV) += vfwcap.o -+OBJS-$(CONFIG_VOUT_DRM_OUTDEV) += drm_vout.o -+OBJS-$(CONFIG_VOUT_EGL_OUTDEV) += egl_vout.o -+OBJS-$(CONFIG_VOUT_RPI_OUTDEV) += rpi_vout.o - OBJS-$(CONFIG_XCBGRAB_INDEV) += xcbgrab.o - OBJS-$(CONFIG_XV_OUTDEV) += xv.o - ---- a/libavdevice/alldevices.c -+++ b/libavdevice/alldevices.c -@@ -52,6 +52,9 @@ extern AVOutputFormat ff_sndio_muxer; - extern AVInputFormat ff_v4l2_demuxer; - extern AVOutputFormat ff_v4l2_muxer; - extern AVInputFormat ff_vfwcap_demuxer; -+extern AVOutputFormat ff_vout_drm_muxer; -+extern AVOutputFormat ff_vout_egl_muxer; -+extern AVOutputFormat ff_vout_rpi_muxer; - extern AVInputFormat ff_xcbgrab_demuxer; - extern AVOutputFormat ff_xv_muxer; - ---- /dev/null -+++ b/libavdevice/drm_vout.c -@@ -0,0 +1,643 @@ -+/* -+ * Copyright (c) 2020 John Cox for Raspberry Pi Trading -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+ -+// *** This module is a work in progress and its utility is strictly -+// limited to testing. -+ -+#include "libavutil/opt.h" -+#include "libavutil/pixdesc.h" -+#include "libavutil/hwcontext_drm.h" -+#include "libavformat/internal.h" -+#include "avdevice.h" -+ -+#include "pthread.h" -+#include -+#include -+ -+#include -+#include -+ -+#define TRACE_ALL 0 -+ -+#define DRM_MODULE "vc4" -+ -+#define ERRSTR strerror(errno) -+ -+struct drm_setup { -+ int conId; -+ uint32_t crtcId; -+ int crtcIdx; -+ uint32_t planeId; -+ unsigned int out_fourcc; -+ struct { -+ int x, y, width, height; -+ } compose; -+}; -+ -+typedef struct drm_aux_s { -+ unsigned int fb_handle; -+ uint32_t bo_handles[AV_DRM_MAX_PLANES]; -+ AVFrame * frame; -+} drm_aux_t; -+ -+// Aux size should only need to be 2, but on a few streams (Hobbit) under FKMS -+// we get initial flicker probably due to dodgy drm timing -+#define AUX_SIZE 3 -+typedef struct drm_display_env_s -+{ -+ AVClass *class; -+ -+ int drm_fd; -+ uint32_t con_id; -+ struct drm_setup setup; -+ enum AVPixelFormat avfmt; -+ int show_all; -+ -+ unsigned int ano; -+ drm_aux_t aux[AUX_SIZE]; -+ -+ pthread_t q_thread; -+ sem_t q_sem_in; -+ sem_t q_sem_out; -+ int q_terminate; -+ AVFrame * q_next; -+ -+} drm_display_env_t; -+ -+ -+static int drm_vout_write_trailer(AVFormatContext *s) -+{ -+#if TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, "%s\n", __func__); -+#endif -+ -+ return 0; -+} -+ -+static int drm_vout_write_header(AVFormatContext *s) -+{ -+ const AVCodecParameters * const par = s->streams[0]->codecpar; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, "%s\n", __func__); -+#endif -+ if ( s->nb_streams > 1 -+ || par->codec_type != AVMEDIA_TYPE_VIDEO -+ || par->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME) { -+ av_log(s, AV_LOG_ERROR, "Only supports one wrapped avframe stream\n"); -+ return AVERROR(EINVAL); -+ } -+ -+ return 0; -+} -+ -+static int find_plane(struct AVFormatContext * const avctx, -+ const int drmfd, const int crtcidx, const uint32_t format, -+ uint32_t * const pplane_id) -+{ -+ drmModePlaneResPtr planes; -+ drmModePlanePtr plane; -+ unsigned int i; -+ unsigned int j; -+ int ret = 0; -+ -+ planes = drmModeGetPlaneResources(drmfd); -+ if (!planes) -+ { -+ av_log(avctx, AV_LOG_WARNING, "drmModeGetPlaneResources failed: %s\n", ERRSTR); -+ return -1; -+ } -+ -+ for (i = 0; i < planes->count_planes; ++i) { -+ plane = drmModeGetPlane(drmfd, planes->planes[i]); -+ if (!planes) -+ { -+ av_log(avctx, AV_LOG_WARNING, "drmModeGetPlane failed: %s\n", ERRSTR); -+ break; -+ } -+ -+ if (!(plane->possible_crtcs & (1 << crtcidx))) { -+ drmModeFreePlane(plane); -+ continue; -+ } -+ -+ for (j = 0; j < plane->count_formats; ++j) { -+ if (plane->formats[j] == format) -+ break; -+ } -+ -+ if (j == plane->count_formats) { -+ drmModeFreePlane(plane); -+ continue; -+ } -+ -+ *pplane_id = plane->plane_id; -+ drmModeFreePlane(plane); -+ break; -+ } -+ -+ if (i == planes->count_planes) -+ ret = -1; -+ -+ drmModeFreePlaneResources(planes); -+ return ret; -+} -+ -+static void da_uninit(drm_display_env_t * const de, drm_aux_t * da) -+{ -+ if (da->fb_handle != 0) { -+ drmModeRmFB(de->drm_fd, da->fb_handle); -+ da->fb_handle = 0; -+ } -+ -+ for (unsigned int i = 0; i != AV_DRM_MAX_PLANES; ++i) { -+ if (da->bo_handles[i]) { -+ struct drm_gem_close gem_close = {.handle = da->bo_handles[i]}; -+ drmIoctl(de->drm_fd, DRM_IOCTL_GEM_CLOSE, &gem_close); -+ da->bo_handles[i] = 0; -+ } -+ } -+ av_frame_free(&da->frame); -+} -+ -+static int do_display(AVFormatContext * const s, drm_display_env_t * const de, AVFrame * frame) -+{ -+ const AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor*)frame->data[0]; -+ drm_aux_t * da = de->aux + de->ano; -+ const uint32_t format = desc->layers[0].format; -+ int ret = 0; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, "<<< %s: fd=%d\n", __func__, desc->objects[0].fd); -+#endif -+ -+ if (de->setup.out_fourcc != format) { -+ if (find_plane(s, de->drm_fd, de->setup.crtcIdx, format, &de->setup.planeId)) { -+ av_frame_free(&frame); -+ av_log(s, AV_LOG_WARNING, "No plane for format: %#x\n", format); -+ return -1; -+ } -+ de->setup.out_fourcc = format; -+ } -+ -+ { -+ drmVBlank vbl = { -+ .request = { -+ .type = DRM_VBLANK_RELATIVE, -+ .sequence = 0 -+ } -+ }; -+ -+ while (drmWaitVBlank(de->drm_fd, &vbl)) { -+ if (errno != EINTR) { -+ av_log(s, AV_LOG_WARNING, "drmWaitVBlank failed: %s\n", ERRSTR); -+ break; -+ } -+ } -+ } -+ -+ da_uninit(de, da); -+ -+ { -+ uint32_t pitches[4] = {0}; -+ uint32_t offsets[4] = {0}; -+ uint64_t modifiers[4] = {0}; -+ uint32_t bo_handles[4] = {0}; -+ int i, j, n; -+ -+ da->frame = frame; -+ -+ for (i = 0; i < desc->nb_objects; ++i) { -+ if (drmPrimeFDToHandle(de->drm_fd, desc->objects[i].fd, da->bo_handles + i) != 0) { -+ av_log(s, AV_LOG_WARNING, "drmPrimeFDToHandle[%d](%d) failed: %s\n", i, desc->objects[i].fd, ERRSTR); -+ return -1; -+ } -+ } -+ -+ n = 0; -+ for (i = 0; i < desc->nb_layers; ++i) { -+ for (j = 0; j < desc->layers[i].nb_planes; ++j) { -+ const AVDRMPlaneDescriptor * const p = desc->layers[i].planes + j; -+ const AVDRMObjectDescriptor * const obj = desc->objects + p->object_index; -+ pitches[n] = p->pitch; -+ offsets[n] = p->offset; -+ modifiers[n] = obj->format_modifier; -+ bo_handles[n] = da->bo_handles[p->object_index]; -+ ++n; -+ } -+ } -+ -+#if 1 && TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, "%dx%d, fmt: %x, boh=%d,%d,%d,%d, pitch=%d,%d,%d,%d," -+ " offset=%d,%d,%d,%d, mod=%llx,%llx,%llx,%llx\n", -+ av_frame_cropped_width(frame), -+ av_frame_cropped_height(frame), -+ desc->layers[0].format, -+ bo_handles[0], -+ bo_handles[1], -+ bo_handles[2], -+ bo_handles[3], -+ pitches[0], -+ pitches[1], -+ pitches[2], -+ pitches[3], -+ offsets[0], -+ offsets[1], -+ offsets[2], -+ offsets[3], -+ (long long)modifiers[0], -+ (long long)modifiers[1], -+ (long long)modifiers[2], -+ (long long)modifiers[3] -+ ); -+#endif -+ -+ if (drmModeAddFB2WithModifiers(de->drm_fd, -+ av_frame_cropped_width(frame), -+ av_frame_cropped_height(frame), -+ desc->layers[0].format, bo_handles, -+ pitches, offsets, modifiers, -+ &da->fb_handle, DRM_MODE_FB_MODIFIERS /** 0 if no mods */) != 0) { -+ av_log(s, AV_LOG_WARNING, "drmModeAddFB2WithModifiers failed: %s\n", ERRSTR); -+ return -1; -+ } -+ } -+ -+ ret = drmModeSetPlane(de->drm_fd, de->setup.planeId, de->setup.crtcId, -+ da->fb_handle, 0, -+ de->setup.compose.x, de->setup.compose.y, -+ de->setup.compose.width, -+ de->setup.compose.height, -+ 0, 0, -+ av_frame_cropped_width(frame) << 16, -+ av_frame_cropped_height(frame) << 16); -+ -+ if (ret != 0) { -+ av_log(s, AV_LOG_WARNING, "drmModeSetPlane failed: %s\n", ERRSTR); -+ } -+ -+ de->ano = de->ano + 1 >= AUX_SIZE ? 0 : de->ano + 1; -+ -+ return ret; -+} -+ -+static int do_sem_wait(sem_t * const sem, const int nowait) -+{ -+ while (nowait ? sem_trywait(sem) : sem_wait(sem)) { -+ if (errno != EINTR) -+ return -errno; -+ } -+ return 0; -+} -+ -+static void * display_thread(void * v) -+{ -+ AVFormatContext * const s = v; -+ drm_display_env_t * const de = s->priv_data; -+ int i; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); -+#endif -+ -+ sem_post(&de->q_sem_out); -+ -+ for (;;) { -+ AVFrame * frame; -+ -+ do_sem_wait(&de->q_sem_in, 0); -+ -+ if (de->q_terminate) -+ break; -+ -+ frame = de->q_next; -+ de->q_next = NULL; -+ sem_post(&de->q_sem_out); -+ -+ do_display(s, de, frame); -+ } -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); -+#endif -+ -+ for (i = 0; i != AUX_SIZE; ++i) -+ da_uninit(de, de->aux + i); -+ -+ av_frame_free(&de->q_next); -+ -+ return NULL; -+} -+ -+static int drm_vout_write_packet(AVFormatContext *s, AVPacket *pkt) -+{ -+ const AVFrame * const src_frame = (AVFrame *)pkt->data; -+ AVFrame * frame; -+ drm_display_env_t * const de = s->priv_data; -+ int ret; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, "%s\n", __func__); -+#endif -+ -+ if ((src_frame->flags & AV_FRAME_FLAG_CORRUPT) != 0) { -+ av_log(s, AV_LOG_WARNING, "Discard corrupt frame: fmt=%d, ts=%" PRId64 "\n", src_frame->format, src_frame->pts); -+ return 0; -+ } -+ -+ if (src_frame->format == AV_PIX_FMT_DRM_PRIME) { -+ frame = av_frame_alloc(); -+ av_frame_ref(frame, src_frame); -+ } -+ else if (src_frame->format == AV_PIX_FMT_VAAPI) { -+ frame = av_frame_alloc(); -+ frame->format = AV_PIX_FMT_DRM_PRIME; -+ if (av_hwframe_map(frame, src_frame, 0) != 0) -+ { -+ av_log(s, AV_LOG_WARNING, "Failed to map frame (format=%d) to DRM_PRiME\n", src_frame->format); -+ av_frame_free(&frame); -+ return AVERROR(EINVAL); -+ } -+ } -+ else { -+ av_log(s, AV_LOG_WARNING, "Frame (format=%d) not DRM_PRiME\n", src_frame->format); -+ return AVERROR(EINVAL); -+ } -+ -+ ret = do_sem_wait(&de->q_sem_out, !de->show_all); -+ if (ret) { -+ av_frame_free(&frame); -+ } -+ else { -+ de->q_next = frame; -+ sem_post(&de->q_sem_in); -+ } -+ -+ return 0; -+} -+ -+static int drm_vout_write_frame(AVFormatContext *s, int stream_index, AVFrame **ppframe, -+ unsigned flags) -+{ -+#if TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, "%s: idx=%d, flags=%#x\n", __func__, stream_index, flags); -+#endif -+ -+ /* drm_vout_write_header() should have accepted only supported formats */ -+ if ((flags & AV_WRITE_UNCODED_FRAME_QUERY)) -+ return 0; -+ -+ return 0; -+} -+ -+static int drm_vout_control_message(AVFormatContext *s, int type, void *data, size_t data_size) -+{ -+#if TRACE_ALL -+ av_log(s, AV_LOG_DEBUG, "%s: %d\n", __func__, type); -+#endif -+ switch(type) { -+ case AV_APP_TO_DEV_WINDOW_REPAINT: -+ return 0; -+ default: -+ break; -+ } -+ return AVERROR(ENOSYS); -+} -+ -+static int find_crtc(struct AVFormatContext * const avctx, int drmfd, struct drm_setup *s, uint32_t * const pConId) -+{ -+ int ret = -1; -+ int i; -+ drmModeRes *res = drmModeGetResources(drmfd); -+ drmModeConnector *c; -+ -+ if(!res) -+ { -+ printf( "drmModeGetResources failed: %s\n", ERRSTR); -+ return -1; -+ } -+ -+ if (res->count_crtcs <= 0) -+ { -+ printf( "drm: no crts\n"); -+ goto fail_res; -+ } -+ -+ if (!s->conId) { -+ fprintf(stderr, -+ "No connector ID specified. Choosing default from list:\n"); -+ -+ for (i = 0; i < res->count_connectors; i++) { -+ drmModeConnector *con = -+ drmModeGetConnector(drmfd, res->connectors[i]); -+ drmModeEncoder *enc = NULL; -+ drmModeCrtc *crtc = NULL; -+ -+ if (con->encoder_id) { -+ enc = drmModeGetEncoder(drmfd, con->encoder_id); -+ if (enc->crtc_id) { -+ crtc = drmModeGetCrtc(drmfd, enc->crtc_id); -+ } -+ } -+ -+ if (!s->conId && crtc) { -+ s->conId = con->connector_id; -+ s->crtcId = crtc->crtc_id; -+ } -+ -+ av_log(avctx, AV_LOG_DEBUG, "Connector %d (crtc %d): type %d, %dx%d%s\n", -+ con->connector_id, -+ crtc ? crtc->crtc_id : 0, -+ con->connector_type, -+ crtc ? crtc->width : 0, -+ crtc ? crtc->height : 0, -+ (s->conId == (int)con->connector_id ? -+ " (chosen)" : "")); -+ } -+ -+ if (!s->conId) { -+ av_log(avctx, AV_LOG_ERROR, -+ "No suitable enabled connector found.\n"); -+ return -1;; -+ } -+ } -+ -+ s->crtcIdx = -1; -+ -+ for (i = 0; i < res->count_crtcs; ++i) { -+ if (s->crtcId == res->crtcs[i]) { -+ s->crtcIdx = i; -+ break; -+ } -+ } -+ -+ if (s->crtcIdx == -1) -+ { -+ av_log(avctx, AV_LOG_WARNING, "drm: CRTC %u not found\n", s->crtcId); -+ goto fail_res; -+ } -+ -+ if (res->count_connectors <= 0) -+ { -+ av_log(avctx, AV_LOG_WARNING, "drm: no connectors\n"); -+ goto fail_res; -+ } -+ -+ c = drmModeGetConnector(drmfd, s->conId); -+ if (!c) -+ { -+ av_log(avctx, AV_LOG_WARNING, "drmModeGetConnector failed: %s\n", ERRSTR); -+ goto fail_res; -+ } -+ -+ if (!c->count_modes) -+ { -+ av_log(avctx, AV_LOG_WARNING, "connector supports no mode\n"); -+ goto fail_conn; -+ } -+ -+ { -+ drmModeCrtc *crtc = drmModeGetCrtc(drmfd, s->crtcId); -+ s->compose.x = crtc->x; -+ s->compose.y = crtc->y; -+ s->compose.width = crtc->width; -+ s->compose.height = crtc->height; -+ drmModeFreeCrtc(crtc); -+ } -+ -+ if (pConId) -+ *pConId = c->connector_id; -+ ret = 0; -+ -+fail_conn: -+ drmModeFreeConnector(c); -+ -+fail_res: -+ drmModeFreeResources(res); -+ -+ return ret; -+} -+ -+// deinit is called if init fails so no need to clean up explicity here -+static int drm_vout_init(struct AVFormatContext * s) -+{ -+ drm_display_env_t * const de = s->priv_data; -+ int rv; -+ const char * drm_module = DRM_MODULE; -+ -+ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); -+ -+ de->drm_fd = -1; -+ de->con_id = 0; -+ de->setup = (struct drm_setup){0}; -+ de->q_terminate = 0; -+ -+ if ((de->drm_fd = drmOpen(drm_module, NULL)) < 0) -+ { -+ rv = AVERROR(errno); -+ av_log(s, AV_LOG_ERROR, "Failed to drmOpen %s: %s\n", drm_module, av_err2str(rv)); -+ return rv; -+ } -+ -+ if (find_crtc(s, de->drm_fd, &de->setup, &de->con_id) != 0) -+ { -+ av_log(s, AV_LOG_ERROR, "failed to find valid mode\n"); -+ rv = AVERROR(EINVAL); -+ goto fail_close; -+ } -+ -+ sem_init(&de->q_sem_in, 0, 0); -+ sem_init(&de->q_sem_out, 0, 0); -+ if (pthread_create(&de->q_thread, NULL, display_thread, s)) { -+ rv = AVERROR(errno); -+ av_log(s, AV_LOG_ERROR, "Failed to creatye display thread: %s\n", av_err2str(rv)); -+ goto fail_close; -+ } -+ -+ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); -+ -+ return 0; -+ -+fail_close: -+ close(de->drm_fd); -+ de->drm_fd = -1; -+ av_log(s, AV_LOG_DEBUG, ">>> %s: FAIL\n", __func__); -+ -+ return rv; -+} -+ -+static void drm_vout_deinit(struct AVFormatContext * s) -+{ -+ drm_display_env_t * const de = s->priv_data; -+ -+ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); -+ -+ de->q_terminate = 1; -+ sem_post(&de->q_sem_in); -+ pthread_join(de->q_thread, NULL); -+ sem_destroy(&de->q_sem_in); -+ sem_destroy(&de->q_sem_out); -+ -+ for (unsigned int i = 0; i != AUX_SIZE; ++i) -+ da_uninit(de, de->aux + i); -+ -+ av_frame_free(&de->q_next); -+ -+ if (de->drm_fd >= 0) { -+ close(de->drm_fd); -+ de->drm_fd = -1; -+ } -+ -+ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); -+} -+ -+ -+#define OFFSET(x) offsetof(drm_display_env_t, x) -+static const AVOption options[] = { -+ { "show_all", "show all frames", OFFSET(show_all), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, -+ { NULL } -+}; -+ -+static const AVClass drm_vout_class = { -+ .class_name = "drm vid outdev", -+ .item_name = av_default_item_name, -+ .option = options, -+ .version = LIBAVUTIL_VERSION_INT, -+ .category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, -+}; -+ -+AVOutputFormat ff_vout_drm_muxer = { -+ .name = "vout_drm", -+ .long_name = NULL_IF_CONFIG_SMALL("Drm video output device"), -+ .priv_data_size = sizeof(drm_display_env_t), -+ .audio_codec = AV_CODEC_ID_NONE, -+ .video_codec = AV_CODEC_ID_WRAPPED_AVFRAME, -+ .write_header = drm_vout_write_header, -+ .write_packet = drm_vout_write_packet, -+ .write_uncoded_frame = drm_vout_write_frame, -+ .write_trailer = drm_vout_write_trailer, -+ .control_message = drm_vout_control_message, -+ .flags = AVFMT_NOFILE | AVFMT_VARIABLE_FPS | AVFMT_NOTIMESTAMPS, -+ .priv_class = &drm_vout_class, -+ .init = drm_vout_init, -+ .deinit = drm_vout_deinit, -+}; -+ ---- /dev/null -+++ b/libavdevice/egl_vout.c -@@ -0,0 +1,825 @@ -+/* -+ * Copyright (c) 2020 John Cox for Raspberry Pi Trading -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+ -+// *** This module is a work in progress and its utility is strictly -+// limited to testing. -+// Amongst other issues it doesn't wait for the pic to be displayed before -+// returning the buffer so flikering does occur. -+ -+#include -+#include -+ -+#include "libavutil/opt.h" -+#include "libavutil/avassert.h" -+#include "libavutil/pixdesc.h" -+#include "libavutil/imgutils.h" -+#include "libavutil/hwcontext_drm.h" -+#include "libavformat/internal.h" -+#include "avdevice.h" -+ -+#include "pthread.h" -+#include -+#include -+#include -+ -+#include "drm_fourcc.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "libavutil/rpi_sand_fns.h" -+ -+#define TRACE_ALL 0 -+ -+struct egl_setup { -+ int conId; -+ -+ Display *dpy; -+ EGLDisplay egl_dpy; -+ EGLContext ctx; -+ EGLSurface surf; -+ Window win; -+ -+ uint32_t crtcId; -+ int crtcIdx; -+ uint32_t planeId; -+ struct { -+ int x, y, width, height; -+ } compose; -+}; -+ -+typedef struct egl_aux_s { -+ int fd; -+ GLuint texture; -+ -+} egl_aux_t; -+ -+typedef struct egl_display_env_s -+{ -+ AVClass *class; -+ -+ struct egl_setup setup; -+ enum AVPixelFormat avfmt; -+ -+ int show_all; -+ int window_width, window_height; -+ int window_x, window_y; -+ int fullscreen; -+ -+ egl_aux_t aux[32]; -+ -+ pthread_t q_thread; -+ pthread_mutex_t q_lock; -+ sem_t display_start_sem; -+ sem_t q_sem; -+ int q_terminate; -+ AVFrame * q_this; -+ AVFrame * q_next; -+ -+} egl_display_env_t; -+ -+ -+/** -+ * Remove window border/decorations. -+ */ -+static void -+no_border( Display *dpy, Window w) -+{ -+ static const unsigned MWM_HINTS_DECORATIONS = (1 << 1); -+ static const int PROP_MOTIF_WM_HINTS_ELEMENTS = 5; -+ -+ typedef struct -+ { -+ unsigned long flags; -+ unsigned long functions; -+ unsigned long decorations; -+ long inputMode; -+ unsigned long status; -+ } PropMotifWmHints; -+ -+ PropMotifWmHints motif_hints; -+ Atom prop, proptype; -+ unsigned long flags = 0; -+ -+ /* setup the property */ -+ motif_hints.flags = MWM_HINTS_DECORATIONS; -+ motif_hints.decorations = flags; -+ -+ /* get the atom for the property */ -+ prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True ); -+ if (!prop) { -+ /* something went wrong! */ -+ return; -+ } -+ -+ /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */ -+ proptype = prop; -+ -+ XChangeProperty( dpy, w, /* display, window */ -+ prop, proptype, /* property, type */ -+ 32, /* format: 32-bit datums */ -+ PropModeReplace, /* mode */ -+ (unsigned char *) &motif_hints, /* data */ -+ PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */ -+ ); -+} -+ -+ -+/* -+ * Create an RGB, double-buffered window. -+ * Return the window and context handles. -+ */ -+static int -+make_window(struct AVFormatContext * const s, -+ egl_display_env_t * const de, -+ Display *dpy, EGLDisplay egl_dpy, const char *name, -+ Window *winRet, EGLContext *ctxRet, EGLSurface *surfRet) -+{ -+ int scrnum = DefaultScreen( dpy ); -+ XSetWindowAttributes attr; -+ unsigned long mask; -+ Window root = RootWindow( dpy, scrnum ); -+ Window win; -+ EGLContext ctx; -+ const int fullscreen = de->fullscreen; -+ EGLConfig config; -+ int x = de->window_x; -+ int y = de->window_y; -+ int width = de->window_width ? de->window_width : 1280; -+ int height = de->window_height ? de->window_height : 720; -+ -+ -+ if (fullscreen) { -+ int scrnum = DefaultScreen(dpy); -+ -+ x = 0; y = 0; -+ width = DisplayWidth(dpy, scrnum); -+ height = DisplayHeight(dpy, scrnum); -+ } -+ -+ { -+ EGLint num_configs; -+ static const EGLint attribs[] = { -+ EGL_RED_SIZE, 1, -+ EGL_GREEN_SIZE, 1, -+ EGL_BLUE_SIZE, 1, -+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, -+ EGL_NONE -+ }; -+ -+ if (!eglChooseConfig(egl_dpy, attribs, &config, 1, &num_configs)) { -+ av_log(s, AV_LOG_ERROR, "Error: couldn't get an EGL visual config\n"); -+ return -1; -+ } -+ } -+ -+ { -+ EGLint vid; -+ if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { -+ av_log(s, AV_LOG_ERROR, "Error: eglGetConfigAttrib() failed\n"); -+ return -1; -+ } -+ -+ { -+ XVisualInfo visTemplate = { -+ .visualid = vid, -+ }; -+ int num_visuals; -+ XVisualInfo *visinfo = XGetVisualInfo(dpy, VisualIDMask, -+ &visTemplate, &num_visuals); -+ -+ /* window attributes */ -+ attr.background_pixel = 0; -+ attr.border_pixel = 0; -+ attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); -+ attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; -+ /* XXX this is a bad way to get a borderless window! */ -+ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; -+ -+ win = XCreateWindow( dpy, root, x, y, width, height, -+ 0, visinfo->depth, InputOutput, -+ visinfo->visual, mask, &attr ); -+ XFree(visinfo); -+ } -+ } -+ -+ if (fullscreen) -+ no_border(dpy, win); -+ -+ /* set hints and properties */ -+ { -+ XSizeHints sizehints; -+ sizehints.x = x; -+ sizehints.y = y; -+ sizehints.width = width; -+ sizehints.height = height; -+ sizehints.flags = USSize | USPosition; -+ XSetNormalHints(dpy, win, &sizehints); -+ XSetStandardProperties(dpy, win, name, name, -+ None, (char **)NULL, 0, &sizehints); -+ } -+ -+ eglBindAPI(EGL_OPENGL_ES_API); -+ -+ { -+ static const EGLint ctx_attribs[] = { -+ EGL_CONTEXT_CLIENT_VERSION, 2, -+ EGL_NONE -+ }; -+ ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs ); -+ if (!ctx) { -+ av_log(s, AV_LOG_ERROR, "Error: eglCreateContext failed\n"); -+ return -1; -+ } -+ } -+ -+ -+ XMapWindow(dpy, win); -+ -+ { -+ EGLSurface surf = eglCreateWindowSurface(egl_dpy, config, -+ (void *)(uintptr_t)win, NULL); -+ if (!surf) { -+ av_log(s, AV_LOG_ERROR, "Error: eglCreateWindowSurface failed\n"); -+ return -1; -+ } -+ -+ if (!eglMakeCurrent(egl_dpy, surf, surf, ctx)) { -+ av_log(s, AV_LOG_ERROR, "Error: eglCreateContext failed\n"); -+ return -1; -+ } -+ -+ *winRet = win; -+ *ctxRet = ctx; -+ *surfRet = surf; -+ } -+ -+ return 0; -+} -+ -+static GLint -+compile_shader(struct AVFormatContext * const avctx, GLenum target, const char *source) -+{ -+ GLuint s = glCreateShader(target); -+ -+ if (s == 0) { -+ av_log(avctx, AV_LOG_ERROR, "Failed to create shader\n"); -+ return 0; -+ } -+ -+ glShaderSource(s, 1, (const GLchar **) &source, NULL); -+ glCompileShader(s); -+ -+ { -+ GLint ok; -+ glGetShaderiv(s, GL_COMPILE_STATUS, &ok); -+ -+ if (!ok) { -+ GLchar *info; -+ GLint size; -+ -+ glGetShaderiv(s, GL_INFO_LOG_LENGTH, &size); -+ info = malloc(size); -+ -+ glGetShaderInfoLog(s, size, NULL, info); -+ av_log(avctx, AV_LOG_ERROR, "Failed to compile shader: %ssource:\n%s\n", info, source); -+ -+ return 0; -+ } -+ } -+ -+ return s; -+} -+ -+static GLuint link_program(struct AVFormatContext * const s, GLint vs, GLint fs) -+{ -+ GLuint prog = glCreateProgram(); -+ -+ if (prog == 0) { -+ av_log(s, AV_LOG_ERROR, "Failed to create program\n"); -+ return 0; -+ } -+ -+ glAttachShader(prog, vs); -+ glAttachShader(prog, fs); -+ glLinkProgram(prog); -+ -+ { -+ GLint ok; -+ glGetProgramiv(prog, GL_LINK_STATUS, &ok); -+ if (!ok) { -+ /* Some drivers return a size of 1 for an empty log. This is the size -+ * of a log that contains only a terminating NUL character. -+ */ -+ GLint size; -+ GLchar *info = NULL; -+ glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); -+ if (size > 1) { -+ info = malloc(size); -+ glGetProgramInfoLog(prog, size, NULL, info); -+ } -+ -+ av_log(s, AV_LOG_ERROR, "Failed to link: %s\n", -+ (info != NULL) ? info : ""); -+ return 0; -+ } -+ } -+ -+ return prog; -+} -+ -+static int -+gl_setup(struct AVFormatContext * const s) -+{ -+ const char *vs = -+ "attribute vec4 pos;\n" -+ "varying vec2 texcoord;\n" -+ "\n" -+ "void main() {\n" -+ " gl_Position = pos;\n" -+ " texcoord.x = (pos.x + 1.0) / 2.0;\n" -+ " texcoord.y = (-pos.y + 1.0) / 2.0;\n" -+ "}\n"; -+ const char *fs = -+ "#extension GL_OES_EGL_image_external : enable\n" -+ "precision mediump float;\n" -+ "uniform samplerExternalOES s;\n" -+ "varying vec2 texcoord;\n" -+ "void main() {\n" -+ " gl_FragColor = texture2D(s, texcoord);\n" -+ "}\n"; -+ -+ GLuint vs_s; -+ GLuint fs_s; -+ GLuint prog; -+ -+ if (!(vs_s = compile_shader(s, GL_VERTEX_SHADER, vs)) || -+ !(fs_s = compile_shader(s, GL_FRAGMENT_SHADER, fs)) || -+ !(prog = link_program(s, vs_s, fs_s))) -+ return -1; -+ -+ glUseProgram(prog); -+ -+ { -+ static const float verts[] = { -+ -1, -1, -+ 1, -1, -+ 1, 1, -+ -1, 1, -+ }; -+ glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, verts); -+ } -+ -+ glEnableVertexAttribArray(0); -+ return 0; -+} -+ -+static int egl_vout_write_trailer(AVFormatContext *s) -+{ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s\n", __func__); -+#endif -+ -+ return 0; -+} -+ -+static int egl_vout_write_header(AVFormatContext *s) -+{ -+ const AVCodecParameters * const par = s->streams[0]->codecpar; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s\n", __func__); -+#endif -+ if ( s->nb_streams > 1 -+ || par->codec_type != AVMEDIA_TYPE_VIDEO -+ || par->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME) { -+ av_log(s, AV_LOG_ERROR, "Only supports one wrapped avframe stream\n"); -+ return AVERROR(EINVAL); -+ } -+ -+ return 0; -+} -+ -+ -+static int do_display(AVFormatContext * const s, egl_display_env_t * const de, AVFrame * const frame) -+{ -+ const AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor*)frame->data[0]; -+ egl_aux_t * da = NULL; -+ unsigned int i; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "<<< %s\n", __func__); -+#endif -+ -+ for (i = 0; i != 32; ++i) { -+ if (de->aux[i].fd == -1 || de->aux[i].fd == desc->objects[0].fd) { -+ da = de->aux + i; -+ break; -+ } -+ } -+ -+ if (da == NULL) { -+ av_log(s, AV_LOG_INFO, "%s: Out of handles\n", __func__); -+ return AVERROR(EINVAL); -+ } -+ -+ if (da->texture == 0) { -+ EGLint attribs[50]; -+ EGLint * a = attribs; -+ int i, j; -+ static const EGLint anames[] = { -+ EGL_DMA_BUF_PLANE0_FD_EXT, -+ EGL_DMA_BUF_PLANE0_OFFSET_EXT, -+ EGL_DMA_BUF_PLANE0_PITCH_EXT, -+ EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, -+ EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, -+ EGL_DMA_BUF_PLANE1_FD_EXT, -+ EGL_DMA_BUF_PLANE1_OFFSET_EXT, -+ EGL_DMA_BUF_PLANE1_PITCH_EXT, -+ EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, -+ EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, -+ EGL_DMA_BUF_PLANE2_FD_EXT, -+ EGL_DMA_BUF_PLANE2_OFFSET_EXT, -+ EGL_DMA_BUF_PLANE2_PITCH_EXT, -+ EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT, -+ EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT, -+ }; -+ const EGLint * b = anames; -+ -+ *a++ = EGL_WIDTH; -+ *a++ = av_frame_cropped_width(frame); -+ *a++ = EGL_HEIGHT; -+ *a++ = av_frame_cropped_height(frame); -+ *a++ = EGL_LINUX_DRM_FOURCC_EXT; -+ *a++ = desc->layers[0].format; -+ -+ for (i = 0; i < desc->nb_layers; ++i) { -+ for (j = 0; j < desc->layers[i].nb_planes; ++j) { -+ const AVDRMPlaneDescriptor * const p = desc->layers[i].planes + j; -+ const AVDRMObjectDescriptor * const obj = desc->objects + p->object_index; -+ *a++ = *b++; -+ *a++ = obj->fd; -+ *a++ = *b++; -+ *a++ = p->offset; -+ *a++ = *b++; -+ *a++ = p->pitch; -+ if (obj->format_modifier == 0) { -+ b += 2; -+ } -+ else { -+ *a++ = *b++; -+ *a++ = (EGLint)(obj->format_modifier & 0xFFFFFFFF); -+ *a++ = *b++; -+ *a++ = (EGLint)(obj->format_modifier >> 32); -+ } -+ } -+ } -+ -+ *a = EGL_NONE; -+ -+#if TRACE_ALL -+ for (a = attribs, i = 0; *a != EGL_NONE; a += 2, ++i) { -+ av_log(s, AV_LOG_INFO, "[%2d] %4x: %d\n", i, a[0], a[1]); -+ } -+#endif -+ { -+ const EGLImage image = eglCreateImageKHR(de->setup.egl_dpy, -+ EGL_NO_CONTEXT, -+ EGL_LINUX_DMA_BUF_EXT, -+ NULL, attribs); -+ if (!image) { -+ av_log(s, AV_LOG_ERROR, "Failed to import fd %d\n", desc->objects[0].fd); -+ return -1; -+ } -+ -+ glGenTextures(1, &da->texture); -+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, da->texture); -+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -+ glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, image); -+ -+ eglDestroyImageKHR(de->setup.egl_dpy, image); -+ } -+ -+ da->fd = desc->objects[0].fd; -+ -+#if 0 -+ av_log(s, AV_LOG_INFO, "%dx%d, fmt: %x, boh=%d,%d,%d,%d, pitch=%d,%d,%d,%d," -+ " offset=%d,%d,%d,%d, mod=%llx,%llx,%llx,%llx\n", -+ av_frame_cropped_width(frame), -+ av_frame_cropped_height(frame), -+ desc->layers[0].format, -+ bo_plane_handles[0], -+ bo_plane_handles[1], -+ bo_plane_handles[2], -+ bo_plane_handles[3], -+ pitches[0], -+ pitches[1], -+ pitches[2], -+ pitches[3], -+ offsets[0], -+ offsets[1], -+ offsets[2], -+ offsets[3], -+ (long long)modifiers[0], -+ (long long)modifiers[1], -+ (long long)modifiers[2], -+ (long long)modifiers[3] -+ ); -+#endif -+ } -+ -+ glClearColor(0.5, 0.5, 0.5, 0.5); -+ glClear(GL_COLOR_BUFFER_BIT); -+ -+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, da->texture); -+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4); -+ eglSwapBuffers(de->setup.egl_dpy, de->setup.surf); -+ -+ glDeleteTextures(1, &da->texture); -+ da->texture = 0; -+ da->fd = -1; -+ -+ return 0; -+} -+ -+static void * display_thread(void * v) -+{ -+ AVFormatContext * const s = v; -+ egl_display_env_t * const de = s->priv_data; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "<<< %s\n", __func__); -+#endif -+ { -+ EGLint egl_major, egl_minor; -+ -+ de->setup.dpy = XOpenDisplay(NULL); -+ if (!de->setup.dpy) { -+ av_log(s, AV_LOG_ERROR, "Couldn't open X display\n"); -+ goto fail; -+ } -+ -+ de->setup.egl_dpy = eglGetDisplay(de->setup.dpy); -+ if (!de->setup.egl_dpy) { -+ av_log(s, AV_LOG_ERROR, "eglGetDisplay() failed\n"); -+ goto fail; -+ } -+ -+ if (!eglInitialize(de->setup.egl_dpy, &egl_major, &egl_minor)) { -+ av_log(s, AV_LOG_ERROR, "Error: eglInitialize() failed\n"); -+ goto fail; -+ } -+ -+ av_log(s, AV_LOG_INFO, "EGL version %d.%d\n", egl_major, egl_minor); -+ -+ if (!epoxy_has_egl_extension(de->setup.egl_dpy, "EGL_KHR_image_base")) { -+ av_log(s, AV_LOG_ERROR, "Missing EGL KHR image extension\n"); -+ goto fail; -+ } -+ } -+ -+ if (!de->window_width || !de->window_height) { -+ de->window_width = 1280; -+ de->window_height = 720; -+ } -+ if (make_window(s, de, de->setup.dpy, de->setup.egl_dpy, "ffmpeg-vout", -+ &de->setup.win, &de->setup.ctx, &de->setup.surf)) { -+ av_log(s, AV_LOG_ERROR, "%s: make_window failed\n", __func__); -+ goto fail; -+ } -+ -+ if (gl_setup(s)) { -+ av_log(s, AV_LOG_ERROR, "%s: gl_setup failed\n", __func__); -+ goto fail; -+ } -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "--- %s: Start done\n", __func__); -+#endif -+ sem_post(&de->display_start_sem); -+ -+ for (;;) { -+ AVFrame * frame; -+ -+ while (sem_wait(&de->q_sem) != 0) { -+ av_assert0(errno == EINTR); -+ } -+ -+ if (de->q_terminate) -+ break; -+ -+ pthread_mutex_lock(&de->q_lock); -+ frame = de->q_next; -+ de->q_next = NULL; -+ pthread_mutex_unlock(&de->q_lock); -+ -+ do_display(s, de, frame); -+ -+ av_frame_free(&de->q_this); -+ de->q_this = frame; -+ } -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, ">>> %s\n", __func__); -+#endif -+ -+ return NULL; -+ -+fail: -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, ">>> %s: FAIL\n", __func__); -+#endif -+ de->q_terminate = 1; -+ sem_post(&de->display_start_sem); -+ -+ return NULL; -+} -+ -+static int egl_vout_write_packet(AVFormatContext *s, AVPacket *pkt) -+{ -+ const AVFrame * const src_frame = (AVFrame *)pkt->data; -+ AVFrame * frame; -+ egl_display_env_t * const de = s->priv_data; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s\n", __func__); -+#endif -+ -+ if (src_frame->format == AV_PIX_FMT_DRM_PRIME) { -+ frame = av_frame_alloc(); -+ av_frame_ref(frame, src_frame); -+ } -+ else if (src_frame->format == AV_PIX_FMT_VAAPI) { -+ frame = av_frame_alloc(); -+ frame->format = AV_PIX_FMT_DRM_PRIME; -+ if (av_hwframe_map(frame, src_frame, 0) != 0) -+ { -+ av_log(s, AV_LOG_WARNING, "Failed to map frame (format=%d) to DRM_PRiME\n", src_frame->format); -+ av_frame_free(&frame); -+ return AVERROR(EINVAL); -+ } -+ } -+ else { -+ av_log(s, AV_LOG_WARNING, "Frame (format=%d) not DRM_PRiME\n", src_frame->format); -+ return AVERROR(EINVAL); -+ } -+ -+ // Really hacky sync -+ while (de->show_all && de->q_next) { -+ usleep(3000); -+ } -+ -+ pthread_mutex_lock(&de->q_lock); -+ { -+ AVFrame * const t = de->q_next; -+ de->q_next = frame; -+ frame = t; -+ } -+ pthread_mutex_unlock(&de->q_lock); -+ -+ if (frame == NULL) -+ sem_post(&de->q_sem); -+ else -+ av_frame_free(&frame); -+ -+ return 0; -+} -+ -+static int egl_vout_write_frame(AVFormatContext *s, int stream_index, AVFrame **ppframe, -+ unsigned flags) -+{ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s: idx=%d, flags=%#x\n", __func__, stream_index, flags); -+#endif -+ -+ /* egl_vout_write_header() should have accepted only supported formats */ -+ if ((flags & AV_WRITE_UNCODED_FRAME_QUERY)) -+ return 0; -+ -+ return 0; -+} -+ -+static int egl_vout_control_message(AVFormatContext *s, int type, void *data, size_t data_size) -+{ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s: %d\n", __func__, type); -+#endif -+ switch(type) { -+ case AV_APP_TO_DEV_WINDOW_REPAINT: -+ return 0; -+ default: -+ break; -+ } -+ return AVERROR(ENOSYS); -+} -+ -+// deinit is called if init fails so no need to clean up explicity here -+static int egl_vout_init(struct AVFormatContext * s) -+{ -+ egl_display_env_t * const de = s->priv_data; -+ unsigned int i; -+ -+ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); -+ -+ de->setup = (struct egl_setup){0}; -+ -+ for (i = 0; i != 32; ++i) { -+ de->aux[i].fd = -1; -+ } -+ -+ de->q_terminate = 0; -+ pthread_mutex_init(&de->q_lock, NULL); -+ sem_init(&de->q_sem, 0, 0); -+ sem_init(&de->display_start_sem, 0, 0); -+ av_assert0(pthread_create(&de->q_thread, NULL, display_thread, s) == 0); -+ -+ sem_wait(&de->display_start_sem); -+ if (de->q_terminate) { -+ av_log(s, AV_LOG_ERROR, "%s: Display startup failure\n", __func__); -+ return -1; -+ } -+ -+ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); -+ -+ return 0; -+} -+ -+static void egl_vout_deinit(struct AVFormatContext * s) -+{ -+ egl_display_env_t * const de = s->priv_data; -+ -+ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); -+ -+ de->q_terminate = 1; -+ sem_post(&de->q_sem); -+ pthread_join(de->q_thread, NULL); -+ sem_destroy(&de->q_sem); -+ pthread_mutex_destroy(&de->q_lock); -+ -+ av_frame_free(&de->q_next); -+ av_frame_free(&de->q_this); -+ -+ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); -+} -+ -+#define OFFSET(x) offsetof(egl_display_env_t, x) -+static const AVOption options[] = { -+ { "show_all", "show all frames", OFFSET(show_all), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "window_size", "set window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "window_x", "set window x offset", OFFSET(window_x), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "window_y", "set window y offset", OFFSET(window_y), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "fullscreen", "set fullscreen display", OFFSET(fullscreen), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, -+ { NULL } -+ -+}; -+ -+static const AVClass egl_vout_class = { -+ .class_name = "egl vid outdev", -+ .item_name = av_default_item_name, -+ .option = options, -+ .version = LIBAVUTIL_VERSION_INT, -+ .category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, -+}; -+ -+AVOutputFormat ff_vout_egl_muxer = { -+ .name = "vout_egl", -+ .long_name = NULL_IF_CONFIG_SMALL("Egl video output device"), -+ .priv_data_size = sizeof(egl_display_env_t), -+ .audio_codec = AV_CODEC_ID_NONE, -+ .video_codec = AV_CODEC_ID_WRAPPED_AVFRAME, -+ .write_header = egl_vout_write_header, -+ .write_packet = egl_vout_write_packet, -+ .write_uncoded_frame = egl_vout_write_frame, -+ .write_trailer = egl_vout_write_trailer, -+ .control_message = egl_vout_control_message, -+ .flags = AVFMT_NOFILE | AVFMT_VARIABLE_FPS | AVFMT_NOTIMESTAMPS, -+ .priv_class = &egl_vout_class, -+ .init = egl_vout_init, -+ .deinit = egl_vout_deinit, -+}; -+ ---- /dev/null -+++ b/libavdevice/rpi_vout.c -@@ -0,0 +1,534 @@ -+/* -+ * Copyright (c) 2013 Jeff Moguillansky -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+/** -+ * @file -+ * XVideo output device -+ * -+ * TODO: -+ * - add support to more formats -+ */ -+ -+#include "libavutil/opt.h" -+#include "libavutil/avassert.h" -+#include "libavutil/pixdesc.h" -+#include "libavutil/imgutils.h" -+#include "libavformat/internal.h" -+#include "avdevice.h" -+ -+#include -+#include -+ -+#pragma GCC diagnostic push -+// Many many redundant decls in the header files -+#pragma GCC diagnostic ignored "-Wredundant-decls" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#pragma GCC diagnostic pop -+#include "libavutil/rpi_sand_fns.h" -+#include "libavcodec/rpi_zc.h" -+ -+#define TRACE_ALL 0 -+ -+#define DISPLAY_PORT_DEPTH 4 -+ -+typedef struct rpi_display_env_s -+{ -+ AVClass *class; -+ -+ MMAL_COMPONENT_T* display; -+ MMAL_COMPONENT_T* isp; -+ MMAL_PORT_T * port_in; // Input port of either isp or display depending on pipe setup -+ MMAL_CONNECTION_T * conn; -+ -+ MMAL_POOL_T *rpi_pool; -+ volatile int rpi_display_count; -+ -+ MMAL_FOURCC_T req_fmt; -+ MMAL_VIDEO_FORMAT_T req_vfmt; -+ -+ AVZcEnvPtr zc; -+ -+ int window_width, window_height; -+ int window_x, window_y; -+ int layer, fullscreen; -+ int show_all; -+} rpi_display_env_t; -+ -+ -+static void display_cb_input(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { -+ mmal_buffer_header_release(buffer); -+} -+ -+static void display_cb_control(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { -+ mmal_buffer_header_release(buffer); -+} -+ -+ -+static MMAL_FOURCC_T mmfmt_from_avfmt(const enum AVPixelFormat fmt) -+{ -+ switch (fmt) { -+ case AV_PIX_FMT_SAND128: -+ case AV_PIX_FMT_RPI4_8: -+ return MMAL_ENCODING_YUVUV128; -+ case AV_PIX_FMT_RPI4_10: -+ return MMAL_ENCODING_YUV10_COL; -+ case AV_PIX_FMT_SAND64_10: -+ return MMAL_ENCODING_YUVUV64_10; -+ case AV_PIX_FMT_SAND64_16: -+ return MMAL_ENCODING_YUVUV64_16; -+ case AV_PIX_FMT_YUV420P: -+ return MMAL_ENCODING_I420; -+ -+ default: -+ break; -+ } -+ return 0; -+} -+ -+ -+static void video_format_from_zc_frame(MMAL_ES_FORMAT_T* const es_fmt, -+ const AVFrame * const frame, const AVRpiZcRefPtr fr_ref) -+{ -+ MMAL_VIDEO_FORMAT_T *const vfmt = &es_fmt->es->video; -+ const AVRpiZcFrameGeometry * geo = av_rpi_zc_geometry(fr_ref); -+ if (av_rpi_is_sand_format(geo->format)) { -+ // Sand formats are a bit "special" -+ // stride1 implicit in format -+ // width = stride2 -+ vfmt->width = geo->stripe_is_yc ? -+ geo->height_y + geo->height_c : geo->height_y; -+// es->height = geo->video_height; //*** When we get the FLAG this will change -+ vfmt->height = geo->height_y; -+ es_fmt->flags = MMAL_ES_FORMAT_FLAG_COL_FMTS_WIDTH_IS_COL_STRIDE; -+ } -+ else { -+ vfmt->width = geo->stride_y / geo->bytes_per_pel; -+ vfmt->height = geo->height_y; -+ es_fmt->flags = 0; -+ } -+ -+ es_fmt->type = MMAL_ES_TYPE_VIDEO; -+ es_fmt->encoding = mmfmt_from_avfmt(geo->format); -+ es_fmt->encoding_variant = 0; -+ es_fmt->bitrate = 0; -+ -+ vfmt->crop.x = frame->crop_left; -+ vfmt->crop.y = frame->crop_top; -+ vfmt->crop.width = av_frame_cropped_width(frame); -+ vfmt->crop.height = av_frame_cropped_height(frame); -+ -+ vfmt->frame_rate.den = 0; // Don't think I know it here -+ vfmt->frame_rate.num = 0; -+ -+ vfmt->par.den = frame->sample_aspect_ratio.den; -+ vfmt->par.num = frame->sample_aspect_ratio.num; -+ -+ vfmt->color_space = 0; // Unknown currently -+} -+ -+static MMAL_BOOL_T buf_release_cb(MMAL_BUFFER_HEADER_T * buf, void *userdata) -+{ -+ rpi_display_env_t * const de = userdata; -+ if (buf->user_data != NULL) { -+ av_rpi_zc_unref((AVRpiZcRefPtr)buf->user_data); -+ buf->user_data = NULL; -+ } -+ atomic_fetch_add(&de->rpi_display_count, -1); -+ return MMAL_FALSE; -+} -+ -+static inline int avfmt_needs_isp(const enum AVPixelFormat avfmt) -+{ -+ return avfmt == AV_PIX_FMT_SAND64_10; -+} -+ -+static void isp_remove(AVFormatContext * const s, rpi_display_env_t * const de) -+{ -+ if (de->isp != NULL) -+ { -+ if (de->isp->input[0]->is_enabled) -+ mmal_port_disable(de->isp->input[0]); -+ if (de->isp->control->is_enabled) -+ mmal_port_disable(de->isp->control); -+ } -+ if (de->conn != NULL) { -+ mmal_connection_destroy(de->conn); -+ de->conn = NULL; -+ } -+ if (de->isp != NULL) { -+ mmal_component_destroy(de->isp); -+ de->isp = NULL; -+ } -+} -+ -+static void display_frame(AVFormatContext * const s, rpi_display_env_t * const de, const AVFrame* const fr) -+{ -+ MMAL_BUFFER_HEADER_T* buf = NULL; -+ AVRpiZcRefPtr fr_buf = NULL; -+ -+ if (de == NULL) -+ return; -+ -+ if (atomic_load(&de->rpi_display_count) >= DISPLAY_PORT_DEPTH - 1) { -+ av_log(s, AV_LOG_VERBOSE, "Frame dropped\n"); -+ return; -+ } -+ -+ if ((fr_buf = av_rpi_zc_ref(s, de->zc, fr, fr->format, 1)) == NULL) { -+ return; -+ } -+ -+ buf = mmal_queue_get(de->rpi_pool->queue); -+ if (!buf) { -+ // Running too fast so drop the frame (unexpected) -+ goto fail; -+ } -+ -+ buf->cmd = 0; -+ buf->offset = 0; -+ buf->flags = 0; -+ mmal_buffer_header_reset(buf); -+ -+ atomic_fetch_add(&de->rpi_display_count, 1); // Deced on release -+ mmal_buffer_header_pre_release_cb_set(buf, buf_release_cb, de); -+ -+ buf->user_data = fr_buf; -+ buf->data = (uint8_t *)av_rpi_zc_vc_handle(fr_buf); // Cast our handle to a pointer for mmal -+ buf->offset = av_rpi_zc_offset(fr_buf); -+ buf->length = av_rpi_zc_length(fr_buf); -+ buf->alloc_size = av_rpi_zc_numbytes(fr_buf); -+ -+ while (de->show_all && atomic_load(&de->rpi_display_count) >= DISPLAY_PORT_DEPTH - 1) { -+ usleep(5000); -+ } -+ -+ { -+ MMAL_ES_SPECIFIC_FORMAT_T new_ess = {.video = {0}}; -+ MMAL_ES_FORMAT_T new_es = {.es = &new_ess}; -+ MMAL_VIDEO_FORMAT_T * const new_vfmt = &new_ess.video; -+ -+ video_format_from_zc_frame(&new_es, fr, fr_buf); -+ if (de->req_fmt != new_es.encoding || -+ de->req_vfmt.width != new_vfmt->width || -+ de->req_vfmt.height != new_vfmt->height || -+ de->req_vfmt.crop.x != new_vfmt->crop.x || -+ de->req_vfmt.crop.y != new_vfmt->crop.y || -+ de->req_vfmt.crop.width != new_vfmt->crop.width || -+ de->req_vfmt.crop.height != new_vfmt->crop.height) { -+ // Something has changed -+ -+ // If we have an ISP tear it down -+ isp_remove(s, de); -+ de->port_in = de->display->input[0]; -+ -+ // If we still need an ISP create it now -+ if (avfmt_needs_isp(fr->format)) -+ { -+ if (mmal_component_create("vc.ril.isp", &de->isp) != MMAL_SUCCESS) -+ { -+ av_log(s, AV_LOG_ERROR, "ISP creation failed\n"); -+ goto fail; -+ } -+ de->port_in = de->isp->input[0]; -+ } -+ -+ mmal_format_copy(de->port_in->format, &new_es); -+ -+ if (mmal_port_format_commit(de->port_in)) { -+ av_log(s, AV_LOG_ERROR, "Failed to commit input format\n"); -+ goto fail; -+ } -+ -+ // If we have an ISP then we must want to use it -+ if (de->isp != NULL) { -+ MMAL_PORT_T * const port_out = de->isp->output[0]; -+ MMAL_VIDEO_FORMAT_T* vfmt_in = &de->port_in->format->es->video; -+ MMAL_VIDEO_FORMAT_T* vfmt_out = &port_out->format->es->video; -+ -+ port_out->format->type = MMAL_ES_TYPE_VIDEO; -+ port_out->format->encoding = MMAL_ENCODING_YUVUV128; -+ port_out->format->encoding_variant = 0; -+ port_out->format->bitrate = 0; -+ port_out->format->flags = 0; -+ port_out->format->extradata = NULL; -+ port_out->format->extradata_size = 0; -+ -+ vfmt_out->width = (vfmt_in->crop.width + 31) & ~31; -+ vfmt_out->height = (vfmt_in->crop.height + 15) & ~15; -+ vfmt_out->crop.x = 0; -+ vfmt_out->crop.y = 0; -+ vfmt_out->crop.width = vfmt_in->crop.width; -+ vfmt_out->crop.height = vfmt_in->crop.height; -+ vfmt_out->frame_rate = vfmt_in->frame_rate; -+ vfmt_out->par = vfmt_in->par; -+ vfmt_out->color_space = vfmt_in->color_space; -+ -+ if (mmal_port_format_commit(port_out)) { -+ av_log(s, AV_LOG_ERROR, "Failed to commit output format\n"); -+ goto fail; -+ } -+ -+ if (mmal_connection_create(&de->conn, port_out, de->display->input[0], MMAL_CONNECTION_FLAG_TUNNELLING) != MMAL_SUCCESS) { -+ av_log(s, AV_LOG_ERROR, "Failed to create connection\n"); -+ goto fail; -+ } -+ if (mmal_connection_enable(de->conn) != MMAL_SUCCESS) { -+ av_log(s, AV_LOG_ERROR, "Failed to enable connection\n"); -+ goto fail; -+ } -+ mmal_port_enable(de->isp->control,display_cb_control); -+ mmal_component_enable(de->isp); -+ } -+ -+ // Number of slots in my port Q -+ de->port_in->buffer_num = DISPLAY_PORT_DEPTH; -+ // Size to keep it happy - isn't used for anything other than error checking -+ de->port_in->buffer_size = buf->alloc_size; -+ if (!de->port_in->is_enabled) -+ { -+ mmal_port_parameter_set_boolean(de->port_in, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); // Does this mark that the buffer contains a vc_handle? Would have expected a vc_image? -+ if (mmal_port_enable(de->port_in, display_cb_input) != MMAL_SUCCESS) { -+ av_log(s, AV_LOG_ERROR, "Failed to enable input port\n"); -+ goto fail; -+ } -+ } -+ -+ de->req_fmt = new_es.encoding; -+ de->req_vfmt = *new_vfmt; -+ } -+ } -+ -+ if (mmal_port_send_buffer(de->port_in, buf) != MMAL_SUCCESS) -+ { -+ av_log(s, AV_LOG_ERROR, "mmal_port_send_buffer failed: depth=%d\n", de->rpi_display_count); -+ goto fail; -+ } -+ return; -+ -+fail: -+ // If we have a buf then fr_buf is held by that -+ if (buf != NULL) -+ mmal_buffer_header_release(buf); -+ else if (fr_buf != NULL) -+ av_rpi_zc_unref(fr_buf); -+} -+ -+ -+static int xv_write_trailer(AVFormatContext *s) -+{ -+ rpi_display_env_t * const de = s->priv_data; -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s\n", __func__); -+#endif -+ if (de->port_in != NULL && de->port_in->is_enabled) { -+ mmal_port_disable(de->port_in); -+ } -+ -+ // The above disable should kick out all buffers - check that -+ if (atomic_load(&de->rpi_display_count) != 0) { -+ av_log(s, AV_LOG_WARNING, "Exiting with display count non-zero:%d\n", atomic_load(&de->rpi_display_count)); -+ } -+ -+ isp_remove(s, de); -+ if (de->rpi_pool != NULL) { -+ mmal_pool_destroy(de->rpi_pool); -+ de->rpi_pool = NULL; -+ } -+ if (de->display != NULL) { -+ mmal_component_destroy(de->display); -+ de->display = NULL; -+ } -+ -+ return 0; -+} -+ -+static int xv_write_header(AVFormatContext *s) -+{ -+ rpi_display_env_t * const de = s->priv_data; -+ const AVCodecParameters * const par = s->streams[0]->codecpar; -+ const unsigned int w = de->window_width ? de->window_width : par->width; -+ const unsigned int h = de->window_height ? de->window_height : par->height; -+ const unsigned int x = de->window_x; -+ const unsigned int y = de->window_y; -+ const int layer = de->layer ? de->layer : 2; -+ const MMAL_BOOL_T fullscreen = de->fullscreen; -+ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s: %dx%d\n", __func__, w, h); -+#endif -+ if ( s->nb_streams > 1 -+ || par->codec_type != AVMEDIA_TYPE_VIDEO -+ || par->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME) { -+ av_log(s, AV_LOG_ERROR, "Only supports one wrapped avframe stream\n"); -+ return AVERROR(EINVAL); -+ } -+ -+ { -+ MMAL_DISPLAYREGION_T region = -+ { -+ .hdr = {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, -+ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | -+ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_ALPHA, -+ .layer = layer, -+ .fullscreen = fullscreen, -+ .dest_rect = {x, y, w, h}, -+ .alpha = !fullscreen ? 0xff : 0xff | MMAL_DISPLAY_ALPHA_FLAGS_DISCARD_LOWER_LAYERS, -+ }; -+ -+ bcm_host_init(); // Needs to be done by someone... -+ -+ if (mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &de->display) != MMAL_SUCCESS) -+ { -+ av_log(s, AV_LOG_ERROR, "Failed to create display component\n"); -+ goto fail; -+ } -+ de->port_in = de->display->input[0]; -+ -+ mmal_port_parameter_set(de->display->input[0], ®ion.hdr); -+ -+ if (mmal_component_enable(de->display) != MMAL_SUCCESS) -+ { -+ av_log(s, AV_LOG_ERROR, "Failed to enable display component\n"); -+ goto fail; -+ } -+ if (mmal_port_enable(de->display->control,display_cb_control) != MMAL_SUCCESS) -+ { -+ av_log(s, AV_LOG_ERROR, "Failed to enable display control port\n"); -+ goto fail; -+ } -+ -+ if ((de->rpi_pool = mmal_pool_create(DISPLAY_PORT_DEPTH, 0)) == NULL) -+ { -+ av_log(s, AV_LOG_ERROR, "Failed to create pool\n"); -+ goto fail; -+ } -+ } -+ -+ return 0; -+ -+fail: -+ xv_write_trailer(s); -+ return AVERROR_UNKNOWN; -+} -+ -+static int xv_write_packet(AVFormatContext *s, AVPacket *pkt) -+{ -+ AVFrame * const frame = (AVFrame *)pkt->data; -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s\n", __func__); -+#endif -+ display_frame(s, s->priv_data, frame); -+ return 0; -+} -+ -+static int xv_write_frame(AVFormatContext *s, int stream_index, AVFrame **ppframe, -+ unsigned flags) -+{ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s: idx=%d, flags=%#x\n", __func__, stream_index, flags); -+#endif -+ -+ /* xv_write_header() should have accepted only supported formats */ -+ if ((flags & AV_WRITE_UNCODED_FRAME_QUERY)) -+ return 0; -+// return write_picture(s, (*frame)->data, (*frame)->linesize); -+ -+ display_frame(s, s->priv_data, *ppframe); -+ return 0; -+} -+ -+static int xv_control_message(AVFormatContext *s, int type, void *data, size_t data_size) -+{ -+#if TRACE_ALL -+ av_log(s, AV_LOG_INFO, "%s: %d\n", __func__, type); -+#endif -+ switch(type) { -+ case AV_APP_TO_DEV_WINDOW_REPAINT: -+ return 0; -+ default: -+ break; -+ } -+ return AVERROR(ENOSYS); -+} -+ -+// deinit is called if init fails so no need to clean up explicity here -+static int rpi_vout_init(struct AVFormatContext * s) -+{ -+ rpi_display_env_t * const de = s->priv_data; -+ -+ // Get a ZC context in case we need one - has little overhead if unused -+ if ((de->zc = av_rpi_zc_int_env_alloc(s)) == NULL) -+ return 1; -+ -+ return 0; -+} -+ -+static void rpi_vout_deinit(struct AVFormatContext * s) -+{ -+ rpi_display_env_t * const de = s->priv_data; -+ -+ av_rpi_zc_int_env_freep(&de->zc); -+} -+ -+ -+#define OFFSET(x) offsetof(rpi_display_env_t, x) -+static const AVOption options[] = { -+ { "show_all", "show all frames", OFFSET(show_all), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "window_size", "set window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "window_x", "set window x offset", OFFSET(window_x), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "window_y", "set window y offset", OFFSET(window_y), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "display_layer","set display layer", OFFSET(layer), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, -+ { "fullscreen", "set fullscreen display", OFFSET(fullscreen), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, -+ { NULL } -+ -+}; -+ -+static const AVClass xv_class = { -+ .class_name = "rpi vid outdev", -+ .item_name = av_default_item_name, -+ .option = options, -+ .version = LIBAVUTIL_VERSION_INT, -+ .category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, -+}; -+ -+AVOutputFormat ff_vout_rpi_muxer = { -+ .name = "vout_rpi", -+ .long_name = NULL_IF_CONFIG_SMALL("Rpi (mmal) video output device"), -+ .priv_data_size = sizeof(rpi_display_env_t), -+ .audio_codec = AV_CODEC_ID_NONE, -+ .video_codec = AV_CODEC_ID_WRAPPED_AVFRAME, -+ .write_header = xv_write_header, -+ .write_packet = xv_write_packet, -+ .write_uncoded_frame = xv_write_frame, -+ .write_trailer = xv_write_trailer, -+ .control_message = xv_control_message, -+ .flags = AVFMT_NOFILE | AVFMT_VARIABLE_FPS | AVFMT_NOTIMESTAMPS, -+ .priv_class = &xv_class, -+ .init = rpi_vout_init, -+ .deinit = rpi_vout_deinit, -+}; ---- a/libavfilter/Makefile -+++ b/libavfilter/Makefile -@@ -434,6 +434,7 @@ OBJS-$(CONFIG_TRANSPOSE_OPENCL_FILTER) - OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER) += vf_transpose_vaapi.o vaapi_vpp.o - OBJS-$(CONFIG_TRIM_FILTER) += trim.o - OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += vf_premultiply.o framesync.o -+OBJS-$(CONFIG_UNSAND_FILTER) += vf_unsand.o - OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o - OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) += vf_unsharp_opencl.o opencl.o \ - opencl/unsharp.o ---- a/libavfilter/allfilters.c -+++ b/libavfilter/allfilters.c -@@ -414,6 +414,7 @@ extern AVFilter ff_vf_transpose_opencl; - extern AVFilter ff_vf_transpose_vaapi; - extern AVFilter ff_vf_trim; - extern AVFilter ff_vf_unpremultiply; -+extern AVFilter ff_vf_unsand; - extern AVFilter ff_vf_unsharp; - extern AVFilter ff_vf_unsharp_opencl; - extern AVFilter ff_vf_untile; ---- a/libavfilter/avfiltergraph.c -+++ b/libavfilter/avfiltergraph.c -@@ -32,6 +32,9 @@ - #include "libavutil/internal.h" - #include "libavutil/opt.h" - #include "libavutil/pixdesc.h" -+#if CONFIG_UNSAND_FILTER -+#include "libavutil/rpi_sand_fns.h" -+#endif - - #define FF_INTERNAL_FIELDS 1 - #include "framequeue.h" -@@ -427,6 +430,19 @@ static int can_merge_formats(AVFilterFor - } - } - -+#if CONFIG_UNSAND_FILTER -+static int has_sand_format(const AVFilterFormats * const ff) -+{ -+ int i; -+ for (i = 0; i != ff->nb_formats; ++i) { -+ if (av_rpi_is_sand_format(ff->formats[i])) { -+ return 1; -+ } -+ } -+ return 0; -+} -+#endif -+ - /** - * Perform one round of query_formats() and merging formats lists on the - * filter graph. -@@ -467,6 +483,7 @@ static int query_formats(AVFilterGraph * - for (j = 0; j < filter->nb_inputs; j++) { - AVFilterLink *link = filter->inputs[j]; - int convert_needed = 0; -+ unsigned int extra_convert_tried = 0; - - if (!link) - continue; -@@ -514,11 +531,14 @@ static int query_formats(AVFilterGraph * - ) - #undef MERGE_DISPATCH - -- if (convert_needed) { -+ while (convert_needed) { - AVFilterContext *convert; - const AVFilter *filter; - AVFilterLink *inlink, *outlink; - char inst_name[30]; -+ int can_retry = 0; -+ -+ convert_needed = 0; - - if (graph->disable_auto_convert) { - av_log(log_ctx, AV_LOG_ERROR, -@@ -531,19 +551,45 @@ static int query_formats(AVFilterGraph * - /* couldn't merge format lists. auto-insert conversion filter */ - switch (link->type) { - case AVMEDIA_TYPE_VIDEO: -- if (!(filter = avfilter_get_by_name("scale"))) { -- av_log(log_ctx, AV_LOG_ERROR, "'scale' filter " -- "not present, cannot convert pixel formats.\n"); -- return AVERROR(EINVAL); -- } -- -- snprintf(inst_name, sizeof(inst_name), "auto_scaler_%d", -- scaler_count++); -+#if CONFIG_UNSAND_FILTER -+ // Only try each extra conversion once -+ // The unsand output pad should never trigger has_sand_format -+ // but it is better to be safe -+ if ((extra_convert_tried & 1) == 0 && has_sand_format(link->in_formats)) { -+ if (!(filter = avfilter_get_by_name("unsand"))) { -+ av_log(log_ctx, AV_LOG_ERROR, "'unsand' filter " -+ "not present, cannot convert pixel formats.\n"); -+ return AVERROR(EINVAL); -+ } -+ -+ snprintf(inst_name, sizeof(inst_name), "auto_unsand_%d", -+ scaler_count++); -+ -+ if ((ret = avfilter_graph_create_filter(&convert, filter, -+ inst_name, "", NULL, -+ graph)) < 0) -+ return ret; - -- if ((ret = avfilter_graph_create_filter(&convert, filter, -- inst_name, graph->scale_sws_opts, NULL, -- graph)) < 0) -- return ret; -+ extra_convert_tried |= 1; -+ can_retry = 1; -+ } -+ else -+#endif -+ { -+ if (!(filter = avfilter_get_by_name("scale"))) { -+ av_log(log_ctx, AV_LOG_ERROR, "'scale' filter " -+ "not present, cannot convert pixel formats.\n"); -+ return AVERROR(EINVAL); -+ } -+ -+ snprintf(inst_name, sizeof(inst_name), "auto_scaler_%d", -+ scaler_count++); -+ -+ if ((ret = avfilter_graph_create_filter(&convert, filter, -+ inst_name, graph->scale_sws_opts, NULL, -+ graph)) < 0) -+ return ret; -+ } - break; - case AVMEDIA_TYPE_AUDIO: - if (!(filter = avfilter_get_by_name("aresample"))) { -@@ -585,9 +631,19 @@ static int query_formats(AVFilterGraph * - av_assert0(outlink-> in_channel_layouts->refcount > 0); - av_assert0(outlink->out_channel_layouts->refcount > 0); - } -- if (!ff_merge_formats( inlink->in_formats, inlink->out_formats, inlink->type) || -- !ff_merge_formats(outlink->in_formats, outlink->out_formats, outlink->type)) -+ // If we have added an extra filter we must merge the input -+ // side but we can have another go at the output -+ if (!ff_merge_formats( inlink->in_formats, inlink->out_formats, inlink->type)) - ret = AVERROR(ENOSYS); -+ else if (!ff_merge_formats(outlink->in_formats, outlink->out_formats, outlink->type)) -+ { -+ if (can_retry) { -+ link = outlink; -+ convert_needed = 1; -+ continue; -+ } -+ ret = AVERROR(ENOSYS); -+ } - if (inlink->type == AVMEDIA_TYPE_AUDIO && - (!ff_merge_samplerates(inlink->in_samplerates, - inlink->out_samplerates) || ---- a/libavfilter/buffersrc.c -+++ b/libavfilter/buffersrc.c -@@ -210,7 +210,7 @@ static int av_buffersrc_add_frame_intern - - switch (ctx->outputs[0]->type) { - case AVMEDIA_TYPE_VIDEO: -- CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height, -+ CHECK_VIDEO_PARAM_CHANGE(ctx, s, av_frame_cropped_width(frame), av_frame_cropped_height(frame), - frame->format, frame->pts); - break; - case AVMEDIA_TYPE_AUDIO: ---- /dev/null -+++ b/libavfilter/vf_unsand.c -@@ -0,0 +1,234 @@ -+/* -+ * Copyright (c) 2007 Bobby Bingham -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+/** -+ * @file -+ * format and noformat video filters -+ */ -+ -+#include -+ -+#include "libavutil/internal.h" -+#include "libavutil/mem.h" -+#include "libavutil/pixdesc.h" -+#include "libavutil/opt.h" -+#include "libavutil/rpi_sand_fns.h" -+ -+#include "avfilter.h" -+#include "formats.h" -+#include "internal.h" -+#include "video.h" -+ -+typedef struct UnsandContext { -+ const AVClass *class; -+} UnsandContext; -+ -+static av_cold void uninit(AVFilterContext *ctx) -+{ -+// UnsandContext *s = ctx->priv; -+} -+ -+static av_cold int init(AVFilterContext *ctx) -+{ -+// UnsandContext *s = ctx->priv; -+ -+ return 0; -+} -+ -+ -+static int filter_frame(AVFilterLink *link, AVFrame *in) -+{ -+ AVFilterLink * const outlink = link->dst->outputs[0]; -+ AVFrame *out = NULL; -+ int rv = 0; -+ -+ if (outlink->format == in->format) { -+ // If nothing to do then do nothing -+ out = in; -+ } -+ else -+ { -+ if ((out = ff_get_video_buffer(outlink, av_frame_cropped_width(in), av_frame_cropped_height(in))) == NULL) -+ { -+ rv = AVERROR(ENOMEM); -+ goto fail; -+ } -+ if (av_rpi_sand_to_planar_frame(out, in) != 0) -+ { -+ rv = -1; -+ goto fail; -+ } -+ -+ av_frame_free(&in); -+ } -+ -+ return ff_filter_frame(outlink, out); -+ -+fail: -+ av_frame_free(&out); -+ av_frame_free(&in); -+ return rv; -+} -+ -+#if 0 -+static void dump_fmts(const AVFilterFormats * fmts) -+{ -+ int i; -+ if (fmts== NULL) { -+ printf("NULL\n"); -+ return; -+ } -+ for (i = 0; i < fmts->nb_formats; ++i) { -+ printf(" %d", fmts->formats[i]); -+ } -+ printf("\n"); -+} -+#endif -+ -+static int query_formats(AVFilterContext *ctx) -+{ -+// UnsandContext *s = ctx->priv; -+ int ret; -+ -+ // If we aren't connected at both ends then just do nothing -+ if (ctx->inputs[0] == NULL || ctx->outputs[0] == NULL) -+ return 0; -+ -+// printf("Unsand: %s in: ", __func__); -+// dump_fmts(ctx->inputs[0]->in_formats); -+// printf("Unsand: %s out: ", __func__); -+// dump_fmts(ctx->outputs[0]->out_formats); -+ -+ // Our output formats depend on our input formats and we can't/don't -+ // want to convert between bit depths so we need to wait for the source -+ // to have an opinion before we do -+ if (ctx->inputs[0]->in_formats == NULL) -+ return AVERROR(EAGAIN); -+ -+ // Accept anything -+ if (ctx->inputs[0]->out_formats == NULL && -+ (ret = ff_formats_ref(ctx->inputs[0]->in_formats, &ctx->inputs[0]->out_formats)) < 0) -+ return ret; -+ -+ // Filter out sand formats -+ -+ // Generate a container if we don't already have one -+ if (ctx->outputs[0]->in_formats == NULL) -+ { -+ // Somewhat rubbish way of ensuring we have a good structure -+ const static enum AVPixelFormat out_fmts[] = {AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE}; -+ AVFilterFormats *formats = ff_make_format_list(out_fmts); -+ -+ if (formats == NULL) -+ return AVERROR(ENOMEM); -+ if ((ret = ff_formats_ref(formats, &ctx->outputs[0]->in_formats)) < 0) -+ return ret; -+ } -+ -+ // Replace old format list with new filtered list derived from what our -+ // input says it can do -+ { -+ const AVFilterFormats * const src_ff = ctx->inputs[0]->out_formats; -+ AVFilterFormats * const dst_ff = ctx->outputs[0]->in_formats; -+ enum AVPixelFormat *dst_fmts = av_malloc(sizeof(enum AVPixelFormat) * src_ff->nb_formats); -+ int i; -+ int n = 0; -+ int seen_420p = 0; -+ int seen_420p10 = 0; -+ -+ for (i = 0; i < src_ff->nb_formats; ++i) { -+ const enum AVPixelFormat f = src_ff->formats[i]; -+ -+ switch (f){ -+ case AV_PIX_FMT_YUV420P: -+ case AV_PIX_FMT_SAND128: -+ case AV_PIX_FMT_RPI4_8: -+ if (!seen_420p) { -+ seen_420p = 1; -+ dst_fmts[n++] = AV_PIX_FMT_YUV420P; -+ } -+ break; -+ case AV_PIX_FMT_SAND64_10: -+ case AV_PIX_FMT_YUV420P10: -+ case AV_PIX_FMT_RPI4_10: -+ if (!seen_420p10) { -+ seen_420p10 = 1; -+ dst_fmts[n++] = AV_PIX_FMT_YUV420P10; -+ } -+ break; -+ default: -+ dst_fmts[n++] = f; -+ break; -+ } -+ } -+ -+ av_freep(&dst_ff->formats); -+ dst_ff->formats = dst_fmts; -+ dst_ff->nb_formats = n; -+ } -+ -+// printf("Unsand: %s calc: ", __func__); -+// dump_fmts(ctx->outputs[0]->in_formats); -+ -+ return 0; -+} -+ -+ -+#define OFFSET(x) offsetof(UnsandContext, x) -+static const AVOption unsand_options[] = { -+ { NULL } -+}; -+ -+ -+AVFILTER_DEFINE_CLASS(unsand); -+ -+static const AVFilterPad avfilter_vf_unsand_inputs[] = { -+ { -+ .name = "default", -+ .type = AVMEDIA_TYPE_VIDEO, -+ .filter_frame = filter_frame, -+ }, -+ { NULL } -+}; -+ -+static const AVFilterPad avfilter_vf_unsand_outputs[] = { -+ { -+ .name = "default", -+ .type = AVMEDIA_TYPE_VIDEO -+ }, -+ { NULL } -+}; -+ -+AVFilter ff_vf_unsand = { -+ .name = "unsand", -+ .description = NULL_IF_CONFIG_SMALL("Convert sand pix fmt to yuv"), -+ -+ .init = init, -+ .uninit = uninit, -+ -+ .query_formats = query_formats, -+ -+ .priv_size = sizeof(UnsandContext), -+ .priv_class = &unsand_class, -+ -+ .inputs = avfilter_vf_unsand_inputs, -+ .outputs = avfilter_vf_unsand_outputs, -+}; -+ ---- a/libavformat/utils.c -+++ b/libavformat/utils.c -@@ -3051,6 +3051,40 @@ static int has_codec_parameters(AVStream - return 1; - } - -+#if CONFIG_HEVC_RPI_DECODER && CONFIG_HEVC_DECODER -+// This should be quite general purpose but avoid possible conflicts -+// by limiting usage to cases wehere we know it works. -+static int try_fallback_decoder(AVCodecContext * const avctx, const AVCodec *const old_codec, AVDictionary ** const opts) -+{ -+ // Only try fallback if we know it is supported (HEVC only) -+ const AVCodec *const new_codec = old_codec->id != AV_CODEC_ID_HEVC ? NULL : -+ avcodec_find_decoder_by_id_and_fmt(old_codec->id, AV_PIX_FMT_NONE); -+ int err; -+ -+ // Failed to find fallback or we are already at the fallback -+ if (new_codec == NULL || new_codec == old_codec) -+ { -+ return AVERROR_DECODER_NOT_FOUND; -+ } -+ -+ // * This may be dodgy - header says to not use this fn, -+ // especially if we are going to reopen the context... -+ // (but it does seem to work for our cases) -+ if (avcodec_is_open(avctx)) { -+ avcodec_close(avctx); -+ } -+ -+ if ((err = avcodec_open2(avctx, new_codec, opts)) < 0) -+ { -+ return err; -+ } -+ -+ return 0; -+} -+#else -+#define try_fallback_decoder(avctx, old_codec, opts) (AVERROR_DECODER_NOT_FOUND) -+#endif -+ - /* returns 1 or 0 if or if not decoded data was returned, or a negative error */ - static int try_decode_frame(AVFormatContext *s, AVStream *st, - const AVPacket *avpkt, AVDictionary **options) -@@ -3085,7 +3119,11 @@ static int try_decode_frame(AVFormatCont - av_dict_set(options ? options : &thread_opt, "threads", "1", 0); - if (s->codec_whitelist) - av_dict_set(options ? options : &thread_opt, "codec_whitelist", s->codec_whitelist, 0); -- ret = avcodec_open2(avctx, codec, options ? options : &thread_opt); -+ if ((ret = avcodec_open2(avctx, codec, options ? options : &thread_opt)) == AVERROR_DECODER_NOT_FOUND) -+ { -+ // Try fallback if if looks worth a try -+ ret = try_fallback_decoder(avctx, codec, options ? options : &thread_opt); -+ } - if (!options) - av_dict_free(&thread_opt); - if (ret < 0) { -@@ -3116,6 +3154,14 @@ static int try_decode_frame(AVFormatCont - if (avctx->codec_type == AVMEDIA_TYPE_VIDEO || - avctx->codec_type == AVMEDIA_TYPE_AUDIO) { - ret = avcodec_send_packet(avctx, &pkt); -+ -+ // If we are going to want to fall back we should know here -+ if (ret == AVERROR_DECODER_NOT_FOUND) { -+ if ((ret = try_fallback_decoder(avctx, avctx->codec, options)) < 0) -+ break; -+ continue; -+ } -+ - if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) - break; - if (ret >= 0) -@@ -3726,9 +3772,20 @@ FF_ENABLE_DEPRECATION_WARNINGS - // Try to just open decoders, in case this is enough to get parameters. - if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) { - if (codec && !avctx->codec) -- if (avcodec_open2(avctx, codec, options ? &options[i] : &thread_opt) < 0) -- av_log(ic, AV_LOG_WARNING, -- "Failed to open codec in %s\n",__FUNCTION__); -+ { -+ int err; -+ -+ if ((err = avcodec_open2(avctx, codec, options ? &options[i] : &thread_opt)) < 0) -+ { -+ if (err == AVERROR_DECODER_NOT_FOUND) { -+ err = try_fallback_decoder(avctx, codec, options ? &options[i] : &thread_opt); -+ } -+ if (err < 0) { -+ av_log(ic, AV_LOG_WARNING, -+ "Failed to open codec in %s\n",__FUNCTION__); -+ } -+ } -+ } - } - if (!options) - av_dict_free(&thread_opt); ---- a/libavutil/Makefile -+++ b/libavutil/Makefile -@@ -68,6 +68,7 @@ HEADERS = adler32.h - rational.h \ - replaygain.h \ - ripemd.h \ -+ rpi_sand_fns.h \ - samplefmt.h \ - sha.h \ - sha512.h \ -@@ -86,6 +87,7 @@ HEADERS = adler32.h - tx.h \ - - HEADERS-$(CONFIG_LZO) += lzo.h -+HEADERS-$(CONFIG-RPI) += rpi_sand_fn_pw.h - - ARCH_HEADERS = bswap.h \ - intmath.h \ -@@ -180,6 +182,7 @@ OBJS-$(CONFIG_LZO) - OBJS-$(CONFIG_MEDIACODEC) += hwcontext_mediacodec.o - OBJS-$(CONFIG_OPENCL) += hwcontext_opencl.o - OBJS-$(CONFIG_QSV) += hwcontext_qsv.o -+OBJS-$(CONFIG_SAND) += rpi_sand_fns.o - OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o - OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o - OBJS-$(CONFIG_VDPAU) += hwcontext_vdpau.o ---- a/libavutil/aarch64/Makefile -+++ b/libavutil/aarch64/Makefile -@@ -1,4 +1,6 @@ - OBJS += aarch64/cpu.o \ - aarch64/float_dsp_init.o \ - --NEON-OBJS += aarch64/float_dsp_neon.o -+NEON-OBJS += aarch64/float_dsp_neon.o \ -+ aarch64/rpi_sand_neon.o \ -+ ---- /dev/null -+++ b/libavutil/aarch64/rpi_sand_neon.S -@@ -0,0 +1,676 @@ -+/* -+Copyright (c) 2021 Michael Eiler -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: Michael Eiler -+*/ -+ -+#include "asm.S" -+ -+// void ff_rpi_sand8_lines_to_planar_y8( -+// uint8_t * dest, : x0 -+// unsigned int dst_stride, : w1 -+// const uint8_t * src, : x2 -+// unsigned int src_stride1, : w3, always 128 -+// unsigned int src_stride2, : w4 -+// unsigned int _x, : w5 -+// unsigned int y, : w6 -+// unsigned int _w, : w7 -+// unsigned int h); : [sp, #0] -+ -+function ff_rpi_sand8_lines_to_planar_y8, export=1 -+ // w15 contains the number of rows we need to process -+ ldr w15, [sp, #0] -+ -+ // w8 will contain the number of blocks per row -+ // w8 = floor(_w/stride1) -+ // stride1 is assumed to always be 128 -+ mov w8, w1 -+ lsr w8, w8, #7 -+ -+ // in case the width of the image is not a multiple of 128, there will -+ // be an incomplete block at the end of every row -+ // w9 contains the number of pixels stored within this block -+ // w9 = _w - w8 * 128 -+ lsl w9, w8, #7 -+ sub w9, w7, w9 -+ -+ // this is the value we have to add to the src pointer after reading a complete block -+ // it will move the address to the start of the next block -+ // w10 = stride2 * stride1 - stride1 -+ mov w10, w4 -+ lsl w10, w10, #7 -+ sub w10, w10, #128 -+ -+ // w11 is the row offset, meaning the start offset of the first block of every collumn -+ // this will be increased with stride1 within every iteration of the row_loop -+ eor w11, w11, w11 -+ -+ // w12 = 0, processed row count -+ eor w12, w12, w12 -+row_loop: -+ // start of the first block within the current row -+ // x13 = row offset + src -+ mov x13, x2 -+ add x13, x13, x11 -+ -+ // w14 = 0, processed block count -+ eor w14, w14, w14 -+ -+ cmp w8, #0 -+ beq no_main_y8 -+ -+block_loop: -+ // copy 128 bytes (a full block) into the vector registers v0-v7 and increase the src address by 128 -+ // fortunately these aren't callee saved ones, meaning we don't need to backup them -+ ld1 { v0.16b, v1.16b, v2.16b, v3.16b}, [x13], #64 -+ ld1 { v4.16b, v5.16b, v6.16b, v7.16b}, [x13], #64 -+ -+ // write these registers back to the destination vector and increase the dst address by 128 -+ st1 { v0.16b, v1.16b, v2.16b, v3.16b }, [x0], #64 -+ st1 { v4.16b, v5.16b, v6.16b, v7.16b }, [x0], #64 -+ -+ // move the source register to the beginning of the next block (x13 = src + block offset) -+ add x13, x13, x10 -+ // increase the block counter -+ add w14, w14, #1 -+ -+ // continue with the block_loop if we haven't copied all full blocks yet -+ cmp w8, w14 -+ bgt block_loop -+ -+ // handle the last block at the end of each row -+ // at most 127 byte values copied from src to dst -+no_main_y8: -+ eor w5, w5, w5 // i = 0 -+incomplete_block_loop_y8: -+ cmp w5, w9 -+ bge incomplete_block_loop_end_y8 -+ -+ ldrb w6, [x13] -+ strb w6, [x0] -+ add x13, x13, #1 -+ add x0, x0, #1 -+ -+ add w5, w5, #1 -+ b incomplete_block_loop_y8 -+incomplete_block_loop_end_y8: -+ -+ -+ // increase the row offset by 128 (stride1) -+ add w11, w11, #128 -+ // increment the row counter -+ add w12, w12, #1 -+ -+ // process the next row if we haven't finished yet -+ cmp w15, w12 -+ bgt row_loop -+ -+ ret -+endfunc -+ -+ -+ -+// void ff_rpi_sand8_lines_to_planar_c8( -+// uint8_t * dst_u, : x0 -+// unsigned int dst_stride_u, : w1 == width -+// uint8_t * dst_v, : x2 -+// unsigned int dst_stride_v, : w3 == width -+// const uint8_t * src, : x4 -+// unsigned int stride1, : w5 == 128 -+// unsigned int stride2, : w6 -+// unsigned int _x, : w7 -+// unsigned int y, : [sp, #0] -+// unsigned int _w, : [sp, #8] -+// unsigned int h); : [sp, #16] -+ -+function ff_rpi_sand8_lines_to_planar_c8, export=1 -+ // w7 = width -+ ldr w7, [sp, #8] -+ -+ // w15 contains the number of rows we need to process -+ // counts down -+ ldr w15, [sp, #16] -+ -+ // number of full blocks, w8 = _w / (stride1 >> 1) == _w / 64 == _w >> 6 -+ mov w8, w7 -+ lsr w8, w8, #6 -+ -+ // number of pixels in block at the end of every row -+ // w9 = _w - (w8 * 64) -+ lsl w9, w8, #6 -+ sub w9, w7, w9 -+ -+ // Skip at the end of the line to account for stride -+ sub w12, w1, w7 -+ -+ // address delta to the beginning of the next block -+ // w10 = (stride2 * stride1 - stride1) = stride2 * 128 - 128 -+ lsl w10, w6, #7 -+ sub w10, w10, #128 -+ -+ // w11 = row address start offset = 0 -+ eor w11, w11, w11 -+ -+row_loop_c8: -+ // start of the first block within the current row -+ // x13 = row offset + src -+ mov x13, x4 -+ add x13, x13, x11 -+ -+ // w14 = 0, processed block count -+ eor w14, w14, w14 -+ -+ cmp w8, #0 -+ beq no_main_c8 -+ -+block_loop_c8: -+ // load the full block -> 128 bytes, the block contains 64 interleaved U and V values -+ ld2 { v0.16b, v1.16b }, [x13], #32 -+ ld2 { v2.16b, v3.16b }, [x13], #32 -+ ld2 { v4.16b, v5.16b }, [x13], #32 -+ ld2 { v6.16b, v7.16b }, [x13], #32 -+ -+ // swap register so that we can write them out with a single instruction -+ mov v16.16b, v1.16b -+ mov v17.16b, v3.16b -+ mov v18.16b, v5.16b -+ mov v1.16b, v2.16b -+ mov v2.16b, v4.16b -+ mov v3.16b, v6.16b -+ mov v4.16b, v16.16b -+ mov v5.16b, v17.16b -+ mov v6.16b, v18.16b -+ -+ st1 { v0.16b, v1.16b, v2.16b, v3.16b }, [x0], #64 -+ st1 { v4.16b, v5.16b, v6.16b, v7.16b }, [x2], #64 -+ -+ // increment row counter and move src to the beginning of the next block -+ add w14, w14, #1 -+ add x13, x13, x10 -+ -+ // jump to block_loop_c8 iff the block count is smaller than the number of full blocks -+ cmp w8, w14 -+ bgt block_loop_c8 -+ -+no_main_c8: -+ // handle incomplete block at the end of every row -+ eor w5, w5, w5 // point counter, this might be -+incomplete_block_loop_c8: -+ cmp w5, w9 -+ bge incomplete_block_loop_end_c8 -+ -+ ldrb w1, [x13] -+ strb w1, [x0] -+ add x13, x13, #1 -+ -+ ldrb w1, [x13] -+ strb w1, [x2] -+ add x13, x13, #1 -+ -+ add x0, x0, #1 -+ add x2, x2, #1 -+ -+ add w5, w5, #1 -+ b incomplete_block_loop_c8 -+incomplete_block_loop_end_c8: -+ -+ // increase row_offset by stride1 -+ add w11, w11, #128 -+ add x0, x0, w12, sxtw -+ add x2, x2, w12, sxtw -+ -+ // jump to row_Loop_c8 iff the row count is small than the height -+ subs w15, w15, #1 -+ bgt row_loop_c8 -+ -+ ret -+endfunc -+ -+//void ff_rpi_sand30_lines_to_planar_y16( -+// uint8_t * dest, // [x0] -+// unsigned int dst_stride, // [w1] -> assumed to be equal to _w -+// const uint8_t * src, // [x2] -+// unsigned int src_stride1, // [w3] -> 128 -+// unsigned int src_stride2, // [w4] -+// unsigned int _x, // [w5] -+// unsigned int y, // [w6] -+// unsigned int _w, // [w7] -+// unsigned int h); // [sp, #0] -+ -+function ff_rpi_sand30_lines_to_planar_y16, export=1 -+ stp x19, x20, [sp, #-48]! -+ stp x21, x22, [sp, #16] -+ stp x23, x24, [sp, #32] -+ -+ // w6 = argument h -+ ldr w6, [sp, #48] -+ -+ // slice_inc = ((stride2 - 1) * stride1) -+ mov w5, w4 -+ sub w5, w5, #1 -+ lsl w5, w5, #7 -+ -+ // total number of bytes per row = (width / 3) * 4 -+ mov w8, w7 -+ mov w9, #3 -+ udiv w8, w8, w9 -+ lsl w8, w8, #2 -+ -+ // number of full 128 byte blocks to be processed -+ mov w9, #96 -+ udiv w9, w7, w9 // = (width * 4) / (3*128) = width/96 -+ -+ // w10 = number of full integers to process (4 bytes) -+ // w11 = remaning zero to two 10bit values still to copy over -+ mov w12, #96 -+ mul w12, w9, w12 -+ sub w12, w7, w12 // width - blocks*96 = remaining points per row -+ mov w11, #3 -+ udiv w10, w12, w11 // full integers to process = w12 / 3 -+ mul w11, w10, w11 // #integers *3 -+ sub w11, w12, w11 // remaining 0-2 points = remaining points - integers*3 -+ -+ // increase w9 by one if w10+w11 is not zero, and decrease the row count by one -+ // this is to efficiently copy incomplete blocks at the end of the rows -+ // the last row is handled explicitly to avoid writing out of bounds -+ add w22, w10, w11 -+ cmp w22, #0 -+ cset w22, ne // 1 iff w10+w11 not zero, 0 otherwise -+ add w9, w9, w22 -+ sub w6, w6, #1 -+ -+ // store the number of bytes in w20 which we copy too much for every row -+ // when the width of the frame is not a multiple of 96 (128bytes storing 96 10bit values) -+ mov w20, #96*2 -+ mul w20, w20, w9 -+ sub w20, w1, w20 -+ -+ mov w23, #0 // flag to check whether the last line had already been processed -+ -+ // bitmask to clear the uppper 6bits of the result values -+ mov x19, #0x03ff03ff03ff03ff -+ dup v22.2d, x19 -+ -+ // row counter = 0 -+ eor w12, w12, w12 -+row_loop_y16: -+ cmp w12, w6 // jump to row_loop_y16_fin if we processed all rows -+ bge row_loop_y16_fin -+ -+ mov x13, x2 // row src -+ eor w14, w14, w14 // full block counter -+block_loop_y16: -+ cmp w14, w9 -+ bge block_loop_y16_fin -+ -+ // load 64 bytes -+ ld1 { v0.4s, v1.4s, v2.4s, v3.4s }, [x13], #64 -+ -+ // process v0 and v1 -+ xtn v16.4h, v0.4s -+ ushr v0.4s, v0.4s, #10 -+ xtn v17.4h, v0.4s -+ ushr v0.4s, v0.4s, #10 -+ xtn v18.4h, v0.4s -+ -+ xtn2 v16.8h, v1.4s -+ and v16.16b, v16.16b, v22.16b -+ ushr v1.4s, v1.4s, #10 -+ xtn2 v17.8h, v1.4s -+ and v17.16b, v17.16b, v22.16b -+ ushr v1.4s, v1.4s, #10 -+ xtn2 v18.8h, v1.4s -+ and v18.16b, v18.16b, v22.16b -+ -+ st3 { v16.8h, v17.8h, v18.8h }, [x0], #48 -+ -+ // process v2 and v3 -+ xtn v23.4h, v2.4s -+ ushr v2.4s, v2.4s, #10 -+ xtn v24.4h, v2.4s -+ ushr v2.4s, v2.4s, #10 -+ xtn v25.4h, v2.4s -+ -+ xtn2 v23.8h, v3.4s -+ and v23.16b, v23.16b, v22.16b -+ ushr v3.4s, v3.4s, #10 -+ xtn2 v24.8h, v3.4s -+ and v24.16b, v24.16b, v22.16b -+ ushr v3.4s, v3.4s, #10 -+ xtn2 v25.8h, v3.4s -+ and v25.16b, v25.16b, v22.16b -+ -+ st3 { v23.8h, v24.8h, v25.8h }, [x0], #48 -+ -+ // load the second half of the block -> 64 bytes into registers v4-v7 -+ ld1 { v4.4s, v5.4s, v6.4s, v7.4s }, [x13], #64 -+ -+ // process v4 and v5 -+ xtn v16.4h, v4.4s -+ ushr v4.4s, v4.4s, #10 -+ xtn v17.4h, v4.4s -+ ushr v4.4s, v4.4s, #10 -+ xtn v18.4h, v4.4s -+ -+ xtn2 v16.8h, v5.4s -+ and v16.16b, v16.16b, v22.16b -+ ushr v5.4s, v5.4s, #10 -+ xtn2 v17.8h, v5.4s -+ and v17.16b, v17.16b, v22.16b -+ ushr v5.4s, v5.4s, #10 -+ xtn2 v18.8h, v5.4s -+ and v18.16b, v18.16b, v22.16b -+ -+ st3 { v16.8h, v17.8h, v18.8h }, [x0], #48 -+ -+ // v6 and v7 -+ xtn v23.4h, v6.4s -+ ushr v6.4s, v6.4s, #10 -+ xtn v24.4h, v6.4s -+ ushr v6.4s, v6.4s, #10 -+ xtn v25.4h, v6.4s -+ -+ xtn2 v23.8h, v7.4s -+ and v23.16b, v23.16b, v22.16b -+ ushr v7.4s, v7.4s, #10 -+ xtn2 v24.8h, v7.4s -+ and v24.16b, v24.16b, v22.16b -+ ushr v7.4s, v7.4s, #10 -+ xtn2 v25.8h, v7.4s -+ and v25.16b, v25.16b, v22.16b -+ -+ st3 { v23.8h, v24.8h, v25.8h }, [x0], #48 -+ -+ add x13, x13, x5 // row src += slice_inc -+ add w14, w14, #1 -+ b block_loop_y16 -+block_loop_y16_fin: -+ -+ -+ -+ -+ add x2, x2, #128 // src += stride1 (start of the next row) -+ add x0, x0, w20, sxtw // subtract the bytes we copied too much from dst -+ add w12, w12, #1 -+ b row_loop_y16 -+row_loop_y16_fin: -+ -+ // check whether we have incomplete blocks at the end of every row -+ // in that case decrease row block count by one -+ // change height back to it's original value (meaning increase it by 1) -+ // and jump back to another iteration of row_loop_y16 -+ -+ cmp w23, #1 -+ beq row_loop_y16_fin2 // don't continue here if we already processed the last row -+ add w6, w6, #1 // increase height to the original value -+ sub w9, w9, w22 // block count - 1 or 0, depending on the remaining bytes count -+ mov w23, #1 -+ b row_loop_y16 -+row_loop_y16_fin2: -+ -+ sub x0, x0, w20, sxtw // with the last row we didn't actually move the dst ptr to far ahead, therefore readd the diference -+ -+ // now we've got to handle the last block in the last row -+ eor w12, w12, w12 // w12 = 0 = counter -+integer_loop_y16: -+ cmp w12, w10 -+ bge integer_loop_y16_fin -+ ldr w14, [x13], #4 -+ and w15, w14, #0x3ff -+ strh w15, [x0], #2 -+ lsr w14, w14, #10 -+ and w15, w14, #0x3ff -+ strh w15, [x0], #2 -+ lsr w14, w14, #10 -+ and w15, w14, #0x3ff -+ strh w15, [x0], #2 -+ add w12, w12, #1 -+ b integer_loop_y16 -+integer_loop_y16_fin: -+ -+final_values_y16: -+ // remaining point count = w11 -+ ldr w14, [x13], #4 -+ cmp w11, #0 -+ beq final_values_y16_fin -+ and w15, w14, #0x3ff -+ strh w15, [x0], #2 -+ cmp w11, #1 -+ beq final_values_y16_fin -+ lsr w14, w14, #10 -+ and w15, w14, #0x3ff -+ strh w15, [x0], #2 -+final_values_y16_fin: -+ -+ ldp x23, x24, [sp, #32] -+ ldp x21, x22, [sp, #16] -+ ldp x19, x20, [sp], #48 -+ ret -+endfunc -+ -+//void ff_rpi_sand30_lines_to_planar_c16( -+// uint8_t * dst_u, // [x0] -+// unsigned int dst_stride_u, // [w1] == _w*2 -+// uint8_t * dst_v, // [x2] -+// unsigned int dst_stride_v, // [w3] == _w*2 -+// const uint8_t * src, // [x4] -+// unsigned int stride1, // [w5] == 128 -+// unsigned int stride2, // [w6] -+// unsigned int _x, // [w7] == 0 -+// unsigned int y, // [sp, #0] == 0 -+// unsigned int _w, // [sp, #8] -> w3 -+// unsigned int h); // [sp, #16] -> w7 -+ -+.macro rpi_sand30_lines_to_planar_c16_block_half -+ ld1 { v0.4s, v1.4s, v2.4s, v3.4s }, [x13], #64 -+ -+ xtn v4.4h, v0.4s -+ ushr v0.4s, v0.4s, #10 -+ xtn v5.4h, v0.4s -+ ushr v0.4s, v0.4s, #10 -+ xtn v6.4h, v0.4s -+ xtn2 v4.8h, v1.4s -+ ushr v1.4s, v1.4s, #10 -+ xtn2 v5.8h, v1.4s -+ ushr v1.4s, v1.4s, #10 -+ xtn2 v6.8h, v1.4s -+ and v4.16b, v4.16b, v16.16b -+ and v5.16b, v5.16b, v16.16b -+ and v6.16b, v6.16b, v16.16b -+ st3 { v4.8h, v5.8h, v6.8h }, [sp], #48 -+ -+ xtn v4.4h, v2.4s -+ ushr v2.4s, v2.4s, #10 -+ xtn v5.4h, v2.4s -+ ushr v2.4s, v2.4s, #10 -+ xtn v6.4h, v2.4s -+ xtn2 v4.8h, v3.4s -+ ushr v3.4s, v3.4s, #10 -+ xtn2 v5.8h, v3.4s -+ ushr v3.4s, v3.4s, #10 -+ xtn2 v6.8h, v3.4s -+ and v4.16b, v4.16b, v16.16b -+ and v5.16b, v5.16b, v16.16b -+ and v6.16b, v6.16b, v16.16b -+ st3 { v4.8h, v5.8h, v6.8h }, [sp] -+ sub sp, sp, #48 -+.endm -+ -+function ff_rpi_sand30_lines_to_planar_c16, export=1 -+ stp x19, x20, [sp, #-48]! -+ stp x21, x22, [sp, #16] -+ stp x23, x24, [sp, #32] -+ -+ ldr w3, [sp, #48+8] // w3 = width -+ ldr w7, [sp, #48+16] // w7 = height -+ -+ // reserve space on the stack for intermediate results -+ sub sp, sp, #256 -+ -+ // number of 128byte blocks per row, w8 = width / 48 -+ mov w9, #48 -+ udiv w8, w3, w9 -+ -+ // remaining pixels (rem_pix) per row, w9 = width - w8 * 48 -+ mul w9, w8, w9 -+ sub w9, w3, w9 -+ -+ // row offset, the beginning of the next row to process -+ eor w10, w10, w10 -+ -+ // offset to the beginning of the next block, w11 = stride2 * 128 - 128 -+ lsl w11, w6, #7 -+ sub w11, w11, #128 -+ -+ // decrease the height by one and in case of remaining pixels increase the block count by one -+ sub w7, w7, #1 -+ cmp w9, #0 -+ cset w19, ne // w19 == 1 iff reamining pixels != 0 -+ add w8, w8, w19 -+ -+ // bytes we have to move dst back by at the end of every row -+ mov w21, #48*2 -+ mul w21, w21, w8 -+ sub w21, w1, w21 -+ -+ mov w20, #0 // w20 = flag, last row processed -+ -+ mov x12, #0x03ff03ff03ff03ff -+ dup v16.2d, x12 -+ -+ // iterate through rows, row counter = w12 = 0 -+ eor w12, w12, w12 -+row_loop_c16: -+ cmp w12, w7 -+ bge row_loop_c16_fin -+ -+ // address of row data = src + row_offset -+ mov x13, x4 -+ add x13, x13, x10 -+ -+ eor w14, w14, w14 -+block_loop_c16: -+ cmp w14, w8 -+ bge block_loop_c16_fin -+ -+ rpi_sand30_lines_to_planar_c16_block_half -+ -+ ld2 { v0.8h, v1.8h }, [sp], #32 -+ ld2 { v2.8h, v3.8h }, [sp], #32 -+ ld2 { v4.8h, v5.8h }, [sp] -+ sub sp, sp, #64 -+ -+ st1 { v0.8h }, [x0], #16 -+ st1 { v2.8h }, [x0], #16 -+ st1 { v4.8h }, [x0], #16 -+ st1 { v1.8h }, [x2], #16 -+ st1 { v3.8h }, [x2], #16 -+ st1 { v5.8h }, [x2], #16 -+ -+ rpi_sand30_lines_to_planar_c16_block_half -+ -+ ld2 { v0.8h, v1.8h }, [sp], #32 -+ ld2 { v2.8h, v3.8h }, [sp], #32 -+ ld2 { v4.8h, v5.8h }, [sp] -+ sub sp, sp, #64 -+ -+ st1 { v0.8h }, [x0], #16 -+ st1 { v2.8h }, [x0], #16 -+ st1 { v4.8h }, [x0], #16 -+ st1 { v1.8h }, [x2], #16 -+ st1 { v3.8h }, [x2], #16 -+ st1 { v5.8h }, [x2], #16 -+ -+ add x13, x13, x11 // offset to next block -+ add w14, w14, #1 -+ b block_loop_c16 -+block_loop_c16_fin: -+ -+ add w10, w10, #128 -+ add w12, w12, #1 -+ add x0, x0, w21, sxtw // move dst pointers back by x21 -+ add x2, x2, w21, sxtw -+ b row_loop_c16 -+row_loop_c16_fin: -+ -+ cmp w20, #1 -+ beq row_loop_c16_fin2 -+ mov w20, #1 -+ sub w8, w8, w19 // decrease block count by w19 -+ add w7, w7, #1 // increase height -+ b row_loop_c16 -+ -+row_loop_c16_fin2: -+ sub x0, x0, w21, sxtw // readd x21 in case of the last row -+ sub x2, x2, w21, sxtw // so that we can write out the few remaining pixels -+ -+ // last incomplete block to be finished -+ // read operations are fine, stride2 is more than large enough even if rem_pix is 0 -+ rpi_sand30_lines_to_planar_c16_block_half -+ ld2 { v0.8h, v1.8h }, [sp], #32 -+ ld2 { v2.8h, v3.8h }, [sp], #32 -+ ld2 { v4.8h, v5.8h }, [sp], #32 -+ rpi_sand30_lines_to_planar_c16_block_half -+ ld2 { v0.8h, v1.8h }, [sp], #32 -+ ld2 { v2.8h, v3.8h }, [sp], #32 -+ ld2 { v4.8h, v5.8h }, [sp] -+ sub sp, sp, #160 -+ -+ mov x4, sp -+ eor w20, w20, w20 -+rem_pix_c16_loop: -+ cmp w20, w9 -+ bge rem_pix_c16_fin -+ -+ ldr w22, [x4], #4 -+ str w22, [x0], #2 -+ lsr w22, w22, #16 -+ str w22, [x2], #2 -+ -+ add w20, w20, #1 -+ b rem_pix_c16_loop -+rem_pix_c16_fin: -+ -+ add sp, sp, #256 -+ -+ ldp x23, x24, [sp, #32] -+ ldp x21, x22, [sp, #16] -+ ldp x19, x20, [sp], #48 -+ ret -+endfunc -+ -+ -+ -+//void ff_rpi_sand30_lines_to_planar_p010( -+// uint8_t * dest, -+// unsigned int dst_stride, -+// const uint8_t * src, -+// unsigned int src_stride1, -+// unsigned int src_stride2, -+// unsigned int _x, -+// unsigned int y, -+// unsigned int _w, -+// unsigned int h); -+ ---- /dev/null -+++ b/libavutil/aarch64/rpi_sand_neon.h -@@ -0,0 +1,55 @@ -+/* -+Copyright (c) 2021 Michael Eiler -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: Michael Eiler -+*/ -+ -+#pragma once -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+void ff_rpi_sand8_lines_to_planar_y8(uint8_t * dest, unsigned int dst_stride, -+ const uint8_t * src, unsigned int src_stride1, unsigned int src_stride2, -+ unsigned int _x, unsigned int y, unsigned int _w, unsigned int h); -+ -+void ff_rpi_sand8_lines_to_planar_c8(uint8_t * dst_u, unsigned int dst_stride_u, -+ uint8_t * dst_v, unsigned int dst_stride_v, const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+ -+void ff_rpi_sand30_lines_to_planar_y16(uint8_t * dest, unsigned int dst_stride, -+ const uint8_t * src, unsigned int src_stride1, unsigned int src_stride2, -+ unsigned int _x, unsigned int y, unsigned int _w, unsigned int h); -+ -+void ff_rpi_sand30_lines_to_planar_c16(uint8_t * dst_u, unsigned int dst_stride_u, -+ uint8_t * dst_v, unsigned int dst_stride_v, const uint8_t * src, unsigned int stride1, -+ unsigned int stride2, unsigned int _x, unsigned int y, unsigned int _w, unsigned int h); -+ -+#ifdef __cplusplus -+} -+#endif -+ ---- a/libavutil/arm/Makefile -+++ b/libavutil/arm/Makefile -@@ -6,3 +6,4 @@ VFP-OBJS += arm/float_dsp_init_vfp.o - - NEON-OBJS += arm/float_dsp_init_neon.o \ - arm/float_dsp_neon.o \ -+ arm/rpi_sand_neon.o \ ---- /dev/null -+++ b/libavutil/arm/rpi_sand_neon.S -@@ -0,0 +1,768 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox -+*/ -+ -+#include "libavutil/arm/asm.S" -+ -+ -+@ General notes: -+@ Having done some timing on this in sand8->y8 (Pi4) -+@ vst1 (680fps) is a bit faster than vstm (660fps) -+@ vldm (680fps) is noticably faster than vld1 (480fps) -+@ (or it might be that a mix is what is required) -+@ -+@ At least on a Pi4 it is no more expensive to have a single auto-inc register -+@ for dest address than it is to have 2 used alternately (On Pi3 Ben asserted -+@ the latter was better) -+@ -+@ vstm will bus error on unaligned access (so will vldm), vst1 is safe unless -+@ the memory is uncached. -+@ As these are Sand -> planar we can assume that src is going to be aligned but -+@ it is possible that dest isn't (converting to .yuv or other packed format). -+@ Luckily vst1 is faster than vstm :-) so all is well -+@ vst1 has alignment requirements of el size so maybe splitting vst1.32 into 4 -+@ .8 stores would let us do non-word aligned stores into uncached but it -+@ probably isn't worth it. -+ -+ -+ -+ -+@ void ff_rpi_sand128b_stripe_to_8_10( -+@ uint8_t * dest, // [r0] -+@ const uint8_t * src1, // [r1] -+@ const uint8_t * src2, // [r2] -+@ unsigned int lines); // [r3] -+ -+.macro stripe2_to_8, bit_depth -+ vpush {q4-q7} -+1: -+ vldm r1!, {q0-q7} -+ subs r3, #1 -+ vldm r2!, {q8-q15} -+ vqrshrn.u16 d0, q0, #\bit_depth - 8 -+ vqrshrn.u16 d1, q1, #\bit_depth - 8 -+ vqrshrn.u16 d2, q2, #\bit_depth - 8 -+ vqrshrn.u16 d3, q3, #\bit_depth - 8 -+ vqrshrn.u16 d4, q4, #\bit_depth - 8 -+ vqrshrn.u16 d5, q5, #\bit_depth - 8 -+ vqrshrn.u16 d6, q6, #\bit_depth - 8 -+ vqrshrn.u16 d7, q7, #\bit_depth - 8 -+ vqrshrn.u16 d8, q8, #\bit_depth - 8 -+ vqrshrn.u16 d9, q9, #\bit_depth - 8 -+ vqrshrn.u16 d10, q10, #\bit_depth - 8 -+ vqrshrn.u16 d11, q11, #\bit_depth - 8 -+ vqrshrn.u16 d12, q12, #\bit_depth - 8 -+ vqrshrn.u16 d13, q13, #\bit_depth - 8 -+ vqrshrn.u16 d14, q14, #\bit_depth - 8 -+ vqrshrn.u16 d15, q15, #\bit_depth - 8 -+ vstm r0!, {q0-q7} -+ bne 1b -+ vpop {q4-q7} -+ bx lr -+.endm -+ -+function ff_rpi_sand128b_stripe_to_8_10, export=1 -+ stripe2_to_8 10 -+endfunc -+ -+@ void ff_rpi_sand8_lines_to_planar_y8( -+@ uint8_t * dest, // [r0] -+@ unsigned int dst_stride, // [r1] -+@ const uint8_t * src, // [r2] -+@ unsigned int src_stride1, // [r3] Ignored - assumed 128 -+@ unsigned int src_stride2, // [sp, #0] -> r3 -+@ unsigned int _x, // [sp, #4] Ignored - 0 -+@ unsigned int y, // [sp, #8] (r7 in prefix) -+@ unsigned int _w, // [sp, #12] -> r6 (cur r5) -+@ unsigned int h); // [sp, #16] -> r7 -+@ -+@ Assumes that we are starting on a stripe boundary and that overreading -+@ within the stripe is OK. However it does respect the dest size for writing -+ -+function ff_rpi_sand8_lines_to_planar_y8, export=1 -+ push {r4-r8, lr} @ +24 L -+ ldr r3, [sp, #24] -+ ldr r6, [sp, #36] -+ ldr r7, [sp, #32] @ y -+ lsl r3, #7 -+ sub r1, r6 -+ add r8, r2, r7, lsl #7 -+ ldr r7, [sp, #40] -+ -+10: -+ mov r2, r8 -+ add r4, r0, #24 -+ mov r5, r6 -+ mov lr, #0 -+1: -+ vldm r2, {q8-q15} -+ add r2, r3 -+ subs r5, #128 -+ blt 2f -+ vst1.8 {d16, d17, d18, d19}, [r0]! -+ vst1.8 {d20, d21, d22, d23}, [r0]! -+ vst1.8 {d24, d25, d26, d27}, [r0]! -+ vst1.8 {d28, d29, d30, d31}, [r0]! -+ bne 1b -+11: -+ subs r7, #1 -+ add r0, r1 -+ add r8, #128 -+ bne 10b -+ -+ pop {r4-r8, pc} -+ -+@ Partial final write -+2: -+ cmp r5, #64-128 -+ blt 1f -+ vst1.8 {d16, d17, d18, d19}, [r0]! -+ vst1.8 {d20, d21, d22, d23}, [r0]! -+ beq 11b -+ vmov q8, q12 -+ vmov q9, q13 -+ sub r5, #64 -+ vmov q10, q14 -+ vmov q11, q15 -+1: -+ cmp r5, #32-128 -+ blt 1f -+ vst1.8 {d16, d17, d18, d19}, [r0]! -+ beq 11b -+ vmov q8, q10 -+ sub r5, #32 -+ vmov q9, q11 -+1: -+ cmp r5, #16-128 -+ blt 1f -+ vst1.8 {d16, d17}, [r0]! -+ beq 11b -+ sub r5, #16 -+ vmov q8, q9 -+1: -+ cmp r5, #8-128 -+ blt 1f -+ vst1.8 {d16}, [r0]! -+ beq 11b -+ sub r5, #8 -+ vmov d16, d17 -+1: -+ cmp r5, #4-128 -+ blt 1f -+ vst1.32 {d16[0]}, [r0]! -+ beq 11b -+ sub r5, #4 -+ vshr.u64 d16, #32 -+1: -+ cmp r5, #2-128 -+ blt 1f -+ vst1.16 {d16[0]}, [r0]! -+ beq 11b -+ vst1.8 {d16[2]}, [r0]! -+ b 11b -+1: -+ vst1.8 {d16[0]}, [r0]! -+ b 11b -+endfunc -+ -+@ void ff_rpi_sand8_lines_to_planar_c8( -+@ uint8_t * dst_u, // [r0] -+@ unsigned int dst_stride_u, // [r1] -+@ uint8_t * dst_v, // [r2] -+@ unsigned int dst_stride_v, // [r3] -+@ const uint8_t * src, // [sp, #0] -> r4, r5 -+@ unsigned int stride1, // [sp, #4] 128 -+@ unsigned int stride2, // [sp, #8] -> r8 -+@ unsigned int _x, // [sp, #12] 0 -+@ unsigned int y, // [sp, #16] (r7 in prefix) -+@ unsigned int _w, // [sp, #20] -> r12, r6 -+@ unsigned int h); // [sp, #24] -> r7 -+@ -+@ Assumes that we are starting on a stripe boundary and that overreading -+@ within the stripe is OK. However it does respect the dest size for writing -+ -+function ff_rpi_sand8_lines_to_planar_c8, export=1 -+ push {r4-r8, lr} @ +24 -+ -+ ldr r5, [sp, #24] -+ ldr r8, [sp, #32] -+ ldr r7, [sp, #40] -+ ldr r6, [sp, #44] -+ lsl r8, #7 -+ add r5, r5, r7, lsl #7 -+ sub r1, r1, r6 -+ sub r3, r3, r6 -+ ldr r7, [sp, #48] -+ vpush {q4-q7} -+ -+10: -+ mov r4, r5 -+ mov r12, r6 -+1: -+ subs r12, #64 -+ vldm r4, {q0-q7} -+ add r4, r8 -+ it gt -+ vldmgt r4, {q8-q15} -+ add r4, r8 -+ -+ vuzp.8 q0, q1 -+ vuzp.8 q2, q3 -+ vuzp.8 q4, q5 -+ vuzp.8 q6, q7 -+ -+ vuzp.8 q8, q9 -+ vuzp.8 q10, q11 -+ vuzp.8 q12, q13 -+ vuzp.8 q14, q15 -+ subs r12, #64 -+ -+ @ Rearrange regs so we can use vst1 with 4 regs -+ vswp q1, q2 -+ vswp q5, q6 -+ vswp q9, q10 -+ vswp q13, q14 -+ blt 2f -+ -+ vst1.8 {d0, d1, d2, d3 }, [r0]! -+ vst1.8 {d8, d9, d10, d11}, [r0]! -+ vst1.8 {d16, d17, d18, d19}, [r0]! -+ vst1.8 {d24, d25, d26, d27}, [r0]! -+ -+ vst1.8 {d4, d5, d6, d7 }, [r2]! -+ vst1.8 {d12, d13, d14, d15}, [r2]! -+ vst1.8 {d20, d21, d22, d23}, [r2]! -+ vst1.8 {d28, d29, d30, d31}, [r2]! -+ bne 1b -+11: -+ subs r7, #1 -+ add r5, #128 -+ add r0, r1 -+ add r2, r3 -+ bne 10b -+ vpop {q4-q7} -+ pop {r4-r8,pc} -+ -+2: -+ cmp r12, #64-128 -+ blt 1f -+ vst1.8 {d0, d1, d2, d3 }, [r0]! -+ vst1.8 {d8, d9, d10, d11}, [r0]! -+ vst1.8 {d4, d5, d6, d7 }, [r2]! -+ vst1.8 {d12, d13, d14, d15}, [r2]! -+ beq 11b -+ sub r12, #64 -+ vmov q0, q8 -+ vmov q1, q9 -+ vmov q2, q10 -+ vmov q3, q11 -+ vmov q4, q12 -+ vmov q5, q13 -+ vmov q6, q14 -+ vmov q7, q15 -+1: -+ cmp r12, #32-128 -+ blt 1f -+ vst1.8 {d0, d1, d2, d3 }, [r0]! -+ vst1.8 {d4, d5, d6, d7 }, [r2]! -+ beq 11b -+ sub r12, #32 -+ vmov q0, q4 -+ vmov q1, q5 -+ vmov q2, q6 -+ vmov q3, q7 -+1: -+ cmp r12, #16-128 -+ blt 1f -+ vst1.8 {d0, d1 }, [r0]! -+ vst1.8 {d4, d5 }, [r2]! -+ beq 11b -+ sub r12, #16 -+ vmov q0, q1 -+ vmov q2, q3 -+1: -+ cmp r12, #8-128 -+ blt 1f -+ vst1.8 {d0}, [r0]! -+ vst1.8 {d4}, [r2]! -+ beq 11b -+ sub r12, #8 -+ vmov d0, d1 -+ vmov d4, d5 -+1: -+ cmp r12, #4-128 -+ blt 1f -+ vst1.32 {d0[0]}, [r0]! -+ vst1.32 {d4[0]}, [r2]! -+ beq 11b -+ sub r12, #4 -+ vmov s0, s1 -+ vmov s8, s9 -+1: -+ cmp r12, #2-128 -+ blt 1f -+ vst1.16 {d0[0]}, [r0]! -+ vst1.16 {d4[0]}, [r2]! -+ beq 11b -+ vst1.8 {d0[2]}, [r0]! -+ vst1.8 {d4[2]}, [r2]! -+ b 11b -+1: -+ vst1.8 {d0[0]}, [r0]! -+ vst1.8 {d4[0]}, [r2]! -+ b 11b -+endfunc -+ -+ -+ -+@ void ff_rpi_sand30_lines_to_planar_y16( -+@ uint8_t * dest, // [r0] -+@ unsigned int dst_stride, // [r1] -+@ const uint8_t * src, // [r2] -+@ unsigned int src_stride1, // [r3] Ignored - assumed 128 -+@ unsigned int src_stride2, // [sp, #0] -> r3 -+@ unsigned int _x, // [sp, #4] Ignored - 0 -+@ unsigned int y, // [sp, #8] (r7 in prefix) -+@ unsigned int _w, // [sp, #12] -> r6 (cur r5) -+@ unsigned int h); // [sp, #16] -> r7 -+@ -+@ Assumes that we are starting on a stripe boundary and that overreading -+@ within the stripe is OK. However it does respect the dest size for writing -+ -+function ff_rpi_sand30_lines_to_planar_y16, export=1 -+ push {r4-r8, lr} @ +24 -+ ldr r3, [sp, #24] -+ ldr r6, [sp, #36] -+ ldr r7, [sp, #32] @ y -+ mov r12, #48 -+ vmov.u16 q15, #0x3ff -+ sub r3, #1 -+ lsl r3, #7 -+ sub r1, r1, r6, lsl #1 -+ add r8, r2, r7, lsl #7 -+ ldr r7, [sp, #40] -+ -+10: -+ mov r2, r8 -+ add r4, r0, #24 -+ mov r5, r6 -+ mov lr, #0 -+1: -+ vldm r2!, {q10-q13} -+ add lr, #64 -+ -+ vshr.u32 q14, q10, #20 @ Cannot vshrn.u32 #20! -+ ands lr, #127 -+ vshrn.u32 d2, q10, #10 -+ vmovn.u32 d0, q10 -+ vmovn.u32 d4, q14 -+ -+ vshr.u32 q14, q11, #20 -+ it eq -+ addeq r2, r3 -+ vshrn.u32 d3, q11, #10 -+ vmovn.u32 d1, q11 -+ vmovn.u32 d5, q14 -+ -+ subs r5, #48 -+ vand q0, q15 -+ vand q1, q15 -+ vand q2, q15 -+ -+ vshr.u32 q14, q12, #20 -+ vshrn.u32 d18, q12, #10 -+ vmovn.u32 d16, q12 -+ vmovn.u32 d20, q14 -+ -+ vshr.u32 q14, q13, #20 -+ vshrn.u32 d19, q13, #10 -+ vmovn.u32 d17, q13 -+ vmovn.u32 d21, q14 -+ -+ vand q8, q15 -+ vand q9, q15 -+ vand q10, q15 -+ blt 2f -+ -+ vst3.16 {d0, d2, d4}, [r0], r12 -+ vst3.16 {d1, d3, d5}, [r4], r12 -+ vst3.16 {d16, d18, d20}, [r0], r12 -+ vst3.16 {d17, d19, d21}, [r4], r12 -+ -+ bne 1b -+ -+11: -+ subs r7, #1 -+ add r0, r1 -+ add r8, #128 -+ bne 10b -+ -+ pop {r4-r8, pc} -+ -+@ Partial final write -+2: -+ cmp r5, #24-48 -+ blt 1f -+ vst3.16 {d0, d2, d4}, [r0], r12 -+ vst3.16 {d1, d3, d5}, [r4] -+ beq 11b -+ vmov q0, q8 -+ sub r5, #24 -+ vmov q1, q9 -+ vmov q2, q10 -+1: -+ cmp r5, #12-48 -+ blt 1f -+ vst3.16 {d0, d2, d4}, [r0]! -+ beq 11b -+ vmov d0, d1 -+ sub r5, #12 -+ vmov d2, d3 -+ vmov d4, d5 -+1: -+ cmp r5, #6-48 -+ add r4, r0, #6 @ avoid [r0]! on sequential instructions -+ blt 1f -+ vst3.16 {d0[0], d2[0], d4[0]}, [r0] -+ vst3.16 {d0[1], d2[1], d4[1]}, [r4] -+ add r0, #12 -+ beq 11b -+ vmov s0, s1 -+ sub r5, #6 -+ vmov s4, s5 -+ vmov s8, s9 -+1: -+ cmp r5, #3-48 -+ blt 1f -+ vst3.16 {d0[0], d2[0], d4[0]}, [r0]! -+ beq 11b -+ sub r5, #3 -+ vshr.u32 d0, #16 -+ vshr.u32 d2, #16 -+1: -+ cmp r5, #2-48 -+ blt 1f -+ vst2.16 {d0[0], d2[0]}, [r0]! -+ b 11b -+1: -+ vst1.16 {d0[0]}, [r0]! -+ b 11b -+ -+endfunc -+ -+ -+@ void ff_rpi_sand30_lines_to_planar_c16( -+@ uint8_t * dst_u, // [r0] -+@ unsigned int dst_stride_u, // [r1] -+@ uint8_t * dst_v, // [r2] -+@ unsigned int dst_stride_v, // [r3] -+@ const uint8_t * src, // [sp, #0] -> r4, r5 -+@ unsigned int stride1, // [sp, #4] 128 -+@ unsigned int stride2, // [sp, #8] -> r8 -+@ unsigned int _x, // [sp, #12] 0 -+@ unsigned int y, // [sp, #16] (r7 in prefix) -+@ unsigned int _w, // [sp, #20] -> r6, r9 -+@ unsigned int h); // [sp, #24] -> r7 -+@ -+@ Assumes that we are starting on a stripe boundary and that overreading -+@ within the stripe is OK. However it does respect the dest size for writing -+ -+function ff_rpi_sand30_lines_to_planar_c16, export=1 -+ push {r4-r10, lr} @ +32 -+ ldr r5, [sp, #32] -+ ldr r8, [sp, #40] -+ ldr r7, [sp, #48] -+ ldr r9, [sp, #52] -+ mov r12, #48 -+ vmov.u16 q15, #0x3ff -+ sub r8, #1 -+ lsl r8, #7 -+ add r5, r5, r7, lsl #7 -+ sub r1, r1, r9, lsl #1 -+ sub r3, r3, r9, lsl #1 -+ ldr r7, [sp, #56] -+10: -+ mov lr, #0 -+ mov r4, r5 -+ mov r6, r9 -+1: -+ vldm r4!, {q0-q3} -+ add lr, #64 -+ -+ @ N.B. unpack [0,1,2] -> (reg order) 1, 0, 2 -+ vshr.u32 q14, q0, #20 -+ vshrn.u32 d16, q0, #10 -+ vmovn.u32 d18, q0 -+ ands lr, #127 -+ vmovn.u32 d20, q14 -+ -+ vshr.u32 q14, q1, #20 -+ vshrn.u32 d17, q1, #10 -+ vmovn.u32 d19, q1 -+ vmovn.u32 d21, q14 -+ -+ vshr.u32 q14, q2, #20 -+ vshrn.u32 d22, q2, #10 -+ vmovn.u32 d24, q2 -+ vmovn.u32 d26, q14 -+ -+ vshr.u32 q14, q3, #20 -+ vshrn.u32 d23, q3, #10 -+ vmovn.u32 d25, q3 -+ add r10, r0, #24 -+ vmovn.u32 d27, q14 -+ -+ it eq -+ addeq r4, r8 -+ vuzp.16 q8, q11 -+ vuzp.16 q9, q12 -+ vuzp.16 q10, q13 -+ -+ @ q8 V0, V3,.. -> q0 -+ @ q9 U0, U3... -+ @ q10 U1, U4... -+ @ q11 U2, U5,.. -+ @ q12 V1, V4,.. -> q1 -+ @ q13 V2, V5,.. -> q2 -+ -+ subs r6, #24 -+ vand q11, q15 -+ vand q9, q15 -+ vand q10, q15 -+ vand q0, q8, q15 -+ vand q1, q12, q15 -+ vand q2, q13, q15 -+ -+ blt 2f -+ -+ vst3.16 {d18, d20, d22}, [r0], r12 -+ vst3.16 {d19, d21, d23}, [r10] -+ add r10, r2, #24 -+ vst3.16 {d0, d2, d4}, [r2], r12 -+ vst3.16 {d1, d3, d5}, [r10] -+ -+ bne 1b -+ -+11: -+ subs r7, #1 -+ add r5, #128 -+ add r0, r1 -+ add r2, r3 -+ bne 10b -+ -+ pop {r4-r10, pc} -+ -+@ Partial final write -+2: -+ cmp r6, #-12 -+ blt 1f -+ vst3.16 {d18, d20, d22}, [r0]! -+ vst3.16 {d0, d2, d4}, [r2]! -+ beq 11b -+ vmov d18, d19 -+ vmov d20, d21 -+ vmov d22, d23 -+ sub r6, #12 -+ vmov d0, d1 -+ vmov d2, d3 -+ vmov d4, d5 -+1: -+ cmp r6, #-18 -+ @ Rezip here as it makes the remaining tail handling easier -+ vzip.16 d0, d18 -+ vzip.16 d2, d20 -+ vzip.16 d4, d22 -+ blt 1f -+ vst3.16 {d0[1], d2[1], d4[1]}, [r0]! -+ vst3.16 {d0[0], d2[0], d4[0]}, [r2]! -+ vst3.16 {d0[3], d2[3], d4[3]}, [r0]! -+ vst3.16 {d0[2], d2[2], d4[2]}, [r2]! -+ beq 11b -+ vmov d0, d18 -+ vmov d2, d20 -+ sub r6, #6 -+ vmov d4, d22 -+1: -+ cmp r6, #-21 -+ blt 1f -+ vst3.16 {d0[1], d2[1], d4[1]}, [r0]! -+ vst3.16 {d0[0], d2[0], d4[0]}, [r2]! -+ beq 11b -+ vmov s4, s5 -+ sub r6, #3 -+ vmov s0, s1 -+1: -+ cmp r6, #-22 -+ blt 1f -+ vst2.16 {d0[1], d2[1]}, [r0]! -+ vst2.16 {d0[0], d2[0]}, [r2]! -+ b 11b -+1: -+ vst1.16 {d0[1]}, [r0]! -+ vst1.16 {d0[0]}, [r2]! -+ b 11b -+ -+endfunc -+ -+@ void ff_rpi_sand30_lines_to_planar_p010( -+@ uint8_t * dest, // [r0] -+@ unsigned int dst_stride, // [r1] -+@ const uint8_t * src, // [r2] -+@ unsigned int src_stride1, // [r3] Ignored - assumed 128 -+@ unsigned int src_stride2, // [sp, #0] -> r3 -+@ unsigned int _x, // [sp, #4] Ignored - 0 -+@ unsigned int y, // [sp, #8] (r7 in prefix) -+@ unsigned int _w, // [sp, #12] -> r6 (cur r5) -+@ unsigned int h); // [sp, #16] -> r7 -+@ -+@ Assumes that we are starting on a stripe boundary and that overreading -+@ within the stripe is OK. However it does respect the dest size for writing -+ -+function ff_rpi_sand30_lines_to_planar_p010, export=1 -+ push {r4-r8, lr} @ +24 -+ ldr r3, [sp, #24] -+ ldr r6, [sp, #36] -+ ldr r7, [sp, #32] @ y -+ mov r12, #48 -+ vmov.u16 q15, #0xffc0 -+ sub r3, #1 -+ lsl r3, #7 -+ sub r1, r1, r6, lsl #1 -+ add r8, r2, r7, lsl #7 -+ ldr r7, [sp, #40] -+ -+10: -+ mov r2, r8 -+ add r4, r0, #24 -+ mov r5, r6 -+ mov lr, #0 -+1: -+ vldm r2!, {q10-q13} -+ add lr, #64 -+ -+ vshl.u32 q14, q10, #6 -+ ands lr, #127 -+ vshrn.u32 d4, q10, #14 -+ vshrn.u32 d2, q10, #4 -+ vmovn.u32 d0, q14 -+ -+ vshl.u32 q14, q11, #6 -+ it eq -+ addeq r2, r3 -+ vshrn.u32 d5, q11, #14 -+ vshrn.u32 d3, q11, #4 -+ vmovn.u32 d1, q14 -+ -+ subs r5, #48 -+ vand q2, q15 -+ vand q1, q15 -+ vand q0, q15 -+ -+ vshl.u32 q14, q12, #6 -+ vshrn.u32 d20, q12, #14 -+ vshrn.u32 d18, q12, #4 -+ vmovn.u32 d16, q14 -+ -+ vshl.u32 q14, q13, #6 -+ vshrn.u32 d21, q13, #14 -+ vshrn.u32 d19, q13, #4 -+ vmovn.u32 d17, q14 -+ -+ vand q10, q15 -+ vand q9, q15 -+ vand q8, q15 -+ blt 2f -+ -+ vst3.16 {d0, d2, d4}, [r0], r12 -+ vst3.16 {d1, d3, d5}, [r4], r12 -+ vst3.16 {d16, d18, d20}, [r0], r12 -+ vst3.16 {d17, d19, d21}, [r4], r12 -+ -+ bne 1b -+ -+11: -+ subs r7, #1 -+ add r0, r1 -+ add r8, #128 -+ bne 10b -+ -+ pop {r4-r8, pc} -+ -+@ Partial final write -+2: -+ cmp r5, #24-48 -+ blt 1f -+ vst3.16 {d0, d2, d4}, [r0], r12 -+ vst3.16 {d1, d3, d5}, [r4] -+ beq 11b -+ vmov q0, q8 -+ sub r5, #24 -+ vmov q1, q9 -+ vmov q2, q10 -+1: -+ cmp r5, #12-48 -+ blt 1f -+ vst3.16 {d0, d2, d4}, [r0]! -+ beq 11b -+ vmov d0, d1 -+ sub r5, #12 -+ vmov d2, d3 -+ vmov d4, d5 -+1: -+ cmp r5, #6-48 -+ add r4, r0, #6 @ avoid [r0]! on sequential instructions -+ blt 1f -+ vst3.16 {d0[0], d2[0], d4[0]}, [r0] -+ vst3.16 {d0[1], d2[1], d4[1]}, [r4] -+ add r0, #12 -+ beq 11b -+ vmov s0, s1 -+ sub r5, #6 -+ vmov s4, s5 -+ vmov s8, s9 -+1: -+ cmp r5, #3-48 -+ blt 1f -+ vst3.16 {d0[0], d2[0], d4[0]}, [r0]! -+ beq 11b -+ sub r5, #3 -+ vshr.u32 d0, #16 -+ vshr.u32 d2, #16 -+1: -+ cmp r5, #2-48 -+ blt 1f -+ vst2.16 {d0[0], d2[0]}, [r0]! -+ b 11b -+1: -+ vst1.16 {d0[0]}, [r0]! -+ b 11b -+ -+endfunc -+ -+ -+ ---- /dev/null -+++ b/libavutil/arm/rpi_sand_neon.h -@@ -0,0 +1,99 @@ -+/* -+Copyright (c) 2020 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox -+*/ -+ -+#ifndef AVUTIL_ARM_SAND_NEON_H -+#define AVUTIL_ARM_SAND_NEON_H -+ -+void ff_rpi_sand128b_stripe_to_8_10( -+ uint8_t * dest, // [r0] -+ const uint8_t * src1, // [r1] -+ const uint8_t * src2, // [r2] -+ unsigned int lines); // [r3] -+ -+void ff_rpi_sand8_lines_to_planar_y8( -+ uint8_t * dest, // [r0] -+ unsigned int dst_stride, // [r1] -+ const uint8_t * src, // [r2] -+ unsigned int src_stride1, // [r3] Ignored - assumed 128 -+ unsigned int src_stride2, // [sp, #0] -> r3 -+ unsigned int _x, // [sp, #4] Ignored - 0 -+ unsigned int y, // [sp, #8] (r7 in prefix) -+ unsigned int _w, // [sp, #12] -> r6 (cur r5) -+ unsigned int h); // [sp, #16] -> r7 -+ -+void ff_rpi_sand8_lines_to_planar_c8( -+ uint8_t * dst_u, // [r0] -+ unsigned int dst_stride_u, // [r1] -+ uint8_t * dst_v, // [r2] -+ unsigned int dst_stride_v, // [r3] -+ const uint8_t * src, // [sp, #0] -> r4, r5 -+ unsigned int stride1, // [sp, #4] 128 -+ unsigned int stride2, // [sp, #8] -> r8 -+ unsigned int _x, // [sp, #12] 0 -+ unsigned int y, // [sp, #16] (r7 in prefix) -+ unsigned int _w, // [sp, #20] -> r12, r6 -+ unsigned int h); // [sp, #24] -> r7 -+ -+void ff_rpi_sand30_lines_to_planar_y16( -+ uint8_t * dest, // [r0] -+ unsigned int dst_stride, // [r1] -+ const uint8_t * src, // [r2] -+ unsigned int src_stride1, // [r3] Ignored - assumed 128 -+ unsigned int src_stride2, // [sp, #0] -> r3 -+ unsigned int _x, // [sp, #4] Ignored - 0 -+ unsigned int y, // [sp, #8] (r7 in prefix) -+ unsigned int _w, // [sp, #12] -> r6 (cur r5) -+ unsigned int h); // [sp, #16] -> r7 -+ -+void ff_rpi_sand30_lines_to_planar_c16( -+ uint8_t * dst_u, // [r0] -+ unsigned int dst_stride_u, // [r1] -+ uint8_t * dst_v, // [r2] -+ unsigned int dst_stride_v, // [r3] -+ const uint8_t * src, // [sp, #0] -> r4, r5 -+ unsigned int stride1, // [sp, #4] 128 -+ unsigned int stride2, // [sp, #8] -> r8 -+ unsigned int _x, // [sp, #12] 0 -+ unsigned int y, // [sp, #16] (r7 in prefix) -+ unsigned int _w, // [sp, #20] -> r6, r9 -+ unsigned int h); // [sp, #24] -> r7 -+ -+void ff_rpi_sand30_lines_to_planar_p010( -+ uint8_t * dest, // [r0] -+ unsigned int dst_stride, // [r1] -+ const uint8_t * src, // [r2] -+ unsigned int src_stride1, // [r3] Ignored - assumed 128 -+ unsigned int src_stride2, // [sp, #0] -> r3 -+ unsigned int _x, // [sp, #4] Ignored - 0 -+ unsigned int y, // [sp, #8] (r7 in prefix) -+ unsigned int _w, // [sp, #12] -> r6 (cur r5) -+ unsigned int h); // [sp, #16] -> r7 -+ -+#endif // AVUTIL_ARM_SAND_NEON_H -+ ---- a/libavutil/frame.c -+++ b/libavutil/frame.c -@@ -16,6 +16,8 @@ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+#include "config.h" -+ - #include "channel_layout.h" - #include "avassert.h" - #include "buffer.h" -@@ -26,6 +28,9 @@ - #include "mem.h" - #include "samplefmt.h" - #include "hwcontext.h" -+#if CONFIG_SAND -+#include "rpi_sand_fns.h" -+#endif - - #if FF_API_FRAME_GET_SET - MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) -@@ -902,6 +907,12 @@ int av_frame_apply_cropping(AVFrame *fra - (frame->crop_top + frame->crop_bottom) >= frame->height) - return AVERROR(ERANGE); - -+#if CONFIG_SAND -+ // Sand cannot be cropped - do not try -+ if (av_rpi_is_sand_format(frame->format)) -+ return 0; -+#endif -+ - desc = av_pix_fmt_desc_get(frame->format); - if (!desc) - return AVERROR_BUG; ---- a/libavutil/frame.h -+++ b/libavutil/frame.h -@@ -968,6 +968,16 @@ int av_frame_apply_cropping(AVFrame *fra - */ - const char *av_frame_side_data_name(enum AVFrameSideDataType type); - -+ -+static inline int av_frame_cropped_width(const AVFrame * const frame) -+{ -+ return frame->width - (frame->crop_left + frame->crop_right); -+} -+static inline int av_frame_cropped_height(const AVFrame * const frame) -+{ -+ return frame->height - (frame->crop_top + frame->crop_bottom); -+} -+ - /** - * @} - */ ---- a/libavutil/hwcontext_drm.c -+++ b/libavutil/hwcontext_drm.c -@@ -19,8 +19,10 @@ - #include - #include - #include -+#include - - #include -+#include - #include - - #include "avassert.h" -@@ -28,6 +30,11 @@ - #include "hwcontext_drm.h" - #include "hwcontext_internal.h" - #include "imgutils.h" -+#include "libavutil/rpi_sand_fns.h" -+ -+#include -+#include -+#include - - - static void drm_device_free(AVHWDeviceContext *hwdev) -@@ -43,6 +50,11 @@ static int drm_device_create(AVHWDeviceC - AVDRMDeviceContext *hwctx = hwdev->hwctx; - drmVersionPtr version; - -+ if (device == NULL) { -+ hwctx->fd = -1; -+ return 0; -+ } -+ - hwctx->fd = open(device, O_RDWR); - if (hwctx->fd < 0) - return AVERROR(errno); -@@ -85,18 +97,37 @@ static int drm_get_buffer(AVHWFramesCont - typedef struct DRMMapping { - // Address and length of each mmap()ed region. - int nb_regions; -+ unsigned int dmaflags; - void *address[AV_DRM_MAX_PLANES]; - size_t length[AV_DRM_MAX_PLANES]; -+ int fds[AV_DRM_MAX_PLANES]; - } DRMMapping; - -+static int dmasync(const int fd, const unsigned int flags) -+{ -+ struct dma_buf_sync sync = { -+ .flags = flags -+ }; -+ while (ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync) == -1) { -+ const int err = errno; -+ if (errno == EINTR) -+ continue; -+ av_log(NULL, AV_LOG_WARNING, "%s: ioctl failed: flags=%#x\n", __func__, flags); -+ return -err; -+ } -+ return 0; -+} -+ - static void drm_unmap_frame(AVHWFramesContext *hwfc, - HWMapDescriptor *hwmap) - { - DRMMapping *map = hwmap->priv; - int i; - -- for (i = 0; i < map->nb_regions; i++) -+ for (i = 0; i < map->nb_regions; i++) { - munmap(map->address[i], map->length[i]); -+ dmasync(map->fds[i], DMA_BUF_SYNC_END | map->dmaflags); -+ } - - av_free(map); - } -@@ -114,15 +145,28 @@ static int drm_map_frame(AVHWFramesConte - if (!map) - return AVERROR(ENOMEM); - -+ for (i = 0; i < AV_DRM_MAX_PLANES; i++) -+ map->fds[i] = -1; -+ - mmap_prot = 0; -- if (flags & AV_HWFRAME_MAP_READ) -+ if (flags & AV_HWFRAME_MAP_READ) { -+ map->dmaflags |= DMA_BUF_SYNC_READ; - mmap_prot |= PROT_READ; -- if (flags & AV_HWFRAME_MAP_WRITE) -+ } -+ if (flags & AV_HWFRAME_MAP_WRITE) { -+ map->dmaflags |= DMA_BUF_SYNC_WRITE; - mmap_prot |= PROT_WRITE; -+ } -+ -+ if (dst->format == AV_PIX_FMT_NONE) -+ dst->format = hwfc->sw_format; - - av_assert0(desc->nb_objects <= AV_DRM_MAX_PLANES); - for (i = 0; i < desc->nb_objects; i++) { -- addr = mmap(NULL, desc->objects[i].size, mmap_prot, MAP_SHARED, -+ dmasync(desc->objects[i].fd, DMA_BUF_SYNC_START | map->dmaflags); -+ map->fds[i] = desc->objects[i].fd; -+ -+ addr = mmap(NULL, desc->objects[i].size, mmap_prot, MAP_SHARED | MAP_POPULATE, - desc->objects[i].fd, 0); - if (addr == MAP_FAILED) { - err = AVERROR(errno); -@@ -151,6 +195,23 @@ static int drm_map_frame(AVHWFramesConte - - dst->width = src->width; - dst->height = src->height; -+ dst->crop_top = src->crop_top; -+ dst->crop_bottom = src->crop_bottom; -+ dst->crop_left = src->crop_left; -+ dst->crop_right = src->crop_right; -+ -+#if CONFIG_SAND -+ // Rework for sand frames -+ if (av_rpi_is_sand_frame(dst)) { -+ // As it stands the sand formats hold stride2 in linesize[3] -+ // linesize[0] & [1] contain stride1 which is always 128 for everything we do -+ // * Arguably this should be reworked s.t. stride2 is in linesize[0] & [1] -+ dst->linesize[3] = fourcc_mod_broadcom_param(desc->objects[0].format_modifier); -+ dst->linesize[0] = 128; -+ dst->linesize[1] = 128; -+ // *** Are we sure src->height is actually what we want ??? -+ } -+#endif - - err = ff_hwframe_map_create(src->hw_frames_ctx, dst, src, - &drm_unmap_frame, map); -@@ -160,7 +221,9 @@ static int drm_map_frame(AVHWFramesConte - return 0; - - fail: -- for (i = 0; i < desc->nb_objects; i++) { -+ for (i = 0; i < AV_DRM_MAX_PLANES; i++) { -+ if (map->fds[i] != -1) -+ dmasync(map->fds[i], DMA_BUF_SYNC_END | map->dmaflags); - if (map->address[i]) - munmap(map->address[i], map->length[i]); - } -@@ -178,7 +241,15 @@ static int drm_transfer_get_formats(AVHW - if (!pix_fmts) - return AVERROR(ENOMEM); - -- pix_fmts[0] = ctx->sw_format; -+ // **** Offer native sand too ???? -+ pix_fmts[0] = -+#if CONFIG_SAND -+ ctx->sw_format == AV_PIX_FMT_RPI4_8 || ctx->sw_format == AV_PIX_FMT_SAND128 ? -+ AV_PIX_FMT_YUV420P : -+ ctx->sw_format == AV_PIX_FMT_RPI4_10 ? -+ AV_PIX_FMT_YUV420P10LE : -+#endif -+ ctx->sw_format; - pix_fmts[1] = AV_PIX_FMT_NONE; - - *formats = pix_fmts; -@@ -197,18 +268,80 @@ static int drm_transfer_data_from(AVHWFr - map = av_frame_alloc(); - if (!map) - return AVERROR(ENOMEM); -- map->format = dst->format; - -+ // Map to default -+ map->format = AV_PIX_FMT_NONE; - err = drm_map_frame(hwfc, map, src, AV_HWFRAME_MAP_READ); - if (err) - goto fail; - -- map->width = dst->width; -- map->height = dst->height; -+#if 0 -+ av_log(hwfc, AV_LOG_INFO, "%s: src fmt=%d (%d), dst fmt=%d (%d) s=%dx%d l=%d/%d/%d/%d, d=%dx%d l=%d/%d/%d\n", __func__, -+ map->hwfc_format, AV_PIX_FMT_RPI4_8, dst->format, AV_PIX_FMT_YUV420P10LE, -+ map->width, map->height, -+ map->linesize[0], -+ map->linesize[1], -+ map->linesize[2], -+ map->linesize[3], -+ dst->width, dst->height, -+ dst->linesize[0], -+ dst->linesize[1], -+ dst->linesize[2]); -+#endif -+#if CONFIG_SAND -+ if (av_rpi_is_sand_frame(map)) { -+ // Preserve crop - later ffmpeg code assumes that we have in that it -+ // overwrites any crop that we create with the old values -+ unsigned int stride2 = map->linesize[3]; -+ const unsigned int w = FFMIN(dst->width, map->width); -+ const unsigned int h = FFMIN(dst->height, map->height); -+ -+ if (map->format == AV_PIX_FMT_RPI4_8 && dst->format == AV_PIX_FMT_YUV420P) { -+ av_rpi_sand_to_planar_y8(dst->data[0], dst->linesize[0], -+ map->data[0], -+ 128, stride2, -+ 0, 0, w, h); -+ av_rpi_sand_to_planar_c8(dst->data[1], dst->linesize[1], -+ dst->data[2], dst->linesize[2], -+ map->data[1], -+ 128, stride2, -+ 0, 0, w / 2, h / 2); -+ } -+ else if (map->format == AV_PIX_FMT_RPI4_10 && dst->format == AV_PIX_FMT_YUV420P10LE) { -+ av_rpi_sand30_to_planar_y16(dst->data[0], dst->linesize[0], -+ map->data[0], -+ 128, stride2, -+ 0, 0, w, h); -+ av_rpi_sand30_to_planar_c16(dst->data[1], dst->linesize[1], -+ dst->data[2], dst->linesize[2], -+ map->data[1], -+ 128, stride2, -+ 0, 0, w / 2, h / 2); -+ } -+ else -+ { -+ av_log(hwfc, AV_LOG_ERROR, "%s: Incompatible output pixfmt for sand\n", __func__); -+ err = AVERROR(EINVAL); -+ goto fail; -+ } -+ -+ dst->width = w; -+ dst->height = h; -+ } -+ else -+#endif -+ { -+ // Kludge mapped h/w s.t. frame_copy works -+ map->width = dst->width; -+ map->height = dst->height; -+ err = av_frame_copy(dst, map); -+ } - -- err = av_frame_copy(dst, map); - if (err) -+ { -+ av_log(hwfc, AV_LOG_ERROR, "%s: Copy fail\n", __func__); - goto fail; -+ } - - err = 0; - fail: -@@ -223,7 +356,10 @@ static int drm_transfer_data_to(AVHWFram - int err; - - if (src->width > hwfc->width || src->height > hwfc->height) -+ { -+ av_log(hwfc, AV_LOG_ERROR, "%s: H/w mismatch: %d/%d, %d/%d\n", __func__, dst->width, hwfc->width, dst->height, hwfc->height); - return AVERROR(EINVAL); -+ } - - map = av_frame_alloc(); - if (!map) ---- a/libavutil/pixdesc.c -+++ b/libavutil/pixdesc.c -@@ -2371,6 +2371,38 @@ static const AVPixFmtDescriptor av_pix_f - .name = "vulkan", - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, -+ [AV_PIX_FMT_SAND128] = { -+ .name = "sand128", -+ .nb_components = 3, -+ .log2_chroma_w = 1, -+ .log2_chroma_h = 1, -+ .comp = { -+ { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */ -+ { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */ -+ { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */ -+ }, -+ .flags = 0, -+ }, -+ [AV_PIX_FMT_SAND64_10] = { -+ .name = "sand64_10", -+ .nb_components = 3, -+ .log2_chroma_w = 1, -+ .log2_chroma_h = 1, -+ .comp = { -+ { 0, 2, 0, 0, 10, 0, 9, 1 }, /* Y */ -+ { 1, 4, 0, 0, 10, 1, 9, 1 }, /* U */ -+ { 1, 4, 1, 0, 10, 1, 9, 2 }, /* V */ -+ }, -+ .flags = 0, -+ }, -+ [AV_PIX_FMT_RPI4_8] = { -+ .name = "rpi", -+ .flags = AV_PIX_FMT_FLAG_HWACCEL, -+ }, -+ [AV_PIX_FMT_RPI4_10] = { -+ .name = "rpi", -+ .flags = AV_PIX_FMT_FLAG_HWACCEL, -+ }, - }; - #if FF_API_PLUS1_MINUS1 - FF_ENABLE_DEPRECATION_WARNINGS ---- a/libavutil/pixfmt.h -+++ b/libavutil/pixfmt.h -@@ -357,6 +357,12 @@ enum AVPixelFormat { - - AV_PIX_FMT_Y210BE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, big-endian - AV_PIX_FMT_Y210LE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian -+// RPI - not on ifdef so can be got at by calling progs -+ AV_PIX_FMT_SAND128, ///< 4:2:0 8-bit 128x*Y stripe, 64x*UV stripe, then next x stripe, mysterious padding -+ AV_PIX_FMT_SAND64_10, ///< 4:2:0 10-bit 64x*Y stripe, 32x*UV stripe, then next x stripe, mysterious padding -+ AV_PIX_FMT_SAND64_16, ///< 4:2:0 16-bit 64x*Y stripe, 32x*UV stripe, then next x stripe, mysterious padding -+ AV_PIX_FMT_RPI4_8, -+ AV_PIX_FMT_RPI4_10, - - AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions - }; ---- /dev/null -+++ b/libavutil/rpi_sand_fn_pw.h -@@ -0,0 +1,227 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox -+*/ -+ -+// * Included twice from rpi_sand_fn with different PW -+ -+#define STRCAT(x,y) x##y -+ -+#if PW == 1 -+#define pixel uint8_t -+#define FUNC(f) STRCAT(f, 8) -+#elif PW == 2 -+#define pixel uint16_t -+#define FUNC(f) STRCAT(f, 16) -+#else -+#error Unexpected PW -+#endif -+ -+// Fetches a single patch - offscreen fixup not done here -+// w <= stride1 -+// unclipped -+void FUNC(av_rpi_sand_to_planar_y)(uint8_t * dst, const unsigned int dst_stride, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h) -+{ -+ const unsigned int x = _x; -+ const unsigned int w = _w; -+ const unsigned int mask = stride1 - 1; -+ -+#if PW == 1 && HAVE_SAND_ASM -+ if (_x == 0) { -+ ff_rpi_sand8_lines_to_planar_y8(dst, dst_stride, -+ src, stride1, stride2, _x, y, _w, h); -+ return; -+ } -+#endif -+ -+ if ((x & ~mask) == ((x + w) & ~mask)) { -+ // All in one sand stripe -+ const uint8_t * p = src + (x & mask) + y * stride1 + (x & ~mask) * stride2; -+ for (unsigned int i = 0; i != h; ++i, dst += dst_stride, p += stride1) { -+ memcpy(dst, p, w); -+ } -+ } -+ else -+ { -+ // Two+ stripe -+ const unsigned int sstride = stride1 * stride2; -+ const uint8_t * p1 = src + (x & mask) + y * stride1 + (x & ~mask) * stride2; -+ const uint8_t * p2 = p1 + sstride - (x & mask); -+ const unsigned int w1 = stride1 - (x & mask); -+ const unsigned int w3 = (x + w) & mask; -+ const unsigned int w2 = w - (w1 + w3); -+ -+ for (unsigned int i = 0; i != h; ++i, dst += dst_stride, p1 += stride1, p2 += stride1) { -+ unsigned int j; -+ const uint8_t * p = p2; -+ uint8_t * d = dst; -+ memcpy(d, p1, w1); -+ d += w1; -+ for (j = 0; j < w2; j += stride1, d += stride1, p += sstride) { -+ memcpy(d, p, stride1); -+ } -+ memcpy(d, p, w3); -+ } -+ } -+} -+ -+// x & w in bytes but not of interleave (i.e. offset = x*2 for U&V) -+ -+void FUNC(av_rpi_sand_to_planar_c)(uint8_t * dst_u, const unsigned int dst_stride_u, -+ uint8_t * dst_v, const unsigned int dst_stride_v, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h) -+{ -+ const unsigned int x = _x * 2; -+ const unsigned int w = _w * 2; -+ const unsigned int mask = stride1 - 1; -+ -+#if PW == 1 && HAVE_SAND_ASM -+ if (_x == 0) { -+ ff_rpi_sand8_lines_to_planar_c8(dst_u, dst_stride_u, dst_v, dst_stride_v, -+ src, stride1, stride2, _x, y, _w, h); -+ return; -+ } -+#endif -+ -+ if ((x & ~mask) == ((x + w) & ~mask)) { -+ // All in one sand stripe -+ const uint8_t * p1 = src + (x & mask) + y * stride1 + (x & ~mask) * stride2; -+ for (unsigned int i = 0; i != h; ++i, dst_u += dst_stride_u, dst_v += dst_stride_v, p1 += stride1) { -+ pixel * du = (pixel *)dst_u; -+ pixel * dv = (pixel *)dst_v; -+ const pixel * p = (const pixel *)p1; -+ for (unsigned int k = 0; k < w; k += 2 * PW) { -+ *du++ = *p++; -+ *dv++ = *p++; -+ } -+ } -+ } -+ else -+ { -+ // Two+ stripe -+ const unsigned int sstride = stride1 * stride2; -+ const unsigned int sstride_p = (sstride - stride1) / PW; -+ -+ const uint8_t * p1 = src + (x & mask) + y * stride1 + (x & ~mask) * stride2; -+ const uint8_t * p2 = p1 + sstride - (x & mask); -+ const unsigned int w1 = stride1 - (x & mask); -+ const unsigned int w3 = (x + w) & mask; -+ const unsigned int w2 = w - (w1 + w3); -+ -+ for (unsigned int i = 0; i != h; ++i, dst_u += dst_stride_u, dst_v += dst_stride_v, p1 += stride1, p2 += stride1) { -+ unsigned int j; -+ const pixel * p = (const pixel *)p1; -+ pixel * du = (pixel *)dst_u; -+ pixel * dv = (pixel *)dst_v; -+ for (unsigned int k = 0; k < w1; k += 2 * PW) { -+ *du++ = *p++; -+ *dv++ = *p++; -+ } -+ for (j = 0, p = (const pixel *)p2; j < w2; j += stride1, p += sstride_p) { -+ for (unsigned int k = 0; k < stride1; k += 2 * PW) { -+ *du++ = *p++; -+ *dv++ = *p++; -+ } -+ } -+ for (unsigned int k = 0; k < w3; k += 2 * PW) { -+ *du++ = *p++; -+ *dv++ = *p++; -+ } -+ } -+ } -+} -+ -+void FUNC(av_rpi_planar_to_sand_c)(uint8_t * dst_c, -+ unsigned int stride1, unsigned int stride2, -+ const uint8_t * src_u, const unsigned int src_stride_u, -+ const uint8_t * src_v, const unsigned int src_stride_v, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h) -+{ -+ const unsigned int x = _x * 2; -+ const unsigned int w = _w * 2; -+ const unsigned int mask = stride1 - 1; -+ if ((x & ~mask) == ((x + w) & ~mask)) { -+ // All in one sand stripe -+ uint8_t * p1 = dst_c + (x & mask) + y * stride1 + (x & ~mask) * stride2; -+ for (unsigned int i = 0; i != h; ++i, src_u += src_stride_u, src_v += src_stride_v, p1 += stride1) { -+ const pixel * su = (const pixel *)src_u; -+ const pixel * sv = (const pixel *)src_v; -+ pixel * p = (pixel *)p1; -+ for (unsigned int k = 0; k < w; k += 2 * PW) { -+ *p++ = *su++; -+ *p++ = *sv++; -+ } -+ } -+ } -+ else -+ { -+ // Two+ stripe -+ const unsigned int sstride = stride1 * stride2; -+ const unsigned int sstride_p = (sstride - stride1) / PW; -+ -+ const uint8_t * p1 = dst_c + (x & mask) + y * stride1 + (x & ~mask) * stride2; -+ const uint8_t * p2 = p1 + sstride - (x & mask); -+ const unsigned int w1 = stride1 - (x & mask); -+ const unsigned int w3 = (x + w) & mask; -+ const unsigned int w2 = w - (w1 + w3); -+ -+ for (unsigned int i = 0; i != h; ++i, src_u += src_stride_u, src_v += src_stride_v, p1 += stride1, p2 += stride1) { -+ unsigned int j; -+ const pixel * su = (const pixel *)src_u; -+ const pixel * sv = (const pixel *)src_v; -+ pixel * p = (pixel *)p1; -+ for (unsigned int k = 0; k < w1; k += 2 * PW) { -+ *p++ = *su++; -+ *p++ = *sv++; -+ } -+ for (j = 0, p = (pixel *)p2; j < w2; j += stride1, p += sstride_p) { -+ for (unsigned int k = 0; k < stride1; k += 2 * PW) { -+ *p++ = *su++; -+ *p++ = *sv++; -+ } -+ } -+ for (unsigned int k = 0; k < w3; k += 2 * PW) { -+ *p++ = *su++; -+ *p++ = *sv++; -+ } -+ } -+ } -+} -+ -+ -+#undef pixel -+#undef STRCAT -+#undef FUNC -+ ---- /dev/null -+++ b/libavutil/rpi_sand_fns.c -@@ -0,0 +1,356 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox -+*/ -+ -+#include "config.h" -+#include -+#include -+#include "rpi_sand_fns.h" -+#include "avassert.h" -+#include "frame.h" -+ -+#if ARCH_ARM && HAVE_NEON -+#include "arm/rpi_sand_neon.h" -+#define HAVE_SAND_ASM 1 -+#elif ARCH_AARCH64 && HAVE_NEON -+#include "aarch64/rpi_sand_neon.h" -+#define HAVE_SAND_ASM 1 -+#else -+#define HAVE_SAND_ASM 0 -+#endif -+ -+#define PW 1 -+#include "rpi_sand_fn_pw.h" -+#undef PW -+ -+#define PW 2 -+#include "rpi_sand_fn_pw.h" -+#undef PW -+ -+#if 1 -+// Simple round -+static void cpy16_to_8(uint8_t * dst, const uint8_t * _src, unsigned int n, const unsigned int shr) -+{ -+ const unsigned int rnd = (1 << shr) >> 1; -+ const uint16_t * src = (const uint16_t *)_src; -+ -+ for (; n != 0; --n) { -+ *dst++ = (*src++ + rnd) >> shr; -+ } -+} -+#else -+// Dithered variation -+static void cpy16_to_8(uint8_t * dst, const uint8_t * _src, unsigned int n, const unsigned int shr) -+{ -+ unsigned int rnd = (1 << shr) >> 1; -+ const unsigned int mask = ((1 << shr) - 1); -+ const uint16_t * src = (const uint16_t *)_src; -+ -+ for (; n != 0; --n) { -+ rnd = *src++ + (rnd & mask); -+ *dst++ = rnd >> shr; -+ } -+} -+#endif -+ -+// Fetches a single patch - offscreen fixup not done here -+// w <= stride1 -+// unclipped -+// _x & _w in pixels, strides in bytes -+void av_rpi_sand30_to_planar_y16(uint8_t * dst, const unsigned int dst_stride, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h) -+{ -+ const unsigned int x0 = (_x / 3) * 4; // Byte offset of the word -+ const unsigned int xskip0 = _x - (x0 >> 2) * 3; -+ const unsigned int x1 = ((_x + _w) / 3) * 4; -+ const unsigned int xrem1 = _x + _w - (x1 >> 2) * 3; -+ const unsigned int mask = stride1 - 1; -+ const uint8_t * p0 = src + (x0 & mask) + y * stride1 + (x0 & ~mask) * stride2; -+ const unsigned int slice_inc = ((stride2 - 1) * stride1) >> 2; // RHS of a stripe to LHS of next in words -+ -+#if HAVE_SAND_ASM -+ if (_x == 0) { -+ ff_rpi_sand30_lines_to_planar_y16(dst, dst_stride, src, stride1, stride2, _x, y, _w, h); -+ return; -+ } -+#endif -+ -+ if (x0 == x1) { -+ // ******************* -+ // Partial single word xfer -+ return; -+ } -+ -+ for (unsigned int i = 0; i != h; ++i, dst += dst_stride, p0 += stride1) -+ { -+ unsigned int x = x0; -+ const uint32_t * p = (const uint32_t *)p0; -+ uint16_t * d = (uint16_t *)dst; -+ -+ if (xskip0 != 0) { -+ const uint32_t p3 = *p++; -+ -+ if (xskip0 == 1) -+ *d++ = (p3 >> 10) & 0x3ff; -+ *d++ = (p3 >> 20) & 0x3ff; -+ -+ if (((x += 4) & mask) == 0) -+ p += slice_inc; -+ } -+ -+ while (x != x1) { -+ const uint32_t p3 = *p++; -+ *d++ = p3 & 0x3ff; -+ *d++ = (p3 >> 10) & 0x3ff; -+ *d++ = (p3 >> 20) & 0x3ff; -+ -+ if (((x += 4) & mask) == 0) -+ p += slice_inc; -+ } -+ -+ if (xrem1 != 0) { -+ const uint32_t p3 = *p; -+ -+ *d++ = p3 & 0x3ff; -+ if (xrem1 == 2) -+ *d++ = (p3 >> 10) & 0x3ff; -+ } -+ } -+} -+ -+ -+void av_rpi_sand30_to_planar_c16(uint8_t * dst_u, const unsigned int dst_stride_u, -+ uint8_t * dst_v, const unsigned int dst_stride_v, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h) -+{ -+ const unsigned int x0 = (_x / 3) * 8; // Byte offset of the word -+ const unsigned int xskip0 = _x - (x0 >> 3) * 3; -+ const unsigned int x1 = ((_x + _w) / 3) * 8; -+ const unsigned int xrem1 = _x + _w - (x1 >> 3) * 3; -+ const unsigned int mask = stride1 - 1; -+ const uint8_t * p0 = src + (x0 & mask) + y * stride1 + (x0 & ~mask) * stride2; -+ const unsigned int slice_inc = ((stride2 - 1) * stride1) >> 2; // RHS of a stripe to LHS of next in words -+ -+#if HAVE_SAND_ASM -+ if (_x == 0) { -+ ff_rpi_sand30_lines_to_planar_c16(dst_u, dst_stride_u, dst_v, dst_stride_v, -+ src, stride1, stride2, _x, y, _w, h); -+ return; -+ } -+#endif -+ -+ if (x0 == x1) { -+ // ******************* -+ // Partial single word xfer -+ return; -+ } -+ -+ for (unsigned int i = 0; i != h; ++i, dst_u += dst_stride_u, dst_v += dst_stride_v, p0 += stride1) -+ { -+ unsigned int x = x0; -+ const uint32_t * p = (const uint32_t *)p0; -+ uint16_t * du = (uint16_t *)dst_u; -+ uint16_t * dv = (uint16_t *)dst_v; -+ -+ if (xskip0 != 0) { -+ const uint32_t p3a = *p++; -+ const uint32_t p3b = *p++; -+ -+ if (xskip0 == 1) -+ { -+ *du++ = (p3a >> 20) & 0x3ff; -+ *dv++ = (p3b >> 0) & 0x3ff; -+ } -+ *du++ = (p3b >> 10) & 0x3ff; -+ *dv++ = (p3b >> 20) & 0x3ff; -+ -+ if (((x += 8) & mask) == 0) -+ p += slice_inc; -+ } -+ -+ while (x != x1) { -+ const uint32_t p3a = *p++; -+ const uint32_t p3b = *p++; -+ -+ *du++ = p3a & 0x3ff; -+ *dv++ = (p3a >> 10) & 0x3ff; -+ *du++ = (p3a >> 20) & 0x3ff; -+ *dv++ = p3b & 0x3ff; -+ *du++ = (p3b >> 10) & 0x3ff; -+ *dv++ = (p3b >> 20) & 0x3ff; -+ -+ if (((x += 8) & mask) == 0) -+ p += slice_inc; -+ } -+ -+ if (xrem1 != 0) { -+ const uint32_t p3a = *p++; -+ const uint32_t p3b = *p++; -+ -+ *du++ = p3a & 0x3ff; -+ *dv++ = (p3a >> 10) & 0x3ff; -+ if (xrem1 == 2) -+ { -+ *du++ = (p3a >> 20) & 0x3ff; -+ *dv++ = p3b & 0x3ff; -+ } -+ } -+ } -+} -+ -+ -+// w/h in pixels -+void av_rpi_sand16_to_sand8(uint8_t * dst, const unsigned int dst_stride1, const unsigned int dst_stride2, -+ const uint8_t * src, const unsigned int src_stride1, const unsigned int src_stride2, -+ unsigned int w, unsigned int h, const unsigned int shr) -+{ -+ const unsigned int n = dst_stride1 / 2; -+ unsigned int j; -+ -+ // This is true for our current layouts -+ av_assert0(dst_stride1 == src_stride1); -+ -+ // As we have the same stride1 for src & dest and src is wider than dest -+ // then if we loop on src we can always write contiguously to dest -+ // We make no effort to copy an exact width - round up to nearest src stripe -+ // as we will always have storage in dest for that -+ -+#if ARCH_ARM && HAVE_NEON -+ if (shr == 3 && src_stride1 == 128) { -+ for (j = 0; j + n < w; j += dst_stride1) { -+ uint8_t * d = dst + j * dst_stride2; -+ const uint8_t * s1 = src + j * 2 * src_stride2; -+ const uint8_t * s2 = s1 + src_stride1 * src_stride2; -+ -+ ff_rpi_sand128b_stripe_to_8_10(d, s1, s2, h); -+ } -+ } -+ else -+#endif -+ { -+ for (j = 0; j + n < w; j += dst_stride1) { -+ uint8_t * d = dst + j * dst_stride2; -+ const uint8_t * s1 = src + j * 2 * src_stride2; -+ const uint8_t * s2 = s1 + src_stride1 * src_stride2; -+ -+ for (unsigned int i = 0; i != h; ++i, s1 += src_stride1, s2 += src_stride1, d += dst_stride1) { -+ cpy16_to_8(d, s1, n, shr); -+ cpy16_to_8(d + n, s2, n, shr); -+ } -+ } -+ } -+ -+ // Fix up a trailing dest half stripe -+ if (j < w) { -+ uint8_t * d = dst + j * dst_stride2; -+ const uint8_t * s1 = src + j * 2 * src_stride2; -+ -+ for (unsigned int i = 0; i != h; ++i, s1 += src_stride1, d += dst_stride1) { -+ cpy16_to_8(d, s1, n, shr); -+ } -+ } -+} -+ -+int av_rpi_sand_to_planar_frame(AVFrame * const dst, const AVFrame * const src) -+{ -+ const int w = av_frame_cropped_width(src); -+ const int h = av_frame_cropped_height(src); -+ const int x = src->crop_left; -+ const int y = src->crop_top; -+ -+ // We will crop as part of the conversion -+ dst->crop_top = 0; -+ dst->crop_left = 0; -+ dst->crop_bottom = 0; -+ dst->crop_right = 0; -+ -+ switch (src->format){ -+ case AV_PIX_FMT_SAND128: -+ case AV_PIX_FMT_RPI4_8: -+ switch (dst->format){ -+ case AV_PIX_FMT_YUV420P: -+ av_rpi_sand_to_planar_y8(dst->data[0], dst->linesize[0], -+ src->data[0], -+ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), -+ x, y, w, h); -+ av_rpi_sand_to_planar_c8(dst->data[1], dst->linesize[1], -+ dst->data[2], dst->linesize[2], -+ src->data[1], -+ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), -+ x/2, y/2, w/2, h/2); -+ break; -+ default: -+ return -1; -+ } -+ break; -+ case AV_PIX_FMT_SAND64_10: -+ switch (dst->format){ -+ case AV_PIX_FMT_YUV420P10: -+ av_rpi_sand_to_planar_y16(dst->data[0], dst->linesize[0], -+ src->data[0], -+ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), -+ x*2, y, w*2, h); -+ av_rpi_sand_to_planar_c16(dst->data[1], dst->linesize[1], -+ dst->data[2], dst->linesize[2], -+ src->data[1], -+ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), -+ x, y/2, w, h/2); -+ break; -+ default: -+ return -1; -+ } -+ break; -+ case AV_PIX_FMT_RPI4_10: -+ switch (dst->format){ -+ case AV_PIX_FMT_YUV420P10: -+ av_rpi_sand30_to_planar_y16(dst->data[0], dst->linesize[0], -+ src->data[0], -+ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), -+ x, y, w, h); -+ av_rpi_sand30_to_planar_c16(dst->data[1], dst->linesize[1], -+ dst->data[2], dst->linesize[2], -+ src->data[1], -+ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), -+ x/2, y/2, w/2, h/2); -+ break; -+ default: -+ return -1; -+ } -+ break; -+ default: -+ return -1; -+ } -+ -+ return av_frame_copy_props(dst, src); -+} ---- /dev/null -+++ b/libavutil/rpi_sand_fns.h -@@ -0,0 +1,183 @@ -+/* -+Copyright (c) 2018 Raspberry Pi (Trading) Ltd. -+All rights reserved. -+ -+Redistribution and use in source and binary forms, with or without -+modification, are permitted provided that the following conditions are met: -+ * Redistributions of source code must retain the above copyright -+ notice, this list of conditions and the following disclaimer. -+ * Redistributions in binary form must reproduce the above copyright -+ notice, this list of conditions and the following disclaimer in the -+ documentation and/or other materials provided with the distribution. -+ * Neither the name of the copyright holder nor the -+ names of its contributors may be used to endorse or promote products -+ derived from this software without specific prior written permission. -+ -+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY -+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ -+Authors: John Cox -+*/ -+ -+#ifndef AVUTIL_RPI_SAND_FNS -+#define AVUTIL_RPI_SAND_FNS -+ -+#include "libavutil/frame.h" -+ -+// For all these fns _x & _w are measured as coord * PW -+// For the C fns coords are in chroma pels (so luma / 2) -+// Strides are in bytes -+ -+void av_rpi_sand_to_planar_y8(uint8_t * dst, const unsigned int dst_stride, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+void av_rpi_sand_to_planar_y16(uint8_t * dst, const unsigned int dst_stride, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+ -+void av_rpi_sand_to_planar_c8(uint8_t * dst_u, const unsigned int dst_stride_u, -+ uint8_t * dst_v, const unsigned int dst_stride_v, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+void av_rpi_sand_to_planar_c16(uint8_t * dst_u, const unsigned int dst_stride_u, -+ uint8_t * dst_v, const unsigned int dst_stride_v, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+ -+void av_rpi_planar_to_sand_c8(uint8_t * dst_c, -+ unsigned int stride1, unsigned int stride2, -+ const uint8_t * src_u, const unsigned int src_stride_u, -+ const uint8_t * src_v, const unsigned int src_stride_v, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+void av_rpi_planar_to_sand_c16(uint8_t * dst_c, -+ unsigned int stride1, unsigned int stride2, -+ const uint8_t * src_u, const unsigned int src_stride_u, -+ const uint8_t * src_v, const unsigned int src_stride_v, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+ -+void av_rpi_sand30_to_planar_y16(uint8_t * dst, const unsigned int dst_stride, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+void av_rpi_sand30_to_planar_c16(uint8_t * dst_u, const unsigned int dst_stride_u, -+ uint8_t * dst_v, const unsigned int dst_stride_v, -+ const uint8_t * src, -+ unsigned int stride1, unsigned int stride2, -+ unsigned int _x, unsigned int y, -+ unsigned int _w, unsigned int h); -+ -+ -+// w/h in pixels -+void av_rpi_sand16_to_sand8(uint8_t * dst, const unsigned int dst_stride1, const unsigned int dst_stride2, -+ const uint8_t * src, const unsigned int src_stride1, const unsigned int src_stride2, -+ unsigned int w, unsigned int h, const unsigned int shr); -+ -+ -+// dst must contain required pixel format & allocated data buffers -+// Cropping on the src buffer will be honoured and dst crop will be set to zero -+int av_rpi_sand_to_planar_frame(AVFrame * const dst, const AVFrame * const src); -+ -+ -+static inline unsigned int av_rpi_sand_frame_stride1(const AVFrame * const frame) -+{ -+#ifdef RPI_ZC_SAND128_ONLY -+ // If we are sure we only only support 128 byte sand formats replace the -+ // var with a constant which should allow for better optimisation -+ return 128; -+#else -+ return frame->linesize[0]; -+#endif -+} -+ -+static inline unsigned int av_rpi_sand_frame_stride2(const AVFrame * const frame) -+{ -+ return frame->linesize[3]; -+} -+ -+ -+static inline int av_rpi_is_sand_format(const int format) -+{ -+ return (format >= AV_PIX_FMT_SAND128 && format <= AV_PIX_FMT_RPI4_10); -+} -+ -+static inline int av_rpi_is_sand_frame(const AVFrame * const frame) -+{ -+ return av_rpi_is_sand_format(frame->format); -+} -+ -+static inline int av_rpi_is_sand8_frame(const AVFrame * const frame) -+{ -+ return (frame->format == AV_PIX_FMT_SAND128 || frame->format == AV_PIX_FMT_RPI4_8); -+} -+ -+static inline int av_rpi_is_sand16_frame(const AVFrame * const frame) -+{ -+ return (frame->format >= AV_PIX_FMT_SAND64_10 && frame->format <= AV_PIX_FMT_SAND64_16); -+} -+ -+static inline int av_rpi_is_sand30_frame(const AVFrame * const frame) -+{ -+ return (frame->format == AV_PIX_FMT_RPI4_10); -+} -+ -+static inline int av_rpi_sand_frame_xshl(const AVFrame * const frame) -+{ -+ return av_rpi_is_sand8_frame(frame) ? 0 : 1; -+} -+ -+// If x is measured in bytes (not pixels) then this works for sand64_16 as -+// well as sand128 - but in the general case we work that out -+ -+static inline unsigned int av_rpi_sand_frame_off_y(const AVFrame * const frame, const unsigned int x_y, const unsigned int y) -+{ -+ const unsigned int stride1 = av_rpi_sand_frame_stride1(frame); -+ const unsigned int stride2 = av_rpi_sand_frame_stride2(frame); -+ const unsigned int x = x_y << av_rpi_sand_frame_xshl(frame); -+ const unsigned int x1 = x & (stride1 - 1); -+ const unsigned int x2 = x ^ x1; -+ -+ return x1 + stride1 * y + stride2 * x2; -+} -+ -+static inline unsigned int av_rpi_sand_frame_off_c(const AVFrame * const frame, const unsigned int x_c, const unsigned int y_c) -+{ -+ const unsigned int stride1 = av_rpi_sand_frame_stride1(frame); -+ const unsigned int stride2 = av_rpi_sand_frame_stride2(frame); -+ const unsigned int x = x_c << (av_rpi_sand_frame_xshl(frame) + 1); -+ const unsigned int x1 = x & (stride1 - 1); -+ const unsigned int x2 = x ^ x1; -+ -+ return x1 + stride1 * y_c + stride2 * x2; -+} -+ -+static inline uint8_t * av_rpi_sand_frame_pos_y(const AVFrame * const frame, const unsigned int x, const unsigned int y) -+{ -+ return frame->data[0] + av_rpi_sand_frame_off_y(frame, x, y); -+} -+ -+static inline uint8_t * av_rpi_sand_frame_pos_c(const AVFrame * const frame, const unsigned int x, const unsigned int y) -+{ -+ return frame->data[1] + av_rpi_sand_frame_off_c(frame, x, y); -+} -+ -+#endif -+ ---- /dev/null -+++ b/pi-util/BUILD.txt -@@ -0,0 +1,29 @@ -+Building Pi FFmpeg -+================== -+ -+Configuration: -+============= -+ -+These instructions work for cross compiles from Ubuntu 16.04 & Ubuntu -+18.04. I would expect most other linux environments to work but I haven't -+tried them. -+ -+pi-util/conf_pi2.sh -+ -+contains suitable options to build the code for Pi2/3. It expects to find -+git clones of -+ -+https://github.com/raspberrypi/tools -+https://github.com/raspberrypi/firmware -+ -+in the parent of the FFmpeg directory. I recommend using --depth 1 to avoid a -+lot of history you don't want. -+ -+If you have a copy of qasm.py in ../local/bin then the .qasm sources will be -+rebuilt. Otherwise the prebuilt .c & .h files will be used. -+Likewise ../local/bin/vasmvidcore_std will enable VPU code rebuild -+ -+pi-util/conf_p1.sh should configure for Pi1. Beware that as of this time -+H265 QPU acceleration is broken on Pi1 and so it is disabled. -+ -+ ---- /dev/null -+++ b/pi-util/NOTES.txt -@@ -0,0 +1,69 @@ -+Notes on the hevc_rpi decoder & associated support code -+------------------------------------------------------- -+ -+There are 3 main parts to the existing code: -+ -+1) The decoder - this is all in libavcodec as rpi_hevc*. -+ -+2) A few filters to deal with Sand frames and a small patch to -+automatically select the sand->i420 converter when required. -+ -+3) A kludge in ffmpeg.c to display the decoded video. This could & should -+be converted into a proper ffmpeg display module. -+ -+ -+Decoder -+------- -+ -+The decoder is a modified version of the existing ffmpeg hevc decoder. -+Generally it is ~100% faster than the existing ffmpeg hevc s/w decoder. -+More complex bitstreams can be up to ~200% faster but particularly easy -+streams can cut its advantage down to ~50%. This means that a Pi3+ can -+display nearly all 8-bit 1080p30 streams and with some overclocking it can -+display most lower bitrate 10-bit 1080p30 streams - this latter case is -+not helped by the requirement to downsample to 8-bit before display on a -+Pi. -+ -+It has had co-processor offload added for inter-pred and large block -+residual transform. Various parts have had optimized ARM NEON assembler -+added and the existing ARM asm sections have been profiled and -+re-optimized for A53. The main C code has been substantially reworked at -+its lower levels in an attempt to optimize it and minimize memory -+bandwidth. To some extent code paths that deal with frame types that it -+doesn't support have been pruned. -+ -+It outputs frames in Broadcom Sand format. This is a somewhat annoying -+layout that doesn't fit into ffmpegs standard frame descriptions. It has -+vertical stripes of 128 horizontal pixels (64 in 10 bit forms) with Y for -+the stripe followed by interleaved U & V, that is then followed by the Y -+for the next stripe, etc. The final stripe is always padded to -+stripe-width. This is used in an attempt to help with cache locality and -+cut down on the number of dram bank switches. It is annoying to use for -+inter-pred with conventional processing but the way the Pi QPU (which is -+used for inter-pred) works means that it has negligible downsides here and -+the improved memory performance exceeds the overhead of the increased -+complexity in the rest of the code. -+ -+Frames must be allocated out of GPU memory (as otherwise they can't be -+accessed by the co-processors). Utility functions (in rpi_zc.c) have been -+written to make this easier. As the frames are already in GPU memory they -+can be displayed by the Pi h/w without any further copying. -+ -+ -+Known non-features -+------------------ -+ -+Frame allocation should probably be done in some other way in order to fit -+into the standard framework better. -+ -+Sand frames are currently declared as software frames, there is an -+argument that they should be hardware frames but they aren't really. -+ -+There must be a better way of auto-selecting the hevc_rpi decoder over the -+normal s/w hevc decoder, but I became confused by the existing h/w -+acceleration framework and what I wanted to do didn't seem to fit in -+neatly. -+ -+Display should be a proper device rather than a kludge in ffmpeg.c -+ -+ ---- /dev/null -+++ b/pi-util/TESTMESA.txt -@@ -0,0 +1,82 @@ -+# Setup & Build instructions for testing Argon30 mesa support (on Pi4) -+ -+# These assume that the drm_mmal test for Sand8 has been built on this Pi -+# as build relies on many of the same files -+ -+# 1st get everything required to build ffmpeg -+# If sources aren't already enabled on your Pi then enable them -+sudo su -+sed "s/#deb-src/deb-src/" /etc/apt/sources.list > /tmp/sources.list -+sed "s/#deb-src/deb-src/" /etc/apt/sources.list.d/raspi.list > /tmp/raspi.list -+mv /tmp/sources.list /etc/apt/ -+mv /tmp/raspi.list /etc/apt/sources.list.d/ -+apt update -+ -+# Get dependancies -+sudo apt build-dep ffmpeg -+ -+sudo apt install meson libepoxy-dev libxcb-dri3-dev libxcb1-dev libx11-dev libx11-xcb-dev libdrm-dev -+ -+# Enable H265 V4L2 request decoder -+sudo su -+echo dtoverlay=rpivid-v4l2 >> /boot/config.txt -+# You may also want to add more CMA if you are going to try 4k videos -+# Change the dtoverlay=vc4-fkms-v3d line in config.txt to read -+# dtoverlay=vc4-fkms-v3d,cma-512 -+reboot -+# Check it has turned up -+ls -la /dev/video* -+# This should include video19 -+# crw-rw----+ 1 root video 81, 7 Aug 4 17:25 /dev/video19 -+ -+# Currently on the Pi the linux headers from the debian distro don't match -+# the kernel that we ship and we need to update them - hopefully this step -+# will be unneeded in the future -+sudo apt install git bc bison flex libssl-dev make -+git clone --depth=1 https://github.com/raspberrypi/linux --branch rpi-5.10.y -+cd linux -+KERNEL=kernel7l -+make bcm2711_defconfig -+make headers_install -+sudo cp -r usr/include/linux /usr/include -+cd .. -+ -+# Config - this builds a staticly linked ffmpeg which is easier for testing -+pi-util/conf_native.sh --noshared -+ -+# Build (this is a bit dull) -+# If you want to poke the source the libavdevice/egl_vout.c contains the -+# output code - -+cd out/armv7-static-rel -+ -+# Check that you have actually configured V4L2 request -+grep HEVC_V4L2REQUEST config.h -+# You are hoping for -+# #define CONFIG_HEVC_V4L2REQUEST_HWACCEL 1 -+# if you get 0 then the config has failed -+ -+make -j6 -+ -+# Grab test streams -+wget http://www.jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv -+wget http://www.jell.yfish.us/media/jellyfish-3-mbps-hd-hevc.mkv -+wget http://www.jell.yfish.us/media/jellyfish-3-mbps-hd-hevc-10bit.mkv -+ -+# Test i420 output (works currently) -+./ffmpeg -no_cvt_hw -vcodec h264_v4l2m2m -i jellyfish-3-mbps-hd-h264.mkv -f vout_egl - -+ -+# Test Sand8 output - doesn't currently work but should once you have -+# Sand8 working in drm_mmal. I can't guarantee that this will work as -+# I can't test this path with a known working format, but the debug looks -+# good. If this doesn't work & drm_mmal does with sand8 then come back to me -+# The "show_all 1" forces vout to display every frame otherwise it drops any -+# frame that would cause it to block -+./ffmpeg -no_cvt_hw -hwaccel drm -vcodec hevc -i jellyfish-3-mbps-hd-hevc.mkv -show_all 1 -f vout_egl - -+ -+# Test Sand30 - doesn't currently work -+# (Beware that when FFmpeg errors out it often leaves your teminal window -+# in a state where you need to reset it) -+./ffmpeg -no_cvt_hw -hwaccel drm -vcodec hevc -i jellyfish-3-mbps-hd-hevc-10bit.mkv -f vout_egl - -+ -+ -+ ---- /dev/null -+++ b/pi-util/clean_usr_libs.sh -@@ -0,0 +1,23 @@ -+set -e -+U=/usr/lib/arm-linux-gnueabihf -+rm -f $U/libavcodec.* -+rm -f $U/libavdevice.* -+rm -f $U/libavfilter.* -+rm -f $U/libavformat.* -+rm -f $U/libavresample.* -+rm -f $U/libavutil.* -+U=/usr/lib/arm-linux-gnueabihf/neon/vfp -+rm -f $U/libavcodec.* -+rm -f $U/libavdevice.* -+rm -f $U/libavfilter.* -+rm -f $U/libavformat.* -+rm -f $U/libavresample.* -+rm -f $U/libavutil.* -+U=/usr/lib/aarch64-linux-gnu -+rm -f $U/libavcodec.* -+rm -f $U/libavdevice.* -+rm -f $U/libavfilter.* -+rm -f $U/libavformat.* -+rm -f $U/libavresample.* -+rm -f $U/libavutil.* -+ ---- /dev/null -+++ b/pi-util/conf_arm64_native.sh -@@ -0,0 +1,45 @@ -+echo "Configure for ARM64 native build" -+ -+#RPI_KEEPS="-save-temps=obj" -+ -+SHARED_LIBS="--enable-shared" -+if [ "$1" == "--noshared" ]; then -+ SHARED_LIBS="--disable-shared" -+ echo Static libs -+ OUT=out/arm64-static-rel -+else -+ echo Shared libs -+ OUT=out/arm64-shared-rel -+fi -+ -+mkdir -p $OUT -+cd $OUT -+ -+A=aarch64-linux-gnu -+USR_PREFIX=`pwd`/install -+LIB_PREFIX=$USR_PREFIX/lib/$A -+INC_PREFIX=$USR_PREFIX/include/$A -+ -+../../configure \ -+ --prefix=$USR_PREFIX\ -+ --libdir=$LIB_PREFIX\ -+ --incdir=$INC_PREFIX\ -+ --disable-stripping\ -+ --disable-thumb\ -+ --disable-mmal\ -+ --enable-sand\ -+ --enable-v4l2-request\ -+ --enable-libdrm\ -+ --enable-epoxy\ -+ --enable-libudev\ -+ --enable-vout-drm\ -+ --enable-vout-egl\ -+ $SHARED_LIBS\ -+ --extra-cflags="-ggdb" -+ -+# --enable-decoder=hevc_rpi\ -+# --enable-extra-warnings\ -+# --arch=armv71\ -+ -+# gcc option for getting asm listing -+# -Wa,-ahls ---- /dev/null -+++ b/pi-util/conf_h265.2016.csv -@@ -0,0 +1,195 @@ -+1,HEVC_v1/AMP_A_Samsung_7,AMP_A_Samsung_7.bin,AMP_A_Samsung_7.md5,8 -+1,HEVC_v1/AMP_B_Samsung_7,AMP_B_Samsung_7.bin,AMP_B_Samsung_7.md5,8 -+1,HEVC_v1/AMP_D_Hisilicon_3,AMP_D_Hisilicon.bit,AMP_D_Hisilicon_3.yuv.md5,8 -+1,HEVC_v1/AMP_E_Hisilicon_3,AMP_E_Hisilicon.bit,AMP_E_Hisilicon_3.yuv.md5,8 -+1,HEVC_v1/AMP_F_Hisilicon_3,AMP_F_Hisilicon_3.bit,AMP_F_Hisilicon_3.yuv.md5,8 -+1,HEVC_v1/AMVP_A_MTK_4,AMVP_A_MTK_4.bit,AMVP_A_MTK_4.md5,8 -+1,HEVC_v1/AMVP_B_MTK_4,AMVP_B_MTK_4.bit,AMVP_B_MTK_4.md5,8 -+1,HEVC_v1/AMVP_C_Samsung_7,AMVP_C_Samsung_7.bin,AMVP_C_Samsung_7.md5,8 -+1,HEVC_v1/BUMPING_A_ericsson_1,BUMPING_A_ericsson_1.bit,BUMPING_A_ericsson_1.md5,8 -+1,HEVC_v1/CAINIT_A_SHARP_4,CAINIT_A_SHARP_4.bit,CAINIT_A_SHARP_4.md5,8 -+1,HEVC_v1/CAINIT_B_SHARP_4,CAINIT_B_SHARP_4.bit,CAINIT_B_SHARP_4.md5,8 -+1,HEVC_v1/CAINIT_C_SHARP_3,CAINIT_C_SHARP_3.bit,CAINIT_C_SHARP_3.md5,8 -+1,HEVC_v1/CAINIT_D_SHARP_3,CAINIT_D_SHARP_3.bit,CAINIT_D_SHARP_3.md5,8 -+1,HEVC_v1/CAINIT_E_SHARP_3,CAINIT_E_SHARP_3.bit,CAINIT_E_SHARP_3.md5,8 -+1,HEVC_v1/CAINIT_F_SHARP_3,CAINIT_F_SHARP_3.bit,CAINIT_F_SHARP_3.md5,8 -+1,HEVC_v1/CAINIT_G_SHARP_3,CAINIT_G_SHARP_3.bit,CAINIT_G_SHARP_3.md5,8 -+1,HEVC_v1/CAINIT_H_SHARP_3,CAINIT_H_SHARP_3.bit,CAINIT_H_SHARP_3.md5,8 -+1,HEVC_v1/CIP_A_Panasonic_3,CIP_A_Panasonic_3.bit,CIP_A_Panasonic_3_yuv.md5,8 -+1,HEVC_v1/cip_B_NEC_3,cip_B_NEC_3.bit,cip_B_NEC_3.md5,8 -+1,HEVC_v1/CIP_C_Panasonic_2,CIP_C_Panasonic_2.bit,CIP_C_Panasonic_2_yuv.md5,8 -+1,HEVC_v1/CONFWIN_A_Sony_1,CONFWIN_A_Sony_1.bit,CONFWIN_A_Sony_1.md5,8 -+1,HEVC_v1/DBLK_A_MAIN10_VIXS_4,DBLK_A_MAIN10_VIXS_4.bit,DBLK_A_MAIN10_VIXS_4.md5,10 -+1,HEVC_v1/DBLK_A_SONY_3,DBLK_A_SONY_3.bit,DBLK_A_SONY_3.bit.yuv.md5,8 -+1,HEVC_v1/DBLK_B_SONY_3,DBLK_B_SONY_3.bit,DBLK_B_SONY_3.bit.yuv.md5,8 -+1,HEVC_v1/DBLK_C_SONY_3,DBLK_C_SONY_3.bit,DBLK_C_SONY_3.bit.yuv.md5,8 -+1,HEVC_v1/DBLK_D_VIXS_2,DBLK_D_VIXS_2.bit,DBLK_D_VIXS_2_yuv.md5,8 -+1,HEVC_v1/DBLK_E_VIXS_2,DBLK_E_VIXS_2.bit,DBLK_E_VIXS_2_yuv.md5,8 -+1,HEVC_v1/DBLK_F_VIXS_2,DBLK_F_VIXS_2.bit,DBLK_F_VIXS_2_yuv.md5,8 -+1,HEVC_v1/DBLK_G_VIXS_2,DBLK_G_VIXS_2.bit,DBLK_G_VIXS_2_yuv.md5,8 -+1,HEVC_v1/DELTAQP_A_BRCM_4,DELTAQP_A_BRCM_4.bit,DELTAQP_A_BRCM_4_yuv.md5,8 -+1,HEVC_v1/DELTAQP_B_SONY_3,DELTAQP_B_SONY_3.bit,DELTAQP_B_SONY_3.bit.yuv.md5,8 -+1,HEVC_v1/DELTAQP_C_SONY_3,DELTAQP_C_SONY_3.bit,DELTAQP_C_SONY_3.bit.yuv.md5,8 -+1,HEVC_v1/DSLICE_A_HHI_5,DSLICE_A_HHI_5.bin,DSLICE_A_HHI_5.md5,8 -+1,HEVC_v1/DSLICE_B_HHI_5,DSLICE_B_HHI_5.bin,DSLICE_B_HHI_5.md5,8 -+1,HEVC_v1/DSLICE_C_HHI_5,DSLICE_C_HHI_5.bin,DSLICE_C_HHI_5.md5,8 -+1,HEVC_v1/ENTP_A_QUALCOMM_1,ENTP_A_Qualcomm_1.bit,ENTP_A_Qualcomm_1.md5,8 -+1,HEVC_v1/ENTP_B_Qualcomm_1,ENTP_B_Qualcomm_1.bit,ENTP_B_Qualcomm_1.md5,8 -+1,HEVC_v1/ENTP_C_Qualcomm_1,ENTP_C_Qualcomm_1.bit,ENTP_C_Qualcomm_1.md5,8 -+1,HEVC_v1/EXT_A_ericsson_4,EXT_A_ericsson_4.bit,EXT_A_ericsson_4.md5,8 -+1,HEVC_v1/FILLER_A_Sony_1,FILLER_A_Sony_1.bit,FILLER_A_Sony_1.md5,8 -+1,HEVC_v1/HRD_A_Fujitsu_3,HRD_A_Fujitsu_3.bin,HRD_A_Fujitsu_3.md5,8 -+1,HEVC_v1/INITQP_A_Sony_1,INITQP_A_Sony_1.bit,INITQP_A_Sony_1.md5,8 -+1,HEVC_v1/INITQP_B_Main10_Sony_1,INITQP_B_Main10_Sony_1.bit,INITQP_B_Main10_Sony_1.md5,10 -+1,HEVC_v1/ipcm_A_NEC_3,ipcm_A_NEC_3.bit,ipcm_A_NEC_3.md5,8 -+1,HEVC_v1/ipcm_B_NEC_3,ipcm_B_NEC_3.bit,ipcm_B_NEC_3.md5,8 -+1,HEVC_v1/ipcm_C_NEC_3,ipcm_C_NEC_3.bit,ipcm_C_NEC_3.md5,8 -+1,HEVC_v1/ipcm_D_NEC_3,ipcm_D_NEC_3.bit,ipcm_D_NEC_3.md5,8 -+1,HEVC_v1/ipcm_E_NEC_2,ipcm_E_NEC_2.bit,ipcm_E_NEC_2.md5,8 -+1,HEVC_v1/IPRED_A_docomo_2,IPRED_A_docomo_2.bit,IPRED_A_docomo_2.md5,8 -+1,HEVC_v1/IPRED_B_Nokia_3,IPRED_B_Nokia_3.bit,IPRED_B_Nokia_3_yuv.md5,8 -+1,HEVC_v1/IPRED_C_Mitsubishi_3,IPRED_C_Mitsubishi_3.bit,IPRED_C_Mitsubishi_3_yuv.md5,8 -+1,HEVC_v1/LS_A_Orange_2,LS_A_Orange_2.bit,LS_A_Orange_2_yuv.md5,8 -+1,HEVC_v1/LS_B_Orange_4,LS_B_Orange_4.bit,LS_B_Orange_4_yuv.md5,8 -+1,HEVC_v1/LTRPSPS_A_Qualcomm_1,LTRPSPS_A_Qualcomm_1.bit,LTRPSPS_A_Qualcomm_1.md5,8 -+1,HEVC_v1/MAXBINS_A_TI_5,MAXBINS_A_TI_5.bit,MAXBINS_A_TI_5_yuv.md5,8 -+1,HEVC_v1/MAXBINS_B_TI_5,MAXBINS_B_TI_5.bit,MAXBINS_B_TI_5_yuv.md5,8 -+1,HEVC_v1/MAXBINS_C_TI_5,MAXBINS_C_TI_5.bit,MAXBINS_C_TI_5_yuv.md5,8 -+1,HEVC_v1/MERGE_A_TI_3,MERGE_A_TI_3.bit,MERGE_A_TI_3.md5,8 -+1,HEVC_v1/MERGE_B_TI_3,MERGE_B_TI_3.bit,MERGE_B_TI_3.md5,8 -+1,HEVC_v1/MERGE_C_TI_3,MERGE_C_TI_3.bit,MERGE_C_TI_3.md5,8 -+1,HEVC_v1/MERGE_D_TI_3,MERGE_D_TI_3.bit,MERGE_D_TI_3.md5,8 -+1,HEVC_v1/MERGE_E_TI_3,MERGE_E_TI_3.bit,MERGE_E_TI_3.md5,8 -+1,HEVC_v1/MERGE_F_MTK_4,MERGE_F_MTK_4.bit,MERGE_F_MTK_4.md5,8 -+1,HEVC_v1/MERGE_G_HHI_4,MERGE_G_HHI_4.bit,MERGE_G_HHI_4.md5,8 -+1,HEVC_v1/MVCLIP_A_qualcomm_3,MVCLIP_A_qualcomm_3.bit,MVCLIP_A_qualcomm_3.yuv.md5,8 -+1,HEVC_v1/MVDL1ZERO_A_docomo_4,MVDL1ZERO_A_docomo_4.bit,MVDL1ZERO_A_docomo_4.md5,8 -+1,HEVC_v1/MVEDGE_A_qualcomm_3,MVEDGE_A_qualcomm_3.bit,MVEDGE_A_qualcomm_3.yuv.md5,8 -+1,HEVC_v1/NoOutPrior_A_Qualcomm_1,NoOutPrior_A_Qualcomm_1.bit,NoOutPrior_A_Qualcomm_1.md5,8 -+1,HEVC_v1/NoOutPrior_B_Qualcomm_1,NoOutPrior_B_Qualcomm_1.bit,NoOutPrior_B_Qualcomm_1.md5,8 -+1,HEVC_v1/NUT_A_ericsson_5,NUT_A_ericsson_5.bit,NUT_A_ericsson_5.md5,8 -+1,HEVC_v1/OPFLAG_A_Qualcomm_1,OPFLAG_A_Qualcomm_1.bit,OPFLAG_A_Qualcomm_1.md5,8 -+1,HEVC_v1/OPFLAG_B_Qualcomm_1,OPFLAG_B_Qualcomm_1.bit,OPFLAG_B_Qualcomm_1.md5,8 -+1,HEVC_v1/OPFLAG_C_Qualcomm_1,OPFLAG_C_Qualcomm_1.bit,OPFLAG_C_Qualcomm_1.md5,8 -+1,HEVC_v1/PICSIZE_A_Bossen_1,PICSIZE_A_Bossen_1.bin,PICSIZE_A_Bossen_1.md5,8 -+1,HEVC_v1/PICSIZE_B_Bossen_1,PICSIZE_B_Bossen_1.bin,PICSIZE_B_Bossen_1.md5,8 -+1,HEVC_v1/PICSIZE_C_Bossen_1,PICSIZE_C_Bossen_1.bin,PICSIZE_C_Bossen_1.md5,8 -+1,HEVC_v1/PICSIZE_D_Bossen_1,PICSIZE_D_Bossen_1.bin,PICSIZE_D_Bossen_1.md5,8 -+1,HEVC_v1/PMERGE_A_TI_3,PMERGE_A_TI_3.bit,PMERGE_A_TI_3.md5,8 -+1,HEVC_v1/PMERGE_B_TI_3,PMERGE_B_TI_3.bit,PMERGE_B_TI_3.md5,8 -+1,HEVC_v1/PMERGE_C_TI_3,PMERGE_C_TI_3.bit,PMERGE_C_TI_3.md5,8 -+1,HEVC_v1/PMERGE_D_TI_3,PMERGE_D_TI_3.bit,PMERGE_D_TI_3.md5,8 -+1,HEVC_v1/PMERGE_E_TI_3,PMERGE_E_TI_3.bit,PMERGE_E_TI_3.md5,8 -+1,HEVC_v1/POC_A_Bossen_3,POC_A_Bossen_3.bin,POC_A_Bossen_3.md5,8 -+1,HEVC_v1/PPS_A_qualcomm_7,PPS_A_qualcomm_7.bit,PPS_A_qualcomm_7.yuv.md5,8 -+1,HEVC_v1/PS_B_VIDYO_3,PS_B_VIDYO_3.bit,PS_B_VIDYO_3_yuv.md5,8 -+1,HEVC_v1/RAP_A_docomo_6,RAP_A_docomo_6.bit,RAP_A_docomo_6.md5,8 -+1,HEVC_v1/RAP_B_Bossen_2,RAP_B_Bossen_2.bit,RAP_B_Bossen_2.md5,8 -+1,HEVC_v1/RPLM_A_qualcomm_4,RPLM_A_qualcomm_4.bit,RPLM_A_qualcomm_4.yuv.md5,8 -+1,HEVC_v1/RPLM_B_qualcomm_4,RPLM_B_qualcomm_4.bit,RPLM_B_qualcomm_4.yuv.md5,8 -+1,HEVC_v1/RPS_A_docomo_5,RPS_A_docomo_5.bit,RPS_A_docomo_5.md5,8 -+1,HEVC_v1/RPS_B_qualcomm_5,RPS_B_qualcomm_5.bit,RPS_B_qualcomm_5.yuv.md5,8 -+1,HEVC_v1/RPS_C_ericsson_5,RPS_C_ericsson_5.bit,RPS_C_ericsson_5.md5,8 -+1,HEVC_v1/RPS_D_ericsson_6,RPS_D_ericsson_6.bit,RPS_D_ericsson_6.md5,8 -+1,HEVC_v1/RPS_E_qualcomm_5,RPS_E_qualcomm_5.bit,RPS_E_qualcomm_5.yuv.md5,8 -+1,HEVC_v1/RPS_F_docomo_2,RPS_F_docomo_2.bit,RPS_F_docomo_2.md5,8 -+1,HEVC_v1/RQT_A_HHI_4,RQT_A_HHI_4.bit,RQT_A_HHI_4.md5,8 -+1,HEVC_v1/RQT_B_HHI_4,RQT_B_HHI_4.bit,RQT_B_HHI_4.md5,8 -+1,HEVC_v1/RQT_C_HHI_4,RQT_C_HHI_4.bit,RQT_C_HHI_4.md5,8 -+1,HEVC_v1/RQT_D_HHI_4,RQT_D_HHI_4.bit,RQT_D_HHI_4.md5,8 -+1,HEVC_v1/RQT_E_HHI_4,RQT_E_HHI_4.bit,RQT_E_HHI_4.md5,8 -+1,HEVC_v1/RQT_F_HHI_4,RQT_F_HHI_4.bit,RQT_F_HHI_4.md5,8 -+1,HEVC_v1/RQT_G_HHI_4,RQT_G_HHI_4.bit,RQT_G_HHI_4.md5,8 -+1,HEVC_v1/SAO_A_MediaTek_4,SAO_A_MediaTek_4.bit,SAO_A_MediaTek_4.md5,8 -+1,HEVC_v1/SAO_B_MediaTek_5,SAO_B_MediaTek_5.bit,SAO_B_MediaTek_5.md5,8 -+1,HEVC_v1/SAO_C_Samsung_5,SAO_C_Samsung_5.bin,SAO_C_Samsung_5.md5,8 -+1,HEVC_v1/SAO_D_Samsung_5,SAO_D_Samsung_5.bin,SAO_D_Samsung_5.md5,8 -+1,HEVC_v1/SAO_E_Canon_4,SAO_E_Canon_4.bit,SAO_E_Canon_4.md5,8 -+1,HEVC_v1/SAO_F_Canon_3,SAO_F_Canon_3.bit,SAO_F_Canon_3.md5,8 -+1,HEVC_v1/SAO_G_Canon_3,SAO_G_Canon_3.bit,SAO_G_Canon_3.md5,8 -+1,HEVC_v1/SAO_H_Parabola_1,SAO_H_Parabola_1.bit,SAO_H_Parabola_1.md5,8 -+1,HEVC_v1/SAODBLK_A_MainConcept_4,SAODBLK_A_MainConcept_4.bin,SAODBLK_A_MainConcept_4_md5.txt,8 -+1,HEVC_v1/SAODBLK_B_MainConcept_4,SAODBLK_B_MainConcept_4.bin,SAODBLK_B_MainConcept_4_md5.txt,8 -+1,HEVC_v1/SDH_A_Orange_4,SDH_A_Orange_4.bit,SDH_A_Orange_4_yuv.md5,8 -+1,HEVC_v1/SLICES_A_Rovi_3,SLICES_A_Rovi_3.bin,SLICES_A_Rovi_3.md5,8 -+1,HEVC_v1/SLIST_A_Sony_5,SLIST_A_Sony_5.bin,SLIST_A_Sony_5_yuv.md5,8 -+1,HEVC_v1/SLIST_B_Sony_9,SLIST_B_Sony_9.bin,SLIST_B_Sony_9_yuv.md5,8 -+1,HEVC_v1/SLIST_C_Sony_4,SLIST_C_Sony_4.bin,SLIST_C_Sony_4_yuv.md5,8 -+1,HEVC_v1/SLIST_D_Sony_9,str.bin,SLIST_D_Sony_9_yuv.md5,8 -+1,HEVC_v1/SLPPLP_A_VIDYO_2,SLPPLP_A_VIDYO_2.bit,SLPPLP_A_VIDYO_2_yuv.md5,8 -+1,HEVC_v1/STRUCT_A_Samsung_7,STRUCT_A_Samsung_7.bin,STRUCT_A_Samsung_7.md5,8 -+1,HEVC_v1/STRUCT_B_Samsung_7,STRUCT_B_Samsung_7.bin,STRUCT_B_Samsung_7.md5,8 -+1,HEVC_v1/TILES_A_Cisco_2,TILES_A_Cisco_2.bin,TILES_A_Cisco_2_yuv.md5,8 -+1,HEVC_v1/TILES_B_Cisco_1,TILES_B_Cisco_1.bin,TILES_B_Cisco_1_yuv.md5,8 -+1,HEVC_v1/TMVP_A_MS_3,TMVP_A_MS_3.bit,TMVP_A_MS_3.yuv.md5,8 -+1,HEVC_v1/TSCL_A_VIDYO_5,TSCL_A_VIDYO_5.bit,TSCL_A_VIDYO_5_yuv.md5,8 -+1,HEVC_v1/TSCL_B_VIDYO_4,TSCL_B_VIDYO_4.bit,TSCL_B_VIDYO_4_yuv.md5,8 -+1,HEVC_v1/TSKIP_A_MS_3,TSKIP_A_MS_3.bit,TSKIP_A_MS_3.yuv.md5,8 -+3,HEVC_v1/TSUNEQBD_A_MAIN10_Technicolor_2,TSUNEQBD_A_MAIN10_Technicolor_2.bit,TSUNEQBD_A_MAIN10_Technicolor_2_yuv.md5, # unequal bit depth,10 -+1,HEVC_v1/TUSIZE_A_Samsung_1,TUSIZE_A_Samsung_1.bin,TUSIZE_A_Samsung_1.md5,8 -+1,HEVC_v1/VPSID_A_VIDYO_2,VPSID_A_VIDYO_2.bit,VPSID_A_VIDYO_2_yuv.md5,8 -+3,HEVC_v1/VPSSPSPPS_A_MainConcept_1,VPSSPSPPS_A_MainConcept_1.bin,VPSSPSPPS_A_MainConcept_1_md5.txt, # ???,8 -+1,HEVC_v1/WP_A_MAIN10_Toshiba_3,WP_A_MAIN10_Toshiba_3.bit,WP_A_MAIN10_Toshiba_3_yuv.md5,10 -+1,HEVC_v1/WP_A_Toshiba_3,WP_A_Toshiba_3.bit,WP_A_Toshiba_3_yuv.md5,8 -+1,HEVC_v1/WP_B_Toshiba_3,WP_B_Toshiba_3.bit,WP_B_Toshiba_3_yuv.md5,8 -+1,HEVC_v1/WP_MAIN10_B_Toshiba_3,WP_MAIN10_B_Toshiba_3.bit,WP_MAIN10_B_Toshiba_3_yuv.md5,10 -+1,HEVC_v1/WPP_A_ericsson_MAIN10_2,WPP_A_ericsson_MAIN10_2.bit,WPP_A_ericsson_MAIN10_yuv.md5,10 -+1,HEVC_v1/WPP_A_ericsson_MAIN_2,WPP_A_ericsson_MAIN_2.bit,WPP_A_ericsson_MAIN_2_yuv.md5,8 -+1,HEVC_v1/WPP_B_ericsson_MAIN10_2,WPP_B_ericsson_MAIN10_2.bit,WPP_B_ericsson_MAIN10_yuv.md5,10 -+1,HEVC_v1/WPP_B_ericsson_MAIN_2,WPP_B_ericsson_MAIN_2.bit,WPP_B_ericsson_MAIN_2_yuv.md5,8 -+1,HEVC_v1/WPP_C_ericsson_MAIN10_2,WPP_C_ericsson_MAIN10_2.bit,WPP_C_ericsson_MAIN10_yuv.md5,10 -+1,HEVC_v1/WPP_C_ericsson_MAIN_2,WPP_C_ericsson_MAIN_2.bit,WPP_C_ericsson_MAIN_2_yuv.md5,8 -+1,HEVC_v1/WPP_D_ericsson_MAIN10_2,WPP_D_ericsson_MAIN10_2.bit,WPP_D_ericsson_MAIN10_yuv.md5,10 -+1,HEVC_v1/WPP_D_ericsson_MAIN_2,WPP_D_ericsson_MAIN_2.bit,WPP_D_ericsson_MAIN_2_yuv.md5,8 -+1,HEVC_v1/WPP_E_ericsson_MAIN10_2,WPP_E_ericsson_MAIN10_2.bit,WPP_E_ericsson_MAIN10_yuv.md5,10 -+1,HEVC_v1/WPP_E_ericsson_MAIN_2,WPP_E_ericsson_MAIN_2.bit,WPP_E_ericsson_MAIN_2_yuv.md5,8 -+1,HEVC_v1/WPP_F_ericsson_MAIN10_2,WPP_F_ericsson_MAIN10_2.bit,WPP_F_ericsson_MAIN10_yuv.md5,10 -+1,HEVC_v1/WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5,8 -+1,RExt/ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_2,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_2.bit,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_yuv_2.md5,0 -+0,RExt/Bitdepth_A_RExt_Sony_1,Bitdepth_A_RExt_Sony_1.bin,md5sum.txt,8 -+0,RExt/Bitdepth_B_RExt_Sony_1,Bitdepth_B_RExt_Sony_1.bin,md5sum.txt,8 -+0,RExt/CCP_10bit_RExt_QCOM,CCP_10bit_RExt_QCOM.bin,CCP_10bit_RExt_QCOM_md5sum.txt,10 -+0,RExt/CCP_12bit_RExt_QCOM,CCP_12bit_RExt_QCOM.bin,CCP_12bit_RExt_QCOM_md5sum.txt,8 -+0,RExt/CCP_8bit_RExt_QCOM,CCP_8bit_RExt_QCOM.bin,CCP_8bit_RExt_QCOM_md5sum.txt,8 -+1,RExt/ExplicitRdpcm_A_BBC_1,ExplicitRdpcm_A_BBC_1.bit,md5sum.txt,0 -+0,RExt/ExplicitRdpcm_B_BBC_2,ExplicitRdpcm_B_BBC_1.bit,md5sum.txt,8 -+0,RExt/EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.bit,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.md5,10 -+0,RExt/EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.bit,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.md5,8 -+0,RExt/EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_16BIT_RExt_Sony_1,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_16BIT_RExt_Sony_1.bit,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_16BIT_RExt_Sony_1.md5,8 -+0,RExt/EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.bit,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.md5,8 -+0,RExt/EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1,EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.bit,EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.md5,10 -+0,RExt/EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1,EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.bit,EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.md5,8 -+0,RExt/EXTPREC_MAIN_444_16_INTRA_16BIT_RExt_Sony_1,EXTPREC_MAIN_444_16_INTRA_16BIT_RExt_Sony_1.bit,EXTPREC_MAIN_444_16_INTRA_16BIT_RExt_Sony_1.md5,8 -+0,RExt/EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1,EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.bit,EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.md5,8 -+1,RExt/GENERAL_10b_420_RExt_Sony_1,GENERAL_10b_420_RExt_Sony_1.bit,GENERAL_10b_420_RExt_Sony_1.md5,10 -+1,RExt/GENERAL_10b_422_RExt_Sony_1,GENERAL_10b_422_RExt_Sony_1.bit,GENERAL_10b_422_RExt_Sony_1.md5,0 -+1,RExt/GENERAL_10b_444_RExt_Sony_2,GENERAL_10b_444_RExt_Sony_2.bit,GENERAL_10b_444_RExt_Sony_2.md5,0 -+1,RExt/GENERAL_12b_400_RExt_Sony_1,GENERAL_12b_400_RExt_Sony_1.bit,GENERAL_12b_400_RExt_Sony_1.md5,0 -+1,RExt/GENERAL_12b_420_RExt_Sony_1,GENERAL_12b_420_RExt_Sony_1.bit,GENERAL_12b_420_RExt_Sony_1.md5,0 -+1,RExt/GENERAL_12b_422_RExt_Sony_1,GENERAL_12b_422_RExt_Sony_1.bit,GENERAL_12b_422_RExt_Sony_1.md5,0 -+1,RExt/GENERAL_12b_444_RExt_Sony_2,GENERAL_12b_444_RExt_Sony_2.bit,GENERAL_12b_444_RExt_Sony_2.md5,0 -+0,RExt/GENERAL_16b_400_RExt_Sony_1,GENERAL_16b_400_RExt_Sony_1.bit,GENERAL_16b_400_RExt_Sony_1.md5,0 -+0,RExt/GENERAL_16b_444_highThroughput_RExt_Sony_2,GENERAL_16b_444_highThroughput_RExt_Sony_2.bit,GENERAL_16b_444_highThroughput_RExt_Sony_2.md5,8 -+0,RExt/GENERAL_16b_444_RExt_Sony_2,GENERAL_16b_444_RExt_Sony_2.bit,GENERAL_16b_444_RExt_Sony_2.md5,8 -+1,RExt/GENERAL_8b_400_RExt_Sony_1,GENERAL_8b_400_RExt_Sony_1.bit,GENERAL_8b_400_RExt_Sony_1.md5,0 -+1,RExt/GENERAL_8b_420_RExt_Sony_1,GENERAL_8b_420_RExt_Sony_1.bit,GENERAL_8b_420_RExt_Sony_1.md5,8 -+1,RExt/GENERAL_8b_444_RExt_Sony_2,GENERAL_8b_444_RExt_Sony_2.bit,GENERAL_8b_444_RExt_Sony_2.md5,0 -+1,RExt/IPCM_A_RExt_NEC_2,IPCM_A_RExt_NEC_2.bit,IPCM_A_RExt_NEC_2_yuv.md5,0 -+1,RExt/IPCM_B_RExt_NEC,IPCM_B_RExt_NEC.bit,IPCM_B_RExt_NEC_yuv.md5,0 -+1,RExt/Main_422_10_A_RExt_Sony_2,Main_422_10_A_RExt_Sony_2.bin,md5sum.txt,0 -+1,RExt/Main_422_10_B_RExt_Sony_2,Main_422_10_B_RExt_Sony_2.bin,md5sum.txt,0 -+1,RExt/PERSIST_RPARAM_A_RExt_Sony_3,PERSIST_RPARAM_A_RExt_Sony_3.bit,PERSIST_RPARAM_A_RExt_Sony_3.md5,0 -+1,RExt/QMATRIX_A_RExt_Sony_1,QMATRIX_A_RExt_Sony_1.bit,QMATRIX_A_RExt_Sony_1.md5,0 -+0,RExt/SAO_A_RExt_MediaTek_1,SAO_A_RExt_MediaTek_1.bit,SAO_A_RExt_MediaTek_1.md5, # Runs out of memory - could be fixed,8 -+0,RExt/TSCTX_10bit_I_RExt_SHARP_1,TSCTX_10bit_I_RExt_SHARP_1.bin,TSCTX_10bit_I_RExt_SHARP_1.md5,10 -+0,RExt/TSCTX_10bit_RExt_SHARP_1,TSCTX_10bit_RExt_SHARP_1.bin,TSCTX_10bit_RExt_SHARP_1.md5,10 -+0,RExt/TSCTX_12bit_I_RExt_SHARP_1,TSCTX_12bit_I_RExt_SHARP_1.bin,TSCTX_12bit_I_RExt_SHARP_1.md5,8 -+0,RExt/TSCTX_12bit_RExt_SHARP_1,TSCTX_12bit_RExt_SHARP_1.bin,TSCTX_12bit_RExt_SHARP_1.md5,8 -+0,RExt/TSCTX_8bit_I_RExt_SHARP_1,TSCTX_8bit_I_RExt_SHARP_1.bin,TSCTX_8bit_I_RExt_SHARP_1.md5,8 -+0,RExt/TSCTX_8bit_RExt_SHARP_1,TSCTX_8bit_RExt_SHARP_1.bin,TSCTX_8bit_RExt_SHARP_1.md5,8 -+0,RExt/WAVETILES_RExt_Sony_2,WAVETILES_RExt_Sony_2.bit,WAVETILES_RExt_Sony_2.md5,8 -+1,local/sao_cu16_mobile_344x280,sao_cu16_mobile_344x280.265,sao_cu16_mobile_344x280.md5,8 -+1,local/dblk_cu16_mobile_344x280,dblk_cu16_mobile_344x280.265,dblk_cu16_mobile_344x280.md5,8 -+1,local/dblksao_cu16_mobile_344x280,dblksao_cu16_mobile_344x280.265,dblksao_cu16_mobile_344x280.md5,8 -+1,local/dblk_pu32_horses_832x448,dblk_pu32_horses_832x448.265,dblk_pu32_horses_832x448.md5,8 -+1,local/intra_pred_21_laps,intra_pred_21_laps.265,intra_pred_21_laps.md5,8 ---- /dev/null -+++ b/pi-util/conf_h265.2016_HEVC_v1.csv -@@ -0,0 +1,147 @@ -+1,AMP_A_Samsung_7,AMP_A_Samsung_7.bin,AMP_A_Samsung_7.md5 -+1,AMP_B_Samsung_7,AMP_B_Samsung_7.bin,AMP_B_Samsung_7.md5 -+1,AMP_D_Hisilicon_3,AMP_D_Hisilicon.bit,AMP_D_Hisilicon_3.yuv.md5 -+1,AMP_E_Hisilicon_3,AMP_E_Hisilicon.bit,AMP_E_Hisilicon_3.yuv.md5 -+1,AMP_F_Hisilicon_3,AMP_F_Hisilicon_3.bit,AMP_F_Hisilicon_3.yuv.md5 -+1,AMVP_A_MTK_4,AMVP_A_MTK_4.bit,AMVP_A_MTK_4.md5 -+1,AMVP_B_MTK_4,AMVP_B_MTK_4.bit,AMVP_B_MTK_4.md5 -+1,AMVP_C_Samsung_7,AMVP_C_Samsung_7.bin,AMVP_C_Samsung_7.md5 -+1,BUMPING_A_ericsson_1,BUMPING_A_ericsson_1.bit,BUMPING_A_ericsson_1.md5 -+1,CAINIT_A_SHARP_4,CAINIT_A_SHARP_4.bit,CAINIT_A_SHARP_4.md5 -+1,CAINIT_B_SHARP_4,CAINIT_B_SHARP_4.bit,CAINIT_B_SHARP_4.md5 -+1,CAINIT_C_SHARP_3,CAINIT_C_SHARP_3.bit,CAINIT_C_SHARP_3.md5 -+1,CAINIT_D_SHARP_3,CAINIT_D_SHARP_3.bit,CAINIT_D_SHARP_3.md5 -+1,CAINIT_E_SHARP_3,CAINIT_E_SHARP_3.bit,CAINIT_E_SHARP_3.md5 -+1,CAINIT_F_SHARP_3,CAINIT_F_SHARP_3.bit,CAINIT_F_SHARP_3.md5 -+1,CAINIT_G_SHARP_3,CAINIT_G_SHARP_3.bit,CAINIT_G_SHARP_3.md5 -+1,CAINIT_H_SHARP_3,CAINIT_H_SHARP_3.bit,CAINIT_H_SHARP_3.md5 -+1,CIP_A_Panasonic_3,CIP_A_Panasonic_3.bit,CIP_A_Panasonic_3_yuv.md5 -+1,cip_B_NEC_3,cip_B_NEC_3.bit,cip_B_NEC_3.md5 -+1,CIP_C_Panasonic_2,CIP_C_Panasonic_2.bit,CIP_C_Panasonic_2_yuv.md5 -+1,CONFWIN_A_Sony_1,CONFWIN_A_Sony_1.bit,CONFWIN_A_Sony_1.md5 -+1,DBLK_A_MAIN10_VIXS_4,DBLK_A_MAIN10_VIXS_4.bit,DBLK_A_MAIN10_VIXS_4.md5 -+1,DBLK_A_SONY_3,DBLK_A_SONY_3.bit,DBLK_A_SONY_3.bit.yuv.md5 -+1,DBLK_B_SONY_3,DBLK_B_SONY_3.bit,DBLK_B_SONY_3.bit.yuv.md5 -+1,DBLK_C_SONY_3,DBLK_C_SONY_3.bit,DBLK_C_SONY_3.bit.yuv.md5 -+1,DBLK_D_VIXS_2,DBLK_D_VIXS_2.bit,DBLK_D_VIXS_2_yuv.md5 -+1,DBLK_E_VIXS_2,DBLK_E_VIXS_2.bit,DBLK_E_VIXS_2_yuv.md5 -+1,DBLK_F_VIXS_2,DBLK_F_VIXS_2.bit,DBLK_F_VIXS_2_yuv.md5 -+1,DBLK_G_VIXS_2,DBLK_G_VIXS_2.bit,DBLK_G_VIXS_2_yuv.md5 -+1,DELTAQP_A_BRCM_4,DELTAQP_A_BRCM_4.bit,DELTAQP_A_BRCM_4_yuv.md5 -+1,DELTAQP_B_SONY_3,DELTAQP_B_SONY_3.bit,DELTAQP_B_SONY_3.bit.yuv.md5 -+1,DELTAQP_C_SONY_3,DELTAQP_C_SONY_3.bit,DELTAQP_C_SONY_3.bit.yuv.md5 -+1,DSLICE_A_HHI_5,DSLICE_A_HHI_5.bin,DSLICE_A_HHI_5.md5 -+1,DSLICE_B_HHI_5,DSLICE_B_HHI_5.bin,DSLICE_B_HHI_5.md5 -+1,DSLICE_C_HHI_5,DSLICE_C_HHI_5.bin,DSLICE_C_HHI_5.md5 -+1,ENTP_A_QUALCOMM_1,ENTP_A_Qualcomm_1.bit,ENTP_A_Qualcomm_1.md5 -+1,ENTP_B_Qualcomm_1,ENTP_B_Qualcomm_1.bit,ENTP_B_Qualcomm_1.md5 -+1,ENTP_C_Qualcomm_1,ENTP_C_Qualcomm_1.bit,ENTP_C_Qualcomm_1.md5 -+1,EXT_A_ericsson_4,EXT_A_ericsson_4.bit,EXT_A_ericsson_4.md5 -+1,FILLER_A_Sony_1,FILLER_A_Sony_1.bit,FILLER_A_Sony_1.md5 -+1,HRD_A_Fujitsu_3,HRD_A_Fujitsu_3.bin,HRD_A_Fujitsu_3.md5 -+1,INITQP_A_Sony_1,INITQP_A_Sony_1.bit,INITQP_A_Sony_1.md5 -+1,INITQP_B_Main10_Sony_1,INITQP_B_Main10_Sony_1.bit,INITQP_B_Main10_Sony_1.md5 -+1,ipcm_A_NEC_3,ipcm_A_NEC_3.bit,ipcm_A_NEC_3.md5 -+1,ipcm_B_NEC_3,ipcm_B_NEC_3.bit,ipcm_B_NEC_3.md5 -+1,ipcm_C_NEC_3,ipcm_C_NEC_3.bit,ipcm_C_NEC_3.md5 -+1,ipcm_D_NEC_3,ipcm_D_NEC_3.bit,ipcm_D_NEC_3.md5 -+1,ipcm_E_NEC_2,ipcm_E_NEC_2.bit,ipcm_E_NEC_2.md5 -+1,IPRED_A_docomo_2,IPRED_A_docomo_2.bit,IPRED_A_docomo_2.md5 -+1,IPRED_B_Nokia_3,IPRED_B_Nokia_3.bit,IPRED_B_Nokia_3_yuv.md5 -+1,IPRED_C_Mitsubishi_3,IPRED_C_Mitsubishi_3.bit,IPRED_C_Mitsubishi_3_yuv.md5 -+1,LS_A_Orange_2,LS_A_Orange_2.bit,LS_A_Orange_2_yuv.md5 -+1,LS_B_Orange_4,LS_B_Orange_4.bit,LS_B_Orange_4_yuv.md5 -+1,LTRPSPS_A_Qualcomm_1,LTRPSPS_A_Qualcomm_1.bit,LTRPSPS_A_Qualcomm_1.md5 -+1,MAXBINS_A_TI_5,MAXBINS_A_TI_5.bit,MAXBINS_A_TI_5_yuv.md5 -+1,MAXBINS_B_TI_5,MAXBINS_B_TI_5.bit,MAXBINS_B_TI_5_yuv.md5 -+1,MAXBINS_C_TI_5,MAXBINS_C_TI_5.bit,MAXBINS_C_TI_5_yuv.md5 -+1,MERGE_A_TI_3,MERGE_A_TI_3.bit,MERGE_A_TI_3.md5 -+1,MERGE_B_TI_3,MERGE_B_TI_3.bit,MERGE_B_TI_3.md5 -+1,MERGE_C_TI_3,MERGE_C_TI_3.bit,MERGE_C_TI_3.md5 -+1,MERGE_D_TI_3,MERGE_D_TI_3.bit,MERGE_D_TI_3.md5 -+1,MERGE_E_TI_3,MERGE_E_TI_3.bit,MERGE_E_TI_3.md5 -+1,MERGE_F_MTK_4,MERGE_F_MTK_4.bit,MERGE_F_MTK_4.md5 -+1,MERGE_G_HHI_4,MERGE_G_HHI_4.bit,MERGE_G_HHI_4.md5 -+1,MVCLIP_A_qualcomm_3,MVCLIP_A_qualcomm_3.bit,MVCLIP_A_qualcomm_3.yuv.md5 -+1,MVDL1ZERO_A_docomo_4,MVDL1ZERO_A_docomo_4.bit,MVDL1ZERO_A_docomo_4.md5 -+1,MVEDGE_A_qualcomm_3,MVEDGE_A_qualcomm_3.bit,MVEDGE_A_qualcomm_3.yuv.md5 -+1,NoOutPrior_A_Qualcomm_1,NoOutPrior_A_Qualcomm_1.bit,NoOutPrior_A_Qualcomm_1.md5 -+1,NoOutPrior_B_Qualcomm_1,NoOutPrior_B_Qualcomm_1.bit,NoOutPrior_B_Qualcomm_1.md5 -+1,NUT_A_ericsson_5,NUT_A_ericsson_5.bit,NUT_A_ericsson_5.md5 -+1,OPFLAG_A_Qualcomm_1,OPFLAG_A_Qualcomm_1.bit,OPFLAG_A_Qualcomm_1.md5 -+1,OPFLAG_B_Qualcomm_1,OPFLAG_B_Qualcomm_1.bit,OPFLAG_B_Qualcomm_1.md5 -+1,OPFLAG_C_Qualcomm_1,OPFLAG_C_Qualcomm_1.bit,OPFLAG_C_Qualcomm_1.md5 -+1,PICSIZE_A_Bossen_1,PICSIZE_A_Bossen_1.bin,PICSIZE_A_Bossen_1.md5 -+1,PICSIZE_B_Bossen_1,PICSIZE_B_Bossen_1.bin,PICSIZE_B_Bossen_1.md5 -+1,PICSIZE_C_Bossen_1,PICSIZE_C_Bossen_1.bin,PICSIZE_C_Bossen_1.md5 -+1,PICSIZE_D_Bossen_1,PICSIZE_D_Bossen_1.bin,PICSIZE_D_Bossen_1.md5 -+1,PMERGE_A_TI_3,PMERGE_A_TI_3.bit,PMERGE_A_TI_3.md5 -+1,PMERGE_B_TI_3,PMERGE_B_TI_3.bit,PMERGE_B_TI_3.md5 -+1,PMERGE_C_TI_3,PMERGE_C_TI_3.bit,PMERGE_C_TI_3.md5 -+1,PMERGE_D_TI_3,PMERGE_D_TI_3.bit,PMERGE_D_TI_3.md5 -+1,PMERGE_E_TI_3,PMERGE_E_TI_3.bit,PMERGE_E_TI_3.md5 -+1,POC_A_Bossen_3,POC_A_Bossen_3.bin,POC_A_Bossen_3.md5 -+1,PPS_A_qualcomm_7,PPS_A_qualcomm_7.bit,PPS_A_qualcomm_7.yuv.md5 -+1,PS_B_VIDYO_3,PS_B_VIDYO_3.bit,PS_B_VIDYO_3_yuv.md5 -+1,RAP_A_docomo_6,RAP_A_docomo_6.bit,RAP_A_docomo_6.md5 -+1,RAP_B_Bossen_2,RAP_B_Bossen_2.bit,RAP_B_Bossen_2.md5 -+1,RPLM_A_qualcomm_4,RPLM_A_qualcomm_4.bit,RPLM_A_qualcomm_4.yuv.md5 -+1,RPLM_B_qualcomm_4,RPLM_B_qualcomm_4.bit,RPLM_B_qualcomm_4.yuv.md5 -+1,RPS_A_docomo_5,RPS_A_docomo_5.bit,RPS_A_docomo_5.md5 -+1,RPS_B_qualcomm_5,RPS_B_qualcomm_5.bit,RPS_B_qualcomm_5.yuv.md5 -+1,RPS_C_ericsson_5,RPS_C_ericsson_5.bit,RPS_C_ericsson_5.md5 -+1,RPS_D_ericsson_6,RPS_D_ericsson_6.bit,RPS_D_ericsson_6.md5 -+1,RPS_E_qualcomm_5,RPS_E_qualcomm_5.bit,RPS_E_qualcomm_5.yuv.md5 -+1,RPS_F_docomo_2,RPS_F_docomo_2.bit,RPS_F_docomo_2.md5 -+1,RQT_A_HHI_4,RQT_A_HHI_4.bit,RQT_A_HHI_4.md5 -+1,RQT_B_HHI_4,RQT_B_HHI_4.bit,RQT_B_HHI_4.md5 -+1,RQT_C_HHI_4,RQT_C_HHI_4.bit,RQT_C_HHI_4.md5 -+1,RQT_D_HHI_4,RQT_D_HHI_4.bit,RQT_D_HHI_4.md5 -+1,RQT_E_HHI_4,RQT_E_HHI_4.bit,RQT_E_HHI_4.md5 -+1,RQT_F_HHI_4,RQT_F_HHI_4.bit,RQT_F_HHI_4.md5 -+1,RQT_G_HHI_4,RQT_G_HHI_4.bit,RQT_G_HHI_4.md5 -+1,SAO_A_MediaTek_4,SAO_A_MediaTek_4.bit,SAO_A_MediaTek_4.md5 -+1,SAO_B_MediaTek_5,SAO_B_MediaTek_5.bit,SAO_B_MediaTek_5.md5 -+1,SAO_C_Samsung_5,SAO_C_Samsung_5.bin,SAO_C_Samsung_5.md5 -+1,SAO_D_Samsung_5,SAO_D_Samsung_5.bin,SAO_D_Samsung_5.md5 -+1,SAO_E_Canon_4,SAO_E_Canon_4.bit,SAO_E_Canon_4.md5 -+1,SAO_F_Canon_3,SAO_F_Canon_3.bit,SAO_F_Canon_3.md5 -+1,SAO_G_Canon_3,SAO_G_Canon_3.bit,SAO_G_Canon_3.md5 -+1,SAO_H_Parabola_1,SAO_H_Parabola_1.bit,SAO_H_Parabola_1.md5 -+2,SAODBLK_A_MainConcept_4,SAODBLK_A_MainConcept_4.bin,SAODBLK_A_MainConcept_4_md5.txt -+2,SAODBLK_B_MainConcept_4,SAODBLK_B_MainConcept_4.bin,SAODBLK_B_MainConcept_4_md5.txt -+1,SDH_A_Orange_4,SDH_A_Orange_4.bit,SDH_A_Orange_4_yuv.md5 -+1,SLICES_A_Rovi_3,SLICES_A_Rovi_3.bin,SLICES_A_Rovi_3.md5 -+1,SLIST_A_Sony_5,SLIST_A_Sony_5.bin,SLIST_A_Sony_5_yuv.md5 -+1,SLIST_B_Sony_9,SLIST_B_Sony_9.bin,SLIST_B_Sony_9_yuv.md5 -+1,SLIST_C_Sony_4,SLIST_C_Sony_4.bin,SLIST_C_Sony_4_yuv.md5 -+1,SLIST_D_Sony_9,str.bin,SLIST_D_Sony_9_yuv.md5 -+1,SLPPLP_A_VIDYO_2,SLPPLP_A_VIDYO_2.bit,SLPPLP_A_VIDYO_2_yuv.md5 -+1,STRUCT_A_Samsung_7,STRUCT_A_Samsung_7.bin,STRUCT_A_Samsung_7.md5 -+1,STRUCT_B_Samsung_7,STRUCT_B_Samsung_7.bin,STRUCT_B_Samsung_7.md5 -+1,TILES_A_Cisco_2,TILES_A_Cisco_2.bin,TILES_A_Cisco_2_yuv.md5 -+1,TILES_B_Cisco_1,TILES_B_Cisco_1.bin,TILES_B_Cisco_1_yuv.md5 -+1,TMVP_A_MS_3,TMVP_A_MS_3.bit,TMVP_A_MS_3.yuv.md5 -+1,TSCL_A_VIDYO_5,TSCL_A_VIDYO_5.bit,TSCL_A_VIDYO_5_yuv.md5 -+1,TSCL_B_VIDYO_4,TSCL_B_VIDYO_4.bit,TSCL_B_VIDYO_4_yuv.md5 -+1,TSKIP_A_MS_3,TSKIP_A_MS_3.bit,TSKIP_A_MS_3.yuv.md5 -+3,TSUNEQBD_A_MAIN10_Technicolor_2,TSUNEQBD_A_MAIN10_Technicolor_2.bit,TSUNEQBD_A_MAIN10_Technicolor_2_yuv.md5, # unequal bit depth -+1,TUSIZE_A_Samsung_1,TUSIZE_A_Samsung_1.bin,TUSIZE_A_Samsung_1.md5 -+1,VPSID_A_VIDYO_2,VPSID_A_VIDYO_2.bit,VPSID_A_VIDYO_2_yuv.md5 -+3,VPSSPSPPS_A_MainConcept_1,VPSSPSPPS_A_MainConcept_1.bin,VPSSPSPPS_A_MainConcept_1_md5.txt, # ??? -+1,WP_A_MAIN10_Toshiba_3,WP_A_MAIN10_Toshiba_3.bit,WP_A_MAIN10_Toshiba_3_yuv.md5 -+1,WP_A_Toshiba_3,WP_A_Toshiba_3.bit,WP_A_Toshiba_3_yuv.md5 -+1,WP_B_Toshiba_3,WP_B_Toshiba_3.bit,WP_B_Toshiba_3_yuv.md5 -+1,WP_MAIN10_B_Toshiba_3,WP_MAIN10_B_Toshiba_3.bit,WP_MAIN10_B_Toshiba_3_yuv.md5 -+1,WPP_A_ericsson_MAIN10_2,WPP_A_ericsson_MAIN10_2.bit,WPP_A_ericsson_MAIN10_yuv.md5 -+1,WPP_A_ericsson_MAIN_2,WPP_A_ericsson_MAIN_2.bit,WPP_A_ericsson_MAIN_2_yuv.md5 -+1,WPP_B_ericsson_MAIN10_2,WPP_B_ericsson_MAIN10_2.bit,WPP_B_ericsson_MAIN10_yuv.md5 -+1,WPP_B_ericsson_MAIN_2,WPP_B_ericsson_MAIN_2.bit,WPP_B_ericsson_MAIN_2_yuv.md5 -+1,WPP_C_ericsson_MAIN10_2,WPP_C_ericsson_MAIN10_2.bit,WPP_C_ericsson_MAIN10_yuv.md5 -+1,WPP_C_ericsson_MAIN_2,WPP_C_ericsson_MAIN_2.bit,WPP_C_ericsson_MAIN_2_yuv.md5 -+1,WPP_D_ericsson_MAIN10_2,WPP_D_ericsson_MAIN10_2.bit,WPP_D_ericsson_MAIN10_yuv.md5 -+1,WPP_D_ericsson_MAIN_2,WPP_D_ericsson_MAIN_2.bit,WPP_D_ericsson_MAIN_2_yuv.md5 -+1,WPP_E_ericsson_MAIN10_2,WPP_E_ericsson_MAIN10_2.bit,WPP_E_ericsson_MAIN10_yuv.md5 -+1,WPP_E_ericsson_MAIN_2,WPP_E_ericsson_MAIN_2.bit,WPP_E_ericsson_MAIN_2_yuv.md5 -+1,WPP_F_ericsson_MAIN10_2,WPP_F_ericsson_MAIN10_2.bit,WPP_F_ericsson_MAIN10_yuv.md5 -+1,WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5 ---- /dev/null -+++ b/pi-util/conf_h265.csv -@@ -0,0 +1,144 @@ -+1,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_1,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_1.bit,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_1.md5 -+1,AMP_A_Samsung_6,AMP_A_Samsung_6.bin,AMP_A_Samsung_6.md5 -+1,AMP_B_Samsung_6,AMP_B_Samsung_6.bin,AMP_B_Samsung_6.md5 -+1,AMP_D_Hisilicon_3,AMP_D_Hisilicon.bit,AMP_D_Hisilicon_3.yuv.md5 -+1,AMP_E_Hisilicon_3,AMP_E_Hisilicon.bit,AMP_E_Hisilicon_3.yuv.md5 -+1,AMP_F_Hisilicon_3,AMP_F_Hisilicon_3.bit,AMP_F_Hisilicon_3.yuv.md5 -+1,AMVP_A_MTK_4,AMVP_A_MTK_4.bit,AMVP_A_MTK_4.md5 -+1,AMVP_B_MTK_4,AMVP_B_MTK_4.bit,AMVP_B_MTK_4.md5 -+1,AMVP_C_Samsung_6,AMVP_C_Samsung_6.bin,AMVP_C_Samsung_6.md5 -+1,BUMPING_A_ericsson_1,BUMPING_A_ericsson_1.bit,BUMPING_A_ericsson_1.md5 -+1,CAINIT_A_SHARP_4,CAINIT_A_SHARP_4.bit,CAINIT_A_SHARP_4.md5 -+1,CAINIT_B_SHARP_4,CAINIT_B_SHARP_4.bit,CAINIT_B_SHARP_4.md5 -+1,CAINIT_C_SHARP_3,CAINIT_C_SHARP_3.bit,CAINIT_C_SHARP_3.md5 -+1,CAINIT_D_SHARP_3,CAINIT_D_SHARP_3.bit,CAINIT_D_SHARP_3.md5 -+1,CAINIT_E_SHARP_3,CAINIT_E_SHARP_3.bit,CAINIT_E_SHARP_3.md5 -+1,CAINIT_F_SHARP_3,CAINIT_F_SHARP_3.bit,CAINIT_F_SHARP_3.md5 -+1,CAINIT_G_SHARP_3,CAINIT_G_SHARP_3.bit,CAINIT_G_SHARP_3.md5 -+1,CAINIT_H_SHARP_3,CAINIT_H_SHARP_3.bit,CAINIT_H_SHARP_3.md5 -+1,CIP_A_Panasonic_3,CIP_A_Panasonic_3.bit,CIP_A_Panasonic_3_yuv.md5 -+1,cip_B_NEC_3,cip_B_NEC_3.bit,cip_B_NEC_3.md5 -+1,CIP_C_Panasonic_2,CIP_C_Panasonic_2.bit,CIP_C_Panasonic_2_yuv.md5 -+1,CONFWIN_A_Sony_1,CONFWIN_A_Sony_1.bit,CONFWIN_A_Sony_1.md5 -+1,DBLK_A_MAIN10_VIXS_3,DBLK_A_MAIN10_VIXS_3.bit,DBLK_A_MAIN10_VIXS_3.md5 -+1,DBLK_A_SONY_3,DBLK_A_SONY_3.bit,DBLK_A_SONY_3.bit.yuv.md5 -+1,DBLK_B_SONY_3,DBLK_B_SONY_3.bit,DBLK_B_SONY_3.bit.yuv.md5 -+1,DBLK_C_SONY_3,DBLK_C_SONY_3.bit,DBLK_C_SONY_3.bit.yuv.md5 -+1,DBLK_D_VIXS_2,DBLK_D_VIXS_2.bit,DBLK_D_VIXS_2_yuv.md5 -+1,DBLK_E_VIXS_2,DBLK_E_VIXS_2.bit,DBLK_E_VIXS_2_yuv.md5 -+1,DBLK_F_VIXS_2,DBLK_F_VIXS_2.bit,DBLK_F_VIXS_2_yuv.md5 -+1,DBLK_G_VIXS_2,DBLK_G_VIXS_2.bit,DBLK_G_VIXS_2_yuv.md5 -+1,DELTAQP_A_BRCM_4,DELTAQP_A_BRCM_4.bit,DELTAQP_A_BRCM_4_yuv.md5 -+1,DELTAQP_B_SONY_3,DELTAQP_B_SONY_3.bit,DELTAQP_B_SONY_3.bit.yuv.md5 -+1,DELTAQP_C_SONY_3,DELTAQP_C_SONY_3.bit,DELTAQP_C_SONY_3.bit.yuv.md5 -+1,DSLICE_A_HHI_5,DSLICE_A_HHI_5.bin,DSLICE_A_HHI_5.md5 -+1,DSLICE_B_HHI_5,DSLICE_B_HHI_5.bin,DSLICE_B_HHI_5.md5 -+1,DSLICE_C_HHI_5,DSLICE_C_HHI_5.bin,DSLICE_C_HHI_5.md5 -+1,ENTP_A_QUALCOMM_1,ENTP_A_Qualcomm_1.bit,ENTP_A_Qualcomm_1.md5 -+1,ENTP_B_Qualcomm_1,ENTP_B_Qualcomm_1.bit,ENTP_B_Qualcomm_1.md5 -+1,ENTP_C_Qualcomm_1,ENTP_C_Qualcomm_1.bit,ENTP_C_Qualcomm_1.md5 -+1,EXT_A_ericsson_4,EXT_A_ericsson_4.bit,EXT_A_ericsson_4.md5 -+1,FILLER_A_Sony_1,FILLER_A_Sony_1.bit,FILLER_A_Sony_1.md5 -+1,HRD_A_Fujitsu_3,HRD_A_Fujitsu_3.bin,HRD_A_Fujitsu_3.md5 -+1,INITQP_A_Sony_1,INITQP_A_Sony_1.bit,INITQP_A_Sony_1.md5 -+1,INITQP_B_Main10_Sony_1,INITQP_B_Main10_Sony_1.bit,INITQP_B_Main10_Sony_1.md5 -+1,ipcm_A_NEC_3,ipcm_A_NEC_3.bit,ipcm_A_NEC_3.md5 -+1,ipcm_B_NEC_3,ipcm_B_NEC_3.bit,ipcm_B_NEC_3.md5 -+1,ipcm_C_NEC_3,ipcm_C_NEC_3.bit,ipcm_C_NEC_3.md5 -+1,ipcm_D_NEC_3,ipcm_D_NEC_3.bit,ipcm_D_NEC_3.md5 -+1,ipcm_E_NEC_2,ipcm_E_NEC_2.bit,ipcm_E_NEC_2.md5 -+1,IPRED_A_docomo_2,IPRED_A_docomo_2.bit,IPRED_A_docomo_2.md5 -+1,IPRED_B_Nokia_3,IPRED_B_Nokia_3.bit,IPRED_B_Nokia_3_yuv.md5 -+1,IPRED_C_Mitsubishi_3,IPRED_C_Mitsubishi_3.bit,IPRED_C_Mitsubishi_3_yuv.md5 -+1,LS_A_Orange_2,LS_A_Orange_2.bit,LS_A_Orange_2_yuv.md5 -+1,LS_B_Orange_4,LS_B_Orange_4.bit,LS_B_Orange_4_yuv.md5 -+1,LTRPSPS_A_Qualcomm_1,LTRPSPS_A_Qualcomm_1.bit,LTRPSPS_A_Qualcomm_1.md5 -+1,MAXBINS_A_TI_4,MAXBINS_A_TI_4.bit,MAXBINS_A_TI_4.md5 -+1,MAXBINS_B_TI_4,MAXBINS_B_TI_4.bit,MAXBINS_B_TI_4.md5 -+1,MAXBINS_C_TI_4,MAXBINS_C_TI_4.bit,MAXBINS_C_TI_4.md5 -+1,MERGE_A_TI_3,MERGE_A_TI_3.bit,MERGE_A_TI_3.md5 -+1,MERGE_B_TI_3,MERGE_B_TI_3.bit,MERGE_B_TI_3.md5 -+1,MERGE_C_TI_3,MERGE_C_TI_3.bit,MERGE_C_TI_3.md5 -+1,MERGE_D_TI_3,MERGE_D_TI_3.bit,MERGE_D_TI_3.md5 -+1,MERGE_E_TI_3,MERGE_E_TI_3.bit,MERGE_E_TI_3.md5 -+1,MERGE_F_MTK_4,MERGE_F_MTK_4.bit,MERGE_F_MTK_4.md5 -+1,MERGE_G_HHI_4,MERGE_G_HHI_4.bit,MERGE_G_HHI_4.md5 -+1,MVCLIP_A_qualcomm_3,MVCLIP_A_qualcomm_3.bit,MVCLIP_A_qualcomm_3.yuv.md5 -+1,MVDL1ZERO_A_docomo_4,MVDL1ZERO_A_docomo_4.bit,MVDL1ZERO_A_docomo_4.md5 -+1,MVEDGE_A_qualcomm_3,MVEDGE_A_qualcomm_3.bit,MVEDGE_A_qualcomm_3.yuv.md5 -+1,NoOutPrior_A_Qualcomm_1,NoOutPrior_A_Qualcomm_1.bit,NoOutPrior_A_Qualcomm_1.md5 -+1,NoOutPrior_B_Qualcomm_1,NoOutPrior_B_Qualcomm_1.bit,NoOutPrior_B_Qualcomm_1.md5 -+1,NUT_A_ericsson_5,NUT_A_ericsson_5.bit,NUT_A_ericsson_5.md5 -+1,OPFLAG_A_Qualcomm_1,OPFLAG_A_Qualcomm_1.bit,OPFLAG_A_Qualcomm_1.md5 -+1,OPFLAG_B_Qualcomm_1,OPFLAG_B_Qualcomm_1.bit,OPFLAG_B_Qualcomm_1.md5 -+1,OPFLAG_C_Qualcomm_1,OPFLAG_C_Qualcomm_1.bit,OPFLAG_C_Qualcomm_1.md5 -+1,PICSIZE_A_Bossen_1,PICSIZE_A_Bossen_1.bin,PICSIZE_A_Bossen_1.md5 -+1,PICSIZE_B_Bossen_1,PICSIZE_B_Bossen_1.bin,PICSIZE_B_Bossen_1.md5 -+1,PICSIZE_C_Bossen_1,PICSIZE_C_Bossen_1.bin,PICSIZE_C_Bossen_1.md5 -+1,PICSIZE_D_Bossen_1,PICSIZE_D_Bossen_1.bin,PICSIZE_D_Bossen_1.md5 -+1,PMERGE_A_TI_3,PMERGE_A_TI_3.bit,PMERGE_A_TI_3.md5 -+1,PMERGE_B_TI_3,PMERGE_B_TI_3.bit,PMERGE_B_TI_3.md5 -+1,PMERGE_C_TI_3,PMERGE_C_TI_3.bit,PMERGE_C_TI_3.md5 -+1,PMERGE_D_TI_3,PMERGE_D_TI_3.bit,PMERGE_D_TI_3.md5 -+1,PMERGE_E_TI_3,PMERGE_E_TI_3.bit,PMERGE_E_TI_3.md5 -+1,POC_A_Bossen_3,POC_A_Bossen_3.bin,POC_A_Bossen_3.md5 -+1,PPS_A_qualcomm_7,PPS_A_qualcomm_7.bit,PPS_A_qualcomm_7.yuv.md5 -+1,PS_B_VIDYO_3,PS_B_VIDYO_3.bit,PS_B_VIDYO_3_yuv.md5 -+1,RAP_A_docomo_6,RAP_A_docomo_6.bit,RAP_A_docomo_6.md5 -+1,RAP_B_Bossen_2,RAP_B_Bossen_2.bit,RAP_B_Bossen_2.md5 -+1,RPLM_A_qualcomm_4,RPLM_A_qualcomm_4.bit,RPLM_A_qualcomm_4.yuv.md5 -+1,RPLM_B_qualcomm_4,RPLM_B_qualcomm_4.bit,RPLM_B_qualcomm_4.yuv.md5 -+1,RPS_A_docomo_5,RPS_A_docomo_5.bit,RPS_A_docomo_5.md5 -+1,RPS_B_qualcomm_5,RPS_B_qualcomm_5.bit,RPS_B_qualcomm_5.yuv.md5 -+1,RPS_C_ericsson_5,RPS_C_ericsson_5.bit,RPS_C_ericsson_5.md5 -+1,RPS_D_ericsson_6,RPS_D_ericsson_6.bit,RPS_D_ericsson_6.md5 -+1,RPS_E_qualcomm_5,RPS_E_qualcomm_5.bit,RPS_E_qualcomm_5.yuv.md5 -+1,RPS_F_docomo_2,RPS_F_docomo_2.bit,RPS_F_docomo_2.md5 -+1,RQT_A_HHI_4,RQT_A_HHI_4.bit,RQT_A_HHI_4.md5 -+1,RQT_B_HHI_4,RQT_B_HHI_4.bit,RQT_B_HHI_4.md5 -+1,RQT_C_HHI_4,RQT_C_HHI_4.bit,RQT_C_HHI_4.md5 -+1,RQT_D_HHI_4,RQT_D_HHI_4.bit,RQT_D_HHI_4.md5 -+1,RQT_E_HHI_4,RQT_E_HHI_4.bit,RQT_E_HHI_4.md5 -+1,RQT_F_HHI_4,RQT_F_HHI_4.bit,RQT_F_HHI_4.md5 -+1,RQT_G_HHI_4,RQT_G_HHI_4.bit,RQT_G_HHI_4.md5 -+1,SAO_A_MediaTek_4,SAO_A_MediaTek_4.bit,SAO_A_MediaTek_4.md5 -+1,SAO_B_MediaTek_5,SAO_B_MediaTek_5.bit,SAO_B_MediaTek_5.md5 -+1,SAO_C_Samsung_5,SAO_C_Samsung_5.bin,SAO_C_Samsung_5.md5 -+1,SAO_D_Samsung_5,SAO_D_Samsung_5.bin,SAO_D_Samsung_5.md5 -+1,SAO_E_Canon_4,SAO_E_Canon_4.bit,SAO_E_Canon_4.md5 -+1,SAO_F_Canon_3,SAO_F_Canon_3.bit,SAO_F_Canon_3.md5 -+1,SAO_G_Canon_3,SAO_G_Canon_3.bit,SAO_G_Canon_3.md5 -+1,SDH_A_Orange_4,SDH_A_Orange_4.bit,SDH_A_Orange_4_yuv.md5 -+1,SLICES_A_Rovi_3,SLICES_A_Rovi_3.bin,SLICES_A_Rovi_3.md5 -+1,SLIST_A_Sony_4,str.bin,SLIST_A_Sony_4_yuv.md5 -+1,SLIST_B_Sony_8,str.bin,SLIST_B_Sony_8_yuv.md5 -+1,SLIST_C_Sony_3,str.bin,SLIST_C_Sony_3_yuv.md5 -+1,SLIST_D_Sony_9,str.bin,SLIST_D_Sony_9_yuv.md5 -+1,SLPPLP_A_VIDYO_2,SLPPLP_A_VIDYO_2.bit,SLPPLP_A_VIDYO_2_yuv.md5 -+1,STRUCT_A_Samsung_6,STRUCT_A_Samsung_6.bin,STRUCT_A_Samsung_6.md5 -+1,STRUCT_B_Samsung_6,STRUCT_B_Samsung_6.bin,STRUCT_B_Samsung_6.md5 -+1,TILES_A_Cisco_2,TILES_A_Cisco_2.bin,TILES_A_Cisco_2_yuv.md5 -+1,TILES_B_Cisco_1,TILES_B_Cisco_1.bin,TILES_B_Cisco_1_yuv.md5 -+1,TMVP_A_MS_3,TMVP_A_MS_3.bit,TMVP_A_MS_3.yuv.md5 -+1,TSCL_A_VIDYO_5,TSCL_A_VIDYO_5.bit,TSCL_A_VIDYO_5_yuv.md5 -+1,TSCL_B_VIDYO_4,TSCL_B_VIDYO_4.bit,TSCL_B_VIDYO_4_yuv.md5 -+1,TSKIP_A_MS_3,TSKIP_A_MS_3.bit,TSKIP_A_MS_3.yuv.md5 -+0,TSUNEQBD_A_MAIN10_Technicolor_2,TSUNEQBD_A_MAIN10_Technicolor_2.bit,TSUNEQBD_A_MAIN10_Technicolor_2_yuv.md5, # Y/C bit depth unmatched -+1,TUSIZE_A_Samsung_1,TUSIZE_A_Samsung_1.bin,TUSIZE_A_Samsung_1.md5 -+1,VPSID_A_VIDYO_2,VPSID_A_VIDYO_2.bit,VPSID_A_VIDYO_2_yuv.md5 -+1,WP_A_MAIN10_Toshiba_3,WP_A_MAIN10_Toshiba_3.bit,WP_A_MAIN10_Toshiba_3_yuv.md5 -+1,WP_A_Toshiba_3,WP_A_Toshiba_3.bit,WP_A_Toshiba_3_yuv.md5 -+1,WP_B_Toshiba_3,WP_B_Toshiba_3.bit,WP_B_Toshiba_3_yuv.md5 -+1,WP_MAIN10_B_Toshiba_3,WP_MAIN10_B_Toshiba_3.bit,WP_MAIN10_B_Toshiba_3_yuv.md5 -+1,WPP_A_ericsson_MAIN10_2,WPP_A_ericsson_MAIN10_2.bit,WPP_A_ericsson_MAIN10_yuv.md5 -+1,WPP_A_ericsson_MAIN_2,WPP_A_ericsson_MAIN_2.bit,WPP_A_ericsson_MAIN_2_yuv.md5 -+1,WPP_B_ericsson_MAIN10_2,WPP_B_ericsson_MAIN10_2.bit,WPP_B_ericsson_MAIN10_yuv.md5 -+1,WPP_B_ericsson_MAIN_2,WPP_B_ericsson_MAIN_2.bit,WPP_B_ericsson_MAIN_2_yuv.md5 -+1,WPP_C_ericsson_MAIN10_2,WPP_C_ericsson_MAIN10_2.bit,WPP_C_ericsson_MAIN10_yuv.md5 -+1,WPP_C_ericsson_MAIN_2,WPP_C_ericsson_MAIN_2.bit,WPP_C_ericsson_MAIN_2_yuv.md5 -+1,WPP_D_ericsson_MAIN10_2,WPP_D_ericsson_MAIN10_2.bit,WPP_D_ericsson_MAIN10_yuv.md5 -+1,WPP_D_ericsson_MAIN_2,WPP_D_ericsson_MAIN_2.bit,WPP_D_ericsson_MAIN_2_yuv.md5 -+1,WPP_E_ericsson_MAIN10_2,WPP_E_ericsson_MAIN10_2.bit,WPP_E_ericsson_MAIN10_yuv.md5 -+1,WPP_E_ericsson_MAIN_2,WPP_E_ericsson_MAIN_2.bit,WPP_E_ericsson_MAIN_2_yuv.md5 -+1,WPP_F_ericsson_MAIN10_2,WPP_F_ericsson_MAIN10_2.bit,WPP_F_ericsson_MAIN10_yuv.md5 -+1,WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5 ---- /dev/null -+++ b/pi-util/conf_native.sh -@@ -0,0 +1,78 @@ -+echo "Configure for native build" -+ -+FFSRC=`pwd` -+MC=`uname -m` -+ -+#RPI_KEEPS="-save-temps=obj" -+RPI_KEEPS="" -+ -+if [ "$MC" == "aarch64" ]; then -+ echo "M/C aarch64" -+ A=aarch64-linux-gnu -+ B=arm64 -+ MCOPTS= -+ RPI_INCLUDES= -+ RPI_LIBDIRS= -+ RPI_DEFINES= -+ RPI_EXTRALIBS= -+ RPIOPTS="--disable-mmal --enable-sand" -+else -+ echo "M/C armv7" -+ A=arm-linux-gnueabihf -+ B=armv7 -+ MCOPTS="--arch=armv6t2 --cpu=cortex-a7" -+ RPI_OPT_VC=/opt/vc -+ RPI_INCLUDES="-I$RPI_OPT_VC/include -I$RPI_OPT_VC/include/interface/vcos/pthreads -I$RPI_OPT_VC/include/interface/vmcs_host/linux" -+ RPI_LIBDIRS="-L$RPI_OPT_VC/lib" -+ RPI_DEFINES="-D__VCCOREVER__=0x4000000 -mfpu=neon-vfpv4" -+ RPI_EXTRALIBS="-Wl,--start-group -lbcm_host -lmmal -lmmal_util -lmmal_core -lvcos -lvcsm -lvchostif -lvchiq_arm -Wl,--end-group" -+ RPIOPTS="--enable-mmal --enable-rpi" -+fi -+C=`lsb_release -sc` -+V=`cat RELEASE` -+ -+SHARED_LIBS="--enable-shared" -+if [ "$1" == "--noshared" ]; then -+ SHARED_LIBS="--disable-shared" -+ OUT=out/$B-$C-$V-static-rel -+ echo Static libs -+else -+ echo Shared libs -+ OUT=out/$B-$C-$V-shared-rel -+fi -+ -+USR_PREFIX=$FFSRC/$OUT/install -+LIB_PREFIX=$USR_PREFIX/lib/$A -+INC_PREFIX=$USR_PREFIX/include/$A -+ -+echo Destination directory: $OUT -+mkdir -p $FFSRC/$OUT -+cd $FFSRC/$OUT -+ -+$FFSRC/configure \ -+ --prefix=$USR_PREFIX\ -+ --libdir=$LIB_PREFIX\ -+ --incdir=$INC_PREFIX\ -+ $MCOPTS\ -+ --disable-stripping\ -+ --disable-thumb\ -+ --enable-v4l2-request\ -+ --enable-libdrm\ -+ --enable-epoxy\ -+ --enable-libudev\ -+ --enable-vout-drm\ -+ --enable-vout-egl\ -+ $SHARED_LIBS\ -+ $RPIOPTS\ -+ --extra-cflags="-ggdb $RPI_KEEPS $RPI_DEFINES $RPI_INCLUDES"\ -+ --extra-cxxflags="$RPI_DEFINES $RPI_INCLUDES"\ -+ --extra-ldflags="$RPI_LIBDIRS"\ -+ --extra-libs="$RPI_EXTRALIBS"\ -+ --extra-version="rpi" -+ -+# --enable-decoder=hevc_rpi\ -+# --enable-extra-warnings\ -+# --arch=armv71\ -+ -+# gcc option for getting asm listing -+# -Wa,-ahls ---- /dev/null -+++ b/pi-util/conf_pi1.sh -@@ -0,0 +1,39 @@ -+echo "Configure for Pi1" -+ -+RPI_TOOLROOT=`pwd`/../tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf -+RPI_OPT_VC=`pwd`/../firmware/hardfp/opt/vc -+ -+RPI_INCLUDES="-I$RPI_OPT_VC/include -I$RPI_OPT_VC/include/interface/vcos/pthreads -I$RPI_OPT_VC/include/interface/vmcs_host/linux" -+RPI_LIBDIRS="-L$RPI_TOOLROOT/lib -L$RPI_OPT_VC/lib" -+#RPI_KEEPS="-save-temps=obj" -+RPI_KEEPS="" -+ -+SHARED_LIBS="--enable-shared" -+if [ "$1" == "--noshared" ]; then -+ SHARED_LIBS="--disable-shared" -+ echo Static libs -+else -+ echo Shared libs -+fi -+ -+./configure --enable-cross-compile\ -+ --cpu=arm1176jzf-s\ -+ --arch=arm\ -+ --disable-neon\ -+ --target-os=linux\ -+ --disable-stripping\ -+ --enable-mmal\ -+ $SHARED_LIBS\ -+ --extra-cflags="-g $RPI_KEEPS $RPI_INCLUDES"\ -+ --extra-cxxflags="$RPI_INCLUDES"\ -+ --extra-ldflags="$RPI_LIBDIRS -Wl,-rpath=/opt/vc/lib,-rpath-link=$RPI_OPT_VC/lib,-rpath=/lib,-rpath=/usr/lib,-rpath-link=$RPI_TOOLROOT/lib,-rpath-link=$RPI_TOOLROOT/lib"\ -+ --extra-libs="-Wl,--start-group -lbcm_host -lmmal -lmmal_util -lmmal_core -lvcos -lvcsm -lvchostif -lvchiq_arm"\ -+ --cross-prefix=$RPI_TOOLROOT/bin/arm-linux-gnueabihf- -+ -+ -+# --enable-extra-warnings\ -+# --arch=armv71\ -+# --enable-shared\ -+ -+# gcc option for getting asm listing -+# -Wa,-ahls ---- /dev/null -+++ b/pi-util/conf_pi2.sh -@@ -0,0 +1,57 @@ -+echo "Configure for Pi2/3" -+ -+FFSRC=`pwd` -+ -+RPI_TOOLROOT=$FFSRC/../tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf -+RPI_OPT_VC=$FFSRC/../firmware/hardfp/opt/vc -+ -+RPI_INCLUDES="-I$RPI_OPT_VC/include -I$RPI_OPT_VC/include/interface/vcos/pthreads -I$RPI_OPT_VC/include/interface/vmcs_host/linux" -+RPI_LIBDIRS="-L$RPI_TOOLROOT/lib -L$RPI_OPT_VC/lib" -+RPI_DEFINES="-D__VCCOREVER__=0x4000000 -mfpu=neon-vfpv4" -+#RPI_KEEPS="-save-temps=obj" -+RPI_KEEPS="" -+ -+SHARED_LIBS="--enable-shared" -+if [ "$1" == "--noshared" ]; then -+ SHARED_LIBS="--disable-shared" -+ OUT=out/x-armv7-static-rel -+ echo Static libs -+else -+ echo Shared libs -+ OUT=out/x-armv7-shared-rel -+fi -+ -+USR_PREFIX=$FFSRC/$OUT/install -+LIB_PREFIX=$USR_PREFIX/lib/arm-linux-gnueabihf -+INC_PREFIX=$USR_PREFIX/include/arm-linux-gnueabihf -+ -+mkdir -p $FFSRC/$OUT -+cd $FFSRC/$OUT -+ -+$FFSRC/configure --enable-cross-compile\ -+ --prefix=$USR_PREFIX\ -+ --libdir=$LIB_PREFIX\ -+ --incdir=$INC_PREFIX\ -+ --arch=armv6t2\ -+ --cpu=cortex-a7\ -+ --target-os=linux\ -+ --disable-stripping\ -+ --disable-thumb\ -+ --enable-mmal\ -+ --enable-rpi\ -+ $SHARED_LIBS\ -+ --extra-cflags="-ggdb $RPI_KEEPS $RPI_DEFINES $RPI_INCLUDES"\ -+ --extra-cxxflags="$RPI_DEFINES $RPI_INCLUDES"\ -+ --extra-ldflags="$RPI_LIBDIRS -Wl,-rpath=/opt/vc/lib,-rpath-link=$RPI_OPT_VC/lib,-rpath=/lib,-rpath=/usr/lib,-rpath-link=$RPI_TOOLROOT/lib,-rpath-link=$RPI_TOOLROOT/lib"\ -+ --extra-libs="-Wl,--start-group -lbcm_host -lmmal -lmmal_util -lmmal_core -lvcos -lvcsm -lvchostif -lvchiq_arm"\ -+ --cross-prefix=$RPI_TOOLROOT/bin/arm-linux-gnueabihf- -+ -+# --enable-shared\ -+ -+# --enable-decoder=hevc_rpi\ -+# --enable-extra-warnings\ -+# --arch=armv71\ -+# --enable-shared\ -+ -+# gcc option for getting asm listing -+# -Wa,-ahls ---- /dev/null -+++ b/pi-util/ffconf.py -@@ -0,0 +1,215 @@ -+#!/usr/bin/env python -+ -+import string -+import os -+import subprocess -+import re -+import argparse -+import sys -+import csv -+from stat import * -+ -+CODEC_HEVC_RPI = 1 -+HWACCEL_RPI = 2 -+HWACCEL_DRM = 3 -+HWACCEL_VAAPI = 4 -+ -+def testone(fileroot, srcname, es_file, md5_file, pix, dectype, vcodec, ffmpeg_exec): -+ hwaccel = "" -+ if dectype == HWACCEL_RPI: -+ hwaccel = "rpi" -+ elif dectype == HWACCEL_DRM: -+ hwaccel = "drm" -+ elif dectype == HWACCEL_VAAPI: -+ hwaccel = "vaapi" -+ -+ pix_fmt = [] -+ if pix == "8": -+ pix_fmt = ["-pix_fmt", "yuv420p"] -+ elif pix == "10": -+ pix_fmt = ["-pix_fmt", "yuv420p10le"] -+ elif pix == "12": -+ pix_fmt = ["-pix_fmt", "yuv420p12le"] -+ -+ tmp_root = "/tmp" -+ -+ names = srcname.split('/') -+ while len(names) > 1: -+ tmp_root = os.path.join(tmp_root, names[0]) -+ del names[0] -+ name = names[0] -+ -+ if not os.path.exists(tmp_root): -+ os.makedirs(tmp_root) -+ -+ dec_file = os.path.join(tmp_root, name + ".dec.md5") -+ try: -+ os.remove(dec_file) -+ except: -+ pass -+ -+ flog = open(os.path.join(tmp_root, name + ".log"), "wt") -+ -+ ffargs = [ffmpeg_exec, "-flags", "unaligned", "-hwaccel", hwaccel, "-vcodec", "hevc", "-i", os.path.join(fileroot, es_file)] + pix_fmt + ["-f", "md5", dec_file] -+ -+ # Unaligned needed for cropping conformance -+ if hwaccel: -+ rstr = subprocess.call(ffargs, stdout=flog, stderr=subprocess.STDOUT) -+ else: -+ rstr = subprocess.call( -+ [ffmpeg_exec, "-flags", "unaligned", "-vcodec", vcodec, "-i", os.path.join(fileroot, es_file), "-f", "md5", dec_file], -+ stdout=flog, stderr=subprocess.STDOUT) -+ -+ try: -+ m1 = None -+ m2 = None -+ with open(os.path.join(fileroot, md5_file)) as f: -+ for line in f: -+ m1 = re.search("[0-9a-f]{32}", line.lower()) -+ if m1: -+ break -+ -+ with open(dec_file) as f: -+ m2 = re.search("[0-9a-f]{32}", f.readline()) -+ except: -+ pass -+ -+ if m1 and m2 and m1.group() == m2.group(): -+ print >> flog, "Match: " + m1.group() -+ rv = 0 -+ elif not m1: -+ print >> flog, "****** Cannot find m1" -+ rv = 3 -+ elif not m2: -+ print >> flog, "****** Cannot find m2" -+ rv = 2 -+ else: -+ print >> flog, "****** Mismatch: " + m1.group() + " != " + m2.group() -+ rv = 1 -+ flog.close() -+ return rv -+ -+def scandir(root): -+ aconf = [] -+ ents = os.listdir(root) -+ ents.sort(key=str.lower) -+ for name in ents: -+ test_path = os.path.join(root, name) -+ if S_ISDIR(os.stat(test_path).st_mode): -+ files = os.listdir(test_path) -+ es_file = "?" -+ md5_file = "?" -+ for f in files: -+ (base, ext) = os.path.splitext(f) -+ if base[0] == '.': -+ pass -+ elif ext == ".bit" or ext == ".bin": -+ es_file = f -+ elif ext == ".md5" or (ext == ".txt" and (base[-4:] == "_md5" or base[-6:] == "md5sum")): -+ if md5_file == "?": -+ md5_file = f -+ elif base[-3:] == "yuv": -+ md5_file = f -+ aconf.append((1, name, es_file, md5_file)) -+ return aconf -+ -+def runtest(name, tests): -+ if not tests: -+ return True -+ for t in tests: -+ if name[0:len(t)] == t or name.find("/" + t) != -1: -+ return True -+ return False -+ -+def doconf(csva, tests, test_root, vcodec, dectype, ffmpeg_exec): -+ unx_failures = [] -+ unx_success = [] -+ failures = 0 -+ successes = 0 -+ for a in csva: -+ exp_test = int(a[0]) -+ if (exp_test and runtest(a[1], tests)): -+ name = a[1] -+ print "==== ", name, -+ sys.stdout.flush() -+ -+ rv = testone(os.path.join(test_root, name), name, a[2], a[3], a[4], dectype=dectype, vcodec=vcodec, ffmpeg_exec=ffmpeg_exec) -+ if (rv == 0): -+ successes += 1 -+ else: -+ failures += 1 -+ -+ if (rv == 0): -+ if exp_test == 2: -+ print ": * OK *" -+ unx_success.append(name) -+ else: -+ print ": ok" -+ elif exp_test == 2 and rv == 1: -+ print ": fail" -+ elif exp_test == 3 and rv == 2: -+ # Call an expected "crash" an abort -+ print ": abort" -+ else: -+ unx_failures.append(name) -+ if rv == 1: -+ print ": * FAIL *" -+ elif (rv == 2) : -+ print ": * CRASH *" -+ elif (rv == 3) : -+ print ": * MD5 MISSING *" -+ else : -+ print ": * BANG *" -+ -+ if unx_failures or unx_success: -+ print "Unexpected Failures:", unx_failures -+ print "Unexpected Success: ", unx_success -+ else: -+ print "All tests normal:", successes, "ok,", failures, "failed" -+ -+ -+class ConfCSVDialect(csv.Dialect): -+ delimiter = ',' -+ doublequote = True -+ lineterminator = '\n' -+ quotechar='"' -+ quoting = csv.QUOTE_MINIMAL -+ skipinitialspace = True -+ strict = True -+ -+if __name__ == '__main__': -+ -+ argp = argparse.ArgumentParser(description="FFmpeg h265 conformance tester") -+ argp.add_argument("tests", nargs='*') -+ argp.add_argument("--pi4", action='store_true', help="Force pi4 cmd line") -+ argp.add_argument("--drm", action='store_true', help="Force v4l2 drm cmd line") -+ argp.add_argument("--vaapi", action='store_true', help="Force vaapi cmd line") -+ argp.add_argument("--test_root", default="/opt/conform/h265.2016", help="Root dir for test") -+ argp.add_argument("--csvgen", action='store_true', help="Generate CSV file for dir") -+ argp.add_argument("--csv", default="pi-util/conf_h265.2016.csv", help="CSV filename") -+ argp.add_argument("--vcodec", default="hevc_rpi", help="vcodec name to use") -+ argp.add_argument("--ffmpeg", default="./ffmpeg", help="ffmpeg exec name") -+ args = argp.parse_args() -+ -+ if args.csvgen: -+ csv.writer(sys.stdout).writerows(scandir(args.test_root)) -+ exit(0) -+ -+ with open(args.csv, 'rt') as csvfile: -+ csva = [a for a in csv.reader(csvfile, ConfCSVDialect())] -+ -+ dectype = CODEC_HEVC_RPI -+ if os.path.exists("/dev/rpivid-hevcmem"): -+ dectype = HWACCEL_RPI -+ if args.drm or os.path.exists("/sys/module/rpivid_hevc"): -+ dectype = HWACCEL_DRM -+ -+ if args.pi4: -+ dectype = HWACCEL_RPI -+ elif args.drm: -+ dectype = HWACCEL_DRM -+ elif args.vaapi: -+ dectype = HWACCEL_VAAPI -+ -+ doconf(csva, args.tests, args.test_root, args.vcodec, dectype, args.ffmpeg) -+ ---- /dev/null -+++ b/pi-util/ffperf.py -@@ -0,0 +1,128 @@ -+#!/usr/bin/env python3 -+ -+import time -+import string -+import os -+import tempfile -+import subprocess -+import re -+import argparse -+import sys -+import csv -+from stat import * -+ -+class tstats: -+ close_threshold = 0.01 -+ -+ def __init__(self, stats_dict=None): -+ if stats_dict != None: -+ self.name = stats_dict["name"] -+ self.elapsed = float(stats_dict["elapsed"]) -+ self.user = float(stats_dict["user"]) -+ self.sys = float(stats_dict["sys"]) -+ -+ def times_str(self): -+ ctime = self.sys + self.user -+ return "time=%6.2f, cpu=%6.2f (%4.2f%%)" % (self.elapsed, ctime, (ctime * 100.0) / self.elapsed) -+ -+ def dict(self): -+ return {"name":self.name, "elapsed":self.elapsed, "user":self.user, "sys":self.sys} -+ -+ def is_close(self, other): -+ return abs(self.elapsed - other.elapsed) / self.elapsed < self.close_threshold -+ -+ def __lt__(self, other): -+ return self.elapsed < other.elapsed -+ def __gt__(self, other): -+ return self.elapsed > other.elapsed -+ -+ def time_file(name, prefix, ffmpeg="./ffmpeg"): -+ stats = tstats() -+ stats.name = name -+ start_time = time.clock_gettime(time.CLOCK_MONOTONIC); -+ cproc = subprocess.Popen([ffmpeg, "-no_cvt_hw", -+ "-vcodec", "hevc_rpi", -+ "-t", "30", "-i", prefix + name, -+ "-f", "vout_rpi", os.devnull], bufsize=-1, stdout=flog, stderr=flog); -+ pinfo = os.wait4(cproc.pid, 0) -+ end_time = time.clock_gettime(time.CLOCK_MONOTONIC); -+ stats.elapsed = end_time - start_time -+ stats.user = pinfo[2].ru_utime -+ stats.sys = pinfo[2].ru_stime -+ return stats -+ -+ -+def common_prefix(s1, s2): -+ for i in range(min(len(s1),len(s2))): -+ if s1[i] != s2[i]: -+ return s1[:i] -+ return s1[:i+1] -+ -+def main(): -+ global flog -+ -+ argp = argparse.ArgumentParser(description="FFmpeg performance tester", epilog=""" -+To blank the screen before starting use "xdg-screensaver activate" -+(For some reason this doesn't seem to work from within python). -+""") -+ -+ argp.add_argument("streams", nargs='*') -+ argp.add_argument("--csv_out", default="ffperf_out.csv", help="CSV output filename") -+ argp.add_argument("--csv_in", help="CSV input filename") -+ argp.add_argument("--prefix", help="Filename prefix (include terminal '/' if a directory).") -+ argp.add_argument("--repeat", default=3, type=int, help="Run repeat count") -+ argp.add_argument("--ffmpeg", default="./ffmpeg", help="FFmpeg executable") -+ -+ args = argp.parse_args() -+ -+ csv_out = csv.DictWriter(open(args.csv_out, 'w', newline=''), ["name", "elapsed", "user", "sys"]) -+ csv_out.writeheader() -+ -+ stats_in = {} -+ if args.csv_in != None: -+ with open(args.csv_in, 'r', newline='') as f_in: -+ stats_in = {x["name"]:tstats(x) for x in csv.DictReader(f_in)} -+ -+ flog = open(os.path.join(tempfile.gettempdir(), "ffperf.log"), "wt") -+ -+ streams = args.streams -+ if not streams: -+ if not stats_in: -+ print ("No source streams specified") -+ return 1 -+ prefix = "" if args.prefix == None else args.prefix -+ streams = [k for k in stats_in] -+ elif args.prefix != None: -+ prefix = args.prefix -+ else: -+ prefix = streams[0] -+ for f in streams[1:]: -+ prefix = common_prefix(prefix, f) -+ pp = prefix.rpartition(os.sep) -+ prefix = pp[0] + pp[1] -+ streams = [s[len(prefix):] for s in streams] -+ -+ for f in sorted(streams, key=lambda x : "~" * x.count(os.sep) + x.lower()): -+ print ("====", f) -+ -+ t0 = tstats({"name":f, "elapsed":999, "user":999, "sys":999}) -+ for i in range(args.repeat): -+ t = tstats.time_file(f, prefix, args.ffmpeg) -+ print ("...", t.times_str()) -+ if t0 > t: -+ t0 = t -+ -+ if t0.name in stats_in: -+ pstat = stats_in[t0.name] -+ print("---" if pstat.is_close(t0) else "<<<" if t0 < pstat else ">>>", pstat.times_str()) -+ -+ csv_out.writerow(t0.dict()) -+ -+ print () -+ -+ return 0 -+ -+ -+if __name__ == '__main__': -+ exit(main()) -+ ---- /dev/null -+++ b/pi-util/genpatch.sh -@@ -0,0 +1,35 @@ -+set -e -+ -+NOPATCH= -+if [ "$1" == "--notag" ]; then -+ shift -+ NOPATCH=1 -+fi -+ -+if [ "$1" == "" ]; then -+ echo Usage: $0 [--notag] \ -+ echo e.g.: $0 mmal_4 -+ exit 1 -+fi -+ -+VERSION=`cat RELEASE` -+if [ "$VERSION" == "" ]; then -+ echo Can\'t find version RELEASE -+ exit 1 -+fi -+ -+PATCHFILE=../ffmpeg-$VERSION-$1.patch -+ -+if [ $NOPATCH ]; then -+ echo Not tagged -+else -+ # Only continue if we are all comitted -+ git diff --name-status --exit-code -+ -+ PATCHTAG=pi/$VERSION/$1 -+ echo Tagging: $PATCHTAG -+ -+ git tag $PATCHTAG -+fi -+echo Generating patch: $PATCHFILE -+git diff n$VERSION -- > $PATCHFILE ---- /dev/null -+++ b/pi-util/make_array.py -@@ -0,0 +1,23 @@ -+#!/usr/bin/env python -+ -+# Usage -+# make_array file.bin -+# Produces file.h with array of bytes. -+# -+import sys -+for file in sys.argv[1:]: -+ prefix,suffix = file.split('.') -+ assert suffix=='bin' -+ name=prefix.split('/')[-1] -+ print 'Converting',file -+ with open(prefix+'.h','wb') as out: -+ print >>out, 'static const unsigned char',name,'[] = {' -+ with open(file,'rb') as fd: -+ i = 0 -+ for byte in fd.read(): -+ print >>out, '0x%02x, ' % ord(byte), -+ i = i + 1 -+ if i % 8 == 0: -+ print >>out, ' // %04x' % (i - 8) -+ print >>out,'};' -+ ---- /dev/null -+++ b/pi-util/mkinst.sh -@@ -0,0 +1,5 @@ -+set -e -+ -+make install -+ -+cp -r install/* ../vlc/sysroot/raspian_stretch_pi1-sysroot/usr ---- /dev/null -+++ b/pi-util/patkodi.sh -@@ -0,0 +1,9 @@ -+set -e -+KODIBASE=/home/jc/rpi/kodi/xbmc -+JOBS=-j20 -+make $JOBS -+git diff xbmc/release/4.3-kodi > $KODIBASE/tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch -+make -C $KODIBASE/tools/depends/target/ffmpeg $JOBS -+make -C $KODIBASE/build install -+ -+ ---- /dev/null -+++ b/pi-util/perfcmp.py -@@ -0,0 +1,101 @@ -+#!/usr/bin/env python3 -+ -+import time -+import string -+import os -+import tempfile -+import subprocess -+import re -+import argparse -+import sys -+import csv -+from stat import * -+ -+class tstats: -+ close_threshold = 0.01 -+ -+ def __init__(self, stats_dict=None): -+ if stats_dict != None: -+ self.name = stats_dict["name"] -+ self.elapsed = float(stats_dict["elapsed"]) -+ self.user = float(stats_dict["user"]) -+ self.sys = float(stats_dict["sys"]) -+ -+ def times_str(self): -+ ctime = self.sys + self.user -+ return "time=%6.2f, cpu=%6.2f (%4.2f%%)" % (self.elapsed, ctime, (ctime * 100.0) / self.elapsed) -+ -+ def dict(self): -+ return {"name":self.name, "elapsed":self.elapsed, "user":self.user, "sys":self.sys} -+ -+ def is_close(self, other): -+ return abs(self.elapsed - other.elapsed) / self.elapsed < self.close_threshold -+ -+ def __lt__(self, other): -+ return self.elapsed < other.elapsed -+ def __gt__(self, other): -+ return self.elapsed > other.elapsed -+ -+ def time_file(name, prefix): -+ stats = tstats() -+ stats.name = name -+ start_time = time.clock_gettime(time.CLOCK_MONOTONIC); -+ cproc = subprocess.Popen(["./ffmpeg", "-t", "30", "-i", prefix + name, -+ "-f", "null", os.devnull], bufsize=-1, stdout=flog, stderr=flog); -+ pinfo = os.wait4(cproc.pid, 0) -+ end_time = time.clock_gettime(time.CLOCK_MONOTONIC); -+ stats.elapsed = end_time - start_time -+ stats.user = pinfo[2].ru_utime -+ stats.sys = pinfo[2].ru_stime -+ return stats -+ -+ -+def common_prefix(s1, s2): -+ for i in range(min(len(s1),len(s2))): -+ if s1[i] != s2[i]: -+ return s1[:i] -+ return s1[:i+1] -+ -+def main(): -+ argp = argparse.ArgumentParser(description="FFmpeg performance compare") -+ -+ argp.add_argument("stream0", help="CSV to compare") -+ argp.add_argument("stream1", nargs='?', default="ffperf_out.csv", help="CSV to compare") -+ -+ args = argp.parse_args() -+ -+ with open(args.stream0, 'r', newline='') as f_in: -+ stats0 = {x["name"]:tstats(x) for x in csv.DictReader(f_in)} -+ with open(args.stream1, 'r', newline='') as f_in: -+ stats1 = {x["name"]:tstats(x) for x in csv.DictReader(f_in)} -+ -+ print (args.stream0, "<<-->>", args.stream1) -+ print () -+ -+ for f in sorted(stats0.keys() | stats1.keys(), key=lambda x : "~" * x.count(os.sep) + x.lower()): -+ if not (f in stats0) : -+ print (" XX :", f) -+ continue -+ if not (f in stats1) : -+ print (" XX :", f) -+ continue -+ -+ s0 = stats0[f] -+ s1 = stats1[f] -+ -+ pcent = ((s0.elapsed - s1.elapsed) / s0.elapsed) * 100.0 -+ thresh = 0.3 -+ tc = 6 -+ -+ nchar = min(tc - 1, int(abs(pcent) / thresh)) -+ cc = " -- " if nchar == 0 else "<" * nchar + " " * (tc - nchar) if pcent < 0 else " " * (tc - nchar) + ">" * nchar -+ -+ print ("%6.2f %s%6.2f (%+5.2f) : %s" % -+ (s0.elapsed, cc, s1.elapsed, pcent, f)) -+ -+ return 0 -+ -+ -+if __name__ == '__main__': -+ exit(main()) -+ ---- /dev/null -+++ b/pi-util/qem.sh -@@ -0,0 +1,9 @@ -+TARGET_DIR=../src/eupton_vc4dev_2012a/software/vc4/DEV/applications/tutorials/user_shader_example_tex -+QASM=python\ ../local/bin/qasm.py -+SRC_FILE=libavcodec/rpi_hevc_shader.qasm -+DST_BASE=shader -+ -+cp libavcodec/rpi_hevc_shader_cmd.h $TARGET_DIR -+$QASM -mc_c:$DST_BASE,$DST_BASE,$DST_BASE $SRC_FILE > $TARGET_DIR/$DST_BASE.c -+$QASM -mc_h:$DST_BASE,$DST_BASE,$DST_BASE $SRC_FILE > $TARGET_DIR/$DST_BASE.h -+ ---- /dev/null -+++ b/pi-util/v3dusage.py -@@ -0,0 +1,128 @@ -+#!/usr/bin/env python -+ -+import sys -+import argparse -+import re -+ -+def do_logparse(logname): -+ -+ rmatch = re.compile(r'^([0-9]+\.[0-9]{3}): (done )?((vpu0)|(vpu1)|(qpu1)) ([A-Z_]+) cb:([0-9a-f]+) ') -+ rqcycle = re.compile(r'^([0-9]+\.[0-9]{3}): v3d: QPU Total clock cycles for all QPUs doing vertex/coordinate shading +([0-9]+)$') -+ rqtscycle = re.compile(r'^([0-9]+\.[0-9]{3}): v3d: QPU Total clock cycles for all QPUs stalled waiting for TMUs +([0-9]+)$') -+ rl2hits = re.compile(r'^([0-9]+\.[0-9]{3}): v3d: L2C Total Level 2 cache ([a-z]+) +([0-9]+)$') -+ -+ ttotal = {'idle':0.0} -+ tstart = {} -+ qctotal = {} -+ qtstotal = {} -+ l2hits = {} -+ l2total = {} -+ time0 = None -+ idle_start = None -+ qpu_op_no = 0 -+ op_count = 0 -+ -+ with open(logname, "rt") as infile: -+ for line in infile: -+ match = rmatch.match(line) -+ if match: -+# print match.group(1), ":", match.group(2), ":", match.group(3), ":", match.group(7), ":" -+ time = float(match.group(1)) -+ unit = match.group(3) -+ opstart = not match.group(2) -+ optype = match.group(7) -+ hascb = match.group(8) != "0" -+ -+ if unit == 'qpu1': -+ unit = unit + "." + str(qpu_op_no) -+ if not opstart: -+ if hascb or optype == 'EXECUTE_SYNC': -+ qpu_op_no = 0 -+ else: -+ qpu_op_no += 1 -+ -+ # Ignore sync type -+ if optype == 'EXECUTE_SYNC': -+ continue -+ -+ if not time0: -+ time0 = time -+ -+ if opstart: -+ tstart[unit] = time; -+ elif unit in tstart: -+ op_count += 1 -+ if not unit in ttotal: -+ ttotal[unit] = 0.0 -+ ttotal[unit] += time - tstart[unit] -+ del tstart[unit] -+ -+ if not idle_start and not tstart: -+ idle_start = time -+ elif idle_start and tstart: -+ ttotal['idle'] += time - idle_start -+ idle_start = None -+ -+ match = rqcycle.match(line) -+ if match: -+ unit = "qpu1." + str(qpu_op_no) -+ if not unit in qctotal: -+ qctotal[unit] = 0 -+ qctotal[unit] += int(match.group(2)) -+ -+ match = rqtscycle.match(line) -+ if match: -+ unit = "qpu1." + str(qpu_op_no) -+ if not unit in qtstotal: -+ qtstotal[unit] = 0 -+ qtstotal[unit] += int(match.group(2)) -+ -+ match = rl2hits.match(line) -+ if match: -+ unit = "qpu1." + str(qpu_op_no) -+ if not unit in l2total: -+ l2total[unit] = 0 -+ l2hits[unit] = 0 -+ l2total[unit] += int(match.group(3)) -+ if match.group(2) == "hits": -+ l2hits[unit] += int(match.group(3)) -+ -+ -+ if not time0: -+ print "No v3d profile records found" -+ else: -+ tlogged = time - time0 -+ -+ print "Logged time:", tlogged, " Op count:", op_count -+ for unit in sorted(ttotal): -+ print b'%6s: %10.3f %7.3f%%' % (unit, ttotal[unit], ttotal[unit] * 100.0 / tlogged) -+ print -+ for unit in sorted(qctotal): -+ if not unit in qtstotal: -+ qtstotal[unit] = 0; -+ print b'%6s: Qcycles: %10d, TMU stall: %10d (%7.3f%%)' % (unit, qctotal[unit], qtstotal[unit], (qtstotal[unit] * 100.0)/qctotal[unit]) -+ if unit in l2total: -+ print b' L2Total: %10d, hits: %10d (%7.3f%%)' % (l2total[unit], l2hits[unit], (l2hits[unit] * 100.0)/l2total[unit]) -+ -+ -+ -+if __name__ == '__main__': -+ argp = argparse.ArgumentParser( -+ formatter_class=argparse.RawDescriptionHelpFormatter, -+ description="QPU/VPU perf summary from VC logging", -+ epilog = """ -+Will also summarise TMU stalls if logging requests set in qpu noflush param -+in the profiled code. -+ -+Example use: -+ vcgencmd set_logging level=0xc0 -+ -+ sudo vcdbg log msg >& t.log -+ v3dusage.py t.log -+""") -+ -+ argp.add_argument("logfile") -+ args = argp.parse_args() -+ -+ do_logparse(args.logfile) -+ diff --git a/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/0004-ffmpeg-4.3.4-rpi_14.patch b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/0004-ffmpeg-4.3.4-rpi_14.patch new file mode 100644 index 0000000000..740ac0eab9 --- /dev/null +++ b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/0004-ffmpeg-4.3.4-rpi_14.patch @@ -0,0 +1,68341 @@ +Upstream-Status: Inappropriate + +RPI-Distro repo clones original ffmpeg and applies patches to enable +raspiberry pi support. + +--- a/configure ++++ b/configure +@@ -207,6 +207,7 @@ External library support: + --disable-bzlib disable bzlib [autodetect] + --disable-coreimage disable Apple CoreImage framework [autodetect] + --enable-chromaprint enable audio fingerprinting with chromaprint [no] ++ --disable-epoxy disable epoxy [autodetect] + --enable-frei0r enable frei0r video filtering [no] + --enable-gcrypt enable gcrypt, needed for rtmp(t)e support + if openssl, librtmp or gmp is not used [no] +@@ -274,6 +275,7 @@ External library support: + --enable-libtls enable LibreSSL (via libtls), needed for https support + if openssl, gnutls or mbedtls is not used [no] + --enable-libtwolame enable MP2 encoding via libtwolame [no] ++ --disable-libudev disable libudev [autodetect] + --enable-libv4l2 enable libv4l2/v4l-utils [no] + --enable-libvidstab enable video stabilization using vid.stab [no] + --enable-libvmaf enable vmaf filter via libvmaf [no] +@@ -336,12 +338,17 @@ External library support: + --enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no] + --enable-libnpp enable Nvidia Performance Primitives-based code [no] + --enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no] ++ --enable-rpi enable other rpi specific stuff [no] ++ --enable-sand enable sand video formats [rpi] ++ --enable-vout-drm enable the vout_drm module - for internal testing only [no] ++ --enable-vout-egl enable the vout_egl module - for internal testing only [no] + --disable-nvdec disable Nvidia video decoding acceleration (via hwaccel) [autodetect] + --disable-nvenc disable Nvidia video encoding code [autodetect] + --enable-omx enable OpenMAX IL code [no] + --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no] + --enable-rkmpp enable Rockchip Media Process Platform code [no] + --disable-v4l2-m2m disable V4L2 mem2mem code [autodetect] ++ --enable-v4l2-request enable V4L2 request API code [no] + --disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect] + --disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect] + --disable-videotoolbox disable VideoToolbox code [autodetect] +@@ -1699,7 +1706,9 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST=" + avfoundation + bzlib + coreimage ++ epoxy + iconv ++ libudev + libxcb + libxcb_shm + libxcb_shape +@@ -1861,7 +1870,10 @@ HWACCEL_LIBRARY_LIST=" + mmal + omx + opencl ++ v4l2_request + vulkan ++ rpi4_8 ++ rpi4_10 + " + + DOCUMENT_LIST=" +@@ -1877,12 +1889,16 @@ FEATURE_LIST=" + gray + hardcoded_tables + omx_rpi ++ rpi + runtime_cpudetect + safe_bitstream_reader ++ sand + shared + small + static + swscale_alpha ++ vout_drm ++ vout_egl + " + + # this list should be kept in linking order +@@ -1923,6 +1939,7 @@ SUBSYSTEM_LIST=" + pixelutils + network + rdft ++ rpi + " + + # COMPONENT_LIST needs to come last to ensure correct dependency checking +@@ -2405,9 +2422,11 @@ CONFIG_EXTRA=" + rangecoder + riffdec + riffenc ++ rpi + rtpdec + rtpenc_chain + rv34dsp ++ sand + scene_sad + sinewin + snappy +@@ -2737,6 +2756,8 @@ hap_decoder_select="snappy texturedsp" + hap_encoder_deps="libsnappy" + hap_encoder_select="texturedspenc" + hevc_decoder_select="bswapdsp cabac golomb hevcparse videodsp" ++hevc_rpi_decoder_deps="rpi" ++hevc_rpi_decoder_select="hevc_decoder sand" + huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp" + huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" + hymt_decoder_select="huffyuv_decoder" +@@ -2903,6 +2924,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder + dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32" + ffnvcodec_deps_any="libdl LoadLibrary" + nvdec_deps="ffnvcodec" ++v4l2_request_deps="linux_videodev2_h linux_media_h v4l2_timeval_to_ns libdrm libudev" + vaapi_x11_deps="xlib" + videotoolbox_hwaccel_deps="videotoolbox pthreads" + videotoolbox_hwaccel_extralibs="-framework QuartzCore" +@@ -2934,6 +2956,12 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicP + hevc_dxva2_hwaccel_select="hevc_decoder" + hevc_nvdec_hwaccel_deps="nvdec" + hevc_nvdec_hwaccel_select="hevc_decoder" ++hevc_v4l2request_hwaccel_deps="v4l2_request" ++hevc_v4l2request_hwaccel_select="hevc_decoder" ++hevc_rpi4_10_hwaccel_deps="rpi" ++hevc_rpi4_10_hwaccel_select="hevc_decoder" ++hevc_rpi4_8_hwaccel_deps="rpi" ++hevc_rpi4_8_hwaccel_select="hevc_decoder" + hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" + hevc_vaapi_hwaccel_select="hevc_decoder" + hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" +@@ -3401,8 +3429,13 @@ sndio_indev_deps="sndio" + sndio_outdev_deps="sndio" + v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" + v4l2_indev_suggest="libv4l2" ++v4l2_outdev_deps="libdrm" + v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h" + v4l2_outdev_suggest="libv4l2" ++vout_drm_outdev_deps="libdrm" ++vout_egl_outdev_deps="xlib epoxy" ++vout_rpi_outdev_deps="rpi" ++vout_rpi_outdev_select="sand" + vfwcap_indev_deps="vfw32 vfwcap_defines" + xcbgrab_indev_deps="libxcb" + xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes" +@@ -3618,6 +3651,7 @@ tonemap_vaapi_filter_deps="vaapi VAProcF + tonemap_opencl_filter_deps="opencl const_nan" + transpose_opencl_filter_deps="opencl" + transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" ++unsand_filter_select="sand" + unsharp_opencl_filter_deps="opencl" + uspp_filter_deps="gpl avcodec" + vaguedenoiser_filter_deps="gpl" +@@ -6102,6 +6136,12 @@ check_func_headers glob.h glob + enabled xlib && + check_lib xlib "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext + ++enabled libudev && ++ check_pkg_config libudev libudev libudev.h udev_new ++ ++enabled epoxy && ++ check_pkg_config epoxy epoxy epoxy/egl.h epoxy_egl_version ++ + check_headers direct.h + check_headers dirent.h + check_headers dxgidebug.h +@@ -6430,11 +6470,12 @@ enabled mbedtls && { check_pkg + check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto || + die "ERROR: mbedTLS not found"; } + enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; } +-enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || ++( enabled rpi || ++ enabled mmal ) && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || + { ! enabled cross_compile && + add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline && + add_ldflags -L/opt/vc/lib/ && +- check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } || ++ check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host -lvcos -lvcsm -lvchostif -lvchiq_arm; } || + die "ERROR: mmal not found" && + check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; } + enabled openal && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do +@@ -6475,8 +6516,16 @@ enabled rkmpp && { require_p + { enabled libdrm || + die "ERROR: rkmpp requires --enable-libdrm"; } + } ++enabled v4l2_request && { enabled libdrm || ++ die "ERROR: v4l2-request requires --enable-libdrm"; } && ++ { enabled libudev || ++ die "ERROR: v4l2-request requires libudev"; } + enabled vapoursynth && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init + ++enabled vout_drm && { enabled libdrm || die "ERROR: vout_drm requires --enable-libdrm"; } ++ ++enabled vout_egl && { enabled epoxy || die "ERROR: vout_egl requires epoxy"; } && ++ { enabled xlib || die "ERROR: vout_egl requires xlib"; } + + if enabled gcrypt; then + GCRYPT_CONFIG="${cross_prefix}libgcrypt-config" +@@ -6556,6 +6605,8 @@ if enabled v4l2_m2m; then + check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" + fi + ++check_func_headers "linux/media.h linux/videodev2.h" v4l2_timeval_to_ns ++check_cc hevc_v4l2_request linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC_SLICE;" + check_headers sys/videoio.h + test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete + +--- a/fftools/ffmpeg.c ++++ b/fftools/ffmpeg.c +@@ -2119,8 +2119,8 @@ static int ifilter_send_frame(InputFilte + ifilter->channel_layout != frame->channel_layout; + break; + case AVMEDIA_TYPE_VIDEO: +- need_reinit |= ifilter->width != frame->width || +- ifilter->height != frame->height; ++ need_reinit |= ifilter->width != av_frame_cropped_width(frame) || ++ ifilter->height != av_frame_cropped_height(frame); + break; + } + +@@ -2131,6 +2131,9 @@ static int ifilter_send_frame(InputFilte + (ifilter->hw_frames_ctx && ifilter->hw_frames_ctx->data != frame->hw_frames_ctx->data)) + need_reinit = 1; + ++ if (no_cvt_hw && fg->graph) ++ need_reinit = 0; ++ + if (need_reinit) { + ret = ifilter_parameters_from_frame(ifilter, frame); + if (ret < 0) +@@ -2401,8 +2404,7 @@ static int decode_video(InputStream *ist + decoded_frame->top_field_first = ist->top_field_first; + + ist->frames_decoded++; +- +- if (ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_fmt) { ++ if (!no_cvt_hw && ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_fmt) { + err = ist->hwaccel_retrieve_data(ist->dec_ctx, decoded_frame); + if (err < 0) + goto fail; +@@ -2600,7 +2602,12 @@ static int process_input_packet(InputStr + case AVMEDIA_TYPE_VIDEO: + ret = decode_video (ist, repeating ? NULL : &avpkt, &got_output, &duration_pts, !pkt, + &decode_failed); +- if (!repeating || !pkt || got_output) { ++ // Pi: Do not inc dts if no_cvt_hw set ++ // V4L2 H264 decode has long latency and sometimes spits out a long ++ // stream of output without input. In this case incrementing DTS is wrong. ++ // There may be cases where the condition as written is correct so only ++ // "fix" in the cases which cause problems ++ if (!repeating || !pkt || (got_output && !no_cvt_hw)) { + if (pkt && pkt->duration) { + duration_dts = av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); + } else if(ist->dec_ctx->framerate.num != 0 && ist->dec_ctx->framerate.den != 0) { +@@ -2820,6 +2827,16 @@ static enum AVPixelFormat get_format(AVC + } else { + const HWAccel *hwaccel = NULL; + int i; ++ ++ if (no_cvt_hw) { ++ config = avcodec_get_hw_config(s->codec, 0); ++ if (config->methods == AV_CODEC_HW_CONFIG_METHOD_INTERNAL) { ++ av_log(s, AV_LOG_DEBUG, "no_cvt_hw so accepting pix_fmt %d with codec internal hwaccel\n", *p); ++ ist->hwaccel_pix_fmt = *p; ++ break; ++ } ++ } ++ + for (i = 0; hwaccels[i].name; i++) { + if (hwaccels[i].pix_fmt == *p) { + hwaccel = &hwaccels[i]; +@@ -2914,6 +2931,15 @@ static int init_input_stream(int ist_ind + return ret; + } + ++#if CONFIG_HEVC_RPI_DECODER ++ ret = -1; ++ if (strcmp(codec->name, "hevc_rpi") == 0 && ++ (ret = avcodec_open2(ist->dec_ctx, codec, &ist->decoder_opts)) < 0) { ++ ist->dec = codec = avcodec_find_decoder_by_name("hevc"); ++ av_log(NULL, AV_LOG_INFO, "Failed to open hevc_rpi - trying hevc\n"); ++ } ++ if (ret < 0) ++#endif + if ((ret = avcodec_open2(ist->dec_ctx, codec, &ist->decoder_opts)) < 0) { + if (ret == AVERROR_EXPERIMENTAL) + abort_codec_experimental(codec, 0); +--- a/fftools/ffmpeg.h ++++ b/fftools/ffmpeg.h +@@ -61,6 +61,7 @@ enum HWAccelID { + HWACCEL_GENERIC, + HWACCEL_VIDEOTOOLBOX, + HWACCEL_QSV, ++ HWACCEL_RPI, + }; + + typedef struct HWAccel { +@@ -590,6 +591,7 @@ extern int video_sync_method; + extern float frame_drop_threshold; + extern int do_benchmark; + extern int do_benchmark_all; ++extern int no_cvt_hw; + extern int do_deinterlace; + extern int do_hex_dump; + extern int do_pkt_dump; +--- a/fftools/ffmpeg_filter.c ++++ b/fftools/ffmpeg_filter.c +@@ -1186,8 +1186,8 @@ int ifilter_parameters_from_frame(InputF + + ifilter->format = frame->format; + +- ifilter->width = frame->width; +- ifilter->height = frame->height; ++ ifilter->width = av_frame_cropped_width(frame); ++ ifilter->height = av_frame_cropped_height(frame); + ifilter->sample_aspect_ratio = frame->sample_aspect_ratio; + + ifilter->sample_rate = frame->sample_rate; +--- a/fftools/ffmpeg_hw.c ++++ b/fftools/ffmpeg_hw.c +@@ -75,6 +75,8 @@ static char *hw_device_default_name(enum + char *name; + size_t index_pos; + int index, index_limit = 1000; ++ if (!type_name) ++ return NULL; + index_pos = strlen(type_name); + name = av_malloc(index_pos + 4); + if (!name) +--- a/fftools/ffmpeg_opt.c ++++ b/fftools/ffmpeg_opt.c +@@ -130,6 +130,12 @@ static const char *opt_name_enc_time_bas + }\ + } + ++#if CONFIG_RPI ++static int rpi_init(AVCodecContext *avctx) { ++ return 0; ++} ++#endif ++ + const HWAccel hwaccels[] = { + #if CONFIG_VIDEOTOOLBOX + { "videotoolbox", videotoolbox_init, HWACCEL_VIDEOTOOLBOX, AV_PIX_FMT_VIDEOTOOLBOX }, +@@ -137,6 +143,10 @@ const HWAccel hwaccels[] = { + #if CONFIG_LIBMFX + { "qsv", qsv_init, HWACCEL_QSV, AV_PIX_FMT_QSV }, + #endif ++#if CONFIG_RPI ++ { "rpi", rpi_init, HWACCEL_RPI, AV_PIX_FMT_RPI4_8 }, ++ { "rpi", rpi_init, HWACCEL_RPI, AV_PIX_FMT_RPI4_10 }, ++#endif + { 0 }, + }; + HWDevice *filter_hw_device; +@@ -155,6 +165,7 @@ float frame_drop_threshold = 0; + int do_deinterlace = 0; + int do_benchmark = 0; + int do_benchmark_all = 0; ++int no_cvt_hw = 0; + int do_hex_dump = 0; + int do_pkt_dump = 0; + int copy_ts = 0; +@@ -3460,6 +3471,8 @@ const OptionDef options[] = { + "add timings for benchmarking" }, + { "benchmark_all", OPT_BOOL | OPT_EXPERT, { &do_benchmark_all }, + "add timings for each task" }, ++ { "no_cvt_hw", OPT_BOOL | OPT_EXPERT, { &no_cvt_hw }, ++ "do not auto-convert hw frames to sw" }, + { "progress", HAS_ARG | OPT_EXPERT, { .func_arg = opt_progress }, + "write program-readable progress information", "url" }, + { "stdin", OPT_BOOL | OPT_EXPERT, { &stdin_interaction }, +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -19,6 +19,7 @@ HEADERS = ac3_parser.h + mediacodec.h \ + packet.h \ + qsv.h \ ++ rpi_zc.h \ + vaapi.h \ + vdpau.h \ + version.h \ +@@ -138,6 +139,7 @@ OBJS-$(CONFIG_QSVDEC) + + OBJS-$(CONFIG_QSVENC) += qsvenc.o + OBJS-$(CONFIG_RANGECODER) += rangecoder.o + OBJS-$(CONFIG_RDFT) += rdft.o ++OBJS-$(CONFIG_RPI) += rpi_qpu.o rpi_mailbox.o rpi_zc.o + OBJS-$(CONFIG_RV34DSP) += rv34dsp.o + OBJS-$(CONFIG_SHARED) += log2_tab.o reverse.o + OBJS-$(CONFIG_SINEWIN) += sinewin.o sinewin_fixed.o +@@ -152,7 +154,10 @@ OBJS-$(CONFIG_VIDEODSP) + + OBJS-$(CONFIG_VP3DSP) += vp3dsp.o + OBJS-$(CONFIG_VP56DSP) += vp56dsp.o + OBJS-$(CONFIG_VP8DSP) += vp8dsp.o +-OBJS-$(CONFIG_V4L2_M2M) += v4l2_m2m.o v4l2_context.o v4l2_buffers.o v4l2_fmt.o ++OBJS-$(CONFIG_V4L2_M2M) += v4l2_m2m.o v4l2_context.o v4l2_buffers.o v4l2_fmt.o\ ++ weak_link.o ++OBJS-$(CONFIG_V4L2_REQUEST) += v4l2_req_media.o v4l2_req_pollqueue.o v4l2_req_dmabufs.o\ ++ v4l2_req_devscan.o weak_link.o + OBJS-$(CONFIG_WMA_FREQS) += wma_freqs.o + OBJS-$(CONFIG_WMV2DSP) += wmv2dsp.o + +@@ -391,6 +396,14 @@ OBJS-$(CONFIG_HEVC_QSV_DECODER) + + OBJS-$(CONFIG_HEVC_QSV_ENCODER) += qsvenc_hevc.o hevc_ps_enc.o \ + hevc_data.o + OBJS-$(CONFIG_HEVC_RKMPP_DECODER) += rkmppdec.o ++OBJS-$(CONFIG_RPI) += rpi_mem.o \ ++ rpi_mailbox.o rpi_zc.o ++OBJS-$(CONFIG_HEVC_RPI_DECODER) += rpi_hevcdec.o rpi_hevc_mvs.o \ ++ rpi_hevc_cabac.o rpi_hevc_refs.o rpi_hevcpred.o \ ++ rpi_hevcdsp.o rpi_hevc_filter.o rpi_hevc_data.o \ ++ rpi_hevc_shader.o rpi_hevc_shader_template.o \ ++ rpi_hevc_parse.o h2645_parse.o rpi_hevc_ps.o \ ++ rpi_hevc_sei.o rpi_hevc_data.o rpi_qpu.o rpi_mem.o + OBJS-$(CONFIG_HEVC_VAAPI_ENCODER) += vaapi_encode_h265.o h265_profile_level.o + OBJS-$(CONFIG_HEVC_V4L2M2M_DECODER) += v4l2_m2m_dec.o + OBJS-$(CONFIG_HEVC_V4L2M2M_ENCODER) += v4l2_m2m_enc.o +@@ -909,6 +922,10 @@ OBJS-$(CONFIG_HEVC_D3D11VA_HWACCEL) + OBJS-$(CONFIG_HEVC_DXVA2_HWACCEL) += dxva2_hevc.o + OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o + OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o ++OBJS-$(CONFIG_HEVC_RPI4_8_HWACCEL) += rpivid_hevc.o ++OBJS-$(CONFIG_HEVC_RPI4_10_HWACCEL) += rpivid_hevc.o ++OBJS-$(CONFIG_HEVC_V4L2REQUEST_HWACCEL) += v4l2_request_hevc.o v4l2_req_decode_q.o\ ++ v4l2_req_hevc_v1.o v4l2_req_hevc_v2.o v4l2_req_hevc_v3.o v4l2_req_hevc_v4.o + OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o h265_profile_level.o + OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o + OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL) += nvdec_mjpeg.o +@@ -1261,3 +1278,31 @@ $(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h + $(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h + $(SUBDIR)sinewin_fixed.o: $(SUBDIR)sinewin_fixed_tables.h + endif ++ ++ifdef CONFIG_HEVC_RPI_DECODER ++QASM_PY := ../local/bin/qasm.py ++VASMVIDCORE := ../local/bin/vasmvidcore_std ++ ++ifneq ("$(wildcard $(QASM_PY))","") ++$(SUBDIR)rpi_hevc_shader.c: $(SUBDIR)rpi_hevc_shader.qasm ++ $(QASM_PY) -mc_c:rpi_hevc_shader,rpi_hevc_shader,ff_hevc_rpi_shader $< > $@ ++ ++$(SUBDIR)rpi_hevc_shader.h: $(SUBDIR)rpi_hevc_shader.qasm ++ $(QASM_PY) -mc_h:rpi_hevc_shader,rpi_hevc_shader,ff_hevc_rpi_shader $< > $@ ++endif ++ ++ifneq ("$(wildcard $(VASMVIDCORE))","") ++$(SUBDIR)rpi_hevc_transform8.bin: $(SUBDIR)rpi_hevc_transform.s ++ $(VASMVIDCORE) -Fbin -DBIT_DEPTH=8 $< -o $@ ++$(SUBDIR)rpi_hevc_transform10.bin: $(SUBDIR)rpi_hevc_transform.s ++ $(VASMVIDCORE) -Fbin -DBIT_DEPTH=10 $< -o $@ ++ ++$(SUBDIR)rpi_hevc_transform8.h: $(SUBDIR)rpi_hevc_transform8.bin ++ python pi-util/make_array.py $< ++$(SUBDIR)rpi_hevc_transform10.h: $(SUBDIR)rpi_hevc_transform10.bin ++ python pi-util/make_array.py $< ++endif ++ ++$(SUBDIR)rpi_qpu.o: $(SUBDIR)rpi_hevc_transform8.h $(SUBDIR)rpi_hevc_transform10.h ++$(SUBDIR)rpi_hevcdec.o $(SUBDIR)rpi_shader_template.o $(SUBDIR)rpi_qpu.o: $(SUBDIR)rpi_hevc_shader.h ++endif +--- a/libavcodec/aarch64/Makefile ++++ b/libavcodec/aarch64/Makefile +@@ -44,10 +44,12 @@ NEON-OBJS-$(CONFIG_H264PRED) + NEON-OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_neon.o \ + aarch64/hpeldsp_neon.o + NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o +-NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/simple_idct_neon.o ++NEON-OBJS-$(CONFIG_IDCTDSP) += aarch64/idctdsp_neon.o \ ++ aarch64/simple_idct_neon.o + NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o + NEON-OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_neon.o + NEON-OBJS-$(CONFIG_PIXBLOCKDSP) += aarch64/pixblockdsp_neon.o ++NEON-OBJS-$(CONFIG_VC1DSP) += aarch64/vc1dsp_neon.o + NEON-OBJS-$(CONFIG_VP8DSP) += aarch64/vp8dsp_neon.o + + # decoders/encoders +--- a/libavcodec/aarch64/idctdsp_init_aarch64.c ++++ b/libavcodec/aarch64/idctdsp_init_aarch64.c +@@ -27,19 +27,29 @@ + #include "libavcodec/idctdsp.h" + #include "idct.h" + ++void ff_put_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); ++void ff_put_signed_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); ++void ff_add_pixels_clamped_neon(const int16_t *, uint8_t *, ptrdiff_t); ++ + av_cold void ff_idctdsp_init_aarch64(IDCTDSPContext *c, AVCodecContext *avctx, + unsigned high_bit_depth) + { + int cpu_flags = av_get_cpu_flags(); + +- if (have_neon(cpu_flags) && !avctx->lowres && !high_bit_depth) { +- if (avctx->idct_algo == FF_IDCT_AUTO || +- avctx->idct_algo == FF_IDCT_SIMPLEAUTO || +- avctx->idct_algo == FF_IDCT_SIMPLENEON) { +- c->idct_put = ff_simple_idct_put_neon; +- c->idct_add = ff_simple_idct_add_neon; +- c->idct = ff_simple_idct_neon; +- c->perm_type = FF_IDCT_PERM_PARTTRANS; ++ if (have_neon(cpu_flags)) { ++ if (!avctx->lowres && !high_bit_depth) { ++ if (avctx->idct_algo == FF_IDCT_AUTO || ++ avctx->idct_algo == FF_IDCT_SIMPLEAUTO || ++ avctx->idct_algo == FF_IDCT_SIMPLENEON) { ++ c->idct_put = ff_simple_idct_put_neon; ++ c->idct_add = ff_simple_idct_add_neon; ++ c->idct = ff_simple_idct_neon; ++ c->perm_type = FF_IDCT_PERM_PARTTRANS; ++ } + } ++ ++ c->add_pixels_clamped = ff_add_pixels_clamped_neon; ++ c->put_pixels_clamped = ff_put_pixels_clamped_neon; ++ c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon; + } + } +--- /dev/null ++++ b/libavcodec/aarch64/idctdsp_neon.S +@@ -0,0 +1,130 @@ ++/* ++ * IDCT AArch64 NEON optimisations ++ * ++ * Copyright (c) 2022 Ben Avison ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/aarch64/asm.S" ++ ++// Clamp 16-bit signed block coefficients to unsigned 8-bit ++// On entry: ++// x0 -> array of 64x 16-bit coefficients ++// x1 -> 8-bit results ++// x2 = row stride for results, bytes ++function ff_put_pixels_clamped_neon, export=1 ++ ld1 {v0.16b, v1.16b, v2.16b, v3.16b}, [x0], #64 ++ ld1 {v4.16b, v5.16b, v6.16b, v7.16b}, [x0] ++ sqxtun v0.8b, v0.8h ++ sqxtun v1.8b, v1.8h ++ sqxtun v2.8b, v2.8h ++ sqxtun v3.8b, v3.8h ++ sqxtun v4.8b, v4.8h ++ st1 {v0.8b}, [x1], x2 ++ sqxtun v0.8b, v5.8h ++ st1 {v1.8b}, [x1], x2 ++ sqxtun v1.8b, v6.8h ++ st1 {v2.8b}, [x1], x2 ++ sqxtun v2.8b, v7.8h ++ st1 {v3.8b}, [x1], x2 ++ st1 {v4.8b}, [x1], x2 ++ st1 {v0.8b}, [x1], x2 ++ st1 {v1.8b}, [x1], x2 ++ st1 {v2.8b}, [x1] ++ ret ++endfunc ++ ++// Clamp 16-bit signed block coefficients to signed 8-bit (biased by 128) ++// On entry: ++// x0 -> array of 64x 16-bit coefficients ++// x1 -> 8-bit results ++// x2 = row stride for results, bytes ++function ff_put_signed_pixels_clamped_neon, export=1 ++ ld1 {v0.16b, v1.16b, v2.16b, v3.16b}, [x0], #64 ++ movi v4.8b, #128 ++ ld1 {v16.16b, v17.16b, v18.16b, v19.16b}, [x0] ++ sqxtn v0.8b, v0.8h ++ sqxtn v1.8b, v1.8h ++ sqxtn v2.8b, v2.8h ++ sqxtn v3.8b, v3.8h ++ sqxtn v5.8b, v16.8h ++ add v0.8b, v0.8b, v4.8b ++ sqxtn v6.8b, v17.8h ++ add v1.8b, v1.8b, v4.8b ++ sqxtn v7.8b, v18.8h ++ add v2.8b, v2.8b, v4.8b ++ sqxtn v16.8b, v19.8h ++ add v3.8b, v3.8b, v4.8b ++ st1 {v0.8b}, [x1], x2 ++ add v0.8b, v5.8b, v4.8b ++ st1 {v1.8b}, [x1], x2 ++ add v1.8b, v6.8b, v4.8b ++ st1 {v2.8b}, [x1], x2 ++ add v2.8b, v7.8b, v4.8b ++ st1 {v3.8b}, [x1], x2 ++ add v3.8b, v16.8b, v4.8b ++ st1 {v0.8b}, [x1], x2 ++ st1 {v1.8b}, [x1], x2 ++ st1 {v2.8b}, [x1], x2 ++ st1 {v3.8b}, [x1] ++ ret ++endfunc ++ ++// Add 16-bit signed block coefficients to unsigned 8-bit ++// On entry: ++// x0 -> array of 64x 16-bit coefficients ++// x1 -> 8-bit input and results ++// x2 = row stride for 8-bit input and results, bytes ++function ff_add_pixels_clamped_neon, export=1 ++ ld1 {v0.16b, v1.16b, v2.16b, v3.16b}, [x0], #64 ++ mov x3, x1 ++ ld1 {v4.8b}, [x1], x2 ++ ld1 {v5.8b}, [x1], x2 ++ ld1 {v6.8b}, [x1], x2 ++ ld1 {v7.8b}, [x1], x2 ++ ld1 {v16.16b, v17.16b, v18.16b, v19.16b}, [x0] ++ uaddw v0.8h, v0.8h, v4.8b ++ uaddw v1.8h, v1.8h, v5.8b ++ uaddw v2.8h, v2.8h, v6.8b ++ ld1 {v4.8b}, [x1], x2 ++ uaddw v3.8h, v3.8h, v7.8b ++ ld1 {v5.8b}, [x1], x2 ++ sqxtun v0.8b, v0.8h ++ ld1 {v6.8b}, [x1], x2 ++ sqxtun v1.8b, v1.8h ++ ld1 {v7.8b}, [x1] ++ sqxtun v2.8b, v2.8h ++ sqxtun v3.8b, v3.8h ++ uaddw v4.8h, v16.8h, v4.8b ++ st1 {v0.8b}, [x3], x2 ++ uaddw v0.8h, v17.8h, v5.8b ++ st1 {v1.8b}, [x3], x2 ++ uaddw v1.8h, v18.8h, v6.8b ++ st1 {v2.8b}, [x3], x2 ++ uaddw v2.8h, v19.8h, v7.8b ++ sqxtun v4.8b, v4.8h ++ sqxtun v0.8b, v0.8h ++ st1 {v3.8b}, [x3], x2 ++ sqxtun v1.8b, v1.8h ++ sqxtun v2.8b, v2.8h ++ st1 {v4.8b}, [x3], x2 ++ st1 {v0.8b}, [x3], x2 ++ st1 {v1.8b}, [x3], x2 ++ st1 {v2.8b}, [x3] ++ ret ++endfunc +--- a/libavcodec/aarch64/vc1dsp_init_aarch64.c ++++ b/libavcodec/aarch64/vc1dsp_init_aarch64.c +@@ -21,10 +21,28 @@ + #include "libavutil/attributes.h" + #include "libavutil/cpu.h" + #include "libavutil/aarch64/cpu.h" ++#include "libavutil/intreadwrite.h" + #include "libavcodec/vc1dsp.h" + + #include "config.h" + ++void ff_vc1_inv_trans_8x8_neon(int16_t *block); ++void ff_vc1_inv_trans_8x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); ++void ff_vc1_inv_trans_4x8_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); ++void ff_vc1_inv_trans_4x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); ++ ++void ff_vc1_inv_trans_8x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); ++void ff_vc1_inv_trans_8x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); ++void ff_vc1_inv_trans_4x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); ++void ff_vc1_inv_trans_4x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); ++ ++void ff_vc1_v_loop_filter4_neon(uint8_t *src, ptrdiff_t stride, int pq); ++void ff_vc1_h_loop_filter4_neon(uint8_t *src, ptrdiff_t stride, int pq); ++void ff_vc1_v_loop_filter8_neon(uint8_t *src, ptrdiff_t stride, int pq); ++void ff_vc1_h_loop_filter8_neon(uint8_t *src, ptrdiff_t stride, int pq); ++void ff_vc1_v_loop_filter16_neon(uint8_t *src, ptrdiff_t stride, int pq); ++void ff_vc1_h_loop_filter16_neon(uint8_t *src, ptrdiff_t stride, int pq); ++ + void ff_put_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + void ff_avg_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, +@@ -34,14 +52,90 @@ void ff_put_vc1_chroma_mc4_neon(uint8_t + void ff_avg_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + ++int ff_vc1_unescape_buffer_helper_neon(const uint8_t *src, int size, uint8_t *dst); ++ ++static int vc1_unescape_buffer_neon(const uint8_t *src, int size, uint8_t *dst) ++{ ++ /* Dealing with starting and stopping, and removing escape bytes, are ++ * comparatively less time-sensitive, so are more clearly expressed using ++ * a C wrapper around the assembly inner loop. Note that we assume a ++ * little-endian machine that supports unaligned loads. */ ++ int dsize = 0; ++ while (size >= 4) ++ { ++ int found = 0; ++ while (!found && (((uintptr_t) dst) & 7) && size >= 4) ++ { ++ found = (AV_RL32(src) &~ 0x03000000) == 0x00030000; ++ if (!found) ++ { ++ *dst++ = *src++; ++ --size; ++ ++dsize; ++ } ++ } ++ if (!found) ++ { ++ int skip = size - ff_vc1_unescape_buffer_helper_neon(src, size, dst); ++ dst += skip; ++ src += skip; ++ size -= skip; ++ dsize += skip; ++ while (!found && size >= 4) ++ { ++ found = (AV_RL32(src) &~ 0x03000000) == 0x00030000; ++ if (!found) ++ { ++ *dst++ = *src++; ++ --size; ++ ++dsize; ++ } ++ } ++ } ++ if (found) ++ { ++ *dst++ = *src++; ++ *dst++ = *src++; ++ ++src; ++ size -= 3; ++ dsize += 2; ++ } ++ } ++ while (size > 0) ++ { ++ *dst++ = *src++; ++ --size; ++ ++dsize; ++ } ++ return dsize; ++} ++ + av_cold void ff_vc1dsp_init_aarch64(VC1DSPContext *dsp) + { + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { ++ dsp->vc1_inv_trans_8x8 = ff_vc1_inv_trans_8x8_neon; ++ dsp->vc1_inv_trans_8x4 = ff_vc1_inv_trans_8x4_neon; ++ dsp->vc1_inv_trans_4x8 = ff_vc1_inv_trans_4x8_neon; ++ dsp->vc1_inv_trans_4x4 = ff_vc1_inv_trans_4x4_neon; ++ dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_neon; ++ dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_neon; ++ dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_neon; ++ dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_neon; ++ ++ dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_neon; ++ dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_neon; ++ dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_neon; ++ dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_neon; ++ dsp->vc1_v_loop_filter16 = ff_vc1_v_loop_filter16_neon; ++ dsp->vc1_h_loop_filter16 = ff_vc1_h_loop_filter16_neon; ++ + dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_neon; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_neon; + dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = ff_put_vc1_chroma_mc4_neon; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = ff_avg_vc1_chroma_mc4_neon; ++ ++ dsp->vc1_unescape_buffer = vc1_unescape_buffer_neon; + } + } +--- /dev/null ++++ b/libavcodec/aarch64/vc1dsp_neon.S +@@ -0,0 +1,1546 @@ ++/* ++ * VC1 AArch64 NEON optimisations ++ * ++ * Copyright (c) 2022 Ben Avison ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/aarch64/asm.S" ++ ++// VC-1 8x8 inverse transform ++// On entry: ++// x0 -> array of 16-bit inverse transform coefficients, in column-major order ++// On exit: ++// array at x0 updated to hold transformed block; also now held in row-major order ++function ff_vc1_inv_trans_8x8_neon, export=1 ++ ld1 {v1.16b, v2.16b}, [x0], #32 ++ ld1 {v3.16b, v4.16b}, [x0], #32 ++ ld1 {v5.16b, v6.16b}, [x0], #32 ++ shl v1.8h, v1.8h, #2 // 8/2 * src[0] ++ sub x1, x0, #3*32 ++ ld1 {v16.16b, v17.16b}, [x0] ++ shl v7.8h, v2.8h, #4 // 16 * src[8] ++ shl v18.8h, v2.8h, #2 // 4 * src[8] ++ shl v19.8h, v4.8h, #4 // 16 * src[24] ++ ldr d0, .Lcoeffs_it8 ++ shl v5.8h, v5.8h, #2 // 8/2 * src[32] ++ shl v20.8h, v6.8h, #4 // 16 * src[40] ++ shl v21.8h, v6.8h, #2 // 4 * src[40] ++ shl v22.8h, v17.8h, #4 // 16 * src[56] ++ ssra v20.8h, v19.8h, #2 // 4 * src[24] + 16 * src[40] ++ mul v23.8h, v3.8h, v0.h[0] // 6/2 * src[16] ++ sub v19.8h, v19.8h, v21.8h // 16 * src[24] - 4 * src[40] ++ ssra v7.8h, v22.8h, #2 // 16 * src[8] + 4 * src[56] ++ sub v18.8h, v22.8h, v18.8h // - 4 * src[8] + 16 * src[56] ++ shl v3.8h, v3.8h, #3 // 16/2 * src[16] ++ mls v20.8h, v2.8h, v0.h[2] // - 15 * src[8] + 4 * src[24] + 16 * src[40] ++ ssra v1.8h, v1.8h, #1 // 12/2 * src[0] ++ ssra v5.8h, v5.8h, #1 // 12/2 * src[32] ++ mla v7.8h, v4.8h, v0.h[2] // 16 * src[8] + 15 * src[24] + 4 * src[56] ++ shl v21.8h, v16.8h, #3 // 16/2 * src[48] ++ mls v19.8h, v2.8h, v0.h[1] // - 9 * src[8] + 16 * src[24] - 4 * src[40] ++ sub v2.8h, v23.8h, v21.8h // t4/2 = 6/2 * src[16] - 16/2 * src[48] ++ mla v18.8h, v4.8h, v0.h[1] // - 4 * src[8] + 9 * src[24] + 16 * src[56] ++ add v4.8h, v1.8h, v5.8h // t1/2 = 12/2 * src[0] + 12/2 * src[32] ++ sub v1.8h, v1.8h, v5.8h // t2/2 = 12/2 * src[0] - 12/2 * src[32] ++ mla v3.8h, v16.8h, v0.h[0] // t3/2 = 16/2 * src[16] + 6/2 * src[48] ++ mla v7.8h, v6.8h, v0.h[1] // t1 = 16 * src[8] + 15 * src[24] + 9 * src[40] + 4 * src[56] ++ add v5.8h, v1.8h, v2.8h // t6/2 = t2/2 + t4/2 ++ sub v16.8h, v1.8h, v2.8h // t7/2 = t2/2 - t4/2 ++ mla v20.8h, v17.8h, v0.h[1] // -t2 = - 15 * src[8] + 4 * src[24] + 16 * src[40] + 9 * src[56] ++ add v21.8h, v1.8h, v2.8h // t6/2 = t2/2 + t4/2 ++ add v22.8h, v4.8h, v3.8h // t5/2 = t1/2 + t3/2 ++ mls v19.8h, v17.8h, v0.h[2] // -t3 = - 9 * src[8] + 16 * src[24] - 4 * src[40] - 15 * src[56] ++ sub v17.8h, v4.8h, v3.8h // t8/2 = t1/2 - t3/2 ++ add v23.8h, v4.8h, v3.8h // t5/2 = t1/2 + t3/2 ++ mls v18.8h, v6.8h, v0.h[2] // -t4 = - 4 * src[8] + 9 * src[24] - 15 * src[40] + 16 * src[56] ++ sub v1.8h, v1.8h, v2.8h // t7/2 = t2/2 - t4/2 ++ sub v2.8h, v4.8h, v3.8h // t8/2 = t1/2 - t3/2 ++ neg v3.8h, v7.8h // -t1 ++ neg v4.8h, v20.8h // +t2 ++ neg v6.8h, v19.8h // +t3 ++ ssra v22.8h, v7.8h, #1 // (t5 + t1) >> 1 ++ ssra v1.8h, v19.8h, #1 // (t7 - t3) >> 1 ++ neg v7.8h, v18.8h // +t4 ++ ssra v5.8h, v4.8h, #1 // (t6 + t2) >> 1 ++ ssra v16.8h, v6.8h, #1 // (t7 + t3) >> 1 ++ ssra v2.8h, v18.8h, #1 // (t8 - t4) >> 1 ++ ssra v17.8h, v7.8h, #1 // (t8 + t4) >> 1 ++ ssra v21.8h, v20.8h, #1 // (t6 - t2) >> 1 ++ ssra v23.8h, v3.8h, #1 // (t5 - t1) >> 1 ++ srshr v3.8h, v22.8h, #2 // (t5 + t1 + 4) >> 3 ++ srshr v4.8h, v5.8h, #2 // (t6 + t2 + 4) >> 3 ++ srshr v5.8h, v16.8h, #2 // (t7 + t3 + 4) >> 3 ++ srshr v6.8h, v17.8h, #2 // (t8 + t4 + 4) >> 3 ++ srshr v2.8h, v2.8h, #2 // (t8 - t4 + 4) >> 3 ++ srshr v1.8h, v1.8h, #2 // (t7 - t3 + 4) >> 3 ++ srshr v7.8h, v21.8h, #2 // (t6 - t2 + 4) >> 3 ++ srshr v16.8h, v23.8h, #2 // (t5 - t1 + 4) >> 3 ++ trn2 v17.8h, v3.8h, v4.8h ++ trn2 v18.8h, v5.8h, v6.8h ++ trn2 v19.8h, v2.8h, v1.8h ++ trn2 v20.8h, v7.8h, v16.8h ++ trn1 v21.4s, v17.4s, v18.4s ++ trn2 v17.4s, v17.4s, v18.4s ++ trn1 v18.4s, v19.4s, v20.4s ++ trn2 v19.4s, v19.4s, v20.4s ++ trn1 v3.8h, v3.8h, v4.8h ++ trn2 v4.2d, v21.2d, v18.2d ++ trn1 v20.2d, v17.2d, v19.2d ++ trn1 v5.8h, v5.8h, v6.8h ++ trn1 v1.8h, v2.8h, v1.8h ++ trn1 v2.8h, v7.8h, v16.8h ++ trn1 v6.2d, v21.2d, v18.2d ++ trn2 v7.2d, v17.2d, v19.2d ++ shl v16.8h, v20.8h, #4 // 16 * src[24] ++ shl v17.8h, v4.8h, #4 // 16 * src[40] ++ trn1 v18.4s, v3.4s, v5.4s ++ trn1 v19.4s, v1.4s, v2.4s ++ shl v21.8h, v7.8h, #4 // 16 * src[56] ++ shl v22.8h, v6.8h, #2 // 4 * src[8] ++ shl v23.8h, v4.8h, #2 // 4 * src[40] ++ trn2 v3.4s, v3.4s, v5.4s ++ trn2 v1.4s, v1.4s, v2.4s ++ shl v2.8h, v6.8h, #4 // 16 * src[8] ++ sub v5.8h, v16.8h, v23.8h // 16 * src[24] - 4 * src[40] ++ ssra v17.8h, v16.8h, #2 // 4 * src[24] + 16 * src[40] ++ sub v16.8h, v21.8h, v22.8h // - 4 * src[8] + 16 * src[56] ++ trn1 v22.2d, v18.2d, v19.2d ++ trn2 v18.2d, v18.2d, v19.2d ++ trn1 v19.2d, v3.2d, v1.2d ++ ssra v2.8h, v21.8h, #2 // 16 * src[8] + 4 * src[56] ++ mls v17.8h, v6.8h, v0.h[2] // - 15 * src[8] + 4 * src[24] + 16 * src[40] ++ shl v21.8h, v22.8h, #2 // 8/2 * src[0] ++ shl v18.8h, v18.8h, #2 // 8/2 * src[32] ++ mls v5.8h, v6.8h, v0.h[1] // - 9 * src[8] + 16 * src[24] - 4 * src[40] ++ shl v6.8h, v19.8h, #3 // 16/2 * src[16] ++ trn2 v1.2d, v3.2d, v1.2d ++ mla v16.8h, v20.8h, v0.h[1] // - 4 * src[8] + 9 * src[24] + 16 * src[56] ++ ssra v21.8h, v21.8h, #1 // 12/2 * src[0] ++ ssra v18.8h, v18.8h, #1 // 12/2 * src[32] ++ mul v3.8h, v19.8h, v0.h[0] // 6/2 * src[16] ++ shl v19.8h, v1.8h, #3 // 16/2 * src[48] ++ mla v2.8h, v20.8h, v0.h[2] // 16 * src[8] + 15 * src[24] + 4 * src[56] ++ add v20.8h, v21.8h, v18.8h // t1/2 = 12/2 * src[0] + 12/2 * src[32] ++ mla v6.8h, v1.8h, v0.h[0] // t3/2 = 16/2 * src[16] + 6/2 * src[48] ++ sub v1.8h, v21.8h, v18.8h // t2/2 = 12/2 * src[0] - 12/2 * src[32] ++ sub v3.8h, v3.8h, v19.8h // t4/2 = 6/2 * src[16] - 16/2 * src[48] ++ mla v17.8h, v7.8h, v0.h[1] // -t2 = - 15 * src[8] + 4 * src[24] + 16 * src[40] + 9 * src[56] ++ mls v5.8h, v7.8h, v0.h[2] // -t3 = - 9 * src[8] + 16 * src[24] - 4 * src[40] - 15 * src[56] ++ add v7.8h, v1.8h, v3.8h // t6/2 = t2/2 + t4/2 ++ add v18.8h, v20.8h, v6.8h // t5/2 = t1/2 + t3/2 ++ mls v16.8h, v4.8h, v0.h[2] // -t4 = - 4 * src[8] + 9 * src[24] - 15 * src[40] + 16 * src[56] ++ sub v19.8h, v1.8h, v3.8h // t7/2 = t2/2 - t4/2 ++ neg v21.8h, v17.8h // +t2 ++ mla v2.8h, v4.8h, v0.h[1] // t1 = 16 * src[8] + 15 * src[24] + 9 * src[40] + 4 * src[56] ++ sub v0.8h, v20.8h, v6.8h // t8/2 = t1/2 - t3/2 ++ neg v4.8h, v5.8h // +t3 ++ sub v22.8h, v1.8h, v3.8h // t7/2 = t2/2 - t4/2 ++ sub v23.8h, v20.8h, v6.8h // t8/2 = t1/2 - t3/2 ++ neg v24.8h, v16.8h // +t4 ++ add v6.8h, v20.8h, v6.8h // t5/2 = t1/2 + t3/2 ++ add v1.8h, v1.8h, v3.8h // t6/2 = t2/2 + t4/2 ++ ssra v7.8h, v21.8h, #1 // (t6 + t2) >> 1 ++ neg v3.8h, v2.8h // -t1 ++ ssra v18.8h, v2.8h, #1 // (t5 + t1) >> 1 ++ ssra v19.8h, v4.8h, #1 // (t7 + t3) >> 1 ++ ssra v0.8h, v24.8h, #1 // (t8 + t4) >> 1 ++ srsra v23.8h, v16.8h, #1 // (t8 - t4 + 1) >> 1 ++ srsra v22.8h, v5.8h, #1 // (t7 - t3 + 1) >> 1 ++ srsra v1.8h, v17.8h, #1 // (t6 - t2 + 1) >> 1 ++ srsra v6.8h, v3.8h, #1 // (t5 - t1 + 1) >> 1 ++ srshr v2.8h, v18.8h, #6 // (t5 + t1 + 64) >> 7 ++ srshr v3.8h, v7.8h, #6 // (t6 + t2 + 64) >> 7 ++ srshr v4.8h, v19.8h, #6 // (t7 + t3 + 64) >> 7 ++ srshr v5.8h, v0.8h, #6 // (t8 + t4 + 64) >> 7 ++ srshr v16.8h, v23.8h, #6 // (t8 - t4 + 65) >> 7 ++ srshr v17.8h, v22.8h, #6 // (t7 - t3 + 65) >> 7 ++ st1 {v2.16b, v3.16b}, [x1], #32 ++ srshr v0.8h, v1.8h, #6 // (t6 - t2 + 65) >> 7 ++ srshr v1.8h, v6.8h, #6 // (t5 - t1 + 65) >> 7 ++ st1 {v4.16b, v5.16b}, [x1], #32 ++ st1 {v16.16b, v17.16b}, [x1], #32 ++ st1 {v0.16b, v1.16b}, [x1] ++ ret ++endfunc ++ ++// VC-1 8x4 inverse transform ++// On entry: ++// x0 -> array of 8-bit samples, in row-major order ++// x1 = row stride for 8-bit sample array ++// x2 -> array of 16-bit inverse transform coefficients, in row-major order ++// On exit: ++// array at x0 updated by saturated addition of (narrowed) transformed block ++function ff_vc1_inv_trans_8x4_neon, export=1 ++ ld1 {v1.8b, v2.8b, v3.8b, v4.8b}, [x2], #32 ++ mov x3, x0 ++ ld1 {v16.8b, v17.8b, v18.8b, v19.8b}, [x2] ++ ldr q0, .Lcoeffs_it8 // includes 4-point coefficients in upper half of vector ++ ld1 {v5.8b}, [x0], x1 ++ trn2 v6.4h, v1.4h, v3.4h ++ trn2 v7.4h, v2.4h, v4.4h ++ trn1 v1.4h, v1.4h, v3.4h ++ trn1 v2.4h, v2.4h, v4.4h ++ trn2 v3.4h, v16.4h, v18.4h ++ trn2 v4.4h, v17.4h, v19.4h ++ trn1 v16.4h, v16.4h, v18.4h ++ trn1 v17.4h, v17.4h, v19.4h ++ ld1 {v18.8b}, [x0], x1 ++ trn1 v19.2s, v6.2s, v3.2s ++ trn2 v3.2s, v6.2s, v3.2s ++ trn1 v6.2s, v7.2s, v4.2s ++ trn2 v4.2s, v7.2s, v4.2s ++ trn1 v7.2s, v1.2s, v16.2s ++ trn1 v20.2s, v2.2s, v17.2s ++ shl v21.4h, v19.4h, #4 // 16 * src[1] ++ trn2 v1.2s, v1.2s, v16.2s ++ shl v16.4h, v3.4h, #4 // 16 * src[3] ++ trn2 v2.2s, v2.2s, v17.2s ++ shl v17.4h, v6.4h, #4 // 16 * src[5] ++ ld1 {v22.8b}, [x0], x1 ++ shl v23.4h, v4.4h, #4 // 16 * src[7] ++ mul v24.4h, v1.4h, v0.h[0] // 6/2 * src[2] ++ ld1 {v25.8b}, [x0] ++ shl v26.4h, v19.4h, #2 // 4 * src[1] ++ shl v27.4h, v6.4h, #2 // 4 * src[5] ++ ssra v21.4h, v23.4h, #2 // 16 * src[1] + 4 * src[7] ++ ssra v17.4h, v16.4h, #2 // 4 * src[3] + 16 * src[5] ++ sub v23.4h, v23.4h, v26.4h // - 4 * src[1] + 16 * src[7] ++ sub v16.4h, v16.4h, v27.4h // 16 * src[3] - 4 * src[5] ++ shl v7.4h, v7.4h, #2 // 8/2 * src[0] ++ shl v20.4h, v20.4h, #2 // 8/2 * src[4] ++ mla v21.4h, v3.4h, v0.h[2] // 16 * src[1] + 15 * src[3] + 4 * src[7] ++ shl v1.4h, v1.4h, #3 // 16/2 * src[2] ++ mls v17.4h, v19.4h, v0.h[2] // - 15 * src[1] + 4 * src[3] + 16 * src[5] ++ ssra v7.4h, v7.4h, #1 // 12/2 * src[0] ++ mls v16.4h, v19.4h, v0.h[1] // - 9 * src[1] + 16 * src[3] - 4 * src[5] ++ ssra v20.4h, v20.4h, #1 // 12/2 * src[4] ++ mla v23.4h, v3.4h, v0.h[1] // - 4 * src[1] + 9 * src[3] + 16 * src[7] ++ shl v3.4h, v2.4h, #3 // 16/2 * src[6] ++ mla v1.4h, v2.4h, v0.h[0] // t3/2 = 16/2 * src[2] + 6/2 * src[6] ++ mla v21.4h, v6.4h, v0.h[1] // t1 = 16 * src[1] + 15 * src[3] + 9 * src[5] + 4 * src[7] ++ mla v17.4h, v4.4h, v0.h[1] // -t2 = - 15 * src[1] + 4 * src[3] + 16 * src[5] + 9 * src[7] ++ sub v2.4h, v24.4h, v3.4h // t4/2 = 6/2 * src[2] - 16/2 * src[6] ++ mls v16.4h, v4.4h, v0.h[2] // -t3 = - 9 * src[1] + 16 * src[3] - 4 * src[5] - 15 * src[7] ++ add v3.4h, v7.4h, v20.4h // t1/2 = 12/2 * src[0] + 12/2 * src[4] ++ mls v23.4h, v6.4h, v0.h[2] // -t4 = - 4 * src[1] + 9 * src[3] - 15 * src[5] + 16 * src[7] ++ sub v4.4h, v7.4h, v20.4h // t2/2 = 12/2 * src[0] - 12/2 * src[4] ++ neg v6.4h, v21.4h // -t1 ++ add v7.4h, v3.4h, v1.4h // t5/2 = t1/2 + t3/2 ++ sub v19.4h, v3.4h, v1.4h // t8/2 = t1/2 - t3/2 ++ add v20.4h, v4.4h, v2.4h // t6/2 = t2/2 + t4/2 ++ sub v24.4h, v4.4h, v2.4h // t7/2 = t2/2 - t4/2 ++ add v26.4h, v3.4h, v1.4h // t5/2 = t1/2 + t3/2 ++ add v27.4h, v4.4h, v2.4h // t6/2 = t2/2 + t4/2 ++ sub v2.4h, v4.4h, v2.4h // t7/2 = t2/2 - t4/2 ++ sub v1.4h, v3.4h, v1.4h // t8/2 = t1/2 - t3/2 ++ neg v3.4h, v17.4h // +t2 ++ neg v4.4h, v16.4h // +t3 ++ neg v28.4h, v23.4h // +t4 ++ ssra v7.4h, v21.4h, #1 // (t5 + t1) >> 1 ++ ssra v1.4h, v23.4h, #1 // (t8 - t4) >> 1 ++ ssra v20.4h, v3.4h, #1 // (t6 + t2) >> 1 ++ ssra v24.4h, v4.4h, #1 // (t7 + t3) >> 1 ++ ssra v19.4h, v28.4h, #1 // (t8 + t4) >> 1 ++ ssra v2.4h, v16.4h, #1 // (t7 - t3) >> 1 ++ ssra v27.4h, v17.4h, #1 // (t6 - t2) >> 1 ++ ssra v26.4h, v6.4h, #1 // (t5 - t1) >> 1 ++ trn1 v1.2d, v7.2d, v1.2d ++ trn1 v2.2d, v20.2d, v2.2d ++ trn1 v3.2d, v24.2d, v27.2d ++ trn1 v4.2d, v19.2d, v26.2d ++ srshr v1.8h, v1.8h, #2 // (t5 + t1 + 4) >> 3, (t8 - t4 + 4) >> 3 ++ srshr v2.8h, v2.8h, #2 // (t6 + t2 + 4) >> 3, (t7 - t3 + 4) >> 3 ++ srshr v3.8h, v3.8h, #2 // (t7 + t3 + 4) >> 3, (t6 - t2 + 4) >> 3 ++ srshr v4.8h, v4.8h, #2 // (t8 + t4 + 4) >> 3, (t5 - t1 + 4) >> 3 ++ trn2 v6.8h, v1.8h, v2.8h ++ trn1 v1.8h, v1.8h, v2.8h ++ trn2 v2.8h, v3.8h, v4.8h ++ trn1 v3.8h, v3.8h, v4.8h ++ trn2 v4.4s, v6.4s, v2.4s ++ trn1 v7.4s, v1.4s, v3.4s ++ trn2 v1.4s, v1.4s, v3.4s ++ mul v3.8h, v4.8h, v0.h[5] // 22/2 * src[24] ++ trn1 v2.4s, v6.4s, v2.4s ++ mul v4.8h, v4.8h, v0.h[4] // 10/2 * src[24] ++ mul v6.8h, v7.8h, v0.h[6] // 17 * src[0] ++ mul v1.8h, v1.8h, v0.h[6] // 17 * src[16] ++ mls v3.8h, v2.8h, v0.h[4] // t4/2 = - 10/2 * src[8] + 22/2 * src[24] ++ mla v4.8h, v2.8h, v0.h[5] // t3/2 = 22/2 * src[8] + 10/2 * src[24] ++ add v0.8h, v6.8h, v1.8h // t1 = 17 * src[0] + 17 * src[16] ++ sub v1.8h, v6.8h, v1.8h // t2 = 17 * src[0] - 17 * src[16] ++ neg v2.8h, v3.8h // -t4/2 ++ neg v6.8h, v4.8h // -t3/2 ++ ssra v4.8h, v0.8h, #1 // (t1 + t3) >> 1 ++ ssra v2.8h, v1.8h, #1 // (t2 - t4) >> 1 ++ ssra v3.8h, v1.8h, #1 // (t2 + t4) >> 1 ++ ssra v6.8h, v0.8h, #1 // (t1 - t3) >> 1 ++ srshr v0.8h, v4.8h, #6 // (t1 + t3 + 64) >> 7 ++ srshr v1.8h, v2.8h, #6 // (t2 - t4 + 64) >> 7 ++ srshr v2.8h, v3.8h, #6 // (t2 + t4 + 64) >> 7 ++ srshr v3.8h, v6.8h, #6 // (t1 - t3 + 64) >> 7 ++ uaddw v0.8h, v0.8h, v5.8b ++ uaddw v1.8h, v1.8h, v18.8b ++ uaddw v2.8h, v2.8h, v22.8b ++ uaddw v3.8h, v3.8h, v25.8b ++ sqxtun v0.8b, v0.8h ++ sqxtun v1.8b, v1.8h ++ sqxtun v2.8b, v2.8h ++ sqxtun v3.8b, v3.8h ++ st1 {v0.8b}, [x3], x1 ++ st1 {v1.8b}, [x3], x1 ++ st1 {v2.8b}, [x3], x1 ++ st1 {v3.8b}, [x3] ++ ret ++endfunc ++ ++// VC-1 4x8 inverse transform ++// On entry: ++// x0 -> array of 8-bit samples, in row-major order ++// x1 = row stride for 8-bit sample array ++// x2 -> array of 16-bit inverse transform coefficients, in row-major order (row stride is 8 coefficients) ++// On exit: ++// array at x0 updated by saturated addition of (narrowed) transformed block ++function ff_vc1_inv_trans_4x8_neon, export=1 ++ mov x3, #16 ++ ldr q0, .Lcoeffs_it8 // includes 4-point coefficients in upper half of vector ++ mov x4, x0 ++ ld1 {v1.d}[0], [x2], x3 // 00 01 02 03 ++ ld1 {v2.d}[0], [x2], x3 // 10 11 12 13 ++ ld1 {v3.d}[0], [x2], x3 // 20 21 22 23 ++ ld1 {v4.d}[0], [x2], x3 // 30 31 32 33 ++ ld1 {v1.d}[1], [x2], x3 // 40 41 42 43 ++ ld1 {v2.d}[1], [x2], x3 // 50 51 52 53 ++ ld1 {v3.d}[1], [x2], x3 // 60 61 62 63 ++ ld1 {v4.d}[1], [x2] // 70 71 72 73 ++ ld1 {v5.s}[0], [x0], x1 ++ ld1 {v6.s}[0], [x0], x1 ++ ld1 {v7.s}[0], [x0], x1 ++ trn2 v16.8h, v1.8h, v2.8h // 01 11 03 13 41 51 43 53 ++ trn1 v1.8h, v1.8h, v2.8h // 00 10 02 12 40 50 42 52 ++ trn2 v2.8h, v3.8h, v4.8h // 21 31 23 33 61 71 63 73 ++ trn1 v3.8h, v3.8h, v4.8h // 20 30 22 32 60 70 62 72 ++ ld1 {v4.s}[0], [x0], x1 ++ trn2 v17.4s, v16.4s, v2.4s // 03 13 23 33 43 53 63 73 ++ trn1 v18.4s, v1.4s, v3.4s // 00 10 20 30 40 50 60 70 ++ trn1 v2.4s, v16.4s, v2.4s // 01 11 21 31 41 51 61 71 ++ mul v16.8h, v17.8h, v0.h[4] // 10/2 * src[3] ++ ld1 {v5.s}[1], [x0], x1 ++ mul v17.8h, v17.8h, v0.h[5] // 22/2 * src[3] ++ ld1 {v6.s}[1], [x0], x1 ++ trn2 v1.4s, v1.4s, v3.4s // 02 12 22 32 42 52 62 72 ++ mul v3.8h, v18.8h, v0.h[6] // 17 * src[0] ++ ld1 {v7.s}[1], [x0], x1 ++ mul v1.8h, v1.8h, v0.h[6] // 17 * src[2] ++ ld1 {v4.s}[1], [x0] ++ mla v16.8h, v2.8h, v0.h[5] // t3/2 = 22/2 * src[1] + 10/2 * src[3] ++ mls v17.8h, v2.8h, v0.h[4] // t4/2 = - 10/2 * src[1] + 22/2 * src[3] ++ add v2.8h, v3.8h, v1.8h // t1 = 17 * src[0] + 17 * src[2] ++ sub v1.8h, v3.8h, v1.8h // t2 = 17 * src[0] - 17 * src[2] ++ neg v3.8h, v16.8h // -t3/2 ++ ssra v16.8h, v2.8h, #1 // (t1 + t3) >> 1 ++ neg v18.8h, v17.8h // -t4/2 ++ ssra v17.8h, v1.8h, #1 // (t2 + t4) >> 1 ++ ssra v3.8h, v2.8h, #1 // (t1 - t3) >> 1 ++ ssra v18.8h, v1.8h, #1 // (t2 - t4) >> 1 ++ srshr v1.8h, v16.8h, #2 // (t1 + t3 + 64) >> 3 ++ srshr v2.8h, v17.8h, #2 // (t2 + t4 + 64) >> 3 ++ srshr v3.8h, v3.8h, #2 // (t1 - t3 + 64) >> 3 ++ srshr v16.8h, v18.8h, #2 // (t2 - t4 + 64) >> 3 ++ trn2 v17.8h, v2.8h, v3.8h // 12 13 32 33 52 53 72 73 ++ trn2 v18.8h, v1.8h, v16.8h // 10 11 30 31 50 51 70 71 ++ trn1 v1.8h, v1.8h, v16.8h // 00 01 20 21 40 41 60 61 ++ trn1 v2.8h, v2.8h, v3.8h // 02 03 22 23 42 43 62 63 ++ trn1 v3.4s, v18.4s, v17.4s // 10 11 12 13 50 51 52 53 ++ trn2 v16.4s, v18.4s, v17.4s // 30 31 32 33 70 71 72 73 ++ trn1 v17.4s, v1.4s, v2.4s // 00 01 02 03 40 41 42 43 ++ mov d18, v3.d[1] // 50 51 52 53 ++ shl v19.4h, v3.4h, #4 // 16 * src[8] ++ mov d20, v16.d[1] // 70 71 72 73 ++ shl v21.4h, v16.4h, #4 // 16 * src[24] ++ mov d22, v17.d[1] // 40 41 42 43 ++ shl v23.4h, v3.4h, #2 // 4 * src[8] ++ shl v24.4h, v18.4h, #4 // 16 * src[40] ++ shl v25.4h, v20.4h, #4 // 16 * src[56] ++ shl v26.4h, v18.4h, #2 // 4 * src[40] ++ trn2 v1.4s, v1.4s, v2.4s // 20 21 22 23 60 61 62 63 ++ ssra v24.4h, v21.4h, #2 // 4 * src[24] + 16 * src[40] ++ sub v2.4h, v25.4h, v23.4h // - 4 * src[8] + 16 * src[56] ++ shl v17.4h, v17.4h, #2 // 8/2 * src[0] ++ sub v21.4h, v21.4h, v26.4h // 16 * src[24] - 4 * src[40] ++ shl v22.4h, v22.4h, #2 // 8/2 * src[32] ++ mov d23, v1.d[1] // 60 61 62 63 ++ ssra v19.4h, v25.4h, #2 // 16 * src[8] + 4 * src[56] ++ mul v25.4h, v1.4h, v0.h[0] // 6/2 * src[16] ++ shl v1.4h, v1.4h, #3 // 16/2 * src[16] ++ mls v24.4h, v3.4h, v0.h[2] // - 15 * src[8] + 4 * src[24] + 16 * src[40] ++ ssra v17.4h, v17.4h, #1 // 12/2 * src[0] ++ mls v21.4h, v3.4h, v0.h[1] // - 9 * src[8] + 16 * src[24] - 4 * src[40] ++ ssra v22.4h, v22.4h, #1 // 12/2 * src[32] ++ mla v2.4h, v16.4h, v0.h[1] // - 4 * src[8] + 9 * src[24] + 16 * src[56] ++ shl v3.4h, v23.4h, #3 // 16/2 * src[48] ++ mla v19.4h, v16.4h, v0.h[2] // 16 * src[8] + 15 * src[24] + 4 * src[56] ++ mla v1.4h, v23.4h, v0.h[0] // t3/2 = 16/2 * src[16] + 6/2 * src[48] ++ mla v24.4h, v20.4h, v0.h[1] // -t2 = - 15 * src[8] + 4 * src[24] + 16 * src[40] + 9 * src[56] ++ add v16.4h, v17.4h, v22.4h // t1/2 = 12/2 * src[0] + 12/2 * src[32] ++ sub v3.4h, v25.4h, v3.4h // t4/2 = 6/2 * src[16] - 16/2 * src[48] ++ sub v17.4h, v17.4h, v22.4h // t2/2 = 12/2 * src[0] - 12/2 * src[32] ++ mls v21.4h, v20.4h, v0.h[2] // -t3 = - 9 * src[8] + 16 * src[24] - 4 * src[40] - 15 * src[56] ++ mla v19.4h, v18.4h, v0.h[1] // t1 = 16 * src[8] + 15 * src[24] + 9 * src[40] + 4 * src[56] ++ add v20.4h, v16.4h, v1.4h // t5/2 = t1/2 + t3/2 ++ mls v2.4h, v18.4h, v0.h[2] // -t4 = - 4 * src[8] + 9 * src[24] - 15 * src[40] + 16 * src[56] ++ sub v0.4h, v16.4h, v1.4h // t8/2 = t1/2 - t3/2 ++ add v18.4h, v17.4h, v3.4h // t6/2 = t2/2 + t4/2 ++ sub v22.4h, v17.4h, v3.4h // t7/2 = t2/2 - t4/2 ++ neg v23.4h, v24.4h // +t2 ++ sub v25.4h, v17.4h, v3.4h // t7/2 = t2/2 - t4/2 ++ add v3.4h, v17.4h, v3.4h // t6/2 = t2/2 + t4/2 ++ neg v17.4h, v21.4h // +t3 ++ sub v26.4h, v16.4h, v1.4h // t8/2 = t1/2 - t3/2 ++ add v1.4h, v16.4h, v1.4h // t5/2 = t1/2 + t3/2 ++ neg v16.4h, v19.4h // -t1 ++ neg v27.4h, v2.4h // +t4 ++ ssra v20.4h, v19.4h, #1 // (t5 + t1) >> 1 ++ srsra v0.4h, v2.4h, #1 // (t8 - t4 + 1) >> 1 ++ ssra v18.4h, v23.4h, #1 // (t6 + t2) >> 1 ++ srsra v22.4h, v21.4h, #1 // (t7 - t3 + 1) >> 1 ++ ssra v25.4h, v17.4h, #1 // (t7 + t3) >> 1 ++ srsra v3.4h, v24.4h, #1 // (t6 - t2 + 1) >> 1 ++ ssra v26.4h, v27.4h, #1 // (t8 + t4) >> 1 ++ srsra v1.4h, v16.4h, #1 // (t5 - t1 + 1) >> 1 ++ trn1 v0.2d, v20.2d, v0.2d ++ trn1 v2.2d, v18.2d, v22.2d ++ trn1 v3.2d, v25.2d, v3.2d ++ trn1 v1.2d, v26.2d, v1.2d ++ srshr v0.8h, v0.8h, #6 // (t5 + t1 + 64) >> 7, (t8 - t4 + 65) >> 7 ++ srshr v2.8h, v2.8h, #6 // (t6 + t2 + 64) >> 7, (t7 - t3 + 65) >> 7 ++ srshr v3.8h, v3.8h, #6 // (t7 + t3 + 64) >> 7, (t6 - t2 + 65) >> 7 ++ srshr v1.8h, v1.8h, #6 // (t8 + t4 + 64) >> 7, (t5 - t1 + 65) >> 7 ++ uaddw v0.8h, v0.8h, v5.8b ++ uaddw v2.8h, v2.8h, v6.8b ++ uaddw v3.8h, v3.8h, v7.8b ++ uaddw v1.8h, v1.8h, v4.8b ++ sqxtun v0.8b, v0.8h ++ sqxtun v2.8b, v2.8h ++ sqxtun v3.8b, v3.8h ++ sqxtun v1.8b, v1.8h ++ st1 {v0.s}[0], [x4], x1 ++ st1 {v2.s}[0], [x4], x1 ++ st1 {v3.s}[0], [x4], x1 ++ st1 {v1.s}[0], [x4], x1 ++ st1 {v0.s}[1], [x4], x1 ++ st1 {v2.s}[1], [x4], x1 ++ st1 {v3.s}[1], [x4], x1 ++ st1 {v1.s}[1], [x4] ++ ret ++endfunc ++ ++// VC-1 4x4 inverse transform ++// On entry: ++// x0 -> array of 8-bit samples, in row-major order ++// x1 = row stride for 8-bit sample array ++// x2 -> array of 16-bit inverse transform coefficients, in row-major order (row stride is 8 coefficients) ++// On exit: ++// array at x0 updated by saturated addition of (narrowed) transformed block ++function ff_vc1_inv_trans_4x4_neon, export=1 ++ mov x3, #16 ++ ldr d0, .Lcoeffs_it4 ++ mov x4, x0 ++ ld1 {v1.d}[0], [x2], x3 // 00 01 02 03 ++ ld1 {v2.d}[0], [x2], x3 // 10 11 12 13 ++ ld1 {v3.d}[0], [x2], x3 // 20 21 22 23 ++ ld1 {v4.d}[0], [x2] // 30 31 32 33 ++ ld1 {v5.s}[0], [x0], x1 ++ ld1 {v5.s}[1], [x0], x1 ++ ld1 {v6.s}[0], [x0], x1 ++ trn2 v7.4h, v1.4h, v2.4h // 01 11 03 13 ++ trn1 v1.4h, v1.4h, v2.4h // 00 10 02 12 ++ ld1 {v6.s}[1], [x0] ++ trn2 v2.4h, v3.4h, v4.4h // 21 31 23 33 ++ trn1 v3.4h, v3.4h, v4.4h // 20 30 22 32 ++ trn2 v4.2s, v7.2s, v2.2s // 03 13 23 33 ++ trn1 v16.2s, v1.2s, v3.2s // 00 10 20 30 ++ trn1 v2.2s, v7.2s, v2.2s // 01 11 21 31 ++ trn2 v1.2s, v1.2s, v3.2s // 02 12 22 32 ++ mul v3.4h, v4.4h, v0.h[0] // 10/2 * src[3] ++ mul v4.4h, v4.4h, v0.h[1] // 22/2 * src[3] ++ mul v7.4h, v16.4h, v0.h[2] // 17 * src[0] ++ mul v1.4h, v1.4h, v0.h[2] // 17 * src[2] ++ mla v3.4h, v2.4h, v0.h[1] // t3/2 = 22/2 * src[1] + 10/2 * src[3] ++ mls v4.4h, v2.4h, v0.h[0] // t4/2 = - 10/2 * src[1] + 22/2 * src[3] ++ add v2.4h, v7.4h, v1.4h // t1 = 17 * src[0] + 17 * src[2] ++ sub v1.4h, v7.4h, v1.4h // t2 = 17 * src[0] - 17 * src[2] ++ neg v7.4h, v3.4h // -t3/2 ++ neg v16.4h, v4.4h // -t4/2 ++ ssra v3.4h, v2.4h, #1 // (t1 + t3) >> 1 ++ ssra v4.4h, v1.4h, #1 // (t2 + t4) >> 1 ++ ssra v16.4h, v1.4h, #1 // (t2 - t4) >> 1 ++ ssra v7.4h, v2.4h, #1 // (t1 - t3) >> 1 ++ srshr v1.4h, v3.4h, #2 // (t1 + t3 + 64) >> 3 ++ srshr v2.4h, v4.4h, #2 // (t2 + t4 + 64) >> 3 ++ srshr v3.4h, v16.4h, #2 // (t2 - t4 + 64) >> 3 ++ srshr v4.4h, v7.4h, #2 // (t1 - t3 + 64) >> 3 ++ trn2 v7.4h, v1.4h, v3.4h // 10 11 30 31 ++ trn1 v1.4h, v1.4h, v3.4h // 00 01 20 21 ++ trn2 v3.4h, v2.4h, v4.4h // 12 13 32 33 ++ trn1 v2.4h, v2.4h, v4.4h // 02 03 22 23 ++ trn2 v4.2s, v7.2s, v3.2s // 30 31 32 33 ++ trn1 v16.2s, v1.2s, v2.2s // 00 01 02 03 ++ trn1 v3.2s, v7.2s, v3.2s // 10 11 12 13 ++ trn2 v1.2s, v1.2s, v2.2s // 20 21 22 23 ++ mul v2.4h, v4.4h, v0.h[1] // 22/2 * src[24] ++ mul v4.4h, v4.4h, v0.h[0] // 10/2 * src[24] ++ mul v7.4h, v16.4h, v0.h[2] // 17 * src[0] ++ mul v1.4h, v1.4h, v0.h[2] // 17 * src[16] ++ mls v2.4h, v3.4h, v0.h[0] // t4/2 = - 10/2 * src[8] + 22/2 * src[24] ++ mla v4.4h, v3.4h, v0.h[1] // t3/2 = 22/2 * src[8] + 10/2 * src[24] ++ add v0.4h, v7.4h, v1.4h // t1 = 17 * src[0] + 17 * src[16] ++ sub v1.4h, v7.4h, v1.4h // t2 = 17 * src[0] - 17 * src[16] ++ neg v3.4h, v2.4h // -t4/2 ++ neg v7.4h, v4.4h // -t3/2 ++ ssra v4.4h, v0.4h, #1 // (t1 + t3) >> 1 ++ ssra v3.4h, v1.4h, #1 // (t2 - t4) >> 1 ++ ssra v2.4h, v1.4h, #1 // (t2 + t4) >> 1 ++ ssra v7.4h, v0.4h, #1 // (t1 - t3) >> 1 ++ trn1 v0.2d, v4.2d, v3.2d ++ trn1 v1.2d, v2.2d, v7.2d ++ srshr v0.8h, v0.8h, #6 // (t1 + t3 + 64) >> 7, (t2 - t4 + 64) >> 7 ++ srshr v1.8h, v1.8h, #6 // (t2 + t4 + 64) >> 7, (t1 - t3 + 64) >> 7 ++ uaddw v0.8h, v0.8h, v5.8b ++ uaddw v1.8h, v1.8h, v6.8b ++ sqxtun v0.8b, v0.8h ++ sqxtun v1.8b, v1.8h ++ st1 {v0.s}[0], [x4], x1 ++ st1 {v0.s}[1], [x4], x1 ++ st1 {v1.s}[0], [x4], x1 ++ st1 {v1.s}[1], [x4] ++ ret ++endfunc ++ ++// VC-1 8x8 inverse transform, DC case ++// On entry: ++// x0 -> array of 8-bit samples, in row-major order ++// x1 = row stride for 8-bit sample array ++// x2 -> 16-bit inverse transform DC coefficient ++// On exit: ++// array at x0 updated by saturated addition of (narrowed) transformed block ++function ff_vc1_inv_trans_8x8_dc_neon, export=1 ++ ldrsh w2, [x2] ++ mov x3, x0 ++ ld1 {v0.8b}, [x0], x1 ++ ld1 {v1.8b}, [x0], x1 ++ ld1 {v2.8b}, [x0], x1 ++ add w2, w2, w2, lsl #1 ++ ld1 {v3.8b}, [x0], x1 ++ ld1 {v4.8b}, [x0], x1 ++ add w2, w2, #1 ++ ld1 {v5.8b}, [x0], x1 ++ asr w2, w2, #1 ++ ld1 {v6.8b}, [x0], x1 ++ add w2, w2, w2, lsl #1 ++ ld1 {v7.8b}, [x0] ++ add w0, w2, #16 ++ asr w0, w0, #5 ++ dup v16.8h, w0 ++ uaddw v0.8h, v16.8h, v0.8b ++ uaddw v1.8h, v16.8h, v1.8b ++ uaddw v2.8h, v16.8h, v2.8b ++ uaddw v3.8h, v16.8h, v3.8b ++ uaddw v4.8h, v16.8h, v4.8b ++ uaddw v5.8h, v16.8h, v5.8b ++ sqxtun v0.8b, v0.8h ++ uaddw v6.8h, v16.8h, v6.8b ++ sqxtun v1.8b, v1.8h ++ uaddw v7.8h, v16.8h, v7.8b ++ sqxtun v2.8b, v2.8h ++ sqxtun v3.8b, v3.8h ++ sqxtun v4.8b, v4.8h ++ st1 {v0.8b}, [x3], x1 ++ sqxtun v0.8b, v5.8h ++ st1 {v1.8b}, [x3], x1 ++ sqxtun v1.8b, v6.8h ++ st1 {v2.8b}, [x3], x1 ++ sqxtun v2.8b, v7.8h ++ st1 {v3.8b}, [x3], x1 ++ st1 {v4.8b}, [x3], x1 ++ st1 {v0.8b}, [x3], x1 ++ st1 {v1.8b}, [x3], x1 ++ st1 {v2.8b}, [x3] ++ ret ++endfunc ++ ++// VC-1 8x4 inverse transform, DC case ++// On entry: ++// x0 -> array of 8-bit samples, in row-major order ++// x1 = row stride for 8-bit sample array ++// x2 -> 16-bit inverse transform DC coefficient ++// On exit: ++// array at x0 updated by saturated addition of (narrowed) transformed block ++function ff_vc1_inv_trans_8x4_dc_neon, export=1 ++ ldrsh w2, [x2] ++ mov x3, x0 ++ ld1 {v0.8b}, [x0], x1 ++ ld1 {v1.8b}, [x0], x1 ++ ld1 {v2.8b}, [x0], x1 ++ add w2, w2, w2, lsl #1 ++ ld1 {v3.8b}, [x0] ++ add w0, w2, #1 ++ asr w0, w0, #1 ++ add w0, w0, w0, lsl #4 ++ add w0, w0, #64 ++ asr w0, w0, #7 ++ dup v4.8h, w0 ++ uaddw v0.8h, v4.8h, v0.8b ++ uaddw v1.8h, v4.8h, v1.8b ++ uaddw v2.8h, v4.8h, v2.8b ++ uaddw v3.8h, v4.8h, v3.8b ++ sqxtun v0.8b, v0.8h ++ sqxtun v1.8b, v1.8h ++ sqxtun v2.8b, v2.8h ++ sqxtun v3.8b, v3.8h ++ st1 {v0.8b}, [x3], x1 ++ st1 {v1.8b}, [x3], x1 ++ st1 {v2.8b}, [x3], x1 ++ st1 {v3.8b}, [x3] ++ ret ++endfunc ++ ++// VC-1 4x8 inverse transform, DC case ++// On entry: ++// x0 -> array of 8-bit samples, in row-major order ++// x1 = row stride for 8-bit sample array ++// x2 -> 16-bit inverse transform DC coefficient ++// On exit: ++// array at x0 updated by saturated addition of (narrowed) transformed block ++function ff_vc1_inv_trans_4x8_dc_neon, export=1 ++ ldrsh w2, [x2] ++ mov x3, x0 ++ ld1 {v0.s}[0], [x0], x1 ++ ld1 {v1.s}[0], [x0], x1 ++ ld1 {v2.s}[0], [x0], x1 ++ add w2, w2, w2, lsl #4 ++ ld1 {v3.s}[0], [x0], x1 ++ add w2, w2, #4 ++ asr w2, w2, #3 ++ add w2, w2, w2, lsl #1 ++ ld1 {v0.s}[1], [x0], x1 ++ add w2, w2, #16 ++ asr w2, w2, #5 ++ dup v4.8h, w2 ++ ld1 {v1.s}[1], [x0], x1 ++ ld1 {v2.s}[1], [x0], x1 ++ ld1 {v3.s}[1], [x0] ++ uaddw v0.8h, v4.8h, v0.8b ++ uaddw v1.8h, v4.8h, v1.8b ++ uaddw v2.8h, v4.8h, v2.8b ++ uaddw v3.8h, v4.8h, v3.8b ++ sqxtun v0.8b, v0.8h ++ sqxtun v1.8b, v1.8h ++ sqxtun v2.8b, v2.8h ++ sqxtun v3.8b, v3.8h ++ st1 {v0.s}[0], [x3], x1 ++ st1 {v1.s}[0], [x3], x1 ++ st1 {v2.s}[0], [x3], x1 ++ st1 {v3.s}[0], [x3], x1 ++ st1 {v0.s}[1], [x3], x1 ++ st1 {v1.s}[1], [x3], x1 ++ st1 {v2.s}[1], [x3], x1 ++ st1 {v3.s}[1], [x3] ++ ret ++endfunc ++ ++// VC-1 4x4 inverse transform, DC case ++// On entry: ++// x0 -> array of 8-bit samples, in row-major order ++// x1 = row stride for 8-bit sample array ++// x2 -> 16-bit inverse transform DC coefficient ++// On exit: ++// array at x0 updated by saturated addition of (narrowed) transformed block ++function ff_vc1_inv_trans_4x4_dc_neon, export=1 ++ ldrsh w2, [x2] ++ mov x3, x0 ++ ld1 {v0.s}[0], [x0], x1 ++ ld1 {v1.s}[0], [x0], x1 ++ ld1 {v0.s}[1], [x0], x1 ++ add w2, w2, w2, lsl #4 ++ ld1 {v1.s}[1], [x0] ++ add w0, w2, #4 ++ asr w0, w0, #3 ++ add w0, w0, w0, lsl #4 ++ add w0, w0, #64 ++ asr w0, w0, #7 ++ dup v2.8h, w0 ++ uaddw v0.8h, v2.8h, v0.8b ++ uaddw v1.8h, v2.8h, v1.8b ++ sqxtun v0.8b, v0.8h ++ sqxtun v1.8b, v1.8h ++ st1 {v0.s}[0], [x3], x1 ++ st1 {v1.s}[0], [x3], x1 ++ st1 {v0.s}[1], [x3], x1 ++ st1 {v1.s}[1], [x3] ++ ret ++endfunc ++ ++.align 5 ++.Lcoeffs_it8: ++.quad 0x000F00090003 ++.Lcoeffs_it4: ++.quad 0x0011000B0005 ++.Lcoeffs: ++.quad 0x00050002 ++ ++// VC-1 in-loop deblocking filter for 4 pixel pairs at boundary of vertically-neighbouring blocks ++// On entry: ++// x0 -> top-left pel of lower block ++// x1 = row stride, bytes ++// w2 = PQUANT bitstream parameter ++function ff_vc1_v_loop_filter4_neon, export=1 ++ sub x3, x0, w1, sxtw #2 ++ ldr d0, .Lcoeffs ++ ld1 {v1.s}[0], [x0], x1 // P5 ++ ld1 {v2.s}[0], [x3], x1 // P1 ++ ld1 {v3.s}[0], [x3], x1 // P2 ++ ld1 {v4.s}[0], [x0], x1 // P6 ++ ld1 {v5.s}[0], [x3], x1 // P3 ++ ld1 {v6.s}[0], [x0], x1 // P7 ++ ld1 {v7.s}[0], [x3] // P4 ++ ld1 {v16.s}[0], [x0] // P8 ++ ushll v17.8h, v1.8b, #1 // 2*P5 ++ dup v18.8h, w2 // pq ++ ushll v2.8h, v2.8b, #1 // 2*P1 ++ uxtl v3.8h, v3.8b // P2 ++ uxtl v4.8h, v4.8b // P6 ++ uxtl v19.8h, v5.8b // P3 ++ mls v2.4h, v3.4h, v0.h[1] // 2*P1-5*P2 ++ uxtl v3.8h, v6.8b // P7 ++ mls v17.4h, v4.4h, v0.h[1] // 2*P5-5*P6 ++ ushll v5.8h, v5.8b, #1 // 2*P3 ++ uxtl v6.8h, v7.8b // P4 ++ mla v17.4h, v3.4h, v0.h[1] // 2*P5-5*P6+5*P7 ++ uxtl v3.8h, v16.8b // P8 ++ mla v2.4h, v19.4h, v0.h[1] // 2*P1-5*P2+5*P3 ++ uxtl v1.8h, v1.8b // P5 ++ mls v5.4h, v6.4h, v0.h[1] // 2*P3-5*P4 ++ mls v17.4h, v3.4h, v0.h[0] // 2*P5-5*P6+5*P7-2*P8 ++ sub v3.4h, v6.4h, v1.4h // P4-P5 ++ mls v2.4h, v6.4h, v0.h[0] // 2*P1-5*P2+5*P3-2*P4 ++ mla v5.4h, v1.4h, v0.h[1] // 2*P3-5*P4+5*P5 ++ mls v5.4h, v4.4h, v0.h[0] // 2*P3-5*P4+5*P5-2*P6 ++ abs v4.4h, v3.4h ++ srshr v7.4h, v17.4h, #3 ++ srshr v2.4h, v2.4h, #3 ++ sshr v4.4h, v4.4h, #1 // clip ++ srshr v5.4h, v5.4h, #3 ++ abs v7.4h, v7.4h // a2 ++ sshr v3.4h, v3.4h, #8 // clip_sign ++ abs v2.4h, v2.4h // a1 ++ cmeq v16.4h, v4.4h, #0 // test clip == 0 ++ abs v17.4h, v5.4h // a0 ++ sshr v5.4h, v5.4h, #8 // a0_sign ++ cmhs v19.4h, v2.4h, v7.4h // test a1 >= a2 ++ cmhs v18.4h, v17.4h, v18.4h // test a0 >= pq ++ sub v3.4h, v3.4h, v5.4h // clip_sign - a0_sign ++ bsl v19.8b, v7.8b, v2.8b // a3 ++ orr v2.8b, v16.8b, v18.8b // test clip == 0 || a0 >= pq ++ uqsub v5.4h, v17.4h, v19.4h // a0 >= a3 ? a0-a3 : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ cmhs v7.4h, v19.4h, v17.4h // test a3 >= a0 ++ mul v0.4h, v5.4h, v0.h[1] // a0 >= a3 ? 5*(a0-a3) : 0 ++ orr v5.8b, v2.8b, v7.8b // test clip == 0 || a0 >= pq || a3 >= a0 ++ mov w0, v5.s[1] // move to gp reg ++ ushr v0.4h, v0.4h, #3 // a0 >= a3 ? (5*(a0-a3))>>3 : 0 ++ cmhs v5.4h, v0.4h, v4.4h ++ tbnz w0, #0, 1f // none of the 4 pixel pairs should be updated if this one is not filtered ++ bsl v5.8b, v4.8b, v0.8b // FFMIN(d, clip) ++ bic v0.8b, v5.8b, v2.8b // set each d to zero if it should not be filtered because clip == 0 || a0 >= pq (a3 > a0 case already zeroed by saturating sub) ++ mls v6.4h, v0.4h, v3.4h // invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P4 ++ mla v1.4h, v0.4h, v3.4h // invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P5 ++ sqxtun v0.8b, v6.8h ++ sqxtun v1.8b, v1.8h ++ st1 {v0.s}[0], [x3], x1 ++ st1 {v1.s}[0], [x3] ++1: ret ++endfunc ++ ++// VC-1 in-loop deblocking filter for 4 pixel pairs at boundary of horizontally-neighbouring blocks ++// On entry: ++// x0 -> top-left pel of right block ++// x1 = row stride, bytes ++// w2 = PQUANT bitstream parameter ++function ff_vc1_h_loop_filter4_neon, export=1 ++ sub x3, x0, #4 // where to start reading ++ ldr d0, .Lcoeffs ++ ld1 {v1.8b}, [x3], x1 ++ sub x0, x0, #1 // where to start writing ++ ld1 {v2.8b}, [x3], x1 ++ ld1 {v3.8b}, [x3], x1 ++ ld1 {v4.8b}, [x3] ++ dup v5.8h, w2 // pq ++ trn1 v6.8b, v1.8b, v2.8b ++ trn2 v1.8b, v1.8b, v2.8b ++ trn1 v2.8b, v3.8b, v4.8b ++ trn2 v3.8b, v3.8b, v4.8b ++ trn1 v4.4h, v6.4h, v2.4h // P1, P5 ++ trn1 v7.4h, v1.4h, v3.4h // P2, P6 ++ trn2 v2.4h, v6.4h, v2.4h // P3, P7 ++ trn2 v1.4h, v1.4h, v3.4h // P4, P8 ++ ushll v3.8h, v4.8b, #1 // 2*P1, 2*P5 ++ uxtl v6.8h, v7.8b // P2, P6 ++ uxtl v7.8h, v2.8b // P3, P7 ++ uxtl v1.8h, v1.8b // P4, P8 ++ mls v3.8h, v6.8h, v0.h[1] // 2*P1-5*P2, 2*P5-5*P6 ++ ushll v2.8h, v2.8b, #1 // 2*P3, 2*P7 ++ uxtl v4.8h, v4.8b // P1, P5 ++ mla v3.8h, v7.8h, v0.h[1] // 2*P1-5*P2+5*P3, 2*P5-5*P6+5*P7 ++ mov d6, v6.d[1] // P6 ++ mls v3.8h, v1.8h, v0.h[0] // 2*P1-5*P2+5*P3-2*P4, 2*P5-5*P6+5*P7-2*P8 ++ mov d4, v4.d[1] // P5 ++ mls v2.4h, v1.4h, v0.h[1] // 2*P3-5*P4 ++ mla v2.4h, v4.4h, v0.h[1] // 2*P3-5*P4+5*P5 ++ sub v7.4h, v1.4h, v4.4h // P4-P5 ++ mls v2.4h, v6.4h, v0.h[0] // 2*P3-5*P4+5*P5-2*P6 ++ srshr v3.8h, v3.8h, #3 ++ abs v6.4h, v7.4h ++ sshr v7.4h, v7.4h, #8 // clip_sign ++ srshr v2.4h, v2.4h, #3 ++ abs v3.8h, v3.8h // a1, a2 ++ sshr v6.4h, v6.4h, #1 // clip ++ mov d16, v3.d[1] // a2 ++ abs v17.4h, v2.4h // a0 ++ cmeq v18.4h, v6.4h, #0 // test clip == 0 ++ sshr v2.4h, v2.4h, #8 // a0_sign ++ cmhs v19.4h, v3.4h, v16.4h // test a1 >= a2 ++ cmhs v5.4h, v17.4h, v5.4h // test a0 >= pq ++ sub v2.4h, v7.4h, v2.4h // clip_sign - a0_sign ++ bsl v19.8b, v16.8b, v3.8b // a3 ++ orr v3.8b, v18.8b, v5.8b // test clip == 0 || a0 >= pq ++ uqsub v5.4h, v17.4h, v19.4h // a0 >= a3 ? a0-a3 : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ cmhs v7.4h, v19.4h, v17.4h // test a3 >= a0 ++ mul v0.4h, v5.4h, v0.h[1] // a0 >= a3 ? 5*(a0-a3) : 0 ++ orr v5.8b, v3.8b, v7.8b // test clip == 0 || a0 >= pq || a3 >= a0 ++ mov w2, v5.s[1] // move to gp reg ++ ushr v0.4h, v0.4h, #3 // a0 >= a3 ? (5*(a0-a3))>>3 : 0 ++ cmhs v5.4h, v0.4h, v6.4h ++ tbnz w2, #0, 1f // none of the 4 pixel pairs should be updated if this one is not filtered ++ bsl v5.8b, v6.8b, v0.8b // FFMIN(d, clip) ++ bic v0.8b, v5.8b, v3.8b // set each d to zero if it should not be filtered because clip == 0 || a0 >= pq (a3 > a0 case already zeroed by saturating sub) ++ mla v4.4h, v0.4h, v2.4h // invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P5 ++ mls v1.4h, v0.4h, v2.4h // invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P4 ++ sqxtun v3.8b, v4.8h ++ sqxtun v2.8b, v1.8h ++ st2 {v2.b, v3.b}[0], [x0], x1 ++ st2 {v2.b, v3.b}[1], [x0], x1 ++ st2 {v2.b, v3.b}[2], [x0], x1 ++ st2 {v2.b, v3.b}[3], [x0] ++1: ret ++endfunc ++ ++// VC-1 in-loop deblocking filter for 8 pixel pairs at boundary of vertically-neighbouring blocks ++// On entry: ++// x0 -> top-left pel of lower block ++// x1 = row stride, bytes ++// w2 = PQUANT bitstream parameter ++function ff_vc1_v_loop_filter8_neon, export=1 ++ sub x3, x0, w1, sxtw #2 ++ ldr d0, .Lcoeffs ++ ld1 {v1.8b}, [x0], x1 // P5 ++ movi v2.2d, #0x0000ffff00000000 ++ ld1 {v3.8b}, [x3], x1 // P1 ++ ld1 {v4.8b}, [x3], x1 // P2 ++ ld1 {v5.8b}, [x0], x1 // P6 ++ ld1 {v6.8b}, [x3], x1 // P3 ++ ld1 {v7.8b}, [x0], x1 // P7 ++ ushll v16.8h, v1.8b, #1 // 2*P5 ++ ushll v3.8h, v3.8b, #1 // 2*P1 ++ ld1 {v17.8b}, [x3] // P4 ++ uxtl v4.8h, v4.8b // P2 ++ ld1 {v18.8b}, [x0] // P8 ++ uxtl v5.8h, v5.8b // P6 ++ dup v19.8h, w2 // pq ++ uxtl v20.8h, v6.8b // P3 ++ mls v3.8h, v4.8h, v0.h[1] // 2*P1-5*P2 ++ uxtl v4.8h, v7.8b // P7 ++ ushll v6.8h, v6.8b, #1 // 2*P3 ++ mls v16.8h, v5.8h, v0.h[1] // 2*P5-5*P6 ++ uxtl v7.8h, v17.8b // P4 ++ uxtl v17.8h, v18.8b // P8 ++ mla v16.8h, v4.8h, v0.h[1] // 2*P5-5*P6+5*P7 ++ uxtl v1.8h, v1.8b // P5 ++ mla v3.8h, v20.8h, v0.h[1] // 2*P1-5*P2+5*P3 ++ sub v4.8h, v7.8h, v1.8h // P4-P5 ++ mls v6.8h, v7.8h, v0.h[1] // 2*P3-5*P4 ++ mls v16.8h, v17.8h, v0.h[0] // 2*P5-5*P6+5*P7-2*P8 ++ abs v17.8h, v4.8h ++ sshr v4.8h, v4.8h, #8 // clip_sign ++ mls v3.8h, v7.8h, v0.h[0] // 2*P1-5*P2+5*P3-2*P4 ++ sshr v17.8h, v17.8h, #1 // clip ++ mla v6.8h, v1.8h, v0.h[1] // 2*P3-5*P4+5*P5 ++ srshr v16.8h, v16.8h, #3 ++ mls v6.8h, v5.8h, v0.h[0] // 2*P3-5*P4+5*P5-2*P6 ++ cmeq v5.8h, v17.8h, #0 // test clip == 0 ++ srshr v3.8h, v3.8h, #3 ++ abs v16.8h, v16.8h // a2 ++ abs v3.8h, v3.8h // a1 ++ srshr v6.8h, v6.8h, #3 ++ cmhs v18.8h, v3.8h, v16.8h // test a1 >= a2 ++ abs v20.8h, v6.8h // a0 ++ sshr v6.8h, v6.8h, #8 // a0_sign ++ bsl v18.16b, v16.16b, v3.16b // a3 ++ cmhs v3.8h, v20.8h, v19.8h // test a0 >= pq ++ sub v4.8h, v4.8h, v6.8h // clip_sign - a0_sign ++ uqsub v6.8h, v20.8h, v18.8h // a0 >= a3 ? a0-a3 : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ cmhs v16.8h, v18.8h, v20.8h // test a3 >= a0 ++ orr v3.16b, v5.16b, v3.16b // test clip == 0 || a0 >= pq ++ mul v0.8h, v6.8h, v0.h[1] // a0 >= a3 ? 5*(a0-a3) : 0 ++ orr v5.16b, v3.16b, v16.16b // test clip == 0 || a0 >= pq || a3 >= a0 ++ cmtst v2.2d, v5.2d, v2.2d // if 2nd of each group of is not filtered, then none of the others in the group should be either ++ mov w0, v5.s[1] // move to gp reg ++ ushr v0.8h, v0.8h, #3 // a0 >= a3 ? (5*(a0-a3))>>3 : 0 ++ mov w2, v5.s[3] ++ orr v2.16b, v3.16b, v2.16b ++ cmhs v3.8h, v0.8h, v17.8h ++ and w0, w0, w2 ++ bsl v3.16b, v17.16b, v0.16b // FFMIN(d, clip) ++ tbnz w0, #0, 1f // none of the 8 pixel pairs should be updated in this case ++ bic v0.16b, v3.16b, v2.16b // set each d to zero if it should not be filtered ++ mls v7.8h, v0.8h, v4.8h // invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P4 ++ mla v1.8h, v0.8h, v4.8h // invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P5 ++ sqxtun v0.8b, v7.8h ++ sqxtun v1.8b, v1.8h ++ st1 {v0.8b}, [x3], x1 ++ st1 {v1.8b}, [x3] ++1: ret ++endfunc ++ ++// VC-1 in-loop deblocking filter for 8 pixel pairs at boundary of horizontally-neighbouring blocks ++// On entry: ++// x0 -> top-left pel of right block ++// x1 = row stride, bytes ++// w2 = PQUANT bitstream parameter ++function ff_vc1_h_loop_filter8_neon, export=1 ++ sub x3, x0, #4 // where to start reading ++ ldr d0, .Lcoeffs ++ ld1 {v1.8b}, [x3], x1 // P1[0], P2[0]... ++ sub x0, x0, #1 // where to start writing ++ ld1 {v2.8b}, [x3], x1 ++ add x4, x0, x1, lsl #2 ++ ld1 {v3.8b}, [x3], x1 ++ ld1 {v4.8b}, [x3], x1 ++ ld1 {v5.8b}, [x3], x1 ++ ld1 {v6.8b}, [x3], x1 ++ ld1 {v7.8b}, [x3], x1 ++ trn1 v16.8b, v1.8b, v2.8b // P1[0], P1[1], P3[0]... ++ ld1 {v17.8b}, [x3] ++ trn2 v1.8b, v1.8b, v2.8b // P2[0], P2[1], P4[0]... ++ trn1 v2.8b, v3.8b, v4.8b // P1[2], P1[3], P3[2]... ++ trn2 v3.8b, v3.8b, v4.8b // P2[2], P2[3], P4[2]... ++ dup v4.8h, w2 // pq ++ trn1 v18.8b, v5.8b, v6.8b // P1[4], P1[5], P3[4]... ++ trn2 v5.8b, v5.8b, v6.8b // P2[4], P2[5], P4[4]... ++ trn1 v6.4h, v16.4h, v2.4h // P1[0], P1[1], P1[2], P1[3], P5[0]... ++ trn1 v19.4h, v1.4h, v3.4h // P2[0], P2[1], P2[2], P2[3], P6[0]... ++ trn1 v20.8b, v7.8b, v17.8b // P1[6], P1[7], P3[6]... ++ trn2 v7.8b, v7.8b, v17.8b // P2[6], P2[7], P4[6]... ++ trn2 v2.4h, v16.4h, v2.4h // P3[0], P3[1], P3[2], P3[3], P7[0]... ++ trn2 v1.4h, v1.4h, v3.4h // P4[0], P4[1], P4[2], P4[3], P8[0]... ++ trn1 v3.4h, v18.4h, v20.4h // P1[4], P1[5], P1[6], P1[7], P5[4]... ++ trn1 v16.4h, v5.4h, v7.4h // P2[4], P2[5], P2[6], P2[7], P6[4]... ++ trn2 v17.4h, v18.4h, v20.4h // P3[4], P3[5], P3[6], P3[7], P7[4]... ++ trn2 v5.4h, v5.4h, v7.4h // P4[4], P4[5], P4[6], P4[7], P8[4]... ++ trn1 v7.2s, v6.2s, v3.2s // P1 ++ trn1 v18.2s, v19.2s, v16.2s // P2 ++ trn2 v3.2s, v6.2s, v3.2s // P5 ++ trn2 v6.2s, v19.2s, v16.2s // P6 ++ trn1 v16.2s, v2.2s, v17.2s // P3 ++ trn2 v2.2s, v2.2s, v17.2s // P7 ++ ushll v7.8h, v7.8b, #1 // 2*P1 ++ trn1 v17.2s, v1.2s, v5.2s // P4 ++ ushll v19.8h, v3.8b, #1 // 2*P5 ++ trn2 v1.2s, v1.2s, v5.2s // P8 ++ uxtl v5.8h, v18.8b // P2 ++ uxtl v6.8h, v6.8b // P6 ++ uxtl v18.8h, v16.8b // P3 ++ mls v7.8h, v5.8h, v0.h[1] // 2*P1-5*P2 ++ uxtl v2.8h, v2.8b // P7 ++ ushll v5.8h, v16.8b, #1 // 2*P3 ++ mls v19.8h, v6.8h, v0.h[1] // 2*P5-5*P6 ++ uxtl v16.8h, v17.8b // P4 ++ uxtl v1.8h, v1.8b // P8 ++ mla v19.8h, v2.8h, v0.h[1] // 2*P5-5*P6+5*P7 ++ uxtl v2.8h, v3.8b // P5 ++ mla v7.8h, v18.8h, v0.h[1] // 2*P1-5*P2+5*P3 ++ sub v3.8h, v16.8h, v2.8h // P4-P5 ++ mls v5.8h, v16.8h, v0.h[1] // 2*P3-5*P4 ++ mls v19.8h, v1.8h, v0.h[0] // 2*P5-5*P6+5*P7-2*P8 ++ abs v1.8h, v3.8h ++ sshr v3.8h, v3.8h, #8 // clip_sign ++ mls v7.8h, v16.8h, v0.h[0] // 2*P1-5*P2+5*P3-2*P4 ++ sshr v1.8h, v1.8h, #1 // clip ++ mla v5.8h, v2.8h, v0.h[1] // 2*P3-5*P4+5*P5 ++ srshr v17.8h, v19.8h, #3 ++ mls v5.8h, v6.8h, v0.h[0] // 2*P3-5*P4+5*P5-2*P6 ++ cmeq v6.8h, v1.8h, #0 // test clip == 0 ++ srshr v7.8h, v7.8h, #3 ++ abs v17.8h, v17.8h // a2 ++ abs v7.8h, v7.8h // a1 ++ srshr v5.8h, v5.8h, #3 ++ cmhs v18.8h, v7.8h, v17.8h // test a1 >= a2 ++ abs v19.8h, v5.8h // a0 ++ sshr v5.8h, v5.8h, #8 // a0_sign ++ bsl v18.16b, v17.16b, v7.16b // a3 ++ cmhs v4.8h, v19.8h, v4.8h // test a0 >= pq ++ sub v3.8h, v3.8h, v5.8h // clip_sign - a0_sign ++ uqsub v5.8h, v19.8h, v18.8h // a0 >= a3 ? a0-a3 : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ cmhs v7.8h, v18.8h, v19.8h // test a3 >= a0 ++ orr v4.16b, v6.16b, v4.16b // test clip == 0 || a0 >= pq ++ mul v0.8h, v5.8h, v0.h[1] // a0 >= a3 ? 5*(a0-a3) : 0 ++ orr v5.16b, v4.16b, v7.16b // test clip == 0 || a0 >= pq || a3 >= a0 ++ mov w2, v5.s[1] // move to gp reg ++ ushr v0.8h, v0.8h, #3 // a0 >= a3 ? (5*(a0-a3))>>3 : 0 ++ mov w3, v5.s[3] ++ cmhs v5.8h, v0.8h, v1.8h ++ and w5, w2, w3 ++ bsl v5.16b, v1.16b, v0.16b // FFMIN(d, clip) ++ tbnz w5, #0, 2f // none of the 8 pixel pairs should be updated in this case ++ bic v0.16b, v5.16b, v4.16b // set each d to zero if it should not be filtered because clip == 0 || a0 >= pq (a3 > a0 case already zeroed by saturating sub) ++ mla v2.8h, v0.8h, v3.8h // invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P5 ++ mls v16.8h, v0.8h, v3.8h // invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P4 ++ sqxtun v1.8b, v2.8h ++ sqxtun v0.8b, v16.8h ++ tbnz w2, #0, 1f // none of the first 4 pixel pairs should be updated if so ++ st2 {v0.b, v1.b}[0], [x0], x1 ++ st2 {v0.b, v1.b}[1], [x0], x1 ++ st2 {v0.b, v1.b}[2], [x0], x1 ++ st2 {v0.b, v1.b}[3], [x0] ++1: tbnz w3, #0, 2f // none of the second 4 pixel pairs should be updated if so ++ st2 {v0.b, v1.b}[4], [x4], x1 ++ st2 {v0.b, v1.b}[5], [x4], x1 ++ st2 {v0.b, v1.b}[6], [x4], x1 ++ st2 {v0.b, v1.b}[7], [x4] ++2: ret ++endfunc ++ ++// VC-1 in-loop deblocking filter for 16 pixel pairs at boundary of vertically-neighbouring blocks ++// On entry: ++// x0 -> top-left pel of lower block ++// x1 = row stride, bytes ++// w2 = PQUANT bitstream parameter ++function ff_vc1_v_loop_filter16_neon, export=1 ++ sub x3, x0, w1, sxtw #2 ++ ldr d0, .Lcoeffs ++ ld1 {v1.16b}, [x0], x1 // P5 ++ movi v2.2d, #0x0000ffff00000000 ++ ld1 {v3.16b}, [x3], x1 // P1 ++ ld1 {v4.16b}, [x3], x1 // P2 ++ ld1 {v5.16b}, [x0], x1 // P6 ++ ld1 {v6.16b}, [x3], x1 // P3 ++ ld1 {v7.16b}, [x0], x1 // P7 ++ ushll v16.8h, v1.8b, #1 // 2*P5[0..7] ++ ushll v17.8h, v3.8b, #1 // 2*P1[0..7] ++ ld1 {v18.16b}, [x3] // P4 ++ uxtl v19.8h, v4.8b // P2[0..7] ++ ld1 {v20.16b}, [x0] // P8 ++ uxtl v21.8h, v5.8b // P6[0..7] ++ dup v22.8h, w2 // pq ++ ushll2 v3.8h, v3.16b, #1 // 2*P1[8..15] ++ mls v17.8h, v19.8h, v0.h[1] // 2*P1[0..7]-5*P2[0..7] ++ ushll2 v19.8h, v1.16b, #1 // 2*P5[8..15] ++ uxtl2 v4.8h, v4.16b // P2[8..15] ++ mls v16.8h, v21.8h, v0.h[1] // 2*P5[0..7]-5*P6[0..7] ++ uxtl2 v5.8h, v5.16b // P6[8..15] ++ uxtl v23.8h, v6.8b // P3[0..7] ++ uxtl v24.8h, v7.8b // P7[0..7] ++ mls v3.8h, v4.8h, v0.h[1] // 2*P1[8..15]-5*P2[8..15] ++ ushll v4.8h, v6.8b, #1 // 2*P3[0..7] ++ uxtl v25.8h, v18.8b // P4[0..7] ++ mls v19.8h, v5.8h, v0.h[1] // 2*P5[8..15]-5*P6[8..15] ++ uxtl2 v26.8h, v6.16b // P3[8..15] ++ mla v17.8h, v23.8h, v0.h[1] // 2*P1[0..7]-5*P2[0..7]+5*P3[0..7] ++ uxtl2 v7.8h, v7.16b // P7[8..15] ++ ushll2 v6.8h, v6.16b, #1 // 2*P3[8..15] ++ mla v16.8h, v24.8h, v0.h[1] // 2*P5[0..7]-5*P6[0..7]+5*P7[0..7] ++ uxtl2 v18.8h, v18.16b // P4[8..15] ++ uxtl v23.8h, v20.8b // P8[0..7] ++ mls v4.8h, v25.8h, v0.h[1] // 2*P3[0..7]-5*P4[0..7] ++ uxtl v24.8h, v1.8b // P5[0..7] ++ uxtl2 v20.8h, v20.16b // P8[8..15] ++ mla v3.8h, v26.8h, v0.h[1] // 2*P1[8..15]-5*P2[8..15]+5*P3[8..15] ++ uxtl2 v1.8h, v1.16b // P5[8..15] ++ sub v26.8h, v25.8h, v24.8h // P4[0..7]-P5[0..7] ++ mla v19.8h, v7.8h, v0.h[1] // 2*P5[8..15]-5*P6[8..15]+5*P7[8..15] ++ sub v7.8h, v18.8h, v1.8h // P4[8..15]-P5[8..15] ++ mls v6.8h, v18.8h, v0.h[1] // 2*P3[8..15]-5*P4[8..15] ++ abs v27.8h, v26.8h ++ sshr v26.8h, v26.8h, #8 // clip_sign[0..7] ++ mls v17.8h, v25.8h, v0.h[0] // 2*P1[0..7]-5*P2[0..7]+5*P3[0..7]-2*P4[0..7] ++ abs v28.8h, v7.8h ++ sshr v27.8h, v27.8h, #1 // clip[0..7] ++ mls v16.8h, v23.8h, v0.h[0] // 2*P5[0..7]-5*P6[0..7]+5*P7[0..7]-2*P8[0..7] ++ sshr v7.8h, v7.8h, #8 // clip_sign[8..15] ++ sshr v23.8h, v28.8h, #1 // clip[8..15] ++ mla v4.8h, v24.8h, v0.h[1] // 2*P3[0..7]-5*P4[0..7]+5*P5[0..7] ++ cmeq v28.8h, v27.8h, #0 // test clip[0..7] == 0 ++ srshr v17.8h, v17.8h, #3 ++ mls v3.8h, v18.8h, v0.h[0] // 2*P1[8..15]-5*P2[8..15]+5*P3[8..15]-2*P4[8..15] ++ cmeq v29.8h, v23.8h, #0 // test clip[8..15] == 0 ++ srshr v16.8h, v16.8h, #3 ++ mls v19.8h, v20.8h, v0.h[0] // 2*P5[8..15]-5*P6[8..15]+5*P7[8..15]-2*P8[8..15] ++ abs v17.8h, v17.8h // a1[0..7] ++ mla v6.8h, v1.8h, v0.h[1] // 2*P3[8..15]-5*P4[8..15]+5*P5[8..15] ++ srshr v3.8h, v3.8h, #3 ++ mls v4.8h, v21.8h, v0.h[0] // 2*P3[0..7]-5*P4[0..7]+5*P5[0..7]-2*P6[0..7] ++ abs v16.8h, v16.8h // a2[0..7] ++ srshr v19.8h, v19.8h, #3 ++ mls v6.8h, v5.8h, v0.h[0] // 2*P3[8..15]-5*P4[8..15]+5*P5[8..15]-2*P6[8..15] ++ cmhs v5.8h, v17.8h, v16.8h // test a1[0..7] >= a2[0..7] ++ abs v3.8h, v3.8h // a1[8..15] ++ srshr v4.8h, v4.8h, #3 ++ abs v19.8h, v19.8h // a2[8..15] ++ bsl v5.16b, v16.16b, v17.16b // a3[0..7] ++ srshr v6.8h, v6.8h, #3 ++ cmhs v16.8h, v3.8h, v19.8h // test a1[8..15] >= a2[8.15] ++ abs v17.8h, v4.8h // a0[0..7] ++ sshr v4.8h, v4.8h, #8 // a0_sign[0..7] ++ bsl v16.16b, v19.16b, v3.16b // a3[8..15] ++ uqsub v3.8h, v17.8h, v5.8h // a0[0..7] >= a3[0..7] ? a0[0..7]-a3[0..7] : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ abs v19.8h, v6.8h // a0[8..15] ++ cmhs v20.8h, v17.8h, v22.8h // test a0[0..7] >= pq ++ cmhs v5.8h, v5.8h, v17.8h // test a3[0..7] >= a0[0..7] ++ sub v4.8h, v26.8h, v4.8h // clip_sign[0..7] - a0_sign[0..7] ++ sshr v6.8h, v6.8h, #8 // a0_sign[8..15] ++ mul v3.8h, v3.8h, v0.h[1] // a0[0..7] >= a3[0..7] ? 5*(a0[0..7]-a3[0..7]) : 0 ++ uqsub v17.8h, v19.8h, v16.8h // a0[8..15] >= a3[8..15] ? a0[8..15]-a3[8..15] : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ orr v20.16b, v28.16b, v20.16b // test clip[0..7] == 0 || a0[0..7] >= pq ++ cmhs v21.8h, v19.8h, v22.8h // test a0[8..15] >= pq ++ cmhs v16.8h, v16.8h, v19.8h // test a3[8..15] >= a0[8..15] ++ mul v0.8h, v17.8h, v0.h[1] // a0[8..15] >= a3[8..15] ? 5*(a0[8..15]-a3[8..15]) : 0 ++ sub v6.8h, v7.8h, v6.8h // clip_sign[8..15] - a0_sign[8..15] ++ orr v5.16b, v20.16b, v5.16b // test clip[0..7] == 0 || a0[0..7] >= pq || a3[0..7] >= a0[0..7] ++ ushr v3.8h, v3.8h, #3 // a0[0..7] >= a3[0..7] ? (5*(a0[0..7]-a3[0..7]))>>3 : 0 ++ orr v7.16b, v29.16b, v21.16b // test clip[8..15] == 0 || a0[8..15] >= pq ++ cmtst v17.2d, v5.2d, v2.2d // if 2nd of each group of is not filtered, then none of the others in the group should be either ++ mov w0, v5.s[1] // move to gp reg ++ cmhs v19.8h, v3.8h, v27.8h ++ ushr v0.8h, v0.8h, #3 // a0[8..15] >= a3[8..15] ? (5*(a0[8..15]-a3[8..15]))>>3 : 0 ++ mov w2, v5.s[3] ++ orr v5.16b, v7.16b, v16.16b // test clip[8..15] == 0 || a0[8..15] >= pq || a3[8..15] >= a0[8..15] ++ orr v16.16b, v20.16b, v17.16b ++ bsl v19.16b, v27.16b, v3.16b // FFMIN(d[0..7], clip[0..7]) ++ cmtst v2.2d, v5.2d, v2.2d ++ cmhs v3.8h, v0.8h, v23.8h ++ mov w4, v5.s[1] ++ mov w5, v5.s[3] ++ and w0, w0, w2 ++ bic v5.16b, v19.16b, v16.16b // set each d[0..7] to zero if it should not be filtered because clip[0..7] == 0 || a0[0..7] >= pq (a3 > a0 case already zeroed by saturating sub) ++ orr v2.16b, v7.16b, v2.16b ++ bsl v3.16b, v23.16b, v0.16b // FFMIN(d[8..15], clip[8..15]) ++ mls v25.8h, v5.8h, v4.8h // invert d[0..7] depending on clip_sign[0..7] & a0_sign[0..7], or zero it if they match, and accumulate into P4[0..7] ++ and w2, w4, w5 ++ bic v0.16b, v3.16b, v2.16b // set each d[8..15] to zero if it should not be filtered because clip[8..15] == 0 || a0[8..15] >= pq (a3 > a0 case already zeroed by saturating sub) ++ mla v24.8h, v5.8h, v4.8h // invert d[0..7] depending on clip_sign[0..7] & a0_sign[0..7], or zero it if they match, and accumulate into P5[0..7] ++ and w0, w0, w2 ++ mls v18.8h, v0.8h, v6.8h // invert d[8..15] depending on clip_sign[8..15] & a0_sign[8..15], or zero it if they match, and accumulate into P4[8..15] ++ sqxtun v2.8b, v25.8h ++ tbnz w0, #0, 1f // none of the 16 pixel pairs should be updated in this case ++ mla v1.8h, v0.8h, v6.8h // invert d[8..15] depending on clip_sign[8..15] & a0_sign[8..15], or zero it if they match, and accumulate into P5[8..15] ++ sqxtun v0.8b, v24.8h ++ sqxtun2 v2.16b, v18.8h ++ sqxtun2 v0.16b, v1.8h ++ st1 {v2.16b}, [x3], x1 ++ st1 {v0.16b}, [x3] ++1: ret ++endfunc ++ ++// VC-1 in-loop deblocking filter for 16 pixel pairs at boundary of horizontally-neighbouring blocks ++// On entry: ++// x0 -> top-left pel of right block ++// x1 = row stride, bytes ++// w2 = PQUANT bitstream parameter ++function ff_vc1_h_loop_filter16_neon, export=1 ++ sub x3, x0, #4 // where to start reading ++ ldr d0, .Lcoeffs ++ ld1 {v1.8b}, [x3], x1 // P1[0], P2[0]... ++ sub x0, x0, #1 // where to start writing ++ ld1 {v2.8b}, [x3], x1 ++ add x4, x0, x1, lsl #3 ++ ld1 {v3.8b}, [x3], x1 ++ add x5, x0, x1, lsl #2 ++ ld1 {v4.8b}, [x3], x1 ++ add x6, x4, x1, lsl #2 ++ ld1 {v5.8b}, [x3], x1 ++ ld1 {v6.8b}, [x3], x1 ++ ld1 {v7.8b}, [x3], x1 ++ trn1 v16.8b, v1.8b, v2.8b // P1[0], P1[1], P3[0]... ++ ld1 {v17.8b}, [x3], x1 ++ trn2 v1.8b, v1.8b, v2.8b // P2[0], P2[1], P4[0]... ++ ld1 {v2.8b}, [x3], x1 ++ trn1 v18.8b, v3.8b, v4.8b // P1[2], P1[3], P3[2]... ++ ld1 {v19.8b}, [x3], x1 ++ trn2 v3.8b, v3.8b, v4.8b // P2[2], P2[3], P4[2]... ++ ld1 {v4.8b}, [x3], x1 ++ trn1 v20.8b, v5.8b, v6.8b // P1[4], P1[5], P3[4]... ++ ld1 {v21.8b}, [x3], x1 ++ trn2 v5.8b, v5.8b, v6.8b // P2[4], P2[5], P4[4]... ++ ld1 {v6.8b}, [x3], x1 ++ trn1 v22.8b, v7.8b, v17.8b // P1[6], P1[7], P3[6]... ++ ld1 {v23.8b}, [x3], x1 ++ trn2 v7.8b, v7.8b, v17.8b // P2[6], P2[7], P4[6]... ++ ld1 {v17.8b}, [x3], x1 ++ trn1 v24.8b, v2.8b, v19.8b // P1[8], P1[9], P3[8]... ++ ld1 {v25.8b}, [x3] ++ trn2 v2.8b, v2.8b, v19.8b // P2[8], P2[9], P4[8]... ++ trn1 v19.4h, v16.4h, v18.4h // P1[0], P1[1], P1[2], P1[3], P5[0]... ++ trn1 v26.8b, v4.8b, v21.8b // P1[10], P1[11], P3[10]... ++ trn2 v4.8b, v4.8b, v21.8b // P2[10], P2[11], P4[10]... ++ trn1 v21.4h, v1.4h, v3.4h // P2[0], P2[1], P2[2], P2[3], P6[0]... ++ trn1 v27.4h, v20.4h, v22.4h // P1[4], P1[5], P1[6], P1[7], P5[4]... ++ trn1 v28.8b, v6.8b, v23.8b // P1[12], P1[13], P3[12]... ++ trn2 v6.8b, v6.8b, v23.8b // P2[12], P2[13], P4[12]... ++ trn1 v23.4h, v5.4h, v7.4h // P2[4], P2[5], P2[6], P2[7], P6[4]... ++ trn1 v29.4h, v24.4h, v26.4h // P1[8], P1[9], P1[10], P1[11], P5[8]... ++ trn1 v30.8b, v17.8b, v25.8b // P1[14], P1[15], P3[14]... ++ trn2 v17.8b, v17.8b, v25.8b // P2[14], P2[15], P4[14]... ++ trn1 v25.4h, v2.4h, v4.4h // P2[8], P2[9], P2[10], P2[11], P6[8]... ++ trn1 v31.2s, v19.2s, v27.2s // P1[0..7] ++ trn2 v19.2s, v19.2s, v27.2s // P5[0..7] ++ trn1 v27.2s, v21.2s, v23.2s // P2[0..7] ++ trn2 v21.2s, v21.2s, v23.2s // P6[0..7] ++ trn1 v23.4h, v28.4h, v30.4h // P1[12], P1[13], P1[14], P1[15], P5[12]... ++ trn2 v16.4h, v16.4h, v18.4h // P3[0], P3[1], P3[2], P3[3], P7[0]... ++ trn1 v18.4h, v6.4h, v17.4h // P2[12], P2[13], P2[14], P2[15], P6[12]... ++ trn2 v20.4h, v20.4h, v22.4h // P3[4], P3[5], P3[6], P3[7], P7[4]... ++ trn2 v22.4h, v24.4h, v26.4h // P3[8], P3[9], P3[10], P3[11], P7[8]... ++ trn1 v24.2s, v29.2s, v23.2s // P1[8..15] ++ trn2 v23.2s, v29.2s, v23.2s // P5[8..15] ++ trn1 v26.2s, v25.2s, v18.2s // P2[8..15] ++ trn2 v18.2s, v25.2s, v18.2s // P6[8..15] ++ trn2 v25.4h, v28.4h, v30.4h // P3[12], P3[13], P3[14], P3[15], P7[12]... ++ trn2 v1.4h, v1.4h, v3.4h // P4[0], P4[1], P4[2], P4[3], P8[0]... ++ trn2 v3.4h, v5.4h, v7.4h // P4[4], P4[5], P4[6], P4[7], P8[4]... ++ trn2 v2.4h, v2.4h, v4.4h // P4[8], P4[9], P4[10], P4[11], P8[8]... ++ trn2 v4.4h, v6.4h, v17.4h // P4[12], P4[13], P4[14], P4[15], P8[12]... ++ ushll v5.8h, v31.8b, #1 // 2*P1[0..7] ++ ushll v6.8h, v19.8b, #1 // 2*P5[0..7] ++ trn1 v7.2s, v16.2s, v20.2s // P3[0..7] ++ uxtl v17.8h, v27.8b // P2[0..7] ++ trn2 v16.2s, v16.2s, v20.2s // P7[0..7] ++ uxtl v20.8h, v21.8b // P6[0..7] ++ trn1 v21.2s, v22.2s, v25.2s // P3[8..15] ++ ushll v24.8h, v24.8b, #1 // 2*P1[8..15] ++ trn2 v22.2s, v22.2s, v25.2s // P7[8..15] ++ ushll v25.8h, v23.8b, #1 // 2*P5[8..15] ++ trn1 v27.2s, v1.2s, v3.2s // P4[0..7] ++ uxtl v26.8h, v26.8b // P2[8..15] ++ mls v5.8h, v17.8h, v0.h[1] // 2*P1[0..7]-5*P2[0..7] ++ uxtl v17.8h, v18.8b // P6[8..15] ++ mls v6.8h, v20.8h, v0.h[1] // 2*P5[0..7]-5*P6[0..7] ++ trn1 v18.2s, v2.2s, v4.2s // P4[8..15] ++ uxtl v28.8h, v7.8b // P3[0..7] ++ mls v24.8h, v26.8h, v0.h[1] // 2*P1[8..15]-5*P2[8..15] ++ uxtl v16.8h, v16.8b // P7[0..7] ++ uxtl v26.8h, v21.8b // P3[8..15] ++ mls v25.8h, v17.8h, v0.h[1] // 2*P5[8..15]-5*P6[8..15] ++ uxtl v22.8h, v22.8b // P7[8..15] ++ ushll v7.8h, v7.8b, #1 // 2*P3[0..7] ++ uxtl v27.8h, v27.8b // P4[0..7] ++ trn2 v1.2s, v1.2s, v3.2s // P8[0..7] ++ ushll v3.8h, v21.8b, #1 // 2*P3[8..15] ++ trn2 v2.2s, v2.2s, v4.2s // P8[8..15] ++ uxtl v4.8h, v18.8b // P4[8..15] ++ mla v5.8h, v28.8h, v0.h[1] // 2*P1[0..7]-5*P2[0..7]+5*P3[0..7] ++ uxtl v1.8h, v1.8b // P8[0..7] ++ mla v6.8h, v16.8h, v0.h[1] // 2*P5[0..7]-5*P6[0..7]+5*P7[0..7] ++ uxtl v2.8h, v2.8b // P8[8..15] ++ uxtl v16.8h, v19.8b // P5[0..7] ++ mla v24.8h, v26.8h, v0.h[1] // 2*P1[8..15]-5*P2[8..15]+5*P3[8..15] ++ uxtl v18.8h, v23.8b // P5[8..15] ++ dup v19.8h, w2 // pq ++ mla v25.8h, v22.8h, v0.h[1] // 2*P5[8..15]-5*P6[8..15]+5*P7[8..15] ++ sub v21.8h, v27.8h, v16.8h // P4[0..7]-P5[0..7] ++ sub v22.8h, v4.8h, v18.8h // P4[8..15]-P5[8..15] ++ mls v7.8h, v27.8h, v0.h[1] // 2*P3[0..7]-5*P4[0..7] ++ abs v23.8h, v21.8h ++ mls v3.8h, v4.8h, v0.h[1] // 2*P3[8..15]-5*P4[8..15] ++ abs v26.8h, v22.8h ++ sshr v21.8h, v21.8h, #8 // clip_sign[0..7] ++ mls v5.8h, v27.8h, v0.h[0] // 2*P1[0..7]-5*P2[0..7]+5*P3[0..7]-2*P4[0..7] ++ sshr v23.8h, v23.8h, #1 // clip[0..7] ++ sshr v26.8h, v26.8h, #1 // clip[8..15] ++ mls v6.8h, v1.8h, v0.h[0] // 2*P5[0..7]-5*P6[0..7]+5*P7[0..7]-2*P8[0..7] ++ sshr v1.8h, v22.8h, #8 // clip_sign[8..15] ++ cmeq v22.8h, v23.8h, #0 // test clip[0..7] == 0 ++ mls v24.8h, v4.8h, v0.h[0] // 2*P1[8..15]-5*P2[8..15]+5*P3[8..15]-2*P4[8..15] ++ cmeq v28.8h, v26.8h, #0 // test clip[8..15] == 0 ++ srshr v5.8h, v5.8h, #3 ++ mls v25.8h, v2.8h, v0.h[0] // 2*P5[8..15]-5*P6[8..15]+5*P7[8..15]-2*P8[8..15] ++ srshr v2.8h, v6.8h, #3 ++ mla v7.8h, v16.8h, v0.h[1] // 2*P3[0..7]-5*P4[0..7]+5*P5[0..7] ++ srshr v6.8h, v24.8h, #3 ++ mla v3.8h, v18.8h, v0.h[1] // 2*P3[8..15]-5*P4[8..15]+5*P5[8..15] ++ abs v5.8h, v5.8h // a1[0..7] ++ srshr v24.8h, v25.8h, #3 ++ mls v3.8h, v17.8h, v0.h[0] // 2*P3[8..15]-5*P4[8..15]+5*P5[8..15]-2*P6[8..15] ++ abs v2.8h, v2.8h // a2[0..7] ++ abs v6.8h, v6.8h // a1[8..15] ++ mls v7.8h, v20.8h, v0.h[0] // 2*P3[0..7]-5*P4[0..7]+5*P5[0..7]-2*P6[0..7] ++ abs v17.8h, v24.8h // a2[8..15] ++ cmhs v20.8h, v5.8h, v2.8h // test a1[0..7] >= a2[0..7] ++ srshr v3.8h, v3.8h, #3 ++ cmhs v24.8h, v6.8h, v17.8h // test a1[8..15] >= a2[8.15] ++ srshr v7.8h, v7.8h, #3 ++ bsl v20.16b, v2.16b, v5.16b // a3[0..7] ++ abs v2.8h, v3.8h // a0[8..15] ++ sshr v3.8h, v3.8h, #8 // a0_sign[8..15] ++ bsl v24.16b, v17.16b, v6.16b // a3[8..15] ++ abs v5.8h, v7.8h // a0[0..7] ++ sshr v6.8h, v7.8h, #8 // a0_sign[0..7] ++ cmhs v7.8h, v2.8h, v19.8h // test a0[8..15] >= pq ++ sub v1.8h, v1.8h, v3.8h // clip_sign[8..15] - a0_sign[8..15] ++ uqsub v3.8h, v2.8h, v24.8h // a0[8..15] >= a3[8..15] ? a0[8..15]-a3[8..15] : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ cmhs v2.8h, v24.8h, v2.8h // test a3[8..15] >= a0[8..15] ++ uqsub v17.8h, v5.8h, v20.8h // a0[0..7] >= a3[0..7] ? a0[0..7]-a3[0..7] : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ cmhs v19.8h, v5.8h, v19.8h // test a0[0..7] >= pq ++ orr v7.16b, v28.16b, v7.16b // test clip[8..15] == 0 || a0[8..15] >= pq ++ sub v6.8h, v21.8h, v6.8h // clip_sign[0..7] - a0_sign[0..7] ++ mul v3.8h, v3.8h, v0.h[1] // a0[8..15] >= a3[8..15] ? 5*(a0[8..15]-a3[8..15]) : 0 ++ cmhs v5.8h, v20.8h, v5.8h // test a3[0..7] >= a0[0..7] ++ orr v19.16b, v22.16b, v19.16b // test clip[0..7] == 0 || a0[0..7] >= pq ++ mul v0.8h, v17.8h, v0.h[1] // a0[0..7] >= a3[0..7] ? 5*(a0[0..7]-a3[0..7]) : 0 ++ orr v2.16b, v7.16b, v2.16b // test clip[8..15] == 0 || a0[8..15] >= pq || a3[8..15] >= a0[8..15] ++ orr v5.16b, v19.16b, v5.16b // test clip[0..7] == 0 || a0[0..7] >= pq || a3[0..7] >= a0[0..7] ++ ushr v3.8h, v3.8h, #3 // a0[8..15] >= a3[8..15] ? (5*(a0[8..15]-a3[8..15]))>>3 : 0 ++ mov w7, v2.s[1] ++ mov w8, v2.s[3] ++ ushr v0.8h, v0.8h, #3 // a0[0..7] >= a3[0..7] ? (5*(a0[0..7]-a3[0..7]))>>3 : 0 ++ mov w2, v5.s[1] // move to gp reg ++ cmhs v2.8h, v3.8h, v26.8h ++ mov w3, v5.s[3] ++ cmhs v5.8h, v0.8h, v23.8h ++ bsl v2.16b, v26.16b, v3.16b // FFMIN(d[8..15], clip[8..15]) ++ and w9, w7, w8 ++ bsl v5.16b, v23.16b, v0.16b // FFMIN(d[0..7], clip[0..7]) ++ and w10, w2, w3 ++ bic v0.16b, v2.16b, v7.16b // set each d[8..15] to zero if it should not be filtered because clip[8..15] == 0 || a0[8..15] >= pq (a3 > a0 case already zeroed by saturating sub) ++ and w9, w10, w9 ++ bic v2.16b, v5.16b, v19.16b // set each d[0..7] to zero if it should not be filtered because clip[0..7] == 0 || a0[0..7] >= pq (a3 > a0 case already zeroed by saturating sub) ++ mls v4.8h, v0.8h, v1.8h // invert d[8..15] depending on clip_sign[8..15] & a0_sign[8..15], or zero it if they match, and accumulate into P4 ++ tbnz w9, #0, 4f // none of the 16 pixel pairs should be updated in this case ++ mls v27.8h, v2.8h, v6.8h // invert d[0..7] depending on clip_sign[0..7] & a0_sign[0..7], or zero it if they match, and accumulate into P4 ++ mla v16.8h, v2.8h, v6.8h // invert d[0..7] depending on clip_sign[0..7] & a0_sign[0..7], or zero it if they match, and accumulate into P5 ++ sqxtun v2.8b, v4.8h ++ mla v18.8h, v0.8h, v1.8h // invert d[8..15] depending on clip_sign[8..15] & a0_sign[8..15], or zero it if they match, and accumulate into P5 ++ sqxtun v0.8b, v27.8h ++ sqxtun v1.8b, v16.8h ++ sqxtun v3.8b, v18.8h ++ tbnz w2, #0, 1f ++ st2 {v0.b, v1.b}[0], [x0], x1 ++ st2 {v0.b, v1.b}[1], [x0], x1 ++ st2 {v0.b, v1.b}[2], [x0], x1 ++ st2 {v0.b, v1.b}[3], [x0] ++1: tbnz w3, #0, 2f ++ st2 {v0.b, v1.b}[4], [x5], x1 ++ st2 {v0.b, v1.b}[5], [x5], x1 ++ st2 {v0.b, v1.b}[6], [x5], x1 ++ st2 {v0.b, v1.b}[7], [x5] ++2: tbnz w7, #0, 3f ++ st2 {v2.b, v3.b}[0], [x4], x1 ++ st2 {v2.b, v3.b}[1], [x4], x1 ++ st2 {v2.b, v3.b}[2], [x4], x1 ++ st2 {v2.b, v3.b}[3], [x4] ++3: tbnz w8, #0, 4f ++ st2 {v2.b, v3.b}[4], [x6], x1 ++ st2 {v2.b, v3.b}[5], [x6], x1 ++ st2 {v2.b, v3.b}[6], [x6], x1 ++ st2 {v2.b, v3.b}[7], [x6] ++4: ret ++endfunc ++ ++// Copy at most the specified number of bytes from source to destination buffer, ++// stopping at a multiple of 32 bytes, none of which are the start of an escape sequence ++// On entry: ++// x0 -> source buffer ++// w1 = max number of bytes to copy ++// x2 -> destination buffer, optimally 8-byte aligned ++// On exit: ++// w0 = number of bytes not copied ++function ff_vc1_unescape_buffer_helper_neon, export=1 ++ // Offset by 80 to screen out cases that are too short for us to handle, ++ // and also make it easy to test for loop termination, or to determine ++ // whether we need an odd number of half-iterations of the loop. ++ subs w1, w1, #80 ++ b.mi 90f ++ ++ // Set up useful constants ++ movi v20.4s, #3, lsl #24 ++ movi v21.4s, #3, lsl #16 ++ ++ tst w1, #32 ++ b.ne 1f ++ ++ ld1 {v0.16b, v1.16b, v2.16b}, [x0], #48 ++ ext v25.16b, v0.16b, v1.16b, #1 ++ ext v26.16b, v0.16b, v1.16b, #2 ++ ext v27.16b, v0.16b, v1.16b, #3 ++ ext v29.16b, v1.16b, v2.16b, #1 ++ ext v30.16b, v1.16b, v2.16b, #2 ++ ext v31.16b, v1.16b, v2.16b, #3 ++ bic v24.16b, v0.16b, v20.16b ++ bic v25.16b, v25.16b, v20.16b ++ bic v26.16b, v26.16b, v20.16b ++ bic v27.16b, v27.16b, v20.16b ++ bic v28.16b, v1.16b, v20.16b ++ bic v29.16b, v29.16b, v20.16b ++ bic v30.16b, v30.16b, v20.16b ++ bic v31.16b, v31.16b, v20.16b ++ eor v24.16b, v24.16b, v21.16b ++ eor v25.16b, v25.16b, v21.16b ++ eor v26.16b, v26.16b, v21.16b ++ eor v27.16b, v27.16b, v21.16b ++ eor v28.16b, v28.16b, v21.16b ++ eor v29.16b, v29.16b, v21.16b ++ eor v30.16b, v30.16b, v21.16b ++ eor v31.16b, v31.16b, v21.16b ++ cmeq v24.4s, v24.4s, #0 ++ cmeq v25.4s, v25.4s, #0 ++ cmeq v26.4s, v26.4s, #0 ++ cmeq v27.4s, v27.4s, #0 ++ add w1, w1, #32 ++ b 3f ++ ++1: ld1 {v3.16b, v4.16b, v5.16b}, [x0], #48 ++ ext v25.16b, v3.16b, v4.16b, #1 ++ ext v26.16b, v3.16b, v4.16b, #2 ++ ext v27.16b, v3.16b, v4.16b, #3 ++ ext v29.16b, v4.16b, v5.16b, #1 ++ ext v30.16b, v4.16b, v5.16b, #2 ++ ext v31.16b, v4.16b, v5.16b, #3 ++ bic v24.16b, v3.16b, v20.16b ++ bic v25.16b, v25.16b, v20.16b ++ bic v26.16b, v26.16b, v20.16b ++ bic v27.16b, v27.16b, v20.16b ++ bic v28.16b, v4.16b, v20.16b ++ bic v29.16b, v29.16b, v20.16b ++ bic v30.16b, v30.16b, v20.16b ++ bic v31.16b, v31.16b, v20.16b ++ eor v24.16b, v24.16b, v21.16b ++ eor v25.16b, v25.16b, v21.16b ++ eor v26.16b, v26.16b, v21.16b ++ eor v27.16b, v27.16b, v21.16b ++ eor v28.16b, v28.16b, v21.16b ++ eor v29.16b, v29.16b, v21.16b ++ eor v30.16b, v30.16b, v21.16b ++ eor v31.16b, v31.16b, v21.16b ++ cmeq v24.4s, v24.4s, #0 ++ cmeq v25.4s, v25.4s, #0 ++ cmeq v26.4s, v26.4s, #0 ++ cmeq v27.4s, v27.4s, #0 ++ // Drop through... ++2: mov v0.16b, v5.16b ++ ld1 {v1.16b, v2.16b}, [x0], #32 ++ cmeq v28.4s, v28.4s, #0 ++ cmeq v29.4s, v29.4s, #0 ++ cmeq v30.4s, v30.4s, #0 ++ cmeq v31.4s, v31.4s, #0 ++ orr v24.16b, v24.16b, v25.16b ++ orr v26.16b, v26.16b, v27.16b ++ orr v28.16b, v28.16b, v29.16b ++ orr v30.16b, v30.16b, v31.16b ++ ext v25.16b, v0.16b, v1.16b, #1 ++ orr v22.16b, v24.16b, v26.16b ++ ext v26.16b, v0.16b, v1.16b, #2 ++ ext v27.16b, v0.16b, v1.16b, #3 ++ ext v29.16b, v1.16b, v2.16b, #1 ++ orr v23.16b, v28.16b, v30.16b ++ ext v30.16b, v1.16b, v2.16b, #2 ++ ext v31.16b, v1.16b, v2.16b, #3 ++ bic v24.16b, v0.16b, v20.16b ++ bic v25.16b, v25.16b, v20.16b ++ bic v26.16b, v26.16b, v20.16b ++ orr v22.16b, v22.16b, v23.16b ++ bic v27.16b, v27.16b, v20.16b ++ bic v28.16b, v1.16b, v20.16b ++ bic v29.16b, v29.16b, v20.16b ++ bic v30.16b, v30.16b, v20.16b ++ bic v31.16b, v31.16b, v20.16b ++ addv s22, v22.4s ++ eor v24.16b, v24.16b, v21.16b ++ eor v25.16b, v25.16b, v21.16b ++ eor v26.16b, v26.16b, v21.16b ++ eor v27.16b, v27.16b, v21.16b ++ eor v28.16b, v28.16b, v21.16b ++ mov w3, v22.s[0] ++ eor v29.16b, v29.16b, v21.16b ++ eor v30.16b, v30.16b, v21.16b ++ eor v31.16b, v31.16b, v21.16b ++ cmeq v24.4s, v24.4s, #0 ++ cmeq v25.4s, v25.4s, #0 ++ cmeq v26.4s, v26.4s, #0 ++ cmeq v27.4s, v27.4s, #0 ++ cbnz w3, 90f ++ st1 {v3.16b, v4.16b}, [x2], #32 ++3: mov v3.16b, v2.16b ++ ld1 {v4.16b, v5.16b}, [x0], #32 ++ cmeq v28.4s, v28.4s, #0 ++ cmeq v29.4s, v29.4s, #0 ++ cmeq v30.4s, v30.4s, #0 ++ cmeq v31.4s, v31.4s, #0 ++ orr v24.16b, v24.16b, v25.16b ++ orr v26.16b, v26.16b, v27.16b ++ orr v28.16b, v28.16b, v29.16b ++ orr v30.16b, v30.16b, v31.16b ++ ext v25.16b, v3.16b, v4.16b, #1 ++ orr v22.16b, v24.16b, v26.16b ++ ext v26.16b, v3.16b, v4.16b, #2 ++ ext v27.16b, v3.16b, v4.16b, #3 ++ ext v29.16b, v4.16b, v5.16b, #1 ++ orr v23.16b, v28.16b, v30.16b ++ ext v30.16b, v4.16b, v5.16b, #2 ++ ext v31.16b, v4.16b, v5.16b, #3 ++ bic v24.16b, v3.16b, v20.16b ++ bic v25.16b, v25.16b, v20.16b ++ bic v26.16b, v26.16b, v20.16b ++ orr v22.16b, v22.16b, v23.16b ++ bic v27.16b, v27.16b, v20.16b ++ bic v28.16b, v4.16b, v20.16b ++ bic v29.16b, v29.16b, v20.16b ++ bic v30.16b, v30.16b, v20.16b ++ bic v31.16b, v31.16b, v20.16b ++ addv s22, v22.4s ++ eor v24.16b, v24.16b, v21.16b ++ eor v25.16b, v25.16b, v21.16b ++ eor v26.16b, v26.16b, v21.16b ++ eor v27.16b, v27.16b, v21.16b ++ eor v28.16b, v28.16b, v21.16b ++ mov w3, v22.s[0] ++ eor v29.16b, v29.16b, v21.16b ++ eor v30.16b, v30.16b, v21.16b ++ eor v31.16b, v31.16b, v21.16b ++ cmeq v24.4s, v24.4s, #0 ++ cmeq v25.4s, v25.4s, #0 ++ cmeq v26.4s, v26.4s, #0 ++ cmeq v27.4s, v27.4s, #0 ++ cbnz w3, 91f ++ st1 {v0.16b, v1.16b}, [x2], #32 ++ subs w1, w1, #64 ++ b.pl 2b ++ ++90: add w0, w1, #80 ++ ret ++ ++91: sub w1, w1, #32 ++ b 90b ++endfunc +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -149,6 +149,7 @@ extern AVCodec ff_hap_decoder; + extern AVCodec ff_hevc_decoder; + extern AVCodec ff_hevc_qsv_decoder; + extern AVCodec ff_hevc_rkmpp_decoder; ++extern AVCodec ff_hevc_rpi_decoder; + extern AVCodec ff_hevc_v4l2m2m_decoder; + extern AVCodec ff_hnm4_video_decoder; + extern AVCodec ff_hq_hqa_decoder; +@@ -890,6 +891,41 @@ static enum AVCodecID remap_deprecated_c + } + } + ++static int codec_supports_format(const AVCodec * const p, const enum AVPixelFormat fmt) ++{ ++ const enum AVPixelFormat *pf = p->pix_fmts; ++ ++ // Assume good if we lack info ++ if (pf == NULL) ++ return 1; ++ if (fmt == AV_PIX_FMT_NONE) ++ return 0; ++ ++ for (; *pf != AV_PIX_FMT_NONE; ++pf) { ++ if (*pf == fmt) ++ return 1; ++ } ++ return 0; ++} ++ ++AVCodec *avcodec_find_decoder_by_id_and_fmt(enum AVCodecID id, enum AVPixelFormat fmt) ++{ ++ const AVCodec *p, *experimental = NULL; ++ void *i = 0; ++ ++ id= remap_deprecated_codec_id(id); ++ while ((p = av_codec_iterate(&i))) { ++ if (av_codec_is_decoder(p) && p->id == id && codec_supports_format(p, fmt)) { ++ if (p->capabilities & AV_CODEC_CAP_EXPERIMENTAL && !experimental) { ++ experimental = p; ++ } else ++ return (AVCodec *)p; ++ } ++ p = p->next; ++ } ++ return (AVCodec *)experimental; ++} ++ + static AVCodec *find_codec(enum AVCodecID id, int (*x)(const AVCodec *)) + { + const AVCodec *p, *experimental = NULL; +--- a/libavcodec/arm/Makefile ++++ b/libavcodec/arm/Makefile +@@ -40,6 +40,8 @@ OBJS-$(CONFIG_AAC_DECODER) + + arm/sbrdsp_init_arm.o + OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_init_arm.o + OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_arm.o ++OBJS-$(CONFIG_HEVC_RPI_DECODER) += arm/rpi_hevcdsp_init_arm.o \ ++ arm/rpi_hevcpred_init_arm.o + OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o + OBJS-$(CONFIG_RV40_DECODER) += arm/rv40dsp_init_arm.o + OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_init_arm.o +@@ -140,10 +142,24 @@ NEON-OBJS-$(CONFIG_AAC_DECODER) + + NEON-OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_neon.o + NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_neon.o + NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \ ++ arm/hevcdsp_idct_neon.o \ + arm/hevcdsp_deblock_neon.o \ + arm/hevcdsp_idct_neon.o \ + arm/hevcdsp_qpel_neon.o \ + arm/hevcdsp_sao_neon.o ++NEON-OBJS-$(CONFIG_HEVC_RPI_DECODER) += arm/rpi_hevcdsp_init_neon.o \ ++ arm/rpi_hevc_misc_neon.o \ ++ arm/rpi_hevcdsp_deblock_neon.o \ ++ arm/rpi_hevcdsp_idct_neon.o \ ++ arm/rpi_hevcdsp_res8_neon.o \ ++ arm/rpi_hevcdsp_res16_neon.o \ ++ arm/rpi_hevcdsp_sao_neon.o \ ++ arm/rpi_hevcpred_init_neon.o \ ++ arm/rpi_hevcpred_intra_angular_neon.o \ ++ arm/rpi_hevcpred_intra_dc_neon.o \ ++ arm/rpi_hevcpred_intra_filter_neon.o \ ++ arm/rpi_hevcpred_intra_hv_neon.o \ ++ arm/rpi_hevcpred_intra_planar_neon.o + NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o + NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \ + arm/rv40dsp_neon.o +--- a/libavcodec/arm/cabac.h ++++ b/libavcodec/arm/cabac.h +@@ -26,83 +26,209 @@ + #include "libavutil/internal.h" + #include "libavcodec/cabac.h" + ++ + #define get_cabac_inline get_cabac_inline_arm + static av_always_inline int get_cabac_inline_arm(CABACContext *c, +- uint8_t *const state) ++ uint8_t *state) + { +- int bit; +- void *reg_b, *reg_c, *tmp; ++ const uint8_t *mlps_tables = ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128; ++ int bit, ptr, low, tmp1, tmp2; ++ __asm__ volatile ( ++ "ldr %[bit], [%[c], %[range_off]] \n\t" ++ "ldrb %[ptr], [%[state]] \n\t" ++ "sub %[tmp1], %[mlps_tables], %[lps_off] \n\t" ++ "and %[tmp2], %[bit], #0xc0 \n\t" ++ "add %[tmp1], %[tmp1], %[ptr] \n\t" ++ "ldr %[low], [%[c], %[low_off]] \n\t" ++ "ldrb %[tmp2], [%[tmp1], %[tmp2], lsl #1] \n\t" ++ "sub %[bit], %[bit], %[tmp2] \n\t" ++ "mov %[tmp1], %[bit] \n\t" ++ "cmp %[low], %[bit], lsl #17 \n\t" ++ "itt ge \n\t" ++ "movge %[tmp1], %[tmp2] \n\t" ++ "mvnge %[ptr], %[ptr] \n\t" ++ "clz %[tmp2], %[tmp1] \n\t" ++ "it ge \n\t" ++ "subge %[low], %[low], %[bit], lsl #17 \n\t" ++ "sub %[tmp2], %[tmp2], #23 \n\t" ++ "and %[bit], %[ptr], #1 \n\t" ++ "ldrb %[mlps_tables], [%[mlps_tables], %[ptr]] \n\t" ++ "lsl %[low], %[low], %[tmp2] \n\t" ++ "lsls %[ptr], %[low], #16 \n\t" ++ "bne 1f \n\t" ++ "ldr %[ptr], [%[c], %[ptr_off]] \n\t" ++ "lsl %[tmp2], %[tmp1], %[tmp2] \n\t" ++#if UNCHECKED_BITSTREAM_READER ++ "strb %[mlps_tables], [%[state]] \n\t" ++ "rbit %[state], %[low] \n\t" ++ "ldrh %[tmp1], [%[ptr]], #2 \n\t" ++#else ++ "ldr %[tmp1], [%[c], %[end_off]] \n\t" ++ "strb %[mlps_tables], [%[state]] \n\t" ++ "rbit %[state], %[low] \n\t" ++ "cmp %[tmp1], %[ptr] \n\t" ++#if CONFIG_THUMB ++ "it cs \n\t" ++ "ldrhcs %[tmp1], [%[ptr]], #2 \n\t" ++#else ++ "ldrcsh %[tmp1], [%[ptr]], #2 \n\t" ++#endif ++#endif ++ "clz %[state], %[state] \n\t" ++ "movw %[mlps_tables], #0xffff \n\t" ++ "sub %[state], %[state], #16 \n\t" ++ "str %[tmp2], [%[c], %[range_off]] \n\t" ++ "rev %[tmp1], %[tmp1] \n\t" ++ "str %[ptr], [%[c], %[ptr_off]] \n\t" ++ "lsr %[tmp1], %[tmp1], #15 \n\t" ++ "sub %[tmp1], %[tmp1], %[mlps_tables] \n\t" ++#if CONFIG_THUMB ++ "lsl %[tmp1], %[tmp1], %[state] \n\t" ++ "add %[low], %[low], %[tmp1] \n\t" ++#else ++ "add %[low], %[low], %[tmp1], lsl %[state] \n\t" ++#endif ++ "str %[low], [%[c], %[low_off]] \n\t" ++ "b 2f \n\t" ++ "1: \n\t" ++ "strb %[mlps_tables], [%[state]] \n\t" ++ "lsl %[tmp1], %[tmp1], %[tmp2] \n\t" ++ "str %[low], [%[c], %[low_off]] \n\t" ++ "str %[tmp1], [%[c], %[range_off]] \n\t" ++ "2: \n\t" ++ : // Outputs ++ [state]"+r"(state), ++ [mlps_tables]"+r"(mlps_tables), ++ [bit]"=&r"(bit), ++ [ptr]"=&r"(ptr), ++ [low]"=&r"(low), ++ [tmp1]"=&r"(tmp1), ++ [tmp2]"=&r"(tmp2) ++ : // Inputs ++ [c]"r"(c), ++ [low_off]"J"(offsetof(CABACContext, low)), ++ [range_off]"J"(offsetof(CABACContext, range)), ++ [ptr_off]"J"(offsetof(CABACContext, bytestream)), ++ [end_off]"J"(offsetof(CABACContext, bytestream_end)), ++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ return bit; ++} + +- __asm__ volatile( +- "ldrb %[bit] , [%[state]] \n\t" +- "add %[r_b] , %[tables] , %[lps_off] \n\t" +- "mov %[tmp] , %[range] \n\t" +- "and %[range] , %[range] , #0xC0 \n\t" +- "add %[r_b] , %[r_b] , %[bit] \n\t" +- "ldrb %[range] , [%[r_b], %[range], lsl #1] \n\t" +- "add %[r_b] , %[tables] , %[norm_off] \n\t" +- "sub %[r_c] , %[tmp] , %[range] \n\t" +- "lsl %[tmp] , %[r_c] , #17 \n\t" +- "cmp %[tmp] , %[low] \n\t" +- "it gt \n\t" +- "movgt %[range] , %[r_c] \n\t" +- "itt cc \n\t" +- "mvncc %[bit] , %[bit] \n\t" +- "subcc %[low] , %[low] , %[tmp] \n\t" +- "add %[r_c] , %[tables] , %[mlps_off] \n\t" +- "ldrb %[tmp] , [%[r_b], %[range]] \n\t" +- "ldrb %[r_b] , [%[r_c], %[bit]] \n\t" +- "lsl %[low] , %[low] , %[tmp] \n\t" +- "lsl %[range] , %[range] , %[tmp] \n\t" +- "uxth %[r_c] , %[low] \n\t" +- "strb %[r_b] , [%[state]] \n\t" +- "tst %[r_c] , %[r_c] \n\t" +- "bne 2f \n\t" +- "ldr %[r_c] , [%[c], %[byte]] \n\t" ++#define get_cabac_bypass get_cabac_bypass_arm ++static inline int get_cabac_bypass_arm(CABACContext * const c) ++{ ++ uint32_t low = c->low, range, ptr, tmp; ++ int rv; ++ __asm volatile ( ++ "ldr %[range] , [%[c], %[range_off]] \n\t" ++ "mov %[rv] , #0 \n\t" ++ "ldr %[ptr] , [%[c], %[ptr_off]] \n\t" ++ "lsl %[low] , #1 \n\t" ++#if !UNCHECKED_BITSTREAM_READER ++ "ldr %[tmp] , [%[c], %[end_off]] \n\t" ++#endif ++ "cmp %[low] , %[range], lsl #17 \n\t" ++ "itt cs \n\t" ++ "subcs %[low] , %[low], %[range], lsl #17 \n\t" ++ "movcs %[rv] , #1 \n\t" + #if UNCHECKED_BITSTREAM_READER +- "ldrh %[tmp] , [%[r_c]] \n\t" +- "add %[r_c] , %[r_c] , #2 \n\t" +- "str %[r_c] , [%[c], %[byte]] \n\t" +-#else +- "ldr %[r_b] , [%[c], %[end]] \n\t" +- "ldrh %[tmp] , [%[r_c]] \n\t" +- "cmp %[r_c] , %[r_b] \n\t" +- "itt lt \n\t" +- "addlt %[r_c] , %[r_c] , #2 \n\t" +- "strlt %[r_c] , [%[c], %[byte]] \n\t" +-#endif +- "sub %[r_c] , %[low] , #1 \n\t" +- "add %[r_b] , %[tables] , %[norm_off] \n\t" +- "eor %[r_c] , %[low] , %[r_c] \n\t" +- "rev %[tmp] , %[tmp] \n\t" +- "lsr %[r_c] , %[r_c] , #15 \n\t" +- "lsr %[tmp] , %[tmp] , #15 \n\t" +- "ldrb %[r_c] , [%[r_b], %[r_c]] \n\t" +- "movw %[r_b] , #0xFFFF \n\t" +- "sub %[tmp] , %[tmp] , %[r_b] \n\t" +- "rsb %[r_c] , %[r_c] , #7 \n\t" +- "lsl %[tmp] , %[tmp] , %[r_c] \n\t" +- "add %[low] , %[low] , %[tmp] \n\t" +- "2: \n\t" +- : [bit]"=&r"(bit), +- [low]"+&r"(c->low), +- [range]"+&r"(c->range), +- [r_b]"=&r"(reg_b), +- [r_c]"=&r"(reg_c), +- [tmp]"=&r"(tmp) +- : [c]"r"(c), +- [state]"r"(state), +- [tables]"r"(ff_h264_cabac_tables), +- [byte]"M"(offsetof(CABACContext, bytestream)), +- [end]"M"(offsetof(CABACContext, bytestream_end)), +- [norm_off]"I"(H264_NORM_SHIFT_OFFSET), +- [lps_off]"I"(H264_LPS_RANGE_OFFSET), +- [mlps_off]"I"(H264_MLPS_STATE_OFFSET + 128) +- : "memory", "cc" +- ); ++ "ldrh %[tmp] , [%[ptr]], #2 \n\t" ++#else ++ "cmp %[tmp] , %[ptr] \n\t" ++#if CONFIG_THUMB ++ "it cs \n\t" ++ "ldrhcs %[tmp] , [%[ptr]], #2 \n\t" ++#else ++ "ldrcsh %[tmp] , [%[ptr]], #2 \n\t" ++#endif ++#endif ++ "lsls %[range] , %[low], #16 \n\t" ++ "bne 1f \n\t" + +- return bit & 1; ++ "str %[ptr] , [%[c], %[ptr_off]] \n\t" ++ "rev %[tmp] , %[tmp] \n\t" ++ "add %[low] , %[low], %[tmp], lsr #15 \n\t" ++ "movw %[tmp] , 0xFFFF \n\t" ++ "sub %[low] , %[tmp] \n\t" ++ "1: \n\t" ++ "str %[low] , [%[c], %[low_off]] \n\t" ++ : // Outputs ++ [rv]"=&r"(rv), ++ [low]"+r"(low), ++ [range]"=&r"(range), ++ [ptr]"=&r"(ptr), ++ [tmp]"=&r"(tmp) ++ : // Inputs ++ [c]"r"(c), ++ [low_off]"J"(offsetof(CABACContext, low)), ++ [range_off]"J"(offsetof(CABACContext, range)), ++ [ptr_off]"J"(offsetof(CABACContext, bytestream)), ++ [end_off]"J"(offsetof(CABACContext, bytestream_end)) ++ : // Clobbers ++ "memory", "cc" ++ ); ++ return rv; + } ++ ++ ++#define get_cabac_bypass_sign get_cabac_bypass_sign_arm ++static inline int get_cabac_bypass_sign_arm(CABACContext * const c, int rv) ++{ ++ uint32_t low = c->low, range, ptr, tmp; ++ __asm volatile ( ++ "ldr %[range] , [%[c], %[range_off]] \n\t" ++ "ldr %[ptr] , [%[c], %[ptr_off]] \n\t" ++ "lsl %[low] , #1 \n\t" ++#if !UNCHECKED_BITSTREAM_READER ++ "ldr %[tmp] , [%[c], %[end_off]] \n\t" ++#endif ++ "cmp %[low] , %[range], lsl #17 \n\t" ++ "it cs \n\t" ++ "subcs %[low] , %[low], %[range], lsl #17 \n\t" ++ "it cc \n\t" ++ "rsbcc %[rv] , %[rv], #0 \n\t" ++#if UNCHECKED_BITSTREAM_READER ++ "ldrh %[tmp] , [%[ptr]], #2 \n\t" ++#else ++ "cmp %[tmp] , %[ptr] \n\t" ++#if CONFIG_THUMB ++ "it cs \n\t" ++ "ldrhcs %[tmp] , [%[ptr]], #2 \n\t" ++#else ++ "ldrcsh %[tmp] , [%[ptr]], #2 \n\t" ++#endif ++#endif ++ "lsls %[range] , %[low], #16 \n\t" ++ "bne 1f \n\t" ++ ++ "str %[ptr] , [%[c], %[ptr_off]] \n\t" ++ "rev %[tmp] , %[tmp] \n\t" ++ "add %[low] , %[low], %[tmp], lsr #15 \n\t" ++ "movw %[tmp] , 0xFFFF \n\t" ++ "sub %[low] , %[tmp] \n\t" ++ "1: \n\t" ++ "str %[low] , [%[c], %[low_off]] \n\t" ++ : // Outputs ++ [rv]"+r"(rv), ++ [low]"+r"(low), ++ [range]"=&r"(range), ++ [ptr]"=&r"(ptr), ++ [tmp]"=&r"(tmp) ++ : // Inputs ++ [c]"r"(c), ++ [low_off]"J"(offsetof(CABACContext, low)), ++ [range_off]"J"(offsetof(CABACContext, range)), ++ [ptr_off]"J"(offsetof(CABACContext, bytestream)), ++ [end_off]"J"(offsetof(CABACContext, bytestream_end)) ++ : // Clobbers ++ "memory", "cc" ++ ); ++ return rv; ++} ++ + #endif /* HAVE_ARMV6T2_INLINE */ + + #endif /* AVCODEC_ARM_CABAC_H */ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevc_cabac.h +@@ -0,0 +1,607 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * Copyright (C) 2018 John Cox, Ben Avison for Raspberry Pi (Trading) ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_ARM_HEVC_CABAC_H ++#define AVCODEC_ARM_HEVC_CABAC_H ++ ++#include "config.h" ++#if HAVE_ARMV6T2_INLINE ++ ++#define hevc_mem_bits32 hevc_mem_bits32_arm ++static inline uint32_t hevc_mem_bits32_arm(const void * p, const unsigned int bits) ++{ ++ unsigned int n; ++ __asm__ ( ++ "rev %[n], %[x] \n\t" ++ : [n]"=r"(n) ++ : [x]"r"(*(const uint32_t *)((const uint8_t *)p + (bits >> 3))) ++ : ++ ); ++ return n << (bits & 7); ++} ++ ++ ++// --------------------------------------------------------------------------- ++// ++// Helper fns - little bits of code where ARM has an instraction that the ++// compiler doesn't know about / use ++ ++#define trans_scale_sat trans_scale_sat_arm ++static inline int trans_scale_sat_arm(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) ++{ ++ int rv; ++ int t = ((level * (int)(scale * scale_m)) >> shift) + 1; ++ ++ __asm__ ( ++ "ssat %[rv], #16, %[t], ASR #1 \n\t" ++ : [rv]"=r"(rv) ++ : [t]"r"(t) ++ : ++ ); ++ return rv; ++} ++ ++#define update_rice update_rice_arm ++static inline void update_rice_arm(uint8_t * const stat_coeff, ++ const unsigned int last_coeff_abs_level_remaining, ++ const unsigned int c_rice_param) ++{ ++ int t = last_coeff_abs_level_remaining << 1; ++ __asm__ ( ++ "lsrs %[t], %[t], %[shift] \n\t" ++ ++ "it eq \n\t" ++ "subeq %[stat], %[stat], #1 \n\t" ++ "cmp %[t], #6 \n\t" ++ "adc %[stat], %[stat], #0 \n\t" ++ "usat %[stat], #8, %[stat] \n\t" ++ : [stat]"+r"(*stat_coeff), ++ [t]"+r"(t) ++ : [shift]"r"(c_rice_param) ++ : "cc" ++ ); ++} ++ ++// --------------------------------------------------------------------------- ++// ++// CABAC get loops ++// ++// Where the loop is simple enough we can normally do 10-30% better than the ++// compiler ++ ++// Get the residual greater than 1 bits ++ ++#define get_cabac_greater1_bits get_cabac_greater1_bits_arm ++static inline unsigned int get_cabac_greater1_bits_arm(CABACContext * const c, const unsigned int n, ++ uint8_t * const state0) ++{ ++ unsigned int i, reg_b, st, tmp, bit, rv; ++ __asm__ ( ++ "mov %[i] , #0 \n\t" ++ "mov %[rv] , #0 \n\t" ++ "1: \n\t" ++ "add %[i] , %[i] , #1 \n\t" ++ "cmp %[rv] , #0 \n\t" ++ "ite eq \n\t" ++ "usateq %[st] , #2 , %[i] \n\t" ++ "movne %[st] , #0 \n\t" ++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" ++ "and %[tmp] , %[range] , #0xC0 \n\t" ++ ++ "ldrb %[bit] , [%[state0], %[st]] \n\t" ++ "add %[r_b] , %[r_b] , %[bit] \n\t" ++ "ldrb %[tmp] , [%[r_b], %[tmp], lsl #1] \n\t" ++ "sub %[range] , %[range] , %[tmp] \n\t" ++ ++ "cmp %[low] , %[range], lsl #17 \n\t" ++ "ittt ge \n\t" ++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" ++ "movge %[range] , %[tmp] \n\t" ++ "mvnge %[bit] , %[bit] \n\t" ++ ++ "clz %[tmp] , %[range] \n\t" ++ "sub %[tmp] , #23 \n\t" ++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" ++ "and %[bit] , %[bit] , #1 \n\t" ++ "strb %[r_b] , [%[state0], %[st]] \n\t" ++ "lsl %[low] , %[low] , %[tmp] \n\t" ++ "orr %[rv] , %[bit] , %[rv], lsl #1 \n\t" ++ "lsl %[range] , %[range] , %[tmp] \n\t" ++ ++// There is a small speed gain from combining both conditions, using a single ++// branch and then working out what that meant later ++ "lsls %[tmp] , %[low] , #16 \n\t" ++ "it ne \n\t" ++ "cmpne %[n] , %[i] \n\t" ++ "bne 1b \n\t" ++ ++// If reload is not required then we must have run out of flags to decode ++ "tst %[tmp] , %[tmp] \n\t" ++ "bne 2f \n\t" ++ ++// Do reload ++ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" ++ "rbit %[bit] , %[low] \n\t" ++ "movw %[r_b] , #0xFFFF \n\t" ++ "clz %[bit] , %[bit] \n\t" ++ "rev %[tmp] , %[tmp] \n\t" ++ "sub %[bit] , %[bit] , #16 \n\t" ++ "cmp %[n] , %[i] \n\t" ++ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" ++ ++#if CONFIG_THUMB ++ "lsl %[tmp] , %[tmp] , %[bit] \n\t" ++ "add %[low] , %[low] , %[tmp] \n\t" ++#else ++ "add %[low] , %[low] , %[tmp], lsl %[bit] \n\t" ++#endif ++ ++ "bne 1b \n\t" ++ "2: \n\t" ++ : [bit]"=&r"(bit), ++ [low]"+r"(c->low), ++ [range]"+r"(c->range), ++ [r_b]"=&r"(reg_b), ++ [bptr]"+r"(c->bytestream), ++ [i]"=&r"(i), ++ [tmp]"=&r"(tmp), ++ [st]"=&r"(st), ++ [rv]"=&r"(rv) ++ : [state0]"r"(state0), ++ [n]"r"(n), ++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), ++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) ++ : "memory", "cc" ++ ); ++ return rv; ++} ++ ++ ++// n must be > 0 on entry ++#define get_cabac_sig_coeff_flag_idxs get_cabac_sig_coeff_flag_idxs_arm ++static inline uint8_t * get_cabac_sig_coeff_flag_idxs_arm(CABACContext * const c, uint8_t * const state0, ++ unsigned int n, ++ const uint8_t * ctx_map, ++ uint8_t * p) ++{ ++ unsigned int reg_b, tmp, st, bit; ++ __asm__ ( ++// Get bin from map ++#if CONFIG_THUMB ++ "add %[ctx_map] , %[n] \n\t" ++ "ldrb %[st] , [%[ctx_map]] \n\t" ++#else ++ "ldrb %[st] , [%[ctx_map], %[n]]! \n\t" ++#endif ++ "1: \n\t" ++ ++// Load state & ranges ++ "ldrb %[bit] , [%[state0], %[st]] \n\t" ++ "and %[tmp] , %[range] , #0xC0 \n\t" ++ "sub %[r_b] , %[mlps_tables], %[lps_off] \n\t" ++ "add %[r_b] , %[r_b] , %[tmp], lsl #1 \n\t" ++ "ldrb %[tmp] , [%[r_b], %[bit]] \n\t" ++ "sub %[range] , %[range] , %[tmp] \n\t" ++ ++ "cmp %[low] , %[range], lsl #17 \n\t" ++ "ittt ge \n\t" ++ "mvnge %[bit] , %[bit] \n\t" ++ "subge %[low] , %[low] , %[range], lsl #17 \n\t" ++ "movge %[range] , %[tmp] \n\t" ++ ++// Renorm ++ "clz %[tmp] , %[range] \n\t" ++ "ldrb %[r_b] , [%[mlps_tables], %[bit]] \n\t" ++ "sub %[tmp] , #23 \n\t" ++ "strb %[r_b] , [%[state0], %[st]] \n\t" ++ "tst %[bit] , #1 \n\t" ++ "ldrb %[st] , [%[ctx_map], #-1]! \n\t" ++ "lsl %[low] , %[low] , %[tmp] \n\t" ++// GCC asm seems to need strbne written differently for thumb and arm ++#if CONFIG_THUMB ++ "it ne \n\t" ++ "strbne %[n] , [%[idx]] , #1 \n\t" ++#else ++ "strneb %[n] , [%[idx]] , #1 \n\t" ++#endif ++ ++// There is a small speed gain from combining both conditions, using a single ++// branch and then working out what that meant later ++ "subs %[n] , %[n] , #1 \n\t" ++ "lsl %[range] , %[range] , %[tmp] \n\t" ++#if CONFIG_THUMB ++ "itt ne \n\t" ++ "lslsne %[tmp] , %[low] , #16 \n\t" ++#else ++ "lslnes %[tmp] , %[low] , #16 \n\t" ++#endif ++ "bne 1b \n\t" ++ ++// If we have bits left then n must be 0 so give up now ++ "lsls %[tmp] , %[low] , #16 \n\t" ++ "bne 2f \n\t" ++ ++// Do reload ++ "ldrh %[tmp] , [%[bptr]] , #2 \n\t" ++ "rbit %[bit] , %[low] \n\t" ++ "movw %[r_b] , #0xFFFF \n\t" ++ "clz %[bit] , %[bit] \n\t" ++ "cmp %[n] , #0 \n\t" ++ "rev %[tmp] , %[tmp] \n\t" ++ "sub %[bit] , %[bit] , #16 \n\t" ++ "rsb %[tmp] , %[r_b] , %[tmp], lsr #15 \n\t" ++ ++#if CONFIG_THUMB ++ "lsl %[tmp] , %[tmp] , %[bit] \n\t" ++ "add %[low] , %[low] , %[tmp] \n\t" ++#else ++ "add %[low] , %[low] , %[tmp], lsl %[bit] \n\t" ++#endif ++ ++// Check to see if we still have more to do ++ "bne 1b \n\t" ++ "2: \n\t" ++ : [bit]"=&r"(bit), ++ [low]"+r"(c->low), ++ [range]"+r"(c->range), ++ [r_b]"=&r"(reg_b), ++ [bptr]"+r"(c->bytestream), ++ [idx]"+r"(p), ++ [n]"+r"(n), ++ [tmp]"=&r"(tmp), ++ [st]"=&r"(st), ++ [ctx_map]"+r"(ctx_map) ++ : [state0]"r"(state0), ++ [mlps_tables]"r"(ff_h264_cabac_tables + H264_MLPS_STATE_OFFSET + 128), ++ [lps_off]"I"((H264_MLPS_STATE_OFFSET + 128) - H264_LPS_RANGE_OFFSET) ++ : "memory", "cc" ++ ); ++ ++ return p; ++} ++ ++// --------------------------------------------------------------------------- ++// ++// CABAC_BY22 functions ++ ++ ++#define get_cabac_by22_start get_cabac_by22_start_arm ++static inline void get_cabac_by22_start_arm(CABACContext * const c) ++{ ++ const uint8_t *ptr = c->bytestream; ++ register uint32_t low __asm__("r1"), range __asm__("r2"); ++ uint32_t m, range8, bits; ++#if !USE_BY22_DIV ++ uintptr_t inv; ++#endif ++ ++ av_assert2(offsetof (CABACContext, low) == 0); ++ av_assert2(offsetof (CABACContext, range) == 4); ++ av_assert2(offsetof (CABACContext, by22.range) == offsetof (CABACContext, by22.bits) + 2); ++ __asm__ volatile ( ++ "ldmia %[c], {%[low], %[range]} \n\t" ++ : // Outputs ++ [low]"=r"(low), ++ [range]"=r"(range) ++ : // Inputs ++ [c]"r"(c) ++ : // Clobbers ++ ); ++#if !USE_BY22_DIV ++ inv = (uintptr_t)cabac_by22_inv_range; ++#endif ++ __asm__ volatile ( ++ "ldr %[m], [%[ptr]], #-("AV_STRINGIFY(CABAC_BITS)"/8) \n\t" ++#if !USE_BY22_DIV ++ "uxtb %[range8], %[range] \n\t" ++#endif ++ "rbit %[bits], %[low] \n\t" ++ "lsl %[low], %[low], #22 - "AV_STRINGIFY(CABAC_BITS)" \n\t" ++ "clz %[bits], %[bits] \n\t" ++ "str %[ptr], [%[c], %[ptr_off]] \n\t" ++ "rev %[m], %[m] \n\t" ++ "rsb %[ptr], %[bits], #9 + "AV_STRINGIFY(CABAC_BITS)" \n\t" ++ "eor %[m], %[m], #0x80000000 \n\t" ++#if !USE_BY22_DIV ++ "ldr %[inv], [%[inv], %[range8], lsl #2] \n\t" ++ "pkhbt %[range], %[bits], %[range], lsl #16 \n\t" ++ "str %[range], [%[c], %[bits_off]] \n\t" ++#else ++ "strh %[bits], [%[c], %[bits_off]] \n\t" ++#endif ++#if CONFIG_THUMB ++ "lsr %[m], %[ptr] \n\t" ++ "eor %[range], %[low], %[m] \n\t" ++#else ++ "eor %[range], %[low], %[m], lsr %[ptr] \n\t" ++#endif ++ : // Outputs ++ [ptr]"+&r"(ptr), ++ [low]"+&r"(low), ++ [range]"+&r"(range), ++#if !USE_BY22_DIV ++ [inv]"+&r"(inv), ++#endif ++ [m]"=&r"(m), ++ [range8]"=&r"(range8), ++ [bits]"=&r"(bits) ++ : // Inputs ++ [c]"r"(c), ++ [bits_off]"J"(offsetof (CABACContext, by22.bits)), ++ [ptr_off]"J"(offsetof (CABACContext, bytestream)) ++ : // Clobbers ++ "memory" ++ ); ++ c->low = range; ++#if !USE_BY22_DIV ++ c->range = inv; ++#endif ++} ++ ++#define get_cabac_by22_peek get_cabac_by22_peek_arm ++static inline uint32_t get_cabac_by22_peek_arm(const CABACContext *const c) ++{ ++ uint32_t rv = c->low &~ 1, tmp; ++ __asm__ ( ++ "cmp %[inv] , #0 \n\t" ++ "it ne \n\t" ++ "umullne %[tmp] , %[rv] , %[inv], %[rv] \n\t" ++ : // Outputs ++ [rv]"+r"(rv), ++ [tmp]"=r"(tmp) ++ : // Inputs ++ [inv]"r"(c->range) ++ : // Clobbers ++ "cc" ++ ); ++ return rv << 1; ++} ++ ++#define get_cabac_by22_flush get_cabac_by22_flush_arm ++static inline void get_cabac_by22_flush_arm(CABACContext *const c, const unsigned int n, uint32_t val) ++{ ++ uint32_t bits, ptr, tmp1, tmp2; ++ __asm__ volatile ( ++ "ldrh %[bits], [%[cc], %[bits_off]] \n\t" ++ "ldr %[ptr], [%[cc], %[ptr_off]] \n\t" ++ "rsb %[tmp1], %[n], #32 \n\t" ++ "add %[bits], %[bits], %[n] \n\t" ++ "ldrh %[tmp2], [%[cc], %[range_off]] \n\t" ++ "lsr %[tmp1], %[val], %[tmp1] \n\t" ++ "ldr %[val], [%[cc], %[low_off]] \n\t" ++#if CONFIG_THUMB ++ "add %[ptr], %[ptr], %[bits], lsr #3 \n\t" ++ "ldr %[ptr], [%[ptr]] \n\t" ++#else ++ "ldr %[ptr], [%[ptr], %[bits], lsr #3] \n\t" ++#endif ++ "mul %[tmp1], %[tmp2], %[tmp1] \n\t" ++ "and %[tmp2], %[bits], #7 \n\t" ++ "strh %[bits], [%[cc], %[bits_off]] \n\t" ++ "rev %[ptr], %[ptr] \n\t" ++ "lsl %[tmp1], %[tmp1], #23 \n\t" ++#if CONFIG_THUMB ++ "lsl %[val], %[n] \n\t" ++ "sub %[val], %[tmp1] \n\t" ++#else ++ "rsb %[val], %[tmp1], %[val], lsl %[n] \n\t" ++#endif ++ "lsl %[ptr], %[ptr], %[tmp2] \n\t" ++ "orr %[val], %[val], %[ptr], lsr #9 \n\t" ++ "str %[val], [%[cc], %[low_off]] \n\t" ++ : // Outputs ++ [val]"+r"(val), ++ [bits]"=&r"(bits), ++ [ptr]"=&r"(ptr), ++ [tmp1]"=&r"(tmp1), ++ [tmp2]"=&r"(tmp2) ++ : // Inputs ++ [cc]"r"(c), ++ [n]"r"(n), ++ [bits_off]"J"(offsetof(CABACContext, by22.bits)), ++ [ptr_off]"J"(offsetof(CABACContext, bytestream)), ++ [range_off]"J"(offsetof(CABACContext, by22.range)), ++ [low_off]"J"(offsetof(CABACContext, low)) ++ : // Clobbers ++ "memory" ++ ); ++} ++ ++#define coeff_abs_level_remaining_decode_bypass coeff_abs_level_remaining_decode_bypass_arm ++static inline int coeff_abs_level_remaining_decode_bypass_arm(CABACContext *const c, unsigned int rice_param) ++{ ++ uint32_t last_coeff_abs_level_remaining; ++ uint32_t prefix, n1, range, n2, ptr, tmp1, tmp2; ++ __asm__ volatile ( ++ "ldr %[remain], [%[cc], %[low_off]] \n\t" ++ "ldr %[prefix], [%[cc], %[range_off]] \n\t" ++ "bic %[remain], %[remain], #1 \n\t" ++ "ldrh %[tmp2], [%[cc], %[by22_bits_off]] \n\t" ++ "ldr %[ptr], [%[cc], %[ptr_off]] \n\t" ++ "cmp %[prefix], #0 \n\t" ++ "it ne \n\t" ++ "umullne %[prefix], %[remain], %[prefix], %[remain] \n\t" ++ "ldrh %[range], [%[cc], %[by22_range_off]] \n\t" ++ "lsl %[remain], %[remain], #1 \n\t" ++ "mvn %[prefix], %[remain] \n\t" ++ "clz %[prefix], %[prefix] \n\t" ++ "rsbs %[n1], %[prefix], #2 \n\t" ++ "bcc 1f \n\t" ++ "adc %[n1], %[rice], %[prefix] \n\t" ++ "add %[tmp2], %[tmp2], %[n1] \n\t" ++ "rsb %[n2], %[n1], #32 \n\t" ++ "and %[tmp1], %[tmp2], #7 \n\t" ++ "strh %[tmp2], [%[cc], %[by22_bits_off]] \n\t" ++ "lsr %[tmp2], %[tmp2], #3 \n\t" ++ "lsr %[n2], %[remain], %[n2] \n\t" ++ "mul %[n2], %[range], %[n2] \n\t" ++ "ldr %[range], [%[cc], %[low_off]] \n\t" ++ "ldr %[ptr], [%[ptr], %[tmp2]] \n\t" ++ "rsb %[tmp2], %[rice], #31 \n\t" ++ "lsl %[remain], %[remain], %[prefix] \n\t" ++ "lsl %[n2], %[n2], #23 \n\t" ++#if CONFIG_THUMB ++ "lsl %[range], %[n1] \n\t" ++ "sub %[range], %[n2] \n\t" ++#else ++ "rsb %[range], %[n2], %[range], lsl %[n1] \n\t" ++#endif ++ "rev %[ptr], %[ptr] \n\t" ++ "lsl %[n2], %[prefix], %[rice] \n\t" ++#if CONFIG_THUMB ++ "lsr %[remain], %[tmp2] \n\t" ++ "add %[remain], %[n2] \n\t" ++#else ++ "add %[remain], %[n2], %[remain], lsr %[tmp2] \n\t" ++#endif ++ "b 3f \n\t" ++ "1: \n\t" ++ "add %[n2], %[rice], %[prefix], lsl #1 \n\t" ++ "cmp %[n2], %[peek_bits_plus_2] \n\t" ++ "bhi 2f \n\t" ++ "sub %[n1], %[n2], #2 \n\t" ++ "add %[tmp2], %[tmp2], %[n1] \n\t" ++ "rsb %[n2], %[n1], #32 \n\t" ++ "strh %[tmp2], [%[cc], %[by22_bits_off]] \n\t" ++ "lsr %[tmp1], %[tmp2], #3 \n\t" ++ "lsr %[n2], %[remain], %[n2] \n\t" ++ "mul %[n2], %[range], %[n2] \n\t" ++ "rsb %[range], %[rice], #34 \n\t" ++ "ldr %[ptr], [%[ptr], %[tmp1]] \n\t" ++ "and %[tmp1], %[tmp2], #7 \n\t" ++ "lsl %[remain], %[remain], %[prefix] \n\t" ++ "ldr %[tmp2], [%[cc], %[low_off]] \n\t" ++ "rsb %[prefix], %[prefix], %[range] \n\t" ++ "orr %[remain], %[remain], #0x80000000 \n\t" ++ "rev %[ptr], %[ptr] \n\t" ++ "lsl %[n2], %[n2], #23 \n\t" ++ "mov %[range], #2 \n\t" ++#if CONFIG_THUMB ++ "lsl %[tmp2], %[n1] \n\t" ++ "sub %[tmp2], %[n2] \n\t" ++#else ++ "rsb %[tmp2], %[n2], %[tmp2], lsl %[n1] \n\t" ++#endif ++ "lsl %[ptr], %[ptr], %[tmp1] \n\t" ++ "lsl %[rice], %[range], %[rice] \n\t" ++ "orr %[range], %[tmp2], %[ptr], lsr #9 \n\t" ++#if CONFIG_THUMB ++ "lsr %[remain], %[prefix] \n\t" ++ "add %[remain], %[rice] \n\t" ++#else ++ "add %[remain], %[rice], %[remain], lsr %[prefix] \n\t" ++#endif ++ "b 4f \n\t" ++ "2: \n\t" ++ "add %[n1], %[tmp2], %[prefix] \n\t" ++#if CONFIG_THUMB ++ "add %[tmp2], %[ptr], %[n1], lsr #3 \n\t" ++ "ldr %[tmp2], [%[tmp2]] \n\t" ++#else ++ "ldr %[tmp2], [%[ptr], %[n1], lsr #3] \n\t" ++#endif ++ "rsb %[tmp1], %[prefix], #32 \n\t" ++ "push {%[rice]} \n\t" ++ "and %[rice], %[n1], #7 \n\t" ++ "lsr %[tmp1], %[remain], %[tmp1] \n\t" ++ "ldr %[ptr], [%[cc], %[low_off]] \n\t" ++ "mul %[remain], %[range], %[tmp1] \n\t" ++ "rev %[tmp2], %[tmp2] \n\t" ++ "rsb %[n2], %[prefix], %[n2] \n\t" ++ "ldr %[tmp1], [%[cc], %[range_off]] \n\t" ++ "lsl %[rice], %[tmp2], %[rice] \n\t" ++ "sub %[tmp2], %[n2], #2 \n\t" ++ "lsl %[remain], %[remain], #23 \n\t" ++#if CONFIG_THUMB ++ "lsl %[ptr], %[prefix] \n\t" ++ "rsb %[remain], %[ptr] \n\t" ++#else ++ "rsb %[remain], %[remain], %[ptr], lsl %[prefix] \n\t" ++#endif ++ "orr %[remain], %[remain], %[rice], lsr #9 \n\t" ++ "add %[prefix], %[n1], %[tmp2] \n\t" ++ "bic %[n1], %[remain], #1 \n\t" ++ "ldr %[ptr], [%[cc], %[ptr_off]] \n\t" ++ "cmp %[tmp1], #0 \n\t" ++ "rsb %[rice], %[tmp2], #32 \n\t" ++ "it ne \n\t" ++ "umullne %[tmp1], %[n1], %[tmp1], %[n1] \n\t" ++ "and %[tmp1], %[prefix], #7 \n\t" ++#if CONFIG_THUMB ++ "add %[ptr], %[ptr], %[prefix], lsr #3 \n\t" ++ "ldr %[ptr], [%[ptr]] \n\t" ++#else ++ "ldr %[ptr], [%[ptr], %[prefix], lsr #3] \n\t" ++#endif ++ "lsl %[n1], %[n1], #1 \n\t" ++ "lsr %[rice], %[n1], %[rice] \n\t" ++ "rsb %[n2], %[n2], #34 \n\t" ++ "mul %[range], %[range], %[rice] \n\t" ++ "pop {%[rice]} \n\t" ++ "rev %[ptr], %[ptr] \n\t" ++ "orr %[n1], %[n1], #0x80000000 \n\t" ++ "strh %[prefix], [%[cc], %[by22_bits_off]] \n\t" ++ "mov %[prefix], #2 \n\t" ++ "lsl %[range], %[range], #23 \n\t" ++#if CONFIG_THUMB ++ "lsl %[remain], %[tmp2] \n\t" ++ "rsb %[range], %[remain] \n\t" ++#else ++ "rsb %[range], %[range], %[remain], lsl %[tmp2] \n\t" ++#endif ++ "lsl %[remain], %[prefix], %[rice] \n\t" ++#if CONFIG_THUMB ++ "lsr %[n1], %[n2] \n\t" ++ "add %[remain], %[n1] \n\t" ++#else ++ "add %[remain], %[remain], %[n1], lsr %[n2] \n\t" ++#endif ++ "3: \n\t" ++ "lsl %[ptr], %[ptr], %[tmp1] \n\t" ++ "orr %[range], %[range], %[ptr], lsr #9 \n\t" ++ "4: \n\t" ++ "str %[range], [%[cc], %[low_off]] \n\t" ++ : // Outputs ++ [remain]"=&r"(last_coeff_abs_level_remaining), ++ [rice]"+r"(rice_param), ++ [prefix]"=&r"(prefix), ++ [n1]"=&r"(n1), ++ [range]"=&r"(range), ++ [n2]"=&r"(n2), ++ [ptr]"=&r"(ptr), ++ [tmp1]"=&r"(tmp1), ++ [tmp2]"=&r"(tmp2) ++ : // Inputs ++ [cc]"r"(c), ++ [peek_bits_plus_2]"I"(CABAC_BY22_PEEK_BITS + 2), ++ [low_off]"J"(offsetof(CABACContext, low)), ++ [range_off]"J"(offsetof(CABACContext, range)), ++ [by22_bits_off]"J"(offsetof(CABACContext, by22.bits)), ++ [by22_range_off]"J"(offsetof(CABACContext, by22.range)), ++ [ptr_off]"J"(offsetof(CABACContext, bytestream)) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ return last_coeff_abs_level_remaining; ++} ++ ++#endif /* HAVE_ARMV6T2_INLINE */ ++ ++#endif /* AVCODEC_ARM_HEVC_CABAC_H */ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevc_idct_fn_neon.S +@@ -0,0 +1,183 @@ ++/* ++ * ARM NEON optimised IDCT functions for HEVC decoding ++ * Copyright (c) 2014 Seppo Tomperi ++ * Copyright (C) 2018 John Cox, ben Avison for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++@ Included multiple times from hevc_idct_neon.S ++@ Macros defined there ++ ++#define DC_SHIFT (15 - BIT_DEPTH) ++#define DC_ADD (1 | (1 << (14 - BIT_DEPTH))) ++#define TRN_SHIFT (20 - BIT_DEPTH) ++ ++function JOIN(ff_hevc_rpi_idct_4x4_dc_neon_, BIT_DEPTH), export=1 ++ ldrsh r1, [r0] ++ add r1, #DC_ADD ++ asr r1, #DC_SHIFT ++ vdup.16 q0, r1 ++ vdup.16 q1, r1 ++ vst1.16 {q0, q1}, [r0] ++ bx lr ++endfunc ++ ++function JOIN(ff_hevc_rpi_idct_8x8_dc_neon_, BIT_DEPTH), export=1 ++ ldrsh r1, [r0] ++ add r2, r0, #32 ++ mov r3, #64 ++ add r1, #DC_ADD ++ asr r1, #DC_SHIFT ++ vdup.16 q8, r1 ++ vdup.16 q9, r1 ++ vst1.16 {q8, q9}, [r0], r3 ++ vst1.16 {q8, q9}, [r2], r3 ++ vst1.16 {q8, q9}, [r0] ++ vst1.16 {q8, q9}, [r2] ++ bx lr ++endfunc ++ ++function JOIN(ff_hevc_rpi_idct_16x16_dc_neon_, BIT_DEPTH), export=1 ++ ldrsh r1, [r0] ++ add r2, r0, #32 ++ mov r3, #64 ++ add r1, #DC_ADD ++ mov ip, #16*16 ++ asr r1, #DC_SHIFT ++ vdup.16 q8, r1 ++ vdup.16 q9, r1 ++1: vst1.16 {q8, q9}, [r0], r3 ++ subs ip, ip, #32 ++ vst1.16 {q8, q9}, [r2], r3 ++ bhi 1b ++ bx lr ++endfunc ++ ++function JOIN(ff_hevc_rpi_idct_32x32_dc_neon_, BIT_DEPTH), export=1 ++ ldrsh r1, [r0] ++ add r2, r0, #32 ++ mov r3, #64 ++ add r1, #DC_ADD ++ mov ip, #32*32 ++ asr r1, #DC_SHIFT ++ vdup.16 q8, r1 ++ vdup.16 q9, r1 ++1: vst1.16 {q8, q9}, [r0], r3 ++ subs ip, ip, #32 ++ vst1.16 {q8, q9}, [r2], r3 ++ bhi 1b ++ bx lr ++endfunc ++ ++ ++function JOIN(ff_hevc_rpi_transform_4x4_neon_, BIT_DEPTH), export=1 ++ vldr.i32 s0, =0x00240053 // 36 and 83 ++ vld1.16 {q14, q15}, [r0 :256] // coeffs ++ ++ tr4_shift #7 ++ ++ vzip.16 d28, d29 ++ vzip.16 d30, d31 ++ vzip.32 q14, q15 ++ ++ tr4_shift #TRN_SHIFT ++ ++ vst4.16 {q14, q15}, [r0 :256] ++ bx lr ++ ++ .ltorg ++endfunc ++ ++ ++ ++function JOIN(ff_hevc_rpi_transform_luma_4x4_neon_, BIT_DEPTH), export=1 ++ vmov.i32 d0, #0x4a // 74 ++ vld1.16 {q14, q15}, [r0 :256] // coeffs ++ vmov.i32 d1, #0x1d // 29 ++ vmov.i32 d2, #0x37 // 55 ++ ++ tr4_luma_shift #7 ++ ++ vzip.16 d28, d29 ++ vzip.16 d30, d31 ++ vzip.32 q14, q15 ++ ++ tr4_luma_shift #TRN_SHIFT ++ ++ vst4.16 {q14, q15}, [r0 :256] ++ bx lr ++endfunc ++ ++function JOIN(ff_hevc_rpi_transform_8x8_neon_, BIT_DEPTH), export=1 ++ add r2, r0, #16 ++ adr r3, tr4f ++ vpush {d8-d15} ++ vld1.16 {d0, d1}, [r3] ++ mov r3, #32 ++ ++ tr8_vert d16, d17, d18, d19, d24, d25, d26, d27, q8, q9, \ ++ "sub r0, r0, #128-8", \ ++ "sub r2, r2, #128-8", \ ++ "cmp r1, #4" ++ ble 2f ++ ++ tr8_vert d20, d21, d22, d23, d28, d29, d30, d31, q10, q11, \ ++ "sub r0, r0, #128+8", \ ++ "sub r2, r2, #128+8+16-32", \ ++ "mov r3, #64" ++ ++ vzip.16 d16, d17 ++ vzip.16 d18, d19 ++ ++ vzip.16 d20, d21 ++ vzip.16 d22, d23 ++ vzip.16 d28, d29 ++ vzip.16 d30, d31 ++ vzip.32 q10, q11 ++ vzip.32 q14, q15 ++1: ++ vzip.16 d24, d25 ++ vzip.16 d26, d27 ++ vzip.32 q8, q9 ++ vzip.32 q12, q13 ++ ++ tr8_horiz d16, d17, d18, d19, d20, d21, d22, d23, q8, q9, TRN_SHIFT ++ tr8_horiz d24, d25, d26, d27, d28, d29, d30, d31, q12, q13, TRN_SHIFT ++ ++ vpop {d8-d15} ++ bx lr ++ ++2: vmov.i64 q10, #0 ++ sub r0, r0, #8 ++ vmov.i64 q11, #0 ++ sub r2, r2, #8+16-32 ++ vmov.i64 q14, #0 ++ mov r3, #64 ++ vmov.i64 q15, #0 ++ ++ vzip.16 d16, d17 ++ vzip.16 d18, d19 ++ ++ b 1b ++ ++endfunc ++ ++#undef DC_SHIFT ++#undef DC_ADD ++#undef TRN_SHIFT ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevc_misc_neon.S +@@ -0,0 +1,267 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Written by John Cox, Ben Avison ++*/ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++@ rpi_zap_coeff_vals_neon( ++@ uint16_t * buf, [r0] ++@ unsigned int log_n_m2) [r1] ++ ++function rpi_zap_coeff_vals_neon, export=1 ++ mov ip, #1 ++ vmov.i64 q0, #0 ++ teq r1, #0 ++ vmov.i64 q1, #0 ++ beq 2f ++ ++ lsl ip, r1 @ 2, 4 or 8 ++ add r2, r0, #32 ++ lsl ip, r1 @ 4, 16 or 64 = number of 32-byte blocks to zero ++ mov r3, #64 ++1: vst1.8 {q0,q1}, [r0:256], r3 ++ subs ip, #2 ++ vst1.8 {q0,q1}, [r2:256], r3 ++ bne 1b ++ bx lr ++ ++2: vst1.8 {q0,q1}, [r0:256] ++ bx lr ++endfunc ++ ++@ PIC jump tables are more expensive than absolute for A32 code ++.set jent_pic, CONFIG_PIC || CONFIG_THUMB ++ ++@ Jump table entry - if in neon mode the bottom bit must be set ++@ ? There is probably a real asm instruction to do this but I haven't found it ++.macro jent lab ++.if jent_pic ++T .short ((0 + \lab) - (0 + 98b)) / 2 ++A .short (0 + \lab) - (4 + 98b) ++.else ++T .word 1 + \lab ++A .word \lab ++.endif ++.endm ++ ++.set expected_next, 0 ++ ++.macro cpy_compound val, p1, p2, drop_thru=0 ++.if \p1 + \p2 != \val ++.error "Bad addition! \p1 + \p2 != \val" ++.endif ++.if expected_next != 0 && expected_next != \val ++.error "Drop thru failure" ++.endif ++\val\(): ++ push {r0-r3} ++ bl 100\p1\()b ++ pop {r0-r3} ++ add r0, #\p1 ++ add r2, #\p1 ++.if \drop_thru == 0 ++ b \p2\()b ++.set expected_next, 0 ++.else ++.set expected_next, \p2 ++.endif ++.endm ++ ++@ ff_hevc_cpy_blks8x4_neon( ++@ dst [r0] ++@ dst_stride [r1] ++@ src [r2] ++@ src_stride [r3] ++@ width [sp, #0] (bytes) ++@ height) [sp, #4] ++@ ++@ Power of 2 widths are directly coded, all others are done in stripes ++@ We expect the vast majority of calls to be power of 2 ++@ ++@ Currently has min width of 8, but we could make that 4 without issue ++@ Min height is 4 ++ ++function ff_hevc_rpi_cpy_blks8x4_neon, export=1 ++ ldr r12, [sp, #0] ++ push {r11, lr} ++.if jent_pic ++A adr lr, 98f - 2 ++.else ++A adr lr, 98f - 4 ++.endif ++ lsr r12, #3 ++ ldr r11, [sp, #(8 + 4)] ++.if jent_pic ++A lsl r12, #1 ++A ldrsh lr, [lr, r12] ++A add pc, lr ++T tbh [pc, r12, lsl #1] ++.else ++ @ A32 only, Thumb is always PIC ++ ldr pc, [lr, r12, lsl #2] ++.endif ++ ++98: ++T .short 0 @ unused ++ jent 8f ++ jent 16f ++ jent 24f ++ jent 32f ++ jent 40f ++ jent 48f ++ jent 56f ++ jent 64f ++ jent 72f ++ jent 80f ++ jent 88f ++ jent 96f ++ jent 104f ++ jent 112f ++ jent 120f ++ jent 128f ++ ++1008: ++ push {r11, lr} ++8: ++ add lr, r2, r3 ++ lsl r3, #1 ++ add r12, r0, r1 ++ lsl r1, #1 ++1: ++ vld1.32 {d0 }, [r2], r3 ++ vld1.32 {d1 }, [lr], r3 ++ vld1.32 {d2 }, [r2], r3 ++ vld1.32 {d3 }, [lr], r3 ++ subs r11, #4 ++ vst1.32 {d0 }, [r0], r1 ++ vst1.32 {d1 }, [r12], r1 ++ vst1.32 {d2 }, [r0], r1 ++ vst1.32 {d3 }, [r12], r1 ++ bgt 1b ++ pop {r11, pc} ++ ++10016: ++ push {r11, lr} ++16: ++ add lr, r2, r3 ++ lsl r3, #1 ++ add r12, r0, r1 ++ lsl r1, #1 ++1: ++ vld1.32 {q0 }, [r2], r3 ++ vld1.32 {q1 }, [lr], r3 ++ vld1.32 {q2 }, [r2], r3 ++ vld1.32 {q3 }, [lr], r3 ++ subs r11, #4 ++ vst1.32 {q0 }, [r0], r1 ++ vst1.32 {q1 }, [r12], r1 ++ vst1.32 {q2 }, [r0], r1 ++ vst1.32 {q3 }, [r12], r1 ++ bgt 1b ++ pop {r11, pc} ++ ++10032: ++ push {r11, lr} ++32: ++ add lr, r2, r3 ++ lsl r3, #1 ++ add r12, r0, r1 ++ lsl r1, #1 ++1: ++ vld1.32 {q8, q9 }, [r2], r3 ++ vld1.32 {q10, q11}, [lr], r3 ++ vld1.32 {q12, q13}, [r2], r3 ++ vld1.32 {q14, q15}, [lr], r3 ++ subs r11, #4 ++ vst1.32 {q8, q9 }, [r0], r1 ++ vst1.32 {q10, q11}, [r12], r1 ++ vst1.32 {q12, q13}, [r0], r1 ++ vst1.32 {q14, q15}, [r12], r1 ++ bgt 1b ++ pop {r11, pc} ++ ++10064: ++ push {r11, lr} ++64: ++ add lr, r2, #32 ++ add r12, r0, #32 ++1: ++ vld1.32 {q8, q9 }, [r2], r3 ++ vld1.32 {q10, q11}, [lr], r3 ++ vld1.32 {q12, q13}, [r2], r3 ++ vld1.32 {q14, q15}, [lr], r3 ++ subs r11, #2 ++ vst1.32 {q8, q9 }, [r0], r1 ++ vst1.32 {q10, q11}, [r12], r1 ++ vst1.32 {q12, q13}, [r0], r1 ++ vst1.32 {q14, q15}, [r12], r1 ++ bgt 1b ++ pop {r11, pc} ++ ++128: ++ push {r4, r5} ++ @ We could do this with fewer registers if we jump around but I ++ @ have a primative urge to load sequentially ++ mov r4, #64 ++ add lr, r2, #32 ++ add r12, r0, #32 ++ sub r3, r4 ++ sub r1, r4 ++1: ++ vld1.32 {q8, q9 }, [r2], r4 ++ vld1.32 {q10, q11}, [lr], r4 ++ vld1.32 {q12, q13}, [r2], r3 ++ vld1.32 {q14, q15}, [lr], r3 ++ subs r11, #1 ++ vst1.32 {q8, q9 }, [r0], r4 ++ vst1.32 {q10, q11}, [r12], r4 ++ vst1.32 {q12, q13}, [r0], r1 ++ vst1.32 {q14, q15}, [r12], r1 ++ bgt 1b ++ pop {r4, r5, r11, pc} ++ ++@ Use drop_thru where we can ++cpy_compound 104, 64, 40, 1 ++cpy_compound 40, 32, 8 ++ ++cpy_compound 112, 64, 48, 1 ++cpy_compound 48, 32, 16 ++ ++cpy_compound 120, 64, 56, 1 ++cpy_compound 56, 32, 24, 1 ++cpy_compound 24, 16, 8 ++ ++cpy_compound 72, 64, 8 ++cpy_compound 80, 64, 16 ++cpy_compound 88, 64, 24 ++cpy_compound 96, 64, 32 ++ ++ ++endfunc ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevc_misc_neon.h +@@ -0,0 +1,438 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_ARM_RPI_HEVC_MISC_H ++#define AVCODEC_ARM_RPI_HEVC_MISC_H ++ ++#include "config.h" ++#if HAVE_NEON_INLINE && !CONFIG_THUMB ++ ++static av_noinline void ff_hevc_rpi_copy_vert_v2h_neon(uint8_t *dst, const uint8_t *src, ++ int pixel_shift, int height, ++ ptrdiff_t stride_src) ++{ ++ const uint8_t *src2 = src + stride_src; ++ stride_src <<= 1; ++ switch (pixel_shift) ++ { ++ case 2: ++ __asm__ volatile ( ++ "vld1.32 {d0[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.32 {d0[1]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.32 {d1[0]}, [%[src]], %[stride_src] \n\t" ++ "subs %[height], #4 \n\t" ++ "vld1.32 {d1[1]}, [%[src2]], %[stride_src] \n\t" ++ "beq 2f \n\t" ++ "1: \n\t" ++ "vld1.32 {d2[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.32 {d2[1]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.32 {d3[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.32 {d3[1]}, [%[src2]], %[stride_src] \n\t" ++ "subs %[height], #4 \n\t" ++ "vst1.32 {q0}, [%[dst]]! \n\t" ++ "beq 3f \n\t" ++ "vld1.32 {d0[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.32 {d0[1]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.32 {d1[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.32 {d1[1]}, [%[src2]], %[stride_src] \n\t" ++ "subs %[height], #4 \n\t" ++ "vst1.32 {q1}, [%[dst]]! \n\t" ++ "bne 1b \n\t" ++ "2: \n\t" ++ "vst1.32 {q0}, [%[dst]] \n\t" ++ "b 4f \n\t" ++ "3: \n\t" ++ "vst1.32 {q1}, [%[dst]] \n\t" ++ "4: \n\t" ++ : // Outputs ++ [src]"+r"(src), ++ [src2]"+r"(src2), ++ [dst]"+r"(dst), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_src]"r"(stride_src) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ case 1: ++ __asm__ volatile ( ++ "vld1.16 {d0[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.16 {d1[0]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.16 {d0[1]}, [%[src]], %[stride_src] \n\t" ++ "subs %[height], #4 \n\t" ++ "vld1.16 {d1[1]}, [%[src2]], %[stride_src] \n\t" ++ "beq 2f \n\t" ++ "1: \n\t" ++ "vld1.16 {d2[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.16 {d3[0]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.16 {d2[1]}, [%[src]], %[stride_src] \n\t" ++ "vld1.16 {d3[1]}, [%[src2]], %[stride_src] \n\t" ++ "vzip.16 d0, d1 \n\t" ++ "subs %[height], #4 \n\t" ++ "vst1.16 {d0}, [%[dst]]! \n\t" ++ "beq 3f \n\t" ++ "vld1.16 {d0[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.16 {d1[0]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.16 {d0[1]}, [%[src]], %[stride_src] \n\t" ++ "vld1.16 {d1[1]}, [%[src2]], %[stride_src] \n\t" ++ "vzip.16 d2, d3 \n\t" ++ "subs %[height], #4 \n\t" ++ "vst1.16 {d2}, [%[dst]]! \n\t" ++ "bne 1b \n\t" ++ "2: \n\t" ++ "vzip.16 d0, d1 \n\t" ++ "vst1.16 {d0}, [%[dst]] \n\t" ++ "b 4f \n\t" ++ "3: \n\t" ++ "vzip.16 d2, d3 \n\t" ++ "vst1.16 {d2}, [%[dst]] \n\t" ++ "4: \n\t" ++ : // Outputs ++ [src]"+r"(src), ++ [src2]"+r"(src2), ++ [dst]"+r"(dst), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_src]"r"(stride_src) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ default: ++ __asm__ volatile ( ++ "vld1.8 {d0[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d1[0]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d0[1]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d1[1]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d0[2]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d1[2]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d0[3]}, [%[src]], %[stride_src] \n\t" ++ "subs %[height], #8 \n\t" ++ "vld1.8 {d1[3]}, [%[src2]], %[stride_src] \n\t" ++ "beq 2f \n\t" ++ "1: \n\t" ++ "vld1.8 {d2[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d3[0]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d2[1]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d3[1]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d2[2]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d3[2]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d2[3]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d3[3]}, [%[src2]], %[stride_src] \n\t" ++ "vzip.8 d0, d1 \n\t" ++ "subs %[height], #8 \n\t" ++ "vst1.8 {d0}, [%[dst]]! \n\t" ++ "beq 3f \n\t" ++ "vld1.8 {d0[0]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d1[0]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d0[1]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d1[1]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d0[2]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d1[2]}, [%[src2]], %[stride_src] \n\t" ++ "vld1.8 {d0[3]}, [%[src]], %[stride_src] \n\t" ++ "vld1.8 {d1[3]}, [%[src2]], %[stride_src] \n\t" ++ "vzip.8 d2, d3 \n\t" ++ "subs %[height], #8 \n\t" ++ "vst1.8 {d2}, [%[dst]]! \n\t" ++ "bne 1b \n\t" ++ "2: \n\t" ++ "vzip.8 d0, d1 \n\t" ++ "vst1.8 {d0}, [%[dst]] \n\t" ++ "b 4f \n\t" ++ "3: \n\t" ++ "vzip.8 d2, d3 \n\t" ++ "vst1.8 {d2}, [%[dst]] \n\t" ++ "4: \n\t" ++ : // Outputs ++ [src]"+r"(src), ++ [src2]"+r"(src2), ++ [dst]"+r"(dst), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_src]"r"(stride_src) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ } ++} ++ ++static av_noinline void ff_hevc_rpi_copy_vert_h2v_neon(uint8_t *dst, const uint8_t *src, ++ int pixel_shift, int height, ++ ptrdiff_t stride_dst) ++{ ++ uint8_t *dst2 = dst + stride_dst; ++ stride_dst <<= 1; ++ switch (pixel_shift) ++ { ++ case 2: ++ __asm__ volatile ( ++ "subs %[height], #4 \n\t" ++ "vld1.32 {q0}, [%[src]]! \n\t" ++ "beq 2f \n\t" ++ "1: \n\t" ++ "vld1.32 {q1}, [%[src]]! \n\t" ++ "vst1.32 {d0[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.32 {d0[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.32 {d1[0]}, [%[dst]], %[stride_dst] \n\t" ++ "subs %[height], #4 \n\t" ++ "vst1.32 {d1[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "beq 3f \n\t" ++ "vld1.32 {q0}, [%[src]]! \n\t" ++ "vst1.32 {d2[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.32 {d2[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.32 {d3[0]}, [%[dst]], %[stride_dst] \n\t" ++ "subs %[height], #4 \n\t" ++ "vst1.32 {d3[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "bne 1b \n\t" ++ "2: \n\t" ++ "vst1.32 {d0[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.32 {d0[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.32 {d1[0]}, [%[dst]] \n\t" ++ "vst1.32 {d1[1]}, [%[dst2]] \n\t" ++ "b 4f \n\t" ++ "3: \n\t" ++ "vst1.32 {d2[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.32 {d2[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.32 {d3[0]}, [%[dst]] \n\t" ++ "vst1.32 {d3[1]}, [%[dst2]] \n\t" ++ "4: \n\t" ++ : // Outputs ++ [dst]"+r"(dst), ++ [dst2]"+r"(dst2), ++ [src]"+r"(src), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_dst]"r"(stride_dst) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ case 1: ++ __asm__ volatile ( ++ "subs %[height], #4 \n\t" ++ "vld1.16 {d0}, [%[src]]! \n\t" ++ "beq 2f \n\t" ++ "1: \n\t" ++ "vld1.16 {d2}, [%[src]]! \n\t" ++ "vst1.16 {d0[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.16 {d0[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.16 {d0[2]}, [%[dst]], %[stride_dst] \n\t" ++ "subs %[height], #4 \n\t" ++ "vst1.16 {d0[3]}, [%[dst2]], %[stride_dst] \n\t" ++ "beq 3f \n\t" ++ "vld1.16 {d0}, [%[src]]! \n\t" ++ "vst1.16 {d2[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.16 {d2[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.16 {d2[2]}, [%[dst]], %[stride_dst] \n\t" ++ "subs %[height], #4 \n\t" ++ "vst1.16 {d2[3]}, [%[dst2]], %[stride_dst] \n\t" ++ "bne 1b \n\t" ++ "2: \n\t" ++ "vst1.16 {d0[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.16 {d0[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.16 {d0[2]}, [%[dst]] \n\t" ++ "vst1.16 {d0[3]}, [%[dst2]] \n\t" ++ "b 4f \n\t" ++ "3: \n\t" ++ "vst1.16 {d2[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.16 {d2[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.16 {d2[2]}, [%[dst]] \n\t" ++ "vst1.16 {d2[3]}, [%[dst2]] \n\t" ++ "4: \n\t" ++ : // Outputs ++ [dst]"+r"(dst), ++ [dst2]"+r"(dst2), ++ [src]"+r"(src), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_dst]"r"(stride_dst) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ default: ++ __asm__ volatile ( ++ "subs %[height], #8 \n\t" ++ "vld1.8 {d0}, [%[src]]! \n\t" ++ "beq 2f \n\t" ++ "1: \n\t" ++ "vld1.8 {d2}, [%[src]]! \n\t" ++ "vst1.8 {d0[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d0[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d0[2]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d0[3]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d0[4]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d0[5]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d0[6]}, [%[dst]], %[stride_dst] \n\t" ++ "subs %[height], #8 \n\t" ++ "vst1.8 {d0[7]}, [%[dst2]], %[stride_dst] \n\t" ++ "beq 3f \n\t" ++ "vld1.8 {d0}, [%[src]]! \n\t" ++ "vst1.8 {d2[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d2[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d2[2]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d2[3]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d2[4]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d2[5]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d2[6]}, [%[dst]], %[stride_dst] \n\t" ++ "subs %[height], #8 \n\t" ++ "vst1.8 {d2[7]}, [%[dst2]], %[stride_dst] \n\t" ++ "bne 1b \n\t" ++ "2: \n\t" ++ "vst1.8 {d0[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d0[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d0[2]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d0[3]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d0[4]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d0[5]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d0[6]}, [%[dst]] \n\t" ++ "vst1.8 {d0[7]}, [%[dst2]] \n\t" ++ "b 4f \n\t" ++ "3: \n\t" ++ "vst1.8 {d2[0]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d2[1]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d2[2]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d2[3]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d2[4]}, [%[dst]], %[stride_dst] \n\t" ++ "vst1.8 {d2[5]}, [%[dst2]], %[stride_dst] \n\t" ++ "vst1.8 {d2[6]}, [%[dst]] \n\t" ++ "vst1.8 {d2[7]}, [%[dst2]] \n\t" ++ "4: \n\t" ++ : // Outputs ++ [dst]"+r"(dst), ++ [dst2]"+r"(dst2), ++ [src]"+r"(src), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_dst]"r"(stride_dst) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ } ++} ++ ++static av_noinline void ff_hevc_rpi_copy_vert_v2v_neon(uint8_t *dst, const uint8_t *src, ++ int pixel_shift, int height, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src) ++{ ++ int x, y; ++ switch (pixel_shift) ++ { ++ case 2: ++ __asm__ volatile ( ++ "ldr %[x], [%[src]], %[stride_src] \n\t" ++ "ldr %[y], [%[src]], %[stride_src] \n\t" ++ "str %[x], [%[dst]], %[stride_dst] \n\t" ++ "sub %[height], #2 \n\t" ++ "1: \n\t" ++ "ldr %[x], [%[src]], %[stride_src] \n\t" ++ "str %[y], [%[dst]], %[stride_dst] \n\t" ++ "ldr %[y], [%[src]], %[stride_src] \n\t" ++ "subs %[height], #2 \n\t" ++ "str %[x], [%[dst]], %[stride_dst] \n\t" ++ "bne 1b \n\t" ++ "str %[y], [%[dst]] \n\t" ++ : // Outputs ++ [x]"=&r"(x), ++ [y]"=&r"(y), ++ [src]"+r"(src), ++ [dst]"+r"(dst), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_src]"r"(stride_src), ++ [stride_dst]"r"(stride_dst) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ case 1: ++ __asm__ volatile ( ++ "ldrh %[x], [%[src]], %[stride_src] \n\t" ++ "ldrh %[y], [%[src]], %[stride_src] \n\t" ++ "strh %[x], [%[dst]], %[stride_dst] \n\t" ++ "sub %[height], #2 \n\t" ++ "1: \n\t" ++ "ldrh %[x], [%[src]], %[stride_src] \n\t" ++ "strh %[y], [%[dst]], %[stride_dst] \n\t" ++ "ldrh %[y], [%[src]], %[stride_src] \n\t" ++ "subs %[height], #2 \n\t" ++ "strh %[x], [%[dst]], %[stride_dst] \n\t" ++ "bne 1b \n\t" ++ "strh %[y], [%[dst]] \n\t" ++ : // Outputs ++ [x]"=&r"(x), ++ [y]"=&r"(y), ++ [src]"+r"(src), ++ [dst]"+r"(dst), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_src]"r"(stride_src), ++ [stride_dst]"r"(stride_dst) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ default: ++ __asm__ volatile ( ++ "ldrb %[x], [%[src]], %[stride_src] \n\t" ++ "ldrb %[y], [%[src]], %[stride_src] \n\t" ++ "strb %[x], [%[dst]], %[stride_dst] \n\t" ++ "sub %[height], #2 \n\t" ++ "1: \n\t" ++ "ldrb %[x], [%[src]], %[stride_src] \n\t" ++ "strb %[y], [%[dst]], %[stride_dst] \n\t" ++ "ldrb %[y], [%[src]], %[stride_src] \n\t" ++ "subs %[height], #2 \n\t" ++ "strb %[x], [%[dst]], %[stride_dst] \n\t" ++ "bne 1b \n\t" ++ "strb %[y], [%[dst]] \n\t" ++ : // Outputs ++ [x]"=&r"(x), ++ [y]"=&r"(y), ++ [src]"+r"(src), ++ [dst]"+r"(dst), ++ [height]"+r"(height) ++ : // Inputs ++ [stride_src]"r"(stride_src), ++ [stride_dst]"r"(stride_dst) ++ : // Clobbers ++ "cc", "memory" ++ ); ++ break; ++ } ++} ++ ++#define ff_hevc_rpi_copy_vert ff_hevc_rpi_copy_vert_neon ++static inline void ff_hevc_rpi_copy_vert_neon(uint8_t *dst, const uint8_t *src, ++ int pixel_shift, int height, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src) ++{ ++ if (stride_dst == 1 << pixel_shift) ++ ff_hevc_rpi_copy_vert_v2h_neon(dst, src, pixel_shift, height, stride_src); ++ else if (stride_src == 1 << pixel_shift) ++ ff_hevc_rpi_copy_vert_h2v_neon(dst, src, pixel_shift, height, stride_dst); ++ else ++ ff_hevc_rpi_copy_vert_v2v_neon(dst, src, pixel_shift, height, stride_dst, stride_src); ++} ++ ++#endif /* HAVE_NEON_INLINE */ ++ ++#endif /* AVCODEC_ARM_RPI_HEVC_MISC_H */ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevc_mv_arm.h +@@ -0,0 +1,93 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Written by John Cox, Ben Avison ++*/ ++ ++#ifndef AVCODEC_ARM_RPI_HEVC_MV_H ++#define AVCODEC_ARM_RPI_HEVC_MV_H ++ ++#if HAVE_ARMV6T2_INLINE ++static inline MvXY mvxy_add_arm(const MvXY a, const MvXY b) ++{ ++ MvXY r; ++ __asm__ ( ++ "sadd16 %[r], %[a], %[b] \n\t" ++ : [r]"=r"(r) ++ : [a]"r"(a), ++ [b]"r"(b) ++ : ++ ); ++ return r; ++} ++#define mvxy_add mvxy_add_arm ++#endif ++ ++#if HAVE_ARMV6T2_INLINE ++#if (defined(__ARM_ARCH_EXT_IDIV__) || defined (__ARM_FEATURE_IDIV)) ++static inline int32_t mv_scale_xy_arm(int32_t xy, int td, int tb) ++{ ++ int t; ++ __asm__ ( ++ "ssat %[td], #8, %[td] \n\t" ++ "ssat %[tb], #8, %[tb] \n\t" ++ "eor %[t], %[td], %[td], asr #31 \n\t" ++ "adds %[t], %[t], %[td], lsr #31 \n\t" ++ "asr %[t], #1 \n\t" ++ "add %[t], #0x4000 \n\t" ++ "it ne \n\t" ++ "sdivne %[t], %[t], %[td] \n\t" ++ "mov %[td], #32 \n\t" ++ "smlabb %[td], %[t], %[tb], %[td] \n\t" ++ "ssat %[td], #13, %[td], asr #6 \n\t" ++ "mov %[tb], #127 \n\t" ++ "smlatb %[t], %[xy], %[td], %[tb] \n\t" ++ "smlabb %[tb], %[xy], %[td], %[tb] \n\t" ++// This takes the sign of x & y for rounding at the "wrong" point ++// (i.e. after adding 127) but for the range of values (-1,-127) ++// where it does the wrong thing you get the right answer (0) anyway ++ "add %[t], %[t], %[t], lsr #31 \n\t" ++ "add %[xy], %[tb], %[tb], lsr #31 \n\t" ++ "ssat %[t], #16, %[t], asr #8 \n\t" ++ "ssat %[xy], #16, %[xy], asr #8 \n\t" ++ "pkhbt %[xy], %[xy], %[t], lsl #16 \n\t" ++ : ++ [t]"=&r"(t), ++ [xy]"+r"(xy), ++ [td]"+r"(td), ++ [tb]"+r"(tb) ++ : ++ : ++ "cc" ++ ); ++ return xy; ++} ++#define mv_scale_xy mv_scale_xy_arm ++#endif ++#endif ++ ++#endif // AVCODEC_ARM_RPI_HEVC_MV_H ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcdsp_arm.h +@@ -0,0 +1,26 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_ARM_HEVCDSP_ARM_H ++#define AVCODEC_ARM_HEVCDSP_ARM_H ++ ++#include "libavcodec/rpi_hevcdsp.h" ++ ++void ff_hevcdsp_rpi_init_neon(HEVCDSPContext *c, const int bit_depth); ++ ++#endif /* AVCODEC_ARM_HEVCDSP_ARM_H */ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcdsp_deblock_neon.S +@@ -0,0 +1,1634 @@ ++/* ++ * Copyright (c) 2014 Seppo Tomperi ++ * Copyright (C) 2018 John Cox, Ben Avison for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1 ++ */ ++ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++.macro hevc_loop_filter_uv_body1 P1a, P0a, Q0a, Q1a, I1, I2, I3, I4, I5, I6, I7, I8 ++ vsubl.u8 q0, \Q0a, \P0a ++ vsubl.u8 q1, \P1a, \Q1a ++ vdup.16 d4, r2 ++ \I1 ++ vshl.i16 q0, #2 ++ \I2 ++ vadd.i16 q0, q1 ++ \I3 ++ vmovl.u8 q2, d4 ++ \I4 ++ vneg.s16 q1, q2 ++ \I5 ++ vrshr.s16 q0, #3 ++ \I6 ++ \I7 ++ \I8 ++ vmin.s16 q0, q2 ++ vmovl.u8 q2, \Q0a ++ vmax.s16 q0, q1 ++ vaddw.u8 q1, q0, \P0a ++ vsub.i16 q0, q2, q0 ++ vqmovun.s16 \P0a, q1 ++ vqmovun.s16 \Q0a, q0 ++.endm ++ ++ ++.macro hevc_loop_filter_uv_body2 P1a, P1b, P0a, P0b, Q0a, Q0b, Q1a, Q1b, I1, I2, I3, I4, I5, I6, I7 ++ vsubl.u8 q0, \Q0a, \P0a @ q0a - p0a ++ lsr r12, r2, #16 ++ vsubl.u8 q1, \Q0b, \P0b @ q0b - p0b ++ vsubl.u8 q2, \P1a, \Q1a @ p1a - q1a ++ vsubl.u8 q3, \P1b, \Q1b @ p1b - q1b ++ vshl.i16 q0, #2 @ (q0a - p0a) * 4 ++ vshl.i16 q1, #2 @ (q0b - p0b) * 4 ++ vadd.i16 q0, q2 @ ((q0a - p0a) * 4) + p1a - q1a ++ vadd.i16 q1, q3 @ ((q0b - p0b) * 4) + p1b - q1b ++ vdup.16 d4, r2 @ tc0a, tc0b ++ vdup.16 d6, r12 @ tc1a, tc1b ++ vrshr.s16 q0, #3 @ (((q0a - p0a) * 4) + p1a - q1a + 4) >> 3 ++ \I1 ++ vrshr.s16 q1, #3 @ (((q0b - p0b) * 4) + p1b - q1b + 4) >> 3 ++ \I2 ++ vmovl.u8 q2, d4 @ tc0a, tc0b ++ \I3 ++ vmovl.u8 q3, d6 @ tc1a, tc1b ++ \I4 ++ vmin.s16 q0, q2 ++ \I5 ++ vneg.s16 q2, q2 @ -tc0a, -tc0b ++ \I6 ++ vmin.s16 q1, q3 ++ \I7 ++ vneg.s16 q3, q3 @ -tc1a, -tc1b ++ vmax.s16 q0, q2 @ delta0a ++ vmovl.u8 q2, \Q0a ++ vmax.s16 q1, q3 @ delta0b ++ vaddw.u8 q3, q0, \P0a @ p0a + delta0a ++ vsub.i16 q0, q2, q0 @ q0a - delta0a ++ vmovl.u8 q2, \Q0b ++ vsub.i16 q2, q1 @ q0b - delta0b ++ vaddw.u8 q1, \P0b @ p0b + delta0b ++ vqmovun.s16 \Q0a, q0 ++ vqmovun.s16 \P0a, q3 ++ vqmovun.s16 \Q0b, q2 ++ vqmovun.s16 \P0b, q1 ++.endm ++ ++ ++@ Preserves r12 ++@ Clobbers r2 ++@ P0a et al all contain UVUVUVUV ++@ r2 (tc4) contains ++@ [0..7] tc U a ++@ [8..15] tc V a ++ ++.macro hevc_loop_filter_uv_body1_16 P1a, P0a, Q0a, Q1a, bit_depth, I1, I2, I3, I4, I5, I6, I7, I8 ++ vsub.i16 q0, \Q0a, \P0a ++ vsub.i16 q1, \P1a, \Q1a ++ vdup.16 d4, r2 ++ \I1 ++ vshl.i16 q0, #2 ++ \I2 ++ vadd.i16 q0, q1 ++ \I3 ++ vshll.u8 q2, d4, #\bit_depth - 8 ++ \I4 ++ vneg.s16 q1, q2 ++ \I5 ++ vrshr.s16 q0, #3 ++ \I6 ++ \I7 ++ \I8 ++ vmin.s16 q0, q2 ++ vmov.i16 q2, #0 ++ vmax.s16 q0, q1 ++ vadd.i16 \P0a, q0 ++ vsub.i16 \Q0a, q0 ++ vmov.i16 q1, #(1 << \bit_depth) - 1 ++ vmax.s16 \P0a, q2 ++ vmax.s16 \Q0a, q2 ++ vmin.s16 \P0a, q1 ++ vmin.s16 \Q0a, q1 ++.endm ++ ++@ Clobbers r2, r12 ++@ P0a et al all contain UVUVUVUV ++@ r2 (tc4) contains ++@ [0..7] tc U a ++@ [8..15] tc V a ++@ [16..23] tc U b ++@ [24..31] tc V b ++ ++.macro hevc_loop_filter_uv_body2_16 P1a, P1b, P0a, P0b, Q0a, Q0b, Q1a, Q1b, bit_depth, I1, I2, I3, I4, I5, I6, I7 ++ vsub.i16 q0, \Q0a, \P0a @ q0a - p0a ++ lsr r12, r2, #16 ++ vsub.i16 q1, \Q0b, \P0b @ q0b - p0b ++ vsub.i16 q2, \P1a, \Q1a @ p1a - q1a ++ vsub.i16 q3, \P1b, \Q1b @ p1b - q1b ++ vshl.i16 q0, #2 @ (q0a - p0a) * 4 ++ vshl.i16 q1, #2 @ (q0b - p0b) * 4 ++ vadd.i16 q0, q2 @ ((q0a - p0a) * 4) + p1a - q1a ++ vadd.i16 q1, q3 @ ((q0b - p0b) * 4) + p1b - q1b ++ vdup.16 d4, r2 @ tc0a, tc0b ++ vdup.16 d6, r12 @ tc1a, tc1b ++ vrshr.s16 q0, #3 @ (((q0a - p0a) * 4) + p1a - q1a + 4) >> 3 ++ \I1 ++ vrshr.s16 q1, #3 @ (((q0b - p0b) * 4) + p1b - q1b + 4) >> 3 ++ \I2 ++ vshll.u8 q2, d4, #\bit_depth - 8 @ tc0a, tc0b ++ \I3 ++ vshll.u8 q3, d6, #\bit_depth - 8 @ tc1a, tc1b ++ \I4 ++ vmin.s16 q0, q2 ++ \I5 ++ vneg.s16 q2, q2 @ -tc0a, -tc0b ++ \I6 ++ vmin.s16 q1, q3 ++ \I7 ++ vneg.s16 q3, q3 @ -tc1a, -tc1b ++ vmax.s16 q0, q2 @ delta0a ++ vadd.i16 \P0a, q0 @ p0a + delta0a ++ vsub.i16 \Q0a, q0 @ q0a - delta0a ++ vmax.s16 q1, q3 @ delta0b ++ vadd.i16 \P0b, q1 @ p0b + delta0b ++ vsub.i16 \Q0b, q1 @ q0b - delta0b ++ vmov.i16 q2, #0 ++ vmov.i16 q3, #(1 << \bit_depth) - 1 ++ vmax.s16 \P0a, q2 ++ vmax.s16 \Q0a, q2 ++ vmax.s16 \P0b, q2 ++ vmax.s16 \Q0b, q2 ++ vmin.s16 \P0a, q3 ++ vmin.s16 \Q0a, q3 ++ vmin.s16 \P0b, q3 ++ vmin.s16 \Q0b, q3 ++.endm ++ ++ ++ ++@ uint8_t *_no_p, [sp+0] ++@ uint8_t *_no_q) [sp+4] ++ ++.macro hevc_loop_filter_luma_start ++ ldr r12, [r3] ++ ldr r3, [r3, #4] ++ orrs r3, r12, r3, lsl #16 ++ it eq ++ bxeq lr ++ push {r4-r10,lr} @ 32 bytes ++ ldrd r4, r5, [sp, #32] @ &_no_p ++ ldrb r4, [r4] ++ ldrb r5, [r5] ++ movs r10, r4 ++ it ne ++ movne r10, #1 ++ cmp r5, #0 ++ it ne ++ orrne r10, #2 ++.endm ++ ++@ Input: ++@ r2 beta (raw: needs shift for bitdepth > 8) ++@ r3[ 0:15] tc[0] (raw: needs shift for bitdepth > 8) ++@ r3[16:31] tc[1] (raw: needs shift for bitdepth > 8) ++@ ++@ Input & output ++@ 8-bit: d16-d23 (Q3,Q2,Q1,Q0,P0,P1,P2,P3) ++@ 16-bit: q8-q15 ++@ ++@ r1 -r1 ++@ r10 b1->C, b0->N (r10 junk) ++@ ++@ Junks: ++@ r5, r6, r7, r8, r9 ++ ++.macro m_filter_luma bit_depth, Q11, Q15 ++.if \bit_depth == 8 ++ vmovl.u8 q14, d22 @ q2,7 q2,6 ... q2,0 = TQ2' ... Q2' TQ2 ... Q2 ++ vmovl.u8 q13, d21 @ q1,7 q1,6 ... q1,0 = TQ1' ... Q1' TQ1 ... Q1 ++ vmovl.u8 q12, d20 @ q0,7 q0,6 ... q0,0 = TQ0' ... Q0' TQ0 ... Q0 ++ vmovl.u8 \Q11, d19 @ p0,7 p0,6 ... p0,0 = TP0' ... P0' TP0 ... P0 ++ vmovl.u8 q10, d18 @ p1,7 p1,6 ... p1,0 = TP1' ... P1' TP1 ... P1 ++ vmovl.u8 q9, d17 @ p2,7 p2,6 ... p2,0 = TP2' ... P2' TP2 ... P2 ++.endif ++ vadd.i16 q0, q9, \Q11 @ P2 + P0 ++.if \bit_depth > 8 ++ lsl r3, r3, #(\bit_depth - 8) ++.endif ++ vadd.i16 q1, q14, q12 @ Q2 + Q0 ++.if \bit_depth > 8 ++ lsl r2, r2, #(\bit_depth - 8) ++.endif ++ vsub.i16 q0, q10 @ P2 - P1 + P0 ++ lsr r5, r3, #16 ++ vsub.i16 q1, q13 @ Q2 - Q1 + Q0 ++.if \bit_depth == 8 ++ vmovl.u8 q8, d16 @ p3,7 p3,6 ... p3,0 = TP3' ... P3' TP3 ... P3 ++ vmovl.u8 \Q15, d23 @ q3,7 q3,6 ... q3,0 = TQ3' ... Q3' TQ3 ... Q3 ++.endif ++ vabd.s16 q0, q10 @ dp0 = abs(P2 - 2 * P1 + P0) ++ vabd.s16 q1, q13 @ dq0 = abs(Q2 - 2 * Q1 + Q0) ++ vmov.i64 q2, #0xffffffff0000 ++ vbic q0, q2 @ only dp0(') and dp3(') ++ vbic q1, q2 @ only dq0(') and dq3(') ++ vsra.u64 q0, #16 ++ vsra.u64 q1, #16 ++ vdup.16 q3, r2 @ beta ++ vdup.16 d14, r3 @ tC[0] ++ vdup.16 d15, r5 @ tC[1] ++ vabd.s16 q4, q8, \Q11 @ abs(TP3'-TP0' ... P3'-P0' TP3-TP0 ... P3-P0) ++ vmovn.i32 d0, q0 @ dp3' dp0' dp3 dp0 ++ vmovn.i32 d1, q1 @ dq3' dq0' dq3 dq0 ++ vadd.i16 d5, d0, d1 @ d3'=dp3'+dq3' d0'=dp0'+dq0' d3=dp3+dq3 d0=dp0+dq0 ++ vabd.s16 q5, \Q11, q12 @ abs(TP0'-TQ0' ... P0'-Q0' TP0-TQ0 ... P0-Q0) ++ vaba.s16 q4, \Q15, q12 @ +abs(TQ3'-TQ0' ... Q3'-Q0' TQ3-TQ0 ... Q3-Q0) ++ vpadd.i16 d2, d5, d5 @ dontcare dontcare d0'+d3' d0+d3 ++ vshl.s16 q6, q7, #2 @ tC[] * 4 ++ vrhadd.s16 q6, q7 @ tc25 = (tc[] * 5 + 1) >> 1 ++ vcgt.s16 d2, d6, d2 @ if (d0 + d3 < beta) ++ vmov r7, s4 @ (d2) r7 = mask of blocks to apply filtering (16b/block) ++ vshr.s16 q1, q3, #3 @ beta_3 = beta >> 3 ++ cmp r7, #0 ++ beq .Lbypasswrite ++ ++ vcgt.s16 q5, q6, q5 @ if < tc25 ++ vcgt.s16 q4, q1, q4 @ if (abs({T}P[0-3]{'}-{T}P[0-3]{'})+abs({T}Q[0-3]{'}-{T}Q[0-3]{'}) < beta_3) ++ vand q4, q5 ++ vbic d8, d4 ++ vbic d9, d4 ++ vshr.s16 q3, #2 @ beta_2 = beta >> 2 ++ vsra.u64 q4, #16 ++ vshl.s16 d5, #1 @ d3'<<1 d0'<<1 d3<<1 d0<<1 ++ vshl.i16 q7, #1 @ tc2 = tC[] << 1 ++ vcgt.s16 d6, d5 @ if (d3'<<1 < beta_2) etc ++ vmovn.i32 d8, q4 @ beta_3 && tc25 tests, prime block in ms half ++ vand d6, d8 @ && beta_2 tests, prime in ms half ++ vpadd.i16 d0, d1 @ dq0'+dq3' dq0+dq3 dp0'+dp3' dp0+dp3 ++ vneg.s16 q6, q7 @ -tc2 ++ vmovn.i32 d8, q3 ++ vshrn.i32 d6, q3, #16 ++ vand d6, d8 ++ vmov r5, r6, d0 @ r5 = dp0'+dp3' dp0+dp3 r6 = dq0'+dq3' dq0+dq3 ++ vmov r8, s12 @ (d6) r8 = mask of strong filtering blocks (16b/block) ++ vadd.i16 q0, \Q11, q12 @ p0 + q0 ++ ands r9, r7, r8 ++ beq 1f ++ ++ vadd.i16 q2, q0, q10 @ p1 + p0 + q0 ++ vadd.i16 q3, q0, q13 @ p0 + q0 + q1 ++ lsr r3, r9, #16 ++ vadd.i16 q1, q2, q9 @ p2 + p1 + p0 + q0 (new P1 before clipping) ++ vadd.i16 q4, q3, q14 @ p0 + q0 + q1 + q2 (new Q1 before clipping) ++ vadd.i16 q0, q8, q9 @ p3 + p2 ++ vadd.i16 q5, \Q15, q14 @ q2 + q3 ++ vadd.i16 q2, q1 @ p2 + 2 * p1 + 2 * p0 + 2 * q0 ++ vadd.i16 q3, q4 @ 2 * p0 + 2 * q0 + 2 * q1 + q2 ++ vshl.i16 q0, #1 @ 2 * p3 + 2 * p2 ++ vshl.i16 q5, #1 @ 2 * q2 + 2 * q3 ++ vadd.i16 q0, q1 @ 2 * p3 + 3 * p2 + p1 + p0 + q0 (new P2 before clipping) ++ vadd.i16 q5, q4 @ p0 + q0 + q1 + 3 * q2 + 2 * q3 (new Q2 before clipping) ++ vadd.i16 q2, q13 @ p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 (new P0 before clipping) ++ vadd.i16 q3, q10 @ p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 (new Q0 before clipping) ++ vrshr.s16 q0, #3 @ scale, with rounding ++ vrshr.s16 q5, #3 ++ vrshr.s16 q1, #2 ++ vrshr.s16 q4, #2 ++ vrshr.s16 q2, #3 ++ vrshr.s16 q3, #3 ++ vsub.i16 q0, q9 @ find difference ++ vsub.i16 q5, q14 ++ vsub.i16 q1, q10 ++ vsub.i16 q4, q13 ++ vsub.i16 q2, \Q11 ++ vsub.i16 q3, q12 ++ vmax.s16 q0, q6 @ clip difference to -tc2 .. tc2 ++ vmax.s16 q5, q6 ++ vmax.s16 q1, q6 ++ vmax.s16 q4, q6 ++ vmax.s16 q2, q6 ++ vmax.s16 q3, q6 ++ vdup.16 d12, r9 @ expand mask, reuse q6 due to register pressure ++ vdup.16 d13, r3 ++ vmin.s16 q0, q7 ++ vmin.s16 q5, q7 ++ vmin.s16 q1, q7 ++ vmin.s16 q4, q7 ++ vmin.s16 q2, q7 ++ vmin.s16 q3, q7 ++ vadd.i16 q0, q9 @ apply difference ++ vadd.i16 q5, q14 ++ vadd.i16 q1, q10 ++ vadd.i16 q4, q13 ++ vadd.i16 q2, \Q11 ++ vadd.i16 q3, q12 ++ vbit q9, q0, q6 @ apply filtered values according to mask ++ vbit q14, q5, q6 ++ vbit q10, q1, q6 ++ vbit q13, q4, q6 ++ vbit \Q11, q2, q6 ++ vbit q12, q3, q6 ++ vneg.s16 q6, q7 @ restore -tc2 ++ ++1: ++ bics r9, r7, r8 ++ beq 2f ++ ++ vsub.i16 q0, q12, \Q11 @ q0 - p0 ++ vsub.i16 q1, q13, q10 @ q1 - p1 ++ lsr r3, r9, #16 ++ vshl.i16 q2, q0, #3 ++ lsr r7, r5, #16 ++ vadd.i16 q3, q0, q2 @ 9 * (q0 - p0) ++ lsr r8, r6, #16 ++ vshl.i16 q2, q1, #1 ++ vadd.i16 q4, q1, q2 @ 3 * (q1 - p1) ++ vshr.s16 q6, #1 @ -tc = -tc2 >> 1 ++ vsub.i16 q5, q3, q4 ++ vrhadd.s16 q1, q9, \Q11 @ (p2 + p0 + 1) >> 1 ++ vrhadd.s16 q3, q14, q12 @ (q2 + q0 + 1) >> 1 ++ vrshr.s16 q5, #4 @ delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4 ++ vsub.i16 q1, q10 @ ((p2 + p0 + 1) >> 1) - p1 ++ vsub.i16 q3, q13 @ ((q2 + q0 + 1) >> 1) - q1 ++ vmax.s16 q6, q5 @ ++ vshr.s16 q4, q7, #1 @ tc = tc2 >> 1 ++ vdup.16 q0, r2 @ beta ++ vmin.s16 q6, q4 @ delta0 clamped to [-tc, tc] ++ vshr.s16 q4, #1 @ tc_2 = tc >> 1 ++ vhadd.s16 q1, q6 @ (((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1 ++ vhsub.s16 q3, q6 @ (((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1 ++ vshr.s16 q2, q0, #1 @ beta >> 1 ++ vadd.i16 q2, q0 @ beta + (beta >> 1) ++ vneg.s16 q0, q4 @ -tc_2 ++ vabs.s16 q5, q5 @ abs(original delta0) ++ vshr.s16 q2, #3 @ (beta + (beta >> 1)) >> 3 ++ vmax.s16 q1, q0 ++ vmax.s16 q3, q0 ++ vshl.s16 q0, q7, #2 @ 8 * tc ++ vadd.i16 q7, q0 @ 10 * tc ++ vdup.16 d0, r9 ++ vdup.16 d1, r3 @ q0 = mask of blocks to apply filtering ++ vmin.s16 q1, q4 @ deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2) ++ vmin.s16 q3, q4 @ deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 + delta0) >> 1, -tc_2, tc_2) ++ vdup.16 d8, r5 @ dp0 + dp3 ++ vdup.16 d9, r7 @ dp0' + dp3' ++ vcgt.s16 q7, q5 @ if ((10 * tc) > abs(delta0)) ++ vdup.16 d10, r6 @ dq0 + dq3 ++ vdup.16 d11, r8 @ dq0' + dq3' ++ vand q7, q0 @ AND block and line masks ++ vcgt.s16 q4, q2, q4 @ if (((beta + (beta >> 1)) >> 3) > dp0 + dp3), i.e. if (nd_p > 1) ++ vadd.i16 q0, q1, q10 @ p1 + deltap1 ++ vcgt.s16 q5, q2, q5 @ if (((beta + (beta >> 1)) >> 3) > dq0 + dq3), i.e. if (nd_q > 1) ++ vadd.i16 q3, q3, q13 @ q1 + deltaq1 ++ vadd.i16 q1, \Q11, q6 @ p0 + delta0 ++ vsub.i16 q2, q12, q6 @ q0 - delta0 ++ vand q4, q7 @ AND nd_p test with block/line masks ++ vand q5, q7 @ AND nd_q test with block/line masks ++ vbit q10, q0, q4 ++ vbit \Q11, q1, q7 ++ vbit q12, q2, q7 ++ vbit q13, q3, q5 ++ ++2: ++.if \bit_depth == 8 ++ vmovn.i16 d16, q8 ++ vmovn.i16 d23, \Q15 ++ neg r1, r1 ++ vqmovun.s16 d17, q9 ++ vqmovun.s16 d18, q10 ++ vqmovun.s16 d19, \Q11 ++ lsls r10, #31 ++ vqmovun.s16 d20, q12 ++ vqmovun.s16 d21, q13 ++ vqmovun.s16 d22, q14 ++.else ++ vmov.i16 q0, #0 ++ vmov.i16 q1, #(1 << \bit_depth - 1) ++ @ q8 & q15 should be unaltered and so don't require clipping ++ neg r1, r1 ++ vmax.s16 q9, q0 ++ vmax.s16 q10, q0 ++ vmax.s16 q11, q0 ++ vmax.s16 q12, q0 ++ vmax.s16 q13, q0 ++ vmax.s16 q14, q0 ++ lsls r10, #31 ++ vmin.s16 q9, q1 ++ vmin.s16 q10, q1 ++ vmin.s16 q11, q1 ++ vmin.s16 q12, q1 ++ vmin.s16 q13, q1 ++ vmin.s16 q14, q1 ++.endif ++ bx lr ++.endm ++ ++function hevc_loop_filter_luma_body ++ m_filter_luma 8, q15, q11 ++endfunc ++ ++@ void ff_hevc_rpi_v_loop_filter_luma_neon_8( ++@ uint8_t *_pix, [r0] ++@ ptrdiff_t _stride, [r1] ++@ int _beta, [r2] ++@ int *_tc, [r3] ++@ uint8_t *_no_p, [sp+0] ++@ uint8_t *_no_q) [sp+4] ++ ++function ff_hevc_rpi_v_loop_filter_luma_neon_8, export=1 ++ hevc_loop_filter_luma_start ++ ++ sub r4, r0, #4 ++ b .Lv_loop_luma_common ++endfunc ++ ++@ void ff_hevc_rpi_v_loop_filter2_luma_neon( ++@ uint8_t * pix_r, [r0] ++@ ptrdiff_t _stride, [r1] ++@ int _beta, [r2] ++@ int tc2, [r3] ++@ int no_f, [sp+0] ++@ uint8_t * pix_l) [sp+4] ++ ++function ff_hevc_rpi_v_loop_filter_luma2_neon_8, export=1 ++ cmp r3, #0 ++ it eq ++ bxeq lr ++ push {r4-r10,lr} @ 32 bytes ++ ldr r4, [sp, #36] ++ ldr r10, [sp, #32] ++ ++.Lv_loop_luma_common: ++ vpush {d8-d15} ++ ++ @ It's slightly faster to do unlaned loads and transpose in the ++ @ 8-bit case, even though it needs more instructions, because ++ @ VLD4.8 is a really slow way to read from memory. ++ vld1.32 {d16[0]}, [r4:32], r1 ++ vld1.32 {d20[0]}, [r0:32], r1 ++ vld1.32 {d16[1]}, [r4:32], r1 ++ vld1.32 {d20[1]}, [r0:32], r1 ++ vld1.32 {d17[0]}, [r4:32], r1 ++ vld1.32 {d21[0]}, [r0:32], r1 ++ vld1.32 {d17[1]}, [r4:32], r1 ++ vld1.32 {d21[1]}, [r0:32], r1 ++ vld1.32 {d18[0]}, [r4:32], r1 ++ vld1.32 {d22[0]}, [r0:32], r1 ++ vld1.32 {d18[1]}, [r4:32], r1 ++ vld1.32 {d22[1]}, [r0:32], r1 ++ vld1.32 {d19[0]}, [r4:32], r1 ++ vld1.32 {d23[0]}, [r0:32], r1 ++ vld1.32 {d19[1]}, [r4:32] ++ vld1.32 {d23[1]}, [r0:32] ++ vuzp.16 q8, q9 ++ vuzp.16 q10, q11 ++ vuzp.8 q8, q9 ++ vuzp.8 q10, q11 ++ vswp d17, d18 ++ vswp d21, d22 ++ ++ bl hevc_loop_filter_luma_body ++ ++ add r6, r4, r1 ++ add r2, r0, r1 ++ lsl r1, #1 ++ ++ vpop {d8-d15} ++ ++ @ no_p[1] ++ bmi 1f ++ vst4.8 {d16[7],d17[7],d18[7],d19[7]}, [r4:32], r1 ++ vst4.8 {d16[6],d17[6],d18[6],d19[6]}, [r6:32], r1 ++ vst4.8 {d16[5],d17[5],d18[5],d19[5]}, [r4:32], r1 ++ vst4.8 {d16[4],d17[4],d18[4],d19[4]}, [r6:32], r1 ++ ++ vst4.8 {d16[3],d17[3],d18[3],d19[3]}, [r4:32], r1 ++ vst4.8 {d16[2],d17[2],d18[2],d19[2]}, [r6:32], r1 ++ vst4.8 {d16[1],d17[1],d18[1],d19[1]}, [r4:32], r1 ++ vst4.8 {d16[0],d17[0],d18[0],d19[0]}, [r6:32] ++1: ++ @ no_q[1] ++ bcs 1f ++ vst4.8 {d20[7],d21[7],d22[7],d23[7]}, [r0:32], r1 ++ vst4.8 {d20[6],d21[6],d22[6],d23[6]}, [r2:32], r1 ++ vst4.8 {d20[5],d21[5],d22[5],d23[5]}, [r0:32], r1 ++ vst4.8 {d20[4],d21[4],d22[4],d23[4]}, [r2:32], r1 ++ ++ vst4.8 {d20[3],d21[3],d22[3],d23[3]}, [r0:32], r1 ++ vst4.8 {d20[2],d21[2],d22[2],d23[2]}, [r2:32], r1 ++ vst4.8 {d20[1],d21[1],d22[1],d23[1]}, [r0:32], r1 ++ vst4.8 {d20[0],d21[0],d22[0],d23[0]}, [r2:32] ++1: ++ pop {r4-r10,pc} ++ ++.Lbypasswrite: ++ vpop {d8-d15} ++ pop {r4-r10,pc} ++endfunc ++ ++.macro m_filter_v_luma_16 bit_depth ++ vpush {d8-d15} ++ ++ @ Uses slightly fewer instructions to do laned loads than unlaned ++ @ and transpose. This also means that we can use the same code for ++ @ both split & unsplit deblock ++ vld4.16 {d16[0], d18[0], d20[0], d22[0]}, [r4], r1 ++ vld4.16 {d24[0], d26[0], d28[0], d30[0]}, [r0], r1 ++ ++ vld4.16 {d16[1], d18[1], d20[1], d22[1]}, [r4], r1 ++ vld4.16 {d24[1], d26[1], d28[1], d30[1]}, [r0], r1 ++ ++ vld4.16 {d16[2], d18[2], d20[2], d22[2]}, [r4], r1 ++ vld4.16 {d24[2], d26[2], d28[2], d30[2]}, [r0], r1 ++ ++ vld4.16 {d16[3], d18[3], d20[3], d22[3]}, [r4], r1 ++ vld4.16 {d24[3], d26[3], d28[3], d30[3]}, [r0], r1 ++ ++ vld4.16 {d17[0], d19[0], d21[0], d23[0]}, [r4], r1 ++ vld4.16 {d25[0], d27[0], d29[0], d31[0]}, [r0], r1 ++ ++ vld4.16 {d17[1], d19[1], d21[1], d23[1]}, [r4], r1 ++ vld4.16 {d25[1], d27[1], d29[1], d31[1]}, [r0], r1 ++ ++ vld4.16 {d17[2], d19[2], d21[2], d23[2]}, [r4], r1 ++ vld4.16 {d25[2], d27[2], d29[2], d31[2]}, [r0], r1 ++ ++ vld4.16 {d17[3], d19[3], d21[3], d23[3]}, [r4] ++ vld4.16 {d25[3], d27[3], d29[3], d31[3]}, [r0] ++ ++ bl hevc_loop_filter_luma_body_\bit_depth ++ ++ add r6, r4, r1 ++ add r2, r0, r1 ++ lsl r1, #1 ++ ++ vpop {d8-d15} ++ ++ @ p[1] ++ bmi 1f ++ vst4.16 {d17[3], d19[3], d21[3], d23[3]}, [r4], r1 ++ vst4.16 {d17[2], d19[2], d21[2], d23[2]}, [r6], r1 ++ vst4.16 {d17[1], d19[1], d21[1], d23[1]}, [r4], r1 ++ vst4.16 {d17[0], d19[0], d21[0], d23[0]}, [r6], r1 ++ vst4.16 {d16[3], d18[3], d20[3], d22[3]}, [r4], r1 ++ vst4.16 {d16[2], d18[2], d20[2], d22[2]}, [r6], r1 ++ vst4.16 {d16[1], d18[1], d20[1], d22[1]}, [r4], r1 ++ vst4.16 {d16[0], d18[0], d20[0], d22[0]}, [r6] ++1: ++ @ q[1] ++ bcs 1f ++ vst4.16 {d25[3], d27[3], d29[3], d31[3]}, [r0], r1 ++ vst4.16 {d25[2], d27[2], d29[2], d31[2]}, [r2], r1 ++ vst4.16 {d25[1], d27[1], d29[1], d31[1]}, [r0], r1 ++ vst4.16 {d25[0], d27[0], d29[0], d31[0]}, [r2], r1 ++ vst4.16 {d24[3], d26[3], d28[3], d30[3]}, [r0], r1 ++ vst4.16 {d24[2], d26[2], d28[2], d30[2]}, [r2], r1 ++ vst4.16 {d24[1], d26[1], d28[1], d30[1]}, [r0], r1 ++ vst4.16 {d24[0], d26[0], d28[0], d30[0]}, [r2] ++1: ++ pop {r4-r10,pc} ++.endm ++ ++ ++ ++ ++@ void (*hevc_h_loop_filter_luma)(uint8_t *pix, [r0] ++@ ptrdiff_t stride, [r1] ++@ int beta, [r2] ++@ int32_t *tc, [r3] ++@ uint8_t *no_p, sp[0] ++@ uint8_t *no_q); sp[4] ++@ ++@ Src should always be on 8 byte boundry & all in the same slice ++ ++function ff_hevc_rpi_h_loop_filter_luma_neon_8, export=1 ++ hevc_loop_filter_luma_start ++ b .Lh_loop_filter_luma_common_8 ++endfunc ++ ++function ff_hevc_rpi_h_loop_filter_luma2_neon_8, export=1 ++ cmp r3, #0 ++ it eq ++ bxeq lr ++ push {r4-r10,lr} @ 32 bytes ++ ldr r10, [sp, #32] ++ ++.Lh_loop_filter_luma_common_8: ++ sub r4, r0, r1, lsl #2 ++ add r0, r4, r1 ++ lsl r1, #1 ++ vpush {d8-d15} ++ ++ vld1.8 {d16}, [r4], r1 ++ vld1.8 {d17}, [r0], r1 ++ vld1.8 {d18}, [r4], r1 ++ vld1.8 {d19}, [r0], r1 ++ vld1.8 {d20}, [r4], r1 ++ vld1.8 {d21}, [r0], r1 ++ vld1.8 {d22}, [r4] ++ vld1.8 {d23}, [r0] ++ ++ bl hevc_loop_filter_luma_body ++ ++ add r0, r0, r1, lsl #1 ++ add r2, r4, r1, lsl #1 ++ add r6, r4, r1, asr #1 ++ vpop {d8-d15} ++ ++ @ P2-P0 ++ bcs 1f ++ vst1.8 {d22}, [r4], r1 ++ vst1.8 {d21}, [r6] ++ vst1.8 {d20}, [r4] ++1: ++ @ Q0-Q2 ++ bmi 1f ++ vst1.8 {d19}, [r0], r1 ++ vst1.8 {d18}, [r2] ++ vst1.8 {d17}, [r0] ++1: ++ pop {r4-r10,pc} ++endfunc ++ ++ ++.macro m_filter_h_luma_16 bit_depth ++ sub r4, r0, r1, lsl #2 ++ add r0, r4, r1 ++ lsl r1, #1 ++ vpush {d8-d15} ++ ++ vld1.16 { q8}, [r4], r1 ++ vld1.16 { q9}, [r0], r1 ++ vld1.16 {q10}, [r4], r1 ++ vld1.16 {q11}, [r0], r1 ++ vld1.16 {q12}, [r4], r1 ++ vld1.16 {q13}, [r0], r1 ++ vld1.16 {q14}, [r4] ++ vld1.16 {q15}, [r0] ++ ++ bl hevc_loop_filter_luma_body_\bit_depth ++ ++ add r0, r0, r1, lsl #1 ++ add r2, r4, r1, lsl #1 ++ add r6, r4, r1, asr #1 ++ vpop {d8-d15} ++ ++ @ P2-P0 ++ bcs 1f ++ vst1.16 {q14}, [r4], r1 ++ vst1.16 {q13}, [r6] ++ vst1.16 {q12}, [r4] ++1: ++ bmi 1f ++ vst1.16 {q11}, [r0], r1 ++ vst1.16 {q10}, [r2] ++ vst1.16 { q9}, [r0] ++1: ++ pop {r4-r10,pc} ++.endm ++ ++ ++@ void ff_hevc_rpi_h_loop_filter_uv_neon(uint8_t * src_r, // r0 ++@ unsigned int stride, // r1 ++@ uint32_t tc4, // r2 ++@ unsigned int no_f); // r3 ++@ ++@ no_f ++@ 0 tl P0 ++@ 1 tr P1 ++@ 2 bl Q0 ++@ 3 br Q1 ++@ ++@ Probably not worth having the P/Qa only special case in this direction ++@ Given layout we won't save any memory reads or avoid any cache dirtying ++@ We would save a bit of computation but I expect the partials to be less ++@ common in the H direction than V due to how we arrange deblock. ++ ++function ff_hevc_rpi_h_loop_filter_uv_neon_8, export=1 ++ sub r12, r0, r1 ++ cmp r2, #0 ++ it eq ++ bxeq lr ++ vld1.8 {d26,d27}, [r0] ++ lsl r1, #1 ++ sub r0, r1 ++ vld1.8 {d18,d19}, [r12], r1 ++ vld1.8 {d16,d17}, [r0], r1 ++ vld1.8 {d28,d29}, [r12] ++ ++ hevc_loop_filter_uv_body2 d16, d17, d18, d19, d26, d27, d28, d29, \ ++ "sub r12, r0, r1, asr #1" ++ ++ lsls r3, #29 @ b2 -> N, b3 -> C ++ it pl ++ vstrpl d26, [r0, #0] ++ it cc ++ vstrcc d27, [r0, #8] ++ lsls r3, #2 @ b0 -> N, b1 -> C ++ it pl ++ vstrpl d18, [r12, #0] ++ it cc ++ vstrcc d19, [r12, #8] ++ bx lr ++ ++endfunc ++ ++ ++@ void ff_hevc_rpi_h_loop_filter_uv_neon_10(uint8_t * src_r, // r0 ++@ unsigned int stride, // r1 ++@ uint32_t tc4, // r2 ++@ unsigned int no_f); // r3 ++@ ++@ no-F = b0:no_p[0], b1:no_p[1], b2:no_q[0], b3:no_q[1] ++@ ++@ Macro here actual function near bottom ++ ++.macro m_filter_h_uv_16 bit_depth ++ sub r12, r0, r1 ++ cmp r2, #0 ++ it eq ++ bxeq lr ++ vld1.16 {q12, q13}, [r0] ++ lsl r1, #1 ++ sub r0, r1 ++ vld1.16 {q10, q11}, [r12], r1 ++ vld1.16 {q8, q9 }, [r0], r1 ++ vld1.16 {q14, q15}, [r12] ++ ++ hevc_loop_filter_uv_body2_16 q8, q9, q10, q11, q12, q13, q14, q15, \bit_depth, \ ++ "sub r12, r0, r1, asr #1", \ ++ "cmp r3, #0" ++ ++ bne 1f ++ vst1.16 {q10, q11}, [r12] ++ vst1.16 {q12, q13}, [r0] ++ bx lr ++ ++ @ At least one no_f bit is set ++ @ Which means we need to break this apart in an ugly fashion ++1: ++ lsls r3, #29 @ b2 -> N, b3 -> C ++ itt pl ++ vstrpl d24, [r0, #0] ++ vstrpl d25, [r0, #8] ++ itt cc ++ vstrcc d26, [r0, #16] ++ vstrcc d27, [r0, #24] ++ lsls r3, #2 @ b0 -> N, b1 -> C ++ itt pl ++ vstrpl d20, [r12, #0] ++ vstrpl d21, [r12, #8] ++ itt cc ++ vstrcc d22, [r12, #16] ++ vstrcc d23, [r12, #24] ++ bx lr ++.endm ++ ++ ++@ void ff_hevc_rpi_v_loop_filter_uv2_neon(uint8_t * src_r, // r0 ++@ unsigned int stride, // r1 ++@ uint32_t tc4, // r2 ++@ uint8_t * src_l, // r3 ++@ unsigned int no_f); // sp[0] ++@ ++@ no_f: ++@ 0 tl P0 ++@ 1 tr Q0 ++@ 2 bl P1 ++@ 3 br Q1 ++ ++function ff_hevc_rpi_v_loop_filter_uv2_neon_8, export=1 ++ cmp r2, #0 ++ it eq ++ bxeq lr ++ push {lr} ++ vld2.16 {d16[0], d18[0]}, [r3], r1 ++ vld2.16 {d20[0], d22[0]}, [r0], r1 ++ ++ cmp r2, #0x10000 ++ vld2.16 {d16[1], d18[1]}, [r3], r1 ++ vld2.16 {d20[1], d22[1]}, [r0], r1 ++ ++ vld2.16 {d16[2], d18[2]}, [r3], r1 ++ vld2.16 {d20[2], d22[2]}, [r0], r1 ++ ++ vld2.16 {d16[3], d18[3]}, [r3], r1 ++ vld2.16 {d20[3], d22[3]}, [r0], r1 ++ blo 10f ++ ++ vld2.16 {d17[0], d19[0]}, [r3], r1 ++ vld2.16 {d21[0], d23[0]}, [r0], r1 ++ ++ sub ip, r0, r3 ++ vld2.16 {d17[1], d19[1]}, [r3], r1 ++ vld2.16 {d21[1], d23[1]}, [r0], r1 ++ ++ cmp ip, #4 ++ vld2.16 {d17[2], d19[2]}, [r3], r1 ++ vld2.16 {d21[2], d23[2]}, [r0], r1 ++ ++ vld2.16 {d17[3], d19[3]}, [r3] ++ vld2.16 {d21[3], d23[3]}, [r0] ++ ++ hevc_loop_filter_uv_body2 d16, d17, d18, d19, d20, d21, d22, d23 \ ++ "ldr lr, [sp, #4]", \ ++ "neg r1, r1", \ ++ "it eq; cmpeq lr, #0", \ ++ "add r3, #2", \ ++ "add ip, r3, r1", \ ++ "add r2, r0, r1", \ ++ "lsl r1, #1" ++ ++ bne 1f ++ ++@ Much/most of the time r0 == r3 + 4 and no_f == 0 ++@ so it is worth having this special case ++ vst2.16 {d19[3], d21[3]}, [r3], r1 @ P0b, Q0b ++ vst2.16 {d19[2], d21[2]}, [ip], r1 ++ vst2.16 {d19[1], d21[1]}, [r3], r1 ++ vst2.16 {d19[0], d21[0]}, [ip], r1 ++ vst2.16 {d18[3], d20[3]}, [r3], r1 @ P0a, Q0a ++ vst2.16 {d18[2], d20[2]}, [ip], r1 ++ vst2.16 {d18[1], d20[1]}, [r3] ++ vst2.16 {d18[0], d20[0]}, [ip] ++ pop {pc} ++ ++@ Either split or partial ++1: ++ lsls lr, #29 @ b3 (Q0b) -> C, b2 (P0b) -> N & b31, b1 (Q0a) -> b30, b0 (P0a) -> b29 ++ ittt cs ++ addcs r0, r0, r1, lsl #1 ++ addcs r2, r2, r1, lsl #1 ++ bcs 1f ++ @ Q0b ++ vst1.16 {d21[3]}, [r0], r1 ++ vst1.16 {d21[2]}, [r2], r1 ++ vst1.16 {d21[1]}, [r0], r1 ++ vst1.16 {d21[0]}, [r2], r1 ++1: ++ ittt mi ++ addmi r3, r3, r1, lsl #1 ++ addmi ip, ip, r1, lsl #1 ++ bmi 1f ++ @ P0b ++ vst1.16 {d19[3]}, [r3], r1 ++ vst1.16 {d19[2]}, [ip], r1 ++ vst1.16 {d19[1]}, [r3], r1 ++ vst1.16 {d19[0]}, [ip], r1 ++1: ++ lsls lr, #2 @ b30 (Q0a) -> C, b29 (P0a) -> N & b31 ++ bcs 1f ++ @ Q0a ++ vst1.16 {d20[3]}, [r0], r1 ++ vst1.16 {d20[2]}, [r2], r1 ++ vst1.16 {d20[1]}, [r0] ++ vst1.16 {d20[0]}, [r2] ++1: ++ it mi ++ popmi {pc} ++ @ P0a ++ vst1.16 {d18[3]}, [r3], r1 ++ vst1.16 {d18[2]}, [ip], r1 ++ vst1.16 {d18[1]}, [r3] ++ vst1.16 {d18[0]}, [ip] ++ pop {pc} ++ ++@ Single lump (rather than double) ++10: ++ @ As we have post inced r0/r3 in the load the easiest thing to do is ++ @ to subtract and write forwards, rather than backwards (as above) ++ @ b0 (P0a) -> N, b1 (Q0a) -> C ++ ++ hevc_loop_filter_uv_body1 d16, d18, d20, d22 \ ++ "ldr lr, [sp, #4]", \ ++ "add r3, #2", \ ++ "sub r0, r0, r1, lsl #2", \ ++ "sub r3, r3, r1, lsl #2", \ ++ "lsls lr, #31", \ ++ "add r2, r0, r1", \ ++ "add ip, r3, r1", \ ++ "lsl r1, #1" ++ ++ bcs 3f ++ @ Q0a ++ vst1.16 {d20[0]}, [r0], r1 ++ vst1.16 {d20[1]}, [r2], r1 ++ vst1.16 {d20[2]}, [r0] ++ vst1.16 {d20[3]}, [r2] ++3: ++ it mi ++ popmi {pc} ++ @ P0a ++ vst1.16 {d18[0]}, [r3], r1 ++ vst1.16 {d18[1]}, [ip], r1 ++ vst1.16 {d18[2]}, [r3] ++ vst1.16 {d18[3]}, [ip] ++ pop {pc} ++ ++endfunc ++ ++ ++@ void ff_hevc_rpi_v_loop_filter_uv2_neon(uint8_t * src_r, // r0 ++@ unsigned int stride, // r1 ++@ uint32_t tc4, // r2 ++@ uint8_t * src_l, // r3 ++@ unsigned int no_f); // sp[0] ++@ ++ ++@ no_f ++@ 0 tl P0a ++@ 1 tr Q0a ++@ 2 bl P0b ++@ 3 br Q0b ++ ++@ P1: q8, q12 ++@ P0: q9, q13 ++@ Q0: q10, q14 ++@ Q1: q11, q15 ++ ++.macro m_filter_v_uv2_16 bit_depth ++ cmp r2, #0 ++ it eq ++ bxeq lr ++ push {lr} ++ vld2.32 {d16[0], d18[0]}, [r3], r1 ++ vld2.32 {d20[0], d22[0]}, [r0], r1 ++ ++ cmp r2, #0x10000 ++ vld2.32 {d16[1], d18[1]}, [r3], r1 ++ vld2.32 {d20[1], d22[1]}, [r0], r1 ++ ++ vld2.32 {d17[0], d19[0]}, [r3], r1 ++ vld2.32 {d21[0], d23[0]}, [r0], r1 ++ ++ vld2.32 {d17[1], d19[1]}, [r3], r1 ++ vld2.32 {d21[1], d23[1]}, [r0], r1 ++ blo 10f ++ ++ vld2.32 {d24[0], d26[0]}, [r3], r1 ++ vld2.32 {d28[0], d30[0]}, [r0], r1 ++ ++ sub ip, r0, r3 ++ vld2.32 {d24[1], d26[1]}, [r3], r1 ++ vld2.32 {d28[1], d30[1]}, [r0], r1 ++ ++ cmp ip, #8 ++ vld2.32 {d25[0], d27[0]}, [r3], r1 ++ vld2.32 {d29[0], d31[0]}, [r0], r1 ++ ++ vld2.32 {d25[1], d27[1]}, [r3] ++ vld2.32 {d29[1], d31[1]}, [r0] ++ ++ hevc_loop_filter_uv_body2_16 q8, q12, q9, q13, q10, q14, q11, q15, \bit_depth, \ ++ "ldr lr, [sp, #4]", \ ++ "neg r1, r1", \ ++ "it eq; cmpeq lr, #0", \ ++ "add r3, #4", \ ++ "add ip, r3, r1", \ ++ "add r2, r0, r1", \ ++ "lsl r1, #1" ++ ++ bne 1f ++ ++@ Much/most of the time r0 == r3 + 8 and no_f == 0 ++@ so it is worth having this special case ++ vst2.32 {d27[1], d29[1]}, [r3], r1 @ P0b, Q0b ++ vst2.32 {d27[0], d29[0]}, [ip], r1 ++ vst2.32 {d26[1], d28[1]}, [r3], r1 ++ vst2.32 {d26[0], d28[0]}, [ip], r1 ++ vst2.32 {d19[1], d21[1]}, [r3], r1 @ P0a, Q0a ++ vst2.32 {d19[0], d21[0]}, [ip], r1 ++ vst2.32 {d18[1], d20[1]}, [r3] ++ vst2.32 {d18[0], d20[0]}, [ip] ++ pop {pc} ++ ++@ Either split or partial ++1: ++ lsls lr, #29 @ b3 (Q0b) -> C, b2 (P0b) -> N & b31, b1 (Q0a) -> b30, b0 (P0a) -> b29 ++ ittt cs ++ addcs r0, r0, r1, lsl #1 ++ addcs r2, r2, r1, lsl #1 ++ bcs 1f ++ @ Q0b ++ vst1.32 {d29[1]}, [r0], r1 ++ vst1.32 {d29[0]}, [r2], r1 ++ vst1.32 {d28[1]}, [r0], r1 ++ vst1.32 {d28[0]}, [r2], r1 ++1: ++ ittt mi ++ addmi r3, r3, r1, lsl #1 ++ addmi ip, ip, r1, lsl #1 ++ bmi 1f ++ @ P0b ++ vst1.32 {d27[1]}, [r3], r1 ++ vst1.32 {d27[0]}, [ip], r1 ++ vst1.32 {d26[1]}, [r3], r1 ++ vst1.32 {d26[0]}, [ip], r1 ++1: ++ lsls lr, #2 @ b30 (Q0a) -> C, b29 (P0a) -> N & b31 ++ bcs 1f ++ @ Q0a ++ vst1.32 {d21[1]}, [r0], r1 ++ vst1.32 {d21[0]}, [r2], r1 ++ vst1.32 {d20[1]}, [r0] ++ vst1.32 {d20[0]}, [r2] ++1: ++ it mi ++ popmi {pc} ++ @ P0a ++ vst1.32 {d19[1]}, [r3], r1 ++ vst1.32 {d19[0]}, [ip], r1 ++ vst1.32 {d18[1]}, [r3] ++ vst1.32 {d18[0]}, [ip] ++ pop {pc} ++ ++@ Single lump (rather than double) ++10: ++ @ As we have post inced r0/r3 in the load the easiest thing to do is ++ @ to subtract and write forwards, rather than backwards (as above) ++ @ b0 (P0a) -> N, b1 (Q0a) -> C ++ ++ hevc_loop_filter_uv_body1_16 q8, q9, q10, q11, \bit_depth, \ ++ "ldr lr, [sp, #4]", \ ++ "add r3, #4", \ ++ "sub r0, r0, r1, lsl #2", \ ++ "sub r3, r3, r1, lsl #2", \ ++ "lsls lr, #31", \ ++ "add r2, r0, r1", \ ++ "add ip, r3, r1", \ ++ "lsl r1, #1" ++ ++ bcs 3f ++ @ Q0a ++ vst1.32 {d20[0]}, [r0], r1 ++ vst1.32 {d20[1]}, [r2], r1 ++ vst1.32 {d21[0]}, [r0] ++ vst1.32 {d21[1]}, [r2] ++3: ++ it mi ++ popmi {pc} ++ @ P0a ++ vst1.32 {d18[0]}, [r3], r1 ++ vst1.32 {d18[1]}, [ip], r1 ++ vst1.32 {d19[0]}, [r3] ++ vst1.32 {d19[1]}, [ip] ++ pop {pc} ++.endm ++ ++ ++@ The NEON version is faster under ideal circumstances (i.e. everything in L1) ++@ But in real world testing it is ~20% slower, presumably due to code size ++ ++#if 0 // NEON version ++ ++/* uint32_t ff_hevc_rpi_deblocking_boundary_strengths_neon(int pus, int dup, const HEVCRpiMvField *curr, const HEVCRpiMvField *neigh, ++ * const int *curr_rpl0, const int *curr_rpl1, const int *neigh_rpl0, const int *neigh_rpl1, ++ * int in_inc0, int in_inc1) ++ */ ++function ff_hevc_rpi_deblocking_boundary_strengths_neon, export=1 ++ mov ip, sp ++ push {a1-a3,v1-v8,lr} ++ ldm ip, {v1-v6} ++ cmp a1, #2 ++ bls 2f ++ vpush {d8-d13} ++ sub v5, v5, #10 ++ sub v6, v6, #10 ++1: ++ vld2.32 {d0[0], d2[0]}, [a3]! ++ vld2.32 {d4[0], d6[0]}, [a4]! ++ vmov.u8 q12, #0 ++ ldrb a2, [a3], #1 ++ ldrb ip, [a4], #1 ++ ldrb v8, [a3], #1 ++ ldrb lr, [a4], #1 ++ add a2, v1, a2, lsl #2 ++ vld1.8 {d24[0]}, [a3], v5 ++ add ip, v3, ip, lsl #2 ++ vld1.8 {d25[0]}, [a4], v6 ++ add v8, v2, v8, lsl #2 ++ vld1.32 {d16[0]}, [a2] ++ add lr, v4, lr, lsl #2 ++ vld1.32 {d20[0]}, [ip] ++ vld1.32 {d18[0]}, [v8] ++ vld1.32 {d22[0]}, [lr] ++ ++ vld2.32 {d0[1], d2[1]}, [a3]! ++ vld2.32 {d4[1], d6[1]}, [a4]! ++ ldrb a2, [a3], #1 ++ vmov.u16 d12, #1 ++ ldrb ip, [a4], #1 ++ vmov.u16 d13, #2 ++ ldrb v8, [a3], #1 ++ vmov.u16 d27, #4 ++ ldrb lr, [a4], #1 ++ add a2, v1, a2, lsl #2 ++ vld1.8 {d24[2]}, [a3], v5 ++ add ip, v3, ip, lsl #2 ++ vld1.8 {d25[2]}, [a4], v6 ++ add v8, v2, v8, lsl #2 ++ vld1.32 {d16[1]}, [a2] ++ add lr, v4, lr, lsl #2 ++ vld1.32 {d20[1]}, [ip] ++ vld1.32 {d18[1]}, [v8] ++ vld1.32 {d22[1]}, [lr] ++ ++ vld2.32 {d1[0], d3[0]}, [a3]! ++ vld2.32 {d5[0], d7[0]}, [a4]! ++ ldrb a2, [a3], #1 ++ ldrb ip, [a4], #1 ++ ldrb lr, [a4], #1 ++ ldrb v8, [a3], #1 ++ add a2, v1, a2, lsl #2 ++ vld1.8 {d24[4]}, [a3], v5 ++ add ip, v3, ip, lsl #2 ++ vld1.8 {d25[4]}, [a4], v6 ++ add v8, v2, v8, lsl #2 ++ vld1.32 {d17[0]}, [a2] ++ add lr, v4, lr, lsl #2 ++ vld1.32 {d21[0]}, [ip] ++ vld1.32 {d19[0]}, [v8] ++ vld1.32 {d23[0]}, [lr] ++ ++ vld2.32 {d1[1], d3[1]}, [a3]! ++ vld2.32 {d5[1], d7[1]}, [a4]! ++ ldrb a2, [a3], #1 ++ ldrb ip, [a4], #1 ++ ldrb v8, [a3], #1 ++ ldrb lr, [a4], #1 ++ add a2, v1, a2, lsl #2 ++ vld1.8 {d24[6]}, [a3], v5 ++ add ip, v3, ip, lsl #2 ++ vld1.8 {d25[6]}, [a4], v6 ++ add v8, v2, v8, lsl #2 ++ vld1.32 {d17[1]}, [a2] ++ add lr, v4, lr, lsl #2 ++ vld1.32 {d21[1]}, [ip] ++ vld1.32 {d19[1]}, [v8] ++ vld1.32 {d23[1]}, [lr] ++ ++ @ So now we have: ++ @ q0.32[i] = curr[i].mv[0] ++ @ q1.32[i] = curr[i].mv[1] ++ @ q2.32[i] = neigh[i].mv[0] ++ @ q3.32[i] = neigh[i].mv[1] ++ @ q8.32[i] = curr_rpl0[curr[i].ref_idx[0]] ++ @ q9.32[i] = curr_rpl1[curr[i].ref_idx[1]] ++ @ q10.32[i] = neigh_rpl0[neigh[i].ref_idx[0]] ++ @ q11.32[i] = neigh_rpl1[neigh[i].ref_idx[1]] ++ @ d24.16[i] = curr[i].pred_flag ++ @ d25.16[i] = neigh[i].pred_flag ++ ++ vtst.16 d28, d24, d12 ++ vtst.16 d29, d24, d13 ++ vadd.i16 d8, d24, d12 ++ vadd.i16 d9, d25, d12 ++ vtst.16 d30, d25, d12 ++ vtst.16 d31, d25, d13 ++ veor d26, d8, d9 ++ ldr lr, [sp, 6*8 + 1*4] ++ vmovl.s16 q4, d28 ++ vmovl.s16 q5, d29 ++ teq lr, #1 ++ vmovl.s16 q14, d30 ++ it ne ++ lslne v1, lr, #1 ++ vmovl.s16 q15, d31 ++ it ne ++ rsbne v2, v1, #32 ++ vbif q0, q1, q4 ++ vbif q2, q3, q14 ++ vbif q1, q0, q5 ++ vbif q3, q2, q15 ++ vabd.s16 q12, q0, q2 ++ vabd.s16 q2, q1 ++ vabd.s16 q0, q3 ++ vabd.s16 q1, q3 ++ vbif q8, q9, q4 ++ vbif q10, q11, q14 ++ vbif q9, q8, q5 ++ vbif q11, q10, q15 ++ vclt.u16 d6, d24, d27 ++ vclt.u16 d8, d2, d27 ++ vclt.u16 d7, d25, d27 ++ vclt.u16 d9, d3, d27 ++ vclt.u16 d2, d0, d27 ++ vclt.u16 d0, d4, d27 ++ vclt.u16 d3, d1, d27 ++ vclt.u16 d1, d5, d27 ++ vceq.i32 q12, q10, q8 ++ vceq.i32 q10, q9 ++ vceq.i32 q8, q11 ++ vceq.i32 q9, q11 ++ vshrn.i32 d6, q3, #8 ++ vshrn.i32 d7, q4, #8 ++ vshrn.i32 d8, q1, #8 ++ vshrn.i32 d9, q0, #8 ++ vmovn.i32 d4, q12 ++ vmovn.i32 d2, q10 ++ vmovn.i32 d3, q8 ++ vmovn.i32 d5, q9 ++ vand q2, q3 ++ vrev16.8 q3, q3 ++ vand q2, q3 ++ vand q1, q4 ++ vrev16.8 q4, q4 ++ vand q1, q4 ++ vand d4, d5 ++ vand d2, d3 ++ vbic d0, d12, d4 ++ vshr.u16 d26, #2 ++ vbic d0, d2 ++ vmov.i16 d1, #0x5555 ++ vorr d0, d26 ++ bne 10f ++ ++ @ Merge results into result word, no duplicates ++ vmov a2, s0 ++ vmov v8, s1 ++ vmov.u16 ip, d0[1] ++ vmov.u16 lr, d0[3] ++ lsl a2, #30 ++ lsl v8, #30 ++ lsl ip, #30 ++ lsl lr, #30 ++ orr a2, ip, a2, lsr #2 ++ orr v8, lr, v8, lsr #2 ++ orr a2, v8, a2, lsr #4 ++ subs a1, #4 ++ orr v7, a2, v7, lsr #8 ++ bhi 1b ++ ++ mov a1, #32 ++ ldr a3, [sp, #6*8] ++ vpop {d8-d13} ++ sub a1, a1, a3, lsl #1 ++ mov a1, v7, lsr a1 ++ pop {a2-a4,v1-v8,pc} ++10: ++ @ Merge results into result word, with duplicates ++ vmul.i16 d0, d1 ++ vmov a2, s0 ++ vmov v8, s1 ++ vmov.u16 ip, d0[1] ++ vmov.u16 lr, d0[3] ++ lsl a2, v2 ++ subs a1, #4 ++ lsl v8, v2 ++ lsl ip, v2 ++ lsl lr, v2 ++ ldr v2, [sp, #6*8 + 12*4 + 1*4] ++T lsr a2, v1 ++T orr a2, ip, a2 ++A orr a2, ip, a2, lsr v1 ++ lsl ip, v1, #1 ++T lsr v8, v1 ++T orr v8, lr, v8 ++A orr v8, lr, v8, lsr v1 ++ lsl lr, v1, #2 ++T lsr a2, ip ++T orr a2, v8, a2 ++A orr a2, v8, a2, lsr ip ++ ldr v1, [sp, #6*8 + 12*4] ++T lsr v7, lr ++T orr v7, a2, v7 ++A orr v7, a2, v7, lsr lr ++ bhi 1b ++ ++ mov a1, #32 ++ ldrd a3, a4, [sp, #6*8] ++ vpop {d8-d13} ++ mls a1, a3, a4, a1 ++ mls a1, a3, a4, a1 ++ mov a1, v7, lsr a1 ++ pop {a2-a4,v1-v8,pc} ++ ++ ++2: ++ sub v5, v5, #10 ++ sub v6, v6, #10 ++ vmov.u8 d16, #0 ++ blo 3f ++ vld2.32 {d0[0], d1[0]}, [a3]! ++ vld2.32 {d2[0], d3[0]}, [a4]! ++ ldrb a2, [a3], #1 ++ ldrb ip, [a4], #1 ++ ldrb lr, [a4], #1 ++ ldrb v8, [a3], #1 ++ add a2, v1, a2, lsl #2 ++ vld1.8 {d16[0]}, [a3], v5 ++ add ip, v3, ip, lsl #2 ++ vld1.8 {d16[4]}, [a4], v6 ++ add v8, v2, v8, lsl #2 ++ vld1.32 {d4[0]}, [a2] ++ add lr, v4, lr, lsl #2 ++ vld1.32 {d5[0]}, [ip] ++ vld1.32 {d6[0]}, [v8] ++ vld1.32 {d7[0]}, [lr] ++ ++3: ++ vld2.32 {d0[1], d1[1]}, [a3]! ++ vld2.32 {d2[1], d3[1]}, [a4]! ++ ldrb a2, [a3], #1 ++ vmov.u16 d17, #1 ++ ldrb ip, [a4], #1 ++ vmov.u16 d18, #2 ++ ldrb v8, [a3], #1 ++ vmov.u16 d19, #4 ++ ldrb lr, [a4], #1 ++ add a2, v1, a2, lsl #2 ++ vld1.8 {d16[2]}, [a3], v5 ++ add ip, v3, ip, lsl #2 ++ vld1.8 {d16[6]}, [a4], v6 ++ add v8, v2, v8, lsl #2 ++ vld1.32 {d4[1]}, [a2] ++ add lr, v4, lr, lsl #2 ++ vld1.32 {d5[1]}, [ip] ++ vld1.32 {d6[1]}, [v8] ++ vld1.32 {d7[1]}, [lr] ++ ++ @ So now we have: ++ @ d0.32[i] = curr[i].mv[0] ++ @ d1.32[i] = curr[i].mv[1] ++ @ d2.32[i] = neigh[i].mv[0] ++ @ d3.32[i] = neigh[i].mv[1] ++ @ d4.32[i] = curr_rpl0[curr[i].ref_idx[0]] ++ @ d5.32[i] = neigh_rpl0[neigh[i].ref_idx[0]] ++ @ d6.32[i] = curr_rpl1[curr[i].ref_idx[1]] ++ @ d7.32[i] = neigh_rpl1[neigh[i].ref_idx[1]] ++ @ d16.16[i] = curr[i].pred_flag ++ @ d16.16[2+i] = neigh[i].pred_flag ++ ++ vtst.16 d20, d16, d17 ++ vtst.16 d22, d16, d18 ++ vadd.i16 d30, d16, d17 ++ vswp d2, d3 ++ ldr lr, [sp, #1*4] ++ vmovl.s16 q10, d20 ++ teq lr, #1 ++ vmovl.s16 q11, d22 ++ it ne ++ lslne v1, lr, #1 ++ vbif d0, d1, d20 ++ vbif d4, d6, d20 ++ vbif d3, d2, d21 ++ vbif d5, d7, d21 ++ vbif d1, d0, d22 ++ vbif d6, d4, d22 ++ vbif d2, d3, d23 ++ vbif d7, d5, d23 ++ vshr.u16 d30, #2 ++ vabd.s16 d24, d0, d3 ++ vabd.s16 d25, d1, d2 ++ vabd.s16 q0, q0, q1 ++ vceq.i32 d2, d4, d5 ++ vceq.i32 d20, d5, d6 ++ vceq.i32 d21, d4, d7 ++ vceq.i32 d3, d6, d7 ++ vclt.u16 d6, d24, d19 ++ vclt.u16 d7, d25, d19 ++ vclt.u16 d22, d1, d19 ++ vclt.u16 d23, d0, d19 ++ vshrn.i32 d6, q3, #8 ++ vmovn.i32 d2, q1 ++ vshrn.i32 d7, q11, #8 ++ vmovn.i32 d3, q10 ++ vand q0, q3, q1 ++ it ne ++ rsbne v2, v1, #32 ++ vrev16.8 q3, q3 ++ vand q0, q3 ++ vsra.u64 d30, #32 ++ vshr.u64 q1, q0, #32 ++ vand q0, q1 ++ vbic d0, d17, d0 ++ vand d30, d30, d17 ++ vbic d0, d1 ++ vmov.i16 d1, #0x5555 ++ vorr d0, d30 ++ bne 10f ++ ++ @ Construct result word, no duplicates ++ cmp a1, #2 ++ vmov.u16 a1, d0[1] ++ vmov.u16 a2, d0[0] ++ it eq ++ orreq a1, a2, a1, lsl #2 ++ pop {a2-a4,v1-v8,pc} ++10: ++ @ Construct result word, with duplicates ++ cmp a1, #2 ++ vmul.i16 d0, d1 ++ vmov a2, s0 ++ vmov.u16 a1, d0[1] ++ lsl a2, #16 ++ pkhbt a1, a1, a1, lsl #16 ++ lsr a2, v2 ++ lsr a1, v2 ++T itt eq ++T lsleq a1, v1 ++T orreq a1, a2, a1 ++A orreq a1, a2, a1, lsl v1 ++ pop {a2-a4,v1-v8,pc} ++endfunc ++ ++ ++ ++#else // non-NEON version ++ ++ ++/* uint32_t ff_hevc_rpi_deblocking_boundary_strengths_neon(int pus, int dup, const HEVCRpiMvField *curr, const HEVCRpiMvField *neigh, ++ * const int *curr_rpl0, const int *curr_rpl1, const int *neigh_rpl0, const int *neigh_rpl1, ++ * int in_inc0, in_inc1) ++ */ ++function ff_hevc_rpi_deblocking_boundary_strengths_neon, export=1 ++ add ip, sp, #4*4 ++ push {a2-a4,v1-v8,lr} ++ mov v6, #32 ++1: ldmdb ip, {v1-v4} ++ ldrsb v5, [a3, #8] @ curr->ref_idx ++ ldrsb v8, [a3, #9] ++ ldrsb ip, [a4, #8] @ neigh->ref_idx ++ ldrsb lr, [a4, #9] ++ ldr v1, [v1, v5, lsl #2] ++ ldrb v5, [a3, #10] @ curr->pred_flag ++ ldr v2, [v2, v8, lsl #2] ++ ldrb v8, [a4, #10] @ neigh->pred_flag ++ ldr v3, [v3, ip, lsl #2] ++ ldr v4, [v4, lr, lsl #2] ++ teq v5, #3 ++ beq 20f ++ teq v8, #3 ++ beq 90f ++ ++ tst v5, #1 ++ itee ne ++ ldrne v5, [a3, #0] @ curr->mv[0] ++ moveq v1, v2 ++ ldreq v5, [a3, #4] @ curr->mv[1] ++ tst v8, #1 ++ itee ne ++ ldrne v8, [a4, #0] @ neigh->mv[0] ++ moveq v3, v4 ++ ldreq v8, [a4, #4] @ neigh->mv[1] ++ teq v1, v3 ++ bne 10f ++ ldr lr, =0xFFFCFFFC ++ ssub16 ip, v8, v5 ++ ssub16 v5, v5, v8 ++ sel v5, v5, ip ++ ands v5, v5, lr ++ @ drop through ++10: it ne ++ movne v5, #1<<30 ++11: ++ sub v6, v6, #2 ++T mov v7, v7, lsr #2 ++ subs a2, a2, #1 ++A orr v7, v5, v7, lsr #2 ++T orr v7, v5, v7 ++ bhi 11b ++ ++ ldrd v3, v4, [sp, #16*4] ++ ldr a2, [sp] ++ add ip, sp, #16*4 ++ subs a1, a1, #1 ++ add a3, a3, v3 ++ add a4, a4, v4 ++ bhi 1b ++ mov a1, v7, lsr v6 ++ pop {a2-a4,v1-v8,pc} ++ ++20: teq v8, #3 ++ bne 10b ++ ++ teq v1, v3 ++ it eq ++ teqeq v2, v4 ++ bne 40f ++ teq v1, v2 ++ bne 30f ++ ++ ldrd v1, v2, [a3] @ curr->mv ++ ldrd v3, v4, [a4] @ neigh->mv ++ ldr lr, =0xFFFCFFFC ++ ssub16 ip, v3, v1 ++ ssub16 v5, v1, v3 ++ sel v5, v5, ip ++ ands v5, v5, lr ++ bne 25f ++ ssub16 ip, v4, v2 ++ ssub16 v5, v2, v4 ++ sel v5, v5, ip ++ ands v5, v5, lr ++ beq 11b ++ @ drop through ++25: ssub16 ip, v4, v1 ++ ssub16 v5, v1, v4 ++ sel v5, v5, ip ++ ands v5, v5, lr ++ bne 10b ++ ssub16 ip, v3, v2 ++ ssub16 v5, v2, v3 ++ sel v5, v5, ip ++ ands v5, v5, lr ++ b 10b ++ ++30: ldrd v1, v2, [a3] @ curr->mv ++ ldrd v3, v4, [a4] @ neigh->mv ++ ldr lr, =0xFFFCFFFC ++ ssub16 ip, v3, v1 ++ ssub16 v5, v1, v3 ++ sel v5, v5, ip ++ ands v5, v5, lr ++ bne 10b ++ ssub16 ip, v4, v2 ++ ssub16 v5, v2, v4 ++ sel v5, v5, ip ++ ands v5, v5, lr ++ b 10b ++ ++40: teq v1, v4 ++ ite eq ++ teqeq v2, v3 ++ bne 10b ++ ++ ldrd v1, v2, [a3] @ curr->mv ++ ldrd v3, v4, [a4] @ neigh->mv ++ ldr lr, =0xFFFCFFFC ++ b 25b ++ ++90: ++ mov v5, #1<<30 ++ b 11b ++endfunc ++ ++ ++#endif ++ ++ ++@ ============================================================================= ++@ ++@ 10 bit ++ ++function hevc_loop_filter_luma_body_10 ++ m_filter_luma 10, q11, q15 ++endfunc ++ ++function ff_hevc_rpi_h_loop_filter_luma_neon_10, export=1 ++ hevc_loop_filter_luma_start ++ b .Lh_loop_luma_common_10 ++endfunc ++ ++function ff_hevc_rpi_h_loop_filter_luma2_neon_10, export=1 ++ cmp r3, #0 ++ it eq ++ bxeq lr ++ push {r4-r10,lr} @ 32 bytes ++ ldr r10, [sp, #32] ++.Lh_loop_luma_common_10: ++ m_filter_h_luma_16 10 ++endfunc ++ ++function ff_hevc_rpi_v_loop_filter_luma_neon_10, export=1 ++ hevc_loop_filter_luma_start ++ sub r4, r0, #8 ++ b .Lv_loop_luma_common_10 ++endfunc ++ ++function ff_hevc_rpi_v_loop_filter_luma2_neon_10, export=1 ++ cmp r3, #0 ++ it eq ++ bxeq lr ++ push {r4-r10,lr} @ 32 bytes ++ ldr r4, [sp, #36] ++ ldr r10, [sp, #32] ++ ++.Lv_loop_luma_common_10: ++ m_filter_v_luma_16 10 ++endfunc ++ ++function ff_hevc_rpi_h_loop_filter_uv_neon_10, export=1 ++ m_filter_h_uv_16 10 ++endfunc ++ ++function ff_hevc_rpi_v_loop_filter_uv2_neon_10, export=1 ++ m_filter_v_uv2_16 10 ++endfunc ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcdsp_idct_neon.S +@@ -0,0 +1,184 @@ ++/* ++ * Copyright (c) 2014 Seppo Tomperi ++ * Copyright (C) 2018 John Cox, Ben Avison for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++/* uses registers q8 - q13 for temp values */ ++.macro tr4_luma_shift shift ++ vaddl.s16 q8, d28, d30 // c0 = src0 + src2 ++ vaddl.s16 q9, d30, d31 // c1 = src2 + src3 ++ vsubl.s16 q10, d28, d31 // c2 = src0 - src3 ++ vaddl.s16 q11, d28, d31 // src0 + src3 ++ ++ vmul.i32 q12, q8, d1[0] // 29 * c0 ++ vmul.i32 q13, q10, d2[0] // 55 * c2 ++ vmul.i32 q8, q8, d2[0] // 55 * c0 ++ vmull.s16 q14, d29, d0[0] // c3 = 74 * src1 ++ ++ vsubw.s16 q11, q11, d30 // src0 - src2 + src3 ++ vmla.i32 q12, q9, d2[0] // 29 * c0 + 55 * c1 ++ vmls.i32 q13, q9, d1[0] // 55 * c2 - 29 * c1 ++ vmla.i32 q8, q10, d1[0] // 55 * c0 + 29 * c2 ++ ++ vmul.i32 q11, q11, d0[0] // dst2 = 74 * (src0 - src2 + src3) ++ vadd.i32 q12, q12, q14 // dst0 = 29 * c0 + 55 * c1 + c3 ++ vadd.i32 q13, q13, q14 // dst1 = 55 * c2 - 29 * c1 + c3 ++ vsub.i32 q8, q8, q14 // dst3 = 55 * c0 + 29 * c2 - c3 ++ ++ vqrshrn.s32 d28, q12, \shift ++ vqrshrn.s32 d29, q13, \shift ++ vqrshrn.s32 d30, q11, \shift ++ vqrshrn.s32 d31, q8, \shift ++.endm ++ ++/* uses registers q8 - q11 for temp values */ ++.macro tr4_shift shift ++ vmull.s16 q9, d29, d0[0] // 83 * src1 ++ vmull.s16 q8, d29, d0[1] // 36 * src1 ++ vshll.s16 q14, d28, #6 // 64 * src0 ++ vshll.s16 q10, d30, #6 // 64 * src2 ++ vmlal.s16 q9, d31, d0[1] // 83 * src1 + 36 * src3 o0 ++ vmlsl.s16 q8, d31, d0[0] // 36 * src1 - 83 * src3 o1 ++ vadd.s32 q11, q14, q10 // 64 * (src0 + src2) e0 ++ vsub.s32 q10, q14, q10 // 64 * (src0 - src2) e1 ++ vadd.s32 q14, q11, q9 // e0 + o0 ++ vadd.s32 q15, q10, q8 // e1 + o1 ++ vsub.s32 q8, q10, q8 // e1 - o1 ++ vsub.s32 q9, q11, q9 // e0 - o0 ++ ++ vqrshrn.s32 d28, q14, \shift ++ vqrshrn.s32 d29, q15, \shift ++ vqrshrn.s32 d30, q8, \shift ++ vqrshrn.s32 d31, q9, \shift ++.endm ++ ++.macro tr8_process d0, d1, d2, d3, d4, d5, d6, d7, \ ++ tmp0, /* Q reg which doesn't alias with d4, d6 or d7 */ \ ++ tmp1, /* Q reg which doesn't alias with d7 or d0 */ \ ++ shift, I1, I2, I3 ++ ++ vmull.s16 q4, \d1, d1[1] // 89 * src1 ++ \I1 ++ vmull.s16 q5, \d1, d1[0] // 75 * src1 ++ \I2 ++ vmull.s16 q6, \d1, d1[3] // 50 * src1 ++ \I3 ++ vmull.s16 q7, \d1, d1[2] // 18 * src1 ++ vmlal.s16 q4, \d3, d1[0] // 75 * src3 ++ vmlsl.s16 q5, \d3, d1[2] //-18 * src3 ++ vmlsl.s16 q6, \d3, d1[1] //-89 * src3 ++ vmlsl.s16 q7, \d3, d1[3] //-50 * src3 ++ ++ // tr4 ++ vmull.s16 q1, \d2, d0[0] // 83 * src(1*2) ++ vmull.s16 q2, \d2, d0[1] // 36 * src(1*2) ++ ++ vmlal.s16 q4, \d5, d1[3] // 50 * src5 ++ vmlsl.s16 q5, \d5, d1[1] //-89 * src5 ++ vmlal.s16 q6, \d5, d1[2] // 18 * src5 ++ vmlal.s16 q7, \d5, d1[0] // 75 * src5 ++ ++ vshll.s16 q3, \d0, #6 // 64 * src(0*2) ++ vshll.s16 \tmp0, \d4, #6 // 64 * src(2*2) ++ vmlal.s16 q1, \d6, d0[1] // 83 * src(1*2) + 36 * src(3*2) o0 ++ vmlsl.s16 q2, \d6, d0[0] // 36 * src(1*2) - 83 * src(3*2) o1 ++ vadd.i32 \tmp1, q3, \tmp0 // 64 * (src(0*2) + src(2*2)) e0 ++ vsub.i32 \tmp0, q3, \tmp0 // 64 * (src(0*2) - src(2*2)) e1 ++ ++ vmlal.s16 q4, \d7, d1[2] // 18 * src7 ++ vmlsl.s16 q5, \d7, d1[3] //-50 * src7 ++ vmlal.s16 q6, \d7, d1[0] // 75 * src7 ++ vmlsl.s16 q7, \d7, d1[1] //-89 * src7 ++ ++ vsub.i32 q3, \tmp1, q1 // e0 - o0 ++ vadd.i32 \tmp1, \tmp1, q1 // e0 + o0 ++ vadd.i32 q1, \tmp0, q2 // e1 + o1 ++ vsub.i32 q2, \tmp0, q2 // e1 - o1 ++ ++ vadd.i32 \tmp0, \tmp1, q4 // e_8[0] + o_8[0], dst[0] ++ vsub.i32 q4, \tmp1, q4 // e_8[0] - o_8[0], dst[7] ++ vsub.i32 \tmp1, q3, q7 // e_8[3] - o_8[3], dst[4] ++ vadd.i32 q7, q3, q7 // e_8[3] + o_8[3], dst[3] ++ vadd.i32 q3, q1, q5 // e_8[1] + o_8[1], dst[1] ++ vsub.i32 q5, q1, q5 // e_8[1] - o_8[1], dst[6] ++ vsub.i32 q1, q2, q6 // e_8[2] - o_8[2], dst[5] ++ vadd.i32 q6, q2, q6 // e_8[2] + o_8[2], dst[2] ++ vqrshrn.s32 \d0, \tmp0, #\shift ++ vqrshrn.s32 \d4, \tmp1, #\shift ++ vqrshrn.s32 \d1, q3, #\shift ++ vqrshrn.s32 \d5, q1, #\shift ++ vqrshrn.s32 \d2, q6, #\shift ++ vqrshrn.s32 \d6, q5, #\shift ++ vqrshrn.s32 \d3, q7, #\shift ++ vqrshrn.s32 \d7, q4, #\shift ++.endm ++ ++.macro tr8_vert d0, d1, d2, d3, d4, d5, d6, d7, q01, q23, I1, I2, I3 ++ vld1.16 {\d0}, [r0 :64], r3 ++ vld1.16 {\d1}, [r2 :64], r3 ++ vld1.16 {\d2}, [r0 :64], r3 ++ vld1.16 {\d3}, [r2 :64], r3 ++ vld1.16 {\d4}, [r0 :64], r3 ++ vld1.16 {\d5}, [r2 :64], r3 ++ vld1.16 {\d6}, [r0 :64], r3 ++ vld1.16 {\d7}, [r2 :64], r3 ++ ++ tr8_process \ ++ \d0, \d1, \d2, \d3, \d4, \d5, \d6, \d7, \ ++ \q01, \q23, 7, "\I1", "\I2", "\I3" ++.endm ++ ++.macro tr8_horiz d0, d1, d2, d3, d4, d5, d6, d7, q01, q23, shift ++ tr8_process \ ++ \d0, \d1, \d2, \d3, \d4, \d5, \d6, \d7, \ ++ \q01, \q23, \shift ++ ++ vzip.16 \d0, \d4 ++ vzip.16 \d1, \d5 ++ vzip.16 \d2, \d6 ++ vzip.16 \d3, \d7 ++ vst4.16 {\d0-\d3}, [r0 :128], r3 ++ vst4.16 {\d4-\d7}, [r2 :128], r3 ++.endm ++ ++#define BIT_DEPTH 8 ++#include "rpi_hevc_idct_fn_neon.S" ++ ++.text ++ ++.align 4 ++tr4f: ++.word 0x00240053 // 36 and d1[0] = 83 ++.word 0x00000000 ++tr8f: ++.word 0x0059004b // 89, d0[0] = 75 ++.word 0x00320012 // 50, d0[2] = 18 ++tr16: ++.word 0x005a0057 // 90, d2[0] = 87 ++.word 0x00500046 // 80, d2[2] = 70 ++.word 0x0039002b // 57, d2[0] = 43 ++.word 0x00190009 // 25, d2[2] = 9 ++ ++#undef BIT_DEPTH ++#define BIT_DEPTH 10 ++#include "rpi_hevc_idct_fn_neon.S" ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcdsp_init_arm.c +@@ -0,0 +1,32 @@ ++/* ++ * Copyright (c) 2014 Seppo Tomperi ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/attributes.h" ++#include "libavutil/arm/cpu.h" ++#include "libavcodec/rpi_hevcdsp.h" ++#include "rpi_hevcdsp_arm.h" ++ ++av_cold void ff_hevcdsp_rpi_init_arm(HEVCDSPContext *c, const int bit_depth) ++{ ++ int cpu_flags = av_get_cpu_flags(); ++ ++ if (have_neon(cpu_flags)) ++ ff_hevcdsp_rpi_init_neon(c, bit_depth); ++} +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcdsp_init_neon.c +@@ -0,0 +1,467 @@ ++/* ++ * Copyright (c) 2014 Seppo Tomperi ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "config.h" ++#include "libavutil/attributes.h" ++#include "libavutil/arm/cpu.h" ++#include "libavcodec/rpi_hevcdsp.h" ++#include "rpi_hevcdsp_arm.h" ++#include "libavcodec/avcodec.h" ++#include "libavcodec/bit_depth_template.c" ++ ++// NEON inter pred fns for qpel & epel (non-sand) exist in the git repo but ++// have been removed from head as we never use them. ++ ++void ff_hevc_rpi_v_loop_filter_luma_neon_8(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); ++void ff_hevc_rpi_h_loop_filter_luma_neon_8(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); ++ ++void ff_hevc_rpi_v_loop_filter_luma_neon_10(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); ++void ff_hevc_rpi_h_loop_filter_luma_neon_10(uint8_t *_pix, ptrdiff_t _stride, int _beta, int *_tc, uint8_t *_no_p, uint8_t *_no_q); ++ ++void ff_hevc_rpi_h_loop_filter_luma2_neon_8(uint8_t * _pix_r, ++ unsigned int _stride, unsigned int beta, unsigned int tc2, unsigned int no_f); ++void ff_hevc_rpi_v_loop_filter_luma2_neon_8(uint8_t * _pix_r, ++ unsigned int _stride, unsigned int beta, unsigned int tc2, unsigned int no_f, ++ uint8_t * _pix_l); ++void ff_hevc_rpi_h_loop_filter_uv_neon_8(uint8_t * src, unsigned int stride, uint32_t tc4, ++ unsigned int no_f); ++void ff_hevc_rpi_v_loop_filter_uv2_neon_8(uint8_t * src_r, unsigned int stride, uint32_t tc4, ++ uint8_t * src_l, ++ unsigned int no_f); ++ ++void ff_hevc_rpi_h_loop_filter_luma2_neon_10(uint8_t * _pix_r, ++ unsigned int _stride, unsigned int beta, unsigned int tc2, unsigned int no_f); ++void ff_hevc_rpi_v_loop_filter_luma2_neon_10(uint8_t * _pix_r, ++ unsigned int _stride, unsigned int beta, unsigned int tc2, unsigned int no_f, ++ uint8_t * _pix_l); ++void ff_hevc_rpi_h_loop_filter_uv_neon_10(uint8_t * src, unsigned int stride, uint32_t tc4, ++ unsigned int no_f); ++void ff_hevc_rpi_v_loop_filter_uv2_neon_10(uint8_t * src_r, unsigned int stride, uint32_t tc4, ++ uint8_t * src_l, ++ unsigned int no_f); ++ ++void ff_hevc_rpi_transform_4x4_neon_8(int16_t *coeffs, int col_limit); ++void ff_hevc_rpi_transform_8x8_neon_8(int16_t *coeffs, int col_limit); ++void ff_hevc_rpi_idct_4x4_dc_neon_8(int16_t *coeffs); ++void ff_hevc_rpi_idct_8x8_dc_neon_8(int16_t *coeffs); ++void ff_hevc_rpi_idct_16x16_dc_neon_8(int16_t *coeffs); ++void ff_hevc_rpi_idct_32x32_dc_neon_8(int16_t *coeffs); ++void ff_hevc_rpi_transform_luma_4x4_neon_8(int16_t *coeffs); ++ ++void ff_hevc_rpi_transform_4x4_neon_10(int16_t *coeffs, int col_limit); ++void ff_hevc_rpi_transform_8x8_neon_10(int16_t *coeffs, int col_limit); ++void ff_hevc_rpi_idct_4x4_dc_neon_10(int16_t *coeffs); ++void ff_hevc_rpi_idct_8x8_dc_neon_10(int16_t *coeffs); ++void ff_hevc_rpi_idct_16x16_dc_neon_10(int16_t *coeffs); ++void ff_hevc_rpi_idct_32x32_dc_neon_10(int16_t *coeffs); ++void ff_hevc_rpi_transform_luma_4x4_neon_10(int16_t *coeffs); ++ ++void ff_hevc_rpi_add_residual_4x4_neon_8(uint8_t *_dst, int16_t *coeffs, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_8x8_neon_8(uint8_t *_dst, int16_t *coeffs, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_16x16_neon_8(uint8_t *_dst, int16_t *coeffs, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_32x32_neon_8(uint8_t *_dst, int16_t *coeffs, ++ ptrdiff_t stride); ++ ++void ff_hevc_rpi_add_residual_4x4_dc_neon_8(uint8_t *_dst, ptrdiff_t stride, int dc); ++void ff_hevc_rpi_add_residual_8x8_dc_neon_8(uint8_t *_dst, ptrdiff_t stride, int dc); ++void ff_hevc_rpi_add_residual_16x16_dc_neon_8(uint8_t *_dst, ptrdiff_t stride, int dc); ++void ff_hevc_rpi_add_residual_32x32_dc_neon_8(uint8_t *_dst, ptrdiff_t stride, int dc); ++ ++ ++void ff_hevc_rpi_add_residual_4x4_neon_10(uint8_t *_dst, int16_t *coeffs, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_8x8_neon_10(uint8_t *_dst, int16_t *coeffs, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_16x16_neon_10(uint8_t *_dst, int16_t *coeffs, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_32x32_neon_10(uint8_t *_dst, int16_t *coeffs, ++ ptrdiff_t stride); ++ ++void ff_hevc_rpi_add_residual_4x4_dc_neon_10(uint8_t *_dst, ptrdiff_t stride, int dc); ++void ff_hevc_rpi_add_residual_8x8_dc_neon_10(uint8_t *_dst, ptrdiff_t stride, int dc); ++void ff_hevc_rpi_add_residual_16x16_dc_neon_10(uint8_t *_dst, ptrdiff_t stride, int dc); ++void ff_hevc_rpi_add_residual_32x32_dc_neon_10(uint8_t *_dst, ptrdiff_t stride, int dc); ++ ++ ++void ff_hevc_rpi_add_residual_4x4_u_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_v); ++void ff_hevc_rpi_add_residual_8x8_u_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_v); ++void ff_hevc_rpi_add_residual_16x16_u_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_v); ++void ff_hevc_rpi_add_residual_4x4_v_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_u); ++void ff_hevc_rpi_add_residual_8x8_v_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_u); ++void ff_hevc_rpi_add_residual_16x16_v_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_u); ++void ff_hevc_rpi_add_residual_4x4_c_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_8x8_c_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_16x16_c_neon_8(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_4x4_dc_c_neon_8(uint8_t *_dst, ptrdiff_t stride, int32_t dc); ++void ff_hevc_rpi_add_residual_8x8_dc_c_neon_8(uint8_t *_dst, ptrdiff_t stride, int32_t dc); ++void ff_hevc_rpi_add_residual_16x16_dc_c_neon_8(uint8_t *_dst, ptrdiff_t stride, int32_t dc); ++ ++ ++void ff_hevc_rpi_add_residual_4x4_u_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_v); ++void ff_hevc_rpi_add_residual_8x8_u_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_v); ++void ff_hevc_rpi_add_residual_16x16_u_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_v); ++void ff_hevc_rpi_add_residual_4x4_v_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_u); ++void ff_hevc_rpi_add_residual_8x8_v_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_u); ++void ff_hevc_rpi_add_residual_16x16_v_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride, int dc_u); ++void ff_hevc_rpi_add_residual_4x4_c_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_8x8_c_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_16x16_c_neon_10(uint8_t *_dst, const int16_t * residual, ++ ptrdiff_t stride); ++void ff_hevc_rpi_add_residual_4x4_dc_c_neon_10(uint8_t *_dst, ptrdiff_t stride, int32_t dc); ++void ff_hevc_rpi_add_residual_8x8_dc_c_neon_10(uint8_t *_dst, ptrdiff_t stride, int32_t dc); ++void ff_hevc_rpi_add_residual_16x16_dc_c_neon_10(uint8_t *_dst, ptrdiff_t stride, int32_t dc); ++ ++void ff_hevc_rpi_sao_edge_8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height); ++ ++void ff_hevc_rpi_sao_edge_8_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_16_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_32_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_64_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height); ++ ++void ff_hevc_rpi_sao_edge_c_8_neon_8(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *_sao_offset_val_u, const int16_t *_sao_offset_val_v, ++ int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_c_16_neon_8(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *_sao_offset_val_u, const int16_t *_sao_offset_val_v, ++ int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_c_32_neon_8(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *_sao_offset_val_u, const int16_t *_sao_offset_val_v, ++ int eo, int width, int height); ++ ++void ff_hevc_rpi_sao_edge_c_8_neon_10(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *_sao_offset_val_u, const int16_t *_sao_offset_val_v, ++ int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_c_16_neon_10(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *_sao_offset_val_u, const int16_t *_sao_offset_val_v, ++ int eo, int width, int height); ++void ff_hevc_rpi_sao_edge_c_32_neon_10(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *_sao_offset_val_u, const int16_t *_sao_offset_val_v, ++ int eo, int width, int height); ++ ++void ff_hevc_rpi_sao_band_c_8_neon_8(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height); ++void ff_hevc_rpi_sao_band_c_16_neon_8(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height); ++void ff_hevc_rpi_sao_band_c_32_neon_8(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height); ++ ++void ff_hevc_rpi_sao_band_c_8_neon_10(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height); ++void ff_hevc_rpi_sao_band_c_16_neon_10(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height); ++void ff_hevc_rpi_sao_band_c_32_neon_10(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height); ++ ++void ff_hevc_rpi_sao_band_8_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height); ++void ff_hevc_rpi_sao_band_16_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height); ++void ff_hevc_rpi_sao_band_32_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height); ++void ff_hevc_rpi_sao_band_64_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height); ++ ++void ff_hevc_rpi_sao_band_8_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height); ++void ff_hevc_rpi_sao_band_16_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height); ++void ff_hevc_rpi_sao_band_32_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height); ++void ff_hevc_rpi_sao_band_64_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height); ++ ++ ++uint32_t ff_hevc_rpi_deblocking_boundary_strengths_neon(int pus, int dup, const struct HEVCRpiMvField *curr, const struct HEVCRpiMvField *neigh, ++ const int *curr_rpl0, const int *curr_rpl1, const int *neigh_rpl0, const int *neigh_rpl1, ++ int in_inc0, int in_inc1); ++void ff_hevc_rpi_cpy_blks8x4_neon(uint8_t *dst, unsigned int stride_dst, const uint8_t *src, unsigned stride_src, unsigned int width, unsigned int height); ++ ++ ++static void ff_hevc_rpi_sao_edge_48_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height) ++{ ++ ff_hevc_rpi_sao_edge_32_neon_8(_dst, _src, stride_dst, _sao_offset_val, eo, 32, height); ++ ff_hevc_rpi_sao_edge_16_neon_8(_dst + 32, _src + 32, stride_dst, _sao_offset_val, eo, 16, height); ++} ++static void ff_hevc_rpi_sao_edge_48_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height) ++{ ++ ff_hevc_rpi_sao_edge_32_neon_10(_dst, _src, stride_dst, _sao_offset_val, eo, 32, height); ++ ff_hevc_rpi_sao_edge_16_neon_10(_dst + 64, _src + 64, stride_dst, _sao_offset_val, eo, 16, height); ++} ++ ++static void ff_hevc_rpi_sao_band_48_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height) ++{ ++ ff_hevc_rpi_sao_band_32_neon_8(_dst, _src, stride_dst, stride_src, sao_offset_val, sao_left_class, 32, height); ++ ff_hevc_rpi_sao_band_16_neon_8(_dst + 32, _src + 32, stride_dst, stride_src, sao_offset_val, sao_left_class, 16, height); ++} ++static void ff_hevc_rpi_sao_band_48_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height) ++{ ++ ff_hevc_rpi_sao_band_32_neon_10(_dst, _src, stride_dst, stride_src, sao_offset_val, sao_left_class, 32, height); ++ ff_hevc_rpi_sao_band_16_neon_10(_dst + 64, _src + 64, stride_dst, stride_src, sao_offset_val, sao_left_class, 16, height); ++} ++ ++#if SAO_FILTER_N == 6 ++static void ff_hevc_rpi_sao_edge_24_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height) ++{ ++ ff_hevc_rpi_sao_edge_16_neon_8(_dst, _src, stride_dst, _sao_offset_val, eo, 16, height); ++ ff_hevc_rpi_sao_edge_8_neon_8(_dst + 16, _src + 16, stride_dst, _sao_offset_val, eo, 8, height); ++} ++static void ff_hevc_rpi_sao_edge_24_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *_sao_offset_val, int eo, int width, int height) ++{ ++ ff_hevc_rpi_sao_edge_16_neon_10(_dst, _src, stride_dst, _sao_offset_val, eo, 16, height); ++ ff_hevc_rpi_sao_edge_8_neon_10(_dst + 32, _src + 32, stride_dst, _sao_offset_val, eo, 8, height); ++} ++ ++static void ff_hevc_rpi_sao_band_24_neon_8(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height) ++{ ++ ff_hevc_rpi_sao_band_16_neon_8(_dst, _src, stride_dst, stride_src, sao_offset_val, sao_left_class, 16, height); ++ ff_hevc_rpi_sao_band_8_neon_8(_dst + 16, _src + 16, stride_dst, stride_src, sao_offset_val, sao_left_class, 8, height); ++} ++static void ff_hevc_rpi_sao_band_24_neon_10(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, int width, int height) ++{ ++ ff_hevc_rpi_sao_band_16_neon_10(_dst, _src, stride_dst, stride_src, sao_offset_val, sao_left_class, 16, height); ++ ff_hevc_rpi_sao_band_8_neon_10(_dst + 32, _src + 32, stride_dst, stride_src, sao_offset_val, sao_left_class, 8, height); ++} ++ ++static void ff_hevc_rpi_sao_edge_c_24_neon_8(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *_sao_offset_val_u, const int16_t *_sao_offset_val_v, ++ int eo, int width, int height) ++{ ++ ff_hevc_rpi_sao_edge_c_16_neon_8(_dst, _src, stride_dst, _sao_offset_val_u, _sao_offset_val_v, eo, 16, height); ++ ff_hevc_rpi_sao_edge_c_8_neon_8(_dst + 32, _src + 32, stride_dst, _sao_offset_val_u, _sao_offset_val_v, eo, 8, height); ++} ++static void ff_hevc_rpi_sao_edge_c_24_neon_10(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *_sao_offset_val_u, const int16_t *_sao_offset_val_v, ++ int eo, int width, int height) ++{ ++ ff_hevc_rpi_sao_edge_c_16_neon_10(_dst, _src, stride_dst, _sao_offset_val_u, _sao_offset_val_v, eo, 16, height); ++ ff_hevc_rpi_sao_edge_c_8_neon_10(_dst + 64, _src + 64, stride_dst, _sao_offset_val_u, _sao_offset_val_v, eo, 8, height); ++} ++ ++static void ff_hevc_rpi_sao_band_c_24_neon_8(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height) ++{ ++ ff_hevc_rpi_sao_band_c_16_neon_8(_dst, _src, stride_dst, stride_src, ++ sao_offset_val_u, sao_left_class_u, sao_offset_val_v, sao_left_class_v, 16, height); ++ ff_hevc_rpi_sao_band_c_8_neon_8(_dst + 32, _src + 32, stride_dst, stride_src, ++ sao_offset_val_u, sao_left_class_u, sao_offset_val_v, sao_left_class_v, 8, height); ++} ++static void ff_hevc_rpi_sao_band_c_24_neon_10(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height) ++{ ++ ff_hevc_rpi_sao_band_c_16_neon_10(_dst, _src, stride_dst, stride_src, ++ sao_offset_val_u, sao_left_class_u, sao_offset_val_v, sao_left_class_v, 16, height); ++ ff_hevc_rpi_sao_band_c_8_neon_10(_dst + 64, _src + 64, stride_dst, stride_src, ++ sao_offset_val_u, sao_left_class_u, sao_offset_val_v, sao_left_class_v, 8, height); ++} ++#endif ++ ++ ++ ++#if RPI_HEVC_SAO_BUF_STRIDE != 160 ++#error SAO edge src stride not 160 - value used in .S ++#endif ++ ++av_cold void ff_hevcdsp_rpi_init_neon(HEVCDSPContext *c, const int bit_depth) ++{ ++ if (bit_depth == 8) { ++ c->hevc_v_loop_filter_luma = ff_hevc_rpi_v_loop_filter_luma_neon_8; ++ c->hevc_v_loop_filter_luma_c = ff_hevc_rpi_v_loop_filter_luma_neon_8; ++ c->hevc_h_loop_filter_luma = ff_hevc_rpi_h_loop_filter_luma_neon_8; ++ c->hevc_h_loop_filter_luma_c = ff_hevc_rpi_h_loop_filter_luma_neon_8; ++ c->hevc_h_loop_filter_luma2 = ff_hevc_rpi_h_loop_filter_luma2_neon_8; ++ c->hevc_v_loop_filter_luma2 = ff_hevc_rpi_v_loop_filter_luma2_neon_8; ++ c->hevc_h_loop_filter_uv = ff_hevc_rpi_h_loop_filter_uv_neon_8; ++ c->hevc_v_loop_filter_uv2 = ff_hevc_rpi_v_loop_filter_uv2_neon_8; ++ c->idct[0] = ff_hevc_rpi_transform_4x4_neon_8; ++ c->idct[1] = ff_hevc_rpi_transform_8x8_neon_8; ++ c->idct_dc[0] = ff_hevc_rpi_idct_4x4_dc_neon_8; ++ c->idct_dc[1] = ff_hevc_rpi_idct_8x8_dc_neon_8; ++ c->idct_dc[2] = ff_hevc_rpi_idct_16x16_dc_neon_8; ++ c->idct_dc[3] = ff_hevc_rpi_idct_32x32_dc_neon_8; ++ c->add_residual[0] = ff_hevc_rpi_add_residual_4x4_neon_8; ++ c->add_residual[1] = ff_hevc_rpi_add_residual_8x8_neon_8; ++ c->add_residual[2] = ff_hevc_rpi_add_residual_16x16_neon_8; ++ c->add_residual[3] = ff_hevc_rpi_add_residual_32x32_neon_8; ++ c->add_residual_dc[0] = ff_hevc_rpi_add_residual_4x4_dc_neon_8; ++ c->add_residual_dc[1] = ff_hevc_rpi_add_residual_8x8_dc_neon_8; ++ c->add_residual_dc[2] = ff_hevc_rpi_add_residual_16x16_dc_neon_8; ++ c->add_residual_dc[3] = ff_hevc_rpi_add_residual_32x32_dc_neon_8; ++ c->add_residual_u[0] = ff_hevc_rpi_add_residual_4x4_u_neon_8; ++ c->add_residual_u[1] = ff_hevc_rpi_add_residual_8x8_u_neon_8; ++ c->add_residual_u[2] = ff_hevc_rpi_add_residual_16x16_u_neon_8; ++ c->add_residual_v[0] = ff_hevc_rpi_add_residual_4x4_v_neon_8; ++ c->add_residual_v[1] = ff_hevc_rpi_add_residual_8x8_v_neon_8; ++ c->add_residual_v[2] = ff_hevc_rpi_add_residual_16x16_v_neon_8; ++ c->add_residual_c[0] = ff_hevc_rpi_add_residual_4x4_c_neon_8; ++ c->add_residual_c[1] = ff_hevc_rpi_add_residual_8x8_c_neon_8; ++ c->add_residual_c[2] = ff_hevc_rpi_add_residual_16x16_c_neon_8; ++ c->add_residual_dc_c[0] = ff_hevc_rpi_add_residual_4x4_dc_c_neon_8; ++ c->add_residual_dc_c[1] = ff_hevc_rpi_add_residual_8x8_dc_c_neon_8; ++ c->add_residual_dc_c[2] = ff_hevc_rpi_add_residual_16x16_dc_c_neon_8; ++ c->transform_4x4_luma = ff_hevc_rpi_transform_luma_4x4_neon_8; ++ c->sao_band_filter[0] = ff_hevc_rpi_sao_band_8_neon_8; ++ c->sao_band_filter[1] = ff_hevc_rpi_sao_band_16_neon_8; ++ c->sao_band_filter[2] = ff_hevc_rpi_sao_band_32_neon_8; ++ c->sao_band_filter[3] = ff_hevc_rpi_sao_band_48_neon_8; ++ c->sao_band_filter[4] = ff_hevc_rpi_sao_band_64_neon_8; ++ c->sao_edge_filter[0] = ff_hevc_rpi_sao_edge_8_neon_8; ++ c->sao_edge_filter[1] = ff_hevc_rpi_sao_edge_16_neon_8; ++ c->sao_edge_filter[2] = ff_hevc_rpi_sao_edge_32_neon_8; ++ c->sao_edge_filter[3] = ff_hevc_rpi_sao_edge_48_neon_8; ++ c->sao_edge_filter[4] = ff_hevc_rpi_sao_edge_64_neon_8; ++#if SAO_FILTER_N == 6 ++ c->sao_band_filter[5] = ff_hevc_rpi_sao_band_24_neon_8; ++ c->sao_edge_filter[5] = ff_hevc_rpi_sao_edge_24_neon_8; ++#endif ++ c->sao_band_filter_c[0] = ff_hevc_rpi_sao_band_c_8_neon_8; ++ c->sao_band_filter_c[1] = ff_hevc_rpi_sao_band_c_16_neon_8; ++ c->sao_band_filter_c[2] = ff_hevc_rpi_sao_band_c_32_neon_8; ++ ++ c->sao_edge_filter_c[0] = ff_hevc_rpi_sao_edge_c_8_neon_8; ++ c->sao_edge_filter_c[1] = ff_hevc_rpi_sao_edge_c_16_neon_8; ++ c->sao_edge_filter_c[2] = ff_hevc_rpi_sao_edge_c_32_neon_8; ++ ++#if SAO_FILTER_N == 6 ++ c->sao_band_filter_c[5] = ff_hevc_rpi_sao_band_c_24_neon_8; ++ c->sao_edge_filter_c[5] = ff_hevc_rpi_sao_edge_c_24_neon_8; ++#endif ++ } ++ else if (bit_depth == 10) { ++ c->hevc_v_loop_filter_luma = ff_hevc_rpi_v_loop_filter_luma_neon_10; ++ c->hevc_v_loop_filter_luma_c = ff_hevc_rpi_v_loop_filter_luma_neon_10; ++ c->hevc_h_loop_filter_luma = ff_hevc_rpi_h_loop_filter_luma_neon_10; ++ c->hevc_h_loop_filter_luma_c = ff_hevc_rpi_h_loop_filter_luma_neon_10; ++ c->hevc_h_loop_filter_luma2 = ff_hevc_rpi_h_loop_filter_luma2_neon_10; ++ c->hevc_v_loop_filter_luma2 = ff_hevc_rpi_v_loop_filter_luma2_neon_10; ++ c->hevc_h_loop_filter_uv = ff_hevc_rpi_h_loop_filter_uv_neon_10; ++ c->hevc_v_loop_filter_uv2 = ff_hevc_rpi_v_loop_filter_uv2_neon_10; ++ c->idct[0] = ff_hevc_rpi_transform_4x4_neon_10; ++ c->idct[1] = ff_hevc_rpi_transform_8x8_neon_10; ++ c->idct_dc[0] = ff_hevc_rpi_idct_4x4_dc_neon_10; ++ c->idct_dc[1] = ff_hevc_rpi_idct_8x8_dc_neon_10; ++ c->idct_dc[2] = ff_hevc_rpi_idct_16x16_dc_neon_10; ++ c->idct_dc[3] = ff_hevc_rpi_idct_32x32_dc_neon_10; ++ c->add_residual[0] = ff_hevc_rpi_add_residual_4x4_neon_10; ++ c->add_residual[1] = ff_hevc_rpi_add_residual_8x8_neon_10; ++ c->add_residual[2] = ff_hevc_rpi_add_residual_16x16_neon_10; ++ c->add_residual[3] = ff_hevc_rpi_add_residual_32x32_neon_10; ++ c->add_residual_dc[0] = ff_hevc_rpi_add_residual_4x4_dc_neon_10; ++ c->add_residual_dc[1] = ff_hevc_rpi_add_residual_8x8_dc_neon_10; ++ c->add_residual_dc[2] = ff_hevc_rpi_add_residual_16x16_dc_neon_10; ++ c->add_residual_dc[3] = ff_hevc_rpi_add_residual_32x32_dc_neon_10; ++ c->add_residual_u[0] = ff_hevc_rpi_add_residual_4x4_u_neon_10; ++ c->add_residual_u[1] = ff_hevc_rpi_add_residual_8x8_u_neon_10; ++ c->add_residual_u[2] = ff_hevc_rpi_add_residual_16x16_u_neon_10; ++ c->add_residual_v[0] = ff_hevc_rpi_add_residual_4x4_v_neon_10; ++ c->add_residual_v[1] = ff_hevc_rpi_add_residual_8x8_v_neon_10; ++ c->add_residual_v[2] = ff_hevc_rpi_add_residual_16x16_v_neon_10; ++ c->add_residual_c[0] = ff_hevc_rpi_add_residual_4x4_c_neon_10; ++ c->add_residual_c[1] = ff_hevc_rpi_add_residual_8x8_c_neon_10; ++ c->add_residual_c[2] = ff_hevc_rpi_add_residual_16x16_c_neon_10; ++ c->add_residual_dc_c[0] = ff_hevc_rpi_add_residual_4x4_dc_c_neon_10; ++ c->add_residual_dc_c[1] = ff_hevc_rpi_add_residual_8x8_dc_c_neon_10; ++ c->add_residual_dc_c[2] = ff_hevc_rpi_add_residual_16x16_dc_c_neon_10; ++ c->transform_4x4_luma = ff_hevc_rpi_transform_luma_4x4_neon_10; ++ c->sao_band_filter[0] = ff_hevc_rpi_sao_band_8_neon_10; ++ c->sao_band_filter[1] = ff_hevc_rpi_sao_band_16_neon_10; ++ c->sao_band_filter[2] = ff_hevc_rpi_sao_band_32_neon_10; ++ c->sao_band_filter[3] = ff_hevc_rpi_sao_band_48_neon_10; ++ c->sao_band_filter[4] = ff_hevc_rpi_sao_band_64_neon_10; ++ ++ c->sao_edge_filter[0] = ff_hevc_rpi_sao_edge_8_neon_10; ++ c->sao_edge_filter[1] = ff_hevc_rpi_sao_edge_16_neon_10; ++ c->sao_edge_filter[2] = ff_hevc_rpi_sao_edge_32_neon_10; ++ c->sao_edge_filter[3] = ff_hevc_rpi_sao_edge_48_neon_10; ++ c->sao_edge_filter[4] = ff_hevc_rpi_sao_edge_64_neon_10; ++#if SAO_FILTER_N == 6 ++ c->sao_band_filter[5] = ff_hevc_rpi_sao_band_24_neon_10; ++ c->sao_edge_filter[5] = ff_hevc_rpi_sao_edge_24_neon_10; ++#endif ++ c->sao_band_filter_c[0] = ff_hevc_rpi_sao_band_c_8_neon_10; ++ c->sao_band_filter_c[1] = ff_hevc_rpi_sao_band_c_16_neon_10; ++ c->sao_band_filter_c[2] = ff_hevc_rpi_sao_band_c_32_neon_10; ++ ++ c->sao_edge_filter_c[0] = ff_hevc_rpi_sao_edge_c_8_neon_10; ++ c->sao_edge_filter_c[1] = ff_hevc_rpi_sao_edge_c_16_neon_10; ++ c->sao_edge_filter_c[2] = ff_hevc_rpi_sao_edge_c_32_neon_10; ++ ++#if SAO_FILTER_N == 6 ++ c->sao_band_filter_c[5] = ff_hevc_rpi_sao_band_c_24_neon_10; ++ c->sao_edge_filter_c[5] = ff_hevc_rpi_sao_edge_c_24_neon_10; ++#endif ++ } ++ ++ assert(offsetof(HEVCRpiMvField, mv) == 0); ++ assert(offsetof(HEVCRpiMvField, ref_idx) == 8); ++ assert(offsetof(HEVCRpiMvField, pred_flag) == 10); ++ c->hevc_deblocking_boundary_strengths = ff_hevc_rpi_deblocking_boundary_strengths_neon; ++ c->cpy_blk = ff_hevc_rpi_cpy_blks8x4_neon; ++} +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcdsp_res16_neon.S +@@ -0,0 +1,620 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++ .arch_extension mp @ enable PLDW ++ ++#define BIT_DEPTH 10 ++ ++.macro clip16_4 Q0, Q1, Q2, Q3, Q_MIN, Q_MAX ++ vmax.s16 \Q0, \Q_MIN ++ vmax.s16 \Q1, \Q_MIN ++ vmax.s16 \Q2, \Q_MIN ++ vmax.s16 \Q3, \Q_MIN ++ vmin.s16 \Q0, \Q_MAX ++ vmin.s16 \Q1, \Q_MAX ++ vmin.s16 \Q2, \Q_MAX ++ vmin.s16 \Q3, \Q_MAX ++.endm ++ ++@ add_residual4x4( ++@ uint16_t *_dst, [r0] ++@ int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_4x4_neon_, BIT_DEPTH), export=1 ++ add ip, r0, r2 ++ vld1.16 {q10, q11}, [r1] ++ lsl r2, #1 ++ vld1.16 {d0}, [r0 :64], r2 ++ vld1.16 {d1}, [ip :64], r2 ++ vld1.16 {d2}, [r0 :64] ++ vld1.16 {d3}, [ip :64] ++ sub r0, r2 ++ vqadd.s16 q0, q10 ++ sub ip, r2 ++ vqadd.s16 q1, q11 ++ vmov.i16 q8, #0 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ vmax.s16 q0, q0, q8 ++ vmax.s16 q1, q1, q8 ++ vmin.s16 q0, q0, q9 ++ vmin.s16 q1, q1, q9 ++ vst1.16 {d0}, [r0 :64], r2 ++ vst1.16 {d1}, [ip :64], r2 ++ vst1.16 {d2}, [r0 :64] ++ vst1.16 {d3}, [ip :64] ++ bx lr ++ ++endfunc ++ ++@ add_residual4x4_dc( ++@ uint16_t *_dst, [r0] ++@ ptrdiff_t stride, [r1] ++@ int dc) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_4x4_dc_neon_, BIT_DEPTH), export=1 ++ add ip, r0, r1 ++ vdup.16 q15, r2 ++ lsl r1, #1 ++ vld1.16 {d0}, [r0 :64], r1 ++ vld1.16 {d1}, [ip :64], r1 ++ vld1.16 {d2}, [r0 :64] ++ vld1.16 {d3}, [ip :64] ++ sub r0, r1 ++ vqadd.s16 q0, q15 ++ sub ip, r1 ++ vqadd.s16 q1, q15 ++ vmov.i16 q8, #0 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ vmax.s16 q0, q0, q8 ++ vmax.s16 q1, q1, q8 ++ vmin.s16 q0, q0, q9 ++ vmin.s16 q1, q1, q9 ++ vst1.16 {d0}, [r0 :64], r1 ++ vst1.16 {d1}, [ip :64], r1 ++ vst1.16 {d2}, [r0 :64] ++ vst1.16 {d3}, [ip :64] ++ bx lr ++ ++endfunc ++ ++ ++@ add_residual8x8( ++@ uint16_t *_dst, [r0] ++@ int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_8x8_neon_, BIT_DEPTH), export=1 ++ mov r3, #8 ++ vmov.i64 q8, #0 ++ add ip, r0, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ lsl r2, #1 ++1: ++ vldm r1!, {q10-q13} ++ vld1.16 {q0}, [r0 :128], r2 ++ vld1.16 {q1}, [ip :128], r2 ++ vld1.16 {q2}, [r0 :128] ++ vld1.16 {q3}, [ip :128] ++ sub r0, r2 ++ vqadd.s16 q0, q10 ++ sub ip, r2 ++ vqadd.s16 q1, q11 ++ subs r3, #4 ++ vqadd.s16 q2, q12 ++ vqadd.s16 q3, q13 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst1.16 {q0}, [r0 :128], r2 ++ vst1.16 {q1}, [ip :128], r2 ++ vst1.16 {q2}, [r0 :128], r2 ++ vst1.16 {q3}, [ip :128], r2 ++ bne 1b ++ bx lr ++ ++endfunc ++ ++@ add_residual4x4_dc_c( ++@ uint16_t *_dst, [r0] ++@ ptrdiff_t stride, [r1] ++@ int dc_uv) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_4x4_dc_c_neon_, BIT_DEPTH), export=1 ++ mov r3, #4 ++ vdup.32 q15, r2 ++ b 9f ++endfunc ++ ++@ add_residual8x8_dc( ++@ uint16_t *_dst, [r0] ++@ ptrdiff_t stride, [r1] ++@ int dc) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_8x8_dc_neon_, BIT_DEPTH), export=1 ++ vdup.16 q15, r2 ++ mov r3, #8 ++9: ++ vmov.i16 q8, #0 ++ add ip, r0, r1 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ lsl r1, #1 ++1: ++ vld1.16 {q0}, [r0 :128], r1 ++ vld1.16 {q1}, [ip :128], r1 ++ vld1.16 {q2}, [r0 :128] ++ vld1.16 {q3}, [ip :128] ++ sub r0, r1 ++ vqadd.s16 q0, q15 ++ sub ip, r1 ++ vqadd.s16 q1, q15 ++ subs r3, #4 ++ vqadd.s16 q2, q15 ++ vqadd.s16 q3, q15 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst1.16 {q0}, [r0 :128], r1 ++ vst1.16 {q1}, [ip :128], r1 ++ vst1.16 {q2}, [r0 :128], r1 ++ vst1.16 {q3}, [ip :128], r1 ++ bne 1b ++ bx lr ++ ++endfunc ++ ++@ add_residual16x16( ++@ uint16_t *_dst, [r0] ++@ int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_16x16_neon_, BIT_DEPTH), export=1 ++ add ip, r0, r2 ++ vmov.i16 q8, #0 ++ lsl r2, #1 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ mov r3, #16 ++1: ++ vldm r1!, {q10-q13} ++ @ For RPI Sand we could guarantee :256 but not for general ++ @ non-RPI allocation. :128 is as good as we can claim ++ vld1.16 {q0, q1}, [r0 :128] ++ subs r3, #2 ++ vld1.16 {q2, q3}, [ip :128] ++ vqadd.s16 q0, q10 ++ vqadd.s16 q1, q11 ++ vqadd.s16 q2, q12 ++ vqadd.s16 q3, q13 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst1.16 {q0, q1}, [r0 :128], r2 ++ vst1.16 {q2, q3}, [ip :128], r2 ++ bne 1b ++ bx lr ++endfunc ++ ++@ add_residual8x8_dc_c( ++@ uint16_t *_dst, [r0] ++@ ptrdiff_t stride, [r1] ++@ int dc_uv) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_8x8_dc_c_neon_, BIT_DEPTH), export=1 ++ mov r3, #8 ++ vdup.32 q15, r2 ++ b 9f ++endfunc ++ ++@ add_residual16x16_dc( ++@ uint16_t *_dst, [r0] ++@ ptrdiff_t stride, [r1] ++@ int dc) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_16x16_dc_neon_, BIT_DEPTH), export=1 ++ vdup.i16 q15, r2 ++ mov r3, #16 ++9: ++ vmov.i16 q8, #0 ++ add ip, r0, r1 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ lsl r1, #1 ++1: ++ @ For RPI Sand we could guarantee :256 but not for general ++ @ non-RPI allocation. :128 is as good as we can claim ++ vld1.16 {q0, q1}, [r0 :128] ++ subs r3, #2 ++ vqadd.s16 q0, q15 ++ vqadd.s16 q1, q15 ++ vld1.16 {q2, q3}, [ip :128] ++ vqadd.s16 q2, q15 ++ vqadd.s16 q3, q15 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst1.16 {q0, q1}, [r0 :128], r1 ++ vst1.16 {q2, q3}, [ip :128], r1 ++ bne 1b ++ bx lr ++ ++endfunc ++ ++ ++@ add_residual32x32( ++@ uint16_t *_dst, [r0] ++@ int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_32x32_neon_, BIT_DEPTH), export=1 ++ push {lr} ++ mov r3, #32 ++ vmov.i16 q8, #0 ++ add lr, r0, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ add ip, r0, #32 ++1: ++ vldm r1!, {q10-q13} ++ vldm r0, {q0-q3} ++ vqadd.s16 q0, q10 ++ pldw [lr] ++ vqadd.s16 q1, q11 ++ add lr, r2 ++ vqadd.s16 q2, q12 ++ subs r3, #1 ++ vqadd.s16 q3, q13 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst1.16 {q0-q1}, [r0], r2 ++ vst1.16 {q2-q3}, [ip], r2 ++ bne 1b ++ pop {pc} ++ ++endfunc ++ ++@ add_residual16x16_dc_c( ++@ uint16_t *_dst, [r0] ++@ ptrdiff_t stride, [r1] ++@ int dc_uv) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_16x16_dc_c_neon_, BIT_DEPTH), export=1 ++ mov r3, #16 ++ vdup.32 q15, r2 ++ b 9f ++endfunc ++ ++@ add_residual32x32_dc( ++@ uint16_t *_dst, [r0] ++@ ptrdiff_t stride, [r1] ++@ int dc) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_32x32_dc_neon_, BIT_DEPTH), export=1 ++ vdup.16 q15, r2 ++ mov r3, #32 ++9: ++ vmov.i16 q8, #0 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ add ip, r0, #32 ++1: ++ vldm r0, {q0-q3} ++ vqadd.s16 q0, q15 ++ subs r3, #1 ++ vqadd.s16 q1, q15 ++ vqadd.s16 q2, q15 ++ vqadd.s16 q3, q15 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst1.16 {q0-q1}, [r0], r1 ++ vst1.16 {q2-q3}, [ip], r1 ++ bne 1b ++ bx lr ++ ++endfunc ++ ++@ ============================================================================ ++@ U add ++ ++@ add_residual4x4_u( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride, [r2] ++@ int dc) [r3] ++ ++function JOIN(ff_hevc_rpi_add_residual_4x4_u_neon_, BIT_DEPTH), export=1 ++ vdup.16 q15, r3 ++ add ip, r0, r2 ++ vld1.16 {q10, q11}, [r1 :256] ++ lsl r2, #1 ++ vld2.16 {d0, d2}, [r0 :128], r2 ++ vld2.16 {d1, d3}, [ip :128], r2 ++ vld2.16 {d4, d6}, [r0 :128] ++ vld2.16 {d5, d7}, [ip :128] ++ sub r0, r2 ++ vmov.i16 q8, #0 ++ sub ip, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ ++ vqadd.s16 q0, q10 ++ vqadd.s16 q1, q15 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q3, q15 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ ++ vst2.16 {d0, d2}, [r0 :128], r2 ++ vst2.16 {d1, d3}, [ip :128], r2 ++ vst2.16 {d4, d6}, [r0 :128] ++ vst2.16 {d5, d7}, [ip :128] ++ bx lr ++endfunc ++ ++@ add_residual8x8_u( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride, [r2] ++@ int dc) [r3] ++ ++function JOIN(ff_hevc_rpi_add_residual_8x8_u_neon_, BIT_DEPTH), export=1 ++ vdup.16 q15, r3 ++ mov r3, #8 ++ vmov.i16 q8, #0 ++ add ip, r0, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ lsl r2, #1 ++1: ++ vld2.16 {q0, q1}, [r0 :256] ++ subs r3, #2 ++ vld2.16 {q2, q3}, [ip :256] ++ vld1.16 {q10, q11}, [r1 :256]! ++ vqadd.s16 q0, q10 ++ vqadd.s16 q1, q15 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q3, q15 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst2.16 {q0, q1}, [r0 :256], r2 ++ vst2.16 {q2, q3}, [ip :256], r2 ++ bne 1b ++ bx lr ++endfunc ++ ++@ add_residual16x16_u( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride, [r2] ++@ int dc) [r3] ++ ++function JOIN(ff_hevc_rpi_add_residual_16x16_u_neon_, BIT_DEPTH), export=1 ++ push {lr} ++ vdup.16 q15, r3 ++ mov r3, #16 ++ vmov.i16 q8, #0 ++ add lr, r0, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ add ip, r0, #32 ++1: ++ vld2.16 {q0, q1}, [r0 :256] ++ vld2.16 {q2, q3}, [ip :256] ++ vld1.16 {q10, q11}, [r1 :256]! ++ vqadd.s16 q0, q10 ++ pldw [lr] ++ vqadd.s16 q1, q15 ++ add lr, r2 ++ vqadd.s16 q2, q11 ++ subs r3, #1 ++ vqadd.s16 q3, q15 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst2.16 {q0, q1}, [r0 :256], r2 ++ vst2.16 {q2, q3}, [ip :256], r2 ++ bne 1b ++ pop {pc} ++endfunc ++ ++@ ============================================================================ ++@ V add ++ ++@ add_residual4x4_v( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride, [r2] ++@ int dc) [r3] ++ ++function JOIN(ff_hevc_rpi_add_residual_4x4_v_neon_, BIT_DEPTH), export=1 ++ vdup.16 q15, r3 ++ add ip, r0, r2 ++ vld1.16 {q10, q11}, [r1 :256] ++ lsl r2, #1 ++ vld2.16 {d0, d2}, [r0 :128], r2 ++ vld2.16 {d1, d3}, [ip :128], r2 ++ vld2.16 {d4, d6}, [r0 :128] ++ vld2.16 {d5, d7}, [ip :128] ++ sub r0, r2 ++ vmov.i16 q8, #0 ++ sub ip, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ ++ vqadd.s16 q0, q15 ++ vqadd.s16 q1, q10 ++ vqadd.s16 q2, q15 ++ vqadd.s16 q3, q11 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ ++ vst2.16 {d0, d2}, [r0 :128], r2 ++ vst2.16 {d1, d3}, [ip :128], r2 ++ vst2.16 {d4, d6}, [r0 :128] ++ vst2.16 {d5, d7}, [ip :128] ++ bx lr ++endfunc ++ ++@ add_residual8x8_v( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride, [r2] ++@ int dc) [r3] ++ ++function JOIN(ff_hevc_rpi_add_residual_8x8_v_neon_, BIT_DEPTH), export=1 ++ vdup.16 q15, r3 ++ mov r3, #8 ++ vmov.i16 q8, #0 ++ add ip, r0, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ lsl r2, #1 ++1: ++ vld2.16 {q0, q1}, [r0 :256] ++ subs r3, #2 ++ vld2.16 {q2, q3}, [ip :256] ++ vld1.16 {q10, q11}, [r1 :256]! ++ vqadd.s16 q0, q15 ++ vqadd.s16 q1, q10 ++ vqadd.s16 q2, q15 ++ vqadd.s16 q3, q11 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst2.16 {q0, q1}, [r0 :256], r2 ++ vst2.16 {q2, q3}, [ip :256], r2 ++ bne 1b ++ bx lr ++endfunc ++ ++@ add_residual16x16_v( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride, [r2] ++@ int dc) [r3] ++ ++function JOIN(ff_hevc_rpi_add_residual_16x16_v_neon_, BIT_DEPTH), export=1 ++ push {lr} ++ vdup.16 q15, r3 ++ mov r3, #16 ++ vmov.i16 q8, #0 ++ add lr, r0, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ add ip, r0, #32 ++1: ++ vld2.16 {q0, q1}, [r0 :256] ++ vld2.16 {q2, q3}, [ip :256] ++ vld1.16 {q10, q11}, [r1 :256]! ++ vqadd.s16 q0, q15 ++ pldw [lr] ++ vqadd.s16 q1, q10 ++ add lr, r2 ++ vqadd.s16 q2, q15 ++ subs r3, #1 ++ vqadd.s16 q3, q11 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst2.16 {q0, q1}, [r0 :256], r2 ++ vst2.16 {q2, q3}, [ip :256], r2 ++ bne 1b ++ pop {pc} ++endfunc ++ ++@ ============================================================================ ++@ U & V add ++ ++@ add_residual4x4_c( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_4x4_c_neon_, BIT_DEPTH), export=1 ++ vmov.i16 q8, #0 ++ add ip, r0, r2 ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ lsl r2, #1 ++ vldm r1, {q10-q13} ++ vld2.16 {d0, d2}, [r0 :128], r2 ++ vld2.16 {d1, d3}, [ip :128], r2 ++ vld2.16 {d4, d6}, [r0 :128] ++ vld2.16 {d5, d7}, [ip :128] ++ ++ sub r0, r2 ++ vqadd.s16 q0, q10 ++ sub ip, r2 ++ vqadd.s16 q1, q12 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q3, q13 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ ++ vst2.16 {d0, d2}, [r0 :128], r2 ++ vst2.16 {d1, d3}, [ip :128], r2 ++ vst2.16 {d4, d6}, [r0 :128] ++ vst2.16 {d5, d7}, [ip :128] ++ bx lr ++endfunc ++ ++@ add_residual8x8_c( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_8x8_c_neon_, BIT_DEPTH), export=1 ++ push {lr} ++ add ip, r0, r2 ++ lsl r2, #1 ++ vmov.i16 q8, #0 ++ add r3, r1, #(8*8*2) @ Offset to V ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ mov lr, #8 ++1: ++ vld1.16 {q10, q11}, [r1 :256]! ++ subs lr, #2 ++ vld2.16 {q0, q1}, [r0 :256] ++ vld2.16 {q2, q3}, [ip :256] ++ vld1.16 {q12, q13}, [r3 :256]! ++ vqadd.s16 q0, q10 ++ vqadd.s16 q1, q12 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q3, q13 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst2.16 {q0, q1}, [r0 :256], r2 ++ vst2.16 {q2, q3}, [ip :256], r2 ++ bne 1b ++ pop {pc} ++endfunc ++ ++@ add_residual16x16_c( ++@ uint16_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function JOIN(ff_hevc_rpi_add_residual_16x16_c_neon_, BIT_DEPTH), export=1 ++ push {r4, lr} ++ vmov.i16 q8, #0 ++ add r3, r1, #(16*16*2) @ Offset to V ++ vmov.i16 q9, #(1 << BIT_DEPTH) - 1 ++ add ip, r0, #32 ++ add r4, r0, r2 ++ mov lr, #16 ++1: ++ vld2.16 {q0, q1}, [r0 :256] ++ vld2.16 {q2, q3}, [ip :256] ++ vld1.16 {q10, q11}, [r1 :256]! ++ vld1.16 {q12, q13}, [r3 :256]! ++ vqadd.s16 q0, q10 ++ pldw [r4] ++ vqadd.s16 q1, q12 ++ add r4, r2 ++ vqadd.s16 q2, q11 ++ subs lr, #1 ++ vqadd.s16 q3, q13 ++ clip16_4 q0, q1, q2, q3, q8, q9 ++ vst2.16 {q0, q1}, [r0 :256], r2 ++ vst2.16 {q2, q3}, [ip :256], r2 ++ bne 1b ++ pop {r4,pc} ++endfunc ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcdsp_res8_neon.S +@@ -0,0 +1,741 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++ .arch_extension mp @ enable PLDW ++ ++@ General notes: ++@ ++@ Residual is generally only guaranteed to be clipped to 16 bits. ++@ This means that we do need to do vmovl, vqadd, vqmovun ++@ rather than vaddw, vqmovun (if we were clipped to 15 then we could get away ++@ with this). ++@ ++@ There is an exception for the DC case because its transform is guaranteed ++@ to be small enough that overflow cannot occur during the first add. ++ ++@ ============================================================================ ++@ Y add ++ ++function ff_hevc_rpi_add_residual_4x4_neon_8, export=1 ++ add ip, r0, r2 ++ vld1.16 {q0, q1}, [r1] ++ lsl r2, #1 ++ vld1.32 d4[0], [r0], r2 ++ rsb r3, r2, #0 ++ vld1.32 d4[1], [ip], r2 ++ vld1.32 d5[0], [r0], r3 ++ vld1.32 d5[1], [ip], r3 ++ vmovl.u8 q8, d4 ++ vmovl.u8 q9, d5 ++ vqadd.s16 q0, q8 ++ vqadd.s16 q1, q9 ++ vqmovun.s16 d0, q0 ++ vqmovun.s16 d1, q1 ++ vst1.32 d0[0], [r0], r2 ++ vst1.32 d0[1], [ip], r2 ++ vst1.32 d1[0], [r0] ++ vst1.32 d1[1], [ip] ++ bx lr ++endfunc ++ ++function ff_hevc_rpi_add_residual_8x8_neon_8, export=1 ++ push {r4, lr} ++ vld1.16 {q0, q1}, [r1]! ++ add ip, r0, r2 ++ vld1.8 {d6}, [r0] ++ add r4, r0, r2, lsl #1 ++ vld1.8 {d7}, [ip] ++ add lr, ip, r2, lsl #1 ++ lsl r2, #1 ++ mov r3, #8-2 ++ vmovl.u8 q2, d6 ++ vmovl.u8 q3, d7 ++ vqadd.s16 q2, q0 ++ vqadd.s16 q3, q1 ++1: ++ vld1.16 {q0, q1}, [r1]! ++ subs r3, #2 ++ vqmovun.s16 d4, q2 ++ vqmovun.s16 d5, q3 ++ vld1.8 {d6}, [r4], r2 ++ vld1.8 {d7}, [lr], r2 ++ vst1.8 {d4}, [r0], r2 ++ vst1.8 {d5}, [ip], r2 ++ vmovl.u8 q2, d6 ++ pldw [r4] ++ vmovl.u8 q3, d7 ++ vqadd.s16 q2, q0 ++ vqadd.s16 q3, q1 ++ bne 1b ++ ++ vqmovun.s16 d4, q2 ++ vqmovun.s16 d5, q3 ++ vst1.8 {d4}, [r0] ++ vst1.8 {d5}, [ip] ++ pop {r4, pc} ++endfunc ++ ++function ff_hevc_rpi_add_residual_16x16_neon_8, export=1 ++ vld1.16 {q0, q1}, [r1]! ++ add ip, r0, r2 ++ vld1.8 {q3}, [r0] ++ mov r3, #16-1 ++ vmovl.u8 q2, d6 ++ vmovl.u8 q3, d7 ++ vqadd.s16 q2, q0 ++ vqadd.s16 q3, q1 ++1: ++ vld1.16 {q0, q1}, [r1]! ++ subs r3, #1 ++ vqmovun.s16 d4, q2 ++ vqmovun.s16 d5, q3 ++ vld1.8 {q3}, [ip], r2 ++ vst1.8 {q2}, [r0], r2 ++ vmovl.u8 q2, d6 ++ pldw [ip] ++ vmovl.u8 q3, d7 ++ vqadd.s16 q2, q0 ++ vqadd.s16 q3, q1 ++ bne 1b ++ ++ vqmovun.s16 d4, q2 ++ vqmovun.s16 d5, q3 ++ vst1.8 {q2}, [r0] ++ bx lr ++endfunc ++ ++function ff_hevc_rpi_add_residual_32x32_neon_8, export=1 ++ vldm r1!, {q0-q3} ++ vld1.8 {q8, q9}, [r0] ++ add ip, r0, r2 ++ vmovl.u8 q10, d16 ++ mov r3, #32-1 ++ vmovl.u8 q11, d17 ++ vmovl.u8 q12, d18 ++ vmovl.u8 q13, d19 ++ vqadd.s16 q10, q0 ++ vqadd.s16 q11, q1 ++ vqadd.s16 q12, q2 ++ vqadd.s16 q13, q3 ++1: ++ vldm r1!, {q0-q3} ++ vqmovun.s16 d20, q10 ++ vqmovun.s16 d21, q11 ++ vqmovun.s16 d22, q12 ++ vqmovun.s16 d23, q13 ++ vld1.8 {q8, q9}, [ip], r2 ++ subs r3, #1 ++ vst1.8 {q10, q11}, [r0], r2 ++ vmovl.u8 q10, d16 ++ pldw [ip] ++ vmovl.u8 q11, d17 ++ vmovl.u8 q12, d18 ++ vmovl.u8 q13, d19 ++ vqadd.s16 q10, q0 ++ vqadd.s16 q11, q1 ++ vqadd.s16 q12, q2 ++ vqadd.s16 q13, q3 ++ bne 1b ++ ++ vqmovun.s16 d20, q10 ++ vqmovun.s16 d21, q11 ++ vqmovun.s16 d22, q12 ++ vqmovun.s16 d23, q13 ++ vst1.8 {q10, q11}, [r0] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_add_residual_4x4_dc_neon_8( ++@ uint8_t * dst, // [r0] ++@ unsigned int stride, // [r1] ++@ int dc) // [r2] ++ ++function ff_hevc_rpi_add_residual_4x4_dc_neon_8, export=1 ++ add ip, r0, r1 ++ vdup.16 q15, r2 ++ lsl r1, #1 ++ vld1.32 d4[0], [r0], r1 ++ rsb r3, r1, #0 ++ vld1.32 d4[1], [ip], r1 ++ vld1.32 d5[0], [r0], r3 ++ vld1.32 d5[1], [ip], r3 ++ vaddw.u8 q0, q15, d4 ++ vaddw.u8 q1, q15, d5 ++ vqmovun.s16 d0, q0 ++ vqmovun.s16 d1, q1 ++ vst1.32 d0[0], [r0], r1 ++ vst1.32 d0[1], [ip], r1 ++ vst1.32 d1[0], [r0] ++ vst1.32 d1[1], [ip] ++ bx lr ++endfunc ++ ++@ ============================================================================ ++@ DC Y or C add ++ ++@ ff_hevc_rpi_add_residual_4x4_dc_c_neon_8( ++@ uint8_t * dst, // [r0] ++@ unsigned int stride, // [r1] ++@ int dc) // [r2] ++ ++function ff_hevc_rpi_add_residual_4x4_dc_c_neon_8, export=1 ++ mov r3, #4-2 ++ vdup.32 q15, r2 ++ b 1f ++endfunc ++ ++@ ff_hevc_rpi_add_residual_8x8_dc_neon_8( ++@ uint8_t * dst, // [r0] ++@ unsigned int stride, // [r1] ++@ int dc) // [r2] ++ ++function ff_hevc_rpi_add_residual_8x8_dc_neon_8, export=1 ++ vdup.16 q15, r2 ++ mov r3, #8-2 ++1: vld1.8 d16, [r0] ++ add ip, r0, r1 ++ push {r4, lr} ++ vld1.8 d17, [ip] ++ add r4, r0, r1, lsl #1 ++ vaddw.u8 q0, q15, d16 ++ lsl r1, #1 ++ vaddw.u8 q1, q15, d17 ++ add lr, ip, r1 ++1: ++ vld1.8 {d16}, [r4], r1 ++ vld1.8 {d17}, [lr], r1 ++ subs r3, #2 ++ vqmovun.s16 d4, q0 ++ vqmovun.s16 d5, q1 ++ vaddw.u8 q0, q15, d16 ++ vaddw.u8 q1, q15, d17 ++ vst1.8 {d4}, [r0], r1 ++ vst1.8 {d5}, [ip], r1 ++ bne 1b ++ ++ vqmovun.s16 d4, q0 ++ vqmovun.s16 d5, q1 ++ vst1.8 {d4}, [r0] ++ vst1.8 {d5}, [ip] ++ pop {r4, pc} ++endfunc ++ ++ ++@ ff_hevc_rpi_add_residual_8x8_dc_c_neon_8( ++@ uint8_t * dst, // [r0] ++@ unsigned int stride, // [r1] ++@ int dc) // [r2] ++ ++function ff_hevc_rpi_add_residual_8x8_dc_c_neon_8, export=1 ++ mov r3, #8-1 ++ vdup.32 q15, r2 ++ b 1f ++endfunc ++ ++@ ff_hevc_rpi_add_residual_16x16_dc_neon_8( ++@ uint8_t * dst, // [r0] ++@ unsigned int stride, // [r1] ++@ int dc) // [r2] ++ ++function ff_hevc_rpi_add_residual_16x16_dc_neon_8, export=1 ++ vdup.16 q15, r2 ++ mov r3, #16-1 ++1: vld1.8 {q8}, [r0] ++ add ip, r0, r1 ++ vaddw.u8 q0, q15, d16 ++ vaddw.u8 q1, q15, d17 ++1: ++ vld1.8 {q8}, [ip], r1 ++ subs r3, #1 ++ vqmovun.s16 d4, q0 ++ vqmovun.s16 d5, q1 ++ vaddw.u8 q0, q15, d16 ++ vaddw.u8 q1, q15, d17 ++ vst1.8 {q2}, [r0], r1 ++ bne 1b ++ ++ vqmovun.s16 d4, q0 ++ vqmovun.s16 d5, q1 ++ vst1.8 {q2}, [r0] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_add_residual_16x16_dc_c_neon_8( ++@ uint8_t * dst, // [r0] ++@ unsigned int stride, // [r1] ++@ int dc) // [r2] ++ ++function ff_hevc_rpi_add_residual_16x16_dc_c_neon_8, export=1 ++ mov r3, #16-1 ++ vdup.32 q15, r2 ++ b 1f ++endfunc ++ ++@ ff_hevc_rpi_add_residual_32x32_dc_neon_8( ++@ uint8_t * dst, // [r0] ++@ unsigned int stride, // [r1] ++@ int dc) // [r2] ++ ++function ff_hevc_rpi_add_residual_32x32_dc_neon_8, export=1 ++ vdup.16 q15, r2 ++ mov r3, #32-1 ++1: vld1.8 {q8, q9}, [r0] ++ add ip, r0, r1 ++ vaddw.u8 q0, q15, d16 ++ vaddw.u8 q1, q15, d17 ++ vaddw.u8 q2, q15, d18 ++ vaddw.u8 q3, q15, d19 ++1: ++ vqmovun.s16 d20, q0 ++ vqmovun.s16 d21, q1 ++ vqmovun.s16 d22, q2 ++ vqmovun.s16 d23, q3 ++ vld1.8 {q8, q9}, [ip], r1 ++ subs r3, #1 ++ vaddw.u8 q0, q15, d16 ++ vaddw.u8 q1, q15, d17 ++ vaddw.u8 q2, q15, d18 ++ vaddw.u8 q3, q15, d19 ++ vst1.8 {q10, q11}, [r0], r1 ++ bne 1b ++ ++ vqmovun.s16 d20, q0 ++ vqmovun.s16 d21, q1 ++ vqmovun.s16 d22, q2 ++ vqmovun.s16 d23, q3 ++ vst1.8 {q10, q11}, [r0] ++ bx lr ++endfunc ++ ++@ ============================================================================ ++@ U add ++ ++@ add_residual4x4_c( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride, [r2] ++@ int dc_v) [r3] ++ ++function ff_hevc_rpi_add_residual_4x4_u_neon_8, export=1 ++ add ip, r0, r2 ++ vld1.16 {q0, q1}, [r1] ++ lsl r2, #1 ++ vld1.8 {d16}, [r0 :64], r2 ++ vld1.8 {d17}, [ip :64], r2 ++ vld1.8 {d18}, [r0 :64] ++ sub r0, r2 ++ vld1.8 {d19}, [ip :64] ++ sub ip, r2 ++ vdup.16 q2, r3 ++ vdup.16 q3, r3 ++ vmovl.u8 q10, d16 ++ vmovl.u8 q11, d17 ++ vmovl.u8 q12, d18 ++ vmovl.u8 q13, d19 ++ vzip.16 q0, q2 ++ vzip.16 q1, q3 ++ vqadd.s16 q0, q10 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q1, q12 ++ vqadd.s16 q3, q13 ++ vqmovun.s16 d0, q0 ++ vqmovun.s16 d1, q2 ++ vqmovun.s16 d2, q1 ++ vqmovun.s16 d3, q3 ++ vst1.8 {d0}, [r0 :64], r2 ++ vst1.8 {d1}, [ip :64], r2 ++ vst1.8 {d2}, [r0 :64] ++ vst1.8 {d3}, [ip :64] ++ bx lr ++endfunc ++ ++@ add_residual8x8_c( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++@ int dc_v) [r3] ++ ++function ff_hevc_rpi_add_residual_8x8_u_neon_8, export=1 ++ vdup.16 q15, r3 ++ add ip, r0, r2 ++ push {r4, lr} ++ vld2.8 {d16, d17}, [r0 :128] ++ lsl r2, #1 ++ vld2.8 {d18, d19}, [ip :128] ++ mov r3, #8-2 ++ vld1.16 {q0, q1}, [r1 :256]! ++ add r4, r0, r2 ++ vmovl.u8 q10, d16 ++ add lr, ip, r2 ++ vmovl.u8 q11, d18 ++ vqadd.s16 q0, q10 ++ vaddw.u8 q2, q15, d17 ++ vqadd.s16 q1, q11 ++ vaddw.u8 q3, q15, d19 ++1: ++ vqmovun.s16 d20, q0 ++ vqmovun.s16 d21, q2 ++ vld2.8 {d16, d17}, [r4 :128], r2 ++ subs r3, #2 ++ vqmovun.s16 d22, q1 ++ vqmovun.s16 d23, q3 ++ vst2.8 {d20, d21}, [r0 :128], r2 ++ vld2.8 {d18, d19}, [lr :128], r2 ++ vst2.8 {d22, d23}, [ip :128], r2 ++ vld1.16 {q0, q1}, [r1 :256]! ++ vmovl.u8 q10, d16 ++ vmovl.u8 q11, d18 ++ vqadd.s16 q0, q10 ++ vaddw.u8 q2, q15, d17 ++ vqadd.s16 q1, q11 ++ vaddw.u8 q3, q15, d19 ++ bne 1b ++ ++ vqmovun.s16 d20, q0 ++ vqmovun.s16 d21, q2 ++ vqmovun.s16 d22, q1 ++ vqmovun.s16 d23, q3 ++ vst2.8 {d20, d21}, [r0 :128] ++ vst2.8 {d22, d23}, [ip :128] ++ pop {r4, pc} ++endfunc ++ ++@ add_residual16x16_u( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++@ int dc_v) [r3] ++ ++function ff_hevc_rpi_add_residual_16x16_u_neon_8, export=1 ++ vdup.16 q15, r3 ++ add ip, r0, r2 ++ vld2.8 {q8, q9}, [r0 :256] ++ mov r3, #16-1 ++ vld1.16 {q0, q1}, [r1 :256]! ++ vmovl.u8 q11, d16 ++ vmovl.u8 q12, d17 ++ vqadd.s16 q0, q11 ++ vaddw.u8 q11, q15, d18 ++ vqadd.s16 q1, q12 ++ vaddw.u8 q12, q15, d19 ++1: ++ vld2.8 {q8, q9}, [ip :256], r2 ++ subs r3, #1 ++ vqmovun.s16 d20, q0 ++ vqmovun.s16 d22, q11 ++ vqmovun.s16 d21, q1 ++ vqmovun.s16 d23, q12 ++ vld1.16 {q0, q1}, [r1 :256]! ++ vst2.8 {q10, q11}, [r0 :256], r2 ++ vmovl.u8 q11, d16 ++ pldw [ip] ++ vmovl.u8 q12, d17 ++ vqadd.s16 q0, q11 ++ vaddw.u8 q11, q15, d18 ++ vqadd.s16 q1, q12 ++ vaddw.u8 q12, q15, d19 ++ bne 1b ++ ++ vqmovun.s16 d20, q0 ++ vqmovun.s16 d22, q11 ++ vqmovun.s16 d21, q1 ++ vqmovun.s16 d23, q12 ++ vst2.8 {q10, q11}, [r0 :256] ++ bx lr ++endfunc ++ ++@ ============================================================================ ++@ V add ++ ++@ add_residual4x4_v( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function ff_hevc_rpi_add_residual_4x4_v_neon_8, export=1 ++ add ip, r0, r2 ++ vld1.16 {q2, q3}, [r1] ++ lsl r2, #1 ++ vld1.8 {d16}, [r0 :64], r2 ++ vld1.8 {d17}, [ip :64], r2 ++ vld1.8 {d18}, [r0 :64] ++ sub r0, r2 ++ vld1.8 {d19}, [ip :64] ++ sub ip, r2 ++ vdup.16 q0, r3 ++ vdup.16 q1, r3 ++ vmovl.u8 q10, d16 ++ vmovl.u8 q11, d17 ++ vmovl.u8 q12, d18 ++ vmovl.u8 q13, d19 ++ vzip.16 q0, q2 ++ vzip.16 q1, q3 ++ vqadd.s16 q0, q10 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q1, q12 ++ vqadd.s16 q3, q13 ++ vqmovun.s16 d0, q0 ++ vqmovun.s16 d1, q2 ++ vqmovun.s16 d2, q1 ++ vqmovun.s16 d3, q3 ++ vst1.8 {d0}, [r0 :64], r2 ++ vst1.8 {d1}, [ip :64], r2 ++ vst1.8 {d2}, [r0 :64] ++ vst1.8 {d3}, [ip :64] ++ bx lr ++endfunc ++ ++@ add_residual8x8_v( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function ff_hevc_rpi_add_residual_8x8_v_neon_8, export=1 ++ vdup.16 q15, r3 ++ add ip, r0, r2 ++ push {r4, lr} ++ vld2.8 {d16, d17}, [r0 :128] ++ lsl r2, #1 ++ vld2.8 {d18, d19}, [ip :128] ++ mov r3, #8-2 ++ vld1.16 {q0, q1}, [r1 :256]! ++ add r4, r0, r2 ++ vmovl.u8 q10, d17 ++ add lr, ip, r2 ++ vmovl.u8 q11, d19 ++ vqadd.s16 q0, q10 ++ vaddw.u8 q2, q15, d16 ++ vqadd.s16 q1, q11 ++ vaddw.u8 q3, q15, d18 ++1: ++ vqmovun.s16 d20, q2 ++ vqmovun.s16 d21, q0 ++ vld2.8 {d16, d17}, [r4 :128], r2 ++ subs r3, #2 ++ vqmovun.s16 d22, q3 ++ vqmovun.s16 d23, q1 ++ vst2.8 {d20, d21}, [r0 :128], r2 ++ vld2.8 {d18, d19}, [lr :128], r2 ++ vst2.8 {d22, d23}, [ip :128], r2 ++ vld1.16 {q0, q1}, [r1 :256]! ++ vmovl.u8 q10, d17 ++ vmovl.u8 q11, d19 ++ vqadd.s16 q0, q10 ++ vaddw.u8 q2, q15, d16 ++ vqadd.s16 q1, q11 ++ vaddw.u8 q3, q15, d18 ++ bne 1b ++ ++ vqmovun.s16 d20, q2 ++ vqmovun.s16 d21, q0 ++ vqmovun.s16 d22, q3 ++ vqmovun.s16 d23, q1 ++ vst2.8 {d20, d21}, [r0 :128] ++ vst2.8 {d22, d23}, [ip :128] ++ pop {r4, pc} ++endfunc ++ ++@ add_residual16x16_v( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function ff_hevc_rpi_add_residual_16x16_v_neon_8, export=1 ++ vdup.16 q15, r3 ++ add ip, r0, r2 ++ vld2.8 {q8, q9}, [r0 :256] ++ mov r3, #16-1 ++ vld1.16 {q0, q1}, [r1 :256]! ++ vmovl.u8 q11, d18 ++ vmovl.u8 q12, d19 ++ vqadd.s16 q0, q11 ++ vaddw.u8 q11, q15, d16 ++ vqadd.s16 q1, q12 ++ vaddw.u8 q12, q15, d17 ++1: ++ vld2.8 {q8, q9}, [ip :256], r2 ++ subs r3, #1 ++ vqmovun.s16 d20, q11 ++ vqmovun.s16 d22, q0 ++ vqmovun.s16 d21, q12 ++ vqmovun.s16 d23, q1 ++ vld1.16 {q0, q1}, [r1 :256]! ++ vst2.8 {q10, q11}, [r0 :256], r2 ++ vmovl.u8 q11, d18 ++ pldw [ip] ++ vmovl.u8 q12, d19 ++ vqadd.s16 q0, q11 ++ vaddw.u8 q11, q15, d16 ++ vqadd.s16 q1, q12 ++ vaddw.u8 q12, q15, d17 ++ bne 1b ++ ++ vqmovun.s16 d20, q11 ++ vqmovun.s16 d22, q0 ++ vqmovun.s16 d21, q12 ++ vqmovun.s16 d23, q1 ++ vst2.8 {q10, q11}, [r0 :256] ++ bx lr ++endfunc ++ ++@ ============================================================================ ++@ U & V add ++ ++@ add_residual4x4_c( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function ff_hevc_rpi_add_residual_4x4_c_neon_8, export=1 ++ add ip, r0, r2 ++ vld1.16 {q0, q1}, [r1]! @ all of U ++ lsl r2, #1 ++ vld1.8 {d16}, [r0 :64], r2 ++ rsb r3, r2, #0 ++ vld1.8 {d17}, [ip :64], r2 ++ vld1.16 {q2, q3}, [r1] @ all of V ++ vld1.8 {d18}, [r0 :64], r3 ++ vld1.8 {d19}, [ip :64], r3 ++ vmovl.u8 q10, d16 ++ vmovl.u8 q11, d17 ++ vmovl.u8 q12, d18 ++ vmovl.u8 q13, d19 ++ vzip.16 q0, q2 ++ vzip.16 q1, q3 ++ vqadd.s16 q0, q10 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q1, q12 ++ vqadd.s16 q3, q13 ++ vqmovun.s16 d0, q0 ++ vqmovun.s16 d1, q2 ++ vqmovun.s16 d2, q1 ++ vqmovun.s16 d3, q3 ++ vst1.8 {d0}, [r0 :64], r2 ++ vst1.8 {d1}, [ip :64], r2 ++ vst1.8 {d2}, [r0 :64] ++ vst1.8 {d3}, [ip :64] ++ bx lr ++endfunc ++ ++@ add_residual8x8_c( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function ff_hevc_rpi_add_residual_8x8_c_neon_8, export=1 ++ vld2.8 {d16, d17}, [r0 :128] ++ add r3, r1, #(8*8*2) @ Offset to V ++ vld1.16 {q0}, [r1 :128]! ++ add ip, r0, r2 ++ vld1.16 {q1}, [r3 :128]! ++ vmovl.u8 q10, d16 ++ push {lr} ++ vmovl.u8 q8, d17 ++ mov lr, #8-1 ++ vqadd.s16 q10, q0 ++ vqadd.s16 q1, q8 ++1: ++ vld2.8 {d16, d17}, [ip :128], r2 ++ subs lr, #1 ++ vld1.16 {q0}, [r1 :128]! ++ vqmovun.s16 d20, q10 ++ vqmovun.s16 d21, q1 ++ vld1.16 {q1}, [r3 :128]! ++ vst2.8 {d20, d21}, [r0 :128], r2 ++ vmovl.u8 q10, d16 ++ pldw [ip] ++ vmovl.u8 q8, d17 ++ vqadd.s16 q10, q0 ++ vqadd.s16 q1, q8 ++ bne 1b ++ ++ vqmovun.s16 d20, q10 ++ vqmovun.s16 d21, q1 ++ vst2.8 {d20, d21}, [r0 :128] ++ pop {pc} ++endfunc ++ ++@ add_residual16x16_c( ++@ uint8_t *_dst, [r0] ++@ const int16_t *res, [r1] ++@ ptrdiff_t stride) [r2] ++ ++function ff_hevc_rpi_add_residual_16x16_c_neon_8, export=1 ++ vld2.8 {q8, q9}, [r0 :256] ++ add r3, r1, #(16*16*2) @ Offset to V ++ vld1.16 {q0, q1}, [r1 :256]! ++ add ip, r0, r2 ++ vld1.16 {q2, q3}, [r3 :256]! ++ vmovl.u8 q10, d16 ++ push {lr} ++ vmovl.u8 q8, d17 ++ mov lr, #16-1 ++ vmovl.u8 q11, d18 ++ vmovl.u8 q9, d19 ++ vqadd.s16 q0, q10 ++ vqadd.s16 q1, q8 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q3, q9 ++1: ++ vld2.8 {q8, q9}, [ip :256], r2 ++ subs lr, #1 ++ vqmovun.s16 d20, q0 ++ vqmovun.s16 d22, q2 ++ vqmovun.s16 d21, q1 ++ vqmovun.s16 d23, q3 ++ vld1.16 {q0, q1}, [r1 :256]! ++ vst2.8 {d20-d23}, [r0 :256], r2 ++ vld1.16 {q2, q3}, [r3 :256]! ++ vmovl.u8 q10, d16 ++ pldw [ip] ++ vmovl.u8 q8, d17 ++ vmovl.u8 q11, d18 ++ vmovl.u8 q9, d19 ++ vqadd.s16 q0, q10 ++ vqadd.s16 q1, q8 ++ vqadd.s16 q2, q11 ++ vqadd.s16 q3, q9 ++ bne 1b ++ ++ vqmovun.s16 d20, q0 ++ vqmovun.s16 d22, q2 ++ vqmovun.s16 d21, q1 ++ vqmovun.s16 d23, q3 ++ vst2.8 {d20-d23}, [r0 :256] ++ pop {pc} ++endfunc ++ ++@ 32x32 chroma never occurs so NIF ++ ++@ ============================================================================ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcdsp_sao_neon.S +@@ -0,0 +1,2245 @@ ++/* ++ * Copyright (c) 2014 - 2015 Seppo Tomperi ++ * 2017 John Cox (for Raspberry Pi) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++.set EDGE_SRC_STRIDE, 160 ++ ++@ PIC jump tables are fractionally more expensive than absolute in our code ++.set jent_pic, CONFIG_PIC ++ ++ ++.macro sao_band_64b_8 XLAT0, XLAT1, Q_K128, I1, I2, I3, I4 ++ vshr.u8 q12, q8, #3 ++ \I1 ++ vadd.i8 q8, \Q_K128 ++ \I2 ++ vshr.u8 q13, q9, #3 ++ \I3 ++ vadd.i8 q9, \Q_K128 ++ \I4 ++ vtbl.8 d24, \XLAT0, d24 ++ vtbl.8 d25, \XLAT0, d25 ++ vtbl.8 d26, \XLAT1, d26 ++ vtbl.8 d27, \XLAT1, d27 ++ ++ vqadd.s8 q8, q12 ++ vshr.u8 q12, q10, #3 ++ vadd.i8 q10, \Q_K128 ++ vqadd.s8 q9, q13 ++ vshr.u8 q13, q11, #3 ++ vadd.i8 q11, \Q_K128 ++ ++ vtbl.8 d24, \XLAT0, d24 ++ vtbl.8 d25, \XLAT0, d25 ++ vtbl.8 d26, \XLAT1, d26 ++ vtbl.8 d27, \XLAT1, d27 ++ vqadd.s8 q10, q12 ++ vsub.i8 q8, \Q_K128 ++ vqadd.s8 q11, q13 ++ vsub.i8 q9, \Q_K128 ++ vsub.i8 q10, \Q_K128 ++ vsub.i8 q11, \Q_K128 ++.endm ++ ++.macro sao_band_16b_8 XLAT0, XLAT1, Q_K128, L1, L2, L3, L4, L5, S1, S2, S3, S4 ++ \L1 ++ \L2 ++ \L3 ++ \L4 ++ \L5 ++ vadd.i8 q12, q8, \Q_K128 ++ vshr.u8 q8, #3 ++ vtbl.8 d16, \XLAT0, d16 ++ vtbl.8 d17, \XLAT1, d17 ++ vqadd.s8 q12, q8 ++ bmi 2f ++1: \L1 ++ \L2 ++ \L3 ++ \L4 ++ \L5 ++ vsub.i8 q13, q12, \Q_K128 ++ vadd.i8 q12, q8, \Q_K128 ++ vshr.u8 q8, #3 ++ \S1 ++ \S2 ++ \S3 ++ \S4 ++ vtbl.8 d16, \XLAT0, d16 ++ vtbl.8 d17, \XLAT1, d17 ++ vqadd.s8 q12, q8 ++ bpl 1b ++2: vsub.i8 q13, q12, \Q_K128 ++ \S1 ++ \S2 ++ \S3 ++ \S4 ++.endm ++ ++ ++.macro clip16_4 Q0, Q1, Q2, Q3, Q_MIN, Q_MAX ++ vmax.s16 \Q0, \Q_MIN ++ vmax.s16 \Q1, \Q_MIN ++ vmax.s16 \Q2, \Q_MIN ++ vmax.s16 \Q3, \Q_MIN ++ vmin.s16 \Q0, \Q_MAX ++ vmin.s16 \Q1, \Q_MAX ++ vmin.s16 \Q2, \Q_MAX ++ vmin.s16 \Q3, \Q_MAX ++.endm ++ ++@ Clobbers q12, q13 ++.macro sao_band_64b_16 Q0, Q1, Q2, Q3, XLAT0, XLAT1, Q_MIN, Q_MAX, bit_depth, I1, I2 ++ vshrn.i16 d24, \Q0, #(\bit_depth - 5) ++ vshrn.i16 d25, \Q1, #(\bit_depth - 5) ++ vshrn.i16 d26, \Q2, #(\bit_depth - 5) ++ \I1 ++ vtbl.8 d24, \XLAT0, d24 ++ vshrn.i16 d27, \Q3, #(\bit_depth - 5) ++ vtbl.8 d25, \XLAT1, d25 ++ \I2 ++ vtbl.8 d26, \XLAT0, d26 ++ vtbl.8 d27, \XLAT1, d27 ++ vaddw.s8 \Q0, d24 ++ vaddw.s8 \Q1, d25 ++ vaddw.s8 \Q2, d26 ++ vaddw.s8 \Q3, d27 ++ clip16_4 \Q0, \Q1, \Q2, \Q3, \Q_MIN, \Q_MAX ++.endm ++ ++@ Clobbers q10, q11, q12 ++.macro sao_band_32b_16 Q0, Q1, XLAT0, XLAT1, Q_MIN, Q_MAX, bit_depth, L1, L2, L3, L4, L5, S1, S2, S3, S4 ++ \L1 ++ \L2 ++ \L3 ++ \L4 ++ \L5 ++ vshrn.i16 d24, \Q0, #\bit_depth - 5 ++ vshrn.i16 d25, \Q1, #\bit_depth - 5 ++ vtbl.8 d24, \XLAT0, d24 ++ vtbl.8 d25, \XLAT1, d25 ++ vaddw.s8 q10, \Q0, d24 ++ vaddw.s8 q11, \Q1, d25 ++ bmi 2f ++1: \L1 ++ \L2 ++ \L3 ++ \L4 ++ \L5 ++ vmax.s16 q10, \Q_MIN ++ vmax.s16 q11, \Q_MIN ++ vshrn.i16 d24, \Q0, #\bit_depth - 5 ++ vshrn.i16 d25, \Q1, #\bit_depth - 5 ++ vmin.s16 q10, \Q_MAX ++ vmin.s16 q11, \Q_MAX ++ \S1 ++ \S2 ++ \S3 ++ \S4 ++ vtbl.8 d24, \XLAT0, d24 ++ vtbl.8 d25, \XLAT1, d25 ++ vaddw.s8 q10, \Q0, d24 ++ vaddw.s8 q11, \Q1, d25 ++ bpl 1b ++2: vmax.s16 q10, \Q_MIN ++ vmax.s16 q11, \Q_MIN ++ vmin.s16 q10, \Q_MAX ++ vmin.s16 q11, \Q_MAX ++ \S1 ++ \S2 ++ \S3 ++ \S4 ++.endm ++ ++ ++@ Standard coding rules for sao_offset_abs limit it to 0-31 (Table 9-38) ++@ so we are quite safe stuffing it into a byte array ++@ There may be a subsequent shl by log2_sao_offset_scale_luma/chroma ++@ (7.4.3.3.2 && 7-70) but we should still be safe to at least 12 bits of ++@ precision ++ ++@ This, somewhat nasty, bit of code builds the {d0-d3} translation ++@ array via the stack ++@ Given that sao_left_class > 28 can cause wrap we can't just poke ++@ all 4 bytes in at once ++@ ++@ It also loads other common regs ++ ++@ Beware that the offset read here overrreads by 6 bytes so source must be sized appropriately ++function band_load_y ++ ldr ip, [sp, #16] @ &sao_offset_val[0] ++ ldr r4, [sp, #20] @ sao_left_class ++ vmov.i64 d4, #0 ++ vmov.i64 q0, #0 ++ pld [r1] ++ vld2.8 {q8}, [ip] ++ sub ip, sp, #8*5 ++ vmov.i64 q1, #0 ++ add r4, ip, r4 ++ vpush {d0-d4} @ Put zero array on stack ++ vshr.u64 d16, d16, #8 @ 1st interesting val is [1] ++ ldr ip, [ip, #8*5 + 28] @ height ++ vst1.32 {d16[0]}, [r4] ++ add r4, r1, r3 ++ vpop {d0-d4} @ Pop modified array ++ sub ip, ip, #1 ++ vorr d0, d0, d4 ++ bx lr ++endfunc ++ ++@ Beware that offset reads here overrread by 6 bytes so source must be sized appropriately ++function band_load_c ++ ldr ip, [sp, #16] @ &sao_offset_val1[0] ++ ldr r4, [sp, #20] @ sao_left_class1 ++ vmov.i64 d24, #0 ++ vmov.i64 q10, #0 ++ pld [r1] ++ vld2.8 {q8}, [ip] ++ sub ip, sp, #8*5 ++ vmov.i64 q11, #0 ++ add r4, ip, r4 ++ ldr ip, [sp, #24] @ &sao_offset_val2[0] ++ vpush {d20-d24} @ Put zero array on stack ++ vld2.8 {q9}, [ip] ++ vshr.u64 d16, d16, #8 @ 1st interesting val is [1] ++ ldr ip, [sp, #8*5 + 28] @ sao_left_class2 ++ vst1.32 {d16[0]}, [r4] ++ add ip, sp, ip ++ vshr.u64 d18, d18, #8 @ 1st interesting val is [1] ++ vldmia sp, {d0-d3} @ Load modified array ++ vldr d16, [sp, #8*4] ++ add r4, r1, r3 ++ vstmia sp, {d20-d24} @ Put zero array on stack (again) ++ vst1.32 {d18[0]}, [ip] ++ vorr d0, d0, d16 ++ vldmia sp, {d4-d7} @ Load modified array ++ vldr d18, [sp, #8*4] ++ ldr ip, [sp, #8*5 + 36] @ height ++ add sp, sp, #8*5 ++ vorr d4, d4, d18 ++ sub ip, ip, #1 ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_sao_band_64_neon_8 ( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ ptrdiff_t stride_src, [r3] ++@ int16_t *sao_offset_val, [sp, #0] ++@ int sao_left_class, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_band_64_neon_8, export=1 ++ push {r4-r6, lr} ++ vmov.u8 q15, #128 ++ bl band_load_y ++ ++1: vldmia r1, {q8-q11} ++ sao_band_64b_8 {d0-d3}, {d0-d3}, q15, \ ++ "pld [r4]", \ ++ "subs ip, #1", \ ++ "it ne; addne r4, r3", \ ++ "add r1, r3" ++ vstmia r0, {q8-q11} ++ add r0, r2 ++ bpl 1b ++ ++ pop {r4-r6, pc} ++endfunc ++ ++@ ff_hevc_rpi_sao_band_32_neon_8 ( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ ptrdiff_t stride_src, [r3] ++@ int16_t *sao_offset_val, [sp, #0] ++@ int sao_left_class, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_band_32_neon_8, export=1 ++ push {r4-r6, lr} ++ add r5, r0, r2 ++ add r6, r1, r3 ++ lsl r2, #1 ++ lsl r3, #1 ++ vmov.u8 q15, #128 ++ bl band_load_y ++ ++1: vld1.8 { q8, q9 }, [r1, :128], r3 ++ subs ip, #2 ++ vld1.8 {q10, q11}, [r6, :128], r3 ++ ++ sao_band_64b_8 {d0-d3}, {d0-d3}, q15 ++ ++ vst1.8 { q8, q9 }, [r0, :128], r2 ++ vst1.8 {q10, q11}, [r5, :128], r2 ++ bpl 1b ++ ++ pop {r4-r6, pc} ++endfunc ++ ++@ ff_hevc_rpi_sao_band_16_neon_8 ( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ ptrdiff_t stride_src, [r3] ++@ int16_t *sao_offset_val, [sp, #0] ++@ int sao_left_class, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_band_16_neon_8, export=1 ++ push {r4-r6, lr} ++ add r5, r0, r2 ++ add r6, r1, r3 ++ lsl r2, #1 ++ lsl r3, #1 ++ vmov.u8 q15, #128 ++ bl band_load_y ++ ++1: vld1.8 { q8}, [r1, :128], r3 ++ subs ip, #4 ++ vld1.8 { q9}, [r6, :128], r3 ++ vld1.8 {q10}, [r1, :128], r3 ++ vld1.8 {q11}, [r6, :128], r3 ++ ++ sao_band_64b_8 {d0-d3}, {d0-d3}, q15 ++ ++ vst1.8 { q8}, [r0, :128], r2 ++ vst1.8 { q9}, [r5, :128], r2 ++ vst1.8 {q10}, [r0, :128], r2 ++ vst1.8 {q11}, [r5, :128], r2 ++ bpl 1b ++ ++ pop {r4-r6, pc} ++endfunc ++ ++@ ff_hevc_rpi_sao_band_8_neon_8 ( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ ptrdiff_t stride_src, [r3] ++@ int16_t *sao_offset_val, [sp, #0] ++@ int sao_left_class, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_band_8_neon_8, export=1 ++ ldr ip, [sp, #8] @ width ++ push {r4-r6, lr} ++ vmov.u8 q15, #128 ++ cmp ip, #8 ++ bl band_load_y ++ add r5, r0, r2 ++ add r6, r1, r3 ++ lsl r2, #1 ++ lsl r3, #1 ++ blt 4f ++ ++ sao_band_16b_8 {d0-d3}, {d0-d3}, q15, \ ++ "vld1.8 {d16}, [r1, :64], r3", \ ++ "subs ip, #2", \ ++ "vld1.8 {d17}, [r6, :64], r3", \ ++ "", \ ++ "", \ ++ "vst1.8 {d26}, [r0, :64], r2", \ ++ "vst1.8 {d27}, [r5, :64], r2" ++ pop {r4-r6, pc} ++4: ++ sao_band_16b_8 {d0-d3}, {d0-d3}, q15, \ ++ "vld1.32 {d16[0]}, [r1, :32], r3", \ ++ "subs ip, #4", \ ++ "vld1.32 {d16[1]}, [r6, :32], r3", \ ++ "vld1.32 {d17[0]}, [r1, :32], r3", \ ++ "vld1.32 {d17[1]}, [r6, :32], r3", \ ++ "vst1.32 {d26[0]}, [r0, :32], r2", \ ++ "vst1.32 {d26[1]}, [r5, :32], r2", \ ++ "vst1.32 {d27[0]}, [r0, :32], r2", \ ++ "vst1.32 {d27[1]}, [r5, :32], r2" ++ pop {r4-r6, pc} ++endfunc ++ ++@ ff_hevc_rpi_sao_band_c_32_neon_8( ++@ uint8_t * dst [r0] ++@ uint8_t * src [r1] ++@ uint32_t dst_stride [r2] ++@ uint32_t src_stride [r3] ++@ const int16_t * table1 sp[0] ++@ uint32_t offset1 sp[4] ++@ const int16_t * table2 sp[8] ++@ uint32_t offset2 sp[12] ++@ int width sp[16] ++@ int height sp[20] ++ ++function ff_hevc_rpi_sao_band_c_32_neon_8, export=1 ++ push {r4-r6, lr} ++ add r5, r0, #32 ++ add r6, r1, #32 ++ vmov.u8 q15, #128 ++ bl band_load_c ++ ++1: vld2.8 { q8, q9 }, [r1, :128], r3 ++ subs ip, #1 ++ vld2.8 {q10, q11}, [r6, :128], r3 ++ ++ sao_band_64b_8 {d0-d3}, {d4-d7}, q15, \ ++ "pld [r4]", \ ++ "it ne; addne r4, r3" ++ ++ vst2.8 { q8, q9 }, [r0, :128], r2 ++ vst2.8 {q10, q11}, [r5, :128], r2 ++ bpl 1b ++ ++ pop {r4-r6, pc} ++endfunc ++ ++@ ff_hevc_rpi_sao_band_c_16_neon_8( ++@ uint8_t * dst [r0] ++@ uint8_t * src [r1] ++@ uint32_t dst_stride [r2] ++@ uint32_t src_stride [r3] ++@ const int16_t * table1 sp[0] ++@ uint32_t offset1 sp[4] ++@ const int16_t * table2 sp[8] ++@ uint32_t offset2 sp[12] ++@ int width sp[16] ++@ int height sp[20] ++ ++function ff_hevc_rpi_sao_band_c_16_neon_8, export=1 ++ push {r4-r6, lr} ++ add r5, r0, r2 ++ add r6, r1, r3 ++ lsl r2, #1 ++ lsl r3, #1 ++ vmov.u8 q15, #128 ++ bl band_load_c ++ ++1: vld2.8 { q8, q9 }, [r1, :128], r3 ++ subs ip, #2 ++ vld2.8 {q10, q11}, [r6, :128], r3 ++ ++ sao_band_64b_8 {d0-d3}, {d4-d7}, q15 ++ ++ vst2.8 { q8, q9 }, [r0, :128], r2 ++ vst2.8 {q10, q11}, [r5, :128], r2 ++ bpl 1b ++ ++ pop {r4-r6, pc} ++endfunc ++ ++@ ff_hevc_rpi_sao_band_c_8_neon_8( ++@ uint8_t * dst [r0] ++@ uint8_t * src [r1] ++@ uint32_t dst_stride [r2] ++@ uint32_t src_stride [r3] ++@ const int16_t * table1 sp[0] ++@ uint32_t offset1 sp[4] ++@ const int16_t * table2 sp[8] ++@ uint32_t offset2 sp[12] ++@ int width sp[16] ++@ int height sp[20] ++ ++function ff_hevc_rpi_sao_band_c_8_neon_8, export=1 ++ ldr ip, [sp, #16] @ width ++ push {r4-r6, lr} ++ vmov.u8 q15, #128 ++ cmp ip, #8 ++ bl band_load_c ++ blt 4f ++ ++ sao_band_16b_8 {d0-d3}, {d4-d7}, q15, \ ++ "vld2.8 {d16-d17}, [r1, :128], r3", \ ++ "subs ip, #1", \ ++ "", \ ++ "", \ ++ "", \ ++ "vst2.8 {d26-d27}, [r0, :128], r2" ++ pop {r4-r6, pc} ++4: ++ add r5, r0, r2 ++ add r6, r1, r3 ++ lsl r2, #1 ++ lsl r3, #1 ++ sao_band_16b_8 {d0-d3}, {d4-d7}, q15, \ ++ "vld1.8 {d16}, [r1, :64], r3", \ ++ "subs ip, #2", \ ++ "vld1.8 {d17}, [r6, :64], r3", \ ++ "vuzp.8 d16, d17", \ ++ "", \ ++ "vzip.8 d26, d27", \ ++ "vst1.8 {d26}, [r0, :64], r2", \ ++ "vst1.8 {d27}, [r5, :64], r2" ++ pop {r4-r6, pc} ++endfunc ++ ++ ++@ ff_hevc_rpi_sao_band_64_neon_10 ( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ ptrdiff_t stride_src, [r3] ++@ int16_t *sao_offset_val, [sp, #0] ++@ int sao_left_class, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++.macro band_64_16 bit_depth ++ push {r4-r6, lr} ++ vmov.i64 q2, #0 ++ vmov.i16 q3, #(1 << \bit_depth) - 1 ++ bl band_load_y ++ vpush {q4-q7} ++ ++1: vldm r1, {q4-q11} ++ sao_band_64b_16 q4, q5, q6, q7, {d0-d3}, {d0-d3}, q2, q3, \bit_depth, \ ++ "subs ip, #1", \ ++ "add r1, r3" ++ sao_band_64b_16 q8, q9, q10, q11, {d0-d3}, {d0-d3}, q2, q3, \bit_depth ++ vstm r0, {q4-q11} ++ add r0, r2 ++ bpl 1b ++ ++ vpop {q4-q7} ++ pop {r4-r6, pc} ++.endm ++ ++function ff_hevc_rpi_sao_band_64_neon_10, export=1 ++ band_64_16 10 ++endfunc ++ ++@ ff_hevc_rpi_sao_band_32_neon_10 ( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ ptrdiff_t stride_src, [r3] ++@ int16_t *sao_offset_val, [sp, #0] ++@ int sao_left_class, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++.macro band_32_16 bit_depth ++ push {r4-r6, lr} ++ vmov.i64 q2, #0 ++ vmov.i16 q3, #(1 << \bit_depth) - 1 ++ bl band_load_y ++ ++1: vldm r1, {q8-q11} ++ sao_band_64b_16 q8, q9, q10, q11, {d0-d3}, {d0-d3}, q2, q3, \bit_depth, \ ++ "subs ip, #1", \ ++ "add r1, r3" ++ vstm r0, {q8-q11} ++ add r0, r2 ++ bpl 1b ++ ++ pop {r4-r6, pc} ++.endm ++ ++function ff_hevc_rpi_sao_band_32_neon_10, export=1 ++ band_32_16 10 ++endfunc ++ ++@ ff_hevc_rpi_sao_band_16_neon_10 ( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ ptrdiff_t stride_src, [r3] ++@ int16_t *sao_offset_val, [sp, #0] ++@ int sao_left_class, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++.macro band_16_16 bit_depth ++ push {r4-r6, lr} ++ add r5, r0, r2 ++ add r6, r1, r3 ++ lsl r2, #1 ++ lsl r3, #1 ++ vmov.i64 q14, #0 ++ vmov.i16 q15, #(1 << \bit_depth) - 1 ++ bl band_load_y ++ ++1: vld1.16 { q8, q9 }, [r1, :128], r3 ++ subs r12, #2 ++ vld1.16 {q10, q11}, [r6, :128], r3 ++ sao_band_64b_16 q8, q9, q10, q11, {d0-d3}, {d0-d3}, q14, q15, \bit_depth ++ vst1.16 { q8, q9 }, [r0, :128], r2 ++ vst1.16 {q10, q11}, [r5, :128], r2 ++ bpl 1b ++ ++ pop {r4-r6, pc} ++.endm ++ ++function ff_hevc_rpi_sao_band_16_neon_10, export=1 ++ band_16_16 10 ++endfunc ++ ++@ ff_hevc_rpi_sao_band_8_neon_10 ( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ ptrdiff_t stride_src, [r3] ++@ int16_t *sao_offset_val, [sp, #0] ++@ int sao_left_class, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++.macro band_8_16 bit_depth ++ ldr ip, [sp, #8] @ width ++ push {r4-r6, lr} ++ vmov.i64 q14, #0 ++ cmp ip, #8 ++ vmov.i16 q15, #(1 << \bit_depth) - 1 ++ bl band_load_y ++ add r5, r0, r2 ++ add r6, r1, r3 ++ lsl r2, #1 ++ lsl r3, #1 ++ blt 4f ++ ++ sao_band_32b_16 q8, q9, {d0-d3}, {d0-d3}, q14, q15, \bit_depth, \ ++ "vld1.16 {q8}, [r1, :128], r3", \ ++ "subs ip, #2", \ ++ "vld1.16 {q9}, [r6, :128], r3", \ ++ "", \ ++ "", \ ++ "vst1.16 {q10}, [r0, :128], r2", \ ++ "vst1.16 {q11}, [r5, :128], r2" ++ pop {r4-r6, pc} ++4: ++ sao_band_32b_16 q8, q9, {d0-d3}, {d0-d3}, q14, q15, \bit_depth, \ ++ "vld1.16 {d16}, [r1, :64], r3", \ ++ "subs ip, #4", \ ++ "vld1.16 {d17}, [r6, :64], r3", \ ++ "vld1.16 {d18}, [r1, :64], r3", \ ++ "vld1.16 {d19}, [r6, :64], r3", \ ++ "vst1.16 {d20}, [r0, :64], r2", \ ++ "vst1.16 {d21}, [r5, :64], r2", \ ++ "vst1.16 {d22}, [r0, :64], r2", \ ++ "vst1.16 {d23}, [r5, :64], r2" ++ pop {r4-r6, pc} ++.endm ++ ++function ff_hevc_rpi_sao_band_8_neon_10, export=1 ++ band_8_16 10 ++endfunc ++ ++ ++@ ff_hevc_rpi_sao_band_c_32_neon_10( ++@ uint8_t * dst [r0] ++@ uint8_t * src [r1] ++@ uint32_t dst_stride [r2] ++@ uint32_t src_stride [r3] ++@ const int16_t * table1 sp[0] ++@ uint32_t offset1 sp[4] ++@ const int16_t * table2 sp[8] ++@ uint32_t offset2 sp[12] ++@ int width sp[16] ++@ int height sp[20] ++ ++.macro band_c_32_16 bit_depth ++ push {r4-r6, lr} ++ add r5, r0, #32 ++ add r6, r1, #32 ++ sub r2, #64 ++ sub r3, #64 ++ vmov.i64 q14, #0 ++ vmov.i16 q15, #(1 << \bit_depth) - 1 ++ bl band_load_c ++ mov lr, #64 ++ vpush {q4-q7} ++ ++1: vld2.16 { q4, q5 }, [r1, :128], lr ++ subs ip, #1 ++ vld2.16 { q6, q7 }, [r6, :128], lr ++ vld2.16 { q8, q9 }, [r1, :128], r3 ++ vld2.16 {q10, q11}, [r6, :128], r3 ++ ++ sao_band_64b_16 q4, q5, q6, q7, {d0-d3}, {d4-d7}, q14, q15, \bit_depth, \ ++ "pld [r4]", \ ++ "it ne; addne r4, r3" ++ sao_band_64b_16 q8, q9, q10, q11, {d0-d3}, {d4-d7}, q14, q15, \bit_depth ++ ++ vst2.16 { q4, q5 }, [r0, :128], lr ++ vst2.16 { q6, q7 }, [r5, :128], lr ++ vst2.16 { q8, q9 }, [r0, :128], r2 ++ vst2.16 {q10, q11}, [r5, :128], r2 ++ ++ bpl 1b ++ ++ vpop {q4-q7} ++ pop {r4-r6, pc} ++.endm ++ ++function ff_hevc_rpi_sao_band_c_32_neon_10, export=1 ++ band_c_32_16 10 ++endfunc ++ ++ ++@ ff_hevc_rpi_sao_band_c_16_neon_10( ++@ uint8_t * dst [r0] ++@ uint8_t * src [r1] ++@ uint32_t dst_stride [r2] ++@ uint32_t src_stride [r3] ++@ const int16_t * table1 sp[0] ++@ uint32_t offset1 sp[4] ++@ const int16_t * table2 sp[8] ++@ uint32_t offset2 sp[12] ++@ int width sp[16] ++@ int height sp[20] ++ ++.macro band_c_16_16 bit_depth ++ push {r4-r6, lr} ++ add r5, r0, #32 ++ add r6, r1, #32 ++ vmov.i64 q14, #0 ++ vmov.i16 q15, #(1 << \bit_depth) - 1 ++ bl band_load_c ++ ++1: vld2.16 { q8, q9 }, [r1, :128], r3 ++ subs ip, #1 ++ vld2.16 {q10, q11}, [r6, :128], r3 ++ ++ sao_band_64b_16 q4, q5, q6, q7, {d0-d3}, {d4-d7}, q14, q15, \bit_depth ++ sao_band_64b_16 q8, q9, q10, q11, {d0-d3}, {d4-d7}, q14, q15, \bit_depth ++ ++ vst2.16 { q8, q9 }, [r0, :128], r2 ++ vst2.16 {q10, q11}, [r5, :128], r2 ++ ++ bpl 1b ++ pop {r4-r6, pc} ++.endm ++ ++function ff_hevc_rpi_sao_band_c_16_neon_10, export=1 ++ band_c_16_16 10 ++endfunc ++ ++ ++@ ff_hevc_rpi_sao_band_c_8_neon_10( ++@ uint8_t * dst [r0] ++@ uint8_t * src [r1] ++@ uint32_t dst_stride [r2] ++@ uint32_t src_stride [r3] ++@ const int16_t * table1 sp[0] ++@ uint32_t offset1 sp[4] ++@ const int16_t * table2 sp[8] ++@ uint32_t offset2 sp[12] ++@ int width sp[16] ++@ int height sp[20] ++ ++.macro band_c_8_16 bit_depth ++ ldr ip, [sp, #16] @ width ++ push {r4-r6, lr} ++ vmov.i64 q14, #0 ++ cmp ip, #8 ++ vmov.i16 q15, #(1 << \bit_depth) - 1 ++ bl band_load_c ++ blt 4f ++ ++ sao_band_32b_16 q8, q9, {d0-d3}, {d4-d7}, q14, q15, \bit_depth, \ ++ "vld2.16 {q8,q9}, [r1, :128], r3", \ ++ "subs ip, #1", \ ++ "", \ ++ "", \ ++ "", \ ++ "vst2.16 {q10,q11}, [r0, :128], r2" ++ pop {r4-r6, pc} ++4: ++ add r5, r0, r2 ++ add r6, r1, r3 ++ lsl r2, #1 ++ lsl r3, #1 ++ sao_band_32b_16 q8, q9, {d0-d3}, {d4-d7}, q14, q15, \bit_depth, \ ++ "vld2.16 {d16,d18}, [r1, :128], r3", \ ++ "subs ip, #2", \ ++ "vld2.16 {d17,d19}, [r6, :128], r3", \ ++ "", \ ++ "", \ ++ "vst2.16 {d20,d22}, [r0, :128], r2", \ ++ "vst2.16 {d21,d23}, [r5, :128], r2" ++ pop {r4-r6, pc} ++.endm ++ ++function ff_hevc_rpi_sao_band_c_8_neon_10, export=1 ++ band_c_8_16 10 ++endfunc ++ ++ ++@ ============================================================================= ++@ SAO EDGE ++ ++@ r0 destination address ++@ r2 stride to post-increment r0 with ++@ [r5] translate values ++@ ++@ a <- c <- b ++@ a in q0 - q3 ++@ c in q4 - q7 ++@ b in q8 - q11 ++@ ++@ q12-15 used as temp ++@ ++@ Can be used for both Y & C as we unzip/zip the deltas and ++@ transform "u/v" separately via d26/d27. For Y d26=d27 ++ ++function edge_64b_body_8 ++ ++ vcgt.u8 q12, q4, q0 @ c > a -> -1 , otherwise 0 ++ vcgt.u8 q13, q5, q1 ++ vcgt.u8 q14, q6, q2 ++ vcgt.u8 q15, q7, q3 ++ ++ vcgt.u8 q0, q4 @ a > c -> -1 , otherwise 0 ++ vcgt.u8 q1, q5 ++ vcgt.u8 q2, q6 ++ vcgt.u8 q3, q7 ++ ++ vsub.s8 q0, q12 @ a = sign(c-a) ++ vsub.s8 q1, q13 ++ vsub.s8 q2, q14 ++ vsub.s8 q3, q15 ++ ++ vcgt.u8 q12, q4, q8 @ c > b -> -1 , otherwise 0 ++ vcgt.u8 q13, q5, q9 ++ vcgt.u8 q14, q6, q10 ++ vcgt.u8 q15, q7, q11 ++ ++ vsub.s8 q0, q12 ++ vsub.s8 q1, q13 ++ vsub.s8 q2, q14 ++ vsub.s8 q3, q15 ++ ++ vcgt.u8 q12, q8, q4 @ c < b -> -1 , otherwise 0 ++ vcgt.u8 q13, q9, q5 ++ vcgt.u8 q14, q10, q6 ++ vcgt.u8 q15, q11, q7 ++ ++ vadd.s8 q0, q12 @ a = sign(c-a) + sign(c-b) ++ vadd.s8 q1, q13 ++ vmov.u8 q12, #2 ++ vadd.s8 q2, q14 ++ vadd.s8 q3, q15 ++ ++ vadd.s8 q0, q12 ++ vadd.s8 q1, q12 ++ ++ vld1.8 {d26, d27}, [r5] ++ ++ vadd.s8 q2, q12 ++ vuzp.8 q0, q1 ++ vmov.u8 q15, #128 ++ vadd.s8 q3, q12 @ a = 2 + sign(c-a) + sign(c-b) ++ ++ vtbl.8 d0, {d26}, d0 ++ vadd.s8 q12, q4, q15 @ Add -128 so we can use saturating signed add ++ ++ vtbl.8 d1, {d26}, d1 ++ vadd.s8 q14, q5, q15 ++ ++ vtbl.8 d2, {d27}, d2 ++ vuzp.8 q2, q3 ++ ++ vtbl.8 d3, {d27}, d3 ++ ++ vtbl.8 d4, {d26}, d4 ++ vzip.8 q0, q1 ++ ++ vtbl.8 d5, {d26}, d5 ++ vqadd.s8 q0, q12 ++ vqadd.s8 q1, q14 ++ vadd.s8 q12, q6, q15 @ Add -128 so we can use saturating signed add ++ ++ vtbl.8 d6, {d27}, d6 ++ vtbl.8 d7, {d27}, d7 ++ vadd.s8 q14, q7, q15 @ Add -128 so we can use saturating signed add ++ vzip.8 q2, q3 ++ ++ vsub.s8 q0, q15 ++ vqadd.s8 q2, q12 ++ vqadd.s8 q3, q14 ++ vsub.s8 q1, q15 ++ vsub.s8 q2, q15 ++ vsub.s8 q3, q15 ++ ++ bx lr ++endfunc ++ ++@ r0 destination address ++@ r2 stride to post-increment r0 with ++@ r4 upper clip value ++@ [r5] translate values ++@ ++@ a <- c <- b ++@ a in q0 - q3 ++@ c in q4 - q7 ++@ b in q8 - q11 ++@ ++@ q12-15 used as temp ++@ ++@ Can be used for both Y & C as we unzip/zip the deltas and ++@ transform "u/v" separately via d26/d27. For Y d26=d27 ++ ++function edge_64b_body_16 ++ ++ vcgt.u16 q12, q4, q0 // c > a -> -1 , otherwise 0 ++ vcgt.u16 q13, q5, q1 ++ vcgt.u16 q14, q6, q2 ++ vcgt.u16 q15, q7, q3 ++ ++ vcgt.u16 q0, q0, q4 // a > c -> -1 , otherwise 0 ++ vcgt.u16 q1, q1, q5 ++ vcgt.u16 q2, q2, q6 ++ vcgt.u16 q3, q3, q7 ++ ++ vsub.s16 q0, q0, q12 // a = sign(c-a) ++ vsub.s16 q1, q1, q13 ++ vsub.s16 q2, q2, q14 ++ vsub.s16 q3, q3, q15 ++ ++ vcgt.u16 q12, q4, q8 // c > b -> -1 , otherwise 0 ++ vcgt.u16 q13, q5, q9 ++ vcgt.u16 q14, q6, q10 ++ vcgt.u16 q15, q7, q11 ++ ++ vsub.s16 q0, q0, q12 ++ vsub.s16 q1, q1, q13 ++ vsub.s16 q2, q2, q14 ++ vsub.s16 q3, q3, q15 ++ ++ vcgt.u16 q12, q8, q4 // c < b -> -1 , otherwise 0 ++ vcgt.u16 q13, q9, q5 ++ vcgt.u16 q14, q10, q6 ++ vcgt.u16 q15, q11, q7 ++ ++ vadd.s16 q0, q0, q12 // a = sign(c-a) + sign(c-b) ++ vadd.s16 q1, q1, q13 ++ vadd.s16 q2, q2, q14 ++ vadd.s16 q3, q3, q15 ++ ++ vmov.u8 q12, #2 ++ ++ vmovn.s16 d0, q0 ++ vmovn.s16 d1, q1 ++ vmovn.s16 d2, q2 ++ vmovn.s16 d3, q3 ++ ++ vldr d26, [r5] ++ ++ vuzp.8 q0, q1 ++ ++ vldr d27, [r5, #8] ++ ++ vadd.s8 q0, q0, q12 ++ vadd.s8 q1, q1, q12 ++ ++ vmov.i64 q12, #0 ++ ++ vtbl.8 d0, {d26}, d0 ++ vtbl.8 d1, {d26}, d1 ++ vtbl.8 d2, {d27}, d2 ++ vtbl.8 d3, {d27}, d3 ++ ++ vdup.i16 q13, r4 ++ ++ vzip.8 q0, q1 ++ ++ @ Avoid overwrite whilst widening ++ vaddw.s8 q2, q6, d2 ++ vaddw.s8 q3, q7, d3 ++ vaddw.s8 q1, q5, d1 ++ vaddw.s8 q0, q4, d0 ++ ++ @ now clip ++ clip16_4 q2, q3, q1, q0, q12, q13 ++ ++ bx lr ++endfunc ++ ++ ++@ a <- c <- b ++@ a in q0 ++@ c in q1 ++@ b in q2 ++@ Temp q3, q9, q10 ++@ ++@ d16, d17 (q8) xlat U, V ++@ q14.u8 #2 ++@ q15.u8 #128 ++ ++function edge_16b_body_8 ++ vcgt.u8 q9, q0, q1 @ a > c -> -1 , otherwise 0 ++ vadd.u8 q9, q14, q9 ++ vcgt.u8 q0, q1, q0 @ c > a -> -1 , otherwise 0 ++ vsub.u8 q9, q9, q0 ++ vcgt.u8 q0, q2, q1 @ c < b -> -1 , otherwise 0 ++ vadd.u8 q9, q9, q0 ++ vcgt.u8 q0, q1, q2 @ c > b -> -1 , otherwise 0 ++ vsub.u8 q0, q9, q0 ++ ++ vadd.s8 q3, q1, q15 @ Add -128 so we can use saturating signed add ++ ++ vuzp.8 d0, d1 ++ ++ vtbl.8 d0, {d16}, d0 ++ vtbl.8 d1, {d17}, d1 ++ ++ vzip.8 d0, d1 ++ vqadd.s8 q0, q3 ++ vsub.s8 q0, q15 ++ ++ bx lr ++endfunc ++ ++@ a <- c <- b ++@ a in q0 ++@ c in q1 ++@ b in q2 ++@ Temp q3 ++@ ++@ q12, #0 ++@ d16, d17 xlat U, V ++@ q14.u8 #2 ++@ q15.u16 max ++function edge_16b_body_16 ++ vcgt.u16 q9, q0, q1 @ a > c -> -1 , otherwise 0 ++ vadd.u16 q9, q14, q9 ++ vcgt.u16 q0, q1, q0 @ c > a -> -1 , otherwise 0 ++ vsub.u16 q9, q9, q0 ++ vcgt.u16 q0, q2, q1 @ c < b -> -1 , otherwise 0 ++ vadd.u16 q9, q9, q0 ++ vcgt.u16 q0, q1, q2 @ c > b -> -1 , otherwise 0 ++ vsub.u16 q0, q9, q0 ++ ++ vmovn.s16 d0, q0 ++ @ d1 will have random contents that we transform but ++ @ that doesn't matter as we then discard them ++ vuzp.8 d0, d1 ++ ++ vtbl.8 d0, {d16}, d0 ++ vtbl.8 d1, {d17}, d1 ++ ++ vzip.8 d0, d1 ++ ++ vaddw.s8 q0, q1, d0 ++ ++ @ now clip ++ vmax.s16 q0, q12 ++ vmin.s16 q0, q15 ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_sao_edge_[c_]xx_neon( ++@ uint8_t *_dst, [r0] ++@ const uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ const int16_t *_sao_offset_val_u, [r3] ++@ const int16_t *_sao_offset_val_v, [sp, #0] // Chroma only ++@ int eo, [sp, #sp_base + 0] ++@ int width, [sp, #sp_base + 4] ++@ int height) [sp, #sp_base + 8] ++ ++@ Jumps via jump_tab with ++@ uint8_t *_dst, [r0] ++@ const uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ EDGE_SRC_STRIDE [r3] ++@ (1 << \bit_depth) - 1 [r4] ++@ * xlat_table [r5] // setup_64b only ++@ int height [r12] ++@ ++@ 0 [q12] // > 8 bit ++@ 2 [q14] ++@ 128 [q15] // = 8 bit ++@ r4 [q15] // > 8 bit ++ ++.macro edge_xxb_init, bit_depth, is_chroma, jump_tab, setup_64b = 0, setup_16b = 0, check_w4 = 0, do2 = 0, xjump = 0 ++ ++@ Build translate registers ++@ As translate values can only be 0-4 we don't care about junk in the rest ++@ of the register ++.if \is_chroma ++ ldr ip, [sp, #0] ++ push {r4-r6, lr} @ 16 bytes ++ vld1.8 {d16[2]}, [r3] ++ add r3, r3, #2 ++ vld1.8 {d17[2]}, [ip] ++ add ip, ip, #2 ++ vld1.8 {d16[0]}, [r3] ++ add r3, r3, #2 ++ vld1.8 {d17[0]}, [ip] ++ add ip, ip, #2 ++ vld1.8 {d16[1]}, [r3] ++ add r3, r3, #2 ++ vld1.8 {d17[1]}, [ip] ++ add ip, ip, #2 ++ vld1.8 {d16[3]}, [r3] ++ add r3, r3, #2 ++ vld1.8 {d17[3]}, [ip] ++ add ip, ip, #2 ++ vld1.8 {d16[4]}, [r3] ++ vld1.8 {d17[4]}, [ip] ++ movw r3, EDGE_SRC_STRIDE ++.set sp_base, 20 ++.else ++ add ip, r3, #4 ++ vld1.8 {d16[1]}, [r3] ++ add r3, r3, #2 ++ vld1.8 {d17[0]}, [ip] ++ add ip, ip, #2 ++ vld1.8 {d16[0]}, [r3] ++ add r3, r3, #6 ++ vld1.8 {d17[1]}, [ip] ++ vld1.8 {d16[2]}, [r3] ++ movw r3, EDGE_SRC_STRIDE ++ push {r4-r6, lr} @ 16 bytes ++ vzip.8 d16, d17 ++ vmov d17, d16 ++.set sp_base, 16 ++.endif ++ ++@ If setup_64b we need the xlat table on the stack ++.if \setup_64b ++ sub r5, sp, #16 ++.endif ++ ++@ Get jump address ++@ We have a special case for width 4 as the calling code doesn't detect it ++@ If we may have w4 then we add a 2nd jump table after the 1st ++.if \check_w4 ++ ldr r12, [sp, #sp_base + 4] @ width ++ adr r6, \jump_tab ++ ldr lr, [sp, #sp_base + 0] @ e0 ++ cmp r12, #8 ++ it lt ++ addlt r6, #16 ++.else ++ ldr lr, [sp, #sp_base + 0] @ e0 ++ adr r6, \jump_tab ++.endif ++ ++ ldr r12, [sp, #sp_base + 8] @ height ++ ++.if \bit_depth > 8 ++ movw r4, (1 << \bit_depth) - 1 ++.endif ++.if \setup_16b ++.if \bit_depth > 8 ++ vmov.i64 q12, #0 ++ vdup.16 q15, r4 ++ vmov.u16 q14, #2 ++.else ++ vmov.u8 q15, #128 ++ vmov.u8 q14, #2 ++.endif ++.endif ++ ++@ If setup_64b we need q4-q7 saved. ++.if \setup_64b ++ vpush {q4-q8} @ 80 bytes, q8 pushed first ++.set sp_base, sp_base + 80 ++.endif ++ ++ ldr r6, [r6, lr, lsl #2] ++ ++@ For 16 bit width 64 (or chroma 32) we need to do this in 2 passes ++.if \do2 ++ push {r0, r1, r6, r12} ++.if jent_pic ++ bl 98f ++.else ++ blx r6 ++.endif ++ pop {r0, r1, r6, r12} ++ ++ add r0, #64 ++ add r1, #64 ++.endif ++ ++.if jent_pic ++ bl 98f ++.else ++ blx r6 ++.endif ++ ++@ Tidy up & return ++.if \setup_64b ++ vpop {q4-q8} @ spurious but harmless load of q8 ++.endif ++ pop {r4-r6, pc} ++ ++.if jent_pic && !\xjump ++@ Magic label - used as 98b in jent macro ++98: ++ add pc, r6 ++.endif ++.endm ++ ++ ++.macro edge_16b_init, bit_depth, is_chroma, check_w4, jump_tab ++ edge_xxb_init \bit_depth, \is_chroma, \jump_tab, check_w4=\check_w4, setup_16b=1 ++.endm ++ ++.macro edge_64b_init, bit_depth, is_chroma, do2, jump_tab, xjump=0 ++ edge_xxb_init \bit_depth, \is_chroma, \jump_tab, do2=\do2, setup_64b=1, xjump=\xjump ++.endm ++ ++ ++.macro edge_64b_e0, body_fn, pb ++ sub r1, #8 ++ mov r6, lr ++1: vldm r1, {d7-d16} ++ // load a ++ vext.8 q0, q3, q4, #(16 - \pb) ++ add r1, r3 ++ vext.8 q1, q4, q5, #(16 - \pb) ++ subs r12, #1 ++ vext.8 q2, q5, q6, #(16 - \pb) ++ vext.8 q3, q6, q7, #(16 - \pb) ++ pld [r1] ++ // load b ++ vext.8 q11, q7, q8, #\pb @ Avoid overwrite ++ pld [r1, #64] ++ vext.8 q8, q4, q5, #\pb ++ vext.8 q9, q5, q6, #\pb ++ vext.8 q10, q6, q7, #\pb ++ bl \body_fn ++ vstm r0, {q0-q3} ++ add r0, r0, r2 ++ bgt 1b ++ bx r6 ++.endm ++ ++.macro edge_32bx2_e0, body_fn, pb ++ add r6, r1, r3 ++ push {r7,lr} ++ sub r1, #8 ++ add r7, r0, r2 ++ lsl r2, #1 ++1: vldmia r1, {d7-d12} ++ // load a ++ vext.8 q0, q3, q4, #16 - \pb ++ add r1, r1, r3, lsl #1 ++ vext.8 q1, q4, q5, #16 - \pb ++ subs r12, #2 ++ // load b ++ vext.8 q8, q4, q5, #\pb ++ vext.8 q9, q5, q6, #\pb ++ vldr d25, [r6, #-8] ++ vldmia r6, {d12-d15} ++ vldr d26, [r6, #32] ++ // load a ++ vext.8 q2, q12, q6, #16 - \pb ++ add r6, r6, r3, lsl #1 ++ vext.8 q3, q6, q7, #16 - \pb ++ // load b ++ vext.8 q10, q6, q7, #\pb ++ vext.8 q11, q7, q13, #\pb ++ bl \body_fn ++ vst1.8 {q0-q1}, [r0, :256], r2 ++ vst1.8 {q2-q3}, [r7, :256], r2 ++ bgt 1b ++ pop {r7,pc} ++.endm ++ ++.macro edge_16b_e0, body_fn, pb ++ sub r1, #8 ++ mov r6, lr ++1: vldmia r1, {d1-d4} ++ add r1, r3 ++ subs r12, #1 ++ vext.8 q0, q0, q1, #16 - \pb ++ vext.8 q2, q1, q2, #\pb ++ ++ bl \body_fn ++ vst1.8 {q0}, [r0, :128], r2 ++ bgt 1b ++ bx r6 ++.endm ++ ++.macro edge_8bx2_e0, body_fn, pb ++ add r6, r1, r3 ++ push {r7,lr} ++ sub r1, #8 ++ add r7, r0, r2 ++ lsl r2, #1 ++1: vldmia r1, {d1-d2} ++ vldmia r6, {d3-d4} ++ vldr d6, [r1, #16] ++ subs r12, #2 ++ vldr d7, [r6, #-8] ++ add r1, r1, r3, lsl #1 ++ vext.8 d0, d1, d2, #8 - \pb ++ add r6, r6, r3, lsl #1 ++ vext.8 d5, d3, d4, #\pb ++ vext.8 d4, d2, d6, #\pb ++ vext.8 d1, d7, d3, #8 - \pb ++ ++ bl \body_fn ++ vst1.8 {d0}, [r0, :64], r2 ++ vst1.8 {d1}, [r7, :64], r2 ++ bgt 1b ++ pop {r7,pc} ++.endm ++ ++.macro edge_4bx4_e0, body_fn, pb ++ add r6, r1, r3 ++ push {r7,lr} ++ add r7, r0, r2 ++ lsl r2, #1 ++ ++ tst r1, #4 ++ bne 2f ++1: // r1 (and assumed r6) are 64-bit aligned ++ vldr d2, [r1] ++ vldr d0, [r1, #-8] ++ add r1, r1, r3, lsl #1 ++ vldr d20, [r6] ++ subs r12, #4 ++ vldr d18, [r6, #-8] ++ add r6, r6, r3, lsl #1 ++ vldr d3, [r1] ++ vshr.u64 d4, d2, #\pb * 8 ++ vldr d1, [r1, #-8] ++ add r1, r1, r3, lsl #1 ++ vldr d21, [r6] ++ vext.8 d0, d0, d2, #8 - \pb ++ vldr d19, [r6,#-8] ++ add r6, r6, r3, lsl #1 ++ vshr.u64 d22, d20, #\pb * 8 ++ vext.8 d18, d18, d20, #8 - \pb ++ vshr.u64 d5, d3, #\pb * 8 ++ vext.8 d1, d1, d3, #8 - \pb ++ vshr.u64 d23, d21, #\pb * 8 ++ vext.8 d19, d19, d21, #8 - \pb ++ vsli.64 q1, q10, #32 ++ vsli.64 q2, q11, #32 ++ vsli.64 q0, q9, #32 ++ ++ bl \body_fn ++ vst1.32 {d0[0]}, [r0, :32], r2 ++ vst1.32 {d0[1]}, [r7, :32], r2 ++ vst1.32 {d1[0]}, [r0, :32], r2 ++ vst1.32 {d1[1]}, [r7, :32], r2 ++ bgt 1b ++ pop {r7,pc} ++ ++2: // r1 (and assumed r6) are 32-bit but not 64-bit aligned ++ vldr d20, [r1, #-4] ++ vldr d22, [r1, #4] ++ add r1, r1, r3, lsl #1 ++ vldr d2, [r6, #-4] ++ subs r12, #4 ++ vldr d4, [r6, #4] ++ add r6, r6, r3, lsl #1 ++ vldr d21, [r1, #-4] ++ vshl.i64 d18, d20, #\pb * 8 ++ vldr d23, [r1, #4] ++ add r1, r1, r3, lsl #1 ++ vldr d3, [r6, #-4] ++ vext.8 d22, d20, d22, #\pb ++ vldr d5, [r6, #4] ++ add r6, r6, r3, lsl #1 ++ vshl.i64 d0, d2, #\pb * 8 ++ vext.8 d4, d2, d4, #\pb ++ vshl.i64 d19, d21, #\pb * 8 ++ vext.8 d23, d21, d23, #\pb ++ vshl.i64 d1, d3, #\pb * 8 ++ vext.8 d5, d3, d5, #\pb ++ vsri.64 q1, q10, #32 ++ vsri.64 q0, q9, #32 ++ vsri.64 q2, q11, #32 ++ ++ bl \body_fn ++ vst1.32 {d0[0]}, [r0, :32], r2 ++ vst1.32 {d0[1]}, [r7, :32], r2 ++ vst1.32 {d1[0]}, [r0, :32], r2 ++ vst1.32 {d1[1]}, [r7, :32], r2 ++ bgt 2b ++ pop {r7,pc} ++.endm ++ ++ ++.macro edge_64b_e1, body_fn ++ sub r1, r3 ++ push {lr} ++ add r6, r1, #32 ++ // load a ++ vld1.8 {q0-q1}, [r1, :256], r3 ++ vld1.8 {q2-q3}, [r6, :256], r3 ++ // load c ++ vld1.8 {q4-q5}, [r1, :256], r3 ++ vld1.8 {q6-q7}, [r6, :256], r3 ++1: // load b ++ vld1.8 {q8-q9}, [r1, :256], r3 ++ subs r12, #1 ++ vld1.8 {q10-q11}, [r6, :256], r3 ++ bl \body_fn ++ vstm r0, {q0-q3} ++ // copy c to a ++ vmov.64 q0, q4 ++ pld [r1, r3] ++ vmov.64 q1, q5 ++ it le ++ pople {lr} ++ vmov.64 q2, q6 ++ it le ++ bxle lr ++ vmov.64 q3, q7 ++ add r0, r0, r2 ++ // copy b to c ++ vmov.64 q4, q8 ++ vmov.64 q5, q9 ++ vmov.64 q6, q10 ++ vmov.64 q7, q11 ++ b 1b ++.endm ++ ++.macro edge_32bx2_e1, body_fn ++ sub r6, r1, r3 ++ vld1.8 {q2-q3}, [r1, :256], r3 ++ vld1.8 {q0-q1}, [r6, :256] ++ mov r6, lr ++ ++1: @ Given the data duplication here we could obviously do better than ++ @ using the generic body_fn but it almost certainly isn't worth it ++ vld1.8 {q8-q9}, [r1, :256], r3 ++ subs r12, #2 ++ vmov q4, q2 ++ vmov q5, q3 ++ vld1.8 {q10-q11}, [r1, :256], r3 ++ vmov q6, q8 ++ vmov q7, q9 ++ ++ bl \body_fn ++ ++ vst1.8 {q0-q1}, [r0, :256], r2 ++ // copy b to a ++ vmov q0, q8 ++ vmov q1, q9 ++ vst1.8 {q2-q3}, [r0, :256], r2 ++ vmov q2, q10 ++ it le ++ bxle r6 ++ vmov q3, q11 ++ b 1b ++.endm ++ ++.macro edge_16b_e1, body_fn ++ sub r6, r1, r3 ++ // load c ++ vld1.8 {q1}, [r1, :128], r3 ++ // load a ++ vld1.8 {q0}, [r6, :128] ++ mov r6, lr ++1: // load b ++ vld1.8 {q2}, [r1, :128], r3 ++ bl \body_fn ++ vst1.8 {q0}, [r0, :128], r2 ++ subs r12, #1 ++ // copy c to a ++ vmov.64 q0, q1 ++ it le ++ bxle r6 ++ // copy b to c ++ vmov.64 q1, q2 ++ b 1b ++.endm ++ ++.macro edge_8bx2_e1, body_fn ++ sub r6, r1, r3 ++ lsl r3, #1 ++ push {r7, lr} ++ vld1.8 {d1}, [r1, :64], r3 ++ vld1.8 {d0}, [r6, :64], r3 ++ add r7, r0, r2 ++ lsl r2, #1 ++1: @ Given the data duplication here we could obviously do better than ++ @ using the generic body_fn but it almost certainly isn't worth it ++ vld1.8 {d4}, [r6, :64], r3 ++ vmov d2, d1 ++ vld1.8 {d5}, [r1, :64], r3 ++ subs r12, #2 ++ vmov d3, d4 ++ ++ bl \body_fn ++ ++ vst1.8 {d0}, [r0, :64], r2 ++ vst1.8 {d1}, [r7, :64], r2 ++ ++ // copy b to a ++ vmov q0, q2 ++ bgt 1b ++ pop {r7, pc} ++.endm ++ ++.macro edge_4bx4_e1, body_fn ++ sub r6, r1, r3 ++ lsl r3, #1 ++ push {r7, lr} ++ vld1.32 {d0[1]}, [r1, :32], r3 ++ add r7, r0, r2 ++ vld1.32 {d0[0]}, [r6, :32], r3 ++ lsl r2, #1 ++ vld1.32 {d4[1]}, [r1, :32], r3 ++ vld1.32 {d4[0]}, [r6, :32], r3 ++ vld1.32 {d5[1]}, [r1, :32], r3 ++ vld1.32 {d5[0]}, [r6, :32], r3 ++ vmov d1, d4 ++ vext.32 d2, d0, d4, #1 ++ subs r12, #4 ++ vmov d22, d5 ++ vext.32 d3, d4, d5, #1 ++ b 2f ++ ++1: vst1.32 {d0[0]}, [r0, :32], r2 ++ vext.32 d2, d22, d4, #1 ++ vst1.32 {d0[1]}, [r7, :32], r2 ++ vmov d0, d22 ++ vst1.32 {d1[0]}, [r0, :32], r2 ++ vext.32 d3, d4, d5, #1 ++ vst1.32 {d1[1]}, [r7, :32], r2 ++ vmov d1, d4 ++ vmov d22, d5 ++2: @ Given the data duplication here we could probably do better than ++ @ using the generic body_fn but it almost certainly isn't worth it ++ bl \body_fn ++ ble 3f ++ vld1.32 {d4[0]}, [r6, :32], r3 ++ subs r12, #4 ++ vld1.32 {d4[1]}, [r1, :32], r3 ++ vld1.32 {d5[0]}, [r6, :32], r3 ++ vld1.32 {d5[1]}, [r1, :32], r3 ++ b 1b ++ ++3: vst1.32 {d0[0]}, [r0, :32], r2 ++ vst1.32 {d0[1]}, [r7, :32], r2 ++ vst1.32 {d1[0]}, [r0, :32] ++ vst1.32 {d1[1]}, [r7, :32] ++ pop {r7, pc} ++.endm ++ ++.macro edge_64b_e2, body_fn, pb ++ push {lr} ++ sub r6, r1, r3 ++ // load c and a ++ vld1.8 {q4-q5}, [r1, :128] ++ vldr d25, [r6, #-8] ++ vldmia r6, {d16-d23} ++ vext.8 q0, q12, q8, #16 - \pb ++ add r6, r1, #32 ++ vext.8 q1, q8, q9, #16 - \pb ++ add r1, r1, r3 ++ vext.8 q2, q9, q10, #16 - \pb ++ vld1.8 {q6-q7}, [r6, :128] ++ sub r6, r1, r3 ++ vext.8 q3, q10, q11, #16 - \pb ++ ++1: // load b ++ vldmia r1, {d16-d24} ++ vext.8 q8, q8, q9, #\pb ++ pld [r1, r3] ++ vext.8 q9, q9, q10, #\pb ++ subs r12, #1 ++ vext.8 q10, q10, q11, #\pb ++ vext.8 q11, q11, q12, #\pb ++ bl \body_fn ++ // next a is mostly available in c ++ vldr d25, [r6, #-8] ++ vstmia r0, {q0-q3} ++ vext.8 q3, q6, q7, #16 - \pb ++ it le ++ pople {lr} ++ vext.8 q2, q5, q6, #16 - \pb ++ it le ++ bxle lr ++ vext.8 q1, q4, q5, #16 - \pb ++ add r6, r6, r3 ++ vext.8 q0, q12, q4, #16 - \pb ++ add r0, r0, r2 ++ // next c is mostly available in b ++ vldr d8, [r1] ++ vext.8 d9, d16, d17, #8 - \pb ++ vext.8 q5, q8, q9, #16 - \pb ++ add r1, r1, r3 ++ vext.8 q6, q9, q10, #16 - \pb ++ pld [r6, #-8] ++ vext.8 q7, q10, q11, #16 - \pb ++ b 1b ++.endm ++ ++.macro edge_32bx2_e2, body_fn, pb ++ sub r6, r1, r3 ++ push {r7, lr} ++ add r7, r0, r2 ++ lsl r2, #1 ++ // load a and first 32b of c ++ vld1.8 {q4-q5}, [r1, :256] ++ vldr d25, [r6, #-8] ++ vld1.8 {q13-q14}, [r6, :256] ++ vldr d31, [r1, #-8] ++ add r6, r6, r3, lsl #1 ++ vext.8 q0, q12, q13, #16 - \pb ++ add r1, r1, r3, lsl #1 ++ vext.8 q1, q13, q14, #16 - \pb ++ vext.8 q2, q15, q4, #16 - \pb ++ vext.8 q3, q4, q5, #16 - \pb ++1: ++ // load second 32b of c and second 32b of b ++ vldmia r6, {d12-d16} ++ vldmia r1, {d20-d24} ++ // first 32b of b is mostly available in second 32b of c ++ vext.8 q9, q7, q8, #\pb ++ subs r12, #2 ++ vext.8 q8, q6, q7, #\pb ++ vext.8 q10, q10, q11, #\pb ++ vext.8 q11, q11, q12, #\pb ++ ++ bl \body_fn ++ ++ vst1.8 {q0-q1}, [r0, :256], r2 ++ vst1.8 {q2-q3}, [r7, :256], r2 ++ ble 2f ++ ++ vldr d25, [r6, #-8] ++ add r6, r6, r3, lsl #1 ++ vldr d8, [r1] ++ vext.8 d9, d20, d21, #8 - \pb ++ vldr d31, [r1, #-8] ++ add r1, r1, r3, lsl #1 ++ // first 32b of a is mostly available in second 32b of c ++ vext.8 q1, q6, q7, #16 - \pb ++ vext.8 q0, q12, q6, #16 - \pb ++ // first 32b of c is mostly available in second 32b of b ++ vext.8 q5, q10, q11, #16 - \pb ++ // second 32b of a is mostly available in first 32b of c ++ vext.8 q2, q15, q4, #16 - \pb ++ vext.8 q3, q4, q5, #16 - \pb ++ b 1b ++ ++2: pop {r7, pc} ++.endm ++ ++.macro edge_16b_e2, body_fn, pb ++ push {lr} ++ sub r6, r1, r3 ++ vld1.8 {q1}, [r1, :128], r3 ++ vldr d19, [r6, #-8] ++ vld1.8 {q10}, [r6, :128], r3 ++ ++1: vldmia r1, {d4-d6} ++ vext.8 q0, q9, q10, #16 - \pb ++ subs r12, #1 ++ vext.8 q2, q2, q3, #\pb ++ bl \body_fn ++ vst1.8 {q0}, [r0, :128], r2 ++ ble 2f ++ vmov q10, q1 ++ vldr d2, [r1] ++ add r1, r1, r3 ++ vldr d19, [r6, #-8] ++ add r6, r6, r3 ++ vext.8 d3, d4, d5, #8 - \pb ++ b 1b ++ ++2: pop {pc} ++.endm ++ ++.macro edge_8bx2_e2, body_fn, pb ++ sub r6, r1, r3 ++ push {r7, lr} ++ add r7, r0, r2 ++ lsl r2, #1 ++ vldr d18, [r6, #-8] ++ vldr d19, [r6] ++ add r6, r6, r3, lsl #1 ++ vldr d20, [r1, #-8] ++ vldr d2, [r1] ++ add r1, r1, r3, lsl #1 ++ vldmia r6, {d3-d4} ++ vld1.8 {d21-d22}, [r1, :128] ++ ++1: vext.8 d0, d18, d19, #8 - \pb ++ vext.8 d4, d3, d4, #\pb ++ vext.8 d1, d20, d2, #8 - \pb ++ subs r12, #2 ++ vext.8 d5, d21, d22, #\pb ++ ++ bl \body_fn ++ ++ vst1.8 {d0}, [r0, :64], r2 ++ vst1.8 {d1}, [r7, :64], r2 ++ ble 2f ++ ++ vldr d18, [r6, #-8] ++ add r6, r6, r3, lsl #1 ++ vldr d20, [r1, #-8] ++ vmov d19, d3 ++ vldr d2, [r1] ++ add r1, r1, r3, lsl #1 ++ vldmia r6, {d3-d4} ++ vld1.8 {d21-d22}, [r1, :128] ++ b 1b ++ ++2: pop {r7, pc} ++.endm ++ ++.macro edge_4bx4_e2, body_fn, pb ++ sub r6, r1, r3 ++ push {r7-r9, lr} ++ add r8, r1, r3 ++ sub r6, r6, #\pb ++ add r8, r8, #\pb ++ add r7, r0, r2 ++ lsl r2, #1 ++ ++1: vld1.32 {d0[0]}, [r6], r3 ++ subs r12, #4 ++ vld1.32 {d2[0]}, [r1], r3 ++ vld1.32 {d4[0]}, [r8], r3 ++ vld1.32 {d0[1]}, [r6], r3 ++ vld1.32 {d2[1]}, [r1], r3 ++ vld1.32 {d4[1]}, [r8], r3 ++ vld1.32 {d1[0]}, [r6], r3 ++ vld1.32 {d3[0]}, [r1], r3 ++ vld1.32 {d5[0]}, [r8], r3 ++ vld1.32 {d1[1]}, [r6], r3 ++ vld1.32 {d3[1]}, [r1], r3 ++ vld1.32 {d5[1]}, [r8], r3 ++ ++ bl \body_fn ++ ++ vst1.32 {d0[0]}, [r0, :32], r2 ++ vst1.32 {d0[1]}, [r7, :32], r2 ++ vst1.32 {d1[0]}, [r0, :32], r2 ++ vst1.32 {d1[1]}, [r7, :32], r2 ++ bgt 1b ++ ++ pop {r7-r9,pc} ++.endm ++ ++.macro edge_64b_e3, body_fn, pb ++ push {lr} ++ sub r6, r1, r3 ++ // load c and a ++ vld1.8 {q4-q5}, [r1, :128] ++ vldmia r6, {d16-d24} ++ vext.8 q0, q8, q9, #\pb ++ add r6, r1, #32 ++ vext.8 q1, q9, q10, #\pb ++ add r1, r1, r3 ++ vext.8 q2, q10, q11, #\pb ++ vld1.8 {q6-q7}, [r6, :128] ++ sub r6, r1, r3 ++ vext.8 q3, q11, q12, #\pb ++ ++1: // load b ++ vldr d17, [r1, #-8] ++ vldmia r1, {d18-d25} ++ vext.8 q8, q8, q9, #16 - \pb ++ pld [r1, r3] ++ vext.8 q9, q9, q10, #16 - \pb ++ subs r12, #1 ++ vext.8 q10, q10, q11, #16 - \pb ++ vext.8 q11, q11, q12, #16 - \pb ++ bl \body_fn ++ // next a is mostly available in c ++ vldr d24, [r6, #64] ++ vstmia r0, {q0-q3} ++ vext.8 q0, q4, q5, #\pb ++ it le ++ pople {lr} ++ vext.8 q1, q5, q6, #\pb ++ it le ++ bxle lr ++ vext.8 q2, q6, q7, #\pb ++ add r6, r6, r3 ++ vext.8 q3, q7, q12, #\pb ++ add r0, r0, r2 ++ // next c is mostly available in b ++ vext.8 d14, d22, d23, #\pb ++ vldr d15, [r1, #56] ++ vext.8 q4, q8, q9, #\pb ++ add r1, r1, r3 ++ vext.8 q5, q9, q10, #\pb ++ vext.8 q6, q10, q11, #\pb ++ b 1b ++.endm ++ ++.macro edge_32bx2_e3, body_fn, pb ++ sub r6, r1, r3 ++ push {r7, lr} ++ add r7, r0, r2 ++ lsl r2, #1 ++ // load a and first 32b of c ++ vldmia r1, {d8-d12} ++ vldmia r6, {d24-d28} ++ vext.8 q2, q4, q5, #\pb ++ add r6, r6, r3, lsl #1 ++ vext.8 q3, q5, q6, #\pb ++ add r1, r1, r3, lsl #1 ++ vext.8 q0, q12, q13, #\pb ++ vext.8 q1, q13, q14, #\pb ++1: ++ // load second 32b of c and second 32b of b ++ vldr d25, [r6, #-8] ++ subs r12, #2 ++ vldmia r6, {d12-d15} ++ vldr d27, [r1, #-8] ++ vldmia r1, {d20-d23} ++ // first 32b of b is mostly available in second 32b of c ++ vext.8 q8, q12, q6, #16 - \pb ++ vext.8 q9, q6, q7, #16 - \pb ++ vext.8 q11, q10, q11, #16 - \pb ++ vext.8 q10, q13, q10, #16 - \pb ++ ++ bl \body_fn ++ ++ vst1.8 {q0-q1}, [r0, :256], r2 ++ vst1.8 {q2-q3}, [r7, :256], r2 ++ ble 2f ++ ++ vldr d24, [r6, #32] ++ add r6, r6, r3, lsl #1 ++ vldr d11, [r1, #24] ++ vext.8 d10, d22, d23, #\pb ++ vldr d30, [r1, #32] ++ add r1, r1, r3, lsl #1 ++ // first 32b of a is mostly available in second 32b of c ++ vext.8 q0, q6, q7, #\pb ++ vext.8 q1, q7, q12, #\pb ++ // first 32b of c is mostly available in second 32b of b ++ vext.8 q4, q10, q11, #\pb ++ // second 32b of a is mostly available in first 32b of c ++ vext.8 q3, q5, q15, #\pb ++ vext.8 q2, q4, q5, #\pb ++ b 1b ++ ++2: pop {r7, pc} ++.endm ++ ++.macro edge_16b_e3, body_fn, pb ++ push {lr} ++ sub r6, r1, r3 ++ vld1.8 {q1}, [r1, :128], r3 ++ vldmia r6, {d18-d20} ++ add r6, r6, r3 ++ ++1: vldr d5, [r1, #-8] ++ vld1.8 {q3}, [r1, :128] ++ subs r12, #1 ++ vext.8 q0, q9, q10, #\pb ++ vext.8 q2, q2, q3, #16 - \pb ++ bl \body_fn ++ vst1.8 {q0}, [r0, :128], r2 ++ ble 2f ++ vmov q9, q1 ++ vldr d3, [r1, #8] ++ add r1, r1, r3 ++ vldr d20, [r6, #16] ++ add r6, r6, r3 ++ vext.8 d2, d4, d5, #\pb ++ b 1b ++ ++2: pop {pc} ++.endm ++ ++.macro edge_8bx2_e3, body_fn, pb ++ sub r6, r1, r3 ++ push {r7, lr} ++ add r7, r0, r2 ++ lsl r2, #1 ++ vld1.8 {d18-d19}, [r6] ++ add r6, r6, r3, lsl #1 ++ vldr d20, [r1, #8] ++ vldr d2, [r1] ++ add r1, r1, r3, lsl #1 ++ vldr d4, [r6, #-8] ++ vldr d3, [r6] ++ vldr d21, [r1, #-8] ++ vldr d22, [r1] ++ ++1: vext.8 d0, d18, d19, #\pb ++ vext.8 d4, d4, d3, #8 - \pb ++ vext.8 d1, d2, d20, #\pb ++ subs r12, #2 ++ vext.8 d5, d21, d22, #8 - \pb ++ ++ bl \body_fn ++ ++ vst1.8 {d0}, [r0, :64], r2 ++ vst1.8 {d1}, [r7, :64], r2 ++ ble 2f ++ ++ vldr d19, [r6, #8] ++ add r6, r6, r3, lsl #1 ++ vldr d20, [r1, #8] ++ vmov d18, d3 ++ vldr d2, [r1] ++ add r1, r1, r3, lsl #1 ++ vldr d4, [r6, #-8] ++ vldr d3, [r6] ++ vldr d21, [r1, #-8] ++ vldr d22, [r1] ++ b 1b ++ ++2: pop {r7, pc} ++.endm ++ ++.macro edge_4bx4_e3, body_fn, pb ++ @ e3 is the same as e2 but with the X offset reversed ++ edge_4bx4_e2 \body_fn, (-\pb) ++.endm ++ ++@ Jump table entry - if in neon mode the bottom bit must be set ++@ ? There is probably a real asm instruction to do this but I haven't found it ++.macro jent lab ++.if jent_pic ++@ Could use .short here but due to A32 not supporting ldrh [lsl#1] it is ++@ simpler and clearer in the code to stick with .word ++T .word (0 + \lab) - (4 + 98b) ++A .word (0 + \lab) - (8 + 98b) ++.else ++T .word 1 + \lab ++A .word \lab ++.endif ++.endm ++ ++.macro edge_64b_bodies, body_fn, pb ++ jent 0f ++ jent 10f ++ jent 20f ++ jent 30f ++ ++0: edge_64b_e0 \body_fn, \pb ++10: edge_64b_e1 \body_fn ++20: edge_64b_e2 \body_fn, \pb ++30: edge_64b_e3 \body_fn, \pb ++.endm ++ ++.macro edge_32bx2_bodies, body_fn, pb ++ jent 0f ++ jent 10f ++ jent 20f ++ jent 30f ++ ++0: edge_32bx2_e0 \body_fn, \pb ++10: edge_32bx2_e1 \body_fn ++20: edge_32bx2_e2 \body_fn, \pb ++30: edge_32bx2_e3 \body_fn, \pb ++.endm ++ ++.macro edge_16b_bodies, body_fn, pb ++ jent 0f ++ jent 10f ++ jent 20f ++ jent 30f ++ ++0: edge_16b_e0 \body_fn, \pb ++10: edge_16b_e1 \body_fn ++20: edge_16b_e2 \body_fn, \pb ++30: edge_16b_e3 \body_fn, \pb ++.endm ++ ++.macro edge_32bx2_16b_bodies, body_fn_64b, body_fn_16b, pb ++ jent 0f ++ jent 10f ++ jent 20f ++ jent 30f ++ jent 5f ++ jent 15f ++ jent 25f ++ jent 35f ++ ++0: edge_32bx2_e0 \body_fn_64b, \pb ++10: edge_32bx2_e1 \body_fn_64b ++20: edge_32bx2_e2 \body_fn_64b, \pb ++30: edge_32bx2_e3 \body_fn_64b, \pb ++5: edge_16b_e0 \body_fn_16b, \pb ++15: edge_16b_e1 \body_fn_16b ++25: edge_16b_e2 \body_fn_16b, \pb ++35: edge_16b_e3 \body_fn_16b, \pb ++.endm ++ ++.macro edge_16b_8bx2_bodies, body_fn, pb ++ jent 0f ++ jent 10f ++ jent 20f ++ jent 30f ++ jent 5f ++ jent 15f ++ jent 25f ++ jent 35f ++ ++0: edge_16b_e0 \body_fn, \pb ++10: edge_16b_e1 \body_fn ++20: edge_16b_e2 \body_fn, \pb ++30: edge_16b_e3 \body_fn, \pb ++5: edge_8bx2_e0 \body_fn, \pb ++15: edge_8bx2_e1 \body_fn ++25: edge_8bx2_e2 \body_fn, \pb ++35: edge_8bx2_e3 \body_fn, \pb ++.endm ++ ++.macro edge_8bx2_4bx4_bodies, body_fn, pb ++ jent 0f ++ jent 10f ++ jent 20f ++ jent 30f ++ jent 5f ++ jent 15f ++ jent 25f ++ jent 35f ++ ++0: edge_8bx2_e0 \body_fn, \pb ++10: edge_8bx2_e1 \body_fn ++20: edge_8bx2_e2 \body_fn, \pb ++30: edge_8bx2_e3 \body_fn, \pb ++5: edge_4bx4_e0 \body_fn, \pb ++15: edge_4bx4_e1 \body_fn ++25: edge_4bx4_e2 \body_fn, \pb ++35: edge_4bx4_e3 \body_fn, \pb ++.endm ++ ++@ void ff_hevc_rpi_sao_edge_8_neon_8( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ int stride_dst, [r2] ++@ int16_t *_sao_offset_val, [r3] ++@ int eo, [sp, #0] ++@ int width, [sp, #4] ++@ int height) [sp, #8] ++ ++function ff_hevc_rpi_sao_edge_8_neon_8, export=1 ++ edge_16b_init 8, 0, 1, 99f ++99: ++ edge_8bx2_4bx4_bodies edge_16b_body_8, 1 ++endfunc ++ ++@ void ff_hevc_rpi_sao_edge_16_neon_8( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ int stride_dst, [r2] ++@ int16_t *_sao_offset_val, [r3] ++@ int eo, [sp, #0] ++@ int width, [sp, #4] ++@ int height) [sp, #8] ++ ++function ff_hevc_rpi_sao_edge_16_neon_8, export=1 ++ edge_16b_init 8, 0, 0, 99f ++99: ++ edge_16b_bodies edge_16b_body_8, 1 ++endfunc ++ ++@ void ff_hevc_rpi_sao_edge_32_neon_8( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ int stride_dst, [r2] ++@ int16_t *_sao_offset_val, [r3] ++@ int eo, [sp, #0] ++@ int width, [sp, #4] ++@ int height) [sp, #8] ++ ++function ff_hevc_rpi_sao_edge_32_neon_8, export=1 ++ edge_64b_init 8, 0, 0, 99f ++99: ++ edge_32bx2_bodies edge_64b_body_8, 1 ++endfunc ++ ++@ void ff_hevc_rpi_sao_edge_64_neon_8( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ int stride_dst, [r2] ++@ int16_t *_sao_offset_val, [r3] ++@ int eo, [sp, #0] ++@ int width, [sp, #4] ++@ int height) [sp, #8] ++ ++function ff_hevc_rpi_sao_edge_64_neon_8, export=1 ++ edge_64b_init 8, 0, 0, 99f ++99: ++ edge_64b_bodies edge_64b_body_8, 1 ++endfunc ++ ++@ ff_hevc_rpi_sao_edge_c_8_neon_8( ++@ uint8_t *_dst, [r0] ++@ const uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ const int16_t *_sao_offset_val_u, [r3] ++@ const int16_t *_sao_offset_val_v, [sp, #0] ++@ int eo, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_edge_c_8_neon_8, export=1 ++ edge_16b_init 8, 1, 1, 99f ++99: ++ edge_16b_8bx2_bodies edge_16b_body_8, 2 ++endfunc ++ ++@ ff_hevc_rpi_sao_edge_c_16_neon_8( ++@ uint8_t *_dst, [r0] ++@ const uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ const int16_t *_sao_offset_val_u, [r3] ++@ const int16_t *_sao_offset_val_v, [sp, #0] ++@ int eo, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_edge_c_16_neon_8, export=1 ++ edge_64b_init 8, 1, 0, 99f ++99: ++ edge_32bx2_bodies edge_64b_body_8, 2 ++endfunc ++ ++@ ff_hevc_rpi_sao_edge_c_32_neon_8( ++@ uint8_t *_dst, [r0] ++@ const uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ const int16_t *_sao_offset_val_u, [r3] ++@ const int16_t *_sao_offset_val_v, [sp, #0] ++@ int eo, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_edge_c_32_neon_8, export=1 ++ edge_64b_init 8, 1, 0, 99f ++99: ++ edge_64b_bodies edge_64b_body_8, 2 ++endfunc ++ ++@ void ff_hevc_rpi_sao_edge_8_neon_10( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ int stride_dst, [r2] ++@ int16_t *_sao_offset_val, [r3] ++@ int eo, [sp, #0] ++@ int width, [sp, #4] ++@ int height) [sp, #8] ++ ++function ff_hevc_rpi_sao_edge_8_neon_10, export=1 ++ edge_16b_init 10, 0, 1, 99f ++99: ++ edge_16b_8bx2_bodies edge_16b_body_16, 2 ++endfunc ++ ++@ void ff_hevc_rpi_sao_edge_16_neon_10( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ int stride_dst, [r2] ++@ int16_t *_sao_offset_val, [r3] ++@ int eo, [sp, #0] ++@ int width, [sp, #4] ++@ int height) [sp, #8] ++ ++function ff_hevc_rpi_sao_edge_16_neon_10, export=1 ++ edge_64b_init 10, 0, 0, 99f ++99: ++ edge_32bx2_bodies edge_64b_body_16, 2 ++endfunc ++ ++@ void ff_hevc_rpi_sao_edge_64_neon_10( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ int stride_dst, [r2] ++@ int16_t *_sao_offset_val, [r3] ++@ int eo, [sp, #0] ++@ int width, [sp, #4] ++@ int height) [sp, #8] ++ ++@ We simply split the 32 case into 2 vertical stripes ++@ and call the fns for w32 ++@ ++@ Calling code will always have src != dst so we don't have to worry ++@ about edge effects ++ ++function ff_hevc_rpi_sao_edge_64_neon_10, export=1 ++ edge_64b_init 10, 0, 1, 99f, xjump=1 ++endfunc ++ ++@ void ff_hevc_rpi_sao_edge_32_neon_10( ++@ uint8_t *_dst, [r0] ++@ uint8_t *_src, [r1] ++@ int stride_dst, [r2] ++@ int16_t *_sao_offset_val, [r3] ++@ int eo, [sp, #0] ++@ int width, [sp, #4] ++@ int height) [sp, #8] ++ ++function ff_hevc_rpi_sao_edge_32_neon_10, export=1 ++ edge_64b_init 10, 0, 0, 99f ++99: ++ edge_64b_bodies edge_64b_body_16, 2 ++endfunc ++ ++@ ff_hevc_rpi_sao_edge_c_8_neon_10( ++@ uint8_t *_dst, [r0] ++@ const uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ const int16_t *_sao_offset_val_u, [r3] ++@ const int16_t *_sao_offset_val_v, [sp, #0] ++@ int eo, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_edge_c_8_neon_10, export=1 ++ edge_xxb_init 10, 1, 99f, check_w4=1, setup_16b=1, setup_64b=1 ++99: ++ edge_32bx2_16b_bodies edge_64b_body_16, edge_16b_body_16, 4 ++endfunc ++ ++@ ff_hevc_rpi_sao_edge_c_32_neon_10( ++@ uint8_t *_dst, [r0] ++@ const uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ const int16_t *_sao_offset_val_u, [r3] ++@ const int16_t *_sao_offset_val_v, [sp, #0] ++@ int eo, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_edge_c_32_neon_10, export=1 ++ edge_64b_init 10, 1, 1, 99f, xjump=1 ++endfunc ++ ++ ++@ ff_hevc_rpi_sao_edge_c_16_neon_10( ++@ uint8_t *_dst, [r0] ++@ const uint8_t *_src, [r1] ++@ ptrdiff_t stride_dst, [r2] ++@ const int16_t *_sao_offset_val_u, [r3] ++@ const int16_t *_sao_offset_val_v, [sp, #0] ++@ int eo, [sp, #4] ++@ int width, [sp, #8] ++@ int height) [sp, #12] ++ ++function ff_hevc_rpi_sao_edge_c_16_neon_10, export=1 ++ edge_64b_init 10, 1, 0, 99f ++99: ++ edge_64b_bodies edge_64b_body_16, 4 ++endfunc ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcpred_arm.h +@@ -0,0 +1,28 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_ARM_HEVCPRED_ARM_H ++#define AVCODEC_ARM_HEVCPRED_ARM_H ++ ++#include "libavcodec/rpi_hevcpred.h" ++ ++void ff_hevc_rpi_pred_init_arm(HEVCRpiPredContext * const c, const int bit_depth); ++void ff_hevc_rpi_pred_init_neon(HEVCRpiPredContext * const c, const int bit_depth); ++ ++#endif /* AVCODEC_ARM_HEVCPRED_ARM_H */ ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcpred_init_arm.c +@@ -0,0 +1,35 @@ ++/* ++ * Copyright (c) 2018 John Cox (for Raspberry Pi) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/attributes.h" ++#include "libavutil/cpu.h" ++#include "libavutil/arm/cpu.h" ++ ++#include "libavcodec/rpi_hevcpred.h" ++#include "rpi_hevcpred_arm.h" ++ ++av_cold void ff_hevc_rpi_pred_init_arm(HEVCRpiPredContext * const c, const int bit_depth) ++{ ++ int cpu_flags = av_get_cpu_flags(); ++ ++ if (have_neon(cpu_flags)) ++ ff_hevc_rpi_pred_init_neon(c, bit_depth); ++} ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcpred_init_neon.c +@@ -0,0 +1,210 @@ ++/* ++ * Copyright (c) 2018 John Cox (for Raspberry Pi) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "rpi_hevcpred_arm.h" ++ ++intra_filter_fn_t ff_hevc_rpi_intra_filter_4_neon_8; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_8_neon_8; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_4_neon_16; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_8_neon_16; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_16_neon_16; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_4_neon_32; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_8_neon_32; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_16_neon_32; ++ ++void ff_hevc_rpi_pred_angular_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_32_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_c_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_c_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_c_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_32_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_c_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_c_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_angular_c_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++ ++void ff_hevc_rpi_pred_vertical_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_32_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_c_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_c_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_c_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_32_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_c_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_c_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_vertical_c_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++ ++void ff_hevc_rpi_pred_horizontal_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_32_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_c_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_c_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_c_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_32_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_c_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_c_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++void ff_hevc_rpi_pred_horizontal_c_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int mode); ++ ++void ff_hevc_rpi_pred_planar_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_32_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_c_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_c_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_c_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_32_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_c_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_c_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_planar_c_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++ ++void ff_hevc_rpi_pred_dc_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_32_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_c_4_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_c_8_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_c_16_neon_8(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_32_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_c_4_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_c_8_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++void ff_hevc_rpi_pred_dc_c_16_neon_10(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride); ++ ++void ff_hevc_rpi_pred_init_neon(HEVCRpiPredContext * const c, const int bit_depth) ++{ ++ switch (bit_depth) ++ { ++ case 8: ++ c->intra_filter[0] = ff_hevc_rpi_intra_filter_4_neon_8; ++ c->intra_filter[1] = ff_hevc_rpi_intra_filter_8_neon_8; ++ c->intra_filter_c[0] = ff_hevc_rpi_intra_filter_4_neon_16; // Equivalent to c_4_neon_8 ++ c->intra_filter_c[1] = ff_hevc_rpi_intra_filter_8_neon_16; ++ c->intra_filter_c[2] = ff_hevc_rpi_intra_filter_16_neon_16; ++ ++ c->pred_angular[0] = ff_hevc_rpi_pred_angular_4_neon_8; ++ c->pred_angular[1] = ff_hevc_rpi_pred_angular_8_neon_8; ++ c->pred_angular[2] = ff_hevc_rpi_pred_angular_16_neon_8; ++ c->pred_angular[3] = ff_hevc_rpi_pred_angular_32_neon_8; ++ c->pred_angular_c[0] = ff_hevc_rpi_pred_angular_c_4_neon_8; ++ c->pred_angular_c[1] = ff_hevc_rpi_pred_angular_c_8_neon_8; ++ c->pred_angular_c[2] = ff_hevc_rpi_pred_angular_c_16_neon_8; ++ ++ c->pred_horizontal[0] = ff_hevc_rpi_pred_horizontal_4_neon_8; ++ c->pred_horizontal[1] = ff_hevc_rpi_pred_horizontal_8_neon_8; ++ c->pred_horizontal[2] = ff_hevc_rpi_pred_horizontal_16_neon_8; ++ c->pred_horizontal[3] = ff_hevc_rpi_pred_horizontal_32_neon_8; ++ c->pred_horizontal_c[0] = ff_hevc_rpi_pred_horizontal_c_4_neon_8; ++ c->pred_horizontal_c[1] = ff_hevc_rpi_pred_horizontal_c_8_neon_8; ++ c->pred_horizontal_c[2] = ff_hevc_rpi_pred_horizontal_c_16_neon_8; ++ ++ c->pred_vertical[0] = ff_hevc_rpi_pred_vertical_4_neon_8; ++ c->pred_vertical[1] = ff_hevc_rpi_pred_vertical_8_neon_8; ++ c->pred_vertical[2] = ff_hevc_rpi_pred_vertical_16_neon_8; ++ c->pred_vertical[3] = ff_hevc_rpi_pred_vertical_32_neon_8; ++ c->pred_vertical_c[0] = ff_hevc_rpi_pred_vertical_c_4_neon_8; ++ c->pred_vertical_c[1] = ff_hevc_rpi_pred_vertical_c_8_neon_8; ++ c->pred_vertical_c[2] = ff_hevc_rpi_pred_vertical_c_16_neon_8; ++ ++ c->pred_planar[0] = ff_hevc_rpi_pred_planar_4_neon_8; ++ c->pred_planar[1] = ff_hevc_rpi_pred_planar_8_neon_8; ++ c->pred_planar[2] = ff_hevc_rpi_pred_planar_16_neon_8; ++ c->pred_planar[3] = ff_hevc_rpi_pred_planar_32_neon_8; ++ c->pred_planar_c[0] = ff_hevc_rpi_pred_planar_c_4_neon_8; ++ c->pred_planar_c[1] = ff_hevc_rpi_pred_planar_c_8_neon_8; ++ c->pred_planar_c[2] = ff_hevc_rpi_pred_planar_c_16_neon_8; ++ ++ c->pred_dc[0] = ff_hevc_rpi_pred_dc_4_neon_8; ++ c->pred_dc[1] = ff_hevc_rpi_pred_dc_8_neon_8; ++ c->pred_dc[2] = ff_hevc_rpi_pred_dc_16_neon_8; ++ c->pred_dc[3] = ff_hevc_rpi_pred_dc_32_neon_8; ++ c->pred_dc_c[0] = ff_hevc_rpi_pred_dc_c_4_neon_8; ++ c->pred_dc_c[1] = ff_hevc_rpi_pred_dc_c_8_neon_8; ++ c->pred_dc_c[2] = ff_hevc_rpi_pred_dc_c_16_neon_8; ++ break; ++ case 10: ++ c->intra_filter[0] = ff_hevc_rpi_intra_filter_4_neon_16; ++ c->intra_filter[1] = ff_hevc_rpi_intra_filter_8_neon_16; ++ c->intra_filter[2] = ff_hevc_rpi_intra_filter_16_neon_16; ++ c->intra_filter_c[0] = ff_hevc_rpi_intra_filter_4_neon_32; ++ c->intra_filter_c[1] = ff_hevc_rpi_intra_filter_8_neon_32; ++ c->intra_filter_c[2] = ff_hevc_rpi_intra_filter_16_neon_32; ++ ++ c->pred_angular[0] = ff_hevc_rpi_pred_angular_4_neon_10; ++ c->pred_angular[1] = ff_hevc_rpi_pred_angular_8_neon_10; ++ c->pred_angular[2] = ff_hevc_rpi_pred_angular_16_neon_10; ++ c->pred_angular[3] = ff_hevc_rpi_pred_angular_32_neon_10; ++ c->pred_angular_c[0] = ff_hevc_rpi_pred_angular_c_4_neon_10; ++ c->pred_angular_c[1] = ff_hevc_rpi_pred_angular_c_8_neon_10; ++ c->pred_angular_c[2] = ff_hevc_rpi_pred_angular_c_16_neon_10; ++ ++ c->pred_horizontal[0] = ff_hevc_rpi_pred_horizontal_4_neon_10; ++ c->pred_horizontal[1] = ff_hevc_rpi_pred_horizontal_8_neon_10; ++ c->pred_horizontal[2] = ff_hevc_rpi_pred_horizontal_16_neon_10; ++ c->pred_horizontal[3] = ff_hevc_rpi_pred_horizontal_32_neon_10; ++ c->pred_horizontal_c[0] = ff_hevc_rpi_pred_horizontal_c_4_neon_10; ++ c->pred_horizontal_c[1] = ff_hevc_rpi_pred_horizontal_c_8_neon_10; ++ c->pred_horizontal_c[2] = ff_hevc_rpi_pred_horizontal_c_16_neon_10; ++ ++ c->pred_vertical[0] = ff_hevc_rpi_pred_vertical_4_neon_10; ++ c->pred_vertical[1] = ff_hevc_rpi_pred_vertical_8_neon_10; ++ c->pred_vertical[2] = ff_hevc_rpi_pred_vertical_16_neon_10; ++ c->pred_vertical[3] = ff_hevc_rpi_pred_vertical_32_neon_10; ++ c->pred_vertical_c[0] = ff_hevc_rpi_pred_vertical_c_4_neon_10; ++ c->pred_vertical_c[1] = ff_hevc_rpi_pred_vertical_c_8_neon_10; ++ c->pred_vertical_c[2] = ff_hevc_rpi_pred_vertical_c_16_neon_10; ++ ++ c->pred_planar[0] = ff_hevc_rpi_pred_planar_4_neon_10; ++ c->pred_planar[1] = ff_hevc_rpi_pred_planar_8_neon_10; ++ c->pred_planar[2] = ff_hevc_rpi_pred_planar_16_neon_10; ++ c->pred_planar[3] = ff_hevc_rpi_pred_planar_32_neon_10; ++ c->pred_planar_c[0] = ff_hevc_rpi_pred_planar_c_4_neon_10; ++ c->pred_planar_c[1] = ff_hevc_rpi_pred_planar_c_8_neon_10; ++ c->pred_planar_c[2] = ff_hevc_rpi_pred_planar_c_16_neon_10; ++ ++ c->pred_dc[0] = ff_hevc_rpi_pred_dc_4_neon_10; ++ c->pred_dc[1] = ff_hevc_rpi_pred_dc_8_neon_10; ++ c->pred_dc[2] = ff_hevc_rpi_pred_dc_16_neon_10; ++ c->pred_dc[3] = ff_hevc_rpi_pred_dc_32_neon_10; ++ c->pred_dc_c[0] = ff_hevc_rpi_pred_dc_c_4_neon_10; ++ c->pred_dc_c[1] = ff_hevc_rpi_pred_dc_c_8_neon_10; ++ c->pred_dc_c[2] = ff_hevc_rpi_pred_dc_c_16_neon_10; ++ break; ++ default: ++ break; ++ } ++} ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcpred_intra_angular_neon.S +@@ -0,0 +1,2984 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++/* ++ * General angular pred ++ * ++ * Horizontal (10) & Vertical (26) cases have their own file ++ * and are not dealt with properly here (luma filtering is missing) ++ * ++ * The inv_angle calculations are annoying - if it wasn't for the +128 ++ * rounding step then the result would simply be the loop counter :-( ++ */ ++ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++.text ++ ++@ Horizontal Patch functions ++@ These need a transpose before store so exist as smaller patches ++@ Patches can be called repeatedly without any intermediate setup ++@ to generate a horizontal block ++@ ++@ It is almost certainly the case that larger patch fns can be built ++@ and they would be a little faster, but we would still need the small ++@ fns and code size (or at least instruction cache size) is an issue ++@ given how much code we already have here ++ ++@ Generate 8x8 luma 8 patch ++@ ++@ r3 Out stride ++@ r4 Angle add ++@ r7 Inv angle (_up only) ++@ ++@ In/Out (updated) ++@ r0 Out pointer - on exit point to start of next patch horizontally (i.e. r0 + patch width) ++@ r2 Left ptr - updated ++@ r10 Inv angle accumulator (_up only) ++@ r12 32 - angle frac (_down) or angle frac (_up) ++@ d0 Older reference samples ++@ d1=r8+r9 Newer reference samples ++@ d2 32 - angle frac ++@ d3 Angle frac ++@ q2 Partially computed next result (_up only) ++@ ++@ Temps ++@ r5 Loop counter ++@ r6 ++@ r7 (_down only) ++@ r11 (_up only) ++@ q2, q8-q11 ++ ++patch_h_down_8x8_8: ++ ldrd r8, r9, [r2] @ Left ++ rsb r12, r6, #32 ++ vmov d0, r8, r9 ++ vdup.8 d3, r6 ++ lsr r8, #8 ++ vdup.8 d2, r12 ++ orr r8, r8, r9, lsl #24 ++ ldr r9, [r2, #5]! ++ vmov d1, r8, r9 ++ // drop through... ++patch_h_down_8x8_8_continue: ++ mov r5, #8 ++1: ++ subs r12, r4 ++ vmull.u8 q2, d0, d2 ++ it mi ++ addmi r12, #32 ++ vmlal.u8 q2, d1, d3 ++ rsb r6, r12, #32 ++ vext.8 q8, q8, q9, #8 ++ itt mi ++ lsrmi r7, r8, #8 ++ vmovmi d0, r8, r9 ++ vdup.8 d2, r12 ++ vext.8 q9, q9, q10, #8 ++ it mi ++ orrmi r8, r7, r9, lsl #24 ++ vext.8 q10, q10, q11, #8 ++ it mi ++ ldrmi r9, [r2, #1]! ++ vmov d22, d23 ++ vrshrn.u16 d23, q2, #5 ++ it mi ++ vmovmi d1, r8, r9 ++ subs r5, #1 ++ vdup.8 d3, r6 ++ bne 1b ++ // drop through... ++store_tran_8x8_8: ++ vzip.8 d16, d17 ++ add r6, r0, r3 ++ vzip.8 d18, d19 ++ lsl r3, #1 ++ vzip.8 d20, d21 ++ add r5, r0, r3 ++ vzip.8 d22, d23 ++ vzip.16 q8, q9 ++ vzip.16 q10, q11 ++ vzip.32 q8, q10 ++ vzip.32 q9, q11 ++ vst1.8 {d16}, [r0]! ++ vst1.8 {d17}, [r6], r3 ++ vst1.8 {d20}, [r5], r3 ++ vst1.8 {d21}, [r6], r3 ++ vst1.8 {d18}, [r5], r3 ++ vst1.8 {d19}, [r6], r3 ++ vst1.8 {d22}, [r5] ++ asr r3, #1 ++ vst1.8 {d23}, [r6] ++ ++ bx lr ++ ++patch_h_up_8x8_8: ++ ldrd r8, r9, [r2] ++ rsb r6, r4, #32 ++ vmov d0, r8, r9 ++ vdup.8 d3, r4 ++ lsr r11, r8, #24 ++ vdup.8 d2, r6 ++ ldr r8, [r2, #-1]! ++ orr r9, r11, r9, lsl #8 ++ vmov d1, r8, r9 ++ mov r12, r4 ++ vmull.u8 q2, d0, d2 ++ vmlal.u8 q2, d1, d3 ++patch_h_up_8x8_8_continue: ++ mov r5, #8 ++1: ++ add r12, r4 ++ mov r11, #0 ++ cmp r12, #33 ++ it cs ++ addcs r10, r7 ++ vext.8 q8, q8, q9, #8 ++ itt cs ++ subcs r12, #32 ++ tstcs r10, #1<<31 ++ rsb r6, r12, #32 ++ it eq ++ asreq r11, r10, #8 ++ it cs ++ vmovcs d0, r8, r9 ++ vdup.8 d2, r6 ++ it cs ++ lsrcs r6, r8, #24 ++ vext.8 q9, q9, q10, #8 ++ itt cs ++ orrcs r9, r6, r9, lsl #8 ++ ldrbcs r11, [r1, r11] ++ vdup.8 d3, r12 ++ vext.8 q10, q10, q11, #8 ++ it hi ++ ldrbhi r11, [r2, #-1]! ++ vmov d22, d23 ++ vrshrn.u16 d23, q2, #5 ++ itt cs ++ orrcs r8, r11, r8, lsl #8 ++ vmovcs d1, r8, r9 ++ vmull.u8 q2, d0, d2 ++ subs r5, #1 ++ vmlal.u8 q2, d1, d3 ++ bne 1b ++ ++ b store_tran_8x8_8 ++ ++ ++.macro ADRT reg, val ++@ adr in T32 has enough range but not in A32 ++A adrl \reg, \val ++T adr \reg, \val ++.endm ++ ++@ ff_hevc_rpi_pred_angular_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_4_neon_8, export=1 ++ ldr r12, [sp] ++ push {r4-r8, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ ldr lr, [r2], #1 @ Top ++ rsb r12, r6, #32 ++ vmov s0, lr ++ vdup.8 d3, r6 ++ ldr lr, [r2], #1 ++ vdup.8 d2, r12 ++ vmov s2, lr ++ subs r12, r4 ++ vmull.u8 q2, d0, d2 ++ it mi ++ addmi r12, #32 ++ vmlal.u8 q2, d1, d3 ++ rsb r6, r12, #32 ++ itt mi ++ vmovmi s0, lr ++ ldrmi lr, [r2], #1 ++ vdup.8 d2, r12 ++ it mi ++ vmovmi s2, lr ++ vdup.8 d3, r6 ++ mov r5, #2 ++1: ++ vrshrn.u16 d20, q2, #5 ++ subs r12, r4 ++ vmull.u8 q2, d0, d2 ++ it mi ++ addmi r12, #32 ++ vmlal.u8 q2, d1, d3 ++ rsb r6, r12, #32 ++ vext.64 q8, q8, q9, #1 ++ it mi ++ vmovmi s0, lr ++ vext.64 q9, q9, q10, #1 ++ it mi ++ ldrmi lr, [r2], #1 ++ vdup.8 d2, r12 ++ it mi ++ vmovmi s2, lr ++ subs r5, #1 ++ vdup.8 d3, r6 ++ bne 1b ++ ++ vrshrn.u16 d20, q2, #5 ++ vmull.u8 q2, d0, d2 ++ add r12, r0, r3 ++ vmlal.u8 q2, d1, d3 ++ lsl r3, #1 ++ vext.64 q8, q8, q9, #1 ++ vext.64 q9, q9, q10, #1 ++ vrshrn.u16 d20, q2, #5 ++ ++98: ++ vst4.8 {d17[0], d18[0], d19[0], d20[0]}, [r0], r3 ++ vst4.8 {d17[1], d18[1], d19[1], d20[1]}, [r12], r3 ++ vst4.8 {d17[2], d18[2], d19[2], d20[2]}, [r0] ++ vst4.8 {d17[3], d18[3], d19[3], d20[3]}, [r12] ++ pop {r4-r8, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ rsb r12, r6, #32 ++ ldr lr, [r2] @ Left ++ ldrb r2, [r2, #-1] @ Top-left ++ vmov s0, lr ++ vdup.8 d2, r12 ++ vdup.8 d3, r6 ++ orr lr, r2, lr, lsl #8 ++ vmov s2, lr ++ sub r8, r7, #128 ++ mov r5, #3 ++2: ++ vmull.u8 q2, d0, d2 ++ subs r12, r4 ++ vmlal.u8 q2, d1, d3 ++T it mi ++ addmi r12, #32 ++T asr r6, r8, #8 ++T it mi ++T ldrbmi r2, [r1, r6] ++A ldrbmi r2, [r1, r8, asr #8] ++ rsb r6, r12, #32 ++ vdup.8 d2, r12 ++ ittt mi ++ vmovmi s0, lr ++ orrmi lr, r2, lr, lsl #8 ++ vmovmi s2, lr ++ vrshrn.u16 d20, q2, #5 ++ vdup.8 d3, r6 ++ it mi ++ addmi r8, r7 ++ subs r5, #1 ++ vext.64 q8, q8, q9, #1 ++ vext.64 q9, q9, q10, #1 ++ bne 2b ++ ++ vmull.u8 q2, d0, d2 ++ add r12, r0, r3 ++ vmlal.u8 q2, d1, d3 ++ lsl r3, #1 ++ vrshrn.u16 d20, q2, #5 ++ b 98b ++ ++@ Left of vertical - works down left ++18: ++ ldrh r7, [r7] ++ rsb r12, r6, #32 ++ ldr lr, [r1] @ Top ++ ldrb r1, [r2, #-1] @ Top-left ++ vmov s0, lr ++ vdup.8 d2, r12 ++ vdup.8 d3, r6 ++ orr lr, r1, lr, lsl #8 ++ vmov s2, lr ++ sub r8, r7, #128 ++ mov r5, #3 ++2: ++ vmull.u8 q2, d0, d2 ++ subs r12, r4 ++ vmlal.u8 q2, d1, d3 ++T it mi ++ addmi r12, #32 ++T asr r6, r8, #8 ++T it mi ++T ldrbmi r1, [r2, r6] ++A ldrbmi r1, [r2, r8, asr #8] ++ rsb r6, r12, #32 ++ vdup.8 d2, r12 ++ ittt mi ++ vmovmi s0, lr ++ orrmi lr, r1, lr, lsl #8 ++ vmovmi s2, lr ++ vrshrn.u16 d4, q2, #5 ++ vdup.8 d3, r6 ++ it mi ++ addmi r8, r7 ++ subs r5, #1 ++ vst1.32 {d4[0]}, [r0], r3 ++ bne 2b ++ ++ vmull.u8 q2, d0, d2 ++ vmlal.u8 q2, d1, d3 ++ vrshrn.u16 d4, q2, #5 ++ vst1.32 {d4[0]}, [r0] ++ ++ pop {r4-r8, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ ldr lr, [r1], #1 @ Top ++ rsb r12, r6, #32 ++ vmov s0, lr ++ vdup.8 d3, r6 ++ ldr lr, [r1], #1 ++ vdup.8 d2, r12 ++ vmov s2, lr ++ subs r12, r4 ++ vmull.u8 q2, d0, d2 ++ it mi ++ addmi r12, #32 ++ vmlal.u8 q2, d1, d3 ++ rsb r6, r12, #32 ++ itt mi ++ vmovmi s0, lr ++ ldrmi lr, [r1], #1 ++ vdup.8 d2, r12 ++ it mi ++ vmovmi s2, lr ++ vdup.8 d3, r6 ++ mov r5, #2 ++1: ++ vrshrn.u16 d6, q2, #5 ++ subs r12, r4 ++ vmull.u8 q2, d0, d2 ++ it mi ++ addmi r12, #32 ++ vmlal.u8 q2, d1, d3 ++ rsb r6, r12, #32 ++ vst1.32 {d6[0]}, [r0], r3 ++ itt mi ++ vmovmi s0, lr ++ ldrmi lr, [r1], #1 ++ vdup.8 d2, r12 ++ it mi ++ vmovmi s2, lr ++ subs r5, #1 ++ vdup.8 d3, r6 ++ bne 1b ++ ++ vrshrn.u16 d6, q2, #5 ++ vmull.u8 q2, d0, d2 ++ vmlal.u8 q2, d1, d3 ++ vst1.32 {d6[0]}, [r0], r3 ++ vrshrn.u16 d6, q2, #5 ++ vst1.32 {d6[0]}, [r0] ++ ++ pop {r4-r8, pc} ++ ++endfunc ++ ++ ++ ++@ ff_hevc_rpi_pred_angular_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_8_neon_8, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ bl patch_h_down_8x8_8 ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ bl patch_h_up_8x8_8 ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ ldrd r8, r9, [r1] @ Top ++ rsb r12, r6, #32 ++ ldrb lr, [r2, #-1] @ Top-left ++ ldrh r7, [r7] ++ vmov d0, r8, r9 ++ lsl r9, r9, #8 ++ vdup.8 d2, r12 ++ orr r9, r9, r8, lsr #24 ++ orr r8, lr, r8, lsl #8 ++ vmov d1, r8, r9 ++ sub r1, r7, #128 ++ mov r5, #7 ++1: ++ vdup.8 d3, r6 ++ vmull.u8 q2, d0, d2 ++ subs r12, r12, r4 ++ vmlal.u8 q2, d1, d3 ++ ittt mi ++ addmi lr, r2, r1, asr #8 ++ addmi r12, r12, #32 ++ vmovmi d0, r8, r9 ++ rsb r6, r12, #32 ++ itt mi ++ lslmi r9, r9, #8 ++ ldrbmi lr, [lr] ++ vdup.8 d2, r12 ++ vrshrn.u16 d4, q2, #5 ++ itttt mi ++ orrmi r9, r9, r8, lsr #24 ++ orrmi r8, lr, r8, lsl #8 ++ vmovmi d1, r8, r9 ++ addmi r1, r1, r7 ++ subs r5, r5, #1 ++ vst1.8 {d4}, [r0], r3 ++ bne 1b ++ ++ vdup.8 d3, r6 ++ vmull.u8 q2, d0, d2 ++ vmlal.u8 q2, d1, d3 ++ vrshrn.u16 d4, q2, #5 ++ vst1.8 {d4}, [r0] ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ ldrd r8, r9, [r1] @ Top ++ rsb r12, r6, #32 ++ vmov d0, r8, r9 ++ vdup.8 d3, r6 ++ mov r5, #7 ++ lsr r8, #8 ++ vdup.8 d2, r12 ++ orr r8, r8, r9, lsl #24 ++ ldr r9, [r1, #5]! ++ vmov d1, r8, r9 ++1: ++ vmull.u8 q2, d0, d2 ++ subs r12, r4 ++ vmlal.u8 q2, d1, d3 ++ it mi ++ addmi r12, #32 ++ rsb r6, r12, #32 ++ itt mi ++ vmovmi d0, r8, r9 ++ lsrmi r8, #8 ++ vdup.8 d2, r12 ++ itt mi ++ orrmi r8, r8, r9, lsl #24 ++ ldrmi r9, [r1, #1]! ++ vrshrn.u16 d6, q2, #5 ++ it mi ++ vmovmi d1, r8, r9 ++ vdup.8 d3, r6 ++ subs r5, #1 ++ vst1.8 {d6}, [r0], r3 ++ bne 1b ++ ++ vmull.u8 q2, d0, d2 ++ vmlal.u8 q2, d1, d3 ++ vrshrn.u16 d6, q2, #5 ++ vst1.8 {d6}, [r0] ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_16_neon_8, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ mov r1, r2 @ save r2 - r1 unused by patch_down ++ ++ bl patch_h_down_8x8_8 ++ bl patch_h_down_8x8_8_continue ++ ++ add r2, r1, #8 @ restore r2, but 8 rows further down left ++ sub r0, #16 ++ mov r6, r4 ++ add r0, r0, r3, lsl #3 ++ ++ bl patch_h_down_8x8_8 ++ bl patch_h_down_8x8_8_continue ++ ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ ++ push {r2} ++ bl patch_h_up_8x8_8 ++ bl patch_h_up_8x8_8_continue ++ pop {r2} ++ ++ sub r0, #16 ++ mov r10, #-128 ++ add r2, #8 ++ add r0, r0, r3, lsl #3 ++ sub r10, r10, r7, lsl #3 ++ ++ bl patch_h_up_8x8_8 ++ bl patch_h_up_8x8_8_continue ++ ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ vld1.8 {q9}, [r1] ++ sub r1, r2, #1 ++ rsb r12, r6, #32 ++ ldrh r7, [r7] ++ vdup.8 d6, r6 ++ vext.8 q8, q9, q9, #15 ++ sub r8, r7, #128 ++ vld1.8 {d16[0]}, [r1] ++ vdup.8 d7, r12 ++ mov r5, #15 ++1: ++ vmull.u8 q0, d18, d7 ++ subs r12, r4 ++ vmlal.u8 q0, d16, d6 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q1, d19, d7 ++ it cc ++ addcc r1, r2, r8, asr #8 ++ vmlal.u8 q1, d17, d6 ++ rsb r6, r12, #32 ++ vext.8 q10, q8, q8, #15 ++ sub r5, #1 ++ vld1.8 {d20[0]}, [r1] ++ it cc ++ addcc r8, r7 ++ vmov q11, q8 ++ teq r5, #0 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vst1.8 {q0}, [r0], r3 ++ bhi 1b ++ beq 4f ++2: ++ vmull.u8 q0, d22, d7 ++ subs r12, r4 ++ vmlal.u8 q0, d20, d6 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q1, d23, d7 ++ it cc ++ addcc r1, r2, r8, asr #8 ++ vmlal.u8 q1, d21, d6 ++ rsb r6, r12, #32 ++ vext.8 q8, q10, q10, #15 ++ sub r5, #1 ++ vld1.8 {d16[0]}, [r1] ++ it cc ++ addcc r8, r7 ++ vmov q9, q10 ++ teq r5, #0 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vst1.8 {q0}, [r0], r3 ++ bhi 2b ++ bne 1b ++ bcc 5f ++3: ++ vmull.u8 q0, d22, d7 ++ vmlal.u8 q0, d20, d6 ++ vmull.u8 q1, d23, d7 ++ vmlal.u8 q1, d21, d6 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vst1.8 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++4: ++ bcc 3b ++5: ++ vmull.u8 q0, d18, d7 ++ vmlal.u8 q0, d16, d6 ++ vmull.u8 q1, d19, d7 ++ vmlal.u8 q1, d17, d6 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vst1.8 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ vld1.8 {q9}, [r1]! ++ rsb r12, r6, #32 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vext.8 q8, q9, q9, #1 ++ vld1.8 {d17[7]}, [r1]! ++ mov r5, #15 ++1: ++ vmull.u8 q0, d16, d6 ++ subs r12, r4 ++ vmlal.u8 q0, d18, d7 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q1, d17, d6 ++ rsb r6, r12, #32 ++ vmlal.u8 q1, d19, d7 ++ sub r5, #1 ++ vext.8 q10, q8, q8, #1 ++ teq r5, #0 ++ vld1.8 {d21[7]}, [r1] ++ it cc ++ addcc r1, #1 ++ vmov q11, q8 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vst1.8 {q0}, [r0], r3 ++ bhi 1b ++ beq 4f ++2: ++ vmull.u8 q0, d20, d6 ++ subs r12, r4 ++ vmlal.u8 q0, d22, d7 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q1, d21, d6 ++ rsb r6, r12, #32 ++ vmlal.u8 q1, d23, d7 ++ sub r5, #1 ++ vext.8 q8, q10, q10, #1 ++ teq r5, #0 ++ vld1.8 {d17[7]}, [r1] ++ it cc ++ addcc r1, #1 ++ vmov q9, q10 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vst1.8 {q0}, [r0], r3 ++ bhi 2b ++ bne 1b ++ bcc 5f ++3: ++ vmull.u8 q0, d20, d6 ++ vmlal.u8 q0, d22, d7 ++ vmull.u8 q1, d21, d6 ++ vmlal.u8 q1, d23, d7 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vst1.8 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++4: ++ bcc 3b ++5: ++ vmull.u8 q0, d16, d6 ++ vmlal.u8 q0, d18, d7 ++ vmull.u8 q1, d17, d6 ++ vmlal.u8 q1, d19, d7 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vst1.8 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_32_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_32_neon_8, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ mov r10, #4 ++ mov r1, r2 ++1: ++ bl patch_h_down_8x8_8 ++ bl patch_h_down_8x8_8_continue ++ bl patch_h_down_8x8_8_continue ++ bl patch_h_down_8x8_8_continue ++ ++ add r2, r1, #8 @ restore r2, but 8 rows further down left ++ add r1, r1, #8 ++ mov r6, r4 ++ sub r0, #32 ++ subs r10, #1 ++ add r0, r0, r3, lsl #3 ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ vmov.i8 d6, #1<<2 ++1: ++ push {r2,r10} ++ bl patch_h_up_8x8_8 ++ bl patch_h_up_8x8_8_continue ++ bl patch_h_up_8x8_8_continue ++ bl patch_h_up_8x8_8_continue ++ pop {r2,r10} ++ ++ vmov r8, s12 ++ sub r0, #32 ++ add r2, #8 ++ add r0, r0, r3, lsl #3 ++ sub r10, r10, r7, lsl #3 ++ vshr.u8 d6, #1 ++ teq r8, #0 ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ vld1.8 {q0-q1}, [r1] ++ sub r9, r2, #1 ++ rsb r12, r6, #32 ++ ldrh r7, [r7] ++ mov r8, #-128 ++ vdup.8 d18, r6 ++ vdup.8 d19, r12 ++ mov r5, #32 ++1: ++ vld1.8 {d17[7]}, [r9] ++ add r8, r7 ++ vmov q2, q0 ++ vmov q3, q1 ++ add r9, r2, r8, asr #8 ++ vext.8 q1, q0, q1, #15 ++ vext.8 q0, q8, q0, #15 ++2: ++ vmull.u8 q10, d4, d19 ++ subs r12, r4 ++ vmlal.u8 q10, d0, d18 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q11, d5, d19 ++ rsb r6, r12, #32 ++ vmlal.u8 q11, d1, d18 ++ sub r5, #1 ++ vmull.u8 q12, d6, d19 ++ teq r5, #0 ++ vmlal.u8 q12, d2, d18 ++ vmull.u8 q13, d7, d19 ++ vmlal.u8 q13, d3, d18 ++ vdup.8 d18, r6 ++ vdup.8 d19, r12 ++ vrshrn.u16 d20, q10, #5 ++ vrshrn.u16 d21, q11, #5 ++ vrshrn.u16 d22, q12, #5 ++ vrshrn.u16 d23, q13, #5 ++ vst1.8 {q10-q11}, [r0], r3 ++ bhi 2b ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ add r5, r1, #32 ++ vld1.8 {q0-q1}, [r1]! ++ rsb r12, r6, #32 ++ vld1.8 {d16[0]}, [r5] ++ mov r5, #32 ++ vdup.8 d18, r6 ++ vdup.8 d19, r12 ++1: ++ vmov q2, q0 ++ add r1, #1 ++ vmov q3, q1 ++ vext.8 q0, q0, q1, #1 ++ vext.8 q1, q1, q8, #1 ++2: ++ vmull.u8 q10, d0, d18 ++ subs r12, r4 ++ vmlal.u8 q10, d4, d19 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q11, d1, d18 ++ rsb r6, r12, #32 ++ vmlal.u8 q11, d5, d19 ++ sub r5, #1 ++ vmull.u8 q12, d2, d18 ++ teq r5, #0 ++ vmlal.u8 q12, d6, d19 ++ vmull.u8 q13, d3, d18 ++ vmlal.u8 q13, d7, d19 ++ vld1.8 {d16[0]}, [r1] ++ vdup.8 d18, r6 ++ vdup.8 d19, r12 ++ vrshrn.u16 d20, q10, #5 ++ vrshrn.u16 d21, q11, #5 ++ vrshrn.u16 d22, q12, #5 ++ vrshrn.u16 d23, q13, #5 ++ vst1.8 {q10-q11}, [r0], r3 ++ bhi 2b ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++@ Chroma 8 bit 4x4 patch fns ++ .text ++ ++patch_h_down_c_4x4_8: ++ ldrd r8, r9, [r2] @ Left ++ rsb r12, r6, #32 ++ vmov d0, r8, r9 ++ vdup.8 d3, r6 ++ lsr r8, #16 ++ vdup.8 d2, r12 ++ orr r8, r8, r9, lsl #16 ++ ldr r9, [r2, #6]! ++ vmov d1, r8, r9 ++ // drop through... ++patch_h_down_c_4x4_8_continue: ++ mov r5, #4 ++1: ++ subs r12, r4 ++ vmull.u8 q2, d0, d2 ++ it mi ++ addmi r12, #32 ++ vmlal.u8 q2, d1, d3 ++ rsb r6, r12, #32 ++ vext.8 q8, q8, q9, #8 ++ it mi ++ lsrmi r7, r8, #16 ++ vmov d18, d19 ++ it mi ++ vmovmi d0, r8, r9 ++ vdup.8 d2, r12 ++ it mi ++ orrmi r8, r7, r9, lsl #16 ++ vrshrn.u16 d19, q2, #5 ++ itt mi ++ ldrmi r9, [r2, #2]! ++ vmovmi d1, r8, r9 ++ subs r5, #1 ++ vdup.8 d3, r6 ++ bne 1b ++ // drop through... ++store_tran_c_4x4_8: ++ vzip.16 d16, d17 ++ add r6, r0, r3 ++ vzip.16 d18, d19 ++ lsl r3, #1 ++ vzip.32 q8, q9 ++ add r5, r0, r3 ++ vst1.16 {d16}, [r0]! ++ vst1.16 {d17}, [r6], r3 ++ vst1.16 {d18}, [r5] ++ asr r3, #1 ++ vst1.16 {d19}, [r6] ++ ++ bx lr ++ ++patch_h_up_c_4x4_8: ++ ldrd r8, r9, [r2] ++ rsb r6, r4, #32 ++ vmov d0, r8, r9 ++ vdup.8 d3, r4 ++ lsr r11, r8, #16 ++ vdup.8 d2, r6 ++ ldr r8, [r2, #-2]! ++ orr r9, r11, r9, lsl #16 ++ vmov d1, r8, r9 ++ mov r12, r4 ++ vmull.u8 q2, d0, d2 ++ vmlal.u8 q2, d1, d3 ++patch_h_up_c_4x4_8_continue: ++ mov r5, #4 ++1: ++ add r12, r4 ++ cmp r12, #33 ++ it cs ++ addcs r10, r7 ++ mov r11, #0 ++ itt cs ++ subcs r12, #32 ++ tstcs r10, #1<<31 ++ rsb r6, r12, #32 ++ it eq ++ asreq r11, r10, #7 ++ it cs ++ vmovcs d0, r8, r9 ++ it eq ++ biceq r11, #1 ++ vdup.8 d2, r6 ++ it cs ++ lsrcs r6, r8, #16 ++ vdup.8 d3, r12 ++ vext.8 q8, q8, q9, #8 ++ itt cs ++ orrcs r9, r6, r9, lsl #16 ++ ldrhcs r11, [r1, r11] ++ vmov d18, d19 ++ it hi ++ ldrhhi r11, [r2, #-2]! ++ vrshrn.u16 d19, q2, #5 ++ itt cs ++ orrcs r8, r11, r8, lsl #16 ++ vmovcs d1, r8, r9 ++ vmull.u8 q2, d0, d2 ++ subs r5, #1 ++ vmlal.u8 q2, d1, d3 ++ bne 1b ++ ++ b store_tran_c_4x4_8 ++ ++ ++@ ff_hevc_rpi_pred_angular_c_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_c_4_neon_8, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ bl patch_h_down_c_4x4_8 ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ bl patch_h_up_c_4x4_8 ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ ldrd r8, r9, [r1] @ Top ++ rsb r12, r6, #32 ++ ldrh lr, [r2, #-2] @ Top-left ++ ldrh r7, [r7] ++ vmov d0, r8, r9 ++ lsl r9, r9, #16 ++ vdup.8 d2, r12 ++ orr r9, r9, r8, lsr #16 ++ orr r8, lr, r8, lsl #16 ++ vmov d1, r8, r9 ++ sub r1, r7, #128 ++ mov r5, #3 ++1: ++ vdup.8 d3, r6 ++ vmull.u8 q2, d0, d2 ++ subs r12, r12, r4 ++ vmlal.u8 q2, d1, d3 ++ itttt mi ++ addmi lr, r2, r1, asr #7 ++ bicmi lr, #1 ++ addmi r12, r12, #32 ++ vmovmi d0, r8, r9 ++ rsb r6, r12, #32 ++ itt mi ++ lslmi r9, r9, #16 ++ ldrhmi lr, [lr] ++ vdup.8 d2, r12 ++ vrshrn.u16 d4, q2, #5 ++ itttt mi ++ orrmi r9, r9, r8, lsr #16 ++ orrmi r8, lr, r8, lsl #16 ++ vmovmi d1, r8, r9 ++ addmi r1, r1, r7 ++ subs r5, r5, #1 ++ vst1.16 {d4}, [r0], r3 ++ bne 1b ++ ++ vdup.8 d3, r6 ++ vmull.u8 q2, d0, d2 ++ vmlal.u8 q2, d1, d3 ++ vrshrn.u16 d4, q2, #5 ++ vst1.16 {d4}, [r0] ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ ldrd r8, r9, [r1] @ Top ++ rsb r12, r6, #32 ++ vmov d0, r8, r9 ++ vdup.8 d3, r6 ++ mov r5, #3 ++ lsr r8, #16 ++ vdup.8 d2, r12 ++ orr r8, r8, r9, lsl #16 ++ ldr r9, [r1, #6]! ++ vmov d1, r8, r9 ++1: ++ vmull.u8 q2, d0, d2 ++ subs r12, r4 ++ vmlal.u8 q2, d1, d3 ++ it mi ++ addmi r12, #32 ++ rsb r6, r12, #32 ++ itt mi ++ vmovmi d0, r8, r9 ++ lsrmi r8, #16 ++ vdup.8 d2, r12 ++ itt mi ++ orrmi r8, r8, r9, lsl #16 ++ ldrmi r9, [r1, #2]! ++ vrshrn.u16 d6, q2, #5 ++ it mi ++ vmovmi d1, r8, r9 ++ vdup.8 d3, r6 ++ subs r5, #1 ++ vst1.16 {d6}, [r0], r3 ++ bne 1b ++ ++ vmull.u8 q2, d0, d2 ++ vmlal.u8 q2, d1, d3 ++ vrshrn.u16 d6, q2, #5 ++ vst1.16 {d6}, [r0] ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_c_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_c_8_neon_8, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ mov r1, r2 @ save r2 - r1 unused by patch_down ++ ++ bl patch_h_down_c_4x4_8 ++ bl patch_h_down_c_4x4_8_continue ++ ++ add r2, r1, #4*2 @ restore r2, but 4 rows further down left ++ sub r0, #16 ++ mov r6, r4 ++ add r0, r0, r3, lsl #2 ++ ++ bl patch_h_down_c_4x4_8 ++ bl patch_h_down_c_4x4_8_continue ++ ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ ++ push {r2} ++ bl patch_h_up_c_4x4_8 ++ bl patch_h_up_c_4x4_8_continue ++ pop {r2} ++ ++ sub r0, #16 ++ mov r10, #-128 ++ add r2, #8 ++ add r0, r0, r3, lsl #2 ++ sub r10, r10, r7, lsl #2 ++ ++ bl patch_h_up_c_4x4_8 ++ bl patch_h_up_c_4x4_8_continue ++ ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ vld1.8 {q9}, [r1] ++ sub r1, r2, #2 ++ rsb r12, r6, #32 ++ ldrh r7, [r7] ++ vdup.8 d6, r6 ++ vext.8 q8, q9, q9, #14 ++ sub r8, r7, #128 ++ vld1.16 {d16[0]}, [r1] ++ vdup.8 d7, r12 ++ mov r5, #7 ++1: ++ subs r12, r4 ++ vmull.u8 q0, d18, d7 ++ it cc ++ asrcc r1, r8, #8 ++ vmlal.u8 q0, d16, d6 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q1, d19, d7 ++ it cc ++ addcc r1, r2, r1, lsl #1 ++ vmlal.u8 q1, d17, d6 ++ rsb r6, r12, #32 ++ vext.8 q10, q8, q8, #14 ++ sub r5, #1 ++ vld1.16 {d20[0]}, [r1] ++ it cc ++ addcc r8, r7 ++ vmov q11, q8 ++ teq r5, #0 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vst1.8 {q0}, [r0], r3 ++ bhi 1b ++ beq 4f ++2: ++ subs r12, r4 ++ vmull.u8 q0, d22, d7 ++ it cc ++ asrcc r1, r8, #8 ++ vmlal.u8 q0, d20, d6 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q1, d23, d7 ++ it cc ++ addcc r1, r2, r1, lsl #1 ++ vmlal.u8 q1, d21, d6 ++ rsb r6, r12, #32 ++ vext.8 q8, q10, q10, #14 ++ sub r5, #1 ++ vld1.16 {d16[0]}, [r1] ++ it cc ++ addcc r8, r7 ++ vmov q9, q10 ++ teq r5, #0 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vst1.8 {q0}, [r0], r3 ++ bhi 2b ++ bne 1b ++ bcc 5f ++3: ++ vmull.u8 q0, d22, d7 ++ vmlal.u8 q0, d20, d6 ++ vmull.u8 q1, d23, d7 ++ vmlal.u8 q1, d21, d6 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vst1.8 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++4: ++ bcc 3b ++5: ++ vmull.u8 q0, d18, d7 ++ vmlal.u8 q0, d16, d6 ++ vmull.u8 q1, d19, d7 ++ vmlal.u8 q1, d17, d6 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vst1.8 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ vld1.8 {q9}, [r1]! ++ rsb r12, r6, #32 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vext.8 q8, q9, q9, #2 ++ vld1.16 {d17[3]}, [r1]! ++ mov r5, #7 ++1: ++ vmull.u8 q0, d16, d6 ++ subs r12, r4 ++ vmlal.u8 q0, d18, d7 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q1, d17, d6 ++ rsb r6, r12, #32 ++ vmlal.u8 q1, d19, d7 ++ sub r5, #1 ++ vext.8 q10, q8, q8, #2 ++ teq r5, #0 ++ vld1.16 {d21[3]}, [r1] ++ it cc ++ addcc r1, #2 ++ vmov q11, q8 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vst1.8 {q0}, [r0], r3 ++ bhi 1b ++ beq 4f ++2: ++ vmull.u8 q0, d20, d6 ++ subs r12, r4 ++ vmlal.u8 q0, d22, d7 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q1, d21, d6 ++ rsb r6, r12, #32 ++ vmlal.u8 q1, d23, d7 ++ sub r5, #1 ++ vext.8 q8, q10, q10, #2 ++ teq r5, #0 ++ vld1.16 {d17[3]}, [r1] ++ it cc ++ addcc r1, #2 ++ vmov q9, q10 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vdup.8 d6, r6 ++ vdup.8 d7, r12 ++ vst1.8 {q0}, [r0], r3 ++ bhi 2b ++ bne 1b ++ bcc 5f ++3: ++ vmull.u8 q0, d20, d6 ++ vmlal.u8 q0, d22, d7 ++ vmull.u8 q1, d21, d6 ++ vmlal.u8 q1, d23, d7 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vst1.8 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++4: ++ bcc 3b ++5: ++ vmull.u8 q0, d16, d6 ++ vmlal.u8 q0, d18, d7 ++ vmull.u8 q1, d17, d6 ++ vmlal.u8 q1, d19, d7 ++ vrshrn.u16 d0, q0, #5 ++ vrshrn.u16 d1, q1, #5 ++ vst1.8 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_c_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_c_16_neon_8, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ mov r10, #4 ++ mov r1, r2 ++1: ++ bl patch_h_down_c_4x4_8 ++ bl patch_h_down_c_4x4_8_continue ++ bl patch_h_down_c_4x4_8_continue ++ bl patch_h_down_c_4x4_8_continue ++ ++ add r2, r1, #4*2 @ restore r2, but 4 rows further down left ++ add r1, r1, #4*2 ++ mov r6, r4 ++ sub r0, #32 ++ subs r10, #1 ++ add r0, r0, r3, lsl #2 ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ vmov.i8 d6, #1<<2 ++1: ++ push {r2, r10} ++ bl patch_h_up_c_4x4_8 ++ bl patch_h_up_c_4x4_8_continue ++ bl patch_h_up_c_4x4_8_continue ++ bl patch_h_up_c_4x4_8_continue ++ pop {r2, r10} ++ ++ vmov r8, s12 ++ sub r0, #32 ++ add r2, #8 ++ add r0, r0, r3, lsl #2 ++ sub r10, r10, r7, lsl #2 ++ vshr.u8 d6, #1 ++ teq r8, #0 ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ vld1.8 {q0-q1}, [r1] ++ sub r9, r2, #2 ++ rsb r12, r6, #32 ++ ldrh r7, [r7] ++ mov r8, #-128 ++ vdup.8 d18, r6 ++ vdup.8 d19, r12 ++ mov r5, #16 ++1: ++ vld1.16 {d17[3]}, [r9] ++ add r8, r7 ++ vmov q2, q0 ++ vmov q3, q1 ++ asr r9, r8, #8 ++ vext.8 q1, q0, q1, #14 ++ add r9, r2, r9, lsl #1 ++ vext.8 q0, q8, q0, #14 ++2: ++ vmull.u8 q10, d4, d19 ++ subs r12, r4 ++ vmlal.u8 q10, d0, d18 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q11, d5, d19 ++ rsb r6, r12, #32 ++ vmlal.u8 q11, d1, d18 ++ sub r5, #1 ++ vmull.u8 q12, d6, d19 ++ teq r5, #0 ++ vmlal.u8 q12, d2, d18 ++ vmull.u8 q13, d7, d19 ++ vmlal.u8 q13, d3, d18 ++ vdup.8 d18, r6 ++ vdup.8 d19, r12 ++ vrshrn.u16 d20, q10, #5 ++ vrshrn.u16 d21, q11, #5 ++ vrshrn.u16 d22, q12, #5 ++ vrshrn.u16 d23, q13, #5 ++ vst1.8 {q10-q11}, [r0], r3 ++ bhi 2b ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ add r5, r1, #32 ++ vld1.8 {q0-q1}, [r1]! ++ rsb r12, r6, #32 ++ vld1.16 {d16[0]}, [r5] ++ mov r5, #16 ++ vdup.8 d18, r6 ++ vdup.8 d19, r12 ++1: ++ vmov q2, q0 ++ add r1, #2 ++ vmov q3, q1 ++ vext.8 q0, q0, q1, #2 ++ vext.8 q1, q1, q8, #2 ++2: ++ vmull.u8 q10, d0, d18 ++ subs r12, r4 ++ vmlal.u8 q10, d4, d19 ++ it cc ++ addcc r12, #32 ++ vmull.u8 q11, d1, d18 ++ rsb r6, r12, #32 ++ vmlal.u8 q11, d5, d19 ++ sub r5, #1 ++ vmull.u8 q12, d2, d18 ++ teq r5, #0 ++ vmlal.u8 q12, d6, d19 ++ vmull.u8 q13, d3, d18 ++ vmlal.u8 q13, d7, d19 ++ vld1.16 {d16[0]}, [r1] ++ vdup.8 d18, r6 ++ vdup.8 d19, r12 ++ vrshrn.u16 d20, q10, #5 ++ vrshrn.u16 d21, q11, #5 ++ vrshrn.u16 d22, q12, #5 ++ vrshrn.u16 d23, q13, #5 ++ vst1.8 {q10-q11}, [r0], r3 ++ bhi 2b ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++@------------------------------------------------------------------------------ ++@ Data ++ ++ .text ++ .balign 64 ++angle_2: ++ .byte 32 ++ .byte 26, 21, 17, 13, 9, 5, 2, 0 ++ @ Sign inverted from standards table ++ .byte 2, 5, 9, 13, 17, 21, 26, 32 ++ .byte 26, 21, 17, 13, 9, 5, 2, 0 ++ @ Standard sign ++ .byte 2, 5, 9, 13, 17, 21, 26, 32 ++ ++ .balign 2 ++ ++ @ Sign inverted from standards table ++inv_angle: ++ .short 4096, 1638, 910, 630, 482, 390, 315 ++ .short 256 ++ .short 315, 390, 482, 630, 910, 1638, 4096 ++ ++@------------------------------------------------------------------------------ ++@ ++@ 10 bit fns ++@ Should work for 9 & 11 bit as there is no actual bit-depth specific code ++@ but runs out of register width for 12+ bit ++ ++ .text ++ .balign 64 ++ ++patch_h_down_4x4_10: ++ ldrd r8, r9, [r2] @ Left ++ rsb r12, r6, #32 ++ vmov d0, r8, r9 ++ vdup.16 d3, r6 ++ lsr r8, #16 ++ vdup.16 d2, r12 ++ orr r8, r8, r9, lsl #16 ++ ldr r9, [r2, #6]! ++ vmov d1, r8, r9 ++ // drop through... ++patch_h_down_4x4_10_continue: ++ mov r5, #4 ++1: ++ subs r12, r4 ++ vmul.u16 d4, d0, d2 ++ it mi ++ addmi r12, #32 ++ vmla.u16 d4, d1, d3 ++ rsb r6, r12, #32 ++ vext.16 q8, q8, q9, #4 ++ it mi ++ lsrmi r7, r8, #16 ++ vmov d18, d19 ++ it mi ++ vmovmi d0, r8, r9 ++ vdup.16 d2, r12 ++ it mi ++ orrmi r8, r7, r9, lsl #16 ++ vrshr.u16 d19, d4, #5 ++ itt mi ++ ldrmi r9, [r2, #2]! ++ vmovmi d1, r8, r9 ++ subs r5, #1 ++ vdup.16 d3, r6 ++ bne 1b ++ // drop through... ++store_tran_4x4_10: ++ vzip.16 d16, d17 ++ add r6, r0, r3 ++ vzip.16 d18, d19 ++ lsl r3, #1 ++ vzip.32 q8, q9 ++ add r5, r0, r3 ++ vst1.16 {d16}, [r0]! ++ vst1.16 {d17}, [r6], r3 ++ vst1.16 {d18}, [r5] ++ asr r3, #1 ++ vst1.16 {d19}, [r6] ++ ++ bx lr ++ ++patch_h_up_4x4_10: ++ ldrd r8, r9, [r2] ++ rsb r6, r4, #32 ++ vmov d0, r8, r9 ++ vdup.16 d3, r4 ++ lsr r11, r8, #16 ++ vdup.16 d2, r6 ++ ldr r8, [r2, #-2]! ++ orr r9, r11, r9, lsl #16 ++ vmov d1, r8, r9 ++ mov r12, r4 ++ vmul.u16 d4, d0, d2 ++ vmla.u16 d4, d1, d3 ++patch_h_up_4x4_10_continue: ++ mov r5, #4 ++1: ++ add r12, r4 ++ cmp r12, #33 ++ it cs ++ addcs r10, r7 ++ mov r11, #0 ++ itt cs ++ subcs r12, #32 ++ tstcs r10, #1<<31 ++ rsb r6, r12, #32 ++ it eq ++ asreq r11, r10, #7 ++ it cs ++ vmovcs d0, r8, r9 ++ it eq ++ biceq r11, #1 ++ vdup.16 d2, r6 ++ it cs ++ lsrcs r6, r8, #16 ++ vdup.16 d3, r12 ++ vext.16 q8, q8, q9, #4 ++ itt cs ++ orrcs r9, r6, r9, lsl #16 ++ ldrhcs r11, [r1, r11] ++ vmov d18, d19 ++ it hi ++ ldrhhi r11, [r2, #-2]! ++ vrshr.u16 d19, d4, #5 ++ itt cs ++ orrcs r8, r11, r8, lsl #16 ++ vmovcs d1, r8, r9 ++ vmul.u16 d4, d0, d2 ++ subs r5, #1 ++ vmla.u16 d4, d1, d3 ++ bne 1b ++ ++ b store_tran_4x4_10 ++ ++ ++@ ff_hevc_rpi_pred_angular_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_4_neon_10, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ bl patch_h_down_4x4_10 ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ bl patch_h_up_4x4_10 ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ ldrd r8, r9, [r1] @ Top ++ rsb r12, r6, #32 ++ ldrh lr, [r2, #-2] @ Top-left ++ ldrh r7, [r7] ++ vmov d0, r8, r9 ++ lsl r9, r9, #16 ++ vdup.16 d2, r12 ++ orr r9, r9, r8, lsr #16 ++ orr r8, lr, r8, lsl #16 ++ vmov d1, r8, r9 ++ sub r1, r7, #128 ++ mov r5, #3 ++1: ++ sel lr, lr, lr @ force pipeline 0 on Cortex-A53 ++ vdup.16 d3, r6 ++ vmul.u16 d4, d0, d2 ++ subs r12, r12, r4 ++ vmla.u16 d4, d1, d3 ++ itttt mi ++ addmi lr, r2, r1, asr #7 ++ bicmi lr, #1 ++ addmi r12, r12, #32 ++ vmovmi d0, r8, r9 ++ rsb r6, r12, #32 ++ itt mi ++ lslmi r9, r9, #16 ++ ldrhmi lr, [lr] ++ vdup.16 d2, r12 ++ vrshr.u16 d4, d4, #5 ++ itttt mi ++ orrmi r9, r9, r8, lsr #16 ++ orrmi r8, lr, r8, lsl #16 ++ vmovmi d1, r8, r9 ++ addmi r1, r1, r7 ++ subs r5, r5, #1 ++ vst1.16 {d4}, [r0], r3 ++ bne 1b ++ ++ vdup.16 d3, r6 ++ nop @ force next insn into pipeline 0 to enable ++ vmul.u16 d4, d0, d2 @ vmla to execute back-to-back on Cortex-A53 ++ vmla.u16 d4, d1, d3 ++ vrshr.u16 d4, d4, #5 ++ vst1.16 {d4}, [r0] ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ ldrd r8, r9, [r1] @ Top ++ rsb r12, r6, #32 ++ vmov d0, r8, r9 ++ vdup.16 d3, r6 ++ lsr r8, #16 ++ vdup.16 d2, r12 ++ orr r8, r8, r9, lsl #16 ++ ldr r9, [r1, #6]! ++ vmov d1, r8, r9 ++ mov r5, #3 ++1: ++ vmul.u16 d4, d0, d2 ++ subs r12, r4 ++ vmla.u16 d4, d1, d3 ++ it mi ++ addmi r12, #32 ++ rsb r6, r12, #32 ++ itt mi ++ vmovmi d0, r8, r9 ++ lsrmi r8, #16 ++ vdup.16 d2, r12 ++ itt mi ++ orrmi r8, r8, r9, lsl #16 ++ ldrmi r9, [r1, #2]! ++ vrshr.u16 d4, d4, #5 ++ it mi ++ vmovmi d1, r8, r9 ++ vdup.16 d3, r6 ++ subs r5, #1 ++ vst1.16 {d4}, [r0], r3 ++ bne 1b ++ ++ vmul.u16 d4, d0, d2 ++ vmla.u16 d4, d1, d3 ++ vrshr.u16 d4, d4, #5 ++ vst1.16 {d4}, [r0] ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_8_neon_10, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ mov r1, r2 @ save r2 - r1 unused by patch_down ++ ++ bl patch_h_down_4x4_10 ++ bl patch_h_down_4x4_10_continue ++ ++ add r2, r1, #4*2 @ restore r2, but 4 rows further down left ++ sub r0, #16 ++ mov r6, r4 ++ add r0, r0, r3, lsl #2 ++ ++ bl patch_h_down_4x4_10 ++ bl patch_h_down_4x4_10_continue ++ ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ ++ push {r2} ++ bl patch_h_up_4x4_10 ++ bl patch_h_up_4x4_10_continue ++ pop {r2} ++ ++ sub r0, #16 ++ mov r10, #-128 ++ add r2, #8 ++ add r0, r0, r3, lsl #2 ++ sub r10, r10, r7, lsl #2 ++ ++ bl patch_h_up_4x4_10 ++ bl patch_h_up_4x4_10_continue ++ ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ vld1.16 {q9}, [r1] ++ sub r1, r2, #2 ++ rsb r12, r6, #32 ++ ldrh r7, [r7] ++ vdup.16 q2, r6 ++ vext.16 q8, q9, q9, #7 ++ sub r8, r7, #128 ++ vld1.16 {d16[0]}, [r1] ++ vdup.16 q3, r12 ++ mov r5, #7 ++1: ++ vmul.u16 q0, q9, q3 ++ subs r12, r4 ++ vmla.u16 q0, q8, q2 ++ ittt cc ++ asrcc r1, r8, #8 ++ addcc r12, #32 ++ addcc r1, r2, r1, lsl #1 ++ vext.16 q10, q8, q8, #7 ++ rsb r6, r12, #32 ++ vmov q11, q8 ++ sub r5, #1 ++ vrshr.u16 q0, q0, #5 ++ it cc ++ addcc r8, r7 ++ vld1.16 {d20[0]}, [r1] ++ teq r5, #0 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vst1.16 {q0}, [r0], r3 ++ bhi 1b ++ beq 4f ++2: ++ vmul.u16 q0, q11, q3 ++ subs r12, r4 ++ vmla.u16 q0, q10, q2 ++ ittt cc ++ asrcc r1, r8, #8 ++ addcc r12, #32 ++ addcc r1, r2, r1, lsl #1 ++ vext.16 q8, q10, q10, #7 ++ rsb r6, r12, #32 ++ vmov q9, q10 ++ sub r5, #1 ++ vrshr.u16 q0, q0, #5 ++ it cc ++ addcc r8, r7 ++ vld1.16 {d16[0]}, [r1] ++ teq r5, #0 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vst1.16 {q0}, [r0], r3 ++ bhi 2b ++ bne 1b ++ bcc 5f ++3: ++ vmul.u16 q0, q11, q3 ++ vmla.u16 q0, q10, q2 ++ vrshr.u16 q0, q0, #5 ++ vst1.16 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++4: ++ bcc 3b ++5: ++ vmul.u16 q0, q9, q3 ++ vmla.u16 q0, q8, q2 ++ vrshr.u16 q0, q0, #5 ++ vst1.16 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ vld1.16 {q9}, [r1]! ++ rsb r12, r6, #32 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vext.16 q8, q9, q9, #1 ++ vld1.16 {d17[3]}, [r1]! ++ mov r5, #7 ++1: ++ vmul.u16 q0, q8, q2 ++ subs r12, r4 ++ vmla.u16 q0, q9, q3 ++ it cc ++ addcc r12, #32 ++ vext.16 q10, q8, q8, #1 ++ rsb r6, r12, #32 ++ vld1.16 {d21[3]}, [r1] ++ sub r5, #1 ++ vmov q11, q8 ++ teq r5, #0 ++ vrshr.u16 q0, q0, #5 ++ it cc ++ addcc r1, #2 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vst1.16 {q0}, [r0], r3 ++ bhi 1b ++ beq 4f ++2: ++ vmul.u16 q0, q10, q2 ++ subs r12, r4 ++ vmla.u16 q0, q11, q3 ++ it cc ++ addcc r12, #32 ++ vext.16 q8, q10, q10, #1 ++ rsb r6, r12, #32 ++ vld1.16 {d17[3]}, [r1] ++ sub r5, #1 ++ vmov q9, q10 ++ teq r5, #0 ++ vrshr.u16 q0, q0, #5 ++ it cc ++ addcc r1, #2 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vst1.16 {q0}, [r0], r3 ++ bhi 2b ++ bne 1b ++ bcc 5f ++3: ++ vmul.u16 q0, q10, q2 ++ vmla.u16 q0, q11, q3 ++ vrshr.u16 q0, q0, #5 ++ vst1.16 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++4: ++ bcc 3b ++5: ++ vmul.u16 q0, q8, q2 ++ vmla.u16 q0, q9, q3 ++ vrshr.u16 q0, q0, #5 ++ vst1.16 {q0}, [r0] ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_16_neon_10, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #1 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ mov r10, #4 ++ mov r1, r2 ++1: ++ bl patch_h_down_4x4_10 ++ bl patch_h_down_4x4_10_continue ++ bl patch_h_down_4x4_10_continue ++ bl patch_h_down_4x4_10_continue ++ ++ add r2, r1, #4*2 @ restore r2, but 4 rows further down left ++ add r1, r1, #4*2 ++ mov r6, r4 ++ sub r0, #32 ++ subs r10, #1 ++ add r0, r0, r3, lsl #2 ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r10, #-128 ++ vmov.i8 d6, #1<<2 ++1: ++ push {r2, r10} ++ bl patch_h_up_4x4_10 ++ bl patch_h_up_4x4_10_continue ++ bl patch_h_up_4x4_10_continue ++ bl patch_h_up_4x4_10_continue ++ pop {r2, r10} ++ ++ vmov r8, s12 ++ sub r0, #32 ++ add r2, #8 ++ add r0, r0, r3, lsl #2 ++ sub r10, r10, r7, lsl #2 ++ vshr.u8 d6, #1 ++ teq r8, #0 ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ vld1.16 {q0-q1}, [r1] ++ sub r9, r2, #2 ++ rsb r12, r6, #32 ++ ldrh r7, [r7] ++ mov r8, #-128 ++ vdup.16 q9, r6 ++ vdup.16 q10, r12 ++ mov r5, #16 ++1: ++ vld1.16 {d17[3]}, [r9] ++ add r8, r7 ++ vmov q2, q0 ++ vmov q3, q1 ++ asr r9, r8, #8 ++ vext.16 q1, q0, q1, #7 ++ add r9, r2, r9, lsl #1 ++ vext.16 q0, q8, q0, #7 ++2: ++ vmul.u16 q11, q2, q10 ++ subs r12, r4 ++ vmla.u16 q11, q0, q9 ++ it cc ++ addcc r12, #32 ++ vmul.u16 q12, q3, q10 ++ rsb r6, r12, #32 ++ vmla.u16 q12, q1, q9 ++ sub r5, #1 ++ teq r5, #0 ++ vdup.16 q9, r6 ++ vdup.16 q10, r12 ++ vrshr.u16 q11, q11, #5 ++ vrshr.u16 q12, q12, #5 ++ vst1.16 {q11-q12}, [r0], r3 ++ bhi 2b ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ add r5, r1, #32 ++ vld1.16 {q0-q1}, [r1]! ++ rsb r12, r6, #32 ++ vld1.16 {d16[0]}, [r5] ++ mov r5, #16 ++ vdup.16 q9, r6 ++ vdup.16 q10, r12 ++1: ++ vmov q2, q0 ++ add r1, #2 ++ vmov q3, q1 ++ vext.16 q0, q0, q1, #1 ++ vext.16 q1, q1, q8, #1 ++2: ++ vmul.u16 q11, q0, q9 ++ subs r12, r4 ++ vmla.u16 q11, q2, q10 ++ it cc ++ addcc r12, #32 ++ vmul.u16 q12, q1, q9 ++ rsb r6, r12, #32 ++ vmla.u16 q12, q3, q10 ++ sub r5, #1 ++ vld1.16 {d16[0]}, [r1] ++ teq r5, #0 ++ vdup.16 q9, r6 ++ vdup.16 q10, r12 ++ vrshr.u16 q11, q11, #5 ++ vrshr.u16 q12, q12, #5 ++ vst1.16 {q11-q12}, [r0], r3 ++ bhi 2b ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_32_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_32_neon_10, export=1 ++ ldr r12, [sp] ++ push {r4-r11, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #1 ++ vpush {d8} ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ add sp, #8 ++ mov r10, #8 ++ mov r1, r2 ++1: ++ bl patch_h_down_4x4_10 ++ bl patch_h_down_4x4_10_continue ++ bl patch_h_down_4x4_10_continue ++ bl patch_h_down_4x4_10_continue ++ bl patch_h_down_4x4_10_continue ++ bl patch_h_down_4x4_10_continue ++ bl patch_h_down_4x4_10_continue ++ bl patch_h_down_4x4_10_continue ++ ++ add r2, r1, #4*2 @ restore r2, but 4 rows further down left ++ add r1, r1, #4*2 ++ mov r6, r4 ++ sub r0, #64 ++ subs r10, #1 ++ add r0, r0, r3, lsl #2 ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ add sp, #8 ++ ldrh r7, [r7] ++ mov r10, #-128 ++ vmov.i8 d6, #1<<6 ++1: ++ push {r2, r10} ++ bl patch_h_up_4x4_10 ++ bl patch_h_up_4x4_10_continue ++ bl patch_h_up_4x4_10_continue ++ bl patch_h_up_4x4_10_continue ++ bl patch_h_up_4x4_10_continue ++ bl patch_h_up_4x4_10_continue ++ bl patch_h_up_4x4_10_continue ++ bl patch_h_up_4x4_10_continue ++ pop {r2, r10} ++ ++ vmov r8, s12 ++ sub r0, #64 ++ add r2, #8 ++ add r0, r0, r3, lsl #2 ++ sub r10, r10, r7, lsl #2 ++ vshr.u8 d6, #1 ++ teq r8, #0 ++ bne 1b ++ ++ pop {r4-r11, pc} ++ ++@ Left of vertical - works down left ++18: ++ add r5, r1, #32 ++ vld1.16 {q1-q2}, [r1] ++ rsb r12, r6, r6, lsl #16 ++ vld1.16 {q3-q4}, [r5] ++ sub r9, r2, #2 ++ rsb r4, r12, #0 ++ rsb r12, r12, #32 << 16 ++ ldrh r7, [r7] ++ mov r8, #-128 ++ vmov d0, d9 ++ vmov s2, r12 ++ add r10, r0, #32 ++ mov r5, #32 ++1: ++ vld1.16 {d1[3]}, [r9] ++ add r8, r7 ++ vmov q11, q4 ++ vmov q10, q3 ++ asr r9, r8, #8 ++ vmov q9, q2 ++ add r9, r2, r9, lsl #1 ++ vmov q8, q1 ++ vext.16 q4, q3, q4, #7 ++ vext.16 q3, q2, q3, #7 ++ vext.16 q2, q1, q2, #7 ++ vext.16 q1, q0, q1, #7 ++2: ++ vmul.u16 q12, q8, d1[1] ++ adds r12, r4 ++ vmla.u16 q12, q1, d1[0] ++ it cc ++ addcc r12, #32 << 16 ++ vmul.u16 q13, q9, d1[1] ++ it cc ++ subcc r12, #32 ++ vmla.u16 q13, q2, d1[0] ++ sub r5, #1 ++ vmul.u16 q14, q10, d1[1] ++ teq r5, #0 ++ vmla.u16 q14, q3, d1[0] ++ vmul.u16 q15, q11, d1[1] ++ vmla.u16 q15, q4, d1[0] ++ vmov s2, r12 ++ vrshr.u16 q12, q12, #5 ++ vrshr.u16 q13, q13, #5 ++ vrshr.u16 q14, q14, #5 ++ vrshr.u16 q15, q15, #5 ++ vst1.16 {q12-q13}, [r0], r3 ++ vst1.16 {q14-q15}, [r10], r3 ++ bhi 2b ++ bne 1b ++ ++ vpop {d8} ++ vmov d9, d0 ++ pop {r4-r11, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ add r5, r1, #32 ++ vld1.16 {q1-q2}, [r1] ++ rsb r12, r6, r6, lsl #16 ++ vld1.16 {q3-q4}, [r5] ++ add r1, r1, #64 ++ rsb r4, r12, #0 ++ rsb r12, r12, #32 << 16 ++ vmov d1, d9 ++ vmov s1, r12 ++ add r10, r0, #32 ++ mov r5, #32 ++1: ++ vld1.16 {d0[0]}, [r1]! ++ vmov q8, q1 ++ vmov q9, q2 ++ vmov q10, q3 ++ vmov q11, q4 ++ vext.16 q1, q1, q2, #1 ++ vext.16 q2, q2, q3, #1 ++ vext.16 q3, q3, q4, #1 ++ vext.16 q4, q4, q0, #1 ++2: ++ vmul.u16 q12, q1, d0[2] ++ adds r12, r4 ++ vmla.u16 q12, q8, d0[3] ++ it cc ++ addcc r12, #32 << 16 ++ vmul.u16 q13, q2, d0[2] ++ it cc ++ subcc r12, #32 ++ vmla.u16 q13, q9, d0[3] ++ sub r5, #1 ++ vmul.u16 q14, q3, d0[2] ++ teq r5, #0 ++ vmla.u16 q14, q10, d0[3] ++ vmul.u16 q15, q4, d0[2] ++ vmla.u16 q15, q11, d0[3] ++ vmov s1, r12 ++ vrshr.u16 q12, q12, #5 ++ vrshr.u16 q13, q13, #5 ++ vrshr.u16 q14, q14, #5 ++ vrshr.u16 q15, q15, #5 ++ vst1.16 {q12-q13}, [r0], r3 ++ vst1.16 {q14-q15}, [r10], r3 ++ bhi 2b ++ bne 1b ++ ++ vpop {d8} ++ vmov d9, d1 ++ pop {r4-r11, pc} ++ ++endfunc ++ ++ ++ ++@ Generate 4x4 chroma patch ++@ ++@ In (const) ++@ r1 Up ptr (_up only) ++@ r3 Out stride ++@ r4 Angle add ++@ r7 Inv angle (_up only) ++@ ++@ In/Out (updated) ++@ r0 Out pointer - on exit point to start of next patch horizontally (i.e. r0 + patch width) ++@ r2 Left ptr - updated ++@ r6 Angle frac (init to r4 + 32) ++@ r8 Inv angle accumulator ++@ q2 Cur Line - load before 1st call for down - set by _up ++@ q8 Cur Line - load before 1st call for up - set by _down ++@ ++@ Temps ++@ r5 Loop counter ++@ r12 ++@ d0, q1, q12-q15 ++ ++patch_h_down_c_4x4_10: ++ vld1.16 {q12}, [r2]! ++ rsb r12, r6, #32 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ mov r5, #4 ++1: ++ vmov q13, q12 ++ vext.16 q12, q12, q12, #2 ++ vld1.32 {d25[1]}, [r2]! ++patch_h_down_c_4x4_10_continue: ++2: ++ vmov q8, q9 ++ subs r12, r4 ++ vmul.u16 q0, q13, q3 ++ it cc ++ addcc r12, #32 ++ vmla.u16 q0, q12, q2 ++ rsb r6, r12, #32 ++ vmov q9, q10 ++ sub r5, #1 ++ vmov q10, q11 ++ teq r5, #0 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vrshr.u16 q11, q0, #5 ++ bhi 2b ++ bne 1b ++ ++ bcs 3f ++ vmov q13, q12 ++ vext.16 q12, q12, q12, #2 ++ vld1.32 {d25[1]}, [r2]! ++3: ++ ++store_tran_c_4x4_10: ++T add r6, r0, r3 ++ vzip.32 q8, q10 ++A add r6, r0, r3 ++T lsl r3, #1 ++ vzip.32 q9, q11 ++A add r5, r0, r3, lsl #1 ++T add r5, r0, r3 ++ vst2.32 {d16,d18}, [r0]! ++A lsl r3, #1 ++ vst2.32 {d17,d19}, [r6], r3 ++ asr r3, #1 ++ vst2.32 {d20,d22}, [r5] ++ mov r5, #4 ++ vst2.32 {d21,d23}, [r6] ++ bx lr ++ ++patch_h_up_c_4x4_10: ++ vld1.16 {q1}, [r2] ++ rsb r12, r6, #32 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ mov r5, #4 ++1: ++ adds r8, r7 ++ vmov q12, q1 ++ it mi ++ ldrmi r6, [r2, #-4]! ++ vext.16 q1, q1, q1, #6 ++ itt pl ++ asrpl r6, r8, #8 ++ ldrpl r6, [r1, r6, lsl #2] ++ vmov s4, r6 ++patch_h_up_c_4x4_10_continue: ++2: ++ vmov q8, q9 ++ subs r12, r4 ++ vmul.u16 q0, q12, q3 ++ it cc ++ addcc r12, #32 ++ vmla.u16 q0, q1, q2 ++ rsb r6, r12, #32 ++ vmov q9, q10 ++ sub r5, #1 ++ vmov q10, q11 ++ teq r5, #0 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vrshr.u16 q11, q0, #5 ++ bhi 2b ++ bne 1b ++ ++ bcs store_tran_c_4x4_10 ++ adds r8, r7 ++ vmov q12, q1 ++ it mi ++ ldrmi r6, [r2, #-4]! ++ vext.16 q1, q1, q1, #6 ++ itt pl ++ asrpl r6, r8, #8 ++ ldrpl r6, [r1, r6, lsl #2] ++ vmov s4, r6 ++ b store_tran_c_4x4_10 ++ ++ ++@ ff_hevc_rpi_pred_angular_c_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_c_4_neon_10, export=1 ++ ldr r12, [sp] ++ push {r4-r8, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #2 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ bl patch_h_down_c_4x4_10 ++ pop {r4-r8, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r8, #-128 ++ sub r8, r7 ++ bl patch_h_up_c_4x4_10 ++ pop {r4-r8, pc} ++ ++@ Left of vertical - works down left ++18: ++ vld1.16 {q9}, [r1] ++ sub r1, r2, #4 ++ rsb r12, r6, #32 ++ ldrh r7, [r7] ++ vdup.16 q2, r6 ++ vext.16 q8, q9, q9, #6 ++ sub r8, r7, #128 ++ vld1.32 {d16[0]}, [r1] ++ vdup.16 q3, r12 ++ mov r5, #3 ++1: ++ vmul.u16 q0, q9, q3 ++ subs r12, r4 ++ vmla.u16 q0, q8, q2 ++ ittt cc ++ asrcc r1, r8, #8 ++ addcc r12, #32 ++ addcc r1, r2, r1, lsl #2 ++ vext.16 q10, q8, q8, #6 ++ rsb r6, r12, #32 ++ vmov q11, q8 ++ sub r5, #1 ++ vrshr.u16 q0, q0, #5 ++ it cc ++ addcc r8, r7 ++ vld1.32 {d20[0]}, [r1] ++ teq r5, #0 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vst1.16 {q0}, [r0], r3 ++ bhi 1b ++ beq 4f ++2: ++ vmul.u16 q0, q11, q3 ++ subs r12, r4 ++ vmla.u16 q0, q10, q2 ++ ittt cc ++ asrcc r1, r8, #8 ++ addcc r12, #32 ++ addcc r1, r2, r1, lsl #2 ++ vext.16 q8, q10, q10, #6 ++ rsb r6, r12, #32 ++ vmov q9, q10 ++ sub r5, #1 ++ vrshr.u16 q0, q0, #5 ++ it cc ++ addcc r8, r7 ++ vld1.32 {d16[0]}, [r1] ++ teq r5, #0 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vst1.16 {q0}, [r0], r3 ++ bhi 2b ++ bne 1b ++ bcc 5f ++3: ++ vmul.u16 q0, q11, q3 ++ vmla.u16 q0, q10, q2 ++ vrshr.u16 q0, q0, #5 ++ vst1.16 {q0}, [r0] ++ ++ pop {r4-r8, pc} ++4: ++ bcc 3b ++5: ++ vmul.u16 q0, q9, q3 ++ vmla.u16 q0, q8, q2 ++ vrshr.u16 q0, q0, #5 ++ vst1.16 {q0}, [r0] ++ ++ pop {r4-r8, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ vld1.16 {q9}, [r1]! ++ rsb r12, r6, #32 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vext.16 q8, q9, q9, #2 ++ vld1.32 {d17[1]}, [r1]! ++ mov r5, #3 ++1: ++ vmul.u16 q0, q8, q2 ++ subs r12, r4 ++ vmla.u16 q0, q9, q3 ++ it cc ++ addcc r12, #32 ++ vext.16 q10, q8, q8, #2 ++ rsb r6, r12, #32 ++ vld1.32 {d21[1]}, [r1] ++ sub r5, #1 ++ vmov q11, q8 ++ teq r5, #0 ++ vrshr.u16 q0, q0, #5 ++ it cc ++ addcc r1, #4 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vst1.16 {q0}, [r0], r3 ++ bhi 1b ++ beq 4f ++2: ++ vmul.u16 q0, q10, q2 ++ subs r12, r4 ++ vmla.u16 q0, q11, q3 ++ it cc ++ addcc r12, #32 ++ vext.16 q8, q10, q10, #2 ++ rsb r6, r12, #32 ++ vld1.32 {d17[1]}, [r1] ++ sub r5, #1 ++ vmov q9, q10 ++ teq r5, #0 ++ vrshr.u16 q0, q0, #5 ++ it cc ++ addcc r1, #4 ++ vdup.16 q2, r6 ++ vdup.16 q3, r12 ++ vst1.16 {q0}, [r0], r3 ++ bhi 2b ++ bne 1b ++ bcc 5f ++3: ++ vmul.u16 q0, q10, q2 ++ vmla.u16 q0, q11, q3 ++ vrshr.u16 q0, q0, #5 ++ vst1.16 {q0}, [r0] ++ ++ pop {r4-r8, pc} ++4: ++ bcc 3b ++5: ++ vmul.u16 q0, q8, q2 ++ vmla.u16 q0, q9, q3 ++ vrshr.u16 q0, q0, #5 ++ vst1.16 {q0}, [r0] ++ ++ pop {r4-r8, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_c_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_c_8_neon_10, export=1 ++ ldr r12, [sp] ++ push {r4-r8, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #2 ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ mov r1, r2 @ save r2 - r1 unused by patch_down ++ ++ bl patch_h_down_c_4x4_10 ++ bl patch_h_down_c_4x4_10_continue ++ ++ add r2, r1, #4*4 @ restore r2, but 4 rows further down left ++ sub r0, #32 ++ mov r6, r4 ++ add r0, r0, r3, lsl #2 ++ ++ bl patch_h_down_c_4x4_10 ++ bl patch_h_down_c_4x4_10_continue ++ ++ pop {r4-r8, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ ldrh r7, [r7] ++ mov r8, #-128 ++ sub r8, r7 ++ ++ push {r2, r8} ++ bl patch_h_up_c_4x4_10 ++ bl patch_h_up_c_4x4_10_continue ++ pop {r2, r8} ++ ++ sub r0, #32 ++ mov r6, r4 ++ add r2, #16 ++ sub r8, r8, r7, lsl #2 ++ add r0, r0, r3, lsl #2 ++ ++ bl patch_h_up_c_4x4_10 ++ bl patch_h_up_c_4x4_10_continue ++ ++ pop {r4-r8, pc} ++ ++@ Left of vertical - works down left ++18: ++ vld1.16 {q0-q1}, [r1] ++ sub r9, r2, #4 ++ rsb r12, r6, #32 ++ ldrh r7, [r7] ++ mov r8, #-128 ++ vdup.16 q9, r6 ++ vdup.16 q10, r12 ++ mov r5, #8 ++1: ++ vld1.32 {d17[1]}, [r9] ++ add r8, r7 ++ vmov q2, q0 ++ vmov q3, q1 ++ asr r9, r8, #8 ++ vext.16 q1, q0, q1, #6 ++ add r9, r2, r9, lsl #2 ++ vext.16 q0, q8, q0, #6 ++2: ++ vmul.u16 q11, q2, q10 ++ subs r12, r4 ++ vmla.u16 q11, q0, q9 ++ it cc ++ addcc r12, #32 ++ vmul.u16 q12, q3, q10 ++ rsb r6, r12, #32 ++ vmla.u16 q12, q1, q9 ++ sub r5, #1 ++ teq r5, #0 ++ vdup.16 q9, r6 ++ vdup.16 q10, r12 ++ vrshr.u16 q11, q11, #5 ++ vrshr.u16 q12, q12, #5 ++ vst1.16 {q11-q12}, [r0], r3 ++ bhi 2b ++ bne 1b ++ ++ pop {r4-r8, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ add r5, r1, #32 ++ vld1.16 {q0-q1}, [r1]! ++ rsb r12, r6, #32 ++ vld1.32 {d16[0]}, [r5] ++ mov r5, #8 ++ vdup.16 q9, r6 ++ vdup.16 q10, r12 ++1: ++ vmov q2, q0 ++ add r1, #4 ++ vmov q3, q1 ++ vext.16 q0, q0, q1, #2 ++ vext.16 q1, q1, q8, #2 ++2: ++ vmul.u16 q11, q0, q9 ++ subs r12, r4 ++ vmla.u16 q11, q2, q10 ++ it cc ++ addcc r12, #32 ++ vmul.u16 q12, q1, q9 ++ rsb r6, r12, #32 ++ vmla.u16 q12, q3, q10 ++ sub r5, #1 ++ vld1.32 {d16[0]}, [r1] ++ teq r5, #0 ++ vdup.16 q9, r6 ++ vdup.16 q10, r12 ++ vrshr.u16 q11, q11, #5 ++ vrshr.u16 q12, q12, #5 ++ vst1.16 {q11-q12}, [r0], r3 ++ bhi 2b ++ bne 1b ++ ++ pop {r4-r8, pc} ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_angular_c_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride [r3] ++@ unsigned int mode [sp, #0] 2..34 ++ ++function ff_hevc_rpi_pred_angular_c_16_neon_10, export=1 ++ ldr r12, [sp] ++ push {r4-r10, lr} ++ ADRT r4, angle_2 - 2 ++ ADRT r7, inv_angle - 11*2 ++ add r7, r7, r12, lsl #1 ++ lsl r3, #2 ++ vpush {d8} ++ ldrsb r6, [r4, r12] ++ cmp r12, #26 ++ ldrsb r4, [r4, r12] ++ bge 26f ++ cmp r12, #18 ++ bge 18f ++ cmp r12, #10 ++ bge 10f ++ ++@ Down of Horizontal - works down left ++ add sp, #8 ++ mov r10, #4 ++ mov r1, r2 ++1: ++ bl patch_h_down_c_4x4_10 ++ bl patch_h_down_c_4x4_10_continue ++ bl patch_h_down_c_4x4_10_continue ++ bl patch_h_down_c_4x4_10_continue ++ ++ add r2, r1, #4*4 @ restore r2, but 4 rows further down left ++ add r1, r1, #4*4 ++ mov r6, r4 ++ sub r0, #64 ++ subs r10, #1 ++ add r0, r0, r3, lsl #2 ++ bne 1b ++ ++ pop {r4-r10, pc} ++ ++@ Up of Horizontal - works down up ++10: ++ add sp, #8 ++ mov r10, #4 ++ ldrh r7, [r7] ++ mov r8, #-128 ++ sub r8, r7 ++2: ++ push {r2, r8} ++ bl patch_h_up_c_4x4_10 ++ bl patch_h_up_c_4x4_10_continue ++ bl patch_h_up_c_4x4_10_continue ++ bl patch_h_up_c_4x4_10_continue ++ pop {r2, r8} ++ ++ sub r0, #64 ++ mov r6, r4 ++ add r2, #16 ++ sub r8, r8, r7, lsl #2 ++ add r0, r0, r3, lsl #2 ++ subs r10, #1 ++ bne 2b ++ ++ pop {r4-r10, pc} ++ ++@ Left of vertical - works down left ++18: ++ add r5, r1, #32 ++ vld1.16 {q1-q2}, [r1] ++ rsb r12, r6, r6, lsl #16 ++ vld1.16 {q3-q4}, [r5] ++ sub r9, r2, #4 ++ rsb r4, r12, #0 ++ rsb r12, r12, #32 << 16 ++ ldrh r7, [r7] ++ mov r8, #-128 ++ vmov d0, d9 ++ vmov s2, r12 ++ add r10, r0, #32 ++ mov r5, #16 ++1: ++ vld1.32 {d1[1]}, [r9] ++ add r8, r7 ++ vmov q11, q4 ++ vmov q10, q3 ++ asr r9, r8, #8 ++ vmov q9, q2 ++ add r9, r2, r9, lsl #2 ++ vmov q8, q1 ++ vext.16 q4, q3, q4, #6 ++ vext.16 q3, q2, q3, #6 ++ vext.16 q2, q1, q2, #6 ++ vext.16 q1, q0, q1, #6 ++2: ++ vmul.u16 q12, q8, d1[1] ++ adds r12, r4 ++ vmla.u16 q12, q1, d1[0] ++ it cc ++ addcc r12, #32 << 16 ++ vmul.u16 q13, q9, d1[1] ++ it cc ++ subcc r12, #32 ++ vmla.u16 q13, q2, d1[0] ++ sub r5, #1 ++ vmul.u16 q14, q10, d1[1] ++ teq r5, #0 ++ vmla.u16 q14, q3, d1[0] ++ vmul.u16 q15, q11, d1[1] ++ vmla.u16 q15, q4, d1[0] ++ vmov s2, r12 ++ vrshr.u16 q12, q12, #5 ++ vrshr.u16 q13, q13, #5 ++ vrshr.u16 q14, q14, #5 ++ vrshr.u16 q15, q15, #5 ++ vst1.16 {q12-q13}, [r0], r3 ++ vst1.16 {q14-q15}, [r10], r3 ++ bhi 2b ++ bne 1b ++ ++ vpop {d8} ++ vmov d9, d0 ++ pop {r4-r10, pc} ++ ++@ Right of vertical - works along top - left unused ++26: ++ add r5, r1, #32 ++ vld1.16 {q1-q2}, [r1] ++ rsb r12, r6, r6, lsl #16 ++ vld1.16 {q3-q4}, [r5] ++ add r1, r1, #64 ++ rsb r4, r12, #0 ++ rsb r12, r12, #32 << 16 ++ vmov d1, d9 ++ vmov s1, r12 ++ add r10, r0, #32 ++ mov r5, #16 ++1: ++ vld1.32 {d0[0]}, [r1]! ++ vmov q8, q1 ++ vmov q9, q2 ++ vmov q10, q3 ++ vmov q11, q4 ++ vext.16 q1, q1, q2, #2 ++ vext.16 q2, q2, q3, #2 ++ vext.16 q3, q3, q4, #2 ++ vext.16 q4, q4, q0, #2 ++2: ++ vmul.u16 q12, q1, d0[2] ++ adds r12, r4 ++ vmla.u16 q12, q8, d0[3] ++ it cc ++ addcc r12, #32 << 16 ++ vmul.u16 q13, q2, d0[2] ++ it cc ++ subcc r12, #32 ++ vmla.u16 q13, q9, d0[3] ++ sub r5, #1 ++ vmul.u16 q14, q3, d0[2] ++ teq r5, #0 ++ vmla.u16 q14, q10, d0[3] ++ vmul.u16 q15, q4, d0[2] ++ vmla.u16 q15, q11, d0[3] ++ vmov s1, r12 ++ vrshr.u16 q12, q12, #5 ++ vrshr.u16 q13, q13, #5 ++ vrshr.u16 q14, q14, #5 ++ vrshr.u16 q15, q15, #5 ++ vst1.16 {q12-q13}, [r0], r3 ++ vst1.16 {q14-q15}, [r10], r3 ++ bhi 2b ++ bne 1b ++ ++ vpop {d8} ++ vmov d9, d1 ++ pop {r4-r10, pc} ++ ++endfunc +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcpred_intra_dc_neon.S +@@ -0,0 +1,705 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++ ++@ ff_hevc_rpi_pred_dc_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_4_neon_8, export=1 ++ ++ @ Average the els of top & left ++ ldr r2, [r2] ++ vld1.32 {d0[0]}, [r1] ++ mov r1, #2 ++ vmov s1, r2 ++ vmov s2, r2 ++ vmov.i16 q2, #3 ++ add r2, r0, r3 ++ vaddl.u8 q1, d0, d1 @ d2[0] = top[0] + left[0] ++ lsl r3, #1 ++ vmovl.u8 q0, d0 ++ vmov.i64 d7, #0xffff ++ vmov.16 d4[0], r1 @ 2, 3, 3, 3... ++ vpadd.i16 d6, d2, d2 @ 2 (top & bottom of vector the same) ++ vbit d0, d2, d7 @ q0 = top[0]+left[0], top[1..3], left[0..3] ++ ++ @ top line gets some smoothing ++ @ (top[i] + 3*dc + 2) >> 2 ++ @ as does left ++ @ top_line[0] is extra special ++ @ (top[0] + left[0] + 2*dc + 2) >> 2 ++ ++ vmov.i64 d7, #0xff ++ vpadd.i16 d6, d6 @ 1 (all the same) ++ vrshr.u16 d6, #3 ++ vmla.i16 q0, q2, d6[0] ++ vdup.8 d6, d6[0] ++ vrshrn.i16 d0, q0, #2 ++ ++ @ Store top line ++ vst1.32 {d0[0]}, [r0], r3 ++ ++ @ Store the rest ++ vshr.u64 d1, d0, #5*8 ++ vshr.u64 d2, d0, #6*8 ++ vshr.u64 d3, d0, #7*8 ++ vbif d1, d6, d7 ++ vbif d2, d6, d7 ++ vst1.32 {d1[0]}, [r2], r3 ++ vbif d3, d6, d7 ++ vst1.32 {d2[0]}, [r0] ++ vst1.32 {d3[0]}, [r2] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_c_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_c_4_neon_8, export=1 ++ ++ @ Average the els of top & left ++ vld1.8 {d0}, [r1] ++ vld1.8 {d1}, [r2] ++A add r2, r0, r3, lsl #1 ++A lsl r3, #2 ++T lsl r3, #1 ++T add r2, r0, r3 ++T lsl r3, #1 ++ vaddl.u8 q0, d0, d1 ++ vadd.i16 d0, d1 @ d0 has 2 val pairs ++ vpadd.i32 d2, d0, d0 @ This adds U & V separately ++ vpadd.i32 d3, d0, d0 ++ vrshrn.u16 d0, q1, #3 ++ ++ @ Store ++ vst1.8 {d0}, [r0], r3 ++ vst1.8 {d0}, [r2], r3 ++ vst1.8 {d0}, [r0] ++ vst1.8 {d0}, [r2] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_8_neon_8, export=1 ++ ++ @ Average the els of top & left ++ vld1.8 {d0}, [r1] ++ mov r1, #2 ++ vld1.8 {d16}, [r2] ++ vmov.i16 q2, #3 ++ vmov.i64 d7, #0xffff ++ vaddl.u8 q1, d0, d16 @ d2[0] = top[0] + left[0] ++ vmovl.u8 q0, d0 ++ vadd.i16 d6, d2, d3 @ d6 has 4 vals ++ vmov.16 d4[0], r1 @ 2, 3, 3, 3... ++ vbit d0, d2, d7 @ q0 = top[0]+left[0], top[1..7] ++ ++ @ top line gets some smoothing ++ @ (top[i] + 3*dc + 2) >> 2 ++ @ as does left ++ @ top_line[0] is extra special ++ @ (top[0] + left[0] + 2*dc + 2) >> 2 ++ ++ vmov.i64 d7, #0xff ++ vmovl.u8 q1, d16 ++ vpadd.i16 d6, d6 @ 2 (top & bottom of vector the same) ++ vpadd.i16 d6, d6 @ 1 (all the same) ++ vrshr.u16 d6, #4 ++ vmla.i16 q1, q2, d6[0] ++ vmla.i16 q0, q2, d6[0] ++ vdup.8 d6, d6[0] ++ vrshrn.i16 d2, q1, #2 ++ vrshrn.i16 d0, q0, #2 ++ ++ @ Store top line ++ vst1.8 {d0}, [r0], r3 ++ ++ @ Store the rest ++ vshr.u64 d2, #8 ++ vbit d6, d2, d7 ++ vshr.u64 d2, #8 ++ vst1.8 {d6}, [r0], r3 ++ mov r1, #6 ++1: ++ vbit d6, d2, d7 ++ vshr.u64 d2, #8 ++ vst1.8 {d6}, [r0], r3 ++ subs r1, #2 ++ vbit d6, d2, d7 ++ vshr.u64 d2, #8 ++ vst1.8 {d6}, [r0], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_c_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_c_8_neon_8, export=1 ++ ++ @ Average the els of top & left ++ vld1.8 {q0}, [r1] ++ mov r1, #8 ++ vld1.8 {q1}, [r2] ++T lsl r3, #1 ++ vaddl.u8 q0, d0, d1 ++A add r2, r0, r3, lsl #1 ++A lsl r3, #2 ++T add r2, r0, r3 ++T lsl r3, #1 ++ vaddl.u8 q1, d2, d3 ++ vadd.i16 q1, q0 ++ vadd.i16 d3, d2 @ d3 has 2 val pairs ++ vpadd.i32 d2, d3, d3 @ This add U & V separately ++ vpadd.i32 d3, d3, d3 ++ vrshrn.u16 d0, q1, #4 ++ vrshrn.u16 d1, q1, #4 ++ ++ @ Store ++1: ++ vst1.8 {q0}, [r0], r3 ++ subs r1, #4 ++ vst1.8 {q0}, [r2], r3 ++ vst1.8 {q0}, [r0], r3 ++ vst1.8 {q0}, [r2], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_16_neon_8, export=1 ++ ++ @ Average the els of top & left ++ vld1.8 {q8}, [r1] ++ mov r1, #2 ++ vld1.8 {q9}, [r2] ++ vaddl.u8 q10, d16, d17 ++ vaddl.u8 q11, d16, d18 ++ vaddl.u8 q0, d18, d19 ++ vmov.i16 q1, #3 ++ vadd.i16 q10, q0 ++ vmovl.u8 q0, d18 ++ vadd.i16 d20, d21 ++ vmov.i16 d2[0], r1 @ 2, 3, 3, 3... ++ ++ @ top line gets some smoothing ++ @ (top[i] + 3*dc + 2) >> 2 ++ @ as does left ++ @ top_line[0] is extra special ++ @ (top[0] + left[0] + 2*dc + 2) >> 2 ++ ++ vmovl.u8 q2, d16 ++ vmovl.u8 q9, d19 ++ vpadd.i16 d20, d20 @ 2 (top & bottom of vector the same) ++ vmov.i64 d7, #0xffff ++ vmovl.u8 q8, d17 ++ vbit d4, d22, d7 @ q2 = top[0]+left[0], top[1..7] ++ vmov.i64 d7, #0xff ++ vpadd.i16 d20, d20 @ 1 (all the same) ++ vrshr.u16 d21, d20, #5 ++ vrshr.u16 d20, d20, #5 ++ vmla.i16 q0, q10, d2[1] ++ vmla.i16 q9, q10, d2[1] ++ vmla.i16 q2, q10, q1 ++ vmla.i16 q8, q10, d2[1] ++ vdup.8 q1, d20[0] ++ vrshrn.i16 d0, q0, #2 ++ vrshrn.i16 d1, q9, #2 ++ vrshrn.i16 d4, q2, #2 ++ vrshrn.i16 d5, q8, #2 ++ vext.8 q0, q0, q0, #1 ++ ++ @ Store top line ++ vst1.8 {q2}, [r0], r3 ++ ++ @ Store the rest ++ mov r1, #15 ++1: ++ vbit d2, d0, d7 ++ vext.8 q0, q0, q0, #1 ++ subs r1, #1 ++ vst1.8 {q1}, [r0], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_c_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_c_16_neon_8, export=1 ++ ++ @ Average the els of top & left ++ vld1.8 {q0-q1}, [r1] ++ mov r1, #16 ++ vld1.8 {q2-q3}, [r2] ++T lsl r3, #1 ++ vaddl.u8 q0, d0, d1 ++A add r2, r0, r3, lsl #1 ++T add r2, r0, r3 ++ vaddl.u8 q1, d2, d3 ++A lsl r3, #2 ++T lsl r3, #1 ++ vaddl.u8 q2, d4, d5 ++ vaddl.u8 q3, d6, d7 ++ vadd.i16 q0, q1 ++ vadd.i16 q2, q3 ++ vadd.i16 q0, q2 ++ vadd.i16 d0, d1 @ d0 has 2 val pairs ++ vpadd.i32 d4, d0, d0 @ This adds U & V separately ++ vpadd.i32 d5, d0, d0 ++ vrshrn.u16 d0, q2, #5 ++ vrshrn.u16 d1, q2, #5 ++ vrshrn.u16 d2, q2, #5 ++ vrshrn.u16 d3, q2, #5 ++ ++ @ Store ++1: ++ vst1.8 {q0-q1}, [r0], r3 ++ subs r1, #2 ++ vst1.8 {q0-q1}, [r2], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_32_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_32_neon_8, export=1 ++ ++ @ Average the els of top & left ++ vld1.8 {q0-q1}, [r1] ++ mov r1, #32 ++ vld1.8 {q2-q3}, [r2] ++ add r2, r0, r3 ++ vaddl.u8 q0, d0, d1 ++ lsl r3, #1 ++ vaddl.u8 q1, d2, d3 ++ vaddl.u8 q2, d4, d5 ++ vaddl.u8 q3, d6, d7 ++ vadd.i16 q0, q1 ++ vadd.i16 q2, q3 ++ vadd.i16 q0, q2 ++ vadd.i16 d0, d1 @ d0 has 4 vals ++ vpadd.i16 d0, d0 @ 2 (top & bottom the same) ++ vpadd.i16 d4, d0, d0 @ 1 (all the same) ++ vpadd.i16 d5, d0, d0 ++ vrshrn.u16 d0, q2, #6 ++ vrshrn.u16 d1, q2, #6 ++ vrshrn.u16 d2, q2, #6 ++ vrshrn.u16 d3, q2, #6 ++ ++ @ Store ++1: ++ vst1.8 {q0-q1}, [r0], r3 ++ subs r1, #2 ++ vst1.8 {q0-q1}, [r2], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ----------------------------------------------------------------------------- ++@ ++@ 10 Bit versions ++@ ++@ There is no actual bit depth dependency in this code except that our ++@ intermediate results will overflow the 16 bits they are stored in ++@ All there functions are good to 10 bits - with the worst case being ++@ in dc_32 where we use all 16 bits. ++ ++ ++@ ff_hevc_rpi_pred_dc_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_4_neon_10, export=1 ++ ++ @ Average the els of top & left ++ vld1.16 {d0}, [r1] ++ mov r1, #2 ++ vld1.16 {d1}, [r2] ++T lsl r3, #1 ++ vmov.i16 q2, #3 ++A add r2, r0, r3, lsl #1 ++T add r2, r0, r3 ++ vadd.u16 d2, d0, d1 @ d2[0] = top[0] + left[0] ++A lsl r3, #2 ++T lsl r3, #1 ++ vmov.16 d4[0], r1 @ 2, 3, 3, 3... ++ vmov.i64 d7, #0xffff ++ vbit d0, d2, d7 @ q0 = top[0]+left[0], top[1..3], left[0..3] ++ ++ @ top line gets some smoothing ++ @ (top[i] + 3*dc + 2) >> 2 ++ @ as does left ++ @ top_line[0] is extra special ++ @ (top[0] + left[0] + 2*dc + 2) >> 2 ++ ++ vpadd.i16 d6, d2, d2 @ 2 (top & bottom of vector the same) ++ vpadd.i16 d6, d6 @ 1 (all the same) ++ vrshr.u16 d6, #3 ++ vmla.i16 q0, q2, d6[0] ++ vrshr.u16 q0, #2 ++ ++ @ Store top line ++ vst1.16 {d0}, [r0], r3 ++ ++ @ Store the rest ++ vshr.u64 d3, d1, #1*16 ++ vshr.u64 d4, d1, #2*16 ++ vshr.u64 d5, d1, #3*16 ++ vbif d3, d6, d7 ++ vbif d4, d6, d7 ++ vst1.16 {d3}, [r2], r3 ++ vbif d5, d6, d7 ++ vst1.16 {d4}, [r0] ++ vst1.16 {d5}, [r2] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_c_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] (In pels - needs * 4) ++ ++function ff_hevc_rpi_pred_dc_c_4_neon_10, export=1 ++ ++ @ Average the els of top & left ++ vld1.8 {q0}, [r1] ++ vld1.8 {q1}, [r2] ++A add r2, r0, r3, lsl #2 ++A lsl r3, #3 ++T lsl r3, #2 ++T add r2, r0, r3 ++T lsl r3, #1 ++ vadd.i16 q0, q1 ++ vadd.i16 d0, d1 @ d0 has 2 val pairs ++ vpadd.i32 d2, d0, d0 @ This adds U & V separately ++ vpadd.i32 d3, d0, d0 ++ vrshr.u16 q0, q1, #3 ++ ++ vst1.16 {q0}, [r0], r3 ++ vst1.16 {q0}, [r2], r3 ++ vst1.16 {q0}, [r0] ++ vst1.16 {q0}, [r2] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_8_neon_10, export=1 ++ ++ @ Average the els of top & left ++ vld1.16 {q0}, [r1] ++ mov r1, #2 ++ vld1.16 {q8}, [r2] ++T lsl r3, #1 ++ vmov.i16 q2, #3 ++A add r2, r0, r3, lsl #1 ++T add r2, r0, r3 ++ vadd.i16 q1, q0, q8 @ q1[0] = top[0] + left[0] ++A lsl r3, #2 ++T lsl r3, #1 ++ vmov.i64 d7, #0xffff ++ vmov.16 d4[0], r1 @ 2, 3, 3, 3... ++ vadd.i16 d6, d2, d3 @ d6 has 4 vals ++ vbit d0, d2, d7 @ q0 = top[0]+left[0], top[1..7] ++ ++ @ top line gets some smoothing ++ @ (top[i] + 3*dc + 2) >> 2 ++ @ as does left ++ @ top_line[0] is extra special ++ @ (top[0] + left[0] + 2*dc + 2) >> 2 ++ ++ vpadd.i16 d6, d6 @ 2 (top & bottom of vector the same) ++ vpadd.i16 d6, d6 @ 1 (all the same) ++ vrshr.u16 d6, #4 ++ vmla.i16 q8, q2, d6[0] ++ vmla.i16 q0, q2, d6[0] ++ vdup.16 q2, d6[0] ++ vdup.16 q9, d6[0] ++ vrshr.u16 q8, q8, #2 ++ vrshr.u16 q0, q0, #2 ++ vext.16 q1, q8, q8, #1 ++ ++ @ Store top line ++ vst1.16 {q0}, [r0], r3 ++ ++ @ Store the rest ++ vbit d18, d2, d7 ++ vst1.16 {q9}, [r2], r3 ++ mov r1, #6 ++1: ++ vext.16 q8, q8, q8, #2 ++ subs r1, #2 ++ vext.16 q1, q1, q1, #2 ++ vbit d4, d16, d7 ++ vst1.16 {q2}, [r0], r3 ++ vbit d18, d2, d7 ++ vst1.16 {q9}, [r2], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_c_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] (In pels - needs * 4) ++ ++function ff_hevc_rpi_pred_dc_c_8_neon_10, export=1 ++ ++ @ Average the els of top & left ++ vld1.16 {q0-q1}, [r1] ++ mov r1, #8 ++ vld1.16 {q2-q3}, [r2] ++T lsl r3, #2 ++ vadd.i16 q1, q0 ++A add r2, r0, r3, lsl #2 ++A lsl r3, #3 ++T add r2, r0, r3 ++T lsl r3, #1 ++ vadd.i16 q2, q3 ++ vadd.i16 q1, q2 ++ vadd.i16 d3, d2 @ d3 has 2 val pairs ++ vpadd.i32 d2, d3, d3 @ This add U & V separately ++ vpadd.i32 d3, d3, d3 ++ vrshr.u16 q0, q1, #4 ++ vrshr.u16 q1, q1, #4 ++ ++ @ Store ++1: ++ vst1.8 {q0-q1}, [r0], r3 ++ subs r1, #2 ++ vst1.8 {q0-q1}, [r2], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_dc_16_neon_10, export=1 ++ ++ @ Average the els of top & left ++ vld1.16 {q8-q9}, [r1] ++ mov r1, #2 ++ vld1.16 {q10-q11}, [r2] ++ lsl r3, #1 @ stride given in pels ++ vadd.i16 q0, q8, q9 ++ vadd.i16 q1, q10, q11 ++ vmov.i16 q3, #3 ++ vadd.i16 q1, q0 ++ vadd.i16 d0, d16, d20 ++ vmov.i64 d31, #0xffff ++ vadd.i16 d3, d2 ++ vmov.16 d6[0], r1 @ 2, 3, 3, 3... ++ ++ @ top line gets some smoothing ++ @ (top[i] + 3*dc + 2) >> 2 ++ @ as does left ++ @ topline[0] is extra special ++ @ (top[0] + left[0] + 2*dc + 2) >> 2 ++ ++ vbit d16, d0, d31 @ q8 = top[0]+left[0], top[1..7] ++ vpadd.i16 d3, d3 @ 2 (top & bottom of vector the same) ++ vpadd.i16 d3, d3 @ 1 (all the same) ++ vrshr.u16 d2, d3, #5 ++ vrshr.u16 d3, d3, #5 ++ vmov q0, q1 ++ vmla.i16 q10, q1, d6[1] ++ vmla.i16 q11, q1, d6[1] ++ vmla.i16 q8, q1, q3 ++ vmla.i16 q9, q1, d6[1] ++ vrshr.u16 q2, q10, #2 ++ vrshr.u16 q3, q11, #2 ++ vrshr.u16 q8, #2 ++ vrshr.u16 q9, #2 ++ vext.16 q2, q2, q2, #1 ++ mov r1, #7<<29 ++ ++ @ Store top line ++ vst1.16 {q8-q9}, [r0], r3 ++ ++ @ Store the rest ++1: ++ vbit d0, d4, d31 ++ vext.16 q2, q2, q2, #1 ++ subs r1, #1<<29 ++ vst1.16 {q0-q1}, [r0], r3 ++ bne 1b ++1: ++ vbit d0, d6, d31 ++ vext.16 q3, q3, q3, #1 ++ subs r1, #1<<29 ++ vst1.16 {q0-q1}, [r0], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_c_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] (In pels - needs * 4) ++ ++function ff_hevc_rpi_pred_dc_c_16_neon_10, export=1 ++ ++ @ Average the els of top & left ++ vldm r1, {q0-q3} ++ vldm r2, {q8-q11} ++ vadd.i16 q0, q1 ++ mov r1, #16 ++ vadd.i16 q2, q3 ++ add r2, r0, #32 ++ vadd.i16 q8, q9 ++ lsl r3, #2 ++ vadd.i16 q10, q11 ++ vadd.u16 q0, q2 ++ vadd.u16 q8, q10 ++ vadd.i16 q0, q8 ++ vadd.i16 d0, d1 @ d0 has 2 val pairs ++ vpadd.i32 d4, d0, d0 @ This adds U & V separately ++ vpadd.i32 d5, d0, d0 ++ vrshr.u16 q0, q2, #5 ++ vrshr.u16 q1, q2, #5 ++ ++ @ Store ++1: ++ vst1.16 {q0-q1}, [r0], r3 ++ subs r1, #1 ++ vst1.16 {q0-q1}, [r2], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_dc_32_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] (In pels) ++ ++function ff_hevc_rpi_pred_dc_32_neon_10, export=1 ++ ++ @ Average the els of top & left ++ @ With 10 bits we are (just) safe from overflow in i16 ++ vldm r1, {q0-q3} ++ vldm r2, {q8-q11} ++ vadd.i16 q0, q1 ++ mov r1, #32 ++ vadd.i16 q2, q3 ++ add r2, r0, #32 ++ vadd.i16 q8, q9 ++ lsl r3, #1 ++ vadd.i16 q10, q11 ++ vadd.u16 q0, q2 ++ vadd.u16 q8, q10 ++ vadd.i16 q0, q8 ++ vadd.i16 d0, d1 @ d0 has 4 vals ++ vpadd.i16 d0, d0 @ 2 (top & bottom the same) ++ vpadd.i16 d4, d0, d0 @ 1 (all the same) ++ vpadd.i16 d5, d0, d0 ++ vrshr.u16 q0, q2, #6 ++ vrshr.u16 q1, q2, #6 ++ ++ @ Store ++1: ++ vst1.16 {q0-q1}, [r0], r3 ++ subs r1, #1 ++ vst1.16 {q0-q1}, [r2], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcpred_intra_filter_neon.S +@@ -0,0 +1,881 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++@ All functions have the call ++@ ++@ int ff_hevc_rpi_intra_filter_N_neon_PW( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++@ ++@ Assumptions: ++@ (that wouldn't apply to all frame layoouts but do apply to sand, so beware ++@ if reuseing this code) ++@ ++@ Min ctb size is 8 so we don't need to worry about tr_size or dl_size for ++@ N==4, but do for chroma N>=8. As we share Y/C fns that means we can ignore ++@ N==8,PW=8 (chroma always PW>8) but have to cope for larger ++@ ++@ We always have at least 64 pixel H frame width rounding - this lets us ++@ load UR widthout having to worry about exactly how many pixels are actually ++@ within the frame. As partial loads will only occur very occasionally this ++@ should be a win in nearly all cases. ++@ ++@ 16 bit fns can be used as 8 bit chroma fns as chroma never filters ++@ so we do no maths on the contents ++@ ++@ No filtering in 32bit fns as they are chroma only ++ ++ ++.equ AVAIL_UR, 1 ++.equ AVAIL_U, 2 ++.equ AVAIL_UL, 4 ++.equ AVAIL_L, 8 ++.equ AVAIL_DL, 16 ++ ++.equ FILTER_LIGHT, 0x40 ++.equ FILTER_STRONG, 0x80 ++ ++.equ AVAIL_S_UR_N_U_C, 32 - 1 ++.equ AVAIL_S_U_N_UL_C, 32 - 2 ++.equ AVAIL_S_UL_N_L_C, 32 - 3 ++.equ AVAIL_S_L_N_DL_C, 32 - 4 ++ ++.equ AVAIL_S_U_DL_CPSR, 31 - 4 @ Shift for u..dl to go into flags via cpsr ++ ++@ On entry ++@ r2 req ++@ r3 avail ++@ [sp, #sp_offset...] args ++@ ++@ On Exit: ++@ ++@ Extend values: ++@ d_l scalar contains value for L & DL ++@ if DL avail then this is is DL[0] so we don't need to load that ++@ d_ul scalar containing value for UL ++@ d_u scalar containing value for U ++@ d_ur scalar containing value for UR ++@ If DL avail then d_l == b_dl elif L avail then d_l == a_l else... ++@ This means that L-light-filter works even if nreq DL (we never filter ++@ req-DL without req-L, but we do filter req-L without req-DL) ++@ If UR avail then d_ur == a_ur so U-filter good too ++@ ++@ Data load pointers (only load if req & avail): ++@ r4 DL + stride ++@ r10 L ++@ r6 U ++@ r5 UR ++@ ++@ Others: ++@ r2 req ++@ r7 req & avail ++@ r3 L + stride ++@ r8 DL + stride * 2 ++@ r9 stride * 2 ++@ cs Load U ++@ mi Load UR ++@ ++@ Clobbered: ++@ r12 ++ ++.macro load_pointers pw_s, log2_s, sp_offset, d_type, d_l, d_ul, d_u, d_ur ++ ++.equ src_l\@, \sp_offset + 0 ++.equ src_u\@, \sp_offset + 4 ++.equ src_ur\@, \sp_offset + 8 ++.equ stride\@, \sp_offset + 12 ++.equ pw\@, (1 << \pw_s) @ pel width in bytes ++.equ b_size\@, (1 << (\pw_s + \log2_s)) @ size in bytes ++ ++@ r9 stride ++@ r7 = ab_ul, r6 = a_u, r5 = a_ur ++@ r4 = b_dl, r10 = b_l, r8 = b_u ++ ++ ldr r5, [sp, #src_ur\@] ++ lsl r12, r3, #AVAIL_S_U_DL_CPSR ++ ldr r10, [sp, #src_l\@] ++ ldr r9, [sp, #stride\@] ++ ldr r6, [sp, #src_u\@] ++ ++ @ This is quite a slow instruction but it replaces ++ @ a decent number of tests that yield a max of 2 flags/op ++ @ It is annoying we can't branch on Q! ++ @ If L navail (ne) then DL must be navail (pl) ++ msr APSR_nzcvq, r12 @ n=dl, z=l, c=ul, v=u, q=ur ++ ++ mov r4, r5 ++ sub r7, r10, r9 ++ it vs ++ movvs r4, r6 ++ add r8, r6, #b_size\@ - pw\@ ++ it cs ++ movcs r4, r7 ++ ite ne ++ movne r10, r4 ++ addeq r4, r7, r9, lsl #\log2_s ++ it cc ++ movcc r7, r10 ++ it mi ++ addmi r4, r10, r9, lsl #\log2_s ++ vld1.\d_type {\d_ul}, [r7] ++ itt vc ++ movvc r8, r7 ++ movvc r6, r7 ++ vld1.\d_type {\d_l }, [r4], r9 ++ tst r3, #AVAIL_UR ++ vld1.\d_type {\d_u }, [r6] ++ it eq ++ moveq r5, r8 ++ and r7, r2, r3 ++ add r8, r4, r9 ++ vld1.\d_type {\d_ur}, [r5] ++ lsls r12, r7, #AVAIL_S_UR_N_U_C ++ add r3, r10, r9 ++ lsl r9, #1 ++.endm ++ ++ ++ ++@ int ff_hevc_rpi_intra_filter_4_neon_8( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++ ++.set sp_base, 8*4 ++.set pw_s, 0 ++.set pw, (1 << pw_s) ++.set log2_s, 2 ++ ++function ff_hevc_rpi_intra_filter_4_neon_8, export=1 ++ push {r4-r10, lr} ++ load_pointers pw_s, log2_s, sp_base, 8, d0[], d31[7], d1[], d2[] ++ ++ it cs ++ vldrcs s2, [r6] ++ ite pl ++ vmovpl s3, s4 ++ vldrmi s3, [r5] ++ ++ lsls r7, #AVAIL_S_L_N_DL_C ++ add r12, r0, #-pw ++ bpl 1f ++ ++ vld1.8 {d0[0]}, [r10], r9 ++ vld1.8 {d0[1]}, [r3], r9 ++ vld1.8 {d0[2]}, [r10] ++ vld1.8 {d0[3]}, [r3] ++1: ++ bcc 1f ++ vld1.8 {d0[5]}, [r4], r9 ++ vld1.8 {d0[6]}, [r8] ++ vld1.8 {d0[7]}, [r4] ++1: ++ vstr d1, [r1] @ Up ++ vst1.8 {d31[7]}, [r12] ++ vstr d0, [r0] @ Left ++ pop {r4-r10, pc} ++endfunc ++ ++ ++@ int ff_hevc_rpi_intra_filter_4_neon_16( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++ ++.set sp_base, 8*4 ++.set pw_s, 1 ++.set pw, (1 << pw_s) ++.set log2_s, 2 ++ ++function ff_hevc_rpi_intra_filter_4_neon_16, export=1 ++ push {r4-r10, lr} ++ load_pointers pw_s, log2_s, sp_base, 16, "d0[],d1[]", d31[3], d2[], d3[] ++ ++ it cs ++ vldrcs d2, [r6] ++ it mi ++ vldrmi d3, [r5] ++ lsls r7, #AVAIL_S_L_N_DL_C ++ add r12, r0, #-pw ++ bpl 1f ++ vld1.16 {d0[0]}, [r10], r9 ++ vld1.16 {d0[1]}, [r3], r9 ++ vld1.16 {d0[2]}, [r10] ++ vld1.16 {d0[3]}, [r3] ++1: ++ bcc 1f ++ vld1.16 {d1[1]}, [r4], r9 ++ vld1.16 {d1[2]}, [r8] ++ vld1.16 {d1[3]}, [r4] ++1: ++ vst1.16 {q1}, [r1] @ Up ++ vst1.16 {d31[3]}, [r12] ++ vst1.16 {q0}, [r0] @ Left ++ pop {r4-r10, pc} ++endfunc ++ ++ ++@ int ff_hevc_rpi_intra_filter_8_neon_8( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++ ++.set sp_base, 8*4 ++.set pw_s, 0 ++.set pw, (1 << pw_s) ++.set log2_s, 3 ++ ++function ff_hevc_rpi_intra_filter_8_neon_8, export=1 ++ push {r4-r10, lr} ++ load_pointers pw_s, log2_s, sp_base, 8, "d0[],d1[]", d31[7], d4[], d5[] ++ ++ it cs ++ vldrcs d4, [r6] ++ it mi ++ vldrmi d5, [r5] ++ ++ lsls r7, #AVAIL_S_L_N_DL_C ++ bpl 1f ++ vld1.8 {d0[0]}, [r10], r9 ++ vld1.8 {d0[1]}, [r3], r9 ++ vld1.8 {d0[2]}, [r10], r9 ++ vld1.8 {d0[3]}, [r3], r9 ++ vld1.8 {d0[4]}, [r10], r9 ++ vld1.8 {d0[5]}, [r3], r9 ++ vld1.8 {d0[6]}, [r10] ++ vld1.8 {d0[7]}, [r3] ++1: ++ bcc 1f ++ vld1.8 {d1[1]}, [r4], r9 ++ vld1.8 {d1[2]}, [r8], r9 ++ vld1.8 {d1[3]}, [r4], r9 ++ vld1.8 {d1[4]}, [r8], r9 ++ vld1.8 {d1[5]}, [r4], r9 ++ vld1.8 {d1[6]}, [r8] ++ vld1.8 {d1[7]}, [r4] ++1: ++ tst r2, #FILTER_LIGHT ++ add r12, r0, #-pw ++ beq 10f ++ ++ @ Luma light filter ++ vext.8 q8, q15, q2, #15 ++ vext.8 q12, q15, q0, #15 ++ vaddl.u8 q9, d17, d5 ++ vaddl.u8 q8, d16, d4 ++ vaddl.u8 q13, d25, d1 ++ vaddl.u8 q12, d24, d0 ++ vmov.u8 r3, d5[7] @ Save final pel ++ vmov.u8 r2, d1[7] @ Save final pel ++ ++ vext.16 q2, q8, q9, #1 ++ vext.16 q3, q9, q9, #1 ++ vext.16 q0, q12, q13, #1 ++ vext.16 q1, q13, q13, #1 ++ vadd.u16 d30, d16, d24 @ d30[0] = l[0] + 2ul + u[0] ++ vadd.u16 q2, q8 ++ vadd.u16 q3, q9 ++ vadd.u16 q0, q12 ++ vadd.u16 q1, q13 ++ ++ vrshrn.u16 d4, q2, #2 ++ vrshrn.u16 d5, q3, #2 ++ vrshrn.u16 d0, q0, #2 ++ vrshrn.u16 d1, q1, #2 ++ vrshr.u16 d30, #2 ++ vmov.u8 d5[7], r3 @ Restore final pel ++ vmov.u8 d1[7], r2 @ Restore final pel ++ vdup.u8 d31, d30[0] @ d31[3] = d30[0] ++ ++10: ++ vst1.8 {q2 }, [r1] @ Up ++ vst1.8 {d31[7]}, [r12] @ Up-left ++ vst1.8 {q0 }, [r0] @ Left ++ pop {r4-r10, pc} ++endfunc ++ ++ ++@ int ff_hevc_rpi_intra_filter_8_neon_16( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++ ++.set sp_base, 8*4 ++.set ur_size, sp_base + 16 ++.set dl_size, sp_base + 20 ++.set pw_s, 1 ++.set pw, (1 << pw_s) ++.set log2_s, 3 ++.set p_size, (1 << log2_s) @ size in pels ++ ++function ff_hevc_rpi_intra_filter_8_neon_16, export=1 ++ push {r4-r10, lr} ++ load_pointers pw_s, log2_s, sp_base, 16, "d0[],d1[]", d31[3], "d4[],d5[]", "d6[],d7[]" ++ ++ it cs ++ vldmcs r6, {d4, d5} ++ ldr r12, [sp, #ur_size] ++ bpl 1f ++ cmp r12, #4 ++ vldm r5, {d6, d7} ++ bgt 1f ++ vdup.16 d7, d6[3] ++1: ++ lsls r12, r7, #AVAIL_S_L_N_DL_C ++ vdup.16 q1, d0[0] ++ bpl 1f ++ vld1.16 {d0[0]}, [r10], r9 ++ vld1.16 {d0[1]}, [r3], r9 ++ vld1.16 {d0[2]}, [r10], r9 ++ vld1.16 {d0[3]}, [r3], r9 ++ vld1.16 {d1[0]}, [r10], r9 ++ vld1.16 {d1[1]}, [r3], r9 ++ vld1.16 {d1[2]}, [r10] ++ vld1.16 {d1[3]}, [r3] ++1: ++ bcc 1f ++ ldr r12, [sp, #dl_size] ++ vld1.16 {d2[1]}, [r4], r9 ++ cmp r12, #p_size ++ vld1.16 {d2[2]}, [r8], r9 ++ vld1.16 {d2[3]}, [r4], r9 ++ blt 2f ++ vld1.16 {d3[0]}, [r8], r9 ++ vld1.16 {d3[1]}, [r4], r9 ++ vld1.16 {d3[2]}, [r8] ++ vld1.16 {d3[3]}, [r4] ++ b 1f ++2: ++ vdup.16 d3, d2[3] ++1: ++ tst r2, #FILTER_LIGHT ++ add r12, r0, #-pw ++ beq 10f ++ ++ @ Luma light filter ++ vext.16 q9, q2, q3, #7 ++ vext.16 q8, q15, q2, #7 ++ vext.16 q13, q0, q1, #7 ++ vext.16 q12, q15, q0, #7 ++ vadd.u16 q9, q3 ++ vadd.u16 q8, q2 ++ vadd.u16 q13, q1 ++ vadd.u16 q12, q0 ++ vmov.u16 r3, d7[3] @ Save final pel ++ vmov.u16 r2, d3[3] @ Save final pel ++ ++ vext.16 q2, q8, q9, #1 ++ vext.16 q3, q9, q9, #1 ++ vext.16 q0, q12, q13, #1 ++ vext.16 q1, q13, q13, #1 ++ vadd.u16 d30, d16, d24 @ d30[0] = l[0] + 2ul + u[0] ++ vadd.u16 q2, q8 ++ vadd.u16 q3, q9 ++ vadd.u16 q0, q12 ++ vadd.u16 q1, q13 ++ ++ vrshr.u16 q2, #2 ++ vrshr.u16 q3, #2 ++ vrshr.u16 q0, #2 ++ vrshr.u16 q1, #2 ++ vrshr.u16 d30, #2 ++ vmov.u16 d7[3], r3 @ Restore final pel ++ vmov.u16 d3[3], r2 @ Restore final pel ++ vdup.u16 d31, d30[0] @ d31[3] = d30[0] ++ ++10: ++ vst1.16 {q2, q3}, [r1] @ Up ++ vst1.16 {d31[3]}, [r12] @ Up-left ++ vst1.16 {q0, q1}, [r0] @ Left ++ pop {r4-r10, pc} ++endfunc ++ ++@ int ff_hevc_rpi_intra_filter_16_neon_16( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++ ++.set sp_base, 8*4 ++.set ur_size, sp_base + 16 ++.set dl_size, sp_base + 20 ++.set pw_s, 1 ++.set pw, (1 << pw_s) ++.set log2_s, 4 ++.set p_size, (1 << log2_s) @ size in pels ++ ++function ff_hevc_rpi_intra_filter_16_neon_16, export=1 ++ push {r4-r10, lr} ++ load_pointers pw_s, log2_s, sp_base, 16, "d0[],d1[]", d31[3], "d16[],d17[]", "d20[],d21[]" ++ ++ vdup.16 q9, d16[0] ++ vdup.16 q11, d20[0] ++ ++ it cs ++ vldmcs r6, {d16-d19} ++ ldr r12, [sp, #ur_size] ++ bpl 1f ++ cmp r12, #12 ++ @ Given chroma frame layout, if UR exists then it is always legit to ++ @ load all of it even if most of it is outside the frame. ++ vldm r5, {d20-d23} ++ bgt 1f ++ bge 4f ++ cmp r12, #8 ++ bge 3f ++ vdup.16 d21, d20[3] ++3: vdup.16 d22, d21[3] ++4: vdup.16 d23, d22[3] ++ ++1: ++ lsls r7, #AVAIL_S_L_N_DL_C ++ ldr r12, [sp, #dl_size] ++ vdup.16 q1, d0[0] ++ vdup.16 q2, d0[0] ++ vdup.16 q3, d0[0] ++ bpl 1f ++ vld1.16 {d0[0]}, [r10], r9 ++ vld1.16 {d0[1]}, [r3], r9 ++ vld1.16 {d0[2]}, [r10], r9 ++ vld1.16 {d0[3]}, [r3], r9 ++ vld1.16 {d1[0]}, [r10], r9 ++ vld1.16 {d1[1]}, [r3], r9 ++ vld1.16 {d1[2]}, [r10], r9 ++ vld1.16 {d1[3]}, [r3], r9 ++ vld1.16 {d2[0]}, [r10], r9 ++ vld1.16 {d2[1]}, [r3], r9 ++ vld1.16 {d2[2]}, [r10], r9 ++ vld1.16 {d2[3]}, [r3], r9 ++ vld1.16 {d3[0]}, [r10], r9 ++ vld1.16 {d3[1]}, [r3], r9 ++ vld1.16 {d3[2]}, [r10] ++ vld1.16 {d3[3]}, [r3] ++1: ++ bcc 1f ++ vld1.16 {d4[1]}, [r4], r9 ++ cmp r12, #4 ++ vld1.16 {d4[2]}, [r8], r9 ++ vld1.16 {d4[3]}, [r4], r9 ++ ble 2f ++ vld1.16 {d5[0]}, [r8], r9 ++ vld1.16 {d5[1]}, [r4], r9 ++ cmp r12, #12 ++ vld1.16 {d5[2]}, [r8], r9 ++ vld1.16 {d5[3]}, [r4], r9 ++ blt 3f ++ vld1.16 {d6[0]}, [r8], r9 ++ vld1.16 {d6[1]}, [r4], r9 ++ vld1.16 {d6[2]}, [r8], r9 ++ vld1.16 {d6[3]}, [r4], r9 ++ ble 4f ++ vld1.16 {d7[0]}, [r8], r9 ++ vld1.16 {d7[1]}, [r4], r9 ++ vld1.16 {d7[2]}, [r8] ++ vld1.16 {d7[3]}, [r4] ++ b 1f ++2: vdup.16 d5, d4[3] ++3: vdup.16 d6, d5[3] ++4: vdup.16 d7, d6[3] ++1: ++ tst r2, #FILTER_LIGHT ++ add r12, r0, #-pw ++ beq 10f ++ ++ vpush {q5} ++ @ Luma light filter ++ @ Left ++ vext.16 q5, q2, q3, #7 ++ vext.16 q14, q1, q2, #7 ++ vext.16 q13, q0, q1, #7 ++ vext.16 q12, q15, q0, #7 ++ ++ vadd.u16 q5, q3 ++ vadd.u16 q14, q2 ++ vadd.u16 q13, q1 ++ vadd.u16 q12, q0 ++ vmov.u16 r2, d7[3] @ Save final pel ++ ++ vext.16 q0, q12, q13, #1 ++ vext.16 q1, q13, q14, #1 ++ vext.16 q2, q14, q5, #1 ++ vext.16 q3, q5, q5, #1 ++ ++ vmov d30, d24 @ d30[0] = l[0] + ul ++ vadd.u16 q0, q12 ++ vadd.u16 q1, q13 ++ vadd.u16 q2, q14 ++ vadd.u16 q3, q5 ++ ++ vrshr.u16 q0, #2 ++ vrshr.u16 q1, #2 ++ vrshr.u16 q2, #2 ++ vrshr.u16 q3, #2 ++ ++ @ Up ++ vext.16 q5, q10, q11, #7 ++ vext.16 q14, q9, q10, #7 ++ vext.16 q13, q8, q9, #7 ++ vext.16 q12, q15, q8, #7 ++ ++ vadd.u16 q5, q11 ++ vadd.u16 q14, q10 ++ vadd.u16 q13, q9 ++ vadd.u16 q12, q8 ++ vmov.u16 r3, d23[3] @ Save final pel ++ ++ vext.16 q8, q12, q13, #1 ++ vext.16 q9, q13, q14, #1 ++ vext.16 q10, q14, q5, #1 ++ vext.16 q11, q5, q5, #1 ++ ++ vadd.u16 d30, d24 @ d30[0] = l[0] + 2ul + u[0] ++ vadd.u16 q8, q12 ++ vadd.u16 q9, q13 ++ vadd.u16 q10, q14 ++ vadd.u16 q11, q5 ++ ++ vrshr.u16 q8, #2 ++ vrshr.u16 q9, #2 ++ vrshr.u16 q10, #2 ++ vrshr.u16 q11, #2 ++ ++ @ Misc ++ vrshr.u16 d30, #2 ++ vmov.u16 d7[3], r2 @ Restore final pel ++ vmov.u16 d23[3], r3 @ Restore final pel ++ vdup.u16 d31, d30[0] @ d31[3] = d30[0] ++ vpop {q5} ++ ++10: ++ vstm r1, {d16-d23} @ Up ++ vst1.16 {d31[3]}, [r12] @ Up-left ++ vstm r0, { d0-d7 } @ Left ++ pop {r4-r10, pc} ++endfunc ++ ++@ int ff_hevc_rpi_intra_filter_4_neon_32( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++ ++.set sp_base, 8*4 ++.set pw_s, 2 ++.set pw, (1 << pw_s) ++.set log2_s, 2 ++ ++function ff_hevc_rpi_intra_filter_4_neon_32, export=1 ++ push {r4-r10, lr} ++ load_pointers pw_s, log2_s, sp_base, 32, "d0[],d1[]", d31[1], "d4[],d5[]", "d6[],d7[]" ++ ++ it cs ++ vldmcs r6, {d4, d5} ++ it mi ++ vldmmi r5, {d6, d7} ++ lsls r7, #AVAIL_S_L_N_DL_C ++ vdup.32 q1, d0[0] ++ add r12, r0, #-pw ++ bpl 1f ++ vld1.32 {d0[0]}, [r10], r9 ++ vld1.32 {d0[1]}, [r3], r9 ++ vld1.32 {d1[0]}, [r10] ++ vld1.32 {d1[1]}, [r3] ++1: ++ bcc 1f ++ vld1.32 {d2[1]}, [r4], r9 ++ vld1.32 {d3[0]}, [r8] ++ vld1.32 {d3[1]}, [r4] ++1: ++ vst1.32 {q2, q3 }, [r1] @ Up ++ vst1.32 {d31[1]}, [r12] ++ vst1.32 {q0, q1 }, [r0] @ Left ++ pop {r4-r10, pc} ++endfunc ++ ++ ++@ int ff_hevc_rpi_intra_filter_8_neon_32( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++ ++.set sp_base, 8*4 ++.set ur_size, sp_base + 16 ++.set dl_size, sp_base + 20 ++.set pw_s, 2 ++.set pw, (1 << pw_s) ++.set log2_s, 3 ++.set p_size, (1 << log2_s) @ size in pels ++ ++function ff_hevc_rpi_intra_filter_8_neon_32, export=1 ++ push {r4-r10, lr} ++ load_pointers pw_s, log2_s, sp_base, 32, "d0[],d1[]", d31[1], "d16[],d17[]", "d20[],d21[]" ++ ++ vdup.32 q9, d16[0] ++ vdup.32 q11, d20[0] ++ ++ it cs ++ vldmcs r6, {q8, q9 } ++ ldr r12, [sp, #ur_size] ++ bpl 1f ++ cmp r12, #p_size ++ vldm r5, {q10, q11} ++ bge 1f ++ vdup.32 q11, d21[1] ++1: ++ lsls r7, #AVAIL_S_L_N_DL_C ++ vdup.32 q1, d0[0] ++ vdup.32 q2, d0[0] ++ vdup.32 q3, d0[0] ++ bpl 1f ++ vld1.32 {d0[0]}, [r10], r9 ++ vld1.32 {d0[1]}, [r3], r9 ++ vld1.32 {d1[0]}, [r10], r9 ++ vld1.32 {d1[1]}, [r3], r9 ++ vld1.32 {d2[0]}, [r10], r9 ++ vld1.32 {d2[1]}, [r3], r9 ++ vld1.32 {d3[0]}, [r10] ++ vld1.32 {d3[1]}, [r3] ++1: ++ bcc 1f ++ ldr r12, [sp, #dl_size] ++ vld1.32 {d4[1]}, [r4], r9 ++ cmp r12, #p_size ++ vld1.32 {d5[0]}, [r8], r9 ++ vld1.32 {d5[1]}, [r4], r9 ++ blt 2f ++ vld1.32 {d6[0]}, [r8], r9 ++ vld1.32 {d6[1]}, [r4], r9 ++ vld1.32 {d7[0]}, [r8] ++ vld1.32 {d7[1]}, [r4] ++ b 1f ++2: ++ vdup.32 q3, d5[1] ++1: ++ add r12, r0, #-pw ++ vstm r1, { q8-q11} @ Up ++ vst1.32 {d31[1]}, [r12] ++ vstm r0, { q0-q3 } @ Left ++ pop {r4-r10, pc} ++endfunc ++ ++ ++@ int ff_hevc_rpi_intra_filter_16_neon_32( ++@ pixel * const left, [r0] ++@ pixel * const top, [r1] ++@ const unsigned int req, [r2] ++@ const unsigned int avail, [r3] ++@ const pixel * const src_l, [sp, #0] ++@ const pixel * const src_u, [sp, #4] ++@ const pixel * const src_ur, [sp, #8] ++@ const unsigned int stride, [sp, #12] (pels) ++@ const unsigned int top_right_size, [sp, #16] ++@ const unsigned int down_left_size) [sp, #20] ++ ++.set sp_base, 8*4 ++.set ur_size, sp_base + 16 ++.set dl_size, sp_base + 20 ++.set pw_s, 2 ++.set pw, (1 << pw_s) ++.set log2_s, 4 ++.set p_size, (1 << log2_s) @ size in pels ++ ++function ff_hevc_rpi_intra_filter_16_neon_32, export=1 ++ push {r4-r10, lr} ++ load_pointers pw_s, log2_s, sp_base, 32, d30[0], d30[1], d31[0], d31[1] ++ ++ @ Once we get this big we have run out of neon regs to store ++ @ everything at once so do in pieces ++ ++ @ Up (have) ++ it cs ++ vldmcs r6, { q0-q3 } ++ ldr r12, [sp, #ur_size] ++ it mi ++ vldmmi r5, { q8-q11} ++ it cs ++ vstmcs r1, { q0-q3 } ++ bpl 1f ++ cmp r12, #12 ++ add lr, r1, #(pw << log2_s) ++ bgt 2f ++ cmp r12, #8 ++ bge 3f ++ vdup.16 q9, d17[1] ++4: vdup.16 d10, d19[1] ++3: vdup.16 q11, d21[1] ++2: vstm lr, { q8-q11} ++1: ++ ++ @ Left (have) ++ add lr, r0, #-pw ++ lsls r12, r7, #AVAIL_S_L_N_DL_C ++ vst1.32 {d30[1]}, [lr] @ UL ++ bpl 1f ++ vld1.32 { d0[0]}, [r10], r9 ++ vld1.32 { d0[1]}, [r3], r9 ++ vld1.32 { d1[0]}, [r10], r9 ++ vld1.32 { d1[1]}, [r3], r9 ++ vld1.32 { d2[0]}, [r10], r9 ++ vld1.32 { d2[1]}, [r3], r9 ++ vld1.32 { d3[0]}, [r10], r9 ++ vld1.32 { d3[1]}, [r3], r9 ++ vld1.32 { d4[0]}, [r10], r9 ++ vld1.32 { d4[1]}, [r3], r9 ++ vld1.32 { d5[0]}, [r10], r9 ++ vld1.32 { d5[1]}, [r3], r9 ++ vld1.32 { d6[0]}, [r10], r9 ++ vld1.32 { d6[1]}, [r3], r9 ++ vld1.32 { d7[0]}, [r10] ++ vld1.32 { d7[1]}, [r3] ++ vstm r0, { q0-q3 } ++1: ++ bcc 1f ++ ldr r12, [sp, #dl_size] ++ vdup.32 d16, d30[0] @ d16[0] = d30[0] ++ add lr, r0, #(pw << log2_s) ++ vld1.32 {d16[1]}, [r4], r9 ++ cmp r12, #4 ++ vld1.32 {d17[0]}, [r8], r9 ++ vld1.32 {d17[1]}, [r4], r9 ++ ble 2f ++ vld1.32 {d18[0]}, [r8], r9 ++ vld1.32 {d18[1]}, [r4], r9 ++ cmp r12, #12 ++ vld1.32 {d19[0]}, [r8], r9 ++ vld1.32 {d19[1]}, [r4], r9 ++ blt 3f ++ vld1.32 {d20[0]}, [r8], r9 ++ vld1.32 {d20[1]}, [r4], r9 ++ vld1.32 {d21[0]}, [r8], r9 ++ vld1.32 {d21[1]}, [r4], r9 ++ ble 4f ++ vld1.32 {d22[0]}, [r8], r9 ++ vld1.32 {d22[1]}, [r4], r9 ++ vld1.32 {d23[0]}, [r8] ++ vld1.32 {d23[1]}, [r4] ++ b 5f ++2: vdup.32 q9, d17[1] ++3: vdup.32 q10, d19[1] ++4: vdup.32 q11, d21[1] ++5: vstm lr, { q8-q11} ++1: ++ eors r7, r2 ++ beq 99f ++ ++ lsls r12, r7, #AVAIL_S_UR_N_U_C ++ vdup.32 q0, d31[0] ++ vdup.32 q1, d31[0] ++ vdup.32 q2, d31[0] ++ vdup.32 q3, d31[0] ++ add lr, r1, #(pw << log2_s) ++ vdup.32 q8, d31[1] ++ vdup.32 q9, d31[1] ++ vdup.32 q10, d31[1] ++ vdup.32 q11, d31[1] ++ it cs ++ vstmcs r1, { q0-q3 } ++ it mi ++ vstmmi lr, { q8-q11} ++ ++ lsls r7, #AVAIL_S_L_N_DL_C ++ vdup.32 q0, d30[0] ++ vdup.32 q1, d30[0] ++ vdup.32 q2, d30[0] ++ vdup.32 q3, d30[0] ++ add lr, r0, #(pw << log2_s) ++ it mi ++ vstmmi r0, { q0-q3 } ++ it cs ++ vstmcs lr, { q0-q3 } ++ ++99: ++ pop {r4-r10, pc} ++endfunc ++ ++ ++ ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcpred_intra_hv_neon.S +@@ -0,0 +1,920 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++/* ++ * Horizontal & Vertical special cases of angular intra pred ++ * ++ * Split out because: ++ * Vertical, at least, is relatively common ++ * Much simpler code than the general angular case ++ * Luma with size < 32 has extra filtering that doesn't happen anywhere else ++ * ++ * *** Currently luma filtering is mandatory where it occurs, but there are ++ * cases where it should be turned off (rdpcm & an extension sps flag). ++ * These don't occur in the standard conformance suite for Main Profile ++ */ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++@ ff_hevc_rpi_pred_vertical_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_4_neon_8, export=1 ++ ldrb ip, [r2, #-1] @ Top-left ++ vld1.32 {d0[0]}, [r2 :32] @ Left ++ add r2, r0, r3 ++ vld1.8 {d1[]}, [r1] ++ lsl r3, #1 ++ vdup.8 d4, ip ++ vmov.i8 d2, #128 ++ vhsub.u8 d4, d0, d4 ++ veor d1, d2 ++ vld1.32 {d0[0]}, [r1 :32] @ Top ++ vqadd.s8 d1, d4 ++ vmov.i64 d3, #0xff ++ vmov d4, d0 ++ veor d5, d1, d2 ++ veor d1, d1, d2 ++ vbit d0, d1, d3 ++ vshr.u64 d5, #8 ++ vst1.32 {d0[0]}, [r0], r3 ++ vshr.u64 d1, #16 ++ vbit d4, d5, d3 ++ vshr.u64 d5, #16 ++ vst1.32 {d4[0]}, [r2], r3 ++ vbit d0, d1, d3 ++ vst1.32 {d0[0]}, [r0] ++ vbit d4, d5, d3 ++ vst1.32 {d4[0]}, [r2] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_8_neon_8, export=1 ++ ldrb ip, [r2, #-1] @ Top-left ++ vld1.8 {d0}, [r2 :64] @ Left ++ vmov.i8 d1, #128 ++ vld1.8 {d2[]}, [r1] ++ vld1.8 {d3}, [r1 :64] @ Top ++ vdup.8 d4, ip ++ vhsub.u8 d4, d0, d4 ++ veor d2, d1 ++ vmov.i64 d0, #0xff ++ mov r1, #8 ++ vqadd.s8 d2, d4, d2 ++ veor d1, d2, d1 ++1: ++ vbit d3, d1, d0 ++ vshr.u64 d1, #8 ++ vst1.8 {d3}, [r0 :64], r3 ++ subs r1, #2 ++ vbit d3, d1, d0 ++ vshr.u64 d1, #8 ++ vst1.8 {d3}, [r0 :64], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_16_neon_8, export=1 ++ ldrb ip, [r2, #-1] @ Top-left ++ vld1.8 {q0}, [r2 :128] @ Left ++ vdup.8 q1, ip ++ vld1.8 {d4[],d5[]}, [r1] ++ vhsub.u8 q0, q1 ++ vmov.i8 q1, #128 ++ veor q2, q1 ++ vmov.i64 d16, #0xff ++ vqadd.s8 q0, q2 ++ vld1.8 {q3}, [r1 :128] @ Top ++ mov r1, #16 ++ veor q0, q1 ++ vmov q1, q3 ++ vext.8 q2, q0, q0, #1 ++1: ++ vbit d2, d0, d16 ++ vbit d6, d4, d16 ++ vext.8 q0, q0, q0, #2 ++ subs r1, #2 ++ vst1.8 {q1}, [r0 :128], r3 ++ vext.8 q2, q2, q2, #2 ++ vst1.8 {q3}, [r0 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vert_32_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_32_neon_8, export=1 ++ vld1.8 {q0, q1 }, [r1 :128] @ Up ++ add r2, r0, r3 ++ lsl r3, #1 ++ mov r1, #16 ++1: ++ vst1.8 {q0, q1 }, [r0 :128], r3 ++ subs r1, #1 ++ vst1.8 {q0, q1 }, [r2 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_c_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_c_4_neon_8, export=1 ++ vld1.16 {d0 }, [r1 :64] @ Up ++ add r2, r0, r3, lsl #1 ++ lsl r3, #2 ++ ++ vst1.16 {d0 }, [r0 :64], r3 ++ vst1.16 {d0 }, [r2 :64], r3 ++ vst1.16 {d0 }, [r0 :64] ++ vst1.16 {d0 }, [r2 :64] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_c_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_c_8_neon_8, export=1 ++ vld1.16 {q0 }, [r1 :128] @ Up ++ add r2, r0, r3, lsl #1 ++ lsl r3, #2 ++ mov r1, #4 ++1: ++ vst1.16 {q0 }, [r0 :128], r3 ++ subs r1, #2 ++ vst1.16 {q0 }, [r2 :128], r3 ++ vst1.16 {q0 }, [r0 :128], r3 ++ vst1.16 {q0 }, [r2 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_c_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_c_16_neon_8, export=1 ++ vld1.16 {q0, q1 }, [r1 :128] @ Up ++ add r2, r0, r3, lsl #1 ++ lsl r3, #2 ++ mov r1, #8 ++1: ++ vst1.16 {q0, q1 }, [r0 :128], r3 ++ subs r1, #1 ++ vst1.16 {q0, q1 }, [r2 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontalal_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++@ ? Might be faster as simple arm ++ ++function ff_hevc_rpi_pred_horizontal_4_neon_8, export=1 ++ ldrb ip, [r2, #-1] @ Top-left ++ vld1.32 {d0[0]}, [r1 :32] @ Top ++ add r1, r2, #3 ++ vld1.8 {d1[]}, [r2]! ++ vdup.8 d2, ip ++ vmov.i8 d3, #128 ++ vhsub.u8 d0, d2 ++ veor d1, d3 ++ vld1.8 {d2[]}, [r2]! ++ add ip, r0, r3 ++ vqadd.s8 d0, d0, d1 ++ lsl r3, #1 ++ vld1.8 {d1[]}, [r2] ++ vld1.8 {d4[]}, [r1] ++ veor d0, d3 ++ vst1.32 {d0[0]}, [r0 :32], r3 ++ vst1.32 {d2[0]}, [ip :32], r3 ++ vst1.32 {d1[0]}, [r0 :32] ++ vst1.32 {d4[0]}, [ip :32] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_8_neon_8, export=1 ++ ldrb ip, [r2, #-1] @ Top-left ++ vld1.8 {d0}, [r1 :64] @ Top ++ vmov.i8 d1, #128 ++ vld1.8 {d2[]}, [r2]! ++ mov r1, #8-2 ++ vdup.8 d3, ip ++ vhsub.u8 d0, d3 ++ veor d2, d1 ++ vqadd.s8 d0, d2 ++ vld1.8 {d2[]}, [r2]! ++ veor d0, d1 ++ vst1.8 {d0}, [r0], r3 ++1: ++ vld1.8 {d0[]}, [r2]! ++ subs r1, #2 ++ vst1.8 {d2}, [r0 :64], r3 ++ vld1.8 {d2[]}, [r2]! ++ vst1.8 {d0}, [r0 :64], r3 ++ bne 1b ++ ++ vst1.8 {d2}, [r0 :64] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_16_neon_8, export=1 ++ ldrb ip, [r2, #-1] @ Top-left ++ vld1.8 {q0}, [r1 :64] @ Top ++ mov r1, #16-2 ++ vld1.8 {d4[],d5[]}, [r2]! ++ vdup.8 q3, ip ++ vhsub.u8 q0, q3 ++ vmov.i8 q1, #128 ++ veor q2, q1 ++ vqadd.s8 q0, q2 ++ vld1.8 {d4[],d5[]}, [r2]! ++ veor q0, q1 ++ vst1.8 {q0}, [r0], r3 ++1: ++ vld1.8 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.8 {q2}, [r0 :64], r3 ++ vld1.8 {d4[],d5[]}, [r2]! ++ vst1.8 {q0}, [r0 :64], r3 ++ bne 1b ++ ++ vst1.8 {q2}, [r0 :64] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_32_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_32_neon_8, export=1 ++ vld1.8 {d0[],d1[]}, [r2]! ++ add ip, r0, #16 ++ mov r1, #32-2 ++ vld1.8 {d2[],d3[]}, [r2]! ++ vst1.8 {q0}, [r0 :128], r3 ++ vst1.8 {q0}, [ip :128], r3 ++1: ++ vld1.8 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.8 {q1}, [r0 :128], r3 ++ vst1.8 {q1}, [ip :128], r3 ++ vld1.8 {d2[],d3[]}, [r2]! ++ vst1.8 {q0}, [r0 :128], r3 ++ vst1.8 {q0}, [ip :128], r3 ++ bne 1b ++ ++ vst1.8 {q1}, [r0 :128] ++ vst1.8 {q1}, [ip :128] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_c_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_c_4_neon_8, export=1 ++ add r1, r2, #2 ++ vld1.16 {d0[]}, [r2] ++ add r2, #4 ++ vld1.16 {d1[]}, [r1] ++ add r1, #4 ++ vld1.16 {d2[]}, [r2] ++A add r2, r0, r3, lsl #1 ++T lsl r3, #1 ++T add r2, r0, r3 ++ vld1.16 {d3[]}, [r1] ++A lsl r3, #2 ++T lsl r3, #1 ++ vst1.16 {d0}, [r0 :64], r3 ++ vst1.16 {d1}, [r2 :64], r3 ++ vst1.16 {d2}, [r0 :64] ++ vst1.16 {d3}, [r2 :64] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_c_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_c_8_neon_8, export=1 ++ vld1.16 {d0[],d1[]}, [r2]! ++ lsl r3, #1 ++ vld1.16 {d2[],d3[]}, [r2]! ++ mov r1, #8-2 ++ vst1.16 {q0}, [r0 :64], r3 ++1: ++ vld1.16 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.16 {q1}, [r0 :64], r3 ++ vld1.16 {d2[],d3[]}, [r2]! ++ vst1.16 {q0}, [r0 :64], r3 ++ bne 1b ++ ++ vst1.16 {q1}, [r0 :64] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_c_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_c_16_neon_8, export=1 ++ vld1.16 {d0[],d1[]}, [r2]! ++ lsl r3, #1 ++ add ip, r0, #16 ++ mov r1, #16-2 ++ vld1.16 {d2[],d3[]}, [r2]! ++ vst1.16 {q0}, [r0 :128], r3 ++ vst1.16 {q0}, [ip :128], r3 ++1: ++ vld1.16 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.16 {q1}, [r0 :128], r3 ++ vst1.16 {q1}, [ip :128], r3 ++ vld1.16 {d2[],d3[]}, [r2]! ++ vst1.16 {q0}, [r0 :128], r3 ++ vst1.16 {q0}, [ip :128], r3 ++ bne 1b ++ ++ vst1.16 {q1}, [r0 :128] ++ vst1.16 {q1}, [ip :128] ++ bx lr ++endfunc ++ ++ ++@------------------------------------------------------------------------------ ++@ ++@ 10 Bit ++@ Has clipping constants so 10-bit only but could easily be macroed up to ++@ 14-bit before we run out of bits ++ ++ ++@ ff_hevc_rpi_pred_vertical_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_4_neon_10, export=1 ++ ldrh ip, [r2, #-2] @ Top-left ++ vld1.16 {d0}, [r2 :64] @ Left ++ vmov.i16 d2, #0 ++ vld1.16 {d1[]}, [r1] ++T lsl r3, #1 ++ vdup.16 d4, ip ++ vmov.i16 d3, #0x3ff ++ vld1.16 {d5}, [r1 :64] @ Top ++ vhsub.u16 d4, d0, d4 ++ vmov.i64 d0, #0xffff ++A add r2, r0, r3, lsl #1 ++T add r2, r0, r3 ++ vadd.i16 d1, d1, d4 ++ vmov d6, d5 ++ vmax.s16 d1, d1, d2 ++ vmin.s16 d2, d1, d3 ++ vmin.s16 d1, d1, d3 ++ vbit d5, d1, d0 ++A lsl r3, #2 ++T lsl r3, #1 ++ vshr.u64 d2, #16 ++ vshr.u64 d1, #32 ++ vbit d6, d2, d0 ++ vst1.16 {d5}, [r0], r3 ++ vshr.u64 d2, #32 ++ vst1.16 {d6}, [r2], r3 ++ vbit d5, d1, d0 ++ vst1.16 {d5}, [r0] ++ vbit d6, d2, d0 ++ vst1.16 {d6}, [r2] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_8_neon_10, export=1 ++ ldrh ip, [r2, #-2] @ Top-left ++ vld1.16 {q0}, [r2 :128] @ Left ++ lsl r3, #1 ++ vdup.16 q1, ip ++ vld1.16 {d4[],d5[]}, [r1] ++ vhsub.u16 q0, q0, q1 ++ vmov.i16 q1, #0 ++ vadd.i16 q0, q2 ++ vmov.i16 q2, #0x3ff ++ vld1.16 {q3}, [r1 :128] @ Top ++ mov r1, #8 ++ vmax.s16 q0, q1 ++ vmov q1, q3 ++ vmin.s16 q0, q2 ++ vmov.i64 d16, #0xffff ++ vext.16 q2, q0, q0, #1 ++1: ++ vbit d2, d0, d16 ++ vbit d6, d4, d16 ++ vext.16 q0, q0, q0, #2 ++ subs r1, #2 ++ vst1.16 {q1}, [r0 :128], r3 ++ vext.16 q2, q2, q2, #2 ++ vst1.16 {q3}, [r0 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_16_neon_10, export=1 ++ ldrh ip, [r2, #-2] @ Top-left ++ vld1.16 {q0-q1}, [r2 :128] @ Left ++T lsl r3, #1 ++ vdup.16 q2, ip ++A add r2, r0, r3, lsl #1 ++T add r2, r0, r3 ++ vld1.16 {d6[],d7[]}, [r1] ++A lsl r3, #2 ++T lsl r3, #1 ++ vhsub.u16 q0, q2 ++ vhsub.u16 q1, q2 ++ vadd.i16 q0, q3 ++ vadd.i16 q1, q3 ++ vmov.i16 q2, #0 ++ vld1.16 {q8-q9}, [r1 :128] @ Top ++ mov r1, #0 ++ vmov.i16 q3, #0x3ff ++ vmax.s16 q0, q2 ++ vmax.s16 q1, q2 ++ vmin.s16 q0, q3 ++ vmin.s16 q1, q3 ++ vmov q10, q8 ++ vmov q11, q9 ++ vext.16 q2, q0, q1, #1 ++ vext.16 q3, q1, q1, #1 ++ vmov.i64 d24, #0xffff ++1: ++ vbit d16, d0, d24 ++ vbit d20, d4, d24 ++ vext.16 q0, q0, q0, #2 ++ subs r1, #1<<30 ++ vst1.16 {q8-q9}, [r0 :128], r3 ++ vext.16 q2, q2, q2, #2 ++ vst1.16 {q10-q11}, [r2 :128], r3 ++ bne 1b ++1: ++ vbit d16, d2, d24 ++ vbit d20, d6, d24 ++ vext.16 q1, q1, q1, #2 ++ subs r1, #1<<30 ++ vst1.16 {q8-q9}, [r0 :128], r3 ++ vext.16 q3, q3, q3, #2 ++ vst1.16 {q10-q11}, [r2 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_32_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_32_neon_10, export=1 ++ vldm r1, { q0-q3 } @ Up ++ lsl r3, #1 ++ mov r1, #32 ++ add r2, r0, #32 ++1: ++ vst1.16 {q0-q1}, [r0 :128], r3 ++ subs r1, #1 ++ vst1.16 {q2-q3}, [r2 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_c_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_c_4_neon_10, export=1 ++ vld1.16 {q0 }, [r1 :128] @ Up ++ add r2, r0, r3, lsl #2 ++ lsl r3, #3 ++ ++ vst1.16 {q0 }, [r0 :128], r3 ++ vst1.16 {q0 }, [r2 :128], r3 ++ vst1.16 {q0 }, [r0 :128] ++ vst1.16 {q0 }, [r2 :128] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_c_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_c_8_neon_10, export=1 ++ vld1.16 {q0, q1 }, [r1 :128] @ Up ++ add r2, r0, r3, lsl #2 ++ lsl r3, #3 ++ mov r1, #4 ++1: ++ vst1.16 {q0, q1 }, [r0 :128], r3 ++ subs r1, #1 ++ vst1.16 {q0, q1 }, [r2 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_vertical_c_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_vertical_c_16_neon_10, export=1 ++ vldm r1, { q0-q3 } @ Up ++ lsl r3, #2 ++ mov r1, #16 ++ add r2, r0, #32 ++1: ++ vst1.16 {q0-q1}, [r0 :128], r3 ++ subs r1, #1 ++ vst1.16 {q2-q3}, [r2 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++@ ff_hevc_rpi_pred_horizontal_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_4_neon_10, export=1 ++ ldrh ip, [r2, #-2] @ Top-left ++ vld1.16 {d0}, [r1 :64] @ Top ++ vmov.i16 d1, #0 ++ vld1.16 {d2[]}, [r2]! ++T lsl r3, #1 ++ vdup.16 d3, ip ++ vmov.i16 d4, #0x3ff ++ vhsub.u16 d0, d3 ++A add ip, r0, r3, lsl #1 ++T add ip, r0, r3 ++ vld1.16 {d3[]}, [r2]! ++A lsl r3, #2 ++T lsl r3, #1 ++ vadd.i16 d0, d2 ++ vld1.16 {d2[]}, [r2]! ++ vmax.s16 d0, d1 ++ vld1.16 {d1[]}, [r2] ++ vmin.s16 d0, d4 ++ vst1.16 {d0}, [r0 :64], r3 ++ vst1.16 {d3}, [ip :64], r3 ++ vst1.16 {d2}, [r0 :64] ++ vst1.16 {d1}, [ip :64] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_8_neon_10, export=1 ++ ldrh ip, [r2, #-2] @ Top-left ++ vld1.16 {q0}, [r1 :128] @ Top ++ lsl r3, #1 ++ vdup.16 q1, ip ++ mov r1, #8-2 ++ vhsub.u16 q0, q1 ++ vld1.16 {d2[],d3[]}, [r2]! ++ vmov.i16 q2, #0 ++ vadd.i16 q0, q1 ++ vmov.i16 q1, #0x3ff ++ vmax.s16 q0, q2 ++ vld1.16 {d4[],d5[]}, [r2]! ++ vmin.s16 q0, q1 ++ vst1.16 {q0}, [r0 :128], r3 ++1: ++ vld1.16 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.16 {q2}, [r0 :128], r3 ++ vld1.16 {d4[],d5[]}, [r2]! ++ vst1.16 {q0}, [r0 :128], r3 ++ bne 1b ++ ++ vst1.16 {q2}, [r0 :128] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontalal_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_16_neon_10, export=1 ++ ldrh ip, [r2, #-2] @ Top-left ++ vld1.16 {q0-q1}, [r1 :128] @ Top ++ lsl r3, #1 ++ vdup.16 q2, ip ++ add ip, r0, r3 ++ vhsub.u16 q0, q2 ++ add ip, #16 ++ vhsub.u16 q1, q2 ++ mov r1, #16-2 ++ vld1.16 {d4[],d5[]}, [r2]! ++ vmov.i16 q3, #0 ++ vadd.u16 q0, q2 ++ vadd.i16 q1, q2 ++ vmov.i16 q2, #0x3ff ++ vmax.s16 q0, q3 ++ vmax.s16 q1, q3 ++ vld1.16 {d6[],d7[]}, [r2]! ++ vmin.s16 q0, q2 ++ vmin.s16 q1, q2 ++ vst1.16 {q0-q1}, [r0 :128], r3 ++1: ++ vld1.16 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.16 {q3}, [r0 :128], r3 ++ vst1.16 {q3}, [ip :128], r3 ++ vld1.16 {d6[],d7[]}, [r2]! ++ vst1.16 {q0}, [r0 :128], r3 ++ vst1.16 {q0}, [ip :128], r3 ++ bne 1b ++ ++ vst1.16 {q3}, [r0 :128] ++ vst1.16 {q3}, [ip :128] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_32_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_32_neon_10, export=1 ++ vld1.16 {d0[],d1[]}, [r2]! ++ add ip, r0, #16 ++ push {lr} ++ mov lr, #32 ++ vld1.16 {d2[],d3[]}, [r2]! ++ lsl r3, #1 ++ vst1.16 {q0}, [r0 :128], lr ++ sub r3, #32 ++ vst1.16 {q0}, [ip :128], lr ++ mov r1, #32-2 ++ vst1.16 {q0}, [r0 :128], r3 ++ vst1.16 {q0}, [ip :128], r3 ++1: ++ vld1.16 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.16 {q1}, [r0 :128], lr ++ vst1.16 {q1}, [ip :128], lr ++ vst1.16 {q1}, [r0 :128], r3 ++ vst1.16 {q1}, [ip :128], r3 ++ vld1.16 {d2[],d3[]}, [r2]! ++ vst1.16 {q0}, [r0 :128], lr ++ vst1.16 {q0}, [ip :128], lr ++ vst1.16 {q0}, [r0 :128], r3 ++ vst1.16 {q0}, [ip :128], r3 ++ bne 1b ++ ++ vst1.16 {q1}, [r0 :128], lr ++ vst1.16 {q1}, [ip :128], lr ++ vst1.16 {q1}, [r0 :128] ++ vst1.16 {q1}, [ip :128] ++ pop {pc} ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_c_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_c_4_neon_10, export=1 ++ add r1, r2, #4 ++ vld1.32 {d0[],d1[]}, [r2] ++ add r2, #8 ++ vld1.32 {d2[],d3[]}, [r1] ++ add r1, #8 ++ vld1.32 {d4[],d5[]}, [r2] ++A add r2, r0, r3, lsl #2 ++T lsl r3, #2 ++T add r2, r0, r3 ++ vld1.32 {d6[],d7[]}, [r1] ++A lsl r3, #3 ++T lsl r3, #1 ++ vst1.32 {q0}, [r0 :128], r3 ++ vst1.32 {q1}, [r2 :128], r3 ++ vst1.32 {q2}, [r0 :128] ++ vst1.32 {q3}, [r2 :128] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_c_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_c_8_neon_10, export=1 ++ vld1.32 {d0[],d1[]}, [r2]! ++ lsl r3, #2 ++ add ip, r0, #16 ++ mov r1, #8-2 ++ vld1.32 {d2[],d3[]}, [r2]! ++ vst1.32 {q0}, [r0 :128], r3 ++ vst1.32 {q0}, [ip :128], r3 ++1: ++ vld1.32 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.32 {q1}, [r0 :128], r3 ++ vst1.32 {q1}, [ip :128], r3 ++ vld1.32 {d2[],d3[]}, [r2]! ++ vst1.32 {q0}, [r0 :128], r3 ++ vst1.32 {q0}, [ip :128], r3 ++ bne 1b ++ ++ vst1.32 {q1}, [r0 :128] ++ vst1.32 {q1}, [ip :128] ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_horizontal_c_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_horizontal_c_16_neon_10, export=1 ++ vld1.32 {d0[],d1[]}, [r2]! ++ add ip, r0, #16 ++ push {lr} ++ mov lr, #32 ++ vld1.32 {d2[],d3[]}, [r2]! ++ lsl r3, #2 ++ vst1.32 {q0}, [r0 :128], lr ++ sub r3, #32 ++ vst1.32 {q0}, [ip :128], lr ++ mov r1, #16-2 ++ vst1.32 {q0}, [r0 :128], r3 ++ vst1.32 {q0}, [ip :128], r3 ++1: ++ vld1.32 {d0[],d1[]}, [r2]! ++ subs r1, #2 ++ vst1.32 {q1}, [r0 :128], lr ++ vst1.32 {q1}, [ip :128], lr ++ vst1.32 {q1}, [r0 :128], r3 ++ vst1.32 {q1}, [ip :128], r3 ++ vld1.32 {d2[],d3[]}, [r2]! ++ vst1.32 {q0}, [r0 :128], lr ++ vst1.32 {q0}, [ip :128], lr ++ vst1.32 {q0}, [r0 :128], r3 ++ vst1.32 {q0}, [ip :128], r3 ++ bne 1b ++ ++ vst1.32 {q1}, [r0 :128], lr ++ vst1.32 {q1}, [ip :128], lr ++ vst1.32 {q1}, [r0 :128] ++ vst1.32 {q1}, [ip :128] ++ pop {pc} ++endfunc ++ ++ ++ +--- /dev/null ++++ b/libavcodec/arm/rpi_hevcpred_intra_planar_neon.S +@@ -0,0 +1,1043 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++#include "libavutil/arm/asm.S" ++#include "neon.S" ++ ++@ Planar intra pred (8.4.4.2.4) ++@ ++@ predSamples[ x ][ y ] = ++@ ( ( nTbS - 1 - x ) * p[ -1 ][ y ] + ++@ ( x + 1 ) * p[ nTbS ][ -1 ] + ++@ ( nTbS - 1 - y ) * p[ x ][ -1 ] + ++@ ( y + 1 ) * p[ -1 ][ nTbS ] + nTbS ) >> ( Log2( nTbS ) + 1 ) ++ ++@ All 10-bit functions would work with 9 ++ ++ ++@ ff_hevc_rpi_pred_planar_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_4_neon_8, export=1 ++ ++ vld1.8 {d0}, [r1] @ Top ++ adr ip, nb_3_0_1_4 ++ vld1.8 {d1}, [r2] @ Left ++ vmov.i64 d2, #0xffffffff ++ vldr d3, [ip, #8] @ {1,2,3,4,1,2,3,4} ++ add r1, r0, r3 ++ vdup.32 d4, d0[0] @ {t0,t1,t2,t3,t0,t1,t2,t3} ++ vdup.8 d0, d0[4] @ {t4,t4,t4,t4,t4,t4,t4,t4} ++ vdup.8 d5, d1[4] @ {l4,l4,l4,l4,l4,l4,l4,l4} ++ vdup.8 d6, d1[0] @ {l0,l0,l0,l0,l0,l0,l0,l0} ++ vshll.u8 q8, d4, #2 ++ lsl r3, #1 ++ vsubl.u8 q2, d5, d4 ++ vmlal.u8 q8, d0, d3 ++ vld1.8 {d0}, [ip] @ {3,2,1,0,3,2,1,0} ++ vdup.8 d7, d1[1] @ {l1,l1,l1,l1,l1,l1,l1,l1} ++ vshl.s16 q9, q2, #1 ++ vbif d6, d7, d2 @ {l0,l0,l0,l0,l1,l1,l1,l1} ++ vadd.i16 d16, d4 ++ vdup.8 d7, d1[2] @ {l2,l2,l2,l2,l2,l2,l2,l2} ++ vadd.i16 d17, d18 ++ vdup.8 d1, d1[3] @ {l3,l3,l3,l3,l3,l3,l3,l3} ++ vadd.i16 q2, q8, q9 ++ vmlal.u8 q8, d0, d6 ++ vbif d7, d1, d2 @ {l2,l2,l2,l2,l3,l3,l3,l3} ++ vmlal.u8 q2, d0, d7 ++ vrshrn.i16 d0, q8, #3 ++ vst1.32 d0[0], [r0 :32], r3 ++ vst1.32 d0[1], [r1 :32], r3 ++ vrshrn.i16 d0, q2, #3 ++ vst1.32 d0[0], [r0 :32] ++ vst1.32 d0[1], [r1 :32] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_4_neon_10, export=1 ++ @ Load from bytes & expand later - at the very least this uses less ++ @ memory than having a short table ++ vld1.16 {q0}, [r1 :64] @ Top ++ adr ip, nbh_3_0_1_4 ++ vldr d2, [r2, #8] @ Left (lower) ++ vldr d3, [ip, #8] @ {1,2,3,4} ++T lsl r3, #1 ++ vshl.s16 d4, d0, #2 ++ vdup.16 d1, d1[0] @ {t4,t4,t4,t4} ++ vldr d5, [r2] @ Left (upper) ++ vdup.16 d2, d2[0] @ {l4,l4,l4,l4} ++ vldr d6, [ip] @ {3,2,1,0} ++ vmla.i16 d4, d3, d1 @ Acc set up ++ vsub.i16 d0, d2, d0 @ Add set up ++ vmov d7, d6 ++ vdup.16 d2, d5[0] ++ vdup.16 d3, d5[1] ++ vdup.16 d16, d5[2] ++ vadd.i16 d18, d0, d4 ++ vshl.s16 d0, #1 @ x2 ++ vadd.i16 d19, d0, d4 ++ vdup.16 d17, d5[3] ++ vadd.i16 d4, d0, d18 ++A add r1, r0, r3, lsl #1 ++T add r1, r0, r3 ++ vadd.i16 d5, d0, d19 ++A lsl r3, #2 ++T lsl r3, #1 ++ vmla.i16 q9, q1, q3 ++ vmla.i16 q2, q8, q3 ++ vrshr.u16 q0, q9, #3 ++ vst1.16 {d0}, [r0], r3 ++ vrshr.u16 d2, d4, #3 ++ vst1.16 {d1}, [r1], r3 ++ vrshr.u16 d3, d5, #3 ++ vst1.16 {d2}, [r0] ++ vst1.16 {d3}, [r1] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_8_neon_8, export=1 ++ ++ vld1.8 {q0}, [r1] @ Top ++ adr ip, nb_7_0_1_8 ++ vldr d2, [r2, #8] @ Left (lower) ++ mov r1, #8 ++ vldr d3, [ip, #8] @ {1,2,3,4,5,6,7,8} ++ vshll.u8 q2, d0, #3 ++ vdup.8 d1, d1[0] @ {t8,t8,t8,t8,t8,t8,t8,t8} ++ vdup.8 d2, d2[0] @ {l8,l8,l8,l8,l8,l8,l8,l8} ++ vldr d6, [r2] @ Left (upper) ++ vmlal.u8 q2, d3, d1 ++ vsubl.u8 q0, d2, d0 ++ vldr d7, [ip] @ {7,6,5,4,3,2,1,0} ++ ++@ u8 7..0 [1] d7 ++@ u8 left[y] [1] d6 ++@ u16 acc [2] q2 (even rows) or q8 (odd rows) = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [2] q0 = p[-1][nTbs] - p[x][-1] ++ ++ vdup.8 d2, d6[0] ++ vadd.i16 q2, q0 ++ vdup.8 d3, d6[1] ++ vadd.i16 q8, q2, q0 ++1: ++ vmlal.u8 q2, d7, d2 ++ subs r1, #2 ++ vadd.i16 q9, q8, q0 ++ vmlal.u8 q8, d7, d3 ++ vdup.8 d2, d6[2] ++ vdup.8 d3, d6[3] ++ vrshrn.i16 d20, q2, #4 ++ vshr.u64 d6, #16 ++ vmov q2, q9 ++ vst1.8 {d20}, [r0], r3 ++ vrshrn.i16 d20, q8, #4 ++ vadd.i16 q8, q2, q0 ++ vst1.8 {d20}, [r0], r3 ++ bne 1b ++ ++ bx lr ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_8_neon_10, export=1 ++ ++ adr ip, nb_7_0_1_8 ++ vld1.16 {q0}, [r1 :128]! @ Top (left) ++ lsl r3, #1 ++ vld1.16 {q1}, [ip :128] @ {7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8} ++ add ip, r2, #16 ++ vld1.16 {d4[],d5[]}, [r1] @ Top (right) ++ mov r1, #8-2 ++ vshl.s16 q3, q0, #3 ++ vmovl.u8 q8, d3 @ {1,2,3,4,5,6,7,8} ++ vld1.16 {d18[],d19[]}, [ip] @ Left (lower) ++ vmla.i16 q3, q8, q2 @ Acc set up ++ vsub.i16 q0, q9, q0 @ Add set up ++ vmovl.u8 q1, d2 @ {7,6,5,4,3,2,1,0} ++ vadd.i16 q2, q3, q0 ++ ++@ u16 7..0 [1] q1 ++@ u32 left[y] [1] [r2] ++@ u16 acc [1] q3 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [1] q0 = p[-1][nTbs] - p[x][-1] ++ ++ vld1.16 {d6[],d7[]}, [r2]! ++ vadd.i16 q8, q2, q0 ++ vld1.16 {d18[],d19[]}, [r2]! ++ vmla.i16 q2, q1, q3 ++ vadd.i16 q3, q8, q0 ++ vmla.i16 q8, q1, q9 ++1: ++ vrshr.u16 q9, q2, #4 ++ subs r1, #2 ++ vmov q2, q3 ++ vrshr.u16 q10, q8, #4 ++ vld1.16 {d6[],d7[]}, [r2]! ++ vst1.16 {q9}, [r0 :128], r3 ++ vadd.i16 q8, q2, q0 ++ vld1.16 {d18[],d19[]}, [r2]! ++ vmla.i16 q2, q1, q3 ++ vadd.i16 q3, q8, q0 ++ vmla.i16 q8, q1, q9 ++ vst1.16 {q10}, [r0 :128], r3 ++ bne 1b ++ ++ vrshr.u16 q9, q2, #4 ++ add r3, r0 ++ vrshr.u16 q10, q8, #4 ++ vst1.16 {q9}, [r0 :128] ++ vst1.16 {q10}, [r3 :128] ++ ++ bx lr ++endfunc ++ ++ ++@------------------------------------------------------------------------------ ++@ ++@ Data - has to be in two lumps to ensure we can always reach using adr ++ ++ .balign 64 ++ ++nb_31_0_1_32: ++ .byte 31, 30, 29, 28, 27, 26, 25, 24 ++ .byte 23, 22, 21, 20, 19, 18, 17, 16 ++nb_15_0_1_16: ++ .byte 15, 14, 13, 12, 11, 10, 9, 8 ++ .byte 7, 6, 5, 4, 3, 2, 1, 0 ++ .byte 1, 2, 3, 4, 5, 6, 7, 8 ++ .byte 9, 10, 11, 12, 13, 14, 15, 16 ++ .byte 17, 18, 19, 20, 21, 22, 23, 24 ++ .byte 25, 26, 27, 28, 29, 30, 31, 32 ++ ++ @ should be back on a 64-byte boundary here ++ ++ @ These could be extracted from the above array, but separate out ++ @ out for better (16 byte) alignment ++nb_3_0_1_4: ++ .byte 3, 2, 1, 0, 3, 2, 1, 0 ++ .byte 1, 2, 3, 4, 1, 2, 3, 4 ++nb_7_0_1_8: ++ .byte 7, 6, 5, 4, 3, 2, 1, 0 ++ .byte 1, 2, 3, 4, 5, 6, 7, 8 ++nbh_3_0_1_4: ++ .short 3, 2, 1, 0, 1, 2, 3, 4 ++ ++@------------------------------------------------------------------------------ ++ ++ ++@ ff_hevc_rpi_pred_planar_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_16_neon_8, export=1 ++ ++ adr ip, nb_15_0_1_16 + 16 ++ vld1.8 {q0}, [r1 :128]! @ Top (left) ++ add r2, #16 ++ vld1.8 {q1}, [ip: 128] @ {1,2,3...16} ++ vld1.8 {d4[]}, [r1] @ Top (right) ++ sub ip, #16 ++ vshll.u8 q3, d0, #4 ++ mov r1, #16 ++ vshll.u8 q8, d1, #4 ++ vld1.8 {d5[]}, [r2] @ Left (lower) ++ sub r2, #16 ++ vmlal.u8 q3, d2, d4 ++ vmlal.u8 q8, d3, d4 @ Acc set up ++ vsubl.u8 q1, d5, d0 ++ vsubl.u8 q0, d5, d1 @ Add set up ++ vld1.8 {q2}, [ip :128] @ {15,14,13...0} ++ ++@ u8 15..0 [1] q2 ++@ u8 left[y] [1] [r2] ++@ u16 acc [2] q3,q8 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [2] q1,q0 = p[-1][nTbs] - p[x][-1] ++ ++ vadd.i16 q3, q1 ++ vadd.i16 q8, q0 ++1: ++ vadd.i16 q10, q3, q1 ++ subs r1, #2 ++ vld1.8 {d18[]}, [r2]! ++ vadd.i16 q11, q8, q0 ++ vld1.8 {d19[]}, [r2]! ++ vmlal.u8 q3, d4, d18 ++ vmlal.u8 q8, d5, d18 ++ vadd.i16 q12, q10, q1 ++ vmlal.u8 q10, d4, d19 ++ vadd.i16 q13, q11, q0 ++ vmlal.u8 q11, d5, d19 ++ vrshrn.u16 d18, q3, #5 ++ vrshrn.u16 d19, q8, #5 ++ vmov q3, q12 ++ vst1.8 {q9}, [r0 :128], r3 ++ vrshrn.u16 d18, q10, #5 ++ vrshrn.u16 d19, q11, #5 ++ vmov q8, q13 ++ vst1.8 {q9}, [r0 :128], r3 ++ bne 1b ++ ++ bx lr ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_16_neon_10, export=1 ++ ++ @ Load from bytes & expand later - at the very least this uses less ++ @ memory than having a short table ++ adr ip, nb_15_0_1_16 + 16 ++ vld1.16 {q0-q1}, [r1 :128]! @ Top (left) ++ add r2, #32 ++ vld1.8 {q2}, [ip :128] @ {1,2,3...16} ++ lsl r3, #1 ++ vld1.16 {d6[],d7[]}, [r1] @ Top (right) ++ sub ip, #16 ++ vmovl.u8 q8, d4 ++ mov r1, #16 ++ vshl.i16 q9, q0, #4 ++ vmovl.u8 q2, d5 ++ vshl.i16 q10, q1, #4 ++ vld1.16 {d22[],d23[]}, [r2] @ Left (lower) ++ sub r2, #32 ++ vld1.8 {q12}, [ip] @ {15,14,13...0} ++ vmla.i16 q9, q8, q3 ++ vmla.i16 q10, q2, q3 @ Acc set up ++ vsub.i16 q0, q11, q0 ++ vsub.i16 q1, q11, q1 @ Add set up ++ vadd.i16 q2, q9, q0 ++ vadd.i16 q3, q10, q1 ++ vmovl.u8 q8, d24 ++ vmovl.u8 q9, d25 ++ ++@ u16 15..0 [2] q8,q9 ++@ u32 left[y] [2] [r2] ++@ u16 acc [2] q2,q3 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [2] q0,q1 = p[-1][nTbs] - p[x][-1] ++ ++1: ++ vadd.i16 q10, q2, q0 ++ subs r1, #2 ++ vld1.16 {d24[],d25[]}, [r2]! ++ vadd.i16 q11, q3, q1 ++ vld1.16 {d28[],d29[]}, [r2]! ++ vmla.i16 q2, q8, q12 ++ vmla.i16 q3, q9, q12 ++ vadd.i16 q12, q10, q0 ++ vmla.i16 q10, q8, q14 ++ vadd.i16 q13, q11, q1 ++ vmla.i16 q11, q9, q14 ++ vrshr.u16 q14, q2, #5 ++ vrshr.u16 q15, q3, #5 ++ vmov q2, q12 ++ vst1.16 {q14-q15}, [r0 :128], r3 ++ vrshr.u16 q14, q10, #5 ++ vrshr.u16 q15, q11, #5 ++ vmov q3, q13 ++ vst1.16 {q14-q15}, [r0 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_32_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_32_neon_8, export=1 ++ ++ vld1.8 {q0-q1}, [r1 :128]! @ Top (left) ++ adr ip, nb_31_0_1_32 + 32 ++ vpush {d8-d12} ++ vld1.8 {q2-q3}, [ip :128] @ {1,2,3...32} ++ add r2, #32 ++ vld1.8 {d8[]}, [r1] @ Top (right) ++ sub ip, #32 ++ vshll.u8 q8, d0, #5 ++ mov r1, #32 ++ vld1.8 {d9[]}, [r2] @ Left (lower) ++ sub r2, #32 ++ vshll.u8 q9, d1, #5 ++ vshll.u8 q10, d2, #5 ++ vshll.u8 q11, d3, #5 ++ vmlal.u8 q8, d4, d8 ++ vsubl.u8 q12, d9, d0 ++ vmlal.u8 q9, d5, d8 ++ vsubl.u8 q13, d9, d1 ++ vmlal.u8 q10, d6, d8 ++ vsubl.u8 q14, d9, d2 ++ vmlal.u8 q11, d7, d8 @ Acc set up ++ vsubl.u8 q15, d9, d3 @ Add set up ++ vadd.i16 q8, q12 ++ vadd.i16 q9, q13 ++ vadd.i16 q10, q14 ++ vadd.i16 q11, q15 ++ vld1.8 {q4-q5}, [ip :128] @ {31,30,29...0} ++ ++@ u8 31..0 [2] q4,q5 ++@ u8 left[y] [2] [r2] ++@ u16 acc [4] q8-q11 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [4] q12-q15 = p[-1][nTbs] - p[x][-1] ++ ++ vld1.8 {d12[]}, [r2]! ++ vadd.i16 q0, q8, q12 ++ b 2f ++1: ++ vld1.8 {d12[]}, [r2]! ++ vrshrn.u16 d3, q1, #6 ++ vrshrn.u16 d2, q0, #6 ++ vadd.i16 q0, q8, q12 ++ vrshrn.u16 d4, q2, #6 ++ vrshrn.u16 d5, q3, #6 ++ vst1.8 {q1-q2}, [r0 :128], r3 ++2: vadd.i16 q1, q9, q13 ++ subs r1, #2 ++ vadd.i16 q2, q10, q14 ++ vadd.i16 q3, q11, q15 ++ vmlal.u8 q8, d8, d12 ++ vmlal.u8 q9, d9, d12 ++ vmlal.u8 q10, d10, d12 ++ vmlal.u8 q11, d11, d12 ++ vld1.8 {d12[]}, [r2]! ++ vrshrn.u16 d19, q9, #6 ++ vrshrn.u16 d18, q8, #6 ++ vadd.i16 q8, q0, q12 ++ vrshrn.u16 d20, q10, #6 ++ vrshrn.u16 d21, q11, #6 ++ vst1.8 {q9-q10}, [r0 :128], r3 ++ vadd.i16 q9, q1, q13 ++ vadd.i16 q10, q2, q14 ++ vadd.i16 q11, q3, q15 ++ vmlal.u8 q0, d8, d12 ++ vmlal.u8 q1, d9, d12 ++ vmlal.u8 q2, d10, d12 ++ vmlal.u8 q3, d11, d12 ++ ++ bne 1b ++ ++ vpop {d8-d12} ++ ++ vrshrn.u16 d3, q1, #6 ++ vrshrn.u16 d2, q0, #6 ++ vrshrn.u16 d4, q2, #6 ++ vrshrn.u16 d5, q3, #6 ++ vst1.8 {q1-q2}, [r0 :128] ++ ++ bx lr ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_32_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_32_neon_10, export=1 ++ ++ @ Load from bytes & expand later - at the very least this uses less ++ @ memory than having a short table ++ vld1.16 {q0-q1}, [r1 :128]! @ Top (left) ++ adr ip, nb_31_0_1_32 + 32 ++ vpush {q4-q7} ++ vld1.16 {q2-q3}, [r1 :128]! @ Top (centre) ++ add r2, #64 ++ vld1.8 {q14-q15}, [ip :128] @ {1,2,3...32} ++T lsl r3, #1 ++ vld1.16 {d8[],d9[]}, [r1] @ Top (right) ++ sub ip, #32 ++ vmovl.u8 q12, d28 ++ mov r1, #32 ++ vmovl.u8 q13, d29 ++ vld1.8 {q6-q7}, [ip :128] @ {31,30,29...0} ++ vmovl.u8 q14, d30 ++ vmovl.u8 q15, d31 ++ vld1.16 {d10[],d11[]}, [r2] @ Left (lower) ++ sub r2, #64 ++ vshl.i16 q8, q0, #5 ++ vshl.i16 q9, q1, #5 ++ vshl.i16 q10, q2, #5 ++ vshl.i16 q11, q3, #5 ++ vmla.i16 q8, q12, q4 ++ vsub.i16 q0, q5, q0 ++ vmla.i16 q9, q13, q4 ++ vsub.i16 q1, q5, q1 ++ vmla.i16 q10, q14, q4 ++ vmov.u16 ip, d0[0] ++ vsub.i16 q2, q5, q2 ++ vmla.i16 q11, q15, q4 @ Acc set up ++ vsub.i16 q3, q5, q3 @ Add set up ++ vadd.i16 q8, q0 ++ vadd.i16 q9, q1 ++ vadd.i16 q10, q2 ++ vadd.i16 q11, q3 ++ vmovl.u8 q4, d12 ++ vmovl.u8 q5, d13 ++ vmovl.u8 q6, d14 ++ vmovl.u8 q7, d15 ++ ++@ u16 31..0 [4] q4-q7 ++@ u16 left[y] [4] [r2] ++@ u16 acc [4] q8-q11 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [4] q0-q3 = p[-1][nTbs] - p[x][-1] ++ ++ vadd.i16 q12, q8, q0 ++A sub r0, r0, r3, lsl #1 ++T sub r0, r3 ++1: ++ vld1.16 {d0[0]}, [r2]! ++A add r0, r0, r3, lsl #1 ++T add r0, r3 ++ vadd.i16 q13, q9, q1 ++ subs r1, #2 ++ vadd.i16 q14, q10, q2 ++ vadd.i16 q15, q11, q3 ++ vmla.i16 q8, q4, d0[0] ++ vmla.i16 q9, q5, d0[0] ++ vmla.i16 q10, q6, d0[0] ++ vmla.i16 q11, q7, d0[0] ++ vmov.16 d0[0], ip ++ vrshr.u16 q8, #6 ++ vrshr.u16 q9, #6 ++ vrshr.u16 q10, #6 ++ vrshr.u16 q11, #6 ++ vstm r0, {q8-q11} ++ vadd.i16 q8, q12, q0 ++A add r0, r0, r3, lsl #1 ++T add r0, r3 ++ vld1.16 {d0[0]}, [r2]! ++ vadd.i16 q9, q13, q1 ++ vadd.i16 q10, q14, q2 ++ vadd.i16 q11, q15, q3 ++ vmla.i16 q12, q4, d0[0] ++ vmla.i16 q13, q5, d0[0] ++ vmla.i16 q14, q6, d0[0] ++ vmla.i16 q15, q7, d0[0] ++ vmov.16 d0[0], ip ++ vrshr.u16 q12, #6 ++ vrshr.u16 q13, #6 ++ vrshr.u16 q14, #6 ++ vrshr.u16 q15, #6 ++ vstm r0, {q12-q15} ++ vadd.i16 q12, q8, q0 ++ bne 1b ++ ++ vpop {q4-q7} ++ bx lr ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_c_4_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_c_4_neon_8, export=1 ++ ++ vld1.8 {q0}, [r1] @ Top ++ adr ip, nbx2_3_0_1_4 ++ vldr d2, [r2, #8] @ Left (lower) ++ mov r1, #4 ++ vldr d3, [ip, #8] @ {1,1,2,2,3,3,4,4} ++ lsl r3, #1 ++ vshll.u8 q2, d0, #2 ++ vdup.16 d1, d1[0] @ {t4,t4,t4,t4,t4,t4,t4,t4} ++ vdup.16 d2, d2[0] @ {l4,l4,l4,l4,l4,l4,l4,l4} ++ vldr d6, [r2] @ Left (upper) ++ vmlal.u8 q2, d3, d1 ++ vsubl.u8 q0, d2, d0 ++ vldr d7, [ip] @ {3,3,2,2,1,1,0,0} ++ ++@ u8 3..0 [1] d7 ++@ u8 left[y] [1] d6 ++@ u16 acc [2] q2 (even rows) or q8 (odd rows) = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [2] q0 = p[-1][nTbs] - p[x][-1] ++ ++ vdup.16 d2, d6[0] ++ vadd.i16 q2, q0 ++ vdup.16 d3, d6[1] ++ vadd.i16 q8, q2, q0 ++1: ++ vmlal.u8 q2, d7, d2 ++ subs r1, #2 ++ vadd.i16 q9, q8, q0 ++ vmlal.u8 q8, d7, d3 ++ vdup.16 d2, d6[2] ++ vdup.16 d3, d6[3] ++ vrshrn.i16 d20, q2, #3 ++ vmov q2, q9 ++ vst1.8 {d20}, [r0], r3 ++ vrshrn.i16 d20, q8, #3 ++ vadd.i16 q8, q2, q0 ++ vst1.8 {d20}, [r0], r3 ++ bne 1b ++ ++ bx lr ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_c_4_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_c_4_neon_10, export=1 ++ ++ adr ip, nbx2_3_0_1_4 ++ vld1.16 {q0}, [r1 :128]! @ Top (left) ++ lsl r3, #2 ++ vld1.16 {q1}, [ip :128] @ {3,3,2,2,1,1,0,0,1,1,2,2,3,3,4,4} ++ add ip, r2, #16 ++ vld1.32 {d4[],d5[]}, [r1] @ Top (right) ++ vshl.s16 q3, q0, #2 ++ vmovl.u8 q8, d3 @ {1,1,2,2,3,3,4,4} ++ vld1.32 {d18[],d19[]}, [ip] @ Left (lower) ++ vmla.i16 q3, q8, q2 @ Acc set up ++ vsub.i16 q0, q9, q0 @ Add set up ++ vmovl.u8 q1, d2 @ {3,3,2,2,1,1,0,0} ++ vadd.i16 q2, q3, q0 ++ ++@ u16 3..0 [1] q1 ++@ u32 left[y] [1] [r2] ++@ u16 acc [1] q3 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [1] q0 = p[-1][nTbs] - p[x][-1] ++ ++ vld1.32 {d6[],d7[]}, [r2]! ++ vadd.i16 q8, q2, q0 ++ vld1.32 {d18[],d19[]}, [r2]! ++ vmla.i16 q2, q1, q3 ++ vadd.i16 q3, q8, q0 ++ vmla.i16 q8, q1, q9 ++ ++ vrshr.u16 q9, q2, #3 ++ vmov q2, q3 ++ vrshr.u16 q10, q8, #3 ++ vld1.32 {d6[],d7[]}, [r2]! ++ vst1.16 {q9}, [r0 :128], r3 ++ vadd.i16 q8, q2, q0 ++ vld1.32 {d18[],d19[]}, [r2]! ++ vmla.i16 q2, q1, q3 ++ vadd.i16 q3, q8, q0 ++ vmla.i16 q8, q1, q9 ++ vst1.16 {q10}, [r0 :128], r3 ++ ++ vrshr.u16 q9, q2, #3 ++ add r3, r0 ++ vrshr.u16 q10, q8, #3 ++ vst1.16 {q9}, [r0 :128] ++ vst1.16 {q10}, [r3 :128] ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_c_8_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_c_8_neon_8, export=1 ++ ++ adr ip, nbx2_7_0_1_8 + 16 ++ vld1.8 {q0}, [r1 :128]! @ Top (left) ++ add r2, #16 ++ vld1.8 {q1}, [ip: 128] @ {1,1,2,2,3,3...8,8} ++ lsl r3, #1 ++ vld1.16 {d4[]}, [r1] @ Top (right) ++ sub ip, #16 ++ vshll.u8 q3, d0, #3 ++ mov r1, #8 ++ vshll.u8 q8, d1, #3 ++ vld1.16 {d5[]}, [r2] @ Left (lower) ++ sub r2, #16 ++ vmlal.u8 q3, d2, d4 ++ vmlal.u8 q8, d3, d4 @ Acc set up ++ vsubl.u8 q1, d5, d0 ++ vsubl.u8 q0, d5, d1 @ Add set up ++ vld1.8 {q2}, [ip :128] @ {7,7,6,6,5,5...0,0} ++ ++@ u8 7..0 [1] q2 ++@ u8 left[y] [1] [r2] ++@ u16 acc [2] q3,q8 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [2] q1,q0 = p[-1][nTbs] - p[x][-1] ++ ++ vadd.i16 q3, q1 ++ vadd.i16 q8, q0 ++1: ++ vadd.i16 q10, q3, q1 ++ subs r1, #2 ++ vld1.16 {d18[]}, [r2]! ++ vadd.i16 q11, q8, q0 ++ vld1.16 {d19[]}, [r2]! ++ vmlal.u8 q3, d4, d18 ++ vmlal.u8 q8, d5, d18 ++ vadd.i16 q12, q10, q1 ++ vmlal.u8 q10, d4, d19 ++ vadd.i16 q13, q11, q0 ++ vmlal.u8 q11, d5, d19 ++ vrshrn.u16 d18, q3, #4 ++ vrshrn.u16 d19, q8, #4 ++ vmov q3, q12 ++ vst1.8 {q9}, [r0 :128], r3 ++ vrshrn.u16 d18, q10, #4 ++ vrshrn.u16 d19, q11, #4 ++ vmov q8, q13 ++ vst1.8 {q9}, [r0 :128], r3 ++ bne 1b ++ ++ bx lr ++ ++endfunc ++ ++ ++@------------------------------------------------------------------------------ ++@ ++@ Data - has to be in two lumps to ensure we can always reach using adr ++ ++ .balign 64 ++ ++nbx2_15_0_1_16: ++ .byte 15, 15, 14, 14, 13, 13, 12, 12 ++ .byte 11, 11, 10, 10, 9, 9, 8, 8 ++nbx2_7_0_1_8: ++ .byte 7, 7, 6, 6, 5, 5, 4, 4 ++ .byte 3, 3, 2, 2, 1, 1, 0, 0 ++ .byte 1, 1, 2, 2, 3, 3, 4, 4 ++ .byte 5, 5, 6, 6, 7, 7, 8, 8 ++ .byte 9, 9, 10, 10, 11, 11, 12, 12 ++ .byte 13, 13, 14, 14, 15, 15, 16, 16 ++ ++ @ should be back on a 64-byte boundary here ++ ++nbx2_3_0_1_4: ++ .byte 3, 3, 2, 2, 1, 1, 0, 0 ++ .byte 1, 1, 2, 2, 3, 3, 4, 4 ++ ++@------------------------------------------------------------------------------ ++ ++ ++@ ff_hevc_rpi_pred_planar_c_8_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_c_8_neon_10, export=1 ++ ++ @ Load from bytes & expand later - at the very least this uses less ++ @ memory than having a short table ++ adr ip, nbx2_7_0_1_8 + 16 ++ vld1.16 {q0-q1}, [r1 :128]! @ Top (left) ++ add r2, #32 ++ vld1.8 {q2}, [ip :128] @ {1,1,2,2,3,3...8,8} ++ lsl r3, #2 ++ vld1.32 {d6[],d7[]}, [r1] @ Top (right) ++ sub ip, #16 ++ vmovl.u8 q8, d4 ++ mov r1, #8 ++ vshl.i16 q9, q0, #3 ++ vmovl.u8 q2, d5 ++ vshl.i16 q10, q1, #3 ++ vld1.32 {d22[],d23[]}, [r2] @ Left (lower) ++ sub r2, #32 ++ vld1.8 {q12}, [ip] @ {7,7,6,6,5,5...0,0} ++ vmla.i16 q9, q8, q3 ++ vmla.i16 q10, q2, q3 @ Acc set up ++ vsub.i16 q0, q11, q0 ++ vsub.i16 q1, q11, q1 @ Add set up ++ vadd.i16 q2, q9, q0 ++ vadd.i16 q3, q10, q1 ++ vmovl.u8 q8, d24 ++ vmovl.u8 q9, d25 ++ ++@ u16 7..0 [2] q8,q9 ++@ u32 left[y] [2] [r2] ++@ u16 acc [2] q2,q3 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [2] q0,q1 = p[-1][nTbs] - p[x][-1] ++ ++1: ++ vadd.i16 q10, q2, q0 ++ subs r1, #2 ++ vld1.32 {d24[],d25[]}, [r2]! ++ vadd.i16 q11, q3, q1 ++ vld1.32 {d28[],d29[]}, [r2]! ++ vmla.i16 q2, q8, q12 ++ vmla.i16 q3, q9, q12 ++ vadd.i16 q12, q10, q0 ++ vmla.i16 q10, q8, q14 ++ vadd.i16 q13, q11, q1 ++ vmla.i16 q11, q9, q14 ++ vrshr.u16 q14, q2, #4 ++ vrshr.u16 q15, q3, #4 ++ vmov q2, q12 ++ vst1.16 {q14-q15}, [r0 :128], r3 ++ vrshr.u16 q14, q10, #4 ++ vrshr.u16 q15, q11, #4 ++ vmov q3, q13 ++ vst1.16 {q14-q15}, [r0 :128], r3 ++ bne 1b ++ ++ bx lr ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_c_16_neon_8 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_c_16_neon_8, export=1 ++ ++ vld1.8 {q0-q1}, [r1 :128]! @ Top (left) ++ adr ip, nbx2_15_0_1_16 + 32 ++ vpush {d8-d12} ++ vld1.8 {q2-q3}, [ip :128] @ {1,1,2,2,3,3...16,16} ++ add r2, #32 ++ vld1.16 {d8[]}, [r1] @ Top (right) ++ sub ip, #32 ++ vshll.u8 q8, d0, #4 ++ mov r1, #16 ++ vld1.16 {d9[]}, [r2] @ Left (lower) ++ sub r2, #32 ++ vshll.u8 q9, d1, #4 ++ lsl r3, #1 ++ vshll.u8 q10, d2, #4 ++ vshll.u8 q11, d3, #4 ++ vmlal.u8 q8, d4, d8 ++ vsubl.u8 q12, d9, d0 ++ vmlal.u8 q9, d5, d8 ++ vsubl.u8 q13, d9, d1 ++ vmlal.u8 q10, d6, d8 ++ vsubl.u8 q14, d9, d2 ++ vmlal.u8 q11, d7, d8 @ Acc set up ++ vsubl.u8 q15, d9, d3 @ Add set up ++ vadd.i16 q8, q12 ++ vadd.i16 q9, q13 ++ vadd.i16 q10, q14 ++ vadd.i16 q11, q15 ++ vld1.8 {q4-q5}, [ip :128] @ {15,15,14,14,13,13...0,0} ++ ++@ u8 15..0 [2] q4,q5 ++@ u8 left[y] [2] [r2] ++@ u16 acc [4] q8-q11 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [4] q12-q15 = p[-1][nTbs] - p[x][-1] ++ ++ vld1.16 {d12[]}, [r2]! ++ vadd.i16 q0, q8, q12 ++ b 2f ++1: ++ vld1.16 {d12[]}, [r2]! ++ vrshrn.u16 d3, q1, #5 ++ vrshrn.u16 d2, q0, #5 ++ vadd.i16 q0, q8, q12 ++ vrshrn.u16 d4, q2, #5 ++ vrshrn.u16 d5, q3, #5 ++ vst1.8 {q1-q2}, [r0 :128], r3 ++2: vadd.i16 q1, q9, q13 ++ subs r1, #2 ++ vadd.i16 q2, q10, q14 ++ vadd.i16 q3, q11, q15 ++ vmlal.u8 q8, d8, d12 ++ vmlal.u8 q9, d9, d12 ++ vmlal.u8 q10, d10, d12 ++ vmlal.u8 q11, d11, d12 ++ vld1.16 {d12[]}, [r2]! ++ vrshrn.u16 d19, q9, #5 ++ vrshrn.u16 d18, q8, #5 ++ vadd.i16 q8, q0, q12 ++ vrshrn.u16 d20, q10, #5 ++ vrshrn.u16 d21, q11, #5 ++ vst1.8 {q9-q10}, [r0 :128], r3 ++ vadd.i16 q9, q1, q13 ++ vadd.i16 q10, q2, q14 ++ vadd.i16 q11, q3, q15 ++ vmlal.u8 q0, d8, d12 ++ vmlal.u8 q1, d9, d12 ++ vmlal.u8 q2, d10, d12 ++ vmlal.u8 q3, d11, d12 ++ ++ bne 1b ++ ++ vpop {d8-d12} ++ ++ vrshrn.u16 d3, q1, #5 ++ vrshrn.u16 d2, q0, #5 ++ vrshrn.u16 d4, q2, #5 ++ vrshrn.u16 d5, q3, #5 ++ vst1.8 {q1-q2}, [r0 :128] ++ ++ bx lr ++ ++endfunc ++ ++ ++@ ff_hevc_rpi_pred_planar_c_16_neon_10 ++@ uint8_t *_src, [r0] ++@ const uint8_t *_top, [r1] ++@ const uint8_t *_left, [r2] ++@ ptrdiff_t stride) [r3] ++ ++function ff_hevc_rpi_pred_planar_c_16_neon_10, export=1 ++ ++ @ Load from bytes & expand later - at the very least this uses less ++ @ memory than having a short table ++ vld1.16 {q0-q1}, [r1 :128]! @ Top (left) ++ adr ip, nbx2_15_0_1_16 + 32 ++ vpush {q4-q7} ++ vld1.16 {q2-q3}, [r1 :128]! @ Top (centre) ++ add r2, #64 ++ vld1.8 {q14-q15}, [ip :128] @ {1,1,2,2,3,3...16,16} ++T lsl r3, #2 ++ vld1.32 {d8[],d9[]}, [r1] @ Top (right) ++ sub ip, #32 ++ vmovl.u8 q12, d28 ++ mov r1, #16 ++ vmovl.u8 q13, d29 ++ vld1.8 {q6-q7}, [ip :128] @ {15,15,14,14,13,13...0,0} ++ vmovl.u8 q14, d30 ++ vmovl.u8 q15, d31 ++ vld1.32 {d10[],d11[]}, [r2] @ Left (lower) ++ sub r2, #64 ++ vshl.i16 q8, q0, #4 ++ vshl.i16 q9, q1, #4 ++ vshl.i16 q10, q2, #4 ++ vshl.i16 q11, q3, #4 ++ vmla.i16 q8, q12, q4 ++ vsub.i16 q0, q5, q0 ++ vmla.i16 q9, q13, q4 ++ vpush {q0} ++ vsub.i16 q1, q5, q1 ++ vmla.i16 q10, q14, q4 ++ vsub.i16 q2, q5, q2 ++ vmla.i16 q11, q15, q4 @ Acc set up ++ vsub.i16 q3, q5, q3 @ Add set up ++ vadd.i16 q8, q0 ++ vadd.i16 q9, q1 ++ vadd.i16 q10, q2 ++ vadd.i16 q11, q3 ++ vmovl.u8 q4, d12 ++ vmovl.u8 q5, d13 ++ vmovl.u8 q6, d14 ++ vmovl.u8 q7, d15 ++ ++@ u16 31..0 [4] q4-q7 ++@ u16 left[y] [4] [r2] ++@ u16 acc [4] q8-q11 = (x+1)*p[nTbS][-1] + 32*p[x][-1] initially ++@ u16 add [4] q0-q3 = p[-1][nTbs] - p[x][-1] ++ ++ vadd.i16 q12, q8, q0 ++A sub r0, r0, r3, lsl #2 ++T sub r0, r3 ++1: ++ vld1.32 {d0[],d1[]}, [r2]! ++A add r0, r0, r3, lsl #2 ++T add r0, r3 ++ vadd.i16 q13, q9, q1 ++ subs r1, #2 ++ vadd.i16 q14, q10, q2 ++ vadd.i16 q15, q11, q3 ++ vmla.i16 q8, q4, q0 ++ vmla.i16 q9, q5, q0 ++ vmla.i16 q10, q6, q0 ++ vmla.i16 q11, q7, q0 ++ vld1.16 {q0}, [sp] ++ vrshr.u16 q8, #5 ++ vrshr.u16 q9, #5 ++ vrshr.u16 q10, #5 ++ vrshr.u16 q11, #5 ++ vstm r0, {q8-q11} ++ vadd.i16 q8, q12, q0 ++A add r0, r0, r3, lsl #2 ++T add r0, r3 ++ vld1.32 {d0[],d1[]}, [r2]! ++ vadd.i16 q9, q13, q1 ++ vadd.i16 q10, q14, q2 ++ vadd.i16 q11, q15, q3 ++ vmla.i16 q12, q4, q0 ++ vmla.i16 q13, q5, q0 ++ vmla.i16 q14, q6, q0 ++ vmla.i16 q15, q7, q0 ++ vld1.16 {q0}, [sp] ++ vrshr.u16 q12, #5 ++ vrshr.u16 q13, #5 ++ vrshr.u16 q14, #5 ++ vrshr.u16 q15, #5 ++ vstm r0, {q12-q15} ++ vadd.i16 q12, q8, q0 ++ bne 1b ++ ++ vpop {q3-q7} ++ bx lr ++ ++endfunc +--- a/libavcodec/arm/vc1dsp_init_neon.c ++++ b/libavcodec/arm/vc1dsp_init_neon.c +@@ -19,6 +19,7 @@ + #include + + #include "libavutil/attributes.h" ++#include "libavutil/intreadwrite.h" + #include "libavcodec/vc1dsp.h" + #include "vc1dsp.h" + +@@ -32,6 +33,13 @@ void ff_vc1_inv_trans_4x8_dc_neon(uint8_ + void ff_vc1_inv_trans_8x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); + void ff_vc1_inv_trans_4x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block); + ++void ff_vc1_v_loop_filter4_neon(uint8_t *src, int stride, int pq); ++void ff_vc1_h_loop_filter4_neon(uint8_t *src, int stride, int pq); ++void ff_vc1_v_loop_filter8_neon(uint8_t *src, int stride, int pq); ++void ff_vc1_h_loop_filter8_neon(uint8_t *src, int stride, int pq); ++void ff_vc1_v_loop_filter16_neon(uint8_t *src, int stride, int pq); ++void ff_vc1_h_loop_filter16_neon(uint8_t *src, int stride, int pq); ++ + void ff_put_pixels8x8_neon(uint8_t *block, const uint8_t *pixels, + ptrdiff_t line_size, int rnd); + +@@ -77,6 +85,64 @@ void ff_put_vc1_chroma_mc4_neon(uint8_t + void ff_avg_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + ++int ff_vc1_unescape_buffer_helper_neon(const uint8_t *src, int size, uint8_t *dst); ++ ++static int vc1_unescape_buffer_neon(const uint8_t *src, int size, uint8_t *dst) ++{ ++ /* Dealing with starting and stopping, and removing escape bytes, are ++ * comparatively less time-sensitive, so are more clearly expressed using ++ * a C wrapper around the assembly inner loop. Note that we assume a ++ * little-endian machine that supports unaligned loads. */ ++ int dsize = 0; ++ while (size >= 4) ++ { ++ int found = 0; ++ while (!found && (((uintptr_t) dst) & 7) && size >= 4) ++ { ++ found = (AV_RL32(src) &~ 0x03000000) == 0x00030000; ++ if (!found) ++ { ++ *dst++ = *src++; ++ --size; ++ ++dsize; ++ } ++ } ++ if (!found) ++ { ++ int skip = size - ff_vc1_unescape_buffer_helper_neon(src, size, dst); ++ dst += skip; ++ src += skip; ++ size -= skip; ++ dsize += skip; ++ while (!found && size >= 4) ++ { ++ found = (AV_RL32(src) &~ 0x03000000) == 0x00030000; ++ if (!found) ++ { ++ *dst++ = *src++; ++ --size; ++ ++dsize; ++ } ++ } ++ } ++ if (found) ++ { ++ *dst++ = *src++; ++ *dst++ = *src++; ++ ++src; ++ size -= 3; ++ dsize += 2; ++ } ++ } ++ while (size > 0) ++ { ++ *dst++ = *src++; ++ --size; ++ ++dsize; ++ } ++ return dsize; ++} ++ + #define FN_ASSIGN(X, Y) \ + dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_16_neon; \ + dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_neon +@@ -92,6 +158,13 @@ av_cold void ff_vc1dsp_init_neon(VC1DSPC + dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_neon; + dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_neon; + ++ dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_neon; ++ dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_neon; ++ dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_neon; ++ dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_neon; ++ dsp->vc1_v_loop_filter16 = ff_vc1_v_loop_filter16_neon; ++ dsp->vc1_h_loop_filter16 = ff_vc1_h_loop_filter16_neon; ++ + dsp->put_vc1_mspel_pixels_tab[1][ 0] = ff_put_pixels8x8_neon; + FN_ASSIGN(1, 0); + FN_ASSIGN(2, 0); +@@ -116,4 +189,6 @@ av_cold void ff_vc1dsp_init_neon(VC1DSPC + dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_neon; + dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = ff_put_vc1_chroma_mc4_neon; + dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = ff_avg_vc1_chroma_mc4_neon; ++ ++ dsp->vc1_unescape_buffer = vc1_unescape_buffer_neon; + } +--- a/libavcodec/arm/vc1dsp_neon.S ++++ b/libavcodec/arm/vc1dsp_neon.S +@@ -1161,3 +1161,764 @@ function ff_vc1_inv_trans_4x4_dc_neon, e + vst1.32 {d1[1]}, [r0,:32] + bx lr + endfunc ++ ++@ VC-1 in-loop deblocking filter for 4 pixel pairs at boundary of vertically-neighbouring blocks ++@ On entry: ++@ r0 -> top-left pel of lower block ++@ r1 = row stride, bytes ++@ r2 = PQUANT bitstream parameter ++function ff_vc1_v_loop_filter4_neon, export=1 ++ sub r3, r0, r1, lsl #2 ++ vldr d0, .Lcoeffs ++ vld1.32 {d1[0]}, [r0], r1 @ P5 ++ vld1.32 {d2[0]}, [r3], r1 @ P1 ++ vld1.32 {d3[0]}, [r3], r1 @ P2 ++ vld1.32 {d4[0]}, [r0], r1 @ P6 ++ vld1.32 {d5[0]}, [r3], r1 @ P3 ++ vld1.32 {d6[0]}, [r0], r1 @ P7 ++ vld1.32 {d7[0]}, [r3] @ P4 ++ vld1.32 {d16[0]}, [r0] @ P8 ++ vshll.u8 q9, d1, #1 @ 2*P5 ++ vdup.16 d17, r2 @ pq ++ vshll.u8 q10, d2, #1 @ 2*P1 ++ vmovl.u8 q11, d3 @ P2 ++ vmovl.u8 q1, d4 @ P6 ++ vmovl.u8 q12, d5 @ P3 ++ vmls.i16 d20, d22, d0[1] @ 2*P1-5*P2 ++ vmovl.u8 q11, d6 @ P7 ++ vmls.i16 d18, d2, d0[1] @ 2*P5-5*P6 ++ vshll.u8 q2, d5, #1 @ 2*P3 ++ vmovl.u8 q3, d7 @ P4 ++ vmla.i16 d18, d22, d0[1] @ 2*P5-5*P6+5*P7 ++ vmovl.u8 q11, d16 @ P8 ++ vmla.u16 d20, d24, d0[1] @ 2*P1-5*P2+5*P3 ++ vmovl.u8 q12, d1 @ P5 ++ vmls.u16 d4, d6, d0[1] @ 2*P3-5*P4 ++ vmls.u16 d18, d22, d0[0] @ 2*P5-5*P6+5*P7-2*P8 ++ vsub.i16 d1, d6, d24 @ P4-P5 ++ vmls.i16 d20, d6, d0[0] @ 2*P1-5*P2+5*P3-2*P4 ++ vmla.i16 d4, d24, d0[1] @ 2*P3-5*P4+5*P5 ++ vmls.i16 d4, d2, d0[0] @ 2*P3-5*P4+5*P5-2*P6 ++ vabs.s16 d2, d1 ++ vrshr.s16 d3, d18, #3 ++ vrshr.s16 d5, d20, #3 ++ vshr.s16 d2, d2, #1 @ clip ++ vrshr.s16 d4, d4, #3 ++ vabs.s16 d3, d3 @ a2 ++ vshr.s16 d1, d1, #8 @ clip_sign ++ vabs.s16 d5, d5 @ a1 ++ vceq.i16 d7, d2, #0 @ test clip == 0 ++ vabs.s16 d16, d4 @ a0 ++ vshr.s16 d4, d4, #8 @ a0_sign ++ vcge.s16 d18, d5, d3 @ test a1 >= a2 ++ vcge.s16 d17, d16, d17 @ test a0 >= pq ++ vbsl d18, d3, d5 @ a3 ++ vsub.i16 d1, d1, d4 @ clip_sign - a0_sign ++ vorr d3, d7, d17 @ test clip == 0 || a0 >= pq ++ vqsub.u16 d4, d16, d18 @ a0 >= a3 ? a0-a3 : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ vcge.s16 d5, d18, d16 @ test a3 >= a0 ++ vmul.i16 d0, d4, d0[1] @ a0 >= a3 ? 5*(a0-a3) : 0 ++ vorr d4, d3, d5 @ test clip == 0 || a0 >= pq || a3 >= a0 ++ vmov.32 r0, d4[1] @ move to gp reg ++ vshr.u16 d0, d0, #3 @ a0 >= a3 ? (5*(a0-a3))>>3 : 0 ++ vcge.s16 d4, d0, d2 ++ tst r0, #1 ++ bne 1f @ none of the 4 pixel pairs should be updated if this one is not filtered ++ vbsl d4, d2, d0 @ FFMIN(d, clip) ++ vbic d0, d4, d3 @ set each d to zero if it should not be filtered because clip == 0 || a0 >= pq (a3 > a0 case already zeroed by saturating sub) ++ vmls.i16 d6, d0, d1 @ invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P4 ++ vmla.i16 d24, d0, d1 @ invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P5 ++ vqmovun.s16 d0, q3 ++ vqmovun.s16 d1, q12 ++ vst1.32 {d0[0]}, [r3], r1 ++ vst1.32 {d1[0]}, [r3] ++1: bx lr ++endfunc ++ ++@ VC-1 in-loop deblocking filter for 4 pixel pairs at boundary of horizontally-neighbouring blocks ++@ On entry: ++@ r0 -> top-left pel of right block ++@ r1 = row stride, bytes ++@ r2 = PQUANT bitstream parameter ++function ff_vc1_h_loop_filter4_neon, export=1 ++ sub r3, r0, #4 @ where to start reading ++ vldr d0, .Lcoeffs ++ vld1.32 {d2}, [r3], r1 ++ sub r0, r0, #1 @ where to start writing ++ vld1.32 {d4}, [r3], r1 ++ vld1.32 {d3}, [r3], r1 ++ vld1.32 {d5}, [r3] ++ vdup.16 d1, r2 @ pq ++ vtrn.8 q1, q2 ++ vtrn.16 d2, d3 @ P1, P5, P3, P7 ++ vtrn.16 d4, d5 @ P2, P6, P4, P8 ++ vshll.u8 q3, d2, #1 @ 2*P1, 2*P5 ++ vmovl.u8 q8, d4 @ P2, P6 ++ vmovl.u8 q9, d3 @ P3, P7 ++ vmovl.u8 q2, d5 @ P4, P8 ++ vmls.i16 q3, q8, d0[1] @ 2*P1-5*P2, 2*P5-5*P6 ++ vshll.u8 q10, d3, #1 @ 2*P3, 2*P7 ++ vmovl.u8 q1, d2 @ P1, P5 ++ vmla.i16 q3, q9, d0[1] @ 2*P1-5*P2+5*P3, 2*P5-5*P6+5*P7 ++ vmls.i16 q3, q2, d0[0] @ 2*P1-5*P2+5*P3-2*P4, 2*P5-5*P6+5*P7-2*P8 ++ vmov d2, d3 @ needs to be in an even-numbered vector for when we come to narrow it later ++ vmls.i16 d20, d4, d0[1] @ 2*P3-5*P4 ++ vmla.i16 d20, d3, d0[1] @ 2*P3-5*P4+5*P5 ++ vsub.i16 d3, d4, d2 @ P4-P5 ++ vmls.i16 d20, d17, d0[0] @ 2*P3-5*P4+5*P5-2*P6 ++ vrshr.s16 q3, q3, #3 ++ vabs.s16 d5, d3 ++ vshr.s16 d3, d3, #8 @ clip_sign ++ vrshr.s16 d16, d20, #3 ++ vabs.s16 q3, q3 @ a1, a2 ++ vshr.s16 d5, d5, #1 @ clip ++ vabs.s16 d17, d16 @ a0 ++ vceq.i16 d18, d5, #0 @ test clip == 0 ++ vshr.s16 d16, d16, #8 @ a0_sign ++ vcge.s16 d19, d6, d7 @ test a1 >= a2 ++ vcge.s16 d1, d17, d1 @ test a0 >= pq ++ vsub.i16 d16, d3, d16 @ clip_sign - a0_sign ++ vbsl d19, d7, d6 @ a3 ++ vorr d1, d18, d1 @ test clip == 0 || a0 >= pq ++ vqsub.u16 d3, d17, d19 @ a0 >= a3 ? a0-a3 : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ vcge.s16 d6, d19, d17 @ test a3 >= a0 @ ++ vmul.i16 d0, d3, d0[1] @ a0 >= a3 ? 5*(a0-a3) : 0 ++ vorr d3, d1, d6 @ test clip == 0 || a0 >= pq || a3 >= a0 ++ vmov.32 r2, d3[1] @ move to gp reg ++ vshr.u16 d0, d0, #3 @ a0 >= a3 ? (5*(a0-a3))>>3 : 0 ++ vcge.s16 d3, d0, d5 ++ tst r2, #1 ++ bne 1f @ none of the 4 pixel pairs should be updated if this one is not filtered ++ vbsl d3, d5, d0 @ FFMIN(d, clip) ++ vbic d0, d3, d1 @ set each d to zero if it should not be filtered because clip == 0 || a0 >= pq (a3 > a0 case already zeroed by saturating sub) ++ vmla.i16 d2, d0, d16 @ invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P5 ++ vmls.i16 d4, d0, d16 @ invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P4 ++ vqmovun.s16 d1, q1 ++ vqmovun.s16 d0, q2 ++ vst2.8 {d0[0], d1[0]}, [r0], r1 ++ vst2.8 {d0[1], d1[1]}, [r0], r1 ++ vst2.8 {d0[2], d1[2]}, [r0], r1 ++ vst2.8 {d0[3], d1[3]}, [r0] ++1: bx lr ++endfunc ++ ++@ VC-1 in-loop deblocking filter for 8 pixel pairs at boundary of vertically-neighbouring blocks ++@ On entry: ++@ r0 -> top-left pel of lower block ++@ r1 = row stride, bytes ++@ r2 = PQUANT bitstream parameter ++function ff_vc1_v_loop_filter8_neon, export=1 ++ sub r3, r0, r1, lsl #2 ++ vldr d0, .Lcoeffs ++ vld1.32 {d1}, [r0 :64], r1 @ P5 ++ vld1.32 {d2}, [r3 :64], r1 @ P1 ++ vld1.32 {d3}, [r3 :64], r1 @ P2 ++ vld1.32 {d4}, [r0 :64], r1 @ P6 ++ vld1.32 {d5}, [r3 :64], r1 @ P3 ++ vld1.32 {d6}, [r0 :64], r1 @ P7 ++ vshll.u8 q8, d1, #1 @ 2*P5 ++ vshll.u8 q9, d2, #1 @ 2*P1 ++ vld1.32 {d7}, [r3 :64] @ P4 ++ vmovl.u8 q1, d3 @ P2 ++ vld1.32 {d20}, [r0 :64] @ P8 ++ vmovl.u8 q11, d4 @ P6 ++ vdup.16 q12, r2 @ pq ++ vmovl.u8 q13, d5 @ P3 ++ vmls.i16 q9, q1, d0[1] @ 2*P1-5*P2 ++ vmovl.u8 q1, d6 @ P7 ++ vshll.u8 q2, d5, #1 @ 2*P3 ++ vmls.i16 q8, q11, d0[1] @ 2*P5-5*P6 ++ vmovl.u8 q3, d7 @ P4 ++ vmovl.u8 q10, d20 @ P8 ++ vmla.i16 q8, q1, d0[1] @ 2*P5-5*P6+5*P7 ++ vmovl.u8 q1, d1 @ P5 ++ vmla.i16 q9, q13, d0[1] @ 2*P1-5*P2+5*P3 ++ vsub.i16 q13, q3, q1 @ P4-P5 ++ vmls.i16 q2, q3, d0[1] @ 2*P3-5*P4 ++ vmls.i16 q8, q10, d0[0] @ 2*P5-5*P6+5*P7-2*P8 ++ vabs.s16 q10, q13 ++ vshr.s16 q13, q13, #8 @ clip_sign ++ vmls.i16 q9, q3, d0[0] @ 2*P1-5*P2+5*P3-2*P4 ++ vshr.s16 q10, q10, #1 @ clip ++ vmla.i16 q2, q1, d0[1] @ 2*P3-5*P4+5*P5 ++ vrshr.s16 q8, q8, #3 ++ vmls.i16 q2, q11, d0[0] @ 2*P3-5*P4+5*P5-2*P6 ++ vceq.i16 q11, q10, #0 @ test clip == 0 ++ vrshr.s16 q9, q9, #3 ++ vabs.s16 q8, q8 @ a2 ++ vabs.s16 q9, q9 @ a1 ++ vrshr.s16 q2, q2, #3 ++ vcge.s16 q14, q9, q8 @ test a1 >= a2 ++ vabs.s16 q15, q2 @ a0 ++ vshr.s16 q2, q2, #8 @ a0_sign ++ vbsl q14, q8, q9 @ a3 ++ vcge.s16 q8, q15, q12 @ test a0 >= pq ++ vsub.i16 q2, q13, q2 @ clip_sign - a0_sign ++ vqsub.u16 q9, q15, q14 @ a0 >= a3 ? a0-a3 : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ vcge.s16 q12, q14, q15 @ test a3 >= a0 ++ vorr q8, q11, q8 @ test clip == 0 || a0 >= pq ++ vmul.i16 q0, q9, d0[1] @ a0 >= a3 ? 5*(a0-a3) : 0 ++ vorr q9, q8, q12 @ test clip == 0 || a0 >= pq || a3 >= a0 ++ vshl.i64 q11, q9, #16 ++ vmov.32 r0, d18[1] @ move to gp reg ++ vshr.u16 q0, q0, #3 @ a0 >= a3 ? (5*(a0-a3))>>3 : 0 ++ vmov.32 r2, d19[1] ++ vshr.s64 q9, q11, #48 ++ vcge.s16 q11, q0, q10 ++ vorr q8, q8, q9 ++ and r0, r0, r2 ++ vbsl q11, q10, q0 @ FFMIN(d, clip) ++ tst r0, #1 ++ bne 1f @ none of the 8 pixel pairs should be updated in this case ++ vbic q0, q11, q8 @ set each d to zero if it should not be filtered ++ vmls.i16 q3, q0, q2 @ invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P4 ++ vmla.i16 q1, q0, q2 @ invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P5 ++ vqmovun.s16 d0, q3 ++ vqmovun.s16 d1, q1 ++ vst1.32 {d0}, [r3 :64], r1 ++ vst1.32 {d1}, [r3 :64] ++1: bx lr ++endfunc ++ ++.align 5 ++.Lcoeffs: ++.quad 0x00050002 ++ ++@ VC-1 in-loop deblocking filter for 8 pixel pairs at boundary of horizontally-neighbouring blocks ++@ On entry: ++@ r0 -> top-left pel of right block ++@ r1 = row stride, bytes ++@ r2 = PQUANT bitstream parameter ++function ff_vc1_h_loop_filter8_neon, export=1 ++ push {lr} ++ sub r3, r0, #4 @ where to start reading ++ vldr d0, .Lcoeffs ++ vld1.32 {d2}, [r3], r1 @ P1[0], P2[0]... ++ sub r0, r0, #1 @ where to start writing ++ vld1.32 {d4}, [r3], r1 ++ add r12, r0, r1, lsl #2 ++ vld1.32 {d3}, [r3], r1 ++ vld1.32 {d5}, [r3], r1 ++ vld1.32 {d6}, [r3], r1 ++ vld1.32 {d16}, [r3], r1 ++ vld1.32 {d7}, [r3], r1 ++ vld1.32 {d17}, [r3] ++ vtrn.8 q1, q2 @ P1[0], P1[1], P3[0]... P1[2], P1[3], P3[2]... P2[0], P2[1], P4[0]... P2[2], P2[3], P4[2]... ++ vdup.16 q9, r2 @ pq ++ vtrn.16 d2, d3 @ P1[0], P1[1], P1[2], P1[3], P5[0]... P3[0], P3[1], P3[2], P3[3], P7[0]... ++ vtrn.16 d4, d5 @ P2[0], P2[1], P2[2], P2[3], P6[0]... P4[0], P4[1], P4[2], P4[3], P8[0]... ++ vtrn.8 q3, q8 @ P1[4], P1[5], P3[4]... P1[6], P1[7], P3[6]... P2[4], P2[5], P4[4]... P2[6], P2[7], P4[6]... ++ vtrn.16 d6, d7 @ P1[4], P1[5], P1[6], P1[7], P5[4]... P3[4], P3[5], P3[5], P3[7], P7[4]... ++ vtrn.16 d16, d17 @ P2[4], P2[5], P2[6], P2[7], P6[4]... P4[4], P4[5], P4[6], P4[7], P8[4]... ++ vtrn.32 d2, d6 @ P1, P5 ++ vtrn.32 d4, d16 @ P2, P6 ++ vtrn.32 d3, d7 @ P3, P7 ++ vtrn.32 d5, d17 @ P4, P8 ++ vshll.u8 q10, d2, #1 @ 2*P1 ++ vshll.u8 q11, d6, #1 @ 2*P5 ++ vmovl.u8 q12, d4 @ P2 ++ vmovl.u8 q13, d16 @ P6 ++ vmovl.u8 q14, d3 @ P3 ++ vmls.i16 q10, q12, d0[1] @ 2*P1-5*P2 ++ vmovl.u8 q12, d7 @ P7 ++ vshll.u8 q1, d3, #1 @ 2*P3 ++ vmls.i16 q11, q13, d0[1] @ 2*P5-5*P6 ++ vmovl.u8 q2, d5 @ P4 ++ vmovl.u8 q8, d17 @ P8 ++ vmla.i16 q11, q12, d0[1] @ 2*P5-5*P6+5*P7 ++ vmovl.u8 q3, d6 @ P5 ++ vmla.i16 q10, q14, d0[1] @ 2*P1-5*P2+5*P3 ++ vsub.i16 q12, q2, q3 @ P4-P5 ++ vmls.i16 q1, q2, d0[1] @ 2*P3-5*P4 ++ vmls.i16 q11, q8, d0[0] @ 2*P5-5*P6+5*P7-2*P8 ++ vabs.s16 q8, q12 ++ vshr.s16 q12, q12, #8 @ clip_sign ++ vmls.i16 q10, q2, d0[0] @ 2*P1-5*P2+5*P3-2*P4 ++ vshr.s16 q8, q8, #1 @ clip ++ vmla.i16 q1, q3, d0[1] @ 2*P3-5*P4+5*P5 ++ vrshr.s16 q11, q11, #3 ++ vmls.i16 q1, q13, d0[0] @ 2*P3-5*P4+5*P5-2*P6 ++ vceq.i16 q13, q8, #0 @ test clip == 0 ++ vrshr.s16 q10, q10, #3 ++ vabs.s16 q11, q11 @ a2 ++ vabs.s16 q10, q10 @ a1 ++ vrshr.s16 q1, q1, #3 ++ vcge.s16 q14, q10, q11 @ test a1 >= a2 ++ vabs.s16 q15, q1 @ a0 ++ vshr.s16 q1, q1, #8 @ a0_sign ++ vbsl q14, q11, q10 @ a3 ++ vcge.s16 q9, q15, q9 @ test a0 >= pq ++ vsub.i16 q1, q12, q1 @ clip_sign - a0_sign ++ vqsub.u16 q10, q15, q14 @ a0 >= a3 ? a0-a3 : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ vcge.s16 q11, q14, q15 @ test a3 >= a0 ++ vorr q9, q13, q9 @ test clip == 0 || a0 >= pq ++ vmul.i16 q0, q10, d0[1] @ a0 >= a3 ? 5*(a0-a3) : 0 ++ vorr q10, q9, q11 @ test clip == 0 || a0 >= pq || a3 >= a0 ++ vmov.32 r2, d20[1] @ move to gp reg ++ vshr.u16 q0, q0, #3 @ a0 >= a3 ? (5*(a0-a3))>>3 : 0 ++ vmov.32 r3, d21[1] ++ vcge.s16 q10, q0, q8 ++ and r14, r2, r3 ++ vbsl q10, q8, q0 @ FFMIN(d, clip) ++ tst r14, #1 ++ bne 2f @ none of the 8 pixel pairs should be updated in this case ++ vbic q0, q10, q9 @ set each d to zero if it should not be filtered because clip == 0 || a0 >= pq (a3 > a0 case already zeroed by saturating sub) ++ vmla.i16 q3, q0, q1 @ invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P5 ++ vmls.i16 q2, q0, q1 @ invert d depending on clip_sign & a0_sign, or zero it if they match, and accumulate into P4 ++ vqmovun.s16 d1, q3 ++ vqmovun.s16 d0, q2 ++ tst r2, #1 ++ bne 1f @ none of the first 4 pixel pairs should be updated if so ++ vst2.8 {d0[0], d1[0]}, [r0], r1 ++ vst2.8 {d0[1], d1[1]}, [r0], r1 ++ vst2.8 {d0[2], d1[2]}, [r0], r1 ++ vst2.8 {d0[3], d1[3]}, [r0] ++1: tst r3, #1 ++ bne 2f @ none of the second 4 pixel pairs should be updated if so ++ vst2.8 {d0[4], d1[4]}, [r12], r1 ++ vst2.8 {d0[5], d1[5]}, [r12], r1 ++ vst2.8 {d0[6], d1[6]}, [r12], r1 ++ vst2.8 {d0[7], d1[7]}, [r12] ++2: pop {pc} ++endfunc ++ ++@ VC-1 in-loop deblocking filter for 16 pixel pairs at boundary of vertically-neighbouring blocks ++@ On entry: ++@ r0 -> top-left pel of lower block ++@ r1 = row stride, bytes ++@ r2 = PQUANT bitstream parameter ++function ff_vc1_v_loop_filter16_neon, export=1 ++ vpush {d8-d15} ++ sub r3, r0, r1, lsl #2 ++ vldr d0, .Lcoeffs ++ vld1.64 {q1}, [r0 :128], r1 @ P5 ++ vld1.64 {q2}, [r3 :128], r1 @ P1 ++ vld1.64 {q3}, [r3 :128], r1 @ P2 ++ vld1.64 {q4}, [r0 :128], r1 @ P6 ++ vld1.64 {q5}, [r3 :128], r1 @ P3 ++ vld1.64 {q6}, [r0 :128], r1 @ P7 ++ vshll.u8 q7, d2, #1 @ 2*P5[0..7] ++ vshll.u8 q8, d4, #1 @ 2*P1[0..7] ++ vld1.64 {q9}, [r3 :128] @ P4 ++ vmovl.u8 q10, d6 @ P2[0..7] ++ vld1.64 {q11}, [r0 :128] @ P8 ++ vmovl.u8 q12, d8 @ P6[0..7] ++ vdup.16 q13, r2 @ pq ++ vshll.u8 q2, d5, #1 @ 2*P1[8..15] ++ vmls.i16 q8, q10, d0[1] @ 2*P1[0..7]-5*P2[0..7] ++ vshll.u8 q10, d3, #1 @ 2*P5[8..15] ++ vmovl.u8 q3, d7 @ P2[8..15] ++ vmls.i16 q7, q12, d0[1] @ 2*P5[0..7]-5*P6[0..7] ++ vmovl.u8 q4, d9 @ P6[8..15] ++ vmovl.u8 q14, d10 @ P3[0..7] ++ vmovl.u8 q15, d12 @ P7[0..7] ++ vmls.i16 q2, q3, d0[1] @ 2*P1[8..15]-5*P2[8..15] ++ vshll.u8 q3, d10, #1 @ 2*P3[0..7] ++ vmls.i16 q10, q4, d0[1] @ 2*P5[8..15]-5*P6[8..15] ++ vmovl.u8 q6, d13 @ P7[8..15] ++ vmla.i16 q8, q14, d0[1] @ 2*P1[0..7]-5*P2[0..7]+5*P3[0..7] ++ vmovl.u8 q14, d18 @ P4[0..7] ++ vmovl.u8 q9, d19 @ P4[8..15] ++ vmla.i16 q7, q15, d0[1] @ 2*P5[0..7]-5*P6[0..7]+5*P7[0..7] ++ vmovl.u8 q15, d11 @ P3[8..15] ++ vshll.u8 q5, d11, #1 @ 2*P3[8..15] ++ vmls.i16 q3, q14, d0[1] @ 2*P3[0..7]-5*P4[0..7] ++ vmla.i16 q2, q15, d0[1] @ 2*P1[8..15]-5*P2[8..15]+5*P3[8..15] ++ vmovl.u8 q15, d22 @ P8[0..7] ++ vmovl.u8 q11, d23 @ P8[8..15] ++ vmla.i16 q10, q6, d0[1] @ 2*P5[8..15]-5*P6[8..15]+5*P7[8..15] ++ vmovl.u8 q6, d2 @ P5[0..7] ++ vmovl.u8 q1, d3 @ P5[8..15] ++ vmls.i16 q5, q9, d0[1] @ 2*P3[8..15]-5*P4[8..15] ++ vmls.i16 q8, q14, d0[0] @ 2*P1[0..7]-5*P2[0..7]+5*P3[0..7]-2*P4[0..7] ++ vmls.i16 q7, q15, d0[0] @ 2*P5[0..7]-5*P6[0..7]+5*P7[0..7]-2*P8[0..7] ++ vsub.i16 q15, q14, q6 @ P4[0..7]-P5[0..7] ++ vmla.i16 q3, q6, d0[1] @ 2*P3[0..7]-5*P4[0..7]+5*P5[0..7] ++ vrshr.s16 q8, q8, #3 ++ vmls.i16 q2, q9, d0[0] @ 2*P1[8..15]-5*P2[8..15]+5*P3[8..15]-2*P4[8..15] ++ vrshr.s16 q7, q7, #3 ++ vmls.i16 q10, q11, d0[0] @ 2*P5[8..15]-5*P6[8..15]+5*P7[8..15]-2*P8[8..15] ++ vabs.s16 q11, q15 ++ vabs.s16 q8, q8 @ a1[0..7] ++ vmla.i16 q5, q1, d0[1] @ 2*P3[8..15]-5*P4[8..15]+5*P5[8..15] ++ vshr.s16 q15, q15, #8 @ clip_sign[0..7] ++ vrshr.s16 q2, q2, #3 ++ vmls.i16 q3, q12, d0[0] @ 2*P3[0..7]-5*P4[0..7]+5*P5[0..7]-2*P6[0..7] ++ vabs.s16 q7, q7 @ a2[0..7] ++ vrshr.s16 q10, q10, #3 ++ vsub.i16 q12, q9, q1 @ P4[8..15]-P5[8..15] ++ vshr.s16 q11, q11, #1 @ clip[0..7] ++ vmls.i16 q5, q4, d0[0] @ 2*P3[8..15]-5*P4[8..15]+5*P5[8..15]-2*P6[8..15] ++ vcge.s16 q4, q8, q7 @ test a1[0..7] >= a2[0..7] ++ vabs.s16 q2, q2 @ a1[8..15] ++ vrshr.s16 q3, q3, #3 ++ vabs.s16 q10, q10 @ a2[8..15] ++ vbsl q4, q7, q8 @ a3[0..7] ++ vabs.s16 q7, q12 ++ vshr.s16 q8, q12, #8 @ clip_sign[8..15] ++ vrshr.s16 q5, q5, #3 ++ vcge.s16 q12, q2, q10 @ test a1[8..15] >= a2[8.15] ++ vshr.s16 q7, q7, #1 @ clip[8..15] ++ vbsl q12, q10, q2 @ a3[8..15] ++ vabs.s16 q2, q3 @ a0[0..7] ++ vceq.i16 q10, q11, #0 @ test clip[0..7] == 0 ++ vshr.s16 q3, q3, #8 @ a0_sign[0..7] ++ vsub.i16 q3, q15, q3 @ clip_sign[0..7] - a0_sign[0..7] ++ vcge.s16 q15, q2, q13 @ test a0[0..7] >= pq ++ vorr q10, q10, q15 @ test clip[0..7] == 0 || a0[0..7] >= pq ++ vqsub.u16 q15, q2, q4 @ a0[0..7] >= a3[0..7] ? a0[0..7]-a3[0..7] : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ vcge.s16 q2, q4, q2 @ test a3[0..7] >= a0[0..7] ++ vabs.s16 q4, q5 @ a0[8..15] ++ vshr.s16 q5, q5, #8 @ a0_sign[8..15] ++ vmul.i16 q15, q15, d0[1] @ a0[0..7] >= a3[0..7] ? 5*(a0[0..7]-a3[0..7]) : 0 ++ vcge.s16 q13, q4, q13 @ test a0[8..15] >= pq ++ vorr q2, q10, q2 @ test clip[0..7] == 0 || a0[0..7] >= pq || a3[0..7] >= a0[0..7] ++ vsub.i16 q5, q8, q5 @ clip_sign[8..15] - a0_sign[8..15] ++ vceq.i16 q8, q7, #0 @ test clip[8..15] == 0 ++ vshr.u16 q15, q15, #3 @ a0[0..7] >= a3[0..7] ? (5*(a0[0..7]-a3[0..7]))>>3 : 0 ++ vmov.32 r0, d4[1] @ move to gp reg ++ vorr q8, q8, q13 @ test clip[8..15] == 0 || a0[8..15] >= pq ++ vqsub.u16 q13, q4, q12 @ a0[8..15] >= a3[8..15] ? a0[8..15]-a3[8..15] : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ vmov.32 r2, d5[1] ++ vcge.s16 q4, q12, q4 @ test a3[8..15] >= a0[8..15] ++ vshl.i64 q2, q2, #16 ++ vcge.s16 q12, q15, q11 ++ vmul.i16 q0, q13, d0[1] @ a0[8..15] >= a3[8..15] ? 5*(a0[8..15]-a3[8..15]) : 0 ++ vorr q4, q8, q4 @ test clip[8..15] == 0 || a0[8..15] >= pq || a3[8..15] >= a0[8..15] ++ vshr.s64 q2, q2, #48 ++ and r0, r0, r2 ++ vbsl q12, q11, q15 @ FFMIN(d[0..7], clip[0..7]) ++ vshl.i64 q11, q4, #16 ++ vmov.32 r2, d8[1] ++ vshr.u16 q0, q0, #3 @ a0[8..15] >= a3[8..15] ? (5*(a0[8..15]-a3[8..15]))>>3 : 0 ++ vorr q2, q10, q2 ++ vmov.32 r12, d9[1] ++ vshr.s64 q4, q11, #48 ++ vcge.s16 q10, q0, q7 ++ vbic q2, q12, q2 @ set each d[0..7] to zero if it should not be filtered because clip[0..7] == 0 || a0[0..7] >= pq (a3 > a0 case already zeroed by saturating sub) ++ vorr q4, q8, q4 ++ and r2, r2, r12 ++ vbsl q10, q7, q0 @ FFMIN(d[8..15], clip[8..15]) ++ vmls.i16 q14, q2, q3 @ invert d[0..7] depending on clip_sign[0..7] & a0_sign[0..7], or zero it if they match, and accumulate into P4[0..7] ++ and r0, r0, r2 ++ vbic q0, q10, q4 @ set each d[8..15] to zero if it should not be filtered because clip[8..15] == 0 || a0[8..15] >= pq (a3 > a0 case already zeroed by saturating sub) ++ tst r0, #1 ++ bne 1f @ none of the 16 pixel pairs should be updated in this case ++ vmla.i16 q6, q2, q3 @ invert d[0..7] depending on clip_sign[0..7] & a0_sign[0..7], or zero it if they match, and accumulate into P5[0..7] ++ vmls.i16 q9, q0, q5 @ invert d[8..15] depending on clip_sign[8..15] & a0_sign[8..15], or zero it if they match, and accumulate into P4[8..15] ++ vqmovun.s16 d4, q14 ++ vmla.i16 q1, q0, q5 @ invert d[8..15] depending on clip_sign[8..15] & a0_sign[8..15], or zero it if they match, and accumulate into P5[8..15] ++ vqmovun.s16 d0, q6 ++ vqmovun.s16 d5, q9 ++ vqmovun.s16 d1, q1 ++ vst1.64 {q2}, [r3 :128], r1 ++ vst1.64 {q0}, [r3 :128] ++1: vpop {d8-d15} ++ bx lr ++endfunc ++ ++@ VC-1 in-loop deblocking filter for 16 pixel pairs at boundary of horizontally-neighbouring blocks ++@ On entry: ++@ r0 -> top-left pel of right block ++@ r1 = row stride, bytes ++@ r2 = PQUANT bitstream parameter ++function ff_vc1_h_loop_filter16_neon, export=1 ++ push {r4-r6,lr} ++ vpush {d8-d15} ++ sub r3, r0, #4 @ where to start reading ++ vldr d0, .Lcoeffs ++ vld1.32 {d2}, [r3], r1 @ P1[0], P2[0]... ++ sub r0, r0, #1 @ where to start writing ++ vld1.32 {d3}, [r3], r1 ++ add r4, r0, r1, lsl #2 ++ vld1.32 {d10}, [r3], r1 ++ vld1.32 {d11}, [r3], r1 ++ vld1.32 {d16}, [r3], r1 ++ vld1.32 {d4}, [r3], r1 ++ vld1.32 {d8}, [r3], r1 ++ vtrn.8 d2, d3 @ P1[0], P1[1], P3[0]... P2[0], P2[1], P4[0]... ++ vld1.32 {d14}, [r3], r1 ++ vld1.32 {d5}, [r3], r1 ++ vtrn.8 d10, d11 @ P1[2], P1[3], P3[2]... P2[2], P2[3], P4[2]... ++ vld1.32 {d6}, [r3], r1 ++ vld1.32 {d12}, [r3], r1 ++ vtrn.8 d16, d4 @ P1[4], P1[5], P3[4]... P2[4], P2[5], P4[4]... ++ vld1.32 {d13}, [r3], r1 ++ vtrn.16 d2, d10 @ P1[0], P1[1], P1[2], P1[3], P5[0]... P3[0], P3[1], P3[2], P3[3], P7[0]... ++ vld1.32 {d1}, [r3], r1 ++ vtrn.8 d8, d14 @ P1[6], P1[7], P3[6]... P2[6], P2[7], P4[6]... ++ vld1.32 {d7}, [r3], r1 ++ vtrn.16 d3, d11 @ P2[0], P2[1], P2[2], P2[3], P6[0]... P4[0], P4[1], P4[2], P4[3], P8[0]... ++ vld1.32 {d9}, [r3], r1 ++ vtrn.8 d5, d6 @ P1[8], P1[9], P3[8]... P2[8], P2[9], P4[8]... ++ vld1.32 {d15}, [r3] ++ vtrn.16 d16, d8 @ P1[4], P1[5], P1[6], P1[7], P5[4]... P3[4], P3[5], P3[6], P3[7], P7[4]... ++ vtrn.16 d4, d14 @ P2[4], P2[5], P2[6], P2[7], P6[4]... P4[4], P4[5], P4[6], P4[7], P8[4]... ++ vtrn.8 d12, d13 @ P1[10], P1[11], P3[10]... P2[10], P2[11], P4[10]... ++ vdup.16 q9, r2 @ pq ++ vtrn.8 d1, d7 @ P1[12], P1[13], P3[12]... P2[12], P2[13], P4[12]... ++ vtrn.32 d2, d16 @ P1[0..7], P5[0..7] ++ vtrn.16 d5, d12 @ P1[8], P1[7], P1[10], P1[11], P5[8]... P3[8], P3[9], P3[10], P3[11], P7[8]... ++ vtrn.16 d6, d13 @ P2[8], P2[7], P2[10], P2[11], P6[8]... P4[8], P4[9], P4[10], P4[11], P8[8]... ++ vtrn.8 d9, d15 @ P1[14], P1[15], P3[14]... P2[14], P2[15], P4[14]... ++ vtrn.32 d3, d4 @ P2[0..7], P6[0..7] ++ vshll.u8 q10, d2, #1 @ 2*P1[0..7] ++ vtrn.32 d10, d8 @ P3[0..7], P7[0..7] ++ vshll.u8 q11, d16, #1 @ 2*P5[0..7] ++ vtrn.32 d11, d14 @ P4[0..7], P8[0..7] ++ vtrn.16 d1, d9 @ P1[12], P1[13], P1[14], P1[15], P5[12]... P3[12], P3[13], P3[14], P3[15], P7[12]... ++ vtrn.16 d7, d15 @ P2[12], P2[13], P2[14], P2[15], P6[12]... P4[12], P4[13], P4[14], P4[15], P8[12]... ++ vmovl.u8 q1, d3 @ P2[0..7] ++ vmovl.u8 q12, d4 @ P6[0..7] ++ vtrn.32 d5, d1 @ P1[8..15], P5[8..15] ++ vtrn.32 d6, d7 @ P2[8..15], P6[8..15] ++ vtrn.32 d12, d9 @ P3[8..15], P7[8..15] ++ vtrn.32 d13, d15 @ P4[8..15], P8[8..15] ++ vmls.i16 q10, q1, d0[1] @ 2*P1[0..7]-5*P2[0..7] ++ vmovl.u8 q1, d10 @ P3[0..7] ++ vshll.u8 q2, d5, #1 @ 2*P1[8..15] ++ vshll.u8 q13, d1, #1 @ 2*P5[8..15] ++ vmls.i16 q11, q12, d0[1] @ 2*P5[0..7]-5*P6[0..7] ++ vmovl.u8 q14, d6 @ P2[8..15] ++ vmovl.u8 q3, d7 @ P6[8..15] ++ vmovl.u8 q15, d8 @ P7[0..7] ++ vmla.i16 q10, q1, d0[1] @ 2*P1[0..7]-5*P2[0..7]+5*P3[0..7] ++ vmovl.u8 q1, d12 @ P3[8..15] ++ vmls.i16 q2, q14, d0[1] @ 2*P1[8..15]-5*P2[8..15] ++ vmovl.u8 q4, d9 @ P7[8..15] ++ vshll.u8 q14, d10, #1 @ 2*P3[0..7] ++ vmls.i16 q13, q3, d0[1] @ 2*P5[8..15]-5*P6[8..15] ++ vmovl.u8 q5, d11 @ P4[0..7] ++ vmla.i16 q11, q15, d0[1] @ 2*P5[0..7]-5*P6[0..7]+5*P7[0..7] ++ vshll.u8 q15, d12, #1 @ 2*P3[8..15] ++ vmovl.u8 q6, d13 @ P4[8..15] ++ vmla.i16 q2, q1, d0[1] @ 2*P1[8..15]-5*P2[8..15]+5*P3[8..15] ++ vmovl.u8 q1, d14 @ P8[0..7] ++ vmovl.u8 q7, d15 @ P8[8..15] ++ vmla.i16 q13, q4, d0[1] @ 2*P5[8..15]-5*P6[8..15]+5*P7[8..15] ++ vmovl.u8 q4, d16 @ P5[0..7] ++ vmovl.u8 q8, d1 @ P5[8..15] ++ vmls.i16 q14, q5, d0[1] @ 2*P3[0..7]-5*P4[0..7] ++ vmls.i16 q15, q6, d0[1] @ 2*P3[8..15]-5*P4[8..15] ++ vmls.i16 q10, q5, d0[0] @ 2*P1[0..7]-5*P2[0..7]+5*P3[0..7]-2*P4[0..7] ++ vmls.i16 q11, q1, d0[0] @ 2*P5[0..7]-5*P6[0..7]+5*P7[0..7]-2*P8[0..7] ++ vsub.i16 q1, q5, q4 @ P4[0..7]-P5[0..7] ++ vmls.i16 q2, q6, d0[0] @ 2*P1[8..15]-5*P2[8..15]+5*P3[8..15]-2*P4[8..15] ++ vrshr.s16 q10, q10, #3 ++ vmls.i16 q13, q7, d0[0] @ 2*P5[8..15]-5*P6[8..15]+5*P7[8..15]-2*P8[8..15] ++ vsub.i16 q7, q6, q8 @ P4[8..15]-P5[8..15] ++ vrshr.s16 q11, q11, #3 ++ vmla.s16 q14, q4, d0[1] @ 2*P3[0..7]-5*P4[0..7]+5*P5[0..7] ++ vrshr.s16 q2, q2, #3 ++ vmla.i16 q15, q8, d0[1] @ 2*P3[8..15]-5*P4[8..15]+5*P5[8..15] ++ vabs.s16 q10, q10 @ a1[0..7] ++ vrshr.s16 q13, q13, #3 ++ vmls.i16 q15, q3, d0[0] @ 2*P3[8..15]-5*P4[8..15]+5*P5[8..15]-2*P6[8..15] ++ vabs.s16 q3, q11 @ a2[0..7] ++ vabs.s16 q2, q2 @ a1[8..15] ++ vmls.i16 q14, q12, d0[0] @ 2*P3[0..7]-5*P4[0..7]+5*P5[0..7]-2*P6[0..7] ++ vabs.s16 q11, q1 ++ vabs.s16 q12, q13 @ a2[8..15] ++ vcge.s16 q13, q10, q3 @ test a1[0..7] >= a2[0..7] ++ vshr.s16 q1, q1, #8 @ clip_sign[0..7] ++ vrshr.s16 q15, q15, #3 ++ vshr.s16 q11, q11, #1 @ clip[0..7] ++ vrshr.s16 q14, q14, #3 ++ vbsl q13, q3, q10 @ a3[0..7] ++ vcge.s16 q3, q2, q12 @ test a1[8..15] >= a2[8.15] ++ vabs.s16 q10, q15 @ a0[8..15] ++ vshr.s16 q15, q15, #8 @ a0_sign[8..15] ++ vbsl q3, q12, q2 @ a3[8..15] ++ vabs.s16 q2, q14 @ a0[0..7] ++ vabs.s16 q12, q7 ++ vshr.s16 q7, q7, #8 @ clip_sign[8..15] ++ vshr.s16 q14, q14, #8 @ a0_sign[0..7] ++ vshr.s16 q12, q12, #1 @ clip[8..15] ++ vsub.i16 q7, q7, q15 @ clip_sign[8..15] - a0_sign[8..15] ++ vqsub.u16 q15, q10, q3 @ a0[8..15] >= a3[8..15] ? a0[8..15]-a3[8..15] : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ vcge.s16 q3, q3, q10 @ test a3[8..15] >= a0[8..15] ++ vcge.s16 q10, q10, q9 @ test a0[8..15] >= pq ++ vcge.s16 q9, q2, q9 @ test a0[0..7] >= pq ++ vsub.i16 q1, q1, q14 @ clip_sign[0..7] - a0_sign[0..7] ++ vqsub.u16 q14, q2, q13 @ a0[0..7] >= a3[0..7] ? a0[0..7]-a3[0..7] : 0 (a0 > a3 in all cases where filtering is enabled, so makes more sense to subtract this way round than the opposite and then taking the abs) ++ vcge.s16 q2, q13, q2 @ test a3[0..7] >= a0[0..7] ++ vmul.i16 q13, q15, d0[1] @ a0[8..15] >= a3[8..15] ? 5*(a0[8..15]-a3[8..15]) : 0 ++ vceq.i16 q15, q11, #0 @ test clip[0..7] == 0 ++ vmul.i16 q0, q14, d0[1] @ a0[0..7] >= a3[0..7] ? 5*(a0[0..7]-a3[0..7]) : 0 ++ vorr q9, q15, q9 @ test clip[0..7] == 0 || a0[0..7] >= pq ++ vceq.i16 q14, q12, #0 @ test clip[8..15] == 0 ++ vshr.u16 q13, q13, #3 @ a0[8..15] >= a3[8..15] ? (5*(a0[8..15]-a3[8..15]))>>3 : 0 ++ vorr q2, q9, q2 @ test clip[0..7] == 0 || a0[0..7] >= pq || a3[0..7] >= a0[0..7] ++ vshr.u16 q0, q0, #3 @ a0[0..7] >= a3[0..7] ? (5*(a0[0..7]-a3[0..7]))>>3 : 0 ++ vorr q10, q14, q10 @ test clip[8..15] == 0 || a0[8..15] >= pq ++ vcge.s16 q14, q13, q12 ++ vmov.32 r2, d4[1] @ move to gp reg ++ vorr q3, q10, q3 @ test clip[8..15] == 0 || a0[8..15] >= pq || a3[8..15] >= a0[8..15] ++ vmov.32 r3, d5[1] ++ vcge.s16 q2, q0, q11 ++ vbsl q14, q12, q13 @ FFMIN(d[8..15], clip[8..15]) ++ vbsl q2, q11, q0 @ FFMIN(d[0..7], clip[0..7]) ++ vmov.32 r5, d6[1] ++ vbic q0, q14, q10 @ set each d[8..15] to zero if it should not be filtered because clip[8..15] == 0 || a0[8..15] >= pq (a3 > a0 case already zeroed by saturating sub) ++ vmov.32 r6, d7[1] ++ and r12, r2, r3 ++ vbic q2, q2, q9 @ set each d[0..7] to zero if it should not be filtered because clip[0..7] == 0 || a0[0..7] >= pq (a3 > a0 case already zeroed by saturating sub) ++ vmls.i16 q6, q0, q7 @ invert d[8..15] depending on clip_sign[8..15] & a0_sign[8..15], or zero it if they match, and accumulate into P4 ++ vmls.i16 q5, q2, q1 @ invert d[0..7] depending on clip_sign[0..7] & a0_sign[0..7], or zero it if they match, and accumulate into P4 ++ and r14, r5, r6 ++ vmla.i16 q4, q2, q1 @ invert d[0..7] depending on clip_sign[0..7] & a0_sign[0..7], or zero it if they match, and accumulate into P5 ++ and r12, r12, r14 ++ vqmovun.s16 d4, q6 ++ vmla.i16 q8, q0, q7 @ invert d[8..15] depending on clip_sign[8..15] & a0_sign[8..15], or zero it if they match, and accumulate into P5 ++ tst r12, #1 ++ bne 4f @ none of the 16 pixel pairs should be updated in this case ++ vqmovun.s16 d2, q5 ++ vqmovun.s16 d3, q4 ++ vqmovun.s16 d5, q8 ++ tst r2, #1 ++ bne 1f ++ vst2.8 {d2[0], d3[0]}, [r0], r1 ++ vst2.8 {d2[1], d3[1]}, [r0], r1 ++ vst2.8 {d2[2], d3[2]}, [r0], r1 ++ vst2.8 {d2[3], d3[3]}, [r0] ++1: add r0, r4, r1, lsl #2 ++ tst r3, #1 ++ bne 2f ++ vst2.8 {d2[4], d3[4]}, [r4], r1 ++ vst2.8 {d2[5], d3[5]}, [r4], r1 ++ vst2.8 {d2[6], d3[6]}, [r4], r1 ++ vst2.8 {d2[7], d3[7]}, [r4] ++2: add r4, r0, r1, lsl #2 ++ tst r5, #1 ++ bne 3f ++ vst2.8 {d4[0], d5[0]}, [r0], r1 ++ vst2.8 {d4[1], d5[1]}, [r0], r1 ++ vst2.8 {d4[2], d5[2]}, [r0], r1 ++ vst2.8 {d4[3], d5[3]}, [r0] ++3: tst r6, #1 ++ bne 4f ++ vst2.8 {d4[4], d5[4]}, [r4], r1 ++ vst2.8 {d4[5], d5[5]}, [r4], r1 ++ vst2.8 {d4[6], d5[6]}, [r4], r1 ++ vst2.8 {d4[7], d5[7]}, [r4] ++4: vpop {d8-d15} ++ pop {r4-r6,pc} ++endfunc ++ ++@ Copy at most the specified number of bytes from source to destination buffer, ++@ stopping at a multiple of 16 bytes, none of which are the start of an escape sequence ++@ On entry: ++@ r0 -> source buffer ++@ r1 = max number of bytes to copy ++@ r2 -> destination buffer, optimally 8-byte aligned ++@ On exit: ++@ r0 = number of bytes not copied ++function ff_vc1_unescape_buffer_helper_neon, export=1 ++ @ Offset by 48 to screen out cases that are too short for us to handle, ++ @ and also make it easy to test for loop termination, or to determine ++ @ whether we need an odd number of half-iterations of the loop. ++ subs r1, r1, #48 ++ bmi 90f ++ ++ @ Set up useful constants ++ vmov.i32 q0, #0x3000000 ++ vmov.i32 q1, #0x30000 ++ ++ tst r1, #16 ++ bne 1f ++ ++ vld1.8 {q8, q9}, [r0]! ++ vbic q12, q8, q0 ++ vext.8 q13, q8, q9, #1 ++ vext.8 q14, q8, q9, #2 ++ vext.8 q15, q8, q9, #3 ++ veor q12, q12, q1 ++ vbic q13, q13, q0 ++ vbic q14, q14, q0 ++ vbic q15, q15, q0 ++ vceq.i32 q12, q12, #0 ++ veor q13, q13, q1 ++ veor q14, q14, q1 ++ veor q15, q15, q1 ++ vceq.i32 q13, q13, #0 ++ vceq.i32 q14, q14, #0 ++ vceq.i32 q15, q15, #0 ++ add r1, r1, #16 ++ b 3f ++ ++1: vld1.8 {q10, q11}, [r0]! ++ vbic q12, q10, q0 ++ vext.8 q13, q10, q11, #1 ++ vext.8 q14, q10, q11, #2 ++ vext.8 q15, q10, q11, #3 ++ veor q12, q12, q1 ++ vbic q13, q13, q0 ++ vbic q14, q14, q0 ++ vbic q15, q15, q0 ++ vceq.i32 q12, q12, #0 ++ veor q13, q13, q1 ++ veor q14, q14, q1 ++ veor q15, q15, q1 ++ vceq.i32 q13, q13, #0 ++ vceq.i32 q14, q14, #0 ++ vceq.i32 q15, q15, #0 ++ @ Drop through... ++2: vmov q8, q11 ++ vld1.8 {q9}, [r0]! ++ vorr q13, q12, q13 ++ vorr q15, q14, q15 ++ vbic q12, q8, q0 ++ vorr q3, q13, q15 ++ vext.8 q13, q8, q9, #1 ++ vext.8 q14, q8, q9, #2 ++ vext.8 q15, q8, q9, #3 ++ veor q12, q12, q1 ++ vorr d6, d6, d7 ++ vbic q13, q13, q0 ++ vbic q14, q14, q0 ++ vbic q15, q15, q0 ++ vceq.i32 q12, q12, #0 ++ vmov r3, r12, d6 ++ veor q13, q13, q1 ++ veor q14, q14, q1 ++ veor q15, q15, q1 ++ vceq.i32 q13, q13, #0 ++ vceq.i32 q14, q14, #0 ++ vceq.i32 q15, q15, #0 ++ orrs r3, r3, r12 ++ bne 90f ++ vst1.64 {q10}, [r2]! ++3: vmov q10, q9 ++ vld1.8 {q11}, [r0]! ++ vorr q13, q12, q13 ++ vorr q15, q14, q15 ++ vbic q12, q10, q0 ++ vorr q3, q13, q15 ++ vext.8 q13, q10, q11, #1 ++ vext.8 q14, q10, q11, #2 ++ vext.8 q15, q10, q11, #3 ++ veor q12, q12, q1 ++ vorr d6, d6, d7 ++ vbic q13, q13, q0 ++ vbic q14, q14, q0 ++ vbic q15, q15, q0 ++ vceq.i32 q12, q12, #0 ++ vmov r3, r12, d6 ++ veor q13, q13, q1 ++ veor q14, q14, q1 ++ veor q15, q15, q1 ++ vceq.i32 q13, q13, #0 ++ vceq.i32 q14, q14, #0 ++ vceq.i32 q15, q15, #0 ++ orrs r3, r3, r12 ++ bne 91f ++ vst1.64 {q8}, [r2]! ++ subs r1, r1, #32 ++ bpl 2b ++ ++90: add r0, r1, #48 ++ bx lr ++ ++91: sub r1, r1, #16 ++ b 90b ++endfunc +--- a/libavcodec/avcodec.h ++++ b/libavcodec/avcodec.h +@@ -2567,6 +2567,17 @@ typedef struct AVHWAccel { + * that avctx->hwaccel_priv_data is invalid. + */ + int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx); ++ ++ /** ++ * Called if parsing fails ++ * ++ * An error has occured, end_frame will not be called ++ * start_frame & decode_slice may or may not have been called ++ * Optional ++ * ++ * @param avctx the codec context ++ */ ++ void (*abort_frame)(AVCodecContext *avctx); + } AVHWAccel; + + /** +--- a/libavcodec/cabac.h ++++ b/libavcodec/cabac.h +@@ -43,7 +43,14 @@ extern const uint8_t ff_h264_cabac_table + typedef struct CABACContext{ + int low; + int range; +- int outstanding_count; ++ union ++ { ++ int outstanding_count; ++ struct { ++ uint16_t bits; ++ uint16_t range; ++ } by22; ++ }; + const uint8_t *bytestream_start; + const uint8_t *bytestream; + const uint8_t *bytestream_end; +--- a/libavcodec/codec.h ++++ b/libavcodec/codec.h +@@ -350,6 +350,17 @@ const AVCodec *av_codec_iterate(void **o + AVCodec *avcodec_find_decoder(enum AVCodecID id); + + /** ++ * Find a registered decoder with a matching codec ID and pix_fmt. ++ * A decoder will pix_fmt set to NULL will match any fmt. ++ * A fmt of AV_PIX_FMT_NONE will only match a decoder will px_fmt NULL. ++ * ++ * @param id AVCodecID of the requested decoder ++ * @param fmt AVPixelForma that msut be supported by decoder ++ * @return A decoder if one was found, NULL otherwise. ++ */ ++AVCodec *avcodec_find_decoder_by_id_and_fmt(enum AVCodecID id, enum AVPixelFormat fmt); ++ ++/** + * Find a registered decoder with the specified name. + * + * @param name name of the requested decoder +--- /dev/null ++++ b/libavcodec/hevc-ctrls-v1.h +@@ -0,0 +1,229 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * These are the HEVC state controls for use with stateless HEVC ++ * codec drivers. ++ * ++ * It turns out that these structs are not stable yet and will undergo ++ * more changes. So keep them private until they are stable and ready to ++ * become part of the official public API. ++ */ ++ ++#ifndef _HEVC_CTRLS_H_ ++#define _HEVC_CTRLS_H_ ++ ++#include ++ ++/* The pixel format isn't stable at the moment and will likely be renamed. */ ++#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */ ++ ++#define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_MPEG_BASE + 1008) ++#define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_MPEG_BASE + 1009) ++#define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_MPEG_BASE + 1010) ++#define V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX (V4L2_CID_MPEG_BASE + 1011) ++#define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (V4L2_CID_MPEG_BASE + 1015) ++#define V4L2_CID_MPEG_VIDEO_HEVC_START_CODE (V4L2_CID_MPEG_BASE + 1016) ++ ++/* enum v4l2_ctrl_type type values */ ++#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120 ++#define V4L2_CTRL_TYPE_HEVC_PPS 0x0121 ++#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122 ++#define V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX 0x0123 ++ ++enum v4l2_mpeg_video_hevc_decode_mode { ++ V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, ++ V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, ++}; ++ ++enum v4l2_mpeg_video_hevc_start_code { ++ V4L2_MPEG_VIDEO_HEVC_START_CODE_NONE, ++ V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, ++}; ++ ++#define V4L2_HEVC_SLICE_TYPE_B 0 ++#define V4L2_HEVC_SLICE_TYPE_P 1 ++#define V4L2_HEVC_SLICE_TYPE_I 2 ++ ++#define V4L2_HEVC_SPS_FLAG_SEPARATE_COLOUR_PLANE (1ULL << 0) ++#define V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED (1ULL << 1) ++#define V4L2_HEVC_SPS_FLAG_AMP_ENABLED (1ULL << 2) ++#define V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET (1ULL << 3) ++#define V4L2_HEVC_SPS_FLAG_PCM_ENABLED (1ULL << 4) ++#define V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED (1ULL << 5) ++#define V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT (1ULL << 6) ++#define V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED (1ULL << 7) ++#define V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED (1ULL << 8) ++ ++/* The controls are not stable at the moment and will likely be reworked. */ ++struct v4l2_ctrl_hevc_sps { ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */ ++ __u16 pic_width_in_luma_samples; ++ __u16 pic_height_in_luma_samples; ++ __u8 bit_depth_luma_minus8; ++ __u8 bit_depth_chroma_minus8; ++ __u8 log2_max_pic_order_cnt_lsb_minus4; ++ __u8 sps_max_dec_pic_buffering_minus1; ++ __u8 sps_max_num_reorder_pics; ++ __u8 sps_max_latency_increase_plus1; ++ __u8 log2_min_luma_coding_block_size_minus3; ++ __u8 log2_diff_max_min_luma_coding_block_size; ++ __u8 log2_min_luma_transform_block_size_minus2; ++ __u8 log2_diff_max_min_luma_transform_block_size; ++ __u8 max_transform_hierarchy_depth_inter; ++ __u8 max_transform_hierarchy_depth_intra; ++ __u8 pcm_sample_bit_depth_luma_minus1; ++ __u8 pcm_sample_bit_depth_chroma_minus1; ++ __u8 log2_min_pcm_luma_coding_block_size_minus3; ++ __u8 log2_diff_max_min_pcm_luma_coding_block_size; ++ __u8 num_short_term_ref_pic_sets; ++ __u8 num_long_term_ref_pics_sps; ++ __u8 chroma_format_idc; ++ __u8 sps_max_sub_layers_minus1; ++ ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 0) ++#define V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT (1ULL << 1) ++#define V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED (1ULL << 2) ++#define V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT (1ULL << 3) ++#define V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED (1ULL << 4) ++#define V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED (1ULL << 5) ++#define V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED (1ULL << 6) ++#define V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT (1ULL << 7) ++#define V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED (1ULL << 8) ++#define V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED (1ULL << 9) ++#define V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED (1ULL << 10) ++#define V4L2_HEVC_PPS_FLAG_TILES_ENABLED (1ULL << 11) ++#define V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED (1ULL << 12) ++#define V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED (1ULL << 13) ++#define V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 14) ++#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED (1ULL << 15) ++#define V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER (1ULL << 16) ++#define V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT (1ULL << 17) ++#define V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT (1ULL << 18) ++ ++struct v4l2_ctrl_hevc_pps { ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */ ++ __u8 num_extra_slice_header_bits; ++ __s8 init_qp_minus26; ++ __u8 diff_cu_qp_delta_depth; ++ __s8 pps_cb_qp_offset; ++ __s8 pps_cr_qp_offset; ++ __u8 num_tile_columns_minus1; ++ __u8 num_tile_rows_minus1; ++ __u8 column_width_minus1[20]; ++ __u8 row_height_minus1[22]; ++ __s8 pps_beta_offset_div2; ++ __s8 pps_tc_offset_div2; ++ __u8 log2_parallel_merge_level_minus2; ++ ++ __u8 padding[4]; ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE 0x01 ++#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_AFTER 0x02 ++#define V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR 0x03 ++ ++#define V4L2_HEVC_DPB_ENTRIES_NUM_MAX 16 ++ ++struct v4l2_hevc_dpb_entry { ++ __u64 timestamp; ++ __u8 rps; ++ __u8 field_pic; ++ __u16 pic_order_cnt[2]; ++ __u8 padding[2]; ++}; ++ ++struct v4l2_hevc_pred_weight_table { ++ __s8 delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ __s8 chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ ++ __s8 delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ __s8 chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ ++ __u8 padding[6]; ++ ++ __u8 luma_log2_weight_denom; ++ __s8 delta_chroma_log2_weight_denom; ++}; ++ ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_LUMA (1ULL << 0) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_CHROMA (1ULL << 1) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_TEMPORAL_MVP_ENABLED (1ULL << 2) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_MVD_L1_ZERO (1ULL << 3) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_CABAC_INIT (1ULL << 4) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_COLLOCATED_FROM_L0 (1ULL << 5) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_USE_INTEGER_MV (1ULL << 6) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED (1ULL << 7) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9) ++ ++struct v4l2_ctrl_hevc_slice_params { ++ __u32 bit_size; ++ __u32 data_bit_offset; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u32 slice_segment_addr; ++ __u32 num_entry_point_offsets; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */ ++ __u8 nal_unit_type; ++ __u8 nuh_temporal_id_plus1; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u8 slice_type; ++ __u8 colour_plane_id; ++ __u16 slice_pic_order_cnt; ++ __u8 num_ref_idx_l0_active_minus1; ++ __u8 num_ref_idx_l1_active_minus1; ++ __u8 collocated_ref_idx; ++ __u8 five_minus_max_num_merge_cand; ++ __s8 slice_qp_delta; ++ __s8 slice_cb_qp_offset; ++ __s8 slice_cr_qp_offset; ++ __s8 slice_act_y_qp_offset; ++ __s8 slice_act_cb_qp_offset; ++ __s8 slice_act_cr_qp_offset; ++ __s8 slice_beta_offset_div2; ++ __s8 slice_tc_offset_div2; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture timing SEI message */ ++ __u8 pic_struct; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u8 num_active_dpb_entries; ++ __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ ++ __u8 num_rps_poc_st_curr_before; ++ __u8 num_rps_poc_st_curr_after; ++ __u8 num_rps_poc_lt_curr; ++ ++ __u8 padding; ++ ++ __u32 entry_point_offset_minus1[256]; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */ ++ struct v4l2_hevc_pred_weight_table pred_weight_table; ++ ++ __u64 flags; ++}; ++ ++struct v4l2_ctrl_hevc_scaling_matrix { ++ __u8 scaling_list_4x4[6][16]; ++ __u8 scaling_list_8x8[6][64]; ++ __u8 scaling_list_16x16[6][64]; ++ __u8 scaling_list_32x32[2][64]; ++ __u8 scaling_list_dc_coef_16x16[6]; ++ __u8 scaling_list_dc_coef_32x32[2]; ++}; ++ ++#endif +--- /dev/null ++++ b/libavcodec/hevc-ctrls-v2.h +@@ -0,0 +1,257 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * These are the HEVC state controls for use with stateless HEVC ++ * codec drivers. ++ * ++ * It turns out that these structs are not stable yet and will undergo ++ * more changes. So keep them private until they are stable and ready to ++ * become part of the official public API. ++ */ ++ ++#ifndef _HEVC_CTRLS_H_ ++#define _HEVC_CTRLS_H_ ++ ++#include ++ ++/* The pixel format isn't stable at the moment and will likely be renamed. */ ++#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */ ++ ++#define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_CODEC_BASE + 1008) ++#define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_CODEC_BASE + 1009) ++#define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_CODEC_BASE + 1010) ++#define V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX (V4L2_CID_CODEC_BASE + 1011) ++#define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_BASE + 1012) ++#define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE + 1015) ++#define V4L2_CID_MPEG_VIDEO_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016) ++ ++/* enum v4l2_ctrl_type type values */ ++#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120 ++#define V4L2_CTRL_TYPE_HEVC_PPS 0x0121 ++#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122 ++#define V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX 0x0123 ++#define V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS 0x0124 ++ ++enum v4l2_mpeg_video_hevc_decode_mode { ++ V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, ++ V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, ++}; ++ ++enum v4l2_mpeg_video_hevc_start_code { ++ V4L2_MPEG_VIDEO_HEVC_START_CODE_NONE, ++ V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, ++}; ++ ++#define V4L2_HEVC_SLICE_TYPE_B 0 ++#define V4L2_HEVC_SLICE_TYPE_P 1 ++#define V4L2_HEVC_SLICE_TYPE_I 2 ++ ++#define V4L2_HEVC_SPS_FLAG_SEPARATE_COLOUR_PLANE (1ULL << 0) ++#define V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED (1ULL << 1) ++#define V4L2_HEVC_SPS_FLAG_AMP_ENABLED (1ULL << 2) ++#define V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET (1ULL << 3) ++#define V4L2_HEVC_SPS_FLAG_PCM_ENABLED (1ULL << 4) ++#define V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED (1ULL << 5) ++#define V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT (1ULL << 6) ++#define V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED (1ULL << 7) ++#define V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED (1ULL << 8) ++ ++/* The controls are not stable at the moment and will likely be reworked. */ ++struct v4l2_ctrl_hevc_sps { ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */ ++ __u16 pic_width_in_luma_samples; ++ __u16 pic_height_in_luma_samples; ++ __u8 bit_depth_luma_minus8; ++ __u8 bit_depth_chroma_minus8; ++ __u8 log2_max_pic_order_cnt_lsb_minus4; ++ __u8 sps_max_dec_pic_buffering_minus1; ++ __u8 sps_max_num_reorder_pics; ++ __u8 sps_max_latency_increase_plus1; ++ __u8 log2_min_luma_coding_block_size_minus3; ++ __u8 log2_diff_max_min_luma_coding_block_size; ++ __u8 log2_min_luma_transform_block_size_minus2; ++ __u8 log2_diff_max_min_luma_transform_block_size; ++ __u8 max_transform_hierarchy_depth_inter; ++ __u8 max_transform_hierarchy_depth_intra; ++ __u8 pcm_sample_bit_depth_luma_minus1; ++ __u8 pcm_sample_bit_depth_chroma_minus1; ++ __u8 log2_min_pcm_luma_coding_block_size_minus3; ++ __u8 log2_diff_max_min_pcm_luma_coding_block_size; ++ __u8 num_short_term_ref_pic_sets; ++ __u8 num_long_term_ref_pics_sps; ++ __u8 chroma_format_idc; ++ __u8 sps_max_sub_layers_minus1; ++ ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED (1ULL << 0) ++#define V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT (1ULL << 1) ++#define V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED (1ULL << 2) ++#define V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT (1ULL << 3) ++#define V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED (1ULL << 4) ++#define V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED (1ULL << 5) ++#define V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED (1ULL << 6) ++#define V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT (1ULL << 7) ++#define V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED (1ULL << 8) ++#define V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED (1ULL << 9) ++#define V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED (1ULL << 10) ++#define V4L2_HEVC_PPS_FLAG_TILES_ENABLED (1ULL << 11) ++#define V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED (1ULL << 12) ++#define V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED (1ULL << 13) ++#define V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 14) ++#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED (1ULL << 15) ++#define V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER (1ULL << 16) ++#define V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT (1ULL << 17) ++#define V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT (1ULL << 18) ++#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT (1ULL << 19) ++#define V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING (1ULL << 20) ++ ++struct v4l2_ctrl_hevc_pps { ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */ ++ __u8 num_extra_slice_header_bits; ++ __u8 num_ref_idx_l0_default_active_minus1; ++ __u8 num_ref_idx_l1_default_active_minus1; ++ __s8 init_qp_minus26; ++ __u8 diff_cu_qp_delta_depth; ++ __s8 pps_cb_qp_offset; ++ __s8 pps_cr_qp_offset; ++ __u8 num_tile_columns_minus1; ++ __u8 num_tile_rows_minus1; ++ __u8 column_width_minus1[20]; ++ __u8 row_height_minus1[22]; ++ __s8 pps_beta_offset_div2; ++ __s8 pps_tc_offset_div2; ++ __u8 log2_parallel_merge_level_minus2; ++ ++ __u8 padding[4]; ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE 0x01 ++#define V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_AFTER 0x02 ++#define V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR 0x03 ++ ++#define V4L2_HEVC_DPB_ENTRIES_NUM_MAX 16 ++ ++struct v4l2_hevc_dpb_entry { ++ __u64 timestamp; ++ __u8 rps; ++ __u8 field_pic; ++ __u16 pic_order_cnt[2]; ++ __u8 padding[2]; ++}; ++ ++struct v4l2_hevc_pred_weight_table { ++ __s8 delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ __s8 chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ ++ __s8 delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ __s8 chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ ++ __u8 padding[6]; ++ ++ __u8 luma_log2_weight_denom; ++ __s8 delta_chroma_log2_weight_denom; ++}; ++ ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_LUMA (1ULL << 0) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_CHROMA (1ULL << 1) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_TEMPORAL_MVP_ENABLED (1ULL << 2) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_MVD_L1_ZERO (1ULL << 3) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_CABAC_INIT (1ULL << 4) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_COLLOCATED_FROM_L0 (1ULL << 5) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_USE_INTEGER_MV (1ULL << 6) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED (1ULL << 7) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9) ++ ++struct v4l2_ctrl_hevc_slice_params { ++ __u32 bit_size; ++ __u32 data_bit_offset; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u32 slice_segment_addr; ++ __u32 num_entry_point_offsets; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */ ++ __u8 nal_unit_type; ++ __u8 nuh_temporal_id_plus1; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u8 slice_type; ++ __u8 colour_plane_id; ++ __u16 slice_pic_order_cnt; ++ __u8 num_ref_idx_l0_active_minus1; ++ __u8 num_ref_idx_l1_active_minus1; ++ __u8 collocated_ref_idx; ++ __u8 five_minus_max_num_merge_cand; ++ __s8 slice_qp_delta; ++ __s8 slice_cb_qp_offset; ++ __s8 slice_cr_qp_offset; ++ __s8 slice_act_y_qp_offset; ++ __s8 slice_act_cb_qp_offset; ++ __s8 slice_act_cr_qp_offset; ++ __s8 slice_beta_offset_div2; ++ __s8 slice_tc_offset_div2; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture timing SEI message */ ++ __u8 pic_struct; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ ++ __u8 padding[5]; ++ ++ __u32 entry_point_offset_minus1[256]; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */ ++ struct v4l2_hevc_pred_weight_table pred_weight_table; ++ ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC 0x1 ++#define V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC 0x2 ++#define V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR 0x4 ++ ++struct v4l2_ctrl_hevc_decode_params { ++ __s32 pic_order_cnt_val; ++ __u8 num_active_dpb_entries; ++ struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 num_poc_st_curr_before; ++ __u8 num_poc_st_curr_after; ++ __u8 num_poc_lt_curr; ++ __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u64 flags; ++}; ++ ++/* MPEG-class control IDs specific to the Hantro driver as defined by V4L2 */ ++#define V4L2_CID_CODEC_HANTRO_BASE (V4L2_CTRL_CLASS_CODEC | 0x1200) ++/* ++ * V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP - ++ * the number of data (in bits) to skip in the ++ * slice segment header. ++ * If non-IDR, the bits to be skipped go from syntax element "pic_output_flag" ++ * to before syntax element "slice_temporal_mvp_enabled_flag". ++ * If IDR, the skipped bits are just "pic_output_flag" ++ * (separate_colour_plane_flag is not supported). ++ */ ++#define V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP (V4L2_CID_CODEC_HANTRO_BASE + 0) ++ ++struct v4l2_ctrl_hevc_scaling_matrix { ++ __u8 scaling_list_4x4[6][16]; ++ __u8 scaling_list_8x8[6][64]; ++ __u8 scaling_list_16x16[6][64]; ++ __u8 scaling_list_32x32[2][64]; ++ __u8 scaling_list_dc_coef_16x16[6]; ++ __u8 scaling_list_dc_coef_32x32[2]; ++}; ++ ++#endif +--- /dev/null ++++ b/libavcodec/hevc-ctrls-v3.h +@@ -0,0 +1,255 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * These are the HEVC state controls for use with stateless HEVC ++ * codec drivers. ++ * ++ * It turns out that these structs are not stable yet and will undergo ++ * more changes. So keep them private until they are stable and ready to ++ * become part of the official public API. ++ */ ++ ++#ifndef _HEVC_CTRLS_H_ ++#define _HEVC_CTRLS_H_ ++ ++#include ++ ++/* The pixel format isn't stable at the moment and will likely be renamed. */ ++#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */ ++ ++#define V4L2_CID_MPEG_VIDEO_HEVC_SPS (V4L2_CID_CODEC_BASE + 1008) ++#define V4L2_CID_MPEG_VIDEO_HEVC_PPS (V4L2_CID_CODEC_BASE + 1009) ++#define V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS (V4L2_CID_CODEC_BASE + 1010) ++#define V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX (V4L2_CID_CODEC_BASE + 1011) ++#define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_BASE + 1012) ++#define V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE (V4L2_CID_CODEC_BASE + 1015) ++#define V4L2_CID_MPEG_VIDEO_HEVC_START_CODE (V4L2_CID_CODEC_BASE + 1016) ++ ++/* enum v4l2_ctrl_type type values */ ++#define V4L2_CTRL_TYPE_HEVC_SPS 0x0120 ++#define V4L2_CTRL_TYPE_HEVC_PPS 0x0121 ++#define V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS 0x0122 ++#define V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX 0x0123 ++#define V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS 0x0124 ++ ++enum v4l2_mpeg_video_hevc_decode_mode { ++ V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, ++ V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED, ++}; ++ ++enum v4l2_mpeg_video_hevc_start_code { ++ V4L2_MPEG_VIDEO_HEVC_START_CODE_NONE, ++ V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B, ++}; ++ ++#define V4L2_HEVC_SLICE_TYPE_B 0 ++#define V4L2_HEVC_SLICE_TYPE_P 1 ++#define V4L2_HEVC_SLICE_TYPE_I 2 ++ ++#define V4L2_HEVC_SPS_FLAG_SEPARATE_COLOUR_PLANE (1ULL << 0) ++#define V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED (1ULL << 1) ++#define V4L2_HEVC_SPS_FLAG_AMP_ENABLED (1ULL << 2) ++#define V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET (1ULL << 3) ++#define V4L2_HEVC_SPS_FLAG_PCM_ENABLED (1ULL << 4) ++#define V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED (1ULL << 5) ++#define V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT (1ULL << 6) ++#define V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED (1ULL << 7) ++#define V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED (1ULL << 8) ++ ++/* The controls are not stable at the moment and will likely be reworked. */ ++struct v4l2_ctrl_hevc_sps { ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */ ++ __u16 pic_width_in_luma_samples; ++ __u16 pic_height_in_luma_samples; ++ __u8 bit_depth_luma_minus8; ++ __u8 bit_depth_chroma_minus8; ++ __u8 log2_max_pic_order_cnt_lsb_minus4; ++ __u8 sps_max_dec_pic_buffering_minus1; ++ __u8 sps_max_num_reorder_pics; ++ __u8 sps_max_latency_increase_plus1; ++ __u8 log2_min_luma_coding_block_size_minus3; ++ __u8 log2_diff_max_min_luma_coding_block_size; ++ __u8 log2_min_luma_transform_block_size_minus2; ++ __u8 log2_diff_max_min_luma_transform_block_size; ++ __u8 max_transform_hierarchy_depth_inter; ++ __u8 max_transform_hierarchy_depth_intra; ++ __u8 pcm_sample_bit_depth_luma_minus1; ++ __u8 pcm_sample_bit_depth_chroma_minus1; ++ __u8 log2_min_pcm_luma_coding_block_size_minus3; ++ __u8 log2_diff_max_min_pcm_luma_coding_block_size; ++ __u8 num_short_term_ref_pic_sets; ++ __u8 num_long_term_ref_pics_sps; ++ __u8 chroma_format_idc; ++ __u8 sps_max_sub_layers_minus1; ++ ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED (1ULL << 0) ++#define V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT (1ULL << 1) ++#define V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED (1ULL << 2) ++#define V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT (1ULL << 3) ++#define V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED (1ULL << 4) ++#define V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED (1ULL << 5) ++#define V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED (1ULL << 6) ++#define V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT (1ULL << 7) ++#define V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED (1ULL << 8) ++#define V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED (1ULL << 9) ++#define V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED (1ULL << 10) ++#define V4L2_HEVC_PPS_FLAG_TILES_ENABLED (1ULL << 11) ++#define V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED (1ULL << 12) ++#define V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED (1ULL << 13) ++#define V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 14) ++#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED (1ULL << 15) ++#define V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER (1ULL << 16) ++#define V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT (1ULL << 17) ++#define V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT (1ULL << 18) ++#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT (1ULL << 19) ++#define V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING (1ULL << 20) ++ ++struct v4l2_ctrl_hevc_pps { ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */ ++ __u8 num_extra_slice_header_bits; ++ __u8 num_ref_idx_l0_default_active_minus1; ++ __u8 num_ref_idx_l1_default_active_minus1; ++ __s8 init_qp_minus26; ++ __u8 diff_cu_qp_delta_depth; ++ __s8 pps_cb_qp_offset; ++ __s8 pps_cr_qp_offset; ++ __u8 num_tile_columns_minus1; ++ __u8 num_tile_rows_minus1; ++ __u8 column_width_minus1[20]; ++ __u8 row_height_minus1[22]; ++ __s8 pps_beta_offset_div2; ++ __s8 pps_tc_offset_div2; ++ __u8 log2_parallel_merge_level_minus2; ++ ++ __u8 padding[4]; ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE 0x01 ++ ++#define V4L2_HEVC_DPB_ENTRIES_NUM_MAX 16 ++ ++struct v4l2_hevc_dpb_entry { ++ __u64 timestamp; ++ __u8 flags; ++ __u8 field_pic; ++ __u16 pic_order_cnt[2]; ++ __u8 padding[2]; ++}; ++ ++struct v4l2_hevc_pred_weight_table { ++ __s8 delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ __s8 chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ ++ __s8 delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ __s8 chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ ++ __u8 padding[6]; ++ ++ __u8 luma_log2_weight_denom; ++ __s8 delta_chroma_log2_weight_denom; ++}; ++ ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_LUMA (1ULL << 0) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_CHROMA (1ULL << 1) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_TEMPORAL_MVP_ENABLED (1ULL << 2) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_MVD_L1_ZERO (1ULL << 3) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_CABAC_INIT (1ULL << 4) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_COLLOCATED_FROM_L0 (1ULL << 5) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_USE_INTEGER_MV (1ULL << 6) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED (1ULL << 7) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9) ++ ++struct v4l2_ctrl_hevc_slice_params { ++ __u32 bit_size; ++ __u32 data_bit_offset; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u32 slice_segment_addr; ++ __u32 num_entry_point_offsets; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */ ++ __u8 nal_unit_type; ++ __u8 nuh_temporal_id_plus1; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u8 slice_type; ++ __u8 colour_plane_id; ++ __u16 slice_pic_order_cnt; ++ __u8 num_ref_idx_l0_active_minus1; ++ __u8 num_ref_idx_l1_active_minus1; ++ __u8 collocated_ref_idx; ++ __u8 five_minus_max_num_merge_cand; ++ __s8 slice_qp_delta; ++ __s8 slice_cb_qp_offset; ++ __s8 slice_cr_qp_offset; ++ __s8 slice_act_y_qp_offset; ++ __s8 slice_act_cb_qp_offset; ++ __s8 slice_act_cr_qp_offset; ++ __s8 slice_beta_offset_div2; ++ __s8 slice_tc_offset_div2; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture timing SEI message */ ++ __u8 pic_struct; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ ++ __u8 padding[5]; ++ ++ __u32 entry_point_offset_minus1[256]; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */ ++ struct v4l2_hevc_pred_weight_table pred_weight_table; ++ ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC 0x1 ++#define V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC 0x2 ++#define V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR 0x4 ++ ++struct v4l2_ctrl_hevc_decode_params { ++ __s32 pic_order_cnt_val; ++ __u8 num_active_dpb_entries; ++ struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 num_poc_st_curr_before; ++ __u8 num_poc_st_curr_after; ++ __u8 num_poc_lt_curr; ++ __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u64 flags; ++}; ++ ++struct v4l2_ctrl_hevc_scaling_matrix { ++ __u8 scaling_list_4x4[6][16]; ++ __u8 scaling_list_8x8[6][64]; ++ __u8 scaling_list_16x16[6][64]; ++ __u8 scaling_list_32x32[2][64]; ++ __u8 scaling_list_dc_coef_16x16[6]; ++ __u8 scaling_list_dc_coef_32x32[2]; ++}; ++ ++/* MPEG-class control IDs specific to the Hantro driver as defined by V4L2 */ ++#define V4L2_CID_CODEC_HANTRO_BASE (V4L2_CTRL_CLASS_CODEC | 0x1200) ++/* ++ * V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP - ++ * the number of data (in bits) to skip in the ++ * slice segment header. ++ * If non-IDR, the bits to be skipped go from syntax element "pic_output_flag" ++ * to before syntax element "slice_temporal_mvp_enabled_flag". ++ * If IDR, the skipped bits are just "pic_output_flag" ++ * (separate_colour_plane_flag is not supported). ++ */ ++#define V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP (V4L2_CID_CODEC_HANTRO_BASE + 0) ++ ++#endif +--- /dev/null ++++ b/libavcodec/hevc-ctrls-v4.h +@@ -0,0 +1,515 @@ ++/* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) */ ++/* ++ * Video for Linux Two controls header file ++ * ++ * Copyright (C) 1999-2012 the contributors ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * Alternatively you can redistribute this file under the terms of the ++ * BSD license as stated below: ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * 3. The names of its contributors may not be used to endorse or promote ++ * products derived from this software without specific prior written ++ * permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ++ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED ++ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * ++ * The contents of this header was split off from videodev2.h. All control ++ * definitions should be added to this header, which is included by ++ * videodev2.h. ++ */ ++ ++#ifndef AVCODEC_HEVC_CTRLS_V4_H ++#define AVCODEC_HEVC_CTRLS_V4_H ++ ++#include ++#include ++ ++#define V4L2_CID_STATELESS_HEVC_SPS (V4L2_CID_CODEC_STATELESS_BASE + 400) ++#define V4L2_CID_STATELESS_HEVC_PPS (V4L2_CID_CODEC_STATELESS_BASE + 401) ++#define V4L2_CID_STATELESS_HEVC_SLICE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 402) ++#define V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (V4L2_CID_CODEC_STATELESS_BASE + 403) ++#define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 404) ++#define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_STATELESS_BASE + 405) ++#define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_STATELESS_BASE + 406) ++#define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_STATELESS_BASE + 407) ++ ++enum v4l2_stateless_hevc_decode_mode { ++ V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED, ++ V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED, ++}; ++ ++enum v4l2_stateless_hevc_start_code { ++ V4L2_STATELESS_HEVC_START_CODE_NONE, ++ V4L2_STATELESS_HEVC_START_CODE_ANNEX_B, ++}; ++ ++#define V4L2_HEVC_SLICE_TYPE_B 0 ++#define V4L2_HEVC_SLICE_TYPE_P 1 ++#define V4L2_HEVC_SLICE_TYPE_I 2 ++ ++#define V4L2_HEVC_SPS_FLAG_SEPARATE_COLOUR_PLANE (1ULL << 0) ++#define V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED (1ULL << 1) ++#define V4L2_HEVC_SPS_FLAG_AMP_ENABLED (1ULL << 2) ++#define V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET (1ULL << 3) ++#define V4L2_HEVC_SPS_FLAG_PCM_ENABLED (1ULL << 4) ++#define V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED (1ULL << 5) ++#define V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT (1ULL << 6) ++#define V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED (1ULL << 7) ++#define V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED (1ULL << 8) ++ ++/** ++ * struct v4l2_ctrl_hevc_sps - ITU-T Rec. H.265: Sequence parameter set ++ * ++ * @video_parameter_set_id: specifies the value of the ++ * vps_video_parameter_set_id of the active VPS ++ * @seq_parameter_set_id: provides an identifier for the SPS for ++ * reference by other syntax elements ++ * @pic_width_in_luma_samples: specifies the width of each decoded picture ++ * in units of luma samples ++ * @pic_height_in_luma_samples: specifies the height of each decoded picture ++ * in units of luma samples ++ * @bit_depth_luma_minus8: this value plus 8specifies the bit depth of the ++ * samples of the luma array ++ * @bit_depth_chroma_minus8: this value plus 8 specifies the bit depth of the ++ * samples of the chroma arrays ++ * @log2_max_pic_order_cnt_lsb_minus4: this value plus 4 specifies the value of ++ * the variable MaxPicOrderCntLsb ++ * @sps_max_dec_pic_buffering_minus1: this value plus 1 specifies the maximum ++ * required size of the decoded picture ++ * buffer for the codec video sequence ++ * @sps_max_num_reorder_pics: indicates the maximum allowed number of pictures ++ * @sps_max_latency_increase_plus1: not equal to 0 is used to compute the ++ * value of SpsMaxLatencyPictures array ++ * @log2_min_luma_coding_block_size_minus3: plus 3 specifies the minimum ++ * luma coding block size ++ * @log2_diff_max_min_luma_coding_block_size: specifies the difference between ++ * the maximum and minimum luma ++ * coding block size ++ * @log2_min_luma_transform_block_size_minus2: plus 2 specifies the minimum luma ++ * transform block size ++ * @log2_diff_max_min_luma_transform_block_size: specifies the difference between ++ * the maximum and minimum luma ++ * transform block size ++ * @max_transform_hierarchy_depth_inter: specifies the maximum hierarchy ++ * depth for transform units of ++ * coding units coded in inter ++ * prediction mode ++ * @max_transform_hierarchy_depth_intra: specifies the maximum hierarchy ++ * depth for transform units of ++ * coding units coded in intra ++ * prediction mode ++ * @pcm_sample_bit_depth_luma_minus1: this value plus 1 specifies the number of ++ * bits used to represent each of PCM sample ++ * values of the luma component ++ * @pcm_sample_bit_depth_chroma_minus1: this value plus 1 specifies the number ++ * of bits used to represent each of PCM ++ * sample values of the chroma components ++ * @log2_min_pcm_luma_coding_block_size_minus3: this value plus 3 specifies the ++ * minimum size of coding blocks ++ * @log2_diff_max_min_pcm_luma_coding_block_size: specifies the difference between ++ * the maximum and minimum size of ++ * coding blocks ++ * @num_short_term_ref_pic_sets: specifies the number of st_ref_pic_set() ++ * syntax structures included in the SPS ++ * @num_long_term_ref_pics_sps: specifies the number of candidate long-term ++ * reference pictures that are specified in the SPS ++ * @chroma_format_idc: specifies the chroma sampling ++ * @sps_max_sub_layers_minus1: this value plus 1 specifies the maximum number ++ * of temporal sub-layers ++ * @reserved: padding field. Should be zeroed by applications. ++ * @flags: see V4L2_HEVC_SPS_FLAG_{} ++ */ ++struct v4l2_ctrl_hevc_sps { ++ __u8 video_parameter_set_id; ++ __u8 seq_parameter_set_id; ++ __u16 pic_width_in_luma_samples; ++ __u16 pic_height_in_luma_samples; ++ __u8 bit_depth_luma_minus8; ++ __u8 bit_depth_chroma_minus8; ++ __u8 log2_max_pic_order_cnt_lsb_minus4; ++ __u8 sps_max_dec_pic_buffering_minus1; ++ __u8 sps_max_num_reorder_pics; ++ __u8 sps_max_latency_increase_plus1; ++ __u8 log2_min_luma_coding_block_size_minus3; ++ __u8 log2_diff_max_min_luma_coding_block_size; ++ __u8 log2_min_luma_transform_block_size_minus2; ++ __u8 log2_diff_max_min_luma_transform_block_size; ++ __u8 max_transform_hierarchy_depth_inter; ++ __u8 max_transform_hierarchy_depth_intra; ++ __u8 pcm_sample_bit_depth_luma_minus1; ++ __u8 pcm_sample_bit_depth_chroma_minus1; ++ __u8 log2_min_pcm_luma_coding_block_size_minus3; ++ __u8 log2_diff_max_min_pcm_luma_coding_block_size; ++ __u8 num_short_term_ref_pic_sets; ++ __u8 num_long_term_ref_pics_sps; ++ __u8 chroma_format_idc; ++ __u8 sps_max_sub_layers_minus1; ++ ++ __u8 reserved[6]; ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED (1ULL << 0) ++#define V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT (1ULL << 1) ++#define V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED (1ULL << 2) ++#define V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT (1ULL << 3) ++#define V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED (1ULL << 4) ++#define V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED (1ULL << 5) ++#define V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED (1ULL << 6) ++#define V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT (1ULL << 7) ++#define V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED (1ULL << 8) ++#define V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED (1ULL << 9) ++#define V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED (1ULL << 10) ++#define V4L2_HEVC_PPS_FLAG_TILES_ENABLED (1ULL << 11) ++#define V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED (1ULL << 12) ++#define V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED (1ULL << 13) ++#define V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 14) ++#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED (1ULL << 15) ++#define V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER (1ULL << 16) ++#define V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT (1ULL << 17) ++#define V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT (1ULL << 18) ++#define V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT (1ULL << 19) ++#define V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING (1ULL << 20) ++ ++/** ++ * struct v4l2_ctrl_hevc_pps - ITU-T Rec. H.265: Picture parameter set ++ * ++ * @pic_parameter_set_id: identifies the PPS for reference by other ++ * syntax elements ++ * @num_extra_slice_header_bits: specifies the number of extra slice header ++ * bits that are present in the slice header RBSP ++ * for coded pictures referring to the PPS. ++ * @num_ref_idx_l0_default_active_minus1: this value plus 1 specifies the ++ * inferred value of num_ref_idx_l0_active_minus1 ++ * @num_ref_idx_l1_default_active_minus1: this value plus 1 specifies the ++ * inferred value of num_ref_idx_l1_active_minus1 ++ * @init_qp_minus26: this value plus 26 specifies the initial value of SliceQp Y for ++ * each slice referring to the PPS ++ * @diff_cu_qp_delta_depth: specifies the difference between the luma coding ++ * tree block size and the minimum luma coding block ++ * size of coding units that convey cu_qp_delta_abs ++ * and cu_qp_delta_sign_flag ++ * @pps_cb_qp_offset: specify the offsets to the luma quantization parameter Cb ++ * @pps_cr_qp_offset: specify the offsets to the luma quantization parameter Cr ++ * @num_tile_columns_minus1: this value plus 1 specifies the number of tile columns ++ * partitioning the picture ++ * @num_tile_rows_minus1: this value plus 1 specifies the number of tile rows partitioning ++ * the picture ++ * @column_width_minus1: this value plus 1 specifies the width of the each tile column in ++ * units of coding tree blocks ++ * @row_height_minus1: this value plus 1 specifies the height of the each tile row in ++ * units of coding tree blocks ++ * @pps_beta_offset_div2: specify the default deblocking parameter offsets for ++ * beta divided by 2 ++ * @pps_tc_offset_div2: specify the default deblocking parameter offsets for tC ++ * divided by 2 ++ * @log2_parallel_merge_level_minus2: this value plus 2 specifies the value of ++ * the variable Log2ParMrgLevel ++ * @reserved: padding field. Should be zeroed by applications. ++ * @flags: see V4L2_HEVC_PPS_FLAG_{} ++ */ ++struct v4l2_ctrl_hevc_pps { ++ __u8 pic_parameter_set_id; ++ __u8 num_extra_slice_header_bits; ++ __u8 num_ref_idx_l0_default_active_minus1; ++ __u8 num_ref_idx_l1_default_active_minus1; ++ __s8 init_qp_minus26; ++ __u8 diff_cu_qp_delta_depth; ++ __s8 pps_cb_qp_offset; ++ __s8 pps_cr_qp_offset; ++ __u8 num_tile_columns_minus1; ++ __u8 num_tile_rows_minus1; ++ __u8 column_width_minus1[20]; ++ __u8 row_height_minus1[22]; ++ __s8 pps_beta_offset_div2; ++ __s8 pps_tc_offset_div2; ++ __u8 log2_parallel_merge_level_minus2; ++ __u8 reserved; ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE 0x01 ++ ++#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME 0 ++#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_FIELD 1 ++#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_FIELD 2 ++#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM 3 ++#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP 4 ++#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM_TOP 5 ++#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM 6 ++#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING 7 ++#define V4L2_HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING 8 ++#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM 9 ++#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP 10 ++#define V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM 11 ++#define V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP 12 ++ ++#define V4L2_HEVC_DPB_ENTRIES_NUM_MAX 16 ++ ++/** ++ * struct v4l2_hevc_dpb_entry - HEVC decoded picture buffer entry ++ * ++ * @timestamp: timestamp of the V4L2 capture buffer to use as reference. ++ * @flags: long term flag for the reference frame ++ * @field_pic: whether the reference is a field picture or a frame. ++ * @reserved: padding field. Should be zeroed by applications. ++ * @pic_order_cnt_val: the picture order count of the current picture. ++ */ ++struct v4l2_hevc_dpb_entry { ++ __u64 timestamp; ++ __u8 flags; ++ __u8 field_pic; ++ __u16 reserved; ++ __s32 pic_order_cnt_val; ++}; ++ ++/** ++ * struct v4l2_hevc_pred_weight_table - HEVC weighted prediction parameters ++ * ++ * @delta_luma_weight_l0: the difference of the weighting factor applied ++ * to the luma prediction value for list 0 ++ * @luma_offset_l0: the additive offset applied to the luma prediction value ++ * for list 0 ++ * @delta_chroma_weight_l0: the difference of the weighting factor applied ++ * to the chroma prediction values for list 0 ++ * @chroma_offset_l0: the difference of the additive offset applied to ++ * the chroma prediction values for list 0 ++ * @delta_luma_weight_l1: the difference of the weighting factor applied ++ * to the luma prediction value for list 1 ++ * @luma_offset_l1: the additive offset applied to the luma prediction value ++ * for list 1 ++ * @delta_chroma_weight_l1: the difference of the weighting factor applied ++ * to the chroma prediction values for list 1 ++ * @chroma_offset_l1: the difference of the additive offset applied to ++ * the chroma prediction values for list 1 ++ * @luma_log2_weight_denom: the base 2 logarithm of the denominator for ++ * all luma weighting factors ++ * @delta_chroma_log2_weight_denom: the difference of the base 2 logarithm ++ * of the denominator for all chroma ++ * weighting factors ++ */ ++struct v4l2_hevc_pred_weight_table { ++ __s8 delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ __s8 chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ ++ __s8 delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __s8 delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ __s8 chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]; ++ ++ __u8 luma_log2_weight_denom; ++ __s8 delta_chroma_log2_weight_denom; ++}; ++ ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_LUMA (1ULL << 0) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_CHROMA (1ULL << 1) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_TEMPORAL_MVP_ENABLED (1ULL << 2) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_MVD_L1_ZERO (1ULL << 3) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_CABAC_INIT (1ULL << 4) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_COLLOCATED_FROM_L0 (1ULL << 5) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_USE_INTEGER_MV (1ULL << 6) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED (1ULL << 7) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED (1ULL << 8) ++#define V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT (1ULL << 9) ++ ++/** ++ * struct v4l2_ctrl_hevc_slice_params - HEVC slice parameters ++ * ++ * This control is a dynamically sized 1-dimensional array, ++ * V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag must be set when using it. ++ * ++ * @bit_size: size (in bits) of the current slice data ++ * @data_byte_offset: offset (in bytes) to the video data in the current slice data ++ * @num_entry_point_offsets: specifies the number of entry point offset syntax ++ * elements in the slice header. ++ * @nal_unit_type: specifies the coding type of the slice (B, P or I) ++ * @nuh_temporal_id_plus1: minus 1 specifies a temporal identifier for the NAL unit ++ * @slice_type: see V4L2_HEVC_SLICE_TYPE_{} ++ * @colour_plane_id: specifies the colour plane associated with the current slice ++ * @slice_pic_order_cnt: specifies the picture order count ++ * @num_ref_idx_l0_active_minus1: this value plus 1 specifies the maximum ++ * reference index for reference picture list 0 ++ * that may be used to decode the slice ++ * @num_ref_idx_l1_active_minus1: this value plus 1 specifies the maximum ++ * reference index for reference picture list 1 ++ * that may be used to decode the slice ++ * @collocated_ref_idx: specifies the reference index of the collocated picture used ++ * for temporal motion vector prediction ++ * @five_minus_max_num_merge_cand: specifies the maximum number of merging ++ * motion vector prediction candidates supported in ++ * the slice subtracted from 5 ++ * @slice_qp_delta: specifies the initial value of QpY to be used for the coding ++ * blocks in the slice ++ * @slice_cb_qp_offset: specifies a difference to be added to the value of pps_cb_qp_offset ++ * @slice_cr_qp_offset: specifies a difference to be added to the value of pps_cr_qp_offset ++ * @slice_act_y_qp_offset: screen content extension parameters ++ * @slice_act_cb_qp_offset: screen content extension parameters ++ * @slice_act_cr_qp_offset: screen content extension parameters ++ * @slice_beta_offset_div2: specify the deblocking parameter offsets for beta divided by 2 ++ * @slice_tc_offset_div2: specify the deblocking parameter offsets for tC divided by 2 ++ * @pic_struct: indicates whether a picture should be displayed as a frame or as one or ++ * more fields ++ * @reserved0: padding field. Should be zeroed by applications. ++ * @slice_segment_addr: specifies the address of the first coding tree block in ++ * the slice segment ++ * @ref_idx_l0: the list of L0 reference elements as indices in the DPB ++ * @ref_idx_l1: the list of L1 reference elements as indices in the DPB ++ * @short_term_ref_pic_set_size: specifies the size of short-term reference ++ * pictures set included in the SPS ++ * @long_term_ref_pic_set_size: specifies the size of long-term reference ++ * pictures set include in the SPS ++ * @pred_weight_table: the prediction weight coefficients for inter-picture ++ * prediction ++ * @reserved1: padding field. Should be zeroed by applications. ++ * @flags: see V4L2_HEVC_SLICE_PARAMS_FLAG_{} ++ */ ++struct v4l2_ctrl_hevc_slice_params { ++ __u32 bit_size; ++ __u32 data_byte_offset; ++ __u32 num_entry_point_offsets; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */ ++ __u8 nal_unit_type; ++ __u8 nuh_temporal_id_plus1; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u8 slice_type; ++ __u8 colour_plane_id; ++ __s32 slice_pic_order_cnt; ++ __u8 num_ref_idx_l0_active_minus1; ++ __u8 num_ref_idx_l1_active_minus1; ++ __u8 collocated_ref_idx; ++ __u8 five_minus_max_num_merge_cand; ++ __s8 slice_qp_delta; ++ __s8 slice_cb_qp_offset; ++ __s8 slice_cr_qp_offset; ++ __s8 slice_act_y_qp_offset; ++ __s8 slice_act_cb_qp_offset; ++ __s8 slice_act_cr_qp_offset; ++ __s8 slice_beta_offset_div2; ++ __s8 slice_tc_offset_div2; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture timing SEI message */ ++ __u8 pic_struct; ++ ++ __u8 reserved0[3]; ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ __u32 slice_segment_addr; ++ __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u16 short_term_ref_pic_set_size; ++ __u16 long_term_ref_pic_set_size; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Weighted prediction parameter */ ++ struct v4l2_hevc_pred_weight_table pred_weight_table; ++ ++ __u8 reserved1[2]; ++ __u64 flags; ++}; ++ ++#define V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC 0x1 ++#define V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC 0x2 ++#define V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR 0x4 ++ ++/** ++ * struct v4l2_ctrl_hevc_decode_params - HEVC decode parameters ++ * ++ * @pic_order_cnt_val: picture order count ++ * @short_term_ref_pic_set_size: specifies the size of short-term reference ++ * pictures set included in the SPS of the first slice ++ * @long_term_ref_pic_set_size: specifies the size of long-term reference ++ * pictures set include in the SPS of the first slice ++ * @num_active_dpb_entries: the number of entries in dpb ++ * @num_poc_st_curr_before: the number of reference pictures in the short-term ++ * set that come before the current frame ++ * @num_poc_st_curr_after: the number of reference pictures in the short-term ++ * set that come after the current frame ++ * @num_poc_lt_curr: the number of reference pictures in the long-term set ++ * @poc_st_curr_before: provides the index of the short term before references ++ * in DPB array ++ * @poc_st_curr_after: provides the index of the short term after references ++ * in DPB array ++ * @poc_lt_curr: provides the index of the long term references in DPB array ++ * @reserved: padding field. Should be zeroed by applications. ++ * @dpb: the decoded picture buffer, for meta-data about reference frames ++ * @flags: see V4L2_HEVC_DECODE_PARAM_FLAG_{} ++ */ ++struct v4l2_ctrl_hevc_decode_params { ++ __s32 pic_order_cnt_val; ++ __u16 short_term_ref_pic_set_size; ++ __u16 long_term_ref_pic_set_size; ++ __u8 num_active_dpb_entries; ++ __u8 num_poc_st_curr_before; ++ __u8 num_poc_st_curr_after; ++ __u8 num_poc_lt_curr; ++ __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u8 reserved[4]; ++ struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; ++ __u64 flags; ++}; ++ ++/** ++ * struct v4l2_ctrl_hevc_scaling_matrix - HEVC scaling lists parameters ++ * ++ * @scaling_list_4x4: scaling list is used for the scaling process for ++ * transform coefficients. The values on each scaling ++ * list are expected in raster scan order ++ * @scaling_list_8x8: scaling list is used for the scaling process for ++ * transform coefficients. The values on each scaling ++ * list are expected in raster scan order ++ * @scaling_list_16x16: scaling list is used for the scaling process for ++ * transform coefficients. The values on each scaling ++ * list are expected in raster scan order ++ * @scaling_list_32x32: scaling list is used for the scaling process for ++ * transform coefficients. The values on each scaling ++ * list are expected in raster scan order ++ * @scaling_list_dc_coef_16x16: scaling list is used for the scaling process ++ * for transform coefficients. The values on each ++ * scaling list are expected in raster scan order. ++ * @scaling_list_dc_coef_32x32: scaling list is used for the scaling process ++ * for transform coefficients. The values on each ++ * scaling list are expected in raster scan order. ++ */ ++struct v4l2_ctrl_hevc_scaling_matrix { ++ __u8 scaling_list_4x4[6][16]; ++ __u8 scaling_list_8x8[6][64]; ++ __u8 scaling_list_16x16[6][64]; ++ __u8 scaling_list_32x32[2][64]; ++ __u8 scaling_list_dc_coef_16x16[6]; ++ __u8 scaling_list_dc_coef_32x32[2]; ++}; ++ ++#endif +--- a/libavcodec/hevc_parser.c ++++ b/libavcodec/hevc_parser.c +@@ -98,6 +98,19 @@ static int hevc_parse_slice_header(AVCod + avctx->profile = ps->sps->ptl.general_ptl.profile_idc; + avctx->level = ps->sps->ptl.general_ptl.level_idc; + ++ if (ps->sps->chroma_format_idc == 1) { ++ avctx->chroma_sample_location = ps->sps->vui.chroma_loc_info_present_flag ? ++ ps->sps->vui.chroma_sample_loc_type_top_field + 1 : ++ AVCHROMA_LOC_LEFT; ++ } ++ else if (ps->sps->chroma_format_idc == 2 || ++ ps->sps->chroma_format_idc == 3) { ++ avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;; ++ } ++ else { ++ avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; ++ } ++ + if (ps->vps->vps_timing_info_present_flag) { + num = ps->vps->vps_num_units_in_tick; + den = ps->vps->vps_time_scale; +--- a/libavcodec/hevc_refs.c ++++ b/libavcodec/hevc_refs.c +@@ -96,18 +96,22 @@ static HEVCFrame *alloc_frame(HEVCContex + if (!frame->rpl_buf) + goto fail; + +- frame->tab_mvf_buf = av_buffer_pool_get(s->tab_mvf_pool); +- if (!frame->tab_mvf_buf) +- goto fail; +- frame->tab_mvf = (MvField *)frame->tab_mvf_buf->data; ++ if (s->tab_mvf_pool) { ++ frame->tab_mvf_buf = av_buffer_pool_get(s->tab_mvf_pool); ++ if (!frame->tab_mvf_buf) ++ goto fail; ++ frame->tab_mvf = (MvField *)frame->tab_mvf_buf->data; ++ } + +- frame->rpl_tab_buf = av_buffer_pool_get(s->rpl_tab_pool); +- if (!frame->rpl_tab_buf) +- goto fail; +- frame->rpl_tab = (RefPicListTab **)frame->rpl_tab_buf->data; +- frame->ctb_count = s->ps.sps->ctb_width * s->ps.sps->ctb_height; +- for (j = 0; j < frame->ctb_count; j++) +- frame->rpl_tab[j] = (RefPicListTab *)frame->rpl_buf->data; ++ if (s->rpl_tab_pool) { ++ frame->rpl_tab_buf = av_buffer_pool_get(s->rpl_tab_pool); ++ if (!frame->rpl_tab_buf) ++ goto fail; ++ frame->rpl_tab = (RefPicListTab **)frame->rpl_tab_buf->data; ++ frame->ctb_count = s->ps.sps->ctb_width * s->ps.sps->ctb_height; ++ for (j = 0; j < frame->ctb_count; j++) ++ frame->rpl_tab[j] = (RefPicListTab *)frame->rpl_buf->data; ++ } + + frame->frame->top_field_first = s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD; + frame->frame->interlaced_frame = (s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD) || (s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_BOTTOM_FIELD); +@@ -276,14 +280,17 @@ static int init_slice_rpl(HEVCContext *s + int ctb_count = frame->ctb_count; + int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr]; + int i; ++ RefPicListTab * const tab = (RefPicListTab *)frame->rpl_buf->data + s->slice_idx; + + if (s->slice_idx >= frame->rpl_buf->size / sizeof(RefPicListTab)) + return AVERROR_INVALIDDATA; + +- for (i = ctb_addr_ts; i < ctb_count; i++) +- frame->rpl_tab[i] = (RefPicListTab *)frame->rpl_buf->data + s->slice_idx; ++ if (frame->rpl_tab) { ++ for (i = ctb_addr_ts; i < ctb_count; i++) ++ frame->rpl_tab[i] = tab; ++ } + +- frame->refPicList = (RefPicList *)frame->rpl_tab[ctb_addr_ts]; ++ frame->refPicList = tab->refPicList; + + return 0; + } +--- a/libavcodec/hevcdec.c ++++ b/libavcodec/hevcdec.c +@@ -332,6 +332,19 @@ static void export_stream_params(HEVCCon + + ff_set_sar(avctx, sps->vui.sar); + ++ if (sps->chroma_format_idc == 1) { ++ avctx->chroma_sample_location = sps->vui.chroma_loc_info_present_flag ? ++ sps->vui.chroma_sample_loc_type_top_field + 1 : ++ AVCHROMA_LOC_LEFT; ++ } ++ else if (sps->chroma_format_idc == 2 || ++ sps->chroma_format_idc == 3) { ++ avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;; ++ } ++ else { ++ avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; ++ } ++ + if (sps->vui.video_signal_type_present_flag) + avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG + : AVCOL_RANGE_MPEG; +@@ -372,14 +385,20 @@ static enum AVPixelFormat get_format(HEV + #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \ + CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \ + CONFIG_HEVC_NVDEC_HWACCEL + \ ++ CONFIG_HEVC_V4L2REQUEST_HWACCEL + \ + CONFIG_HEVC_VAAPI_HWACCEL + \ + CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \ ++ CONFIG_HEVC_RPI4_8_HWACCEL + \ ++ CONFIG_HEVC_RPI4_10_HWACCEL + \ + CONFIG_HEVC_VDPAU_HWACCEL) + enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; + + switch (sps->pix_fmt) { + case AV_PIX_FMT_YUV420P: + case AV_PIX_FMT_YUVJ420P: ++#if CONFIG_HEVC_RPI4_8_HWACCEL ++ *fmt++ = AV_PIX_FMT_RPI4_8; ++#endif + #if CONFIG_HEVC_DXVA2_HWACCEL + *fmt++ = AV_PIX_FMT_DXVA2_VLD; + #endif +@@ -399,8 +418,14 @@ static enum AVPixelFormat get_format(HEV + #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; + #endif ++#if CONFIG_HEVC_V4L2REQUEST_HWACCEL ++ *fmt++ = AV_PIX_FMT_DRM_PRIME; ++#endif + break; + case AV_PIX_FMT_YUV420P10: ++#if CONFIG_HEVC_RPI4_10_HWACCEL ++ *fmt++ = AV_PIX_FMT_RPI4_10; ++#endif + #if CONFIG_HEVC_DXVA2_HWACCEL + *fmt++ = AV_PIX_FMT_DXVA2_VLD; + #endif +@@ -417,6 +442,9 @@ static enum AVPixelFormat get_format(HEV + #if CONFIG_HEVC_NVDEC_HWACCEL + *fmt++ = AV_PIX_FMT_CUDA; + #endif ++#if CONFIG_HEVC_V4L2REQUEST_HWACCEL ++ *fmt++ = AV_PIX_FMT_DRM_PRIME; ++#endif + break; + case AV_PIX_FMT_YUV444P: + #if CONFIG_HEVC_VDPAU_HWACCEL +@@ -459,6 +487,16 @@ static int set_sps(HEVCContext *s, const + if (!sps) + return 0; + ++ // If hwaccel then we don't need all the s/w decode helper arrays ++ if (s->avctx->hwaccel) { ++ export_stream_params(s, sps); ++ ++ s->avctx->pix_fmt = pix_fmt; ++ s->ps.sps = sps; ++ s->ps.vps = (HEVCVPS*) s->ps.vps_list[s->ps.sps->vps_id]->data; ++ return 0; ++ } ++ + ret = pic_arrays_init(s, sps); + if (ret < 0) + goto fail; +@@ -2809,11 +2847,13 @@ static int hevc_frame_start(HEVCContext + ((s->ps.sps->height >> s->ps.sps->log2_min_cb_size) + 1); + int ret; + +- memset(s->horizontal_bs, 0, s->bs_width * s->bs_height); +- memset(s->vertical_bs, 0, s->bs_width * s->bs_height); +- memset(s->cbf_luma, 0, s->ps.sps->min_tb_width * s->ps.sps->min_tb_height); +- memset(s->is_pcm, 0, (s->ps.sps->min_pu_width + 1) * (s->ps.sps->min_pu_height + 1)); +- memset(s->tab_slice_address, -1, pic_size_in_ctb * sizeof(*s->tab_slice_address)); ++ if (s->horizontal_bs) { ++ memset(s->horizontal_bs, 0, s->bs_width * s->bs_height); ++ memset(s->vertical_bs, 0, s->bs_width * s->bs_height); ++ memset(s->cbf_luma, 0, s->ps.sps->min_tb_width * s->ps.sps->min_tb_height); ++ memset(s->is_pcm, 0, (s->ps.sps->min_pu_width + 1) * (s->ps.sps->min_pu_height + 1)); ++ memset(s->tab_slice_address, -1, pic_size_in_ctb * sizeof(*s->tab_slice_address)); ++ } + + s->is_decoded = 0; + s->first_nal_type = s->nal_unit_type; +@@ -3230,7 +3270,14 @@ static int hevc_decode_frame(AVCodecCont + s->ref = NULL; + ret = decode_nal_units(s, avpkt->data, avpkt->size); + if (ret < 0) ++ { ++ // Ensure that hwaccel knows this frame is over ++ if (s->avctx->hwaccel && s->avctx->hwaccel->abort_frame) { ++ s->avctx->hwaccel->abort_frame(s->avctx); ++ } ++ + return ret; ++ } + + if (avctx->hwaccel) { + if (s->ref && (ret = avctx->hwaccel->end_frame(avctx)) < 0) { +@@ -3273,15 +3320,19 @@ static int hevc_ref_frame(HEVCContext *s + if (ret < 0) + return ret; + +- dst->tab_mvf_buf = av_buffer_ref(src->tab_mvf_buf); +- if (!dst->tab_mvf_buf) +- goto fail; +- dst->tab_mvf = src->tab_mvf; ++ if (src->tab_mvf_buf) { ++ dst->tab_mvf_buf = av_buffer_ref(src->tab_mvf_buf); ++ if (!dst->tab_mvf_buf) ++ goto fail; ++ dst->tab_mvf = src->tab_mvf; ++ } + +- dst->rpl_tab_buf = av_buffer_ref(src->rpl_tab_buf); +- if (!dst->rpl_tab_buf) +- goto fail; +- dst->rpl_tab = src->rpl_tab; ++ if (src->rpl_tab_buf) { ++ dst->rpl_tab_buf = av_buffer_ref(src->rpl_tab_buf); ++ if (!dst->rpl_tab_buf) ++ goto fail; ++ dst->rpl_tab = src->rpl_tab; ++ } + + dst->rpl_buf = av_buffer_ref(src->rpl_buf); + if (!dst->rpl_buf) +@@ -3585,6 +3636,15 @@ AVCodec ff_hevc_decoder = { + #if CONFIG_HEVC_NVDEC_HWACCEL + HWACCEL_NVDEC(hevc), + #endif ++#if CONFIG_HEVC_RPI4_8_HWACCEL ++ HWACCEL_RPI4_8(hevc), ++#endif ++#if CONFIG_HEVC_RPI4_10_HWACCEL ++ HWACCEL_RPI4_10(hevc), ++#endif ++#if CONFIG_HEVC_V4L2REQUEST_HWACCEL ++ HWACCEL_V4L2REQUEST(hevc), ++#endif + #if CONFIG_HEVC_VAAPI_HWACCEL + HWACCEL_VAAPI(hevc), + #endif +--- a/libavcodec/hwaccels.h ++++ b/libavcodec/hwaccels.h +@@ -34,6 +34,9 @@ extern const AVHWAccel ff_hevc_d3d11va_h + extern const AVHWAccel ff_hevc_d3d11va2_hwaccel; + extern const AVHWAccel ff_hevc_dxva2_hwaccel; + extern const AVHWAccel ff_hevc_nvdec_hwaccel; ++extern const AVHWAccel ff_hevc_rpi4_8_hwaccel; ++extern const AVHWAccel ff_hevc_rpi4_10_hwaccel; ++extern const AVHWAccel ff_hevc_v4l2request_hwaccel; + extern const AVHWAccel ff_hevc_vaapi_hwaccel; + extern const AVHWAccel ff_hevc_vdpau_hwaccel; + extern const AVHWAccel ff_hevc_videotoolbox_hwaccel; +--- a/libavcodec/hwconfig.h ++++ b/libavcodec/hwconfig.h +@@ -24,6 +24,7 @@ + + + #define HWACCEL_CAP_ASYNC_SAFE (1 << 0) ++#define HWACCEL_CAP_MT_SAFE (1 << 1) + + + typedef struct AVCodecHWConfigInternal { +@@ -70,6 +71,12 @@ typedef struct AVCodecHWConfigInternal { + HW_CONFIG_HWACCEL(1, 1, 0, D3D11, D3D11VA, ff_ ## codec ## _d3d11va2_hwaccel) + #define HWACCEL_NVDEC(codec) \ + HW_CONFIG_HWACCEL(1, 1, 0, CUDA, CUDA, ff_ ## codec ## _nvdec_hwaccel) ++#define HWACCEL_RPI4_8(codec) \ ++ HW_CONFIG_HWACCEL(0, 0, 1, RPI4_8, NONE, ff_ ## codec ## _rpi4_8_hwaccel) ++#define HWACCEL_RPI4_10(codec) \ ++ HW_CONFIG_HWACCEL(0, 0, 1, RPI4_10, NONE, ff_ ## codec ## _rpi4_10_hwaccel) ++#define HWACCEL_V4L2REQUEST(codec) \ ++ HW_CONFIG_HWACCEL(1, 0, 0, DRM_PRIME, DRM, ff_ ## codec ## _v4l2request_hwaccel) + #define HWACCEL_VAAPI(codec) \ + HW_CONFIG_HWACCEL(1, 1, 1, VAAPI, VAAPI, ff_ ## codec ## _vaapi_hwaccel) + #define HWACCEL_VDPAU(codec) \ +--- a/libavcodec/mmaldec.c ++++ b/libavcodec/mmaldec.c +@@ -24,6 +24,9 @@ + * MMAL Video Decoder + */ + ++#pragma GCC diagnostic push ++// Many many redundant decls in the header files ++#pragma GCC diagnostic ignored "-Wredundant-decls" + #include + #include + #include +@@ -31,6 +34,7 @@ + #include + #include + #include ++#pragma GCC diagnostic pop + #include + + #include "avcodec.h" +--- a/libavcodec/pthread_frame.c ++++ b/libavcodec/pthread_frame.c +@@ -191,7 +191,8 @@ static attribute_align_arg void *frame_w + + /* if the previous thread uses hwaccel then we take the lock to ensure + * the threads don't run concurrently */ +- if (avctx->hwaccel) { ++ if (avctx->hwaccel && ++ !(avctx->hwaccel->caps_internal & HWACCEL_CAP_MT_SAFE)) { + pthread_mutex_lock(&p->parent->hwaccel_mutex); + p->hwaccel_serializing = 1; + } +@@ -614,7 +615,9 @@ void ff_thread_finish_setup(AVCodecConte + + if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return; + +- if (avctx->hwaccel && !p->hwaccel_serializing) { ++ if (avctx->hwaccel && ++ !(avctx->hwaccel->caps_internal & HWACCEL_CAP_MT_SAFE) && ++ !p->hwaccel_serializing) { + pthread_mutex_lock(&p->parent->hwaccel_mutex); + p->hwaccel_serializing = 1; + } +--- a/libavcodec/raw.c ++++ b/libavcodec/raw.c +@@ -293,6 +293,12 @@ const PixelFormatTag ff_raw_pix_fmt_tags + { AV_PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */ + { AV_PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */ + ++ /* RPI (Might as well define for everything) */ ++ { AV_PIX_FMT_SAND128, MKTAG('S', 'A', 'N', 'D') }, ++ { AV_PIX_FMT_RPI4_8, MKTAG('S', 'A', 'N', 'D') }, ++ { AV_PIX_FMT_SAND64_10, MKTAG('S', 'N', 'D', 'A') }, ++ { AV_PIX_FMT_RPI4_10, MKTAG('S', 'N', 'D', 'B') }, ++ + { AV_PIX_FMT_NONE, 0 }, + }; + +--- a/libavcodec/rawenc.c ++++ b/libavcodec/rawenc.c +@@ -24,6 +24,7 @@ + * Raw Video Encoder + */ + ++#include "config.h" + #include "avcodec.h" + #include "raw.h" + #include "internal.h" +@@ -31,6 +32,10 @@ + #include "libavutil/intreadwrite.h" + #include "libavutil/imgutils.h" + #include "libavutil/internal.h" ++#include "libavutil/avassert.h" ++#if CONFIG_SAND ++#include "libavutil/rpi_sand_fns.h" ++#endif + + static av_cold int raw_encode_init(AVCodecContext *avctx) + { +@@ -49,22 +54,114 @@ FF_ENABLE_DEPRECATION_WARNINGS + return 0; + } + ++#if CONFIG_SAND ++static int raw_sand8_as_yuv420(AVCodecContext *avctx, AVPacket *pkt, ++ const AVFrame *frame) ++{ ++ const int width = av_frame_cropped_width(frame); ++ const int height = av_frame_cropped_height(frame); ++ const int x0 = frame->crop_left; ++ const int y0 = frame->crop_top; ++ const int size = width * height * 3 / 2; ++ uint8_t * dst; ++ int ret; ++ ++ if ((ret = ff_alloc_packet2(avctx, pkt, size, size)) < 0) ++ return ret; ++ ++ dst = pkt->data; ++ ++ av_rpi_sand_to_planar_y8(dst, width, frame->data[0], frame->linesize[0], frame->linesize[3], x0, y0, width, height); ++ dst += width * height; ++ av_rpi_sand_to_planar_c8(dst, width / 2, dst + width * height / 4, width / 2, ++ frame->data[1], frame->linesize[1], av_rpi_sand_frame_stride2(frame), x0 / 2, y0 / 2, width / 2, height / 2); ++ return 0; ++} ++ ++static int raw_sand16_as_yuv420(AVCodecContext *avctx, AVPacket *pkt, ++ const AVFrame *frame) ++{ ++ const int width = av_frame_cropped_width(frame); ++ const int height = av_frame_cropped_height(frame); ++ const int x0 = frame->crop_left; ++ const int y0 = frame->crop_top; ++ const int size = width * height * 3; ++ uint8_t * dst; ++ int ret; ++ ++ if ((ret = ff_alloc_packet2(avctx, pkt, size, size)) < 0) ++ return ret; ++ ++ dst = pkt->data; ++ ++ av_rpi_sand_to_planar_y16(dst, width * 2, frame->data[0], frame->linesize[0], frame->linesize[3], x0 * 2, y0, width * 2, height); ++ dst += width * height * 2; ++ av_rpi_sand_to_planar_c16(dst, width, dst + width * height / 2, width, ++ frame->data[1], frame->linesize[1], av_rpi_sand_frame_stride2(frame), x0, y0 / 2, width, height / 2); ++ return 0; ++} ++ ++static int raw_sand30_as_yuv420(AVCodecContext *avctx, AVPacket *pkt, ++ const AVFrame *frame) ++{ ++ const int width = av_frame_cropped_width(frame); ++ const int height = av_frame_cropped_height(frame); ++ const int x0 = frame->crop_left; ++ const int y0 = frame->crop_top; ++ const int size = width * height * 3; ++ uint8_t * dst; ++ int ret; ++ ++ if ((ret = ff_alloc_packet2(avctx, pkt, size, size)) < 0) ++ return ret; ++ ++ dst = pkt->data; ++ ++ av_rpi_sand30_to_planar_y16(dst, width * 2, frame->data[0], frame->linesize[0], frame->linesize[3], x0, y0, width, height); ++ dst += width * height * 2; ++ av_rpi_sand30_to_planar_c16(dst, width, dst + width * height / 2, width, ++ frame->data[1], frame->linesize[1], av_rpi_sand_frame_stride2(frame), x0/2, y0 / 2, width/2, height / 2); ++ return 0; ++} ++#endif ++ ++ + static int raw_encode(AVCodecContext *avctx, AVPacket *pkt, +- const AVFrame *frame, int *got_packet) ++ const AVFrame *src_frame, int *got_packet) + { +- int ret = av_image_get_buffer_size(frame->format, +- frame->width, frame->height, 1); ++ int ret; ++ AVFrame * frame = NULL; + +- if (ret < 0) ++#if CONFIG_SAND ++ if (av_rpi_is_sand_frame(src_frame)) { ++ ret = av_rpi_is_sand8_frame(src_frame) ? raw_sand8_as_yuv420(avctx, pkt, src_frame) : ++ av_rpi_is_sand16_frame(src_frame) ? raw_sand16_as_yuv420(avctx, pkt, src_frame) : ++ av_rpi_is_sand30_frame(src_frame) ? raw_sand30_as_yuv420(avctx, pkt, src_frame) : -1; ++ *got_packet = (ret == 0); + return ret; ++ } ++#endif ++ ++ if ((frame = av_frame_clone(src_frame)) == NULL) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ if ((ret = av_frame_apply_cropping(frame, AV_FRAME_CROP_UNALIGNED)) < 0) ++ goto fail; ++ ++ ret = av_image_get_buffer_size(frame->format, ++ frame->width, frame->height, 1); ++ if (ret < 0) ++ goto fail; + + if ((ret = ff_alloc_packet2(avctx, pkt, ret, ret)) < 0) +- return ret; ++ goto fail; + if ((ret = av_image_copy_to_buffer(pkt->data, pkt->size, + (const uint8_t **)frame->data, frame->linesize, + frame->format, + frame->width, frame->height, 1)) < 0) +- return ret; ++ goto fail; + + if(avctx->codec_tag == AV_RL32("yuv2") && ret > 0 && + frame->format == AV_PIX_FMT_YUYV422) { +@@ -81,8 +178,14 @@ static int raw_encode(AVCodecContext *av + } + } + pkt->flags |= AV_PKT_FLAG_KEY; ++ av_frame_free(&frame); + *got_packet = 1; + return 0; ++ ++fail: ++ av_frame_free(&frame); ++ *got_packet = 0; ++ return ret; + } + + AVCodec ff_rawvideo_encoder = { +--- /dev/null ++++ b/libavcodec/rpi_hevc_cabac.c +@@ -0,0 +1,2257 @@ ++/* ++ * HEVC CABAC decoding ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2012 - 2013 Gildas Cocherel ++ * Copyright (C) 2012 - 2013 Gildas Cocherel ++ * Copyright (C) 2018 John Cox, Ben Avison, Peter de Rivaz for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#define UNCHECKED_BITSTREAM_READER 1 ++ ++#include "libavutil/attributes.h" ++#include "libavutil/common.h" ++ ++#include "cabac_functions.h" ++#include "rpi_hevc_data.h" ++#include "hevc.h" ++#include "rpi_hevcdec.h" ++#include "rpi_hevc_cabac_fns.h" ++ ++#include "libavutil/rpi_sand_fns.h" ++ ++// BY22 is probably faster than simple bypass if the processor has ++// either a fast 32-bit divide or a fast 32x32->64[63:32] instruction ++// x86 has fast int divide ++// Arm doesn't have divide or general fast 64 bit, but does have the multiply ++// * Beware: ARCH_xxx isn't set if configure --disable-asm is used ++#define USE_BY22 (HAVE_FAST_64BIT || ARCH_ARM || ARCH_X86) ++// Use native divide if we have a fast one - otherwise use mpy 1/x ++// x86 has a fast integer divide - arm doesn't - unsure about other ++// architectures ++#define USE_BY22_DIV ARCH_X86 ++ ++// Special case blocks with a single significant ceoff ++// Decreases the complexity of the code for a common case but increases the ++// code size. ++#define USE_N_END_1 1 ++ ++#if !USE_BY22_DIV ++// * 1/x @ 32 bits gets us 22 bits of accuracy ++#define CABAC_BY22_PEEK_BITS 22 ++#else ++// A real 32-bit divide gets us another bit ++// If we have a 64 bit int & a unit time divider then we should get a lot ++// of bits (55) but that is untested and it is unclear if it would give ++// us a large advantage ++#define CABAC_BY22_PEEK_BITS 23 ++#endif ++ ++#define CABAC_MAX_BIN 31 ++ ++ ++#if USE_BY22 && !USE_BY22_DIV ++#define I(x) (uint32_t)((0x10000000000ULL / (uint64_t)(x)) + 1ULL) ++ ++static const uint32_t cabac_by22_inv_range[256] = { ++ 0, I(257), I(258), I(259), ++ I(260), I(261), I(262), I(263), I(264), I(265), I(266), I(267), I(268), I(269), ++ I(270), I(271), I(272), I(273), I(274), I(275), I(276), I(277), I(278), I(279), ++ I(280), I(281), I(282), I(283), I(284), I(285), I(286), I(287), I(288), I(289), ++ I(290), I(291), I(292), I(293), I(294), I(295), I(296), I(297), I(298), I(299), ++ I(300), I(301), I(302), I(303), I(304), I(305), I(306), I(307), I(308), I(309), ++ I(310), I(311), I(312), I(313), I(314), I(315), I(316), I(317), I(318), I(319), ++ I(320), I(321), I(322), I(323), I(324), I(325), I(326), I(327), I(328), I(329), ++ I(330), I(331), I(332), I(333), I(334), I(335), I(336), I(337), I(338), I(339), ++ I(340), I(341), I(342), I(343), I(344), I(345), I(346), I(347), I(348), I(349), ++ I(350), I(351), I(352), I(353), I(354), I(355), I(356), I(357), I(358), I(359), ++ I(360), I(361), I(362), I(363), I(364), I(365), I(366), I(367), I(368), I(369), ++ I(370), I(371), I(372), I(373), I(374), I(375), I(376), I(377), I(378), I(379), ++ I(380), I(381), I(382), I(383), I(384), I(385), I(386), I(387), I(388), I(389), ++ I(390), I(391), I(392), I(393), I(394), I(395), I(396), I(397), I(398), I(399), ++ I(400), I(401), I(402), I(403), I(404), I(405), I(406), I(407), I(408), I(409), ++ I(410), I(411), I(412), I(413), I(414), I(415), I(416), I(417), I(418), I(419), ++ I(420), I(421), I(422), I(423), I(424), I(425), I(426), I(427), I(428), I(429), ++ I(430), I(431), I(432), I(433), I(434), I(435), I(436), I(437), I(438), I(439), ++ I(440), I(441), I(442), I(443), I(444), I(445), I(446), I(447), I(448), I(449), ++ I(450), I(451), I(452), I(453), I(454), I(455), I(456), I(457), I(458), I(459), ++ I(460), I(461), I(462), I(463), I(464), I(465), I(466), I(467), I(468), I(469), ++ I(470), I(471), I(472), I(473), I(474), I(475), I(476), I(477), I(478), I(479), ++ I(480), I(481), I(482), I(483), I(484), I(485), I(486), I(487), I(488), I(489), ++ I(490), I(491), I(492), I(493), I(494), I(495), I(496), I(497), I(498), I(499), ++ I(500), I(501), I(502), I(503), I(504), I(505), I(506), I(507), I(508), I(509), ++ I(510), I(511) ++}; ++#undef I ++#endif // USE_BY22 ++ ++#if ARCH_ARM ++#include "arm/rpi_hevc_cabac.h" ++#endif ++ ++/** ++ * number of bin by SyntaxElement. ++ */ ++static const int8_t num_bins_in_se[] = { ++ 1, // sao_merge_flag ++ 1, // sao_type_idx ++ 0, // sao_eo_class ++ 0, // sao_band_position ++ 0, // sao_offset_abs ++ 0, // sao_offset_sign ++ 0, // end_of_slice_flag ++ 3, // split_coding_unit_flag ++ 1, // cu_transquant_bypass_flag ++ 3, // skip_flag ++ 3, // cu_qp_delta ++ 1, // pred_mode ++ 4, // part_mode ++ 0, // pcm_flag ++ 1, // prev_intra_luma_pred_mode ++ 0, // mpm_idx ++ 0, // rem_intra_luma_pred_mode ++ 2, // intra_chroma_pred_mode ++ 1, // merge_flag ++ 1, // merge_idx ++ 5, // inter_pred_idc ++ 2, // ref_idx_l0 ++ 2, // ref_idx_l1 ++ 2, // abs_mvd_greater0_flag ++ 2, // abs_mvd_greater1_flag ++ 0, // abs_mvd_minus2 ++ 0, // mvd_sign_flag ++ 1, // mvp_lx_flag ++ 1, // no_residual_data_flag ++ 3, // split_transform_flag ++ 2, // cbf_luma ++ 4, // cbf_cb, cbf_cr ++ 2, // transform_skip_flag[][] ++ 2, // explicit_rdpcm_flag[][] ++ 2, // explicit_rdpcm_dir_flag[][] ++ 18, // last_significant_coeff_x_prefix ++ 18, // last_significant_coeff_y_prefix ++ 0, // last_significant_coeff_x_suffix ++ 0, // last_significant_coeff_y_suffix ++ 4, // significant_coeff_group_flag ++ 44, // significant_coeff_flag ++ 24, // coeff_abs_level_greater1_flag ++ 6, // coeff_abs_level_greater2_flag ++ 0, // coeff_abs_level_remaining ++ 0, // coeff_sign_flag ++ 8, // log2_res_scale_abs ++ 2, // res_scale_sign_flag ++ 1, // cu_chroma_qp_offset_flag ++ 1, // cu_chroma_qp_offset_idx ++}; ++ ++/** ++ * Offset to ctxIdx 0 in init_values and states, indexed by SyntaxElement. ++ */ ++static const int elem_offset[sizeof(num_bins_in_se)] = { ++ 0, // sao_merge_flag ++ 1, // sao_type_idx ++ 2, // sao_eo_class ++ 2, // sao_band_position ++ 2, // sao_offset_abs ++ 2, // sao_offset_sign ++ 2, // end_of_slice_flag ++ 2, // split_coding_unit_flag ++ 5, // cu_transquant_bypass_flag ++ 6, // skip_flag ++ 9, // cu_qp_delta ++ 12, // pred_mode ++ 13, // part_mode ++ 17, // pcm_flag ++ 17, // prev_intra_luma_pred_mode ++ 18, // mpm_idx ++ 18, // rem_intra_luma_pred_mode ++ 18, // intra_chroma_pred_mode ++ 20, // merge_flag ++ 21, // merge_idx ++ 22, // inter_pred_idc ++ 27, // ref_idx_l0 ++ 29, // ref_idx_l1 ++ 31, // abs_mvd_greater0_flag ++ 33, // abs_mvd_greater1_flag ++ 35, // abs_mvd_minus2 ++ 35, // mvd_sign_flag ++ 35, // mvp_lx_flag ++ 36, // no_residual_data_flag ++ 37, // split_transform_flag ++ 40, // cbf_luma ++ 42, // cbf_cb, cbf_cr ++ 46, // transform_skip_flag[][] ++ 48, // explicit_rdpcm_flag[][] ++ 50, // explicit_rdpcm_dir_flag[][] ++ 52, // last_significant_coeff_x_prefix ++ 70, // last_significant_coeff_y_prefix ++ 88, // last_significant_coeff_x_suffix ++ 88, // last_significant_coeff_y_suffix ++ 88, // significant_coeff_group_flag ++ 92, // significant_coeff_flag ++ 136, // coeff_abs_level_greater1_flag ++ 160, // coeff_abs_level_greater2_flag ++ 166, // coeff_abs_level_remaining ++ 166, // coeff_sign_flag ++ 166, // log2_res_scale_abs ++ 174, // res_scale_sign_flag ++ 176, // cu_chroma_qp_offset_flag ++ 177, // cu_chroma_qp_offset_idx ++}; ++ ++#define CNU 154 ++/** ++ * Indexed by init_type ++ */ ++static const uint8_t init_values[3][HEVC_CONTEXTS] = { ++ { // sao_merge_flag ++ 153, ++ // sao_type_idx ++ 200, ++ // split_coding_unit_flag ++ 139, 141, 157, ++ // cu_transquant_bypass_flag ++ 154, ++ // skip_flag ++ CNU, CNU, CNU, ++ // cu_qp_delta ++ 154, 154, 154, ++ // pred_mode ++ CNU, ++ // part_mode ++ 184, CNU, CNU, CNU, ++ // prev_intra_luma_pred_mode ++ 184, ++ // intra_chroma_pred_mode ++ 63, 139, ++ // merge_flag ++ CNU, ++ // merge_idx ++ CNU, ++ // inter_pred_idc ++ CNU, CNU, CNU, CNU, CNU, ++ // ref_idx_l0 ++ CNU, CNU, ++ // ref_idx_l1 ++ CNU, CNU, ++ // abs_mvd_greater1_flag ++ CNU, CNU, ++ // abs_mvd_greater1_flag ++ CNU, CNU, ++ // mvp_lx_flag ++ CNU, ++ // no_residual_data_flag ++ CNU, ++ // split_transform_flag ++ 153, 138, 138, ++ // cbf_luma ++ 111, 141, ++ // cbf_cb, cbf_cr ++ 94, 138, 182, 154, ++ // transform_skip_flag ++ 139, 139, ++ // explicit_rdpcm_flag ++ 139, 139, ++ // explicit_rdpcm_dir_flag ++ 139, 139, ++ // last_significant_coeff_x_prefix ++ 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111, ++ 79, 108, 123, 63, ++ // last_significant_coeff_y_prefix ++ 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111, ++ 79, 108, 123, 63, ++ // significant_coeff_group_flag ++ 91, 171, 134, 141, ++ // significant_coeff_flag ++ 111, 111, 125, 110, 110, 94, 124, 108, 124, 107, 125, 141, 179, 153, ++ 125, 107, 125, 141, 179, 153, 125, 107, 125, 141, 179, 153, 125, 140, ++ 139, 182, 182, 152, 136, 152, 136, 153, 136, 139, 111, 136, 139, 111, ++ 141, 111, ++ // coeff_abs_level_greater1_flag ++ 140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107, ++ 122, 152, 140, 179, 166, 182, 140, 227, 122, 197, ++ // coeff_abs_level_greater2_flag ++ 138, 153, 136, 167, 152, 152, ++ // log2_res_scale_abs ++ 154, 154, 154, 154, 154, 154, 154, 154, ++ // res_scale_sign_flag ++ 154, 154, ++ // cu_chroma_qp_offset_flag ++ 154, ++ // cu_chroma_qp_offset_idx ++ 154, ++ }, ++ { // sao_merge_flag ++ 153, ++ // sao_type_idx ++ 185, ++ // split_coding_unit_flag ++ 107, 139, 126, ++ // cu_transquant_bypass_flag ++ 154, ++ // skip_flag ++ 197, 185, 201, ++ // cu_qp_delta ++ 154, 154, 154, ++ // pred_mode ++ 149, ++ // part_mode ++ 154, 139, 154, 154, ++ // prev_intra_luma_pred_mode ++ 154, ++ // intra_chroma_pred_mode ++ 152, 139, ++ // merge_flag ++ 110, ++ // merge_idx ++ 122, ++ // inter_pred_idc ++ 95, 79, 63, 31, 31, ++ // ref_idx_l0 ++ 153, 153, ++ // ref_idx_l1 ++ 153, 153, ++ // abs_mvd_greater1_flag ++ 140, 198, ++ // abs_mvd_greater1_flag ++ 140, 198, ++ // mvp_lx_flag ++ 168, ++ // no_residual_data_flag ++ 79, ++ // split_transform_flag ++ 124, 138, 94, ++ // cbf_luma ++ 153, 111, ++ // cbf_cb, cbf_cr ++ 149, 107, 167, 154, ++ // transform_skip_flag ++ 139, 139, ++ // explicit_rdpcm_flag ++ 139, 139, ++ // explicit_rdpcm_dir_flag ++ 139, 139, ++ // last_significant_coeff_x_prefix ++ 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95, ++ 94, 108, 123, 108, ++ // last_significant_coeff_y_prefix ++ 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95, ++ 94, 108, 123, 108, ++ // significant_coeff_group_flag ++ 121, 140, 61, 154, ++ // significant_coeff_flag ++ 155, 154, 139, 153, 139, 123, 123, 63, 153, 166, 183, 140, 136, 153, ++ 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 170, ++ 153, 123, 123, 107, 121, 107, 121, 167, 151, 183, 140, 151, 183, 140, ++ 140, 140, ++ // coeff_abs_level_greater1_flag ++ 154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121, ++ 136, 137, 169, 194, 166, 167, 154, 167, 137, 182, ++ // coeff_abs_level_greater2_flag ++ 107, 167, 91, 122, 107, 167, ++ // log2_res_scale_abs ++ 154, 154, 154, 154, 154, 154, 154, 154, ++ // res_scale_sign_flag ++ 154, 154, ++ // cu_chroma_qp_offset_flag ++ 154, ++ // cu_chroma_qp_offset_idx ++ 154, ++ }, ++ { // sao_merge_flag ++ 153, ++ // sao_type_idx ++ 160, ++ // split_coding_unit_flag ++ 107, 139, 126, ++ // cu_transquant_bypass_flag ++ 154, ++ // skip_flag ++ 197, 185, 201, ++ // cu_qp_delta ++ 154, 154, 154, ++ // pred_mode ++ 134, ++ // part_mode ++ 154, 139, 154, 154, ++ // prev_intra_luma_pred_mode ++ 183, ++ // intra_chroma_pred_mode ++ 152, 139, ++ // merge_flag ++ 154, ++ // merge_idx ++ 137, ++ // inter_pred_idc ++ 95, 79, 63, 31, 31, ++ // ref_idx_l0 ++ 153, 153, ++ // ref_idx_l1 ++ 153, 153, ++ // abs_mvd_greater1_flag ++ 169, 198, ++ // abs_mvd_greater1_flag ++ 169, 198, ++ // mvp_lx_flag ++ 168, ++ // no_residual_data_flag ++ 79, ++ // split_transform_flag ++ 224, 167, 122, ++ // cbf_luma ++ 153, 111, ++ // cbf_cb, cbf_cr ++ 149, 92, 167, 154, ++ // transform_skip_flag ++ 139, 139, ++ // explicit_rdpcm_flag ++ 139, 139, ++ // explicit_rdpcm_dir_flag ++ 139, 139, ++ // last_significant_coeff_x_prefix ++ 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111, ++ 79, 108, 123, 93, ++ // last_significant_coeff_y_prefix ++ 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111, ++ 79, 108, 123, 93, ++ // significant_coeff_group_flag ++ 121, 140, 61, 154, ++ // significant_coeff_flag ++ 170, 154, 139, 153, 139, 123, 123, 63, 124, 166, 183, 140, 136, 153, ++ 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 170, ++ 153, 138, 138, 122, 121, 122, 121, 167, 151, 183, 140, 151, 183, 140, ++ 140, 140, ++ // coeff_abs_level_greater1_flag ++ 154, 196, 167, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121, ++ 136, 122, 169, 208, 166, 167, 154, 152, 167, 182, ++ // coeff_abs_level_greater2_flag ++ 107, 167, 91, 107, 107, 167, ++ // log2_res_scale_abs ++ 154, 154, 154, 154, 154, 154, 154, 154, ++ // res_scale_sign_flag ++ 154, 154, ++ // cu_chroma_qp_offset_flag ++ 154, ++ // cu_chroma_qp_offset_idx ++ 154, ++ }, ++}; ++ ++static const uint8_t scan_1x1[1] = { ++ 0, ++}; ++ ++static const uint8_t horiz_scan2x2_x[4] = { ++ 0, 1, 0, 1, ++}; ++ ++static const uint8_t horiz_scan2x2_y[4] = { ++ 0, 0, 1, 1 ++}; ++ ++static const uint8_t horiz_scan4x4_x[16] = { ++ 0, 1, 2, 3, ++ 0, 1, 2, 3, ++ 0, 1, 2, 3, ++ 0, 1, 2, 3, ++}; ++ ++static const uint8_t horiz_scan4x4_y[16] = { ++ 0, 0, 0, 0, ++ 1, 1, 1, 1, ++ 2, 2, 2, 2, ++ 3, 3, 3, 3, ++}; ++ ++static const uint8_t horiz_scan8x8_inv[8][8] = { ++ { 0, 1, 2, 3, 16, 17, 18, 19, }, ++ { 4, 5, 6, 7, 20, 21, 22, 23, }, ++ { 8, 9, 10, 11, 24, 25, 26, 27, }, ++ { 12, 13, 14, 15, 28, 29, 30, 31, }, ++ { 32, 33, 34, 35, 48, 49, 50, 51, }, ++ { 36, 37, 38, 39, 52, 53, 54, 55, }, ++ { 40, 41, 42, 43, 56, 57, 58, 59, }, ++ { 44, 45, 46, 47, 60, 61, 62, 63, }, ++}; ++ ++static const uint8_t diag_scan2x2_x[4] = { ++ 0, 0, 1, 1, ++}; ++ ++static const uint8_t diag_scan2x2_y[4] = { ++ 0, 1, 0, 1, ++}; ++ ++static const uint8_t diag_scan2x2_inv[2][2] = { ++ { 0, 2, }, ++ { 1, 3, }, ++}; ++ ++static const uint8_t diag_scan4x4_inv[4][4] = { ++ { 0, 2, 5, 9, }, ++ { 1, 4, 8, 12, }, ++ { 3, 7, 11, 14, }, ++ { 6, 10, 13, 15, }, ++}; ++ ++static const uint8_t diag_scan8x8_inv[8][8] = { ++ { 0, 2, 5, 9, 14, 20, 27, 35, }, ++ { 1, 4, 8, 13, 19, 26, 34, 42, }, ++ { 3, 7, 12, 18, 25, 33, 41, 48, }, ++ { 6, 11, 17, 24, 32, 40, 47, 53, }, ++ { 10, 16, 23, 31, 39, 46, 52, 57, }, ++ { 15, 22, 30, 38, 45, 51, 56, 60, }, ++ { 21, 29, 37, 44, 50, 55, 59, 62, }, ++ { 28, 36, 43, 49, 54, 58, 61, 63, }, ++}; ++ ++ ++typedef struct ++{ ++ uint16_t coeff; ++ uint16_t scale; ++} xy_off_t; ++ ++#define XYT_C(x,y,t) ((x) + ((y) << (t))) ++#define SCALE_TRAFO(t) ((t) > 3 ? 3 : (t)) ++#define SCALE_SHR(t) ((t) - SCALE_TRAFO(t)) ++#define XYT_S(x,y,t) (((x) >> SCALE_SHR(t)) + (((y) >> SCALE_SHR(t)) << SCALE_TRAFO(t))) ++ ++#define XYT(x,y,t) {XYT_C(x,y,t), XYT_S(x,y,t)} ++ ++#define OFF_DIAG(t) {\ ++ XYT(0,0,t), XYT(0,1,t), XYT(1,0,t), XYT(0,2,t),\ ++ XYT(1,1,t), XYT(2,0,t), XYT(0,3,t), XYT(1,2,t),\ ++ XYT(2,1,t), XYT(3,0,t), XYT(1,3,t), XYT(2,2,t),\ ++ XYT(3,1,t), XYT(2,3,t), XYT(3,2,t), XYT(3,3,t)\ ++} ++ ++#define OFF_HORIZ(t) {\ ++ XYT(0,0,t), XYT(1,0,t), XYT(2,0,t), XYT(3,0,t),\ ++ XYT(0,1,t), XYT(1,1,t), XYT(2,1,t), XYT(3,1,t),\ ++ XYT(0,2,t), XYT(1,2,t), XYT(2,2,t), XYT(3,2,t),\ ++ XYT(0,3,t), XYT(1,3,t), XYT(2,3,t), XYT(3,3,t)\ ++} ++ ++#define OFF_VERT(t) {\ ++ XYT(0,0,t), XYT(0,1,t), XYT(0,2,t), XYT(0,3,t),\ ++ XYT(1,0,t), XYT(1,1,t), XYT(1,2,t), XYT(1,3,t),\ ++ XYT(2,0,t), XYT(2,1,t), XYT(2,2,t), XYT(2,3,t),\ ++ XYT(3,0,t), XYT(3,1,t), XYT(3,2,t), XYT(3,3,t)\ ++} ++ ++static const xy_off_t off_xys[3][4][16] = ++{ ++ {OFF_DIAG(2), OFF_DIAG(3), OFF_DIAG(4), OFF_DIAG(5)}, ++ {OFF_HORIZ(2), OFF_HORIZ(3), OFF_HORIZ(4), OFF_HORIZ(5)}, ++ {OFF_VERT(2), OFF_VERT(3), OFF_VERT(4), OFF_VERT(5)} ++}; ++ ++ ++// Helper fns ++#ifndef hevc_mem_bits32 ++static av_always_inline uint32_t hevc_mem_bits32(const void * buf, const unsigned int offset) ++{ ++ return AV_RB32((const uint8_t *)buf + (offset >> 3)) << (offset & 7); ++} ++#endif ++ ++#if AV_GCC_VERSION_AT_LEAST(3,4) && !defined(hevc_clz32) ++#define hevc_clz32 hevc_clz32_builtin ++static av_always_inline unsigned int hevc_clz32_builtin(const uint32_t x) ++{ ++ // __builtin_clz says it works on ints - so adjust if int is >32 bits long ++ return __builtin_clz(x) - (sizeof(int) * 8 - 32); ++} ++#endif ++ ++// It is unlikely that we will ever need this but include for completeness ++#ifndef hevc_clz32 ++static inline unsigned int hevc_clz32(unsigned int x) ++{ ++ unsigned int n = 1; ++ if ((x & 0xffff0000) == 0) { ++ n += 16; ++ x <<= 16; ++ } ++ if ((x & 0xff000000) == 0) { ++ n += 8; ++ x <<= 8; ++ } ++ if ((x & 0xf0000000) == 0) { ++ n += 4; ++ x <<= 4; ++ } ++ if ((x & 0xc0000000) == 0) { ++ n += 2; ++ x <<= 2; ++ } ++ return n - ((x >> 31) & 1); ++} ++#endif ++ ++static inline int cabac_overflow(const CABACContext * const cc) ++{ ++ av_assert0(cc->bytestream >= cc->bytestream_start); ++ return cc->bytestream >= cc->bytestream_end + 4; ++} ++ ++int ff_hevc_rpi_cabac_overflow(const HEVCRpiLocalContext * const lc) ++{ ++ return cabac_overflow(&lc->cc); ++} ++ ++#if !USE_BY22 ++// If no by22 then _by22 functions will revert to normal and so _peek/_flush ++// will no longer be called but the setup calls will still exist and we want ++// to null them out ++#define bypass_start(s) ++#define bypass_finish(s) ++#else ++// Use BY22 for residual bypass block ++ ++#define bypass_start(cc) get_cabac_by22_start(cc) ++#define bypass_finish(cc) get_cabac_by22_finish(cc) ++ ++// BY22 notes that bypass is simply a divide into the bitstream and so we ++// can peek out large quantities of bits at once and treat the result as if ++// it was VLC. In many cases this will lead to O(1) processing rather than ++// O(n) though the setup and teardown is sufficiently expensive that it is ++// only worth using if we expect to be dealing with more than a few bits ++// The definition of "a few bits" will vary from platform to platform but ++// tests on ARM show that it probably isn't worth it for a single coded ++// residual, but is for >1 - it also seems likely that if there are ++// more residuals then they are likely to be bigger and this will make the ++// O(1) nature of the code more worthwhile. ++ ++ ++// Bypass block start ++// Must be called before _by22_peek is used as it sets the CABAC environment ++// into the correct state. _by22_finish must be called to return to 'normal' ++// (i.e. non-bypass) cabac decoding ++#ifndef get_cabac_by22_start ++static inline void get_cabac_by22_start(CABACContext * const c) ++{ ++ const unsigned int bits = __builtin_ctz(c->low); ++ const uint32_t m = hevc_mem_bits32(c->bytestream, 0); ++ uint32_t x = (c->low << (22 - CABAC_BITS)) ^ ((m ^ 0x80000000U) >> (9 + CABAC_BITS - bits)); ++#if !USE_BY22_DIV ++ const uint32_t inv = cabac_by22_inv_range[c->range & 0xff]; ++#endif ++ ++ c->bytestream -= (CABAC_BITS / 8); ++ c->by22.bits = bits; ++#if !USE_BY22_DIV ++ c->by22.range = c->range; ++ c->range = inv; ++#endif ++ c->low = x; ++} ++#endif ++ ++// Bypass block finish ++// Must be called at the end of the bypass block to return to normal operation ++static inline void get_cabac_by22_finish(CABACContext * const c) ++{ ++ unsigned int used = c->by22.bits; ++ unsigned int bytes_used = (used / CABAC_BITS) * (CABAC_BITS / 8); ++ unsigned int bits_used = used & (CABAC_BITS == 16 ? 15 : 7); ++ ++ c->bytestream += bytes_used + (CABAC_BITS / 8); ++ c->low = (((uint32_t)c->low >> (22 - CABAC_BITS + bits_used)) | 1) << bits_used; ++#if !USE_BY22_DIV ++ c->range = c->by22.range; ++#endif ++} ++ ++// Peek bypass bits ++// _by22_start must be called before _by22_peek is called and _by22_flush ++// must be called afterwards to flush any used bits ++// The actual number of valid bits returned is ++// min(, CABAC_BY22_PEEK_BITS). CABAC_BY22_PEEK_BITS ++// will be at least 22 which should be long enough for any prefix or suffix ++// though probably not long enough for the worst case combination ++#ifndef get_cabac_by22_peek ++static inline uint32_t get_cabac_by22_peek(const CABACContext * const c) ++{ ++#if USE_BY22_DIV ++ return ((unsigned int)c->low / (unsigned int)c->range) << 9; ++#else ++ uint32_t x = c->low & ~1U; ++ const uint32_t inv = c->range; ++ ++ if (inv != 0) ++ x = (uint32_t)(((uint64_t)x * (uint64_t)inv) >> 32); ++ ++ return x << 1; ++#endif ++} ++#endif ++ ++// Flush bypass bits peeked by _by22_peek ++// Flush n bypass bits. n must be >= 1 to guarantee correct operation ++// val is an unmodified copy of whatever _by22_peek returned ++#ifndef get_cabac_by22_flush ++static inline void get_cabac_by22_flush(CABACContext * c, const unsigned int n, const uint32_t val) ++{ ++ // Subtract the bits used & reshift up to the top of the word ++#if USE_BY22_DIV ++ const uint32_t low = (((unsigned int)c->low << n) - (((val >> (32 - n)) * (unsigned int)c->range) << 23)); ++#else ++ const uint32_t low = (((uint32_t)c->low << n) - (((val >> (32 - n)) * c->by22.range) << 23)); ++#endif ++ ++ // and refill lower bits ++ // We will probably OR over some existing bits but that doesn't matter ++ c->by22.bits += n; ++ c->low = low | (hevc_mem_bits32(c->bytestream, c->by22.bits) >> 9); ++} ++#endif ++ ++#endif // USE_BY22 ++ ++ ++void ff_hevc_rpi_save_states(HEVCRpiContext *s, const HEVCRpiLocalContext * const lc) ++{ ++ memcpy(s->cabac_save->rice, lc->stat_coeff, 4); ++ memcpy(s->cabac_save->state, lc->cabac_state, HEVC_CONTEXTS); ++} ++ ++static void load_states(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) ++{ ++ memcpy(lc->stat_coeff, s->cabac_save->rice, 4); ++ memcpy(lc->cabac_state, s->cabac_save->state, HEVC_CONTEXTS); ++} ++ ++int ff_hevc_rpi_cabac_init_decoder(HEVCRpiLocalContext * const lc) ++{ ++ GetBitContext * const gb = &lc->gb; ++ skip_bits(gb, 1); ++ align_get_bits(gb); ++ return ff_init_cabac_decoder(&lc->cc, ++ gb->buffer + get_bits_count(gb) / 8, ++ (get_bits_left(gb) + 7) / 8); ++} ++ ++static void cabac_init_state(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) ++{ ++ int init_type = 2 - s->sh.slice_type; ++ int i; ++ ++ if (s->sh.cabac_init_flag && s->sh.slice_type != HEVC_SLICE_I) ++ init_type ^= 3; ++ ++ for (i = 0; i < HEVC_CONTEXTS; i++) { ++ int init_value = init_values[init_type][i]; ++ int m = (init_value >> 4) * 5 - 45; ++ int n = ((init_value & 15) << 3) - 16; ++ int pre = 2 * (((m * av_clip(s->sh.slice_qp, 0, 51)) >> 4) + n) - 127; ++ ++ pre ^= pre >> 31; ++ if (pre > 124) ++ pre = 124 + (pre & 1); ++ lc->cabac_state[i] = pre; ++ } ++ ++ for (i = 0; i < 4; i++) ++ lc->stat_coeff[i] = 0; ++} ++ ++void ff_hevc_rpi_cabac_init(const HEVCRpiContext * const s, HEVCRpiLocalContext *const lc, const unsigned int ctb_flags) ++{ ++ if (lc->cabac_init_req == 1 || (ctb_flags & CTB_TS_FLAGS_CIREQ) != 0) ++ { ++ lc->qPy_pred = s->sh.slice_qp; ++ cabac_init_state(s, lc); ++ } ++ else if ((ctb_flags & CTB_TS_FLAGS_CLOAD) != 0) ++ { ++ lc->qPy_pred = s->sh.slice_qp; ++ load_states(s, lc); ++ } ++ lc->cabac_init_req = 0; ++} ++ ++#define GET_CABAC_LC(ctx) get_cabac(&lc->cc, lc->cabac_state + (ctx)) ++ ++int ff_hevc_rpi_get_cabac(CABACContext * const c, uint8_t * const state) ++{ ++ return get_cabac_inline(c, state); ++} ++ ++int ff_hevc_rpi_get_cabac_terminate(CABACContext * const c) ++{ ++ return get_cabac_terminate(c); ++} ++ ++int ff_hevc_rpi_sao_type_idx_decode(HEVCRpiLocalContext * const lc) ++{ ++ if (!GET_CABAC_LC(elem_offset[SAO_TYPE_IDX])) ++ return 0; ++ ++ if (!get_cabac_bypass(&lc->cc)) ++ return SAO_BAND; ++ return SAO_EDGE; ++} ++ ++int ff_hevc_rpi_sao_band_position_decode(HEVCRpiLocalContext * const lc) ++{ ++ int i; ++ int value = get_cabac_bypass(&lc->cc); ++ ++ for (i = 0; i < 4; i++) ++ value = (value << 1) | get_cabac_bypass(&lc->cc); ++ return value; ++} ++ ++int ff_hevc_rpi_sao_offset_abs_decode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) ++{ ++ int i = 0; ++ int length = (1 << (FFMIN(s->ps.sps->bit_depth, 10) - 5)) - 1; ++ ++ while (i < length && get_cabac_bypass(&lc->cc)) ++ i++; ++ return i; ++} ++ ++int ff_hevc_rpi_sao_offset_sign_decode(HEVCRpiLocalContext * const lc) ++{ ++ return get_cabac_bypass(&lc->cc); ++} ++ ++int ff_hevc_rpi_sao_eo_class_decode(HEVCRpiLocalContext * const lc) ++{ ++ int ret = get_cabac_bypass(&lc->cc) << 1; ++ ret |= get_cabac_bypass(&lc->cc); ++ return ret; ++} ++ ++int ff_hevc_rpi_cu_qp_delta(HEVCRpiLocalContext * const lc) ++{ ++ int val = 1; ++ ++ if (get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_CU_QP_DELTA) == 0) ++ return 0; ++ ++ while (val < 5 && ++ get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_CU_QP_DELTA + 1) != 0) ++ val++; ++ ++ if (val >= 5) { ++ unsigned int k = 0; ++ while (k < CABAC_MAX_BIN && get_cabac_bypass(&lc->cc)) { ++ val += 1 << k; ++ k++; ++ } ++// if (k == CABAC_MAX_BIN) ++// av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k); ++ ++ while (k--) ++ val += get_cabac_bypass(&lc->cc) << k; ++ } ++ return get_cabac_bypass(&lc->cc) ? -val : val; ++} ++ ++int ff_hevc_rpi_cu_chroma_qp_offset_idx(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) ++{ ++ int c_max= FFMAX(5, s->ps.pps->chroma_qp_offset_list_len_minus1); ++ int i = 0; ++ ++ while (i < c_max && GET_CABAC_LC(elem_offset[CU_CHROMA_QP_OFFSET_IDX])) ++ i++; ++ ++ return i; ++} ++ ++int ff_hevc_rpi_part_mode_decode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const int log2_cb_size) ++{ ++ if (GET_CABAC_LC(elem_offset[PART_MODE])) // 1 ++ return PART_2Nx2N; ++ if (log2_cb_size == s->ps.sps->log2_min_cb_size) { ++ if (lc->cu.pred_mode == MODE_INTRA) // 0 ++ return PART_NxN; ++ if (GET_CABAC_LC(elem_offset[PART_MODE] + 1)) // 01 ++ return PART_2NxN; ++ if (log2_cb_size == 3) // 00 ++ return PART_Nx2N; ++ if (GET_CABAC_LC(elem_offset[PART_MODE] + 2)) // 001 ++ return PART_Nx2N; ++ return PART_NxN; // 000 ++ } ++ ++ if (!s->ps.sps->amp_enabled_flag) { ++ if (GET_CABAC_LC(elem_offset[PART_MODE] + 1)) // 01 ++ return PART_2NxN; ++ return PART_Nx2N; ++ } ++ ++ if (GET_CABAC_LC(elem_offset[PART_MODE] + 1)) { // 01X, 01XX ++ if (GET_CABAC_LC(elem_offset[PART_MODE] + 3)) // 011 ++ return PART_2NxN; ++ if (get_cabac_bypass(&lc->cc)) // 0101 ++ return PART_2NxnD; ++ return PART_2NxnU; // 0100 ++ } ++ ++ if (GET_CABAC_LC(elem_offset[PART_MODE] + 3)) // 001 ++ return PART_Nx2N; ++ if (get_cabac_bypass(&lc->cc)) // 0001 ++ return PART_nRx2N; ++ return PART_nLx2N; // 0000 ++} ++ ++int ff_hevc_rpi_mpm_idx_decode(HEVCRpiLocalContext * const lc) ++{ ++ int i = 0; ++ while (i < 2 && get_cabac_bypass(&lc->cc)) ++ i++; ++ return i; ++} ++ ++int ff_hevc_rpi_rem_intra_luma_pred_mode_decode(HEVCRpiLocalContext * const lc) ++{ ++ int i; ++ int value = get_cabac_bypass(&lc->cc); ++ ++ for (i = 0; i < 4; i++) ++ value = (value << 1) | get_cabac_bypass(&lc->cc); ++ return value; ++} ++ ++int ff_hevc_rpi_intra_chroma_pred_mode_decode(HEVCRpiLocalContext * const lc) ++{ ++ int ret; ++ if (!GET_CABAC_LC(elem_offset[INTRA_CHROMA_PRED_MODE])) ++ return 4; ++ ++ ret = get_cabac_bypass(&lc->cc) << 1; ++ ret |= get_cabac_bypass(&lc->cc); ++ return ret; ++} ++ ++int ff_hevc_rpi_merge_idx_decode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) ++{ ++ int i = GET_CABAC_LC(elem_offset[MERGE_IDX]); ++ ++ if (i != 0) { ++ while (i < s->sh.max_num_merge_cand-1 && get_cabac_bypass(&lc->cc)) ++ i++; ++ } ++ return i; ++} ++ ++int ff_hevc_rpi_inter_pred_idc_decode(HEVCRpiLocalContext * const lc, int nPbW, int nPbH) ++{ ++ if (nPbW + nPbH == 12) ++ return GET_CABAC_LC(elem_offset[INTER_PRED_IDC] + 4); ++ if (GET_CABAC_LC(elem_offset[INTER_PRED_IDC] + lc->ct_depth)) ++ return PRED_BI; ++ ++ return GET_CABAC_LC(elem_offset[INTER_PRED_IDC] + 4); ++} ++ ++int ff_hevc_rpi_ref_idx_lx_decode(HEVCRpiLocalContext * const lc, const int num_ref_idx_lx) ++{ ++ int i = 0; ++ int max = num_ref_idx_lx - 1; ++ int max_ctx = FFMIN(max, 2); ++ ++ while (i < max_ctx && GET_CABAC_LC(elem_offset[REF_IDX_L0] + i)) ++ i++; ++ if (i == 2) { ++ while (i < max && get_cabac_bypass(&lc->cc)) ++ i++; ++ } ++ ++ return i; ++} ++ ++static av_always_inline int abs_mvd_greater0_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return GET_CABAC_LC(elem_offset[ABS_MVD_GREATER0_FLAG]); ++} ++ ++static av_always_inline int abs_mvd_greater1_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return GET_CABAC_LC(elem_offset[ABS_MVD_GREATER1_FLAG] + 1); ++} ++ ++#if !USE_BY22 ++static av_always_inline int mvd_decode(HEVCRpiLocalContext * const lc) ++{ ++ int ret = 2; ++ int k = 1; ++ ++ while (k < CABAC_MAX_BIN && get_cabac_bypass(&lc->cc)) { ++ ret += 1U << k; ++ k++; ++ } ++ if (k == CABAC_MAX_BIN) { ++ av_log(NULL, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k); ++ return 0; ++ } ++ ++ while (k--) ++ ret += get_cabac_bypass(&lc->cc) << k; ++ return get_cabac_bypass_sign(&lc->cc, -ret); ++} ++#endif ++ ++static av_always_inline int mvd_sign_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return get_cabac_bypass_sign(&lc->cc, -1); ++} ++ ++static int hevc_transform_skip_flag_decode(HEVCRpiLocalContext * const lc, int c_idx_nz) ++{ ++ return GET_CABAC_LC(elem_offset[TRANSFORM_SKIP_FLAG] + c_idx_nz); ++} ++ ++static int explicit_rdpcm_flag_decode(HEVCRpiLocalContext * const lc, int c_idx_nz) ++{ ++ return GET_CABAC_LC(elem_offset[EXPLICIT_RDPCM_FLAG] + c_idx_nz); ++} ++ ++static int explicit_rdpcm_dir_flag_decode(HEVCRpiLocalContext * const lc, int c_idx_nz) ++{ ++ return GET_CABAC_LC(elem_offset[EXPLICIT_RDPCM_DIR_FLAG] + c_idx_nz); ++} ++ ++ ++int ff_hevc_rpi_log2_res_scale_abs(HEVCRpiLocalContext * const lc, const int idx) { ++ int i =0; ++ ++ while (i < 4 && GET_CABAC_LC(elem_offset[LOG2_RES_SCALE_ABS] + 4 * idx + i)) ++ i++; ++ ++ return i; ++} ++ ++static av_always_inline void last_significant_coeff_xy_prefix_decode(HEVCRpiLocalContext * const lc, int c_idx_nz, ++ int log2_size, int *last_scx_prefix, int *last_scy_prefix) ++{ ++ int i = 0; ++ int max = (log2_size << 1) - 1; ++ int ctx_offset, ctx_shift; ++ ++ if (!c_idx_nz) { ++ ctx_offset = 3 * (log2_size - 2) + ((log2_size - 1) >> 2); ++ ctx_shift = (log2_size + 1) >> 2; ++ } else { ++ ctx_offset = 15; ++ ctx_shift = log2_size - 2; ++ } ++ while (i < max && ++ GET_CABAC_LC(elem_offset[LAST_SIGNIFICANT_COEFF_X_PREFIX] + (i >> ctx_shift) + ctx_offset)) ++ i++; ++ *last_scx_prefix = i; ++ ++ i = 0; ++ while (i < max && ++ GET_CABAC_LC(elem_offset[LAST_SIGNIFICANT_COEFF_Y_PREFIX] + (i >> ctx_shift) + ctx_offset)) ++ i++; ++ *last_scy_prefix = i; ++} ++ ++static av_always_inline int last_significant_coeff_suffix_decode(HEVCRpiLocalContext * const lc, ++ int last_significant_coeff_prefix) ++{ ++ int i; ++ int length = (last_significant_coeff_prefix >> 1) - 1; ++ int value = get_cabac_bypass(&lc->cc); ++ ++ for (i = 1; i < length; i++) ++ value = (value << 1) | get_cabac_bypass(&lc->cc); ++ return value; ++} ++ ++static av_always_inline int significant_coeff_group_flag_decode(HEVCRpiLocalContext * const lc, int c_idx_nz, int ctx_cg) ++{ ++ int inc; ++ ++ inc = (ctx_cg != 0) + (c_idx_nz << 1); ++ ++ return GET_CABAC_LC(elem_offset[SIGNIFICANT_COEFF_GROUP_FLAG] + inc); ++} ++ ++static av_always_inline int significant_coeff_flag_decode_0(HEVCRpiLocalContext * const lc, int offset) ++{ ++ return GET_CABAC_LC(elem_offset[SIGNIFICANT_COEFF_FLAG] + offset); ++} ++ ++#if !USE_BY22 ++#define coeff_abs_level_remaining_decode_bypass(s,r) coeff_abs_level_remaining_decode(s, r) ++#endif ++ ++ ++#ifndef coeff_abs_level_remaining_decode_bypass ++static int coeff_abs_level_remaining_decode_bypass(CABACContext * const c, const unsigned int rice_param) ++{ ++ uint32_t y; ++ unsigned int prefix; ++ unsigned int last_coeff_abs_level_remaining; ++ unsigned int n; ++ ++ y = get_cabac_by22_peek(c); ++ prefix = hevc_clz32(~y); ++ // y << prefix will always have top bit 0 ++ ++ if (prefix < 3) { ++ const unsigned int suffix = (y << prefix) >> (31 - rice_param); ++ last_coeff_abs_level_remaining = (prefix << rice_param) + suffix; ++ n = prefix + 1 + rice_param; ++ } ++ else if (prefix * 2 + rice_param <= CABAC_BY22_PEEK_BITS + 2) ++ { ++ const uint32_t suffix = ((y << prefix) | 0x80000000) >> (34 - (prefix + rice_param)); ++ ++ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; ++ n = prefix * 2 + rice_param - 2; ++ } ++ else { ++ unsigned int suffix; ++ ++ get_cabac_by22_flush(c, prefix, y); ++ y = get_cabac_by22_peek(c); ++ ++ suffix = (y | 0x80000000) >> (34 - (prefix + rice_param)); ++ last_coeff_abs_level_remaining = (2 << rice_param) + suffix; ++ n = prefix + rice_param - 2; ++ } ++ ++ get_cabac_by22_flush(c, n, y); ++ ++ return last_coeff_abs_level_remaining; ++} ++#endif ++ ++static int coeff_abs_level_remaining_decode(CABACContext * const c, int rc_rice_param) ++{ ++ int prefix = 0; ++ int suffix = 0; ++ int last_coeff_abs_level_remaining; ++ int i; ++ ++ while (prefix < CABAC_MAX_BIN && get_cabac_bypass(c)) ++ prefix++; ++ if (prefix == CABAC_MAX_BIN) { ++// av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", prefix); ++ return 0; ++ } ++ ++ if (prefix < 3) { ++ for (i = 0; i < rc_rice_param; i++) ++ suffix = (suffix << 1) | get_cabac_bypass(c); ++ last_coeff_abs_level_remaining = (prefix << rc_rice_param) + suffix; ++ } else { ++ int prefix_minus3 = prefix - 3; ++ for (i = 0; i < prefix_minus3 + rc_rice_param; i++) ++ suffix = (suffix << 1) | get_cabac_bypass(c); ++ last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1) ++ << rc_rice_param) + suffix; ++ } ++ ++ return last_coeff_abs_level_remaining; ++} ++ ++#if !USE_BY22 ++#define coeff_sign_flag_decode_bypass coeff_sign_flag_decode ++static inline uint32_t coeff_sign_flag_decode(CABACContext * const c, const unsigned int nb) ++{ ++ unsigned int i; ++ uint32_t ret = 0; ++ ++ for (i = 0; i < nb; i++) ++ ret = (ret << 1) | get_cabac_bypass(c); ++ ++ return ret << (32 - nb); ++} ++#endif ++ ++#ifndef coeff_sign_flag_decode_bypass ++static inline uint32_t coeff_sign_flag_decode_bypass(CABACContext * const c, const unsigned int nb) ++{ ++ uint32_t y; ++ y = get_cabac_by22_peek(c); ++ get_cabac_by22_flush(c, nb, y); ++ return y & ~(0xffffffffU >> nb); ++} ++#endif ++ ++ ++#ifndef get_cabac_greater1_bits ++static inline unsigned int get_cabac_greater1_bits(CABACContext * const c, const unsigned int n, ++ uint8_t * const state0) ++{ ++ unsigned int i; ++ unsigned int rv = 0; ++ for (i = 0; i != n; ++i) { ++ const unsigned int idx = rv != 0 ? 0 : i < 3 ? i + 1 : 3; ++ const unsigned int b = get_cabac(c, state0 + idx); ++ rv = (rv << 1) | b; ++ } ++ return rv; ++} ++#endif ++ ++ ++// N.B. levels returned are the values assuming coeff_abs_level_remaining ++// is uncoded, so 1 must be added if it is coded. sum_abs also reflects ++// this version of events. ++static inline uint32_t get_greaterx_bits(HEVCRpiLocalContext * const lc, const unsigned int n_end, int * const levels, ++ int * const pprev_subset_coded, int * const psum, ++ const unsigned int idx0_gt1, const unsigned int idx_gt2) ++{ ++ CABACContext * const c = &lc->cc; ++ uint8_t * const state0 = lc->cabac_state + idx0_gt1; ++ uint8_t * const state_gt2 = lc->cabac_state + idx_gt2; ++ unsigned int rv; ++ unsigned int i; ++ const unsigned int n = FFMIN(n_end, 8); ++ ++ // Really this is i != n but the simple unconditional loop is cheaper ++ // and faster ++ for (i = 0; i != 8; ++i) ++ levels[i] = 1; ++ ++ rv = get_cabac_greater1_bits(c, n, state0); ++ ++ *pprev_subset_coded = 0; ++ *psum = n; ++ ++ rv <<= (32 - n); ++ if (rv != 0) ++ { ++ *pprev_subset_coded = 1; ++ *psum = n + 1; ++ i = hevc_clz32(rv); ++ levels[i] = 2; ++ if (get_cabac(c, state_gt2) == 0) ++ { ++ // Unset first coded bit ++ rv &= ~(0x80000000U >> i); ++ } ++ } ++ ++ if (n_end > 8) { ++ const unsigned int g8 = n_end - 8; ++ rv |= ((1 << g8) - 1) << (24 - g8); ++ for (i = 0; i != g8; ++i) { ++ levels[i + 8] = 0; ++ } ++ } ++ ++ return rv; ++} ++ ++// extended_precision_processing_flag must be false given we are ++// putting the result into a 16-bit array ++// So trans_coeff_level must fit in 16 bits too (7.4.9.1 definition of coeff_abs_level_remaining) ++// scale_m is uint8_t ++// ++// scale is [40 - 72] << [0..12] based on qp- worst case is (45 << 12) ++// or it can be 2 (if we have transquant_bypass) ++// shift is set to one less than we really want but would normally be ++// s->ps.sps->bit_depth (max 16, min 8) + log2_trafo_size (max 5, min 2?) - 5 = max 16 min 5? ++// however the scale shift is substracted from shift to a min 0 so scale_m worst = 45 << 6 ++// This can still theoretically lead to overflow but the coding would have to be very odd (& inefficient) ++// to achieve it ++ ++#ifndef trans_scale_sat ++static inline int trans_scale_sat(const int level, const unsigned int scale, const unsigned int scale_m, const unsigned int shift) ++{ ++ return av_clip_int16((((level * (int)(scale * scale_m)) >> shift) + 1) >> 1); ++} ++#endif ++ ++ ++#ifndef update_rice ++static inline void update_rice(uint8_t * const stat_coeff, ++ const unsigned int last_coeff_abs_level_remaining, ++ const unsigned int c_rice_param) ++{ ++ const unsigned int x = (last_coeff_abs_level_remaining << 1) >> c_rice_param; ++ if (x >= 6) ++ (*stat_coeff)++; ++ else if (x == 0 && *stat_coeff > 0) ++ (*stat_coeff)--; ++} ++#endif ++ ++ ++// n must be > 0 on entry ++#ifndef get_cabac_sig_coeff_flag_idxs ++static inline uint8_t * get_cabac_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, ++ unsigned int n, ++ const uint8_t const * ctx_map, ++ uint8_t * p) ++{ ++ do { ++ if (get_cabac(c, state0 + ctx_map[n])) ++ *p++ = n; ++ } while (--n != 0); ++ return p; ++} ++#endif ++ ++ ++static int get_sig_coeff_flag_idxs(CABACContext * const c, uint8_t * const state0, ++ unsigned int n, ++ const uint8_t * ctx_map, // const ptr here but not in asm ++ uint8_t * const flag_idx) ++{ ++ int rv; ++ ++ rv = get_cabac_sig_coeff_flag_idxs(c, state0, n, ctx_map, flag_idx) - flag_idx; ++ ++ return rv; ++} ++ ++#define H4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ ++ x0, x1, x2, x3,\ ++ x4, x5, x6, x7,\ ++ x8, x9, x10, x11,\ ++ x12, x13, x14, x15} ++ ++#define V4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ ++ x0, x4, x8, x12,\ ++ x1, x5, x9, x13,\ ++ x2, x6, x10, x14,\ ++ x3, x7, x11, x15} ++ ++#define D4x4(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) {\ ++ x0, x4, x1, x8,\ ++ x5, x2, x12, x9,\ ++ x6, x3, x13, x10,\ ++ x7, x14, x11, x15} ++ ++ ++static inline int next_subset(HEVCRpiLocalContext * const lc, int i, const int c_idx_nz, ++ uint8_t * const significant_coeff_group_flag, ++ const uint8_t * const scan_x_cg, const uint8_t * const scan_y_cg, ++ int * const pPrev_sig) ++{ ++ while (--i >= 0) { ++ uint8_t * const gf_y = scan_y_cg[i] + significant_coeff_group_flag; ++ const unsigned int x_cg = scan_x_cg[i]; ++ ++ // For the flag decode we only care about Z/NZ but ++ // we use the full Right * 2 + Down when calculating ++ // significant coeff flags so we obtain it here. ++ // ++ // The group flag array is one longer than it needs to ++ // be so we don't need to check for y_cg limits ++ const unsigned int prev_sig = ((gf_y[0] >> x_cg) & 2) | ((gf_y[1] >> x_cg) & 1); ++ ++ if (i == 0 || ++ significant_coeff_group_flag_decode(lc, c_idx_nz, prev_sig)) ++ { ++ gf_y[0] |= (1 << x_cg); ++ *pPrev_sig = prev_sig; ++ break; ++ } ++ } ++ ++ return i; ++} ++ ++static void rpi_add_residual(const HEVCRpiContext *const s, HEVCRpiJob * const jb, ++ const unsigned int log2_trafo_size, const unsigned int c_idx, ++ const unsigned int x0, const unsigned int y0, const int16_t * const coeffs) ++{ ++ const AVFrame * const frame = s->frame; ++ const unsigned int stride = frame_stride1(s->frame, c_idx); ++ const unsigned int x = x0 >> ctx_hshift(s, c_idx); ++ const unsigned int y = y0 >> ctx_vshift(s, c_idx); ++ const int is_sliced = 1; // av_rpi_is_sand_frame(frame); ++ uint8_t * const dst = !is_sliced ? ++ s->frame->data[c_idx] + y * stride + (x << s->ps.sps->pixel_shift) : ++ c_idx == 0 ? ++ av_rpi_sand_frame_pos_y(frame, x, y) : ++ av_rpi_sand_frame_pos_c(frame, x, y); ++ ++ const unsigned int i = jb->intra.n; ++ HEVCPredCmd *const pc = jb->intra.cmds + i - 1; ++ ++ if (i != 0 && c_idx == 2 && pc->type == RPI_PRED_ADD_RESIDUAL_U && ++ pc->ta.dst == dst) ++ { ++ av_assert1(pc->size == log2_trafo_size && ++ pc->c_idx == 1 && ++ pc->ta.stride == stride); ++ ++ pc->type = RPI_PRED_ADD_RESIDUAL_C; ++ } ++ else if (i != 0 && c_idx == 2 && pc->type == RPI_PRED_ADD_DC_U && ++ pc->dc.dst == dst) ++ { ++ const int16_t dc = (int16_t)pc->dc.dc; // Discard top bits ++ av_assert1(pc->size == log2_trafo_size && ++ pc->c_idx == 1 && ++ pc->dc.stride == stride); ++ ++ // Rewrite as add residual - must rewrite all fields as different union member ++ pc->type = RPI_PRED_ADD_RESIDUAL_V; ++ pc->ta.buf = coeffs; ++ pc->ta.dst = dst; ++ pc->ta.stride = stride; ++ pc->ta.dc = dc; ++ } ++ else ++ { ++ HEVCPredCmd * const cmd = pc + 1; ++ jb->intra.n = i + 1; ++ ++ cmd->type = RPI_PRED_ADD_RESIDUAL + (is_sliced ? c_idx : 0); ++ cmd->size = log2_trafo_size; ++ cmd->ta.buf = coeffs; ++ cmd->ta.dst = dst; ++ cmd->ta.stride = stride; ++ cmd->ta.dc = 0; ++ } ++} ++ ++ ++static void rpi_add_dc(const HEVCRpiContext * const s, HEVCRpiJob * const jb, ++ const unsigned int log2_trafo_size, const unsigned int c_idx, ++ const unsigned int x0, const unsigned int y0, const int16_t * const coeffs) ++{ ++ const AVFrame * const frame = s->frame; ++ const unsigned int stride = frame_stride1(s->frame, c_idx); ++ const unsigned int x = x0 >> ctx_hshift(s, c_idx); ++ const unsigned int y = y0 >> ctx_vshift(s, c_idx); ++ const int is_sliced = 1; ++ uint8_t * const dst = !is_sliced ? ++ s->frame->data[c_idx] + y * stride + (x << s->ps.sps->pixel_shift) : ++ c_idx == 0 ? ++ av_rpi_sand_frame_pos_y(frame, x, y) : ++ av_rpi_sand_frame_pos_c(frame, x, y); ++ ++ const unsigned int shift = FFMAX(14 - s->ps.sps->bit_depth, 0); ++ const int coeff = (coeffs[0] + (1 | (1 << shift))) >> (shift + 1); ++ ++ const unsigned int i = jb->intra.n; ++ HEVCPredCmd *const pc = jb->intra.cmds + i - 1; ++ ++ if (i != 0 && c_idx == 2 && pc->type == RPI_PRED_ADD_RESIDUAL_U && ++ pc->ta.dst == dst) ++ { ++ av_assert1(pc->size == log2_trafo_size && ++ pc->c_idx == 1 && ++ pc->ta.stride == stride); ++ ++ pc->ta.dc = (int16_t)coeff; ++ } ++ else if (i != 0 && c_idx == 2 && pc->type == RPI_PRED_ADD_DC_U && ++ pc->dc.dst == dst) ++ { ++ av_assert1(pc->size == log2_trafo_size && ++ pc->c_idx == 1 && ++ pc->dc.stride == stride && ++ (pc->dc.dc & ~0xffff) == 0); ++ ++ pc->dc.dc |= (coeff << 16); ++ } ++ else ++ { ++ HEVCPredCmd * const cmd = pc + 1; ++ jb->intra.n = i + 1; ++ ++ cmd->type = RPI_PRED_ADD_DC + c_idx; ++ cmd->size = log2_trafo_size; ++ cmd->dc.dst = dst; ++ cmd->dc.stride = stride; ++ cmd->dc.dc = c_idx == 0 ? coeff : c_idx == 2 ? coeff << 16 : coeff & 0xffff; ++ } ++} ++ ++ ++void ff_hevc_rpi_hls_residual_coding(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const int x0, const int y0, ++ const int log2_trafo_size, const enum ScanType scan_idx, ++ const int c_idx) ++{ ++ int trans_skip_or_bypass = lc->cu.cu_transquant_bypass_flag; ++ ++ int last_significant_coeff_x, last_significant_coeff_y; ++ int num_coeff = 0; ++ int prev_subset_coded = 0; ++ ++ int num_last_subset; ++ int x_cg_last_sig, y_cg_last_sig; ++ ++ const uint8_t *scan_x_cg, *scan_y_cg; ++ const xy_off_t * const scan_xy_off = off_xys[scan_idx][log2_trafo_size - 2]; ++ ++ int use_vpu; ++#if RPI_COMPRESS_COEFFS ++ int num_nonzero = 0; ++ int use_compress = 0; ++ int *coeffs32; ++#endif ++ int use_dc = 0; ++ int16_t *coeffs; ++ uint8_t significant_coeff_group_flag[9] = {0}; // Allow 1 final byte that is always zero ++ int explicit_rdpcm_flag = 0; ++ int explicit_rdpcm_dir_flag; ++ ++ int i; ++ int shift,scale; ++ const uint8_t *scale_matrix = NULL; ++ uint8_t dc_scale; ++ const int c_idx_nz = (c_idx != 0); ++ const int pred_mode_intra = c_idx_nz ? lc->tu.intra_pred_mode_c : lc->tu.intra_pred_mode; ++ int prev_sig = 0; ++ int may_hide_sign; ++ ++ int16_t dummy_coeffs[16]; ++ ++ // Derive QP for dequant ++ if (!lc->cu.cu_transquant_bypass_flag) { ++ may_hide_sign = s->ps.pps->sign_data_hiding_flag; ++ ++ if (s->ps.pps->transform_skip_enabled_flag && ++ log2_trafo_size <= s->ps.pps->log2_max_transform_skip_block_size) { ++ int transform_skip_flag = hevc_transform_skip_flag_decode(lc, c_idx_nz); ++ if (transform_skip_flag) { ++ trans_skip_or_bypass = 1; ++ if (lc->cu.pred_mode == MODE_INTRA && ++ s->ps.sps->implicit_rdpcm_enabled_flag && ++ (pred_mode_intra == 10 || pred_mode_intra == 26)) { ++ may_hide_sign = 0; ++ } ++ } ++ } ++ ++ { ++ static const uint8_t level_scale[8] = { ++ 40, 45, 51, 57, 64, 72, 0, 0 // Pad to 8 ++ }; ++ const int qp6 = (int8_t)lc->tu.qp_divmod6[c_idx][lc->qp_y]; ++ ++ // Shift is set to one less than will actually occur as the scale ++ // and saturate step adds 1 and then shifts right again ++ scale = level_scale[qp6 & 7]; ++// shift = s->ps.sps->bit_depth + log2_trafo_size - (int)(qp6 >> 3); ++ shift = log2_trafo_size - (qp6 >> 3); ++ ++ if (shift < 0) { ++ scale <<= -shift; ++ shift = 0; ++ } ++ } ++ ++ if (s->ps.sps->scaling_list_enable_flag && !(trans_skip_or_bypass && log2_trafo_size > 2)) { ++ const ScalingList * const sl = s->ps.pps->scaling_list_data_present_flag ? ++ &s->ps.pps->scaling_list : &s->ps.sps->scaling_list; ++ const unsigned int matrix_id = ++ lc->cu.pred_mode != MODE_INTRA ? 3 + c_idx : c_idx; ++ ++ scale_matrix = sl->sl[log2_trafo_size - 2][matrix_id]; ++ dc_scale = scale_matrix[0]; ++ if (log2_trafo_size >= 4) ++ dc_scale = sl->sl_dc[log2_trafo_size - 4][matrix_id]; ++ } ++ else ++ { ++ static const uint8_t sixteen_scale[64] = { ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16, ++ 16, 16, 16, 16, 16, 16, 16, 16 ++ }; ++ scale_matrix = sixteen_scale; ++ dc_scale = 16; ++ } ++ } else { ++ static const uint8_t unit_scale[64] = { ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 1, 1, 1, 1, 1, ++ }; ++ scale_matrix = unit_scale; ++ shift = 0; ++ scale = 2; // We will shift right to kill this ++ dc_scale = 1; ++ ++ may_hide_sign = 0; ++ } ++ ++ ++ ++ ++ if (lc->cu.pred_mode == MODE_INTER && s->ps.sps->explicit_rdpcm_enabled_flag && ++ trans_skip_or_bypass) { ++ explicit_rdpcm_flag = explicit_rdpcm_flag_decode(lc, c_idx_nz); ++ if (explicit_rdpcm_flag) { ++ may_hide_sign = 0; ++ explicit_rdpcm_dir_flag = explicit_rdpcm_dir_flag_decode(lc, c_idx_nz); ++ } ++ } ++ ++ last_significant_coeff_xy_prefix_decode(lc, c_idx_nz, log2_trafo_size, ++ &last_significant_coeff_x, &last_significant_coeff_y); ++ ++ if (last_significant_coeff_x > 3) { ++ int suffix = last_significant_coeff_suffix_decode(lc, last_significant_coeff_x); ++ last_significant_coeff_x = (1 << ((last_significant_coeff_x >> 1) - 1)) * ++ (2 + (last_significant_coeff_x & 1)) + ++ suffix; ++ } ++ ++ if (last_significant_coeff_y > 3) { ++ int suffix = last_significant_coeff_suffix_decode(lc, last_significant_coeff_y); ++ last_significant_coeff_y = (1 << ((last_significant_coeff_y >> 1) - 1)) * ++ (2 + (last_significant_coeff_y & 1)) + ++ suffix; ++ } ++ ++ if (scan_idx == SCAN_VERT) ++ FFSWAP(int, last_significant_coeff_x, last_significant_coeff_y); ++ ++ x_cg_last_sig = last_significant_coeff_x >> 2; ++ y_cg_last_sig = last_significant_coeff_y >> 2; ++ ++ switch (scan_idx) { ++ case SCAN_DIAG: { ++ int last_x_c = last_significant_coeff_x & 3; ++ int last_y_c = last_significant_coeff_y & 3; ++ ++ num_coeff = diag_scan4x4_inv[last_y_c][last_x_c]; ++ ++ switch (log2_trafo_size) { ++ case 2: ++ scan_x_cg = scan_1x1; ++ scan_y_cg = scan_1x1; ++ break; ++ case 3: ++ num_coeff += diag_scan2x2_inv[y_cg_last_sig][x_cg_last_sig] << 4; ++ scan_x_cg = diag_scan2x2_x; ++ scan_y_cg = diag_scan2x2_y; ++ break; ++ case 4: ++ num_coeff += diag_scan4x4_inv[y_cg_last_sig][x_cg_last_sig] << 4; ++ scan_x_cg = ff_hevc_rpi_diag_scan4x4_x; ++ scan_y_cg = ff_hevc_rpi_diag_scan4x4_y; ++ break; ++ case 5: ++ default: ++ num_coeff += diag_scan8x8_inv[y_cg_last_sig][x_cg_last_sig] << 4; ++ scan_x_cg = ff_hevc_rpi_diag_scan8x8_x; ++ scan_y_cg = ff_hevc_rpi_diag_scan8x8_y; ++ break; ++ } ++ break; ++ } ++ case SCAN_HORIZ: ++ scan_x_cg = horiz_scan2x2_x; ++ scan_y_cg = horiz_scan2x2_y; ++ num_coeff = horiz_scan8x8_inv[last_significant_coeff_y][last_significant_coeff_x]; ++ break; ++ default: //SCAN_VERT ++ scan_x_cg = horiz_scan2x2_y; ++ scan_y_cg = horiz_scan2x2_x; ++ num_coeff = horiz_scan8x8_inv[last_significant_coeff_x][last_significant_coeff_y]; ++ break; ++ } ++ num_coeff++; ++ num_last_subset = (num_coeff - 1) >> 4; ++ ++ significant_coeff_group_flag[y_cg_last_sig] = 1 << x_cg_last_sig; // 1st subset always significant ++ ++ { ++ const unsigned int ccount = 1 << (log2_trafo_size * 2); ++ const int special = trans_skip_or_bypass /* || lc->tu.cross_pf */; // These need special processing ++ use_vpu = 0; ++ use_dc = (num_coeff == 1) && !special && ++ !(lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2); ++ ++ if (use_dc) { ++ // Just need a little empty space ++ coeffs = dummy_coeffs; ++ // No need to clear ++ } ++ else ++ { ++ use_vpu = !special && log2_trafo_size >= 4; ++#if RPI_COMPRESS_COEFFS ++ use_compress = use_vpu && lc->jb0->coeffs.s[log2_trafo_size - 2].packed; ++#endif ++ coeffs = rpi_alloc_coeff_buf(lc->jb0, !use_vpu ? 0 : log2_trafo_size - 2, ccount); ++#if RPI_COMPRESS_COEFFS ++ coeffs32 = (int*)coeffs; ++ if (!use_compress) ++#endif ++#if HAVE_NEON ++ rpi_zap_coeff_vals_neon(coeffs, log2_trafo_size - 2); ++#else ++ memset(coeffs, 0, ccount * sizeof(int16_t)); ++#endif ++ } ++ } ++ ++ i = num_last_subset; ++ do { ++ int implicit_non_zero_coeff = 0; ++ int n_end; ++ ++ uint8_t significant_coeff_flag_idx[16]; ++ unsigned int nb_significant_coeff_flag = 0; ++ ++ if (i == num_last_subset) { ++ // First time through ++ int last_scan_pos = num_coeff - (i << 4) - 1; ++ n_end = last_scan_pos - 1; ++ significant_coeff_flag_idx[0] = last_scan_pos; ++ nb_significant_coeff_flag = 1; ++ } else { ++ n_end = 15; ++ implicit_non_zero_coeff = (i != 0); ++ } ++ ++ if (n_end >= 0) { ++ static const uint8_t ctx_idx_maps_ts2[3][16] = { ++ D4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 ++ H4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8), // log2_trafo_size == 2 ++ V4x4(0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8) // log2_trafo_size == 2 ++ }; ++ // N.B. prev_sig = Right * 2 + Down ++ static const uint8_t ctx_idx_maps[3][4][16] = { ++ { ++ D4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 ++ D4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 1 ++ D4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 2 ++ D4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default ++ }, ++ { ++ H4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 ++ H4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 1 ++ H4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 2 ++ H4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default ++ }, ++ { ++ V4x4(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 0 ++ V4x4(2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0), // prev_sig == 1 ++ V4x4(2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0), // prev_sig == 2 ++ V4x4(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) // prev_sig == 3, default ++ } ++ }; ++ const uint8_t *ctx_idx_map_p; ++ int scf_offset = 0; ++ ++ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { ++ ctx_idx_map_p = ctx_idx_maps[0][3]; ++ scf_offset = 40 + c_idx_nz; ++ } else { ++ if (c_idx_nz != 0) ++ scf_offset = 27; ++ ++ if (log2_trafo_size == 2) { ++ ctx_idx_map_p = ctx_idx_maps_ts2[scan_idx]; ++ } else { ++ ctx_idx_map_p = ctx_idx_maps[scan_idx][prev_sig]; ++ if (!c_idx_nz) { ++ if (i != 0) ++ scf_offset += 3; ++ ++ if (log2_trafo_size == 3) { ++ scf_offset += (scan_idx == SCAN_DIAG) ? 9 : 15; ++ } else { ++ scf_offset += 21; ++ } ++ } else { ++ if (log2_trafo_size == 3) ++ scf_offset += 9; ++ else ++ scf_offset += 12; ++ } ++ } ++ } ++ ++ if (n_end > 0) { ++ int cnt = get_sig_coeff_flag_idxs(&lc->cc, ++ lc->cabac_state + elem_offset[SIGNIFICANT_COEFF_FLAG] + scf_offset, ++ n_end, ctx_idx_map_p, ++ significant_coeff_flag_idx + nb_significant_coeff_flag); ++ ++ nb_significant_coeff_flag += cnt; ++ if (cnt != 0) { ++ implicit_non_zero_coeff = 0; ++ } ++ } ++ ++ if (implicit_non_zero_coeff == 0) { ++ if (s->ps.sps->transform_skip_context_enabled_flag && trans_skip_or_bypass) { ++ scf_offset = 42 + c_idx_nz; ++ } else { ++ if (i == 0) { ++ scf_offset = c_idx_nz ? 27 : 0; ++ } else { ++ scf_offset = 2 + scf_offset; ++ } ++ } ++ if (significant_coeff_flag_decode_0(lc, scf_offset) == 1) { ++ significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; ++ nb_significant_coeff_flag++; ++ } ++ } else { ++ significant_coeff_flag_idx[nb_significant_coeff_flag] = 0; ++ nb_significant_coeff_flag++; ++ } ++ } ++#if RPI_COMPRESS_COEFFS ++ if (use_compress && (nb_significant_coeff_flag + num_nonzero + 1 >= (1<<(2*log2_trafo_size-1)))) { // Overflow when half-full! ++ int16_t temp[32*32]; ++ const unsigned int ccount = 1 << (log2_trafo_size * 2); ++ lc->jb0->coeffs.s[log2_trafo_size - 2].packed = 0; ++ lc->jb0->coeffs.s[log2_trafo_size - 2].packed_n = lc->jb0->coeffs.s[log2_trafo_size - 2].n - ccount; // Don't want to unpack the last buffer ++ memcpy(temp, coeffs, sizeof(int)*num_nonzero); ++ coeffs32 = (int *)temp; ++ memset(coeffs, 0, ccount * sizeof(int16_t)); ++ num_nonzero--; ++ while (num_nonzero >= 0) { ++ const unsigned int res = coeffs32[num_nonzero]; ++ const unsigned int offset = res & 0xffff; ++ coeffs[ offset ] = res >> 16; ++ num_nonzero--; ++ } ++ use_compress = 0; ++ } ++#endif ++ ++ if (nb_significant_coeff_flag != 0) { ++ const unsigned int gt1_idx_delta = (c_idx_nz << 2) | ++ ((i != 0 && !c_idx_nz) ? 2 : 0) | ++ prev_subset_coded; ++ const unsigned int idx0_gt1 = elem_offset[COEFF_ABS_LEVEL_GREATER1_FLAG] + ++ (gt1_idx_delta << 2); ++ const unsigned int idx_gt2 = elem_offset[COEFF_ABS_LEVEL_GREATER2_FLAG] + ++ gt1_idx_delta; ++ ++ const unsigned int x_cg = scan_x_cg[i]; ++ const unsigned int y_cg = scan_y_cg[i]; ++ int16_t * const blk_coeffs = coeffs + ++ ((x_cg + (y_cg << log2_trafo_size)) << 2); ++ // This calculation is 'wrong' for log2_traffo_size == 2 ++ // but that doesn't matter as in this case x_cg & y_cg ++ // are always 0 so result is correct (0) anyway ++ const uint8_t * const blk_scale = scale_matrix + ++ (((x_cg + (y_cg << 3)) << (5 - log2_trafo_size))); ++ ++ // * The following code block doesn't deal with these flags: ++ // (nor did the one it replaces) ++ // ++ // cabac_bypass_alignment_enabled_flag ++ // This should be easy but I can't find a test case ++ // extended_precision_processing_flag ++ // This can extend the required precision past 16bits ++ // so is probably tricky - also no example found yet ++ ++#if USE_N_END_1 ++ if (nb_significant_coeff_flag == 1) { ++ // There is a small gain to be had from special casing the single ++ // transform coefficient case. The reduction in complexity ++ // makes up for the code duplicatioon. ++ ++ int trans_coeff_level = 1; ++ int coeff_sign_flag; ++ int coded_val = 0; ++ ++ // initialize first elem of coeff_bas_level_greater1_flag ++ prev_subset_coded = 0; ++ ++ if (get_cabac(&lc->cc, lc->cabac_state + idx0_gt1 + 1)) { ++ trans_coeff_level = 2; ++ prev_subset_coded = 1; ++ coded_val = get_cabac(&lc->cc, lc->cabac_state + idx_gt2); ++ } ++ ++ // Probably not worth the overhead of starting by22 for just one value ++ coeff_sign_flag = get_cabac_bypass(&lc->cc); ++ ++ if (coded_val) ++ { ++ if (!s->ps.sps->persistent_rice_adaptation_enabled_flag) { ++ trans_coeff_level = 3 + coeff_abs_level_remaining_decode(&lc->cc, 0); ++ } else { ++ uint8_t * const stat_coeff = ++ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); ++ const unsigned int c_rice_param = *stat_coeff >> 2; ++ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode(&lc->cc, c_rice_param); ++ ++ trans_coeff_level = 3 + last_coeff_abs_level_remaining; ++ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); ++ } ++ } ++ ++ { ++ const xy_off_t * const xy_off = scan_xy_off + significant_coeff_flag_idx[0]; ++ const int k = (int32_t)(coeff_sign_flag << 31) >> 31; ++ const unsigned int scale_m = blk_scale[xy_off->scale]; ++ const int res = trans_scale_sat( ++ (trans_coeff_level ^ k) - k, // Apply sign ++ scale, ++ i == 0 && xy_off->coeff == 0 ? dc_scale : scale_m, ++ shift); ++#if RPI_COMPRESS_COEFFS ++ if (use_compress) ++ coeffs32[num_nonzero++] = (res<<16) + (&blk_coeffs[xy_off->coeff] - coeffs); ++ else ++#endif ++ blk_coeffs[xy_off->coeff] = res; ++ } ++ } ++ else ++#endif ++ { ++ int sign_hidden = may_hide_sign; ++ int levels[16]; // Should be able to get away with int16_t but that fails some tests ++ uint32_t coeff_sign_flags; ++ uint32_t coded_vals = 0; ++ // Sum(abs(level[])) ++ // In fact we only need the bottom bit and in some future ++ // version that may be all we calculate ++ unsigned int sum_abs; ++ ++ coded_vals = get_greaterx_bits(lc, nb_significant_coeff_flag, levels, ++ &prev_subset_coded, &sum_abs, idx0_gt1, idx_gt2); ++ ++ if (significant_coeff_flag_idx[0] - significant_coeff_flag_idx[nb_significant_coeff_flag - 1] <= 3) ++ sign_hidden = 0; ++ ++ // -- Start bypass block ++ ++ bypass_start(&lc->cc); ++ ++ coeff_sign_flags = coeff_sign_flag_decode_bypass(&lc->cc, nb_significant_coeff_flag - sign_hidden); ++ ++ if (coded_vals != 0) ++ { ++ const int rice_adaptation_enabled = s->ps.sps->persistent_rice_adaptation_enabled_flag; ++ uint8_t * stat_coeff = !rice_adaptation_enabled ? NULL : ++ lc->stat_coeff + trans_skip_or_bypass + 2 - ((c_idx_nz) << 1); ++ int c_rice_param = !rice_adaptation_enabled ? 0 : *stat_coeff >> 2; ++ int * level = levels - 1; ++ ++ do { ++ { ++ const unsigned int z = hevc_clz32(coded_vals) + 1; ++ level += z; ++ coded_vals <<= z; ++ } ++ ++ { ++ const int last_coeff_abs_level_remaining = coeff_abs_level_remaining_decode_bypass(&lc->cc, c_rice_param); ++ const int trans_coeff_level = *level + last_coeff_abs_level_remaining + 1; ++ ++ sum_abs += last_coeff_abs_level_remaining + 1; ++ *level = trans_coeff_level; ++ ++ if (stat_coeff != NULL) ++ update_rice(stat_coeff, last_coeff_abs_level_remaining, c_rice_param); ++ stat_coeff = NULL; ++ ++ if (trans_coeff_level > (3 << c_rice_param) && ++ (c_rice_param < 4 || rice_adaptation_enabled)) ++ ++c_rice_param; ++ } ++ } while (coded_vals != 0); ++ } ++ ++ // sign_hidden = 0 or 1 so we can combine the tests ++ if ((sign_hidden & sum_abs) != 0) { ++ levels[nb_significant_coeff_flag - 1] = -levels[nb_significant_coeff_flag - 1]; ++ } ++ ++ bypass_finish(&lc->cc); ++ ++ // -- Finish bypass block ++ ++ // Scale loop ++ { ++ int m = nb_significant_coeff_flag - 1; ++ ++ // Deal with DC component (if any) first ++ if (i == 0 && significant_coeff_flag_idx[m] == 0) ++ { ++ const int k = (int32_t)(coeff_sign_flags << m) >> 31; ++ const int res = trans_scale_sat( ++ (levels[m] ^ k) - k, scale, dc_scale, shift); ++#if RPI_COMPRESS_COEFFS ++ if (use_compress) ++ { ++ coeffs32[num_nonzero++] = (res<<16) + (blk_coeffs - coeffs); ++ } ++ else ++#endif ++ { ++ blk_coeffs[0] = res; ++ } ++ --m; ++ } ++ ++#if !USE_N_END_1 ++ // If N_END_1 set then m was at least 1 initially ++ if (m >= 0) ++#endif ++ { ++ do { ++ const xy_off_t * const xy_off = scan_xy_off + ++ significant_coeff_flag_idx[m]; ++ const int k = (int32_t)(coeff_sign_flags << m) >> 31; ++ const int res = trans_scale_sat( ++ (levels[m] ^ k) - k, ++ scale, ++ blk_scale[xy_off->scale], ++ shift); ++#if RPI_COMPRESS_COEFFS ++ if (use_compress) { ++ coeffs32[num_nonzero++] = (res<<16) + (&blk_coeffs[xy_off->coeff] - coeffs); ++ } else ++#endif ++ blk_coeffs[xy_off->coeff] = res; ++ } while (--m >= 0); ++ } ++ } ++ ++ } ++ } ++ } while ((i = next_subset(lc, i, c_idx_nz, ++ significant_coeff_group_flag, scan_x_cg, scan_y_cg, &prev_sig)) >= 0 && ++ !cabac_overflow(&lc->cc)); ++ ++ if (lc->cu.cu_transquant_bypass_flag) { ++ if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && ++ (pred_mode_intra == 10 || pred_mode_intra == 26))) { ++ int mode = s->ps.sps->implicit_rdpcm_enabled_flag ? (pred_mode_intra == 26) : explicit_rdpcm_dir_flag; ++ ++ s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); ++ } ++ } else { ++ if (trans_skip_or_bypass) { // Must be trans_skip as we've already dealt with bypass ++ int rot = s->ps.sps->transform_skip_rotation_enabled_flag && ++ log2_trafo_size == 2 && ++ lc->cu.pred_mode == MODE_INTRA; ++ if (rot) { ++ for (i = 0; i < 8; i++) ++ FFSWAP(int16_t, coeffs[i], coeffs[16 - i - 1]); ++ } ++ ++ s->hevcdsp.dequant(coeffs, log2_trafo_size); ++ ++ if (explicit_rdpcm_flag || (s->ps.sps->implicit_rdpcm_enabled_flag && ++ lc->cu.pred_mode == MODE_INTRA && ++ (pred_mode_intra == 10 || pred_mode_intra == 26))) { ++ int mode = explicit_rdpcm_flag ? explicit_rdpcm_dir_flag : (pred_mode_intra == 26); ++ ++ s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size, mode); ++ } ++ } else if (lc->cu.pred_mode == MODE_INTRA && c_idx == 0 && log2_trafo_size == 2) { ++ s->hevcdsp.transform_4x4_luma(coeffs); ++ } ++ else if (!use_vpu) ++ { ++ int max_xy = FFMAX(last_significant_coeff_x, last_significant_coeff_y); ++ if (max_xy == 0) ++ { ++ if (use_dc) ++ rpi_add_dc(s, lc->jb0, log2_trafo_size, c_idx, x0, y0, coeffs); ++ else ++ s->hevcdsp.idct_dc[log2_trafo_size - 2](coeffs); ++ } ++ else { ++ int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4; ++ if (max_xy < 4) ++ col_limit = FFMIN(4, col_limit); ++ else if (max_xy < 8) ++ col_limit = FFMIN(8, col_limit); ++ else if (max_xy < 12) ++ col_limit = FFMIN(24, col_limit); ++ s->hevcdsp.idct[log2_trafo_size - 2](coeffs, col_limit); ++ } ++ } ++ } ++ ++#if 0 ++ // Mildly rotted - we support no mode where cross is valid ++ if (lc->tu.cross_pf) { ++ int16_t * const coeffs_y = (int16_t*)lc->edge_emu_buffer; ++ const int ccount = 1 << (log2_trafo_size * 2); ++ ++ for (i = 0; i < ccount; i++) { ++ coeffs[i] = coeffs[i] + ((lc->tu.res_scale_val * coeffs_y[i]) >> 3); ++ } ++ } ++#endif ++ ++ if (!use_dc) { ++#if RPI_COMPRESS_COEFFS ++ if (use_compress) { ++ coeffs32[num_nonzero] = 0; ++ } ++#endif ++ rpi_add_residual(s, lc->jb0, log2_trafo_size, c_idx, x0, y0, coeffs); ++ } ++} ++ ++#if !USE_BY22 ++// Stores results to lc ++MvXY ff_hevc_rpi_hls_mvd_coding(HEVCRpiLocalContext * const lc) ++{ ++ int x = abs_mvd_greater0_flag_decode(lc); ++ int y = abs_mvd_greater0_flag_decode(lc); ++ ++ if (x) ++ x += abs_mvd_greater1_flag_decode(lc); ++ if (y) ++ y += abs_mvd_greater1_flag_decode(lc); ++ ++ switch (x) { ++ case 2: x = mvd_decode(lc); break; ++ case 1: x = mvd_sign_flag_decode(lc); break; ++ case 0: x = 0; break; ++ } ++ ++ switch (y) { ++ case 2: y = mvd_decode(lc); break; ++ case 1: y = mvd_sign_flag_decode(lc); break; ++ case 0: y = 0; break; ++ } ++ return MV_XY(x,y); ++} ++#else ++MvXY ff_hevc_rpi_hls_mvd_coding(HEVCRpiLocalContext * const lc) ++{ ++ int x = abs_mvd_greater0_flag_decode(lc); ++ int y = abs_mvd_greater0_flag_decode(lc); ++ ++ if ((x | y) == 0) ++ return 0; ++ ++ if (x != 0) ++ x += abs_mvd_greater1_flag_decode(lc); ++ if (y != 0) ++ y += abs_mvd_greater1_flag_decode(lc); ++ ++ if ((x | y) == 1) ++ { ++ // Not worth starting BY22 ++ if (x != 0) ++ x = mvd_sign_flag_decode(lc); ++ if (y != 0) ++ y = mvd_sign_flag_decode(lc); ++ } ++ else ++ { ++ CABACContext * const cc = &lc->cc; ++ uint32_t val; ++ uint32_t b; ++ unsigned int n = 0; ++ ++ bypass_start(cc); ++ b = val = get_cabac_by22_peek(cc); ++ ++ if (x == 1) { ++ x = ((int32_t)b >> 31) | 1; ++ n = 1; ++ b <<= 1; ++ } ++ else if (x == 2) { ++ // EG1 so we have (leading one bits + 1) of suffix ++ // This makes prefix & suffix lengths the same ++ const unsigned int k = hevc_clz32(~b) + 1; ++ int s; ++ ++ av_assert2(k <= 15); ++ ++ b <<= k; ++ n = 2 * k + 1; // Includes suffix & sign ++ ++ // We need to have k*2 + 2 (prefix, suffix, sign, y-sign) bits peeked ++ // if we are going to do this without a flush ++ if (k > CABAC_BY22_PEEK_BITS / 2 - 1) ++ { ++ // Need too many bits - flush ++ // n = k ++ get_cabac_by22_flush(cc, k, val); ++ b = val = get_cabac_by22_peek(cc); ++ n = k + 1; ++ } ++ ++ x = (b >> (32 - k)) + (1 << k); ++ b <<= k; ++ s = (int32_t)b >> 31; ++ x = (x ^ s) - s; ++ b <<= 1; ++ ++ // Max abs value of an mv is 2^15 - 1 (i.e. a prefix len of 15 bits) ++ if (y > 1 && n > CABAC_BY22_PEEK_BITS - 15) ++ { ++ get_cabac_by22_flush(cc, n, val); ++ b = val = get_cabac_by22_peek(cc); ++ n = 0; ++ } ++ } ++ ++ if (y == 1) { ++ y = ((int32_t)b >> 31) | 1; ++ ++n; ++ // don't care about b anymore ++ } ++ else if (y == 2) { ++ const unsigned int k = hevc_clz32(~b) + 1; ++ int s; ++ ++ av_assert2(k <= 15); ++ ++ // We need to have k*2 + 1 (prefix, suffix, sign) bits peeked ++ // if we are going to do this without a flush ++ b <<= k; ++ n += 2 * k + 1; ++ ++ if (n > CABAC_BY22_PEEK_BITS) ++ { ++ // Need too many bits - flush ++ get_cabac_by22_flush(cc, n - (k + 1), val); ++ b = val = get_cabac_by22_peek(cc); ++ n = k + 1; ++ } ++ ++ y = (b >> (32 - k)) + (1 << k); ++ s = (int32_t)(b << k) >> 31; ++ y = (y ^ s) - s; ++ // don't care about b anymore ++ } ++ ++ get_cabac_by22_flush(cc, n, val); ++ bypass_finish(cc); ++ } ++ ++ return MV_XY(x, y); ++} ++#endif +--- /dev/null ++++ b/libavcodec/rpi_hevc_cabac_fns.h +@@ -0,0 +1,217 @@ ++/* ++ * HEVC CABAC decoding ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2012 - 2013 Gildas Cocherel ++ * Copyright (C) 2012 - 2013 Gildas Cocherel ++ * Copyright (C) 2018 John Cox ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++ ++#ifndef AVCODEC_RPI_HEVC_CABAC_FNS_H ++#define AVCODEC_RPI_HEVC_CABAC_FNS_H ++ ++#include "config.h" ++#include "rpi_hevcdec.h" ++ ++void ff_hevc_rpi_save_states(HEVCRpiContext *s, const HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_cabac_init_decoder(HEVCRpiLocalContext * const lc); ++void ff_hevc_rpi_cabac_init(const HEVCRpiContext * const s, HEVCRpiLocalContext *const lc, const unsigned int ctb_flags); ++int ff_hevc_rpi_sao_type_idx_decode(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_sao_band_position_decode(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_sao_offset_abs_decode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_sao_offset_sign_decode(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_sao_eo_class_decode(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_part_mode_decode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const int log2_cb_size); ++int ff_hevc_rpi_mpm_idx_decode(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_rem_intra_luma_pred_mode_decode(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_intra_chroma_pred_mode_decode(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_merge_idx_decode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_inter_pred_idc_decode(HEVCRpiLocalContext * const lc, int nPbW, int nPbH); ++int ff_hevc_rpi_ref_idx_lx_decode(HEVCRpiLocalContext * const lc, const int num_ref_idx_lx); ++int ff_hevc_rpi_log2_res_scale_abs(HEVCRpiLocalContext * const lc, const int idx); ++ ++//int ff_hevc_rpi_cu_qp_delta_sign_flag(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_cu_qp_delta(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_cu_chroma_qp_offset_idx(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc); ++void ff_hevc_rpi_hls_residual_coding(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const int x0, const int y0, ++ const int log2_trafo_size, const enum ScanType scan_idx, ++ const int c_idx); ++ ++MvXY ff_hevc_rpi_hls_mvd_coding(HEVCRpiLocalContext * const lc); ++int ff_hevc_rpi_cabac_overflow(const HEVCRpiLocalContext * const lc); ++ ++#define HEVC_BIN_SAO_MERGE_FLAG 0 ++#define HEVC_BIN_SAO_TYPE_IDX 1 ++#define HEVC_BIN_SAO_EO_CLASS 2 ++#define HEVC_BIN_SAO_BAND_POSITION 2 ++#define HEVC_BIN_SAO_OFFSET_ABS 2 ++#define HEVC_BIN_SAO_OFFSET_SIGN 2 ++#define HEVC_BIN_END_OF_SLICE_FLAG 2 ++#define HEVC_BIN_SPLIT_CODING_UNIT_FLAG 2 ++#define HEVC_BIN_CU_TRANSQUANT_BYPASS_FLAG 5 ++#define HEVC_BIN_SKIP_FLAG 6 ++#define HEVC_BIN_CU_QP_DELTA 9 ++#define HEVC_BIN_PRED_MODE 12 ++#define HEVC_BIN_PART_MODE 13 ++#define HEVC_BIN_PCM_FLAG 17 ++#define HEVC_BIN_PREV_INTRA_LUMA_PRED_MODE 17 ++#define HEVC_BIN_MPM_IDX 18 ++#define HEVC_BIN_REM_INTRA_LUMA_PRED_MODE 18 ++#define HEVC_BIN_INTRA_CHROMA_PRED_MODE 18 ++#define HEVC_BIN_MERGE_FLAG 20 ++#define HEVC_BIN_MERGE_IDX 21 ++#define HEVC_BIN_INTER_PRED_IDC 22 ++#define HEVC_BIN_REF_IDX_L0 27 ++#define HEVC_BIN_REF_IDX_L1 29 ++#define HEVC_BIN_ABS_MVD_GREATER0_FLAG 31 ++#define HEVC_BIN_ABS_MVD_GREATER1_FLAG 33 ++#define HEVC_BIN_ABS_MVD_MINUS2 35 ++#define HEVC_BIN_MVD_SIGN_FLAG 35 ++#define HEVC_BIN_MVP_LX_FLAG 35 ++#define HEVC_BIN_NO_RESIDUAL_DATA_FLAG 36 ++#define HEVC_BIN_SPLIT_TRANSFORM_FLAG 37 ++#define HEVC_BIN_CBF_LUMA 40 ++#define HEVC_BIN_CBF_CB_CR 42 ++#define HEVC_BIN_TRANSFORM_SKIP_FLAG 46 ++#define HEVC_BIN_EXPLICIT_RDPCM_FLAG 48 ++#define HEVC_BIN_EXPLICIT_RDPCM_DIR_FLAG 50 ++#define HEVC_BIN_LAST_SIGNIFICANT_COEFF_X_PREFIX 52 ++#define HEVC_BIN_LAST_SIGNIFICANT_COEFF_Y_PREFIX 70 ++#define HEVC_BIN_LAST_SIGNIFICANT_COEFF_X_SUFFIX 88 ++#define HEVC_BIN_LAST_SIGNIFICANT_COEFF_Y_SUFFIX 88 ++#define HEVC_BIN_SIGNIFICANT_COEFF_GROUP_FLAG 88 ++#define HEVC_BIN_SIGNIFICANT_COEFF_FLAG 92 ++#define HEVC_BIN_COEFF_ABS_LEVEL_GREATER1_FLAG 136 ++#define HEVC_BIN_COEFF_ABS_LEVEL_GREATER2_FLAG 160 ++#define HEVC_BIN_COEFF_ABS_LEVEL_REMAINING 166 ++#define HEVC_BIN_COEFF_SIGN_FLAG 166 ++#define HEVC_BIN_LOG2_RES_SCALE_ABS 166 ++#define HEVC_BIN_RES_SCALE_SIGN_FLAG 174 ++#define HEVC_BIN_CU_CHROMA_QP_OFFSET_FLAG 176 ++#define HEVC_BIN_CU_CHROMA_QP_OFFSET_IDX 177 ++ ++ ++int ff_hevc_rpi_get_cabac(CABACContext * const c, uint8_t * const state); ++int ff_hevc_rpi_get_cabac_terminate(CABACContext * const c); ++ ++static inline const uint8_t* ff_hevc_rpi_cabac_skip_bytes(CABACContext * const c, int n) { ++ const uint8_t *ptr = c->bytestream; ++ ++ if (c->low & 0x1) ++ ptr--; ++#if CABAC_BITS == 16 ++ if (c->low & 0x1FF) ++ ptr--; ++#endif ++ if ((int) (c->bytestream_end - ptr) < n) ++ return NULL; ++ if (ff_init_cabac_decoder(c, ptr + n, c->bytestream_end - ptr - n) < 0) ++ return NULL; ++ ++ return ptr; ++} ++ ++static inline int ff_hevc_rpi_sao_merge_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_SAO_MERGE_FLAG); ++} ++ ++static inline int ff_hevc_rpi_cu_transquant_bypass_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_CU_TRANSQUANT_BYPASS_FLAG); ++} ++ ++static inline int ff_hevc_rpi_cu_chroma_qp_offset_flag(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_CU_CHROMA_QP_OFFSET_FLAG); ++} ++ ++static inline int ff_hevc_rpi_split_coding_unit_flag_decode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int ct_depth, ++ const unsigned int x0, const unsigned int y0) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_SPLIT_CODING_UNIT_FLAG + ++ ((s->cabac_stash_left[y0 >> 3] >> 1) > ct_depth) + ++ ((s->cabac_stash_up[x0 >> 3] >> 1) > ct_depth)); ++} ++ ++static inline int ff_hevc_rpi_skip_flag_decode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const int x0, const int y0, const int x_cb, const int y_cb) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_SKIP_FLAG + ++ (s->cabac_stash_left[y0 >> 3] & 1) + ++ (s->cabac_stash_up[x0 >> 3] & 1)); ++} ++ ++static inline int ff_hevc_rpi_pred_mode_decode(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_PRED_MODE); ++} ++ ++static inline int ff_hevc_rpi_pcm_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac_terminate(&lc->cc); ++} ++ ++static inline int ff_hevc_rpi_prev_intra_luma_pred_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_PREV_INTRA_LUMA_PRED_MODE); ++} ++ ++static inline int ff_hevc_rpi_merge_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_MERGE_FLAG); ++} ++ ++static inline int ff_hevc_rpi_mvp_lx_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_MVP_LX_FLAG); ++} ++ ++static inline int ff_hevc_rpi_no_residual_syntax_flag_decode(HEVCRpiLocalContext * const lc) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_NO_RESIDUAL_DATA_FLAG); ++} ++ ++static inline int ff_hevc_rpi_cbf_cb_cr_decode(HEVCRpiLocalContext * const lc, const int trafo_depth) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_CBF_CB_CR + trafo_depth); ++} ++ ++static inline int ff_hevc_rpi_cbf_luma_decode(HEVCRpiLocalContext * const lc, const int trafo_depth) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_CBF_LUMA + !trafo_depth); ++} ++ ++static inline int ff_hevc_rpi_split_transform_flag_decode(HEVCRpiLocalContext * const lc, const int log2_trafo_size) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_SPLIT_TRANSFORM_FLAG + 5 - log2_trafo_size); ++} ++ ++static inline int ff_hevc_rpi_res_scale_sign_flag(HEVCRpiLocalContext *const lc, const int idx) ++{ ++ return ff_hevc_rpi_get_cabac(&lc->cc, lc->cabac_state + HEVC_BIN_RES_SCALE_SIGN_FLAG + idx); ++} ++ ++ ++ ++#endif ++ +--- /dev/null ++++ b/libavcodec/rpi_hevc_data.c +@@ -0,0 +1,75 @@ ++/* ++ * HEVC shared tables ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++ ++#include "rpi_hevc_data.h" ++ ++const uint8_t ff_hevc_rpi_diag_scan4x4_x[16] = { ++ 0, 0, 1, 0, ++ 1, 2, 0, 1, ++ 2, 3, 1, 2, ++ 3, 2, 3, 3, ++}; ++ ++const uint8_t ff_hevc_rpi_diag_scan4x4_y[16] = { ++ 0, 1, 0, 2, ++ 1, 0, 3, 2, ++ 1, 0, 3, 2, ++ 1, 3, 2, 3, ++}; ++ ++const uint8_t ff_hevc_rpi_diag_scan8x8_x[64] = { ++ 0, 0, 1, 0, ++ 1, 2, 0, 1, ++ 2, 3, 0, 1, ++ 2, 3, 4, 0, ++ 1, 2, 3, 4, ++ 5, 0, 1, 2, ++ 3, 4, 5, 6, ++ 0, 1, 2, 3, ++ 4, 5, 6, 7, ++ 1, 2, 3, 4, ++ 5, 6, 7, 2, ++ 3, 4, 5, 6, ++ 7, 3, 4, 5, ++ 6, 7, 4, 5, ++ 6, 7, 5, 6, ++ 7, 6, 7, 7, ++}; ++ ++const uint8_t ff_hevc_rpi_diag_scan8x8_y[64] = { ++ 0, 1, 0, 2, ++ 1, 0, 3, 2, ++ 1, 0, 4, 3, ++ 2, 1, 0, 5, ++ 4, 3, 2, 1, ++ 0, 6, 5, 4, ++ 3, 2, 1, 0, ++ 7, 6, 5, 4, ++ 3, 2, 1, 0, ++ 7, 6, 5, 4, ++ 3, 2, 1, 7, ++ 6, 5, 4, 3, ++ 2, 7, 6, 5, ++ 4, 3, 7, 6, ++ 5, 4, 7, 6, ++ 5, 7, 6, 7, ++}; +--- /dev/null ++++ b/libavcodec/rpi_hevc_data.h +@@ -0,0 +1,31 @@ ++/* ++ * HEVC shared data tables ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_RPI_HEVC_DATA_H ++#define AVCODEC_RPI_HEVC_DATA_H ++ ++#include ++ ++extern const uint8_t ff_hevc_rpi_diag_scan4x4_x[16]; ++extern const uint8_t ff_hevc_rpi_diag_scan4x4_y[16]; ++extern const uint8_t ff_hevc_rpi_diag_scan8x8_x[64]; ++extern const uint8_t ff_hevc_rpi_diag_scan8x8_y[64]; ++ ++#endif /* AVCODEC_RPI_HEVC_DATA_H */ +--- /dev/null ++++ b/libavcodec/rpi_hevc_filter.c +@@ -0,0 +1,1210 @@ ++/* ++ * HEVC video decoder ++ * ++ * Originally by: ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2013 Seppo Tomperi ++ * Copyright (C) 2013 Wassim Hamidouche ++ * ++ * Substantially rewritten: ++ * Copyright (C) 2018 John Cox, Ben Avison for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++//#define DISABLE_SAO ++//#define DISABLE_DEBLOCK ++//#define DISABLE_STRENGTHS ++// define DISABLE_DEBLOCK_NONREF for a 6% speed boost (by skipping deblocking on unimportant frames) ++//#define DISABLE_DEBLOCK_NONREF ++ ++#include "libavutil/common.h" ++#include "libavutil/internal.h" ++ ++#include "rpi_hevcdec.h" ++ ++#include "bit_depth_template.c" ++ ++#include "rpi_qpu.h" ++#include "rpi_zc.h" ++#include "libavutil/rpi_sand_fns.h" ++ ++#define LUMA 0 ++#define CB 1 ++#define CR 2 ++ ++// tcoffset: -12,12; qp: 0,51; (bs-1)*2: 0,2 ++// so -12,75 overall ++static const uint8_t tctablex[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -ve quant padding ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -12..-1 ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // QP 0...18 ++ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, // QP 19...37 ++ 5, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24, // QP 38...53 ++ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 // 54..75 ++}; ++#define tctable (tctablex + 12 + 6*8) ++ ++static const uint8_t betatablex[] = { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -ve quant padding ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // -12..-1 ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, // QP 0...18 ++ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, // QP 19...37 ++ 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, // QP 38...51 ++ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 // 52..73 ++}; ++#define betatable (betatablex + 12 + 6*8) ++ ++static inline int chroma_tc(const HEVCRpiContext * const s, const int qp_y, ++ const int c_idx, const int tc_offset) ++{ ++ return tctable[(int)s->ps.pps->qp_dblk_x[c_idx][qp_y] + tc_offset + 2]; ++} ++ ++static inline int get_qPy_pred(const HEVCRpiContext * const s, const HEVCRpiLocalContext * const lc, ++ const unsigned int xBase, const unsigned int yBase) ++{ ++ const unsigned int ctb_size_mask = (1 << s->ps.sps->log2_ctb_size) - 1; ++ const unsigned int MinCuQpDeltaSizeMask = ~0U << s->ps.pps->log2_min_cu_qp_delta_size; ++ const unsigned int xQgBase = xBase & MinCuQpDeltaSizeMask; ++ const unsigned int yQgBase = yBase & MinCuQpDeltaSizeMask; ++ const unsigned int min_cb_width = s->ps.sps->min_cb_width; ++ const unsigned int x_cb = xQgBase >> s->ps.sps->log2_min_cb_size; ++ const unsigned int y_cb = yQgBase >> s->ps.sps->log2_min_cb_size; ++ const int qPy_pred = lc->qPy_pred; ++ ++ return (((xQgBase & ctb_size_mask) == 0 ? qPy_pred : ++ s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width]) + ++ ((yQgBase & ctb_size_mask) == 0 ? qPy_pred : ++ s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width]) + 1) >> 1; ++} ++ ++// * Only called from bitstream decode in foreground ++// so should be safe ++void ff_hevc_rpi_set_qPy(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, int xBase, int yBase) ++{ ++ const int qp_y = get_qPy_pred(s, lc, xBase, yBase); ++ ++ if (lc->tu.cu_qp_delta != 0) { ++ // ?? I suspect that the -bd_offset here leads to us adding it elsewhere ++ int off = s->ps.sps->qp_bd_offset; ++ lc->qp_y = FFUMOD(qp_y + lc->tu.cu_qp_delta + 52 + 2 * off, ++ 52 + off) - off; ++ } else ++ lc->qp_y = qp_y; ++} ++ ++static inline unsigned int pixel_shift(const HEVCRpiContext * const s, const unsigned int c_idx) ++{ ++ return c_idx != 0 ? 1 + s->ps.sps->pixel_shift : s->ps.sps->pixel_shift; ++} ++ ++// "DSP" these? ++static void copy_pixel(uint8_t *dst, const uint8_t *src, int pixel_shift) ++{ ++ switch (pixel_shift) ++ { ++ case 2: ++ *(uint32_t *)dst = *(uint32_t *)src; ++ break; ++ case 1: ++ *(uint16_t *)dst = *(uint16_t *)src; ++ break; ++ default: ++ *dst = *src; ++ break; ++ } ++} ++ ++static void copy_CTB_to_hv(const HEVCRpiContext * const s, const uint8_t * const src, ++ ptrdiff_t stride_src, int x, int y, int width, int height, ++ int c_idx, int x_ctb, int y_ctb) ++{ ++ const unsigned int sh = pixel_shift(s, c_idx); ++ const unsigned int w = s->ps.sps->width >> ctx_hshift(s, c_idx); ++ const unsigned int h = s->ps.sps->height >> ctx_vshift(s, c_idx); ++ ++ /* copy horizontal edges */ ++ memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << sh), ++ src, width << sh); ++ memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << sh), ++ src + stride_src * (height - 1), width << sh); ++ ++ /* copy vertical edges */ ++ ff_hevc_rpi_copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << sh), src, sh, height, 1 << sh, stride_src); ++ ++ ff_hevc_rpi_copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 1) * h + y) << sh), src + ((width - 1) << sh), sh, height, 1 << sh, stride_src); ++} ++ ++// N.B. Src & dst are swapped as this is a restore! ++// x0 & y0 are in luma coords ++// Width & height are in Y/C pels as appropriate ++// * Clear scope for optimsation here but not used enough to be worth it ++static void restore_tqb_pixels(const HEVCRpiContext * const s, ++ uint8_t *src1, const uint8_t *dst1, ++ const ptrdiff_t stride_src, const ptrdiff_t stride_dst, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int width, const int height, ++ const int c_idx) ++{ ++ if (s->ps.pps->transquant_bypass_enable_flag || ++ s->ps.sps->pcm.loop_filter_disable_flag) ++ { ++ const uint8_t *pcm = s->is_pcm + (x0 >> 6) + (y0 >> 3) * s->ps.sps->pcm_width; ++ int blks_y = height >> (c_idx == 0 ? 3 : 2); ++ const unsigned int bwidth = 8 << s->ps.sps->pixel_shift; // Y & C have the same width in sand ++ const unsigned int bheight = (c_idx == 0) ? 8 : 4; ++ const unsigned int sh = ((x0 >> 3) & 7); ++ const unsigned int mask = (1 << (width >> (c_idx == 0 ? 3 : 2))) - 1; ++ ++ do { ++ unsigned int m = (*pcm >> sh) & mask; ++ uint8_t * bd = src1; ++ const uint8_t * bs = dst1; ++ while (m != 0) { ++ if ((m & 1) != 0) { ++ s->hevcdsp.cpy_blk(bd, stride_src, bs, stride_dst, bwidth, bheight); ++ } ++ m >>= 1; ++ bs += bwidth; ++ bd += bwidth; ++ } ++ src1 += stride_src * bheight; ++ dst1 += stride_dst * bheight; ++ pcm += s->ps.sps->pcm_width; ++ } while (--blks_y > 0); ++ } ++} ++ ++#define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)]) ++ ++static void sao_filter_CTB(const HEVCRpiContext * const s, const int x, const int y) ++{ ++#if SAO_FILTER_N == 5 ++ static const uint8_t sao_tab[8] = { 0 /* 8 */, 1 /* 16 */, 2 /* 24 */, 2 /* 32 */, 3, 3 /* 48 */, 4, 4 /* 64 */}; ++#elif SAO_FILTER_N == 6 ++ static const uint8_t sao_tab[8] = { 0 /* 8 */, 1 /* 16 */, 5 /* 24 */, 2 /* 32 */, 3, 3 /* 48 */, 4, 4 /* 64 */}; ++#else ++#error Confused by size of sao fn array ++#endif ++ int c_idx; ++ int edges[4]; // 0 left 1 top 2 right 3 bottom ++ int x_ctb = x >> s->ps.sps->log2_ctb_size; ++ int y_ctb = y >> s->ps.sps->log2_ctb_size; ++ int ctb_addr_rs = y_ctb * s->ps.sps->ctb_width + x_ctb; ++ int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs]; ++ RpiSAOParams *sao = &CTB(s->sao, x_ctb, y_ctb); ++ // flags indicating unfilterable edges ++ uint8_t vert_edge[] = { 0, 0 }; ++ uint8_t horiz_edge[] = { 0, 0 }; ++ uint8_t diag_edge[] = { 0, 0, 0, 0 }; ++ uint8_t lfase = CTB(s->filter_slice_edges, x_ctb, y_ctb); ++ uint8_t no_tile_filter = s->ps.pps->tiles_enabled_flag && ++ !s->ps.pps->loop_filter_across_tiles_enabled_flag; ++ uint8_t restore = no_tile_filter || !lfase; ++ uint8_t left_tile_edge = 0; ++ uint8_t right_tile_edge = 0; ++ uint8_t up_tile_edge = 0; ++ uint8_t bottom_tile_edge = 0; ++ const int sliced = 1; ++ const int plane_count = sliced ? 2 : (ctx_cfmt(s) != 0 ? 3 : 1); ++ ++ edges[0] = x_ctb == 0; ++ edges[1] = y_ctb == 0; ++ edges[2] = x_ctb == s->ps.sps->ctb_width - 1; ++ edges[3] = y_ctb == s->ps.sps->ctb_height - 1; ++ ++#ifdef DISABLE_SAO ++ return; ++#endif ++ ++ if (restore) { ++ if (!edges[0]) { ++ left_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]]; ++ vert_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb)) || left_tile_edge; ++ } ++ if (!edges[2]) { ++ right_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs+1]]; ++ vert_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb)) || right_tile_edge; ++ } ++ if (!edges[1]) { ++ up_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs - s->ps.sps->ctb_width]]; ++ horiz_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb, y_ctb - 1)) || up_tile_edge; ++ } ++ if (!edges[3]) { ++ bottom_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs + s->ps.sps->ctb_width]]; ++ horiz_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb, y_ctb + 1)) || bottom_tile_edge; ++ } ++ if (!edges[0] && !edges[1]) { ++ diag_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb - 1)) || left_tile_edge || up_tile_edge; ++ } ++ if (!edges[1] && !edges[2]) { ++ diag_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb - 1)) || right_tile_edge || up_tile_edge; ++ } ++ if (!edges[2] && !edges[3]) { ++ diag_edge[2] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb + 1)) || right_tile_edge || bottom_tile_edge; ++ } ++ if (!edges[0] && !edges[3]) { ++ diag_edge[3] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb + 1)) || left_tile_edge || bottom_tile_edge; ++ } ++ } ++ ++ for (c_idx = 0; c_idx < plane_count; c_idx++) { ++ const unsigned int vshift = ctx_vshift(s, c_idx); ++ const unsigned int hshift = ctx_hshift(s, c_idx); ++ const int x0 = x >> hshift; ++ const int y0 = y >> vshift; ++ const ptrdiff_t stride_src = frame_stride1(s->frame, c_idx); ++ const int ctb_size_h = (1 << (s->ps.sps->log2_ctb_size)) >> hshift; ++ const int ctb_size_v = (1 << (s->ps.sps->log2_ctb_size)) >> vshift; ++ const int width = FFMIN(ctb_size_h, (s->ps.sps->width >> hshift) - x0); ++ const int height = FFMIN(ctb_size_v, (s->ps.sps->height >> vshift) - y0); ++ int tab = sao_tab[(FFALIGN(width, 8) >> 3) - 1]; ++ ptrdiff_t stride_dst; ++ uint8_t *dst; ++ ++ const unsigned int sh = s->ps.sps->pixel_shift + (sliced && c_idx != 0); ++ const int wants_lr = sao->type_idx[c_idx] == SAO_EDGE && sao->eo_class[c_idx] != 1 /* Vertical */; ++ uint8_t * const src = !sliced ? ++ &s->frame->data[c_idx][y0 * stride_src + (x0 << sh)] : ++ c_idx == 0 ? ++ av_rpi_sand_frame_pos_y(s->frame, x0, y0) : ++ av_rpi_sand_frame_pos_c(s->frame, x0, y0); ++ const uint8_t * const src_l = edges[0] || !wants_lr ? NULL : ++ !sliced ? src - (1 << sh) : ++ c_idx == 0 ? ++ av_rpi_sand_frame_pos_y(s->frame, x0 - 1, y0) : ++ av_rpi_sand_frame_pos_c(s->frame, x0 - 1, y0); ++ const uint8_t * const src_r = edges[2] || !wants_lr ? NULL : ++ !sliced ? src + (width << sh) : ++ c_idx == 0 ? ++ av_rpi_sand_frame_pos_y(s->frame, x0 + width, y0) : ++ av_rpi_sand_frame_pos_c(s->frame, x0 + width, y0); ++ ++ if (sliced && c_idx > 1) { ++ break; ++ } ++ ++// if (c_idx == 1) ++// printf("%d: %dx%d %d,%d: lr=%d\n", c_idx, width, height, x0, y0, wants_lr); ++ ++ switch (sao->type_idx[c_idx]) { ++ case SAO_BAND: ++ copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx, ++ x_ctb, y_ctb); ++ if (s->ps.pps->transquant_bypass_enable_flag || ++ s->ps.sps->pcm.loop_filter_disable_flag) ++ { ++ // Can't use the edge buffer here as it may be in use by the foreground ++ DECLARE_ALIGNED(64, uint8_t, dstbuf) ++ [2*MAX_PB_SIZE*MAX_PB_SIZE]; ++ dst = dstbuf; ++ stride_dst = 2*MAX_PB_SIZE; ++ s->hevcdsp.cpy_blk(dst, stride_dst, src, stride_src, width << sh, height); ++ if (sliced && c_idx != 0) ++ { ++ s->hevcdsp.sao_band_filter_c[tab](src, dst, stride_src, stride_dst, ++ sao->offset_val[1], sao->band_position[1], ++ sao->offset_val[2], sao->band_position[2], ++ width, height); ++ } ++ else ++ { ++ s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst, ++ sao->offset_val[c_idx], sao->band_position[c_idx], ++ width, height); ++ } ++ restore_tqb_pixels(s, src, dst, stride_src, stride_dst, ++ x, y, width, height, c_idx); ++ } else { ++ if (sliced && c_idx != 0) ++ { ++ s->hevcdsp.sao_band_filter_c[tab](src, src, stride_src, stride_src, ++ sao->offset_val[1], sao->band_position[1], ++ sao->offset_val[2], sao->band_position[2], ++ width, height); ++ } ++ else ++ { ++ s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src, ++ sao->offset_val[c_idx], sao->band_position[c_idx], ++ width, height); ++ } ++ } ++ sao->type_idx[c_idx] = SAO_APPLIED; ++ break; ++ case SAO_EDGE: ++ { ++ const int w = s->ps.sps->width >> hshift; ++ const int h = s->ps.sps->height >> vshift; ++ int top_edge = edges[1]; ++ int bottom_edge = edges[3]; ++ // Can't use the edge buffer here as it may be in use by the foreground ++ DECLARE_ALIGNED(64, uint8_t, dstbuf) ++ [RPI_HEVC_SAO_BUF_STRIDE * (MAX_PB_SIZE + 2) + 64]; ++ ++ stride_dst = RPI_HEVC_SAO_BUF_STRIDE; ++ dst = dstbuf + stride_dst + 32; ++ ++ if (!top_edge) { ++ uint8_t *dst1; ++ int src_idx; ++ const uint8_t * const src_spb = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0) << sh); ++ ++ dst1 = dst - stride_dst; ++ ++ if (src_l != NULL) { ++ src_idx = (CTB(s->sao, x_ctb-1, y_ctb-1).type_idx[c_idx] == ++ SAO_APPLIED); ++ copy_pixel(dst1 - (1 << sh), src_idx ? src_spb - (1 << sh) : src_l - stride_src, sh); ++ } ++ ++ src_idx = (CTB(s->sao, x_ctb, y_ctb-1).type_idx[c_idx] == ++ SAO_APPLIED); ++ memcpy(dst1, src_idx ? src_spb : src - stride_src, width << sh); ++ ++ if (src_r != NULL) { ++ src_idx = (CTB(s->sao, x_ctb+1, y_ctb-1).type_idx[c_idx] == ++ SAO_APPLIED); ++ copy_pixel(dst1 + (width << sh), src_idx ? src_spb + (width << sh) : src_r - stride_src, sh); ++ } ++ } ++ if (!bottom_edge) { ++ uint8_t * const dst1 = dst + height * stride_dst; ++ int src_idx; ++ const uint8_t * const src_spb = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0) << sh); ++ const unsigned int hoff = height * stride_src; ++ ++ if (src_l != NULL) { ++ src_idx = (CTB(s->sao, x_ctb-1, y_ctb+1).type_idx[c_idx] == ++ SAO_APPLIED); ++ copy_pixel(dst1 - (1 << sh), src_idx ? src_spb - (1 << sh) : src_l + hoff, sh); ++ } ++ ++ src_idx = (CTB(s->sao, x_ctb, y_ctb+1).type_idx[c_idx] == ++ SAO_APPLIED); ++ memcpy(dst1, src_idx ? src_spb : src + hoff, width << sh); ++ ++ if (src_r != NULL) { ++ src_idx = (CTB(s->sao, x_ctb+1, y_ctb+1).type_idx[c_idx] == ++ SAO_APPLIED); ++ copy_pixel(dst1 + (width << sh), src_idx ? src_spb + (width << sh) : src_r + hoff, sh); ++ } ++ } ++ if (src_l != NULL) { ++ if (CTB(s->sao, x_ctb-1, y_ctb).type_idx[c_idx] == SAO_APPLIED) { ++ ff_hevc_rpi_copy_vert(dst - (1 << sh), ++ s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh), ++ sh, height, stride_dst, 1 << sh); ++ } else { ++ ff_hevc_rpi_copy_vert(dst - (1 << sh), ++ src_l, ++ sh, height, stride_dst, stride_src); ++ } ++ } ++ if (src_r != NULL) { ++ if (CTB(s->sao, x_ctb+1, y_ctb).type_idx[c_idx] == SAO_APPLIED) { ++ ff_hevc_rpi_copy_vert(dst + (width << sh), ++ s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) * h + y0) << sh), ++ sh, height, stride_dst, 1 << sh); ++ } else { ++ ff_hevc_rpi_copy_vert(dst + (width << sh), ++ src_r, ++ sh, height, stride_dst, stride_src); ++ } ++ } ++ ++ s->hevcdsp.cpy_blk(dst, stride_dst, src, stride_src, width << sh, height); ++ ++ copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx, ++ x_ctb, y_ctb); ++ if (sliced && c_idx != 0) ++ { ++ // Class always the same for both U & V (which is just as well :-)) ++ s->hevcdsp.sao_edge_filter_c[tab](src, dst, stride_src, ++ sao->offset_val[1], sao->offset_val[2], sao->eo_class[1], ++ width, height); ++ s->hevcdsp.sao_edge_restore_c[restore](src, dst, ++ stride_src, stride_dst, ++ sao, ++ edges, width, ++ height, c_idx, ++ vert_edge, ++ horiz_edge, ++ diag_edge); ++ } ++ else ++ { ++ s->hevcdsp.sao_edge_filter[tab](src, dst, stride_src, sao->offset_val[c_idx], ++ sao->eo_class[c_idx], width, height); ++ s->hevcdsp.sao_edge_restore[restore](src, dst, ++ stride_src, stride_dst, ++ sao, ++ edges, width, ++ height, c_idx, ++ vert_edge, ++ horiz_edge, ++ diag_edge); ++ } ++ restore_tqb_pixels(s, src, dst, stride_src, stride_dst, ++ x, y, width, height, c_idx); ++ sao->type_idx[c_idx] = SAO_APPLIED; ++ break; ++ } ++ } ++ } ++ ++#if RPI_ZC_SAND_8_IN_10_BUF ++ if (s->frame->format == AV_PIX_FMT_SAND64_10 && s->frame->buf[RPI_ZC_SAND_8_IN_10_BUF] != NULL && ++ (((x + (1 << (s->ps.sps->log2_ctb_size))) & 255) == 0 || edges[2])) ++ { ++ const unsigned int stride1 = frame_stride1(s->frame, 1); ++ const unsigned int stride2 = av_rpi_sand_frame_stride2(s->frame); ++ const unsigned int xoff = (x >> 8) * stride2 * stride1; ++ const unsigned int ctb_size = (1 << s->ps.sps->log2_ctb_size); ++ const uint8_t * const sy = s->frame->data[0] + xoff * 4 + y * stride1; ++ uint8_t * const dy = s->frame->buf[4]->data + xoff * 2 + y * stride1; ++ const uint8_t * const sc = s->frame->data[1] + xoff * 4 + (y >> 1) * stride1; ++ uint8_t * const dc = s->frame->buf[4]->data + (s->frame->data[1] - s->frame->data[0]) + xoff * 2 + (y >> 1) * stride1; ++ const unsigned int wy = !edges[2] ? 256 : s->ps.sps->width - (x & ~255); ++ const unsigned int hy = !edges[3] ? ctb_size : s->ps.sps->height - y; ++ ++// printf("dy=%p/%p, stride1=%d, stride2=%d, sy=%p/%p, wy=%d, hy=%d, x=%d, y=%d, cs=%d\n", dy, dc, stride1, stride2, sy, sc, wy, hy, x, y, ctb_size); ++ av_rpi_sand16_to_sand8(dy, stride1, stride2, sy, stride1, stride2, wy, hy, 3); ++ av_rpi_sand16_to_sand8(dc, stride1, stride2, sc, stride1, stride2, wy, hy >> 1, 3); ++ } ++#endif ++} ++ ++// When bits are delivered to deblock we want them ++//#define TL 1 ++//#define TR 2 ++//#define BL 4 ++//#define BR 8 ++ ++// pcm4 returns them as b0 = tl, b1 = tr, b16 = bl, b17 = br ++// so we need to rearrange before passing on ++ ++static inline uint32_t pcm4(const HEVCRpiContext * const s, const unsigned int x, const unsigned int y) ++{ ++ const uint8_t * const pcm = s->is_pcm + (x >> 6) + (y >> 3) * s->ps.sps->pcm_width; ++ return (pcm[0] | ++ (pcm[1] << 8) | ++ (pcm[s->ps.sps->pcm_width] << 16) | ++ (pcm[s->ps.sps->pcm_width + 1] << 24)) >> ((x >> 3) & 7); ++} ++ ++static inline uint32_t pcm2(const HEVCRpiContext * const s, const unsigned int x, const unsigned int y) ++{ ++ const uint8_t * const pcm = s->is_pcm + (x >> 6) + (y >> 3) * s->ps.sps->pcm_width; ++ return (pcm[0] | (pcm[1] << 8)) >> ((x >> 3) & 7); ++} ++ ++// We cast away const here as we want this to work for both get and set ++static inline uint32_t * bs_ptr32(const uint8_t * bs, const unsigned int stride2, const unsigned int x, const unsigned int y) ++{ ++ return (uint32_t *)(bs + ++#if (~3U & (HEVC_RPI_BS_STRIDE1_PEL_MASK >> HEVC_RPI_BS_PELS_PER_BYTE_SHIFT)) != 0 ++#warning Unexpected masks ++ // As it happens we end up with stride1 = sizeof(uint32_t) so this expr vanishes ++ ((x >> HEVC_RPI_BS_PELS_PER_BYTE_SHIFT) & ++ (~3 & (HEVC_RPI_BS_STRIDE1_PEL_MASK >> HEVC_RPI_BS_PELS_PER_BYTE_SHIFT))) + ++#elif HEVC_RPI_BS_STRIDE1_BYTES < 4 ++#error Stride1 < return size ++#endif ++ ((y >> HEVC_RPI_BS_Y_SHR) << HEVC_RPI_BS_STRIDE1_BYTE_SHIFT) + ++ (x >> HEVC_RPI_BS_STRIDE1_PEL_SHIFT) * stride2); ++} ++ ++static inline uint8_t * bs_ptr8(const uint8_t * bs, const unsigned int stride2, const unsigned int x, const unsigned int y) ++{ ++ return (uint8_t *)(bs + ++ ((x >> HEVC_RPI_BS_PELS_PER_BYTE_SHIFT) & ++ (HEVC_RPI_BS_STRIDE1_PEL_MASK >> HEVC_RPI_BS_PELS_PER_BYTE_SHIFT)) + ++ ((y >> HEVC_RPI_BS_Y_SHR) << HEVC_RPI_BS_STRIDE1_BYTE_SHIFT) + ++ (x >> HEVC_RPI_BS_STRIDE1_PEL_SHIFT) * stride2); ++} ++ ++ ++// Get block strength ++// Given how we call we will always get within the 32bit boundries ++static inline uint32_t bs_get32(const uint8_t * bs, unsigned int stride2, ++ unsigned int xl, unsigned int xr, const unsigned int y) ++{ ++ if (xr <= xl) { ++ return 0; ++ } ++ else ++ { ++#if HAVE_ARMV6T2_INLINE ++#if (~3U & (HEVC_RPI_BS_STRIDE1_PEL_MASK >> HEVC_RPI_BS_PELS_PER_BYTE_SHIFT)) != 0 ++#error This case not yet handled in bs_get32 ++#elif HEVC_RPI_BS_STRIDE1_BYTES < 4 ++#error Stride1 < return size ++#endif ++ uint32_t tmp; ++ __asm__ ( ++ "lsr %[tmp], %[xl], %[xl_shift] \n\t" ++ "rsb %[xr], %[xl], %[xr] \n\t" ++ "mla %[stride2], %[stride2], %[tmp], %[bs] \n\t" ++ "add %[xr], %[xr], #7 \n\t" ++ "lsr %[bs], %[y], %[y_shift1] \n\t" ++ "bic %[xr], %[xr], #7 \n\t" ++ "ubfx %[xl], %[xl], #1, #5 \n\t" ++ "lsr %[xr], %[xr], #1 \n\t" ++ "cmp %[xr], #32 \n\t" ++ "mvn %[tmp], #0 \n\t" ++ "ldr %[bs], [%[stride2], %[bs], lsl %[y_shift2]] \n\t" ++ "lsl %[tmp], %[tmp], %[xr] \n\t" ++ "lsr %[xl], %[bs], %[xl] \n\t" ++ "it ne \n\t" ++ "bicne %[bs], %[xl], %[tmp] \n\t" ++ : // Outputs ++ [bs]"+r"(bs), ++ [stride2]"+r"(stride2), ++ [xl]"+r"(xl), ++ [xr]"+r"(xr), ++ [tmp]"=&r"(tmp) ++ : // Inputs ++ [y]"r"(y), ++ [xl_shift]"M"(HEVC_RPI_BS_STRIDE1_PEL_SHIFT), ++ [y_shift1]"M"(HEVC_RPI_BS_Y_SHR), ++ [y_shift2]"M"(HEVC_RPI_BS_STRIDE1_BYTE_SHIFT) ++ : // Clobbers ++ "cc" ++ ); ++ return (uint32_t) bs; ++#else ++ const uint32_t a = *bs_ptr32(bs, stride2, xl, y); ++ const unsigned int n = ((xr - xl + 7) & ~7) >> 1; ++ ++ return n == 32 ? a : ++ (a >> ((xl >> 1) & 31)) & ~(~0U << n); ++#endif ++ } ++} ++ ++static inline uint32_t hbs_get32(const HEVCRpiContext * const s, const unsigned int xl, const unsigned int xr, const unsigned int y) ++{ ++ av_assert2(((xl ^ (xr - 1)) >> s->ps.sps->log2_ctb_size) == 0); ++ return bs_get32(s->bs_horizontal, s->bs_stride2, xl, xr, y); ++} ++ ++static inline uint32_t vbs_get32(const HEVCRpiContext * const s, const unsigned int xl, const unsigned int xr, const unsigned int y) ++{ ++ av_assert2(((xl ^ (xr - 1)) >> s->ps.sps->log2_ctb_size) == 0); ++ return bs_get32(s->bs_vertical, s->bs_stride2, xl, xr, y); ++} ++ ++ ++static void deblock_y_blk(const HEVCRpiContext * const s, const RpiBlk bounds, const int end_x, const int end_y) ++{ ++ const unsigned int log2_ctb_size = s->ps.sps->log2_ctb_size; ++ const unsigned int log2_min_cb_size = s->ps.sps->log2_min_cb_size; ++ const unsigned int ctb_size = (1 << log2_ctb_size); ++ const unsigned int cb_r = bounds.x + bounds.w - (end_x ? 0 : 1); ++ const unsigned int ctb_n = (bounds.x + bounds.y * s->ps.sps->ctb_width) >> log2_ctb_size; ++ const DBParams * cb_dbp = s->deblock + ctb_n; ++ const unsigned int b_b = bounds.y + bounds.h - (end_y ? 0 : 8); ++ ++ unsigned int cb_x; ++ ++ // Do in CTB-shaped blocks ++ for (cb_x = bounds.x; cb_x < cb_r; cb_x += ctb_size, ++cb_dbp) ++ { ++ const unsigned int bv_r = FFMIN(cb_x + ctb_size, cb_r); ++ const unsigned int bv_l = FFMAX(cb_x, 8); ++ const unsigned int bh_r = cb_x + ctb_size >= cb_r ? cb_r - 8 : cb_x + ctb_size - 9; ++ const unsigned int bh_l = bv_l - 8; ++ unsigned int y; ++ ++ // Main body ++ for (y = (bounds.y == 0 ? 0 : bounds.y - 8); y < b_b; y += 8) ++ { ++ uint32_t vbs = vbs_get32(s, bv_l, bv_r, y); ++ ++ const DBParams * const dbp = y < bounds.y ? cb_dbp - s->ps.sps->ctb_width : cb_dbp; ++ const int8_t * const qta = s->qp_y_tab + ((y - 1) >> log2_min_cb_size) * s->ps.sps->min_cb_width; ++ const int8_t * const qtb = s->qp_y_tab + (y >> log2_min_cb_size) * s->ps.sps->min_cb_width; ++ ++ if (vbs != 0) ++ { ++ const uint8_t * const tcv = tctable + dbp->tc_offset; ++ const uint8_t * const betav = betatable + dbp->beta_offset; ++ unsigned int pcmfa = pcm2(s, bv_l - 1, y); ++ unsigned int x; ++ ++ for (x = bv_l; vbs != 0; x += 8, vbs >>= 4, pcmfa >>= 1) ++ { ++ if ((vbs & 0xf) != 0 && (pcmfa & 3) != 3) ++ { ++ const int qp = (qtb[(x - 1) >> log2_min_cb_size] + qtb[x >> log2_min_cb_size] + 1) >> 1; ++ s->hevcdsp.hevc_v_loop_filter_luma2(av_rpi_sand_frame_pos_y(s->frame, x, y), ++ frame_stride1(s->frame, LUMA), ++ betav[qp], ++ ((vbs & 3) == 0 ? 0 : tcv[qp + (int)(vbs & 2)]) | ++ (((vbs & 0xc) == 0 ? 0 : tcv[qp + (int)((vbs >> 2) & 2)]) << 16), ++ pcmfa & 3, ++ av_rpi_sand_frame_pos_y(s->frame, x - 4, y)); ++ } ++ } ++ } ++ ++ if (y != 0) ++ { ++ uint32_t hbs; ++ ++ // H left - mostly separated out so we only need a uint32_t hbs ++ if ((hbs = hbs_get32(s, bh_l, cb_x, y)) != 0) ++ { ++ const unsigned int x = bh_l; ++ const unsigned int pcmfa = pcm4(s, bh_l, y - 1); ++ const int qp = (qta[x >> log2_min_cb_size] + qtb[x >> log2_min_cb_size] + 1) >> 1; ++ const DBParams * const dbph = dbp - 1; ++ const uint8_t * const tc = tctable + dbph->tc_offset + qp; ++ ++ av_assert2(cb_x - bh_l == 8); ++ ++ s->hevcdsp.hevc_h_loop_filter_luma2(av_rpi_sand_frame_pos_y(s->frame, x, y), ++ frame_stride1(s->frame, LUMA), ++ betatable[qp + dbph->beta_offset], ++ ((hbs & 3) == 0 ? 0 : tc[hbs & 2]) | ++ (((hbs & 0xc) == 0 ? 0 : tc[(hbs >> 2) & 2]) << 16), ++ (pcmfa & 1) | ((pcmfa & 0x10000) >> 15)); ++ } ++ ++ // H ++ if ((hbs = hbs_get32(s, cb_x, bh_r + 1, y)) != 0) // Will give (x <= bh_r) in for loop ++ { ++ unsigned int x; ++ unsigned int pcmfa = pcm4(s, cb_x, y - 1); ++ ++ for (x = cb_x; hbs != 0; x += 8, hbs >>= 4, pcmfa >>= 1) ++ { ++ if ((hbs & 0xf) != 0 && (~pcmfa & 0x10001) != 0) ++ { ++ const int qp = (qta[x >> log2_min_cb_size] + qtb[x >> log2_min_cb_size] + 1) >> 1; ++ const uint8_t * const tc = tctable + dbp->tc_offset + qp; ++ s->hevcdsp.hevc_h_loop_filter_luma2(av_rpi_sand_frame_pos_y(s->frame, x, y), ++ frame_stride1(s->frame, LUMA), ++ betatable[qp + dbp->beta_offset], ++ ((hbs & 3) == 0 ? 0 : tc[hbs & 2]) | ++ (((hbs & 0xc) == 0 ? 0 : tc[(hbs >> 2) & 2]) << 16), ++ (pcmfa & 1) | ((pcmfa & 0x10000) >> 15)); ++ } ++ } ++ } ++ } ++ ++ } ++ } ++} ++ ++static av_always_inline int q2h(const HEVCRpiContext * const s, const unsigned int x, const unsigned int y) ++{ ++ const unsigned int log2_min_cb_size = s->ps.sps->log2_min_cb_size; ++ const int8_t * const qt = s->qp_y_tab + (y >> log2_min_cb_size) * s->ps.sps->min_cb_width; ++ return (qt[(x - 1) >> log2_min_cb_size] + qt[x >> log2_min_cb_size] + 1) >> 1; ++} ++ ++static void deblock_uv_blk(const HEVCRpiContext * const s, const RpiBlk bounds, const int end_x, const int end_y) ++{ ++ const unsigned int log2_ctb_size = s->ps.sps->log2_ctb_size; ++ const unsigned int log2_min_cb_size = s->ps.sps->log2_min_cb_size; ++ const unsigned int ctb_size = (1 << log2_ctb_size); ++ const unsigned int cb_r = bounds.x + bounds.w - (end_x ? 0 : 8); ++ const unsigned int ctb_n = (bounds.x + bounds.y * s->ps.sps->ctb_width) >> log2_ctb_size; ++ const DBParams * dbp = s->deblock + ctb_n; ++ const unsigned int b_b = bounds.y + bounds.h - (end_y ? 0 : 8); ++ const uint8_t * const tcq_u = s->ps.pps->qp_dblk_x[1]; ++ const uint8_t * const tcq_v = s->ps.pps->qp_dblk_x[2]; ++ ++ unsigned int cb_x; ++ ++ av_assert1((bounds.x & (ctb_size - 1)) == 0); ++ av_assert1((bounds.y & (ctb_size - 1)) == 0); ++ av_assert1(bounds.h <= ctb_size); ++ ++ // Do in CTB-shaped blocks ++ for (cb_x = bounds.x; cb_x < cb_r; cb_x += ctb_size, ++dbp) { ++ const unsigned int bv_r = FFMIN(cb_x + ctb_size, cb_r); ++ const unsigned int bv_l = FFMAX(cb_x, 16); ++ unsigned int y; ++ ++ // V above ++ if (bounds.y != 0) { ++ // Deblock V up 8 ++ // CTB above current ++ // Top-half only (tc4 & ~0xffff == 0) is special cased in asm ++ const unsigned int y = bounds.y - 8; ++ uint32_t vbs = vbs_get32(s, bv_l, bv_r, y) & 0x02020202U; ++ ++ if (vbs != 0) ++ { ++ unsigned int pcmfa = pcm2(s, bv_l - 1, y); ++ const uint8_t * const tc = tctable + 2 + (dbp - s->ps.sps->ctb_width)->tc_offset; ++ unsigned int x; ++ ++ for (x = bv_l; vbs != 0; x += 16, vbs >>= 8, pcmfa >>= 2) ++ { ++ if ((vbs & 2) != 0 && (~pcmfa & 3) != 0) ++ { ++ const int qp0 = q2h(s, x, y); ++ s->hevcdsp.hevc_v_loop_filter_uv2(av_rpi_sand_frame_pos_c(s->frame, x >> 1, y >> 1), ++ frame_stride1(s->frame, 1), ++ tc[tcq_u[qp0]] | (tc[tcq_v[qp0]] << 8), ++ av_rpi_sand_frame_pos_c(s->frame, (x >> 1) - 2, y >> 1), ++ pcmfa & 3); ++ } ++ } ++ } ++ } ++ ++ for (y = bounds.y; y < b_b; y += 16) ++ { ++ uint32_t vbs = (vbs_get32(s, bv_l, bv_r, y) & 0x02020202U) | ++ (y + 16 > b_b ? 0 : (vbs_get32(s, bv_l, bv_r, y + 8) & 0x02020202U) << 4); ++ ++ // V ++ if (vbs != 0) ++ { ++ unsigned int x; ++ unsigned int pcmfa = ++ (y + 16 > b_b ? ++ pcm2(s, bv_l - 1, y) | 0xffff0000 : ++ pcm4(s, bv_l - 1, y)); ++ const uint8_t * const tc = tctable + 2 + dbp->tc_offset; ++ ++ for (x = bv_l; vbs != 0; x += 16, vbs >>= 8, pcmfa >>= 2) ++ { ++ if ((vbs & 0xff) != 0 && (~pcmfa & 0x30003) != 0) ++ { ++ const int qp0 = q2h(s, x, y); ++ const int qp1 = q2h(s, x, y + 8); ++ s->hevcdsp.hevc_v_loop_filter_uv2(av_rpi_sand_frame_pos_c(s->frame, x >> 1, y >> 1), ++ frame_stride1(s->frame, 1), ++ ((vbs & 2) == 0 ? 0 : (tc[tcq_u[qp0]] << 0) | (tc[tcq_v[qp0]] << 8)) | ++ ((vbs & 0x20) == 0 ? 0 : (tc[tcq_u[qp1]] << 16) | (tc[tcq_v[qp1]] << 24)), ++ av_rpi_sand_frame_pos_c(s->frame, (x >> 1) - 2, y >> 1), ++ (pcmfa & 3) | ((pcmfa >> 14) & 0xc)); ++ } ++ } ++ } ++ ++ // H ++ if (y != 0) ++ { ++ uint32_t hbs; ++ const unsigned int bh_l = bv_l - 16; ++ const unsigned int bh_r = cb_x + ctb_size >= cb_r ? cb_r : cb_x + ctb_size - 16; ++ const int8_t * const qta = s->qp_y_tab + ((y - 1) >> log2_min_cb_size) * s->ps.sps->min_cb_width; ++ const int8_t * const qtb = s->qp_y_tab + (y >> log2_min_cb_size) * s->ps.sps->min_cb_width; ++ ++ // H left - mostly separated out so we only need a uint32_t hbs ++ // Stub is width 8 to the left of bounds, but width 16 internally ++ if ((hbs = hbs_get32(s, bh_l, cb_x, y) & 0x22U) != 0) ++ { ++ unsigned int pcmfa = pcm4(s, bh_l, y - 1); ++ ++ // Chop off bits we don't want... ++ if (bh_l < bounds.x) { ++ pcmfa |= 0x10001; // TL|BL pre rearrangement ++ hbs &= ~3; // Make BS 0 ++ } ++ ++ // Double check we still want this ++ if (hbs != 0 && (~pcmfa & 0x30003) != 0) ++ { ++ const unsigned int x = bh_l; ++ const int qp0 = (qta[x >> log2_min_cb_size] + qtb[x >> log2_min_cb_size] + 1) >> 1; ++ const int qp1 = (qta[(x + 8) >> log2_min_cb_size] + qtb[(x + 8) >> log2_min_cb_size] + 1) >> 1; ++ const uint8_t * const tc = tctable + 2 + (dbp - 1)->tc_offset; ++ ++ s->hevcdsp.hevc_h_loop_filter_uv(av_rpi_sand_frame_pos_c(s->frame, x >> 1, y >> 1), ++ frame_stride1(s->frame, 1), ++ ((hbs & 2) == 0 ? 0 : (tc[tcq_u[qp0]] << 0) | (tc[tcq_v[qp0]] << 8)) | ++ ((hbs & 0x20) == 0 ? 0 : (tc[tcq_u[qp1]] << 16) | (tc[tcq_v[qp1]] << 24)), ++ (pcmfa & 3) | ((pcmfa >> 14) & 0xc)); ++ } ++ } ++ ++ // H main ++ if ((hbs = (hbs_get32(s, cb_x, bh_r, y) & 0x22222222U)) != 0) ++ { ++ unsigned int x; ++ unsigned int pcmfa = pcm4(s, cb_x, y - 1); // Might like to mask out far right writes but probably not worth it ++ ++ for (x = cb_x; hbs != 0; x += 16, hbs >>= 8, pcmfa >>= 2) ++ { ++ if ((hbs & 0xff) != 0 && (~pcmfa & 0x30003) != 0) ++ { ++ const int qp0 = (qta[x >> log2_min_cb_size] + qtb[x >> log2_min_cb_size] + 1) >> 1; ++ const int qp1 = (qta[(x + 8) >> log2_min_cb_size] + qtb[(x + 8) >> log2_min_cb_size] + 1) >> 1; ++ const uint8_t * const tc = tctable + 2 + dbp->tc_offset; ++ ++ s->hevcdsp.hevc_h_loop_filter_uv(av_rpi_sand_frame_pos_c(s->frame, x >> 1, y >> 1), ++ frame_stride1(s->frame, 1), ++ ((hbs & 2) == 0 ? 0 : (tc[tcq_u[qp0]] << 0) | (tc[tcq_v[qp0]] << 8)) | ++ ((hbs & 0x20) == 0 ? 0 : (tc[tcq_u[qp1]] << 16) | (tc[tcq_v[qp1]] << 24)), ++ (pcmfa & 3) | ((pcmfa >> 14) & 0xc)); ++ } ++ } ++ } ++ } ++ } ++ } ++} ++ ++static inline unsigned int off_boundary(const unsigned int x, const unsigned int log2_n) ++{ ++ return x & ~(~0U << log2_n); ++} ++ ++static inline void hbs_set(const HEVCRpiContext * const s, const unsigned int x, const unsigned int y, const uint32_t mask, uint32_t bsf) ++{ ++ av_assert2((y & 7) == 0); ++ ++ // This doesn't have the same simultainious update issues that bsf_stash ++ // does (other threads will have a different y) so we can do it the easy way ++ if ((bsf &= mask) != 0) ++ *bs_ptr32(s->bs_horizontal, s->bs_stride2, x, y) |= bsf << ((x >> 1) & 31); ++} ++ ++ ++static void vbs_set(const HEVCRpiContext * const s, const unsigned int x, const unsigned int y, const uint32_t mask, uint32_t bsf) ++{ ++ // We arrange this in a slightly odd fashion but it lines up with ++ // how we are going to use it in the actual deblock code & it is easier ++ // to do the contortions here than there ++ // ++ // Arrange (LE) {x0y0, x0y4, x8y0, x8,y4}, {x16y0, x16y4, x24y0, x24y4},... ++ ++ av_assert2((x & 7) == 0); ++ ++ if ((bsf &= mask) != 0) ++ { ++ uint8_t *p = bs_ptr8(s->bs_vertical, s->bs_stride2, x, y); ++ const unsigned int sh = ((x & 8) | (y & 4)) >> 1; ++ ++ if (mask <= 0xf) ++ { ++ *p |= (bsf << sh); ++ } ++ else ++ { ++ do { ++ *p |= (bsf & 0xf) << sh; ++ p += HEVC_RPI_BS_STRIDE1_BYTES; ++ } while ((bsf >>= 4) != 0); ++ } ++ } ++} ++ ++static inline uint32_t bsf_mv(const HEVCRpiContext * const s, ++ const unsigned int rep, const unsigned int dup, ++ const unsigned int mvf_stride0, ++ const unsigned int mvf_stride1, ++ const RefPicList * const rpl_p, const RefPicList * const rpl_q, ++ const HEVCRpiMvField * const mvf_p, const HEVCRpiMvField * const mvf_q) ++{ ++ return s->hevcdsp.hevc_deblocking_boundary_strengths(rep, dup, ++ mvf_p, mvf_q, ++ rpl_p[0].list, rpl_p[1].list, rpl_q[0].list, rpl_q[1].list, ++ sizeof(HEVCRpiMvField) * mvf_stride0, sizeof(HEVCRpiMvField) * mvf_stride1); ++} ++ ++ ++void ff_hevc_rpi_deblocking_boundary_strengths(const HEVCRpiContext * const s, ++ const HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int log2_trafo_size, ++ const int is_coded_block) ++{ ++ const HEVCRpiMvField * const mvf_curr = mvf_stash_ptr(s, lc, x0, y0); ++ const unsigned int log2_min_pu_size = LOG2_MIN_PU_SIZE; ++ const RefPicList * const rpl = s->refPicList; ++ // Rep count for bsf_mv when running with min_pu chuncks ++ const unsigned int log2_rep_min_pu = log2_trafo_size <= log2_min_pu_size ? 0 : log2_trafo_size - log2_min_pu_size; ++ const unsigned int boundary_flags = s->sh.no_dblk_boundary_flags & lc->boundary_flags; ++ const unsigned int trafo_size = (1U << log2_trafo_size); ++ const uint32_t bsf_mask = log2_trafo_size > 5 ? ~0U : (1U << (trafo_size >> 1)) - 1; ++ const uint32_t bsf_cbf = (bsf_mask & 0x55555555); ++ ++ // Do we cover a pred split line? ++ const int has_x_split = x0 < lc->cu.x_split && x0 + trafo_size > lc->cu.x_split; ++ const int has_y_split = y0 < lc->cu.y_split && y0 + trafo_size > lc->cu.y_split; ++ ++ uint32_t bsf_h; ++ uint32_t bsf_v; ++ ++#ifdef DISABLE_STRENGTHS ++ return; ++#endif ++ ++ // We are always on a size boundary ++ av_assert2((x0 & (trafo_size - 1)) == 0); ++ av_assert2((y0 & (trafo_size - 1)) == 0); ++ // log2_trafo_size not really a transform size; we can have to deal ++ // with size 2^6 blocks ++ av_assert2(log2_trafo_size >= 2 && log2_trafo_size <= 6); ++ ++ // Retrieve and update coded (b0), intra (b1) bs flags ++ // ++ // Store on min width (rather than uint32_t) to avoid possible issues ++ // with another thread on another core running wpp using the same ++ // memory (min CTB = 16 pels = 4 bsf els = 8 bits) ++ // ++ // In bsf BS=2 is represented by 3 as it is much easier to test & set ++ // and the actual deblock code tests for 0 and b1 set/not-set so 2 and ++ // 3 will work the same ++ { ++ // Given where we are called from is_cbf_luma & is_intra will be constant over the block ++ const uint32_t bsf0 = (lc->cu.pred_mode == MODE_INTRA) ? bsf_mask : is_coded_block ? bsf_cbf : 0; ++ uint8_t *const p = s->bsf_stash_up + (x0 >> 4); ++ uint8_t *const q = s->bsf_stash_left + (y0 >> 4); ++ ++ switch (log2_trafo_size) ++ { ++ case 2: ++ case 3: ++ { ++ const unsigned int sh_h = (x0 >> 1) & 7; ++ const unsigned int sh_v = (y0 >> 1) & 7; ++ bsf_h = *p; ++ bsf_v = *q; ++ *p = (bsf_h & ~(bsf_mask << sh_h)) | (bsf0 << sh_h); ++ *q = (bsf_v & ~(bsf_mask << sh_v)) | (bsf0 << sh_v); ++ bsf_h >>= sh_h; ++ bsf_v >>= sh_v; ++ break; ++ } ++ case 4: ++ bsf_h = *p; ++ bsf_v = *q; ++ *p = bsf0; ++ *q = bsf0; ++ break; ++ case 5: ++ bsf_h = *(uint16_t *)p; ++ bsf_v = *(uint16_t *)q; ++ *(uint16_t *)p = bsf0; ++ *(uint16_t *)q = bsf0; ++ break; ++ case 6: ++ default: ++ bsf_h = *(uint32_t *)p; ++ bsf_v = *(uint32_t *)q; ++ *(uint32_t *)p = bsf0; ++ *(uint32_t *)q = bsf0; ++ break; ++ } ++ ++ bsf_h |= bsf0; ++ bsf_v |= bsf0; ++ } ++ ++ // Do Horizontal ++ if ((y0 & 7) == 0) ++ { ++ // Boundary upper ++ if (y0 != 0 && ++ (off_boundary(y0, s->ps.sps->log2_ctb_size) || ++ (boundary_flags & (BOUNDARY_UPPER_SLICE | BOUNDARY_UPPER_TILE)) == 0)) ++ { ++ // Look at MVs (BS=1) if we don't already has a full set of bs bits ++ if ((~bsf_h & bsf_cbf) != 0 && (y0 == lc->cu.y || y0 == lc->cu.y_split)) ++ { ++ // If we aren't on the top boundary we must be in the middle ++ // and in that case we know where mvf can change ++ const unsigned int log2_rep = (y0 == lc->cu.y) ? log2_rep_min_pu : has_x_split ? 1 : 0; ++ const RefPicList *const rpl_top = !off_boundary(y0, s->ps.sps->log2_ctb_size) ? ++ s->rpl_up[x0 >> s->ps.sps->log2_ctb_size] : ++ rpl; ++ ++ bsf_h |= bsf_mv(s, 1 << log2_rep, trafo_size >> (2 + log2_rep), ++ trafo_size >> (log2_min_pu_size + log2_rep), ++ trafo_size >> (log2_min_pu_size + log2_rep), ++ rpl, rpl_top, ++ mvf_curr, mvf_ptr(s, lc, x0, y0, x0, y0 - 1)); ++ } ++ ++ // Finally put the results into bs ++ hbs_set(s, x0, y0, bsf_mask, bsf_h); ++ } ++ ++ // Max of 1 pu internal split - ignore if not on 8pel boundary ++ if (has_y_split && !off_boundary(lc->cu.y_split, 3)) ++ { ++ const HEVCRpiMvField * const mvf = mvf_stash_ptr(s, lc, x0, lc->cu.y_split); ++ // If we have the x split as well then it must be in the middle ++ const unsigned int log2_rep = has_x_split ? 1 : 0; ++ ++ hbs_set(s, x0, lc->cu.y_split, bsf_mask, ++ bsf_mv(s, 1 << log2_rep, trafo_size >> (2 + log2_rep), ++ trafo_size >> (log2_min_pu_size + log2_rep), ++ trafo_size >> (log2_min_pu_size + log2_rep), ++ rpl, rpl, ++ mvf, mvf - MVF_STASH_WIDTH_PU)); ++ } ++ } ++ ++ // And again for vertical - same logic as horizontal just in the other direction ++ if ((x0 & 7) == 0) ++ { ++ // Boundary left ++ if (x0 != 0 && ++ (off_boundary(x0, s->ps.sps->log2_ctb_size) || ++ (boundary_flags & (BOUNDARY_LEFT_SLICE | BOUNDARY_LEFT_TILE)) == 0)) ++ { ++ if ((~bsf_v & bsf_cbf) != 0 && (x0 == lc->cu.x || x0 == lc->cu.x_split)) ++ { ++ const unsigned int log2_rep = (x0 == lc->cu.x) ? log2_rep_min_pu : has_y_split ? 1 : 0; ++ const RefPicList *const rpl_left = !off_boundary(x0, s->ps.sps->log2_ctb_size) ? ++ s->rpl_left[y0 >> s->ps.sps->log2_ctb_size] : ++ rpl; ++ ++ bsf_v |= bsf_mv(s, 1 << log2_rep, trafo_size >> (2 + log2_rep), ++ (MVF_STASH_WIDTH_PU << log2_trafo_size) >> (log2_min_pu_size + log2_rep), ++ (mvf_left_stride(s, x0, x0 - 1) << log2_trafo_size) >> (log2_min_pu_size + log2_rep), ++ rpl, rpl_left, ++ mvf_curr, mvf_ptr(s, lc, x0, y0, x0 - 1, y0)); ++ } ++ ++ vbs_set(s, x0, y0, bsf_mask, bsf_v); ++ } ++ ++ if (has_x_split && !off_boundary(lc->cu.x_split, 3)) ++ { ++ const HEVCRpiMvField *const mvf = mvf_stash_ptr(s, lc, lc->cu.x_split, y0); ++ const unsigned int log2_rep = has_y_split ? 1 : 0; ++ ++ vbs_set(s, lc->cu.x_split, y0, bsf_mask, ++ bsf_mv(s, 1 << log2_rep, trafo_size >> (2 + log2_rep), ++ (MVF_STASH_WIDTH_PU << log2_trafo_size) >> (log2_min_pu_size + log2_rep), ++ (MVF_STASH_WIDTH_PU << log2_trafo_size) >> (log2_min_pu_size + log2_rep), ++ rpl, rpl, ++ mvf, mvf - 1)); ++ } ++ } ++} ++ ++#undef LUMA ++#undef CB ++#undef CR ++ ++static inline unsigned int ussub(const unsigned int a, const unsigned int b) ++{ ++ return a < b ? 0 : a - b; ++} ++ ++static inline int cache_boundry(const AVFrame * const frame, const unsigned int x) ++{ ++ return ((x >> av_rpi_sand_frame_xshl(frame)) & ~63) == 0; ++} ++ ++int ff_hevc_rpi_hls_filter_blk(const HEVCRpiContext * const s, const RpiBlk bounds, const int eot) ++{ ++ const int ctb_size = (1 << s->ps.sps->log2_ctb_size); ++ int x, y; ++ ++ const unsigned int br = bounds.x + bounds.w; ++ const unsigned int bb = bounds.y + bounds.h; ++ ++ const int x_end = (br >= s->ps.sps->width); ++ const int y_end = (bb >= s->ps.sps->height); ++ ++ // Deblock may not touch the edges of the bound as they are still needed ++ // for Intra pred ++ // ++ // Deblock is disabled with a per-slice flag ++ // Given that bounds may cover multiple slices & we dblock outside bounds ++ // anyway we can't avoid deblock using that flag - about the only thing we ++ // could do is have a "no deblock seen yet" flag but it doesn't really ++ // seem worth the effort ++ ++ deblock_y_blk(s, bounds, x_end, y_end); ++ deblock_uv_blk(s, bounds, x_end, y_end); ++ ++ // SAO needs ++ // (a) CTB alignment ++ // (b) Valid pixels all the way around the CTB in particular it needs the DR pixel ++ { ++ const unsigned int xo = bounds.x - ((bounds.x - 16) & ~(ctb_size - 1)); ++ const unsigned int yo = bounds.y - ((bounds.y - 16) & ~(ctb_size - 1)); ++ const unsigned int yt = ussub(bounds.y, yo); ++ const unsigned int yb = y_end ? bb : ussub(bb, yo); ++ const unsigned int xl = ussub(bounds.x, xo); ++ const unsigned int xr = x_end ? br : ussub(br, xo); ++ ++ if (s->ps.sps->sao_enabled) ++ { ++ for (y = yt; y < yb; y += ctb_size) { ++ for (x = xl; x < xr; x += ctb_size) { ++ sao_filter_CTB(s, x, y); ++ } ++ } ++ } ++ ++ // Cache invalidate ++ y = 0; ++ if (xr != 0 && yb != 0) ++ { ++ const unsigned int llen = ++ (av_rpi_sand_frame_stride1(s->frame) >> av_rpi_sand_frame_xshl(s->frame)); ++ const unsigned int mask = ~(llen - 1); ++ const unsigned int il = (xl == 0) ? 0 : (xl - 1) & mask; ++ const unsigned int ir = x_end || !cache_boundry(s->frame, br) ? br : (xr - 1) & mask; ++ const unsigned int it = ussub(yt, 1); ++ const unsigned int ib = y_end ? bb : yb - 1; ++ ++ if (il < ir) { ++ rpi_cache_buf_t cbuf; ++ rpi_cache_flush_env_t * const rfe = rpi_cache_flush_init(&cbuf); ++ rpi_cache_flush_add_frame_block(rfe, s->frame, RPI_CACHE_FLUSH_MODE_WB_INVALIDATE, ++ il, it, ir - il, ib - it, ++ ctx_vshift(s, 1), 1, 1); ++ ++ // If we have to commit the right hand tile boundry due to ++ // cache boundry considerations then at EoTile we must commit ++ // that boundry to bottom of tile (bounds) ++ if (ib != bb && ir == br && eot) { ++ rpi_cache_flush_add_frame_block(rfe, s->frame, RPI_CACHE_FLUSH_MODE_WB_INVALIDATE, ++ br - 1, ib, 1, bb - ib, ++ ctx_vshift(s, 1), 1, 1); ++ } ++ ++ rpi_cache_flush_finish(rfe); ++ ++ if (x_end) ++ y = y_end ? INT_MAX : ib; ++ ++// printf("Flush: %4d,%4d -> %4d,%4d: signal: %d\n", il, it, ir, ib, y - 1); ++ } ++ } ++ } ++ ++ return y; ++} ++ +--- /dev/null ++++ b/libavcodec/rpi_hevc_mv.h +@@ -0,0 +1,71 @@ ++#ifndef AVCODEC_RPI_HEVC_MV_H ++#define AVCODEC_RPI_HEVC_MV_H ++ ++#include "config.h" ++ ++typedef int32_t MvXY; ++ ++typedef struct HEVCRpiMvField { ++ MvXY xy[2]; ++ int8_t ref_idx[2]; ++ int8_t pred_flag; ++ int8_t dummy; // To 12 bytes ++} HEVCRpiMvField; ++ ++ ++#define MV_X(xy) (((xy) << 16) >> 16) ++#define MV_Y(xy) ((xy) >> 16) ++#define MV_XY(x, y) ((x & 0xffff) | ((y) << 16)) ++ ++#if ARCH_ARM ++#include "arm/rpi_hevc_mv_arm.h" ++#endif ++ ++#ifndef mvxy_add ++static inline MvXY mvxy_add(const MvXY a, const MvXY b) ++{ ++ return MV_XY(MV_X(a) + MV_X(b), MV_Y(a) + MV_Y(b)); ++} ++#endif ++ ++ ++#ifndef mv_scale_xy ++static inline MvXY mv_scale_xy(const MvXY const src, int td, int tb) ++{ ++ int tx, scale_factor; ++ ++ td = td == 0 ? 1 : av_clip_int8(td); ++ tb = av_clip_int8(tb); ++ tx = (0x4000 + (abs(td) >> 1)) / td; ++ scale_factor = av_clip_intp2((tb * tx + 32) >> 6, 12); ++ return MV_XY( ++ av_clip_int16((scale_factor * MV_X(src) + 127 + ++ (scale_factor * MV_X(src) < 0)) >> 8), ++ av_clip_int16((scale_factor * MV_Y(src) + 127 + ++ (scale_factor * MV_Y(src) < 0)) >> 8)); ++} ++#endif ++ ++// 8.3.1 states that the bitstream may not contain poc diffs that do not ++// fit in 16 bits, so given that we don't care about the high bits we only ++// store the low 16 + LT & Inter flags ++ ++#define COL_POC_INTRA 0 ++#define COL_POC_INTER (1 << 16) ++#define COL_POC_LT (1 << 17) ++#define COL_POC_DIFF(x,y) ((int16_t)((x) - (y))) ++#define COL_POC_MAKE_INTER(lt,poc) (COL_POC_INTER | ((lt) ? COL_POC_LT : 0) | ((poc) & 0xffff)) ++#define COL_POC_IS_LT(x) (((x) & COL_POC_LT) != 0) ++ ++typedef struct ColMv_s { ++ int32_t poc; ++ int32_t xy; ++} ColMv; ++ ++typedef struct ColMvField_s { ++ ColMv L[2]; ++} ColMvField; ++ ++ ++ ++#endif // AVCODEC_RPI_HEVC_MV_H +--- /dev/null ++++ b/libavcodec/rpi_hevc_mvs.c +@@ -0,0 +1,487 @@ ++/* ++ * HEVC video decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2013 Anand Meher Kotra ++ * Copyright (C) 2018 John Cox for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "hevc.h" ++#include "rpi_hevcdec.h" ++ ++static av_always_inline int ++is_eq_mer(const unsigned int plevel, ++ const unsigned int xN, const unsigned int yN, ++ const unsigned int xP, const unsigned int yP) ++{ ++ return (((xN ^ xP) | (yN ^ yP)) >> plevel) == 0; ++} ++ ++// check if the mv's and refidx are the same between A and B ++static av_always_inline int compare_mv_ref_idx(const HEVCRpiMvField * const a, const HEVCRpiMvField * const b) ++{ ++ return a->pred_flag == b->pred_flag && ++ ((a->pred_flag & PF_L0) == 0 || (a->ref_idx[0] == b->ref_idx[0] && a->xy[0] == b->xy[0])) && ++ ((a->pred_flag & PF_L1) == 0 || (a->ref_idx[1] == b->ref_idx[1] && a->xy[1] == b->xy[1])); ++ return 0; ++} ++ ++/* ++ * 8.5.3.1.7 temporal luma motion vector prediction ++ */ ++static int temporal_luma_motion_vector(const HEVCRpiContext * const s, ++ const HEVCRpiLocalContext * const lc, const int x0, const int y0, ++ const int nPbW, const int nPbH, const int refIdxLx, ++ MvXY * const mvLXCol, const int X) ++{ ++ int x, y; ++ const ColMv * cmv = NULL; ++ ++ HEVCRpiFrame * const col_ref = s->ref->collocated_ref; ++ const RefPicList * const refPicList = s->refPicList + X; ++ const int cur_lt = refPicList->isLongTerm[refIdxLx]; ++ ++ *mvLXCol = 0; ++ // Unlikely but we might have a col_ref IDR frame! ++ if (col_ref->col_mvf == NULL) ++ return 0; ++ ++ ff_hevc_rpi_progress_wait_mv(s, lc->jb0, col_ref, y0 + nPbH); ++ ++ //bottom right collocated motion vector ++ x = x0 + nPbW; ++ y = y0 + nPbH; ++ ++ if ((y0 >> s->ps.sps->log2_ctb_size) == (y >> s->ps.sps->log2_ctb_size) && ++ y < s->ps.sps->height && ++ x < s->ps.sps->width) ++ { ++ const ColMvField * const col = col_ref->col_mvf + (x >> 4) + ++ (y >> 4) * s->col_mvf_stride; ++ ++ if (col->L[0].poc != COL_POC_INTRA && ++ (col->L[1].poc == COL_POC_INTRA || ++ (s->no_backward_pred_flag ? s->sh.collocated_list == L1 : X == 0))) ++ { ++ cmv = col->L + 0; ++ } ++ else if (col->L[1].poc != COL_POC_INTRA) ++ { ++ cmv = col->L + 1; ++ } ++ } ++ ++ // derive center collocated motion vector ++ if (cmv == NULL || COL_POC_IS_LT(cmv->poc) != cur_lt) ++ { ++ cmv = NULL; ++ x = x0 + (nPbW >> 1); ++ y = y0 + (nPbH >> 1); ++ ++ { ++ const ColMvField * const col = col_ref->col_mvf + (x >> 4) + ++ (y >> 4) * s->col_mvf_stride; ++ ++ if (col->L[0].poc != COL_POC_INTRA && ++ (col->L[1].poc == COL_POC_INTRA || ++ (s->no_backward_pred_flag ? s->sh.collocated_list == L1 : X == 0))) ++ { ++ cmv = col->L + 0; ++ } ++ else if (col->L[1].poc != COL_POC_INTRA) ++ { ++ cmv = col->L + 1; ++ } ++ } ++ } ++ ++ if (cmv == NULL || cur_lt != COL_POC_IS_LT(cmv->poc)) ++ return 0; ++ ++ { ++ const int col_poc = col_ref->poc; ++ const int ref_poc = refPicList->list[refIdxLx]; ++ ++ *mvLXCol = (cur_lt || ++ cmv->poc == col_poc || ++ COL_POC_DIFF(col_poc, cmv->poc) == s->poc - ref_poc) ? ++ cmv->xy : ++ mv_scale_xy(cmv->xy, COL_POC_DIFF(col_poc, cmv->poc), s->poc - ref_poc); ++ } ++ ++ return cmv != NULL; ++} ++ ++static inline int mvf_eq(const HEVCRpiMvField * const a, const HEVCRpiMvField * const b) ++{ ++ return b != NULL && compare_mv_ref_idx(a, b); ++} ++ ++ ++ ++/* ++ * 8.5.3.1.2 Derivation process for spatial merging candidates ++ */ ++static inline const HEVCRpiMvField * ++derive_spatial_merge_candidates( ++ const HEVCRpiContext * const s, ++ const HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int nPbW, const unsigned int nPbH, ++ const unsigned int avail, ++ const unsigned int part_idx, ++ const unsigned int merge_idx, ++ HEVCRpiMvField * const mvf_t) ++{ ++ const unsigned int parts_a1 = (1 << PART_Nx2N) | (1 << PART_nLx2N) | (1 << PART_nRx2N); ++ const unsigned int parts_b1 = (1 << PART_2NxN) | (1<< PART_2NxnU) | (1 << PART_2NxnD); ++ ++ const HEVCRpiMvField * mvf_a1 = mvf_ptr(s, lc, x0, y0, x0 - 1, y0 + nPbH - 1); ++ const HEVCRpiMvField * mvf_a0 = mvf_a1 + mvf_left_stride(s, x0, x0 - 1); ++ const HEVCRpiMvField * mvf_b1 = mvf_ptr(s, lc, x0, y0, x0 + nPbW - 1, y0 - 1); ++ const HEVCRpiMvField * mvf_b0 = mvf_b1 + 1; ++ const unsigned int plevel = s->ps.pps->log2_parallel_merge_level; ++ const unsigned int part_mode = lc->cu.part_mode; ++ ++ const HEVCRpiMvField * perm[4]; ++ unsigned int nb_merge_cand = 0; ++ ++ // singleMCLFlag => part_idx == 0 so no need to test for it ++ if ((avail & AVAIL_L) == 0 || ++ (part_idx == 1 && ++ ((parts_a1 >> part_mode) & 1) != 0 || ++ is_eq_mer(plevel, x0 - 1, y0 + nPbH - 1, x0, y0)) || ++ mvf_a1->pred_flag == PF_INTRA) ++ { ++ mvf_a1 = NULL; ++ } ++ else ++ { ++ if (merge_idx == nb_merge_cand) ++ return mvf_a1; ++ perm[nb_merge_cand++] = mvf_a1; ++ } ++ ++ if ((avail & AVAIL_U) == 0 || ++ (part_idx == 1 && ++ ((parts_b1 >> part_mode) & 1) != 0 || ++ is_eq_mer(plevel, x0 + nPbW - 1, y0 - 1, x0, y0)) || ++ mvf_b1->pred_flag == PF_INTRA) ++ { ++ mvf_b1 = NULL; ++ } ++ else if (!mvf_eq(mvf_b1, mvf_a1)) ++ { ++ if (merge_idx == nb_merge_cand) ++ return mvf_b1; ++ perm[nb_merge_cand++] = mvf_b1; ++ } ++ ++ // above right spatial merge candidate ++ // Never need mvf_b0 again so don't bother zeroing if navail ++ if ((avail & AVAIL_UR) != 0 && ++ !is_eq_mer(plevel, x0 + nPbW, y0 - 1, x0, y0) && ++ mvf_b0->pred_flag != PF_INTRA && ++ !mvf_eq(mvf_b0, mvf_b1)) ++ { ++ if (merge_idx == nb_merge_cand) ++ return mvf_b0; ++ perm[nb_merge_cand++] = mvf_b0; ++ } ++ ++ // left bottom spatial merge candidate ++ // Never need mvf_a0 again so don't bother zeroing if navail ++ if ((avail & AVAIL_DL) != 0 && ++ !is_eq_mer(plevel, x0 - 1, y0 + nPbH, x0, y0) && ++ mvf_a0->pred_flag != PF_INTRA && ++ !mvf_eq(mvf_a0, mvf_a1)) ++ { ++ if (merge_idx == nb_merge_cand) ++ return mvf_a0; ++ perm[nb_merge_cand++] = mvf_a0; ++ } ++ ++ // above left spatial merge candidate ++ if (nb_merge_cand != 4 && ++ (avail & AVAIL_UL) != 0 && ++ !is_eq_mer(plevel, x0 - 1, y0 - 1, x0, y0)) ++ { ++ const HEVCRpiMvField * mvf_b2 = mvf_ptr(s, lc, x0, y0, x0 - 1, y0 - 1); // UL ++ ++ if (mvf_b2->pred_flag != PF_INTRA && ++ !mvf_eq(mvf_b2, mvf_a1) && ++ !mvf_eq(mvf_b2, mvf_b1)) ++ { ++ if (merge_idx == nb_merge_cand) ++ return mvf_b2; ++ perm[nb_merge_cand++] = mvf_b2; ++ } ++ } ++ ++ // temporal motion vector candidate ++ if (s->sh.slice_temporal_mvp_enabled_flag) ++ { ++ static const HEVCRpiMvField mvf_z = {{0}}; ++ ++ *mvf_t = mvf_z; ++ ++ if (temporal_luma_motion_vector(s, lc, x0, y0, nPbW, nPbH, ++ 0, mvf_t->xy + 0, 0)) ++ mvf_t->pred_flag = PF_L0; ++ ++ if (s->sh.slice_type == HEVC_SLICE_B && ++ temporal_luma_motion_vector(s, lc, x0, y0, nPbW, nPbH, ++ 0, mvf_t->xy + 1, 1)) ++ mvf_t->pred_flag |= PF_L1; ++ ++ if (mvf_t->pred_flag != 0) ++ { ++ if (merge_idx == nb_merge_cand) ++ return mvf_t; ++ perm[nb_merge_cand++] = mvf_t; ++ } ++ } ++ ++ // combined bi-predictive merge candidates (applies for B slices) ++ if (s->sh.slice_type == HEVC_SLICE_B && nb_merge_cand > 1) ++ { ++ unsigned int comb_idx = 0; ++ const unsigned int cand_count = nb_merge_cand * (nb_merge_cand - 1); ++ const RefPicList * const refPicList = s->refPicList; ++ ++ for (comb_idx = 0; comb_idx < cand_count; comb_idx++) ++ { ++ static const uint8_t l0_l1_cand_idx[12][2] = { ++ { 0, 1, }, ++ { 1, 0, }, ++ { 0, 2, }, ++ { 2, 0, }, ++ { 1, 2, }, ++ { 2, 1, }, ++ { 0, 3, }, ++ { 3, 0, }, ++ { 1, 3, }, ++ { 3, 1, }, ++ { 2, 3, }, ++ { 3, 2, }, ++ }; ++ ++ const unsigned int l0_cand_idx = l0_l1_cand_idx[comb_idx][0]; ++ const unsigned int l1_cand_idx = l0_l1_cand_idx[comb_idx][1]; ++ const HEVCRpiMvField * const mvf_c0 = perm[l0_cand_idx]; ++ const HEVCRpiMvField * const mvf_c1 = perm[l1_cand_idx]; ++ ++ if ((mvf_c0->pred_flag & PF_L0) != 0 && ++ (mvf_c1->pred_flag & PF_L1) != 0 && ++ (refPicList[0].list[mvf_c0->ref_idx[0]] != refPicList[1].list[mvf_c1->ref_idx[1]] || ++ mvf_c0->xy[0] != mvf_c1->xy[1])) ++ { ++ if (merge_idx == nb_merge_cand++) ++ { ++ // Need to be a bit careful as we will construct mvf_t and we ++ // may already be using that as one of our condidates ++ // so build & copy rather than build in place ++ const HEVCRpiMvField mvf_m = { ++ .xy = { ++ mvf_c0->xy[0], ++ mvf_c1->xy[1]}, ++ .ref_idx = { ++ mvf_c0->ref_idx[0], ++ mvf_c1->ref_idx[1]}, ++ .pred_flag = PF_BI ++ }; ++ *mvf_t = mvf_m; ++ return mvf_t; ++ } ++ } ++ } ++ } ++ ++ // "append" Zero motion vector candidates ++ { ++ const unsigned int nb_refs = (s->sh.slice_type == HEVC_SLICE_B) ? ++ FFMIN(s->sh.nb_refs[0], s->sh.nb_refs[1]) : s->sh.nb_refs[0]; ++ const unsigned int zero_idx = merge_idx - nb_merge_cand; ++ ++ const HEVCRpiMvField mvf_m = { ++ .xy = {0, 0}, ++ .ref_idx = { ++ zero_idx < nb_refs ? zero_idx : 0, ++ (s->sh.slice_type == HEVC_SLICE_B && zero_idx < nb_refs) ? zero_idx : 0}, ++ .pred_flag = (s->sh.slice_type == HEVC_SLICE_B) ? PF_BI : PF_L0 ++ }; ++ ++ *mvf_t = mvf_m; ++ return mvf_t; ++ } ++} ++ ++ ++// 8.5.3.1.1 Derivation process of luma Mvs for merge mode ++void ff_hevc_rpi_luma_mv_merge_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, int x0, int y0, int nPbW, ++ int nPbH, int log2_cb_size, int part_idx, ++ int merge_idx, HEVCRpiMvField * const mv) ++{ ++ const HEVCRpiMvField * mvf_m = (s->ps.pps->log2_parallel_merge_level > 2 && log2_cb_size == 3) ? ++ derive_spatial_merge_candidates(s, lc, lc->cu.x, lc->cu.y, 8, 8, ++ ff_hevc_rpi_tb_avail_flags(s, lc, lc->cu.x, lc->cu.y, 8, 8), ++ 0, merge_idx, mv) : ++ derive_spatial_merge_candidates(s, lc, x0, y0, nPbW, nPbH, ++ ff_hevc_rpi_tb_avail_flags(s, lc, x0, y0, nPbW, nPbH), ++ part_idx, merge_idx, mv); ++ ++ if (mvf_m != mv) ++ *mv = *mvf_m; ++ ++ if (mv->pred_flag == PF_BI && (nPbW + nPbH) == 12) ++ mv->pred_flag = PF_L0; ++} ++ ++ ++static av_always_inline const MvXY * ++mvf_same_poc(const RefPicList * const rpl, const unsigned int pfi0, const unsigned int pfi1, const int poc0, const HEVCRpiMvField * const mvf) ++{ ++ if (mvf != NULL) ++ { ++ if (((mvf->pred_flag >> pfi0) & 1) != 0 && rpl[pfi0].list[mvf->ref_idx[pfi0]] == poc0) ++ return mvf->xy + pfi0; ++ if (((mvf->pred_flag >> pfi1) & 1) != 0 && rpl[pfi1].list[mvf->ref_idx[pfi1]] == poc0) ++ return mvf->xy + pfi1; ++ } ++ return NULL; ++} ++ ++static av_always_inline const MvXY * ++mvf_other_poc(const RefPicList * const rpl, const unsigned int pfi0, const unsigned int pfi1, ++ const int islt0, const int poc0, const int poc_cur, ++ MvXY * const mv_t, const HEVCRpiMvField * const mvf) ++{ ++ if (mvf != NULL) ++ { ++ if (((mvf->pred_flag >> pfi0) & 1) != 0 && rpl[pfi0].isLongTerm[mvf->ref_idx[pfi0]] == islt0) ++ { ++ const int poc1 = rpl[pfi0].list[mvf->ref_idx[pfi0]]; ++ if (islt0 || poc1 == poc0) { ++ return mvf->xy + pfi0; ++ } ++ *mv_t = mv_scale_xy(mvf->xy[pfi0], poc_cur - poc1, poc_cur - poc0); ++ return mv_t; ++ } ++ if (((mvf->pred_flag >> pfi1) & 1) != 0 && rpl[pfi1].isLongTerm[mvf->ref_idx[pfi1]] == islt0) ++ { ++ const int poc1 = rpl[pfi1].list[mvf->ref_idx[pfi1]]; ++ if (islt0 || poc1 == poc0) { ++ return mvf->xy + pfi1; ++ } ++ *mv_t = mv_scale_xy(mvf->xy[pfi1], poc_cur - poc1, poc_cur - poc0); ++ return mv_t; ++ } ++ } ++ return NULL; ++} ++ ++void ff_hevc_rpi_luma_mv_mvp_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int nPbW, const unsigned int nPbH, ++ const unsigned int avail, ++ HEVCRpiMvField * const mv, ++ const unsigned int mvp_lx_flag, const unsigned int LX) ++{ ++ const unsigned int pfi0 = LX; ++ const unsigned int pfi1 = LX == 0 ? 1 : 0; ++ const RefPicList * const rpl = s->refPicList; ++ const int poc0 = rpl[LX].list[mv->ref_idx[LX]]; ++ const int poc_cur = s->poc; ++ const int islt0 = rpl[LX].isLongTerm[mv->ref_idx[LX]]; ++ ++ const HEVCRpiMvField * mvf_a1 = mvf_ptr(s, lc, x0, y0, x0 - 1, y0 + nPbH - 1); ++ const HEVCRpiMvField * mvf_a0 = mvf_a1 + mvf_left_stride(s, x0, x0 - 1); ++ const HEVCRpiMvField * mvf_b2 = mvf_ptr(s, lc, x0, y0, x0 - 1, y0 - 1); // UL ++ const HEVCRpiMvField * mvf_b1 = mvf_ptr(s, lc, x0, y0, x0 + nPbW - 1, y0 - 1); ++ const HEVCRpiMvField * mvf_b0 = mvf_b1 + 1; ++ const MvXY * mva = NULL; ++ const MvXY * mvb; ++ MvXY * const mv_rv = mv->xy + LX; ++ MvXY mvt_a, mvt_b; ++ ++ *mv_rv = 0; ++ ++ if ((avail & AVAIL_DL) == 0 || mvf_a0->pred_flag == PF_INTRA) ++ mvf_a0 = NULL; ++ else if ((mva = mvf_same_poc(rpl, pfi0, pfi1, poc0, mvf_a0)) != NULL && mvp_lx_flag == 0) ++ goto use_mva; ++ ++ if ((avail & AVAIL_L) == 0 || mvf_a1->pred_flag == PF_INTRA) ++ mvf_a1 = NULL; ++ ++ if (mva == NULL && ++ (mva = mvf_same_poc(rpl, pfi0, pfi1, poc0, mvf_a1)) == NULL && ++ (mva = mvf_other_poc(rpl, pfi0, pfi1, islt0, poc0, poc_cur, &mvt_a, mvf_a0)) == NULL) ++ mva = mvf_other_poc(rpl, pfi0, pfi1, islt0, poc0, poc_cur, &mvt_a, mvf_a1); ++ ++ if (mvp_lx_flag == 0 && mva != NULL) ++ goto use_mva; ++ ++ if ((avail & AVAIL_UR) == 0 || mvf_b0->pred_flag == PF_INTRA) ++ mvf_b0 = NULL; ++ if ((avail & AVAIL_U) == 0 || mvf_b1->pred_flag == PF_INTRA) ++ mvf_b1 = NULL; ++ if ((avail & AVAIL_UL) == 0 || mvf_b2->pred_flag == PF_INTRA) ++ mvf_b2 = NULL; ++ ++ if ((mvb = mvf_same_poc(rpl, pfi0, pfi1, poc0, mvf_b0)) == NULL && ++ (mvb = mvf_same_poc(rpl, pfi0, pfi1, poc0, mvf_b1)) == NULL) ++ mvb = mvf_same_poc(rpl, pfi0, pfi1, poc0, mvf_b2); ++ ++ if (mvf_a0 == NULL && mvf_a1 == NULL) { ++ mva = mvb; ++ if (mvp_lx_flag == 0 && mva != NULL) ++ goto use_mva; ++ ++ if ((mvb = mvf_other_poc(rpl, pfi0, pfi1, islt0, poc0, poc_cur, &mvt_b, mvf_b0)) == NULL && ++ (mvb = mvf_other_poc(rpl, pfi0, pfi1, islt0, poc0, poc_cur, &mvt_b, mvf_b1)) == NULL) ++ mvb = mvf_other_poc(rpl, pfi0, pfi1, islt0, poc0, poc_cur, &mvt_b, mvf_b2); ++ } ++ ++ if (mva == NULL) { ++ mva = mvb; ++ mvb = NULL; ++ } ++ ++ if (mvb != NULL && *mva == *mvb) // If A == B then ignore B ++ mvb = NULL; ++ ++ if (mvp_lx_flag == 0 && mva != NULL) { ++ goto use_mva; ++ } ++ else if (mvp_lx_flag != 0 && mvb != NULL) { ++ *mv_rv = *mvb; ++ } ++ else if (s->sh.slice_temporal_mvp_enabled_flag && ((mvp_lx_flag == 0 && mva == NULL) || (mvp_lx_flag != 0 && mva != NULL))) { ++ temporal_luma_motion_vector(s, lc, x0, y0, nPbW, ++ nPbH, mv->ref_idx[LX], ++ mv_rv, LX); ++ } ++ return; ++ ++use_mva: ++ *mv_rv = *mva; ++ return; ++} ++ +--- /dev/null ++++ b/libavcodec/rpi_hevc_parse.c +@@ -0,0 +1,143 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "bytestream.h" ++#include "h2645_parse.h" ++#include "hevc.h" ++#include "rpi_hevc_parse.h" ++ ++static int hevc_decode_nal_units(const uint8_t *buf, int buf_size, HEVCRpiParamSets *ps, ++ HEVCSEIContext *sei, int is_nalff, int nal_length_size, ++ int err_recognition, int apply_defdispwin, void *logctx) ++{ ++ int i; ++ int ret = 0; ++ H2645Packet pkt = { 0 }; ++ ++ ret = ff_h2645_packet_split(&pkt, buf, buf_size, logctx, is_nalff, ++ nal_length_size, AV_CODEC_ID_HEVC, 1, 0); ++ if (ret < 0) { ++ goto done; ++ } ++ ++ for (i = 0; i < pkt.nb_nals; i++) { ++ H2645NAL *nal = &pkt.nals[i]; ++ ++ /* ignore everything except parameter sets and VCL NALUs */ ++ switch (nal->type) { ++ case HEVC_NAL_VPS: ++ ret = ff_hevc_rpi_decode_nal_vps(&nal->gb, logctx, ps); ++ if (ret < 0) ++ goto done; ++ break; ++ case HEVC_NAL_SPS: ++ ret = ff_hevc_rpi_decode_nal_sps(&nal->gb, logctx, ps, apply_defdispwin); ++ if (ret < 0) ++ goto done; ++ break; ++ case HEVC_NAL_PPS: ++ ret = ff_hevc_rpi_decode_nal_pps(&nal->gb, logctx, ps); ++ if (ret < 0) ++ goto done; ++ break; ++ case HEVC_NAL_SEI_PREFIX: ++ case HEVC_NAL_SEI_SUFFIX: ++ ret = ff_hevc_rpi_decode_nal_sei(&nal->gb, logctx, sei, ps, nal->type); ++ if (ret < 0) ++ goto done; ++ break; ++ default: ++ av_log(logctx, AV_LOG_VERBOSE, "Ignoring NAL type %d in extradata\n", nal->type); ++ break; ++ } ++ } ++ ++done: ++ ff_h2645_packet_uninit(&pkt); ++ if (err_recognition & AV_EF_EXPLODE) ++ return ret; ++ ++ return 0; ++} ++ ++int ff_hevc_rpi_decode_extradata(const uint8_t *data, int size, HEVCRpiParamSets *ps, ++ HEVCSEIContext *sei, int *is_nalff, int *nal_length_size, ++ int err_recognition, int apply_defdispwin, void *logctx) ++{ ++ int ret = 0; ++ GetByteContext gb; ++ ++ bytestream2_init(&gb, data, size); ++ ++ if (size > 3 && (data[0] || data[1] || data[2] > 1)) { ++ /* It seems the extradata is encoded as hvcC format. ++ * Temporarily, we support configurationVersion==0 until 14496-15 3rd ++ * is finalized. When finalized, configurationVersion will be 1 and we ++ * can recognize hvcC by checking if avctx->extradata[0]==1 or not. */ ++ int i, j, num_arrays, nal_len_size; ++ ++ *is_nalff = 1; ++ ++ bytestream2_skip(&gb, 21); ++ nal_len_size = (bytestream2_get_byte(&gb) & 3) + 1; ++ num_arrays = bytestream2_get_byte(&gb); ++ ++ /* nal units in the hvcC always have length coded with 2 bytes, ++ * so put a fake nal_length_size = 2 while parsing them */ ++ *nal_length_size = 2; ++ ++ /* Decode nal units from hvcC. */ ++ for (i = 0; i < num_arrays; i++) { ++ int type = bytestream2_get_byte(&gb) & 0x3f; ++ int cnt = bytestream2_get_be16(&gb); ++ ++ for (j = 0; j < cnt; j++) { ++ // +2 for the nal size field ++ int nalsize = bytestream2_peek_be16(&gb) + 2; ++ if (bytestream2_get_bytes_left(&gb) < nalsize) { ++ av_log(logctx, AV_LOG_ERROR, ++ "Invalid NAL unit size in extradata.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ ret = hevc_decode_nal_units(gb.buffer, nalsize, ps, sei, *is_nalff, ++ *nal_length_size, err_recognition, apply_defdispwin, ++ logctx); ++ if (ret < 0) { ++ av_log(logctx, AV_LOG_ERROR, ++ "Decoding nal unit %d %d from hvcC failed\n", ++ type, i); ++ return ret; ++ } ++ bytestream2_skip(&gb, nalsize); ++ } ++ } ++ ++ /* Now store right nal length size, that will be used to parse ++ * all other nals */ ++ *nal_length_size = nal_len_size; ++ } else { ++ *is_nalff = 0; ++ ret = hevc_decode_nal_units(data, size, ps, sei, *is_nalff, *nal_length_size, ++ err_recognition, apply_defdispwin, logctx); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return ret; ++} +--- /dev/null ++++ b/libavcodec/rpi_hevc_parse.h +@@ -0,0 +1,36 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++/** ++ * @file ++ * H.265 parser code ++ */ ++ ++#ifndef AVCODEC_RPI_HEVC_PARSE_H ++#define AVCODEC_RPI_HEVC_PARSE_H ++ ++#include ++ ++#include "rpi_hevc_ps.h" ++#include "rpi_hevc_sei.h" ++ ++int ff_hevc_rpi_decode_extradata(const uint8_t *data, int size, HEVCRpiParamSets *ps, ++ HEVCSEIContext *sei, int *is_nalff, int *nal_length_size, ++ int err_recognition, int apply_defdispwin, void *logctx); ++ ++#endif /* AVCODEC_RPI_HEVC_PARSE_H */ +--- /dev/null ++++ b/libavcodec/rpi_hevc_ps.c +@@ -0,0 +1,1938 @@ ++/* ++ * HEVC Parameter Set decoding ++ * ++ * Copyright (C) 2012 - 2103 Guillaume Martres ++ * Copyright (C) 2012 - 2103 Mickael Raulet ++ * Copyright (C) 2012 - 2013 Gildas Cocherel ++ * Copyright (C) 2013 Vittorio Giovara ++ * Copyright (C) 2018 John Cox for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/imgutils.h" ++#include "golomb.h" ++#include "rpi_hevc_data.h" ++#include "rpi_hevc_ps.h" ++#include "rpi_hevcdec.h" ++ ++static const uint8_t default_scaling_list_intra[] = { ++ 16, 16, 16, 16, 17, 18, 21, 24, ++ 16, 16, 16, 16, 17, 19, 22, 25, ++ 16, 16, 17, 18, 20, 22, 25, 29, ++ 16, 16, 18, 21, 24, 27, 31, 36, ++ 17, 17, 20, 24, 30, 35, 41, 47, ++ 18, 19, 22, 27, 35, 44, 54, 65, ++ 21, 22, 25, 31, 41, 54, 70, 88, ++ 24, 25, 29, 36, 47, 65, 88, 115 ++}; ++ ++static const uint8_t default_scaling_list_inter[] = { ++ 16, 16, 16, 16, 17, 18, 20, 24, ++ 16, 16, 16, 17, 18, 20, 24, 25, ++ 16, 16, 17, 18, 20, 24, 25, 28, ++ 16, 17, 18, 20, 24, 25, 28, 33, ++ 17, 18, 20, 24, 25, 28, 33, 41, ++ 18, 20, 24, 25, 28, 33, 41, 54, ++ 20, 24, 25, 28, 33, 41, 54, 71, ++ 24, 25, 28, 33, 41, 54, 71, 91 ++}; ++ ++static const AVRational vui_sar[] = { ++ { 0, 1 }, ++ { 1, 1 }, ++ { 12, 11 }, ++ { 10, 11 }, ++ { 16, 11 }, ++ { 40, 33 }, ++ { 24, 11 }, ++ { 20, 11 }, ++ { 32, 11 }, ++ { 80, 33 }, ++ { 18, 11 }, ++ { 15, 11 }, ++ { 64, 33 }, ++ { 160, 99 }, ++ { 4, 3 }, ++ { 3, 2 }, ++ { 2, 1 }, ++}; ++ ++ ++// pps_cb_qp_offset: -12,+12 ++// slice_cb_qp_offset: -12,+12 also ++// "The value of pps_cb_qp_offset + slice_cb_qp_offset shall be in the range of -12 to +12, inclusive." ++// cr_qp_offset_list[n]: -12,+12 ++// So worst case total offset: -24,+24 ++ ++#define T(n) ((((48+(n))/6-10)<<3) | (48+(n))%6) ++#define C(B,n) T(B*6+(n) < 0 ? -B*6 : (n) > 51 ? 51 : (n)) ++#define M(B,n) C(B,(-n)) ++ ++// Sizeof the QP_START_BLOCK ++#define QP_OFFSET_0 (8*6 + 12*2) ++#define QP_START(B) \ ++ M(B,48), M(B,48), M(B,48), M(B,48), M(B,48), M(B,48),\ ++ M(B,48), M(B,48), M(B,48), M(B,48), M(B,48), M(B,48),\ ++ M(B,48), M(B,48), M(B,48), M(B,48), M(B,48), M(B,48),\ ++ M(B,48), M(B,48), M(B,48), M(B,48), M(B,48), M(B,48),\ ++\ ++ M(B,48), M(B,47), M(B,46), M(B,45), M(B,44), M(B,43),\ ++ M(B,42), M(B,41), M(B,40), M(B,39), M(B,38), M(B,37),\ ++ M(B,36), M(B,35), M(B,34), M(B,33), M(B,32), M(B,31),\ ++ M(B,30), M(B,29), M(B,28), M(B,27), M(B,26), M(B,25),\ ++ M(B,24), M(B,23), M(B,22), M(B,21), M(B,20), M(B,19),\ ++ M(B,18), M(B,17), M(B,16), M(B,15), M(B,14), M(B,13),\ ++ M(B,12), M(B,11), M(B,10), M(B, 9), M(B, 8), M(B, 7),\ ++ M(B, 6), M(B, 5), M(B, 4), M(B, 3), M(B, 2), M(B, 1) ++#define QP_END(B) \ ++ C(B,51), C(B,51), C(B,51), C(B,51), C(B,51), C(B,51),\ ++ C(B,51), C(B,51), C(B,51), C(B,51), C(B,51), C(B,51),\ ++ C(B,51), C(B,51), C(B,51), C(B,51), C(B,51), C(B,51) ++ ++#define T1(B)\ ++{\ ++ QP_START(B),\ ++ C(B, 0), C(B, 1), C(B, 2), C(B, 3), C(B, 4), C(B, 5), C(B, 6), C(B, 7), C(B, 8), C(B, 9),\ ++ C(B,10), C(B,11), C(B,12), C(B,13), C(B,14), C(B,15), C(B,16), C(B,17), C(B,18), C(B,19),\ ++ C(B,20), C(B,21), C(B,22), C(B,23), C(B,24), C(B,25), C(B,26), C(B,27), C(B,28), C(B,29),\ ++ C(B,29), C(B,30), C(B,31), C(B,32), C(B,33), C(B,33), C(B,34), C(B,34), C(B,35), C(B,35),\ ++ C(B,36), C(B,36), C(B,37), C(B,37), C(B,38), C(B,39), C(B,40), C(B,41), C(B,42), C(B,43),\ ++ C(B,44), C(B,45),\ ++ C(B,46), C(B,47), C(B,48), C(B,49), C(B,50), C(B,51),\ ++ QP_END(B)\ ++} ++#define T0(B)\ ++{\ ++ QP_START(B),\ ++ C(B, 0), C(B, 1), C(B, 2), C(B, 3), C(B, 4), C(B, 5), C(B, 6), C(B, 7), C(B, 8), C(B, 9),\ ++ C(B,10), C(B,11), C(B,12), C(B,13), C(B,14), C(B,15), C(B,16), C(B,17), C(B,18), C(B,19),\ ++ C(B,20), C(B,21), C(B,22), C(B,23), C(B,24), C(B,25), C(B,26), C(B,27), C(B,28), C(B,29),\ ++ C(B,30), C(B,31), C(B,32), C(B,33), C(B,34), C(B,35), C(B,36), C(B,37), C(B,38), C(B,39),\ ++ C(B,40), C(B,41), C(B,42), C(B,43), C(B,44), C(B,45), C(B,46), C(B,47), C(B,48), C(B,49),\ ++ C(B,50), C(B,51),\ ++ C(B,51), C(B,51), C(B,51), C(B,51), C(B,51), C(B,51),\ ++ QP_END(B)\ ++} ++ ++#define QP_TABLE_SIZE (QP_OFFSET_0 + 52 + 12*2) ++ ++static const int8_t qp_c_bd_0[8][QP_TABLE_SIZE] = {T0(0),T0(1),T0(2),T0(3),T0(4),T0(5),T0(6),T0(7)}; ++static const int8_t qp_c_bd_1[8][QP_TABLE_SIZE] = {T1(0),T1(1),T1(2),T1(3),T1(4),T1(5),T1(6),T1(7)}; ++ ++#undef T ++#undef C ++#undef QP_END ++ ++#define C(B,n) ((n)<0?0:(n)>51?51:(n)) ++// We do need a lot of -ve padding to cope with high bit depths that give -ve qps ++#define QP_DBLK_OFFSET_0 QP_OFFSET_0 ++#define QP_END(B)\ ++ 51, 51, 51, 51, 51, 51 ++ ++// These don't need all the padding we have here (12 top/bottom would be enough) ++static const uint8_t qp_c_dblk_0[] = T0(0); ++static const uint8_t qp_c_dblk_1[] = T1(0); ++ ++#undef T ++#undef M ++#undef C ++#undef QP_END ++#undef QP_START ++ ++ ++static void remove_pps(HEVCRpiParamSets * const s, const int id) ++{ ++ if (s->pps_list[id] && s->pps == (const HEVCRpiPPS*)s->pps_list[id]->data) ++ s->pps = NULL; ++ av_buffer_unref(&s->pps_list[id]); ++} ++ ++static void remove_sps(HEVCRpiParamSets * const s, const int id) ++{ ++ int i; ++ if (s->sps_list[id]) { ++ if (s->sps == (const HEVCRpiSPS*)s->sps_list[id]->data) ++ s->sps = NULL; ++ ++ /* drop all PPS that depend on this SPS */ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++) ++ if (s->pps_list[i] && ((HEVCRpiPPS*)s->pps_list[i]->data)->sps_id == id) ++ remove_pps(s, i); ++ ++ av_assert0(!(s->sps_list[id] && s->sps == (HEVCRpiSPS*)s->sps_list[id]->data)); ++ } ++ av_buffer_unref(&s->sps_list[id]); ++} ++ ++static void remove_vps(HEVCRpiParamSets * const s, const int id) ++{ ++ int i; ++ if (s->vps_list[id]) { ++ if (s->vps == (const HEVCRpiVPS*)s->vps_list[id]->data) ++ s->vps = NULL; ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->sps_list); i++) ++ if (s->sps_list[i] && ((HEVCRpiSPS*)s->sps_list[i]->data)->vps_id == id) ++ remove_sps(s, i); ++ } ++ av_buffer_unref(&s->vps_list[id]); ++} ++ ++int ff_hevc_rpi_decode_short_term_rps(GetBitContext * const gb, AVCodecContext * const avctx, ++ ShortTermRPS * const rps, const HEVCRpiSPS * const sps, const int is_slice_header) ++{ ++ uint8_t rps_predict = 0; ++ int delta_poc; ++ int k0 = 0; ++ int k1 = 0; ++ int k = 0; ++ int i; ++ ++ if (rps != sps->st_rps && sps->nb_st_rps) ++ rps_predict = get_bits1(gb); ++ ++ if (rps_predict) { ++ const ShortTermRPS *rps_ridx; ++ int delta_rps; ++ unsigned abs_delta_rps; ++ uint8_t use_delta_flag = 0; ++ uint8_t delta_rps_sign; ++ ++ if (is_slice_header) { ++ unsigned int delta_idx = get_ue_golomb_long(gb) + 1; ++ if (delta_idx > sps->nb_st_rps) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid value of delta_idx in slice header RPS: %d > %d.\n", ++ delta_idx, sps->nb_st_rps); ++ return AVERROR_INVALIDDATA; ++ } ++ rps_ridx = &sps->st_rps[sps->nb_st_rps - delta_idx]; ++ rps->rps_idx_num_delta_pocs = rps_ridx->num_delta_pocs; ++ } else ++ rps_ridx = &sps->st_rps[rps - sps->st_rps - 1]; ++ ++ delta_rps_sign = get_bits1(gb); ++ abs_delta_rps = get_ue_golomb_long(gb) + 1; ++ if (abs_delta_rps < 1 || abs_delta_rps > 32768) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid value of abs_delta_rps: %d\n", ++ abs_delta_rps); ++ return AVERROR_INVALIDDATA; ++ } ++ delta_rps = (1 - (delta_rps_sign << 1)) * abs_delta_rps; ++ for (i = 0; i <= rps_ridx->num_delta_pocs; i++) { ++ int used = rps->used[k] = get_bits1(gb); ++ ++ if (!used) ++ use_delta_flag = get_bits1(gb); ++ ++ if (used || use_delta_flag) { ++ if (i < rps_ridx->num_delta_pocs) ++ delta_poc = delta_rps + rps_ridx->delta_poc[i]; ++ else ++ delta_poc = delta_rps; ++ rps->delta_poc[k] = delta_poc; ++ if (delta_poc < 0) ++ k0++; ++ else ++ k1++; ++ k++; ++ } ++ } ++ ++ if (k >= FF_ARRAY_ELEMS(rps->used)) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid num_delta_pocs: %d\n", k); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ rps->num_delta_pocs = k; ++ rps->num_negative_pics = k0; ++ // sort in increasing order (smallest first) ++ if (rps->num_delta_pocs != 0) { ++ int used, tmp; ++ for (i = 1; i < rps->num_delta_pocs; i++) { ++ delta_poc = rps->delta_poc[i]; ++ used = rps->used[i]; ++ for (k = i - 1; k >= 0; k--) { ++ tmp = rps->delta_poc[k]; ++ if (delta_poc < tmp) { ++ rps->delta_poc[k + 1] = tmp; ++ rps->used[k + 1] = rps->used[k]; ++ rps->delta_poc[k] = delta_poc; ++ rps->used[k] = used; ++ } ++ } ++ } ++ } ++ if ((rps->num_negative_pics >> 1) != 0) { ++ int used; ++ k = rps->num_negative_pics - 1; ++ // flip the negative values to largest first ++ for (i = 0; i < rps->num_negative_pics >> 1; i++) { ++ delta_poc = rps->delta_poc[i]; ++ used = rps->used[i]; ++ rps->delta_poc[i] = rps->delta_poc[k]; ++ rps->used[i] = rps->used[k]; ++ rps->delta_poc[k] = delta_poc; ++ rps->used[k] = used; ++ k--; ++ } ++ } ++ } else { ++ unsigned int prev, nb_positive_pics; ++ rps->num_negative_pics = get_ue_golomb_long(gb); ++ nb_positive_pics = get_ue_golomb_long(gb); ++ ++ if (rps->num_negative_pics >= HEVC_MAX_REFS || ++ nb_positive_pics >= HEVC_MAX_REFS) { ++ av_log(avctx, AV_LOG_ERROR, "Too many refs in a short term RPS.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ rps->num_delta_pocs = rps->num_negative_pics + nb_positive_pics; ++ if (rps->num_delta_pocs) { ++ prev = 0; ++ for (i = 0; i < rps->num_negative_pics; i++) { ++ delta_poc = get_ue_golomb_long(gb) + 1; ++ if (delta_poc < 1 || delta_poc > 32768) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid value of delta_poc: %d\n", ++ delta_poc); ++ return AVERROR_INVALIDDATA; ++ } ++ prev -= delta_poc; ++ rps->delta_poc[i] = prev; ++ rps->used[i] = get_bits1(gb); ++ } ++ prev = 0; ++ for (i = 0; i < nb_positive_pics; i++) { ++ delta_poc = get_ue_golomb_long(gb) + 1; ++ if (delta_poc < 1 || delta_poc > 32768) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid value of delta_poc: %d\n", ++ delta_poc); ++ return AVERROR_INVALIDDATA; ++ } ++ prev += delta_poc; ++ rps->delta_poc[rps->num_negative_pics + i] = prev; ++ rps->used[rps->num_negative_pics + i] = get_bits1(gb); ++ } ++ } ++ } ++ return 0; ++} ++ ++ ++static int decode_profile_tier_level(GetBitContext * const gb, AVCodecContext * const avctx, ++ PTLCommon * const ptl) ++{ ++ int i; ++ ++ if (get_bits_left(gb) < 2+1+5 + 32 + 4 + 16 + 16 + 12) ++ return -1; ++ ++ ptl->profile_space = get_bits(gb, 2); ++ ptl->tier_flag = get_bits1(gb); ++ ptl->profile_idc = get_bits(gb, 5); ++ if (ptl->profile_idc == FF_PROFILE_HEVC_MAIN) ++ av_log(avctx, AV_LOG_DEBUG, "Main profile bitstream\n"); ++ else if (ptl->profile_idc == FF_PROFILE_HEVC_MAIN_10) ++ av_log(avctx, AV_LOG_DEBUG, "Main 10 profile bitstream\n"); ++ else if (ptl->profile_idc == FF_PROFILE_HEVC_MAIN_STILL_PICTURE) ++ av_log(avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n"); ++ else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT) ++ av_log(avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n"); ++ else ++ av_log(avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc); ++ ++ for (i = 0; i < 32; i++) { ++ ptl->profile_compatibility_flag[i] = get_bits1(gb); ++ ++ if (ptl->profile_idc == 0 && i > 0 && ptl->profile_compatibility_flag[i]) ++ ptl->profile_idc = i; ++ } ++ ptl->progressive_source_flag = get_bits1(gb); ++ ptl->interlaced_source_flag = get_bits1(gb); ++ ptl->non_packed_constraint_flag = get_bits1(gb); ++ ptl->frame_only_constraint_flag = get_bits1(gb); ++ ++ skip_bits(gb, 16); // XXX_reserved_zero_44bits[0..15] ++ skip_bits(gb, 16); // XXX_reserved_zero_44bits[16..31] ++ skip_bits(gb, 12); // XXX_reserved_zero_44bits[32..43] ++ ++ return 0; ++} ++ ++static int parse_ptl(GetBitContext * const gb, AVCodecContext * const avctx, ++ PTL * const ptl, const int max_num_sub_layers) ++{ ++ int i; ++ if (decode_profile_tier_level(gb, avctx, &ptl->general_ptl) < 0 || ++ get_bits_left(gb) < 8 + (8*2 * (max_num_sub_layers - 1 > 0))) { ++ av_log(avctx, AV_LOG_ERROR, "PTL information too short\n"); ++ return -1; ++ } ++ ++ ptl->general_ptl.level_idc = get_bits(gb, 8); ++ ++ for (i = 0; i < max_num_sub_layers - 1; i++) { ++ ptl->sub_layer_profile_present_flag[i] = get_bits1(gb); ++ ptl->sub_layer_level_present_flag[i] = get_bits1(gb); ++ } ++ ++ if (max_num_sub_layers - 1> 0) ++ for (i = max_num_sub_layers - 1; i < 8; i++) ++ skip_bits(gb, 2); // reserved_zero_2bits[i] ++ for (i = 0; i < max_num_sub_layers - 1; i++) { ++ if (ptl->sub_layer_profile_present_flag[i] && ++ decode_profile_tier_level(gb, avctx, &ptl->sub_layer_ptl[i]) < 0) { ++ av_log(avctx, AV_LOG_ERROR, ++ "PTL information for sublayer %i too short\n", i); ++ return -1; ++ } ++ if (ptl->sub_layer_level_present_flag[i]) { ++ if (get_bits_left(gb) < 8) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Not enough data for sublayer %i level_idc\n", i); ++ return -1; ++ } else ++ ptl->sub_layer_ptl[i].level_idc = get_bits(gb, 8); ++ } ++ } ++ ++ return 0; ++} ++ ++static void decode_sublayer_hrd(GetBitContext * const gb, const unsigned int nb_cpb, ++ const int subpic_params_present) ++{ ++ int i; ++ ++ for (i = 0; i < nb_cpb; i++) { ++ get_ue_golomb_long(gb); // bit_rate_value_minus1 ++ get_ue_golomb_long(gb); // cpb_size_value_minus1 ++ ++ if (subpic_params_present) { ++ get_ue_golomb_long(gb); // cpb_size_du_value_minus1 ++ get_ue_golomb_long(gb); // bit_rate_du_value_minus1 ++ } ++ skip_bits1(gb); // cbr_flag ++ } ++} ++ ++static int decode_hrd(GetBitContext * const gb, const int common_inf_present, ++ const int max_sublayers) ++{ ++ int nal_params_present = 0, vcl_params_present = 0; ++ int subpic_params_present = 0; ++ int i; ++ ++ if (common_inf_present) { ++ nal_params_present = get_bits1(gb); ++ vcl_params_present = get_bits1(gb); ++ ++ if (nal_params_present || vcl_params_present) { ++ subpic_params_present = get_bits1(gb); ++ ++ if (subpic_params_present) { ++ skip_bits(gb, 8); // tick_divisor_minus2 ++ skip_bits(gb, 5); // du_cpb_removal_delay_increment_length_minus1 ++ skip_bits(gb, 1); // sub_pic_cpb_params_in_pic_timing_sei_flag ++ skip_bits(gb, 5); // dpb_output_delay_du_length_minus1 ++ } ++ ++ skip_bits(gb, 4); // bit_rate_scale ++ skip_bits(gb, 4); // cpb_size_scale ++ ++ if (subpic_params_present) ++ skip_bits(gb, 4); // cpb_size_du_scale ++ ++ skip_bits(gb, 5); // initial_cpb_removal_delay_length_minus1 ++ skip_bits(gb, 5); // au_cpb_removal_delay_length_minus1 ++ skip_bits(gb, 5); // dpb_output_delay_length_minus1 ++ } ++ } ++ ++ for (i = 0; i < max_sublayers; i++) { ++ int low_delay = 0; ++ unsigned int nb_cpb = 1; ++ int fixed_rate = get_bits1(gb); ++ ++ if (!fixed_rate) ++ fixed_rate = get_bits1(gb); ++ ++ if (fixed_rate) ++ get_ue_golomb_long(gb); // elemental_duration_in_tc_minus1 ++ else ++ low_delay = get_bits1(gb); ++ ++ if (!low_delay) { ++ nb_cpb = get_ue_golomb_long(gb) + 1; ++ if (nb_cpb < 1 || nb_cpb > 32) { ++ av_log(NULL, AV_LOG_ERROR, "nb_cpb %d invalid\n", nb_cpb); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ if (nal_params_present) ++ decode_sublayer_hrd(gb, nb_cpb, subpic_params_present); ++ if (vcl_params_present) ++ decode_sublayer_hrd(gb, nb_cpb, subpic_params_present); ++ } ++ return 0; ++} ++ ++int ff_hevc_rpi_decode_nal_vps(GetBitContext * const gb, AVCodecContext * const avctx, ++ HEVCRpiParamSets * const ps) ++{ ++ int i,j; ++ int vps_id = 0; ++ ptrdiff_t nal_size; ++ HEVCRpiVPS *vps; ++ AVBufferRef *vps_buf = av_buffer_allocz(sizeof(*vps)); ++ ++ if (!vps_buf) ++ return AVERROR(ENOMEM); ++ vps = (HEVCRpiVPS*)vps_buf->data; ++ ++ av_log(avctx, AV_LOG_DEBUG, "Decoding VPS\n"); ++ ++ nal_size = gb->buffer_end - gb->buffer; ++ if (nal_size > sizeof(vps->data)) { ++ av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized VPS " ++ "(%"PTRDIFF_SPECIFIER" > %"SIZE_SPECIFIER")\n", ++ nal_size, sizeof(vps->data)); ++ vps->data_size = sizeof(vps->data); ++ } else { ++ vps->data_size = nal_size; ++ } ++ memcpy(vps->data, gb->buffer, vps->data_size); ++ ++ vps_id = get_bits(gb, 4); ++ if (vps_id >= HEVC_MAX_VPS_COUNT) { ++ av_log(avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", vps_id); ++ goto err; ++ } ++ ++ if (get_bits(gb, 2) != 3) { // vps_reserved_three_2bits ++ av_log(avctx, AV_LOG_ERROR, "vps_reserved_three_2bits is not three\n"); ++ goto err; ++ } ++ ++ vps->vps_max_layers = get_bits(gb, 6) + 1; ++ vps->vps_max_sub_layers = get_bits(gb, 3) + 1; ++ vps->vps_temporal_id_nesting_flag = get_bits1(gb); ++ ++ if (get_bits(gb, 16) != 0xffff) { // vps_reserved_ffff_16bits ++ av_log(avctx, AV_LOG_ERROR, "vps_reserved_ffff_16bits is not 0xffff\n"); ++ goto err; ++ } ++ ++ if (vps->vps_max_sub_layers > HEVC_MAX_SUB_LAYERS) { ++ av_log(avctx, AV_LOG_ERROR, "vps_max_sub_layers out of range: %d\n", ++ vps->vps_max_sub_layers); ++ goto err; ++ } ++ ++ if (parse_ptl(gb, avctx, &vps->ptl, vps->vps_max_sub_layers) < 0) ++ goto err; ++ ++ vps->vps_sub_layer_ordering_info_present_flag = get_bits1(gb); ++ ++ i = vps->vps_sub_layer_ordering_info_present_flag ? 0 : vps->vps_max_sub_layers - 1; ++ for (; i < vps->vps_max_sub_layers; i++) { ++ vps->vps_max_dec_pic_buffering[i] = get_ue_golomb_long(gb) + 1; ++ vps->vps_num_reorder_pics[i] = get_ue_golomb_long(gb); ++ vps->vps_max_latency_increase[i] = get_ue_golomb_long(gb) - 1; ++ ++ if (vps->vps_max_dec_pic_buffering[i] > HEVC_MAX_DPB_SIZE || !vps->vps_max_dec_pic_buffering[i]) { ++ av_log(avctx, AV_LOG_ERROR, "vps_max_dec_pic_buffering_minus1 out of range: %d\n", ++ vps->vps_max_dec_pic_buffering[i] - 1); ++ goto err; ++ } ++ if (vps->vps_num_reorder_pics[i] > vps->vps_max_dec_pic_buffering[i] - 1) { ++ av_log(avctx, AV_LOG_WARNING, "vps_max_num_reorder_pics out of range: %d\n", ++ vps->vps_num_reorder_pics[i]); ++ if (avctx->err_recognition & AV_EF_EXPLODE) ++ goto err; ++ } ++ } ++ ++ vps->vps_max_layer_id = get_bits(gb, 6); ++ vps->vps_num_layer_sets = get_ue_golomb_long(gb) + 1; ++ if (vps->vps_num_layer_sets < 1 || vps->vps_num_layer_sets > 1024 || ++ (vps->vps_num_layer_sets - 1LL) * (vps->vps_max_layer_id + 1LL) > get_bits_left(gb)) { ++ av_log(avctx, AV_LOG_ERROR, "too many layer_id_included_flags\n"); ++ goto err; ++ } ++ ++ for (i = 1; i < vps->vps_num_layer_sets; i++) ++ for (j = 0; j <= vps->vps_max_layer_id; j++) ++ skip_bits(gb, 1); // layer_id_included_flag[i][j] ++ ++ vps->vps_timing_info_present_flag = get_bits1(gb); ++ if (vps->vps_timing_info_present_flag) { ++ vps->vps_num_units_in_tick = get_bits_long(gb, 32); ++ vps->vps_time_scale = get_bits_long(gb, 32); ++ vps->vps_poc_proportional_to_timing_flag = get_bits1(gb); ++ if (vps->vps_poc_proportional_to_timing_flag) ++ vps->vps_num_ticks_poc_diff_one = get_ue_golomb_long(gb) + 1; ++ vps->vps_num_hrd_parameters = get_ue_golomb_long(gb); ++ if (vps->vps_num_hrd_parameters > (unsigned)vps->vps_num_layer_sets) { ++ av_log(avctx, AV_LOG_ERROR, ++ "vps_num_hrd_parameters %d is invalid\n", vps->vps_num_hrd_parameters); ++ goto err; ++ } ++ for (i = 0; i < vps->vps_num_hrd_parameters; i++) { ++ int common_inf_present = 1; ++ ++ get_ue_golomb_long(gb); // hrd_layer_set_idx ++ if (i) ++ common_inf_present = get_bits1(gb); ++ decode_hrd(gb, common_inf_present, vps->vps_max_sub_layers); ++ } ++ } ++ get_bits1(gb); /* vps_extension_flag */ ++ ++ if (get_bits_left(gb) < 0) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Overread VPS by %d bits\n", -get_bits_left(gb)); ++ if (ps->vps_list[vps_id]) ++ goto err; ++ } ++ ++ if (ps->vps_list[vps_id] && ++ !memcmp(ps->vps_list[vps_id]->data, vps_buf->data, vps_buf->size)) { ++ av_buffer_unref(&vps_buf); ++ } else { ++ remove_vps(ps, vps_id); ++ ps->vps_list[vps_id] = vps_buf; ++ } ++ ++ return 0; ++ ++err: ++ av_buffer_unref(&vps_buf); ++ return AVERROR_INVALIDDATA; ++} ++ ++static void decode_vui(GetBitContext * const gb, AVCodecContext * const avctx, ++ const int apply_defdispwin, HEVCRpiSPS * const sps) ++{ ++ VUI backup_vui, * const vui = &sps->vui; ++ GetBitContext backup; ++ int sar_present, alt = 0; ++ ++ av_log(avctx, AV_LOG_DEBUG, "Decoding VUI\n"); ++ ++ sar_present = get_bits1(gb); ++ if (sar_present) { ++ uint8_t sar_idx = get_bits(gb, 8); ++ if (sar_idx < FF_ARRAY_ELEMS(vui_sar)) ++ vui->sar = vui_sar[sar_idx]; ++ else if (sar_idx == 255) { ++ vui->sar.num = get_bits(gb, 16); ++ vui->sar.den = get_bits(gb, 16); ++ } else ++ av_log(avctx, AV_LOG_WARNING, ++ "Unknown SAR index: %u.\n", sar_idx); ++ } ++ ++ vui->overscan_info_present_flag = get_bits1(gb); ++ if (vui->overscan_info_present_flag) ++ vui->overscan_appropriate_flag = get_bits1(gb); ++ ++ vui->video_signal_type_present_flag = get_bits1(gb); ++ if (vui->video_signal_type_present_flag) { ++ vui->video_format = get_bits(gb, 3); ++ vui->video_full_range_flag = get_bits1(gb); ++ vui->colour_description_present_flag = get_bits1(gb); ++ if (vui->video_full_range_flag && sps->pix_fmt == AV_PIX_FMT_YUV420P) ++ sps->pix_fmt = AV_PIX_FMT_YUVJ420P; ++ if (vui->colour_description_present_flag) { ++ vui->colour_primaries = get_bits(gb, 8); ++ vui->transfer_characteristic = get_bits(gb, 8); ++ vui->matrix_coeffs = get_bits(gb, 8); ++ ++ // Set invalid values to "unspecified" ++ if (!av_color_primaries_name(vui->colour_primaries)) ++ vui->colour_primaries = AVCOL_PRI_UNSPECIFIED; ++ if (!av_color_transfer_name(vui->transfer_characteristic)) ++ vui->transfer_characteristic = AVCOL_TRC_UNSPECIFIED; ++ if (!av_color_space_name(vui->matrix_coeffs)) ++ vui->matrix_coeffs = AVCOL_SPC_UNSPECIFIED; ++ if (vui->matrix_coeffs == AVCOL_SPC_RGB) { ++ switch (sps->pix_fmt) { ++ case AV_PIX_FMT_YUV444P: ++ sps->pix_fmt = AV_PIX_FMT_GBRP; ++ break; ++ case AV_PIX_FMT_YUV444P10: ++ sps->pix_fmt = AV_PIX_FMT_GBRP10; ++ break; ++ case AV_PIX_FMT_YUV444P12: ++ sps->pix_fmt = AV_PIX_FMT_GBRP12; ++ break; ++ } ++ } ++ } ++ } ++ ++ vui->chroma_loc_info_present_flag = get_bits1(gb); ++ if (vui->chroma_loc_info_present_flag) { ++ vui->chroma_sample_loc_type_top_field = get_ue_golomb_long(gb); ++ vui->chroma_sample_loc_type_bottom_field = get_ue_golomb_long(gb); ++ } ++ ++ vui->neutra_chroma_indication_flag = get_bits1(gb); ++ vui->field_seq_flag = get_bits1(gb); ++ vui->frame_field_info_present_flag = get_bits1(gb); ++ ++ // Backup context in case an alternate header is detected ++ memcpy(&backup, gb, sizeof(backup)); ++ memcpy(&backup_vui, vui, sizeof(backup_vui)); ++ if (get_bits_left(gb) >= 68 && show_bits_long(gb, 21) == 0x100000) { ++ vui->default_display_window_flag = 0; ++ av_log(avctx, AV_LOG_WARNING, "Invalid default display window\n"); ++ } else ++ vui->default_display_window_flag = get_bits1(gb); ++ ++ if (vui->default_display_window_flag) { ++ int vert_mult = 1 + (sps->chroma_format_idc < 2); ++ int horiz_mult = 1 + (sps->chroma_format_idc < 3); ++ vui->def_disp_win.left_offset = get_ue_golomb_long(gb) * horiz_mult; ++ vui->def_disp_win.right_offset = get_ue_golomb_long(gb) * horiz_mult; ++ vui->def_disp_win.top_offset = get_ue_golomb_long(gb) * vert_mult; ++ vui->def_disp_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult; ++ ++ if (apply_defdispwin && ++ avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { ++ av_log(avctx, AV_LOG_DEBUG, ++ "discarding vui default display window, " ++ "original values are l:%u r:%u t:%u b:%u\n", ++ vui->def_disp_win.left_offset, ++ vui->def_disp_win.right_offset, ++ vui->def_disp_win.top_offset, ++ vui->def_disp_win.bottom_offset); ++ ++ vui->def_disp_win.left_offset = ++ vui->def_disp_win.right_offset = ++ vui->def_disp_win.top_offset = ++ vui->def_disp_win.bottom_offset = 0; ++ } ++ } ++ ++timing_info: ++ vui->vui_timing_info_present_flag = get_bits1(gb); ++ ++ if (vui->vui_timing_info_present_flag) { ++ if( get_bits_left(gb) < 66 && !alt) { ++ // The alternate syntax seem to have timing info located ++ // at where def_disp_win is normally located ++ av_log(avctx, AV_LOG_WARNING, ++ "Strange VUI timing information, retrying...\n"); ++ memcpy(vui, &backup_vui, sizeof(backup_vui)); ++ memcpy(gb, &backup, sizeof(backup)); ++ alt = 1; ++ goto timing_info; ++ } ++ vui->vui_num_units_in_tick = get_bits_long(gb, 32); ++ vui->vui_time_scale = get_bits_long(gb, 32); ++ if (alt) { ++ av_log(avctx, AV_LOG_INFO, "Retry got %"PRIu32"/%"PRIu32" fps\n", ++ vui->vui_time_scale, vui->vui_num_units_in_tick); ++ } ++ vui->vui_poc_proportional_to_timing_flag = get_bits1(gb); ++ if (vui->vui_poc_proportional_to_timing_flag) ++ vui->vui_num_ticks_poc_diff_one_minus1 = get_ue_golomb_long(gb); ++ vui->vui_hrd_parameters_present_flag = get_bits1(gb); ++ if (vui->vui_hrd_parameters_present_flag) ++ decode_hrd(gb, 1, sps->max_sub_layers); ++ } ++ ++ vui->bitstream_restriction_flag = get_bits1(gb); ++ if (vui->bitstream_restriction_flag) { ++ if (get_bits_left(gb) < 8 && !alt) { ++ av_log(avctx, AV_LOG_WARNING, ++ "Strange VUI bitstream restriction information, retrying" ++ " from timing information...\n"); ++ memcpy(vui, &backup_vui, sizeof(backup_vui)); ++ memcpy(gb, &backup, sizeof(backup)); ++ alt = 1; ++ goto timing_info; ++ } ++ vui->tiles_fixed_structure_flag = get_bits1(gb); ++ vui->motion_vectors_over_pic_boundaries_flag = get_bits1(gb); ++ vui->restricted_ref_pic_lists_flag = get_bits1(gb); ++ vui->min_spatial_segmentation_idc = get_ue_golomb_long(gb); ++ vui->max_bytes_per_pic_denom = get_ue_golomb_long(gb); ++ vui->max_bits_per_min_cu_denom = get_ue_golomb_long(gb); ++ vui->log2_max_mv_length_horizontal = get_ue_golomb_long(gb); ++ vui->log2_max_mv_length_vertical = get_ue_golomb_long(gb); ++ } ++ ++ if (get_bits_left(gb) < 1 && !alt) { ++ // XXX: Alternate syntax when sps_range_extension_flag != 0? ++ av_log(avctx, AV_LOG_WARNING, ++ "Overread in VUI, retrying from timing information...\n"); ++ memcpy(vui, &backup_vui, sizeof(backup_vui)); ++ memcpy(gb, &backup, sizeof(backup)); ++ alt = 1; ++ goto timing_info; ++ } ++} ++ ++static void set_default_scaling_list_data(ScalingList * const sl) ++{ ++ int matrixId; ++ ++ for (matrixId = 0; matrixId < 6; matrixId++) { ++ // 4x4 default is 16 ++ memset(sl->sl[0][matrixId], 16, 16); ++ sl->sl_dc[0][matrixId] = 16; // default for 16x16 ++ sl->sl_dc[1][matrixId] = 16; // default for 32x32 ++ } ++ ++ memcpy(sl->sl[1][0], default_scaling_list_intra, 64); ++ memcpy(sl->sl[1][1], default_scaling_list_intra, 64); ++ memcpy(sl->sl[1][2], default_scaling_list_intra, 64); ++ ++ memcpy(sl->sl[1][3], default_scaling_list_inter, 64); ++ memcpy(sl->sl[1][4], default_scaling_list_inter, 64); ++ memcpy(sl->sl[1][5], default_scaling_list_inter, 64); ++ ++ memcpy(sl->sl[2][0], default_scaling_list_intra, 64); ++ memcpy(sl->sl[2][1], default_scaling_list_intra, 64); ++ memcpy(sl->sl[2][2], default_scaling_list_intra, 64); ++ ++ memcpy(sl->sl[2][3], default_scaling_list_inter, 64); ++ memcpy(sl->sl[2][4], default_scaling_list_inter, 64); ++ memcpy(sl->sl[2][5], default_scaling_list_inter, 64); ++ ++ memcpy(sl->sl[3][0], default_scaling_list_intra, 64); ++ memcpy(sl->sl[3][1], default_scaling_list_intra, 64); ++ memcpy(sl->sl[3][2], default_scaling_list_intra, 64); ++ ++ memcpy(sl->sl[3][3], default_scaling_list_inter, 64); ++ memcpy(sl->sl[3][4], default_scaling_list_inter, 64); ++ memcpy(sl->sl[3][5], default_scaling_list_inter, 64); ++} ++ ++static int scaling_list_data(GetBitContext * const gb, AVCodecContext * const avctx, ScalingList * const sl, ++ const HEVCRpiSPS * const sps) ++{ ++ uint8_t scaling_list_pred_mode_flag; ++ int32_t scaling_list_dc_coef[2][6]; ++ int size_id, matrix_id, pos; ++ int i; ++ ++ for (size_id = 0; size_id < 4; size_id++) ++ for (matrix_id = 0; matrix_id < 6; matrix_id += ((size_id == 3) ? 3 : 1)) { ++ scaling_list_pred_mode_flag = get_bits1(gb); ++ if (!scaling_list_pred_mode_flag) { ++ unsigned int delta = get_ue_golomb_long(gb); ++ /* Only need to handle non-zero delta. Zero means default, ++ * which should already be in the arrays. */ ++ if (delta) { ++ // Copy from previous array. ++ delta *= (size_id == 3) ? 3 : 1; ++ if (matrix_id < delta) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid delta in scaling list data: %d.\n", delta); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ memcpy(sl->sl[size_id][matrix_id], ++ sl->sl[size_id][matrix_id - delta], ++ size_id > 0 ? 64 : 16); ++ if (size_id > 1) ++ sl->sl_dc[size_id - 2][matrix_id] = sl->sl_dc[size_id - 2][matrix_id - delta]; ++ } ++ } else { ++ int next_coef, coef_num; ++ int32_t scaling_list_delta_coef; ++ ++ next_coef = 8; ++ coef_num = FFMIN(64, 1 << (4 + (size_id << 1))); ++ if (size_id > 1) { ++ scaling_list_dc_coef[size_id - 2][matrix_id] = get_se_golomb(gb) + 8; ++ next_coef = scaling_list_dc_coef[size_id - 2][matrix_id]; ++ sl->sl_dc[size_id - 2][matrix_id] = next_coef; ++ } ++ for (i = 0; i < coef_num; i++) { ++ if (size_id == 0) ++ pos = 4 * ff_hevc_rpi_diag_scan4x4_y[i] + ++ ff_hevc_rpi_diag_scan4x4_x[i]; ++ else ++ pos = 8 * ff_hevc_rpi_diag_scan8x8_y[i] + ++ ff_hevc_rpi_diag_scan8x8_x[i]; ++ ++ scaling_list_delta_coef = get_se_golomb(gb); ++ next_coef = (next_coef + 256U + scaling_list_delta_coef) % 256; ++ sl->sl[size_id][matrix_id][pos] = next_coef; ++ } ++ } ++ } ++ ++ if (sps->chroma_format_idc == 3) { ++ for (i = 0; i < 64; i++) { ++ sl->sl[3][1][i] = sl->sl[2][1][i]; ++ sl->sl[3][2][i] = sl->sl[2][2][i]; ++ sl->sl[3][4][i] = sl->sl[2][4][i]; ++ sl->sl[3][5][i] = sl->sl[2][5][i]; ++ } ++ sl->sl_dc[1][1] = sl->sl_dc[0][1]; ++ sl->sl_dc[1][2] = sl->sl_dc[0][2]; ++ sl->sl_dc[1][4] = sl->sl_dc[0][4]; ++ sl->sl_dc[1][5] = sl->sl_dc[0][5]; ++ } ++ ++ ++ return 0; ++} ++ ++static int map_pixel_format(HEVCRpiSPS * const sps) ++{ ++ const int cfmt = sps->chroma_format_idc; ++ ++ sps->pix_fmt = AV_PIX_FMT_NONE; ++ switch (sps->bit_depth) { ++ case 8: ++ if (cfmt == 1) ++ sps->pix_fmt = AV_PIX_FMT_SAND128; ++ break; ++ case 10: ++ if (cfmt == 1) ++ sps->pix_fmt = AV_PIX_FMT_SAND64_10; ++ break; ++ default: ++ break; ++ } ++ ++ sps->hshift[0] = sps->vshift[0] = 0; ++ sps->hshift[2] = sps->hshift[1] = cfmt > 2 ? 0 : 1; // 1 unless 4:4:4 ++ sps->vshift[2] = sps->vshift[1] = cfmt > 1 ? 0 : 1; // 1 unless 4:4:4 or 4:2:2 ++ ++ sps->pixel_shift = sps->bit_depth > 8 ? 1 : 0; ++ ++ return 0; ++} ++ ++static int ff_hevc_rpi_parse_sps(HEVCRpiSPS * const sps, GetBitContext * const gb, unsigned int * const sps_id, ++ const int apply_defdispwin, AVBufferRef * const * const vps_list, AVCodecContext * const avctx) ++{ ++ HEVCRpiWindow *ow; ++ int ret = 0; ++ int log2_diff_max_min_transform_block_size; ++ int bit_depth_chroma, start, vui_present, sublayer_ordering_info; ++ int i; ++ ++ // Coded parameters ++ ++ sps->vps_id = get_bits(gb, 4); ++ if (sps->vps_id >= HEVC_MAX_VPS_COUNT) { ++ av_log(avctx, AV_LOG_ERROR, "VPS id out of range: %d\n", sps->vps_id); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (vps_list && !vps_list[sps->vps_id]) { ++ av_log(avctx, AV_LOG_ERROR, "VPS %d does not exist\n", ++ sps->vps_id); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ sps->max_sub_layers = get_bits(gb, 3) + 1; ++ if (sps->max_sub_layers > HEVC_MAX_SUB_LAYERS) { ++ av_log(avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n", ++ sps->max_sub_layers); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ sps->temporal_id_nesting_flag = get_bits(gb, 1); ++ ++ if ((ret = parse_ptl(gb, avctx, &sps->ptl, sps->max_sub_layers)) < 0) ++ return ret; ++ ++ *sps_id = get_ue_golomb_long(gb); ++ if (*sps_id >= HEVC_MAX_SPS_COUNT) { ++ av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", *sps_id); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ sps->chroma_format_idc = get_ue_golomb_long(gb); ++ if (sps->chroma_format_idc > 3U) { ++ av_log(avctx, AV_LOG_ERROR, "chroma_format_idc %d is invalid\n", sps->chroma_format_idc); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (sps->chroma_format_idc == 3) ++ sps->separate_colour_plane_flag = get_bits1(gb); ++ ++ if (sps->separate_colour_plane_flag) ++ sps->chroma_format_idc = 0; ++ ++ sps->width = get_ue_golomb_long(gb); ++ sps->height = get_ue_golomb_long(gb); ++ if ((ret = av_image_check_size(sps->width, ++ sps->height, 0, avctx)) < 0) ++ return ret; ++ ++ if (get_bits1(gb)) { // pic_conformance_flag ++ int vert_mult = 1 + (sps->chroma_format_idc < 2); ++ int horiz_mult = 1 + (sps->chroma_format_idc < 3); ++ sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult; ++ sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * horiz_mult; ++ sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * vert_mult; ++ sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult; ++ ++ if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { ++ av_log(avctx, AV_LOG_DEBUG, ++ "discarding sps conformance window, " ++ "original values are l:%u r:%u t:%u b:%u\n", ++ sps->pic_conf_win.left_offset, ++ sps->pic_conf_win.right_offset, ++ sps->pic_conf_win.top_offset, ++ sps->pic_conf_win.bottom_offset); ++ ++ sps->pic_conf_win.left_offset = ++ sps->pic_conf_win.right_offset = ++ sps->pic_conf_win.top_offset = ++ sps->pic_conf_win.bottom_offset = 0; ++ } ++ sps->output_window = sps->pic_conf_win; ++ } ++ ++ sps->bit_depth = get_ue_golomb_long(gb) + 8; ++ bit_depth_chroma = get_ue_golomb_long(gb) + 8; ++ if (sps->chroma_format_idc && bit_depth_chroma != sps->bit_depth) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Luma bit depth (%d) is different from chroma bit depth (%d), " ++ "this is unsupported.\n", ++ sps->bit_depth, bit_depth_chroma); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ ret = map_pixel_format(sps); ++ if (ret < 0) ++ return ret; ++ ++ sps->log2_max_poc_lsb = get_ue_golomb_long(gb) + 4; ++ if (sps->log2_max_poc_lsb > 16) { ++ av_log(avctx, AV_LOG_ERROR, "log2_max_pic_order_cnt_lsb_minus4 out range: %d\n", ++ sps->log2_max_poc_lsb - 4); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ sublayer_ordering_info = get_bits1(gb); ++ start = sublayer_ordering_info ? 0 : sps->max_sub_layers - 1; ++ for (i = start; i < sps->max_sub_layers; i++) { ++ sps->temporal_layer[i].max_dec_pic_buffering = get_ue_golomb_long(gb) + 1; ++ sps->temporal_layer[i].num_reorder_pics = get_ue_golomb_long(gb); ++ sps->temporal_layer[i].max_latency_increase = get_ue_golomb_long(gb) - 1; ++ if (sps->temporal_layer[i].max_dec_pic_buffering > (unsigned)HEVC_MAX_DPB_SIZE) { ++ av_log(avctx, AV_LOG_ERROR, "sps_max_dec_pic_buffering_minus1 out of range: %d\n", ++ sps->temporal_layer[i].max_dec_pic_buffering - 1U); ++ return AVERROR_INVALIDDATA; ++ } ++ if (sps->temporal_layer[i].num_reorder_pics > sps->temporal_layer[i].max_dec_pic_buffering - 1) { ++ av_log(avctx, AV_LOG_WARNING, "sps_max_num_reorder_pics out of range: %d\n", ++ sps->temporal_layer[i].num_reorder_pics); ++ if (avctx->err_recognition & AV_EF_EXPLODE || ++ sps->temporal_layer[i].num_reorder_pics > HEVC_MAX_DPB_SIZE - 1) { ++ return AVERROR_INVALIDDATA; ++ } ++ sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[i].num_reorder_pics + 1; ++ } ++ } ++ ++ if (!sublayer_ordering_info) { ++ for (i = 0; i < start; i++) { ++ sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[start].max_dec_pic_buffering; ++ sps->temporal_layer[i].num_reorder_pics = sps->temporal_layer[start].num_reorder_pics; ++ sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase; ++ } ++ } ++ ++ sps->log2_min_cb_size = get_ue_golomb_long(gb) + 3; ++ sps->log2_diff_max_min_coding_block_size = get_ue_golomb_long(gb); ++ sps->log2_min_tb_size = get_ue_golomb_long(gb) + 2; ++ log2_diff_max_min_transform_block_size = get_ue_golomb_long(gb); ++ sps->log2_max_trafo_size = log2_diff_max_min_transform_block_size + ++ sps->log2_min_tb_size; ++ ++ if (sps->log2_min_cb_size < 3 || sps->log2_min_cb_size > 30) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid value %d for log2_min_cb_size", sps->log2_min_cb_size); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (sps->log2_diff_max_min_coding_block_size > 30) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid value %d for log2_diff_max_min_coding_block_size", sps->log2_diff_max_min_coding_block_size); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (sps->log2_min_tb_size >= sps->log2_min_cb_size || sps->log2_min_tb_size < 2) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid value for log2_min_tb_size"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (log2_diff_max_min_transform_block_size < 0 || log2_diff_max_min_transform_block_size > 30) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid value %d for log2_diff_max_min_transform_block_size", log2_diff_max_min_transform_block_size); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ { ++ const unsigned int CtbLog2SizeY = sps->log2_min_cb_size + sps->log2_diff_max_min_coding_block_size; ++ // Not a bitstream limitation, but all profiles ++ if (CtbLog2SizeY < 4 || CtbLog2SizeY > HEVC_MAX_LOG2_CTB_SIZE) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid value %d for CtbLog2SizeY", CtbLog2SizeY); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (sps->log2_max_trafo_size > FFMIN(5, CtbLog2SizeY)) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid value %d for MaxTbLog2SizeY", sps->log2_max_trafo_size); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ // Inferred parameters ++ sps->log2_ctb_size = CtbLog2SizeY; ++// sps->log2_min_pu_size = sps->log2_min_cb_size - 1; ++ } ++ ++ sps->max_transform_hierarchy_depth_inter = get_ue_golomb_long(gb); ++ sps->max_transform_hierarchy_depth_intra = get_ue_golomb_long(gb); ++ ++ sps->scaling_list_enable_flag = get_bits1(gb); ++ if (sps->scaling_list_enable_flag) { ++ set_default_scaling_list_data(&sps->scaling_list); ++ ++ if (get_bits1(gb)) { ++ ret = scaling_list_data(gb, avctx, &sps->scaling_list, sps); ++ if (ret < 0) ++ return ret; ++ } ++ } ++ ++ sps->amp_enabled_flag = get_bits1(gb); ++ sps->sao_enabled = get_bits1(gb); ++ ++ // Set pcm defaults (0) so we don't have to test _enabled when we ++ // want to use them ++ memset(&sps->pcm, 0, sizeof(sps->pcm)); ++ ++ if (get_bits1(gb)) // pcm_enabled_flag ++ { ++ const unsigned int limit_max_pcm = FFMIN(5, ++ sps->log2_min_cb_size + sps->log2_diff_max_min_coding_block_size); ++ sps->pcm.bit_depth = get_bits(gb, 4) + 1; ++ sps->pcm.bit_depth_chroma = get_bits(gb, 4) + 1; ++ sps->pcm.log2_min_pcm_cb_size = get_ue_golomb_long(gb) + 3; ++ sps->pcm.log2_max_pcm_cb_size = sps->pcm.log2_min_pcm_cb_size + ++ get_ue_golomb_long(gb); ++ if (FFMAX(sps->pcm.bit_depth, sps->pcm.bit_depth_chroma) > sps->bit_depth) { ++ av_log(avctx, AV_LOG_ERROR, ++ "PCM bit depth (%d, %d) is greater than normal bit depth (%d)\n", ++ sps->pcm.bit_depth, sps->pcm.bit_depth_chroma, sps->bit_depth); ++ return AVERROR_INVALIDDATA; ++ } ++ if (sps->pcm.log2_min_pcm_cb_size < sps->log2_min_cb_size || ++ sps->pcm.log2_max_pcm_cb_size > limit_max_pcm) { ++ av_log(avctx, AV_LOG_ERROR, "Bad PCM CB min/max size (%d->%d)", ++ sps->pcm.log2_min_pcm_cb_size, sps->pcm.log2_max_pcm_cb_size); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ sps->pcm.loop_filter_disable_flag = get_bits1(gb); ++ } ++ ++ // Could be based on min_pcm_cb_size but much easier logic if we just stick ++ // with 8 (and costs us little) ++ sps->pcm_width = (sps->width + 63) >> 6; // 8 for min size, 8 bits per byte - round up ++ sps->pcm_height = (sps->height + 7) >> 3; ++ ++ sps->nb_st_rps = get_ue_golomb_long(gb); ++ if (sps->nb_st_rps > HEVC_MAX_SHORT_TERM_REF_PIC_SETS) { ++ av_log(avctx, AV_LOG_ERROR, "Too many short term RPS: %d.\n", ++ sps->nb_st_rps); ++ return AVERROR_INVALIDDATA; ++ } ++ for (i = 0; i < sps->nb_st_rps; i++) { ++ if ((ret = ff_hevc_rpi_decode_short_term_rps(gb, avctx, &sps->st_rps[i], ++ sps, 0)) < 0) ++ return ret; ++ } ++ ++ sps->long_term_ref_pics_present_flag = get_bits1(gb); ++ if (sps->long_term_ref_pics_present_flag) { ++ sps->num_long_term_ref_pics_sps = get_ue_golomb_long(gb); ++ if (sps->num_long_term_ref_pics_sps > HEVC_MAX_LONG_TERM_REF_PICS) { ++ av_log(avctx, AV_LOG_ERROR, "num_long_term_ref_pics_sps %d is out of range.\n", ++ sps->num_long_term_ref_pics_sps); ++ return AVERROR_INVALIDDATA; ++ } ++ for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) { ++ sps->lt_ref_pic_poc_lsb_sps[i] = get_bits(gb, sps->log2_max_poc_lsb); ++ sps->used_by_curr_pic_lt_sps_flag[i] = get_bits1(gb); ++ } ++ } ++ ++ sps->sps_temporal_mvp_enabled_flag = get_bits1(gb); ++ sps->intra_filters_disable = get_bits1(gb) ? 0 : FILTER_STRONG; // sps->sps_strong_intra_smoothing_enable_flag ++ sps->vui.sar = (AVRational){0, 1}; ++ vui_present = get_bits1(gb); ++ if (vui_present) ++ decode_vui(gb, avctx, apply_defdispwin, sps); ++ ++ if (get_bits1(gb)) { // sps_extension_flag ++ int sps_extension_flag[1]; ++ for (i = 0; i < 1; i++) ++ sps_extension_flag[i] = get_bits1(gb); ++ skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7); ++ if (sps_extension_flag[0]) { ++ int extended_precision_processing_flag; ++ int cabac_bypass_alignment_enabled_flag; ++ ++ sps->transform_skip_rotation_enabled_flag = get_bits1(gb); ++ sps->transform_skip_context_enabled_flag = get_bits1(gb); ++ sps->implicit_rdpcm_enabled_flag = get_bits1(gb); ++ ++ sps->explicit_rdpcm_enabled_flag = get_bits1(gb); ++ ++ extended_precision_processing_flag = get_bits1(gb); ++ if (extended_precision_processing_flag) ++ av_log(avctx, AV_LOG_WARNING, ++ "extended_precision_processing_flag not yet implemented\n"); ++ ++ if (get_bits1(gb)) // sps->intra_smoothing_disabled_flag ++ sps->intra_filters_disable |= FILTER_EITHER; ++ sps->high_precision_offsets_enabled_flag = get_bits1(gb); ++ sps->persistent_rice_adaptation_enabled_flag = get_bits1(gb); ++ ++ cabac_bypass_alignment_enabled_flag = get_bits1(gb); ++ if (cabac_bypass_alignment_enabled_flag) ++ av_log(avctx, AV_LOG_WARNING, ++ "cabac_bypass_alignment_enabled_flag not yet implemented\n"); ++ } ++ } ++ if (apply_defdispwin) { ++ sps->output_window.left_offset += sps->vui.def_disp_win.left_offset; ++ sps->output_window.right_offset += sps->vui.def_disp_win.right_offset; ++ sps->output_window.top_offset += sps->vui.def_disp_win.top_offset; ++ sps->output_window.bottom_offset += sps->vui.def_disp_win.bottom_offset; ++ } ++ ++ ow = &sps->output_window; ++ if (ow->left_offset >= INT_MAX - ow->right_offset || ++ ow->top_offset >= INT_MAX - ow->bottom_offset || ++ ow->left_offset + ow->right_offset >= sps->width || ++ ow->top_offset + ow->bottom_offset >= sps->height) { ++ av_log(avctx, AV_LOG_WARNING, "Invalid cropping offsets: %u/%u/%u/%u\n", ++ ow->left_offset, ow->right_offset, ow->top_offset, ow->bottom_offset); ++ if (avctx->err_recognition & AV_EF_EXPLODE) { ++ return AVERROR_INVALIDDATA; ++ } ++ av_log(avctx, AV_LOG_WARNING, ++ "Displaying the whole video surface.\n"); ++ memset(ow, 0, sizeof(*ow)); ++ memset(&sps->pic_conf_win, 0, sizeof(sps->pic_conf_win)); ++ } ++ ++ // Inferred parameters ++ ++ sps->ctb_width = (sps->width + (1 << sps->log2_ctb_size) - 1) >> sps->log2_ctb_size; ++ sps->ctb_height = (sps->height + (1 << sps->log2_ctb_size) - 1) >> sps->log2_ctb_size; ++ sps->ctb_size = sps->ctb_width * sps->ctb_height; ++ ++ sps->min_cb_width = sps->width >> sps->log2_min_cb_size; ++ sps->min_cb_height = sps->height >> sps->log2_min_cb_size; ++ sps->min_tb_width = sps->width >> sps->log2_min_tb_size; ++ sps->min_tb_height = sps->height >> sps->log2_min_tb_size; ++ sps->min_pu_width = sps->width >> LOG2_MIN_PU_SIZE; ++ sps->min_pu_height = sps->height >> LOG2_MIN_PU_SIZE; ++ sps->tb_mask = (1 << (sps->log2_ctb_size - sps->log2_min_tb_size)) - 1; ++ ++ sps->qp_bd_offset = 6 * (sps->bit_depth - 8); ++ sps->wp_offset_half_range = (1U << (sps->high_precision_offsets_enabled_flag ? sps->bit_depth - 1 : 7)); ++ ++ if (av_mod_uintp2(sps->width, sps->log2_min_cb_size) || ++ av_mod_uintp2(sps->height, sps->log2_min_cb_size)) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid coded frame dimensions.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (sps->max_transform_hierarchy_depth_inter > sps->log2_ctb_size - sps->log2_min_tb_size) { ++ av_log(avctx, AV_LOG_ERROR, "max_transform_hierarchy_depth_inter out of range: %d\n", ++ sps->max_transform_hierarchy_depth_inter); ++ return AVERROR_INVALIDDATA; ++ } ++ if (sps->max_transform_hierarchy_depth_intra > sps->log2_ctb_size - sps->log2_min_tb_size) { ++ av_log(avctx, AV_LOG_ERROR, "max_transform_hierarchy_depth_intra out of range: %d\n", ++ sps->max_transform_hierarchy_depth_intra); ++ return AVERROR_INVALIDDATA; ++ } ++ if (sps->log2_max_trafo_size > FFMIN(sps->log2_ctb_size, 5)) { ++ av_log(avctx, AV_LOG_ERROR, ++ "max transform block size out of range: %d\n", ++ sps->log2_max_trafo_size); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (get_bits_left(gb) < 0) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Overread SPS by %d bits\n", -get_bits_left(gb)); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ return 0; ++} ++ ++int ff_hevc_rpi_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, ++ HEVCRpiParamSets *ps, int apply_defdispwin) ++{ ++ HEVCRpiSPS *sps; ++ AVBufferRef *sps_buf = av_buffer_allocz(sizeof(*sps)); ++ unsigned int sps_id; ++ int ret; ++ ptrdiff_t nal_size; ++ ++ if (!sps_buf) ++ return AVERROR(ENOMEM); ++ sps = (HEVCRpiSPS*)sps_buf->data; ++ ++ av_log(avctx, AV_LOG_DEBUG, "Decoding SPS\n"); ++ ++ nal_size = gb->buffer_end - gb->buffer; ++ if (nal_size > sizeof(sps->data)) { ++ av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized SPS " ++ "(%"PTRDIFF_SPECIFIER" > %"SIZE_SPECIFIER")\n", ++ nal_size, sizeof(sps->data)); ++ sps->data_size = sizeof(sps->data); ++ } else { ++ sps->data_size = nal_size; ++ } ++ memcpy(sps->data, gb->buffer, sps->data_size); ++ ++ ret = ff_hevc_rpi_parse_sps(sps, gb, &sps_id, ++ apply_defdispwin, ++ ps->vps_list, avctx); ++ if (ret < 0) { ++ av_buffer_unref(&sps_buf); ++ return ret; ++ } ++ ++ if (avctx->debug & FF_DEBUG_BITSTREAM) { ++ av_log(avctx, AV_LOG_DEBUG, ++ "Parsed SPS: id %d; coded wxh: %dx%d; " ++ "cropped wxh: %dx%d; pix_fmt: %s.\n", ++ sps_id, sps->width, sps->height, ++ sps->width - (sps->output_window.left_offset + sps->output_window.right_offset), ++ sps->height - (sps->output_window.top_offset + sps->output_window.bottom_offset), ++ av_get_pix_fmt_name(sps->pix_fmt)); ++ } ++ ++ /* check if this is a repeat of an already parsed SPS, then keep the ++ * original one. ++ * otherwise drop all PPSes that depend on it */ ++ if (ps->sps_list[sps_id] && ++ !memcmp(ps->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) { ++ av_buffer_unref(&sps_buf); ++ } else { ++ remove_sps(ps, sps_id); ++ ps->sps_list[sps_id] = sps_buf; ++ } ++ ++ return 0; ++} ++ ++static void hevc_pps_free(void *opaque, uint8_t *data) ++{ ++ HEVCRpiPPS *pps = (HEVCRpiPPS*)data; ++ ++ av_freep(&pps->column_width); ++ av_freep(&pps->row_height); ++ av_freep(&pps->col_bd); ++ av_freep(&pps->row_bd); ++ av_freep(&pps->col_idxX); ++ av_freep(&pps->ctb_addr_rs_to_ts); ++ av_freep(&pps->ctb_addr_ts_to_rs); ++ av_freep(&pps->tile_pos_ts); ++ av_freep(&pps->tile_size); ++ av_freep(&pps->tile_id); ++ av_freep(&pps->ctb_ts_flags); ++ ++ av_freep(&pps); ++} ++ ++static int get_offset_list(GetBitContext * const gb, AVCodecContext * const avctx, unsigned int n_minus_1, int8_t * offsets) ++{ ++ do ++ { ++ const int offset = get_se_golomb_long(gb); ++ if (offset < -12 || offset > 12) { ++ av_log(avctx, AV_LOG_ERROR, "qp_offset_list[]: %d out of range\n", offset); ++ return AVERROR_INVALIDDATA; ++ } ++ *offsets++ = offset; ++ } while (n_minus_1-- != 0); ++ return 0; ++} ++ ++static int pps_range_extensions(GetBitContext * const gb, AVCodecContext * const avctx, ++ HEVCRpiPPS * const pps, const HEVCRpiSPS * const sps) ++{ ++ if (pps->transform_skip_enabled_flag) { ++ pps->log2_max_transform_skip_block_size = get_ue_golomb_long(gb) + 2; ++ } ++ pps->cross_component_prediction_enabled_flag = get_bits1(gb); ++ if (pps->cross_component_prediction_enabled_flag && ++ (sps->chroma_format_idc != 3 || sps->separate_colour_plane_flag)) ++ { ++ av_log(avctx, AV_LOG_ERROR, "cross_component_prediction_enabled but chroma_format_idc != 3\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ pps->chroma_qp_offset_list_enabled_flag = get_bits1(gb); ++ if (pps->chroma_qp_offset_list_enabled_flag) { ++ int err; ++ ++ pps->diff_cu_chroma_qp_offset_depth = get_ue_golomb_long(gb); ++ pps->chroma_qp_offset_list_len_minus1 = get_ue_golomb_long(gb); ++ if (pps->chroma_qp_offset_list_len_minus1 > 5) { ++ av_log(avctx, AV_LOG_ERROR, ++ "chroma_qp_offset_list_len_minus1 shall be in the range [0, 5].\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ av_log(avctx, AV_LOG_WARNING, "cb_qp_offset_list not tested yet.\n"); ++ ++ if ((err = get_offset_list(gb, avctx, pps->chroma_qp_offset_list_len_minus1, pps->cb_qp_offset_list)) != 0 || ++ (err = get_offset_list(gb, avctx, pps->chroma_qp_offset_list_len_minus1, pps->cr_qp_offset_list)) != 0) ++ return err; ++ } ++ ++ { ++ const unsigned int max_offset = sps->bit_depth > 10 ? sps->bit_depth - 10 : 0; ++ ++ pps->log2_sao_offset_scale_luma = get_ue_golomb_long(gb); ++ if (pps->log2_sao_offset_scale_luma > max_offset) { ++ av_log(avctx, AV_LOG_ERROR, "log2_sao_offset_scale_luma invalid"); ++ return AVERROR_INVALIDDATA; ++ } ++ pps->log2_sao_offset_scale_chroma = get_ue_golomb_long(gb); ++ if (pps->log2_sao_offset_scale_chroma > max_offset) { ++ av_log(avctx, AV_LOG_ERROR, "log2_sao_offset_scale_chroma invalid"); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ return(0); ++} ++ ++static inline int setup_pps(AVCodecContext * const avctx, ++ HEVCRpiPPS * const pps, const HEVCRpiSPS * const sps) ++{ ++ int pic_area_in_ctbs; ++ int i, j, x, y, ctb_addr_rs, tile_id; ++ ++ // Inferred parameters ++ ++ // qp_y -> qp_u/qp_v tables ++ // The tables have at least -24,+24 overrun after adding offset here ++ // which should allow for clipless offseting ++ ++ pps->qp_dblk_x[0] = qp_c_dblk_0 + QP_DBLK_OFFSET_0; // No offset for luma, but may be useful for general code ++ pps->qp_bd_x[0] = qp_c_bd_0[sps->bit_depth - 8] + QP_OFFSET_0; ++ ++ if (sps->chroma_format_idc == 1) { ++ pps->qp_dblk_x[1] = qp_c_dblk_1 + pps->cb_qp_offset + QP_DBLK_OFFSET_0; ++ pps->qp_bd_x[1] = qp_c_bd_1[sps->bit_depth - 8] + pps->cb_qp_offset + QP_OFFSET_0; ++ pps->qp_dblk_x[2] = qp_c_dblk_1 + pps->cr_qp_offset + QP_DBLK_OFFSET_0; ++ pps->qp_bd_x[2] = qp_c_bd_1[sps->bit_depth - 8] + pps->cr_qp_offset + QP_OFFSET_0; ++ } ++ else ++ { ++ pps->qp_dblk_x[1] = qp_c_dblk_0 + pps->cb_qp_offset + QP_DBLK_OFFSET_0; ++ pps->qp_bd_x[1] = qp_c_bd_0[sps->bit_depth - 8] + pps->cb_qp_offset + QP_OFFSET_0; ++ pps->qp_dblk_x[2] = qp_c_dblk_0 + pps->cr_qp_offset + QP_DBLK_OFFSET_0; ++ pps->qp_bd_x[2] = qp_c_bd_0[sps->bit_depth - 8] + pps->cr_qp_offset + QP_OFFSET_0; ++ } ++ ++ pps->col_bd = av_malloc_array(pps->num_tile_columns + 1, sizeof(*pps->col_bd)); ++ pps->row_bd = av_malloc_array(pps->num_tile_rows + 1, sizeof(*pps->row_bd)); ++ pps->col_idxX = av_malloc_array(sps->ctb_width, sizeof(*pps->col_idxX)); ++ if (!pps->col_bd || !pps->row_bd || !pps->col_idxX) ++ return AVERROR(ENOMEM); ++ ++ if (pps->uniform_spacing_flag) { ++ if (!pps->column_width) { ++ pps->column_width = av_malloc_array(pps->num_tile_columns, sizeof(*pps->column_width)); ++ pps->row_height = av_malloc_array(pps->num_tile_rows, sizeof(*pps->row_height)); ++ } ++ if (!pps->column_width || !pps->row_height) ++ return AVERROR(ENOMEM); ++ ++ for (i = 0; i < pps->num_tile_columns; i++) { ++ pps->column_width[i] = ((i + 1) * sps->ctb_width) / pps->num_tile_columns - ++ (i * sps->ctb_width) / pps->num_tile_columns; ++ } ++ ++ for (i = 0; i < pps->num_tile_rows; i++) { ++ pps->row_height[i] = ((i + 1) * sps->ctb_height) / pps->num_tile_rows - ++ (i * sps->ctb_height) / pps->num_tile_rows; ++ } ++ } ++ ++ { ++ const unsigned int td_mask = 63 >> (sps->log2_ctb_size + sps->pixel_shift); ++ pps->col_bd[0] = 0; ++ pps->tile_wpp_inter_disable = 0; ++ for (i = 0; i < pps->num_tile_columns; i++) ++ { ++ pps->col_bd[i + 1] = pps->col_bd[i] + pps->column_width[i]; ++ ++ // Avoid trying tile parallel if the columns don't fall on cache boundries ++ // (this causes too much pain syncing flushes with the QPU) ++ // Ignore the final (RHS of pic) tile boundry ++ if ((pps->col_bd[i] & td_mask) != 0) { ++ pps->tile_wpp_inter_disable = 1; ++ } ++ } ++ ++ // If we can start the next row before finishing the first line of ++ // this one then we must wait at the end of the tile ++ // * if this happens a lot then there are better but more complicated ++ // conditions that we could apply ++ if (pps->tile_wpp_inter_disable) { ++ for (i = 0; i < pps->num_tile_rows; i++) ++ { ++ if (pps->row_height[i] <= RPI_MAX_JOBS) { ++ pps->tile_wpp_inter_disable = 2; ++ break; ++ } ++ } ++ } ++ } ++ ++ pps->row_bd[0] = 0; ++ for (i = 0; i < pps->num_tile_rows; i++) ++ pps->row_bd[i + 1] = pps->row_bd[i] + pps->row_height[i]; ++ ++ for (i = 0, j = 0; i < sps->ctb_width; i++) { ++ if (i >= pps->col_bd[j + 1]) ++ j++; ++ pps->col_idxX[i] = j; ++ } ++ ++ /** ++ * 6.5 ++ */ ++ pic_area_in_ctbs = sps->ctb_size; ++ ++ pps->ctb_addr_rs_to_ts = av_malloc_array(pic_area_in_ctbs, sizeof(*pps->ctb_addr_rs_to_ts)); ++ pps->ctb_addr_ts_to_rs = av_malloc_array(pic_area_in_ctbs, sizeof(*pps->ctb_addr_ts_to_rs)); ++ pps->tile_id = av_malloc_array(pic_area_in_ctbs, sizeof(*pps->tile_id)); ++ pps->tile_size = av_malloc_array(pps->num_tile_columns * pps->num_tile_rows, sizeof(*pps->tile_size)); ++ pps->tile_pos_ts = av_malloc_array(pps->num_tile_columns * pps->num_tile_rows, sizeof(*pps->tile_pos_ts)); ++ pps->ctb_ts_flags = av_malloc_array(pic_area_in_ctbs, sizeof(*pps->ctb_ts_flags)); ++ if (!pps->ctb_addr_rs_to_ts || !pps->ctb_addr_ts_to_rs || ++ !pps->tile_id || pps->tile_pos_ts == NULL || pps->tile_size == NULL) { ++ return AVERROR(ENOMEM); ++ } ++ ++ memset(pps->ctb_ts_flags, 0, pic_area_in_ctbs * sizeof(*pps->ctb_ts_flags)); ++ ++ for (ctb_addr_rs = 0; ctb_addr_rs < pic_area_in_ctbs; ctb_addr_rs++) { ++ int tb_x = ctb_addr_rs % sps->ctb_width; ++ int tb_y = ctb_addr_rs / sps->ctb_width; ++ int tile_x = 0; ++ int tile_y = 0; ++ int val = 0; ++ ++ for (i = 0; i < pps->num_tile_columns; i++) { ++ if (tb_x < pps->col_bd[i + 1]) { ++ tile_x = i; ++ break; ++ } ++ } ++ ++ for (i = 0; i < pps->num_tile_rows; i++) { ++ if (tb_y < pps->row_bd[i + 1]) { ++ tile_y = i; ++ break; ++ } ++ } ++ ++ for (i = 0; i < tile_x; i++) ++ val += pps->row_height[tile_y] * pps->column_width[i]; ++ for (i = 0; i < tile_y; i++) ++ val += sps->ctb_width * pps->row_height[i]; ++ ++ val += (tb_y - pps->row_bd[tile_y]) * pps->column_width[tile_x] + ++ tb_x - pps->col_bd[tile_x]; ++ ++ pps->ctb_addr_rs_to_ts[ctb_addr_rs] = val; ++ pps->ctb_addr_ts_to_rs[val] = ctb_addr_rs; ++ } ++ ++ { ++ uint8_t * pflags = pps->ctb_ts_flags; ++ uint16_t * ptid = pps->tile_id; ++ ++ for (j = 0, tile_id = 0; j < pps->num_tile_rows; j++) ++ { ++ for (i = 0; i < pps->num_tile_columns; i++, tile_id++) ++ { ++ const unsigned int tile_w = pps->column_width[i]; ++ ++ pflags[0] |= CTB_TS_FLAGS_CIREQ; ++ ++ for (x = 0; x != tile_w; ++x) { ++ pflags[x] |= CTB_TS_FLAGS_TOT; ++ } ++ ++ for (y = pps->row_bd[j]; y < pps->row_bd[j + 1]; y++) ++ { ++ pflags[0] |= CTB_TS_FLAGS_SOTL; ++ ++ if (pps->entropy_coding_sync_enabled_flag) ++ { ++ if (pps->column_width[i] != 1) ++ pflags[1] |= CTB_TS_FLAGS_CSAVE; ++ else ++ pflags[0] |= CTB_TS_FLAGS_CIREQ; ++ ++ if ((pflags[0] & CTB_TS_FLAGS_CIREQ) == 0) ++ pflags[0] |= CTB_TS_FLAGS_CLOAD; ++ } ++ ++ for (x = 0; x != tile_w; ++x) ++ *ptid++ = tile_id; ++ ++ pflags += tile_w; ++ pflags[-1] |= CTB_TS_FLAGS_EOTL; ++ if (i + 1 == pps->num_tile_columns) ++ pflags[-1] |= CTB_TS_FLAGS_EOL; ++ } ++ ++ pflags[-1] |= CTB_TS_FLAGS_EOT; ++ } ++ } ++ } ++ ++ { ++ unsigned int ts = 0; ++ for (j = 0; j < pps->num_tile_rows; j++) ++ for (i = 0; i < pps->num_tile_columns; i++) ++ { ++ const unsigned int size = pps->column_width[i] * pps->row_height[j]; ++ pps->tile_size[j * pps->num_tile_columns + i] = size; ++ pps->tile_pos_ts[j * pps->num_tile_columns + i] = ts; ++ ts += size; ++ } ++ } ++ ++ return 0; ++} ++ ++int ff_hevc_rpi_decode_nal_pps(GetBitContext * const gb, AVCodecContext * const avctx, ++ HEVCRpiParamSets * const ps) ++{ ++ const HEVCRpiSPS *sps = NULL; ++ int i, ret = 0; ++ unsigned int pps_id = 0; ++ ptrdiff_t nal_size; ++ unsigned log2_parallel_merge_level_minus2; ++ ++ AVBufferRef *pps_buf; ++ HEVCRpiPPS *pps = av_mallocz(sizeof(*pps)); ++ ++ if (!pps) ++ return AVERROR(ENOMEM); ++ ++ pps_buf = av_buffer_create((uint8_t *)pps, sizeof(*pps), ++ hevc_pps_free, NULL, 0); ++ if (!pps_buf) { ++ av_freep(&pps); ++ return AVERROR(ENOMEM); ++ } ++ ++ av_log(avctx, AV_LOG_DEBUG, "Decoding PPS\n"); ++ ++ nal_size = gb->buffer_end - gb->buffer; ++ if (nal_size > sizeof(pps->data)) { ++ av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized PPS " ++ "(%"PTRDIFF_SPECIFIER" > %"SIZE_SPECIFIER")\n", ++ nal_size, sizeof(pps->data)); ++ pps->data_size = sizeof(pps->data); ++ } else { ++ pps->data_size = nal_size; ++ } ++ memcpy(pps->data, gb->buffer, pps->data_size); ++ ++ // Default values ++ pps->loop_filter_across_tiles_enabled_flag = 1; ++ pps->num_tile_columns = 1; ++ pps->num_tile_rows = 1; ++ pps->uniform_spacing_flag = 1; ++ pps->disable_dbf = 0; ++ pps->beta_offset = 0; ++ pps->tc_offset = 0; ++ pps->log2_max_transform_skip_block_size = 2; ++ ++ // Coded parameters ++ pps_id = get_ue_golomb_long(gb); ++ if (pps_id >= HEVC_MAX_PPS_COUNT) { ++ av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ pps->sps_id = get_ue_golomb_long(gb); ++ if (pps->sps_id >= HEVC_MAX_SPS_COUNT) { ++ av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", pps->sps_id); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ if (!ps->sps_list[pps->sps_id]) { ++ av_log(avctx, AV_LOG_ERROR, "SPS %u does not exist.\n", pps->sps_id); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ sps = (HEVCRpiSPS *)ps->sps_list[pps->sps_id]->data; ++ ++ pps->dependent_slice_segments_enabled_flag = get_bits1(gb); ++ pps->output_flag_present_flag = get_bits1(gb); ++ pps->num_extra_slice_header_bits = get_bits(gb, 3); ++ ++ pps->sign_data_hiding_flag = get_bits1(gb); ++ ++ pps->cabac_init_present_flag = get_bits1(gb); ++ ++ pps->num_ref_idx_l0_default_active = get_ue_golomb_long(gb) + 1; ++ if (pps->num_ref_idx_l0_default_active < 1 || pps->num_ref_idx_l0_default_active > 15) { ++ av_log(avctx, AV_LOG_ERROR, "pps->num_ref_idx_l0_default_active invalid\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ pps->num_ref_idx_l1_default_active = get_ue_golomb_long(gb) + 1; ++ if (pps->num_ref_idx_l1_default_active < 1 || pps->num_ref_idx_l1_default_active > 15) { ++ av_log(avctx, AV_LOG_ERROR, "pps->num_ref_idx_l1_default_active invalid\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ ++ pps->pic_init_qp_minus26 = get_se_golomb(gb); ++ if (pps->pic_init_qp_minus26 > 25 || pps->pic_init_qp_minus26 < -(26 + sps->qp_bd_offset)) { ++ av_log(avctx, AV_LOG_ERROR, ++ "init_qp_minus26 %d is outside the valid range " ++ "[%d, %d].\n", ++ pps->pic_init_qp_minus26, ++ -(26 + sps->qp_bd_offset), 25); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ ++ pps->constrained_intra_pred_flag = get_bits1(gb); ++ pps->transform_skip_enabled_flag = get_bits1(gb); ++ ++ pps->cu_qp_delta_enabled_flag = get_bits1(gb); ++ pps->log2_min_cu_qp_delta_size = sps->log2_ctb_size; ++ if (pps->cu_qp_delta_enabled_flag) ++ { ++ const unsigned int diff_cu_qp_delta_depth = get_ue_golomb_long(gb); ++ ++ if (diff_cu_qp_delta_depth > sps->log2_diff_max_min_coding_block_size) { ++ av_log(avctx, AV_LOG_ERROR, "diff_cu_qp_delta_depth %d is invalid\n", ++ diff_cu_qp_delta_depth); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ ++ pps->log2_min_cu_qp_delta_size = sps->log2_ctb_size - diff_cu_qp_delta_depth; ++ } ++ ++ pps->cb_qp_offset = get_se_golomb(gb); ++ if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) { ++ av_log(avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n", ++ pps->cb_qp_offset); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ pps->cr_qp_offset = get_se_golomb(gb); ++ if (pps->cr_qp_offset < -12 || pps->cr_qp_offset > 12) { ++ av_log(avctx, AV_LOG_ERROR, "pps_cr_qp_offset out of range: %d\n", ++ pps->cr_qp_offset); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ pps->pic_slice_level_chroma_qp_offsets_present_flag = get_bits1(gb); ++ ++ pps->weighted_pred_flag = get_bits1(gb); ++ pps->weighted_bipred_flag = get_bits1(gb); ++ ++ pps->transquant_bypass_enable_flag = get_bits1(gb); ++ pps->tiles_enabled_flag = get_bits1(gb); ++ pps->entropy_coding_sync_enabled_flag = get_bits1(gb); ++ ++ if (pps->tiles_enabled_flag) { ++ pps->num_tile_columns = get_ue_golomb_long(gb) + 1; ++ pps->num_tile_rows = get_ue_golomb_long(gb) + 1; ++ if (pps->num_tile_columns <= 0 || ++ pps->num_tile_columns >= sps->width) { ++ av_log(avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n", ++ pps->num_tile_columns - 1); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ if (pps->num_tile_rows <= 0 || ++ pps->num_tile_rows >= sps->height) { ++ av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n", ++ pps->num_tile_rows - 1); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ ++ pps->column_width = av_malloc_array(pps->num_tile_columns, sizeof(*pps->column_width)); ++ pps->row_height = av_malloc_array(pps->num_tile_rows, sizeof(*pps->row_height)); ++ if (!pps->column_width || !pps->row_height) { ++ ret = AVERROR(ENOMEM); ++ goto err; ++ } ++ ++ pps->uniform_spacing_flag = get_bits1(gb); ++ if (!pps->uniform_spacing_flag) { ++ uint64_t sum = 0; ++ for (i = 0; i < pps->num_tile_columns - 1; i++) { ++ pps->column_width[i] = get_ue_golomb_long(gb) + 1; ++ sum += pps->column_width[i]; ++ } ++ if (sum >= sps->ctb_width) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile widths.\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ pps->column_width[pps->num_tile_columns - 1] = sps->ctb_width - sum; ++ ++ sum = 0; ++ for (i = 0; i < pps->num_tile_rows - 1; i++) { ++ pps->row_height[i] = get_ue_golomb_long(gb) + 1; ++ sum += pps->row_height[i]; ++ } ++ if (sum >= sps->ctb_height) { ++ av_log(avctx, AV_LOG_ERROR, "Invalid tile heights.\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ pps->row_height[pps->num_tile_rows - 1] = sps->ctb_height - sum; ++ } ++ pps->loop_filter_across_tiles_enabled_flag = get_bits1(gb); ++ } ++ ++ pps->seq_loop_filter_across_slices_enabled_flag = get_bits1(gb); ++ ++ pps->deblocking_filter_control_present_flag = get_bits1(gb); ++ if (pps->deblocking_filter_control_present_flag) { ++ pps->deblocking_filter_override_enabled_flag = get_bits1(gb); ++ pps->disable_dbf = get_bits1(gb); ++ if (!pps->disable_dbf) { ++ int beta_offset_div2 = get_se_golomb(gb); ++ int tc_offset_div2 = get_se_golomb(gb) ; ++ if (beta_offset_div2 < -6 || beta_offset_div2 > 6) { ++ av_log(avctx, AV_LOG_ERROR, "pps_beta_offset_div2 out of range: %d\n", ++ beta_offset_div2); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ if (tc_offset_div2 < -6 || tc_offset_div2 > 6) { ++ av_log(avctx, AV_LOG_ERROR, "pps_tc_offset_div2 out of range: %d\n", ++ tc_offset_div2); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ pps->beta_offset = 2 * beta_offset_div2; ++ pps->tc_offset = 2 * tc_offset_div2; ++ } ++ } ++ ++ pps->scaling_list_data_present_flag = get_bits1(gb); ++ if (pps->scaling_list_data_present_flag) { ++ set_default_scaling_list_data(&pps->scaling_list); ++ ret = scaling_list_data(gb, avctx, &pps->scaling_list, sps); ++ if (ret < 0) ++ goto err; ++ } ++ pps->lists_modification_present_flag = get_bits1(gb); ++ log2_parallel_merge_level_minus2 = get_ue_golomb_long(gb); ++ if (log2_parallel_merge_level_minus2 > sps->log2_ctb_size) { ++ av_log(avctx, AV_LOG_ERROR, "log2_parallel_merge_level_minus2 out of range: %d\n", ++ log2_parallel_merge_level_minus2); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ pps->log2_parallel_merge_level = log2_parallel_merge_level_minus2 + 2; ++ ++ pps->slice_header_extension_present_flag = get_bits1(gb); ++ ++ if (get_bits1(gb)) { // pps_extension_present_flag ++ int pps_range_extensions_flag = get_bits1(gb); ++ skip_bits(gb, 7); // pps_extension_7bits ++ if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps_range_extensions_flag) { ++ if ((ret = pps_range_extensions(gb, avctx, pps, sps)) < 0) ++ goto err; ++ } ++ } ++ ++ ret = setup_pps(avctx, pps, sps); ++ if (ret < 0) ++ goto err; ++ ++ if (get_bits_left(gb) < 0) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Overread PPS by %d bits\n", -get_bits_left(gb)); ++ ret = AVERROR_INVALIDDATA; ++ goto err; ++ } ++ ++ remove_pps(ps, pps_id); ++ ps->pps_list[pps_id] = pps_buf; ++ ++ return 0; ++ ++err: ++ av_buffer_unref(&pps_buf); ++ return ret; ++} ++ ++int ff_hevc_rpi_compute_poc(const HEVCRpiSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type) ++{ ++ int max_poc_lsb = 1 << sps->log2_max_poc_lsb; ++ int prev_poc_lsb = pocTid0 % max_poc_lsb; ++ int prev_poc_msb = pocTid0 - prev_poc_lsb; ++ int poc_msb; ++ ++ if (poc_lsb < prev_poc_lsb && prev_poc_lsb - poc_lsb >= max_poc_lsb / 2) ++ poc_msb = prev_poc_msb + max_poc_lsb; ++ else if (poc_lsb > prev_poc_lsb && poc_lsb - prev_poc_lsb > max_poc_lsb / 2) ++ poc_msb = prev_poc_msb - max_poc_lsb; ++ else ++ poc_msb = prev_poc_msb; ++ ++ // For BLA picture types, POCmsb is set to 0. ++ if (nal_unit_type == HEVC_NAL_BLA_W_LP || ++ nal_unit_type == HEVC_NAL_BLA_W_RADL || ++ nal_unit_type == HEVC_NAL_BLA_N_LP) ++ poc_msb = 0; ++ ++ return poc_msb + poc_lsb; ++} +--- /dev/null ++++ b/libavcodec/rpi_hevc_ps.h +@@ -0,0 +1,449 @@ ++/* ++ * HEVC parameter set parsing ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_RPI_HEVC_PS_H ++#define AVCODEC_RPI_HEVC_PS_H ++ ++#include ++ ++#include "libavutil/buffer.h" ++#include "libavutil/pixfmt.h" ++#include "libavutil/rational.h" ++ ++#include "avcodec.h" ++#include "get_bits.h" ++#include "hevc.h" ++ ++typedef struct ShortTermRPS { ++ unsigned int num_negative_pics; ++ int num_delta_pocs; ++ int rps_idx_num_delta_pocs; ++ int32_t delta_poc[32]; ++ uint8_t used[32]; ++} ShortTermRPS; ++ ++typedef struct LongTermRPS { ++ int poc[32]; ++ uint8_t used[32]; ++ uint8_t nb_refs; ++} LongTermRPS; ++ ++typedef struct RpiSliceHeader { ++ unsigned int pps_id; ++ ++ ///< address (in raster order) of the first block in the current slice segment ++ unsigned int slice_segment_addr; ++ ///< address (in raster order) of the first block in the current slice ++ unsigned int slice_addr; ++ ++ enum HEVCSliceType slice_type; ++ ++ int pic_order_cnt_lsb; ++ ++ uint8_t first_slice_in_pic_flag; ++ uint8_t dependent_slice_segment_flag; ++ uint8_t pic_output_flag; ++ uint8_t colour_plane_id; ++ ++ ///< RPS coded in the slice header itself is stored here ++ int short_term_ref_pic_set_sps_flag; ++ int short_term_ref_pic_set_size; ++ ShortTermRPS slice_rps; ++ const ShortTermRPS *short_term_rps; ++ int long_term_ref_pic_set_size; ++ LongTermRPS long_term_rps; ++ unsigned int list_entry_lx[2][32]; ++ ++ uint8_t rpl_modification_flag[2]; ++ uint8_t no_output_of_prior_pics_flag; ++ uint8_t slice_temporal_mvp_enabled_flag; ++ ++ unsigned int nb_refs[2]; ++ ++ uint8_t slice_sample_adaptive_offset_flag[3]; ++ uint8_t mvd_l1_zero_flag; ++ ++ uint8_t cabac_init_flag; ++ uint8_t disable_deblocking_filter_flag; ///< slice_header_disable_deblocking_filter_flag ++ uint8_t slice_loop_filter_across_slices_enabled_flag; ++ uint8_t collocated_list; ++ ++ uint8_t no_dblk_boundary_flags; ++ ++ unsigned int collocated_ref_idx; ++ ++ int slice_qp_delta; ++ int slice_cb_qp_offset; // -12, +12 ++ int slice_cr_qp_offset; // -12, +12 ++ ++ uint8_t cu_chroma_qp_offset_enabled_flag; ++ ++ int beta_offset; ///< beta_offset_div2 * 2 ++ int tc_offset; ///< tc_offset_div2 * 2 ++ ++ unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand ++ ++ unsigned *entry_point_offset; ++ int * offset; ++ int * size; ++ int num_entry_point_offsets; ++ int offsets_allocated; ++ ++ uint8_t offload_wpp; ++ uint8_t offload_tiles; ++ ++ int8_t slice_qp; ++ ++ uint8_t luma_log2_weight_denom; ++ uint8_t chroma_log2_weight_denom; ++ ++ int16_t luma_weight_l0[16]; // -128, +255 ++ int16_t luma_offset_l0[16]; ++ int16_t chroma_weight_l0[16][2]; ++ int16_t chroma_offset_l0[16][2]; ++ ++ int16_t luma_weight_l1[16]; ++ int16_t luma_offset_l1[16]; ++ int16_t chroma_weight_l1[16][2]; ++ int16_t chroma_offset_l1[16][2]; ++ ++} RpiSliceHeader; ++ ++typedef struct HEVCRpiWindow { ++ uint16_t left_offset; ++ uint16_t right_offset; ++ uint16_t top_offset; ++ uint16_t bottom_offset; ++} HEVCRpiWindow; ++ ++typedef struct VUI { ++ AVRational sar; ++ ++ int overscan_info_present_flag; ++ int overscan_appropriate_flag; ++ ++ int video_signal_type_present_flag; ++ int video_format; ++ int video_full_range_flag; ++ int colour_description_present_flag; ++ uint8_t colour_primaries; ++ uint8_t transfer_characteristic; ++ uint8_t matrix_coeffs; ++ ++ int chroma_loc_info_present_flag; ++ int chroma_sample_loc_type_top_field; ++ int chroma_sample_loc_type_bottom_field; ++ int neutra_chroma_indication_flag; ++ ++ int field_seq_flag; ++ int frame_field_info_present_flag; ++ ++ int default_display_window_flag; ++ HEVCRpiWindow def_disp_win; ++ ++ int vui_timing_info_present_flag; ++ uint32_t vui_num_units_in_tick; ++ uint32_t vui_time_scale; ++ int vui_poc_proportional_to_timing_flag; ++ int vui_num_ticks_poc_diff_one_minus1; ++ int vui_hrd_parameters_present_flag; ++ ++ int bitstream_restriction_flag; ++ int tiles_fixed_structure_flag; ++ int motion_vectors_over_pic_boundaries_flag; ++ int restricted_ref_pic_lists_flag; ++ int min_spatial_segmentation_idc; ++ int max_bytes_per_pic_denom; ++ int max_bits_per_min_cu_denom; ++ int log2_max_mv_length_horizontal; ++ int log2_max_mv_length_vertical; ++} VUI; ++ ++typedef struct PTLCommon { ++ uint8_t profile_space; ++ uint8_t tier_flag; ++ uint8_t profile_idc; ++ uint8_t profile_compatibility_flag[32]; ++ uint8_t level_idc; ++ uint8_t progressive_source_flag; ++ uint8_t interlaced_source_flag; ++ uint8_t non_packed_constraint_flag; ++ uint8_t frame_only_constraint_flag; ++} PTLCommon; ++ ++typedef struct PTL { ++ PTLCommon general_ptl; ++ PTLCommon sub_layer_ptl[HEVC_MAX_SUB_LAYERS]; ++ ++ uint8_t sub_layer_profile_present_flag[HEVC_MAX_SUB_LAYERS]; ++ uint8_t sub_layer_level_present_flag[HEVC_MAX_SUB_LAYERS]; ++} PTL; ++ ++typedef struct HEVCRpiVPS { ++ uint8_t vps_temporal_id_nesting_flag; ++ int vps_max_layers; ++ int vps_max_sub_layers; ///< vps_max_temporal_layers_minus1 + 1 ++ ++ PTL ptl; ++ int vps_sub_layer_ordering_info_present_flag; ++ unsigned int vps_max_dec_pic_buffering[HEVC_MAX_SUB_LAYERS]; ++ unsigned int vps_num_reorder_pics[HEVC_MAX_SUB_LAYERS]; ++ unsigned int vps_max_latency_increase[HEVC_MAX_SUB_LAYERS]; ++ int vps_max_layer_id; ++ int vps_num_layer_sets; ///< vps_num_layer_sets_minus1 + 1 ++ uint8_t vps_timing_info_present_flag; ++ uint32_t vps_num_units_in_tick; ++ uint32_t vps_time_scale; ++ uint8_t vps_poc_proportional_to_timing_flag; ++ int vps_num_ticks_poc_diff_one; ///< vps_num_ticks_poc_diff_one_minus1 + 1 ++ int vps_num_hrd_parameters; ++ ++ uint8_t data[4096]; ++ int data_size; ++} HEVCRpiVPS; ++ ++typedef struct ScalingList { ++ /* This is a little wasteful, since sizeID 0 only needs 8 coeffs, ++ * and size ID 3 only has 2 arrays, not 6. */ ++ uint8_t sl[4][6][64]; ++ uint8_t sl_dc[2][6]; ++} ScalingList; ++ ++typedef struct HEVCRpiSPS { ++ unsigned vps_id; ++ uint8_t chroma_format_idc; ++ uint8_t separate_colour_plane_flag; ++ ++ HEVCRpiWindow output_window; ++ ++ HEVCRpiWindow pic_conf_win; ++ ++ uint16_t wp_offset_half_range; // WpOffsetHalfRange ++ ++ uint8_t bit_depth; ++ ++// int bit_depth_chroma; // We only support lum_bit_depth = chroma_bit_depth ++ uint8_t pixel_shift; ++ enum AVPixelFormat pix_fmt; ++ ++ unsigned int log2_max_poc_lsb; ++ ++ int max_sub_layers; ++ struct { ++ int max_dec_pic_buffering; ++ int num_reorder_pics; ++ int max_latency_increase; ++ } temporal_layer[HEVC_MAX_SUB_LAYERS]; ++ uint8_t temporal_id_nesting_flag; ++ ++ uint8_t scaling_list_enable_flag; ++ ScalingList scaling_list; ++ ++ unsigned int nb_st_rps; ++ ShortTermRPS st_rps[HEVC_MAX_SHORT_TERM_REF_PIC_SETS]; ++ ++ uint8_t amp_enabled_flag; ++ uint8_t sao_enabled; ++ ++ uint8_t long_term_ref_pics_present_flag; ++ uint16_t lt_ref_pic_poc_lsb_sps[HEVC_MAX_LONG_TERM_REF_PICS]; ++ uint8_t used_by_curr_pic_lt_sps_flag[HEVC_MAX_LONG_TERM_REF_PICS]; ++ uint8_t num_long_term_ref_pics_sps; ++ ++ struct { ++ uint8_t bit_depth; ++ uint8_t bit_depth_chroma; ++ uint8_t log2_min_pcm_cb_size; ++ uint8_t log2_max_pcm_cb_size; ++ uint8_t loop_filter_disable_flag; ++ } pcm; ++ char sps_temporal_mvp_enabled_flag; ++// char sps_strong_intra_smoothing_enable_flag; -> intra_filtes_disable ++ ++ uint8_t log2_min_cb_size; // 3..6 ++ uint8_t log2_diff_max_min_coding_block_size; ++ uint8_t log2_min_tb_size; // 2..5 ++ uint8_t log2_max_trafo_size; ++ uint8_t log2_ctb_size; // 4..6 ++// unsigned int log2_min_pu_size; // 2..5 (min_cb_size - 1) ++#define LOG2_MIN_PU_SIZE 2 ++#define LOG2_MIN_CU_SIZE 3 ++ ++ uint8_t max_transform_hierarchy_depth_inter; ++ uint8_t max_transform_hierarchy_depth_intra; ++ ++ char transform_skip_rotation_enabled_flag; ++ char transform_skip_context_enabled_flag; ++ char implicit_rdpcm_enabled_flag; ++ char explicit_rdpcm_enabled_flag; ++// char intra_smoothing_disabled_flag; -> intra_filtes_disable ++ char high_precision_offsets_enabled_flag; ++ char persistent_rice_adaptation_enabled_flag; ++ ++ uint8_t intra_filters_disable; ++ ++ ///< coded frame dimension in various units ++ int width; ++ int height; ++ int ctb_width; ++ int ctb_height; ++ int ctb_size; // Pic size in CTBs not size of a CTB ++ int min_cb_width; ++ int min_cb_height; ++ int min_tb_width; ++ int min_tb_height; ++ int min_pu_width; ++ int min_pu_height; ++ int pcm_width; ++ int pcm_height; ++ int tb_mask; ++ ++ int hshift[3]; ++ int vshift[3]; ++ ++ int qp_bd_offset; ++ ++ uint8_t data[4096]; ++ int data_size; ++ ++ VUI vui; ++ PTL ptl; ++} HEVCRpiSPS; ++ ++#define CTB_TS_FLAGS_SOTL (1U << 0) // X start of tile line ++#define CTB_TS_FLAGS_EOTL (1U << 1) // Last CTB of a tile line ++#define CTB_TS_FLAGS_EOL (1U << 2) // Last CTB of a complete line ++#define CTB_TS_FLAGS_EOT (1U << 3) // Last CTB of a tile ++#define CTB_TS_FLAGS_CSAVE (1U << 4) ++#define CTB_TS_FLAGS_CIREQ (1U << 5) // Cabac init request ++#define CTB_TS_FLAGS_TOT (1U << 6) // CTB on top row of a tile ++#define CTB_TS_FLAGS_CLOAD (1U << 7) ++ ++typedef struct HEVCRpiPPS { ++ unsigned int sps_id; ///< seq_parameter_set_id ++ ++ uint8_t sign_data_hiding_flag; ++ ++ uint8_t cabac_init_present_flag; ++ ++ int num_ref_idx_l0_default_active; ///< num_ref_idx_l0_default_active_minus1 + 1 ++ int num_ref_idx_l1_default_active; ///< num_ref_idx_l1_default_active_minus1 + 1 ++ int pic_init_qp_minus26; ++ ++ uint8_t constrained_intra_pred_flag; ++ uint8_t transform_skip_enabled_flag; ++ ++ uint8_t cu_qp_delta_enabled_flag; ++ uint8_t log2_min_cu_qp_delta_size; ++ int cb_qp_offset; // -12..12 ++ int cr_qp_offset; // -12..12 ++ const uint8_t * qp_dblk_x[3]; ++ const int8_t * qp_bd_x[3]; ++ ++ uint8_t pic_slice_level_chroma_qp_offsets_present_flag; ++ uint8_t weighted_pred_flag; ++ uint8_t weighted_bipred_flag; ++ uint8_t output_flag_present_flag; ++ uint8_t transquant_bypass_enable_flag; ++ ++ uint8_t dependent_slice_segments_enabled_flag; ++ uint8_t tiles_enabled_flag; ++ uint8_t entropy_coding_sync_enabled_flag; ++ ++ uint8_t tile_wpp_inter_disable; ++ int num_tile_columns; ///< num_tile_columns_minus1 + 1 ++ int num_tile_rows; ///< num_tile_rows_minus1 + 1 ++ uint8_t uniform_spacing_flag; ++ uint8_t loop_filter_across_tiles_enabled_flag; ++ ++ uint8_t seq_loop_filter_across_slices_enabled_flag; ++ ++ uint8_t deblocking_filter_control_present_flag; ++ uint8_t deblocking_filter_override_enabled_flag; ++ uint8_t disable_dbf; ++ int beta_offset; ///< beta_offset_div2 * 2 ++ int tc_offset; ///< tc_offset_div2 * 2 ++ ++ uint8_t scaling_list_data_present_flag; ++ ScalingList scaling_list; ++ ++ uint8_t lists_modification_present_flag; ++ int log2_parallel_merge_level; ///< log2_parallel_merge_level_minus2 + 2 ++ int num_extra_slice_header_bits; ++ uint8_t slice_header_extension_present_flag; ++ uint8_t log2_max_transform_skip_block_size; ++ uint8_t cross_component_prediction_enabled_flag; ++ uint8_t chroma_qp_offset_list_enabled_flag; ++ uint8_t diff_cu_chroma_qp_offset_depth; ++ uint8_t chroma_qp_offset_list_len_minus1; ++ int8_t cb_qp_offset_list[6]; ++ int8_t cr_qp_offset_list[6]; ++ uint8_t log2_sao_offset_scale_luma; ++ uint8_t log2_sao_offset_scale_chroma; ++ ++ // Inferred parameters ++ uint16_t *column_width; ///< ColumnWidth ++ uint16_t *row_height; ///< RowHeight ++ uint16_t *col_bd; ///< ColBd ++ uint16_t *row_bd; ///< RowBd ++ uint16_t *col_idxX; ++ ++ // We can limit these to uint16_t given our other size limits ++ uint16_t *ctb_addr_rs_to_ts; ///< CtbAddrRSToTS ++ uint16_t *ctb_addr_ts_to_rs; ///< CtbAddrTSToRS ++ uint16_t *tile_id; ///< TileId ++ uint16_t *tile_pos_ts; ///< TilePosRS ++ uint16_t *tile_size; ///< TileSize ++ uint8_t * ctb_ts_flags; ++ ++ uint8_t data[4096]; ++ int data_size; ++} HEVCRpiPPS; ++ ++typedef struct HEVCRpiParamSets { ++ /* currently active parameter sets */ ++ const HEVCRpiVPS *vps; ++ const HEVCRpiSPS *sps; ++ const HEVCRpiPPS *pps; ++ ++ AVBufferRef *vps_list[HEVC_MAX_VPS_COUNT]; ++ AVBufferRef *sps_list[HEVC_MAX_SPS_COUNT]; ++ AVBufferRef *pps_list[HEVC_MAX_PPS_COUNT]; ++} HEVCRpiParamSets; ++ ++int ff_hevc_rpi_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx, ++ HEVCRpiParamSets *ps); ++int ff_hevc_rpi_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, ++ HEVCRpiParamSets *ps, int apply_defdispwin); ++int ff_hevc_rpi_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, ++ HEVCRpiParamSets *ps); ++ ++int ff_hevc_rpi_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, ++ ShortTermRPS *rps, const HEVCRpiSPS *sps, int is_slice_header); ++ ++int ff_hevc_rpi_encode_nal_vps(HEVCRpiVPS *vps, unsigned int id, ++ uint8_t *buf, int buf_size); ++ ++/** ++ * Compute POC of the current frame and return it. ++ */ ++int ff_hevc_rpi_compute_poc(const HEVCRpiSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type); ++ ++#endif /* AVCODEC_RPI_HEVC_PS_H */ +--- /dev/null ++++ b/libavcodec/rpi_hevc_refs.c +@@ -0,0 +1,485 @@ ++/* ++ * HEVC video decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2012 - 2013 Gildas Cocherel ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/avassert.h" ++#include "libavutil/pixdesc.h" ++#include "libavutil/rpi_sand_fns.h" ++#include "internal.h" ++#include "thread.h" ++#include "hevc.h" ++#include "rpi_hevcdec.h" ++ ++void ff_hevc_rpi_unref_frame(HEVCRpiContext *s, HEVCRpiFrame *frame, int flags) ++{ ++ /* frame->frame can be NULL if context init failed */ ++ if (!frame->frame || !frame->frame->buf[0]) ++ return; ++ ++ frame->flags &= ~flags; ++ if (!frame->flags) { ++ ff_thread_release_buffer(s->avctx, &frame->tf); ++ ++ av_buffer_unref(&frame->col_mvf_buf); // OK if already NULL ++ frame->col_mvf = NULL; ++ ++ frame->collocated_ref = NULL; ++ } ++} ++ ++void ff_hevc_rpi_clear_refs(HEVCRpiContext *s) ++{ ++ int i; ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) ++ ff_hevc_rpi_unref_frame(s, &s->DPB[i], ++ HEVC_FRAME_FLAG_SHORT_REF | ++ HEVC_FRAME_FLAG_LONG_REF); ++} ++ ++void ff_hevc_rpi_flush_dpb(HEVCRpiContext *s) ++{ ++ int i; ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) ++ ff_hevc_rpi_unref_frame(s, &s->DPB[i], ~0); ++} ++ ++static HEVCRpiFrame *alloc_frame(HEVCRpiContext * const s) ++{ ++ int i, ret; ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame * const frame = &s->DPB[i]; ++ if (frame->frame->buf[0]) ++ continue; ++ ++ ret = ff_thread_get_buffer(s->avctx, &frame->tf, ++ AV_GET_BUFFER_FLAG_REF); ++ if (ret < 0) ++ return NULL; ++ ++ frame->col_mvf = NULL; ++ frame->col_mvf_buf = NULL; ++ if (s->used_for_ref && !s->is_irap) ++ { ++ frame->col_mvf_buf = av_buffer_pool_get(s->col_mvf_pool); ++ if (!frame->col_mvf_buf) ++ goto fail; ++ frame->col_mvf = (ColMvField *)frame->col_mvf_buf->data; ++ } ++ ++ frame->frame->top_field_first = s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD; ++ frame->frame->interlaced_frame = (s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_TOP_FIELD) || (s->sei.picture_timing.picture_struct == AV_PICTURE_STRUCTURE_BOTTOM_FIELD); ++ ++ return frame; ++ ++fail: ++ ff_hevc_rpi_unref_frame(s, frame, ~0); ++ return NULL; ++ } ++ av_log(s->avctx, AV_LOG_ERROR, "Error allocating frame, DPB full.\n"); ++ return NULL; ++} ++ ++int ff_hevc_rpi_set_new_ref(HEVCRpiContext *s, AVFrame **frame, int poc) ++{ ++ HEVCRpiFrame *ref; ++ int i; ++ ++ /* check that this POC doesn't already exist */ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *frame = &s->DPB[i]; ++ ++ if (frame->frame->buf[0] && frame->sequence == s->seq_decode && ++ frame->poc == poc) { ++ av_log(s->avctx, AV_LOG_ERROR, "Duplicate POC in a sequence: %d.\n", ++ poc); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ ref = alloc_frame(s); ++ if (!ref) ++ return AVERROR(ENOMEM); ++ ++ *frame = ref->frame; ++ s->ref = ref; ++ ++ if (s->sh.pic_output_flag) ++ ref->flags = HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_SHORT_REF; ++ else ++ ref->flags = HEVC_FRAME_FLAG_SHORT_REF; ++ ++ ref->poc = poc; ++ ref->sequence = s->seq_decode; ++ ref->frame->crop_left = s->ps.sps->output_window.left_offset; ++ ref->frame->crop_right = s->ps.sps->output_window.right_offset; ++ ref->frame->crop_top = s->ps.sps->output_window.top_offset; ++ ref->frame->crop_bottom = s->ps.sps->output_window.bottom_offset; ++ ++ return 0; ++} ++ ++int ff_hevc_rpi_output_frame(HEVCRpiContext *s, AVFrame *out, int flush) ++{ ++ do { ++ int nb_output = 0; ++ int min_poc = INT_MAX; ++ int i, min_idx, ret; ++ ++ if (s->sh.no_output_of_prior_pics_flag == 1 && s->no_rasl_output_flag == 1) { ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *frame = &s->DPB[i]; ++ if (!(frame->flags & HEVC_FRAME_FLAG_BUMPING) && frame->poc != s->poc && ++ frame->sequence == s->seq_output) { ++ ff_hevc_rpi_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT); ++ } ++ } ++ } ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *frame = &s->DPB[i]; ++ if ((frame->flags & HEVC_FRAME_FLAG_OUTPUT) && ++ frame->sequence == s->seq_output) { ++ nb_output++; ++ if (frame->poc < min_poc || nb_output == 1) { ++ min_poc = frame->poc; ++ min_idx = i; ++ } ++ } ++ } ++ ++ /* wait for more frames before output */ ++ if (!flush && s->seq_output == s->seq_decode && s->ps.sps && ++ nb_output <= s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].num_reorder_pics) ++ return 0; ++ ++ if (nb_output) { ++ HEVCRpiFrame *frame = &s->DPB[min_idx]; ++ if (frame->frame->format == AV_PIX_FMT_VIDEOTOOLBOX && frame->frame->buf[0]->size == 1) ++ return 0; ++ ++ ret = av_frame_ref(out, frame->frame); ++ if (frame->flags & HEVC_FRAME_FLAG_BUMPING) ++ ff_hevc_rpi_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT | HEVC_FRAME_FLAG_BUMPING); ++ else ++ ff_hevc_rpi_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT); ++ if (ret < 0) ++ return ret; ++ av_log(s->avctx, AV_LOG_DEBUG, ++ "Output frame with POC %d.\n", frame->poc); ++ return 1; ++ } ++ ++ if (s->seq_output != s->seq_decode) ++ s->seq_output = (s->seq_output + 1) & 0xff; ++ else ++ break; ++ } while (1); ++ ++ return 0; ++} ++ ++void ff_hevc_rpi_bump_frame(HEVCRpiContext *s) ++{ ++ int dpb = 0; ++ int min_poc = INT_MAX; ++ int i; ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *frame = &s->DPB[i]; ++ if ((frame->flags) && ++ frame->sequence == s->seq_output && ++ frame->poc != s->poc) { ++ dpb++; ++ } ++ } ++ ++ if (s->ps.sps && dpb >= s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].max_dec_pic_buffering) { ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *frame = &s->DPB[i]; ++ if ((frame->flags) && ++ frame->sequence == s->seq_output && ++ frame->poc != s->poc) { ++ if (frame->flags == HEVC_FRAME_FLAG_OUTPUT && frame->poc < min_poc) { ++ min_poc = frame->poc; ++ } ++ } ++ } ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *frame = &s->DPB[i]; ++ if (frame->flags & HEVC_FRAME_FLAG_OUTPUT && ++ frame->sequence == s->seq_output && ++ frame->poc <= min_poc) { ++ frame->flags |= HEVC_FRAME_FLAG_BUMPING; ++ } ++ } ++ ++ dpb--; ++ } ++} ++ ++static int init_slice_rpl(HEVCRpiContext *s) ++{ ++ if (s->slice_idx >= s->rpl_tab_size) ++ return AVERROR_INVALIDDATA; ++ ++ s->refPicList = s->rpl_tab[s->slice_idx].refPicList + 0; ++ return 0; ++} ++ ++int ff_hevc_rpi_slice_rpl(HEVCRpiContext *s) ++{ ++ RpiSliceHeader *sh = &s->sh; ++ ++ uint8_t nb_list = sh->slice_type == HEVC_SLICE_B ? 2 : 1; ++ uint8_t list_idx; ++ int i, j, ret; ++ ++ ret = init_slice_rpl(s); ++ if (ret < 0) ++ return ret; ++ ++ if (!(s->rps[ST_CURR_BEF].nb_refs + s->rps[ST_CURR_AFT].nb_refs + ++ s->rps[LT_CURR].nb_refs)) { ++ av_log(s->avctx, AV_LOG_ERROR, "Zero refs in the frame RPS.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ for (list_idx = 0; list_idx < nb_list; list_idx++) { ++ RefPicList rpl_tmp = { { 0 } }; ++ RefPicList *rpl = &s->refPicList[list_idx]; ++ ++ /* The order of the elements is ++ * ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and ++ * ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1 */ ++ int cand_lists[3] = { list_idx ? ST_CURR_AFT : ST_CURR_BEF, ++ list_idx ? ST_CURR_BEF : ST_CURR_AFT, ++ LT_CURR }; ++ ++ /* concatenate the candidate lists for the current frame */ ++ while (rpl_tmp.nb_refs < sh->nb_refs[list_idx]) { ++ for (i = 0; i < FF_ARRAY_ELEMS(cand_lists); i++) { ++ RefPicList *rps = &s->rps[cand_lists[i]]; ++ for (j = 0; j < rps->nb_refs && rpl_tmp.nb_refs < HEVC_MAX_REFS; j++) { ++ rpl_tmp.list[rpl_tmp.nb_refs] = rps->list[j]; ++ rpl_tmp.ref[rpl_tmp.nb_refs] = rps->ref[j]; ++ rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = i == 2; ++ rpl_tmp.nb_refs++; ++ } ++ } ++ } ++ ++ /* reorder the references if necessary */ ++ if (sh->rpl_modification_flag[list_idx]) { ++ for (i = 0; i < sh->nb_refs[list_idx]; i++) { ++ int idx = sh->list_entry_lx[list_idx][i]; ++ ++ if (idx >= rpl_tmp.nb_refs) { ++ av_log(s->avctx, AV_LOG_ERROR, "Invalid reference index.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ rpl->list[i] = rpl_tmp.list[idx]; ++ rpl->ref[i] = rpl_tmp.ref[idx]; ++ rpl->isLongTerm[i] = rpl_tmp.isLongTerm[idx]; ++ rpl->nb_refs++; ++ } ++ } else { ++ memcpy(rpl, &rpl_tmp, sizeof(*rpl)); ++ rpl->nb_refs = FFMIN(rpl->nb_refs, sh->nb_refs[list_idx]); ++ } ++ ++ if (sh->collocated_list == list_idx && ++ sh->collocated_ref_idx < rpl->nb_refs) ++ s->ref->collocated_ref = rpl->ref[sh->collocated_ref_idx]; ++ } ++ ++ return 0; ++} ++ ++static HEVCRpiFrame *find_ref_idx(HEVCRpiContext *s, int poc) ++{ ++ int i; ++ int LtMask = (1 << s->ps.sps->log2_max_poc_lsb) - 1; ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *ref = &s->DPB[i]; ++ if (ref->frame->buf[0] && (ref->sequence == s->seq_decode)) { ++ if ((ref->poc & LtMask) == poc) ++ return ref; ++ } ++ } ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *ref = &s->DPB[i]; ++ if (ref->frame->buf[0] && ref->sequence == s->seq_decode) { ++ if (ref->poc == poc || (ref->poc & LtMask) == poc) ++ return ref; ++ } ++ } ++ ++ if (s->nal_unit_type != HEVC_NAL_CRA_NUT && !IS_BLA(s)) ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Could not find ref with POC %d\n", poc); ++ return NULL; ++} ++ ++static void mark_ref(HEVCRpiFrame *frame, int flag) ++{ ++ frame->flags &= ~(HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF); ++ frame->flags |= flag; ++} ++ ++static HEVCRpiFrame *generate_missing_ref(HEVCRpiContext *s, int poc) ++{ ++ HEVCRpiFrame *frame; ++ int i, x, y; ++ ++ frame = alloc_frame(s); ++ if (!frame) ++ return NULL; ++ ++ if (!s->ps.sps->pixel_shift) { ++ for (i = 0; frame->frame->buf[i]; i++) ++ memset(frame->frame->buf[i]->data, 1 << (s->ps.sps->bit_depth - 1), ++ frame->frame->buf[i]->size); ++ } else { ++ for (i = 0; frame->frame->data[i]; i++) ++ for (y = 0; y < (s->ps.sps->height >> s->ps.sps->vshift[i]); y++) ++ for (x = 0; x < (s->ps.sps->width >> s->ps.sps->hshift[i]); x++) { ++ AV_WN16(frame->frame->data[i] + y * frame_stride1(frame->frame, 1) + 2 * x, ++ 1 << (s->ps.sps->bit_depth - 1)); ++ } ++ } ++ ++ frame->poc = poc; ++ frame->sequence = s->seq_decode; ++ frame->flags = 0; ++ ++ ff_hevc_rpi_progress_set_all_done(frame); ++ ++ return frame; ++} ++ ++/* add a reference with the given poc to the list and mark it as used in DPB */ ++static int add_candidate_ref(HEVCRpiContext *s, RefPicList *list, ++ int poc, int ref_flag) ++{ ++ HEVCRpiFrame *ref = find_ref_idx(s, poc); ++ ++ if (ref == s->ref || list->nb_refs >= HEVC_MAX_REFS) ++ return AVERROR_INVALIDDATA; ++ ++ if (!ref) { ++ ref = generate_missing_ref(s, poc); ++ if (!ref) ++ return AVERROR(ENOMEM); ++ } ++ ++ list->list[list->nb_refs] = ref->poc; ++ list->ref[list->nb_refs] = ref; ++ list->nb_refs++; ++ ++ mark_ref(ref, ref_flag); ++ return 0; ++} ++ ++int ff_hevc_rpi_frame_rps(HEVCRpiContext *s) ++{ ++ const ShortTermRPS *short_rps = s->sh.short_term_rps; ++ const LongTermRPS *long_rps = &s->sh.long_term_rps; ++ RefPicList *rps = s->rps; ++ int i, ret = 0; ++ ++ if (!short_rps) { ++ rps[0].nb_refs = rps[1].nb_refs = 0; ++ return 0; ++ } ++ ++ /* clear the reference flags on all frames except the current one */ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ HEVCRpiFrame *frame = &s->DPB[i]; ++ ++ if (frame == s->ref) ++ continue; ++ ++ mark_ref(frame, 0); ++ } ++ ++ for (i = 0; i < NB_RPS_TYPE; i++) ++ rps[i].nb_refs = 0; ++ ++ /* add the short refs */ ++ for (i = 0; i < short_rps->num_delta_pocs; i++) { ++ int poc = s->poc + short_rps->delta_poc[i]; ++ int list; ++ ++ if (!short_rps->used[i]) ++ list = ST_FOLL; ++ else if (i < short_rps->num_negative_pics) ++ list = ST_CURR_BEF; ++ else ++ list = ST_CURR_AFT; ++ ++ ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_SHORT_REF); ++ if (ret < 0) ++ goto fail; ++ } ++ ++ /* add the long refs */ ++ for (i = 0; i < long_rps->nb_refs; i++) { ++ int poc = long_rps->poc[i]; ++ int list = long_rps->used[i] ? LT_CURR : LT_FOLL; ++ ++ ret = add_candidate_ref(s, &rps[list], poc, HEVC_FRAME_FLAG_LONG_REF); ++ if (ret < 0) ++ goto fail; ++ } ++ ++fail: ++ /* release any frames that are now unused */ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) ++ ff_hevc_rpi_unref_frame(s, &s->DPB[i], 0); ++ ++ return ret; ++} ++ ++int ff_hevc_rpi_frame_nb_refs(HEVCRpiContext *s) ++{ ++ int ret = 0; ++ int i; ++ const ShortTermRPS *rps = s->sh.short_term_rps; ++ LongTermRPS *long_rps = &s->sh.long_term_rps; ++ ++ if (rps) { ++ for (i = 0; i < rps->num_negative_pics; i++) ++ ret += !!rps->used[i]; ++ for (; i < rps->num_delta_pocs; i++) ++ ret += !!rps->used[i]; ++ } ++ ++ if (long_rps) { ++ for (i = 0; i < long_rps->nb_refs; i++) ++ ret += !!long_rps->used[i]; ++ } ++ return ret; ++} +--- /dev/null ++++ b/libavcodec/rpi_hevc_sei.c +@@ -0,0 +1,368 @@ ++/* ++ * HEVC Supplementary Enhancement Information messages ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2012 - 2013 Gildas Cocherel ++ * Copyright (C) 2013 Vittorio Giovara ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "golomb.h" ++#include "rpi_hevc_ps.h" ++#include "rpi_hevc_sei.h" ++ ++static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, GetBitContext *gb) ++{ ++ int cIdx, i; ++ uint8_t hash_type; ++ //uint16_t picture_crc; ++ //uint32_t picture_checksum; ++ hash_type = get_bits(gb, 8); ++ ++ for (cIdx = 0; cIdx < 3/*((s->sps->chroma_format_idc == 0) ? 1 : 3)*/; cIdx++) { ++ if (hash_type == 0) { ++ s->is_md5 = 1; ++ for (i = 0; i < 16; i++) ++ s->md5[cIdx][i] = get_bits(gb, 8); ++ } else if (hash_type == 1) { ++ // picture_crc = get_bits(gb, 16); ++ skip_bits(gb, 16); ++ } else if (hash_type == 2) { ++ // picture_checksum = get_bits_long(gb, 32); ++ skip_bits(gb, 32); ++ } ++ } ++ return 0; ++} ++ ++static int decode_nal_sei_mastering_display_info(HEVCSEIMasteringDisplay *s, GetBitContext *gb) ++{ ++ int i; ++ // Mastering primaries ++ for (i = 0; i < 3; i++) { ++ s->display_primaries[i][0] = get_bits(gb, 16); ++ s->display_primaries[i][1] = get_bits(gb, 16); ++ } ++ // White point (x, y) ++ s->white_point[0] = get_bits(gb, 16); ++ s->white_point[1] = get_bits(gb, 16); ++ ++ // Max and min luminance of mastering display ++ s->max_luminance = get_bits_long(gb, 32); ++ s->min_luminance = get_bits_long(gb, 32); ++ ++ // As this SEI message comes before the first frame that references it, ++ // initialize the flag to 2 and decrement on IRAP access unit so it ++ // persists for the coded video sequence (e.g., between two IRAPs) ++ s->present = 2; ++ return 0; ++} ++ ++static int decode_nal_sei_content_light_info(HEVCSEIContentLight *s, GetBitContext *gb) ++{ ++ // Max and average light levels ++ s->max_content_light_level = get_bits_long(gb, 16); ++ s->max_pic_average_light_level = get_bits_long(gb, 16); ++ // As this SEI message comes before the first frame that references it, ++ // initialize the flag to 2 and decrement on IRAP access unit so it ++ // persists for the coded video sequence (e.g., between two IRAPs) ++ s->present = 2; ++ return 0; ++} ++ ++static int decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking *s, GetBitContext *gb) ++{ ++ get_ue_golomb_long(gb); // frame_packing_arrangement_id ++ s->present = !get_bits1(gb); ++ ++ if (s->present) { ++ s->arrangement_type = get_bits(gb, 7); ++ s->quincunx_subsampling = get_bits1(gb); ++ s->content_interpretation_type = get_bits(gb, 6); ++ ++ // spatial_flipping_flag, frame0_flipped_flag, field_views_flag ++ skip_bits(gb, 3); ++ s->current_frame_is_frame0_flag = get_bits1(gb); ++ // frame0_self_contained_flag, frame1_self_contained_flag ++ skip_bits(gb, 2); ++ ++ if (!s->quincunx_subsampling && s->arrangement_type != 5) ++ skip_bits(gb, 16); // frame[01]_grid_position_[xy] ++ skip_bits(gb, 8); // frame_packing_arrangement_reserved_byte ++ skip_bits1(gb); // frame_packing_arrangement_persistence_flag ++ } ++ skip_bits1(gb); // upsampled_aspect_ratio_flag ++ return 0; ++} ++ ++static int decode_nal_sei_display_orientation(HEVCSEIDisplayOrientation *s, GetBitContext *gb) ++{ ++ s->present = !get_bits1(gb); ++ ++ if (s->present) { ++ s->hflip = get_bits1(gb); // hor_flip ++ s->vflip = get_bits1(gb); // ver_flip ++ ++ s->anticlockwise_rotation = get_bits(gb, 16); ++ skip_bits1(gb); // display_orientation_persistence_flag ++ } ++ ++ return 0; ++} ++ ++static int decode_nal_sei_pic_timing(HEVCSEIContext *s, GetBitContext *gb, const HEVCRpiParamSets *ps, ++ void *logctx, int size) ++{ ++ HEVCSEIPictureTiming *h = &s->picture_timing; ++ HEVCRpiSPS *sps; ++ ++ if (!ps->sps_list[s->active_seq_parameter_set_id]) ++ return(AVERROR(ENOMEM)); ++ sps = (HEVCRpiSPS*)ps->sps_list[s->active_seq_parameter_set_id]->data; ++ ++ if (sps->vui.frame_field_info_present_flag) { ++ int pic_struct = get_bits(gb, 4); ++ h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN; ++ if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) { ++ av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n"); ++ h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; ++ } else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) { ++ av_log(logctx, AV_LOG_DEBUG, "TOP Field\n"); ++ h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD; ++ } ++ get_bits(gb, 2); // source_scan_type ++ get_bits(gb, 1); // duplicate_flag ++ skip_bits1(gb); ++ size--; ++ } ++ skip_bits_long(gb, 8 * size); ++ ++ return 0; ++} ++ ++static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetBitContext *gb, ++ int size) ++{ ++ int flag; ++ int user_data_type_code; ++ int cc_count; ++ ++ if (size < 3) ++ return AVERROR(EINVAL); ++ ++ user_data_type_code = get_bits(gb, 8); ++ if (user_data_type_code == 0x3) { ++ skip_bits(gb, 1); // reserved ++ ++ flag = get_bits(gb, 1); // process_cc_data_flag ++ if (flag) { ++ skip_bits(gb, 1); ++ cc_count = get_bits(gb, 5); ++ skip_bits(gb, 8); // reserved ++ size -= 2; ++ ++ if (cc_count && size >= cc_count * 3) { ++ const uint64_t new_size = (s->a53_caption_size + cc_count ++ * UINT64_C(3)); ++ int i, ret; ++ ++ if (new_size > INT_MAX) ++ return AVERROR(EINVAL); ++ ++ /* Allow merging of the cc data from two fields. */ ++ ret = av_reallocp(&s->a53_caption, new_size); ++ if (ret < 0) ++ return ret; ++ ++ for (i = 0; i < cc_count; i++) { ++ s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); ++ s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); ++ s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8); ++ } ++ skip_bits(gb, 8); // marker_bits ++ } ++ } ++ } else { ++ int i; ++ for (i = 0; i < size - 1; i++) ++ skip_bits(gb, 8); ++ } ++ ++ return 0; ++} ++ ++static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEIContext *s, GetBitContext *gb, ++ int size) ++{ ++ uint32_t country_code; ++ uint32_t user_identifier; ++ ++ if (size < 7) ++ return AVERROR(EINVAL); ++ size -= 7; ++ ++ country_code = get_bits(gb, 8); ++ if (country_code == 0xFF) { ++ skip_bits(gb, 8); ++ size--; ++ } ++ ++ skip_bits(gb, 8); ++ skip_bits(gb, 8); ++ ++ user_identifier = get_bits_long(gb, 32); ++ ++ switch (user_identifier) { ++ case MKBETAG('G', 'A', '9', '4'): ++ return decode_registered_user_data_closed_caption(&s->a53_caption, gb, size); ++ default: ++ skip_bits_long(gb, size * 8); ++ break; ++ } ++ return 0; ++} ++ ++static int decode_nal_sei_active_parameter_sets(HEVCSEIContext *s, GetBitContext *gb, void *logctx) ++{ ++ int num_sps_ids_minus1; ++ int i; ++ unsigned active_seq_parameter_set_id; ++ ++ get_bits(gb, 4); // active_video_parameter_set_id ++ get_bits(gb, 1); // self_contained_cvs_flag ++ get_bits(gb, 1); // num_sps_ids_minus1 ++ num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1 ++ ++ if (num_sps_ids_minus1 < 0 || num_sps_ids_minus1 > 15) { ++ av_log(logctx, AV_LOG_ERROR, "num_sps_ids_minus1 %d invalid\n", num_sps_ids_minus1); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ active_seq_parameter_set_id = get_ue_golomb_long(gb); ++ if (active_seq_parameter_set_id >= HEVC_MAX_SPS_COUNT) { ++ av_log(logctx, AV_LOG_ERROR, "active_parameter_set_id %d invalid\n", active_seq_parameter_set_id); ++ return AVERROR_INVALIDDATA; ++ } ++ s->active_seq_parameter_set_id = active_seq_parameter_set_id; ++ ++ for (i = 1; i <= num_sps_ids_minus1; i++) ++ get_ue_golomb_long(gb); // active_seq_parameter_set_id[i] ++ ++ return 0; ++} ++ ++static int decode_nal_sei_alternative_transfer(HEVCSEIAlternativeTransfer *s, GetBitContext *gb) ++{ ++ s->present = 1; ++ s->preferred_transfer_characteristics = get_bits(gb, 8); ++ return 0; ++} ++ ++static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEIContext *s, const HEVCRpiParamSets *ps, ++ int type, int size) ++{ ++ switch (type) { ++ case 256: // Mismatched value from HM 8.1 ++ return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb); ++ case HEVC_SEI_TYPE_FRAME_PACKING: ++ return decode_nal_sei_frame_packing_arrangement(&s->frame_packing, gb); ++ case HEVC_SEI_TYPE_DISPLAY_ORIENTATION: ++ return decode_nal_sei_display_orientation(&s->display_orientation, gb); ++ case HEVC_SEI_TYPE_PICTURE_TIMING: ++ return decode_nal_sei_pic_timing(s, gb, ps, logctx, size); ++ case HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO: ++ return decode_nal_sei_mastering_display_info(&s->mastering_display, gb); ++ case HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO: ++ return decode_nal_sei_content_light_info(&s->content_light, gb); ++ case HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS: ++ return decode_nal_sei_active_parameter_sets(s, gb, logctx); ++ case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35: ++ return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size); ++ case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS: ++ return decode_nal_sei_alternative_transfer(&s->alternative_transfer, gb); ++ default: ++ av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type); ++ skip_bits_long(gb, 8 * size); ++ return 0; ++ } ++} ++ ++static int decode_nal_sei_suffix(GetBitContext *gb, void *logctx, HEVCSEIContext *s, ++ int type, int size) ++{ ++ switch (type) { ++ case HEVC_SEI_TYPE_DECODED_PICTURE_HASH: ++ return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb); ++ default: ++ av_log(logctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", type); ++ skip_bits_long(gb, 8 * size); ++ return 0; ++ } ++} ++ ++static int decode_nal_sei_message(GetBitContext * const gb, void * const logctx, HEVCSEIContext * const s, ++ const HEVCRpiParamSets * const ps, const int nal_unit_type) ++{ ++ int payload_type = 0; ++ int payload_size = 0; ++ int byte = 0xFF; ++ av_log(logctx, AV_LOG_DEBUG, "Decoding SEI\n"); ++ ++ while (byte == 0xFF) { ++ if (get_bits_left(gb) < 16 || payload_type > INT_MAX - 255) ++ return AVERROR_INVALIDDATA; ++ byte = get_bits(gb, 8); ++ payload_type += byte; ++ } ++ byte = 0xFF; ++ while (byte == 0xFF) { ++ if (get_bits_left(gb) < 8 + 8LL*payload_size) ++ return AVERROR_INVALIDDATA; ++ byte = get_bits(gb, 8); ++ payload_size += byte; ++ } ++ if (nal_unit_type == HEVC_NAL_SEI_PREFIX) { ++ return decode_nal_sei_prefix(gb, logctx, s, ps, payload_type, payload_size); ++ } else { /* nal_unit_type == NAL_SEI_SUFFIX */ ++ return decode_nal_sei_suffix(gb, logctx, s, payload_type, payload_size); ++ } ++} ++ ++static int more_rbsp_data(GetBitContext *gb) ++{ ++ return get_bits_left(gb) > 0 && show_bits(gb, 8) != 0x80; ++} ++ ++int ff_hevc_rpi_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEIContext *s, ++ const HEVCRpiParamSets *ps, int type) ++{ ++ int ret; ++ ++ do { ++ ret = decode_nal_sei_message(gb, logctx, s, ps, type); ++ if (ret < 0) ++ return ret; ++ } while (more_rbsp_data(gb)); ++ return 1; ++} ++ ++void ff_hevc_rpi_reset_sei(HEVCSEIContext *s) ++{ ++ s->a53_caption.a53_caption_size = 0; ++ av_freep(&s->a53_caption.a53_caption); ++} +--- /dev/null ++++ b/libavcodec/rpi_hevc_sei.h +@@ -0,0 +1,135 @@ ++/* ++ * HEVC Supplementary Enhancement Information messages ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_RPI_HEVC_SEI_H ++#define AVCODEC_RPI_HEVC_SEI_H ++ ++#include ++ ++#include "libavutil/md5.h" ++ ++#include "get_bits.h" ++ ++/** ++ * SEI message types ++ */ ++typedef enum { ++ HEVC_SEI_TYPE_BUFFERING_PERIOD = 0, ++ HEVC_SEI_TYPE_PICTURE_TIMING = 1, ++ HEVC_SEI_TYPE_PAN_SCAN_RECT = 2, ++ HEVC_SEI_TYPE_FILLER_PAYLOAD = 3, ++ HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35 = 4, ++ HEVC_SEI_TYPE_USER_DATA_UNREGISTERED = 5, ++ HEVC_SEI_TYPE_RECOVERY_POINT = 6, ++ HEVC_SEI_TYPE_SCENE_INFO = 9, ++ HEVC_SEI_TYPE_FULL_FRAME_SNAPSHOT = 15, ++ HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_START = 16, ++ HEVC_SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_END = 17, ++ HEVC_SEI_TYPE_FILM_GRAIN_CHARACTERISTICS = 19, ++ HEVC_SEI_TYPE_POST_FILTER_HINT = 22, ++ HEVC_SEI_TYPE_TONE_MAPPING_INFO = 23, ++ HEVC_SEI_TYPE_FRAME_PACKING = 45, ++ HEVC_SEI_TYPE_DISPLAY_ORIENTATION = 47, ++ HEVC_SEI_TYPE_SOP_DESCRIPTION = 128, ++ HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS = 129, ++ HEVC_SEI_TYPE_DECODING_UNIT_INFO = 130, ++ HEVC_SEI_TYPE_TEMPORAL_LEVEL0_INDEX = 131, ++ HEVC_SEI_TYPE_DECODED_PICTURE_HASH = 132, ++ HEVC_SEI_TYPE_SCALABLE_NESTING = 133, ++ HEVC_SEI_TYPE_REGION_REFRESH_INFO = 134, ++ HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO = 137, ++ HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO = 144, ++ HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147, ++} HEVC_SEI_Type; ++ ++typedef struct HEVCSEIPictureHash { ++ uint8_t md5[3][16]; ++ uint8_t is_md5; ++} HEVCSEIPictureHash; ++ ++typedef struct HEVCSEIFramePacking { ++ int present; ++ int arrangement_type; ++ int content_interpretation_type; ++ int quincunx_subsampling; ++ int current_frame_is_frame0_flag; ++} HEVCSEIFramePacking; ++ ++typedef struct HEVCSEIDisplayOrientation { ++ int present; ++ int anticlockwise_rotation; ++ int hflip, vflip; ++} HEVCSEIDisplayOrientation; ++ ++typedef struct HEVCSEIPictureTiming { ++ int picture_struct; ++} HEVCSEIPictureTiming; ++ ++typedef struct HEVCSEIA53Caption { ++ int a53_caption_size; ++ uint8_t *a53_caption; ++} HEVCSEIA53Caption; ++ ++typedef struct HEVCSEIMasteringDisplay { ++ int present; ++ uint16_t display_primaries[3][2]; ++ uint16_t white_point[2]; ++ uint32_t max_luminance; ++ uint32_t min_luminance; ++} HEVCSEIMasteringDisplay; ++ ++typedef struct HEVCSEIContentLight { ++ int present; ++ uint16_t max_content_light_level; ++ uint16_t max_pic_average_light_level; ++} HEVCSEIContentLight; ++ ++typedef struct HEVCSEIAlternativeTransfer { ++ int present; ++ int preferred_transfer_characteristics; ++} HEVCSEIAlternativeTransfer; ++ ++typedef struct HEVCSEIContext { ++ HEVCSEIPictureHash picture_hash; ++ HEVCSEIFramePacking frame_packing; ++ HEVCSEIDisplayOrientation display_orientation; ++ HEVCSEIPictureTiming picture_timing; ++ HEVCSEIA53Caption a53_caption; ++ HEVCSEIMasteringDisplay mastering_display; ++ HEVCSEIContentLight content_light; ++ int active_seq_parameter_set_id; ++ HEVCSEIAlternativeTransfer alternative_transfer; ++} HEVCSEIContext; ++ ++struct HEVCRpiParamSets; ++ ++int ff_hevc_rpi_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEIContext *s, ++ const struct HEVCRpiParamSets *ps, int type); ++ ++/** ++ * Reset SEI values that are stored on the Context. ++ * e.g. Caption data that was extracted during NAL ++ * parsing. ++ * ++ * @param s HEVCRpiContext. ++ */ ++void ff_hevc_rpi_reset_sei(HEVCSEIContext *s); ++ ++#endif /* AVCODEC_RPI_HEVC_SEI_H */ +--- /dev/null ++++ b/libavcodec/rpi_hevc_shader.c +@@ -0,0 +1,1537 @@ ++#include "rpi_hevc_shader.h" ++ ++#ifdef _MSC_VER ++ #include ++ /* cast through uintptr_t to avoid warnings */ ++ #define POINTER_TO_UINT(X) ((unsigned int)(uintptr_t)(X)) ++#else ++ #define POINTER_TO_UINT(X) ((unsigned int)(X)) ++#endif ++ ++#ifdef __cplusplus ++extern "C" { /* the types are probably wrong... */ ++#endif ++#ifdef __cplusplus ++} ++#endif ++ ++#ifdef _MSC_VER ++__declspec(align(8)) ++#elif defined(__GNUC__) ++__attribute__((aligned(8))) ++#endif ++unsigned int ff_hevc_rpi_shader[] = { ++// ::mc_setup_c_q0 ++// ::mc_start ++/* [0x00000000] */ 0x0000000c, 0xe80009e7, // mov dst, srel(i) ++// ::mc_setup_c_qn ++/* [0x00000008] */ 0x95801ff6, 0xd0025900, // mov tmurs, 1 ; mov ra0, unif ++/* [0x00000010] */ 0xaaaaff00, 0xe6020827, // mov r0, [0,2,0,2,0,2,0,2,1,3,1,3,1,3,1,3] ++/* [0x00000018] */ 0x9181e1f6, 0xd00250d8, // shl rb_ef, r0, i_shift30 ; mov ra_base, unif ++/* [0x00000020] */ 0x0d801dc0, 0xd0020827, // sub r0, unif, 1 ++/* [0x00000028] */ 0x119c11c0, 0xd00216a7, // shl rb_max_x, r0, v_x_shift ++/* [0x00000030] */ 0x0d801dc0, 0xd00217a7, // sub rb_max_y, unif, 1 ++/* [0x00000038] */ 0xff800100, 0xe0020527, // mov ra_kff800100, 0xff800100 ++/* [0x00000040] */ 0x000000ff, 0xe0021627, // mov rb_pmask, v_pmask ++/* [0x00000048] */ 0x001000ff, 0xe00205e7, // mov ra_blk_height_pmax, ((1 << v_bit_depth) - 1) | (v_blk_height << 16) ++/* [0x00000050] */ 0x00004000, 0xe00217e7, // mov rb_fir_off_h, (FIR_OFFSET << (v_bit_depth - 8)) ++/* [0x00000058] */ 0x4000000e, 0xe0020667, // mov ra_fir_off_val_wt_den_p7, (FIR_OFFSET << 16) | (DENOM + 15 - v_bit_depth) ++/* [0x00000060] */ 0x95803ff6, 0x10024754, // mov ra_ef, rb_ef ; mov rb_xpitch, unif ++/* [0x00000068] */ 0x15827d80, 0x10021427, // mov rb_pitch, unif ++/* [0x00000070] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x00000078] */ 0x0c9d03c0, 0x10021667, // add rb_dma1_base, r1, rb_pitch ++/* [0x00000080] */ 0x14981f80, 0xd0020827, // and r0, 1, elem_num ++/* [0x00000088] */ 0x409c5007, 0xd00049e0, // nop ; mul24 r0, r0, 5 ++/* [0x00000090] */ 0x0c9a7180, 0x100210a7, // add rb_elem_x, r0, elem_num ++/* [0x00000098] */ 0x11001dc0, 0xd4020827, // shl r0, ra0.16b, v_x_shift ++/* [0x000000a0] */ 0x0c9c21c0, 0x10020827, // add r0, r0, rb_elem_x ++/* [0x000000a8] */ 0x930001f6, 0xd2225811, // max r0, r0, 0 ; mov ra_y, ra0.16a ++/* [0x000000b0] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x000000b8] */ 0x119c31c0, 0xd0220567, // shl ra_xshift_next, r0, 3 ++/* [0x000000c0] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x000000c8] */ 0x0d510dc0, 0x18020867, // sub r1, ra_k0, rb_pitch ++/* [0x000000d0] */ 0x149e7040, 0x10020867, // and r1, r0, r1 ++/* [0x000000d8] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x000000e0] */ 0x8c827076, 0x10025800, // add r0, r0, r1 ; mov ra0, unif ++/* [0x000000e8] */ 0x0c627c00, 0x10020627, // add ra_base, ra_base, r0 ++/* [0x000000f0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x000000f8] */ 0x0f9c25c0, 0xd0020867, // asr r1, r2, 2 ++/* [0x00000100] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000108] */ 0x149c35c0, 0xd0020827, // and r0, r2, 3 ++/* [0x00000110] */ 0x159e7040, 0x10020827, // or r0, r0, r1 ++/* [0x00000118] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000120] */ 0x0c9e7040, 0x10021727, // add r_vpm, r0, r1 ++/* [0x00000128] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000130] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000138] */ 0x0c9e7040, 0x100216e7, // add r_dma, r0, r1 ++/* [0x00000140] */ 0x11001dc0, 0xd4020827, // shl r0, ra0.16b, v_x_shift ++/* [0x00000148] */ 0x8c0021f6, 0x12125811, // add r0, r0, rb_elem_x ; mov ra_y2, ra0.16a ++/* [0x00000150] */ 0x938001f6, 0xd002480f, // max r0, r0, 0 ; mov rb_base2, unif ++/* [0x00000158] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x00000160] */ 0x119c31c0, 0xd0021067, // shl rb_xshift2_next, r0, 3 ++/* [0x00000168] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x00000170] */ 0x0d510dc0, 0x18020867, // sub r1, ra_k0, rb_pitch ++/* [0x00000178] */ 0x949c307f, 0xd0024863, // and r1, r0, r1 ; mov r3, PREREAD ++/* [0x00000180] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00000188] */ 0x8c467076, 0x12024822, // add r0, r0, r1 ; mov r2, ra_y2 ++/* [0x00000190] */ 0x8c44fe36, 0x140253e0, // add rb_base2, rb_base2, r0 ; mov r0, ra_y ++// :1 ++/* [0x00000198] */ 0x0d9c17c0, 0xd00228e7, // sub.setf r3, r3, 1 ++/* [0x000001a0] */ 0x139c01c0, 0xd0020867, // max r1, r0, 0 ++/* [0x000001a8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_max_y ++/* [0x000001b0] */ 0x4c51018f, 0x1a024821, // add r0, r0, ra_k1 ; mul24 r1, r1, rb_pitch ++/* [0x000001b8] */ 0x8c627c40, 0x10225e11, // add t0s, ra_base, r1 ; mov ra_y, r0 ++/* [0x000001c0] */ 0x139c05c0, 0xd0020867, // max r1, r2, 0 ++/* [0x000001c8] */ 0xffffffb0, 0xf03809e7, // brr.anynz -, r:1b ++/* [0x000001d0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_max_y ++/* [0x000001d8] */ 0x4c51058f, 0x1a0248a1, // add r2, r2, ra_k1 ; mul24 r1, r1, rb_pitch ++/* [0x000001e0] */ 0x8c9cfe52, 0x10125f11, // add t1s, rb_base2, r1 ; mov ra_y2, r2 ++/* [0x000001e8] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x000001f0] */ 0x00000000, 0xe0024104, // mov ra4, 0 ; mov rb4, 0 ++/* [0x000001f8] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000200] */ 0x00000000, 0xe0024145, // mov ra5, 0 ; mov rb5, 0 ++/* [0x00000208] */ 0x00000000, 0xe0024186, // mov ra6, 0 ; mov rb6, 0 ++/* [0x00000210] */ 0x00000000, 0xe00241c7, // mov ra7, 0 ; mov rb7, 0 ++// ::mc_filter_c_p ++/* [0x00000218] */ 0x9581cff6, 0x10025c42, // mov vw_setup, rb_vpm_init ; mov ra2, unif ++/* [0x00000220] */ 0x8c803ff6, 0x100269e3, // add.setf -, rb_ef, rb_ef ; mov r3, unif ++/* [0x00000228] */ 0xf1081dc0, 0xd4024825, // shl r0, ra2.16b, v_x_shift ; v8subs r5rep, r0, r0 ++/* [0x00000230] */ 0x8c8021f6, 0x10025810, // add r0, r0, rb_elem_x ; mov ra_width_height, unif ++/* [0x00000238] */ 0x8d810bf6, 0x10025840, // sub r1, r5, rb_pitch ; mov ra0, unif ++/* [0x00000240] */ 0x93567176, 0x14024800, // max r0, r0, r5 ; mov vrx_xshift, vrx_xshift_next ++/* [0x00000248] */ 0x9209a1f6, 0x12225813, // min r0, r0, rb_max_x ; mov vra_y_next, ra2.16a ++/* [0x00000250] */ 0x119c31c0, 0xd0220567, // shl vrx_xshift_next, r0, 3 ++/* [0x00000258] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x00000260] */ 0x54402077, 0xd4024862, // and r1, r0, r1 ; mul24 r2, ra_width, v_x_mul ++/* [0x00000268] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00000270] */ 0x8c827076, 0x10025803, // add r0, r0, r1 ; mov ra3, unif ++/* [0x00000278] */ 0x8c427636, 0x120246a1, // add vrx_base_next, r3, r0 ; mov r1, ra_height ++/* [0x00000280] */ 0x8d819eb6, 0x10025756, // sub rb_dma1, rb_dma1_base, r2 ; mov ra_wt_off_mul_l0, unif ++/* [0x00000288] */ 0x8c5dc3ce, 0xdc025461, // add rb_i_tmu, r1, (3-4) - PREREAD ; v8min r1, r1, ra_blk_height ++/* [0x00000290] */ 0x8c81f3f6, 0xd0039496, // add rb_lcount, r1, (3-4) ; mov.ifc ra_wt_off_mul_l0, unif ++/* [0x00000298] */ 0x918073f6, 0xd002581c, // shl r0, r1, v_dma_h_shift ; mov ra_dest, unif ++/* [0x000002a0] */ 0x8c6670b6, 0x14024822, // add r0, r0, r2 ; mov r2, ra_fir_off_val ++/* [0x000002a8] */ 0x910d01f6, 0xdc02480a, // shl r0, r0, v_dma_wh_shift ; mov rb10, ra3.8c ++/* [0x000002b0] */ 0x8c59b1f6, 0x140246e1, // add ra_dma0, r0, rb_dma0_base ; mov r1, ra_wt_off_l0 ++/* [0x000002b8] */ 0x5158c3d6, 0xd2024860, // shl r1, r1, i_wt_den_p5 ; mul24 r0, r2, ra_wt_mul_l0 ++/* [0x000002c0] */ 0x8d667236, 0x14025320, // sub rb_wt_off, r1, r0 ; mov r0, ra_kmul_add ++/* [0x000002c8] */ 0x8c59cc3f, 0xd21245a5, // add ra_wt_mul_l0, ra_wt_mul_l0, r0 ; mov r5rep, -4 ++/* [0x000002d0] */ 0x950e0dbf, 0x1e0252de, // mov rb11, ra3.8d ; mov ra_link, unif ++// :1 ++/* [0x000002d8] */ 0x8d151bf6, 0xa00269c4, // sub.setf -, r5, rb_i_tmu ; mov rb4, ra5 ; ldtmu0 ++/* [0x000002e0] */ 0x8e4c09f6, 0x140288a3, // shr r2, r4, vrx_xshift ; mov.ifz r3, vra_y_next ++/* [0x000002e8] */ 0x8e4485f6, 0xd402c863, // shr r1, r2, v_v_shift ; mov.ifnz r3, vra_y ++/* [0x000002f0] */ 0x8c683ff6, 0x1002b9d8, // add.setf -, rb_ef, rb_ef ; mov.ifz vra_base, vrx_base_next ++/* [0x000002f8] */ 0x8c531789, 0xda224460, // add vra_y, r3, ra_k1 ; mov r0, r1 << 15 ++/* [0x00000300] */ 0x9353f792, 0xd803c8e1, // max r3, r3, ra_k0 ; mov.ifnc r1, r2 << 1 ++/* [0x00000308] */ 0x929de7d2, 0x1003c8e0, // min r3, r3, rb_max_y ; mov.ifnc r0, r2 ++/* [0x00000310] */ 0x545d039f, 0x12024863, // and r1, r1, ra_pmax ; mul24 r3, r3, rb_pitch ++/* [0x00000318] */ 0x8c618cc7, 0x10024e20, // add vr_txs, vra_base, r3 ; v8min r0, r0, rb_pmask ++/* [0x00000320] */ 0x4c001bf0, 0xd8025963, // add r5rep, r5, 1 ; mul24 r3, ra0.8a, r0 ++/* [0x00000328] */ 0x4d01fef1, 0x1e0248a3, // sub r2, rb_fir_off_h, r3 ; mul24 r3, ra0.8d, r1 ++/* [0x00000330] */ 0x4d03e4f0, 0xda0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8b << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00000338] */ 0x40034031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00000340] */ 0x4c03c4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 4, r0 << 4 @ "mul_used", 0 ++/* [0x00000348] */ 0x4c032b71, 0xdc0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra0.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00000350] */ 0xffffff68, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00000358] */ 0x4c1ca4f7, 0x100248a0, // add r2, r2, r3 ; mul24 r0, ra7, rb10 ++/* [0x00000360] */ 0x550c6ffe, 0x1a024161, // mov ra5, rb6 ; mul24 r1, rb6, ra3.8b ++/* [0x00000368] */ 0x8f1c05f6, 0xd00241c6, // asr ra7, r2, v_bit_depth - 8 ; mov rb6, ra7 ++/* [0x00000370] */ 0x4c0c423e, 0x18024860, // add r1, r1, r0 ; mul24 r0, rb4, ra3.8a ++/* [0x00000378] */ 0x4d1cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra7, rb11 ++/* [0x00000380] */ 0x0d9e7200, 0x10020867, // sub r1, r1, r0 ++/* [0x00000388] */ 0x8f5c63f6, 0xdc024863, // asr r1, r1, 6 ; mov r3, ra_blk_height ++/* [0x00000390] */ 0x4d592bce, 0x120269e0, // sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x00000398] */ 0x4c64c1ce, 0x14024821, // add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add ++/* [0x000003a0] */ 0xed427073, 0x12024860, // sub r1, r0, r1 ; v8subs r0, ra_height, r3 ++/* [0x000003a8] */ 0xffffff10, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x000003b0] */ 0x0f9cd3c0, 0xd0020867, // asr r1, r1, i_wt_den_p6 ++/* [0x000003b8] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x000003c0] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x000003c8] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x000003d0] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x000003d8] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x000003e0] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x000003e8] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x000003f0] */ 0xfffffec8, 0xf0f809e7, // brr -, r:1b ++/* [0x000003f8] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00000400] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00000408] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_c_p_l1 ++/* [0x00000410] */ 0x9581cff6, 0x10025c42, // mov vw_setup, rb_vpm_init ; mov ra2, unif ++/* [0x00000418] */ 0x8c803ff6, 0x100269e3, // add.setf -, rb_ef, rb_ef ; mov r3, unif ++/* [0x00000420] */ 0xf1081dc0, 0xd4024825, // shl r0, ra2.16b, v_x_shift ; v8subs r5rep, r0, r0 ++/* [0x00000428] */ 0x8c8021f6, 0x10025810, // add r0, r0, rb_elem_x ; mov ra_width_height, unif ++/* [0x00000430] */ 0x8d810bf6, 0x10025840, // sub r1, r5, rb_pitch ; mov ra0, unif ++/* [0x00000438] */ 0x939c117f, 0x10125815, // max r0, r0, r5 ; mov vrx_xshift, vrx_xshift_next ++/* [0x00000440] */ 0x9209a1f6, 0x12125813, // min r0, r0, rb_max_x ; mov vra_y_next, ra2.16a ++/* [0x00000448] */ 0x119c31c0, 0xd0021067, // shl vrx_xshift_next, r0, 3 ++/* [0x00000450] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x00000458] */ 0x54402077, 0xd4024862, // and r1, r0, r1 ; mul24 r2, ra_width, v_x_mul ++/* [0x00000460] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00000468] */ 0x8c827076, 0x10025803, // add r0, r0, r1 ; mov ra3, unif ++/* [0x00000470] */ 0x8c427636, 0x120254e1, // add vrx_base_next, r3, r0 ; mov r1, ra_height ++/* [0x00000478] */ 0x8d819eb6, 0x10025756, // sub rb_dma1, rb_dma1_base, r2 ; mov ra_wt_off_mul_l0, unif ++/* [0x00000480] */ 0x8c5dc3ce, 0xdc025461, // add rb_i_tmu, r1, (3-4) - PREREAD ; v8min r1, r1, ra_blk_height ++/* [0x00000488] */ 0x8c81f3f6, 0xd0039496, // add rb_lcount, r1, (3-4) ; mov.ifc ra_wt_off_mul_l0, unif ++/* [0x00000490] */ 0x918073f6, 0xd002581c, // shl r0, r1, v_dma_h_shift ; mov ra_dest, unif ++/* [0x00000498] */ 0x8c6670b6, 0x14024822, // add r0, r0, r2 ; mov r2, ra_fir_off_val ++/* [0x000004a0] */ 0x910d01f6, 0xdc02480a, // shl r0, r0, v_dma_wh_shift ; mov rb10, ra3.8c ++/* [0x000004a8] */ 0x8c59b1f6, 0x140246e1, // add ra_dma0, r0, rb_dma0_base ; mov r1, ra_wt_off_l0 ++/* [0x000004b0] */ 0x5158c3d6, 0xd2024860, // shl r1, r1, i_wt_den_p5 ; mul24 r0, r2, ra_wt_mul_l0 ++/* [0x000004b8] */ 0x8d667236, 0x14025320, // sub rb_wt_off, r1, r0 ; mov r0, ra_kmul_add ++/* [0x000004c0] */ 0x8c59cc3f, 0xd21245a5, // add ra_wt_mul_l0, ra_wt_mul_l0, r0 ; mov r5rep, -4 ++/* [0x000004c8] */ 0x950e0dbf, 0x1e0252de, // mov rb11, ra3.8d ; mov ra_link, unif ++// :1 ++/* [0x000004d0] */ 0x8d151bf6, 0xb00269c4, // sub.setf -, r5, rb_i_tmu ; mov rb4, ra5 ; ldtmu1 ++/* [0x000004d8] */ 0x8e5539bf, 0x1202888f, // shr r2, r4, vrx_xshift ; mov.ifz vra_base, vrx_base_next ++/* [0x000004e0] */ 0x8e4485f6, 0xd202c863, // shr r1, r2, v_v_shift ; mov.ifnz r3, vra_y ++/* [0x000004e8] */ 0x8c4c3ff6, 0x1202a9e3, // add.setf -, rb_ef, rb_ef ; mov.ifz r3, vra_y_next ++/* [0x000004f0] */ 0x8c531789, 0xda124460, // add vra_y, r3, ra_k1 ; mov r0, r1 << 15 ++/* [0x000004f8] */ 0x9353f792, 0xd803c8e1, // max r3, r3, ra_k0 ; mov.ifnc r1, r2 << 1 ++/* [0x00000500] */ 0x929de7d2, 0x1003c8e0, // min r3, r3, rb_max_y ; mov.ifnc r0, r2 ++/* [0x00000508] */ 0x545d039f, 0x12024863, // and r1, r1, ra_pmax ; mul24 r3, r3, rb_pitch ++/* [0x00000510] */ 0x8c5cfec6, 0x12024f20, // add vr_txs, vra_base, r3 ; v8min r0, r0, ra_pmax ++/* [0x00000518] */ 0x4c001bf0, 0xd8025963, // add r5rep, r5, 1 ; mul24 r3, ra0.8a, r0 ++/* [0x00000520] */ 0x4d01fef1, 0x1e0248a3, // sub r2, rb_fir_off_h, r3 ; mul24 r3, ra0.8d, r1 ++/* [0x00000528] */ 0x4d03e4f0, 0xda0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8b << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00000530] */ 0x40034031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00000538] */ 0x4c03c4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 4, r0 << 4 @ "mul_used", 0 ++/* [0x00000540] */ 0x4c032b71, 0xdc0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra0.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00000548] */ 0xffffff68, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00000550] */ 0x4c1ca4f7, 0x100248a0, // add r2, r2, r3 ; mul24 r0, ra7, rb10 ++/* [0x00000558] */ 0x550c6ffe, 0x1a024161, // mov ra5, rb6 ; mul24 r1, rb6, ra3.8b ++/* [0x00000560] */ 0x8f1c05f6, 0xd00241c6, // asr ra7, r2, v_bit_depth - 8 ; mov rb6, ra7 ++/* [0x00000568] */ 0x4c0c423e, 0x18024860, // add r1, r1, r0 ; mul24 r0, rb4, ra3.8a ++/* [0x00000570] */ 0x4d1cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra7, rb11 ++/* [0x00000578] */ 0x0d9e7200, 0x10020867, // sub r1, r1, r0 ++/* [0x00000580] */ 0x8f5c63f6, 0xdc024863, // asr r1, r1, 6 ; mov r3, ra_blk_height ++/* [0x00000588] */ 0x4d592bce, 0x120269e0, // sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x00000590] */ 0x4c64c1ce, 0x14024821, // add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add ++/* [0x00000598] */ 0xed427073, 0x12024860, // sub r1, r0, r1 ; v8subs r0, ra_height, r3 ++/* [0x000005a0] */ 0xffffff10, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x000005a8] */ 0x0f9cd3c0, 0xd0020867, // asr r1, r1, i_wt_den_p6 ++/* [0x000005b0] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x000005b8] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x000005c0] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x000005c8] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x000005d0] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x000005d8] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x000005e0] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x000005e8] */ 0xfffffec8, 0xf0f809e7, // brr -, r:1b ++/* [0x000005f0] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x000005f8] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00000600] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_c_b ++/* [0x00000608] */ 0x9581cff6, 0x10025c42, // mov vw_setup, rb_vpm_init ; mov ra2, unif ++/* [0x00000610] */ 0x8c803ff6, 0x100269e3, // add.setf -, rb_ef, rb_ef ; mov r3, unif ++/* [0x00000618] */ 0xf1081dc9, 0xd4024825, // shl r0, ra2.16b, v_x_shift ; v8subs r5rep, r1, r1 ++/* [0x00000620] */ 0x8c0821f6, 0x12225813, // add r0, r0, rb_elem_x ; mov ra_y_next, ra2.16a ++/* [0x00000628] */ 0x8d810bf6, 0x10025850, // sub r1, r5, rb_pitch ; mov ra_width_height, unif ++/* [0x00000630] */ 0x93567176, 0x14125815, // max r0, r0, r5 ; mov ra_xshift, ra_xshift_next ++/* [0x00000638] */ 0x9281a1f6, 0x10025800, // min r0, r0, rb_max_x ; mov ra0, unif ++/* [0x00000640] */ 0x119c31c0, 0xd0220567, // shl ra_xshift_next, r0, 3 ++/* [0x00000648] */ 0x9481c1f6, 0xd0025802, // and r0, r0, -4 ; mov ra2, unif ++/* [0x00000650] */ 0x54402077, 0xd4024862, // and r1, r0, r1 ; mul24 r2, ra_width, v_x_mul ++/* [0x00000658] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00000660] */ 0x8c427076, 0x12024821, // add r0, r0, r1 ; mov r1, ra_height ++/* [0x00000668] */ 0x8c9c163f, 0x10024680, // add ra_base_next, r3, r0 ; mov rb_xshift2, rb_xshift2_next ++/* [0x00000670] */ 0x8d819eb6, 0x10025756, // sub rb_dma1, rb_dma1_base, r2 ; mov ra_wt_off_mul_l0, unif ++/* [0x00000678] */ 0x8c5dc3ce, 0xdc025461, // add rb_i_tmu, r1, (3-4) - PREREAD ; v8min r1, r1, ra_blk_height ++/* [0x00000680] */ 0x8c59f3f6, 0xd4139496, // add rb_lcount, r1, (3-4) ; mov.ifc ra_wt_mul_l0, ra_wt_off_l0 ++/* [0x00000688] */ 0x918073f6, 0xd0025803, // shl r0, r1, v_dma_h_shift ; mov ra3, unif ++/* [0x00000690] */ 0x8c8270b6, 0x10024823, // add r0, r0, r2 ; mov r3, unif ++/* [0x00000698] */ 0x910d01f6, 0xd2125813, // shl r0, r0, v_dma_wh_shift ; mov ra_y2_next, ra3.16a ++/* [0x000006a0] */ 0x8c0db1f6, 0x140246e0, // add ra_dma0, r0, rb_dma0_base ; mov r0, ra3.16b ++/* [0x000006a8] */ 0x918011f6, 0xd0025801, // shl r0, r0, v_x_shift ; mov ra1, unif ++/* [0x000006b0] */ 0x8c8021f6, 0x10025803, // add r0, r0, rb_elem_x ; mov ra3, unif ++/* [0x000006b8] */ 0x8d810bf6, 0x10025852, // sub r1, r5, rb_pitch ; mov ra_wt_off_mul_l1, unif ++/* [0x000006c0] */ 0x939de17f, 0x10025809, // max r0, r0, r5 ; mov ra9, rb_max_y ++/* [0x000006c8] */ 0x9265a1f6, 0x14024822, // min r0, r0, rb_max_x ; mov r2, ra_kmul_add ++/* [0x000006d0] */ 0x119c31c0, 0xd0021067, // shl rb_xshift2_next, r0, 3 ++/* [0x000006d8] */ 0x9481c1f6, 0xd0039812, // and r0, r0, -4 ; mov.ifc ra_wt_off_mul_l1, unif ++/* [0x000006e0] */ 0x949dc07f, 0xd0024865, // and r1, r0, r1 ; mov r5rep, -4 ++/* [0x000006e8] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x000006f0] */ 0x8c827076, 0x1002581c, // add r0, r0, r1 ; mov ra_dest, unif ++/* [0x000006f8] */ 0x8c667636, 0x140254e0, // add rb_base2_next, r3, r0 ; mov r0, ra_fir_off_val ++/* [0x00000700] */ 0x4c5a7c86, 0x121245a1, // add ra_wt_mul_l0, ra_wt_mul_l0, r2 ; mul24 r1, r0, ra_wt_mul_l0 ++/* [0x00000708] */ 0x4c4a7c86, 0x121244a0, // add ra_wt_mul_l1, ra_wt_mul_l1, r2 ; mul24 r0, r0, ra_wt_mul_l1 ++/* [0x00000710] */ 0x8c4a7076, 0x14024821, // add r0, r0, r1 ; mov r1, ra_wt_off_l1 ++/* [0x00000718] */ 0x910cd3f6, 0xde02484b, // shl r1, r1, i_wt_den_p6 ; mov rb11, ra3.8d ++/* [0x00000720] */ 0x8d827236, 0x1002531e, // sub rb_wt_off, r1, r0 ; mov ra_link, unif ++/* [0x00000728] */ 0x95080ff6, 0x1e024287, // mov ra10, rb_xshift2 ; mov rb7, ra2.8d ++// :1 ++/* [0x00000730] */ 0x0d9d1bc0, 0xa00229e7, // sub.setf -, r5, rb_i_tmu ; nop ; ldtmu0 ++/* [0x00000738] */ 0x8e5539bf, 0x1202888f, // shr r2, r4, ra_xshift ; mov.ifz rb_base2, rb_base2_next ++/* [0x00000740] */ 0x8e4c85f6, 0xd0029851, // shr r1, r2, v_v_shift ; mov.ifz ra_y_y2, ra_y_y2_next ++/* [0x00000748] */ 0x8c683ff6, 0x1002b9d8, // add.setf -, rb_ef, rb_ef ; mov.ifz ra_base, ra_base_next ++/* [0x00000750] */ 0x8c441fb6, 0xd4224463, // add ra_y, 1, ra_y ; mov r3, ra_y ++/* [0x00000758] */ 0x93531789, 0xd80248e0, // max r3, r3, ra_k0 ; mov r0, r1 << 15 ++/* [0x00000760] */ 0x9227f792, 0xd003c8e1, // min r3, r3, ra9 ; mov.ifnc r1, r2 << 1 ++/* [0x00000768] */ 0x559d049f, 0x100e4823, // mov.ifnc r0, r2 ; mul24 r3, r3, rb_pitch ++/* [0x00000770] */ 0x8c618cc7, 0x10024e20, // add t0s, ra_base, r3 ; v8min r0, r0, rb_pmask ++/* [0x00000778] */ 0x540183f0, 0x18024862, // and r1, r1, rb_pmask ; mul24 r2, ra0.8a, r0 ++/* [0x00000780] */ 0x4d01feb1, 0x1e0248a3, // sub r2, rb_fir_off_h, r2 ; mul24 r3, ra0.8d, r1 ++/* [0x00000788] */ 0x4d03e4f0, 0xda0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8b << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00000790] */ 0x40034031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00000798] */ 0x4c03c4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 4, r0 << 4 @ "mul_used", 0 ++/* [0x000007a0] */ 0x40032031, 0xdc0109e3, // nop ; mul24.ifn r3, ra0.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x000007a8] */ 0x4c0854fe, 0xb8025804, // add r0, r2, r3 ; mul24 ra4, rb5, ra2.8a ; ldtmu1 ++/* [0x000007b0] */ 0x8e2869bf, 0x10024885, // shr r2, r4, ra10 ; mov rb5, rb6 ++/* [0x000007b8] */ 0x8e4485f6, 0xd2024863, // shr r1, r2, v_v_shift ; mov r3, ra_y2 ++/* [0x000007c0] */ 0x8e1c01f6, 0xd00241c6, // shr ra7, r0, v_bit_depth - 8 ; mov rb6, ra7 ++/* [0x000007c8] */ 0x8c531789, 0xda124460, // add ra_y2, r3, ra_k1 ; mov r0, r1 << 15 ++/* [0x000007d0] */ 0x9353f792, 0xd803c8e1, // max r3, r3, ra_k0 ; mov.ifnc r1, r2 << 1 ++/* [0x000007d8] */ 0x925de7ce, 0x120248e1, // min r3, r3, rb_max_y ; v8min r1, r1, ra_pmax ++/* [0x000007e0] */ 0x559d049f, 0x100e4823, // mov.ifnc r0, r2 ; mul24 r3, r3, rb_pitch ++/* [0x000007e8] */ 0x8c5cfec6, 0x12024f20, // add t1s, rb_base2, r3 ; v8min r0, r0, ra_pmax ++/* [0x000007f0] */ 0x4c041bf0, 0xd8025962, // add r5rep, r5, 1 ; mul24 r2, ra1.8a, r0 ++/* [0x000007f8] */ 0x4d05feb1, 0x1e0248a3, // sub r2, rb_fir_off_h, r2 ; mul24 r3, ra1.8d, r1 ++/* [0x00000800] */ 0x4d07e4f0, 0xda0248a3, // sub r2, r2, r3 ; mul24 r3, ra1.8b << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00000808] */ 0x40074031, 0xda0109e3, // nop ; mul24.ifn r3, ra1.8b << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00000810] */ 0x4c07c6b0, 0xdc0248a3, // add r2, r3, r2 ; mul24 r3, ra1.8c << 4, r0 << 4 @ "mul_used", 0 ++/* [0x00000818] */ 0x4c072b71, 0xdc0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00000820] */ 0xfffffef0, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00000828] */ 0x4c0c94fe, 0x180248a0, // add r2, r2, r3 ; mul24 r0, rb9, ra3.8a ++/* [0x00000830] */ 0x550caffe, 0x1a025261, // mov rb9, rb10 ; mul24 r1, rb10, ra3.8b ++/* [0x00000838] */ 0x8e2c05f6, 0xd00242ca, // shr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 ++/* [0x00000840] */ 0x4d08523e, 0x1a0248a1, // sub r2, r1, r0 ; mul24 r1, rb5, ra2.8b ++/* [0x00000848] */ 0x8d112bf6, 0x100269e0, // sub.setf -, r5, rb_lcount ; mov r0, ra4 ++/* [0x00000850] */ 0x4d08623e, 0x1c024860, // sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++/* [0x00000858] */ 0x4c1c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra7, rb7 ++/* [0x00000860] */ 0x4d0ca23e, 0x1c024860, // sub r1, r1, r0 ; mul24 r0, rb10, ra3.8c ++/* [0x00000868] */ 0x4c2cb437, 0x100248a0, // add r2, r2, r0 ; mul24 r0, ra11, rb11 ++/* [0x00000870] */ 0x0d9e7400, 0x100208a7, // sub r2, r2, r0 ++/* [0x00000878] */ 0x0e9c63c0, 0xd0020867, // shr r1, r1, 6 ++/* [0x00000880] */ 0x4e5865ce, 0xd20248a0, // shr r2, r2, 6 ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x00000888] */ 0x4c4a7456, 0x120248a1, // add r2, r2, r1 ; mul24 r1, r2, ra_wt_mul_l1 ++/* [0x00000890] */ 0x4c667216, 0x14024862, // add r1, r1, r0 ; mul24 r2, r2, ra_kmul_add ++/* [0x00000898] */ 0x8d5e72b6, 0x1c024863, // sub r1, r1, r2 ; mov r3, ra_blk_height ++/* [0x000008a0] */ 0xec40c3f3, 0x12024860, // add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 ++/* [0x000008a8] */ 0xfffffe68, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x000008b0] */ 0x0f667380, 0x18020867, // asr r1, r1, ra_wt_den_p7 ++/* [0x000008b8] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x000008c0] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x000008c8] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x000008d0] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x000008d8] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x000008e0] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x000008e8] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x000008f0] */ 0xfffffe20, 0xf0f809e7, // brr -, r:1b ++/* [0x000008f8] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00000900] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00000908] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_sync_q0 ++/* [0x00000910] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000918] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000920] */ 0x00000010, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000928] */ 0x00000010, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000930] */ 0x00000010, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000938] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000940] */ 0x0000001c, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000948] */ 0x00000001, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000950] */ 0x0000000d, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q1 ++/* [0x00000958] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000960] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000968] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000970] */ 0x00000000, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000978] */ 0x00000011, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000980] */ 0x00000002, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q2 ++/* [0x00000988] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000990] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000998] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x000009a0] */ 0x00000000, 0xe80009e7, // mov dst, srel(i) ++/* [0x000009a8] */ 0x00000012, 0xe80009e7, // mov dst, sacq(i) ++/* [0x000009b0] */ 0x00000003, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q3 ++/* [0x000009b8] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x000009c0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000009c8] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x000009d0] */ 0x00000000, 0xe80009e7, // mov dst, srel(i) ++/* [0x000009d8] */ 0x00000013, 0xe80009e7, // mov dst, sacq(i) ++/* [0x000009e0] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_sync_q4 ++/* [0x000009e8] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x000009f0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000009f8] */ 0x00000014, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000a00] */ 0x00000014, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000a08] */ 0x00000014, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000a10] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000a18] */ 0x0000001d, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000a20] */ 0x00000005, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000a28] */ 0x0000000e, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q5 ++/* [0x00000a30] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000a38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a40] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000a48] */ 0x00000004, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000a50] */ 0x00000015, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000a58] */ 0x00000006, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q6 ++/* [0x00000a60] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000a68] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000a70] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000a78] */ 0x00000004, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000a80] */ 0x00000016, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000a88] */ 0x00000007, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q7 ++/* [0x00000a90] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000a98] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000aa0] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000aa8] */ 0x00000004, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000ab0] */ 0x00000017, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000ab8] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_sync_q8 ++/* [0x00000ac0] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000ac8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000ad0] */ 0x00000018, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000ad8] */ 0x00000018, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000ae0] */ 0x00000018, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000ae8] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000af0] */ 0x0000001e, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000af8] */ 0x00000009, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000b00] */ 0x0000000c, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q9 ++/* [0x00000b08] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000b10] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000b18] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000b20] */ 0x00000008, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000b28] */ 0x00000019, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000b30] */ 0x0000000a, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q10 ++/* [0x00000b38] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000b40] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000b48] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000b50] */ 0x00000008, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000b58] */ 0x0000001a, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000b60] */ 0x0000000b, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync_q11 ++/* [0x00000b68] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000b70] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000b78] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000b80] */ 0x00000008, 0xe80009e7, // mov dst, srel(i) ++/* [0x00000b88] */ 0x0000001b, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000b90] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_exit_c_qn ++// ::mc_exit_y_qn ++/* [0x00000b98] */ 0x00000002, 0xe00228e7, // mov.setf r3, PREREAD - 1 ++// :1 ++/* [0x00000ba0] */ 0xffffffe0, 0xf03809e7, // brr.anynz -, r:1b ++/* [0x00000ba8] */ 0x009e7000, 0xa00009e7, // nop ; nop ; ldtmu0 ++/* [0x00000bb0] */ 0x009e7000, 0xb00009e7, // nop ; nop ; ldtmu1 ++/* [0x00000bb8] */ 0x0d9c17c0, 0xd00228e7, // sub.setf r3, r3, 1 ++/* [0x00000bc0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000bc8] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000bd0] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00000bd8] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_exit_c_q0 ++// ::mc_exit_y_q0 ++/* [0x00000be0] */ 0x00000002, 0xe00228e7, // mov.setf r3, PREREAD - 1 ++// :1 ++/* [0x00000be8] */ 0xffffffe0, 0xf03809e7, // brr.anynz -, r:1b ++/* [0x00000bf0] */ 0x009e7000, 0xa00009e7, // nop ; nop ; ldtmu0 ++/* [0x00000bf8] */ 0x009e7000, 0xb00009e7, // nop ; nop ; ldtmu1 ++/* [0x00000c00] */ 0x0d9c17c0, 0xd00228e7, // sub.setf r3, r3, 1 ++/* [0x00000c08] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00000c10] */ 0x0000001c, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00000c18] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00000c20] */ 0x00000001, 0xe00209a7, // mov interrupt, 1 ++/* [0x00000c28] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_setup_y_q0 ++/* [0x00000c30] */ 0x0000000c, 0xe80009e7, // mov dst, srel(i) ++// ::mc_setup_y_qn ++/* [0x00000c38] */ 0x95801ff6, 0xd0025900, // mov tmurs, 1 ; mov ra0, unif ++/* [0x00000c40] */ 0x15827d80, 0x10020267, // mov ra9, unif ++/* [0x00000c48] */ 0x15827d80, 0x10020067, // mov ra1, unif ++/* [0x00000c50] */ 0xaaaaff00, 0xe6020827, // mov r0, [0,2,0,2,0,2,0,2,1,3,1,3,1,3,1,3] ++/* [0x00000c58] */ 0x9181e1f6, 0xd00250cb, // shl rb_ef, r0, i_shift30 ; mov ra11, unif ++/* [0x00000c60] */ 0xff800100, 0xe0020527, // mov ra_kff800100, 0xff800100 ++/* [0x00000c68] */ 0x000000ff, 0xe0021627, // mov rb_pmask, v_pmask ++/* [0x00000c70] */ 0x001000ff, 0xe00205e7, // mov ra_blk_height_pmax, ((1 << v_bit_depth) - 1) | (v_blk_height << 16) ++/* [0x00000c78] */ 0x00004000, 0xe00217e7, // mov rb_fir_off_h, (FIR_OFFSET << (v_bit_depth - 8)) ++/* [0x00000c80] */ 0x4000000e, 0xe0020667, // mov ra_fir_off_val_wt_den_p7, (FIR_OFFSET << 16) | (DENOM + 15 - v_bit_depth) ++/* [0x00000c88] */ 0x050b0a00, 0xe0021567, // mov rb_y_coeffs_2, 0x050b0a00 ++/* [0x00000c90] */ 0x11283a40, 0xe00215a7, // mov rb_y_coeffs_3, 0x11283a40 ++/* [0x00000c98] */ 0x0a0b0500, 0xe00215e7, // mov rb_y_coeffs_5, 0x0a0b0500 ++/* [0x00000ca0] */ 0x15827d80, 0x100200e7, // mov ra3, unif ++/* [0x00000ca8] */ 0x95803ff6, 0x10024754, // mov ra_ef, rb_ef ; mov rb_xpitch, unif ++/* [0x00000cb0] */ 0x0d0c1dc0, 0xd40216a7, // sub rb_max_x, ra3.16b, 1 ++/* [0x00000cb8] */ 0x0d0c1dc0, 0xd20217a7, // sub rb_max_y, ra3.16a, 1 ++/* [0x00000cc0] */ 0x959a0dbf, 0x100248d0, // mov r3, elem_num ; mov rb_pitch, unif ++/* [0x00000cc8] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x00000cd0] */ 0x159d03c0, 0x10021667, // or rb_dma1_base, r1, rb_pitch ++/* [0x00000cd8] */ 0x0c027cc0, 0x14020827, // add r0, ra0.16b, r3 ++/* [0x00000ce0] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 ++/* [0x00000ce8] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x00000cf0] */ 0x119c31c0, 0xd0220567, // shl ra_xshift_next, r0, 3 ++/* [0x00000cf8] */ 0xf49dc1d2, 0xd0024822, // and r0, r0, -4 ; v8subs r2, r2, r2 ++/* [0x00000d00] */ 0x0d9d05c0, 0x100208a7, // sub r2, r2, rb_pitch ++/* [0x00000d08] */ 0x149e7080, 0x10020867, // and r1, r0, r2 ++/* [0x00000d10] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00000d18] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000d20] */ 0x0c267c00, 0x10020627, // add ra_base, ra9, r0 ++/* [0x00000d28] */ 0x0c067cc0, 0x14020827, // add r0, ra1.16b, r3 ++/* [0x00000d30] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 ++/* [0x00000d38] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x00000d40] */ 0x119c31c0, 0xd0021067, // shl rb_xshift2_next, r0, 3 ++/* [0x00000d48] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x00000d50] */ 0x149e7080, 0x10020867, // and r1, r0, r2 ++/* [0x00000d58] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00000d60] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000d68] */ 0x0c2e7c00, 0x100213e7, // add rb_base2, ra11, r0 ++/* [0x00000d70] */ 0x80027036, 0x120049e0, // nop ; mov r0, ra0.16a ++/* [0x00000d78] */ 0x95043ff6, 0xd20248e2, // mov r3, PREREAD ; mov r2, ra1.16a ++// :1 ++/* [0x00000d80] */ 0x0d9c17c0, 0xd00228e7, // sub.setf r3, r3, 1 ++/* [0x00000d88] */ 0x139c01c0, 0xd0020867, // max r1, r0, 0 ++/* [0x00000d90] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_max_y ++/* [0x00000d98] */ 0x4c51018f, 0x1a024821, // add r0, r0, ra_k1 ; mul24 r1, r1, rb_pitch ++/* [0x00000da0] */ 0x8c627c40, 0x10225e11, // add t0s, ra_base, r1 ; mov ra_y, r0 ++/* [0x00000da8] */ 0x139c05c0, 0xd0020867, // max r1, r2, 0 ++/* [0x00000db0] */ 0xffffffb0, 0xf03809e7, // brr.anynz -, r:1b ++/* [0x00000db8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_max_y ++/* [0x00000dc0] */ 0x4c51058f, 0x1a0248a1, // add r2, r2, ra_k1 ; mul24 r1, r1, rb_pitch ++/* [0x00000dc8] */ 0x8c9cfe52, 0x10125f11, // add t1s, rb_base2, r1 ; mov ra_y2, r2 ++/* [0x00000dd0] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00000dd8] */ 0x0f9c25c0, 0xd0020867, // asr r1, r2, 2 ++/* [0x00000de0] */ 0x119c63c0, 0xd0020867, // shl r1, r1, 6 ++/* [0x00000de8] */ 0x149c35c0, 0xd0020827, // and r0, r2, 3 ++/* [0x00000df0] */ 0x159e7040, 0x10020827, // or r0, r0, r1 ++/* [0x00000df8] */ 0x00004800, 0xe0020867, // mov r1, vpm_setup(0, 4, h8p(0, 0)) ++/* [0x00000e00] */ 0x0c9e7040, 0x10021727, // add r_vpm, r0, r1 ++/* [0x00000e08] */ 0x80004004, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) ++/* [0x00000e10] */ 0x119c51c0, 0xd0020827, // shl r0, r0, 5 ++/* [0x00000e18] */ 0x0c9e7040, 0x100216e7, // add r_dma, r0, r1 ++/* [0x00000e20] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00000e28] */ 0x00000000, 0xe0024208, // mov ra8, 0 ; mov rb8, 0 ++/* [0x00000e30] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000e38] */ 0x00000000, 0xe0024249, // mov ra9, 0 ; mov rb9, 0 ++/* [0x00000e40] */ 0x00000000, 0xe002428a, // mov ra10, 0 ; mov rb10, 0 ++/* [0x00000e48] */ 0x00000000, 0xe00242cb, // mov ra11, 0 ; mov rb11, 0 ++// :per_block_setup_8 ++/* [0x00000e50] */ 0x93567176, 0x14125815, // max r0, r0, r5 ; mov ra_xshift, ra_xshift_next ++/* [0x00000e58] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x00000e60] */ 0x119c31c0, 0xd0220567, // shl ra_xshift_next, r0, 3 ++/* [0x00000e68] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x00000e70] */ 0x8d810bf6, 0x1002589a, // sub r2, r5, rb_pitch ; mov ra_base_next, unif ++/* [0x00000e78] */ 0x940270b6, 0x12225853, // and r1, r0, r2 ; mov ra_y_next, ra0.16a ++/* [0x00000e80] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00000e88] */ 0x8c827076, 0x10025801, // add r0, r0, r1 ; mov ra1, unif ++/* [0x00000e90] */ 0x0c6a7c00, 0x100206a7, // add ra_base_next, ra_base_next, r0 ++/* [0x00000e98] */ 0x0c067cc0, 0x14020827, // add r0, ra1.16b, r3 ++/* [0x00000ea0] */ 0x93067176, 0x12125813, // max r0, r0, r5 ; mov ra_y2_next, ra1.16a ++/* [0x00000ea8] */ 0x9281a1f6, 0x10024813, // min r0, r0, rb_max_x ; mov rb_base2_next, unif ++/* [0x00000eb0] */ 0x119c31c0, 0xd0021067, // shl rb_xshift2_next, r0, 3 ++/* [0x00000eb8] */ 0x9481c1f6, 0xd0025810, // and r0, r0, -4 ; mov ra_width_height, unif ++/* [0x00000ec0] */ 0x949dc0bf, 0x10024871, // and r1, r0, r2 ; mov vw_setup, rb_vpm_init ++/* [0x00000ec8] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00000ed0] */ 0x4c401077, 0xd4024821, // add r0, r0, r1 ; mul24 r1, ra_width, v_x_mul ++/* [0x00000ed8] */ 0x0c9d3e00, 0x100214e7, // add rb_base2_next, rb_base2_next, r0 ++/* [0x00000ee0] */ 0x8d419e76, 0x12025760, // sub rb_dma1, rb_dma1_base, r1 ; mov r0, ra_height ++/* [0x00000ee8] */ 0x8c5dc1c6, 0xdc025460, // add rb_i_tmu, r0, (7-8) - PREREAD ; v8min r0, r0, ra_blk_height ++/* [0x00000ef0] */ 0x0c9df1c0, 0xd00214a7, // add rb_lcount, r0, (7-8) ++/* [0x00000ef8] */ 0x916471f6, 0xd4024823, // shl r0, r0, v_dma_h_shift ; mov r3, ra_kmul_add ++/* [0x00000f00] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00000f08] */ 0x916501f6, 0xd4024822, // shl r0, r0, v_dma_wh_shift ; mov r2, ra_fir_off_val ++/* [0x00000f10] */ 0x8c81b1f6, 0x100246e0, // add ra_dma0, r0, rb_dma0_base ; mov r0, unif ++/* [0x00000f18] */ 0x918101f6, 0xd00a5816, // shl.ifnn r0, r0, i_shift16 ; mov ra_wt_off_mul_l0, unif ++/* [0x00000f20] */ 0x915031f6, 0xde024205, // shl ra8, r0, 3 ; mov rb5, ra_k255 ++/* [0x00000f28] */ 0x01040400, 0xe0020867, // mov r1, 0x01040400 ++/* [0x00000f30] */ 0x10227380, 0x1e5200a7, // ror ra2.8b, r1, ra8.8d ++/* [0x00000f38] */ 0x10227380, 0x1c520027, // ror ra0.8b, r1, ra8.8c ++/* [0x00000f40] */ 0x10215f80, 0x1e6200a7, // ror ra2.8c, rb_y_coeffs_2, ra8.8d ++/* [0x00000f48] */ 0x10215f80, 0x1c620027, // ror ra0.8c, rb_y_coeffs_2, ra8.8c ++/* [0x00000f50] */ 0x00010100, 0xe0020867, // mov r1,0x00010100 ++/* [0x00000f58] */ 0x902203bf, 0x1e025812, // ror r0, r1, ra8.8d ; mov ra_wt_off_mul_l1, unif ++/* [0x00000f60] */ 0x90205387, 0x1c424004, // ror ra0.8a, r1, ra8.8c ; v8min rb4, r0, rb5 ++/* [0x00000f68] */ 0x914883f6, 0xd0031856, // shl r1, r1, 8 ; mov.ifn ra_wt_off_mul_l0, ra_wt_off_mul_l1 ++/* [0x00000f70] */ 0x902203bf, 0x1e02581c, // ror r0, r1, ra8.8d ; mov ra_dest, unif ++/* [0x00000f78] */ 0x90205387, 0x1c72404b, // ror ra1.8d, r1, ra8.8c ; v8min rb11, r0, rb5 ++/* [0x00000f80] */ 0x10216f80, 0x1e7200a7, // ror ra2.8d, rb_y_coeffs_3, ra8.8d ++/* [0x00000f88] */ 0x10216f80, 0x1c720027, // ror ra0.8d, rb_y_coeffs_3, ra8.8c ++/* [0x00000f90] */ 0x10217f80, 0x1e5200e7, // ror ra3.8b, rb_y_coeffs_5, ra8.8d ++/* [0x00000f98] */ 0x10217f80, 0x1c520067, // ror ra1.8b, rb_y_coeffs_5, ra8.8c ++/* [0x00000fa0] */ 0x04040100, 0xe0020867, // mov r1,0x04040100 ++/* [0x00000fa8] */ 0x10227380, 0x1e6200e7, // ror ra3.8c, r1, ra8.8d ++/* [0x00000fb0] */ 0x902183bf, 0xdc624065, // ror ra1.8c, r1, ra8.8c ; mov r5rep, -8 ++/* [0x00000fb8] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00000fc0] */ 0x3a281100, 0xe0020867, // mov r1,0x3a281100 ++/* [0x00000fc8] */ 0x902203bf, 0x1e02581e, // ror r0, r1, ra8.8d ; mov ra_link, unif ++/* [0x00000fd0] */ 0x90205387, 0x1c424048, // ror ra1.8a, r1, ra8.8c ; v8min rb8, r0, rb5 ++// ::mc_filter_y_pxx ++/* [0x00000fd8] */ 0xfffffe58, 0xf0f807a7, // brr ra_link, r:per_block_setup_8 ++/* [0x00000fe0] */ 0x959a0ff6, 0x10024023, // mov ra0, unif ; mov r3, elem_num ++/* [0x00000fe8] */ 0xec9c3fd2, 0x100269e5, // add.setf -, rb_ef, rb_ef ; v8subs r5rep, r2, r2 ++/* [0x00000ff0] */ 0x8c001cff, 0x14024800, // add r0, ra0.16b, r3 ; mov rb_xshift2, rb_xshift2_next ++/* [0x00000ff8] */ 0x1158cdc0, 0xd4020867, // shl r1, ra_wt_off_l0, i_wt_den_p5 ++/* [0x00001000] */ 0x4c5a7cd6, 0x121245a0, // add ra_wt_mul_l0, ra_wt_mul_l0, r3 ; mul24 r0, r2, ra_wt_mul_l0 ++/* [0x00001008] */ 0x8d9c423f, 0x1042531d, // sub rb_wt_off, r1, r0 ; mov ra_ef.8a, rb4 ++// :1 ++/* [0x00001010] */ 0x4c745dbe, 0x100279c4, // add.setf -, ra_ef, ra_ef ; mul24 ra4, rb5, ra_ef ++/* [0x00001018] */ 0x93440dff, 0xd40248a1, // max r2, ra_y, 0 ; mov r1, 0 ++/* [0x00001020] */ 0x9251e5f6, 0x1a0248a3, // min r2, r2, rb_max_y ; mov r3, ra_k1 ++/* [0x00001028] */ 0x4c450cd7, 0xa4224462, // add ra_y, ra_y, r3 ; mul24 r2, r2, rb_pitch ; ldtmu0 ++/* [0x00001030] */ 0x8c606cbf, 0x10024e05, // add t0s, ra_base, r2 ; mov rb5, rb6 ++/* [0x00001038] */ 0x8e5479bf, 0x12024806, // shr r0, r4, ra_xshift ; mov rb6, rb7 ++/* [0x00001040] */ 0x93458c47, 0xb20248a0, // max r2, ra_y2, r1 ; v8min r0, r0, rb_pmask ; ldtmu1 ++/* [0x00001048] */ 0x8e2009f6, 0x10024847, // shr r1, r4, rb_xshift2 ; mov rb7, ra8 ++/* [0x00001050] */ 0x925de5ce, 0x120248a1, // min r2, r2, rb_max_y ; v8min r1, r1, ra_pmax ++/* [0x00001058] */ 0x4c450cd7, 0x12124462, // add ra_y2, ra_y2, r3 ; mul24 r2, r2, rb_pitch ++/* [0x00001060] */ 0x8c24feb6, 0x10025f08, // add t1s, rb_base2, r2 ; mov ra8, ra9 ++/* [0x00001068] */ 0x4c038af1, 0xd8025962, // add r5rep, r5, r3 ; mul24 r2, ra0.8a << 8, r1 << 8 @ "mul_used", 0 ++/* [0x00001070] */ 0x5501fff0, 0x180348e2, // mov r3, rb_fir_off_h ; mul24.ifnn r2, ra0.8a, r0 ++/* [0x00001078] */ 0x4d03f6b0, 0xda0248a3, // sub r2, r3, r2 ; mul24 r3, ra0.8b << 1, r0 << 1 @ "mul_used", 0 ++/* [0x00001080] */ 0x40037031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 9, r1 << 9 @ "mul_used", 0 ++/* [0x00001088] */ 0x4c03e4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00001090] */ 0x40036031, 0xdc0109e3, // nop ; mul24.ifn r3, ra0.8c << 10, r1 << 10 @ "mul_used", 0 ++/* [0x00001098] */ 0x4d03d4f0, 0xde0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8d << 3, r0 << 3 @ "mul_used", 0 ++/* [0x000010a0] */ 0x40035031, 0xde0109e3, // nop ; mul24.ifn r3, ra0.8d << 11, r1 << 11 @ "mul_used", 0 ++/* [0x000010a8] */ 0x4c07c4f0, 0xd80248a3, // add r2, r2, r3 ; mul24 r3, ra1.8a << 4, r0 << 4 @ "mul_used", 0 ++/* [0x000010b0] */ 0x40074031, 0xd80109e3, // nop ; mul24.ifn r3, ra1.8a << 12, r1 << 12 @ "mul_used", 0 ++/* [0x000010b8] */ 0x4c07b4f0, 0xda0248a3, // add r2, r2, r3 ; mul24 r3, ra1.8b << 5, r0 << 5 @ "mul_used", 0 ++/* [0x000010c0] */ 0x40073031, 0xda0109e3, // nop ; mul24.ifn r3, ra1.8b << 13, r1 << 13 @ "mul_used", 0 ++/* [0x000010c8] */ 0x4d07a4f0, 0xdc0248a3, // sub r2, r2, r3 ; mul24 r3, ra1.8c << 6, r0 << 6 @ "mul_used", 0 ++/* [0x000010d0] */ 0x40072031, 0xdc0109e3, // nop ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x000010d8] */ 0x4c0794f0, 0xde0248a3, // add r2, r2, r3 ; mul24 r3, ra1.8d << 7, r0 << 7 @ "mul_used", 0 ++/* [0x000010e0] */ 0x4c071b71, 0xde0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra1.8d << 15, r1 << 15 @ "mul_used", 0 ++/* [0x000010e8] */ 0xffffff08, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x000010f0] */ 0x4d0854fe, 0x1a0248a1, // sub r2, r2, r3 ; mul24 r1, rb5, ra2.8b ++/* [0x000010f8] */ 0x550caffe, 0x1a024260, // mov ra9, rb10 ; mul24 r0, rb10, ra3.8b ++/* [0x00001100] */ 0x8f2c05f6, 0xd00242ca, // asr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 ++/* [0x00001108] */ 0x4d08623e, 0x1c024860, // sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++/* [0x00001110] */ 0x4d08723e, 0x1e024860, // sub r1, r1, r0 ; mul24 r0, rb7, ra2.8d ++/* [0x00001118] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00001120] */ 0x4c0ca23e, 0x1c024860, // add r1, r1, r0 ; mul24 r0, rb10, ra3.8c ++/* [0x00001128] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00001130] */ 0x8d5d1bf6, 0x1c0269e3, // sub.setf -, r5, rb_i_tmu ; mov r3, ra_blk_height ++/* [0x00001138] */ 0x8d1133bf, 0x1002884f, // sub r1, r1, ra4 ; mov.ifz rb_base2, rb_base2_next ++/* [0x00001140] */ 0x8d6a7236, 0x10029858, // sub r1, r1, r0 ; mov.ifz ra_base, ra_base_next ++/* [0x00001148] */ 0x8f4c63f6, 0xd0029851, // asr r1, r1, 6 ; mov.ifz ra_y_y2, ra_y_y2_next ++/* [0x00001150] */ 0x4d592bce, 0x120269e0, // sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x00001158] */ 0x4c64c1ce, 0x14024821, // add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add ++/* [0x00001160] */ 0xed427073, 0x12024860, // sub r1, r0, r1 ; v8subs r0, ra_height, r3 ++/* [0x00001168] */ 0xfffffe88, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00001170] */ 0x0f9cd3c0, 0xd0020867, // asr r1, r1, i_wt_den_p6 ++/* [0x00001178] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00001180] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x00001188] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x00001190] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00001198] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x000011a0] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x000011a8] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x000011b0] */ 0xfffffe40, 0xf0f809e7, // brr -, r:1b ++/* [0x000011b8] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x000011c0] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x000011c8] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_y_bxx ++/* [0x000011d0] */ 0xfffffc60, 0xf0f807a7, // brr ra_link, r:per_block_setup_8 ++/* [0x000011d8] */ 0x959a0ff6, 0x10024023, // mov ra0, unif ; mov r3, elem_num ++/* [0x000011e0] */ 0xec9c3fd2, 0x100269e5, // add.setf -, rb_ef, rb_ef ; v8subs r5rep, r2, r2 ++/* [0x000011e8] */ 0x8c001cff, 0x14024800, // add r0, ra0.16b, r3 ; mov rb_xshift2, rb_xshift2_next ++/* [0x000011f0] */ 0x1158ddc0, 0xd4020867, // shl r1, ra_wt_off_l0, i_wt_den_p6 ++/* [0x000011f8] */ 0x4c5a7cd6, 0x121245a0, // add ra_wt_mul_l0, ra_wt_mul_l0, r3 ; mul24 r0, r2, ra_wt_mul_l0 ++/* [0x00001200] */ 0x4d4a7216, 0x12024860, // sub r1, r1, r0 ; mul24 r0, r2, ra_wt_mul_l1 ++/* [0x00001208] */ 0x8d9c423f, 0x1042531d, // sub rb_wt_off, r1, r0 ; mov ra_ef.8a, rb4 ++// :1 ++/* [0x00001210] */ 0x4c745dbe, 0x100279c4, // add.setf -, ra_ef, ra_ef ; mul24 ra4, rb5, ra_ef ++/* [0x00001218] */ 0x93440dff, 0xd40248a1, // max r2, ra_y, 0 ; mov r1, 0 ++/* [0x00001220] */ 0x9251e5f6, 0x1a0248a3, // min r2, r2, rb_max_y ; mov r3, ra_k1 ++/* [0x00001228] */ 0x4c450cd7, 0xa4224462, // add ra_y, ra_y, r3 ; mul24 r2, r2, rb_pitch ; ldtmu0 ++/* [0x00001230] */ 0x8c606cbf, 0x10024e05, // add t0s, ra_base, r2 ; mov rb5, rb6 ++/* [0x00001238] */ 0x8e5479bf, 0x12024806, // shr r0, r4, ra_xshift ; mov rb6, rb7 ++/* [0x00001240] */ 0x93458c47, 0xb20248a0, // max r2, ra_y2, r1 ; v8min r0, r0, rb_pmask ; ldtmu1 ++/* [0x00001248] */ 0x8e2009f6, 0x10024847, // shr r1, r4, rb_xshift2 ; mov rb7, ra8 ++/* [0x00001250] */ 0x925de5ce, 0x120248a1, // min r2, r2, rb_max_y ; v8min r1, r1, ra_pmax ++/* [0x00001258] */ 0x4c450cd7, 0x12124462, // add ra_y2, ra_y2, r3 ; mul24 r2, r2, rb_pitch ++/* [0x00001260] */ 0x8c24feb6, 0x10025f08, // add t1s, rb_base2, r2 ; mov ra8, ra9 ++/* [0x00001268] */ 0x4c038af1, 0xd8025962, // add r5rep, r5, r3 ; mul24 r2, ra0.8a << 8, r1 << 8 @ "mul_used", 0 ++/* [0x00001270] */ 0x5501fff0, 0x180348e2, // mov r3, rb_fir_off_h ; mul24.ifnn r2, ra0.8a, r0 ++/* [0x00001278] */ 0x4d03f6b0, 0xda0248a3, // sub r2, r3, r2 ; mul24 r3, ra0.8b << 1, r0 << 1 @ "mul_used", 0 ++/* [0x00001280] */ 0x40037031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 9, r1 << 9 @ "mul_used", 0 ++/* [0x00001288] */ 0x4c03e4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00001290] */ 0x40036031, 0xdc0109e3, // nop ; mul24.ifn r3, ra0.8c << 10, r1 << 10 @ "mul_used", 0 ++/* [0x00001298] */ 0x4d03d4f0, 0xde0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8d << 3, r0 << 3 @ "mul_used", 0 ++/* [0x000012a0] */ 0x40035031, 0xde0109e3, // nop ; mul24.ifn r3, ra0.8d << 11, r1 << 11 @ "mul_used", 0 ++/* [0x000012a8] */ 0x4c07c4f0, 0xd80248a3, // add r2, r2, r3 ; mul24 r3, ra1.8a << 4, r0 << 4 @ "mul_used", 0 ++/* [0x000012b0] */ 0x40074031, 0xd80109e3, // nop ; mul24.ifn r3, ra1.8a << 12, r1 << 12 @ "mul_used", 0 ++/* [0x000012b8] */ 0x4c07b4f0, 0xda0248a3, // add r2, r2, r3 ; mul24 r3, ra1.8b << 5, r0 << 5 @ "mul_used", 0 ++/* [0x000012c0] */ 0x40073031, 0xda0109e3, // nop ; mul24.ifn r3, ra1.8b << 13, r1 << 13 @ "mul_used", 0 ++/* [0x000012c8] */ 0x4d07a4f0, 0xdc0248a3, // sub r2, r2, r3 ; mul24 r3, ra1.8c << 6, r0 << 6 @ "mul_used", 0 ++/* [0x000012d0] */ 0x40072031, 0xdc0109e3, // nop ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x000012d8] */ 0x4c0794f0, 0xde0248a3, // add r2, r2, r3 ; mul24 r3, ra1.8d << 7, r0 << 7 @ "mul_used", 0 ++/* [0x000012e0] */ 0x4c071b71, 0xde0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra1.8d << 15, r1 << 15 @ "mul_used", 0 ++/* [0x000012e8] */ 0xffffff08, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x000012f0] */ 0x4d0854fe, 0x1a0248a1, // sub r2, r2, r3 ; mul24 r1, rb5, ra2.8b ++/* [0x000012f8] */ 0x550caffe, 0x1a024260, // mov ra9, rb10 ; mul24 r0, rb10, ra3.8b ++/* [0x00001300] */ 0x8f2c05f6, 0xd00242ca, // asr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 ++/* [0x00001308] */ 0x4d08623e, 0x1c024860, // sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++/* [0x00001310] */ 0x4d08723e, 0x1e024860, // sub r1, r1, r0 ; mul24 r0, rb7, ra2.8d ++/* [0x00001318] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00001320] */ 0x4c0ca23e, 0x1c024860, // add r1, r1, r0 ; mul24 r0, rb10, ra3.8c ++/* [0x00001328] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00001330] */ 0x0d127380, 0x10020867, // sub r1, r1, ra4 ++/* [0x00001338] */ 0x8d9cc23f, 0x10024862, // sub r1, r1, r0 ; mov r2, rb_wt_off ++/* [0x00001340] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00001348] */ 0x4d591bce, 0x120269e0, // sub.setf -, r5, rb_i_tmu ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x00001350] */ 0x55653fce, 0x140453e1, // mov.ifz rb_base2, rb_base2_next ; mul24 r1, r1, ra_kmul_add ++/* [0x00001358] */ 0x8d4e7076, 0x10029851, // sub r1, r0, r1 ; mov.ifz ra_y_y2, ra_y_y2_next ++/* [0x00001360] */ 0x8d692bf6, 0x1002b9d8, // sub.setf -, r5, rb_lcount ; mov.ifz ra_base, ra_base_next ++/* [0x00001368] */ 0x8c9f8289, 0xd0024860, // add r1, r1, r2 ; mov r0, r1 << 8 ++/* [0x00001370] */ 0x8c5e7236, 0x1c024863, // add r1, r1, r0 ; mov r3, ra_blk_height ++/* [0x00001378] */ 0xfffffe78, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00001380] */ 0x4f65039f, 0x18024862, // asr r1, r1, ra_wt_den_p7 ; mul24 r2, r3, rb_pitch ++/* [0x00001388] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00001390] */ 0xf34003f3, 0xd2024c20, // max vpm, r1, 0 ; v8subs r0, ra_height, r3 ++/* [0x00001398] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x000013a0] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x000013a8] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x000013b0] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x000013b8] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x000013c0] */ 0xfffffe30, 0xf0f809e7, // brr -, r:1b ++/* [0x000013c8] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x000013d0] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x000013d8] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_y_p00 ++/* [0x000013e0] */ 0x959a0ff6, 0x10024020, // mov ra0, unif ; mov r0, elem_num ++/* [0x000013e8] */ 0xf5567dad, 0x14124565, // mov ra_xshift, ra_xshift_next ; v8subs r5rep, r5, r5 ++/* [0x000013f0] */ 0x8c020c3f, 0x1402581a, // add r0, ra0.16b, r0 ; mov ra_base_next, unif ++/* [0x000013f8] */ 0x93027176, 0x12225813, // max r0, r0, r5 ; mov ra_y_next, ra0.16a ++/* [0x00001400] */ 0x9281a1f6, 0x10025810, // min r0, r0, rb_max_x ; mov ra_width_height, unif ++/* [0x00001408] */ 0x119c31c0, 0xd0220567, // shl ra_xshift_next, r0, 3 ++/* [0x00001410] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x00001418] */ 0x8d810bf6, 0x10025896, // sub r2, r5, rb_pitch ; mov ra_wt_off_mul_l0, unif ++/* [0x00001420] */ 0x149e7080, 0x10020867, // and r1, r0, r2 ++/* [0x00001428] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00001430] */ 0x8c827076, 0x1002581c, // add r0, r0, r1 ; mov ra_dest, unif ++/* [0x00001438] */ 0x8c69cc3f, 0x100246b1, // add ra_base_next, ra_base_next, r0 ; mov vw_setup, rb_vpm_init ++/* [0x00001440] */ 0x11400dc0, 0xd4020867, // shl r1, ra_width, v_x_shift ++/* [0x00001448] */ 0x8d419e76, 0x12025760, // sub rb_dma1, rb_dma1_base, r1 ; mov r0, ra_height ++/* [0x00001450] */ 0x8d5c31c6, 0xdc025460, // sub rb_i_tmu, r0, PREREAD ; v8min r0, r0, ra_blk_height ++/* [0x00001458] */ 0x919c71c0, 0xd0024812, // shl r0, r0, v_dma_h_shift ; mov rb_lcount, r0 ++/* [0x00001460] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00001468] */ 0x1158edc0, 0xd4021327, // shl rb_wt_off, ra_wt_off_l0, DENOM + 7 ++/* [0x00001470] */ 0x918101f6, 0xd002581e, // shl r0, r0, v_dma_wh_shift ; mov ra_link, unif ++/* [0x00001478] */ 0x0c9db1c0, 0x100206e7, // add ra_dma0, r0, rb_dma0_base ++// :1 ++/* [0x00001480] */ 0xcd511bee, 0x1a0269e5, // sub.setf -, r5, rb_i_tmu ; v8adds r5rep, r5, ra_k1 ++/* [0x00001488] */ 0x804e7036, 0xa42099d1, // nop ; mov.ifz ra_y, ra_y_next ; ldtmu0 ++/* [0x00001490] */ 0x8e5509bf, 0x12024823, // shr r0, r4, ra_xshift ; mov r3, rb_pitch ++/* [0x00001498] */ 0x13440dc0, 0xd40208a7, // max r2, ra_y, 0 ++/* [0x000014a0] */ 0x9269e5f6, 0x10029898, // min r2, r2, rb_max_y ; mov.ifz ra_base, ra_base_next ++/* [0x000014a8] */ 0x4c441dd3, 0xd4224462, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000014b0] */ 0x8c618c87, 0x10024e20, // add t0s, ra_base, r2 ; v8min r0, r0, rb_pmask ++/* [0x000014b8] */ 0x4d592bc6, 0x120269e1, // sub.setf -, r5, rb_lcount ; mul24 r1, r0, ra_wt_mul_l0 ++/* [0x000014c0] */ 0x915c83f6, 0xdc024863, // shl r1, r1, 8 ; mov r3, ra_blk_height ++/* [0x000014c8] */ 0xec40c3f3, 0x12024860, // add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 ++/* [0x000014d0] */ 0xffffff90, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x000014d8] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, DENOM + 8 ++/* [0x000014e0] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x000014e8] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x000014f0] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x000014f8] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00001500] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x00001508] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x00001510] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x00001518] */ 0xffffff48, 0xf0f809e7, // brr -, r:1b ++/* [0x00001520] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00001528] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00001530] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_y_b00 ++/* [0x00001538] */ 0xfffff8f8, 0xf0f807a7, // brr ra_link, r:per_block_setup_8 ++/* [0x00001540] */ 0x959a0ff6, 0x10024023, // mov ra0, unif ; mov r3, elem_num ++/* [0x00001548] */ 0xec9c3fd2, 0x100269e5, // add.setf -, rb_ef, rb_ef ; v8subs r5rep, r2, r2 ++/* [0x00001550] */ 0x8c001cff, 0x14024800, // add r0, ra0.16b, r3 ; mov rb_xshift2, rb_xshift2_next ++/* [0x00001558] */ 0x00000001, 0xe00208a7, // mov r2, 1 ++/* [0x00001560] */ 0x8c591eb6, 0x10025461, // add rb_i_tmu, rb_i_tmu, r2 ; mov r1, ra_wt_off_mul_l0 ++/* [0x00001568] */ 0xf158fded, 0xd4025325, // shl rb_wt_off, ra_wt_off_l0, DENOM + 8 ; v8subs r5quad, r5, r5 ++/* [0x00001570] */ 0x809f8009, 0xd000d9d6, // nop ; mov.ifnz ra_wt_off_mul_l0, r1 << 8 ++// :1 ++/* [0x00001578] */ 0x0d9d1bc0, 0xb00229e7, // sub.setf -, r5, rb_i_tmu ; nop ; ldtmu1 ++/* [0x00001580] */ 0x8e4c09f6, 0xa0029851, // shr r1, r4, rb_xshift2 ; mov.ifz ra_y_y2, ra_y_y2_next ; ldtmu0 ++/* [0x00001588] */ 0x8e5509bf, 0x12024823, // shr r0, r4, ra_xshift ; mov r3, rb_pitch ++/* [0x00001590] */ 0x13440dc0, 0xd40208a7, // max r2, ra_y, 0 ++/* [0x00001598] */ 0x9269e5f6, 0x10029898, // min r2, r2, rb_max_y ; mov.ifz ra_base, ra_base_next ++/* [0x000015a0] */ 0x4c441dd3, 0xd4224462, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000015a8] */ 0x8c613cbf, 0x10028e0f, // add t0s, ra_base, r2 ; mov.ifz rb_base2, rb_base2_next ++/* [0x000015b0] */ 0x13440dc0, 0xd20208a7, // max r2, ra_y2, 0 ++/* [0x000015b8] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_max_y ++/* [0x000015c0] */ 0x4c441dd3, 0xd2124462, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++/* [0x000015c8] */ 0x8c5cfe86, 0x12024f20, // add t1s, rb_base2, r2 ; v8min r0, r0, ra_pmax ++/* [0x000015d0] */ 0x545983c6, 0x12024860, // and r1, r1, rb_pmask ; mul24 r0, r0, ra_wt_mul_l0 ++/* [0x000015d8] */ 0x4d492bce, 0x120269e1, // sub.setf -, r5, rb_lcount ; mul24 r1, r1, ra_wt_mul_l1 ++/* [0x000015e0] */ 0xcc52706e, 0x1a024865, // add r1, r0, r1 ; v8adds r5rep, r5, ra_k1 ++/* [0x000015e8] */ 0x915c83f6, 0xdc024863, // shl r1, r1, 8 ; mov r3, ra_blk_height ++/* [0x000015f0] */ 0xec40c3f3, 0x12024860, // add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 ++/* [0x000015f8] */ 0xffffff60, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00001600] */ 0x0f9d03c0, 0xd0020867, // asr r1, r1, (DENOM + 9) - 32 ++/* [0x00001608] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00001610] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x00001618] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x00001620] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00001628] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x00001630] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x00001638] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x00001640] */ 0xffffff18, 0xf0f809e7, // brr -, r:1b ++/* [0x00001648] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00001650] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00001658] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_setup_c10_q0 ++/* [0x00001660] */ 0x0000000c, 0xe80009e7, // mov dst, srel(i) ++// ::mc_setup_c10_qn ++/* [0x00001668] */ 0x95801ff6, 0xd0025900, // mov tmurs, 1 ; mov ra0, unif ++/* [0x00001670] */ 0xaaaaff00, 0xe6020827, // mov r0, [0,2,0,2,0,2,0,2,1,3,1,3,1,3,1,3] ++/* [0x00001678] */ 0x9181e1f6, 0xd00250d8, // shl rb_ef, r0, i_shift30 ; mov ra_base, unif ++/* [0x00001680] */ 0x0d801dc0, 0xd0020827, // sub r0, unif, 1 ++/* [0x00001688] */ 0x119c21c0, 0xd00216a7, // shl rb_max_x, r0, v_x_shift ++/* [0x00001690] */ 0x0d801dc0, 0xd00217a7, // sub rb_max_y, unif, 1 ++/* [0x00001698] */ 0xff800100, 0xe0020527, // mov ra_kff800100, 0xff800100 ++/* [0x000016a0] */ 0x0000ffff, 0xe0021627, // mov rb_pmask, v_pmask ++/* [0x000016a8] */ 0x000803ff, 0xe00205e7, // mov ra_blk_height_pmax, ((1 << v_bit_depth) - 1) | (v_blk_height << 16) ++/* [0x000016b0] */ 0x00010000, 0xe00217e7, // mov rb_fir_off_h, (FIR_OFFSET << (v_bit_depth - 8)) ++/* [0x000016b8] */ 0x4000000c, 0xe0020667, // mov ra_fir_off_val_wt_den_p7, (FIR_OFFSET << 16) | (DENOM + 15 - v_bit_depth) ++/* [0x000016c0] */ 0x95803ff6, 0x10024754, // mov ra_ef, rb_ef ; mov rb_xpitch, unif ++/* [0x000016c8] */ 0x15827d80, 0x10021427, // mov rb_pitch, unif ++/* [0x000016d0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x000016d8] */ 0x0c9d03c0, 0x10021667, // add rb_dma1_base, r1, rb_pitch ++/* [0x000016e0] */ 0x14981f80, 0xd0020827, // and r0, 1, elem_num ++/* [0x000016e8] */ 0x409c5007, 0xd00049e0, // nop ; mul24 r0, r0, 5 ++/* [0x000016f0] */ 0x0c9a7180, 0x10020827, // add r0, r0, elem_num ++/* [0x000016f8] */ 0x0c9e7000, 0x100210a7, // add rb_elem_x, r0, r0 ++/* [0x00001700] */ 0x11002dc0, 0xd4020827, // shl r0, ra0.16b, v_x_shift ++/* [0x00001708] */ 0x0c9c21c0, 0x10020827, // add r0, r0, rb_elem_x ++/* [0x00001710] */ 0x930001f6, 0xd2225811, // max r0, r0, 0 ; mov ra_y, ra0.16a ++/* [0x00001718] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x00001720] */ 0x00000000, 0xe0224541, // mov ra_xshift_next, 0 ; mov rb_xshift2_next, 0 ++/* [0x00001728] */ 0x0d510dc0, 0x18020867, // sub r1, ra_k0, rb_pitch ++/* [0x00001730] */ 0x149e7040, 0x10020867, // and r1, r0, r1 ++/* [0x00001738] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00001740] */ 0x8c827076, 0x10025800, // add r0, r0, r1 ; mov ra0, unif ++/* [0x00001748] */ 0x0c627c00, 0x10020627, // add ra_base, ra_base, r0 ++/* [0x00001750] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00001758] */ 0x0f9c15c0, 0xd0020867, // asr r1, r2, 1 ++/* [0x00001760] */ 0x119c43c0, 0xd0020867, // shl r1, r1, 4 ++/* [0x00001768] */ 0x149c15c0, 0xd0020827, // and r0, r2, 1 ++/* [0x00001770] */ 0x159e7040, 0x10020827, // or r0, r0, r1 ++/* [0x00001778] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) ++/* [0x00001780] */ 0x0c9e7040, 0x10021727, // add r_vpm, r0, r1 ++/* [0x00001788] */ 0x80004002, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h16p(0,0,0)) ++/* [0x00001790] */ 0x119c61c0, 0xd0020827, // shl r0, r0, 6 ++/* [0x00001798] */ 0x0c9e7040, 0x100216e7, // add r_dma, r0, r1 ++/* [0x000017a0] */ 0x11002dc0, 0xd4020827, // shl r0, ra0.16b, v_x_shift ++/* [0x000017a8] */ 0x8c0021f6, 0x12125811, // add r0, r0, rb_elem_x ; mov ra_y2, ra0.16a ++/* [0x000017b0] */ 0x938001f6, 0xd002480f, // max r0, r0, 0 ; mov rb_base2, unif ++/* [0x000017b8] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x000017c0] */ 0x0d510dc0, 0x18020867, // sub r1, ra_k0, rb_pitch ++/* [0x000017c8] */ 0x949c307f, 0xd0024863, // and r1, r0, r1 ; mov r3, PREREAD ++/* [0x000017d0] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x000017d8] */ 0x8c467076, 0x12024822, // add r0, r0, r1 ; mov r2, ra_y2 ++/* [0x000017e0] */ 0x8c44fe36, 0x140253e0, // add rb_base2, rb_base2, r0 ; mov r0, ra_y ++// :1 ++/* [0x000017e8] */ 0x0d9c17c0, 0xd00228e7, // sub.setf r3, r3, 1 ++/* [0x000017f0] */ 0x139c01c0, 0xd0020867, // max r1, r0, 0 ++/* [0x000017f8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_max_y ++/* [0x00001800] */ 0x4c51018f, 0x1a024821, // add r0, r0, ra_k1 ; mul24 r1, r1, rb_pitch ++/* [0x00001808] */ 0x8c627c40, 0x10225e11, // add t0s, ra_base, r1 ; mov ra_y, r0 ++/* [0x00001810] */ 0x139c05c0, 0xd0020867, // max r1, r2, 0 ++/* [0x00001818] */ 0xffffffb0, 0xf03809e7, // brr.anynz -, r:1b ++/* [0x00001820] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_max_y ++/* [0x00001828] */ 0x4c51058f, 0x1a0248a1, // add r2, r2, ra_k1 ; mul24 r1, r1, rb_pitch ++/* [0x00001830] */ 0x8c9cfe52, 0x10125f11, // add t1s, rb_base2, r1 ; mov ra_y2, r2 ++/* [0x00001838] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00001840] */ 0x00000000, 0xe0024104, // mov ra4, 0 ; mov rb4, 0 ++/* [0x00001848] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00001850] */ 0x00000000, 0xe0024145, // mov ra5, 0 ; mov rb5, 0 ++/* [0x00001858] */ 0x00000000, 0xe0024186, // mov ra6, 0 ; mov rb6, 0 ++/* [0x00001860] */ 0x00000000, 0xe00241c7, // mov ra7, 0 ; mov rb7, 0 ++// ::mc_filter_c10_p ++/* [0x00001868] */ 0x9581cff6, 0x10025c42, // mov vw_setup, rb_vpm_init ; mov ra2, unif ++/* [0x00001870] */ 0x8c803ff6, 0x100269e3, // add.setf -, rb_ef, rb_ef ; mov r3, unif ++/* [0x00001878] */ 0xf1082dc0, 0xd4024825, // shl r0, ra2.16b, v_x_shift ; v8subs r5rep, r0, r0 ++/* [0x00001880] */ 0x8c8021f6, 0x10025810, // add r0, r0, rb_elem_x ; mov ra_width_height, unif ++/* [0x00001888] */ 0x8d810bf6, 0x10025840, // sub r1, r5, rb_pitch ; mov ra0, unif ++/* [0x00001890] */ 0x93567176, 0x14024800, // max r0, r0, r5 ; mov vrx_xshift, vrx_xshift_next ++/* [0x00001898] */ 0x9209a1f6, 0x12225813, // min r0, r0, rb_max_x ; mov vra_y_next, ra2.16a ++/* [0x000018a0] */ 0x54404077, 0xd4024862, // and r1, r0, r1 ; mul24 r2, ra_width, v_x_mul ++/* [0x000018a8] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x000018b0] */ 0x8c827076, 0x10025803, // add r0, r0, r1 ; mov ra3, unif ++/* [0x000018b8] */ 0x8c427636, 0x120246a1, // add vrx_base_next, r3, r0 ; mov r1, ra_height ++/* [0x000018c0] */ 0x8d819eb6, 0x10025756, // sub rb_dma1, rb_dma1_base, r2 ; mov ra_wt_off_mul_l0, unif ++/* [0x000018c8] */ 0x8c5dc3ce, 0xdc025461, // add rb_i_tmu, r1, (3-4) - PREREAD ; v8min r1, r1, ra_blk_height ++/* [0x000018d0] */ 0x8c81f3f6, 0xd0039496, // add rb_lcount, r1, (3-4) ; mov.ifc ra_wt_off_mul_l0, unif ++/* [0x000018d8] */ 0x918083f6, 0xd002581c, // shl r0, r1, v_dma_h_shift ; mov ra_dest, unif ++/* [0x000018e0] */ 0x8c6670b6, 0x14024822, // add r0, r0, r2 ; mov r2, ra_fir_off_val ++/* [0x000018e8] */ 0x910cf1f6, 0xdc02480a, // shl r0, r0, v_dma_wh_shift ; mov rb10, ra3.8c ++/* [0x000018f0] */ 0x8c59b1f6, 0x140246e1, // add ra_dma0, r0, rb_dma0_base ; mov r1, ra_wt_off_l0 ++/* [0x000018f8] */ 0x5158a3d6, 0xd2024860, // shl r1, r1, i_wt_den_p5 ; mul24 r0, r2, ra_wt_mul_l0 ++/* [0x00001900] */ 0x8d667236, 0x14025320, // sub rb_wt_off, r1, r0 ; mov r0, ra_kmul_add ++/* [0x00001908] */ 0x8c59cc3f, 0xd21245a5, // add ra_wt_mul_l0, ra_wt_mul_l0, r0 ; mov r5rep, -4 ++/* [0x00001910] */ 0x950e0dbf, 0x1e0252de, // mov rb11, ra3.8d ; mov ra_link, unif ++// :1 ++/* [0x00001918] */ 0x8d151bf6, 0xa00269c4, // sub.setf -, r5, rb_i_tmu ; mov rb4, ra5 ; ldtmu0 ++/* [0x00001920] */ 0x8e4c09f6, 0x140288a3, // shr r2, r4, vrx_xshift ; mov.ifz r3, vra_y_next ++/* [0x00001928] */ 0x8e4505f6, 0xd402c863, // shr r1, r2, v_v_shift ; mov.ifnz r3, vra_y ++/* [0x00001930] */ 0x8c683ff6, 0x1002b9d8, // add.setf -, rb_ef, rb_ef ; mov.ifz vra_base, vrx_base_next ++/* [0x00001938] */ 0x8c531789, 0xda224460, // add vra_y, r3, ra_k1 ; mov r0, r1 << 15 ++/* [0x00001940] */ 0x9353f792, 0xd803c8e1, // max r3, r3, ra_k0 ; mov.ifnc r1, r2 << 1 ++/* [0x00001948] */ 0x929de7d2, 0x1003c8e0, // min r3, r3, rb_max_y ; mov.ifnc r0, r2 ++/* [0x00001950] */ 0x545d039f, 0x12024863, // and r1, r1, ra_pmax ; mul24 r3, r3, rb_pitch ++/* [0x00001958] */ 0x8c618cc7, 0x10024e20, // add vr_txs, vra_base, r3 ; v8min r0, r0, rb_pmask ++/* [0x00001960] */ 0x4c001bf0, 0xd8025963, // add r5rep, r5, 1 ; mul24 r3, ra0.8a, r0 ++/* [0x00001968] */ 0x4d01fef1, 0x1e0248a3, // sub r2, rb_fir_off_h, r3 ; mul24 r3, ra0.8d, r1 ++/* [0x00001970] */ 0x4d03e4f0, 0xda0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8b << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00001978] */ 0x40034031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00001980] */ 0x4c03c4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 4, r0 << 4 @ "mul_used", 0 ++/* [0x00001988] */ 0x4c032b71, 0xdc0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra0.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00001990] */ 0xffffff68, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00001998] */ 0x4c1ca4f7, 0x100248a0, // add r2, r2, r3 ; mul24 r0, ra7, rb10 ++/* [0x000019a0] */ 0x550c6ffe, 0x1a024161, // mov ra5, rb6 ; mul24 r1, rb6, ra3.8b ++/* [0x000019a8] */ 0x8f1c25f6, 0xd00241c6, // asr ra7, r2, v_bit_depth - 8 ; mov rb6, ra7 ++/* [0x000019b0] */ 0x4c0c423e, 0x18024860, // add r1, r1, r0 ; mul24 r0, rb4, ra3.8a ++/* [0x000019b8] */ 0x4d1cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra7, rb11 ++/* [0x000019c0] */ 0x0d9e7200, 0x10020867, // sub r1, r1, r0 ++/* [0x000019c8] */ 0x8f5c63f6, 0xdc024863, // asr r1, r1, 6 ; mov r3, ra_blk_height ++/* [0x000019d0] */ 0x4d592bce, 0x120269e0, // sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x000019d8] */ 0x4c64c1ce, 0x14024821, // add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add ++/* [0x000019e0] */ 0xed427073, 0x12024860, // sub r1, r0, r1 ; v8subs r0, ra_height, r3 ++/* [0x000019e8] */ 0xffffff10, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x000019f0] */ 0x0f9cb3c0, 0xd0020867, // asr r1, r1, i_wt_den_p6 ++/* [0x000019f8] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00001a00] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x00001a08] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x00001a10] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00001a18] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x00001a20] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x00001a28] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x00001a30] */ 0xfffffec8, 0xf0f809e7, // brr -, r:1b ++/* [0x00001a38] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00001a40] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00001a48] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_c10_p_l1 ++/* [0x00001a50] */ 0x9581cff6, 0x10025c42, // mov vw_setup, rb_vpm_init ; mov ra2, unif ++/* [0x00001a58] */ 0x8c803ff6, 0x100269e3, // add.setf -, rb_ef, rb_ef ; mov r3, unif ++/* [0x00001a60] */ 0xf1082dc0, 0xd4024825, // shl r0, ra2.16b, v_x_shift ; v8subs r5rep, r0, r0 ++/* [0x00001a68] */ 0x8c8021f6, 0x10025810, // add r0, r0, rb_elem_x ; mov ra_width_height, unif ++/* [0x00001a70] */ 0x8d810bf6, 0x10025840, // sub r1, r5, rb_pitch ; mov ra0, unif ++/* [0x00001a78] */ 0x939c117f, 0x10125815, // max r0, r0, r5 ; mov vrx_xshift, vrx_xshift_next ++/* [0x00001a80] */ 0x9209a1f6, 0x12125813, // min r0, r0, rb_max_x ; mov vra_y_next, ra2.16a ++/* [0x00001a88] */ 0x54404077, 0xd4024862, // and r1, r0, r1 ; mul24 r2, ra_width, v_x_mul ++/* [0x00001a90] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00001a98] */ 0x8c827076, 0x10025803, // add r0, r0, r1 ; mov ra3, unif ++/* [0x00001aa0] */ 0x8c427636, 0x120254e1, // add vrx_base_next, r3, r0 ; mov r1, ra_height ++/* [0x00001aa8] */ 0x8d819eb6, 0x10025756, // sub rb_dma1, rb_dma1_base, r2 ; mov ra_wt_off_mul_l0, unif ++/* [0x00001ab0] */ 0x8c5dc3ce, 0xdc025461, // add rb_i_tmu, r1, (3-4) - PREREAD ; v8min r1, r1, ra_blk_height ++/* [0x00001ab8] */ 0x8c81f3f6, 0xd0039496, // add rb_lcount, r1, (3-4) ; mov.ifc ra_wt_off_mul_l0, unif ++/* [0x00001ac0] */ 0x918083f6, 0xd002581c, // shl r0, r1, v_dma_h_shift ; mov ra_dest, unif ++/* [0x00001ac8] */ 0x8c6670b6, 0x14024822, // add r0, r0, r2 ; mov r2, ra_fir_off_val ++/* [0x00001ad0] */ 0x910cf1f6, 0xdc02480a, // shl r0, r0, v_dma_wh_shift ; mov rb10, ra3.8c ++/* [0x00001ad8] */ 0x8c59b1f6, 0x140246e1, // add ra_dma0, r0, rb_dma0_base ; mov r1, ra_wt_off_l0 ++/* [0x00001ae0] */ 0x5158a3d6, 0xd2024860, // shl r1, r1, i_wt_den_p5 ; mul24 r0, r2, ra_wt_mul_l0 ++/* [0x00001ae8] */ 0x8d667236, 0x14025320, // sub rb_wt_off, r1, r0 ; mov r0, ra_kmul_add ++/* [0x00001af0] */ 0x8c59cc3f, 0xd21245a5, // add ra_wt_mul_l0, ra_wt_mul_l0, r0 ; mov r5rep, -4 ++/* [0x00001af8] */ 0x950e0dbf, 0x1e0252de, // mov rb11, ra3.8d ; mov ra_link, unif ++// :1 ++/* [0x00001b00] */ 0x8d151bf6, 0xb00269c4, // sub.setf -, r5, rb_i_tmu ; mov rb4, ra5 ; ldtmu1 ++/* [0x00001b08] */ 0x8e5539bf, 0x1202888f, // shr r2, r4, vrx_xshift ; mov.ifz vra_base, vrx_base_next ++/* [0x00001b10] */ 0x8e4505f6, 0xd202c863, // shr r1, r2, v_v_shift ; mov.ifnz r3, vra_y ++/* [0x00001b18] */ 0x8c4c3ff6, 0x1202a9e3, // add.setf -, rb_ef, rb_ef ; mov.ifz r3, vra_y_next ++/* [0x00001b20] */ 0x8c531789, 0xda124460, // add vra_y, r3, ra_k1 ; mov r0, r1 << 15 ++/* [0x00001b28] */ 0x9353f792, 0xd803c8e1, // max r3, r3, ra_k0 ; mov.ifnc r1, r2 << 1 ++/* [0x00001b30] */ 0x929de7d2, 0x1003c8e0, // min r3, r3, rb_max_y ; mov.ifnc r0, r2 ++/* [0x00001b38] */ 0x545d039f, 0x12024863, // and r1, r1, ra_pmax ; mul24 r3, r3, rb_pitch ++/* [0x00001b40] */ 0x8c5cfec6, 0x12024f20, // add vr_txs, vra_base, r3 ; v8min r0, r0, ra_pmax ++/* [0x00001b48] */ 0x4c001bf0, 0xd8025963, // add r5rep, r5, 1 ; mul24 r3, ra0.8a, r0 ++/* [0x00001b50] */ 0x4d01fef1, 0x1e0248a3, // sub r2, rb_fir_off_h, r3 ; mul24 r3, ra0.8d, r1 ++/* [0x00001b58] */ 0x4d03e4f0, 0xda0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8b << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00001b60] */ 0x40034031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00001b68] */ 0x4c03c4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 4, r0 << 4 @ "mul_used", 0 ++/* [0x00001b70] */ 0x4c032b71, 0xdc0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra0.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00001b78] */ 0xffffff68, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00001b80] */ 0x4c1ca4f7, 0x100248a0, // add r2, r2, r3 ; mul24 r0, ra7, rb10 ++/* [0x00001b88] */ 0x550c6ffe, 0x1a024161, // mov ra5, rb6 ; mul24 r1, rb6, ra3.8b ++/* [0x00001b90] */ 0x8f1c25f6, 0xd00241c6, // asr ra7, r2, v_bit_depth - 8 ; mov rb6, ra7 ++/* [0x00001b98] */ 0x4c0c423e, 0x18024860, // add r1, r1, r0 ; mul24 r0, rb4, ra3.8a ++/* [0x00001ba0] */ 0x4d1cb237, 0x10024860, // sub r1, r1, r0 ; mul24 r0, ra7, rb11 ++/* [0x00001ba8] */ 0x0d9e7200, 0x10020867, // sub r1, r1, r0 ++/* [0x00001bb0] */ 0x8f5c63f6, 0xdc024863, // asr r1, r1, 6 ; mov r3, ra_blk_height ++/* [0x00001bb8] */ 0x4d592bce, 0x120269e0, // sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x00001bc0] */ 0x4c64c1ce, 0x14024821, // add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add ++/* [0x00001bc8] */ 0xed427073, 0x12024860, // sub r1, r0, r1 ; v8subs r0, ra_height, r3 ++/* [0x00001bd0] */ 0xffffff10, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00001bd8] */ 0x0f9cb3c0, 0xd0020867, // asr r1, r1, i_wt_den_p6 ++/* [0x00001be0] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00001be8] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x00001bf0] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x00001bf8] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00001c00] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x00001c08] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x00001c10] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x00001c18] */ 0xfffffec8, 0xf0f809e7, // brr -, r:1b ++/* [0x00001c20] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00001c28] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00001c30] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_c10_b ++/* [0x00001c38] */ 0x9581cff6, 0x10025c42, // mov vw_setup, rb_vpm_init ; mov ra2, unif ++/* [0x00001c40] */ 0x8c803ff6, 0x100269e3, // add.setf -, rb_ef, rb_ef ; mov r3, unif ++/* [0x00001c48] */ 0xf1082dc9, 0xd4024825, // shl r0, ra2.16b, v_x_shift ; v8subs r5rep, r1, r1 ++/* [0x00001c50] */ 0x8c0821f6, 0x12225813, // add r0, r0, rb_elem_x ; mov ra_y_next, ra2.16a ++/* [0x00001c58] */ 0x8d810bf6, 0x10025850, // sub r1, r5, rb_pitch ; mov ra_width_height, unif ++/* [0x00001c60] */ 0x93567176, 0x14125815, // max r0, r0, r5 ; mov ra_xshift, ra_xshift_next ++/* [0x00001c68] */ 0x9281a1f6, 0x10025800, // min r0, r0, rb_max_x ; mov ra0, unif ++/* [0x00001c70] */ 0x9481c1f6, 0xd0025802, // and r0, r0, -4 ; mov ra2, unif ++/* [0x00001c78] */ 0x54404077, 0xd4024862, // and r1, r0, r1 ; mul24 r2, ra_width, v_x_mul ++/* [0x00001c80] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00001c88] */ 0x8c427076, 0x12024821, // add r0, r0, r1 ; mov r1, ra_height ++/* [0x00001c90] */ 0x8c9c163f, 0x10024680, // add ra_base_next, r3, r0 ; mov rb_xshift2, rb_xshift2_next ++/* [0x00001c98] */ 0x8d819eb6, 0x10025756, // sub rb_dma1, rb_dma1_base, r2 ; mov ra_wt_off_mul_l0, unif ++/* [0x00001ca0] */ 0x8c5dc3ce, 0xdc025461, // add rb_i_tmu, r1, (3-4) - PREREAD ; v8min r1, r1, ra_blk_height ++/* [0x00001ca8] */ 0x8c59f3f6, 0xd4139496, // add rb_lcount, r1, (3-4) ; mov.ifc ra_wt_mul_l0, ra_wt_off_l0 ++/* [0x00001cb0] */ 0x918083f6, 0xd0025803, // shl r0, r1, v_dma_h_shift ; mov ra3, unif ++/* [0x00001cb8] */ 0x8c8270b6, 0x10024823, // add r0, r0, r2 ; mov r3, unif ++/* [0x00001cc0] */ 0x910cf1f6, 0xd2125813, // shl r0, r0, v_dma_wh_shift ; mov ra_y2_next, ra3.16a ++/* [0x00001cc8] */ 0x8c0db1f6, 0x140246e0, // add ra_dma0, r0, rb_dma0_base ; mov r0, ra3.16b ++/* [0x00001cd0] */ 0x918021f6, 0xd0025801, // shl r0, r0, v_x_shift ; mov ra1, unif ++/* [0x00001cd8] */ 0x8c8021f6, 0x10025803, // add r0, r0, rb_elem_x ; mov ra3, unif ++/* [0x00001ce0] */ 0x8d810bf6, 0x10025852, // sub r1, r5, rb_pitch ; mov ra_wt_off_mul_l1, unif ++/* [0x00001ce8] */ 0x939de17f, 0x10025809, // max r0, r0, r5 ; mov ra9, rb_max_y ++/* [0x00001cf0] */ 0x9265a1f6, 0x14024822, // min r0, r0, rb_max_x ; mov r2, ra_kmul_add ++/* [0x00001cf8] */ 0x9481c1f6, 0xd0039812, // and r0, r0, -4 ; mov.ifc ra_wt_off_mul_l1, unif ++/* [0x00001d00] */ 0x949dc07f, 0xd0024865, // and r1, r0, r1 ; mov r5rep, -4 ++/* [0x00001d08] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00001d10] */ 0x8c827076, 0x1002581c, // add r0, r0, r1 ; mov ra_dest, unif ++/* [0x00001d18] */ 0x8c667636, 0x140254e0, // add rb_base2_next, r3, r0 ; mov r0, ra_fir_off_val ++/* [0x00001d20] */ 0x4c5a7c86, 0x121245a1, // add ra_wt_mul_l0, ra_wt_mul_l0, r2 ; mul24 r1, r0, ra_wt_mul_l0 ++/* [0x00001d28] */ 0x4c4a7c86, 0x121244a0, // add ra_wt_mul_l1, ra_wt_mul_l1, r2 ; mul24 r0, r0, ra_wt_mul_l1 ++/* [0x00001d30] */ 0x8c4a7076, 0x14024821, // add r0, r0, r1 ; mov r1, ra_wt_off_l1 ++/* [0x00001d38] */ 0x910cb3f6, 0xde02484b, // shl r1, r1, i_wt_den_p6 ; mov rb11, ra3.8d ++/* [0x00001d40] */ 0x8d827236, 0x1002531e, // sub rb_wt_off, r1, r0 ; mov ra_link, unif ++/* [0x00001d48] */ 0x95080ff6, 0x1e024287, // mov ra10, rb_xshift2 ; mov rb7, ra2.8d ++// :1 ++/* [0x00001d50] */ 0x0d9d1bc0, 0xa00229e7, // sub.setf -, r5, rb_i_tmu ; nop ; ldtmu0 ++/* [0x00001d58] */ 0x8e5539bf, 0x1202888f, // shr r2, r4, ra_xshift ; mov.ifz rb_base2, rb_base2_next ++/* [0x00001d60] */ 0x8e4d05f6, 0xd0029851, // shr r1, r2, v_v_shift ; mov.ifz ra_y_y2, ra_y_y2_next ++/* [0x00001d68] */ 0x8c683ff6, 0x1002b9d8, // add.setf -, rb_ef, rb_ef ; mov.ifz ra_base, ra_base_next ++/* [0x00001d70] */ 0x8c441fb6, 0xd4224463, // add ra_y, 1, ra_y ; mov r3, ra_y ++/* [0x00001d78] */ 0x93531789, 0xd80248e0, // max r3, r3, ra_k0 ; mov r0, r1 << 15 ++/* [0x00001d80] */ 0x9227f792, 0xd003c8e1, // min r3, r3, ra9 ; mov.ifnc r1, r2 << 1 ++/* [0x00001d88] */ 0x559d049f, 0x100e4823, // mov.ifnc r0, r2 ; mul24 r3, r3, rb_pitch ++/* [0x00001d90] */ 0x8c618cc7, 0x10024e20, // add t0s, ra_base, r3 ; v8min r0, r0, rb_pmask ++/* [0x00001d98] */ 0x540183f0, 0x18024862, // and r1, r1, rb_pmask ; mul24 r2, ra0.8a, r0 ++/* [0x00001da0] */ 0x4d01feb1, 0x1e0248a3, // sub r2, rb_fir_off_h, r2 ; mul24 r3, ra0.8d, r1 ++/* [0x00001da8] */ 0x4d03e4f0, 0xda0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8b << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00001db0] */ 0x40034031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00001db8] */ 0x4c03c4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 4, r0 << 4 @ "mul_used", 0 ++/* [0x00001dc0] */ 0x40032031, 0xdc0109e3, // nop ; mul24.ifn r3, ra0.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00001dc8] */ 0x4c0854fe, 0xb8025804, // add r0, r2, r3 ; mul24 ra4, rb5, ra2.8a ; ldtmu1 ++/* [0x00001dd0] */ 0x8e2869bf, 0x10024885, // shr r2, r4, ra10 ; mov rb5, rb6 ++/* [0x00001dd8] */ 0x8e4505f6, 0xd2024863, // shr r1, r2, v_v_shift ; mov r3, ra_y2 ++/* [0x00001de0] */ 0x8e1c21f6, 0xd00241c6, // shr ra7, r0, v_bit_depth - 8 ; mov rb6, ra7 ++/* [0x00001de8] */ 0x8c531789, 0xda124460, // add ra_y2, r3, ra_k1 ; mov r0, r1 << 15 ++/* [0x00001df0] */ 0x9353f792, 0xd803c8e1, // max r3, r3, ra_k0 ; mov.ifnc r1, r2 << 1 ++/* [0x00001df8] */ 0x925de7ce, 0x120248e1, // min r3, r3, rb_max_y ; v8min r1, r1, ra_pmax ++/* [0x00001e00] */ 0x559d049f, 0x100e4823, // mov.ifnc r0, r2 ; mul24 r3, r3, rb_pitch ++/* [0x00001e08] */ 0x8c5cfec6, 0x12024f20, // add t1s, rb_base2, r3 ; v8min r0, r0, ra_pmax ++/* [0x00001e10] */ 0x4c041bf0, 0xd8025962, // add r5rep, r5, 1 ; mul24 r2, ra1.8a, r0 ++/* [0x00001e18] */ 0x4d05feb1, 0x1e0248a3, // sub r2, rb_fir_off_h, r2 ; mul24 r3, ra1.8d, r1 ++/* [0x00001e20] */ 0x4d07e4f0, 0xda0248a3, // sub r2, r2, r3 ; mul24 r3, ra1.8b << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00001e28] */ 0x40074031, 0xda0109e3, // nop ; mul24.ifn r3, ra1.8b << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00001e30] */ 0x4c07c6b0, 0xdc0248a3, // add r2, r3, r2 ; mul24 r3, ra1.8c << 4, r0 << 4 @ "mul_used", 0 ++/* [0x00001e38] */ 0x4c072b71, 0xdc0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00001e40] */ 0xfffffef0, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00001e48] */ 0x4c0c94fe, 0x180248a0, // add r2, r2, r3 ; mul24 r0, rb9, ra3.8a ++/* [0x00001e50] */ 0x550caffe, 0x1a025261, // mov rb9, rb10 ; mul24 r1, rb10, ra3.8b ++/* [0x00001e58] */ 0x8e2c25f6, 0xd00242ca, // shr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 ++/* [0x00001e60] */ 0x4d08523e, 0x1a0248a1, // sub r2, r1, r0 ; mul24 r1, rb5, ra2.8b ++/* [0x00001e68] */ 0x8d112bf6, 0x100269e0, // sub.setf -, r5, rb_lcount ; mov r0, ra4 ++/* [0x00001e70] */ 0x4d08623e, 0x1c024860, // sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++/* [0x00001e78] */ 0x4c1c7237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra7, rb7 ++/* [0x00001e80] */ 0x4d0ca23e, 0x1c024860, // sub r1, r1, r0 ; mul24 r0, rb10, ra3.8c ++/* [0x00001e88] */ 0x4c2cb437, 0x100248a0, // add r2, r2, r0 ; mul24 r0, ra11, rb11 ++/* [0x00001e90] */ 0x0d9e7400, 0x100208a7, // sub r2, r2, r0 ++/* [0x00001e98] */ 0x0e9c63c0, 0xd0020867, // shr r1, r1, 6 ++/* [0x00001ea0] */ 0x4e5865ce, 0xd20248a0, // shr r2, r2, 6 ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x00001ea8] */ 0x4c4a7456, 0x120248a1, // add r2, r2, r1 ; mul24 r1, r2, ra_wt_mul_l1 ++/* [0x00001eb0] */ 0x4c667216, 0x14024862, // add r1, r1, r0 ; mul24 r2, r2, ra_kmul_add ++/* [0x00001eb8] */ 0x8d5e72b6, 0x1c024863, // sub r1, r1, r2 ; mov r3, ra_blk_height ++/* [0x00001ec0] */ 0xec40c3f3, 0x12024860, // add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 ++/* [0x00001ec8] */ 0xfffffe68, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00001ed0] */ 0x0f667380, 0x18020867, // asr r1, r1, ra_wt_den_p7 ++/* [0x00001ed8] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00001ee0] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x00001ee8] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x00001ef0] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00001ef8] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x00001f00] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x00001f08] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x00001f10] */ 0xfffffe20, 0xf0f809e7, // brr -, r:1b ++/* [0x00001f18] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00001f20] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00001f28] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_sync10_q0 ++/* [0x00001f30] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00001f38] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001f40] */ 0x00000010, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00001f48] */ 0x00000010, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00001f50] */ 0x00000010, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00001f58] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00001f60] */ 0x0000001c, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00001f68] */ 0x00000001, 0xe80009e7, // mov dst, srel(i) ++/* [0x00001f70] */ 0x0000000d, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q1 ++/* [0x00001f78] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00001f80] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001f88] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00001f90] */ 0x00000000, 0xe80009e7, // mov dst, srel(i) ++/* [0x00001f98] */ 0x00000011, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00001fa0] */ 0x00000002, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q2 ++/* [0x00001fa8] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00001fb0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001fb8] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00001fc0] */ 0x00000000, 0xe80009e7, // mov dst, srel(i) ++/* [0x00001fc8] */ 0x00000012, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00001fd0] */ 0x00000003, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q3 ++/* [0x00001fd8] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00001fe0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00001fe8] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00001ff0] */ 0x00000000, 0xe80009e7, // mov dst, srel(i) ++/* [0x00001ff8] */ 0x00000013, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002000] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_sync10_q4 ++/* [0x00002008] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00002010] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00002018] */ 0x00000014, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002020] */ 0x00000014, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002028] */ 0x00000014, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002030] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00002038] */ 0x0000001d, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002040] */ 0x00000005, 0xe80009e7, // mov dst, srel(i) ++/* [0x00002048] */ 0x0000000e, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q5 ++/* [0x00002050] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00002058] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00002060] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00002068] */ 0x00000004, 0xe80009e7, // mov dst, srel(i) ++/* [0x00002070] */ 0x00000015, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002078] */ 0x00000006, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q6 ++/* [0x00002080] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00002088] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00002090] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00002098] */ 0x00000004, 0xe80009e7, // mov dst, srel(i) ++/* [0x000020a0] */ 0x00000016, 0xe80009e7, // mov dst, sacq(i) ++/* [0x000020a8] */ 0x00000007, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q7 ++/* [0x000020b0] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x000020b8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000020c0] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x000020c8] */ 0x00000004, 0xe80009e7, // mov dst, srel(i) ++/* [0x000020d0] */ 0x00000017, 0xe80009e7, // mov dst, sacq(i) ++/* [0x000020d8] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_sync10_q8 ++/* [0x000020e0] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x000020e8] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000020f0] */ 0x00000018, 0xe80009e7, // mov dst, sacq(i) ++/* [0x000020f8] */ 0x00000018, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002100] */ 0x00000018, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002108] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00002110] */ 0x0000001e, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002118] */ 0x00000009, 0xe80009e7, // mov dst, srel(i) ++/* [0x00002120] */ 0x0000000c, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q9 ++/* [0x00002128] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00002130] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00002138] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00002140] */ 0x00000008, 0xe80009e7, // mov dst, srel(i) ++/* [0x00002148] */ 0x00000019, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002150] */ 0x0000000a, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q10 ++/* [0x00002158] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00002160] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00002168] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00002170] */ 0x00000008, 0xe80009e7, // mov dst, srel(i) ++/* [0x00002178] */ 0x0000001a, 0xe80009e7, // mov dst, sacq(i) ++/* [0x00002180] */ 0x0000000b, 0xe80009e7, // mov dst, srel(i) ++// ::mc_sync10_q11 ++/* [0x00002188] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00002190] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00002198] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x000021a0] */ 0x00000008, 0xe80009e7, // mov dst, srel(i) ++/* [0x000021a8] */ 0x0000001b, 0xe80009e7, // mov dst, sacq(i) ++/* [0x000021b0] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_exit_c10_q0 ++// ::mc_exit_y10_q0 ++/* [0x000021b8] */ 0x00000002, 0xe00228e7, // mov.setf r3, PREREAD - 1 ++// :1 ++/* [0x000021c0] */ 0xffffffe0, 0xf03809e7, // brr.anynz -, r:1b ++/* [0x000021c8] */ 0x009e7000, 0xa00009e7, // nop ; nop ; ldtmu0 ++/* [0x000021d0] */ 0x009e7000, 0xb00009e7, // nop ; nop ; ldtmu1 ++/* [0x000021d8] */ 0x0d9c17c0, 0xd00228e7, // sub.setf r3, r3, 1 ++/* [0x000021e0] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x000021e8] */ 0x0000001c, 0xe80009e7, // mov dst, sacq(i) ++/* [0x000021f0] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x000021f8] */ 0x00000001, 0xe00209a7, // mov interrupt, 1 ++/* [0x00002200] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_exit_c10_qn ++// ::mc_exit_y10_qn ++/* [0x00002208] */ 0x00000002, 0xe00228e7, // mov.setf r3, PREREAD - 1 ++// :1 ++/* [0x00002210] */ 0xffffffe0, 0xf03809e7, // brr.anynz -, r:1b ++/* [0x00002218] */ 0x009e7000, 0xa00009e7, // nop ; nop ; ldtmu0 ++/* [0x00002220] */ 0x009e7000, 0xb00009e7, // nop ; nop ; ldtmu1 ++/* [0x00002228] */ 0x0d9c17c0, 0xd00228e7, // sub.setf r3, r3, 1 ++/* [0x00002230] */ 0x159f2fc0, 0x100009e7, // mov -, vw_wait ++/* [0x00002238] */ 0x009e7000, 0x300009e7, // nop ; nop ; thrend ++/* [0x00002240] */ 0x009e7000, 0x100009e7, // nop ++/* [0x00002248] */ 0x009e7000, 0x100009e7, // nop ++// ::mc_setup_y10_q0 ++/* [0x00002250] */ 0x0000000c, 0xe80009e7, // mov dst, srel(i) ++// ::mc_setup_y10_qn ++/* [0x00002258] */ 0x95801ff6, 0xd0025900, // mov tmurs, 1 ; mov ra0, unif ++/* [0x00002260] */ 0x15827d80, 0x10020267, // mov ra9, unif ++/* [0x00002268] */ 0x15827d80, 0x10020067, // mov ra1, unif ++/* [0x00002270] */ 0xaaaaff00, 0xe6020827, // mov r0, [0,2,0,2,0,2,0,2,1,3,1,3,1,3,1,3] ++/* [0x00002278] */ 0x9181e1f6, 0xd00250cb, // shl rb_ef, r0, i_shift30 ; mov ra11, unif ++/* [0x00002280] */ 0xff800100, 0xe0020527, // mov ra_kff800100, 0xff800100 ++/* [0x00002288] */ 0x0000ffff, 0xe0021627, // mov rb_pmask, v_pmask ++/* [0x00002290] */ 0x000803ff, 0xe00205e7, // mov ra_blk_height_pmax, ((1 << v_bit_depth) - 1) | (v_blk_height << 16) ++/* [0x00002298] */ 0x00010000, 0xe00217e7, // mov rb_fir_off_h, (FIR_OFFSET << (v_bit_depth - 8)) ++/* [0x000022a0] */ 0x4000000c, 0xe0020667, // mov ra_fir_off_val_wt_den_p7, (FIR_OFFSET << 16) | (DENOM + 15 - v_bit_depth) ++/* [0x000022a8] */ 0x050b0a00, 0xe0021567, // mov rb_y_coeffs_2, 0x050b0a00 ++/* [0x000022b0] */ 0x11283a40, 0xe00215a7, // mov rb_y_coeffs_3, 0x11283a40 ++/* [0x000022b8] */ 0x0a0b0500, 0xe00215e7, // mov rb_y_coeffs_5, 0x0a0b0500 ++/* [0x000022c0] */ 0x15827d80, 0x100200e7, // mov ra3, unif ++/* [0x000022c8] */ 0x95803ff6, 0x10024754, // mov ra_ef, rb_ef ; mov rb_xpitch, unif ++/* [0x000022d0] */ 0x0d0c1dc0, 0xd4020827, // sub r0, ra3.16b, 1 ++/* [0x000022d8] */ 0x119c11c0, 0xd00216a7, // shl rb_max_x, r0, v_x_shift ++/* [0x000022e0] */ 0x0d0c1dc0, 0xd20217a7, // sub rb_max_y, ra3.16a, 1 ++/* [0x000022e8] */ 0x959a0dbf, 0x100248d0, // mov r3, elem_num ; mov rb_pitch, unif ++/* [0x000022f0] */ 0xc0000000, 0xe0020867, // mov r1, vdw_setup_1(0) ++/* [0x000022f8] */ 0x159d03c0, 0x10021667, // or rb_dma1_base, r1, rb_pitch ++/* [0x00002300] */ 0x0c027cc0, 0x14020827, // add r0, ra0.16b, r3 ++/* [0x00002308] */ 0x119c11c0, 0xd0020827, // shl r0, r0, v_x_shift ++/* [0x00002310] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 ++/* [0x00002318] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x00002320] */ 0x119c31c0, 0xd0220567, // shl ra_xshift_next, r0, 3 ++/* [0x00002328] */ 0xf49dc1d2, 0xd0024822, // and r0, r0, -4 ; v8subs r2, r2, r2 ++/* [0x00002330] */ 0x0d9d05c0, 0x100208a7, // sub r2, r2, rb_pitch ++/* [0x00002338] */ 0x149e7080, 0x10020867, // and r1, r0, r2 ++/* [0x00002340] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00002348] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00002350] */ 0x0c267c00, 0x10020627, // add ra_base, ra9, r0 ++/* [0x00002358] */ 0x0c067cc0, 0x14020827, // add r0, ra1.16b, r3 ++/* [0x00002360] */ 0x119c11c0, 0xd0020827, // shl r0, r0, v_x_shift ++/* [0x00002368] */ 0x139c01c0, 0xd0020827, // max r0, r0, 0 ++/* [0x00002370] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x00002378] */ 0x119c31c0, 0xd0021067, // shl rb_xshift2_next, r0, 3 ++/* [0x00002380] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x00002388] */ 0x149e7080, 0x10020867, // and r1, r0, r2 ++/* [0x00002390] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00002398] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000023a0] */ 0x0c2e7c00, 0x100213e7, // add rb_base2, ra11, r0 ++/* [0x000023a8] */ 0x80027036, 0x120049e0, // nop ; mov r0, ra0.16a ++/* [0x000023b0] */ 0x95043ff6, 0xd20248e2, // mov r3, PREREAD ; mov r2, ra1.16a ++// :1 ++/* [0x000023b8] */ 0x0d9c17c0, 0xd00228e7, // sub.setf r3, r3, 1 ++/* [0x000023c0] */ 0x139c01c0, 0xd0020867, // max r1, r0, 0 ++/* [0x000023c8] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_max_y ++/* [0x000023d0] */ 0x4c51018f, 0x1a024821, // add r0, r0, ra_k1 ; mul24 r1, r1, rb_pitch ++/* [0x000023d8] */ 0x8c627c40, 0x10225e11, // add t0s, ra_base, r1 ; mov ra_y, r0 ++/* [0x000023e0] */ 0x139c05c0, 0xd0020867, // max r1, r2, 0 ++/* [0x000023e8] */ 0xffffffb0, 0xf03809e7, // brr.anynz -, r:1b ++/* [0x000023f0] */ 0x129de3c0, 0x10020867, // min r1, r1, rb_max_y ++/* [0x000023f8] */ 0x4c51058f, 0x1a0248a1, // add r2, r2, ra_k1 ; mul24 r1, r1, rb_pitch ++/* [0x00002400] */ 0x8c9cfe52, 0x10125f11, // add t1s, rb_base2, r1 ; mov ra_y2, r2 ++/* [0x00002408] */ 0x159e6fc0, 0x100208a7, // mov r2, qpu_num ++/* [0x00002410] */ 0x0f9c15c0, 0xd0020867, // asr r1, r2, 1 ++/* [0x00002418] */ 0x119c43c0, 0xd0020867, // shl r1, r1, 4 ++/* [0x00002420] */ 0x149c15c0, 0xd0020827, // and r0, r2, 1 ++/* [0x00002428] */ 0x159e7040, 0x10020827, // or r0, r0, r1 ++/* [0x00002430] */ 0x00002900, 0xe0020867, // mov r1, vpm_setup(0, 2, h16p(0, 0)) ++/* [0x00002438] */ 0x0c9e7040, 0x10021727, // add r_vpm, r0, r1 ++/* [0x00002440] */ 0x80004002, 0xe0020867, // mov r1, vdw_setup_0(0, 0, dma_h16p(0,0,0)) ++/* [0x00002448] */ 0x119c61c0, 0xd0020827, // shl r0, r0, 6 ++/* [0x00002450] */ 0x0c9e7040, 0x100216e7, // add r_dma, r0, r1 ++/* [0x00002458] */ 0x15827d80, 0x100207a7, // mov ra_link, unif ++/* [0x00002460] */ 0x00000000, 0xe0024208, // mov ra8, 0 ; mov rb8, 0 ++/* [0x00002468] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00002470] */ 0x00000000, 0xe0024249, // mov ra9, 0 ; mov rb9, 0 ++/* [0x00002478] */ 0x00000000, 0xe002428a, // mov ra10, 0 ; mov rb10, 0 ++/* [0x00002480] */ 0x00000000, 0xe00242cb, // mov ra11, 0 ; mov rb11, 0 ++// :per_block_setup_10 ++/* [0x00002488] */ 0x119c11c0, 0xd0020827, // shl r0, r0, v_x_shift ++/* [0x00002490] */ 0x93567176, 0x14125815, // max r0, r0, r5 ; mov ra_xshift, ra_xshift_next ++/* [0x00002498] */ 0x129da1c0, 0x10020827, // min r0, r0, rb_max_x ++/* [0x000024a0] */ 0x119c31c0, 0xd0220567, // shl ra_xshift_next, r0, 3 ++/* [0x000024a8] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x000024b0] */ 0x8d810bf6, 0x1002589a, // sub r2, r5, rb_pitch ; mov ra_base_next, unif ++/* [0x000024b8] */ 0x940270b6, 0x12225853, // and r1, r0, r2 ; mov ra_y_next, ra0.16a ++/* [0x000024c0] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x000024c8] */ 0x8c827076, 0x10025801, // add r0, r0, r1 ; mov ra1, unif ++/* [0x000024d0] */ 0x0c6a7c00, 0x100206a7, // add ra_base_next, ra_base_next, r0 ++/* [0x000024d8] */ 0x0c067cc0, 0x14020827, // add r0, ra1.16b, r3 ++/* [0x000024e0] */ 0x119c11c0, 0xd0020827, // shl r0, r0, v_x_shift ++/* [0x000024e8] */ 0x93067176, 0x12125813, // max r0, r0, r5 ; mov ra_y2_next, ra1.16a ++/* [0x000024f0] */ 0x9281a1f6, 0x10024813, // min r0, r0, rb_max_x ; mov rb_base2_next, unif ++/* [0x000024f8] */ 0x119c31c0, 0xd0021067, // shl rb_xshift2_next, r0, 3 ++/* [0x00002500] */ 0x9481c1f6, 0xd0025810, // and r0, r0, -4 ; mov ra_width_height, unif ++/* [0x00002508] */ 0x949dc0bf, 0x10024871, // and r1, r0, r2 ; mov vw_setup, rb_vpm_init ++/* [0x00002510] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00002518] */ 0x4c402077, 0xd4024821, // add r0, r0, r1 ; mul24 r1, ra_width, v_x_mul ++/* [0x00002520] */ 0x0c9d3e00, 0x100214e7, // add rb_base2_next, rb_base2_next, r0 ++/* [0x00002528] */ 0x8d419e76, 0x12025760, // sub rb_dma1, rb_dma1_base, r1 ; mov r0, ra_height ++/* [0x00002530] */ 0x8c5dc1c6, 0xdc025460, // add rb_i_tmu, r0, (7-8) - PREREAD ; v8min r0, r0, ra_blk_height ++/* [0x00002538] */ 0x0c9df1c0, 0xd00214a7, // add rb_lcount, r0, (7-8) ++/* [0x00002540] */ 0x916481f6, 0xd4024823, // shl r0, r0, v_dma_h_shift ; mov r3, ra_kmul_add ++/* [0x00002548] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x00002550] */ 0x9164f1f6, 0xd4024822, // shl r0, r0, v_dma_wh_shift ; mov r2, ra_fir_off_val ++/* [0x00002558] */ 0x8c81b1f6, 0x100246e0, // add ra_dma0, r0, rb_dma0_base ; mov r0, unif ++/* [0x00002560] */ 0x918101f6, 0xd00a5816, // shl.ifnn r0, r0, i_shift16 ; mov ra_wt_off_mul_l0, unif ++/* [0x00002568] */ 0x915031f6, 0xde024205, // shl ra8, r0, 3 ; mov rb5, ra_k255 ++/* [0x00002570] */ 0x01040400, 0xe0020867, // mov r1, 0x01040400 ++/* [0x00002578] */ 0x10227380, 0x1e5200a7, // ror ra2.8b, r1, ra8.8d ++/* [0x00002580] */ 0x10227380, 0x1c520027, // ror ra0.8b, r1, ra8.8c ++/* [0x00002588] */ 0x10215f80, 0x1e6200a7, // ror ra2.8c, rb_y_coeffs_2, ra8.8d ++/* [0x00002590] */ 0x10215f80, 0x1c620027, // ror ra0.8c, rb_y_coeffs_2, ra8.8c ++/* [0x00002598] */ 0x00010100, 0xe0020867, // mov r1,0x00010100 ++/* [0x000025a0] */ 0x902203bf, 0x1e025812, // ror r0, r1, ra8.8d ; mov ra_wt_off_mul_l1, unif ++/* [0x000025a8] */ 0x90205387, 0x1c424004, // ror ra0.8a, r1, ra8.8c ; v8min rb4, r0, rb5 ++/* [0x000025b0] */ 0x914883f6, 0xd0031856, // shl r1, r1, 8 ; mov.ifn ra_wt_off_mul_l0, ra_wt_off_mul_l1 ++/* [0x000025b8] */ 0x902203bf, 0x1e02581c, // ror r0, r1, ra8.8d ; mov ra_dest, unif ++/* [0x000025c0] */ 0x90205387, 0x1c72404b, // ror ra1.8d, r1, ra8.8c ; v8min rb11, r0, rb5 ++/* [0x000025c8] */ 0x10216f80, 0x1e7200a7, // ror ra2.8d, rb_y_coeffs_3, ra8.8d ++/* [0x000025d0] */ 0x10216f80, 0x1c720027, // ror ra0.8d, rb_y_coeffs_3, ra8.8c ++/* [0x000025d8] */ 0x10217f80, 0x1e5200e7, // ror ra3.8b, rb_y_coeffs_5, ra8.8d ++/* [0x000025e0] */ 0x10217f80, 0x1c520067, // ror ra1.8b, rb_y_coeffs_5, ra8.8c ++/* [0x000025e8] */ 0x04040100, 0xe0020867, // mov r1,0x04040100 ++/* [0x000025f0] */ 0x10227380, 0x1e6200e7, // ror ra3.8c, r1, ra8.8d ++/* [0x000025f8] */ 0x902183bf, 0xdc624065, // ror ra1.8c, r1, ra8.8c ; mov r5rep, -8 ++/* [0x00002600] */ 0x00000000, 0xf0f7c9e7, // bra -, ra_link ++/* [0x00002608] */ 0x3a281100, 0xe0020867, // mov r1,0x3a281100 ++/* [0x00002610] */ 0x902203bf, 0x1e02581e, // ror r0, r1, ra8.8d ; mov ra_link, unif ++/* [0x00002618] */ 0x90205387, 0x1c424048, // ror ra1.8a, r1, ra8.8c ; v8min rb8, r0, rb5 ++// ::mc_filter_y10_pxx ++/* [0x00002620] */ 0xfffffe48, 0xf0f807a7, // brr ra_link, r:per_block_setup_10 ++/* [0x00002628] */ 0x959a0ff6, 0x10024023, // mov ra0, unif ; mov r3, elem_num ++/* [0x00002630] */ 0xec9c3fd2, 0x100269e5, // add.setf -, rb_ef, rb_ef ; v8subs r5rep, r2, r2 ++/* [0x00002638] */ 0x8c001cff, 0x14024800, // add r0, ra0.16b, r3 ; mov rb_xshift2, rb_xshift2_next ++/* [0x00002640] */ 0x1158adc0, 0xd4020867, // shl r1, ra_wt_off_l0, i_wt_den_p5 ++/* [0x00002648] */ 0x4c5a7cd6, 0x121245a0, // add ra_wt_mul_l0, ra_wt_mul_l0, r3 ; mul24 r0, r2, ra_wt_mul_l0 ++/* [0x00002650] */ 0x8d9c423f, 0x1042531d, // sub rb_wt_off, r1, r0 ; mov ra_ef.8a, rb4 ++// :1 ++/* [0x00002658] */ 0x4c745dbe, 0x100279c4, // add.setf -, ra_ef, ra_ef ; mul24 ra4, rb5, ra_ef ++/* [0x00002660] */ 0x93440dff, 0xd40248a1, // max r2, ra_y, 0 ; mov r1, 0 ++/* [0x00002668] */ 0x9251e5f6, 0x1a0248a3, // min r2, r2, rb_max_y ; mov r3, ra_k1 ++/* [0x00002670] */ 0x4c450cd7, 0xa4224462, // add ra_y, ra_y, r3 ; mul24 r2, r2, rb_pitch ; ldtmu0 ++/* [0x00002678] */ 0x8c606cbf, 0x10024e05, // add t0s, ra_base, r2 ; mov rb5, rb6 ++/* [0x00002680] */ 0x8e5479bf, 0x12024806, // shr r0, r4, ra_xshift ; mov rb6, rb7 ++/* [0x00002688] */ 0x93458c47, 0xb20248a0, // max r2, ra_y2, r1 ; v8min r0, r0, rb_pmask ; ldtmu1 ++/* [0x00002690] */ 0x8e2009f6, 0x10024847, // shr r1, r4, rb_xshift2 ; mov rb7, ra8 ++/* [0x00002698] */ 0x925de5ce, 0x120248a1, // min r2, r2, rb_max_y ; v8min r1, r1, ra_pmax ++/* [0x000026a0] */ 0x4c450cd7, 0x12124462, // add ra_y2, ra_y2, r3 ; mul24 r2, r2, rb_pitch ++/* [0x000026a8] */ 0x8c24feb6, 0x10025f08, // add t1s, rb_base2, r2 ; mov ra8, ra9 ++/* [0x000026b0] */ 0x4c038af1, 0xd8025962, // add r5rep, r5, r3 ; mul24 r2, ra0.8a << 8, r1 << 8 @ "mul_used", 0 ++/* [0x000026b8] */ 0x5501fff0, 0x180348e2, // mov r3, rb_fir_off_h ; mul24.ifnn r2, ra0.8a, r0 ++/* [0x000026c0] */ 0x4d03f6b0, 0xda0248a3, // sub r2, r3, r2 ; mul24 r3, ra0.8b << 1, r0 << 1 @ "mul_used", 0 ++/* [0x000026c8] */ 0x40037031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 9, r1 << 9 @ "mul_used", 0 ++/* [0x000026d0] */ 0x4c03e4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 2, r0 << 2 @ "mul_used", 0 ++/* [0x000026d8] */ 0x40036031, 0xdc0109e3, // nop ; mul24.ifn r3, ra0.8c << 10, r1 << 10 @ "mul_used", 0 ++/* [0x000026e0] */ 0x4d03d4f0, 0xde0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8d << 3, r0 << 3 @ "mul_used", 0 ++/* [0x000026e8] */ 0x40035031, 0xde0109e3, // nop ; mul24.ifn r3, ra0.8d << 11, r1 << 11 @ "mul_used", 0 ++/* [0x000026f0] */ 0x4c07c4f0, 0xd80248a3, // add r2, r2, r3 ; mul24 r3, ra1.8a << 4, r0 << 4 @ "mul_used", 0 ++/* [0x000026f8] */ 0x40074031, 0xd80109e3, // nop ; mul24.ifn r3, ra1.8a << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00002700] */ 0x4c07b4f0, 0xda0248a3, // add r2, r2, r3 ; mul24 r3, ra1.8b << 5, r0 << 5 @ "mul_used", 0 ++/* [0x00002708] */ 0x40073031, 0xda0109e3, // nop ; mul24.ifn r3, ra1.8b << 13, r1 << 13 @ "mul_used", 0 ++/* [0x00002710] */ 0x4d07a4f0, 0xdc0248a3, // sub r2, r2, r3 ; mul24 r3, ra1.8c << 6, r0 << 6 @ "mul_used", 0 ++/* [0x00002718] */ 0x40072031, 0xdc0109e3, // nop ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00002720] */ 0x4c0794f0, 0xde0248a3, // add r2, r2, r3 ; mul24 r3, ra1.8d << 7, r0 << 7 @ "mul_used", 0 ++/* [0x00002728] */ 0x4c071b71, 0xde0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra1.8d << 15, r1 << 15 @ "mul_used", 0 ++/* [0x00002730] */ 0xffffff08, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00002738] */ 0x4d0854fe, 0x1a0248a1, // sub r2, r2, r3 ; mul24 r1, rb5, ra2.8b ++/* [0x00002740] */ 0x550caffe, 0x1a024260, // mov ra9, rb10 ; mul24 r0, rb10, ra3.8b ++/* [0x00002748] */ 0x8f2c25f6, 0xd00242ca, // asr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 ++/* [0x00002750] */ 0x4d08623e, 0x1c024860, // sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++/* [0x00002758] */ 0x4d08723e, 0x1e024860, // sub r1, r1, r0 ; mul24 r0, rb7, ra2.8d ++/* [0x00002760] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00002768] */ 0x4c0ca23e, 0x1c024860, // add r1, r1, r0 ; mul24 r0, rb10, ra3.8c ++/* [0x00002770] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00002778] */ 0x8d5d1bf6, 0x1c0269e3, // sub.setf -, r5, rb_i_tmu ; mov r3, ra_blk_height ++/* [0x00002780] */ 0x8d1133bf, 0x1002884f, // sub r1, r1, ra4 ; mov.ifz rb_base2, rb_base2_next ++/* [0x00002788] */ 0x8d6a7236, 0x10029858, // sub r1, r1, r0 ; mov.ifz ra_base, ra_base_next ++/* [0x00002790] */ 0x8f4c63f6, 0xd0029851, // asr r1, r1, 6 ; mov.ifz ra_y_y2, ra_y_y2_next ++/* [0x00002798] */ 0x4d592bce, 0x120269e0, // sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x000027a0] */ 0x4c64c1ce, 0x14024821, // add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add ++/* [0x000027a8] */ 0xed427073, 0x12024860, // sub r1, r0, r1 ; v8subs r0, ra_height, r3 ++/* [0x000027b0] */ 0xfffffe88, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x000027b8] */ 0x0f9cb3c0, 0xd0020867, // asr r1, r1, i_wt_den_p6 ++/* [0x000027c0] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x000027c8] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x000027d0] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x000027d8] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x000027e0] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x000027e8] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x000027f0] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x000027f8] */ 0xfffffe40, 0xf0f809e7, // brr -, r:1b ++/* [0x00002800] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00002808] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00002810] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_y10_p00 ++/* [0x00002818] */ 0x959a0ff6, 0x10024020, // mov ra0, unif ; mov r0, elem_num ++/* [0x00002820] */ 0xf5567dad, 0x14124565, // mov ra_xshift, ra_xshift_next ; v8subs r5rep, r5, r5 ++/* [0x00002828] */ 0x8c020c3f, 0x1402581a, // add r0, ra0.16b, r0 ; mov ra_base_next, unif ++/* [0x00002830] */ 0x119c11c0, 0xd0020827, // shl r0, r0, v_x_shift ++/* [0x00002838] */ 0x93027176, 0x12225813, // max r0, r0, r5 ; mov ra_y_next, ra0.16a ++/* [0x00002840] */ 0x9281a1f6, 0x10025810, // min r0, r0, rb_max_x ; mov ra_width_height, unif ++/* [0x00002848] */ 0x119c31c0, 0xd0220567, // shl ra_xshift_next, r0, 3 ++/* [0x00002850] */ 0x149dc1c0, 0xd0020827, // and r0, r0, -4 ++/* [0x00002858] */ 0x8d810bf6, 0x10025896, // sub r2, r5, rb_pitch ; mov ra_wt_off_mul_l0, unif ++/* [0x00002860] */ 0x149e7080, 0x10020867, // and r1, r0, r2 ++/* [0x00002868] */ 0x569d404f, 0x10024821, // xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++/* [0x00002870] */ 0x8c827076, 0x1002581c, // add r0, r0, r1 ; mov ra_dest, unif ++/* [0x00002878] */ 0x8c69cc3f, 0x100246b1, // add ra_base_next, ra_base_next, r0 ; mov vw_setup, rb_vpm_init ++/* [0x00002880] */ 0x11401dc0, 0xd4020867, // shl r1, ra_width, v_x_shift ++/* [0x00002888] */ 0x8d419e76, 0x12025760, // sub rb_dma1, rb_dma1_base, r1 ; mov r0, ra_height ++/* [0x00002890] */ 0x8d5c31c6, 0xdc025460, // sub rb_i_tmu, r0, PREREAD ; v8min r0, r0, ra_blk_height ++/* [0x00002898] */ 0x919c81c0, 0xd0024812, // shl r0, r0, v_dma_h_shift ; mov rb_lcount, r0 ++/* [0x000028a0] */ 0x0c9e7040, 0x10020827, // add r0, r0, r1 ++/* [0x000028a8] */ 0x1158edc0, 0xd4021327, // shl rb_wt_off, ra_wt_off_l0, DENOM + 7 ++/* [0x000028b0] */ 0x9180f1f6, 0xd002581e, // shl r0, r0, v_dma_wh_shift ; mov ra_link, unif ++/* [0x000028b8] */ 0x0c9db1c0, 0x100206e7, // add ra_dma0, r0, rb_dma0_base ++// :1 ++/* [0x000028c0] */ 0xcd511bee, 0x1a0269e5, // sub.setf -, r5, rb_i_tmu ; v8adds r5rep, r5, ra_k1 ++/* [0x000028c8] */ 0x804e7036, 0xa42099d1, // nop ; mov.ifz ra_y, ra_y_next ; ldtmu0 ++/* [0x000028d0] */ 0x8e5509bf, 0x12024823, // shr r0, r4, ra_xshift ; mov r3, rb_pitch ++/* [0x000028d8] */ 0x13440dc0, 0xd40208a7, // max r2, ra_y, 0 ++/* [0x000028e0] */ 0x9269e5f6, 0x10029898, // min r2, r2, rb_max_y ; mov.ifz ra_base, ra_base_next ++/* [0x000028e8] */ 0x4c441dd3, 0xd4224462, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x000028f0] */ 0x8c618c87, 0x10024e20, // add t0s, ra_base, r2 ; v8min r0, r0, rb_pmask ++/* [0x000028f8] */ 0x4d592bc6, 0x120269e1, // sub.setf -, r5, rb_lcount ; mul24 r1, r0, ra_wt_mul_l0 ++/* [0x00002900] */ 0x915c83f6, 0xdc024863, // shl r1, r1, 8 ; mov r3, ra_blk_height ++/* [0x00002908] */ 0xec40c3f3, 0x12024860, // add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 ++/* [0x00002910] */ 0xffffff90, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00002918] */ 0x0f9cf3c0, 0xd0020867, // asr r1, r1, DENOM + 8 ++/* [0x00002920] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00002928] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x00002930] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x00002938] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00002940] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x00002948] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x00002950] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x00002958] */ 0xffffff48, 0xf0f809e7, // brr -, r:1b ++/* [0x00002960] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00002968] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00002970] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_y10_bxx ++/* [0x00002978] */ 0xfffffaf0, 0xf0f807a7, // brr ra_link, r:per_block_setup_10 ++/* [0x00002980] */ 0x959a0ff6, 0x10024023, // mov ra0, unif ; mov r3, elem_num ++/* [0x00002988] */ 0xec9c3fd2, 0x100269e5, // add.setf -, rb_ef, rb_ef ; v8subs r5rep, r2, r2 ++/* [0x00002990] */ 0x8c001cff, 0x14024800, // add r0, ra0.16b, r3 ; mov rb_xshift2, rb_xshift2_next ++/* [0x00002998] */ 0x1158bdc0, 0xd4020867, // shl r1, ra_wt_off_l0, i_wt_den_p6 ++/* [0x000029a0] */ 0x4c5a7cd6, 0x121245a0, // add ra_wt_mul_l0, ra_wt_mul_l0, r3 ; mul24 r0, r2, ra_wt_mul_l0 ++/* [0x000029a8] */ 0x4d4a7216, 0x12024860, // sub r1, r1, r0 ; mul24 r0, r2, ra_wt_mul_l1 ++/* [0x000029b0] */ 0x8d9c423f, 0x1042531d, // sub rb_wt_off, r1, r0 ; mov ra_ef.8a, rb4 ++// :1 ++/* [0x000029b8] */ 0x4c745dbe, 0x100279c4, // add.setf -, ra_ef, ra_ef ; mul24 ra4, rb5, ra_ef ++/* [0x000029c0] */ 0x93440dff, 0xd40248a1, // max r2, ra_y, 0 ; mov r1, 0 ++/* [0x000029c8] */ 0x9251e5f6, 0x1a0248a3, // min r2, r2, rb_max_y ; mov r3, ra_k1 ++/* [0x000029d0] */ 0x4c450cd7, 0xa4224462, // add ra_y, ra_y, r3 ; mul24 r2, r2, rb_pitch ; ldtmu0 ++/* [0x000029d8] */ 0x8c606cbf, 0x10024e05, // add t0s, ra_base, r2 ; mov rb5, rb6 ++/* [0x000029e0] */ 0x8e5479bf, 0x12024806, // shr r0, r4, ra_xshift ; mov rb6, rb7 ++/* [0x000029e8] */ 0x93458c47, 0xb20248a0, // max r2, ra_y2, r1 ; v8min r0, r0, rb_pmask ; ldtmu1 ++/* [0x000029f0] */ 0x8e2009f6, 0x10024847, // shr r1, r4, rb_xshift2 ; mov rb7, ra8 ++/* [0x000029f8] */ 0x925de5ce, 0x120248a1, // min r2, r2, rb_max_y ; v8min r1, r1, ra_pmax ++/* [0x00002a00] */ 0x4c450cd7, 0x12124462, // add ra_y2, ra_y2, r3 ; mul24 r2, r2, rb_pitch ++/* [0x00002a08] */ 0x8c24feb6, 0x10025f08, // add t1s, rb_base2, r2 ; mov ra8, ra9 ++/* [0x00002a10] */ 0x4c038af1, 0xd8025962, // add r5rep, r5, r3 ; mul24 r2, ra0.8a << 8, r1 << 8 @ "mul_used", 0 ++/* [0x00002a18] */ 0x5501fff0, 0x180348e2, // mov r3, rb_fir_off_h ; mul24.ifnn r2, ra0.8a, r0 ++/* [0x00002a20] */ 0x4d03f6b0, 0xda0248a3, // sub r2, r3, r2 ; mul24 r3, ra0.8b << 1, r0 << 1 @ "mul_used", 0 ++/* [0x00002a28] */ 0x40037031, 0xda0109e3, // nop ; mul24.ifn r3, ra0.8b << 9, r1 << 9 @ "mul_used", 0 ++/* [0x00002a30] */ 0x4c03e4f0, 0xdc0248a3, // add r2, r2, r3 ; mul24 r3, ra0.8c << 2, r0 << 2 @ "mul_used", 0 ++/* [0x00002a38] */ 0x40036031, 0xdc0109e3, // nop ; mul24.ifn r3, ra0.8c << 10, r1 << 10 @ "mul_used", 0 ++/* [0x00002a40] */ 0x4d03d4f0, 0xde0248a3, // sub r2, r2, r3 ; mul24 r3, ra0.8d << 3, r0 << 3 @ "mul_used", 0 ++/* [0x00002a48] */ 0x40035031, 0xde0109e3, // nop ; mul24.ifn r3, ra0.8d << 11, r1 << 11 @ "mul_used", 0 ++/* [0x00002a50] */ 0x4c07c4f0, 0xd80248a3, // add r2, r2, r3 ; mul24 r3, ra1.8a << 4, r0 << 4 @ "mul_used", 0 ++/* [0x00002a58] */ 0x40074031, 0xd80109e3, // nop ; mul24.ifn r3, ra1.8a << 12, r1 << 12 @ "mul_used", 0 ++/* [0x00002a60] */ 0x4c07b4f0, 0xda0248a3, // add r2, r2, r3 ; mul24 r3, ra1.8b << 5, r0 << 5 @ "mul_used", 0 ++/* [0x00002a68] */ 0x40073031, 0xda0109e3, // nop ; mul24.ifn r3, ra1.8b << 13, r1 << 13 @ "mul_used", 0 ++/* [0x00002a70] */ 0x4d07a4f0, 0xdc0248a3, // sub r2, r2, r3 ; mul24 r3, ra1.8c << 6, r0 << 6 @ "mul_used", 0 ++/* [0x00002a78] */ 0x40072031, 0xdc0109e3, // nop ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 ++/* [0x00002a80] */ 0x4c0794f0, 0xde0248a3, // add r2, r2, r3 ; mul24 r3, ra1.8d << 7, r0 << 7 @ "mul_used", 0 ++/* [0x00002a88] */ 0x4c071b71, 0xde0329e3, // add.setf -, r5, r5 ; mul24.ifn r3, ra1.8d << 15, r1 << 15 @ "mul_used", 0 ++/* [0x00002a90] */ 0xffffff08, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00002a98] */ 0x4d0854fe, 0x1a0248a1, // sub r2, r2, r3 ; mul24 r1, rb5, ra2.8b ++/* [0x00002aa0] */ 0x550caffe, 0x1a024260, // mov ra9, rb10 ; mul24 r0, rb10, ra3.8b ++/* [0x00002aa8] */ 0x8f2c25f6, 0xd00242ca, // asr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 ++/* [0x00002ab0] */ 0x4d08623e, 0x1c024860, // sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++/* [0x00002ab8] */ 0x4d08723e, 0x1e024860, // sub r1, r1, r0 ; mul24 r0, rb7, ra2.8d ++/* [0x00002ac0] */ 0x4c208237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra8, rb8 ++/* [0x00002ac8] */ 0x4c0ca23e, 0x1c024860, // add r1, r1, r0 ; mul24 r0, rb10, ra3.8c ++/* [0x00002ad0] */ 0x4c2cb237, 0x10024860, // add r1, r1, r0 ; mul24 r0, ra11, rb11 ++/* [0x00002ad8] */ 0x0d127380, 0x10020867, // sub r1, r1, ra4 ++/* [0x00002ae0] */ 0x8d9cc23f, 0x10024862, // sub r1, r1, r0 ; mov r2, rb_wt_off ++/* [0x00002ae8] */ 0x0f9c63c0, 0xd0020867, // asr r1, r1, 6 ++/* [0x00002af0] */ 0x4d591bce, 0x120269e0, // sub.setf -, r5, rb_i_tmu ; mul24 r0, r1, ra_wt_mul_l0 ++/* [0x00002af8] */ 0x55653fce, 0x140453e1, // mov.ifz rb_base2, rb_base2_next ; mul24 r1, r1, ra_kmul_add ++/* [0x00002b00] */ 0x8d4e7076, 0x10029851, // sub r1, r0, r1 ; mov.ifz ra_y_y2, ra_y_y2_next ++/* [0x00002b08] */ 0x8d692bf6, 0x1002b9d8, // sub.setf -, r5, rb_lcount ; mov.ifz ra_base, ra_base_next ++/* [0x00002b10] */ 0x8c9f8289, 0xd0024860, // add r1, r1, r2 ; mov r0, r1 << 8 ++/* [0x00002b18] */ 0x8c5e7236, 0x1c024863, // add r1, r1, r0 ; mov r3, ra_blk_height ++/* [0x00002b20] */ 0xfffffe78, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00002b28] */ 0x4f65039f, 0x18024862, // asr r1, r1, ra_wt_den_p7 ; mul24 r2, r3, rb_pitch ++/* [0x00002b30] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00002b38] */ 0xf34003f3, 0xd2024c20, // max vpm, r1, 0 ; v8subs r0, ra_height, r3 ++/* [0x00002b40] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x00002b48] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00002b50] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x00002b58] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x00002b60] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x00002b68] */ 0xfffffe30, 0xf0f809e7, // brr -, r:1b ++/* [0x00002b70] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00002b78] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00002b80] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_filter_y10_b00 ++/* [0x00002b88] */ 0xfffff8e0, 0xf0f807a7, // brr ra_link, r:per_block_setup_10 ++/* [0x00002b90] */ 0x959a0ff6, 0x10024023, // mov ra0, unif ; mov r3, elem_num ++/* [0x00002b98] */ 0xec9c3fd2, 0x100269e5, // add.setf -, rb_ef, rb_ef ; v8subs r5rep, r2, r2 ++/* [0x00002ba0] */ 0x8c001cff, 0x14024800, // add r0, ra0.16b, r3 ; mov rb_xshift2, rb_xshift2_next ++/* [0x00002ba8] */ 0x00000001, 0xe00208a7, // mov r2, 1 ++/* [0x00002bb0] */ 0x8c591eb6, 0x10025461, // add rb_i_tmu, rb_i_tmu, r2 ; mov r1, ra_wt_off_mul_l0 ++/* [0x00002bb8] */ 0xf158fded, 0xd4025325, // shl rb_wt_off, ra_wt_off_l0, DENOM + 8 ; v8subs r5quad, r5, r5 ++/* [0x00002bc0] */ 0x809f8009, 0xd000d9d6, // nop ; mov.ifnz ra_wt_off_mul_l0, r1 << 8 ++// :1 ++/* [0x00002bc8] */ 0x0d9d1bc0, 0xb00229e7, // sub.setf -, r5, rb_i_tmu ; nop ; ldtmu1 ++/* [0x00002bd0] */ 0x8e4c09f6, 0xa0029851, // shr r1, r4, rb_xshift2 ; mov.ifz ra_y_y2, ra_y_y2_next ; ldtmu0 ++/* [0x00002bd8] */ 0x8e5509bf, 0x12024823, // shr r0, r4, ra_xshift ; mov r3, rb_pitch ++/* [0x00002be0] */ 0x13440dc0, 0xd40208a7, // max r2, ra_y, 0 ++/* [0x00002be8] */ 0x9269e5f6, 0x10029898, // min r2, r2, rb_max_y ; mov.ifz ra_base, ra_base_next ++/* [0x00002bf0] */ 0x4c441dd3, 0xd4224462, // add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++/* [0x00002bf8] */ 0x8c613cbf, 0x10028e0f, // add t0s, ra_base, r2 ; mov.ifz rb_base2, rb_base2_next ++/* [0x00002c00] */ 0x13440dc0, 0xd20208a7, // max r2, ra_y2, 0 ++/* [0x00002c08] */ 0x129de5c0, 0x100208a7, // min r2, r2, rb_max_y ++/* [0x00002c10] */ 0x4c441dd3, 0xd2124462, // add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++/* [0x00002c18] */ 0x8c5cfe86, 0x12024f20, // add t1s, rb_base2, r2 ; v8min r0, r0, ra_pmax ++/* [0x00002c20] */ 0x545983c6, 0x12024860, // and r1, r1, rb_pmask ; mul24 r0, r0, ra_wt_mul_l0 ++/* [0x00002c28] */ 0x4d492bce, 0x120269e1, // sub.setf -, r5, rb_lcount ; mul24 r1, r1, ra_wt_mul_l1 ++/* [0x00002c30] */ 0xcc52706e, 0x1a024865, // add r1, r0, r1 ; v8adds r5rep, r5, ra_k1 ++/* [0x00002c38] */ 0x915c83f6, 0xdc024863, // shl r1, r1, 8 ; mov r3, ra_blk_height ++/* [0x00002c40] */ 0xec40c3f3, 0x12024860, // add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 ++/* [0x00002c48] */ 0xffffff60, 0xf06809e7, // brr.anyn -, r:1b ++/* [0x00002c50] */ 0x0f9d03c0, 0xd0020867, // asr r1, r1, (DENOM + 9) - 32 ++/* [0x00002c58] */ 0x925f23bf, 0x12020867, // min r1, r1, ra_pmax ; mov -, vw_wait ++/* [0x00002c60] */ 0x5351039f, 0x18024c22, // max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++/* [0x00002c68] */ 0x956e7036, 0x10126431, // mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 ++/* [0x00002c70] */ 0x00000000, 0xf027c9e7, // bra.anyz -, ra_link ++/* [0x00002c78] */ 0x929dd0ff, 0x10024831, // min r0, r0, r3 ; mov vw_setup, rb_dma1 ++/* [0x00002c80] */ 0x8d7270f6, 0x10024872, // sub r1, r0, r3 ; mov vw_addr, ra_dest ++/* [0x00002c88] */ 0x119d73c0, 0xd0020867, // shl r1, r1, i_shift23 ++/* [0x00002c90] */ 0xffffff18, 0xf0f809e7, // brr -, r:1b ++/* [0x00002c98] */ 0x0c9d2e00, 0x100214a7, // add rb_lcount, rb_lcount, r0 ++/* [0x00002ca0] */ 0x0c6e7c40, 0x100206e7, // add ra_dma0, ra_dma0, r1 ++/* [0x00002ca8] */ 0x8c71ccbf, 0x10024731, // add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init ++// ::mc_end ++}; ++#ifdef __HIGHC__ ++#pragma Align_to(8, ff_hevc_rpi_shader) ++#endif +--- /dev/null ++++ b/libavcodec/rpi_hevc_shader.h +@@ -0,0 +1,63 @@ ++#ifndef rpi_hevc_shader_H ++#define rpi_hevc_shader_H ++ ++extern unsigned int ff_hevc_rpi_shader[]; ++ ++#define mc_setup_c_q0 (ff_hevc_rpi_shader + 0) ++#define mc_start (ff_hevc_rpi_shader + 0) ++#define mc_setup_c_qn (ff_hevc_rpi_shader + 2) ++#define mc_filter_c_p (ff_hevc_rpi_shader + 134) ++#define mc_filter_c_p_l1 (ff_hevc_rpi_shader + 260) ++#define mc_filter_c_b (ff_hevc_rpi_shader + 386) ++#define mc_sync_q0 (ff_hevc_rpi_shader + 580) ++#define mc_sync_q1 (ff_hevc_rpi_shader + 598) ++#define mc_sync_q2 (ff_hevc_rpi_shader + 610) ++#define mc_sync_q3 (ff_hevc_rpi_shader + 622) ++#define mc_sync_q4 (ff_hevc_rpi_shader + 634) ++#define mc_sync_q5 (ff_hevc_rpi_shader + 652) ++#define mc_sync_q6 (ff_hevc_rpi_shader + 664) ++#define mc_sync_q7 (ff_hevc_rpi_shader + 676) ++#define mc_sync_q8 (ff_hevc_rpi_shader + 688) ++#define mc_sync_q9 (ff_hevc_rpi_shader + 706) ++#define mc_sync_q10 (ff_hevc_rpi_shader + 718) ++#define mc_sync_q11 (ff_hevc_rpi_shader + 730) ++#define mc_exit_c_qn (ff_hevc_rpi_shader + 742) ++#define mc_exit_y_qn (ff_hevc_rpi_shader + 742) ++#define mc_exit_c_q0 (ff_hevc_rpi_shader + 760) ++#define mc_exit_y_q0 (ff_hevc_rpi_shader + 760) ++#define mc_setup_y_q0 (ff_hevc_rpi_shader + 780) ++#define mc_setup_y_qn (ff_hevc_rpi_shader + 782) ++#define mc_filter_y_pxx (ff_hevc_rpi_shader + 1014) ++#define mc_filter_y_bxx (ff_hevc_rpi_shader + 1140) ++#define mc_filter_y_p00 (ff_hevc_rpi_shader + 1272) ++#define mc_filter_y_b00 (ff_hevc_rpi_shader + 1358) ++#define mc_setup_c10_q0 (ff_hevc_rpi_shader + 1432) ++#define mc_setup_c10_qn (ff_hevc_rpi_shader + 1434) ++#define mc_filter_c10_p (ff_hevc_rpi_shader + 1562) ++#define mc_filter_c10_p_l1 (ff_hevc_rpi_shader + 1684) ++#define mc_filter_c10_b (ff_hevc_rpi_shader + 1806) ++#define mc_sync10_q0 (ff_hevc_rpi_shader + 1996) ++#define mc_sync10_q1 (ff_hevc_rpi_shader + 2014) ++#define mc_sync10_q2 (ff_hevc_rpi_shader + 2026) ++#define mc_sync10_q3 (ff_hevc_rpi_shader + 2038) ++#define mc_sync10_q4 (ff_hevc_rpi_shader + 2050) ++#define mc_sync10_q5 (ff_hevc_rpi_shader + 2068) ++#define mc_sync10_q6 (ff_hevc_rpi_shader + 2080) ++#define mc_sync10_q7 (ff_hevc_rpi_shader + 2092) ++#define mc_sync10_q8 (ff_hevc_rpi_shader + 2104) ++#define mc_sync10_q9 (ff_hevc_rpi_shader + 2122) ++#define mc_sync10_q10 (ff_hevc_rpi_shader + 2134) ++#define mc_sync10_q11 (ff_hevc_rpi_shader + 2146) ++#define mc_exit_c10_q0 (ff_hevc_rpi_shader + 2158) ++#define mc_exit_y10_q0 (ff_hevc_rpi_shader + 2158) ++#define mc_exit_c10_qn (ff_hevc_rpi_shader + 2178) ++#define mc_exit_y10_qn (ff_hevc_rpi_shader + 2178) ++#define mc_setup_y10_q0 (ff_hevc_rpi_shader + 2196) ++#define mc_setup_y10_qn (ff_hevc_rpi_shader + 2198) ++#define mc_filter_y10_pxx (ff_hevc_rpi_shader + 2440) ++#define mc_filter_y10_p00 (ff_hevc_rpi_shader + 2566) ++#define mc_filter_y10_bxx (ff_hevc_rpi_shader + 2654) ++#define mc_filter_y10_b00 (ff_hevc_rpi_shader + 2786) ++#define mc_end (ff_hevc_rpi_shader + 2860) ++ ++#endif +--- /dev/null ++++ b/libavcodec/rpi_hevc_shader.qasm +@@ -0,0 +1,1850 @@ ++# Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++# All rights reserved. ++# ++# Redistribution and use in source and binary forms, with or without ++# modification, are permitted provided that the following conditions are met: ++# * Redistributions of source code must retain the above copyright ++# notice, this list of conditions and the following disclaimer. ++# * Redistributions in binary form must reproduce the above copyright ++# notice, this list of conditions and the following disclaimer in the ++# documentation and/or other materials provided with the distribution. ++# * Neither the name of the copyright holder nor the ++# names of its contributors may be used to endorse or promote products ++# derived from this software without specific prior written permission. ++# ++# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++# ++# Written by Peter de Rivaz, John Cox ++ ++ ++ ++# Inter pred asm ++# ++# Logic here should be good to 14 bits without modification ++# but only 8 & 10 are currently instantiated & tested ++# 15 & 16 bits have different shift1, shift2 calc & I also suspect overflow ++# in _p00 & _b00 ++ ++# The @ "mul_used", 0 annotations that occur by various mul blocks suppress ++# the warning that we are using rotation & ra/rb registers. r0..3 can be ++# rotated through all 16 elems ra regs can only be rotated through their ++# local 4. As it happens this is what is wanted here as we do not want the ++# constants from the other half of the calc. ++ ++# Number limits in P/B calculation ++# ++# In order to avoid issues with mul24 being an unsigned 24->32 bit multiplier ++# we offset our intermediates s.t. they always end up +ve before the next ++# multiply (may be -ve whilst summing but that doesn't matter). ++# ++# Range calc for up to 14 bits (Y-B pred): ++# ++# denom: [0, 7] ++# bmax = (1 << bits) - 1 ++# off: [-(1 << (bits-1)), (1 << (bits-1)) - 1] ++# ++# wt_mul: [-128, 255] ++# wt_off = off * 2 + 1: [-bmax, bmax] ++# ++# pel: [0, bmax] ++# H-filter: [(-22*pel + 88*pel) >> (bits-8) + 0x4000] = [0x2a00, 0x97ff] ++# V-filter: [(-22*hf + 88*hf) >> 6] = [0x580, 0xc28e] ++# mul_t = (V_L0 + V_l1) * (wt_mul + 128): [0, 0x24624e6] ++# mul_t - (V_l0 + V_l1)* 128: [-0xc28e00, 0x18396e4] ++# adj_wt_off = (wt_off << ((denom + 6) - (bits - 8))) - 0x4000 * (wt_mul * 2): ++# [wt_off << (21 - bits)] - [wt_mul << 15] = [-0x1fffff, 0x1fffff] - [-0x400000, 0x7f8000] ++# ++# This all looks good and is mostly bit depth independant - and as we manage ++# to do unsigned multiplies everywhere (now) this should be good for any bit ++# depth up to 14 (we could probably do 16 - but that requires a few tweaks ++# to the shifts we don't currently have logic for) ++ ++# PREREAD is the number of requests that we have sitting in the TMU request ++# queue. ++# ++# There are 8 slots availible in the TMU request Q for tm0s requests, but ++# only 4 output FIFO entries and overflow is bad (corruption or crash) ++# (If threaded then only 2 out FIFO entries, but we aren't.) ++# In s/w we are effectively limited to the min vertical read which is >= 4 ++# so output FIFO is the limit. ++# ++# As the test for read-next is is the main part of the Luma loop (rather than ++# the preload FIFO part) we are limited to min_luma_height - 1 ++# Min_luma_height is 4 so we can only have a preload of 3 ++# Beware that min_chroma_height (and_width) is 2 so we can't do the same trick ++# in chroma without abandoning preload pretty much entirely (which would be bad) ++# ++# Timing tests vs preload of 4 suggests this doesn't hurt us much ++# Could have preread 4 for Chroma but when tested it didn't help ++ ++.set PREREAD, 3 ++ ++# Offset added (effectively) at the exit of the H FIR filter ++# This is enough to force the result +ve ++# Is good if it is a power of 2 as that allows for >> without loss ++# ++# Worst case for a single Y FIR is *-22 so we need an offset of 256*22 ++# But we need twice offset to survive both H & V = 256*22*2 = 0x2c00 ++# Round up to next power of 2 ++ ++.set FIR_OFFSET, 0x4000 ++ ++# Block heights - 8 & 16 are the only numbers we currently support ++ ++.set C_BLK_HEIGHT_8, 16 ++.set C_BLK_HEIGHT_16, 8 ++.set Y_BLK_HEIGHT_8, 16 ++.set Y_BLK_HEIGHT_16, 8 ++ ++# QPU counts - depend on block size ++# If we have a 2-byte format & block_size > 8 then can only afford ++# 8 QPUs ++# These numbers must match the numbers in ff_hevc_rpi_shader_cmd.h ++ ++.set N_QPU_8, 12 ++.set N_QPU_16, 12 ++ ++# Value to add to the weight multiplier to convert it into an unsigned value ++# Should be power of two for convienience ++ ++.set LOG2_MUL_ADD, 14 ++.set MUL_ADD, (1 << LOG2_MUL_ADD) ++ ++# Fixed denom (max that it can be set to) ++.set DENOM, 7 ++ ++# register allocation ++# ++ ++# ra0-3 ++# Used as temp and may be loop filter coeffs (split into .8s) ++# or temp in loop. Check usage on an individual basis. ++ ++# ra4-11 ++# V FIFO / temp / free ++ ++# -- free -- ra12 ++ ++# -- free -- ra13 ++ ++# -- free -- ra14 ++ ++# -- free -- ra15 ++ ++# uniform: width:height ++.set ra_width_height, ra16 ++.set ra_width, ra16.16b ++.set ra_height, ra16.16a ++ ++# y:y2 same layout as y_y2_next so we can update both together ++.set ra_y_y2, ra17 ++.set ra_y2, ra17.16a ++.set ra_y, ra17.16b ++ ++# uniform: L1 weight (U on left, V on right) ++# Only used in Y B ++.set ra_wt_off_mul_l1, ra18 ++.set ra_wt_off_l1, ra18.16b ++.set ra_wt_mul_l1, ra18.16a ++ ++# y_next:y2_next same layout as y_y2 so we can update both together ++.set ra_y_y2_next, ra19 ++.set ra_y_next, ra19.16b ++.set ra_y2_next, ra19.16a ++ ++# Setup: consts - subdivide a single register ++.set ra_kff800100, ra20 ++.set ra_k256, ra20.16a ++.set ra_k0, ra20.8a ++.set ra_k1, ra20.8b ++.set ra_k128, ra20.8c ++.set ra_k255, ra20.8d ++ ++# Loop: xshifts ++.set ra_xshift, ra21.16a ++.set ra_xshift_next, ra21.16b ++ ++# Loop var: L0 weight (U on left, V on right) ++# _off_ is not used in loop as we want to modify it before use ++.set ra_wt_off_mul_l0, ra22 ++.set ra_wt_mul_l0, ra22.16a ++.set ra_wt_off_l0, ra22.16b ++ ++# Max pel value (for 8 bit we can get away with sat ops but not 9+) ++# * Could merge with rb_pmask. For 10 bit Logically pmask needs 0xff in the ++# 2nd byte but as the source should never be > 3 there 0x3ff should do ++.set ra_blk_height_pmax, ra23 ++.set ra_pmax, ra23.16a ++.set ra_blk_height, ra23.8c ++# --free -- ra23.8d ++ ++# Loop: src frame base (L0) ++.set ra_base, ra24 ++ ++# Misc offsets ++.set ra_fir_off_val_wt_den_p7, ra25 ++.set ra_wt_den_p7, ra25.8a ++# -- free -- ra25.8b ++.set ra_fir_off_val, ra25.16b ++ ++# As it happens these constants are the same ++.if FIR_OFFSET == MUL_ADD ++# Weight multiplier unsigned add ++.set ra_kmul_add, ra_fir_off_val ++.else ++.error "FIR_OFFSET != MUL_ADD: Need new register & init" ++.endif ++ ++# Loop: next src frame base (L0) ++.set ra_base_next, ra26 ++ ++# Loop: height<<23 + width<<16 + vdw_setup_0 ++.set ra_dma0, ra27 ++ ++# Loop: destination address ++.set ra_dest, ra28 ++ ++# Setup: Dup of rb_ef ++# Lo bits are used as Y coeff 0 as that lefts us combine test & coeff mul ++# (top bits are ignored by mul24) ++.set ra_ef, ra29 ++ ++# Use an even numbered register as a link register to avoid corrupting flags ++.set ra_link, ra30 ++ ++# -- free -- ra31 ++ ++.set rb_xshift2, rb0 ++.set rb_xshift2_next, rb1 ++ ++# C: (elem & 1) == 0 ? elem * 2 : (elem + 4) * 2 ++.set rb_elem_x, rb2 ++ ++# El Flags ++# After adding to self we to have el even/odd on nc/c and lo/hi on nn/n ++# Duped into ra_ef as sometimes that is easier to use ++.set rb_ef, rb3 ++ ++# rb4-11 ++# Loop: V filter FIFO or V filter coeff ++ ++# Loop var: offset to add before shift (round + weighting offsets) ++# Exact value varies by loop ++.set rb_wt_off, rb12 ++ ++# -- free -- rb13 ++ ++# -- free -- rb14 ++ ++# Loop: src frame base (L1) ++.set rb_base2, rb15 ++ ++# Line pitch (128 for sand128) ++.set rb_pitch, rb16 ++ ++# Loop count - 2 (set up TMU for next xfer) ++.set rb_i_tmu, rb17 ++ ++# Loop count for min(height, 16) ++# Y will reset & loop again if height > 16 ++.set rb_lcount, rb18 ++ ++# frame_base2_next ++.set rb_base2_next, rb19 ++ ++# Setup: Height of Y+C in sand, (x&mask)*xpitch will give ++# offset to the slice ++.set rb_xpitch, rb20 ++ ++# These 3 consts each save 1 instruction in Y loop setup ++# so whilst they are worthwhile they should be the 1st to die if we need ++# another b reg ++.set rb_y_coeffs_2, rb21 # 0x050b0a00 ++.set rb_y_coeffs_3, rb22 # 0x11283a40 ++.set rb_y_coeffs_5, rb23 # 0x0a0b0500 ++ ++# Setup: 0xff (8-bit) / 0xffff (9+ bit) ++.set rb_pmask, rb24 ++ ++# vdw_setup_1(dst_pitch) ++.set rb_dma1_base, rb25 ++ ++# Setup: pic width - 1 ++# In bytes so 8 bit luma is (width - 1)*1, 16 bit chroma is (width -1)*4 etc. ++.set rb_max_x, rb26 ++ ++# vdw_setup_0 (depends on QPU number) ++.set rb_dma0_base, rb27 ++ ++# Setup: vw_setup value to reset VPM write pointer ++.set rb_vpm_init, rb28 ++ ++# Loop: vdw_setup_1(dst_pitch-width) = stride ++.set rb_dma1, rb29 ++ ++# Setup: pic_height - 1 ++.set rb_max_y, rb30 ++ ++# Setup: FIR H offset ++.set rb_fir_off_h, rb31 ++ ++ ++# With shifts only the bottom 5 bits are considered so -16=16, -15=17 etc. ++.set i_shift16, -16 ++.set i_shift21, -11 ++.set i_shift23, -9 ++.set i_shift30, -2 ++ ++# Much of the setup code is common between Y & C ++# Macros that express this - obviously these can't be overlapped ++# so are probably unsuitable for loop code ++ ++.macro m_calc_dma_regs, v_bit_depth, v_blk_height, r_vpm, r_dma ++ mov r2, qpu_num ++.if v_bit_depth <= 8 ++ # 8 bit version ++ asr r1, r2, 2 ++ shl r1, r1, 6 ++ and r0, r2, 3 ++ or r0, r0, r1 ++ ++ mov r1, vpm_setup(0, 4, h8p(0, 0)) # 4 is stride - stride acts on ADDR which is Y[5:0],B[1:0] for 8 bit ++ add r_vpm, r0, r1 # VPM 8bit storage ++ ++ mov r1, vdw_setup_0(0, 0, dma_h8p(0,0,0)) # height,width added later ++ shl r0, r0, 5 ++ ++.else ++ # 16 bit version ++ # Limited to 8 QPUs if blk height > 8 ++ asr r1, r2, 1 ++.if v_blk_height <= 8 ++ shl r1, r1, 4 ++.else ++ shl r1, r1, 5 ++.endif ++ and r0, r2, 1 ++ or r0, r0, r1 ++ ++ mov r1, vpm_setup(0, 2, h16p(0, 0)) # 2 is stride - stride acts on ADDR ++ add r_vpm, r0, r1 ++ ++ # X = H * 8 so the YH from VPMVCD_WR_SETUP[ADDR] drops into ++ # XY VPMVCD_WR_SETUP[VPMBASE] if shifted left 3 (+ 3 for pos of field in reg) ++ mov r1, vdw_setup_0(0, 0, dma_h16p(0,0,0)) # height,width added later ++ shl r0, r0, 6 ++.endif ++ add r_dma, r0, r1 # DMA out ++.endm ++ ++ ++.macro m_setup_q0 ++ srel -, 12 ++.endm ++ ++# Code start label ++::mc_start ++ ++################################################################################ ++# mc_setup_c ++# ++# typedef struct qpu_mc_pred_c_s_s { ++# int16_t y; ++# int16_t x; ++# uint32_t base; ++# uint32_t pic_cw; // C Width (== Y width / 2) ++# uint32_t pic_ch; // C Height (== Y Height / 2) ++# uint32_t stride2; ++# uint32_t stride1; ++# uint32_t wdenom; ++# int16_t y2; ++# int16_t x2; ++# uint32_t base2; ++# uint32_t next_fn; ++# } qpu_mc_pred_c_s_t; ++ ++.macro m_setup_c, v_bit_depth ++ ++# Cannot use mul24 on x as x might be -ve, so must use shift ++.if v_bit_depth <= 8 ++.set v_x_shift, 1 ++.set v_pmask, 0xff ++.set v_blk_height, C_BLK_HEIGHT_8 ++.else ++.set v_x_shift, 2 ++.set v_pmask, 0xffff ++.set v_blk_height, C_BLK_HEIGHT_16 ++.endif ++ ++ mov tmurs, 1 ; mov ra0, unif # No TMU swap ; x_y ++ ++ mov r0, [0,2,0,2,0,2,0,2,1,3,1,3,1,3,1,3] ++ shl rb_ef, r0, i_shift30 ; mov ra_base, unif # ; ref_c_base ++ ++# Read image dimensions ++ sub r0, unif, 1 # pic c width ++ shl rb_max_x, r0, v_x_shift # rb_max_x in bytes ++ sub rb_max_y, unif, 1 # pic c height ++ ++# load constants ++ mov ra_kff800100, 0xff800100 ++ mov rb_pmask, v_pmask ++ mov ra_blk_height_pmax, ((1 << v_bit_depth) - 1) | (v_blk_height << 16) ++ mov rb_fir_off_h, (FIR_OFFSET << (v_bit_depth - 8)) ++ mov ra_fir_off_val_wt_den_p7, (FIR_OFFSET << 16) | (DENOM + 15 - v_bit_depth) ++ ++# get source pitch ++ mov ra_ef, rb_ef ; mov rb_xpitch, unif # ; stride2 ++ mov rb_pitch, unif # stride1 ++ mov r1, vdw_setup_1(0) # [rb_pitch delay] Merged with dst_stride shortly ++ add rb_dma1_base, r1, rb_pitch # vdw_setup_1 ++ ++ and r0, 1, elem_num ++ nop ; mul24 r0, r0, 5 ++.if v_bit_depth <= 8 ++ add rb_elem_x, r0, elem_num ++.else ++ add r0, r0, elem_num ++ add rb_elem_x, r0, r0 ++.endif ++ ++# Compute base address for first and second access ++# ra_base ends up with t0s base ++# ra_base2 ends up with t1s base ++ ++ shl r0, ra0.16b, v_x_shift # [rb_elem_x delay] ++ add r0, r0, rb_elem_x # Add elem no to x to get X for this slice ++ max r0, r0, 0 ; mov ra_y, ra0.16a # ; stash Y ++ min r0, r0, rb_max_x ++ ++# Get shift ++# Shift will always calculate as 0 for 9+ bit ++# Ideally we can optimize the shift out of the code in these cases but for now ++# it is tidier to leave it in ++.if v_bit_depth <= 8 ++ shl ra_xshift_next, r0, 3 ++.else ++ mov ra_xshift_next, 0 ; mov rb_xshift2_next, 0 ++.endif ++ ++# In a single 32 bit word we get 1 or 2 UV pairs so mask bottom bits of xs if we need to ++ ++.if v_bit_depth <= 8 ++ and r0, r0, -4 ++.endif ++ sub r1, ra_k0, rb_pitch ++ and r1, r0, r1 ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 ; mov ra0, unif # ; next_x2_y2 ++ add ra_base, ra_base, r0 ++ ++# Compute part of VPM to use for DMA output ++# * We only get 8 QPUs if 16 bit - maybe reduce height and auto-loop? ++ m_calc_dma_regs v_bit_depth, v_blk_height, rb_vpm_init, rb_dma0_base ++ ++# And again for L1, but only worrying about frame2 stuff ++ ++# Compute base address for first and second access ++# ra_base ends up with t0s base ++# rb_base2 ends up with t1s base ++ ++ shl r0, ra0.16b, v_x_shift ++ add r0, r0, rb_elem_x ; mov ra_y2, ra0.16a # Add QPU slice offset ++ max r0, r0, 0 ; mov rb_base2, unif # ref_c_base2 ++ min r0, r0, rb_max_x ++ ++# Get shift (already zero if 9+ bit so ignore) ++.if v_bit_depth <= 8 ++ shl rb_xshift2_next, r0, 3 ++.endif ++ ++# In a single 32 bit word we get 2 UV pairs so mask bottom bit of xs ++ ++.if v_bit_depth <= 8 ++ and r0, r0, -4 ++.endif ++ sub r1, ra_k0, rb_pitch ++ and r1, r0, r1 ; mov r3, PREREAD ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 ; mov r2, ra_y2 ++ add rb_base2, rb_base2, r0 ; mov r0, ra_y ++ ++# Do preloads ++# r0 = ra_y, r2 = ra_y2, r3 = PREREAD ++ ++:1 ++ sub.setf r3, r3, 1 ++ max r1, r0, 0 ++ min r1, r1, rb_max_y ++ add r0, r0, ra_k1 ; mul24 r1, r1, rb_pitch ++ add t0s, ra_base, r1 ; mov ra_y, r0 ++ ++ max r1, r2, 0 ++ brr.anynz -, r:1b ++ min r1, r1, rb_max_y ++ add r2, r2, ra_k1 ; mul24 r1, r1, rb_pitch ++ add t1s, rb_base2, r1 ; mov ra_y2, r2 ++# >>> .anynz 1b ++ ++ mov ra_link, unif # link ++# touch registers to keep simulator happy (and fills in delay slots) ++ mov ra4, 0 ; mov rb4, 0 ++ bra -, ra_link ++ mov ra5, 0 ; mov rb5, 0 ++ mov ra6, 0 ; mov rb6, 0 ++ mov ra7, 0 ; mov rb7, 0 ++# >>> ra_link ++.endm ++ ++::mc_setup_c_q0 ++ m_setup_q0 ++::mc_setup_c_qn ++ m_setup_c 8 ++ ++################################################################################ ++# ++# mc_filter_c_p ++# ++# typedef struct qpu_mc_pred_c_p_s { ++# int16_t y; ++# int16_t x; ++# uint32_t base; ++# uint16_t h; ++# uint16_t w; ++# uint32_t coeffs_x; ++# uint32_t coeffs_y; ++# uint32_t wo_u; ++# uint32_t wo_v; ++# uint32_t dst_addr_c; ++# uint32_t next_fn; ++# } qpu_mc_pred_c_p_t; ++ ++.macro m_filter_c_p, v_tmu, v_bit_depth ++ ++.if v_bit_depth <= 8 ++.set v_x_shift, 1 ++.set v_x_mul, 2 ++.set v_v_shift, 8 ++# Shifts to get width & height in the right place in rb_dma0 ++.set v_dma_h_shift, 7 ++.set v_dma_wh_shift, i_shift16 ++.else ++.set v_x_shift, 2 ++.set v_x_mul, 4 ++.set v_v_shift, i_shift16 ++# Shifts to get width & height in the right place in rb_dma0 ++.set v_dma_h_shift, 8 ++.set v_dma_wh_shift, 15 ++.endif ++ ++.if v_tmu == 0 ++.set vrx_xshift, rb_xshift2 # b side more convienient ++.set vrx_xshift_next, ra_xshift_next ++.set vra_y_next, ra_y_next ++.set vrx_base_next, ra_base_next ++.set vra_y, ra_y ++.set vra_base, ra_base ++.set vr_txs, t0s ++.else ++.set vrx_xshift, ra_xshift # a side more convienient ++.set vrx_xshift_next, rb_xshift2_next ++.set vra_y_next, ra_y2_next ++.set vrx_base_next, rb_base2_next ++.set vra_y, ra_y2 ++.set vra_base, rb_base2 ++.set vr_txs, t1s ++.endif ++ ++# denom shift values ++.set i_wt_den_p5, (DENOM + 13 - v_bit_depth) ++.set i_wt_den_p6, (DENOM + 14 - v_bit_depth) ++ ++# per-channel shifts were calculated on the *previous* invocation ++# get base addresses and per-channel shifts for *next* invocation ++ mov vw_setup, rb_vpm_init ; mov ra2, unif # ; x_y ++ ++ add.setf -, rb_ef, rb_ef ; mov r3, unif # [ra2 delay] ; base ++ ++ shl r0, ra2.16b, v_x_shift ; v8subs r5rep, r0, r0 # r5 = 0 ++ add r0, r0, rb_elem_x ; mov ra_width_height, unif # r1=pitch2 mask ; width_height ++ sub r1, r5, rb_pitch ; mov ra0, unif # ; H filter coeffs ++ max r0, r0, r5 ; mov vrx_xshift, vrx_xshift_next ++ min r0, r0, rb_max_x ; mov vra_y_next, ra2.16a ++ ++.if v_bit_depth <= 8 ++ shl vrx_xshift_next, r0, 3 ++ and r0, r0, -4 ++.endif ++ and r1, r0, r1 ; mul24 r2, ra_width, v_x_mul # r2=w*2 (we are working in pel pairs) ** x*2 already calced! ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 ; mov ra3, unif # ; V filter coeffs ++ add vrx_base_next, r3, r0 ; mov r1, ra_height ++ ++# set up VPM write ++ sub rb_dma1, rb_dma1_base, r2 ; mov ra_wt_off_mul_l0, unif # Compute vdw_setup1(dst_pitch-width) ; U offset/weight ++ add rb_i_tmu, r1, (3-4) - PREREAD ; v8min r1, r1, ra_blk_height ++ add rb_lcount, r1, (3-4) ; mov.ifc ra_wt_off_mul_l0, unif # ; V offset/weight ++ ++# Misc final setup... ++ ++ shl r0, r1, v_dma_h_shift ; mov ra_dest, unif # ; dst_addr ++ add r0, r0, r2 ; mov r2, ra_fir_off_val # Combine width and height of destination area (r0=h<<8, r2=w*2) ++ shl r0, r0, v_dma_wh_shift ; mov rb10, ra3.8c # Shift into bits 16 upwards of the vdw_setup0 register ++ add ra_dma0, r0, rb_dma0_base ; mov r1, ra_wt_off_l0 # ; r1=weight ++ shl r1, r1, i_wt_den_p5 ; mul24 r0, r2, ra_wt_mul_l0 ++ sub rb_wt_off, r1, r0 ; mov r0, ra_kmul_add ++ add ra_wt_mul_l0, ra_wt_mul_l0, r0 ; mov r5rep, -4 # ; loop counter (V FIFO fill = 4) ++ mov rb11, ra3.8d ; mov ra_link, unif # ; Link ++ ++# r5 = -4 (loop counter) ++# ra_wt_mul_l0 = weight L0 + 128 (now unsigned) ++# rb_wt_off = (offset * 2 + 1) << (wt_den + 5) ++# rb31 = FIR value offset ++ ++# FIFO: rb4, ra5, rb6, ra7 ++# Coeffs in ra3.8a, ra3.8b, rb10, rb11 ++ ++# We want (r0r1) ++# U0U3 : V0V3 : U1U4 : V1V4 : U2U5 : V2U5 : ... ++# We fetch (after shift) ++# C0 : C3 : C1 : C4 : C2 : C5 : ... ++ ++:1 ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++.if v_tmu == 0 ++ sub.setf -, r5, rb_i_tmu ; mov rb4, ra5 ; ldtmu0 ++ shr r2, r4, vrx_xshift ; mov.ifz r3, vra_y_next ++ shr r1, r2, v_v_shift ; mov.ifnz r3, vra_y ++ add.setf -, rb_ef, rb_ef ; mov.ifz vra_base, vrx_base_next ++.else ++ sub.setf -, r5, rb_i_tmu ; mov rb4, ra5 ; ldtmu1 ++ shr r2, r4, vrx_xshift ; mov.ifz vra_base, vrx_base_next ++ shr r1, r2, v_v_shift ; mov.ifnz r3, vra_y ++ add.setf -, rb_ef, rb_ef ; mov.ifz r3, vra_y_next # [r1 << delay] ++.endif ++ ++ add vra_y, r3, ra_k1 ; mov r0, r1 << 15 ++ max r3, r3, ra_k0 ; mov.ifnc r1, r2 << 1 ++ min r3, r3, rb_max_y ; mov.ifnc r0, r2 ++ ++ and r1, r1, ra_pmax ; mul24 r3, r3, rb_pitch ++.if v_tmu == 0 ++ add vr_txs, vra_base, r3 ; v8min r0, r0, rb_pmask # ; mask bytes ++.else ++ add vr_txs, vra_base, r3 ; v8min r0, r0, ra_pmax # ; mask bytes ++.endif ++ ++# apply horizontal filter ++# The filter coeffs for the two halves of this are the same (unlike in the ++# Y case) so it doesn't matter which ra0 we get them from ++# Also as the two halves are locked together we don't need to separate the 1st ++# r0 mul or the last r1 mul as they are valid for all QPUs ++ ++ add r5rep, r5, 1 ; mul24 r3, ra0.8a, r0 ++ sub r2, rb_fir_off_h, r3 ; mul24 r3, ra0.8d, r1 ++ sub r2, r2, r3 ; mul24 r3, ra0.8b << 2, r0 << 2 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra0.8b << 12, r1 << 12 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra0.8c << 4, r0 << 4 @ "mul_used", 0 ++ add.setf -, r5, r5 ; mul24.ifn r3, ra0.8c << 14, r1 << 14 @ "mul_used", 0 ++ ++# V filter = - r4 * a + r5 * b + r6 * c - r7 * d (post FIFO shift) ++# We would like to save the r5->r4 shift but we need a delay slot ++# for both r7 & r6 which we can't find anything to put in if we have ++# already multiplied r4 & r5! ++ brr.anyn -, r:1b ++ add r2, r2, r3 ; mul24 r0, ra7, rb10 # r6 post ++ mov ra5, rb6 ; mul24 r1, rb6, ra3.8b # r5 post ++ asr ra7, r2, v_bit_depth - 8 ; mov rb6, ra7 ++# >>> .anyn 1b ++ ++ add r1, r1, r0 ; mul24 r0, rb4, ra3.8a # [ra7 delay] ++ sub r1, r1, r0 ; mul24 r0, ra7, rb11 ++ sub r1, r1, r0 ++ ++ asr r1, r1, 6 ; mov r3, ra_blk_height # ; NxtLoop ++ sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 ++ add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add ++ sub r1, r0, r1 ; v8subs r0, ra_height, r3 # ; NxtLoop ++ brr.anyn -, r:1b ++ asr r1, r1, i_wt_den_p6 ++ min r1, r1, ra_pmax ; mov -, vw_wait ++ max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch # ; NxtLoop ++# >>> .anyn 1b ++ ++# r0 = remaining height (min 0) ++# r2 = r3 * rb_pitch ++# r3 = block_height ++ ++# If looping again then we consumed 16 height last loop ++# rb_dma1 (stride) remains constant ++# rb_i_tmu remains const (based on total height) ++# recalc ra_dma0, rb_lcount based on new segment height ++ ++ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # VDW setup 0 ++ ++# DMA out ++ bra.anyz -, ra_link ++ min r0, r0, r3 ; mov vw_setup, rb_dma1 # Stride ++ sub r1, r0, r3 ; mov vw_addr, ra_dest # start the VDW ++ shl r1, r1, i_shift23 ++# >>> .anyz ra_link ++ ++# Here r1 = cur_blk_height - 16 so it will be 0 or -ve ++# We add to dma0 to reduce the number of output lines in the final block ++ brr -, r:1b ++ add rb_lcount, rb_lcount, r0 ++ add ra_dma0, ra_dma0, r1 ++ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer ++# >>> 1b ++.endm ++ ++::mc_filter_c_p ++ m_filter_c_p 0, 8 ++ ++::mc_filter_c_p_l1 ++ m_filter_c_p 1, 8 ++ ++################################################################################ ++# ++# mc_filter_c_b ++# ++# typedef struct qpu_mc_pred_c_b_s { ++# int16_t y; ++# int16_t x; ++# uint32_t base; ++# uint16_t h; ++# uint16_t w; ++# uint32_t coeffs_x1; ++# uint32_t coeffs_y1; ++# int16_t weight_u1; ++# int16_t weight_v1; ++# int16_t y2; ++# int16_t x2; ++# uint32_t base2; ++# uint32_t coeffs_x2; ++# uint32_t coeffs_y2; ++# uint32_t wo_u2; ++# uint32_t wo_v2; ++# uint32_t dst_addr_c; ++# uint32_t next_fn; ++# } qpu_mc_pred_c_b_t; ++ ++.macro m_filter_c_b, v_bit_depth ++ ++.if v_bit_depth <= 8 ++.set v_x_shift, 1 ++.set v_v_shift, 8 ++# Shifts to get width & height in the right place in ra_dma0 ++.set v_dma_h_shift, 7 ++.set v_dma_wh_shift, i_shift16 ++.else ++.set v_x_shift, 2 ++.set v_v_shift, i_shift16 ++# Shifts to get width & height in the right place in ra_dma0 ++.set v_dma_h_shift, 8 ++.set v_dma_wh_shift, 15 ++.endif ++.set v_x_mul, (1 << v_x_shift) ++ ++# denom shift values ++.set i_wt_den_p5, (DENOM + 13 - v_bit_depth) ++.set i_wt_den_p6, (DENOM + 14 - v_bit_depth) ++ ++# per-channel shifts were calculated on the *previous* invocation ++ ++# get base addresses and per-channel shifts for *next* invocation ++ mov vw_setup, rb_vpm_init ; mov ra2, unif # ; x_y ++ ++ add.setf -, rb_ef, rb_ef ; mov r3, unif # [ra2 delay] ; r3=base ++ ++ shl r0, ra2.16b, v_x_shift ; v8subs r5rep, r1, r1 # x ; r5=0 ++ add r0, r0, rb_elem_x ; mov ra_y_next, ra2.16a ++ sub r1, r5, rb_pitch ; mov ra_width_height, unif # r1=pitch2 mask ; width_height ++ max r0, r0, r5 ; mov ra_xshift, ra_xshift_next ++ min r0, r0, rb_max_x ; mov ra0, unif # ; L0 H filter coeffs ++ ++.if v_bit_depth <= 8 ++ shl ra_xshift_next, r0, 3 ++.endif ++ ++ and r0, r0, -4 ; mov ra2, unif # ; L0 V filter coeffs ++ and r1, r0, r1 ; mul24 r2, ra_width, v_x_mul # r2=x*2 (we are working in pel pairs) ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 ; mov r1, ra_height # Add stripe offsets ; r1=height ++ add ra_base_next, r3, r0 ; mov rb_xshift2, rb_xshift2_next # ; xshift2 used because B ++ ++# set up VPM write ++ ++ sub rb_dma1, rb_dma1_base, r2 ; mov ra_wt_off_mul_l0, unif # Compute vdw_setup1(dst_pitch-width) ; U weight ++ add rb_i_tmu, r1, (3-4) - PREREAD ; v8min r1, r1, ra_blk_height ++ add rb_lcount, r1, (3-4) ; mov.ifc ra_wt_mul_l0, ra_wt_off_l0 # ; V weight ++ ++ shl r0, r1, v_dma_h_shift ; mov ra3, unif # ; x2_y2 ++ add r0, r0, r2 ; mov r3, unif # [ra3 delay] ; base ++ shl r0, r0, v_dma_wh_shift ; mov ra_y2_next, ra3.16a # Shift into bits 16 upwards of the vdw_setup0 register ++ add ra_dma0, r0, rb_dma0_base ; mov r0, ra3.16b # r0=x ++ ++# L1 - uniform layout could possibly be optimized ++ ++ shl r0, r0, v_x_shift ; mov ra1, unif # r0=x<>> .anyn 1b ++ ++ sub r2, r1, r0 ; mul24 r1, rb5, ra2.8b # L1 ; L0 ++ sub.setf -, r5, rb_lcount ; mov r0, ra4 ++ sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++ add r1, r1, r0 ; mul24 r0, ra7, rb7 ++ ++ sub r1, r1, r0 ; mul24 r0, rb10, ra3.8c # L1 ++ add r2, r2, r0 ; mul24 r0, ra11, rb11 # L1 ++ sub r2, r2, r0 ++ ++ shr r1, r1, 6 ++ shr r2, r2, 6 ; mul24 r0, r1, ra_wt_mul_l0 ++ add r2, r2, r1 ; mul24 r1, r2, ra_wt_mul_l1 ++ add r1, r1, r0 ; mul24 r2, r2, ra_kmul_add ++ sub r1, r1, r2 ; mov r3, ra_blk_height # ; NxtLoop ++ add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 # ; NxtLoop ++ ++ brr.anyn -, r:1b ++ asr r1, r1, ra_wt_den_p7 ++ min r1, r1, ra_pmax ; mov -, vw_wait ++ max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch # ; NxtLoop ++# >>> .anyn 1b ++ ++# r0 = remaining height (min 0) ++# r2 = r3 * rb_pitch ++# r3 = block_height ++ ++# If looping again then we consumed 16 height last loop ++# rb_dma1 (stride) remains constant ++# rb_i_tmu remains const (based on total height) ++# recalc ra_dma0, rb_lcount based on new segment height ++ ++ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # ; VDW setup 0 ++ ++# DMA out ++ bra.anyz -, ra_link ++ min r0, r0, r3 ; mov vw_setup, rb_dma1 # ; Stride ++ sub r1, r0, r3 ; mov vw_addr, ra_dest # ; start the VDW ++ shl r1, r1, i_shift23 ++# >>> .anyz ra_link ++ ++# Here r1 = cur_blk_height - 16 so it will be 0 or -ve ++# We add to dma0 to reduce the number of output lines in the final block ++ brr -, r:1b ++ add rb_lcount, rb_lcount, r0 ++ add ra_dma0, ra_dma0, r1 ++ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer ++# >>> 1b ++.endm ++ ++::mc_filter_c_b ++ m_filter_c_b 8 ++ ++################################################################################ ++# Exit code used by both Luma & Chroma so place between them to avoid I-cache ++# conflicts ++ ++.macro m_exit_drain ++.if PREREAD == 2 ++# Special case 2 as loop is wasteful ++ nop ; nop ; ldtmu0 ++ nop ; nop ; ldtmu1 ++ nop ; nop ; ldtmu0 ++ mov -, vw_wait ; nop ; ldtmu1 ++.else ++ mov.setf r3, PREREAD - 1 ++:1 ++ brr.anynz -, r:1b ++ nop ; nop ; ldtmu0 ++ nop ; nop ; ldtmu1 ++ sub.setf r3, r3, 1 ++ # >>> ++ mov -, vw_wait ++.endif ++.endm ++ ++# This sync layout groups QPUs 0-3, 4-7, 8-11 (i.e. 1 group per TMU pair) ++# All qpus start at the beginning and after that (group - 1) must have finished ++# before (group) can start ++# ++# Requires setup code for QPU 0 to srel sem 12 (m_setup_q0) to start the chain ++# Exit code will sacq sem 12 so everything is @ 0 on exit (this is important - ++# lockup otherwise) ++# ++# There is some, currently ill defined, potential lockup if we have the VDM active ++# whilst doing sem stuff so we wait first. ?? QPU stall from sem stalls VDM pipe too ?? ++# ++# The code stalled when I had many waiters on a single sem so we have a ++# "ripple" of srels to restart. Unsure why, may have been bug, but this works ++# and we currently have both the memory & sems to support it. ++.macro m_sync_q, n_qpu, n_quads ++# Do not generate code for qpu >= quads * 4 - fns should never be called ++.if n_qpu < n_quads * 4 ++ mov ra_link, unif # Can only branch to an a reg (not r0) ++ mov -, vw_wait # [ra_link delay] ++ ++.set n_sem_sync, n_qpu - (n_qpu % 4) ++.set n_sem_in, n_qpu ++.set n_sem_out, n_qpu + 1 ++ ++.if n_qpu % 4 == 0 ++ ++.set n_sem_quad_in, 12 + n_qpu / 4 ++.set n_sem_quad_out, 12 + (((n_qpu / 4) + 1) % n_quads) ++ ++ sacq -, n_sem_sync ++ sacq -, n_sem_sync ++ sacq -, n_sem_sync ++ bra -, ra_link ++ sacq -, n_sem_quad_in ++ srel -, n_sem_out ++ srel -, n_sem_quad_out ++ ++.else ++ bra -, ra_link ++ srel -, n_sem_sync ++ sacq -, n_sem_in ++.if n_sem_out % 4 != 0 ++ srel -, n_sem_out ++.else ++ nop ++.endif ++.endif ++.endif ++.endm ++ ++.set v_quads8, N_QPU_8 / 4 ++ ++::mc_sync_q0 ++ m_sync_q 0, v_quads8 ++::mc_sync_q1 ++ m_sync_q 1, v_quads8 ++::mc_sync_q2 ++ m_sync_q 2, v_quads8 ++::mc_sync_q3 ++ m_sync_q 3, v_quads8 ++::mc_sync_q4 ++ m_sync_q 4, v_quads8 ++::mc_sync_q5 ++ m_sync_q 5, v_quads8 ++::mc_sync_q6 ++ m_sync_q 6, v_quads8 ++::mc_sync_q7 ++ m_sync_q 7, v_quads8 ++::mc_sync_q8 ++ m_sync_q 8, v_quads8 ++::mc_sync_q9 ++ m_sync_q 9, v_quads8 ++::mc_sync_q10 ++ m_sync_q 10, v_quads8 ++::mc_sync_q11 ++ m_sync_q 11, v_quads8 ++ ++# mc_exit() ++# Chroma & Luma the same now ++ ++.macro m_exit_qn ++ m_exit_drain ++ nop ; nop ; thrend ++ nop ++ nop ++# >>> thrend <<< ++.endm ++ ++::mc_exit_c_qn ++::mc_exit_y_qn ++ m_exit_qn ++ ++ ++ ++# mc_interrupt_exit12() ++ ++.macro m_exit_q0 ++ m_exit_drain ++ sacq -, 12 ++ nop ; nop ; thrend ++ mov interrupt, 1 ++ nop ++# >>> thrend <<< ++.endm ++ ++::mc_exit_c_q0 ++::mc_exit_y_q0 ++ m_exit_q0 ++ ++# LUMA CODE ++ ++# The idea is to form B predictions by doing 8 pixels from ref0 in parallel with 8 pixels from ref1. ++# For P frames we make the second x,y coordinates offset by +8 ++ ++ ++################################################################################ ++# mc_setup ++# ++# typedef struct qpu_mc_pred_y_s_s { ++# qpu_mc_src_t next_src1; ++# qpu_mc_src_t next_src2; ++# uint16_t pic_h; ++# uint16_t pic_w; ++# uint32_t stride2; ++# uint32_t stride1; ++# uint32_t wdenom; ++# uint32_t next_fn; ++# } qpu_mc_pred_y_s_t; ++ ++.macro m_setup_y, v_bit_depth ++ ++# Cannot use mul24 on x as x might be -ve, so must use shift ++.if v_bit_depth <= 8 ++.set v_x_shift, 0 ++.set v_pmask, 0xff ++.set v_blk_height, Y_BLK_HEIGHT_8 ++.else ++.set v_x_shift, 1 ++.set v_pmask, 0xffff ++.set v_blk_height, Y_BLK_HEIGHT_16 ++.endif ++ ++ ++ # Need to save these because we need to know the frame dimensions before computing texture coordinates ++ mov tmurs, 1 ; mov ra0, unif # No TMU swap ; x_y ++ mov ra9, unif # ref_y_base ++ mov ra1, unif # x2_y2 ++ ++ ++# load constants ++ mov r0, [0,2,0,2,0,2,0,2,1,3,1,3,1,3,1,3] ++ shl rb_ef, r0, i_shift30 ; mov ra11, unif # ; ref_y2_base ++ ++ mov ra_kff800100, 0xff800100 ++ mov rb_pmask, v_pmask ++ mov ra_blk_height_pmax, ((1 << v_bit_depth) - 1) | (v_blk_height << 16) ++ mov rb_fir_off_h, (FIR_OFFSET << (v_bit_depth - 8)) ++ mov ra_fir_off_val_wt_den_p7, (FIR_OFFSET << 16) | (DENOM + 15 - v_bit_depth) ++ mov rb_y_coeffs_2, 0x050b0a00 ++ mov rb_y_coeffs_3, 0x11283a40 ++ mov rb_y_coeffs_5, 0x0a0b0500 ++ ++# Compute part of VPM to use ++ ++# Read image dimensions ++ mov ra3, unif # width_height ++ mov ra_ef, rb_ef ; mov rb_xpitch, unif # [ra3 delay] ; stride2 ++.if v_x_shift == 0 ++ sub rb_max_x, ra3.16b, 1 ++.else ++ sub r0, ra3.16b, 1 ++ shl rb_max_x, r0, v_x_shift ++.endif ++ sub rb_max_y, ra3.16a, 1 ++ mov r3, elem_num ; mov rb_pitch, unif # stride1 ++ ++# get destination pitch ++ mov r1, vdw_setup_1(0) # [rb_pitch delay] ++ or rb_dma1_base, r1, rb_pitch ++ ++# Compute base address for first and second access ++ add r0, ra0.16b, r3 # Load x + elem_num ++.if v_x_shift != 0 ++ shl r0, r0, v_x_shift ++.endif ++ max r0, r0, 0 ++ min r0, r0, rb_max_x ++ shl ra_xshift_next, r0, 3 # Compute shifts ++ ++# X is byte offset - we can only load words - mask ++ ++ and r0, r0, -4 ; v8subs r2, r2, r2 ++ sub r2, r2, rb_pitch ++ and r1, r0, r2 ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 # Add stripe offsets ++ add ra_base, ra9, r0 ++ ++ # r3 still contains elem_num ++ add r0, ra1.16b, r3 # Load x ++.if v_x_shift != 0 ++ shl r0, r0, v_x_shift ++.endif ++ max r0, r0, 0 ++ min r0, r0, rb_max_x ++ shl rb_xshift2_next, r0, 3 # Compute shifts ++ ++ # r2 still contains mask ++ and r0, r0, -4 ++ and r1, r0, r2 ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 # Add stripe offsets ++ add rb_base2, ra11, r0 ++ ++# Do preloads ++ nop ; mov r0, ra0.16a # ; r0 = y ++ mov r3, PREREAD ; mov r2, ra1.16a # ; r2 = y2 ++ ++:1 ++ sub.setf r3, r3, 1 ++ max r1, r0, 0 ++ min r1, r1, rb_max_y ++ add r0, r0, ra_k1 ; mul24 r1, r1, rb_pitch ++ add t0s, ra_base, r1 ; mov ra_y, r0 ++ ++ max r1, r2, 0 ++ brr.anynz -, r:1b ++ min r1, r1, rb_max_y ++ add r2, r2, ra_k1 ; mul24 r1, r1, rb_pitch ++ add t1s, rb_base2, r1 ; mov ra_y2, r2 ++# >>> .anynz 1b ++ ++ m_calc_dma_regs v_bit_depth, v_blk_height, rb_vpm_init, rb_dma0_base ++ ++ mov ra_link, unif # Next fn ++ ++# touch vertical context to keep simulator happy ++ mov ra8, 0 ; mov rb8, 0 # [ra_link delay] ++ bra -, ra_link ++ mov ra9, 0 ; mov rb9, 0 ++ mov ra10, 0 ; mov rb10, 0 ++ mov ra11, 0 ; mov rb11, 0 ++# >>> ra_link ++.endm ++ ++::mc_setup_y_q0 ++ m_setup_q0 ++::mc_setup_y_qn ++ m_setup_y 8 ++ ++################################################################################ ++# ++# Start of per-block setup code ++# P and B blocks share the same setup code to save on Icache space ++ ++# get base addresses and per-channel shifts for *next* invocation ++# per-channel shifts were calculated on the *previous* invocation ++ ++# 1st 3 instructions of per_block-setup in branch delay ++# ++# typedef struct qpu_mc_pred_y_p_s { ++# qpu_mc_src_t next_src1; ++# qpu_mc_src_t next_src2; ++# uint16_t h; ++# uint16_t w; ++# uint32_t mymx21; ++# uint32_t wo1; ++# uint32_t wo2; ++# uint32_t dst_addr; ++# uint32_t next_fn; ++# } qpu_mc_pred_y_p_t; ++# ++ ++.macro m_luma_setup, v_bit_depth ++# Hack - QASM may well have have label pasting but I have no idea how... ++.if v_bit_depth == 8 ++ brr ra_link, r:per_block_setup_8 ++.elif v_bit_depth == 10 ++ brr ra_link, r:per_block_setup_10 ++.endif ++ mov ra0, unif ; mov r3, elem_num # y_x ; elem_num has implicit unpack?? ++ add.setf -, rb_ef, rb_ef ; v8subs r5rep, r2, r2 # [ra0 delay] ; r5 = 0 ++ add r0, ra0.16b, r3 ; mov rb_xshift2, rb_xshift2_next ++.endm ++ ++.macro m_per_block_setup, v_bit_depth ++ ++.if v_bit_depth <= 8 ++.set v_x_shift, 0 ++.set v_x_mul, 1 ++# Shifts to get width & height in the right place in ra_dma0 ++.set v_dma_h_shift, 7 ++.set v_dma_wh_shift, i_shift16 ++.else ++.set v_x_shift, 1 ++.set v_x_mul, 2 ++# Shifts to get width & height in the right place in ra_dma0 ++.set v_dma_h_shift, 8 ++.set v_dma_wh_shift, 15 ++.endif ++ ++.if v_x_shift != 0 ++ shl r0, r0, v_x_shift ++.endif ++ max r0, r0, r5 ; mov ra_xshift, ra_xshift_next ++ min r0, r0, rb_max_x ++ ++ shl ra_xshift_next, r0, 3 # Compute shifts ++ and r0, r0, -4 ++ sub r2, r5, rb_pitch ; mov ra_base_next, unif # ; src1.base ++ and r1, r0, r2 ; mov ra_y_next, ra0.16a ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 ; mov ra1, unif # Add stripe offsets ; src2.x_y ++ add ra_base_next, ra_base_next, r0 # [ra1 delay] ++ ++ add r0, ra1.16b, r3 # Load x2 ++.if v_x_shift != 0 ++ shl r0, r0, v_x_shift ++.endif ++ max r0, r0, r5 ; mov ra_y2_next, ra1.16a ++ min r0, r0, rb_max_x ; mov rb_base2_next, unif # ; src2.base ++ shl rb_xshift2_next, r0, 3 # Compute shifts ++ and r0, r0, -4 ; mov ra_width_height, unif # ; width_height ++ and r1, r0, r2 ; mov vw_setup, rb_vpm_init # ; set up VPM write ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 ; mul24 r1, ra_width, v_x_mul # Add stripe offsets ; r1 = x in bytes ++ add rb_base2_next, rb_base2_next, r0 ++ ++# get width,height of block (unif load above), r1 = width * pel_size ++ sub rb_dma1, rb_dma1_base, r1 ; mov r0, ra_height # Compute vdw_setup1(dst_pitch-width) ++ add rb_i_tmu, r0, (7-8) - PREREAD ; v8min r0, r0, ra_blk_height ++ add rb_lcount, r0, (7-8) ++ shl r0, r0, v_dma_h_shift ; mov r3, ra_kmul_add # ; r3 return val ++ add r0, r0, r1 # Combine width and height of destination area ++ shl r0, r0, v_dma_wh_shift ; mov r2, ra_fir_off_val # Shift into bits 16 upwards of the vdw_setup0 register ; r2 return val ++ add ra_dma0, r0, rb_dma0_base ; mov r0, unif # ; Packed filter offsets ++ ++# get filter coefficients and discard unused B frame values ++ shl.ifnn r0, r0, i_shift16 ; mov ra_wt_off_mul_l0, unif # Pick half to use ; L0 offset/weight ++ shl ra8, r0, 3 ; mov rb5, ra_k255 ++ ++# Coeffs are all abs values here as that means mul24 works (no sign extend from .8) ++ ++# 2nd half coeffs same as first if we can swap 8<->24 in the rotate val ++# but I can't see a way of doing that that is cheap enough to be worth it ++ ++# Picked out in a slightly random order to space out uniform loads ++ ++ # 1 ++ mov r1, 0x01040400 # [ra8 delay] ++ ror ra2.8b, r1, ra8.8d ++ ror ra0.8b, r1, ra8.8c ++ # 2 ++ ror ra2.8c, rb_y_coeffs_2, ra8.8d ++ ror ra0.8c, rb_y_coeffs_2, ra8.8c ++ # 0 ++ mov r1,0x00010100 # -ve [ra8 delay] ++ ror r0, r1, ra8.8d ; mov ra_wt_off_mul_l1, unif # ; L1 Wt/Offset ++ ror ra0.8a, r1, ra8.8c ; v8min rb4, r0, rb5 ++ # 7 ++ shl r1, r1, 8 ; mov.ifn ra_wt_off_mul_l0, ra_wt_off_mul_l1 # r1 = 0x01010000 ++ ror r0, r1, ra8.8d ; mov ra_dest, unif # ; Destination address ++ ror ra1.8d, r1, ra8.8c ; v8min rb11, r0, rb5 ++ # 3 ++ ror ra2.8d, rb_y_coeffs_3, ra8.8d ++ ror ra0.8d, rb_y_coeffs_3, ra8.8c ++ # 5 ++ ror ra3.8b, rb_y_coeffs_5, ra8.8d ++ ror ra1.8b, rb_y_coeffs_5, ra8.8c ++ # 6 ++ mov r1,0x04040100 ++ ror ra3.8c, r1, ra8.8d ++ ror ra1.8c, r1, ra8.8c ; mov r5rep, -8 # ; r5 return val ++ ++ bra -, ra_link ++ # 4 ++ mov r1,0x3a281100 ++ ror r0, r1, ra8.8d ; mov ra_link, unif # ; link - load after we've used its previous val ++ ror ra1.8a, r1, ra8.8c ; v8min rb8, r0, rb5 ++# >>> branch ra_link ++ ++# r5 = -8 ++# r2 = fir_off_val ++# r3 = 128 ++.endm ++ ++:per_block_setup_8 ++ m_per_block_setup 8 ++ ++ ++ ++################################################################################ ++# ++# mc_filter_y_pxx ++# ++# Setup (& therefore uniform struct) shared with _bxx ++# Struct in m_luma_setup ++# ++# We can have 2 separate P reqs here as long as they mate to generate a ++# rectangular output block (i.e. h0 = h1, w0 = 8) ++# ++# At this point we have already issued PREREAD pairs of texture requests for the current block ++ ++.macro m_filter_y_pxx, v_bit_depth ++ ++# denom shift values ++.set i_wt_den_p5, (DENOM + 13 - v_bit_depth) ++.set i_wt_den_p6, (DENOM + 14 - v_bit_depth) ++ ++ m_luma_setup v_bit_depth ++ ++ shl r1, ra_wt_off_l0, i_wt_den_p5 ++ add ra_wt_mul_l0, ra_wt_mul_l0, r3 ; mul24 r0, r2, ra_wt_mul_l0 # r2 = 0x4000 so mul24 safe even with -ve wt_mul ++ sub rb_wt_off, r1, r0 ; mov ra_ef.8a, rb4 ++ ++# retrieve texture results and pick out bytes ++# then submit two more texture requests ++ ++# This loop is identical to the B loop from here ---> ++:1 ++ add.setf -, ra_ef, ra_ef ; mul24 ra4, rb5, ra_ef ++ ++ max r2, ra_y, 0 ; mov r1, 0 ++ min r2, r2, rb_max_y ; mov r3, ra_k1 ++ add ra_y, ra_y, r3 ; mul24 r2, r2, rb_pitch ; ldtmu0 ++ add t0s, ra_base, r2 ; mov rb5, rb6 ++ shr r0, r4, ra_xshift ; mov rb6, rb7 ++ ++ max r2, ra_y2, r1 ; v8min r0, r0, rb_pmask ; ldtmu1 # ; masks out all but wanted bytes ++ shr r1, r4, rb_xshift2 ; mov rb7, ra8 ++ min r2, r2, rb_max_y ; v8min r1, r1, ra_pmax ++ add ra_y2, ra_y2, r3 ; mul24 r2, r2, rb_pitch ++ add t1s, rb_base2, r2 ; mov ra8, ra9 ++ ++# apply horizontal filter ++ add r5rep, r5, r3 ; mul24 r2, ra0.8a << 8, r1 << 8 @ "mul_used", 0 ++ mov r3, rb_fir_off_h ; mul24.ifnn r2, ra0.8a, r0 ++ sub r2, r3, r2 ; mul24 r3, ra0.8b << 1, r0 << 1 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra0.8b << 9, r1 << 9 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra0.8c << 2, r0 << 2 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra0.8c << 10, r1 << 10 @ "mul_used", 0 ++ sub r2, r2, r3 ; mul24 r3, ra0.8d << 3, r0 << 3 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra0.8d << 11, r1 << 11 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra1.8a << 4, r0 << 4 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra1.8a << 12, r1 << 12 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra1.8b << 5, r0 << 5 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra1.8b << 13, r1 << 13 @ "mul_used", 0 ++ sub r2, r2, r3 ; mul24 r3, ra1.8c << 6, r0 << 6 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra1.8d << 7, r0 << 7 @ "mul_used", 0 ++ add.setf -, r5, r5 ; mul24.ifn r3, ra1.8d << 15, r1 << 15 @ "mul_used", 0 ++ ++ brr.anyn -, r:1b ++ sub r2, r2, r3 ; mul24 r1, rb5, ra2.8b ++ mov ra9, rb10 ; mul24 r0, rb10, ra3.8b ++ asr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 ++ # >>> .anyn 1b (r5 + r5) ++ ++ # apply vertical filter and write to VPM ++ # - r4* + r5 - r6 + r7 + r8 - r9 + r10 - r11 ++ ++ sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++ sub r1, r1, r0 ; mul24 r0, rb7, ra2.8d ++ add r1, r1, r0 ; mul24 r0, ra8, rb8 ++ add r1, r1, r0 ; mul24 r0, rb10, ra3.8c ++ add r1, r1, r0 ; mul24 r0, ra11, rb11 ++# <--- to here ++ sub.setf -, r5, rb_i_tmu ; mov r3, ra_blk_height # ; NxtLoop: r3 = block height ++ sub r1, r1, ra4 ; mov.ifz rb_base2, rb_base2_next ++ sub r1, r1, r0 ; mov.ifz ra_base, ra_base_next ++ ++ asr r1, r1, 6 ; mov.ifz ra_y_y2, ra_y_y2_next ++ sub.setf -, r5, rb_lcount ; mul24 r0, r1, ra_wt_mul_l0 ++ add r0, r0, rb_wt_off ; mul24 r1, r1, ra_kmul_add ++ sub r1, r0, r1 ; v8subs r0, ra_height, r3 # ; NxtLoop: r0 = remaining height (0 saturate) ++ ++ brr.anyn -, r:1b ++ asr r1, r1, i_wt_den_p6 ++ min r1, r1, ra_pmax ; mov -, vw_wait ++ max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch # ; NxtLoop ++# >>> branch.anyn 1b (r5 - rb_lcount) ++ ++# r0 = remaining height (min 0) ++# r2 = r3 * rb_pitch ++# r3 = block_height ++ ++# If looping again then we consumed 16 height last loop ++# rb_dma1 (stride) remains constant ++# rb_i_tmu remains const (based on total height) ++# recalc ra_dma0, rb_lcount based on new segment height ++ ++ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # VDW setup 0 ++ ++# DMA out ++ bra.anyz -, ra_link ++ min r0, r0, r3 ; mov vw_setup, rb_dma1 # Stride ++ sub r1, r0, r3 ; mov vw_addr, ra_dest # start the VDW ++ shl r1, r1, i_shift23 ++# >>> .anyz ra_link ++ ++# Here r1 = cur_blk_height - 16 so it will be 0 or -ve ++# We add to dma0 to reduce the number of output lines in the final block ++ brr -, r:1b ++ add rb_lcount, rb_lcount, r0 ++ add ra_dma0, ra_dma0, r1 ++ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer ++# >>> 1b ++.endm ++ ++::mc_filter_y_pxx ++ m_filter_y_pxx 8 ++ ++ ++################################################################################ ++ ++# mc_filter_b(y_x, base, y2_x2, base2, width_height, my2_mx2_my_mx, offsetweight0, this_dst, next_kernel) ++# ++# Setup (& therefore uniform struct) shared with _pxx ++# Struct in m_luma_setup ++# ++# l0 calc in els 0-7, L1 in 8-15 ++# Only els 0-7 write data that is stored back to ram (els 8-15 may write tosh) ++# ++# At this point we have already issued PREREAD pairs of texture requests for the current block ++ ++.macro m_filter_y_bxx, v_bit_depth ++ ++# denom shift values ++.set i_wt_den_p5, (DENOM + 13 - v_bit_depth) ++.set i_wt_den_p6, (DENOM + 14 - v_bit_depth) ++ ++ m_luma_setup v_bit_depth ++ ++ shl r1, ra_wt_off_l0, i_wt_den_p6 ++ add ra_wt_mul_l0, ra_wt_mul_l0, r3 ; mul24 r0, r2, ra_wt_mul_l0 ++ sub r1, r1, r0 ; mul24 r0, r2, ra_wt_mul_l1 ++ sub rb_wt_off, r1, r0 ; mov ra_ef.8a, rb4 ++ ++# This loop is identical to the P loop from here ---> ++:1 ++ add.setf -, ra_ef, ra_ef ; mul24 ra4, rb5, ra_ef ++ ++ max r2, ra_y, 0 ; mov r1, 0 ++ min r2, r2, rb_max_y ; mov r3, ra_k1 ++ add ra_y, ra_y, r3 ; mul24 r2, r2, rb_pitch ; ldtmu0 ++ add t0s, ra_base, r2 ; mov rb5, rb6 ++ shr r0, r4, ra_xshift ; mov rb6, rb7 ++ ++ max r2, ra_y2, r1 ; v8min r0, r0, rb_pmask ; ldtmu1 # ; masks out all but wanted bytes ++ shr r1, r4, rb_xshift2 ; mov rb7, ra8 ++ min r2, r2, rb_max_y ; v8min r1, r1, ra_pmax ++ add ra_y2, ra_y2, r3 ; mul24 r2, r2, rb_pitch ++ add t1s, rb_base2, r2 ; mov ra8, ra9 ++ ++# apply horizontal filter ++ add r5rep, r5, r3 ; mul24 r2, ra0.8a << 8, r1 << 8 @ "mul_used", 0 ++ mov r3, rb_fir_off_h ; mul24.ifnn r2, ra0.8a, r0 ++ sub r2, r3, r2 ; mul24 r3, ra0.8b << 1, r0 << 1 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra0.8b << 9, r1 << 9 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra0.8c << 2, r0 << 2 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra0.8c << 10, r1 << 10 @ "mul_used", 0 ++ sub r2, r2, r3 ; mul24 r3, ra0.8d << 3, r0 << 3 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra0.8d << 11, r1 << 11 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra1.8a << 4, r0 << 4 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra1.8a << 12, r1 << 12 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra1.8b << 5, r0 << 5 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra1.8b << 13, r1 << 13 @ "mul_used", 0 ++ sub r2, r2, r3 ; mul24 r3, ra1.8c << 6, r0 << 6 @ "mul_used", 0 ++ nop ; mul24.ifn r3, ra1.8c << 14, r1 << 14 @ "mul_used", 0 ++ add r2, r2, r3 ; mul24 r3, ra1.8d << 7, r0 << 7 @ "mul_used", 0 ++ add.setf -, r5, r5 ; mul24.ifn r3, ra1.8d << 15, r1 << 15 @ "mul_used", 0 ++ ++ brr.anyn -, r:1b ++ sub r2, r2, r3 ; mul24 r1, rb5, ra2.8b ++ mov ra9, rb10 ; mul24 r0, rb10, ra3.8b ++ asr ra11, r2, v_bit_depth - 8 ; mov rb10, ra11 ++ # >>> .anyn 1b (r5 + r5) ++ ++ # apply vertical filter and write to VPM ++ # - r4* + r5 - r6 + r7 + r8 - r9 + r10 - r11 ++ ++ sub r1, r1, r0 ; mul24 r0, rb6, ra2.8c ++ sub r1, r1, r0 ; mul24 r0, rb7, ra2.8d ++ add r1, r1, r0 ; mul24 r0, ra8, rb8 ++ add r1, r1, r0 ; mul24 r0, rb10, ra3.8c ++ add r1, r1, r0 ; mul24 r0, ra11, rb11 ++# <--- to here ++ sub r1, r1, ra4 ++ sub r1, r1, r0 ; mov r2, rb_wt_off ++ ++ asr r1, r1, 6 ++ sub.setf -, r5, rb_i_tmu ; mul24 r0, r1, ra_wt_mul_l0 ++ mov.ifz rb_base2, rb_base2_next ; mul24 r1, r1, ra_kmul_add ++ sub r1, r0, r1 ; mov.ifz ra_y_y2, ra_y_y2_next ++ sub.setf -, r5, rb_lcount ; mov.ifz ra_base, ra_base_next ++ add r1, r1, r2 ; mov r0, r1 << 8 ++ add r1, r1, r0 ; mov r3, ra_blk_height # ; NxtLoop: r3 = block height ++ ++ brr.anyn -, r:1b ++ asr r1, r1, ra_wt_den_p7 ; mul24 r2, r3, rb_pitch # ; NxtLoop ++ min r1, r1, ra_pmax ; mov -, vw_wait ++ max vpm, r1, 0 ; v8subs r0, ra_height, r3 # ; NxtLoop: r0 = remaining height (0 saturate) ++# >>> branch.anyn 1b (r5 - rb_lcount) ++ ++# r0 = remaining height (min 0) ++# r2 = r3 * rb_pitch ++# r3 = block_height ++ ++# If looping again then we consumed block_height last loop ++# rb_dma1 (stride) remains constant ++# rb_i_tmu remains const (based on total height) ++# recalc ra_dma0, rb_lcount based on new segment height ++ ++ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # VDW setup 0 ++ ++# DMA out ++ bra.anyz -, ra_link ++ min r0, r0, r3 ; mov vw_setup, rb_dma1 # Stride ++ sub r1, r0, r3 ; mov vw_addr, ra_dest # start the VDW ++ shl r1, r1, i_shift23 ++# >>> .anyz ra_link (ra_height - remaining height) ++ ++# Here r1 = cur_blk_height - blk_height so it will be 0 or -ve ++# We add to dma0 to reduce the number of output lines in the final block ++ brr -, r:1b ++ add rb_lcount, rb_lcount, r0 ++ add ra_dma0, ra_dma0, r1 ++ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer ++# >>> 1b ++.endm ++ ++::mc_filter_y_bxx ++ m_filter_y_bxx 8 ++ ++################################################################################ ++# ++# typedef struct qpu_mc_pred_y_p00_s { ++# qpu_mc_src_t next_src1; ++# uint16_t h; ++# uint16_t w; ++# uint32_t wo1; ++# uint32_t dst_addr; ++# uint32_t next_fn; ++# } qpu_mc_pred_y_p00_t; ++ ++.macro m_filter_y_p00, v_bit_depth ++ ++.if v_bit_depth <= 8 ++.set v_x_shift, 0 ++.set v_x_mul, 1 ++# Shifts to get width & height in the right place in ra_dma0 ++.set v_dma_h_shift, 7 ++.set v_dma_wh_shift, i_shift16 ++.else ++.set v_x_shift, 1 ++.set v_x_mul, 2 ++# Shifts to get width & height in the right place in ra_dma0 ++.set v_dma_h_shift, 8 ++.set v_dma_wh_shift, 15 ++.endif ++ ++ mov ra0, unif ; mov r0, elem_num # y_x ++ mov ra_xshift, ra_xshift_next ; v8subs r5rep, r5, r5 # [ra0 delay] ; r5 = 0 ++ add r0, ra0.16b, r0 ; mov ra_base_next, unif # ; src1.base ++.if v_x_shift != 0 ++ shl r0, r0, v_x_shift ++.endif ++ ++ max r0, r0, r5 ; mov ra_y_next, ra0.16a # ; width_height ++ min r0, r0, rb_max_x ; mov ra_width_height, unif ++ ++ shl ra_xshift_next, r0, 3 # Compute shifts ++ and r0, r0, -4 ++ sub r2, r5, rb_pitch ; mov ra_wt_off_mul_l0, unif # ; weight_offset ++ and r1, r0, r2 ++ xor r0, r0, r1 ; mul24 r1, r1, rb_xpitch ++ add r0, r0, r1 ; mov ra_dest, unif # Add stripe offsets ; dest addr ++ add ra_base_next, ra_base_next, r0 ; mov vw_setup, rb_vpm_init # [ra_width delay] ; set up VPM write ++ ++# get width,height of block (unif load above) ++# Compute vdw_setup1(dst_pitch-width) ++ shl r1, ra_width, v_x_shift ++ sub rb_dma1, rb_dma1_base, r1 ; mov r0, ra_height ++ sub rb_i_tmu, r0, PREREAD ; v8min r0, r0, ra_blk_height ++ shl r0, r0, v_dma_h_shift ; mov rb_lcount, r0 ++ add r0, r0, r1 # Combine width and height of destination area ++ shl rb_wt_off, ra_wt_off_l0, DENOM + 7 ++ shl r0, r0, v_dma_wh_shift ; mov ra_link, unif # Shift into bits 16 upwards of the vdw_setup0 register ; link ++ add ra_dma0, r0, rb_dma0_base ++ ++:1 ++ sub.setf -, r5, rb_i_tmu ; v8adds r5rep, r5, ra_k1 ++ nop ; mov.ifz ra_y, ra_y_next ; ldtmu0 ++ shr r0, r4, ra_xshift ; mov r3, rb_pitch ++ ++ max r2, ra_y, 0 # y ++ min r2, r2, rb_max_y ; mov.ifz ra_base, ra_base_next ++ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++ add t0s, ra_base, r2 ; v8min r0, r0, rb_pmask ++ ++ sub.setf -, r5, rb_lcount ; mul24 r1, r0, ra_wt_mul_l0 ++ shl r1, r1, 8 ; mov r3, ra_blk_height ++ add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 ++ ++ brr.anyn -, r:1b ++ asr r1, r1, DENOM + 8 ++ min r1, r1, ra_pmax ; mov -, vw_wait ++ max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++# >>> branch.anyn 1b ++ ++# r0 = remaining height (min 0) ++# r2 = r3 * rb_pitch ++# r3 = block_height ++ ++# If looping again then we consumed 16 height last loop ++# rb_dma1 (stride) remains constant ++# rb_i_tmu remains const (based on total height) ++# recalc ra_dma0, rb_lcount based on new segment height ++ ++ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # VDW setup 0 ++ ++# DMA out ++ bra.anyz -, ra_link ++ min r0, r0, r3 ; mov vw_setup, rb_dma1 # Stride ++ sub r1, r0, r3 ; mov vw_addr, ra_dest # start the VDW ++ shl r1, r1, i_shift23 ++# >>> .anyz ra_link ++ ++# Here r1 = cur_blk_height - 16 so it will be 0 or -ve ++# We add to dma0 to reduce the number of output lines in the final block ++ brr -, r:1b ++ add rb_lcount, rb_lcount, r0 ++ add ra_dma0, ra_dma0, r1 ++ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer ++# >>> 1b ++.endm ++ ++::mc_filter_y_p00 ++ m_filter_y_p00 8 ++ ++################################################################################ ++ ++.macro m_filter_y_b00, v_bit_depth ++# luma setup does a fair bit more than we need calculating filter coeffs ++# that we will never use but it saves I-cache to use it (also simple!) ++ m_luma_setup v_bit_depth ++ ++# Fix up vals that were expecting a filter (somewhat icky) ++ mov r2, 1 ++ add rb_i_tmu, rb_i_tmu, r2 ; mov r1, ra_wt_off_mul_l0 # Need in rX rather than raX for <<8 to do what we want ++ shl rb_wt_off, ra_wt_off_l0, DENOM + 8 ; v8subs r5quad, r5, r5 # [r1 << delay] ; r5quad OK for zero ++ nop ; mov.ifnz ra_wt_off_mul_l0, r1 << 8 ++ ++:1 ++ sub.setf -, r5, rb_i_tmu ; nop ; ldtmu1 ++ shr r1, r4, rb_xshift2 ; mov.ifz ra_y_y2, ra_y_y2_next ; ldtmu0 ++ shr r0, r4, ra_xshift ; mov r3, rb_pitch ++ ++ max r2, ra_y, 0 # y ++ min r2, r2, rb_max_y ; mov.ifz ra_base, ra_base_next ++ add ra_y, ra_y, 1 ; mul24 r2, r2, r3 ++ add t0s, ra_base, r2 ; mov.ifz rb_base2, rb_base2_next ++ ++ max r2, ra_y2, 0 ++ min r2, r2, rb_max_y ++ add ra_y2, ra_y2, 1 ; mul24 r2, r2, r3 ++ add t1s, rb_base2, r2 ; v8min r0, r0, ra_pmax # v8subs masks out all but bottom byte ++ and r1, r1, rb_pmask ; mul24 r0, r0, ra_wt_mul_l0 ++ ++ sub.setf -, r5, rb_lcount ; mul24 r1, r1, ra_wt_mul_l1 ++ add r1, r0, r1 ; v8adds r5rep, r5, ra_k1 ++ ++ shl r1, r1, 8 ; mov r3, ra_blk_height ++ add r1, r1, rb_wt_off ; v8subs r0, ra_height, r3 ++ ++ brr.anyn -, r:1b ++ asr r1, r1, (DENOM + 9) - 32 # -32 to get valid shift immediate ++ min r1, r1, ra_pmax ; mov -, vw_wait ++ max vpm, r1, ra_k0 ; mul24 r2, r3, rb_pitch ++# >>> branch.anyn 1b ++ ++# r0 = remaining height (min 0) ++# r2 = r3 * rb_pitch ++# r3 = block_height ++ ++# If looping again then we consumed 16 height last loop ++# rb_dma1 (stride) remains constant ++# rb_i_tmu remains const (based on total height) ++# recalc ra_dma0, rb_lcount based on new segment height ++ ++ mov.setf ra_height, r0 ; mov vw_setup, ra_dma0 # ; VDW setup 0 ++ ++# DMA out ++ bra.anyz -, ra_link ++ min r0, r0, r3 ; mov vw_setup, rb_dma1 # ; Stride ++ sub r1, r0, r3 ; mov vw_addr, ra_dest # ; start the VDW ++ shl r1, r1, i_shift23 ++# >>> .anyz ra_link ++ ++# Here r1 = cur_blk_height - 16 so it will be 0 or -ve ++# We add to dma0 to reduce the number of output lines in the final block ++ brr -, r:1b ++ add rb_lcount, rb_lcount, r0 ++ add ra_dma0, ra_dma0, r1 ++ add ra_dest, ra_dest, r2 ; mov vw_setup, rb_vpm_init # ; Reset our VDM write pointer ++# >>> 1b ++.endm ++ ++::mc_filter_y_b00 ++ m_filter_y_b00 8 ++ ++################################################################################ ++################################################################################ ++# 10 BIT ++ ++::mc_setup_c10_q0 ++ m_setup_q0 ++::mc_setup_c10_qn ++ m_setup_c 10 ++ ++::mc_filter_c10_p ++ m_filter_c_p 0, 10 ++ ++::mc_filter_c10_p_l1 ++ m_filter_c_p 1, 10 ++ ++ ++::mc_filter_c10_b ++ m_filter_c_b 10 ++ ++# Even if these fns are the same as for other bit depths we want our own copy ++# to keep the code we are using in a single lump to avoid (direct map) cache ++# thrashing ++.set v_quads10, N_QPU_16 / 4 ++ ++::mc_sync10_q0 ++ m_sync_q 0, v_quads10 ++::mc_sync10_q1 ++ m_sync_q 1, v_quads10 ++::mc_sync10_q2 ++ m_sync_q 2, v_quads10 ++::mc_sync10_q3 ++ m_sync_q 3, v_quads10 ++::mc_sync10_q4 ++ m_sync_q 4, v_quads10 ++::mc_sync10_q5 ++ m_sync_q 5, v_quads10 ++::mc_sync10_q6 ++ m_sync_q 6, v_quads10 ++::mc_sync10_q7 ++ m_sync_q 7, v_quads10 ++::mc_sync10_q8 ++ m_sync_q 8, v_quads10 ++::mc_sync10_q9 ++ m_sync_q 9, v_quads10 ++::mc_sync10_q10 ++ m_sync_q 10, v_quads10 ++::mc_sync10_q11 ++ m_sync_q 11, v_quads10 ++ ++::mc_exit_y10_q0 ++::mc_exit_c10_q0 ++ m_exit_q0 ++ ++::mc_exit_y10_qn ++::mc_exit_c10_qn ++ m_exit_qn ++ ++::mc_setup_y10_q0 ++ m_setup_q0 ++::mc_setup_y10_qn ++ m_setup_y 10 ++ ++:per_block_setup_10 ++ m_per_block_setup 10 ++ ++::mc_filter_y10_pxx ++ m_filter_y_pxx 10 ++ ++::mc_filter_y10_p00 ++ m_filter_y_p00 10 ++ ++::mc_filter_y10_bxx ++ m_filter_y_bxx 10 ++ ++::mc_filter_y10_b00 ++ m_filter_y_b00 10 ++ ++ ++ ++::mc_end ++# Do not add code here because mc_end must appear after all other code. +--- /dev/null ++++ b/libavcodec/rpi_hevc_shader_cmd.h +@@ -0,0 +1,165 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#ifndef RPI_SHADER_CMD_H ++#define RPI_SHADER_CMD_H ++ ++#pragma pack(push, 4) ++ ++#if RPI_QPU_EMU_C && RPI_QPU_EMU_Y ++// If mixed then we are just confused and get a lot of warnings.... ++typedef const uint8_t * qpu_mc_src_addr_t; ++typedef uint8_t * qpu_mc_dst_addr_t; ++#else ++typedef uint32_t qpu_mc_src_addr_t; ++typedef uint32_t qpu_mc_dst_addr_t; ++#endif ++ ++typedef struct qpu_mc_src_s ++{ ++ int16_t y; ++ int16_t x; ++ qpu_mc_src_addr_t base; ++} qpu_mc_src_t; ++ ++ ++typedef struct qpu_mc_pred_c_p_s { ++ qpu_mc_src_t next_src; ++ uint16_t h; ++ uint16_t w; ++ uint32_t coeffs_x; ++ uint32_t coeffs_y; ++ uint32_t wo_u; ++ uint32_t wo_v; ++ qpu_mc_dst_addr_t dst_addr_c; ++ uint32_t next_fn; ++} qpu_mc_pred_c_p_t; ++ ++typedef struct qpu_mc_pred_c_b_s { ++ qpu_mc_src_t next_src1; ++ uint16_t h; ++ uint16_t w; ++ uint32_t coeffs_x1; ++ uint32_t coeffs_y1; ++ int16_t weight_u1; ++ int16_t weight_v1; ++ qpu_mc_src_t next_src2; ++ uint32_t coeffs_x2; ++ uint32_t coeffs_y2; ++ uint32_t wo_u2; ++ uint32_t wo_v2; ++ qpu_mc_dst_addr_t dst_addr_c; ++ uint32_t next_fn; ++} qpu_mc_pred_c_b_t; ++ ++typedef struct qpu_mc_pred_c_s_s { ++ qpu_mc_src_t next_src1; ++ uint32_t pic_cw; // C Width (== Y width / 2) ++ uint32_t pic_ch; // C Height (== Y Height / 2) ++ uint32_t stride2; ++ uint32_t stride1; ++ qpu_mc_src_t next_src2; ++ uint32_t next_fn; ++} qpu_mc_pred_c_s_t; ++ ++typedef struct qpu_mc_pred_c_s { ++ union { ++ qpu_mc_pred_c_p_t p; ++ qpu_mc_pred_c_b_t b; ++ qpu_mc_pred_c_s_t s; ++ }; ++} qpu_mc_pred_c_t; ++ ++ ++typedef struct qpu_mc_pred_y_p_s { ++ qpu_mc_src_t next_src1; ++ qpu_mc_src_t next_src2; ++ uint16_t h; ++ uint16_t w; ++ uint32_t mymx21; ++ uint32_t wo1; ++ uint32_t wo2; ++ qpu_mc_dst_addr_t dst_addr; ++ uint32_t next_fn; ++} qpu_mc_pred_y_p_t; ++ ++typedef struct qpu_mc_pred_y_p00_s { ++ qpu_mc_src_t next_src1; ++ uint16_t h; ++ uint16_t w; ++ uint32_t wo1; ++ qpu_mc_dst_addr_t dst_addr; ++ uint32_t next_fn; ++} qpu_mc_pred_y_p00_t; ++ ++typedef struct qpu_mc_pred_y_s_s { ++ qpu_mc_src_t next_src1; ++ qpu_mc_src_t next_src2; ++ uint16_t pic_h; ++ uint16_t pic_w; ++ uint32_t stride2; ++ uint32_t stride1; ++ uint32_t next_fn; ++} qpu_mc_pred_y_s_t; ++ ++typedef struct qpu_mc_pred_sync_s { ++ uint32_t next_fn; ++} qpu_mc_pred_sync_t; ++ ++// Only a useful structure in that it allows us to return something other than a void * ++typedef struct qpu_mc_pred_y_s { ++ union { ++ qpu_mc_pred_y_p_t p; ++ qpu_mc_pred_y_p00_t p00; ++ qpu_mc_pred_y_s_t s; ++ }; ++} qpu_mc_pred_y_t; ++ ++typedef union qpu_mc_pred_cmd_u { ++ qpu_mc_pred_y_t y; ++ qpu_mc_pred_c_t c; ++ qpu_mc_pred_sync_t sync; ++} qpu_mc_pred_cmd_t; ++ ++static void inline qpu_mc_link_set(qpu_mc_pred_cmd_t * const cmd, const uint32_t fn) ++{ ++ // Link is last el of previous cmd ++ ((uint32_t *)cmd)[-1] = fn; ++} ++ ++#define QPU_MC_PRED_N_Y8 12 ++#define QPU_MC_PRED_N_C8 12 ++ ++#define QPU_MC_PRED_N_Y10 12 ++#define QPU_MC_PRED_N_C10 12 ++ ++#define QPU_MC_DENOM 7 ++ ++#pragma pack(pop) ++ ++#endif ++ +--- /dev/null ++++ b/libavcodec/rpi_hevc_shader_template.c +@@ -0,0 +1,88 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include "hevc.h" ++#include "rpi_hevcdec.h" ++#include "libavutil/rpi_sand_fns.h" ++#include "rpi_hevc_shader_cmd.h" ++#include "rpi_hevc_shader_template.h" ++ ++typedef struct shader_track_s ++{ ++ const union qpu_mc_pred_cmd_u *qpu_mc_curr; ++ const struct qpu_mc_src_s *last_l0; ++ const struct qpu_mc_src_s *last_l1; ++ uint32_t width; // pic_width * PW ++ uint32_t height; ++ uint32_t stride2; ++ uint32_t stride1; ++} shader_track_t; ++ ++static int wtoidx(const unsigned int w) ++{ ++ static const uint8_t pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; ++ return pel_weight[w]; ++} ++ ++static const int fctom(uint32_t x) ++{ ++ int rv; ++ // As it happens we can take the 2nd filter term & divide it by 8 ++ // (dropping fractions) to get the fractional move ++ rv = 8 - ((x >> 11) & 0xf); ++ av_assert2(rv >= 0 && rv <= 7); ++ return rv; ++} ++ ++static inline int32_t ext(int32_t x, unsigned int shl, unsigned int shr) ++{ ++ return (x << shl) >> shr; ++} ++ ++static inline int woff_p(HEVCRpiContext *const s, int32_t x) ++{ ++ return ext(x, 0, 17 + s->ps.sps->bit_depth - 8); ++} ++ ++static inline int woff_b(HEVCRpiContext *const s, int32_t x) ++{ ++ return ext(x - 0x10000, 0, 16 + s->ps.sps->bit_depth - 8); ++} ++ ++static inline int wweight(int32_t x) ++{ ++ return ext(x, 16, 16); ++} ++ ++ ++#define PW 1 ++#include "rpi_hevc_shader_template_fn.h" ++ ++#undef PW ++#define PW 2 ++#include "rpi_hevc_shader_template_fn.h" ++ +--- /dev/null ++++ b/libavcodec/rpi_hevc_shader_template.h +@@ -0,0 +1,49 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#ifndef LIBAVCODEC_RPI_SHADER_TEMPLATE_H ++#define LIBAVCODEC_RPI_SHADER_TEMPLATE_H ++ ++struct HEVCRpiContext; ++struct HEVCRpiInterPredEnv; ++ ++void ff_hevc_rpi_shader_c8(struct HEVCRpiContext *const s, ++ const struct HEVCRpiInterPredEnv *const ipe_y, ++ const struct HEVCRpiInterPredEnv *const ipe_c); ++ ++void ff_hevc_rpi_shader_c16(struct HEVCRpiContext *const s, ++ const struct HEVCRpiInterPredEnv *const ipe_y, ++ const struct HEVCRpiInterPredEnv *const ipe_c); ++ ++void rpi_sand_dump8(const char * const name, ++ const uint8_t * const base, const int stride1, const int stride2, int x, int y, int w, int h, const int is_c); ++ ++void rpi_sand_dump16(const char * const name, ++ const uint8_t * const base, const int stride1, const int stride2, int x, int y, int w, int h, const int is_c); ++ ++#endif ++ +--- /dev/null ++++ b/libavcodec/rpi_hevc_shader_template_fn.h +@@ -0,0 +1,502 @@ ++/* ++Copyright (c) 2017 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#define STRCAT(x,y) x##y ++ ++#if PW == 1 ++#define pixel uint8_t ++#define FUNC(f) STRCAT(f, 8) ++#elif PW == 2 ++#define pixel uint16_t ++#define FUNC(f) STRCAT(f, 16) ++#else ++#error Unexpected PW ++#endif ++ ++#define PATCH_STRIDE (16 * PW) ++ ++static void FUNC(dup_lr)(uint8_t * dst, const uint8_t * src, unsigned int w, unsigned int h, unsigned int stride) ++{ ++ for (unsigned int i = 0; i != h; ++i, dst += stride, src += stride) { ++ const pixel s = *(const pixel *)src; ++ pixel * d = (pixel *)dst; ++ for (unsigned int j = 0; j < w; j += PW) { ++ *d++ = s; ++ } ++ } ++} ++ ++static void FUNC(dup_tb)(uint8_t * dst, const uint8_t * src, unsigned int w, unsigned int h, unsigned int stride) ++{ ++ for (unsigned int i = 0; i != h; ++i, dst += stride) { ++ memcpy(dst, src, w); ++ } ++} ++ ++static void FUNC(get_patch_y)(const shader_track_t * const st, ++ uint8_t * dst, const unsigned int dst_stride, ++ const qpu_mc_src_t *src, ++ unsigned int _w, unsigned int _h) ++{ ++ int x = src->x * PW; ++ int y = src->y; ++ int w = _w * PW; ++ int h = _h; ++ int dl = 0; ++ int dr = 0; ++ int dt = 0; ++ int db = 0; ++ ++ if (x < 0) { ++ if (-x >= w) ++ x = PW - w; ++ dl = -x; ++ w += x; ++ x = 0; ++ } ++ if (x + w > st->width) { ++ if (x >= st->width) ++ x = st->width - PW; ++ dr = (x + w) - st->width; ++ w = st->width - x; ++ } ++ ++ // Y ++ if (y < 0) { ++ if (-y >= h) ++ y = 1 - h; ++ dt = -y; ++ h += y; ++ y = 0; ++ } ++ if (y + h > st->height) { ++ if (y >= st->height) ++ y = st->height - 1; ++ db = (y + h) - st->height; ++ h = st->height - y; ++ } ++ ++ dst += dl + dt * dst_stride; ++ FUNC(av_rpi_sand_to_planar_y)(dst, dst_stride, (const uint8_t *)src->base, st->stride1, st->stride2, x, y, w, h); ++ ++ // Edge dup ++ if (dl != 0) ++ FUNC(dup_lr)(dst - dl, dst, dl, h, dst_stride); ++ if (dr != 0) ++ FUNC(dup_lr)(dst + w, dst + w - PW, dr, h, dst_stride); ++ w += dl + dr; ++ dst -= dl; ++ ++ if (dt != 0) ++ FUNC(dup_tb)(dst - dt * dst_stride, dst, w, dt, dst_stride); ++ if (db != 0) ++ FUNC(dup_tb)(dst + h * dst_stride, dst + (h - 1) * dst_stride, w, db, dst_stride); ++} ++ ++ ++ ++static void FUNC(get_patch_c)(const shader_track_t * const st, ++ uint8_t * dst_u, uint8_t * dst_v, const unsigned int dst_stride, ++ const qpu_mc_src_t *src, ++ unsigned int _w, unsigned int _h) ++{ ++ int x = src->x * PW; ++ int y = src->y; ++ int w = _w * PW; ++ int h = _h; ++ int dl = 0; ++ int dr = 0; ++ int dt = 0; ++ int db = 0; ++ const int width = st->width; ++ const int height = st->height; ++ ++ if (x < 0) { ++ if (-x >= w) ++ x = PW - w; ++ dl = -x; ++ w += x; ++ x = 0; ++ } ++ if (x + w > width) { ++ if (x >= width) ++ x = width - PW; ++ dr = (x + w) - width; ++ w = width - x; ++ } ++ ++ // Y ++ if (y < 0) { ++ if (-y >= h) ++ y = 1 - h; ++ dt = -y; ++ h += y; ++ y = 0; ++ } ++ if (y + h > height) { ++ if (y >= height) ++ y = height - 1; ++ db = (y + h) - height; ++ h = height - y; ++ } ++ ++ dst_u += dl + dt * dst_stride; ++ dst_v += dl + dt * dst_stride; ++ FUNC(av_rpi_sand_to_planar_c)(dst_u, dst_stride, dst_v, dst_stride, (const uint8_t *)src->base, st->stride1, st->stride2, x, y, w, h); ++ ++ // Edge dup ++ if (dl != 0) ++ { ++ FUNC(dup_lr)(dst_u - dl, dst_u, dl, h, dst_stride); ++ FUNC(dup_lr)(dst_v - dl, dst_v, dl, h, dst_stride); ++ } ++ if (dr != 0) ++ { ++ FUNC(dup_lr)(dst_u + w, dst_u + w - PW, dr, h, dst_stride); ++ FUNC(dup_lr)(dst_v + w, dst_v + w - PW, dr, h, dst_stride); ++ } ++ w += dl + dr; ++ dst_u -= dl; ++ dst_v -= dl; ++ ++ if (dt != 0) ++ { ++ FUNC(dup_tb)(dst_u - dt * dst_stride, dst_u, w, dt, dst_stride); ++ FUNC(dup_tb)(dst_v - dt * dst_stride, dst_v, w, dt, dst_stride); ++ } ++ if (db != 0) ++ { ++ FUNC(dup_tb)(dst_u + h * dst_stride, dst_u + (h - 1) * dst_stride, w, db, dst_stride); ++ FUNC(dup_tb)(dst_v + h * dst_stride, dst_v + (h - 1) * dst_stride, w, db, dst_stride); ++ } ++} ++ ++// w, y, w, h in pixels ++// stride1, stride2 in bytes ++void FUNC(rpi_sand_dump)(const char * const name, ++ const uint8_t * const base, const int stride1, const int stride2, int x, int y, int w, int h, const int is_c) ++{ ++ const int mask = stride2 == 0 ? ~0 : stride1 - 1; ++ ++ printf("%s (%d,%d) %dx%d\n", name, x, y, w, h); ++ ++ if (is_c) { ++ x *= 2; ++ w *= 2; ++ } ++ ++ for (int i = y; i != y + h; ++i) { ++ for (int j = x; j != x + w; ++j) { ++ const uint8_t * p = base + ((j*PW) & mask) + i * stride1 + ((j*PW) & ~mask) * stride2; ++ char sep = is_c && (j & 1) == 0 ? ':' : ' '; ++#if PW == 1 ++ if (j < 0 || i < 0) ++ printf("..%c", sep); ++ else ++ printf("%02x%c", *(const pixel*)p, sep); ++#else ++ if (j < 0 || i < 0) ++ printf("...%c", sep); ++ else ++ printf("%03x%c", *(const pixel*)p, sep); ++#endif ++ } ++ printf("\n"); ++ } ++} ++ ++ ++void FUNC(ff_hevc_rpi_shader_c)(HEVCRpiContext *const s, ++ const HEVCRpiInterPredEnv *const ipe_y, ++ const HEVCRpiInterPredEnv *const ipe_c) ++{ ++ for (int c_idx = 0; c_idx < 2; ++c_idx) ++ { ++ const HEVCRpiInterPredEnv *const ipe = c_idx == 0 ? ipe_y : ipe_c; ++ shader_track_t tracka[QPU_N_MAX] = {{NULL}}; ++ unsigned int exit_n = 0; ++ ++ if (ipe == NULL || !ipe->used) { ++ continue; ++ } ++ ++ do { ++ for (unsigned int i = 0; i != ipe->n; ++i) { ++ const HEVCRpiInterPredQ * const q = ipe->q + i; ++ shader_track_t * const st = tracka + i; ++ const qpu_mc_pred_cmd_t * cmd = st->qpu_mc_curr == NULL ? q->qpu_mc_base : st->qpu_mc_curr; ++ ++ for (;;) { ++ const uint32_t link = (cmd == q->qpu_mc_base) ? q->code_setup : ((uint32_t *)cmd)[-1]; ++ ++ if (link == q->code_setup) { ++ if (c_idx == 0) { ++ // Luma ++ const qpu_mc_pred_y_s_t *const c = &cmd->y.s; ++ ++ st->height = c->pic_h; ++ st->width = c->pic_w * PW; ++ st->stride1 = c->stride1; ++ st->stride2 = c->stride2; ++ st->last_l0 = &c->next_src1; ++ st->last_l1 = &c->next_src2; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ else { ++ // Chroma ++ const qpu_mc_pred_c_s_t *const c = &cmd->c.s; ++ ++ st->height = c->pic_ch; ++ st->width = c->pic_cw * PW; ++ st->stride1 = c->stride1; ++ st->stride2 = c->stride2; ++ st->last_l0 = &c->next_src1; ++ st->last_l1 = &c->next_src2; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ } ++ else if (link == s->qpu.y_pxx) { ++ const qpu_mc_pred_y_p_t *const c = &cmd->y.p; ++ const int w1 = FFMIN(c->w, 8); ++ const int w2 = c->w - w1; ++ ++ uint8_t patch_y1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ uint8_t patch_y2[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ ++ FUNC(get_patch_y)(st, ++ patch_y1, PATCH_STRIDE, ++ st->last_l0, ++ 16, c->h + 7); ++ if (w2 > 0) { ++ FUNC(get_patch_y)(st, ++ patch_y2, PATCH_STRIDE, ++ st->last_l1, ++ 16, c->h + 7); ++ } ++ ++ // wo[offset] = offset*2+1 ++ s->hevcdsp.put_hevc_qpel_uni_w[wtoidx(w1)][(c->mymx21 & 0xff00) != 0][(c->mymx21 & 0xff) != 0]( ++ (uint8_t *)c->dst_addr, st->stride1, patch_y1 + 3 * (PATCH_STRIDE + PW), PATCH_STRIDE, ++ c->h, QPU_MC_DENOM, wweight(c->wo1), woff_p(s, c->wo1), (c->mymx21 & 0xff), ((c->mymx21 >> 8) & 0xff), w1); ++ if (w2 > 0) { ++ s->hevcdsp.put_hevc_qpel_uni_w[wtoidx(w2)][(c->mymx21 & 0xff000000) != 0][(c->mymx21 & 0xff0000) != 0]( ++ (uint8_t *)c->dst_addr + 8 * PW, st->stride1, patch_y2 + 3 * (PATCH_STRIDE + PW), PATCH_STRIDE, ++ c->h, QPU_MC_DENOM, wweight(c->wo2), woff_p(s, c->wo2), ((c->mymx21 >> 16) & 0xff), ((c->mymx21 >> 24) & 0xff), w2); ++ } ++ st->last_l0 = &c->next_src1; ++ st->last_l1 = &c->next_src2; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ else if (link == s->qpu.y_bxx) { ++ const qpu_mc_pred_y_p_t *const c = &cmd->y.p; ++ ++ uint8_t patch_y1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ uint8_t patch_y2[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ int16_t patch_y3[MAX_PB_SIZE * MAX_PB_SIZE]; ++ ++ FUNC(get_patch_y)(st, ++ patch_y1, PATCH_STRIDE, ++ st->last_l0, ++ 16, c->h + 7); ++ FUNC(get_patch_y)(st, ++ patch_y2, PATCH_STRIDE, ++ st->last_l1, ++ 16, c->h + 7); ++ ++ s->hevcdsp.put_hevc_qpel[wtoidx(c->w)][(c->mymx21 & 0xff00) != 0][(c->mymx21 & 0xff) != 0]( ++ patch_y3, patch_y1+ 3 * (PATCH_STRIDE + PW), PATCH_STRIDE, ++ c->h, (c->mymx21 & 0xff), ((c->mymx21 >> 8) & 0xff), c->w); ++ ++ s->hevcdsp.put_hevc_qpel_bi_w[wtoidx(c->w)][(c->mymx21 & 0xff000000) != 0][(c->mymx21 & 0xff0000) != 0]( ++ (uint8_t *)c->dst_addr, st->stride1, patch_y2 + 3 * (PATCH_STRIDE + PW), PATCH_STRIDE, patch_y3, ++ c->h, QPU_MC_DENOM, wweight(c->wo1), wweight(c->wo2), ++ 0, woff_b(s, c->wo2), ((c->mymx21 >> 16) & 0xff), ((c->mymx21 >> 24) & 0xff), c->w); ++ st->last_l0 = &c->next_src1; ++ st->last_l1 = &c->next_src2; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ else if (link == s->qpu.y_p00) { ++ const qpu_mc_pred_y_p00_t *const c = &cmd->y.p00; ++ ++ uint8_t patch_y1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ ++ FUNC(get_patch_y)(st, ++ patch_y1, PATCH_STRIDE, ++ st->last_l0, ++ 16, c->h + 7); ++ ++ // wo[offset] = offset*2+1 ++ s->hevcdsp.put_hevc_qpel_uni_w[wtoidx(c->w)][0][0]( ++ (uint8_t *)c->dst_addr, st->stride1, patch_y1, PATCH_STRIDE, ++ c->h, QPU_MC_DENOM, wweight(c->wo1), woff_p(s, c->wo1), 0, 0, c->w); ++ ++ st->last_l0 = &c->next_src1; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ else if (link == s->qpu.y_b00) { ++ const qpu_mc_pred_y_p_t *const c = &cmd->y.p; ++ ++ uint8_t patch_y1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ uint8_t patch_y2[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ int16_t patch_y3[MAX_PB_SIZE * MAX_PB_SIZE]; ++ ++ av_assert0(c->w <= 16 && c->h <= 64); ++ ++ FUNC(get_patch_y)(st, ++ patch_y1, PATCH_STRIDE, ++ st->last_l0, ++ 16, c->h); ++ FUNC(get_patch_y)(st, ++ patch_y2, PATCH_STRIDE, ++ st->last_l1, ++ 16, c->h); ++ ++ s->hevcdsp.put_hevc_qpel[wtoidx(c->w)][0][0]( ++ patch_y3, patch_y1, PATCH_STRIDE, ++ c->h, 0, 0, c->w); ++ ++ s->hevcdsp.put_hevc_qpel_bi_w[wtoidx(c->w)][0][0]( ++ (uint8_t *)c->dst_addr, st->stride1, patch_y2, PATCH_STRIDE, patch_y3, ++ c->h, QPU_MC_DENOM, wweight(c->wo1), wweight(c->wo2), ++ 0, woff_b(s, c->wo2), 0, 0, c->w); ++ st->last_l0 = &c->next_src1; ++ st->last_l1 = &c->next_src2; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ else if (link == s->qpu.c_pxx) { ++ const qpu_mc_pred_c_p_t *const c = &cmd->c.p; ++ const int mx = fctom(c->coeffs_x); ++ const int my = fctom(c->coeffs_y); ++ ++ uint8_t patch_u1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ uint8_t patch_v1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ uint8_t patch_u3[8 * 16 * PW]; ++ uint8_t patch_v3[8 * 16 * PW]; ++ ++ FUNC(get_patch_c)(st, patch_u1, patch_v1, PATCH_STRIDE, st->last_l0, 8+3, c->h + 3); ++ ++ s->hevcdsp.put_hevc_epel_uni_w[wtoidx(c->w)][my != 0][mx != 0]( ++ patch_u3, 8 * PW, patch_u1 + PATCH_STRIDE + PW, PATCH_STRIDE, ++ c->h, QPU_MC_DENOM, wweight(c->wo_u), woff_p(s, c->wo_u), mx, my, c->w); ++ s->hevcdsp.put_hevc_epel_uni_w[wtoidx(c->w)][my != 0][mx != 0]( ++ patch_v3, 8 * PW, patch_v1 + PATCH_STRIDE + PW, PATCH_STRIDE, ++ c->h, QPU_MC_DENOM, wweight(c->wo_v), woff_p(s, c->wo_v), mx, my, c->w); ++ ++ FUNC(av_rpi_planar_to_sand_c)((uint8_t *)c->dst_addr_c, st->stride1, st->stride2, patch_u3, 8 * PW, patch_v3, 8 * PW, 0, 0, c->w * PW, c->h); ++ ++ st->last_l0 = &c->next_src; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ else if (link == s->qpu.c_pxx_l1) { ++ const qpu_mc_pred_c_p_t *const c = &cmd->c.p; ++ const int mx = fctom(c->coeffs_x); ++ const int my = fctom(c->coeffs_y); ++ ++ uint8_t patch_u1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ uint8_t patch_v1[PATCH_STRIDE * 72]; // (Max width + 8) * (max height + 8) ++ uint8_t patch_u3[8 * 16 * PW]; ++ uint8_t patch_v3[8 * 16 * PW]; ++ ++ FUNC(get_patch_c)(st, patch_u1, patch_v1, PATCH_STRIDE, st->last_l1, 8+3, c->h + 3); ++ ++ s->hevcdsp.put_hevc_epel_uni_w[wtoidx(c->w)][my != 0][mx != 0]( ++ patch_u3, 8 * PW, patch_u1 + PATCH_STRIDE + PW, PATCH_STRIDE, ++ c->h, QPU_MC_DENOM, wweight(c->wo_u), woff_p(s, c->wo_u), mx, my, c->w); ++ s->hevcdsp.put_hevc_epel_uni_w[wtoidx(c->w)][my != 0][mx != 0]( ++ patch_v3, 8 * PW, patch_v1 + PATCH_STRIDE + PW, PATCH_STRIDE, ++ c->h, QPU_MC_DENOM, wweight(c->wo_v), woff_p(s, c->wo_v), mx, my, c->w); ++ ++ FUNC(av_rpi_planar_to_sand_c)((uint8_t *)c->dst_addr_c, st->stride1, st->stride2, patch_u3, 8 * PW, patch_v3, 8 * PW, 0, 0, c->w * PW, c->h); ++ ++ st->last_l1 = &c->next_src; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ else if (link == s->qpu.c_bxx) { ++ const qpu_mc_pred_c_b_t *const c = &cmd->c.b; ++ const int mx1 = fctom(c->coeffs_x1); ++ const int my1 = fctom(c->coeffs_y1); ++ const int mx2 = fctom(c->coeffs_x2); ++ const int my2 = fctom(c->coeffs_y2); ++ ++ uint8_t patch_u1[PATCH_STRIDE * 72]; ++ uint8_t patch_v1[PATCH_STRIDE * 72]; ++ uint8_t patch_u2[PATCH_STRIDE * 72]; ++ uint8_t patch_v2[PATCH_STRIDE * 72]; ++ uint8_t patch_u3[8 * 16 * PW]; ++ uint8_t patch_v3[8 * 16 * PW]; ++ uint16_t patch_u4[MAX_PB_SIZE * MAX_PB_SIZE]; ++ uint16_t patch_v4[MAX_PB_SIZE * MAX_PB_SIZE]; ++ ++ FUNC(get_patch_c)(st, patch_u1, patch_v1, PATCH_STRIDE, st->last_l0, 8+3, c->h + 3); ++ FUNC(get_patch_c)(st, patch_u2, patch_v2, PATCH_STRIDE, st->last_l1, 8+3, c->h + 3); ++ ++ s->hevcdsp.put_hevc_epel[wtoidx(c->w)][my1 != 0][mx1 != 0]( ++ patch_u4, patch_u1 + PATCH_STRIDE + PW, PATCH_STRIDE, ++ c->h, mx1, my1, c->w); ++ s->hevcdsp.put_hevc_epel[wtoidx(c->w)][my1 != 0][mx1 != 0]( ++ patch_v4, patch_v1 + PATCH_STRIDE + PW, PATCH_STRIDE, ++ c->h, mx1, my1, c->w); ++ ++ s->hevcdsp.put_hevc_epel_bi_w[wtoidx(c->w)][my2 != 0][mx2 != 0]( ++ patch_u3, 8 * PW, patch_u2 + PATCH_STRIDE + PW, PATCH_STRIDE, patch_u4, ++ c->h, QPU_MC_DENOM, c->weight_u1, wweight(c->wo_u2), ++ 0, woff_b(s, c->wo_u2), mx2, my2, c->w); ++ s->hevcdsp.put_hevc_epel_bi_w[wtoidx(c->w)][my2 != 0][mx2 != 0]( ++ patch_v3, 8 * PW, patch_v2 + PATCH_STRIDE + PW, PATCH_STRIDE, patch_v4, ++ c->h, QPU_MC_DENOM, c->weight_v1, wweight(c->wo_v2), ++ 0, woff_b(s, c->wo_v2), mx2, my2, c->w); ++ ++ FUNC(av_rpi_planar_to_sand_c)((uint8_t *)c->dst_addr_c, st->stride1, st->stride2, patch_u3, 8 * PW, patch_v3, 8 * PW, 0, 0, c->w * PW, c->h); ++ ++ st->last_l0 = &c->next_src1; ++ st->last_l1 = &c->next_src2; ++ cmd = (const qpu_mc_pred_cmd_t *)(c + 1); ++ } ++ else if (link == q->code_sync) { ++ cmd = (const qpu_mc_pred_cmd_t *)((uint32_t *)cmd + 1); ++ break; ++ } ++ else if (link == q->code_exit) { ++ // We expect exit to occur without other sync ++ av_assert0(i == exit_n); ++ ++exit_n; ++ break; ++ } ++ else { ++ av_assert0(0); ++ } ++ } ++ ++ st->qpu_mc_curr = cmd; ++ } ++ } while (exit_n == 0); ++ } ++} ++ ++#undef FUNC ++#undef pixel ++ +--- /dev/null ++++ b/libavcodec/rpi_hevc_transform.s +@@ -0,0 +1,444 @@ ++# ****************************************************************************** ++# Argon Design Ltd. ++# (c) Copyright 2015 Argon Design Ltd. All rights reserved. ++# ++# Module : HEVC ++# Author : Peter de Rivaz ++# ****************************************************************************** ++ ++# USE_STACK = 1 means temporary data stored on the stack (requires build with larger stack) ++# USE_STACK = 0 means temporary data stored in fixed per-VPU data buffers (requires modifications to vasm to handle instruction encoding for PC relative instructions) ++.set USE_STACK, 0 ++ ++# Lines that fail to assemble start with #: ++# The script insert_magic_opcodes.sh inserts the machine code directly for these. ++# HEVC VPU Transform ++# ++# Transform matrix can be thought of as ++# output row vector = input row vector * transMatrix2 ++# ++# The even rows of the matrix are symmetric ++# The odd rows of the matrix are antisymmetric ++# ++# So only need to compute the first half of the results, then can compute the remainder with a butterfly ++# ++# EXAMPLE ++# (a b c d) (1 2 2 1) ++# (3 4 -4 -3) ++# (5 6 6 5) ++# (7 8 -8 -7) ++# ++# x=(a c)(1 2) = 1a+5c 2a+6c ++# (5 6) ++# ++# y=(b d)(3 4) = 3b+7d 4b+8d ++# (7 8) ++# ++# u=x+y = 1a+5c+3b+7d 2a+4b+6c+8d ++# v=x-y = 1a+5c-3b-7d 2a+6c-4b-8d ++# ++# Final results are (u , v[::-1]) ++# ++# ++# For 32x1 input, load even rows into HX(0++,0), odd rows into HX(16++,0) ++# Apply the even matrix first and stop before rounding ++# Then apply the odd matrix in a full manner: ++# ++# First step is to compute partial products with the first input (16 cycles) ++# 1a 3b 5c 7d 16x1 input coefficients produce 16x16 output ++# 2a 4b 6c 8d ++# 2a -4b 6c -8d ++# 1a -3b 5c -7d ++# ++# Second step is to sum partial products into final position (8 cycles) ++# 1a+3b+5c+7d ++# 2a+4b+6c+8d ++# 2a-4b+6c-8d ++# 1a-3b+5c-7d ++# ++# Then can apply butterfly to combine even results and odd results + rounding to produce 16 rows of output at a time (need to save in transposed format) ++# ++# For 16x16 no butterfly is required and can store final results in original location (Could do 2 16x16s in parallel to make use of the trick - saves on the adds) ++# ++# For 8x8 we could compute two in parallel. ++# ++# ++ ++# Columns are transformed first ++# ++# Store top left half of transMatrix2 in ++# Store bottom left half of transMatrix2 in HX(32,32) ++# ++# For 16x16 ++# HX(0:15,0) contains input data before transform ++# HY(0:15,0) contains 32bit output data after transform ++# HX(32,0) contains even rows of left half of transMatrix2 ++# HX(32,32) contains odd rows of left half of transMatrix2 ++# HY(48,0) contains partial products ready for summing ++# ++ ++ ++# hevc_trans_16x16(short *transMatrix2, short *coeffs, int num) # TODO add size so we can branch to correct implementation (or perhaps have coeffs32 and num32 as secondary inputs!) ++# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) ++# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) ++# num: number of 16x16 transforms to be done ++# coeffs32 ++# num32: number of 32x32 transforms ++# command 0 for transform, 1 for memclear16(int16_t *dst,num16) ++# ++ ++.equ TRANS_SHIFT, 20 - BIT_DEPTH ++.equ TRANS_RND2, 1 << (TRANS_SHIFT - 1) ++.equ TRANS_ASL2, 16 - TRANS_SHIFT ++ ++ ++hevc_trans_16x16: ++ push r6-r15, lr # TODO cut down number of used registers ++ mov r14,r3 # coeffs32 ++ mov r15,r4 # num32 ++ mov r3, 16*2 # Stride of transMatrix2 in bytes ++ vldh HX(32++,0),(r0 += r3) REP 16 # This is the 16x16 matrix, a transform is equivalent to multiplying input row vector * matrix ++ ++ add r0, 16*16*2 # For 32x32 transforms we also need this matrix ++ vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix ++ ++ # Now use r0 to describe which matrix we are working on. ++ # Allows us to prefetch the next block of coefficients for efficiency. ++ mov r0,0 # This describes the location where we read our coefficients from ++ mov r3,16*2 # Stride of coefficients in bytes (TODO remove) ++ mov r7,16*16*2 # Total block size ++ mov r8,64*16 # Value used to swap from current to next VRF location ++ mov r4,64 # Constant used for rounding first pass ++ mov r5,TRANS_RND2 # Constant used for rounding second pass ++ ++ sub sp,sp,64+16*16*2 # Move on stack pointer in case interrupt occurs and uses stack ++ ++ add r11,sp,64 # Space for 32 bytes before, and rounding ++ lsr r11,5 ++ lsl r11,5 # Make sure r11 is rounded to multiple of 2**5==32 ++ ++ lsr r10, r2, 16 # Number of compressed blocks stored in top short ++ extu r2,16 ++ # At start of block r0,r1 point to the current block (that has already been loaded) ++ # r0 VRF location of current block ++ # r1 address of current block ++ # r2 number of 16*16 transforms to do ++ # r3 Stride of coefficients (==32) ++ # r4 TRANS_RND1 (64) ++ # r5 TRANS_RND2 ++ # r6 temporary used inside col_trans16 ++ # r7 16*16*2 total bytes in block ++ # r8 64*16 VRF switch locations ++ # r9 temporary in unpack_coeff for index ++ # r10 number of 16x16 transforms using compression ++ # r11 unpacked data buffer (16*16 shorts) (preceded by 16 shorts of packed data buffer) ++ # r12 temporary counter in unpack_coeff ++ # r13 ++ # r14 Save information for 32 bit transform (coeffs location) ++ # r15 Save information for 32 bit transform (number of transforms) ++ cmp r2,0 ++ beq done16x16s ++block_loop: ++ # With compressed coefficients, we don't use prefetch as we don't want to issue unnecessary memory requests ++ cmp r10,0 ++ mov r6, r1 ++ beq not_compressed ++ sub r10, 1 ++ bl unpack16x16 ++not_compressed: ++ #mov r6,r1 # DEBUG without compress ++ vldh HX(0++,0)+r0,(r6 += r3) REP 16 ++ #eor r0,r8 ++ #add r1,r7 ++ # Prefetch the next block ++ #bl unpack16x16 ++ #vldh HX(0++,0)+r0,(r6 += r3) REP 16 ++ #vmov HX(0++,0)+r0,0 REP 16 # DEBUG ++ #eor r0,r8 ++ #sub r1,r7 ++ ++ # Transform the current block ++ bl col_trans_16 ++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r4 REP 16 # Now add on rounding, shift down by 7, and saturate ++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # 9+7=16 so this ends up with the output saturated and in the top half of the word. ++ vasl HY(0++,0)+r0,HY(0++,0)+r0,9 REP 16 # This should be saturating, but the instruction above does not assemble? ++ vmov VX(0,0++)+r0, HX(0++,32)+r0 REP 16 # For simplicity transpose this back to the original position ++ ++ bl col_trans_16 ++ vadd HY(0++,0)+r0,HY(0++,0)+r0,r5 REP 16 # Now add on rounding, shift down by 7, and saturate ++ #vsasls HY(0++,0)+r0,HY(0++,0)+r0,4 REP 16 # 4+12=16 so this ends up with the output saturated and in the top half of the word. ++ vasl HY(0++,0)+r0,HY(0++,0)+r0,TRANS_ASL2 REP 16 # This should be saturating, but the instruction above does not assemble? (Probably because it ends with ls which is interpreted as a condition flag) ++ ++ # Save results - note there has been a transposition during the processing so we save columns ++ vsth VX(0,32++)+r0, (r1 += r3) REP 16 ++ ++ # Move onto next block ++ eor r0,r8 ++ add r1,r7 ++ ++ addcmpbgt r2,-1,0,block_loop ++done16x16s: ++ ++ add sp,sp,64+16*16*2 # Move on stack pointer in case interrupt occurs and uses stack ++ # Now go and do any 32x32 transforms ++ b hevc_trans_32x32 ++ ++ pop r6-r15, pc ++# This returns a value in r6 that says where to load the data from. ++# We load data 16 shorts at a time from memory (uncached), and store to stack space to allow us to process it. ++unpack16x16: ++# Clear out destination ++ vmov HX(0,0)+r0,0 ++ mov r6, r11 ++ vsth HX(0,0)+r0,(r6 += r3) REP 16 ++ mov r5, r1 # Moving pointer to input coefficients ++unpack_outer_loop: ++ # Loop until we find the end ++ vldh HX(0,0)+r0,(r5) # TODO would prefetch help here while unpacking previous? ++ sub r6,r11,32 ++ #add r6,pc,packed_data-$ # Packed data ++ vsth HX(0,0)+r0,(r6) # Store into packed data ++ mov r12,0 ++unpack_loop: ++ ld r4,(r6) ++ add r6,r6,4 ++ lsr r9,r4,16 # r9 is destination value ++ cmp r4,0 # {value,index} ++ extu r4,8 ++ beq done_unpack ++ sth r9,(r11, r4) ++ addcmpblt r12,1,8,unpack_loop ++# # Read next 16 ++ add r5,32 ++ b unpack_outer_loop ++done_unpack: ++# # Set new load location ++ mov r6, r11 ++ #add r6,pc,unpacked_data-$ ++# # Restore constants ++ mov r4,64 ++ mov r5,TRANS_RND2 ++# pop r6-r15, pc ++ b lr ++ ++# r1,r2,r3 r7,r8 should be preserved ++# HX(0++,0)+r0 is the block to be transformed ++# HX(32++,0)+r6 is the 16x16 matrix of transform coefficients ++# Use HY(48,0) for intermediate results ++# r0 can be used, but should be returned to its original value at the end ++col_trans_16: ++ add r6,r0,16 # Final value for this loop ++col_trans_16_loop: ++ # First compute partial products for a single column ++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,0++) REP 16 ++ # Then sum up the results and place back ++ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC ++ addcmpblt r0,1,r6,col_trans_16_loop ++ sub r0,16 # put r0 back to its original value ++ b lr ++ ++col_trans_odd_16: ++ add r6,r0,16 # Final value for this loop ++col_trans_odd_16_loop: ++ # First compute partial products for a single column ++ vmul32s HY(48++,0), VX(0,0)+r0, VX(32,32++) REP 16 ++ # Then sum up the results and place back ++ vadd VY(0,0)+r0, VY(48,0++), VY(48,8++) REP 8 CLRA SACC ++ addcmpblt r0,1,r6,col_trans_odd_16_loop ++ sub r0,16 # put r0 back to its original value ++ b lr ++ ++# r1/r10 input pointer ++# r0,r4,r5,r6 free ++# r8/r9 output storage ++# ++# Store packed coefficients at r9-32 ++# Store unpacked at r9+32*32 (because transform works on even/odd rows on input, but writes all rows) ++unpack32x32: ++# Clear out destination ++ vmov HX(0,0),0 ++ add r0, r9, 32*32*2 # Unpacked buffer ++ mov r4, 32 ++ vsth HX(0,0),(r0 += r4) REP 64 ++unpack_outer_loop32: ++ # Loop until we find the end ++ vldh HX(0,0),(r1) # TODO would prefetch help here while unpacking previous? ++ sub r6,r9,32 ++ #add r6,pc,packed_data-$ # Packed data ++ vsth HX(0,0),(r6) # Store into packed data ++ mov r8,0 ++unpack_loop32: ++ ld r4,(r6) ++ add r6,r6,4 ++ lsr r5,r4,16 # r5 is destination value ++ cmp r4,0 # {value,index} ++ extu r4,10 ++ beq done_unpack ++ sth r5,(r0, r4) ++ addcmpblt r8,1,8,unpack_loop32 ++# # Read next 16 ++ add r1,32 ++ b unpack_outer_loop32 ++done_unpack32: ++ b lr ++# hevc_trans_32x32(short *transMatrix2, short *coeffs, int num) ++# transMatrix2: address of the constant matrix (must be at 32 byte aligned address in Videocore memory) Even followed by odd ++# coeffs: address of the transform coefficients (must be at 32 byte aligned address in Videocore memory) ++# num: number of 16x16 transforms to be done in low 16, number of packed in high 16 ++# ++# Note that the 32x32 transforms are stored in reverse order, this means that the unpacked ones appear first! ++hevc_trans_32x32: ++ mov r1,r14 # coeffs ++ mov r2,r15 # num ++ lsr r15,r15,16 # Number that are packed ++ extu r2,16 # Total number ++ ++ # Fetch odd transform matrix ++ #mov r3, 16*2 # Stride of transMatrix2 in bytes (and of coefficients) ++ #vldh HX(32++,0),(r0 += r3) REP 16 # This is the even 16x16 matrix ++ #add r0, 16*16*2 ++ #vldh HX(32++,32),(r0 += r3) REP 16 # This is the odd 16x16 matrix ++ ++ mov r3, 32*2*2 # Stride used to fetch alternate rows of our input coefficient buffer ++ mov r7, 16*16*2 # Total block size ++ ++.if USE_STACK ++ # Stack base allocation ++ sub sp,sp,32*32*4+64 # Allocate some space on the stack for us to store 32*32 shorts as temporary results (needs to be aligned) and another 32*32 for unpacking ++ # set r8 to 32byte aligned stack pointer with 32 bytes of space before it ++ add r8,sp,63 ++ lsr r8,5 ++ lsl r8,5 ++.else ++#:version r8 ++ .half 0x00e8 #AUTOINSERTED ++ btst r8,16 ++#:add r8,pc,intermediate_results-$ ++ .half 0xbfe8 ++ .half intermediate_results-($-2) ++ beq on_vpu1 ++ add r8,r8,32*32*2*2+16*2 # Move to secondary storage ++on_vpu1: ++.endif ++ mov r9,r8 # Backup of the temporary storage ++ mov r10,r1 # Backup of the coefficient buffer ++ ++ cmp r2,0 ++ beq done32x32s ++block_loop32: ++ ++ # Transform the first 16 columns ++ mov r1,r10 # Input Coefficient buffer ++ mov r8,r9 # Output temporary storage ++ # Unpacked are first, so need to only do unpacking when r2(=num left) <= r15 (=num packed) ++ cmp r2,r15 ++ bgt not_compressed_32 ++ bl unpack32x32 ++ add r1,r9,32*32*2 # Uncompressed into temporary storage ++ mov r8,r9 # Transform into here ++not_compressed_32: ++ # COLUMN TRANSFORM ++ mov r4, 64 # Constant used for rounding first pass ++ mov r5, 9 # left shift used for rounding first pass ++ ++ bl trans32 ++ # Transform the second 16 columns ++ add r8,32*16*2 ++ add r1,32 ++ bl trans32 ++ ++ # ROW TRANSFORM ++ mov r4, TRANS_RND2 # Constant used for rounding second pass ++ mov r5, TRANS_ASL2 # left shift used for rounding second pass ++ ++ mov r1,r9 # Input temporary storage ++ mov r8,r10 # Output Coefficient buffer ++ bl trans32 ++ # Transform the second 16 columns ++ add r8,32*16*2 ++ add r1,32 ++ bl trans32 ++ ++ add r10, 32*32*2 # move onto next block of coefficients ++ addcmpbgt r2,-1,0,block_loop32 ++done32x32s: ++ ++.if USE_STACK ++ add sp,sp,32*32*4+64# Restore stack ++.endif ++ ++ pop r6-r15, pc ++ ++trans32: ++ push lr ++ # We can no longer afford the VRF space to do prefetching when doing 32x32 ++ # Fetch the even rows ++ vldh HX(0++,0),(r1 += r3) REP 16 ++ # Fetch the odd rows ++ vldh HX(16++,0),64(r1 += r3) REP 16 # First odd row is 32 shorts ahead of r1 ++ ++ # Transform the even rows using even matrix ++ mov r0, 0 # Even rows ++ bl col_trans_16 ++ ++ # Now transform the odd rows using odd matrix ++ mov r0, 64*16 # Odd rows ++ bl col_trans_odd_16 ++ ++ # Now apply butterfly to compute the first 16 results ++ vadd HY(48++,0),HY(0++,0),HY(16++,0) REP 16 ++ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, ++ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate ++ # 16bit results now in HX(48,32) ++ mov r0,r8 ++ mov r6,32*2 ++ vsth VX(48,32++),(r0+=r6) REP 16 ++ ++ # Now apply butterfly to compute the second 16 results (in reverse order) ++ vsub HY(63,0),HY(0 ,0),HY(16,0) ++ vsub HY(62,0),HY(1 ,0),HY(17,0) ++ vsub HY(61,0),HY(2 ,0),HY(18,0) ++ vsub HY(60,0),HY(3 ,0),HY(19,0) ++ vsub HY(59,0),HY(4 ,0),HY(20,0) ++ vsub HY(58,0),HY(5 ,0),HY(21,0) ++ vsub HY(57,0),HY(6 ,0),HY(22,0) ++ vsub HY(56,0),HY(7 ,0),HY(23,0) ++ vsub HY(55,0),HY(8 ,0),HY(24,0) ++ vsub HY(54,0),HY(9 ,0),HY(25,0) ++ vsub HY(53,0),HY(10,0),HY(26,0) ++ vsub HY(52,0),HY(11,0),HY(27,0) ++ vsub HY(51,0),HY(12,0),HY(28,0) ++ vsub HY(50,0),HY(13,0),HY(29,0) ++ vsub HY(49,0),HY(14,0),HY(30,0) ++ vsub HY(48,0),HY(15,0),HY(31,0) ++ vadd HY(48++,0),HY(48++,0),r4 REP 16 # add on rounding, ++ vasl HY(48++,0),HY(48++,0),r5 REP 16 # shift down by 7, and saturate ++ add r0,r8,32 ++ vsth VX(48,32++),(r0+=r6) REP 16 ++ pop pc ++ ++.if USE_STACK == 0 ++ .balign 32 ++ ++# .space directives generate 0's in the bin so avoid unnecessary padding by ++# just setting to appropriate value ++.equ intermediate_results, $+16*2 ++ ++# Layout goes: ++# ++#packed_buffer: ++# .space 16*2 ++#intermediate_results: ++# .space 32*32*2 ++#unpacked_buffer: ++# .space 32*32*2 ++# ++#packed_buffer2: ++# .space 16*2 ++#intermediate_results2: ++# .space 32*32*2 ++#unpacked_buffer2: ++# .space 32*32*2 ++.endif ++ ++ +--- /dev/null ++++ b/libavcodec/rpi_hevc_transform10.h +@@ -0,0 +1,94 @@ ++static const unsigned char rpi_hevc_transform10 [] = { ++0xa9, 0x03, 0x3e, 0x40, 0x4f, 0x40, 0x03, 0xb0, // 0000 ++0x20, 0x00, 0x0c, 0xf8, 0x38, 0x88, 0x80, 0x03, // 0008 ++0xc0, 0xf8, 0x00, 0x00, 0x40, 0xb0, 0x00, 0x02, // 0010 ++0x0c, 0xf8, 0x38, 0xa8, 0x80, 0x03, 0xc0, 0xf8, // 0018 ++0x00, 0x00, 0x00, 0x60, 0x03, 0xb0, 0x20, 0x00, // 0020 ++0x07, 0xb0, 0x00, 0x02, 0x08, 0xb0, 0x00, 0x04, // 0028 ++0x04, 0xb0, 0x40, 0x00, 0x05, 0xb0, 0x00, 0x02, // 0030 ++0x59, 0xb0, 0xc0, 0xfd, 0x0b, 0x12, 0x5b, 0x7a, // 0038 ++0x5b, 0x7c, 0x4a, 0xc3, 0x50, 0x17, 0x02, 0x6f, // 0040 ++0x02, 0x6a, 0x32, 0x18, 0x0a, 0x6a, 0x16, 0x40, // 0048 ++0x04, 0x18, 0x1a, 0x66, 0x80, 0x90, 0x32, 0x00, // 0050 ++0x0c, 0xf8, 0x38, 0x80, 0x80, 0x03, 0xc0, 0x08, // 0058 ++0x18, 0x00, 0x80, 0x90, 0x51, 0x00, 0x04, 0xff, // 0060 ++0x30, 0xc0, 0x80, 0x03, 0x20, 0x08, 0x10, 0x00, // 0068 ++0x4c, 0xfe, 0x30, 0xc0, 0x09, 0x04, 0x20, 0x08, // 0070 ++0x00, 0x00, 0x04, 0xfc, 0x38, 0x90, 0x80, 0x02, // 0078 ++0xc0, 0x0b, 0x02, 0x00, 0x80, 0x90, 0x40, 0x00, // 0080 ++0x04, 0xff, 0x30, 0xc0, 0x80, 0x03, 0x20, 0x08, // 0088 ++0x14, 0x00, 0x4c, 0xfe, 0x30, 0xc0, 0x06, 0x04, // 0090 ++0x20, 0x08, 0x00, 0x00, 0x8c, 0xf8, 0x2c, 0xe0, // 0098 ++0x80, 0x03, 0x20, 0x30, 0x04, 0x00, 0x80, 0x45, // 00a0 ++0x71, 0x42, 0xf2, 0x8c, 0xd1, 0xc0, 0x59, 0xb0, // 00a8 ++0x40, 0x02, 0x00, 0x9e, 0x6d, 0x00, 0x29, 0x03, // 00b0 ++0x00, 0xf4, 0x38, 0x80, 0x00, 0x0c, 0xb6, 0x40, // 00b8 ++0x8c, 0xf8, 0x20, 0xe0, 0x80, 0x03, 0x00, 0x30, // 00c0 ++0x18, 0x00, 0x15, 0x40, 0x08, 0xf0, 0x38, 0x80, // 00c8 ++0x85, 0x0b, 0x66, 0xb5, 0xe0, 0xff, 0x88, 0xf0, // 00d0 ++0x24, 0xe0, 0x86, 0x03, 0x0c, 0x60, 0x64, 0x08, // 00d8 ++0x46, 0x62, 0x49, 0xc3, 0x50, 0x27, 0x04, 0x6a, // 00e0 ++0x84, 0x6e, 0x07, 0x18, 0x69, 0xa0, 0x04, 0x5f, // 00e8 ++0x1c, 0x8b, 0xf7, 0xc8, 0x45, 0x76, 0x6b, 0x1f, // 00f0 ++0xb6, 0x40, 0x04, 0xb0, 0x40, 0x00, 0x05, 0xb0, // 00f8 ++0x00, 0x02, 0x5a, 0x00, 0x06, 0xb4, 0x10, 0x00, // 0100 ++0xa4, 0xff, 0x24, 0xcc, 0x60, 0x02, 0x00, 0xf8, // 0108 ++0x3e, 0x00, 0x03, 0xff, 0x37, 0xd0, 0x78, 0x03, // 0110 ++0xe0, 0x03, 0xbe, 0x0b, 0x10, 0x8b, 0xf6, 0x5b, // 0118 ++0x00, 0x67, 0x5a, 0x00, 0x06, 0xb4, 0x10, 0x00, // 0120 ++0xa4, 0xff, 0x24, 0xcc, 0xe0, 0x02, 0x00, 0xf8, // 0128 ++0x3e, 0x00, 0x03, 0xff, 0x37, 0xd0, 0x78, 0x03, // 0130 ++0xe0, 0x03, 0xbe, 0x0b, 0x10, 0x8b, 0xf6, 0x5b, // 0138 ++0x00, 0x67, 0x5a, 0x00, 0x00, 0xf4, 0x38, 0x80, // 0140 ++0x00, 0x04, 0x20, 0xb5, 0x00, 0x08, 0x04, 0xb0, // 0148 ++0x20, 0x00, 0x8e, 0xf8, 0x20, 0xe0, 0x80, 0x03, // 0150 ++0xc0, 0x43, 0x00, 0x00, 0x08, 0xf0, 0x38, 0x80, // 0158 ++0x81, 0x03, 0x26, 0xb5, 0xe0, 0xff, 0x88, 0xf0, // 0160 ++0x20, 0xe0, 0x86, 0x03, 0x08, 0x60, 0x64, 0x08, // 0168 ++0x46, 0x62, 0x45, 0xc3, 0x50, 0x27, 0x04, 0x6a, // 0170 ++0xa4, 0x6e, 0x7f, 0x90, 0xbf, 0xff, 0x65, 0xa0, // 0178 ++0x04, 0x07, 0x18, 0x8b, 0xf6, 0xc8, 0x41, 0x76, // 0180 ++0x6a, 0x1f, 0x5a, 0x00, 0xe1, 0x40, 0xf2, 0x40, // 0188 ++0x0f, 0x7b, 0x02, 0x6f, 0x03, 0xb0, 0x80, 0x00, // 0190 ++0x07, 0xb0, 0x00, 0x02, 0xe8, 0x00, 0x08, 0x6d, // 0198 ++0xe8, 0xbf, 0x60, 0x01, 0x03, 0x18, 0x48, 0xb0, // 01a0 ++0x20, 0x10, 0x89, 0x40, 0x1a, 0x40, 0x02, 0x6a, // 01a8 ++0x24, 0x18, 0xa1, 0x40, 0x98, 0x40, 0xf2, 0x4a, // 01b0 ++0x06, 0x1e, 0xff, 0x9f, 0xc5, 0xff, 0x21, 0xb5, // 01b8 ++0x00, 0x08, 0x98, 0x40, 0x04, 0xb0, 0x40, 0x00, // 01c0 ++0x95, 0x60, 0x80, 0x90, 0x18, 0x00, 0x48, 0xb0, // 01c8 ++0x00, 0x04, 0x41, 0x76, 0x80, 0x90, 0x13, 0x00, // 01d0 ++0x04, 0xb0, 0x00, 0x02, 0x65, 0x60, 0x91, 0x40, // 01d8 ++0xa8, 0x40, 0x80, 0x90, 0x0c, 0x00, 0x48, 0xb0, // 01e0 ++0x00, 0x04, 0x41, 0x76, 0x80, 0x90, 0x07, 0x00, // 01e8 ++0x4a, 0xb0, 0x00, 0x08, 0xf2, 0x8c, 0xdf, 0xc0, // 01f0 ++0x29, 0x03, 0xef, 0x03, 0x0c, 0xf8, 0x38, 0x80, // 01f8 ++0x80, 0x03, 0xc0, 0xf8, 0x04, 0x00, 0x0c, 0xf8, // 0200 ++0x38, 0x84, 0xc0, 0x03, 0xc0, 0xf8, 0x04, 0x00, // 0208 ++0x00, 0x60, 0xff, 0x9f, 0x79, 0xff, 0x00, 0xb0, // 0210 ++0x00, 0x04, 0xff, 0x9f, 0x85, 0xff, 0x04, 0xff, // 0218 ++0x30, 0xcc, 0x10, 0x03, 0xe0, 0xfb, 0x3e, 0x00, // 0220 ++0x04, 0xff, 0x33, 0xcc, 0x80, 0x03, 0xe0, 0xfb, // 0228 ++0x10, 0x00, 0x4c, 0xfe, 0x33, 0xcc, 0x80, 0x03, // 0230 ++0xe0, 0xfb, 0x14, 0x00, 0x80, 0x40, 0x06, 0xb0, // 0238 ++0x40, 0x00, 0x8c, 0xf8, 0x2f, 0xe0, 0x80, 0x03, // 0240 ++0xe0, 0x63, 0x00, 0x00, 0x20, 0xf7, 0xf0, 0xcf, // 0248 ++0x10, 0x03, 0x20, 0xf7, 0xb0, 0xcf, 0x11, 0x13, // 0250 ++0x20, 0xf7, 0x70, 0xcf, 0x12, 0x23, 0x20, 0xf7, // 0258 ++0x30, 0xcf, 0x13, 0x33, 0x20, 0xf7, 0xf0, 0xce, // 0260 ++0x14, 0x43, 0x20, 0xf7, 0xb0, 0xce, 0x15, 0x53, // 0268 ++0x20, 0xf7, 0x70, 0xce, 0x16, 0x63, 0x20, 0xf7, // 0270 ++0x30, 0xce, 0x17, 0x73, 0x20, 0xf7, 0xf0, 0xcd, // 0278 ++0x18, 0x83, 0x20, 0xf7, 0xb0, 0xcd, 0x19, 0x93, // 0280 ++0x20, 0xf7, 0x70, 0xcd, 0x1a, 0xa3, 0x20, 0xf7, // 0288 ++0x30, 0xcd, 0x1b, 0xb3, 0x20, 0xf7, 0xf0, 0xcc, // 0290 ++0x1c, 0xc3, 0x20, 0xf7, 0xb0, 0xcc, 0x1d, 0xd3, // 0298 ++0x20, 0xf7, 0x70, 0xcc, 0x1e, 0xe3, 0x20, 0xf7, // 02a0 ++0x30, 0xcc, 0x1f, 0xf3, 0x04, 0xff, 0x33, 0xcc, // 02a8 ++0x80, 0x03, 0xe0, 0xfb, 0x10, 0x00, 0x4c, 0xfe, // 02b0 ++0x33, 0xcc, 0x80, 0x03, 0xe0, 0xfb, 0x14, 0x00, // 02b8 ++0x00, 0xb5, 0x20, 0x00, 0x8c, 0xf8, 0x2f, 0xe0, // 02c0 ++0x80, 0x03, 0xe0, 0x63, 0x00, 0x00, 0x6f, 0x03, // 02c8 ++0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 02d0 ++0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 02d8 ++}; +--- /dev/null ++++ b/libavcodec/rpi_hevc_transform8.h +@@ -0,0 +1,94 @@ ++static const unsigned char rpi_hevc_transform8 [] = { ++0xa9, 0x03, 0x3e, 0x40, 0x4f, 0x40, 0x03, 0xb0, // 0000 ++0x20, 0x00, 0x0c, 0xf8, 0x38, 0x88, 0x80, 0x03, // 0008 ++0xc0, 0xf8, 0x00, 0x00, 0x40, 0xb0, 0x00, 0x02, // 0010 ++0x0c, 0xf8, 0x38, 0xa8, 0x80, 0x03, 0xc0, 0xf8, // 0018 ++0x00, 0x00, 0x00, 0x60, 0x03, 0xb0, 0x20, 0x00, // 0020 ++0x07, 0xb0, 0x00, 0x02, 0x08, 0xb0, 0x00, 0x04, // 0028 ++0x04, 0xb0, 0x40, 0x00, 0x05, 0xb0, 0x00, 0x08, // 0030 ++0x59, 0xb0, 0xc0, 0xfd, 0x0b, 0x12, 0x5b, 0x7a, // 0038 ++0x5b, 0x7c, 0x4a, 0xc3, 0x50, 0x17, 0x02, 0x6f, // 0040 ++0x02, 0x6a, 0x32, 0x18, 0x0a, 0x6a, 0x16, 0x40, // 0048 ++0x04, 0x18, 0x1a, 0x66, 0x80, 0x90, 0x32, 0x00, // 0050 ++0x0c, 0xf8, 0x38, 0x80, 0x80, 0x03, 0xc0, 0x08, // 0058 ++0x18, 0x00, 0x80, 0x90, 0x51, 0x00, 0x04, 0xff, // 0060 ++0x30, 0xc0, 0x80, 0x03, 0x20, 0x08, 0x10, 0x00, // 0068 ++0x4c, 0xfe, 0x30, 0xc0, 0x09, 0x04, 0x20, 0x08, // 0070 ++0x00, 0x00, 0x04, 0xfc, 0x38, 0x90, 0x80, 0x02, // 0078 ++0xc0, 0x0b, 0x02, 0x00, 0x80, 0x90, 0x40, 0x00, // 0080 ++0x04, 0xff, 0x30, 0xc0, 0x80, 0x03, 0x20, 0x08, // 0088 ++0x14, 0x00, 0x4c, 0xfe, 0x30, 0xc0, 0x04, 0x04, // 0090 ++0x20, 0x08, 0x00, 0x00, 0x8c, 0xf8, 0x2c, 0xe0, // 0098 ++0x80, 0x03, 0x20, 0x30, 0x04, 0x00, 0x80, 0x45, // 00a0 ++0x71, 0x42, 0xf2, 0x8c, 0xd1, 0xc0, 0x59, 0xb0, // 00a8 ++0x40, 0x02, 0x00, 0x9e, 0x6d, 0x00, 0x29, 0x03, // 00b0 ++0x00, 0xf4, 0x38, 0x80, 0x00, 0x0c, 0xb6, 0x40, // 00b8 ++0x8c, 0xf8, 0x20, 0xe0, 0x80, 0x03, 0x00, 0x30, // 00c0 ++0x18, 0x00, 0x15, 0x40, 0x08, 0xf0, 0x38, 0x80, // 00c8 ++0x85, 0x0b, 0x66, 0xb5, 0xe0, 0xff, 0x88, 0xf0, // 00d0 ++0x24, 0xe0, 0x86, 0x03, 0x0c, 0x60, 0x64, 0x08, // 00d8 ++0x46, 0x62, 0x49, 0xc3, 0x50, 0x27, 0x04, 0x6a, // 00e0 ++0x84, 0x6e, 0x07, 0x18, 0x69, 0xa0, 0x04, 0x5f, // 00e8 ++0x1c, 0x8b, 0xf7, 0xc8, 0x45, 0x76, 0x6b, 0x1f, // 00f0 ++0xb6, 0x40, 0x04, 0xb0, 0x40, 0x00, 0x05, 0xb0, // 00f8 ++0x00, 0x08, 0x5a, 0x00, 0x06, 0xb4, 0x10, 0x00, // 0100 ++0xa4, 0xff, 0x24, 0xcc, 0x60, 0x02, 0x00, 0xf8, // 0108 ++0x3e, 0x00, 0x03, 0xff, 0x37, 0xd0, 0x78, 0x03, // 0110 ++0xe0, 0x03, 0xbe, 0x0b, 0x10, 0x8b, 0xf6, 0x5b, // 0118 ++0x00, 0x67, 0x5a, 0x00, 0x06, 0xb4, 0x10, 0x00, // 0120 ++0xa4, 0xff, 0x24, 0xcc, 0xe0, 0x02, 0x00, 0xf8, // 0128 ++0x3e, 0x00, 0x03, 0xff, 0x37, 0xd0, 0x78, 0x03, // 0130 ++0xe0, 0x03, 0xbe, 0x0b, 0x10, 0x8b, 0xf6, 0x5b, // 0138 ++0x00, 0x67, 0x5a, 0x00, 0x00, 0xf4, 0x38, 0x80, // 0140 ++0x00, 0x04, 0x20, 0xb5, 0x00, 0x08, 0x04, 0xb0, // 0148 ++0x20, 0x00, 0x8e, 0xf8, 0x20, 0xe0, 0x80, 0x03, // 0150 ++0xc0, 0x43, 0x00, 0x00, 0x08, 0xf0, 0x38, 0x80, // 0158 ++0x81, 0x03, 0x26, 0xb5, 0xe0, 0xff, 0x88, 0xf0, // 0160 ++0x20, 0xe0, 0x86, 0x03, 0x08, 0x60, 0x64, 0x08, // 0168 ++0x46, 0x62, 0x45, 0xc3, 0x50, 0x27, 0x04, 0x6a, // 0170 ++0xa4, 0x6e, 0x7f, 0x90, 0xbf, 0xff, 0x65, 0xa0, // 0178 ++0x04, 0x07, 0x18, 0x8b, 0xf6, 0xc8, 0x41, 0x76, // 0180 ++0x6a, 0x1f, 0x5a, 0x00, 0xe1, 0x40, 0xf2, 0x40, // 0188 ++0x0f, 0x7b, 0x02, 0x6f, 0x03, 0xb0, 0x80, 0x00, // 0190 ++0x07, 0xb0, 0x00, 0x02, 0xe8, 0x00, 0x08, 0x6d, // 0198 ++0xe8, 0xbf, 0x60, 0x01, 0x03, 0x18, 0x48, 0xb0, // 01a0 ++0x20, 0x10, 0x89, 0x40, 0x1a, 0x40, 0x02, 0x6a, // 01a8 ++0x24, 0x18, 0xa1, 0x40, 0x98, 0x40, 0xf2, 0x4a, // 01b0 ++0x06, 0x1e, 0xff, 0x9f, 0xc5, 0xff, 0x21, 0xb5, // 01b8 ++0x00, 0x08, 0x98, 0x40, 0x04, 0xb0, 0x40, 0x00, // 01c0 ++0x95, 0x60, 0x80, 0x90, 0x18, 0x00, 0x48, 0xb0, // 01c8 ++0x00, 0x04, 0x41, 0x76, 0x80, 0x90, 0x13, 0x00, // 01d0 ++0x04, 0xb0, 0x00, 0x08, 0x45, 0x60, 0x91, 0x40, // 01d8 ++0xa8, 0x40, 0x80, 0x90, 0x0c, 0x00, 0x48, 0xb0, // 01e0 ++0x00, 0x04, 0x41, 0x76, 0x80, 0x90, 0x07, 0x00, // 01e8 ++0x4a, 0xb0, 0x00, 0x08, 0xf2, 0x8c, 0xdf, 0xc0, // 01f0 ++0x29, 0x03, 0xef, 0x03, 0x0c, 0xf8, 0x38, 0x80, // 01f8 ++0x80, 0x03, 0xc0, 0xf8, 0x04, 0x00, 0x0c, 0xf8, // 0200 ++0x38, 0x84, 0xc0, 0x03, 0xc0, 0xf8, 0x04, 0x00, // 0208 ++0x00, 0x60, 0xff, 0x9f, 0x79, 0xff, 0x00, 0xb0, // 0210 ++0x00, 0x04, 0xff, 0x9f, 0x85, 0xff, 0x04, 0xff, // 0218 ++0x30, 0xcc, 0x10, 0x03, 0xe0, 0xfb, 0x3e, 0x00, // 0220 ++0x04, 0xff, 0x33, 0xcc, 0x80, 0x03, 0xe0, 0xfb, // 0228 ++0x10, 0x00, 0x4c, 0xfe, 0x33, 0xcc, 0x80, 0x03, // 0230 ++0xe0, 0xfb, 0x14, 0x00, 0x80, 0x40, 0x06, 0xb0, // 0238 ++0x40, 0x00, 0x8c, 0xf8, 0x2f, 0xe0, 0x80, 0x03, // 0240 ++0xe0, 0x63, 0x00, 0x00, 0x20, 0xf7, 0xf0, 0xcf, // 0248 ++0x10, 0x03, 0x20, 0xf7, 0xb0, 0xcf, 0x11, 0x13, // 0250 ++0x20, 0xf7, 0x70, 0xcf, 0x12, 0x23, 0x20, 0xf7, // 0258 ++0x30, 0xcf, 0x13, 0x33, 0x20, 0xf7, 0xf0, 0xce, // 0260 ++0x14, 0x43, 0x20, 0xf7, 0xb0, 0xce, 0x15, 0x53, // 0268 ++0x20, 0xf7, 0x70, 0xce, 0x16, 0x63, 0x20, 0xf7, // 0270 ++0x30, 0xce, 0x17, 0x73, 0x20, 0xf7, 0xf0, 0xcd, // 0278 ++0x18, 0x83, 0x20, 0xf7, 0xb0, 0xcd, 0x19, 0x93, // 0280 ++0x20, 0xf7, 0x70, 0xcd, 0x1a, 0xa3, 0x20, 0xf7, // 0288 ++0x30, 0xcd, 0x1b, 0xb3, 0x20, 0xf7, 0xf0, 0xcc, // 0290 ++0x1c, 0xc3, 0x20, 0xf7, 0xb0, 0xcc, 0x1d, 0xd3, // 0298 ++0x20, 0xf7, 0x70, 0xcc, 0x1e, 0xe3, 0x20, 0xf7, // 02a0 ++0x30, 0xcc, 0x1f, 0xf3, 0x04, 0xff, 0x33, 0xcc, // 02a8 ++0x80, 0x03, 0xe0, 0xfb, 0x10, 0x00, 0x4c, 0xfe, // 02b0 ++0x33, 0xcc, 0x80, 0x03, 0xe0, 0xfb, 0x14, 0x00, // 02b8 ++0x00, 0xb5, 0x20, 0x00, 0x8c, 0xf8, 0x2f, 0xe0, // 02c0 ++0x80, 0x03, 0xe0, 0x63, 0x00, 0x00, 0x6f, 0x03, // 02c8 ++0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 02d0 ++0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 02d8 ++}; +--- /dev/null ++++ b/libavcodec/rpi_hevcdec.c +@@ -0,0 +1,6134 @@ ++/* ++ * HEVC video Decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2012 - 2013 Mickael Raulet ++ * Copyright (C) 2012 - 2013 Gildas Cocherel ++ * Copyright (C) 2012 - 2013 Wassim Hamidouche ++ * Copyright (C) 2018 John Cox, Ben Avison, Peter de Rivaz for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavutil/attributes.h" ++#include "libavutil/common.h" ++#include "libavutil/display.h" ++#include "libavutil/internal.h" ++#include "libavutil/mastering_display_metadata.h" ++#include "libavutil/md5.h" ++#include "libavutil/opt.h" ++#include "libavutil/pixdesc.h" ++#include "libavutil/stereo3d.h" ++ ++#include "decode.h" ++#include "bswapdsp.h" ++#include "bytestream.h" ++#include "golomb.h" ++#include "hevc.h" ++#include "rpi_hevc_data.h" ++#include "rpi_hevc_parse.h" ++#include "rpi_hevcdec.h" ++#include "rpi_hevc_cabac_fns.h" ++#include "profiles.h" ++#include "hwconfig.h" ++ ++#include "rpi_zc_frames.h" ++#include "rpi_qpu.h" ++#include "rpi_hevc_shader.h" ++#include "rpi_hevc_shader_cmd.h" ++#include "rpi_hevc_shader_template.h" ++#include "rpi_zc.h" ++#include "libavutil/rpi_sand_fns.h" ++ ++#include "pthread.h" ++#include ++ ++#define DEBUG_DECODE_N 0 // 0 = do all, n = frames idr onwards ++ ++#define PACK2(hi,lo) (((hi) << 16) | ((lo) & 0xffff)) ++ ++#ifndef av_mod_uintp2 ++static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) ++{ ++ return a & ((1 << p) - 1); ++} ++# define av_mod_uintp2 av_mod_uintp2_c ++#endif ++ ++const uint8_t ff_hevc_rpi_pel_weight[65] = { [2] = 0, [4] = 1, [6] = 2, [8] = 3, [12] = 4, [16] = 5, [24] = 6, [32] = 7, [48] = 8, [64] = 9 }; ++static void rpi_begin(const HEVCRpiContext * const s, HEVCRpiJob * const jb, const unsigned int ctu_ts_first); ++ ++#define MC_DUMMY_X (-32) ++#define MC_DUMMY_Y (-32) ++ ++// UV & Y both have min 4x4 pred (no 2x2 chroma) ++// Allow for even spread +1 for setup, +1 for rounding ++// As we have load sharing this can (in theory) be exceeded so we have to ++// check after each CTU, but it is a good base size ++ ++// Worst case (all 4x4) commands per CTU ++#define QPU_Y_CMD_PER_CTU_MAX (16 * 16) ++#define QPU_C_CMD_PER_CTU_MAX (8 * 8) ++ ++#define QPU_MAX_CTU_PER_LINE ((HEVC_RPI_MAX_WIDTH + 63) / 64) ++ ++#define QPU_GRPS (QPU_N_MAX / QPU_N_GRP) ++#define QPU_CTU_PER_GRP ((QPU_MAX_CTU_PER_LINE + QPU_GRPS - 1) / QPU_GRPS) ++ ++#define QPU_Y_CMD_SLACK_PER_Q (QPU_Y_CMD_PER_CTU_MAX / 2) ++#define QPU_C_CMD_SLACK_PER_Q (QPU_C_CMD_PER_CTU_MAX / 2) ++ ++// Total cmds to allocate - allow for slack & setup ++#define QPU_Y_COMMANDS (QPU_CTU_PER_GRP * QPU_GRPS * QPU_Y_CMD_PER_CTU_MAX + (1 + QPU_Y_CMD_SLACK_PER_Q) * QPU_N_MAX) ++#define QPU_C_COMMANDS (QPU_CTU_PER_GRP * QPU_GRPS * QPU_C_CMD_PER_CTU_MAX + (1 + QPU_C_CMD_SLACK_PER_Q) * QPU_N_MAX) ++ ++#define QPU_Y_SYNCS (QPU_N_MAX * (16 + 2)) ++#define QPU_C_SYNCS (QPU_N_MAX * (8 + 2)) ++ ++// The QPU code for UV blocks only works up to a block width of 8 ++#define RPI_CHROMA_BLOCK_WIDTH 8 ++ ++#define ENCODE_COEFFS(c0, c1, c2, c3) (((c0) & 0xff) | ((c1) & 0xff) << 8 | ((c2) & 0xff) << 16 | ((c3) & 0xff) << 24) ++ ++ ++// Actual filter goes -ve, +ve, +ve, -ve using these values ++static const uint32_t rpi_filter_coefs[8] = { ++ ENCODE_COEFFS( 0, 64, 0, 0), ++ ENCODE_COEFFS( 2, 58, 10, 2), ++ ENCODE_COEFFS( 4, 54, 16, 2), ++ ENCODE_COEFFS( 6, 46, 28, 4), ++ ENCODE_COEFFS( 4, 36, 36, 4), ++ ENCODE_COEFFS( 4, 28, 46, 6), ++ ENCODE_COEFFS( 2, 16, 54, 4), ++ ENCODE_COEFFS( 2, 10, 58, 2) ++}; ++ ++// Function arrays by QPU ++ ++static const int * const inter_pred_setup_c_qpu[12] = { ++ mc_setup_c_q0, mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn, ++ mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn, ++ mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn, mc_setup_c_qn ++}; ++ ++static const int * const inter_pred_setup_c10_qpu[12] = { ++ mc_setup_c10_q0, mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn, ++ mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn, ++ mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn, mc_setup_c10_qn ++}; ++ ++static const int * const inter_pred_setup_y_qpu[12] = { ++ mc_setup_y_q0, mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn, ++ mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn, ++ mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn, mc_setup_y_qn ++}; ++ ++static const int * const inter_pred_setup_y10_qpu[12] = { ++ mc_setup_y10_q0, mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn, ++ mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn, ++ mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn, mc_setup_y10_qn ++}; ++ ++static const int * const inter_pred_sync_qpu[12] = { ++ mc_sync_q0, mc_sync_q1, mc_sync_q2, mc_sync_q3, ++ mc_sync_q4, mc_sync_q5, mc_sync_q6, mc_sync_q7, ++ mc_sync_q8, mc_sync_q9, mc_sync_q10, mc_sync_q11 ++}; ++ ++static const int * const inter_pred_sync10_qpu[12] = { ++ mc_sync10_q0, mc_sync10_q1, mc_sync10_q2, mc_sync10_q3, ++ mc_sync10_q4, mc_sync10_q5, mc_sync10_q6, mc_sync10_q7, ++ mc_sync10_q8, mc_sync10_q9, mc_sync10_q10, mc_sync10_q11 ++}; ++ ++static const int * const inter_pred_exit_c_qpu[12] = { ++ mc_exit_c_q0, mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn, ++ mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn, ++ mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn, mc_exit_c_qn ++}; ++ ++static const int * const inter_pred_exit_c10_qpu[12] = { ++ mc_exit_c10_q0, mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn, ++ mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn, ++ mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn, mc_exit_c10_qn ++}; ++ ++static const int * const inter_pred_exit_y_qpu[12] = { ++ mc_exit_y_q0, mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn, ++ mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn, ++ mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn, mc_exit_y_qn ++}; ++ ++static const int * const inter_pred_exit_y10_qpu[12] = { ++ mc_exit_y10_q0, mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn, ++ mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn, ++ mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn, mc_exit_y10_qn ++}; ++ ++typedef struct ipe_chan_info_s ++{ ++ const uint8_t bit_depth; ++ const uint8_t n; ++ const int * const * setup_fns; ++ const int * const * sync_fns; ++ const int * const * exit_fns; ++} ipe_chan_info_t; ++ ++typedef struct ipe_init_info_s ++{ ++ ipe_chan_info_t luma; ++ ipe_chan_info_t chroma; ++} ipe_init_info_t; ++ ++static void set_bytes(uint8_t * b, const unsigned int stride, const int ln, unsigned int a) ++{ ++ switch (ln) ++ { ++ default: // normally 0 ++ *b = a; ++ break; ++ case 1: ++ a |= a << 8; ++ *(uint16_t *)b = a; ++ b += stride; ++ *(uint16_t *)b = a; ++ break; ++ case 2: ++ a |= a << 8; ++ a |= a << 16; ++ *(uint32_t *)b = a; ++ b += stride; ++ *(uint32_t *)b = a; ++ b += stride; ++ *(uint32_t *)b = a; ++ b += stride; ++ *(uint32_t *)b = a; ++ break; ++ case 3: ++ { ++ unsigned int i; ++ uint64_t d; ++ a |= a << 8; ++ a |= a << 16; ++ d = ((uint64_t)a << 32) | a; ++ for (i = 0; i != 8; ++i, b += stride) ++ *(uint64_t *)b = d; ++ break; ++ } ++ case 4: ++ { ++ unsigned int i; ++ uint64_t d; ++ a |= a << 8; ++ a |= a << 16; ++ d = ((uint64_t)a << 32) | a; ++ for (i = 0; i != 16; ++i, b += stride) ++ { ++ *(uint64_t *)b = d; ++ *(uint64_t *)(b + 8) = d; ++ } ++ break; ++ } ++ } ++} ++ ++// We expect this to be called with ln = (log2_cb_size - 3) so range = -1..3 ++// (4 not required) ++static void set_stash2(uint8_t * b_u, uint8_t * b_l, const int ln, unsigned int a) ++{ ++ switch (ln) ++ { ++ default: // 0 or -1 ++ *b_u = a; ++ *b_l = a; ++ break; ++ case 1: ++ a |= a << 8; ++ *(uint16_t *)b_u = a; ++ *(uint16_t *)b_l = a; ++ break; ++ case 2: ++ a |= a << 8; ++ a |= a << 16; ++ *(uint32_t *)b_u = a; ++ *(uint32_t *)b_l = a; ++ break; ++ case 3: ++ a |= a << 8; ++ a |= a << 16; ++ *(uint32_t *)b_u = a; ++ *(uint32_t *)(b_u + 4) = a; ++ *(uint32_t *)b_l = a; ++ *(uint32_t *)(b_l + 4) = a; ++ break; ++ case 4: ++ a |= a << 8; ++ a |= a << 16; ++ *(uint32_t *)b_u = a; ++ *(uint32_t *)(b_u + 4) = a; ++ *(uint32_t *)(b_u + 8) = a; ++ *(uint32_t *)(b_u + 12) = a; ++ *(uint32_t *)b_l = a; ++ *(uint32_t *)(b_l + 4) = a; ++ *(uint32_t *)(b_l + 8) = a; ++ *(uint32_t *)(b_l + 12) = a; ++ break; ++ } ++} ++ ++static void zap_cabac_stash(uint8_t * b, const int ln) ++{ ++ switch (ln) ++ { ++ default: // 0 ++ *b = 0; ++ break; ++ case 1: ++ *(uint16_t *)b = 0; ++ break; ++ case 2: ++ *(uint32_t *)b = 0; ++ break; ++ case 3: ++ *(uint32_t *)b = 0; ++ *(uint32_t *)(b + 4) = 0; ++ break; ++ } ++} ++ ++ ++ ++// Set a small square block of bits in a bitmap ++// Bits must be aligned on their size boundry (which will be true of all split CBs) ++static void set_bits(uint8_t * f, const unsigned int x, const unsigned int stride, const unsigned int ln) ++{ ++ unsigned int n; ++ const unsigned int sh = (x & 7); ++ ++ f += (x >> 3); ++ ++ av_assert2(ln <= 3); ++ av_assert2((x & ((1 << ln) - 1)) == 0); ++ ++ switch (ln) ++ { ++ default: // 1 ++ f[0] |= 1 << sh; ++ break; ++ case 1: // 3 * 2 ++ n = 3 << sh; ++ f[0] |= n; ++ f[stride] |= n; ++ break; ++ case 2: // 0xf * 4 ++ n = 0xf << sh; ++ f[0] |= n; ++ f[stride] |= n; ++ f[stride * 2] |= n; ++ f[stride * 3] |= n; ++ break; ++ case 3: // 0xff * 8 ++ for (n = 0; n != 8; ++n, f += stride) ++ *f = 0xff; ++ break; ++ } ++} ++ ++static const ipe_init_info_t ipe_init_infos[9] = { // Alloc for bit depths of 8-16 ++ { // 8 ++ .luma = {8, QPU_MC_PRED_N_Y8, inter_pred_setup_y_qpu, inter_pred_sync_qpu, inter_pred_exit_y_qpu}, ++ .chroma = {8, QPU_MC_PRED_N_C8, inter_pred_setup_c_qpu, inter_pred_sync_qpu, inter_pred_exit_c_qpu} ++ }, ++ { // 9 ++ .luma = {0}, ++ .chroma = {0} ++ }, ++ { // 10 ++ .luma = {10, QPU_MC_PRED_N_Y10, inter_pred_setup_y10_qpu, inter_pred_sync10_qpu, inter_pred_exit_y10_qpu}, ++ .chroma = {10, QPU_MC_PRED_N_C10, inter_pred_setup_c10_qpu, inter_pred_sync10_qpu, inter_pred_exit_c10_qpu} ++ } ++ ++}; ++ ++static void set_ipe_from_ici(HEVCRpiInterPredEnv * const ipe, const ipe_chan_info_t * const ici) ++{ ++ const unsigned int n = ici->n; ++ const unsigned int q1_size = (ipe->gptr.numbytes / n) & ~3; // Round down to word ++ ++ ipe->n = n; ++ ipe->max_fill = q1_size - ipe->min_gap; ++ for(unsigned int i = 0; i < n; i++) { ++ HEVCRpiInterPredQ * const q = ipe->q + i; ++ q->qpu_mc_curr = q->qpu_mc_base = ++ (qpu_mc_pred_cmd_t *)(ipe->gptr.arm + i * q1_size); ++ q->code_setup = qpu_fn(ici->setup_fns[i]); ++ q->code_sync = qpu_fn(ici->sync_fns[i]); ++ q->code_exit = qpu_fn(ici->exit_fns[i]); ++ } ++} ++ ++static void rpi_hevc_qpu_set_fns(HEVCRpiContext * const s, const unsigned int bit_depth) ++{ ++ av_assert0(bit_depth >= 8 && bit_depth <= 16); ++ ++ rpi_hevc_qpu_init_fn(&s->qpu, bit_depth); ++} ++ ++// Unsigned Trivial MOD ++static inline unsigned int utmod(const unsigned int x, const unsigned int n) ++{ ++ return x >= n ? x - n : x; ++} ++ ++// returns pq->job_n++ ++static inline unsigned int pass_queue_inc_job_n(HEVCRpiPassQueue * const pq) ++{ ++ unsigned int const x2 = pq->job_n; ++ pq->job_n = utmod(x2 + 1, RPI_MAX_JOBS); ++ return x2; ++} ++ ++static void pass_queue_init(HEVCRpiPassQueue * const pq, HEVCRpiContext * const s, HEVCRpiWorkerFn * const worker, sem_t * const psem_out, const int n) ++{ ++ pq->terminate = 0; ++ pq->job_n = 0; ++ pq->context = s; ++ pq->worker = worker; ++ pq->psem_out = psem_out; ++ pq->pass_n = n; ++ pq->started = 0; ++ sem_init(&pq->sem_in, 0, 0); ++} ++ ++static void pass_queue_kill(HEVCRpiPassQueue * const pq) ++{ ++ sem_destroy(&pq->sem_in); ++} ++ ++static inline void rpi_sem_wait(sem_t * const sem) ++{ ++ while (sem_wait(sem) != 0) { ++ av_assert0(errno == EINTR); ++ } ++} ++ ++static void pass_queue_submit_job(HEVCRpiPassQueue * const pq) ++{ ++ sem_post(&pq->sem_in); ++} ++ ++static inline void pass_queue_do_all(HEVCRpiContext * const s, HEVCRpiJob * const jb) ++{ ++ // Do the various passes - common with the worker code ++ for (unsigned int i = 0; i != RPI_PASSES; ++i) { ++ s->passq[i].worker(s, jb); ++ } ++} ++ ++ ++#if 0 ++static void dump_jbc(const HEVCRpiJobCtl *const jbc, const char * const func) ++{ ++ int x; ++ sem_getvalue((sem_t *)&jbc->sem_out, &x); ++ printf("%s: jbc: in=%d, out=%d, sum=%d\n", func, jbc->offload_in, jbc->offload_out, x); ++} ++#endif ++ ++ ++static HEVCRpiJob * job_alloc(HEVCRpiJobCtl * const jbc, HEVCRpiLocalContext * const lc) ++{ ++ HEVCRpiJob * jb; ++ HEVCRpiJobGlobal * const jbg = jbc->jbg; ++ ++ pthread_mutex_lock(&jbg->lock); ++ // Check local 1st ++ if ((jb = jbc->jb1) != NULL) ++ { ++ // Only 1 - very easy :-) ++ jbc->jb1 = NULL; ++ } ++ else ++ { ++ // Now look for global free chain ++ if ((jb = jbg->free1) != NULL) ++ { ++ // Found one - unlink it ++ jbg->free1 = jb->next; ++ jb->next = NULL; ++ } ++ else ++ { ++ // Out of places to look - wait for one to become free - add to Qs ++ ++ // Global ++ // If "good" lc then add after the last "good" el in the chain ++ // otherwise add to the tail ++ if (jbg->wait_tail == NULL || jbg->wait_tail->last_progress_good || !lc->last_progress_good) ++ { ++ // Add to end as we had to wait last time or wait Q empty ++ if ((lc->jw_prev = jbg->wait_tail) == NULL) ++ jbg->wait_head = lc; ++ else ++ lc->jw_prev->jw_next = lc; ++ lc->jw_next = NULL; ++ jbg->wait_tail = lc; ++ } ++ else ++ { ++ // This is a "good" lc that we need to poke into the middle ++ // of the Q ++ // We know that the Q isn't empty and there is at least one ++ // !last_progess_good el in it from the previous test ++ ++ HEVCRpiLocalContext * const p = jbg->wait_good; // Insert after ++ ++ if (p == NULL) ++ { ++ // No current good els - add to head ++ lc->jw_next = jbg->wait_head; ++ jbg->wait_head = lc; ++ } ++ else ++ { ++ lc->jw_next = p->jw_next; ++ p->jw_next = lc; ++ } ++ ++ lc->jw_next->jw_prev = lc; ++ lc->jw_prev = p; ++ } ++ ++ // If "good" then we are now the last good waiting el ++ if (lc->last_progress_good) ++ jbg->wait_good = lc; ++ ++ // Local ++ if ((lc->ljw_prev = jbc->lcw_tail) == NULL) ++ jbc->lcw_head = lc; ++ else ++ lc->ljw_prev->ljw_next = lc; ++ lc->ljw_next = NULL; ++ jbc->lcw_tail = lc; ++ } ++ } ++ ++ pthread_mutex_unlock(&jbg->lock); ++ ++ if (jb == NULL) // Need to wait ++ { ++ rpi_sem_wait(&lc->jw_sem); ++ jb = lc->jw_job; // Set by free code ++ } ++ ++ return jb; ++} ++ ++ ++static void job_free(HEVCRpiJobCtl * const jbc0, HEVCRpiJob * const jb) ++{ ++ HEVCRpiJobGlobal * const jbg = jbc0->jbg; // This jbc only used to find jbg so we can get the lock ++ HEVCRpiJobCtl * jbc = jb->jbc_local; ++ HEVCRpiLocalContext * lc = NULL; ++ ++ pthread_mutex_lock(&jbg->lock); ++ ++ if (jbc != NULL) ++ { ++ av_assert1(jbc->jb1 == NULL); ++ ++ // Release to Local if nothing waiting there ++ if ((lc = jbc->lcw_head) == NULL) ++ jbc->jb1 = jb; ++ } ++ else ++ { ++ // Release to global if nothing waiting there ++ if ((lc = jbg->wait_head) == NULL) ++ { ++ jb->next = jbg->free1; ++ jbg->free1 = jb; ++ } ++ else ++ { ++ // ? seems somehow mildy ugly... ++ jbc = lc->context->jbc; ++ } ++ } ++ ++ if (lc != NULL) ++ { ++ // Something was waiting ++ ++ // Unlink ++ // Global ++ if (lc->jw_next == NULL) ++ jbg->wait_tail = lc->jw_prev; ++ else ++ lc->jw_next->jw_prev = lc->jw_prev; ++ ++ if (lc->jw_prev == NULL) ++ jbg->wait_head = lc->jw_next; ++ else ++ lc->jw_prev->jw_next = lc->jw_next; ++ ++ // Local ++ if (lc->ljw_next == NULL) ++ jbc->lcw_tail = lc->ljw_prev; ++ else ++ lc->ljw_next->ljw_prev = lc->ljw_prev; ++ ++ if (lc->ljw_prev == NULL) ++ jbc->lcw_head = lc->ljw_next; ++ else ++ lc->ljw_prev->ljw_next = lc->ljw_next; ++ ++ // Update good if required ++ if (jbg->wait_good == lc) ++ jbg->wait_good = lc->jw_prev; ++ ++ // Prod ++ lc->jw_job = jb; ++ sem_post(&lc->jw_sem); ++ } ++ ++ pthread_mutex_unlock(&jbg->lock); ++} ++ ++static void job_lc_kill(HEVCRpiLocalContext * const lc) ++{ ++ sem_destroy(&lc->jw_sem); ++} ++ ++static void job_lc_init(HEVCRpiLocalContext * const lc) ++{ ++ lc->jw_next = NULL; ++ lc->jw_prev = NULL; ++ lc->ljw_next = NULL; ++ lc->ljw_prev = NULL; ++ lc->jw_job = NULL; ++ sem_init(&lc->jw_sem, 0, 0); ++} ++ ++// Returns: ++// 0 if we have waited for MV or expect to wait for recon ++// 1 if we haven't waited for MV & do not need to wait for recon ++static int progress_good(const HEVCRpiContext *const s, const HEVCRpiJob * const jb) ++{ ++ if (jb->waited) // reset by rpi_begin ++ return 0; ++ for (unsigned int i = 0; i != FF_ARRAY_ELEMS(jb->progress_req); ++i) ++ { ++ if (jb->progress_req[i] >= 0 && s->DPB[i].tf.progress != NULL && ++ ((volatile int *)(s->DPB[i].tf.progress->data))[0] < jb->progress_req[i]) ++ return 0; ++ } ++ return 1; ++} ++ ++// Submit job if it is full (indicated by having ctu_ts_last set >= 0) ++static inline void worker_submit_job(HEVCRpiContext *const s, HEVCRpiLocalContext * const lc) ++{ ++ HEVCRpiJobCtl *const jbc = s->jbc; ++ HEVCRpiJob * const jb = lc->jb0; ++ ++ av_assert1(jb != NULL); ++ ++ if (jb->ctu_ts_last < 0) { ++ return; ++ } ++ ++ lc->last_progress_good = progress_good(s, jb); ++ jb->waited = !lc->last_progress_good; ++ lc->jb0 = NULL; ++ ++ if (s->offload_recon) ++ { ++ pthread_mutex_lock(&jbc->in_lock); ++ jbc->offloadq[jbc->offload_in] = jb; ++ jbc->offload_in = utmod(jbc->offload_in + 1, RPI_MAX_JOBS); ++ pthread_mutex_unlock(&jbc->in_lock); ++ ++ pass_queue_submit_job(s->passq + 0); // Consumes job eventually ++ } ++ else ++ { ++ pass_queue_do_all(s, jb); // Consumes job before return ++ } ++} ++ ++ ++// Call worker_pass0_ready to wait until the s->pass0_job slot becomes ++// available to receive the next job. ++// ++// Now safe against multiple callers - needed for tiles ++// "normal" and WPP will only call here one at a time ++static inline void worker_pass0_ready(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) ++{ ++ HEVCRpiJobCtl * const jbc = s->jbc; ++ ++ // It is legit for us to already have a job allocated - do nothing in this case ++ if (lc->jb0 != NULL) ++ return; ++ ++ if (s->offload_recon) ++ rpi_sem_wait(&jbc->sem_out); // This sem will stop this frame grabbing too much ++ ++ lc->jb0 = job_alloc(jbc, lc); ++ ++ rpi_begin(s, lc->jb0, lc->ts); ++} ++ ++// Free up a job without submission ++static void worker_free(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) ++{ ++ HEVCRpiJobCtl * const jbc = s->jbc; ++ HEVCRpiJob * const jb = lc->jb0; ++ ++ if (jb == NULL) { ++ return; ++ } ++ ++ lc->jb0 = NULL; ++ ++ job_free(jbc, jb); ++ ++ // If offload then poke sem_out too ++ if (s->offload_recon) { ++ sem_post(&jbc->sem_out); ++ } ++} ++ ++ ++// Call this to wait for all jobs to have completed at the end of a frame ++// Slightly icky as there is no clean way to wait for a sem to count up ++// Not reentrant - call on main thread only ++static void worker_wait(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc) ++{ ++ HEVCRpiJobCtl * const jbc = s->jbc; ++ int i = 0; ++ ++ // We shouldn't reach here with an unsubmitted job ++ av_assert1(lc->jb0 == NULL); ++ ++ // If no offload then there can't be anything to wait for ++ if (!s->offload_recon) { ++ return; ++ } ++ ++ if (sem_getvalue(&jbc->sem_out, &i) == 0 && i < RPI_MAX_JOBS) ++ { ++ for (i = 0; i != RPI_MAX_JOBS; ++i) { ++ rpi_sem_wait(&jbc->sem_out); ++ } ++ for (i = 0; i != RPI_MAX_JOBS; ++i) { ++ sem_post(&jbc->sem_out); ++ } ++ } ++} ++ ++static void * pass_worker(void *arg) ++{ ++ HEVCRpiPassQueue *const pq = (HEVCRpiPassQueue *)arg; ++ HEVCRpiContext *const s = pq->context; ++ ++ for (;;) ++ { ++ rpi_sem_wait(&pq->sem_in); ++ ++ if (pq->terminate) ++ break; ++ ++ pq->worker(s, s->jbc->offloadq[pass_queue_inc_job_n(pq)]); ++ // * should really set jb->passes_done here ++ ++ sem_post(pq->psem_out); ++ } ++ return NULL; ++} ++ ++static void pass_queues_start_all(HEVCRpiContext *const s) ++{ ++ unsigned int i; ++ HEVCRpiPassQueue * const pqs = s->passq; ++ ++ for (i = 0; i != RPI_PASSES; ++i) ++ { ++ av_assert0(pthread_create(&pqs[i].thread, NULL, pass_worker, pqs + i) == 0); ++ pqs[i].started = 1; ++ } ++} ++ ++static void pass_queues_term_all(HEVCRpiContext *const s) ++{ ++ unsigned int i; ++ HEVCRpiPassQueue * const pqs = s->passq; ++ ++ for (i = 0; i != RPI_PASSES; ++i) ++ pqs[i].terminate = 1; ++ for (i = 0; i != RPI_PASSES; ++i) ++ { ++ if (pqs[i].started) ++ sem_post(&pqs[i].sem_in); ++ } ++ for (i = 0; i != RPI_PASSES; ++i) ++ { ++ if (pqs[i].started) { ++ pthread_join(pqs[i].thread, NULL); ++ pqs[i].started = 0; ++ } ++ } ++} ++ ++static void pass_queues_kill_all(HEVCRpiContext *const s) ++{ ++ unsigned int i; ++ HEVCRpiPassQueue * const pqs = s->passq; ++ ++ for (i = 0; i != RPI_PASSES; ++i) ++ pass_queue_kill(pqs + i); ++} ++ ++ ++static void worker_pic_free_one(HEVCRpiJob * const jb) ++{ ++ // Free coeff stuff - allocation not the same for all buffers ++ HEVCRpiCoeffsEnv * const cf = &jb->coeffs; ++ ++ if (cf->s[0].buf != NULL) ++ av_freep(&cf->mptr); ++ if (cf->s[2].buf != NULL) ++ gpu_free(&cf->gptr); ++ memset(cf, 0, sizeof(*cf)); ++} ++ ++static int worker_pic_alloc_one(HEVCRpiJob * const jb, const unsigned int coeff_count) ++{ ++ HEVCRpiCoeffsEnv * const cf = &jb->coeffs; ++ ++ if (gpu_malloc_cached((coeff_count + 32*32) * sizeof(cf->s[2].buf[0]), &cf->gptr) != 0) ++ goto fail; ++ cf->s[2].buf = (int16_t *)cf->gptr.arm; ++ cf->s[3].buf = cf->s[2].buf + coeff_count; ++ ++ // Must be 64 byte aligned for our zero zapping code so over-allocate & ++ // round ++ if ((cf->mptr = av_malloc(coeff_count * sizeof(cf->s[0].buf[0]) + 63)) == NULL) ++ goto fail; ++ cf->s[0].buf = (void *)(((intptr_t)cf->mptr + 63) & ~63); ++ return 0; ++ ++fail: ++ av_log(NULL, AV_LOG_ERROR, "%s: Allocation failed\n", __func__); ++ worker_pic_free_one(jb); ++ return -1; ++} ++ ++static void worker_pic_reset(HEVCRpiCoeffsEnv * const cf) ++{ ++ unsigned int i; ++ for (i = 0; i != 4; ++i) { ++ cf->s[i].n = 0; ++#if RPI_COMPRESS_COEFFS ++ cf->s[i].packed = 1; ++ cf->s[i].packed_n = 0; ++#endif ++ } ++} ++ ++int16_t * rpi_alloc_coeff_buf(HEVCRpiJob * const jb, const int buf_no, const int n) ++{ ++ HEVCRpiCoeffEnv *const cfe = jb->coeffs.s + buf_no; ++ int16_t * const coeffs = (buf_no != 3) ? cfe->buf + cfe->n : cfe->buf - (cfe->n + n); ++ cfe->n += n; ++ return coeffs; ++} ++ ++void ff_hevc_rpi_progress_wait_field(const HEVCRpiContext * const s, HEVCRpiJob * const jb, ++ const HEVCRpiFrame * const ref, const int val, const int field) ++{ ++ if (ref->tf.progress != NULL && ((int *)ref->tf.progress->data)[field] < val) { ++ HEVCRpiContext *const fs = ref->tf.owner[field]->priv_data; ++ HEVCRpiFrameProgressState * const pstate = fs->progress_states + field; ++ sem_t * sem = NULL; ++ ++ av_assert0(pthread_mutex_lock(&pstate->lock) == 0); ++ if (((volatile int *)ref->tf.progress->data)[field] < val) { ++ HEVCRpiFrameProgressWait * const pwait = &jb->progress_wait; ++ ++ av_assert1(pwait->req == -1 && pwait->next == NULL); ++ jb->waited = 1; // Remember that we had to wait for later scheduling ++ ++ pwait->req = val; ++ pwait->next = NULL; ++ if (pstate->first == NULL) ++ pstate->first = pwait; ++ else ++ pstate->last->next = pwait; ++ pstate->last = pwait; ++ sem = &pwait->sem; ++ } ++ pthread_mutex_unlock(&pstate->lock); ++ ++ if (sem != NULL) { ++ rpi_sem_wait(sem); ++ } ++ } ++} ++ ++void ff_hevc_rpi_progress_signal_field(HEVCRpiContext * const s, const int val, const int field) ++{ ++ HEVCRpiFrameProgressState *const pstate = s->progress_states + field; ++ ++ ((int *)s->ref->tf.progress->data)[field] = val; ++ ++ av_assert0(pthread_mutex_lock(&pstate->lock) == 0); ++ { ++ HEVCRpiFrameProgressWait ** ppwait = &pstate->first; ++ HEVCRpiFrameProgressWait * pwait; ++ ++ while ((pwait = *ppwait) != NULL) { ++ if (pwait->req > val) ++ { ++ ppwait = &pwait->next; ++ pstate->last = pwait; ++ } ++ else ++ { ++ *ppwait = pwait->next; ++ pwait->req = -1; ++ pwait->next = NULL; ++ sem_post(&pwait->sem); ++ } ++ } ++ } ++ pthread_mutex_unlock(&pstate->lock); ++} ++ ++static void ff_hevc_rpi_progress_init_state(HEVCRpiFrameProgressState * const pstate) ++{ ++ pstate->first = NULL; ++ pstate->last = NULL; ++ pthread_mutex_init(&pstate->lock, NULL); ++} ++ ++static void ff_hevc_rpi_progress_init_wait(HEVCRpiFrameProgressWait * const pwait) ++{ ++ pwait->req = -1; ++ pwait->next = NULL; ++ sem_init(&pwait->sem, 0, 0); ++} ++ ++static void ff_hevc_rpi_progress_kill_state(HEVCRpiFrameProgressState * const pstate) ++{ ++ av_assert1(pstate->first == NULL); ++ pthread_mutex_destroy(&pstate->lock); ++} ++ ++static void ff_hevc_rpi_progress_kill_wait(HEVCRpiFrameProgressWait * const pwait) ++{ ++ sem_destroy(&pwait->sem); ++} ++ ++ ++/** ++ * NOTE: Each function hls_foo correspond to the function foo in the ++ * specification (HLS stands for High Level Syntax). ++ */ ++ ++/** ++ * Section 5.7 ++ */ ++ ++// Realloc the entry point arrays ++static int alloc_entry_points(RpiSliceHeader * const sh, const int n) ++{ ++ if (sh->entry_point_offset == NULL || n > sh->offsets_allocated || n == 0) ++ { ++ // Round up alloc to multiple of 32 ++ int a = (n + 31) & ~31; ++ ++ // We don't care about the previous contents so probably fastest to simply discard ++ av_freep(&sh->entry_point_offset); ++ av_freep(&sh->offset); ++ av_freep(&sh->size); ++ ++ if (a != 0) ++ { ++ sh->entry_point_offset = av_malloc_array(a, sizeof(unsigned)); ++ sh->offset = av_malloc_array(a, sizeof(int)); ++ sh->size = av_malloc_array(a, sizeof(int)); ++ ++ if (!sh->entry_point_offset || !sh->offset || !sh->size) { ++ sh->num_entry_point_offsets = 0; ++ sh->offsets_allocated = 0; ++ return AVERROR(ENOMEM); ++ } ++ } ++ ++ sh->offsets_allocated = a; ++ } ++ ++ return 0; ++} ++ ++/* free everything allocated by pic_arrays_init() */ ++static void pic_arrays_free(HEVCRpiContext *s) ++{ ++ av_freep(&s->sao); ++ av_freep(&s->deblock); ++ ++ av_freep(&s->cabac_stash_up); ++ s->cabac_stash_left = NULL; // freed with _up ++ ++ av_freep(&s->mvf_up); ++ av_freep(&s->mvf_left); ++ ++ av_freep(&s->is_pcm); ++ av_freep(&s->is_intra_store); ++ s->is_intra = NULL; ++ av_freep(&s->rpl_tab); ++ s->rpl_tab_size = 0; ++ ++ av_freep(&s->qp_y_tab); ++ av_freep(&s->tab_slice_address); ++ av_freep(&s->filter_slice_edges); ++ ++ av_freep(&s->bs_horizontal); ++ s->bs_vertical = NULL; // freed with H ++ av_freep(&s->bsf_stash_left); ++ av_freep(&s->bsf_stash_up); ++ ++ av_freep(&s->rpl_up); ++ av_freep(&s->rpl_left); ++ ++ alloc_entry_points(&s->sh, 0); ++ ++ av_buffer_pool_uninit(&s->col_mvf_pool); ++} ++ ++/* allocate arrays that depend on frame dimensions */ ++static int pic_arrays_init(HEVCRpiContext * const s, const HEVCRpiSPS * const sps) ++{ ++ const unsigned int log2_min_cb_size = sps->log2_min_cb_size; ++ const unsigned int width = sps->width; ++ const unsigned int height = sps->height; ++ const unsigned int pic_size_in_cb = ((width >> log2_min_cb_size) + 1) * ++ ((height >> log2_min_cb_size) + 1); ++ const unsigned int ctb_count = sps->ctb_size; ++ ++ { ++ unsigned int w = ((width + HEVC_RPI_BS_STRIDE1_PEL_MASK) & ~HEVC_RPI_BS_STRIDE1_PEL_MASK); ++ unsigned int h = ((height + 15) & ~15); ++ ++ s->bs_stride2 = h >> HEVC_RPI_BS_COL_BYTES_SHR; // Column size ++ s->bs_size = s->bs_stride2 * (w >> HEVC_RPI_BS_STRIDE1_PEL_SHIFT); // col size * cols ++ } ++ ++ s->sao = av_mallocz(ctb_count * sizeof(*s->sao) + 8); // Our sao code overreads this array slightly ++ s->deblock = av_mallocz_array(ctb_count, sizeof(*s->deblock)); ++ if (!s->sao || !s->deblock) ++ goto fail; ++ ++ s->cabac_stash_up = av_malloc((((width + 63) & ~63) >> 3) + (((height + 63) & ~63) >> 3)); ++ s->cabac_stash_left = s->cabac_stash_up + (((width + 63) & ~63) >> 3); ++ if (s->cabac_stash_up == NULL) ++ goto fail; ++ ++ // Round width up to max ctb size ++ s->mvf_up = av_malloc((((width + 63) & ~63) >> LOG2_MIN_PU_SIZE) * sizeof(*s->mvf_up)); ++ // * Only needed if we have H tiles ++ s->mvf_left = av_malloc((((height + 63) & ~63) >> LOG2_MIN_PU_SIZE) * sizeof(*s->mvf_up)); ++ ++ // We can overread by 1 line & one byte in deblock so alloc & zero ++ // We don't need to zero the extra @ start of frame as it will never be ++ // written ++ s->is_pcm = av_mallocz(sps->pcm_width * (sps->pcm_height + 1) + 1); ++ s->is_intra_store = av_mallocz(sps->pcm_width * (sps->pcm_height + 1) + 1); ++ if (s->is_pcm == NULL || s->is_intra_store == NULL) ++ goto fail; ++ ++ s->filter_slice_edges = av_mallocz(ctb_count); ++ s->tab_slice_address = av_malloc_array(ctb_count, ++ sizeof(*s->tab_slice_address)); ++ s->qp_y_tab = av_malloc_array(pic_size_in_cb, ++ sizeof(*s->qp_y_tab)); ++ if (!s->qp_y_tab || !s->filter_slice_edges || !s->tab_slice_address) ++ goto fail; ++ ++ s->bs_horizontal = av_mallocz(s->bs_size * 2); ++ s->bs_vertical = s->bs_horizontal + s->bs_size; ++ if (s->bs_horizontal == NULL) ++ goto fail; ++ ++ s->rpl_up = av_mallocz(sps->ctb_width * sizeof(*s->rpl_up)); ++ s->rpl_left = av_mallocz(sps->ctb_height * sizeof(*s->rpl_left)); ++ if (s->rpl_left == NULL || s->rpl_up == NULL) ++ goto fail; ++ ++ if ((s->bsf_stash_left = av_mallocz(((height + 63) & ~63) >> 4)) == NULL || ++ (s->bsf_stash_up = av_mallocz(((width + 63) & ~63) >> 4)) == NULL) ++ goto fail; ++ ++ s->col_mvf_stride = (width + 15) >> 4; ++ s->col_mvf_pool = av_buffer_pool_init(((height + 15) >> 4) * s->col_mvf_stride * sizeof(ColMvField), ++ av_buffer_allocz); ++ if (s->col_mvf_pool == NULL) ++ goto fail; ++ ++ return 0; ++ ++fail: ++ pic_arrays_free(s); ++ return AVERROR(ENOMEM); ++} ++ ++static void default_pred_weight_table(HEVCRpiContext * const s) ++{ ++ unsigned int i; ++ const unsigned int wt = 1 << QPU_MC_DENOM; ++ s->sh.luma_log2_weight_denom = 0; ++ s->sh.chroma_log2_weight_denom = 0; ++ for (i = 0; i < s->sh.nb_refs[L0]; i++) { ++ s->sh.luma_weight_l0[i] = wt; ++ s->sh.luma_offset_l0[i] = 0; ++ s->sh.chroma_weight_l0[i][0] = wt; ++ s->sh.chroma_weight_l0[i][1] = wt; ++ s->sh.chroma_offset_l0[i][0] = 0; ++ s->sh.chroma_offset_l0[i][1] = 0; ++ } ++ for (i = 0; i < s->sh.nb_refs[L1]; i++) { ++ s->sh.luma_weight_l1[i] = wt; ++ s->sh.luma_offset_l1[i] = 0; ++ s->sh.chroma_weight_l1[i][0] = wt; ++ s->sh.chroma_weight_l1[i][1] = wt; ++ s->sh.chroma_offset_l1[i][0] = 0; ++ s->sh.chroma_offset_l1[i][1] = 0; ++ } ++} ++ ++static int get_weights(HEVCRpiContext * const s, GetBitContext * const gb, ++ const unsigned int refs, ++ int16_t * luma_weight, int16_t * luma_offset, ++ int16_t * chroma_weight, int16_t * chroma_offset) ++{ ++ unsigned int luma_flags; ++ unsigned int chroma_flags; ++ unsigned int i; ++ const unsigned int wp_offset_bd_shift = s->ps.sps->high_precision_offsets_enabled_flag ? 0 : (s->ps.sps->bit_depth - 8); ++ const int wp_offset_half_range = s->ps.sps->wp_offset_half_range; ++ const unsigned int luma_weight_base = 1 << QPU_MC_DENOM; ++ const unsigned int chroma_weight_base = 1 << QPU_MC_DENOM; ++ const unsigned int luma_weight_shift = (QPU_MC_DENOM - s->sh.luma_log2_weight_denom); ++ const unsigned int chroma_weight_shift = (QPU_MC_DENOM - s->sh.chroma_log2_weight_denom); ++ ++ if (refs == 0) ++ return 0; ++ ++ luma_flags = get_bits(gb, refs); ++ chroma_flags = ctx_cfmt(s) == 0 ? 0 : get_bits(gb, refs); ++ i = 1 << (refs - 1); ++ ++ do ++ { ++ if ((luma_flags & i) != 0) ++ { ++ const int delta_weight = get_se_golomb(gb); ++ const int offset = get_se_golomb(gb); ++ if (delta_weight < -128 || delta_weight > 127 || ++ offset < -wp_offset_half_range || offset >= wp_offset_half_range) ++ { ++ return AVERROR_INVALIDDATA; ++ } ++ *luma_weight++ = luma_weight_base + (delta_weight << luma_weight_shift); ++ *luma_offset++ = offset << wp_offset_bd_shift; ++ } ++ else ++ { ++ *luma_weight++ = luma_weight_base; ++ *luma_offset++ = 0; ++ } ++ ++ if ((chroma_flags & i) != 0) ++ { ++ unsigned int j; ++ for (j = 0; j != 2; ++j) ++ { ++ const int delta_weight = get_se_golomb(gb); ++ const int delta_offset = get_se_golomb(gb); ++ ++ if (delta_weight < -128 || delta_weight > 127 || ++ delta_offset < -4 * wp_offset_half_range || delta_offset >= 4 * wp_offset_half_range) ++ { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ *chroma_weight++ = chroma_weight_base + (delta_weight << chroma_weight_shift); ++ *chroma_offset++ = av_clip( ++ wp_offset_half_range + delta_offset - ++ ((wp_offset_half_range * ((1 << s->sh.chroma_log2_weight_denom) + delta_weight)) >> s->sh.chroma_log2_weight_denom), ++ -wp_offset_half_range, wp_offset_half_range - 1) << wp_offset_bd_shift; ++ } ++ } ++ else ++ { ++ *chroma_weight++ = chroma_weight_base; ++ *chroma_weight++ = chroma_weight_base; ++ *chroma_offset++ = 0; ++ *chroma_offset++ = 0; ++ } ++ } while ((i >>= 1) != 0); ++ ++ return 0; ++} ++ ++static int pred_weight_table(HEVCRpiContext *s, GetBitContext *gb) ++{ ++ int err; ++ const unsigned int luma_log2_weight_denom = get_ue_golomb_long(gb); ++ const unsigned int chroma_log2_weight_denom = (ctx_cfmt(s) == 0) ? 0 : luma_log2_weight_denom + get_se_golomb(gb); ++ ++ if (luma_log2_weight_denom > 7 || ++ chroma_log2_weight_denom > 7) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, "Invalid prediction weight denom: luma=%d, chroma=%d\n", ++ luma_log2_weight_denom, chroma_log2_weight_denom); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ s->sh.luma_log2_weight_denom = luma_log2_weight_denom; ++ s->sh.chroma_log2_weight_denom = chroma_log2_weight_denom; ++ ++ if ((err = get_weights(s, gb, s->sh.nb_refs[L0], ++ s->sh.luma_weight_l0, s->sh.luma_offset_l0, ++ s->sh.chroma_weight_l0[0], s->sh.chroma_offset_l0[0])) != 0 || ++ (err = get_weights(s, gb, s->sh.nb_refs[L1], ++ s->sh.luma_weight_l1, s->sh.luma_offset_l1, ++ s->sh.chroma_weight_l1[0], s->sh.chroma_offset_l1[0])) != 0) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, "Invalid prediction weight or offset\n"); ++ return err; ++ } ++ ++ return 0; ++} ++ ++static int decode_lt_rps(HEVCRpiContext *s, LongTermRPS *rps, GetBitContext *gb) ++{ ++ const HEVCRpiSPS *sps = s->ps.sps; ++ int max_poc_lsb = 1 << sps->log2_max_poc_lsb; ++ int prev_delta_msb = 0; ++ unsigned int nb_sps = 0, nb_sh; ++ int i; ++ ++ rps->nb_refs = 0; ++ if (!sps->long_term_ref_pics_present_flag) ++ return 0; ++ ++ if (sps->num_long_term_ref_pics_sps > 0) ++ nb_sps = get_ue_golomb_long(gb); ++ nb_sh = get_ue_golomb_long(gb); ++ ++ if (nb_sps > sps->num_long_term_ref_pics_sps) ++ return AVERROR_INVALIDDATA; ++ if (nb_sh + (uint64_t)nb_sps > FF_ARRAY_ELEMS(rps->poc)) ++ return AVERROR_INVALIDDATA; ++ ++ rps->nb_refs = nb_sh + nb_sps; ++ ++ for (i = 0; i < rps->nb_refs; i++) { ++ uint8_t delta_poc_msb_present; ++ ++ if (i < nb_sps) { ++ uint8_t lt_idx_sps = 0; ++ ++ if (sps->num_long_term_ref_pics_sps > 1) ++ lt_idx_sps = get_bits(gb, av_ceil_log2(sps->num_long_term_ref_pics_sps)); ++ ++ rps->poc[i] = sps->lt_ref_pic_poc_lsb_sps[lt_idx_sps]; ++ rps->used[i] = sps->used_by_curr_pic_lt_sps_flag[lt_idx_sps]; ++ } else { ++ rps->poc[i] = get_bits(gb, sps->log2_max_poc_lsb); ++ rps->used[i] = get_bits1(gb); ++ } ++ ++ delta_poc_msb_present = get_bits1(gb); ++ if (delta_poc_msb_present) { ++ int64_t delta = get_ue_golomb_long(gb); ++ int64_t poc; ++ ++ if (i && i != nb_sps) ++ delta += prev_delta_msb; ++ ++ poc = rps->poc[i] + s->poc - delta * max_poc_lsb - s->sh.pic_order_cnt_lsb; ++ if (poc != (int32_t)poc) ++ return AVERROR_INVALIDDATA; ++ rps->poc[i] = poc; ++ prev_delta_msb = delta; ++ } ++ } ++ ++ return 0; ++} ++ ++static void export_stream_params(AVCodecContext *avctx, const HEVCRpiParamSets *ps, ++ const HEVCRpiSPS *sps) ++{ ++ const HEVCRpiVPS *vps = (const HEVCRpiVPS*)ps->vps_list[sps->vps_id]->data; ++ const HEVCRpiWindow *ow = &sps->output_window; ++ unsigned int num = 0, den = 0; ++ ++ avctx->pix_fmt = sps->pix_fmt; ++ avctx->coded_width = sps->width; ++ avctx->coded_height = sps->height; ++ avctx->width = sps->width - ow->left_offset - ow->right_offset; ++ avctx->height = sps->height - ow->top_offset - ow->bottom_offset; ++ avctx->has_b_frames = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics; ++ avctx->profile = sps->ptl.general_ptl.profile_idc; ++ avctx->level = sps->ptl.general_ptl.level_idc; ++ ++ ff_set_sar(avctx, sps->vui.sar); ++ ++ if (sps->vui.video_signal_type_present_flag) ++ avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG ++ : AVCOL_RANGE_MPEG; ++ else ++ avctx->color_range = AVCOL_RANGE_MPEG; ++ ++ if (sps->vui.colour_description_present_flag) { ++ avctx->color_primaries = sps->vui.colour_primaries; ++ avctx->color_trc = sps->vui.transfer_characteristic; ++ avctx->colorspace = sps->vui.matrix_coeffs; ++ } else { ++ avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; ++ avctx->color_trc = AVCOL_TRC_UNSPECIFIED; ++ avctx->colorspace = AVCOL_SPC_UNSPECIFIED; ++ } ++ ++ if (vps->vps_timing_info_present_flag) { ++ num = vps->vps_num_units_in_tick; ++ den = vps->vps_time_scale; ++ } else if (sps->vui.vui_timing_info_present_flag) { ++ num = sps->vui.vui_num_units_in_tick; ++ den = sps->vui.vui_time_scale; ++ } ++ ++ if (num != 0 && den != 0) ++ av_reduce(&avctx->framerate.den, &avctx->framerate.num, ++ num, den, 1 << 30); ++} ++ ++static enum AVPixelFormat get_format(HEVCRpiContext *s, const HEVCRpiSPS *sps) ++{ ++ enum AVPixelFormat pix_fmts[4], *fmt = pix_fmts; ++ ++ // Admit to no h/w formats ++ ++ *fmt++ = sps->pix_fmt; ++ *fmt = AV_PIX_FMT_NONE; ++ ++ return pix_fmts[0] == AV_PIX_FMT_NONE ? AV_PIX_FMT_NONE: ff_thread_get_format(s->avctx, pix_fmts); ++} ++ ++static int is_sps_supported(const HEVCRpiSPS * const sps) ++{ ++ return av_rpi_is_sand_format(sps->pix_fmt) && ++ sps->width <= HEVC_RPI_MAX_WIDTH && ++ sps->height <= HEVC_RPI_MAX_HEIGHT; ++} ++ ++static int set_sps(HEVCRpiContext * const s, const HEVCRpiSPS * const sps, ++ const enum AVPixelFormat pix_fmt) ++{ ++ int ret; ++ ++ pic_arrays_free(s); ++ s->ps.sps = NULL; ++ s->ps.vps = NULL; ++ ++ if (sps == NULL) ++ return 0; ++ ++ if (!is_sps_supported(sps)) ++ return AVERROR_DECODER_NOT_FOUND; ++ ++ ret = pic_arrays_init(s, sps); ++ if (ret < 0) ++ goto fail; ++ ++ export_stream_params(s->avctx, &s->ps, sps); ++ ++ s->avctx->pix_fmt = pix_fmt; ++ ++ ff_hevc_rpi_pred_init(&s->hpc, sps->bit_depth); ++ ff_hevc_rpi_dsp_init (&s->hevcdsp, sps->bit_depth); ++ ++ // * We don't support cross_component_prediction_enabled_flag but as that ++ // must be 0 unless we have 4:4:4 there is no point testing for it as we ++ // only deal with sand which is never 4:4:4 ++ // [support wouldn't be hard] ++ ++ rpi_hevc_qpu_set_fns(s, sps->bit_depth); ++ ++ av_freep(&s->sao_pixel_buffer_h[0]); ++ av_freep(&s->sao_pixel_buffer_v[0]); ++ ++ if (sps->sao_enabled) ++ { ++ const unsigned int c_count = (ctx_cfmt(s) != 0) ? 3 : 1; ++ unsigned int c_idx; ++ size_t vsize[3] = {0}; ++ size_t hsize[3] = {0}; ++ ++ for(c_idx = 0; c_idx < c_count; c_idx++) { ++ int w = sps->width >> ctx_hshift(s, c_idx); ++ int h = sps->height >> ctx_vshift(s, c_idx); ++ // ctb height & width are a min of 8 so this must a multiple of 16 ++ // so no point rounding up! ++ hsize[c_idx] = (w * 2 * sps->ctb_height) << sps->pixel_shift; ++ vsize[c_idx] = (h * 2 * sps->ctb_width) << sps->pixel_shift; ++ } ++ ++ // Allocate as a single lump so we can extend h[1] & v[1] into h[2] & v[2] ++ // when we have plaited chroma ++ s->sao_pixel_buffer_h[0] = av_malloc(hsize[0] + hsize[1] + hsize[2]); ++ s->sao_pixel_buffer_v[0] = av_malloc(vsize[0] + vsize[1] + vsize[2]); ++ s->sao_pixel_buffer_h[1] = s->sao_pixel_buffer_h[0] + hsize[0]; ++ s->sao_pixel_buffer_h[2] = s->sao_pixel_buffer_h[1] + hsize[1]; ++ s->sao_pixel_buffer_v[1] = s->sao_pixel_buffer_v[0] + vsize[0]; ++ s->sao_pixel_buffer_v[2] = s->sao_pixel_buffer_v[1] + vsize[1]; ++ } ++ ++ s->ps.sps = sps; ++ s->ps.vps = (HEVCRpiVPS*) s->ps.vps_list[s->ps.sps->vps_id]->data; ++ ++ return 0; ++ ++fail: ++ pic_arrays_free(s); ++ s->ps.sps = NULL; ++ return ret; ++} ++ ++static inline int qp_offset_valid(const int qp_offset) ++{ ++ return qp_offset >= -12 && qp_offset <= 12; ++} ++ ++static int hls_slice_header(HEVCRpiContext * const s) ++{ ++ GetBitContext * const gb = &s->HEVClc->gb; ++ RpiSliceHeader * const sh = &s->sh; ++ int i, ret; ++ ++ // Coded parameters ++ sh->first_slice_in_pic_flag = get_bits1(gb); ++ if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) { ++ s->seq_decode = (s->seq_decode + 1) & 0xff; ++ s->max_ra = INT_MAX; ++ if (IS_IDR(s)) ++ ff_hevc_rpi_clear_refs(s); ++ } ++ sh->no_output_of_prior_pics_flag = 0; ++ if (IS_IRAP(s)) ++ sh->no_output_of_prior_pics_flag = get_bits1(gb); ++ ++ sh->pps_id = get_ue_golomb_long(gb); ++ if (sh->pps_id >= HEVC_MAX_PPS_COUNT || !s->ps.pps_list[sh->pps_id]) { ++ av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); ++ return AVERROR_INVALIDDATA; ++ } ++ if (!sh->first_slice_in_pic_flag && ++ s->ps.pps != (HEVCRpiPPS*)s->ps.pps_list[sh->pps_id]->data) { ++ av_log(s->avctx, AV_LOG_ERROR, "PPS changed between slices.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ s->ps.pps = (HEVCRpiPPS*)s->ps.pps_list[sh->pps_id]->data; ++ if (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos == 1) ++ sh->no_output_of_prior_pics_flag = 1; ++ ++ if (s->ps.sps != (HEVCRpiSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data) { ++ const HEVCRpiSPS *sps = (HEVCRpiSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data; ++ const HEVCRpiSPS *last_sps = s->ps.sps; ++ enum AVPixelFormat pix_fmt; ++ ++ if (last_sps && IS_IRAP(s) && s->nal_unit_type != HEVC_NAL_CRA_NUT) { ++ if (sps->width != last_sps->width || sps->height != last_sps->height || ++ sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering != ++ last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering) ++ sh->no_output_of_prior_pics_flag = 0; ++ } ++ ff_hevc_rpi_clear_refs(s); ++ ++ ret = set_sps(s, sps, sps->pix_fmt); ++ if (ret < 0) ++ return ret; ++ ++ pix_fmt = get_format(s, sps); ++ if (pix_fmt < 0) ++ return pix_fmt; ++ ++// ret = set_sps(s, sps, pix_fmt); ++// if (ret < 0) ++// return ret; ++ ++ s->avctx->pix_fmt = pix_fmt; ++ ++ s->seq_decode = (s->seq_decode + 1) & 0xff; ++ s->max_ra = INT_MAX; ++ } ++ ++ sh->dependent_slice_segment_flag = 0; ++ if (!sh->first_slice_in_pic_flag) { ++ int slice_address_length; ++ ++ if (s->ps.pps->dependent_slice_segments_enabled_flag) ++ sh->dependent_slice_segment_flag = get_bits1(gb); ++ ++ slice_address_length = av_ceil_log2(s->ps.sps->ctb_size); ++ sh->slice_segment_addr = get_bitsz(gb, slice_address_length); ++ if (sh->slice_segment_addr >= s->ps.sps->ctb_size) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Invalid slice segment address: %u.\n", ++ sh->slice_segment_addr); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (!sh->dependent_slice_segment_flag) { ++ sh->slice_addr = sh->slice_segment_addr; ++ s->slice_idx++; ++ } ++ } else { ++ sh->slice_segment_addr = sh->slice_addr = 0; ++ s->slice_idx = 0; ++ s->slice_initialized = 0; ++ } ++ ++ if (!sh->dependent_slice_segment_flag) { ++ s->slice_initialized = 0; ++ ++ for (i = 0; i < s->ps.pps->num_extra_slice_header_bits; i++) ++ skip_bits(gb, 1); // slice_reserved_undetermined_flag[] ++ ++ sh->slice_type = get_ue_golomb_long(gb); ++ if (!(sh->slice_type == HEVC_SLICE_I || ++ sh->slice_type == HEVC_SLICE_P || ++ sh->slice_type == HEVC_SLICE_B)) { ++ av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", ++ sh->slice_type); ++ return AVERROR_INVALIDDATA; ++ } ++ if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { ++ av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ // when flag is not present, picture is inferred to be output ++ sh->pic_output_flag = 1; ++ if (s->ps.pps->output_flag_present_flag) ++ sh->pic_output_flag = get_bits1(gb); ++ ++ if (s->ps.sps->separate_colour_plane_flag) ++ sh->colour_plane_id = get_bits(gb, 2); ++ ++ if (!IS_IDR(s)) { ++ int poc, pos; ++ ++ sh->pic_order_cnt_lsb = get_bits(gb, s->ps.sps->log2_max_poc_lsb); ++ poc = ff_hevc_rpi_compute_poc(s->ps.sps, s->pocTid0, sh->pic_order_cnt_lsb, s->nal_unit_type); ++ if (!sh->first_slice_in_pic_flag && poc != s->poc) { ++ av_log(s->avctx, AV_LOG_WARNING, ++ "Ignoring POC change between slices: %d -> %d\n", s->poc, poc); ++ if (s->avctx->err_recognition & AV_EF_EXPLODE) ++ return AVERROR_INVALIDDATA; ++ poc = s->poc; ++ } ++ s->poc = poc; ++ ++ sh->short_term_ref_pic_set_sps_flag = get_bits1(gb); ++ pos = get_bits_left(gb); ++ if (!sh->short_term_ref_pic_set_sps_flag) { ++ ret = ff_hevc_rpi_decode_short_term_rps(gb, s->avctx, &sh->slice_rps, s->ps.sps, 1); ++ if (ret < 0) ++ return ret; ++ ++ sh->short_term_rps = &sh->slice_rps; ++ } else { ++ int numbits, rps_idx; ++ ++ if (!s->ps.sps->nb_st_rps) { ++ av_log(s->avctx, AV_LOG_ERROR, "No ref lists in the SPS.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ numbits = av_ceil_log2(s->ps.sps->nb_st_rps); ++ rps_idx = numbits > 0 ? get_bits(gb, numbits) : 0; ++ sh->short_term_rps = &s->ps.sps->st_rps[rps_idx]; ++ } ++ sh->short_term_ref_pic_set_size = pos - get_bits_left(gb); ++ ++ pos = get_bits_left(gb); ++ ret = decode_lt_rps(s, &sh->long_term_rps, gb); ++ if (ret < 0) { ++ av_log(s->avctx, AV_LOG_WARNING, "Invalid long term RPS.\n"); ++ if (s->avctx->err_recognition & AV_EF_EXPLODE) ++ return AVERROR_INVALIDDATA; ++ } ++ sh->long_term_ref_pic_set_size = pos - get_bits_left(gb); ++ ++ if (s->ps.sps->sps_temporal_mvp_enabled_flag) ++ sh->slice_temporal_mvp_enabled_flag = get_bits1(gb); ++ else ++ sh->slice_temporal_mvp_enabled_flag = 0; ++ } else { ++ s->sh.short_term_rps = NULL; ++ s->poc = 0; ++ } ++ ++ /* 8.3.1 */ ++ if (sh->first_slice_in_pic_flag && s->temporal_id == 0 && ++ s->nal_unit_type != HEVC_NAL_TRAIL_N && ++ s->nal_unit_type != HEVC_NAL_TSA_N && ++ s->nal_unit_type != HEVC_NAL_STSA_N && ++ s->nal_unit_type != HEVC_NAL_RADL_N && ++ s->nal_unit_type != HEVC_NAL_RADL_R && ++ s->nal_unit_type != HEVC_NAL_RASL_N && ++ s->nal_unit_type != HEVC_NAL_RASL_R) ++ s->pocTid0 = s->poc; ++ ++ if (s->ps.sps->sao_enabled) { ++ sh->slice_sample_adaptive_offset_flag[0] = get_bits1(gb); ++ if (ctx_cfmt(s) != 0) { ++ sh->slice_sample_adaptive_offset_flag[1] = ++ sh->slice_sample_adaptive_offset_flag[2] = get_bits1(gb); ++ } ++ } else { ++ sh->slice_sample_adaptive_offset_flag[0] = 0; ++ sh->slice_sample_adaptive_offset_flag[1] = 0; ++ sh->slice_sample_adaptive_offset_flag[2] = 0; ++ } ++ ++ sh->nb_refs[L0] = sh->nb_refs[L1] = 0; ++ if (sh->slice_type == HEVC_SLICE_P || sh->slice_type == HEVC_SLICE_B) { ++ int nb_refs; ++ ++ sh->nb_refs[L0] = s->ps.pps->num_ref_idx_l0_default_active; ++ if (sh->slice_type == HEVC_SLICE_B) ++ sh->nb_refs[L1] = s->ps.pps->num_ref_idx_l1_default_active; ++ ++ if (get_bits1(gb)) { // num_ref_idx_active_override_flag ++ sh->nb_refs[L0] = get_ue_golomb_long(gb) + 1; ++ if (sh->slice_type == HEVC_SLICE_B) ++ sh->nb_refs[L1] = get_ue_golomb_long(gb) + 1; ++ } ++ if (sh->nb_refs[L0] > HEVC_MAX_REFS || sh->nb_refs[L1] > HEVC_MAX_REFS) { ++ av_log(s->avctx, AV_LOG_ERROR, "Too many refs: %d/%d.\n", ++ sh->nb_refs[L0], sh->nb_refs[L1]); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ sh->rpl_modification_flag[0] = 0; ++ sh->rpl_modification_flag[1] = 0; ++ nb_refs = ff_hevc_rpi_frame_nb_refs(s); ++ if (!nb_refs) { ++ av_log(s->avctx, AV_LOG_ERROR, "Zero refs for a frame with P or B slices.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (s->ps.pps->lists_modification_present_flag && nb_refs > 1) { ++ sh->rpl_modification_flag[0] = get_bits1(gb); ++ if (sh->rpl_modification_flag[0]) { ++ for (i = 0; i < sh->nb_refs[L0]; i++) ++ sh->list_entry_lx[0][i] = get_bits(gb, av_ceil_log2(nb_refs)); ++ } ++ ++ if (sh->slice_type == HEVC_SLICE_B) { ++ sh->rpl_modification_flag[1] = get_bits1(gb); ++ if (sh->rpl_modification_flag[1] == 1) ++ for (i = 0; i < sh->nb_refs[L1]; i++) ++ sh->list_entry_lx[1][i] = get_bits(gb, av_ceil_log2(nb_refs)); ++ } ++ } ++ ++ if (sh->slice_type == HEVC_SLICE_B) ++ sh->mvd_l1_zero_flag = get_bits1(gb); ++ ++ if (s->ps.pps->cabac_init_present_flag) ++ sh->cabac_init_flag = get_bits1(gb); ++ else ++ sh->cabac_init_flag = 0; ++ ++ sh->collocated_ref_idx = 0; ++ if (sh->slice_temporal_mvp_enabled_flag) { ++ sh->collocated_list = L0; ++ if (sh->slice_type == HEVC_SLICE_B) ++ sh->collocated_list = !get_bits1(gb); ++ ++ if (sh->nb_refs[sh->collocated_list] > 1) { ++ sh->collocated_ref_idx = get_ue_golomb_long(gb); ++ if (sh->collocated_ref_idx >= sh->nb_refs[sh->collocated_list]) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Invalid collocated_ref_idx: %d.\n", ++ sh->collocated_ref_idx); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ } ++ ++ if ((s->ps.pps->weighted_pred_flag && sh->slice_type == HEVC_SLICE_P) || ++ (s->ps.pps->weighted_bipred_flag && sh->slice_type == HEVC_SLICE_B)) ++ { ++ if ((ret = pred_weight_table(s, gb)) != 0) ++ return ret; ++ } ++ else ++ { ++ // Give us unit weights ++ default_pred_weight_table(s); ++ } ++ ++ sh->max_num_merge_cand = 5 - get_ue_golomb_long(gb); ++ if (sh->max_num_merge_cand < 1 || sh->max_num_merge_cand > 5) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Invalid number of merging MVP candidates: %d.\n", ++ sh->max_num_merge_cand); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ sh->slice_qp_delta = get_se_golomb(gb); ++ ++ if (s->ps.pps->pic_slice_level_chroma_qp_offsets_present_flag) { ++ sh->slice_cb_qp_offset = get_se_golomb(gb); ++ sh->slice_cr_qp_offset = get_se_golomb(gb); ++ if (!qp_offset_valid(sh->slice_cb_qp_offset) || ++ !qp_offset_valid(s->ps.pps->cb_qp_offset + sh->slice_cb_qp_offset) || ++ !qp_offset_valid(sh->slice_cr_qp_offset) || ++ !qp_offset_valid(s->ps.pps->cr_qp_offset + sh->slice_cr_qp_offset)) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, "Bad chroma offset (pps:%d/%d; slice=%d/%d\n", ++ sh->slice_cr_qp_offset, sh->slice_cr_qp_offset, ++ s->ps.pps->cb_qp_offset, s->ps.pps->cr_qp_offset); ++ return AVERROR_INVALIDDATA; ++ } ++ } else ++ { ++ sh->slice_cb_qp_offset = 0; ++ sh->slice_cr_qp_offset = 0; ++ } ++ ++ if (s->ps.pps->chroma_qp_offset_list_enabled_flag) ++ sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); ++ else ++ sh->cu_chroma_qp_offset_enabled_flag = 0; ++ ++ if (s->ps.pps->deblocking_filter_control_present_flag) { ++ int deblocking_filter_override_flag = 0; ++ ++ if (s->ps.pps->deblocking_filter_override_enabled_flag) ++ deblocking_filter_override_flag = get_bits1(gb); ++ ++ if (deblocking_filter_override_flag) { ++ sh->disable_deblocking_filter_flag = get_bits1(gb); ++ if (!sh->disable_deblocking_filter_flag) { ++ int beta_offset_div2 = get_se_golomb(gb); ++ int tc_offset_div2 = get_se_golomb(gb) ; ++ if (beta_offset_div2 < -6 || beta_offset_div2 > 6 || ++ tc_offset_div2 < -6 || tc_offset_div2 > 6) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Invalid deblock filter offsets: %d, %d\n", ++ beta_offset_div2, tc_offset_div2); ++ return AVERROR_INVALIDDATA; ++ } ++ sh->beta_offset = beta_offset_div2 * 2; ++ sh->tc_offset = tc_offset_div2 * 2; ++ } ++ } else { ++ sh->disable_deblocking_filter_flag = s->ps.pps->disable_dbf; ++ sh->beta_offset = s->ps.pps->beta_offset; ++ sh->tc_offset = s->ps.pps->tc_offset; ++ } ++ } else { ++ sh->disable_deblocking_filter_flag = 0; ++ sh->beta_offset = 0; ++ sh->tc_offset = 0; ++ } ++ ++ if (s->ps.pps->seq_loop_filter_across_slices_enabled_flag && ++ (sh->slice_sample_adaptive_offset_flag[0] || ++ sh->slice_sample_adaptive_offset_flag[1] || ++ !sh->disable_deblocking_filter_flag)) { ++ sh->slice_loop_filter_across_slices_enabled_flag = get_bits1(gb); ++ } else { ++ sh->slice_loop_filter_across_slices_enabled_flag = s->ps.pps->seq_loop_filter_across_slices_enabled_flag; ++ } ++ sh->no_dblk_boundary_flags = ++ (sh->slice_loop_filter_across_slices_enabled_flag ? 0 : ++ BOUNDARY_UPPER_SLICE | BOUNDARY_LEFT_SLICE) | ++ (s->ps.pps->loop_filter_across_tiles_enabled_flag ? 0 : ++ BOUNDARY_UPPER_TILE | BOUNDARY_LEFT_TILE); ++ ++ ++ } else if (!s->slice_initialized) { ++ av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ sh->num_entry_point_offsets = 0; ++ sh->offload_wpp = 0; ++ sh->offload_tiles = 0; ++ ++ if (s->ps.pps->tiles_enabled_flag || s->ps.pps->entropy_coding_sync_enabled_flag) { ++ unsigned num_entry_point_offsets = get_ue_golomb_long(gb); ++ // It would be possible to bound this tighter but this here is simpler ++ if (num_entry_point_offsets > get_bits_left(gb)) { ++ av_log(s->avctx, AV_LOG_ERROR, "num_entry_point_offsets %d is invalid\n", num_entry_point_offsets); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ sh->num_entry_point_offsets = num_entry_point_offsets; ++ if (sh->num_entry_point_offsets > 0) { ++ int offset_len = get_ue_golomb_long(gb) + 1; ++ ++ if (offset_len < 1 || offset_len > 32) { ++ sh->num_entry_point_offsets = 0; ++ av_log(s->avctx, AV_LOG_ERROR, "offset_len %d is invalid\n", offset_len); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if ((ret = alloc_entry_points(sh, sh->num_entry_point_offsets)) < 0) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate memory\n"); ++ return ret; ++ } ++ ++ for (i = 0; i < sh->num_entry_point_offsets; i++) { ++ uint32_t val_minus1 = get_bits_long(gb, offset_len); ++ if (val_minus1 > (1 << 28)) ++ { ++ // We can declare offsets of > 2^28 bad without loss of generality ++ // Will check actual bounds wrt NAL later, but this keeps ++ // the values within bounds we can deal with easily ++ av_log(s->avctx, AV_LOG_ERROR, "entry_point_offset_minus1 %d invalid\n", val_minus1); ++ return AVERROR_INVALIDDATA; ++ } ++ sh->entry_point_offset[i] = val_minus1 + 1; // +1 to get the size ++ } ++ ++ // Do we want to offload this ++ if (s->threads_type != 0) ++ { ++ sh->offload_tiles = (!s->ps.pps->tile_wpp_inter_disable || sh->slice_type == HEVC_SLICE_I) && ++ s->ps.pps->num_tile_columns > 1; ++ // * We only cope with WPP in a single column ++ // Probably want to deal with that case as tiles rather than WPP anyway ++ // ?? Not actually sure that the main code deals with WPP + multi-col correctly ++ sh->offload_wpp = s->ps.pps->entropy_coding_sync_enabled_flag && ++ s->ps.pps->num_tile_columns == 1; ++ } ++ } ++ } ++ ++ if (s->ps.pps->slice_header_extension_present_flag) { ++ unsigned int length = get_ue_golomb_long(gb); ++ if (length*8LL > get_bits_left(gb)) { ++ av_log(s->avctx, AV_LOG_ERROR, "too many slice_header_extension_data_bytes\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ for (i = 0; i < length; i++) ++ skip_bits(gb, 8); // slice_header_extension_data_byte ++ } ++ ++ // Inferred parameters ++ sh->slice_qp = 26U + s->ps.pps->pic_init_qp_minus26 + sh->slice_qp_delta; ++ if (sh->slice_qp > 51 || ++ sh->slice_qp < -s->ps.sps->qp_bd_offset) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "The slice_qp %d is outside the valid range " ++ "[%d, 51].\n", ++ sh->slice_qp, ++ -s->ps.sps->qp_bd_offset); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (get_bits_left(gb) < 0) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Overread slice header by %d bits\n", -get_bits_left(gb)); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ s->slice_initialized = 1; ++ return 0; ++} ++ ++static void hls_sao_param(const HEVCRpiContext *s, HEVCRpiLocalContext * const lc, const int rx, const int ry) ++{ ++ RpiSAOParams * const sao = s->sao + rx + ry * s->ps.sps->ctb_width; ++ int c_idx, i; ++ ++ if (s->sh.slice_sample_adaptive_offset_flag[0] || ++ s->sh.slice_sample_adaptive_offset_flag[1]) { ++ if ((lc->ctb_avail & AVAIL_L) != 0) ++ { ++ const int sao_merge_left_flag = ff_hevc_rpi_sao_merge_flag_decode(lc); ++ if (sao_merge_left_flag) { ++ *sao = sao[-1]; ++ return; ++ } ++ } ++ if ((lc->ctb_avail & AVAIL_U) != 0) ++ { ++ const int sao_merge_up_flag = ff_hevc_rpi_sao_merge_flag_decode(lc); ++ if (sao_merge_up_flag) { ++ *sao = sao[-(int)s->ps.sps->ctb_width]; ++ return; ++ } ++ } ++ } ++ ++ for (c_idx = 0; c_idx < (ctx_cfmt(s) != 0 ? 3 : 1); c_idx++) { ++ const unsigned int log2_sao_offset_scale = c_idx == 0 ? s->ps.pps->log2_sao_offset_scale_luma : ++ s->ps.pps->log2_sao_offset_scale_chroma; ++ int offset_abs[4]; ++ char offset_sign[4] = {0}; ++ ++ if (!s->sh.slice_sample_adaptive_offset_flag[c_idx]) { ++ sao->type_idx[c_idx] = SAO_NOT_APPLIED; ++ continue; ++ } ++ ++ if (c_idx == 2) { ++ sao->type_idx[2] = sao->type_idx[1]; ++ sao->eo_class[2] = sao->eo_class[1]; ++ } else { ++ sao->type_idx[c_idx] = ff_hevc_rpi_sao_type_idx_decode(lc); ++ } ++ ++ // ** Could use BY22 here quite plausibly - this is all bypass stuff ++ // though only per CTB so not very timing critical ++ ++ if (sao->type_idx[c_idx] == SAO_NOT_APPLIED) ++ continue; ++ ++ for (i = 0; i < 4; i++) ++ offset_abs[i] = ff_hevc_rpi_sao_offset_abs_decode(s, lc); ++ ++ if (sao->type_idx[c_idx] == SAO_BAND) { ++ for (i = 0; i < 4; i++) { ++ if (offset_abs[i] != 0) ++ offset_sign[i] = ff_hevc_rpi_sao_offset_sign_decode(lc); ++ } ++ sao->band_position[c_idx] = ff_hevc_rpi_sao_band_position_decode(lc); ++ } else if (c_idx != 2) { ++ sao->eo_class[c_idx] = ff_hevc_rpi_sao_eo_class_decode(lc); ++ } ++ ++ // Inferred parameters ++ sao->offset_val[c_idx][0] = 0; ++ for (i = 0; i < 4; i++) { ++ sao->offset_val[c_idx][i + 1] = offset_abs[i] << log2_sao_offset_scale; ++ if (sao->type_idx[c_idx] == SAO_EDGE) { ++ if (i > 1) ++ sao->offset_val[c_idx][i + 1] = -sao->offset_val[c_idx][i + 1]; ++ } else if (offset_sign[i]) { ++ sao->offset_val[c_idx][i + 1] = -sao->offset_val[c_idx][i + 1]; ++ } ++ } ++ } ++} ++ ++#if 0 ++static int hls_cross_component_pred(HEVCRpiLocalContext * const lc, const int idx) { ++ int log2_res_scale_abs_plus1 = ff_hevc_rpi_log2_res_scale_abs(lc, idx); // 0..4 ++ ++ if (log2_res_scale_abs_plus1 != 0) { ++ int res_scale_sign_flag = ff_hevc_rpi_res_scale_sign_flag(lc, idx); ++ lc->tu.res_scale_val = (1 << (log2_res_scale_abs_plus1 - 1)) * ++ (1 - 2 * res_scale_sign_flag); ++ } else { ++ lc->tu.res_scale_val = 0; ++ } ++ ++ ++ return 0; ++} ++#endif ++ ++static inline HEVCPredCmd * rpi_new_intra_cmd(HEVCRpiJob * const jb) ++{ ++ return jb->intra.cmds + jb->intra.n++; ++} ++ ++#define A0(x, y, U, L, UL, UR, DL) \ ++ [(x)+(y)*16] = (((U) ? AVAIL_U : 0) | ((L) ? AVAIL_L : 0) | ((UL) ? AVAIL_UL : 0) | ((UR) ? AVAIL_UR : 0) | ((DL) ? AVAIL_DL : 0)) ++ ++#define A1(x, y, U, L, UL, UR, DL) \ ++ A0((x) + 0, (y) + 0, (U), (L), (UL), (U), (L) ), A0((x) + 1, (y) + 0, (U), 1, (U), (UR), 0 ),\ ++ A0((x) + 0, (y) + 1, 1, (L), (L), 1, (DL)), A0((x) + 1, (y) + 1, 1, 1, 1, 0, 0 ) ++ ++#define A2(x, y, U, L, UL, UR, DL) \ ++ A1((x) + 0, (y) + 0, (U), (L), (UL), (U), (L) ), A1((x) + 2, (y) + 0, (U), 1, (U), (UR), 0 ),\ ++ A1((x) + 0, (y) + 2, 1, (L), (L), 1, (DL)), A1((x) + 2, (y) + 2, 1, 1, 1, 0, 0 ) ++ ++#define A3(x, y, U, L, UL, UR, DL) \ ++ A2((x) + 0, (y) + 0, (U), (L), (UL), (U), (L) ), A2((x) + 4, (y) + 0, (U), 1, (U), (UR), 0 ),\ ++ A2((x) + 0, (y) + 4, 1, (L), (L), 1, (DL)), A2((x) + 4, (y) + 4, 1, 1, 1, 0, 0 ) ++ ++#define A4(x, y, U, L, UL, UR, DL) \ ++ A3((x) + 0, (y) + 0, (U), (L), (UL), (U), (L) ), A3((x) + 8, (y) + 0, (U), 1, (U), (UR), 0 ),\ ++ A3((x) + 0, (y) + 8, 1, (L), (L), 1, (DL)), A3((x) + 8, (y) + 8, 1, 1, 1, 0, 0 ) ++ ++static const uint8_t tb_flags[16 * 16] = {A4(0, 0, 0, 0, 0, 0, 0)}; ++ ++unsigned int ff_hevc_rpi_tb_avail_flags( ++ const HEVCRpiContext * const s, const HEVCRpiLocalContext * const lc, ++ const unsigned int x, const unsigned int y, const unsigned int w, const unsigned int h) ++{ ++ const unsigned int ctb_mask = ~0U << s->ps.sps->log2_ctb_size; ++ const unsigned int tb_x = x & ~ctb_mask; ++ const unsigned int tb_y = y & ~ctb_mask; ++ const unsigned int ctb_avail = lc->ctb_avail; ++ ++ const uint8_t * const tb_f = tb_flags + (tb_x >> 2) + (tb_y >> 2) * 16; ++ ++ unsigned int f = (ctb_avail | tb_f[0]) & (AVAIL_L | AVAIL_U | AVAIL_UL); ++ ++ // This deals with both the U & L edges ++ if ((tb_x | tb_y) != 0 && (~f & (AVAIL_L | AVAIL_U)) == 0) ++ f |= AVAIL_UL; ++ ++ if (x + w < lc->end_of_ctb_x) ++ f |= (tb_y == 0 ? ctb_avail >> (AVAIL_S_U - AVAIL_S_UR) : tb_f[(w - 1) >> 2]) & AVAIL_UR; ++ else if (tb_y == 0) ++ f |= (ctb_avail & AVAIL_UR); ++#if AVAIL_S_U - AVAIL_S_UR < 0 ++#error Shift problem ++#endif ++ ++ // Never any D if Y beyond eoctb ++ if (y + h < lc->end_of_ctb_y) ++ f |= (tb_x == 0 ? ctb_avail << (AVAIL_S_DL - AVAIL_S_L) : tb_f[((h - 1) >> 2) * 16]) & AVAIL_DL; ++#if AVAIL_S_DL - AVAIL_S_L < 0 ++#error Shift problem ++#endif ++ ++// printf("(%#x, %#x): %dx%d ca=%02x, ful=%02x, ftr=%02x, fdl=%02x, eox=%#x, eoy=%#x\n", x, y, w, h, ++// lc->ctb_avail, tb_f[0], tb_f[(w - 1) >> 2], tb_f[((h - 1) >> 2) * 16], ++// lc->end_of_ctb_x, lc->end_of_ctb_y); ++ ++ return f; ++} ++ ++#undef A0 ++#undef A1 ++#undef A2 ++#undef A3 ++#undef A4 ++ ++static void do_intra_pred(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, int log2_trafo_size, int x0, int y0, int c_idx, ++ unsigned int avail) ++{ ++ // If rpi_enabled then sand - U & V done on U call ++ if (c_idx <= 1) ++ { ++ HEVCPredCmd *const cmd = rpi_new_intra_cmd(lc->jb0); ++ cmd->type = RPI_PRED_INTRA + c_idx; ++ cmd->size = log2_trafo_size; ++ cmd->avail = avail; ++ cmd->i_pred.x = x0; ++ cmd->i_pred.y = y0; ++ cmd->i_pred.mode = c_idx ? lc->tu.intra_pred_mode_c : lc->tu.intra_pred_mode; ++ ++// printf("(%#x, %#x) c_idx=%d, s=%d, a=%#x\n", x0, y0, c_idx, 1 << log2_trafo_size, avail); ++ } ++} ++ ++#define CBF_CB0_S 0 ++#define CBF_CB1_S 1 // CB1 must be CB0 + 1 ++#define CBF_CR0_S 2 ++#define CBF_CR1_S 3 ++ ++#define CBF_CB0 (1 << CBF_CB0_S) ++#define CBF_CR0 (1 << CBF_CR0_S) ++#define CBF_CB1 (1 << CBF_CB1_S) ++#define CBF_CR1 (1 << CBF_CR1_S) ++ ++// * Only good for chroma_idx == 1 ++static int hls_transform_unit(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int log2_cb_size, const unsigned int log2_trafo_size, ++ const unsigned int blk_idx, const int cbf_luma, ++ const unsigned int cbf_chroma) ++{ ++ const unsigned int log2_trafo_size_c = FFMAX(2, log2_trafo_size - 1); ++ const unsigned int x0_c = x0 & ~7; ++ const unsigned int y0_c = y0 & ~7; ++ ++ enum ScanType scan_idx = SCAN_DIAG; ++ enum ScanType scan_idx_c = SCAN_DIAG; ++ ++ if (lc->cu.pred_mode == MODE_INTRA) ++ { ++ const unsigned int trafo_size = 1 << log2_trafo_size; ++ const unsigned int avail = ff_hevc_rpi_tb_avail_flags(s, lc, x0, y0, trafo_size, trafo_size); ++ ++ do_intra_pred(s, lc, log2_trafo_size, x0, y0, 0, avail); ++ ++ if (log2_trafo_size > 2) ++ do_intra_pred(s, lc, log2_trafo_size_c, x0_c, y0_c, 1, avail); ++ else if (blk_idx == 3) ++ do_intra_pred(s, lc, log2_trafo_size_c, x0_c, y0_c, 1, ++ ff_hevc_rpi_tb_avail_flags(s, lc, x0_c, y0_c, 8, 8)); ++ ++ if (log2_trafo_size < 4) { ++ if (lc->tu.intra_pred_mode >= 6 && ++ lc->tu.intra_pred_mode <= 14) { ++ scan_idx = SCAN_VERT; ++ } else if (lc->tu.intra_pred_mode >= 22 && ++ lc->tu.intra_pred_mode <= 30) { ++ scan_idx = SCAN_HORIZ; ++ } ++ ++ if (lc->tu.intra_pred_mode_c >= 6 && ++ lc->tu.intra_pred_mode_c <= 14) { ++ scan_idx_c = SCAN_VERT; ++ } else if (lc->tu.intra_pred_mode_c >= 22 && ++ lc->tu.intra_pred_mode_c <= 30) { ++ scan_idx_c = SCAN_HORIZ; ++ } ++ } ++ } ++ ++ if (!cbf_luma && cbf_chroma == 0) ++ return 0; ++ ++ if (lc->tu.is_cu_qp_delta_wanted) ++ { ++ const int qp_delta = ff_hevc_rpi_cu_qp_delta(lc); ++ const unsigned int cb_mask = ~0U << log2_cb_size; ++ ++ if (qp_delta < -(26 + (s->ps.sps->qp_bd_offset >> 1)) || ++ qp_delta > (25 + (s->ps.sps->qp_bd_offset >> 1))) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "The cu_qp_delta %d is outside the valid range " ++ "[%d, %d].\n", ++ qp_delta, ++ -(26 + (s->ps.sps->qp_bd_offset >> 1)), ++ (25 + (s->ps.sps->qp_bd_offset >> 1))); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ lc->tu.is_cu_qp_delta_wanted = 0; ++ lc->tu.cu_qp_delta = qp_delta; ++ ff_hevc_rpi_set_qPy(s, lc, x0 & cb_mask, y0 & cb_mask); ++ } ++ ++ // * Not main profile & untested due to no conform streams ++ if (lc->tu.cu_chroma_qp_offset_wanted && cbf_chroma && ++ !lc->cu.cu_transquant_bypass_flag) { ++ int cu_chroma_qp_offset_flag = ff_hevc_rpi_cu_chroma_qp_offset_flag(lc); ++ if (cu_chroma_qp_offset_flag) { ++ int cu_chroma_qp_offset_idx = 0; ++ if (s->ps.pps->chroma_qp_offset_list_len_minus1 > 0) { ++ cu_chroma_qp_offset_idx = ff_hevc_rpi_cu_chroma_qp_offset_idx(s, lc); ++ } ++ lc->tu.qp_divmod6[1] += s->ps.pps->cb_qp_offset_list[cu_chroma_qp_offset_idx]; ++ lc->tu.qp_divmod6[2] += s->ps.pps->cr_qp_offset_list[cu_chroma_qp_offset_idx]; ++ } ++ lc->tu.cu_chroma_qp_offset_wanted = 0; ++ } ++ ++ if (cbf_luma) ++ ff_hevc_rpi_hls_residual_coding(s, lc, x0, y0, log2_trafo_size, scan_idx, 0); ++ ++ if (log2_trafo_size > 2 || blk_idx == 3) ++ { ++ if ((cbf_chroma & CBF_CB0) != 0) ++ ff_hevc_rpi_hls_residual_coding(s, lc, x0_c, y0_c, ++ log2_trafo_size_c, scan_idx_c, 1); ++ if ((cbf_chroma & CBF_CR0) != 0) ++ ff_hevc_rpi_hls_residual_coding(s, lc, x0_c, y0_c, ++ log2_trafo_size_c, scan_idx_c, 2); ++ } ++ ++ return 0; ++} ++ ++static inline void set_deblocking_bypass(const HEVCRpiContext * const s, const int x0, const int y0, const int log2_cb_size) ++{ ++ set_bits(s->is_pcm + (y0 >> 3) * s->ps.sps->pcm_width, x0 >> 3, s->ps.sps->pcm_width, log2_cb_size - 3); ++} ++ ++ ++static int hls_transform_tree(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int log2_trafo_size, ++ const unsigned int trafo_depth, const unsigned int blk_idx, ++ const unsigned int cbf_c0) ++{ ++ // When trafo_size == 2 hls_transform_unit uses c0 so put in c1 ++ unsigned int cbf_c1 = cbf_c0; ++ int split_transform_flag; ++ int ret; ++ ++ if (lc->cu.intra_split_flag) { ++ if (trafo_depth == 1) { ++ lc->tu.intra_pred_mode = lc->pu.intra_pred_mode[blk_idx]; ++ if (ctx_cfmt(s) == 3) { ++ lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[blk_idx]; ++ lc->tu.chroma_mode_c = lc->pu.chroma_mode_c[blk_idx]; ++ } else { ++ lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[0]; ++ lc->tu.chroma_mode_c = lc->pu.chroma_mode_c[0]; ++ } ++ } ++ } else { ++ lc->tu.intra_pred_mode = lc->pu.intra_pred_mode[0]; ++ lc->tu.intra_pred_mode_c = lc->pu.intra_pred_mode_c[0]; ++ lc->tu.chroma_mode_c = lc->pu.chroma_mode_c[0]; ++ } ++ ++ if (log2_trafo_size <= s->ps.sps->log2_max_trafo_size && ++ log2_trafo_size > s->ps.sps->log2_min_tb_size && ++ trafo_depth < lc->cu.max_trafo_depth && ++ !(lc->cu.intra_split_flag && trafo_depth == 0)) ++ { ++ split_transform_flag = ff_hevc_rpi_split_transform_flag_decode(lc, log2_trafo_size); ++ } else { ++ int inter_split = s->ps.sps->max_transform_hierarchy_depth_inter == 0 && ++ lc->cu.pred_mode == MODE_INTER && ++ lc->cu.part_mode != PART_2Nx2N && ++ trafo_depth == 0; ++ ++ split_transform_flag = log2_trafo_size > s->ps.sps->log2_max_trafo_size || ++ (lc->cu.intra_split_flag && trafo_depth == 0) || ++ inter_split; ++ } ++ ++ if (log2_trafo_size > 2 || ctx_cfmt(s) == 3) ++ { ++ const int wants_c1 = ctx_cfmt(s) == 2 && (!split_transform_flag || log2_trafo_size == 3); ++ cbf_c1 = 0; ++ ++ if ((cbf_c0 & CBF_CB0) != 0) ++ { ++ cbf_c1 = ff_hevc_rpi_cbf_cb_cr_decode(lc, trafo_depth) << CBF_CB0_S; ++ if (wants_c1) ++ cbf_c1 |= ff_hevc_rpi_cbf_cb_cr_decode(lc, trafo_depth) << CBF_CB1_S; ++ } ++ ++ if ((cbf_c0 & CBF_CR0) != 0) ++ { ++ cbf_c1 |= ff_hevc_rpi_cbf_cb_cr_decode(lc, trafo_depth) << CBF_CR0_S; ++ if (wants_c1) ++ cbf_c1 |= ff_hevc_rpi_cbf_cb_cr_decode(lc, trafo_depth) << CBF_CR1_S; ++ } ++ } ++ ++ if (split_transform_flag) { ++ const int trafo_size_split = 1 << (log2_trafo_size - 1); ++ const int x1 = x0 + trafo_size_split; ++ const int y1 = y0 + trafo_size_split; ++ ++#define SUBDIVIDE(x, y, idx) \ ++do { \ ++ ret = hls_transform_tree(s, lc, x, y, \ ++ log2_trafo_size - 1, trafo_depth + 1, idx, \ ++ cbf_c1); \ ++ if (ret < 0) \ ++ return ret; \ ++} while (0) ++ ++ SUBDIVIDE(x0, y0, 0); ++ SUBDIVIDE(x1, y0, 1); ++ SUBDIVIDE(x0, y1, 2); ++ SUBDIVIDE(x1, y1, 3); ++ ++#undef SUBDIVIDE ++ } else { ++ // If trafo_size == 2 then we should have cbf_c == 0 here but as we can't have ++ // trafo_size == 2 with depth == 0 the issue is moot ++ const int cbf_luma = ((lc->cu.pred_mode != MODE_INTRA && trafo_depth == 0 && cbf_c1 == 0) || ++ ff_hevc_rpi_cbf_luma_decode(lc, trafo_depth)); ++ ++ ret = hls_transform_unit(s, lc, x0, y0, ++ log2_trafo_size + trafo_depth, log2_trafo_size, ++ blk_idx, cbf_luma, cbf_c1); ++ if (ret < 0) ++ return ret; ++ ++ if (!s->sh.disable_deblocking_filter_flag) { ++ ff_hevc_rpi_deblocking_boundary_strengths(s, lc, x0, y0, log2_trafo_size, cbf_luma); ++ } ++ } ++ return 0; ++} ++ ++ ++static int pcm_extract(const HEVCRpiContext * const s, const uint8_t * pcm, const int length, const int x0, const int y0, const int cb_size) ++{ ++ GetBitContext gb; ++ int ret; ++ ++ ret = init_get_bits(&gb, pcm, length); ++ if (ret < 0) ++ return ret; ++ ++ s->hevcdsp.put_pcm(av_rpi_sand_frame_pos_y(s->frame, x0, y0), ++ frame_stride1(s->frame, 0), ++ cb_size, cb_size, &gb, s->ps.sps->pcm.bit_depth); ++ ++ s->hevcdsp.put_pcm_c(av_rpi_sand_frame_pos_c(s->frame, x0 >> ctx_hshift(s, 1), y0 >> ctx_vshift(s, 1)), ++ s->frame->linesize[1], ++ cb_size >> ctx_hshift(s, 1), ++ cb_size >> ctx_vshift(s, 1), ++ &gb, s->ps.sps->pcm.bit_depth_chroma); ++ ++ return 0; ++} ++ ++ ++// x * 2^(y*2) ++static inline unsigned int xyexp2(const unsigned int x, const unsigned int y) ++{ ++ return x << (y * 2); ++} ++ ++static int hls_pcm_sample(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const int x0, const int y0, unsigned int log2_cb_size) ++{ ++ // Length in bits ++ const unsigned int length = xyexp2(s->ps.sps->pcm.bit_depth, log2_cb_size) + ++ xyexp2(s->ps.sps->pcm.bit_depth_chroma, log2_cb_size - ctx_vshift(s, 1)) + ++ xyexp2(s->ps.sps->pcm.bit_depth_chroma, log2_cb_size - ctx_vshift(s, 2)); ++ ++ const uint8_t * const pcm = ff_hevc_rpi_cabac_skip_bytes(&lc->cc, (length + 7) >> 3); ++ ++ if (!s->sh.disable_deblocking_filter_flag) ++ ff_hevc_rpi_deblocking_boundary_strengths(s, lc, x0, y0, log2_cb_size, 0); ++ ++ // Copy coeffs ++ { ++ const int blen = (length + 7) >> 3; ++ // Round allocated bytes up to nearest 32 to avoid alignment confusion ++ // Allocation is in int16_t s ++ // As we are only using 1 byte per sample and the coeff buffer allows 2 per ++ // sample this rounding doesn't affect the total size we need to allocate for ++ // the coeff buffer ++ int16_t * const coeffs = rpi_alloc_coeff_buf(lc->jb0, 0, ((blen + 31) & ~31) >> 1); ++ memcpy(coeffs, pcm, blen); ++ ++ // Our coeff stash assumes that any partially allocated 64byte lump ++ // is zeroed so make that true. ++ { ++ uint8_t * const eopcm = (uint8_t *)coeffs + blen; ++ if ((-(intptr_t)eopcm & 63) != 0) ++ memset(eopcm, 0, -(intptr_t)eopcm & 63); ++ } ++ ++ // Add command ++ { ++ HEVCPredCmd *const cmd = rpi_new_intra_cmd(lc->jb0); ++ cmd->type = RPI_PRED_I_PCM; ++ cmd->size = log2_cb_size; ++ cmd->i_pcm.src = coeffs; ++ cmd->i_pcm.x = x0; ++ cmd->i_pcm.y = y0; ++ cmd->i_pcm.src_len = length; ++ } ++ return 0; ++ } ++} ++ ++ ++static void hevc_await_progress(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const HEVCRpiFrame * const ref, ++ const MvXY xy, const int y0, const int height) ++{ ++ if (s->threads_type != 0) { ++ const int y = FFMAX(0, (MV_Y(xy) >> 2) + y0 + height + 9); ++ ++ // Progress has to be attached to current job as the actual wait ++ // is in worker_core which can't use lc ++ int16_t *const pr = lc->jb0->progress_req + ref->dpb_no; ++ if (*pr < y) { ++ *pr = y; ++ } ++ } ++} ++ ++static void hevc_luma_mv_mvp_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const int x0, const int y0, const int nPbW, ++ const int nPbH, ++ HEVCRpiMvField * const mv) ++{ ++ enum InterPredIdc inter_pred_idc = PRED_L0; ++ int mvp_flag; ++ const unsigned int avail = ff_hevc_rpi_tb_avail_flags(s, lc, x0, y0, nPbW, nPbH); ++ ++ mv->pred_flag = 0; ++ if (s->sh.slice_type == HEVC_SLICE_B) ++ inter_pred_idc = ff_hevc_rpi_inter_pred_idc_decode(lc, nPbW, nPbH); ++ ++ if (inter_pred_idc != PRED_L1) { ++ MvXY mvd; ++ ++ if (s->sh.nb_refs[L0]) ++ mv->ref_idx[0]= ff_hevc_rpi_ref_idx_lx_decode(lc, s->sh.nb_refs[L0]); ++ ++ mv->pred_flag = PF_L0; ++ mvd = ff_hevc_rpi_hls_mvd_coding(lc); ++ mvp_flag = ff_hevc_rpi_mvp_lx_flag_decode(lc); ++ ff_hevc_rpi_luma_mv_mvp_mode(s, lc, x0, y0, nPbW, nPbH, avail, ++ mv, mvp_flag, 0); ++ mv->xy[0] = mvxy_add(mv->xy[0], mvd); ++ } ++ ++ if (inter_pred_idc != PRED_L0) { ++ MvXY mvd = 0; ++ ++ if (s->sh.nb_refs[L1]) ++ mv->ref_idx[1] = ff_hevc_rpi_ref_idx_lx_decode(lc, s->sh.nb_refs[L1]); ++ ++ if (s->sh.mvd_l1_zero_flag != 1 || inter_pred_idc != PRED_BI) ++ mvd = ff_hevc_rpi_hls_mvd_coding(lc); ++ ++ mv->pred_flag += PF_L1; ++ mvp_flag = ff_hevc_rpi_mvp_lx_flag_decode(lc); ++ ff_hevc_rpi_luma_mv_mvp_mode(s, lc, x0, y0, nPbW, nPbH, avail, ++ mv, mvp_flag, 1); ++ mv->xy[1] = mvxy_add(mv->xy[1], mvd); ++ } ++} ++ ++ ++static HEVCRpiInterPredQ * ++rpi_nxt_pred(HEVCRpiInterPredEnv * const ipe, const unsigned int load_val, const uint32_t fn) ++{ ++ HEVCRpiInterPredQ * yp = NULL; ++ HEVCRpiInterPredQ * ypt = ipe->q + ipe->curr; ++ const unsigned int max_fill = ipe->max_fill; ++ unsigned int load = UINT_MAX; ++ ++ for (unsigned int i = 0; i != ipe->n_grp; ++i, ++ypt) { ++ // We will always have enough room between the Qs but if we are ++ // running critically low due to poor scheduling then use fill size ++ // rather than load to determine QPU. This has obvious dire ++ // performance implications but (a) it is better than crashing ++ // and (b) it should (almost) never happen ++ const unsigned int tfill = (char *)ypt->qpu_mc_curr - (char *)ypt->qpu_mc_base; ++ const unsigned int tload = tfill > max_fill ? tfill + 0x1000000 : ypt->load; ++ ++ if (tload < load) ++ { ++ yp = ypt; ++ load = tload; ++ } ++ } ++ ++ yp->load += load_val; ++ ipe->used_grp = 1; ++ qpu_mc_link_set(yp->qpu_mc_curr, fn); ++ ++ return yp; ++} ++ ++ ++static void rpi_inter_pred_sync(HEVCRpiInterPredEnv * const ipe) ++{ ++ for (unsigned int i = 0; i != ipe->n; ++i) { ++ HEVCRpiInterPredQ * const q = ipe->q + i; ++ const unsigned int qfill = (char *)q->qpu_mc_curr - (char *)q->qpu_mc_base; ++ ++ qpu_mc_link_set(q->qpu_mc_curr, q->code_sync); ++ q->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(&q->qpu_mc_curr->sync + 1); ++ q->load = (qfill >> 7); // Have a mild preference for emptier Qs to balance memory usage ++ } ++} ++ ++// Returns 0 on success ++// We no longer check for Q fullness as wew have emergncy code in ctu alloc ++// * However it might be an idea to have some means of spotting that we've used it ++static int rpi_inter_pred_next_ctu(HEVCRpiInterPredEnv * const ipe) ++{ ++ if (!ipe->used_grp) ++ return 0; ++ ++ if ((ipe->curr += ipe->n_grp) >= ipe->n) ++ { ++ ipe->curr = 0; ++ rpi_inter_pred_sync(ipe); ++ } ++ ipe->used = 1; ++ ipe->used_grp = 0; ++ ++ return 0; ++} ++ ++static void rpi_inter_pred_reset(HEVCRpiInterPredEnv * const ipe) ++{ ++ unsigned int i; ++ ++ ipe->curr = 0; ++ ipe->used = 0; ++ ipe->used_grp = 0; ++ for (i = 0; i != ipe->n; ++i) { ++ HEVCRpiInterPredQ * const q = ipe->q + i; ++ q->qpu_mc_curr = q->qpu_mc_base; ++ q->load = 0; ++ q->last_l0 = NULL; ++ q->last_l1 = NULL; ++ } ++} ++ ++static int rpi_inter_pred_alloc(HEVCRpiInterPredEnv * const ipe, ++ const unsigned int n_max, const unsigned int n_grp, ++ const unsigned int total_size, const unsigned int min_gap) ++{ ++ int rv; ++ ++ memset(ipe, 0, sizeof(*ipe)); ++ if ((ipe->q = av_mallocz(n_max * sizeof(*ipe->q))) == NULL) ++ return AVERROR(ENOMEM); ++ ++ ipe->n_grp = n_grp; ++ ipe->min_gap = min_gap; ++ ++ if ((rv = gpu_malloc_cached(total_size, &ipe->gptr)) != 0) ++ av_freep(&ipe->q); ++ return rv; ++} ++ ++ ++#if RPI_QPU_EMU_Y ++#define get_mc_address_y(f) ((f)->data[0]) ++#else ++#define get_mc_address_y(f) get_vc_address_y(f) ++#endif ++#if RPI_QPU_EMU_C ++#define get_mc_address_u(f) ((f)->data[1]) ++#else ++#define get_mc_address_u(f) get_vc_address_u(f) ++#endif ++ ++static inline uint32_t pack_wo_p(const int off, const int mul) ++{ ++ return PACK2(off * 2 + 1, mul); ++} ++ ++static inline uint32_t pack_wo_b(const int off0, const int off1, const int mul) ++{ ++ return PACK2(off0 + off1 + 1, mul); ++} ++ ++ ++static void ++rpi_pred_y(const HEVCRpiContext *const s, HEVCRpiJob * const jb, ++ const int x0, const int y0, ++ const int nPbW, const int nPbH, ++ const MvXY mv_xy, ++ const int weight_mul, ++ const int weight_offset, ++ AVFrame *const src_frame) ++{ ++ const unsigned int y_off = av_rpi_sand_frame_off_y(s->frame, x0, y0); ++ const unsigned int mx = MV_X(mv_xy) & 3; ++ const unsigned int my = MV_Y(mv_xy) & 3; ++ const unsigned int my_mx = (my << 8) | mx; ++ const uint32_t my2_mx2_my_mx = (my_mx << 16) | my_mx; ++ const qpu_mc_src_addr_t src_vc_address_y = get_mc_address_y(src_frame); ++ qpu_mc_dst_addr_t dst_addr = get_mc_address_y(s->frame) + y_off; ++ const uint32_t wo = pack_wo_p(weight_offset, weight_mul); ++ HEVCRpiInterPredEnv * const ipe = &jb->luma_ip; ++ const unsigned int xshl = av_rpi_sand_frame_xshl(s->frame); ++ ++ if (my_mx == 0) ++ { ++ const int x1 = x0 + (MV_X(mv_xy) >> 2); ++ const int y1 = y0 + (MV_Y(mv_xy) >> 2); ++ const int bh = nPbH; ++ ++ for (int start_x = 0; start_x < nPbW; start_x += 16) ++ { ++ const int bw = FFMIN(nPbW - start_x, 16); ++ HEVCRpiInterPredQ *const yp = rpi_nxt_pred(ipe, bh, s->qpu.y_p00); ++ qpu_mc_src_t *const src1 = yp->last_l0; ++ qpu_mc_pred_y_p00_t *const cmd_y = &yp->qpu_mc_curr->y.p00; ++ ++#if RPI_TSTATS ++ { ++ HEVCRpiStats *const ts = (HEVCRpiStats *)&s->tstats; ++ ++ts->y_pred1_x0y0; ++ ++ if (nPbW > 8) ++ ++ts->y_pred1_wgt8; ++ else ++ ++ts->y_pred1_wle8; ++ ++ if (nPbH > 16) ++ ++ts->y_pred1_hgt16; ++ else ++ ++ts->y_pred1_hle16; ++ } ++#endif ++ ++ src1->x = x1 + start_x; ++ src1->y = y1; ++ src1->base = src_vc_address_y; ++ cmd_y->w = bw; ++ cmd_y->h = bh; ++ cmd_y->wo1 = wo; ++ cmd_y->dst_addr = dst_addr + (start_x << xshl); ++ yp->last_l0 = &cmd_y->next_src1; ++ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_y + 1); ++ } ++ } ++ else ++ { ++ const int x1_m3 = x0 + (MV_X(mv_xy) >> 2) - 3; ++ const int y1_m3 = y0 + (MV_Y(mv_xy) >> 2) - 3; ++ const unsigned int bh = nPbH; ++ int start_x = 0; ++ ++#if 1 ++ // As Y-pred operates on two independant 8-wide src blocks we can merge ++ // this pred with the previous one if it the previous one is 8 pel wide, ++ // the same height as the current block, immediately to the left of our ++ // current dest block and mono-pred. ++ ++ qpu_mc_pred_y_p_t *const last_y8_p = jb->last_y8_p; ++ if (last_y8_p != NULL && last_y8_p->h == bh && last_y8_p->dst_addr + (8 << xshl) == dst_addr) ++ { ++ const int bw = FFMIN(nPbW, 8); ++ qpu_mc_src_t *const last_y8_src2 = jb->last_y8_l1; ++ ++ last_y8_src2->x = x1_m3; ++ last_y8_src2->y = y1_m3; ++ last_y8_src2->base = src_vc_address_y; ++ last_y8_p->w += bw; ++ last_y8_p->mymx21 = PACK2(my2_mx2_my_mx, last_y8_p->mymx21); ++ last_y8_p->wo2 = wo; ++ ++ jb->last_y8_p = NULL; ++ jb->last_y8_l1 = NULL; ++ start_x = bw; ++#if RPI_TSTATS ++ ++((HEVCRpiStats *)&s->tstats)->y_pred1_y8_merge; ++#endif ++ } ++#endif ++ ++ for (; start_x < nPbW; start_x += 16) ++ { ++ const int bw = FFMIN(nPbW - start_x, 16); ++ HEVCRpiInterPredQ *const yp = rpi_nxt_pred(ipe, bh + 7, s->qpu.y_pxx); ++ qpu_mc_src_t *const src1 = yp->last_l0; ++ qpu_mc_src_t *const src2 = yp->last_l1; ++ qpu_mc_pred_y_p_t *const cmd_y = &yp->qpu_mc_curr->y.p; ++#if RPI_TSTATS ++ { ++ HEVCRpiStats *const ts = (HEVCRpiStats *)&s->tstats; ++ if (mx == 0 && my == 0) ++ ++ts->y_pred1_x0y0; ++ else if (mx == 0) ++ ++ts->y_pred1_x0; ++ else if (my == 0) ++ ++ts->y_pred1_y0; ++ else ++ ++ts->y_pred1_xy; ++ ++ if (nPbW > 8) ++ ++ts->y_pred1_wgt8; ++ else ++ ++ts->y_pred1_wle8; ++ ++ if (nPbH > 16) ++ ++ts->y_pred1_hgt16; ++ else ++ ++ts->y_pred1_hle16; ++ } ++#endif ++ src1->x = x1_m3 + start_x; ++ src1->y = y1_m3; ++ src1->base = src_vc_address_y; ++ if (bw <= 8) ++ { ++ src2->x = MC_DUMMY_X; ++ src2->y = MC_DUMMY_Y; ++#if RPI_QPU_EMU_Y ++ src2->base = s->qpu_dummy_frame_emu; ++#else ++ src2->base = s->qpu_dummy_frame_qpu; ++#endif ++ } ++ else ++ { ++ src2->x = x1_m3 + start_x + 8; ++ src2->y = y1_m3; ++ src2->base = src_vc_address_y; ++ } ++ cmd_y->w = bw; ++ cmd_y->h = bh; ++ cmd_y->mymx21 = my2_mx2_my_mx; ++ cmd_y->wo1 = wo; ++ cmd_y->wo2 = wo; ++ cmd_y->dst_addr = dst_addr + (start_x << xshl); ++ yp->last_l0 = &cmd_y->next_src1; ++ yp->last_l1 = &cmd_y->next_src2; ++ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_y + 1); ++ ++ if (bw == 8) { ++ jb->last_y8_l1 = src2; ++ jb->last_y8_p = cmd_y; ++ } ++ } ++ } ++} ++ ++static void ++rpi_pred_y_b(const HEVCRpiContext * const s, HEVCRpiJob * const jb, ++ const int x0, const int y0, ++ const int nPbW, const int nPbH, ++ const struct HEVCRpiMvField *const mv_field, ++ const AVFrame *const src_frame, ++ const AVFrame *const src_frame2) ++{ ++ const unsigned int y_off = av_rpi_sand_frame_off_y(s->frame, x0, y0); ++ const MvXY mv = mv_field->xy[0]; ++ const MvXY mv2 = mv_field->xy[1]; ++ ++ const unsigned int mx = MV_X(mv) & 3; ++ const unsigned int my = MV_Y(mv) & 3; ++ const unsigned int my_mx = (my<<8) | mx; ++ const unsigned int mx2 = MV_X(mv2) & 3; ++ const unsigned int my2 = MV_Y(mv2) & 3; ++ const unsigned int my2_mx2 = (my2<<8) | mx2; ++ const uint32_t my2_mx2_my_mx = (my2_mx2 << 16) | my_mx; ++ const unsigned int ref_idx0 = mv_field->ref_idx[0]; ++ const unsigned int ref_idx1 = mv_field->ref_idx[1]; ++ const uint32_t wo1 = pack_wo_b(s->sh.luma_offset_l0[ref_idx0], s->sh.luma_offset_l1[ref_idx1], s->sh.luma_weight_l0[ref_idx0]); ++ const uint32_t wo2 = pack_wo_b(s->sh.luma_offset_l0[ref_idx0], s->sh.luma_offset_l1[ref_idx1], s->sh.luma_weight_l1[ref_idx1]); ++ ++ const unsigned int xshl = av_rpi_sand_frame_xshl(s->frame); ++ qpu_mc_dst_addr_t dst = get_mc_address_y(s->frame) + y_off; ++ const qpu_mc_src_addr_t src1_base = get_mc_address_y(src_frame); ++ const qpu_mc_src_addr_t src2_base = get_mc_address_y(src_frame2); ++ HEVCRpiInterPredEnv * const ipe = &jb->luma_ip; ++ ++ if (my2_mx2_my_mx == 0) ++ { ++ const int x1 = x0 + (MV_X(mv) >> 2); ++ const int y1 = y0 + (MV_Y(mv) >> 2); ++ const int x2 = x0 + (MV_X(mv2) >> 2); ++ const int y2 = y0 + (MV_Y(mv2) >> 2); ++ const int bh = nPbH; ++ ++ // Can do chunks a full 16 wide if we don't want the H filter ++ for (int start_x=0; start_x < nPbW; start_x += 16) ++ { ++ HEVCRpiInterPredQ *const yp = rpi_nxt_pred(ipe, bh, s->qpu.y_b00); ++ qpu_mc_src_t *const src1 = yp->last_l0; ++ qpu_mc_src_t *const src2 = yp->last_l1; ++ qpu_mc_pred_y_p_t *const cmd_y = &yp->qpu_mc_curr->y.p; ++#if RPI_TSTATS ++ { ++ HEVCRpiStats *const ts = (HEVCRpiStats *)&s->tstats; ++ ++ts->y_pred2_x0y0; ++ ++ if (nPbH > 16) ++ ++ts->y_pred2_hgt16; ++ else ++ ++ts->y_pred2_hle16; ++ } ++#endif ++ src1->x = x1 + start_x; ++ src1->y = y1; ++ src1->base = src1_base; ++ src2->x = x2 + start_x; ++ src2->y = y2; ++ src2->base = src2_base; ++ cmd_y->w = FFMIN(nPbW - start_x, 16); ++ cmd_y->h = bh; ++ cmd_y->mymx21 = 0; ++ cmd_y->wo1 = wo1; ++ cmd_y->wo2 = wo2; ++ cmd_y->dst_addr = dst + (start_x << xshl); ++ yp->last_l0 = &cmd_y->next_src1; ++ yp->last_l1 = &cmd_y->next_src2; ++ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_y + 1); ++ } ++ } ++ else ++ { ++ // Filter requires a run-up of 3 ++ const int x1 = x0 + (MV_X(mv) >> 2) - 3; ++ const int y1 = y0 + (MV_Y(mv) >> 2) - 3; ++ const int x2 = x0 + (MV_X(mv2) >> 2) - 3; ++ const int y2 = y0 + (MV_Y(mv2) >> 2) - 3; ++ const int bh = nPbH; ++ ++ for (int start_x=0; start_x < nPbW; start_x += 8) ++ { // B blocks work 8 at a time ++ // B weights aren't doubled as the QPU code does the same ++ // amount of work as it does for P ++ HEVCRpiInterPredQ *const yp = rpi_nxt_pred(ipe, bh + 7, s->qpu.y_bxx); ++ qpu_mc_src_t *const src1 = yp->last_l0; ++ qpu_mc_src_t *const src2 = yp->last_l1; ++ qpu_mc_pred_y_p_t *const cmd_y = &yp->qpu_mc_curr->y.p; ++#if RPI_TSTATS ++ { ++ HEVCRpiStats *const ts = (HEVCRpiStats *)&s->tstats; ++ const unsigned int mmx = mx | mx2; ++ const unsigned int mmy = my | my2; ++ if (mmx == 0 && mmy == 0) ++ ++ts->y_pred2_x0y0; ++ else if (mmx == 0) ++ ++ts->y_pred2_x0; ++ else if (mmy == 0) ++ ++ts->y_pred2_y0; ++ else ++ ++ts->y_pred2_xy; ++ ++ if (nPbH > 16) ++ ++ts->y_pred2_hgt16; ++ else ++ ++ts->y_pred2_hle16; ++ } ++#endif ++ src1->x = x1 + start_x; ++ src1->y = y1; ++ src1->base = src1_base; ++ src2->x = x2 + start_x; ++ src2->y = y2; ++ src2->base = src2_base; ++ cmd_y->w = FFMIN(nPbW - start_x, 8); ++ cmd_y->h = bh; ++ cmd_y->mymx21 = my2_mx2_my_mx; ++ cmd_y->wo1 = wo1; ++ cmd_y->wo2 = wo2; ++ cmd_y->dst_addr = dst + (start_x << xshl); ++ yp->last_l0 = &cmd_y->next_src1; ++ yp->last_l1 = &cmd_y->next_src2; ++ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_y + 1); ++ } ++ } ++} ++ ++// h/v shifts fixed at one as that is all the qasm copes with ++static void ++rpi_pred_c(const HEVCRpiContext * const s, HEVCRpiJob * const jb, ++ const unsigned int lx, const int x0_c, const int y0_c, ++ const int nPbW_c, const int nPbH_c, ++ const MvXY mv, ++ const int16_t * const c_weights, ++ const int16_t * const c_offsets, ++ AVFrame * const src_frame) ++{ ++ const unsigned int c_off = av_rpi_sand_frame_off_c(s->frame, x0_c, y0_c); ++ const int hshift = 1; // = s->ps.sps->hshift[1]; ++ const int vshift = 1; // = s->ps.sps->vshift[1]; ++ ++ const int x1_c = x0_c + (MV_X(mv) >> (2 + hshift)) - 1; ++ const int y1_c = y0_c + (MV_Y(mv) >> (2 + hshift)) - 1; ++ const qpu_mc_src_addr_t src_base_u = get_mc_address_u(src_frame); ++ const uint32_t x_coeffs = rpi_filter_coefs[av_mod_uintp2(MV_X(mv), 2 + hshift) << (1 - hshift)]; ++ const uint32_t y_coeffs = rpi_filter_coefs[av_mod_uintp2(MV_Y(mv), 2 + vshift) << (1 - vshift)]; ++ const uint32_t wo_u = pack_wo_p(c_offsets[0], c_weights[0]); ++ const uint32_t wo_v = pack_wo_p(c_offsets[1], c_weights[1]); ++ qpu_mc_dst_addr_t dst_base_u = get_mc_address_u(s->frame) + c_off; ++ HEVCRpiInterPredEnv * const ipe = &jb->chroma_ip; ++ const unsigned int xshl = av_rpi_sand_frame_xshl(s->frame) + 1; ++ const unsigned int bh = nPbH_c; ++ const uint32_t qfn = lx == 0 ? s->qpu.c_pxx : s->qpu.c_pxx_l1; ++ ++ for(int start_x=0; start_x < nPbW_c; start_x+=RPI_CHROMA_BLOCK_WIDTH) ++ { ++ HEVCRpiInterPredQ * const cp = rpi_nxt_pred(ipe, bh + 3, qfn); ++ qpu_mc_pred_c_p_t * const cmd_c = &cp->qpu_mc_curr->c.p; ++ qpu_mc_src_t ** const plast_lx = (lx == 0) ? &cp->last_l0 : &cp->last_l1; ++ qpu_mc_src_t * const last_lx = *plast_lx; ++ const int bw = FFMIN(nPbW_c-start_x, RPI_CHROMA_BLOCK_WIDTH); ++ ++ last_lx->x = x1_c + start_x; ++ last_lx->y = y1_c; ++ last_lx->base = src_base_u; ++ cmd_c->h = bh; ++ cmd_c->w = bw; ++ cmd_c->coeffs_x = x_coeffs; ++ cmd_c->coeffs_y = y_coeffs; ++ cmd_c->wo_u = wo_u; ++ cmd_c->wo_v = wo_v; ++ cmd_c->dst_addr_c = dst_base_u + (start_x << xshl); ++ *plast_lx = &cmd_c->next_src; ++ cp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(cmd_c + 1); ++ } ++ return; ++} ++ ++// h/v shifts fixed at one as that is all the qasm copes with ++static void ++rpi_pred_c_b(const HEVCRpiContext * const s, HEVCRpiJob * const jb, ++ const int x0_c, const int y0_c, ++ const int nPbW_c, const int nPbH_c, ++ const struct HEVCRpiMvField * const mv_field, ++ const int16_t * const c_weights, ++ const int16_t * const c_offsets, ++ const int16_t * const c_weights2, ++ const int16_t * const c_offsets2, ++ AVFrame * const src_frame, ++ AVFrame * const src_frame2) ++{ ++ const unsigned int c_off = av_rpi_sand_frame_off_c(s->frame, x0_c, y0_c); ++ const int hshift = 1; // s->ps.sps->hshift[1]; ++ const int vshift = 1; // s->ps.sps->vshift[1]; ++ const MvXY mv = mv_field->xy[0]; ++ const MvXY mv2 = mv_field->xy[1]; ++ ++ const unsigned int mx = av_mod_uintp2(MV_X(mv), 2 + hshift); ++ const unsigned int my = av_mod_uintp2(MV_Y(mv), 2 + vshift); ++ const uint32_t coefs0_x = rpi_filter_coefs[mx << (1 - hshift)]; ++ const uint32_t coefs0_y = rpi_filter_coefs[my << (1 - vshift)]; // Fractional part of motion vector ++ const int x1_c = x0_c + (MV_X(mv) >> (2 + hshift)) - 1; ++ const int y1_c = y0_c + (MV_Y(mv) >> (2 + hshift)) - 1; ++ ++ const unsigned int mx2 = av_mod_uintp2(MV_X(mv2), 2 + hshift); ++ const unsigned int my2 = av_mod_uintp2(MV_Y(mv2), 2 + vshift); ++ const uint32_t coefs1_x = rpi_filter_coefs[mx2 << (1 - hshift)]; ++ const uint32_t coefs1_y = rpi_filter_coefs[my2 << (1 - vshift)]; // Fractional part of motion vector ++ ++ const int x2_c = x0_c + (MV_X(mv2) >> (2 + hshift)) - 1; ++ const int y2_c = y0_c + (MV_Y(mv2) >> (2 + hshift)) - 1; ++ ++ const uint32_t wo_u2 = pack_wo_b(c_offsets[0], c_offsets2[0], c_weights2[0]); ++ const uint32_t wo_v2 = pack_wo_b(c_offsets[1], c_offsets2[1], c_weights2[1]); ++ ++ const qpu_mc_dst_addr_t dst_base_u = get_mc_address_u(s->frame) + c_off; ++ const qpu_mc_src_addr_t src1_base = get_mc_address_u(src_frame); ++ const qpu_mc_src_addr_t src2_base = get_mc_address_u(src_frame2); ++ HEVCRpiInterPredEnv * const ipe = &jb->chroma_ip; ++ const unsigned int xshl = av_rpi_sand_frame_xshl(s->frame) + 1; ++ const unsigned int bh = nPbH_c; ++ ++ for (int start_x=0; start_x < nPbW_c; start_x += RPI_CHROMA_BLOCK_WIDTH) ++ { ++ const unsigned int bw = FFMIN(nPbW_c-start_x, RPI_CHROMA_BLOCK_WIDTH); ++ ++ HEVCRpiInterPredQ * const cp = rpi_nxt_pred(ipe, bh * 2 + 3, s->qpu.c_bxx); ++ qpu_mc_pred_c_b_t * const u = &cp->qpu_mc_curr->c.b; ++ qpu_mc_src_t * const src_l0 = cp->last_l0; ++ qpu_mc_src_t * const src_l1 = cp->last_l1; ++ ++ src_l0->x = x1_c + start_x; ++ src_l0->y = y1_c; ++ src_l0->base = src1_base; ++ src_l1->x = x2_c + start_x; ++ src_l1->y = y2_c; ++ src_l1->base = src2_base; ++ ++ u[0].h = bh; ++ u[0].w = bw; ++ u[0].coeffs_x1 = coefs0_x; ++ u[0].coeffs_y1 = coefs0_y; ++ u[0].weight_u1 = c_weights[0]; // Weight L0 U ++ u[0].weight_v1 = c_weights[1]; // Weight L0 V ++ u[0].coeffs_x2 = coefs1_x; ++ u[0].coeffs_y2 = coefs1_y; ++ u[0].wo_u2 = wo_u2; ++ u[0].wo_v2 = wo_v2; ++ u[0].dst_addr_c = dst_base_u + (start_x << xshl); ++ ++ cp->last_l0 = &u[0].next_src1; ++ cp->last_l1 = &u[0].next_src2; ++ cp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(u + 1); ++ } ++} ++ ++ ++static inline void ++col_stash(const HEVCRpiContext * const s, ++ const unsigned int x0, const unsigned int y0, const unsigned int w0, const unsigned int h0, ++ const HEVCRpiMvField * const mvf) ++{ ++ ColMvField * const col_mvf = s->ref->col_mvf; ++ const unsigned int x = (x0 + 15) >> 4; ++ const unsigned int y = (y0 + 15) >> 4; ++ const unsigned int w = ((x0 + 15 + w0) >> 4) - x; ++ const unsigned int h = ((y0 + 15 + h0) >> 4) - y; ++ ++ if (col_mvf != NULL && w != 0 && h != 0) ++ { ++ // Only record MV from the top left of the 16x16 block ++ ++ const RefPicList * const rpl = s->refPicList; ++ const ColMvField cmv = { ++ .L = { ++ { ++ .poc = (mvf->pred_flag & PF_L0) == 0 ? ++ COL_POC_INTRA : ++ COL_POC_MAKE_INTER(rpl[0].isLongTerm[mvf->ref_idx[0]], rpl[0].list[mvf->ref_idx[0]]), ++ .xy = mvf->xy[0] ++ }, ++ { ++ .poc = (mvf->pred_flag & PF_L1) == 0 ? ++ COL_POC_INTRA : ++ COL_POC_MAKE_INTER(rpl[1].isLongTerm[mvf->ref_idx[1]], rpl[1].list[mvf->ref_idx[1]]), ++ .xy = mvf->xy[1] ++ } ++ } ++ }; ++ ++ ColMvField * p = col_mvf + y * s->col_mvf_stride + x; ++ const unsigned int stride = s->col_mvf_stride - w; ++ unsigned int j = h; ++ ++ do ++ { ++ unsigned int k = w; ++ do ++ { ++ *p++ = cmv; ++ } while (--k != 0); ++ p += stride; ++ } while (--j != 0); ++ } ++} ++ ++static void hls_prediction_unit(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int nPbW, const unsigned int nPbH, ++ const unsigned int log2_cb_size, const unsigned int partIdx, const unsigned int idx) ++{ ++ HEVCRpiJob * const jb = lc->jb0; ++ ++ struct HEVCRpiMvField current_mv = {{0}}; ++ const RefPicList *const refPicList = s->refPicList; ++ const HEVCRpiFrame *ref0 = NULL, *ref1 = NULL; ++ ++ if (lc->cu.pred_mode != MODE_SKIP) ++ lc->pu.merge_flag = ff_hevc_rpi_merge_flag_decode(lc); ++ ++ if (lc->cu.pred_mode == MODE_SKIP || lc->pu.merge_flag) { ++ const unsigned int merge_idx = s->sh.max_num_merge_cand <= 1 ? 0 : ++ ff_hevc_rpi_merge_idx_decode(s, lc); ++ ++ ff_hevc_rpi_luma_mv_merge_mode(s, lc, x0, y0, nPbW, nPbH, log2_cb_size, ++ partIdx, merge_idx, ¤t_mv); ++ } else { ++ hevc_luma_mv_mvp_mode(s, lc, x0, y0, nPbW, nPbH, ¤t_mv); ++ } ++ ++ { ++ HEVCRpiMvField * p = mvf_stash_ptr(s, lc, x0, y0); ++ unsigned int i, j; ++ ++ for (j = 0; j < nPbH >> LOG2_MIN_PU_SIZE; j++) ++ { ++ for (i = 0; i < nPbW >> LOG2_MIN_PU_SIZE; i++) ++ p[i] = current_mv; ++ p += MVF_STASH_WIDTH_PU; ++ } ++ } ++ ++ col_stash(s, x0, y0, nPbW, nPbH, ¤t_mv); ++ ++ if (current_mv.pred_flag & PF_L0) { ++ ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; ++ if (!ref0) ++ return; ++ hevc_await_progress(s, lc, ref0, current_mv.xy[0], y0, nPbH); ++ } ++ if (current_mv.pred_flag & PF_L1) { ++ ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; ++ if (!ref1) ++ return; ++ hevc_await_progress(s, lc, ref1, current_mv.xy[1], y0, nPbH); ++ } ++ ++ if (current_mv.pred_flag == PF_L0) { ++ const int x0_c = x0 >> ctx_hshift(s, 1); ++ const int y0_c = y0 >> ctx_vshift(s, 1); ++ const int nPbW_c = nPbW >> ctx_hshift(s, 1); ++ const int nPbH_c = nPbH >> ctx_vshift(s, 1); ++ ++ rpi_pred_y(s, jb, x0, y0, nPbW, nPbH, current_mv.xy[0], ++ s->sh.luma_weight_l0[current_mv.ref_idx[0]], s->sh.luma_offset_l0[current_mv.ref_idx[0]], ++ ref0->frame); ++ ++ if (ctx_cfmt(s) != 0) { ++ rpi_pred_c(s, jb, 0, x0_c, y0_c, nPbW_c, nPbH_c, current_mv.xy[0], ++ s->sh.chroma_weight_l0[current_mv.ref_idx[0]], s->sh.chroma_offset_l0[current_mv.ref_idx[0]], ++ ref0->frame); ++ return; ++ } ++ } else if (current_mv.pred_flag == PF_L1) { ++ const int x0_c = x0 >> ctx_hshift(s, 1); ++ const int y0_c = y0 >> ctx_vshift(s, 1); ++ const int nPbW_c = nPbW >> ctx_hshift(s, 1); ++ const int nPbH_c = nPbH >> ctx_vshift(s, 1); ++ ++ rpi_pred_y(s, jb, x0, y0, nPbW, nPbH, current_mv.xy[1], ++ s->sh.luma_weight_l1[current_mv.ref_idx[1]], s->sh.luma_offset_l1[current_mv.ref_idx[1]], ++ ref1->frame); ++ ++ if (ctx_cfmt(s) != 0) { ++ rpi_pred_c(s, jb, 1, x0_c, y0_c, nPbW_c, nPbH_c, current_mv.xy[1], ++ s->sh.chroma_weight_l1[current_mv.ref_idx[1]], s->sh.chroma_offset_l1[current_mv.ref_idx[1]], ++ ref1->frame); ++ return; ++ } ++ } else if (current_mv.pred_flag == PF_BI) { ++ const int x0_c = x0 >> ctx_hshift(s, 1); ++ const int y0_c = y0 >> ctx_vshift(s, 1); ++ const int nPbW_c = nPbW >> ctx_hshift(s, 1); ++ const int nPbH_c = nPbH >> ctx_vshift(s, 1); ++ ++ rpi_pred_y_b(s, jb, x0, y0, nPbW, nPbH, ¤t_mv, ref0->frame, ref1->frame); ++ ++ if (ctx_cfmt(s) != 0) { ++ rpi_pred_c_b(s, jb, x0_c, y0_c, nPbW_c, nPbH_c, ++ ¤t_mv, ++ s->sh.chroma_weight_l0[current_mv.ref_idx[0]], ++ s->sh.chroma_offset_l0[current_mv.ref_idx[0]], ++ s->sh.chroma_weight_l1[current_mv.ref_idx[1]], ++ s->sh.chroma_offset_l1[current_mv.ref_idx[1]], ++ ref0->frame, ++ ref1->frame); ++ return; ++ } ++ } ++} ++ ++static void set_ipm(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int log2_cb_size, ++ const unsigned int ipm) ++{ ++ const unsigned int x_pu = x0 >> LOG2_MIN_PU_SIZE; ++ const unsigned int y_pu = y0 >> LOG2_MIN_PU_SIZE; ++ ++ { ++ const unsigned int ctb_mask = ~(~0U << (s->ps.sps->log2_ctb_size - LOG2_MIN_PU_SIZE)); ++ set_stash2(lc->ipm_left + (y_pu & ctb_mask), lc->ipm_up + (x_pu & ctb_mask), log2_cb_size - LOG2_MIN_PU_SIZE, ipm); ++ } ++ ++ // If IRAP then everything is Intra & we avoid ever looking at these ++ // stashes so don't bother setting them ++ if (!s->is_irap && lc->cu.pred_mode == MODE_INTRA) ++ { ++ if (s->is_intra != NULL) ++ { ++ set_bits(s->is_intra + (y0 >> LOG2_MIN_CU_SIZE) * s->ps.sps->pcm_width, x0 >> LOG2_MIN_CU_SIZE, s->ps.sps->pcm_width, log2_cb_size - LOG2_MIN_CU_SIZE); ++ } ++ ++ { ++ HEVCRpiMvField * p = mvf_stash_ptr(s, lc, x0, y0); ++ const unsigned int size_in_pus = (1 << log2_cb_size) >> LOG2_MIN_PU_SIZE; // min_pu <= log2_cb so >= 1 ++ unsigned int n = size_in_pus; ++ ++ do ++ { ++ memset(p, 0, size_in_pus * sizeof(*p)); ++ p += MVF_STASH_WIDTH_PU; ++ } while (--n != 0); ++ } ++ ++ ++ if (s->ref->col_mvf != NULL && ((x0 | y0) & 0xf) == 0) ++ { ++ // Only record top left stuff ++ // Blocks should always be alinged on size boundries ++ // so cannot have overflow from a small block ++ ++ ColMvField * p = s->ref->col_mvf + (y0 >> 4) * s->col_mvf_stride + (x0 >> 4); ++ const unsigned int size_in_col = log2_cb_size < 4 ? 1 : (1 << (log2_cb_size - 4)); ++ const unsigned int stride = s->col_mvf_stride - size_in_col; ++ unsigned int j = size_in_col; ++ ++ do ++ { ++ unsigned int k = size_in_col; ++ do ++ { ++ p->L[0].poc = COL_POC_INTRA; ++ p->L[0].xy = 0; ++ p->L[1].poc = COL_POC_INTRA; ++ p->L[1].xy = 0; ++ ++p; ++ } while (--k != 0); ++ p += stride; ++ } while (--j != 0); ++ } ++ } ++} ++ ++static inline void intra_prediction_unit_default_value(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int log2_cb_size) ++{ ++ set_ipm(s, lc, x0, y0, log2_cb_size, INTRA_DC); ++} ++ ++ ++/** ++ * 8.4.1 ++ */ ++static int luma_intra_pred_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ int x0, int y0, int log2_pu_size, ++ int prev_intra_luma_pred_flag, ++ const unsigned int idx) ++{ ++ const unsigned int ctb_mask = ~(~0U << s->ps.sps->log2_ctb_size); ++ const unsigned int xb_pu = (x0 & ctb_mask) >> LOG2_MIN_PU_SIZE; ++ const unsigned int yb_pu = (y0 & ctb_mask) >> LOG2_MIN_PU_SIZE; ++ ++ // Up does not cross boundries so as we always scan 1 slice-tile-line in an ++ // lc we can just keep 1 CTB lR stashes ++ // Left is reset to DC @ Start of Line/Tile/Slice in fill_job ++ const unsigned int cand_up = yb_pu == 0 ? INTRA_DC : lc->ipm_up[xb_pu]; ++ const unsigned int cand_left = lc->ipm_left[yb_pu]; ++ ++ unsigned int intra_pred_mode; ++ unsigned int a, b, c; ++ ++ if (cand_left == cand_up) { ++ if (cand_left < 2) { ++ a = INTRA_PLANAR; ++ b = INTRA_DC; ++ c = INTRA_ANGULAR_26; ++ } else { ++ a = cand_left; ++ b = 2 + ((cand_left - 2 - 1 + 32) & 31); ++ c = 2 + ((cand_left - 2 + 1) & 31); ++ } ++ } else { ++ a = cand_left; ++ b = cand_up; ++ c = (cand_left != INTRA_PLANAR && cand_up != INTRA_PLANAR) ? ++ INTRA_PLANAR : ++ (cand_left != INTRA_DC && cand_up != INTRA_DC) ? ++ INTRA_DC : ++ INTRA_ANGULAR_26; ++ } ++ ++ if (prev_intra_luma_pred_flag) { ++ intra_pred_mode = idx == 0 ? a : idx == 1 ? b : c; ++ } else { ++ // Sort lowest 1st ++ if (a > b) ++ FFSWAP(int, a, b); ++ if (a > c) ++ FFSWAP(int, a, c); ++ if (b > c) ++ FFSWAP(int, b, c); ++ ++ intra_pred_mode = idx; ++ if (intra_pred_mode >= a) ++ intra_pred_mode++; ++ if (intra_pred_mode >= b) ++ intra_pred_mode++; ++ if (intra_pred_mode >= c) ++ intra_pred_mode++; ++ } ++ ++ /* write the intra prediction units into the mv array */ ++ set_ipm(s, lc, x0, y0, log2_pu_size, intra_pred_mode); ++ return intra_pred_mode; ++} ++ ++static const uint8_t tab_mode_idx[] = { ++ 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20, ++ 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31}; ++ ++static void intra_prediction_unit(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int log2_cb_size) ++{ ++ static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 }; ++ uint8_t prev_intra_luma_pred_flag[4]; ++ int split = lc->cu.part_mode == PART_NxN; ++ const unsigned int split_size = (1 << (log2_cb_size - 1)); ++ int chroma_mode; ++ const unsigned int n = split ? 4 : 1; ++ unsigned int i; ++ ++ for (i = 0; i != n; i++) ++ prev_intra_luma_pred_flag[i] = ff_hevc_rpi_prev_intra_luma_pred_flag_decode(lc); ++ ++ for (i = 0; i < n; i++) { ++ // depending on mode idx is mpm or luma_pred_mode ++ const unsigned int idx = prev_intra_luma_pred_flag[i] ? ++ ff_hevc_rpi_mpm_idx_decode(lc) : ++ ff_hevc_rpi_rem_intra_luma_pred_mode_decode(lc); ++ ++ lc->pu.intra_pred_mode[i] = ++ luma_intra_pred_mode(s, lc, ++ x0 + ((i & 1) == 0 ? 0 : split_size), ++ y0 + ((i & 2) == 0 ? 0 : split_size), ++ log2_cb_size - split, ++ prev_intra_luma_pred_flag[i], idx); ++ } ++ ++ if (ctx_cfmt(s) == 3) { ++ for (i = 0; i < n; i++) { ++ lc->pu.chroma_mode_c[i] = chroma_mode = ff_hevc_rpi_intra_chroma_pred_mode_decode(lc); ++ if (chroma_mode != 4) { ++ if (lc->pu.intra_pred_mode[i] == intra_chroma_table[chroma_mode]) ++ lc->pu.intra_pred_mode_c[i] = 34; ++ else ++ lc->pu.intra_pred_mode_c[i] = intra_chroma_table[chroma_mode]; ++ } else { ++ lc->pu.intra_pred_mode_c[i] = lc->pu.intra_pred_mode[i]; ++ } ++ } ++ } else if (ctx_cfmt(s) == 2) { ++ int mode_idx; ++ lc->pu.chroma_mode_c[0] = chroma_mode = ff_hevc_rpi_intra_chroma_pred_mode_decode(lc); ++ if (chroma_mode != 4) { ++ if (lc->pu.intra_pred_mode[0] == intra_chroma_table[chroma_mode]) ++ mode_idx = 34; ++ else ++ mode_idx = intra_chroma_table[chroma_mode]; ++ } else { ++ mode_idx = lc->pu.intra_pred_mode[0]; ++ } ++ lc->pu.intra_pred_mode_c[0] = tab_mode_idx[mode_idx]; ++ } else if (ctx_cfmt(s) != 0) { ++ chroma_mode = ff_hevc_rpi_intra_chroma_pred_mode_decode(lc); ++ if (chroma_mode != 4) { ++ if (lc->pu.intra_pred_mode[0] == intra_chroma_table[chroma_mode]) ++ lc->pu.intra_pred_mode_c[0] = 34; ++ else ++ lc->pu.intra_pred_mode_c[0] = intra_chroma_table[chroma_mode]; ++ } else { ++ lc->pu.intra_pred_mode_c[0] = lc->pu.intra_pred_mode[0]; ++ } ++ } ++} ++ ++static int hls_coding_unit(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, const unsigned int log2_cb_size) ++{ ++ const unsigned int cb_size = 1 << log2_cb_size; ++ const unsigned int log2_min_cb_size = s->ps.sps->log2_min_cb_size; ++ const unsigned int min_cb_width = s->ps.sps->min_cb_width; ++ const unsigned int x_cb = x0 >> log2_min_cb_size; ++ const unsigned int y_cb = y0 >> log2_min_cb_size; ++ const unsigned int idx = log2_cb_size - 2; ++ const unsigned int qp_block_mask = (1 << s->ps.pps->log2_min_cu_qp_delta_size) - 1; ++ int skip_flag = 0; ++ ++ lc->cu.x = x0; ++ lc->cu.y = y0; ++ lc->cu.x_split = x0; ++ lc->cu.y_split = y0; ++ ++ lc->cu.pred_mode = MODE_INTRA; ++ lc->cu.part_mode = PART_2Nx2N; ++ lc->cu.intra_split_flag = 0; ++ lc->cu.cu_transquant_bypass_flag = 0; ++ lc->pu.intra_pred_mode[0] = 1; ++ lc->pu.intra_pred_mode[1] = 1; ++ lc->pu.intra_pred_mode[2] = 1; ++ lc->pu.intra_pred_mode[3] = 1; ++ ++ if (s->ps.pps->transquant_bypass_enable_flag) { ++ lc->cu.cu_transquant_bypass_flag = ff_hevc_rpi_cu_transquant_bypass_flag_decode(lc); ++ if (lc->cu.cu_transquant_bypass_flag) ++ set_deblocking_bypass(s, x0, y0, log2_cb_size); ++ } ++ ++ if (s->sh.slice_type != HEVC_SLICE_I) { ++ lc->cu.pred_mode = MODE_INTER; ++ skip_flag = ff_hevc_rpi_skip_flag_decode(s, lc, x0, y0, x_cb, y_cb); ++ } ++ ++ if (skip_flag) { ++ lc->cu.pred_mode = MODE_SKIP; ++ ++ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size, log2_cb_size, 0, idx); ++ intra_prediction_unit_default_value(s, lc, x0, y0, log2_cb_size); ++ ++ if (!s->sh.disable_deblocking_filter_flag) ++ ff_hevc_rpi_deblocking_boundary_strengths(s, lc, x0, y0, log2_cb_size, 0); ++ } else { ++ int pcm_flag = 0; ++ ++ if (s->sh.slice_type != HEVC_SLICE_I) ++ lc->cu.pred_mode = ff_hevc_rpi_pred_mode_decode(lc); ++ if (lc->cu.pred_mode != MODE_INTRA || ++ log2_cb_size == s->ps.sps->log2_min_cb_size) { ++ lc->cu.part_mode = ff_hevc_rpi_part_mode_decode(s, lc, log2_cb_size); ++ lc->cu.intra_split_flag = lc->cu.part_mode == PART_NxN && ++ lc->cu.pred_mode == MODE_INTRA; ++ } ++ ++ if (lc->cu.pred_mode == MODE_INTRA) { ++ if (lc->cu.part_mode == PART_2Nx2N && ++ log2_cb_size <= s->ps.sps->pcm.log2_max_pcm_cb_size && // 0 if not enabled ++ log2_cb_size >= s->ps.sps->pcm.log2_min_pcm_cb_size && ++ ff_hevc_rpi_pcm_flag_decode(lc) != 0) ++ { ++ int ret; ++ pcm_flag = 1; ++ intra_prediction_unit_default_value(s, lc, x0, y0, log2_cb_size); ++ if ((ret = hls_pcm_sample(s, lc, x0, y0, log2_cb_size)) < 0) ++ return ret; ++ ++ if (s->ps.sps->pcm.loop_filter_disable_flag) ++ set_deblocking_bypass(s, x0, y0, log2_cb_size); ++ } else { ++ intra_prediction_unit(s, lc, x0, y0, log2_cb_size); ++ } ++ } else { ++ intra_prediction_unit_default_value(s, lc, x0, y0, log2_cb_size); ++ switch (lc->cu.part_mode) { ++ case PART_2Nx2N: ++ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size, log2_cb_size, 0, idx); ++ break; ++ case PART_2NxN: ++ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size / 2, log2_cb_size, 0, idx); ++ lc->cu.y_split = y0 + cb_size / 2; ++ hls_prediction_unit(s, lc, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1, idx); ++ break; ++ case PART_Nx2N: ++ hls_prediction_unit(s, lc, x0, y0, cb_size / 2, cb_size, log2_cb_size, 0, idx - 1); ++ lc->cu.x_split = x0 + cb_size / 2; ++ hls_prediction_unit(s, lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1); ++ break; ++ case PART_2NxnU: ++ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size / 4, log2_cb_size, 0, idx); ++ lc->cu.y_split = y0 + cb_size / 4; ++ hls_prediction_unit(s, lc, x0, y0 + cb_size / 4, cb_size, cb_size / 4 * 3, log2_cb_size, 1, idx); ++ break; ++ case PART_2NxnD: ++ hls_prediction_unit(s, lc, x0, y0, cb_size, cb_size / 4 * 3, log2_cb_size, 0, idx); ++ lc->cu.y_split = y0 + cb_size / 4 * 3; ++ hls_prediction_unit(s, lc, x0, y0 + cb_size / 4 * 3, cb_size, cb_size / 4, log2_cb_size, 1, idx); ++ break; ++ case PART_nLx2N: ++ hls_prediction_unit(s, lc, x0, y0, cb_size / 4, cb_size, log2_cb_size, 0, idx - 2); ++ lc->cu.x_split = x0 + cb_size / 4; ++ hls_prediction_unit(s, lc, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2); ++ break; ++ case PART_nRx2N: ++ hls_prediction_unit(s, lc, x0, y0, cb_size / 4 * 3, cb_size, log2_cb_size, 0, idx - 2); ++ lc->cu.x_split = x0 + cb_size / 4 * 3; ++ hls_prediction_unit(s, lc, x0 + cb_size / 4 * 3, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2); ++ break; ++ case PART_NxN: ++ hls_prediction_unit(s, lc, x0, y0, cb_size / 2, cb_size / 2, log2_cb_size, 0, idx - 1); ++ lc->cu.x_split = x0 + cb_size / 2; ++ hls_prediction_unit(s, lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1); ++ lc->cu.y_split = y0 + cb_size / 2; ++ hls_prediction_unit(s, lc, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1); ++ hls_prediction_unit(s, lc, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1); ++ break; ++ } ++ } ++ ++ if (!pcm_flag) { ++ int rqt_root_cbf = 1; ++ ++ if (lc->cu.pred_mode != MODE_INTRA && ++ !(lc->cu.part_mode == PART_2Nx2N && lc->pu.merge_flag)) { ++ rqt_root_cbf = ff_hevc_rpi_no_residual_syntax_flag_decode(lc); ++ } ++ if (rqt_root_cbf) { ++ const unsigned int cbf_c = ctx_cfmt(s) == 0 ? 0 : (CBF_CR0 | CBF_CB0); ++ int ret; ++ ++ lc->cu.max_trafo_depth = lc->cu.pred_mode == MODE_INTRA ? ++ s->ps.sps->max_transform_hierarchy_depth_intra + lc->cu.intra_split_flag : ++ s->ps.sps->max_transform_hierarchy_depth_inter; ++ // transform_tree does deblock_boundary_strengths ++ ret = hls_transform_tree(s, lc, x0, y0, ++ log2_cb_size, 0, 0, cbf_c); ++ if (ret < 0) ++ return ret; ++ } else { ++ if (!s->sh.disable_deblocking_filter_flag) ++ ff_hevc_rpi_deblocking_boundary_strengths(s, lc, x0, y0, log2_cb_size, 0); ++ } ++ } ++ } ++ ++ // If the delta is still wanted then we haven't read the delta & therefore need to set qp here ++ if (lc->tu.is_cu_qp_delta_wanted) ++ ff_hevc_rpi_set_qPy(s, lc, x0, y0); ++ ++ if(((x0 + (1<qPy_pred = lc->qp_y; ++ } ++ ++ set_bytes(s->qp_y_tab + y_cb * min_cb_width + x_cb, min_cb_width, log2_cb_size - log2_min_cb_size, lc->qp_y & 0xff); ++ ++ set_stash2(s->cabac_stash_up + (x0 >> 3), s->cabac_stash_left + (y0 >> 3), log2_cb_size - 3, (lc->ct_depth << 1) | skip_flag); ++ ++ return 0; ++} ++ ++// Returns: ++// < 0 Error ++// 0 More data wanted ++// 1 EoSlice / EoPicture ++static int hls_coding_quadtree(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const int x0, const int y0, ++ const int log2_cb_size, const unsigned int cb_depth) ++{ ++ const int cb_size = 1 << log2_cb_size; ++ int ret; ++ int split_cu; ++ ++ lc->ct_depth = cb_depth; ++ split_cu = (log2_cb_size > s->ps.sps->log2_min_cb_size); ++ if (x0 + cb_size <= s->ps.sps->width && ++ y0 + cb_size <= s->ps.sps->height && ++ split_cu) ++ { ++ split_cu = ff_hevc_rpi_split_coding_unit_flag_decode(s, lc, cb_depth, x0, y0); ++ } ++ ++ // Qp delta (and offset) need to remain wanted if cb_size < min until ++ // a coded block is found so we still initial state at depth 0 (outside ++ // this fn) and only reset here ++ if (s->ps.pps->cu_qp_delta_enabled_flag && ++ log2_cb_size >= s->ps.pps->log2_min_cu_qp_delta_size) ++ { ++ lc->tu.is_cu_qp_delta_wanted = 1; ++ lc->tu.cu_qp_delta = 0; ++ } ++ if (s->sh.cu_chroma_qp_offset_enabled_flag && ++ log2_cb_size >= s->ps.pps->log2_min_cu_qp_delta_size) ++ { ++ lc->tu.cu_chroma_qp_offset_wanted = 1; ++ } ++ ++ lc->tu.qp_divmod6[0] = s->ps.pps->qp_bd_x[0]; ++ lc->tu.qp_divmod6[1] = s->ps.pps->qp_bd_x[1] + s->sh.slice_cb_qp_offset; ++ lc->tu.qp_divmod6[2] = s->ps.pps->qp_bd_x[2] + s->sh.slice_cr_qp_offset; ++ ++ if (split_cu) { ++ int qp_block_mask = (1 << s->ps.pps->log2_min_cu_qp_delta_size) - 1; ++ const int cb_size_split = cb_size >> 1; ++ const int x1 = x0 + cb_size_split; ++ const int y1 = y0 + cb_size_split; ++ ++ int more_data = 0; ++ ++ more_data = hls_coding_quadtree(s, lc, x0, y0, log2_cb_size - 1, cb_depth + 1); ++ if (more_data < 0) ++ return more_data; ++ ++ if (more_data && x1 < s->ps.sps->width) { ++ more_data = hls_coding_quadtree(s, lc, x1, y0, log2_cb_size - 1, cb_depth + 1); ++ if (more_data < 0) ++ return more_data; ++ } ++ if (more_data && y1 < s->ps.sps->height) { ++ more_data = hls_coding_quadtree(s, lc, x0, y1, log2_cb_size - 1, cb_depth + 1); ++ if (more_data < 0) ++ return more_data; ++ } ++ if (more_data && x1 < s->ps.sps->width && ++ y1 < s->ps.sps->height) { ++ more_data = hls_coding_quadtree(s, lc, x1, y1, log2_cb_size - 1, cb_depth + 1); ++ if (more_data < 0) ++ return more_data; ++ } ++ ++ if(((x0 + (1<qPy_pred = lc->qp_y; ++ ++ if (more_data) ++ return ((x1 + cb_size_split) < s->ps.sps->width || ++ (y1 + cb_size_split) < s->ps.sps->height); ++ else ++ return 0; ++ } else { ++ ret = hls_coding_unit(s, lc, x0, y0, log2_cb_size); ++ if (ret < 0) ++ return ret; ++ if ((!((x0 + cb_size) % ++ (1 << (s->ps.sps->log2_ctb_size))) || ++ (x0 + cb_size >= s->ps.sps->width)) && ++ (!((y0 + cb_size) % ++ (1 << (s->ps.sps->log2_ctb_size))) || ++ (y0 + cb_size >= s->ps.sps->height))) { ++ int end_of_slice_flag = ff_hevc_rpi_get_cabac_terminate(&lc->cc); ++ return !end_of_slice_flag; ++ } else { ++ return 1; ++ } ++ } ++ ++ return 0; // NEVER ++} ++ ++static void hls_decode_neighbour(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const int x_ctb, const int y_ctb, const int ctb_addr_ts) ++{ ++ const unsigned int ctb_size = 1 << s->ps.sps->log2_ctb_size; ++ const unsigned int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; ++ const unsigned int ctb_addr_rs_in_slice = ctb_addr_rs - s->sh.slice_addr; // slice_addr = RS addr of start of slice ++ const unsigned int ctb_flags = s->ps.pps->ctb_ts_flags[ctb_addr_ts]; ++ const unsigned int line_w = s->ps.sps->ctb_width; ++ ++ s->tab_slice_address[ctb_addr_rs] = s->sh.slice_addr; ++ ++ lc->end_of_ctb_x = FFMIN(x_ctb + ctb_size, s->ps.sps->width); ++ lc->end_of_ctb_y = FFMIN(y_ctb + ctb_size, s->ps.sps->height); ++ ++ lc->boundary_flags = 0; ++ ++ if ((ctb_flags & CTB_TS_FLAGS_SOTL) != 0) ++ lc->boundary_flags |= BOUNDARY_LEFT_TILE; ++ if (x_ctb > 0 && s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - 1]) ++ lc->boundary_flags |= BOUNDARY_LEFT_SLICE; ++ if ((ctb_flags & CTB_TS_FLAGS_TOT) != 0) ++ lc->boundary_flags |= BOUNDARY_UPPER_TILE; ++ if (y_ctb > 0 && s->tab_slice_address[ctb_addr_rs] != s->tab_slice_address[ctb_addr_rs - line_w]) ++ lc->boundary_flags |= BOUNDARY_UPPER_SLICE; ++ ++ // Use line width rather than tile width for addr_in_slice test as ++ // addr_in_slice is in raster units ++ ++ lc->ctb_avail = ++ ((lc->boundary_flags & (BOUNDARY_LEFT_SLICE | BOUNDARY_LEFT_TILE)) == 0 ? AVAIL_L : 0) | ++ ((lc->boundary_flags & (BOUNDARY_UPPER_SLICE | BOUNDARY_UPPER_TILE)) == 0 ? AVAIL_U : 0) | ++ ((lc->boundary_flags & (BOUNDARY_LEFT_TILE | BOUNDARY_UPPER_TILE)) == 0 && ++ (ctb_addr_rs_in_slice > line_w) ? AVAIL_UL : 0) | ++ ((ctb_flags & (CTB_TS_FLAGS_EOTL | CTB_TS_FLAGS_TOT)) == 0 && ++ (ctb_addr_rs_in_slice + 1 >= line_w) ? AVAIL_UR : 0); ++ // Down-left never avail at CTB level ++} ++ ++ ++static void rpi_execute_dblk_cmds(const HEVCRpiContext * const s, HEVCRpiJob * const jb) ++{ ++ int y = ff_hevc_rpi_hls_filter_blk(s, jb->bounds, ++ (s->ps.pps->ctb_ts_flags[jb->ctu_ts_last] & CTB_TS_FLAGS_EOT) != 0); ++ ++ // Signal ++ if (y > 0) { ++ // Cast away const as progress is held in s, but this really shouldn't confuse anything ++ ff_hevc_rpi_progress_signal_recon((HEVCRpiContext *)s, y - 1); ++ } ++ ++ // Job done now ++ // ? Move outside this fn ++ job_free(s->jbc, jb); ++} ++ ++// I-pred, transform_and_add for all blocks types done here ++// All ARM ++static void rpi_execute_pred_cmds(const HEVCRpiContext * const s, HEVCRpiJob * const jb) ++{ ++ unsigned int i; ++ HEVCRpiIntraPredEnv * const iap = &jb->intra; ++ const HEVCPredCmd *cmd = iap->cmds; ++ ++#if !RPI_WORKER_WAIT_PASS_0 ++ rpi_sem_wait(&jb->sem); ++ rpi_cache_flush_execute(jb->rfe); // Invalidate data set up in pass1 ++#endif ++ ++ for (i = iap->n; i > 0; i--, cmd++) ++ { ++ switch (cmd->type) ++ { ++ case RPI_PRED_INTRA: ++ s->hpc.intra_pred(s, cmd->i_pred.mode, cmd->i_pred.x, cmd->i_pred.y, cmd->avail, cmd->size); ++ break; ++ case RPI_PRED_INTRA_C: ++ s->hpc.intra_pred_c(s, cmd->i_pred.mode, cmd->i_pred.x, cmd->i_pred.y, cmd->avail, cmd->size); ++ break; ++ case RPI_PRED_ADD_RESIDUAL: ++ s->hevcdsp.add_residual[cmd->size - 2](cmd->ta.dst, (int16_t *)cmd->ta.buf, cmd->ta.stride); ++ break; ++ case RPI_PRED_ADD_DC: ++ s->hevcdsp.add_residual_dc[cmd->size - 2](cmd->dc.dst, cmd->dc.stride, cmd->dc.dc); ++ break; ++ case RPI_PRED_ADD_RESIDUAL_U: ++ s->hevcdsp.add_residual_u[cmd->size - 2](cmd->ta.dst, (int16_t *)cmd->ta.buf, cmd->ta.stride, cmd->ta.dc); ++ break; ++ case RPI_PRED_ADD_RESIDUAL_V: ++ s->hevcdsp.add_residual_v[cmd->size - 2](cmd->ta.dst, (int16_t *)cmd->ta.buf, cmd->ta.stride, cmd->ta.dc); ++ break; ++ case RPI_PRED_ADD_RESIDUAL_C: ++ s->hevcdsp.add_residual_c[cmd->size - 2](cmd->ta.dst, (int16_t *)cmd->ta.buf, cmd->ta.stride); ++ break; ++ case RPI_PRED_ADD_DC_U: ++ case RPI_PRED_ADD_DC_V: ++ s->hevcdsp.add_residual_dc_c[cmd->size - 2](cmd->dc.dst, cmd->dc.stride, cmd->dc.dc); ++ break; ++ ++ case RPI_PRED_I_PCM: ++ pcm_extract(s, cmd->i_pcm.src, cmd->i_pcm.src_len, cmd->i_pcm.x, cmd->i_pcm.y, 1 << cmd->size); ++ break; ++ ++ default: ++ av_log(s->avctx, AV_LOG_PANIC, "Bad command %d in worker pred Q\n", cmd->type); ++ abort(); ++ } ++ } ++ ++ // Mark done ++ iap->n = 0; ++} ++ ++ ++// Set initial uniform job values & zero ctu_count ++static void rpi_begin(const HEVCRpiContext * const s, HEVCRpiJob * const jb, const unsigned int ctu_ts_first) ++{ ++ unsigned int i; ++ HEVCRpiInterPredEnv *const cipe = &jb->chroma_ip; ++ HEVCRpiInterPredEnv *const yipe = &jb->luma_ip; ++ const HEVCRpiSPS * const sps = s->ps.sps; ++ ++ const uint16_t pic_width_y = sps->width; ++ const uint16_t pic_height_y = sps->height; ++ ++ const uint16_t pic_width_c = sps->width >> ctx_hshift(s, 1); ++ const uint16_t pic_height_c = sps->height >> ctx_vshift(s, 1); ++ ++ // We expect the pointer to change if we use another sps ++ if (sps != jb->sps) ++ { ++ worker_pic_free_one(jb); ++ ++ set_ipe_from_ici(cipe, &ipe_init_infos[s->ps.sps->bit_depth - 8].chroma); ++ set_ipe_from_ici(yipe, &ipe_init_infos[s->ps.sps->bit_depth - 8].luma); ++ ++ { ++ const int coefs_per_luma = HEVC_MAX_CTB_SIZE * HEVC_RPI_MAX_WIDTH; ++ const int coefs_per_chroma = (coefs_per_luma * 2) >> (ctx_vshift(s, 1) + ctx_hshift(s, 1)); ++ worker_pic_alloc_one(jb, coefs_per_luma + coefs_per_chroma); ++ } ++ ++ jb->sps = sps; ++ } ++ ++ jb->waited = 0; ++ jb->ctu_ts_first = ctu_ts_first; ++ jb->ctu_ts_last = -1; ++ ++ rpi_inter_pred_reset(cipe); ++ for (i = 0; i < cipe->n; i++) { ++ HEVCRpiInterPredQ * const cp = cipe->q + i; ++ qpu_mc_pred_c_s_t * const u = &cp->qpu_mc_base->c.s; ++ ++ u->next_src1.x = 0; ++ u->next_src1.y = 0; ++ u->next_src1.base = 0; ++ u->pic_cw = pic_width_c; ++ u->pic_ch = pic_height_c; ++ u->stride2 = av_rpi_sand_frame_stride2(s->frame); ++ u->stride1 = av_rpi_sand_frame_stride1(s->frame); ++ cp->last_l0 = &u->next_src1; ++ ++ u->next_fn = 0; ++ u->next_src2.x = 0; ++ u->next_src2.y = 0; ++ u->next_src2.base = 0; ++ cp->last_l1 = &u->next_src2; ++ ++ cp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(u + 1); ++ } ++ ++ rpi_inter_pred_reset(yipe); ++ for (i = 0; i < yipe->n; i++) { ++ HEVCRpiInterPredQ * const yp = yipe->q + i; ++ qpu_mc_pred_y_s_t * const y = &yp->qpu_mc_base->y.s; ++ ++ y->next_src1.x = 0; ++ y->next_src1.y = 0; ++ y->next_src1.base = 0; ++ y->next_src2.x = 0; ++ y->next_src2.y = 0; ++ y->next_src2.base = 0; ++ y->pic_h = pic_height_y; ++ y->pic_w = pic_width_y; ++ y->stride2 = av_rpi_sand_frame_stride2(s->frame); ++ y->stride1 = av_rpi_sand_frame_stride1(s->frame); ++ y->next_fn = 0; ++ yp->last_l0 = &y->next_src1; ++ yp->last_l1 = &y->next_src2; ++ ++ yp->qpu_mc_curr = (qpu_mc_pred_cmd_t *)(y + 1); ++ } ++ ++ jb->last_y8_p = NULL; ++ jb->last_y8_l1 = NULL; ++ ++ for (i = 0; i != FF_ARRAY_ELEMS(jb->progress_req); ++i) { ++ jb->progress_req[i] = -1; ++ } ++ ++ worker_pic_reset(&jb->coeffs); ++} ++ ++ ++#if !RPI_QPU_EMU_Y || !RPI_QPU_EMU_C ++static unsigned int mc_terminate_add_qpu(const HEVCRpiContext * const s, ++ const vpu_qpu_job_h vqj, ++ rpi_cache_flush_env_t * const rfe, ++ HEVCRpiInterPredEnv * const ipe) ++{ ++ unsigned int i; ++ uint32_t mail[QPU_N_MAX][QPU_MAIL_EL_VALS]; ++ unsigned int max_block = 0; ++ ++ if (!ipe->used) { ++ return 0; ++ } ++ ++ if (ipe->curr != 0) { ++ rpi_inter_pred_sync(ipe); ++ } ++ ++ // Add final commands to Q ++ for(i = 0; i != ipe->n; ++i) { ++ HEVCRpiInterPredQ * const yp = ipe->q + i; ++ qpu_mc_src_t *const p0 = yp->last_l0; ++ qpu_mc_src_t *const p1 = yp->last_l1; ++ const unsigned int block_size = (char *)yp->qpu_mc_curr - (char *)yp->qpu_mc_base; ++ ++ if (block_size > max_block) ++ max_block = block_size; ++ ++ qpu_mc_link_set(yp->qpu_mc_curr, yp->code_exit); ++ ++ // Need to set the srcs for L0 & L1 to something that can be (pointlessly) prefetched ++ p0->x = MC_DUMMY_X; ++ p0->y = MC_DUMMY_Y; ++ p0->base = s->qpu_dummy_frame_qpu; ++ p1->x = MC_DUMMY_X; ++ p1->y = MC_DUMMY_Y; ++ p1->base = s->qpu_dummy_frame_qpu; ++ ++ yp->last_l0 = NULL; ++ yp->last_l1 = NULL; ++ ++ // Add to mailbox list ++ mail[i][0] = ipe->gptr.vc + ((uint8_t *)yp->qpu_mc_base - ipe->gptr.arm); ++ mail[i][1] = yp->code_setup; ++ } ++ ++ // We don't need invalidate here as the uniforms aren't changed by the QPU ++ // and leaving them in ARM cache avoids (pointless) pre-reads when writing ++ // new values which seems to give us a small performance advantage ++ // ++ // In most cases we will not have a completely packed set of uniforms and as ++ // we have a 2d invalidate we writeback all uniform Qs to the depth of the ++ // fullest ++ rpi_cache_flush_add_gm_blocks(rfe, &ipe->gptr, RPI_CACHE_FLUSH_MODE_WRITEBACK, ++ (uint8_t *)ipe->q[0].qpu_mc_base - ipe->gptr.arm, max_block, ++ ipe->n, ipe->max_fill + ipe->min_gap); ++ vpu_qpu_job_add_qpu(vqj, ipe->n, (uint32_t *)mail); ++ ++ return 1; ++} ++#endif ++ ++#if RPI_QPU_EMU_Y || RPI_QPU_EMU_C ++static unsigned int mc_terminate_add_emu(const HEVCRpiContext * const s, ++ const vpu_qpu_job_h vqj, ++ rpi_cache_flush_env_t * const rfe, ++ HEVCRpiInterPredEnv * const ipe) ++{ ++ unsigned int i; ++ if (!ipe->used) { ++ return 0; ++ } ++ ++ if (ipe->curr != 0) { ++ rpi_inter_pred_sync(ipe); ++ } ++ ++ // Add final commands to Q ++ for(i = 0; i != ipe->n; ++i) { ++ HEVCRpiInterPredQ * const yp = ipe->q + i; ++ qpu_mc_src_t *const p0 = yp->last_l0; ++ qpu_mc_src_t *const p1 = yp->last_l1; ++ ++ yp->qpu_mc_curr->data[-1] = yp->code_exit; ++ ++ // Need to set the srcs for L0 & L1 to something that can be (pointlessly) prefetched ++ p0->x = MC_DUMMY_X; ++ p0->y = MC_DUMMY_Y; ++ p0->base = s->qpu_dummy_frame_emu; ++ p1->x = MC_DUMMY_X; ++ p1->y = MC_DUMMY_Y; ++ p1->base = s->qpu_dummy_frame_emu; ++ ++ yp->last_l0 = NULL; ++ yp->last_l1 = NULL; ++ } ++ ++ return 1; ++} ++#endif ++ ++ ++#if RPI_QPU_EMU_Y ++#define mc_terminate_add_y mc_terminate_add_emu ++#else ++#define mc_terminate_add_y mc_terminate_add_qpu ++#endif ++#if RPI_QPU_EMU_C ++#define mc_terminate_add_c mc_terminate_add_emu ++#else ++#define mc_terminate_add_c mc_terminate_add_qpu ++#endif ++ ++ ++static void flush_frame(HEVCRpiContext *s,AVFrame *frame) ++{ ++ rpi_cache_buf_t cbuf; ++ rpi_cache_flush_env_t * rfe = rpi_cache_flush_init(&cbuf); ++ rpi_cache_flush_add_frame(rfe, frame, RPI_CACHE_FLUSH_MODE_WB_INVALIDATE); ++ rpi_cache_flush_finish(rfe); ++} ++ ++static void job_gen_bounds(const HEVCRpiContext * const s, HEVCRpiJob * const jb) ++{ ++ const unsigned int rs0 = s->ps.pps->ctb_addr_ts_to_rs[jb->ctu_ts_first]; ++ const unsigned int rs1 = s->ps.pps->ctb_addr_ts_to_rs[jb->ctu_ts_last]; ++ const unsigned int ctb_width = s->ps.sps->ctb_width; ++ RpiBlk *const bounds = &jb->bounds; ++ av_assert1(jb->ctu_ts_first <= jb->ctu_ts_last); ++ bounds->x = (rs0 % ctb_width) << s->ps.sps->log2_ctb_size; ++ bounds->y = (rs0 / ctb_width) << s->ps.sps->log2_ctb_size; ++ bounds->w = ((rs1 - rs0) % ctb_width + 1) << s->ps.sps->log2_ctb_size; ++ bounds->h = ((rs1 - rs0) / ctb_width + 1) << s->ps.sps->log2_ctb_size; ++ ++ bounds->w = FFMIN(bounds->w, s->ps.sps->width - bounds->x); ++ bounds->h = FFMIN(bounds->h, s->ps.sps->height - bounds->y); ++} ++ ++#if RPI_PASSES == 2 ++static void worker_core2(HEVCRpiContext * const s, HEVCRpiJob * const jb) ++{ ++ // Perform intra prediction and residual reconstruction ++ rpi_execute_pred_cmds(s, jb); ++ ++ // Perform deblocking for CTBs in this row ++ rpi_execute_dblk_cmds(s, jb); ++} ++#endif ++ ++// Core execution tasks ++static void worker_core(const HEVCRpiContext * const s, HEVCRpiJob * const jb) ++{ ++ int pred_y, pred_c; ++ vpu_qpu_job_env_t qvbuf; ++ const vpu_qpu_job_h vqj = vpu_qpu_job_init(&qvbuf); ++#if RPI_WORKER_WAIT_PASS_0 ++ int do_wait; ++#endif ++ ++ { ++ const HEVCRpiCoeffsEnv * const cf = &jb->coeffs; ++ if (cf->s[3].n + cf->s[2].n != 0) ++ { ++ const unsigned int csize = sizeof(cf->s[3].buf[0]); ++ const unsigned int offset32 = ((cf->s[3].buf - cf->s[2].buf) - cf->s[3].n) * csize; ++ unsigned int n16 = (cf->s[2].n >> 8); ++ unsigned int n32 = (cf->s[3].n >> 10); ++#if RPI_COMPRESS_COEFFS ++ if (cf->s[2].packed) { ++ n16 = n16 | (n16<<16); ++ } else { ++ const unsigned int npack16 = (cf->s[2].packed_n>>8); ++ n16 = n16 | (npack16<<16); ++ } ++ if (cf->s[3].packed) { ++ n32 = n32 | (n32<<16); ++ } else { ++ const unsigned int npack32 = (cf->s[3].packed_n>>10); ++ n32 = n32 | (npack32<<16); ++ } ++#endif ++ vpu_qpu_job_add_vpu(vqj, ++ vpu_get_fn(s->ps.sps->bit_depth), ++ vpu_get_constants(), ++ cf->gptr.vc, ++ n16, ++ cf->gptr.vc + offset32, ++ n32, ++ 0); ++ ++ rpi_cache_flush_add_gm_range(jb->rfe, &cf->gptr, RPI_CACHE_FLUSH_MODE_WB_INVALIDATE, 0, cf->s[2].n * csize); ++ rpi_cache_flush_add_gm_range(jb->rfe, &cf->gptr, RPI_CACHE_FLUSH_MODE_WB_INVALIDATE, offset32, cf->s[3].n * csize); ++ } ++ } ++ ++ pred_c = mc_terminate_add_c(s, vqj, jb->rfe, &jb->chroma_ip); ++ ++// We could take a sync here and try to locally overlap QPU processing with ARM ++// but testing showed a slightly negative benefit with noticable extra complexity ++ ++ pred_y = mc_terminate_add_y(s, vqj, jb->rfe, &jb->luma_ip); ++ ++ // Returns 0 if nothing to do, 1 if sync added ++#if RPI_WORKER_WAIT_PASS_0 ++ do_wait = vpu_qpu_job_add_sync_sem(vqj, &jb->sem); ++#else ++ if (vpu_qpu_job_add_sync_sem(vqj, &jb->sem) == 0) ++ sem_post(&jb->sem); ++#endif ++ ++ rpi_cache_flush_execute(jb->rfe); ++ ++ // Await progress as required ++ // jb->waited will only be clear if we have already tested the progress values ++ // (in worker_submit_job) and found we don't have to wait ++ if (jb->waited) ++ { ++ unsigned int i; ++ for (i = 0; i != FF_ARRAY_ELEMS(jb->progress_req); ++i) { ++ if (jb->progress_req[i] >= 0) { ++ ff_hevc_rpi_progress_wait_recon(s, jb, s->DPB + i, jb->progress_req[i]); ++ } ++ } ++ } ++ ++ vpu_qpu_job_finish(vqj); ++ ++ // We always work on a rectangular block ++ if (pred_y || pred_c) ++ { ++ rpi_cache_flush_add_frame_block(jb->rfe, s->frame, RPI_CACHE_FLUSH_MODE_INVALIDATE, ++ jb->bounds.x, jb->bounds.y, jb->bounds.w, jb->bounds.h, ++ ctx_vshift(s, 1), pred_y, pred_c); ++ } ++ ++ // If we have emulated VPU ops - do it here ++#if RPI_QPU_EMU_Y || RPI_QPU_EMU_C ++ if (av_rpi_is_sand8_frame(s->frame)) ++ { ++#if RPI_QPU_EMU_Y && RPI_QPU_EMU_C ++ ff_hevc_rpi_shader_c8(s, &jb->luma_ip, &jb->chroma_ip); ++#elif RPI_QPU_EMU_Y ++ ff_hevc_rpi_shader_c8(s, &jb->luma_ip, NULL); ++#else ++ ff_hevc_rpi_shader_c8(s, NULL, &jb->chroma_ip); ++#endif ++ } ++ else ++ { ++#if RPI_QPU_EMU_Y && RPI_QPU_EMU_C ++ ff_hevc_rpi_shader_c16(s, &jb->luma_ip, &jb->chroma_ip); ++#elif RPI_QPU_EMU_Y ++ ff_hevc_rpi_shader_c16(s, &jb->luma_ip, NULL); ++#else ++ ff_hevc_rpi_shader_c16(s, NULL, &jb->chroma_ip); ++#endif ++ } ++#endif ++ ++#if RPI_WORKER_WAIT_PASS_0 ++ if (do_wait) ++ rpi_sem_wait(&jb->sem); ++ rpi_cache_flush_execute(jb->rfe); ++#endif ++} ++ ++ ++static void rpi_free_inter_pred(HEVCRpiInterPredEnv * const ipe) ++{ ++ av_freep(&ipe->q); ++ gpu_free(&ipe->gptr); ++} ++ ++static HEVCRpiJob * job_new(void) ++{ ++ HEVCRpiJob * const jb = av_mallocz(sizeof(HEVCRpiJob)); ++ ++ if (jb == NULL) ++ return NULL; ++ ++ sem_init(&jb->sem, 0, 0); ++ jb->rfe = rpi_cache_flush_init(&jb->flush_buf); ++ ff_hevc_rpi_progress_init_wait(&jb->progress_wait); ++ ++ jb->intra.n = 0; ++ if ((jb->intra.cmds = av_mallocz(sizeof(HEVCPredCmd) * RPI_MAX_PRED_CMDS)) == NULL) ++ goto fail1; ++ ++ // * Sizeof the union structure might be overkill but at the moment it ++ // is correct (it certainly isn't going to be too small) ++ // Set max fill to slack/2 from the end of the Q ++ // If we exceed this in any Q then we will schedule by size (which should ++ // mean that we never use that Q again part from syncs) ++ // * Given how agressive the overflow resonse is we could maybe put the ++ // threshold even nearer the end, but I don't expect us to ever hit ++ // it on any real stream anyway. ++ ++ if (rpi_inter_pred_alloc(&jb->chroma_ip, ++ QPU_N_MAX, QPU_N_GRP, ++ QPU_C_COMMANDS * sizeof(qpu_mc_pred_c_t) + QPU_C_SYNCS * sizeof(uint32_t), ++ QPU_C_CMD_SLACK_PER_Q * sizeof(qpu_mc_pred_c_t) / 2) != 0) ++ goto fail2; ++ if (rpi_inter_pred_alloc(&jb->luma_ip, ++ QPU_N_MAX, QPU_N_GRP, ++ QPU_Y_COMMANDS * sizeof(qpu_mc_pred_y_t) + QPU_Y_SYNCS * sizeof(uint32_t), ++ QPU_Y_CMD_SLACK_PER_Q * sizeof(qpu_mc_pred_y_t) / 2) != 0) ++ goto fail3; ++ ++ return jb; ++ ++fail3: ++ rpi_free_inter_pred(&jb->luma_ip); ++fail2: ++ av_freep(&jb->intra.cmds); ++fail1: ++ ff_hevc_rpi_progress_kill_wait(&jb->progress_wait); ++ rpi_cache_flush_finish(jb->rfe); ++ sem_destroy(&jb->sem); ++ return NULL; ++} ++ ++static void job_delete(HEVCRpiJob * const jb) ++{ ++ worker_pic_free_one(jb); ++ ff_hevc_rpi_progress_kill_wait(&jb->progress_wait); ++ rpi_free_inter_pred(&jb->chroma_ip); ++ rpi_free_inter_pred(&jb->luma_ip); ++ av_freep(&jb->intra.cmds); ++ rpi_cache_flush_finish(jb->rfe); // Not really needed - should do nothing ++ sem_destroy(&jb->sem); ++ av_free(jb); ++} ++ ++static void jbg_delete(HEVCRpiJobGlobal * const jbg) ++{ ++ HEVCRpiJob * jb; ++ ++ if (jbg == NULL) ++ return; ++ ++ jb = jbg->free1; ++ while (jb != NULL) ++ { ++ HEVCRpiJob * const jb2 = jb; ++ jb = jb2->next; ++ job_delete(jb2); ++ } ++ ++ pthread_mutex_destroy(&jbg->lock); ++ av_free(jbg); ++} ++ ++static HEVCRpiJobGlobal * jbg_new(unsigned int job_count) ++{ ++ HEVCRpiJobGlobal * const jbg = av_mallocz(sizeof(HEVCRpiJobGlobal)); ++ if (jbg == NULL) ++ return NULL; ++ ++ pthread_mutex_init(&jbg->lock, NULL); ++ ++ while (job_count-- != 0) ++ { ++ HEVCRpiJob * const jb = job_new(); ++ if (jb == NULL) ++ goto fail; ++ ++ jb->next = jbg->free1; ++ jbg->free1 = jb; ++ } ++ ++ return jbg; ++ ++fail: ++ jbg_delete(jbg); ++ return NULL; ++} ++ ++static void rpi_job_ctl_delete(HEVCRpiJobCtl * const jbc) ++{ ++ HEVCRpiJobGlobal * jbg; ++ ++ if (jbc == NULL) ++ return; ++ ++ jbg = jbc->jbg; ++ ++ if (jbc->jb1 != NULL) ++ job_delete(jbc->jb1); ++ ++ pthread_mutex_destroy(&jbc->in_lock); ++ sem_destroy(&jbc->sem_out); ++ av_free(jbc); ++ ++ // Deref the global job context ++ if (jbg != NULL && atomic_fetch_add(&jbg->ref_count, -1) == 1) ++ jbg_delete(jbg); ++} ++ ++static HEVCRpiJobCtl * rpi_job_ctl_new(HEVCRpiJobGlobal *const jbg) ++{ ++ HEVCRpiJobCtl * const jbc = av_mallocz(sizeof(HEVCRpiJobCtl)); ++ ++ if (jbc == NULL) ++ return NULL; ++ ++ jbc->jbg = jbg; ++ atomic_fetch_add(&jbg->ref_count, 1); ++ ++ sem_init(&jbc->sem_out, 0, RPI_MAX_JOBS); ++ pthread_mutex_init(&jbc->in_lock, NULL); ++ ++ if ((jbc->jb1 = job_new()) == NULL) ++ goto fail; ++ jbc->jb1->jbc_local = jbc; ++ ++ return jbc; ++ ++fail: ++ rpi_job_ctl_delete(jbc); ++ return NULL; ++} ++ ++ ++ ++static av_cold void hevc_init_worker(HEVCRpiContext * const s) ++{ ++#if RPI_PASSES == 2 ++ pass_queue_init(s->passq + 1, s, worker_core2, &s->jbc->sem_out, 1); ++#elif RPI_PASSES == 3 ++ pass_queue_init(s->passq + 2, s, rpi_execute_dblk_cmds, &s->jbc->sem_out, 2); ++ pass_queue_init(s->passq + 1, s, rpi_execute_pred_cmds, &s->passq[2].sem_in, 1); ++#else ++#error Passes confused ++#endif ++ pass_queue_init(s->passq + 0, s, worker_core, &s->passq[1].sem_in, 0); ++ ++ pass_queues_start_all(s); ++} ++ ++static av_cold void hevc_exit_worker(HEVCRpiContext *s) ++{ ++ pass_queues_term_all(s); ++ ++ pass_queues_kill_all(s); ++ ++ rpi_job_ctl_delete(s->jbc); ++ s->jbc = NULL; ++} ++ ++ ++static int slice_start(const HEVCRpiContext * const s, HEVCRpiLocalContext *const lc) ++{ ++ const int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr]; ++ const int tiles = s->ps.pps->num_tile_rows * s->ps.pps->num_tile_columns; ++ const unsigned int tile_id = s->ps.pps->tile_id[ctb_addr_ts]; ++ ++ // Check for obvious disasters ++ if (ctb_addr_ts == 0 && s->sh.dependent_slice_segment_flag) { ++ av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ // If dependant then ctb_addr_ts != 0 from previous check ++ if (s->sh.dependent_slice_segment_flag) { ++ int prev_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1]; ++ if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) { ++ av_log(s->avctx, AV_LOG_ERROR, "Previous slice segment missing\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ if (!s->ps.pps->entropy_coding_sync_enabled_flag && ++ tile_id + s->sh.num_entry_point_offsets >= tiles) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, "Entry points exceed tiles\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ // Tiled stuff must start at start of tile if it has multiple entry points ++ if (!s->ps.pps->entropy_coding_sync_enabled_flag && ++ s->sh.num_entry_point_offsets != 0 && ++ ctb_addr_ts != s->ps.pps->tile_pos_ts[tile_id]) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, "Multiple tiles in slice; slice start != tile start\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ ff_hevc_rpi_cabac_init_decoder(lc); ++ ++ // Setup any required decode vars ++ lc->cabac_init_req = !s->sh.dependent_slice_segment_flag; ++ ++// printf("SS: req=%d, sol=%d, sot=%d\n", lc->cabac_init_req, sol, sot); ++ lc->qp_y = s->sh.slice_qp; ++ ++ // General setup ++ lc->bt_line_no = 0; ++ lc->ts = ctb_addr_ts; ++ return 0; ++} ++ ++static int gen_entry_points(HEVCRpiContext * const s, const H2645NAL * const nal) ++{ ++ const GetBitContext * const gb = &s->HEVClc->gb; ++ RpiSliceHeader * const sh = &s->sh; ++ int i, j; ++ ++ const unsigned int length = nal->size; ++ unsigned int offset = ((gb->index) >> 3) + 1; // We have a bit & align still to come = +1 byte ++ unsigned int cmpt; ++ unsigned int startheader; ++ ++ if (sh->num_entry_point_offsets == 0) { ++ s->data = NULL; ++ return 0; ++ } ++ ++ // offset in slice header includes emulation prevention bytes. ++ // Unfortunately those have been removed by the time we get here so we ++ // have to compensate. The nal layer keeps a track of where they were. ++ for (j = 0, cmpt = 0, startheader = offset + sh->entry_point_offset[0]; j < nal->skipped_bytes; j++) { ++ if (nal->skipped_bytes_pos[j] >= offset && nal->skipped_bytes_pos[j] < startheader) { ++ startheader--; ++ cmpt++; ++ } ++ } ++ ++ for (i = 1; i < sh->num_entry_point_offsets; i++) { ++ offset += (sh->entry_point_offset[i - 1] - cmpt); ++ for (j = 0, cmpt = 0, startheader = offset + sh->entry_point_offset[i]; j < nal->skipped_bytes; j++) { ++ if (nal->skipped_bytes_pos[j] >= offset && nal->skipped_bytes_pos[j] < startheader) { ++ startheader--; ++ cmpt++; ++ } ++ } ++ if (sh->entry_point_offset[i] <= cmpt) { ++ av_log(s->avctx, AV_LOG_ERROR, "entry point offset <= skipped bytes\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ sh->size[i - 1] = sh->entry_point_offset[i] - cmpt; ++ sh->offset[i - 1] = offset; ++ } ++ ++ offset += sh->entry_point_offset[sh->num_entry_point_offsets - 1] - cmpt; ++ if (length < offset) { ++ av_log(s->avctx, AV_LOG_ERROR, "entry_point_offset table is corrupted\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ sh->size[sh->num_entry_point_offsets - 1] = length - offset; ++ sh->offset[sh->num_entry_point_offsets - 1] = offset; ++ ++ // Remember data start pointer as we won't have nal later ++ s->data = nal->data; ++ return 0; ++} ++ ++ ++// Return ++// < 0 Error ++// 0 OK ++// ++// jb->ctu_ts_last < 0 Job still filling ++// jb->ctu_ts_last >= 0 Job ready ++ ++static int fill_job(HEVCRpiContext * const s, HEVCRpiLocalContext *const lc, unsigned int max_blocks) ++{ ++ const unsigned int log2_ctb_size = s->ps.sps->log2_ctb_size; ++ const unsigned int ctb_size = (1 << log2_ctb_size); ++ HEVCRpiJob * const jb = lc->jb0; ++ int more_data = 1; ++ unsigned int ctb_addr_ts = lc->ts; ++ unsigned int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; ++ unsigned int x_ctb = (ctb_addr_rs % s->ps.sps->ctb_width) << log2_ctb_size; ++ const unsigned int y_ctb = (ctb_addr_rs / s->ps.sps->ctb_width) << log2_ctb_size; ++ ++ lc->unit_done = 0; ++ ++ while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) ++ { ++ int q_full; ++ const unsigned int ctb_flags = s->ps.pps->ctb_ts_flags[ctb_addr_ts]; ++ ++ hls_decode_neighbour(s, lc, x_ctb, y_ctb, ctb_addr_ts); ++ ++ ff_hevc_rpi_cabac_init(s, lc, ctb_flags); ++ ++ hls_sao_param(s, lc, x_ctb >> log2_ctb_size, y_ctb >> log2_ctb_size); ++ ++ s->deblock[ctb_addr_rs].beta_offset = s->sh.beta_offset; ++ s->deblock[ctb_addr_rs].tc_offset = s->sh.tc_offset; ++ s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; ++ ++ // Zap stashes if navail ++ if ((lc->ctb_avail & AVAIL_U) == 0) ++ zap_cabac_stash(s->cabac_stash_up + (x_ctb >> 3), log2_ctb_size - 3); ++ if ((lc->ctb_avail & AVAIL_L) == 0) ++ { ++ memset(lc->ipm_left, INTRA_DC, IPM_TAB_SIZE); ++ zap_cabac_stash(s->cabac_stash_left + (y_ctb >> 3), log2_ctb_size - 3); ++ } ++#if MVF_STASH_WIDTH > 64 ++ // Restore left mvf stash at start of tile if not at start of line ++ if ((ctb_flags & CTB_TS_FLAGS_SOTL) != 0 && x_ctb != 0 && !s->is_irap) ++ { ++ unsigned int i; ++ HEVCRpiMvField * dst = mvf_stash_ptr(s, lc, x_ctb - 1, 0); ++ const HEVCRpiMvField * src = s->mvf_left + (y_ctb >> LOG2_MIN_PU_SIZE); ++ for (i = 0; i != ctb_size >> LOG2_MIN_PU_SIZE; ++i) ++ { ++ *dst = *src++; ++ dst += MVF_STASH_WIDTH_PU; ++ } ++ } ++#endif ++ ++ // Set initial tu states ++ lc->tu.cu_qp_delta = 0; ++ lc->tu.is_cu_qp_delta_wanted = 0; ++ lc->tu.cu_chroma_qp_offset_wanted = 0; ++ ++ // Decode ++ more_data = hls_coding_quadtree(s, lc, x_ctb, y_ctb, log2_ctb_size, 0); ++ ++ if (ff_hevc_rpi_cabac_overflow(lc)) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, "Quadtree bitstream overread\n "); ++ more_data = AVERROR_INVALIDDATA; ++ } ++ ++ if (more_data < 0) { ++ s->tab_slice_address[ctb_addr_rs] = TAB_SLICE_ADDR_BROKEN; // Mark slice as broken ++ return more_data; ++ } ++ ++ if (more_data && ((ctb_flags & CTB_TS_FLAGS_EOT) != 0 || ++ (s->ps.pps->entropy_coding_sync_enabled_flag && (ctb_flags & CTB_TS_FLAGS_EOTL) != 0))) ++ { ++ if (ff_hevc_rpi_get_cabac_terminate(&lc->cc) < 0 || ++ ff_hevc_rpi_cabac_skip_bytes(&lc->cc, 0) == NULL) ++ { ++ av_log(s->avctx, AV_LOG_ERROR, "Error reading terminate el\n "); ++ return -1; ++ } ++ } ++ ++ // --- Post CTB processing ++ ++ // Stash rpl top/left for deblock that needs to remember such things cross-slice ++ s->rpl_up[x_ctb >> log2_ctb_size] = s->refPicList; ++ s->rpl_left[y_ctb >> log2_ctb_size] = s->refPicList; ++ ++ if (!s->is_irap) ++ { ++ // Copy MVF up to up-left & stash to up ++ { ++ const HEVCRpiMvField * src = mvf_stash_ptr(s, lc, x_ctb, ctb_size - 1); ++ HEVCRpiMvField * dst = s->mvf_up + (x_ctb >> LOG2_MIN_PU_SIZE); ++ ++ // printf("Stash: %d,%d, ctb_size=%d, %p->%p\n", x_ctb, y_ctb, ctb_size, src, dst); ++ ++ lc->mvf_ul[0] = dst[(ctb_size - 1) >> LOG2_MIN_PU_SIZE]; ++ memcpy(dst, src, (sizeof(*src)*ctb_size) >> LOG2_MIN_PU_SIZE); ++ } ++ // Stash sideways if end of tile line but not end of line (no point) ++ // ** Could/should do this @ end of fn ++#if MVF_STASH_WIDTH > 64 ++ if ((ctb_flags & (CTB_TS_FLAGS_EOTL | CTB_TS_FLAGS_EOL)) == CTB_TS_FLAGS_EOTL) ++#endif ++ { ++ unsigned int i; ++ const HEVCRpiMvField * src = mvf_stash_ptr(s, lc, x_ctb + ctb_size - 1, 0); ++ HEVCRpiMvField * dst = s->mvf_left + (y_ctb >> LOG2_MIN_PU_SIZE); ++ for (i = 0; i != ctb_size >> LOG2_MIN_PU_SIZE; ++i) ++ { ++ *dst++ = *src; ++ src += MVF_STASH_WIDTH_PU; ++ } ++ } ++ } ++ ++ if ((ctb_flags & CTB_TS_FLAGS_CSAVE) != 0) ++ ff_hevc_rpi_save_states(s, lc); ++ ++ // Report progress so we can use our MVs in other frames ++ if ((ctb_flags & CTB_TS_FLAGS_EOL) != 0) ++ ff_hevc_rpi_progress_signal_mv(s, y_ctb + ctb_size - 1); ++ ++ // End of line || End of tile line || End of tile ++ // (EoL covers end of frame for our purposes here) ++ q_full = ((ctb_flags & CTB_TS_FLAGS_EOTL) != 0); ++ ++ // Allocate QPU chunks on fixed size 64 pel boundries rather than ++ // whatever ctb_size is today. ++ // * We might quite like to continue to 64 pel vertical too but that ++ // currently confuses WPP ++ if (((x_ctb + ctb_size) & 63) == 0 || q_full) ++ { ++ int overflow = 0; ++ if (rpi_inter_pred_next_ctu(&jb->luma_ip) != 0) ++ overflow = 1; ++ if (rpi_inter_pred_next_ctu(&jb->chroma_ip) != 0) ++ overflow = 1; ++ if (overflow) ++ { ++ // * This is very annoying (and slow) to cope with in WPP so ++ // we treat it as an error there (no known stream triggers this ++ // with the current buffer sizes). Non-wpp should cope fine. ++ av_log(s->avctx, AV_LOG_WARNING, "%s: Q full before EoL\n", __func__); ++ q_full = 1; ++ } ++ } ++ ++ // Inc TS to next. ++ ctb_addr_ts++; ++ ctb_addr_rs++; ++ x_ctb += ctb_size; ++ ++ if (q_full) ++ { ++ // Do job ++ // Prep for submission ++ jb->ctu_ts_last = ctb_addr_ts - 1; // Was pre-inced ++ job_gen_bounds(s, jb); ++ break; ++ } ++ ++ // If max_blocks started as 0 then this will never be true ++ if (--max_blocks == 0) ++ break; ++ } ++ ++ lc->unit_done = (more_data <= 0); ++ lc->ts = ctb_addr_ts; ++ return 0; ++} ++ ++static void bt_lc_init(HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, const unsigned int n) ++{ ++ lc->context = s; ++ lc->jb0 = NULL; ++ lc->lc_n = n; ++ lc->bt_terminate = 0; ++ lc->bt_psem_out = NULL; ++ sem_init(&lc->bt_sem_in, 0, 0); ++} ++ ++#define TRACE_WPP 0 ++#if RPI_EXTRA_BIT_THREADS > 0 ++static inline unsigned int line_ts_width(const HEVCRpiContext * const s, unsigned int ts) ++{ ++ unsigned int rs = s->ps.pps->ctb_addr_ts_to_rs[ts]; ++ return s->ps.pps->column_width[s->ps.pps->col_idxX[rs % s->ps.sps->ctb_width]]; ++} ++ ++// Move local context parameters from an aux bit thread back to the main ++// thread at the end of a slice as processing is going to continue there. ++static void movlc(HEVCRpiLocalContext *const dst_lc, HEVCRpiLocalContext *const src_lc, const int is_dep) ++{ ++ if (src_lc == dst_lc) { ++ return; ++ } ++ ++ // Move the job ++ // We will still have an active job if the final line terminates early ++ // Dest should always be null by now ++ av_assert1(dst_lc->jb0 == NULL); ++ dst_lc->jb0 = src_lc->jb0; ++ src_lc->jb0 = NULL; ++ ++ // Always need to store where we are in the bitstream ++ dst_lc->ts = src_lc->ts; ++ dst_lc->gb = src_lc->gb; ++ // Cabac init request will be built at start of next slice ++ ++ // Need to store context if we might have a dependent seg ++ if (is_dep) ++ { ++ dst_lc->qPy_pred = src_lc->qPy_pred; ++ memcpy(dst_lc->ipm_left, src_lc->ipm_left, sizeof(src_lc->ipm_left)); ++ memcpy(dst_lc->cabac_state, src_lc->cabac_state, sizeof(src_lc->cabac_state)); ++ memcpy(dst_lc->stat_coeff, src_lc->stat_coeff, sizeof(src_lc->stat_coeff)); ++ } ++} ++ ++static inline int wait_bt_sem_in(HEVCRpiLocalContext * const lc) ++{ ++ rpi_sem_wait(&lc->bt_sem_in); ++ return lc->bt_terminate; ++} ++ ++// Do one WPP line ++// Will not work correctly over horizontal tile boundries - vertical should be OK ++static int rpi_run_one_line(HEVCRpiContext *const s, HEVCRpiLocalContext * const lc, const int is_first) ++{ ++ const int is_tile = lc->bt_is_tile; ++ const unsigned int tile_id = s->ps.pps->tile_id[lc->ts]; ++ const unsigned int line = lc->bt_line_no; ++ const unsigned int line_inc = lc->bt_line_inc; ++ const int is_last = (line >= lc->bt_last_line); ++ ++ const unsigned int ts_eol = lc->ts + (is_tile ? s->ps.pps->tile_size[tile_id] : lc->bt_line_width); ++ const unsigned int ts_next = ++ line + line_inc > (unsigned int)s->sh.num_entry_point_offsets ? ++ INT_MAX : ++ is_tile ? ++ s->ps.pps->tile_pos_ts[tile_id + line_inc] : ++ lc->ts + lc->bt_line_width * line_inc; ++ // Tile wants line, WPP a few CTUs (must be >= 2 for cabac context to work) ++ const unsigned int partial_size = is_tile ? line_ts_width(s, lc->ts) : 2; ++ unsigned int ts_prev; ++ int loop_n = 0; ++ int err = 0; ++ ++ av_assert1(line <= s->sh.num_entry_point_offsets); ++ ++#if TRACE_WPP ++ printf("%s[%d]: Start %s: tile=%d, line=%d/%d/%d, ts=%d/%d/%d, width=%d, jb=%p\n", __func__, ++ lc->lc_n, is_tile ? "Tile" : "WPP", tile_id, ++ line, lc->bt_last_line, s->sh.num_entry_point_offsets, ++ lc->ts, ts_eol, ts_next, partial_size, lc->jb0); ++#endif ++ if (line != 0) ++ { ++ const uint8_t * const data = s->data + s->sh.offset[line - 1]; ++ const unsigned int len = s->sh.size[line - 1]; ++ if ((err = init_get_bits8(&lc->gb, data, len)) < 0) ++ return err; ++ ++ ff_init_cabac_decoder(&lc->cc, data, len); ++ } ++ ++ // We should never be processing a dependent slice here so reset is good ++ // ?? These probably shouldn't be needed (as they should be set by later ++ // logic) but do seem to be required ++ lc->qp_y = s->sh.slice_qp; ++ ++ do ++ { ++ if (!is_last && loop_n > 1) { ++#if TRACE_WPP ++ printf("%s[%d]: %sPoke %p\n", __func__, lc->lc_n, err == 0 ? "" : "ERR: ", lc->bt_psem_out); ++#endif ++ sem_post(lc->bt_psem_out); ++ } ++ // The wait for loop_n == 0 has been done in bit_thread ++ if (!is_first && loop_n != 0) ++ { ++#if TRACE_WPP ++ printf("%s[%d]: %sWait %p\n", __func__, lc->lc_n, err == 0 ? "" : "ERR: ", &lc->bt_sem_in); ++#endif ++ if (wait_bt_sem_in(lc) != 0) ++ return AVERROR_EXIT; ++ } ++ ++#if TRACE_WPP ++ { ++ int n; ++ sem_getvalue(&lc->bt_sem_in, &n); ++ printf("%s[%d]: ts=%d, sem=%d %p\n", __func__, lc->lc_n, lc->ts, n, &lc->bt_sem_in); ++ } ++#endif ++ ++ ts_prev = lc->ts; ++ ++ // If we have had an error - do no further decode but do continue ++ // moving signals around so the other threads continue to operate ++ // correctly (or at least as correctly as they can with this line missing) ++ // ++ // Errors in WPP/Tile are less fatal than normal as we have a good idea ++ // of how to restart on the next line so there is no need to give up totally ++ if (err != 0) ++ { ++ lc->unit_done = 0; ++ lc->ts += partial_size; ++ } ++ else ++ { ++ worker_pass0_ready(s, lc); ++ ++ if ((err = fill_job(s, lc, partial_size)) < 0 || ++ (lc->ts < ts_eol && !is_last && (lc->ts != ts_prev + partial_size || lc->unit_done))) ++ { ++ if (err == 0) { ++ av_log(s->avctx, AV_LOG_ERROR, "Unexpected end of tile/wpp section\n"); ++ err = AVERROR_INVALIDDATA; ++ } ++ worker_free(s, lc); ++ lc->ts = ts_prev + partial_size; // Pretend we did all that ++ lc->unit_done = 0; ++ } ++ else if (is_tile) ++ { ++ worker_submit_job(s, lc); ++ } ++ } ++ ++ ++loop_n; ++ } while (lc->ts < ts_eol && !lc->unit_done); ++ ++ // If we are on the last line & we didn't get a whole line we must wait for ++ // and sink the sem_posts from the line above / tile to the left. ++ while ((ts_prev += partial_size) < ts_eol) ++ { ++#if TRACE_WPP ++ printf("%s[%d]: EOL Wait: ts=%d %p\n", __func__, lc->lc_n, ts_prev, &lc->bt_sem_in); ++#endif ++ if (wait_bt_sem_in(lc) != 0) ++ return AVERROR_EXIT; ++ } ++ ++ lc->bt_line_no += line_inc; ++ ++ if (!is_tile && err == 0) ++ worker_submit_job(s, lc); ++ ++ if (!is_last) { ++ lc->ts = ts_next; ++ ++#if TRACE_WPP ++ printf("%s[%d]: Poke post submit %p\n", __func__, lc->lc_n, lc->bt_psem_out); ++#endif ++ sem_post(lc->bt_psem_out); ++ if (loop_n > 1) { ++#if TRACE_WPP ++ printf("%s[%d]: Poke post submit2 %p\n", __func__, lc->lc_n, lc->bt_psem_out); ++#endif ++ sem_post(lc->bt_psem_out); ++ } ++ } ++ else ++ { ++ movlc(s->HEVClcList[0], lc, s->ps.pps->dependent_slice_segments_enabled_flag); // * & not EoT ++#if MVF_STASH_WIDTH > 64 ++ // Horrid calculations to work out what we want but luckily this should almost never execute ++ // **** Move to movlc ++ if (!s->is_irap) ++ { ++ const unsigned int ctb_flags = s->ps.pps->ctb_ts_flags[lc->ts]; ++ if ((ctb_flags & CTB_TS_FLAGS_EOTL) == 0) // If EOTL then we have already stashed mvf ++ { ++ const unsigned int x_ctb = ((s->ps.pps->ctb_addr_ts_to_rs[lc->ts] % s->ps.sps->ctb_width) << s->ps.sps->log2_ctb_size) - 1; ++ unsigned int i; ++ const HEVCRpiMvField *s_mvf = lc->mvf_stash + ((x_ctb >> LOG2_MIN_PU_SIZE) & (MVF_STASH_WIDTH_PU - 1)); ++ HEVCRpiMvField *d_mvf = s->HEVClcList[0]->mvf_stash + ((x_ctb >> LOG2_MIN_PU_SIZE) & (MVF_STASH_WIDTH_PU - 1)); ++ ++ for (i = 0; i != MVF_STASH_HEIGHT_PU; ++i) ++ { ++ *d_mvf = *s_mvf; ++ d_mvf += MVF_STASH_WIDTH_PU; ++ s_mvf += MVF_STASH_WIDTH_PU; ++ } ++ ++ } ++ } ++#endif ++ // When all done poke the thread 0 sem_in one final time ++#if TRACE_WPP ++ printf("%s[%d]: Poke final %p\n", __func__, lc->lc_n, &s->HEVClcList[0]->bt_sem_in); ++#endif ++ sem_post(&s->HEVClcList[0]->bt_sem_in); ++ } ++ ++#if TRACE_WPP ++ printf("%s[%d]: End. dep=%d\n", __func__, lc->lc_n, s->ps.pps->dependent_slice_segments_enabled_flag); ++#endif ++ return err; ++} ++ ++static void wpp_setup_lcs(HEVCRpiContext * const s) ++{ ++ unsigned int ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr]; ++ const unsigned int line_width = line_ts_width(s, ts); ++ ++ for (int i = 0; i <= s->sh.num_entry_point_offsets && i < RPI_BIT_THREADS; ++i) ++ { ++ HEVCRpiLocalContext * const lc = s->HEVClcList[i]; ++ lc->ts = ts; ++ lc->bt_is_tile = 0; ++ lc->bt_line_no = i; ++ lc->bt_line_width = line_width; ++ lc->bt_last_line = s->sh.num_entry_point_offsets; ++ lc->bt_line_inc = RPI_BIT_THREADS; ++ ts += line_width; ++ } ++} ++ ++ ++// Can only process tile single row at once ++static void tile_one_row_setup_lcs(HEVCRpiContext * const s, unsigned int slice_row) ++{ ++ const HEVCRpiPPS * const pps = s->ps.pps; ++ const unsigned int ts0 = pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr]; ++ const unsigned int tile0 = pps->tile_id[ts0]; ++ const unsigned int col0 = tile0 % pps->num_tile_columns; ++ ++ const unsigned int col = (slice_row == 0) ? col0 : 0; ++ unsigned int line = slice_row * pps->num_tile_columns - col0 + col; ++ const unsigned int last_line = FFMIN( ++ line + pps->num_tile_columns - 1 - col, s->sh.num_entry_point_offsets); ++ ++ const unsigned int par = ++ FFMIN(RPI_BIT_THREADS, last_line + 1 - line); ++#if TRACE_WPP ++ printf("ts0=%d, ents=%d, row=%d, tiles=%dx%d, col=%d, par=%d, line=%d/%d\n", ts0, s->sh.num_entry_point_offsets, slice_row, ++ pps->num_tile_columns, pps->num_tile_rows, col, par, line, last_line); ++#endif ++ for (unsigned int i = 0; i != par; ++i, ++line) ++ { ++ HEVCRpiLocalContext * const lc = s->HEVClcList[i]; ++ const unsigned int tile = tile0 + line; ++ ++ lc->ts = pps->tile_pos_ts[tile]; ++ lc->bt_line_no = line; ++ lc->bt_is_tile = 1; ++ lc->bt_line_width = line_ts_width(s, lc->ts); ++ lc->bt_last_line = last_line; ++ lc->bt_line_inc = par; ++ } ++} ++ ++ ++static void * bit_thread(void * v) ++{ ++ HEVCRpiLocalContext * const lc = v; ++ HEVCRpiContext *const s = lc->context; ++ ++ while (wait_bt_sem_in(lc) == 0) ++ { ++ int err; ++ ++ if ((err = rpi_run_one_line(s, lc, 0)) < 0) { // Never first tile/wpp ++ if (lc->bt_terminate) { ++ av_log(s->avctx, AV_LOG_ERROR, "%s: Unexpected termination\n", __func__); ++ break; ++ } ++ av_log(s->avctx, AV_LOG_WARNING, "%s: Decode failure: %d\n", __func__, err); ++ } ++ } ++ ++ return NULL; ++} ++ ++static int bit_threads_start(HEVCRpiContext * const s) ++{ ++ if (s->bt_started) ++ return 0; ++ ++ for (int i = 1; i < RPI_BIT_THREADS; ++i) ++ { ++ // lc[0] belongs to the main thread - this sets up lc[1..RPI_BIT_THREADS] ++ if (s->HEVClcList[i] == NULL) { ++ if ((s->HEVClcList[i] = av_mallocz(sizeof(*s->HEVClcList[0]))) == NULL) ++ return -1; ++ } ++ ++ bt_lc_init(s, s->HEVClcList[i], i); ++ job_lc_init(s->HEVClcList[i]); ++ } ++ ++ // Link the sems in a circle ++ for (int i = 0; i < RPI_BIT_THREADS - 1; ++i) ++ s->HEVClcList[i]->bt_psem_out = &s->HEVClcList[i + 1]->bt_sem_in; ++ s->HEVClcList[RPI_BIT_THREADS - 1]->bt_psem_out = &s->HEVClcList[0]->bt_sem_in; ++ ++ // Init all lc before starting any threads ++ for (int i = 0; i < RPI_EXTRA_BIT_THREADS; ++i) ++ { ++ if (pthread_create(s->bit_threads + i, NULL, bit_thread, s->HEVClcList[i + 1]) < 0) ++ return -1; ++ } ++ ++ s->bt_started = 1; ++ return 0; ++} ++ ++static int bit_threads_kill(HEVCRpiContext * const s) ++{ ++ if (!s->bt_started) ++ return 0; ++ s->bt_started = 0; ++ ++ for (int i = 0; i < RPI_EXTRA_BIT_THREADS; ++i) ++ { ++ HEVCRpiLocalContext *const lc = s->HEVClcList[i + 1]; ++ if (lc == NULL) ++ break; ++ ++ lc->bt_terminate = 1; ++ sem_post(&lc->bt_sem_in); ++ pthread_join(s->bit_threads[i], NULL); ++ ++ sem_destroy(&lc->bt_sem_in); ++ job_lc_kill(lc); ++ } ++ return 0; ++} ++#endif ++ ++ ++// If we are at EoT and the row is shorter than the number of jobs ++// we can Q we have to wait for it finish otherwise we risk cache/QPU ++// disasters ++static inline int tile_needs_wait(const HEVCRpiContext * const s, const int n) ++{ ++ return ++ s->ps.pps->tile_wpp_inter_disable >= 2 && ++ s->sh.slice_type != HEVC_SLICE_I && ++ n >= 0 && ++ (s->ps.pps->ctb_ts_flags[n] & (CTB_TS_FLAGS_EOT | CTB_TS_FLAGS_EOL)) == CTB_TS_FLAGS_EOT; ++} ++ ++static int rpi_decode_entry(AVCodecContext *avctxt, void *isFilterThread) ++{ ++ HEVCRpiContext * const s = avctxt->priv_data; ++ HEVCRpiLocalContext * const lc = s->HEVClc; ++ int err; ++ ++ // Start of slice ++ if ((err = slice_start(s, lc)) != 0) ++ return err; ++ ++#if RPI_EXTRA_BIT_THREADS > 0 ++ ++ if (s->sh.offload_tiles) ++ { ++ unsigned int slice_row = 0; ++ ++#if TRACE_WPP ++ printf("%s: Do Tiles\n", __func__); ++#endif ++ // Generate & start extra bit threads if they aren't already running ++ bit_threads_start(s); ++ ++ do ++ { ++ // Reset lc lines etc. ++ tile_one_row_setup_lcs(s, slice_row); ++ ++#if TRACE_WPP ++ printf("%s: Row %d: Do 1st: line=%d/%d/%d\n", ++ __func__, slice_row, lc->bt_line_no, lc->bt_last_line, s->sh.num_entry_point_offsets); ++#endif ++ ++ rpi_run_one_line(s, lc, 1); // Kicks off the other threads ++#if TRACE_WPP ++ printf("%s: Row %d: Done 1st: line=%d/%d/%d\n", ++ __func__, slice_row, lc->bt_line_no, lc->bt_last_line, s->sh.num_entry_point_offsets); ++#endif ++ ++ while (lc->bt_line_no <= lc->bt_last_line) { ++ rpi_sem_wait(&lc->bt_sem_in); ++ rpi_run_one_line(s, lc, 0); ++ } ++#if TRACE_WPP ++ printf("%s: Done body\n", __func__); ++#endif ++ ++ // Wait for everything else to finish ++ rpi_sem_wait(&lc->bt_sem_in); ++ ++ ++slice_row; ++ } while (lc->bt_last_line < s->sh.num_entry_point_offsets); ++ ++ ++#if TRACE_WPP ++ printf("%s: Done wait: ts=%d\n", __func__, lc->ts); ++#endif ++ } ++ else if (s->sh.offload_wpp) ++ { ++#if TRACE_WPP ++ printf("%s: Do WPP\n", __func__); ++#endif ++ // Generate & start extra bit threads if they aren't already running ++ bit_threads_start(s); ++ ++ // Reset lc lines etc. ++ wpp_setup_lcs(s); ++ ++ rpi_run_one_line(s, lc, 1); // Kicks off the other threads ++#if TRACE_WPP ++ printf("%s: Done 1st\n", __func__); ++#endif ++ ++ while (lc->bt_line_no <= s->sh.num_entry_point_offsets) { ++ rpi_sem_wait(&lc->bt_sem_in); ++ rpi_run_one_line(s, lc, 0); ++ } ++#if TRACE_WPP ++ printf("%s: Done body\n", __func__); ++#endif ++ ++ // Wait for everything else to finish ++ rpi_sem_wait(&lc->bt_sem_in); ++ ++#if TRACE_WPP ++ printf("%s: Done wait: ts=%d\n", __func__, lc->ts); ++#endif ++ } ++ else ++#endif ++ { ++#if TRACE_WPP ++ printf("%s: Single start: ts=%d\n", __func__, lc->ts); ++#endif ++ // Single bit thread ++ do { ++ // Make sure we have space to prepare the next job ++ worker_pass0_ready(s, lc); ++ ++ if ((err = fill_job(s, lc, 0)) < 0) ++ goto fail; ++ ++ worker_submit_job(s, lc); ++ ++ if (tile_needs_wait(s, lc->ts - 1)) ++ worker_wait(s, lc); ++ ++ } while (!lc->unit_done); ++ ++#if TRACE_WPP ++ printf("%s: Single end: ts=%d\n", __func__, lc->ts); ++#endif ++ } ++ ++ // If we have reached the end of the frame or ++ // then wait for the worker to finish all its jobs ++ if (lc->ts >= s->ps.sps->ctb_size) ++ worker_wait(s, lc); ++ ++#if RPI_TSTATS ++ { ++ HEVCRpiStats *const ts = &s->tstats; ++ ++ printf("=== P: xy00:%5d/%5d/%5d/%5d h16gl:%5d/%5d w8gl:%5d/%5d y8m:%d\n B: xy00:%5d/%5d/%5d/%5d h16gl:%5d/%5d\n", ++ ts->y_pred1_xy, ts->y_pred1_x0, ts->y_pred1_y0, ts->y_pred1_x0y0, ++ ts->y_pred1_hgt16, ts->y_pred1_hle16, ts->y_pred1_wgt8, ts->y_pred1_wle8, ts->y_pred1_y8_merge, ++ ts->y_pred2_xy, ts->y_pred2_x0, ts->y_pred2_y0, ts->y_pred2_x0y0, ++ ts->y_pred2_hgt16, ts->y_pred2_hle16); ++ memset(ts, 0, sizeof(*ts)); ++ } ++#endif ++ ++ return lc->ts; ++ ++fail: ++ // Cleanup ++ av_log(s->avctx, AV_LOG_ERROR, "%s failed: err=%d\n", __func__, err); ++ // Free our job & wait for temination ++ worker_free(s, lc); ++ worker_wait(s, lc); ++ return err; ++} ++ ++ ++static void set_no_backward_pred(HEVCRpiContext * const s) ++{ ++ int i, j; ++ const RefPicList *const refPicList = s->refPicList; ++ ++ s->no_backward_pred_flag = 0; ++ if (s->sh.slice_type != HEVC_SLICE_B || !s->sh.slice_temporal_mvp_enabled_flag) ++ return; ++ ++ for (j = 0; j < 2; j++) { ++ for (i = 0; i < refPicList[j].nb_refs; i++) { ++ if (refPicList[j].list[i] > s->poc) { ++ s->no_backward_pred_flag = 1; ++ return; ++ } ++ } ++ } ++} ++ ++static int hls_slice_data(HEVCRpiContext * const s, const H2645NAL * const nal) ++{ ++ int err; ++ if ((err = gen_entry_points(s, nal)) < 0) ++ return err; ++ ++ set_no_backward_pred(s); ++ ++ return rpi_decode_entry(s->avctx, NULL); ++} ++ ++static int set_side_data(HEVCRpiContext *s) ++{ ++ AVFrame *out = s->ref->frame; ++ ++ if (s->sei.frame_packing.present && ++ s->sei.frame_packing.arrangement_type >= 3 && ++ s->sei.frame_packing.arrangement_type <= 5 && ++ s->sei.frame_packing.content_interpretation_type > 0 && ++ s->sei.frame_packing.content_interpretation_type < 3) { ++ AVStereo3D *stereo = av_stereo3d_create_side_data(out); ++ if (!stereo) ++ return AVERROR(ENOMEM); ++ ++ switch (s->sei.frame_packing.arrangement_type) { ++ case 3: ++ if (s->sei.frame_packing.quincunx_subsampling) ++ stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX; ++ else ++ stereo->type = AV_STEREO3D_SIDEBYSIDE; ++ break; ++ case 4: ++ stereo->type = AV_STEREO3D_TOPBOTTOM; ++ break; ++ case 5: ++ stereo->type = AV_STEREO3D_FRAMESEQUENCE; ++ break; ++ } ++ ++ if (s->sei.frame_packing.content_interpretation_type == 2) ++ stereo->flags = AV_STEREO3D_FLAG_INVERT; ++ ++ if (s->sei.frame_packing.arrangement_type == 5) { ++ if (s->sei.frame_packing.current_frame_is_frame0_flag) ++ stereo->view = AV_STEREO3D_VIEW_LEFT; ++ else ++ stereo->view = AV_STEREO3D_VIEW_RIGHT; ++ } ++ } ++ ++ if (s->sei.display_orientation.present && ++ (s->sei.display_orientation.anticlockwise_rotation || ++ s->sei.display_orientation.hflip || s->sei.display_orientation.vflip)) { ++ double angle = s->sei.display_orientation.anticlockwise_rotation * 360 / (double) (1 << 16); ++ AVFrameSideData *rotation = av_frame_new_side_data(out, ++ AV_FRAME_DATA_DISPLAYMATRIX, ++ sizeof(int32_t) * 9); ++ if (!rotation) ++ return AVERROR(ENOMEM); ++ ++ av_display_rotation_set((int32_t *)rotation->data, angle); ++ av_display_matrix_flip((int32_t *)rotation->data, ++ s->sei.display_orientation.hflip, ++ s->sei.display_orientation.vflip); ++ } ++ ++ // Decrement the mastering display flag when IRAP frame has no_rasl_output_flag=1 ++ // so the side data persists for the entire coded video sequence. ++ if (s->sei.mastering_display.present > 0 && ++ IS_IRAP(s) && s->no_rasl_output_flag) { ++ s->sei.mastering_display.present--; ++ } ++ if (s->sei.mastering_display.present) { ++ // HEVC uses a g,b,r ordering, which we convert to a more natural r,g,b ++ const int mapping[3] = {2, 0, 1}; ++ const int chroma_den = 50000; ++ const int luma_den = 10000; ++ int i; ++ AVMasteringDisplayMetadata *metadata = ++ av_mastering_display_metadata_create_side_data(out); ++ if (!metadata) ++ return AVERROR(ENOMEM); ++ ++ for (i = 0; i < 3; i++) { ++ const int j = mapping[i]; ++ metadata->display_primaries[i][0].num = s->sei.mastering_display.display_primaries[j][0]; ++ metadata->display_primaries[i][0].den = chroma_den; ++ metadata->display_primaries[i][1].num = s->sei.mastering_display.display_primaries[j][1]; ++ metadata->display_primaries[i][1].den = chroma_den; ++ } ++ metadata->white_point[0].num = s->sei.mastering_display.white_point[0]; ++ metadata->white_point[0].den = chroma_den; ++ metadata->white_point[1].num = s->sei.mastering_display.white_point[1]; ++ metadata->white_point[1].den = chroma_den; ++ ++ metadata->max_luminance.num = s->sei.mastering_display.max_luminance; ++ metadata->max_luminance.den = luma_den; ++ metadata->min_luminance.num = s->sei.mastering_display.min_luminance; ++ metadata->min_luminance.den = luma_den; ++ metadata->has_luminance = 1; ++ metadata->has_primaries = 1; ++ ++ av_log(s->avctx, AV_LOG_DEBUG, "Mastering Display Metadata:\n"); ++ av_log(s->avctx, AV_LOG_DEBUG, ++ "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f)\n", ++ av_q2d(metadata->display_primaries[0][0]), ++ av_q2d(metadata->display_primaries[0][1]), ++ av_q2d(metadata->display_primaries[1][0]), ++ av_q2d(metadata->display_primaries[1][1]), ++ av_q2d(metadata->display_primaries[2][0]), ++ av_q2d(metadata->display_primaries[2][1]), ++ av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1])); ++ av_log(s->avctx, AV_LOG_DEBUG, ++ "min_luminance=%f, max_luminance=%f\n", ++ av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance)); ++ } ++ // Decrement the mastering display flag when IRAP frame has no_rasl_output_flag=1 ++ // so the side data persists for the entire coded video sequence. ++ if (s->sei.content_light.present > 0 && ++ IS_IRAP(s) && s->no_rasl_output_flag) { ++ s->sei.content_light.present--; ++ } ++ if (s->sei.content_light.present) { ++ AVContentLightMetadata *metadata = ++ av_content_light_metadata_create_side_data(out); ++ if (!metadata) ++ return AVERROR(ENOMEM); ++ metadata->MaxCLL = s->sei.content_light.max_content_light_level; ++ metadata->MaxFALL = s->sei.content_light.max_pic_average_light_level; ++ ++ av_log(s->avctx, AV_LOG_DEBUG, "Content Light Level Metadata:\n"); ++ av_log(s->avctx, AV_LOG_DEBUG, "MaxCLL=%d, MaxFALL=%d\n", ++ metadata->MaxCLL, metadata->MaxFALL); ++ } ++ ++ if (s->sei.a53_caption.a53_caption) { ++ AVFrameSideData* sd = av_frame_new_side_data(out, ++ AV_FRAME_DATA_A53_CC, ++ s->sei.a53_caption.a53_caption_size); ++ if (sd) ++ memcpy(sd->data, s->sei.a53_caption.a53_caption, s->sei.a53_caption.a53_caption_size); ++ av_freep(&s->sei.a53_caption.a53_caption); ++ s->sei.a53_caption.a53_caption_size = 0; ++ s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS; ++ } ++ ++ if (s->sei.alternative_transfer.present && ++ av_color_transfer_name(s->sei.alternative_transfer.preferred_transfer_characteristics) && ++ s->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) { ++ s->avctx->color_trc = out->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics; ++ } ++ ++ return 0; ++} ++ ++static int hevc_frame_start(HEVCRpiContext * const s) ++{ ++ int ret; ++ ++ memset(s->bs_horizontal, 0, s->bs_size * 2); // Does V too ++ memset(s->is_pcm, 0, s->ps.sps->pcm_width * s->ps.sps->pcm_height); ++ memset(s->tab_slice_address, -1, s->ps.sps->ctb_size * sizeof(*s->tab_slice_address)); ++ ++ // Only need to remember intra for CIP ++ if (!s->ps.pps->constrained_intra_pred_flag || s->is_irap) ++ s->is_intra = NULL; ++ else ++ { ++ s->is_intra = s->is_intra_store; ++ memset(s->is_intra, 0, s->ps.sps->pcm_width * s->ps.sps->pcm_height); ++ } ++ ++ s->is_decoded = 0; ++ s->first_nal_type = s->nal_unit_type; ++ ++ s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos); ++ ++ if (s->pkt.nb_nals > s->rpl_tab_size) ++ { ++ // In most cases it will be faster to free & realloc as that doesn't ++ // require (an unwanted) copy ++ av_freep(&s->rpl_tab); ++ s->rpl_tab_size = 0; ++ if ((s->rpl_tab = av_malloc(s->pkt.nb_nals * sizeof(*s->rpl_tab))) == NULL) ++ goto fail; ++ s->rpl_tab_size = s->pkt.nb_nals; ++ } ++ memset(s->rpl_tab, 0, s->pkt.nb_nals * sizeof(*s->rpl_tab)); ++ ++ ret = ff_hevc_rpi_set_new_ref(s, &s->frame, s->poc); ++ if (ret < 0) ++ goto fail; ++ ++ // Resize rpl_tab to max that we might want ++ ret = ff_hevc_rpi_frame_rps(s); ++ if (ret < 0) { ++ av_log(s->avctx, AV_LOG_ERROR, "Error constructing the frame RPS.\n"); ++ goto fail; ++ } ++ ++ s->ref->frame->key_frame = IS_IRAP(s); ++ ++ ret = set_side_data(s); ++ if (ret < 0) ++ goto fail; ++ ++ s->frame->pict_type = 3 - s->sh.slice_type; ++ ++ if (!IS_IRAP(s)) ++ ff_hevc_rpi_bump_frame(s); ++ ++ av_frame_unref(s->output_frame); ++ ret = ff_hevc_rpi_output_frame(s, s->output_frame, 0); ++ if (ret < 0) ++ goto fail; ++ ++ ff_thread_finish_setup(s->avctx); ++ ++ return 0; ++ ++fail: ++ if (s->ref) ++ ff_hevc_rpi_unref_frame(s, s->ref, ~0); ++ s->ref = NULL; ++ return ret; ++} ++ ++static inline int is_non_ref_unit_type(const unsigned int nal_unit_type) ++{ ++ // From Table 7-1 ++ return (nal_unit_type & ~0xe) == 0; // True for 0, 2, 4, 6, 8, 10, 12, 14 ++} ++ ++static int decode_nal_unit(HEVCRpiContext *s, const H2645NAL *nal) ++{ ++ GetBitContext * const gb = &s->HEVClc->gb; ++ int ctb_addr_ts, ret; ++ ++ *gb = nal->gb; ++ s->nal_unit_type = nal->type; ++ s->temporal_id = nal->temporal_id; ++ ++ switch (s->nal_unit_type) { ++ case HEVC_NAL_VPS: ++ ret = ff_hevc_rpi_decode_nal_vps(gb, s->avctx, &s->ps); ++ if (ret < 0) ++ goto fail; ++ break; ++ case HEVC_NAL_SPS: ++ ret = ff_hevc_rpi_decode_nal_sps(gb, s->avctx, &s->ps, ++ s->apply_defdispwin); ++ if (ret < 0) ++ goto fail; ++ break; ++ case HEVC_NAL_PPS: ++ ret = ff_hevc_rpi_decode_nal_pps(gb, s->avctx, &s->ps); ++ if (ret < 0) ++ goto fail; ++ break; ++ case HEVC_NAL_SEI_PREFIX: ++ case HEVC_NAL_SEI_SUFFIX: ++ ret = ff_hevc_rpi_decode_nal_sei(gb, s->avctx, &s->sei, &s->ps, s->nal_unit_type); ++ if (ret < 0) ++ goto fail; ++ break; ++ case HEVC_NAL_TRAIL_R: ++ case HEVC_NAL_TRAIL_N: ++ case HEVC_NAL_TSA_N: ++ case HEVC_NAL_TSA_R: ++ case HEVC_NAL_STSA_N: ++ case HEVC_NAL_STSA_R: ++ case HEVC_NAL_BLA_W_LP: ++ case HEVC_NAL_BLA_W_RADL: ++ case HEVC_NAL_BLA_N_LP: ++ case HEVC_NAL_IDR_W_RADL: ++ case HEVC_NAL_IDR_N_LP: ++ case HEVC_NAL_CRA_NUT: ++ case HEVC_NAL_RADL_N: ++ case HEVC_NAL_RADL_R: ++ case HEVC_NAL_RASL_N: ++ case HEVC_NAL_RASL_R: ++ ret = hls_slice_header(s); ++ if (ret < 0) ++ return ret; ++ ++ // The definition of _N unit types is "non-reference for other frames ++ // with the same temporal_id" so they may/will be ref frames for pics ++ // with a higher temporal_id. ++ s->used_for_ref = s->ps.sps->max_sub_layers > s->temporal_id + 1 || ++ !is_non_ref_unit_type(s->nal_unit_type); ++ s->offload_recon = s->threads_type != 0 && s->used_for_ref; ++ s->is_irap = IS_IRAP(s); ++ ++#if DEBUG_DECODE_N ++ { ++ static int z = 0; ++ if (IS_IDR(s)) { ++ z = 1; ++ } ++ if (z != 0 && z++ > DEBUG_DECODE_N) { ++ s->is_decoded = 0; ++ break; ++ } ++ } ++#endif ++ if ( ++ (s->avctx->skip_frame >= AVDISCARD_NONREF && !s->used_for_ref) || ++ (s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || ++ (s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) || ++ (s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IRAP(s))) ++ { ++ s->is_decoded = 0; ++ break; ++ } ++ ++ if (s->sh.first_slice_in_pic_flag) { ++ if (s->max_ra == INT_MAX) { ++ if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { ++ s->max_ra = s->poc; ++ } else { ++ if (IS_IDR(s)) ++ s->max_ra = INT_MIN; ++ } ++ } ++ ++ if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && ++ s->poc <= s->max_ra) { ++ s->is_decoded = 0; ++ break; ++ } else { ++ if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra) ++ s->max_ra = INT_MIN; ++ } ++ ++ ret = hevc_frame_start(s); ++ if (ret < 0) ++ return ret; ++ } else if (!s->ref) { ++ av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n"); ++ goto fail; ++ } ++ ++ if (s->nal_unit_type != s->first_nal_type) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Non-matching NAL types of the VCL NALUs: %d %d\n", ++ s->first_nal_type, s->nal_unit_type); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (!s->sh.dependent_slice_segment_flag && ++ s->sh.slice_type != HEVC_SLICE_I) { ++ ret = ff_hevc_rpi_slice_rpl(s); ++ if (ret < 0) { ++ av_log(s->avctx, AV_LOG_WARNING, ++ "Error constructing the reference lists for the current slice.\n"); ++ goto fail; ++ } ++ } ++ ++ ctb_addr_ts = hls_slice_data(s, nal); ++ if (ctb_addr_ts >= s->ps.sps->ctb_size) { ++ s->is_decoded = 1; ++ } ++ ++ if (ctb_addr_ts < 0) { ++ ret = ctb_addr_ts; ++ goto fail; ++ } ++ break; ++ case HEVC_NAL_EOS_NUT: ++ case HEVC_NAL_EOB_NUT: ++ s->seq_decode = (s->seq_decode + 1) & 0xff; ++ s->max_ra = INT_MAX; ++ break; ++ case HEVC_NAL_AUD: ++ case HEVC_NAL_FD_NUT: ++ break; ++ default: ++ av_log(s->avctx, AV_LOG_INFO, ++ "Skipping NAL unit %d\n", s->nal_unit_type); ++ } ++ ++ return 0; ++fail: ++ if (s->avctx->err_recognition & AV_EF_EXPLODE) ++ return ret; ++ return 0; ++} ++ ++static int decode_nal_units(HEVCRpiContext *s, const uint8_t *buf, int length) ++{ ++ int i, ret = 0; ++ int eos_at_start = 1; ++ ++ s->ref = NULL; ++ s->last_eos = s->eos; ++ s->eos = 0; ++ ++ /* split the input packet into NAL units, so we know the upper bound on the ++ * number of slices in the frame */ ++ ret = ff_h2645_packet_split(&s->pkt, buf, length, s->avctx, s->is_nalff, ++ s->nal_length_size, s->avctx->codec_id, 0, 0); ++ if (ret < 0) { ++ av_log(s->avctx, AV_LOG_ERROR, ++ "Error splitting the input into NAL units.\n"); ++ return ret; ++ } ++ ++ for (i = 0; i < s->pkt.nb_nals; i++) { ++ if (s->pkt.nals[i].type == HEVC_NAL_EOB_NUT || ++ s->pkt.nals[i].type == HEVC_NAL_EOS_NUT) { ++ if (eos_at_start) { ++ s->last_eos = 1; ++ } else { ++ s->eos = 1; ++ } ++ } else { ++ eos_at_start = 0; ++ } ++ } ++ ++ /* decode the NAL units */ ++ for (i = 0; i < s->pkt.nb_nals; i++) { ++ ret = decode_nal_unit(s, &s->pkt.nals[i]); ++ if (ret < 0) { ++ av_log(s->avctx, AV_LOG_WARNING, ++ "Error parsing NAL unit #%d.\n", i); ++ goto fail; ++ } ++ } ++ ++fail: // Also success path ++ if (s->ref != NULL) { ++ if (s->used_for_ref && s->threads_type != 0) { ++ ff_hevc_rpi_progress_signal_all_done(s); ++ } ++ else { ++ // Flush frame to real memory as we expect to be able to pass ++ // it straight on to mmal ++ flush_frame(s, s->frame); ++ } ++ } ++ return ret; ++} ++ ++static void print_md5(void *log_ctx, int level, uint8_t md5[16]) ++{ ++ int i; ++ for (i = 0; i < 16; i++) ++ av_log(log_ctx, level, "%02"PRIx8, md5[i]); ++} ++ ++static int verify_md5(HEVCRpiContext *s, AVFrame *frame) ++{ ++ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); ++ int pixel_shift; ++ int i, j; ++ ++ if (!desc) ++ return AVERROR(EINVAL); ++ ++ pixel_shift = desc->comp[0].depth > 8; ++ ++ av_log(s->avctx, AV_LOG_DEBUG, "Verifying checksum for frame with POC %d: ", ++ s->poc); ++ ++ /* the checksums are LE, so we have to byteswap for >8bpp formats ++ * on BE arches */ ++#if HAVE_BIGENDIAN ++ if (pixel_shift && !s->checksum_buf) { ++ av_fast_malloc(&s->checksum_buf, &s->checksum_buf_size, ++ FFMAX3(frame->linesize[0], frame->linesize[1], ++ frame->linesize[2])); ++ if (!s->checksum_buf) ++ return AVERROR(ENOMEM); ++ } ++#endif ++ ++ for (i = 0; frame->data[i]; i++) { ++ int width = s->avctx->coded_width; ++ int height = s->avctx->coded_height; ++ int w = (i == 1 || i == 2) ? (width >> desc->log2_chroma_w) : width; ++ int h = (i == 1 || i == 2) ? (height >> desc->log2_chroma_h) : height; ++ uint8_t md5[16]; ++ ++ av_md5_init(s->md5_ctx); ++ for (j = 0; j < h; j++) { ++ const uint8_t *src = frame->data[i] + j * frame_stride1(frame, 1); ++#if HAVE_BIGENDIAN ++ if (pixel_shift) { ++ s->bdsp.bswap16_buf((uint16_t *) s->checksum_buf, ++ (const uint16_t *) src, w); ++ src = s->checksum_buf; ++ } ++#endif ++ av_md5_update(s->md5_ctx, src, w << pixel_shift); ++ } ++ av_md5_final(s->md5_ctx, md5); ++ ++ if (!memcmp(md5, s->sei.picture_hash.md5[i], 16)) { ++ av_log (s->avctx, AV_LOG_DEBUG, "plane %d - correct ", i); ++ print_md5(s->avctx, AV_LOG_DEBUG, md5); ++ av_log (s->avctx, AV_LOG_DEBUG, "; "); ++ } else { ++ av_log (s->avctx, AV_LOG_ERROR, "mismatching checksum of plane %d - ", i); ++ print_md5(s->avctx, AV_LOG_ERROR, md5); ++ av_log (s->avctx, AV_LOG_ERROR, " != "); ++ print_md5(s->avctx, AV_LOG_ERROR, s->sei.picture_hash.md5[i]); ++ av_log (s->avctx, AV_LOG_ERROR, "\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ av_log(s->avctx, AV_LOG_DEBUG, "\n"); ++ ++ return 0; ++} ++ ++static int all_sps_supported(const HEVCRpiContext * const s) ++{ ++ for (unsigned int i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) { ++ if (s->ps.sps_list[i] != NULL) ++ { ++ const HEVCRpiSPS * const sps = (const HEVCRpiSPS*)s->ps.sps_list[i]->data; ++ if (!is_sps_supported(sps)) ++ return 0; ++ } ++ } ++ return 1; ++} ++ ++static int hevc_rpi_decode_extradata(HEVCRpiContext *s, uint8_t *buf, int length, int first) ++{ ++ int ret, i; ++ ++ ret = ff_hevc_rpi_decode_extradata(buf, length, &s->ps, &s->sei, &s->is_nalff, ++ &s->nal_length_size, s->avctx->err_recognition, ++ s->apply_defdispwin, s->avctx); ++ if (ret < 0) ++ return ret; ++ ++ /* export stream parameters from the first SPS */ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) { ++ if (first && s->ps.sps_list[i]) { ++ const HEVCRpiSPS *sps = (const HEVCRpiSPS*)s->ps.sps_list[i]->data; ++ export_stream_params(s->avctx, &s->ps, sps); ++ break; ++ } ++ } ++ ++ return 0; ++} ++ ++static int hevc_rpi_decode_frame(AVCodecContext *avctx, void *data, int *got_output, ++ AVPacket *avpkt) ++{ ++ int ret; ++ int new_extradata_size; ++ uint8_t *new_extradata; ++ HEVCRpiContext *s = avctx->priv_data; ++ ++ if (!avpkt->size) { ++ ret = ff_hevc_rpi_output_frame(s, data, 1); ++ if (ret < 0) ++ return ret; ++ ++ *got_output = ret; ++ return 0; ++ } ++ ++ new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, ++ &new_extradata_size); ++ if (new_extradata && new_extradata_size > 0) { ++ ret = hevc_rpi_decode_extradata(s, new_extradata, new_extradata_size, 0); ++ if (ret < 0) ++ return ret; ++ } ++ ++ s->ref = NULL; ++ ret = decode_nal_units(s, avpkt->data, avpkt->size); ++ if (ret < 0) ++ return ret; ++ ++ /* verify the SEI checksum */ ++ if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded && ++ s->sei.picture_hash.is_md5) { ++ ret = verify_md5(s, s->ref->frame); ++ if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) { ++ ff_hevc_rpi_unref_frame(s, s->ref, ~0); ++ return ret; ++ } ++ } ++ s->sei.picture_hash.is_md5 = 0; ++ ++ if (s->is_decoded) { ++ av_log(avctx, AV_LOG_DEBUG, "Decoded frame with POC %d.\n", s->poc); ++ s->is_decoded = 0; ++ } ++ ++ if (s->output_frame->buf[0]) { ++ av_frame_move_ref(data, s->output_frame); ++ *got_output = 1; ++ } ++ ++ return avpkt->size; ++} ++ ++static int hevc_ref_frame(HEVCRpiContext *s, HEVCRpiFrame *dst, HEVCRpiFrame *src) ++{ ++ int ret; ++ ++ ret = ff_thread_ref_frame(&dst->tf, &src->tf); ++ if (ret < 0) ++ return ret; ++ ++ if (src->col_mvf_buf != NULL) ++ { ++ dst->col_mvf_buf = av_buffer_ref(src->col_mvf_buf); ++ if (!dst->col_mvf_buf) ++ goto fail; ++ } ++ dst->col_mvf = src->col_mvf; ++ ++ dst->poc = src->poc; ++ dst->flags = src->flags; ++ dst->sequence = src->sequence; ++ return 0; ++ ++fail: ++ ff_hevc_rpi_unref_frame(s, dst, ~0); ++ return AVERROR(ENOMEM); ++} ++ ++ ++static av_cold int hevc_decode_free(AVCodecContext *avctx) ++{ ++ HEVCRpiContext * const s = avctx->priv_data; ++ int i; ++ ++ pic_arrays_free(s); ++ ++ av_freep(&s->md5_ctx); ++ ++ av_freep(&s->cabac_save); ++ ++#if RPI_EXTRA_BIT_THREADS ++ bit_threads_kill(s); ++#endif ++ ++ hevc_exit_worker(s); ++ for (i = 0; i != 2; ++i) { ++ ff_hevc_rpi_progress_kill_state(s->progress_states + i); ++ } ++ job_lc_kill(s->HEVClc); ++ ++ av_freep(&s->sao_pixel_buffer_h[0]); // [1] & [2] allocated with [0] ++ av_freep(&s->sao_pixel_buffer_v[0]); ++ av_frame_free(&s->output_frame); ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ ff_hevc_rpi_unref_frame(s, &s->DPB[i], ~0); ++ av_frame_free(&s->DPB[i].frame); ++ } ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.vps_list); i++) ++ av_buffer_unref(&s->ps.vps_list[i]); ++ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) ++ av_buffer_unref(&s->ps.sps_list[i]); ++ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++) ++ av_buffer_unref(&s->ps.pps_list[i]); ++ s->ps.sps = NULL; ++ s->ps.pps = NULL; ++ s->ps.vps = NULL; ++ ++ // Free separately from sLists as used that way by RPI WPP ++ for (i = 0; i < MAX_NB_THREADS && s->HEVClcList[i] != NULL; ++i) { ++ av_freep(s->HEVClcList + i); ++ } ++ s->HEVClc = NULL; // Allocated as part of HEVClcList ++ ++ ff_h2645_packet_uninit(&s->pkt); ++ ++ if (s->qpu_init_ok) ++ vpu_qpu_term(); ++ s->qpu_init_ok = 0; ++ ++ return 0; ++} ++ ++ ++static av_cold int hevc_init_context(AVCodecContext *avctx) ++{ ++ HEVCRpiContext *s = avctx->priv_data; ++ int i; ++ ++ s->avctx = avctx; ++ ++ s->HEVClc = av_mallocz(sizeof(HEVCRpiLocalContext)); ++ if (!s->HEVClc) ++ goto fail; ++ s->HEVClcList[0] = s->HEVClc; ++ ++ if (vpu_qpu_init() != 0) ++ goto fail; ++ s->qpu_init_ok = 1; ++ ++#if RPI_QPU_EMU_Y || RPI_QPU_EMU_C ++ { ++ static const uint32_t dframe[1] = {0x80808080}; ++ s->qpu_dummy_frame_emu = (const uint8_t *)dframe; ++ } ++#endif ++#if !RPI_QPU_EMU_Y || !RPI_QPU_EMU_C ++ s->qpu_dummy_frame_qpu = qpu_dummy(); ++#endif ++ ++ bt_lc_init(s, s->HEVClc, 0); ++ job_lc_init(s->HEVClc); ++ ++ for (i = 0; i != 2; ++i) { ++ ff_hevc_rpi_progress_init_state(s->progress_states + i); ++ } ++ ++ if ((s->cabac_save = av_malloc(sizeof(*s->cabac_save))) == NULL) ++ goto fail; ++ ++ if ((s->output_frame = av_frame_alloc()) == NULL) ++ goto fail; ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ s->DPB[i].frame = av_frame_alloc(); ++ if (!s->DPB[i].frame) ++ goto fail; ++ s->DPB[i].tf.f = s->DPB[i].frame; ++ s->DPB[i].dpb_no = i; ++ } ++ ++ s->max_ra = INT_MAX; ++ ++ if ((s->md5_ctx = av_md5_alloc()) == NULL) ++ goto fail; ++ ++ s->context_initialized = 1; ++ s->eos = 0; ++ ++ ff_hevc_rpi_reset_sei(&s->sei); ++ ++ return 0; ++ ++fail: ++ av_log(s->avctx, AV_LOG_ERROR, "%s: Failed\n", __func__); ++ hevc_decode_free(avctx); ++ return AVERROR(ENOMEM); ++} ++ ++#if HAVE_THREADS ++static int hevc_update_thread_context(AVCodecContext *dst, ++ const AVCodecContext *src) ++{ ++ HEVCRpiContext *s = dst->priv_data; ++ HEVCRpiContext *s0 = src->priv_data; ++ int i, ret; ++ ++ av_assert0(s->context_initialized); ++ ++ // dst == src can happen according to the comments and in that case ++ // there is nothing to do here ++ if (dst == src) ++ return 0; ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { ++ ff_hevc_rpi_unref_frame(s, &s->DPB[i], ~0); ++ if (s0->DPB[i].frame->buf[0]) { ++ ret = hevc_ref_frame(s, &s->DPB[i], &s0->DPB[i]); ++ if (ret < 0) ++ return ret; ++ } ++ } ++ ++ if (s->ps.sps != s0->ps.sps) ++ s->ps.sps = NULL; ++ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.vps_list); i++) { ++ av_buffer_unref(&s->ps.vps_list[i]); ++ if (s0->ps.vps_list[i]) { ++ s->ps.vps_list[i] = av_buffer_ref(s0->ps.vps_list[i]); ++ if (!s->ps.vps_list[i]) ++ return AVERROR(ENOMEM); ++ } ++ } ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) { ++ av_buffer_unref(&s->ps.sps_list[i]); ++ if (s0->ps.sps_list[i]) { ++ s->ps.sps_list[i] = av_buffer_ref(s0->ps.sps_list[i]); ++ if (!s->ps.sps_list[i]) ++ return AVERROR(ENOMEM); ++ } ++ } ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(s->ps.pps_list); i++) { ++ av_buffer_unref(&s->ps.pps_list[i]); ++ if (s0->ps.pps_list[i]) { ++ s->ps.pps_list[i] = av_buffer_ref(s0->ps.pps_list[i]); ++ if (!s->ps.pps_list[i]) ++ return AVERROR(ENOMEM); ++ } ++ } ++ ++ if (s->ps.sps != s0->ps.sps) ++ if ((ret = set_sps(s, s0->ps.sps, src->pix_fmt)) < 0) ++ return ret; ++ ++ s->seq_decode = s0->seq_decode; ++ s->seq_output = s0->seq_output; ++ s->pocTid0 = s0->pocTid0; ++ s->max_ra = s0->max_ra; ++ s->eos = s0->eos; ++ s->no_rasl_output_flag = s0->no_rasl_output_flag; ++ ++ s->is_nalff = s0->is_nalff; ++ s->nal_length_size = s0->nal_length_size; ++ ++ s->threads_type = s0->threads_type; ++ ++ if (s0->eos) { ++ s->seq_decode = (s->seq_decode + 1) & 0xff; ++ s->max_ra = INT_MAX; ++ } ++ ++ s->sei.frame_packing = s0->sei.frame_packing; ++ s->sei.display_orientation = s0->sei.display_orientation; ++ s->sei.mastering_display = s0->sei.mastering_display; ++ s->sei.content_light = s0->sei.content_light; ++ s->sei.alternative_transfer = s0->sei.alternative_transfer; ++ ++ // * We do this here as it allows us to easily locate our parents ++ // global job pool, but there really should be a less nasty way ++ if (s->jbc == NULL) ++ { ++ av_assert0((s->jbc = rpi_job_ctl_new(s0->jbc->jbg)) != NULL); ++ hevc_init_worker(s); ++ } ++ ++ return 0; ++} ++#endif ++ ++#include ++static int qpu_ok(void) ++{ ++ static int is_pi3 = -1; ++ if (is_pi3 == -1) ++ { ++ struct stat sb; ++ is_pi3 = (stat("/dev/rpivid-intcmem", &sb) != 0); ++ } ++ return is_pi3; ++} ++ ++static av_cold int hevc_decode_init(AVCodecContext *avctx) ++{ ++ HEVCRpiContext *s = avctx->priv_data; ++ int ret; ++ ++ if (!qpu_ok()) ++ return AVERROR_DECODER_NOT_FOUND; ++ ++ if ((ret = hevc_init_context(avctx)) < 0) ++ return ret; ++ ++ // If we are a child context then stop now ++ // Everything after this point is either 1st decode setup or global alloc ++ // that must not be repeated ++ // Global info will be copied into children in update_thread_context (we ++ // can't do it here as we have no way of finding the parent context) ++ if (avctx->internal->is_copy) ++ return 0; ++ ++ // Job allocation requires VCSM alloc to work so ensure that we have it ++ // initialised by this point ++ { ++ HEVCRpiJobGlobal * const jbg = jbg_new(FFMAX(avctx->thread_count * 3, 5)); ++ if (jbg == NULL) { ++ av_log(s->avctx, AV_LOG_ERROR, "%s: Job global init failed\n", __func__); ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ if ((s->jbc = rpi_job_ctl_new(jbg)) == NULL) { ++ av_log(s->avctx, AV_LOG_ERROR, "%s: Job ctl init failed\n", __func__); ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ } ++ ++ hevc_init_worker(s); ++ ++ s->eos = 1; ++ ++ if (avctx->extradata_size > 0 && avctx->extradata) { ++ if ((ret = hevc_rpi_decode_extradata(s, avctx->extradata, avctx->extradata_size, 1)) < 0) ++ goto fail; ++ ++ if (!all_sps_supported(s)) { ++ ret = AVERROR_DECODER_NOT_FOUND; ++ goto fail; ++ } ++ } ++ ++ if((avctx->active_thread_type & FF_THREAD_FRAME) && avctx->thread_count > 1) ++ s->threads_type = FF_THREAD_FRAME; ++ else ++ s->threads_type = 0; ++ ++ return 0; ++ ++fail: ++ hevc_decode_free(avctx); ++ return ret; ++} ++ ++static void hevc_decode_flush(AVCodecContext *avctx) ++{ ++ HEVCRpiContext *s = avctx->priv_data; ++ ff_hevc_rpi_flush_dpb(s); ++ s->max_ra = INT_MAX; ++ s->eos = 1; ++} ++ ++typedef struct hwaccel_rpi3_qpu_env_s { ++ const AVClass *av_class; ++ AVZcEnvPtr zc; ++} hwaccel_rpi3_qpu_env_t; ++ ++static int hwaccel_alloc_frame(AVCodecContext *s, AVFrame *frame) ++{ ++ hwaccel_rpi3_qpu_env_t * const r3 = s->internal->hwaccel_priv_data; ++ int rv; ++ ++ if (av_rpi_zc_in_use(s)) ++ { ++ rv = s->get_buffer2(s, frame, 0); ++ } ++ else ++ { ++ rv = av_rpi_zc_get_buffer(r3->zc, frame); ++ if (rv == 0) ++ rv = av_rpi_zc_resolve_frame(frame, ZC_RESOLVE_ALLOC_VALID); // actually do the alloc ++ } ++ ++ if (rv == 0 && ++ (rv = ff_attach_decode_data(frame)) < 0) ++ { ++ av_frame_unref(frame); ++ } ++ ++ return rv; ++} ++ ++static int hwaccel_rpi3_qpu_free(AVCodecContext *avctx) ++{ ++ hwaccel_rpi3_qpu_env_t * const r3 = avctx->internal->hwaccel_priv_data; ++ av_rpi_zc_int_env_freep(&r3->zc); ++ return 0; ++} ++ ++static int hwaccel_rpi3_qpu_init(AVCodecContext *avctx) ++{ ++ hwaccel_rpi3_qpu_env_t * const r3 = avctx->internal->hwaccel_priv_data; ++ ++ if ((r3->zc = av_rpi_zc_int_env_alloc(avctx)) == NULL) ++ goto fail; ++ ++ return 0; ++ ++fail: ++ av_log(avctx, AV_LOG_ERROR, "Rpi3 QPU init failed\n"); ++ hwaccel_rpi3_qpu_free(avctx); ++ return AVERROR(ENOMEM); ++} ++ ++ ++#define OFFSET(x) offsetof(HEVCRpiContext, x) ++#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) ++ ++ ++static const AVOption options[] = { ++ { "apply_defdispwin", "Apply default display window from VUI", OFFSET(apply_defdispwin), ++ AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, PAR }, ++ { "strict-displaywin", "stricly apply default display window size", OFFSET(apply_defdispwin), ++ AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, PAR }, ++ { NULL }, ++}; ++ ++static const AVClass hevc_rpi_decoder_class = { ++ .class_name = "HEVC RPI decoder", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++static const enum AVPixelFormat hevc_rpi_pix_fmts[] = { ++ AV_PIX_FMT_SAND128, ++ AV_PIX_FMT_SAND64_10, ++ AV_PIX_FMT_NONE ++}; ++ ++ ++static const AVHWAccel hwaccel_rpi3_qpu = { ++ .name = "Pi3 QPU Hwaccel", ++ .alloc_frame = hwaccel_alloc_frame, ++ .init = hwaccel_rpi3_qpu_init, ++ .uninit = hwaccel_rpi3_qpu_free, ++ .priv_data_size = sizeof(hwaccel_rpi3_qpu_env_t), ++ .caps_internal = HWACCEL_CAP_ASYNC_SAFE | HWACCEL_CAP_MT_SAFE, ++}; ++ ++static const AVCodecHWConfigInternal hevc_rpi_hw_config_sand128 = ++{ ++ .public = { ++ .pix_fmt = AV_PIX_FMT_SAND128, ++ .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC, ++ .device_type = AV_HWDEVICE_TYPE_NONE, ++ }, ++ .hwaccel = &hwaccel_rpi3_qpu ++}; ++static const AVCodecHWConfigInternal hevc_rpi_hw_config_sand64_10 = ++{ ++ .public = { ++ .pix_fmt = AV_PIX_FMT_SAND64_10, ++ .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC, ++ .device_type = AV_HWDEVICE_TYPE_NONE, ++ }, ++ .hwaccel = &hwaccel_rpi3_qpu ++}; ++ ++ ++static const AVCodecHWConfigInternal *hevc_rpi_hw_configs[] = { ++ &hevc_rpi_hw_config_sand128, ++ &hevc_rpi_hw_config_sand64_10, ++ NULL ++}; ++ ++ ++AVCodec ff_hevc_rpi_decoder = { ++ .name = "hevc_rpi", ++ .long_name = NULL_IF_CONFIG_SMALL("HEVC (rpi)"), ++ .type = AVMEDIA_TYPE_VIDEO, ++ .id = AV_CODEC_ID_HEVC, ++ .priv_data_size = sizeof(HEVCRpiContext), ++ .priv_class = &hevc_rpi_decoder_class, ++ .init = hevc_decode_init, ++ .close = hevc_decode_free, ++ .decode = hevc_rpi_decode_frame, ++ .flush = hevc_decode_flush, ++ .update_thread_context = ONLY_IF_THREADS_ENABLED(hevc_update_thread_context), ++ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | ++ AV_CODEC_CAP_HARDWARE | ++ AV_CODEC_CAP_AVOID_PROBING | ++#if 0 ++ // Debugging is often easier without threads getting in the way ++ 0, ++#warning H265 threading turned off ++#else ++ // We only have decent optimisation for frame - so only admit to that ++ AV_CODEC_CAP_FRAME_THREADS, ++#endif ++ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | ++ FF_CODEC_CAP_EXPORTS_CROPPING | ++ FF_CODEC_CAP_ALLOCATE_PROGRESS, ++ .pix_fmts = hevc_rpi_pix_fmts, ++ .profiles = NULL_IF_CONFIG_SMALL(ff_hevc_profiles), ++ .hw_configs = hevc_rpi_hw_configs, ++// .wrapper_name = "hevc_rpi", ++}; ++ +--- /dev/null ++++ b/libavcodec/rpi_hevcdec.h +@@ -0,0 +1,1091 @@ ++/* ++ * HEVC video decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_RPI_HEVCDEC_H ++#define AVCODEC_RPI_HEVCDEC_H ++ ++#include "config.h" ++ ++#include ++ ++#include "libavutil/buffer.h" ++ ++#include "avcodec.h" ++#include "bswapdsp.h" ++#include "cabac.h" ++#include "get_bits.h" ++#include "rpi_hevcpred.h" ++#include "h2645_parse.h" ++#include "hevc.h" ++#include "rpi_hevc_mv.h" ++#include "rpi_hevc_ps.h" ++#include "rpi_hevc_sei.h" ++#include "rpi_hevcdsp.h" ++#include "internal.h" ++#include "thread.h" ++#include "videodsp.h" ++ ++#if ARCH_ARM ++#include "arm/rpi_hevc_misc_neon.h" ++#endif ++ ++#define MAX_NB_THREADS 16 ++#define SHIFT_CTB_WPP 2 ++ ++//TODO: check if this is really the maximum ++#define MAX_TRANSFORM_DEPTH 5 ++ ++#define MAX_TB_SIZE 32 ++#define MAX_QP 51 ++#define DEFAULT_INTRA_TC_OFFSET 2 ++ ++#define HEVC_CONTEXTS 199 ++ ++#define MRG_MAX_NUM_CANDS 5 ++ ++#define HEVC_MAX_CTB_SIZE (1 << HEVC_MAX_LOG2_CTB_SIZE) // 64 ++ ++// Size of DPB array ++#define HEVC_DPB_ELS 32 ++ ++#define L0 0 ++#define L1 1 ++ ++#define EPEL_EXTRA_BEFORE 1 ++#define EPEL_EXTRA_AFTER 2 ++#define EPEL_EXTRA 3 ++#define QPEL_EXTRA_BEFORE 3 ++#define QPEL_EXTRA_AFTER 4 ++#define QPEL_EXTRA 7 ++ ++#define EDGE_EMU_BUFFER_STRIDE 80 ++ ++#include ++#include "rpi_qpu.h" ++ ++// Max jobs per frame thread. Actual usage will be limited by the size ++// of the global job pool ++// ?? Limits ++#define RPI_MAX_JOBS 8 ++ ++// This is the number of _extra_ bit threads - we will have ++// RPI_EXTRA_BIT_THREADS+1 threads actually doing the processing ++// ++// 0 is legitimate and will disable our WPP processing ++//#define RPI_EXTRA_BIT_THREADS 0 ++#define RPI_EXTRA_BIT_THREADS 2 ++ ++// Number of separate threads/passes in worker ++// 2 and 3 are the currently valid numbers ++// At the moment 3 seems fractionally faster ++//#define RPI_PASSES 2 ++#define RPI_PASSES 3 ++ ++// Print out various usage stats ++#define RPI_TSTATS 0 ++ ++// Define RPI_COMPRESS_COEFFS to 1 to send coefficients in compressed form ++#define RPI_COMPRESS_COEFFS 1 ++ ++// Wait for VPU/QPU to finish in worker pass 0 ++// If 0 then the wait is in pass 1 ++// ++// One might expect the better place to wait would be in pass 1 however ++// testing shows that pass 0 produces overall faster decode. ++// Interestingly it is QPU/VPU limited streams that seem to suffer ++// from pass 1 waits, CPU limited ones tend to show a very mild gain. ++// This define exists so it is easy to test this. ++#define RPI_WORKER_WAIT_PASS_0 1 ++ ++// Use ARM emulation of QPU pred ++// These are for debug only as the emulation makes only limited ++// effort to be fast ++#define RPI_QPU_EMU_Y 0 ++#define RPI_QPU_EMU_C 0 ++ ++// Max width & height we are prepared to consider ++// Sand frame shape calc becomes confused with large frames ++// Some buffer alloc also depends on this ++#define HEVC_RPI_MAX_WIDTH 2048 ++#define HEVC_RPI_MAX_HEIGHT 1088 ++ ++ ++// Min CTB size is 16 ++#define HEVC_RPI_MAX_CTBS ((HEVC_RPI_MAX_WIDTH + 15) / 16) * ((HEVC_RPI_MAX_HEIGHT + 15) / 16) ++ ++/** ++ * Value of the luma sample at position (x, y) in the 2D array tab. ++ */ ++#define SAMPLE(tab, x, y) ((tab)[(y) * s->sps->width + (x)]) ++#define SAMPLE_CTB(tab, x, y) ((tab)[(y) * min_cb_width + (x)]) ++ ++#define IS_IDR(s) ((s)->nal_unit_type == HEVC_NAL_IDR_W_RADL || (s)->nal_unit_type == HEVC_NAL_IDR_N_LP) ++#define IS_BLA(s) ((s)->nal_unit_type == HEVC_NAL_BLA_W_RADL || (s)->nal_unit_type == HEVC_NAL_BLA_W_LP || \ ++ (s)->nal_unit_type == HEVC_NAL_BLA_N_LP) ++#define IS_IRAP(s) ((s)->nal_unit_type >= 16 && (s)->nal_unit_type <= 23) ++ ++enum RPSType { ++ ST_CURR_BEF = 0, ++ ST_CURR_AFT, ++ ST_FOLL, ++ LT_CURR, ++ LT_FOLL, ++ NB_RPS_TYPE, ++}; ++ ++enum SyntaxElement { ++ SAO_MERGE_FLAG = 0, ++ SAO_TYPE_IDX, ++ SAO_EO_CLASS, ++ SAO_BAND_POSITION, ++ SAO_OFFSET_ABS, ++ SAO_OFFSET_SIGN, ++ END_OF_SLICE_FLAG, ++ SPLIT_CODING_UNIT_FLAG, ++ CU_TRANSQUANT_BYPASS_FLAG, ++ SKIP_FLAG, ++ CU_QP_DELTA, ++ PRED_MODE_FLAG, ++ PART_MODE, ++ PCM_FLAG, ++ PREV_INTRA_LUMA_PRED_FLAG, ++ MPM_IDX, ++ REM_INTRA_LUMA_PRED_MODE, ++ INTRA_CHROMA_PRED_MODE, ++ MERGE_FLAG, ++ MERGE_IDX, ++ INTER_PRED_IDC, ++ REF_IDX_L0, ++ REF_IDX_L1, ++ ABS_MVD_GREATER0_FLAG, ++ ABS_MVD_GREATER1_FLAG, ++ ABS_MVD_MINUS2, ++ MVD_SIGN_FLAG, ++ MVP_LX_FLAG, ++ NO_RESIDUAL_DATA_FLAG, ++ SPLIT_TRANSFORM_FLAG, ++ CBF_LUMA, ++ CBF_CB_CR, ++ TRANSFORM_SKIP_FLAG, ++ EXPLICIT_RDPCM_FLAG, ++ EXPLICIT_RDPCM_DIR_FLAG, ++ LAST_SIGNIFICANT_COEFF_X_PREFIX, ++ LAST_SIGNIFICANT_COEFF_Y_PREFIX, ++ LAST_SIGNIFICANT_COEFF_X_SUFFIX, ++ LAST_SIGNIFICANT_COEFF_Y_SUFFIX, ++ SIGNIFICANT_COEFF_GROUP_FLAG, ++ SIGNIFICANT_COEFF_FLAG, ++ COEFF_ABS_LEVEL_GREATER1_FLAG, ++ COEFF_ABS_LEVEL_GREATER2_FLAG, ++ COEFF_ABS_LEVEL_REMAINING, ++ COEFF_SIGN_FLAG, ++ LOG2_RES_SCALE_ABS, ++ RES_SCALE_SIGN_FLAG, ++ CU_CHROMA_QP_OFFSET_FLAG, ++ CU_CHROMA_QP_OFFSET_IDX, ++}; ++ ++enum PartMode { ++ PART_2Nx2N = 0, ++ PART_2NxN = 1, ++ PART_Nx2N = 2, ++ PART_NxN = 3, ++ PART_2NxnU = 4, ++ PART_2NxnD = 5, ++ PART_nLx2N = 6, ++ PART_nRx2N = 7, ++}; ++ ++enum PredMode { ++ MODE_INTER = 0, ++ MODE_INTRA, ++ MODE_SKIP, ++}; ++ ++enum InterPredIdc { ++ PRED_L0 = 0, ++ PRED_L1, ++ PRED_BI, ++}; ++ ++enum PredFlag { ++ PF_INTRA = 0, ++ PF_L0, ++ PF_L1, ++ PF_BI, ++}; ++ ++enum SAOType { ++ SAO_NOT_APPLIED = 0, ++ SAO_BAND, ++ SAO_EDGE, ++ SAO_APPLIED ++}; ++ ++enum SAOEOClass { ++ SAO_EO_HORIZ = 0, ++ SAO_EO_VERT, ++ SAO_EO_135D, ++ SAO_EO_45D, ++}; ++ ++enum ScanType { ++ SCAN_DIAG = 0, ++ SCAN_HORIZ, ++ SCAN_VERT, ++}; ++ ++typedef struct RefPicList { ++ struct HEVCRpiFrame *ref[HEVC_MAX_REFS]; ++ int list[HEVC_MAX_REFS]; ++ uint8_t isLongTerm[HEVC_MAX_REFS]; ++ int nb_refs; ++} RefPicList; ++ ++typedef struct RefPicListTab { ++ RefPicList refPicList[2]; ++} RefPicListTab; ++ ++typedef struct RpiCodingUnit { ++ unsigned int x; // Passed to deblock ++ unsigned int y; ++ unsigned int x_split; ++ unsigned int y_split; ++ ++ enum PredMode pred_mode; ///< PredMode ++ enum PartMode part_mode; ///< PartMode ++ ++ // Inferred parameters ++ uint8_t intra_split_flag; ///< IntraSplitFlag ++ uint8_t max_trafo_depth; ///< MaxTrafoDepth ++ uint8_t cu_transquant_bypass_flag; ++} RpiCodingUnit; ++ ++typedef struct RpiPredictionUnit { ++ uint8_t intra_pred_mode[4]; ++ uint8_t intra_pred_mode_c[4]; ++ uint8_t chroma_mode_c[4]; ++ uint8_t merge_flag; ++} RpiPredictionUnit; ++ ++typedef struct HEVCRpiTransformUnit { ++ int8_t cu_qp_delta; ++ ++ // Inferred parameters; ++ uint8_t intra_pred_mode; ++ uint8_t intra_pred_mode_c; ++ uint8_t chroma_mode_c; ++ uint8_t is_cu_qp_delta_wanted; ++ uint8_t cu_chroma_qp_offset_wanted; ++ const int8_t * qp_divmod6[3]; ++} HEVCRpiTransformUnit; ++ ++typedef struct DBParams { ++ int8_t beta_offset; // -12 to +12 ++ int8_t tc_offset; // -12 to +12 ++} DBParams; ++ ++#define HEVC_FRAME_FLAG_OUTPUT (1 << 0) ++#define HEVC_FRAME_FLAG_SHORT_REF (1 << 1) ++#define HEVC_FRAME_FLAG_LONG_REF (1 << 2) ++#define HEVC_FRAME_FLAG_BUMPING (1 << 3) ++ ++struct HEVCRpiJob; ++ ++typedef struct HEVCRpiFrame { ++ AVFrame *frame; ++ ThreadFrame tf; ++ ColMvField *col_mvf; ++ int poc; ++ struct HEVCRpiFrame *collocated_ref; ++ ++ AVBufferRef *col_mvf_buf; ++ ++ /** ++ * A sequence counter, so that old frames are output first ++ * after a POC reset ++ */ ++ uint16_t sequence; ++ ++ /** ++ * A combination of HEVC_FRAME_FLAG_* ++ */ ++ uint8_t flags; ++ ++ // Entry no in DPB - can be used as a small unique ++ // frame identifier (within the current thread) ++ uint8_t dpb_no; ++} HEVCRpiFrame; ++ ++typedef struct HEVCRpiLocalContext { ++ HEVCRpiTransformUnit tu; ++ ++ CABACContext cc; ++ ++ // Vars that allow us to locate everything from just an lc ++ struct HEVCRpiContext * context; // ??? make const ??? ++ unsigned int lc_n; // lc list el no ++ ++ // Job wait links ++ struct HEVCRpiLocalContext * jw_next; ++ struct HEVCRpiLocalContext * jw_prev; ++ struct HEVCRpiLocalContext * ljw_next; ++ struct HEVCRpiLocalContext * ljw_prev; ++ struct HEVCRpiJob * volatile jw_job; ++ sem_t jw_sem; ++ ++ // ?? Wrap in structure ?? ++ sem_t bt_sem_in; ++ sem_t * bt_psem_out; ++ volatile int bt_terminate; ++ unsigned int ts; ++ unsigned int bt_last_line; // Last line in this bit_thread chunk ++ unsigned int bt_line_no; ++ unsigned int bt_line_width; ++ unsigned int bt_line_inc; ++ ++ struct HEVCRpiJob * jb0; ++ char unit_done; // Set once we have dealt with this slice ++ char bt_is_tile; ++ char last_progress_good; ++ char cabac_init_req; ++ ++ uint8_t cabac_state[HEVC_CONTEXTS]; ++ uint8_t stat_coeff[4]; ++ GetBitContext gb; ++ ++ uint8_t ct_depth; ++ int8_t qp_y; ++ int8_t curr_qp_y; ++ int8_t qPy_pred; ++ ++// N.B. Used by asm (neon) - do not change ++#define AVAIL_S_UR 0 ++#define AVAIL_S_U 1 ++#define AVAIL_S_UL 2 ++#define AVAIL_S_L 3 ++#define AVAIL_S_DL 4 ++ ++#define AVAIL_U (1 << AVAIL_S_U) ++#define AVAIL_L (1 << AVAIL_S_L) ++#define AVAIL_UL (1 << AVAIL_S_UL) ++#define AVAIL_UR (1 << AVAIL_S_UR) ++#define AVAIL_DL (1 << AVAIL_S_DL) ++ ++// Intra filters - same number space as avail ++#define FILTER_LIGHT 0x40 ++#define FILTER_STRONG 0x80 ++#define FILTER_EITHER (FILTER_LIGHT | FILTER_STRONG) ++ ++ uint8_t ctb_avail; ++ int end_of_ctb_x; ++ int end_of_ctb_y; ++ ++ RpiCodingUnit cu; ++ RpiPredictionUnit pu; ++ ++#define BOUNDARY_LEFT_SLICE (1 << 0) ++#define BOUNDARY_LEFT_TILE (1 << 1) ++#define BOUNDARY_UPPER_SLICE (1 << 2) ++#define BOUNDARY_UPPER_TILE (1 << 3) ++ /* properties of the boundary of the current CTB for the purposes ++ * of the deblocking filter */ ++ unsigned int boundary_flags; ++ ++#define IPM_TAB_SIZE (HEVC_MAX_CTB_SIZE >> LOG2_MIN_PU_SIZE) ++ uint8_t ipm_left[IPM_TAB_SIZE]; ++ uint8_t ipm_up[IPM_TAB_SIZE]; ++ ++//#define MVF_STASH_WIDTH 128 ++#define MVF_STASH_WIDTH 64 ++#define MVF_STASH_HEIGHT 64 ++#define MVF_STASH_WIDTH_PU (MVF_STASH_WIDTH >> LOG2_MIN_PU_SIZE) ++#define MVF_STASH_HEIGHT_PU (MVF_STASH_HEIGHT >> LOG2_MIN_PU_SIZE) ++ HEVCRpiMvField mvf_ul[1]; ++ HEVCRpiMvField mvf_stash[MVF_STASH_WIDTH_PU * MVF_STASH_HEIGHT_PU]; ++ ++ /* +7 is for subpixel interpolation, *2 for high bit depths */ ++// DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2]; ++ /* The extended size between the new edge emu buffer is abused by SAO */ ++// DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer2)[(MAX_PB_SIZE + 7) * EDGE_EMU_BUFFER_STRIDE * 2]; ++// DECLARE_ALIGNED(32, int16_t, tmp [MAX_PB_SIZE * MAX_PB_SIZE]); ++ ++} HEVCRpiLocalContext; ++ ++// Each block can have an intra prediction and an add_residual command ++// noof-cmds(2) * max-ctu height(64) / min-transform(4) * planes(3) * MAX_WIDTH ++ ++// Sand only has 2 planes (Y/C) ++#define RPI_MAX_PRED_CMDS (2*(HEVC_MAX_CTB_SIZE/4)*2*(HEVC_RPI_MAX_WIDTH/4)) ++ ++// Command for intra prediction and transform_add of predictions to coefficients ++enum rpi_pred_cmd_e ++{ ++ RPI_PRED_ADD_RESIDUAL, ++ RPI_PRED_ADD_RESIDUAL_U, // = RPI_PRED_TRANSFORM_ADD + c_idx ++ RPI_PRED_ADD_RESIDUAL_V, // = RPI_PRED_TRANSFORM_ADD + c_idx ++ RPI_PRED_ADD_RESIDUAL_C, // Merged U+V ++ RPI_PRED_ADD_DC, ++ RPI_PRED_ADD_DC_U, // Both U & V are effectively C ++ RPI_PRED_ADD_DC_V, ++ RPI_PRED_INTRA, ++ RPI_PRED_INTRA_C, ++ RPI_PRED_I_PCM, ++ RPI_PRED_CMD_MAX ++}; ++ ++typedef struct HEVCPredCmd { ++ uint8_t type; ++ uint8_t size; // log2 "size" used by all variants ++ uint8_t avail; // i_pred - but left here as they pack well ++ uint8_t dummy; ++ union { ++ struct { // TRANSFORM_ADD ++ uint8_t * dst; ++ const int16_t * buf; ++ uint16_t stride; // Should be good enough for all pic fmts we use ++ int16_t dc; ++ } ta; ++ struct { ++ uint8_t * dst; ++ uint32_t stride; ++ int dc; ++ } dc; ++ struct { // INTRA ++ uint16_t x; ++ uint16_t y; ++ enum IntraPredMode mode; ++ } i_pred; ++ struct { // I_PCM ++ uint16_t x; ++ uint16_t y; ++ const void * src; ++ uint32_t src_len; ++ } i_pcm; ++ }; ++} HEVCPredCmd; ++ ++union qpu_mc_pred_cmd_s; ++struct qpu_mc_pred_y_p_s; ++struct qpu_mc_src_s; ++ ++typedef struct HEVCRpiInterPredQ ++{ ++ union qpu_mc_pred_cmd_u *qpu_mc_base; ++ union qpu_mc_pred_cmd_u *qpu_mc_curr; ++ struct qpu_mc_src_s *last_l0; ++ struct qpu_mc_src_s *last_l1; ++ unsigned int load; ++ uint32_t code_setup; ++ uint32_t code_sync; ++ uint32_t code_exit; ++} HEVCRpiInterPredQ; ++ ++typedef struct HEVCRpiInterPredEnv ++{ ++ HEVCRpiInterPredQ * q; ++ uint8_t n; // Number of Qs ++ uint8_t n_grp; // Number of Q in a group ++ uint8_t curr; // Current Q number (0..n-1) ++ uint8_t used; // 0 if nothing in any Q, 1 otherwise ++ uint8_t used_grp; // 0 if nothing in any Q in the current group ++ unsigned int max_fill; ++ unsigned int min_gap; ++ GPU_MEM_PTR_T gptr; ++} HEVCRpiInterPredEnv; ++ ++typedef struct HEVCRpiIntraPredEnv { ++ unsigned int n; // Number of commands ++ HEVCPredCmd * cmds; ++} HEVCRpiIntraPredEnv; ++ ++typedef struct HEVCRpiCoeffEnv { ++ unsigned int n; ++#if RPI_COMPRESS_COEFFS ++ unsigned int packed; // Equal to 1 if coefficients should be being packed ++ unsigned int packed_n; // Value of n when packed was set equal to 0 (i.e. the amount that is sent compressed). Only valid if packed==0 ++#endif ++ int16_t * buf; ++} HEVCRpiCoeffEnv; ++ ++typedef struct HEVCRpiCoeffsEnv { ++ HEVCRpiCoeffEnv s[4]; ++ GPU_MEM_PTR_T gptr; ++ void * mptr; ++} HEVCRpiCoeffsEnv; ++ ++typedef struct HEVCRpiFrameProgressWait { ++ int req; ++ struct HEVCRpiFrameProgressWait * next; ++ sem_t sem; ++} HEVCRpiFrameProgressWait; ++ ++typedef struct HEVCRpiFrameProgressState { ++ struct HEVCRpiFrameProgressWait * first; ++ struct HEVCRpiFrameProgressWait * last; ++ pthread_mutex_t lock; ++} HEVCRpiFrameProgressState; ++ ++typedef struct RpiBlk ++{ ++ unsigned int x; ++ unsigned int y; ++ unsigned int w; ++ unsigned int h; ++} RpiBlk; ++ ++typedef struct HEVCRpiJob { ++ struct HEVCRpiJob * next; // Free chain ++ struct HEVCRpiJobCtl * jbc_local; ++ const HEVCRpiSPS * sps; // sps used to set up this job ++ ++ int waited; ++ int ctu_ts_first; ++ int ctu_ts_last; ++ RpiBlk bounds; // Bounding box of job ++ ++ struct qpu_mc_pred_y_p_s * last_y8_p; ++ struct qpu_mc_src_s * last_y8_l1; ++ rpi_cache_flush_env_t * rfe; ++ ++ HEVCRpiInterPredEnv chroma_ip; ++ HEVCRpiInterPredEnv luma_ip; ++ int16_t progress_req[HEVC_DPB_ELS]; // index by dpb_no ++ HEVCRpiIntraPredEnv intra; ++ HEVCRpiCoeffsEnv coeffs; ++ HEVCRpiFrameProgressWait progress_wait; ++ sem_t sem; ++ rpi_cache_buf_t flush_buf; ++} HEVCRpiJob; ++ ++struct HEVCRpiContext; ++ ++typedef void HEVCRpiWorkerFn(const struct HEVCRpiContext * const s, HEVCRpiJob * const jb); ++ ++typedef struct HEVCRpiPassQueue ++{ ++// int pending; ++ volatile int terminate; ++ sem_t sem_in; ++ sem_t * psem_out; ++ unsigned int job_n; ++ struct HEVCRpiContext * context; // Context pointer as we get to pass a single "void * this" to the thread ++ HEVCRpiWorkerFn * worker; ++ pthread_t thread; ++ uint8_t pass_n; // Pass number - debug ++ uint8_t started; ++} HEVCRpiPassQueue; ++ ++ ++struct HEVCRpiJobGlobal; ++ ++typedef struct HEVCRpiJobCtl ++{ ++ sem_t sem_out; ++ ++ HEVCRpiJob * volatile jb1; // The job associated with this frame if unallocated - NULL if allocated ++ struct HEVCRpiJobGlobal * jbg; ++ ++ HEVCRpiLocalContext * lcw_head; ++ HEVCRpiLocalContext * lcw_tail; ++ ++ pthread_mutex_t in_lock; ++ int offload_in; ++ ++ HEVCRpiJob *offloadq[RPI_MAX_JOBS]; ++} HEVCRpiJobCtl; ++ ++ ++typedef struct HEVCRpiJobGlobal ++{ ++ intptr_t ref_count; ++ pthread_mutex_t lock; ++ HEVCRpiJob * free1; // Singly linked list of free jobs ++ HEVCRpiLocalContext * wait_head; // Double linked list of lcs waiting for a job ++ HEVCRpiLocalContext * wait_good; // Last good tail ++ HEVCRpiLocalContext * wait_tail; ++ ++} HEVCRpiJobGlobal; ++ ++#define RPI_BIT_THREADS (RPI_EXTRA_BIT_THREADS + 1) ++ ++#if RPI_TSTATS ++typedef struct HEVCRpiStats { ++ int y_pred1_y8_merge; ++ int y_pred1_xy; ++ int y_pred1_x0; ++ int y_pred1_y0; ++ int y_pred1_x0y0; ++ int y_pred1_wle8; ++ int y_pred1_wgt8; ++ int y_pred1_hle16; ++ int y_pred1_hgt16; ++ int y_pred2_xy; ++ int y_pred2_x0; ++ int y_pred2_y0; ++ int y_pred2_x0y0; ++ int y_pred2_hle16; ++ int y_pred2_hgt16; ++} HEVCRpiStats; ++#endif ++ ++typedef struct HEVCRpiCabacState ++{ ++ uint8_t rice[4]; ++ uint8_t state[HEVC_CONTEXTS]; ++} HEVCRpiCabacState; ++ ++#define HEVC_RPI_BS_STRIDE1_PEL_SHIFT 6 // 64 pels ++#define HEVC_RPI_BS_STRIDE1_PELS (1U << HEVC_RPI_BS_STRIDE1_PEL_SHIFT) ++#define HEVC_RPI_BS_STRIDE1_PEL_MASK (HEVC_RPI_BS_STRIDE1_PELS - 1) ++#define HEVC_RPI_BS_ELS_PER_BYTE_SHIFT 2 // 4 els per byte ++#define HEVC_RPI_BS_PELS_PER_EL_SHIFT 2 // 4 pels per el ++#define HEVC_RPI_BS_PELS_PER_BYTE_SHIFT (HEVC_RPI_BS_PELS_PER_EL_SHIFT + HEVC_RPI_BS_ELS_PER_BYTE_SHIFT) ++#define HEVC_RPI_BS_STRIDE1_BYTE_SHIFT (HEVC_RPI_BS_STRIDE1_PEL_SHIFT - HEVC_RPI_BS_PELS_PER_BYTE_SHIFT) ++#define HEVC_RPI_BS_STRIDE1_BYTES (1U << HEVC_RPI_BS_STRIDE1_BYTE_SHIFT) ++#define HEVC_RPI_BS_Y_SHR 3 // 8 vertical pels per row ++#define HEVC_RPI_BS_COL_BYTES_SHR (HEVC_RPI_BS_Y_SHR - HEVC_RPI_BS_STRIDE1_BYTE_SHIFT) ++ ++typedef struct HEVCRpiContext { ++ const AVClass *c; // needed by private avoptions ++ AVCodecContext *avctx; ++ ++ uint8_t threads_type; ++ char qpu_init_ok; ++ ++ /** 1 if the independent slice segment header was successfully parsed */ ++ uint8_t slice_initialized; ++ char used_for_ref; // rpi ++ char is_irap; ++ char offload_recon; ++ uint8_t eos; ///< current packet contains an EOS/EOB NAL ++ uint8_t last_eos; ///< last packet contains an EOS/EOB NAL ++ uint8_t no_backward_pred_flag; ++ uint8_t is_decoded; ++ uint8_t no_rasl_output_flag; ++ ++ ++ /** ++ * Sequence counters for decoded and output frames, so that old ++ * frames are output first after a POC reset ++ */ ++ uint16_t seq_decode; ++ uint16_t seq_output; ++ ++ int width; ++ int height; ++ ++ HEVCRpiJobCtl * jbc; ++ // cabac stash ++ // b0 skip flag ++ // b1+ ct_depth ++ uint8_t * cabac_stash_left; ++ uint8_t * cabac_stash_up; ++ ++ // Function pointers ++#if RPI_QPU_EMU_Y || RPI_QPU_EMU_C ++ const uint8_t * qpu_dummy_frame_emu; ++#endif ++#if !RPI_QPU_EMU_Y || !RPI_QPU_EMU_C ++ uint32_t qpu_dummy_frame_qpu; // Not a frame - just a bit of memory ++#endif ++ HEVCRpiQpu qpu; ++ ++ HEVCRpiFrameProgressState progress_states[2]; ++ ++ HEVCRpiCabacState *cabac_save; ++ ++ AVFrame *frame; ++ AVFrame *output_frame; ++ uint8_t *sao_pixel_buffer_h[3]; ++ uint8_t *sao_pixel_buffer_v[3]; ++ ++ unsigned int col_mvf_stride; ++ AVBufferPool *col_mvf_pool; ++ ++ RpiSAOParams *sao; ++ DBParams *deblock; ++ enum HEVCNALUnitType nal_unit_type; ++ int temporal_id; ///< temporal_id_plus1 - 1 ++ HEVCRpiFrame *ref; ++ int poc; ++ int pocTid0; ++ int slice_idx; ///< number of the slice being currently decoded ++ int max_ra; ++ ++ int8_t *qp_y_tab; ++ ++ // Deblocking block strength bitmaps ++ unsigned int bs_stride2; ++ unsigned int bs_size; ++ uint8_t *bs_horizontal; ++ uint8_t *bs_vertical; ++ uint8_t *bsf_stash_up; ++ uint8_t *bsf_stash_left; ++ ++#if HEVC_RPI_MAX_CTBS >= 0xffff ++#define TAB_SLICE_ADDR_BROKEN ~(uint32_t)0 ++ uint32_t *tab_slice_address; ++#else ++#define TAB_SLICE_ADDR_BROKEN ~(uint16_t)0 ++ uint16_t *tab_slice_address; ++#endif ++ ++ // Bitfield 1 bit per 8 pels (min pcm size) ++ uint8_t *is_pcm; ++ // Bitfield 1 bit per 8 pels (min cb size) ++ // Only needed for CIP as CIP processing is async to the main thread ++ uint8_t *is_intra; ++ ++ // PU ++ HEVCRpiMvField *mvf_up; ++ HEVCRpiMvField *mvf_left; ++ ++ const RefPicList **rpl_up; ++ const RefPicList **rpl_left; ++ RefPicList * refPicList; ++ ++ // CTB-level flags affecting loop filter operation ++ uint8_t *filter_slice_edges; ++ ++ /** used on BE to byteswap the lines for checksumming */ ++ uint8_t *checksum_buf; ++ int checksum_buf_size; ++ ++ const uint8_t *data; ++ ++ H2645Packet pkt; ++ // type of the first VCL NAL of the current frame ++ enum HEVCNALUnitType first_nal_type; ++ ++ uint8_t context_initialized; ++ int is_nalff; ///< this flag is != 0 if bitstream is encapsulated ++ ///< as a format defined in 14496-15 ++ int apply_defdispwin; ++ ++ int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4) ++ int nuh_layer_id; ++ ++ struct AVMD5 *md5_ctx; ++ ++ RefPicListTab * rpl_tab; ++ unsigned int rpl_tab_size; ++ ++ uint8_t *is_intra_store; ++ ++ RpiSliceHeader sh; ++ ++ HEVCRpiParamSets ps; ++ ++ HEVCRpiLocalContext *HEVClc; ++ HEVCRpiLocalContext *HEVClcList[MAX_NB_THREADS]; ++ ++ HEVCRpiFrame DPB[HEVC_DPB_ELS]; ++ ++ ///< candidate references for the current frame ++ RefPicList rps[5]; ++ ++ HEVCRpiPredContext hpc; ++ HEVCDSPContext hevcdsp; ++ ++ HEVCSEIContext sei; ++ ++ // Put structures that allocate non-trivial storage at the end ++ // These are mostly used indirectly so position in the structure doesn't matter ++ HEVCRpiPassQueue passq[RPI_PASSES]; ++#if RPI_EXTRA_BIT_THREADS > 0 ++ int bt_started; ++ // This simply contains thread descriptors - task setup is held elsewhere ++ pthread_t bit_threads[RPI_EXTRA_BIT_THREADS]; ++#endif ++#if RPI_TSTATS ++ HEVCRpiStats tstats; ++#endif ++} HEVCRpiContext; ++ ++/** ++ * Mark all frames in DPB as unused for reference. ++ */ ++void ff_hevc_rpi_clear_refs(HEVCRpiContext *s); ++ ++/** ++ * Drop all frames currently in DPB. ++ */ ++void ff_hevc_rpi_flush_dpb(HEVCRpiContext *s); ++ ++/** ++ * Construct the reference picture sets for the current frame. ++ */ ++int ff_hevc_rpi_frame_rps(HEVCRpiContext *s); ++ ++/** ++ * Construct the reference picture list(s) for the current slice. ++ */ ++int ff_hevc_rpi_slice_rpl(HEVCRpiContext *s); ++ ++ ++/** ++ * Get the number of candidate references for the current frame. ++ */ ++int ff_hevc_rpi_frame_nb_refs(HEVCRpiContext *s); ++ ++int ff_hevc_rpi_set_new_ref(HEVCRpiContext *s, AVFrame **frame, int poc); ++ ++/** ++ * Find next frame in output order and put a reference to it in frame. ++ * @return 1 if a frame was output, 0 otherwise ++ */ ++int ff_hevc_rpi_output_frame(HEVCRpiContext *s, AVFrame *frame, int flush); ++ ++void ff_hevc_rpi_bump_frame(HEVCRpiContext *s); ++ ++void ff_hevc_rpi_unref_frame(HEVCRpiContext *s, HEVCRpiFrame *frame, int flags); ++ ++unsigned int ff_hevc_rpi_tb_avail_flags( ++ const HEVCRpiContext * const s, const HEVCRpiLocalContext * const lc, ++ const unsigned int x, const unsigned int y, const unsigned int w, const unsigned int h); ++ ++void ff_hevc_rpi_luma_mv_merge_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, int x0, int y0, int nPbW, ++ int nPbH, int log2_cb_size, int part_idx, ++ int merge_idx, HEVCRpiMvField * const mv); ++void ff_hevc_rpi_luma_mv_mvp_mode(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int nPbW, const unsigned int nPbH, ++ const unsigned int avail, ++ HEVCRpiMvField * const mv, ++ const unsigned int mvp_lx_flag, const unsigned int LX); ++void ff_hevc_rpi_set_qPy(const HEVCRpiContext * const s, HEVCRpiLocalContext * const lc, int xBase, int yBase); ++void ff_hevc_rpi_deblocking_boundary_strengths(const HEVCRpiContext * const s, const HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int log2_trafo_size, const int is_coded_block); ++int ff_hevc_rpi_hls_filter_blk(const HEVCRpiContext * const s, const RpiBlk bounds, const int eot); ++ ++extern const uint8_t ff_hevc_rpi_qpel_extra_before[4]; ++extern const uint8_t ff_hevc_rpi_qpel_extra_after[4]; ++extern const uint8_t ff_hevc_rpi_qpel_extra[4]; ++ ++int16_t * rpi_alloc_coeff_buf(HEVCRpiJob * const jb, const int buf_no, const int n); ++ ++// arm/hevc_misc_neon.S ++// Neon coeff zap fn ++#if HAVE_NEON ++extern void rpi_zap_coeff_vals_neon(int16_t * dst, unsigned int l2ts_m2); ++#endif ++ ++void ff_hevc_rpi_progress_wait_field(const HEVCRpiContext * const s, HEVCRpiJob * const jb, ++ const HEVCRpiFrame * const ref, const int val, const int field); ++ ++void ff_hevc_rpi_progress_signal_field(HEVCRpiContext * const s, const int val, const int field); ++ ++// All of these expect that s->threads_type == FF_THREAD_FRAME ++ ++static inline void ff_hevc_rpi_progress_wait_mv(const HEVCRpiContext * const s, HEVCRpiJob * const jb, ++ const HEVCRpiFrame * const ref, const int y) ++{ ++ if (s->threads_type != 0) ++ ff_hevc_rpi_progress_wait_field(s, jb, ref, y, 1); ++} ++ ++static inline void ff_hevc_rpi_progress_signal_mv(HEVCRpiContext * const s, const int y) ++{ ++ if (s->used_for_ref && s->threads_type != 0) ++ ff_hevc_rpi_progress_signal_field(s, y, 1); ++} ++ ++static inline void ff_hevc_rpi_progress_wait_recon(const HEVCRpiContext * const s, HEVCRpiJob * const jb, ++ const HEVCRpiFrame * const ref, const int y) ++{ ++ ff_hevc_rpi_progress_wait_field(s, jb, ref, y, 0); ++} ++ ++static inline void ff_hevc_rpi_progress_signal_recon(HEVCRpiContext * const s, const int y) ++{ ++ if (s->used_for_ref && s->threads_type != 0) ++ { ++ ff_hevc_rpi_progress_signal_field(s, y, 0); ++ } ++} ++ ++static inline void ff_hevc_rpi_progress_signal_all_done(HEVCRpiContext * const s) ++{ ++ ff_hevc_rpi_progress_signal_field(s, INT_MAX, 0); ++ ff_hevc_rpi_progress_signal_field(s, INT_MAX, 1); ++} ++ ++ ++// Set all done - signal nothing (used in missing refs) ++// Works for both rpi & non-rpi ++static inline void ff_hevc_rpi_progress_set_all_done(HEVCRpiFrame * const ref) ++{ ++ if (ref->tf.progress != NULL) ++ { ++ int * const p = (int *)ref->tf.progress->data; ++ p[0] = INT_MAX; ++ p[1] = INT_MAX; ++ } ++} ++ ++#define HEVC_RPI_420_ONLY 1 ++#define HEVC_RPI_SAND128_ONLY 1 ++ ++static inline unsigned int ctx_hshift(const HEVCRpiContext * const s, const int cidx) ++{ ++#if HEVC_RPI_420_ONLY ++ return cidx == 0 ? 0 : 1; ++#else ++ return s->ps.sps->hshift[cidx]; ++#endif ++} ++ ++static inline unsigned int ctx_vshift(const HEVCRpiContext * const s, const int cidx) ++{ ++#if HEVC_RPI_420_ONLY ++ return cidx == 0 ? 0 : 1; ++#else ++ return s->ps.sps->vshift[cidx]; ++#endif ++} ++ ++static inline int ctx_cfmt(const HEVCRpiContext * const s) ++{ ++#if HEVC_RPI_420_ONLY ++ return 1; ++#else ++ return s->ps.sps->chroma_format_idc; ++#endif ++} ++ ++static inline int frame_stride1(const AVFrame * const frame, const int c_idx) ++{ ++#if HEVC_RPI_SAND128_ONLY ++ return 128; ++#else ++ return frame->linesize[c_idx]; ++#endif ++} ++ ++#if HEVC_RPI_SAND128_ONLY ++// Propagate this decision to later zc includes ++#define RPI_ZC_SAND128_ONLY 1 ++#endif ++ ++#ifndef ff_hevc_rpi_copy_vert ++static inline void ff_hevc_rpi_copy_vert(uint8_t *dst, const uint8_t *src, ++ int pixel_shift, int height, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src) ++{ ++ int i; ++ switch (pixel_shift) ++ { ++ case 2: ++ for (i = 0; i < height; i++) { ++ *(uint32_t *)dst = *(uint32_t *)src; ++ dst += stride_dst; ++ src += stride_src; ++ } ++ break; ++ case 1: ++ for (i = 0; i < height; i++) { ++ *(uint16_t *)dst = *(uint16_t *)src; ++ dst += stride_dst; ++ src += stride_src; ++ } ++ break; ++ default: ++ for (i = 0; i < height; i++) { ++ *dst = *src; ++ dst += stride_dst; ++ src += stride_src; ++ } ++ break; ++ } ++} ++#endif ++ ++ ++#if MVF_STASH_WIDTH == 64 ++static inline HEVCRpiMvField* mvf_stash_ptr(const HEVCRpiContext *const s, const HEVCRpiLocalContext * const lc, ++ const unsigned int x, const unsigned int y) ++{ ++ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); ++ return (HEVCRpiMvField*)(lc->mvf_stash + ((y & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE) * MVF_STASH_WIDTH_PU + ((x & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE)); ++} ++ ++static inline HEVCRpiMvField* mvf_ptr(const HEVCRpiContext *const s, const HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int x, const unsigned int y) ++{ ++ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); ++ const unsigned int x0_ctb = x0 & mask_cs_hi; ++ const unsigned int y0_ctb = y0 & mask_cs_hi; ++ ++ return (HEVCRpiMvField *)((y < y0_ctb) ? ++ (x < x0_ctb ? lc->mvf_ul : s->mvf_up + (x >> LOG2_MIN_PU_SIZE)) : ++ (x < x0_ctb ? s->mvf_left + (y >> LOG2_MIN_PU_SIZE) : ++ lc->mvf_stash + ++ ((y & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE) * MVF_STASH_WIDTH_PU + ++ ((x & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE))); ++} ++ ++static inline unsigned int mvf_left_stride(const HEVCRpiContext *const s, ++ const unsigned int x0, ++ const unsigned int x) ++{ ++ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); ++ const unsigned int x0_ctb = x0 & mask_cs_hi; ++ return x < x0_ctb ? 1 : MVF_STASH_WIDTH_PU; ++} ++ ++#else ++static inline HEVCRpiMvField* mvf_stash_ptr(const HEVCRpiContext *const s, const HEVCRpiLocalContext * const lc, ++ const unsigned int x, const unsigned int y) ++{ ++ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); ++ return (HEVCRpiMvField*)(lc->mvf_stash + ((y & ~mask_cs_hi) >> LOG2_MIN_PU_SIZE) * MVF_STASH_WIDTH_PU + ((x >> LOG2_MIN_PU_SIZE) & (MVF_STASH_WIDTH_PU - 1))); ++} ++ ++static inline HEVCRpiMvField* mvf_ptr(const HEVCRpiContext *const s, const HEVCRpiLocalContext * const lc, ++ const unsigned int x0, const unsigned int y0, ++ const unsigned int x, const unsigned int y) ++{ ++ const unsigned int mask_cs_hi = (~0U << s->ps.sps->log2_ctb_size); ++ ++ const unsigned int x0_ctb = x0 & mask_cs_hi; ++ const unsigned int y0_ctb = y0 & mask_cs_hi; ++ ++ // If not in the same CTB for Y assume up ++ if (y < y0_ctb) { ++ // If not in the same CTB for X too assume up-left ++ return (HEVCRpiMvField *)(x < x0_ctb ? lc->mvf_ul : s->mvf_up + (x >> LOG2_MIN_PU_SIZE)); ++ } ++ return mvf_stash_ptr(s, lc, x, y); ++} ++ ++static inline unsigned int mvf_left_stride(const HEVCRpiContext *const s, ++ const unsigned int x0, ++ const unsigned int x) ++{ ++ return MVF_STASH_WIDTH_PU; ++} ++#endif ++ ++#endif /* AVCODEC_RPI_HEVCDEC_H */ +--- /dev/null ++++ b/libavcodec/rpi_hevcdsp.c +@@ -0,0 +1,450 @@ ++/* ++ * HEVC video decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2013 - 2014 Pierre-Edouard Lepere ++ * Copyright (C) 2018 John Cox, Ben Avison for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "rpi_hevcdsp.h" ++#include "rpi_hevc_mv.h" ++ ++static const int8_t transform[32][32] = { ++ { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, ++ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 }, ++ { 90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4, ++ -4, -13, -22, -31, -38, -46, -54, -61, -67, -73, -78, -82, -85, -88, -90, -90 }, ++ { 90, 87, 80, 70, 57, 43, 25, 9, -9, -25, -43, -57, -70, -80, -87, -90, ++ -90, -87, -80, -70, -57, -43, -25, -9, 9, 25, 43, 57, 70, 80, 87, 90 }, ++ { 90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13, ++ 13, 38, 61, 78, 88, 90, 85, 73, 54, 31, 4, -22, -46, -67, -82, -90 }, ++ { 89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89, ++ 89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89 }, ++ { 88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22, ++ -22, -61, -85, -90, -73, -38, 4, 46, 78, 90, 82, 54, 13, -31, -67, -88 }, ++ { 87, 57, 9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87, ++ -87, -57, -9, 43, 80, 90, 70, 25, -25, -70, -90, -80, -43, 9, 57, 87 }, ++ { 85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31, ++ 31, 78, 90, 61, 4, -54, -88, -82, -38, 22, 73, 90, 67, 13, -46, -85 }, ++ { 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83, ++ 83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83 }, ++ { 82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67, 4, 73, 88, 38, ++ -38, -88, -73, -4, 67, 90, 46, -31, -85, -78, -13, 61, 90, 54, -22, -82 }, ++ { 80, 9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80, ++ -80, -9, 70, 87, 25, -57, -90, -43, 43, 90, 57, -25, -87, -70, 9, 80 }, ++ { 78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46, ++ 46, 90, 38, -54, -90, -31, 61, 88, 22, -67, -85, -13, 73, 82, 4, -78 }, ++ { 75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75, ++ 75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75 }, ++ { 73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54, ++ -54, -85, 4, 88, 46, -61, -82, 13, 90, 38, -67, -78, 22, 90, 31, -73 }, ++ { 70, -43, -87, 9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70, ++ -70, 43, 87, -9, -90, -25, 80, 57, -57, -80, 25, 90, 9, -87, -43, 70 }, ++ { 67, -54, -78, 38, 85, -22, -90, 4, 90, 13, -88, -31, 82, 46, -73, -61, ++ 61, 73, -46, -82, 31, 88, -13, -90, -4, 90, 22, -85, -38, 78, 54, -67 }, ++ { 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, ++ 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64 }, ++ { 61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67, ++ -67, -54, 78, 38, -85, -22, 90, 4, -90, 13, 88, -31, -82, 46, 73, -61 }, ++ { 57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87, 9, -90, 25, 80, -57, ++ -57, 80, 25, -90, 9, 87, -43, -70, 70, 43, -87, -9, 90, -25, -80, 57 }, ++ { 54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73, ++ 73, 31, -90, 22, 78, -67, -38, 90, -13, -82, 61, 46, -88, 4, 85, -54 }, ++ { 50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50, ++ 50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50 }, ++ { 46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82, 4, 78, ++ -78, -4, 82, -73, -13, 85, -67, -22, 88, -61, -31, 90, -54, -38, 90, -46 }, ++ { 43, -90, 57, 25, -87, 70, 9, -80, 80, -9, -70, 87, -25, -57, 90, -43, ++ -43, 90, -57, -25, 87, -70, -9, 80, -80, 9, 70, -87, 25, 57, -90, 43 }, ++ { 38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82, ++ 82, -22, -54, 90, -61, -13, 78, -85, 31, 46, -90, 67, 4, -73, 88, -38 }, ++ { 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36, ++ 36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36 }, ++ { 31, -78, 90, -61, 4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85, ++ -85, 46, 13, -67, 90, -73, 22, 38, -82, 88, -54, -4, 61, -90, 78, -31 }, ++ { 25, -70, 90, -80, 43, 9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25, ++ -25, 70, -90, 80, -43, -9, 57, -87, 87, -57, 9, 43, -80, 90, -70, 25 }, ++ { 22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88, ++ 88, -67, 31, 13, -54, 82, -90, 78, -46, 4, 38, -73, 90, -85, 61, -22 }, ++ { 18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18, ++ 18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18 }, ++ { 13, -38, 61, -78, 88, -90, 85, -73, 54, -31, 4, 22, -46, 67, -82, 90, ++ -90, 82, -67, 46, -22, -4, 31, -54, 73, -85, 90, -88, 78, -61, 38, -13 }, ++ { 9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9, ++ -9, 25, -43, 57, -70, 80, -87, 90, -90, 87, -80, 70, -57, 43, -25, 9 }, ++ { 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90, ++ 90, -90, 88, -85, 82, -78, 73, -67, 61, -54, 46, -38, 31, -22, 13, -4 }, ++}; ++ ++DECLARE_ALIGNED(16, const int8_t, ff_hevc_rpi_epel_filters[7][4]) = { ++ { -2, 58, 10, -2}, ++ { -4, 54, 16, -2}, ++ { -6, 46, 28, -4}, ++ { -4, 36, 36, -4}, ++ { -4, 28, 46, -6}, ++ { -2, 16, 54, -4}, ++ { -2, 10, 58, -2}, ++}; ++ ++DECLARE_ALIGNED(16, const int8_t, ff_hevc_rpi_qpel_filters[3][16]) = { ++ { -1, 4,-10, 58, 17, -5, 1, 0, -1, 4,-10, 58, 17, -5, 1, 0}, ++ { -1, 4,-11, 40, 40,-11, 4, -1, -1, 4,-11, 40, 40,-11, 4, -1}, ++ { 0, 1, -5, 17, 58,-10, 4, -1, 0, 1, -5, 17, 58,-10, 4, -1} ++}; ++ ++#define BIT_DEPTH 8 ++#include "rpi_hevcdsp_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 9 ++#include "rpi_hevcdsp_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 10 ++#include "rpi_hevcdsp_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 12 ++#include "rpi_hevcdsp_template.c" ++#undef BIT_DEPTH ++ ++static uint32_t hevc_deblocking_boundary_strengths(int pus, int dup, const HEVCRpiMvField *curr, const HEVCRpiMvField *neigh, ++ const int *curr_rpl0, const int *curr_rpl1, const int *neigh_rpl0, const int *neigh_rpl1, ++ int in_inc0, int in_inc1) ++{ ++ int shift = 32; ++ uint32_t bs = 0; ++ for (; pus > 0; pus--) { ++ int strength, out; ++ int curr_refL0 = curr_rpl0[curr->ref_idx[0]]; ++ int curr_refL1 = curr_rpl1[curr->ref_idx[1]]; ++ int nr_idx0 = neigh->ref_idx[0]; ++ int nr_idx1 = neigh->ref_idx[1]; ++ int neigh_refL0 = neigh_rpl0[nr_idx0]; ++ int neigh_refL1 = neigh_rpl1[nr_idx1]; ++ ++ av_assert0(nr_idx0 >= 0 && nr_idx0 <=31); ++ av_assert0(nr_idx1 >= 0 && nr_idx1 <=31); ++ ++#if 1 // This more directly matches the original implementation ++ if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) { ++ // same L0 and L1 ++ if (curr_refL0 == neigh_refL0 && ++ curr_refL0 == curr_refL1 && ++ neigh_refL0 == neigh_refL1) { ++ if ((FFABS(MV_X(neigh->xy[0]) - MV_X(curr->xy[0])) >= 4 || FFABS(MV_Y(neigh->xy[0]) - MV_Y(curr->xy[0])) >= 4 || ++ FFABS(MV_X(neigh->xy[1]) - MV_X(curr->xy[1])) >= 4 || FFABS(MV_Y(neigh->xy[1]) - MV_Y(curr->xy[1])) >= 4) && ++ (FFABS(MV_X(neigh->xy[1]) - MV_X(curr->xy[0])) >= 4 || FFABS(MV_Y(neigh->xy[1]) - MV_Y(curr->xy[0])) >= 4 || ++ FFABS(MV_X(neigh->xy[0]) - MV_X(curr->xy[1])) >= 4 || FFABS(MV_Y(neigh->xy[0]) - MV_Y(curr->xy[1])) >= 4)) ++ strength = 1; ++ else ++ strength = 0; ++ } else if (neigh_refL0 == curr_refL0 && ++ neigh_refL1 == curr_refL1) { ++ if (FFABS(MV_X(neigh->xy[0]) - MV_X(curr->xy[0])) >= 4 || FFABS(MV_Y(neigh->xy[0]) - MV_Y(curr->xy[0])) >= 4 || ++ FFABS(MV_X(neigh->xy[1]) - MV_X(curr->xy[1])) >= 4 || FFABS(MV_Y(neigh->xy[1]) - MV_Y(curr->xy[1])) >= 4) ++ strength = 1; ++ else ++ strength = 0; ++ } else if (neigh_refL1 == curr_refL0 && ++ neigh_refL0 == curr_refL1) { ++ if (FFABS(MV_X(neigh->xy[1]) - MV_X(curr->xy[0])) >= 4 || FFABS(MV_Y(neigh->xy[1]) - MV_Y(curr->xy[0])) >= 4 || ++ FFABS(MV_X(neigh->xy[0]) - MV_X(curr->xy[1])) >= 4 || FFABS(MV_Y(neigh->xy[0]) - MV_Y(curr->xy[1])) >= 4) ++ strength = 1; ++ else ++ strength = 0; ++ } else { ++ strength = 1; ++ } ++ } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV ++ MvXY curr_mv0, neigh_mv0; ++ ++ if (curr->pred_flag & 1) { ++ curr_mv0 = curr->xy[0]; ++ } else { ++ curr_mv0 = curr->xy[1]; ++ curr_refL0 = curr_refL1; ++ } ++ ++ if (neigh->pred_flag & 1) { ++ neigh_mv0 = neigh->xy[0]; ++ } else { ++ neigh_mv0 = neigh->xy[1]; ++ neigh_refL0 = neigh_refL1; ++ } ++ ++ if (curr_refL0 == neigh_refL0) { ++ if (FFABS(MV_X(curr_mv0) - MV_X(neigh_mv0)) >= 4 || FFABS(MV_Y(curr_mv0) - MV_Y(neigh_mv0)) >= 4) ++ strength = 1; ++ else ++ strength = 0; ++ } else ++ strength = 1; ++ } else ++ strength = 1; ++#else // This has exactly the same effect, but is more suitable for vectorisation ++ MvXY curr_mv[2]; ++ MvXY neigh_mv[2]; ++ memcpy(curr_mv, curr->xy, sizeof curr_mv); ++ memcpy(neigh_mv, neigh->xy, sizeof neigh_mv); ++ ++ if (!(curr->pred_flag & 2)) { ++ curr_mv[1] = curr_mv[0]; ++ curr_refL1 = curr_refL0; ++ } ++ if (!(neigh->pred_flag & 2)) { ++ neigh_mv[1] = neigh_mv[0]; ++ neigh_refL1 = neigh_refL0; ++ } ++ if (!(curr->pred_flag & 1)) { ++ curr_mv[0] = curr_mv[1]; ++ curr_refL0 = curr_refL1; ++ } ++ if (!(neigh->pred_flag & 1)) { ++ neigh_mv[0] = neigh_mv[1]; ++ neigh_refL0 = neigh_refL1; ++ } ++ ++ strength = 1; ++ ++ strength &= (neigh_refL0 != curr_refL0) | (neigh_refL1 != curr_refL1) | ++ (FFABS(MV_X(neigh_mv[0]) - MV_X(curr_mv[0])) >= 4) | (FFABS(MV_Y(neigh_mv[0]) - MV_Y(curr_mv[0])) >= 4) | ++ (FFABS(MV_X(neigh_mv[1]) - MV_X(curr_mv[1])) >= 4) | (FFABS(MV_Y(neigh_mv[1]) - MV_Y(curr_mv[1])) >= 4); ++ ++ strength &= (neigh_refL1 != curr_refL0) | (neigh_refL0 != curr_refL1) | ++ (FFABS(MV_X(neigh_mv[1]) - MV_X(curr_mv[0])) >= 4) | (FFABS(MV_Y(neigh_mv[1]) - MV_Y(curr_mv[0])) >= 4) | ++ (FFABS(MV_X(neigh_mv[0]) - MV_X(curr_mv[1])) >= 4) | (FFABS(MV_Y(neigh_mv[0]) - MV_Y(curr_mv[1])) >= 4); ++ ++ strength |= (((curr->pred_flag + 1) ^ (neigh->pred_flag + 1)) >> 2); ++#endif ++ ++ curr += in_inc0 / sizeof (HEVCRpiMvField); ++ neigh += in_inc1 / sizeof (HEVCRpiMvField); ++ ++ for (out = dup; out > 0; out--) ++ { ++ bs = (bs >> 2) | (strength << 30); ++ shift -= 2; ++ } ++ } ++ return bs >> shift; ++} ++ ++ ++static void cpy_blk(uint8_t *dst, unsigned int stride_dst, const uint8_t *src, unsigned stride_src, unsigned int width, unsigned int height) ++{ ++ unsigned int i, j; ++ ++ if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) { ++ for (i = 0; i < height; i++) { ++ for (j = 0; j < width; j+=8) ++ AV_COPY64U(dst+j, src+j); ++ dst += stride_dst; ++ src += stride_src; ++ } ++ } else { ++ for (i = 0; i < height; i++) { ++ for (j = 0; j < width; j+=16) ++ AV_COPY128(dst+j, src+j); ++ dst += stride_dst; ++ src += stride_src; ++ } ++ } ++} ++ ++ ++ ++void ff_hevc_rpi_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth) ++{ ++#undef FUNC ++#define FUNC(a, depth) a ## _ ## depth ++ ++#undef PEL_FUNC ++#define PEL_FUNC(dst1, idx1, idx2, a, depth) \ ++ for(i = 0 ; i < 10 ; i++) \ ++{ \ ++ hevcdsp->dst1[i][idx1][idx2] = a ## _ ## depth; \ ++} ++ ++#undef EPEL_FUNCS ++#define EPEL_FUNCS(depth) \ ++ PEL_FUNC(put_hevc_epel, 0, 0, put_hevc_pel_pixels, depth); \ ++ PEL_FUNC(put_hevc_epel, 0, 1, put_hevc_epel_h, depth); \ ++ PEL_FUNC(put_hevc_epel, 1, 0, put_hevc_epel_v, depth); \ ++ PEL_FUNC(put_hevc_epel, 1, 1, put_hevc_epel_hv, depth) ++ ++#undef EPEL_UNI_FUNCS ++#define EPEL_UNI_FUNCS(depth) \ ++ PEL_FUNC(put_hevc_epel_uni, 0, 0, put_hevc_pel_uni_pixels, depth); \ ++ PEL_FUNC(put_hevc_epel_uni, 0, 1, put_hevc_epel_uni_h, depth); \ ++ PEL_FUNC(put_hevc_epel_uni, 1, 0, put_hevc_epel_uni_v, depth); \ ++ PEL_FUNC(put_hevc_epel_uni, 1, 1, put_hevc_epel_uni_hv, depth); \ ++ PEL_FUNC(put_hevc_epel_uni_w, 0, 0, put_hevc_pel_uni_w_pixels, depth); \ ++ PEL_FUNC(put_hevc_epel_uni_w, 0, 1, put_hevc_epel_uni_w_h, depth); \ ++ PEL_FUNC(put_hevc_epel_uni_w, 1, 0, put_hevc_epel_uni_w_v, depth); \ ++ PEL_FUNC(put_hevc_epel_uni_w, 1, 1, put_hevc_epel_uni_w_hv, depth) ++ ++#undef EPEL_BI_FUNCS ++#define EPEL_BI_FUNCS(depth) \ ++ PEL_FUNC(put_hevc_epel_bi, 0, 0, put_hevc_pel_bi_pixels, depth); \ ++ PEL_FUNC(put_hevc_epel_bi, 0, 1, put_hevc_epel_bi_h, depth); \ ++ PEL_FUNC(put_hevc_epel_bi, 1, 0, put_hevc_epel_bi_v, depth); \ ++ PEL_FUNC(put_hevc_epel_bi, 1, 1, put_hevc_epel_bi_hv, depth); \ ++ PEL_FUNC(put_hevc_epel_bi_w, 0, 0, put_hevc_pel_bi_w_pixels, depth); \ ++ PEL_FUNC(put_hevc_epel_bi_w, 0, 1, put_hevc_epel_bi_w_h, depth); \ ++ PEL_FUNC(put_hevc_epel_bi_w, 1, 0, put_hevc_epel_bi_w_v, depth); \ ++ PEL_FUNC(put_hevc_epel_bi_w, 1, 1, put_hevc_epel_bi_w_hv, depth) ++ ++#undef QPEL_FUNCS ++#define QPEL_FUNCS(depth) \ ++ PEL_FUNC(put_hevc_qpel, 0, 0, put_hevc_pel_pixels, depth); \ ++ PEL_FUNC(put_hevc_qpel, 0, 1, put_hevc_qpel_h, depth); \ ++ PEL_FUNC(put_hevc_qpel, 1, 0, put_hevc_qpel_v, depth); \ ++ PEL_FUNC(put_hevc_qpel, 1, 1, put_hevc_qpel_hv, depth) ++ ++#undef QPEL_UNI_FUNCS ++#define QPEL_UNI_FUNCS(depth) \ ++ PEL_FUNC(put_hevc_qpel_uni, 0, 0, put_hevc_pel_uni_pixels, depth); \ ++ PEL_FUNC(put_hevc_qpel_uni, 0, 1, put_hevc_qpel_uni_h, depth); \ ++ PEL_FUNC(put_hevc_qpel_uni, 1, 0, put_hevc_qpel_uni_v, depth); \ ++ PEL_FUNC(put_hevc_qpel_uni, 1, 1, put_hevc_qpel_uni_hv, depth); \ ++ PEL_FUNC(put_hevc_qpel_uni_w, 0, 0, put_hevc_pel_uni_w_pixels, depth); \ ++ PEL_FUNC(put_hevc_qpel_uni_w, 0, 1, put_hevc_qpel_uni_w_h, depth); \ ++ PEL_FUNC(put_hevc_qpel_uni_w, 1, 0, put_hevc_qpel_uni_w_v, depth); \ ++ PEL_FUNC(put_hevc_qpel_uni_w, 1, 1, put_hevc_qpel_uni_w_hv, depth) ++ ++#undef QPEL_BI_FUNCS ++#define QPEL_BI_FUNCS(depth) \ ++ PEL_FUNC(put_hevc_qpel_bi, 0, 0, put_hevc_pel_bi_pixels, depth); \ ++ PEL_FUNC(put_hevc_qpel_bi, 0, 1, put_hevc_qpel_bi_h, depth); \ ++ PEL_FUNC(put_hevc_qpel_bi, 1, 0, put_hevc_qpel_bi_v, depth); \ ++ PEL_FUNC(put_hevc_qpel_bi, 1, 1, put_hevc_qpel_bi_hv, depth); \ ++ PEL_FUNC(put_hevc_qpel_bi_w, 0, 0, put_hevc_pel_bi_w_pixels, depth); \ ++ PEL_FUNC(put_hevc_qpel_bi_w, 0, 1, put_hevc_qpel_bi_w_h, depth); \ ++ PEL_FUNC(put_hevc_qpel_bi_w, 1, 0, put_hevc_qpel_bi_w_v, depth); \ ++ PEL_FUNC(put_hevc_qpel_bi_w, 1, 1, put_hevc_qpel_bi_w_hv, depth) ++ ++#define SLICED_ADD_RESIDUAL(depth)\ ++ hevcdsp->add_residual_u[0] = FUNC(add_residual4x4_u, depth); \ ++ hevcdsp->add_residual_u[1] = FUNC(add_residual8x8_u, depth); \ ++ hevcdsp->add_residual_u[2] = FUNC(add_residual16x16_u, depth); \ ++ hevcdsp->add_residual_u[3] = FUNC(add_residual32x32_u, depth); \ ++ hevcdsp->add_residual_v[0] = FUNC(add_residual4x4_v, depth); \ ++ hevcdsp->add_residual_v[1] = FUNC(add_residual8x8_v, depth); \ ++ hevcdsp->add_residual_v[2] = FUNC(add_residual16x16_v, depth); \ ++ hevcdsp->add_residual_v[3] = FUNC(add_residual32x32_v, depth); \ ++ hevcdsp->add_residual_c[0] = FUNC(add_residual4x4_c, depth); \ ++ hevcdsp->add_residual_c[1] = FUNC(add_residual8x8_c, depth); \ ++ hevcdsp->add_residual_c[2] = FUNC(add_residual16x16_c, depth); \ ++ hevcdsp->add_residual_c[3] = FUNC(add_residual32x32_c, depth); \ ++ hevcdsp->add_residual_dc_c[0] = FUNC(add_residual4x4_dc_c, depth); \ ++ hevcdsp->add_residual_dc_c[1] = FUNC(add_residual8x8_dc_c, depth); \ ++ hevcdsp->add_residual_dc_c[2] = FUNC(add_residual16x16_dc_c, depth); \ ++ hevcdsp->add_residual_dc_c[3] = FUNC(add_residual32x32_dc_c, depth); \ ++ hevcdsp->put_pcm_c = FUNC(put_pcm_c, depth) ++#define SLICED_LOOP_FILTERS(depth)\ ++ hevcdsp->hevc_h_loop_filter_luma2 = FUNC(hevc_h_loop_filter_luma2, depth); \ ++ hevcdsp->hevc_v_loop_filter_luma2 = FUNC(hevc_v_loop_filter_luma2, depth); \ ++ hevcdsp->hevc_h_loop_filter_uv = FUNC(hevc_h_loop_filter_uv, depth); \ ++ hevcdsp->hevc_v_loop_filter_uv2 = FUNC(hevc_v_loop_filter_uv2, depth) ++#define SLICED_SAO(depth)\ ++ for (i = 0; i != SAO_FILTER_N; ++i) { \ ++ hevcdsp->sao_band_filter_c[i] = FUNC(sao_band_filter_c, depth); \ ++ hevcdsp->sao_edge_filter_c[i] = FUNC(sao_edge_filter_c, depth); \ ++ } \ ++ hevcdsp->sao_edge_restore_c[0] = FUNC(sao_edge_restore_c_0, depth); \ ++ hevcdsp->sao_edge_restore_c[1] = FUNC(sao_edge_restore_c_1, depth) ++ ++#define HEVC_DSP(depth) \ ++ hevcdsp->put_pcm = FUNC(put_pcm, depth); \ ++ hevcdsp->add_residual[0] = FUNC(add_residual4x4, depth); \ ++ hevcdsp->add_residual[1] = FUNC(add_residual8x8, depth); \ ++ hevcdsp->add_residual[2] = FUNC(add_residual16x16, depth); \ ++ hevcdsp->add_residual[3] = FUNC(add_residual32x32, depth); \ ++ hevcdsp->add_residual_dc[0] = FUNC(add_residual4x4_dc, depth); \ ++ hevcdsp->add_residual_dc[1] = FUNC(add_residual8x8_dc, depth); \ ++ hevcdsp->add_residual_dc[2] = FUNC(add_residual16x16_dc, depth); \ ++ hevcdsp->add_residual_dc[3] = FUNC(add_residual32x32_dc, depth); \ ++ SLICED_ADD_RESIDUAL(depth); \ ++ hevcdsp->dequant = FUNC(dequant, depth); \ ++ hevcdsp->transform_rdpcm = FUNC(transform_rdpcm, depth); \ ++ hevcdsp->transform_4x4_luma = FUNC(transform_4x4_luma, depth); \ ++ hevcdsp->idct[0] = FUNC(idct_4x4, depth); \ ++ hevcdsp->idct[1] = FUNC(idct_8x8, depth); \ ++ hevcdsp->idct[2] = FUNC(idct_16x16, depth); \ ++ hevcdsp->idct[3] = FUNC(idct_32x32, depth); \ ++ \ ++ hevcdsp->idct_dc[0] = FUNC(idct_4x4_dc, depth); \ ++ hevcdsp->idct_dc[1] = FUNC(idct_8x8_dc, depth); \ ++ hevcdsp->idct_dc[2] = FUNC(idct_16x16_dc, depth); \ ++ hevcdsp->idct_dc[3] = FUNC(idct_32x32_dc, depth); \ ++ \ ++ for (i = 0; i != SAO_FILTER_N; ++i) { \ ++ hevcdsp->sao_band_filter[i] = FUNC(sao_band_filter, depth); \ ++ hevcdsp->sao_edge_filter[i] = FUNC(sao_edge_filter, depth); \ ++ } \ ++ hevcdsp->sao_edge_restore[0] = FUNC(sao_edge_restore_0, depth); \ ++ hevcdsp->sao_edge_restore[1] = FUNC(sao_edge_restore_1, depth); \ ++ SLICED_SAO(depth); \ ++ \ ++ QPEL_FUNCS(depth); \ ++ QPEL_UNI_FUNCS(depth); \ ++ QPEL_BI_FUNCS(depth); \ ++ EPEL_FUNCS(depth); \ ++ EPEL_UNI_FUNCS(depth); \ ++ EPEL_BI_FUNCS(depth); \ ++ \ ++ SLICED_LOOP_FILTERS(depth); \ ++ hevcdsp->hevc_h_loop_filter_luma = FUNC(hevc_h_loop_filter_luma, depth); \ ++ hevcdsp->hevc_v_loop_filter_luma = FUNC(hevc_v_loop_filter_luma, depth); \ ++ hevcdsp->hevc_h_loop_filter_chroma = FUNC(hevc_h_loop_filter_chroma, depth); \ ++ hevcdsp->hevc_v_loop_filter_chroma = FUNC(hevc_v_loop_filter_chroma, depth); \ ++ hevcdsp->hevc_h_loop_filter_luma_c = FUNC(hevc_h_loop_filter_luma, depth); \ ++ hevcdsp->hevc_v_loop_filter_luma_c = FUNC(hevc_v_loop_filter_luma, depth); \ ++ hevcdsp->hevc_h_loop_filter_chroma_c = FUNC(hevc_h_loop_filter_chroma, depth); \ ++ hevcdsp->hevc_v_loop_filter_chroma_c = FUNC(hevc_v_loop_filter_chroma, depth) ++int i = 0; ++ ++ switch (bit_depth) { ++ case 9: ++ HEVC_DSP(9); ++ break; ++ case 10: ++ HEVC_DSP(10); ++ break; ++ case 12: ++ HEVC_DSP(12); ++ break; ++ default: ++ HEVC_DSP(8); ++ break; ++ } ++ ++ hevcdsp->hevc_deblocking_boundary_strengths = hevc_deblocking_boundary_strengths; ++ hevcdsp->cpy_blk = cpy_blk; ++ ++ if (ARCH_PPC) ++ ff_hevc_rpi_dsp_init_ppc(hevcdsp, bit_depth); ++ if (ARCH_X86) ++ ff_hevc_rpi_dsp_init_x86(hevcdsp, bit_depth); ++ if (ARCH_ARM) ++ ff_hevcdsp_rpi_init_arm(hevcdsp, bit_depth); ++ if (ARCH_MIPS) ++ ff_hevc_rpi_dsp_init_mips(hevcdsp, bit_depth); ++} +--- /dev/null ++++ b/libavcodec/rpi_hevcdsp.h +@@ -0,0 +1,177 @@ ++/* ++ * HEVC video decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2013 - 2014 Pierre-Edouard Lepere ++ * ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_RPI_HEVCDSP_H ++#define AVCODEC_RPI_HEVCDSP_H ++ ++#include "hevc.h" ++#include "get_bits.h" ++ ++struct HEVCRpiMvField; ++ ++#define MAX_PB_SIZE 64 ++ ++#define RPI_HEVC_SAO_BUF_STRIDE 160 ++ ++ ++typedef struct RpiSAOParams { ++ uint8_t band_position[3]; ///< sao_band_position (Y,U,V) ++ uint8_t eo_class[3]; ///< sao_eo_class (Y,U=V) ++ uint8_t type_idx[3]; ///< sao_type_idx (Y,U=V) ++ ++ int16_t offset_val[3][5]; ///> 16; ++ const int dc_u = (dc << 16) >> 16; ++ ++ stride /= sizeof(pixel); ++ ++ for (y = 0; y < size; y++) { ++ for (x = 0; x < size * 2; x += 2) { ++ dst[x] = av_clip_pixel(dst[x] + dc_u); ++ dst[x + 1] = av_clip_pixel(dst[x + 1] + dc_v); ++ } ++ dst += stride; ++ } ++} ++ ++ ++static void FUNC(add_residual4x4)(uint8_t *_dst, int16_t *res, ++ ptrdiff_t stride) ++{ ++ FUNC(add_residual)(_dst, res, stride, 4); ++} ++ ++static void FUNC(add_residual8x8)(uint8_t *_dst, int16_t *res, ++ ptrdiff_t stride) ++{ ++ FUNC(add_residual)(_dst, res, stride, 8); ++} ++ ++static void FUNC(add_residual16x16)(uint8_t *_dst, int16_t *res, ++ ptrdiff_t stride) ++{ ++ FUNC(add_residual)(_dst, res, stride, 16); ++} ++ ++static void FUNC(add_residual32x32)(uint8_t *_dst, int16_t *res, ++ ptrdiff_t stride) ++{ ++ FUNC(add_residual)(_dst, res, stride, 32); ++} ++ ++static void FUNC(add_residual4x4_dc)(uint8_t *_dst, ptrdiff_t stride, int dc) ++{ ++ FUNC(add_residual_dc)(_dst, stride, dc, 4); ++} ++ ++static void FUNC(add_residual8x8_dc)(uint8_t *_dst, ptrdiff_t stride, int dc) ++{ ++ FUNC(add_residual_dc)(_dst, stride, dc, 8); ++} ++ ++static void FUNC(add_residual16x16_dc)(uint8_t *_dst, ptrdiff_t stride, int dc) ++{ ++ FUNC(add_residual_dc)(_dst, stride, dc, 16); ++} ++ ++static void FUNC(add_residual32x32_dc)(uint8_t *_dst, ptrdiff_t stride, int dc) ++{ ++ FUNC(add_residual_dc)(_dst, stride, dc, 32); ++} ++ ++// -- U -- (plaited) ++ ++static void FUNC(add_residual4x4_u)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride, int dc_u) ++{ ++ FUNC(add_residual_u)(_dst, res, stride, dc_u, 4); ++} ++ ++static void FUNC(add_residual8x8_u)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride, int dc_u) ++{ ++ FUNC(add_residual_u)(_dst, res, stride, dc_u, 8); ++} ++ ++static void FUNC(add_residual16x16_u)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride, int dc_u) ++{ ++ FUNC(add_residual_u)(_dst, res, stride, dc_u, 16); ++} ++ ++static void FUNC(add_residual32x32_u)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride, int dc_u) ++{ ++ // Should never occur for 420, which is all that sand supports ++ av_assert0(0); ++} ++ ++// -- V -- (plaited) ++ ++static void FUNC(add_residual4x4_v)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride, int dc_v) ++{ ++ FUNC(add_residual_v)(_dst, res, stride, dc_v, 4); ++} ++ ++static void FUNC(add_residual8x8_v)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride, int dc_v) ++{ ++ FUNC(add_residual_v)(_dst, res, stride, dc_v, 8); ++} ++ ++static void FUNC(add_residual16x16_v)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride, int dc_v) ++{ ++ FUNC(add_residual_v)(_dst, res, stride, dc_v, 16); ++} ++ ++static void FUNC(add_residual32x32_v)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride, int dc_v) ++{ ++ // Should never occur for 420, which is all that sand supports ++ av_assert0(0); ++} ++ ++// -- C -- (plaited - both U & V) ++ ++static void FUNC(add_residual4x4_c)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride) ++{ ++ FUNC(add_residual_c)(_dst, res, stride, 4); ++} ++ ++static void FUNC(add_residual8x8_c)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride) ++{ ++ FUNC(add_residual_c)(_dst, res, stride, 8); ++} ++ ++static void FUNC(add_residual16x16_c)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride) ++{ ++ FUNC(add_residual_c)(_dst, res, stride, 16); ++} ++ ++static void FUNC(add_residual32x32_c)(uint8_t *_dst, const int16_t * res, ++ ptrdiff_t stride) ++{ ++ // Should never occur for 420, which is all that sand supports ++ av_assert0(0); ++} ++ ++static void FUNC(add_residual4x4_dc_c)(uint8_t *_dst, ptrdiff_t stride, int32_t dc) ++{ ++ FUNC(add_residual_dc_c)(_dst, stride, dc, 4); ++} ++ ++static void FUNC(add_residual8x8_dc_c)(uint8_t *_dst, ptrdiff_t stride, int32_t dc) ++{ ++ FUNC(add_residual_dc_c)(_dst, stride, dc, 8); ++} ++ ++static void FUNC(add_residual16x16_dc_c)(uint8_t *_dst, ptrdiff_t stride, int32_t dc) ++{ ++ FUNC(add_residual_dc_c)(_dst, stride, dc, 16); ++} ++ ++static void FUNC(add_residual32x32_dc_c)(uint8_t *_dst, ptrdiff_t stride, int32_t dc) ++{ ++ // Should never occur for 420, which is all that sand supports ++ av_assert0(0); ++} ++ ++ ++static void FUNC(transform_rdpcm)(int16_t *_coeffs, int16_t log2_size, int mode) ++{ ++ int16_t *coeffs = (int16_t *) _coeffs; ++ int x, y; ++ int size = 1 << log2_size; ++ ++ if (mode) { ++ coeffs += size; ++ for (y = 0; y < size - 1; y++) { ++ for (x = 0; x < size; x++) ++ coeffs[x] += coeffs[x - size]; ++ coeffs += size; ++ } ++ } else { ++ for (y = 0; y < size; y++) { ++ for (x = 1; x < size; x++) ++ coeffs[x] += coeffs[x - 1]; ++ coeffs += size; ++ } ++ } ++} ++ ++static void FUNC(dequant)(int16_t *coeffs, int16_t log2_size) ++{ ++ int shift = 15 - BIT_DEPTH - log2_size; ++ int x, y; ++ int size = 1 << log2_size; ++ ++ if (shift > 0) { ++ int offset = 1 << (shift - 1); ++ for (y = 0; y < size; y++) { ++ for (x = 0; x < size; x++) { ++ *coeffs = (*coeffs + offset) >> shift; ++ coeffs++; ++ } ++ } ++ } else { ++ for (y = 0; y < size; y++) { ++ for (x = 0; x < size; x++) { ++ *coeffs = *coeffs << -shift; ++ coeffs++; ++ } ++ } ++ } ++} ++ ++#define SET(dst, x) (dst) = (x) ++#define SCALE(dst, x) (dst) = av_clip_int16(((x) + add) >> shift) ++ ++#define TR_4x4_LUMA(dst, src, step, assign) \ ++ do { \ ++ int c0 = src[0 * step] + src[2 * step]; \ ++ int c1 = src[2 * step] + src[3 * step]; \ ++ int c2 = src[0 * step] - src[3 * step]; \ ++ int c3 = 74 * src[1 * step]; \ ++ \ ++ assign(dst[2 * step], 74 * (src[0 * step] - \ ++ src[2 * step] + \ ++ src[3 * step])); \ ++ assign(dst[0 * step], 29 * c0 + 55 * c1 + c3); \ ++ assign(dst[1 * step], 55 * c2 - 29 * c1 + c3); \ ++ assign(dst[3 * step], 55 * c0 + 29 * c2 - c3); \ ++ } while (0) ++ ++static void FUNC(transform_4x4_luma)(int16_t *coeffs) ++{ ++ int i; ++ int shift = 7; ++ int add = 1 << (shift - 1); ++ int16_t *src = coeffs; ++ ++ for (i = 0; i < 4; i++) { ++ TR_4x4_LUMA(src, src, 4, SCALE); ++ src++; ++ } ++ ++ shift = 20 - BIT_DEPTH; ++ add = 1 << (shift - 1); ++ for (i = 0; i < 4; i++) { ++ TR_4x4_LUMA(coeffs, coeffs, 1, SCALE); ++ coeffs += 4; ++ } ++} ++ ++#undef TR_4x4_LUMA ++ ++#define TR_4(dst, src, dstep, sstep, assign, end) \ ++ do { \ ++ const int e0 = 64 * src[0 * sstep] + 64 * src[2 * sstep]; \ ++ const int e1 = 64 * src[0 * sstep] - 64 * src[2 * sstep]; \ ++ const int o0 = 83 * src[1 * sstep] + 36 * src[3 * sstep]; \ ++ const int o1 = 36 * src[1 * sstep] - 83 * src[3 * sstep]; \ ++ \ ++ assign(dst[0 * dstep], e0 + o0); \ ++ assign(dst[1 * dstep], e1 + o1); \ ++ assign(dst[2 * dstep], e1 - o1); \ ++ assign(dst[3 * dstep], e0 - o0); \ ++ } while (0) ++ ++#define TR_8(dst, src, dstep, sstep, assign, end) \ ++ do { \ ++ int i, j; \ ++ int e_8[4]; \ ++ int o_8[4] = { 0 }; \ ++ for (i = 0; i < 4; i++) \ ++ for (j = 1; j < end; j += 2) \ ++ o_8[i] += transform[4 * j][i] * src[j * sstep]; \ ++ TR_4(e_8, src, 1, 2 * sstep, SET, 4); \ ++ \ ++ for (i = 0; i < 4; i++) { \ ++ assign(dst[i * dstep], e_8[i] + o_8[i]); \ ++ assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]); \ ++ } \ ++ } while (0) ++ ++#define TR_16(dst, src, dstep, sstep, assign, end) \ ++ do { \ ++ int i, j; \ ++ int e_16[8]; \ ++ int o_16[8] = { 0 }; \ ++ for (i = 0; i < 8; i++) \ ++ for (j = 1; j < end; j += 2) \ ++ o_16[i] += transform[2 * j][i] * src[j * sstep]; \ ++ TR_8(e_16, src, 1, 2 * sstep, SET, 8); \ ++ \ ++ for (i = 0; i < 8; i++) { \ ++ assign(dst[i * dstep], e_16[i] + o_16[i]); \ ++ assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]); \ ++ } \ ++ } while (0) ++ ++#define TR_32(dst, src, dstep, sstep, assign, end) \ ++ do { \ ++ int i, j; \ ++ int e_32[16]; \ ++ int o_32[16] = { 0 }; \ ++ for (i = 0; i < 16; i++) \ ++ for (j = 1; j < end; j += 2) \ ++ o_32[i] += transform[j][i] * src[j * sstep]; \ ++ TR_16(e_32, src, 1, 2 * sstep, SET, end / 2); \ ++ \ ++ for (i = 0; i < 16; i++) { \ ++ assign(dst[i * dstep], e_32[i] + o_32[i]); \ ++ assign(dst[(31 - i) * dstep], e_32[i] - o_32[i]); \ ++ } \ ++ } while (0) ++ ++#define IDCT_VAR4(H) \ ++ int limit2 = FFMIN(col_limit + 4, H) ++#define IDCT_VAR8(H) \ ++ int limit = FFMIN(col_limit, H); \ ++ int limit2 = FFMIN(col_limit + 4, H) ++#define IDCT_VAR16(H) IDCT_VAR8(H) ++#define IDCT_VAR32(H) IDCT_VAR8(H) ++ ++#define IDCT(H) \ ++static void FUNC(idct_ ## H ## x ## H )(int16_t *coeffs, \ ++ int col_limit) \ ++{ \ ++ int i; \ ++ int shift = 7; \ ++ int add = 1 << (shift - 1); \ ++ int16_t *src = coeffs; \ ++ IDCT_VAR ## H(H); \ ++ \ ++ for (i = 0; i < H; i++) { \ ++ TR_ ## H(src, src, H, H, SCALE, limit2); \ ++ if (limit2 < H && i%4 == 0 && !!i) \ ++ limit2 -= 4; \ ++ src++; \ ++ } \ ++ \ ++ shift = 20 - BIT_DEPTH; \ ++ add = 1 << (shift - 1); \ ++ for (i = 0; i < H; i++) { \ ++ TR_ ## H(coeffs, coeffs, 1, 1, SCALE, limit); \ ++ coeffs += H; \ ++ } \ ++} ++ ++#define IDCT_DC(H) \ ++static void FUNC(idct_ ## H ## x ## H ## _dc)(int16_t *coeffs) \ ++{ \ ++ int i, j; \ ++ int shift = 14 - BIT_DEPTH; \ ++ int add = 1 << (shift - 1); \ ++ int coeff = (((coeffs[0] + 1) >> 1) + add) >> shift; \ ++ \ ++ for (j = 0; j < H; j++) { \ ++ for (i = 0; i < H; i++) { \ ++ coeffs[i + j * H] = coeff; \ ++ } \ ++ } \ ++} ++ ++IDCT( 4) ++IDCT( 8) ++IDCT(16) ++IDCT(32) ++ ++IDCT_DC( 4) ++IDCT_DC( 8) ++IDCT_DC(16) ++IDCT_DC(32) ++ ++#undef TR_4 ++#undef TR_8 ++#undef TR_16 ++#undef TR_32 ++ ++#undef SET ++#undef SCALE ++ ++static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ int16_t *sao_offset_val, int sao_left_class, ++ int width, int height) ++{ ++ pixel *dst = (pixel *)_dst; ++ pixel *src = (pixel *)_src; ++ int offset_table[32] = { 0 }; ++ int k, y, x; ++ int shift = BIT_DEPTH - 5; ++ ++ stride_dst /= sizeof(pixel); ++ stride_src /= sizeof(pixel); ++ ++ for (k = 0; k < 4; k++) ++ offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); ++ dst += stride_dst; ++ src += stride_src; ++ } ++} ++ ++#define CMP(a, b) (((a) > (b)) - ((a) < (b))) ++ ++static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst, int16_t *sao_offset_val, ++ int eo, int width, int height) { ++ ++ static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; ++ static const int8_t pos[4][2][2] = { ++ { { -1, 0 }, { 1, 0 } }, // horizontal ++ { { 0, -1 }, { 0, 1 } }, // vertical ++ { { -1, -1 }, { 1, 1 } }, // 45 degree ++ { { 1, -1 }, { -1, 1 } }, // 135 degree ++ }; ++ pixel *dst = (pixel *)_dst; ++ pixel *src = (pixel *)_src; ++ int a_stride, b_stride; ++ int x, y; ++ const ptrdiff_t stride_src = RPI_HEVC_SAO_BUF_STRIDE / sizeof(pixel); ++ stride_dst /= sizeof(pixel); ++ ++ a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; ++ b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) { ++ int diff0 = CMP(src[x], src[x + a_stride]); ++ int diff1 = CMP(src[x], src[x + b_stride]); ++ int offset_val = edge_idx[2 + diff0 + diff1]; ++ dst[x] = av_clip_pixel(src[x] + sao_offset_val[offset_val]); ++ } ++ src += stride_src; ++ dst += stride_dst; ++ } ++} ++ ++ ++#if BIT_DEPTH == 10 ++// We need a 32 bit variation for the _c restores so hijack bit depth 10 ++#undef pixel ++#undef BIT_DEPTH ++#define pixel uint32_t ++#define BIT_DEPTH 32 ++// All 16 bit variations are the same ++#define sao_edge_restore_0_10 sao_edge_restore_0_9 ++#define sao_edge_restore_1_10 sao_edge_restore_1_9 ++#define sao_edge_restore_0_11 sao_edge_restore_0_9 ++#define sao_edge_restore_1_11 sao_edge_restore_1_9 ++#define sao_edge_restore_0_12 sao_edge_restore_0_9 ++#define sao_edge_restore_1_12 sao_edge_restore_1_9 ++#define sao_edge_restore_0_13 sao_edge_restore_0_9 ++#define sao_edge_restore_1_13 sao_edge_restore_1_9 ++#define sao_edge_restore_0_14 sao_edge_restore_0_9 ++#define sao_edge_restore_1_14 sao_edge_restore_1_9 ++#define sao_edge_restore_0_15 sao_edge_restore_0_9 ++#define sao_edge_restore_1_15 sao_edge_restore_1_9 ++#define sao_edge_restore_0_16 sao_edge_restore_0_9 ++#define sao_edge_restore_1_16 sao_edge_restore_1_9 ++#endif ++#if BIT_DEPTH <= 9 || BIT_DEPTH == 32 ++static void FUNC(sao_edge_restore_0)(uint8_t *_dst, uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, RpiSAOParams *sao, ++ int *borders, int _width, int _height, ++ int c_idx, uint8_t *vert_edge, ++ uint8_t *horiz_edge, uint8_t *diag_edge) ++{ ++ int x, y; ++ pixel *dst = (pixel *)_dst; ++ pixel *src = (pixel *)_src; ++ int sao_eo_class = sao->eo_class[c_idx]; ++ int init_x = 0, width = _width, height = _height; ++ ++ stride_dst /= sizeof(pixel); ++ stride_src /= sizeof(pixel); ++ ++ if (sao_eo_class != SAO_EO_VERT) { ++ if (borders[0]) { ++ for (y = 0; y < height; y++) { ++ dst[y * stride_dst] = src[y * stride_src]; ++ } ++ init_x = 1; ++ } ++ if (borders[2]) { ++ int offset = width - 1; ++ for (x = 0; x < height; x++) { ++ dst[x * stride_dst + offset] = src[x * stride_src + offset]; ++ } ++ width--; ++ } ++ } ++ if (sao_eo_class != SAO_EO_HORIZ) { ++ if (borders[1]) { ++ for (x = init_x; x < width; x++) ++ dst[x] = src[x]; ++ } ++ if (borders[3]) { ++ ptrdiff_t y_stride_dst = stride_dst * (height - 1); ++ ptrdiff_t y_stride_src = stride_src * (height - 1); ++ for (x = init_x; x < width; x++) ++ dst[x + y_stride_dst] = src[x + y_stride_src]; ++ height--; ++ } ++ } ++} ++ ++static void FUNC(sao_edge_restore_1)(uint8_t *_dst, uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, RpiSAOParams *sao, ++ int *borders, int _width, int _height, ++ int c_idx, uint8_t *vert_edge, ++ uint8_t *horiz_edge, uint8_t *diag_edge) ++{ ++ int x, y; ++ pixel *dst = (pixel *)_dst; ++ pixel *src = (pixel *)_src; ++ int sao_eo_class = sao->eo_class[c_idx]; ++ int init_x = 0, init_y = 0, width = _width, height = _height; ++ ++ stride_dst /= sizeof(pixel); ++ stride_src /= sizeof(pixel); ++ ++ if (sao_eo_class != SAO_EO_VERT) { ++ if (borders[0]) { ++ for (y = 0; y < height; y++) { ++ dst[y * stride_dst] = src[y * stride_src]; ++ } ++ init_x = 1; ++ } ++ if (borders[2]) { ++ int offset = width - 1; ++ for (x = 0; x < height; x++) { ++ dst[x * stride_dst + offset] = src[x * stride_src + offset]; ++ } ++ width--; ++ } ++ } ++ if (sao_eo_class != SAO_EO_HORIZ) { ++ if (borders[1]) { ++ for (x = init_x; x < width; x++) ++ dst[x] = src[x]; ++ init_y = 1; ++ } ++ if (borders[3]) { ++ ptrdiff_t y_stride_dst = stride_dst * (height - 1); ++ ptrdiff_t y_stride_src = stride_src * (height - 1); ++ for (x = init_x; x < width; x++) ++ dst[x + y_stride_dst] = src[x + y_stride_src]; ++ height--; ++ } ++ } ++ ++ { ++ int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1]; ++ int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2]; ++ int save_lower_right = !diag_edge[2] && sao_eo_class == SAO_EO_135D && !borders[2] && !borders[3]; ++ int save_lower_left = !diag_edge[3] && sao_eo_class == SAO_EO_45D && !borders[0] && !borders[3]; ++ ++ // Restore pixels that can't be modified ++ if(vert_edge[0] && sao_eo_class != SAO_EO_VERT) { ++ for(y = init_y+save_upper_left; y< height-save_lower_left; y++) ++ dst[y*stride_dst] = src[y*stride_src]; ++ } ++ if(vert_edge[1] && sao_eo_class != SAO_EO_VERT) { ++ for(y = init_y+save_upper_right; y< height-save_lower_right; y++) ++ dst[y*stride_dst+width-1] = src[y*stride_src+width-1]; ++ } ++ ++ if(horiz_edge[0] && sao_eo_class != SAO_EO_HORIZ) { ++ for(x = init_x+save_upper_left; x < width-save_upper_right; x++) ++ dst[x] = src[x]; ++ } ++ if(horiz_edge[1] && sao_eo_class != SAO_EO_HORIZ) { ++ for(x = init_x+save_lower_left; x < width-save_lower_right; x++) ++ dst[(height-1)*stride_dst+x] = src[(height-1)*stride_src+x]; ++ } ++ if(diag_edge[0] && sao_eo_class == SAO_EO_135D) ++ dst[0] = src[0]; ++ if(diag_edge[1] && sao_eo_class == SAO_EO_45D) ++ dst[width-1] = src[width-1]; ++ if(diag_edge[2] && sao_eo_class == SAO_EO_135D) ++ dst[stride_dst*(height-1)+width-1] = src[stride_src*(height-1)+width-1]; ++ if(diag_edge[3] && sao_eo_class == SAO_EO_45D) ++ dst[stride_dst*(height-1)] = src[stride_src*(height-1)]; ++ ++ } ++} ++#endif ++#if BIT_DEPTH == 32 ++#undef BIT_DEPTH ++#undef pixel ++#define BIT_DEPTH 10 ++#define pixel uint16_t ++#endif ++ ++// --- Plaited chroma versions ++ ++static void FUNC(sao_band_filter_c)(uint8_t *_dst, const uint8_t *_src, ++ ptrdiff_t stride_dst, ptrdiff_t stride_src, ++ const int16_t *sao_offset_val_u, int sao_left_class_u, ++ const int16_t *sao_offset_val_v, int sao_left_class_v, ++ int width, int height) ++{ ++ pixel *dst = (pixel *)_dst; ++ pixel *src = (pixel *)_src; ++ int offset_table_u[32] = { 0 }; ++ int offset_table_v[32] = { 0 }; ++ int k, y, x; ++ int shift = BIT_DEPTH - 5; ++ ++ stride_dst /= sizeof(pixel); ++ stride_src /= sizeof(pixel); ++ width *= 2; ++ ++ for (k = 0; k < 4; k++) ++ { ++ offset_table_u[(k + sao_left_class_u) & 31] = sao_offset_val_u[k + 1]; ++ offset_table_v[(k + sao_left_class_v) & 31] = sao_offset_val_v[k + 1]; ++ } ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x += 2) ++ { ++// printf("dst=%p, src=%p, x=%d, shift=%d\n", dst, src, x, shift); ++// printf("offsets=%x,%x\n", src[x + 0], src[x + 1]); ++ // *** & 31 shouldn't be wanted but just now we generate broken input that ++ // crashes us in 10-bit world ++ dst[x + 0] = av_clip_pixel(src[x + 0] + offset_table_u[(src[x + 0] >> shift) & 31]); ++ dst[x + 1] = av_clip_pixel(src[x + 1] + offset_table_v[(src[x + 1] >> shift) & 31]); ++ } ++ dst += stride_dst; ++ src += stride_src; ++ } ++} ++ ++static void FUNC(sao_edge_filter_c)(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride_dst, ++ const int16_t *sao_offset_val_u, const int16_t *sao_offset_val_v, ++ int eo, int width, int height) { ++ ++ static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; ++ static const int8_t pos[4][2][2] = { ++ { { -1, 0 }, { 1, 0 } }, // horizontal ++ { { 0, -1 }, { 0, 1 } }, // vertical ++ { { -1, -1 }, { 1, 1 } }, // 45 degree ++ { { 1, -1 }, { -1, 1 } }, // 135 degree ++ }; ++ pixel *dst = (pixel *)_dst; ++ pixel *src = (pixel *)_src; ++ int a_stride, b_stride; ++ int x, y; ++ const ptrdiff_t stride_src = RPI_HEVC_SAO_BUF_STRIDE / sizeof(pixel); ++ ++ stride_dst /= sizeof(pixel); ++ width *= 2; ++ ++ av_assert0(width <= 64); ++ ++ a_stride = pos[eo][0][0] * 2 + pos[eo][0][1] * stride_src; ++ b_stride = pos[eo][1][0] * 2 + pos[eo][1][1] * stride_src; ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x += 2) { ++ int diff0u = CMP(src[x], src[x + a_stride]); ++ int diff1u = CMP(src[x], src[x + b_stride]); ++ int offset_valu = edge_idx[2 + diff0u + diff1u]; ++ int diff0v = CMP(src[x+1], src[x+1 + a_stride]); ++ int diff1v = CMP(src[x+1], src[x+1 + b_stride]); ++ int offset_valv = edge_idx[2 + diff0v + diff1v]; ++ dst[x] = av_clip_pixel(src[x] + sao_offset_val_u[offset_valu]); ++ dst[x+1] = av_clip_pixel(src[x+1] + sao_offset_val_v[offset_valv]); ++ } ++ src += stride_src; ++ dst += stride_dst; ++ } ++} ++ ++// Do once ++#if BIT_DEPTH == 8 ++// Any old 2 byte 'normal' restore will work for these ++#define sao_edge_restore_c_0_8 sao_edge_restore_0_16 ++#define sao_edge_restore_c_1_8 sao_edge_restore_1_16 ++// We need 32 bit for 9 bit+ ++#define sao_edge_restore_c_0_9 sao_edge_restore_0_32 ++#define sao_edge_restore_c_1_9 sao_edge_restore_1_32 ++#define sao_edge_restore_c_0_10 sao_edge_restore_0_32 ++#define sao_edge_restore_c_1_10 sao_edge_restore_1_32 ++#define sao_edge_restore_c_0_11 sao_edge_restore_0_32 ++#define sao_edge_restore_c_1_11 sao_edge_restore_1_32 ++#define sao_edge_restore_c_0_12 sao_edge_restore_0_32 ++#define sao_edge_restore_c_1_12 sao_edge_restore_1_32 ++#define sao_edge_restore_c_0_13 sao_edge_restore_0_32 ++#define sao_edge_restore_c_1_13 sao_edge_restore_1_32 ++#define sao_edge_restore_c_0_14 sao_edge_restore_0_32 ++#define sao_edge_restore_c_1_14 sao_edge_restore_1_32 ++#define sao_edge_restore_c_0_15 sao_edge_restore_0_32 ++#define sao_edge_restore_c_1_15 sao_edge_restore_1_32 ++#define sao_edge_restore_c_0_16 sao_edge_restore_0_32 ++#define sao_edge_restore_c_1_16 sao_edge_restore_1_32 ++#endif ++ ++#undef CMP ++ ++//////////////////////////////////////////////////////////////////////////////// ++// ++//////////////////////////////////////////////////////////////////////////////// ++static void FUNC(put_hevc_pel_pixels)(int16_t *dst, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = src[x] << (14 - BIT_DEPTH); ++ src += srcstride; ++ dst += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_pel_uni_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ ++ for (y = 0; y < height; y++) { ++ memcpy(dst, src, width * sizeof(pixel)); ++ src += srcstride; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_pel_bi_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ ++ int shift = 14 + 1 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((src[x] << (14 - BIT_DEPTH)) + src2[x] + offset) >> shift); ++ src += srcstride; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_pel_uni_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ int shift = denom + 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ ox = ox * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel((((src[x] << (14 - BIT_DEPTH)) * wx + offset) >> shift) + ox); ++ src += srcstride; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_pel_bi_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, int denom, int wx0, int wx1, ++ int ox0, int ox1, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ ++ int shift = 14 + 1 - BIT_DEPTH; ++ int log2Wd = denom + shift - 1; ++ ++ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ++ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) { ++ dst[x] = av_clip_pixel(( (src[x] << (14 - BIT_DEPTH)) * wx1 + src2[x] * wx0 + (ox0 + ox1 + 1) * (1 << log2Wd)) >> (log2Wd + 1)); ++ } ++ src += srcstride; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++//////////////////////////////////////////////////////////////////////////////// ++// ++//////////////////////////////////////////////////////////////////////////////// ++#define QPEL_FILTER(src, stride) \ ++ (filter[0] * src[x - 3 * stride] + \ ++ filter[1] * src[x - 2 * stride] + \ ++ filter[2] * src[x - stride] + \ ++ filter[3] * src[x ] + \ ++ filter[4] * src[x + stride] + \ ++ filter[5] * src[x + 2 * stride] + \ ++ filter[6] * src[x + 3 * stride] + \ ++ filter[7] * src[x + 4 * stride]) ++ ++static void FUNC(put_hevc_qpel_h)(int16_t *dst, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ dst += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_v)(int16_t *dst, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ dst += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_hv)(int16_t *dst, ++ uint8_t *_src, ++ ptrdiff_t _srcstride, ++ int height, intptr_t mx, ++ intptr_t my, int width) ++{ ++ int x, y; ++ const int8_t *filter; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ ++ src -= QPEL_EXTRA_BEFORE * srcstride; ++ filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ for (y = 0; y < height + QPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6; ++ tmp += MAX_PB_SIZE; ++ dst += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_uni_h)(uint8_t *_dst, ptrdiff_t _dststride, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ int shift = 14 - BIT_DEPTH; ++ ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + offset) >> shift); ++ src += srcstride; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ ++ int shift = 14 + 1 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift); ++ src += srcstride; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_uni_v)(uint8_t *_dst, ptrdiff_t _dststride, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ int shift = 14 - BIT_DEPTH; ++ ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + offset) >> shift); ++ src += srcstride; ++ dst += dststride; ++ } ++} ++ ++ ++static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ ++ int shift = 14 + 1 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift); ++ src += srcstride; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_uni_hv)(uint8_t *_dst, ptrdiff_t _dststride, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ const int8_t *filter; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ int shift = 14 - BIT_DEPTH; ++ ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ src -= QPEL_EXTRA_BEFORE * srcstride; ++ filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ for (y = 0; y < height + QPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + offset) >> shift); ++ tmp += MAX_PB_SIZE; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ const int8_t *filter; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ int shift = 14 + 1 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ src -= QPEL_EXTRA_BEFORE * srcstride; ++ filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ for (y = 0; y < height + QPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + src2[x] + offset) >> shift); ++ tmp += MAX_PB_SIZE; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_uni_w_h)(uint8_t *_dst, ptrdiff_t _dststride, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, int denom, int wx, int ox, ++ intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ int shift = denom + 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ ox = ox * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel((((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); ++ src += srcstride; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, int denom, int wx0, int wx1, ++ int ox0, int ox1, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ ++ int shift = 14 + 1 - BIT_DEPTH; ++ int log2Wd = denom + shift - 1; ++ ++ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ++ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + ++ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); ++ src += srcstride; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_uni_w_v)(uint8_t *_dst, ptrdiff_t _dststride, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, int denom, int wx, int ox, ++ intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ int shift = denom + 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ ox = ox * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel((((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); ++ src += srcstride; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, int denom, int wx0, int wx1, ++ int ox0, int ox1, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ ++ const int8_t *filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ ++ int shift = 14 + 1 - BIT_DEPTH; ++ int log2Wd = denom + shift - 1; ++ ++ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ++ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + ++ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); ++ src += srcstride; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_uni_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, int denom, int wx, int ox, ++ intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ const int8_t *filter; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ int shift = denom + 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ src -= QPEL_EXTRA_BEFORE * srcstride; ++ filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ for (y = 0; y < height + QPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ ++ ox = ox * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel((((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx + offset) >> shift) + ox); ++ tmp += MAX_PB_SIZE; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, int denom, int wx0, int wx1, ++ int ox0, int ox1, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ const int8_t *filter; ++ pixel *src = (pixel*)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ int shift = 14 + 1 - BIT_DEPTH; ++ int log2Wd = denom + shift - 1; ++ ++ src -= QPEL_EXTRA_BEFORE * srcstride; ++ filter = ff_hevc_rpi_qpel_filters[mx - 1]; ++ for (y = 0; y < height + QPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_qpel_filters[my - 1]; ++ ++ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ++ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 + ++ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); ++ tmp += MAX_PB_SIZE; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++//////////////////////////////////////////////////////////////////////////////// ++// ++//////////////////////////////////////////////////////////////////////////////// ++#define EPEL_FILTER(src, stride) \ ++ (filter[0] * src[x - stride] + \ ++ filter[1] * src[x] + \ ++ filter[2] * src[x + stride] + \ ++ filter[3] * src[x + 2 * stride]) ++ ++static void FUNC(put_hevc_epel_h)(int16_t *dst, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ dst += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_epel_v)(int16_t *dst, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ dst += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_epel_hv)(int16_t *dst, ++ uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ ++ src -= EPEL_EXTRA_BEFORE * srcstride; ++ ++ for (y = 0; y < height + EPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_epel_filters[my - 1]; ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6; ++ tmp += MAX_PB_SIZE; ++ dst += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_epel_uni_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int shift = 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + offset) >> shift); ++ src += srcstride; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_epel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int shift = 14 + 1 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) { ++ dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift); ++ } ++ dst += dststride; ++ src += srcstride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_epel_uni_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; ++ int shift = 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + offset) >> shift); ++ src += srcstride; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_epel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ int shift = 14 + 1 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift); ++ dst += dststride; ++ src += srcstride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_epel_uni_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ int shift = 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ src -= EPEL_EXTRA_BEFORE * srcstride; ++ ++ for (y = 0; y < height + EPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_epel_filters[my - 1]; ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + offset) >> shift); ++ tmp += MAX_PB_SIZE; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ int shift = 14 + 1 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ src -= EPEL_EXTRA_BEFORE * srcstride; ++ ++ for (y = 0; y < height + EPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_epel_filters[my - 1]; ++ ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + src2[x] + offset) >> shift); ++ tmp += MAX_PB_SIZE; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_epel_uni_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int shift = denom + 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ ox = ox * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) { ++ dst[x] = av_clip_pixel((((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); ++ } ++ dst += dststride; ++ src += srcstride; ++ } ++} ++ ++static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, int denom, int wx0, int wx1, ++ int ox0, int ox1, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int shift = 14 + 1 - BIT_DEPTH; ++ int log2Wd = denom + shift - 1; ++ ++ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ++ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + ++ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); ++ src += srcstride; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_epel_uni_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; ++ int shift = denom + 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ ox = ox * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) { ++ dst[x] = av_clip_pixel((((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx + offset) >> shift) + ox); ++ } ++ dst += dststride; ++ src += srcstride; ++ } ++} ++ ++static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, int denom, int wx0, int wx1, ++ int ox0, int ox1, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[my - 1]; ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ int shift = 14 + 1 - BIT_DEPTH; ++ int log2Wd = denom + shift - 1; ++ ++ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ++ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + ++ ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); ++ src += srcstride; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++static void FUNC(put_hevc_epel_uni_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int height, int denom, int wx, int ox, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ int shift = denom + 14 - BIT_DEPTH; ++#if BIT_DEPTH < 14 ++ int offset = 1 << (shift - 1); ++#else ++ int offset = 0; ++#endif ++ ++ src -= EPEL_EXTRA_BEFORE * srcstride; ++ ++ for (y = 0; y < height + EPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_epel_filters[my - 1]; ++ ++ ox = ox * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel((((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx + offset) >> shift) + ox); ++ tmp += MAX_PB_SIZE; ++ dst += dststride; ++ } ++} ++ ++static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride, ++ int16_t *src2, ++ int height, int denom, int wx0, int wx1, ++ int ox0, int ox1, intptr_t mx, intptr_t my, int width) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ ptrdiff_t srcstride = _srcstride / sizeof(pixel); ++ pixel *dst = (pixel *)_dst; ++ ptrdiff_t dststride = _dststride / sizeof(pixel); ++ const int8_t *filter = ff_hevc_rpi_epel_filters[mx - 1]; ++ int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE]; ++ int16_t *tmp = tmp_array; ++ int shift = 14 + 1 - BIT_DEPTH; ++ int log2Wd = denom + shift - 1; ++ ++ src -= EPEL_EXTRA_BEFORE * srcstride; ++ ++ for (y = 0; y < height + EPEL_EXTRA; y++) { ++ for (x = 0; x < width; x++) ++ tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8); ++ src += srcstride; ++ tmp += MAX_PB_SIZE; ++ } ++ ++ tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE; ++ filter = ff_hevc_rpi_epel_filters[my - 1]; ++ ++ ox0 = ox0 * (1 << (BIT_DEPTH - 8)); ++ ox1 = ox1 * (1 << (BIT_DEPTH - 8)); ++ for (y = 0; y < height; y++) { ++ for (x = 0; x < width; x++) ++ dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 + ++ ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1)); ++ tmp += MAX_PB_SIZE; ++ dst += dststride; ++ src2 += MAX_PB_SIZE; ++ } ++} ++ ++// line zero ++#define P3 pix[-4 * xstride] ++#define P2 pix[-3 * xstride] ++#define P1 pix[-2 * xstride] ++#define P0 pix[-1 * xstride] ++#define Q0 pix[0 * xstride] ++#define Q1 pix[1 * xstride] ++#define Q2 pix[2 * xstride] ++#define Q3 pix[3 * xstride] ++ ++// line three. used only for deblocking decision ++#define TP3 pix[-4 * xstride + 3 * ystride] ++#define TP2 pix[-3 * xstride + 3 * ystride] ++#define TP1 pix[-2 * xstride + 3 * ystride] ++#define TP0 pix[-1 * xstride + 3 * ystride] ++#define TQ0 pix[0 * xstride + 3 * ystride] ++#define TQ1 pix[1 * xstride + 3 * ystride] ++#define TQ2 pix[2 * xstride + 3 * ystride] ++#define TQ3 pix[3 * xstride + 3 * ystride] ++ ++static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix, ++ ptrdiff_t _xstride, ptrdiff_t _ystride, ++ int beta, int *_tc, ++ uint8_t *_no_p, uint8_t *_no_q) ++{ ++ int d, j; ++ pixel *pix = (pixel *)_pix; ++ ptrdiff_t xstride = _xstride / sizeof(pixel); ++ ptrdiff_t ystride = _ystride / sizeof(pixel); ++ ++ beta <<= BIT_DEPTH - 8; ++ ++ for (j = 0; j < 2; j++) { ++ const int dp0 = abs(P2 - 2 * P1 + P0); ++ const int dq0 = abs(Q2 - 2 * Q1 + Q0); ++ const int dp3 = abs(TP2 - 2 * TP1 + TP0); ++ const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0); ++ const int d0 = dp0 + dq0; ++ const int d3 = dp3 + dq3; ++ const int tc = _tc[j] << (BIT_DEPTH - 8); ++ const int no_p = _no_p[j]; ++ const int no_q = _no_q[j]; ++ ++ if (d0 + d3 >= beta) { ++ pix += 4 * ystride; ++ continue; ++ } else { ++ const int beta_3 = beta >> 3; ++ const int beta_2 = beta >> 2; ++ const int tc25 = ((tc * 5 + 1) >> 1); ++ ++ if (abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 && ++ abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 && ++ (d0 << 1) < beta_2 && (d3 << 1) < beta_2) { ++ // strong filtering ++ const int tc2 = tc << 1; ++ for (d = 0; d < 4; d++) { ++ const int p3 = P3; ++ const int p2 = P2; ++ const int p1 = P1; ++ const int p0 = P0; ++ const int q0 = Q0; ++ const int q1 = Q1; ++ const int q2 = Q2; ++ const int q3 = Q3; ++ if (!no_p) { ++ P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc2, tc2); ++ P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2); ++ P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc2, tc2); ++ } ++ if (!no_q) { ++ Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc2, tc2); ++ Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2); ++ Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc2, tc2); ++ } ++ pix += ystride; ++ } ++ } else { // normal filtering ++ int nd_p = 1; ++ int nd_q = 1; ++ const int tc_2 = tc >> 1; ++ if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3)) ++ nd_p = 2; ++ if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3)) ++ nd_q = 2; ++ ++ for (d = 0; d < 4; d++) { ++ const int p2 = P2; ++ const int p1 = P1; ++ const int p0 = P0; ++ const int q0 = Q0; ++ const int q1 = Q1; ++ const int q2 = Q2; ++ int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4; ++ if (abs(delta0) < 10 * tc) { ++ delta0 = av_clip(delta0, -tc, tc); ++ if (!no_p) ++ P0 = av_clip_pixel(p0 + delta0); ++ if (!no_q) ++ Q0 = av_clip_pixel(q0 - delta0); ++ if (!no_p && nd_p > 1) { ++ const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2); ++ P1 = av_clip_pixel(p1 + deltap1); ++ } ++ if (!no_q && nd_q > 1) { ++ const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2); ++ Q1 = av_clip_pixel(q1 + deltaq1); ++ } ++ } ++ pix += ystride; ++ } ++ } ++ } ++ } ++} ++ ++static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride, ++ ptrdiff_t _ystride, int *_tc, ++ uint8_t *_no_p, uint8_t *_no_q) ++{ ++ int d, j, no_p, no_q; ++ pixel *pix = (pixel *)_pix; ++ ptrdiff_t xstride = _xstride / sizeof(pixel); ++ ptrdiff_t ystride = _ystride / sizeof(pixel); ++ ++ for (j = 0; j < 2; j++) { ++ const int tc = _tc[j] << (BIT_DEPTH - 8); ++ if (tc <= 0) { ++ pix += 4 * ystride; ++ continue; ++ } ++ no_p = _no_p[j]; ++ no_q = _no_q[j]; ++ ++ for (d = 0; d < 4; d++) { ++ int delta0; ++ const int p1 = P1; ++ const int p0 = P0; ++ const int q0 = Q0; ++ const int q1 = Q1; ++ delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc); ++ if (!no_p) ++ P0 = av_clip_pixel(p0 + delta0); ++ if (!no_q) ++ Q0 = av_clip_pixel(q0 - delta0); ++ pix += ystride; ++ } ++ } ++} ++ ++static void FUNC(hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride, ++ int32_t *tc, uint8_t *no_p, ++ uint8_t *no_q) ++{ ++ FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel), tc, no_p, no_q); ++} ++ ++static void FUNC(hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride, ++ int32_t *tc, uint8_t *no_p, ++ uint8_t *no_q) ++{ ++ FUNC(hevc_loop_filter_chroma)(pix, sizeof(pixel), stride, tc, no_p, no_q); ++} ++ ++static void FUNC(hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, ++ int beta, int32_t *tc, uint8_t *no_p, ++ uint8_t *no_q) ++{ ++ FUNC(hevc_loop_filter_luma)(pix, stride, sizeof(pixel), ++ beta, tc, no_p, no_q); ++} ++ ++static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, ++ int beta, int32_t *tc, uint8_t *no_p, ++ uint8_t *no_q) ++{ ++ FUNC(hevc_loop_filter_luma)(pix, sizeof(pixel), stride, ++ beta, tc, no_p, no_q); ++} ++ ++#undef P3 ++#undef P2 ++#undef P1 ++#undef P0 ++#undef Q0 ++#undef Q1 ++#undef Q2 ++#undef Q3 ++ ++#undef TP3 ++#undef TP2 ++#undef TP1 ++#undef TP0 ++#undef TQ0 ++#undef TQ1 ++#undef TQ2 ++#undef TQ3 ++ ++// line zero ++#define P3 pix_l[0 * xstride] ++#define P2 pix_l[1 * xstride] ++#define P1 pix_l[2 * xstride] ++#define P0 pix_l[3 * xstride] ++#define Q0 pix_r[0 * xstride] ++#define Q1 pix_r[1 * xstride] ++#define Q2 pix_r[2 * xstride] ++#define Q3 pix_r[3 * xstride] ++ ++// line three. used only for deblocking decision ++#define TP3 pix_l[0 * xstride + 3 * ystride] ++#define TP2 pix_l[1 * xstride + 3 * ystride] ++#define TP1 pix_l[2 * xstride + 3 * ystride] ++#define TP0 pix_l[3 * xstride + 3 * ystride] ++#define TQ0 pix_r[0 * xstride + 3 * ystride] ++#define TQ1 pix_r[1 * xstride + 3 * ystride] ++#define TQ2 pix_r[2 * xstride + 3 * ystride] ++#define TQ3 pix_r[3 * xstride + 3 * ystride] ++ ++// This is identical to hevc_loop_filter_luma except that the P/Q ++// components are on separate pointers ++static void FUNC(hevc_v_loop_filter_luma2)(uint8_t * _pix_r, ++ unsigned int _stride, unsigned int beta, unsigned int tc2, unsigned int no_f, ++ uint8_t * _pix_l) ++{ ++ int d, j; ++ pixel *pix_l = (pixel *)_pix_l; ++ pixel *pix_r = (pixel *)_pix_r; ++ const ptrdiff_t xstride = 1; ++ const ptrdiff_t ystride = _stride / sizeof(pixel); ++ ++ beta <<= BIT_DEPTH - 8; ++ ++ for (j = 0; j < 2; j++) { ++ const int dp0 = abs(P2 - 2 * P1 + P0); ++ const int dq0 = abs(Q2 - 2 * Q1 + Q0); ++ const int dp3 = abs(TP2 - 2 * TP1 + TP0); ++ const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0); ++ const int d0 = dp0 + dq0; ++ const int d3 = dp3 + dq3; ++ const int tc = ((tc2 >> (j << 4)) & 0xffff) << (BIT_DEPTH - 8); ++ const int no_p = no_f & 1; ++ const int no_q = no_f & 2; ++ ++ if (d0 + d3 >= beta) { ++ pix_l += 4 * ystride; ++ pix_r += 4 * ystride; ++ continue; ++ } else { ++ const int beta_3 = beta >> 3; ++ const int beta_2 = beta >> 2; ++ const int tc25 = ((tc * 5 + 1) >> 1); ++ ++ if (abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 && ++ abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 && ++ (d0 << 1) < beta_2 && (d3 << 1) < beta_2) { ++ // strong filtering ++ const int tc2 = tc << 1; ++ for (d = 0; d < 4; d++) { ++ const int p3 = P3; ++ const int p2 = P2; ++ const int p1 = P1; ++ const int p0 = P0; ++ const int q0 = Q0; ++ const int q1 = Q1; ++ const int q2 = Q2; ++ const int q3 = Q3; ++ if (!no_p) { ++ P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc2, tc2); ++ P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2); ++ P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc2, tc2); ++ } ++ if (!no_q) { ++ Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc2, tc2); ++ Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2); ++ Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc2, tc2); ++ } ++ pix_l += ystride; ++ pix_r += ystride; ++ } ++ } else { // normal filtering ++ int nd_p = 1; ++ int nd_q = 1; ++ const int tc_2 = tc >> 1; ++ if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3)) ++ nd_p = 2; ++ if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3)) ++ nd_q = 2; ++ ++ for (d = 0; d < 4; d++) { ++ const int p2 = P2; ++ const int p1 = P1; ++ const int p0 = P0; ++ const int q0 = Q0; ++ const int q1 = Q1; ++ const int q2 = Q2; ++ int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4; ++ if (abs(delta0) < 10 * tc) { ++ delta0 = av_clip(delta0, -tc, tc); ++ if (!no_p) ++ P0 = av_clip_pixel(p0 + delta0); ++ if (!no_q) ++ Q0 = av_clip_pixel(q0 - delta0); ++ if (!no_p && nd_p > 1) { ++ const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2); ++ P1 = av_clip_pixel(p1 + deltap1); ++ } ++ if (!no_q && nd_q > 1) { ++ const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2); ++ Q1 = av_clip_pixel(q1 + deltaq1); ++ } ++ } ++ pix_l += ystride; ++ pix_r += ystride; ++ } ++ } ++ } ++ } ++} ++ ++static void FUNC(hevc_h_loop_filter_luma2)(uint8_t * _pix_r, ++ unsigned int _stride, unsigned int beta, unsigned int tc2, unsigned int no_f) ++{ ++ // Just call the non-2 function having massaged the parameters ++ int32_t tc[2] = {tc2 & 0xffff, tc2 >> 16}; ++ uint8_t no_p[2] = {no_f & 1, no_f & 1}; ++ uint8_t no_q[2] = {no_f & 2, no_f & 2}; ++ FUNC(hevc_h_loop_filter_luma)(_pix_r, _stride, beta, tc, no_p, no_q); ++} ++ ++#undef TP3 ++#undef TP2 ++#undef TP1 ++#undef TP0 ++#undef TQ0 ++#undef TQ1 ++#undef TQ2 ++#undef TQ3 ++ ++#undef P3 ++#undef P2 ++#undef P1 ++#undef P0 ++#undef Q0 ++#undef Q1 ++#undef Q2 ++#undef Q3 ++ ++#define P1 pix_l[0 * xstride] ++#define P0 pix_l[1 * xstride] ++#define Q0 pix_r[0 * xstride] ++#define Q1 pix_r[1 * xstride] ++ ++static void FUNC(hevc_loop_filter_uv2)(uint8_t *_pix_l, ptrdiff_t _xstride, ++ ptrdiff_t _ystride, const int32_t *_tc, ++ const uint8_t *_no_p, const uint8_t *_no_q, uint8_t *_pix_r) ++{ ++ int d, j, no_p, no_q; ++ pixel *pix_l = (pixel *)_pix_l; ++ pixel *pix_r = (pixel *)_pix_r; ++ ptrdiff_t xstride = _xstride / sizeof(pixel); ++ ptrdiff_t ystride = _ystride / sizeof(pixel); ++ ++ for (j = 0; j < 2; j++) { ++ const int tc = _tc[j] << (BIT_DEPTH - 8); ++ if (tc <= 0) { ++ pix_l += 4 * ystride; ++ pix_r += 4 * ystride; ++ continue; ++ } ++ no_p = _no_p[j]; ++ no_q = _no_q[j]; ++ ++ for (d = 0; d < 4; d++) { ++ int delta0; ++ const int p1 = P1; ++ const int p0 = P0; ++ const int q0 = Q0; ++ const int q1 = Q1; ++ delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc); ++ if (!no_p) ++ P0 = av_clip_pixel(p0 + delta0); ++ if (!no_q) ++ Q0 = av_clip_pixel(q0 - delta0); ++ pix_l += ystride; ++ pix_r += ystride; ++ } ++ } ++} ++ ++static void FUNC(hevc_h_loop_filter_uv)(uint8_t * pix, unsigned int stride, uint32_t tc4, ++ unsigned int no_f) ++{ ++ uint8_t no_p[2] = {no_f & 1, no_f & 2}; ++ uint8_t no_q[2] = {no_f & 4, no_f & 8}; ++ int32_t tc[4] = {tc4 & 0xff, (tc4 >> 8) & 0xff, (tc4 >> 16) & 0xff, tc4 >> 24}; ++ FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel) * 2, tc, no_p, no_q); ++ FUNC(hevc_loop_filter_chroma)(pix + sizeof(pixel), stride, sizeof(pixel) * 2, tc + 2, no_p, no_q); ++} ++ ++static void FUNC(hevc_v_loop_filter_uv2)(uint8_t * src_r, unsigned int stride, uint32_t tc4, ++ uint8_t * src_l, ++ unsigned int no_f) ++{ ++ uint8_t no_p[2] = {no_f & 1, no_f & 2}; ++ uint8_t no_q[2] = {no_f & 4, no_f & 8}; ++ int32_t tc[4] = {tc4 & 0xff, (tc4 >> 8) & 0xff, (tc4 >> 16) & 0xff, tc4 >> 24}; ++ FUNC(hevc_loop_filter_uv2)(src_l, sizeof(pixel) * 2, stride, tc, no_p, no_q, src_r); ++ FUNC(hevc_loop_filter_uv2)(src_l + sizeof(pixel), sizeof(pixel) * 2, stride, tc + 2, no_p, no_q, src_r + sizeof(pixel)); ++} ++ ++#undef P1 ++#undef P0 ++#undef Q0 ++#undef Q1 ++ +--- /dev/null ++++ b/libavcodec/rpi_hevcpred.c +@@ -0,0 +1,161 @@ ++/* ++ * HEVC video Decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * Copyright (C) 2018 John Cox for Raspberry Pi (Trading) ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "rpi_hevcdec.h" ++ ++#include "rpi_hevcpred.h" ++#if (ARCH_ARM) ++#include "arm/rpi_hevcpred_arm.h" ++#endif ++ ++#define PRED_C 0 ++#define BIT_DEPTH 8 ++#include "rpi_hevcpred_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 9 ++#include "rpi_hevcpred_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 10 ++#include "rpi_hevcpred_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 12 ++#include "rpi_hevcpred_template.c" ++#undef BIT_DEPTH ++#undef PRED_C ++ ++#define PRED_C 1 ++#define BIT_DEPTH 8 ++#include "rpi_hevcpred_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 9 ++#include "rpi_hevcpred_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 10 ++#include "rpi_hevcpred_template.c" ++#undef BIT_DEPTH ++ ++#define BIT_DEPTH 12 ++#include "rpi_hevcpred_template.c" ++#undef BIT_DEPTH ++#undef PRED_C ++ ++void ff_hevc_rpi_pred_init(HEVCRpiPredContext *hpc, int bit_depth) ++{ ++#undef FUNC ++#define FUNC(a, depth) a ## _ ## depth ++ ++#undef FUNCC ++#define FUNCC(a, depth) a ## _ ## depth ## _c ++ ++#define HEVC_PRED_Y(depth) \ ++ hpc->intra_pred = FUNC(intra_pred, depth); \ ++ hpc->intra_filter[0] = FUNC(intra_filter_2, depth); \ ++ hpc->intra_filter[1] = FUNC(intra_filter_3, depth); \ ++ hpc->intra_filter[2] = FUNC(intra_filter_4, depth); \ ++ hpc->intra_filter[3] = FUNC(intra_filter_5, depth); \ ++ hpc->pred_planar[0] = FUNC(pred_planar_0, depth); \ ++ hpc->pred_planar[1] = FUNC(pred_planar_1, depth); \ ++ hpc->pred_planar[2] = FUNC(pred_planar_2, depth); \ ++ hpc->pred_planar[3] = FUNC(pred_planar_3, depth); \ ++ hpc->pred_dc[0] = FUNC(pred_dc_0, depth); \ ++ hpc->pred_dc[1] = FUNC(pred_dc_1, depth); \ ++ hpc->pred_dc[2] = FUNC(pred_dc_2, depth); \ ++ hpc->pred_dc[3] = FUNC(pred_dc_3, depth); \ ++ hpc->pred_vertical[0] = FUNC(pred_angular_0, depth); \ ++ hpc->pred_vertical[1] = FUNC(pred_angular_1, depth); \ ++ hpc->pred_vertical[2] = FUNC(pred_angular_2, depth); \ ++ hpc->pred_vertical[3] = FUNC(pred_angular_3, depth); \ ++ hpc->pred_horizontal[0] = FUNC(pred_angular_0, depth); \ ++ hpc->pred_horizontal[1] = FUNC(pred_angular_1, depth); \ ++ hpc->pred_horizontal[2] = FUNC(pred_angular_2, depth); \ ++ hpc->pred_horizontal[3] = FUNC(pred_angular_3, depth); \ ++ hpc->pred_angular[0] = FUNC(pred_angular_0, depth); \ ++ hpc->pred_angular[1] = FUNC(pred_angular_1, depth); \ ++ hpc->pred_angular[2] = FUNC(pred_angular_2, depth); \ ++ hpc->pred_angular[3] = FUNC(pred_angular_3, depth); \ ++ hpc->pred_dc0[0] = FUNC(pred_dc0_0, depth); \ ++ hpc->pred_dc0[1] = FUNC(pred_dc0_1, depth); \ ++ hpc->pred_dc0[2] = FUNC(pred_dc0_2, depth); \ ++ hpc->pred_dc0[3] = FUNC(pred_dc0_3, depth); ++ ++#define HEVC_PRED_C(depth) \ ++ hpc->intra_pred_c = FUNCC(intra_pred, depth); \ ++ hpc->intra_filter_c[0] = FUNCC(intra_filter_2, depth); \ ++ hpc->intra_filter_c[1] = FUNCC(intra_filter_3, depth); \ ++ hpc->intra_filter_c[2] = FUNCC(intra_filter_4, depth); \ ++ hpc->intra_filter_c[3] = FUNCC(intra_filter_5, depth); \ ++ hpc->pred_planar_c[0] = FUNCC(pred_planar_0, depth); \ ++ hpc->pred_planar_c[1] = FUNCC(pred_planar_1, depth); \ ++ hpc->pred_planar_c[2] = FUNCC(pred_planar_2, depth); \ ++ hpc->pred_planar_c[3] = FUNCC(pred_planar_3, depth); \ ++ hpc->pred_dc_c[0] = FUNCC(pred_dc_0, depth); \ ++ hpc->pred_dc_c[1] = FUNCC(pred_dc_1, depth); \ ++ hpc->pred_dc_c[2] = FUNCC(pred_dc_2, depth); \ ++ hpc->pred_dc_c[3] = FUNCC(pred_dc_3, depth); \ ++ hpc->pred_vertical_c[0] = FUNCC(pred_angular_0, depth); \ ++ hpc->pred_vertical_c[1] = FUNCC(pred_angular_1, depth); \ ++ hpc->pred_vertical_c[2] = FUNCC(pred_angular_2, depth); \ ++ hpc->pred_vertical_c[3] = FUNCC(pred_angular_3, depth); \ ++ hpc->pred_horizontal_c[0] = FUNCC(pred_angular_0, depth); \ ++ hpc->pred_horizontal_c[1] = FUNCC(pred_angular_1, depth); \ ++ hpc->pred_horizontal_c[2] = FUNCC(pred_angular_2, depth); \ ++ hpc->pred_horizontal_c[3] = FUNCC(pred_angular_3, depth); \ ++ hpc->pred_angular_c[0] = FUNCC(pred_angular_0, depth); \ ++ hpc->pred_angular_c[1] = FUNCC(pred_angular_1, depth); \ ++ hpc->pred_angular_c[2] = FUNCC(pred_angular_2, depth); \ ++ hpc->pred_angular_c[3] = FUNCC(pred_angular_3, depth); \ ++ hpc->pred_dc0_c[0] = FUNCC(pred_dc0_0, depth); \ ++ hpc->pred_dc0_c[1] = FUNCC(pred_dc0_1, depth); \ ++ hpc->pred_dc0_c[2] = FUNCC(pred_dc0_2, depth); \ ++ hpc->pred_dc0_c[3] = FUNCC(pred_dc0_3, depth); ++ ++#define HEVC_PRED(depth) \ ++ HEVC_PRED_Y(depth); \ ++ HEVC_PRED_C(depth); ++ ++ switch (bit_depth) { ++ case 9: ++ HEVC_PRED(9); ++ break; ++ case 10: ++ HEVC_PRED(10); ++ break; ++ case 12: ++ HEVC_PRED(12); ++ break; ++ default: ++ HEVC_PRED(8); ++ break; ++ } ++ ++#if (ARCH_ARM) ++ ff_hevc_rpi_pred_init_arm(hpc, bit_depth); ++#elif (ARCH_MIPS) ++ ff_hevc_rpi_pred_init_mips(hpc, bit_depth); ++#endif ++} +--- /dev/null ++++ b/libavcodec/rpi_hevcpred.h +@@ -0,0 +1,123 @@ ++/* ++ * HEVC video Decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_RPI_HEVCPRED_H ++#define AVCODEC_RPI_HEVCPRED_H ++ ++#include ++#include ++#include "config.h" ++ ++struct HEVCRpiContext; ++struct HEVCRpiLocalContext; ++ ++enum IntraPredMode { ++ INTRA_PLANAR = 0, ++ INTRA_DC, ++ INTRA_ANGULAR_2, ++ INTRA_ANGULAR_3, ++ INTRA_ANGULAR_4, ++ INTRA_ANGULAR_5, ++ INTRA_ANGULAR_6, ++ INTRA_ANGULAR_7, ++ INTRA_ANGULAR_8, ++ INTRA_ANGULAR_9, ++ INTRA_ANGULAR_10, ++ INTRA_ANGULAR_11, ++ INTRA_ANGULAR_12, ++ INTRA_ANGULAR_13, ++ INTRA_ANGULAR_14, ++ INTRA_ANGULAR_15, ++ INTRA_ANGULAR_16, ++ INTRA_ANGULAR_17, ++ INTRA_ANGULAR_18, ++ INTRA_ANGULAR_19, ++ INTRA_ANGULAR_20, ++ INTRA_ANGULAR_21, ++ INTRA_ANGULAR_22, ++ INTRA_ANGULAR_23, ++ INTRA_ANGULAR_24, ++ INTRA_ANGULAR_25, ++ INTRA_ANGULAR_26, ++ INTRA_ANGULAR_27, ++ INTRA_ANGULAR_28, ++ INTRA_ANGULAR_29, ++ INTRA_ANGULAR_30, ++ INTRA_ANGULAR_31, ++ INTRA_ANGULAR_32, ++ INTRA_ANGULAR_33, ++ INTRA_ANGULAR_34, ++}; ++#define INTRA_ANGULAR_HORIZONTAL INTRA_ANGULAR_10 ++#define INTRA_ANGULAR_VERTICAL INTRA_ANGULAR_26 ++ ++typedef void intra_filter_fn_t( ++ uint8_t * const left, uint8_t * const top, ++ const unsigned int req, const unsigned int avail, ++ const uint8_t * const src_l, const uint8_t * const src_u, const uint8_t * const src_ur, ++ const unsigned int stride, ++ const unsigned int top_right_size, const unsigned int down_left_size); ++ ++typedef struct HEVCRpiPredContext { ++ void (*intra_pred)(const struct HEVCRpiContext * const s, ++ const enum IntraPredMode mode, const unsigned int x0, const unsigned int y0, ++ const unsigned int avail, const unsigned int log2_size); ++ ++ intra_filter_fn_t *intra_filter[4]; ++ void (*pred_planar[4])(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ptrdiff_t stride); ++ void (*pred_dc[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, ++ ptrdiff_t stride); ++ void (*pred_angular[4])(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ptrdiff_t stride, ++ int mode); ++ void (*pred_vertical[4])(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ptrdiff_t stride, ++ int mode); ++ void (*pred_horizontal[4])(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ptrdiff_t stride, ++ int mode); ++ void (*pred_dc0[4])(uint8_t *src, ptrdiff_t stride); ++ ++ void (*intra_pred_c)(const struct HEVCRpiContext * const s, ++ const enum IntraPredMode mode, const unsigned int x0, const unsigned int y0, ++ const unsigned int avail, const unsigned int log2_size); ++ intra_filter_fn_t *intra_filter_c[4]; ++ void (*pred_planar_c[4])(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ptrdiff_t stride); ++ void (*pred_dc_c[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, ++ ptrdiff_t stride); ++ void (*pred_angular_c[4])(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ptrdiff_t stride, ++ int mode); ++ void (*pred_vertical_c[4])(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ptrdiff_t stride, ++ int mode); ++ void (*pred_horizontal_c[4])(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ptrdiff_t stride, ++ int mode); ++ void (*pred_dc0_c[4])(uint8_t *src, ptrdiff_t stride); ++} HEVCRpiPredContext; ++ ++void ff_hevc_rpi_pred_init(HEVCRpiPredContext *hpc, int bit_depth); ++ ++#endif /* AVCODEC_RPI_HEVCPRED_H */ +--- /dev/null ++++ b/libavcodec/rpi_hevcpred_template.c +@@ -0,0 +1,1407 @@ ++/* ++ * HEVC video decoder ++ * ++ * Copyright (C) 2012 - 2013 Guillaume Martres ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "config.h" ++#include "libavutil/pixdesc.h" ++#include "libavutil/rpi_sand_fns.h" ++#include "bit_depth_template.c" ++ ++#include "rpi_hevcdec.h" ++#include "rpi_hevcpred.h" ++ ++#define DUMP_PRED 0 ++ ++#define POS(x, y) src[(x) + stride * (y)] ++ ++// INCLUDED_ONCE defined at EOF ++#ifndef INCLUDED_ONCE ++typedef uint8_t (* c8_dst_ptr_t)[2]; ++typedef const uint8_t (* c8_src_ptr_t)[2]; ++typedef uint16_t (* c16_dst_ptr_t)[2]; ++typedef const uint16_t (* c16_src_ptr_t)[2]; ++ ++// *** On ARM make these NEON registers ++typedef struct pixel4_16 { ++ uint16_t x[4]; ++} pixel4_16; ++typedef struct pixel4_32 { ++ uint32_t x[4]; ++} pixel4_32; ++static inline pixel4_16 PIXEL_SPLAT_X4_16(const uint16_t x) ++{ ++ pixel4_16 t = {{x, x, x, x}}; ++ return t; ++} ++static inline pixel4_32 PIXEL_SPLAT_X4_32(const uint32_t x) ++{ ++ pixel4_32 t = {{x, x, x, x}}; ++ return t; ++} ++#endif ++ ++#if PRED_C ++// For chroma we double pixel size so we copy pairs ++#undef pixel ++#undef pixel2 ++#undef pixel4 ++#undef dctcoef ++#undef INIT_CLIP ++#undef no_rnd_avg_pixel4 ++#undef rnd_avg_pixel4 ++#undef AV_RN2P ++#undef AV_RN4P ++#undef AV_RN4PA ++#undef AV_WN2P ++#undef AV_WN4P ++#undef AV_WN4PA ++#undef CLIP ++#undef FUNC ++#undef FUNCC ++#undef av_clip_pixel ++#undef PIXEL_SPLAT_X4 ++ ++#if BIT_DEPTH == 8 ++#define pixel uint16_t ++#define pixel4 pixel4_16 ++#define PIXEL_SPLAT_X4 PIXEL_SPLAT_X4_16 ++#define cpel uint8_t ++#define c_src_ptr_t c8_src_ptr_t ++#define c_dst_ptr_t c8_dst_ptr_t ++#else ++#define pixel uint32_t ++#define pixel4 pixel4_32 ++#define PIXEL_SPLAT_X4 PIXEL_SPLAT_X4_32 ++#define cpel uint16_t ++#define c_src_ptr_t c16_dst_ptr_t ++#define c_dst_ptr_t c16_dst_ptr_t ++#endif ++#define AV_RN4P(p) (*(pixel4*)(p)) ++#define AV_WN4P(p,x) (*(pixel4*)(p) = (x)) ++#define FUNC(a) FUNC2(a, BIT_DEPTH, _c) ++#endif ++ ++ ++// Get PW prior to horrid PRED_C trickery ++#if BIT_DEPTH == 8 ++#define PW 1 ++#else ++#define PW 2 ++#endif ++ ++ ++#if DUMP_PRED && !defined(INCLUDED_ONCE) ++static void dump_pred_uv(const uint8_t * data, const unsigned int stride, const unsigned int size) ++{ ++ for (unsigned int y = 0; y != size; y++, data += stride * 2) { ++ for (unsigned int x = 0; x != size; x++) { ++ printf("%4d", data[x * 2]); ++ } ++ printf("\n"); ++ } ++ printf("\n"); ++} ++#endif ++ ++#ifndef INCLUDED_ONCE ++static inline void extend_8(void * ptr, const unsigned int v, unsigned int n) ++{ ++ if ((n >>= 2) != 0) { ++ uint32_t v4 = v | (v << 8); ++ uint32_t * p = (uint32_t *)ptr; ++ v4 = v4 | (v4 << 16); ++ do { ++ *p++ = v4; ++ } while (--n != 0); ++ } ++} ++ ++static inline void extend_16(void * ptr, const unsigned int v, unsigned int n) ++{ ++ if ((n >>= 2) != 0) { ++ uint32_t v2 = v | (v << 16); ++ uint32_t * p = (uint32_t *)ptr; ++ do { ++ *p++ = v2; ++ *p++ = v2; ++ } while (--n != 0); ++ } ++} ++ ++static inline void extend_32(void * ptr, const unsigned int v, unsigned int n) ++{ ++ if ((n >>= 2) != 0) { ++ uint32_t * p = (uint32_t *)ptr; ++ do { ++ *p++ = v; ++ *p++ = v; ++ *p++ = v; ++ *p++ = v; ++ } while (--n != 0); ++ } ++} ++ ++// Beware that this inverts the avail ordering ++// For CIP it seems easier this way round ++static unsigned int cip_avail_l(const uint8_t * is_intra, const int i_stride, const unsigned int i_mask, ++ const unsigned int log2_intra_bits, const unsigned int avail, unsigned int size, ++ unsigned int s0, unsigned int odd_s) ++{ ++ const unsigned int n = 1 << log2_intra_bits; ++ unsigned int fa = 0; ++ unsigned int i; ++ ++ size >>= 2; // Now in 4-pel units ++ s0 >>= 2; ++ ++ if ((avail & AVAIL_DL) != 0) ++ fa |= ((1 << s0) - 1) << (size - s0); ++ if ((avail & AVAIL_L) != 0) ++ fa |= ((1 << size) - 1) << size; ++ if ((avail & AVAIL_UL) != 0) ++ fa |= 1 << (size << 1); ++ ++ if (odd_s) { ++ if ((fa & 1) != 0 && (*is_intra & i_mask) == 0) ++ fa &= ~1; ++ is_intra += i_stride; ++ } ++ ++ for (i = odd_s; (fa >> i) != 0; i += n, is_intra += i_stride) { ++ const unsigned int m = ((1 << n) - 1) << i; ++ if ((fa & m) != 0 && (*is_intra & i_mask) == 0) ++ fa &= ~m; ++ } ++ ++ return fa; ++} ++ ++static unsigned int cip_avail_u(const uint8_t * is_intra, unsigned int i_shift, ++ const unsigned int log2_intra_bits, const unsigned int avail, unsigned int size, ++ unsigned int s1, unsigned int odd_s) ++{ ++ if ((avail & (AVAIL_U | AVAIL_UR)) == 0) ++ { ++ return 0; ++ } ++ else ++ { ++ const unsigned int n = 1 << log2_intra_bits; ++ unsigned int fa = 0; ++ unsigned int i; ++ unsigned int im = ((is_intra[1] << 8) | (is_intra[0])) >> i_shift; ++ ++ size >>= 2; // Now in 4-pel units ++ s1 >>= 2; ++ ++ if ((avail & AVAIL_U) != 0) ++ fa |= ((1 << size) - 1); ++ if ((avail & AVAIL_UR) != 0) ++ fa |= ((1 << s1) - 1) << size; ++ ++ if (odd_s) { ++ fa &= im | ~1; ++ im >>= 1; ++ } ++ ++ for (i = odd_s; (fa >> i) != 0; i += n, im >>= 1) { ++ const unsigned int m = ((1 << n) - 1) << i; ++ if ((im & 1) == 0) ++ fa &= ~m; ++ } ++ return fa; ++ } ++} ++ ++ ++ ++static inline unsigned int rmbd(unsigned int x) ++{ ++#if 1 ++ return __builtin_ctz(x); ++#else ++ unsigned int n = 0; ++ if ((x & 0xffff) == 0) { ++ x >>= 16; ++ n += 16; ++ } ++ if ((x & 0xff) == 0) { ++ x >>= 8; ++ n += 8; ++ } ++ if ((x & 0xf) == 0) { ++ x >>= 4; ++ n += 4; ++ } ++ if ((x & 0x3) == 0) { ++ x >>= 2; ++ n += 2; ++ } ++ ++ return (x & 1) == 0 ? n + 1 : n; ++#endif ++} ++#endif ++ ++ ++static void FUNC(cip_fill)(pixel * const left, pixel * const top, ++ const unsigned int avail_l, const unsigned int avail_u, ++ const pixel * const src_l, const pixel * const src_u, const pixel * const src_ur, ++ const unsigned int stride, ++ const unsigned int size) ++{ ++ pixel a; ++ unsigned int i; ++ ++ // 1st find DL value ++ if ((avail_l & 1) == 0) { ++ if (avail_l != 0) ++ a = src_l[((int)size * 2 - 1 - (int)rmbd(avail_l)*4) * (int)stride]; ++ else ++ { ++ // (avail_l | avail_u) != 0 so this must be good ++ const unsigned int n = rmbd(avail_u)*4; ++ a = (n >= size) ? src_ur[n - size] : src_u[n]; ++ } ++ } ++ ++ // L ++ { ++ pixel * d = left + size * 2 - 1; ++ const pixel * s = src_l + (size * 2 - 1) * stride; ++ unsigned int x = avail_l; ++ for (i = 0; i < size * 2; i += 4, x >>= 1) ++ { ++ if ((x & 1) != 0) { ++ // Avail ++ *d-- = *s; ++ s -= stride; ++ *d-- = *s; ++ s -= stride; ++ *d-- = *s; ++ s -= stride; ++ *d-- = a = *s; ++ s -= stride; ++ } ++ else ++ { ++ *d-- = a; ++ *d-- = a; ++ *d-- = a; ++ *d-- = a; ++ s -= stride * 4; ++ } ++ } ++ // UL ++ *d = a = (x & 1) != 0 ? *s : a; ++ } ++ ++ // U ++ { ++ pixel * d = top; ++ const pixel * s = src_u; ++ unsigned int x = avail_u; ++ ++ for (i = 0; i < size; i += 4, x >>= 1) ++ { ++ if ((x & 1) != 0) { ++ // Avail ++ *d++ = *s++; ++ *d++ = *s++; ++ *d++ = *s++; ++ *d++ = a = *s++; ++ } ++ else ++ { ++ *d++ = a; ++ *d++ = a; ++ *d++ = a; ++ *d++ = a; ++ s += 4; ++ } ++ } ++ ++ // UR ++ s = src_ur; ++ for (i = 0; i < size; i += 4, x >>= 1) ++ { ++ if ((x & 1) != 0) { ++ // Avail ++ *d++ = *s++; ++ *d++ = *s++; ++ *d++ = *s++; ++ *d++ = a = *s++; ++ } ++ else ++ { ++ *d++ = a; ++ *d++ = a; ++ *d++ = a; ++ *d++ = a; ++ s += 4; ++ } ++ } ++ } ++} ++ ++ ++#if !PRED_C && PW == 1 ++#define EXTEND(ptr, val, len) extend_8(ptr, val, len) ++#elif (!PRED_C && PW == 2) || (PRED_C && PW == 1) ++#define EXTEND(ptr, val, len) extend_16(ptr, val, len) ++#else ++#define EXTEND(ptr, val, len) extend_32(ptr, val, len) ++#endif ++ ++// Reqs: ++// ++// Planar: DL[0], L, ul, U, UR[0] ++// DC: dl, L, ul, U, ur ++// A2-9: DL, L, ul, u, ur ++// A10: dl, L, ul, u, ur ++// A11-17 dl, L, UL, U, ur ++// A18-25 dl, L, Ul, U, ur ++// A26 dl, l, ul, U, ur ++// A27-34 dl, l, ul, U, UR ++ ++#ifndef INCLUDED_ONCE ++ ++intra_filter_fn_t ff_hevc_rpi_intra_filter_8_neon_8; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_4_neon_16; ++intra_filter_fn_t ff_hevc_rpi_intra_filter_8_neon_16; ++ ++static const uint8_t req_avail_c[35] = ++{ ++ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR, // Planar (DL[0] & UR[0] only needed) ++ AVAIL_L | 0 | AVAIL_U, // DC ++ AVAIL_DL | AVAIL_L, // 2 ++ AVAIL_DL | AVAIL_L, // 3 ++ AVAIL_DL | AVAIL_L, // 4 ++ AVAIL_DL | AVAIL_L, // 5 ++ AVAIL_DL | AVAIL_L, // 6 ++ AVAIL_DL | AVAIL_L, // 7 ++ AVAIL_DL | AVAIL_L, // 8 ++ AVAIL_DL | AVAIL_L, // 9 ++ AVAIL_L, // 10 (H) ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 11 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 12 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 13 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 14 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 15 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 16 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 17 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 18 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 19 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 20 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 21 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 22 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 23 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 24 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 25 ++ AVAIL_U, // 26 (V) ++ AVAIL_U | AVAIL_UR, // 27 ++ AVAIL_U | AVAIL_UR, // 28 ++ AVAIL_U | AVAIL_UR, // 29 ++ AVAIL_U | AVAIL_UR, // 30 ++ AVAIL_U | AVAIL_UR, // 31 ++ AVAIL_U | AVAIL_UR, // 32 ++ AVAIL_U | AVAIL_UR, // 33 ++ AVAIL_U | AVAIL_UR // 34 ++}; ++ ++static const uint8_t req_avail[4][35] = { ++{ ++ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR, // Planar (DL[0] & UR[0] only needed) ++ AVAIL_L | 0 | AVAIL_U, // DC ++ AVAIL_DL | AVAIL_L, // 2 ++ AVAIL_DL | AVAIL_L, // 3 ++ AVAIL_DL | AVAIL_L, // 4 ++ AVAIL_DL | AVAIL_L, // 5 ++ AVAIL_DL | AVAIL_L, // 6 ++ AVAIL_DL | AVAIL_L, // 7 ++ AVAIL_DL | AVAIL_L, // 8 ++ AVAIL_DL | AVAIL_L, // 9 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 10 (H) ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 11 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 12 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 13 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 14 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 15 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 16 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 17 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 18 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 19 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 20 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 21 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 22 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 23 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 24 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 25 ++ AVAIL_L | AVAIL_UL | AVAIL_U, // 26 (V) ++ AVAIL_U | AVAIL_UR, // 27 ++ AVAIL_U | AVAIL_UR, // 28 ++ AVAIL_U | AVAIL_UR, // 29 ++ AVAIL_U | AVAIL_UR, // 30 ++ AVAIL_U | AVAIL_UR, // 31 ++ AVAIL_U | AVAIL_UR, // 32 ++ AVAIL_U | AVAIL_UR, // 33 ++ AVAIL_U | AVAIL_UR // 34 ++}, ++{ // 3 ++ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR | FILTER_LIGHT, // Planar (DL[0] & UR[0] only needed) ++ AVAIL_L | 0 | AVAIL_U, // DC ++ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 2 ++ AVAIL_DL | AVAIL_L | 0, // 3 ++ AVAIL_DL | AVAIL_L | 0, // 4 ++ AVAIL_DL | AVAIL_L | 0, // 5 ++ AVAIL_DL | AVAIL_L | 0, // 6 ++ AVAIL_DL | AVAIL_L | 0, // 7 ++ AVAIL_DL | AVAIL_L | 0, // 8 ++ AVAIL_DL | AVAIL_L | 0, // 9 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 10 (H) ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 11 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 12 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 13 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 14 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 15 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 16 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 17 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 18 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 19 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 20 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 21 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 22 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 23 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 24 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 25 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 26 (V) ++ AVAIL_U | AVAIL_UR | 0, // 27 ++ AVAIL_U | AVAIL_UR | 0, // 28 ++ AVAIL_U | AVAIL_UR | 0, // 29 ++ AVAIL_U | AVAIL_UR | 0, // 30 ++ AVAIL_U | AVAIL_UR | 0, // 31 ++ AVAIL_U | AVAIL_UR | 0, // 32 ++ AVAIL_U | AVAIL_UR | 0, // 33 ++ AVAIL_U | AVAIL_UR | FILTER_LIGHT // 34 ++}, ++{ // 4 ++ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR | FILTER_LIGHT, // Planar (DL[0] & UR[0] only needed) ++ AVAIL_L | 0 | AVAIL_U, // DC ++ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 2 ++ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 3 ++ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 4 ++ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 5 ++ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 6 ++ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 7 ++ AVAIL_DL | AVAIL_L | FILTER_LIGHT, // 8 ++ AVAIL_DL | AVAIL_L | 0, // 9 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 10 (H) ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 11 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 12 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 13 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 14 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 15 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 16 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 17 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 18 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 19 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 20 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 21 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 22 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 23 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_LIGHT, // 24 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 25 ++ AVAIL_L | AVAIL_UL | AVAIL_U | 0, // 26 (V) ++ AVAIL_U | AVAIL_UR | 0, // 27 ++ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 28 ++ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 29 ++ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 30 ++ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 31 ++ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 32 ++ AVAIL_U | AVAIL_UR | FILTER_LIGHT, // 33 ++ AVAIL_U | AVAIL_UR | FILTER_LIGHT // 34 ++}, ++{ // 5 ++ AVAIL_DL | AVAIL_L | 0 | AVAIL_U | AVAIL_UR | FILTER_EITHER, // Planar (DL[0] & UR[0] only needed) ++ AVAIL_L | 0 | AVAIL_U, // DC ++ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 2 ++ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 3 ++ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 4 ++ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 5 ++ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 6 ++ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 7 ++ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 8 ++ AVAIL_DL | AVAIL_L | FILTER_EITHER, // 9 ++ AVAIL_L | 0, // 10 (H) ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 11 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 12 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 13 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 14 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 15 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 16 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 17 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 18 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 19 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 20 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 21 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 22 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 23 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 24 ++ AVAIL_L | AVAIL_UL | AVAIL_U | FILTER_EITHER, // 25 ++ AVAIL_U | 0, // 26 (V) ++ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 27 ++ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 28 ++ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 29 ++ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 30 ++ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 31 ++ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 32 ++ AVAIL_U | AVAIL_UR | FILTER_EITHER, // 33 ++ AVAIL_U | AVAIL_UR | FILTER_EITHER // 34 ++} ++}; ++ ++ ++#endif ++ ++#define filter_light1 FUNC(filter_light1) ++static inline pixel filter_light1(pixel a, pixel b, pixel c) ++{ ++ return (a + b*2 + c + 2) >> 2; ++} ++ ++#define filter_light FUNC(filter_light) ++static inline void filter_light(pixel * dst, pixel p1, const pixel * src, const pixel pn, const int sstride, const unsigned int n) ++{ ++ pixel p0; ++ pixel p2 = *src; ++ // Allow for final pel - it is just clearer to to have the call take the actual number of output pels ++ unsigned int n_minus_1 = n - 1; ++ ++ do ++ { ++ src += sstride; ++ p0 = p1; ++ p1 = p2; ++ p2 = *src; ++ *dst++ = filter_light1(p0, p1, p2); ++ } while (--n_minus_1 != 0); ++ *dst = filter_light1(p1, p2, pn); ++} ++ ++#define filter_strong FUNC(filter_strong) ++static inline void filter_strong(pixel * dst, const unsigned int p0, const unsigned int p1, unsigned int n) ++{ ++ unsigned int a = 64 * p0 + 32; ++ const int v = p1 - p0; ++ ++ do ++ { ++ *dst++ = (a += v) >> 6; ++ } while (--n != 0); ++} ++ ++#define intra_filter FUNC(intra_filter) ++static av_always_inline void intra_filter( ++ pixel * const left, pixel * const top, ++ const unsigned int req, const unsigned int avail, ++ const pixel * const src_l, const pixel * const src_u, const pixel * const src_ur, ++ const unsigned int stride, ++ const unsigned int top_right_size, const unsigned int down_left_size, ++ const unsigned int log2_size) ++{ ++ const unsigned int strong_threshold = 1 << (BIT_DEPTH - 5); ++ const unsigned int size = 1 << log2_size; ++ ++ // a_ is the first pel in a section working round dl -> ur ++ // b_ is the last ++ // Beware that top & left work out from UL so usage of a_ & b_ may ++ // swap between them. It is a bad naming scheme but I have found no ++ // better ++ const pixel * a_dl = src_l + (down_left_size + size - 1) * stride; ++ const pixel * b_dl = src_l + size * stride; ++ const pixel * a_l = src_l + (size - 1) * stride; ++ const pixel * b_l = src_l; ++ const pixel * ab_ul = src_l - stride; ++ const pixel * a_u = src_u; ++ const pixel * b_u = src_u + size - 1; ++ const pixel * a_ur = src_ur; ++ const pixel * b_ur = src_ur + top_right_size - 1; ++ ++ const unsigned int want = req & ~avail; ++ const unsigned int have = req & avail; ++ unsigned int i; ++ ++ if ((avail & AVAIL_DL) == 0) ++ { ++ a_dl = a_ur; ++ if ((avail & AVAIL_U) != 0) ++ a_dl = a_u; ++ if ((avail & AVAIL_UL) != 0) ++ a_dl = ab_ul; ++ if ((avail & AVAIL_L) != 0) ++ a_dl = a_l; ++ b_dl = a_dl; ++ } ++ ++ if ((avail & AVAIL_L) == 0) ++ { ++ a_l = b_dl; ++ b_l = b_dl; ++ } ++ if ((avail & AVAIL_UL) == 0) ++ { ++ ab_ul = b_l; ++ } ++ if ((avail & AVAIL_U) == 0) ++ { ++ a_u = ab_ul; ++ b_u = ab_ul; ++ } ++ if ((avail & AVAIL_UR) == 0) ++ { ++ a_ur = b_u; ++ b_ur = b_u; ++ } ++ ++ if ((req & FILTER_LIGHT) == 0 || PRED_C || log2_size == 2) // PRED_C, log2_size compiler opt hints ++ { ++ if ((req & AVAIL_UL) != 0) ++ left[-1] = *ab_ul; ++ ++ if ((want & AVAIL_L) != 0) ++ EXTEND(left, *a_l, size); ++ if ((want & AVAIL_DL) != 0) ++ EXTEND(left + size, *a_dl, size); ++ if ((want & AVAIL_U) != 0) ++ EXTEND(top, *a_u, size); ++ if ((want & AVAIL_UR) != 0) ++ EXTEND(top + size, *a_ur, size); ++ ++ if ((have & AVAIL_U) != 0) ++ // Always good - even with sand ++ memcpy(top, a_u, size * sizeof(pixel)); ++ if ((have & AVAIL_UR) != 0) ++ { ++ memcpy(top + size, a_ur, top_right_size * sizeof(pixel)); ++ EXTEND(top + size + top_right_size, *b_ur, ++ size - top_right_size); ++ } ++ if ((have & AVAIL_L) != 0) ++ { ++ for (i = 0; i < size; i++) ++ left[i] = b_l[stride * i]; ++ } ++ if ((have & AVAIL_DL) != 0) ++ { ++ for (i = 0; i < down_left_size; i++) ++ left[i + size] = b_dl[stride * i]; ++ EXTEND(left + size + down_left_size, *a_dl, ++ size - down_left_size); ++ } ++ } ++ else if ((req & FILTER_STRONG) != 0 && log2_size == 5 && // log2_size compiler opt hint ++ FFABS((int)(*a_dl - *a_l * 2 + *ab_ul)) < strong_threshold && ++ FFABS((int)(*ab_ul - *b_u * 2 + *b_ur)) < strong_threshold) ++ { ++ if ((req & (AVAIL_U | AVAIL_UR)) != 0) ++ filter_strong(top, *ab_ul, *b_ur, size * 2); ++ left[-1] = *ab_ul; ++ if ((req & (AVAIL_L | AVAIL_DL)) != 0) ++ filter_strong(left, *ab_ul, *a_dl, size*2); ++ } ++ else ++ { ++ // Same code for both have & want for UL ++ if ((req & AVAIL_UL) != 0) ++ { ++ left[-1] = filter_light1(*b_l, *ab_ul, *a_u); ++ } ++ ++ if ((want & AVAIL_L) != 0) ++ { ++ EXTEND(left, *a_l, size); ++ left[0] = (*a_l * 3 + *ab_ul + 2) >> 2; ++ } ++ if ((want & AVAIL_DL) != 0) ++ { ++ // If we want DL then it cannot be avail so a_dl = a_l so no edge rounding ++ EXTEND(left + size, *a_l, size); ++ } ++ if ((want & AVAIL_U) != 0) ++ { ++ EXTEND(top, *a_u, size); ++ top[size - 1] = (*a_u * 3 + *a_ur + 2) >> 2; ++ } ++ if ((want & AVAIL_UR) != 0) ++ { ++ // If we want UR then it cannot be avail so a_ur = b_u so no edge rounding ++ EXTEND(top + size, *a_ur, size); ++ } ++ ++ if ((have & AVAIL_U) != 0) ++ { ++ filter_light(top, *ab_ul, a_u, *a_ur, 1, size); ++ } ++ if ((have & AVAIL_UR) != 0) { ++ filter_light(top + size, *b_u, a_ur, *b_ur, 1, top_right_size); ++ top[size*2 - 1] = *b_ur; ++ EXTEND(top + size + top_right_size, *b_ur, size - top_right_size); ++ } ++ if ((have & AVAIL_L) != 0) ++ { ++ filter_light(left, *ab_ul, b_l, *b_dl, stride, size); ++ } ++ if ((have & AVAIL_DL) != 0) ++ { ++ filter_light(left + size, *a_l, b_dl, *a_dl, stride, down_left_size); ++ left[size*2 - 1] = *a_dl; ++ EXTEND(left + size + down_left_size, *a_dl, size - down_left_size); ++ } ++ } ++} ++ ++#define INTRA_FILTER(log2_size) \ ++static void FUNC(intra_filter_ ## log2_size)( \ ++ uint8_t * const left, uint8_t * const top, \ ++ const unsigned int req, const unsigned int avail, \ ++ const uint8_t * const src_l, const uint8_t * const src_u, const uint8_t * const src_ur, \ ++ const unsigned int stride, \ ++ const unsigned int top_right_size, const unsigned int down_left_size) \ ++{ \ ++ intra_filter((pixel *)left, (pixel *)top, req, avail, \ ++ (const pixel *)src_l, (const pixel *)src_u, (const pixel *)src_ur, stride / sizeof(pixel), top_right_size, down_left_size, log2_size); \ ++} ++ ++INTRA_FILTER(2) ++INTRA_FILTER(3) ++INTRA_FILTER(4) ++INTRA_FILTER(5) ++ ++#undef intra_filter ++#undef INTRA_FILTER ++ ++static void FUNC(intra_pred)(const HEVCRpiContext * const s, ++ const enum IntraPredMode mode, const unsigned int x0, const unsigned int y0, const unsigned int avail, ++ const unsigned int log2_size) ++{ ++ // c_idx will alaways be 1 for _c versions and 0 for y ++ const unsigned int c_idx = PRED_C; ++ const unsigned int hshift = ctx_hshift(s, c_idx); ++ const unsigned int vshift = ctx_vshift(s, c_idx); ++ const unsigned int size = (1 << log2_size); ++ const unsigned int x = x0 >> hshift; ++ const unsigned int y = y0 >> vshift; ++ ++ const ptrdiff_t stride = frame_stride1(s->frame, c_idx) / sizeof(pixel); ++ pixel *const src = c_idx == 0 ? ++ (pixel *)av_rpi_sand_frame_pos_y(s->frame, x, y) : ++ (pixel *)av_rpi_sand_frame_pos_c(s->frame, x, y); ++ ++ // Align so we can do multiple loads in the asm ++ // Padded to 16 byte boundary so as not to confuse anything ++ DECLARE_ALIGNED(16, pixel, top[2 * MAX_TB_SIZE]); ++ DECLARE_ALIGNED(16, pixel, left_array[2 * MAX_TB_SIZE + 16 / sizeof(pixel)]); ++ ++ pixel * const left = left_array + 16 / sizeof(pixel); ++ const pixel * top_pred = top; ++ ++ const pixel * src_l = src - 1; ++ const pixel * src_u = src - stride; ++ const pixel * src_ur = src_u + size; ++#if !PRED_C ++ const unsigned int req = req_avail[log2_size - 2][mode] & ~s->ps.sps->intra_filters_disable; ++#else ++ const unsigned int req = req_avail_c[mode]; ++#endif ++ ++ // If we have nothing to pred from then fill with grey ++ // This isn't a common case but dealing with it here means we don't have to ++ // test for it later ++ if (avail == 0) ++ { ++dc_only: ++#if !PRED_C ++ s->hpc.pred_dc0[log2_size - 2]((uint8_t *)src, stride); ++#else ++ s->hpc.pred_dc0_c[log2_size - 2]((uint8_t *)src, stride); ++#endif ++ return; ++ } ++ ++ { ++ // N.B. stride is in pixels (not bytes) or in the case of chroma pixel-pairs ++ const AVFrame * const frame = s->frame; ++ const unsigned int mask = stride - 1; // For chroma pixel=uint16 so stride_c is stride_y / 2 ++ const unsigned int stripe_adj = (av_rpi_sand_frame_stride2(frame) - 1) * stride; ++ if ((x & mask) == 0) ++ src_l -= stripe_adj; ++ if (((x + size) & mask) == 0) ++ src_ur += stripe_adj; ++ } ++ ++ // Can deal with I-slices in 'normal' code even if CIP ++ // This also means that we don't need to generate (elsewhere) is_intra ++ // for IRAP frames ++ if (s->ps.pps->constrained_intra_pred_flag == 1 && ++ s->sh.slice_type != HEVC_SLICE_I) ++ { ++ // * If we ever actually care about CIP performance then we should ++ // special case out size 4 stuff (can be done by 'normal') and ++ // have 8-pel avail masks ++ unsigned int avail_l = cip_avail_l(s->is_intra + ((y + size * 2 - 1) >> (3 - vshift)) * s->ps.sps->pcm_width + ((x - 1) >> (6 - hshift)), ++ -(int)(s->ps.sps->pcm_width), ++ 1 << (((x - 1) >> (3 - hshift)) & 7), ++ 1 - hshift, ++ avail, ++ size, ++ FFMIN(size, ((s->ps.sps->height - y0) >> vshift) - size), ++ vshift != 0 ? 0 : (y >> 2) & 1); ++ ++ unsigned int avail_u = cip_avail_u(s->is_intra + ((y - 1) >> (3 - vshift)) * s->ps.sps->pcm_width + (x >> (6 - hshift)), ++ (x >> (3 - hshift)) & 7, ++ 1 - hshift, ++ avail, ++ size, ++ FFMIN(size, ((s->ps.sps->width - x0) >> hshift) - size), ++ hshift != 0 ? 0 : (x >> 2) & 1); ++ ++ // Anything left? ++ if ((avail_l | avail_u) == 0) ++ goto dc_only; ++ ++ FUNC(cip_fill)(left, top, avail_l, avail_u, src_l, src_u, src_ur, stride, size); ++ ++#if !PRED_C ++ if ((req & FILTER_LIGHT) != 0) ++ { ++ const unsigned threshold = 1 << (BIT_DEPTH - 5); ++ if ((req & FILTER_STRONG) != 0 && ++ (int)(FFABS(left[-1] + top[63] - 2 * top[31])) < threshold && ++ (int)(FFABS(left[-1] + left[63] - 2 * left[31])) < threshold) ++ { ++ filter_strong(top, left[-1], top[63], 64); ++ filter_strong(left, left[-1], left[63], 64); ++ } else ++ { ++ // LHS writes UL too so copy for top ++ const pixel p_ul = left[-1]; ++ filter_light(left - 1, top[0], left - 1, left[2*size - 1], 1, 2*size); ++ filter_light(top, p_ul, top, top[2*size - 1], 1, 2*size - 1); ++ } ++ } ++#endif ++ } ++ else ++ { ++ const unsigned int ur_size = FFMIN(size, ((s->ps.sps->width - x0) >> hshift) - size); ++ if ((req & ~((AVAIL_UR | AVAIL_U) & avail)) == 0 && ++ ((req & AVAIL_UR) == 0 || src_u + 2*size == src_ur + ur_size)) ++ { ++ top_pred = src_u; ++ } ++ else ++ { ++#if !PRED_C ++ s->hpc.intra_filter[log2_size - 2] ++#else ++ s->hpc.intra_filter_c[log2_size - 2] ++#endif ++ ((uint8_t *)left, (uint8_t *)top, req, avail, ++ (const uint8_t *)src_l, (const uint8_t *)src_u, (const uint8_t *)src_ur, stride * sizeof(pixel), ++ ur_size, ++ FFMIN(size, ((s->ps.sps->height - y0) >> vshift) - size)); ++ } ++ } ++ ++ ++#if !PRED_C ++ switch (mode) { ++ case INTRA_PLANAR: ++ s->hpc.pred_planar[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride); ++ break; ++ case INTRA_DC: ++ s->hpc.pred_dc[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride); ++ break; ++ case INTRA_ANGULAR_HORIZONTAL: ++ s->hpc.pred_horizontal[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride, ++ mode); ++ break; ++ case INTRA_ANGULAR_VERTICAL: ++ s->hpc.pred_vertical[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride, ++ mode); ++ break; ++ default: ++ s->hpc.pred_angular[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride, ++ mode); ++ break; ++ } ++#else ++ switch (mode) { ++ case INTRA_PLANAR: ++ s->hpc.pred_planar_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride); ++ break; ++ case INTRA_DC: ++ s->hpc.pred_dc_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride); ++ break; ++ case INTRA_ANGULAR_HORIZONTAL: ++ s->hpc.pred_horizontal_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride, ++ mode); ++ break; ++ case INTRA_ANGULAR_VERTICAL: ++ s->hpc.pred_vertical_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride, ++ mode); ++ break; ++ default: ++ s->hpc.pred_angular_c[log2_size - 2]((uint8_t *)src, (uint8_t *)top_pred, ++ (uint8_t *)left, stride, ++ mode); ++ break; ++ } ++ ++#if DUMP_PRED ++ printf("U pred @ %d, %d: mode=%d\n", x, y, mode); ++ dump_pred_uv((uint8_t *)src, stride, 1 << log2_size); ++ printf("V pred @ %d, %d: mode=%d\n", x, y, mode); ++ dump_pred_uv((uint8_t *)src + 1, stride, 1 << log2_size); ++#endif ++#endif ++} ++ ++#if !PRED_C ++static av_always_inline void FUNC(pred_planar)(uint8_t *_src, const uint8_t *_top, ++ const uint8_t *_left, ptrdiff_t stride, ++ int trafo_size) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ const pixel *top = (const pixel *)_top; ++ const pixel *left = (const pixel *)_left; ++ int size = 1 << trafo_size; ++ for (y = 0; y < size; y++) ++ for (x = 0; x < size; x++) ++ POS(x, y) = ((size - 1 - x) * left[y] + (x + 1) * top[size] + ++ (size - 1 - y) * top[x] + (y + 1) * left[size] + size) >> (trafo_size + 1); ++} ++#else ++static av_always_inline void FUNC(pred_planar)(uint8_t * _src, const uint8_t * _top, ++ const uint8_t * _left, ptrdiff_t stride, ++ int trafo_size) ++{ ++ int x, y; ++ int size = 1 << trafo_size; ++ c_dst_ptr_t src = (c_dst_ptr_t)_src; ++ const c_src_ptr_t top = (c_src_ptr_t)_top; ++ const c_src_ptr_t left = (c_src_ptr_t)_left; ++ ++ for (y = 0; y < size; y++, src += stride) ++ { ++ for (x = 0; x < size; x++) ++ { ++ src[x][0] = ((size - 1 - x) * left[y][0] + (x + 1) * top[size][0] + ++ (size - 1 - y) * top[x][0] + (y + 1) * left[size][0] + size) >> (trafo_size + 1); ++ src[x][1] = ((size - 1 - x) * left[y][1] + (x + 1) * top[size][1] + ++ (size - 1 - y) * top[x][1] + (y + 1) * left[size][1] + size) >> (trafo_size + 1); ++ } ++ } ++} ++#endif ++ ++#define PRED_PLANAR(size)\ ++static void FUNC(pred_planar_ ## size)(uint8_t *src, const uint8_t *top, \ ++ const uint8_t *left, ptrdiff_t stride) \ ++{ \ ++ FUNC(pred_planar)(src, top, left, stride, size + 2); \ ++} ++ ++PRED_PLANAR(0) ++PRED_PLANAR(1) ++PRED_PLANAR(2) ++PRED_PLANAR(3) ++ ++#undef PRED_PLANAR ++ ++#if !PRED_C ++static void FUNC(pred_dc)(uint8_t *_src, const uint8_t *_top, ++ const uint8_t *_left, ++ ptrdiff_t stride, int log2_size) ++{ ++ int i, j, x, y; ++ int size = (1 << log2_size); ++ pixel *src = (pixel *)_src; ++ const pixel *top = (const pixel *)_top; ++ const pixel *left = (const pixel *)_left; ++ int dc = size; ++ pixel4 a; ++ for (i = 0; i < size; i++) ++ dc += left[i] + top[i]; ++ ++ dc >>= log2_size + 1; ++ ++ a = PIXEL_SPLAT_X4(dc); ++ ++ for (i = 0; i < size; i++) ++ for (j = 0; j < size; j+=4) ++ AV_WN4P(&POS(j, i), a); ++ ++// if (c_idx == 0 && size < 32) ++// As we now have separate fns for y & c - no need to test that ++ if (size < 32) ++ { ++ POS(0, 0) = (left[0] + 2 * dc + top[0] + 2) >> 2; ++ for (x = 1; x < size; x++) ++ POS(x, 0) = (top[x] + 3 * dc + 2) >> 2; ++ for (y = 1; y < size; y++) ++ POS(0, y) = (left[y] + 3 * dc + 2) >> 2; ++ } ++} ++#else ++static void FUNC(pred_dc)(uint8_t *_src, const uint8_t *_top, ++ const uint8_t *_left, ++ ptrdiff_t stride, int log2_size) ++{ ++ unsigned int i, j; ++ const unsigned int size = (1 << log2_size); ++ c_dst_ptr_t src = (c_dst_ptr_t)_src; ++ const c_src_ptr_t top = (c_src_ptr_t)_top; ++ const c_src_ptr_t left = (c_src_ptr_t)_left; ++ unsigned int dc0 = size; ++ unsigned int dc1 = size; ++ ++ for (i = 0; i < size; i++) ++ { ++ dc0 += left[i][0] + top[i][0]; ++ dc1 += left[i][1] + top[i][1]; ++ } ++ ++ dc0 >>= log2_size + 1; ++ dc1 >>= log2_size + 1; ++ ++ for (i = 0; i < size; i++, src += stride) ++ { ++ for (j = 0; j < size; ++j) ++ { ++ src[j][0] = dc0; ++ src[j][1] = dc1; ++ ++ } ++ } ++} ++#endif ++ ++#define PRED_DC(size)\ ++static void FUNC(pred_dc_ ## size)(uint8_t *src, const uint8_t *top, \ ++ const uint8_t *left, ptrdiff_t stride) \ ++{ \ ++ FUNC(pred_dc)(src, top, left, stride, size + 2); \ ++} ++ ++PRED_DC(0) ++PRED_DC(1) ++PRED_DC(2) ++PRED_DC(3) ++ ++#undef PRED_DC ++ ++ ++ ++ ++#if !PRED_C ++static void FUNC(pred_dc0)(uint8_t *_src, ptrdiff_t stride, int log2_size) ++{ ++ int i, j; ++ int size = (1 << log2_size); ++ pixel *src = (pixel *)_src; ++ pixel4 a = PIXEL_SPLAT_X4(1 << (BIT_DEPTH - 1)); ++ ++ for (i = 0; i < size; i++) ++ for (j = 0; j < size; j+=4) ++ AV_WN4P(&POS(j, i), a); ++} ++#else ++static void FUNC(pred_dc0)(uint8_t *_src, ptrdiff_t stride, int log2_size) ++{ ++ unsigned int i, j; ++ const unsigned int size = (1 << log2_size); ++ c_dst_ptr_t src = (c_dst_ptr_t)_src; ++ const pixel a = (1 << (BIT_DEPTH - 1)); ++ ++ for (i = 0; i < size; i++, src += stride) ++ { ++ for (j = 0; j < size; ++j) ++ { ++ src[j][0] = a; ++ src[j][1] = a; ++ } ++ } ++} ++#endif ++ ++#define PRED_DC0(size)\ ++static void FUNC(pred_dc0_ ## size)(uint8_t *src, ptrdiff_t stride) \ ++{ \ ++ FUNC(pred_dc0)(src, stride, size + 2); \ ++} ++ ++PRED_DC0(0) ++PRED_DC0(1) ++PRED_DC0(2) ++PRED_DC0(3) ++ ++#undef PRED_DC0 ++ ++ ++ ++ ++#ifndef ANGLE_CONSTS ++#define ANGLE_CONSTS ++static const int intra_pred_angle[] = { ++ 32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32, ++ -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32 ++}; ++static const int inv_angle[] = { ++ -4096, -1638, -910, -630, -482, -390, -315, -256, -315, -390, -482, ++ -630, -910, -1638, -4096 ++}; ++#endif ++ ++#if !PRED_C ++static av_always_inline void FUNC(pred_angular)(uint8_t *_src, ++ const uint8_t *_top, ++ const uint8_t *_left, ++ ptrdiff_t stride, ++ int mode, int size) ++{ ++ int x, y; ++ pixel *src = (pixel *)_src; ++ const pixel *top = (const pixel *)_top; ++ const pixel *left = (const pixel *)_left; ++ ++ int angle = intra_pred_angle[mode - 2]; ++ pixel ref_array[3 * MAX_TB_SIZE + 4]; ++ pixel *ref_tmp = ref_array + size; ++ const pixel *ref; ++ int last = (size * angle) >> 5; ++ ++ if (mode >= 18) { ++ ref = top - 1; ++ ++ if (angle < 0) ++ { ++ memcpy(ref_tmp + 1, top, size * PW); ++ ref_tmp[0] = left[-1]; ++ ++ for (x = last; x <= -1; x++) ++ ref_tmp[x] = left[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)]; ++ ref = ref_tmp; ++ } ++ ++ for (y = 0; y < size; y++) { ++ int idx = ((y + 1) * angle) >> 5; ++ int fact = ((y + 1) * angle) & 31; ++ if (fact) { ++ for (x = 0; x < size; x += 4) { ++ POS(x , y) = ((32 - fact) * ref[x + idx + 1] + ++ fact * ref[x + idx + 2] + 16) >> 5; ++ POS(x + 1, y) = ((32 - fact) * ref[x + 1 + idx + 1] + ++ fact * ref[x + 1 + idx + 2] + 16) >> 5; ++ POS(x + 2, y) = ((32 - fact) * ref[x + 2 + idx + 1] + ++ fact * ref[x + 2 + idx + 2] + 16) >> 5; ++ POS(x + 3, y) = ((32 - fact) * ref[x + 3 + idx + 1] + ++ fact * ref[x + 3 + idx + 2] + 16) >> 5; ++ } ++ } else { ++ for (x = 0; x < size; x += 4) ++ AV_WN4P(&POS(x, y), AV_RN4P(&ref[x + idx + 1])); ++ } ++ } ++ if (mode == 26 && size < 32) { ++ for (y = 0; y < size; y++) ++ POS(0, y) = av_clip_pixel(top[0] + ((left[y] - left[-1]) >> 1)); ++ } ++ ++ } else { ++ ref = left - 1; ++ if (angle < 0 && last < -1) { ++ for (x = 0; x <= size; x += 4) ++ AV_WN4P(&ref_tmp[x], AV_RN4P(&left[x - 1])); ++ // Inv angle <= -256 so top offset >= 0 ++ for (x = last; x <= -1; x++) ++ ref_tmp[x] = top[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)]; ++ ref = ref_tmp; ++ } ++ ++ for (x = 0; x < size; x++) { ++ int idx = ((x + 1) * angle) >> 5; ++ int fact = ((x + 1) * angle) & 31; ++ if (fact) { ++ for (y = 0; y < size; y++) { ++ POS(x, y) = ((32 - fact) * ref[y + idx + 1] + ++ fact * ref[y + idx + 2] + 16) >> 5; ++ } ++ } else { ++ for (y = 0; y < size; y++) ++ POS(x, y) = ref[y + idx + 1]; ++ } ++ } ++ if (mode == 10 && size < 32) { ++ for (x = 0; x < size; x += 4) { ++ POS(x, 0) = av_clip_pixel(left[0] + ((top[x ] - left[-1]) >> 1)); ++ POS(x + 1, 0) = av_clip_pixel(left[0] + ((top[x + 1] - left[-1]) >> 1)); ++ POS(x + 2, 0) = av_clip_pixel(left[0] + ((top[x + 2] - left[-1]) >> 1)); ++ POS(x + 3, 0) = av_clip_pixel(left[0] + ((top[x + 3] - left[-1]) >> 1)); ++ } ++ } ++ } ++} ++#else ++static av_always_inline void FUNC(pred_angular)(uint8_t *_src, ++ const uint8_t *_top, ++ const uint8_t *_left, ++ ptrdiff_t stride, ++ int mode, int size) ++{ ++ int x, y; ++ c_dst_ptr_t src = (c_dst_ptr_t)_src; ++ c_src_ptr_t top = (c_src_ptr_t)_top; ++ c_src_ptr_t left = (c_src_ptr_t)_left; ++ ++ const int angle = intra_pred_angle[mode - 2]; ++ cpel ref_array[3 * MAX_TB_SIZE + 4][2]; ++ c_dst_ptr_t ref_tmp = ref_array + size; ++ c_src_ptr_t ref; ++ const int last = (size * angle) >> 5; ++ ++ if (mode >= 18) { ++ ref = top - 1; ++ if (angle < 0) { ++ memcpy(ref_tmp + 1, top, size * 2 * PW); ++ ref_tmp[0][0] = left[-1][0]; ++ ref_tmp[0][1] = left[-1][1]; ++ for (x = last; x <= -1; x++) ++ { ++ ref_tmp[x][0] = left[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)][0]; ++ ref_tmp[x][1] = left[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)][1]; ++ } ++ ref = (c_src_ptr_t)ref_tmp; ++ } ++ ++ for (y = 0; y < size; y++, src += stride) { ++ const int idx = ((y + 1) * angle) >> 5; ++ const int fact = ((y + 1) * angle) & 31; ++ if (fact) { ++ for (x = 0; x < size; ++x) { ++ src[x][0] = ((32 - fact) * ref[x + idx + 1][0] + ++ fact * ref[x + idx + 2][0] + 16) >> 5; ++ src[x][1] = ((32 - fact) * ref[x + idx + 1][1] + ++ fact * ref[x + idx + 2][1] + 16) >> 5; ++ } ++ } else { ++ memcpy(src, ref + idx + 1, size * 2 * PW); ++ } ++ } ++ } else { ++ ref = left - 1; ++ if (angle < 0 && last < -1) { ++ memcpy(ref_tmp, left - 1, (size + 1) * 2 * PW); ++ for (x = last; x <= -1; x++) ++ { ++ ref_tmp[x][0] = top[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)][0]; ++ ref_tmp[x][1] = top[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)][1]; ++ } ++ ref = (c_src_ptr_t)ref_tmp; ++ } ++ ++ for (x = 0; x < size; x++, src++) { ++ const int idx = ((x + 1) * angle) >> 5; ++ const int fact = ((x + 1) * angle) & 31; ++ if (fact) { ++ for (y = 0; y < size; y++) { ++ src[y * stride][0] = ((32 - fact) * ref[y + idx + 1][0] + ++ fact * ref[y + idx + 2][0] + 16) >> 5; ++ src[y * stride][1] = ((32 - fact) * ref[y + idx + 1][1] + ++ fact * ref[y + idx + 2][1] + 16) >> 5; ++ } ++ } else { ++ for (y = 0; y < size; y++) ++ { ++ src[y * stride][0] = ref[y + idx + 1][0]; ++ src[y * stride][1] = ref[y + idx + 1][1]; ++ } ++ } ++ } ++ } ++} ++#endif ++ ++static void FUNC(pred_angular_0)(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ++ ptrdiff_t stride, int mode) ++{ ++ FUNC(pred_angular)(src, top, left, stride, mode, 1 << 2); ++} ++ ++static void FUNC(pred_angular_1)(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ++ ptrdiff_t stride, int mode) ++{ ++ FUNC(pred_angular)(src, top, left, stride, mode, 1 << 3); ++} ++ ++static void FUNC(pred_angular_2)(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ++ ptrdiff_t stride, int mode) ++{ ++ FUNC(pred_angular)(src, top, left, stride, mode, 1 << 4); ++} ++ ++static void FUNC(pred_angular_3)(uint8_t *src, const uint8_t *top, ++ const uint8_t *left, ++ ptrdiff_t stride, int mode) ++{ ++ FUNC(pred_angular)(src, top, left, stride, mode, 1 << 5); ++} ++ ++#undef cpel ++#undef c_src_ptr_t ++#undef c_dst_ptr_t ++ ++#undef EXTEND ++#undef POS ++#undef PW ++ ++#undef filter_light1 ++#undef filter_light ++#undef filter_strong ++#undef ref_gen ++ ++#ifndef INCLUDED_ONCE ++#define INCLUDED_ONCE ++#endif ++ +--- /dev/null ++++ b/libavcodec/rpi_mailbox.c +@@ -0,0 +1,155 @@ ++/* ++Copyright (c) 2012, Broadcom Europe Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#define MAJOR_NUM 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) ++#define DEVICE_FILE_NAME "/dev/vcio" ++ ++#include "rpi_mailbox.h" ++//#include ++ ++/* ++ * use ioctl to send mbox property message ++ */ ++ ++static int mbox_property(int file_desc, void *buf) ++{ ++ int ret_val = ioctl(file_desc, IOCTL_MBOX_PROPERTY, buf); ++ ++ if (ret_val < 0) { ++ printf("ioctl_set_msg failed:%d\n", ret_val); ++ } ++ ++#ifdef DEBUG ++ unsigned *p = buf; int i; unsigned size = *(unsigned *)buf; ++ for (i=0; i ++#include ++#include ++#include ++ ++#include "config.h" ++ ++#include "libavutil/avassert.h" ++#include "libavutil/rpi_sand_fns.h" ++ ++#pragma GCC diagnostic push ++// Many many redundant decls in the header files ++#pragma GCC diagnostic ignored "-Wredundant-decls" ++#include ++#include ++#include ++#pragma GCC diagnostic pop ++ ++#include "rpi_mem.h" ++#include "rpi_zc_frames.h" ++ ++ ++#define OPT_PREFER_CMA 0 ++ ++struct rpi_cache_flush_env_s { ++ struct vcsm_user_clean_invalid2_s v; ++}; ++ ++ ++// GPU memory alloc fns (internal) ++ ++static void gpu_free_internal(GPU_MEM_PTR_T * const p) ++{ ++ if (p->arm != NULL) ++ vcsm_unlock_ptr(p->arm); ++ if (p->vcsm_handle != 0) ++ vcsm_free(p->vcsm_handle); ++ memset(p, 0, sizeof(*p)); // Ensure we crash hard if we try and use this again ++} ++ ++ ++static int gpu_malloc_internal(GPU_MEM_PTR_T * const p, ++ const int numbytes, const unsigned int cache_type, const char * const name) ++{ ++ memset(p, 0, sizeof(*p)); ++ p->numbytes = (numbytes + 255) & ~255; // Round up ++ ++ if ((p->vcsm_handle = vcsm_malloc_cache(p->numbytes, cache_type | 0x80, (char *)name)) == 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "Unable to alloc %d bytes from VCSM for %s\n", p->numbytes, name); ++ goto fail; ++ } ++ if ((p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle)) == 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "Unable to VC handle from VCSM for %s\n", name); ++ goto fail; ++ } ++ if ((p->arm = vcsm_lock(p->vcsm_handle)) == NULL) ++ { ++ av_log(NULL, AV_LOG_ERROR, "Unable to lock handle from VCSM for %s\n", name); ++ goto fail; ++ } ++ if ((p->vc = vcsm_vc_addr_from_hdl(p->vcsm_handle)) == 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "Unable to get VC addr from VCSM for %s\n", name); ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ gpu_free_internal(p); ++ return AVERROR(ENOMEM); ++} ++ ++// Public gpu fns ++ ++// Allocate memory on GPU ++// Fills in structure

containing ARM pointer, videocore handle, videocore memory address, numbytes ++// Returns 0 on success. ++// This allocates memory that will not be cached in ARM's data cache. ++// Therefore safe to use without data cache flushing. ++int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p) ++{ ++ return gpu_malloc_internal(p, numbytes, VCSM_CACHE_TYPE_NONE, "ffmpeg uncached"); ++} ++ ++// This allocates data that will be ++// Cached in ARM L2 ++// Uncached in VPU L2 ++int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p) ++{ ++ return gpu_malloc_internal(p, numbytes, VCSM_CACHE_TYPE_HOST, "ffmpeg cached"); ++} ++ ++void gpu_free(GPU_MEM_PTR_T * const p) { ++ gpu_free_internal(p); ++} ++ ++void rpi_mem_gpu_uninit(void) ++{ ++ vcsm_exit(); ++ bcm_host_deinit(); ++} ++ ++int rpi_mem_gpu_init(const unsigned int flags) ++{ ++ const int wants_cma = bcm_host_is_fkms_active(); ++ int use_cma; ++ ++ (void)flags; ++ ++ if (vcsm_init_ex(wants_cma ? 1 : 0, -1) == 0) ++ use_cma = 1; ++ else if (vcsm_init_ex(wants_cma ? 0 : 1, -1) == 0) ++ use_cma = 0; ++ else ++ return AVERROR(EINVAL); ++ ++ bcm_host_init(); ++ ++ return use_cma + 1; ++} ++ ++// ---------------------------------------------------------------------------- ++// ++// Cache flush functions ++ ++#define CACHE_EL_MAX ((sizeof(rpi_cache_buf_t) - sizeof (struct vcsm_user_clean_invalid2_s)) / sizeof (struct vcsm_user_clean_invalid2_block_s)) ++ ++rpi_cache_flush_env_t * rpi_cache_flush_init(rpi_cache_buf_t * const buf) ++{ ++ rpi_cache_flush_env_t * const rfe = (rpi_cache_flush_env_t *)buf; ++ *rfe = (rpi_cache_flush_env_t){.v={.op_count = 0}}; ++ return rfe; ++} ++ ++void rpi_cache_flush_abort(rpi_cache_flush_env_t * const rfe) ++{ ++ // Nothing needed ++} ++ ++int rpi_cache_flush_execute(rpi_cache_flush_env_t * const rfe) ++{ ++ int rc = 0; ++ if (rfe->v.op_count != 0) { ++ if (vcsm_clean_invalid2(&rfe->v) != 0) ++ { ++ const int err = errno; ++ av_log(NULL, AV_LOG_ERROR, "vcsm_clean_invalid2 failed: errno=%d\n", err); ++ rc = AVERROR(err); ++ } ++ rfe->v.op_count = 0; ++ } ++ return rc; ++} ++ ++int rpi_cache_flush_finish(rpi_cache_flush_env_t * const rfe) ++{ ++ int rc = rpi_cache_flush_execute(rfe);; ++ ++ return rc; ++} ++ ++inline void rpi_cache_flush_add_gm_blocks(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const unsigned int mode, ++ const unsigned int offset0, const unsigned int block_size, const unsigned int blocks, const unsigned int block_stride) ++{ ++ struct vcsm_user_clean_invalid2_block_s * const b = rfe->v.s + rfe->v.op_count++; ++ ++ av_assert1(rfe->v.op_count <= CACHE_EL_MAX); ++ ++ b->invalidate_mode = mode; ++ b->block_count = blocks; ++ b->start_address = gm->arm + offset0; ++ b->block_size = block_size; ++ b->inter_block_stride = block_stride; ++} ++ ++void rpi_cache_flush_add_gm_range(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const unsigned int mode, ++ const unsigned int offset, const unsigned int size) ++{ ++ // Deal with empty pointer trivially ++ if (gm == NULL || size == 0) ++ return; ++ ++ av_assert1(offset <= gm->numbytes); ++ av_assert1(size <= gm->numbytes); ++ av_assert1(offset + size <= gm->numbytes); ++ ++ rpi_cache_flush_add_gm_blocks(rfe, gm, mode, offset, size, 1, 0); ++} ++ ++void rpi_cache_flush_add_gm_ptr(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const unsigned int mode) ++{ ++ rpi_cache_flush_add_gm_blocks(rfe, gm, mode, 0, gm->numbytes, 1, 0); ++} ++ ++ ++void rpi_cache_flush_add_frame(rpi_cache_flush_env_t * const rfe, const AVFrame * const frame, const unsigned int mode) ++{ ++#if !RPI_ONE_BUF ++#error Fixme! (NIF) ++#endif ++ if (gpu_is_buf1(frame)) { ++ rpi_cache_flush_add_gm_ptr(rfe, gpu_buf1_gmem(frame), mode); ++ } ++ else ++ { ++ rpi_cache_flush_add_gm_ptr(rfe, gpu_buf3_gmem(frame, 0), mode); ++ rpi_cache_flush_add_gm_ptr(rfe, gpu_buf3_gmem(frame, 1), mode); ++ rpi_cache_flush_add_gm_ptr(rfe, gpu_buf3_gmem(frame, 2), mode); ++ } ++} ++ ++// Flush an area of a frame ++// Width, height, x0, y0 in luma pels ++void rpi_cache_flush_add_frame_block(rpi_cache_flush_env_t * const rfe, const AVFrame * const frame, const unsigned int mode, ++ const unsigned int x0, const unsigned int y0, const unsigned int width, const unsigned int height, ++ const unsigned int uv_shift, const int do_luma, const int do_chroma) ++{ ++ const unsigned int y_offset = frame->linesize[0] * y0; ++ const unsigned int y_size = frame->linesize[0] * height; ++ // Round UV up/down to get everything ++ const unsigned int uv_rnd = (1U << uv_shift) >> 1; ++ const unsigned int uv_offset = frame->linesize[1] * (y0 >> uv_shift); ++ const unsigned int uv_size = frame->linesize[1] * ((y0 + height + uv_rnd) >> uv_shift) - uv_offset; ++ ++#if 0 ++ // *** frame->height is cropped height so not good ++ // As all unsigned they will also reject -ve ++ // Test individually as well as added to reject overflow ++ av_assert0(start_line <= (unsigned int)frame->height); // ***** frame height cropped ++ av_assert0(n <= (unsigned int)frame->height); ++ av_assert0(start_line + n <= (unsigned int)frame->height); ++#endif ++ ++ if (!gpu_is_buf1(frame)) ++ { ++ if (do_luma) { ++ rpi_cache_flush_add_gm_range(rfe, gpu_buf3_gmem(frame, 0), mode, y_offset, y_size); ++ } ++ if (do_chroma) { ++ rpi_cache_flush_add_gm_range(rfe, gpu_buf3_gmem(frame, 1), mode, uv_offset, uv_size); ++ rpi_cache_flush_add_gm_range(rfe, gpu_buf3_gmem(frame, 2), mode, uv_offset, uv_size); ++ } ++ } ++ else if (!av_rpi_is_sand_frame(frame)) ++ { ++ const GPU_MEM_PTR_T * const gm = gpu_buf1_gmem(frame); ++ if (do_luma) { ++ rpi_cache_flush_add_gm_range(rfe, gm, mode, (frame->data[0] - gm->arm) + y_offset, y_size); ++ } ++ if (do_chroma) { ++ rpi_cache_flush_add_gm_range(rfe, gm, mode, (frame->data[1] - gm->arm) + uv_offset, uv_size); ++ rpi_cache_flush_add_gm_range(rfe, gm, mode, (frame->data[2] - gm->arm) + uv_offset, uv_size); ++ } ++ } ++ else ++ { ++ const unsigned int stride1 = av_rpi_sand_frame_stride1(frame); ++ const unsigned int stride2 = av_rpi_sand_frame_stride2(frame); ++ const unsigned int xshl = av_rpi_sand_frame_xshl(frame); ++ const unsigned int xleft = x0 & ~((stride1 >> xshl) - 1); ++ const unsigned int block_count = (((x0 + width - xleft) << xshl) + stride1 - 1) / stride1; // Same for Y & C ++ av_assert1(rfe->v.op_count + do_chroma + do_luma < CACHE_EL_MAX); ++ ++ if (do_chroma) ++ { ++ struct vcsm_user_clean_invalid2_block_s * const b = rfe->v.s + rfe->v.op_count++; ++ b->invalidate_mode = mode; ++ b->block_count = block_count; ++ b->start_address = av_rpi_sand_frame_pos_c(frame, xleft >> 1, y0 >> 1); ++ b->block_size = uv_size; ++ b->inter_block_stride = stride1 * stride2; ++ } ++ if (do_luma) ++ { ++ struct vcsm_user_clean_invalid2_block_s * const b = rfe->v.s + rfe->v.op_count++; ++ b->invalidate_mode = mode; ++ b->block_count = block_count; ++ b->start_address = av_rpi_sand_frame_pos_y(frame, xleft, y0); ++ b->block_size = y_size; ++ b->inter_block_stride = stride1 * stride2; ++ } ++ } ++} ++ ++// Call this to clean and invalidate a region of memory ++void rpi_cache_flush_one_gm_ptr(const GPU_MEM_PTR_T *const p, const rpi_cache_flush_mode_t mode) ++{ ++ rpi_cache_buf_t cbuf; ++ rpi_cache_flush_env_t * rfe = rpi_cache_flush_init(&cbuf); ++ rpi_cache_flush_add_gm_ptr(rfe, p, mode); ++ rpi_cache_flush_finish(rfe); ++} ++ +--- /dev/null ++++ b/libavcodec/rpi_mem.h +@@ -0,0 +1,88 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++#ifndef RPI_MEM_H ++#define RPI_MEM_H ++ ++typedef struct gpu_mem_ptr_s { ++ unsigned char *arm; // Pointer to memory mapped on ARM side ++ int vc_handle; // Videocore handle of relocatable memory ++ int vcsm_handle; // Handle for use by VCSM ++ int vc; // Address for use in GPU code ++ int numbytes; // Size of memory block ++} GPU_MEM_PTR_T; ++ ++// General GPU functions ++ ++#define GPU_INIT_GPU 1 ++#define GPU_INIT_CMA 2 ++ ++extern int gpu_malloc_cached(int numbytes, GPU_MEM_PTR_T *p); ++extern int gpu_malloc_uncached(int numbytes, GPU_MEM_PTR_T *p); ++extern void gpu_free(GPU_MEM_PTR_T * const p); ++int rpi_mem_gpu_init(const unsigned int flags); ++void rpi_mem_gpu_uninit(void); ++ ++// Cache flush stuff ++ ++struct rpi_cache_flush_env_s; ++typedef struct rpi_cache_flush_env_s rpi_cache_flush_env_t; ++ ++typedef struct {uint32_t t[33];} rpi_cache_buf_t; ++ ++rpi_cache_flush_env_t * rpi_cache_flush_init(rpi_cache_buf_t * const buf); ++// Free env without flushing ++void rpi_cache_flush_abort(rpi_cache_flush_env_t * const rfe); ++// Do the accumulated flush & clear but do not free the env ++int rpi_cache_flush_execute(rpi_cache_flush_env_t * const rfe); ++// Do the accumulated flush & free the env ++int rpi_cache_flush_finish(rpi_cache_flush_env_t * const rfe); ++ ++typedef enum ++{ ++ RPI_CACHE_FLUSH_MODE_INVALIDATE = 1, ++ RPI_CACHE_FLUSH_MODE_WRITEBACK = 2, ++ RPI_CACHE_FLUSH_MODE_WB_INVALIDATE = 3 ++} rpi_cache_flush_mode_t; ++ ++struct AVFrame; ++void rpi_cache_flush_add_gm_ptr(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const rpi_cache_flush_mode_t mode); ++void rpi_cache_flush_add_gm_range(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const rpi_cache_flush_mode_t mode, ++ const unsigned int offset, const unsigned int size); ++void rpi_cache_flush_add_gm_blocks(rpi_cache_flush_env_t * const rfe, const GPU_MEM_PTR_T * const gm, const unsigned int mode, ++ const unsigned int offset0, const unsigned int block_size, const unsigned int blocks, const unsigned int block_stride); ++void rpi_cache_flush_add_frame(rpi_cache_flush_env_t * const rfe, const struct AVFrame * const frame, const rpi_cache_flush_mode_t mode); ++void rpi_cache_flush_add_frame_block(rpi_cache_flush_env_t * const rfe, const struct AVFrame * const frame, const rpi_cache_flush_mode_t mode, ++ const unsigned int x0, const unsigned int y0, const unsigned int width, const unsigned int height, ++ const unsigned int uv_shift, const int do_luma, const int do_chroma); ++ ++// init, add, finish for one gm ptr ++void rpi_cache_flush_one_gm_ptr(const GPU_MEM_PTR_T * const p, const rpi_cache_flush_mode_t mode); ++ ++#endif +--- /dev/null ++++ b/libavcodec/rpi_qpu.c +@@ -0,0 +1,776 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox ++*/ ++ ++ ++#include ++#include ++#include ++#include ++#include ++#include "libavutil/avassert.h" ++ ++#include "config.h" ++ ++#include ++#include ++ ++#include ++ ++#include "rpi_mailbox.h" ++#include "rpi_mem.h" ++#include "rpi_qpu.h" ++#include "rpi_hevc_shader.h" ++#include "rpi_hevc_transform8.h" ++#include "rpi_hevc_transform10.h" ++#include "libavutil/rpi_sand_fns.h" ++ ++// Trace time spent waiting for GPU (VPU/QPU) (1=Yes, 0=No) ++#define RPI_TRACE_TIME_VPU_QPU_WAIT 0 ++ ++// Add profile flags to all QPU requests - generates output in "vcdbg log msg" ++// Beware this is expensive and will probably throw off all other timing by >10% ++#define RPI_TRACE_QPU_PROFILE_ALL 0 ++ ++// QPU "noflush" flags ++// a mixture of flushing & profiling ++ ++#define QPU_FLAGS_NO_FLUSH_VPU 1 // If unset VPU cache will be flushed ++#define QPU_FLAGS_PROF_CLEAR_AND_ENABLE 2 // Clear & Enable detailed QPU profiling registers ++#define QPU_FLAGS_PROF_OUTPUT_COUNTS 4 // Print the results ++#define QPU_FLAGS_OUTPUT_QPU_TIMES 8 // Print QPU times - independant of the profiling ++#define QPU_FLAGS_NO_FLUSH_QPU 16 // If unset flush QPU caches & TMUs (uniforms always flushed) ++ ++#define vcos_verify_ge0(x) ((x)>=0) ++ ++// Size in 32bit words ++#define QPU_CODE_SIZE 4098 ++#define VPU_CODE_SIZE 16384 ++ ++static const short rpi_transMatrix2even[32][16] = { // Even rows first ++{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64}, ++{90, 87, 80, 70, 57, 43, 25, 9, -9, -25, -43, -57, -70, -80, -87, -90}, ++{89, 75, 50, 18, -18, -50, -75, -89, -89, -75, -50, -18, 18, 50, 75, 89}, ++{87, 57, 9, -43, -80, -90, -70, -25, 25, 70, 90, 80, 43, -9, -57, -87}, ++{83, 36, -36, -83, -83, -36, 36, 83, 83, 36, -36, -83, -83, -36, 36, 83}, ++{80, 9, -70, -87, -25, 57, 90, 43, -43, -90, -57, 25, 87, 70, -9, -80}, ++{75, -18, -89, -50, 50, 89, 18, -75, -75, 18, 89, 50, -50, -89, -18, 75}, ++{70, -43, -87, 9, 90, 25, -80, -57, 57, 80, -25, -90, -9, 87, 43, -70}, ++{64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64, 64, -64, -64, 64}, ++{57, -80, -25, 90, -9, -87, 43, 70, -70, -43, 87, 9, -90, 25, 80, -57}, ++{50, -89, 18, 75, -75, -18, 89, -50, -50, 89, -18, -75, 75, 18, -89, 50}, ++{43, -90, 57, 25, -87, 70, 9, -80, 80, -9, -70, 87, -25, -57, 90, -43}, ++{36, -83, 83, -36, -36, 83, -83, 36, 36, -83, 83, -36, -36, 83, -83, 36}, ++{25, -70, 90, -80, 43, 9, -57, 87, -87, 57, -9, -43, 80, -90, 70, -25}, ++{18, -50, 75, -89, 89, -75, 50, -18, -18, 50, -75, 89, -89, 75, -50, 18}, ++{ 9, -25, 43, -57, 70, -80, 87, -90, 90, -87, 80, -70, 57, -43, 25, -9}, ++// Odd rows ++{90, 90, 88, 85, 82, 78, 73, 67, 61, 54, 46, 38, 31, 22, 13, 4}, ++{90, 82, 67, 46, 22, -4, -31, -54, -73, -85, -90, -88, -78, -61, -38, -13}, ++{88, 67, 31, -13, -54, -82, -90, -78, -46, -4, 38, 73, 90, 85, 61, 22}, ++{85, 46, -13, -67, -90, -73, -22, 38, 82, 88, 54, -4, -61, -90, -78, -31}, ++{82, 22, -54, -90, -61, 13, 78, 85, 31, -46, -90, -67, 4, 73, 88, 38}, ++{78, -4, -82, -73, 13, 85, 67, -22, -88, -61, 31, 90, 54, -38, -90, -46}, ++{73, -31, -90, -22, 78, 67, -38, -90, -13, 82, 61, -46, -88, -4, 85, 54}, ++{67, -54, -78, 38, 85, -22, -90, 4, 90, 13, -88, -31, 82, 46, -73, -61}, ++{61, -73, -46, 82, 31, -88, -13, 90, -4, -90, 22, 85, -38, -78, 54, 67}, ++{54, -85, -4, 88, -46, -61, 82, 13, -90, 38, 67, -78, -22, 90, -31, -73}, ++{46, -90, 38, 54, -90, 31, 61, -88, 22, 67, -85, 13, 73, -82, 4, 78}, ++{38, -88, 73, -4, -67, 90, -46, -31, 85, -78, 13, 61, -90, 54, 22, -82}, ++{31, -78, 90, -61, 4, 54, -88, 82, -38, -22, 73, -90, 67, -13, -46, 85}, ++{22, -61, 85, -90, 73, -38, -4, 46, -78, 90, -82, 54, -13, -31, 67, -88}, ++{13, -38, 61, -78, 88, -90, 85, -73, 54, -31, 4, 22, -46, 67, -82, 90}, ++{ 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90} ++}; ++ ++// Code/constants on GPU ++struct GPU ++{ ++// unsigned int qpu_code[QPU_CODE_SIZE]; ++ unsigned int vpu_code8[VPU_CODE_SIZE]; ++ unsigned int vpu_code10[VPU_CODE_SIZE]; ++ short transMatrix2even[16*16*2]; ++}; ++ ++#define WAIT_COUNT_MAX 16 ++ ++typedef struct trace_time_one_s ++{ ++ int count; ++ int64_t start[WAIT_COUNT_MAX]; ++ int64_t total[WAIT_COUNT_MAX]; ++} trace_time_one_t; ++ ++typedef struct trace_time_wait_s ++{ ++ unsigned int jcount; ++ int64_t start0; ++ int64_t last_update; ++ trace_time_one_t active; ++ trace_time_one_t wait; ++} trace_time_wait_t; ++ ++typedef struct vq_wait_s ++{ ++ sem_t sem; ++ struct vq_wait_s * next; ++} vq_wait_t; ++ ++#define VQ_WAIT_POOL_SIZE 16 ++typedef struct vq_wait_pool_s ++{ ++ vq_wait_t * head; ++ vq_wait_t pool[VQ_WAIT_POOL_SIZE]; ++} vq_wait_pool_t; ++ ++static void vq_wait_pool_init(vq_wait_pool_t * const pool); ++static void vq_wait_pool_deinit(vq_wait_pool_t * const pool); ++ ++typedef struct gpu_env_s ++{ ++ int open_count; ++ int init_count; ++ int vpu_i_cache_flushed; ++ GPU_MEM_PTR_T qpu_code_gm_ptr; ++ GPU_MEM_PTR_T code_gm_ptr; ++ GPU_MEM_PTR_T dummy_gm_ptr; ++ vq_wait_pool_t wait_pool; ++#if RPI_TRACE_TIME_VPU_QPU_WAIT ++ trace_time_wait_t ttw; ++#endif ++} gpu_env_t; ++ ++// Stop more than one thread trying to allocate memory or use the processing resources at once ++static pthread_mutex_t gpu_mutex = PTHREAD_MUTEX_INITIALIZER; ++static gpu_env_t * gpu = NULL; ++ ++#if RPI_TRACE_TIME_VPU_QPU_WAIT ++ ++static int64_t ns_time(void) ++{ ++ struct timespec ts; ++ clock_gettime(CLOCK_MONOTONIC, &ts); ++ return (int64_t)ts.tv_sec * (int64_t)1000000000 + ts.tv_nsec; ++} ++ ++ ++#define WAIT_TIME_PRINT_PERIOD (int64_t)2000000000 ++ ++#define T_MS(t) ((unsigned int)((t)/(int64_t)1000000) % 1000U) ++#define T_SEC(t) (unsigned int)((t)/(int64_t)1000000000) ++#define T_ARG(t) T_SEC(t), T_MS(t) ++#define T_FMT "%u.%03u" ++ ++static void tto_print(trace_time_one_t * tto, const int64_t now, const int64_t start0, const char * const prefix) ++{ ++ // Update totals for levels that are still pending ++ for (int i = 0; i < tto->count; ++i) { ++ tto->total[i] += now - tto->start[i]; ++ tto->start[i] = now; ++ } ++ ++ printf("%s: Idle:" T_FMT ", 1:" T_FMT ", 2:" T_FMT ", 3:" T_FMT ", 4:" T_FMT "\n", ++ prefix, ++ T_ARG(now - start0 - tto->total[0]), ++ T_ARG(tto->total[0]), ++ T_ARG(tto->total[1]), ++ T_ARG(tto->total[2]), ++ T_ARG(tto->total[3])); ++} ++ ++ ++static void tto_start(trace_time_one_t * const tto, const int64_t now) ++{ ++ av_assert0(tto->count < WAIT_COUNT_MAX); ++ tto->start[tto->count++] = now; ++} ++ ++static void tto_end(trace_time_one_t * const tto, const int64_t now) ++{ ++ const int n = --tto->count; ++ av_assert0(n >= 0); ++ tto->total[n] += now - tto->start[n]; ++} ++ ++static void ttw_print(trace_time_wait_t * const ttw, const int64_t now) ++{ ++ printf("Jobs:%d, Total time=" T_FMT "\n", ttw->jcount, T_ARG(now - ttw->start0)); ++ tto_print(&ttw->active, now, ttw->start0, "Active"); ++ tto_print(&ttw->wait, now, ttw->start0, " Wait"); ++} ++ ++#endif ++ ++// GPU memory alloc fns (internal) ++ ++static void gpu_free_internal(GPU_MEM_PTR_T * const p) ++{ ++ if (p->arm != NULL) ++ vcsm_unlock_ptr(p->arm); ++ if (p->vcsm_handle != 0) ++ vcsm_free(p->vcsm_handle); ++ memset(p, 0, sizeof(*p)); // Ensure we crash hard if we try and use this again ++} ++ ++ ++static int gpu_malloc_internal(GPU_MEM_PTR_T * const p, ++ const int numbytes, const unsigned int cache_type, const char * const name) ++{ ++ memset(p, 0, sizeof(*p)); ++ p->numbytes = (numbytes + 255) & ~255; // Round up ++ ++ if ((p->vcsm_handle = vcsm_malloc_cache(p->numbytes, cache_type | 0x80, (char *)name)) == 0 || ++ (p->vc_handle = vcsm_vc_hdl_from_hdl(p->vcsm_handle)) == 0 || ++ (p->arm = vcsm_lock(p->vcsm_handle)) == NULL || ++ (p->vc = vcsm_vc_addr_from_hdl(p->vcsm_handle)) == 0) ++ { ++ gpu_free_internal(p); ++ return AVERROR(ENOMEM); ++ } ++ return 0; ++} ++ ++ ++// GPU init, free, lock, unlock ++ ++static void gpu_term(void) ++{ ++ gpu_env_t * const ge = gpu; ++ ++ // We have to hope that eveything has terminated... ++ gpu = NULL; ++ ++ vc_gpuserv_deinit(); ++ ++ gpu_free_internal(&ge->code_gm_ptr); ++ gpu_free_internal(&ge->qpu_code_gm_ptr); ++ gpu_free_internal(&ge->dummy_gm_ptr); ++ ++ vcsm_exit(); ++ ++ vq_wait_pool_deinit(&ge->wait_pool); ++ ++ free(ge); ++} ++ ++ ++// Connect to QPU, returns 0 on success. ++static int gpu_init(gpu_env_t ** const gpu) { ++ volatile struct GPU* ptr; ++ gpu_env_t * const ge = calloc(1, sizeof(gpu_env_t)); ++ int rv; ++ *gpu = NULL; ++ ++ if (ge == NULL) ++ return -1; ++ ++ vq_wait_pool_init(&ge->wait_pool); ++ ++ vcsm_init(); ++ ++ // Now copy over the QPU code into GPU memory ++ if ((rv = gpu_malloc_internal(&ge->qpu_code_gm_ptr, QPU_CODE_SIZE * 4, VCSM_CACHE_TYPE_NONE, "ffmpeg qpu code")) != 0) ++ return rv; ++ ++ { ++ int num_bytes = (char *)mc_end - (char *)ff_hevc_rpi_shader; ++ av_assert0(num_bytes<=QPU_CODE_SIZE*sizeof(unsigned int)); ++ memcpy(ge->qpu_code_gm_ptr.arm, ff_hevc_rpi_shader, num_bytes); ++ memset(ge->qpu_code_gm_ptr.arm + num_bytes, 0, QPU_CODE_SIZE*4 - num_bytes); ++ } ++ ++ // And the VPU code ++ if ((rv = gpu_malloc_internal(&ge->code_gm_ptr, sizeof(struct GPU), VCSM_CACHE_TYPE_VC, "ffmpeg vpu code")) != 0) ++ return rv; ++ ptr = (volatile struct GPU*)ge->code_gm_ptr.arm; ++ ++ // Zero everything so we have zeros between the code bits ++ memset((void *)ptr, 0, sizeof(*ptr)); ++ { ++ int num_bytes = sizeof(rpi_hevc_transform8); ++ av_assert0(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); ++ memcpy((void*)ptr->vpu_code8, rpi_hevc_transform8, num_bytes); ++ } ++ { ++ int num_bytes = sizeof(rpi_hevc_transform10); ++ av_assert0(num_bytes<=VPU_CODE_SIZE*sizeof(unsigned int)); ++ memcpy((void*)ptr->vpu_code10, rpi_hevc_transform10, num_bytes); ++ } ++ // And the transform coefficients ++ memcpy((void*)ptr->transMatrix2even, rpi_transMatrix2even, sizeof(rpi_transMatrix2even)); ++ ++ // Generate a dummy "frame" & fill with 0x80 ++ // * Could reset to 1 <dummy_gm_ptr, 0x4000, VCSM_CACHE_TYPE_NONE, "ffmpeg dummy frame")) != 0) ++ return rv; ++ memset(ge->dummy_gm_ptr.arm, 0x80, 0x4000); ++ ++ *gpu = ge; ++ return 0; ++} ++ ++ ++ ++static void gpu_unlock(void) { ++ pthread_mutex_unlock(&gpu_mutex); ++} ++ ++// Make sure we have exclusive access to the mailbox, and enable qpu if necessary. ++static gpu_env_t * gpu_lock(void) { ++ pthread_mutex_lock(&gpu_mutex); ++ ++ av_assert1(gpu != NULL); ++ return gpu; ++} ++ ++static gpu_env_t * gpu_lock_ref(void) ++{ ++ pthread_mutex_lock(&gpu_mutex); ++ ++ if (gpu == NULL) { ++ int rv = gpu_init(&gpu); ++ if (rv != 0) { ++ gpu_unlock(); ++ return NULL; ++ } ++ } ++ ++ ++gpu->open_count; ++ return gpu; ++} ++ ++static void gpu_unlock_unref(gpu_env_t * const ge) ++{ ++ if (--ge->open_count == 0) ++ gpu_term(); ++ ++ gpu_unlock(); ++} ++ ++static inline gpu_env_t * gpu_ptr(void) ++{ ++ av_assert1(gpu != NULL); ++ return gpu; ++} ++ ++unsigned int vpu_get_fn(const unsigned int bit_depth) { ++ uint32_t a = 0; ++ ++ // Make sure that the gpu is initialized ++ av_assert1(gpu != NULL); ++ switch (bit_depth){ ++ case 8: ++ a = gpu->code_gm_ptr.vc + offsetof(struct GPU, vpu_code8); ++ break; ++ case 10: ++ a = gpu->code_gm_ptr.vc + offsetof(struct GPU, vpu_code10); ++ break; ++ default: ++ av_assert0(0); ++ } ++ return a; ++} ++ ++unsigned int vpu_get_constants(void) { ++ av_assert1(gpu != NULL); ++ return (gpu->code_gm_ptr.vc + offsetof(struct GPU,transMatrix2even)); ++} ++ ++void gpu_ref(void) ++{ ++ gpu_lock_ref(); ++ gpu_unlock(); ++} ++ ++void gpu_unref(void) ++{ ++ gpu_env_t * const ge = gpu_lock(); ++ gpu_unlock_unref(ge); ++} ++ ++// ---------------------------------------------------------------------------- ++ ++ ++// Wait abstractions - mostly so we can easily add profile code ++static void vq_wait_pool_init(vq_wait_pool_t * const wp) ++{ ++ unsigned int i; ++ for (i = 0; i != VQ_WAIT_POOL_SIZE; ++i) { ++ sem_init(&wp->pool[i].sem, 0, 0); ++ wp->pool[i].next = wp->pool + i + 1; ++ } ++ wp->head = wp->pool + 0; ++ wp->pool[VQ_WAIT_POOL_SIZE - 1].next = NULL; ++} ++ ++static void vq_wait_pool_deinit(vq_wait_pool_t * const wp) ++{ ++ unsigned int i; ++ wp->head = NULL; ++ for (i = 0; i != VQ_WAIT_POOL_SIZE; ++i) { ++ sem_destroy(&wp->pool[i].sem); ++ wp->pool[i].next = NULL; ++ } ++} ++ ++ ++// If sem_init actually takes time then maybe we want a pool... ++static vq_wait_t * vq_wait_new(void) ++{ ++ gpu_env_t * const ge = gpu_lock_ref(); ++ vq_wait_t * const wait = ge->wait_pool.head; ++ ge->wait_pool.head = wait->next; ++ wait->next = NULL; ++ ++#if RPI_TRACE_TIME_VPU_QPU_WAIT ++ tto_start(&ge->ttw.active, ns_time()); ++#endif ++ ++ gpu_unlock(); ++ return wait; ++} ++ ++static void vq_wait_delete(vq_wait_t * const wait) ++{ ++ gpu_env_t * const ge = gpu_lock(); ++ wait->next = ge->wait_pool.head; ++ ge->wait_pool.head = wait; ++ ++#if RPI_TRACE_TIME_VPU_QPU_WAIT ++ { ++ trace_time_wait_t * const ttw = &ge->ttw; ++ const int64_t now = ns_time(); ++ ++ttw->jcount; ++ tto_end(&ttw->wait, now); ++ ++ if (ttw->start0 == 0) ++ { ++ ttw->start0 = ttw->active.start[0]; ++ ttw->last_update = ttw->start0; ++ } ++ if (now - ttw->last_update > WAIT_TIME_PRINT_PERIOD) ++ { ++ ttw->last_update += WAIT_TIME_PRINT_PERIOD; ++ ttw_print(ttw, now); ++ } ++ } ++#endif ++ gpu_unlock_unref(ge); ++} ++ ++static void vq_wait_wait(vq_wait_t * const wait) ++{ ++#if RPI_TRACE_TIME_VPU_QPU_WAIT ++ { ++ const int64_t now = ns_time(); ++ gpu_env_t * const ge = gpu_lock(); ++ tto_start(&ge->ttw.wait, now); ++ gpu_unlock(); ++ } ++#endif ++ ++ while (sem_wait(&wait->sem) == -1 && errno == EINTR) ++ /* loop */; ++} ++ ++static void vq_wait_post(vq_wait_t * const wait) ++{ ++#if RPI_TRACE_TIME_VPU_QPU_WAIT ++ { ++ gpu_env_t *const ge = gpu_lock(); ++ tto_end(&ge->ttw.active, ns_time()); ++ gpu_unlock(); ++ } ++#endif ++ ++ sem_post(&wait->sem); ++} ++ ++ ++ ++// Header comments were wrong for these two ++#define VPU_QPU_MASK_QPU 1 ++#define VPU_QPU_MASK_VPU 2 ++ ++typedef struct vpu_qpu_job_env_s vpu_qpu_job_env_t; ++ ++vpu_qpu_job_env_t * vpu_qpu_job_init(vpu_qpu_job_env_t * const buf) ++{ ++// vpu_qpu_job_env_t * vqj = calloc(1, sizeof(vpu_qpu_job_env_t)); ++ vpu_qpu_job_env_t * vqj = buf; ++// memset(vqj, 0, sizeof(*vqj)); ++ vqj->n = 0; ++ vqj->mask = 0; ++ return vqj; ++} ++ ++void vpu_qpu_job_delete(vpu_qpu_job_env_t * const vqj) ++{ ++// memset(vqj, 0, sizeof(*vqj)); ++// free(vqj); ++} ++ ++static inline struct gpu_job_s * new_job(vpu_qpu_job_env_t * const vqj) ++{ ++ struct gpu_job_s * const j = vqj->j + vqj->n++; ++ av_assert1(vqj->n <= VPU_QPU_JOB_MAX); ++ return j; ++} ++ ++void vpu_qpu_job_add_vpu(vpu_qpu_job_env_t * const vqj, const uint32_t vpu_code, ++ const unsigned r0, const unsigned r1, const unsigned r2, const unsigned r3, const unsigned r4, const unsigned r5) ++{ ++ if (vpu_code != 0) { ++ struct gpu_job_s *const j = new_job(vqj); ++ vqj->mask |= VPU_QPU_MASK_VPU; ++ ++ j->command = EXECUTE_VPU; ++ j->callback.func = 0; ++ j->callback.cookie = NULL; ++ // The bottom two bits of the execute address contain no-flush flags ++ // b0 will flush the VPU I-cache if unset so we nearly always want that set ++ // as we never reload code ++ j->u.v.q[0] = vpu_code | gpu->vpu_i_cache_flushed; ++ j->u.v.q[1] = r0; ++ j->u.v.q[2] = r1; ++ j->u.v.q[3] = r2; ++ j->u.v.q[4] = r3; ++ j->u.v.q[5] = r4; ++ j->u.v.q[6] = r5; ++ gpu->vpu_i_cache_flushed = 1; ++ } ++} ++ ++// flags are QPU_FLAGS_xxx ++void vpu_qpu_job_add_qpu(vpu_qpu_job_env_t * const vqj, const unsigned int n, const uint32_t * const mail) ++{ ++ if (n != 0) { ++ struct gpu_job_s *const j = new_job(vqj); ++ vqj->mask |= VPU_QPU_MASK_QPU; ++ ++ j->command = EXECUTE_QPU; ++ j->callback.func = 0; ++ j->callback.cookie = NULL; ++ ++ j->u.q.jobs = n; ++#if RPI_TRACE_QPU_PROFILE_ALL ++ j->u.q.noflush = QPU_FLAGS_NO_FLUSH_VPU | QPU_FLAGS_PROF_CLEAR_AND_ENABLE | QPU_FLAGS_PROF_OUTPUT_COUNTS; ++#else ++ j->u.q.noflush = QPU_FLAGS_NO_FLUSH_VPU; ++#endif ++ j->u.q.timeout = 5000; ++ memcpy(j->u.q.control, mail, n * QPU_MAIL_EL_VALS * sizeof(uint32_t)); ++ } ++} ++ ++// Convert callback to sem post ++static void vpu_qpu_job_callback_wait(void * v) ++{ ++ vq_wait_post(v); ++} ++ ++// Poke a user-supplied sem ++static void vpu_qpu_job_callback_sem(void * v) ++{ ++ sem_post((sem_t *)v); ++} ++ ++void vpu_qpu_job_add_sync_this(vpu_qpu_job_env_t * const vqj, vpu_qpu_wait_h * const wait_h) ++{ ++ vq_wait_t * wait; ++ ++ if (vqj->mask == 0) { ++ *wait_h = NULL; ++ return; ++ } ++ ++ // We are going to want a sync object ++ wait = vq_wait_new(); ++ ++ // There are 2 VPU Qs & 1 QPU Q so we can collapse sync ++ // If we only posted one thing or only QPU jobs ++ if (vqj->n == 1 || vqj->mask == VPU_QPU_MASK_QPU) ++ { ++ struct gpu_job_s * const j = vqj->j + (vqj->n - 1); ++ av_assert1(j->callback.func == 0); ++ ++ j->callback.func = vpu_qpu_job_callback_wait; ++ j->callback.cookie = wait; ++ } ++ else ++ { ++ struct gpu_job_s *const j = new_job(vqj); ++ ++ j->command = EXECUTE_SYNC; ++ j->u.s.mask = vqj->mask; ++ j->callback.func = vpu_qpu_job_callback_wait; ++ j->callback.cookie = wait; ++ } ++ ++ vqj->mask = 0; ++ *wait_h = wait; ++} ++ ++// Returns 0 if no sync added ('cos Q empty), 1 if sync added ++int vpu_qpu_job_add_sync_sem(vpu_qpu_job_env_t * const vqj, sem_t * const sem) ++{ ++ // If nothing on q then just return ++ if (vqj->mask == 0) ++ return 0; ++ ++ // There are 2 VPU Qs & 1 QPU Q so we can collapse sync ++ // If we only posted one thing or only QPU jobs ++ if (vqj->n == 1 || vqj->mask == VPU_QPU_MASK_QPU) ++ { ++ struct gpu_job_s * const j = vqj->j + (vqj->n - 1); ++ av_assert1(j->callback.func == 0); ++ ++ j->callback.func = vpu_qpu_job_callback_sem; ++ j->callback.cookie = sem; ++ } ++ else ++ { ++ struct gpu_job_s *const j = new_job(vqj); ++ ++ j->command = EXECUTE_SYNC; ++ j->u.s.mask = vqj->mask; ++ j->callback.func = vpu_qpu_job_callback_sem; ++ j->callback.cookie = sem; ++ } ++ ++ vqj->mask = 0; ++ return 1; ++} ++ ++ ++int vpu_qpu_job_start(vpu_qpu_job_env_t * const vqj) ++{ ++ if (vqj->n == 0) ++ return 0; ++ ++ return vc_gpuserv_execute_code(vqj->n, vqj->j); ++} ++ ++// Simple wrapper of start + delete ++int vpu_qpu_job_finish(vpu_qpu_job_env_t * const vqj) ++{ ++ int rv; ++ rv = vpu_qpu_job_start(vqj); ++ vpu_qpu_job_delete(vqj); ++ return rv; ++} ++ ++void vpu_qpu_wait(vpu_qpu_wait_h * const wait_h) ++{ ++ if (wait_h != NULL) ++ { ++ vq_wait_t * const wait = *wait_h; ++ if (wait != NULL) { ++ *wait_h = NULL; ++ vq_wait_wait(wait); ++ vq_wait_delete(wait); ++ } ++ } ++} ++ ++int vpu_qpu_init() ++{ ++ gpu_env_t * const ge = gpu_lock_ref(); ++ if (ge == NULL) ++ return -1; ++ ++ if (ge->init_count++ == 0) ++ { ++ vc_gpuserv_init(); ++ } ++ ++ gpu_unlock(); ++ return 0; ++} ++ ++void vpu_qpu_term() ++{ ++ gpu_env_t * const ge = gpu_lock(); ++ ++ if (--ge->init_count == 0) { ++ vc_gpuserv_deinit(); ++ ++#if RPI_TRACE_TIME_VPU_QPU_WAIT ++ ttw_print(&ge->ttw, ns_time()); ++#endif ++ } ++ ++ gpu_unlock_unref(ge); ++} ++ ++uint32_t qpu_fn(const int * const mc_fn) ++{ ++ return gpu->qpu_code_gm_ptr.vc + ((const char *)mc_fn - (const char *)ff_hevc_rpi_shader); ++} ++ ++uint32_t qpu_dummy(void) ++{ ++ return gpu->dummy_gm_ptr.vc; ++} ++ ++int rpi_hevc_qpu_init_fn(HEVCRpiQpu * const qf, const unsigned int bit_depth) ++{ ++ // Dummy values we can catch with emulation ++ qf->y_pxx = ~1U; ++ qf->y_bxx = ~2U; ++ qf->y_p00 = ~3U; ++ qf->y_b00 = ~4U; ++ qf->c_pxx = ~5U; ++ qf->c_bxx = ~6U; ++ ++ switch (bit_depth) { ++ case 8: ++ qf->y_pxx = qpu_fn(mc_filter_y_pxx); ++ qf->y_pxx = qpu_fn(mc_filter_y_pxx); ++ qf->y_bxx = qpu_fn(mc_filter_y_bxx); ++ qf->y_p00 = qpu_fn(mc_filter_y_p00); ++ qf->y_b00 = qpu_fn(mc_filter_y_b00); ++ qf->c_pxx = qpu_fn(mc_filter_c_p); ++ qf->c_pxx_l1 = qpu_fn(mc_filter_c_p_l1); ++ qf->c_bxx = qpu_fn(mc_filter_c_b); ++ break; ++ case 10: ++ qf->c_pxx = qpu_fn(mc_filter_c10_p); ++ qf->c_pxx_l1 = qpu_fn(mc_filter_c10_p_l1); ++ qf->c_bxx = qpu_fn(mc_filter_c10_b); ++ qf->y_pxx = qpu_fn(mc_filter_y10_pxx); ++ qf->y_bxx = qpu_fn(mc_filter_y10_bxx); ++ qf->y_p00 = qpu_fn(mc_filter_y10_p00); ++ qf->y_b00 = qpu_fn(mc_filter_y10_b00); ++ break; ++ default: ++ return -1; ++ } ++ return 0; ++} ++ +--- /dev/null ++++ b/libavcodec/rpi_qpu.h +@@ -0,0 +1,103 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++#ifndef RPI_QPU_H ++#define RPI_QPU_H ++ ++#include "rpi_mem.h" ++#include "rpi_zc_frames.h" ++ ++#pragma GCC diagnostic push ++// Many many redundant decls in the header files ++#pragma GCC diagnostic ignored "-Wredundant-decls" ++#pragma GCC diagnostic ignored "-Wstrict-prototypes" ++#include "interface/vmcs_host/vc_vchi_gpuserv.h" // for gpu_job_s ++#pragma GCC diagnostic pop ++ ++// QPU specific functions ++ ++typedef struct HEVCRpiQpu { ++ uint32_t c_pxx; ++ uint32_t c_pxx_l1; ++ uint32_t c_bxx; ++ uint32_t y_pxx; ++ uint32_t y_bxx; ++ uint32_t y_p00; ++ uint32_t y_b00; ++} HEVCRpiQpu; ++ ++int rpi_hevc_qpu_init_fn(HEVCRpiQpu * const qf, const unsigned int bit_depth); ++ ++uint32_t qpu_fn(const int * const mc_fn); ++uint32_t qpu_dummy(void); ++ ++#define QPU_N_GRP 4 ++#define QPU_N_MAX 12 ++ ++#define QPU_MAIL_EL_VALS 2 ++ ++struct vpu_qpu_wait_s; ++typedef struct vq_wait_s * vpu_qpu_wait_h; ++ ++// VPU specific functions ++ ++struct vpu_qpu_job_env_s; ++typedef struct vpu_qpu_job_env_s * vpu_qpu_job_h; ++ ++#define VPU_QPU_JOB_MAX 4 ++struct vpu_qpu_job_env_s ++{ ++ unsigned int n; ++ unsigned int mask; ++ struct gpu_job_s j[VPU_QPU_JOB_MAX]; ++}; ++typedef struct vpu_qpu_job_env_s vpu_qpu_job_env_t; ++ ++vpu_qpu_job_h vpu_qpu_job_init(vpu_qpu_job_env_t * const buf); ++void vpu_qpu_job_delete(const vpu_qpu_job_h vqj); ++void vpu_qpu_job_add_vpu(const vpu_qpu_job_h vqj, const uint32_t vpu_code, ++ const unsigned r0, const unsigned r1, const unsigned r2, const unsigned r3, const unsigned r4, const unsigned r5); ++void vpu_qpu_job_add_qpu(const vpu_qpu_job_h vqj, const unsigned int n, const uint32_t * const mail); ++void vpu_qpu_job_add_sync_this(const vpu_qpu_job_h vqj, vpu_qpu_wait_h * const wait_h); ++int vpu_qpu_job_add_sync_sem(vpu_qpu_job_env_t * const vqj, sem_t * const sem); ++int vpu_qpu_job_start(const vpu_qpu_job_h vqj); ++int vpu_qpu_job_finish(const vpu_qpu_job_h vqj); ++ ++extern unsigned int vpu_get_fn(const unsigned int bit_depth); ++extern unsigned int vpu_get_constants(void); ++ ++// Waits for previous post_codee to complete and Will null out *wait_h after use ++void vpu_qpu_wait(vpu_qpu_wait_h * const wait_h); ++int vpu_qpu_init(void); ++void vpu_qpu_term(void); ++ ++void gpu_ref(void); ++void gpu_unref(void); ++ ++#endif +--- /dev/null ++++ b/libavcodec/rpi_zc.c +@@ -0,0 +1,1227 @@ ++#include "config.h" ++ ++#include "libavcodec/avcodec.h" ++#include "rpi_mem.h" ++#include "rpi_mailbox.h" ++#include "rpi_zc.h" ++#include "libavutil/avassert.h" ++#include ++ ++#include "libavutil/buffer_internal.h" ++ ++#pragma GCC diagnostic push ++// Many many redundant decls in the header files ++#pragma GCC diagnostic ignored "-Wredundant-decls" ++#include ++#include ++#pragma GCC diagnostic pop ++ ++#define TRACE_ALLOC 0 ++#define DEBUG_ALWAYS_KEEP_LOCKED 0 ++ ++struct ZcPoolEnt; ++ ++typedef struct ZcPool ++{ ++ size_t numbytes; ++ struct ZcPoolEnt * head; ++ pthread_mutex_t lock; ++} ZcPool; ++ ++typedef struct ZcPoolEnt ++{ ++ size_t numbytes; ++ ++ unsigned int vcsm_handle; ++ unsigned int vc_handle; ++ void * map_arm; ++ unsigned int map_vc; ++ ++ struct ZcPoolEnt * next; ++ struct ZcPool * pool; ++} ZcPoolEnt; ++ ++typedef struct ZcOldCtxVals ++{ ++ int thread_safe_callbacks; ++ int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); ++ void * opaque; ++} ZcOldCtxVals; ++ ++typedef struct AVZcEnv ++{ ++ unsigned int refcount; ++ ZcOldCtxVals old; ++ ++ void * pool_env; ++ av_rpi_zc_alloc_buf_fn_t * alloc_buf; ++ av_rpi_zc_free_pool_fn_t * free_pool; ++ ++ unsigned int pool_size; ++} ZcEnv; ++ ++typedef struct ZcUserBufEnv { ++ void * v; ++ const av_rpi_zc_buf_fn_tab_t * fn; ++ size_t numbytes; ++ int offset; ++} ZcUserBufEnv; ++ ++#define ZC_BUF_INVALID 0 ++#define ZC_BUF_VALID 1 ++#define ZC_BUF_NEVER 2 ++ ++typedef struct ZcBufEnv { ++ GPU_MEM_PTR_T gmem; ++ AVZcEnvPtr zc; ++ int is_valid; ++ AVBufferRef * user; ++ AVRpiZcFrameGeometry geo; ++ size_t size_y; ++ size_t size_c; ++ size_t size_pic; ++ ssize_t offset; ++ pthread_mutex_t lock; ++ pthread_cond_t cond; ++} ZcBufEnv; ++ ++ ++ ++ ++ ++ ++#define ALLOC_PAD 0 ++#define ALLOC_ROUND 0x1000 ++#define STRIDE_ROUND 64 ++#define STRIDE_OR 0 ++ ++#define DEBUG_ZAP0_BUFFERS 0 ++ ++static inline int av_rpi_is_sand_format(const int format) ++{ ++ return (format >= AV_PIX_FMT_SAND128 && format <= AV_PIX_FMT_SAND64_16) || ++ (format == AV_PIX_FMT_RPI4_8 || format == AV_PIX_FMT_RPI4_10); ++} ++ ++static inline int av_rpi_is_sand_frame(const AVFrame * const frame) ++{ ++ return av_rpi_is_sand_format(frame->format); ++} ++ ++//---------------------------------------------------------------------------- ++// ++// Internal pool stuff ++ ++// Pool entry functions ++ ++static ZcPoolEnt * zc_pool_ent_alloc(ZcPool * const pool, const size_t req_size) ++{ ++ ZcPoolEnt * const zp = av_mallocz(sizeof(ZcPoolEnt)); ++ ++ // Round up to 4k & add 4k ++ const unsigned int alloc_size = (req_size + ALLOC_PAD + ALLOC_ROUND - 1) & ~(ALLOC_ROUND - 1); ++ ++ if (zp == NULL) { ++ av_log(NULL, AV_LOG_ERROR, "av_malloc(ZcPoolEnt) failed\n"); ++ goto fail0; ++ } ++ ++ // The 0x80 here maps all pages here rather than waiting for lazy mapping ++ // BEWARE that in GPU land a later unlock/lock pair will put us back into ++ // lazy mode - which will also break cache invalidate calls. ++ if ((zp->vcsm_handle = vcsm_malloc_cache(alloc_size, VCSM_CACHE_TYPE_HOST | 0x80, "ffmpeg_rpi_zc")) == 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "av_gpu_malloc_cached(%d) failed\n", alloc_size); ++ goto fail1; ++ } ++ ++#if TRACE_ALLOC ++ printf("%s: Alloc %#x bytes @ h=%d\n", __func__, alloc_size, zp->vcsm_handle); ++#endif ++ ++ zp->numbytes = alloc_size; ++ zp->pool = pool; ++ return zp; ++ ++fail1: ++ av_free(zp); ++fail0: ++ return NULL; ++} ++ ++static void zc_pool_ent_free(ZcPoolEnt * const zp) ++{ ++#if TRACE_ALLOC ++ printf("%s: Free %#x bytes @ h=%d\n", __func__, zp->numbytes, zp->vcsm_handle); ++#endif ++ ++ if (zp->vcsm_handle != 0) ++ { ++ // VC addr & handle need no dealloc ++ if (zp->map_arm != NULL) ++ vcsm_unlock_hdl(zp->vcsm_handle); ++ vcsm_free(zp->vcsm_handle); ++ } ++ av_free(zp); ++} ++ ++//---------------------------------------------------------------------------- ++// ++// Pool functions ++ ++static void zc_pool_free_ent_list(ZcPoolEnt * p) ++{ ++ while (p != NULL) ++ { ++ ZcPoolEnt * const zp = p; ++ p = p->next; ++ zc_pool_ent_free(zp); ++ } ++} ++ ++static void zc_pool_flush(ZcPool * const pool) ++{ ++ ZcPoolEnt * p = pool->head; ++ pool->head = NULL; ++ pool->numbytes = ~0U; ++ zc_pool_free_ent_list(p); ++} ++ ++static ZcPoolEnt * zc_pool_get_ent(ZcPool * const pool, const size_t req_bytes) ++{ ++ ZcPoolEnt * zp = NULL; ++ ZcPoolEnt * flush_list = NULL; ++ size_t numbytes; ++ ++ pthread_mutex_lock(&pool->lock); ++ ++ numbytes = pool->numbytes; ++ ++ // If size isn't close then dump the pool ++ // Close in this context means within 128k ++ if (req_bytes > numbytes || req_bytes + 0x20000 < numbytes) ++ { ++ flush_list = pool->head; ++ pool->head = NULL; ++ pool->numbytes = numbytes = req_bytes; ++ } ++ else if (pool->head != NULL) ++ { ++ zp = pool->head; ++ pool->head = zp->next; ++ } ++ ++ pthread_mutex_unlock(&pool->lock); ++ ++ zc_pool_free_ent_list(flush_list); ++ ++ if (zp == NULL) ++ zp = zc_pool_ent_alloc(pool, numbytes); ++ ++ return zp; ++} ++ ++static void zc_pool_put_ent(ZcPoolEnt * const zp) ++{ ++ ZcPool * const pool = zp == NULL ? NULL : zp->pool; ++ if (zp != NULL) ++ { ++ pthread_mutex_lock(&pool->lock); ++#if TRACE_ALLOC ++ printf("%s: Recycle %#x, %#x\n", __func__, pool->numbytes, zp->numbytes); ++#endif ++ ++ if (pool->numbytes == zp->numbytes) ++ { ++ zp->next = pool->head; ++ pool->head = zp; ++ pthread_mutex_unlock(&pool->lock); ++ } ++ else ++ { ++ pthread_mutex_unlock(&pool->lock); ++ zc_pool_ent_free(zp); ++ } ++ } ++} ++ ++static ZcPool * ++zc_pool_new(void) ++{ ++ ZcPool * const pool = av_mallocz(sizeof(*pool)); ++ if (pool == NULL) ++ return NULL; ++ ++ pool->numbytes = -1; ++ pool->head = NULL; ++ pthread_mutex_init(&pool->lock, NULL); ++ return pool; ++} ++ ++static void ++zc_pool_delete(ZcPool * const pool) ++{ ++ if (pool != NULL) ++ { ++ pool->numbytes = -1; ++ zc_pool_flush(pool); ++ pthread_mutex_destroy(&pool->lock); ++ av_free(pool); ++ } ++} ++ ++//============================================================================ ++// ++// ZC implementation using above pool implementation ++// ++// Fn table fns... ++ ++static void zc_pool_free_v(void * v) ++{ ++ zc_pool_put_ent(v); ++} ++ ++static unsigned int zc_pool_ent_vcsm_handle_v(void * v) ++{ ++ ZcPoolEnt * zp = v; ++ return zp->vcsm_handle; ++} ++ ++static unsigned int zc_pool_ent_vc_handle_v(void * v) ++{ ++ ZcPoolEnt * zp = v; ++ if (zp->vc_handle == 0) ++ { ++ if ((zp->vc_handle = vcsm_vc_hdl_from_hdl(zp->vcsm_handle)) == 0) ++ av_log(NULL, AV_LOG_ERROR, "%s: Failed to map VCSM handle %d to VC handle\n", ++ __func__, zp->vcsm_handle); ++ } ++ return zp->vc_handle; ++} ++ ++static void * zc_pool_ent_map_arm_v(void * v) ++{ ++ ZcPoolEnt * zp = v; ++ if (zp->map_arm == NULL) ++ { ++ if ((zp->map_arm = vcsm_lock(zp->vcsm_handle)) == NULL) ++ av_log(NULL, AV_LOG_ERROR, "%s: Failed to map VCSM handle %d to ARM address\n", ++ __func__, zp->vcsm_handle); ++ } ++ return zp->map_arm; ++} ++ ++static unsigned int zc_pool_ent_map_vc_v(void * v) ++{ ++ ZcPoolEnt * zp = v; ++ if (zp->map_vc == 0) ++ { ++ if ((zp->map_vc = vcsm_vc_addr_from_hdl(zp->vcsm_handle)) == 0) ++ av_log(NULL, AV_LOG_ERROR, "%s: Failed to map VCSM handle %d to VC address\n", ++ __func__, zp->vcsm_handle); ++ } ++ return zp->map_vc; ++} ++ ++static const av_rpi_zc_buf_fn_tab_t zc_pool_buf_fns = { ++ .free = zc_pool_free_v, ++ .vcsm_handle = zc_pool_ent_vcsm_handle_v, ++ .vc_handle = zc_pool_ent_vc_handle_v, ++ .map_arm = zc_pool_ent_map_arm_v, ++ .map_vc = zc_pool_ent_map_vc_v, ++}; ++ ++// ZC Env fns ++ ++// Delete pool ++// All buffers guaranteed freed by now ++static void ++zc_pool_delete_v(void * v) ++{ ++ zc_pool_delete((ZcPool *)v); ++ rpi_mem_gpu_uninit(); ++} ++ ++// Allocate a new ZC buffer ++static AVBufferRef * ++zc_pool_buf_alloc(void * v, size_t size, const AVRpiZcFrameGeometry * geo) ++{ ++ ZcPool * const pool = v; ++ ZcPoolEnt *const zp = zc_pool_get_ent(pool, size); ++ AVBufferRef * buf; ++ ++ (void)geo; // geo ignored here ++ ++ if (zp == NULL) { ++ av_log(NULL, AV_LOG_ERROR, "zc_pool_alloc(%d) failed\n", size); ++ goto fail0; ++ } ++ ++ if ((buf = av_rpi_zc_buf(size, 0, zp, &zc_pool_buf_fns)) == NULL) ++ { ++ av_log(NULL, AV_LOG_ERROR, "av_rpi_zc_buf() failed\n"); ++ goto fail2; ++ } ++ ++ return buf; ++ ++fail2: ++ zc_pool_put_ent(zp); ++fail0: ++ return NULL; ++} ++ ++// Init wrappers - the public fns ++ ++AVZcEnvPtr ++av_rpi_zc_int_env_alloc(void * logctx) ++{ ++ ZcEnv * zc; ++ ZcPool * pool_env; ++ ++ if (rpi_mem_gpu_init(0) < 0) ++ return NULL; ++ ++ if ((pool_env = zc_pool_new()) == NULL) ++ goto fail1; ++ ++ if ((zc = av_rpi_zc_env_alloc(logctx, pool_env, zc_pool_buf_alloc, zc_pool_delete_v)) == NULL) ++ goto fail2; ++ ++ return zc; ++ ++fail2: ++ zc_pool_delete(pool_env); ++fail1: ++ rpi_mem_gpu_uninit(); ++ return NULL; ++} ++ ++void ++av_rpi_zc_int_env_freep(AVZcEnvPtr * zcp) ++{ ++ const AVZcEnvPtr zc = *zcp; ++ *zcp = NULL; ++ if (zc != NULL) ++ av_rpi_zc_env_release(zc); ++} ++ ++//============================================================================ ++// ++// Geometry ++// ++// This is a separate chunck to the rest ++ ++// Get mailbox fd - should be in a lock when called ++// Rely on process close to close it ++static int mbox_fd(void) ++{ ++ static int fd = -1; ++ if (fd != -1) ++ return fd; ++ return (fd = mbox_open()); ++} ++ ++AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( ++ const int format, const unsigned int video_width, const unsigned int video_height) ++{ ++ static pthread_mutex_t sand_lock = PTHREAD_MUTEX_INITIALIZER; ++ ++ AVRpiZcFrameGeometry geo = { ++ .format = format, ++ .video_width = video_width, ++ .video_height = video_height ++ }; ++ ++ switch (format) ++ { ++ case AV_PIX_FMT_YUV420P: ++ geo.stride_y = ((video_width + 32 + STRIDE_ROUND - 1) & ~(STRIDE_ROUND - 1)) | STRIDE_OR; ++ geo.stride_c = geo.stride_y / 2; ++ geo.height_y = (video_height + 32 + 31) & ~31; ++ geo.height_c = geo.height_y / 2; ++ geo.planes_c = 2; ++ geo.stripes = 1; ++ geo.bytes_per_pel = 1; ++ geo.stripe_is_yc = 1; ++ break; ++ ++ case AV_PIX_FMT_YUV420P10: ++ geo.stride_y = ((video_width * 2 + 64 + STRIDE_ROUND - 1) & ~(STRIDE_ROUND - 1)) | STRIDE_OR; ++ geo.stride_c = geo.stride_y / 2; ++ geo.height_y = (video_height + 32 + 31) & ~31; ++ geo.height_c = geo.height_y / 2; ++ geo.planes_c = 2; ++ geo.stripes = 1; ++ geo.bytes_per_pel = 2; ++ geo.stripe_is_yc = 1; ++ break; ++ ++ case AV_PIX_FMT_SAND128: ++ case AV_PIX_FMT_RPI4_8: ++ { ++ const unsigned int stripe_w = 128; ++ ++ static VC_IMAGE_T img = {0}; ++ ++ // Given the overhead of calling the mailbox keep a stashed ++ // copy as we will almost certainly just want the same numbers again ++ // but that means we need a lock ++ pthread_mutex_lock(&sand_lock); ++ ++ if (img.width != video_width || img.height != video_height) ++ { ++ VC_IMAGE_T new_img = { ++ .type = VC_IMAGE_YUV_UV, ++ .width = video_width, ++ .height = video_height ++ }; ++ ++ mbox_get_image_params(mbox_fd(), &new_img); ++ img = new_img; ++ } ++ ++ geo.stride_y = stripe_w; ++ geo.stride_c = stripe_w; ++ geo.height_y = ((intptr_t)img.extra.uv.u - (intptr_t)img.image_data) / stripe_w; ++ geo.height_c = img.pitch / stripe_w - geo.height_y; ++ geo.stripe_is_yc = 1; ++ if (geo.height_y * stripe_w > img.pitch) ++ { ++ // "tall" sand - all C blocks now follow Y ++ geo.height_y = img.pitch / stripe_w; ++ geo.height_c = geo.height_y; ++ geo.stripe_is_yc = 0; ++ } ++ geo.planes_c = 1; ++ geo.stripes = (video_width + stripe_w - 1) / stripe_w; ++ geo.bytes_per_pel = 1; ++ ++ pthread_mutex_unlock(&sand_lock); ++#if 0 ++ printf("Req: %dx%d: stride=%d/%d, height=%d/%d, stripes=%d, img.pitch=%d\n", ++ video_width, video_height, ++ geo.stride_y, geo.stride_c, ++ geo.height_y, geo.height_c, ++ geo.stripes, img.pitch); ++#endif ++ av_assert0((int)geo.height_y > 0 && (int)geo.height_c > 0); ++ av_assert0(geo.height_y >= video_height && geo.height_c >= video_height / 2); ++ break; ++ } ++ ++ case AV_PIX_FMT_RPI4_10: ++ { ++ const unsigned int stripe_w = 128; // bytes ++ ++ static pthread_mutex_t sand_lock = PTHREAD_MUTEX_INITIALIZER; ++ static VC_IMAGE_T img = {0}; ++ ++ // Given the overhead of calling the mailbox keep a stashed ++ // copy as we will almost certainly just want the same numbers again ++ // but that means we need a lock ++ pthread_mutex_lock(&sand_lock); ++ ++ if (img.width != video_width || img.height != video_height) ++ { ++ VC_IMAGE_T new_img = { ++ .type = VC_IMAGE_YUV10COL, ++ .width = video_width, ++ .height = video_height ++ }; ++ ++ mbox_get_image_params(mbox_fd(), &new_img); ++ img = new_img; ++ } ++ ++ geo.stride_y = stripe_w; ++ geo.stride_c = stripe_w; ++ geo.height_y = ((intptr_t)img.extra.uv.u - (intptr_t)img.image_data) / stripe_w; ++ geo.height_c = img.pitch / stripe_w - geo.height_y; ++ geo.planes_c = 1; ++ geo.stripes = ((video_width * 4 + 2) / 3 + stripe_w - 1) / stripe_w; ++ geo.bytes_per_pel = 1; ++ geo.stripe_is_yc = 1; ++ ++ pthread_mutex_unlock(&sand_lock); ++ ++#if 0 ++ printf("Req: %dx%d: stride=%d/%d, height=%d/%d, stripes=%d, img.pitch=%d\n", ++ video_width, video_height, ++ geo.stride_y, geo.stride_c, ++ geo.height_y, geo.height_c, ++ geo.stripes, img.pitch); ++#endif ++ av_assert0((int)geo.height_y > 0 && (int)geo.height_c > 0); ++ av_assert0(geo.height_y >= video_height && geo.height_c >= video_height / 2); ++ break; ++ } ++ ++ case AV_PIX_FMT_SAND64_16: ++ case AV_PIX_FMT_SAND64_10: ++ { ++ const unsigned int stripe_w = 128; // bytes ++ ++ static pthread_mutex_t sand_lock = PTHREAD_MUTEX_INITIALIZER; ++ static VC_IMAGE_T img = {0}; ++ ++ // Given the overhead of calling the mailbox keep a stashed ++ // copy as we will almost certainly just want the same numbers again ++ // but that means we need a lock ++ pthread_mutex_lock(&sand_lock); ++ ++ if (img.width != video_width || img.height != video_height) ++ { ++ VC_IMAGE_T new_img = { ++ .type = VC_IMAGE_YUV_UV_16, ++ .width = video_width, ++ .height = video_height ++ }; ++ ++ mbox_get_image_params(mbox_fd(), &new_img); ++ img = new_img; ++ } ++ ++ geo.stride_y = stripe_w; ++ geo.stride_c = stripe_w; ++ geo.height_y = ((intptr_t)img.extra.uv.u - (intptr_t)img.image_data) / stripe_w; ++ geo.height_c = img.pitch / stripe_w - geo.height_y; ++ geo.planes_c = 1; ++ geo.stripes = (video_width * 2 + stripe_w - 1) / stripe_w; ++ geo.bytes_per_pel = 2; ++ geo.stripe_is_yc = 1; ++ ++ pthread_mutex_unlock(&sand_lock); ++ break; ++ } ++ ++ default: ++ break; ++ } ++ return geo; ++} ++ ++//============================================================================ ++// ++// ZC Env fns ++// ++// Frame copy fns ++ ++static AVBufferRef * zc_copy(const AVZcEnvPtr zc, ++ const AVFrame * const src) ++{ ++ AVFrame dest_frame; ++ AVFrame * const dest = &dest_frame; ++ unsigned int i; ++ uint8_t * psrc, * pdest; ++ ++ dest->format = src->format; ++ dest->width = src->width; ++ dest->height = src->height; ++ ++ if (av_rpi_zc_get_buffer(zc, dest) != 0 || ++ av_rpi_zc_resolve_frame(dest, ZC_RESOLVE_ALLOC_VALID) != 0) ++ { ++ return NULL; ++ } ++ ++ for (i = 0, psrc = src->data[0], pdest = dest->data[0]; ++ i != dest->height; ++ ++i, psrc += src->linesize[0], pdest += dest->linesize[0]) ++ { ++ memcpy(pdest, psrc, dest->width); ++ } ++ for (i = 0, psrc = src->data[1], pdest = dest->data[1]; ++ i != dest->height / 2; ++ ++i, psrc += src->linesize[1], pdest += dest->linesize[1]) ++ { ++ memcpy(pdest, psrc, dest->width / 2); ++ } ++ for (i = 0, psrc = src->data[2], pdest = dest->data[2]; ++ i != dest->height / 2; ++ ++i, psrc += src->linesize[2], pdest += dest->linesize[2]) ++ { ++ memcpy(pdest, psrc, dest->width / 2); ++ } ++ ++ return dest->buf[0]; ++} ++ ++ ++static AVBufferRef * zc_420p10_to_sand128(const AVZcEnvPtr zc, ++ const AVFrame * const src) ++{ ++ assert(0); ++ return NULL; ++} ++ ++ ++static AVBufferRef * zc_sand64_16_to_sand128(const AVZcEnvPtr zc, ++ const AVFrame * const src, const unsigned int src_bits) ++{ ++ assert(0); ++ return NULL; ++} ++ ++//---------------------------------------------------------------------------- ++// ++// Public info extraction calls ++ ++static void zc_buf_env_free_cb(void * opaque, uint8_t * data); ++ ++static inline ZcBufEnv * pic_zbe_ptr(AVBufferRef *const buf) ++{ ++ // Kludge where we check the free fn to check this is really ++ // one of our buffers - can't think of a better way ++ return buf == NULL || buf->buffer->free != zc_buf_env_free_cb ? NULL : ++ av_buffer_get_opaque(buf); ++} ++ ++static inline GPU_MEM_PTR_T * pic_gm_ptr(AVBufferRef * const buf) ++{ ++ // As gmem is the first el NULL should be preserved ++ return &pic_zbe_ptr(buf)->gmem; ++} ++ ++unsigned int av_rpi_zc_vcsm_handle(const AVRpiZcRefPtr fr_ref) ++{ ++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); ++ return p == NULL ? 0 : p->vcsm_handle; ++} ++ ++int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref) ++{ ++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); ++ return p == NULL ? -1 : p->vc_handle; ++} ++ ++int av_rpi_zc_offset(const AVRpiZcRefPtr fr_ref) ++{ ++ const ZcBufEnv * const zbe = pic_zbe_ptr(fr_ref); ++ return zbe == NULL ? 0 : zbe->offset; ++} ++ ++int av_rpi_zc_length(const AVRpiZcRefPtr fr_ref) ++{ ++ const ZcBufEnv * const zbe = pic_zbe_ptr(fr_ref); ++ return zbe == NULL ? 0 : zbe->size_pic; ++} ++ ++int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref) ++{ ++ const GPU_MEM_PTR_T * const p = pic_gm_ptr(fr_ref); ++ return p == NULL ? 0 : p->numbytes; ++} ++ ++const AVRpiZcFrameGeometry * av_rpi_zc_geometry(const AVRpiZcRefPtr fr_ref) ++{ ++ const ZcBufEnv * const zbe = pic_zbe_ptr(fr_ref); ++ return zbe == NULL ? NULL : &zbe->geo; ++} ++ ++AVRpiZcRefPtr av_rpi_zc_ref(void * const logctx, const AVZcEnvPtr zc, ++ const AVFrame * const frame, const enum AVPixelFormat expected_format, const int maycopy) ++{ ++ av_assert0(!maycopy || zc != NULL); ++ ++ if (frame->format != AV_PIX_FMT_YUV420P && ++ frame->format != AV_PIX_FMT_YUV420P10 && ++ !av_rpi_is_sand_frame(frame)) ++ { ++ av_log(logctx, AV_LOG_WARNING, "%s: *** Format not SAND/YUV420P: %d\n", __func__, frame->format); ++ return NULL; ++ } ++ ++ if (frame->buf[1] != NULL || frame->format != expected_format) ++ { ++#if RPI_ZC_SAND_8_IN_10_BUF ++ if (frame->format == AV_PIX_FMT_SAND64_10 && expected_format == AV_PIX_FMT_SAND128 && frame->buf[RPI_ZC_SAND_8_IN_10_BUF] != NULL) ++ { ++// av_log(s, AV_LOG_INFO, "%s: --- found buf[4]\n", __func__); ++ return av_buffer_ref(frame->buf[RPI_ZC_SAND_8_IN_10_BUF]); ++ } ++#endif ++ ++ if (maycopy) ++ { ++ if (frame->buf[1] != NULL) ++ av_log(logctx, AV_LOG_INFO, "%s: *** Not a single buf frame: copying\n", __func__); ++ else ++ av_log(logctx, AV_LOG_INFO, "%s: *** Unexpected frame format %d: copying to %d\n", __func__, frame->format, expected_format); ++ ++ switch (frame->format) ++ { ++ case AV_PIX_FMT_YUV420P10: ++ return zc_420p10_to_sand128(zc, frame); ++ ++ case AV_PIX_FMT_SAND64_10: ++ return zc_sand64_16_to_sand128(zc, frame, 10); ++ ++ default: ++ return zc_copy(zc, frame); ++ } ++ } ++ else ++ { ++ if (frame->buf[1] != NULL) ++ av_log(logctx, AV_LOG_WARNING, "%s: *** Not a single buf frame: buf[1] != NULL\n", __func__); ++ else ++ av_log(logctx, AV_LOG_INFO, "%s: *** Unexpected frame format: %d != %d\n", __func__, frame->format, expected_format); ++ return NULL; ++ } ++ } ++ ++ if (pic_gm_ptr(frame->buf[0]) == NULL) ++ { ++ if (maycopy) ++ { ++ av_log(logctx, AV_LOG_INFO, "%s: *** Not one of our buffers: copying\n", __func__); ++ return zc_copy(zc, frame); ++ } ++ else ++ { ++ av_log(logctx, AV_LOG_WARNING, "%s: *** Not one of our buffers: NULL\n", __func__); ++ return NULL; ++ } ++ } ++ ++ return av_buffer_ref(frame->buf[0]); ++} ++ ++void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref) ++{ ++ if (fr_ref != NULL) ++ { ++ av_buffer_unref(&fr_ref); ++ } ++} ++ ++//---------------------------------------------------------------------------- ++ ++// Extract user environment from an AVBufferRef ++void * av_rpi_zc_buf_v(AVBufferRef * const buf) ++{ ++ ZcBufEnv * const zbe = pic_zbe_ptr(buf); ++ if (zbe != NULL && zbe->user != NULL) ++ { ++ const ZcUserBufEnv * const zub = (const ZcUserBufEnv *)zbe->user->data; ++ return zub == NULL ? NULL : zub->v; ++ } ++ return NULL; ++} ++ ++// AV buffer pre-free callback ++static void zc_user_buf_free_cb(void * opaque, uint8_t * data) ++{ ++ if (opaque != NULL) ++ { ++ ZcUserBufEnv * const zub = opaque; ++ ++ if (zub->fn->free) ++ zub->fn->free(zub->v); ++ ++ av_free(zub); ++ } ++} ++ ++static void zc_buf_env_free_cb(void * opaque, uint8_t * data) ++{ ++ if (opaque != NULL) ++ { ++ ZcBufEnv * const zbe = opaque; ++ ++ av_buffer_unref(&zbe->user); ++ ++ if (zbe->zc != NULL) ++ av_rpi_zc_env_release(zbe->zc); ++ ++ pthread_cond_destroy(&zbe->cond); ++ pthread_mutex_destroy(&zbe->lock); ++ av_free(zbe); ++ } ++} ++ ++ ++// Wrap the various ZC bits in an AV Buffer and resolve those things we want ++// resolved now. ++// Currently we resolve everything, but in future we might not ++AVBufferRef * av_rpi_zc_buf(size_t numbytes, int addr_offset, void * v, const av_rpi_zc_buf_fn_tab_t * fn_tab) ++{ ++ AVBufferRef *buf; ++ ZcUserBufEnv * zub; ++ ++ if ((zub = av_malloc(sizeof(ZcUserBufEnv))) == NULL) ++ return NULL; ++ ++ zub->fn = fn_tab; ++ zub->v = v; ++ zub->numbytes = numbytes; ++ zub->offset = addr_offset; ++ ++ if ((buf = av_buffer_create((uint8_t*)zub, sizeof(*zub), zc_user_buf_free_cb, zub, 0)) == NULL) ++ { ++ av_log(NULL, AV_LOG_ERROR, "ZC: Failed av_buffer_create\n"); ++ av_free(zub); ++ return NULL; ++ } ++ ++ return buf; ++} ++ ++int av_rpi_zc_resolve_buffer(AVBufferRef * const buf, const int alloc_mode) ++{ ++ ZcBufEnv * const zbe = pic_zbe_ptr(buf); ++ ++ if (zbe == NULL) ++ return AVERROR(EINVAL); ++ ++ if (alloc_mode == ZC_RESOLVE_FAIL && !zbe->is_valid) ++ return AVERROR(EAGAIN); ++ ++ if (alloc_mode == ZC_RESOLVE_WAIT_VALID && !zbe->is_valid) ++ { ++ pthread_mutex_lock(&zbe->lock); ++ while (!zbe->is_valid) ++ pthread_cond_wait(&zbe->cond, &zbe->lock); ++ pthread_mutex_unlock(&zbe->lock); ++ } ++ ++ if (zbe->is_valid == ZC_BUF_NEVER) ++ return AVERROR(EINVAL); ++ ++ // Do alloc if we need it ++ if (zbe->user == NULL) ++ { ++ ZcEnv * const zc = zbe->zc; ++ const ZcUserBufEnv * zub; ++ ++ av_assert0(alloc_mode == ZC_RESOLVE_ALLOC || alloc_mode == ZC_RESOLVE_ALLOC_VALID); ++ ++ if ((zbe->user = zc->alloc_buf(zc->pool_env, zbe->size_pic, &zbe->geo)) == NULL) ++ { ++ av_log(NULL, AV_LOG_ERROR, "rpi_get_display_buffer: Failed to get buffer from pool\n"); ++ goto fail; ++ } ++ zub = (const ZcUserBufEnv *)zbe->user->data; ++ ++ // Track ++ ++ zbe->offset = zub->offset; ++ zbe->gmem.numbytes = zub->numbytes; ++ if ((zbe->gmem.arm = zub->fn->map_arm(zub->v)) == NULL) ++ { ++ av_log(NULL, AV_LOG_ERROR, "ZC: Failed to lock vcsm_handle %u\n", zbe->gmem.vcsm_handle); ++ goto fail; ++ } ++ ++ if ((zbe->gmem.vcsm_handle = zub->fn->vcsm_handle(zub->v)) == 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "ZC: Failed to get vcsm_handle\n"); ++ goto fail; ++ } ++ ++ if ((zbe->gmem.vc_handle = zub->fn->vc_handle(zub->v)) == 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "ZC: Failed to get vc handle from vcsm_handle %u\n", zbe->gmem.vcsm_handle); ++ goto fail; ++ } ++ if ((zbe->gmem.vc = zub->fn->map_vc(zub->v)) == 0) ++ { ++ av_log(NULL, AV_LOG_ERROR, "ZC: Failed to get vc addr from vcsm_handle %u\n", zbe->gmem.vcsm_handle); ++ goto fail; ++ } ++ ++ buf->buffer->data = zbe->gmem.arm + zbe->offset; ++ buf->buffer->size = zbe->size_pic; ++ ++ // In this mode we shouldn't have anyone waiting for us ++ // so no need to signal ++ if (alloc_mode == ZC_RESOLVE_ALLOC_VALID) ++ zbe->is_valid = 1; ++ } ++ ++ // Just overwrite - no point in testing ++ buf->data = zbe->gmem.arm + zbe->offset; ++ buf->size = zbe->size_pic; ++ return 0; ++ ++fail: ++ av_buffer_unref(&zbe->user); ++ return AVERROR(ENOMEM); ++} ++ ++int av_rpi_zc_resolve_frame(AVFrame * const frame, const int may_alloc) ++{ ++ int rv; ++ ++ // Do alloc if we need it ++ if ((rv = av_rpi_zc_resolve_buffer(frame->buf[0], may_alloc)) != 0) ++ return rv; ++ ++ // If we are a framebuf copy then the alloc can be done but we haven't ++ // imported its results yet ++ if (frame->data[0] == NULL) ++ { ++ const ZcBufEnv * const zbe = pic_zbe_ptr(frame->buf[0]); ++ ++ frame->linesize[0] = zbe->geo.stride_y; ++ frame->linesize[1] = zbe->geo.stride_c; ++ frame->linesize[2] = zbe->geo.stride_c; ++ // abuse: linesize[3] = "stripe stride" ++ // stripe_stride is NOT the stride between slices it is (that / geo.stride_y). ++ // In a general case this makes the calculation an xor and multiply rather ++ // than a divide and multiply ++ if (zbe->geo.stripes > 1) ++ frame->linesize[3] = zbe->geo.stripe_is_yc ? zbe->geo.height_y + zbe->geo.height_c : zbe->geo.height_y; ++ ++ frame->data[0] = frame->buf[0]->data; ++ frame->data[1] = frame->data[0] + (zbe->geo.stripe_is_yc ? zbe->size_y : zbe->size_y * zbe->geo.stripes); ++ if (zbe->geo.planes_c > 1) ++ frame->data[2] = frame->data[1] + zbe->size_c; ++ ++ frame->extended_data = frame->data; ++ // Leave extended buf alone ++ } ++ ++ return 0; ++} ++ ++int av_rpi_zc_set_valid_frame(AVFrame * const frame) ++{ ++ ZcBufEnv * const zbe = pic_zbe_ptr(frame->buf[0]); ++ ++ if (zbe == NULL) ++ return AVERROR(EINVAL); ++ ++ zbe->is_valid = ZC_BUF_VALID; ++ pthread_cond_broadcast(&zbe->cond); ++ ++ return 0; ++} ++ ++int av_rpi_zc_set_broken_frame(AVFrame * const frame) ++{ ++ ZcBufEnv * const zbe = pic_zbe_ptr(frame->buf[0]); ++ ++ if (zbe == NULL) ++ return AVERROR(EINVAL); ++ ++ zbe->is_valid = ZC_BUF_NEVER; ++ pthread_cond_broadcast(&zbe->cond); ++ ++ return 0; ++} ++ ++void av_rpi_zc_set_decoder_pool_size(ZcEnv *const zc, const unsigned int pool_size) ++{ ++ zc->pool_size = pool_size; ++} ++ ++unsigned int av_rpi_zc_get_decoder_pool_size(ZcEnv *const zc) ++{ ++ return zc->pool_size; ++} ++ ++int av_rpi_zc_get_buffer(ZcEnv *const zc, AVFrame * const frame) ++{ ++#if 1 ++ ZcBufEnv * zbe = av_mallocz(sizeof(*zbe)); ++ ++ for (unsigned int i = 0; i < AV_NUM_DATA_POINTERS; i++) { ++ frame->buf[i] = NULL; ++ frame->data[i] = NULL; ++ frame->linesize[i] = 0; ++ } ++ ++ if (zbe == NULL) ++ return AVERROR(ENOMEM); ++ ++ if ((frame->buf[0] = av_buffer_create((uint8_t *)zbe, sizeof(*zbe), zc_buf_env_free_cb, zbe, 0)) == NULL) ++ { ++ av_free(zbe); ++ return AVERROR(ENOMEM); ++ } ++ ++ pthread_mutex_init(&zbe->lock, NULL); ++ pthread_cond_init(&zbe->cond, NULL); ++ zbe->zc = zc; ++ atomic_fetch_add(&zc->refcount, 1); ++ ++ zbe->geo = av_rpi_zc_frame_geometry(frame->format, frame->width, frame->height); // Note geometry for later use ++ zbe->size_y = zbe->geo.stride_y * zbe->geo.height_y; ++ zbe->size_c = zbe->geo.stride_c * zbe->geo.height_c; ++ zbe->size_pic = (zbe->size_y + zbe->size_c * zbe->geo.planes_c) * zbe->geo.stripes; ++ ++#else ++ const AVRpiZcFrameGeometry geo = av_rpi_zc_frame_geometry(frame->format, frame->width, frame->height); ++ const unsigned int size_y = geo.stride_y * geo.height_y; ++ const unsigned int size_c = geo.stride_c * geo.height_c; ++ const unsigned int size_pic = (size_y + size_c * geo.planes_c) * geo.stripes; ++ AVBufferRef * buf; ++ unsigned int i; ++ ++// printf("Do local alloc: format=%#x, %dx%d: %u\n", frame->format, frame->width, frame->height, size_pic); ++ ++ if ((buf = zc->alloc_buf(zc->pool_env, size_pic, &geo)) == NULL) ++ { ++ av_log(NULL, AV_LOG_ERROR, "rpi_get_display_buffer: Failed to get buffer from pool\n"); ++ return AVERROR(ENOMEM); ++ } ++ ++ // Track ++ atomic_fetch_add(&zc->refcount, 1); ++ pic_zbe_ptr(buf)->zc = zc; ++ ++ for (i = 0; i < AV_NUM_DATA_POINTERS; i++) { ++ frame->buf[i] = NULL; ++ frame->data[i] = NULL; ++ frame->linesize[i] = 0; ++ } ++ ++ frame->buf[0] = buf; ++ ++ frame->linesize[0] = geo.stride_y; ++ frame->linesize[1] = geo.stride_c; ++ frame->linesize[2] = geo.stride_c; ++ // abuse: linesize[3] = "stripe stride" ++ // stripe_stride is NOT the stride between slices it is (that / geo.stride_y). ++ // In a general case this makes the calculation an xor and multiply rather ++ // than a divide and multiply ++ if (geo.stripes > 1) ++ frame->linesize[3] = geo.stripe_is_yc ? geo.height_y + geo.height_c : geo.height_y; ++ ++ frame->data[0] = buf->data; ++ frame->data[1] = frame->data[0] + (geo.stripe_is_yc ? size_y : size_y * geo.stripes); ++ if (geo.planes_c > 1) ++ frame->data[2] = frame->data[1] + size_c; ++ ++ frame->extended_data = frame->data; ++ // Leave extended buf alone ++ ++#if RPI_ZC_SAND_8_IN_10_BUF != 0 ++ // *** If we intend to use this for real we will want a 2nd buffer pool ++ frame->buf[RPI_ZC_SAND_8_IN_10_BUF] = zc_pool_buf_alloc(&zc->pool, size_pic); // *** 2 * wanted size - kludge ++#endif ++#endif ++ ++ return 0; ++} ++ ++void av_rpi_zc_env_release(const AVZcEnvPtr zc) ++{ ++ const int n = atomic_fetch_add(&zc->refcount, -1); ++ if (n == 1) // was 1, now 0 ++ { ++ zc->free_pool(zc->pool_env); ++ av_free(zc); ++ } ++} ++ ++AVZcEnvPtr av_rpi_zc_env_alloc(void * logctx, ++ void * pool_env, ++ av_rpi_zc_alloc_buf_fn_t * alloc_buf_fn, ++ av_rpi_zc_free_pool_fn_t * free_pool_fn) ++{ ++ ZcEnv * zc; ++ ++ if ((zc = av_mallocz(sizeof(ZcEnv))) == NULL) ++ { ++ av_log(logctx, AV_LOG_ERROR, "av_rpi_zc_env_alloc: Context allocation failed\n"); ++ return NULL; ++ } ++ ++ *zc = (ZcEnv){ ++ .refcount = ATOMIC_VAR_INIT(1), ++ .pool_env = pool_env, ++ .alloc_buf = alloc_buf_fn, ++ .free_pool = free_pool_fn, ++ .pool_size = 0 ++ }; ++ ++ return zc; ++} ++ ++//============================================================================ ++// ++// External ZC initialisation ++ ++#define RPI_GET_BUFFER2 1 ++ ++ ++static int zc_get_buffer2(struct AVCodecContext *s, AVFrame *frame, int flags) ++{ ++#if !RPI_GET_BUFFER2 ++ return avcodec_default_get_buffer2(s, frame, flags); ++#else ++ int rv; ++ ++ if ((s->codec->capabilities & AV_CODEC_CAP_DR1) == 0) ++ { ++// printf("Do default alloc: format=%#x\n", frame->format); ++ rv = avcodec_default_get_buffer2(s, frame, flags); ++ } ++ else if (frame->format == AV_PIX_FMT_YUV420P || ++ av_rpi_is_sand_frame(frame)) ++ { ++ if ((rv = av_rpi_zc_get_buffer(s->opaque, frame)) == 0) ++ rv = av_rpi_zc_resolve_frame(frame, ZC_RESOLVE_ALLOC_VALID); ++ } ++ else ++ { ++ rv = avcodec_default_get_buffer2(s, frame, flags); ++ } ++ ++#if 0 ++ printf("%s: fmt:%d, %dx%d lsize=%d/%d/%d/%d data=%p/%p/%p bref=%p/%p/%p opaque[0]=%p\n", __func__, ++ frame->format, frame->width, frame->height, ++ frame->linesize[0], frame->linesize[1], frame->linesize[2], frame->linesize[3], ++ frame->data[0], frame->data[1], frame->data[2], ++ frame->buf[0], frame->buf[1], frame->buf[2], ++ av_buffer_get_opaque(frame->buf[0])); ++#endif ++ return rv; ++#endif ++} ++ ++int av_rpi_zc_in_use(const struct AVCodecContext * const s) ++{ ++ return s->get_buffer2 == zc_get_buffer2; ++} ++ ++int av_rpi_zc_init2(struct AVCodecContext * const s, ++ void * pool_env, ++ av_rpi_zc_alloc_buf_fn_t * alloc_buf_fn, ++ av_rpi_zc_free_pool_fn_t * free_pool_fn) ++{ ++ ZcEnv * zc; ++ ++ av_assert0(!av_rpi_zc_in_use(s)); ++ ++ if ((zc = av_rpi_zc_env_alloc(s, pool_env, alloc_buf_fn, free_pool_fn)) == NULL) ++ return AVERROR(ENOMEM); ++ ++ zc->old = (ZcOldCtxVals){ ++ .opaque = s->opaque, ++ .get_buffer2 = s->get_buffer2, ++ .thread_safe_callbacks = s->thread_safe_callbacks ++ }; ++ ++ s->opaque = zc; ++ s->get_buffer2 = zc_get_buffer2; ++ s->thread_safe_callbacks = 1; ++ return 0; ++} ++ ++void av_rpi_zc_uninit2(struct AVCodecContext * const s) ++{ ++ ZcEnv * const zc = s->opaque; ++ ++ av_assert0(av_rpi_zc_in_use(s)); ++ ++ s->get_buffer2 = zc->old.get_buffer2; ++ s->opaque = zc->old.opaque; ++ s->thread_safe_callbacks = zc->old.thread_safe_callbacks; ++ ++ av_rpi_zc_env_release(zc); ++} ++ +--- /dev/null ++++ b/libavcodec/rpi_zc.h +@@ -0,0 +1,228 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox ++*/ ++ ++#ifndef LIBAVCODEC_RPI_ZC_H ++#define LIBAVCODEC_RPI_ZC_H ++ ++// Zero-Copy frame code for RPi ++// RPi needs Y/U/V planes to be contiguous for display. By default ++// ffmpeg will allocate separated planes so a memcpy is needed before ++// display. This code provides a method a making ffmpeg allocate a single ++// bit of memory for the frame when can then be reference counted until ++// display has finished with it. ++ ++// Frame buffer number in which to stuff an 8-bit copy of a 16-bit frame ++// 0 disables ++// *** This option still in development ++// Only works if SAO active ++// Allocates buffers that are twice the required size ++#define RPI_ZC_SAND_8_IN_10_BUF 0 ++ ++struct AVBufferRef; ++struct AVFrame; ++struct AVCodecContext; ++enum AVPixelFormat; ++ ++// "Opaque" pointer to whatever we are using as a buffer reference ++typedef struct AVBufferRef * AVRpiZcRefPtr; ++ ++struct AVZcEnv; ++typedef struct AVZcEnv * AVZcEnvPtr; ++ ++typedef struct AVRpiZcFrameGeometry ++{ ++ unsigned int stride_y; // Luma stride (bytes) ++ unsigned int height_y; // Luma height (lines) ++ unsigned int stride_c; // Chroma stride (bytes) ++ unsigned int height_c; // Chroma stride (lines) ++ unsigned int planes_c; // Chroma plane count (U, V = 2, interleaved = 1) ++ unsigned int stripes; // Number of stripes (sand) ++ unsigned int bytes_per_pel; ++ int stripe_is_yc; // A single stripe is Y then C (false for tall sand) ++ ++ int format; // Requested format ++ unsigned int video_width; // Requested width ++ unsigned int video_height; // Requested height ++} AVRpiZcFrameGeometry; ++ ++// Get expected MMAL geometry for a given format, width & height ++AVRpiZcFrameGeometry av_rpi_zc_frame_geometry( ++ const int format, ++ const unsigned int video_width, const unsigned int video_height); ++ ++//---------------------------------------------------------------------------- ++// ++// Calls that extract info from a ZC frame whether internally or externally ++// allocated ++ ++// Generate a ZC reference to the buffer(s) in this frame ++// If the buffer doesn't appear to be one allocated by ZC ++// then the behaviour depends on maycopy: ++// If maycopy=0 then return NULL ++// If maycopy=1 && the src frame is in a form where we can easily copy ++// the data, then allocate a new buffer and copy the data into it ++// Otherwise return NULL ++// If maycopy == 0 then ZC may be NULL ++AVRpiZcRefPtr av_rpi_zc_ref(void * const logging_context, const AVZcEnvPtr zc, ++ const struct AVFrame * const frame, const enum AVPixelFormat expected_format, const int maycopy); ++ ++// Unreference the buffer refed/allocated by _zc_ref ++// If fr_ref is NULL then this will NOP ++void av_rpi_zc_unref(AVRpiZcRefPtr fr_ref); ++ ++// Get the vc_handle from the frame ref ++// Returns -1 if ref doesn't look valid ++int av_rpi_zc_vc_handle(const AVRpiZcRefPtr fr_ref); ++// Get the vcsm_handle from the frame ref ++// Returns 0 if ref doesn't look valid ++unsigned int av_rpi_zc_vcsm_handle(const AVRpiZcRefPtr fr_ref); ++// Get offset from the start of the memory referenced ++// by the vc_handle to valid data ++int av_rpi_zc_offset(const AVRpiZcRefPtr fr_ref); ++// Length of buffer data ++int av_rpi_zc_length(const AVRpiZcRefPtr fr_ref); ++// Get the number of bytes allocated from the frame ref ++// Returns 0 if ref doesn't look valid ++int av_rpi_zc_numbytes(const AVRpiZcRefPtr fr_ref); ++// Geometry this frame was allocated with ++const AVRpiZcFrameGeometry * av_rpi_zc_geometry(const AVRpiZcRefPtr fr_ref); ++ ++//---------------------------------------------------------------------------- ++// ++// Calls for external frame allocation ++ ++// Callbacks registered in av_rpi_zc_init2 ++ ++// Callback to allocate a buf for a frame ++// The frame itself is generated in the calling code ++// ++// Parameters: ++// pool_env value passed to av-rpi_zc_init2 ++// size size wanted ++// geo geometry of the frame to be allocated ++// Returns: ++// NULL Alloc failed ++// ptr AVBufferBuf* of allocated buffer ++// In most cases av_rpi_zc_buf will be called by this function ++// and this will be the buf returned by that. ++typedef AVBufferRef * av_rpi_zc_alloc_buf_fn_t(void * pool_env, size_t size, ++ const AVRpiZcFrameGeometry * geo); ++ ++// Callback once ffmpeg is completely done with this pool ++// Called once all allocated buffers have been derefed and ffmpegs ref to this ++// pool has been dropped ++typedef void av_rpi_zc_free_pool_fn_t(void * pool_env); ++ ++// Init ZC into a context ++// Sets opaque, get_buffer2, thread_safe_callbacks ++// Use if you want to allocate your own pools and/or create ZC buffers for ++// all decoders ++// RPI HEVC decoders will allocate appropriate VCSM buffers which can be taken ++// apart by av_rpi_zc_xxx calls without this ++int av_rpi_zc_init2(struct AVCodecContext * const s, ++ void * pool_env, av_rpi_zc_alloc_buf_fn_t * alloc_buf_fn, ++ av_rpi_zc_free_pool_fn_t * free_pool_fn); ++ ++// Free ZC from a context ++void av_rpi_zc_uninit2(struct AVCodecContext * const s); ++ ++// Get minimum pool size in frames - valid by the time the first alloc request ++// occurs. Takes into account thread requests and DPB sizes derived from SPS ++// rather than just adding a worst case DPB size. ++unsigned int av_rpi_zc_get_decoder_pool_size(const AVZcEnvPtr zc); ++ ++typedef struct av_rpi_zc_buf_fn_tab_s { ++ // This AVBuffer is being freed by ffmpeg - return memory ++ // to external pool. Memory may be, but need not be, unmapped. ++ // v is the ptr passed in av_rpi_zc_buf ++ void (* free)(void * v); ++ ++ // Return appropriate handles / mappings ++ // v is the ptr passed in av_rpi_zc_buf ++ unsigned int (* vcsm_handle)(void * v); ++ unsigned int (* vc_handle)(void * v); ++ void * (* map_arm)(void * v); ++ unsigned int (* map_vc)(void * v); ++} av_rpi_zc_buf_fn_tab_t; ++ ++// Allocate a ZC AVBufferRef and set its callback table ++// Doesn't take a buffer address directly - relies on callbacks to return ++// addresses as they are required. Mappings need not be generated until ++// the map callbacks are called but they should persist from then until ++// the buffer is freed. ++// ++// Parameters: ++// numbytes Size of the buffer ++// addr_offset Offset to first usable byte of buffer (for alignment) ++// normally 0 ++// v Pointer passed to callbacks ++// fn_tab Function table ++AVBufferRef * av_rpi_zc_buf(size_t numbytes, int addr_offset, void * v, const av_rpi_zc_buf_fn_tab_t * fn_tab); ++ ++// Get v ptr set in in av_rpi_zc_buf ++void * av_rpi_zc_buf_v(AVBufferRef * const buf); ++ ++//---------------------------------------------------------------------------- ++// ++// Mostly internal calls but might possibly be wanted by outside code ++ ++void av_rpi_zc_int_env_freep(AVZcEnvPtr * zc); ++AVZcEnvPtr av_rpi_zc_int_env_alloc(void * const logctx); ++void av_rpi_zc_set_decoder_pool_size(const AVZcEnvPtr zc, const unsigned int pool_size); ++ ++// Test to see if the context is using zc (checks get_buffer2) ++int av_rpi_zc_in_use(const struct AVCodecContext * const s); ++ ++// Get buffer generates placeholders for later alloc ++int av_rpi_zc_get_buffer(const AVZcEnvPtr zc, AVFrame * const frame); ++// Resolve actually does the alloc (noop if already alloced) ++// Set data pointers on a buffer/frame that was copied before the alloc ++// accured ++#define ZC_RESOLVE_FAIL 0 // return error on invalid ++#define ZC_RESOLVE_ALLOC 1 // alloc as invalid ++#define ZC_RESOLVE_WAIT_VALID 2 // wait for valid ++#define ZC_RESOLVE_ALLOC_VALID 3 // alloc as valid ++int av_rpi_zc_resolve_buffer(AVBufferRef * const buf, const int may_alloc); ++int av_rpi_zc_resolve_frame(AVFrame * const frame, const int may_alloc); ++ ++int av_rpi_zc_set_valid_frame(AVFrame * const frame); ++int av_rpi_zc_set_broken_frame(AVFrame * const frame); ++ ++ ++ ++ ++AVZcEnvPtr av_rpi_zc_env_alloc(void * logctx, ++ void * pool_env, ++ av_rpi_zc_alloc_buf_fn_t * alloc_buf_fn, ++ av_rpi_zc_free_pool_fn_t * free_pool_fn); ++void av_rpi_zc_env_release(const AVZcEnvPtr zc); ++ ++ ++#endif ++ +--- /dev/null ++++ b/libavcodec/rpi_zc_frames.h +@@ -0,0 +1,142 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox, Ben Avison ++*/ ++ ++#ifndef RPI_ZC_FRAMES_H ++#define RPI_ZC_FRAMES_H ++ ++#define RPI_ONE_BUF 1 ++ ++#include "rpi_mem.h" // for GPU_MEM_PTR_T ++#include "libavutil/frame.h" ++ ++#if !RPI_ONE_BUF ++static inline uint32_t get_vc_address_y(const AVFrame * const frame) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_buffer_get_opaque(frame->buf[0]); ++ return p->vc; ++} ++ ++static inline uint32_t get_vc_address_u(const AVFrame * const frame) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_buffer_get_opaque(frame->buf[1]); ++ return p->vc; ++} ++ ++static inline uint32_t get_vc_address_v(const AVFrame * const frame) { ++ GPU_MEM_PTR_T *p = av_buffer_pool_buffer_get_opaque(frame->buf[2]); ++ return p->vc; ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { ++ return *(GPU_MEM_PTR_T *)av_buffer_pool_buffer_get_opaque(frame->buf[0]); ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { ++ return *(GPU_MEM_PTR_T *)av_buffer_pool_buffer_get_opaque(frame->buf[1]); ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { ++ return *(GPU_MEM_PTR_T *)av_buffer_pool_buffer_get_opaque(frame->buf[2]); ++} ++ ++#else ++ ++static inline int gpu_is_buf1(const AVFrame * const frame) ++{ ++ return frame->buf[1] == NULL; ++} ++ ++static inline GPU_MEM_PTR_T * gpu_buf1_gmem(const AVFrame * const frame) ++{ ++ return av_buffer_get_opaque(frame->buf[0]); ++} ++ ++static inline GPU_MEM_PTR_T * gpu_buf3_gmem(const AVFrame * const frame, const unsigned int n) ++{ ++ return av_buffer_pool_buffer_get_opaque(frame->buf[n]); ++} ++ ++static inline uint32_t get_vc_address3(const AVFrame * const frame, const unsigned int n) ++{ ++ const GPU_MEM_PTR_T * const gm = gpu_is_buf1(frame) ? gpu_buf1_gmem(frame) : gpu_buf3_gmem(frame, n); ++ return gm->vc + (frame->data[n] - gm->arm); ++} ++ ++ ++static inline uint32_t get_vc_address_y(const AVFrame * const frame) { ++ return get_vc_address3(frame, 0); ++} ++ ++static inline uint32_t get_vc_address_u(const AVFrame * const frame) { ++ return get_vc_address3(frame, 1); ++} ++ ++static inline uint32_t get_vc_address_v(const AVFrame * const frame) { ++ return get_vc_address3(frame, 2); ++} ++ ++#if 0 ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_y(const AVFrame * const frame) { ++ if (gpu_is_buf1(frame)) ++ { ++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); ++ g.numbytes = frame->data[1] - frame->data[0]; ++ return g; ++ } ++ else ++ return *gpu_buf3_gmem(frame, 0); ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_u(const AVFrame * const frame) { ++ if (gpu_is_buf1(frame)) ++ { ++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); ++ g.arm += frame->data[1] - frame->data[0]; ++ g.vc += frame->data[1] - frame->data[0]; ++ g.numbytes = frame->data[2] - frame->data[1]; // chroma size ++ return g; ++ } ++ else ++ return *gpu_buf3_gmem(frame, 1); ++} ++ ++static inline GPU_MEM_PTR_T get_gpu_mem_ptr_v(const AVFrame * const frame) { ++ if (gpu_is_buf1(frame)) ++ { ++ GPU_MEM_PTR_T g = *gpu_buf1_gmem(frame); ++ g.arm += frame->data[2] - frame->data[0]; ++ g.vc += frame->data[2] - frame->data[0]; ++ g.numbytes = frame->data[2] - frame->data[1]; // chroma size ++ return g; ++ } ++ else ++ return *gpu_buf3_gmem(frame, 2); ++} ++#endif ++#endif ++ ++#endif +--- /dev/null ++++ b/libavcodec/rpivid_hevc.c +@@ -0,0 +1,2128 @@ ++// FFMPEG HEVC decoder hardware accelerator ++// Andrew Holme, Argon Design Ltd ++// Copyright (c) June 2017 Raspberry Pi Ltd ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "fftools/ffmpeg.h" ++#include "libavutil/avassert.h" ++#include "libavutil/imgutils.h" ++#include "avcodec.h" ++#include "hwconfig.h" ++#include "decode.h" ++ ++#include "hevc.h" ++#include "hevcdec.h" ++#include "rpi_zc.h" ++#include "rpi_mem.h" ++#include "rpi_zc_frames.h" ++#include "rpi_mailbox.h" ++ ++ ++#define OPT_PHASE_TIMING 0 // Generate stats for phase usage ++ ++#define OPT_EMU 0 ++ ++#define TRACE_DEV 0 ++#define TRACE_ENTRY 0 ++ ++#define NUM_SCALING_FACTORS 4064 ++ ++#define AXI_BASE64 0 ++ ++#define PROB_BACKUP ((20<<12) + (20<<6) + (0<<0)) ++#define PROB_RELOAD ((20<<12) + (20<<0) + (0<<6)) ++ ++#define RPIVID_COL_PICS 17 // 16 ref & current ++ ++#define RPIVID_BITBUFS 2 // Bit + Cmd bufs (phase 0 & 1) ++#define RPIVID_BITBUF_SIZE (4 << 20) // Bit + Cmd buf size ++ ++#define RPIVID_COEFFBUFS 3 // PU + Coeff bufs (phase 1 & 2) ++#define RPIVID_COEFFBUF_SIZE (16 << 20) // PU + Coeff buf size ++ ++////////////////////////////////////////////////////////////////////////////// ++// ++// Register offsets ++ ++#define RPI_SPS0 0 ++#define RPI_SPS1 4 ++#define RPI_PPS 8 ++#define RPI_SLICE 12 ++#define RPI_TILESTART 16 ++#define RPI_TILEEND 20 ++#define RPI_SLICESTART 24 ++#define RPI_MODE 28 ++#define RPI_LEFT0 32 ++#define RPI_LEFT1 36 ++#define RPI_LEFT2 40 ++#define RPI_LEFT3 44 ++#define RPI_QP 48 ++#define RPI_CONTROL 52 ++#define RPI_STATUS 56 ++#define RPI_VERSION 60 ++#define RPI_BFBASE 64 ++#define RPI_BFNUM 68 ++#define RPI_BFCONTROL 72 ++#define RPI_BFSTATUS 76 ++#define RPI_PUWBASE 80 ++#define RPI_PUWSTRIDE 84 ++#define RPI_COEFFWBASE 88 ++#define RPI_COEFFWSTRIDE 92 ++#define RPI_SLICECMDS 96 ++#define RPI_BEGINTILEEND 100 ++#define RPI_TRANSFER 104 ++#define RPI_CFBASE 108 ++#define RPI_CFNUM 112 ++#define RPI_CFSTATUS 116 ++ ++#define RPI_PURBASE 0x8000 ++#define RPI_PURSTRIDE 0x8004 ++#define RPI_COEFFRBASE 0x8008 ++#define RPI_COEFFRSTRIDE 0x800C ++#define RPI_NUMROWS 0x8010 ++#define RPI_CONFIG2 0x8014 ++#define RPI_OUTYBASE 0x8018 ++#define RPI_OUTYSTRIDE 0x801C ++#define RPI_OUTCBASE 0x8020 ++#define RPI_OUTCSTRIDE 0x8024 ++#define RPI_STATUS2 0x8028 ++#define RPI_FRAMESIZE 0x802C ++#define RPI_MVBASE 0x8030 ++#define RPI_MVSTRIDE 0x8034 ++#define RPI_COLBASE 0x8038 ++#define RPI_COLSTRIDE 0x803C ++#define RPI_CURRPOC 0x8040 ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++// Unused but left here to illustrate the diffrences between FFmpegs prob ++// structure and the rpivid one ++ ++struct FFM_PROB { ++ uint8_t sao_merge_flag [ 1]; ++ uint8_t sao_type_idx [ 1]; ++ uint8_t split_coding_unit_flag [ 3]; ++ uint8_t cu_transquant_bypass_flag [ 1]; ++ uint8_t skip_flag [ 3]; ++ uint8_t cu_qp_delta [ 3]; ++ uint8_t pred_mode_flag [ 1]; ++ uint8_t part_mode [ 4]; ++ uint8_t prev_intra_luma_pred_flag [ 1]; ++ uint8_t intra_chroma_pred_mode [ 2]; ++ uint8_t merge_flag [ 1]; ++ uint8_t merge_idx [ 1]; ++ uint8_t inter_pred_idc [ 5]; ++ uint8_t ref_idx_l0 [ 2]; ++ uint8_t ref_idx_l1 [ 2]; ++ uint8_t abs_mvd_greater0_flag [ 2]; ++ uint8_t abs_mvd_greater1_flag [ 2]; ++ uint8_t mvp_lx_flag [ 1]; ++ uint8_t no_residual_data_flag [ 1]; ++ uint8_t split_transform_flag [ 3]; ++ uint8_t cbf_luma [ 2]; ++ uint8_t cbf_cb_cr [ 4]; ++ uint8_t transform_skip_flag/*[][]*/ [ 2]; ++ uint8_t explicit_rdpcm_flag/*[][]*/ [ 2]; ++ uint8_t explicit_rdpcm_dir_flag/*[][]*/ [ 2]; ++ uint8_t last_significant_coeff_x_prefix [18]; ++ uint8_t last_significant_coeff_y_prefix [18]; ++ uint8_t significant_coeff_group_flag [ 4]; ++ uint8_t significant_coeff_flag [44]; ++ uint8_t coeff_abs_level_greater1_flag [24]; ++ uint8_t coeff_abs_level_greater2_flag [ 6]; ++ uint8_t log2_res_scale_abs [ 8]; ++ uint8_t res_scale_sign_flag [ 2]; ++ uint8_t cu_chroma_qp_offset_flag [ 1]; ++ uint8_t cu_chroma_qp_offset_idx [ 1]; ++} __attribute__((packed)); ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++struct RPI_PROB { ++ uint8_t SAO_MERGE_FLAG [ 1]; ++ uint8_t SAO_TYPE_IDX [ 1]; ++ uint8_t SPLIT_FLAG [ 3]; ++ uint8_t CU_SKIP_FLAG [ 3]; ++ uint8_t CU_TRANSQUANT_BYPASS_FLAG [ 1]; ++ uint8_t PRED_MODE [ 1]; ++ uint8_t PART_SIZE [ 4]; ++ uint8_t INTRA_PRED_MODE [ 1]; ++ uint8_t CHROMA_PRED_MODE [ 1]; ++ uint8_t MERGE_FLAG_EXT [ 1]; ++ uint8_t MERGE_IDX_EXT [ 1]; ++ uint8_t INTER_DIR [ 5]; ++ uint8_t REF_PIC [ 2]; ++ uint8_t MVP_IDX [ 1]; ++ uint8_t MVD [ 2]; ++ uint8_t QT_ROOT_CBF [ 1]; ++ uint8_t TRANS_SUBDIV_FLAG [ 3]; ++ uint8_t QT_CBF [ 6]; ++ uint8_t DQP [ 2]; ++ uint8_t ONE_FLAG [24]; ++ uint8_t LASTX [18]; ++ uint8_t LASTY [18]; ++ uint8_t SIG_CG_FLAG [ 4]; ++ uint8_t ABS_FLAG [ 6]; ++ uint8_t TRANSFORMSKIP_FLAG [ 2]; ++ uint8_t SIG_FLAG [42]; ++ uint8_t SIG_FLAG_unused [ 2]; ++} __attribute__((packed)); ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++struct RPI_CMD { ++ uint32_t addr; ++ uint32_t data; ++} __attribute__((packed)); ++ ++struct RPI_BIT { ++ int cmd; ++ const void *ptr; ++ int len; ++}; ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++struct RPI_T; ++ ++// Actual addressability is 38bits but we can only alloc in the bottom 32 ++// currently - when passed to rpivid h/w the address is always >> 6 so will ++// fit in 32 bit there ++// At some point we may weant to make this uint64_t ++typedef uint32_t vid_vc_addr_t; ++ ++typedef enum rpivid_decode_state_e { ++ RPIVID_DECODE_NEW = 0, ++ RPIVID_DECODE_START, ++ RPIVID_DECODE_SLICE, ++ RPIVID_DECODE_END, ++} rpivid_decode_state_t; ++ ++#define RPI_PROB_VALS 154U ++#define RPI_PROB_ARRAY_SIZE ((154 + 3) & ~3) ++ ++typedef struct dec_env_s { ++ const AVCodecContext * avctx; ++ ++ rpivid_decode_state_t state; ++ unsigned int decode_order; ++ ++ int phase_no; // Current phase (i.e. the last one we waited for) ++ struct dec_env_s * phase_wait_q_next; ++ sem_t phase_wait; ++ ++ struct RPI_BIT *bit_fifo; ++ struct RPI_CMD *cmd_fifo; ++ unsigned int bit_len, bit_max; ++ unsigned int cmd_len, cmd_max; ++ unsigned int num_slice_msgs; ++ unsigned int PicWidthInCtbsY; ++ unsigned int PicHeightInCtbsY; ++ unsigned int dpbno_col; ++ uint32_t reg_slicestart; ++ unsigned int wpp_entry_x; ++ unsigned int wpp_entry_y; ++ ++ const uint8_t * nal_buffer; ++ size_t nal_size; ++ ++ uint16_t slice_msgs[2*HEVC_MAX_REFS*8+3]; ++ uint8_t scaling_factors[NUM_SCALING_FACTORS]; ++// unsigned int RefPicList[2][HEVC_MAX_REFS]; ++} dec_env_t; ++ ++#define RPIVID_PHASES 3 ++#define RPIVID_PHASE_NEW (RPIVID_PHASES) // Phase before we have inced decode order ++#define RPIVID_PHASE_START (-1) // Phase after we have inced decode_order ++ ++#if OPT_PHASE_TIMING ++static const unsigned int time_thresholds[8] = { ++ 10, 15, 20, 30, 45, 60, 75, 90 ++}; ++#endif ++ ++typedef struct phase_wait_env_s { ++ unsigned int last_order; ++ dec_env_t * q; ++#if OPT_PHASE_TIMING ++ uint64_t phase_time; ++ uint64_t max_phase_time; ++ uint64_t time_in_phase; ++ uint64_t time_out_phase; ++ unsigned int max_time_decode_order; ++ unsigned int time_bins[9]; ++ unsigned int time_bins3[9]; ++ unsigned int time_bins5[9]; ++ uint64_t time_stash[16]; ++ unsigned int i3; ++#endif ++} phase_wait_env_t; // Single linked list of threads waiting for this phase ++ ++typedef struct RPI_T { ++ atomic_int ref_count; ++ sem_t ref_zero; ++ ++ dec_env_t ** dec_envs; ++ AVZcEnvPtr zc; ++ ++ pthread_mutex_t phase_lock; ++ phase_wait_env_t phase_reqs[RPIVID_PHASES]; ++ ++ volatile uint32_t * regs; ++ volatile uint32_t * ints; ++ ++ GPU_MEM_PTR_T gcolbuf; ++ unsigned int col_stride; ++ size_t col_picsize; ++ ++ unsigned int bitbuf_no; ++ sem_t bitbuf_sem; ++ GPU_MEM_PTR_T gbitbufs[RPIVID_BITBUFS]; ++ ++ unsigned int max_pu_msgs; ++ unsigned int coeffbuf_no; ++ sem_t coeffbuf_sem; ++ GPU_MEM_PTR_T gcoeffbufs[RPIVID_COEFFBUFS]; ++ ++ unsigned int decode_order; ++ int mbox_fd; ++ int gpu_init_type; ++} RPI_T; ++ ++#if OPT_PHASE_TIMING ++static uint64_t tus64(void) ++{ ++ struct timespec ts; ++ clock_gettime(CLOCK_MONOTONIC, &ts); ++ return (uint64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; ++} ++#endif ++ ++static inline unsigned int rnd64(unsigned int x) ++{ ++ return (x + 63) & ~63; ++} ++ ++static inline int rpi_sem_wait(sem_t * const sem) ++{ ++ int rv; ++ while ((rv = sem_wait(sem)) != 0 && errno == EINTR) ++ /* Loop */; ++ return rv; ++} ++ ++//============================================================================ ++ ++#define REGS_NAME "/dev/rpivid-hevcmem" ++#define REGS_SIZE 0x10000 ++#define INTS_NAME "/dev/rpivid-intcmem" ++#define INTS_SIZE 0x10000 // 4 is probably enough but we are going to alloc a page anyway ++ ++static volatile uint32_t * map_dev(AVCodecContext * const avctx, const char * const dev_name, size_t size) ++{ ++ void *gpio_map; ++ int mem_fd; ++ ++ /* open /dev/mem */ ++ if ((mem_fd = open(dev_name, O_RDWR|O_SYNC) ) < 0) { ++ av_log(avctx, AV_LOG_WARNING, "can't open %s\n", dev_name); ++ return NULL; ++ } ++ ++ // Now map it ++ gpio_map = mmap( ++ NULL, ++ size, ++ PROT_READ|PROT_WRITE, ++ MAP_SHARED, ++ mem_fd, ++ 0 ++ ); ++ ++ close(mem_fd); // No longer need the FD ++ ++ if (gpio_map == MAP_FAILED) { ++ av_log(avctx, AV_LOG_WARNING, "GPIO mapping failed"); ++ return NULL; ++ } ++ ++ return (volatile uint32_t *)gpio_map; ++} ++ ++static void unmap_devp(volatile uint32_t ** const p_gpio_map, size_t size) ++{ ++ volatile uint32_t * const gpio_map = *p_gpio_map; ++ if (gpio_map != NULL) { ++ *p_gpio_map = NULL; ++ munmap((void *)gpio_map, size); ++ } ++} ++ ++#define MANGLE(x) ((x) &~0xc0000000) // ** If x is ever a 64 bit thing this will need fixing! ++#define MANGLE64(x) (uint32_t)(MANGLE(x)>>6) ++ ++static inline void apb_write_vc_addr(const RPI_T *const rpi, const uint32_t addr, const vid_vc_addr_t data) ++{ ++#if TRACE_DEV ++ printf("W %x %08x\n", addr, MANGLE64(data)); ++#endif ++ ++ rpi->regs[addr >> 2] = MANGLE64(data); ++} ++ ++static inline void apb_write_vc_len(const RPI_T *const rpi, const uint32_t addr, const unsigned int data) ++{ ++#if TRACE_DEV ++ printf("W %x %08x\n", addr, data >> 6); ++#endif ++ ++ rpi->regs[addr >> 2] = data >> 6; // ?? rnd64 - but not currently needed ++} ++ ++static inline void apb_write(const RPI_T * const rpi, const uint32_t addr, const uint32_t data) ++{ ++#if TRACE_DEV ++ printf("W %x %08x\n", addr, data); ++#endif ++ ++ rpi->regs[addr >> 2] = data; ++} ++ ++static inline uint32_t apb_read(const RPI_T * const rpi, const uint32_t addr) ++{ ++ const uint32_t v = rpi->regs[addr >> 2]; ++#if TRACE_DEV ++ printf("R %x (=%x)\n", addr, v); ++#endif ++ return v; ++} ++ ++#define ARG_IC_ICTRL_ACTIVE1_INT_SET 0x00000001 ++#define ARG_IC_ICTRL_ACTIVE1_EDGE_SET 0x00000002 ++#define ARG_IC_ICTRL_ACTIVE1_EN_SET 0x00000004 ++#define ARG_IC_ICTRL_ACTIVE1_STATUS_SET 0x00000008 ++#define ARG_IC_ICTRL_ACTIVE2_INT_SET 0x00000010 ++#define ARG_IC_ICTRL_ACTIVE2_EDGE_SET 0x00000020 ++#define ARG_IC_ICTRL_ACTIVE2_EN_SET 0x00000040 ++#define ARG_IC_ICTRL_ACTIVE2_STATUS_SET 0x00000080 ++ ++static inline void int_wait(const RPI_T * const rpi, const unsigned int phase) ++{ ++ const uint32_t mask_reset = phase == 1 ? ~ARG_IC_ICTRL_ACTIVE2_INT_SET : ~ARG_IC_ICTRL_ACTIVE1_INT_SET; ++ const uint32_t mask_done = phase == 1 ? ARG_IC_ICTRL_ACTIVE1_INT_SET : ARG_IC_ICTRL_ACTIVE2_INT_SET; ++ uint32_t ival; ++ while (((ival = rpi->ints[0]) & mask_done) == 0) { ++ usleep(1000); ++ } ++ rpi->ints[0] = ival & mask_reset; ++} ++ ++#if TRACE_DEV && 0 ++static void apb_dump_regs(const RPI_T * const rpi, uint16_t addr, int num) { ++ int i; ++ ++ for (i=0; iregs[(addr>>2)+i]); ++ ++ if ((i%4)==3 || i+1 == num) ++ printf("\n"); ++ else ++ printf(" "); ++ } ++} ++ ++static void axi_dump(const dec_env_t * const de, uint64_t addr, uint32_t size) { ++ int i; ++ ++ for (i=0; i>2; i++) ++ { ++ if ((i%4)==0) ++ printf("%08x: ", MANGLE(de->gbuf.vc) + (uint32_t)addr + 4*i); ++ ++ printf("%08x", ((uint32_t*)de->gbuf.arm)[(addr>>2)+i]); ++ ++ if ((i%4)==3 || i+1 == size>>2) ++ printf("\n"); ++ else ++ printf(" "); ++ } ++} ++#endif ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++static inline size_t round_up_size(const size_t x) ++{ ++ /* Admit no size < 256 */ ++ const unsigned int n = x < 256 ? 8 : av_log2(x) - 1; ++ ++ return x >= (3 << n) ? 4 << n : (3 << n); ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Scaling factors ++ ++static void expand_scaling_list( ++ const unsigned int sizeID, ++ const unsigned int matrixID, ++ uint8_t * const dst0, ++ const uint8_t * const src0, ++ uint8_t dc) ++{ ++ switch (sizeID) { ++ case 0: ++ memcpy(dst0, src0, 16); ++ break; ++ case 1: ++ memcpy(dst0, src0, 64); ++ break; ++ case 2: ++ { ++ uint8_t * d = dst0; ++ for (unsigned int y=0; y != 16; y++) { ++ const uint8_t * s = src0 + (y >> 1) * 8; ++ for (unsigned int x = 0; x != 8; ++x) { ++ *d++ = *s; ++ *d++ = *s++; ++ } ++ } ++ dst0[0] = dc; ++ break; ++ } ++ default: ++ { ++ uint8_t * d = dst0; ++ for (unsigned int y=0; y != 32; y++) { ++ const uint8_t * s = src0 + (y >> 2) * 8; ++ for (unsigned int x = 0; x != 8; ++x) { ++ *d++ = *s; ++ *d++ = *s; ++ *d++ = *s; ++ *d++ = *s++; ++ } ++ } ++ dst0[0] = dc; ++ break; ++ } ++ } ++} ++ ++static void populate_scaling_factors(dec_env_t * const de, const HEVCContext * const s) { ++ // Array of constants for scaling factors ++ static const uint32_t scaling_factor_offsets[4][6] = { ++ // MID0 MID1 MID2 MID3 MID4 MID5 ++ {0x0000, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050}, // SID0 (4x4) ++ {0x0060, 0x00A0, 0x00E0, 0x0120, 0x0160, 0x01A0}, // SID1 (8x8) ++ {0x01E0, 0x02E0, 0x03E0, 0x04E0, 0x05E0, 0x06E0}, // SID2 (16x16) ++ {0x07E0, 0, 0, 0x0BE0, 0, 0}}; // SID3 (32x32) ++ ++ // ffmpeg places SID3,MID1 where matrixID 3 normally is ++ const ScalingList * const sl = ++ s->ps.pps->scaling_list_data_present_flag ? &s->ps.pps->scaling_list ++ : &s->ps.sps->scaling_list; ++ unsigned int mid; ++ ++ for (mid=0; mid<6; mid++) ++ expand_scaling_list(0, mid, ++ de->scaling_factors + scaling_factor_offsets[0][mid], ++ sl->sl[0][mid], 0); ++ for (mid=0; mid<6; mid++) ++ expand_scaling_list(1, mid, ++ de->scaling_factors + scaling_factor_offsets[1][mid], ++ sl->sl[1][mid], 0); ++ for (mid=0; mid<6; mid++) ++ expand_scaling_list(2, mid, ++ de->scaling_factors + scaling_factor_offsets[2][mid], ++ sl->sl[2][mid], ++ sl->sl_dc[0][mid]); ++ // second scaling matrix for 32x32 is at matrixID 3 not 1 in ffmpeg ++ for (mid=0; mid<6; mid += 3) ++ expand_scaling_list(3, mid, ++ de->scaling_factors + scaling_factor_offsets[3][mid], ++ sl->sl[3][mid], ++ sl->sl_dc[1][mid]); ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Probabilities ++ ++static const uint8_t prob_init[3][156] = { ++ { ++ 153, 200, 139, 141, 157, 154, 154, 154, ++ 154, 154, 184, 154, 154, 154, 184, 63, ++ 154, 154, 154, 154, 154, 154, 154, 154, ++ 154, 154, 154, 154, 154, 153, 138, 138, ++ 111, 141, 94, 138, 182, 154, 154, 154, ++ 140, 92, 137, 138, 140, 152, 138, 139, ++ 153, 74, 149, 92, 139, 107, 122, 152, ++ 140, 179, 166, 182, 140, 227, 122, 197, ++ 110, 110, 124, 125, 140, 153, 125, 127, ++ 140, 109, 111, 143, 127, 111, 79, 108, ++ 123, 63, 110, 110, 124, 125, 140, 153, ++ 125, 127, 140, 109, 111, 143, 127, 111, ++ 79, 108, 123, 63, 91, 171, 134, 141, ++ 138, 153, 136, 167, 152, 152, 139, 139, ++ 111, 111, 125, 110, 110, 94, 124, 108, ++ 124, 107, 125, 141, 179, 153, 125, 107, ++ 125, 141, 179, 153, 125, 107, 125, 141, ++ 179, 153, 125, 140, 139, 182, 182, 152, ++ 136, 152, 136, 153, 136, 139, 111, 136, ++ 139, 111, 0, 0, }, ++ { ++ 153, 185, 107, 139, 126, 197, 185, 201, ++ 154, 149, 154, 139, 154, 154, 154, 152, ++ 110, 122, 95, 79, 63, 31, 31, 153, ++ 153, 168, 140, 198, 79, 124, 138, 94, ++ 153, 111, 149, 107, 167, 154, 154, 154, ++ 154, 196, 196, 167, 154, 152, 167, 182, ++ 182, 134, 149, 136, 153, 121, 136, 137, ++ 169, 194, 166, 167, 154, 167, 137, 182, ++ 125, 110, 94, 110, 95, 79, 125, 111, ++ 110, 78, 110, 111, 111, 95, 94, 108, ++ 123, 108, 125, 110, 94, 110, 95, 79, ++ 125, 111, 110, 78, 110, 111, 111, 95, ++ 94, 108, 123, 108, 121, 140, 61, 154, ++ 107, 167, 91, 122, 107, 167, 139, 139, ++ 155, 154, 139, 153, 139, 123, 123, 63, ++ 153, 166, 183, 140, 136, 153, 154, 166, ++ 183, 140, 136, 153, 154, 166, 183, 140, ++ 136, 153, 154, 170, 153, 123, 123, 107, ++ 121, 107, 121, 167, 151, 183, 140, 151, ++ 183, 140, 0, 0, }, ++ { ++ 153, 160, 107, 139, 126, 197, 185, 201, ++ 154, 134, 154, 139, 154, 154, 183, 152, ++ 154, 137, 95, 79, 63, 31, 31, 153, ++ 153, 168, 169, 198, 79, 224, 167, 122, ++ 153, 111, 149, 92, 167, 154, 154, 154, ++ 154, 196, 167, 167, 154, 152, 167, 182, ++ 182, 134, 149, 136, 153, 121, 136, 122, ++ 169, 208, 166, 167, 154, 152, 167, 182, ++ 125, 110, 124, 110, 95, 94, 125, 111, ++ 111, 79, 125, 126, 111, 111, 79, 108, ++ 123, 93, 125, 110, 124, 110, 95, 94, ++ 125, 111, 111, 79, 125, 126, 111, 111, ++ 79, 108, 123, 93, 121, 140, 61, 154, ++ 107, 167, 91, 107, 107, 167, 139, 139, ++ 170, 154, 139, 153, 139, 123, 123, 63, ++ 124, 166, 183, 140, 136, 153, 154, 166, ++ 183, 140, 136, 153, 154, 166, 183, 140, ++ 136, 153, 154, 170, 153, 138, 138, 122, ++ 121, 122, 121, 167, 151, 183, 140, 151, ++ 183, 140, 0, 0, }, ++}; ++ ++ ++////////////////////////////////////////////////////////////////////////////// ++// Phase 1 command and bit FIFOs ++ ++// ???? uint16_t addr - put in uint32_t ++static int p1_apb_write(dec_env_t * const de, const uint16_t addr, const uint32_t data) { ++ if (de->cmd_len==de->cmd_max) ++ av_assert0(de->cmd_fifo = realloc(de->cmd_fifo, (de->cmd_max*=2)*sizeof(struct RPI_CMD))); ++ ++#if TRACE_DEV ++ printf("[%02x] %x %x\n", de->cmd_len, addr, data); ++#endif ++ ++ de->cmd_fifo[de->cmd_len].addr = addr; ++ de->cmd_fifo[de->cmd_len].data = data; ++ return de->cmd_len++; ++} ++ ++static void p1_axi_write(dec_env_t * const de, const uint32_t len, const void * const ptr, const int cmd_idx) { ++ if (de->bit_len==de->bit_max) ++ av_assert0(de->bit_fifo = realloc(de->bit_fifo, (de->bit_max*=2)*sizeof(struct RPI_BIT))); ++ de->bit_fifo[de->bit_len].cmd = cmd_idx; ++ de->bit_fifo[de->bit_len].ptr = ptr; ++ de->bit_fifo[de->bit_len].len = len; ++ de->bit_len++; ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Write probability and scaling factor memories ++ ++#if 0 ++static void WriteProb(dec_env_t * const de) { ++ int i; ++ const uint8_t *p = (uint8_t *) &de->probabilities; ++ for (i=0; ish.cabac_init_flag && s->sh.slice_type != HEVC_SLICE_I) ? ++ s->sh.slice_type + 1 : 2 - s->sh.slice_type; ++ const uint8_t * p = prob_init[init_type]; ++ const int q = av_clip(s->sh.slice_qp, 0, 51); ++ unsigned int i; ++ ++ for (i = 0; i < RPI_PROB_VALS; i++) { ++ int init_value = p[i]; ++ int m = (init_value >> 4) * 5 - 45; ++ int n = ((init_value & 15) << 3) - 16; ++ int pre = 2 * (((m * q) >> 4) + n) - 127; ++ ++ pre ^= pre >> 31; ++ if (pre > 124) ++ pre = 124 + (pre & 1); ++ dst[i] = pre; ++ } ++ for (i = RPI_PROB_VALS; i != RPI_PROB_ARRAY_SIZE; ++i) { ++ dst[i] = 0; ++ } ++ ++ for (i=0; i < RPI_PROB_ARRAY_SIZE; i+=4) ++ p1_apb_write(de, 0x1000+i, dst[i] + (dst[i+1]<<8) + (dst[i+2]<<16) + (dst[i+3]<<24)); ++ ++} ++ ++ ++static void WriteScalingFactors(dec_env_t * const de) { ++ int i; ++ const uint8_t *p = (uint8_t *) de->scaling_factors; ++ for (i=0; i= bd[i]; i++); // bd[] has num+1 elements; bd[0]=0; see hevc_ps.c ++ return i-1; ++} ++ ++static int ctb_to_slice_w_h (unsigned int ctb, int ctb_size, int width, unsigned int *bd, int num) { ++ if (ctb < bd[num-1]) return ctb_size; ++ else if (width % ctb_size) return width % ctb_size; ++ else return ctb_size; ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Handle PU and COEFF stream overflow ++ ++ ++// Returns: ++// -2 Other error ++// -1 Out of coeff space ++// 0 OK ++// 1 Out of PU space ++ ++static int check_status(const RPI_T * const rpi, dec_env_t * const de) { ++ uint32_t status; ++ ++ // this is the definition of successful completion of phase 1 ++ // it assures that status register is zero and all blocks in each tile have completed ++ if (apb_read(rpi, RPI_CFSTATUS) == apb_read(rpi, RPI_CFNUM)) ++ return 0; ++ ++ status = apb_read(rpi, RPI_STATUS); ++ ++ if ((status & 8) != 0) ++ return -1; ++ ++ if ((status & 0x10) != 0) ++ return 1; ++ ++ return -2; ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Write STATUS register with expected end CTU address of previous slice ++ ++static void end_previous_slice(dec_env_t * const de, const HEVCContext * const s, const int ctb_addr_ts) { ++ const HEVCPPS * const pps = s->ps.pps; ++ int last_x = pps->ctb_addr_ts_to_rs[ctb_addr_ts-1] % de->PicWidthInCtbsY; ++ int last_y = pps->ctb_addr_ts_to_rs[ctb_addr_ts-1] / de->PicWidthInCtbsY; ++ p1_apb_write(de, RPI_STATUS, 1 + (last_x<<5) + (last_y<<18)); ++} ++ ++static void wpp_pause(dec_env_t * const de, int ctb_row) { ++ p1_apb_write(de, RPI_STATUS, (ctb_row<<18) + 0x25); ++ p1_apb_write(de, RPI_TRANSFER, PROB_BACKUP); ++ p1_apb_write(de, RPI_MODE, ctb_row==de->PicHeightInCtbsY-1 ? 0x70000 : 0x30000); ++ p1_apb_write(de, RPI_CONTROL, (ctb_row<<16) + 2); ++} ++ ++static void wpp_end_previous_slice(dec_env_t * const de, const HEVCContext * const s, int ctb_addr_ts) { ++ const HEVCPPS *pps = s->ps.pps; ++ int new_x = s->sh.slice_ctb_addr_rs % de->PicWidthInCtbsY; ++ int new_y = s->sh.slice_ctb_addr_rs / de->PicWidthInCtbsY; ++ int last_x = pps->ctb_addr_ts_to_rs[ctb_addr_ts-1] % de->PicWidthInCtbsY; ++ int last_y = pps->ctb_addr_ts_to_rs[ctb_addr_ts-1] / de->PicWidthInCtbsY; ++ if (de->wpp_entry_x<2 && (de->wpp_entry_y2) && de->PicWidthInCtbsY>2) ++ wpp_pause(de, last_y); ++ p1_apb_write(de, RPI_STATUS, 1 + (last_x<<5) + (last_y<<18)); ++ if (new_x==2 || de->PicWidthInCtbsY==2 && de->wpp_entry_yps.sps; ++ const HEVCPPS *pps = s->ps.pps; ++ ++ p1_apb_write(de, RPI_SPS0, ++ (sps->log2_min_cb_size << 0) + ++ (sps->log2_ctb_size << 4) + ++ (sps->log2_min_tb_size << 8) + ++ (sps->log2_max_trafo_size << 12) + ++ (sps->bit_depth << 16) + ++ (sps->bit_depth << 20) + ++ (sps->max_transform_hierarchy_depth_intra << 24) + ++ (sps->max_transform_hierarchy_depth_inter << 28)); ++ ++ p1_apb_write(de, RPI_SPS1, ++ (sps->pcm.bit_depth << 0) + ++ (sps->pcm.bit_depth_chroma << 4) + ++ (sps->pcm.log2_min_pcm_cb_size << 8) + ++ (sps->pcm.log2_max_pcm_cb_size << 12) + ++ (sps->separate_colour_plane_flag? 0:sps->chroma_format_idc << 16) + ++ (sps->amp_enabled_flag << 18) + ++ (sps->pcm_enabled_flag << 19) + ++ (sps->scaling_list_enable_flag << 20) + ++ (sps->sps_strong_intra_smoothing_enable_flag << 21)); ++ ++ p1_apb_write(de, RPI_PPS, ++ (sps->log2_ctb_size - pps->diff_cu_qp_delta_depth << 0) + ++ (pps->cu_qp_delta_enabled_flag << 4) + ++ (pps->transquant_bypass_enable_flag << 5) + ++ (pps->transform_skip_enabled_flag << 6) + ++ (pps->sign_data_hiding_flag << 7) + ++ (((pps->cb_qp_offset + s->sh.slice_cb_qp_offset)&255) << 8) + ++ (((pps->cr_qp_offset + s->sh.slice_cr_qp_offset)&255) << 16) + ++ (pps->constrained_intra_pred_flag << 24)); ++ ++ if (s->ps.sps->scaling_list_enable_flag) WriteScalingFactors(de); ++ ++ if (!s->sh.dependent_slice_segment_flag) { ++ int ctb_col = s->sh.slice_ctb_addr_rs % de->PicWidthInCtbsY; ++ int ctb_row = s->sh.slice_ctb_addr_rs / de->PicWidthInCtbsY; ++ de->reg_slicestart = (ctb_col<<0) + (ctb_row<<16); ++ } ++ ++ p1_apb_write(de, RPI_SLICESTART, de->reg_slicestart); ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++static void write_slice(dec_env_t * const de, const HEVCContext * const s, ++ const unsigned int slice_w, const unsigned int slice_h) { ++ uint32_t u32 = ++ (s->sh.slice_type << 12) ++ + (s->sh.slice_sample_adaptive_offset_flag[0] << 14) ++ + (s->sh.slice_sample_adaptive_offset_flag[1] << 15) ++ + (slice_w << 17) ++ + (slice_h << 24); ++ ++ if (s->sh.slice_type==HEVC_SLICE_B || s->sh.slice_type==HEVC_SLICE_P) u32 |= ++ (s->sh.max_num_merge_cand << 0) ++ + (s->sh.nb_refs[L0] << 4) ++ + (s->sh.nb_refs[L1] << 8); ++ ++ if (s->sh.slice_type==HEVC_SLICE_B) ++ u32 |= s->sh.mvd_l1_zero_flag<<16; ++ p1_apb_write(de, RPI_SLICE, u32); ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Wavefront mode ++ ++static void wpp_entry_point(dec_env_t * const de, const HEVCContext * const s, ++ const int do_bte, const int resetQPY, const int ctb_addr_ts) { ++ const HEVCSPS * const sps = s->ps.sps; ++ const HEVCPPS * const pps = s->ps.pps; ++ ++ int ctb_size = 1<log2_ctb_size; ++ int ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts]; ++ ++ int ctb_col = de->wpp_entry_x = ctb_addr_rs % de->PicWidthInCtbsY; ++ int ctb_row = de->wpp_entry_y = ctb_addr_rs / de->PicWidthInCtbsY; ++ ++ int endx = de->PicWidthInCtbsY-1; ++ int endy = ctb_row; ++ ++ uint8_t slice_w = ctb_to_slice_w_h(ctb_col, ctb_size, sps->width, pps->col_bd, pps->num_tile_columns); ++ uint8_t slice_h = ctb_to_slice_w_h(ctb_row, ctb_size, sps->height, pps->row_bd, pps->num_tile_rows); ++ ++ p1_apb_write(de, RPI_TILESTART, 0); ++ p1_apb_write(de, RPI_TILEEND, endx + (endy<<16)); ++ ++ if (do_bte) ++ p1_apb_write(de, RPI_BEGINTILEEND, endx + (endy<<16)); ++ ++ write_slice(de, s, slice_w, ctb_row==de->PicHeightInCtbsY-1? slice_h : ctb_size); ++ ++ if (resetQPY) p1_apb_write(de, RPI_QP, sps->qp_bd_offset + s->sh.slice_qp); ++ ++ p1_apb_write(de, RPI_MODE, ctb_row==de->PicHeightInCtbsY-1? 0x60001 : 0x20001); ++ p1_apb_write(de, RPI_CONTROL, (ctb_col<<0) + (ctb_row<<16)); ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Tiles mode ++ ++static void new_entry_point(dec_env_t * const de, const HEVCContext * const s, ++ const int do_bte, const int resetQPY, const int ctb_addr_ts) { ++ const HEVCSPS * const sps = s->ps.sps; ++ const HEVCPPS * const pps = s->ps.pps; ++ ++ int ctb_col = pps->ctb_addr_ts_to_rs[ctb_addr_ts] % de->PicWidthInCtbsY; ++ int ctb_row = pps->ctb_addr_ts_to_rs[ctb_addr_ts] / de->PicWidthInCtbsY; ++ ++ int tile_x = ctb_to_tile (ctb_col, pps->col_bd, pps->num_tile_columns); ++ int tile_y = ctb_to_tile (ctb_row, pps->row_bd, pps->num_tile_rows); ++ ++ int endx = pps->col_bd[tile_x+1] - 1; ++ int endy = pps->row_bd[tile_y+1] - 1; ++ ++ uint8_t slice_w = ctb_to_slice_w_h(ctb_col, 1<log2_ctb_size, sps->width, pps->col_bd, pps->num_tile_columns); ++ uint8_t slice_h = ctb_to_slice_w_h(ctb_row, 1<log2_ctb_size, sps->height, pps->row_bd, pps->num_tile_rows); ++ ++ p1_apb_write(de, RPI_TILESTART, pps->col_bd[tile_x] + (pps->row_bd[tile_y]<<16)); ++ p1_apb_write(de, RPI_TILEEND, endx + (endy<<16)); ++ ++ if (do_bte) ++ p1_apb_write(de, RPI_BEGINTILEEND, endx + (endy<<16)); ++ ++ write_slice(de, s, slice_w, slice_h); ++ ++ if (resetQPY) ++ p1_apb_write(de, RPI_QP, sps->qp_bd_offset + s->sh.slice_qp); ++ ++ p1_apb_write(de, RPI_MODE, (0xFFFF << 0) ++ + (0x0 << 16) ++ + ((tile_x==pps->num_tile_columns-1) << 17) ++ + ((tile_y==pps->num_tile_rows-1) << 18)); ++ ++ p1_apb_write(de, RPI_CONTROL, (ctb_col<<0) + (ctb_row<<16)); ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++// Doesn't attempt to remove from context as we should only do this at the end ++// of time or on create error ++static void ++dec_env_delete(dec_env_t * const de) ++{ ++// gpu_free(&de->gbuf); ++ ++ av_freep(&de->cmd_fifo); ++ av_freep(&de->bit_fifo); ++ ++ sem_destroy(&de->phase_wait); ++ av_free(de); ++} ++ ++static dec_env_t * ++dec_env_new(AVCodecContext * const avctx, RPI_T * const rpi) ++{ ++ dec_env_t * const de = av_mallocz(sizeof(*de)); ++ int i; ++ ++ if (de == NULL) ++ return NULL; ++ ++ de->avctx = avctx; ++ de->phase_no = RPIVID_PHASE_NEW; ++ ++ sem_init(&de->phase_wait, 0, 0); ++ ++ if ((de->cmd_fifo = malloc((de->cmd_max=1024)*sizeof(struct RPI_CMD))) == NULL) ++ goto fail; ++ ++ if ((de->bit_fifo = malloc((de->bit_max=1024)*sizeof(struct RPI_BIT))) == NULL) ++ goto fail; ++ ++ pthread_mutex_lock(&rpi->phase_lock); // Abuse - not worth creating a lock just for this ++ for (i = 0; i != avctx->thread_count; ++i) { ++ if (rpi->dec_envs[i] == NULL) ++ { ++ rpi->dec_envs[i] = de; ++ break; ++ } ++ } ++ pthread_mutex_unlock(&rpi->phase_lock); ++ ++ if (i == avctx->thread_count) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to find a slot for hw thread context\n"); ++ goto fail; ++ } ++ ++ return de; ++ ++fail: ++ dec_env_delete(de); ++ return NULL; ++} ++ ++ ++static dec_env_t * ++dec_env_get(AVCodecContext * const avctx, RPI_T * const rpi) ++{ ++ dec_env_t * de = NULL; ++ const int ref_count = atomic_fetch_add(&rpi->ref_count, 1); ++ ++ if (ref_count <= 0) { ++ // Already dead ++ av_log(avctx, AV_LOG_ERROR, "RPIVID called whilst dead\n");; ++ return NULL; ++ } ++ ++ for (int i = 0; i != avctx->thread_count; ++i) { ++ if (rpi->dec_envs[i] == NULL) ++ { ++ de = dec_env_new(avctx, rpi); ++ break; ++ } ++ if (rpi->dec_envs[i]->avctx == avctx) ++ { ++ de = rpi->dec_envs[i]; ++ break; ++ } ++ } ++ return de; ++} ++ ++// Call at end of fn ++// Used to ensure we aren't in a worker thead when killed ++static void ++dec_env_release(RPI_T * const rpi, dec_env_t * const de) ++{ ++ const int n = atomic_fetch_sub(&rpi->ref_count, 1); ++ if (n == 1) { ++ sem_post(&rpi->ref_zero); ++ } ++} ++ ++//---------------------------------------------------------------------------- ++ ++// Wait for a slot in the given phase ++// Any error return is probably fatal ++static int ++wait_phase(RPI_T * const rpi, dec_env_t * const de, const int phase_no) ++{ ++ int needs_wait = 0; ++ phase_wait_env_t *const p = rpi->phase_reqs + phase_no; ++ ++ pthread_mutex_lock(&rpi->phase_lock); ++ if (p->last_order + 1 != de->decode_order) { ++ de->phase_wait_q_next = p->q; ++ p->q = de; ++ needs_wait = 1; ++ } ++ pthread_mutex_unlock(&rpi->phase_lock); ++ ++ if (needs_wait) { ++ while (sem_wait(&de->phase_wait) == -1) ++ { ++ int err; ++ if ((err = errno) != EINTR) ++ return AVERROR(err); ++ } ++ } ++ ++ de->phase_no = phase_no; ++ return 0; ++} ++ ++static void ++post_phase(RPI_T * const rpi, dec_env_t * const de, const int phase_no) ++{ ++ dec_env_t * next_de = NULL; ++ phase_wait_env_t *const p = rpi->phase_reqs + phase_no; ++ dec_env_t ** q = &p->q; ++ ++ pthread_mutex_lock(&rpi->phase_lock); ++ ++ p->last_order = de->decode_order; ++ while (*q != NULL) { ++ dec_env_t * const t_de = *q; ++ ++ if (t_de->decode_order == p->last_order + 1) { ++ // This is us - remove from Q ++ *q = t_de->phase_wait_q_next; ++ t_de->phase_wait_q_next = NULL; // Tidy ++ next_de = t_de; ++ break; ++ } ++ q = &t_de->phase_wait_q_next; ++ } ++ ++ pthread_mutex_unlock(&rpi->phase_lock); ++ ++ if (next_de != NULL) ++ sem_post(&next_de->phase_wait); ++} ++ ++// Wait & signal stuff s.t. threads in other phases can continue ++static void ++abort_phases(RPI_T * const rpi, dec_env_t * const de) ++{ ++ for (int i = de->phase_no + 1; i < RPIVID_PHASE_NEW; ++i) { ++ wait_phase(rpi, de, i); ++ post_phase(rpi, de, i); ++ } ++ de->phase_no = RPIVID_PHASE_NEW; ++} ++ ++// Start timing for phase ++// Stats only - no actual effect ++static inline void tstart_phase(RPI_T * const rpi, const int phase_no) ++{ ++#if OPT_PHASE_TIMING ++ phase_wait_env_t *const p = rpi->phase_reqs + phase_no; ++ const int64_t now = tus64(); ++ if (p->phase_time != 0) ++ p->time_out_phase += now - p->phase_time; ++ p->phase_time = now; ++#endif ++} ++ ++#if OPT_PHASE_TIMING ++static unsigned int tavg_bin_phase(phase_wait_env_t *const p, const unsigned int avg_n) ++{ ++ uint64_t tsum = 0; ++ unsigned int i; ++ for (i = 0; i != avg_n; ++i) ++ tsum += p->time_stash[(p->i3 - i) & 15]; ++ for (i = 0; i != 9; ++i) { ++ if (time_thresholds[i] * 1000 * avg_n > tsum) ++ break; ++ } ++ return i; ++} ++#endif ++ ++// End timing for phase ++// Stats only - no actual effect ++static inline void tend_phase(RPI_T * const rpi, const int phase_no) ++{ ++#if OPT_PHASE_TIMING ++ phase_wait_env_t *const p = rpi->phase_reqs + phase_no; ++ const uint64_t now = tus64(); ++ const uint64_t in_time = now - p->phase_time; ++ ++ p->time_in_phase += in_time; ++ p->phase_time = now; ++ p->time_stash[p->i3] = in_time; ++ if (in_time > p->max_phase_time) { ++ p->max_phase_time = in_time; ++ p->max_time_decode_order = p->last_order; ++ } ++ ++p->time_bins[tavg_bin_phase(p, 1)]; ++ ++p->time_bins3[tavg_bin_phase(p, 3)]; ++ ++p->time_bins5[tavg_bin_phase(p, 5)]; ++ ++ p->i3 = (p->i3 + 1) & 15; ++#endif ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Start frame ++ ++static int rpi_hevc_start_frame( ++ AVCodecContext * avctx, ++ const uint8_t *buffer, ++ uint32_t size) { ++ ++ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; ++ dec_env_t * const de = dec_env_get(avctx, rpi); ++ const HEVCContext * const s = avctx->priv_data; ++ const HEVCSPS * const sps = s->ps.sps; ++ const unsigned int CtbSizeY = 1U << sps->log2_ctb_size; ++ ++#if TRACE_ENTRY ++ printf("<<< %s[%p]\n", __func__, de); ++#endif ++ ++ if (de == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Cannot find find context for thread\n", __func__); ++ return -1; ++ } ++ ++ de->phase_no = RPIVID_PHASE_START; ++ de->decode_order = ++rpi->decode_order; // *** atomic? ++ ++ ff_thread_finish_setup(avctx); // Allow next thread to enter rpi_hevc_start_frame ++ ++ if (de->state != RPIVID_DECODE_NEW && de->state != RPIVID_DECODE_END) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected state transition: %d", __func__, de->state); ++ return -1; ++ } ++ de->state = RPIVID_DECODE_START; ++ ++ de->PicWidthInCtbsY = (sps->width + CtbSizeY - 1) / CtbSizeY; //7-15 ++ de->PicHeightInCtbsY = (sps->height + CtbSizeY - 1) / CtbSizeY; //7-17 ++ de->bit_len = 0; ++ de->cmd_len = 0; ++ ++#if TRACE_ENTRY ++ printf(">>> %s[%p]\n", __func__, de); ++#endif ++ ++ dec_env_release(rpi, de); ++ return 0; ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Slice messages ++ ++static void msg_slice(dec_env_t * const de, const uint16_t msg) { ++ de->slice_msgs[de->num_slice_msgs++] = msg; ++} ++ ++static void program_slicecmds(dec_env_t * const de, const int sliceid) { ++ int i; ++ p1_apb_write(de, RPI_SLICECMDS, de->num_slice_msgs+(sliceid<<8)); ++ for(i=0; i < de->num_slice_msgs; i++) { ++ p1_apb_write(de, 0x4000+4*i, de->slice_msgs[i] & 0xffff); ++ } ++} ++ ++static void pre_slice_decode(dec_env_t * const de, const HEVCContext * const s) { ++ const HEVCSPS * const sps = s->ps.sps; ++ const HEVCPPS * const pps = s->ps.pps; ++ const SliceHeader *sh = &s->sh; ++ ++ int weightedPredFlag, i, rIdx; ++ uint16_t cmd_slice; ++ unsigned int collocated_from_l0_flag; ++ ++ de->num_slice_msgs=0; ++ de->dpbno_col = 0; ++ cmd_slice = 0; ++ if (sh->slice_type==HEVC_SLICE_I) cmd_slice = 1; ++ if (sh->slice_type==HEVC_SLICE_P) cmd_slice = 2; ++ if (sh->slice_type==HEVC_SLICE_B) cmd_slice = 3; ++ ++ if (sh->slice_type!=HEVC_SLICE_I) { ++ cmd_slice += sh->nb_refs[L0]<<2; ++ cmd_slice += sh->nb_refs[L1]<<6; ++ } ++ ++ if (sh->slice_type==HEVC_SLICE_P || sh->slice_type==HEVC_SLICE_B) ++ cmd_slice |= sh->max_num_merge_cand<<11; ++ ++ collocated_from_l0_flag = ++ !sh->slice_temporal_mvp_enabled_flag ? ++ 0 : ++ sh->slice_type == HEVC_SLICE_B ? ++ (sh->collocated_list == L0) : ++ (sh->slice_type==HEVC_SLICE_P); ++ cmd_slice |= collocated_from_l0_flag<<14; ++ ++ if (sh->slice_type==HEVC_SLICE_P || sh->slice_type==HEVC_SLICE_B) { ++ ++ int NoBackwardPredFlag = 1; // Flag to say all reference pictures are from the past ++ for(i=L0; i<=L1; i++) { ++ for(rIdx=0; rIdx nb_refs[i]; rIdx++) { ++ HEVCFrame *f = s->ref->refPicList[i].ref[rIdx]; ++ HEVCFrame *c = s->ref; // CurrentPicture ++ if (c->poc < f->poc) NoBackwardPredFlag = 0; ++ } ++ } ++ ++ if (sps->sps_temporal_mvp_enabled_flag) ++ { ++ const RefPicList *rpl = (sh->slice_type != HEVC_SLICE_B || collocated_from_l0_flag) ? ++ s->ref->refPicList + 0 : ++ s->ref->refPicList + 1; ++ de->dpbno_col = rpl->ref[sh->collocated_ref_idx] - s->DPB; ++ } ++ ++ cmd_slice += NoBackwardPredFlag<<10; ++ msg_slice(de, cmd_slice); ++ ++ // Write reference picture descriptions ++ weightedPredFlag = sh->slice_type==HEVC_SLICE_P? pps->weighted_pred_flag : pps->weighted_bipred_flag; ++ ++ for(i=L0; i<=L1; i++) ++ for(rIdx=0; rIdx nb_refs[i]; rIdx++) { ++ HEVCFrame *f = s->ref->refPicList[i].ref[rIdx]; ++ HEVCFrame *c = s->ref; // CurrentPicture ++ int pic = f - s->DPB; ++ // Make sure pictures are in range 0 to 15 ++ int adjusted_pic = fref->refPicList[i].isLongTerm[rIdx]; ++ msg_slice(de, adjusted_pic+(lt<<4)+(weightedPredFlag<<5)+(weightedPredFlag<<6)); ++ msg_slice(de, f->poc); ++ if (weightedPredFlag) { ++ msg_slice(de, s->sh.luma_log2_weight_denom+(((i?s-> sh.luma_weight_l1: s->sh.luma_weight_l0)[rIdx] &0x1ff)<<3)); ++ msg_slice(de, (i?s-> sh.luma_offset_l1: s->sh.luma_offset_l0)[rIdx] & 0xff); ++ msg_slice(de, s->sh.chroma_log2_weight_denom+(((i?s->sh.chroma_weight_l1:s->sh.chroma_weight_l0)[rIdx][0]&0x1ff)<<3)); ++ msg_slice(de, (i?s->sh.chroma_offset_l1:s->sh.chroma_offset_l0)[rIdx][0]& 0xff); ++ msg_slice(de, s->sh.chroma_log2_weight_denom+(((i?s->sh.chroma_weight_l1:s->sh.chroma_weight_l0)[rIdx][1]&0x1ff)<<3)); ++ msg_slice(de, (i?s->sh.chroma_offset_l1:s->sh.chroma_offset_l0)[rIdx][1]& 0xff); ++ } ++ } ++ } ++ else ++ msg_slice(de, cmd_slice); ++ ++ msg_slice(de, ((sh->beta_offset/2)&15) ++ + (((sh->tc_offset/2)&15) << 4) ++ + (sh->disable_deblocking_filter_flag << 8) ++ + (sh->slice_loop_filter_across_slices_enabled_flag << 9) ++ + (pps->loop_filter_across_tiles_enabled_flag << 10)); // CMD_DEBLOCK ++ ++ msg_slice(de, ((sh->slice_cr_qp_offset&31)<<5) + (sh->slice_cb_qp_offset&31)); // CMD_QPOFF ++} ++ ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++static void rpi_hevc_abort_frame(AVCodecContext * const avctx) { ++ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; ++ dec_env_t * const de = dec_env_get(avctx, rpi); ++ ++#if TRACE_ENTRY ++ printf("<<< %s[%p]\n", __func__, de); ++#endif ++ ++ if (de == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Cannot find find context for thread\n", __func__); ++ return; ++ } ++ ++ switch (de->state) { ++ case RPIVID_DECODE_NEW: ++ case RPIVID_DECODE_END: ++ // Expected transition ++ break; ++ ++ case RPIVID_DECODE_SLICE: ++ // Error transition ++ av_log(avctx, AV_LOG_INFO, "Error in decode - aborting\n"); ++ break; ++ ++ case RPIVID_DECODE_START: ++ default: ++ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected state transition: %d", __func__, de->state); ++ break; ++ } ++ ++ abort_phases(rpi, de); ++ de->state = RPIVID_DECODE_NEW; ++ ++ dec_env_release(rpi, de); ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// End frame ++ ++static int rpi_hevc_end_frame(AVCodecContext * const avctx) { ++ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; ++ const HEVCContext * const s = avctx->priv_data; ++ const HEVCPPS * const pps = s->ps.pps; ++ const HEVCSPS * const sps = s->ps.sps; ++ dec_env_t * const de = dec_env_get(avctx, rpi); ++ AVFrame * const f = s->ref->frame; ++ const unsigned int dpbno_cur = s->ref - s->DPB; ++ vid_vc_addr_t cmds_vc; ++ vid_vc_addr_t pu_base_vc; ++ unsigned int pu_stride; ++ vid_vc_addr_t coeff_base_vc; ++ unsigned int coeff_stride; ++ unsigned int i; ++ int rv = 0; ++ int status = 0; ++ int coeffbuf_sem_claimed = 0; ++ ++#if TRACE_ENTRY ++ fprintf("<<< %s[%p]\n", __func__, de); ++#endif ++ ++ if (de == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Cannot find find context for thread\n", __func__); ++ return AVERROR_BUG; // Should never happen ++ } ++ ++ if (de->state != RPIVID_DECODE_SLICE) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected state: %d\n", __func__, de->state); ++ rv = AVERROR_UNKNOWN; ++ goto fail; ++ } ++ de->state = RPIVID_DECODE_END; ++ ++ // End of command compilation ++ { ++ const unsigned int last_x = pps->col_bd[pps->num_tile_columns]-1; ++ const unsigned int last_y = pps->row_bd[pps->num_tile_rows]-1; ++ if (pps->entropy_coding_sync_enabled_flag) { ++ if (de->wpp_entry_x<2 && de->PicWidthInCtbsY>2) ++ wpp_pause(de, last_y); ++ } ++ p1_apb_write(de, RPI_STATUS, 1 + (last_x<<5) + (last_y<<18)); ++ } ++ ++ // Phase 0 --------------------------------------------------------------- ++ ++ wait_phase(rpi, de, 0); ++ rpi_sem_wait(&rpi->bitbuf_sem); ++ tstart_phase(rpi, 0); ++ ++ // Copy cmds & bits into gpu side buffer ++ // Layout: CMDS, BITS ++ { ++ uint8_t * const armbase = rpi->gbitbufs[rpi->bitbuf_no].arm; ++ vid_vc_addr_t vcbase = rpi->gbitbufs[rpi->bitbuf_no].vc; ++ unsigned int cmd_bytes = de->cmd_len * sizeof(struct RPI_CMD); ++ ++ uint8_t * p = armbase + rnd64(cmd_bytes); ++ uint8_t * const eobits = armbase + rpi->gbitbufs[rpi->bitbuf_no].numbytes; ++ ++ cmds_vc = vcbase; ++ ++ // Copy all the bits & update bitstream cmds to point at the right bits ++ for (i = 0; i < de->bit_len; ++i) ++ { ++ const unsigned int seg_len = de->bit_fifo[i].len; ++ ++ if (p + seg_len > eobits) { ++ status = -1; ++ break; ++ } ++ ++ memcpy(p, de->bit_fifo[i].ptr, seg_len); ++ de->cmd_fifo[de->bit_fifo[i].cmd].data = MANGLE64((p - armbase) + vcbase); ++ ++ p += rnd64(seg_len); ++ } ++ ++ memcpy(armbase, de->cmd_fifo, cmd_bytes); ++ } ++ ++ if (status == 0) ++ { ++ if (++rpi->bitbuf_no >= RPIVID_BITBUFS) ++ rpi->bitbuf_no = 0; ++ } ++ else ++ { ++ sem_post(&rpi->bitbuf_sem); ++ av_log(avctx, AV_LOG_ERROR, "Out of HEVC bit/cmd memory\n"); ++ rv = AVERROR_BUFFER_TOO_SMALL; ++ } ++ ++ tend_phase(rpi, 0); ++ post_phase(rpi, de, 0); ++ ++ if (status < 0) ++ goto fail; ++ ++ // Phase 1 --------------------------------------------------------------- ++ ++ wait_phase(rpi, de, 1); ++ rpi_sem_wait(&rpi->coeffbuf_sem); ++ coeffbuf_sem_claimed = 1; ++ tstart_phase(rpi, 1); ++ ++ status = 0; ++ for (;;) ++ { ++ // (Re-)allocate PU/COEFF stream space ++ const unsigned int total_size = rpi->gcoeffbufs[rpi->coeffbuf_no].numbytes; ++ unsigned int pu_size; ++ ++ pu_base_vc = rpi->gcoeffbufs[rpi->coeffbuf_no].vc; ++ pu_stride = rnd64(rpi->max_pu_msgs * 2 * de->PicWidthInCtbsY); ++ pu_size = pu_stride * de->PicHeightInCtbsY; ++ ++ if (pu_size >= total_size || status == -1) { ++ GPU_MEM_PTR_T newbuf; ++ ++ if (gpu_malloc_uncached(round_up_size(total_size + 1), &newbuf) != 0) ++ { ++ av_log(avctx, AV_LOG_ERROR, "Failed to reallocate coeffbuf\n"); ++ status = -1; ++ break; ++ } ++ gpu_free(rpi->gcoeffbufs + rpi->coeffbuf_no); ++ rpi->gcoeffbufs[rpi->coeffbuf_no] = newbuf; ++ status = 0; ++ continue; ++ } ++ ++ // Allocate all remaining space to coeff ++ coeff_base_vc = pu_base_vc + pu_size; ++ coeff_stride = ((total_size - pu_size) / de->PicHeightInCtbsY) & ~63; // Round down to multiple of 64 ++ ++ apb_write_vc_addr(rpi, RPI_PUWBASE, pu_base_vc); ++ apb_write_vc_len(rpi, RPI_PUWSTRIDE, pu_stride); ++ apb_write_vc_addr(rpi, RPI_COEFFWBASE, coeff_base_vc); ++ apb_write_vc_len(rpi, RPI_COEFFWSTRIDE, coeff_stride); ++ ++ // Trigger command FIFO ++ apb_write(rpi, RPI_CFNUM, de->cmd_len); ++#if TRACE_DEV && 0 ++ apb_dump_regs(rpi, 0x0, 32); ++ apb_dump_regs(rpi, 0x8000, 24); ++ axi_dump(de, ((uint64_t)a64)<<6, de->cmd_len * sizeof(struct RPI_CMD)); ++#endif ++ apb_write_vc_addr(rpi, RPI_CFBASE, cmds_vc); ++ ++ int_wait(rpi, 1); ++ ++ status = check_status(rpi, de); ++ ++ if (status == -1) ++ continue; ++ else if (status != 1) ++ break; ++ ++ // Status 1 means out of PU space so try again with more ++ // If we ran out of Coeff space then we are out of memory - we could possibly realloc? ++ rpi->max_pu_msgs += rpi->max_pu_msgs / 2; ++ } ++ ++ // Inc inside the phase 1 lock, but only inc if we succeeded otherwise we ++ // may reuse a live buffer when we kick the coeff sem ++ if (status == 0) ++ { ++ if (++rpi->coeffbuf_no >= RPIVID_COEFFBUFS) ++ rpi->coeffbuf_no = 0; ++ } ++ else ++ { ++ if (status == -1) ++ { ++ av_log(avctx, AV_LOG_ERROR, "Out of pu + coeff intermediate memory: pus=%d\n", rpi->max_pu_msgs); ++ rv = AVERROR_BUFFER_TOO_SMALL; ++ } ++ else ++ { ++ av_log(avctx, AV_LOG_WARNING, "Phase 1 decode error\n"); ++ rv = AVERROR_INVALIDDATA; ++ } ++ } ++ ++ tend_phase(rpi, 1); ++ sem_post(&rpi->bitbuf_sem); ++ post_phase(rpi, de, 1); ++ ++ if (status != 0) ++ goto fail; ++ ++ // Phase 2 --------------------------------------------------------------- ++ ++ wait_phase(rpi, de, 2); ++ ++ if ((rv = av_rpi_zc_resolve_frame(f, ZC_RESOLVE_ALLOC)) != 0) ++ { ++ // As we are in phase 2 already here we don't need to worry about ++ // ceoffbuf_no despite the early exit ++ post_phase(rpi, de, 2); ++ av_log(avctx, AV_LOG_ERROR, "Failed to allocate output frame\n"); ++ goto fail; ++ } ++ ++ tstart_phase(rpi, 2); ++ ++ apb_write_vc_addr(rpi, RPI_PURBASE, pu_base_vc); ++ apb_write_vc_len(rpi, RPI_PURSTRIDE, pu_stride); ++ apb_write_vc_addr(rpi, RPI_COEFFRBASE, coeff_base_vc); ++ apb_write_vc_len(rpi, RPI_COEFFRSTRIDE, coeff_stride); ++ ++ apb_write_vc_addr(rpi, RPI_OUTYBASE, get_vc_address_y(f)); ++ apb_write_vc_addr(rpi, RPI_OUTCBASE, get_vc_address_u(f)); ++ apb_write_vc_len(rpi, RPI_OUTYSTRIDE, f->linesize[3] * 128); ++ apb_write_vc_len(rpi, RPI_OUTCSTRIDE, f->linesize[3] * 128); ++ ++ // Keep the last thing we resolved as fallback for any ref we fail to ++ // resolve. As a final fallback use our current frame. The pels might ++ // not be there yet but at least the memory is valid. ++ // ++ // Attempt to resolve the entire DPB - we could note what we have used ++ // in ref lists but probably simpler and more reliable to set the whole thing ++ { ++ AVFrame * fallback_frame = f; ++ for (i = 0; i != 16; ++i) { ++ // Avoid current frame ++ const HEVCFrame * hevc_fr = (s->DPB + i >= s->ref) ? s->DPB + i + 1 : s->DPB + i; ++ AVFrame * fr = hevc_fr->frame; ++ ++ if (fr != NULL && ++ av_rpi_zc_resolve_frame(fr, ZC_RESOLVE_FAIL) == 0) ++ { ++ fallback_frame = fr; ++ } ++ else ++ { ++ fr = fallback_frame; ++ } ++ ++ apb_write_vc_addr(rpi, 0x9000+16*i, get_vc_address_y(fr)); ++ apb_write(rpi, 0x9004+16*i, 0); ++ apb_write_vc_addr(rpi, 0x9008+16*i, get_vc_address_u(fr)); ++ apb_write(rpi, 0x900C+16*i, 0); ++ } ++ } ++ ++ apb_write(rpi, RPI_CONFIG2, ++ (sps->bit_depth << 0) // BitDepthY ++ + (sps->bit_depth << 4) // BitDepthC ++ + ((sps->bit_depth>8) << 8) // BitDepthY ++ + ((sps->bit_depth>8) << 9) // BitDepthC ++ + (sps->log2_ctb_size <<10) ++ + (pps->constrained_intra_pred_flag <<13) ++ + (sps->sps_strong_intra_smoothing_enable_flag<<14) ++ + (sps->sps_temporal_mvp_enabled_flag <<15) ++ + (pps->log2_parallel_merge_level <<16) ++ + (s->sh.slice_temporal_mvp_enabled_flag <<19) ++ + (sps->pcm.loop_filter_disable_flag <<20) ++ + ((pps->cb_qp_offset&31) <<21) ++ + ((pps->cr_qp_offset&31) <<26)); ++ ++ apb_write(rpi, RPI_FRAMESIZE, (sps->height<<16) + sps->width); ++ apb_write(rpi, RPI_CURRPOC, s->poc); ++ ++ // collocated reads/writes ++ if (sps->sps_temporal_mvp_enabled_flag) { ++ av_assert0(de->dpbno_col < RPIVID_COL_PICS); ++ av_assert0(dpbno_cur < RPIVID_COL_PICS); ++ ++ apb_write_vc_len(rpi, RPI_COLSTRIDE, rpi->col_stride); ++ apb_write_vc_len(rpi, RPI_MVSTRIDE, rpi->col_stride); ++ apb_write_vc_addr(rpi, RPI_MVBASE, rpi->gcolbuf.vc + dpbno_cur * rpi->col_picsize); ++ apb_write_vc_addr(rpi, RPI_COLBASE, rpi->gcolbuf.vc + de->dpbno_col * rpi->col_picsize); ++ } ++ ++#if TRACE_DEV && 0 ++ apb_dump_regs(rpi, 0x0, 32); ++ apb_dump_regs(rpi, 0x8000, 24); ++#endif ++ ++ apb_write(rpi, RPI_NUMROWS, de->PicHeightInCtbsY); ++ apb_read(rpi, RPI_NUMROWS); // Read back to confirm write has reached block ++ ++ int_wait(rpi, 2); ++ ++ tend_phase(rpi, 2); ++ coeffbuf_sem_claimed = 0; ++ sem_post(&rpi->coeffbuf_sem); ++ // Set valid here to avoid race in resolving in any pending phase 2 ++ av_rpi_zc_set_valid_frame(f); ++ ++ post_phase(rpi, de, 2); ++ ++ // Flush frame for CPU access ++ // Arguably the best place would be at the start of phase 2 but here ++ // will overlap with the wait ++ // ++ // * Even better would be to have better lock/unlock control in ZC for external access ++ if (rpi->gpu_init_type == GPU_INIT_GPU) // * CMA is currently always uncached ++ { ++ rpi_cache_buf_t cbuf; ++ rpi_cache_flush_env_t * const fe = rpi_cache_flush_init(&cbuf); ++ rpi_cache_flush_add_frame(fe, f, RPI_CACHE_FLUSH_MODE_INVALIDATE); ++ rpi_cache_flush_finish(fe); ++ } ++ ++#if TRACE_ENTRY ++ printf(">>> %s[%p] OK\n", __func__, de); ++#endif ++ ++ dec_env_release(rpi, de); ++ return 0; ++ ++fail: ++ av_rpi_zc_set_broken_frame(f); ++ if (coeffbuf_sem_claimed) ++ sem_post(&rpi->coeffbuf_sem); ++ abort_phases(rpi, de); // Dummy any unresolved phases ++ ++#if TRACE_ENTRY ++ printf(">>> %s[%p] FAIL\n", __func__, de); ++#endif ++ ++ dec_env_release(rpi, de); ++ return rv; ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++ ++#if TRACE_DEV ++static void dump_data(const uint8_t * p, size_t len) ++{ ++ size_t i; ++ for (i = 0; i < len; i += 16) { ++ size_t j; ++ printf("%04x", i); ++ for (j = 0; j != 16; ++j) { ++ printf("%c%02x", i == 8 ? '-' : ' ', p[i+j]); ++ } ++ printf("\n"); ++ } ++} ++#endif ++ ++#if OPT_EMU ++static const uint8_t * ptr_from_index(const uint8_t * b, unsigned int idx) ++{ ++ unsigned int z = 0; ++ while (idx--) { ++ if (*b++ == 0) { ++ ++z; ++ if (z >= 2 && *b == 3) { ++ ++b; ++ z = 0; ++ } ++ } ++ else { ++ z = 0; ++ } ++ } ++ return b; ++} ++#endif ++ ++static void WriteBitstream(dec_env_t * const de, const HEVCContext * const s) { ++ const int rpi_use_emu = OPT_EMU; // FFmpeg removes emulation prevention bytes ++ const int offset = 0; // Always 64-byte aligned in sim, need not be on real hardware ++ const GetBitContext *gb = &s->HEVClc->gb; ++ ++#if OPT_EMU ++ const uint8_t *ptr = ptr_from_index(de->nal_buffer, gb->index/8 + 1); ++ const int len = de->nal_size - (ptr - de->nal_buffer); ++#else ++ const int len = 1 + gb->size_in_bits/8 - gb->index/8; ++ const void *ptr = &gb->buffer[gb->index/8]; ++#endif ++ ++#if TRACE_DEV ++ printf("Index=%d, /8=%#x\n", gb->index, gb->index/8); ++ dump_data(de->nal_buffer, 128); ++#endif ++ ++ p1_axi_write(de, len, ptr, p1_apb_write(de, RPI_BFBASE, 0)); // BFBASE set later ++ p1_apb_write(de, RPI_BFNUM, len); ++ p1_apb_write(de, RPI_BFCONTROL, offset + (1<<7)); // Stop ++ p1_apb_write(de, RPI_BFCONTROL, offset + (rpi_use_emu<<6)); ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Wavefront mode ++ ++static void wpp_decode_slice(dec_env_t * const de, const HEVCContext * const s, int ctb_addr_ts) ++{ ++ const HEVCPPS * const pps = s->ps.pps; ++ ++ int i, resetQPY=1; ++ int indep = !s->sh.dependent_slice_segment_flag; ++ int ctb_col = s->sh.slice_ctb_addr_rs % de->PicWidthInCtbsY; ++ ++ if (ctb_addr_ts) ++ wpp_end_previous_slice(de, s, ctb_addr_ts); ++ pre_slice_decode(de, s); ++ WriteBitstream(de, s); ++ if (ctb_addr_ts==0 || indep || de->PicWidthInCtbsY==1) ++ WriteProb(de, s); ++ else if (ctb_col==0) ++ p1_apb_write(de, RPI_TRANSFER, PROB_RELOAD); ++ else ++ resetQPY=0; ++ program_slicecmds(de, s->slice_idx); ++ new_slice_segment(de, s); ++ wpp_entry_point(de, s, indep, resetQPY, ctb_addr_ts); ++ for (i=0; ish.num_entry_point_offsets; i++) { ++ int ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts]; ++ int ctb_row = ctb_addr_rs / de->PicWidthInCtbsY; ++ int last_x = de->PicWidthInCtbsY-1; ++ if (de->PicWidthInCtbsY>2) ++ wpp_pause(de, ctb_row); ++ p1_apb_write(de, RPI_STATUS, (ctb_row<<18) + (last_x<<5) + 2); ++ if (de->PicWidthInCtbsY==2) ++ p1_apb_write(de, RPI_TRANSFER, PROB_BACKUP); ++ if (de->PicWidthInCtbsY==1) ++ WriteProb(de, s); ++ else ++ p1_apb_write(de, RPI_TRANSFER, PROB_RELOAD); ++ ctb_addr_ts += pps->column_width[0]; ++ wpp_entry_point(de, s, 0, 1, ctb_addr_ts); ++ } ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++// Tiles mode ++ ++static void decode_slice(dec_env_t * const de, const HEVCContext * const s, int ctb_addr_ts) { ++ const HEVCPPS * const pps = s->ps.pps; ++ int i, resetQPY; ++ ++ if (ctb_addr_ts) end_previous_slice(de, s, ctb_addr_ts); ++ pre_slice_decode(de, s); ++ WriteBitstream(de, s); ++ resetQPY = ctb_addr_ts==0 ++ || pps->tile_id[ctb_addr_ts]!=pps->tile_id[ctb_addr_ts-1] ++ || !s->sh.dependent_slice_segment_flag; ++ if (resetQPY) WriteProb(de, s); ++ program_slicecmds(de, s->slice_idx); ++ new_slice_segment(de, s); ++ new_entry_point(de, s, !s->sh.dependent_slice_segment_flag, resetQPY, ctb_addr_ts); ++ for (i=0; ish.num_entry_point_offsets; i++) { ++ int ctb_addr_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts]; ++ int ctb_col = ctb_addr_rs % de->PicWidthInCtbsY; ++ int ctb_row = ctb_addr_rs / de->PicWidthInCtbsY; ++ int tile_x = ctb_to_tile (ctb_col, pps->col_bd, pps->num_tile_columns); ++ int tile_y = ctb_to_tile (ctb_row, pps->row_bd, pps->num_tile_rows); ++ int last_x = pps->col_bd[tile_x+1]-1; ++ int last_y = pps->row_bd[tile_y+1]-1; ++ p1_apb_write(de, RPI_STATUS, 2 + (last_x<<5) + (last_y<<18)); ++ WriteProb(de, s); ++ ctb_addr_ts += pps->column_width[tile_x] * pps->row_height[tile_y]; ++ new_entry_point(de, s, 0, 1, ctb_addr_ts); ++ } ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++static int cabac_start_align(HEVCContext *s) ++{ ++ GetBitContext *gb = &s->HEVClc->gb; ++ skip_bits(gb, 1); ++ align_get_bits(gb); ++ // Should look at getting rid of this ++ return ff_init_cabac_decoder(&s->HEVClc->cc, ++ gb->buffer + get_bits_count(gb) / 8, ++ (get_bits_left(gb) + 7) / 8); ++} ++ ++static int rpi_hevc_decode_slice( ++ AVCodecContext *avctx, ++ const uint8_t *buffer, ++ uint32_t size) ++{ ++ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; ++ HEVCContext * const s = avctx->priv_data; ++ dec_env_t * const de = dec_env_get(avctx, rpi); ++ const HEVCPPS *pps = s->ps.pps; ++ int ctb_addr_ts = pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; ++ ++#if TRACE_ENTRY ++ printf("<<< %s[%p]\n", __func__, de); ++#endif ++ if (de == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Cannot find find context for thread\n", __func__); ++ return -1; ++ } ++ ++ if (de->state != RPIVID_DECODE_START && de->state != RPIVID_DECODE_SLICE) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected state: %d\n", __func__, de->state); ++ return -1; ++ } ++ de->state = RPIVID_DECODE_SLICE; ++ ++ de->nal_buffer = buffer; ++ de->nal_size = size; ++ ++#if !OPT_EMU ++// ff_hevc_cabac_init(s, ctb_addr_ts); ++ cabac_start_align(s); ++#endif ++ if (s->ps.sps->scaling_list_enable_flag) ++ populate_scaling_factors(de, s); ++ pps->entropy_coding_sync_enabled_flag? wpp_decode_slice(de, s, ctb_addr_ts) ++ : decode_slice(de, s, ctb_addr_ts); ++#if TRACE_ENTRY ++ printf(">>> %s[%p]\n", __func__, de); ++#endif ++ dec_env_release(rpi, de); ++ return 0; ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++static int rpivid_retrieve_data(void *logctx, AVFrame *frame) ++{ ++ int rv; ++ if ((rv = av_rpi_zc_resolve_frame(frame, ZC_RESOLVE_WAIT_VALID)) != 0) ++ av_log(logctx, AV_LOG_ERROR, "Unable to resolve output frame\n"); ++ return rv; ++} ++ ++static int rpivid_hevc_alloc_frame(AVCodecContext * avctx, AVFrame *frame) ++{ ++ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; ++ HEVCContext * const s = avctx->priv_data; ++ // Frame buffering + 1 output. Would need thread_count extra but we now ++ // alloc at the start of phase 2 so that is the only thread we need the ++ // extra buffer for. ++ const unsigned int pool_req = s->ps.sps->temporal_layer[s->ps.sps->max_sub_layers - 1].max_dec_pic_buffering + 1; ++ int rv; ++ ++ if (av_rpi_zc_in_use(avctx)) ++ { ++ const AVZcEnvPtr zc = avctx->opaque; ++ av_rpi_zc_set_decoder_pool_size(zc, pool_req); ++ rv = av_rpi_zc_get_buffer(zc, frame); // get_buffer2 would alloc ++ } ++ else ++ { ++ if (rpi->zc == NULL) { ++ pthread_mutex_lock(&rpi->phase_lock); // Abuse - not worth creating a lock just for this ++ // Alloc inside lock to make sure we only ever alloc one ++ if (rpi->zc == NULL) { ++ rpi->zc = av_rpi_zc_int_env_alloc(s); ++ } ++ pthread_mutex_unlock(&rpi->phase_lock); ++ } ++ av_rpi_zc_set_decoder_pool_size(rpi->zc, pool_req); // Ignored by local allocator, but set anyway :-) ++ rv = (rpi->zc == NULL) ? AVERROR(ENOMEM) : ++ av_rpi_zc_get_buffer(rpi->zc, frame); ++ } ++ ++ if (rv == 0 && ++ (rv = ff_attach_decode_data(frame)) < 0) ++ { ++ av_frame_unref(frame); ++ } ++ ++ if (rv == 0) ++ { ++ FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data; ++ fdd->post_process = rpivid_retrieve_data; ++ } ++ ++ return rv; ++} ++ ++#if OPT_PHASE_TIMING ++static void log_bin_phase(AVCodecContext * const avctx, const unsigned int * const bins) ++{ ++ av_log(avctx, AV_LOG_INFO, "%7d %7d %7d %7d %7d %7d %7d %7d %7d\n", ++ bins[0], bins[1], bins[2], bins[3], ++ bins[4], bins[5], bins[6], bins[7], bins[8]); ++} ++#endif ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++static int rpi_hevc_free(AVCodecContext *avctx) { ++ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; ++ ++#if TRACE_ENTRY ++ printf("<<< %s\n", __func__); ++#endif ++ ++ dec_env_release(rpi, NULL); ++ ++ // Wait for everything else to stop ++ { ++ struct timespec tt; ++ clock_gettime(CLOCK_REALTIME, &tt); ++ tt.tv_sec += 2; ++ while (sem_timedwait(&rpi->ref_zero, &tt) == -1) { ++ const int err = errno; ++ if (err == ETIMEDOUT) { ++ av_log(avctx, AV_LOG_FATAL, "Rpivid worker threads still running\n"); ++ return -1; ++ } ++ if (err != EINTR) { ++ av_log(avctx, AV_LOG_ERROR, "Unexpected error %d waiting for work thread to stop\n", err); ++ break; ++ } ++ } ++ } ++ ++#if OPT_PHASE_TIMING ++ { ++ unsigned int i; ++ for (i = 0; i != RPIVID_PHASES; ++i) { ++ const phase_wait_env_t * const p = rpi->phase_reqs + i; ++ av_log(avctx, AV_LOG_INFO, "Phase %u: In %3u.%06u, Out %3u.%06u\n", i, ++ (unsigned int)(p->time_in_phase / 1000000), (unsigned int)(p->time_in_phase % 1000000), ++ (unsigned int)(p->time_out_phase / 1000000), (unsigned int)(p->time_out_phase % 1000000)); ++ av_log(avctx, AV_LOG_INFO, "%7d %7d %7d %7d %7d %7d %7d %7d >\n", ++ time_thresholds[0], time_thresholds[1], time_thresholds[2], time_thresholds[3], ++ time_thresholds[4], time_thresholds[5], time_thresholds[6], time_thresholds[7]); ++ log_bin_phase(avctx, p->time_bins); ++ log_bin_phase(avctx, p->time_bins3); ++ log_bin_phase(avctx, p->time_bins5); ++ av_log(avctx, AV_LOG_INFO, "Longest duraction: %ums @ frame %u\n", ++ (unsigned int)(p->max_phase_time / 1000), ++ p->max_time_decode_order); ++ } ++ av_log(avctx, AV_LOG_INFO, "PU max=%d\n", rpi->max_pu_msgs); ++ } ++#endif ++ ++ if (rpi->dec_envs != NULL) ++ { ++ for (int i; i < avctx->thread_count && rpi->dec_envs[i] != NULL; ++i) { ++ dec_env_delete(rpi->dec_envs[i]); ++ } ++ av_freep(&rpi->dec_envs); ++ } ++ ++ av_rpi_zc_int_env_freep(&rpi->zc); ++ ++ gpu_free(&rpi->gcolbuf); ++ ++ for (unsigned int i = 0; i != RPIVID_BITBUFS; ++i) { ++ gpu_free(rpi->gbitbufs + i); ++ } ++ for (unsigned int i = 0; i != RPIVID_COEFFBUFS; ++i) { ++ gpu_free(rpi->gcoeffbufs + i); ++ } ++ ++ unmap_devp(&rpi->regs, REGS_SIZE); ++ unmap_devp(&rpi->ints, INTS_SIZE); ++ ++ if (rpi->gpu_init_type > 0) ++ rpi_mem_gpu_uninit(); ++ ++ if (rpi->mbox_fd >= 0) { ++ mbox_release_clock(rpi->mbox_fd); ++ mbox_close(rpi->mbox_fd); ++ } ++ ++ sem_destroy(&rpi->ref_zero); ++ sem_destroy(&rpi->coeffbuf_sem); ++ sem_destroy(&rpi->bitbuf_sem); ++ ++#if TRACE_ENTRY ++ printf(">>> %s\n", __func__); ++#endif ++ return 0; ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++static int rpi_hevc_init(AVCodecContext *avctx) { ++ RPI_T * const rpi = avctx->internal->hwaccel_priv_data; ++// const char *err; ++ ++#if TRACE_ENTRY ++ printf("<<< %s\n", __func__); ++#endif ++ ++ if (avctx->width>4096 || avctx->height>4096) { ++ av_log(NULL, AV_LOG_FATAL, "Picture size %dx%d exceeds 4096x4096 maximum for HWAccel\n", avctx->width, avctx->height); ++ return AVERROR(ENOTSUP); ++ } ++ ++ memset(rpi, 0, sizeof(*rpi)); ++ ++ rpi->mbox_fd = -1; ++ rpi->decode_order = 0; ++ ++ // Initial PU/COEFF stream buffer split chosen as worst case seen so far ++ rpi->max_pu_msgs = 768; // 7.2 says at most 1611 messages per CTU ++ ++ ++ atomic_store(&rpi->ref_count, 1); ++ sem_init(&rpi->ref_zero, 0, 0); ++ ++ sem_init(&rpi->bitbuf_sem, 0, RPIVID_BITBUFS); ++ sem_init(&rpi->coeffbuf_sem, 0, RPIVID_COEFFBUFS); ++ ++ pthread_mutex_init(&rpi->phase_lock, NULL); ++ ++ if ((rpi->mbox_fd = mbox_open()) < 0) ++ { ++ av_log(avctx, AV_LOG_ERROR, "Failed to open mailbox\n"); ++ goto fail; ++ } ++ mbox_request_clock(rpi->mbox_fd); ++ ++ if ((rpi->regs = map_dev(avctx, REGS_NAME, REGS_SIZE)) == NULL || ++ (rpi->ints = map_dev(avctx, INTS_NAME, INTS_SIZE)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to open rpivid devices\n"); ++ goto fail; ++ } ++ ++ if ((rpi->gpu_init_type = rpi_mem_gpu_init(0)) < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to init GPU\n"); ++ goto fail; ++ } ++ ++ if ((rpi->dec_envs = av_mallocz(sizeof(dec_env_t *) * avctx->thread_count)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to alloc %d dec envs\n", avctx->thread_count); ++ goto fail; ++ } ++ ++ rpi->col_stride = rnd64(avctx->width); ++ rpi->col_picsize = rpi->col_stride * (((avctx->height + 63) & ~63) >> 4); ++ if (gpu_malloc_uncached(rpi->col_picsize * RPIVID_COL_PICS, &rpi->gcolbuf) != 0) ++ { ++ av_log(avctx, AV_LOG_ERROR, "Failed to allocate col mv buffer\n"); ++ goto fail; ++ } ++ ++ for (unsigned int i = 0; i != RPIVID_BITBUFS; ++i) { ++ if (gpu_malloc_uncached(RPIVID_BITBUF_SIZE, rpi->gbitbufs + i) != 0) ++ { ++ av_log(avctx, AV_LOG_ERROR, "Failed to allocate bitbuf %d\n", i); ++ goto fail; ++ } ++ } ++ ++ for (unsigned int i = 0; i != RPIVID_COEFFBUFS; ++i) { ++ if (gpu_malloc_uncached(RPIVID_COEFFBUF_SIZE, rpi->gcoeffbufs + i) != 0) ++ { ++ av_log(avctx, AV_LOG_ERROR, "Failed to allocate coeffbuf %d\n", i); ++ goto fail; ++ } ++ } ++ ++ av_log(avctx, AV_LOG_INFO, "RPI HEVC h/w accel init OK\n"); ++ ++ return 0; ++ ++fail: ++ rpi_hevc_free(avctx); ++ return AVERROR_EXTERNAL; ++} ++ ++////////////////////////////////////////////////////////////////////////////// ++ ++const AVHWAccel ff_hevc_rpi4_8_hwaccel = { ++ .name = "hevc_rpi4_8", ++ .type = AVMEDIA_TYPE_VIDEO, ++ .id = AV_CODEC_ID_HEVC, ++ .pix_fmt = AV_PIX_FMT_RPI4_8, ++ .alloc_frame = rpivid_hevc_alloc_frame, ++ .start_frame = rpi_hevc_start_frame, ++ .end_frame = rpi_hevc_end_frame, ++ .abort_frame = rpi_hevc_abort_frame, ++ .decode_slice = rpi_hevc_decode_slice, ++ .init = rpi_hevc_init, ++ .uninit = rpi_hevc_free, ++ .priv_data_size = sizeof(RPI_T), ++ .caps_internal = HWACCEL_CAP_ASYNC_SAFE | HWACCEL_CAP_MT_SAFE, ++}; ++ ++const AVHWAccel ff_hevc_rpi4_10_hwaccel = { ++ .name = "hevc_rpi4_10", ++ .type = AVMEDIA_TYPE_VIDEO, ++ .id = AV_CODEC_ID_HEVC, ++ .pix_fmt = AV_PIX_FMT_RPI4_10, ++ .alloc_frame = rpivid_hevc_alloc_frame, ++ .start_frame = rpi_hevc_start_frame, ++ .end_frame = rpi_hevc_end_frame, ++ .abort_frame = rpi_hevc_abort_frame, ++ .decode_slice = rpi_hevc_decode_slice, ++ .init = rpi_hevc_init, ++ .uninit = rpi_hevc_free, ++ .priv_data_size = sizeof(RPI_T), ++ .caps_internal = HWACCEL_CAP_ASYNC_SAFE | HWACCEL_CAP_MT_SAFE, ++}; ++ +--- a/libavcodec/v4l2_buffers.c ++++ b/libavcodec/v4l2_buffers.c +@@ -21,6 +21,7 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + ++#include + #include + #include + #include +@@ -29,57 +30,82 @@ + #include + #include "libavcodec/avcodec.h" + #include "libavcodec/internal.h" ++#include "libavutil/avassert.h" + #include "libavutil/pixdesc.h" ++#include "libavutil/hwcontext.h" + #include "v4l2_context.h" + #include "v4l2_buffers.h" + #include "v4l2_m2m.h" ++#include "weak_link.h" + + #define USEC_PER_SEC 1000000 +-static AVRational v4l2_timebase = { 1, USEC_PER_SEC }; ++static const AVRational v4l2_timebase = { 1, USEC_PER_SEC }; + +-static inline V4L2m2mContext *buf_to_m2mctx(V4L2Buffer *buf) ++static inline V4L2m2mContext *buf_to_m2mctx(const V4L2Buffer * const buf) + { + return V4L2_TYPE_IS_OUTPUT(buf->context->type) ? + container_of(buf->context, V4L2m2mContext, output) : + container_of(buf->context, V4L2m2mContext, capture); + } + +-static inline AVCodecContext *logger(V4L2Buffer *buf) ++static inline AVCodecContext *logger(const V4L2Buffer * const buf) + { + return buf_to_m2mctx(buf)->avctx; + } + +-static inline AVRational v4l2_get_timebase(V4L2Buffer *avbuf) ++static inline AVRational v4l2_get_timebase(const V4L2Buffer * const avbuf) + { +- V4L2m2mContext *s = buf_to_m2mctx(avbuf); +- +- if (s->avctx->pkt_timebase.num) +- return s->avctx->pkt_timebase; +- return s->avctx->time_base; ++ const V4L2m2mContext *s = buf_to_m2mctx(avbuf); ++ const AVRational tb = s->avctx->pkt_timebase.num ? ++ s->avctx->pkt_timebase : ++ s->avctx->time_base; ++ return tb.num && tb.den ? tb : v4l2_timebase; + } + +-static inline void v4l2_set_pts(V4L2Buffer *out, int64_t pts) ++static inline struct timeval tv_from_int(const int64_t t) + { +- int64_t v4l2_pts; ++ return (struct timeval){ ++ .tv_usec = t % USEC_PER_SEC, ++ .tv_sec = t / USEC_PER_SEC ++ }; ++} + +- if (pts == AV_NOPTS_VALUE) +- pts = 0; ++static inline int64_t int_from_tv(const struct timeval t) ++{ ++ return (int64_t)t.tv_sec * USEC_PER_SEC + t.tv_usec; ++} + ++static inline void v4l2_set_pts(V4L2Buffer * const out, const int64_t pts) ++{ + /* convert pts to v4l2 timebase */ +- v4l2_pts = av_rescale_q(pts, v4l2_get_timebase(out), v4l2_timebase); +- out->buf.timestamp.tv_usec = v4l2_pts % USEC_PER_SEC; +- out->buf.timestamp.tv_sec = v4l2_pts / USEC_PER_SEC; ++ const int64_t v4l2_pts = ++ pts == AV_NOPTS_VALUE ? 0 : ++ av_rescale_q(pts, v4l2_get_timebase(out), v4l2_timebase); ++ out->buf.timestamp = tv_from_int(v4l2_pts); + } + +-static inline int64_t v4l2_get_pts(V4L2Buffer *avbuf) ++static inline int64_t v4l2_get_pts(const V4L2Buffer * const avbuf) + { +- int64_t v4l2_pts; +- ++ const int64_t v4l2_pts = int_from_tv(avbuf->buf.timestamp); ++ return v4l2_pts != 0 ? v4l2_pts : AV_NOPTS_VALUE; ++#if 0 + /* convert pts back to encoder timebase */ +- v4l2_pts = (int64_t)avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + +- avbuf->buf.timestamp.tv_usec; ++ return ++ avbuf->context->no_pts_rescale ? v4l2_pts : ++ v4l2_pts == 0 ? AV_NOPTS_VALUE : ++ av_rescale_q(v4l2_pts, v4l2_timebase, v4l2_get_timebase(avbuf)); ++#endif ++} + +- return av_rescale_q(v4l2_pts, v4l2_timebase, v4l2_get_timebase(avbuf)); ++static void set_buf_length(V4L2Buffer *out, unsigned int plane, uint32_t bytesused, uint32_t length) ++{ ++ if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { ++ out->planes[plane].bytesused = bytesused; ++ out->planes[plane].length = length; ++ } else { ++ out->buf.bytesused = bytesused; ++ out->buf.length = length; ++ } + } + + static enum AVColorPrimaries v4l2_get_color_primaries(V4L2Buffer *buf) +@@ -116,49 +142,176 @@ static enum AVColorPrimaries v4l2_get_co + return AVCOL_PRI_UNSPECIFIED; + } + +-static enum AVColorRange v4l2_get_color_range(V4L2Buffer *buf) +-{ +- enum v4l2_quantization qt; ++static void v4l2_set_color(V4L2Buffer *buf, ++ const enum AVColorPrimaries avcp, ++ const enum AVColorSpace avcs, ++ const enum AVColorTransferCharacteristic avxc) ++{ ++ enum v4l2_ycbcr_encoding ycbcr = V4L2_YCBCR_ENC_DEFAULT; ++ enum v4l2_colorspace cs = V4L2_COLORSPACE_DEFAULT; ++ enum v4l2_xfer_func xfer = V4L2_XFER_FUNC_DEFAULT; ++ ++ switch (avcp) { ++ case AVCOL_PRI_BT709: ++ cs = V4L2_COLORSPACE_REC709; ++ ycbcr = V4L2_YCBCR_ENC_709; ++ break; ++ case AVCOL_PRI_BT470M: ++ cs = V4L2_COLORSPACE_470_SYSTEM_M; ++ ycbcr = V4L2_YCBCR_ENC_601; ++ break; ++ case AVCOL_PRI_BT470BG: ++ cs = V4L2_COLORSPACE_470_SYSTEM_BG; ++ break; ++ case AVCOL_PRI_SMPTE170M: ++ cs = V4L2_COLORSPACE_SMPTE170M; ++ break; ++ case AVCOL_PRI_SMPTE240M: ++ cs = V4L2_COLORSPACE_SMPTE240M; ++ break; ++ case AVCOL_PRI_BT2020: ++ cs = V4L2_COLORSPACE_BT2020; ++ break; ++ case AVCOL_PRI_SMPTE428: ++ case AVCOL_PRI_SMPTE431: ++ case AVCOL_PRI_SMPTE432: ++ case AVCOL_PRI_EBU3213: ++ case AVCOL_PRI_RESERVED: ++ case AVCOL_PRI_FILM: ++ case AVCOL_PRI_UNSPECIFIED: ++ default: ++ break; ++ } + +- qt = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? +- buf->context->format.fmt.pix_mp.quantization : +- buf->context->format.fmt.pix.quantization; ++ switch (avcs) { ++ case AVCOL_SPC_RGB: ++ cs = V4L2_COLORSPACE_SRGB; ++ break; ++ case AVCOL_SPC_BT709: ++ cs = V4L2_COLORSPACE_REC709; ++ break; ++ case AVCOL_SPC_FCC: ++ cs = V4L2_COLORSPACE_470_SYSTEM_M; ++ break; ++ case AVCOL_SPC_BT470BG: ++ cs = V4L2_COLORSPACE_470_SYSTEM_BG; ++ break; ++ case AVCOL_SPC_SMPTE170M: ++ cs = V4L2_COLORSPACE_SMPTE170M; ++ break; ++ case AVCOL_SPC_SMPTE240M: ++ cs = V4L2_COLORSPACE_SMPTE240M; ++ break; ++ case AVCOL_SPC_BT2020_CL: ++ cs = V4L2_COLORSPACE_BT2020; ++ ycbcr = V4L2_YCBCR_ENC_BT2020_CONST_LUM; ++ break; ++ case AVCOL_SPC_BT2020_NCL: ++ cs = V4L2_COLORSPACE_BT2020; ++ break; ++ default: ++ break; ++ } + +- switch (qt) { +- case V4L2_QUANTIZATION_LIM_RANGE: return AVCOL_RANGE_MPEG; +- case V4L2_QUANTIZATION_FULL_RANGE: return AVCOL_RANGE_JPEG; ++ switch (xfer) { ++ case AVCOL_TRC_BT709: ++ xfer = V4L2_XFER_FUNC_709; ++ break; ++ case AVCOL_TRC_IEC61966_2_1: ++ xfer = V4L2_XFER_FUNC_SRGB; ++ break; ++ case AVCOL_TRC_SMPTE240M: ++ xfer = V4L2_XFER_FUNC_SMPTE240M; ++ break; ++ case AVCOL_TRC_SMPTE2084: ++ xfer = V4L2_XFER_FUNC_SMPTE2084; ++ break; + default: + break; + } + +- return AVCOL_RANGE_UNSPECIFIED; ++ if (V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type)) { ++ buf->context->format.fmt.pix_mp.colorspace = cs; ++ buf->context->format.fmt.pix_mp.ycbcr_enc = ycbcr; ++ buf->context->format.fmt.pix_mp.xfer_func = xfer; ++ } else { ++ buf->context->format.fmt.pix.colorspace = cs; ++ buf->context->format.fmt.pix.ycbcr_enc = ycbcr; ++ buf->context->format.fmt.pix.xfer_func = xfer; ++ } + } + +-static enum AVColorSpace v4l2_get_color_space(V4L2Buffer *buf) ++static inline enum v4l2_quantization ++buf_quantization(const V4L2Buffer * const buf) + { +- enum v4l2_ycbcr_encoding ycbcr; +- enum v4l2_colorspace cs; ++ return V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? ++ buf->context->format.fmt.pix_mp.quantization : ++ buf->context->format.fmt.pix.quantization; ++} + +- cs = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? ++static inline enum v4l2_colorspace ++buf_colorspace(const V4L2Buffer * const buf) ++{ ++ return V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? + buf->context->format.fmt.pix_mp.colorspace : + buf->context->format.fmt.pix.colorspace; ++} + +- ycbcr = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? ++static inline enum v4l2_ycbcr_encoding ++buf_ycbcr_enc(const V4L2Buffer * const buf) ++{ ++ return V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? + buf->context->format.fmt.pix_mp.ycbcr_enc: + buf->context->format.fmt.pix.ycbcr_enc; ++} + +- switch(cs) { +- case V4L2_COLORSPACE_SRGB: return AVCOL_SPC_RGB; ++static enum AVColorRange v4l2_get_color_range(V4L2Buffer *buf) ++{ ++ switch (buf_quantization(buf)) { ++ case V4L2_QUANTIZATION_LIM_RANGE: ++ return AVCOL_RANGE_MPEG; ++ case V4L2_QUANTIZATION_FULL_RANGE: ++ return AVCOL_RANGE_JPEG; ++ case V4L2_QUANTIZATION_DEFAULT: ++ // If YUV (which we assume for all video decode) then, from the header ++ // comments, range is limited unless CS is JPEG ++ return buf_colorspace(buf) == V4L2_COLORSPACE_JPEG ? ++ AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; ++ default: ++ break; ++ } ++ ++ return AVCOL_RANGE_UNSPECIFIED; ++} ++ ++static void v4l2_set_color_range(V4L2Buffer *buf, const enum AVColorRange avcr) ++{ ++ const enum v4l2_quantization q = ++ avcr == AVCOL_RANGE_MPEG ? V4L2_QUANTIZATION_LIM_RANGE : ++ avcr == AVCOL_RANGE_JPEG ? V4L2_QUANTIZATION_FULL_RANGE : ++ V4L2_QUANTIZATION_DEFAULT; ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type)) { ++ buf->context->format.fmt.pix_mp.quantization = q; ++ } else { ++ buf->context->format.fmt.pix.quantization = q; ++ } ++} ++ ++static enum AVColorSpace v4l2_get_color_space(V4L2Buffer *buf) ++{ ++ switch (buf_colorspace(buf)) { ++ case V4L2_COLORSPACE_JPEG: // JPEG -> SRGB ++ case V4L2_COLORSPACE_SRGB: ++ return AVCOL_SPC_RGB; + case V4L2_COLORSPACE_REC709: return AVCOL_SPC_BT709; + case V4L2_COLORSPACE_470_SYSTEM_M: return AVCOL_SPC_FCC; + case V4L2_COLORSPACE_470_SYSTEM_BG: return AVCOL_SPC_BT470BG; + case V4L2_COLORSPACE_SMPTE170M: return AVCOL_SPC_SMPTE170M; + case V4L2_COLORSPACE_SMPTE240M: return AVCOL_SPC_SMPTE240M; + case V4L2_COLORSPACE_BT2020: +- if (ycbcr == V4L2_YCBCR_ENC_BT2020_CONST_LUM) +- return AVCOL_SPC_BT2020_CL; +- else +- return AVCOL_SPC_BT2020_NCL; ++ return buf_ycbcr_enc(buf) == V4L2_YCBCR_ENC_BT2020_CONST_LUM ? ++ AVCOL_SPC_BT2020_CL : AVCOL_SPC_BT2020_NCL; + default: + break; + } +@@ -168,17 +321,9 @@ static enum AVColorSpace v4l2_get_color_ + + static enum AVColorTransferCharacteristic v4l2_get_color_trc(V4L2Buffer *buf) + { +- enum v4l2_ycbcr_encoding ycbcr; ++ const enum v4l2_ycbcr_encoding ycbcr = buf_ycbcr_enc(buf); + enum v4l2_xfer_func xfer; +- enum v4l2_colorspace cs; +- +- cs = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? +- buf->context->format.fmt.pix_mp.colorspace : +- buf->context->format.fmt.pix.colorspace; +- +- ycbcr = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? +- buf->context->format.fmt.pix_mp.ycbcr_enc: +- buf->context->format.fmt.pix.ycbcr_enc; ++ const enum v4l2_colorspace cs = buf_colorspace(buf); + + xfer = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ? + buf->context->format.fmt.pix_mp.xfer_func: +@@ -210,73 +355,165 @@ static enum AVColorTransferCharacteristi + return AVCOL_TRC_UNSPECIFIED; + } + +-static void v4l2_free_buffer(void *opaque, uint8_t *unused) ++static int v4l2_buf_is_interlaced(const V4L2Buffer * const buf) + { +- V4L2Buffer* avbuf = opaque; +- V4L2m2mContext *s = buf_to_m2mctx(avbuf); +- +- if (atomic_fetch_sub(&avbuf->context_refcount, 1) == 1) { +- atomic_fetch_sub_explicit(&s->refcount, 1, memory_order_acq_rel); ++ return V4L2_FIELD_IS_INTERLACED(buf->buf.field); ++} + +- if (s->reinit) { +- if (!atomic_load(&s->refcount)) +- sem_post(&s->refsync); +- } else { +- if (s->draining && V4L2_TYPE_IS_OUTPUT(avbuf->context->type)) { +- /* no need to queue more buffers to the driver */ +- avbuf->status = V4L2BUF_AVAILABLE; +- } +- else if (avbuf->context->streamon) +- ff_v4l2_buffer_enqueue(avbuf); +- } ++static int v4l2_buf_is_top_first(const V4L2Buffer * const buf) ++{ ++ return buf->buf.field == V4L2_FIELD_INTERLACED_TB; ++} + +- av_buffer_unref(&avbuf->context_ref); +- } ++static void v4l2_set_interlace(V4L2Buffer * const buf, const int is_interlaced, const int is_tff) ++{ ++ buf->buf.field = !is_interlaced ? V4L2_FIELD_NONE : ++ is_tff ? V4L2_FIELD_INTERLACED_TB : V4L2_FIELD_INTERLACED_BT; + } + +-static int v4l2_buf_increase_ref(V4L2Buffer *in) ++static uint8_t * v4l2_get_drm_frame(V4L2Buffer *avbuf) + { +- V4L2m2mContext *s = buf_to_m2mctx(in); ++ AVDRMFrameDescriptor *drm_desc = &avbuf->drm_frame; ++ AVDRMLayerDescriptor *layer; + +- if (in->context_ref) +- atomic_fetch_add(&in->context_refcount, 1); +- else { +- in->context_ref = av_buffer_ref(s->self_ref); +- if (!in->context_ref) +- return AVERROR(ENOMEM); ++ /* fill the DRM frame descriptor */ ++ drm_desc->nb_objects = avbuf->num_planes; ++ drm_desc->nb_layers = 1; + +- in->context_refcount = 1; ++ layer = &drm_desc->layers[0]; ++ layer->nb_planes = avbuf->num_planes; ++ ++ for (int i = 0; i < avbuf->num_planes; i++) { ++ layer->planes[i].object_index = i; ++ layer->planes[i].offset = 0; ++ layer->planes[i].pitch = avbuf->plane_info[i].bytesperline; + } + +- in->status = V4L2BUF_RET_USER; +- atomic_fetch_add_explicit(&s->refcount, 1, memory_order_relaxed); ++ switch (avbuf->context->av_pix_fmt) { ++ case AV_PIX_FMT_YUYV422: ++ ++ layer->format = DRM_FORMAT_YUYV; ++ layer->nb_planes = 1; + +- return 0; ++ break; ++ ++ case AV_PIX_FMT_NV12: ++ case AV_PIX_FMT_NV21: ++ ++ layer->format = avbuf->context->av_pix_fmt == AV_PIX_FMT_NV12 ? ++ DRM_FORMAT_NV12 : DRM_FORMAT_NV21; ++ ++ if (avbuf->num_planes > 1) ++ break; ++ ++ layer->nb_planes = 2; ++ ++ layer->planes[1].object_index = 0; ++ layer->planes[1].offset = avbuf->plane_info[0].bytesperline * ++ avbuf->context->format.fmt.pix.height; ++ layer->planes[1].pitch = avbuf->plane_info[0].bytesperline; ++ break; ++ ++ case AV_PIX_FMT_YUV420P: ++ ++ layer->format = DRM_FORMAT_YUV420; ++ ++ if (avbuf->num_planes > 1) ++ break; ++ ++ layer->nb_planes = 3; ++ ++ layer->planes[1].object_index = 0; ++ layer->planes[1].offset = avbuf->plane_info[0].bytesperline * ++ avbuf->context->format.fmt.pix.height; ++ layer->planes[1].pitch = avbuf->plane_info[0].bytesperline >> 1; ++ ++ layer->planes[2].object_index = 0; ++ layer->planes[2].offset = layer->planes[1].offset + ++ ((avbuf->plane_info[0].bytesperline * ++ avbuf->context->format.fmt.pix.height) >> 2); ++ layer->planes[2].pitch = avbuf->plane_info[0].bytesperline >> 1; ++ break; ++ ++ default: ++ drm_desc->nb_layers = 0; ++ break; ++ } ++ ++ return (uint8_t *) drm_desc; + } + +-static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf) ++static void v4l2_free_bufref(void *opaque, uint8_t *data) + { +- int ret; ++ AVBufferRef * bufref = (AVBufferRef *)data; ++ V4L2Buffer *avbuf = (V4L2Buffer *)bufref->data; ++ struct V4L2Context *ctx = ff_weak_link_lock(&avbuf->context_wl); + +- if (plane >= in->num_planes) +- return AVERROR(EINVAL); ++ if (ctx != NULL) { ++ // Buffer still attached to context ++ V4L2m2mContext *s = buf_to_m2mctx(avbuf); + +- /* even though most encoders return 0 in data_offset encoding vp8 does require this value */ +- *buf = av_buffer_create((char *)in->plane_info[plane].mm_addr + in->planes[plane].data_offset, +- in->plane_info[plane].length, v4l2_free_buffer, in, 0); +- if (!*buf) +- return AVERROR(ENOMEM); ++ ff_mutex_lock(&ctx->lock); + +- ret = v4l2_buf_increase_ref(in); +- if (ret) +- av_buffer_unref(buf); ++ ff_v4l2_buffer_set_avail(avbuf); + +- return ret; ++ if (s->draining && V4L2_TYPE_IS_OUTPUT(ctx->type)) { ++ av_log(logger(avbuf), AV_LOG_DEBUG, "%s: Buffer avail\n", ctx->name); ++ /* no need to queue more buffers to the driver */ ++ } ++ else if (ctx->streamon) { ++ av_log(logger(avbuf), AV_LOG_DEBUG, "%s: Buffer requeue\n", ctx->name); ++ avbuf->buf.timestamp.tv_sec = 0; ++ avbuf->buf.timestamp.tv_usec = 0; ++ ff_v4l2_buffer_enqueue(avbuf); // will set to IN_DRIVER ++ } ++ else { ++ av_log(logger(avbuf), AV_LOG_DEBUG, "%s: Buffer freed but streamoff\n", ctx->name); ++ } ++ ++ ff_mutex_unlock(&ctx->lock); ++ } ++ ++ ff_weak_link_unlock(avbuf->context_wl); ++ av_buffer_unref(&bufref); + } + +-static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, int offset, AVBufferRef* bref) ++static int v4l2_buffer_export_drm(V4L2Buffer* avbuf) ++{ ++ struct v4l2_exportbuffer expbuf; ++ int i, ret; ++ ++ for (i = 0; i < avbuf->num_planes; i++) { ++ memset(&expbuf, 0, sizeof(expbuf)); ++ ++ expbuf.index = avbuf->buf.index; ++ expbuf.type = avbuf->buf.type; ++ expbuf.plane = i; ++ ++ ret = ioctl(buf_to_m2mctx(avbuf)->fd, VIDIOC_EXPBUF, &expbuf); ++ if (ret < 0) ++ return AVERROR(errno); ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type)) { ++ /* drm frame */ ++ avbuf->drm_frame.objects[i].size = avbuf->buf.m.planes[i].length; ++ avbuf->drm_frame.objects[i].fd = expbuf.fd; ++ avbuf->drm_frame.objects[i].format_modifier = DRM_FORMAT_MOD_LINEAR; ++ } else { ++ /* drm frame */ ++ avbuf->drm_frame.objects[0].size = avbuf->buf.length; ++ avbuf->drm_frame.objects[0].fd = expbuf.fd; ++ avbuf->drm_frame.objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; ++ } ++ } ++ ++ return 0; ++} ++ ++static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, int offset) + { + unsigned int bytesused, length; ++ int rv = 0; + + if (plane >= out->num_planes) + return AVERROR(EINVAL); +@@ -284,32 +521,57 @@ static int v4l2_bufref_to_buf(V4L2Buffer + length = out->plane_info[plane].length; + bytesused = FFMIN(size+offset, length); + +- memcpy((uint8_t*)out->plane_info[plane].mm_addr+offset, data, FFMIN(size, length-offset)); +- +- if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { +- out->planes[plane].bytesused = bytesused; +- out->planes[plane].length = length; +- } else { +- out->buf.bytesused = bytesused; +- out->buf.length = length; ++ if (size > length - offset) { ++ size = length - offset; ++ rv = AVERROR(ENOMEM); + } + +- return 0; ++ memcpy((uint8_t*)out->plane_info[plane].mm_addr+offset, data, size); ++ ++ set_buf_length(out, plane, bytesused, length); ++ ++ return rv; ++} ++ ++static AVBufferRef * wrap_avbuf(V4L2Buffer * const avbuf) ++{ ++ AVBufferRef * bufref = av_buffer_ref(avbuf->context->bufrefs[avbuf->buf.index]); ++ AVBufferRef * newbuf; ++ ++ if (!bufref) ++ return NULL; ++ ++ newbuf = av_buffer_create((uint8_t *)bufref, sizeof(*bufref), v4l2_free_bufref, NULL, 0); ++ if (newbuf == NULL) ++ av_buffer_unref(&bufref); ++ ++ avbuf->status = V4L2BUF_RET_USER; ++ return newbuf; + } + + static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf) + { +- int i, ret; ++ int i; + + frame->format = avbuf->context->av_pix_fmt; + +- for (i = 0; i < avbuf->num_planes; i++) { +- ret = v4l2_buf_to_bufref(avbuf, i, &frame->buf[i]); +- if (ret) +- return ret; ++ frame->buf[0] = wrap_avbuf(avbuf); ++ if (frame->buf[0] == NULL) ++ return AVERROR(ENOMEM); ++ ++ if (buf_to_m2mctx(avbuf)->output_drm) { ++ /* 1. get references to the actual data */ ++ frame->data[0] = (uint8_t *) v4l2_get_drm_frame(avbuf); ++ frame->format = AV_PIX_FMT_DRM_PRIME; ++ frame->hw_frames_ctx = av_buffer_ref(avbuf->context->frames_ref); ++ return 0; ++ } + ++ ++ /* 1. get references to the actual data */ ++ for (i = 0; i < avbuf->num_planes; i++) { ++ frame->data[i] = (uint8_t *)avbuf->plane_info[i].mm_addr + avbuf->planes[i].data_offset; + frame->linesize[i] = avbuf->plane_info[i].bytesperline; +- frame->data[i] = frame->buf[i]->data; + } + + /* fixup special cases */ +@@ -318,17 +580,17 @@ static int v4l2_buffer_buf_to_swframe(AV + case AV_PIX_FMT_NV21: + if (avbuf->num_planes > 1) + break; +- frame->linesize[1] = avbuf->plane_info[0].bytesperline; +- frame->data[1] = frame->buf[0]->data + avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height; ++ frame->linesize[1] = frame->linesize[0]; ++ frame->data[1] = frame->data[0] + frame->linesize[0] * ff_v4l2_get_format_height(&avbuf->context->format); + break; + + case AV_PIX_FMT_YUV420P: + if (avbuf->num_planes > 1) + break; +- frame->linesize[1] = avbuf->plane_info[0].bytesperline >> 1; +- frame->linesize[2] = avbuf->plane_info[0].bytesperline >> 1; +- frame->data[1] = frame->buf[0]->data + avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height; +- frame->data[2] = frame->data[1] + ((avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height) >> 2); ++ frame->linesize[1] = frame->linesize[0] / 2; ++ frame->linesize[2] = frame->linesize[1]; ++ frame->data[1] = frame->data[0] + frame->linesize[0] * ff_v4l2_get_format_height(&avbuf->context->format); ++ frame->data[2] = frame->data[1] + frame->linesize[1] * ff_v4l2_get_format_height(&avbuf->context->format) / 2; + break; + + default: +@@ -338,68 +600,127 @@ static int v4l2_buffer_buf_to_swframe(AV + return 0; + } + ++static void cpy_2d(uint8_t * dst, int dst_stride, const uint8_t * src, int src_stride, int w, int h) ++{ ++ if (dst_stride == src_stride && w + 32 >= dst_stride) { ++ memcpy(dst, src, dst_stride * h); ++ } ++ else { ++ while (--h >= 0) { ++ memcpy(dst, src, w); ++ dst += dst_stride; ++ src += src_stride; ++ } ++ } ++} ++ ++static int is_chroma(const AVPixFmtDescriptor *desc, int i, int num_planes) ++{ ++ return i != 0 && !(i == num_planes - 1 && (desc->flags & AV_PIX_FMT_FLAG_ALPHA)); ++} ++ ++static int v4l2_buffer_primeframe_to_buf(const AVFrame *frame, V4L2Buffer *out) ++{ ++ const AVDRMFrameDescriptor *const src = (const AVDRMFrameDescriptor *)frame->data[0]; ++ ++ if (frame->format != AV_PIX_FMT_DRM_PRIME || !src) ++ return AVERROR(EINVAL); ++ ++ av_assert0(out->buf.memory == V4L2_MEMORY_DMABUF); ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { ++ // Only currently cope with single buffer types ++ if (out->buf.length != 1) ++ return AVERROR_PATCHWELCOME; ++ if (src->nb_objects != 1) ++ return AVERROR(EINVAL); ++ ++ out->planes[0].m.fd = src->objects[0].fd; ++ } ++ else { ++ if (src->nb_objects != 1) ++ return AVERROR(EINVAL); ++ ++ out->buf.m.fd = src->objects[0].fd; ++ } ++ ++ // No need to copy src AVDescriptor and if we did then we may confuse ++ // fd close on free ++ out->ref_buf = av_buffer_ref(frame->buf[0]); ++ ++ return 0; ++} ++ + static int v4l2_buffer_swframe_to_buf(const AVFrame *frame, V4L2Buffer *out) + { +- int i, ret; +- struct v4l2_format fmt = out->context->format; +- int pixel_format = V4L2_TYPE_IS_MULTIPLANAR(fmt.type) ? +- fmt.fmt.pix_mp.pixelformat : fmt.fmt.pix.pixelformat; +- int height = V4L2_TYPE_IS_MULTIPLANAR(fmt.type) ? +- fmt.fmt.pix_mp.height : fmt.fmt.pix.height; +- int is_planar_format = 0; +- +- switch (pixel_format) { +- case V4L2_PIX_FMT_YUV420M: +- case V4L2_PIX_FMT_YVU420M: +-#ifdef V4L2_PIX_FMT_YUV422M +- case V4L2_PIX_FMT_YUV422M: +-#endif +-#ifdef V4L2_PIX_FMT_YVU422M +- case V4L2_PIX_FMT_YVU422M: +-#endif +-#ifdef V4L2_PIX_FMT_YUV444M +- case V4L2_PIX_FMT_YUV444M: +-#endif +-#ifdef V4L2_PIX_FMT_YVU444M +- case V4L2_PIX_FMT_YVU444M: +-#endif +- case V4L2_PIX_FMT_NV12M: +- case V4L2_PIX_FMT_NV21M: +- case V4L2_PIX_FMT_NV12MT_16X16: +- case V4L2_PIX_FMT_NV12MT: +- case V4L2_PIX_FMT_NV16M: +- case V4L2_PIX_FMT_NV61M: +- is_planar_format = 1; +- } +- +- if (!is_planar_format) { +- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); +- int planes_nb = 0; +- int offset = 0; +- +- for (i = 0; i < desc->nb_components; i++) +- planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1); +- +- for (i = 0; i < planes_nb; i++) { +- int size, h = height; +- if (i == 1 || i == 2) { ++ int i; ++ int num_planes = 0; ++ int pel_strides[4] = {0}; ++ ++ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); ++ ++ if ((desc->flags & AV_PIX_FMT_FLAG_HWACCEL) != 0) { ++ av_log(NULL, AV_LOG_ERROR, "%s: HWACCEL cannot be copied\n", __func__); ++ return -1; ++ } ++ ++ for (i = 0; i != desc->nb_components; ++i) { ++ if (desc->comp[i].plane >= num_planes) ++ num_planes = desc->comp[i].plane + 1; ++ pel_strides[desc->comp[i].plane] = desc->comp[i].step; ++ } ++ ++ if (out->num_planes > 1) { ++ if (num_planes != out->num_planes) { ++ av_log(NULL, AV_LOG_ERROR, "%s: Num planes mismatch: %d != %d\n", __func__, num_planes, out->num_planes); ++ return -1; ++ } ++ for (i = 0; i != num_planes; ++i) { ++ int w = frame->width; ++ int h = frame->height; ++ if (is_chroma(desc, i, num_planes)) { ++ w = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); + h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); + } +- size = frame->linesize[i] * h; +- ret = v4l2_bufref_to_buf(out, 0, frame->data[i], size, offset, frame->buf[i]); +- if (ret) +- return ret; +- offset += size; ++ ++ cpy_2d(out->plane_info[i].mm_addr, out->plane_info[i].bytesperline, ++ frame->data[i], frame->linesize[i], ++ w * pel_strides[i], h); ++ set_buf_length(out, i, out->plane_info[i].bytesperline * h, out->plane_info[i].length); + } +- return 0; + } ++ else ++ { ++ unsigned int offset = 0; ++ ++ for (i = 0; i != num_planes; ++i) { ++ int w = frame->width; ++ int h = frame->height; ++ int dst_stride = out->plane_info[0].bytesperline; ++ uint8_t * const dst = (uint8_t *)out->plane_info[0].mm_addr + offset; ++ ++ if (is_chroma(desc, i, num_planes)) { ++ // Is chroma ++ dst_stride >>= desc->log2_chroma_w; ++ offset += dst_stride * (out->context->height >> desc->log2_chroma_h); ++ w = AV_CEIL_RSHIFT(w, desc->log2_chroma_w); ++ h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h); ++ } ++ else { ++ // Is luma or alpha ++ offset += dst_stride * out->context->height; ++ } ++ if (offset > out->plane_info[0].length) { ++ av_log(NULL, AV_LOG_ERROR, "%s: Plane total %u > buffer size %zu\n", __func__, offset, out->plane_info[0].length); ++ return -1; ++ } + +- for (i = 0; i < out->num_planes; i++) { +- ret = v4l2_bufref_to_buf(out, i, frame->buf[i]->data, frame->buf[i]->size, 0, frame->buf[i]); +- if (ret) +- return ret; ++ cpy_2d(dst, dst_stride, ++ frame->data[i], frame->linesize[i], ++ w * pel_strides[i], h); ++ } ++ set_buf_length(out, 0, offset, out->plane_info[0].length); + } +- + return 0; + } + +@@ -409,16 +730,31 @@ static int v4l2_buffer_swframe_to_buf(co + * + ******************************************************************************/ + +-int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer *out) ++int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer *out, const int64_t track_ts) + { +- v4l2_set_pts(out, frame->pts); +- +- return v4l2_buffer_swframe_to_buf(frame, out); ++ out->buf.flags = frame->key_frame ? ++ (out->buf.flags | V4L2_BUF_FLAG_KEYFRAME) : ++ (out->buf.flags & ~V4L2_BUF_FLAG_KEYFRAME); ++ // Beware that colour info is held in format rather than the actual ++ // v4l2 buffer struct so this may not be as useful as you might hope ++ v4l2_set_color(out, frame->color_primaries, frame->colorspace, frame->color_trc); ++ v4l2_set_color_range(out, frame->color_range); ++ // PTS & interlace are buffer vars ++ if (track_ts) ++ out->buf.timestamp = tv_from_int(track_ts); ++ else ++ v4l2_set_pts(out, frame->pts); ++ v4l2_set_interlace(out, frame->interlaced_frame, frame->top_field_first); ++ ++ return frame->format == AV_PIX_FMT_DRM_PRIME ? ++ v4l2_buffer_primeframe_to_buf(frame, out) : ++ v4l2_buffer_swframe_to_buf(frame, out); + } + + int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf) + { + int ret; ++ V4L2Context * const ctx = avbuf->context; + + av_frame_unref(frame); + +@@ -429,17 +765,32 @@ int ff_v4l2_buffer_buf_to_avframe(AVFram + + /* 2. get frame information */ + frame->key_frame = !!(avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME); ++ frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : ++ (avbuf->buf.flags & V4L2_BUF_FLAG_PFRAME) != 0 ? AV_PICTURE_TYPE_P : ++ (avbuf->buf.flags & V4L2_BUF_FLAG_BFRAME) != 0 ? AV_PICTURE_TYPE_B : ++ AV_PICTURE_TYPE_NONE; + frame->color_primaries = v4l2_get_color_primaries(avbuf); + frame->colorspace = v4l2_get_color_space(avbuf); + frame->color_range = v4l2_get_color_range(avbuf); + frame->color_trc = v4l2_get_color_trc(avbuf); + frame->pts = v4l2_get_pts(avbuf); + frame->pkt_dts = AV_NOPTS_VALUE; ++ frame->interlaced_frame = v4l2_buf_is_interlaced(avbuf); ++ frame->top_field_first = v4l2_buf_is_top_first(avbuf); + + /* these values are updated also during re-init in v4l2_process_driver_event */ +- frame->height = avbuf->context->height; +- frame->width = avbuf->context->width; +- frame->sample_aspect_ratio = avbuf->context->sample_aspect_ratio; ++ frame->height = ctx->height; ++ frame->width = ctx->width; ++ frame->sample_aspect_ratio = ctx->sample_aspect_ratio; ++ ++ if (ctx->selection.height && ctx->selection.width) { ++ frame->crop_left = ctx->selection.left < frame->width ? ctx->selection.left : 0; ++ frame->crop_top = ctx->selection.top < frame->height ? ctx->selection.top : 0; ++ frame->crop_right = ctx->selection.left + ctx->selection.width < frame->width ? ++ frame->width - (ctx->selection.left + ctx->selection.width) : 0; ++ frame->crop_bottom = ctx->selection.top + ctx->selection.height < frame->height ? ++ frame->height - (ctx->selection.top + ctx->selection.height) : 0; ++ } + + /* 3. report errors upstream */ + if (avbuf->buf.flags & V4L2_BUF_FLAG_ERROR) { +@@ -452,15 +803,15 @@ int ff_v4l2_buffer_buf_to_avframe(AVFram + + int ff_v4l2_buffer_buf_to_avpkt(AVPacket *pkt, V4L2Buffer *avbuf) + { +- int ret; +- + av_packet_unref(pkt); +- ret = v4l2_buf_to_bufref(avbuf, 0, &pkt->buf); +- if (ret) +- return ret; ++ ++ pkt->buf = wrap_avbuf(avbuf); ++ if (pkt->buf == NULL) ++ return AVERROR(ENOMEM); + + pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused; +- pkt->data = pkt->buf->data; ++ pkt->data = (uint8_t*)avbuf->plane_info[0].mm_addr + avbuf->planes[0].data_offset; ++ pkt->flags = 0; + + if (avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME) + pkt->flags |= AV_PKT_FLAG_KEY; +@@ -475,31 +826,91 @@ int ff_v4l2_buffer_buf_to_avpkt(AVPacket + return 0; + } + +-int ff_v4l2_buffer_avpkt_to_buf(const AVPacket *pkt, V4L2Buffer *out) ++int ff_v4l2_buffer_avpkt_to_buf_ext(const AVPacket * const pkt, V4L2Buffer * const out, ++ const void *extdata, size_t extlen, ++ const int64_t timestamp) + { + int ret; + +- ret = v4l2_bufref_to_buf(out, 0, pkt->data, pkt->size, 0, pkt->buf); +- if (ret) ++ if (extlen) { ++ ret = v4l2_bufref_to_buf(out, 0, extdata, extlen, 0); ++ if (ret) ++ return ret; ++ } ++ ++ ret = v4l2_bufref_to_buf(out, 0, pkt->data, pkt->size, extlen); ++ if (ret && ret != AVERROR(ENOMEM)) + return ret; + +- v4l2_set_pts(out, pkt->pts); ++ if (timestamp) ++ out->buf.timestamp = tv_from_int(timestamp); ++ else ++ v4l2_set_pts(out, pkt->pts); ++ ++ out->buf.flags = (pkt->flags & AV_PKT_FLAG_KEY) != 0 ? ++ (out->buf.flags | V4L2_BUF_FLAG_KEYFRAME) : ++ (out->buf.flags & ~V4L2_BUF_FLAG_KEYFRAME); + +- if (pkt->flags & AV_PKT_FLAG_KEY) +- out->flags = V4L2_BUF_FLAG_KEYFRAME; ++ return ret; ++} + +- return 0; ++int ff_v4l2_buffer_avpkt_to_buf(const AVPacket *pkt, V4L2Buffer *out) ++{ ++ return ff_v4l2_buffer_avpkt_to_buf_ext(pkt, out, NULL, 0, 0); ++} ++ ++ ++static void v4l2_buffer_buffer_free(void *opaque, uint8_t *data) ++{ ++ V4L2Buffer * const avbuf = (V4L2Buffer *)data; ++ int i; ++ ++ for (i = 0; i != FF_ARRAY_ELEMS(avbuf->plane_info); ++i) { ++ struct V4L2Plane_info *p = avbuf->plane_info + i; ++ if (p->mm_addr != NULL) ++ munmap(p->mm_addr, p->length); ++ } ++ ++ for (i = 0; i != FF_ARRAY_ELEMS(avbuf->drm_frame.objects); ++i) { ++ if (avbuf->drm_frame.objects[i].fd != -1) ++ close(avbuf->drm_frame.objects[i].fd); ++ } ++ ++ av_buffer_unref(&avbuf->ref_buf); ++ ++ ff_weak_link_unref(&avbuf->context_wl); ++ ++ av_free(avbuf); + } + +-int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index) ++ ++int ff_v4l2_buffer_initialize(AVBufferRef ** pbufref, int index, V4L2Context *ctx, enum v4l2_memory mem) + { +- V4L2Context *ctx = avbuf->context; + int ret, i; ++ V4L2Buffer * const avbuf = av_mallocz(sizeof(*avbuf)); ++ AVBufferRef * bufref; + +- avbuf->buf.memory = V4L2_MEMORY_MMAP; ++ *pbufref = NULL; ++ if (avbuf == NULL) ++ return AVERROR(ENOMEM); ++ ++ bufref = av_buffer_create((uint8_t*)avbuf, sizeof(*avbuf), v4l2_buffer_buffer_free, NULL, 0); ++ if (bufref == NULL) { ++ av_free(avbuf); ++ return AVERROR(ENOMEM); ++ } ++ ++ avbuf->context = ctx; ++ avbuf->buf.memory = mem; + avbuf->buf.type = ctx->type; + avbuf->buf.index = index; + ++ for (i = 0; i != FF_ARRAY_ELEMS(avbuf->drm_frame.objects); ++i) { ++ avbuf->drm_frame.objects[i].fd = -1; ++ } ++ ++ avbuf->context_wl = ff_weak_link_ref(ctx->wl_master); ++ + if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { + avbuf->buf.length = VIDEO_MAX_PLANES; + avbuf->buf.m.planes = avbuf->planes; +@@ -507,7 +918,7 @@ int ff_v4l2_buffer_initialize(V4L2Buffer + + ret = ioctl(buf_to_m2mctx(avbuf)->fd, VIDIOC_QUERYBUF, &avbuf->buf); + if (ret < 0) +- return AVERROR(errno); ++ goto fail; + + if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { + avbuf->num_planes = 0; +@@ -520,6 +931,8 @@ int ff_v4l2_buffer_initialize(V4L2Buffer + avbuf->num_planes = 1; + + for (i = 0; i < avbuf->num_planes; i++) { ++ const int want_mmap = avbuf->buf.memory == V4L2_MEMORY_MMAP && ++ (V4L2_TYPE_IS_OUTPUT(ctx->type) || !buf_to_m2mctx(avbuf)->output_drm); + + avbuf->plane_info[i].bytesperline = V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? + ctx->format.fmt.pix_mp.plane_fmt[i].bytesperline : +@@ -527,25 +940,29 @@ int ff_v4l2_buffer_initialize(V4L2Buffer + + if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { + avbuf->plane_info[i].length = avbuf->buf.m.planes[i].length; +- avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, +- PROT_READ | PROT_WRITE, MAP_SHARED, +- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.planes[i].m.mem_offset); ++ ++ if (want_mmap) ++ avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length, ++ PROT_READ | PROT_WRITE, MAP_SHARED, ++ buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.planes[i].m.mem_offset); + } else { + avbuf->plane_info[i].length = avbuf->buf.length; +- avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, +- PROT_READ | PROT_WRITE, MAP_SHARED, +- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.offset); ++ ++ if (want_mmap) ++ avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length, ++ PROT_READ | PROT_WRITE, MAP_SHARED, ++ buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.offset); + } + +- if (avbuf->plane_info[i].mm_addr == MAP_FAILED) +- return AVERROR(ENOMEM); ++ if (avbuf->plane_info[i].mm_addr == MAP_FAILED) { ++ avbuf->plane_info[i].mm_addr = NULL; ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } + } + + avbuf->status = V4L2BUF_AVAILABLE; + +- if (V4L2_TYPE_IS_OUTPUT(ctx->type)) +- return 0; +- + if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { + avbuf->buf.m.planes = avbuf->planes; + avbuf->buf.length = avbuf->num_planes; +@@ -555,20 +972,51 @@ int ff_v4l2_buffer_initialize(V4L2Buffer + avbuf->buf.length = avbuf->planes[0].length; + } + +- return ff_v4l2_buffer_enqueue(avbuf); ++ if (!V4L2_TYPE_IS_OUTPUT(ctx->type)) { ++ if (buf_to_m2mctx(avbuf)->output_drm) { ++ ret = v4l2_buffer_export_drm(avbuf); ++ if (ret) ++ goto fail; ++ } ++ } ++ ++ *pbufref = bufref; ++ return 0; ++ ++fail: ++ av_buffer_unref(&bufref); ++ return ret; + } + + int ff_v4l2_buffer_enqueue(V4L2Buffer* avbuf) + { + int ret; ++ int qc; + +- avbuf->buf.flags = avbuf->flags; ++ if (avbuf->buf.timestamp.tv_sec || avbuf->buf.timestamp.tv_usec) { ++ av_log(logger(avbuf), AV_LOG_DEBUG, "--- %s pre VIDIOC_QBUF: index %d, ts=%ld.%06ld count=%d\n", ++ avbuf->context->name, avbuf->buf.index, ++ avbuf->buf.timestamp.tv_sec, avbuf->buf.timestamp.tv_usec, ++ avbuf->context->q_count); ++ } + + ret = ioctl(buf_to_m2mctx(avbuf)->fd, VIDIOC_QBUF, &avbuf->buf); +- if (ret < 0) +- return AVERROR(errno); ++ if (ret < 0) { ++ int err = errno; ++ av_log(logger(avbuf), AV_LOG_ERROR, "--- %s VIDIOC_QBUF: index %d FAIL err %d (%s)\n", ++ avbuf->context->name, avbuf->buf.index, ++ err, strerror(err)); ++ return AVERROR(err); ++ } + ++ // Lock not wanted - if called from buffer free then lock already obtained ++ qc = atomic_fetch_add(&avbuf->context->q_count, 1) + 1; + avbuf->status = V4L2BUF_IN_DRIVER; ++ pthread_cond_broadcast(&avbuf->context->cond); ++ ++ av_log(logger(avbuf), AV_LOG_DEBUG, "--- %s VIDIOC_QBUF: index %d, ts=%ld.%06ld count=%d\n", ++ avbuf->context->name, avbuf->buf.index, ++ avbuf->buf.timestamp.tv_sec, avbuf->buf.timestamp.tv_usec, qc); + + return 0; + } +--- a/libavcodec/v4l2_buffers.h ++++ b/libavcodec/v4l2_buffers.h +@@ -27,25 +27,38 @@ + #include + #include + ++#include "libavutil/hwcontext_drm.h" + #include "avcodec.h" + + enum V4L2Buffer_status { + V4L2BUF_AVAILABLE, + V4L2BUF_IN_DRIVER, ++ V4L2BUF_IN_USE, + V4L2BUF_RET_USER, + }; + + /** + * V4L2Buffer (wrapper for v4l2_buffer management) + */ ++struct V4L2Context; ++struct ff_weak_link_client; ++ + typedef struct V4L2Buffer { +- /* each buffer needs to have a reference to its context */ ++ /* each buffer needs to have a reference to its context ++ * The pointer is good enough for most operation but once the buffer has ++ * been passed to the user the buffer may become orphaned so for free ops ++ * the weak link must be used to ensure that the context is actually ++ * there ++ */ + struct V4L2Context *context; ++ struct ff_weak_link_client *context_wl; + +- /* This object is refcounted per-plane, so we need to keep track +- * of how many context-refs we are holding. */ +- AVBufferRef *context_ref; +- atomic_uint context_refcount; ++ /* DRM descriptor */ ++ AVDRMFrameDescriptor drm_frame; ++ /* For DRM_PRIME encode - need to keep a ref to the source buffer till we ++ * are done ++ */ ++ AVBufferRef * ref_buf; + + /* keep track of the mmap address and mmap length */ + struct V4L2Plane_info { +@@ -60,7 +73,6 @@ typedef struct V4L2Buffer { + struct v4l2_buffer buf; + struct v4l2_plane planes[VIDEO_MAX_PLANES]; + +- int flags; + enum V4L2Buffer_status status; + + } V4L2Buffer; +@@ -98,6 +110,10 @@ int ff_v4l2_buffer_buf_to_avpkt(AVPacket + */ + int ff_v4l2_buffer_avpkt_to_buf(const AVPacket *pkt, V4L2Buffer *out); + ++int ff_v4l2_buffer_avpkt_to_buf_ext(const AVPacket * const pkt, V4L2Buffer * const out, ++ const void *extdata, size_t extlen, ++ const int64_t timestamp); ++ + /** + * Extracts the data from an AVFrame to a V4L2Buffer + * +@@ -106,7 +122,7 @@ int ff_v4l2_buffer_avpkt_to_buf(const AV + * + * @returns 0 in case of success, a negative AVERROR code otherwise + */ +-int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer *out); ++int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer *out, const int64_t track_ts); + + /** + * Initializes a V4L2Buffer +@@ -116,7 +132,7 @@ int ff_v4l2_buffer_avframe_to_buf(const + * + * @returns 0 in case of success, a negative AVERROR code otherwise + */ +-int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index); ++int ff_v4l2_buffer_initialize(AVBufferRef **avbuf, int index, struct V4L2Context *ctx, enum v4l2_memory mem); + + /** + * Enqueues a V4L2Buffer +@@ -127,5 +143,12 @@ int ff_v4l2_buffer_initialize(V4L2Buffer + */ + int ff_v4l2_buffer_enqueue(V4L2Buffer* avbuf); + ++static inline void ++ff_v4l2_buffer_set_avail(V4L2Buffer* const avbuf) ++{ ++ avbuf->status = V4L2BUF_AVAILABLE; ++ av_buffer_unref(&avbuf->ref_buf); ++} ++ + + #endif // AVCODEC_V4L2_BUFFERS_H +--- a/libavcodec/v4l2_context.c ++++ b/libavcodec/v4l2_context.c +@@ -27,11 +27,13 @@ + #include + #include + #include ++#include "libavutil/avassert.h" + #include "libavcodec/avcodec.h" + #include "libavcodec/internal.h" + #include "v4l2_buffers.h" + #include "v4l2_fmt.h" + #include "v4l2_m2m.h" ++#include "weak_link.h" + + struct v4l2_format_update { + uint32_t v4l2_fmt; +@@ -41,26 +43,168 @@ struct v4l2_format_update { + int update_avfmt; + }; + +-static inline V4L2m2mContext *ctx_to_m2mctx(V4L2Context *ctx) ++ ++static inline int64_t track_to_pts(AVCodecContext *avctx, unsigned int n) + { +- return V4L2_TYPE_IS_OUTPUT(ctx->type) ? +- container_of(ctx, V4L2m2mContext, output) : +- container_of(ctx, V4L2m2mContext, capture); ++ return (int64_t)n; + } + +-static inline AVCodecContext *logger(V4L2Context *ctx) ++static inline unsigned int pts_to_track(AVCodecContext *avctx, const int64_t pts) + { +- return ctx_to_m2mctx(ctx)->avctx; ++ return (unsigned int)pts; + } + +-static inline unsigned int v4l2_get_width(struct v4l2_format *fmt) ++// FFmpeg requires us to propagate a number of vars from the coded pkt into ++// the decoded frame. The only thing that tracks like that in V4L2 stateful ++// is timestamp. PTS maps to timestamp for this decode. FFmpeg makes no ++// guarantees about PTS being unique or specified for every frame so replace ++// the supplied PTS with a simple incrementing number and keep a circular ++// buffer of all the things we want preserved (including the original PTS) ++// indexed by the tracking no. ++static int64_t ++xlat_pts_pkt_in(AVCodecContext *const avctx, xlat_track_t *const x, const AVPacket *const avpkt) + { +- return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.width : fmt->fmt.pix.width; ++ int64_t track_pts; ++ ++ // Avoid 0 ++ if (++x->track_no == 0) ++ x->track_no = 1; ++ ++ track_pts = track_to_pts(avctx, x->track_no); ++ ++ av_log(avctx, AV_LOG_TRACE, "In pkt PTS=%" PRId64 ", DTS=%" PRId64 ", track=%" PRId64 ", n=%u\n", avpkt->pts, avpkt->dts, track_pts, x->track_no); ++ x->track_els[x->track_no % FF_V4L2_M2M_TRACK_SIZE] = (V4L2m2mTrackEl){ ++ .discard = 0, ++ .pending = 1, ++ .pkt_size = avpkt->size, ++ .pts = avpkt->pts, ++ .dts = avpkt->dts, ++ .reordered_opaque = avctx->reordered_opaque, ++ .pkt_pos = avpkt->pos, ++ .pkt_duration = avpkt->duration, ++ .track_pts = track_pts ++ }; ++ return track_pts; + } + +-static inline unsigned int v4l2_get_height(struct v4l2_format *fmt) ++static int64_t ++xlat_pts_frame_in(AVCodecContext *const avctx, xlat_track_t *const x, const AVFrame *const frame) + { +- return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.height : fmt->fmt.pix.height; ++ int64_t track_pts; ++ ++ // Avoid 0 ++ if (++x->track_no == 0) ++ x->track_no = 1; ++ ++ track_pts = track_to_pts(avctx, x->track_no); ++ ++ av_log(avctx, AV_LOG_TRACE, "In frame PTS=%" PRId64 ", track=%" PRId64 ", n=%u\n", frame->pts, track_pts, x->track_no); ++ x->track_els[x->track_no % FF_V4L2_M2M_TRACK_SIZE] = (V4L2m2mTrackEl){ ++ .discard = 0, ++ .pending = 1, ++ .pkt_size = 0, ++ .pts = frame->pts, ++ .dts = AV_NOPTS_VALUE, ++ .reordered_opaque = frame->reordered_opaque, ++ .pkt_pos = frame->pkt_pos, ++ .pkt_duration = frame->pkt_duration, ++ .track_pts = track_pts ++ }; ++ return track_pts; ++} ++ ++ ++// Returns -1 if we should discard the frame ++static int ++xlat_pts_frame_out(AVCodecContext *const avctx, ++ xlat_track_t * const x, ++ AVFrame *const frame) ++{ ++ unsigned int n = pts_to_track(avctx, frame->pts) % FF_V4L2_M2M_TRACK_SIZE; ++ V4L2m2mTrackEl *const t = x->track_els + n; ++ if (frame->pts == AV_NOPTS_VALUE || frame->pts != t->track_pts) ++ { ++ av_log(avctx, frame->pts == AV_NOPTS_VALUE ? AV_LOG_DEBUG : AV_LOG_WARNING, ++ "Frame tracking failure: pts=%" PRId64 ", track[%d]=%" PRId64 "\n", frame->pts, n, t->track_pts); ++ frame->pts = AV_NOPTS_VALUE; ++ frame->pkt_dts = AV_NOPTS_VALUE; ++ frame->reordered_opaque = x->last_opaque; ++ frame->pkt_pos = -1; ++ frame->pkt_duration = 0; ++ frame->pkt_size = -1; ++ } ++ else if (!t->discard) ++ { ++ frame->pts = t->pending ? t->pts : AV_NOPTS_VALUE; ++ frame->pkt_dts = t->dts; ++ frame->reordered_opaque = t->reordered_opaque; ++ frame->pkt_pos = t->pkt_pos; ++ frame->pkt_duration = t->pkt_duration; ++ frame->pkt_size = t->pkt_size; ++ ++ x->last_opaque = x->track_els[n].reordered_opaque; ++ if (frame->pts != AV_NOPTS_VALUE) ++ x->last_pts = frame->pts; ++ t->pending = 0; ++ } ++ else ++ { ++ av_log(avctx, AV_LOG_DEBUG, "Discard frame (flushed): pts=%" PRId64 ", track[%d]=%" PRId64 "\n", frame->pts, n, t->track_pts); ++ return -1; ++ } ++ ++ av_log(avctx, AV_LOG_TRACE, "Out frame PTS=%" PRId64 "/%"PRId64", DTS=%" PRId64 ", track=%"PRId64", n=%d\n", ++ frame->pts, frame->best_effort_timestamp, frame->pkt_dts, t->track_pts, n); ++ return 0; ++} ++ ++// Returns -1 if we should discard the frame ++static int ++xlat_pts_pkt_out(AVCodecContext *const avctx, ++ xlat_track_t * const x, ++ AVPacket *const pkt) ++{ ++ unsigned int n = pts_to_track(avctx, pkt->pts) % FF_V4L2_M2M_TRACK_SIZE; ++ V4L2m2mTrackEl *const t = x->track_els + n; ++ if (pkt->pts == AV_NOPTS_VALUE || pkt->pts != t->track_pts) ++ { ++ av_log(avctx, pkt->pts == AV_NOPTS_VALUE ? AV_LOG_DEBUG : AV_LOG_WARNING, ++ "Pkt tracking failure: pts=%" PRId64 ", track[%d]=%" PRId64 "\n", pkt->pts, n, t->track_pts); ++ pkt->pts = AV_NOPTS_VALUE; ++ } ++ else if (!t->discard) ++ { ++ pkt->pts = t->pending ? t->pts : AV_NOPTS_VALUE; ++ ++ x->last_opaque = x->track_els[n].reordered_opaque; ++ if (pkt->pts != AV_NOPTS_VALUE) ++ x->last_pts = pkt->pts; ++ t->pending = 0; ++ } ++ else ++ { ++ av_log(avctx, AV_LOG_DEBUG, "Discard packet (flushed): pts=%" PRId64 ", track[%d]=%" PRId64 "\n", pkt->pts, n, t->track_pts); ++ return -1; ++ } ++ ++ // * Would like something much better than this...xlat(offset + out_count)? ++ pkt->dts = pkt->pts; ++ av_log(avctx, AV_LOG_TRACE, "Out pkt PTS=%" PRId64 ", track=%"PRId64", n=%d\n", ++ pkt->pts, t->track_pts, n); ++ return 0; ++} ++ ++ ++static inline V4L2m2mContext *ctx_to_m2mctx(const V4L2Context *ctx) ++{ ++ return V4L2_TYPE_IS_OUTPUT(ctx->type) ? ++ container_of(ctx, V4L2m2mContext, output) : ++ container_of(ctx, V4L2m2mContext, capture); ++} ++ ++static inline AVCodecContext *logger(const V4L2Context *ctx) ++{ ++ return ctx_to_m2mctx(ctx)->avctx; + } + + static AVRational v4l2_get_sar(V4L2Context *ctx) +@@ -81,21 +225,29 @@ static AVRational v4l2_get_sar(V4L2Conte + return sar; + } + +-static inline unsigned int v4l2_resolution_changed(V4L2Context *ctx, struct v4l2_format *fmt2) ++static inline int ctx_buffers_alloced(const V4L2Context * const ctx) ++{ ++ return ctx->bufrefs != NULL; ++} ++ ++// Width/Height changed or we don't have an alloc in the first place? ++static int ctx_resolution_changed(const V4L2Context *ctx, const struct v4l2_format *fmt2) + { +- struct v4l2_format *fmt1 = &ctx->format; +- int ret = V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? +- fmt1->fmt.pix_mp.width != fmt2->fmt.pix_mp.width || +- fmt1->fmt.pix_mp.height != fmt2->fmt.pix_mp.height +- : +- fmt1->fmt.pix.width != fmt2->fmt.pix.width || +- fmt1->fmt.pix.height != fmt2->fmt.pix.height; ++ const struct v4l2_format *fmt1 = &ctx->format; ++ int ret = !ctx_buffers_alloced(ctx) || ++ (V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? ++ fmt1->fmt.pix_mp.width != fmt2->fmt.pix_mp.width || ++ fmt1->fmt.pix_mp.height != fmt2->fmt.pix_mp.height ++ : ++ fmt1->fmt.pix.width != fmt2->fmt.pix.width || ++ fmt1->fmt.pix.height != fmt2->fmt.pix.height); + + if (ret) +- av_log(logger(ctx), AV_LOG_DEBUG, "%s changed (%dx%d) -> (%dx%d)\n", ++ av_log(logger(ctx), AV_LOG_DEBUG, "V4L2 %s changed: alloc=%d (%dx%d) -> (%dx%d)\n", + ctx->name, +- v4l2_get_width(fmt1), v4l2_get_height(fmt1), +- v4l2_get_width(fmt2), v4l2_get_height(fmt2)); ++ ctx_buffers_alloced(ctx), ++ ff_v4l2_get_format_width(fmt1), ff_v4l2_get_format_height(fmt1), ++ ff_v4l2_get_format_width(fmt2), ff_v4l2_get_format_height(fmt2)); + + return ret; + } +@@ -153,90 +305,110 @@ static inline void v4l2_save_to_context( + } + } + +-/** +- * handle resolution change event and end of stream event +- * returns 1 if reinit was successful, negative if it failed +- * returns 0 if reinit was not executed +- */ +-static int v4l2_handle_event(V4L2Context *ctx) ++static int get_default_selection(V4L2Context * const ctx, struct v4l2_rect *r) + { +- V4L2m2mContext *s = ctx_to_m2mctx(ctx); +- struct v4l2_format cap_fmt = s->capture.format; +- struct v4l2_format out_fmt = s->output.format; +- struct v4l2_event evt = { 0 }; +- int full_reinit, reinit, ret; ++ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); ++ struct v4l2_selection selection = { ++ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, ++ .target = V4L2_SEL_TGT_COMPOSE ++ }; + +- ret = ioctl(s->fd, VIDIOC_DQEVENT, &evt); +- if (ret < 0) { +- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_DQEVENT\n", ctx->name); +- return 0; +- } ++ memset(r, 0, sizeof(*r)); ++ if (ioctl(s->fd, VIDIOC_G_SELECTION, &selection)) ++ return AVERROR(errno); + +- if (evt.type == V4L2_EVENT_EOS) { +- ctx->done = 1; +- return 0; +- } ++ *r = selection.r; ++ return 0; ++} + +- if (evt.type != V4L2_EVENT_SOURCE_CHANGE) +- return 0; ++static int do_source_change(V4L2m2mContext * const s) ++{ ++ AVCodecContext *const avctx = s->avctx; + +- ret = ioctl(s->fd, VIDIOC_G_FMT, &out_fmt); +- if (ret) { +- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", s->output.name); +- return 0; +- } ++ int ret; ++ int reinit; ++ struct v4l2_format cap_fmt = s->capture.format; ++ ++ s->capture.done = 0; + + ret = ioctl(s->fd, VIDIOC_G_FMT, &cap_fmt); + if (ret) { +- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT\n", s->capture.name); ++ av_log(avctx, AV_LOG_ERROR, "%s VIDIOC_G_FMT failed\n", s->capture.name); + return 0; + } + +- full_reinit = v4l2_resolution_changed(&s->output, &out_fmt); +- if (full_reinit) { +- s->output.height = v4l2_get_height(&out_fmt); +- s->output.width = v4l2_get_width(&out_fmt); +- s->output.sample_aspect_ratio = v4l2_get_sar(&s->output); +- } ++ get_default_selection(&s->capture, &s->capture.selection); ++ ++ reinit = ctx_resolution_changed(&s->capture, &cap_fmt); ++ if ((s->quirks & FF_V4L2_QUIRK_REINIT_ALWAYS) != 0) ++ reinit = 1; + +- reinit = v4l2_resolution_changed(&s->capture, &cap_fmt); ++ s->capture.format = cap_fmt; + if (reinit) { +- s->capture.height = v4l2_get_height(&cap_fmt); +- s->capture.width = v4l2_get_width(&cap_fmt); +- s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture); ++ s->capture.height = ff_v4l2_get_format_height(&cap_fmt); ++ s->capture.width = ff_v4l2_get_format_width(&cap_fmt); + } + +- if (full_reinit || reinit) +- s->reinit = 1; +- +- if (full_reinit) { +- ret = ff_v4l2_m2m_codec_full_reinit(s); +- if (ret) { +- av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_full_reinit\n"); +- return AVERROR(EINVAL); +- } +- goto reinit_run; ++ // If we don't support selection (or it is bust) and we obviously have HD then kludge ++ if ((s->capture.selection.width == 0 || s->capture.selection.height == 0) && ++ (s->capture.height == 1088 && s->capture.width == 1920)) { ++ s->capture.selection = (struct v4l2_rect){.width = 1920, .height = 1080}; + } + ++ s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture); ++ ++ av_log(avctx, AV_LOG_DEBUG, "Source change: SAR: %d/%d, wxh %dx%d crop %dx%d @ %d,%d, reinit=%d\n", ++ s->capture.sample_aspect_ratio.num, s->capture.sample_aspect_ratio.den, ++ s->capture.width, s->capture.height, ++ s->capture.selection.width, s->capture.selection.height, ++ s->capture.selection.left, s->capture.selection.top, reinit); ++ + if (reinit) { +- if (s->avctx) +- ret = ff_set_dimensions(s->avctx, s->capture.width, s->capture.height); ++ if (avctx) ++ ret = ff_set_dimensions(s->avctx, ++ s->capture.selection.width != 0 ? s->capture.selection.width : s->capture.width, ++ s->capture.selection.height != 0 ? s->capture.selection.height : s->capture.height); + if (ret < 0) +- av_log(logger(ctx), AV_LOG_WARNING, "update avcodec height and width\n"); ++ av_log(avctx, AV_LOG_WARNING, "update avcodec height and width failed\n"); + + ret = ff_v4l2_m2m_codec_reinit(s); + if (ret) { +- av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_reinit\n"); ++ av_log(avctx, AV_LOG_ERROR, "v4l2_m2m_codec_reinit failed\n"); + return AVERROR(EINVAL); + } ++ ++ if (s->capture.width > ff_v4l2_get_format_width(&s->capture.format) || ++ s->capture.height > ff_v4l2_get_format_height(&s->capture.format)) { ++ av_log(avctx, AV_LOG_ERROR, "Format post reinit too small: wanted %dx%d > got %dx%d\n", ++ s->capture.width, s->capture.height, ++ ff_v4l2_get_format_width(&s->capture.format), ff_v4l2_get_format_height(&s->capture.format)); ++ return AVERROR(EINVAL); ++ } ++ ++ // Update pixel format - should only actually do something on initial change ++ s->capture.av_pix_fmt = ++ ff_v4l2_format_v4l2_to_avfmt(ff_v4l2_get_format_pixelformat(&s->capture.format), AV_CODEC_ID_RAWVIDEO); ++ if (s->output_drm) { ++ avctx->pix_fmt = AV_PIX_FMT_DRM_PRIME; ++ avctx->sw_pix_fmt = s->capture.av_pix_fmt; ++ } ++ else ++ avctx->pix_fmt = s->capture.av_pix_fmt; ++ + goto reinit_run; + } + +- /* dummy event received */ +- return 0; ++ /* Buffers are OK so just stream off to ack */ ++ av_log(avctx, AV_LOG_DEBUG, "%s: Parameters only - restart decode\n", __func__); ++ ++ ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); ++ if (ret) ++ av_log(avctx, AV_LOG_ERROR, "capture VIDIOC_STREAMOFF failed\n"); ++ s->draining = 0; + + /* reinit executed */ + reinit_run: ++ ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMON); + return 1; + } + +@@ -280,171 +452,277 @@ static int v4l2_stop_encode(V4L2Context + return 0; + } + +-static V4L2Buffer* v4l2_dequeue_v4l2buf(V4L2Context *ctx, int timeout) +-{ +- struct v4l2_plane planes[VIDEO_MAX_PLANES]; +- struct v4l2_buffer buf = { 0 }; +- V4L2Buffer *avbuf; +- struct pollfd pfd = { +- .events = POLLIN | POLLRDNORM | POLLPRI | POLLOUT | POLLWRNORM, /* default blocking capture */ +- .fd = ctx_to_m2mctx(ctx)->fd, ++// DQ a buffer ++// Amalgamates all the various ways there are of signalling EOS/Event to ++// generate a consistant EPIPE. ++// ++// Sets ctx->flag_last if next dq would produce EPIPE (i.e. stream has stopped) ++// ++// Returns: ++// 0 Success ++// AVERROR(EPIPE) Nothing more to read ++// AVERROR(ENOSPC) No buffers in Q to put result in ++// * AVERROR(..) ++ ++ static int ++dq_buf(V4L2Context * const ctx, V4L2Buffer ** const ppavbuf) ++{ ++ V4L2m2mContext * const m = ctx_to_m2mctx(ctx); ++ AVCodecContext * const avctx = m->avctx; ++ V4L2Buffer * avbuf; ++ const int is_mp = V4L2_TYPE_IS_MULTIPLANAR(ctx->type); ++ ++ struct v4l2_plane planes[VIDEO_MAX_PLANES] = {{0}}; ++ ++ struct v4l2_buffer buf = { ++ .type = ctx->type, ++ .memory = V4L2_MEMORY_MMAP, + }; +- int i, ret; + +- if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx->buffers) { +- for (i = 0; i < ctx->num_buffers; i++) { +- if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER) +- break; +- } +- if (i == ctx->num_buffers) +- av_log(logger(ctx), AV_LOG_WARNING, "All capture buffers returned to " +- "userspace. Increase num_capture_buffers " +- "to prevent device deadlock or dropped " +- "packets/frames.\n"); +- } +- +- /* if we are draining and there are no more capture buffers queued in the driver we are done */ +- if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx_to_m2mctx(ctx)->draining) { +- for (i = 0; i < ctx->num_buffers; i++) { +- /* capture buffer initialization happens during decode hence +- * detection happens at runtime +- */ +- if (!ctx->buffers) +- break; +- +- if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER) +- goto start; +- } +- ctx->done = 1; +- return NULL; +- } +- +-start: +- if (V4L2_TYPE_IS_OUTPUT(ctx->type)) +- pfd.events = POLLOUT | POLLWRNORM; +- else { +- /* no need to listen to requests for more input while draining */ +- if (ctx_to_m2mctx(ctx)->draining) +- pfd.events = POLLIN | POLLRDNORM | POLLPRI; ++ *ppavbuf = NULL; ++ ++ if (ctx->flag_last) ++ return AVERROR(EPIPE); ++ ++ if (is_mp) { ++ buf.length = VIDEO_MAX_PLANES; ++ buf.m.planes = planes; + } + +- for (;;) { +- ret = poll(&pfd, 1, timeout); +- if (ret > 0) +- break; +- if (errno == EINTR) +- continue; +- return NULL; ++ while (ioctl(m->fd, VIDIOC_DQBUF, &buf) != 0) { ++ const int err = errno; ++ av_assert0(AVERROR(err) < 0); ++ if (err != EINTR) { ++ av_log(avctx, AV_LOG_DEBUG, "%s VIDIOC_DQBUF, errno (%s)\n", ++ ctx->name, av_err2str(AVERROR(err))); ++ ++ if (err == EPIPE) ++ ctx->flag_last = 1; ++ ++ return AVERROR(err); ++ } + } ++ atomic_fetch_sub(&ctx->q_count, 1); + +- /* 0. handle errors */ +- if (pfd.revents & POLLERR) { +- /* if we are trying to get free buffers but none have been queued yet +- no need to raise a warning */ +- if (timeout == 0) { +- for (i = 0; i < ctx->num_buffers; i++) { +- if (ctx->buffers[i].status != V4L2BUF_AVAILABLE) +- av_log(logger(ctx), AV_LOG_WARNING, "%s POLLERR\n", ctx->name); +- } ++ avbuf = (V4L2Buffer *)ctx->bufrefs[buf.index]->data; ++ ff_v4l2_buffer_set_avail(avbuf); ++ avbuf->buf = buf; ++ if (is_mp) { ++ memcpy(avbuf->planes, planes, sizeof(planes)); ++ avbuf->buf.m.planes = avbuf->planes; ++ } ++ // Done with any attached buffer ++ av_buffer_unref(&avbuf->ref_buf); ++ ++ if (V4L2_TYPE_IS_CAPTURE(ctx->type)) { ++ // Zero length cap buffer return == EOS ++ if ((is_mp ? buf.m.planes[0].bytesused : buf.bytesused) == 0) { ++ av_log(avctx, AV_LOG_DEBUG, "Buffer empty - reQ\n"); ++ ++ // Must reQ so we don't leak ++ // May not matter if the next thing we do is release all the ++ // buffers but better to be tidy. ++ ff_v4l2_buffer_enqueue(avbuf); ++ ++ ctx->flag_last = 1; ++ return AVERROR(EPIPE); + } +- else +- av_log(logger(ctx), AV_LOG_WARNING, "%s POLLERR\n", ctx->name); + +- return NULL; ++#ifdef V4L2_BUF_FLAG_LAST ++ // If flag_last set then this contains data but is the last frame ++ // so remember that but return OK ++ if ((buf.flags & V4L2_BUF_FLAG_LAST) != 0) ++ ctx->flag_last = 1; ++#endif + } + +- /* 1. handle resolution changes */ +- if (pfd.revents & POLLPRI) { +- ret = v4l2_handle_event(ctx); +- if (ret < 0) { +- /* if re-init failed, abort */ +- ctx->done = 1; +- return NULL; +- } +- if (ret) { +- /* if re-init was successful drop the buffer (if there was one) +- * since we had to reconfigure capture (unmap all buffers) +- */ +- return NULL; ++ *ppavbuf = avbuf; ++ return 0; ++} ++ ++/** ++ * handle resolution change event and end of stream event ++ * Expects to be called after the stream has stopped ++ * ++ * returns 1 if reinit was successful, negative if it failed ++ * returns 0 if reinit was not executed ++ */ ++static int ++get_event(V4L2m2mContext * const m) ++{ ++ AVCodecContext * const avctx = m->avctx; ++ struct v4l2_event evt = { 0 }; ++ ++ while (ioctl(m->fd, VIDIOC_DQEVENT, &evt) != 0) { ++ const int rv = AVERROR(errno); ++ if (rv == AVERROR(EINTR)) ++ continue; ++ if (rv == AVERROR(EAGAIN)) { ++ av_log(avctx, AV_LOG_WARNING, "V4L2 failed to get expected event - assume EOS\n"); ++ return AVERROR_EOF; + } ++ av_log(avctx, AV_LOG_ERROR, "V4L2 VIDIOC_DQEVENT: %s\n", av_err2str(rv)); ++ return rv; + } + +- /* 2. dequeue the buffer */ +- if (pfd.revents & (POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM)) { ++ av_log(avctx, AV_LOG_DEBUG, "Dq event %d\n", evt.type); + +- if (!V4L2_TYPE_IS_OUTPUT(ctx->type)) { +- /* there is a capture buffer ready */ +- if (pfd.revents & (POLLIN | POLLRDNORM)) +- goto dequeue; ++ if (evt.type == V4L2_EVENT_EOS) { ++ av_log(avctx, AV_LOG_TRACE, "V4L2 VIDIOC_EVENT_EOS\n"); ++ return AVERROR_EOF; ++ } ++ ++ if (evt.type == V4L2_EVENT_SOURCE_CHANGE) ++ return do_source_change(m); ++ ++ return 0; ++} ++ ++ ++// Get a buffer ++// If output then just gets the buffer in the expected way ++// If capture then runs the capture state m/c to deal with res change etc. ++// If return value == 0 then *ppavbuf != NULL ++ ++static int ++get_qbuf(V4L2Context * const ctx, V4L2Buffer ** const ppavbuf, const int timeout) ++{ ++ V4L2m2mContext * const m = ctx_to_m2mctx(ctx); ++ AVCodecContext * const avctx = m->avctx; ++ const int is_cap = V4L2_TYPE_IS_CAPTURE(ctx->type); ++ ++ const unsigned int poll_cap = (POLLIN | POLLRDNORM); ++ const unsigned int poll_out = (POLLOUT | POLLWRNORM); ++ const unsigned int poll_event = POLLPRI; ++ ++ *ppavbuf = NULL; + +- /* the driver is ready to accept more input; instead of waiting for the capture +- * buffer to complete we return NULL so input can proceed (we are single threaded) +- */ +- if (pfd.revents & (POLLOUT | POLLWRNORM)) +- return NULL; ++ for (;;) { ++ struct pollfd pfd = { ++ .fd = m->fd, ++ // If capture && stream not started then assume we are waiting for the initial event ++ .events = !is_cap ? poll_out : ++ !ff_v4l2_ctx_eos(ctx) && ctx->streamon ? poll_cap : ++ poll_event, ++ }; ++ int ret; ++ ++ if (ctx->done) { ++ av_log(avctx, AV_LOG_TRACE, "V4L2 %s already done\n", ctx->name); ++ return AVERROR_EOF; + } + +-dequeue: +- memset(&buf, 0, sizeof(buf)); +- buf.memory = V4L2_MEMORY_MMAP; +- buf.type = ctx->type; +- if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { +- memset(planes, 0, sizeof(planes)); +- buf.length = VIDEO_MAX_PLANES; +- buf.m.planes = planes; ++ // If capture && timeout == -1 then also wait for rx buffer free ++ if (is_cap && timeout == -1 && m->output.streamon && !m->draining) ++ pfd.events |= poll_out; ++ ++ // If nothing Qed all we will get is POLLERR - avoid that ++ if ((pfd.events == poll_out && atomic_load(&m->output.q_count) == 0) || ++ (pfd.events == poll_cap && atomic_load(&m->capture.q_count) == 0) || ++ (pfd.events == (poll_cap | poll_out) && atomic_load(&m->capture.q_count) == 0 && atomic_load(&m->output.q_count) == 0)) { ++ av_log(avctx, AV_LOG_TRACE, "V4L2 poll %s empty\n", ctx->name); ++ return AVERROR(ENOSPC); + } + +- ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_DQBUF, &buf); +- if (ret) { +- if (errno != EAGAIN) { +- ctx->done = 1; +- if (errno != EPIPE) +- av_log(logger(ctx), AV_LOG_DEBUG, "%s VIDIOC_DQBUF, errno (%s)\n", +- ctx->name, av_err2str(AVERROR(errno))); ++ // Timeout kludged s.t. "forever" eventually gives up & produces logging ++ // If waiting for an event when we have seen a last_frame then we expect ++ // it to be ready already so force a short timeout ++ ret = poll(&pfd, 1, ++ ff_v4l2_ctx_eos(ctx) ? 10 : ++ timeout == -1 ? 3000 : timeout); ++ if (ret < 0) { ++ ret = AVERROR(errno); // Remember errno before logging etc. ++ av_assert0(ret < 0); ++ } ++ ++ av_log(avctx, AV_LOG_TRACE, "V4L2 poll %s ret=%d, timeout=%d, events=%#x, revents=%#x\n", ++ ctx->name, ret, timeout, pfd.events, pfd.revents); ++ ++ if (ret < 0) { ++ if (ret == AVERROR(EINTR)) ++ continue; ++ av_log(avctx, AV_LOG_ERROR, "V4L2 %s poll error %d (%s)\n", ctx->name, AVUNERROR(ret), av_err2str(ret)); ++ return ret; ++ } ++ ++ if (ret == 0) { ++ if (timeout == -1) ++ av_log(avctx, AV_LOG_ERROR, "V4L2 %s poll unexpected timeout: events=%#x\n", ctx->name, pfd.events); ++ if (ff_v4l2_ctx_eos(ctx)) { ++ av_log(avctx, AV_LOG_WARNING, "V4L2 %s poll event timeout\n", ctx->name); ++ ret = get_event(m); ++ if (ret < 0) { ++ ctx->done = 1; ++ return ret; ++ } + } +- return NULL; ++ return AVERROR(EAGAIN); + } + +- if (ctx_to_m2mctx(ctx)->draining && !V4L2_TYPE_IS_OUTPUT(ctx->type)) { +- int bytesused = V4L2_TYPE_IS_MULTIPLANAR(buf.type) ? +- buf.m.planes[0].bytesused : buf.bytesused; +- if (bytesused == 0) { ++ if ((pfd.revents & POLLERR) != 0) { ++ av_log(avctx, AV_LOG_WARNING, "V4L2 %s POLLERR\n", ctx->name); ++ return AVERROR_UNKNOWN; ++ } ++ ++ if ((pfd.revents & poll_event) != 0) { ++ ret = get_event(m); ++ if (ret < 0) { + ctx->done = 1; +- return NULL; ++ return ret; + } +-#ifdef V4L2_BUF_FLAG_LAST +- if (buf.flags & V4L2_BUF_FLAG_LAST) +- ctx->done = 1; +-#endif ++ continue; ++ } ++ ++ if ((pfd.revents & poll_cap) != 0) { ++ ret = dq_buf(ctx, ppavbuf); ++ if (ret == AVERROR(EPIPE)) ++ continue; ++ return ret; + } + +- avbuf = &ctx->buffers[buf.index]; +- avbuf->status = V4L2BUF_AVAILABLE; +- avbuf->buf = buf; +- if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) { +- memcpy(avbuf->planes, planes, sizeof(planes)); +- avbuf->buf.m.planes = avbuf->planes; ++ if ((pfd.revents & poll_out) != 0) { ++ if (is_cap) ++ return AVERROR(EAGAIN); ++ return dq_buf(ctx, ppavbuf); + } +- return avbuf; ++ ++ av_log(avctx, AV_LOG_ERROR, "V4L2 poll unexpected events=%#x, revents=%#x\n", pfd.events, pfd.revents); ++ return AVERROR_UNKNOWN; + } ++} + +- return NULL; ++// Clear out flags and timestamps that should should be set by the user ++// Returns the passed avbuf ++static V4L2Buffer * ++clean_v4l2_buffer(V4L2Buffer * const avbuf) ++{ ++ struct v4l2_buffer *const buf = &avbuf->buf; ++ ++ buf->flags = 0; ++ buf->field = V4L2_FIELD_ANY; ++ buf->timestamp = (struct timeval){0}; ++ buf->timecode = (struct v4l2_timecode){0}; ++ buf->sequence = 0; ++ ++ return avbuf; + } + + static V4L2Buffer* v4l2_getfree_v4l2buf(V4L2Context *ctx) + { +- int timeout = 0; /* return when no more buffers to dequeue */ + int i; + + /* get back as many output buffers as possible */ + if (V4L2_TYPE_IS_OUTPUT(ctx->type)) { +- do { +- } while (v4l2_dequeue_v4l2buf(ctx, timeout)); ++ V4L2Buffer * avbuf; ++ do { ++ get_qbuf(ctx, &avbuf, 0); ++ } while (avbuf); + } + + for (i = 0; i < ctx->num_buffers; i++) { +- if (ctx->buffers[i].status == V4L2BUF_AVAILABLE) +- return &ctx->buffers[i]; ++ V4L2Buffer * const avbuf = (V4L2Buffer *)ctx->bufrefs[i]->data; ++ if (avbuf->status == V4L2BUF_AVAILABLE) ++ return clean_v4l2_buffer(avbuf); + } + + return NULL; +@@ -452,25 +730,45 @@ static V4L2Buffer* v4l2_getfree_v4l2buf( + + static int v4l2_release_buffers(V4L2Context* ctx) + { +- struct v4l2_requestbuffers req = { +- .memory = V4L2_MEMORY_MMAP, +- .type = ctx->type, +- .count = 0, /* 0 -> unmaps buffers from the driver */ +- }; +- int i, j; ++ int i; ++ int ret = 0; ++ const int fd = ctx_to_m2mctx(ctx)->fd; + +- for (i = 0; i < ctx->num_buffers; i++) { +- V4L2Buffer *buffer = &ctx->buffers[i]; ++ // Orphan any buffers in the wild ++ ff_weak_link_break(&ctx->wl_master); + +- for (j = 0; j < buffer->num_planes; j++) { +- struct V4L2Plane_info *p = &buffer->plane_info[j]; +- if (p->mm_addr && p->length) +- if (munmap(p->mm_addr, p->length) < 0) +- av_log(logger(ctx), AV_LOG_ERROR, "%s unmap plane (%s))\n", ctx->name, av_err2str(AVERROR(errno))); ++ if (ctx->bufrefs) { ++ for (i = 0; i < ctx->num_buffers; i++) ++ av_buffer_unref(ctx->bufrefs + i); ++ } ++ ++ if (fd != -1) { ++ struct v4l2_requestbuffers req = { ++ .memory = V4L2_MEMORY_MMAP, ++ .type = ctx->type, ++ .count = 0, /* 0 -> unmap all buffers from the driver */ ++ }; ++ ++ while ((ret = ioctl(fd, VIDIOC_REQBUFS, &req)) == -1) { ++ if (errno == EINTR) ++ continue; ++ ++ ret = AVERROR(errno); ++ ++ av_log(logger(ctx), AV_LOG_ERROR, "release all %s buffers (%s)\n", ++ ctx->name, av_err2str(AVERROR(errno))); ++ ++ if (ctx_to_m2mctx(ctx)->output_drm) ++ av_log(logger(ctx), AV_LOG_ERROR, ++ "Make sure the DRM client releases all FB/GEM objects before closing the codec (ie):\n" ++ "for all buffers: \n" ++ " 1. drmModeRmFB(..)\n" ++ " 2. drmIoctl(.., DRM_IOCTL_GEM_CLOSE,... )\n"); + } + } ++ atomic_store(&ctx->q_count, 0); + +- return ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_REQBUFS, &req); ++ return ret; + } + + static inline int v4l2_try_raw_format(V4L2Context* ctx, enum AVPixelFormat pixfmt) +@@ -499,6 +797,8 @@ static inline int v4l2_try_raw_format(V4 + + static int v4l2_get_raw_format(V4L2Context* ctx, enum AVPixelFormat *p) + { ++ V4L2m2mContext* s = ctx_to_m2mctx(ctx); ++ V4L2m2mPriv *priv = s->avctx->priv_data; + enum AVPixelFormat pixfmt = ctx->av_pix_fmt; + struct v4l2_fmtdesc fdesc; + int ret; +@@ -517,6 +817,13 @@ static int v4l2_get_raw_format(V4L2Conte + if (ret) + return AVERROR(EINVAL); + ++ if (priv->pix_fmt != AV_PIX_FMT_NONE) { ++ if (fdesc.pixelformat != ff_v4l2_format_avfmt_to_v4l2(priv->pix_fmt)) { ++ fdesc.index++; ++ continue; ++ } ++ } ++ + pixfmt = ff_v4l2_format_v4l2_to_avfmt(fdesc.pixelformat, AV_CODEC_ID_RAWVIDEO); + ret = v4l2_try_raw_format(ctx, pixfmt); + if (ret){ +@@ -569,30 +876,99 @@ static int v4l2_get_coded_format(V4L2Con + * + *****************************************************************************/ + ++ ++static void flush_all_buffers_status(V4L2Context* const ctx) ++{ ++ int i; ++ ++ if (!ctx->bufrefs) ++ return; ++ ++ for (i = 0; i < ctx->num_buffers; ++i) { ++ struct V4L2Buffer * const buf = (struct V4L2Buffer *)ctx->bufrefs[i]->data; ++ if (buf->status == V4L2BUF_IN_DRIVER) ++ ff_v4l2_buffer_set_avail(buf); ++ } ++ atomic_store(&ctx->q_count, 0); ++} ++ ++static int stuff_all_buffers(AVCodecContext * avctx, V4L2Context* ctx) ++{ ++ int i; ++ int rv; ++ ++ if (!ctx->bufrefs) { ++ rv = ff_v4l2_context_init(ctx); ++ if (rv) { ++ av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n"); ++ return rv; ++ } ++ } ++ ++ for (i = 0; i < ctx->num_buffers; ++i) { ++ struct V4L2Buffer * const buf = (struct V4L2Buffer *)ctx->bufrefs[i]->data; ++ if (buf->status == V4L2BUF_AVAILABLE) { ++ rv = ff_v4l2_buffer_enqueue(buf); ++ if (rv < 0) ++ return rv; ++ } ++ } ++ return 0; ++} ++ + int ff_v4l2_context_set_status(V4L2Context* ctx, uint32_t cmd) + { + int type = ctx->type; +- int ret; ++ int ret = 0; ++ AVCodecContext * const avctx = logger(ctx); + +- ret = ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type); +- if (ret < 0) +- return AVERROR(errno); ++ // Avoid doing anything if there is nothing we can do ++ if (cmd == VIDIOC_STREAMOFF && !ctx_buffers_alloced(ctx) && !ctx->streamon) ++ return 0; + +- ctx->streamon = (cmd == VIDIOC_STREAMON); ++ ff_mutex_lock(&ctx->lock); + +- return 0; ++ if (cmd == VIDIOC_STREAMON && !V4L2_TYPE_IS_OUTPUT(ctx->type)) ++ stuff_all_buffers(avctx, ctx); ++ ++ if (ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type) < 0) { ++ const int err = errno; ++ av_log(avctx, AV_LOG_ERROR, "%s set status %d (%s) failed: err=%d\n", ctx->name, ++ cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF", err); ++ ret = AVERROR(err); ++ } ++ else ++ { ++ if (cmd == VIDIOC_STREAMOFF) ++ flush_all_buffers_status(ctx); ++ else ++ ctx->first_buf = 1; ++ ++ ctx->streamon = (cmd == VIDIOC_STREAMON); ++ av_log(avctx, AV_LOG_DEBUG, "%s set status %d (%s) OK\n", ctx->name, ++ cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF"); ++ } ++ ++ // Both stream off & on effectively clear flag_last ++ ctx->flag_last = 0; ++ ++ ff_mutex_unlock(&ctx->lock); ++ ++ return ret; + } + + int ff_v4l2_context_enqueue_frame(V4L2Context* ctx, const AVFrame* frame) + { +- V4L2m2mContext *s = ctx_to_m2mctx(ctx); ++ V4L2m2mContext *const s = ctx_to_m2mctx(ctx); ++ AVCodecContext *const avctx = s->avctx; ++ int64_t track_ts; + V4L2Buffer* avbuf; + int ret; + + if (!frame) { + ret = v4l2_stop_encode(ctx); + if (ret) +- av_log(logger(ctx), AV_LOG_ERROR, "%s stop_encode\n", ctx->name); ++ av_log(avctx, AV_LOG_ERROR, "%s stop_encode\n", ctx->name); + s->draining= 1; + return 0; + } +@@ -601,23 +977,29 @@ int ff_v4l2_context_enqueue_frame(V4L2Co + if (!avbuf) + return AVERROR(ENOMEM); + +- ret = ff_v4l2_buffer_avframe_to_buf(frame, avbuf); ++ track_ts = xlat_pts_frame_in(avctx, &s->xlat, frame); ++ ++ ret = ff_v4l2_buffer_avframe_to_buf(frame, avbuf, track_ts); + if (ret) + return ret; + + return ff_v4l2_buffer_enqueue(avbuf); + } + +-int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt) ++int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt, ++ const void * extdata, size_t extlen) + { + V4L2m2mContext *s = ctx_to_m2mctx(ctx); ++ AVCodecContext *const avctx = s->avctx; + V4L2Buffer* avbuf; + int ret; ++ int64_t track_ts; + + if (!pkt->size) { + ret = v4l2_stop_decode(ctx); ++ // Log but otherwise ignore stop failure + if (ret) +- av_log(logger(ctx), AV_LOG_ERROR, "%s stop_decode\n", ctx->name); ++ av_log(avctx, AV_LOG_ERROR, "%s stop_decode failed: err=%d\n", ctx->name, ret); + s->draining = 1; + return 0; + } +@@ -626,8 +1008,13 @@ int ff_v4l2_context_enqueue_packet(V4L2C + if (!avbuf) + return AVERROR(EAGAIN); + +- ret = ff_v4l2_buffer_avpkt_to_buf(pkt, avbuf); +- if (ret) ++ track_ts = xlat_pts_pkt_in(avctx, &s->xlat, pkt); ++ ++ ret = ff_v4l2_buffer_avpkt_to_buf_ext(pkt, avbuf, extdata, extlen, track_ts); ++ if (ret == AVERROR(ENOMEM)) ++ av_log(logger(ctx), AV_LOG_ERROR, "Buffer overflow in %s: pkt->size=%d > buf->length=%d\n", ++ __func__, pkt->size, avbuf->planes[0].length); ++ else if (ret) + return ret; + + return ff_v4l2_buffer_enqueue(avbuf); +@@ -635,42 +1022,36 @@ int ff_v4l2_context_enqueue_packet(V4L2C + + int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame, int timeout) + { ++ V4L2m2mContext *s = ctx_to_m2mctx(ctx); ++ AVCodecContext *const avctx = s->avctx; + V4L2Buffer *avbuf; ++ int rv; + +- /* +- * timeout=-1 blocks until: +- * 1. decoded frame available +- * 2. an input buffer is ready to be dequeued +- */ +- avbuf = v4l2_dequeue_v4l2buf(ctx, timeout); +- if (!avbuf) { +- if (ctx->done) +- return AVERROR_EOF; +- +- return AVERROR(EAGAIN); +- } ++ do { ++ if ((rv = get_qbuf(ctx, &avbuf, timeout)) != 0) ++ return rv; ++ if ((rv = ff_v4l2_buffer_buf_to_avframe(frame, avbuf)) != 0) ++ return rv; ++ } while (xlat_pts_frame_out(avctx, &s->xlat, frame) != 0); + +- return ff_v4l2_buffer_buf_to_avframe(frame, avbuf); ++ return 0; + } + + int ff_v4l2_context_dequeue_packet(V4L2Context* ctx, AVPacket* pkt) + { ++ V4L2m2mContext *s = ctx_to_m2mctx(ctx); ++ AVCodecContext *const avctx = s->avctx; + V4L2Buffer *avbuf; ++ int rv; + +- /* +- * blocks until: +- * 1. encoded packet available +- * 2. an input buffer ready to be dequeued +- */ +- avbuf = v4l2_dequeue_v4l2buf(ctx, -1); +- if (!avbuf) { +- if (ctx->done) +- return AVERROR_EOF; ++ do { ++ if ((rv = get_qbuf(ctx, &avbuf, -1)) != 0) ++ return rv == AVERROR(ENOSPC) ? AVERROR(EAGAIN) : rv; // Caller not currently expecting ENOSPC ++ if ((rv = ff_v4l2_buffer_buf_to_avpkt(pkt, avbuf)) != 0) ++ return rv; ++ } while (xlat_pts_pkt_out(avctx, &s->xlat, pkt) != 0); + +- return AVERROR(EAGAIN); +- } +- +- return ff_v4l2_buffer_buf_to_avpkt(pkt, avbuf); ++ return 0; + } + + int ff_v4l2_context_get_format(V4L2Context* ctx, int probe) +@@ -702,78 +1083,160 @@ int ff_v4l2_context_get_format(V4L2Conte + + int ff_v4l2_context_set_format(V4L2Context* ctx) + { +- return ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_S_FMT, &ctx->format); ++ int ret; ++ ++ ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_S_FMT, &ctx->format); ++ if (ret != 0) ++ return ret; ++ ++ // Check returned size against min size and if smaller have another go ++ // Only worry about plane[0] as this is meant to enforce limits for ++ // encoded streams where we might know a bit more about the shape ++ // than the driver ++ if (V4L2_TYPE_IS_MULTIPLANAR(ctx->format.type)) { ++ if (ctx->min_buf_size <= ctx->format.fmt.pix_mp.plane_fmt[0].sizeimage) ++ return 0; ++ ctx->format.fmt.pix_mp.plane_fmt[0].sizeimage = ctx->min_buf_size; ++ } ++ else { ++ if (ctx->min_buf_size <= ctx->format.fmt.pix.sizeimage) ++ return 0; ++ ctx->format.fmt.pix.sizeimage = ctx->min_buf_size; ++ } ++ ++ ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_S_FMT, &ctx->format); ++ return ret; + } + + void ff_v4l2_context_release(V4L2Context* ctx) + { + int ret; + +- if (!ctx->buffers) ++ if (!ctx->bufrefs) + return; + + ret = v4l2_release_buffers(ctx); + if (ret) + av_log(logger(ctx), AV_LOG_WARNING, "V4L2 failed to unmap the %s buffers\n", ctx->name); + +- av_freep(&ctx->buffers); ++ av_freep(&ctx->bufrefs); ++ av_buffer_unref(&ctx->frames_ref); ++ ++ ff_mutex_destroy(&ctx->lock); ++ pthread_cond_destroy(&ctx->cond); + } + +-int ff_v4l2_context_init(V4L2Context* ctx) ++ ++static int create_buffers(V4L2Context* const ctx, const unsigned int req_buffers, const enum v4l2_memory mem) + { +- V4L2m2mContext *s = ctx_to_m2mctx(ctx); ++ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); + struct v4l2_requestbuffers req; +- int ret, i; +- +- if (!v4l2_type_supported(ctx)) { +- av_log(logger(ctx), AV_LOG_ERROR, "type %i not supported\n", ctx->type); +- return AVERROR_PATCHWELCOME; +- } ++ int ret; ++ int i; + +- ret = ioctl(s->fd, VIDIOC_G_FMT, &ctx->format); +- if (ret) +- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT failed\n", ctx->name); ++ av_assert0(ctx->bufrefs == NULL); + + memset(&req, 0, sizeof(req)); +- req.count = ctx->num_buffers; +- req.memory = V4L2_MEMORY_MMAP; ++ req.count = req_buffers; ++ req.memory = mem; + req.type = ctx->type; +- ret = ioctl(s->fd, VIDIOC_REQBUFS, &req); +- if (ret < 0) { +- av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_REQBUFS failed: %s\n", ctx->name, strerror(errno)); +- return AVERROR(errno); ++ while ((ret = ioctl(s->fd, VIDIOC_REQBUFS, &req)) == -1) { ++ if (errno != EINTR) { ++ ret = AVERROR(errno); ++ av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_REQBUFS failed: %s\n", ctx->name, av_err2str(ret)); ++ return ret; ++ } + } + + ctx->num_buffers = req.count; +- ctx->buffers = av_mallocz(ctx->num_buffers * sizeof(V4L2Buffer)); +- if (!ctx->buffers) { ++ ctx->bufrefs = av_mallocz(ctx->num_buffers * sizeof(*ctx->bufrefs)); ++ if (!ctx->bufrefs) { + av_log(logger(ctx), AV_LOG_ERROR, "%s malloc enomem\n", ctx->name); +- return AVERROR(ENOMEM); ++ goto fail_release; + } + +- for (i = 0; i < req.count; i++) { +- ctx->buffers[i].context = ctx; +- ret = ff_v4l2_buffer_initialize(&ctx->buffers[i], i); +- if (ret < 0) { ++ ctx->wl_master = ff_weak_link_new(ctx); ++ if (!ctx->wl_master) { ++ ret = AVERROR(ENOMEM); ++ goto fail_release; ++ } ++ ++ for (i = 0; i < ctx->num_buffers; i++) { ++ ret = ff_v4l2_buffer_initialize(&ctx->bufrefs[i], i, ctx, mem); ++ if (ret) { + av_log(logger(ctx), AV_LOG_ERROR, "%s buffer[%d] initialization (%s)\n", ctx->name, i, av_err2str(ret)); +- goto error; ++ goto fail_release; + } + } + + av_log(logger(ctx), AV_LOG_DEBUG, "%s: %s %02d buffers initialized: %04ux%04u, sizeimage %08u, bytesperline %08u\n", ctx->name, + V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? av_fourcc2str(ctx->format.fmt.pix_mp.pixelformat) : av_fourcc2str(ctx->format.fmt.pix.pixelformat), + req.count, +- v4l2_get_width(&ctx->format), +- v4l2_get_height(&ctx->format), ++ ff_v4l2_get_format_width(&ctx->format), ++ ff_v4l2_get_format_height(&ctx->format), + V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? ctx->format.fmt.pix_mp.plane_fmt[0].sizeimage : ctx->format.fmt.pix.sizeimage, + V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? ctx->format.fmt.pix_mp.plane_fmt[0].bytesperline : ctx->format.fmt.pix.bytesperline); + + return 0; + +-error: ++fail_release: + v4l2_release_buffers(ctx); ++ av_freep(&ctx->bufrefs); ++ return ret; ++} ++ ++int ff_v4l2_context_init(V4L2Context* ctx) ++{ ++ V4L2m2mContext * const s = ctx_to_m2mctx(ctx); ++ int ret; ++ ++ // It is not valid to reinit a context without a previous release ++ av_assert0(ctx->bufrefs == NULL); + +- av_freep(&ctx->buffers); ++ if (!v4l2_type_supported(ctx)) { ++ av_log(logger(ctx), AV_LOG_ERROR, "type %i not supported\n", ctx->type); ++ return AVERROR_PATCHWELCOME; ++ } ++ ++ ff_mutex_init(&ctx->lock, NULL); ++ pthread_cond_init(&ctx->cond, NULL); ++ atomic_init(&ctx->q_count, 0); ++ ++ if (s->output_drm) { ++ AVHWFramesContext *hwframes; ++ ++ ctx->frames_ref = av_hwframe_ctx_alloc(s->device_ref); ++ if (!ctx->frames_ref) { ++ ret = AVERROR(ENOMEM); ++ goto fail_unlock; ++ } ++ ++ hwframes = (AVHWFramesContext*)ctx->frames_ref->data; ++ hwframes->format = AV_PIX_FMT_DRM_PRIME; ++ hwframes->sw_format = ctx->av_pix_fmt; ++ hwframes->width = ctx->width != 0 ? ctx->width : s->avctx->width; ++ hwframes->height = ctx->height != 0 ? ctx->height : s->avctx->height; ++ ret = av_hwframe_ctx_init(ctx->frames_ref); ++ if (ret < 0) ++ goto fail_unref_hwframes; ++ } ++ ++ ret = ioctl(s->fd, VIDIOC_G_FMT, &ctx->format); ++ if (ret) { ++ ret = AVERROR(errno); ++ av_log(logger(ctx), AV_LOG_ERROR, "%s VIDIOC_G_FMT failed: %s\n", ctx->name, av_err2str(ret)); ++ goto fail_unref_hwframes; ++ } ++ ++ ret = create_buffers(ctx, ctx->num_buffers, ctx->buf_mem); ++ if (ret < 0) ++ goto fail_unref_hwframes; ++ ++ return 0; + ++fail_unref_hwframes: ++ av_buffer_unref(&ctx->frames_ref); ++fail_unlock: ++ ff_mutex_destroy(&ctx->lock); + return ret; + } +--- a/libavcodec/v4l2_context.h ++++ b/libavcodec/v4l2_context.h +@@ -31,6 +31,7 @@ + #include "libavutil/pixfmt.h" + #include "libavutil/frame.h" + #include "libavutil/buffer.h" ++#include "libavutil/thread.h" + #include "v4l2_buffers.h" + + typedef struct V4L2Context { +@@ -70,11 +71,18 @@ typedef struct V4L2Context { + */ + int width, height; + AVRational sample_aspect_ratio; ++ struct v4l2_rect selection; + + /** +- * Indexed array of V4L2Buffers ++ * If the default size of buffer is less than this then try to ++ * set to this. + */ +- V4L2Buffer *buffers; ++ uint32_t min_buf_size; ++ ++ /** ++ * Indexed array of pointers to V4L2Buffers ++ */ ++ AVBufferRef **bufrefs; + + /** + * Readonly after init. +@@ -82,16 +90,38 @@ typedef struct V4L2Context { + int num_buffers; + + /** ++ * Buffer memory type V4L2_MEMORY_MMAP or V4L2_MEMORY_DMABUF ++ */ ++ enum v4l2_memory buf_mem; ++ ++ /** + * Whether the stream has been started (VIDIOC_STREAMON has been sent). + */ + int streamon; + ++ /* 1st buffer after stream on */ ++ int first_buf; ++ + /** + * Either no more buffers available or an unrecoverable error was notified + * by the V4L2 kernel driver: once set the context has to be exited. + */ + int done; + ++ int flag_last; ++ ++ /** ++ * If NZ then when Qing frame/pkt use this rather than the ++ * "real" PTS ++ */ ++ uint64_t track_ts; ++ ++ AVBufferRef *frames_ref; ++ atomic_int q_count; ++ struct ff_weak_link_master *wl_master; ++ ++ AVMutex lock; ++ pthread_cond_t cond; + } V4L2Context; + + /** +@@ -156,7 +186,10 @@ int ff_v4l2_context_dequeue_packet(V4L2C + * @param[in] ctx The V4L2Context to dequeue from. + * @param[inout] f The AVFrame to dequeue to. + * @param[in] timeout The timeout for dequeue (-1 to block, 0 to return immediately, or milliseconds) ++ * + * @return 0 in case of success, AVERROR(EAGAIN) if no buffer was ready, another negative error in case of error. ++ * AVERROR(ENOSPC) if no buffer availible to put ++ * the frame in + */ + int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* f, int timeout); + +@@ -170,7 +203,7 @@ int ff_v4l2_context_dequeue_frame(V4L2Co + * @param[in] pkt A pointer to an AVPacket. + * @return 0 in case of success, a negative error otherwise. + */ +-int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt); ++int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt, const void * ext_data, size_t ext_size); + + /** + * Enqueues a buffer to a V4L2Context from an AVFrame +--- a/libavcodec/v4l2_m2m.c ++++ b/libavcodec/v4l2_m2m.c +@@ -36,6 +36,14 @@ + #include "v4l2_fmt.h" + #include "v4l2_m2m.h" + ++static void ++xlat_init(xlat_track_t * const x) ++{ ++ memset(x, 0, sizeof(*x)); ++ x->last_pts = AV_NOPTS_VALUE; ++} ++ ++ + static inline int v4l2_splane_video(struct v4l2_capability *cap) + { + if (cap->capabilities & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT) && +@@ -68,7 +76,9 @@ static int v4l2_prepare_contexts(V4L2m2m + + s->capture.done = s->output.done = 0; + s->capture.name = "capture"; ++ s->capture.buf_mem = V4L2_MEMORY_MMAP; + s->output.name = "output"; ++ s->output.buf_mem = s->input_drm ? V4L2_MEMORY_DMABUF : V4L2_MEMORY_MMAP; + atomic_init(&s->refcount, 0); + sem_init(&s->refsync, 0, 0); + +@@ -215,13 +225,7 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mCont + av_log(log_ctx, AV_LOG_ERROR, "capture VIDIOC_STREAMOFF\n"); + + /* 2. unmap the capture buffers (v4l2 and ffmpeg): +- * we must wait for all references to be released before being allowed +- * to queue new buffers. + */ +- av_log(log_ctx, AV_LOG_DEBUG, "waiting for user to release AVBufferRefs\n"); +- if (atomic_load(&s->refcount)) +- while(sem_wait(&s->refsync) == -1 && errno == EINTR); +- + ff_v4l2_context_release(&s->capture); + + /* 3. get the new capture format */ +@@ -240,7 +244,6 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mCont + + /* 5. complete reinit */ + s->draining = 0; +- s->reinit = 0; + + return 0; + } +@@ -274,7 +277,6 @@ int ff_v4l2_m2m_codec_full_reinit(V4L2m2 + + /* start again now that we know the stream dimensions */ + s->draining = 0; +- s->reinit = 0; + + ret = ff_v4l2_context_get_format(&s->output, 0); + if (ret) { +@@ -328,7 +330,13 @@ static void v4l2_m2m_destroy_context(voi + ff_v4l2_context_release(&s->capture); + sem_destroy(&s->refsync); + +- close(s->fd); ++ if (s->fd != -1) ++ close(s->fd); ++ ++ av_packet_unref(&s->buf_pkt); ++ av_freep(&s->extdata_data); ++ ++ av_log(s->avctx, AV_LOG_DEBUG, "V4L2 Context destroyed\n"); + + av_free(s); + } +@@ -338,17 +346,34 @@ int ff_v4l2_m2m_codec_end(V4L2m2mPriv *p + V4L2m2mContext *s = priv->context; + int ret; + +- ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF); +- if (ret) +- av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name); ++ if (!s) ++ return 0; + +- ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); +- if (ret) +- av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name); ++ av_log(s->avctx, AV_LOG_DEBUG, "V4L2 Codec end\n"); ++ ++ if (av_codec_is_decoder(s->avctx->codec)) ++ av_packet_unref(&s->buf_pkt); ++ ++ if (s->fd >= 0) { ++ ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF); ++ if (ret) ++ av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name); ++ ++ ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); ++ if (ret) ++ av_log(s->avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name); ++ } + + ff_v4l2_context_release(&s->output); + ++ close(s->fd); ++ s->fd = -1; ++ + s->self_ref = NULL; ++ // This is only called on avctx close so after this point we don't have that ++ // Crash sooner if we find we are using it (can still log with avctx = NULL) ++ s->avctx = NULL; ++ priv->context = NULL; + av_buffer_unref(&priv->context_ref); + + return 0; +@@ -392,28 +417,33 @@ int ff_v4l2_m2m_codec_init(V4L2m2mPriv * + return v4l2_configure_contexts(s); + } + +-int ff_v4l2_m2m_create_context(V4L2m2mPriv *priv, V4L2m2mContext **s) ++int ff_v4l2_m2m_create_context(V4L2m2mPriv *priv, V4L2m2mContext **pps) + { +- *s = av_mallocz(sizeof(V4L2m2mContext)); +- if (!*s) ++ V4L2m2mContext * const s = av_mallocz(sizeof(V4L2m2mContext)); ++ ++ *pps = NULL; ++ if (!s) + return AVERROR(ENOMEM); + +- priv->context_ref = av_buffer_create((uint8_t *) *s, sizeof(V4L2m2mContext), ++ priv->context_ref = av_buffer_create((uint8_t *)s, sizeof(*s), + &v4l2_m2m_destroy_context, NULL, 0); + if (!priv->context_ref) { +- av_freep(s); ++ av_free(s); + return AVERROR(ENOMEM); + } + + /* assign the context */ +- priv->context = *s; +- (*s)->priv = priv; ++ priv->context = s; ++ s->priv = priv; + + /* populate it */ +- priv->context->capture.num_buffers = priv->num_capture_buffers; +- priv->context->output.num_buffers = priv->num_output_buffers; +- priv->context->self_ref = priv->context_ref; +- priv->context->fd = -1; ++ s->capture.num_buffers = priv->num_capture_buffers; ++ s->output.num_buffers = priv->num_output_buffers; ++ s->self_ref = priv->context_ref; ++ s->fd = -1; ++ ++ xlat_init(&s->xlat); + ++ *pps = s; + return 0; + } +--- a/libavcodec/v4l2_m2m.h ++++ b/libavcodec/v4l2_m2m.h +@@ -30,6 +30,7 @@ + #include + + #include "libavcodec/avcodec.h" ++#include "libavutil/pixfmt.h" + #include "v4l2_context.h" + + #define container_of(ptr, type, member) ({ \ +@@ -38,7 +39,37 @@ + + #define V4L_M2M_DEFAULT_OPTS \ + { "num_output_buffers", "Number of buffers in the output context",\ +- OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 6, INT_MAX, FLAGS } ++ OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 2, INT_MAX, FLAGS } ++ ++#define FF_V4L2_M2M_TRACK_SIZE 128 ++typedef struct V4L2m2mTrackEl { ++ int discard; // If we see this buffer its been flushed, so discard ++ int pending; ++ int pkt_size; ++ int64_t pts; ++ int64_t dts; ++ int64_t reordered_opaque; ++ int64_t pkt_pos; ++ int64_t pkt_duration; ++ int64_t track_pts; ++} V4L2m2mTrackEl; ++ ++typedef struct pts_stats_s ++{ ++ void * logctx; ++ const char * name; // For debug ++ unsigned int last_count; ++ unsigned int last_interval; ++ int64_t last_pts; ++ int64_t guess; ++} pts_stats_t; ++ ++typedef struct xlat_track_s { ++ unsigned int track_no; ++ int64_t last_pts; ++ int64_t last_opaque; ++ V4L2m2mTrackEl track_els[FF_V4L2_M2M_TRACK_SIZE]; ++} xlat_track_t; + + typedef struct V4L2m2mContext { + char devname[PATH_MAX]; +@@ -52,7 +83,6 @@ typedef struct V4L2m2mContext { + AVCodecContext *avctx; + sem_t refsync; + atomic_uint refcount; +- int reinit; + + /* null frame/packet received */ + int draining; +@@ -63,6 +93,36 @@ typedef struct V4L2m2mContext { + + /* reference back to V4L2m2mPriv */ + void *priv; ++ ++ AVBufferRef *device_ref; ++ ++ /* generate DRM frames */ ++ int output_drm; ++ ++ /* input frames are drmprime */ ++ int input_drm; ++ ++ /* Frame tracking */ ++ xlat_track_t xlat; ++ int pending_hw; ++ int pending_n; ++ ++ pts_stats_t pts_stat; ++ ++ /* req pkt */ ++ int req_pkt; ++ ++ /* Ext data sent */ ++ int extdata_sent; ++ /* Ext data sent in packet - overrides ctx */ ++ uint8_t * extdata_data; ++ size_t extdata_size; ++ ++#define FF_V4L2_QUIRK_REINIT_ALWAYS 1 ++#define FF_V4L2_QUIRK_ENUM_FRAMESIZES_BROKEN 2 ++ /* Quirks */ ++ unsigned int quirks; ++ + } V4L2m2mContext; + + typedef struct V4L2m2mPriv { +@@ -73,6 +133,7 @@ typedef struct V4L2m2mPriv { + + int num_output_buffers; + int num_capture_buffers; ++ enum AVPixelFormat pix_fmt; + } V4L2m2mPriv; + + /** +@@ -126,4 +187,26 @@ int ff_v4l2_m2m_codec_reinit(V4L2m2mCont + */ + int ff_v4l2_m2m_codec_full_reinit(V4L2m2mContext *ctx); + ++ ++static inline unsigned int ff_v4l2_get_format_width(const struct v4l2_format * const fmt) ++{ ++ return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.width : fmt->fmt.pix.width; ++} ++ ++static inline unsigned int ff_v4l2_get_format_height(const struct v4l2_format * const fmt) ++{ ++ return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.height : fmt->fmt.pix.height; ++} ++ ++static inline uint32_t ff_v4l2_get_format_pixelformat(const struct v4l2_format * const fmt) ++{ ++ return V4L2_TYPE_IS_MULTIPLANAR(fmt->type) ? fmt->fmt.pix_mp.pixelformat : fmt->fmt.pix.pixelformat; ++} ++ ++static inline int ff_v4l2_ctx_eos(const V4L2Context * const ctx) ++{ ++ return ctx->flag_last; ++} ++ ++ + #endif /* AVCODEC_V4L2_M2M_H */ +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -23,6 +23,10 @@ + + #include + #include ++ ++#include "libavutil/avassert.h" ++#include "libavutil/hwcontext.h" ++#include "libavutil/hwcontext_drm.h" + #include "libavutil/pixfmt.h" + #include "libavutil/pixdesc.h" + #include "libavutil/opt.h" +@@ -30,75 +34,111 @@ + #include "libavcodec/decode.h" + #include "libavcodec/internal.h" + ++#include "libavcodec/hwaccels.h" ++#include "libavcodec/internal.h" ++#include "libavcodec/hwconfig.h" ++ + #include "v4l2_context.h" + #include "v4l2_m2m.h" + #include "v4l2_fmt.h" + +-static int v4l2_try_start(AVCodecContext *avctx) ++// Pick 64 for max last count - that is >1sec at 60fps ++#define STATS_LAST_COUNT_MAX 64 ++#define STATS_INTERVAL_MAX (1 << 30) ++ ++#ifndef FF_API_BUFFER_SIZE_T ++#define FF_API_BUFFER_SIZE_T 1 ++#endif ++ ++static int64_t pts_stats_guess(const pts_stats_t * const stats) + { +- V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context; +- V4L2Context *const capture = &s->capture; +- V4L2Context *const output = &s->output; +- struct v4l2_selection selection = { 0 }; +- int ret; ++ if (stats->last_pts == AV_NOPTS_VALUE || ++ stats->last_interval == 0 || ++ stats->last_count >= STATS_LAST_COUNT_MAX) ++ return AV_NOPTS_VALUE; ++ return stats->last_pts + (int64_t)(stats->last_count - 1) * (int64_t)stats->last_interval; ++} + +- /* 1. start the output process */ +- if (!output->streamon) { +- ret = ff_v4l2_context_set_status(output, VIDIOC_STREAMON); +- if (ret < 0) { +- av_log(avctx, AV_LOG_DEBUG, "VIDIOC_STREAMON on output context\n"); +- return ret; ++static void pts_stats_add(pts_stats_t * const stats, int64_t pts) ++{ ++ if (pts == AV_NOPTS_VALUE || pts == stats->last_pts) { ++ if (stats->last_count < STATS_LAST_COUNT_MAX) ++ ++stats->last_count; ++ return; ++ } ++ ++ if (stats->last_pts != AV_NOPTS_VALUE) { ++ const int64_t interval = pts - stats->last_pts; ++ ++ if (interval < 0 || interval >= STATS_INTERVAL_MAX || ++ stats->last_count >= STATS_LAST_COUNT_MAX) { ++ if (stats->last_interval != 0) ++ av_log(stats->logctx, AV_LOG_DEBUG, "%s: %s: Bad interval: %" PRId64 "/%d\n", ++ __func__, stats->name, interval, stats->last_count); ++ stats->last_interval = 0; ++ } ++ else { ++ const int64_t frame_time = interval / (int64_t)stats->last_count; ++ ++ if (frame_time != stats->last_interval) ++ av_log(stats->logctx, AV_LOG_DEBUG, "%s: %s: New interval: %u->%" PRId64 "/%d=%" PRId64 "\n", ++ __func__, stats->name, stats->last_interval, interval, stats->last_count, frame_time); ++ stats->last_interval = frame_time; + } + } + +- if (capture->streamon) ++ stats->last_pts = pts; ++ stats->last_count = 1; ++} ++ ++static void pts_stats_init(pts_stats_t * const stats, void * logctx, const char * name) ++{ ++ *stats = (pts_stats_t){ ++ .logctx = logctx, ++ .name = name, ++ .last_count = 1, ++ .last_interval = 0, ++ .last_pts = AV_NOPTS_VALUE ++ }; ++} ++ ++static int check_output_streamon(AVCodecContext *const avctx, V4L2m2mContext *const s) ++{ ++ int ret; ++ struct v4l2_decoder_cmd cmd = { ++ .cmd = V4L2_DEC_CMD_START, ++ .flags = 0, ++ }; ++ ++ if (s->output.streamon) + return 0; + +- /* 2. get the capture format */ +- capture->format.type = capture->type; +- ret = ioctl(s->fd, VIDIOC_G_FMT, &capture->format); +- if (ret) { +- av_log(avctx, AV_LOG_WARNING, "VIDIOC_G_FMT ioctl\n"); ++ ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMON); ++ if (ret != 0) { ++ av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMON on output context: %s\n", av_err2str(ret)); + return ret; + } + +- /* 2.1 update the AVCodecContext */ +- avctx->pix_fmt = ff_v4l2_format_v4l2_to_avfmt(capture->format.fmt.pix_mp.pixelformat, AV_CODEC_ID_RAWVIDEO); +- capture->av_pix_fmt = avctx->pix_fmt; +- +- /* 3. set the crop parameters */ +- selection.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; +- selection.r.height = avctx->coded_height; +- selection.r.width = avctx->coded_width; +- ret = ioctl(s->fd, VIDIOC_S_SELECTION, &selection); +- if (!ret) { +- ret = ioctl(s->fd, VIDIOC_G_SELECTION, &selection); +- if (ret) { +- av_log(avctx, AV_LOG_WARNING, "VIDIOC_G_SELECTION ioctl\n"); +- } else { +- av_log(avctx, AV_LOG_DEBUG, "crop output %dx%d\n", selection.r.width, selection.r.height); +- /* update the size of the resulting frame */ +- capture->height = selection.r.height; +- capture->width = selection.r.width; +- } ++ // STREAMON should do implicit START so this just for those that don't. ++ // It is optional so don't worry if it fails ++ if (ioctl(s->fd, VIDIOC_DECODER_CMD, &cmd) < 0) { ++ ret = AVERROR(errno); ++ av_log(avctx, AV_LOG_WARNING, "VIDIOC_DECODER_CMD start error: %s\n", av_err2str(ret)); + } +- +- /* 4. init the capture context now that we have the capture format */ +- if (!capture->buffers) { +- ret = ff_v4l2_context_init(capture); +- if (ret) { +- av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n"); +- return AVERROR(ENOMEM); +- } ++ else { ++ av_log(avctx, AV_LOG_TRACE, "VIDIOC_DECODER_CMD start OK\n"); + } ++ return 0; ++} + +- /* 5. start the capture process */ +- ret = ff_v4l2_context_set_status(capture, VIDIOC_STREAMON); +- if (ret) { +- av_log(avctx, AV_LOG_DEBUG, "VIDIOC_STREAMON, on capture context\n"); +- return ret; +- } ++static int v4l2_try_start(AVCodecContext *avctx) ++{ ++ V4L2m2mContext * const s = ((V4L2m2mPriv*)avctx->priv_data)->context; ++ int ret; + ++ /* 1. start the output process */ ++ if ((ret = check_output_streamon(avctx, s)) != 0) ++ return ret; + return 0; + } + +@@ -133,52 +173,525 @@ static int v4l2_prepare_decoder(V4L2m2mC + return 0; + } + +-static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) ++static void ++set_best_effort_pts(AVCodecContext *const avctx, ++ pts_stats_t * const ps, ++ AVFrame *const frame) ++{ ++ pts_stats_add(ps, frame->pts); ++ ++#if FF_API_PKT_PTS ++FF_DISABLE_DEPRECATION_WARNINGS ++ frame->pkt_pts = frame->pts; ++FF_ENABLE_DEPRECATION_WARNINGS ++#endif ++ frame->best_effort_timestamp = pts_stats_guess(ps); ++ // If we can't guess from just PTS - try DTS ++ if (frame->best_effort_timestamp == AV_NOPTS_VALUE) ++ frame->best_effort_timestamp = frame->pkt_dts; ++ ++ // We can't emulate what s/w does in a useful manner and using the ++ // "correct" answer seems to just confuse things. ++ frame->pkt_dts = frame->pts; ++ av_log(avctx, AV_LOG_TRACE, "Out PTS=%" PRId64 "/%"PRId64", DTS=%" PRId64 "\n", ++ frame->pts, frame->best_effort_timestamp, frame->pkt_dts); ++} ++ ++static void ++xlat_flush(xlat_track_t * const x) ++{ ++ unsigned int i; ++ for (i = 0; i != FF_V4L2_M2M_TRACK_SIZE; ++i) { ++ x->track_els[i].pending = 0; ++ x->track_els[i].discard = 1; ++ } ++ x->last_pts = AV_NOPTS_VALUE; ++} ++ ++static int ++xlat_pending(const xlat_track_t * const x) ++{ ++ unsigned int n = x->track_no % FF_V4L2_M2M_TRACK_SIZE; ++ unsigned int i; ++ int r = 0; ++ int64_t now = AV_NOPTS_VALUE; ++ ++ for (i = 0; i < 32; ++i, n = (n - 1) % FF_V4L2_M2M_TRACK_SIZE) { ++ const V4L2m2mTrackEl * const t = x->track_els + n; ++ ++ if (!t->pending) ++ continue; ++ ++ if (now == AV_NOPTS_VALUE) ++ now = t->dts; ++ ++ if (t->pts == AV_NOPTS_VALUE || ++ ((now == AV_NOPTS_VALUE || t->pts <= now) && ++ (x->last_pts == AV_NOPTS_VALUE || t->pts > x->last_pts))) ++ ++r; ++ } ++ ++ // If we never get any ideas about PTS vs DTS allow a lot more buffer ++ if (now == AV_NOPTS_VALUE) ++ r -= 16; ++ ++ return r; ++} ++ ++static inline int stream_started(const V4L2m2mContext * const s) { ++ return s->output.streamon; ++} ++ ++#define NQ_OK 0 ++#define NQ_Q_FULL 1 ++#define NQ_SRC_EMPTY 2 ++#define NQ_NONE 3 ++#define NQ_DRAINING 4 ++#define NQ_DEAD 5 ++ ++#define TRY_DQ(nq_status) ((nq_status) >= NQ_OK && (nq_status) <= NQ_DRAINING) ++#define RETRY_NQ(nq_status) ((nq_status) == NQ_Q_FULL || (nq_status) == NQ_NONE) ++ ++// do_not_get If true then no new packet will be got but status will ++// be set appropriately ++ ++// AVERROR_EOF Flushing an already flushed stream ++// -ve Error (all errors except EOF are unexpected) ++// NQ_OK (0) OK ++// NQ_Q_FULL Dst full (retry if we think V4L2 Q has space now) ++// NQ_SRC_EMPTY Src empty (do not retry) ++// NQ_NONE Enqueue not attempted ++// NQ_DRAINING At EOS, dQ dest until EOS there too ++// NQ_DEAD Not running (do not retry, do not attempt capture dQ) ++ ++static int try_enqueue_src(AVCodecContext * const avctx, V4L2m2mContext * const s, const int do_not_get) + { +- V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context; +- V4L2Context *const capture = &s->capture; +- V4L2Context *const output = &s->output; +- AVPacket avpkt = {0}; + int ret; + +- if (s->buf_pkt.size) { +- avpkt = s->buf_pkt; +- memset(&s->buf_pkt, 0, sizeof(AVPacket)); +- } else { +- ret = ff_decode_get_packet(avctx, &avpkt); +- if (ret < 0 && ret != AVERROR_EOF) ++ // If we don't already have a coded packet - get a new one ++ // We will already have a coded pkt if the output Q was full last time we ++ // tried to Q it ++ if (!s->buf_pkt.size && !do_not_get) { ++ unsigned int i; ++ ++ for (i = 0; i < 256; ++i) { ++ uint8_t * side_data; ++#if FF_API_BUFFER_SIZE_T ++ int side_size; ++#else ++ size_t side_size; ++#endif ++ ret = ff_decode_get_packet(avctx, &s->buf_pkt); ++ if (ret != 0) ++ break; ++ ++ // New extradata is the only side-data we undertand ++ side_data = av_packet_get_side_data(&s->buf_pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); ++ if (side_data) { ++ av_log(avctx, AV_LOG_DEBUG, "New extradata\n"); ++ av_freep(&s->extdata_data); ++ if ((s->extdata_data = av_malloc(side_size ? side_size : 1)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to alloc %d bytes of extra data\n", (int)side_size); ++ return AVERROR(ENOMEM); ++ } ++ memcpy(s->extdata_data, side_data, side_size); ++ s->extdata_size = side_size; ++ s->extdata_sent = 0; ++ } ++ ++ if (s->buf_pkt.size != 0) ++ break; ++ ++ if (s->buf_pkt.side_data_elems == 0) { ++ av_log(avctx, AV_LOG_WARNING, "Empty pkt from ff_decode_get_packet - treating as EOF\n"); ++ ret = AVERROR_EOF; ++ break; ++ } ++ ++ // Retry a side-data only pkt ++ } ++ // If i >= 256 something has gone wrong ++ if (i >= 256) { ++ av_log(avctx, AV_LOG_ERROR, "Too many side-data only packets\n"); ++ return AVERROR(EIO); ++ } ++ ++ if (ret == AVERROR(EAGAIN)) { ++ if (!stream_started(s)) { ++ av_log(avctx, AV_LOG_TRACE, "%s: receive_frame before 1st coded packet\n", __func__); ++ return NQ_DEAD; ++ } ++ return NQ_SRC_EMPTY; ++ } ++ ++ if (ret == AVERROR_EOF) { ++ // EOF - enter drain mode ++ av_log(avctx, AV_LOG_TRACE, "--- EOS req: ret=%d, size=%d, started=%d, drain=%d\n", ++ ret, s->buf_pkt.size, stream_started(s), s->draining); ++ if (!stream_started(s)) { ++ av_log(avctx, AV_LOG_DEBUG, "EOS on flushed stream\n"); ++ s->draining = 1; ++ s->capture.done = 1; ++ return AVERROR_EOF; ++ } ++ ++ if (!s->draining) { ++ // Calling enqueue with an empty pkt starts drain ++ av_assert0(s->buf_pkt.size == 0); ++ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, NULL, 0); ++ if (ret) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to start drain: ret=%d\n", ret); ++ return ret; ++ } ++ } ++ return NQ_DRAINING; ++ } ++ ++ if (ret < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to get coded packet: err=%d\n", ret); + return ret; ++ } + } + +- if (s->draining) +- goto dequeue; ++ if (s->draining) { ++ if (s->buf_pkt.size) { ++ av_log(avctx, AV_LOG_WARNING, "Unexpected input whilst draining\n"); ++ av_packet_unref(&s->buf_pkt); ++ } ++ return NQ_DRAINING; ++ } + +- ret = ff_v4l2_context_enqueue_packet(output, &avpkt); +- if (ret < 0) { +- if (ret != AVERROR(EAGAIN)) +- return ret; ++ if (!s->buf_pkt.size) ++ return NQ_NONE; + +- s->buf_pkt = avpkt; +- /* no input buffers available, continue dequeing */ +- } ++ if ((ret = check_output_streamon(avctx, s)) != 0) ++ return ret; ++ ++ if (s->extdata_sent) ++ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, NULL, 0); ++ else if (s->extdata_data) ++ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, s->extdata_data, s->extdata_size); ++ else ++ ret = ff_v4l2_context_enqueue_packet(&s->output, &s->buf_pkt, avctx->extradata, avctx->extradata_size); ++ ++ if (ret == AVERROR(EAGAIN)) { ++ // Out of input buffers - keep packet ++ ret = NQ_Q_FULL; ++ } ++ else { ++ // In all other cases we are done with this packet ++ av_packet_unref(&s->buf_pkt); ++ s->extdata_sent = 1; + +- if (avpkt.size) { +- ret = v4l2_try_start(avctx); + if (ret) { +- av_packet_unref(&avpkt); ++ av_log(avctx, AV_LOG_ERROR, "Packet enqueue failure: err=%d\n", ret); ++ return ret; ++ } ++ } + +- /* cant recover */ +- if (ret == AVERROR(ENOMEM)) +- return ret; ++ // Start if we haven't ++ { ++ const int ret2 = v4l2_try_start(avctx); ++ if (ret2) { ++ av_log(avctx, AV_LOG_DEBUG, "Start failure: err=%d\n", ret2); ++ ret = (ret2 == AVERROR(ENOMEM)) ? ret2 : NQ_DEAD; ++ } ++ } ++ ++ return ret; ++} ++ ++static int qbuf_wait(AVCodecContext * const avctx, V4L2Context * const ctx) ++{ ++ int rv = 0; + +- return 0; ++ ff_mutex_lock(&ctx->lock); ++ ++ while (atomic_load(&ctx->q_count) == 0 && ctx->streamon) { ++ if (pthread_cond_wait(&ctx->cond, &ctx->lock) != 0) { ++ rv = AVERROR(errno); ++ av_log(avctx, AV_LOG_ERROR, "Cond wait failure: %s\n", av_err2str(rv)); ++ break; + } + } + +-dequeue: +- if (!s->buf_pkt.size) +- av_packet_unref(&avpkt); +- return ff_v4l2_context_dequeue_frame(capture, frame, -1); ++ ff_mutex_unlock(&ctx->lock); ++ return rv; ++} ++ ++// Number of frames over what xlat_pending returns that we keep *16 ++// This is a min value - if it appears to be too small the threshold should ++// adjust dynamically. ++#define PENDING_HW_MIN (3 * 16) ++// Offset to use when setting dynamically ++// Set to %16 == 15 to avoid the threshold changing immediately as we relax ++#define PENDING_HW_OFFSET (PENDING_HW_MIN - 1) ++// Number of consecutive times we've failed to get a frame when we prefer it ++// before we increase the prefer threshold (5ms * N = max expected decode ++// time) ++#define PENDING_N_THRESHOLD 6 ++ ++static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) ++{ ++ V4L2m2mContext *const s = ((V4L2m2mPriv*)avctx->priv_data)->context; ++ int src_rv = NQ_OK; ++ int dst_rv = 1; // Non-zero (done), non-negative (error) number ++ unsigned int i = 0; ++ ++ do { ++ const int pending = xlat_pending(&s->xlat); ++ const int prefer_dq = (pending > s->pending_hw / 16); ++ const int last_src_rv = src_rv; ++ ++ // Enqueue another pkt for decode if ++ // (a) We don't have a lot of stuff in the buffer already OR ++ // (b) ... we (think we) do but we've failed to get a frame already OR ++ // (c) We've dequeued a lot of frames without asking for input ++ src_rv = try_enqueue_src(avctx, s, !(!prefer_dq || i != 0 || s->req_pkt > 2)); ++ ++ // If we got a frame last time or we've already tried to get a frame and ++ // we have nothing to enqueue then return now. rv will be AVERROR(EAGAIN) ++ // indicating that we want more input. ++ // This should mean that once decode starts we enter a stable state where ++ // we alternately ask for input and produce output ++ if ((i != 0 || s->req_pkt) && src_rv == NQ_SRC_EMPTY) ++ break; ++ ++ if (src_rv == NQ_Q_FULL && last_src_rv == NQ_Q_FULL) { ++ av_log(avctx, AV_LOG_WARNING, "Poll thinks src Q has space; none found\n"); ++ break; ++ } ++ ++ // Try to get a new frame if ++ // (a) we haven't already got one AND ++ // (b) enqueue returned a status indicating that decode should be attempted ++ if (dst_rv != 0 && TRY_DQ(src_rv)) { ++ // Pick a timeout depending on state ++ const int t = ++ src_rv == NQ_DRAINING ? 300 : ++ prefer_dq ? 5 : ++ src_rv == NQ_Q_FULL ? -1 : 0; ++ ++ // Dequeue frame will unref any previous contents of frame ++ // if it returns success so we don't need an explicit unref ++ // when discarding ++ // This returns AVERROR(EAGAIN) on timeout or if ++ // there is room in the input Q and timeout == -1 ++ dst_rv = ff_v4l2_context_dequeue_frame(&s->capture, frame, t); ++ ++ // Failure due to no buffer in Q? ++ if (dst_rv == AVERROR(ENOSPC)) { ++ // Wait & retry ++ if ((dst_rv = qbuf_wait(avctx, &s->capture)) == 0) { ++ dst_rv = ff_v4l2_context_dequeue_frame(&s->capture, frame, t); ++ } ++ } ++ ++ // Adjust dynamic pending threshold ++ if (dst_rv == 0) { ++ if (--s->pending_hw < PENDING_HW_MIN) ++ s->pending_hw = PENDING_HW_MIN; ++ s->pending_n = 0; ++ ++ set_best_effort_pts(avctx, &s->pts_stat, frame); ++ } ++ else if (dst_rv == AVERROR(EAGAIN)) { ++ if (prefer_dq && ++s->pending_n > PENDING_N_THRESHOLD) { ++ s->pending_hw = pending * 16 + PENDING_HW_OFFSET; ++ s->pending_n = 0; ++ } ++ } ++ ++ if (dst_rv == AVERROR(EAGAIN) && src_rv == NQ_DRAINING) { ++ av_log(avctx, AV_LOG_WARNING, "Timeout in drain - assume EOF"); ++ dst_rv = AVERROR_EOF; ++ s->capture.done = 1; ++ } ++ else if (dst_rv == AVERROR_EOF && (s->draining || s->capture.done)) ++ av_log(avctx, AV_LOG_DEBUG, "Dequeue EOF: draining=%d, cap.done=%d\n", ++ s->draining, s->capture.done); ++ else if (dst_rv && dst_rv != AVERROR(EAGAIN)) ++ av_log(avctx, AV_LOG_ERROR, "Packet dequeue failure: draining=%d, cap.done=%d, err=%d\n", ++ s->draining, s->capture.done, dst_rv); ++ } ++ ++ ++i; ++ if (i >= 256) { ++ av_log(avctx, AV_LOG_ERROR, "Unexpectedly large retry count: %d\n", i); ++ src_rv = AVERROR(EIO); ++ } ++ ++ // Continue trying to enqueue packets if either ++ // (a) we succeeded last time OR ++ // (b) we didn't ret a frame and we can retry the input ++ } while (src_rv == NQ_OK || (dst_rv == AVERROR(EAGAIN) && RETRY_NQ(src_rv))); ++ ++ // Ensure that the frame contains nothing if we aren't returning a frame ++ // (might happen when discarding) ++ if (dst_rv) ++ av_frame_unref(frame); ++ ++ // If we got a frame this time ask for a pkt next time ++ s->req_pkt = (dst_rv == 0) ? s->req_pkt + 1 : 0; ++ ++#if 0 ++ if (dst_rv == 0) ++ { ++ static int z = 0; ++ if (++z > 50) { ++ av_log(avctx, AV_LOG_ERROR, "Streamoff and die?\n"); ++ ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF); ++ return -1; ++ } ++ } ++#endif ++ ++ return dst_rv == 0 ? 0 : ++ src_rv < 0 ? src_rv : ++ dst_rv < 0 ? dst_rv : ++ AVERROR(EAGAIN); ++} ++ ++#if 0 ++#include ++static int64_t us_time(void) ++{ ++ struct timespec ts; ++ clock_gettime(CLOCK_MONOTONIC, &ts); ++ return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; ++} ++ ++static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) ++{ ++ int ret; ++ const int64_t now = us_time(); ++ int64_t done; ++ av_log(avctx, AV_LOG_TRACE, "<<< %s\n", __func__); ++ ret = v4l2_receive_frame2(avctx, frame); ++ done = us_time(); ++ av_log(avctx, AV_LOG_TRACE, ">>> %s: rx time=%" PRId64 ", rv=%d\n", __func__, done - now, ret); ++ return ret; ++} ++#endif ++ ++static int ++check_size(AVCodecContext * const avctx, V4L2m2mContext * const s) ++{ ++ unsigned int i; ++ const uint32_t fcc = ff_v4l2_get_format_pixelformat(&s->capture.format); ++ const uint32_t w = avctx->coded_width; ++ const uint32_t h = avctx->coded_height; ++ ++ if (w == 0 || h == 0 || fcc == 0) { ++ av_log(avctx, AV_LOG_TRACE, "%s: Size %dx%d or fcc %s empty\n", __func__, w, h, av_fourcc2str(fcc)); ++ return 0; ++ } ++ if ((s->quirks & FF_V4L2_QUIRK_ENUM_FRAMESIZES_BROKEN) != 0) { ++ av_log(avctx, AV_LOG_TRACE, "%s: Skipped (quirk): Size %dx%d, fcc %s\n", __func__, w, h, av_fourcc2str(fcc)); ++ return 0; ++ } ++ ++ for (i = 0;; ++i) { ++ struct v4l2_frmsizeenum fs = { ++ .index = i, ++ .pixel_format = fcc, ++ }; ++ ++ while (ioctl(s->fd, VIDIOC_ENUM_FRAMESIZES, &fs) != 0) { ++ const int err = AVERROR(errno); ++ if (err == AVERROR(EINTR)) ++ continue; ++ if (i == 0 && err == AVERROR(ENOTTY)) { ++ av_log(avctx, AV_LOG_DEBUG, "Framesize enum not supported\n"); ++ return 0; ++ } ++ if (err != AVERROR(EINVAL)) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to enum framesizes: %s", av_err2str(err)); ++ return err; ++ } ++ av_log(avctx, AV_LOG_WARNING, "Failed to find Size=%dx%d, fmt=%s in %u frame size enums\n", ++ w, h, av_fourcc2str(fcc), i); ++ return err; ++ } ++ ++ switch (fs.type) { ++ case V4L2_FRMSIZE_TYPE_DISCRETE: ++ av_log(avctx, AV_LOG_TRACE, "%s[%d]: Discrete: %dx%d\n", __func__, i, ++ fs.discrete.width,fs.discrete.height); ++ if (w == fs.discrete.width && h == fs.discrete.height) ++ return 0; ++ break; ++ case V4L2_FRMSIZE_TYPE_STEPWISE: ++ av_log(avctx, AV_LOG_TRACE, "%s[%d]: Stepwise: Min: %dx%d Max: %dx%d, Step: %dx%d\n", __func__, i, ++ fs.stepwise.min_width, fs.stepwise.min_height, ++ fs.stepwise.max_width, fs.stepwise.max_height, ++ fs.stepwise.step_width,fs.stepwise.step_height); ++ if (w >= fs.stepwise.min_width && w <= fs.stepwise.max_width && ++ h >= fs.stepwise.min_height && h <= fs.stepwise.max_height && ++ (w - fs.stepwise.min_width) % fs.stepwise.step_width == 0 && ++ (h - fs.stepwise.min_height) % fs.stepwise.step_height == 0) ++ return 0; ++ break; ++ case V4L2_FRMSIZE_TYPE_CONTINUOUS: ++ av_log(avctx, AV_LOG_TRACE, "%s[%d]: Continuous: Min: %dx%d Max: %dx%d, Step: %dx%d\n", __func__, i, ++ fs.stepwise.min_width, fs.stepwise.min_height, ++ fs.stepwise.max_width, fs.stepwise.max_height, ++ fs.stepwise.step_width,fs.stepwise.step_height); ++ if (w >= fs.stepwise.min_width && w <= fs.stepwise.max_width && ++ h >= fs.stepwise.min_height && h <= fs.stepwise.max_height) ++ return 0; ++ break; ++ default: ++ av_log(avctx, AV_LOG_ERROR, "Unexpected framesize enum: %d", fs.type); ++ return AVERROR(EINVAL); ++ } ++ } ++} ++ ++static int ++get_quirks(AVCodecContext * const avctx, V4L2m2mContext * const s) ++{ ++ struct v4l2_capability cap; ++ ++ memset(&cap, 0, sizeof(cap)); ++ while (ioctl(s->fd, VIDIOC_QUERYCAP, &cap) != 0) { ++ int err = errno; ++ if (err == EINTR) ++ continue; ++ av_log(avctx, AV_LOG_ERROR, "V4L2: Failed to get capabilities: %s\n", strerror(err)); ++ return AVERROR(err); ++ } ++ ++ // Could be made table driven if we have a few more but right now there ++ // seems no point ++ ++ // Meson (amlogic) always gives a resolution changed event after output ++ // streamon and userspace must (re)allocate capture buffers and streamon ++ // capture to clear the event even if the capture buffers were the right ++ // size in the first place. ++ if (strcmp(cap.driver, "meson-vdec") == 0) ++ s->quirks |= FF_V4L2_QUIRK_REINIT_ALWAYS | FF_V4L2_QUIRK_ENUM_FRAMESIZES_BROKEN; ++ ++ av_log(avctx, AV_LOG_DEBUG, "Driver '%s': Quirks=%#x\n", cap.driver, s->quirks); ++ return 0; ++} ++ ++// This heuristic is for H264 but use for everything ++static uint32_t max_coded_size(const AVCodecContext * const avctx) ++{ ++ uint32_t wxh = avctx->coded_width * avctx->coded_height; ++ uint32_t size; ++ ++ size = wxh * 3 / 2; ++ // H.264 Annex A table A-1 gives minCR which is either 2 or 4 ++ // unfortunately that doesn't yield an actually useful limit ++ // and it should be noted that frame 0 is special cased to allow ++ // a bigger number which really isn't helpful for us. So just pick ++ // frame_size / 2 ++ size /= 2; ++ // Add 64k to allow for any overheads and/or encoder hopefulness ++ // with small WxH ++ return size + (1 << 16); + } + + static av_cold int v4l2_decode_init(AVCodecContext *avctx) +@@ -186,12 +699,29 @@ static av_cold int v4l2_decode_init(AVCo + V4L2Context *capture, *output; + V4L2m2mContext *s; + V4L2m2mPriv *priv = avctx->priv_data; ++ int gf_pix_fmt; + int ret; + ++ av_log(avctx, AV_LOG_TRACE, "<<< %s\n", __func__); ++ ++ if (avctx->codec_id == AV_CODEC_ID_H264) { ++ if (avctx->ticks_per_frame == 1) { ++ if(avctx->time_base.den < INT_MAX/2) { ++ avctx->time_base.den *= 2; ++ } else ++ avctx->time_base.num /= 2; ++ } ++ avctx->ticks_per_frame = 2; ++ } ++ ++ av_log(avctx, AV_LOG_INFO, "level=%d\n", avctx->level); + ret = ff_v4l2_m2m_create_context(priv, &s); + if (ret < 0) + return ret; + ++ pts_stats_init(&s->pts_stat, avctx, "decoder"); ++ s->pending_hw = PENDING_HW_MIN; ++ + capture = &s->capture; + output = &s->output; + +@@ -199,34 +729,127 @@ static av_cold int v4l2_decode_init(AVCo + * by the v4l2 driver; this event will trigger a full pipeline reconfig and + * the proper values will be retrieved from the kernel driver. + */ +- output->height = capture->height = avctx->coded_height; +- output->width = capture->width = avctx->coded_width; ++// output->height = capture->height = avctx->coded_height; ++// output->width = capture->width = avctx->coded_width; ++ output->height = capture->height = 0; ++ output->width = capture->width = 0; + + output->av_codec_id = avctx->codec_id; + output->av_pix_fmt = AV_PIX_FMT_NONE; ++ output->min_buf_size = max_coded_size(avctx); + + capture->av_codec_id = AV_CODEC_ID_RAWVIDEO; + capture->av_pix_fmt = avctx->pix_fmt; ++ capture->min_buf_size = 0; ++ ++ /* the client requests the codec to generate DRM frames: ++ * - data[0] will therefore point to the returned AVDRMFrameDescriptor ++ * check the ff_v4l2_buffer_to_avframe conversion function. ++ * - the DRM frame format is passed in the DRM frame descriptor layer. ++ * check the v4l2_get_drm_frame function. ++ */ ++ ++ avctx->sw_pix_fmt = avctx->pix_fmt; ++ gf_pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); ++ av_log(avctx, AV_LOG_DEBUG, "avctx requested=%d (%s) %dx%d; get_format requested=%d (%s)\n", ++ avctx->pix_fmt, av_get_pix_fmt_name(avctx->pix_fmt), ++ avctx->coded_width, avctx->coded_height, ++ gf_pix_fmt, av_get_pix_fmt_name(gf_pix_fmt)); ++ ++ if (gf_pix_fmt == AV_PIX_FMT_DRM_PRIME || avctx->pix_fmt == AV_PIX_FMT_DRM_PRIME) { ++ avctx->pix_fmt = AV_PIX_FMT_DRM_PRIME; ++ s->output_drm = 1; ++ } ++ else { ++ capture->av_pix_fmt = gf_pix_fmt; ++ s->output_drm = 0; ++ } ++ ++ s->device_ref = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_DRM); ++ if (!s->device_ref) { ++ ret = AVERROR(ENOMEM); ++ return ret; ++ } ++ ++ ret = av_hwdevice_ctx_init(s->device_ref); ++ if (ret < 0) ++ return ret; + + s->avctx = avctx; + ret = ff_v4l2_m2m_codec_init(priv); + if (ret) { + av_log(avctx, AV_LOG_ERROR, "can't configure decoder\n"); +- s->self_ref = NULL; +- av_buffer_unref(&priv->context_ref); +- + return ret; + } + +- return v4l2_prepare_decoder(s); ++ if ((ret = v4l2_prepare_decoder(s)) < 0) ++ return ret; ++ ++ if ((ret = get_quirks(avctx, s)) != 0) ++ return ret; ++ ++ if ((ret = check_size(avctx, s)) != 0) ++ return ret; ++ ++ return 0; + } + + static av_cold int v4l2_decode_close(AVCodecContext *avctx) + { +- V4L2m2mPriv *priv = avctx->priv_data; +- V4L2m2mContext *s = priv->context; ++ int rv; ++ av_log(avctx, AV_LOG_TRACE, "<<< %s\n", __func__); ++ rv = ff_v4l2_m2m_codec_end(avctx->priv_data); ++ av_log(avctx, AV_LOG_TRACE, ">>> %s: rv=%d\n", __func__, rv); ++ return rv; ++} ++ ++static void v4l2_decode_flush(AVCodecContext *avctx) ++{ ++ // An alternatve and more drastic form of flush is to simply do this: ++ // v4l2_decode_close(avctx); ++ // v4l2_decode_init(avctx); ++ // The downside is that this keeps a decoder open until all the frames ++ // associated with it have been returned. This is a bit wasteful on ++ // possibly limited h/w resources and fails on a Pi for this reason unless ++ // more GPU mem is allocated than is the default. ++ ++ V4L2m2mPriv * const priv = avctx->priv_data; ++ V4L2m2mContext * const s = priv->context; ++ V4L2Context * const output = &s->output; ++ V4L2Context * const capture = &s->capture; ++ ++ av_log(avctx, AV_LOG_TRACE, "<<< %s: streamon=%d\n", __func__, output->streamon); ++ ++ // Reflushing everything is benign, quick and avoids having to worry about ++ // states like EOS processing so don't try to optimize out (having got it ++ // wrong once) ++ ++ ff_v4l2_context_set_status(output, VIDIOC_STREAMOFF); ++ ++ // Clear any buffered input packet + av_packet_unref(&s->buf_pkt); +- return ff_v4l2_m2m_codec_end(priv); ++ ++ // Clear a pending EOS ++ if (ff_v4l2_ctx_eos(capture)) { ++ // Arguably we could delay this but this is easy and doesn't require ++ // thought or extra vars ++ ff_v4l2_context_set_status(capture, VIDIOC_STREAMOFF); ++ ff_v4l2_context_set_status(capture, VIDIOC_STREAMON); ++ } ++ ++ // V4L2 makes no guarantees about whether decoded frames are flushed or not ++ // so mark all frames we are tracking to be discarded if they appear ++ xlat_flush(&s->xlat); ++ ++ // resend extradata ++ s->extdata_sent = 0; ++ // clear EOS status vars ++ s->draining = 0; ++ output->done = 0; ++ capture->done = 0; ++ ++ // Stream on will occur when we actually submit a new frame ++ av_log(avctx, AV_LOG_TRACE, ">>> %s\n", __func__); + } + + #define OFFSET(x) offsetof(V4L2m2mPriv, x) +@@ -235,10 +858,16 @@ static av_cold int v4l2_decode_close(AVC + static const AVOption options[] = { + V4L_M2M_DEFAULT_OPTS, + { "num_capture_buffers", "Number of buffers in the capture context", +- OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = 20}, 20, INT_MAX, FLAGS }, ++ OFFSET(num_capture_buffers), AV_OPT_TYPE_INT, {.i64 = 20}, 2, INT_MAX, FLAGS }, ++ { "pixel_format", "Pixel format to be used by the decoder", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, AV_PIX_FMT_NONE, AV_PIX_FMT_NB, FLAGS }, + { NULL}, + }; + ++static const AVCodecHWConfigInternal *v4l2_m2m_hw_configs[] = { ++ HW_CONFIG_INTERNAL(DRM_PRIME), ++ NULL ++}; ++ + #define M2MDEC_CLASS(NAME) \ + static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \ + .class_name = #NAME "_v4l2m2m_decoder", \ +@@ -259,9 +888,15 @@ static const AVOption options[] = { + .init = v4l2_decode_init, \ + .receive_frame = v4l2_receive_frame, \ + .close = v4l2_decode_close, \ ++ .flush = v4l2_decode_flush, \ + .bsfs = bsf_name, \ + .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \ +- .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS, \ ++ .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS | FF_CODEC_CAP_INIT_CLEANUP, \ ++ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_DRM_PRIME, \ ++ AV_PIX_FMT_NV12, \ ++ AV_PIX_FMT_YUV420P, \ ++ AV_PIX_FMT_NONE}, \ ++ .hw_configs = v4l2_m2m_hw_configs, \ + .wrapper_name = "v4l2m2m", \ + } + +--- a/libavcodec/v4l2_m2m_enc.c ++++ b/libavcodec/v4l2_m2m_enc.c +@@ -24,6 +24,8 @@ + #include + #include + #include ++#include ++ + #include "libavcodec/avcodec.h" + #include "libavcodec/internal.h" + #include "libavutil/pixdesc.h" +@@ -37,6 +39,34 @@ + #define MPEG_CID(x) V4L2_CID_MPEG_VIDEO_##x + #define MPEG_VIDEO(x) V4L2_MPEG_VIDEO_##x + ++// P030 should be defined in drm_fourcc.h and hopefully will be sometime ++// in the future but until then... ++#ifndef DRM_FORMAT_P030 ++#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') ++#endif ++ ++#ifndef DRM_FORMAT_NV15 ++#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') ++#endif ++ ++#ifndef DRM_FORMAT_NV20 ++#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') ++#endif ++ ++#ifndef V4L2_CID_CODEC_BASE ++#define V4L2_CID_CODEC_BASE V4L2_CID_MPEG_BASE ++#endif ++ ++// V4L2_PIX_FMT_NV12_10_COL128 and V4L2_PIX_FMT_NV12_COL128 should be defined ++// in videodev2.h hopefully will be sometime in the future but until then... ++#ifndef V4L2_PIX_FMT_NV12_10_COL128 ++#define V4L2_PIX_FMT_NV12_10_COL128 v4l2_fourcc('N', 'C', '3', '0') ++#endif ++ ++#ifndef V4L2_PIX_FMT_NV12_COL128 ++#define V4L2_PIX_FMT_NV12_COL128 v4l2_fourcc('N', 'C', '1', '2') /* 12 Y/CbCr 4:2:0 128 pixel wide column */ ++#endif ++ + static inline void v4l2_set_timeperframe(V4L2m2mContext *s, unsigned int num, unsigned int den) + { + struct v4l2_streamparm parm = { 0 }; +@@ -147,15 +177,14 @@ static inline int v4l2_mpeg4_profile_fro + static int v4l2_check_b_frame_support(V4L2m2mContext *s) + { + if (s->avctx->max_b_frames) +- av_log(s->avctx, AV_LOG_WARNING, "Encoder does not support b-frames yet\n"); ++ av_log(s->avctx, AV_LOG_WARNING, "Encoder does not support %d b-frames yet\n", s->avctx->max_b_frames); + +- v4l2_set_ext_ctrl(s, MPEG_CID(B_FRAMES), 0, "number of B-frames", 0); ++ v4l2_set_ext_ctrl(s, MPEG_CID(B_FRAMES), s->avctx->max_b_frames, "number of B-frames", 1); + v4l2_get_ext_ctrl(s, MPEG_CID(B_FRAMES), &s->avctx->max_b_frames, "number of B-frames", 0); + if (s->avctx->max_b_frames == 0) + return 0; + + avpriv_report_missing_feature(s->avctx, "DTS/PTS calculation for V4L2 encoding"); +- + return AVERROR_PATCHWELCOME; + } + +@@ -270,13 +299,184 @@ static int v4l2_prepare_encoder(V4L2m2mC + return 0; + } + ++static int avdrm_to_v4l2(struct v4l2_format * const format, const AVFrame * const frame) ++{ ++ const AVDRMFrameDescriptor *const src = (const AVDRMFrameDescriptor *)frame->data[0]; ++ ++ const uint32_t drm_fmt = src->layers[0].format; ++ // Treat INVALID as LINEAR ++ const uint64_t mod = src->objects[0].format_modifier == DRM_FORMAT_MOD_INVALID ? ++ DRM_FORMAT_MOD_LINEAR : src->objects[0].format_modifier; ++ uint32_t pix_fmt = 0; ++ uint32_t w = 0; ++ uint32_t h = 0; ++ uint32_t bpl = src->layers[0].planes[0].pitch; ++ ++ // We really don't expect multiple layers ++ // All formats that we currently cope with are single object ++ ++ if (src->nb_layers != 1 || src->nb_objects != 1) ++ return AVERROR(EINVAL); ++ ++ switch (drm_fmt) { ++ case DRM_FORMAT_YUV420: ++ if (mod == DRM_FORMAT_MOD_LINEAR) { ++ if (src->layers[0].nb_planes != 3) ++ break; ++ pix_fmt = V4L2_PIX_FMT_YUV420; ++ h = src->layers[0].planes[1].offset / bpl; ++ w = bpl; ++ } ++ break; ++ ++ case DRM_FORMAT_NV12: ++ if (mod == DRM_FORMAT_MOD_LINEAR) { ++ if (src->layers[0].nb_planes != 2) ++ break; ++ pix_fmt = V4L2_PIX_FMT_NV12; ++ h = src->layers[0].planes[1].offset / bpl; ++ w = bpl; ++ } ++ else if (fourcc_mod_broadcom_mod(mod) == DRM_FORMAT_MOD_BROADCOM_SAND128) { ++ if (src->layers[0].nb_planes != 2) ++ break; ++ pix_fmt = V4L2_PIX_FMT_NV12_COL128; ++ w = bpl; ++ h = src->layers[0].planes[1].offset / 128; ++ bpl = fourcc_mod_broadcom_param(mod); ++ } ++ break; ++ ++ case DRM_FORMAT_P030: ++ if (fourcc_mod_broadcom_mod(mod) == DRM_FORMAT_MOD_BROADCOM_SAND128) { ++ if (src->layers[0].nb_planes != 2) ++ break; ++ pix_fmt = V4L2_PIX_FMT_NV12_10_COL128; ++ w = bpl / 2; // Matching lie to how we construct this ++ h = src->layers[0].planes[1].offset / 128; ++ bpl = fourcc_mod_broadcom_param(mod); ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ if (!pix_fmt) ++ return AVERROR(EINVAL); ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(format->type)) { ++ struct v4l2_pix_format_mplane *const pix = &format->fmt.pix_mp; ++ ++ pix->width = w; ++ pix->height = h; ++ pix->pixelformat = pix_fmt; ++ pix->plane_fmt[0].bytesperline = bpl; ++ pix->num_planes = 1; ++ } ++ else { ++ struct v4l2_pix_format *const pix = &format->fmt.pix; ++ ++ pix->width = w; ++ pix->height = h; ++ pix->pixelformat = pix_fmt; ++ pix->bytesperline = bpl; ++ } ++ ++ return 0; ++} ++ ++// Do we have similar enough formats to be usable? ++static int fmt_eq(const struct v4l2_format * const a, const struct v4l2_format * const b) ++{ ++ if (a->type != b->type) ++ return 0; ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(a->type)) { ++ const struct v4l2_pix_format_mplane *const pa = &a->fmt.pix_mp; ++ const struct v4l2_pix_format_mplane *const pb = &b->fmt.pix_mp; ++ unsigned int i; ++ if (pa->pixelformat != pb->pixelformat || ++ pa->num_planes != pb->num_planes) ++ return 0; ++ for (i = 0; i != pa->num_planes; ++i) { ++ if (pa->plane_fmt[i].bytesperline != pb->plane_fmt[i].bytesperline) ++ return 0; ++ } ++ } ++ else { ++ const struct v4l2_pix_format *const pa = &a->fmt.pix; ++ const struct v4l2_pix_format *const pb = &b->fmt.pix; ++ if (pa->pixelformat != pb->pixelformat || ++ pa->bytesperline != pb->bytesperline) ++ return 0; ++ } ++ return 1; ++} ++ ++ + static int v4l2_send_frame(AVCodecContext *avctx, const AVFrame *frame) + { + V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context; + V4L2Context *const output = &s->output; + ++ // Signal EOF if needed ++ if (!frame) { ++ return ff_v4l2_context_enqueue_frame(output, frame); ++ } ++ ++ if (s->input_drm && !output->streamon) { ++ int rv; ++ struct v4l2_format req_format = {.type = output->format.type}; ++ ++ // Set format when we first get a buffer ++ if ((rv = avdrm_to_v4l2(&req_format, frame)) != 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to get V4L2 format from DRM_PRIME frame\n"); ++ return rv; ++ } ++ ++ ff_v4l2_context_release(output); ++ ++ output->format = req_format; ++ ++ if ((rv = ff_v4l2_context_set_format(output)) != 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to set V4L2 format\n"); ++ return rv; ++ } ++ ++ if (!fmt_eq(&req_format, &output->format)) { ++ av_log(avctx, AV_LOG_ERROR, "Format mismatch after setup\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ output->selection.top = frame->crop_top; ++ output->selection.left = frame->crop_left; ++ output->selection.width = av_frame_cropped_width(frame); ++ output->selection.height = av_frame_cropped_height(frame); ++ ++ if ((rv = ff_v4l2_context_init(output)) != 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to (re)init context\n"); ++ return rv; ++ } ++ ++ { ++ struct v4l2_selection selection = { ++ .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, ++ .target = V4L2_SEL_TGT_CROP, ++ .r = output->selection ++ }; ++ if (ioctl(s->fd, VIDIOC_S_SELECTION, &selection) != 0) { ++ av_log(avctx, AV_LOG_WARNING, "S_SELECTION (CROP) %dx%d @ %d,%d failed: %s\n", ++ selection.r.width, selection.r.height, selection.r.left, selection.r.top, ++ av_err2str(AVERROR(errno))); ++ } ++ av_log(avctx, AV_LOG_TRACE, "S_SELECTION (CROP) %dx%d @ %d,%d OK\n", ++ selection.r.width, selection.r.height, selection.r.left, selection.r.top); ++ } ++ } ++ + #ifdef V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME +- if (frame && frame->pict_type == AV_PICTURE_TYPE_I) ++ if (frame->pict_type == AV_PICTURE_TYPE_I) + v4l2_set_ext_ctrl(s, MPEG_CID(FORCE_KEY_FRAME), 0, "force key frame", 1); + #endif + +@@ -310,7 +510,70 @@ static int v4l2_receive_packet(AVCodecCo + } + + dequeue: +- return ff_v4l2_context_dequeue_packet(capture, avpkt); ++ if ((ret = ff_v4l2_context_dequeue_packet(capture, avpkt)) != 0) ++ return ret; ++ ++ if (capture->first_buf == 1) { ++ uint8_t * data; ++ const int len = avpkt->size; ++ ++ // 1st buffer after streamon should be SPS/PPS ++ capture->first_buf = 2; ++ ++ // Clear both possible stores so there is no chance of confusion ++ av_freep(&s->extdata_data); ++ s->extdata_size = 0; ++ av_freep(&avctx->extradata); ++ avctx->extradata_size = 0; ++ ++ if ((data = av_malloc(len + AV_INPUT_BUFFER_PADDING_SIZE)) != NULL) ++ memcpy(data, avpkt->data, len); ++ ++ av_packet_unref(avpkt); ++ ++ if (data == NULL) ++ return AVERROR(ENOMEM); ++ ++ // We need to copy the header, but keep local if not global ++ if ((avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) != 0) { ++ avctx->extradata = data; ++ avctx->extradata_size = len; ++ } ++ else { ++ s->extdata_data = data; ++ s->extdata_size = len; ++ } ++ ++ if ((ret = ff_v4l2_context_dequeue_packet(capture, avpkt)) != 0) ++ return ret; ++ } ++ ++ // First frame must be key so mark as such even if encoder forgot ++ if (capture->first_buf == 2) ++ avpkt->flags |= AV_PKT_FLAG_KEY; ++ ++ // Add SPS/PPS to the start of every key frame if non-global headers ++ if ((avpkt->flags & AV_PKT_FLAG_KEY) != 0 && s->extdata_size != 0) { ++ const size_t newlen = s->extdata_size + avpkt->size; ++ AVBufferRef * const buf = av_buffer_alloc(newlen + AV_INPUT_BUFFER_PADDING_SIZE); ++ ++ if (buf == NULL) { ++ av_packet_unref(avpkt); ++ return AVERROR(ENOMEM); ++ } ++ ++ memcpy(buf->data, s->extdata_data, s->extdata_size); ++ memcpy(buf->data + s->extdata_size, avpkt->data, avpkt->size); ++ ++ av_buffer_unref(&avpkt->buf); ++ avpkt->buf = buf; ++ avpkt->data = buf->data; ++ avpkt->size = newlen; ++ } ++ ++// av_log(avctx, AV_LOG_INFO, "%s: PTS out=%"PRId64", size=%d, ret=%d\n", __func__, avpkt->pts, avpkt->size, ret); ++ capture->first_buf = 0; ++ return 0; + } + + static av_cold int v4l2_encode_init(AVCodecContext *avctx) +@@ -322,6 +585,8 @@ static av_cold int v4l2_encode_init(AVCo + uint32_t v4l2_fmt_output; + int ret; + ++ av_log(avctx, AV_LOG_INFO, " <<< %s: fmt=%d/%d\n", __func__, avctx->pix_fmt, avctx->sw_pix_fmt); ++ + ret = ff_v4l2_m2m_create_context(priv, &s); + if (ret < 0) + return ret; +@@ -329,13 +594,17 @@ static av_cold int v4l2_encode_init(AVCo + capture = &s->capture; + output = &s->output; + ++ s->input_drm = (avctx->pix_fmt == AV_PIX_FMT_DRM_PRIME); ++ + /* common settings output/capture */ + output->height = capture->height = avctx->height; + output->width = capture->width = avctx->width; + + /* output context */ + output->av_codec_id = AV_CODEC_ID_RAWVIDEO; +- output->av_pix_fmt = avctx->pix_fmt; ++ output->av_pix_fmt = !s->input_drm ? avctx->pix_fmt : ++ avctx->sw_pix_fmt != AV_PIX_FMT_NONE ? avctx->sw_pix_fmt : ++ AV_PIX_FMT_YUV420P; + + /* capture context */ + capture->av_codec_id = avctx->codec_id; +@@ -354,7 +623,7 @@ static av_cold int v4l2_encode_init(AVCo + v4l2_fmt_output = output->format.fmt.pix.pixelformat; + + pix_fmt_output = ff_v4l2_format_v4l2_to_avfmt(v4l2_fmt_output, AV_CODEC_ID_RAWVIDEO); +- if (pix_fmt_output != avctx->pix_fmt) { ++ if (!s->input_drm && pix_fmt_output != avctx->pix_fmt) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt_output); + av_log(avctx, AV_LOG_ERROR, "Encoder requires %s pixel format.\n", desc->name); + return AVERROR(EINVAL); +--- /dev/null ++++ b/libavcodec/v4l2_req_decode_q.c +@@ -0,0 +1,84 @@ ++#include ++#include ++#include ++ ++#include "v4l2_req_decode_q.h" ++ ++int decode_q_in_q(const req_decode_ent * const d) ++{ ++ return d->in_q; ++} ++ ++void decode_q_add(req_decode_q * const q, req_decode_ent * const d) ++{ ++ pthread_mutex_lock(&q->q_lock); ++ if (!q->head) { ++ q->head = d; ++ q->tail = d; ++ d->prev = NULL; ++ } ++ else { ++ q->tail->next = d; ++ d->prev = q->tail; ++ q->tail = d; ++ } ++ d->next = NULL; ++ d->in_q = 1; ++ pthread_mutex_unlock(&q->q_lock); ++} ++ ++// Remove entry from Q - if head wake-up anything that was waiting ++void decode_q_remove(req_decode_q * const q, req_decode_ent * const d) ++{ ++ int try_signal = 0; ++ ++ if (!d->in_q) ++ return; ++ ++ pthread_mutex_lock(&q->q_lock); ++ if (d->prev) ++ d->prev->next = d->next; ++ else { ++ try_signal = 1; // Only need to signal if we were head ++ q->head = d->next; ++ } ++ ++ if (d->next) ++ d->next->prev = d->prev; ++ else ++ q->tail = d->prev; ++ ++ // Not strictly needed but makes debug easier ++ d->next = NULL; ++ d->prev = NULL; ++ d->in_q = 0; ++ pthread_mutex_unlock(&q->q_lock); ++ ++ if (try_signal) ++ pthread_cond_broadcast(&q->q_cond); ++} ++ ++void decode_q_wait(req_decode_q * const q, req_decode_ent * const d) ++{ ++ pthread_mutex_lock(&q->q_lock); ++ ++ while (q->head != d) ++ pthread_cond_wait(&q->q_cond, &q->q_lock); ++ ++ pthread_mutex_unlock(&q->q_lock); ++} ++ ++void decode_q_uninit(req_decode_q * const q) ++{ ++ pthread_mutex_destroy(&q->q_lock); ++ pthread_cond_destroy(&q->q_cond); ++} ++ ++void decode_q_init(req_decode_q * const q) ++{ ++ memset(q, 0, sizeof(*q)); ++ pthread_mutex_init(&q->q_lock, NULL); ++ pthread_cond_init(&q->q_cond, NULL); ++} ++ ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_decode_q.h +@@ -0,0 +1,25 @@ ++#ifndef AVCODEC_V4L2_REQ_DECODE_Q_H ++#define AVCODEC_V4L2_REQ_DECODE_Q_H ++ ++typedef struct req_decode_ent { ++ struct req_decode_ent * next; ++ struct req_decode_ent * prev; ++ int in_q; ++} req_decode_ent; ++ ++typedef struct req_decode_q { ++ pthread_mutex_t q_lock; ++ pthread_cond_t q_cond; ++ req_decode_ent * head; ++ req_decode_ent * tail; ++} req_decode_q; ++ ++int decode_q_in_q(const req_decode_ent * const d); ++void decode_q_add(req_decode_q * const q, req_decode_ent * const d); ++void decode_q_remove(req_decode_q * const q, req_decode_ent * const d); ++void decode_q_wait(req_decode_q * const q, req_decode_ent * const d); ++void decode_q_uninit(req_decode_q * const q); ++void decode_q_init(req_decode_q * const q); ++ ++#endif ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_devscan.c +@@ -0,0 +1,449 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++ ++#include "v4l2_req_devscan.h" ++#include "v4l2_req_utils.h" ++ ++struct decdev { ++ enum v4l2_buf_type src_type; ++ uint32_t src_fmt_v4l2; ++ const char * vname; ++ const char * mname; ++}; ++ ++struct devscan { ++ struct decdev env; ++ unsigned int dev_size; ++ unsigned int dev_count; ++ struct decdev *devs; ++}; ++ ++static int video_src_pixfmt_supported(uint32_t fmt) ++{ ++ return 1; ++} ++ ++static void v4l2_setup_format(struct v4l2_format *format, unsigned int type, ++ unsigned int width, unsigned int height, ++ unsigned int pixelformat) ++{ ++ unsigned int sizeimage; ++ ++ memset(format, 0, sizeof(*format)); ++ format->type = type; ++ ++ sizeimage = V4L2_TYPE_IS_OUTPUT(type) ? 4 * 1024 * 1024 : 0; ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(type)) { ++ format->fmt.pix_mp.width = width; ++ format->fmt.pix_mp.height = height; ++ format->fmt.pix_mp.plane_fmt[0].sizeimage = sizeimage; ++ format->fmt.pix_mp.pixelformat = pixelformat; ++ } else { ++ format->fmt.pix.width = width; ++ format->fmt.pix.height = height; ++ format->fmt.pix.sizeimage = sizeimage; ++ format->fmt.pix.pixelformat = pixelformat; ++ } ++} ++ ++static int v4l2_set_format(int video_fd, unsigned int type, unsigned int pixelformat, ++ unsigned int width, unsigned int height) ++{ ++ struct v4l2_format format; ++ ++ v4l2_setup_format(&format, type, width, height, pixelformat); ++ ++ return ioctl(video_fd, VIDIOC_S_FMT, &format) ? -errno : 0; ++} ++ ++static int v4l2_query_capabilities(int video_fd, unsigned int *capabilities) ++{ ++ struct v4l2_capability capability = { 0 }; ++ int rc; ++ ++ rc = ioctl(video_fd, VIDIOC_QUERYCAP, &capability); ++ if (rc < 0) ++ return -errno; ++ ++ if (capabilities != NULL) { ++ if ((capability.capabilities & V4L2_CAP_DEVICE_CAPS) != 0) ++ *capabilities = capability.device_caps; ++ else ++ *capabilities = capability.capabilities; ++ } ++ ++ return 0; ++} ++ ++static int devscan_add(struct devscan *const scan, ++ enum v4l2_buf_type src_type, ++ uint32_t src_fmt_v4l2, ++ const char * vname, ++ const char * mname) ++{ ++ struct decdev *d; ++ ++ if (scan->dev_size <= scan->dev_count) { ++ unsigned int n = !scan->dev_size ? 4 : scan->dev_size * 2; ++ d = realloc(scan->devs, n * sizeof(*d)); ++ if (!d) ++ return -ENOMEM; ++ scan->devs = d; ++ scan->dev_size = n; ++ } ++ ++ d = scan->devs + scan->dev_count; ++ d->src_type = src_type; ++ d->src_fmt_v4l2 = src_fmt_v4l2; ++ d->vname = strdup(vname); ++ if (!d->vname) ++ return -ENOMEM; ++ d->mname = strdup(mname); ++ if (!d->mname) { ++ free((char *)d->vname); ++ return -ENOMEM; ++ } ++ ++scan->dev_count; ++ return 0; ++} ++ ++void devscan_delete(struct devscan **const pScan) ++{ ++ unsigned int i; ++ struct devscan * const scan = *pScan; ++ ++ if (!scan) ++ return; ++ *pScan = NULL; ++ ++ for (i = 0; i < scan->dev_count; ++i) { ++ free((char*)scan->devs[i].mname); ++ free((char*)scan->devs[i].vname); ++ } ++ free(scan->devs); ++ free(scan); ++} ++ ++#define REQ_BUF_CAPS (\ ++ V4L2_BUF_CAP_SUPPORTS_DMABUF |\ ++ V4L2_BUF_CAP_SUPPORTS_REQUESTS |\ ++ V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF) ++ ++static void probe_formats(void * const dc, ++ struct devscan *const scan, ++ const int fd, ++ const unsigned int type_v4l2, ++ const char *const mpath, ++ const char *const vpath) ++{ ++ unsigned int i; ++ for (i = 0;; ++i) { ++ struct v4l2_fmtdesc fmtdesc = { ++ .index = i, ++ .type = type_v4l2 ++ }; ++ struct v4l2_requestbuffers rbufs = { ++ .count = 0, ++ .type = type_v4l2, ++ .memory = V4L2_MEMORY_MMAP ++ }; ++ while (ioctl(fd, VIDIOC_ENUM_FMT, &fmtdesc)) { ++ if (errno == EINTR) ++ continue; ++ if (errno != EINVAL) ++ request_err(dc, "Enum[%d] failed for type=%d\n", i, type_v4l2); ++ return; ++ } ++ if (!video_src_pixfmt_supported(fmtdesc.pixelformat)) ++ continue; ++ ++ if (v4l2_set_format(fd, type_v4l2, fmtdesc.pixelformat, 720, 480)) { ++ request_debug(dc, "Set failed for type=%d, pf=%.4s\n", type_v4l2, (char*)&fmtdesc.pixelformat); ++ continue; ++ } ++ ++ while (ioctl(fd, VIDIOC_REQBUFS, &rbufs)) { ++ if (errno != EINTR) { ++ request_debug(dc, "%s: Reqbufs failed\n", vpath); ++ continue; ++ } ++ } ++ ++ if ((rbufs.capabilities & REQ_BUF_CAPS) != REQ_BUF_CAPS) { ++ request_debug(dc, "%s: Buf caps %#x insufficient\n", vpath, rbufs.capabilities); ++ continue; ++ } ++ ++ request_debug(dc, "Adding: %s,%s pix=%#x, type=%d\n", ++ mpath, vpath, fmtdesc.pixelformat, type_v4l2); ++ devscan_add(scan, type_v4l2, fmtdesc.pixelformat, vpath, mpath); ++ } ++} ++ ++ ++static int probe_video_device(void * const dc, ++ struct udev_device *const device, ++ struct devscan *const scan, ++ const char *const mpath) ++{ ++ int ret; ++ unsigned int capabilities = 0; ++ int video_fd = -1; ++ ++ const char *path = udev_device_get_devnode(device); ++ if (!path) { ++ request_err(dc, "%s: get video device devnode failed\n", __func__); ++ ret = -EINVAL; ++ goto fail; ++ } ++ ++ video_fd = open(path, O_RDWR, 0); ++ if (video_fd == -1) { ++ ret = -errno; ++ request_err(dc, "%s: opening %s failed, %s (%d)\n", __func__, path, strerror(errno), errno); ++ goto fail; ++ } ++ ++ ret = v4l2_query_capabilities(video_fd, &capabilities); ++ if (ret < 0) { ++ request_err(dc, "%s: get video capability failed, %s (%d)\n", __func__, strerror(-ret), -ret); ++ goto fail; ++ } ++ ++ request_debug(dc, "%s: path=%s capabilities=%#x\n", __func__, path, capabilities); ++ ++ if (!(capabilities & V4L2_CAP_STREAMING)) { ++ request_debug(dc, "%s: missing required streaming capability\n", __func__); ++ ret = -EINVAL; ++ goto fail; ++ } ++ ++ if (!(capabilities & (V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M))) { ++ request_debug(dc, "%s: missing required mem2mem capability\n", __func__); ++ ret = -EINVAL; ++ goto fail; ++ } ++ ++ /* Should check capture formats too... */ ++ if ((capabilities & V4L2_CAP_VIDEO_M2M) != 0) ++ probe_formats(dc, scan, video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT, mpath, path); ++ if ((capabilities & V4L2_CAP_VIDEO_M2M_MPLANE) != 0) ++ probe_formats(dc, scan, video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, mpath, path); ++ ++ close(video_fd); ++ return 0; ++ ++fail: ++ if (video_fd >= 0) ++ close(video_fd); ++ return ret; ++} ++ ++static int probe_media_device(void * const dc, ++ struct udev_device *const device, ++ struct devscan *const scan) ++{ ++ int ret; ++ int rv; ++ struct media_device_info device_info = { 0 }; ++ struct media_v2_topology topology = { 0 }; ++ struct media_v2_interface *interfaces = NULL; ++ struct udev *udev = udev_device_get_udev(device); ++ struct udev_device *video_device; ++ dev_t devnum; ++ int media_fd = -1; ++ ++ const char *path = udev_device_get_devnode(device); ++ if (!path) { ++ request_err(dc, "%s: get media device devnode failed\n", __func__); ++ ret = -EINVAL; ++ goto fail; ++ } ++ ++ media_fd = open(path, O_RDWR, 0); ++ if (media_fd < 0) { ++ ret = -errno; ++ request_err(dc, "%s: opening %s failed, %s (%d)\n", __func__, path, strerror(-ret), -ret); ++ goto fail; ++ } ++ ++ rv = ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &device_info); ++ if (rv < 0) { ++ ret = -errno; ++ request_err(dc, "%s: get media device info failed, %s (%d)\n", __func__, strerror(-ret), -ret); ++ goto fail; ++ } ++ ++ rv = ioctl(media_fd, MEDIA_IOC_G_TOPOLOGY, &topology); ++ if (rv < 0) { ++ ret = -errno; ++ request_err(dc, "%s: get media topology failed, %s (%d)\n", __func__, strerror(-ret), -ret); ++ goto fail; ++ } ++ ++ if (topology.num_interfaces <= 0) { ++ request_err(dc, "%s: media device has no interfaces\n", __func__); ++ ret = -EINVAL; ++ goto fail; ++ } ++ ++ interfaces = calloc(topology.num_interfaces, sizeof(*interfaces)); ++ if (!interfaces) { ++ request_err(dc, "%s: allocating media interface struct failed\n", __func__); ++ ret = -ENOMEM; ++ goto fail; ++ } ++ ++ topology.ptr_interfaces = (__u64)(uintptr_t)interfaces; ++ rv = ioctl(media_fd, MEDIA_IOC_G_TOPOLOGY, &topology); ++ if (rv < 0) { ++ ret = -errno; ++ request_err(dc, "%s: get media topology failed, %s (%d)\n", __func__, strerror(-ret), -ret); ++ goto fail; ++ } ++ ++ for (int i = 0; i < topology.num_interfaces; i++) { ++ if (interfaces[i].intf_type != MEDIA_INTF_T_V4L_VIDEO) ++ continue; ++ ++ devnum = makedev(interfaces[i].devnode.major, interfaces[i].devnode.minor); ++ video_device = udev_device_new_from_devnum(udev, 'c', devnum); ++ if (!video_device) { ++ ret = -errno; ++ request_err(dc, "%s: video_device[%d]=%p\n", __func__, i, video_device); ++ continue; ++ } ++ ++ ret = probe_video_device(dc, video_device, scan, path); ++ udev_device_unref(video_device); ++ ++ if (ret != 0) ++ goto fail; ++ } ++ ++fail: ++ free(interfaces); ++ if (media_fd != -1) ++ close(media_fd); ++ return ret; ++} ++ ++const char *decdev_media_path(const struct decdev *const dev) ++{ ++ return !dev ? NULL : dev->mname; ++} ++ ++const char *decdev_video_path(const struct decdev *const dev) ++{ ++ return !dev ? NULL : dev->vname; ++} ++ ++enum v4l2_buf_type decdev_src_type(const struct decdev *const dev) ++{ ++ return !dev ? 0 : dev->src_type; ++} ++ ++uint32_t decdev_src_pixelformat(const struct decdev *const dev) ++{ ++ return !dev ? 0 : dev->src_fmt_v4l2; ++} ++ ++ ++const struct decdev *devscan_find(struct devscan *const scan, ++ const uint32_t src_fmt_v4l2) ++{ ++ unsigned int i; ++ ++ if (scan->env.mname && scan->env.vname) ++ return &scan->env; ++ ++ if (!src_fmt_v4l2) ++ return scan->dev_count ? scan->devs + 0 : NULL; ++ ++ for (i = 0; i != scan->dev_count; ++i) { ++ if (scan->devs[i].src_fmt_v4l2 == src_fmt_v4l2) ++ return scan->devs + i; ++ } ++ return NULL; ++} ++ ++int devscan_build(void * const dc, struct devscan **pscan) ++{ ++ int ret; ++ struct udev *udev; ++ struct udev_enumerate *enumerate; ++ struct udev_list_entry *devices; ++ struct udev_list_entry *entry; ++ struct udev_device *device; ++ struct devscan * scan; ++ ++ *pscan = NULL; ++ ++ scan = calloc(1, sizeof(*scan)); ++ if (!scan) { ++ ret = -ENOMEM; ++ goto fail; ++ } ++ ++ scan->env.mname = getenv("LIBVA_V4L2_REQUEST_MEDIA_PATH"); ++ scan->env.vname = getenv("LIBVA_V4L2_REQUEST_VIDEO_PATH"); ++ if (scan->env.mname && scan->env.vname) { ++ request_info(dc, "Media/video device env overrides found: %s,%s\n", ++ scan->env.mname, scan->env.vname); ++ *pscan = scan; ++ return 0; ++ } ++ ++ udev = udev_new(); ++ if (!udev) { ++ request_err(dc, "%s: allocating udev context failed\n", __func__); ++ ret = -ENOMEM; ++ goto fail; ++ } ++ ++ enumerate = udev_enumerate_new(udev); ++ if (!enumerate) { ++ request_err(dc, "%s: allocating udev enumerator failed\n", __func__); ++ ret = -ENOMEM; ++ goto fail; ++ } ++ ++ udev_enumerate_add_match_subsystem(enumerate, "media"); ++ udev_enumerate_scan_devices(enumerate); ++ ++ devices = udev_enumerate_get_list_entry(enumerate); ++ udev_list_entry_foreach(entry, devices) { ++ const char *path = udev_list_entry_get_name(entry); ++ if (!path) ++ continue; ++ ++ device = udev_device_new_from_syspath(udev, path); ++ if (!device) ++ continue; ++ ++ probe_media_device(dc, device, scan); ++ udev_device_unref(device); ++ } ++ ++ udev_enumerate_unref(enumerate); ++ ++ *pscan = scan; ++ return 0; ++ ++fail: ++ udev_unref(udev); ++ devscan_delete(&scan); ++ return ret; ++} ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_devscan.h +@@ -0,0 +1,21 @@ ++#ifndef _DEVSCAN_H_ ++#define _DEVSCAN_H_ ++ ++struct devscan; ++struct decdev; ++enum v4l2_buf_type; ++ ++/* These return pointers to data in the devscan structure and so are vaild ++ * for the lifetime of that ++ */ ++const char *decdev_media_path(const struct decdev *const dev); ++const char *decdev_video_path(const struct decdev *const dev); ++enum v4l2_buf_type decdev_src_type(const struct decdev *const dev); ++uint32_t decdev_src_pixelformat(const struct decdev *const dev); ++ ++const struct decdev *devscan_find(struct devscan *const scan, const uint32_t src_fmt_v4l2); ++ ++int devscan_build(void * const dc, struct devscan **pscan); ++void devscan_delete(struct devscan **const pScan); ++ ++#endif +--- /dev/null ++++ b/libavcodec/v4l2_req_dmabufs.c +@@ -0,0 +1,266 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "v4l2_req_dmabufs.h" ++#include "v4l2_req_utils.h" ++ ++#define DMABUF_NAME1 "/dev/dma_heap/linux,cma" ++#define DMABUF_NAME2 "/dev/dma_heap/reserved" ++ ++#define TRACE_ALLOC 0 ++ ++struct dmabufs_ctl { ++ int fd; ++ size_t page_size; ++}; ++ ++struct dmabuf_h { ++ int fd; ++ size_t size; ++ size_t len; ++ void * mapptr; ++}; ++ ++#if TRACE_ALLOC ++static unsigned int total_bufs = 0; ++static size_t total_size = 0; ++#endif ++ ++struct dmabuf_h * dmabuf_import(int fd, size_t size) ++{ ++ struct dmabuf_h *dh; ++ ++ fd = dup(fd); ++ if (fd < 0 || size == 0) ++ return NULL; ++ ++ dh = malloc(sizeof(*dh)); ++ if (!dh) { ++ close(fd); ++ return NULL; ++ } ++ ++ *dh = (struct dmabuf_h) { ++ .fd = fd, ++ .size = size, ++ .mapptr = MAP_FAILED ++ }; ++ ++#if TRACE_ALLOC ++ ++total_bufs; ++ total_size += dh->size; ++ request_log("%s: Import: %zd, total=%zd, bufs=%d\n", __func__, dh->size, total_size, total_bufs); ++#endif ++ ++ return dh; ++} ++ ++struct dmabuf_h * dmabuf_realloc(struct dmabufs_ctl * dbsc, struct dmabuf_h * old, size_t size) ++{ ++ struct dmabuf_h * dh; ++ struct dma_heap_allocation_data data = { ++ .len = (size + dbsc->page_size - 1) & ~(dbsc->page_size - 1), ++ .fd = 0, ++ .fd_flags = O_RDWR, ++ .heap_flags = 0 ++ }; ++ ++ if (old != NULL) { ++ if (old->size == data.len) { ++ return old; ++ } ++ dmabuf_free(old); ++ } ++ ++ if (size == 0 || ++ (dh = malloc(sizeof(*dh))) == NULL) ++ return NULL; ++ ++ while (ioctl(dbsc->fd, DMA_HEAP_IOCTL_ALLOC, &data)) { ++ int err = errno; ++ request_log("Failed to alloc %" PRIu64 " from dma-heap(fd=%d): %d (%s)\n", ++ (uint64_t)data.len, ++ dbsc->fd, ++ err, ++ strerror(err)); ++ if (err == EINTR) ++ continue; ++ goto fail; ++ } ++ ++ *dh = (struct dmabuf_h){ ++ .fd = data.fd, ++ .size = (size_t)data.len, ++ .mapptr = MAP_FAILED ++ }; ++ ++#if TRACE_ALLOC ++ ++total_bufs; ++ total_size += dh->size; ++ request_log("%s: Alloc: %zd, total=%zd, bufs=%d\n", __func__, dh->size, total_size, total_bufs); ++#endif ++ ++ return dh; ++ ++fail: ++ free(dh); ++ return NULL; ++} ++ ++int dmabuf_sync(struct dmabuf_h * const dh, unsigned int flags) ++{ ++ struct dma_buf_sync sync = { ++ .flags = flags ++ }; ++ while (ioctl(dh->fd, DMA_BUF_IOCTL_SYNC, &sync) == -1) { ++ const int err = errno; ++ if (errno == EINTR) ++ continue; ++ request_log("%s: ioctl failed: flags=%#x\n", __func__, flags); ++ return -err; ++ } ++ return 0; ++} ++ ++int dmabuf_write_start(struct dmabuf_h * const dh) ++{ ++ return dmabuf_sync(dh, DMA_BUF_SYNC_START | DMA_BUF_SYNC_WRITE); ++} ++ ++int dmabuf_write_end(struct dmabuf_h * const dh) ++{ ++ return dmabuf_sync(dh, DMA_BUF_SYNC_END | DMA_BUF_SYNC_WRITE); ++} ++ ++int dmabuf_read_start(struct dmabuf_h * const dh) ++{ ++ if (!dmabuf_map(dh)) ++ return -1; ++ return dmabuf_sync(dh, DMA_BUF_SYNC_START | DMA_BUF_SYNC_READ); ++} ++ ++int dmabuf_read_end(struct dmabuf_h * const dh) ++{ ++ return dmabuf_sync(dh, DMA_BUF_SYNC_END | DMA_BUF_SYNC_READ); ++} ++ ++ ++void * dmabuf_map(struct dmabuf_h * const dh) ++{ ++ if (!dh) ++ return NULL; ++ if (dh->mapptr != MAP_FAILED) ++ return dh->mapptr; ++ dh->mapptr = mmap(NULL, dh->size, ++ PROT_READ | PROT_WRITE, ++ MAP_SHARED | MAP_POPULATE, ++ dh->fd, 0); ++ if (dh->mapptr == MAP_FAILED) { ++ request_log("%s: Map failed\n", __func__); ++ return NULL; ++ } ++ return dh->mapptr; ++} ++ ++int dmabuf_fd(const struct dmabuf_h * const dh) ++{ ++ if (!dh) ++ return -1; ++ return dh->fd; ++} ++ ++size_t dmabuf_size(const struct dmabuf_h * const dh) ++{ ++ if (!dh) ++ return 0; ++ return dh->size; ++} ++ ++size_t dmabuf_len(const struct dmabuf_h * const dh) ++{ ++ if (!dh) ++ return 0; ++ return dh->len; ++} ++ ++void dmabuf_len_set(struct dmabuf_h * const dh, const size_t len) ++{ ++ dh->len = len; ++} ++ ++ ++ ++void dmabuf_free(struct dmabuf_h * dh) ++{ ++ if (!dh) ++ return; ++ ++#if TRACE_ALLOC ++ --total_bufs; ++ total_size -= dh->size; ++ request_log("%s: Free: %zd, total=%zd, bufs=%d\n", __func__, dh->size, total_size, total_bufs); ++#endif ++ ++ if (dh->mapptr != MAP_FAILED) ++ munmap(dh->mapptr, dh->size); ++ while (close(dh->fd) == -1 && errno == EINTR) ++ /* loop */; ++ free(dh); ++} ++ ++struct dmabufs_ctl * dmabufs_ctl_new(void) ++{ ++ struct dmabufs_ctl * dbsc = malloc(sizeof(*dbsc)); ++ ++ if (!dbsc) ++ return NULL; ++ ++ while ((dbsc->fd = open(DMABUF_NAME1, O_RDWR)) == -1 && ++ errno == EINTR) ++ /* Loop */; ++ ++ if (dbsc->fd == -1) { ++ while ((dbsc->fd = open(DMABUF_NAME2, O_RDWR)) == -1 && ++ errno == EINTR) ++ /* Loop */; ++ if (dbsc->fd == -1) { ++ request_log("Unable to open either %s or %s\n", ++ DMABUF_NAME1, DMABUF_NAME2); ++ goto fail; ++ } ++ } ++ ++ dbsc->page_size = (size_t)sysconf(_SC_PAGE_SIZE); ++ ++ return dbsc; ++ ++fail: ++ free(dbsc); ++ return NULL; ++} ++ ++void dmabufs_ctl_delete(struct dmabufs_ctl ** const pDbsc) ++{ ++ struct dmabufs_ctl * const dbsc = *pDbsc; ++ ++ if (!dbsc) ++ return; ++ *pDbsc = NULL; ++ ++ while (close(dbsc->fd) == -1 && errno == EINTR) ++ /* loop */; ++ ++ free(dbsc); ++} ++ ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_dmabufs.h +@@ -0,0 +1,38 @@ ++#ifndef DMABUFS_H ++#define DMABUFS_H ++ ++struct dmabufs_ctl; ++struct dmabuf_h; ++ ++struct dmabufs_ctl * dmabufs_ctl_new(void); ++void dmabufs_ctl_delete(struct dmabufs_ctl ** const pdbsc); ++ ++// Need not preserve old contents ++// On NULL return old buffer is freed ++struct dmabuf_h * dmabuf_realloc(struct dmabufs_ctl * dbsc, struct dmabuf_h *, size_t size); ++ ++static inline struct dmabuf_h * dmabuf_alloc(struct dmabufs_ctl * dbsc, size_t size) { ++ return dmabuf_realloc(dbsc, NULL, size); ++} ++/* Create from existing fd - dups(fd) */ ++struct dmabuf_h * dmabuf_import(int fd, size_t size); ++void * dmabuf_map(struct dmabuf_h * const dh); ++ ++/* flags from linux/dmabuf.h DMA_BUF_SYNC_xxx */ ++int dmabuf_sync(struct dmabuf_h * const dh, unsigned int flags); ++ ++int dmabuf_write_start(struct dmabuf_h * const dh); ++int dmabuf_write_end(struct dmabuf_h * const dh); ++int dmabuf_read_start(struct dmabuf_h * const dh); ++int dmabuf_read_end(struct dmabuf_h * const dh); ++ ++int dmabuf_fd(const struct dmabuf_h * const dh); ++/* Allocated size */ ++size_t dmabuf_size(const struct dmabuf_h * const dh); ++/* Bytes in use */ ++size_t dmabuf_len(const struct dmabuf_h * const dh); ++/* Set bytes in use */ ++void dmabuf_len_set(struct dmabuf_h * const dh, const size_t len); ++void dmabuf_free(struct dmabuf_h * dh); ++ ++#endif +--- /dev/null ++++ b/libavcodec/v4l2_req_hevc_v1.c +@@ -0,0 +1,3 @@ ++#define HEVC_CTRLS_VERSION 1 ++#include "v4l2_req_hevc_vx.c" ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_hevc_v2.c +@@ -0,0 +1,3 @@ ++#define HEVC_CTRLS_VERSION 2 ++#include "v4l2_req_hevc_vx.c" ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_hevc_v3.c +@@ -0,0 +1,3 @@ ++#define HEVC_CTRLS_VERSION 3 ++#include "v4l2_req_hevc_vx.c" ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_hevc_v4.c +@@ -0,0 +1,3 @@ ++#define HEVC_CTRLS_VERSION 4 ++#include "v4l2_req_hevc_vx.c" ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_hevc_vx.c +@@ -0,0 +1,1365 @@ ++// File included by v4l2_req_hevc_v* - not compiled on its own ++ ++#include "decode.h" ++#include "hevcdec.h" ++#include "hwconfig.h" ++ ++#if HEVC_CTRLS_VERSION == 1 ++#include "hevc-ctrls-v1.h" ++ ++// Fixup renamed entries ++#define V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT ++ ++#elif HEVC_CTRLS_VERSION == 2 ++#include "hevc-ctrls-v2.h" ++#elif HEVC_CTRLS_VERSION == 3 ++#include "hevc-ctrls-v3.h" ++#elif HEVC_CTRLS_VERSION == 4 ++#include ++#if !defined(V4L2_CID_STATELESS_HEVC_SPS) ++#include "hevc-ctrls-v4.h" ++#endif ++#else ++#error Unknown HEVC_CTRLS_VERSION ++#endif ++ ++#ifndef V4L2_CID_STATELESS_HEVC_SPS ++#define V4L2_CID_STATELESS_HEVC_SPS V4L2_CID_MPEG_VIDEO_HEVC_SPS ++#define V4L2_CID_STATELESS_HEVC_PPS V4L2_CID_MPEG_VIDEO_HEVC_PPS ++#define V4L2_CID_STATELESS_HEVC_SLICE_PARAMS V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS ++#define V4L2_CID_STATELESS_HEVC_SCALING_MATRIX V4L2_CID_MPEG_VIDEO_HEVC_SCALING_MATRIX ++#define V4L2_CID_STATELESS_HEVC_DECODE_PARAMS V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS ++#define V4L2_CID_STATELESS_HEVC_DECODE_MODE V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE ++#define V4L2_CID_STATELESS_HEVC_START_CODE V4L2_CID_MPEG_VIDEO_HEVC_START_CODE ++ ++#define V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED ++#define V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_FRAME_BASED ++#define V4L2_STATELESS_HEVC_START_CODE_NONE V4L2_MPEG_VIDEO_HEVC_START_CODE_NONE ++#define V4L2_STATELESS_HEVC_START_CODE_ANNEX_B V4L2_MPEG_VIDEO_HEVC_START_CODE_ANNEX_B ++#endif ++ ++// Should be in videodev2 but we might not have a good enough one ++#ifndef V4L2_PIX_FMT_HEVC_SLICE ++#define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */ ++#endif ++ ++#include "v4l2_request_hevc.h" ++ ++#include "libavutil/hwcontext_drm.h" ++ ++#include ++#include ++ ++#include "v4l2_req_devscan.h" ++#include "v4l2_req_dmabufs.h" ++#include "v4l2_req_pollqueue.h" ++#include "v4l2_req_media.h" ++#include "v4l2_req_utils.h" ++ ++// Attached to buf[0] in frame ++// Pooled in hwcontext so generally create once - 1/frame ++typedef struct V4L2MediaReqDescriptor { ++ AVDRMFrameDescriptor drm; ++ ++ // Media ++ uint64_t timestamp; ++ struct qent_dst * qe_dst; ++ ++ // Decode only - should be NULL by the time we emit the frame ++ struct req_decode_ent decode_ent; ++ ++ struct media_request *req; ++ struct qent_src *qe_src; ++ ++#if HEVC_CTRLS_VERSION >= 2 ++ struct v4l2_ctrl_hevc_decode_params dec; ++#endif ++ ++ size_t num_slices; ++ size_t alloced_slices; ++ struct v4l2_ctrl_hevc_slice_params * slice_params; ++ struct slice_info * slices; ++ ++ size_t num_offsets; ++ size_t alloced_offsets; ++ uint32_t *offsets; ++ ++} V4L2MediaReqDescriptor; ++ ++struct slice_info { ++ const uint8_t * ptr; ++ size_t len; // bytes ++ size_t n_offsets; ++}; ++ ++// Handy container for accumulating controls before setting ++struct req_controls { ++ int has_scaling; ++ struct timeval tv; ++ struct v4l2_ctrl_hevc_sps sps; ++ struct v4l2_ctrl_hevc_pps pps; ++ struct v4l2_ctrl_hevc_scaling_matrix scaling_matrix; ++}; ++ ++//static uint8_t nalu_slice_start_code[] = { 0x00, 0x00, 0x01 }; ++ ++ ++// Get an FFmpeg format from the v4l2 format ++static enum AVPixelFormat pixel_format_from_format(const struct v4l2_format *const format) ++{ ++ switch (V4L2_TYPE_IS_MULTIPLANAR(format->type) ? ++ format->fmt.pix_mp.pixelformat : format->fmt.pix.pixelformat) { ++ case V4L2_PIX_FMT_YUV420: ++ return AV_PIX_FMT_YUV420P; ++ case V4L2_PIX_FMT_NV12: ++ return AV_PIX_FMT_NV12; ++#if CONFIG_SAND ++ case V4L2_PIX_FMT_NV12_COL128: ++ return AV_PIX_FMT_RPI4_8; ++ case V4L2_PIX_FMT_NV12_10_COL128: ++ return AV_PIX_FMT_RPI4_10; ++#endif ++ default: ++ break; ++ } ++ return AV_PIX_FMT_NONE; ++} ++ ++static inline uint64_t frame_capture_dpb(const AVFrame * const frame) ++{ ++ const V4L2MediaReqDescriptor *const rd = (V4L2MediaReqDescriptor *)frame->data[0]; ++ return rd->timestamp; ++} ++ ++static inline void frame_set_capture_dpb(AVFrame * const frame, const uint64_t dpb_stamp) ++{ ++ V4L2MediaReqDescriptor *const rd = (V4L2MediaReqDescriptor *)frame->data[0]; ++ rd->timestamp = dpb_stamp; ++} ++ ++static void fill_pred_table(const HEVCContext *h, struct v4l2_hevc_pred_weight_table *table) ++{ ++ int32_t luma_weight_denom, chroma_weight_denom; ++ const SliceHeader *sh = &h->sh; ++ ++ if (sh->slice_type == HEVC_SLICE_I || ++ (sh->slice_type == HEVC_SLICE_P && !h->ps.pps->weighted_pred_flag) || ++ (sh->slice_type == HEVC_SLICE_B && !h->ps.pps->weighted_bipred_flag)) ++ return; ++ ++ table->luma_log2_weight_denom = sh->luma_log2_weight_denom; ++ ++ if (h->ps.sps->chroma_format_idc) ++ table->delta_chroma_log2_weight_denom = sh->chroma_log2_weight_denom - sh->luma_log2_weight_denom; ++ ++ luma_weight_denom = (1 << sh->luma_log2_weight_denom); ++ chroma_weight_denom = (1 << sh->chroma_log2_weight_denom); ++ ++ for (int i = 0; i < 15 && i < sh->nb_refs[L0]; i++) { ++ table->delta_luma_weight_l0[i] = sh->luma_weight_l0[i] - luma_weight_denom; ++ table->luma_offset_l0[i] = sh->luma_offset_l0[i]; ++ table->delta_chroma_weight_l0[i][0] = sh->chroma_weight_l0[i][0] - chroma_weight_denom; ++ table->delta_chroma_weight_l0[i][1] = sh->chroma_weight_l0[i][1] - chroma_weight_denom; ++ table->chroma_offset_l0[i][0] = sh->chroma_offset_l0[i][0]; ++ table->chroma_offset_l0[i][1] = sh->chroma_offset_l0[i][1]; ++ } ++ ++ if (sh->slice_type != HEVC_SLICE_B) ++ return; ++ ++ for (int i = 0; i < 15 && i < sh->nb_refs[L1]; i++) { ++ table->delta_luma_weight_l1[i] = sh->luma_weight_l1[i] - luma_weight_denom; ++ table->luma_offset_l1[i] = sh->luma_offset_l1[i]; ++ table->delta_chroma_weight_l1[i][0] = sh->chroma_weight_l1[i][0] - chroma_weight_denom; ++ table->delta_chroma_weight_l1[i][1] = sh->chroma_weight_l1[i][1] - chroma_weight_denom; ++ table->chroma_offset_l1[i][0] = sh->chroma_offset_l1[i][0]; ++ table->chroma_offset_l1[i][1] = sh->chroma_offset_l1[i][1]; ++ } ++} ++ ++#if HEVC_CTRLS_VERSION <= 2 ++static int find_frame_rps_type(const HEVCContext *h, uint64_t timestamp) ++{ ++ const HEVCFrame *frame; ++ int i; ++ ++ for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) { ++ frame = h->rps[ST_CURR_BEF].ref[i]; ++ if (frame && timestamp == frame_capture_dpb(frame->frame)) ++ return V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_BEFORE; ++ } ++ ++ for (i = 0; i < h->rps[ST_CURR_AFT].nb_refs; i++) { ++ frame = h->rps[ST_CURR_AFT].ref[i]; ++ if (frame && timestamp == frame_capture_dpb(frame->frame)) ++ return V4L2_HEVC_DPB_ENTRY_RPS_ST_CURR_AFTER; ++ } ++ ++ for (i = 0; i < h->rps[LT_CURR].nb_refs; i++) { ++ frame = h->rps[LT_CURR].ref[i]; ++ if (frame && timestamp == frame_capture_dpb(frame->frame)) ++ return V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR; ++ } ++ ++ return 0; ++} ++#endif ++ ++static unsigned int ++get_ref_pic_index(const HEVCContext *h, const HEVCFrame *frame, ++ const struct v4l2_hevc_dpb_entry * const entries, ++ const unsigned int num_entries) ++{ ++ uint64_t timestamp; ++ ++ if (!frame) ++ return 0; ++ ++ timestamp = frame_capture_dpb(frame->frame); ++ ++ for (unsigned int i = 0; i < num_entries; i++) { ++ if (entries[i].timestamp == timestamp) ++ return i; ++ } ++ ++ return 0; ++} ++ ++static const uint8_t * ptr_from_index(const uint8_t * b, unsigned int idx) ++{ ++ unsigned int z = 0; ++ while (idx--) { ++ if (*b++ == 0) { ++ ++z; ++ if (z >= 2 && *b == 3) { ++ ++b; ++ z = 0; ++ } ++ } ++ else { ++ z = 0; ++ } ++ } ++ return b; ++} ++ ++static int slice_add(V4L2MediaReqDescriptor * const rd) ++{ ++ if (rd->num_slices >= rd->alloced_slices) { ++ struct v4l2_ctrl_hevc_slice_params * p2; ++ struct slice_info * s2; ++ size_t n2 = rd->alloced_slices == 0 ? 8 : rd->alloced_slices * 2; ++ ++ p2 = av_realloc_array(rd->slice_params, n2, sizeof(*p2)); ++ if (p2 == NULL) ++ return AVERROR(ENOMEM); ++ rd->slice_params = p2; ++ ++ s2 = av_realloc_array(rd->slices, n2, sizeof(*s2)); ++ if (s2 == NULL) ++ return AVERROR(ENOMEM); ++ rd->slices = s2; ++ ++ rd->alloced_slices = n2; ++ } ++ ++rd->num_slices; ++ return 0; ++} ++ ++static int offsets_add(V4L2MediaReqDescriptor *const rd, const size_t n, const unsigned * const offsets) ++{ ++ if (rd->num_offsets + n > rd->alloced_offsets) { ++ size_t n2 = rd->alloced_slices == 0 ? 128 : rd->alloced_slices * 2; ++ void * p2; ++ while (rd->num_offsets + n > n2) ++ n2 *= 2; ++ if ((p2 = av_realloc_array(rd->offsets, n2, sizeof(*rd->offsets))) == NULL) ++ return AVERROR(ENOMEM); ++ rd->offsets = p2; ++ rd->alloced_offsets = n2; ++ } ++ for (size_t i = 0; i != n; ++i) ++ rd->offsets[rd->num_offsets++] = offsets[i] - 1; ++ return 0; ++} ++ ++static unsigned int ++fill_dpb_entries(const HEVCContext * const h, struct v4l2_hevc_dpb_entry * const entries) ++{ ++ unsigned int i; ++ unsigned int n = 0; ++ const HEVCFrame * const pic = h->ref; ++ ++ for (i = 0; i < FF_ARRAY_ELEMS(h->DPB); i++) { ++ const HEVCFrame * const frame = &h->DPB[i]; ++ if (frame != pic && (frame->flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) { ++ struct v4l2_hevc_dpb_entry * const entry = entries + n++; ++ ++ entry->timestamp = frame_capture_dpb(frame->frame); ++#if HEVC_CTRLS_VERSION <= 2 ++ entry->rps = find_frame_rps_type(h, entry->timestamp); ++#else ++ entry->flags = (frame->flags & HEVC_FRAME_FLAG_LONG_REF) == 0 ? 0 : ++ V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE; ++#endif ++ entry->field_pic = frame->frame->interlaced_frame; ++ ++#if HEVC_CTRLS_VERSION <= 3 ++ /* TODO: Interleaved: Get the POC for each field. */ ++ entry->pic_order_cnt[0] = frame->poc; ++ entry->pic_order_cnt[1] = frame->poc; ++#else ++ entry->pic_order_cnt_val = frame->poc; ++#endif ++ } ++ } ++ return n; ++} ++ ++static void fill_slice_params(const HEVCContext * const h, ++#if HEVC_CTRLS_VERSION >= 2 ++ const struct v4l2_ctrl_hevc_decode_params * const dec, ++#endif ++ struct v4l2_ctrl_hevc_slice_params *slice_params, ++ uint32_t bit_size, uint32_t bit_offset) ++{ ++ const SliceHeader * const sh = &h->sh; ++#if HEVC_CTRLS_VERSION >= 2 ++ const struct v4l2_hevc_dpb_entry *const dpb = dec->dpb; ++ const unsigned int dpb_n = dec->num_active_dpb_entries; ++#else ++ struct v4l2_hevc_dpb_entry *const dpb = slice_params->dpb; ++ unsigned int dpb_n; ++#endif ++ unsigned int i; ++ RefPicList *rpl; ++ ++ *slice_params = (struct v4l2_ctrl_hevc_slice_params) { ++ .bit_size = bit_size, ++#if HEVC_CTRLS_VERSION <= 3 ++ .data_bit_offset = bit_offset, ++#else ++ .data_byte_offset = bit_offset / 8 + 1, ++#endif ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ .slice_segment_addr = sh->slice_segment_addr, ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: NAL unit header */ ++ .nal_unit_type = h->nal_unit_type, ++ .nuh_temporal_id_plus1 = h->temporal_id + 1, ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ .slice_type = sh->slice_type, ++ .colour_plane_id = sh->colour_plane_id, ++ .slice_pic_order_cnt = h->ref->poc, ++ .num_ref_idx_l0_active_minus1 = sh->nb_refs[L0] ? sh->nb_refs[L0] - 1 : 0, ++ .num_ref_idx_l1_active_minus1 = sh->nb_refs[L1] ? sh->nb_refs[L1] - 1 : 0, ++ .collocated_ref_idx = sh->slice_temporal_mvp_enabled_flag ? sh->collocated_ref_idx : 0, ++ .five_minus_max_num_merge_cand = sh->slice_type == HEVC_SLICE_I ? 0 : 5 - sh->max_num_merge_cand, ++ .slice_qp_delta = sh->slice_qp_delta, ++ .slice_cb_qp_offset = sh->slice_cb_qp_offset, ++ .slice_cr_qp_offset = sh->slice_cr_qp_offset, ++ .slice_act_y_qp_offset = 0, ++ .slice_act_cb_qp_offset = 0, ++ .slice_act_cr_qp_offset = 0, ++ .slice_beta_offset_div2 = sh->beta_offset / 2, ++ .slice_tc_offset_div2 = sh->tc_offset / 2, ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture timing SEI message */ ++ .pic_struct = h->sei.picture_timing.picture_struct, ++ ++#if HEVC_CTRLS_VERSION < 2 ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ ++ .num_rps_poc_st_curr_before = h->rps[ST_CURR_BEF].nb_refs, ++ .num_rps_poc_st_curr_after = h->rps[ST_CURR_AFT].nb_refs, ++ .num_rps_poc_lt_curr = h->rps[LT_CURR].nb_refs, ++#endif ++ }; ++ ++ if (sh->slice_sample_adaptive_offset_flag[0]) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_LUMA; ++ ++ if (sh->slice_sample_adaptive_offset_flag[1]) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_CHROMA; ++ ++ if (sh->slice_temporal_mvp_enabled_flag) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_TEMPORAL_MVP_ENABLED; ++ ++ if (sh->mvd_l1_zero_flag) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_MVD_L1_ZERO; ++ ++ if (sh->cabac_init_flag) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_CABAC_INIT; ++ ++ if (sh->collocated_list == L0) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_COLLOCATED_FROM_L0; ++ ++ if (sh->disable_deblocking_filter_flag) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED; ++ ++ if (sh->slice_loop_filter_across_slices_enabled_flag) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED; ++ ++ if (sh->dependent_slice_segment_flag) ++ slice_params->flags |= V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT; ++ ++#if HEVC_CTRLS_VERSION < 2 ++ dpb_n = fill_dpb_entries(h, dpb); ++ slice_params->num_active_dpb_entries = dpb_n; ++#endif ++ ++ if (sh->slice_type != HEVC_SLICE_I) { ++ rpl = &h->ref->refPicList[0]; ++ for (i = 0; i < rpl->nb_refs; i++) ++ slice_params->ref_idx_l0[i] = get_ref_pic_index(h, rpl->ref[i], dpb, dpb_n); ++ } ++ ++ if (sh->slice_type == HEVC_SLICE_B) { ++ rpl = &h->ref->refPicList[1]; ++ for (i = 0; i < rpl->nb_refs; i++) ++ slice_params->ref_idx_l1[i] = get_ref_pic_index(h, rpl->ref[i], dpb, dpb_n); ++ } ++ ++ fill_pred_table(h, &slice_params->pred_weight_table); ++ ++ slice_params->num_entry_point_offsets = sh->num_entry_point_offsets; ++#if HEVC_CTRLS_VERSION <= 3 ++ if (slice_params->num_entry_point_offsets > 256) { ++ slice_params->num_entry_point_offsets = 256; ++ av_log(NULL, AV_LOG_ERROR, "%s: Currently only 256 entry points are supported, but slice has %d entry points.\n", __func__, sh->num_entry_point_offsets); ++ } ++ ++ for (i = 0; i < slice_params->num_entry_point_offsets; i++) ++ slice_params->entry_point_offset_minus1[i] = sh->entry_point_offset[i] - 1; ++#endif ++} ++ ++#if HEVC_CTRLS_VERSION >= 2 ++static void ++fill_decode_params(const HEVCContext * const h, ++ struct v4l2_ctrl_hevc_decode_params * const dec) ++{ ++ unsigned int i; ++ ++ *dec = (struct v4l2_ctrl_hevc_decode_params){ ++ .pic_order_cnt_val = h->poc, ++ .num_poc_st_curr_before = h->rps[ST_CURR_BEF].nb_refs, ++ .num_poc_st_curr_after = h->rps[ST_CURR_AFT].nb_refs, ++ .num_poc_lt_curr = h->rps[LT_CURR].nb_refs, ++ }; ++ ++ dec->num_active_dpb_entries = fill_dpb_entries(h, dec->dpb); ++ ++ // The docn does seem to ask that we fit our 32 bit signed POC into ++ // a U8 so... (To be fair 16 bits would be enough) ++ // Luckily we (Pi) don't use these fields ++ for (i = 0; i != h->rps[ST_CURR_BEF].nb_refs; ++i) ++ dec->poc_st_curr_before[i] = h->rps[ST_CURR_BEF].ref[i]->poc; ++ for (i = 0; i != h->rps[ST_CURR_AFT].nb_refs; ++i) ++ dec->poc_st_curr_after[i] = h->rps[ST_CURR_AFT].ref[i]->poc; ++ for (i = 0; i != h->rps[LT_CURR].nb_refs; ++i) ++ dec->poc_lt_curr[i] = h->rps[LT_CURR].ref[i]->poc; ++ ++ if (IS_IRAP(h)) ++ dec->flags |= V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC; ++ if (IS_IDR(h)) ++ dec->flags |= V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC; ++ if (h->sh.no_output_of_prior_pics_flag) ++ dec->flags |= V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR; ++ ++} ++#endif ++ ++static void fill_sps(struct v4l2_ctrl_hevc_sps *ctrl, const HEVCSPS *sps) ++{ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Sequence parameter set */ ++ *ctrl = (struct v4l2_ctrl_hevc_sps) { ++ .chroma_format_idc = sps->chroma_format_idc, ++ .pic_width_in_luma_samples = sps->width, ++ .pic_height_in_luma_samples = sps->height, ++ .bit_depth_luma_minus8 = sps->bit_depth - 8, ++ .bit_depth_chroma_minus8 = sps->bit_depth - 8, ++ .log2_max_pic_order_cnt_lsb_minus4 = sps->log2_max_poc_lsb - 4, ++ .sps_max_dec_pic_buffering_minus1 = sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering - 1, ++ .sps_max_num_reorder_pics = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics, ++ .sps_max_latency_increase_plus1 = sps->temporal_layer[sps->max_sub_layers - 1].max_latency_increase + 1, ++ .log2_min_luma_coding_block_size_minus3 = sps->log2_min_cb_size - 3, ++ .log2_diff_max_min_luma_coding_block_size = sps->log2_diff_max_min_coding_block_size, ++ .log2_min_luma_transform_block_size_minus2 = sps->log2_min_tb_size - 2, ++ .log2_diff_max_min_luma_transform_block_size = sps->log2_max_trafo_size - sps->log2_min_tb_size, ++ .max_transform_hierarchy_depth_inter = sps->max_transform_hierarchy_depth_inter, ++ .max_transform_hierarchy_depth_intra = sps->max_transform_hierarchy_depth_intra, ++ .pcm_sample_bit_depth_luma_minus1 = sps->pcm.bit_depth - 1, ++ .pcm_sample_bit_depth_chroma_minus1 = sps->pcm.bit_depth_chroma - 1, ++ .log2_min_pcm_luma_coding_block_size_minus3 = sps->pcm.log2_min_pcm_cb_size - 3, ++ .log2_diff_max_min_pcm_luma_coding_block_size = sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size, ++ .num_short_term_ref_pic_sets = sps->nb_st_rps, ++ .num_long_term_ref_pics_sps = sps->num_long_term_ref_pics_sps, ++ .chroma_format_idc = sps->chroma_format_idc, ++ .sps_max_sub_layers_minus1 = sps->max_sub_layers - 1, ++ }; ++ ++ if (sps->separate_colour_plane_flag) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_SEPARATE_COLOUR_PLANE; ++ ++ if (sps->scaling_list_enable_flag) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED; ++ ++ if (sps->amp_enabled_flag) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_AMP_ENABLED; ++ ++ if (sps->sao_enabled) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET; ++ ++ if (sps->pcm_enabled_flag) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_PCM_ENABLED; ++ ++ if (sps->pcm.loop_filter_disable_flag) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED; ++ ++ if (sps->long_term_ref_pics_present_flag) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT; ++ ++ if (sps->sps_temporal_mvp_enabled_flag) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED; ++ ++ if (sps->sps_strong_intra_smoothing_enable_flag) ++ ctrl->flags |= V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED; ++} ++ ++static void fill_scaling_matrix(const ScalingList * const sl, ++ struct v4l2_ctrl_hevc_scaling_matrix * const sm) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < 6; i++) { ++ unsigned int j; ++ ++ for (j = 0; j < 16; j++) ++ sm->scaling_list_4x4[i][j] = sl->sl[0][i][j]; ++ for (j = 0; j < 64; j++) { ++ sm->scaling_list_8x8[i][j] = sl->sl[1][i][j]; ++ sm->scaling_list_16x16[i][j] = sl->sl[2][i][j]; ++ if (i < 2) ++ sm->scaling_list_32x32[i][j] = sl->sl[3][i * 3][j]; ++ } ++ sm->scaling_list_dc_coef_16x16[i] = sl->sl_dc[0][i]; ++ if (i < 2) ++ sm->scaling_list_dc_coef_32x32[i] = sl->sl_dc[1][i * 3]; ++ } ++} ++ ++static void fill_pps(struct v4l2_ctrl_hevc_pps * const ctrl, const HEVCPPS * const pps) ++{ ++ uint64_t flags = 0; ++ ++ if (pps->dependent_slice_segments_enabled_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED; ++ ++ if (pps->output_flag_present_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT; ++ ++ if (pps->sign_data_hiding_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED; ++ ++ if (pps->cabac_init_present_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT; ++ ++ if (pps->constrained_intra_pred_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED; ++ ++ if (pps->transform_skip_enabled_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED; ++ ++ if (pps->cu_qp_delta_enabled_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED; ++ ++ if (pps->pic_slice_level_chroma_qp_offsets_present_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT; ++ ++ if (pps->weighted_pred_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED; ++ ++ if (pps->weighted_bipred_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED; ++ ++ if (pps->transquant_bypass_enable_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED; ++ ++ if (pps->tiles_enabled_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_TILES_ENABLED; ++ ++ if (pps->entropy_coding_sync_enabled_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED; ++ ++ if (pps->loop_filter_across_tiles_enabled_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED; ++ ++ if (pps->seq_loop_filter_across_slices_enabled_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED; ++ ++ if (pps->deblocking_filter_override_enabled_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED; ++ ++ if (pps->disable_dbf) ++ flags |= V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER; ++ ++ if (pps->lists_modification_present_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT; ++ ++ if (pps->slice_header_extension_present_flag) ++ flags |= V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT; ++ ++ /* ISO/IEC 23008-2, ITU-T Rec. H.265: Picture parameter set */ ++ *ctrl = (struct v4l2_ctrl_hevc_pps) { ++ .num_extra_slice_header_bits = pps->num_extra_slice_header_bits, ++ .init_qp_minus26 = pps->pic_init_qp_minus26, ++ .diff_cu_qp_delta_depth = pps->diff_cu_qp_delta_depth, ++ .pps_cb_qp_offset = pps->cb_qp_offset, ++ .pps_cr_qp_offset = pps->cr_qp_offset, ++ .pps_beta_offset_div2 = pps->beta_offset / 2, ++ .pps_tc_offset_div2 = pps->tc_offset / 2, ++ .log2_parallel_merge_level_minus2 = pps->log2_parallel_merge_level - 2, ++ .flags = flags ++ }; ++ ++ ++ if (pps->tiles_enabled_flag) { ++ ctrl->num_tile_columns_minus1 = pps->num_tile_columns - 1; ++ ctrl->num_tile_rows_minus1 = pps->num_tile_rows - 1; ++ ++ for (int i = 0; i < pps->num_tile_columns; i++) ++ ctrl->column_width_minus1[i] = pps->column_width[i] - 1; ++ ++ for (int i = 0; i < pps->num_tile_rows; i++) ++ ctrl->row_height_minus1[i] = pps->row_height[i] - 1; ++ } ++} ++ ++// Called before finally returning the frame to the user ++// Set corrupt flag here as this is actually the frame structure that ++// is going to the user (in MT land each thread has its own pool) ++static int frame_post_process(void *logctx, AVFrame *frame) ++{ ++ V4L2MediaReqDescriptor *rd = (V4L2MediaReqDescriptor*)frame->data[0]; ++ ++// av_log(NULL, AV_LOG_INFO, "%s\n", __func__); ++ frame->flags &= ~AV_FRAME_FLAG_CORRUPT; ++ if (rd->qe_dst) { ++ MediaBufsStatus stat = qent_dst_wait(rd->qe_dst); ++ if (stat != MEDIABUFS_STATUS_SUCCESS) { ++ av_log(logctx, AV_LOG_ERROR, "%s: Decode fail\n", __func__); ++ frame->flags |= AV_FRAME_FLAG_CORRUPT; ++ } ++ } ++ ++ return 0; ++} ++ ++static inline struct timeval cvt_dpb_to_tv(uint64_t t) ++{ ++ t /= 1000; ++ return (struct timeval){ ++ .tv_usec = t % 1000000, ++ .tv_sec = t / 1000000 ++ }; ++} ++ ++static inline uint64_t cvt_timestamp_to_dpb(const unsigned int t) ++{ ++ return (uint64_t)t * 1000; ++} ++ ++static int v4l2_request_hevc_start_frame(AVCodecContext *avctx, ++ av_unused const uint8_t *buffer, ++ av_unused uint32_t size) ++{ ++ const HEVCContext *h = avctx->priv_data; ++ V4L2MediaReqDescriptor *const rd = (V4L2MediaReqDescriptor *)h->ref->frame->data[0]; ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ ++// av_log(NULL, AV_LOG_INFO, "%s\n", __func__); ++ decode_q_add(&ctx->decode_q, &rd->decode_ent); ++ ++ rd->num_slices = 0; ++ ctx->timestamp++; ++ rd->timestamp = cvt_timestamp_to_dpb(ctx->timestamp); ++ ++ { ++ FrameDecodeData * const fdd = (FrameDecodeData*)h->ref->frame->private_ref->data; ++ fdd->post_process = frame_post_process; ++ } ++ ++ // qe_dst needs to be bound to the data buffer and only returned when that is ++ if (!rd->qe_dst) ++ { ++ if ((rd->qe_dst = mediabufs_dst_qent_alloc(ctx->mbufs, ctx->dbufs)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Failed to get dst buffer\n", __func__); ++ return AVERROR(ENOMEM); ++ } ++ } ++ ++ ff_thread_finish_setup(avctx); // Allow next thread to enter rpi_hevc_start_frame ++ ++ return 0; ++} ++ ++// Object fd & size will be zapped by this & need setting later ++static int drm_from_format(AVDRMFrameDescriptor * const desc, const struct v4l2_format * const format) ++{ ++ AVDRMLayerDescriptor *layer = &desc->layers[0]; ++ unsigned int width; ++ unsigned int height; ++ unsigned int bpl; ++ uint32_t pixelformat; ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(format->type)) { ++ width = format->fmt.pix_mp.width; ++ height = format->fmt.pix_mp.height; ++ pixelformat = format->fmt.pix_mp.pixelformat; ++ bpl = format->fmt.pix_mp.plane_fmt[0].bytesperline; ++ } ++ else { ++ width = format->fmt.pix.width; ++ height = format->fmt.pix.height; ++ pixelformat = format->fmt.pix.pixelformat; ++ bpl = format->fmt.pix.bytesperline; ++ } ++ ++ switch (pixelformat) { ++ case V4L2_PIX_FMT_NV12: ++ layer->format = DRM_FORMAT_NV12; ++ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; ++ break; ++#if CONFIG_SAND ++ case V4L2_PIX_FMT_NV12_COL128: ++ layer->format = DRM_FORMAT_NV12; ++ desc->objects[0].format_modifier = DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(bpl); ++ break; ++ case V4L2_PIX_FMT_NV12_10_COL128: ++ layer->format = DRM_FORMAT_P030; ++ desc->objects[0].format_modifier = DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT(bpl); ++ break; ++#endif ++#ifdef DRM_FORMAT_MOD_ALLWINNER_TILED ++ case V4L2_PIX_FMT_SUNXI_TILED_NV12: ++ layer->format = DRM_FORMAT_NV12; ++ desc->objects[0].format_modifier = DRM_FORMAT_MOD_ALLWINNER_TILED; ++ break; ++#endif ++#if defined(V4L2_PIX_FMT_NV15) && defined(DRM_FORMAT_NV15) ++ case V4L2_PIX_FMT_NV15: ++ layer->format = DRM_FORMAT_NV15; ++ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; ++ break; ++#endif ++ case V4L2_PIX_FMT_NV16: ++ layer->format = DRM_FORMAT_NV16; ++ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; ++ break; ++#if defined(V4L2_PIX_FMT_NV20) && defined(DRM_FORMAT_NV20) ++ case V4L2_PIX_FMT_NV20: ++ layer->format = DRM_FORMAT_NV20; ++ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR; ++ break; ++#endif ++ default: ++ return -1; ++ } ++ ++ desc->nb_objects = 1; ++ desc->objects[0].fd = -1; ++ desc->objects[0].size = 0; ++ ++ desc->nb_layers = 1; ++ layer->nb_planes = 2; ++ ++ layer->planes[0].object_index = 0; ++ layer->planes[0].offset = 0; ++ layer->planes[0].pitch = bpl; ++#if CONFIG_SAND ++ if (pixelformat == V4L2_PIX_FMT_NV12_COL128) { ++ layer->planes[1].object_index = 0; ++ layer->planes[1].offset = height * 128; ++ layer->planes[0].pitch = width; ++ layer->planes[1].pitch = width; ++ } ++ else if (pixelformat == V4L2_PIX_FMT_NV12_10_COL128) { ++ layer->planes[1].object_index = 0; ++ layer->planes[1].offset = height * 128; ++ layer->planes[0].pitch = width * 2; // Lies but it keeps DRM import happy ++ layer->planes[1].pitch = width * 2; ++ } ++ else ++#endif ++ { ++ layer->planes[1].object_index = 0; ++ layer->planes[1].offset = layer->planes[0].pitch * height; ++ layer->planes[1].pitch = layer->planes[0].pitch; ++ } ++ ++ return 0; ++} ++ ++static int ++set_req_ctls(V4L2RequestContextHEVC *ctx, struct media_request * const mreq, ++ struct req_controls *const controls, ++#if HEVC_CTRLS_VERSION >= 2 ++ struct v4l2_ctrl_hevc_decode_params * const dec, ++#endif ++ struct v4l2_ctrl_hevc_slice_params * const slices, const unsigned int slice_count, ++ void * const offsets, const size_t offset_count) ++{ ++ int rv; ++#if HEVC_CTRLS_VERSION >= 2 ++ unsigned int n = 3; ++#else ++ unsigned int n = 2; ++#endif ++ ++ struct v4l2_ext_control control[6] = { ++ { ++ .id = V4L2_CID_STATELESS_HEVC_SPS, ++ .ptr = &controls->sps, ++ .size = sizeof(controls->sps), ++ }, ++ { ++ .id = V4L2_CID_STATELESS_HEVC_PPS, ++ .ptr = &controls->pps, ++ .size = sizeof(controls->pps), ++ }, ++#if HEVC_CTRLS_VERSION >= 2 ++ { ++ .id = V4L2_CID_STATELESS_HEVC_DECODE_PARAMS, ++ .ptr = dec, ++ .size = sizeof(*dec), ++ }, ++#endif ++ }; ++ ++ if (slices) ++ control[n++] = (struct v4l2_ext_control) { ++ .id = V4L2_CID_STATELESS_HEVC_SLICE_PARAMS, ++ .ptr = slices, ++ .size = sizeof(*slices) * slice_count, ++ }; ++ ++ if (controls->has_scaling) ++ control[n++] = (struct v4l2_ext_control) { ++ .id = V4L2_CID_STATELESS_HEVC_SCALING_MATRIX, ++ .ptr = &controls->scaling_matrix, ++ .size = sizeof(controls->scaling_matrix), ++ }; ++ ++#if HEVC_CTRLS_VERSION >= 4 ++ if (offsets) ++ control[n++] = (struct v4l2_ext_control) { ++ .id = V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS, ++ .ptr = offsets, ++ .size = sizeof(((struct V4L2MediaReqDescriptor *)0)->offsets[0]) * offset_count, ++ }; ++#endif ++ ++ rv = mediabufs_ctl_set_ext_ctrls(ctx->mbufs, mreq, control, n); ++ ++ return rv; ++} ++ ++// This only works because we started out from a single coded frame buffer ++// that will remain intact until after end_frame ++static int v4l2_request_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) ++{ ++ const HEVCContext * const h = avctx->priv_data; ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ V4L2MediaReqDescriptor * const rd = (V4L2MediaReqDescriptor*)h->ref->frame->data[0]; ++ int bcount = get_bits_count(&h->HEVClc->gb); ++ uint32_t boff = (ptr_from_index(buffer, bcount/8 + 1) - (buffer + bcount/8 + 1)) * 8 + bcount; ++ ++ const unsigned int n = rd->num_slices; ++ const unsigned int block_start = (n / ctx->max_slices) * ctx->max_slices; ++ ++ int rv; ++ struct slice_info * si; ++ ++ // This looks dodgy but we know that FFmpeg has parsed this from a buffer ++ // that contains the entire frame including the start code ++ if (ctx->start_code == V4L2_STATELESS_HEVC_START_CODE_ANNEX_B) { ++ buffer -= 3; ++ size += 3; ++ boff += 24; ++ if (buffer[0] != 0 || buffer[1] != 0 || buffer[2] != 1) { ++ av_log(avctx, AV_LOG_ERROR, "Start code requested but missing %02x:%02x:%02x\n", ++ buffer[0], buffer[1], buffer[2]); ++ } ++ } ++ ++ if (ctx->decode_mode == V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED) { ++ if (rd->slices == NULL) { ++ if ((rd->slices = av_mallocz(sizeof(*rd->slices))) == NULL) ++ return AVERROR(ENOMEM); ++ rd->slices->ptr = buffer; ++ rd->num_slices = 1; ++ } ++ rd->slices->len = buffer - rd->slices->ptr + size; ++ return 0; ++ } ++ ++ if ((rv = slice_add(rd)) != 0) ++ return rv; ++ ++ si = rd->slices + n; ++ si->ptr = buffer; ++ si->len = size; ++ si->n_offsets = rd->num_offsets; ++ ++ if (n != block_start) { ++ struct slice_info *const si0 = rd->slices + block_start; ++ const size_t offset = (buffer - si0->ptr); ++ boff += offset * 8; ++ size += offset; ++ si0->len = si->len + offset; ++ } ++ ++#if HEVC_CTRLS_VERSION >= 2 ++ if (n == 0) ++ fill_decode_params(h, &rd->dec); ++ fill_slice_params(h, &rd->dec, rd->slice_params + n, size * 8, boff); ++#else ++ fill_slice_params(h, rd->slice_params + n, size * 8, boff); ++#endif ++ if (ctx->max_offsets != 0 && ++ (rv = offsets_add(rd, h->sh.num_entry_point_offsets, h->sh.entry_point_offset)) != 0) ++ return rv; ++ ++ return 0; ++} ++ ++static void v4l2_request_hevc_abort_frame(AVCodecContext * const avctx) ++{ ++ const HEVCContext * const h = avctx->priv_data; ++ if (h->ref != NULL) { ++ V4L2MediaReqDescriptor *const rd = (V4L2MediaReqDescriptor *)h->ref->frame->data[0]; ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ ++ media_request_abort(&rd->req); ++ mediabufs_src_qent_abort(ctx->mbufs, &rd->qe_src); ++ ++ decode_q_remove(&ctx->decode_q, &rd->decode_ent); ++ } ++} ++ ++static int send_slice(AVCodecContext * const avctx, ++ V4L2MediaReqDescriptor * const rd, ++ struct req_controls *const controls, ++ const unsigned int i, const unsigned int j) ++{ ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ ++ const int is_last = (j == rd->num_slices); ++ struct slice_info *const si = rd->slices + i; ++ struct media_request * req = NULL; ++ struct qent_src * src = NULL; ++ MediaBufsStatus stat; ++ void * offsets = rd->offsets + rd->slices[i].n_offsets; ++ size_t n_offsets = (is_last ? rd->num_offsets : rd->slices[j].n_offsets) - rd->slices[i].n_offsets; ++ ++ if ((req = media_request_get(ctx->mpool)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Failed to alloc media request\n", __func__); ++ return AVERROR(ENOMEM); ++ } ++ ++ if (set_req_ctls(ctx, req, ++ controls, ++#if HEVC_CTRLS_VERSION >= 2 ++ &rd->dec, ++#endif ++ rd->slice_params + i, j - i, ++ offsets, n_offsets)) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Failed to set req ctls\n", __func__); ++ goto fail1; ++ } ++ ++ if ((src = mediabufs_src_qent_get(ctx->mbufs)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Failed to get src buffer\n", __func__); ++ goto fail1; ++ } ++ ++ if (qent_src_data_copy(src, 0, si->ptr, si->len, ctx->dbufs) != 0) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Failed data copy\n", __func__); ++ goto fail2; ++ } ++ ++ if (qent_src_params_set(src, &controls->tv)) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Failed src param set\n", __func__); ++ goto fail2; ++ } ++ ++ stat = mediabufs_start_request(ctx->mbufs, &req, &src, ++ i == 0 ? rd->qe_dst : NULL, ++ is_last); ++ ++ if (stat != MEDIABUFS_STATUS_SUCCESS) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Failed to start request\n", __func__); ++ return AVERROR_UNKNOWN; ++ } ++ return 0; ++ ++fail2: ++ mediabufs_src_qent_abort(ctx->mbufs, &src); ++fail1: ++ media_request_abort(&req); ++ return AVERROR_UNKNOWN; ++} ++ ++static int v4l2_request_hevc_end_frame(AVCodecContext *avctx) ++{ ++ const HEVCContext * const h = avctx->priv_data; ++ V4L2MediaReqDescriptor *rd = (V4L2MediaReqDescriptor*)h->ref->frame->data[0]; ++ V4L2RequestContextHEVC *ctx = avctx->internal->hwaccel_priv_data; ++ struct req_controls rc; ++ unsigned int i; ++ int rv; ++ ++ // It is possible, though maybe a bug, to get an end_frame without ++ // a previous start_frame. If we do then give up. ++ if (!decode_q_in_q(&rd->decode_ent)) { ++ av_log(avctx, AV_LOG_DEBUG, "%s: Frame not in decode Q\n", __func__); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ { ++ const ScalingList *sl = h->ps.pps->scaling_list_data_present_flag ? ++ &h->ps.pps->scaling_list : ++ h->ps.sps->scaling_list_enable_flag ? ++ &h->ps.sps->scaling_list : NULL; ++ ++ ++ memset(&rc, 0, sizeof(rc)); ++ rc.tv = cvt_dpb_to_tv(rd->timestamp); ++ fill_sps(&rc.sps, h->ps.sps); ++ fill_pps(&rc.pps, h->ps.pps); ++ if (sl) { ++ rc.has_scaling = 1; ++ fill_scaling_matrix(sl, &rc.scaling_matrix); ++ } ++ } ++ ++ decode_q_wait(&ctx->decode_q, &rd->decode_ent); ++ ++ // qe_dst needs to be bound to the data buffer and only returned when that is ++ // Alloc almost certainly wants to be serialised if there is any chance of blocking ++ // so we get the next frame to be free in the thread that needs it for decode first. ++ // ++ // In our current world this probably isn't a concern but put it here anyway ++ if (!rd->qe_dst) ++ { ++ if ((rd->qe_dst = mediabufs_dst_qent_alloc(ctx->mbufs, ctx->dbufs)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "%s: Failed to get dst buffer\n", __func__); ++ rv = AVERROR(ENOMEM); ++ goto fail; ++ } ++ } ++ ++ // Send as slices ++ for (i = 0; i < rd->num_slices; i += ctx->max_slices) { ++ const unsigned int e = FFMIN(rd->num_slices, i + ctx->max_slices); ++ if ((rv = send_slice(avctx, rd, &rc, i, e)) != 0) ++ goto fail; ++ } ++ ++ // Set the drm_prime desriptor ++ drm_from_format(&rd->drm, mediabufs_dst_fmt(ctx->mbufs)); ++ rd->drm.objects[0].fd = dmabuf_fd(qent_dst_dmabuf(rd->qe_dst, 0)); ++ rd->drm.objects[0].size = dmabuf_size(qent_dst_dmabuf(rd->qe_dst, 0)); ++ ++ decode_q_remove(&ctx->decode_q, &rd->decode_ent); ++ return 0; ++ ++fail: ++ decode_q_remove(&ctx->decode_q, &rd->decode_ent); ++ return rv; ++} ++ ++static inline int ++ctrl_valid(const struct v4l2_query_ext_ctrl * const c, const int64_t v) ++{ ++ return v >= c->minimum && v <= c->maximum; ++} ++ ++// Initial check & init ++static int ++probe(AVCodecContext * const avctx, V4L2RequestContextHEVC * const ctx) ++{ ++ const HEVCContext *h = avctx->priv_data; ++ const HEVCSPS * const sps = h->ps.sps; ++ struct v4l2_ctrl_hevc_sps ctrl_sps; ++ unsigned int i; ++ ++ // Check for var slice array ++ struct v4l2_query_ext_ctrl qc[] = { ++ { .id = V4L2_CID_STATELESS_HEVC_SLICE_PARAMS }, ++ { .id = V4L2_CID_STATELESS_HEVC_DECODE_MODE, }, ++ { .id = V4L2_CID_STATELESS_HEVC_SPS }, ++ { .id = V4L2_CID_STATELESS_HEVC_PPS }, ++ { .id = V4L2_CID_STATELESS_HEVC_SCALING_MATRIX }, ++#if HEVC_CTRLS_VERSION >= 2 ++ { .id = V4L2_CID_STATELESS_HEVC_DECODE_PARAMS }, ++#endif ++ }; ++ // Order & size must match! ++ static const size_t ctrl_sizes[] = { ++ sizeof(struct v4l2_ctrl_hevc_slice_params), ++ sizeof(int32_t), ++ sizeof(struct v4l2_ctrl_hevc_sps), ++ sizeof(struct v4l2_ctrl_hevc_pps), ++ sizeof(struct v4l2_ctrl_hevc_scaling_matrix), ++#if HEVC_CTRLS_VERSION >= 2 ++ sizeof(struct v4l2_ctrl_hevc_decode_params), ++#endif ++ }; ++ const unsigned int noof_ctrls = FF_ARRAY_ELEMS(qc); ++ ++#if HEVC_CTRLS_VERSION == 2 ++ if (mediabufs_ctl_driver_version(ctx->mbufs) >= MEDIABUFS_DRIVER_VERSION(5, 18, 0)) ++ return AVERROR(EINVAL); ++#elif HEVC_CTRLS_VERSION == 3 ++ if (mediabufs_ctl_driver_version(ctx->mbufs) < MEDIABUFS_DRIVER_VERSION(5, 18, 0)) ++ return AVERROR(EINVAL); ++#endif ++ ++ mediabufs_ctl_query_ext_ctrls(ctx->mbufs, qc, noof_ctrls); ++ i = 0; ++#if HEVC_CTRLS_VERSION >= 4 ++ // Skip slice check if no slice mode ++ if (qc[1].type != 0 && !ctrl_valid(qc + 1, V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED)) ++ i = 1; ++#else ++ // Fail frame mode silently for anything prior to V4 ++ if (qc[1].type == 0 || !ctrl_valid(qc + 1, V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED)) ++ return AVERROR(EINVAL); ++#endif ++ for (; i != noof_ctrls; ++i) { ++ if (qc[i].type == 0) { ++ av_log(avctx, AV_LOG_DEBUG, "Probed V%d control %#x missing\n", HEVC_CTRLS_VERSION, qc[i].id); ++ return AVERROR(EINVAL); ++ } ++ if (ctrl_sizes[i] != (size_t)qc[i].elem_size) { ++ av_log(avctx, AV_LOG_DEBUG, "Probed V%d control %d size mismatch %zu != %zu\n", ++ HEVC_CTRLS_VERSION, i, ctrl_sizes[i], (size_t)qc[i].elem_size); ++ return AVERROR(EINVAL); ++ } ++ } ++ ++ fill_sps(&ctrl_sps, sps); ++ ++ if (mediabufs_set_ext_ctrl(ctx->mbufs, NULL, V4L2_CID_STATELESS_HEVC_SPS, &ctrl_sps, sizeof(ctrl_sps))) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to set initial SPS\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ return 0; ++} ++ ++// Final init ++static int ++set_controls(AVCodecContext * const avctx, V4L2RequestContextHEVC * const ctx) ++{ ++ int ret; ++ ++ struct v4l2_query_ext_ctrl querys[] = { ++ { .id = V4L2_CID_STATELESS_HEVC_DECODE_MODE, }, ++ { .id = V4L2_CID_STATELESS_HEVC_START_CODE, }, ++ { .id = V4L2_CID_STATELESS_HEVC_SLICE_PARAMS, }, ++#if HEVC_CTRLS_VERSION >= 4 ++ { .id = V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS, }, ++#endif ++ }; ++ ++ struct v4l2_ext_control ctrls[] = { ++ { .id = V4L2_CID_STATELESS_HEVC_DECODE_MODE, }, ++ { .id = V4L2_CID_STATELESS_HEVC_START_CODE, }, ++ }; ++ ++ mediabufs_ctl_query_ext_ctrls(ctx->mbufs, querys, FF_ARRAY_ELEMS(querys)); ++ ++ ctx->max_slices = (!(querys[2].flags & V4L2_CTRL_FLAG_DYNAMIC_ARRAY) || ++ querys[2].nr_of_dims != 1 || querys[2].dims[0] == 0) ? ++ 1 : querys[2].dims[0]; ++ av_log(avctx, AV_LOG_DEBUG, "%s: Max slices %d\n", __func__, ctx->max_slices); ++ ++#if HEVC_CTRLS_VERSION >= 4 ++ ctx->max_offsets = (querys[3].type == 0 || querys[3].nr_of_dims != 1) ? ++ 0 : querys[3].dims[0]; ++ av_log(avctx, AV_LOG_DEBUG, "%s: Entry point offsets %d\n", __func__, ctx->max_offsets); ++#else ++ ctx->max_offsets = 0; ++#endif ++ ++ if (querys[0].default_value == V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED || ++ querys[0].default_value == V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED) ++ ctx->decode_mode = querys[0].default_value; ++ else if (ctrl_valid(querys + 0, V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED)) ++ ctx->decode_mode = V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED; ++ else if (ctrl_valid(querys + 0, V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED)) ++ ctx->decode_mode = V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED; ++ else { ++ av_log(avctx, AV_LOG_ERROR, "%s: unsupported decode mode\n", __func__); ++ return AVERROR(EINVAL); ++ } ++ ++ if (querys[1].default_value == V4L2_STATELESS_HEVC_START_CODE_NONE || ++ querys[1].default_value == V4L2_STATELESS_HEVC_START_CODE_ANNEX_B) ++ ctx->start_code = querys[1].default_value; ++ else if (ctrl_valid(querys + 1, V4L2_STATELESS_HEVC_START_CODE_ANNEX_B)) ++ ctx->start_code = V4L2_STATELESS_HEVC_START_CODE_ANNEX_B; ++ else if (ctrl_valid(querys + 1, V4L2_STATELESS_HEVC_START_CODE_NONE)) ++ ctx->start_code = V4L2_STATELESS_HEVC_START_CODE_NONE; ++ else { ++ av_log(avctx, AV_LOG_ERROR, "%s: unsupported start code\n", __func__); ++ return AVERROR(EINVAL); ++ } ++ ++ // If we are in slice mode & START_CODE_NONE supported then pick that ++ // as it doesn't require the slightly dodgy look backwards in our raw buffer ++ if (ctx->decode_mode == V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED && ++ ctrl_valid(querys + 1, V4L2_STATELESS_HEVC_START_CODE_NONE)) ++ ctx->start_code = V4L2_STATELESS_HEVC_START_CODE_NONE; ++ ++ ctrls[0].value = ctx->decode_mode; ++ ctrls[1].value = ctx->start_code; ++ ++ ret = mediabufs_ctl_set_ext_ctrls(ctx->mbufs, NULL, ctrls, FF_ARRAY_ELEMS(ctrls)); ++ return !ret ? 0 : AVERROR(-ret); ++} ++ ++static void v4l2_req_frame_free(void *opaque, uint8_t *data) ++{ ++ AVCodecContext *avctx = opaque; ++ V4L2MediaReqDescriptor * const rd = (V4L2MediaReqDescriptor*)data; ++ ++ av_log(NULL, AV_LOG_DEBUG, "%s: avctx=%p data=%p\n", __func__, avctx, data); ++ ++ qent_dst_unref(&rd->qe_dst); ++ ++ // We don't expect req or qe_src to be set ++ if (rd->req || rd->qe_src) ++ av_log(NULL, AV_LOG_ERROR, "%s: qe_src %p or req %p not NULL\n", __func__, rd->req, rd->qe_src); ++ ++ av_freep(&rd->slices); ++ av_freep(&rd->slice_params); ++ av_freep(&rd->offsets); ++ ++ av_free(rd); ++} ++ ++static AVBufferRef *v4l2_req_frame_alloc(void *opaque, int size) ++{ ++ AVCodecContext *avctx = opaque; ++// V4L2RequestContextHEVC *ctx = avctx->internal->hwaccel_priv_data; ++// V4L2MediaReqDescriptor *req; ++ AVBufferRef *ref; ++ uint8_t *data; ++// int ret; ++ ++ data = av_mallocz(size); ++ if (!data) ++ return NULL; ++ ++ av_log(avctx, AV_LOG_DEBUG, "%s: avctx=%p size=%d data=%p\n", __func__, avctx, size, data); ++ ref = av_buffer_create(data, size, v4l2_req_frame_free, avctx, 0); ++ if (!ref) { ++ av_freep(&data); ++ return NULL; ++ } ++ return ref; ++} ++ ++#if 0 ++static void v4l2_req_pool_free(void *opaque) ++{ ++ av_log(NULL, AV_LOG_DEBUG, "%s: opaque=%p\n", __func__, opaque); ++} ++ ++static void v4l2_req_hwframe_ctx_free(AVHWFramesContext *hwfc) ++{ ++ av_log(NULL, AV_LOG_DEBUG, "%s: hwfc=%p pool=%p\n", __func__, hwfc, hwfc->pool); ++ ++ av_buffer_pool_uninit(&hwfc->pool); ++} ++#endif ++ ++static int frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) ++{ ++ V4L2RequestContextHEVC *ctx = avctx->internal->hwaccel_priv_data; ++ AVHWFramesContext *hwfc = (AVHWFramesContext*)hw_frames_ctx->data; ++ const struct v4l2_format *vfmt = mediabufs_dst_fmt(ctx->mbufs); ++ ++ hwfc->format = AV_PIX_FMT_DRM_PRIME; ++ hwfc->sw_format = pixel_format_from_format(vfmt); ++ if (V4L2_TYPE_IS_MULTIPLANAR(vfmt->type)) { ++ hwfc->width = vfmt->fmt.pix_mp.width; ++ hwfc->height = vfmt->fmt.pix_mp.height; ++ } else { ++ hwfc->width = vfmt->fmt.pix.width; ++ hwfc->height = vfmt->fmt.pix.height; ++ } ++#if 0 ++ hwfc->pool = av_buffer_pool_init2(sizeof(V4L2MediaReqDescriptor), avctx, v4l2_req_frame_alloc, v4l2_req_pool_free); ++ if (!hwfc->pool) ++ return AVERROR(ENOMEM); ++ ++ hwfc->free = v4l2_req_hwframe_ctx_free; ++ ++ hwfc->initial_pool_size = 1; ++ ++ switch (avctx->codec_id) { ++ case AV_CODEC_ID_VP9: ++ hwfc->initial_pool_size += 8; ++ break; ++ case AV_CODEC_ID_VP8: ++ hwfc->initial_pool_size += 3; ++ break; ++ default: ++ hwfc->initial_pool_size += 2; ++ } ++#endif ++ av_log(avctx, AV_LOG_DEBUG, "%s: avctx=%p ctx=%p hw_frames_ctx=%p hwfc=%p pool=%p width=%d height=%d initial_pool_size=%d\n", __func__, avctx, ctx, hw_frames_ctx, hwfc, hwfc->pool, hwfc->width, hwfc->height, hwfc->initial_pool_size); ++ ++ return 0; ++} ++ ++static int alloc_frame(AVCodecContext * avctx, AVFrame *frame) ++{ ++ int rv; ++ ++ frame->buf[0] = v4l2_req_frame_alloc(avctx, sizeof(V4L2MediaReqDescriptor)); ++ if (!frame->buf[0]) ++ return AVERROR(ENOMEM); ++ ++ frame->data[0] = frame->buf[0]->data; ++ ++ frame->hw_frames_ctx = av_buffer_ref(avctx->hw_frames_ctx); ++ ++ if ((rv = ff_attach_decode_data(frame)) != 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to attach decode data to frame\n"); ++ av_frame_unref(frame); ++ return rv; ++ } ++ ++ return 0; ++} ++ ++const v4l2_req_decode_fns V(ff_v4l2_req_hevc) = { ++ .src_pix_fmt_v4l2 = V4L2_PIX_FMT_HEVC_SLICE, ++ .name = "V4L2 HEVC stateless V" STR(HEVC_CTRLS_VERSION), ++ .probe = probe, ++ .set_controls = set_controls, ++ ++ .start_frame = v4l2_request_hevc_start_frame, ++ .decode_slice = v4l2_request_hevc_decode_slice, ++ .end_frame = v4l2_request_hevc_end_frame, ++ .abort_frame = v4l2_request_hevc_abort_frame, ++ .frame_params = frame_params, ++ .alloc_frame = alloc_frame, ++}; ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_media.c +@@ -0,0 +1,1601 @@ ++/* ++ * Copyright (C) 2018 Paul Kocialkowski ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sub license, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial portions ++ * of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ++ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ++ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "v4l2_req_dmabufs.h" ++#include "v4l2_req_media.h" ++#include "v4l2_req_pollqueue.h" ++#include "v4l2_req_utils.h" ++#include "weak_link.h" ++ ++ ++/* floor(log2(x)) */ ++static unsigned int log2_size(size_t x) ++{ ++ unsigned int n = 0; ++ ++ if (x & ~0xffff) { ++ n += 16; ++ x >>= 16; ++ } ++ if (x & ~0xff) { ++ n += 8; ++ x >>= 8; ++ } ++ if (x & ~0xf) { ++ n += 4; ++ x >>= 4; ++ } ++ if (x & ~3) { ++ n += 2; ++ x >>= 2; ++ } ++ return (x & ~1) ? n + 1 : n; ++} ++ ++static size_t round_up_size(const size_t x) ++{ ++ /* Admit no size < 256 */ ++ const unsigned int n = x < 256 ? 8 : log2_size(x) - 1; ++ ++ return x >= (3 << n) ? 4 << n : (3 << n); ++} ++ ++struct media_request; ++ ++struct media_pool { ++ int fd; ++ sem_t sem; ++ pthread_mutex_t lock; ++ struct media_request * free_reqs; ++ struct pollqueue * pq; ++}; ++ ++struct media_request { ++ struct media_request * next; ++ struct media_pool * mp; ++ int fd; ++ struct polltask * pt; ++}; ++ ++ ++static inline int do_trywait(sem_t *const sem) ++{ ++ while (sem_trywait(sem)) { ++ if (errno != EINTR) ++ return -errno; ++ } ++ return 0; ++} ++ ++static inline int do_wait(sem_t *const sem) ++{ ++ while (sem_wait(sem)) { ++ if (errno != EINTR) ++ return -errno; ++ } ++ return 0; ++} ++ ++static int request_buffers(int video_fd, unsigned int type, ++ enum v4l2_memory memory, unsigned int buffers_count) ++{ ++ struct v4l2_requestbuffers buffers; ++ int rc; ++ ++ memset(&buffers, 0, sizeof(buffers)); ++ buffers.type = type; ++ buffers.memory = memory; ++ buffers.count = buffers_count; ++ ++ rc = ioctl(video_fd, VIDIOC_REQBUFS, &buffers); ++ if (rc < 0) { ++ rc = -errno; ++ request_log("Unable to request %d type %d buffers: %s\n", buffers_count, type, strerror(-rc)); ++ return rc; ++ } ++ ++ return 0; ++} ++ ++ ++static int set_stream(int video_fd, unsigned int type, bool enable) ++{ ++ enum v4l2_buf_type buf_type = type; ++ int rc; ++ ++ rc = ioctl(video_fd, enable ? VIDIOC_STREAMON : VIDIOC_STREAMOFF, ++ &buf_type); ++ if (rc < 0) { ++ rc = -errno; ++ request_log("Unable to %sable stream: %s\n", ++ enable ? "en" : "dis", strerror(-rc)); ++ return rc; ++ } ++ ++ return 0; ++} ++ ++ ++ ++struct media_request * media_request_get(struct media_pool * const mp) ++{ ++ struct media_request *req = NULL; ++ ++ /* Timeout handled by poll code */ ++ if (do_wait(&mp->sem)) ++ return NULL; ++ ++ pthread_mutex_lock(&mp->lock); ++ req = mp->free_reqs; ++ if (req) { ++ mp->free_reqs = req->next; ++ req->next = NULL; ++ } ++ pthread_mutex_unlock(&mp->lock); ++ return req; ++} ++ ++int media_request_fd(const struct media_request * const req) ++{ ++ return req->fd; ++} ++ ++int media_request_start(struct media_request * const req) ++{ ++ while (ioctl(req->fd, MEDIA_REQUEST_IOC_QUEUE, NULL) == -1) ++ { ++ const int err = errno; ++ if (err == EINTR) ++ continue; ++ request_log("%s: Failed to Q media: (%d) %s\n", __func__, err, strerror(err)); ++ return -err; ++ } ++ ++ pollqueue_add_task(req->pt, 2000); ++ return 0; ++} ++ ++static void media_request_done(void *v, short revents) ++{ ++ struct media_request *const req = v; ++ struct media_pool *const mp = req->mp; ++ ++ /* ** Not sure what to do about timeout */ ++ ++ if (ioctl(req->fd, MEDIA_REQUEST_IOC_REINIT, NULL) < 0) ++ request_log("Unable to reinit media request: %s\n", ++ strerror(errno)); ++ ++ pthread_mutex_lock(&mp->lock); ++ req->next = mp->free_reqs; ++ mp->free_reqs = req; ++ pthread_mutex_unlock(&mp->lock); ++ sem_post(&mp->sem); ++} ++ ++int media_request_abort(struct media_request ** const preq) ++{ ++ struct media_request * const req = *preq; ++ ++ if (req == NULL) ++ return 0; ++ *preq = NULL; ++ ++ media_request_done(req, 0); ++ return 0; ++} ++ ++static void delete_req_chain(struct media_request * const chain) ++{ ++ struct media_request * next = chain; ++ while (next) { ++ struct media_request * const req = next; ++ next = req->next; ++ if (req->pt) ++ polltask_delete(&req->pt); ++ if (req->fd != -1) ++ close(req->fd); ++ free(req); ++ } ++} ++ ++struct media_pool * media_pool_new(const char * const media_path, ++ struct pollqueue * const pq, ++ const unsigned int n) ++{ ++ struct media_pool * const mp = calloc(1, sizeof(*mp)); ++ unsigned int i; ++ ++ if (!mp) ++ goto fail0; ++ ++ mp->pq = pq; ++ pthread_mutex_init(&mp->lock, NULL); ++ mp->fd = open(media_path, O_RDWR | O_NONBLOCK); ++ if (mp->fd == -1) { ++ request_log("Failed to open '%s': %s\n", media_path, strerror(errno)); ++ goto fail1; ++ } ++ ++ for (i = 0; i != n; ++i) { ++ struct media_request * req = malloc(sizeof(*req)); ++ if (!req) ++ goto fail4; ++ ++ *req = (struct media_request){ ++ .next = mp->free_reqs, ++ .mp = mp, ++ .fd = -1 ++ }; ++ mp->free_reqs = req; ++ ++ if (ioctl(mp->fd, MEDIA_IOC_REQUEST_ALLOC, &req->fd) == -1) { ++ request_log("Failed to alloc request %d: %s\n", i, strerror(errno)); ++ goto fail4; ++ } ++ ++ req->pt = polltask_new(pq, req->fd, POLLPRI, media_request_done, req); ++ if (!req->pt) ++ goto fail4; ++ } ++ ++ sem_init(&mp->sem, 0, n); ++ ++ return mp; ++ ++fail4: ++ delete_req_chain(mp->free_reqs); ++ close(mp->fd); ++ pthread_mutex_destroy(&mp->lock); ++fail1: ++ free(mp); ++fail0: ++ return NULL; ++} ++ ++void media_pool_delete(struct media_pool ** pMp) ++{ ++ struct media_pool * const mp = *pMp; ++ ++ if (!mp) ++ return; ++ *pMp = NULL; ++ ++ delete_req_chain(mp->free_reqs); ++ close(mp->fd); ++ sem_destroy(&mp->sem); ++ pthread_mutex_destroy(&mp->lock); ++ free(mp); ++} ++ ++ ++#define INDEX_UNSET (~(uint32_t)0) ++ ++enum qent_status { ++ QENT_NEW = 0, // Initial state - shouldn't last ++ QENT_FREE, // On free chain ++ QENT_PENDING, // User has ent ++ QENT_WAITING, // On inuse ++ QENT_DONE, // Frame rx ++ QENT_ERROR, // Error ++ QENT_IMPORT ++}; ++ ++struct qent_base { ++ atomic_int ref_count; ++ struct qent_base *next; ++ struct qent_base *prev; ++ enum qent_status status; ++ uint32_t index; ++ struct dmabuf_h *dh[VIDEO_MAX_PLANES]; ++ struct timeval timestamp; ++}; ++ ++struct qent_src { ++ struct qent_base base; ++ int fixed_size; ++}; ++ ++struct qent_dst { ++ struct qent_base base; ++ bool waiting; ++ pthread_mutex_t lock; ++ pthread_cond_t cond; ++ struct ff_weak_link_client * mbc_wl; ++}; ++ ++struct qe_list_head { ++ struct qent_base *head; ++ struct qent_base *tail; ++}; ++ ++struct buf_pool { ++ pthread_mutex_t lock; ++ sem_t free_sem; ++ enum v4l2_buf_type buf_type; ++ struct qe_list_head free; ++ struct qe_list_head inuse; ++}; ++ ++ ++static inline struct qent_dst *base_to_dst(struct qent_base *be) ++{ ++ return (struct qent_dst *)be; ++} ++ ++static inline struct qent_src *base_to_src(struct qent_base *be) ++{ ++ return (struct qent_src *)be; ++} ++ ++ ++#define QENT_BASE_INITIALIZER {\ ++ .ref_count = ATOMIC_VAR_INIT(0),\ ++ .status = QENT_NEW,\ ++ .index = INDEX_UNSET\ ++} ++ ++static void qe_base_uninit(struct qent_base *const be) ++{ ++ unsigned int i; ++ for (i = 0; i != VIDEO_MAX_PLANES; ++i) { ++ dmabuf_free(be->dh[i]); ++ be->dh[i] = NULL; ++ } ++} ++ ++static void qe_src_free(struct qent_src *const be_src) ++{ ++ if (!be_src) ++ return; ++ qe_base_uninit(&be_src->base); ++ free(be_src); ++} ++ ++static struct qent_src * qe_src_new(void) ++{ ++ struct qent_src *const be_src = malloc(sizeof(*be_src)); ++ if (!be_src) ++ return NULL; ++ *be_src = (struct qent_src){ ++ .base = QENT_BASE_INITIALIZER ++ }; ++ return be_src; ++} ++ ++static void qe_dst_free(struct qent_dst *const be_dst) ++{ ++ if (!be_dst) ++ return; ++ ++ ff_weak_link_unref(&be_dst->mbc_wl); ++ pthread_cond_destroy(&be_dst->cond); ++ pthread_mutex_destroy(&be_dst->lock); ++ qe_base_uninit(&be_dst->base); ++ free(be_dst); ++} ++ ++static struct qent_dst* qe_dst_new(struct ff_weak_link_master * const wl) ++{ ++ struct qent_dst *const be_dst = malloc(sizeof(*be_dst)); ++ if (!be_dst) ++ return NULL; ++ *be_dst = (struct qent_dst){ ++ .base = QENT_BASE_INITIALIZER, ++ .lock = PTHREAD_MUTEX_INITIALIZER, ++ .cond = PTHREAD_COND_INITIALIZER, ++ .mbc_wl = ff_weak_link_ref(wl) ++ }; ++ return be_dst; ++} ++ ++static void ql_add_tail(struct qe_list_head * const ql, struct qent_base * be) ++{ ++ if (ql->tail) ++ ql->tail->next = be; ++ else ++ ql->head = be; ++ be->prev = ql->tail; ++ be->next = NULL; ++ ql->tail = be; ++} ++ ++static struct qent_base * ql_extract(struct qe_list_head * const ql, struct qent_base * be) ++{ ++ if (!be) ++ return NULL; ++ ++ if (be->next) ++ be->next->prev = be->prev; ++ else ++ ql->tail = be->prev; ++ if (be->prev) ++ be->prev->next = be->next; ++ else ++ ql->head = be->next; ++ be->next = NULL; ++ be->prev = NULL; ++ return be; ++} ++ ++ ++static void bq_put_free(struct buf_pool *const bp, struct qent_base * be) ++{ ++ ql_add_tail(&bp->free, be); ++} ++ ++static struct qent_base * bq_get_free(struct buf_pool *const bp) ++{ ++ return ql_extract(&bp->free, bp->free.head); ++} ++ ++static struct qent_base * bq_extract_inuse(struct buf_pool *const bp, struct qent_base *const be) ++{ ++ return ql_extract(&bp->inuse, be); ++} ++ ++static struct qent_base * bq_get_inuse(struct buf_pool *const bp) ++{ ++ return ql_extract(&bp->inuse, bp->inuse.head); ++} ++ ++static void bq_free_all_free_src(struct buf_pool *const bp) ++{ ++ struct qent_base *be; ++ while ((be = bq_get_free(bp)) != NULL) ++ qe_src_free(base_to_src(be)); ++} ++ ++static void bq_free_all_inuse_src(struct buf_pool *const bp) ++{ ++ struct qent_base *be; ++ while ((be = bq_get_inuse(bp)) != NULL) ++ qe_src_free(base_to_src(be)); ++} ++ ++static void bq_free_all_free_dst(struct buf_pool *const bp) ++{ ++ struct qent_base *be; ++ while ((be = bq_get_free(bp)) != NULL) ++ qe_dst_free(base_to_dst(be)); ++} ++ ++static void queue_put_free(struct buf_pool *const bp, struct qent_base *be) ++{ ++ unsigned int i; ++ ++ pthread_mutex_lock(&bp->lock); ++ /* Clear out state vars */ ++ be->timestamp.tv_sec = 0; ++ be->timestamp.tv_usec = 0; ++ be->status = QENT_FREE; ++ for (i = 0; i < VIDEO_MAX_PLANES && be->dh[i]; ++i) ++ dmabuf_len_set(be->dh[i], 0); ++ bq_put_free(bp, be); ++ pthread_mutex_unlock(&bp->lock); ++ sem_post(&bp->free_sem); ++} ++ ++static bool queue_is_inuse(const struct buf_pool *const bp) ++{ ++ return bp->inuse.tail != NULL; ++} ++ ++static void queue_put_inuse(struct buf_pool *const bp, struct qent_base *be) ++{ ++ if (!be) ++ return; ++ pthread_mutex_lock(&bp->lock); ++ ql_add_tail(&bp->inuse, be); ++ be->status = QENT_WAITING; ++ pthread_mutex_unlock(&bp->lock); ++} ++ ++static struct qent_base *queue_get_free(struct buf_pool *const bp) ++{ ++ struct qent_base *buf; ++ ++ if (do_wait(&bp->free_sem)) ++ return NULL; ++ pthread_mutex_lock(&bp->lock); ++ buf = bq_get_free(bp); ++ pthread_mutex_unlock(&bp->lock); ++ return buf; ++} ++ ++static struct qent_base *queue_tryget_free(struct buf_pool *const bp) ++{ ++ struct qent_base *buf; ++ ++ if (do_trywait(&bp->free_sem)) ++ return NULL; ++ pthread_mutex_lock(&bp->lock); ++ buf = bq_get_free(bp); ++ pthread_mutex_unlock(&bp->lock); ++ return buf; ++} ++ ++static struct qent_base * queue_find_extract_fd(struct buf_pool *const bp, const int fd) ++{ ++ struct qent_base *be; ++ ++ pthread_mutex_lock(&bp->lock); ++ /* Expect 1st in Q, but allow anywhere */ ++ for (be = bp->inuse.head; be; be = be->next) { ++ if (dmabuf_fd(be->dh[0]) == fd) { ++ bq_extract_inuse(bp, be); ++ break; ++ } ++ } ++ pthread_mutex_unlock(&bp->lock); ++ ++ return be; ++} ++ ++static void queue_delete(struct buf_pool *const bp) ++{ ++ sem_destroy(&bp->free_sem); ++ pthread_mutex_destroy(&bp->lock); ++ free(bp); ++} ++ ++static struct buf_pool* queue_new(const int vfd) ++{ ++ struct buf_pool *bp = calloc(1, sizeof(*bp)); ++ if (!bp) ++ return NULL; ++ pthread_mutex_init(&bp->lock, NULL); ++ sem_init(&bp->free_sem, 0, 0); ++ return bp; ++} ++ ++ ++struct mediabufs_ctl { ++ atomic_int ref_count; /* 0 is single ref for easier atomics */ ++ void * dc; ++ int vfd; ++ bool stream_on; ++ bool polling; ++ bool dst_fixed; // Dst Q is fixed size ++ pthread_mutex_t lock; ++ struct buf_pool * src; ++ struct buf_pool * dst; ++ struct polltask * pt; ++ struct pollqueue * pq; ++ struct ff_weak_link_master * this_wlm; ++ ++ struct v4l2_format src_fmt; ++ struct v4l2_format dst_fmt; ++ struct v4l2_capability capability; ++}; ++ ++static int qe_v4l2_queue(struct qent_base *const be, ++ const int vfd, struct media_request *const mreq, ++ const struct v4l2_format *const fmt, ++ const bool is_dst, const bool hold_flag) ++{ ++ struct v4l2_buffer buffer = { ++ .type = fmt->type, ++ .memory = V4L2_MEMORY_DMABUF, ++ .index = be->index ++ }; ++ struct v4l2_plane planes[VIDEO_MAX_PLANES] = {{0}}; ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(fmt->type)) { ++ unsigned int i; ++ for (i = 0; i < VIDEO_MAX_PLANES && be->dh[i]; ++i) { ++ if (is_dst) ++ dmabuf_len_set(be->dh[i], 0); ++ ++ /* *** Really need a pixdesc rather than a format so we can fill in data_offset */ ++ planes[i].length = dmabuf_size(be->dh[i]); ++ planes[i].bytesused = dmabuf_len(be->dh[i]); ++ planes[i].m.fd = dmabuf_fd(be->dh[i]); ++ } ++ buffer.m.planes = planes; ++ buffer.length = i; ++ } ++ else { ++ if (is_dst) ++ dmabuf_len_set(be->dh[0], 0); ++ ++ buffer.bytesused = dmabuf_len(be->dh[0]); ++ buffer.length = dmabuf_size(be->dh[0]); ++ buffer.m.fd = dmabuf_fd(be->dh[0]); ++ } ++ ++ if (!is_dst && mreq) { ++ buffer.flags |= V4L2_BUF_FLAG_REQUEST_FD; ++ buffer.request_fd = media_request_fd(mreq); ++ if (hold_flag) ++ buffer.flags |= V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF; ++ } ++ ++ if (is_dst) ++ be->timestamp = (struct timeval){0,0}; ++ ++ buffer.timestamp = be->timestamp; ++ ++ while (ioctl(vfd, VIDIOC_QBUF, &buffer)) { ++ const int err = errno; ++ if (err != EINTR) { ++ request_log("%s: Failed to Q buffer: err=%d (%s)\n", __func__, err, strerror(err)); ++ return -err; ++ } ++ } ++ return 0; ++} ++ ++static struct qent_base * qe_dequeue(struct buf_pool *const bp, ++ const int vfd, ++ const struct v4l2_format * const f) ++{ ++ int fd; ++ struct qent_base *be; ++ int rc; ++ const bool mp = V4L2_TYPE_IS_MULTIPLANAR(f->type); ++ struct v4l2_plane planes[VIDEO_MAX_PLANES] = {{0}}; ++ struct v4l2_buffer buffer = { ++ .type = f->type, ++ .memory = V4L2_MEMORY_DMABUF ++ }; ++ if (mp) { ++ buffer.length = f->fmt.pix_mp.num_planes; ++ buffer.m.planes = planes; ++ } ++ ++ while ((rc = ioctl(vfd, VIDIOC_DQBUF, &buffer)) != 0 && ++ errno == EINTR) ++ /* Loop */; ++ if (rc) { ++ request_log("Error DQing buffer type %d: %s\n", f->type, strerror(errno)); ++ return NULL; ++ } ++ ++ fd = mp ? planes[0].m.fd : buffer.m.fd; ++ be = queue_find_extract_fd(bp, fd); ++ if (!be) { ++ request_log("Failed to find fd %d in Q\n", fd); ++ return NULL; ++ } ++ ++ be->timestamp = buffer.timestamp; ++ be->status = (buffer.flags & V4L2_BUF_FLAG_ERROR) ? QENT_ERROR : QENT_DONE; ++ return be; ++} ++ ++static void qe_dst_done(struct qent_dst * dst_be) ++{ ++ pthread_mutex_lock(&dst_be->lock); ++ dst_be->waiting = false; ++ pthread_cond_broadcast(&dst_be->cond); ++ pthread_mutex_unlock(&dst_be->lock); ++ ++ qent_dst_unref(&dst_be); ++} ++ ++static bool qe_dst_waiting(struct qent_dst *const dst_be) ++{ ++ bool waiting; ++ pthread_mutex_lock(&dst_be->lock); ++ waiting = dst_be->waiting; ++ dst_be->waiting = true; ++ pthread_mutex_unlock(&dst_be->lock); ++ return waiting; ++} ++ ++ ++static bool mediabufs_wants_poll(const struct mediabufs_ctl *const mbc) ++{ ++ return queue_is_inuse(mbc->src) || queue_is_inuse(mbc->dst); ++} ++ ++static void mediabufs_poll_cb(void * v, short revents) ++{ ++ struct mediabufs_ctl *mbc = v; ++ struct qent_src *src_be = NULL; ++ struct qent_dst *dst_be = NULL; ++ ++ if (!revents) ++ request_err(mbc->dc, "%s: Timeout\n", __func__); ++ ++ pthread_mutex_lock(&mbc->lock); ++ mbc->polling = false; ++ ++ if ((revents & POLLOUT) != 0) ++ src_be = base_to_src(qe_dequeue(mbc->src, mbc->vfd, &mbc->src_fmt)); ++ if ((revents & POLLIN) != 0) ++ dst_be = base_to_dst(qe_dequeue(mbc->dst, mbc->vfd, &mbc->dst_fmt)); ++ ++ /* Reschedule */ ++ if (mediabufs_wants_poll(mbc)) { ++ mbc->polling = true; ++ pollqueue_add_task(mbc->pt, 2000); ++ } ++ pthread_mutex_unlock(&mbc->lock); ++ ++ if (src_be) ++ queue_put_free(mbc->src, &src_be->base); ++ if (dst_be) ++ qe_dst_done(dst_be); ++} ++ ++int qent_src_params_set(struct qent_src *const be_src, const struct timeval * timestamp) ++{ ++ struct qent_base *const be = &be_src->base; ++ ++ be->timestamp = *timestamp; ++ return 0; ++} ++ ++struct timeval qent_dst_timestamp_get(const struct qent_dst *const be_dst) ++{ ++ return be_dst->base.timestamp; ++} ++ ++static int qent_base_realloc(struct qent_base *const be, const size_t len, struct dmabufs_ctl * dbsc) ++{ ++ if (!be->dh[0] || len > dmabuf_size(be->dh[0])) { ++ size_t newsize = round_up_size(len); ++ request_log("%s: Overrun %zd > %zd; trying %zd\n", __func__, len, dmabuf_size(be->dh[0]), newsize); ++ if (!dbsc) { ++ request_log("%s: No dmbabuf_ctrl for realloc\n", __func__); ++ return -ENOMEM; ++ } ++ if ((be->dh[0] = dmabuf_realloc(dbsc, be->dh[0], newsize)) == NULL) { ++ request_log("%s: Realloc %zd failed\n", __func__, newsize); ++ return -ENOMEM; ++ } ++ } ++ return 0; ++} ++ ++int qent_src_alloc(struct qent_src *const be_src, const size_t len, struct dmabufs_ctl * dbsc) ++{ ++ struct qent_base *const be = &be_src->base; ++ return qent_base_realloc(be, len, dbsc); ++} ++ ++ ++int qent_src_data_copy(struct qent_src *const be_src, const size_t offset, const void *const src, const size_t len, struct dmabufs_ctl * dbsc) ++{ ++ void * dst; ++ struct qent_base *const be = &be_src->base; ++ int rv; ++ ++ // Realloc doesn't copy so don't alloc if offset != 0 ++ if ((rv = qent_base_realloc(be, offset + len, ++ be_src->fixed_size || offset ? NULL : dbsc)) != 0) ++ return rv; ++ ++ dmabuf_write_start(be->dh[0]); ++ dst = dmabuf_map(be->dh[0]); ++ if (!dst) ++ return -1; ++ memcpy((char*)dst + offset, src, len); ++ dmabuf_len_set(be->dh[0], len); ++ dmabuf_write_end(be->dh[0]); ++ return 0; ++} ++ ++const struct dmabuf_h * qent_dst_dmabuf(const struct qent_dst *const be_dst, unsigned int plane) ++{ ++ const struct qent_base *const be = &be_dst->base; ++ ++ return (plane >= sizeof(be->dh)/sizeof(be->dh[0])) ? NULL : be->dh[plane]; ++} ++ ++int qent_dst_dup_fd(const struct qent_dst *const be_dst, unsigned int plane) ++{ ++ return dup(dmabuf_fd(qent_dst_dmabuf(be_dst, plane))); ++} ++ ++MediaBufsStatus mediabufs_start_request(struct mediabufs_ctl *const mbc, ++ struct media_request **const pmreq, ++ struct qent_src **const psrc_be, ++ struct qent_dst *const dst_be, ++ const bool is_final) ++{ ++ struct media_request * mreq = *pmreq; ++ struct qent_src *const src_be = *psrc_be; ++ ++ // Req & src are always both "consumed" ++ *pmreq = NULL; ++ *psrc_be = NULL; ++ ++ pthread_mutex_lock(&mbc->lock); ++ ++ if (!src_be) ++ goto fail1; ++ ++ if (dst_be) { ++ if (qe_dst_waiting(dst_be)) { ++ request_info(mbc->dc, "Request buffer already waiting on start\n"); ++ goto fail1; ++ } ++ dst_be->base.timestamp = (struct timeval){0,0}; ++ if (qe_v4l2_queue(&dst_be->base, mbc->vfd, NULL, &mbc->dst_fmt, true, false)) ++ goto fail1; ++ ++ qent_dst_ref(dst_be); ++ queue_put_inuse(mbc->dst, &dst_be->base); ++ } ++ ++ if (qe_v4l2_queue(&src_be->base, mbc->vfd, mreq, &mbc->src_fmt, false, !is_final)) ++ goto fail1; ++ queue_put_inuse(mbc->src, &src_be->base); ++ ++ if (!mbc->polling && mediabufs_wants_poll(mbc)) { ++ mbc->polling = true; ++ pollqueue_add_task(mbc->pt, 2000); ++ } ++ pthread_mutex_unlock(&mbc->lock); ++ ++ if (media_request_start(mreq)) ++ return MEDIABUFS_ERROR_OPERATION_FAILED; ++ ++ return MEDIABUFS_STATUS_SUCCESS; ++ ++fail1: ++ media_request_abort(&mreq); ++ if (src_be) ++ queue_put_free(mbc->src, &src_be->base); ++ ++// *** TODO: If src Q fails this doesnt unwind properly - separate dst Q from src Q ++ if (dst_be) { ++ dst_be->base.status = QENT_ERROR; ++ qe_dst_done(dst_be); ++ } ++ pthread_mutex_unlock(&mbc->lock); ++ return MEDIABUFS_ERROR_OPERATION_FAILED; ++} ++ ++ ++static int qe_alloc_from_fmt(struct qent_base *const be, ++ struct dmabufs_ctl *const dbsc, ++ const struct v4l2_format *const fmt) ++{ ++ if (V4L2_TYPE_IS_MULTIPLANAR(fmt->type)) { ++ unsigned int i; ++ for (i = 0; i != fmt->fmt.pix_mp.num_planes; ++i) { ++ be->dh[i] = dmabuf_realloc(dbsc, be->dh[i], ++ fmt->fmt.pix_mp.plane_fmt[i].sizeimage); ++ /* On failure tidy up and die */ ++ if (!be->dh[i]) { ++ while (i--) { ++ dmabuf_free(be->dh[i]); ++ be->dh[i] = NULL; ++ } ++ return -1; ++ } ++ } ++ } ++ else { ++// be->dh[0] = dmabuf_alloc(dbsc, fmt->fmt.pix.sizeimage); ++ size_t size = fmt->fmt.pix.sizeimage; ++ be->dh[0] = dmabuf_realloc(dbsc, be->dh[0], size); ++ if (!be->dh[0]) ++ return -1; ++ } ++ return 0; ++} ++ ++static MediaBufsStatus fmt_set(struct v4l2_format *const fmt, const int fd, ++ const enum v4l2_buf_type buftype, ++ uint32_t pixfmt, ++ const unsigned int width, const unsigned int height, ++ const size_t bufsize) ++{ ++ *fmt = (struct v4l2_format){.type = buftype}; ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(buftype)) { ++ fmt->fmt.pix_mp.width = width; ++ fmt->fmt.pix_mp.height = height; ++ fmt->fmt.pix_mp.pixelformat = pixfmt; ++ if (bufsize) { ++ fmt->fmt.pix_mp.num_planes = 1; ++ fmt->fmt.pix_mp.plane_fmt[0].sizeimage = bufsize; ++ } ++ } ++ else { ++ fmt->fmt.pix.width = width; ++ fmt->fmt.pix.height = height; ++ fmt->fmt.pix.pixelformat = pixfmt; ++ fmt->fmt.pix.sizeimage = bufsize; ++ } ++ ++ while (ioctl(fd, VIDIOC_S_FMT, fmt)) ++ if (errno != EINTR) ++ return MEDIABUFS_ERROR_OPERATION_FAILED; ++ ++ // Treat anything where we don't get at least what we asked for as a fail ++ if (V4L2_TYPE_IS_MULTIPLANAR(buftype)) { ++ if (fmt->fmt.pix_mp.width < width || ++ fmt->fmt.pix_mp.height < height || ++ fmt->fmt.pix_mp.pixelformat != pixfmt) { ++ return MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE; ++ } ++ } ++ else { ++ if (fmt->fmt.pix.width < width || ++ fmt->fmt.pix.height < height || ++ fmt->fmt.pix.pixelformat != pixfmt) { ++ return MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE; ++ } ++ } ++ ++ return MEDIABUFS_STATUS_SUCCESS; ++} ++ ++static MediaBufsStatus find_fmt_flags(struct v4l2_format *const fmt, ++ const int fd, ++ const unsigned int type_v4l2, ++ const uint32_t flags_must, ++ const uint32_t flags_not, ++ const unsigned int width, ++ const unsigned int height, ++ mediabufs_dst_fmt_accept_fn *const accept_fn, ++ void *const accept_v) ++{ ++ unsigned int i; ++ ++ for (i = 0;; ++i) { ++ struct v4l2_fmtdesc fmtdesc = { ++ .index = i, ++ .type = type_v4l2 ++ }; ++ while (ioctl(fd, VIDIOC_ENUM_FMT, &fmtdesc)) { ++ if (errno != EINTR) ++ return MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE; ++ } ++ if ((fmtdesc.flags & flags_must) != flags_must || ++ (fmtdesc.flags & flags_not)) ++ continue; ++ if (!accept_fn(accept_v, &fmtdesc)) ++ continue; ++ ++ if (fmt_set(fmt, fd, fmtdesc.type, fmtdesc.pixelformat, ++ width, height, 0) == MEDIABUFS_STATUS_SUCCESS) ++ return MEDIABUFS_STATUS_SUCCESS; ++ } ++ return 0; ++} ++ ++ ++/* Wait for qent done */ ++ ++MediaBufsStatus qent_dst_wait(struct qent_dst *const be_dst) ++{ ++ struct qent_base *const be = &be_dst->base; ++ enum qent_status estat; ++ ++ pthread_mutex_lock(&be_dst->lock); ++ while (be_dst->waiting && ++ !pthread_cond_wait(&be_dst->cond, &be_dst->lock)) ++ /* Loop */; ++ estat = be->status; ++ pthread_mutex_unlock(&be_dst->lock); ++ ++ return estat == QENT_DONE ? MEDIABUFS_STATUS_SUCCESS : ++ estat == QENT_ERROR ? MEDIABUFS_ERROR_DECODING_ERROR : ++ MEDIABUFS_ERROR_OPERATION_FAILED; ++} ++ ++const uint8_t * qent_dst_data(struct qent_dst *const be_dst, unsigned int buf_no) ++{ ++ struct qent_base *const be = &be_dst->base; ++ return dmabuf_map(be->dh[buf_no]); ++} ++ ++MediaBufsStatus qent_dst_read_start(struct qent_dst *const be_dst) ++{ ++ struct qent_base *const be = &be_dst->base; ++ unsigned int i; ++ for (i = 0; i != VIDEO_MAX_PLANES && be->dh[i]; ++i) { ++ if (dmabuf_read_start(be->dh[i])) { ++ while (i--) ++ dmabuf_read_end(be->dh[i]); ++ return MEDIABUFS_ERROR_ALLOCATION_FAILED; ++ } ++ } ++ return MEDIABUFS_STATUS_SUCCESS; ++} ++ ++MediaBufsStatus qent_dst_read_stop(struct qent_dst *const be_dst) ++{ ++ struct qent_base *const be = &be_dst->base; ++ unsigned int i; ++ MediaBufsStatus status = MEDIABUFS_STATUS_SUCCESS; ++ ++ for (i = 0; i != VIDEO_MAX_PLANES && be->dh[i]; ++i) { ++ if (dmabuf_read_end(be->dh[i])) ++ status = MEDIABUFS_ERROR_OPERATION_FAILED; ++ } ++ return status; ++} ++ ++struct qent_dst * qent_dst_ref(struct qent_dst * const be_dst) ++{ ++ if (be_dst) ++ atomic_fetch_add(&be_dst->base.ref_count, 1); ++ return be_dst; ++} ++ ++void qent_dst_unref(struct qent_dst ** const pbe_dst) ++{ ++ struct qent_dst * const be_dst = *pbe_dst; ++ struct mediabufs_ctl * mbc; ++ if (!be_dst) ++ return; ++ *pbe_dst = NULL; ++ ++ if (atomic_fetch_sub(&be_dst->base.ref_count, 1) != 0) ++ return; ++ ++ if ((mbc = ff_weak_link_lock(&be_dst->mbc_wl)) != NULL) { ++ queue_put_free(mbc->dst, &be_dst->base); ++ ff_weak_link_unlock(be_dst->mbc_wl); ++ } ++ else { ++ qe_dst_free(be_dst); ++ } ++} ++ ++MediaBufsStatus qent_dst_import_fd(struct qent_dst *const be_dst, ++ unsigned int plane, ++ int fd, size_t size) ++{ ++ struct qent_base *const be = &be_dst->base; ++ struct dmabuf_h * dh; ++ ++ if (be->status != QENT_IMPORT || be->dh[plane]) ++ return MEDIABUFS_ERROR_OPERATION_FAILED; ++ ++ dh = dmabuf_import(fd, size); ++ if (!dh) ++ return MEDIABUFS_ERROR_ALLOCATION_FAILED; ++ ++ be->dh[plane] = dh; ++ return MEDIABUFS_STATUS_SUCCESS; ++} ++ ++// Returns noof buffers created, -ve for error ++static int create_dst_bufs(struct mediabufs_ctl *const mbc, unsigned int n, struct qent_dst * const qes[]) ++{ ++ unsigned int i; ++ ++ struct v4l2_create_buffers cbuf = { ++ .count = n, ++ .memory = V4L2_MEMORY_DMABUF, ++ .format = mbc->dst_fmt, ++ }; ++ ++ while (ioctl(mbc->vfd, VIDIOC_CREATE_BUFS, &cbuf)) { ++ const int err = -errno; ++ if (err != EINTR) { ++ request_err(mbc->dc, "%s: Failed to create V4L2 buffer\n", __func__); ++ return -err; ++ } ++ } ++ ++ if (cbuf.count != n) ++ request_warn(mbc->dc, "%s: Created %d of %d V4L2 buffers requested\n", __func__, cbuf.count, n); ++ ++ for (i = 0; i != cbuf.count; ++i) ++ qes[i]->base.index = cbuf.index + i; ++ ++ return cbuf.count; ++} ++ ++struct qent_dst* mediabufs_dst_qent_alloc(struct mediabufs_ctl *const mbc, struct dmabufs_ctl *const dbsc) ++{ ++ struct qent_dst * be_dst; ++ ++ if (mbc == NULL) { ++ be_dst = qe_dst_new(NULL); ++ if (be_dst) ++ be_dst->base.status = QENT_IMPORT; ++ return be_dst; ++ } ++ ++ if (mbc->dst_fixed) { ++ be_dst = base_to_dst(queue_get_free(mbc->dst)); ++ if (!be_dst) ++ return NULL; ++ } ++ else { ++ be_dst = base_to_dst(queue_tryget_free(mbc->dst)); ++ if (!be_dst) { ++ be_dst = qe_dst_new(mbc->this_wlm); ++ if (!be_dst) ++ return NULL; ++ ++ if (create_dst_bufs(mbc, 1, &be_dst) != 1) { ++ qe_dst_free(be_dst); ++ return NULL; ++ } ++ } ++ } ++ ++ if (qe_alloc_from_fmt(&be_dst->base, dbsc, &mbc->dst_fmt)) { ++ /* Given how create buf works we can't uncreate it on alloc failure ++ * all we can do is put it on the free Q ++ */ ++ queue_put_free(mbc->dst, &be_dst->base); ++ return NULL; ++ } ++ ++ be_dst->base.status = QENT_PENDING; ++ atomic_store(&be_dst->base.ref_count, 0); ++ return be_dst; ++} ++ ++const struct v4l2_format *mediabufs_dst_fmt(struct mediabufs_ctl *const mbc) ++{ ++ return &mbc->dst_fmt; ++} ++ ++MediaBufsStatus mediabufs_dst_fmt_set(struct mediabufs_ctl *const mbc, ++ const unsigned int width, ++ const unsigned int height, ++ mediabufs_dst_fmt_accept_fn *const accept_fn, ++ void *const accept_v) ++{ ++ MediaBufsStatus status; ++ unsigned int i; ++ const enum v4l2_buf_type buf_type = mbc->dst_fmt.type; ++ static const struct { ++ unsigned int flags_must; ++ unsigned int flags_not; ++ } trys[] = { ++ {0, V4L2_FMT_FLAG_EMULATED}, ++ {V4L2_FMT_FLAG_EMULATED, 0}, ++ }; ++ for (i = 0; i != sizeof(trys)/sizeof(trys[0]); ++i) { ++ status = find_fmt_flags(&mbc->dst_fmt, mbc->vfd, ++ buf_type, ++ trys[i].flags_must, ++ trys[i].flags_not, ++ width, height, accept_fn, accept_v); ++ if (status != MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE) ++ return status; ++ } ++ ++ if (status != MEDIABUFS_STATUS_SUCCESS) ++ return status; ++ ++ /* Try to create a buffer - don't alloc */ ++ return status; ++} ++ ++// ** This is a mess if we get partial alloc but without any way to remove ++// individual V4L2 Q members we are somewhat stuffed ++MediaBufsStatus mediabufs_dst_slots_create(struct mediabufs_ctl *const mbc, const unsigned int n, const bool fixed) ++{ ++ unsigned int i; ++ int a = 0; ++ unsigned int qc; ++ struct qent_dst * qes[32]; ++ ++ if (n > 32) ++ return MEDIABUFS_ERROR_ALLOCATION_FAILED; ++ ++ // Create qents first as it is hard to get rid of the V4L2 buffers on error ++ for (qc = 0; qc != n; ++qc) ++ { ++ if ((qes[qc] = qe_dst_new(mbc->this_wlm)) == NULL) ++ goto fail; ++ } ++ ++ if ((a = create_dst_bufs(mbc, n, qes)) < 0) ++ goto fail; ++ ++ for (i = 0; i != a; ++i) ++ queue_put_free(mbc->dst, &qes[i]->base); ++ ++ if (a != n) ++ goto fail; ++ ++ mbc->dst_fixed = fixed; ++ return MEDIABUFS_STATUS_SUCCESS; ++ ++fail: ++ for (i = (a < 0 ? 0 : a); i != qc; ++i) ++ qe_dst_free(qes[i]); ++ ++ return MEDIABUFS_ERROR_ALLOCATION_FAILED; ++} ++ ++struct qent_src *mediabufs_src_qent_get(struct mediabufs_ctl *const mbc) ++{ ++ struct qent_base * buf = queue_get_free(mbc->src); ++ buf->status = QENT_PENDING; ++ return base_to_src(buf); ++} ++ ++void mediabufs_src_qent_abort(struct mediabufs_ctl *const mbc, struct qent_src **const pqe_src) ++{ ++ struct qent_src *const qe_src = *pqe_src; ++ if (!qe_src) ++ return; ++ *pqe_src = NULL; ++ queue_put_free(mbc->src, &qe_src->base); ++} ++ ++/* src format must have been set up before this */ ++MediaBufsStatus mediabufs_src_pool_create(struct mediabufs_ctl *const mbc, ++ struct dmabufs_ctl * const dbsc, ++ unsigned int n) ++{ ++ unsigned int i; ++ struct v4l2_requestbuffers req = { ++ .count = n, ++ .type = mbc->src_fmt.type, ++ .memory = V4L2_MEMORY_DMABUF ++ }; ++ ++ bq_free_all_free_src(mbc->src); ++ while (ioctl(mbc->vfd, VIDIOC_REQBUFS, &req) == -1) { ++ if (errno != EINTR) { ++ request_err(mbc->dc, "%s: Failed to request src bufs\n", __func__); ++ return MEDIABUFS_ERROR_OPERATION_FAILED; ++ } ++ } ++ ++ if (n > req.count) { ++ request_info(mbc->dc, "Only allocated %d of %d src buffers requested\n", req.count, n); ++ n = req.count; ++ } ++ ++ for (i = 0; i != n; ++i) { ++ struct qent_src *const be_src = qe_src_new(); ++ if (!be_src) { ++ request_err(mbc->dc, "Failed to create src be %d\n", i); ++ goto fail; ++ } ++ if (qe_alloc_from_fmt(&be_src->base, dbsc, &mbc->src_fmt)) { ++ qe_src_free(be_src); ++ goto fail; ++ } ++ be_src->base.index = i; ++ be_src->fixed_size = !mediabufs_src_resizable(mbc); ++ ++ queue_put_free(mbc->src, &be_src->base); ++ } ++ ++ return MEDIABUFS_STATUS_SUCCESS; ++ ++fail: ++ bq_free_all_free_src(mbc->src); ++ req.count = 0; ++ while (ioctl(mbc->vfd, VIDIOC_REQBUFS, &req) == -1 && ++ errno == EINTR) ++ /* Loop */; ++ ++ return MEDIABUFS_ERROR_OPERATION_FAILED; ++} ++ ++ ++ ++/* ++ * Set stuff order: ++ * Set src fmt ++ * Set parameters (sps) on vfd ++ * Negotiate dst format (dst_fmt_set) ++ * Create src buffers ++ * Alloc a dst buffer or Create dst slots ++*/ ++MediaBufsStatus mediabufs_stream_on(struct mediabufs_ctl *const mbc) ++{ ++ if (mbc->stream_on) ++ return MEDIABUFS_STATUS_SUCCESS; ++ ++ if (set_stream(mbc->vfd, mbc->src_fmt.type, true) < 0) { ++ request_log("Failed to set stream on src type %d\n", mbc->src_fmt.type); ++ return MEDIABUFS_ERROR_OPERATION_FAILED; ++ } ++ ++ if (set_stream(mbc->vfd, mbc->dst_fmt.type, true) < 0) { ++ request_log("Failed to set stream on dst type %d\n", mbc->dst_fmt.type); ++ set_stream(mbc->vfd, mbc->src_fmt.type, false); ++ return MEDIABUFS_ERROR_OPERATION_FAILED; ++ } ++ ++ mbc->stream_on = true; ++ return MEDIABUFS_STATUS_SUCCESS; ++} ++ ++MediaBufsStatus mediabufs_stream_off(struct mediabufs_ctl *const mbc) ++{ ++ MediaBufsStatus status = MEDIABUFS_STATUS_SUCCESS; ++ ++ if (!mbc->stream_on) ++ return MEDIABUFS_STATUS_SUCCESS; ++ ++ if (set_stream(mbc->vfd, mbc->dst_fmt.type, false) < 0) { ++ request_log("Failed to set stream off dst type %d\n", mbc->dst_fmt.type); ++ status = MEDIABUFS_ERROR_OPERATION_FAILED; ++ } ++ ++ if (set_stream(mbc->vfd, mbc->src_fmt.type, false) < 0) { ++ request_log("Failed to set stream off src type %d\n", mbc->src_fmt.type); ++ status = MEDIABUFS_ERROR_OPERATION_FAILED; ++ } ++ ++ mbc->stream_on = false; ++ return status; ++} ++ ++int mediabufs_ctl_set_ext_ctrls(struct mediabufs_ctl * mbc, struct media_request * const mreq, struct v4l2_ext_control control_array[], unsigned int n) ++{ ++ struct v4l2_ext_controls controls = { ++ .controls = control_array, ++ .count = n ++ }; ++ ++ if (mreq) { ++ controls.which = V4L2_CTRL_WHICH_REQUEST_VAL; ++ controls.request_fd = media_request_fd(mreq); ++ } ++ ++ while (ioctl(mbc->vfd, VIDIOC_S_EXT_CTRLS, &controls)) ++ { ++ const int err = errno; ++ if (err != EINTR) { ++ request_err(mbc->dc, "Unable to set controls: %s\n", strerror(err)); ++ return -err; ++ } ++ } ++ ++ return 0; ++} ++ ++MediaBufsStatus mediabufs_set_ext_ctrl(struct mediabufs_ctl *const mbc, ++ struct media_request * const mreq, ++ unsigned int id, void *data, ++ unsigned int size) ++{ ++ struct v4l2_ext_control control = { ++ .id = id, ++ .ptr = data, ++ .size = size ++ }; ++ ++ int rv = mediabufs_ctl_set_ext_ctrls(mbc, mreq, &control, 1); ++ return !rv ? MEDIABUFS_STATUS_SUCCESS : MEDIABUFS_ERROR_OPERATION_FAILED; ++} ++ ++MediaBufsStatus mediabufs_src_fmt_set(struct mediabufs_ctl *const mbc, ++ enum v4l2_buf_type buf_type, ++ const uint32_t pixfmt, ++ const uint32_t width, const uint32_t height, ++ const size_t bufsize) ++{ ++ MediaBufsStatus rv = fmt_set(&mbc->src_fmt, mbc->vfd, buf_type, pixfmt, width, height, bufsize); ++ if (rv != MEDIABUFS_STATUS_SUCCESS) ++ request_err(mbc->dc, "Failed to set src buftype %d, format %#x %dx%d\n", buf_type, pixfmt, width, height); ++ ++ return rv; ++} ++ ++int mediabufs_ctl_query_ext_ctrls(struct mediabufs_ctl * mbc, struct v4l2_query_ext_ctrl ctrls[], unsigned int n) ++{ ++ int rv = 0; ++ while (n--) { ++ while (ioctl(mbc->vfd, VIDIOC_QUERY_EXT_CTRL, ctrls)) { ++ const int err = errno; ++ if (err != EINTR) { ++ // Often used for probing - errors are to be expected ++ request_debug(mbc->dc, "Failed to query ext id=%#x, err=%d\n", ctrls->id, err); ++ ctrls->type = 0; // 0 is invalid ++ rv = -err; ++ break; ++ } ++ } ++ ++ctrls; ++ } ++ return rv; ++} ++ ++int mediabufs_src_resizable(const struct mediabufs_ctl *const mbc) ++{ ++ // Single planar OUTPUT can only take exact size buffers ++ // Multiplanar will take larger than negotiated ++ return V4L2_TYPE_IS_MULTIPLANAR(mbc->src_fmt.type); ++} ++ ++static void mediabufs_ctl_delete(struct mediabufs_ctl *const mbc) ++{ ++ if (!mbc) ++ return; ++ ++ // Break the weak link first ++ ff_weak_link_break(&mbc->this_wlm); ++ ++ polltask_delete(&mbc->pt); ++ ++ mediabufs_stream_off(mbc); ++ ++ // Empty v4l2 buffer stash ++ request_buffers(mbc->vfd, mbc->src_fmt.type, V4L2_MEMORY_MMAP, 0); ++ request_buffers(mbc->vfd, mbc->dst_fmt.type, V4L2_MEMORY_MMAP, 0); ++ ++ bq_free_all_free_src(mbc->src); ++ bq_free_all_inuse_src(mbc->src); ++ bq_free_all_free_dst(mbc->dst); ++ ++ { ++ struct qent_dst *dst_be; ++ while ((dst_be = base_to_dst(bq_get_inuse(mbc->dst))) != NULL) { ++ dst_be->base.timestamp = (struct timeval){0}; ++ dst_be->base.status = QENT_ERROR; ++ qe_dst_done(dst_be); ++ } ++ } ++ ++ queue_delete(mbc->dst); ++ queue_delete(mbc->src); ++ close(mbc->vfd); ++ pthread_mutex_destroy(&mbc->lock); ++ ++ free(mbc); ++} ++ ++struct mediabufs_ctl * mediabufs_ctl_ref(struct mediabufs_ctl *const mbc) ++{ ++ atomic_fetch_add(&mbc->ref_count, 1); ++ return mbc; ++} ++ ++void mediabufs_ctl_unref(struct mediabufs_ctl **const pmbc) ++{ ++ struct mediabufs_ctl *const mbc = *pmbc; ++ int n; ++ ++ if (!mbc) ++ return; ++ *pmbc = NULL; ++ n = atomic_fetch_sub(&mbc->ref_count, 1); ++ if (n) ++ return; ++ mediabufs_ctl_delete(mbc); ++} ++ ++unsigned int mediabufs_ctl_driver_version(struct mediabufs_ctl *const mbc) ++{ ++ return mbc->capability.version; ++} ++ ++static int set_capabilities(struct mediabufs_ctl *const mbc) ++{ ++ uint32_t caps; ++ ++ if (ioctl(mbc->vfd, VIDIOC_QUERYCAP, &mbc->capability)) { ++ int err = errno; ++ request_err(mbc->dc, "Failed to get capabilities: %s\n", strerror(err)); ++ return -err; ++ } ++ ++ caps = (mbc->capability.capabilities & V4L2_CAP_DEVICE_CAPS) != 0 ? ++ mbc->capability.device_caps : ++ mbc->capability.capabilities; ++ ++ if ((caps & V4L2_CAP_VIDEO_M2M_MPLANE) != 0) { ++ mbc->src_fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; ++ mbc->dst_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ } ++ else if ((caps & V4L2_CAP_VIDEO_M2M) != 0) { ++ mbc->src_fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ++ mbc->dst_fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ } ++ else { ++ request_err(mbc->dc, "No M2M capabilities (%#x)\n", caps); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/* One of these per context */ ++struct mediabufs_ctl * mediabufs_ctl_new(void * const dc, const char * vpath, struct pollqueue *const pq) ++{ ++ struct mediabufs_ctl *const mbc = calloc(1, sizeof(*mbc)); ++ ++ if (!mbc) ++ return NULL; ++ ++ mbc->dc = dc; ++ // Default mono planar ++ mbc->pq = pq; ++ pthread_mutex_init(&mbc->lock, NULL); ++ ++ /* Pick a default - could we scan for this? */ ++ if (vpath == NULL) ++ vpath = "/dev/media0"; ++ ++ while ((mbc->vfd = open(vpath, O_RDWR)) == -1) ++ { ++ const int err = errno; ++ if (err != EINTR) { ++ request_err(dc, "Failed to open video dev '%s': %s\n", vpath, strerror(err)); ++ goto fail0; ++ } ++ } ++ ++ if (set_capabilities(mbc)) { ++ request_err(dc, "Bad capabilities for video dev '%s'\n", vpath); ++ goto fail1; ++ } ++ ++ mbc->src = queue_new(mbc->vfd); ++ if (!mbc->src) ++ goto fail1; ++ mbc->dst = queue_new(mbc->vfd); ++ if (!mbc->dst) ++ goto fail2; ++ mbc->pt = polltask_new(pq, mbc->vfd, POLLIN | POLLOUT, mediabufs_poll_cb, mbc); ++ if (!mbc->pt) ++ goto fail3; ++ mbc->this_wlm = ff_weak_link_new(mbc); ++ if (!mbc->this_wlm) ++ goto fail4; ++ ++ /* Cannot add polltask now - polling with nothing pending ++ * generates infinite error polls ++ */ ++ return mbc; ++ ++fail4: ++ polltask_delete(&mbc->pt); ++fail3: ++ queue_delete(mbc->dst); ++fail2: ++ queue_delete(mbc->src); ++fail1: ++ close(mbc->vfd); ++fail0: ++ free(mbc); ++ request_info(dc, "%s: FAILED\n", __func__); ++ return NULL; ++} ++ ++ ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_media.h +@@ -0,0 +1,154 @@ ++/* ++e.h ++* ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sub license, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial portions ++ * of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ++ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ++ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++#ifndef _MEDIA_H_ ++#define _MEDIA_H_ ++ ++#include ++#include ++ ++struct v4l2_format; ++struct v4l2_fmtdesc; ++struct v4l2_query_ext_ctrl; ++ ++struct pollqueue; ++struct media_request; ++struct media_pool; ++ ++typedef enum media_buf_status { ++ MEDIABUFS_STATUS_SUCCESS = 0, ++ MEDIABUFS_ERROR_OPERATION_FAILED, ++ MEDIABUFS_ERROR_DECODING_ERROR, ++ MEDIABUFS_ERROR_UNSUPPORTED_BUFFERTYPE, ++ MEDIABUFS_ERROR_UNSUPPORTED_RT_FORMAT, ++ MEDIABUFS_ERROR_ALLOCATION_FAILED, ++} MediaBufsStatus; ++ ++struct media_pool * media_pool_new(const char * const media_path, ++ struct pollqueue * const pq, ++ const unsigned int n); ++void media_pool_delete(struct media_pool ** pmp); ++ ++// Obtain a media request ++// Will block if none availible - has a 2sec timeout ++struct media_request * media_request_get(struct media_pool * const mp); ++int media_request_fd(const struct media_request * const req); ++ ++// Start this request ++// Request structure is returned to pool once done ++int media_request_start(struct media_request * const req); ++ ++// Return an *unstarted* media_request to the pool ++// May later be upgraded to allow for aborting a started req ++int media_request_abort(struct media_request ** const preq); ++ ++ ++struct mediabufs_ctl; ++struct qent_src; ++struct qent_dst; ++struct dmabuf_h; ++struct dmabufs_ctl; ++ ++int qent_src_params_set(struct qent_src *const be, const struct timeval * timestamp); ++struct timeval qent_dst_timestamp_get(const struct qent_dst *const be_dst); ++ ++// prealloc ++int qent_src_alloc(struct qent_src *const be_src, const size_t len, struct dmabufs_ctl * dbsc); ++// dbsc may be NULL if realloc not required ++int qent_src_data_copy(struct qent_src *const be_src, const size_t offset, const void *const src, const size_t len, struct dmabufs_ctl * dbsc); ++const struct dmabuf_h * qent_dst_dmabuf(const struct qent_dst *const be, unsigned int plane); ++int qent_dst_dup_fd(const struct qent_dst *const be, unsigned int plane); ++MediaBufsStatus qent_dst_wait(struct qent_dst *const be); ++void qent_dst_delete(struct qent_dst *const be); ++// Returns a qent_dst to its mbc free Q or deletes it if the mbc is dead ++void qent_dst_unref(struct qent_dst ** const pbe_dst); ++struct qent_dst * qent_dst_ref(struct qent_dst * const be_dst); ++ ++const uint8_t * qent_dst_data(struct qent_dst *const be, unsigned int buf_no); ++MediaBufsStatus qent_dst_read_start(struct qent_dst *const be); ++MediaBufsStatus qent_dst_read_stop(struct qent_dst *const be); ++/* Import an fd unattached to any mediabuf */ ++MediaBufsStatus qent_dst_import_fd(struct qent_dst *const be_dst, ++ unsigned int plane, ++ int fd, size_t size); ++ ++MediaBufsStatus mediabufs_start_request(struct mediabufs_ctl *const mbc, ++ struct media_request **const pmreq, ++ struct qent_src **const psrc_be, ++ struct qent_dst *const dst_be, ++ const bool is_final); ++// Get / alloc a dst buffer & associate with a slot ++// If the dst pool is empty then behaviour depends on the fixed flag passed to ++// dst_slots_create. Default is !fixed = unlimited alloc ++struct qent_dst* mediabufs_dst_qent_alloc(struct mediabufs_ctl *const mbc, ++ struct dmabufs_ctl *const dbsc); ++// Create dst slots without alloc ++// If fixed true then qent_alloc will only get slots from this pool and will ++// block until a qent has been unrefed ++MediaBufsStatus mediabufs_dst_slots_create(struct mediabufs_ctl *const mbc, const unsigned int n, const bool fixed); ++ ++MediaBufsStatus mediabufs_stream_on(struct mediabufs_ctl *const mbc); ++MediaBufsStatus mediabufs_stream_off(struct mediabufs_ctl *const mbc); ++const struct v4l2_format *mediabufs_dst_fmt(struct mediabufs_ctl *const mbc); ++ ++typedef int mediabufs_dst_fmt_accept_fn(void * v, const struct v4l2_fmtdesc *fmtdesc); ++ ++MediaBufsStatus mediabufs_dst_fmt_set(struct mediabufs_ctl *const mbc, ++ const unsigned int width, ++ const unsigned int height, ++ mediabufs_dst_fmt_accept_fn *const accept_fn, ++ void *const accept_v); ++struct qent_src *mediabufs_src_qent_get(struct mediabufs_ctl *const mbc); ++void mediabufs_src_qent_abort(struct mediabufs_ctl *const mbc, struct qent_src **const pqe_src); ++ ++int mediabufs_ctl_set_ext_ctrls(struct mediabufs_ctl * mbc, struct media_request * const mreq, ++ struct v4l2_ext_control control_array[], unsigned int n); ++MediaBufsStatus mediabufs_set_ext_ctrl(struct mediabufs_ctl *const mbc, ++ struct media_request * const mreq, ++ unsigned int id, void *data, ++ unsigned int size); ++int mediabufs_ctl_query_ext_ctrls(struct mediabufs_ctl * mbc, struct v4l2_query_ext_ctrl ctrls[], unsigned int n); ++ ++int mediabufs_src_resizable(const struct mediabufs_ctl *const mbc); ++ ++MediaBufsStatus mediabufs_src_fmt_set(struct mediabufs_ctl *const mbc, ++ enum v4l2_buf_type buf_type, ++ const uint32_t pixfmt, ++ const uint32_t width, const uint32_t height, ++ const size_t bufsize); ++ ++MediaBufsStatus mediabufs_src_pool_create(struct mediabufs_ctl *const rw, ++ struct dmabufs_ctl * const dbsc, ++ unsigned int n); ++ ++#define MEDIABUFS_DRIVER_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c)) ++unsigned int mediabufs_ctl_driver_version(struct mediabufs_ctl *const mbc); ++ ++struct mediabufs_ctl * mediabufs_ctl_new(void * const dc, ++ const char *vpath, struct pollqueue *const pq); ++void mediabufs_ctl_unref(struct mediabufs_ctl **const pmbc); ++struct mediabufs_ctl * mediabufs_ctl_ref(struct mediabufs_ctl *const mbc); ++ ++ ++#endif +--- /dev/null ++++ b/libavcodec/v4l2_req_pollqueue.c +@@ -0,0 +1,361 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "v4l2_req_pollqueue.h" ++#include "v4l2_req_utils.h" ++ ++ ++struct pollqueue; ++ ++enum polltask_state { ++ POLLTASK_UNQUEUED = 0, ++ POLLTASK_QUEUED, ++ POLLTASK_RUNNING, ++ POLLTASK_Q_KILL, ++ POLLTASK_RUN_KILL, ++}; ++ ++struct polltask { ++ struct polltask *next; ++ struct polltask *prev; ++ struct pollqueue *q; ++ enum polltask_state state; ++ ++ int fd; ++ short events; ++ ++ void (*fn)(void *v, short revents); ++ void * v; ++ ++ uint64_t timeout; /* CLOCK_MONOTONIC time, 0 => never */ ++ sem_t kill_sem; ++}; ++ ++struct pollqueue { ++ atomic_int ref_count; ++ pthread_mutex_t lock; ++ ++ struct polltask *head; ++ struct polltask *tail; ++ ++ bool kill; ++ bool no_prod; ++ int prod_fd; ++ struct polltask *prod_pt; ++ pthread_t worker; ++}; ++ ++struct polltask *polltask_new(struct pollqueue *const pq, ++ const int fd, const short events, ++ void (*const fn)(void *v, short revents), ++ void *const v) ++{ ++ struct polltask *pt; ++ ++ if (!events) ++ return NULL; ++ ++ pt = malloc(sizeof(*pt)); ++ if (!pt) ++ return NULL; ++ ++ *pt = (struct polltask){ ++ .next = NULL, ++ .prev = NULL, ++ .q = pollqueue_ref(pq), ++ .fd = fd, ++ .events = events, ++ .fn = fn, ++ .v = v ++ }; ++ ++ sem_init(&pt->kill_sem, 0, 0); ++ ++ return pt; ++} ++ ++static void pollqueue_rem_task(struct pollqueue *const pq, struct polltask *const pt) ++{ ++ if (pt->prev) ++ pt->prev->next = pt->next; ++ else ++ pq->head = pt->next; ++ if (pt->next) ++ pt->next->prev = pt->prev; ++ else ++ pq->tail = pt->prev; ++ pt->next = NULL; ++ pt->prev = NULL; ++} ++ ++static void polltask_free(struct polltask * const pt) ++{ ++ sem_destroy(&pt->kill_sem); ++ free(pt); ++} ++ ++static int pollqueue_prod(const struct pollqueue *const pq) ++{ ++ static const uint64_t one = 1; ++ return write(pq->prod_fd, &one, sizeof(one)); ++} ++ ++void polltask_delete(struct polltask **const ppt) ++{ ++ struct polltask *const pt = *ppt; ++ struct pollqueue * pq; ++ enum polltask_state state; ++ bool prodme; ++ ++ if (!pt) ++ return; ++ ++ pq = pt->q; ++ pthread_mutex_lock(&pq->lock); ++ state = pt->state; ++ pt->state = (state == POLLTASK_RUNNING) ? POLLTASK_RUN_KILL : POLLTASK_Q_KILL; ++ prodme = !pq->no_prod; ++ pthread_mutex_unlock(&pq->lock); ++ ++ if (state != POLLTASK_UNQUEUED) { ++ if (prodme) ++ pollqueue_prod(pq); ++ while (sem_wait(&pt->kill_sem) && errno == EINTR) ++ /* loop */; ++ } ++ ++ // Leave zapping the ref until we have DQed the PT as might well be ++ // legitimately used in it ++ *ppt = NULL; ++ polltask_free(pt); ++ pollqueue_unref(&pq); ++} ++ ++static uint64_t pollqueue_now(int timeout) ++{ ++ struct timespec now; ++ uint64_t now_ms; ++ ++ if (clock_gettime(CLOCK_MONOTONIC, &now)) ++ return 0; ++ now_ms = (now.tv_nsec / 1000000) + (uint64_t)now.tv_sec * 1000 + timeout; ++ return now_ms ? now_ms : (uint64_t)1; ++} ++ ++void pollqueue_add_task(struct polltask *const pt, const int timeout) ++{ ++ bool prodme = false; ++ struct pollqueue * const pq = pt->q; ++ ++ pthread_mutex_lock(&pq->lock); ++ if (pt->state != POLLTASK_Q_KILL && pt->state != POLLTASK_RUN_KILL) { ++ if (pq->tail) ++ pq->tail->next = pt; ++ else ++ pq->head = pt; ++ pt->prev = pq->tail; ++ pt->next = NULL; ++ pt->state = POLLTASK_QUEUED; ++ pt->timeout = timeout < 0 ? 0 : pollqueue_now(timeout); ++ pq->tail = pt; ++ prodme = !pq->no_prod; ++ } ++ pthread_mutex_unlock(&pq->lock); ++ if (prodme) ++ pollqueue_prod(pq); ++} ++ ++static void *poll_thread(void *v) ++{ ++ struct pollqueue *const pq = v; ++ struct pollfd *a = NULL; ++ size_t asize = 0; ++ ++ pthread_mutex_lock(&pq->lock); ++ do { ++ unsigned int i; ++ unsigned int n = 0; ++ struct polltask *pt; ++ struct polltask *pt_next; ++ uint64_t now = pollqueue_now(0); ++ int timeout = -1; ++ int rv; ++ ++ for (pt = pq->head; pt; pt = pt_next) { ++ int64_t t; ++ ++ pt_next = pt->next; ++ ++ if (pt->state == POLLTASK_Q_KILL) { ++ pollqueue_rem_task(pq, pt); ++ sem_post(&pt->kill_sem); ++ continue; ++ } ++ ++ if (n >= asize) { ++ asize = asize ? asize * 2 : 4; ++ a = realloc(a, asize * sizeof(*a)); ++ if (!a) { ++ request_log("Failed to realloc poll array to %zd\n", asize); ++ goto fail_locked; ++ } ++ } ++ ++ a[n++] = (struct pollfd){ ++ .fd = pt->fd, ++ .events = pt->events ++ }; ++ ++ t = (int64_t)(pt->timeout - now); ++ if (pt->timeout && t < INT_MAX && ++ (timeout < 0 || (int)t < timeout)) ++ timeout = (t < 0) ? 0 : (int)t; ++ } ++ pthread_mutex_unlock(&pq->lock); ++ ++ if ((rv = poll(a, n, timeout)) == -1) { ++ if (errno != EINTR) { ++ request_log("Poll error: %s\n", strerror(errno)); ++ goto fail_unlocked; ++ } ++ } ++ ++ pthread_mutex_lock(&pq->lock); ++ now = pollqueue_now(0); ++ ++ /* Prodding in this loop is pointless and might lead to ++ * infinite looping ++ */ ++ pq->no_prod = true; ++ for (i = 0, pt = pq->head; i < n; ++i, pt = pt_next) { ++ pt_next = pt->next; ++ ++ /* Pending? */ ++ if (a[i].revents || ++ (pt->timeout && (int64_t)(now - pt->timeout) >= 0)) { ++ pollqueue_rem_task(pq, pt); ++ if (pt->state == POLLTASK_QUEUED) ++ pt->state = POLLTASK_RUNNING; ++ if (pt->state == POLLTASK_Q_KILL) ++ pt->state = POLLTASK_RUN_KILL; ++ pthread_mutex_unlock(&pq->lock); ++ ++ /* This can add new entries to the Q but as ++ * those are added to the tail our existing ++ * chain remains intact ++ */ ++ pt->fn(pt->v, a[i].revents); ++ ++ pthread_mutex_lock(&pq->lock); ++ if (pt->state == POLLTASK_RUNNING) ++ pt->state = POLLTASK_UNQUEUED; ++ if (pt->state == POLLTASK_RUN_KILL) ++ sem_post(&pt->kill_sem); ++ } ++ } ++ pq->no_prod = false; ++ ++ } while (!pq->kill); ++ ++fail_locked: ++ pthread_mutex_unlock(&pq->lock); ++fail_unlocked: ++ free(a); ++ return NULL; ++} ++ ++static void prod_fn(void *v, short revents) ++{ ++ struct pollqueue *const pq = v; ++ char buf[8]; ++ if (revents) ++ read(pq->prod_fd, buf, 8); ++ if (!pq->kill) ++ pollqueue_add_task(pq->prod_pt, -1); ++} ++ ++struct pollqueue * pollqueue_new(void) ++{ ++ struct pollqueue *pq = malloc(sizeof(*pq)); ++ if (!pq) ++ return NULL; ++ *pq = (struct pollqueue){ ++ .ref_count = ATOMIC_VAR_INIT(0), ++ .lock = PTHREAD_MUTEX_INITIALIZER, ++ .head = NULL, ++ .tail = NULL, ++ .kill = false, ++ .prod_fd = -1 ++ }; ++ ++ pq->prod_fd = eventfd(0, EFD_NONBLOCK); ++ if (pq->prod_fd == 1) ++ goto fail1; ++ pq->prod_pt = polltask_new(pq, pq->prod_fd, POLLIN, prod_fn, pq); ++ if (!pq->prod_pt) ++ goto fail2; ++ pollqueue_add_task(pq->prod_pt, -1); ++ if (pthread_create(&pq->worker, NULL, poll_thread, pq)) ++ goto fail3; ++ // Reset ref count which will have been inced by the add_task ++ atomic_store(&pq->ref_count, 0); ++ return pq; ++ ++fail3: ++ polltask_free(pq->prod_pt); ++fail2: ++ close(pq->prod_fd); ++fail1: ++ free(pq); ++ return NULL; ++} ++ ++static void pollqueue_free(struct pollqueue *const pq) ++{ ++ void *rv; ++ ++ pthread_mutex_lock(&pq->lock); ++ pq->kill = true; ++ pollqueue_prod(pq); ++ pthread_mutex_unlock(&pq->lock); ++ ++ pthread_join(pq->worker, &rv); ++ polltask_free(pq->prod_pt); ++ pthread_mutex_destroy(&pq->lock); ++ close(pq->prod_fd); ++ free(pq); ++} ++ ++struct pollqueue * pollqueue_ref(struct pollqueue *const pq) ++{ ++ atomic_fetch_add(&pq->ref_count, 1); ++ return pq; ++} ++ ++void pollqueue_unref(struct pollqueue **const ppq) ++{ ++ struct pollqueue * const pq = *ppq; ++ ++ if (!pq) ++ return; ++ *ppq = NULL; ++ ++ if (atomic_fetch_sub(&pq->ref_count, 1) != 0) ++ return; ++ ++ pollqueue_free(pq); ++} ++ ++ ++ +--- /dev/null ++++ b/libavcodec/v4l2_req_pollqueue.h +@@ -0,0 +1,18 @@ ++#ifndef POLLQUEUE_H_ ++#define POLLQUEUE_H_ ++ ++struct polltask; ++struct pollqueue; ++ ++struct polltask *polltask_new(struct pollqueue *const pq, ++ const int fd, const short events, ++ void (*const fn)(void *v, short revents), ++ void *const v); ++void polltask_delete(struct polltask **const ppt); ++ ++void pollqueue_add_task(struct polltask *const pt, const int timeout); ++struct pollqueue * pollqueue_new(void); ++void pollqueue_unref(struct pollqueue **const ppq); ++struct pollqueue * pollqueue_ref(struct pollqueue *const pq); ++ ++#endif /* POLLQUEUE_H_ */ +--- /dev/null ++++ b/libavcodec/v4l2_req_utils.h +@@ -0,0 +1,22 @@ ++#include "libavutil/log.h" ++ ++#define request_log(...) av_log(NULL, AV_LOG_INFO, __VA_ARGS__) ++ ++#define request_err(_ctx, ...) av_log(_ctx, AV_LOG_ERROR, __VA_ARGS__) ++#define request_warn(_ctx, ...) av_log(_ctx, AV_LOG_WARNING, __VA_ARGS__) ++#define request_info(_ctx, ...) av_log(_ctx, AV_LOG_INFO, __VA_ARGS__) ++#define request_debug(_ctx, ...) av_log(_ctx, AV_LOG_DEBUG, __VA_ARGS__) ++ ++static inline char safechar(char c) { ++ return c > 0x20 && c < 0x7f ? c : '.'; ++} ++ ++static inline const char * strfourcc(char tbuf[5], uint32_t fcc) { ++ tbuf[0] = safechar((fcc >> 0) & 0xff); ++ tbuf[1] = safechar((fcc >> 8) & 0xff); ++ tbuf[2] = safechar((fcc >> 16) & 0xff); ++ tbuf[3] = safechar((fcc >> 24) & 0xff); ++ tbuf[4] = '\0'; ++ return tbuf; ++} ++ +--- /dev/null ++++ b/libavcodec/v4l2_request_hevc.c +@@ -0,0 +1,315 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++ ++ ++#include "decode.h" ++#include "hevcdec.h" ++#include "hwconfig.h" ++ ++#include "v4l2_request_hevc.h" ++ ++#include "libavutil/hwcontext_drm.h" ++ ++#include "v4l2_req_devscan.h" ++#include "v4l2_req_dmabufs.h" ++#include "v4l2_req_pollqueue.h" ++#include "v4l2_req_media.h" ++#include "v4l2_req_utils.h" ++ ++static size_t bit_buf_size(unsigned int w, unsigned int h, unsigned int bits_minus8) ++{ ++ const size_t wxh = w * h; ++ size_t bits_alloc; ++ ++ /* Annex A gives a min compression of 2 @ lvl 3.1 ++ * (wxh <= 983040) and min 4 thereafter but avoid ++ * the odity of 983041 having a lower limit than ++ * 983040. ++ * Multiply by 3/2 for 4:2:0 ++ */ ++ bits_alloc = wxh < 983040 ? wxh * 3 / 4 : ++ wxh < 983040 * 2 ? 983040 * 3 / 4 : ++ wxh * 3 / 8; ++ /* Allow for bit depth */ ++ bits_alloc += (bits_alloc * bits_minus8) / 8; ++ /* Add a few bytes (16k) for overhead */ ++ bits_alloc += 0x4000; ++ return bits_alloc; ++} ++ ++static int v4l2_req_hevc_start_frame(AVCodecContext *avctx, ++ av_unused const uint8_t *buffer, ++ av_unused uint32_t size) ++{ ++ const V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ return ctx->fns->start_frame(avctx, buffer, size); ++} ++ ++static int v4l2_req_hevc_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) ++{ ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ return ctx->fns->decode_slice(avctx, buffer, size); ++} ++ ++static int v4l2_req_hevc_end_frame(AVCodecContext *avctx) ++{ ++ V4L2RequestContextHEVC *ctx = avctx->internal->hwaccel_priv_data; ++ return ctx->fns->end_frame(avctx); ++} ++ ++static void v4l2_req_hevc_abort_frame(AVCodecContext * const avctx) ++{ ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ ctx->fns->abort_frame(avctx); ++} ++ ++static int v4l2_req_hevc_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx) ++{ ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ return ctx->fns->frame_params(avctx, hw_frames_ctx); ++} ++ ++static int v4l2_req_hevc_alloc_frame(AVCodecContext * avctx, AVFrame *frame) ++{ ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ return ctx->fns->alloc_frame(avctx, frame); ++} ++ ++ ++static int v4l2_request_hevc_uninit(AVCodecContext *avctx) ++{ ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ ++ av_log(avctx, AV_LOG_DEBUG, "<<< %s\n", __func__); ++ ++ decode_q_wait(&ctx->decode_q, NULL); // Wait for all other threads to be out of decode ++ ++ mediabufs_ctl_unref(&ctx->mbufs); ++ media_pool_delete(&ctx->mpool); ++ pollqueue_unref(&ctx->pq); ++ dmabufs_ctl_delete(&ctx->dbufs); ++ devscan_delete(&ctx->devscan); ++ ++ decode_q_uninit(&ctx->decode_q); ++ ++// if (avctx->hw_frames_ctx) { ++// AVHWFramesContext *hwfc = (AVHWFramesContext*)avctx->hw_frames_ctx->data; ++// av_buffer_pool_flush(hwfc->pool); ++// } ++ return 0; ++} ++ ++static int dst_fmt_accept_cb(void * v, const struct v4l2_fmtdesc *fmtdesc) ++{ ++ AVCodecContext *const avctx = v; ++ const HEVCContext *const h = avctx->priv_data; ++ ++ if (h->ps.sps->bit_depth == 8) { ++ if (fmtdesc->pixelformat == V4L2_PIX_FMT_NV12_COL128 || ++ fmtdesc->pixelformat == V4L2_PIX_FMT_NV12) { ++ return 1; ++ } ++ } ++ else if (h->ps.sps->bit_depth == 10) { ++ if (fmtdesc->pixelformat == V4L2_PIX_FMT_NV12_10_COL128) { ++ return 1; ++ } ++ } ++ return 0; ++} ++ ++static int v4l2_request_hevc_init(AVCodecContext *avctx) ++{ ++ const HEVCContext *h = avctx->priv_data; ++ V4L2RequestContextHEVC * const ctx = avctx->internal->hwaccel_priv_data; ++ const HEVCSPS * const sps = h->ps.sps; ++ int ret; ++ const struct decdev * decdev; ++ const uint32_t src_pix_fmt = V2(ff_v4l2_req_hevc, 1).src_pix_fmt_v4l2; // Assuming constant for all APIs but avoiding V4L2 includes ++ size_t src_size; ++ ++ av_log(avctx, AV_LOG_DEBUG, "<<< %s\n", __func__); ++ ++ // Give up immediately if this is something that we have no code to deal with ++ if (h->ps.sps->chroma_format_idc != 1) { ++ av_log(avctx, AV_LOG_WARNING, "chroma_format_idc(%d) != 1: Not implemented\n", h->ps.sps->chroma_format_idc); ++ return AVERROR_PATCHWELCOME; ++ } ++ if (!(h->ps.sps->bit_depth == 10 || h->ps.sps->bit_depth == 8) || ++ h->ps.sps->bit_depth != h->ps.sps->bit_depth_chroma) { ++ av_log(avctx, AV_LOG_WARNING, "Bit depth Y:%d C:%d: Not implemented\n", h->ps.sps->bit_depth, h->ps.sps->bit_depth_chroma); ++ return AVERROR_PATCHWELCOME; ++ } ++ ++ if ((ret = devscan_build(avctx, &ctx->devscan)) != 0) { ++ av_log(avctx, AV_LOG_WARNING, "Failed to find any V4L2 devices\n"); ++ return (AVERROR(-ret)); ++ } ++ ret = AVERROR(ENOMEM); // Assume mem fail by default for these ++ ++ if ((decdev = devscan_find(ctx->devscan, src_pix_fmt)) == NULL) ++ { ++ av_log(avctx, AV_LOG_WARNING, "Failed to find a V4L2 device for H265\n"); ++ ret = AVERROR(ENODEV); ++ goto fail0; ++ } ++ av_log(avctx, AV_LOG_DEBUG, "Trying V4L2 devices: %s,%s\n", ++ decdev_media_path(decdev), decdev_video_path(decdev)); ++ ++ if ((ctx->dbufs = dmabufs_ctl_new()) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to open dmabufs\n"); ++ goto fail0; ++ } ++ ++ if ((ctx->pq = pollqueue_new()) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to create pollqueue\n"); ++ goto fail1; ++ } ++ ++ if ((ctx->mpool = media_pool_new(decdev_media_path(decdev), ctx->pq, 4)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to create media pool\n"); ++ goto fail2; ++ } ++ ++ if ((ctx->mbufs = mediabufs_ctl_new(avctx, decdev_video_path(decdev), ctx->pq)) == NULL) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to create media controls\n"); ++ goto fail3; ++ } ++ ++ // Ask for an initial bitbuf size of max size / 4 ++ // We will realloc if we need more ++ // Must use sps->h/w as avctx contains cropped size ++ src_size = bit_buf_size(sps->width, sps->height, sps->bit_depth - 8); ++ if (mediabufs_src_resizable(ctx->mbufs)) ++ src_size /= 4; ++ // Kludge for conformance tests which break Annex A limits ++ else if (src_size < 0x40000) ++ src_size = 0x40000; ++ ++ if (mediabufs_src_fmt_set(ctx->mbufs, decdev_src_type(decdev), src_pix_fmt, ++ sps->width, sps->height, src_size)) { ++ char tbuf1[5]; ++ av_log(avctx, AV_LOG_ERROR, "Failed to set source format: %s %dx%d\n", strfourcc(tbuf1, src_pix_fmt), sps->width, sps->height); ++ goto fail4; ++ } ++ ++ if (V2(ff_v4l2_req_hevc, 4).probe(avctx, ctx) == 0) { ++ av_log(avctx, AV_LOG_DEBUG, "HEVC API version 4 probed successfully\n"); ++ ctx->fns = &V2(ff_v4l2_req_hevc, 4); ++ } ++ else if (V2(ff_v4l2_req_hevc, 3).probe(avctx, ctx) == 0) { ++ av_log(avctx, AV_LOG_DEBUG, "HEVC API version 3 probed successfully\n"); ++ ctx->fns = &V2(ff_v4l2_req_hevc, 3); ++ } ++ else if (V2(ff_v4l2_req_hevc, 2).probe(avctx, ctx) == 0) { ++ av_log(avctx, AV_LOG_DEBUG, "HEVC API version 2 probed successfully\n"); ++ ctx->fns = &V2(ff_v4l2_req_hevc, 2); ++ } ++ else if (V2(ff_v4l2_req_hevc, 1).probe(avctx, ctx) == 0) { ++ av_log(avctx, AV_LOG_DEBUG, "HEVC API version 1 probed successfully\n"); ++ ctx->fns = &V2(ff_v4l2_req_hevc, 1); ++ } ++ else { ++ av_log(avctx, AV_LOG_ERROR, "No HEVC version probed successfully\n"); ++ ret = AVERROR(EINVAL); ++ goto fail4; ++ } ++ ++ if (mediabufs_dst_fmt_set(ctx->mbufs, sps->width, sps->height, dst_fmt_accept_cb, avctx)) { ++ char tbuf1[5]; ++ av_log(avctx, AV_LOG_ERROR, "Failed to set destination format: %s %dx%d\n", strfourcc(tbuf1, src_pix_fmt), sps->width, sps->height); ++ goto fail4; ++ } ++ ++ if (mediabufs_src_pool_create(ctx->mbufs, ctx->dbufs, 6)) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to create source pool\n"); ++ goto fail4; ++ } ++ ++ { ++ unsigned int dst_slots = sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering + ++ avctx->thread_count + (avctx->extra_hw_frames > 0 ? avctx->extra_hw_frames : 6); ++ av_log(avctx, AV_LOG_DEBUG, "Slots=%d: Reordering=%d, threads=%d, hw+=%d\n", dst_slots, ++ sps->temporal_layer[sps->max_sub_layers - 1].max_dec_pic_buffering, ++ avctx->thread_count, avctx->extra_hw_frames); ++ ++ // extra_hw_frames is -1 if unset ++ if (mediabufs_dst_slots_create(ctx->mbufs, dst_slots, (avctx->extra_hw_frames > 0))) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to create destination slots\n"); ++ goto fail4; ++ } ++ } ++ ++ if (mediabufs_stream_on(ctx->mbufs)) { ++ av_log(avctx, AV_LOG_ERROR, "Failed stream on\n"); ++ goto fail4; ++ } ++ ++ if ((ret = ff_decode_get_hw_frames_ctx(avctx, AV_HWDEVICE_TYPE_DRM)) != 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to create frame ctx\n"); ++ goto fail4; ++ } ++ ++ if ((ret = ctx->fns->set_controls(avctx, ctx)) != 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed set controls\n"); ++ goto fail5; ++ } ++ ++ decode_q_init(&ctx->decode_q); ++ ++ // Set our s/w format ++ avctx->sw_pix_fmt = ((AVHWFramesContext *)avctx->hw_frames_ctx->data)->sw_format; ++ ++ av_log(avctx, AV_LOG_INFO, "Hwaccel %s; devices: %s,%s\n", ++ ctx->fns->name, ++ decdev_media_path(decdev), decdev_video_path(decdev)); ++ ++ return 0; ++ ++fail5: ++ av_buffer_unref(&avctx->hw_frames_ctx); ++fail4: ++ mediabufs_ctl_unref(&ctx->mbufs); ++fail3: ++ media_pool_delete(&ctx->mpool); ++fail2: ++ pollqueue_unref(&ctx->pq); ++fail1: ++ dmabufs_ctl_delete(&ctx->dbufs); ++fail0: ++ devscan_delete(&ctx->devscan); ++ return ret; ++} ++ ++const AVHWAccel ff_hevc_v4l2request_hwaccel = { ++ .name = "hevc_v4l2request", ++ .type = AVMEDIA_TYPE_VIDEO, ++ .id = AV_CODEC_ID_HEVC, ++ .pix_fmt = AV_PIX_FMT_DRM_PRIME, ++ .alloc_frame = v4l2_req_hevc_alloc_frame, ++ .start_frame = v4l2_req_hevc_start_frame, ++ .decode_slice = v4l2_req_hevc_decode_slice, ++ .end_frame = v4l2_req_hevc_end_frame, ++ .abort_frame = v4l2_req_hevc_abort_frame, ++ .init = v4l2_request_hevc_init, ++ .uninit = v4l2_request_hevc_uninit, ++ .priv_data_size = sizeof(V4L2RequestContextHEVC), ++ .frame_params = v4l2_req_hevc_frame_params, ++ .caps_internal = HWACCEL_CAP_ASYNC_SAFE | HWACCEL_CAP_MT_SAFE, ++}; +--- /dev/null ++++ b/libavcodec/v4l2_request_hevc.h +@@ -0,0 +1,101 @@ ++#ifndef AVCODEC_V4L2_REQUEST_HEVC_H ++#define AVCODEC_V4L2_REQUEST_HEVC_H ++ ++#include ++#include "v4l2_req_decode_q.h" ++ ++#ifndef DRM_FORMAT_NV15 ++#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') ++#endif ++ ++#ifndef DRM_FORMAT_NV20 ++#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') ++#endif ++ ++// P030 should be defined in drm_fourcc.h and hopefully will be sometime ++// in the future but until then... ++#ifndef DRM_FORMAT_P030 ++#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') ++#endif ++ ++#ifndef DRM_FORMAT_NV15 ++#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') ++#endif ++ ++#ifndef DRM_FORMAT_NV20 ++#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') ++#endif ++ ++#include ++#ifndef V4L2_CID_CODEC_BASE ++#define V4L2_CID_CODEC_BASE V4L2_CID_MPEG_BASE ++#endif ++ ++// V4L2_PIX_FMT_NV12_10_COL128 and V4L2_PIX_FMT_NV12_COL128 should be defined ++// in drm_fourcc.h hopefully will be sometime in the future but until then... ++#ifndef V4L2_PIX_FMT_NV12_10_COL128 ++#define V4L2_PIX_FMT_NV12_10_COL128 v4l2_fourcc('N', 'C', '3', '0') ++#endif ++ ++#ifndef V4L2_PIX_FMT_NV12_COL128 ++#define V4L2_PIX_FMT_NV12_COL128 v4l2_fourcc('N', 'C', '1', '2') /* 12 Y/CbCr 4:2:0 128 pixel wide column */ ++#endif ++ ++#ifndef V4L2_CTRL_FLAG_DYNAMIC_ARRAY ++#define V4L2_CTRL_FLAG_DYNAMIC_ARRAY 0x0800 ++#endif ++ ++#define VCAT(name, version) name##_v##version ++#define V2(n,v) VCAT(n, v) ++#define V(n) V2(n, HEVC_CTRLS_VERSION) ++ ++#define S2(x) #x ++#define STR(x) S2(x) ++ ++// 1 per decoder ++struct v4l2_req_decode_fns; ++ ++typedef struct V4L2RequestContextHEVC { ++// V4L2RequestContext base; ++ const struct v4l2_req_decode_fns * fns; ++ ++ unsigned int timestamp; // ?? maybe uint64_t ++ ++ int decode_mode; ++ int start_code; ++ unsigned int max_slices; // 0 => not wanted (frame mode) ++ unsigned int max_offsets; // 0 => not wanted ++ ++ req_decode_q decode_q; ++ ++ struct devscan *devscan; ++ struct dmabufs_ctl *dbufs; ++ struct pollqueue *pq; ++ struct media_pool * mpool; ++ struct mediabufs_ctl *mbufs; ++} V4L2RequestContextHEVC; ++ ++typedef struct v4l2_req_decode_fns { ++ int src_pix_fmt_v4l2; ++ const char * name; ++ ++ // Init setup ++ int (*probe)(AVCodecContext * const avctx, V4L2RequestContextHEVC * const ctx); ++ int (*set_controls)(AVCodecContext * const avctx, V4L2RequestContextHEVC * const ctx); ++ ++ // Passthrough of hwaccel fns ++ int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); ++ int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); ++ int (*end_frame)(AVCodecContext *avctx); ++ void (*abort_frame)(AVCodecContext *avctx); ++ int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx); ++ int (*alloc_frame)(AVCodecContext * avctx, AVFrame *frame); ++} v4l2_req_decode_fns; ++ ++ ++extern const v4l2_req_decode_fns V2(ff_v4l2_req_hevc, 1); ++extern const v4l2_req_decode_fns V2(ff_v4l2_req_hevc, 2); ++extern const v4l2_req_decode_fns V2(ff_v4l2_req_hevc, 3); ++extern const v4l2_req_decode_fns V2(ff_v4l2_req_hevc, 4); ++ ++#endif +--- a/libavcodec/vc1dec.c ++++ b/libavcodec/vc1dec.c +@@ -486,7 +486,7 @@ static av_cold int vc1_decode_init(AVCod + size = next - start - 4; + if (size <= 0) + continue; +- buf2_size = vc1_unescape_buffer(start + 4, size, buf2); ++ buf2_size = v->vc1dsp.vc1_unescape_buffer(start + 4, size, buf2); + init_get_bits(&gb, buf2, buf2_size * 8); + switch (AV_RB32(start)) { + case VC1_CODE_SEQHDR: +@@ -689,7 +689,7 @@ static int vc1_decode_frame(AVCodecConte + case VC1_CODE_FRAME: + if (avctx->hwaccel) + buf_start = start; +- buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); ++ buf_size2 = v->vc1dsp.vc1_unescape_buffer(start + 4, size, buf2); + break; + case VC1_CODE_FIELD: { + int buf_size3; +@@ -706,8 +706,8 @@ static int vc1_decode_frame(AVCodecConte + ret = AVERROR(ENOMEM); + goto err; + } +- buf_size3 = vc1_unescape_buffer(start + 4, size, +- slices[n_slices].buf); ++ buf_size3 = v->vc1dsp.vc1_unescape_buffer(start + 4, size, ++ slices[n_slices].buf); + init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, + buf_size3 << 3); + slices[n_slices].mby_start = avctx->coded_height + 31 >> 5; +@@ -718,7 +718,7 @@ static int vc1_decode_frame(AVCodecConte + break; + } + case VC1_CODE_ENTRYPOINT: /* it should be before frame data */ +- buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); ++ buf_size2 = v->vc1dsp.vc1_unescape_buffer(start + 4, size, buf2); + init_get_bits(&s->gb, buf2, buf_size2 * 8); + ff_vc1_decode_entry_point(avctx, v, &s->gb); + break; +@@ -735,8 +735,8 @@ static int vc1_decode_frame(AVCodecConte + ret = AVERROR(ENOMEM); + goto err; + } +- buf_size3 = vc1_unescape_buffer(start + 4, size, +- slices[n_slices].buf); ++ buf_size3 = v->vc1dsp.vc1_unescape_buffer(start + 4, size, ++ slices[n_slices].buf); + init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, + buf_size3 << 3); + slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9); +@@ -770,7 +770,7 @@ static int vc1_decode_frame(AVCodecConte + ret = AVERROR(ENOMEM); + goto err; + } +- buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf); ++ buf_size3 = v->vc1dsp.vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf); + init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, + buf_size3 << 3); + slices[n_slices].mby_start = s->mb_height + 1 >> 1; +@@ -779,9 +779,9 @@ static int vc1_decode_frame(AVCodecConte + n_slices1 = n_slices - 1; + n_slices++; + } +- buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); ++ buf_size2 = v->vc1dsp.vc1_unescape_buffer(buf, divider - buf, buf2); + } else { +- buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); ++ buf_size2 = v->vc1dsp.vc1_unescape_buffer(buf, buf_size, buf2); + } + init_get_bits(&s->gb, buf2, buf_size2*8); + } else +--- a/libavcodec/vc1dsp.c ++++ b/libavcodec/vc1dsp.c +@@ -32,6 +32,7 @@ + #include "rnd_avg.h" + #include "vc1dsp.h" + #include "startcode.h" ++#include "vc1_common.h" + + /* Apply overlap transform to horizontal edge */ + static void vc1_v_overlap_c(uint8_t *src, int stride) +@@ -1028,6 +1029,7 @@ av_cold void ff_vc1dsp_init(VC1DSPContex + #endif /* CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER */ + + dsp->startcode_find_candidate = ff_startcode_find_candidate_c; ++ dsp->vc1_unescape_buffer = vc1_unescape_buffer; + + if (ARCH_AARCH64) + ff_vc1dsp_init_aarch64(dsp); +--- a/libavcodec/vc1dsp.h ++++ b/libavcodec/vc1dsp.h +@@ -80,6 +80,9 @@ typedef struct VC1DSPContext { + * one or more further zero bytes and a one byte. + */ + int (*startcode_find_candidate)(const uint8_t *buf, int size); ++ ++ /* Copy a buffer, removing startcode emulation escape bytes as we go */ ++ int (*vc1_unescape_buffer)(const uint8_t *src, int size, uint8_t *dst); + } VC1DSPContext; + + void ff_vc1dsp_init(VC1DSPContext* c); +--- /dev/null ++++ b/libavcodec/weak_link.c +@@ -0,0 +1,102 @@ ++#include ++#include ++#include ++#include "weak_link.h" ++ ++struct ff_weak_link_master { ++ atomic_int ref_count; /* 0 is single ref for easier atomics */ ++ pthread_rwlock_t lock; ++ void * ptr; ++}; ++ ++static inline struct ff_weak_link_master * weak_link_x(struct ff_weak_link_client * c) ++{ ++ return (struct ff_weak_link_master *)c; ++} ++ ++struct ff_weak_link_master * ff_weak_link_new(void * p) ++{ ++ struct ff_weak_link_master * w = malloc(sizeof(*w)); ++ if (!w) ++ return NULL; ++ w->ptr = p; ++ if (pthread_rwlock_init(&w->lock, NULL)) { ++ free(w); ++ return NULL; ++ } ++ return w; ++} ++ ++static void weak_link_do_unref(struct ff_weak_link_master * const w) ++{ ++ int n = atomic_fetch_sub(&w->ref_count, 1); ++ if (n) ++ return; ++ ++ pthread_rwlock_destroy(&w->lock); ++ free(w); ++} ++ ++// Unref & break link ++void ff_weak_link_break(struct ff_weak_link_master ** ppLink) ++{ ++ struct ff_weak_link_master * const w = *ppLink; ++ if (!w) ++ return; ++ ++ *ppLink = NULL; ++ pthread_rwlock_wrlock(&w->lock); ++ w->ptr = NULL; ++ pthread_rwlock_unlock(&w->lock); ++ ++ weak_link_do_unref(w); ++} ++ ++struct ff_weak_link_client* ff_weak_link_ref(struct ff_weak_link_master * w) ++{ ++ if (!w) ++ return NULL; ++ atomic_fetch_add(&w->ref_count, 1); ++ return (struct ff_weak_link_client*)w; ++} ++ ++void ff_weak_link_unref(struct ff_weak_link_client ** ppLink) ++{ ++ struct ff_weak_link_master * const w = weak_link_x(*ppLink); ++ if (!w) ++ return; ++ ++ *ppLink = NULL; ++ weak_link_do_unref(w); ++} ++ ++void * ff_weak_link_lock(struct ff_weak_link_client ** ppLink) ++{ ++ struct ff_weak_link_master * const w = weak_link_x(*ppLink); ++ ++ if (!w) ++ return NULL; ++ ++ if (pthread_rwlock_rdlock(&w->lock)) ++ goto broken; ++ ++ if (w->ptr) ++ return w->ptr; ++ ++ pthread_rwlock_unlock(&w->lock); ++ ++broken: ++ *ppLink = NULL; ++ weak_link_do_unref(w); ++ return NULL; ++} ++ ++// Ignores a NULL c (so can be on the return path of both broken & live links) ++void ff_weak_link_unlock(struct ff_weak_link_client * c) ++{ ++ struct ff_weak_link_master * const w = weak_link_x(c); ++ if (w) ++ pthread_rwlock_unlock(&w->lock); ++} ++ ++ +--- /dev/null ++++ b/libavcodec/weak_link.h +@@ -0,0 +1,23 @@ ++struct ff_weak_link_master; ++struct ff_weak_link_client; ++ ++struct ff_weak_link_master * ff_weak_link_new(void * p); ++void ff_weak_link_break(struct ff_weak_link_master ** ppLink); ++ ++struct ff_weak_link_client* ff_weak_link_ref(struct ff_weak_link_master * w); ++void ff_weak_link_unref(struct ff_weak_link_client ** ppLink); ++ ++// Returns NULL if link broken - in this case it will also zap ++// *ppLink and unref the weak_link. ++// Returns NULL if *ppLink is NULL (so a link once broken stays broken) ++// ++// The above does mean that there is a race if this is called simultainiously ++// by two threads using the same weak_link_client (so don't do that) ++void * ff_weak_link_lock(struct ff_weak_link_client ** ppLink); ++void ff_weak_link_unlock(struct ff_weak_link_client * c); ++ ++ ++ ++ ++ ++ +--- a/libavdevice/Makefile ++++ b/libavdevice/Makefile +@@ -46,6 +46,9 @@ OBJS-$(CONFIG_SNDIO_OUTDEV) + OBJS-$(CONFIG_V4L2_INDEV) += v4l2.o v4l2-common.o timefilter.o + OBJS-$(CONFIG_V4L2_OUTDEV) += v4l2enc.o v4l2-common.o + OBJS-$(CONFIG_VFWCAP_INDEV) += vfwcap.o ++OBJS-$(CONFIG_VOUT_DRM_OUTDEV) += drm_vout.o ++OBJS-$(CONFIG_VOUT_EGL_OUTDEV) += egl_vout.o ++OBJS-$(CONFIG_VOUT_RPI_OUTDEV) += rpi_vout.o + OBJS-$(CONFIG_XCBGRAB_INDEV) += xcbgrab.o + OBJS-$(CONFIG_XV_OUTDEV) += xv.o + +--- a/libavdevice/alldevices.c ++++ b/libavdevice/alldevices.c +@@ -52,6 +52,9 @@ extern AVOutputFormat ff_sndio_muxer; + extern AVInputFormat ff_v4l2_demuxer; + extern AVOutputFormat ff_v4l2_muxer; + extern AVInputFormat ff_vfwcap_demuxer; ++extern AVOutputFormat ff_vout_drm_muxer; ++extern AVOutputFormat ff_vout_egl_muxer; ++extern AVOutputFormat ff_vout_rpi_muxer; + extern AVInputFormat ff_xcbgrab_demuxer; + extern AVOutputFormat ff_xv_muxer; + +--- /dev/null ++++ b/libavdevice/drm_vout.c +@@ -0,0 +1,643 @@ ++/* ++ * Copyright (c) 2020 John Cox for Raspberry Pi Trading ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++ ++// *** This module is a work in progress and its utility is strictly ++// limited to testing. ++ ++#include "libavutil/opt.h" ++#include "libavutil/pixdesc.h" ++#include "libavutil/hwcontext_drm.h" ++#include "libavformat/internal.h" ++#include "avdevice.h" ++ ++#include "pthread.h" ++#include ++#include ++ ++#include ++#include ++ ++#define TRACE_ALL 0 ++ ++#define DRM_MODULE "vc4" ++ ++#define ERRSTR strerror(errno) ++ ++struct drm_setup { ++ int conId; ++ uint32_t crtcId; ++ int crtcIdx; ++ uint32_t planeId; ++ unsigned int out_fourcc; ++ struct { ++ int x, y, width, height; ++ } compose; ++}; ++ ++typedef struct drm_aux_s { ++ unsigned int fb_handle; ++ uint32_t bo_handles[AV_DRM_MAX_PLANES]; ++ AVFrame * frame; ++} drm_aux_t; ++ ++// Aux size should only need to be 2, but on a few streams (Hobbit) under FKMS ++// we get initial flicker probably due to dodgy drm timing ++#define AUX_SIZE 3 ++typedef struct drm_display_env_s ++{ ++ AVClass *class; ++ ++ int drm_fd; ++ uint32_t con_id; ++ struct drm_setup setup; ++ enum AVPixelFormat avfmt; ++ int show_all; ++ ++ unsigned int ano; ++ drm_aux_t aux[AUX_SIZE]; ++ ++ pthread_t q_thread; ++ sem_t q_sem_in; ++ sem_t q_sem_out; ++ int q_terminate; ++ AVFrame * q_next; ++ ++} drm_display_env_t; ++ ++ ++static int drm_vout_write_trailer(AVFormatContext *s) ++{ ++#if TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, "%s\n", __func__); ++#endif ++ ++ return 0; ++} ++ ++static int drm_vout_write_header(AVFormatContext *s) ++{ ++ const AVCodecParameters * const par = s->streams[0]->codecpar; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, "%s\n", __func__); ++#endif ++ if ( s->nb_streams > 1 ++ || par->codec_type != AVMEDIA_TYPE_VIDEO ++ || par->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME) { ++ av_log(s, AV_LOG_ERROR, "Only supports one wrapped avframe stream\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ return 0; ++} ++ ++static int find_plane(struct AVFormatContext * const avctx, ++ const int drmfd, const int crtcidx, const uint32_t format, ++ uint32_t * const pplane_id) ++{ ++ drmModePlaneResPtr planes; ++ drmModePlanePtr plane; ++ unsigned int i; ++ unsigned int j; ++ int ret = 0; ++ ++ planes = drmModeGetPlaneResources(drmfd); ++ if (!planes) ++ { ++ av_log(avctx, AV_LOG_WARNING, "drmModeGetPlaneResources failed: %s\n", ERRSTR); ++ return -1; ++ } ++ ++ for (i = 0; i < planes->count_planes; ++i) { ++ plane = drmModeGetPlane(drmfd, planes->planes[i]); ++ if (!planes) ++ { ++ av_log(avctx, AV_LOG_WARNING, "drmModeGetPlane failed: %s\n", ERRSTR); ++ break; ++ } ++ ++ if (!(plane->possible_crtcs & (1 << crtcidx))) { ++ drmModeFreePlane(plane); ++ continue; ++ } ++ ++ for (j = 0; j < plane->count_formats; ++j) { ++ if (plane->formats[j] == format) ++ break; ++ } ++ ++ if (j == plane->count_formats) { ++ drmModeFreePlane(plane); ++ continue; ++ } ++ ++ *pplane_id = plane->plane_id; ++ drmModeFreePlane(plane); ++ break; ++ } ++ ++ if (i == planes->count_planes) ++ ret = -1; ++ ++ drmModeFreePlaneResources(planes); ++ return ret; ++} ++ ++static void da_uninit(drm_display_env_t * const de, drm_aux_t * da) ++{ ++ if (da->fb_handle != 0) { ++ drmModeRmFB(de->drm_fd, da->fb_handle); ++ da->fb_handle = 0; ++ } ++ ++ for (unsigned int i = 0; i != AV_DRM_MAX_PLANES; ++i) { ++ if (da->bo_handles[i]) { ++ struct drm_gem_close gem_close = {.handle = da->bo_handles[i]}; ++ drmIoctl(de->drm_fd, DRM_IOCTL_GEM_CLOSE, &gem_close); ++ da->bo_handles[i] = 0; ++ } ++ } ++ av_frame_free(&da->frame); ++} ++ ++static int do_display(AVFormatContext * const s, drm_display_env_t * const de, AVFrame * frame) ++{ ++ const AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor*)frame->data[0]; ++ drm_aux_t * da = de->aux + de->ano; ++ const uint32_t format = desc->layers[0].format; ++ int ret = 0; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, "<<< %s: fd=%d\n", __func__, desc->objects[0].fd); ++#endif ++ ++ if (de->setup.out_fourcc != format) { ++ if (find_plane(s, de->drm_fd, de->setup.crtcIdx, format, &de->setup.planeId)) { ++ av_frame_free(&frame); ++ av_log(s, AV_LOG_WARNING, "No plane for format: %#x\n", format); ++ return -1; ++ } ++ de->setup.out_fourcc = format; ++ } ++ ++ { ++ drmVBlank vbl = { ++ .request = { ++ .type = DRM_VBLANK_RELATIVE, ++ .sequence = 0 ++ } ++ }; ++ ++ while (drmWaitVBlank(de->drm_fd, &vbl)) { ++ if (errno != EINTR) { ++// av_log(s, AV_LOG_WARNING, "drmWaitVBlank failed: %s\n", ERRSTR); ++ break; ++ } ++ } ++ } ++ ++ da_uninit(de, da); ++ ++ { ++ uint32_t pitches[4] = {0}; ++ uint32_t offsets[4] = {0}; ++ uint64_t modifiers[4] = {0}; ++ uint32_t bo_handles[4] = {0}; ++ int i, j, n; ++ ++ da->frame = frame; ++ ++ for (i = 0; i < desc->nb_objects; ++i) { ++ if (drmPrimeFDToHandle(de->drm_fd, desc->objects[i].fd, da->bo_handles + i) != 0) { ++ av_log(s, AV_LOG_WARNING, "drmPrimeFDToHandle[%d](%d) failed: %s\n", i, desc->objects[i].fd, ERRSTR); ++ return -1; ++ } ++ } ++ ++ n = 0; ++ for (i = 0; i < desc->nb_layers; ++i) { ++ for (j = 0; j < desc->layers[i].nb_planes; ++j) { ++ const AVDRMPlaneDescriptor * const p = desc->layers[i].planes + j; ++ const AVDRMObjectDescriptor * const obj = desc->objects + p->object_index; ++ pitches[n] = p->pitch; ++ offsets[n] = p->offset; ++ modifiers[n] = obj->format_modifier; ++ bo_handles[n] = da->bo_handles[p->object_index]; ++ ++n; ++ } ++ } ++ ++#if 1 && TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, "%dx%d, fmt: %x, boh=%d,%d,%d,%d, pitch=%d,%d,%d,%d," ++ " offset=%d,%d,%d,%d, mod=%llx,%llx,%llx,%llx\n", ++ av_frame_cropped_width(frame), ++ av_frame_cropped_height(frame), ++ desc->layers[0].format, ++ bo_handles[0], ++ bo_handles[1], ++ bo_handles[2], ++ bo_handles[3], ++ pitches[0], ++ pitches[1], ++ pitches[2], ++ pitches[3], ++ offsets[0], ++ offsets[1], ++ offsets[2], ++ offsets[3], ++ (long long)modifiers[0], ++ (long long)modifiers[1], ++ (long long)modifiers[2], ++ (long long)modifiers[3] ++ ); ++#endif ++ ++ if (drmModeAddFB2WithModifiers(de->drm_fd, ++ av_frame_cropped_width(frame), ++ av_frame_cropped_height(frame), ++ desc->layers[0].format, bo_handles, ++ pitches, offsets, modifiers, ++ &da->fb_handle, DRM_MODE_FB_MODIFIERS /** 0 if no mods */) != 0) { ++ av_log(s, AV_LOG_WARNING, "drmModeAddFB2WithModifiers failed: %s\n", ERRSTR); ++ return -1; ++ } ++ } ++ ++ ret = drmModeSetPlane(de->drm_fd, de->setup.planeId, de->setup.crtcId, ++ da->fb_handle, 0, ++ de->setup.compose.x, de->setup.compose.y, ++ de->setup.compose.width, ++ de->setup.compose.height, ++ 0, 0, ++ av_frame_cropped_width(frame) << 16, ++ av_frame_cropped_height(frame) << 16); ++ ++ if (ret != 0) { ++ av_log(s, AV_LOG_WARNING, "drmModeSetPlane failed: %s\n", ERRSTR); ++ } ++ ++ de->ano = de->ano + 1 >= AUX_SIZE ? 0 : de->ano + 1; ++ ++ return ret; ++} ++ ++static int do_sem_wait(sem_t * const sem, const int nowait) ++{ ++ while (nowait ? sem_trywait(sem) : sem_wait(sem)) { ++ if (errno != EINTR) ++ return -errno; ++ } ++ return 0; ++} ++ ++static void * display_thread(void * v) ++{ ++ AVFormatContext * const s = v; ++ drm_display_env_t * const de = s->priv_data; ++ int i; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); ++#endif ++ ++ sem_post(&de->q_sem_out); ++ ++ for (;;) { ++ AVFrame * frame; ++ ++ do_sem_wait(&de->q_sem_in, 0); ++ ++ if (de->q_terminate) ++ break; ++ ++ frame = de->q_next; ++ de->q_next = NULL; ++ sem_post(&de->q_sem_out); ++ ++ do_display(s, de, frame); ++ } ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); ++#endif ++ ++ for (i = 0; i != AUX_SIZE; ++i) ++ da_uninit(de, de->aux + i); ++ ++ av_frame_free(&de->q_next); ++ ++ return NULL; ++} ++ ++static int drm_vout_write_packet(AVFormatContext *s, AVPacket *pkt) ++{ ++ const AVFrame * const src_frame = (AVFrame *)pkt->data; ++ AVFrame * frame; ++ drm_display_env_t * const de = s->priv_data; ++ int ret; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, "%s\n", __func__); ++#endif ++ ++ if ((src_frame->flags & AV_FRAME_FLAG_CORRUPT) != 0) { ++ av_log(s, AV_LOG_WARNING, "Discard corrupt frame: fmt=%d, ts=%" PRId64 "\n", src_frame->format, src_frame->pts); ++ return 0; ++ } ++ ++ if (src_frame->format == AV_PIX_FMT_DRM_PRIME) { ++ frame = av_frame_alloc(); ++ av_frame_ref(frame, src_frame); ++ } ++ else if (src_frame->format == AV_PIX_FMT_VAAPI) { ++ frame = av_frame_alloc(); ++ frame->format = AV_PIX_FMT_DRM_PRIME; ++ if (av_hwframe_map(frame, src_frame, 0) != 0) ++ { ++ av_log(s, AV_LOG_WARNING, "Failed to map frame (format=%d) to DRM_PRiME\n", src_frame->format); ++ av_frame_free(&frame); ++ return AVERROR(EINVAL); ++ } ++ } ++ else { ++ av_log(s, AV_LOG_WARNING, "Frame (format=%d) not DRM_PRiME\n", src_frame->format); ++ return AVERROR(EINVAL); ++ } ++ ++ ret = do_sem_wait(&de->q_sem_out, !de->show_all); ++ if (ret) { ++ av_frame_free(&frame); ++ } ++ else { ++ de->q_next = frame; ++ sem_post(&de->q_sem_in); ++ } ++ ++ return 0; ++} ++ ++static int drm_vout_write_frame(AVFormatContext *s, int stream_index, AVFrame **ppframe, ++ unsigned flags) ++{ ++#if TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, "%s: idx=%d, flags=%#x\n", __func__, stream_index, flags); ++#endif ++ ++ /* drm_vout_write_header() should have accepted only supported formats */ ++ if ((flags & AV_WRITE_UNCODED_FRAME_QUERY)) ++ return 0; ++ ++ return 0; ++} ++ ++static int drm_vout_control_message(AVFormatContext *s, int type, void *data, size_t data_size) ++{ ++#if TRACE_ALL ++ av_log(s, AV_LOG_DEBUG, "%s: %d\n", __func__, type); ++#endif ++ switch(type) { ++ case AV_APP_TO_DEV_WINDOW_REPAINT: ++ return 0; ++ default: ++ break; ++ } ++ return AVERROR(ENOSYS); ++} ++ ++static int find_crtc(struct AVFormatContext * const avctx, int drmfd, struct drm_setup *s, uint32_t * const pConId) ++{ ++ int ret = -1; ++ int i; ++ drmModeRes *res = drmModeGetResources(drmfd); ++ drmModeConnector *c; ++ ++ if(!res) ++ { ++ printf( "drmModeGetResources failed: %s\n", ERRSTR); ++ return -1; ++ } ++ ++ if (res->count_crtcs <= 0) ++ { ++ printf( "drm: no crts\n"); ++ goto fail_res; ++ } ++ ++ if (!s->conId) { ++ fprintf(stderr, ++ "No connector ID specified. Choosing default from list:\n"); ++ ++ for (i = 0; i < res->count_connectors; i++) { ++ drmModeConnector *con = ++ drmModeGetConnector(drmfd, res->connectors[i]); ++ drmModeEncoder *enc = NULL; ++ drmModeCrtc *crtc = NULL; ++ ++ if (con->encoder_id) { ++ enc = drmModeGetEncoder(drmfd, con->encoder_id); ++ if (enc->crtc_id) { ++ crtc = drmModeGetCrtc(drmfd, enc->crtc_id); ++ } ++ } ++ ++ if (!s->conId && crtc) { ++ s->conId = con->connector_id; ++ s->crtcId = crtc->crtc_id; ++ } ++ ++ av_log(avctx, AV_LOG_DEBUG, "Connector %d (crtc %d): type %d, %dx%d%s\n", ++ con->connector_id, ++ crtc ? crtc->crtc_id : 0, ++ con->connector_type, ++ crtc ? crtc->width : 0, ++ crtc ? crtc->height : 0, ++ (s->conId == (int)con->connector_id ? ++ " (chosen)" : "")); ++ } ++ ++ if (!s->conId) { ++ av_log(avctx, AV_LOG_ERROR, ++ "No suitable enabled connector found.\n"); ++ return -1;; ++ } ++ } ++ ++ s->crtcIdx = -1; ++ ++ for (i = 0; i < res->count_crtcs; ++i) { ++ if (s->crtcId == res->crtcs[i]) { ++ s->crtcIdx = i; ++ break; ++ } ++ } ++ ++ if (s->crtcIdx == -1) ++ { ++ av_log(avctx, AV_LOG_WARNING, "drm: CRTC %u not found\n", s->crtcId); ++ goto fail_res; ++ } ++ ++ if (res->count_connectors <= 0) ++ { ++ av_log(avctx, AV_LOG_WARNING, "drm: no connectors\n"); ++ goto fail_res; ++ } ++ ++ c = drmModeGetConnector(drmfd, s->conId); ++ if (!c) ++ { ++ av_log(avctx, AV_LOG_WARNING, "drmModeGetConnector failed: %s\n", ERRSTR); ++ goto fail_res; ++ } ++ ++ if (!c->count_modes) ++ { ++ av_log(avctx, AV_LOG_WARNING, "connector supports no mode\n"); ++ goto fail_conn; ++ } ++ ++ { ++ drmModeCrtc *crtc = drmModeGetCrtc(drmfd, s->crtcId); ++ s->compose.x = crtc->x; ++ s->compose.y = crtc->y; ++ s->compose.width = crtc->width; ++ s->compose.height = crtc->height; ++ drmModeFreeCrtc(crtc); ++ } ++ ++ if (pConId) ++ *pConId = c->connector_id; ++ ret = 0; ++ ++fail_conn: ++ drmModeFreeConnector(c); ++ ++fail_res: ++ drmModeFreeResources(res); ++ ++ return ret; ++} ++ ++// deinit is called if init fails so no need to clean up explicity here ++static int drm_vout_init(struct AVFormatContext * s) ++{ ++ drm_display_env_t * const de = s->priv_data; ++ int rv; ++ const char * drm_module = DRM_MODULE; ++ ++ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); ++ ++ de->drm_fd = -1; ++ de->con_id = 0; ++ de->setup = (struct drm_setup){0}; ++ de->q_terminate = 0; ++ ++ if ((de->drm_fd = drmOpen(drm_module, NULL)) < 0) ++ { ++ rv = AVERROR(errno); ++ av_log(s, AV_LOG_ERROR, "Failed to drmOpen %s: %s\n", drm_module, av_err2str(rv)); ++ return rv; ++ } ++ ++ if (find_crtc(s, de->drm_fd, &de->setup, &de->con_id) != 0) ++ { ++ av_log(s, AV_LOG_ERROR, "failed to find valid mode\n"); ++ rv = AVERROR(EINVAL); ++ goto fail_close; ++ } ++ ++ sem_init(&de->q_sem_in, 0, 0); ++ sem_init(&de->q_sem_out, 0, 0); ++ if (pthread_create(&de->q_thread, NULL, display_thread, s)) { ++ rv = AVERROR(errno); ++ av_log(s, AV_LOG_ERROR, "Failed to creatye display thread: %s\n", av_err2str(rv)); ++ goto fail_close; ++ } ++ ++ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); ++ ++ return 0; ++ ++fail_close: ++ close(de->drm_fd); ++ de->drm_fd = -1; ++ av_log(s, AV_LOG_DEBUG, ">>> %s: FAIL\n", __func__); ++ ++ return rv; ++} ++ ++static void drm_vout_deinit(struct AVFormatContext * s) ++{ ++ drm_display_env_t * const de = s->priv_data; ++ ++ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); ++ ++ de->q_terminate = 1; ++ sem_post(&de->q_sem_in); ++ pthread_join(de->q_thread, NULL); ++ sem_destroy(&de->q_sem_in); ++ sem_destroy(&de->q_sem_out); ++ ++ for (unsigned int i = 0; i != AUX_SIZE; ++i) ++ da_uninit(de, de->aux + i); ++ ++ av_frame_free(&de->q_next); ++ ++ if (de->drm_fd >= 0) { ++ close(de->drm_fd); ++ de->drm_fd = -1; ++ } ++ ++ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); ++} ++ ++ ++#define OFFSET(x) offsetof(drm_display_env_t, x) ++static const AVOption options[] = { ++ { "show_all", "show all frames", OFFSET(show_all), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, ++ { NULL } ++}; ++ ++static const AVClass drm_vout_class = { ++ .class_name = "drm vid outdev", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++ .category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, ++}; ++ ++AVOutputFormat ff_vout_drm_muxer = { ++ .name = "vout_drm", ++ .long_name = NULL_IF_CONFIG_SMALL("Drm video output device"), ++ .priv_data_size = sizeof(drm_display_env_t), ++ .audio_codec = AV_CODEC_ID_NONE, ++ .video_codec = AV_CODEC_ID_WRAPPED_AVFRAME, ++ .write_header = drm_vout_write_header, ++ .write_packet = drm_vout_write_packet, ++ .write_uncoded_frame = drm_vout_write_frame, ++ .write_trailer = drm_vout_write_trailer, ++ .control_message = drm_vout_control_message, ++ .flags = AVFMT_NOFILE | AVFMT_VARIABLE_FPS | AVFMT_NOTIMESTAMPS, ++ .priv_class = &drm_vout_class, ++ .init = drm_vout_init, ++ .deinit = drm_vout_deinit, ++}; ++ +--- /dev/null ++++ b/libavdevice/egl_vout.c +@@ -0,0 +1,816 @@ ++/* ++ * Copyright (c) 2020 John Cox for Raspberry Pi Trading ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++ ++// *** This module is a work in progress and its utility is strictly ++// limited to testing. ++// Amongst other issues it doesn't wait for the pic to be displayed before ++// returning the buffer so flikering does occur. ++ ++#include ++#include ++ ++#include "libavutil/opt.h" ++#include "libavutil/avassert.h" ++#include "libavutil/pixdesc.h" ++#include "libavutil/imgutils.h" ++#include "libavutil/hwcontext_drm.h" ++#include "libavformat/internal.h" ++#include "avdevice.h" ++ ++#include "pthread.h" ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "libavutil/rpi_sand_fns.h" ++ ++#define TRACE_ALL 0 ++ ++struct egl_setup { ++ int conId; ++ ++ Display *dpy; ++ EGLDisplay egl_dpy; ++ EGLContext ctx; ++ EGLSurface surf; ++ Window win; ++ ++ uint32_t crtcId; ++ int crtcIdx; ++ uint32_t planeId; ++ struct { ++ int x, y, width, height; ++ } compose; ++}; ++ ++typedef struct egl_aux_s { ++ int fd; ++ GLuint texture; ++ ++} egl_aux_t; ++ ++typedef struct egl_display_env_s ++{ ++ AVClass *class; ++ ++ struct egl_setup setup; ++ enum AVPixelFormat avfmt; ++ ++ int show_all; ++ int window_width, window_height; ++ int window_x, window_y; ++ int fullscreen; ++ ++ egl_aux_t aux[32]; ++ ++ pthread_t q_thread; ++ pthread_mutex_t q_lock; ++ sem_t display_start_sem; ++ sem_t q_sem; ++ int q_terminate; ++ AVFrame * q_this; ++ AVFrame * q_next; ++ ++} egl_display_env_t; ++ ++ ++/** ++ * Remove window border/decorations. ++ */ ++static void ++no_border( Display *dpy, Window w) ++{ ++ static const unsigned MWM_HINTS_DECORATIONS = (1 << 1); ++ static const int PROP_MOTIF_WM_HINTS_ELEMENTS = 5; ++ ++ typedef struct ++ { ++ unsigned long flags; ++ unsigned long functions; ++ unsigned long decorations; ++ long inputMode; ++ unsigned long status; ++ } PropMotifWmHints; ++ ++ PropMotifWmHints motif_hints; ++ Atom prop, proptype; ++ unsigned long flags = 0; ++ ++ /* setup the property */ ++ motif_hints.flags = MWM_HINTS_DECORATIONS; ++ motif_hints.decorations = flags; ++ ++ /* get the atom for the property */ ++ prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True ); ++ if (!prop) { ++ /* something went wrong! */ ++ return; ++ } ++ ++ /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */ ++ proptype = prop; ++ ++ XChangeProperty( dpy, w, /* display, window */ ++ prop, proptype, /* property, type */ ++ 32, /* format: 32-bit datums */ ++ PropModeReplace, /* mode */ ++ (unsigned char *) &motif_hints, /* data */ ++ PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */ ++ ); ++} ++ ++ ++/* ++ * Create an RGB, double-buffered window. ++ * Return the window and context handles. ++ */ ++static int ++make_window(struct AVFormatContext * const s, ++ egl_display_env_t * const de, ++ Display *dpy, EGLDisplay egl_dpy, const char *name, ++ Window *winRet, EGLContext *ctxRet, EGLSurface *surfRet) ++{ ++ int scrnum = DefaultScreen( dpy ); ++ XSetWindowAttributes attr; ++ unsigned long mask; ++ Window root = RootWindow( dpy, scrnum ); ++ Window win; ++ EGLContext ctx; ++ const int fullscreen = de->fullscreen; ++ EGLConfig config; ++ int x = de->window_x; ++ int y = de->window_y; ++ int width = de->window_width ? de->window_width : 1280; ++ int height = de->window_height ? de->window_height : 720; ++ ++ ++ if (fullscreen) { ++ int scrnum = DefaultScreen(dpy); ++ ++ x = 0; y = 0; ++ width = DisplayWidth(dpy, scrnum); ++ height = DisplayHeight(dpy, scrnum); ++ } ++ ++ { ++ EGLint num_configs; ++ static const EGLint attribs[] = { ++ EGL_RED_SIZE, 1, ++ EGL_GREEN_SIZE, 1, ++ EGL_BLUE_SIZE, 1, ++ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, ++ EGL_NONE ++ }; ++ ++ if (!eglChooseConfig(egl_dpy, attribs, &config, 1, &num_configs)) { ++ av_log(s, AV_LOG_ERROR, "Error: couldn't get an EGL visual config\n"); ++ return -1; ++ } ++ } ++ ++ { ++ EGLint vid; ++ if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) { ++ av_log(s, AV_LOG_ERROR, "Error: eglGetConfigAttrib() failed\n"); ++ return -1; ++ } ++ ++ { ++ XVisualInfo visTemplate = { ++ .visualid = vid, ++ }; ++ int num_visuals; ++ XVisualInfo *visinfo = XGetVisualInfo(dpy, VisualIDMask, ++ &visTemplate, &num_visuals); ++ ++ /* window attributes */ ++ attr.background_pixel = 0; ++ attr.border_pixel = 0; ++ attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); ++ attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; ++ /* XXX this is a bad way to get a borderless window! */ ++ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; ++ ++ win = XCreateWindow( dpy, root, x, y, width, height, ++ 0, visinfo->depth, InputOutput, ++ visinfo->visual, mask, &attr ); ++ XFree(visinfo); ++ } ++ } ++ ++ if (fullscreen) ++ no_border(dpy, win); ++ ++ /* set hints and properties */ ++ { ++ XSizeHints sizehints; ++ sizehints.x = x; ++ sizehints.y = y; ++ sizehints.width = width; ++ sizehints.height = height; ++ sizehints.flags = USSize | USPosition; ++ XSetNormalHints(dpy, win, &sizehints); ++ XSetStandardProperties(dpy, win, name, name, ++ None, (char **)NULL, 0, &sizehints); ++ } ++ ++ eglBindAPI(EGL_OPENGL_ES_API); ++ ++ { ++ static const EGLint ctx_attribs[] = { ++ EGL_CONTEXT_CLIENT_VERSION, 2, ++ EGL_NONE ++ }; ++ ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs ); ++ if (!ctx) { ++ av_log(s, AV_LOG_ERROR, "Error: eglCreateContext failed\n"); ++ return -1; ++ } ++ } ++ ++ ++ XMapWindow(dpy, win); ++ ++ { ++ EGLSurface surf = eglCreateWindowSurface(egl_dpy, config, (EGLNativeWindowType)win, NULL); ++ if (!surf) { ++ av_log(s, AV_LOG_ERROR, "Error: eglCreateWindowSurface failed\n"); ++ return -1; ++ } ++ ++ if (!eglMakeCurrent(egl_dpy, surf, surf, ctx)) { ++ av_log(s, AV_LOG_ERROR, "Error: eglCreateContext failed\n"); ++ return -1; ++ } ++ ++ *winRet = win; ++ *ctxRet = ctx; ++ *surfRet = surf; ++ } ++ ++ return 0; ++} ++ ++static GLint ++compile_shader(struct AVFormatContext * const avctx, GLenum target, const char *source) ++{ ++ GLuint s = glCreateShader(target); ++ ++ if (s == 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to create shader\n"); ++ return 0; ++ } ++ ++ glShaderSource(s, 1, (const GLchar **) &source, NULL); ++ glCompileShader(s); ++ ++ { ++ GLint ok; ++ glGetShaderiv(s, GL_COMPILE_STATUS, &ok); ++ ++ if (!ok) { ++ GLchar *info; ++ GLint size; ++ ++ glGetShaderiv(s, GL_INFO_LOG_LENGTH, &size); ++ info = malloc(size); ++ ++ glGetShaderInfoLog(s, size, NULL, info); ++ av_log(avctx, AV_LOG_ERROR, "Failed to compile shader: %ssource:\n%s\n", info, source); ++ ++ return 0; ++ } ++ } ++ ++ return s; ++} ++ ++static GLuint link_program(struct AVFormatContext * const s, GLint vs, GLint fs) ++{ ++ GLuint prog = glCreateProgram(); ++ ++ if (prog == 0) { ++ av_log(s, AV_LOG_ERROR, "Failed to create program\n"); ++ return 0; ++ } ++ ++ glAttachShader(prog, vs); ++ glAttachShader(prog, fs); ++ glLinkProgram(prog); ++ ++ { ++ GLint ok; ++ glGetProgramiv(prog, GL_LINK_STATUS, &ok); ++ if (!ok) { ++ /* Some drivers return a size of 1 for an empty log. This is the size ++ * of a log that contains only a terminating NUL character. ++ */ ++ GLint size; ++ GLchar *info = NULL; ++ glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &size); ++ if (size > 1) { ++ info = malloc(size); ++ glGetProgramInfoLog(prog, size, NULL, info); ++ } ++ ++ av_log(s, AV_LOG_ERROR, "Failed to link: %s\n", ++ (info != NULL) ? info : ""); ++ return 0; ++ } ++ } ++ ++ return prog; ++} ++ ++static int ++gl_setup(struct AVFormatContext * const s) ++{ ++ const char *vs = ++ "attribute vec4 pos;\n" ++ "varying vec2 texcoord;\n" ++ "\n" ++ "void main() {\n" ++ " gl_Position = pos;\n" ++ " texcoord.x = (pos.x + 1.0) / 2.0;\n" ++ " texcoord.y = (-pos.y + 1.0) / 2.0;\n" ++ "}\n"; ++ const char *fs = ++ "#extension GL_OES_EGL_image_external : enable\n" ++ "precision mediump float;\n" ++ "uniform samplerExternalOES s;\n" ++ "varying vec2 texcoord;\n" ++ "void main() {\n" ++ " gl_FragColor = texture2D(s, texcoord);\n" ++ "}\n"; ++ ++ GLuint vs_s; ++ GLuint fs_s; ++ GLuint prog; ++ ++ if (!(vs_s = compile_shader(s, GL_VERTEX_SHADER, vs)) || ++ !(fs_s = compile_shader(s, GL_FRAGMENT_SHADER, fs)) || ++ !(prog = link_program(s, vs_s, fs_s))) ++ return -1; ++ ++ glUseProgram(prog); ++ ++ { ++ static const float verts[] = { ++ -1, -1, ++ 1, -1, ++ 1, 1, ++ -1, 1, ++ }; ++ glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, verts); ++ } ++ ++ glEnableVertexAttribArray(0); ++ return 0; ++} ++ ++static int egl_vout_write_trailer(AVFormatContext *s) ++{ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s\n", __func__); ++#endif ++ ++ return 0; ++} ++ ++static int egl_vout_write_header(AVFormatContext *s) ++{ ++ const AVCodecParameters * const par = s->streams[0]->codecpar; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s\n", __func__); ++#endif ++ if ( s->nb_streams > 1 ++ || par->codec_type != AVMEDIA_TYPE_VIDEO ++ || par->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME) { ++ av_log(s, AV_LOG_ERROR, "Only supports one wrapped avframe stream\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ return 0; ++} ++ ++ ++static int do_display(AVFormatContext * const s, egl_display_env_t * const de, AVFrame * const frame) ++{ ++ const AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor*)frame->data[0]; ++ egl_aux_t * da = NULL; ++ unsigned int i; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "<<< %s\n", __func__); ++#endif ++ ++ for (i = 0; i != 32; ++i) { ++ if (de->aux[i].fd == -1 || de->aux[i].fd == desc->objects[0].fd) { ++ da = de->aux + i; ++ break; ++ } ++ } ++ ++ if (da == NULL) { ++ av_log(s, AV_LOG_INFO, "%s: Out of handles\n", __func__); ++ return AVERROR(EINVAL); ++ } ++ ++ if (da->texture == 0) { ++ EGLint attribs[50]; ++ EGLint * a = attribs; ++ int i, j; ++ static const EGLint anames[] = { ++ EGL_DMA_BUF_PLANE0_FD_EXT, ++ EGL_DMA_BUF_PLANE0_OFFSET_EXT, ++ EGL_DMA_BUF_PLANE0_PITCH_EXT, ++ EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, ++ EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, ++ EGL_DMA_BUF_PLANE1_FD_EXT, ++ EGL_DMA_BUF_PLANE1_OFFSET_EXT, ++ EGL_DMA_BUF_PLANE1_PITCH_EXT, ++ EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, ++ EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, ++ EGL_DMA_BUF_PLANE2_FD_EXT, ++ EGL_DMA_BUF_PLANE2_OFFSET_EXT, ++ EGL_DMA_BUF_PLANE2_PITCH_EXT, ++ EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT, ++ EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT, ++ }; ++ const EGLint * b = anames; ++ ++ *a++ = EGL_WIDTH; ++ *a++ = av_frame_cropped_width(frame); ++ *a++ = EGL_HEIGHT; ++ *a++ = av_frame_cropped_height(frame); ++ *a++ = EGL_LINUX_DRM_FOURCC_EXT; ++ *a++ = desc->layers[0].format; ++ ++ for (i = 0; i < desc->nb_layers; ++i) { ++ for (j = 0; j < desc->layers[i].nb_planes; ++j) { ++ const AVDRMPlaneDescriptor * const p = desc->layers[i].planes + j; ++ const AVDRMObjectDescriptor * const obj = desc->objects + p->object_index; ++ *a++ = *b++; ++ *a++ = obj->fd; ++ *a++ = *b++; ++ *a++ = p->offset; ++ *a++ = *b++; ++ *a++ = p->pitch; ++ if (obj->format_modifier == 0) { ++ b += 2; ++ } ++ else { ++ *a++ = *b++; ++ *a++ = (EGLint)(obj->format_modifier & 0xFFFFFFFF); ++ *a++ = *b++; ++ *a++ = (EGLint)(obj->format_modifier >> 32); ++ } ++ } ++ } ++ ++ *a = EGL_NONE; ++ ++#if TRACE_ALL ++ for (a = attribs, i = 0; *a != EGL_NONE; a += 2, ++i) { ++ av_log(s, AV_LOG_INFO, "[%2d] %4x: %d\n", i, a[0], a[1]); ++ } ++#endif ++ { ++ const EGLImage image = eglCreateImageKHR(de->setup.egl_dpy, ++ EGL_NO_CONTEXT, ++ EGL_LINUX_DMA_BUF_EXT, ++ NULL, attribs); ++ if (!image) { ++ av_log(s, AV_LOG_ERROR, "Failed to import fd %d\n", desc->objects[0].fd); ++ return -1; ++ } ++ ++ glGenTextures(1, &da->texture); ++ glBindTexture(GL_TEXTURE_EXTERNAL_OES, da->texture); ++ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR); ++ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR); ++ glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, image); ++ ++ eglDestroyImageKHR(de->setup.egl_dpy, image); ++ } ++ ++ da->fd = desc->objects[0].fd; ++ ++#if 0 ++ av_log(s, AV_LOG_INFO, "%dx%d, fmt: %x, boh=%d,%d,%d,%d, pitch=%d,%d,%d,%d," ++ " offset=%d,%d,%d,%d, mod=%llx,%llx,%llx,%llx\n", ++ av_frame_cropped_width(frame), ++ av_frame_cropped_height(frame), ++ desc->layers[0].format, ++ bo_plane_handles[0], ++ bo_plane_handles[1], ++ bo_plane_handles[2], ++ bo_plane_handles[3], ++ pitches[0], ++ pitches[1], ++ pitches[2], ++ pitches[3], ++ offsets[0], ++ offsets[1], ++ offsets[2], ++ offsets[3], ++ (long long)modifiers[0], ++ (long long)modifiers[1], ++ (long long)modifiers[2], ++ (long long)modifiers[3] ++ ); ++#endif ++ } ++ ++ glClearColor(0.5, 0.5, 0.5, 0.5); ++ glClear(GL_COLOR_BUFFER_BIT); ++ ++ glBindTexture(GL_TEXTURE_EXTERNAL_OES, da->texture); ++ glDrawArrays(GL_TRIANGLE_FAN, 0, 4); ++ eglSwapBuffers(de->setup.egl_dpy, de->setup.surf); ++ ++ glDeleteTextures(1, &da->texture); ++ da->texture = 0; ++ da->fd = -1; ++ ++ return 0; ++} ++ ++static void * display_thread(void * v) ++{ ++ AVFormatContext * const s = v; ++ egl_display_env_t * const de = s->priv_data; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "<<< %s\n", __func__); ++#endif ++ { ++ EGLint egl_major, egl_minor; ++ ++ de->setup.dpy = XOpenDisplay(NULL); ++ if (!de->setup.dpy) { ++ av_log(s, AV_LOG_ERROR, "Couldn't open X display\n"); ++ goto fail; ++ } ++ ++ de->setup.egl_dpy = eglGetDisplay(de->setup.dpy); ++ if (!de->setup.egl_dpy) { ++ av_log(s, AV_LOG_ERROR, "eglGetDisplay() failed\n"); ++ goto fail; ++ } ++ ++ if (!eglInitialize(de->setup.egl_dpy, &egl_major, &egl_minor)) { ++ av_log(s, AV_LOG_ERROR, "Error: eglInitialize() failed\n"); ++ goto fail; ++ } ++ ++ av_log(s, AV_LOG_INFO, "EGL version %d.%d\n", egl_major, egl_minor); ++ ++ if (!epoxy_has_egl_extension(de->setup.egl_dpy, "EGL_KHR_image_base")) { ++ av_log(s, AV_LOG_ERROR, "Missing EGL KHR image extension\n"); ++ goto fail; ++ } ++ } ++ ++ if (!de->window_width || !de->window_height) { ++ de->window_width = 1280; ++ de->window_height = 720; ++ } ++ if (make_window(s, de, de->setup.dpy, de->setup.egl_dpy, "ffmpeg-vout", ++ &de->setup.win, &de->setup.ctx, &de->setup.surf)) { ++ av_log(s, AV_LOG_ERROR, "%s: make_window failed\n", __func__); ++ goto fail; ++ } ++ ++ if (gl_setup(s)) { ++ av_log(s, AV_LOG_ERROR, "%s: gl_setup failed\n", __func__); ++ goto fail; ++ } ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "--- %s: Start done\n", __func__); ++#endif ++ sem_post(&de->display_start_sem); ++ ++ for (;;) { ++ AVFrame * frame; ++ ++ while (sem_wait(&de->q_sem) != 0) { ++ av_assert0(errno == EINTR); ++ } ++ ++ if (de->q_terminate) ++ break; ++ ++ pthread_mutex_lock(&de->q_lock); ++ frame = de->q_next; ++ de->q_next = NULL; ++ pthread_mutex_unlock(&de->q_lock); ++ ++ do_display(s, de, frame); ++ ++ av_frame_free(&de->q_this); ++ de->q_this = frame; ++ } ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, ">>> %s\n", __func__); ++#endif ++ ++ return NULL; ++ ++fail: ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, ">>> %s: FAIL\n", __func__); ++#endif ++ de->q_terminate = 1; ++ sem_post(&de->display_start_sem); ++ ++ return NULL; ++} ++ ++static int egl_vout_write_packet(AVFormatContext *s, AVPacket *pkt) ++{ ++ const AVFrame * const src_frame = (AVFrame *)pkt->data; ++ AVFrame * frame; ++ egl_display_env_t * const de = s->priv_data; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s\n", __func__); ++#endif ++ ++ if (src_frame->format == AV_PIX_FMT_DRM_PRIME) { ++ frame = av_frame_alloc(); ++ av_frame_ref(frame, src_frame); ++ } ++ else if (src_frame->format == AV_PIX_FMT_VAAPI) { ++ frame = av_frame_alloc(); ++ frame->format = AV_PIX_FMT_DRM_PRIME; ++ if (av_hwframe_map(frame, src_frame, 0) != 0) ++ { ++ av_log(s, AV_LOG_WARNING, "Failed to map frame (format=%d) to DRM_PRiME\n", src_frame->format); ++ av_frame_free(&frame); ++ return AVERROR(EINVAL); ++ } ++ } ++ else { ++ av_log(s, AV_LOG_WARNING, "Frame (format=%d) not DRM_PRiME\n", src_frame->format); ++ return AVERROR(EINVAL); ++ } ++ ++ // Really hacky sync ++ while (de->show_all && de->q_next) { ++ usleep(3000); ++ } ++ ++ pthread_mutex_lock(&de->q_lock); ++ { ++ AVFrame * const t = de->q_next; ++ de->q_next = frame; ++ frame = t; ++ } ++ pthread_mutex_unlock(&de->q_lock); ++ ++ if (frame == NULL) ++ sem_post(&de->q_sem); ++ else ++ av_frame_free(&frame); ++ ++ return 0; ++} ++ ++static int egl_vout_write_frame(AVFormatContext *s, int stream_index, AVFrame **ppframe, ++ unsigned flags) ++{ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s: idx=%d, flags=%#x\n", __func__, stream_index, flags); ++#endif ++ ++ /* egl_vout_write_header() should have accepted only supported formats */ ++ if ((flags & AV_WRITE_UNCODED_FRAME_QUERY)) ++ return 0; ++ ++ return 0; ++} ++ ++static int egl_vout_control_message(AVFormatContext *s, int type, void *data, size_t data_size) ++{ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s: %d\n", __func__, type); ++#endif ++ switch(type) { ++ case AV_APP_TO_DEV_WINDOW_REPAINT: ++ return 0; ++ default: ++ break; ++ } ++ return AVERROR(ENOSYS); ++} ++ ++// deinit is called if init fails so no need to clean up explicity here ++static int egl_vout_init(struct AVFormatContext * s) ++{ ++ egl_display_env_t * const de = s->priv_data; ++ unsigned int i; ++ ++ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); ++ ++ de->setup = (struct egl_setup){0}; ++ ++ for (i = 0; i != 32; ++i) { ++ de->aux[i].fd = -1; ++ } ++ ++ de->q_terminate = 0; ++ pthread_mutex_init(&de->q_lock, NULL); ++ sem_init(&de->q_sem, 0, 0); ++ sem_init(&de->display_start_sem, 0, 0); ++ av_assert0(pthread_create(&de->q_thread, NULL, display_thread, s) == 0); ++ ++ sem_wait(&de->display_start_sem); ++ if (de->q_terminate) { ++ av_log(s, AV_LOG_ERROR, "%s: Display startup failure\n", __func__); ++ return -1; ++ } ++ ++ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); ++ ++ return 0; ++} ++ ++static void egl_vout_deinit(struct AVFormatContext * s) ++{ ++ egl_display_env_t * const de = s->priv_data; ++ ++ av_log(s, AV_LOG_DEBUG, "<<< %s\n", __func__); ++ ++ de->q_terminate = 1; ++ sem_post(&de->q_sem); ++ pthread_join(de->q_thread, NULL); ++ sem_destroy(&de->q_sem); ++ pthread_mutex_destroy(&de->q_lock); ++ ++ av_frame_free(&de->q_next); ++ av_frame_free(&de->q_this); ++ ++ av_log(s, AV_LOG_DEBUG, ">>> %s\n", __func__); ++} ++ ++#define OFFSET(x) offsetof(egl_display_env_t, x) ++static const AVOption options[] = { ++ { "show_all", "show all frames", OFFSET(show_all), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "window_size", "set window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "window_x", "set window x offset", OFFSET(window_x), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "window_y", "set window y offset", OFFSET(window_y), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "fullscreen", "set fullscreen display", OFFSET(fullscreen), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, ++ { NULL } ++ ++}; ++ ++static const AVClass egl_vout_class = { ++ .class_name = "egl vid outdev", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++ .category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, ++}; ++ ++AVOutputFormat ff_vout_egl_muxer = { ++ .name = "vout_egl", ++ .long_name = NULL_IF_CONFIG_SMALL("Egl video output device"), ++ .priv_data_size = sizeof(egl_display_env_t), ++ .audio_codec = AV_CODEC_ID_NONE, ++ .video_codec = AV_CODEC_ID_WRAPPED_AVFRAME, ++ .write_header = egl_vout_write_header, ++ .write_packet = egl_vout_write_packet, ++ .write_uncoded_frame = egl_vout_write_frame, ++ .write_trailer = egl_vout_write_trailer, ++ .control_message = egl_vout_control_message, ++ .flags = AVFMT_NOFILE | AVFMT_VARIABLE_FPS | AVFMT_NOTIMESTAMPS, ++ .priv_class = &egl_vout_class, ++ .init = egl_vout_init, ++ .deinit = egl_vout_deinit, ++}; ++ +--- /dev/null ++++ b/libavdevice/rpi_vout.c +@@ -0,0 +1,534 @@ ++/* ++ * Copyright (c) 2013 Jeff Moguillansky ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++/** ++ * @file ++ * XVideo output device ++ * ++ * TODO: ++ * - add support to more formats ++ */ ++ ++#include "libavutil/opt.h" ++#include "libavutil/avassert.h" ++#include "libavutil/pixdesc.h" ++#include "libavutil/imgutils.h" ++#include "libavformat/internal.h" ++#include "avdevice.h" ++ ++#include ++#include ++ ++#pragma GCC diagnostic push ++// Many many redundant decls in the header files ++#pragma GCC diagnostic ignored "-Wredundant-decls" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#pragma GCC diagnostic pop ++#include "libavutil/rpi_sand_fns.h" ++#include "libavcodec/rpi_zc.h" ++ ++#define TRACE_ALL 0 ++ ++#define DISPLAY_PORT_DEPTH 4 ++ ++typedef struct rpi_display_env_s ++{ ++ AVClass *class; ++ ++ MMAL_COMPONENT_T* display; ++ MMAL_COMPONENT_T* isp; ++ MMAL_PORT_T * port_in; // Input port of either isp or display depending on pipe setup ++ MMAL_CONNECTION_T * conn; ++ ++ MMAL_POOL_T *rpi_pool; ++ volatile int rpi_display_count; ++ ++ MMAL_FOURCC_T req_fmt; ++ MMAL_VIDEO_FORMAT_T req_vfmt; ++ ++ AVZcEnvPtr zc; ++ ++ int window_width, window_height; ++ int window_x, window_y; ++ int layer, fullscreen; ++ int show_all; ++} rpi_display_env_t; ++ ++ ++static void display_cb_input(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { ++ mmal_buffer_header_release(buffer); ++} ++ ++static void display_cb_control(MMAL_PORT_T *port,MMAL_BUFFER_HEADER_T *buffer) { ++ mmal_buffer_header_release(buffer); ++} ++ ++ ++static MMAL_FOURCC_T mmfmt_from_avfmt(const enum AVPixelFormat fmt) ++{ ++ switch (fmt) { ++ case AV_PIX_FMT_SAND128: ++ case AV_PIX_FMT_RPI4_8: ++ return MMAL_ENCODING_YUVUV128; ++ case AV_PIX_FMT_RPI4_10: ++ return MMAL_ENCODING_YUV10_COL; ++ case AV_PIX_FMT_SAND64_10: ++ return MMAL_ENCODING_YUVUV64_10; ++ case AV_PIX_FMT_SAND64_16: ++ return MMAL_ENCODING_YUVUV64_16; ++ case AV_PIX_FMT_YUV420P: ++ return MMAL_ENCODING_I420; ++ ++ default: ++ break; ++ } ++ return 0; ++} ++ ++ ++static void video_format_from_zc_frame(MMAL_ES_FORMAT_T* const es_fmt, ++ const AVFrame * const frame, const AVRpiZcRefPtr fr_ref) ++{ ++ MMAL_VIDEO_FORMAT_T *const vfmt = &es_fmt->es->video; ++ const AVRpiZcFrameGeometry * geo = av_rpi_zc_geometry(fr_ref); ++ if (av_rpi_is_sand_format(geo->format)) { ++ // Sand formats are a bit "special" ++ // stride1 implicit in format ++ // width = stride2 ++ vfmt->width = geo->stripe_is_yc ? ++ geo->height_y + geo->height_c : geo->height_y; ++// es->height = geo->video_height; //*** When we get the FLAG this will change ++ vfmt->height = geo->height_y; ++ es_fmt->flags = MMAL_ES_FORMAT_FLAG_COL_FMTS_WIDTH_IS_COL_STRIDE; ++ } ++ else { ++ vfmt->width = geo->stride_y / geo->bytes_per_pel; ++ vfmt->height = geo->height_y; ++ es_fmt->flags = 0; ++ } ++ ++ es_fmt->type = MMAL_ES_TYPE_VIDEO; ++ es_fmt->encoding = mmfmt_from_avfmt(geo->format); ++ es_fmt->encoding_variant = 0; ++ es_fmt->bitrate = 0; ++ ++ vfmt->crop.x = frame->crop_left; ++ vfmt->crop.y = frame->crop_top; ++ vfmt->crop.width = av_frame_cropped_width(frame); ++ vfmt->crop.height = av_frame_cropped_height(frame); ++ ++ vfmt->frame_rate.den = 0; // Don't think I know it here ++ vfmt->frame_rate.num = 0; ++ ++ vfmt->par.den = frame->sample_aspect_ratio.den; ++ vfmt->par.num = frame->sample_aspect_ratio.num; ++ ++ vfmt->color_space = 0; // Unknown currently ++} ++ ++static MMAL_BOOL_T buf_release_cb(MMAL_BUFFER_HEADER_T * buf, void *userdata) ++{ ++ rpi_display_env_t * const de = userdata; ++ if (buf->user_data != NULL) { ++ av_rpi_zc_unref((AVRpiZcRefPtr)buf->user_data); ++ buf->user_data = NULL; ++ } ++ atomic_fetch_add(&de->rpi_display_count, -1); ++ return MMAL_FALSE; ++} ++ ++static inline int avfmt_needs_isp(const enum AVPixelFormat avfmt) ++{ ++ return avfmt == AV_PIX_FMT_SAND64_10; ++} ++ ++static void isp_remove(AVFormatContext * const s, rpi_display_env_t * const de) ++{ ++ if (de->isp != NULL) ++ { ++ if (de->isp->input[0]->is_enabled) ++ mmal_port_disable(de->isp->input[0]); ++ if (de->isp->control->is_enabled) ++ mmal_port_disable(de->isp->control); ++ } ++ if (de->conn != NULL) { ++ mmal_connection_destroy(de->conn); ++ de->conn = NULL; ++ } ++ if (de->isp != NULL) { ++ mmal_component_destroy(de->isp); ++ de->isp = NULL; ++ } ++} ++ ++static void display_frame(AVFormatContext * const s, rpi_display_env_t * const de, const AVFrame* const fr) ++{ ++ MMAL_BUFFER_HEADER_T* buf = NULL; ++ AVRpiZcRefPtr fr_buf = NULL; ++ ++ if (de == NULL) ++ return; ++ ++ if (atomic_load(&de->rpi_display_count) >= DISPLAY_PORT_DEPTH - 1) { ++ av_log(s, AV_LOG_VERBOSE, "Frame dropped\n"); ++ return; ++ } ++ ++ if ((fr_buf = av_rpi_zc_ref(s, de->zc, fr, fr->format, 1)) == NULL) { ++ return; ++ } ++ ++ buf = mmal_queue_get(de->rpi_pool->queue); ++ if (!buf) { ++ // Running too fast so drop the frame (unexpected) ++ goto fail; ++ } ++ ++ buf->cmd = 0; ++ buf->offset = 0; ++ buf->flags = 0; ++ mmal_buffer_header_reset(buf); ++ ++ atomic_fetch_add(&de->rpi_display_count, 1); // Deced on release ++ mmal_buffer_header_pre_release_cb_set(buf, buf_release_cb, de); ++ ++ buf->user_data = fr_buf; ++ buf->data = (uint8_t *)av_rpi_zc_vc_handle(fr_buf); // Cast our handle to a pointer for mmal ++ buf->offset = av_rpi_zc_offset(fr_buf); ++ buf->length = av_rpi_zc_length(fr_buf); ++ buf->alloc_size = av_rpi_zc_numbytes(fr_buf); ++ ++ while (de->show_all && atomic_load(&de->rpi_display_count) >= DISPLAY_PORT_DEPTH - 1) { ++ usleep(5000); ++ } ++ ++ { ++ MMAL_ES_SPECIFIC_FORMAT_T new_ess = {.video = {0}}; ++ MMAL_ES_FORMAT_T new_es = {.es = &new_ess}; ++ MMAL_VIDEO_FORMAT_T * const new_vfmt = &new_ess.video; ++ ++ video_format_from_zc_frame(&new_es, fr, fr_buf); ++ if (de->req_fmt != new_es.encoding || ++ de->req_vfmt.width != new_vfmt->width || ++ de->req_vfmt.height != new_vfmt->height || ++ de->req_vfmt.crop.x != new_vfmt->crop.x || ++ de->req_vfmt.crop.y != new_vfmt->crop.y || ++ de->req_vfmt.crop.width != new_vfmt->crop.width || ++ de->req_vfmt.crop.height != new_vfmt->crop.height) { ++ // Something has changed ++ ++ // If we have an ISP tear it down ++ isp_remove(s, de); ++ de->port_in = de->display->input[0]; ++ ++ // If we still need an ISP create it now ++ if (avfmt_needs_isp(fr->format)) ++ { ++ if (mmal_component_create("vc.ril.isp", &de->isp) != MMAL_SUCCESS) ++ { ++ av_log(s, AV_LOG_ERROR, "ISP creation failed\n"); ++ goto fail; ++ } ++ de->port_in = de->isp->input[0]; ++ } ++ ++ mmal_format_copy(de->port_in->format, &new_es); ++ ++ if (mmal_port_format_commit(de->port_in)) { ++ av_log(s, AV_LOG_ERROR, "Failed to commit input format\n"); ++ goto fail; ++ } ++ ++ // If we have an ISP then we must want to use it ++ if (de->isp != NULL) { ++ MMAL_PORT_T * const port_out = de->isp->output[0]; ++ MMAL_VIDEO_FORMAT_T* vfmt_in = &de->port_in->format->es->video; ++ MMAL_VIDEO_FORMAT_T* vfmt_out = &port_out->format->es->video; ++ ++ port_out->format->type = MMAL_ES_TYPE_VIDEO; ++ port_out->format->encoding = MMAL_ENCODING_YUVUV128; ++ port_out->format->encoding_variant = 0; ++ port_out->format->bitrate = 0; ++ port_out->format->flags = 0; ++ port_out->format->extradata = NULL; ++ port_out->format->extradata_size = 0; ++ ++ vfmt_out->width = (vfmt_in->crop.width + 31) & ~31; ++ vfmt_out->height = (vfmt_in->crop.height + 15) & ~15; ++ vfmt_out->crop.x = 0; ++ vfmt_out->crop.y = 0; ++ vfmt_out->crop.width = vfmt_in->crop.width; ++ vfmt_out->crop.height = vfmt_in->crop.height; ++ vfmt_out->frame_rate = vfmt_in->frame_rate; ++ vfmt_out->par = vfmt_in->par; ++ vfmt_out->color_space = vfmt_in->color_space; ++ ++ if (mmal_port_format_commit(port_out)) { ++ av_log(s, AV_LOG_ERROR, "Failed to commit output format\n"); ++ goto fail; ++ } ++ ++ if (mmal_connection_create(&de->conn, port_out, de->display->input[0], MMAL_CONNECTION_FLAG_TUNNELLING) != MMAL_SUCCESS) { ++ av_log(s, AV_LOG_ERROR, "Failed to create connection\n"); ++ goto fail; ++ } ++ if (mmal_connection_enable(de->conn) != MMAL_SUCCESS) { ++ av_log(s, AV_LOG_ERROR, "Failed to enable connection\n"); ++ goto fail; ++ } ++ mmal_port_enable(de->isp->control,display_cb_control); ++ mmal_component_enable(de->isp); ++ } ++ ++ // Number of slots in my port Q ++ de->port_in->buffer_num = DISPLAY_PORT_DEPTH; ++ // Size to keep it happy - isn't used for anything other than error checking ++ de->port_in->buffer_size = buf->alloc_size; ++ if (!de->port_in->is_enabled) ++ { ++ mmal_port_parameter_set_boolean(de->port_in, MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); // Does this mark that the buffer contains a vc_handle? Would have expected a vc_image? ++ if (mmal_port_enable(de->port_in, display_cb_input) != MMAL_SUCCESS) { ++ av_log(s, AV_LOG_ERROR, "Failed to enable input port\n"); ++ goto fail; ++ } ++ } ++ ++ de->req_fmt = new_es.encoding; ++ de->req_vfmt = *new_vfmt; ++ } ++ } ++ ++ if (mmal_port_send_buffer(de->port_in, buf) != MMAL_SUCCESS) ++ { ++ av_log(s, AV_LOG_ERROR, "mmal_port_send_buffer failed: depth=%d\n", de->rpi_display_count); ++ goto fail; ++ } ++ return; ++ ++fail: ++ // If we have a buf then fr_buf is held by that ++ if (buf != NULL) ++ mmal_buffer_header_release(buf); ++ else if (fr_buf != NULL) ++ av_rpi_zc_unref(fr_buf); ++} ++ ++ ++static int xv_write_trailer(AVFormatContext *s) ++{ ++ rpi_display_env_t * const de = s->priv_data; ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s\n", __func__); ++#endif ++ if (de->port_in != NULL && de->port_in->is_enabled) { ++ mmal_port_disable(de->port_in); ++ } ++ ++ // The above disable should kick out all buffers - check that ++ if (atomic_load(&de->rpi_display_count) != 0) { ++ av_log(s, AV_LOG_WARNING, "Exiting with display count non-zero:%d\n", atomic_load(&de->rpi_display_count)); ++ } ++ ++ isp_remove(s, de); ++ if (de->rpi_pool != NULL) { ++ mmal_pool_destroy(de->rpi_pool); ++ de->rpi_pool = NULL; ++ } ++ if (de->display != NULL) { ++ mmal_component_destroy(de->display); ++ de->display = NULL; ++ } ++ ++ return 0; ++} ++ ++static int xv_write_header(AVFormatContext *s) ++{ ++ rpi_display_env_t * const de = s->priv_data; ++ const AVCodecParameters * const par = s->streams[0]->codecpar; ++ const unsigned int w = de->window_width ? de->window_width : par->width; ++ const unsigned int h = de->window_height ? de->window_height : par->height; ++ const unsigned int x = de->window_x; ++ const unsigned int y = de->window_y; ++ const int layer = de->layer ? de->layer : 2; ++ const MMAL_BOOL_T fullscreen = de->fullscreen; ++ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s: %dx%d\n", __func__, w, h); ++#endif ++ if ( s->nb_streams > 1 ++ || par->codec_type != AVMEDIA_TYPE_VIDEO ++ || par->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME) { ++ av_log(s, AV_LOG_ERROR, "Only supports one wrapped avframe stream\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ { ++ MMAL_DISPLAYREGION_T region = ++ { ++ .hdr = {MMAL_PARAMETER_DISPLAYREGION, sizeof(region)}, ++ .set = MMAL_DISPLAY_SET_LAYER | MMAL_DISPLAY_SET_FULLSCREEN | ++ MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_ALPHA, ++ .layer = layer, ++ .fullscreen = fullscreen, ++ .dest_rect = {x, y, w, h}, ++ .alpha = !fullscreen ? 0xff : 0xff | MMAL_DISPLAY_ALPHA_FLAGS_DISCARD_LOWER_LAYERS, ++ }; ++ ++ bcm_host_init(); // Needs to be done by someone... ++ ++ if (mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &de->display) != MMAL_SUCCESS) ++ { ++ av_log(s, AV_LOG_ERROR, "Failed to create display component\n"); ++ goto fail; ++ } ++ de->port_in = de->display->input[0]; ++ ++ mmal_port_parameter_set(de->display->input[0], ®ion.hdr); ++ ++ if (mmal_component_enable(de->display) != MMAL_SUCCESS) ++ { ++ av_log(s, AV_LOG_ERROR, "Failed to enable display component\n"); ++ goto fail; ++ } ++ if (mmal_port_enable(de->display->control,display_cb_control) != MMAL_SUCCESS) ++ { ++ av_log(s, AV_LOG_ERROR, "Failed to enable display control port\n"); ++ goto fail; ++ } ++ ++ if ((de->rpi_pool = mmal_pool_create(DISPLAY_PORT_DEPTH, 0)) == NULL) ++ { ++ av_log(s, AV_LOG_ERROR, "Failed to create pool\n"); ++ goto fail; ++ } ++ } ++ ++ return 0; ++ ++fail: ++ xv_write_trailer(s); ++ return AVERROR_UNKNOWN; ++} ++ ++static int xv_write_packet(AVFormatContext *s, AVPacket *pkt) ++{ ++ AVFrame * const frame = (AVFrame *)pkt->data; ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s\n", __func__); ++#endif ++ display_frame(s, s->priv_data, frame); ++ return 0; ++} ++ ++static int xv_write_frame(AVFormatContext *s, int stream_index, AVFrame **ppframe, ++ unsigned flags) ++{ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s: idx=%d, flags=%#x\n", __func__, stream_index, flags); ++#endif ++ ++ /* xv_write_header() should have accepted only supported formats */ ++ if ((flags & AV_WRITE_UNCODED_FRAME_QUERY)) ++ return 0; ++// return write_picture(s, (*frame)->data, (*frame)->linesize); ++ ++ display_frame(s, s->priv_data, *ppframe); ++ return 0; ++} ++ ++static int xv_control_message(AVFormatContext *s, int type, void *data, size_t data_size) ++{ ++#if TRACE_ALL ++ av_log(s, AV_LOG_INFO, "%s: %d\n", __func__, type); ++#endif ++ switch(type) { ++ case AV_APP_TO_DEV_WINDOW_REPAINT: ++ return 0; ++ default: ++ break; ++ } ++ return AVERROR(ENOSYS); ++} ++ ++// deinit is called if init fails so no need to clean up explicity here ++static int rpi_vout_init(struct AVFormatContext * s) ++{ ++ rpi_display_env_t * const de = s->priv_data; ++ ++ // Get a ZC context in case we need one - has little overhead if unused ++ if ((de->zc = av_rpi_zc_int_env_alloc(s)) == NULL) ++ return 1; ++ ++ return 0; ++} ++ ++static void rpi_vout_deinit(struct AVFormatContext * s) ++{ ++ rpi_display_env_t * const de = s->priv_data; ++ ++ av_rpi_zc_int_env_freep(&de->zc); ++} ++ ++ ++#define OFFSET(x) offsetof(rpi_display_env_t, x) ++static const AVOption options[] = { ++ { "show_all", "show all frames", OFFSET(show_all), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "window_size", "set window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "window_x", "set window x offset", OFFSET(window_x), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "window_y", "set window y offset", OFFSET(window_y), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "display_layer","set display layer", OFFSET(layer), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, ++ { "fullscreen", "set fullscreen display", OFFSET(fullscreen), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, ++ { NULL } ++ ++}; ++ ++static const AVClass xv_class = { ++ .class_name = "rpi vid outdev", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++ .category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, ++}; ++ ++AVOutputFormat ff_vout_rpi_muxer = { ++ .name = "vout_rpi", ++ .long_name = NULL_IF_CONFIG_SMALL("Rpi (mmal) video output device"), ++ .priv_data_size = sizeof(rpi_display_env_t), ++ .audio_codec = AV_CODEC_ID_NONE, ++ .video_codec = AV_CODEC_ID_WRAPPED_AVFRAME, ++ .write_header = xv_write_header, ++ .write_packet = xv_write_packet, ++ .write_uncoded_frame = xv_write_frame, ++ .write_trailer = xv_write_trailer, ++ .control_message = xv_control_message, ++ .flags = AVFMT_NOFILE | AVFMT_VARIABLE_FPS | AVFMT_NOTIMESTAMPS, ++ .priv_class = &xv_class, ++ .init = rpi_vout_init, ++ .deinit = rpi_vout_deinit, ++}; +--- a/libavfilter/Makefile ++++ b/libavfilter/Makefile +@@ -218,6 +218,7 @@ OBJS-$(CONFIG_DEFLATE_FILTER) + OBJS-$(CONFIG_DEFLICKER_FILTER) += vf_deflicker.o + OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER) += vf_deinterlace_qsv.o + OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER) += vf_deinterlace_vaapi.o vaapi_vpp.o ++OBJS-$(CONFIG_DEINTERLACE_V4L2M2M_FILTER) += vf_deinterlace_v4l2m2m.o + OBJS-$(CONFIG_DEJUDDER_FILTER) += vf_dejudder.o + OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o + OBJS-$(CONFIG_DENOISE_VAAPI_FILTER) += vf_misc_vaapi.o vaapi_vpp.o +@@ -434,6 +435,7 @@ OBJS-$(CONFIG_TRANSPOSE_OPENCL_FILTER) + OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER) += vf_transpose_vaapi.o vaapi_vpp.o + OBJS-$(CONFIG_TRIM_FILTER) += trim.o + OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += vf_premultiply.o framesync.o ++OBJS-$(CONFIG_UNSAND_FILTER) += vf_unsand.o + OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o + OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) += vf_unsharp_opencl.o opencl.o \ + opencl/unsharp.o +--- a/libavfilter/allfilters.c ++++ b/libavfilter/allfilters.c +@@ -204,6 +204,7 @@ extern AVFilter ff_vf_dedot; + extern AVFilter ff_vf_deflate; + extern AVFilter ff_vf_deflicker; + extern AVFilter ff_vf_deinterlace_qsv; ++extern AVFilter ff_vf_deinterlace_v4l2m2m; + extern AVFilter ff_vf_deinterlace_vaapi; + extern AVFilter ff_vf_dejudder; + extern AVFilter ff_vf_delogo; +@@ -414,6 +415,7 @@ extern AVFilter ff_vf_transpose_opencl; + extern AVFilter ff_vf_transpose_vaapi; + extern AVFilter ff_vf_trim; + extern AVFilter ff_vf_unpremultiply; ++extern AVFilter ff_vf_unsand; + extern AVFilter ff_vf_unsharp; + extern AVFilter ff_vf_unsharp_opencl; + extern AVFilter ff_vf_untile; +--- a/libavfilter/avfiltergraph.c ++++ b/libavfilter/avfiltergraph.c +@@ -32,6 +32,9 @@ + #include "libavutil/internal.h" + #include "libavutil/opt.h" + #include "libavutil/pixdesc.h" ++#if CONFIG_UNSAND_FILTER ++#include "libavutil/rpi_sand_fns.h" ++#endif + + #define FF_INTERNAL_FIELDS 1 + #include "framequeue.h" +@@ -427,6 +430,19 @@ static int can_merge_formats(AVFilterFor + } + } + ++#if CONFIG_UNSAND_FILTER ++static int has_sand_format(const AVFilterFormats * const ff) ++{ ++ int i; ++ for (i = 0; i != ff->nb_formats; ++i) { ++ if (av_rpi_is_sand_format(ff->formats[i])) { ++ return 1; ++ } ++ } ++ return 0; ++} ++#endif ++ + /** + * Perform one round of query_formats() and merging formats lists on the + * filter graph. +@@ -467,6 +483,7 @@ static int query_formats(AVFilterGraph * + for (j = 0; j < filter->nb_inputs; j++) { + AVFilterLink *link = filter->inputs[j]; + int convert_needed = 0; ++ unsigned int extra_convert_tried = 0; + + if (!link) + continue; +@@ -514,11 +531,14 @@ static int query_formats(AVFilterGraph * + ) + #undef MERGE_DISPATCH + +- if (convert_needed) { ++ while (convert_needed) { + AVFilterContext *convert; + const AVFilter *filter; + AVFilterLink *inlink, *outlink; + char inst_name[30]; ++ int can_retry = 0; ++ ++ convert_needed = 0; + + if (graph->disable_auto_convert) { + av_log(log_ctx, AV_LOG_ERROR, +@@ -531,19 +551,45 @@ static int query_formats(AVFilterGraph * + /* couldn't merge format lists. auto-insert conversion filter */ + switch (link->type) { + case AVMEDIA_TYPE_VIDEO: +- if (!(filter = avfilter_get_by_name("scale"))) { +- av_log(log_ctx, AV_LOG_ERROR, "'scale' filter " +- "not present, cannot convert pixel formats.\n"); +- return AVERROR(EINVAL); +- } +- +- snprintf(inst_name, sizeof(inst_name), "auto_scaler_%d", +- scaler_count++); ++#if CONFIG_UNSAND_FILTER ++ // Only try each extra conversion once ++ // The unsand output pad should never trigger has_sand_format ++ // but it is better to be safe ++ if ((extra_convert_tried & 1) == 0 && has_sand_format(link->in_formats)) { ++ if (!(filter = avfilter_get_by_name("unsand"))) { ++ av_log(log_ctx, AV_LOG_ERROR, "'unsand' filter " ++ "not present, cannot convert pixel formats.\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ snprintf(inst_name, sizeof(inst_name), "auto_unsand_%d", ++ scaler_count++); ++ ++ if ((ret = avfilter_graph_create_filter(&convert, filter, ++ inst_name, "", NULL, ++ graph)) < 0) ++ return ret; + +- if ((ret = avfilter_graph_create_filter(&convert, filter, +- inst_name, graph->scale_sws_opts, NULL, +- graph)) < 0) +- return ret; ++ extra_convert_tried |= 1; ++ can_retry = 1; ++ } ++ else ++#endif ++ { ++ if (!(filter = avfilter_get_by_name("scale"))) { ++ av_log(log_ctx, AV_LOG_ERROR, "'scale' filter " ++ "not present, cannot convert pixel formats.\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ snprintf(inst_name, sizeof(inst_name), "auto_scaler_%d", ++ scaler_count++); ++ ++ if ((ret = avfilter_graph_create_filter(&convert, filter, ++ inst_name, graph->scale_sws_opts, NULL, ++ graph)) < 0) ++ return ret; ++ } + break; + case AVMEDIA_TYPE_AUDIO: + if (!(filter = avfilter_get_by_name("aresample"))) { +@@ -585,9 +631,19 @@ static int query_formats(AVFilterGraph * + av_assert0(outlink-> in_channel_layouts->refcount > 0); + av_assert0(outlink->out_channel_layouts->refcount > 0); + } +- if (!ff_merge_formats( inlink->in_formats, inlink->out_formats, inlink->type) || +- !ff_merge_formats(outlink->in_formats, outlink->out_formats, outlink->type)) ++ // If we have added an extra filter we must merge the input ++ // side but we can have another go at the output ++ if (!ff_merge_formats( inlink->in_formats, inlink->out_formats, inlink->type)) + ret = AVERROR(ENOSYS); ++ else if (!ff_merge_formats(outlink->in_formats, outlink->out_formats, outlink->type)) ++ { ++ if (can_retry) { ++ link = outlink; ++ convert_needed = 1; ++ continue; ++ } ++ ret = AVERROR(ENOSYS); ++ } + if (inlink->type == AVMEDIA_TYPE_AUDIO && + (!ff_merge_samplerates(inlink->in_samplerates, + inlink->out_samplerates) || +--- a/libavfilter/buffersrc.c ++++ b/libavfilter/buffersrc.c +@@ -210,7 +210,7 @@ static int av_buffersrc_add_frame_intern + + switch (ctx->outputs[0]->type) { + case AVMEDIA_TYPE_VIDEO: +- CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height, ++ CHECK_VIDEO_PARAM_CHANGE(ctx, s, av_frame_cropped_width(frame), av_frame_cropped_height(frame), + frame->format, frame->pts); + break; + case AVMEDIA_TYPE_AUDIO: +--- /dev/null ++++ b/libavfilter/vf_deinterlace_v4l2m2m.c +@@ -0,0 +1,1336 @@ ++/* ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++/** ++ * @file ++ * deinterlace video filter - V4L2 M2M ++ */ ++ ++#include ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "libavutil/avassert.h" ++#include "libavutil/avstring.h" ++#include "libavutil/common.h" ++#include "libavutil/hwcontext.h" ++#include "libavutil/hwcontext_drm.h" ++#include "libavutil/internal.h" ++#include "libavutil/mathematics.h" ++#include "libavutil/opt.h" ++#include "libavutil/pixdesc.h" ++#include "libavutil/time.h" ++ ++#define FF_INTERNAL_FIELDS 1 ++#include "framequeue.h" ++#include "filters.h" ++#include "avfilter.h" ++#include "formats.h" ++#include "internal.h" ++#include "video.h" ++ ++typedef struct V4L2Queue V4L2Queue; ++typedef struct DeintV4L2M2MContextShared DeintV4L2M2MContextShared; ++ ++typedef struct V4L2PlaneInfo { ++ int bytesperline; ++ size_t length; ++} V4L2PlaneInfo; ++ ++typedef struct V4L2Buffer { ++ int enqueued; ++ int reenqueue; ++ int fd; ++ struct v4l2_buffer buffer; ++ AVFrame frame; ++ struct v4l2_plane planes[VIDEO_MAX_PLANES]; ++ int num_planes; ++ V4L2PlaneInfo plane_info[VIDEO_MAX_PLANES]; ++ AVDRMFrameDescriptor drm_frame; ++ V4L2Queue *q; ++} V4L2Buffer; ++ ++typedef struct V4L2Queue { ++ struct v4l2_format format; ++ int num_buffers; ++ V4L2Buffer *buffers; ++ DeintV4L2M2MContextShared *ctx; ++} V4L2Queue; ++ ++typedef struct pts_stats_s ++{ ++ void * logctx; ++ const char * name; // For debug ++ unsigned int last_count; ++ unsigned int last_interval; ++ int64_t last_pts; ++} pts_stats_t; ++ ++#define PTS_TRACK_SIZE 32 ++typedef struct pts_track_el_s ++{ ++ uint32_t n; ++ unsigned int interval; ++ AVFrame * props; ++} pts_track_el_t; ++ ++typedef struct pts_track_s ++{ ++ uint32_t n; ++ uint32_t last_n; ++ int got_2; ++ void * logctx; ++ pts_stats_t stats; ++ pts_track_el_t a[PTS_TRACK_SIZE]; ++} pts_track_t; ++ ++typedef struct DeintV4L2M2MContextShared { ++ void * logctx; // For logging - will be NULL when done ++ ++ int fd; ++ int done; ++ int width; ++ int height; ++ int orig_width; ++ int orig_height; ++ atomic_uint refcount; ++ ++ AVBufferRef *hw_frames_ctx; ++ ++ unsigned int field_order; ++ ++ pts_track_t track; ++ ++ V4L2Queue output; ++ V4L2Queue capture; ++} DeintV4L2M2MContextShared; ++ ++typedef struct DeintV4L2M2MContext { ++ const AVClass *class; ++ ++ DeintV4L2M2MContextShared *shared; ++} DeintV4L2M2MContext; ++ ++static unsigned int pts_stats_interval(const pts_stats_t * const stats) ++{ ++ return stats->last_interval; ++} ++ ++// Pick 64 for max last count - that is >1sec at 60fps ++#define STATS_LAST_COUNT_MAX 64 ++#define STATS_INTERVAL_MAX (1 << 30) ++static void pts_stats_add(pts_stats_t * const stats, int64_t pts) ++{ ++ if (pts == AV_NOPTS_VALUE || pts == stats->last_pts) { ++ if (stats->last_count < STATS_LAST_COUNT_MAX) ++ ++stats->last_count; ++ return; ++ } ++ ++ if (stats->last_pts != AV_NOPTS_VALUE) { ++ const int64_t interval = pts - stats->last_pts; ++ ++ if (interval < 0 || interval >= STATS_INTERVAL_MAX || ++ stats->last_count >= STATS_LAST_COUNT_MAX) { ++ if (stats->last_interval != 0) ++ av_log(stats->logctx, AV_LOG_DEBUG, "%s: %s: Bad interval: %" PRId64 "/%d\n", ++ __func__, stats->name, interval, stats->last_count); ++ stats->last_interval = 0; ++ } ++ else { ++ const int64_t frame_time = interval / (int64_t)stats->last_count; ++ ++ if (frame_time != stats->last_interval) ++ av_log(stats->logctx, AV_LOG_DEBUG, "%s: %s: New interval: %u->%" PRId64 "/%d=%" PRId64 "\n", ++ __func__, stats->name, stats->last_interval, interval, stats->last_count, frame_time); ++ stats->last_interval = frame_time; ++ } ++ } ++ ++ stats->last_pts = pts; ++ stats->last_count = 1; ++} ++ ++static void pts_stats_init(pts_stats_t * const stats, void * logctx, const char * name) ++{ ++ *stats = (pts_stats_t){ ++ .logctx = logctx, ++ .name = name, ++ .last_count = 1, ++ .last_interval = 0, ++ .last_pts = AV_NOPTS_VALUE ++ }; ++} ++ ++static inline uint32_t pts_track_next_n(pts_track_t * const trk) ++{ ++ if (++trk->n == 0) ++ trk->n = 1; ++ return trk->n; ++} ++ ++static int pts_track_get_frame(pts_track_t * const trk, const struct timeval tv, AVFrame * const dst) ++{ ++ uint32_t n = (uint32_t)(tv.tv_usec / 2 + tv.tv_sec * 500000); ++ pts_track_el_t * t; ++ ++ // As a first guess assume that n==0 means last frame ++ if (n == 0) { ++ n = trk->last_n; ++ if (n == 0) ++ goto fail; ++ } ++ ++ t = trk->a + (n & (PTS_TRACK_SIZE - 1)); ++ ++ if (t->n != n) { ++ av_log(trk->logctx, AV_LOG_ERROR, "%s: track failure: got %u, expected %u\n", __func__, n, trk->n); ++ goto fail; ++ } ++ ++ // 1st frame is simple - just believe it ++ if (n != trk->last_n) { ++ trk->last_n = n; ++ trk->got_2 = 0; ++ return av_frame_copy_props(dst, t->props); ++ } ++ ++ // Only believe in a single interpolated frame ++ if (trk->got_2) ++ goto fail; ++ trk->got_2 = 1; ++ ++ av_frame_copy_props(dst, t->props); ++ ++ ++ // If we can't guess - don't ++ if (t->interval == 0) { ++ dst->best_effort_timestamp = AV_NOPTS_VALUE; ++ dst->pts = AV_NOPTS_VALUE; ++ dst->pkt_dts = AV_NOPTS_VALUE; ++ } ++ else { ++ if (dst->best_effort_timestamp != AV_NOPTS_VALUE) ++ dst->best_effort_timestamp += t->interval / 2; ++ if (dst->pts != AV_NOPTS_VALUE) ++ dst->pts += t->interval / 2; ++ if (dst->pkt_dts != AV_NOPTS_VALUE) ++ dst->pkt_dts += t->interval / 2; ++ } ++ ++ return 0; ++ ++fail: ++ trk->last_n = 0; ++ trk->got_2 = 0; ++ dst->pts = AV_NOPTS_VALUE; ++ dst->pkt_dts = AV_NOPTS_VALUE; ++ return 0; ++} ++ ++static struct timeval pts_track_add_frame(pts_track_t * const trk, const AVFrame * const src) ++{ ++ const uint32_t n = pts_track_next_n(trk); ++ pts_track_el_t * const t = trk->a + (n & (PTS_TRACK_SIZE - 1)); ++ ++ pts_stats_add(&trk->stats, src->pts); ++ ++ t->n = n; ++ t->interval = pts_stats_interval(&trk->stats); // guess that next interval is the same as the last ++ av_frame_unref(t->props); ++ av_frame_copy_props(t->props, src); ++ ++ // We now know what the previous interval was, rather than having to guess, ++ // so set it. There is a better than decent chance that this is before ++ // we use it. ++ if (t->interval != 0) { ++ pts_track_el_t * const prev_t = trk->a + ((n - 1) & (PTS_TRACK_SIZE - 1)); ++ prev_t->interval = t->interval; ++ } ++ ++ // In case deinterlace interpolates frames use every other usec ++ return (struct timeval){.tv_sec = n / 500000, .tv_usec = (n % 500000) * 2}; ++} ++ ++static void pts_track_uninit(pts_track_t * const trk) ++{ ++ unsigned int i; ++ for (i = 0; i != PTS_TRACK_SIZE; ++i) { ++ trk->a[i].n = 0; ++ av_frame_free(&trk->a[i].props); ++ } ++} ++ ++static int pts_track_init(pts_track_t * const trk, void *logctx) ++{ ++ unsigned int i; ++ trk->n = 1; ++ pts_stats_init(&trk->stats, logctx, "track"); ++ for (i = 0; i != PTS_TRACK_SIZE; ++i) { ++ trk->a[i].n = 0; ++ if ((trk->a[i].props = av_frame_alloc()) == NULL) { ++ pts_track_uninit(trk); ++ return AVERROR(ENOMEM); ++ } ++ } ++ return 0; ++} ++ ++static int deint_v4l2m2m_prepare_context(DeintV4L2M2MContextShared *ctx) ++{ ++ struct v4l2_capability cap; ++ int ret; ++ ++ memset(&cap, 0, sizeof(cap)); ++ ret = ioctl(ctx->fd, VIDIOC_QUERYCAP, &cap); ++ if (ret < 0) ++ return ret; ++ ++ if (!(cap.capabilities & V4L2_CAP_STREAMING)) ++ return AVERROR(EINVAL); ++ ++ if (cap.capabilities & V4L2_CAP_VIDEO_M2M) { ++ ctx->capture.format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ ctx->output.format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ++ ++ return 0; ++ } ++ ++ if (cap.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE) { ++ ctx->capture.format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; ++ ctx->output.format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; ++ ++ return 0; ++ } ++ ++ return AVERROR(EINVAL); ++} ++ ++static int deint_v4l2m2m_try_format(V4L2Queue *queue) ++{ ++ struct v4l2_format *fmt = &queue->format; ++ DeintV4L2M2MContextShared *ctx = queue->ctx; ++ int ret, field; ++ ++ ret = ioctl(ctx->fd, VIDIOC_G_FMT, fmt); ++ if (ret) ++ av_log(ctx->logctx, AV_LOG_ERROR, "VIDIOC_G_FMT failed: %d\n", ret); ++ ++ if (V4L2_TYPE_IS_OUTPUT(fmt->type)) ++ field = V4L2_FIELD_INTERLACED_TB; ++ else ++ field = V4L2_FIELD_NONE; ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(fmt->type)) { ++ fmt->fmt.pix_mp.pixelformat = V4L2_PIX_FMT_YUV420; ++ fmt->fmt.pix_mp.field = field; ++ fmt->fmt.pix_mp.width = ctx->width; ++ fmt->fmt.pix_mp.height = ctx->height; ++ } else { ++ fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420; ++ fmt->fmt.pix.field = field; ++ fmt->fmt.pix.width = ctx->width; ++ fmt->fmt.pix.height = ctx->height; ++ } ++ ++ av_log(ctx->logctx, AV_LOG_DEBUG, "%s: Trying format for type %d, wxh: %dx%d, fmt: %08x, size %u bpl %u pre\n", __func__, ++ fmt->type, fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height, ++ fmt->fmt.pix_mp.pixelformat, ++ fmt->fmt.pix_mp.plane_fmt[0].sizeimage, fmt->fmt.pix_mp.plane_fmt[0].bytesperline); ++ ++ ret = ioctl(ctx->fd, VIDIOC_TRY_FMT, fmt); ++ if (ret) ++ return AVERROR(EINVAL); ++ ++ av_log(ctx->logctx, AV_LOG_DEBUG, "%s: Trying format for type %d, wxh: %dx%d, fmt: %08x, size %u bpl %u post\n", __func__, ++ fmt->type, fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height, ++ fmt->fmt.pix_mp.pixelformat, ++ fmt->fmt.pix_mp.plane_fmt[0].sizeimage, fmt->fmt.pix_mp.plane_fmt[0].bytesperline); ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(fmt->type)) { ++ if ((fmt->fmt.pix_mp.pixelformat != V4L2_PIX_FMT_YUV420 && ++ fmt->fmt.pix_mp.pixelformat != V4L2_PIX_FMT_NV12) || ++ fmt->fmt.pix_mp.field != field) { ++ av_log(ctx->logctx, AV_LOG_DEBUG, "format not supported for type %d\n", fmt->type); ++ ++ return AVERROR(EINVAL); ++ } ++ } else { ++ if ((fmt->fmt.pix.pixelformat != V4L2_PIX_FMT_YUV420 && ++ fmt->fmt.pix.pixelformat != V4L2_PIX_FMT_NV12) || ++ fmt->fmt.pix.field != field) { ++ av_log(ctx->logctx, AV_LOG_DEBUG, "format not supported for type %d\n", fmt->type); ++ ++ return AVERROR(EINVAL); ++ } ++ } ++ ++ return 0; ++} ++ ++static int deint_v4l2m2m_set_format(V4L2Queue *queue, uint32_t pixelformat, uint32_t field, int width, int height, int pitch, int ysize) ++{ ++ struct v4l2_format *fmt = &queue->format; ++ DeintV4L2M2MContextShared *ctx = queue->ctx; ++ int ret; ++ ++ struct v4l2_selection sel = { ++ .type = fmt->type, ++ .target = V4L2_TYPE_IS_OUTPUT(fmt->type) ? V4L2_SEL_TGT_CROP_BOUNDS : V4L2_SEL_TGT_COMPOSE_BOUNDS, ++ }; ++ ++ // This works for most single object 4:2:0 types ++ if (V4L2_TYPE_IS_MULTIPLANAR(fmt->type)) { ++ fmt->fmt.pix_mp.pixelformat = pixelformat; ++ fmt->fmt.pix_mp.field = field; ++ fmt->fmt.pix_mp.width = width; ++ fmt->fmt.pix_mp.height = ysize / pitch; ++ fmt->fmt.pix_mp.plane_fmt[0].bytesperline = pitch; ++ fmt->fmt.pix_mp.plane_fmt[0].sizeimage = ysize + (ysize >> 1); ++ } else { ++ fmt->fmt.pix.pixelformat = pixelformat; ++ fmt->fmt.pix.field = field; ++ fmt->fmt.pix.width = width; ++ fmt->fmt.pix.height = height; ++ fmt->fmt.pix.sizeimage = 0; ++ fmt->fmt.pix.bytesperline = 0; ++ } ++ ++ ret = ioctl(ctx->fd, VIDIOC_S_FMT, fmt); ++ if (ret) { ++ ret = AVERROR(errno); ++ av_log(ctx->logctx, AV_LOG_ERROR, "VIDIOC_S_FMT failed: %d\n", ret); ++ return ret; ++ } ++ ++ if (pixelformat != fmt->fmt.pix.pixelformat) { ++ av_log(ctx->logctx, AV_LOG_ERROR, "Format not supported: %s; S_FMT returned %s\n", av_fourcc2str(pixelformat), av_fourcc2str(fmt->fmt.pix.pixelformat)); ++ return AVERROR(EINVAL); ++ } ++ ++ ret = ioctl(ctx->fd, VIDIOC_G_SELECTION, &sel); ++ if (ret) { ++ ret = AVERROR(errno); ++ av_log(ctx->logctx, AV_LOG_WARNING, "VIDIOC_G_SELECTION failed: %d\n", ret); ++ } ++ ++ sel.r.width = width; ++ sel.r.height = height; ++ sel.r.left = 0; ++ sel.r.top = 0; ++ sel.target = V4L2_TYPE_IS_OUTPUT(fmt->type) ? V4L2_SEL_TGT_CROP : V4L2_SEL_TGT_COMPOSE, ++ sel.flags = V4L2_SEL_FLAG_LE; ++ ++ ret = ioctl(ctx->fd, VIDIOC_S_SELECTION, &sel); ++ if (ret) { ++ ret = AVERROR(errno); ++ av_log(ctx->logctx, AV_LOG_WARNING, "VIDIOC_S_SELECTION failed: %d\n", ret); ++ } ++ ++ return 0; ++} ++ ++static int deint_v4l2m2m_probe_device(DeintV4L2M2MContextShared *ctx, char *node) ++{ ++ int ret; ++ ++ ctx->fd = open(node, O_RDWR | O_NONBLOCK, 0); ++ if (ctx->fd < 0) ++ return AVERROR(errno); ++ ++ ret = deint_v4l2m2m_prepare_context(ctx); ++ if (ret) ++ goto fail; ++ ++ ret = deint_v4l2m2m_try_format(&ctx->capture); ++ if (ret) ++ goto fail; ++ ++ ret = deint_v4l2m2m_try_format(&ctx->output); ++ if (ret) ++ goto fail; ++ ++ return 0; ++ ++fail: ++ close(ctx->fd); ++ ctx->fd = -1; ++ ++ return ret; ++} ++ ++static int deint_v4l2m2m_find_device(DeintV4L2M2MContextShared *ctx) ++{ ++ int ret = AVERROR(EINVAL); ++ struct dirent *entry; ++ char node[PATH_MAX]; ++ DIR *dirp; ++ ++ dirp = opendir("/dev"); ++ if (!dirp) ++ return AVERROR(errno); ++ ++ for (entry = readdir(dirp); entry; entry = readdir(dirp)) { ++ ++ if (strncmp(entry->d_name, "video", 5)) ++ continue; ++ ++ snprintf(node, sizeof(node), "/dev/%s", entry->d_name); ++ av_log(ctx->logctx, AV_LOG_DEBUG, "probing device %s\n", node); ++ ret = deint_v4l2m2m_probe_device(ctx, node); ++ if (!ret) ++ break; ++ } ++ ++ closedir(dirp); ++ ++ if (ret) { ++ av_log(ctx->logctx, AV_LOG_ERROR, "Could not find a valid device\n"); ++ ctx->fd = -1; ++ ++ return ret; ++ } ++ ++ av_log(ctx->logctx, AV_LOG_INFO, "Using device %s\n", node); ++ ++ return 0; ++} ++ ++static int deint_v4l2m2m_enqueue_buffer(V4L2Buffer *buf) ++{ ++ int ret; ++ ++ ret = ioctl(buf->q->ctx->fd, VIDIOC_QBUF, &buf->buffer); ++ if (ret < 0) ++ return AVERROR(errno); ++ ++ buf->enqueued = 1; ++ ++ return 0; ++} ++ ++static int v4l2_buffer_export_drm(V4L2Buffer* avbuf, const uint32_t pixelformat) ++{ ++ struct v4l2_exportbuffer expbuf; ++ int i, ret; ++ uint64_t mod = DRM_FORMAT_MOD_LINEAR; ++ uint32_t fmt = 0; ++ ++ switch (pixelformat) { ++ case V4L2_PIX_FMT_NV12: ++ fmt = DRM_FORMAT_NV12; ++ break; ++ case V4L2_PIX_FMT_YUV420: ++ fmt = DRM_FORMAT_YUV420; ++ break; ++ default: ++ return AVERROR(EINVAL); ++ } ++ ++ avbuf->drm_frame.layers[0].format = fmt; ++ ++ for (i = 0; i < avbuf->num_planes; i++) { ++ memset(&expbuf, 0, sizeof(expbuf)); ++ ++ expbuf.index = avbuf->buffer.index; ++ expbuf.type = avbuf->buffer.type; ++ expbuf.plane = i; ++ ++ ret = ioctl(avbuf->q->ctx->fd, VIDIOC_EXPBUF, &expbuf); ++ if (ret < 0) ++ return AVERROR(errno); ++ ++ avbuf->fd = expbuf.fd; ++ ++ if (V4L2_TYPE_IS_MULTIPLANAR(avbuf->buffer.type)) { ++ /* drm frame */ ++ avbuf->drm_frame.objects[i].size = avbuf->buffer.m.planes[i].length; ++ avbuf->drm_frame.objects[i].fd = expbuf.fd; ++ avbuf->drm_frame.objects[i].format_modifier = mod; ++ } else { ++ /* drm frame */ ++ avbuf->drm_frame.objects[0].size = avbuf->buffer.length; ++ avbuf->drm_frame.objects[0].fd = expbuf.fd; ++ avbuf->drm_frame.objects[0].format_modifier = mod; ++ } ++ } ++ ++ return 0; ++} ++ ++static int deint_v4l2m2m_allocate_buffers(V4L2Queue *queue) ++{ ++ struct v4l2_format *fmt = &queue->format; ++ DeintV4L2M2MContextShared *ctx = queue->ctx; ++ struct v4l2_requestbuffers req; ++ int ret, i, j, multiplanar; ++ uint32_t memory; ++ ++ memory = V4L2_TYPE_IS_OUTPUT(fmt->type) ? ++ V4L2_MEMORY_DMABUF : V4L2_MEMORY_MMAP; ++ ++ multiplanar = V4L2_TYPE_IS_MULTIPLANAR(fmt->type); ++ ++ memset(&req, 0, sizeof(req)); ++ req.count = queue->num_buffers; ++ req.memory = memory; ++ req.type = fmt->type; ++ ++ ret = ioctl(ctx->fd, VIDIOC_REQBUFS, &req); ++ if (ret < 0) { ++ av_log(ctx->logctx, AV_LOG_ERROR, "VIDIOC_REQBUFS failed: %s\n", strerror(errno)); ++ ++ return AVERROR(errno); ++ } ++ ++ queue->num_buffers = req.count; ++ queue->buffers = av_mallocz(queue->num_buffers * sizeof(V4L2Buffer)); ++ if (!queue->buffers) { ++ av_log(ctx->logctx, AV_LOG_ERROR, "malloc enomem\n"); ++ ++ return AVERROR(ENOMEM); ++ } ++ ++ for (i = 0; i < queue->num_buffers; i++) { ++ V4L2Buffer *buf = &queue->buffers[i]; ++ ++ buf->enqueued = 0; ++ buf->fd = -1; ++ buf->q = queue; ++ ++ buf->buffer.type = fmt->type; ++ buf->buffer.memory = memory; ++ buf->buffer.index = i; ++ ++ if (multiplanar) { ++ buf->buffer.length = VIDEO_MAX_PLANES; ++ buf->buffer.m.planes = buf->planes; ++ } ++ ++ ret = ioctl(ctx->fd, VIDIOC_QUERYBUF, &buf->buffer); ++ if (ret < 0) { ++ ret = AVERROR(errno); ++ ++ goto fail; ++ } ++ ++ if (multiplanar) ++ buf->num_planes = buf->buffer.length; ++ else ++ buf->num_planes = 1; ++ ++ for (j = 0; j < buf->num_planes; j++) { ++ V4L2PlaneInfo *info = &buf->plane_info[j]; ++ ++ if (multiplanar) { ++ info->bytesperline = fmt->fmt.pix_mp.plane_fmt[j].bytesperline; ++ info->length = buf->buffer.m.planes[j].length; ++ } else { ++ info->bytesperline = fmt->fmt.pix.bytesperline; ++ info->length = buf->buffer.length; ++ } ++ } ++ ++ if (!V4L2_TYPE_IS_OUTPUT(fmt->type)) { ++ ret = deint_v4l2m2m_enqueue_buffer(buf); ++ if (ret) ++ goto fail; ++ ++ ret = v4l2_buffer_export_drm(buf, multiplanar ? fmt->fmt.pix_mp.pixelformat : fmt->fmt.pix.pixelformat); ++ if (ret) ++ goto fail; ++ } ++ } ++ ++ return 0; ++ ++fail: ++ for (i = 0; i < queue->num_buffers; i++) ++ if (queue->buffers[i].fd >= 0) ++ close(queue->buffers[i].fd); ++ av_free(queue->buffers); ++ queue->buffers = NULL; ++ ++ return ret; ++} ++ ++static int deint_v4l2m2m_streamon(V4L2Queue *queue) ++{ ++ DeintV4L2M2MContextShared * const ctx = queue->ctx; ++ int type = queue->format.type; ++ int ret; ++ ++ ret = ioctl(ctx->fd, VIDIOC_STREAMON, &type); ++ av_log(ctx->logctx, AV_LOG_DEBUG, "%s: type:%d ret:%d errno:%d\n", __func__, type, ret, AVERROR(errno)); ++ if (ret < 0) ++ return AVERROR(errno); ++ ++ return 0; ++} ++ ++static int deint_v4l2m2m_streamoff(V4L2Queue *queue) ++{ ++ DeintV4L2M2MContextShared * const ctx = queue->ctx; ++ int type = queue->format.type; ++ int ret; ++ ++ ret = ioctl(ctx->fd, VIDIOC_STREAMOFF, &type); ++ av_log(ctx->logctx, AV_LOG_DEBUG, "%s: type:%d ret:%d errno:%d\n", __func__, type, ret, AVERROR(errno)); ++ if (ret < 0) ++ return AVERROR(errno); ++ ++ return 0; ++} ++ ++// timeout in ms ++static V4L2Buffer* deint_v4l2m2m_dequeue_buffer(V4L2Queue *queue, int timeout) ++{ ++ struct v4l2_plane planes[VIDEO_MAX_PLANES]; ++ DeintV4L2M2MContextShared *ctx = queue->ctx; ++ struct v4l2_buffer buf = { 0 }; ++ V4L2Buffer* avbuf = NULL; ++ struct pollfd pfd; ++ short events; ++ int ret; ++ ++ if (V4L2_TYPE_IS_OUTPUT(queue->format.type)) ++ events = POLLOUT | POLLWRNORM; ++ else ++ events = POLLIN | POLLRDNORM; ++ ++ pfd.events = events; ++ pfd.fd = ctx->fd; ++ ++ for (;;) { ++ ret = poll(&pfd, 1, timeout); ++ if (ret > 0) ++ break; ++ if (errno == EINTR) ++ continue; ++ return NULL; ++ } ++ ++ if (pfd.revents & POLLERR) ++ return NULL; ++ ++ if (pfd.revents & events) { ++ memset(&buf, 0, sizeof(buf)); ++ buf.memory = V4L2_MEMORY_MMAP; ++ buf.type = queue->format.type; ++ if (V4L2_TYPE_IS_MULTIPLANAR(queue->format.type)) { ++ memset(planes, 0, sizeof(planes)); ++ buf.length = VIDEO_MAX_PLANES; ++ buf.m.planes = planes; ++ } ++ ++ ret = ioctl(ctx->fd, VIDIOC_DQBUF, &buf); ++ if (ret) { ++ if (errno != EAGAIN) ++ av_log(ctx->logctx, AV_LOG_DEBUG, "VIDIOC_DQBUF, errno (%s)\n", ++ av_err2str(AVERROR(errno))); ++ return NULL; ++ } ++ ++ avbuf = &queue->buffers[buf.index]; ++ avbuf->enqueued = 0; ++ avbuf->buffer = buf; ++ if (V4L2_TYPE_IS_MULTIPLANAR(queue->format.type)) { ++ memcpy(avbuf->planes, planes, sizeof(planes)); ++ avbuf->buffer.m.planes = avbuf->planes; ++ } ++ return avbuf; ++ } ++ ++ return NULL; ++} ++ ++static V4L2Buffer *deint_v4l2m2m_find_free_buf(V4L2Queue *queue) ++{ ++ int i; ++ V4L2Buffer *buf = NULL; ++ ++ for (i = 0; i < queue->num_buffers; i++) ++ if (!queue->buffers[i].enqueued) { ++ buf = &queue->buffers[i]; ++ break; ++ } ++ return buf; ++} ++ ++static void deint_v4l2m2m_unref_queued(V4L2Queue *queue) ++{ ++ int i; ++ V4L2Buffer *buf = NULL; ++ ++ if (!queue || !queue->buffers) ++ return; ++ for (i = 0; i < queue->num_buffers; i++) { ++ buf = &queue->buffers[i]; ++ if (queue->buffers[i].enqueued) ++ av_frame_unref(&buf->frame); ++ } ++} ++ ++static void recycle_q(V4L2Queue * const queue) ++{ ++ V4L2Buffer* avbuf; ++ while (avbuf = deint_v4l2m2m_dequeue_buffer(queue, 0), avbuf) { ++ av_frame_unref(&avbuf->frame); ++ } ++} ++ ++static int count_enqueued(V4L2Queue *queue) ++{ ++ int i; ++ int n = 0; ++ ++ if (queue->buffers == NULL) ++ return 0; ++ ++ for (i = 0; i < queue->num_buffers; i++) ++ if (queue->buffers[i].enqueued) ++ ++n; ++ return n; ++} ++ ++static int deint_v4l2m2m_enqueue_frame(V4L2Queue * const queue, AVFrame * const frame) ++{ ++ DeintV4L2M2MContextShared *const ctx = queue->ctx; ++ AVDRMFrameDescriptor *drm_desc = (AVDRMFrameDescriptor *)frame->data[0]; ++ V4L2Buffer *buf; ++ int i; ++ ++ if (V4L2_TYPE_IS_OUTPUT(queue->format.type)) ++ recycle_q(queue); ++ ++ buf = deint_v4l2m2m_find_free_buf(queue); ++ if (!buf) { ++ av_log(ctx->logctx, AV_LOG_ERROR, "%s: error %d finding free buf\n", __func__, 0); ++ return AVERROR(EAGAIN); ++ } ++ if (V4L2_TYPE_IS_MULTIPLANAR(buf->buffer.type)) ++ for (i = 0; i < drm_desc->nb_objects; i++) ++ buf->buffer.m.planes[i].m.fd = drm_desc->objects[i].fd; ++ else ++ buf->buffer.m.fd = drm_desc->objects[0].fd; ++ ++ buf->buffer.field = !frame->interlaced_frame ? V4L2_FIELD_NONE : ++ frame->top_field_first ? V4L2_FIELD_INTERLACED_TB : ++ V4L2_FIELD_INTERLACED_BT; ++ ++ if (ctx->field_order != buf->buffer.field) { ++ av_log(ctx->logctx, AV_LOG_DEBUG, "%s: Field changed: %d->%d\n", __func__, ctx->field_order, buf->buffer.field); ++ ctx->field_order = buf->buffer.field; ++ } ++ ++ buf->buffer.timestamp = pts_track_add_frame(&ctx->track, frame); ++ ++ buf->drm_frame.objects[0].fd = drm_desc->objects[0].fd; ++ ++ av_frame_move_ref(&buf->frame, frame); ++ ++ return deint_v4l2m2m_enqueue_buffer(buf); ++} ++ ++static void deint_v4l2m2m_destroy_context(DeintV4L2M2MContextShared *ctx) ++{ ++ if (atomic_fetch_sub(&ctx->refcount, 1) == 1) { ++ V4L2Queue *capture = &ctx->capture; ++ V4L2Queue *output = &ctx->output; ++ int i; ++ ++ av_log(NULL, AV_LOG_DEBUG, "%s - destroying context\n", __func__); ++ ++ if (ctx->fd >= 0) { ++ deint_v4l2m2m_streamoff(capture); ++ deint_v4l2m2m_streamoff(output); ++ } ++ ++ if (capture->buffers) ++ for (i = 0; i < capture->num_buffers; i++) { ++ capture->buffers[i].q = NULL; ++ if (capture->buffers[i].fd >= 0) ++ close(capture->buffers[i].fd); ++ } ++ ++ deint_v4l2m2m_unref_queued(output); ++ ++ av_buffer_unref(&ctx->hw_frames_ctx); ++ ++ if (capture->buffers) ++ av_free(capture->buffers); ++ ++ if (output->buffers) ++ av_free(output->buffers); ++ ++ if (ctx->fd >= 0) { ++ close(ctx->fd); ++ ctx->fd = -1; ++ } ++ ++ av_free(ctx); ++ } ++} ++ ++static void v4l2_free_buffer(void *opaque, uint8_t *unused) ++{ ++ V4L2Buffer *buf = opaque; ++ DeintV4L2M2MContextShared *ctx = buf->q->ctx; ++ ++ if (!ctx->done) ++ deint_v4l2m2m_enqueue_buffer(buf); ++ ++ deint_v4l2m2m_destroy_context(ctx); ++} ++ ++static uint8_t * v4l2_get_drm_frame(V4L2Buffer *avbuf, int height) ++{ ++ AVDRMFrameDescriptor *drm_desc = &avbuf->drm_frame; ++ AVDRMLayerDescriptor *layer; ++ ++ /* fill the DRM frame descriptor */ ++ drm_desc->nb_objects = avbuf->num_planes; ++ drm_desc->nb_layers = 1; ++ ++ layer = &drm_desc->layers[0]; ++ layer->nb_planes = avbuf->num_planes; ++ ++ for (int i = 0; i < avbuf->num_planes; i++) { ++ layer->planes[i].object_index = i; ++ layer->planes[i].offset = 0; ++ layer->planes[i].pitch = avbuf->plane_info[i].bytesperline; ++ } ++ ++ switch (layer->format) { ++ case DRM_FORMAT_YUYV: ++ layer->nb_planes = 1; ++ break; ++ ++ case DRM_FORMAT_NV12: ++ case DRM_FORMAT_NV21: ++ if (avbuf->num_planes > 1) ++ break; ++ ++ layer->nb_planes = 2; ++ ++ layer->planes[1].object_index = 0; ++ layer->planes[1].offset = avbuf->plane_info[0].bytesperline * ++ height; ++ layer->planes[1].pitch = avbuf->plane_info[0].bytesperline; ++ break; ++ ++ case DRM_FORMAT_YUV420: ++ if (avbuf->num_planes > 1) ++ break; ++ ++ layer->nb_planes = 3; ++ ++ layer->planes[1].object_index = 0; ++ layer->planes[1].offset = avbuf->plane_info[0].bytesperline * ++ height; ++ layer->planes[1].pitch = avbuf->plane_info[0].bytesperline >> 1; ++ ++ layer->planes[2].object_index = 0; ++ layer->planes[2].offset = layer->planes[1].offset + ++ ((avbuf->plane_info[0].bytesperline * ++ height) >> 2); ++ layer->planes[2].pitch = avbuf->plane_info[0].bytesperline >> 1; ++ break; ++ ++ default: ++ drm_desc->nb_layers = 0; ++ break; ++ } ++ ++ return (uint8_t *) drm_desc; ++} ++ ++// timeout in ms ++static int deint_v4l2m2m_dequeue_frame(V4L2Queue *queue, AVFrame* frame, int timeout) ++{ ++ DeintV4L2M2MContextShared *ctx = queue->ctx; ++ V4L2Buffer* avbuf; ++ ++ av_log(ctx->logctx, AV_LOG_TRACE, "<<< %s\n", __func__); ++ ++ avbuf = deint_v4l2m2m_dequeue_buffer(queue, timeout); ++ if (!avbuf) { ++ av_log(ctx->logctx, AV_LOG_DEBUG, "%s: No buffer to dequeue (timeout=%d)\n", __func__, timeout); ++ return AVERROR(EAGAIN); ++ } ++ ++ // Fill in PTS and anciliary info from src frame ++ // we will want to overwrite some fields as only the pts/dts ++ // fields are updated with new timing in this fn ++ pts_track_get_frame(&ctx->track, avbuf->buffer.timestamp, frame); ++ ++ frame->buf[0] = av_buffer_create((uint8_t *) &avbuf->drm_frame, ++ sizeof(avbuf->drm_frame), v4l2_free_buffer, ++ avbuf, AV_BUFFER_FLAG_READONLY); ++ if (!frame->buf[0]) { ++ av_log(ctx->logctx, AV_LOG_ERROR, "%s: error %d creating buffer\n", __func__, 0); ++ return AVERROR(ENOMEM); ++ } ++ ++ atomic_fetch_add(&ctx->refcount, 1); ++ ++ frame->data[0] = (uint8_t *)v4l2_get_drm_frame(avbuf, ctx->orig_height); ++ frame->format = AV_PIX_FMT_DRM_PRIME; ++ if (ctx->hw_frames_ctx) ++ frame->hw_frames_ctx = av_buffer_ref(ctx->hw_frames_ctx); ++ frame->height = ctx->height; ++ frame->width = ctx->width; ++ ++ // Not interlaced now ++ frame->interlaced_frame = 0; ++ frame->top_field_first = 0; ++ // Pkt duration halved ++ frame->pkt_duration /= 2; ++ ++ if (avbuf->buffer.flags & V4L2_BUF_FLAG_ERROR) { ++ av_log(ctx->logctx, AV_LOG_ERROR, "driver decode error\n"); ++ frame->decode_error_flags |= FF_DECODE_ERROR_INVALID_BITSTREAM; ++ } ++ ++ av_log(ctx->logctx, AV_LOG_TRACE, ">>> %s: PTS=%"PRId64"\n", __func__, frame->pts); ++ return 0; ++} ++ ++static int deint_v4l2m2m_config_props(AVFilterLink *outlink) ++{ ++ AVFilterLink *inlink = outlink->src->inputs[0]; ++ AVFilterContext *avctx = outlink->src; ++ DeintV4L2M2MContext *priv = avctx->priv; ++ DeintV4L2M2MContextShared *ctx = priv->shared; ++ int ret; ++ ++ ctx->height = avctx->inputs[0]->h; ++ ctx->width = avctx->inputs[0]->w; ++ ++ av_log(priv, AV_LOG_DEBUG, "%s: %dx%d\n", __func__, ctx->width, ctx->height); ++ ++ outlink->time_base = inlink->time_base; ++ outlink->w = inlink->w; ++ outlink->h = inlink->h; ++ outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; ++ outlink->format = inlink->format; ++ outlink->frame_rate = (AVRational) {1, 0}; // Deny knowledge of frame rate ++ ++ ret = deint_v4l2m2m_find_device(ctx); ++ if (ret) ++ return ret; ++ ++ if (inlink->hw_frames_ctx) { ++ ctx->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx); ++ if (!ctx->hw_frames_ctx) ++ return AVERROR(ENOMEM); ++ } ++ return 0; ++} ++ ++static int deint_v4l2m2m_query_formats(AVFilterContext *avctx) ++{ ++ static const enum AVPixelFormat pixel_formats[] = { ++ AV_PIX_FMT_DRM_PRIME, ++ AV_PIX_FMT_YUV420P, ++ AV_PIX_FMT_NONE, ++ }; ++ ++ return ff_set_common_formats(avctx, ff_make_format_list(pixel_formats)); ++} ++ ++static uint32_t desc_pixelformat(const AVDRMFrameDescriptor * const drm_desc) ++{ ++ const int is_linear = (drm_desc->objects[0].format_modifier == DRM_FORMAT_MOD_LINEAR || ++ drm_desc->objects[0].format_modifier == DRM_FORMAT_MOD_INVALID); ++ ++ switch (drm_desc->layers[0].format) { ++ case DRM_FORMAT_YUV420: ++ if (is_linear) ++ return drm_desc->nb_objects == 1 ? V4L2_PIX_FMT_YUV420 : 0; ++ break; ++ case DRM_FORMAT_NV12: ++ if (is_linear) ++ return drm_desc->nb_objects == 1 ? V4L2_PIX_FMT_NV12 : 0; ++ break; ++ default: ++ break; ++ } ++ return 0; ++} ++ ++static int deint_v4l2m2m_filter_frame(AVFilterLink *link, AVFrame *in) ++{ ++ AVFilterContext *avctx = link->dst; ++ DeintV4L2M2MContext *priv = avctx->priv; ++ DeintV4L2M2MContextShared *ctx = priv->shared; ++ V4L2Queue *capture = &ctx->capture; ++ V4L2Queue *output = &ctx->output; ++ int ret; ++ ++ av_log(priv, AV_LOG_DEBUG, "<<< %s: input pts: %"PRId64" (%"PRId64") field :%d interlaced: %d aspect:%d/%d\n", ++ __func__, in->pts, AV_NOPTS_VALUE, in->top_field_first, in->interlaced_frame, in->sample_aspect_ratio.num, in->sample_aspect_ratio.den); ++ av_log(priv, AV_LOG_DEBUG, "--- %s: in status in %d/ot %d; out status in %d/out %d\n", __func__, ++ avctx->inputs[0]->status_in, avctx->inputs[0]->status_out, avctx->outputs[0]->status_in, avctx->outputs[0]->status_out); ++ ++ if (ctx->field_order == V4L2_FIELD_ANY) { ++ const AVDRMFrameDescriptor * const drm_desc = (AVDRMFrameDescriptor *)in->data[0]; ++ const uint32_t pixelformat = desc_pixelformat(drm_desc); ++ ++ if (pixelformat == 0) { ++ av_log(avctx, AV_LOG_ERROR, "Unsupported DRM format %s in %d objects, modifier %#" PRIx64 "\n", ++ av_fourcc2str(drm_desc->layers[0].format), ++ drm_desc->nb_objects, drm_desc->objects[0].format_modifier); ++ return AVERROR(EINVAL); ++ } ++ ++ ctx->orig_width = drm_desc->layers[0].planes[0].pitch; ++ ctx->orig_height = drm_desc->layers[0].planes[1].offset / ctx->orig_width; ++ ++ av_log(priv, AV_LOG_DEBUG, "%s: %dx%d (%td,%td)\n", __func__, ctx->width, ctx->height, ++ drm_desc->layers[0].planes[0].pitch, drm_desc->layers[0].planes[1].offset); ++ ++ ret = deint_v4l2m2m_set_format(output, pixelformat, ctx->field_order, ctx->width, ctx->height, ctx->orig_width, drm_desc->layers[0].planes[1].offset); ++ if (ret) ++ return ret; ++ ++ ret = deint_v4l2m2m_set_format(capture, pixelformat, V4L2_FIELD_NONE, ctx->width, ctx->height, ctx->orig_width, drm_desc->layers[0].planes[1].offset); ++ if (ret) ++ return ret; ++ ++ ret = deint_v4l2m2m_allocate_buffers(capture); ++ if (ret) ++ return ret; ++ ++ ret = deint_v4l2m2m_streamon(capture); ++ if (ret) ++ return ret; ++ ++ ret = deint_v4l2m2m_allocate_buffers(output); ++ if (ret) ++ return ret; ++ ++ ret = deint_v4l2m2m_streamon(output); ++ if (ret) ++ return ret; ++ ++ if (in->top_field_first) ++ ctx->field_order = V4L2_FIELD_INTERLACED_TB; ++ else ++ ctx->field_order = V4L2_FIELD_INTERLACED_BT; ++ ++ } ++ ++ ret = deint_v4l2m2m_enqueue_frame(output, in); ++ ++ av_log(priv, AV_LOG_TRACE, ">>> %s: %s\n", __func__, av_err2str(ret)); ++ return ret; ++} ++ ++static int deint_v4l2m2m_activate(AVFilterContext *avctx) ++{ ++ DeintV4L2M2MContext * const priv = avctx->priv; ++ DeintV4L2M2MContextShared *const s = priv->shared; ++ AVFilterLink * const outlink = avctx->outputs[0]; ++ AVFilterLink * const inlink = avctx->inputs[0]; ++ int n = 0; ++ int cn = 99; ++ int instatus = 0; ++ int64_t inpts = 0; ++ int did_something = 0; ++ ++ av_log(priv, AV_LOG_TRACE, "<<< %s\n", __func__); ++ ++ FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, avctx); ++ ++ ff_inlink_acknowledge_status(inlink, &instatus, &inpts); ++ ++ if (!ff_outlink_frame_wanted(outlink)) { ++ av_log(priv, AV_LOG_TRACE, "%s: Not wanted out\n", __func__); ++ } ++ else if (s->field_order != V4L2_FIELD_ANY) // Can't DQ if no setup! ++ { ++ AVFrame * frame = av_frame_alloc(); ++ int rv; ++ ++again: ++ recycle_q(&s->output); ++ n = count_enqueued(&s->output); ++ ++ if (frame == NULL) { ++ av_log(priv, AV_LOG_ERROR, "%s: error allocating frame\n", __func__); ++ return AVERROR(ENOMEM); ++ } ++ ++ rv = deint_v4l2m2m_dequeue_frame(&s->capture, frame, n > 4 ? 300 : 0); ++ if (rv != 0) { ++ av_frame_free(&frame); ++ if (rv != AVERROR(EAGAIN)) { ++ av_log(priv, AV_LOG_ERROR, ">>> %s: DQ fail: %s\n", __func__, av_err2str(rv)); ++ return rv; ++ } ++ } ++ else { ++ frame->interlaced_frame = 0; ++ // frame is always consumed by filter_frame - even on error despite ++ // a somewhat confusing comment in the header ++ rv = ff_filter_frame(outlink, frame); ++ ++ if (instatus != 0) { ++ av_log(priv, AV_LOG_TRACE, "%s: eof loop\n", __func__); ++ goto again; ++ } ++ ++ av_log(priv, AV_LOG_TRACE, "%s: Filtered: %s\n", __func__, av_err2str(rv)); ++ did_something = 1; ++ } ++ ++ cn = count_enqueued(&s->capture); ++ } ++ ++ if (instatus != 0) { ++ ff_outlink_set_status(outlink, instatus, inpts); ++ av_log(priv, AV_LOG_TRACE, ">>> %s: Status done: %s\n", __func__, av_err2str(instatus)); ++ return 0; ++ } ++ ++ recycle_q(&s->output); ++ n = count_enqueued(&s->output); ++ ++ while (n < 6) { ++ AVFrame * frame; ++ int rv; ++ ++ if ((rv = ff_inlink_consume_frame(inlink, &frame)) < 0) { ++ av_log(priv, AV_LOG_ERROR, "%s: consume in failed: %s\n", __func__, av_err2str(rv)); ++ return rv; ++ } ++ ++ if (frame == NULL) { ++ av_log(priv, AV_LOG_TRACE, "%s: No frame\n", __func__); ++ break; ++ } ++ ++ rv = deint_v4l2m2m_filter_frame(inlink, frame); ++ av_frame_free(&frame); ++ ++ if (rv != 0) ++ return rv; ++ ++ av_log(priv, AV_LOG_TRACE, "%s: Q frame\n", __func__); ++ ++n; ++ } ++ ++ if (n < 6) { ++ ff_inlink_request_frame(inlink); ++ did_something = 1; ++ av_log(priv, AV_LOG_TRACE, "%s: req frame\n", __func__); ++ } ++ ++ if (n > 4 && ff_outlink_frame_wanted(outlink)) { ++ ff_filter_set_ready(avctx, 1); ++ did_something = 1; ++ av_log(priv, AV_LOG_TRACE, "%s: ready\n", __func__); ++ } ++ ++ av_log(priv, AV_LOG_TRACE, ">>> %s: OK (n=%d, cn=%d)\n", __func__, n, cn); ++ return did_something ? 0 : FFERROR_NOT_READY; ++} ++ ++static av_cold int deint_v4l2m2m_init(AVFilterContext *avctx) ++{ ++ DeintV4L2M2MContext * const priv = avctx->priv; ++ DeintV4L2M2MContextShared * const ctx = av_mallocz(sizeof(DeintV4L2M2MContextShared)); ++ ++ if (!ctx) { ++ av_log(priv, AV_LOG_ERROR, "%s: error %d allocating context\n", __func__, 0); ++ return AVERROR(ENOMEM); ++ } ++ priv->shared = ctx; ++ ctx->logctx = priv; ++ ctx->fd = -1; ++ ctx->output.ctx = ctx; ++ ctx->output.num_buffers = 8; ++ ctx->capture.ctx = ctx; ++ ctx->capture.num_buffers = 12; ++ ctx->done = 0; ++ ctx->field_order = V4L2_FIELD_ANY; ++ ++ pts_track_init(&ctx->track, priv); ++ ++ atomic_init(&ctx->refcount, 1); ++ ++ return 0; ++} ++ ++static void deint_v4l2m2m_uninit(AVFilterContext *avctx) ++{ ++ DeintV4L2M2MContext *priv = avctx->priv; ++ DeintV4L2M2MContextShared *ctx = priv->shared; ++ ++ ctx->done = 1; ++ ctx->logctx = NULL; // Log to NULL works, log to missing crashes ++ pts_track_uninit(&ctx->track); ++ deint_v4l2m2m_destroy_context(ctx); ++} ++ ++static const AVOption deinterlace_v4l2m2m_options[] = { ++ { NULL }, ++}; ++ ++AVFILTER_DEFINE_CLASS(deinterlace_v4l2m2m); ++ ++static const AVFilterPad deint_v4l2m2m_inputs[] = { ++ { ++ .name = "default", ++ .type = AVMEDIA_TYPE_VIDEO, ++ }, ++ { NULL } ++}; ++ ++static const AVFilterPad deint_v4l2m2m_outputs[] = { ++ { ++ .name = "default", ++ .type = AVMEDIA_TYPE_VIDEO, ++ .config_props = deint_v4l2m2m_config_props, ++ }, ++ { NULL } ++}; ++ ++AVFilter ff_vf_deinterlace_v4l2m2m = { ++ .name = "deinterlace_v4l2m2m", ++ .description = NULL_IF_CONFIG_SMALL("V4L2 M2M deinterlacer"), ++ .priv_size = sizeof(DeintV4L2M2MContext), ++ .init = &deint_v4l2m2m_init, ++ .uninit = &deint_v4l2m2m_uninit, ++ .query_formats = &deint_v4l2m2m_query_formats, ++ .inputs = deint_v4l2m2m_inputs, ++ .outputs = deint_v4l2m2m_outputs, ++ .priv_class = &deinterlace_v4l2m2m_class, ++ .activate = deint_v4l2m2m_activate, ++}; +--- /dev/null ++++ b/libavfilter/vf_unsand.c +@@ -0,0 +1,234 @@ ++/* ++ * Copyright (c) 2007 Bobby Bingham ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++/** ++ * @file ++ * format and noformat video filters ++ */ ++ ++#include ++ ++#include "libavutil/internal.h" ++#include "libavutil/mem.h" ++#include "libavutil/pixdesc.h" ++#include "libavutil/opt.h" ++#include "libavutil/rpi_sand_fns.h" ++ ++#include "avfilter.h" ++#include "formats.h" ++#include "internal.h" ++#include "video.h" ++ ++typedef struct UnsandContext { ++ const AVClass *class; ++} UnsandContext; ++ ++static av_cold void uninit(AVFilterContext *ctx) ++{ ++// UnsandContext *s = ctx->priv; ++} ++ ++static av_cold int init(AVFilterContext *ctx) ++{ ++// UnsandContext *s = ctx->priv; ++ ++ return 0; ++} ++ ++ ++static int filter_frame(AVFilterLink *link, AVFrame *in) ++{ ++ AVFilterLink * const outlink = link->dst->outputs[0]; ++ AVFrame *out = NULL; ++ int rv = 0; ++ ++ if (outlink->format == in->format) { ++ // If nothing to do then do nothing ++ out = in; ++ } ++ else ++ { ++ if ((out = ff_get_video_buffer(outlink, av_frame_cropped_width(in), av_frame_cropped_height(in))) == NULL) ++ { ++ rv = AVERROR(ENOMEM); ++ goto fail; ++ } ++ if (av_rpi_sand_to_planar_frame(out, in) != 0) ++ { ++ rv = -1; ++ goto fail; ++ } ++ ++ av_frame_free(&in); ++ } ++ ++ return ff_filter_frame(outlink, out); ++ ++fail: ++ av_frame_free(&out); ++ av_frame_free(&in); ++ return rv; ++} ++ ++#if 0 ++static void dump_fmts(const AVFilterFormats * fmts) ++{ ++ int i; ++ if (fmts== NULL) { ++ printf("NULL\n"); ++ return; ++ } ++ for (i = 0; i < fmts->nb_formats; ++i) { ++ printf(" %d", fmts->formats[i]); ++ } ++ printf("\n"); ++} ++#endif ++ ++static int query_formats(AVFilterContext *ctx) ++{ ++// UnsandContext *s = ctx->priv; ++ int ret; ++ ++ // If we aren't connected at both ends then just do nothing ++ if (ctx->inputs[0] == NULL || ctx->outputs[0] == NULL) ++ return 0; ++ ++// printf("Unsand: %s in: ", __func__); ++// dump_fmts(ctx->inputs[0]->in_formats); ++// printf("Unsand: %s out: ", __func__); ++// dump_fmts(ctx->outputs[0]->out_formats); ++ ++ // Our output formats depend on our input formats and we can't/don't ++ // want to convert between bit depths so we need to wait for the source ++ // to have an opinion before we do ++ if (ctx->inputs[0]->in_formats == NULL) ++ return AVERROR(EAGAIN); ++ ++ // Accept anything ++ if (ctx->inputs[0]->out_formats == NULL && ++ (ret = ff_formats_ref(ctx->inputs[0]->in_formats, &ctx->inputs[0]->out_formats)) < 0) ++ return ret; ++ ++ // Filter out sand formats ++ ++ // Generate a container if we don't already have one ++ if (ctx->outputs[0]->in_formats == NULL) ++ { ++ // Somewhat rubbish way of ensuring we have a good structure ++ const static enum AVPixelFormat out_fmts[] = {AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE}; ++ AVFilterFormats *formats = ff_make_format_list(out_fmts); ++ ++ if (formats == NULL) ++ return AVERROR(ENOMEM); ++ if ((ret = ff_formats_ref(formats, &ctx->outputs[0]->in_formats)) < 0) ++ return ret; ++ } ++ ++ // Replace old format list with new filtered list derived from what our ++ // input says it can do ++ { ++ const AVFilterFormats * const src_ff = ctx->inputs[0]->out_formats; ++ AVFilterFormats * const dst_ff = ctx->outputs[0]->in_formats; ++ enum AVPixelFormat *dst_fmts = av_malloc(sizeof(enum AVPixelFormat) * src_ff->nb_formats); ++ int i; ++ int n = 0; ++ int seen_420p = 0; ++ int seen_420p10 = 0; ++ ++ for (i = 0; i < src_ff->nb_formats; ++i) { ++ const enum AVPixelFormat f = src_ff->formats[i]; ++ ++ switch (f){ ++ case AV_PIX_FMT_YUV420P: ++ case AV_PIX_FMT_SAND128: ++ case AV_PIX_FMT_RPI4_8: ++ if (!seen_420p) { ++ seen_420p = 1; ++ dst_fmts[n++] = AV_PIX_FMT_YUV420P; ++ } ++ break; ++ case AV_PIX_FMT_SAND64_10: ++ case AV_PIX_FMT_YUV420P10: ++ case AV_PIX_FMT_RPI4_10: ++ if (!seen_420p10) { ++ seen_420p10 = 1; ++ dst_fmts[n++] = AV_PIX_FMT_YUV420P10; ++ } ++ break; ++ default: ++ dst_fmts[n++] = f; ++ break; ++ } ++ } ++ ++ av_freep(&dst_ff->formats); ++ dst_ff->formats = dst_fmts; ++ dst_ff->nb_formats = n; ++ } ++ ++// printf("Unsand: %s calc: ", __func__); ++// dump_fmts(ctx->outputs[0]->in_formats); ++ ++ return 0; ++} ++ ++ ++#define OFFSET(x) offsetof(UnsandContext, x) ++static const AVOption unsand_options[] = { ++ { NULL } ++}; ++ ++ ++AVFILTER_DEFINE_CLASS(unsand); ++ ++static const AVFilterPad avfilter_vf_unsand_inputs[] = { ++ { ++ .name = "default", ++ .type = AVMEDIA_TYPE_VIDEO, ++ .filter_frame = filter_frame, ++ }, ++ { NULL } ++}; ++ ++static const AVFilterPad avfilter_vf_unsand_outputs[] = { ++ { ++ .name = "default", ++ .type = AVMEDIA_TYPE_VIDEO ++ }, ++ { NULL } ++}; ++ ++AVFilter ff_vf_unsand = { ++ .name = "unsand", ++ .description = NULL_IF_CONFIG_SMALL("Convert sand pix fmt to yuv"), ++ ++ .init = init, ++ .uninit = uninit, ++ ++ .query_formats = query_formats, ++ ++ .priv_size = sizeof(UnsandContext), ++ .priv_class = &unsand_class, ++ ++ .inputs = avfilter_vf_unsand_inputs, ++ .outputs = avfilter_vf_unsand_outputs, ++}; ++ +--- a/libavformat/utils.c ++++ b/libavformat/utils.c +@@ -3051,6 +3051,40 @@ static int has_codec_parameters(AVStream + return 1; + } + ++#if CONFIG_HEVC_RPI_DECODER && CONFIG_HEVC_DECODER ++// This should be quite general purpose but avoid possible conflicts ++// by limiting usage to cases wehere we know it works. ++static int try_fallback_decoder(AVCodecContext * const avctx, const AVCodec *const old_codec, AVDictionary ** const opts) ++{ ++ // Only try fallback if we know it is supported (HEVC only) ++ const AVCodec *const new_codec = old_codec->id != AV_CODEC_ID_HEVC ? NULL : ++ avcodec_find_decoder_by_id_and_fmt(old_codec->id, AV_PIX_FMT_NONE); ++ int err; ++ ++ // Failed to find fallback or we are already at the fallback ++ if (new_codec == NULL || new_codec == old_codec) ++ { ++ return AVERROR_DECODER_NOT_FOUND; ++ } ++ ++ // * This may be dodgy - header says to not use this fn, ++ // especially if we are going to reopen the context... ++ // (but it does seem to work for our cases) ++ if (avcodec_is_open(avctx)) { ++ avcodec_close(avctx); ++ } ++ ++ if ((err = avcodec_open2(avctx, new_codec, opts)) < 0) ++ { ++ return err; ++ } ++ ++ return 0; ++} ++#else ++#define try_fallback_decoder(avctx, old_codec, opts) (AVERROR_DECODER_NOT_FOUND) ++#endif ++ + /* returns 1 or 0 if or if not decoded data was returned, or a negative error */ + static int try_decode_frame(AVFormatContext *s, AVStream *st, + const AVPacket *avpkt, AVDictionary **options) +@@ -3085,7 +3119,11 @@ static int try_decode_frame(AVFormatCont + av_dict_set(options ? options : &thread_opt, "threads", "1", 0); + if (s->codec_whitelist) + av_dict_set(options ? options : &thread_opt, "codec_whitelist", s->codec_whitelist, 0); +- ret = avcodec_open2(avctx, codec, options ? options : &thread_opt); ++ if ((ret = avcodec_open2(avctx, codec, options ? options : &thread_opt)) == AVERROR_DECODER_NOT_FOUND) ++ { ++ // Try fallback if if looks worth a try ++ ret = try_fallback_decoder(avctx, codec, options ? options : &thread_opt); ++ } + if (!options) + av_dict_free(&thread_opt); + if (ret < 0) { +@@ -3116,6 +3154,14 @@ static int try_decode_frame(AVFormatCont + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO || + avctx->codec_type == AVMEDIA_TYPE_AUDIO) { + ret = avcodec_send_packet(avctx, &pkt); ++ ++ // If we are going to want to fall back we should know here ++ if (ret == AVERROR_DECODER_NOT_FOUND) { ++ if ((ret = try_fallback_decoder(avctx, avctx->codec, options)) < 0) ++ break; ++ continue; ++ } ++ + if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) + break; + if (ret >= 0) +@@ -3726,9 +3772,20 @@ FF_ENABLE_DEPRECATION_WARNINGS + // Try to just open decoders, in case this is enough to get parameters. + if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) { + if (codec && !avctx->codec) +- if (avcodec_open2(avctx, codec, options ? &options[i] : &thread_opt) < 0) +- av_log(ic, AV_LOG_WARNING, +- "Failed to open codec in %s\n",__FUNCTION__); ++ { ++ int err; ++ ++ if ((err = avcodec_open2(avctx, codec, options ? &options[i] : &thread_opt)) < 0) ++ { ++ if (err == AVERROR_DECODER_NOT_FOUND) { ++ err = try_fallback_decoder(avctx, codec, options ? &options[i] : &thread_opt); ++ } ++ if (err < 0) { ++ av_log(ic, AV_LOG_WARNING, ++ "Failed to open codec in %s\n",__FUNCTION__); ++ } ++ } ++ } + } + if (!options) + av_dict_free(&thread_opt); +--- a/libavutil/Makefile ++++ b/libavutil/Makefile +@@ -68,6 +68,7 @@ HEADERS = adler32.h + rational.h \ + replaygain.h \ + ripemd.h \ ++ rpi_sand_fns.h \ + samplefmt.h \ + sha.h \ + sha512.h \ +@@ -86,6 +87,7 @@ HEADERS = adler32.h + tx.h \ + + HEADERS-$(CONFIG_LZO) += lzo.h ++HEADERS-$(CONFIG-RPI) += rpi_sand_fn_pw.h + + ARCH_HEADERS = bswap.h \ + intmath.h \ +@@ -180,6 +182,7 @@ OBJS-$(CONFIG_LZO) + OBJS-$(CONFIG_MEDIACODEC) += hwcontext_mediacodec.o + OBJS-$(CONFIG_OPENCL) += hwcontext_opencl.o + OBJS-$(CONFIG_QSV) += hwcontext_qsv.o ++OBJS-$(CONFIG_SAND) += rpi_sand_fns.o + OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o + OBJS-$(CONFIG_VIDEOTOOLBOX) += hwcontext_videotoolbox.o + OBJS-$(CONFIG_VDPAU) += hwcontext_vdpau.o +--- a/libavutil/aarch64/Makefile ++++ b/libavutil/aarch64/Makefile +@@ -1,4 +1,6 @@ + OBJS += aarch64/cpu.o \ + aarch64/float_dsp_init.o \ + +-NEON-OBJS += aarch64/float_dsp_neon.o ++NEON-OBJS += aarch64/float_dsp_neon.o \ ++ aarch64/rpi_sand_neon.o \ ++ +--- /dev/null ++++ b/libavutil/aarch64/rpi_sand_neon.S +@@ -0,0 +1,781 @@ ++/* ++Copyright (c) 2021 Michael Eiler ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: Michael Eiler ++*/ ++ ++#include "asm.S" ++ ++// void ff_rpi_sand8_lines_to_planar_y8( ++// uint8_t * dest, : x0 ++// unsigned int dst_stride, : w1 ++// const uint8_t * src, : x2 ++// unsigned int src_stride1, : w3, always 128 ++// unsigned int src_stride2, : w4 ++// unsigned int _x, : w5 ++// unsigned int y, : w6 ++// unsigned int _w, : w7 ++// unsigned int h); : [sp, #0] ++ ++function ff_rpi_sand8_lines_to_planar_y8, export=1 ++ // w15 contains the number of rows we need to process ++ ldr w15, [sp, #0] ++ ++ // w8 will contain the number of blocks per row ++ // w8 = floor(_w/stride1) ++ // stride1 is assumed to always be 128 ++ mov w8, w1 ++ lsr w8, w8, #7 ++ ++ // in case the width of the image is not a multiple of 128, there will ++ // be an incomplete block at the end of every row ++ // w9 contains the number of pixels stored within this block ++ // w9 = _w - w8 * 128 ++ lsl w9, w8, #7 ++ sub w9, w7, w9 ++ ++ // this is the value we have to add to the src pointer after reading a complete block ++ // it will move the address to the start of the next block ++ // w10 = stride2 * stride1 - stride1 ++ mov w10, w4 ++ lsl w10, w10, #7 ++ sub w10, w10, #128 ++ ++ // w11 is the row offset, meaning the start offset of the first block of every collumn ++ // this will be increased with stride1 within every iteration of the row_loop ++ eor w11, w11, w11 ++ ++ // w12 = 0, processed row count ++ eor w12, w12, w12 ++row_loop: ++ // start of the first block within the current row ++ // x13 = row offset + src ++ mov x13, x2 ++ add x13, x13, x11 ++ ++ // w14 = 0, processed block count ++ eor w14, w14, w14 ++ ++ cmp w8, #0 ++ beq no_main_y8 ++ ++block_loop: ++ // copy 128 bytes (a full block) into the vector registers v0-v7 and increase the src address by 128 ++ // fortunately these aren't callee saved ones, meaning we don't need to backup them ++ ld1 { v0.16b, v1.16b, v2.16b, v3.16b}, [x13], #64 ++ ld1 { v4.16b, v5.16b, v6.16b, v7.16b}, [x13], #64 ++ ++ // write these registers back to the destination vector and increase the dst address by 128 ++ st1 { v0.16b, v1.16b, v2.16b, v3.16b }, [x0], #64 ++ st1 { v4.16b, v5.16b, v6.16b, v7.16b }, [x0], #64 ++ ++ // move the source register to the beginning of the next block (x13 = src + block offset) ++ add x13, x13, x10 ++ // increase the block counter ++ add w14, w14, #1 ++ ++ // continue with the block_loop if we haven't copied all full blocks yet ++ cmp w8, w14 ++ bgt block_loop ++ ++ // handle the last block at the end of each row ++ // at most 127 byte values copied from src to dst ++no_main_y8: ++ eor w5, w5, w5 // i = 0 ++incomplete_block_loop_y8: ++ cmp w5, w9 ++ bge incomplete_block_loop_end_y8 ++ ++ ldrb w6, [x13] ++ strb w6, [x0] ++ add x13, x13, #1 ++ add x0, x0, #1 ++ ++ add w5, w5, #1 ++ b incomplete_block_loop_y8 ++incomplete_block_loop_end_y8: ++ ++ ++ // increase the row offset by 128 (stride1) ++ add w11, w11, #128 ++ // increment the row counter ++ add w12, w12, #1 ++ ++ // process the next row if we haven't finished yet ++ cmp w15, w12 ++ bgt row_loop ++ ++ ret ++endfunc ++ ++ ++ ++// void ff_rpi_sand8_lines_to_planar_c8( ++// uint8_t * dst_u, : x0 ++// unsigned int dst_stride_u, : w1 == width ++// uint8_t * dst_v, : x2 ++// unsigned int dst_stride_v, : w3 == width ++// const uint8_t * src, : x4 ++// unsigned int stride1, : w5 == 128 ++// unsigned int stride2, : w6 ++// unsigned int _x, : w7 ++// unsigned int y, : [sp, #0] ++// unsigned int _w, : [sp, #8] ++// unsigned int h); : [sp, #16] ++ ++function ff_rpi_sand8_lines_to_planar_c8, export=1 ++ // w7 = width ++ ldr w7, [sp, #8] ++ ++ // w15 contains the number of rows we need to process ++ // counts down ++ ldr w15, [sp, #16] ++ ++ // number of full blocks, w8 = _w / (stride1 >> 1) == _w / 64 == _w >> 6 ++ mov w8, w7 ++ lsr w8, w8, #6 ++ ++ // number of pixels in block at the end of every row ++ // w9 = _w - (w8 * 64) ++ lsl w9, w8, #6 ++ sub w9, w7, w9 ++ ++ // Skip at the end of the line to account for stride ++ sub w12, w1, w7 ++ ++ // address delta to the beginning of the next block ++ // w10 = (stride2 * stride1 - stride1) = stride2 * 128 - 128 ++ lsl w10, w6, #7 ++ sub w10, w10, #128 ++ ++ // w11 = row address start offset = 0 ++ eor w11, w11, w11 ++ ++row_loop_c8: ++ // start of the first block within the current row ++ // x13 = row offset + src ++ mov x13, x4 ++ add x13, x13, x11 ++ ++ // w14 = 0, processed block count ++ eor w14, w14, w14 ++ ++ cmp w8, #0 ++ beq no_main_c8 ++ ++block_loop_c8: ++ // load the full block -> 128 bytes, the block contains 64 interleaved U and V values ++ ld2 { v0.16b, v1.16b }, [x13], #32 ++ ld2 { v2.16b, v3.16b }, [x13], #32 ++ ld2 { v4.16b, v5.16b }, [x13], #32 ++ ld2 { v6.16b, v7.16b }, [x13], #32 ++ ++ // swap register so that we can write them out with a single instruction ++ mov v16.16b, v1.16b ++ mov v17.16b, v3.16b ++ mov v18.16b, v5.16b ++ mov v1.16b, v2.16b ++ mov v2.16b, v4.16b ++ mov v3.16b, v6.16b ++ mov v4.16b, v16.16b ++ mov v5.16b, v17.16b ++ mov v6.16b, v18.16b ++ ++ st1 { v0.16b, v1.16b, v2.16b, v3.16b }, [x0], #64 ++ st1 { v4.16b, v5.16b, v6.16b, v7.16b }, [x2], #64 ++ ++ // increment row counter and move src to the beginning of the next block ++ add w14, w14, #1 ++ add x13, x13, x10 ++ ++ // jump to block_loop_c8 iff the block count is smaller than the number of full blocks ++ cmp w8, w14 ++ bgt block_loop_c8 ++ ++no_main_c8: ++ // handle incomplete block at the end of every row ++ eor w5, w5, w5 // point counter, this might be ++incomplete_block_loop_c8: ++ cmp w5, w9 ++ bge incomplete_block_loop_end_c8 ++ ++ ldrb w1, [x13] ++ strb w1, [x0] ++ add x13, x13, #1 ++ ++ ldrb w1, [x13] ++ strb w1, [x2] ++ add x13, x13, #1 ++ ++ add x0, x0, #1 ++ add x2, x2, #1 ++ ++ add w5, w5, #1 ++ b incomplete_block_loop_c8 ++incomplete_block_loop_end_c8: ++ ++ // increase row_offset by stride1 ++ add w11, w11, #128 ++ add x0, x0, w12, sxtw ++ add x2, x2, w12, sxtw ++ ++ // jump to row_Loop_c8 iff the row count is small than the height ++ subs w15, w15, #1 ++ bgt row_loop_c8 ++ ++ ret ++endfunc ++ ++//void ff_rpi_sand30_lines_to_planar_c16( ++// uint8_t * dst_u, // [x0] ++// unsigned int dst_stride_u, // [w1] == _w*2 ++// uint8_t * dst_v, // [x2] ++// unsigned int dst_stride_v, // [w3] == _w*2 ++// const uint8_t * src, // [x4] ++// unsigned int stride1, // [w5] == 128 ++// unsigned int stride2, // [w6] ++// unsigned int _x, // [w7] == 0 ++// unsigned int y, // [sp, #0] == 0 ++// unsigned int _w, // [sp, #8] -> w3 ++// unsigned int h); // [sp, #16] -> w7 ++ ++.macro rpi_sand30_lines_to_planar_c16_block_half ++ ld1 { v0.4s, v1.4s, v2.4s, v3.4s }, [x13], #64 ++ ++ xtn v4.4h, v0.4s ++ ushr v0.4s, v0.4s, #10 ++ xtn v5.4h, v0.4s ++ ushr v0.4s, v0.4s, #10 ++ xtn v6.4h, v0.4s ++ xtn2 v4.8h, v1.4s ++ ushr v1.4s, v1.4s, #10 ++ xtn2 v5.8h, v1.4s ++ ushr v1.4s, v1.4s, #10 ++ xtn2 v6.8h, v1.4s ++ and v4.16b, v4.16b, v16.16b ++ and v5.16b, v5.16b, v16.16b ++ and v6.16b, v6.16b, v16.16b ++ st3 { v4.8h, v5.8h, v6.8h }, [sp], #48 ++ ++ xtn v4.4h, v2.4s ++ ushr v2.4s, v2.4s, #10 ++ xtn v5.4h, v2.4s ++ ushr v2.4s, v2.4s, #10 ++ xtn v6.4h, v2.4s ++ xtn2 v4.8h, v3.4s ++ ushr v3.4s, v3.4s, #10 ++ xtn2 v5.8h, v3.4s ++ ushr v3.4s, v3.4s, #10 ++ xtn2 v6.8h, v3.4s ++ and v4.16b, v4.16b, v16.16b ++ and v5.16b, v5.16b, v16.16b ++ and v6.16b, v6.16b, v16.16b ++ st3 { v4.8h, v5.8h, v6.8h }, [sp] ++ sub sp, sp, #48 ++.endm ++ ++function ff_rpi_sand30_lines_to_planar_c16, export=1 ++ stp x19, x20, [sp, #-48]! ++ stp x21, x22, [sp, #16] ++ stp x23, x24, [sp, #32] ++ ++ ldr w3, [sp, #48+8] // w3 = width ++ ldr w7, [sp, #48+16] // w7 = height ++ ++ // reserve space on the stack for intermediate results ++ sub sp, sp, #256 ++ ++ // number of 128byte blocks per row, w8 = width / 48 ++ mov w9, #48 ++ udiv w8, w3, w9 ++ ++ // remaining pixels (rem_pix) per row, w9 = width - w8 * 48 ++ mul w9, w8, w9 ++ sub w9, w3, w9 ++ ++ // row offset, the beginning of the next row to process ++ eor w10, w10, w10 ++ ++ // offset to the beginning of the next block, w11 = stride2 * 128 - 128 ++ lsl w11, w6, #7 ++ sub w11, w11, #128 ++ ++ // decrease the height by one and in case of remaining pixels increase the block count by one ++ sub w7, w7, #1 ++ cmp w9, #0 ++ cset w19, ne // w19 == 1 iff reamining pixels != 0 ++ add w8, w8, w19 ++ ++ // bytes we have to move dst back by at the end of every row ++ mov w21, #48*2 ++ mul w21, w21, w8 ++ sub w21, w1, w21 ++ ++ mov w20, #0 // w20 = flag, last row processed ++ ++ mov x12, #0x03ff03ff03ff03ff ++ dup v16.2d, x12 ++ ++ // iterate through rows, row counter = w12 = 0 ++ eor w12, w12, w12 ++row_loop_c16: ++ cmp w12, w7 ++ bge row_loop_c16_fin ++ ++ // address of row data = src + row_offset ++ mov x13, x4 ++ add x13, x13, x10 ++ ++ eor w14, w14, w14 ++block_loop_c16: ++ cmp w14, w8 ++ bge block_loop_c16_fin ++ ++ rpi_sand30_lines_to_planar_c16_block_half ++ ++ ld2 { v0.8h, v1.8h }, [sp], #32 ++ ld2 { v2.8h, v3.8h }, [sp], #32 ++ ld2 { v4.8h, v5.8h }, [sp] ++ sub sp, sp, #64 ++ ++ st1 { v0.8h }, [x0], #16 ++ st1 { v2.8h }, [x0], #16 ++ st1 { v4.8h }, [x0], #16 ++ st1 { v1.8h }, [x2], #16 ++ st1 { v3.8h }, [x2], #16 ++ st1 { v5.8h }, [x2], #16 ++ ++ rpi_sand30_lines_to_planar_c16_block_half ++ ++ ld2 { v0.8h, v1.8h }, [sp], #32 ++ ld2 { v2.8h, v3.8h }, [sp], #32 ++ ld2 { v4.8h, v5.8h }, [sp] ++ sub sp, sp, #64 ++ ++ st1 { v0.8h }, [x0], #16 ++ st1 { v2.8h }, [x0], #16 ++ st1 { v4.8h }, [x0], #16 ++ st1 { v1.8h }, [x2], #16 ++ st1 { v3.8h }, [x2], #16 ++ st1 { v5.8h }, [x2], #16 ++ ++ add x13, x13, x11 // offset to next block ++ add w14, w14, #1 ++ b block_loop_c16 ++block_loop_c16_fin: ++ ++ add w10, w10, #128 ++ add w12, w12, #1 ++ add x0, x0, w21, sxtw // move dst pointers back by x21 ++ add x2, x2, w21, sxtw ++ b row_loop_c16 ++row_loop_c16_fin: ++ ++ cmp w20, #1 ++ beq row_loop_c16_fin2 ++ mov w20, #1 ++ sub w8, w8, w19 // decrease block count by w19 ++ add w7, w7, #1 // increase height ++ b row_loop_c16 ++ ++row_loop_c16_fin2: ++ sub x0, x0, w21, sxtw // readd x21 in case of the last row ++ sub x2, x2, w21, sxtw // so that we can write out the few remaining pixels ++ ++ // last incomplete block to be finished ++ // read operations are fine, stride2 is more than large enough even if rem_pix is 0 ++ rpi_sand30_lines_to_planar_c16_block_half ++ ld2 { v0.8h, v1.8h }, [sp], #32 ++ ld2 { v2.8h, v3.8h }, [sp], #32 ++ ld2 { v4.8h, v5.8h }, [sp], #32 ++ rpi_sand30_lines_to_planar_c16_block_half ++ ld2 { v0.8h, v1.8h }, [sp], #32 ++ ld2 { v2.8h, v3.8h }, [sp], #32 ++ ld2 { v4.8h, v5.8h }, [sp] ++ sub sp, sp, #160 ++ ++ mov x4, sp ++ eor w20, w20, w20 ++rem_pix_c16_loop: ++ cmp w20, w9 ++ bge rem_pix_c16_fin ++ ++ ldr w22, [x4], #4 ++ str w22, [x0], #2 ++ lsr w22, w22, #16 ++ str w22, [x2], #2 ++ ++ add w20, w20, #1 ++ b rem_pix_c16_loop ++rem_pix_c16_fin: ++ ++ add sp, sp, #256 ++ ++ ldp x23, x24, [sp, #32] ++ ldp x21, x22, [sp, #16] ++ ldp x19, x20, [sp], #48 ++ ret ++endfunc ++ ++ ++ ++//void ff_rpi_sand30_lines_to_planar_p010( ++// uint8_t * dest, ++// unsigned int dst_stride, ++// const uint8_t * src, ++// unsigned int src_stride1, ++// unsigned int src_stride2, ++// unsigned int _x, ++// unsigned int y, ++// unsigned int _w, ++// unsigned int h); ++ ++// void ff_rpi_sand30_lines_to_planar_y8( ++// uint8_t * dest, : x0 ++// unsigned int dst_stride, : w1 ++// const uint8_t * src, : x2 ++// unsigned int src_stride1, : w3, always 128 ++// unsigned int src_stride2, : w4 ++// unsigned int _x, : w5 ++// unsigned int y, : w6 ++// unsigned int _w, : w7 ++// unsigned int h); : [sp, #0] ++// ++// Assumes that we are starting on a stripe boundary and that overreading ++// within the stripe is OK. However it does respect the dest size for wri ++ ++function ff_rpi_sand30_lines_to_planar_y16, export=1 ++ lsl w4, w4, #7 ++ sub w4, w4, #64 ++ sub w1, w1, w7, lsl #1 ++ uxtw x6, w6 ++ add x8, x2, x6, lsl #7 ++ ldr w6, [sp, #0] ++ ++10: ++ mov x2, x8 ++ mov w5, w7 ++1: ++ ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [x2], #64 ++ ld1 {v4.4s, v5.4s, v6.4s, v7.4s}, [x2], x4 ++ ++ subs w5, w5, #96 ++ ++ // v0, v1 ++ ++ shrn v18.4h, v0.4s, #14 ++ xtn v16.4h, v0.4s ++ shrn v17.4h, v0.4s, #10 ++ ++ shrn2 v18.8h, v1.4s, #14 ++ xtn2 v16.8h, v1.4s ++ shrn2 v17.8h, v1.4s, #10 ++ ++ ushr v18.8h, v18.8h, #6 ++ bic v16.8h, #0xfc, lsl #8 ++ bic v17.8h, #0xfc, lsl #8 ++ ++ // v2, v3 ++ ++ shrn v21.4h, v2.4s, #14 ++ xtn v19.4h, v2.4s ++ shrn v20.4h, v2.4s, #10 ++ ++ shrn2 v21.8h, v3.4s, #14 ++ xtn2 v19.8h, v3.4s ++ shrn2 v20.8h, v3.4s, #10 ++ ++ ushr v21.8h, v21.8h, #6 ++ bic v19.8h, #0xfc, lsl #8 ++ bic v20.8h, #0xfc, lsl #8 ++ ++ // v4, v5 ++ ++ shrn v24.4h, v4.4s, #14 ++ xtn v22.4h, v4.4s ++ shrn v23.4h, v4.4s, #10 ++ ++ shrn2 v24.8h, v5.4s, #14 ++ xtn2 v22.8h, v5.4s ++ shrn2 v23.8h, v5.4s, #10 ++ ++ ushr v24.8h, v24.8h, #6 ++ bic v22.8h, #0xfc, lsl #8 ++ bic v23.8h, #0xfc, lsl #8 ++ ++ // v6, v7 ++ ++ shrn v27.4h, v6.4s, #14 ++ xtn v25.4h, v6.4s ++ shrn v26.4h, v6.4s, #10 ++ ++ shrn2 v27.8h, v7.4s, #14 ++ xtn2 v25.8h, v7.4s ++ shrn2 v26.8h, v7.4s, #10 ++ ++ ushr v27.8h, v27.8h, #6 ++ bic v25.8h, #0xfc, lsl #8 ++ bic v26.8h, #0xfc, lsl #8 ++ ++ blt 2f ++ ++ st3 {v16.8h, v17.8h, v18.8h}, [x0], #48 ++ st3 {v19.8h, v20.8h, v21.8h}, [x0], #48 ++ st3 {v22.8h, v23.8h, v24.8h}, [x0], #48 ++ st3 {v25.8h, v26.8h, v27.8h}, [x0], #48 ++ ++ bne 1b ++ ++11: ++ subs w6, w6, #1 ++ add x0, x0, w1, uxtw ++ add x8, x8, #128 ++ bne 10b ++ ++ ret ++ ++// Partial final write ++2: ++ cmp w5, #48-96 ++ blt 1f ++ st3 {v16.8h, v17.8h, v18.8h}, [x0], #48 ++ st3 {v19.8h, v20.8h, v21.8h}, [x0], #48 ++ beq 11b ++ mov v16.16b, v22.16b ++ mov v17.16b, v23.16b ++ sub w5, w5, #48 ++ mov v18.16b, v24.16b ++ mov v19.16b, v25.16b ++ mov v20.16b, v26.16b ++ mov v21.16b, v27.16b ++1: ++ cmp w5, #24-96 ++ blt 1f ++ st3 {v16.8h, v17.8h, v18.8h}, [x0], #48 ++ beq 11b ++ mov v16.16b, v19.16b ++ mov v17.16b, v20.16b ++ sub w5, w5, #24 ++ mov v18.16b, v21.16b ++1: ++ cmp w5, #12-96 ++ blt 1f ++ st3 {v16.4h, v17.4h, v18.4h}, [x0], #24 ++ beq 11b ++ mov v16.2d[0], v16.2d[1] ++ sub w5, w5, #12 ++ mov v17.2d[0], v17.2d[1] ++ mov v18.2d[0], v18.2d[1] ++1: ++ cmp w5, #6-96 ++ blt 1f ++ st3 {v16.h, v17.h, v18.h}[0], [x0], #6 ++ st3 {v16.h, v17.h, v18.h}[1], [x0], #6 ++ beq 11b ++ mov v16.2s[0], v16.2s[1] ++ sub w5, w5, #6 ++ mov v17.2s[0], v17.2s[1] ++ mov v18.2s[0], v18.2s[1] ++1: ++ cmp w5, #3-96 ++ blt 1f ++ st3 {v16.h, v17.h, v18.h}[0], [x0], #6 ++ beq 11b ++ mov v16.4h[0], v16.4h[1] ++ sub w5, w5, #3 ++ mov v17.4h[0], v17.4h[1] ++1: ++ cmp w5, #2-96 ++ blt 1f ++ st2 {v16.h, v17.h}[0], [x0], #4 ++ b 11b ++1: ++ st1 {v16.h}[0], [x0], #2 ++ b 11b ++ ++endfunc ++ ++// void ff_rpi_sand30_lines_to_planar_y8( ++// uint8_t * dest, : x0 ++// unsigned int dst_stride, : w1 ++// const uint8_t * src, : x2 ++// unsigned int src_stride1, : w3, always 128 ++// unsigned int src_stride2, : w4 ++// unsigned int _x, : w5 ++// unsigned int y, : w6 ++// unsigned int _w, : w7 ++// unsigned int h); : [sp, #0] ++// ++// Assumes that we are starting on a stripe boundary and that overreading ++// within the stripe is OK. However it does respect the dest size for wri ++ ++function ff_rpi_sand30_lines_to_planar_y8, export=1 ++ lsl w4, w4, #7 ++ sub w4, w4, #64 ++ sub w1, w1, w7 ++ uxtw x6, w6 ++ add x8, x2, x6, lsl #7 ++ ldr w6, [sp, #0] ++ ++10: ++ mov x2, x8 ++ mov w5, w7 ++1: ++ ld1 {v0.4s, v1.4s, v2.4s, v3.4s}, [x2], #64 ++ ld1 {v4.4s, v5.4s, v6.4s, v7.4s}, [x2], x4 ++ ++ subs w5, w5, #96 ++ ++ // v0, v1 ++ ++ shrn v18.4h, v0.4s, #16 ++ xtn v16.4h, v0.4s ++ shrn v17.4h, v0.4s, #12 ++ ++ shrn2 v18.8h, v1.4s, #16 ++ xtn2 v16.8h, v1.4s ++ shrn2 v17.8h, v1.4s, #12 ++ ++ shrn v18.8b, v18.8h, #6 ++ shrn v16.8b, v16.8h, #2 ++ xtn v17.8b, v17.8h ++ ++ // v2, v3 ++ ++ shrn v21.4h, v2.4s, #16 ++ xtn v19.4h, v2.4s ++ shrn v20.4h, v2.4s, #12 ++ ++ shrn2 v21.8h, v3.4s, #16 ++ xtn2 v19.8h, v3.4s ++ shrn2 v20.8h, v3.4s, #12 ++ ++ shrn2 v18.16b, v21.8h, #6 ++ shrn2 v16.16b, v19.8h, #2 ++ xtn2 v17.16b, v20.8h ++ ++ // v4, v5 ++ ++ shrn v24.4h, v4.4s, #16 ++ xtn v22.4h, v4.4s ++ shrn v23.4h, v4.4s, #12 ++ ++ shrn2 v24.8h, v5.4s, #16 ++ xtn2 v22.8h, v5.4s ++ shrn2 v23.8h, v5.4s, #12 ++ ++ shrn v21.8b, v24.8h, #6 ++ shrn v19.8b, v22.8h, #2 ++ xtn v20.8b, v23.8h ++ ++ // v6, v7 ++ ++ shrn v27.4h, v6.4s, #16 ++ xtn v25.4h, v6.4s ++ shrn v26.4h, v6.4s, #12 ++ ++ shrn2 v27.8h, v7.4s, #16 ++ xtn2 v25.8h, v7.4s ++ shrn2 v26.8h, v7.4s, #12 ++ ++ shrn2 v21.16b, v27.8h, #6 ++ shrn2 v19.16b, v25.8h, #2 ++ xtn2 v20.16b, v26.8h ++ ++ blt 2f ++ ++ st3 {v16.16b, v17.16b, v18.16b}, [x0], #48 ++ st3 {v19.16b, v20.16b, v21.16b}, [x0], #48 ++ ++ bne 1b ++ ++11: ++ subs w6, w6, #1 ++ add x0, x0, w1, uxtw ++ add x8, x8, #128 ++ bne 10b ++ ++ ret ++ ++// Partial final write ++2: ++ cmp w5, #48-96 ++ blt 1f ++ st3 {v16.16b, v17.16b, v18.16b}, [x0], #48 ++ beq 11b ++ mov v16.16b, v22.16b ++ mov v17.16b, v23.16b ++ sub w5, w5, #48 ++ mov v18.16b, v24.16b ++1: ++ cmp w5, #24-96 ++ blt 1f ++ st3 {v16.8b, v17.8b, v18.8b}, [x0], #24 ++ beq 11b ++ mov v16.2d[0], v16.2d[1] ++ sub w5, w5, #24 ++ mov v17.2d[0], v17.2d[1] ++ mov v18.2d[0], v18.2d[1] ++1: ++ cmp w5, #12-96 ++ blt 1f ++ st3 {v16.b, v17.b, v18.b}[0], [x0], #3 ++ st3 {v16.b, v17.b, v18.b}[1], [x0], #3 ++ st3 {v16.b, v17.b, v18.b}[2], [x0], #3 ++ st3 {v16.b, v17.b, v18.b}[3], [x0], #3 ++ beq 11b ++ mov v16.2s[0], v16.2s[1] ++ sub w5, w5, #12 ++ mov v17.2s[0], v17.2s[1] ++ mov v18.2s[0], v18.2s[1] ++1: ++ cmp w5, #6-96 ++ blt 1f ++ st3 {v16.b, v17.b, v18.b}[0], [x0], #3 ++ st3 {v16.b, v17.b, v18.b}[1], [x0], #3 ++ beq 11b ++ mov v16.4h[0], v16.4h[1] ++ sub w5, w5, #6 ++ mov v17.4h[0], v17.4h[1] ++ mov v18.4h[0], v18.4h[1] ++1: ++ cmp w5, #3-96 ++ blt 1f ++ st3 {v16.b, v17.b, v18.b}[0], [x0], #3 ++ beq 11b ++ mov v16.8b[0], v16.8b[1] ++ sub w5, w5, #3 ++ mov v17.8b[0], v17.8b[1] ++1: ++ cmp w5, #2-96 ++ blt 1f ++ st2 {v16.b, v17.b}[0], [x0], #2 ++ b 11b ++1: ++ st1 {v16.b}[0], [x0], #1 ++ b 11b ++ ++endfunc ++ +--- /dev/null ++++ b/libavutil/aarch64/rpi_sand_neon.h +@@ -0,0 +1,59 @@ ++/* ++Copyright (c) 2021 Michael Eiler ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: Michael Eiler ++*/ ++ ++#pragma once ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++void ff_rpi_sand8_lines_to_planar_y8(uint8_t * dest, unsigned int dst_stride, ++ const uint8_t * src, unsigned int src_stride1, unsigned int src_stride2, ++ unsigned int _x, unsigned int y, unsigned int _w, unsigned int h); ++ ++void ff_rpi_sand8_lines_to_planar_c8(uint8_t * dst_u, unsigned int dst_stride_u, ++ uint8_t * dst_v, unsigned int dst_stride_v, const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++ ++void ff_rpi_sand30_lines_to_planar_y16(uint8_t * dest, unsigned int dst_stride, ++ const uint8_t * src, unsigned int src_stride1, unsigned int src_stride2, ++ unsigned int _x, unsigned int y, unsigned int _w, unsigned int h); ++ ++void ff_rpi_sand30_lines_to_planar_c16(uint8_t * dst_u, unsigned int dst_stride_u, ++ uint8_t * dst_v, unsigned int dst_stride_v, const uint8_t * src, unsigned int stride1, ++ unsigned int stride2, unsigned int _x, unsigned int y, unsigned int _w, unsigned int h); ++ ++void ff_rpi_sand30_lines_to_planar_y8(uint8_t * dest, unsigned int dst_stride, ++ const uint8_t * src, unsigned int src_stride1, unsigned int src_stride2, ++ unsigned int _x, unsigned int y, unsigned int _w, unsigned int h); ++ ++#ifdef __cplusplus ++} ++#endif ++ +--- a/libavutil/arm/Makefile ++++ b/libavutil/arm/Makefile +@@ -6,3 +6,4 @@ VFP-OBJS += arm/float_dsp_init_vfp.o + + NEON-OBJS += arm/float_dsp_init_neon.o \ + arm/float_dsp_neon.o \ ++ arm/rpi_sand_neon.o \ +--- /dev/null ++++ b/libavutil/arm/rpi_sand_neon.S +@@ -0,0 +1,925 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox ++*/ ++ ++#include "libavutil/arm/asm.S" ++ ++ ++@ General notes: ++@ Having done some timing on this in sand8->y8 (Pi4) ++@ vst1 (680fps) is a bit faster than vstm (660fps) ++@ vldm (680fps) is noticably faster than vld1 (480fps) ++@ (or it might be that a mix is what is required) ++@ ++@ At least on a Pi4 it is no more expensive to have a single auto-inc register ++@ for dest address than it is to have 2 used alternately (On Pi3 Ben asserted ++@ the latter was better) ++@ ++@ vstm will bus error on unaligned access (so will vldm), vst1 is safe unless ++@ the memory is uncached. ++@ As these are Sand -> planar we can assume that src is going to be aligned but ++@ it is possible that dest isn't (converting to .yuv or other packed format). ++@ Luckily vst1 is faster than vstm :-) so all is well ++@ vst1 has alignment requirements of el size so maybe splitting vst1.32 into 4 ++@ .8 stores would let us do non-word aligned stores into uncached but it ++@ probably isn't worth it. ++ ++ ++ ++ ++@ void ff_rpi_sand128b_stripe_to_8_10( ++@ uint8_t * dest, // [r0] ++@ const uint8_t * src1, // [r1] ++@ const uint8_t * src2, // [r2] ++@ unsigned int lines); // [r3] ++ ++.macro stripe2_to_8, bit_depth ++ vpush {q4-q7} ++1: ++ vldm r1!, {q0-q7} ++ subs r3, #1 ++ vldm r2!, {q8-q15} ++ vqrshrn.u16 d0, q0, #\bit_depth - 8 ++ vqrshrn.u16 d1, q1, #\bit_depth - 8 ++ vqrshrn.u16 d2, q2, #\bit_depth - 8 ++ vqrshrn.u16 d3, q3, #\bit_depth - 8 ++ vqrshrn.u16 d4, q4, #\bit_depth - 8 ++ vqrshrn.u16 d5, q5, #\bit_depth - 8 ++ vqrshrn.u16 d6, q6, #\bit_depth - 8 ++ vqrshrn.u16 d7, q7, #\bit_depth - 8 ++ vqrshrn.u16 d8, q8, #\bit_depth - 8 ++ vqrshrn.u16 d9, q9, #\bit_depth - 8 ++ vqrshrn.u16 d10, q10, #\bit_depth - 8 ++ vqrshrn.u16 d11, q11, #\bit_depth - 8 ++ vqrshrn.u16 d12, q12, #\bit_depth - 8 ++ vqrshrn.u16 d13, q13, #\bit_depth - 8 ++ vqrshrn.u16 d14, q14, #\bit_depth - 8 ++ vqrshrn.u16 d15, q15, #\bit_depth - 8 ++ vstm r0!, {q0-q7} ++ bne 1b ++ vpop {q4-q7} ++ bx lr ++.endm ++ ++function ff_rpi_sand128b_stripe_to_8_10, export=1 ++ stripe2_to_8 10 ++endfunc ++ ++@ void ff_rpi_sand8_lines_to_planar_y8( ++@ uint8_t * dest, // [r0] ++@ unsigned int dst_stride, // [r1] ++@ const uint8_t * src, // [r2] ++@ unsigned int src_stride1, // [r3] Ignored - assumed 128 ++@ unsigned int src_stride2, // [sp, #0] -> r3 ++@ unsigned int _x, // [sp, #4] Ignored - 0 ++@ unsigned int y, // [sp, #8] (r7 in prefix) ++@ unsigned int _w, // [sp, #12] -> r6 (cur r5) ++@ unsigned int h); // [sp, #16] -> r7 ++@ ++@ Assumes that we are starting on a stripe boundary and that overreading ++@ within the stripe is OK. However it does respect the dest size for writing ++ ++function ff_rpi_sand8_lines_to_planar_y8, export=1 ++ push {r4-r8, lr} @ +24 L ++ ldr r3, [sp, #24] ++ ldr r6, [sp, #36] ++ ldr r7, [sp, #32] @ y ++ lsl r3, #7 ++ sub r1, r6 ++ add r8, r2, r7, lsl #7 ++ ldr r7, [sp, #40] ++ ++10: ++ mov r2, r8 ++ add r4, r0, #24 ++ mov r5, r6 ++ mov lr, #0 ++1: ++ vldm r2, {q8-q15} ++ add r2, r3 ++ subs r5, #128 ++ blt 2f ++ vst1.8 {d16, d17, d18, d19}, [r0]! ++ vst1.8 {d20, d21, d22, d23}, [r0]! ++ vst1.8 {d24, d25, d26, d27}, [r0]! ++ vst1.8 {d28, d29, d30, d31}, [r0]! ++ bne 1b ++11: ++ subs r7, #1 ++ add r0, r1 ++ add r8, #128 ++ bne 10b ++ ++ pop {r4-r8, pc} ++ ++@ Partial final write ++2: ++ cmp r5, #64-128 ++ blt 1f ++ vst1.8 {d16, d17, d18, d19}, [r0]! ++ vst1.8 {d20, d21, d22, d23}, [r0]! ++ beq 11b ++ vmov q8, q12 ++ vmov q9, q13 ++ sub r5, #64 ++ vmov q10, q14 ++ vmov q11, q15 ++1: ++ cmp r5, #32-128 ++ blt 1f ++ vst1.8 {d16, d17, d18, d19}, [r0]! ++ beq 11b ++ vmov q8, q10 ++ sub r5, #32 ++ vmov q9, q11 ++1: ++ cmp r5, #16-128 ++ blt 1f ++ vst1.8 {d16, d17}, [r0]! ++ beq 11b ++ sub r5, #16 ++ vmov q8, q9 ++1: ++ cmp r5, #8-128 ++ blt 1f ++ vst1.8 {d16}, [r0]! ++ beq 11b ++ sub r5, #8 ++ vmov d16, d17 ++1: ++ cmp r5, #4-128 ++ blt 1f ++ vst1.32 {d16[0]}, [r0]! ++ beq 11b ++ sub r5, #4 ++ vshr.u64 d16, #32 ++1: ++ cmp r5, #2-128 ++ blt 1f ++ vst1.16 {d16[0]}, [r0]! ++ beq 11b ++ vst1.8 {d16[2]}, [r0]! ++ b 11b ++1: ++ vst1.8 {d16[0]}, [r0]! ++ b 11b ++endfunc ++ ++@ void ff_rpi_sand8_lines_to_planar_c8( ++@ uint8_t * dst_u, // [r0] ++@ unsigned int dst_stride_u, // [r1] ++@ uint8_t * dst_v, // [r2] ++@ unsigned int dst_stride_v, // [r3] ++@ const uint8_t * src, // [sp, #0] -> r4, r5 ++@ unsigned int stride1, // [sp, #4] 128 ++@ unsigned int stride2, // [sp, #8] -> r8 ++@ unsigned int _x, // [sp, #12] 0 ++@ unsigned int y, // [sp, #16] (r7 in prefix) ++@ unsigned int _w, // [sp, #20] -> r12, r6 ++@ unsigned int h); // [sp, #24] -> r7 ++@ ++@ Assumes that we are starting on a stripe boundary and that overreading ++@ within the stripe is OK. However it does respect the dest size for writing ++ ++function ff_rpi_sand8_lines_to_planar_c8, export=1 ++ push {r4-r8, lr} @ +24 ++ ++ ldr r5, [sp, #24] ++ ldr r8, [sp, #32] ++ ldr r7, [sp, #40] ++ ldr r6, [sp, #44] ++ lsl r8, #7 ++ add r5, r5, r7, lsl #7 ++ sub r1, r1, r6 ++ sub r3, r3, r6 ++ ldr r7, [sp, #48] ++ vpush {q4-q7} ++ ++10: ++ mov r4, r5 ++ mov r12, r6 ++1: ++ subs r12, #64 ++ vldm r4, {q0-q7} ++ add r4, r8 ++ it gt ++ vldmgt r4, {q8-q15} ++ add r4, r8 ++ ++ vuzp.8 q0, q1 ++ vuzp.8 q2, q3 ++ vuzp.8 q4, q5 ++ vuzp.8 q6, q7 ++ ++ vuzp.8 q8, q9 ++ vuzp.8 q10, q11 ++ vuzp.8 q12, q13 ++ vuzp.8 q14, q15 ++ subs r12, #64 ++ ++ @ Rearrange regs so we can use vst1 with 4 regs ++ vswp q1, q2 ++ vswp q5, q6 ++ vswp q9, q10 ++ vswp q13, q14 ++ blt 2f ++ ++ vst1.8 {d0, d1, d2, d3 }, [r0]! ++ vst1.8 {d8, d9, d10, d11}, [r0]! ++ vst1.8 {d16, d17, d18, d19}, [r0]! ++ vst1.8 {d24, d25, d26, d27}, [r0]! ++ ++ vst1.8 {d4, d5, d6, d7 }, [r2]! ++ vst1.8 {d12, d13, d14, d15}, [r2]! ++ vst1.8 {d20, d21, d22, d23}, [r2]! ++ vst1.8 {d28, d29, d30, d31}, [r2]! ++ bne 1b ++11: ++ subs r7, #1 ++ add r5, #128 ++ add r0, r1 ++ add r2, r3 ++ bne 10b ++ vpop {q4-q7} ++ pop {r4-r8,pc} ++ ++2: ++ cmp r12, #64-128 ++ blt 1f ++ vst1.8 {d0, d1, d2, d3 }, [r0]! ++ vst1.8 {d8, d9, d10, d11}, [r0]! ++ vst1.8 {d4, d5, d6, d7 }, [r2]! ++ vst1.8 {d12, d13, d14, d15}, [r2]! ++ beq 11b ++ sub r12, #64 ++ vmov q0, q8 ++ vmov q1, q9 ++ vmov q2, q10 ++ vmov q3, q11 ++ vmov q4, q12 ++ vmov q5, q13 ++ vmov q6, q14 ++ vmov q7, q15 ++1: ++ cmp r12, #32-128 ++ blt 1f ++ vst1.8 {d0, d1, d2, d3 }, [r0]! ++ vst1.8 {d4, d5, d6, d7 }, [r2]! ++ beq 11b ++ sub r12, #32 ++ vmov q0, q4 ++ vmov q1, q5 ++ vmov q2, q6 ++ vmov q3, q7 ++1: ++ cmp r12, #16-128 ++ blt 1f ++ vst1.8 {d0, d1 }, [r0]! ++ vst1.8 {d4, d5 }, [r2]! ++ beq 11b ++ sub r12, #16 ++ vmov q0, q1 ++ vmov q2, q3 ++1: ++ cmp r12, #8-128 ++ blt 1f ++ vst1.8 {d0}, [r0]! ++ vst1.8 {d4}, [r2]! ++ beq 11b ++ sub r12, #8 ++ vmov d0, d1 ++ vmov d4, d5 ++1: ++ cmp r12, #4-128 ++ blt 1f ++ vst1.32 {d0[0]}, [r0]! ++ vst1.32 {d4[0]}, [r2]! ++ beq 11b ++ sub r12, #4 ++ vmov s0, s1 ++ vmov s8, s9 ++1: ++ cmp r12, #2-128 ++ blt 1f ++ vst1.16 {d0[0]}, [r0]! ++ vst1.16 {d4[0]}, [r2]! ++ beq 11b ++ vst1.8 {d0[2]}, [r0]! ++ vst1.8 {d4[2]}, [r2]! ++ b 11b ++1: ++ vst1.8 {d0[0]}, [r0]! ++ vst1.8 {d4[0]}, [r2]! ++ b 11b ++endfunc ++ ++ ++ ++@ void ff_rpi_sand30_lines_to_planar_y16( ++@ uint8_t * dest, // [r0] ++@ unsigned int dst_stride, // [r1] ++@ const uint8_t * src, // [r2] ++@ unsigned int src_stride1, // [r3] Ignored - assumed 128 ++@ unsigned int src_stride2, // [sp, #0] -> r3 ++@ unsigned int _x, // [sp, #4] Ignored - 0 ++@ unsigned int y, // [sp, #8] (r7 in prefix) ++@ unsigned int _w, // [sp, #12] -> r6 (cur r5) ++@ unsigned int h); // [sp, #16] -> r7 ++@ ++@ Assumes that we are starting on a stripe boundary and that overreading ++@ within the stripe is OK. However it does respect the dest size for writing ++ ++function ff_rpi_sand30_lines_to_planar_y16, export=1 ++ push {r4-r8, lr} @ +24 ++ ldr r3, [sp, #24] ++ ldr r6, [sp, #36] ++ ldr r7, [sp, #32] @ y ++ mov r12, #48 ++ sub r3, #1 ++ lsl r3, #7 ++ sub r1, r1, r6, lsl #1 ++ add r8, r2, r7, lsl #7 ++ ldr r7, [sp, #40] ++ ++10: ++ mov r2, r8 ++ add r4, r0, #24 ++ mov r5, r6 ++ mov lr, #0 ++1: ++ vldm r2!, {q10-q13} ++ add lr, #64 ++ ++ vshrn.u32 d4 , q10, #14 @ Cannot vshrn.u32 #20! ++ ands lr, #127 ++ vshrn.u32 d2, q10, #10 ++ vmovn.u32 d0, q10 ++ ++ vshrn.u32 d5, q11, #14 ++ it eq ++ addeq r2, r3 ++ vshrn.u32 d3, q11, #10 ++ vmovn.u32 d1, q11 ++ ++ subs r5, #48 ++ vshr.u16 q2, #6 ++ vbic.u16 q0, #0xfc00 ++ vbic.u16 q1, #0xfc00 ++ ++ vshrn.u32 d20, q12, #14 ++ vshrn.u32 d18, q12, #10 ++ vmovn.u32 d16, q12 ++ ++ vshrn.u32 d21, q13, #14 ++ vshrn.u32 d19, q13, #10 ++ vmovn.u32 d17, q13 ++ ++ vshr.u16 q10, #6 ++ vbic.u16 q8, #0xfc00 ++ vbic.u16 q9 , #0xfc00 ++ blt 2f ++ ++ vst3.16 {d0, d2, d4}, [r0], r12 ++ vst3.16 {d1, d3, d5}, [r4], r12 ++ vst3.16 {d16, d18, d20}, [r0], r12 ++ vst3.16 {d17, d19, d21}, [r4], r12 ++ ++ bne 1b ++ ++11: ++ subs r7, #1 ++ add r0, r1 ++ add r8, #128 ++ bne 10b ++ ++ pop {r4-r8, pc} ++ ++@ Partial final write ++2: ++ cmp r5, #24-48 ++ blt 1f ++ vst3.16 {d0, d2, d4}, [r0], r12 ++ vst3.16 {d1, d3, d5}, [r4] ++ beq 11b ++ vmov q0, q8 ++ sub r5, #24 ++ vmov q1, q9 ++ vmov q2, q10 ++1: ++ cmp r5, #12-48 ++ blt 1f ++ vst3.16 {d0, d2, d4}, [r0]! ++ beq 11b ++ vmov d0, d1 ++ sub r5, #12 ++ vmov d2, d3 ++ vmov d4, d5 ++1: ++ cmp r5, #6-48 ++ add r4, r0, #6 @ avoid [r0]! on sequential instructions ++ blt 1f ++ vst3.16 {d0[0], d2[0], d4[0]}, [r0] ++ vst3.16 {d0[1], d2[1], d4[1]}, [r4] ++ add r0, #12 ++ beq 11b ++ vmov s0, s1 ++ sub r5, #6 ++ vmov s4, s5 ++ vmov s8, s9 ++1: ++ cmp r5, #3-48 ++ blt 1f ++ vst3.16 {d0[0], d2[0], d4[0]}, [r0]! ++ beq 11b ++ sub r5, #3 ++ vshr.u32 d0, #16 ++ vshr.u32 d2, #16 ++1: ++ cmp r5, #2-48 ++ blt 1f ++ vst2.16 {d0[0], d2[0]}, [r0]! ++ b 11b ++1: ++ vst1.16 {d0[0]}, [r0]! ++ b 11b ++ ++endfunc ++ ++ ++@ void ff_rpi_sand30_lines_to_planar_c16( ++@ uint8_t * dst_u, // [r0] ++@ unsigned int dst_stride_u, // [r1] ++@ uint8_t * dst_v, // [r2] ++@ unsigned int dst_stride_v, // [r3] ++@ const uint8_t * src, // [sp, #0] -> r4, r5 ++@ unsigned int stride1, // [sp, #4] 128 ++@ unsigned int stride2, // [sp, #8] -> r8 ++@ unsigned int _x, // [sp, #12] 0 ++@ unsigned int y, // [sp, #16] (r7 in prefix) ++@ unsigned int _w, // [sp, #20] -> r6, r9 ++@ unsigned int h); // [sp, #24] -> r7 ++@ ++@ Assumes that we are starting on a stripe boundary and that overreading ++@ within the stripe is OK. However it does respect the dest size for writing ++ ++function ff_rpi_sand30_lines_to_planar_c16, export=1 ++ push {r4-r10, lr} @ +32 ++ ldr r5, [sp, #32] ++ ldr r8, [sp, #40] ++ ldr r7, [sp, #48] ++ ldr r9, [sp, #52] ++ mov r12, #48 ++ sub r8, #1 ++ lsl r8, #7 ++ add r5, r5, r7, lsl #7 ++ sub r1, r1, r9, lsl #1 ++ sub r3, r3, r9, lsl #1 ++ ldr r7, [sp, #56] ++10: ++ mov lr, #0 ++ mov r4, r5 ++ mov r6, r9 ++1: ++ vldm r4!, {q0-q3} ++ add lr, #64 ++ ++ @ N.B. unpack [0,1,2] -> (reg order) 1, 0, 2 ++ vshrn.u32 d20, q0, #14 ++ vmovn.u32 d18, q0 ++ vshrn.u32 d0, q0, #10 ++ ands lr, #127 ++ ++ vshrn.u32 d21, q1, #14 ++ vmovn.u32 d19, q1 ++ vshrn.u32 d1, q1, #10 ++ ++ vshrn.u32 d22, q2, #10 ++ vmovn.u32 d2, q2 ++ vshrn.u32 d4, q2, #14 ++ ++ add r10, r0, #24 ++ vshrn.u32 d23, q3, #10 ++ vmovn.u32 d3, q3 ++ vshrn.u32 d5, q3, #14 ++ ++ it eq ++ addeq r4, r8 ++ vuzp.16 q0, q11 ++ vuzp.16 q9, q1 ++ vuzp.16 q10, q2 ++ ++ @ q0 V0, V3,.. ++ @ q9 U0, U3... ++ @ q10 U1, U4... ++ @ q11 U2, U5,.. ++ @ q1 V1, V4, ++ @ q2 V2, V5,.. ++ ++ subs r6, #24 ++ vbic.u16 q11, #0xfc00 ++ vbic.u16 q9, #0xfc00 ++ vshr.u16 q10, #6 ++ vshr.u16 q2, #6 ++ vbic.u16 q0, #0xfc00 ++ vbic.u16 q1, #0xfc00 ++ ++ blt 2f ++ ++ vst3.16 {d18, d20, d22}, [r0], r12 ++ vst3.16 {d19, d21, d23}, [r10] ++ add r10, r2, #24 ++ vst3.16 {d0, d2, d4}, [r2], r12 ++ vst3.16 {d1, d3, d5}, [r10] ++ ++ bne 1b ++ ++11: ++ subs r7, #1 ++ add r5, #128 ++ add r0, r1 ++ add r2, r3 ++ bne 10b ++ ++ pop {r4-r10, pc} ++ ++@ Partial final write ++2: ++ cmp r6, #-12 ++ blt 1f ++ vst3.16 {d18, d20, d22}, [r0]! ++ vst3.16 {d0, d2, d4}, [r2]! ++ beq 11b ++ vmov d18, d19 ++ vmov d20, d21 ++ vmov d22, d23 ++ sub r6, #12 ++ vmov d0, d1 ++ vmov d2, d3 ++ vmov d4, d5 ++1: ++ cmp r6, #-18 ++ @ Rezip here as it makes the remaining tail handling easier ++ vzip.16 d0, d18 ++ vzip.16 d2, d20 ++ vzip.16 d4, d22 ++ blt 1f ++ vst3.16 {d0[1], d2[1], d4[1]}, [r0]! ++ vst3.16 {d0[0], d2[0], d4[0]}, [r2]! ++ vst3.16 {d0[3], d2[3], d4[3]}, [r0]! ++ vst3.16 {d0[2], d2[2], d4[2]}, [r2]! ++ beq 11b ++ vmov d0, d18 ++ vmov d2, d20 ++ sub r6, #6 ++ vmov d4, d22 ++1: ++ cmp r6, #-21 ++ blt 1f ++ vst3.16 {d0[1], d2[1], d4[1]}, [r0]! ++ vst3.16 {d0[0], d2[0], d4[0]}, [r2]! ++ beq 11b ++ vmov s4, s5 ++ sub r6, #3 ++ vmov s0, s1 ++1: ++ cmp r6, #-22 ++ blt 1f ++ vst2.16 {d0[1], d2[1]}, [r0]! ++ vst2.16 {d0[0], d2[0]}, [r2]! ++ b 11b ++1: ++ vst1.16 {d0[1]}, [r0]! ++ vst1.16 {d0[0]}, [r2]! ++ b 11b ++ ++endfunc ++ ++@ void ff_rpi_sand30_lines_to_planar_p010( ++@ uint8_t * dest, // [r0] ++@ unsigned int dst_stride, // [r1] ++@ const uint8_t * src, // [r2] ++@ unsigned int src_stride1, // [r3] Ignored - assumed 128 ++@ unsigned int src_stride2, // [sp, #0] -> r3 ++@ unsigned int _x, // [sp, #4] Ignored - 0 ++@ unsigned int y, // [sp, #8] (r7 in prefix) ++@ unsigned int _w, // [sp, #12] -> r6 (cur r5) ++@ unsigned int h); // [sp, #16] -> r7 ++@ ++@ Assumes that we are starting on a stripe boundary and that overreading ++@ within the stripe is OK. However it does respect the dest size for writing ++ ++function ff_rpi_sand30_lines_to_planar_p010, export=1 ++ push {r4-r8, lr} @ +24 ++ ldr r3, [sp, #24] ++ ldr r6, [sp, #36] ++ ldr r7, [sp, #32] @ y ++ mov r12, #48 ++ vmov.u16 q15, #0xffc0 ++ sub r3, #1 ++ lsl r3, #7 ++ sub r1, r1, r6, lsl #1 ++ add r8, r2, r7, lsl #7 ++ ldr r7, [sp, #40] ++ ++10: ++ mov r2, r8 ++ add r4, r0, #24 ++ mov r5, r6 ++ mov lr, #0 ++1: ++ vldm r2!, {q10-q13} ++ add lr, #64 ++ ++ vshl.u32 q14, q10, #6 ++ ands lr, #127 ++ vshrn.u32 d4, q10, #14 ++ vshrn.u32 d2, q10, #4 ++ vmovn.u32 d0, q14 ++ ++ vshl.u32 q14, q11, #6 ++ it eq ++ addeq r2, r3 ++ vshrn.u32 d5, q11, #14 ++ vshrn.u32 d3, q11, #4 ++ vmovn.u32 d1, q14 ++ ++ subs r5, #48 ++ vand q2, q15 ++ vand q1, q15 ++ vand q0, q15 ++ ++ vshl.u32 q14, q12, #6 ++ vshrn.u32 d20, q12, #14 ++ vshrn.u32 d18, q12, #4 ++ vmovn.u32 d16, q14 ++ ++ vshl.u32 q14, q13, #6 ++ vshrn.u32 d21, q13, #14 ++ vshrn.u32 d19, q13, #4 ++ vmovn.u32 d17, q14 ++ ++ vand q10, q15 ++ vand q9, q15 ++ vand q8, q15 ++ blt 2f ++ ++ vst3.16 {d0, d2, d4}, [r0], r12 ++ vst3.16 {d1, d3, d5}, [r4], r12 ++ vst3.16 {d16, d18, d20}, [r0], r12 ++ vst3.16 {d17, d19, d21}, [r4], r12 ++ ++ bne 1b ++ ++11: ++ subs r7, #1 ++ add r0, r1 ++ add r8, #128 ++ bne 10b ++ ++ pop {r4-r8, pc} ++ ++@ Partial final write ++2: ++ cmp r5, #24-48 ++ blt 1f ++ vst3.16 {d0, d2, d4}, [r0], r12 ++ vst3.16 {d1, d3, d5}, [r4] ++ beq 11b ++ vmov q0, q8 ++ sub r5, #24 ++ vmov q1, q9 ++ vmov q2, q10 ++1: ++ cmp r5, #12-48 ++ blt 1f ++ vst3.16 {d0, d2, d4}, [r0]! ++ beq 11b ++ vmov d0, d1 ++ sub r5, #12 ++ vmov d2, d3 ++ vmov d4, d5 ++1: ++ cmp r5, #6-48 ++ add r4, r0, #6 @ avoid [r0]! on sequential instructions ++ blt 1f ++ vst3.16 {d0[0], d2[0], d4[0]}, [r0] ++ vst3.16 {d0[1], d2[1], d4[1]}, [r4] ++ add r0, #12 ++ beq 11b ++ vmov s0, s1 ++ sub r5, #6 ++ vmov s4, s5 ++ vmov s8, s9 ++1: ++ cmp r5, #3-48 ++ blt 1f ++ vst3.16 {d0[0], d2[0], d4[0]}, [r0]! ++ beq 11b ++ sub r5, #3 ++ vshr.u32 d0, #16 ++ vshr.u32 d2, #16 ++1: ++ cmp r5, #2-48 ++ blt 1f ++ vst2.16 {d0[0], d2[0]}, [r0]! ++ b 11b ++1: ++ vst1.16 {d0[0]}, [r0]! ++ b 11b ++ ++endfunc ++ ++ ++@ void ff_rpi_sand30_lines_to_planar_y8( ++@ uint8_t * dest, // [r0] ++@ unsigned int dst_stride, // [r1] ++@ const uint8_t * src, // [r2] ++@ unsigned int src_stride1, // [r3] Ignored - assumed 128 ++@ unsigned int src_stride2, // [sp, #0] -> r3 ++@ unsigned int _x, // [sp, #4] Ignored - 0 ++@ unsigned int y, // [sp, #8] (r7 in prefix) ++@ unsigned int _w, // [sp, #12] -> r6 (cur r5) ++@ unsigned int h); // [sp, #16] -> r7 ++@ ++@ Assumes that we are starting on a stripe boundary and that overreading ++@ within the stripe is OK. However it does respect the dest size for wri ++ ++function ff_rpi_sand30_lines_to_planar_y8, export=1 ++ push {r4-r8, lr} @ +24 ++ ldr r3, [sp, #24] ++ ldr r6, [sp, #36] ++ ldr r7, [sp, #32] @ y ++ mov r12, #48 ++ lsl r3, #7 ++ sub r1, r1, r6 ++ add r8, r2, r7, lsl #7 ++ ldr r7, [sp, #40] ++ ++10: ++ mov r2, r8 ++ add r4, r0, #24 ++ mov r5, r6 ++1: ++ vldm r2, {q8-q15} ++ ++ subs r5, #96 ++ ++ vmovn.u32 d0, q8 ++ vshrn.u32 d2, q8, #12 ++ vshrn.u32 d4, q8, #16 @ Cannot vshrn.u32 #20! ++ ++ add r2, r3 ++ ++ vmovn.u32 d1, q9 ++ vshrn.u32 d3, q9, #12 ++ vshrn.u32 d5, q9, #16 ++ ++ pld [r2, #0] ++ ++ vshrn.u16 d0, q0, #2 ++ vmovn.u16 d1, q1 ++ vshrn.u16 d2, q2, #6 ++ ++ vmovn.u32 d16, q10 ++ vshrn.u32 d18, q10, #12 ++ vshrn.u32 d20, q10, #16 ++ ++ vmovn.u32 d17, q11 ++ vshrn.u32 d19, q11, #12 ++ vshrn.u32 d21, q11, #16 ++ ++ pld [r2, #64] ++ ++ vshrn.u16 d4, q8, #2 ++ vmovn.u16 d5, q9 ++ vshrn.u16 d6, q10, #6 ++ ++ vmovn.u32 d16, q12 ++ vshrn.u32 d18, q12, #12 ++ vshrn.u32 d20, q12, #16 ++ ++ vmovn.u32 d17, q13 ++ vshrn.u32 d19, q13, #12 ++ vshrn.u32 d21, q13, #16 ++ ++ vshrn.u16 d16, q8, #2 ++ vmovn.u16 d17, q9 ++ vshrn.u16 d18, q10, #6 ++ ++ vmovn.u32 d20, q14 ++ vshrn.u32 d22, q14, #12 ++ vshrn.u32 d24, q14, #16 ++ ++ vmovn.u32 d21, q15 ++ vshrn.u32 d23, q15, #12 ++ vshrn.u32 d25, q15, #16 ++ ++ vshrn.u16 d20, q10, #2 ++ vmovn.u16 d21, q11 ++ vshrn.u16 d22, q12, #6 ++ ++ blt 2f ++ ++ vst3.8 {d0, d1, d2}, [r0], r12 ++ vst3.8 {d4, d5, d6}, [r4], r12 ++ vst3.8 {d16, d17, d18}, [r0], r12 ++ vst3.8 {d20, d21, d22}, [r4], r12 ++ ++ bne 1b ++ ++11: ++ subs r7, #1 ++ add r0, r1 ++ add r8, #128 ++ bne 10b ++ ++ pop {r4-r8, pc} ++ ++@ Partial final write ++2: ++ cmp r5, #48-96 ++ blt 1f ++ vst3.8 {d0, d1, d2}, [r0], r12 ++ vst3.8 {d4, d5, d6}, [r4], r12 ++ beq 11b ++ vmov q0, q8 ++ vmov q2, q10 ++ sub r5, #48 ++ vmov d2, d18 ++ vmov d6, d22 ++1: ++ cmp r5, #24-96 ++ blt 1f ++ vst3.8 {d0, d1, d2}, [r0]! ++ beq 11b ++ vmov q0, q2 ++ sub r5, #24 ++ vmov d2, d6 ++1: ++ cmp r5, #12-96 ++ blt 1f ++ vst3.8 {d0[0], d1[0], d2[0]}, [r0]! ++ vst3.8 {d0[1], d1[1], d2[1]}, [r0]! ++ vst3.8 {d0[2], d1[2], d2[2]}, [r0]! ++ vst3.8 {d0[3], d1[3], d2[3]}, [r0]! ++ beq 11b ++ vmov s0, s1 ++ sub r5, #12 ++ vmov s2, s3 ++ vmov s4, s5 ++1: ++ cmp r5, #6-96 ++ blt 1f ++ vst3.8 {d0[0], d1[0], d2[0]}, [r0]! ++ vst3.8 {d0[1], d1[1], d2[1]}, [r0]! ++ add r0, #12 ++ beq 11b ++ vshr.u32 d0, #16 ++ sub r5, #6 ++ vshr.u32 d1, #16 ++ vshr.u32 d2, #16 ++1: ++ cmp r5, #3-96 ++ blt 1f ++ vst3.8 {d0[0], d1[0], d2[0]}, [r0]! ++ beq 11b ++ sub r5, #3 ++ vshr.u32 d0, #8 ++ vshr.u32 d1, #8 ++1: ++ cmp r5, #2-96 ++ blt 1f ++ vst2.8 {d0[0], d1[0]}, [r0]! ++ b 11b ++1: ++ vst1.8 {d0[0]}, [r0]! ++ b 11b ++ ++endfunc ++ ++ +--- /dev/null ++++ b/libavutil/arm/rpi_sand_neon.h +@@ -0,0 +1,110 @@ ++/* ++Copyright (c) 2020 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox ++*/ ++ ++#ifndef AVUTIL_ARM_SAND_NEON_H ++#define AVUTIL_ARM_SAND_NEON_H ++ ++void ff_rpi_sand128b_stripe_to_8_10( ++ uint8_t * dest, // [r0] ++ const uint8_t * src1, // [r1] ++ const uint8_t * src2, // [r2] ++ unsigned int lines); // [r3] ++ ++void ff_rpi_sand8_lines_to_planar_y8( ++ uint8_t * dest, // [r0] ++ unsigned int dst_stride, // [r1] ++ const uint8_t * src, // [r2] ++ unsigned int src_stride1, // [r3] Ignored - assumed 128 ++ unsigned int src_stride2, // [sp, #0] -> r3 ++ unsigned int _x, // [sp, #4] Ignored - 0 ++ unsigned int y, // [sp, #8] (r7 in prefix) ++ unsigned int _w, // [sp, #12] -> r6 (cur r5) ++ unsigned int h); // [sp, #16] -> r7 ++ ++void ff_rpi_sand8_lines_to_planar_c8( ++ uint8_t * dst_u, // [r0] ++ unsigned int dst_stride_u, // [r1] ++ uint8_t * dst_v, // [r2] ++ unsigned int dst_stride_v, // [r3] ++ const uint8_t * src, // [sp, #0] -> r4, r5 ++ unsigned int stride1, // [sp, #4] 128 ++ unsigned int stride2, // [sp, #8] -> r8 ++ unsigned int _x, // [sp, #12] 0 ++ unsigned int y, // [sp, #16] (r7 in prefix) ++ unsigned int _w, // [sp, #20] -> r12, r6 ++ unsigned int h); // [sp, #24] -> r7 ++ ++void ff_rpi_sand30_lines_to_planar_y16( ++ uint8_t * dest, // [r0] ++ unsigned int dst_stride, // [r1] ++ const uint8_t * src, // [r2] ++ unsigned int src_stride1, // [r3] Ignored - assumed 128 ++ unsigned int src_stride2, // [sp, #0] -> r3 ++ unsigned int _x, // [sp, #4] Ignored - 0 ++ unsigned int y, // [sp, #8] (r7 in prefix) ++ unsigned int _w, // [sp, #12] -> r6 (cur r5) ++ unsigned int h); // [sp, #16] -> r7 ++ ++void ff_rpi_sand30_lines_to_planar_c16( ++ uint8_t * dst_u, // [r0] ++ unsigned int dst_stride_u, // [r1] ++ uint8_t * dst_v, // [r2] ++ unsigned int dst_stride_v, // [r3] ++ const uint8_t * src, // [sp, #0] -> r4, r5 ++ unsigned int stride1, // [sp, #4] 128 ++ unsigned int stride2, // [sp, #8] -> r8 ++ unsigned int _x, // [sp, #12] 0 ++ unsigned int y, // [sp, #16] (r7 in prefix) ++ unsigned int _w, // [sp, #20] -> r6, r9 ++ unsigned int h); // [sp, #24] -> r7 ++ ++void ff_rpi_sand30_lines_to_planar_p010( ++ uint8_t * dest, // [r0] ++ unsigned int dst_stride, // [r1] ++ const uint8_t * src, // [r2] ++ unsigned int src_stride1, // [r3] Ignored - assumed 128 ++ unsigned int src_stride2, // [sp, #0] -> r3 ++ unsigned int _x, // [sp, #4] Ignored - 0 ++ unsigned int y, // [sp, #8] (r7 in prefix) ++ unsigned int _w, // [sp, #12] -> r6 (cur r5) ++ unsigned int h); // [sp, #16] -> r7 ++ ++void ff_rpi_sand30_lines_to_planar_y8( ++ uint8_t * dest, // [r0] ++ unsigned int dst_stride, // [r1] ++ const uint8_t * src, // [r2] ++ unsigned int src_stride1, // [r3] Ignored - assumed 128 ++ unsigned int src_stride2, // [sp, #0] -> r3 ++ unsigned int _x, // [sp, #4] Ignored - 0 ++ unsigned int y, // [sp, #8] (r7 in prefix) ++ unsigned int _w, // [sp, #12] -> r6 (cur r5) ++ unsigned int h); // [sp, #16] -> r7 ++ ++#endif // AVUTIL_ARM_SAND_NEON_H ++ +--- a/libavutil/frame.c ++++ b/libavutil/frame.c +@@ -16,6 +16,8 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + ++#include "config.h" ++ + #include "channel_layout.h" + #include "avassert.h" + #include "buffer.h" +@@ -26,6 +28,9 @@ + #include "mem.h" + #include "samplefmt.h" + #include "hwcontext.h" ++#if CONFIG_SAND ++#include "rpi_sand_fns.h" ++#endif + + #if FF_API_FRAME_GET_SET + MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) +@@ -902,6 +907,12 @@ int av_frame_apply_cropping(AVFrame *fra + (frame->crop_top + frame->crop_bottom) >= frame->height) + return AVERROR(ERANGE); + ++#if CONFIG_SAND ++ // Sand cannot be cropped - do not try ++ if (av_rpi_is_sand_format(frame->format)) ++ return 0; ++#endif ++ + desc = av_pix_fmt_desc_get(frame->format); + if (!desc) + return AVERROR_BUG; +--- a/libavutil/frame.h ++++ b/libavutil/frame.h +@@ -968,6 +968,16 @@ int av_frame_apply_cropping(AVFrame *fra + */ + const char *av_frame_side_data_name(enum AVFrameSideDataType type); + ++ ++static inline int av_frame_cropped_width(const AVFrame * const frame) ++{ ++ return frame->width - (frame->crop_left + frame->crop_right); ++} ++static inline int av_frame_cropped_height(const AVFrame * const frame) ++{ ++ return frame->height - (frame->crop_top + frame->crop_bottom); ++} ++ + /** + * @} + */ +--- a/libavutil/hwcontext_drm.c ++++ b/libavutil/hwcontext_drm.c +@@ -19,8 +19,10 @@ + #include + #include + #include ++#include + + #include ++#include + #include + + #include "avassert.h" +@@ -28,6 +30,11 @@ + #include "hwcontext_drm.h" + #include "hwcontext_internal.h" + #include "imgutils.h" ++#include "libavutil/rpi_sand_fns.h" ++ ++#include ++#include ++#include + + + static void drm_device_free(AVHWDeviceContext *hwdev) +@@ -43,6 +50,11 @@ static int drm_device_create(AVHWDeviceC + AVDRMDeviceContext *hwctx = hwdev->hwctx; + drmVersionPtr version; + ++ if (device == NULL) { ++ hwctx->fd = -1; ++ return 0; ++ } ++ + hwctx->fd = open(device, O_RDWR); + if (hwctx->fd < 0) + return AVERROR(errno); +@@ -85,18 +97,37 @@ static int drm_get_buffer(AVHWFramesCont + typedef struct DRMMapping { + // Address and length of each mmap()ed region. + int nb_regions; ++ unsigned int dmaflags; + void *address[AV_DRM_MAX_PLANES]; + size_t length[AV_DRM_MAX_PLANES]; ++ int fds[AV_DRM_MAX_PLANES]; + } DRMMapping; + ++static int dmasync(const int fd, const unsigned int flags) ++{ ++ struct dma_buf_sync sync = { ++ .flags = flags ++ }; ++ while (ioctl(fd, DMA_BUF_IOCTL_SYNC, &sync) == -1) { ++ const int err = errno; ++ if (errno == EINTR) ++ continue; ++ av_log(NULL, AV_LOG_WARNING, "%s: ioctl failed: flags=%#x\n", __func__, flags); ++ return -err; ++ } ++ return 0; ++} ++ + static void drm_unmap_frame(AVHWFramesContext *hwfc, + HWMapDescriptor *hwmap) + { + DRMMapping *map = hwmap->priv; + int i; + +- for (i = 0; i < map->nb_regions; i++) ++ for (i = 0; i < map->nb_regions; i++) { + munmap(map->address[i], map->length[i]); ++ dmasync(map->fds[i], DMA_BUF_SYNC_END | map->dmaflags); ++ } + + av_free(map); + } +@@ -114,15 +145,28 @@ static int drm_map_frame(AVHWFramesConte + if (!map) + return AVERROR(ENOMEM); + ++ for (i = 0; i < AV_DRM_MAX_PLANES; i++) ++ map->fds[i] = -1; ++ + mmap_prot = 0; +- if (flags & AV_HWFRAME_MAP_READ) ++ if (flags & AV_HWFRAME_MAP_READ) { ++ map->dmaflags |= DMA_BUF_SYNC_READ; + mmap_prot |= PROT_READ; +- if (flags & AV_HWFRAME_MAP_WRITE) ++ } ++ if (flags & AV_HWFRAME_MAP_WRITE) { ++ map->dmaflags |= DMA_BUF_SYNC_WRITE; + mmap_prot |= PROT_WRITE; ++ } ++ ++ if (dst->format == AV_PIX_FMT_NONE) ++ dst->format = hwfc->sw_format; + + av_assert0(desc->nb_objects <= AV_DRM_MAX_PLANES); + for (i = 0; i < desc->nb_objects; i++) { +- addr = mmap(NULL, desc->objects[i].size, mmap_prot, MAP_SHARED, ++ dmasync(desc->objects[i].fd, DMA_BUF_SYNC_START | map->dmaflags); ++ map->fds[i] = desc->objects[i].fd; ++ ++ addr = mmap(NULL, desc->objects[i].size, mmap_prot, MAP_SHARED | MAP_POPULATE, + desc->objects[i].fd, 0); + if (addr == MAP_FAILED) { + err = AVERROR(errno); +@@ -151,6 +195,23 @@ static int drm_map_frame(AVHWFramesConte + + dst->width = src->width; + dst->height = src->height; ++ dst->crop_top = src->crop_top; ++ dst->crop_bottom = src->crop_bottom; ++ dst->crop_left = src->crop_left; ++ dst->crop_right = src->crop_right; ++ ++#if CONFIG_SAND ++ // Rework for sand frames ++ if (av_rpi_is_sand_frame(dst)) { ++ // As it stands the sand formats hold stride2 in linesize[3] ++ // linesize[0] & [1] contain stride1 which is always 128 for everything we do ++ // * Arguably this should be reworked s.t. stride2 is in linesize[0] & [1] ++ dst->linesize[3] = fourcc_mod_broadcom_param(desc->objects[0].format_modifier); ++ dst->linesize[0] = 128; ++ dst->linesize[1] = 128; ++ // *** Are we sure src->height is actually what we want ??? ++ } ++#endif + + err = ff_hwframe_map_create(src->hw_frames_ctx, dst, src, + &drm_unmap_frame, map); +@@ -160,7 +221,9 @@ static int drm_map_frame(AVHWFramesConte + return 0; + + fail: +- for (i = 0; i < desc->nb_objects; i++) { ++ for (i = 0; i < AV_DRM_MAX_PLANES; i++) { ++ if (map->fds[i] != -1) ++ dmasync(map->fds[i], DMA_BUF_SYNC_END | map->dmaflags); + if (map->address[i]) + munmap(map->address[i], map->length[i]); + } +@@ -172,16 +235,29 @@ static int drm_transfer_get_formats(AVHW + enum AVHWFrameTransferDirection dir, + enum AVPixelFormat **formats) + { +- enum AVPixelFormat *pix_fmts; ++ enum AVPixelFormat *p; + +- pix_fmts = av_malloc_array(2, sizeof(*pix_fmts)); +- if (!pix_fmts) ++ p = *formats = av_malloc_array(3, sizeof(*p)); ++ if (!p) + return AVERROR(ENOMEM); + +- pix_fmts[0] = ctx->sw_format; +- pix_fmts[1] = AV_PIX_FMT_NONE; ++ // **** Offer native sand too ???? ++ *p++ = ++#if CONFIG_SAND ++ ctx->sw_format == AV_PIX_FMT_RPI4_8 || ctx->sw_format == AV_PIX_FMT_SAND128 ? ++ AV_PIX_FMT_YUV420P : ++ ctx->sw_format == AV_PIX_FMT_RPI4_10 ? ++ AV_PIX_FMT_YUV420P10LE : ++#endif ++ ctx->sw_format; ++ ++#if CONFIG_SAND ++ if (ctx->sw_format == AV_PIX_FMT_RPI4_10 || ++ ctx->sw_format == AV_PIX_FMT_RPI4_8 || ctx->sw_format == AV_PIX_FMT_SAND128) ++ *p++ = AV_PIX_FMT_NV12; ++#endif + +- *formats = pix_fmts; ++ *p = AV_PIX_FMT_NONE; + return 0; + } + +@@ -197,18 +273,63 @@ static int drm_transfer_data_from(AVHWFr + map = av_frame_alloc(); + if (!map) + return AVERROR(ENOMEM); +- map->format = dst->format; + ++ // Map to default ++ map->format = AV_PIX_FMT_NONE; + err = drm_map_frame(hwfc, map, src, AV_HWFRAME_MAP_READ); + if (err) + goto fail; + +- map->width = dst->width; +- map->height = dst->height; ++#if 0 ++ av_log(hwfc, AV_LOG_INFO, "%s: src fmt=%d (%d), dst fmt=%d (%d) s=%dx%d l=%d/%d/%d/%d, d=%dx%d l=%d/%d/%d\n", __func__, ++ map->hwfc_format, AV_PIX_FMT_RPI4_8, dst->format, AV_PIX_FMT_YUV420P10LE, ++ map->width, map->height, ++ map->linesize[0], ++ map->linesize[1], ++ map->linesize[2], ++ map->linesize[3], ++ dst->width, dst->height, ++ dst->linesize[0], ++ dst->linesize[1], ++ dst->linesize[2]); ++#endif ++#if CONFIG_SAND ++ if (av_rpi_is_sand_frame(map)) { ++ // Preserve crop - later ffmpeg code assumes that we have in that it ++ // overwrites any crop that we create with the old values ++ unsigned int stride2 = map->linesize[3]; ++ const unsigned int w = FFMIN(dst->width, map->width); ++ const unsigned int h = FFMIN(dst->height, map->height); ++ ++ map->crop_top = 0; ++ map->crop_bottom = 0; ++ map->crop_left = 0; ++ map->crop_right = 0; ++ ++ if (av_rpi_sand_to_planar_frame(dst, map) != 0) ++ { ++ av_log(hwfc, AV_LOG_ERROR, "%s: Incompatible output pixfmt for sand\n", __func__); ++ err = AVERROR(EINVAL); ++ goto fail; ++ } ++ ++ dst->width = w; ++ dst->height = h; ++ } ++ else ++#endif ++ { ++ // Kludge mapped h/w s.t. frame_copy works ++ map->width = dst->width; ++ map->height = dst->height; ++ err = av_frame_copy(dst, map); ++ } + +- err = av_frame_copy(dst, map); + if (err) ++ { ++ av_log(hwfc, AV_LOG_ERROR, "%s: Copy fail\n", __func__); + goto fail; ++ } + + err = 0; + fail: +@@ -223,7 +344,10 @@ static int drm_transfer_data_to(AVHWFram + int err; + + if (src->width > hwfc->width || src->height > hwfc->height) ++ { ++ av_log(hwfc, AV_LOG_ERROR, "%s: H/w mismatch: %d/%d, %d/%d\n", __func__, dst->width, hwfc->width, dst->height, hwfc->height); + return AVERROR(EINVAL); ++ } + + map = av_frame_alloc(); + if (!map) +--- a/libavutil/pixdesc.c ++++ b/libavutil/pixdesc.c +@@ -2371,6 +2371,50 @@ static const AVPixFmtDescriptor av_pix_f + .name = "vulkan", + .flags = AV_PIX_FMT_FLAG_HWACCEL, + }, ++ [AV_PIX_FMT_SAND128] = { ++ .name = "sand128", ++ .nb_components = 3, ++ .log2_chroma_w = 1, ++ .log2_chroma_h = 1, ++ .comp = { ++ { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */ ++ { 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */ ++ { 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */ ++ }, ++ .flags = 0, ++ }, ++ [AV_PIX_FMT_SAND64_10] = { ++ .name = "sand64_10", ++ .nb_components = 3, ++ .log2_chroma_w = 1, ++ .log2_chroma_h = 1, ++ .comp = { ++ { 0, 2, 0, 0, 10, 0, 9, 1 }, /* Y */ ++ { 1, 4, 0, 0, 10, 3, 9, 1 }, /* U */ ++ { 1, 4, 2, 0, 10, 3, 9, 3 }, /* V */ ++ }, ++ .flags = 0, ++ }, ++ [AV_PIX_FMT_SAND64_16] = { ++ .name = "sand64_16", ++ .nb_components = 3, ++ .log2_chroma_w = 1, ++ .log2_chroma_h = 1, ++ .comp = { ++ { 0, 2, 0, 0, 16, 0, 15, 1 }, /* Y */ ++ { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */ ++ { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */ ++ }, ++ .flags = 0, ++ }, ++ [AV_PIX_FMT_RPI4_8] = { ++ .name = "rpi4_8", ++ .flags = AV_PIX_FMT_FLAG_HWACCEL, ++ }, ++ [AV_PIX_FMT_RPI4_10] = { ++ .name = "rpi4_10", ++ .flags = AV_PIX_FMT_FLAG_HWACCEL, ++ }, + }; + #if FF_API_PLUS1_MINUS1 + FF_ENABLE_DEPRECATION_WARNINGS +--- a/libavutil/pixfmt.h ++++ b/libavutil/pixfmt.h +@@ -357,6 +357,12 @@ enum AVPixelFormat { + + AV_PIX_FMT_Y210BE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, big-endian + AV_PIX_FMT_Y210LE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian ++// RPI - not on ifdef so can be got at by calling progs ++ AV_PIX_FMT_SAND128, ///< 4:2:0 8-bit 128x*Y stripe, 64x*UV stripe, then next x stripe, mysterious padding ++ AV_PIX_FMT_SAND64_10, ///< 4:2:0 10-bit 64x*Y stripe, 32x*UV stripe, then next x stripe, mysterious padding ++ AV_PIX_FMT_SAND64_16, ///< 4:2:0 16-bit 64x*Y stripe, 32x*UV stripe, then next x stripe, mysterious padding ++ AV_PIX_FMT_RPI4_8, ++ AV_PIX_FMT_RPI4_10, + + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + }; +--- /dev/null ++++ b/libavutil/rpi_sand_fn_pw.h +@@ -0,0 +1,227 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox ++*/ ++ ++// * Included twice from rpi_sand_fn with different PW ++ ++#define STRCAT(x,y) x##y ++ ++#if PW == 1 ++#define pixel uint8_t ++#define FUNC(f) STRCAT(f, 8) ++#elif PW == 2 ++#define pixel uint16_t ++#define FUNC(f) STRCAT(f, 16) ++#else ++#error Unexpected PW ++#endif ++ ++// Fetches a single patch - offscreen fixup not done here ++// w <= stride1 ++// unclipped ++void FUNC(av_rpi_sand_to_planar_y)(uint8_t * dst, const unsigned int dst_stride, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h) ++{ ++ const unsigned int x = _x; ++ const unsigned int w = _w; ++ const unsigned int mask = stride1 - 1; ++ ++#if PW == 1 && HAVE_SAND_ASM ++ if (_x == 0) { ++ ff_rpi_sand8_lines_to_planar_y8(dst, dst_stride, ++ src, stride1, stride2, _x, y, _w, h); ++ return; ++ } ++#endif ++ ++ if ((x & ~mask) == ((x + w) & ~mask)) { ++ // All in one sand stripe ++ const uint8_t * p = src + (x & mask) + y * stride1 + (x & ~mask) * stride2; ++ for (unsigned int i = 0; i != h; ++i, dst += dst_stride, p += stride1) { ++ memcpy(dst, p, w); ++ } ++ } ++ else ++ { ++ // Two+ stripe ++ const unsigned int sstride = stride1 * stride2; ++ const uint8_t * p1 = src + (x & mask) + y * stride1 + (x & ~mask) * stride2; ++ const uint8_t * p2 = p1 + sstride - (x & mask); ++ const unsigned int w1 = stride1 - (x & mask); ++ const unsigned int w3 = (x + w) & mask; ++ const unsigned int w2 = w - (w1 + w3); ++ ++ for (unsigned int i = 0; i != h; ++i, dst += dst_stride, p1 += stride1, p2 += stride1) { ++ unsigned int j; ++ const uint8_t * p = p2; ++ uint8_t * d = dst; ++ memcpy(d, p1, w1); ++ d += w1; ++ for (j = 0; j < w2; j += stride1, d += stride1, p += sstride) { ++ memcpy(d, p, stride1); ++ } ++ memcpy(d, p, w3); ++ } ++ } ++} ++ ++// x & w in bytes but not of interleave (i.e. offset = x*2 for U&V) ++ ++void FUNC(av_rpi_sand_to_planar_c)(uint8_t * dst_u, const unsigned int dst_stride_u, ++ uint8_t * dst_v, const unsigned int dst_stride_v, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h) ++{ ++ const unsigned int x = _x * 2; ++ const unsigned int w = _w * 2; ++ const unsigned int mask = stride1 - 1; ++ ++#if PW == 1 && HAVE_SAND_ASM ++ if (_x == 0) { ++ ff_rpi_sand8_lines_to_planar_c8(dst_u, dst_stride_u, dst_v, dst_stride_v, ++ src, stride1, stride2, _x, y, _w, h); ++ return; ++ } ++#endif ++ ++ if ((x & ~mask) == ((x + w) & ~mask)) { ++ // All in one sand stripe ++ const uint8_t * p1 = src + (x & mask) + y * stride1 + (x & ~mask) * stride2; ++ for (unsigned int i = 0; i != h; ++i, dst_u += dst_stride_u, dst_v += dst_stride_v, p1 += stride1) { ++ pixel * du = (pixel *)dst_u; ++ pixel * dv = (pixel *)dst_v; ++ const pixel * p = (const pixel *)p1; ++ for (unsigned int k = 0; k < w; k += 2 * PW) { ++ *du++ = *p++; ++ *dv++ = *p++; ++ } ++ } ++ } ++ else ++ { ++ // Two+ stripe ++ const unsigned int sstride = stride1 * stride2; ++ const unsigned int sstride_p = (sstride - stride1) / PW; ++ ++ const uint8_t * p1 = src + (x & mask) + y * stride1 + (x & ~mask) * stride2; ++ const uint8_t * p2 = p1 + sstride - (x & mask); ++ const unsigned int w1 = stride1 - (x & mask); ++ const unsigned int w3 = (x + w) & mask; ++ const unsigned int w2 = w - (w1 + w3); ++ ++ for (unsigned int i = 0; i != h; ++i, dst_u += dst_stride_u, dst_v += dst_stride_v, p1 += stride1, p2 += stride1) { ++ unsigned int j; ++ const pixel * p = (const pixel *)p1; ++ pixel * du = (pixel *)dst_u; ++ pixel * dv = (pixel *)dst_v; ++ for (unsigned int k = 0; k < w1; k += 2 * PW) { ++ *du++ = *p++; ++ *dv++ = *p++; ++ } ++ for (j = 0, p = (const pixel *)p2; j < w2; j += stride1, p += sstride_p) { ++ for (unsigned int k = 0; k < stride1; k += 2 * PW) { ++ *du++ = *p++; ++ *dv++ = *p++; ++ } ++ } ++ for (unsigned int k = 0; k < w3; k += 2 * PW) { ++ *du++ = *p++; ++ *dv++ = *p++; ++ } ++ } ++ } ++} ++ ++void FUNC(av_rpi_planar_to_sand_c)(uint8_t * dst_c, ++ unsigned int stride1, unsigned int stride2, ++ const uint8_t * src_u, const unsigned int src_stride_u, ++ const uint8_t * src_v, const unsigned int src_stride_v, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h) ++{ ++ const unsigned int x = _x * 2; ++ const unsigned int w = _w * 2; ++ const unsigned int mask = stride1 - 1; ++ if ((x & ~mask) == ((x + w) & ~mask)) { ++ // All in one sand stripe ++ uint8_t * p1 = dst_c + (x & mask) + y * stride1 + (x & ~mask) * stride2; ++ for (unsigned int i = 0; i != h; ++i, src_u += src_stride_u, src_v += src_stride_v, p1 += stride1) { ++ const pixel * su = (const pixel *)src_u; ++ const pixel * sv = (const pixel *)src_v; ++ pixel * p = (pixel *)p1; ++ for (unsigned int k = 0; k < w; k += 2 * PW) { ++ *p++ = *su++; ++ *p++ = *sv++; ++ } ++ } ++ } ++ else ++ { ++ // Two+ stripe ++ const unsigned int sstride = stride1 * stride2; ++ const unsigned int sstride_p = (sstride - stride1) / PW; ++ ++ const uint8_t * p1 = dst_c + (x & mask) + y * stride1 + (x & ~mask) * stride2; ++ const uint8_t * p2 = p1 + sstride - (x & mask); ++ const unsigned int w1 = stride1 - (x & mask); ++ const unsigned int w3 = (x + w) & mask; ++ const unsigned int w2 = w - (w1 + w3); ++ ++ for (unsigned int i = 0; i != h; ++i, src_u += src_stride_u, src_v += src_stride_v, p1 += stride1, p2 += stride1) { ++ unsigned int j; ++ const pixel * su = (const pixel *)src_u; ++ const pixel * sv = (const pixel *)src_v; ++ pixel * p = (pixel *)p1; ++ for (unsigned int k = 0; k < w1; k += 2 * PW) { ++ *p++ = *su++; ++ *p++ = *sv++; ++ } ++ for (j = 0, p = (pixel *)p2; j < w2; j += stride1, p += sstride_p) { ++ for (unsigned int k = 0; k < stride1; k += 2 * PW) { ++ *p++ = *su++; ++ *p++ = *sv++; ++ } ++ } ++ for (unsigned int k = 0; k < w3; k += 2 * PW) { ++ *p++ = *su++; ++ *p++ = *sv++; ++ } ++ } ++ } ++} ++ ++ ++#undef pixel ++#undef STRCAT ++#undef FUNC ++ +--- /dev/null ++++ b/libavutil/rpi_sand_fns.c +@@ -0,0 +1,445 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox ++*/ ++ ++#include "config.h" ++#include ++#include ++#include "rpi_sand_fns.h" ++#include "avassert.h" ++#include "frame.h" ++ ++#if ARCH_ARM && HAVE_NEON ++#include "arm/rpi_sand_neon.h" ++#define HAVE_SAND_ASM 1 ++#elif ARCH_AARCH64 && HAVE_NEON ++#include "aarch64/rpi_sand_neon.h" ++#define HAVE_SAND_ASM 1 ++#else ++#define HAVE_SAND_ASM 0 ++#endif ++ ++#define PW 1 ++#include "rpi_sand_fn_pw.h" ++#undef PW ++ ++#define PW 2 ++#include "rpi_sand_fn_pw.h" ++#undef PW ++ ++#if 1 ++// Simple round ++static void cpy16_to_8(uint8_t * dst, const uint8_t * _src, unsigned int n, const unsigned int shr) ++{ ++ const unsigned int rnd = (1 << shr) >> 1; ++ const uint16_t * src = (const uint16_t *)_src; ++ ++ for (; n != 0; --n) { ++ *dst++ = (*src++ + rnd) >> shr; ++ } ++} ++#else ++// Dithered variation ++static void cpy16_to_8(uint8_t * dst, const uint8_t * _src, unsigned int n, const unsigned int shr) ++{ ++ unsigned int rnd = (1 << shr) >> 1; ++ const unsigned int mask = ((1 << shr) - 1); ++ const uint16_t * src = (const uint16_t *)_src; ++ ++ for (; n != 0; --n) { ++ rnd = *src++ + (rnd & mask); ++ *dst++ = rnd >> shr; ++ } ++} ++#endif ++ ++// Fetches a single patch - offscreen fixup not done here ++// w <= stride1 ++// unclipped ++// _x & _w in pixels, strides in bytes ++void av_rpi_sand30_to_planar_y16(uint8_t * dst, const unsigned int dst_stride, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h) ++{ ++ const unsigned int x0 = (_x / 3) * 4; // Byte offset of the word ++ const unsigned int xskip0 = _x - (x0 >> 2) * 3; ++ const unsigned int x1 = ((_x + _w) / 3) * 4; ++ const unsigned int xrem1 = _x + _w - (x1 >> 2) * 3; ++ const unsigned int mask = stride1 - 1; ++ const uint8_t * p0 = src + (x0 & mask) + y * stride1 + (x0 & ~mask) * stride2; ++ const unsigned int slice_inc = ((stride2 - 1) * stride1) >> 2; // RHS of a stripe to LHS of next in words ++ ++#if HAVE_SAND_ASM ++ if (_x == 0) { ++ ff_rpi_sand30_lines_to_planar_y16(dst, dst_stride, src, stride1, stride2, _x, y, _w, h); ++ return; ++ } ++#endif ++ ++ if (x0 == x1) { ++ // ******************* ++ // Partial single word xfer ++ return; ++ } ++ ++ for (unsigned int i = 0; i != h; ++i, dst += dst_stride, p0 += stride1) ++ { ++ unsigned int x = x0; ++ const uint32_t * p = (const uint32_t *)p0; ++ uint16_t * d = (uint16_t *)dst; ++ ++ if (xskip0 != 0) { ++ const uint32_t p3 = *p++; ++ ++ if (xskip0 == 1) ++ *d++ = (p3 >> 10) & 0x3ff; ++ *d++ = (p3 >> 20) & 0x3ff; ++ ++ if (((x += 4) & mask) == 0) ++ p += slice_inc; ++ } ++ ++ while (x != x1) { ++ const uint32_t p3 = *p++; ++ *d++ = p3 & 0x3ff; ++ *d++ = (p3 >> 10) & 0x3ff; ++ *d++ = (p3 >> 20) & 0x3ff; ++ ++ if (((x += 4) & mask) == 0) ++ p += slice_inc; ++ } ++ ++ if (xrem1 != 0) { ++ const uint32_t p3 = *p; ++ ++ *d++ = p3 & 0x3ff; ++ if (xrem1 == 2) ++ *d++ = (p3 >> 10) & 0x3ff; ++ } ++ } ++} ++ ++ ++void av_rpi_sand30_to_planar_c16(uint8_t * dst_u, const unsigned int dst_stride_u, ++ uint8_t * dst_v, const unsigned int dst_stride_v, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h) ++{ ++ const unsigned int x0 = (_x / 3) * 8; // Byte offset of the word ++ const unsigned int xskip0 = _x - (x0 >> 3) * 3; ++ const unsigned int x1 = ((_x + _w) / 3) * 8; ++ const unsigned int xrem1 = _x + _w - (x1 >> 3) * 3; ++ const unsigned int mask = stride1 - 1; ++ const uint8_t * p0 = src + (x0 & mask) + y * stride1 + (x0 & ~mask) * stride2; ++ const unsigned int slice_inc = ((stride2 - 1) * stride1) >> 2; // RHS of a stripe to LHS of next in words ++ ++#if HAVE_SAND_ASM ++ if (_x == 0) { ++ ff_rpi_sand30_lines_to_planar_c16(dst_u, dst_stride_u, dst_v, dst_stride_v, ++ src, stride1, stride2, _x, y, _w, h); ++ return; ++ } ++#endif ++ ++ if (x0 == x1) { ++ // ******************* ++ // Partial single word xfer ++ return; ++ } ++ ++ for (unsigned int i = 0; i != h; ++i, dst_u += dst_stride_u, dst_v += dst_stride_v, p0 += stride1) ++ { ++ unsigned int x = x0; ++ const uint32_t * p = (const uint32_t *)p0; ++ uint16_t * du = (uint16_t *)dst_u; ++ uint16_t * dv = (uint16_t *)dst_v; ++ ++ if (xskip0 != 0) { ++ const uint32_t p3a = *p++; ++ const uint32_t p3b = *p++; ++ ++ if (xskip0 == 1) ++ { ++ *du++ = (p3a >> 20) & 0x3ff; ++ *dv++ = (p3b >> 0) & 0x3ff; ++ } ++ *du++ = (p3b >> 10) & 0x3ff; ++ *dv++ = (p3b >> 20) & 0x3ff; ++ ++ if (((x += 8) & mask) == 0) ++ p += slice_inc; ++ } ++ ++ while (x != x1) { ++ const uint32_t p3a = *p++; ++ const uint32_t p3b = *p++; ++ ++ *du++ = p3a & 0x3ff; ++ *dv++ = (p3a >> 10) & 0x3ff; ++ *du++ = (p3a >> 20) & 0x3ff; ++ *dv++ = p3b & 0x3ff; ++ *du++ = (p3b >> 10) & 0x3ff; ++ *dv++ = (p3b >> 20) & 0x3ff; ++ ++ if (((x += 8) & mask) == 0) ++ p += slice_inc; ++ } ++ ++ if (xrem1 != 0) { ++ const uint32_t p3a = *p++; ++ const uint32_t p3b = *p++; ++ ++ *du++ = p3a & 0x3ff; ++ *dv++ = (p3a >> 10) & 0x3ff; ++ if (xrem1 == 2) ++ { ++ *du++ = (p3a >> 20) & 0x3ff; ++ *dv++ = p3b & 0x3ff; ++ } ++ } ++ } ++} ++ ++// Fetches a single patch - offscreen fixup not done here ++// w <= stride1 ++// single lose bottom 2 bits truncation ++// _x & _w in pixels, strides in bytes ++void av_rpi_sand30_to_planar_y8(uint8_t * dst, const unsigned int dst_stride, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h) ++{ ++ const unsigned int x0 = (_x / 3) * 4; // Byte offset of the word ++ const unsigned int xskip0 = _x - (x0 >> 2) * 3; ++ const unsigned int x1 = ((_x + _w) / 3) * 4; ++ const unsigned int xrem1 = _x + _w - (x1 >> 2) * 3; ++ const unsigned int mask = stride1 - 1; ++ const uint8_t * p0 = src + (x0 & mask) + y * stride1 + (x0 & ~mask) * stride2; ++ const unsigned int slice_inc = ((stride2 - 1) * stride1) >> 2; // RHS of a stripe to LHS of next in words ++ ++#if HAVE_SAND_ASM ++ if (_x == 0) { ++ ff_rpi_sand30_lines_to_planar_y8(dst, dst_stride, src, stride1, stride2, _x, y, _w, h); ++ return; ++ } ++#endif ++ ++ if (x0 == x1) { ++ // ******************* ++ // Partial single word xfer ++ return; ++ } ++ ++ for (unsigned int i = 0; i != h; ++i, dst += dst_stride, p0 += stride1) ++ { ++ unsigned int x = x0; ++ const uint32_t * p = (const uint32_t *)p0; ++ uint8_t * d = dst; ++ ++ if (xskip0 != 0) { ++ const uint32_t p3 = *p++; ++ ++ if (xskip0 == 1) ++ *d++ = (p3 >> 12) & 0xff; ++ *d++ = (p3 >> 22) & 0xff; ++ ++ if (((x += 4) & mask) == 0) ++ p += slice_inc; ++ } ++ ++ while (x != x1) { ++ const uint32_t p3 = *p++; ++ *d++ = (p3 >> 2) & 0xff; ++ *d++ = (p3 >> 12) & 0xff; ++ *d++ = (p3 >> 22) & 0xff; ++ ++ if (((x += 4) & mask) == 0) ++ p += slice_inc; ++ } ++ ++ if (xrem1 != 0) { ++ const uint32_t p3 = *p; ++ ++ *d++ = (p3 >> 2) & 0xff; ++ if (xrem1 == 2) ++ *d++ = (p3 >> 12) & 0xff; ++ } ++ } ++} ++ ++ ++ ++// w/h in pixels ++void av_rpi_sand16_to_sand8(uint8_t * dst, const unsigned int dst_stride1, const unsigned int dst_stride2, ++ const uint8_t * src, const unsigned int src_stride1, const unsigned int src_stride2, ++ unsigned int w, unsigned int h, const unsigned int shr) ++{ ++ const unsigned int n = dst_stride1 / 2; ++ unsigned int j; ++ ++ // This is true for our current layouts ++ av_assert0(dst_stride1 == src_stride1); ++ ++ // As we have the same stride1 for src & dest and src is wider than dest ++ // then if we loop on src we can always write contiguously to dest ++ // We make no effort to copy an exact width - round up to nearest src stripe ++ // as we will always have storage in dest for that ++ ++#if ARCH_ARM && HAVE_NEON ++ if (shr == 3 && src_stride1 == 128) { ++ for (j = 0; j + n < w; j += dst_stride1) { ++ uint8_t * d = dst + j * dst_stride2; ++ const uint8_t * s1 = src + j * 2 * src_stride2; ++ const uint8_t * s2 = s1 + src_stride1 * src_stride2; ++ ++ ff_rpi_sand128b_stripe_to_8_10(d, s1, s2, h); ++ } ++ } ++ else ++#endif ++ { ++ for (j = 0; j + n < w; j += dst_stride1) { ++ uint8_t * d = dst + j * dst_stride2; ++ const uint8_t * s1 = src + j * 2 * src_stride2; ++ const uint8_t * s2 = s1 + src_stride1 * src_stride2; ++ ++ for (unsigned int i = 0; i != h; ++i, s1 += src_stride1, s2 += src_stride1, d += dst_stride1) { ++ cpy16_to_8(d, s1, n, shr); ++ cpy16_to_8(d + n, s2, n, shr); ++ } ++ } ++ } ++ ++ // Fix up a trailing dest half stripe ++ if (j < w) { ++ uint8_t * d = dst + j * dst_stride2; ++ const uint8_t * s1 = src + j * 2 * src_stride2; ++ ++ for (unsigned int i = 0; i != h; ++i, s1 += src_stride1, d += dst_stride1) { ++ cpy16_to_8(d, s1, n, shr); ++ } ++ } ++} ++ ++int av_rpi_sand_to_planar_frame(AVFrame * const dst, const AVFrame * const src) ++{ ++ const int w = av_frame_cropped_width(src); ++ const int h = av_frame_cropped_height(src); ++ const int x = src->crop_left; ++ const int y = src->crop_top; ++ ++ // We will crop as part of the conversion ++ dst->crop_top = 0; ++ dst->crop_left = 0; ++ dst->crop_bottom = 0; ++ dst->crop_right = 0; ++ ++ switch (src->format){ ++ case AV_PIX_FMT_SAND128: ++ case AV_PIX_FMT_RPI4_8: ++ switch (dst->format){ ++ case AV_PIX_FMT_YUV420P: ++ av_rpi_sand_to_planar_y8(dst->data[0], dst->linesize[0], ++ src->data[0], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x, y, w, h); ++ av_rpi_sand_to_planar_c8(dst->data[1], dst->linesize[1], ++ dst->data[2], dst->linesize[2], ++ src->data[1], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x/2, y/2, w/2, h/2); ++ break; ++ case AV_PIX_FMT_NV12: ++ av_rpi_sand_to_planar_y8(dst->data[0], dst->linesize[0], ++ src->data[0], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x, y, w, h); ++ av_rpi_sand_to_planar_y8(dst->data[1], dst->linesize[1], ++ src->data[1], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x/2, y/2, w, h/2); ++ break; ++ default: ++ return -1; ++ } ++ break; ++ case AV_PIX_FMT_SAND64_10: ++ switch (dst->format){ ++ case AV_PIX_FMT_YUV420P10: ++ av_rpi_sand_to_planar_y16(dst->data[0], dst->linesize[0], ++ src->data[0], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x*2, y, w*2, h); ++ av_rpi_sand_to_planar_c16(dst->data[1], dst->linesize[1], ++ dst->data[2], dst->linesize[2], ++ src->data[1], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x, y/2, w, h/2); ++ break; ++ default: ++ return -1; ++ } ++ break; ++ case AV_PIX_FMT_RPI4_10: ++ switch (dst->format){ ++ case AV_PIX_FMT_YUV420P10: ++ av_rpi_sand30_to_planar_y16(dst->data[0], dst->linesize[0], ++ src->data[0], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x, y, w, h); ++ av_rpi_sand30_to_planar_c16(dst->data[1], dst->linesize[1], ++ dst->data[2], dst->linesize[2], ++ src->data[1], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x/2, y/2, w/2, h/2); ++ break; ++ case AV_PIX_FMT_NV12: ++ av_rpi_sand30_to_planar_y8(dst->data[0], dst->linesize[0], ++ src->data[0], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x, y, w, h); ++ av_rpi_sand30_to_planar_y8(dst->data[1], dst->linesize[1], ++ src->data[1], ++ av_rpi_sand_frame_stride1(src), av_rpi_sand_frame_stride2(src), ++ x/2, y/2, w, h/2); ++ break; ++ default: ++ return -1; ++ } ++ break; ++ default: ++ return -1; ++ } ++ ++ return av_frame_copy_props(dst, src); ++} +--- /dev/null ++++ b/libavutil/rpi_sand_fns.h +@@ -0,0 +1,188 @@ ++/* ++Copyright (c) 2018 Raspberry Pi (Trading) Ltd. ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Authors: John Cox ++*/ ++ ++#ifndef AVUTIL_RPI_SAND_FNS ++#define AVUTIL_RPI_SAND_FNS ++ ++#include "libavutil/frame.h" ++ ++// For all these fns _x & _w are measured as coord * PW ++// For the C fns coords are in chroma pels (so luma / 2) ++// Strides are in bytes ++ ++void av_rpi_sand_to_planar_y8(uint8_t * dst, const unsigned int dst_stride, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++void av_rpi_sand_to_planar_y16(uint8_t * dst, const unsigned int dst_stride, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++ ++void av_rpi_sand_to_planar_c8(uint8_t * dst_u, const unsigned int dst_stride_u, ++ uint8_t * dst_v, const unsigned int dst_stride_v, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++void av_rpi_sand_to_planar_c16(uint8_t * dst_u, const unsigned int dst_stride_u, ++ uint8_t * dst_v, const unsigned int dst_stride_v, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++ ++void av_rpi_planar_to_sand_c8(uint8_t * dst_c, ++ unsigned int stride1, unsigned int stride2, ++ const uint8_t * src_u, const unsigned int src_stride_u, ++ const uint8_t * src_v, const unsigned int src_stride_v, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++void av_rpi_planar_to_sand_c16(uint8_t * dst_c, ++ unsigned int stride1, unsigned int stride2, ++ const uint8_t * src_u, const unsigned int src_stride_u, ++ const uint8_t * src_v, const unsigned int src_stride_v, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++ ++void av_rpi_sand30_to_planar_y16(uint8_t * dst, const unsigned int dst_stride, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++void av_rpi_sand30_to_planar_c16(uint8_t * dst_u, const unsigned int dst_stride_u, ++ uint8_t * dst_v, const unsigned int dst_stride_v, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++ ++void av_rpi_sand30_to_planar_y8(uint8_t * dst, const unsigned int dst_stride, ++ const uint8_t * src, ++ unsigned int stride1, unsigned int stride2, ++ unsigned int _x, unsigned int y, ++ unsigned int _w, unsigned int h); ++ ++// w/h in pixels ++void av_rpi_sand16_to_sand8(uint8_t * dst, const unsigned int dst_stride1, const unsigned int dst_stride2, ++ const uint8_t * src, const unsigned int src_stride1, const unsigned int src_stride2, ++ unsigned int w, unsigned int h, const unsigned int shr); ++ ++ ++// dst must contain required pixel format & allocated data buffers ++// Cropping on the src buffer will be honoured and dst crop will be set to zero ++int av_rpi_sand_to_planar_frame(AVFrame * const dst, const AVFrame * const src); ++ ++ ++static inline unsigned int av_rpi_sand_frame_stride1(const AVFrame * const frame) ++{ ++#ifdef RPI_ZC_SAND128_ONLY ++ // If we are sure we only only support 128 byte sand formats replace the ++ // var with a constant which should allow for better optimisation ++ return 128; ++#else ++ return frame->linesize[0]; ++#endif ++} ++ ++static inline unsigned int av_rpi_sand_frame_stride2(const AVFrame * const frame) ++{ ++ return frame->linesize[3]; ++} ++ ++ ++static inline int av_rpi_is_sand_format(const int format) ++{ ++ return (format >= AV_PIX_FMT_SAND128 && format <= AV_PIX_FMT_RPI4_10); ++} ++ ++static inline int av_rpi_is_sand_frame(const AVFrame * const frame) ++{ ++ return av_rpi_is_sand_format(frame->format); ++} ++ ++static inline int av_rpi_is_sand8_frame(const AVFrame * const frame) ++{ ++ return (frame->format == AV_PIX_FMT_SAND128 || frame->format == AV_PIX_FMT_RPI4_8); ++} ++ ++static inline int av_rpi_is_sand16_frame(const AVFrame * const frame) ++{ ++ return (frame->format >= AV_PIX_FMT_SAND64_10 && frame->format <= AV_PIX_FMT_SAND64_16); ++} ++ ++static inline int av_rpi_is_sand30_frame(const AVFrame * const frame) ++{ ++ return (frame->format == AV_PIX_FMT_RPI4_10); ++} ++ ++static inline int av_rpi_sand_frame_xshl(const AVFrame * const frame) ++{ ++ return av_rpi_is_sand8_frame(frame) ? 0 : 1; ++} ++ ++// If x is measured in bytes (not pixels) then this works for sand64_16 as ++// well as sand128 - but in the general case we work that out ++ ++static inline unsigned int av_rpi_sand_frame_off_y(const AVFrame * const frame, const unsigned int x_y, const unsigned int y) ++{ ++ const unsigned int stride1 = av_rpi_sand_frame_stride1(frame); ++ const unsigned int stride2 = av_rpi_sand_frame_stride2(frame); ++ const unsigned int x = x_y << av_rpi_sand_frame_xshl(frame); ++ const unsigned int x1 = x & (stride1 - 1); ++ const unsigned int x2 = x ^ x1; ++ ++ return x1 + stride1 * y + stride2 * x2; ++} ++ ++static inline unsigned int av_rpi_sand_frame_off_c(const AVFrame * const frame, const unsigned int x_c, const unsigned int y_c) ++{ ++ const unsigned int stride1 = av_rpi_sand_frame_stride1(frame); ++ const unsigned int stride2 = av_rpi_sand_frame_stride2(frame); ++ const unsigned int x = x_c << (av_rpi_sand_frame_xshl(frame) + 1); ++ const unsigned int x1 = x & (stride1 - 1); ++ const unsigned int x2 = x ^ x1; ++ ++ return x1 + stride1 * y_c + stride2 * x2; ++} ++ ++static inline uint8_t * av_rpi_sand_frame_pos_y(const AVFrame * const frame, const unsigned int x, const unsigned int y) ++{ ++ return frame->data[0] + av_rpi_sand_frame_off_y(frame, x, y); ++} ++ ++static inline uint8_t * av_rpi_sand_frame_pos_c(const AVFrame * const frame, const unsigned int x, const unsigned int y) ++{ ++ return frame->data[1] + av_rpi_sand_frame_off_c(frame, x, y); ++} ++ ++#endif ++ +--- /dev/null ++++ b/pi-util/BUILD.txt +@@ -0,0 +1,59 @@ ++Building Pi FFmpeg ++================== ++ ++Current only building on a Pi is supported. ++This builds ffmpeg the way I've tested it ++ ++Get all dependencies - the current package dependencies are good enough ++ ++$ sudo apt-get build-dep ffmpeg ++ ++Configure using the pi-util/conf_native.sh script ++------------------------------------------------- ++ ++This sets the normal release options and creates an ouutput dir to build into ++The directory name will depend on system and options but will be under out/ ++ ++There are a few choices here ++ --mmal build including the legacy mmal-based decoders and zero-copy code ++ this requires appropriate libraries which currently will exist for ++ armv7 but not arm64 ++ --noshared ++ Build a static image rather than a shared library one. Static is ++ easier for testing as there is no need to worry about library ++ paths being confused and therefore running the wrong code, Shared ++ is what is needed, in most cases, when building for use by other ++ programs. ++ ++So for a static build ++--------------------- ++ ++$ pi-util/conf_native.sh --noshared ++ ++$ make -j8 -C out/ ++ ++You can now run ffmpeg directly from where it was built ++ ++For a shared build ++------------------ ++ ++$ pi-util/conf_native.sh ++ ++You will normally want an install target if shared. Note that the script has ++set this up to be generated in out//install, you don't have to worry ++about overwriting your system libs. ++ ++$ make -j8 -C out/ install ++ ++You can now set LD_LIBRARY_PATH appropriately and run ffmpeg from where it was ++built or install the image on the system - you have to be careful to get rid ++of all other ffmpeg libs or confusion may result. There is a little script ++that wipes all other versions - obviously use with care! ++ ++$ sudo pi-util/clean_usr_libs.sh ++ ++Then simply copying from the install to /usr works ++ ++$ sudo cp -r out//install/* /usr ++ ++ +--- /dev/null ++++ b/pi-util/NOTES.txt +@@ -0,0 +1,69 @@ ++Notes on the hevc_rpi decoder & associated support code ++------------------------------------------------------- ++ ++There are 3 main parts to the existing code: ++ ++1) The decoder - this is all in libavcodec as rpi_hevc*. ++ ++2) A few filters to deal with Sand frames and a small patch to ++automatically select the sand->i420 converter when required. ++ ++3) A kludge in ffmpeg.c to display the decoded video. This could & should ++be converted into a proper ffmpeg display module. ++ ++ ++Decoder ++------- ++ ++The decoder is a modified version of the existing ffmpeg hevc decoder. ++Generally it is ~100% faster than the existing ffmpeg hevc s/w decoder. ++More complex bitstreams can be up to ~200% faster but particularly easy ++streams can cut its advantage down to ~50%. This means that a Pi3+ can ++display nearly all 8-bit 1080p30 streams and with some overclocking it can ++display most lower bitrate 10-bit 1080p30 streams - this latter case is ++not helped by the requirement to downsample to 8-bit before display on a ++Pi. ++ ++It has had co-processor offload added for inter-pred and large block ++residual transform. Various parts have had optimized ARM NEON assembler ++added and the existing ARM asm sections have been profiled and ++re-optimized for A53. The main C code has been substantially reworked at ++its lower levels in an attempt to optimize it and minimize memory ++bandwidth. To some extent code paths that deal with frame types that it ++doesn't support have been pruned. ++ ++It outputs frames in Broadcom Sand format. This is a somewhat annoying ++layout that doesn't fit into ffmpegs standard frame descriptions. It has ++vertical stripes of 128 horizontal pixels (64 in 10 bit forms) with Y for ++the stripe followed by interleaved U & V, that is then followed by the Y ++for the next stripe, etc. The final stripe is always padded to ++stripe-width. This is used in an attempt to help with cache locality and ++cut down on the number of dram bank switches. It is annoying to use for ++inter-pred with conventional processing but the way the Pi QPU (which is ++used for inter-pred) works means that it has negligible downsides here and ++the improved memory performance exceeds the overhead of the increased ++complexity in the rest of the code. ++ ++Frames must be allocated out of GPU memory (as otherwise they can't be ++accessed by the co-processors). Utility functions (in rpi_zc.c) have been ++written to make this easier. As the frames are already in GPU memory they ++can be displayed by the Pi h/w without any further copying. ++ ++ ++Known non-features ++------------------ ++ ++Frame allocation should probably be done in some other way in order to fit ++into the standard framework better. ++ ++Sand frames are currently declared as software frames, there is an ++argument that they should be hardware frames but they aren't really. ++ ++There must be a better way of auto-selecting the hevc_rpi decoder over the ++normal s/w hevc decoder, but I became confused by the existing h/w ++acceleration framework and what I wanted to do didn't seem to fit in ++neatly. ++ ++Display should be a proper device rather than a kludge in ffmpeg.c ++ ++ +--- /dev/null ++++ b/pi-util/TESTMESA.txt +@@ -0,0 +1,82 @@ ++# Setup & Build instructions for testing Argon30 mesa support (on Pi4) ++ ++# These assume that the drm_mmal test for Sand8 has been built on this Pi ++# as build relies on many of the same files ++ ++# 1st get everything required to build ffmpeg ++# If sources aren't already enabled on your Pi then enable them ++sudo su ++sed "s/#deb-src/deb-src/" /etc/apt/sources.list > /tmp/sources.list ++sed "s/#deb-src/deb-src/" /etc/apt/sources.list.d/raspi.list > /tmp/raspi.list ++mv /tmp/sources.list /etc/apt/ ++mv /tmp/raspi.list /etc/apt/sources.list.d/ ++apt update ++ ++# Get dependancies ++sudo apt build-dep ffmpeg ++ ++sudo apt install meson libepoxy-dev libxcb-dri3-dev libxcb1-dev libx11-dev libx11-xcb-dev libdrm-dev ++ ++# Enable H265 V4L2 request decoder ++sudo su ++echo dtoverlay=rpivid-v4l2 >> /boot/config.txt ++# You may also want to add more CMA if you are going to try 4k videos ++# Change the dtoverlay=vc4-fkms-v3d line in config.txt to read ++# dtoverlay=vc4-fkms-v3d,cma-512 ++reboot ++# Check it has turned up ++ls -la /dev/video* ++# This should include video19 ++# crw-rw----+ 1 root video 81, 7 Aug 4 17:25 /dev/video19 ++ ++# Currently on the Pi the linux headers from the debian distro don't match ++# the kernel that we ship and we need to update them - hopefully this step ++# will be unneeded in the future ++sudo apt install git bc bison flex libssl-dev make ++git clone --depth=1 https://github.com/raspberrypi/linux --branch rpi-5.10.y ++cd linux ++KERNEL=kernel7l ++make bcm2711_defconfig ++make headers_install ++sudo cp -r usr/include/linux /usr/include ++cd .. ++ ++# Config - this builds a staticly linked ffmpeg which is easier for testing ++pi-util/conf_native.sh --noshared ++ ++# Build (this is a bit dull) ++# If you want to poke the source the libavdevice/egl_vout.c contains the ++# output code - ++cd out/armv7-static-rel ++ ++# Check that you have actually configured V4L2 request ++grep HEVC_V4L2REQUEST config.h ++# You are hoping for ++# #define CONFIG_HEVC_V4L2REQUEST_HWACCEL 1 ++# if you get 0 then the config has failed ++ ++make -j6 ++ ++# Grab test streams ++wget http://www.jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv ++wget http://www.jell.yfish.us/media/jellyfish-3-mbps-hd-hevc.mkv ++wget http://www.jell.yfish.us/media/jellyfish-3-mbps-hd-hevc-10bit.mkv ++ ++# Test i420 output (works currently) ++./ffmpeg -no_cvt_hw -vcodec h264_v4l2m2m -i jellyfish-3-mbps-hd-h264.mkv -f vout_egl - ++ ++# Test Sand8 output - doesn't currently work but should once you have ++# Sand8 working in drm_mmal. I can't guarantee that this will work as ++# I can't test this path with a known working format, but the debug looks ++# good. If this doesn't work & drm_mmal does with sand8 then come back to me ++# The "show_all 1" forces vout to display every frame otherwise it drops any ++# frame that would cause it to block ++./ffmpeg -no_cvt_hw -hwaccel drm -vcodec hevc -i jellyfish-3-mbps-hd-hevc.mkv -show_all 1 -f vout_egl - ++ ++# Test Sand30 - doesn't currently work ++# (Beware that when FFmpeg errors out it often leaves your teminal window ++# in a state where you need to reset it) ++./ffmpeg -no_cvt_hw -hwaccel drm -vcodec hevc -i jellyfish-3-mbps-hd-hevc-10bit.mkv -f vout_egl - ++ ++ ++ +--- /dev/null ++++ b/pi-util/clean_usr_libs.sh +@@ -0,0 +1,26 @@ ++set -e ++U=/usr/lib/arm-linux-gnueabihf ++rm -f $U/libavcodec.* ++rm -f $U/libavdevice.* ++rm -f $U/libavfilter.* ++rm -f $U/libavformat.* ++rm -f $U/libavutil.* ++rm -f $U/libswresample.* ++rm -f $U/libswscale.* ++U=/usr/lib/arm-linux-gnueabihf/neon/vfp ++rm -f $U/libavcodec.* ++rm -f $U/libavdevice.* ++rm -f $U/libavfilter.* ++rm -f $U/libavformat.* ++rm -f $U/libavutil.* ++rm -f $U/libswresample.* ++rm -f $U/libswscale.* ++U=/usr/lib/aarch64-linux-gnu ++rm -f $U/libavcodec.* ++rm -f $U/libavdevice.* ++rm -f $U/libavfilter.* ++rm -f $U/libavformat.* ++rm -f $U/libavutil.* ++rm -f $U/libswresample.* ++rm -f $U/libswscale.* ++ +--- /dev/null ++++ b/pi-util/conf_arm64_native.sh +@@ -0,0 +1,45 @@ ++echo "Configure for ARM64 native build" ++ ++#RPI_KEEPS="-save-temps=obj" ++ ++SHARED_LIBS="--enable-shared" ++if [ "$1" == "--noshared" ]; then ++ SHARED_LIBS="--disable-shared" ++ echo Static libs ++ OUT=out/arm64-static-rel ++else ++ echo Shared libs ++ OUT=out/arm64-shared-rel ++fi ++ ++mkdir -p $OUT ++cd $OUT ++ ++A=aarch64-linux-gnu ++USR_PREFIX=`pwd`/install ++LIB_PREFIX=$USR_PREFIX/lib/$A ++INC_PREFIX=$USR_PREFIX/include/$A ++ ++../../configure \ ++ --prefix=$USR_PREFIX\ ++ --libdir=$LIB_PREFIX\ ++ --incdir=$INC_PREFIX\ ++ --disable-stripping\ ++ --disable-thumb\ ++ --disable-mmal\ ++ --enable-sand\ ++ --enable-v4l2-request\ ++ --enable-libdrm\ ++ --enable-epoxy\ ++ --enable-libudev\ ++ --enable-vout-drm\ ++ --enable-vout-egl\ ++ $SHARED_LIBS\ ++ --extra-cflags="-ggdb" ++ ++# --enable-decoder=hevc_rpi\ ++# --enable-extra-warnings\ ++# --arch=armv71\ ++ ++# gcc option for getting asm listing ++# -Wa,-ahls +--- /dev/null ++++ b/pi-util/conf_h265.2016.csv +@@ -0,0 +1,195 @@ ++1,HEVC_v1/AMP_A_Samsung_7,AMP_A_Samsung_7.bin,AMP_A_Samsung_7.md5,8 ++1,HEVC_v1/AMP_B_Samsung_7,AMP_B_Samsung_7.bin,AMP_B_Samsung_7.md5,8 ++1,HEVC_v1/AMP_D_Hisilicon_3,AMP_D_Hisilicon.bit,AMP_D_Hisilicon_3.yuv.md5,8 ++1,HEVC_v1/AMP_E_Hisilicon_3,AMP_E_Hisilicon.bit,AMP_E_Hisilicon_3.yuv.md5,8 ++1,HEVC_v1/AMP_F_Hisilicon_3,AMP_F_Hisilicon_3.bit,AMP_F_Hisilicon_3.yuv.md5,8 ++1,HEVC_v1/AMVP_A_MTK_4,AMVP_A_MTK_4.bit,AMVP_A_MTK_4.md5,8 ++1,HEVC_v1/AMVP_B_MTK_4,AMVP_B_MTK_4.bit,AMVP_B_MTK_4.md5,8 ++1,HEVC_v1/AMVP_C_Samsung_7,AMVP_C_Samsung_7.bin,AMVP_C_Samsung_7.md5,8 ++1,HEVC_v1/BUMPING_A_ericsson_1,BUMPING_A_ericsson_1.bit,BUMPING_A_ericsson_1.md5,8 ++1,HEVC_v1/CAINIT_A_SHARP_4,CAINIT_A_SHARP_4.bit,CAINIT_A_SHARP_4.md5,8 ++1,HEVC_v1/CAINIT_B_SHARP_4,CAINIT_B_SHARP_4.bit,CAINIT_B_SHARP_4.md5,8 ++1,HEVC_v1/CAINIT_C_SHARP_3,CAINIT_C_SHARP_3.bit,CAINIT_C_SHARP_3.md5,8 ++1,HEVC_v1/CAINIT_D_SHARP_3,CAINIT_D_SHARP_3.bit,CAINIT_D_SHARP_3.md5,8 ++1,HEVC_v1/CAINIT_E_SHARP_3,CAINIT_E_SHARP_3.bit,CAINIT_E_SHARP_3.md5,8 ++1,HEVC_v1/CAINIT_F_SHARP_3,CAINIT_F_SHARP_3.bit,CAINIT_F_SHARP_3.md5,8 ++1,HEVC_v1/CAINIT_G_SHARP_3,CAINIT_G_SHARP_3.bit,CAINIT_G_SHARP_3.md5,8 ++1,HEVC_v1/CAINIT_H_SHARP_3,CAINIT_H_SHARP_3.bit,CAINIT_H_SHARP_3.md5,8 ++1,HEVC_v1/CIP_A_Panasonic_3,CIP_A_Panasonic_3.bit,CIP_A_Panasonic_3_yuv.md5,8 ++1,HEVC_v1/cip_B_NEC_3,cip_B_NEC_3.bit,cip_B_NEC_3.md5,8 ++1,HEVC_v1/CIP_C_Panasonic_2,CIP_C_Panasonic_2.bit,CIP_C_Panasonic_2_yuv.md5,8 ++1,HEVC_v1/CONFWIN_A_Sony_1,CONFWIN_A_Sony_1.bit,CONFWIN_A_Sony_1.md5,8 ++1,HEVC_v1/DBLK_A_MAIN10_VIXS_4,DBLK_A_MAIN10_VIXS_4.bit,DBLK_A_MAIN10_VIXS_4.md5,10 ++1,HEVC_v1/DBLK_A_SONY_3,DBLK_A_SONY_3.bit,DBLK_A_SONY_3.bit.yuv.md5,8 ++1,HEVC_v1/DBLK_B_SONY_3,DBLK_B_SONY_3.bit,DBLK_B_SONY_3.bit.yuv.md5,8 ++1,HEVC_v1/DBLK_C_SONY_3,DBLK_C_SONY_3.bit,DBLK_C_SONY_3.bit.yuv.md5,8 ++1,HEVC_v1/DBLK_D_VIXS_2,DBLK_D_VIXS_2.bit,DBLK_D_VIXS_2_yuv.md5,8 ++1,HEVC_v1/DBLK_E_VIXS_2,DBLK_E_VIXS_2.bit,DBLK_E_VIXS_2_yuv.md5,8 ++1,HEVC_v1/DBLK_F_VIXS_2,DBLK_F_VIXS_2.bit,DBLK_F_VIXS_2_yuv.md5,8 ++1,HEVC_v1/DBLK_G_VIXS_2,DBLK_G_VIXS_2.bit,DBLK_G_VIXS_2_yuv.md5,8 ++1,HEVC_v1/DELTAQP_A_BRCM_4,DELTAQP_A_BRCM_4.bit,DELTAQP_A_BRCM_4_yuv.md5,8 ++1,HEVC_v1/DELTAQP_B_SONY_3,DELTAQP_B_SONY_3.bit,DELTAQP_B_SONY_3.bit.yuv.md5,8 ++1,HEVC_v1/DELTAQP_C_SONY_3,DELTAQP_C_SONY_3.bit,DELTAQP_C_SONY_3.bit.yuv.md5,8 ++1,HEVC_v1/DSLICE_A_HHI_5,DSLICE_A_HHI_5.bin,DSLICE_A_HHI_5.md5,8 ++1,HEVC_v1/DSLICE_B_HHI_5,DSLICE_B_HHI_5.bin,DSLICE_B_HHI_5.md5,8 ++1,HEVC_v1/DSLICE_C_HHI_5,DSLICE_C_HHI_5.bin,DSLICE_C_HHI_5.md5,8 ++1,HEVC_v1/ENTP_A_QUALCOMM_1,ENTP_A_Qualcomm_1.bit,ENTP_A_Qualcomm_1.md5,8 ++1,HEVC_v1/ENTP_B_Qualcomm_1,ENTP_B_Qualcomm_1.bit,ENTP_B_Qualcomm_1.md5,8 ++1,HEVC_v1/ENTP_C_Qualcomm_1,ENTP_C_Qualcomm_1.bit,ENTP_C_Qualcomm_1.md5,8 ++1,HEVC_v1/EXT_A_ericsson_4,EXT_A_ericsson_4.bit,EXT_A_ericsson_4.md5,8 ++1,HEVC_v1/FILLER_A_Sony_1,FILLER_A_Sony_1.bit,FILLER_A_Sony_1.md5,8 ++1,HEVC_v1/HRD_A_Fujitsu_3,HRD_A_Fujitsu_3.bin,HRD_A_Fujitsu_3.md5,8 ++1,HEVC_v1/INITQP_A_Sony_1,INITQP_A_Sony_1.bit,INITQP_A_Sony_1.md5,8 ++1,HEVC_v1/INITQP_B_Main10_Sony_1,INITQP_B_Main10_Sony_1.bit,INITQP_B_Main10_Sony_1.md5,10 ++1,HEVC_v1/ipcm_A_NEC_3,ipcm_A_NEC_3.bit,ipcm_A_NEC_3.md5,8 ++1,HEVC_v1/ipcm_B_NEC_3,ipcm_B_NEC_3.bit,ipcm_B_NEC_3.md5,8 ++1,HEVC_v1/ipcm_C_NEC_3,ipcm_C_NEC_3.bit,ipcm_C_NEC_3.md5,8 ++1,HEVC_v1/ipcm_D_NEC_3,ipcm_D_NEC_3.bit,ipcm_D_NEC_3.md5,8 ++1,HEVC_v1/ipcm_E_NEC_2,ipcm_E_NEC_2.bit,ipcm_E_NEC_2.md5,8 ++1,HEVC_v1/IPRED_A_docomo_2,IPRED_A_docomo_2.bit,IPRED_A_docomo_2.md5,8 ++1,HEVC_v1/IPRED_B_Nokia_3,IPRED_B_Nokia_3.bit,IPRED_B_Nokia_3_yuv.md5,8 ++1,HEVC_v1/IPRED_C_Mitsubishi_3,IPRED_C_Mitsubishi_3.bit,IPRED_C_Mitsubishi_3_yuv.md5,8 ++1,HEVC_v1/LS_A_Orange_2,LS_A_Orange_2.bit,LS_A_Orange_2_yuv.md5,8 ++1,HEVC_v1/LS_B_Orange_4,LS_B_Orange_4.bit,LS_B_Orange_4_yuv.md5,8 ++1,HEVC_v1/LTRPSPS_A_Qualcomm_1,LTRPSPS_A_Qualcomm_1.bit,LTRPSPS_A_Qualcomm_1.md5,8 ++1,HEVC_v1/MAXBINS_A_TI_5,MAXBINS_A_TI_5.bit,MAXBINS_A_TI_5_yuv.md5,8 ++1,HEVC_v1/MAXBINS_B_TI_5,MAXBINS_B_TI_5.bit,MAXBINS_B_TI_5_yuv.md5,8 ++1,HEVC_v1/MAXBINS_C_TI_5,MAXBINS_C_TI_5.bit,MAXBINS_C_TI_5_yuv.md5,8 ++1,HEVC_v1/MERGE_A_TI_3,MERGE_A_TI_3.bit,MERGE_A_TI_3.md5,8 ++1,HEVC_v1/MERGE_B_TI_3,MERGE_B_TI_3.bit,MERGE_B_TI_3.md5,8 ++1,HEVC_v1/MERGE_C_TI_3,MERGE_C_TI_3.bit,MERGE_C_TI_3.md5,8 ++1,HEVC_v1/MERGE_D_TI_3,MERGE_D_TI_3.bit,MERGE_D_TI_3.md5,8 ++1,HEVC_v1/MERGE_E_TI_3,MERGE_E_TI_3.bit,MERGE_E_TI_3.md5,8 ++1,HEVC_v1/MERGE_F_MTK_4,MERGE_F_MTK_4.bit,MERGE_F_MTK_4.md5,8 ++1,HEVC_v1/MERGE_G_HHI_4,MERGE_G_HHI_4.bit,MERGE_G_HHI_4.md5,8 ++1,HEVC_v1/MVCLIP_A_qualcomm_3,MVCLIP_A_qualcomm_3.bit,MVCLIP_A_qualcomm_3.yuv.md5,8 ++1,HEVC_v1/MVDL1ZERO_A_docomo_4,MVDL1ZERO_A_docomo_4.bit,MVDL1ZERO_A_docomo_4.md5,8 ++1,HEVC_v1/MVEDGE_A_qualcomm_3,MVEDGE_A_qualcomm_3.bit,MVEDGE_A_qualcomm_3.yuv.md5,8 ++1,HEVC_v1/NoOutPrior_A_Qualcomm_1,NoOutPrior_A_Qualcomm_1.bit,NoOutPrior_A_Qualcomm_1.md5,8 ++1,HEVC_v1/NoOutPrior_B_Qualcomm_1,NoOutPrior_B_Qualcomm_1.bit,NoOutPrior_B_Qualcomm_1.md5,8 ++1,HEVC_v1/NUT_A_ericsson_5,NUT_A_ericsson_5.bit,NUT_A_ericsson_5.md5,8 ++1,HEVC_v1/OPFLAG_A_Qualcomm_1,OPFLAG_A_Qualcomm_1.bit,OPFLAG_A_Qualcomm_1.md5,8 ++1,HEVC_v1/OPFLAG_B_Qualcomm_1,OPFLAG_B_Qualcomm_1.bit,OPFLAG_B_Qualcomm_1.md5,8 ++1,HEVC_v1/OPFLAG_C_Qualcomm_1,OPFLAG_C_Qualcomm_1.bit,OPFLAG_C_Qualcomm_1.md5,8 ++1,HEVC_v1/PICSIZE_A_Bossen_1,PICSIZE_A_Bossen_1.bin,PICSIZE_A_Bossen_1.md5,8 ++1,HEVC_v1/PICSIZE_B_Bossen_1,PICSIZE_B_Bossen_1.bin,PICSIZE_B_Bossen_1.md5,8 ++1,HEVC_v1/PICSIZE_C_Bossen_1,PICSIZE_C_Bossen_1.bin,PICSIZE_C_Bossen_1.md5,8 ++1,HEVC_v1/PICSIZE_D_Bossen_1,PICSIZE_D_Bossen_1.bin,PICSIZE_D_Bossen_1.md5,8 ++1,HEVC_v1/PMERGE_A_TI_3,PMERGE_A_TI_3.bit,PMERGE_A_TI_3.md5,8 ++1,HEVC_v1/PMERGE_B_TI_3,PMERGE_B_TI_3.bit,PMERGE_B_TI_3.md5,8 ++1,HEVC_v1/PMERGE_C_TI_3,PMERGE_C_TI_3.bit,PMERGE_C_TI_3.md5,8 ++1,HEVC_v1/PMERGE_D_TI_3,PMERGE_D_TI_3.bit,PMERGE_D_TI_3.md5,8 ++1,HEVC_v1/PMERGE_E_TI_3,PMERGE_E_TI_3.bit,PMERGE_E_TI_3.md5,8 ++1,HEVC_v1/POC_A_Bossen_3,POC_A_Bossen_3.bin,POC_A_Bossen_3.md5,8 ++1,HEVC_v1/PPS_A_qualcomm_7,PPS_A_qualcomm_7.bit,PPS_A_qualcomm_7.yuv.md5,8 ++1,HEVC_v1/PS_B_VIDYO_3,PS_B_VIDYO_3.bit,PS_B_VIDYO_3_yuv.md5,8 ++1,HEVC_v1/RAP_A_docomo_6,RAP_A_docomo_6.bit,RAP_A_docomo_6.md5,8 ++1,HEVC_v1/RAP_B_Bossen_2,RAP_B_Bossen_2.bit,RAP_B_Bossen_2.md5,8 ++1,HEVC_v1/RPLM_A_qualcomm_4,RPLM_A_qualcomm_4.bit,RPLM_A_qualcomm_4.yuv.md5,8 ++1,HEVC_v1/RPLM_B_qualcomm_4,RPLM_B_qualcomm_4.bit,RPLM_B_qualcomm_4.yuv.md5,8 ++1,HEVC_v1/RPS_A_docomo_5,RPS_A_docomo_5.bit,RPS_A_docomo_5.md5,8 ++1,HEVC_v1/RPS_B_qualcomm_5,RPS_B_qualcomm_5.bit,RPS_B_qualcomm_5.yuv.md5,8 ++1,HEVC_v1/RPS_C_ericsson_5,RPS_C_ericsson_5.bit,RPS_C_ericsson_5.md5,8 ++1,HEVC_v1/RPS_D_ericsson_6,RPS_D_ericsson_6.bit,RPS_D_ericsson_6.md5,8 ++1,HEVC_v1/RPS_E_qualcomm_5,RPS_E_qualcomm_5.bit,RPS_E_qualcomm_5.yuv.md5,8 ++1,HEVC_v1/RPS_F_docomo_2,RPS_F_docomo_2.bit,RPS_F_docomo_2.md5,8 ++1,HEVC_v1/RQT_A_HHI_4,RQT_A_HHI_4.bit,RQT_A_HHI_4.md5,8 ++1,HEVC_v1/RQT_B_HHI_4,RQT_B_HHI_4.bit,RQT_B_HHI_4.md5,8 ++1,HEVC_v1/RQT_C_HHI_4,RQT_C_HHI_4.bit,RQT_C_HHI_4.md5,8 ++1,HEVC_v1/RQT_D_HHI_4,RQT_D_HHI_4.bit,RQT_D_HHI_4.md5,8 ++1,HEVC_v1/RQT_E_HHI_4,RQT_E_HHI_4.bit,RQT_E_HHI_4.md5,8 ++1,HEVC_v1/RQT_F_HHI_4,RQT_F_HHI_4.bit,RQT_F_HHI_4.md5,8 ++1,HEVC_v1/RQT_G_HHI_4,RQT_G_HHI_4.bit,RQT_G_HHI_4.md5,8 ++1,HEVC_v1/SAO_A_MediaTek_4,SAO_A_MediaTek_4.bit,SAO_A_MediaTek_4.md5,8 ++1,HEVC_v1/SAO_B_MediaTek_5,SAO_B_MediaTek_5.bit,SAO_B_MediaTek_5.md5,8 ++1,HEVC_v1/SAO_C_Samsung_5,SAO_C_Samsung_5.bin,SAO_C_Samsung_5.md5,8 ++1,HEVC_v1/SAO_D_Samsung_5,SAO_D_Samsung_5.bin,SAO_D_Samsung_5.md5,8 ++1,HEVC_v1/SAO_E_Canon_4,SAO_E_Canon_4.bit,SAO_E_Canon_4.md5,8 ++1,HEVC_v1/SAO_F_Canon_3,SAO_F_Canon_3.bit,SAO_F_Canon_3.md5,8 ++1,HEVC_v1/SAO_G_Canon_3,SAO_G_Canon_3.bit,SAO_G_Canon_3.md5,8 ++1,HEVC_v1/SAO_H_Parabola_1,SAO_H_Parabola_1.bit,SAO_H_Parabola_1.md5,8 ++1,HEVC_v1/SAODBLK_A_MainConcept_4,SAODBLK_A_MainConcept_4.bin,SAODBLK_A_MainConcept_4_md5.txt,8 ++1,HEVC_v1/SAODBLK_B_MainConcept_4,SAODBLK_B_MainConcept_4.bin,SAODBLK_B_MainConcept_4_md5.txt,8 ++1,HEVC_v1/SDH_A_Orange_4,SDH_A_Orange_4.bit,SDH_A_Orange_4_yuv.md5,8 ++1,HEVC_v1/SLICES_A_Rovi_3,SLICES_A_Rovi_3.bin,SLICES_A_Rovi_3.md5,8 ++1,HEVC_v1/SLIST_A_Sony_5,SLIST_A_Sony_5.bin,SLIST_A_Sony_5_yuv.md5,8 ++1,HEVC_v1/SLIST_B_Sony_9,SLIST_B_Sony_9.bin,SLIST_B_Sony_9_yuv.md5,8 ++1,HEVC_v1/SLIST_C_Sony_4,SLIST_C_Sony_4.bin,SLIST_C_Sony_4_yuv.md5,8 ++1,HEVC_v1/SLIST_D_Sony_9,str.bin,SLIST_D_Sony_9_yuv.md5,8 ++1,HEVC_v1/SLPPLP_A_VIDYO_2,SLPPLP_A_VIDYO_2.bit,SLPPLP_A_VIDYO_2_yuv.md5,8 ++1,HEVC_v1/STRUCT_A_Samsung_7,STRUCT_A_Samsung_7.bin,STRUCT_A_Samsung_7.md5,8 ++1,HEVC_v1/STRUCT_B_Samsung_7,STRUCT_B_Samsung_7.bin,STRUCT_B_Samsung_7.md5,8 ++1,HEVC_v1/TILES_A_Cisco_2,TILES_A_Cisco_2.bin,TILES_A_Cisco_2_yuv.md5,8 ++1,HEVC_v1/TILES_B_Cisco_1,TILES_B_Cisco_1.bin,TILES_B_Cisco_1_yuv.md5,8 ++1,HEVC_v1/TMVP_A_MS_3,TMVP_A_MS_3.bit,TMVP_A_MS_3.yuv.md5,8 ++1,HEVC_v1/TSCL_A_VIDYO_5,TSCL_A_VIDYO_5.bit,TSCL_A_VIDYO_5_yuv.md5,8 ++1,HEVC_v1/TSCL_B_VIDYO_4,TSCL_B_VIDYO_4.bit,TSCL_B_VIDYO_4_yuv.md5,8 ++1,HEVC_v1/TSKIP_A_MS_3,TSKIP_A_MS_3.bit,TSKIP_A_MS_3.yuv.md5,8 ++3,HEVC_v1/TSUNEQBD_A_MAIN10_Technicolor_2,TSUNEQBD_A_MAIN10_Technicolor_2.bit,TSUNEQBD_A_MAIN10_Technicolor_2_yuv.md5, # unequal bit depth,10 ++1,HEVC_v1/TUSIZE_A_Samsung_1,TUSIZE_A_Samsung_1.bin,TUSIZE_A_Samsung_1.md5,8 ++1,HEVC_v1/VPSID_A_VIDYO_2,VPSID_A_VIDYO_2.bit,VPSID_A_VIDYO_2_yuv.md5,8 ++3,HEVC_v1/VPSSPSPPS_A_MainConcept_1,VPSSPSPPS_A_MainConcept_1.bin,VPSSPSPPS_A_MainConcept_1_md5.txt, # ???,8 ++1,HEVC_v1/WP_A_MAIN10_Toshiba_3,WP_A_MAIN10_Toshiba_3.bit,WP_A_MAIN10_Toshiba_3_yuv.md5,10 ++1,HEVC_v1/WP_A_Toshiba_3,WP_A_Toshiba_3.bit,WP_A_Toshiba_3_yuv.md5,8 ++1,HEVC_v1/WP_B_Toshiba_3,WP_B_Toshiba_3.bit,WP_B_Toshiba_3_yuv.md5,8 ++1,HEVC_v1/WP_MAIN10_B_Toshiba_3,WP_MAIN10_B_Toshiba_3.bit,WP_MAIN10_B_Toshiba_3_yuv.md5,10 ++1,HEVC_v1/WPP_A_ericsson_MAIN10_2,WPP_A_ericsson_MAIN10_2.bit,WPP_A_ericsson_MAIN10_yuv.md5,10 ++1,HEVC_v1/WPP_A_ericsson_MAIN_2,WPP_A_ericsson_MAIN_2.bit,WPP_A_ericsson_MAIN_2_yuv.md5,8 ++1,HEVC_v1/WPP_B_ericsson_MAIN10_2,WPP_B_ericsson_MAIN10_2.bit,WPP_B_ericsson_MAIN10_yuv.md5,10 ++1,HEVC_v1/WPP_B_ericsson_MAIN_2,WPP_B_ericsson_MAIN_2.bit,WPP_B_ericsson_MAIN_2_yuv.md5,8 ++1,HEVC_v1/WPP_C_ericsson_MAIN10_2,WPP_C_ericsson_MAIN10_2.bit,WPP_C_ericsson_MAIN10_yuv.md5,10 ++1,HEVC_v1/WPP_C_ericsson_MAIN_2,WPP_C_ericsson_MAIN_2.bit,WPP_C_ericsson_MAIN_2_yuv.md5,8 ++1,HEVC_v1/WPP_D_ericsson_MAIN10_2,WPP_D_ericsson_MAIN10_2.bit,WPP_D_ericsson_MAIN10_yuv.md5,10 ++1,HEVC_v1/WPP_D_ericsson_MAIN_2,WPP_D_ericsson_MAIN_2.bit,WPP_D_ericsson_MAIN_2_yuv.md5,8 ++1,HEVC_v1/WPP_E_ericsson_MAIN10_2,WPP_E_ericsson_MAIN10_2.bit,WPP_E_ericsson_MAIN10_yuv.md5,10 ++1,HEVC_v1/WPP_E_ericsson_MAIN_2,WPP_E_ericsson_MAIN_2.bit,WPP_E_ericsson_MAIN_2_yuv.md5,8 ++1,HEVC_v1/WPP_F_ericsson_MAIN10_2,WPP_F_ericsson_MAIN10_2.bit,WPP_F_ericsson_MAIN10_yuv.md5,10 ++1,HEVC_v1/WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5,8 ++1,RExt/ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_2,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_2.bit,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_yuv_2.md5,0 ++0,RExt/Bitdepth_A_RExt_Sony_1,Bitdepth_A_RExt_Sony_1.bin,md5sum.txt,8 ++0,RExt/Bitdepth_B_RExt_Sony_1,Bitdepth_B_RExt_Sony_1.bin,md5sum.txt,8 ++0,RExt/CCP_10bit_RExt_QCOM,CCP_10bit_RExt_QCOM.bin,CCP_10bit_RExt_QCOM_md5sum.txt,10 ++0,RExt/CCP_12bit_RExt_QCOM,CCP_12bit_RExt_QCOM.bin,CCP_12bit_RExt_QCOM_md5sum.txt,8 ++0,RExt/CCP_8bit_RExt_QCOM,CCP_8bit_RExt_QCOM.bin,CCP_8bit_RExt_QCOM_md5sum.txt,8 ++1,RExt/ExplicitRdpcm_A_BBC_1,ExplicitRdpcm_A_BBC_1.bit,md5sum.txt,0 ++0,RExt/ExplicitRdpcm_B_BBC_2,ExplicitRdpcm_B_BBC_1.bit,md5sum.txt,8 ++0,RExt/EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.bit,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_10BIT_RExt_Sony_1.md5,10 ++0,RExt/EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.bit,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_12BIT_RExt_Sony_1.md5,8 ++0,RExt/EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_16BIT_RExt_Sony_1,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_16BIT_RExt_Sony_1.bit,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_16BIT_RExt_Sony_1.md5,8 ++0,RExt/EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.bit,EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_8BIT_RExt_Sony_1.md5,8 ++0,RExt/EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1,EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.bit,EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1.md5,10 ++0,RExt/EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1,EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.bit,EXTPREC_MAIN_444_16_INTRA_12BIT_RExt_Sony_1.md5,8 ++0,RExt/EXTPREC_MAIN_444_16_INTRA_16BIT_RExt_Sony_1,EXTPREC_MAIN_444_16_INTRA_16BIT_RExt_Sony_1.bit,EXTPREC_MAIN_444_16_INTRA_16BIT_RExt_Sony_1.md5,8 ++0,RExt/EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1,EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.bit,EXTPREC_MAIN_444_16_INTRA_8BIT_RExt_Sony_1.md5,8 ++1,RExt/GENERAL_10b_420_RExt_Sony_1,GENERAL_10b_420_RExt_Sony_1.bit,GENERAL_10b_420_RExt_Sony_1.md5,10 ++1,RExt/GENERAL_10b_422_RExt_Sony_1,GENERAL_10b_422_RExt_Sony_1.bit,GENERAL_10b_422_RExt_Sony_1.md5,0 ++1,RExt/GENERAL_10b_444_RExt_Sony_2,GENERAL_10b_444_RExt_Sony_2.bit,GENERAL_10b_444_RExt_Sony_2.md5,0 ++1,RExt/GENERAL_12b_400_RExt_Sony_1,GENERAL_12b_400_RExt_Sony_1.bit,GENERAL_12b_400_RExt_Sony_1.md5,0 ++1,RExt/GENERAL_12b_420_RExt_Sony_1,GENERAL_12b_420_RExt_Sony_1.bit,GENERAL_12b_420_RExt_Sony_1.md5,0 ++1,RExt/GENERAL_12b_422_RExt_Sony_1,GENERAL_12b_422_RExt_Sony_1.bit,GENERAL_12b_422_RExt_Sony_1.md5,0 ++1,RExt/GENERAL_12b_444_RExt_Sony_2,GENERAL_12b_444_RExt_Sony_2.bit,GENERAL_12b_444_RExt_Sony_2.md5,0 ++0,RExt/GENERAL_16b_400_RExt_Sony_1,GENERAL_16b_400_RExt_Sony_1.bit,GENERAL_16b_400_RExt_Sony_1.md5,0 ++0,RExt/GENERAL_16b_444_highThroughput_RExt_Sony_2,GENERAL_16b_444_highThroughput_RExt_Sony_2.bit,GENERAL_16b_444_highThroughput_RExt_Sony_2.md5,8 ++0,RExt/GENERAL_16b_444_RExt_Sony_2,GENERAL_16b_444_RExt_Sony_2.bit,GENERAL_16b_444_RExt_Sony_2.md5,8 ++1,RExt/GENERAL_8b_400_RExt_Sony_1,GENERAL_8b_400_RExt_Sony_1.bit,GENERAL_8b_400_RExt_Sony_1.md5,0 ++1,RExt/GENERAL_8b_420_RExt_Sony_1,GENERAL_8b_420_RExt_Sony_1.bit,GENERAL_8b_420_RExt_Sony_1.md5,8 ++1,RExt/GENERAL_8b_444_RExt_Sony_2,GENERAL_8b_444_RExt_Sony_2.bit,GENERAL_8b_444_RExt_Sony_2.md5,0 ++1,RExt/IPCM_A_RExt_NEC_2,IPCM_A_RExt_NEC_2.bit,IPCM_A_RExt_NEC_2_yuv.md5,0 ++1,RExt/IPCM_B_RExt_NEC,IPCM_B_RExt_NEC.bit,IPCM_B_RExt_NEC_yuv.md5,0 ++1,RExt/Main_422_10_A_RExt_Sony_2,Main_422_10_A_RExt_Sony_2.bin,md5sum.txt,0 ++1,RExt/Main_422_10_B_RExt_Sony_2,Main_422_10_B_RExt_Sony_2.bin,md5sum.txt,0 ++1,RExt/PERSIST_RPARAM_A_RExt_Sony_3,PERSIST_RPARAM_A_RExt_Sony_3.bit,PERSIST_RPARAM_A_RExt_Sony_3.md5,0 ++1,RExt/QMATRIX_A_RExt_Sony_1,QMATRIX_A_RExt_Sony_1.bit,QMATRIX_A_RExt_Sony_1.md5,0 ++0,RExt/SAO_A_RExt_MediaTek_1,SAO_A_RExt_MediaTek_1.bit,SAO_A_RExt_MediaTek_1.md5, # Runs out of memory - could be fixed,8 ++0,RExt/TSCTX_10bit_I_RExt_SHARP_1,TSCTX_10bit_I_RExt_SHARP_1.bin,TSCTX_10bit_I_RExt_SHARP_1.md5,10 ++0,RExt/TSCTX_10bit_RExt_SHARP_1,TSCTX_10bit_RExt_SHARP_1.bin,TSCTX_10bit_RExt_SHARP_1.md5,10 ++0,RExt/TSCTX_12bit_I_RExt_SHARP_1,TSCTX_12bit_I_RExt_SHARP_1.bin,TSCTX_12bit_I_RExt_SHARP_1.md5,8 ++0,RExt/TSCTX_12bit_RExt_SHARP_1,TSCTX_12bit_RExt_SHARP_1.bin,TSCTX_12bit_RExt_SHARP_1.md5,8 ++0,RExt/TSCTX_8bit_I_RExt_SHARP_1,TSCTX_8bit_I_RExt_SHARP_1.bin,TSCTX_8bit_I_RExt_SHARP_1.md5,8 ++0,RExt/TSCTX_8bit_RExt_SHARP_1,TSCTX_8bit_RExt_SHARP_1.bin,TSCTX_8bit_RExt_SHARP_1.md5,8 ++0,RExt/WAVETILES_RExt_Sony_2,WAVETILES_RExt_Sony_2.bit,WAVETILES_RExt_Sony_2.md5,8 ++1,local/sao_cu16_mobile_344x280,sao_cu16_mobile_344x280.265,sao_cu16_mobile_344x280.md5,8 ++1,local/dblk_cu16_mobile_344x280,dblk_cu16_mobile_344x280.265,dblk_cu16_mobile_344x280.md5,8 ++1,local/dblksao_cu16_mobile_344x280,dblksao_cu16_mobile_344x280.265,dblksao_cu16_mobile_344x280.md5,8 ++1,local/dblk_pu32_horses_832x448,dblk_pu32_horses_832x448.265,dblk_pu32_horses_832x448.md5,8 ++1,local/intra_pred_21_laps,intra_pred_21_laps.265,intra_pred_21_laps.md5,8 +--- /dev/null ++++ b/pi-util/conf_h265.2016_HEVC_v1.csv +@@ -0,0 +1,147 @@ ++1,AMP_A_Samsung_7,AMP_A_Samsung_7.bin,AMP_A_Samsung_7.md5 ++1,AMP_B_Samsung_7,AMP_B_Samsung_7.bin,AMP_B_Samsung_7.md5 ++1,AMP_D_Hisilicon_3,AMP_D_Hisilicon.bit,AMP_D_Hisilicon_3.yuv.md5 ++1,AMP_E_Hisilicon_3,AMP_E_Hisilicon.bit,AMP_E_Hisilicon_3.yuv.md5 ++1,AMP_F_Hisilicon_3,AMP_F_Hisilicon_3.bit,AMP_F_Hisilicon_3.yuv.md5 ++1,AMVP_A_MTK_4,AMVP_A_MTK_4.bit,AMVP_A_MTK_4.md5 ++1,AMVP_B_MTK_4,AMVP_B_MTK_4.bit,AMVP_B_MTK_4.md5 ++1,AMVP_C_Samsung_7,AMVP_C_Samsung_7.bin,AMVP_C_Samsung_7.md5 ++1,BUMPING_A_ericsson_1,BUMPING_A_ericsson_1.bit,BUMPING_A_ericsson_1.md5 ++1,CAINIT_A_SHARP_4,CAINIT_A_SHARP_4.bit,CAINIT_A_SHARP_4.md5 ++1,CAINIT_B_SHARP_4,CAINIT_B_SHARP_4.bit,CAINIT_B_SHARP_4.md5 ++1,CAINIT_C_SHARP_3,CAINIT_C_SHARP_3.bit,CAINIT_C_SHARP_3.md5 ++1,CAINIT_D_SHARP_3,CAINIT_D_SHARP_3.bit,CAINIT_D_SHARP_3.md5 ++1,CAINIT_E_SHARP_3,CAINIT_E_SHARP_3.bit,CAINIT_E_SHARP_3.md5 ++1,CAINIT_F_SHARP_3,CAINIT_F_SHARP_3.bit,CAINIT_F_SHARP_3.md5 ++1,CAINIT_G_SHARP_3,CAINIT_G_SHARP_3.bit,CAINIT_G_SHARP_3.md5 ++1,CAINIT_H_SHARP_3,CAINIT_H_SHARP_3.bit,CAINIT_H_SHARP_3.md5 ++1,CIP_A_Panasonic_3,CIP_A_Panasonic_3.bit,CIP_A_Panasonic_3_yuv.md5 ++1,cip_B_NEC_3,cip_B_NEC_3.bit,cip_B_NEC_3.md5 ++1,CIP_C_Panasonic_2,CIP_C_Panasonic_2.bit,CIP_C_Panasonic_2_yuv.md5 ++1,CONFWIN_A_Sony_1,CONFWIN_A_Sony_1.bit,CONFWIN_A_Sony_1.md5 ++1,DBLK_A_MAIN10_VIXS_4,DBLK_A_MAIN10_VIXS_4.bit,DBLK_A_MAIN10_VIXS_4.md5 ++1,DBLK_A_SONY_3,DBLK_A_SONY_3.bit,DBLK_A_SONY_3.bit.yuv.md5 ++1,DBLK_B_SONY_3,DBLK_B_SONY_3.bit,DBLK_B_SONY_3.bit.yuv.md5 ++1,DBLK_C_SONY_3,DBLK_C_SONY_3.bit,DBLK_C_SONY_3.bit.yuv.md5 ++1,DBLK_D_VIXS_2,DBLK_D_VIXS_2.bit,DBLK_D_VIXS_2_yuv.md5 ++1,DBLK_E_VIXS_2,DBLK_E_VIXS_2.bit,DBLK_E_VIXS_2_yuv.md5 ++1,DBLK_F_VIXS_2,DBLK_F_VIXS_2.bit,DBLK_F_VIXS_2_yuv.md5 ++1,DBLK_G_VIXS_2,DBLK_G_VIXS_2.bit,DBLK_G_VIXS_2_yuv.md5 ++1,DELTAQP_A_BRCM_4,DELTAQP_A_BRCM_4.bit,DELTAQP_A_BRCM_4_yuv.md5 ++1,DELTAQP_B_SONY_3,DELTAQP_B_SONY_3.bit,DELTAQP_B_SONY_3.bit.yuv.md5 ++1,DELTAQP_C_SONY_3,DELTAQP_C_SONY_3.bit,DELTAQP_C_SONY_3.bit.yuv.md5 ++1,DSLICE_A_HHI_5,DSLICE_A_HHI_5.bin,DSLICE_A_HHI_5.md5 ++1,DSLICE_B_HHI_5,DSLICE_B_HHI_5.bin,DSLICE_B_HHI_5.md5 ++1,DSLICE_C_HHI_5,DSLICE_C_HHI_5.bin,DSLICE_C_HHI_5.md5 ++1,ENTP_A_QUALCOMM_1,ENTP_A_Qualcomm_1.bit,ENTP_A_Qualcomm_1.md5 ++1,ENTP_B_Qualcomm_1,ENTP_B_Qualcomm_1.bit,ENTP_B_Qualcomm_1.md5 ++1,ENTP_C_Qualcomm_1,ENTP_C_Qualcomm_1.bit,ENTP_C_Qualcomm_1.md5 ++1,EXT_A_ericsson_4,EXT_A_ericsson_4.bit,EXT_A_ericsson_4.md5 ++1,FILLER_A_Sony_1,FILLER_A_Sony_1.bit,FILLER_A_Sony_1.md5 ++1,HRD_A_Fujitsu_3,HRD_A_Fujitsu_3.bin,HRD_A_Fujitsu_3.md5 ++1,INITQP_A_Sony_1,INITQP_A_Sony_1.bit,INITQP_A_Sony_1.md5 ++1,INITQP_B_Main10_Sony_1,INITQP_B_Main10_Sony_1.bit,INITQP_B_Main10_Sony_1.md5 ++1,ipcm_A_NEC_3,ipcm_A_NEC_3.bit,ipcm_A_NEC_3.md5 ++1,ipcm_B_NEC_3,ipcm_B_NEC_3.bit,ipcm_B_NEC_3.md5 ++1,ipcm_C_NEC_3,ipcm_C_NEC_3.bit,ipcm_C_NEC_3.md5 ++1,ipcm_D_NEC_3,ipcm_D_NEC_3.bit,ipcm_D_NEC_3.md5 ++1,ipcm_E_NEC_2,ipcm_E_NEC_2.bit,ipcm_E_NEC_2.md5 ++1,IPRED_A_docomo_2,IPRED_A_docomo_2.bit,IPRED_A_docomo_2.md5 ++1,IPRED_B_Nokia_3,IPRED_B_Nokia_3.bit,IPRED_B_Nokia_3_yuv.md5 ++1,IPRED_C_Mitsubishi_3,IPRED_C_Mitsubishi_3.bit,IPRED_C_Mitsubishi_3_yuv.md5 ++1,LS_A_Orange_2,LS_A_Orange_2.bit,LS_A_Orange_2_yuv.md5 ++1,LS_B_Orange_4,LS_B_Orange_4.bit,LS_B_Orange_4_yuv.md5 ++1,LTRPSPS_A_Qualcomm_1,LTRPSPS_A_Qualcomm_1.bit,LTRPSPS_A_Qualcomm_1.md5 ++1,MAXBINS_A_TI_5,MAXBINS_A_TI_5.bit,MAXBINS_A_TI_5_yuv.md5 ++1,MAXBINS_B_TI_5,MAXBINS_B_TI_5.bit,MAXBINS_B_TI_5_yuv.md5 ++1,MAXBINS_C_TI_5,MAXBINS_C_TI_5.bit,MAXBINS_C_TI_5_yuv.md5 ++1,MERGE_A_TI_3,MERGE_A_TI_3.bit,MERGE_A_TI_3.md5 ++1,MERGE_B_TI_3,MERGE_B_TI_3.bit,MERGE_B_TI_3.md5 ++1,MERGE_C_TI_3,MERGE_C_TI_3.bit,MERGE_C_TI_3.md5 ++1,MERGE_D_TI_3,MERGE_D_TI_3.bit,MERGE_D_TI_3.md5 ++1,MERGE_E_TI_3,MERGE_E_TI_3.bit,MERGE_E_TI_3.md5 ++1,MERGE_F_MTK_4,MERGE_F_MTK_4.bit,MERGE_F_MTK_4.md5 ++1,MERGE_G_HHI_4,MERGE_G_HHI_4.bit,MERGE_G_HHI_4.md5 ++1,MVCLIP_A_qualcomm_3,MVCLIP_A_qualcomm_3.bit,MVCLIP_A_qualcomm_3.yuv.md5 ++1,MVDL1ZERO_A_docomo_4,MVDL1ZERO_A_docomo_4.bit,MVDL1ZERO_A_docomo_4.md5 ++1,MVEDGE_A_qualcomm_3,MVEDGE_A_qualcomm_3.bit,MVEDGE_A_qualcomm_3.yuv.md5 ++1,NoOutPrior_A_Qualcomm_1,NoOutPrior_A_Qualcomm_1.bit,NoOutPrior_A_Qualcomm_1.md5 ++1,NoOutPrior_B_Qualcomm_1,NoOutPrior_B_Qualcomm_1.bit,NoOutPrior_B_Qualcomm_1.md5 ++1,NUT_A_ericsson_5,NUT_A_ericsson_5.bit,NUT_A_ericsson_5.md5 ++1,OPFLAG_A_Qualcomm_1,OPFLAG_A_Qualcomm_1.bit,OPFLAG_A_Qualcomm_1.md5 ++1,OPFLAG_B_Qualcomm_1,OPFLAG_B_Qualcomm_1.bit,OPFLAG_B_Qualcomm_1.md5 ++1,OPFLAG_C_Qualcomm_1,OPFLAG_C_Qualcomm_1.bit,OPFLAG_C_Qualcomm_1.md5 ++1,PICSIZE_A_Bossen_1,PICSIZE_A_Bossen_1.bin,PICSIZE_A_Bossen_1.md5 ++1,PICSIZE_B_Bossen_1,PICSIZE_B_Bossen_1.bin,PICSIZE_B_Bossen_1.md5 ++1,PICSIZE_C_Bossen_1,PICSIZE_C_Bossen_1.bin,PICSIZE_C_Bossen_1.md5 ++1,PICSIZE_D_Bossen_1,PICSIZE_D_Bossen_1.bin,PICSIZE_D_Bossen_1.md5 ++1,PMERGE_A_TI_3,PMERGE_A_TI_3.bit,PMERGE_A_TI_3.md5 ++1,PMERGE_B_TI_3,PMERGE_B_TI_3.bit,PMERGE_B_TI_3.md5 ++1,PMERGE_C_TI_3,PMERGE_C_TI_3.bit,PMERGE_C_TI_3.md5 ++1,PMERGE_D_TI_3,PMERGE_D_TI_3.bit,PMERGE_D_TI_3.md5 ++1,PMERGE_E_TI_3,PMERGE_E_TI_3.bit,PMERGE_E_TI_3.md5 ++1,POC_A_Bossen_3,POC_A_Bossen_3.bin,POC_A_Bossen_3.md5 ++1,PPS_A_qualcomm_7,PPS_A_qualcomm_7.bit,PPS_A_qualcomm_7.yuv.md5 ++1,PS_B_VIDYO_3,PS_B_VIDYO_3.bit,PS_B_VIDYO_3_yuv.md5 ++1,RAP_A_docomo_6,RAP_A_docomo_6.bit,RAP_A_docomo_6.md5 ++1,RAP_B_Bossen_2,RAP_B_Bossen_2.bit,RAP_B_Bossen_2.md5 ++1,RPLM_A_qualcomm_4,RPLM_A_qualcomm_4.bit,RPLM_A_qualcomm_4.yuv.md5 ++1,RPLM_B_qualcomm_4,RPLM_B_qualcomm_4.bit,RPLM_B_qualcomm_4.yuv.md5 ++1,RPS_A_docomo_5,RPS_A_docomo_5.bit,RPS_A_docomo_5.md5 ++1,RPS_B_qualcomm_5,RPS_B_qualcomm_5.bit,RPS_B_qualcomm_5.yuv.md5 ++1,RPS_C_ericsson_5,RPS_C_ericsson_5.bit,RPS_C_ericsson_5.md5 ++1,RPS_D_ericsson_6,RPS_D_ericsson_6.bit,RPS_D_ericsson_6.md5 ++1,RPS_E_qualcomm_5,RPS_E_qualcomm_5.bit,RPS_E_qualcomm_5.yuv.md5 ++1,RPS_F_docomo_2,RPS_F_docomo_2.bit,RPS_F_docomo_2.md5 ++1,RQT_A_HHI_4,RQT_A_HHI_4.bit,RQT_A_HHI_4.md5 ++1,RQT_B_HHI_4,RQT_B_HHI_4.bit,RQT_B_HHI_4.md5 ++1,RQT_C_HHI_4,RQT_C_HHI_4.bit,RQT_C_HHI_4.md5 ++1,RQT_D_HHI_4,RQT_D_HHI_4.bit,RQT_D_HHI_4.md5 ++1,RQT_E_HHI_4,RQT_E_HHI_4.bit,RQT_E_HHI_4.md5 ++1,RQT_F_HHI_4,RQT_F_HHI_4.bit,RQT_F_HHI_4.md5 ++1,RQT_G_HHI_4,RQT_G_HHI_4.bit,RQT_G_HHI_4.md5 ++1,SAO_A_MediaTek_4,SAO_A_MediaTek_4.bit,SAO_A_MediaTek_4.md5 ++1,SAO_B_MediaTek_5,SAO_B_MediaTek_5.bit,SAO_B_MediaTek_5.md5 ++1,SAO_C_Samsung_5,SAO_C_Samsung_5.bin,SAO_C_Samsung_5.md5 ++1,SAO_D_Samsung_5,SAO_D_Samsung_5.bin,SAO_D_Samsung_5.md5 ++1,SAO_E_Canon_4,SAO_E_Canon_4.bit,SAO_E_Canon_4.md5 ++1,SAO_F_Canon_3,SAO_F_Canon_3.bit,SAO_F_Canon_3.md5 ++1,SAO_G_Canon_3,SAO_G_Canon_3.bit,SAO_G_Canon_3.md5 ++1,SAO_H_Parabola_1,SAO_H_Parabola_1.bit,SAO_H_Parabola_1.md5 ++2,SAODBLK_A_MainConcept_4,SAODBLK_A_MainConcept_4.bin,SAODBLK_A_MainConcept_4_md5.txt ++2,SAODBLK_B_MainConcept_4,SAODBLK_B_MainConcept_4.bin,SAODBLK_B_MainConcept_4_md5.txt ++1,SDH_A_Orange_4,SDH_A_Orange_4.bit,SDH_A_Orange_4_yuv.md5 ++1,SLICES_A_Rovi_3,SLICES_A_Rovi_3.bin,SLICES_A_Rovi_3.md5 ++1,SLIST_A_Sony_5,SLIST_A_Sony_5.bin,SLIST_A_Sony_5_yuv.md5 ++1,SLIST_B_Sony_9,SLIST_B_Sony_9.bin,SLIST_B_Sony_9_yuv.md5 ++1,SLIST_C_Sony_4,SLIST_C_Sony_4.bin,SLIST_C_Sony_4_yuv.md5 ++1,SLIST_D_Sony_9,str.bin,SLIST_D_Sony_9_yuv.md5 ++1,SLPPLP_A_VIDYO_2,SLPPLP_A_VIDYO_2.bit,SLPPLP_A_VIDYO_2_yuv.md5 ++1,STRUCT_A_Samsung_7,STRUCT_A_Samsung_7.bin,STRUCT_A_Samsung_7.md5 ++1,STRUCT_B_Samsung_7,STRUCT_B_Samsung_7.bin,STRUCT_B_Samsung_7.md5 ++1,TILES_A_Cisco_2,TILES_A_Cisco_2.bin,TILES_A_Cisco_2_yuv.md5 ++1,TILES_B_Cisco_1,TILES_B_Cisco_1.bin,TILES_B_Cisco_1_yuv.md5 ++1,TMVP_A_MS_3,TMVP_A_MS_3.bit,TMVP_A_MS_3.yuv.md5 ++1,TSCL_A_VIDYO_5,TSCL_A_VIDYO_5.bit,TSCL_A_VIDYO_5_yuv.md5 ++1,TSCL_B_VIDYO_4,TSCL_B_VIDYO_4.bit,TSCL_B_VIDYO_4_yuv.md5 ++1,TSKIP_A_MS_3,TSKIP_A_MS_3.bit,TSKIP_A_MS_3.yuv.md5 ++3,TSUNEQBD_A_MAIN10_Technicolor_2,TSUNEQBD_A_MAIN10_Technicolor_2.bit,TSUNEQBD_A_MAIN10_Technicolor_2_yuv.md5, # unequal bit depth ++1,TUSIZE_A_Samsung_1,TUSIZE_A_Samsung_1.bin,TUSIZE_A_Samsung_1.md5 ++1,VPSID_A_VIDYO_2,VPSID_A_VIDYO_2.bit,VPSID_A_VIDYO_2_yuv.md5 ++3,VPSSPSPPS_A_MainConcept_1,VPSSPSPPS_A_MainConcept_1.bin,VPSSPSPPS_A_MainConcept_1_md5.txt, # ??? ++1,WP_A_MAIN10_Toshiba_3,WP_A_MAIN10_Toshiba_3.bit,WP_A_MAIN10_Toshiba_3_yuv.md5 ++1,WP_A_Toshiba_3,WP_A_Toshiba_3.bit,WP_A_Toshiba_3_yuv.md5 ++1,WP_B_Toshiba_3,WP_B_Toshiba_3.bit,WP_B_Toshiba_3_yuv.md5 ++1,WP_MAIN10_B_Toshiba_3,WP_MAIN10_B_Toshiba_3.bit,WP_MAIN10_B_Toshiba_3_yuv.md5 ++1,WPP_A_ericsson_MAIN10_2,WPP_A_ericsson_MAIN10_2.bit,WPP_A_ericsson_MAIN10_yuv.md5 ++1,WPP_A_ericsson_MAIN_2,WPP_A_ericsson_MAIN_2.bit,WPP_A_ericsson_MAIN_2_yuv.md5 ++1,WPP_B_ericsson_MAIN10_2,WPP_B_ericsson_MAIN10_2.bit,WPP_B_ericsson_MAIN10_yuv.md5 ++1,WPP_B_ericsson_MAIN_2,WPP_B_ericsson_MAIN_2.bit,WPP_B_ericsson_MAIN_2_yuv.md5 ++1,WPP_C_ericsson_MAIN10_2,WPP_C_ericsson_MAIN10_2.bit,WPP_C_ericsson_MAIN10_yuv.md5 ++1,WPP_C_ericsson_MAIN_2,WPP_C_ericsson_MAIN_2.bit,WPP_C_ericsson_MAIN_2_yuv.md5 ++1,WPP_D_ericsson_MAIN10_2,WPP_D_ericsson_MAIN10_2.bit,WPP_D_ericsson_MAIN10_yuv.md5 ++1,WPP_D_ericsson_MAIN_2,WPP_D_ericsson_MAIN_2.bit,WPP_D_ericsson_MAIN_2_yuv.md5 ++1,WPP_E_ericsson_MAIN10_2,WPP_E_ericsson_MAIN10_2.bit,WPP_E_ericsson_MAIN10_yuv.md5 ++1,WPP_E_ericsson_MAIN_2,WPP_E_ericsson_MAIN_2.bit,WPP_E_ericsson_MAIN_2_yuv.md5 ++1,WPP_F_ericsson_MAIN10_2,WPP_F_ericsson_MAIN10_2.bit,WPP_F_ericsson_MAIN10_yuv.md5 ++1,WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5 +--- /dev/null ++++ b/pi-util/conf_h265.csv +@@ -0,0 +1,144 @@ ++1,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_1,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_1.bit,ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_1.md5 ++1,AMP_A_Samsung_6,AMP_A_Samsung_6.bin,AMP_A_Samsung_6.md5 ++1,AMP_B_Samsung_6,AMP_B_Samsung_6.bin,AMP_B_Samsung_6.md5 ++1,AMP_D_Hisilicon_3,AMP_D_Hisilicon.bit,AMP_D_Hisilicon_3.yuv.md5 ++1,AMP_E_Hisilicon_3,AMP_E_Hisilicon.bit,AMP_E_Hisilicon_3.yuv.md5 ++1,AMP_F_Hisilicon_3,AMP_F_Hisilicon_3.bit,AMP_F_Hisilicon_3.yuv.md5 ++1,AMVP_A_MTK_4,AMVP_A_MTK_4.bit,AMVP_A_MTK_4.md5 ++1,AMVP_B_MTK_4,AMVP_B_MTK_4.bit,AMVP_B_MTK_4.md5 ++1,AMVP_C_Samsung_6,AMVP_C_Samsung_6.bin,AMVP_C_Samsung_6.md5 ++1,BUMPING_A_ericsson_1,BUMPING_A_ericsson_1.bit,BUMPING_A_ericsson_1.md5 ++1,CAINIT_A_SHARP_4,CAINIT_A_SHARP_4.bit,CAINIT_A_SHARP_4.md5 ++1,CAINIT_B_SHARP_4,CAINIT_B_SHARP_4.bit,CAINIT_B_SHARP_4.md5 ++1,CAINIT_C_SHARP_3,CAINIT_C_SHARP_3.bit,CAINIT_C_SHARP_3.md5 ++1,CAINIT_D_SHARP_3,CAINIT_D_SHARP_3.bit,CAINIT_D_SHARP_3.md5 ++1,CAINIT_E_SHARP_3,CAINIT_E_SHARP_3.bit,CAINIT_E_SHARP_3.md5 ++1,CAINIT_F_SHARP_3,CAINIT_F_SHARP_3.bit,CAINIT_F_SHARP_3.md5 ++1,CAINIT_G_SHARP_3,CAINIT_G_SHARP_3.bit,CAINIT_G_SHARP_3.md5 ++1,CAINIT_H_SHARP_3,CAINIT_H_SHARP_3.bit,CAINIT_H_SHARP_3.md5 ++1,CIP_A_Panasonic_3,CIP_A_Panasonic_3.bit,CIP_A_Panasonic_3_yuv.md5 ++1,cip_B_NEC_3,cip_B_NEC_3.bit,cip_B_NEC_3.md5 ++1,CIP_C_Panasonic_2,CIP_C_Panasonic_2.bit,CIP_C_Panasonic_2_yuv.md5 ++1,CONFWIN_A_Sony_1,CONFWIN_A_Sony_1.bit,CONFWIN_A_Sony_1.md5 ++1,DBLK_A_MAIN10_VIXS_3,DBLK_A_MAIN10_VIXS_3.bit,DBLK_A_MAIN10_VIXS_3.md5 ++1,DBLK_A_SONY_3,DBLK_A_SONY_3.bit,DBLK_A_SONY_3.bit.yuv.md5 ++1,DBLK_B_SONY_3,DBLK_B_SONY_3.bit,DBLK_B_SONY_3.bit.yuv.md5 ++1,DBLK_C_SONY_3,DBLK_C_SONY_3.bit,DBLK_C_SONY_3.bit.yuv.md5 ++1,DBLK_D_VIXS_2,DBLK_D_VIXS_2.bit,DBLK_D_VIXS_2_yuv.md5 ++1,DBLK_E_VIXS_2,DBLK_E_VIXS_2.bit,DBLK_E_VIXS_2_yuv.md5 ++1,DBLK_F_VIXS_2,DBLK_F_VIXS_2.bit,DBLK_F_VIXS_2_yuv.md5 ++1,DBLK_G_VIXS_2,DBLK_G_VIXS_2.bit,DBLK_G_VIXS_2_yuv.md5 ++1,DELTAQP_A_BRCM_4,DELTAQP_A_BRCM_4.bit,DELTAQP_A_BRCM_4_yuv.md5 ++1,DELTAQP_B_SONY_3,DELTAQP_B_SONY_3.bit,DELTAQP_B_SONY_3.bit.yuv.md5 ++1,DELTAQP_C_SONY_3,DELTAQP_C_SONY_3.bit,DELTAQP_C_SONY_3.bit.yuv.md5 ++1,DSLICE_A_HHI_5,DSLICE_A_HHI_5.bin,DSLICE_A_HHI_5.md5 ++1,DSLICE_B_HHI_5,DSLICE_B_HHI_5.bin,DSLICE_B_HHI_5.md5 ++1,DSLICE_C_HHI_5,DSLICE_C_HHI_5.bin,DSLICE_C_HHI_5.md5 ++1,ENTP_A_QUALCOMM_1,ENTP_A_Qualcomm_1.bit,ENTP_A_Qualcomm_1.md5 ++1,ENTP_B_Qualcomm_1,ENTP_B_Qualcomm_1.bit,ENTP_B_Qualcomm_1.md5 ++1,ENTP_C_Qualcomm_1,ENTP_C_Qualcomm_1.bit,ENTP_C_Qualcomm_1.md5 ++1,EXT_A_ericsson_4,EXT_A_ericsson_4.bit,EXT_A_ericsson_4.md5 ++1,FILLER_A_Sony_1,FILLER_A_Sony_1.bit,FILLER_A_Sony_1.md5 ++1,HRD_A_Fujitsu_3,HRD_A_Fujitsu_3.bin,HRD_A_Fujitsu_3.md5 ++1,INITQP_A_Sony_1,INITQP_A_Sony_1.bit,INITQP_A_Sony_1.md5 ++1,INITQP_B_Main10_Sony_1,INITQP_B_Main10_Sony_1.bit,INITQP_B_Main10_Sony_1.md5 ++1,ipcm_A_NEC_3,ipcm_A_NEC_3.bit,ipcm_A_NEC_3.md5 ++1,ipcm_B_NEC_3,ipcm_B_NEC_3.bit,ipcm_B_NEC_3.md5 ++1,ipcm_C_NEC_3,ipcm_C_NEC_3.bit,ipcm_C_NEC_3.md5 ++1,ipcm_D_NEC_3,ipcm_D_NEC_3.bit,ipcm_D_NEC_3.md5 ++1,ipcm_E_NEC_2,ipcm_E_NEC_2.bit,ipcm_E_NEC_2.md5 ++1,IPRED_A_docomo_2,IPRED_A_docomo_2.bit,IPRED_A_docomo_2.md5 ++1,IPRED_B_Nokia_3,IPRED_B_Nokia_3.bit,IPRED_B_Nokia_3_yuv.md5 ++1,IPRED_C_Mitsubishi_3,IPRED_C_Mitsubishi_3.bit,IPRED_C_Mitsubishi_3_yuv.md5 ++1,LS_A_Orange_2,LS_A_Orange_2.bit,LS_A_Orange_2_yuv.md5 ++1,LS_B_Orange_4,LS_B_Orange_4.bit,LS_B_Orange_4_yuv.md5 ++1,LTRPSPS_A_Qualcomm_1,LTRPSPS_A_Qualcomm_1.bit,LTRPSPS_A_Qualcomm_1.md5 ++1,MAXBINS_A_TI_4,MAXBINS_A_TI_4.bit,MAXBINS_A_TI_4.md5 ++1,MAXBINS_B_TI_4,MAXBINS_B_TI_4.bit,MAXBINS_B_TI_4.md5 ++1,MAXBINS_C_TI_4,MAXBINS_C_TI_4.bit,MAXBINS_C_TI_4.md5 ++1,MERGE_A_TI_3,MERGE_A_TI_3.bit,MERGE_A_TI_3.md5 ++1,MERGE_B_TI_3,MERGE_B_TI_3.bit,MERGE_B_TI_3.md5 ++1,MERGE_C_TI_3,MERGE_C_TI_3.bit,MERGE_C_TI_3.md5 ++1,MERGE_D_TI_3,MERGE_D_TI_3.bit,MERGE_D_TI_3.md5 ++1,MERGE_E_TI_3,MERGE_E_TI_3.bit,MERGE_E_TI_3.md5 ++1,MERGE_F_MTK_4,MERGE_F_MTK_4.bit,MERGE_F_MTK_4.md5 ++1,MERGE_G_HHI_4,MERGE_G_HHI_4.bit,MERGE_G_HHI_4.md5 ++1,MVCLIP_A_qualcomm_3,MVCLIP_A_qualcomm_3.bit,MVCLIP_A_qualcomm_3.yuv.md5 ++1,MVDL1ZERO_A_docomo_4,MVDL1ZERO_A_docomo_4.bit,MVDL1ZERO_A_docomo_4.md5 ++1,MVEDGE_A_qualcomm_3,MVEDGE_A_qualcomm_3.bit,MVEDGE_A_qualcomm_3.yuv.md5 ++1,NoOutPrior_A_Qualcomm_1,NoOutPrior_A_Qualcomm_1.bit,NoOutPrior_A_Qualcomm_1.md5 ++1,NoOutPrior_B_Qualcomm_1,NoOutPrior_B_Qualcomm_1.bit,NoOutPrior_B_Qualcomm_1.md5 ++1,NUT_A_ericsson_5,NUT_A_ericsson_5.bit,NUT_A_ericsson_5.md5 ++1,OPFLAG_A_Qualcomm_1,OPFLAG_A_Qualcomm_1.bit,OPFLAG_A_Qualcomm_1.md5 ++1,OPFLAG_B_Qualcomm_1,OPFLAG_B_Qualcomm_1.bit,OPFLAG_B_Qualcomm_1.md5 ++1,OPFLAG_C_Qualcomm_1,OPFLAG_C_Qualcomm_1.bit,OPFLAG_C_Qualcomm_1.md5 ++1,PICSIZE_A_Bossen_1,PICSIZE_A_Bossen_1.bin,PICSIZE_A_Bossen_1.md5 ++1,PICSIZE_B_Bossen_1,PICSIZE_B_Bossen_1.bin,PICSIZE_B_Bossen_1.md5 ++1,PICSIZE_C_Bossen_1,PICSIZE_C_Bossen_1.bin,PICSIZE_C_Bossen_1.md5 ++1,PICSIZE_D_Bossen_1,PICSIZE_D_Bossen_1.bin,PICSIZE_D_Bossen_1.md5 ++1,PMERGE_A_TI_3,PMERGE_A_TI_3.bit,PMERGE_A_TI_3.md5 ++1,PMERGE_B_TI_3,PMERGE_B_TI_3.bit,PMERGE_B_TI_3.md5 ++1,PMERGE_C_TI_3,PMERGE_C_TI_3.bit,PMERGE_C_TI_3.md5 ++1,PMERGE_D_TI_3,PMERGE_D_TI_3.bit,PMERGE_D_TI_3.md5 ++1,PMERGE_E_TI_3,PMERGE_E_TI_3.bit,PMERGE_E_TI_3.md5 ++1,POC_A_Bossen_3,POC_A_Bossen_3.bin,POC_A_Bossen_3.md5 ++1,PPS_A_qualcomm_7,PPS_A_qualcomm_7.bit,PPS_A_qualcomm_7.yuv.md5 ++1,PS_B_VIDYO_3,PS_B_VIDYO_3.bit,PS_B_VIDYO_3_yuv.md5 ++1,RAP_A_docomo_6,RAP_A_docomo_6.bit,RAP_A_docomo_6.md5 ++1,RAP_B_Bossen_2,RAP_B_Bossen_2.bit,RAP_B_Bossen_2.md5 ++1,RPLM_A_qualcomm_4,RPLM_A_qualcomm_4.bit,RPLM_A_qualcomm_4.yuv.md5 ++1,RPLM_B_qualcomm_4,RPLM_B_qualcomm_4.bit,RPLM_B_qualcomm_4.yuv.md5 ++1,RPS_A_docomo_5,RPS_A_docomo_5.bit,RPS_A_docomo_5.md5 ++1,RPS_B_qualcomm_5,RPS_B_qualcomm_5.bit,RPS_B_qualcomm_5.yuv.md5 ++1,RPS_C_ericsson_5,RPS_C_ericsson_5.bit,RPS_C_ericsson_5.md5 ++1,RPS_D_ericsson_6,RPS_D_ericsson_6.bit,RPS_D_ericsson_6.md5 ++1,RPS_E_qualcomm_5,RPS_E_qualcomm_5.bit,RPS_E_qualcomm_5.yuv.md5 ++1,RPS_F_docomo_2,RPS_F_docomo_2.bit,RPS_F_docomo_2.md5 ++1,RQT_A_HHI_4,RQT_A_HHI_4.bit,RQT_A_HHI_4.md5 ++1,RQT_B_HHI_4,RQT_B_HHI_4.bit,RQT_B_HHI_4.md5 ++1,RQT_C_HHI_4,RQT_C_HHI_4.bit,RQT_C_HHI_4.md5 ++1,RQT_D_HHI_4,RQT_D_HHI_4.bit,RQT_D_HHI_4.md5 ++1,RQT_E_HHI_4,RQT_E_HHI_4.bit,RQT_E_HHI_4.md5 ++1,RQT_F_HHI_4,RQT_F_HHI_4.bit,RQT_F_HHI_4.md5 ++1,RQT_G_HHI_4,RQT_G_HHI_4.bit,RQT_G_HHI_4.md5 ++1,SAO_A_MediaTek_4,SAO_A_MediaTek_4.bit,SAO_A_MediaTek_4.md5 ++1,SAO_B_MediaTek_5,SAO_B_MediaTek_5.bit,SAO_B_MediaTek_5.md5 ++1,SAO_C_Samsung_5,SAO_C_Samsung_5.bin,SAO_C_Samsung_5.md5 ++1,SAO_D_Samsung_5,SAO_D_Samsung_5.bin,SAO_D_Samsung_5.md5 ++1,SAO_E_Canon_4,SAO_E_Canon_4.bit,SAO_E_Canon_4.md5 ++1,SAO_F_Canon_3,SAO_F_Canon_3.bit,SAO_F_Canon_3.md5 ++1,SAO_G_Canon_3,SAO_G_Canon_3.bit,SAO_G_Canon_3.md5 ++1,SDH_A_Orange_4,SDH_A_Orange_4.bit,SDH_A_Orange_4_yuv.md5 ++1,SLICES_A_Rovi_3,SLICES_A_Rovi_3.bin,SLICES_A_Rovi_3.md5 ++1,SLIST_A_Sony_4,str.bin,SLIST_A_Sony_4_yuv.md5 ++1,SLIST_B_Sony_8,str.bin,SLIST_B_Sony_8_yuv.md5 ++1,SLIST_C_Sony_3,str.bin,SLIST_C_Sony_3_yuv.md5 ++1,SLIST_D_Sony_9,str.bin,SLIST_D_Sony_9_yuv.md5 ++1,SLPPLP_A_VIDYO_2,SLPPLP_A_VIDYO_2.bit,SLPPLP_A_VIDYO_2_yuv.md5 ++1,STRUCT_A_Samsung_6,STRUCT_A_Samsung_6.bin,STRUCT_A_Samsung_6.md5 ++1,STRUCT_B_Samsung_6,STRUCT_B_Samsung_6.bin,STRUCT_B_Samsung_6.md5 ++1,TILES_A_Cisco_2,TILES_A_Cisco_2.bin,TILES_A_Cisco_2_yuv.md5 ++1,TILES_B_Cisco_1,TILES_B_Cisco_1.bin,TILES_B_Cisco_1_yuv.md5 ++1,TMVP_A_MS_3,TMVP_A_MS_3.bit,TMVP_A_MS_3.yuv.md5 ++1,TSCL_A_VIDYO_5,TSCL_A_VIDYO_5.bit,TSCL_A_VIDYO_5_yuv.md5 ++1,TSCL_B_VIDYO_4,TSCL_B_VIDYO_4.bit,TSCL_B_VIDYO_4_yuv.md5 ++1,TSKIP_A_MS_3,TSKIP_A_MS_3.bit,TSKIP_A_MS_3.yuv.md5 ++0,TSUNEQBD_A_MAIN10_Technicolor_2,TSUNEQBD_A_MAIN10_Technicolor_2.bit,TSUNEQBD_A_MAIN10_Technicolor_2_yuv.md5, # Y/C bit depth unmatched ++1,TUSIZE_A_Samsung_1,TUSIZE_A_Samsung_1.bin,TUSIZE_A_Samsung_1.md5 ++1,VPSID_A_VIDYO_2,VPSID_A_VIDYO_2.bit,VPSID_A_VIDYO_2_yuv.md5 ++1,WP_A_MAIN10_Toshiba_3,WP_A_MAIN10_Toshiba_3.bit,WP_A_MAIN10_Toshiba_3_yuv.md5 ++1,WP_A_Toshiba_3,WP_A_Toshiba_3.bit,WP_A_Toshiba_3_yuv.md5 ++1,WP_B_Toshiba_3,WP_B_Toshiba_3.bit,WP_B_Toshiba_3_yuv.md5 ++1,WP_MAIN10_B_Toshiba_3,WP_MAIN10_B_Toshiba_3.bit,WP_MAIN10_B_Toshiba_3_yuv.md5 ++1,WPP_A_ericsson_MAIN10_2,WPP_A_ericsson_MAIN10_2.bit,WPP_A_ericsson_MAIN10_yuv.md5 ++1,WPP_A_ericsson_MAIN_2,WPP_A_ericsson_MAIN_2.bit,WPP_A_ericsson_MAIN_2_yuv.md5 ++1,WPP_B_ericsson_MAIN10_2,WPP_B_ericsson_MAIN10_2.bit,WPP_B_ericsson_MAIN10_yuv.md5 ++1,WPP_B_ericsson_MAIN_2,WPP_B_ericsson_MAIN_2.bit,WPP_B_ericsson_MAIN_2_yuv.md5 ++1,WPP_C_ericsson_MAIN10_2,WPP_C_ericsson_MAIN10_2.bit,WPP_C_ericsson_MAIN10_yuv.md5 ++1,WPP_C_ericsson_MAIN_2,WPP_C_ericsson_MAIN_2.bit,WPP_C_ericsson_MAIN_2_yuv.md5 ++1,WPP_D_ericsson_MAIN10_2,WPP_D_ericsson_MAIN10_2.bit,WPP_D_ericsson_MAIN10_yuv.md5 ++1,WPP_D_ericsson_MAIN_2,WPP_D_ericsson_MAIN_2.bit,WPP_D_ericsson_MAIN_2_yuv.md5 ++1,WPP_E_ericsson_MAIN10_2,WPP_E_ericsson_MAIN10_2.bit,WPP_E_ericsson_MAIN10_yuv.md5 ++1,WPP_E_ericsson_MAIN_2,WPP_E_ericsson_MAIN_2.bit,WPP_E_ericsson_MAIN_2_yuv.md5 ++1,WPP_F_ericsson_MAIN10_2,WPP_F_ericsson_MAIN10_2.bit,WPP_F_ericsson_MAIN10_yuv.md5 ++1,WPP_F_ericsson_MAIN_2,WPP_F_ericsson_MAIN_2.bit,WPP_F_ericsson_MAIN_2_yuv.md5 +--- /dev/null ++++ b/pi-util/conf_native.sh +@@ -0,0 +1,106 @@ ++echo "Configure for native build" ++ ++FFSRC=`pwd` ++MC=`dpkg --print-architecture` ++BUILDBASE=$FFSRC/out ++ ++#RPI_KEEPS="-save-temps=obj" ++RPI_KEEPS="" ++ ++NOSHARED= ++MMAL= ++ ++while [ "$1" != "" ] ; do ++ case $1 in ++ --noshared) ++ NOSHARED=1 ++ ;; ++ --mmal) ++ MMAL=1 ++ ;; ++ *) ++ echo "Usage $0: [--noshared] [--mmal]" ++ exit 1 ++ ;; ++ esac ++ shift ++done ++ ++ ++MCOPTS= ++RPI_INCLUDES= ++RPI_LIBDIRS= ++RPI_DEFINES= ++RPI_EXTRALIBS= ++ ++if [ "$MC" == "arm64" ]; then ++ echo "M/C aarch64" ++ A=aarch64-linux-gnu ++ B=arm64 ++elif [ "$MC" == "armhf" ]; then ++ echo "M/C armv7" ++ A=arm-linux-gnueabihf ++ B=armv7 ++ MCOPTS="--arch=armv6t2 --cpu=cortex-a7" ++ RPI_DEFINES=-mfpu=neon-vfpv4 ++else ++ echo Unexpected architecture $MC ++ exit 1 ++fi ++ ++if [ $MMAL ]; then ++ RPI_OPT_VC=/opt/vc ++ RPI_INCLUDES="-I$RPI_OPT_VC/include -I$RPI_OPT_VC/include/interface/vcos/pthreads -I$RPI_OPT_VC/include/interface/vmcs_host/linux" ++ RPI_LIBDIRS="-L$RPI_OPT_VC/lib" ++ RPI_DEFINES="$RPI_DEFINES -D__VCCOREVER__=0x4000000" ++ RPI_EXTRALIBS="-Wl,--start-group -lbcm_host -lmmal -lmmal_util -lmmal_core -lvcos -lvcsm -lvchostif -lvchiq_arm -Wl,--end-group" ++ RPIOPTS="--enable-mmal --enable-rpi" ++else ++ RPIOPTS="--disable-mmal --enable-sand" ++fi ++ ++C=`lsb_release -sc` ++V=`cat RELEASE` ++ ++SHARED_LIBS="--enable-shared" ++if [ $NOSHARED ]; then ++ SHARED_LIBS="--disable-shared" ++ OUT=$BUILDBASE/$B-$C-$V-static-rel ++ echo Static libs ++else ++ echo Shared libs ++ OUT=$BUILDBASE/$B-$C-$V-shared-rel ++fi ++ ++USR_PREFIX=$OUT/install ++LIB_PREFIX=$USR_PREFIX/lib/$A ++INC_PREFIX=$USR_PREFIX/include/$A ++ ++echo Destination directory: $OUT ++mkdir -p $OUT ++# Nothing under here need worry git - including this .gitignore! ++echo "**" > $BUILDBASE/.gitignore ++cd $OUT ++ ++$FFSRC/configure \ ++ --prefix=$USR_PREFIX\ ++ --libdir=$LIB_PREFIX\ ++ --incdir=$INC_PREFIX\ ++ $MCOPTS\ ++ --disable-stripping\ ++ --disable-thumb\ ++ --enable-v4l2-request\ ++ --enable-libdrm\ ++ --enable-vout-egl\ ++ --enable-vout-drm\ ++ $SHARED_LIBS\ ++ $RPIOPTS\ ++ --extra-cflags="-ggdb $RPI_KEEPS $RPI_DEFINES $RPI_INCLUDES"\ ++ --extra-cxxflags="$RPI_DEFINES $RPI_INCLUDES"\ ++ --extra-ldflags="$RPI_LIBDIRS"\ ++ --extra-libs="$RPI_EXTRALIBS"\ ++ --extra-version="rpi" ++ ++ ++# gcc option for getting asm listing ++# -Wa,-ahls +--- /dev/null ++++ b/pi-util/ffconf.py +@@ -0,0 +1,215 @@ ++#!/usr/bin/env python3 ++ ++import string ++import os ++import subprocess ++import re ++import argparse ++import sys ++import csv ++from stat import * ++ ++CODEC_HEVC_RPI = 1 ++HWACCEL_RPI = 2 ++HWACCEL_DRM = 3 ++HWACCEL_VAAPI = 4 ++ ++def testone(fileroot, srcname, es_file, md5_file, pix, dectype, vcodec, ffmpeg_exec): ++ hwaccel = "" ++ if dectype == HWACCEL_RPI: ++ hwaccel = "rpi" ++ elif dectype == HWACCEL_DRM: ++ hwaccel = "drm" ++ elif dectype == HWACCEL_VAAPI: ++ hwaccel = "vaapi" ++ ++ pix_fmt = [] ++ if pix == "8": ++ pix_fmt = ["-pix_fmt", "yuv420p"] ++ elif pix == "10": ++ pix_fmt = ["-pix_fmt", "yuv420p10le"] ++ elif pix == "12": ++ pix_fmt = ["-pix_fmt", "yuv420p12le"] ++ ++ tmp_root = "/tmp" ++ ++ names = srcname.split('/') ++ while len(names) > 1: ++ tmp_root = os.path.join(tmp_root, names[0]) ++ del names[0] ++ name = names[0] ++ ++ if not os.path.exists(tmp_root): ++ os.makedirs(tmp_root) ++ ++ dec_file = os.path.join(tmp_root, name + ".dec.md5") ++ try: ++ os.remove(dec_file) ++ except: ++ pass ++ ++ flog = open(os.path.join(tmp_root, name + ".log"), "wt") ++ ++ ffargs = [ffmpeg_exec, "-flags", "unaligned", "-hwaccel", hwaccel, "-vcodec", "hevc", "-i", os.path.join(fileroot, es_file)] + pix_fmt + ["-f", "md5", dec_file] ++ ++ # Unaligned needed for cropping conformance ++ if hwaccel: ++ rstr = subprocess.call(ffargs, stdout=flog, stderr=subprocess.STDOUT) ++ else: ++ rstr = subprocess.call( ++ [ffmpeg_exec, "-flags", "unaligned", "-vcodec", vcodec, "-i", os.path.join(fileroot, es_file), "-f", "md5", dec_file], ++ stdout=flog, stderr=subprocess.STDOUT) ++ ++ try: ++ m1 = None ++ m2 = None ++ with open(os.path.join(fileroot, md5_file)) as f: ++ for line in f: ++ m1 = re.search("[0-9a-f]{32}", line.lower()) ++ if m1: ++ break ++ ++ with open(dec_file) as f: ++ m2 = re.search("[0-9a-f]{32}", f.readline()) ++ except: ++ pass ++ ++ if m1 and m2 and m1.group() == m2.group(): ++ print("Match: " + m1.group(), file=flog) ++ rv = 0 ++ elif not m1: ++ print("****** Cannot find m1", file=flog) ++ rv = 3 ++ elif not m2: ++ print("****** Cannot find m2", file=flog) ++ rv = 2 ++ else: ++ print("****** Mismatch: " + m1.group() + " != " + m2.group(), file=flog) ++ rv = 1 ++ flog.close() ++ return rv ++ ++def scandir(root): ++ aconf = [] ++ ents = os.listdir(root) ++ ents.sort(key=str.lower) ++ for name in ents: ++ test_path = os.path.join(root, name) ++ if S_ISDIR(os.stat(test_path).st_mode): ++ files = os.listdir(test_path) ++ es_file = "?" ++ md5_file = "?" ++ for f in files: ++ (base, ext) = os.path.splitext(f) ++ if base[0] == '.': ++ pass ++ elif ext == ".bit" or ext == ".bin": ++ es_file = f ++ elif ext == ".md5" or (ext == ".txt" and (base[-4:] == "_md5" or base[-6:] == "md5sum")): ++ if md5_file == "?": ++ md5_file = f ++ elif base[-3:] == "yuv": ++ md5_file = f ++ aconf.append((1, name, es_file, md5_file)) ++ return aconf ++ ++def runtest(name, tests): ++ if not tests: ++ return True ++ for t in tests: ++ if name[0:len(t)] == t or name.find("/" + t) != -1: ++ return True ++ return False ++ ++def doconf(csva, tests, test_root, vcodec, dectype, ffmpeg_exec): ++ unx_failures = [] ++ unx_success = [] ++ failures = 0 ++ successes = 0 ++ for a in csva: ++ exp_test = int(a[0]) ++ if (exp_test and runtest(a[1], tests)): ++ name = a[1] ++ print ("==== ", name, end="") ++ sys.stdout.flush() ++ ++ rv = testone(os.path.join(test_root, name), name, a[2], a[3], a[4], dectype=dectype, vcodec=vcodec, ffmpeg_exec=ffmpeg_exec) ++ if (rv == 0): ++ successes += 1 ++ else: ++ failures += 1 ++ ++ if (rv == 0): ++ if exp_test == 2: ++ print(": * OK *") ++ unx_success.append(name) ++ else: ++ print(": ok") ++ elif exp_test == 2 and rv == 1: ++ print(": fail") ++ elif exp_test == 3 and rv == 2: ++ # Call an expected "crash" an abort ++ print(": abort") ++ else: ++ unx_failures.append(name) ++ if rv == 1: ++ print(": * FAIL *") ++ elif (rv == 2) : ++ print(": * CRASH *") ++ elif (rv == 3) : ++ print(": * MD5 MISSING *") ++ else : ++ print(": * BANG *") ++ ++ if unx_failures or unx_success: ++ print("Unexpected Failures:", unx_failures) ++ print("Unexpected Success: ", unx_success) ++ else: ++ print("All tests normal:", successes, "ok,", failures, "failed") ++ ++ ++class ConfCSVDialect(csv.Dialect): ++ delimiter = ',' ++ doublequote = True ++ lineterminator = '\n' ++ quotechar='"' ++ quoting = csv.QUOTE_MINIMAL ++ skipinitialspace = True ++ strict = True ++ ++if __name__ == '__main__': ++ ++ argp = argparse.ArgumentParser(description="FFmpeg h265 conformance tester") ++ argp.add_argument("tests", nargs='*') ++ argp.add_argument("--pi4", action='store_true', help="Force pi4 cmd line") ++ argp.add_argument("--drm", action='store_true', help="Force v4l2 drm cmd line") ++ argp.add_argument("--vaapi", action='store_true', help="Force vaapi cmd line") ++ argp.add_argument("--test_root", default="/opt/conform/h265.2016", help="Root dir for test") ++ argp.add_argument("--csvgen", action='store_true', help="Generate CSV file for dir") ++ argp.add_argument("--csv", default="pi-util/conf_h265.2016.csv", help="CSV filename") ++ argp.add_argument("--vcodec", default="hevc_rpi", help="vcodec name to use") ++ argp.add_argument("--ffmpeg", default="./ffmpeg", help="ffmpeg exec name") ++ args = argp.parse_args() ++ ++ if args.csvgen: ++ csv.writer(sys.stdout).writerows(scandir(args.test_root)) ++ exit(0) ++ ++ with open(args.csv, 'rt') as csvfile: ++ csva = [a for a in csv.reader(csvfile, ConfCSVDialect())] ++ ++ dectype = CODEC_HEVC_RPI ++ if os.path.exists("/dev/rpivid-hevcmem"): ++ dectype = HWACCEL_RPI ++ if args.drm or os.path.exists("/sys/module/rpivid_hevc"): ++ dectype = HWACCEL_DRM ++ ++ if args.pi4: ++ dectype = HWACCEL_RPI ++ elif args.drm: ++ dectype = HWACCEL_DRM ++ elif args.vaapi: ++ dectype = HWACCEL_VAAPI ++ ++ doconf(csva, args.tests, args.test_root, args.vcodec, dectype, args.ffmpeg) ++ +--- /dev/null ++++ b/pi-util/ffperf.py +@@ -0,0 +1,128 @@ ++#!/usr/bin/env python3 ++ ++import time ++import string ++import os ++import tempfile ++import subprocess ++import re ++import argparse ++import sys ++import csv ++from stat import * ++ ++class tstats: ++ close_threshold = 0.01 ++ ++ def __init__(self, stats_dict=None): ++ if stats_dict != None: ++ self.name = stats_dict["name"] ++ self.elapsed = float(stats_dict["elapsed"]) ++ self.user = float(stats_dict["user"]) ++ self.sys = float(stats_dict["sys"]) ++ ++ def times_str(self): ++ ctime = self.sys + self.user ++ return "time=%6.2f, cpu=%6.2f (%4.2f%%)" % (self.elapsed, ctime, (ctime * 100.0) / self.elapsed) ++ ++ def dict(self): ++ return {"name":self.name, "elapsed":self.elapsed, "user":self.user, "sys":self.sys} ++ ++ def is_close(self, other): ++ return abs(self.elapsed - other.elapsed) / self.elapsed < self.close_threshold ++ ++ def __lt__(self, other): ++ return self.elapsed < other.elapsed ++ def __gt__(self, other): ++ return self.elapsed > other.elapsed ++ ++ def time_file(name, prefix, ffmpeg="./ffmpeg"): ++ stats = tstats() ++ stats.name = name ++ start_time = time.clock_gettime(time.CLOCK_MONOTONIC); ++ cproc = subprocess.Popen([ffmpeg, "-no_cvt_hw", ++ "-vcodec", "hevc_rpi", ++ "-t", "30", "-i", prefix + name, ++ "-f", "vout_rpi", os.devnull], bufsize=-1, stdout=flog, stderr=flog); ++ pinfo = os.wait4(cproc.pid, 0) ++ end_time = time.clock_gettime(time.CLOCK_MONOTONIC); ++ stats.elapsed = end_time - start_time ++ stats.user = pinfo[2].ru_utime ++ stats.sys = pinfo[2].ru_stime ++ return stats ++ ++ ++def common_prefix(s1, s2): ++ for i in range(min(len(s1),len(s2))): ++ if s1[i] != s2[i]: ++ return s1[:i] ++ return s1[:i+1] ++ ++def main(): ++ global flog ++ ++ argp = argparse.ArgumentParser(description="FFmpeg performance tester", epilog=""" ++To blank the screen before starting use "xdg-screensaver activate" ++(For some reason this doesn't seem to work from within python). ++""") ++ ++ argp.add_argument("streams", nargs='*') ++ argp.add_argument("--csv_out", default="ffperf_out.csv", help="CSV output filename") ++ argp.add_argument("--csv_in", help="CSV input filename") ++ argp.add_argument("--prefix", help="Filename prefix (include terminal '/' if a directory).") ++ argp.add_argument("--repeat", default=3, type=int, help="Run repeat count") ++ argp.add_argument("--ffmpeg", default="./ffmpeg", help="FFmpeg executable") ++ ++ args = argp.parse_args() ++ ++ csv_out = csv.DictWriter(open(args.csv_out, 'w', newline=''), ["name", "elapsed", "user", "sys"]) ++ csv_out.writeheader() ++ ++ stats_in = {} ++ if args.csv_in != None: ++ with open(args.csv_in, 'r', newline='') as f_in: ++ stats_in = {x["name"]:tstats(x) for x in csv.DictReader(f_in)} ++ ++ flog = open(os.path.join(tempfile.gettempdir(), "ffperf.log"), "wt") ++ ++ streams = args.streams ++ if not streams: ++ if not stats_in: ++ print ("No source streams specified") ++ return 1 ++ prefix = "" if args.prefix == None else args.prefix ++ streams = [k for k in stats_in] ++ elif args.prefix != None: ++ prefix = args.prefix ++ else: ++ prefix = streams[0] ++ for f in streams[1:]: ++ prefix = common_prefix(prefix, f) ++ pp = prefix.rpartition(os.sep) ++ prefix = pp[0] + pp[1] ++ streams = [s[len(prefix):] for s in streams] ++ ++ for f in sorted(streams, key=lambda x : "~" * x.count(os.sep) + x.lower()): ++ print ("====", f) ++ ++ t0 = tstats({"name":f, "elapsed":999, "user":999, "sys":999}) ++ for i in range(args.repeat): ++ t = tstats.time_file(f, prefix, args.ffmpeg) ++ print ("...", t.times_str()) ++ if t0 > t: ++ t0 = t ++ ++ if t0.name in stats_in: ++ pstat = stats_in[t0.name] ++ print("---" if pstat.is_close(t0) else "<<<" if t0 < pstat else ">>>", pstat.times_str()) ++ ++ csv_out.writerow(t0.dict()) ++ ++ print () ++ ++ return 0 ++ ++ ++if __name__ == '__main__': ++ exit(main()) ++ +--- /dev/null ++++ b/pi-util/genpatch.sh +@@ -0,0 +1,35 @@ ++set -e ++ ++NOPATCH= ++if [ "$1" == "--notag" ]; then ++ shift ++ NOPATCH=1 ++fi ++ ++if [ "$1" == "" ]; then ++ echo Usage: $0 [--notag] \ ++ echo e.g.: $0 mmal_4 ++ exit 1 ++fi ++ ++VERSION=`cat RELEASE` ++if [ "$VERSION" == "" ]; then ++ echo Can\'t find version RELEASE ++ exit 1 ++fi ++ ++PATCHFILE=../ffmpeg-$VERSION-$1.patch ++ ++if [ $NOPATCH ]; then ++ echo Not tagged ++else ++ # Only continue if we are all comitted ++ git diff --name-status --exit-code ++ ++ PATCHTAG=pi/$VERSION/$1 ++ echo Tagging: $PATCHTAG ++ ++ git tag $PATCHTAG ++fi ++echo Generating patch: $PATCHFILE ++git diff n$VERSION -- > $PATCHFILE +--- /dev/null ++++ b/pi-util/make_array.py +@@ -0,0 +1,23 @@ ++#!/usr/bin/env python ++ ++# Usage ++# make_array file.bin ++# Produces file.h with array of bytes. ++# ++import sys ++for file in sys.argv[1:]: ++ prefix,suffix = file.split('.') ++ assert suffix=='bin' ++ name=prefix.split('/')[-1] ++ print 'Converting',file ++ with open(prefix+'.h','wb') as out: ++ print >>out, 'static const unsigned char',name,'[] = {' ++ with open(file,'rb') as fd: ++ i = 0 ++ for byte in fd.read(): ++ print >>out, '0x%02x, ' % ord(byte), ++ i = i + 1 ++ if i % 8 == 0: ++ print >>out, ' // %04x' % (i - 8) ++ print >>out,'};' ++ +--- /dev/null ++++ b/pi-util/mkinst.sh +@@ -0,0 +1,5 @@ ++set -e ++ ++make install ++ ++cp -r install/* ../vlc/sysroot/raspian_stretch_pi1-sysroot/usr +--- /dev/null ++++ b/pi-util/patkodi.sh +@@ -0,0 +1,9 @@ ++set -e ++KODIBASE=/home/jc/rpi/kodi/xbmc ++JOBS=-j20 ++make $JOBS ++git diff xbmc/release/4.3-kodi > $KODIBASE/tools/depends/target/ffmpeg/pfcd_hevc_optimisations.patch ++make -C $KODIBASE/tools/depends/target/ffmpeg $JOBS ++make -C $KODIBASE/build install ++ ++ +--- /dev/null ++++ b/pi-util/perfcmp.py +@@ -0,0 +1,101 @@ ++#!/usr/bin/env python3 ++ ++import time ++import string ++import os ++import tempfile ++import subprocess ++import re ++import argparse ++import sys ++import csv ++from stat import * ++ ++class tstats: ++ close_threshold = 0.01 ++ ++ def __init__(self, stats_dict=None): ++ if stats_dict != None: ++ self.name = stats_dict["name"] ++ self.elapsed = float(stats_dict["elapsed"]) ++ self.user = float(stats_dict["user"]) ++ self.sys = float(stats_dict["sys"]) ++ ++ def times_str(self): ++ ctime = self.sys + self.user ++ return "time=%6.2f, cpu=%6.2f (%4.2f%%)" % (self.elapsed, ctime, (ctime * 100.0) / self.elapsed) ++ ++ def dict(self): ++ return {"name":self.name, "elapsed":self.elapsed, "user":self.user, "sys":self.sys} ++ ++ def is_close(self, other): ++ return abs(self.elapsed - other.elapsed) / self.elapsed < self.close_threshold ++ ++ def __lt__(self, other): ++ return self.elapsed < other.elapsed ++ def __gt__(self, other): ++ return self.elapsed > other.elapsed ++ ++ def time_file(name, prefix): ++ stats = tstats() ++ stats.name = name ++ start_time = time.clock_gettime(time.CLOCK_MONOTONIC); ++ cproc = subprocess.Popen(["./ffmpeg", "-t", "30", "-i", prefix + name, ++ "-f", "null", os.devnull], bufsize=-1, stdout=flog, stderr=flog); ++ pinfo = os.wait4(cproc.pid, 0) ++ end_time = time.clock_gettime(time.CLOCK_MONOTONIC); ++ stats.elapsed = end_time - start_time ++ stats.user = pinfo[2].ru_utime ++ stats.sys = pinfo[2].ru_stime ++ return stats ++ ++ ++def common_prefix(s1, s2): ++ for i in range(min(len(s1),len(s2))): ++ if s1[i] != s2[i]: ++ return s1[:i] ++ return s1[:i+1] ++ ++def main(): ++ argp = argparse.ArgumentParser(description="FFmpeg performance compare") ++ ++ argp.add_argument("stream0", help="CSV to compare") ++ argp.add_argument("stream1", nargs='?', default="ffperf_out.csv", help="CSV to compare") ++ ++ args = argp.parse_args() ++ ++ with open(args.stream0, 'r', newline='') as f_in: ++ stats0 = {x["name"]:tstats(x) for x in csv.DictReader(f_in)} ++ with open(args.stream1, 'r', newline='') as f_in: ++ stats1 = {x["name"]:tstats(x) for x in csv.DictReader(f_in)} ++ ++ print (args.stream0, "<<-->>", args.stream1) ++ print () ++ ++ for f in sorted(stats0.keys() | stats1.keys(), key=lambda x : "~" * x.count(os.sep) + x.lower()): ++ if not (f in stats0) : ++ print (" XX :", f) ++ continue ++ if not (f in stats1) : ++ print (" XX :", f) ++ continue ++ ++ s0 = stats0[f] ++ s1 = stats1[f] ++ ++ pcent = ((s0.elapsed - s1.elapsed) / s0.elapsed) * 100.0 ++ thresh = 0.3 ++ tc = 6 ++ ++ nchar = min(tc - 1, int(abs(pcent) / thresh)) ++ cc = " -- " if nchar == 0 else "<" * nchar + " " * (tc - nchar) if pcent < 0 else " " * (tc - nchar) + ">" * nchar ++ ++ print ("%6.2f %s%6.2f (%+5.2f) : %s" % ++ (s0.elapsed, cc, s1.elapsed, pcent, f)) ++ ++ return 0 ++ ++ ++if __name__ == '__main__': ++ exit(main()) ++ +--- /dev/null ++++ b/pi-util/qem.sh +@@ -0,0 +1,9 @@ ++TARGET_DIR=../src/eupton_vc4dev_2012a/software/vc4/DEV/applications/tutorials/user_shader_example_tex ++QASM=python\ ../local/bin/qasm.py ++SRC_FILE=libavcodec/rpi_hevc_shader.qasm ++DST_BASE=shader ++ ++cp libavcodec/rpi_hevc_shader_cmd.h $TARGET_DIR ++$QASM -mc_c:$DST_BASE,$DST_BASE,$DST_BASE $SRC_FILE > $TARGET_DIR/$DST_BASE.c ++$QASM -mc_h:$DST_BASE,$DST_BASE,$DST_BASE $SRC_FILE > $TARGET_DIR/$DST_BASE.h ++ +--- /dev/null ++++ b/pi-util/v3dusage.py +@@ -0,0 +1,128 @@ ++#!/usr/bin/env python ++ ++import sys ++import argparse ++import re ++ ++def do_logparse(logname): ++ ++ rmatch = re.compile(r'^([0-9]+\.[0-9]{3}): (done )?((vpu0)|(vpu1)|(qpu1)) ([A-Z_]+) cb:([0-9a-f]+) ') ++ rqcycle = re.compile(r'^([0-9]+\.[0-9]{3}): v3d: QPU Total clock cycles for all QPUs doing vertex/coordinate shading +([0-9]+)$') ++ rqtscycle = re.compile(r'^([0-9]+\.[0-9]{3}): v3d: QPU Total clock cycles for all QPUs stalled waiting for TMUs +([0-9]+)$') ++ rl2hits = re.compile(r'^([0-9]+\.[0-9]{3}): v3d: L2C Total Level 2 cache ([a-z]+) +([0-9]+)$') ++ ++ ttotal = {'idle':0.0} ++ tstart = {} ++ qctotal = {} ++ qtstotal = {} ++ l2hits = {} ++ l2total = {} ++ time0 = None ++ idle_start = None ++ qpu_op_no = 0 ++ op_count = 0 ++ ++ with open(logname, "rt") as infile: ++ for line in infile: ++ match = rmatch.match(line) ++ if match: ++# print match.group(1), ":", match.group(2), ":", match.group(3), ":", match.group(7), ":" ++ time = float(match.group(1)) ++ unit = match.group(3) ++ opstart = not match.group(2) ++ optype = match.group(7) ++ hascb = match.group(8) != "0" ++ ++ if unit == 'qpu1': ++ unit = unit + "." + str(qpu_op_no) ++ if not opstart: ++ if hascb or optype == 'EXECUTE_SYNC': ++ qpu_op_no = 0 ++ else: ++ qpu_op_no += 1 ++ ++ # Ignore sync type ++ if optype == 'EXECUTE_SYNC': ++ continue ++ ++ if not time0: ++ time0 = time ++ ++ if opstart: ++ tstart[unit] = time; ++ elif unit in tstart: ++ op_count += 1 ++ if not unit in ttotal: ++ ttotal[unit] = 0.0 ++ ttotal[unit] += time - tstart[unit] ++ del tstart[unit] ++ ++ if not idle_start and not tstart: ++ idle_start = time ++ elif idle_start and tstart: ++ ttotal['idle'] += time - idle_start ++ idle_start = None ++ ++ match = rqcycle.match(line) ++ if match: ++ unit = "qpu1." + str(qpu_op_no) ++ if not unit in qctotal: ++ qctotal[unit] = 0 ++ qctotal[unit] += int(match.group(2)) ++ ++ match = rqtscycle.match(line) ++ if match: ++ unit = "qpu1." + str(qpu_op_no) ++ if not unit in qtstotal: ++ qtstotal[unit] = 0 ++ qtstotal[unit] += int(match.group(2)) ++ ++ match = rl2hits.match(line) ++ if match: ++ unit = "qpu1." + str(qpu_op_no) ++ if not unit in l2total: ++ l2total[unit] = 0 ++ l2hits[unit] = 0 ++ l2total[unit] += int(match.group(3)) ++ if match.group(2) == "hits": ++ l2hits[unit] += int(match.group(3)) ++ ++ ++ if not time0: ++ print "No v3d profile records found" ++ else: ++ tlogged = time - time0 ++ ++ print "Logged time:", tlogged, " Op count:", op_count ++ for unit in sorted(ttotal): ++ print b'%6s: %10.3f %7.3f%%' % (unit, ttotal[unit], ttotal[unit] * 100.0 / tlogged) ++ print ++ for unit in sorted(qctotal): ++ if not unit in qtstotal: ++ qtstotal[unit] = 0; ++ print b'%6s: Qcycles: %10d, TMU stall: %10d (%7.3f%%)' % (unit, qctotal[unit], qtstotal[unit], (qtstotal[unit] * 100.0)/qctotal[unit]) ++ if unit in l2total: ++ print b' L2Total: %10d, hits: %10d (%7.3f%%)' % (l2total[unit], l2hits[unit], (l2hits[unit] * 100.0)/l2total[unit]) ++ ++ ++ ++if __name__ == '__main__': ++ argp = argparse.ArgumentParser( ++ formatter_class=argparse.RawDescriptionHelpFormatter, ++ description="QPU/VPU perf summary from VC logging", ++ epilog = """ ++Will also summarise TMU stalls if logging requests set in qpu noflush param ++in the profiled code. ++ ++Example use: ++ vcgencmd set_logging level=0xc0 ++ ++ sudo vcdbg log msg >& t.log ++ v3dusage.py t.log ++""") ++ ++ argp.add_argument("logfile") ++ args = argp.parse_args() ++ ++ do_logparse(args.logfile) ++ +--- a/tests/checkasm/Makefile ++++ b/tests/checkasm/Makefile +@@ -9,8 +9,10 @@ AVCODECOBJS-$(CONFIG_G722DSP) + AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o + AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o + AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o ++AVCODECOBJS-$(CONFIG_IDCTDSP) += idctdsp.o + AVCODECOBJS-$(CONFIG_LLVIDDSP) += llviddsp.o + AVCODECOBJS-$(CONFIG_LLVIDENCDSP) += llviddspenc.o ++AVCODECOBJS-$(CONFIG_VC1DSP) += vc1dsp.o + AVCODECOBJS-$(CONFIG_VP8DSP) += vp8dsp.o + AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o + +--- a/tests/checkasm/checkasm.c ++++ b/tests/checkasm/checkasm.c +@@ -121,6 +121,9 @@ static const struct { + #if CONFIG_HUFFYUV_DECODER + { "huffyuvdsp", checkasm_check_huffyuvdsp }, + #endif ++ #if CONFIG_IDCTDSP ++ { "idctdsp", checkasm_check_idctdsp }, ++ #endif + #if CONFIG_JPEG2000_DECODER + { "jpeg2000dsp", checkasm_check_jpeg2000dsp }, + #endif +@@ -145,6 +148,9 @@ static const struct { + #if CONFIG_V210_ENCODER + { "v210enc", checkasm_check_v210enc }, + #endif ++ #if CONFIG_VC1DSP ++ { "vc1dsp", checkasm_check_vc1dsp }, ++ #endif + #if CONFIG_VP8DSP + { "vp8dsp", checkasm_check_vp8dsp }, + #endif +--- a/tests/checkasm/checkasm.h ++++ b/tests/checkasm/checkasm.h +@@ -60,6 +60,7 @@ void checkasm_check_hevc_add_res(void); + void checkasm_check_hevc_idct(void); + void checkasm_check_hevc_sao(void); + void checkasm_check_huffyuvdsp(void); ++void checkasm_check_idctdsp(void); + void checkasm_check_jpeg2000dsp(void); + void checkasm_check_llviddsp(void); + void checkasm_check_llviddspenc(void); +@@ -73,6 +74,7 @@ void checkasm_check_sw_scale(void); + void checkasm_check_utvideodsp(void); + void checkasm_check_v210dec(void); + void checkasm_check_v210enc(void); ++void checkasm_check_vc1dsp(void); + void checkasm_check_vf_eq(void); + void checkasm_check_vf_gblur(void); + void checkasm_check_vf_hflip(void); +--- /dev/null ++++ b/tests/checkasm/idctdsp.c +@@ -0,0 +1,98 @@ ++/* ++ * Copyright (c) 2022 Ben Avison ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with FFmpeg; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++ ++#include ++ ++#include "checkasm.h" ++ ++#include "libavcodec/idctdsp.h" ++ ++#include "libavutil/common.h" ++#include "libavutil/internal.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/mem_internal.h" ++ ++#define IDCTDSP_TEST(func) { #func, offsetof(IDCTDSPContext, func) }, ++ ++typedef struct { ++ const char *name; ++ size_t offset; ++} test; ++ ++#define RANDOMIZE_BUFFER16(name, size) \ ++ do { \ ++ int i; \ ++ for (i = 0; i < size; ++i) { \ ++ uint16_t r = rnd() % 0x201 - 0x100; \ ++ AV_WN16A(name##0 + i, r); \ ++ AV_WN16A(name##1 + i, r); \ ++ } \ ++ } while (0) ++ ++#define RANDOMIZE_BUFFER8(name, size) \ ++ do { \ ++ int i; \ ++ for (i = 0; i < size; ++i) { \ ++ uint8_t r = rnd(); \ ++ name##0[i] = r; \ ++ name##1[i] = r; \ ++ } \ ++ } while (0) ++ ++static void check_add_put_clamped(void) ++{ ++ /* Source buffers are only as big as needed, since any over-read won't affect results */ ++ LOCAL_ALIGNED_16(int16_t, src0, [64]); ++ LOCAL_ALIGNED_16(int16_t, src1, [64]); ++ /* Destination buffers have borders of one row above/below and 8 columns left/right to catch overflows */ ++ LOCAL_ALIGNED_8(uint8_t, dst0, [10 * 24]); ++ LOCAL_ALIGNED_8(uint8_t, dst1, [10 * 24]); ++ ++ AVCodecContext avctx = { 0 }; ++ IDCTDSPContext h; ++ ++ const test tests[] = { ++ IDCTDSP_TEST(add_pixels_clamped) ++ IDCTDSP_TEST(put_pixels_clamped) ++ IDCTDSP_TEST(put_signed_pixels_clamped) ++ }; ++ ++ ff_idctdsp_init(&h, &avctx); ++ ++ for (size_t t = 0; t < FF_ARRAY_ELEMS(tests); ++t) { ++ void (*func)(const int16_t *, uint8_t * ptrdiff_t) = *(void **)((intptr_t) &h + tests[t].offset); ++ if (check_func(func, "idctdsp.%s", tests[t].name)) { ++ declare_func_emms(AV_CPU_FLAG_MMX, void, const int16_t *, uint8_t *, ptrdiff_t); ++ RANDOMIZE_BUFFER16(src, 64); ++ RANDOMIZE_BUFFER8(dst, 10 * 24); ++ call_ref(src0, dst0 + 24 + 8, 24); ++ call_new(src1, dst1 + 24 + 8, 24); ++ if (memcmp(dst0, dst1, 10 * 24)) ++ fail(); ++ bench_new(src1, dst1 + 24 + 8, 24); ++ } ++ } ++} ++ ++void checkasm_check_idctdsp(void) ++{ ++ check_add_put_clamped(); ++ report("idctdsp"); ++} +--- /dev/null ++++ b/tests/checkasm/vc1dsp.c +@@ -0,0 +1,452 @@ ++/* ++ * Copyright (c) 2022 Ben Avison ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with FFmpeg; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++ ++#include ++ ++#include "checkasm.h" ++ ++#include "libavcodec/vc1dsp.h" ++ ++#include "libavutil/common.h" ++#include "libavutil/internal.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/mem_internal.h" ++ ++#define VC1DSP_TEST(func) { #func, offsetof(VC1DSPContext, func) }, ++#define VC1DSP_SIZED_TEST(func, width, height) { #func, offsetof(VC1DSPContext, func), width, height }, ++ ++typedef struct { ++ const char *name; ++ size_t offset; ++ int width; ++ int height; ++} test; ++ ++typedef struct matrix { ++ size_t width; ++ size_t height; ++ float d[]; ++} matrix; ++ ++static const matrix T8 = { 8, 8, { ++ 12, 12, 12, 12, 12, 12, 12, 12, ++ 16, 15, 9, 4, -4, -9, -15, -16, ++ 16, 6, -6, -16, -16, -6, 6, 16, ++ 15, -4, -16, -9, 9, 16, 4, -15, ++ 12, -12, -12, 12, 12, -12, -12, 12, ++ 9, -16, 4, 15, -15, -4, 16, -9, ++ 6, -16, 16, -6, -6, 16, -16, 6, ++ 4, -9, 15, -16, 16, -15, 9, -4 ++} }; ++ ++static const matrix T4 = { 4, 4, { ++ 17, 17, 17, 17, ++ 22, 10, -10, -22, ++ 17, -17, -17, 17, ++ 10, -22, 22, -10 ++} }; ++ ++static const matrix T8t = { 8, 8, { ++ 12, 16, 16, 15, 12, 9, 6, 4, ++ 12, 15, 6, -4, -12, -16, -16, -9, ++ 12, 9, -6, -16, -12, 4, 16, 15, ++ 12, 4, -16, -9, 12, 15, -6, -16, ++ 12, -4, -16, 9, 12, -15, -6, 16, ++ 12, -9, -6, 16, -12, -4, 16, -15, ++ 12, -15, 6, 4, -12, 16, -16, 9, ++ 12, -16, 16, -15, 12, -9, 6, -4 ++} }; ++ ++static const matrix T4t = { 4, 4, { ++ 17, 22, 17, 10, ++ 17, 10, -17, -22, ++ 17, -10, -17, 22, ++ 17, -22, 17, -10 ++} }; ++ ++static matrix *new_matrix(size_t width, size_t height) ++{ ++ matrix *out = av_mallocz(sizeof (matrix) + height * width * sizeof (float)); ++ if (out == NULL) { ++ fprintf(stderr, "Memory allocation failure\n"); ++ exit(EXIT_FAILURE); ++ } ++ out->width = width; ++ out->height = height; ++ return out; ++} ++ ++static matrix *multiply(const matrix *a, const matrix *b) ++{ ++ matrix *out; ++ if (a->width != b->height) { ++ fprintf(stderr, "Incompatible multiplication\n"); ++ exit(EXIT_FAILURE); ++ } ++ out = new_matrix(b->width, a->height); ++ for (int j = 0; j < out->height; ++j) ++ for (int i = 0; i < out->width; ++i) { ++ float sum = 0; ++ for (int k = 0; k < a->width; ++k) ++ sum += a->d[j * a->width + k] * b->d[k * b->width + i]; ++ out->d[j * out->width + i] = sum; ++ } ++ return out; ++} ++ ++static void normalise(matrix *a) ++{ ++ for (int j = 0; j < a->height; ++j) ++ for (int i = 0; i < a->width; ++i) { ++ float *p = a->d + j * a->width + i; ++ *p *= 64; ++ if (a->height == 4) ++ *p /= (const unsigned[]) { 289, 292, 289, 292 } [j]; ++ else ++ *p /= (const unsigned[]) { 288, 289, 292, 289, 288, 289, 292, 289 } [j]; ++ if (a->width == 4) ++ *p /= (const unsigned[]) { 289, 292, 289, 292 } [i]; ++ else ++ *p /= (const unsigned[]) { 288, 289, 292, 289, 288, 289, 292, 289 } [i]; ++ } ++} ++ ++static void divide_and_round_nearest(matrix *a, float by) ++{ ++ for (int j = 0; j < a->height; ++j) ++ for (int i = 0; i < a->width; ++i) { ++ float *p = a->d + j * a->width + i; ++ *p = rintf(*p / by); ++ } ++} ++ ++static void tweak(matrix *a) ++{ ++ for (int j = 4; j < a->height; ++j) ++ for (int i = 0; i < a->width; ++i) { ++ float *p = a->d + j * a->width + i; ++ *p += 1; ++ } ++} ++ ++/* The VC-1 spec places restrictions on the values permitted at three ++ * different stages: ++ * - D: the input coefficients in frequency domain ++ * - E: the intermediate coefficients, inverse-transformed only horizontally ++ * - R: the fully inverse-transformed coefficients ++ * ++ * To fully cater for the ranges specified requires various intermediate ++ * values to be held to 17-bit precision; yet these conditions do not appear ++ * to be utilised in real-world streams. At least some assembly ++ * implementations have chosen to restrict these values to 16-bit precision, ++ * to accelerate the decoding of real-world streams at the cost of strict ++ * adherence to the spec. To avoid our test marking these as failures, ++ * reduce our random inputs. ++ */ ++#define ATTENUATION 4 ++ ++static matrix *generate_inverse_quantized_transform_coefficients(size_t width, size_t height) ++{ ++ matrix *raw, *tmp, *D, *E, *R; ++ raw = new_matrix(width, height); ++ for (int i = 0; i < width * height; ++i) ++ raw->d[i] = (int) (rnd() % (1024/ATTENUATION)) - 512/ATTENUATION; ++ tmp = multiply(height == 8 ? &T8 : &T4, raw); ++ D = multiply(tmp, width == 8 ? &T8t : &T4t); ++ normalise(D); ++ divide_and_round_nearest(D, 1); ++ for (int i = 0; i < width * height; ++i) { ++ if (D->d[i] < -2048/ATTENUATION || D->d[i] > 2048/ATTENUATION-1) { ++ /* Rare, so simply try again */ ++ av_free(raw); ++ av_free(tmp); ++ av_free(D); ++ return generate_inverse_quantized_transform_coefficients(width, height); ++ } ++ } ++ E = multiply(D, width == 8 ? &T8 : &T4); ++ divide_and_round_nearest(E, 8); ++ for (int i = 0; i < width * height; ++i) ++ if (E->d[i] < -4096/ATTENUATION || E->d[i] > 4096/ATTENUATION-1) { ++ /* Rare, so simply try again */ ++ av_free(raw); ++ av_free(tmp); ++ av_free(D); ++ av_free(E); ++ return generate_inverse_quantized_transform_coefficients(width, height); ++ } ++ R = multiply(height == 8 ? &T8t : &T4t, E); ++ tweak(R); ++ divide_and_round_nearest(R, 128); ++ for (int i = 0; i < width * height; ++i) ++ if (R->d[i] < -512/ATTENUATION || R->d[i] > 512/ATTENUATION-1) { ++ /* Rare, so simply try again */ ++ av_free(raw); ++ av_free(tmp); ++ av_free(D); ++ av_free(E); ++ av_free(R); ++ return generate_inverse_quantized_transform_coefficients(width, height); ++ } ++ av_free(raw); ++ av_free(tmp); ++ av_free(E); ++ av_free(R); ++ return D; ++} ++ ++#define RANDOMIZE_BUFFER16(name, size) \ ++ do { \ ++ int i; \ ++ for (i = 0; i < size; ++i) { \ ++ uint16_t r = rnd(); \ ++ AV_WN16A(name##0 + i, r); \ ++ AV_WN16A(name##1 + i, r); \ ++ } \ ++ } while (0) ++ ++#define RANDOMIZE_BUFFER8(name, size) \ ++ do { \ ++ int i; \ ++ for (i = 0; i < size; ++i) { \ ++ uint8_t r = rnd(); \ ++ name##0[i] = r; \ ++ name##1[i] = r; \ ++ } \ ++ } while (0) ++ ++#define RANDOMIZE_BUFFER8_MID_WEIGHTED(name, size) \ ++ do { \ ++ uint8_t *p##0 = name##0, *p##1 = name##1; \ ++ int i = (size); \ ++ while (i-- > 0) { \ ++ int x = 0x80 | (rnd() & 0x7F); \ ++ x >>= rnd() % 9; \ ++ if (rnd() & 1) \ ++ x = -x; \ ++ *p##1++ = *p##0++ = 0x80 + x; \ ++ } \ ++ } while (0) ++ ++static void check_inv_trans_inplace(void) ++{ ++ /* Inverse transform input coefficients are stored in a 16-bit buffer ++ * with row stride of 8 coefficients irrespective of transform size. ++ * vc1_inv_trans_8x8 differs from the others in two ways: coefficients ++ * are stored in column-major order, and the outputs are written back ++ * to the input buffer, so we oversize it slightly to catch overruns. */ ++ LOCAL_ALIGNED_16(int16_t, inv_trans_in0, [10 * 8]); ++ LOCAL_ALIGNED_16(int16_t, inv_trans_in1, [10 * 8]); ++ ++ VC1DSPContext h; ++ ++ ff_vc1dsp_init(&h); ++ ++ if (check_func(h.vc1_inv_trans_8x8, "vc1dsp.vc1_inv_trans_8x8")) { ++ matrix *coeffs; ++ declare_func_emms(AV_CPU_FLAG_MMX, void, int16_t *); ++ RANDOMIZE_BUFFER16(inv_trans_in, 10 * 8); ++ coeffs = generate_inverse_quantized_transform_coefficients(8, 8); ++ for (int j = 0; j < 8; ++j) ++ for (int i = 0; i < 8; ++i) { ++ int idx = 8 + i * 8 + j; ++ inv_trans_in1[idx] = inv_trans_in0[idx] = coeffs->d[j * 8 + i]; ++ } ++ call_ref(inv_trans_in0 + 8); ++ call_new(inv_trans_in1 + 8); ++ if (memcmp(inv_trans_in0, inv_trans_in1, 10 * 8 * sizeof (int16_t))) ++ fail(); ++ bench_new(inv_trans_in1 + 8); ++ av_free(coeffs); ++ } ++} ++ ++static void check_inv_trans_adding(void) ++{ ++ /* Inverse transform input coefficients are stored in a 16-bit buffer ++ * with row stride of 8 coefficients irrespective of transform size. */ ++ LOCAL_ALIGNED_16(int16_t, inv_trans_in0, [8 * 8]); ++ LOCAL_ALIGNED_16(int16_t, inv_trans_in1, [8 * 8]); ++ ++ /* For all but vc1_inv_trans_8x8, the inverse transform is narrowed and ++ * added with saturation to an array of unsigned 8-bit values. Oversize ++ * this by 8 samples left and right and one row above and below. */ ++ LOCAL_ALIGNED_8(uint8_t, inv_trans_out0, [10 * 24]); ++ LOCAL_ALIGNED_8(uint8_t, inv_trans_out1, [10 * 24]); ++ ++ VC1DSPContext h; ++ ++ const test tests[] = { ++ VC1DSP_SIZED_TEST(vc1_inv_trans_8x4, 8, 4) ++ VC1DSP_SIZED_TEST(vc1_inv_trans_4x8, 4, 8) ++ VC1DSP_SIZED_TEST(vc1_inv_trans_4x4, 4, 4) ++ VC1DSP_SIZED_TEST(vc1_inv_trans_8x8_dc, 8, 8) ++ VC1DSP_SIZED_TEST(vc1_inv_trans_8x4_dc, 8, 4) ++ VC1DSP_SIZED_TEST(vc1_inv_trans_4x8_dc, 4, 8) ++ VC1DSP_SIZED_TEST(vc1_inv_trans_4x4_dc, 4, 4) ++ }; ++ ++ ff_vc1dsp_init(&h); ++ ++ for (size_t t = 0; t < FF_ARRAY_ELEMS(tests); ++t) { ++ void (*func)(uint8_t *, ptrdiff_t, int16_t *) = *(void **)((intptr_t) &h + tests[t].offset); ++ if (check_func(func, "vc1dsp.%s", tests[t].name)) { ++ matrix *coeffs; ++ declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, ptrdiff_t, int16_t *); ++ RANDOMIZE_BUFFER16(inv_trans_in, 8 * 8); ++ RANDOMIZE_BUFFER8(inv_trans_out, 10 * 24); ++ coeffs = generate_inverse_quantized_transform_coefficients(tests[t].width, tests[t].height); ++ for (int j = 0; j < tests[t].height; ++j) ++ for (int i = 0; i < tests[t].width; ++i) { ++ int idx = j * 8 + i; ++ inv_trans_in1[idx] = inv_trans_in0[idx] = coeffs->d[j * tests[t].width + i]; ++ } ++ call_ref(inv_trans_out0 + 24 + 8, 24, inv_trans_in0); ++ call_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1); ++ if (memcmp(inv_trans_out0, inv_trans_out1, 10 * 24)) ++ fail(); ++ bench_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1 + 8); ++ av_free(coeffs); ++ } ++ } ++} ++ ++static void check_loop_filter(void) ++{ ++ /* Deblocking filter buffers are big enough to hold a 16x16 block, ++ * plus 16 columns left and 4 rows above to hold filter inputs ++ * (depending on whether v or h neighbouring block edge, oversized ++ * horizontally to maintain 16-byte alignment) plus 16 columns and ++ * 4 rows below to catch write overflows */ ++ LOCAL_ALIGNED_16(uint8_t, filter_buf0, [24 * 48]); ++ LOCAL_ALIGNED_16(uint8_t, filter_buf1, [24 * 48]); ++ ++ VC1DSPContext h; ++ ++ const test tests[] = { ++ VC1DSP_TEST(vc1_v_loop_filter4) ++ VC1DSP_TEST(vc1_h_loop_filter4) ++ VC1DSP_TEST(vc1_v_loop_filter8) ++ VC1DSP_TEST(vc1_h_loop_filter8) ++ VC1DSP_TEST(vc1_v_loop_filter16) ++ VC1DSP_TEST(vc1_h_loop_filter16) ++ }; ++ ++ ff_vc1dsp_init(&h); ++ ++ for (size_t t = 0; t < FF_ARRAY_ELEMS(tests); ++t) { ++ void (*func)(uint8_t *, ptrdiff_t, int) = *(void **)((intptr_t) &h + tests[t].offset); ++ declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, ptrdiff_t, int); ++ if (check_func(func, "vc1dsp.%s", tests[t].name)) { ++ for (int count = 1000; count > 0; --count) { ++ int pq = rnd() % 31 + 1; ++ RANDOMIZE_BUFFER8_MID_WEIGHTED(filter_buf, 24 * 48); ++ call_ref(filter_buf0 + 4 * 48 + 16, 48, pq); ++ call_new(filter_buf1 + 4 * 48 + 16, 48, pq); ++ if (memcmp(filter_buf0, filter_buf1, 24 * 48)) ++ fail(); ++ } ++ } ++ for (int j = 0; j < 24; ++j) ++ for (int i = 0; i < 48; ++i) ++ filter_buf1[j * 48 + i] = 0x60 + 0x40 * (i >= 16 && j >= 4); ++ if (check_func(func, "vc1dsp.%s_bestcase", tests[t].name)) ++ bench_new(filter_buf1 + 4 * 48 + 16, 48, 1); ++ if (check_func(func, "vc1dsp.%s_worstcase", tests[t].name)) ++ bench_new(filter_buf1 + 4 * 48 + 16, 48, 31); ++ } ++} ++ ++#define TEST_UNESCAPE \ ++ do { \ ++ for (int count = 100; count > 0; --count) { \ ++ escaped_offset = rnd() & 7; \ ++ unescaped_offset = rnd() & 7; \ ++ escaped_len = (1u << (rnd() % 8) + 3) - (rnd() & 7); \ ++ RANDOMIZE_BUFFER8(unescaped, UNESCAPE_BUF_SIZE); \ ++ len0 = call_ref(escaped0 + escaped_offset, escaped_len, unescaped0 + unescaped_offset); \ ++ len1 = call_new(escaped1 + escaped_offset, escaped_len, unescaped1 + unescaped_offset); \ ++ if (len0 != len1 || memcmp(unescaped0, unescaped1, UNESCAPE_BUF_SIZE)) \ ++ fail(); \ ++ } \ ++ } while (0) ++ ++static void check_unescape(void) ++{ ++ /* This appears to be a typical length of buffer in use */ ++#define LOG2_UNESCAPE_BUF_SIZE 17 ++#define UNESCAPE_BUF_SIZE (1u< +Date: Thu, 8 Dec 2022 10:34:20 -0600 +Subject: [PATCH] configure: setup for OE-core usage + +Upstream-Status: Inappropriate + +RPI-Distro repo clones original ffmpeg and applies patches to enable +raspiberry pi support. + +Add global CFLAGS and LDFLAGS. So, that when +./configure runs test it's able to locate proper +headers and libs in a cross-compile environment. + +Add new check to opengl. None of the above headers +exists and we also should be using GLESv2. + +Update where compiler finds OMX_Core.h + +Only check that sdl2 version greater than 2.0.1 + +Signed-off-by: Vincent Davis Jr +--- + configure | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/configure b/configure +index 723b81f1..0c7f2654 100755 +--- a/configure ++++ b/configure +@@ -5746,6 +5746,9 @@ enable_weak_pic() { + } + + enabled pic && enable_weak_pic ++# Set CFLAGS and LDFLAGS globally ++add_cflags -I${sysroot}/usr/include/ -I${sysroot}/usr/include/IL -I${sysroot}/usr/include/drm ++add_ldflags -L${sysroot}/usr/lib/ + + test_cc <= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent ++ test_pkg_config sdl2 "sdl2 >= 2.0.1" SDL_events.h SDL_PollEvent + if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then + sdl2_cflags=$("${SDL2_CONFIG}" --cflags) + sdl2_extralibs=$("${SDL2_CONFIG}" --libs) +-- +2.38.1 + diff --git a/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2002-libavdevice-opengl_enc-update-dynamic-function-loader.patch b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2002-libavdevice-opengl_enc-update-dynamic-function-loader.patch new file mode 100644 index 0000000000..43a9191885 --- /dev/null +++ b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2002-libavdevice-opengl_enc-update-dynamic-function-loader.patch @@ -0,0 +1,111 @@ +From be426ad76c3e486f1364dd292cf8e1c633c80e91 Mon Sep 17 00:00:00 2001 +From: Vincent Davis Jr +Date: Thu, 8 Dec 2022 10:39:47 -0600 +Subject: [PATCH] libavdevice: opengl_enc.c update dynamic function loader + +Upstream-Status: Inappropriate + +RPI-Distro repo clones original ffmpeg and applies patches to enable +raspiberry pi support. + +For meta-raspberrypi ffmpeg builds, when opengl +is enabled do_compile will fail. Reasion is that +glGetProcAddress is undefined in either GLES2/gl2.h +or GLES2/gl2ext.h. + +define SelectedGetProcAddress to SDL_GL_GetProcAddress +if sdl2 is included. If not included, define function +pointers at compile time versus runtime. + +Signed-off-by: Vincent Davis Jr +--- + libavdevice/opengl_enc.c | 44 ++++++++++++++++++++++++++++++++++++---- + 1 file changed, 40 insertions(+), 4 deletions(-) + +diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c +index 2bdb8da7..eabc1bf8 100644 +--- a/libavdevice/opengl_enc.c ++++ b/libavdevice/opengl_enc.c +@@ -37,12 +37,13 @@ + #include + #elif HAVE_ES2_GL_H + #include +-#else +-#include +-#include + #endif + #if HAVE_GLXGETPROCADDRESS + #include ++#else ++#define GL_GLEXT_PROTOTYPES ++#include ++#include + #endif + + #if CONFIG_SDL2 +@@ -493,8 +494,14 @@ static int av_cold opengl_load_procedures(OpenGLContext *opengl) + + #if HAVE_GLXGETPROCADDRESS + #define SelectedGetProcAddress glXGetProcAddress ++#define CAN_DYNAMIC_LOAD 1 + #elif HAVE_WGLGETPROCADDRESS + #define SelectedGetProcAddress wglGetProcAddress ++#elif CONFIG_SDL2 ++#define SelectedGetProcAddress SDL_GL_GetProcAddress ++#define CAN_DYNAMIC_LOAD 1 ++#else ++#define CAN_DYNAMIC_LOAD 0 + #endif + + #define LOAD_OPENGL_FUN(name, type) \ +@@ -504,7 +511,8 @@ static int av_cold opengl_load_procedures(OpenGLContext *opengl) + return AVERROR(ENOSYS); \ + } + +-#if CONFIG_SDL2 ++#if CAN_DYNAMIC_LOAD ++#if CONFIG_SDL2 + if (!opengl->no_window) + return opengl_sdl_load_procedures(opengl); + #endif +@@ -534,9 +542,37 @@ static int av_cold opengl_load_procedures(OpenGLContext *opengl) + LOAD_OPENGL_FUN(glGetShaderInfoLog, FF_PFNGLGETSHADERINFOLOGPROC) + LOAD_OPENGL_FUN(glEnableVertexAttribArray, FF_PFNGLENABLEVERTEXATTRIBARRAYPROC) + LOAD_OPENGL_FUN(glVertexAttribPointer, FF_PFNGLVERTEXATTRIBPOINTERPROC) ++#else ++ procs->glActiveTexture = glActiveTexture; ++ procs->glGenBuffers = glGenBuffers; ++ procs->glDeleteBuffers = glDeleteBuffers; ++ procs->glBufferData = glBufferData; ++ procs->glBindBuffer = glBindBuffer; ++ procs->glGetAttribLocation = glGetAttribLocation; ++ procs->glGetUniformLocation = glGetUniformLocation; ++ procs->glUniform1f = glUniform1f; ++ procs->glUniform1i = glUniform1i; ++ procs->glUniformMatrix4fv = glUniformMatrix4fv; ++ procs->glCreateProgram = glCreateProgram; ++ procs->glDeleteProgram = glDeleteProgram; ++ procs->glUseProgram = glUseProgram; ++ procs->glLinkProgram = glLinkProgram; ++ procs->glGetProgramiv = glGetProgramiv; ++ procs->glGetProgramInfoLog = glGetProgramInfoLog; ++ procs->glAttachShader = glAttachShader; ++ procs->glCreateShader = glCreateShader; ++ procs->glDeleteShader = glDeleteShader; ++ procs->glCompileShader = glCompileShader; ++ procs->glShaderSource = glShaderSource; ++ procs->glGetShaderiv = glGetShaderiv; ++ procs->glGetShaderInfoLog = glGetShaderInfoLog; ++ procs->glEnableVertexAttribArray = glEnableVertexAttribArray; ++ procs->glVertexAttribPointer = (FF_PFNGLVERTEXATTRIBPOINTERPROC) glVertexAttribPointer; ++#endif + + return 0; + ++#undef CAN_DYNAMIC_LOAD + #undef SelectedGetProcAddress + #undef LOAD_OPENGL_FUN + } +-- +2.38.1 + diff --git a/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2003-libavcodec-fix-v4l2_req_devscan.patch b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2003-libavcodec-fix-v4l2_req_devscan.patch new file mode 100644 index 0000000000..2232c48308 --- /dev/null +++ b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2003-libavcodec-fix-v4l2_req_devscan.patch @@ -0,0 +1,45 @@ +From 62c2f041890a6e20770350721a0a2138d0b38634 Mon Sep 17 00:00:00 2001 +From: Vincent Davis Jr +Date: Sat, 3 Dec 2022 23:35:51 -0600 +Subject: [PATCH] libavcodec: fix v4l2_req_devscan.h + +Upstream-Status: Inappropriate + +RPI-Distro repo clones original ffmpeg and applies patches to enable +raspiberry pi support. + +Fixes minor differences between v4l2_req_devscan.c +and v4l2_req_devscan.h after all patches have been +applied. + +Signed-off-by: Vincent Davis Jr +--- + libavcodec/v4l2_req_devscan.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/v4l2_req_devscan.h b/libavcodec/v4l2_req_devscan.h +index 0baef365..cd9c49ac 100644 +--- a/libavcodec/v4l2_req_devscan.h ++++ b/libavcodec/v4l2_req_devscan.h +@@ -1,6 +1,8 @@ + #ifndef _DEVSCAN_H_ + #define _DEVSCAN_H_ + ++#include ++ + struct devscan; + struct decdev; + enum v4l2_buf_type; +@@ -13,7 +15,8 @@ const char *decdev_video_path(const struct decdev *const dev); + enum v4l2_buf_type decdev_src_type(const struct decdev *const dev); + uint32_t decdev_src_pixelformat(const struct decdev *const dev); + +-const struct decdev *devscan_find(struct devscan *const scan, const uint32_t src_fmt_v4l2); ++const struct decdev *devscan_find(struct devscan *const scan, ++ const uint32_t src_fmt_v4l2); + + int devscan_build(void * const dc, struct devscan **pscan); + void devscan_delete(struct devscan **const pScan); +-- +2.38.1 + diff --git a/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2004-libavcodec-omx-replace-opt-vc-path-with-usr-lib.patch b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2004-libavcodec-omx-replace-opt-vc-path-with-usr-lib.patch new file mode 100644 index 0000000000..02c07de2cc --- /dev/null +++ b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/files/2004-libavcodec-omx-replace-opt-vc-path-with-usr-lib.patch @@ -0,0 +1,35 @@ +From 0dfb56e12fa709794525cda1471091f6699905d5 Mon Sep 17 00:00:00 2001 +From: Vincent Davis Jr +Date: Thu, 8 Dec 2022 10:49:03 -0600 +Subject: [PATCH] libavcodec: omx replace /opt/vc path with /usr/lib + +Upstream-Status: Inappropriate + +RPI-Distro repo clones original ffmpeg and applies patches to enable +raspiberry pi support. + +Configures omx.c for OE usages as libbcm_host.so +and libopenmaxil.so are located in a different +location. + +Signed-off-by: Vincent Davis Jr +--- + libavcodec/omx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/omx.c b/libavcodec/omx.c +index 0a6a3083..8c6e9193 100644 +--- a/libavcodec/omx.c ++++ b/libavcodec/omx.c +@@ -141,7 +141,7 @@ static av_cold OMXContext *omx_init(void *logctx, const char *libname, const cha + { + static const char * const libnames[] = { + #if CONFIG_OMX_RPI +- "/opt/vc/lib/libopenmaxil.so", "/opt/vc/lib/libbcm_host.so", ++ "/usr/lib/libopenmaxil.so", "/usr/lib/libbcm_host.so", + #else + "libOMX_Core.so", NULL, + "libOmxCore.so", NULL, +-- +2.38.1 + diff --git a/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.2.bb b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.2.bb deleted file mode 100644 index bf8d4b824c..0000000000 --- a/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.2.bb +++ /dev/null @@ -1,194 +0,0 @@ -SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video." -DESCRIPTION = "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, \ - mux, demux, stream, filter and play pretty much anything that humans and machines \ - have created. It supports the most obscure ancient formats up to the cutting edge." -HOMEPAGE = "https://www.ffmpeg.org/" -SECTION = "libs" - -LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG" -LICENSE:${PN} = "GPL-2.0-or-later" -LICENSE:libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" -LICENSE:libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" -LICENSE:libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" -LICENSE:libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" -LICENSE:libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" -LICENSE:libpostproc = "GPL-2.0-or-later" -LICENSE:libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" -LICENSE:libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" -LICENSE_FLAGS = "commercial" - -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 -ARM_INSTRUCTION_SET_armv4 = "arm" -ARM_INSTRUCTION_SET_armv5 = "arm" -ARM_INSTRUCTION_SET_armv6 = "arm" -# Should be API compatible with libav (which was a fork of ffmpeg) -# libpostproc was previously packaged from a separate recipe -PROVIDES = "ffmpeg libav libpostproc" -RPROVIDES:${PN} = "${PROVIDES}" -DEPENDS = "nasm-native" - -inherit autotools pkgconfig -PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \ - opengl udev sdl2 ffplay alsa bzlib lzma pic pthreads shared theora zlib \ - libvorbis x264 gpl sand rpi vout-drm vout-egl \ - ${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', 'mmal', d)} \ - ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb', '', d)}" - -SRC_URI = "\ - git://git@github.com/RPi-Distro/ffmpeg;protocol=https;branch=pios/bullseye \ - file://0001-avcodec-arm-sbcenc-avoid-callee-preserved-vfp-regist.patch \ - file://0002-Fix-build-on-powerpc-and-ppc64.patch \ - file://0003-avcodec-pngenc-remove-monowhite-from-apng-formats.patch \ - file://0004-ffmpeg-4.3.2-rpi_10.patch \ - file://0005-fix_flags.diff \ -" - -SRCREV = "ea72093f350f38edcd39c480b331c3219c377642" - -S = "${WORKDIR}/git" - -# libraries to build in addition to avutil -PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" -PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" -PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" -PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" -PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" -PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" -PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" -PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample" - -# features to support -PACKAGECONFIG[ffplay] = "--enable-ffplay,--disable-ffplay" -PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" -PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," -PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" -PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" -PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" -PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,virtual/libgl" -PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" -PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" -PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" -PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus" -PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" -PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" -PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" -PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" -PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" -PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" -PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" -PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" -PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" -PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" -PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" -PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" -PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" -PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" -PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" -#PACKAGECONFIG[snappy] = "--enable-libsnappy,--enable-libsnappy,snappy" -PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev" -PACKAGECONFIG[v4l2] = "--enable-libv4l2 --enable-v4l2-request --enable-libdrm,,v4l-utils" -PACKAGECONFIG[mmal] = "--enable-omx --enable-omx-rpi --enable-mmal,,userland" -PACKAGECONFIG[sand] = "--enable-sand,," -PACKAGECONFIG[rpi] = "--enable-rpi,," -PACKAGECONFIG[vout-drm] = "--enable-vout-drm,,libdrm" -PACKAGECONFIG[vout-egl] = "--enable-vout-egl,,virtual/egl" - -# other configuration options -PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" -PACKAGECONFIG[pic] = "--enable-pic" -PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" -PACKAGECONFIG[shared] = "--enable-shared" -PACKAGECONFIG[strip] = ",--disable-stripping" - -# Check codecs that require --enable-nonfree -USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" - -def cpu(d): - for arg in (d.getVar('TUNE_CCARGS') or '').split(): - if arg.startswith('-mcpu='): - return arg[6:] - return 'generic' - -EXTRA_OECONF = " \ - ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ - \ - --cross-prefix=${TARGET_PREFIX} \ - \ - --ld="${CCLD}" \ - --cc="${CC}" \ - --cxx="${CXX}" \ - --arch=${TARGET_ARCH} \ - --target-os="linux" \ - --enable-cross-compile \ - --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \ - --extra-ldflags="${LDFLAGS}" \ - --sysroot="${STAGING_DIR_TARGET}" \ - ${EXTRA_FFCONF} \ - --libdir=${libdir} \ - --shlibdir=${libdir} \ - --datadir=${datadir}/ffmpeg \ - --cpu=${@cpu(d)} \ - --pkg-config=pkg-config \ -" -EXTRA_OECONF:append:linux-gnux32 = " --disable-asm" - -# Directly specify the include directories the contain headers for -# libdrm -# openmaxil -TARGET_CFLAGS:append = " -I${STAGING_INCDIR}/IL -I${STAGING_INCDIR}/drm" - -# gold crashes on x86, another solution is to --disable-asm but thats more hacky -# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 -LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" -EXTRA_OEMAKE = "V=1" - -do_configure() { - ${S}/configure ${EXTRA_OECONF} -} - -# patch out build host paths for reproducibility -do_compile:prepend:class-target() { - sed -i -e "s,${WORKDIR},,g" ${B}/config.h -} - -PACKAGES =+ "libavcodec \ - libavdevice \ - libavfilter \ - libavformat \ - libavresample \ - libavutil \ - libpostproc \ - libswresample \ - libswscale" - -FILES:${PN}:append = " /usr/share/ffmpeg" -FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}" -FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}" -FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}" -FILES:libavformat = "${libdir}/libavformat${SOLIBS}" -FILES:libavresample = "${libdir}/libavresample${SOLIBS}" -FILES:libavutil = "${libdir}/libavutil${SOLIBS}" -FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}" -FILES:libswresample = "${libdir}/libswresample${SOLIBS}" -FILES:libswscale = "${libdir}/libswscale${SOLIBS}" -# ffmpeg disables PIC on some platforms (e.g. x86-32) -INSANE_SKIP:${MLPREFIX}libavcodec = "textrel" -INSANE_SKIP:${MLPREFIX}libavdevice = "textrel" -INSANE_SKIP:${MLPREFIX}libavfilter = "textrel" -INSANE_SKIP:${MLPREFIX}libavformat = "textrel" -INSANE_SKIP:${MLPREFIX}libavutil = "textrel" -INSANE_SKIP:${MLPREFIX}libavresample = "textrel" -INSANE_SKIP:${MLPREFIX}libswscale = "textrel" -INSANE_SKIP:${MLPREFIX}libswresample = "textrel" -INSANE_SKIP:${MLPREFIX}libpostproc = "textrel" - -# Only enable it for rpi class of machines -COMPATIBLE_HOST = "null" -COMPATIBLE_HOST:rpi = "'(.*)'" - diff --git a/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.4.bb b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.4.bb new file mode 100644 index 0000000000..30e7c575e3 --- /dev/null +++ b/meta-raspberrypi/recipes-multimedia/rpidistro-ffmpeg/rpidistro-ffmpeg_4.3.4.bb @@ -0,0 +1,195 @@ +SUMMARY = "A complete, cross-platform solution to record, convert and stream audio and video." +DESCRIPTION = "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, \ + mux, demux, stream, filter and play pretty much anything that humans and machines \ + have created. It supports the most obscure ancient formats up to the cutting edge." +HOMEPAGE = "https://www.ffmpeg.org/" +SECTION = "libs" + +LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG" +LICENSE:${PN} = "GPL-2.0-or-later" +LICENSE:libavcodec = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" +LICENSE:libavdevice = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" +LICENSE:libavfilter = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" +LICENSE:libavformat = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" +LICENSE:libavutil = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" +LICENSE:libpostproc = "GPL-2.0-or-later" +LICENSE:libswresample = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" +LICENSE:libswscale = "${@bb.utils.contains('PACKAGECONFIG', 'gpl', 'GPL-2.0-or-later', 'LGPL-2.1-or-later', d)}" +LICENSE_FLAGS = "commercial" + +LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ + file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" + +# Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 +ARM_INSTRUCTION_SET_armv4 = "arm" +ARM_INSTRUCTION_SET_armv5 = "arm" +ARM_INSTRUCTION_SET_armv6 = "arm" +# Should be API compatible with libav (which was a fork of ffmpeg) +# libpostproc was previously packaged from a separate recipe +PROVIDES = "ffmpeg libav libpostproc" +RPROVIDES:${PN} = "${PROVIDES}" +DEPENDS = "nasm-native" + +inherit autotools pkgconfig +PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample ffplay \ + v4l2 drm udev alsa bzlib lzma pic pthreads shared theora zlib libvorbis x264 gpl \ + ${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', 'mmal rpi sand vout-drm', d)} \ + ${@bb.utils.contains('AVAILTUNES', 'mips32r2', 'mips32r2', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv xcb vout-egl epoxy', '', d)}" + +SRC_URI = "\ + git://git@github.com/RPi-Distro/ffmpeg;protocol=https;branch=pios/bullseye \ + file://0001-avcodec-arm-sbcenc-avoid-callee-preserved-vfp-regist.patch \ + file://0002-Fix-build-on-powerpc-and-ppc64.patch \ + file://0003-avcodec-pngenc-remove-monowhite-from-apng-formats.patch \ + file://0004-ffmpeg-4.3.4-rpi_14.patch \ + file://0005-fix-flags.diff \ + file://2001-configure-setup-for-OE-core-usage.patch \ + file://2002-libavdevice-opengl_enc-update-dynamic-function-loader.patch \ + file://2003-libavcodec-fix-v4l2_req_devscan.patch \ + file://2004-libavcodec-omx-replace-opt-vc-path-with-usr-lib.patch \ + " + +SRCREV = "246e1a55a0eca931537d8706acd8b133c07beb05" + +S = "${WORKDIR}/git" + +# libraries to build in addition to avutil +PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice" +PACKAGECONFIG[avfilter] = "--enable-avfilter,--disable-avfilter" +PACKAGECONFIG[avcodec] = "--enable-avcodec,--disable-avcodec" +PACKAGECONFIG[avformat] = "--enable-avformat,--disable-avformat" +PACKAGECONFIG[swresample] = "--enable-swresample,--disable-swresample" +PACKAGECONFIG[swscale] = "--enable-swscale,--disable-swscale" +PACKAGECONFIG[postproc] = "--enable-postproc,--disable-postproc" +PACKAGECONFIG[avresample] = "--enable-avresample,--disable-avresample" + +# features to support +PACKAGECONFIG[ffplay] = "--enable-ffplay,--disable-ffplay" +PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" +PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec," +PACKAGECONFIG[bzlib] = "--enable-bzlib,--disable-bzlib,bzip2" +PACKAGECONFIG[fdk-aac] = "--enable-libfdk-aac --enable-nonfree,--disable-libfdk-aac,fdk-aac" +PACKAGECONFIG[gpl] = "--enable-gpl,--disable-gpl" +PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,virtual/libgles2" +PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm" +PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack" +PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis" +PACKAGECONFIG[libopus] = "--enable-libopus,--disable-libopus,libopus" +PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz" +PACKAGECONFIG[mfx] = "--enable-libmfx,--disable-libmfx,intel-mediasdk" +PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame" +PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" +PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2" +PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex" +PACKAGECONFIG[srt] = "--enable-libsrt,--disable-libsrt,srt" +PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora libogg" +PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva" +PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau" +PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx" +PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264" +PACKAGECONFIG[xcb] = "--enable-libxcb,--disable-libxcb,libxcb" +PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv" +PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" +PACKAGECONFIG[snappy] = "--enable-libsnappy,--disable-libsnappy,snappy" +PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev" +PACKAGECONFIG[drm] = "--enable-libdrm,--disable-libdrm,libdrm" +PACKAGECONFIG[epoxy] = "--enable-epoxy,--disable-epoxy,libepoxy" +PACKAGECONFIG[v4l2] = "--enable-libv4l2 --enable-v4l2-m2m,,v4l-utils" +PACKAGECONFIG[mmal] = "--enable-omx --enable-omx-rpi --enable-mmal,,userland" +PACKAGECONFIG[sand] = "--enable-sand,," +PACKAGECONFIG[rpi] = "--enable-rpi,," +PACKAGECONFIG[vout-drm] = "--enable-vout-drm,,libdrm" +PACKAGECONFIG[vout-egl] = "--enable-vout-egl,,virtual/egl" + +# other configuration options +PACKAGECONFIG[mips32r2] = ",--disable-mipsdsp --disable-mipsdspr2" +PACKAGECONFIG[pic] = "--enable-pic" +PACKAGECONFIG[pthreads] = "--enable-pthreads,--disable-pthreads" +PACKAGECONFIG[shared] = "--enable-shared" +PACKAGECONFIG[strip] = ",--disable-stripping" + +# Check codecs that require --enable-nonfree +USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'openssl' ], 'yes', '', d)}" + +def cpu(d): + for arg in (d.getVar('TUNE_CCARGS') or '').split(): + if arg.startswith('-mcpu='): + return arg[6:] + return 'generic' + +EXTRA_OECONF = " \ + ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \ + \ + --cross-prefix=${TARGET_PREFIX} \ + \ + --ld="${CCLD}" \ + --cc="${CC}" \ + --cxx="${CXX}" \ + --arch=${TARGET_ARCH} \ + --target-os="linux" \ + --enable-cross-compile \ + --extra-cflags="${CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \ + --extra-ldflags="${LDFLAGS}" \ + --sysroot="${STAGING_DIR_TARGET}" \ + ${EXTRA_FFCONF} \ + --libdir=${libdir} \ + --shlibdir=${libdir} \ + --datadir=${datadir}/ffmpeg \ + --cpu=${@cpu(d)} \ + --pkg-config=pkg-config \ +" +EXTRA_OECONF:append:linux-gnux32 = " --disable-asm" + +# gold crashes on x86, another solution is to --disable-asm but thats more hacky +# ld.gold: internal error in relocate_section, at ../../gold/i386.cc:3684 +LDFLAGS:append:x86 = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" +EXTRA_OEMAKE = "V=1" + +do_configure() { + ${S}/configure ${EXTRA_OECONF} +} + +# patch out build host paths for reproducibility +do_compile:prepend:class-target() { + sed -i -e "s,${WORKDIR},,g" ${B}/config.h +} + +PACKAGES =+ "libavcodec \ + libavdevice \ + libavfilter \ + libavformat \ + libavresample \ + libavutil \ + libpostproc \ + libswresample \ + libswscale" + +FILES:${PN}:append = " /usr/share/ffmpeg" +FILES:libavcodec = "${libdir}/libavcodec${SOLIBS}" +FILES:libavdevice = "${libdir}/libavdevice${SOLIBS}" +FILES:libavfilter = "${libdir}/libavfilter${SOLIBS}" +FILES:libavformat = "${libdir}/libavformat${SOLIBS}" +FILES:libavresample = "${libdir}/libavresample${SOLIBS}" +FILES:libavutil = "${libdir}/libavutil${SOLIBS}" +FILES:libpostproc = "${libdir}/libpostproc${SOLIBS}" +FILES:libswresample = "${libdir}/libswresample${SOLIBS}" +FILES:libswscale = "${libdir}/libswscale${SOLIBS}" +# ffmpeg disables PIC on some platforms (e.g. x86-32) +INSANE_SKIP:${MLPREFIX}libavcodec = "textrel" +INSANE_SKIP:${MLPREFIX}libavdevice = "textrel" +INSANE_SKIP:${MLPREFIX}libavfilter = "textrel" +INSANE_SKIP:${MLPREFIX}libavformat = "textrel" +INSANE_SKIP:${MLPREFIX}libavutil = "textrel" +INSANE_SKIP:${MLPREFIX}libavresample = "textrel" +INSANE_SKIP:${MLPREFIX}libswscale = "textrel" +INSANE_SKIP:${MLPREFIX}libswresample = "textrel" +INSANE_SKIP:${MLPREFIX}libpostproc = "textrel" + +# Only enable it for rpi class of machines +COMPATIBLE_HOST = "null" +COMPATIBLE_HOST:rpi = "(.*)" + diff --git a/meta-security/dynamic-layers/meta-python/recipes-security/mfa/python3-privacyidea_3.7.3.bb b/meta-security/dynamic-layers/meta-python/recipes-security/mfa/python3-privacyidea_3.7.3.bb deleted file mode 100644 index 97fa8f9a8c..0000000000 --- a/meta-security/dynamic-layers/meta-python/recipes-security/mfa/python3-privacyidea_3.7.3.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "identity, multifactor authentication (OTP), authorization, audit" -DESCRIPTION = "privacyIDEA is an open solution for strong two-factor authentication like OTP tokens, SMS, smartphones or SSH keys. Using privacyIDEA you can enhance your existing applications like local login (PAM, Windows Credential Provider), VPN, remote access, SSH connections, access to web sites or web portals with a second factor during authentication. Thus boosting the security of your existing applications." - -HOMEPAGE = "http://www.privacyidea.org/" -LICENSE = "AGPL-3.0-only" -LIC_FILES_CHKSUM = "file://LICENSE;md5=c0acfa7a8a03b718abee9135bc1a1c55" - -PYPI_PACKAGE = "privacyIDEA" -SRC_URI[sha256sum] = "7b5725d1af004fe3f68d16c2b14be5a3d61c4d265d18cb7d50a9013da0df42d2" - -inherit pypi setuptools3 - -do_install:append () { - rm -fr ${D}${libdir}/${PYTHON_DIR}/site-packages/tests -} - -USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM:${PN} = "--system privacyidea" -USERADD_PARAM:${PN} = "--system -g privacyidea -o -r -d /opt/${BPN} \ - --shell /bin/false privacyidea" - -FILES:${PN} += " ${prefix}/etc/privacyidea/* ${prefix}/lib/privacyidea/*" - -RDEPENDS:${PN} += " bash perl freeradius-mysql freeradius-utils" - -RDEPENDS:${PN} += "python3 python3-alembic python3-babel python3-bcrypt" -RDEPENDS:${PN} += "python3-beautifulsoup4 python3-cbor2 python3-certifi python3-cffi python3-chardet" -RDEPENDS:${PN} += "python3-click python3-configobj python3-croniter python3-cryptography python3-defusedxml" -RDEPENDS:${PN} += "python3-ecdsa python3-flask python3-flask-babel python3-flask-migrate" -RDEPENDS:${PN} += "python3-flask-script python3-flask-sqlalchemy python3-flask-versioned" -RDEPENDS:${PN} += "python3-future python3-httplib2 python3-huey python3-idna python3-ipaddress" -RDEPENDS:${PN} += "python3-itsdangerous python3-jinja2 python3-ldap python3-lxml python3-mako" -RDEPENDS:${PN} += "python3-markupsafe python3-netaddr python3-oauth2client python3-passlib python3-pillow" -RDEPENDS:${PN} += "python3-pyasn1 python3-pyasn1-modules python3-pycparser python3-pyjwt python3-pymysql" -RDEPENDS:${PN} += "python3-pyopenssl python3-pyrad python3-dateutil python3-editor python3-gnupg" -RDEPENDS:${PN} += "python3-pytz python3-pyyaml python3-qrcode python3-redis python3-requests python3-rsa" -RDEPENDS:${PN} += "python3-six python3-smpplib python3-soupsieve python3-soupsieve " -RDEPENDS:${PN} += "python3-sqlalchemy python3-sqlsoup python3-urllib3 python3-werkzeug" diff --git a/meta-security/dynamic-layers/meta-python/recipes-security/mfa/python3-privacyidea_3.7.4.bb b/meta-security/dynamic-layers/meta-python/recipes-security/mfa/python3-privacyidea_3.7.4.bb new file mode 100644 index 0000000000..b6a0e06314 --- /dev/null +++ b/meta-security/dynamic-layers/meta-python/recipes-security/mfa/python3-privacyidea_3.7.4.bb @@ -0,0 +1,38 @@ +SUMMARY = "identity, multifactor authentication (OTP), authorization, audit" +DESCRIPTION = "privacyIDEA is an open solution for strong two-factor authentication like OTP tokens, SMS, smartphones or SSH keys. Using privacyIDEA you can enhance your existing applications like local login (PAM, Windows Credential Provider), VPN, remote access, SSH connections, access to web sites or web portals with a second factor during authentication. Thus boosting the security of your existing applications." + +HOMEPAGE = "http://www.privacyidea.org/" +LICENSE = "AGPL-3.0-only" +LIC_FILES_CHKSUM = "file://LICENSE;md5=c0acfa7a8a03b718abee9135bc1a1c55" + +PYPI_PACKAGE = "privacyIDEA" +SRC_URI[sha256sum] = "187b6aa61f8b27e1972512123c8295ea6d2501b3d90d975d4603e753f146b50c" + +inherit pypi setuptools3 + +do_install:append () { + rm -fr ${D}${libdir}/${PYTHON_DIR}/site-packages/tests +} + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM:${PN} = "--system privacyidea" +USERADD_PARAM:${PN} = "--system -g privacyidea -o -r -d /opt/${BPN} \ + --shell /bin/false privacyidea" + +FILES:${PN} += " ${prefix}/etc/privacyidea/* ${prefix}/lib/privacyidea/*" + +RDEPENDS:${PN} += " bash perl freeradius-mysql freeradius-utils" + +RDEPENDS:${PN} += "python3 python3-alembic python3-babel python3-bcrypt" +RDEPENDS:${PN} += "python3-beautifulsoup4 python3-cbor2 python3-certifi python3-cffi python3-chardet" +RDEPENDS:${PN} += "python3-click python3-configobj python3-croniter python3-cryptography python3-defusedxml" +RDEPENDS:${PN} += "python3-ecdsa python3-flask python3-flask-babel python3-flask-migrate" +RDEPENDS:${PN} += "python3-flask-script python3-flask-sqlalchemy python3-flask-versioned" +RDEPENDS:${PN} += "python3-future python3-httplib2 python3-huey python3-idna python3-ipaddress" +RDEPENDS:${PN} += "python3-itsdangerous python3-jinja2 python3-ldap python3-lxml python3-mako" +RDEPENDS:${PN} += "python3-markupsafe python3-netaddr python3-oauth2client python3-passlib python3-pillow" +RDEPENDS:${PN} += "python3-pyasn1 python3-pyasn1-modules python3-pycparser python3-pyjwt python3-pymysql" +RDEPENDS:${PN} += "python3-pyopenssl python3-pyrad python3-dateutil python3-editor python3-gnupg" +RDEPENDS:${PN} += "python3-pytz python3-pyyaml python3-qrcode python3-redis python3-requests python3-rsa" +RDEPENDS:${PN} += "python3-six python3-smpplib python3-soupsieve python3-soupsieve " +RDEPENDS:${PN} += "python3-sqlalchemy python3-sqlsoup python3-urllib3 python3-werkzeug" diff --git a/meta-security/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb b/meta-security/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb deleted file mode 100644 index b82fb650d0..0000000000 --- a/meta-security/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "Tools for TPM2." -DESCRIPTION = "tpm2-tools" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=a846608d090aa64494c45fc147cc12e3" -SECTION = "tpm" - -DEPENDS = "tpm2-abrmd tpm2-tss openssl curl autoconf-archive" - -SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz" - -SRC_URI[sha256sum] = "c0b402f6a7b3456e8eb2445211e2d41c46c7e769e05fe4d8909ff64119f7a630" - -UPSTREAM_CHECK_URI = "https://github.com/tpm2-software/${BPN}/releases" - -inherit autotools pkgconfig bash-completion - -do_configure:prepend() { - # do not extract the version number from git - sed -i -e 's/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${PV}/' ${S}/configure.ac -} - -# need tss-esys -RDEPENDS:${PN} = "libtss2 tpm2-abrmd" diff --git a/meta-security/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.3.bb b/meta-security/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.3.bb new file mode 100644 index 0000000000..53d5abb07e --- /dev/null +++ b/meta-security/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.3.bb @@ -0,0 +1,23 @@ +SUMMARY = "Tools for TPM2." +DESCRIPTION = "tpm2-tools" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://docs/LICENSE;md5=a846608d090aa64494c45fc147cc12e3" +SECTION = "tpm" + +DEPENDS = "tpm2-abrmd tpm2-tss openssl curl autoconf-archive" + +SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz" + +SRC_URI[sha256sum] = "e7ce2fd36ef5cdbd7872d823a442e8754a4f0ca7c54b60efcdb75c12a1f98f8f" + +UPSTREAM_CHECK_URI = "https://github.com/tpm2-software/${BPN}/releases" + +inherit autotools pkgconfig bash-completion + +do_configure:prepend() { + # do not extract the version number from git + sed -i -e 's/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${PV}/' ${S}/configure.ac +} + +# need tss-esys +RDEPENDS:${PN} = "libtss2 tpm2-abrmd" diff --git a/meta-security/recipes-security/bubblewrap/bubblewrap_0.6.2.bb b/meta-security/recipes-security/bubblewrap/bubblewrap_0.6.2.bb deleted file mode 100644 index 921defda9e..0000000000 --- a/meta-security/recipes-security/bubblewrap/bubblewrap_0.6.2.bb +++ /dev/null @@ -1,23 +0,0 @@ -DESCRIPTION = "Unprivileged sandboxing tool" -HOMEPAGE = "https://github.com/containers/bubblewrap" -LICENSE = "LGPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" - -DEPENDS = "libcap" - -SRC_URI = "https://github.com/containers/${BPN}/releases/download/v${PV}/${BP}.tar.xz" -SRC_URI[sha256sum] = "8a0ec802d1b3e956c5bb0a40a81c9ce0b055a31bf30a8efa547433603b8af20b" - -UPSTREAM_CHECK_URI = "https://github.com/containers/bubblewrap/releases" -UPSTREAM_CHECK_REGEX = "bubblewrap-(?P\d+(\.\d+)+)\.tar" - -inherit autotools bash-completion manpages pkgconfig - -PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" -PACKAGECONFIG[manpages] = "--enable-man,--disable-man,libxslt-native docbook-xsl-stylesheets-native xmlto-native" -PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux" -PACKAGECONFIG[setuid] = "--with-priv-mode=setuid,--with-priv-mode=none" - -PACKAGES += "${PN}-zsh-completion" - -FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions" diff --git a/meta-security/recipes-security/bubblewrap/bubblewrap_0.7.0.bb b/meta-security/recipes-security/bubblewrap/bubblewrap_0.7.0.bb new file mode 100644 index 0000000000..a48b012520 --- /dev/null +++ b/meta-security/recipes-security/bubblewrap/bubblewrap_0.7.0.bb @@ -0,0 +1,22 @@ +DESCRIPTION = "Unprivileged sandboxing tool" +HOMEPAGE = "https://github.com/containers/bubblewrap" +LICENSE = "LGPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" + +DEPENDS = "libcap" + +SRC_URI = "https://github.com/containers/${BPN}/releases/download/v${PV}/${BP}.tar.xz" +SRC_URI[sha256sum] = "764ab7100bd037ea53d440d362e099d7a425966bc62d1f00ab26b8fbb882a9dc" + +inherit autotools bash-completion github-releases manpages pkgconfig + +GITHUB_BASE_URI = "https://github.com/containers/${BPN}/releases/" + +PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" +PACKAGECONFIG[manpages] = "--enable-man,--disable-man,libxslt-native docbook-xsl-stylesheets-native xmlto-native" +PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux" +PACKAGECONFIG[setuid] = "--with-priv-mode=setuid,--with-priv-mode=none" + +PACKAGES += "${PN}-zsh-completion" + +FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions" diff --git a/meta-security/recipes-security/chipsec/chipsec_1.8.8.bb b/meta-security/recipes-security/chipsec/chipsec_1.8.8.bb deleted file mode 100644 index 858ece5a06..0000000000 --- a/meta-security/recipes-security/chipsec/chipsec_1.8.8.bb +++ /dev/null @@ -1,34 +0,0 @@ -SUMMARY = "CHIPSEC: Platform Security Assessment Framework" - -DESCRIPTION = "CHIPSEC is a framework for analyzing the security \ - of PC platforms including hardware, system firmware \ - (BIOS/UEFI), and platform components." - -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=bc2d1f9b427be5fb63f6af9da56f7c5d" - -DEPENDS = "virtual/kernel nasm-native" - -SRC_URI = "git://github.com/chipsec/chipsec.git;branch=main;protocol=https" -SRCREV = "fd1a98688978fd4b8ca77b512a72eae49c3beffa" - -S = "${WORKDIR}/git" - -inherit module setuptools3 - -EXTRA_OEMAKE = "CC='${CC}' LDFLAGS='${LDFLAGS}' CFLAGS='${CFLAGS}'" - -do_compile:append() { - cd ${S}/drivers/linux - oe_runmake KSRC=${STAGING_KERNEL_BUILDDIR} -} - -do_install:append() { - install -m 0644 ${S}/drivers/linux/chipsec.ko ${D}${PYTHON_SITEPACKAGES_DIR}/chipsec/helper/linux -} - -COMPATIBLE_HOST = "(i.86|x86_64).*-linux" - -FILES:${PN} += "${exec_prefix}" - -RDEPENDS:${PN} = "python3 python3-modules" diff --git a/meta-security/recipes-security/chipsec/chipsec_1.9.1.bb b/meta-security/recipes-security/chipsec/chipsec_1.9.1.bb new file mode 100644 index 0000000000..9fbdaa7a7c --- /dev/null +++ b/meta-security/recipes-security/chipsec/chipsec_1.9.1.bb @@ -0,0 +1,34 @@ +SUMMARY = "CHIPSEC: Platform Security Assessment Framework" + +DESCRIPTION = "CHIPSEC is a framework for analyzing the security \ + of PC platforms including hardware, system firmware \ + (BIOS/UEFI), and platform components." + +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=bc2d1f9b427be5fb63f6af9da56f7c5d" + +DEPENDS = "virtual/kernel nasm-native" + +SRC_URI = "git://github.com/chipsec/chipsec.git;branch=main;protocol=https" +SRCREV = "d8c2a606bf440c32196c6289a7a458f3ae3107cc" + +S = "${WORKDIR}/git" + +inherit module setuptools3 + +EXTRA_OEMAKE = "CC='${CC}' LDFLAGS='${LDFLAGS}' CFLAGS='${CFLAGS}'" + +do_compile:append() { + cd ${S}/drivers/linux + oe_runmake KSRC=${STAGING_KERNEL_BUILDDIR} +} + +do_install:append() { + install -m 0644 ${S}/drivers/linux/chipsec.ko ${D}${PYTHON_SITEPACKAGES_DIR}/chipsec/helper/linux +} + +COMPATIBLE_HOST = "(i.86|x86_64).*-linux" + +FILES:${PN} += "${exec_prefix}" + +RDEPENDS:${PN} = "python3 python3-modules" diff --git a/poky/.gitignore b/poky/.gitignore index 4bfe022dcd..8f48d452da 100644 --- a/poky/.gitignore +++ b/poky/.gitignore @@ -31,4 +31,8 @@ pull-*/ bitbake/lib/toaster/contrib/tts/backlog.txt bitbake/lib/toaster/contrib/tts/log/* bitbake/lib/toaster/contrib/tts/.cache/* -bitbake/lib/bb/tests/runqueue-tests/bitbake-cookerdaemon.log \ No newline at end of file +bitbake/lib/bb/tests/runqueue-tests/bitbake-cookerdaemon.log +_toaster_clones/ +downloads/ +sstate-cache/ +toaster.sqlite diff --git a/poky/bitbake/README b/poky/bitbake/README index 80a97118b9..a5f5c1b64f 100644 --- a/poky/bitbake/README +++ b/poky/bitbake/README @@ -13,6 +13,8 @@ Bitbake plain documentation can be found under the doc directory or its integrat html version at the Yocto Project website: https://docs.yoctoproject.org +Bitbake requires Python version 3.8 or newer. + Contributing ------------ @@ -34,10 +36,21 @@ Source code: https://git.openembedded.org/bitbake/ -Testing: +Testing +------- Bitbake has a testsuite located in lib/bb/tests/ whichs aim to try and prevent regressions. You can run this with "bitbake-selftest". In particular the fetcher is well covered since it has so many corner cases. The datastore has many tests too. Testing with the testsuite is recommended before submitting patches, particularly to the fetcher and datastore. We also appreciate new test cases and may require them for more obscure issues. + +To run the tests "zstd" and "git" must be installed. Git must be correctly configured, in +particular the user.email and user.name values must be set. + +The assumption is made that this testsuite is run from an initialized OpenEmbedded build +environment (i.e. `source oe-init-build-env` is used). If this is not the case, run the +testsuite as follows: + + export PATH=$(pwd)/bin:$PATH + bin/bitbake-selftest diff --git a/poky/bitbake/bin/bitbake b/poky/bitbake/bin/bitbake index 7cbf88f480..f869eb4854 100755 --- a/poky/bitbake/bin/bitbake +++ b/poky/bitbake/bin/bitbake @@ -25,8 +25,7 @@ except RuntimeError as exc: from bb import cookerdata from bb.main import bitbake_main, BitBakeConfigParameters, BBMainException -if sys.getfilesystemencoding() != "utf-8": - sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\nPython can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.") +bb.utils.check_system_locale() __version__ = "2.2.0" diff --git a/poky/bitbake/bin/bitbake-server b/poky/bitbake/bin/bitbake-server index f53f88b6b0..454a3919aa 100755 --- a/poky/bitbake/bin/bitbake-server +++ b/poky/bitbake/bin/bitbake-server @@ -12,11 +12,12 @@ warnings.simplefilter("default") import logging sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) -if sys.getfilesystemencoding() != "utf-8": - sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\nPython can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.") +import bb + +bb.utils.check_system_locale() # Users shouldn't be running this code directly -if len(sys.argv) != 10 or not sys.argv[1].startswith("decafbad"): +if len(sys.argv) != 11 or not sys.argv[1].startswith("decafbad"): print("bitbake-server is meant for internal execution by bitbake itself, please don't use it standalone.") sys.exit(1) @@ -28,7 +29,8 @@ logfile = sys.argv[4] lockname = sys.argv[5] sockname = sys.argv[6] timeout = float(sys.argv[7]) -xmlrpcinterface = (sys.argv[8], int(sys.argv[9])) +profile = bool(int(sys.argv[8])) +xmlrpcinterface = (sys.argv[9], int(sys.argv[10])) if xmlrpcinterface[0] == "None": xmlrpcinterface = (None, xmlrpcinterface[1]) @@ -49,5 +51,5 @@ logger = logging.getLogger("BitBake") handler = bb.event.LogHandler() logger.addHandler(handler) -bb.server.process.execServer(lockfd, readypipeinfd, lockname, sockname, timeout, xmlrpcinterface) +bb.server.process.execServer(lockfd, readypipeinfd, lockname, sockname, timeout, xmlrpcinterface, profile) diff --git a/poky/bitbake/bin/bitbake-worker b/poky/bitbake/bin/bitbake-worker index 7be39370b3..a3ea5d9618 100755 --- a/poky/bitbake/bin/bitbake-worker +++ b/poky/bitbake/bin/bitbake-worker @@ -24,8 +24,7 @@ import subprocess from multiprocessing import Lock from threading import Thread -if sys.getfilesystemencoding() != "utf-8": - sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\nPython can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.") +bb.utils.check_system_locale() # Users shouldn't be running this code directly if len(sys.argv) != 2 or not sys.argv[1].startswith("decafbad"): @@ -122,11 +121,10 @@ def worker_child_fire(event, d): data = b"" + pickle.dumps(event) + b"" try: - worker_pipe_lock.acquire() - while(len(data)): - written = worker_pipe.write(data) - data = data[written:] - worker_pipe_lock.release() + with bb.utils.lock_timeout(worker_pipe_lock): + while(len(data)): + written = worker_pipe.write(data) + data = data[written:] except IOError: sigterm_handler(None, None) raise @@ -145,7 +143,16 @@ def sigterm_handler(signum, frame): os.killpg(0, signal.SIGTERM) sys.exit() -def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskhash, unihash, appends, taskdepdata, extraconfigdata, quieterrors=False, dry_run_exec=False): +def fork_off_task(cfg, data, databuilder, workerdata, extraconfigdata, runtask): + + fn = runtask['fn'] + task = runtask['task'] + taskname = runtask['taskname'] + taskhash = runtask['taskhash'] + unihash = runtask['unihash'] + appends = runtask['appends'] + taskdepdata = runtask['taskdepdata'] + quieterrors = runtask['quieterrors'] # We need to setup the environment BEFORE the fork, since # a fork() or exec*() activates PSEUDO... @@ -157,8 +164,7 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha uid = os.getuid() gid = os.getgid() - - taskdep = workerdata["taskdeps"][fn] + taskdep = runtask['taskdep'] if 'umask' in taskdep and taskname in taskdep['umask']: umask = taskdep['umask'][taskname] elif workerdata["umask"]: @@ -170,24 +176,24 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha except TypeError: pass - dry_run = cfg.dry_run or dry_run_exec + dry_run = cfg.dry_run or runtask['dry_run'] # We can't use the fakeroot environment in a dry run as it possibly hasn't been built if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not dry_run: fakeroot = True - envvars = (workerdata["fakerootenv"][fn] or "").split() + envvars = (runtask['fakerootenv'] or "").split() for key, value in (var.split('=') for var in envvars): envbackup[key] = os.environ.get(key) os.environ[key] = value fakeenv[key] = value - fakedirs = (workerdata["fakerootdirs"][fn] or "").split() + fakedirs = (runtask['fakerootdirs'] or "").split() for p in fakedirs: bb.utils.mkdirhier(p) logger.debug2('Running %s:%s under fakeroot, fakedirs: %s' % (fn, taskname, ', '.join(fakedirs))) else: - envvars = (workerdata["fakerootnoenv"][fn] or "").split() + envvars = (runtask['fakerootnoenv'] or "").split() for key, value in (var.split('=') for var in envvars): envbackup[key] = os.environ.get(key) os.environ[key] = value @@ -238,7 +244,6 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha os.umask(umask) try: - bb_cache = bb.cache.NoCache(databuilder) (realfn, virtual, mc) = bb.cache.virtualfn2realfn(fn) the_data = databuilder.mcdata[mc] the_data.setVar("BB_WORKERCONTEXT", "1") @@ -257,9 +262,10 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha bb.parse.siggen.set_taskhashes(workerdata["newhashes"]) ret = 0 - the_data = bb_cache.loadDataFull(fn, appends) + the_data = databuilder.parseRecipe(fn, appends) the_data.setVar('BB_TASKHASH', taskhash) the_data.setVar('BB_UNIHASH', unihash) + bb.parse.siggen.setup_datacache_from_datastore(fn, the_data) bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", ""))) @@ -475,11 +481,15 @@ class BitbakeWorker(object): sys.exit(0) def handle_runtask(self, data): - fn, task, taskname, taskhash, unihash, quieterrors, appends, taskdepdata, dry_run_exec = pickle.loads(data) - workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname)) + runtask = pickle.loads(data) - pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, fn, task, taskname, taskhash, unihash, appends, taskdepdata, self.extraconfigdata, quieterrors, dry_run_exec) + fn = runtask['fn'] + task = runtask['task'] + taskname = runtask['taskname'] + + workerlog_write("Handling runtask %s %s %s\n" % (task, fn, taskname)) + pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, self.extraconfigdata, runtask) self.build_pids[pid] = task self.build_pipes[pid] = runQueueWorkerPipe(pipein, pipeout) diff --git a/poky/bitbake/doc/_templates/footer.html b/poky/bitbake/doc/_templates/footer.html new file mode 100644 index 0000000000..1398f20d7e --- /dev/null +++ b/poky/bitbake/doc/_templates/footer.html @@ -0,0 +1,9 @@ +

+
+
+

© Copyright {{ copyright }} +
Last updated on {{ last_updated }} from the bitbake git repository. +

+
+
+ diff --git a/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst b/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst index 7a22e96edf..f6ebf7ba6a 100644 --- a/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst +++ b/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst @@ -552,8 +552,8 @@ through dependency chains are more complex and are generally accomplished with a Python function. The code in ``meta/lib/oe/sstatesig.py`` shows two examples of this and also illustrates how you can insert your own policy into the system if so -desired. This file defines the two basic signature generators -OpenEmbedded-Core uses: "OEBasic" and "OEBasicHash". By default, there +desired. This file defines the basic signature generator +OpenEmbedded-Core uses: "OEBasicHash". By default, there is a dummy "noop" signature handler enabled in BitBake. This means that behavior is unchanged from previous versions. ``OE-Core`` uses the "OEBasicHash" signature handler by default through this setting in the @@ -561,14 +561,13 @@ behavior is unchanged from previous versions. ``OE-Core`` uses the BB_SIGNATURE_HANDLER ?= "OEBasicHash" -The "OEBasicHash" :term:`BB_SIGNATURE_HANDLER` is the same as the "OEBasic" -version but adds the task hash to the stamp files. This results in any -metadata change that changes the task hash, automatically causing the -task to be run again. This removes the need to bump -:term:`PR` values, and changes to metadata automatically -ripple across the build. +The main feature of the "OEBasicHash" :term:`BB_SIGNATURE_HANDLER` is that +it adds the task hash to the stamp files. Thanks to this, any metadata +change will change the task hash, automatically causing the task to be run +again. This removes the need to bump :term:`PR` values, and changes to +metadata automatically ripple across the build. -It is also worth noting that the end result of these signature +It is also worth noting that the end result of signature generators is to make some dependency and hash information available to the build. This information includes: diff --git a/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst index 9c269ca837..c061bd70ea 100644 --- a/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +++ b/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst @@ -424,8 +424,8 @@ This fetcher supports the following parameters: - *"nobranch":* Tells the fetcher to not check the SHA validation for the branch when set to "1". The default is "0". Set this option for - the recipe that refers to the commit that is valid for a tag instead - of the branch. + the recipe that refers to the commit that is valid for any namespace + (branch, tag, ...) instead of the branch. - *"bareclone":* Tells the fetcher to clone a bare clone into the destination directory without checking out a working tree. Only the @@ -740,7 +740,7 @@ Here is an example URL with both fetchers:: " See :yocto_docs:`Creating Node Package Manager (NPM) Packages -` +` in the Yocto Project manual for details about using :yocto_docs:`devtool ` to automatically create a recipe from an NPM URL. @@ -777,7 +777,7 @@ the package which has such dependencies, for example:: Such a file can automatically be generated using :yocto_docs:`devtool ` as described in the :yocto_docs:`Creating Node Package Manager (NPM) Packages -` +` section of the Yocto Project. Other Fetchers diff --git a/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst index b7c3d8091f..deb7afad43 100644 --- a/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +++ b/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst @@ -319,6 +319,10 @@ The variable ``D`` becomes "dvaladditional data". You must control all spacing when you use the override syntax. +.. note:: + + The overrides are applied in this order, ":append", ":prepend", ":remove". + It is also possible to append and prepend to shell functions and BitBake-style Python functions. See the ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:shell functions`" and ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:bitbake-style python functions`" sections for examples. @@ -352,6 +356,28 @@ The variable ``FOO`` becomes Like ":append" and ":prepend", ":remove" is applied at variable expansion time. +.. note:: + + The overrides are applied in this order, ":append", ":prepend", ":remove". + This implies it is not possible to re-append previously removed strings. + However, one can undo a ":remove" by using an intermediate variable whose + content is passed to the ":remove" so that modifying the intermediate + variable equals to keeping the string in:: + + FOOREMOVE = "123 456 789" + FOO:remove = "${FOOREMOVE}" + ... + FOOREMOVE = "123 789" + + This expands to ``FOO:remove = "123 789"``. + +.. note:: + + Override application order may not match variable parse history, i.e. + the output of ``bitbake -e`` may contain ":remove" before ":append", + but the result will be removed string, because ":remove" is handled + last. + Override Style Operation Advantages ----------------------------------- @@ -1935,7 +1961,7 @@ Testing and Debugging BitBake Python code The OpenEmbedded build system implements a convenient ``pydevshell`` target which you can use to access the BitBake datastore and experiment with your own Python code. See :yocto_docs:`Using a Python Development Shell -` in the Yocto +` in the Yocto Project manual for details. Task Checksums and Setscene diff --git a/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst b/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst index 3522d2b77b..09d09a8d9e 100644 --- a/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +++ b/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst @@ -40,8 +40,7 @@ overview of their function and contents. Azure Storage Shared Access Signature, when using the :ref:`Azure Storage fetcher ` This variable can be defined to be used by the fetcher to authenticate - and gain access to non-public artifacts. - :: + and gain access to non-public artifacts:: AZ_SAS = ""se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=&sig="" diff --git a/poky/bitbake/lib/bb/__init__.py b/poky/bitbake/lib/bb/__init__.py index 99cb5a0101..4e90964173 100644 --- a/poky/bitbake/lib/bb/__init__.py +++ b/poky/bitbake/lib/bb/__init__.py @@ -12,8 +12,8 @@ __version__ = "2.2.0" import sys -if sys.version_info < (3, 6, 0): - raise RuntimeError("Sorry, python 3.6.0 or later is required for this version of bitbake") +if sys.version_info < (3, 8, 0): + raise RuntimeError("Sorry, python 3.8.0 or later is required for this version of bitbake") class BBHandledException(Exception): diff --git a/poky/bitbake/lib/bb/build.py b/poky/bitbake/lib/bb/build.py index db706d0a3a..5a1727116a 100644 --- a/poky/bitbake/lib/bb/build.py +++ b/poky/bitbake/lib/bb/build.py @@ -772,44 +772,7 @@ def exec_task(fn, task, d, profile = False): event.fire(failedevent, d) return 1 -def stamp_internal(taskname, d, file_name, baseonly=False, noextra=False): - """ - Internal stamp helper function - Makes sure the stamp directory exists - Returns the stamp path+filename - - In the bitbake core, d can be a CacheData and file_name will be set. - When called in task context, d will be a data store, file_name will not be set - """ - taskflagname = taskname - if taskname.endswith("_setscene") and taskname != "do_setscene": - taskflagname = taskname.replace("_setscene", "") - - if file_name: - stamp = d.stamp[file_name] - extrainfo = d.stamp_extrainfo[file_name].get(taskflagname) or "" - else: - stamp = d.getVar('STAMP') - file_name = d.getVar('BB_FILENAME') - extrainfo = d.getVarFlag(taskflagname, 'stamp-extra-info') or "" - - if baseonly: - return stamp - if noextra: - extrainfo = "" - - if not stamp: - return - - stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo) - - stampdir = os.path.dirname(stamp) - if cached_mtime_noerror(stampdir) == 0: - bb.utils.mkdirhier(stampdir) - - return stamp - -def stamp_cleanmask_internal(taskname, d, file_name): +def _get_cleanmask(taskname, mcfn): """ Internal stamp helper function to generate stamp cleaning mask Returns the stamp path+filename @@ -817,27 +780,14 @@ def stamp_cleanmask_internal(taskname, d, file_name): In the bitbake core, d can be a CacheData and file_name will be set. When called in task context, d will be a data store, file_name will not be set """ - taskflagname = taskname - if taskname.endswith("_setscene") and taskname != "do_setscene": - taskflagname = taskname.replace("_setscene", "") - - if file_name: - stamp = d.stampclean[file_name] - extrainfo = d.stamp_extrainfo[file_name].get(taskflagname) or "" - else: - stamp = d.getVar('STAMPCLEAN') - file_name = d.getVar('BB_FILENAME') - extrainfo = d.getVarFlag(taskflagname, 'stamp-extra-info') or "" - - if not stamp: - return [] - - cleanmask = bb.parse.siggen.stampcleanmask(stamp, file_name, taskname, extrainfo) - - return [cleanmask, cleanmask.replace(taskflagname, taskflagname + "_setscene")] - -def clean_stamp(task, d, file_name = None): - cleanmask = stamp_cleanmask_internal(task, d, file_name) + cleanmask = bb.parse.siggen.stampcleanmask_mcfn(taskname, mcfn) + taskflagname = taskname.replace("_setscene", "") + if cleanmask: + return [cleanmask, cleanmask.replace(taskflagname, taskflagname + "_setscene")] + return [] + +def clean_stamp_mcfn(task, mcfn): + cleanmask = _get_cleanmask(task, mcfn) for mask in cleanmask: for name in glob.glob(mask): # Preserve sigdata files in the stamps directory @@ -847,33 +797,46 @@ def clean_stamp(task, d, file_name = None): if name.endswith('.taint'): continue os.unlink(name) - return -def make_stamp(task, d, file_name = None): +def clean_stamp(task, d): + mcfn = d.getVar('BB_FILENAME') + clean_stamp_mcfn(task, mcfn) + +def make_stamp_mcfn(task, mcfn): + + basestamp = bb.parse.siggen.stampfile_mcfn(task, mcfn) + + stampdir = os.path.dirname(basestamp) + if cached_mtime_noerror(stampdir) == 0: + bb.utils.mkdirhier(stampdir) + + clean_stamp_mcfn(task, mcfn) + + # Remove the file and recreate to force timestamp + # change on broken NFS filesystems + if basestamp: + bb.utils.remove(basestamp) + open(basestamp, "w").close() + +def make_stamp(task, d): """ Creates/updates a stamp for a given task - (d can be a data dict or dataCache) """ - clean_stamp(task, d, file_name) + mcfn = d.getVar('BB_FILENAME') - stamp = stamp_internal(task, d, file_name) - # Remove the file and recreate to force timestamp - # change on broken NFS filesystems - if stamp: - bb.utils.remove(stamp) - open(stamp, "w").close() + make_stamp_mcfn(task, mcfn) # If we're in task context, write out a signature file for each task # as it completes - if not task.endswith("_setscene") and task != "do_setscene" and not file_name: - stampbase = stamp_internal(task, d, None, True) - file_name = d.getVar('BB_FILENAME') - bb.parse.siggen.dump_sigtask(file_name, task, stampbase, True) - -def find_stale_stamps(task, d, file_name=None): - current = stamp_internal(task, d, file_name) - current2 = stamp_internal(task + "_setscene", d, file_name) - cleanmask = stamp_cleanmask_internal(task, d, file_name) + if not task.endswith("_setscene"): + stampbase = bb.parse.siggen.stampfile_base(mcfn) + bb.parse.siggen.dump_sigtask(mcfn, task, stampbase, True) + + +def find_stale_stamps(task, mcfn): + current = bb.parse.siggen.stampfile_mcfn(task, mcfn) + current2 = bb.parse.siggen.stampfile_mcfn(task + "_setscene", mcfn) + cleanmask = _get_cleanmask(task, mcfn) found = [] for mask in cleanmask: for name in glob.glob(mask): @@ -887,38 +850,14 @@ def find_stale_stamps(task, d, file_name=None): found.append(name) return found -def del_stamp(task, d, file_name = None): - """ - Removes a stamp for a given task - (d can be a data dict or dataCache) - """ - stamp = stamp_internal(task, d, file_name) - bb.utils.remove(stamp) - -def write_taint(task, d, file_name = None): +def write_taint(task, d): """ Creates a "taint" file which will force the specified task and its dependents to be re-run the next time by influencing the value of its taskhash. - (d can be a data dict or dataCache) - """ - import uuid - if file_name: - taintfn = d.stamp[file_name] + '.' + task + '.taint' - else: - taintfn = d.getVar('STAMP') + '.' + task + '.taint' - bb.utils.mkdirhier(os.path.dirname(taintfn)) - # The specific content of the taint file is not really important, - # we just need it to be random, so a random UUID is used - with open(taintfn, 'w') as taintf: - taintf.write(str(uuid.uuid4())) - -def stampfile(taskname, d, file_name = None, noextra=False): - """ - Return the stamp for a given task - (d can be a data dict or dataCache) """ - return stamp_internal(taskname, d, file_name, noextra=noextra) + mcfn = d.getVar('BB_FILENAME') + bb.parse.siggen.invalidate_task(task, mcfn) def add_tasks(tasklist, d): task_deps = d.getVar('_task_deps', False) diff --git a/poky/bitbake/lib/bb/cache.py b/poky/bitbake/lib/bb/cache.py index 988c596c39..ee924b2d2b 100644 --- a/poky/bitbake/lib/bb/cache.py +++ b/poky/bitbake/lib/bb/cache.py @@ -28,7 +28,7 @@ import shutil logger = logging.getLogger("BitBake.Cache") -__cache_version__ = "154" +__cache_version__ = "155" def getCacheFile(path, filename, mc, data_hash): mcspec = '' @@ -105,7 +105,7 @@ class CoreRecipeInfo(RecipeInfoCommon): self.tasks = metadata.getVar('__BBTASKS', False) - self.basetaskhashes = self.taskvar('BB_BASEHASH', self.tasks, metadata) + self.basetaskhashes = metadata.getVar('__siggen_basehashes', False) or {} self.hashfilename = self.getvar('BB_HASHFILENAME', metadata) self.task_deps = metadata.getVar('_task_deps', False) or {'tasks': [], 'parents': {}} @@ -238,6 +238,106 @@ class CoreRecipeInfo(RecipeInfoCommon): cachedata.fakerootlogs[fn] = self.fakerootlogs cachedata.extradepsfunc[fn] = self.extradepsfunc + +class SiggenRecipeInfo(RecipeInfoCommon): + __slots__ = () + + classname = "SiggenRecipeInfo" + cachefile = "bb_cache_" + classname +".dat" + # we don't want to show this information in graph files so don't set cachefields + #cachefields = [] + + def __init__(self, filename, metadata): + self.siggen_gendeps = metadata.getVar("__siggen_gendeps", False) + self.siggen_varvals = metadata.getVar("__siggen_varvals", False) + self.siggen_taskdeps = metadata.getVar("__siggen_taskdeps", False) + + @classmethod + def init_cacheData(cls, cachedata): + cachedata.siggen_taskdeps = {} + cachedata.siggen_gendeps = {} + cachedata.siggen_varvals = {} + + def add_cacheData(self, cachedata, fn): + cachedata.siggen_gendeps[fn] = self.siggen_gendeps + cachedata.siggen_varvals[fn] = self.siggen_varvals + cachedata.siggen_taskdeps[fn] = self.siggen_taskdeps + + # The siggen variable data is large and impacts: + # - bitbake's overall memory usage + # - the amount of data sent over IPC between parsing processes and the server + # - the size of the cache files on disk + # - the size of "sigdata" hash information files on disk + # The data consists of strings (some large) or frozenset lists of variables + # As such, we a) deplicate the data here and b) pass references to the object at second + # access (e.g. over IPC or saving into pickle). + + store = {} + save_map = {} + save_count = 1 + restore_map = {} + restore_count = {} + + @classmethod + def reset(cls): + # Needs to be called before starting new streamed data in a given process + # (e.g. writing out the cache again) + cls.save_map = {} + cls.save_count = 1 + cls.restore_map = {} + + @classmethod + def _save(cls, deps): + ret = [] + if not deps: + return deps + for dep in deps: + fs = deps[dep] + if fs is None: + ret.append((dep, None, None)) + elif fs in cls.save_map: + ret.append((dep, None, cls.save_map[fs])) + else: + cls.save_map[fs] = cls.save_count + ret.append((dep, fs, cls.save_count)) + cls.save_count = cls.save_count + 1 + return ret + + @classmethod + def _restore(cls, deps, pid): + ret = {} + if not deps: + return deps + if pid not in cls.restore_map: + cls.restore_map[pid] = {} + map = cls.restore_map[pid] + for dep, fs, mapnum in deps: + if fs is None and mapnum is None: + ret[dep] = None + elif fs is None: + ret[dep] = map[mapnum] + else: + try: + fs = cls.store[fs] + except KeyError: + cls.store[fs] = fs + map[mapnum] = fs + ret[dep] = fs + return ret + + def __getstate__(self): + ret = {} + for key in ["siggen_gendeps", "siggen_taskdeps", "siggen_varvals"]: + ret[key] = self._save(self.__dict__[key]) + ret['pid'] = os.getpid() + return ret + + def __setstate__(self, state): + pid = state['pid'] + for key in ["siggen_gendeps", "siggen_taskdeps", "siggen_varvals"]: + setattr(self, key, self._restore(state[key], pid)) + + def virtualfn2realfn(virtualfn): """ Convert a virtual file name to a real one + the associated subclass keyword @@ -280,75 +380,18 @@ def variant2virtual(realfn, variant): return "mc:" + elems[1] + ":" + realfn return "virtual:" + variant + ":" + realfn -def parse_recipe(bb_data, bbfile, appends, mc=''): - """ - Parse a recipe - """ - - bb_data.setVar("__BBMULTICONFIG", mc) - - bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) - bb.parse.cached_mtime_noerror(bbfile_loc) - - if appends: - bb_data.setVar('__BBAPPEND', " ".join(appends)) - bb_data = bb.parse.handle(bbfile, bb_data) - return bb_data - - -class NoCache(object): - - def __init__(self, databuilder): - self.databuilder = databuilder - self.data = databuilder.data - - def loadDataFull(self, virtualfn, appends): - """ - Return a complete set of data for fn. - To do this, we need to parse the file. - """ - logger.debug("Parsing %s (full)" % virtualfn) - (fn, virtual, mc) = virtualfn2realfn(virtualfn) - bb_data = self.load_bbfile(virtualfn, appends, virtonly=True) - return bb_data[virtual] - - def load_bbfile(self, bbfile, appends, virtonly = False, mc=None): - """ - Load and parse one .bb build file - Return the data and whether parsing resulted in the file being skipped - """ - - if virtonly: - (bbfile, virtual, mc) = virtualfn2realfn(bbfile) - bb_data = self.databuilder.mcdata[mc].createCopy() - bb_data.setVar("__ONLYFINALISE", virtual or "default") - datastores = parse_recipe(bb_data, bbfile, appends, mc) - return datastores - - if mc is not None: - bb_data = self.databuilder.mcdata[mc].createCopy() - return parse_recipe(bb_data, bbfile, appends, mc) - - bb_data = self.data.createCopy() - datastores = parse_recipe(bb_data, bbfile, appends) - - for mc in self.databuilder.mcdata: - if not mc: - continue - bb_data = self.databuilder.mcdata[mc].createCopy() - newstores = parse_recipe(bb_data, bbfile, appends, mc) - for ns in newstores: - datastores["mc:%s:%s" % (mc, ns)] = newstores[ns] - - return datastores - -class Cache(NoCache): +# +# Cooker calls cacheValid on its recipe list, then either calls loadCached +# from it's main thread or parse from separate processes to generate an up to +# date cache +# +class Cache(object): """ BitBake Cache implementation """ def __init__(self, databuilder, mc, data_hash, caches_array): - super().__init__(databuilder) - data = databuilder.data + self.databuilder = databuilder + self.data = databuilder.data # Pass caches_array information into Cache Constructor # It will be used later for deciding whether we @@ -356,7 +399,7 @@ class Cache(NoCache): self.mc = mc self.logger = PrefixLoggerAdapter("Cache: %s: " % (mc if mc else "default"), logger) self.caches_array = caches_array - self.cachedir = data.getVar("CACHE") + self.cachedir = self.data.getVar("CACHE") self.clean = set() self.checked = set() self.depends_cache = {} @@ -366,20 +409,12 @@ class Cache(NoCache): self.filelist_regex = re.compile(r'(?:(?<=:True)|(?<=:False))\s+') if self.cachedir in [None, '']: - self.has_cache = False - self.logger.info("Not using a cache. " - "Set CACHE = to enable.") - return - - self.has_cache = True + bb.fatal("Please ensure CACHE is set to the cache directory for BitBake to use") def getCacheFile(self, cachefile): return getCacheFile(self.cachedir, cachefile, self.mc, self.data_hash) def prepare_cache(self, progress): - if not self.has_cache: - return 0 - loaded = 0 self.cachefile = self.getCacheFile("bb_cache.dat") @@ -418,9 +453,6 @@ class Cache(NoCache): return loaded def cachesize(self): - if not self.has_cache: - return 0 - cachesize = 0 for cache_class in self.caches_array: cachefile = self.getCacheFile(cache_class.cachefile) @@ -486,7 +518,7 @@ class Cache(NoCache): """Parse the specified filename, returning the recipe information""" self.logger.debug("Parsing %s", filename) infos = [] - datastores = self.load_bbfile(filename, appends, mc=self.mc) + datastores = self.databuilder.parseRecipeVariants(filename, appends, mc=self.mc) depends = [] variants = [] # Process the "real" fn last so we can store variants list @@ -508,43 +540,19 @@ class Cache(NoCache): return infos - def load(self, filename, appends): + def loadCached(self, filename, appends): """Obtain the recipe information for the specified filename, - using cached values if available, otherwise parsing. - - Note that if it does parse to obtain the info, it will not - automatically add the information to the cache or to your - CacheData. Use the add or add_info method to do so after - running this, or use loadData instead.""" - cached = self.cacheValid(filename, appends) - if cached: - infos = [] - # info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo] - info_array = self.depends_cache[filename] - for variant in info_array[0].variants: - virtualfn = variant2virtual(filename, variant) - infos.append((virtualfn, self.depends_cache[virtualfn])) - else: - return self.parse(filename, appends, configdata, self.caches_array) - - return cached, infos - - def loadData(self, fn, appends, cacheData): - """Load the recipe info for the specified filename, - parsing and adding to the cache if necessary, and adding - the recipe information to the supplied CacheData instance.""" - skipped, virtuals = 0, 0 + using cached values. + """ - cached, infos = self.load(fn, appends) - for virtualfn, info_array in infos: - if info_array[0].skipped: - self.logger.debug("Skipping %s: %s", virtualfn, info_array[0].skipreason) - skipped += 1 - else: - self.add_info(virtualfn, info_array, cacheData, not cached) - virtuals += 1 + infos = [] + # info_array item is a list of [CoreRecipeInfo, XXXRecipeInfo] + info_array = self.depends_cache[filename] + for variant in info_array[0].variants: + virtualfn = variant2virtual(filename, variant) + infos.append((virtualfn, self.depends_cache[virtualfn])) - return cached, skipped, virtuals + return infos def cacheValid(self, fn, appends): """ @@ -553,10 +561,6 @@ class Cache(NoCache): """ if fn not in self.checked: self.cacheValidUpdate(fn, appends) - - # Is cache enabled? - if not self.has_cache: - return False if fn in self.clean: return True return False @@ -566,10 +570,6 @@ class Cache(NoCache): Is the cache valid for fn? Make thorough (slower) checks including timestamps. """ - # Is cache enabled? - if not self.has_cache: - return False - self.checked.add(fn) # File isn't in depends_cache @@ -676,10 +676,6 @@ class Cache(NoCache): Save the cache Called from the parser when complete (or exiting) """ - - if not self.has_cache: - return - if self.cacheclean: self.logger.debug2("Cache is clean, not saving.") return @@ -700,6 +696,7 @@ class Cache(NoCache): p.dump(info) del self.depends_cache + SiggenRecipeInfo.reset() @staticmethod def mtime(cachefile): @@ -722,26 +719,11 @@ class Cache(NoCache): if watcher: watcher(info_array[0].file_depends) - if not self.has_cache: - return - if (info_array[0].skipped or 'SRCREVINACTION' not in info_array[0].pv) and not info_array[0].nocache: if parsed: self.cacheclean = False self.depends_cache[filename] = info_array - def add(self, file_name, data, cacheData, parsed=None): - """ - Save data we need into the cache - """ - - realfn = virtualfn2realfn(file_name)[0] - - info_array = [] - for cache_class in self.caches_array: - info_array.append(cache_class(realfn, data)) - self.add_info(file_name, info_array, cacheData, parsed) - class MulticonfigCache(Mapping): def __init__(self, databuilder, data_hash, caches_array): def progress(p): @@ -778,6 +760,7 @@ class MulticonfigCache(Mapping): loaded = 0 for c in self.__caches.values(): + SiggenRecipeInfo.reset() loaded += c.prepare_cache(progress) previous_progress = current_progress diff --git a/poky/bitbake/lib/bb/codeparser.py b/poky/bitbake/lib/bb/codeparser.py index 9d66d3ae41..ecae7b0808 100644 --- a/poky/bitbake/lib/bb/codeparser.py +++ b/poky/bitbake/lib/bb/codeparser.py @@ -27,6 +27,7 @@ import ast import sys import codegen import logging +import inspect import bb.pysh as pysh import bb.utils, bb.data import hashlib @@ -58,10 +59,39 @@ def check_indent(codestr): return codestr -# A custom getstate/setstate using tuples is actually worth 15% cachesize by -# avoiding duplication of the attribute names! +modulecode_deps = {} +def add_module_functions(fn, functions, namespace): + fstat = os.stat(fn) + fixedhash = fn + ":" + str(fstat.st_size) + ":" + str(fstat.st_mtime) + for f in functions: + name = "%s.%s" % (namespace, f) + parser = PythonParser(name, logger) + try: + parser.parse_python(None, filename=fn, lineno=1, fixedhash=fixedhash+f) + #bb.warn("Cached %s" % f) + except KeyError: + lines, lineno = inspect.getsourcelines(functions[f]) + src = "".join(lines) + parser.parse_python(src, filename=fn, lineno=lineno, fixedhash=fixedhash+f) + #bb.warn("Not cached %s" % f) + execs = parser.execs.copy() + # Expand internal module exec references + for e in parser.execs: + if e in functions: + execs.remove(e) + execs.add(namespace + "." + e) + modulecode_deps[name] = [parser.references.copy(), execs, parser.var_execs.copy(), parser.contains.copy()] + #bb.warn("%s: %s\nRefs:%s Execs: %s %s %s" % (name, src, parser.references, parser.execs, parser.var_execs, parser.contains)) + +def update_module_dependencies(d): + for mod in modulecode_deps: + excludes = set((d.getVarFlag(mod, "vardepsexclude") or "").split()) + if excludes: + modulecode_deps[mod] = [modulecode_deps[mod][0] - excludes, modulecode_deps[mod][1] - excludes, modulecode_deps[mod][2] - excludes, modulecode_deps[mod][3]] +# A custom getstate/setstate using tuples is actually worth 15% cachesize by +# avoiding duplication of the attribute names! class SetCache(object): def __init__(self): self.setcache = {} @@ -289,11 +319,17 @@ class PythonParser(): self.unhandled_message = "in call of %s, argument '%s' is not a string literal" self.unhandled_message = "while parsing %s, %s" % (name, self.unhandled_message) - def parse_python(self, node, lineno=0, filename=""): - if not node or not node.strip(): + # For the python module code it is expensive to have the function text so it is + # uses a different fixedhash to cache against. We can take the hit on obtaining the + # text if it isn't in the cache. + def parse_python(self, node, lineno=0, filename="", fixedhash=None): + if not fixedhash and (not node or not node.strip()): return - h = bbhash(str(node)) + if fixedhash: + h = fixedhash + else: + h = bbhash(str(node)) if h in codeparsercache.pythoncache: self.references = set(codeparsercache.pythoncache[h].refs) @@ -311,6 +347,9 @@ class PythonParser(): self.contains[i] = set(codeparsercache.pythoncacheextras[h].contains[i]) return + if fixedhash and not node: + raise KeyError + # Need to parse so take the hit on the real log buffer self.log = BufferedLogger('BitBake.Data.PythonParser', logging.DEBUG, self._log) diff --git a/poky/bitbake/lib/bb/command.py b/poky/bitbake/lib/bb/command.py index ec86885220..9e2cdc5c75 100644 --- a/poky/bitbake/lib/bb/command.py +++ b/poky/bitbake/lib/bb/command.py @@ -51,16 +51,17 @@ class Command: """ A queue of asynchronous commands for bitbake """ - def __init__(self, cooker): + def __init__(self, cooker, process_server): self.cooker = cooker self.cmds_sync = CommandsSync() self.cmds_async = CommandsAsync() self.remotedatastores = None - # FIXME Add lock for this + self.process_server = process_server + # Access with locking using process_server.{get/set/clear}_async_cmd() self.currentAsyncCommand = None - def runCommand(self, commandline, ro_only = False): + def runCommand(self, commandline, process_server, ro_only=False): command = commandline.pop(0) # Ensure cooker is ready for commands @@ -84,7 +85,7 @@ class Command: if not hasattr(command_method, 'readonly') or not getattr(command_method, 'readonly'): return None, "Not able to execute not readonly commands in readonly mode" try: - self.cooker.process_inotify_updates() + self.cooker.process_inotify_updates_apply() if getattr(command_method, 'needconfig', True): self.cooker.updateCacheSync() result = command_method(self, commandline) @@ -99,24 +100,24 @@ class Command: return None, traceback.format_exc() else: return result, None - if self.currentAsyncCommand is not None: - return None, "Busy (%s in progress)" % self.currentAsyncCommand[0] if command not in CommandsAsync.__dict__: return None, "No such command" - self.currentAsyncCommand = (command, commandline) - self.cooker.idleCallBackRegister(self.cooker.runCommands, self.cooker) + if not process_server.set_async_cmd((command, commandline)): + return None, "Busy (%s in progress)" % self.process_server.get_async_cmd()[0] + self.cooker.idleCallBackRegister(self.runAsyncCommand, process_server) return True, None - def runAsyncCommand(self): + def runAsyncCommand(self, _, process_server, halt): try: - self.cooker.process_inotify_updates() + self.cooker.process_inotify_updates_apply() if self.cooker.state in (bb.cooker.state.error, bb.cooker.state.shutdown, bb.cooker.state.forceshutdown): # updateCache will trigger a shutdown of the parser # and then raise BBHandledException triggering an exit self.cooker.updateCache() - return False - if self.currentAsyncCommand is not None: - (command, options) = self.currentAsyncCommand + return bb.server.process.idleFinish("Cooker in error state") + cmd = process_server.get_async_cmd() + if cmd is not None: + (command, options) = cmd commandmethod = getattr(CommandsAsync, command) needcache = getattr( commandmethod, "needcache" ) if needcache and self.cooker.state != bb.cooker.state.running: @@ -126,24 +127,21 @@ class Command: commandmethod(self.cmds_async, self, options) return False else: - return False + return bb.server.process.idleFinish("Nothing to do, no async command?") except KeyboardInterrupt as exc: - self.finishAsyncCommand("Interrupted") - return False + return bb.server.process.idleFinish("Interrupted") except SystemExit as exc: arg = exc.args[0] if isinstance(arg, str): - self.finishAsyncCommand(arg) + return bb.server.process.idleFinish(arg) else: - self.finishAsyncCommand("Exited with %s" % arg) - return False + return bb.server.process.idleFinish("Exited with %s" % arg) except Exception as exc: import traceback if isinstance(exc, bb.BBHandledException): - self.finishAsyncCommand("") + return bb.server.process.idleFinish("") else: - self.finishAsyncCommand(traceback.format_exc()) - return False + return bb.server.process.idleFinish(traceback.format_exc()) def finishAsyncCommand(self, msg=None, code=None): if msg or msg == "": @@ -152,8 +150,8 @@ class Command: bb.event.fire(CommandExit(code), self.cooker.data) else: bb.event.fire(CommandCompleted(), self.cooker.data) - self.currentAsyncCommand = None self.cooker.finishcommand() + self.process_server.clear_async_cmd() def reset(self): if self.remotedatastores: @@ -166,6 +164,12 @@ class CommandsSync: These must not influence any running synchronous command. """ + def ping(self, command, params): + """ + Allow a UI to check the server is still alive + """ + return "Still alive!" + def stateShutdown(self, command, params): """ Trigger cooker 'shutdown' mode @@ -564,11 +568,10 @@ class CommandsSync: if config_data: # We have to use a different function here if we're passing in a datastore # NOTE: we took a copy above, so we don't do it here again - envdata = bb.cache.parse_recipe(config_data, fn, appendfiles, mc)[''] + envdata = command.cooker.databuilder._parse_recipe(config_data, fn, appendfiles, mc)[''] else: # Use the standard path - parser = bb.cache.NoCache(command.cooker.databuilder) - envdata = parser.loadDataFull(fn, appendfiles) + envdata = command.cooker.databuilder.parseRecipe(fn, appendfiles) idx = command.remotedatastores.store(envdata) return DataStoreConnectionHandle(idx) parseRecipeFile.readonly = True @@ -741,7 +744,7 @@ class CommandsAsync: """ event = params[0] bb.event.fire(eval(event), command.cooker.data) - command.currentAsyncCommand = None + process_server.clear_async_cmd() triggerEvent.needcache = False def resetCooker(self, command, params): diff --git a/poky/bitbake/lib/bb/cooker.py b/poky/bitbake/lib/bb/cooker.py index 1da2f03197..cfaa7cbe6c 100644 --- a/poky/bitbake/lib/bb/cooker.py +++ b/poky/bitbake/lib/bb/cooker.py @@ -80,7 +80,7 @@ class SkippedPackage: class CookerFeatures(object): - _feature_list = [HOB_EXTRA_CACHES, BASEDATASTORE_TRACKING, SEND_SANITYEVENTS] = list(range(3)) + _feature_list = [HOB_EXTRA_CACHES, BASEDATASTORE_TRACKING, SEND_SANITYEVENTS, RECIPE_SIGGEN_INFO] = list(range(4)) def __init__(self): self._features=set() @@ -149,7 +149,7 @@ class BBCooker: Manages one bitbake build run """ - def __init__(self, featureSet=None, idleCallBackRegister=None): + def __init__(self, featureSet=None, server=None): self.recipecaches = None self.eventlog = None self.skiplist = {} @@ -163,7 +163,12 @@ class BBCooker: self.configuration = bb.cookerdata.CookerConfiguration() - self.idleCallBackRegister = idleCallBackRegister + self.process_server = server + self.idleCallBackRegister = None + self.waitIdle = None + if server: + self.idleCallBackRegister = server.register_idle_function + self.waitIdle = server.wait_for_idle bb.debug(1, "BBCooker starting %s" % time.time()) sys.stdout.flush() @@ -189,12 +194,6 @@ class BBCooker: self.inotify_modified_files = [] - def _process_inotify_updates(server, cooker, halt): - cooker.process_inotify_updates() - return 1.0 - - self.idleCallBackRegister(_process_inotify_updates, self) - # TOSTOP must not be set or our children will hang when they output try: fd = sys.stdout.fileno() @@ -208,7 +207,7 @@ class BBCooker: except UnsupportedOperation: pass - self.command = bb.command.Command(self) + self.command = bb.command.Command(self, self.process_server) self.state = state.initial self.parser = None @@ -220,6 +219,8 @@ class BBCooker: bb.debug(1, "BBCooker startup complete %s" % time.time()) sys.stdout.flush() + self.inotify_threadlock = threading.Lock() + def init_configdata(self): if not hasattr(self, "data"): self.initConfigurationData() @@ -248,11 +249,18 @@ class BBCooker: self.notifier = pyinotify.Notifier(self.watcher, self.notifications) def process_inotify_updates(self): - for n in [self.confignotifier, self.notifier]: - if n and n.check_events(timeout=0): - # read notified events and enqueue them - n.read_events() - n.process_events() + with bb.utils.lock_timeout(self.inotify_threadlock): + for n in [self.confignotifier, self.notifier]: + if n and n.check_events(timeout=0): + # read notified events and enqueue them + n.read_events() + + def process_inotify_updates_apply(self): + with bb.utils.lock_timeout(self.inotify_threadlock): + for n in [self.confignotifier, self.notifier]: + if n and n.check_events(timeout=0): + n.read_events() + n.process_events() def config_notifications(self, event): if event.maskname == "IN_Q_OVERFLOW": @@ -367,12 +375,12 @@ class BBCooker: if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset: self.enableDataTracking() - all_extra_cache_names = [] + caches_name_array = ['bb.cache:CoreRecipeInfo'] # We hardcode all known cache types in a single place, here. if CookerFeatures.HOB_EXTRA_CACHES in self.featureset: - all_extra_cache_names.append("bb.cache_extra:HobRecipeInfo") - - caches_name_array = ['bb.cache:CoreRecipeInfo'] + all_extra_cache_names + caches_name_array.append("bb.cache_extra:HobRecipeInfo") + if CookerFeatures.RECIPE_SIGGEN_INFO in self.featureset: + caches_name_array.append("bb.cache:SiggenRecipeInfo") # At least CoreRecipeInfo will be loaded, so caches_array will never be empty! # This is the entry point, no further check needed! @@ -400,9 +408,7 @@ class BBCooker: self.disableDataTracking() for mc in self.databuilder.mcdata.values(): - mc.renameVar("__depends", "__base_depends") self.add_filewatch(mc.getVar("__base_depends", False), self.configwatcher) - mc.setVar("__bbclasstype", "recipe") self.baseconfig_valid = True self.parsecache_valid = False @@ -436,10 +442,8 @@ class BBCooker: upstream=upstream, ) self.hashserv.serve_as_process() - self.data.setVar("BB_HASHSERVE", self.hashservaddr) - self.databuilder.origdata.setVar("BB_HASHSERVE", self.hashservaddr) - self.databuilder.data.setVar("BB_HASHSERVE", self.hashservaddr) for mc in self.databuilder.mcdata: + self.databuilder.mcorigdata[mc].setVar("BB_HASHSERVE", self.hashservaddr) self.databuilder.mcdata[mc].setVar("BB_HASHSERVE", self.hashservaddr) bb.parse.init_parser(self.data) @@ -535,15 +539,6 @@ class BBCooker: logger.debug("Base environment change, triggering reparse") self.reset() - def runCommands(self, server, data, halt): - """ - Run any queued asynchronous command - This is done by the idle handler so it runs in true context rather than - tied to any UI. - """ - - return self.command.runAsyncCommand() - def showVersions(self): (latest_versions, preferred_versions, required) = self.findProviders() @@ -617,8 +612,7 @@ class BBCooker: if fn: try: - bb_caches = bb.cache.MulticonfigCache(self.databuilder, self.data_hash, self.caches_array) - envdata = bb_caches[mc].loadDataFull(fn, self.collections[mc].get_file_appends(fn)) + envdata = self.databuilder.parseRecipe(fn, self.collections[mc].get_file_appends(fn)) except Exception as e: parselog.exception("Unable to read %s", fn) raise @@ -1449,10 +1443,12 @@ class BBCooker: self.recipecaches[mc].rundeps[fn] = defaultdict(list) self.recipecaches[mc].runrecs[fn] = defaultdict(list) + bb.parse.siggen.setup_datacache(self.recipecaches) + # Invalidate task for target if force mode active if self.configuration.force: logger.verbose("Invalidate task %s, %s", task, fn) - bb.parse.siggen.invalidate_task(task, self.recipecaches[mc], fn) + bb.parse.siggen.invalidate_task(task, fn) # Setup taskdata structure taskdata = {} @@ -1466,6 +1462,7 @@ class BBCooker: buildname = self.databuilder.mcdata[mc].getVar("BUILDNAME") if fireevents: bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.databuilder.mcdata[mc]) + bb.event.enable_heartbeat() # Execute the runqueue runlist = [[mc, item, task, fn]] @@ -1491,22 +1488,21 @@ class BBCooker: failures += len(exc.args) retval = False except SystemExit as exc: - self.command.finishAsyncCommand(str(exc)) if quietlog: bb.runqueue.logger.setLevel(rqloglevel) - return False + return bb.server.process.idleFinish(str(exc)) if not retval: if fireevents: bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc]) - self.command.finishAsyncCommand(msg) + bb.event.disable_heartbeat() # We trashed self.recipecaches above self.parsecache_valid = False self.configuration.limited_deps = False bb.parse.siggen.reset(self.data) if quietlog: bb.runqueue.logger.setLevel(rqloglevel) - return False + return bb.server.process.idleFinish(msg) if retval is True: return True return retval @@ -1536,16 +1532,16 @@ class BBCooker: failures += len(exc.args) retval = False except SystemExit as exc: - self.command.finishAsyncCommand(str(exc)) - return False + return bb.server.process.idleFinish(str(exc)) if not retval: try: for mc in self.multiconfigs: bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), self.databuilder.mcdata[mc]) finally: - self.command.finishAsyncCommand(msg) - return False + bb.event.disable_heartbeat() + return bb.server.process.idleFinish(msg) + if retval is True: return True return retval @@ -1577,6 +1573,7 @@ class BBCooker: for mc in self.multiconfigs: bb.event.fire(bb.event.BuildStarted(buildname, ntargets), self.databuilder.mcdata[mc]) + bb.event.enable_heartbeat() rq = bb.runqueue.RunQueue(self, self.data, self.recipecaches, taskdata, runlist) if 'universe' in targets: @@ -1756,22 +1753,26 @@ class BBCooker: if hasattr(self, "data"): bb.event.fire(CookerExit(), self.data) - def shutdown(self, force = False): + def shutdown(self, force=False): if force: self.state = state.forceshutdown else: self.state = state.shutdown if self.parser: - self.parser.shutdown(clean=not force) + self.parser.shutdown(clean=False) self.parser.final_cleanup() def finishcommand(self): + if hasattr(self.parser, 'shutdown'): + self.parser.shutdown(clean=False) + self.parser.final_cleanup() self.state = state.initial def reset(self): if hasattr(bb.parse, "siggen"): bb.parse.siggen.exit() + self.finishcommand() self.initConfigurationData() self.handlePRServ() @@ -1783,8 +1784,9 @@ class BBCooker: if hasattr(self, "data"): self.databuilder.reset() self.data = self.databuilder.data + # In theory tinfoil could have modified the base data before parsing, + # ideally need to track if anything did modify the datastore self.parsecache_valid = False - self.baseconfig_valid = False class CookerExit(bb.event.Event): @@ -2092,29 +2094,29 @@ class Parser(multiprocessing.Process): multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, exitpriority=1) pending = [] + havejobs = True try: - while True: - try: - self.quit.get_nowait() - except queue.Empty: - pass - else: + while havejobs or pending: + if self.quit.is_set(): break - if pending: - result = pending.pop() - else: - try: - job = self.jobs.pop() - except IndexError: - break + job = None + try: + job = self.jobs.pop() + except IndexError: + havejobs = False + if job: result = self.parse(*job) # Clear the siggen cache after parsing to control memory usage, its huge bb.parse.siggen.postparsing_clean_cache() - try: - self.results.put(result, timeout=0.25) - except queue.Full: pending.append(result) + + if pending: + try: + result = pending.pop() + self.results.put(result, timeout=0.05) + except queue.Full: + pending.append(result) finally: self.results.close() self.results.join_thread() @@ -2189,13 +2191,15 @@ class CookerParser(object): self.haveshutdown = False self.syncthread = None + bb.cache.SiggenRecipeInfo.reset() + def start(self): self.results = self.load_cached() self.processes = [] if self.toparse: bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata) - self.parser_quit = multiprocessing.Queue(maxsize=self.num_processes) + self.parser_quit = multiprocessing.Event() self.result_queue = multiprocessing.Queue() def chunkify(lst,n): @@ -2227,8 +2231,15 @@ class CookerParser(object): else: bb.error("Parsing halted due to errors, see error messages above") - for process in self.processes: - self.parser_quit.put(None) + def sync_caches(): + for c in self.bb_caches.values(): + bb.cache.SiggenRecipeInfo.reset() + c.sync() + + self.syncthread = threading.Thread(target=sync_caches, name="SyncThread") + self.syncthread.start() + + self.parser_quit.set() # Cleanup the queue before call process.join(), otherwise there might be # deadlocks. @@ -2258,18 +2269,9 @@ class CookerParser(object): if hasattr(process, "close"): process.close() - self.parser_quit.close() - # Allow data left in the cancel queue to be discarded - self.parser_quit.cancel_join_thread() - - def sync_caches(): - for c in self.bb_caches.values(): - c.sync() - sync = threading.Thread(target=sync_caches, name="SyncThread") - self.syncthread = sync - sync.start() bb.codeparser.parser_cache_savemerge() + bb.cache.SiggenRecipeInfo.reset() bb.fetch.fetcher_parse_done() if self.cooker.configuration.profile: profiles = [] @@ -2288,8 +2290,8 @@ class CookerParser(object): def load_cached(self): for mc, cache, filename, appends in self.fromcache: - cached, infos = cache.load(filename, appends) - yield not cached, mc, infos + infos = cache.loadCached(filename, appends) + yield False, mc, infos def parse_generator(self): empty = False @@ -2387,6 +2389,7 @@ class CookerParser(object): return True def reparse(self, filename): + bb.cache.SiggenRecipeInfo.reset() to_reparse = set() for mc in self.cooker.multiconfigs: to_reparse.add((mc, filename, self.cooker.collections[mc].get_file_appends(filename))) diff --git a/poky/bitbake/lib/bb/cookerdata.py b/poky/bitbake/lib/bb/cookerdata.py index 8a354fed7c..c6b5658d75 100644 --- a/poky/bitbake/lib/bb/cookerdata.py +++ b/poky/bitbake/lib/bb/cookerdata.py @@ -184,7 +184,7 @@ def catch_parse_error(func): @catch_parse_error def parse_config_file(fn, data, include=True): - return bb.parse.handle(fn, data, include) + return bb.parse.handle(fn, data, include, baseconfig=True) @catch_parse_error def _inherit(bbclass, data): @@ -263,6 +263,7 @@ class CookerDataBuilder(object): self.mcdata = {} def parseBaseConfiguration(self, worker=False): + mcdata = {} data_hash = hashlib.sha256() try: self.data = self.parseConfigurationFiles(self.prefiles, self.postfiles) @@ -288,18 +289,18 @@ class CookerDataBuilder(object): bb.parse.init_parser(self.data) data_hash.update(self.data.get_hash().encode('utf-8')) - self.mcdata[''] = self.data + mcdata[''] = self.data multiconfig = (self.data.getVar("BBMULTICONFIG") or "").split() for config in multiconfig: if config[0].isdigit(): bb.fatal("Multiconfig name '%s' is invalid as multiconfigs cannot start with a digit" % config) - mcdata = self.parseConfigurationFiles(self.prefiles, self.postfiles, config) - bb.event.fire(bb.event.ConfigParsed(), mcdata) - self.mcdata[config] = mcdata - data_hash.update(mcdata.get_hash().encode('utf-8')) + parsed_mcdata = self.parseConfigurationFiles(self.prefiles, self.postfiles, config) + bb.event.fire(bb.event.ConfigParsed(), parsed_mcdata) + mcdata[config] = parsed_mcdata + data_hash.update(parsed_mcdata.get_hash().encode('utf-8')) if multiconfig: - bb.event.fire(bb.event.MultiConfigParsed(self.mcdata), self.data) + bb.event.fire(bb.event.MultiConfigParsed(mcdata), self.data) self.data_hash = data_hash.hexdigest() except (SyntaxError, bb.BBHandledException): @@ -311,6 +312,7 @@ class CookerDataBuilder(object): logger.exception("Error parsing configuration files") raise bb.BBHandledException() + bb.codeparser.update_module_dependencies(self.data) # Handle obsolete variable names d = self.data @@ -331,17 +333,23 @@ class CookerDataBuilder(object): if issues: raise bb.BBHandledException() + for mc in mcdata: + mcdata[mc].renameVar("__depends", "__base_depends") + mcdata[mc].setVar("__bbclasstype", "recipe") + # Create a copy so we can reset at a later date when UIs disconnect - self.origdata = self.data - self.data = bb.data.createCopy(self.origdata) - self.mcdata[''] = self.data + self.mcorigdata = mcdata + for mc in mcdata: + self.mcdata[mc] = bb.data.createCopy(mcdata[mc]) + self.data = self.mcdata[''] def reset(self): # We may not have run parseBaseConfiguration() yet - if not hasattr(self, 'origdata'): + if not hasattr(self, 'mcorigdata'): return - self.data = bb.data.createCopy(self.origdata) - self.mcdata[''] = self.data + for mc in self.mcorigdata: + self.mcdata[mc] = bb.data.createCopy(self.mcorigdata[mc]) + self.data = self.mcdata[''] def _findLayerConf(self, data): return findConfigFile("bblayers.conf", data) @@ -383,6 +391,8 @@ class CookerDataBuilder(object): parselog.critical("Please check BBLAYERS in %s" % (layerconf)) raise bb.BBHandledException() + layerseries = None + compat_entries = {} for layer in layers: parselog.debug2("Adding layer %s", layer) if 'HOME' in approved and '~' in layer: @@ -395,8 +405,27 @@ class CookerDataBuilder(object): data.expandVarref('LAYERDIR') data.expandVarref('LAYERDIR_RE') + # Sadly we can't have nice things. + # Some layers think they're going to be 'clever' and copy the values from + # another layer, e.g. using ${LAYERSERIES_COMPAT_core}. The whole point of + # this mechanism is to make it clear which releases a layer supports and + # show when a layer master branch is bitrotting and is unmaintained. + # We therefore avoid people doing this here. + collections = (data.getVar('BBFILE_COLLECTIONS') or "").split() + for c in collections: + compat_entry = data.getVar("LAYERSERIES_COMPAT_%s" % c) + if compat_entry: + compat_entries[c] = set(compat_entry.split()) + data.delVar("LAYERSERIES_COMPAT_%s" % c) + if not layerseries: + layerseries = set((data.getVar("LAYERSERIES_CORENAMES") or "").split()) + if layerseries: + data.delVar("LAYERSERIES_CORENAMES") + data.delVar('LAYERDIR_RE') data.delVar('LAYERDIR') + for c in compat_entries: + data.setVar("LAYERSERIES_COMPAT_%s" % c, " ".join(sorted(compat_entries[c]))) bbfiles_dynamic = (data.getVar('BBFILES_DYNAMIC') or "").split() collections = (data.getVar('BBFILE_COLLECTIONS') or "").split() @@ -415,13 +444,15 @@ class CookerDataBuilder(object): if invalid: bb.fatal("BBFILES_DYNAMIC entries must be of the form {!}:, not:\n %s" % "\n ".join(invalid)) - layerseries = set((data.getVar("LAYERSERIES_CORENAMES") or "").split()) collections_tmp = collections[:] for c in collections: collections_tmp.remove(c) if c in collections_tmp: bb.fatal("Found duplicated BBFILE_COLLECTIONS '%s', check bblayers.conf or layer.conf to fix it." % c) - compat = set((data.getVar("LAYERSERIES_COMPAT_%s" % c) or "").split()) + + compat = set() + if c in compat_entries: + compat = compat_entries[c] if compat and not layerseries: bb.fatal("No core layer found to work with layer '%s'. Missing entry in bblayers.conf?" % c) if compat and not (compat & layerseries): @@ -430,6 +461,8 @@ class CookerDataBuilder(object): elif not compat and not data.getVar("BB_WORKERCONTEXT"): bb.warn("Layer %s should set LAYERSERIES_COMPAT_%s in its conf/layer.conf file to list the core layer names it is compatible with." % (c, c)) + data.setVar("LAYERSERIES_CORENAMES", " ".join(sorted(layerseries))) + if not data.getVar("BBPATH"): msg = "The BBPATH variable is not set" if not layerconf: @@ -466,3 +499,54 @@ class CookerDataBuilder(object): return data + @staticmethod + def _parse_recipe(bb_data, bbfile, appends, mc=''): + bb_data.setVar("__BBMULTICONFIG", mc) + + bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) + bb.parse.cached_mtime_noerror(bbfile_loc) + + if appends: + bb_data.setVar('__BBAPPEND', " ".join(appends)) + bb_data = bb.parse.handle(bbfile, bb_data) + return bb_data + + def parseRecipeVariants(self, bbfile, appends, virtonly=False, mc=None): + """ + Load and parse one .bb build file + Return the data and whether parsing resulted in the file being skipped + """ + + if virtonly: + (bbfile, virtual, mc) = bb.cache.virtualfn2realfn(bbfile) + bb_data = self.mcdata[mc].createCopy() + bb_data.setVar("__ONLYFINALISE", virtual or "default") + datastores = self._parse_recipe(bb_data, bbfile, appends, mc) + return datastores + + if mc is not None: + bb_data = self.mcdata[mc].createCopy() + return self._parse_recipe(bb_data, bbfile, appends, mc) + + bb_data = self.data.createCopy() + datastores = self._parse_recipe(bb_data, bbfile, appends) + + for mc in self.mcdata: + if not mc: + continue + bb_data = self.mcdata[mc].createCopy() + newstores = self._parse_recipe(bb_data, bbfile, appends, mc) + for ns in newstores: + datastores["mc:%s:%s" % (mc, ns)] = newstores[ns] + + return datastores + + def parseRecipe(self, virtualfn, appends): + """ + Return a complete set of data for fn. + To do this, we need to parse the file. + """ + logger.debug("Parsing %s (full)" % virtualfn) + (fn, virtual, mc) = bb.cache.virtualfn2realfn(virtualfn) + bb_data = self.parseRecipeVariants(virtualfn, appends, virtonly=True) + return bb_data[virtual] diff --git a/poky/bitbake/lib/bb/data.py b/poky/bitbake/lib/bb/data.py index 3a6af325f4..841369699e 100644 --- a/poky/bitbake/lib/bb/data.py +++ b/poky/bitbake/lib/bb/data.py @@ -28,11 +28,6 @@ the speed is more critical here. import sys, os, re import hashlib -if sys.argv[0][-5:] == "pydoc": - path = os.path.dirname(os.path.dirname(sys.argv[1])) -else: - path = os.path.dirname(os.path.dirname(sys.argv[0])) -sys.path.insert(0, path) from itertools import groupby from bb import data_smart @@ -266,9 +261,40 @@ def emit_func_python(func, o=sys.__stdout__, d = init()): newdeps |= set((d.getVarFlag(dep, "vardeps") or "").split()) newdeps -= seen -def build_dependencies(key, keys, shelldeps, varflagsexcl, ignored_vars, d): +def build_dependencies(key, keys, mod_funcs, shelldeps, varflagsexcl, ignored_vars, d): + def handle_contains(value, contains, exclusions, d): + newvalue = [] + if value: + newvalue.append(str(value)) + for k in sorted(contains): + if k in exclusions or k in ignored_vars: + continue + l = (d.getVar(k) or "").split() + for item in sorted(contains[k]): + for word in item.split(): + if not word in l: + newvalue.append("\n%s{%s} = Unset" % (k, item)) + break + else: + newvalue.append("\n%s{%s} = Set" % (k, item)) + return "".join(newvalue) + + def handle_remove(value, deps, removes, d): + for r in sorted(removes): + r2 = d.expandWithRefs(r, None) + value += "\n_remove of %s" % r + deps |= r2.references + deps = deps | (keys & r2.execs) + return value + deps = set() try: + if key in mod_funcs: + exclusions = set() + moddep = bb.codeparser.modulecode_deps[key] + value = handle_contains("", moddep[3], exclusions, d) + return frozenset((moddep[0] | keys & moddep[1]) - ignored_vars), value + if key[-1] == ']': vf = key[:-1].split('[') if vf[1] == "vardepvalueexclude": @@ -276,36 +302,12 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, ignored_vars, d): value, parser = d.getVarFlag(vf[0], vf[1], False, retparser=True) deps |= parser.references deps = deps | (keys & parser.execs) - return deps, value + deps -= ignored_vars + return frozenset(deps), value varflags = d.getVarFlags(key, ["vardeps", "vardepvalue", "vardepsexclude", "exports", "postfuncs", "prefuncs", "lineno", "filename"]) or {} vardeps = varflags.get("vardeps") exclusions = varflags.get("vardepsexclude", "").split() - def handle_contains(value, contains, exclusions, d): - newvalue = [] - if value: - newvalue.append(str(value)) - for k in sorted(contains): - if k in exclusions or k in ignored_vars: - continue - l = (d.getVar(k) or "").split() - for item in sorted(contains[k]): - for word in item.split(): - if not word in l: - newvalue.append("\n%s{%s} = Unset" % (k, item)) - break - else: - newvalue.append("\n%s{%s} = Set" % (k, item)) - return "".join(newvalue) - - def handle_remove(value, deps, removes, d): - for r in sorted(removes): - r2 = d.expandWithRefs(r, None) - value += "\n_remove of %s" % r - deps |= r2.references - deps = deps | (keys & r2.execs) - return value - if "vardepvalue" in varflags: value = varflags.get("vardepvalue") elif varflags.get("func"): @@ -359,18 +361,20 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, ignored_vars, d): deps |= set((vardeps or "").split()) deps -= set(exclusions) + deps -= ignored_vars except bb.parse.SkipRecipe: raise except Exception as e: bb.warn("Exception during build_dependencies for %s" % key) raise - return deps, value + return frozenset(deps), value #bb.note("Variable %s references %s and calls %s" % (key, str(deps), str(execs))) #d.setVarFlag(key, "vardeps", deps) def generate_dependencies(d, ignored_vars): - keys = set(key for key in d if not key.startswith("__")) + mod_funcs = set(bb.codeparser.modulecode_deps.keys()) + keys = set(key for key in d if not key.startswith("__")) | mod_funcs shelldeps = set(key for key in d.getVar("__exportlist", False) if d.getVarFlag(key, "export", False) and not d.getVarFlag(key, "unexport", False)) varflagsexcl = d.getVar('BB_SIGNATURE_EXCLUDE_FLAGS') @@ -379,16 +383,16 @@ def generate_dependencies(d, ignored_vars): tasklist = d.getVar('__BBTASKS', False) or [] for task in tasklist: - deps[task], values[task] = build_dependencies(task, keys, shelldeps, varflagsexcl, ignored_vars, d) + deps[task], values[task] = build_dependencies(task, keys, mod_funcs, shelldeps, varflagsexcl, ignored_vars, d) newdeps = deps[task] seen = set() while newdeps: - nextdeps = newdeps - ignored_vars + nextdeps = newdeps seen |= nextdeps newdeps = set() for dep in nextdeps: if dep not in deps: - deps[dep], values[dep] = build_dependencies(dep, keys, shelldeps, varflagsexcl, ignored_vars, d) + deps[dep], values[dep] = build_dependencies(dep, keys, mod_funcs, shelldeps, varflagsexcl, ignored_vars, d) newdeps |= deps[dep] newdeps -= seen #print "For %s: %s" % (task, str(deps[task])) @@ -407,7 +411,6 @@ def generate_dependency_hash(tasklist, gendeps, lookupcache, ignored_vars, fn): else: data = [data] - gendeps[task] -= ignored_vars newdeps = gendeps[task] seen = set() while newdeps: @@ -415,9 +418,6 @@ def generate_dependency_hash(tasklist, gendeps, lookupcache, ignored_vars, fn): seen |= nextdeps newdeps = set() for dep in nextdeps: - if dep in ignored_vars: - continue - gendeps[dep] -= ignored_vars newdeps |= gendeps[dep] newdeps -= seen @@ -429,7 +429,7 @@ def generate_dependency_hash(tasklist, gendeps, lookupcache, ignored_vars, fn): data.append(str(var)) k = fn + ":" + task basehash[k] = hashlib.sha256("".join(data).encode("utf-8")).hexdigest() - taskdeps[task] = alldeps + taskdeps[task] = frozenset(seen) return taskdeps, basehash diff --git a/poky/bitbake/lib/bb/data_smart.py b/poky/bitbake/lib/bb/data_smart.py index 5415f2fccf..e2c93597e5 100644 --- a/poky/bitbake/lib/bb/data_smart.py +++ b/poky/bitbake/lib/bb/data_smart.py @@ -92,10 +92,11 @@ def infer_caller_details(loginfo, parent = False, varval = True): loginfo['func'] = func class VariableParse: - def __init__(self, varname, d, val = None): + def __init__(self, varname, d, unexpanded_value = None, val = None): self.varname = varname self.d = d self.value = val + self.unexpanded_value = unexpanded_value self.references = set() self.execs = set() @@ -447,9 +448,9 @@ class DataSmart(MutableMapping): def expandWithRefs(self, s, varname): if not isinstance(s, str): # sanity check - return VariableParse(varname, self, s) + return VariableParse(varname, self, s, s) - varparse = VariableParse(varname, self) + varparse = VariableParse(varname, self, s) while s.find('${') != -1: olds = s @@ -486,12 +487,14 @@ class DataSmart(MutableMapping): return if self.inoverride: return + overrride_stack = [] for count in range(5): self.inoverride = True # Can end up here recursively so setup dummy values self.overrides = [] self.overridesset = set() self.overrides = (self.getVar("OVERRIDES") or "").split(":") or [] + overrride_stack.append(self.overrides) self.overridesset = set(self.overrides) self.inoverride = False self.expand_cache = {} @@ -501,7 +504,7 @@ class DataSmart(MutableMapping): self.overrides = newoverrides self.overridesset = set(self.overrides) else: - bb.fatal("Overrides could not be expanded into a stable state after 5 iterations, overrides must be being referenced by other overridden variables in some recursive fashion. Please provide your configuration to bitbake-devel so we can laugh, er, I mean try and understand how to make it work.") + bb.fatal("Overrides could not be expanded into a stable state after 5 iterations, overrides must be being referenced by other overridden variables in some recursive fashion. Please provide your configuration to bitbake-devel so we can laugh, er, I mean try and understand how to make it work. The list of failing override expansions: %s" % "\n".join(str(s) for s in overrride_stack)) def initVar(self, var): self.expand_cache = {} @@ -718,7 +721,7 @@ class DataSmart(MutableMapping): if ':' in var: override = var[var.rfind(':')+1:] shortvar = var[:var.rfind(':')] - while override and override.islower(): + while override and __override_regexp__.match(override): try: if shortvar in self.overridedata: # Force CoW by recreating the list first @@ -773,6 +776,9 @@ class DataSmart(MutableMapping): return None cachename = var + "[" + flag + "]" + if not expand and retparser and cachename in self.expand_cache: + return self.expand_cache[cachename].unexpanded_value, self.expand_cache[cachename] + if expand and cachename in self.expand_cache: return self.expand_cache[cachename].value diff --git a/poky/bitbake/lib/bb/event.py b/poky/bitbake/lib/bb/event.py index 97668601a1..8b05f93e2f 100644 --- a/poky/bitbake/lib/bb/event.py +++ b/poky/bitbake/lib/bb/event.py @@ -68,29 +68,28 @@ _catchall_handlers = {} _eventfilter = None _uiready = False _thread_lock = threading.Lock() -_thread_lock_enabled = False - -if hasattr(__builtins__, '__setitem__'): - builtins = __builtins__ -else: - builtins = __builtins__.__dict__ +_heartbeat_enabled = False def enable_threadlock(): - global _thread_lock_enabled - _thread_lock_enabled = True + # Always needed now + return def disable_threadlock(): - global _thread_lock_enabled - _thread_lock_enabled = False + # Always needed now + return + +def enable_heartbeat(): + global _heartbeat_enabled + _heartbeat_enabled = True + +def disable_heartbeat(): + global _heartbeat_enabled + _heartbeat_enabled = False def execute_handler(name, handler, event, d): event.data = d - addedd = False - if 'd' not in builtins: - builtins['d'] = d - addedd = True try: - ret = handler(event) + ret = handler(event, d) except (bb.parse.SkipRecipe, bb.BBHandledException): raise except Exception: @@ -104,8 +103,7 @@ def execute_handler(name, handler, event, d): raise finally: del event.data - if addedd: - del builtins['d'] + def fire_class_handlers(event, d): if isinstance(event, logging.LogRecord): @@ -180,36 +178,30 @@ def print_ui_queue(): def fire_ui_handlers(event, d): global _thread_lock - global _thread_lock_enabled if not _uiready: # No UI handlers registered yet, queue up the messages ui_queue.append(event) return - if _thread_lock_enabled: - _thread_lock.acquire() - - errors = [] - for h in _ui_handlers: - #print "Sending event %s" % event - try: - if not _ui_logfilters[h].filter(event): - continue - # We use pickle here since it better handles object instances - # which xmlrpc's marshaller does not. Events *must* be serializable - # by pickle. - if hasattr(_ui_handlers[h].event, "sendpickle"): - _ui_handlers[h].event.sendpickle((pickle.dumps(event))) - else: - _ui_handlers[h].event.send(event) - except: - errors.append(h) - for h in errors: - del _ui_handlers[h] - - if _thread_lock_enabled: - _thread_lock.release() + with bb.utils.lock_timeout(_thread_lock): + errors = [] + for h in _ui_handlers: + #print "Sending event %s" % event + try: + if not _ui_logfilters[h].filter(event): + continue + # We use pickle here since it better handles object instances + # which xmlrpc's marshaller does not. Events *must* be serializable + # by pickle. + if hasattr(_ui_handlers[h].event, "sendpickle"): + _ui_handlers[h].event.sendpickle((pickle.dumps(event))) + else: + _ui_handlers[h].event.send(event) + except: + errors.append(h) + for h in errors: + del _ui_handlers[h] def fire(event, d): """Fire off an Event""" @@ -253,12 +245,12 @@ def register(name, handler, mask=None, filename=None, lineno=None, data=None): if handler is not None: # handle string containing python code if isinstance(handler, str): - tmp = "def %s(e):\n%s" % (name, handler) + tmp = "def %s(e, d):\n%s" % (name, handler) try: code = bb.methodpool.compile_cache(tmp) if not code: if filename is None: - filename = "%s(e)" % name + filename = "%s(e, d)" % name code = compile(tmp, filename, "exec", ast.PyCF_ONLY_AST) if lineno is not None: ast.increment_lineno(code, lineno-1) @@ -323,21 +315,23 @@ def set_eventfilter(func): _eventfilter = func def register_UIHhandler(handler, mainui=False): - bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 - _ui_handlers[_ui_handler_seq] = handler - level, debug_domains = bb.msg.constructLogOptions() - _ui_logfilters[_ui_handler_seq] = UIEventFilter(level, debug_domains) - if mainui: - global _uiready - _uiready = _ui_handler_seq - return _ui_handler_seq + with bb.utils.lock_timeout(_thread_lock): + bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 + _ui_handlers[_ui_handler_seq] = handler + level, debug_domains = bb.msg.constructLogOptions() + _ui_logfilters[_ui_handler_seq] = UIEventFilter(level, debug_domains) + if mainui: + global _uiready + _uiready = _ui_handler_seq + return _ui_handler_seq def unregister_UIHhandler(handlerNum, mainui=False): if mainui: global _uiready _uiready = False - if handlerNum in _ui_handlers: - del _ui_handlers[handlerNum] + with bb.utils.lock_timeout(_thread_lock): + if handlerNum in _ui_handlers: + del _ui_handlers[handlerNum] return def get_uihandler(): diff --git a/poky/bitbake/lib/bb/fetch2/git.py b/poky/bitbake/lib/bb/fetch2/git.py index 578edc5914..2e3d32515f 100644 --- a/poky/bitbake/lib/bb/fetch2/git.py +++ b/poky/bitbake/lib/bb/fetch2/git.py @@ -44,7 +44,8 @@ Supported SRC_URI options are: - nobranch Don't check the SHA validation for branch. set this option for the recipe - referring to commit which is valid in tag instead of branch. + referring to commit which is valid in any namespace (branch, tag, ...) + instead of branch. The default is "0", set nobranch=1 if needed. - usehead @@ -382,7 +383,11 @@ class Git(FetchMethod): runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=ud.clonedir) - fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, shlex.quote(repourl)) + + if ud.nobranch: + fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, shlex.quote(repourl)) + else: + fetch_cmd = "LANG=C %s fetch -f --progress %s refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*" % (ud.basecmd, shlex.quote(repourl)) if ud.proto.lower() != 'file': bb.fetch2.check_network_access(d, fetch_cmd, ud.url) progresshandler = GitProgressHandler(d) diff --git a/poky/bitbake/lib/bb/fetch2/wget.py b/poky/bitbake/lib/bb/fetch2/wget.py index 821afa5b58..696e918030 100644 --- a/poky/bitbake/lib/bb/fetch2/wget.py +++ b/poky/bitbake/lib/bb/fetch2/wget.py @@ -341,7 +341,8 @@ class Wget(FetchMethod): opener = urllib.request.build_opener(*handlers) try: - uri = ud.url.split(";")[0] + uri_base = ud.url.split(";")[0] + uri = "{}://{}{}".format(urllib.parse.urlparse(uri_base).scheme, ud.host, ud.path) r = urllib.request.Request(uri) r.get_method = lambda: "HEAD" # Some servers (FusionForge, as used on Alioth) require that the @@ -644,10 +645,10 @@ class Wget(FetchMethod): # search for version matches on folders inside the path, like: # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz dirver_regex = re.compile(r"(?P[^/]*(\d+\.)*\d+([-_]r\d+)*)/") - m = dirver_regex.search(path) + m = dirver_regex.findall(path) if m: pn = d.getVar('PN') - dirver = m.group('dirver') + dirver = m[-1][0] dirver_pn_regex = re.compile(r"%s\d?" % (re.escape(pn))) if not dirver_pn_regex.search(dirver): diff --git a/poky/bitbake/lib/bb/main.py b/poky/bitbake/lib/bb/main.py index 93eda3632e..92d8dc0293 100755 --- a/poky/bitbake/lib/bb/main.py +++ b/poky/bitbake/lib/bb/main.py @@ -12,11 +12,12 @@ import os import sys import logging -import optparse +import argparse import warnings import fcntl import time import traceback +import datetime import bb from bb import event @@ -43,18 +44,18 @@ def present_options(optionlist): else: return optionlist[0] -class BitbakeHelpFormatter(optparse.IndentedHelpFormatter): - def format_option(self, option): +class BitbakeHelpFormatter(argparse.HelpFormatter): + def _get_help_string(self, action): # We need to do this here rather than in the text we supply to # add_option() because we don't want to call list_extension_modules() # on every execution (since it imports all of the modules) # Note also that we modify option.help rather than the returned text # - this is so that we don't have to re-format the text ourselves - if option.dest == 'ui': + if action.dest == 'ui': valid_uis = list_extension_modules(bb.ui, 'main') - option.help = option.help.replace('@CHOICES@', present_options(valid_uis)) + return action.help.replace('@CHOICES@', present_options(valid_uis)) - return optparse.IndentedHelpFormatter.format_option(self, option) + return action.help def list_extension_modules(pkg, checkattr): """ @@ -114,180 +115,205 @@ def _showwarning(message, category, filename, lineno, file=None, line=None): warnings.showwarning = _showwarning def create_bitbake_parser(): - parser = optparse.OptionParser( - formatter=BitbakeHelpFormatter(), - version="BitBake Build Tool Core version %s" % bb.__version__, - usage="""%prog [options] [recipename/target recipe:do_task ...] - - Executes the specified task (default is 'build') for a given set of target recipes (.bb files). - It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which - will provide the layer, BBFILES and other configuration information.""") - - parser.add_option("-b", "--buildfile", action="store", dest="buildfile", default=None, - help="Execute tasks from a specific .bb recipe directly. WARNING: Does " - "not handle any dependencies from other recipes.") - - parser.add_option("-k", "--continue", action="store_false", dest="halt", default=True, - help="Continue as much as possible after an error. While the target that " - "failed and anything depending on it cannot be built, as much as " - "possible will be built before stopping.") - - parser.add_option("-f", "--force", action="store_true", dest="force", default=False, - help="Force the specified targets/task to run (invalidating any " - "existing stamp file).") - - parser.add_option("-c", "--cmd", action="store", dest="cmd", - help="Specify the task to execute. The exact options available " - "depend on the metadata. Some examples might be 'compile'" - " or 'populate_sysroot' or 'listtasks' may give a list of " - "the tasks available.") - - parser.add_option("-C", "--clear-stamp", action="store", dest="invalidate_stamp", - help="Invalidate the stamp for the specified task such as 'compile' " - "and then run the default task for the specified target(s).") - - parser.add_option("-r", "--read", action="append", dest="prefile", default=[], - help="Read the specified file before bitbake.conf.") - - parser.add_option("-R", "--postread", action="append", dest="postfile", default=[], - help="Read the specified file after bitbake.conf.") - - parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, - help="Enable tracing of shell tasks (with 'set -x'). " - "Also print bb.note(...) messages to stdout (in " - "addition to writing them to ${T}/log.do_).") - - parser.add_option("-D", "--debug", action="count", dest="debug", default=0, - help="Increase the debug level. You can specify this " - "more than once. -D sets the debug level to 1, " - "where only bb.debug(1, ...) messages are printed " - "to stdout; -DD sets the debug level to 2, where " - "both bb.debug(1, ...) and bb.debug(2, ...) " - "messages are printed; etc. Without -D, no debug " - "messages are printed. Note that -D only affects " - "output to stdout. All debug messages are written " - "to ${T}/log.do_taskname, regardless of the debug " - "level.") - - parser.add_option("-q", "--quiet", action="count", dest="quiet", default=0, - help="Output less log message data to the terminal. You can specify this more than once.") - - parser.add_option("-n", "--dry-run", action="store_true", dest="dry_run", default=False, - help="Don't execute, just go through the motions.") - - parser.add_option("-S", "--dump-signatures", action="append", dest="dump_signatures", - default=[], metavar="SIGNATURE_HANDLER", - help="Dump out the signature construction information, with no task " - "execution. The SIGNATURE_HANDLER parameter is passed to the " - "handler. Two common values are none and printdiff but the handler " - "may define more/less. none means only dump the signature, printdiff" - " means compare the dumped signature with the cached one.") - - parser.add_option("-p", "--parse-only", action="store_true", - dest="parse_only", default=False, - help="Quit after parsing the BB recipes.") - - parser.add_option("-s", "--show-versions", action="store_true", - dest="show_versions", default=False, - help="Show current and preferred versions of all recipes.") - - parser.add_option("-e", "--environment", action="store_true", - dest="show_environment", default=False, - help="Show the global or per-recipe environment complete with information" - " about where variables were set/changed.") - - parser.add_option("-g", "--graphviz", action="store_true", dest="dot_graph", default=False, - help="Save dependency tree information for the specified " - "targets in the dot syntax.") - - parser.add_option("-I", "--ignore-deps", action="append", - dest="extra_assume_provided", default=[], - help="Assume these dependencies don't exist and are already provided " - "(equivalent to ASSUME_PROVIDED). Useful to make dependency " - "graphs more appealing") - - parser.add_option("-l", "--log-domains", action="append", dest="debug_domains", default=[], - help="Show debug logging for the specified logging domains") - - parser.add_option("-P", "--profile", action="store_true", dest="profile", default=False, - help="Profile the command and save reports.") + parser = argparse.ArgumentParser( + description="""\ + It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which + will provide the layer, BBFILES and other configuration information. + """, + formatter_class=BitbakeHelpFormatter, + allow_abbrev=False, + add_help=False, # help is manually added below in a specific argument group + ) + + general_group = parser.add_argument_group('General options') + task_group = parser.add_argument_group('Task control options') + exec_group = parser.add_argument_group('Execution control options') + logging_group = parser.add_argument_group('Logging/output control options') + server_group = parser.add_argument_group('Server options') + config_group = parser.add_argument_group('Configuration options') + + general_group.add_argument("targets", nargs="*", metavar="recipename/target", + help="Execute the specified task (default is 'build') for these target " + "recipes (.bb files).") + + general_group.add_argument("-s", "--show-versions", action="store_true", + help="Show current and preferred versions of all recipes.") + + general_group.add_argument("-e", "--environment", action="store_true", + dest="show_environment", + help="Show the global or per-recipe environment complete with information" + " about where variables were set/changed.") + + general_group.add_argument("-g", "--graphviz", action="store_true", dest="dot_graph", + help="Save dependency tree information for the specified " + "targets in the dot syntax.") # @CHOICES@ is substituted out by BitbakeHelpFormatter above - parser.add_option("-u", "--ui", action="store", dest="ui", - default=os.environ.get('BITBAKE_UI', 'knotty'), - help="The user interface to use (@CHOICES@ - default %default).") - - parser.add_option("", "--token", action="store", dest="xmlrpctoken", - default=os.environ.get("BBTOKEN"), - help="Specify the connection token to be used when connecting " - "to a remote server.") - - parser.add_option("", "--revisions-changed", action="store_true", - dest="revisions_changed", default=False, - help="Set the exit code depending on whether upstream floating " - "revisions have changed or not.") - - parser.add_option("", "--server-only", action="store_true", - dest="server_only", default=False, - help="Run bitbake without a UI, only starting a server " - "(cooker) process.") - - parser.add_option("-B", "--bind", action="store", dest="bind", default=False, - help="The name/address for the bitbake xmlrpc server to bind to.") - - parser.add_option("-T", "--idle-timeout", type=float, dest="server_timeout", - default=os.getenv("BB_SERVER_TIMEOUT"), - help="Set timeout to unload bitbake server due to inactivity, " - "set to -1 means no unload, " - "default: Environment variable BB_SERVER_TIMEOUT.") - - parser.add_option("", "--no-setscene", action="store_true", - dest="nosetscene", default=False, - help="Do not run any setscene tasks. sstate will be ignored and " - "everything needed, built.") - - parser.add_option("", "--skip-setscene", action="store_true", - dest="skipsetscene", default=False, - help="Skip setscene tasks if they would be executed. Tasks previously " - "restored from sstate will be kept, unlike --no-setscene") - - parser.add_option("", "--setscene-only", action="store_true", - dest="setsceneonly", default=False, - help="Only run setscene tasks, don't run any real tasks.") - - parser.add_option("", "--remote-server", action="store", dest="remote_server", - default=os.environ.get("BBSERVER"), - help="Connect to the specified server.") - - parser.add_option("-m", "--kill-server", action="store_true", - dest="kill_server", default=False, - help="Terminate any running bitbake server.") - - parser.add_option("", "--observe-only", action="store_true", - dest="observe_only", default=False, - help="Connect to a server as an observing-only client.") - - parser.add_option("", "--status-only", action="store_true", - dest="status_only", default=False, - help="Check the status of the remote bitbake server.") - - parser.add_option("-w", "--write-log", action="store", dest="writeeventlog", - default=os.environ.get("BBEVENTLOG"), - help="Writes the event log of the build to a bitbake event json file. " - "Use '' (empty string) to assign the name automatically.") - - parser.add_option("", "--runall", action="append", dest="runall", - help="Run the specified task for any recipe in the taskgraph of the specified target (even if it wouldn't otherwise have run).") - - parser.add_option("", "--runonly", action="append", dest="runonly", - help="Run only the specified task within the taskgraph of the specified targets (and any task dependencies those tasks may have).") + general_group.add_argument("-u", "--ui", + default=os.environ.get('BITBAKE_UI', 'knotty'), + help="The user interface to use (@CHOICES@ - default %(default)s).") + + general_group.add_argument("--version", action="store_true", + help="Show programs version and exit.") + + general_group.add_argument('-h', '--help', action='help', + help='Show this help message and exit.') + + + task_group.add_argument("-f", "--force", action="store_true", + help="Force the specified targets/task to run (invalidating any " + "existing stamp file).") + + task_group.add_argument("-c", "--cmd", + help="Specify the task to execute. The exact options available " + "depend on the metadata. Some examples might be 'compile'" + " or 'populate_sysroot' or 'listtasks' may give a list of " + "the tasks available.") + + task_group.add_argument("-C", "--clear-stamp", dest="invalidate_stamp", + help="Invalidate the stamp for the specified task such as 'compile' " + "and then run the default task for the specified target(s).") + + task_group.add_argument("--runall", action="append", default=[], + help="Run the specified task for any recipe in the taskgraph of the " + "specified target (even if it wouldn't otherwise have run).") + + task_group.add_argument("--runonly", action="append", + help="Run only the specified task within the taskgraph of the " + "specified targets (and any task dependencies those tasks may have).") + + task_group.add_argument("--no-setscene", action="store_true", + dest="nosetscene", + help="Do not run any setscene tasks. sstate will be ignored and " + "everything needed, built.") + + task_group.add_argument("--skip-setscene", action="store_true", + dest="skipsetscene", + help="Skip setscene tasks if they would be executed. Tasks previously " + "restored from sstate will be kept, unlike --no-setscene.") + + task_group.add_argument("--setscene-only", action="store_true", + dest="setsceneonly", + help="Only run setscene tasks, don't run any real tasks.") + + + exec_group.add_argument("-n", "--dry-run", action="store_true", + help="Don't execute, just go through the motions.") + + exec_group.add_argument("-p", "--parse-only", action="store_true", + help="Quit after parsing the BB recipes.") + + exec_group.add_argument("-k", "--continue", action="store_false", dest="halt", + help="Continue as much as possible after an error. While the target that " + "failed and anything depending on it cannot be built, as much as " + "possible will be built before stopping.") + + exec_group.add_argument("-P", "--profile", action="store_true", + help="Profile the command and save reports.") + + exec_group.add_argument("-S", "--dump-signatures", action="append", + default=[], metavar="SIGNATURE_HANDLER", + help="Dump out the signature construction information, with no task " + "execution. The SIGNATURE_HANDLER parameter is passed to the " + "handler. Two common values are none and printdiff but the handler " + "may define more/less. none means only dump the signature, printdiff" + " means compare the dumped signature with the cached one.") + + exec_group.add_argument("--revisions-changed", action="store_true", + help="Set the exit code depending on whether upstream floating " + "revisions have changed or not.") + + exec_group.add_argument("-b", "--buildfile", + help="Execute tasks from a specific .bb recipe directly. WARNING: Does " + "not handle any dependencies from other recipes.") + + logging_group.add_argument("-D", "--debug", action="count", default=0, + help="Increase the debug level. You can specify this " + "more than once. -D sets the debug level to 1, " + "where only bb.debug(1, ...) messages are printed " + "to stdout; -DD sets the debug level to 2, where " + "both bb.debug(1, ...) and bb.debug(2, ...) " + "messages are printed; etc. Without -D, no debug " + "messages are printed. Note that -D only affects " + "output to stdout. All debug messages are written " + "to ${T}/log.do_taskname, regardless of the debug " + "level.") + + logging_group.add_argument("-l", "--log-domains", action="append", dest="debug_domains", + default=[], + help="Show debug logging for the specified logging domains.") + + logging_group.add_argument("-v", "--verbose", action="store_true", + help="Enable tracing of shell tasks (with 'set -x'). " + "Also print bb.note(...) messages to stdout (in " + "addition to writing them to ${T}/log.do_).") + + logging_group.add_argument("-q", "--quiet", action="count", default=0, + help="Output less log message data to the terminal. You can specify this " + "more than once.") + + logging_group.add_argument("-w", "--write-log", dest="writeeventlog", + default=os.environ.get("BBEVENTLOG"), + help="Writes the event log of the build to a bitbake event json file. " + "Use '' (empty string) to assign the name automatically.") + + + server_group.add_argument("-B", "--bind", default=False, + help="The name/address for the bitbake xmlrpc server to bind to.") + + server_group.add_argument("-T", "--idle-timeout", type=float, dest="server_timeout", + default=os.getenv("BB_SERVER_TIMEOUT"), + help="Set timeout to unload bitbake server due to inactivity, " + "set to -1 means no unload, " + "default: Environment variable BB_SERVER_TIMEOUT.") + + server_group.add_argument("--remote-server", + default=os.environ.get("BBSERVER"), + help="Connect to the specified server.") + + server_group.add_argument("-m", "--kill-server", action="store_true", + help="Terminate any running bitbake server.") + + server_group.add_argument("--token", dest="xmlrpctoken", + default=os.environ.get("BBTOKEN"), + help="Specify the connection token to be used when connecting " + "to a remote server.") + + server_group.add_argument("--observe-only", action="store_true", + help="Connect to a server as an observing-only client.") + + server_group.add_argument("--status-only", action="store_true", + help="Check the status of the remote bitbake server.") + + server_group.add_argument("--server-only", action="store_true", + help="Run bitbake without a UI, only starting a server " + "(cooker) process.") + + + config_group.add_argument("-r", "--read", action="append", dest="prefile", default=[], + help="Read the specified file before bitbake.conf.") + + config_group.add_argument("-R", "--postread", action="append", dest="postfile", default=[], + help="Read the specified file after bitbake.conf.") + + + config_group.add_argument("-I", "--ignore-deps", action="append", + dest="extra_assume_provided", default=[], + help="Assume these dependencies don't exist and are already provided " + "(equivalent to ASSUME_PROVIDED). Useful to make dependency " + "graphs more appealing.") + return parser class BitBakeConfigParameters(cookerdata.ConfigParameters): def parseCommandLine(self, argv=sys.argv): parser = create_bitbake_parser() - options, targets = parser.parse_args(argv) + options = parser.parse_intermixed_args(argv[1:]) + + if options.version: + print("BitBake Build Tool Core version %s" % bb.__version__) + sys.exit(0) if options.quiet and options.verbose: parser.error("options --quiet and --verbose are mutually exclusive") @@ -319,7 +345,7 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): else: options.xmlrpcinterface = (None, 0) - return options, targets[1:] + return options, options.targets def bitbake_main(configParams, configuration): @@ -384,6 +410,9 @@ def bitbake_main(configParams, configuration): return 1 +def timestamp(): + return datetime.datetime.now().strftime('%H:%M:%S.%f') + def setup_bitbake(configParams, extrafeatures=None): # Ensure logging messages get sent to the UI as events handler = bb.event.LogHandler() @@ -391,6 +420,11 @@ def setup_bitbake(configParams, extrafeatures=None): # In status only mode there are no logs and no UI logger.addHandler(handler) + if configParams.dump_signatures: + if extrafeatures is None: + extrafeatures = [] + extrafeatures.append(bb.cooker.CookerFeatures.RECIPE_SIGGEN_INFO) + if configParams.server_only: featureset = [] ui_module = None @@ -418,7 +452,7 @@ def setup_bitbake(configParams, extrafeatures=None): retries = 8 while retries: try: - topdir, lock = lockBitbake() + topdir, lock, lockfile = lockBitbake() sockname = topdir + "/bitbake.sock" if lock: if configParams.status_only or configParams.kill_server: @@ -429,18 +463,22 @@ def setup_bitbake(configParams, extrafeatures=None): logger.info("Starting bitbake server...") # Clear the event queue since we already displayed messages bb.event.ui_queue = [] - server = bb.server.process.BitBakeServer(lock, sockname, featureset, configParams.server_timeout, configParams.xmlrpcinterface) + server = bb.server.process.BitBakeServer(lock, sockname, featureset, configParams.server_timeout, configParams.xmlrpcinterface, configParams.profile) else: logger.info("Reconnecting to bitbake server...") if not os.path.exists(sockname): - logger.info("Previous bitbake instance shutting down?, waiting to retry...") + logger.info("Previous bitbake instance shutting down?, waiting to retry... (%s)" % timestamp()) + procs = bb.server.process.get_lockfile_process_msg(lockfile) + if procs: + logger.info("Processes holding bitbake.lock (missing socket %s):\n%s" % (sockname, procs)) + logger.info("Directory listing: %s" % (str(os.listdir(topdir)))) i = 0 lock = None # Wait for 5s or until we can get the lock while not lock and i < 50: time.sleep(0.1) - _, lock = lockBitbake() + _, lock, _ = lockBitbake() i += 1 if lock: bb.utils.unlockfile(lock) @@ -459,9 +497,9 @@ def setup_bitbake(configParams, extrafeatures=None): retries -= 1 tryno = 8 - retries if isinstance(e, (bb.server.process.ProcessTimeout, BrokenPipeError, EOFError, SystemExit)): - logger.info("Retrying server connection (#%d)..." % tryno) + logger.info("Retrying server connection (#%d)... (%s)" % (tryno, timestamp())) else: - logger.info("Retrying server connection (#%d)... (%s)" % (tryno, traceback.format_exc())) + logger.info("Retrying server connection (#%d)... (%s, %s)" % (tryno, traceback.format_exc(), timestamp())) if not retries: bb.fatal("Unable to connect to bitbake server, or start one (server startup failures would be in bitbake-cookerdaemon.log).") @@ -490,5 +528,5 @@ def lockBitbake(): bb.error("Unable to find conf/bblayers.conf or conf/bitbake.conf. BBPATH is unset and/or not in a build directory?") raise BBMainFatal lockfile = topdir + "/bitbake.lock" - return topdir, bb.utils.lockfile(lockfile, False, False) + return topdir, bb.utils.lockfile(lockfile, False, False), lockfile diff --git a/poky/bitbake/lib/bb/parse/__init__.py b/poky/bitbake/lib/bb/parse/__init__.py index 347609513b..4cd82f115b 100644 --- a/poky/bitbake/lib/bb/parse/__init__.py +++ b/poky/bitbake/lib/bb/parse/__init__.py @@ -99,12 +99,12 @@ def supports(fn, data): return 1 return 0 -def handle(fn, data, include = 0): +def handle(fn, data, include=0, baseconfig=False): """Call the handler that is appropriate for this file""" for h in handlers: if h['supports'](fn, data): with data.inchistory.include(fn): - return h['handle'](fn, data, include) + return h['handle'](fn, data, include, baseconfig) raise ParseError("not a BitBake file", fn) def init(fn, data): diff --git a/poky/bitbake/lib/bb/parse/ast.py b/poky/bitbake/lib/bb/parse/ast.py index 9e0a0f5c98..375ba3cb79 100644 --- a/poky/bitbake/lib/bb/parse/ast.py +++ b/poky/bitbake/lib/bb/parse/ast.py @@ -9,6 +9,7 @@ # SPDX-License-Identifier: GPL-2.0-only # +import sys import bb from bb import methodpool from bb.parse import logger @@ -269,6 +270,41 @@ class BBHandlerNode(AstNode): data.setVarFlag(h, "handler", 1) data.setVar('__BBHANDLERS', bbhands) +class PyLibNode(AstNode): + def __init__(self, filename, lineno, libdir, namespace): + AstNode.__init__(self, filename, lineno) + self.libdir = libdir + self.namespace = namespace + + def eval(self, data): + global_mods = (data.getVar("BB_GLOBAL_PYMODULES") or "").split() + for m in global_mods: + if m not in bb.utils._context: + bb.utils._context[m] = __import__(m) + + libdir = data.expand(self.libdir) + if libdir not in sys.path: + sys.path.append(libdir) + try: + bb.utils._context[self.namespace] = __import__(self.namespace) + toimport = getattr(bb.utils._context[self.namespace], "BBIMPORTS", []) + for i in toimport: + bb.utils._context[self.namespace] = __import__(self.namespace + "." + i) + mod = getattr(bb.utils._context[self.namespace], i) + fn = getattr(mod, "__file__") + funcs = {} + for f in dir(mod): + if f.startswith("_"): + continue + fcall = getattr(mod, f) + if not callable(fcall): + continue + funcs[f] = fcall + bb.codeparser.add_module_functions(fn, funcs, "%s.%s" % (self.namespace, i)) + + except AttributeError as e: + bb.error("Error importing OE modules: %s" % str(e)) + class InheritNode(AstNode): def __init__(self, filename, lineno, classes): AstNode.__init__(self, filename, lineno) @@ -320,6 +356,9 @@ def handleDelTask(statements, filename, lineno, m): def handleBBHandlers(statements, filename, lineno, m): statements.append(BBHandlerNode(filename, lineno, m.group(1))) +def handlePyLib(statements, filename, lineno, m): + statements.append(PyLibNode(filename, lineno, m.group(1), m.group(2))) + def handleInherit(statements, filename, lineno, m): classes = m.group(1) statements.append(InheritNode(filename, lineno, classes)) diff --git a/poky/bitbake/lib/bb/parse/parse_py/BBHandler.py b/poky/bitbake/lib/bb/parse/parse_py/BBHandler.py index 18e6868387..4d5b45e1ef 100644 --- a/poky/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/poky/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -101,8 +101,8 @@ def get_statements(filename, absolute_filename, base_name): cached_statements[absolute_filename] = statements return statements -def handle(fn, d, include): - global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__, __classname__ +def handle(fn, d, include, baseconfig=False): + global __infunc__, __body__, __residue__, __classname__ __body__ = [] __infunc__ = [] __classname__ = "" @@ -154,7 +154,7 @@ def handle(fn, d, include): return d def feeder(lineno, s, fn, root, statements, eof=False): - global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, bb, __residue__, __classname__ + global __inpython__, __infunc__, __body__, __residue__, __classname__ # Check tabs in python functions: # - def py_funcname(): covered by __inpython__ @@ -265,7 +265,7 @@ def feeder(lineno, s, fn, root, statements, eof=False): ast.handleInherit(statements, fn, lineno, m) return - return ConfHandler.feeder(lineno, s, fn, statements) + return ConfHandler.feeder(lineno, s, fn, statements, conffile=False) # Add us to the handlers list from .. import handlers diff --git a/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 451e68dd66..3076067287 100644 --- a/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py @@ -46,6 +46,7 @@ __require_regexp__ = re.compile( r"require\s+(.+)" ) __export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) __unset_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) __unset_flag_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)\[([a-zA-Z0-9\-_+.]+)\]$" ) +__addpylib_regexp__ = re.compile(r"addpylib\s+(.+)\s+(.+)" ) def init(data): return @@ -107,7 +108,7 @@ def include_single_file(parentfn, fn, lineno, data, error_out): # parsing. This turns out to be a hard problem to solve any other way. confFilters = [] -def handle(fn, data, include): +def handle(fn, data, include, baseconfig=False): init(data) if include == 0: @@ -144,7 +145,7 @@ def handle(fn, data, include): # skip comments if s[0] == '#': continue - feeder(lineno, s, abs_fn, statements) + feeder(lineno, s, abs_fn, statements, baseconfig=baseconfig) # DONE WITH PARSING... time to evaluate data.setVar('FILE', abs_fn) @@ -157,7 +158,9 @@ def handle(fn, data, include): return data -def feeder(lineno, s, fn, statements): +# baseconfig is set for the bblayers/layer.conf cookerdata config parsing +# The function is also used by BBHandler, conffile would be False +def feeder(lineno, s, fn, statements, baseconfig=False, conffile=True): m = __config_regexp__.match(s) if m: groupd = m.groupdict() @@ -189,6 +192,11 @@ def feeder(lineno, s, fn, statements): ast.handleUnsetFlag(statements, fn, lineno, m) return + m = __addpylib_regexp__.match(s) + if baseconfig and conffile and m: + ast.handlePyLib(statements, fn, lineno, m) + return + raise ParseError("unparsed line: '%s'" % s, fn, lineno); # Add us to the handlers list diff --git a/poky/bitbake/lib/bb/runqueue.py b/poky/bitbake/lib/bb/runqueue.py index 338d1fe36f..ce711b6252 100644 --- a/poky/bitbake/lib/bb/runqueue.py +++ b/poky/bitbake/lib/bb/runqueue.py @@ -155,7 +155,7 @@ class RunQueueScheduler(object): self.stamps = {} for tid in self.rqdata.runtaskentries: (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) - self.stamps[tid] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) + self.stamps[tid] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) if tid in self.rq.runq_buildable: self.buildable.append(tid) @@ -651,6 +651,8 @@ class RunQueueData: # Nothing to do return 0 + bb.parse.siggen.setup_datacache(self.dataCaches) + self.init_progress_reporter.start() self.init_progress_reporter.next_stage() @@ -698,6 +700,8 @@ class RunQueueData: frommc = mcdependency[1] mcdep = mcdependency[2] deptask = mcdependency[4] + if mcdep not in taskData: + bb.fatal("Multiconfig '%s' is referenced in multiconfig dependency '%s' but not enabled in BBMULTICONFIG?" % (mcdep, dep)) if mc == frommc: fn = taskData[mcdep].build_targets[pn][0] newdep = '%s:%s' % (fn,deptask) @@ -933,7 +937,7 @@ class RunQueueData: bb.debug(1, "Task %s is marked nostamp, cannot invalidate this task" % taskname) else: logger.verbose("Invalidate task %s, %s", taskname, fn) - bb.parse.siggen.invalidate_task(taskname, self.dataCaches[mc], taskfn) + bb.parse.siggen.invalidate_task(taskname, taskfn) self.target_tids = [] for (mc, target, task, fn) in self.targets: @@ -1243,9 +1247,8 @@ class RunQueueData: return len(self.runtaskentries) def prepare_task_hash(self, tid): - dc = bb.parse.siggen.get_data_caches(self.dataCaches, mc_from_tid(tid)) - bb.parse.siggen.prep_taskhash(tid, self.runtaskentries[tid].depends, dc) - self.runtaskentries[tid].hash = bb.parse.siggen.get_taskhash(tid, self.runtaskentries[tid].depends, dc) + bb.parse.siggen.prep_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches) + self.runtaskentries[tid].hash = bb.parse.siggen.get_taskhash(tid, self.runtaskentries[tid].depends, self.dataCaches) self.runtaskentries[tid].unihash = bb.parse.siggen.get_unihash(tid) def dump_data(self): @@ -1311,10 +1314,6 @@ class RunQueue: workerpipe = runQueuePipe(worker.stdout, None, self.cfgData, self, rqexec, fakerootlogs=fakerootlogs) workerdata = { - "taskdeps" : self.rqdata.dataCaches[mc].task_deps, - "fakerootenv" : self.rqdata.dataCaches[mc].fakerootenv, - "fakerootdirs" : self.rqdata.dataCaches[mc].fakerootdirs, - "fakerootnoenv" : self.rqdata.dataCaches[mc].fakerootnoenv, "sigdata" : bb.parse.siggen.get_taskdata(), "logdefaultlevel" : bb.msg.loggerDefaultLogLevel, "build_verbose_shell" : self.cooker.configuration.build_verbose_shell, @@ -1399,7 +1398,7 @@ class RunQueue: if taskname is None: taskname = tn - stampfile = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn) + stampfile = bb.parse.siggen.stampfile_mcfn(taskname, taskfn) # If the stamp is missing, it's not current if not os.access(stampfile, os.F_OK): @@ -1411,7 +1410,7 @@ class RunQueue: logger.debug2("%s.%s is nostamp\n", fn, taskname) return False - if taskname != "do_setscene" and taskname.endswith("_setscene"): + if taskname.endswith("_setscene"): return True if cache is None: @@ -1422,8 +1421,8 @@ class RunQueue: for dep in self.rqdata.runtaskentries[tid].depends: if iscurrent: (mc2, fn2, taskname2, taskfn2) = split_tid_mcfn(dep) - stampfile2 = bb.build.stampfile(taskname2, self.rqdata.dataCaches[mc2], taskfn2) - stampfile3 = bb.build.stampfile(taskname2 + "_setscene", self.rqdata.dataCaches[mc2], taskfn2) + stampfile2 = bb.parse.siggen.stampfile_mcfn(taskname2, taskfn2) + stampfile3 = bb.parse.siggen.stampfile_mcfn(taskname2 + "_setscene", taskfn2) t2 = get_timestamp(stampfile2) t3 = get_timestamp(stampfile3) if t3 and not t2: @@ -1512,7 +1511,7 @@ class RunQueue: if not self.dm_event_handler_registered: res = bb.event.register(self.dm_event_handler_name, - lambda x: self.dm.check(self) if self.state in [runQueueRunning, runQueueCleanUp] else False, + lambda x, y: self.dm.check(self) if self.state in [runQueueRunning, runQueueCleanUp] else False, ('bb.event.HeartbeatEvent',), data=self.cfgData) self.dm_event_handler_registered = True @@ -1609,29 +1608,28 @@ class RunQueue: else: self.rqexe.finish() - def rq_dump_sigfn(self, fn, options): - bb_cache = bb.cache.NoCache(self.cooker.databuilder) - mc = bb.runqueue.mc_from_tid(fn) - the_data = bb_cache.loadDataFull(fn, self.cooker.collections[mc].get_file_appends(fn)) - siggen = bb.parse.siggen - dataCaches = self.rqdata.dataCaches - siggen.dump_sigfn(fn, dataCaches, options) + def _rq_dump_sigtid(self, tids): + for tid in tids: + (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) + dataCaches = self.rqdata.dataCaches + bb.parse.siggen.dump_sigtask(taskfn, taskname, dataCaches[mc].stamp[taskfn], True) def dump_signatures(self, options): - fns = set() - bb.note("Reparsing files to collect dependency data") + if bb.cooker.CookerFeatures.RECIPE_SIGGEN_INFO not in self.cooker.featureset: + bb.fatal("The dump signatures functionality needs the RECIPE_SIGGEN_INFO feature enabled") - for tid in self.rqdata.runtaskentries: - fn = fn_from_tid(tid) - fns.add(fn) + bb.note("Writing task signature files") max_process = int(self.cfgData.getVar("BB_NUMBER_PARSE_THREADS") or os.cpu_count() or 1) + def chunkify(l, n): + return [l[i::n] for i in range(n)] + tids = chunkify(list(self.rqdata.runtaskentries), max_process) # We cannot use the real multiprocessing.Pool easily due to some local data # that can't be pickled. This is a cheap multi-process solution. launched = [] - while fns: + while tids: if len(launched) < max_process: - p = Process(target=self.rq_dump_sigfn, args=(fns.pop(), options)) + p = Process(target=self._rq_dump_sigtid, args=(tids.pop(), )) p.start() launched.append(p) for q in launched: @@ -2140,21 +2138,33 @@ class RunQueueExecute: startevent = sceneQueueTaskStarted(task, self.stats, self.rq) bb.event.fire(startevent, self.cfgData) - taskdepdata = self.sq_build_taskdepdata(task) - taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] - taskhash = self.rqdata.get_task_hash(task) - unihash = self.rqdata.get_task_unihash(task) + runtask = { + 'fn' : taskfn, + 'task' : task, + 'taskname' : taskname, + 'taskhash' : self.rqdata.get_task_hash(task), + 'unihash' : self.rqdata.get_task_unihash(task), + 'quieterrors' : True, + 'appends' : self.cooker.collections[mc].get_file_appends(taskfn), + 'taskdepdata' : self.sq_build_taskdepdata(task), + 'dry_run' : False, + 'taskdep': taskdep, + 'fakerootenv' : self.rqdata.dataCaches[mc].fakerootenv[taskfn], + 'fakerootdirs' : self.rqdata.dataCaches[mc].fakerootdirs[taskfn], + 'fakerootnoenv' : self.rqdata.dataCaches[mc].fakerootnoenv[taskfn] + } + if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not self.cooker.configuration.dry_run: if not mc in self.rq.fakeworker: self.rq.start_fakeworker(self, mc) - self.rq.fakeworker[mc].process.stdin.write(b"" + pickle.dumps((taskfn, task, taskname, taskhash, unihash, True, self.cooker.collections[mc].get_file_appends(taskfn), taskdepdata, False)) + b"") + self.rq.fakeworker[mc].process.stdin.write(b"" + pickle.dumps(runtask) + b"") self.rq.fakeworker[mc].process.stdin.flush() else: - self.rq.worker[mc].process.stdin.write(b"" + pickle.dumps((taskfn, task, taskname, taskhash, unihash, True, self.cooker.collections[mc].get_file_appends(taskfn), taskdepdata, False)) + b"") + self.rq.worker[mc].process.stdin.write(b"" + pickle.dumps(runtask) + b"") self.rq.worker[mc].process.stdin.flush() - self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) + self.build_stamps[task] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) self.build_stamps2.append(self.build_stamps[task]) self.sq_running.add(task) self.sq_live.add(task) @@ -2214,18 +2224,30 @@ class RunQueueExecute: self.runq_running.add(task) self.stats.taskActive() if not (self.cooker.configuration.dry_run or self.rqdata.setscene_enforce): - bb.build.make_stamp(taskname, self.rqdata.dataCaches[mc], taskfn) + bb.build.make_stamp_mcfn(taskname, taskfn) self.task_complete(task) return True else: startevent = runQueueTaskStarted(task, self.stats, self.rq) bb.event.fire(startevent, self.cfgData) - taskdepdata = self.build_taskdepdata(task) - taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn] - taskhash = self.rqdata.get_task_hash(task) - unihash = self.rqdata.get_task_unihash(task) + runtask = { + 'fn' : taskfn, + 'task' : task, + 'taskname' : taskname, + 'taskhash' : self.rqdata.get_task_hash(task), + 'unihash' : self.rqdata.get_task_unihash(task), + 'quieterrors' : False, + 'appends' : self.cooker.collections[mc].get_file_appends(taskfn), + 'taskdepdata' : self.build_taskdepdata(task), + 'dry_run' : self.rqdata.setscene_enforce, + 'taskdep': taskdep, + 'fakerootenv' : self.rqdata.dataCaches[mc].fakerootenv[taskfn], + 'fakerootdirs' : self.rqdata.dataCaches[mc].fakerootdirs[taskfn], + 'fakerootnoenv' : self.rqdata.dataCaches[mc].fakerootnoenv[taskfn] + } + if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not (self.cooker.configuration.dry_run or self.rqdata.setscene_enforce): if not mc in self.rq.fakeworker: try: @@ -2235,13 +2257,13 @@ class RunQueueExecute: self.rq.state = runQueueFailed self.stats.taskFailed() return True - self.rq.fakeworker[mc].process.stdin.write(b"" + pickle.dumps((taskfn, task, taskname, taskhash, unihash, False, self.cooker.collections[mc].get_file_appends(taskfn), taskdepdata, self.rqdata.setscene_enforce)) + b"") + self.rq.fakeworker[mc].process.stdin.write(b"" + pickle.dumps(runtask) + b"") self.rq.fakeworker[mc].process.stdin.flush() else: - self.rq.worker[mc].process.stdin.write(b"" + pickle.dumps((taskfn, task, taskname, taskhash, unihash, False, self.cooker.collections[mc].get_file_appends(taskfn), taskdepdata, self.rqdata.setscene_enforce)) + b"") + self.rq.worker[mc].process.stdin.write(b"" + pickle.dumps(runtask) + b"") self.rq.worker[mc].process.stdin.flush() - self.build_stamps[task] = bb.build.stampfile(taskname, self.rqdata.dataCaches[mc], taskfn, noextra=True) + self.build_stamps[task] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) self.build_stamps2.append(self.build_stamps[task]) self.runq_running.add(task) self.stats.taskActive() @@ -2413,8 +2435,7 @@ class RunQueueExecute: if self.rqdata.runtaskentries[p].depends and not self.rqdata.runtaskentries[tid].depends.isdisjoint(total): continue orighash = self.rqdata.runtaskentries[tid].hash - dc = bb.parse.siggen.get_data_caches(self.rqdata.dataCaches, mc_from_tid(tid)) - newhash = bb.parse.siggen.get_taskhash(tid, self.rqdata.runtaskentries[tid].depends, dc) + newhash = bb.parse.siggen.get_taskhash(tid, self.rqdata.runtaskentries[tid].depends, self.rqdata.dataCaches) origuni = self.rqdata.runtaskentries[tid].unihash newuni = bb.parse.siggen.get_unihash(tid) # FIXME, need to check it can come from sstate at all for determinism? @@ -2489,17 +2510,6 @@ class RunQueueExecute: self.sq_buildable.remove(tid) if tid in self.sq_running: self.sq_running.remove(tid) - harddepfail = False - for t in self.sqdata.sq_harddeps: - if tid in self.sqdata.sq_harddeps[t] and t in self.scenequeue_notcovered: - harddepfail = True - break - if not harddepfail and self.sqdata.sq_revdeps[tid].issubset(self.scenequeue_covered | self.scenequeue_notcovered): - if tid not in self.sq_buildable: - self.sq_buildable.add(tid) - if not self.sqdata.sq_revdeps[tid]: - self.sq_buildable.add(tid) - if tid in self.sqdata.outrightfail: self.sqdata.outrightfail.remove(tid) if tid in self.scenequeue_notcovered: @@ -2510,7 +2520,7 @@ class RunQueueExecute: self.scenequeue_notneeded.remove(tid) (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) - self.sqdata.stamps[tid] = bb.build.stampfile(taskname + "_setscene", self.rqdata.dataCaches[mc], taskfn, noextra=True) + self.sqdata.stamps[tid] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) if tid in self.stampcache: del self.stampcache[tid] @@ -2518,24 +2528,40 @@ class RunQueueExecute: if tid in self.build_stamps: del self.build_stamps[tid] - update_tasks.append((tid, harddepfail, tid in self.sqdata.valid)) + update_tasks.append(tid) - if update_tasks: + update_tasks2 = [] + for tid in update_tasks: + harddepfail = False + for t in self.sqdata.sq_harddeps: + if tid in self.sqdata.sq_harddeps[t] and t in self.scenequeue_notcovered: + harddepfail = True + break + if not harddepfail and self.sqdata.sq_revdeps[tid].issubset(self.scenequeue_covered | self.scenequeue_notcovered): + if tid not in self.sq_buildable: + self.sq_buildable.add(tid) + if not self.sqdata.sq_revdeps[tid]: + self.sq_buildable.add(tid) + + update_tasks2.append((tid, harddepfail, tid in self.sqdata.valid)) + + if update_tasks2: self.sqdone = False for mc in sorted(self.sqdata.multiconfigs): - for tid in sorted([t[0] for t in update_tasks]): + for tid in sorted([t[0] for t in update_tasks2]): if mc_from_tid(tid) != mc: continue h = pending_hash_index(tid, self.rqdata) if h in self.sqdata.hashes and tid != self.sqdata.hashes[h]: self.sq_deferred[tid] = self.sqdata.hashes[h] bb.note("Deferring %s after %s" % (tid, self.sqdata.hashes[h])) - update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False) + update_scenequeue_data([t[0] for t in update_tasks2], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False) - for (tid, harddepfail, origvalid) in update_tasks: + for (tid, harddepfail, origvalid) in update_tasks2: if tid in self.sqdata.valid and not origvalid: hashequiv_logger.verbose("Setscene task %s became valid" % tid) if harddepfail: + logger.debug2("%s has an unavailable hard dependency so skipping" % (tid)) self.sq_task_failoutright(tid) if changed: @@ -2810,7 +2836,8 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq): (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) realtid = tid + "_setscene" idepends = rqdata.taskData[mc].taskentries[realtid].idepends - sqdata.stamps[tid] = bb.build.stampfile(taskname + "_setscene", rqdata.dataCaches[mc], taskfn, noextra=True) + sqdata.stamps[tid] = bb.parse.siggen.stampfile_mcfn(taskname, taskfn, extrainfo=False) + for (depname, idependtask) in idepends: if depname not in rqdata.taskData[mc].build_targets: @@ -2889,7 +2916,7 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq): found = {} for tid in rqdata.runq_setscene_tids: (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) - stamps = bb.build.find_stale_stamps(taskname, rqdata.dataCaches[mc], taskfn) + stamps = bb.build.find_stale_stamps(taskname, taskfn) if stamps: if mc not in found: found[mc] = {} @@ -2905,7 +2932,7 @@ def check_setscene_stamps(tid, rqdata, rq, stampcache, noexecstamp=False): taskdep = rqdata.dataCaches[mc].task_deps[taskfn] if 'noexec' in taskdep and taskname in taskdep['noexec']: - bb.build.make_stamp(taskname + "_setscene", rqdata.dataCaches[mc], taskfn) + bb.build.make_stamp_mcfn(taskname + "_setscene", taskfn) return True, False if rq.check_stamp_task(tid, taskname + "_setscene", cache=stampcache): @@ -2935,11 +2962,13 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s if noexec: sqdata.noexec.add(tid) sqrq.sq_task_skip(tid) + logger.debug2("%s is noexec so skipping setscene" % (tid)) continue if stamppresent: sqdata.stamppresent.add(tid) sqrq.sq_task_skip(tid) + logger.debug2("%s has a valid stamp, skipping" % (tid)) continue tocheck.add(tid) @@ -2960,6 +2989,7 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s if tid in sqrq.sq_deferred: continue sqdata.outrightfail.add(tid) + logger.debug2("%s already handled (fallthrough), skipping" % (tid)) class TaskFailure(Exception): """ diff --git a/poky/bitbake/lib/bb/server/process.py b/poky/bitbake/lib/bb/server/process.py index 5d02c0b9f5..529196b78c 100644 --- a/poky/bitbake/lib/bb/server/process.py +++ b/poky/bitbake/lib/bb/server/process.py @@ -28,6 +28,7 @@ import datetime import pickle import traceback import gc +import stat import bb.server.xmlrpcserver from bb import daemonize from multiprocessing import queues @@ -41,6 +42,39 @@ def serverlog(msg): print(str(os.getpid()) + " " + datetime.datetime.now().strftime('%H:%M:%S.%f') + " " + msg) sys.stdout.flush() +# +# When we have lockfile issues, try and find infomation about which process is +# using the lockfile +# +def get_lockfile_process_msg(lockfile): + # Some systems may not have lsof available + procs = None + try: + procs = subprocess.check_output(["lsof", '-w', lockfile], stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + # File was deleted? + pass + except OSError as e: + if e.errno != errno.ENOENT: + raise + if procs is None: + # Fall back to fuser if lsof is unavailable + try: + procs = subprocess.check_output(["fuser", '-v', lockfile], stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + # File was deleted? + pass + except OSError as e: + if e.errno != errno.ENOENT: + raise + if procs: + return procs.decode("utf-8") + return None + +class idleFinish(): + def __init__(self, msg): + self.msg = msg + class ProcessServer(): profile_filename = "profile.log" profile_processed_filename = "profile.log.processed" @@ -58,12 +92,19 @@ class ProcessServer(): self.maxuiwait = 30 self.xmlrpc = False + self.idle = None + # Need a lock for _idlefuns changes self._idlefuns = {} + self._idlefuncsLock = threading.Lock() + self.idle_cond = threading.Condition(self._idlefuncsLock) self.bitbake_lock = lock self.bitbake_lock_name = lockname self.sock = sock self.sockname = sockname + # It is possible the directory may be renamed. Cache the inode of the socket file + # so we can tell if things changed. + self.sockinode = os.stat(self.sockname)[stat.ST_INO] self.server_timeout = server_timeout self.timeout = self.server_timeout @@ -72,7 +113,9 @@ class ProcessServer(): def register_idle_function(self, function, data): """Register a function to be called while the server is idle""" assert hasattr(function, '__call__') - self._idlefuns[function] = data + with bb.utils.lock_timeout(self._idlefuncsLock): + self._idlefuns[function] = data + serverlog("Registering idle function %s" % str(function)) def run(self): @@ -111,6 +154,31 @@ class ProcessServer(): return ret + def _idle_check(self): + return len(self._idlefuns) == 0 and self.cooker.command.currentAsyncCommand is None + + def wait_for_idle(self, timeout=30): + # Wait for the idle loop to have cleared + with bb.utils.lock_timeout(self._idlefuncsLock): + return self.idle_cond.wait_for(self._idle_check, timeout) is not False + + def set_async_cmd(self, cmd): + with bb.utils.lock_timeout(self._idlefuncsLock): + ret = self.idle_cond.wait_for(self._idle_check, 30) + if ret is False: + return False + self.cooker.command.currentAsyncCommand = cmd + return True + + def clear_async_cmd(self): + with bb.utils.lock_timeout(self._idlefuncsLock): + self.cooker.command.currentAsyncCommand = None + self.idle_cond.notify_all() + + def get_async_cmd(self): + with bb.utils.lock_timeout(self._idlefuncsLock): + return self.cooker.command.currentAsyncCommand + def main(self): self.cooker.pre_serve() @@ -125,14 +193,19 @@ class ProcessServer(): fds.append(self.xmlrpc) seendata = False serverlog("Entering server connection loop") + serverlog("Lockfile is: %s\nSocket is %s (%s)" % (self.bitbake_lock_name, self.sockname, os.path.exists(self.sockname))) def disconnect_client(self, fds): - serverlog("Disconnecting Client") + serverlog("Disconnecting Client (socket: %s)" % os.path.exists(self.sockname)) if self.controllersock: fds.remove(self.controllersock) self.controllersock.close() self.controllersock = False if self.haveui: + # Wait for the idle loop to have cleared (30s max) + if not self.wait_for_idle(30): + serverlog("Idle loop didn't finish queued commands after 30s, exiting.") + self.quit = True fds.remove(self.command_channel) bb.event.unregister_UIHhandler(self.event_handle, True) self.command_channel_reply.writer.close() @@ -144,7 +217,7 @@ class ProcessServer(): self.cooker.clientComplete() self.haveui = False ready = select.select(fds,[],[],0)[0] - if newconnections: + if newconnections and not self.quit: serverlog("Starting new client") conn = newconnections.pop(-1) fds.append(conn) @@ -216,8 +289,8 @@ class ProcessServer(): continue try: serverlog("Running command %s" % command) - self.command_channel_reply.send(self.cooker.command.runCommand(command)) - serverlog("Command Completed") + self.command_channel_reply.send(self.cooker.command.runCommand(command, self)) + serverlog("Command Completed (socket: %s)" % os.path.exists(self.sockname)) except Exception as e: stack = traceback.format_exc() serverlog('Exception in server main event loop running command %s (%s)' % (command, stack)) @@ -244,16 +317,25 @@ class ProcessServer(): ready = self.idle_commands(.1, fds) - serverlog("Exiting") + if self.idle: + self.idle.join() + + serverlog("Exiting (socket: %s)" % os.path.exists(self.sockname)) # Remove the socket file so we don't get any more connections to avoid races + # The build directory could have been renamed so if the file isn't the one we created + # we shouldn't delete it. try: - os.unlink(self.sockname) - except: - pass + sockinode = os.stat(self.sockname)[stat.ST_INO] + if sockinode == self.sockinode: + os.unlink(self.sockname) + else: + serverlog("bitbake.sock inode mismatch (%s vs %s), not deleting." % (sockinode, self.sockinode)) + except Exception as err: + serverlog("Removing socket file '%s' failed (%s)" % (self.sockname, err)) self.sock.close() try: - self.cooker.shutdown(True) + self.cooker.shutdown(True, idle=False) self.cooker.notifier.stop() self.cooker.confignotifier.stop() except: @@ -306,80 +388,90 @@ class ProcessServer(): return if not lock: - # Some systems may not have lsof available - procs = None - try: - procs = subprocess.check_output(["lsof", '-w', lockfile], stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - # File was deleted? - continue - except OSError as e: - if e.errno != errno.ENOENT: - raise - if procs is None: - # Fall back to fuser if lsof is unavailable - try: - procs = subprocess.check_output(["fuser", '-v', lockfile], stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - # File was deleted? - continue - except OSError as e: - if e.errno != errno.ENOENT: - raise - + procs = get_lockfile_process_msg(lockfile) msg = ["Delaying shutdown due to active processes which appear to be holding bitbake.lock"] if procs: - msg.append(":\n%s" % str(procs.decode("utf-8"))) + msg.append(":\n%s" % procs) serverlog("".join(msg)) - def idle_commands(self, delay, fds=None): - nextsleep = delay - if not fds: + def idle_thread(self): + def remove_idle_func(function): + with bb.utils.lock_timeout(self._idlefuncsLock): + del self._idlefuns[function] + self.idle_cond.notify_all() + + while not self.quit: + nextsleep = 0.1 fds = [] - for function, data in list(self._idlefuns.items()): - try: - retval = function(self, data, False) - if retval is False: - del self._idlefuns[function] - nextsleep = None - elif retval is True: - nextsleep = None - elif isinstance(retval, float) and nextsleep: - if (retval < nextsleep): - nextsleep = retval - elif nextsleep is None: - continue - else: - fds = fds + retval - except SystemExit: - raise - except Exception as exc: - if not isinstance(exc, bb.BBHandledException): - logger.exception('Running idle function') - del self._idlefuns[function] - self.quit = True + self.cooker.process_inotify_updates() + + with bb.utils.lock_timeout(self._idlefuncsLock): + items = list(self._idlefuns.items()) - # Create new heartbeat event? - now = time.time() - if now >= self.next_heartbeat: - # We might have missed heartbeats. Just trigger once in - # that case and continue after the usual delay. - self.next_heartbeat += self.heartbeat_seconds - if self.next_heartbeat <= now: - self.next_heartbeat = now + self.heartbeat_seconds - if hasattr(self.cooker, "data"): - heartbeat = bb.event.HeartbeatEvent(now) + for function, data in items: try: - bb.event.fire(heartbeat, self.cooker.data) + retval = function(self, data, False) + if isinstance(retval, idleFinish): + serverlog("Removing idle function %s at idleFinish" % str(function)) + remove_idle_func(function) + self.cooker.command.finishAsyncCommand(retval.msg) + nextsleep = None + elif retval is False: + serverlog("Removing idle function %s" % str(function)) + remove_idle_func(function) + nextsleep = None + elif retval is True: + nextsleep = None + elif isinstance(retval, float) and nextsleep: + if (retval < nextsleep): + nextsleep = retval + elif nextsleep is None: + continue + else: + fds = fds + retval + except SystemExit: + raise except Exception as exc: if not isinstance(exc, bb.BBHandledException): - logger.exception('Running heartbeat function') + logger.exception('Running idle function') + remove_idle_func(function) + serverlog("Exception %s broke the idle_thread, exiting" % traceback.format_exc()) self.quit = True - if nextsleep and now + nextsleep > self.next_heartbeat: - # Shorten timeout so that we we wake up in time for - # the heartbeat. - nextsleep = self.next_heartbeat - now + + # Create new heartbeat event? + now = time.time() + if bb.event._heartbeat_enabled and now >= self.next_heartbeat: + # We might have missed heartbeats. Just trigger once in + # that case and continue after the usual delay. + self.next_heartbeat += self.heartbeat_seconds + if self.next_heartbeat <= now: + self.next_heartbeat = now + self.heartbeat_seconds + if hasattr(self.cooker, "data"): + heartbeat = bb.event.HeartbeatEvent(now) + try: + bb.event.fire(heartbeat, self.cooker.data) + except Exception as exc: + if not isinstance(exc, bb.BBHandledException): + logger.exception('Running heartbeat function') + serverlog("Exception %s broke in idle_thread, exiting" % traceback.format_exc()) + self.quit = True + if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat: + # Shorten timeout so that we we wake up in time for + # the heartbeat. + nextsleep = self.next_heartbeat - now + + if nextsleep is not None: + select.select(fds,[],[],nextsleep)[0] + + def idle_commands(self, delay, fds=None): + nextsleep = delay + if not fds: + fds = [] + + if not self.idle: + self.idle = threading.Thread(target=self.idle_thread) + self.idle.start() if nextsleep is not None: if self.xmlrpc: @@ -448,13 +540,14 @@ start_log_datetime_format = '%Y-%m-%d %H:%M:%S.%f' class BitBakeServer(object): - def __init__(self, lock, sockname, featureset, server_timeout, xmlrpcinterface): + def __init__(self, lock, sockname, featureset, server_timeout, xmlrpcinterface, profile): self.server_timeout = server_timeout self.xmlrpcinterface = xmlrpcinterface self.featureset = featureset self.sockname = sockname self.bitbake_lock = lock + self.profile = profile self.readypipe, self.readypipein = os.pipe() # Place the log in the builddirectory alongside the lock file @@ -518,9 +611,9 @@ class BitBakeServer(object): os.set_inheritable(self.bitbake_lock.fileno(), True) os.set_inheritable(self.readypipein, True) serverscript = os.path.realpath(os.path.dirname(__file__) + "/../../../bin/bitbake-server") - os.execl(sys.executable, "bitbake-server", serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname, str(self.server_timeout or 0), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1])) + os.execl(sys.executable, "bitbake-server", serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname, str(self.server_timeout or 0), str(int(self.profile)), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1])) -def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpcinterface): +def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpcinterface, profile): import bb.cookerdata import bb.cooker @@ -532,6 +625,7 @@ def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpc # Create server control socket if os.path.exists(sockname): + serverlog("WARNING: removing existing socket file '%s'" % sockname) os.unlink(sockname) sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) @@ -548,7 +642,8 @@ def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpc writer = ConnectionWriter(readypipeinfd) try: featureset = [] - cooker = bb.cooker.BBCooker(featureset, server.register_idle_function) + cooker = bb.cooker.BBCooker(featureset, server) + cooker.configuration.profile = profile except bb.BBHandledException: return None writer.send("r") @@ -667,7 +762,7 @@ class BBUIEventQueue: self.t.start() def getEvent(self): - with self.eventQueueLock: + with bb.utils.lock_timeout(self.eventQueueLock): if len(self.eventQueue) == 0: return None @@ -682,7 +777,7 @@ class BBUIEventQueue: return self.getEvent() def queue_event(self, event): - with self.eventQueueLock: + with bb.utils.lock_timeout(self.eventQueueLock): self.eventQueue.append(event) self.eventQueueNotify.set() @@ -718,7 +813,7 @@ class ConnectionReader(object): return self.reader.poll(timeout) def get(self): - with self.rlock: + with bb.utils.lock_timeout(self.rlock): res = self.reader.recv_bytes() return multiprocessing.reduction.ForkingPickler.loads(res) @@ -739,7 +834,7 @@ class ConnectionWriter(object): def _send(self, obj): gc.disable() - with self.wlock: + with bb.utils.lock_timeout(self.wlock): self.writer.send_bytes(obj) gc.enable() @@ -752,7 +847,7 @@ class ConnectionWriter(object): # pthread_sigmask block/unblock would be nice but doesn't work, https://bugs.python.org/issue47139 process = multiprocessing.current_process() if process and hasattr(process, "queue_signals"): - with process.signal_threadlock: + with bb.utils.lock_timeout(process.signal_threadlock): process.queue_signals = True self._send(obj) process.queue_signals = False diff --git a/poky/bitbake/lib/bb/server/xmlrpcserver.py b/poky/bitbake/lib/bb/server/xmlrpcserver.py index 01f55538ae..2e65dc34a9 100644 --- a/poky/bitbake/lib/bb/server/xmlrpcserver.py +++ b/poky/bitbake/lib/bb/server/xmlrpcserver.py @@ -118,7 +118,7 @@ class BitBakeXMLRPCServerCommands(): """ Run a cooker command on the server """ - return self.server.cooker.command.runCommand(command, self.server.readonly) + return self.server.cooker.command.runCommand(command, self.server, self.server.readonly) def getEventHandle(self): return self.event_handle diff --git a/poky/bitbake/lib/bb/siggen.py b/poky/bitbake/lib/bb/siggen.py index 07bb529452..0e79404f76 100644 --- a/poky/bitbake/lib/bb/siggen.py +++ b/poky/bitbake/lib/bb/siggen.py @@ -14,6 +14,7 @@ import bb.data import difflib import simplediff import json +import types import bb.compress.zstd from bb.checksum import FileChecksumCache from bb import runqueue @@ -25,13 +26,13 @@ hashequiv_logger = logging.getLogger('BitBake.SigGen.HashEquiv') class SetEncoder(json.JSONEncoder): def default(self, obj): - if isinstance(obj, set): + if isinstance(obj, set) or isinstance(obj, frozenset): return dict(_set_object=list(sorted(obj))) return json.JSONEncoder.default(self, obj) def SetDecoder(dct): if '_set_object' in dct: - return set(dct['_set_object']) + return frozenset(dct['_set_object']) return dct def init(d): @@ -53,11 +54,6 @@ class SignatureGenerator(object): """ name = "noop" - # If the derived class supports multiconfig datacaches, set this to True - # The default is False for backward compatibility with derived signature - # generators that do not understand multiconfig caches - supports_multiconfig_datacaches = False - def __init__(self, data): self.basehash = {} self.taskhash = {} @@ -75,6 +71,27 @@ class SignatureGenerator(object): def postparsing_clean_cache(self): return + def setup_datacache(self, datacaches): + self.datacaches = datacaches + + def setup_datacache_from_datastore(self, mcfn, d): + # In task context we have no cache so setup internal data structures + # from the fully parsed data store provided + + mc = d.getVar("__BBMULTICONFIG", False) or "" + tasks = d.getVar('__BBTASKS', False) + + self.datacaches = {} + self.datacaches[mc] = types.SimpleNamespace() + setattr(self.datacaches[mc], "stamp", {}) + self.datacaches[mc].stamp[mcfn] = d.getVar('STAMP') + setattr(self.datacaches[mc], "stamp_extrainfo", {}) + self.datacaches[mc].stamp_extrainfo[mcfn] = {} + for t in tasks: + flag = d.getVarFlag(t, "stamp-extra-info") + if flag: + self.datacaches[mc].stamp_extrainfo[mcfn][t] = flag + def get_unihash(self, tid): return self.taskhash[tid] @@ -89,17 +106,51 @@ class SignatureGenerator(object): """Write/update the file checksum cache onto disk""" return + def stampfile_base(self, mcfn): + mc = bb.runqueue.mc_from_tid(mcfn) + return self.datacaches[mc].stamp[mcfn] + + def stampfile_mcfn(self, taskname, mcfn, extrainfo=True): + mc = bb.runqueue.mc_from_tid(mcfn) + stamp = self.datacaches[mc].stamp[mcfn] + if not stamp: + return + + stamp_extrainfo = "" + if extrainfo: + taskflagname = taskname + if taskname.endswith("_setscene"): + taskflagname = taskname.replace("_setscene", "") + stamp_extrainfo = self.datacaches[mc].stamp_extrainfo[mcfn].get(taskflagname) or "" + + return self.stampfile(stamp, mcfn, taskname, stamp_extrainfo) + def stampfile(self, stampbase, file_name, taskname, extrainfo): return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') + def stampcleanmask_mcfn(self, taskname, mcfn): + mc = bb.runqueue.mc_from_tid(mcfn) + stamp = self.datacaches[mc].stamp[mcfn] + if not stamp: + return [] + + taskflagname = taskname + if taskname.endswith("_setscene"): + taskflagname = taskname.replace("_setscene", "") + stamp_extrainfo = self.datacaches[mc].stamp_extrainfo[mcfn].get(taskflagname) or "" + + return self.stampcleanmask(stamp, mcfn, taskname, stamp_extrainfo) + def stampcleanmask(self, stampbase, file_name, taskname, extrainfo): return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') - def dump_sigtask(self, fn, task, stampbase, runtime): + def dump_sigtask(self, mcfn, task, stampbase, runtime): return - def invalidate_task(self, task, d, fn): - bb.build.del_stamp(task, d, fn) + def invalidate_task(self, task, mcfn): + mc = bb.runqueue.mc_from_tid(mcfn) + stamp = self.datacaches[mc].stamp[mcfn] + bb.utils.remove(stamp) def dump_sigs(self, dataCache, options): return @@ -128,38 +179,6 @@ class SignatureGenerator(object): def set_setscene_tasks(self, setscene_tasks): return - @classmethod - def get_data_caches(cls, dataCaches, mc): - """ - This function returns the datacaches that should be passed to signature - generator functions. If the signature generator supports multiconfig - caches, the entire dictionary of data caches is sent, otherwise a - special proxy is sent that support both index access to all - multiconfigs, and also direct access for the default multiconfig. - - The proxy class allows code in this class itself to always use - multiconfig aware code (to ease maintenance), but derived classes that - are unaware of multiconfig data caches can still access the default - multiconfig as expected. - - Do not override this function in derived classes; it will be removed in - the future when support for multiconfig data caches is mandatory - """ - class DataCacheProxy(object): - def __init__(self): - pass - - def __getitem__(self, key): - return dataCaches[key] - - def __getattr__(self, name): - return getattr(dataCaches[mc], name) - - if cls.supports_multiconfig_datacaches: - return dataCaches - - return DataCacheProxy() - def exit(self): return @@ -172,12 +191,9 @@ class SignatureGeneratorBasic(SignatureGenerator): self.basehash = {} self.taskhash = {} self.unihash = {} - self.taskdeps = {} self.runtaskdeps = {} self.file_checksum_values = {} self.taints = {} - self.gendeps = {} - self.lookupcache = {} self.setscenetasks = set() self.basehash_ignore_vars = set((data.getVar("BB_BASEHASH_IGNORE_VARS") or "").split()) self.taskhash_ignore_tasks = None @@ -201,15 +217,15 @@ class SignatureGeneratorBasic(SignatureGenerator): else: self.twl = None - def _build_data(self, fn, d): + def _build_data(self, mcfn, d): ignore_mismatch = ((d.getVar("BB_HASH_IGNORE_MISMATCH") or '') == '1') tasklist, gendeps, lookupcache = bb.data.generate_dependencies(d, self.basehash_ignore_vars) - taskdeps, basehash = bb.data.generate_dependency_hash(tasklist, gendeps, lookupcache, self.basehash_ignore_vars, fn) + taskdeps, basehash = bb.data.generate_dependency_hash(tasklist, gendeps, lookupcache, self.basehash_ignore_vars, mcfn) for task in tasklist: - tid = fn + ":" + task + tid = mcfn + ":" + task if not ignore_mismatch and tid in self.basehash and self.basehash[tid] != basehash[tid]: bb.error("When reparsing %s, the basehash value changed from %s to %s. The metadata is not deterministic and this needs to be fixed." % (tid, self.basehash[tid], basehash[tid])) bb.error("The following commands may help:") @@ -220,11 +236,7 @@ class SignatureGeneratorBasic(SignatureGenerator): bb.error("%s -Sprintdiff\n" % cmd) self.basehash[tid] = basehash[tid] - self.taskdeps[fn] = taskdeps - self.gendeps[fn] = gendeps - self.lookupcache[fn] = lookupcache - - return taskdeps + return taskdeps, gendeps, lookupcache def set_setscene_tasks(self, setscene_tasks): self.setscenetasks = set(setscene_tasks) @@ -232,31 +244,41 @@ class SignatureGeneratorBasic(SignatureGenerator): def finalise(self, fn, d, variant): mc = d.getVar("__BBMULTICONFIG", False) or "" + mcfn = fn if variant or mc: - fn = bb.cache.realfn2virtual(fn, variant, mc) + mcfn = bb.cache.realfn2virtual(fn, variant, mc) try: - taskdeps = self._build_data(fn, d) + taskdeps, gendeps, lookupcache = self._build_data(mcfn, d) except bb.parse.SkipRecipe: raise except: - bb.warn("Error during finalise of %s" % fn) + bb.warn("Error during finalise of %s" % mcfn) raise #Slow but can be useful for debugging mismatched basehashes - #for task in self.taskdeps[fn]: - # self.dump_sigtask(fn, task, d.getVar("STAMP"), False) + #for task in self.taskdeps[mcfn]: + # self.dump_sigtask(mcfn, task, d.getVar("STAMP"), False) + basehashes = {} for task in taskdeps: - d.setVar("BB_BASEHASH:task-%s" % task, self.basehash[fn + ":" + task]) + basehashes[task] = self.basehash[mcfn + ":" + task] - def postparsing_clean_cache(self): - # - # After parsing we can remove some things from memory to reduce our memory footprint - # - self.gendeps = {} - self.lookupcache = {} - self.taskdeps = {} + d.setVar("__siggen_basehashes", basehashes) + d.setVar("__siggen_gendeps", gendeps) + d.setVar("__siggen_varvals", lookupcache) + d.setVar("__siggen_taskdeps", taskdeps) + + def setup_datacache_from_datastore(self, mcfn, d): + super().setup_datacache_from_datastore(mcfn, d) + + mc = bb.runqueue.mc_from_tid(mcfn) + for attr in ["siggen_varvals", "siggen_taskdeps", "siggen_gendeps"]: + if not hasattr(self.datacaches[mc], attr): + setattr(self.datacaches[mc], attr, {}) + self.datacaches[mc].siggen_varvals[mcfn] = d.getVar("__siggen_varvals") + self.datacaches[mc].siggen_taskdeps[mcfn] = d.getVar("__siggen_taskdeps") + self.datacaches[mc].siggen_gendeps[mcfn] = d.getVar("__siggen_gendeps") def rundep_check(self, fn, recipename, task, dep, depname, dataCaches): # Return True if we should keep the dependency, False to drop it @@ -279,38 +301,33 @@ class SignatureGeneratorBasic(SignatureGenerator): def prep_taskhash(self, tid, deps, dataCaches): - (mc, _, task, fn) = bb.runqueue.split_tid_mcfn(tid) + (mc, _, task, mcfn) = bb.runqueue.split_tid_mcfn(tid) self.basehash[tid] = dataCaches[mc].basetaskhash[tid] self.runtaskdeps[tid] = [] self.file_checksum_values[tid] = [] - recipename = dataCaches[mc].pkg_fn[fn] + recipename = dataCaches[mc].pkg_fn[mcfn] self.tidtopn[tid] = recipename for dep in sorted(deps, key=clean_basepath): (depmc, _, _, depmcfn) = bb.runqueue.split_tid_mcfn(dep) depname = dataCaches[depmc].pkg_fn[depmcfn] - if not self.supports_multiconfig_datacaches and mc != depmc: - # If the signature generator doesn't understand multiconfig - # data caches, any dependency not in the same multiconfig must - # be skipped for backward compatibility - continue - if not self.rundep_check(fn, recipename, task, dep, depname, dataCaches): + if not self.rundep_check(mcfn, recipename, task, dep, depname, dataCaches): continue if dep not in self.taskhash: bb.fatal("%s is not in taskhash, caller isn't calling in dependency order?" % dep) self.runtaskdeps[tid].append(dep) - if task in dataCaches[mc].file_checksums[fn]: + if task in dataCaches[mc].file_checksums[mcfn]: if self.checksum_cache: - checksums = self.checksum_cache.get_checksums(dataCaches[mc].file_checksums[fn][task], recipename, self.localdirsexclude) + checksums = self.checksum_cache.get_checksums(dataCaches[mc].file_checksums[mcfn][task], recipename, self.localdirsexclude) else: - checksums = bb.fetch2.get_file_checksums(dataCaches[mc].file_checksums[fn][task], recipename, self.localdirsexclude) + checksums = bb.fetch2.get_file_checksums(dataCaches[mc].file_checksums[mcfn][task], recipename, self.localdirsexclude) for (f,cs) in checksums: self.file_checksum_values[tid].append((f,cs)) - taskdep = dataCaches[mc].task_deps[fn] + taskdep = dataCaches[mc].task_deps[mcfn] if 'nostamp' in taskdep and task in taskdep['nostamp']: # Nostamp tasks need an implicit taint so that they force any dependent tasks to run if tid in self.taints and self.taints[tid].startswith("nostamp:"): @@ -321,7 +338,7 @@ class SignatureGeneratorBasic(SignatureGenerator): taint = str(uuid.uuid4()) self.taints[tid] = "nostamp:" + taint - taint = self.read_taint(fn, task, dataCaches[mc].stamp[fn]) + taint = self.read_taint(mcfn, task, dataCaches[mc].stamp[mcfn]) if taint: self.taints[tid] = taint logger.warning("%s is tainted from a forced run" % tid) @@ -366,9 +383,9 @@ class SignatureGeneratorBasic(SignatureGenerator): def copy_unitaskhashes(self, targetdir): self.unihash_cache.copyfile(targetdir) - def dump_sigtask(self, fn, task, stampbase, runtime): - - tid = fn + ":" + task + def dump_sigtask(self, mcfn, task, stampbase, runtime): + tid = mcfn + ":" + task + mc = bb.runqueue.mc_from_tid(mcfn) referencestamp = stampbase if isinstance(runtime, str) and runtime.startswith("customfile"): sigfile = stampbase @@ -385,16 +402,16 @@ class SignatureGeneratorBasic(SignatureGenerator): data['task'] = task data['basehash_ignore_vars'] = self.basehash_ignore_vars data['taskhash_ignore_tasks'] = self.taskhash_ignore_tasks - data['taskdeps'] = self.taskdeps[fn][task] + data['taskdeps'] = self.datacaches[mc].siggen_taskdeps[mcfn][task] data['basehash'] = self.basehash[tid] data['gendeps'] = {} data['varvals'] = {} - data['varvals'][task] = self.lookupcache[fn][task] - for dep in self.taskdeps[fn][task]: + data['varvals'][task] = self.datacaches[mc].siggen_varvals[mcfn][task] + for dep in self.datacaches[mc].siggen_taskdeps[mcfn][task]: if dep in self.basehash_ignore_vars: - continue - data['gendeps'][dep] = self.gendeps[fn][dep] - data['varvals'][dep] = self.lookupcache[fn][dep] + continue + data['gendeps'][dep] = self.datacaches[mc].siggen_gendeps[mcfn][dep] + data['varvals'][dep] = self.datacaches[mc].siggen_varvals[mcfn][dep] if runtime and tid in self.taskhash: data['runtaskdeps'] = self.runtaskdeps[tid] @@ -410,7 +427,7 @@ class SignatureGeneratorBasic(SignatureGenerator): data['taskhash'] = self.taskhash[tid] data['unihash'] = self.get_unihash(tid) - taint = self.read_taint(fn, task, referencestamp) + taint = self.read_taint(mcfn, task, referencestamp) if taint: data['taint'] = taint @@ -441,18 +458,6 @@ class SignatureGeneratorBasic(SignatureGenerator): pass raise err - def dump_sigfn(self, fn, dataCaches, options): - if fn in self.taskdeps: - for task in self.taskdeps[fn]: - tid = fn + ":" + task - mc = bb.runqueue.mc_from_tid(tid) - if tid not in self.taskhash: - continue - if dataCaches[mc].basetaskhash[tid] != self.basehash[tid]: - bb.error("Bitbake's cached basehash does not match the one we just generated (%s)!" % tid) - bb.error("The mismatched hashes were %s and %s" % (dataCaches[mc].basetaskhash[tid], self.basehash[tid])) - self.dump_sigtask(fn, task, dataCaches[mc].stamp[fn], True) - class SignatureGeneratorBasicHash(SignatureGeneratorBasic): name = "basichash" @@ -463,11 +468,11 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic): # If task is not in basehash, then error return self.basehash[tid] - def stampfile(self, stampbase, fn, taskname, extrainfo, clean=False): - if taskname != "do_setscene" and taskname.endswith("_setscene"): - tid = fn + ":" + taskname[:-9] + def stampfile(self, stampbase, mcfn, taskname, extrainfo, clean=False): + if taskname.endswith("_setscene"): + tid = mcfn + ":" + taskname[:-9] else: - tid = fn + ":" + taskname + tid = mcfn + ":" + taskname if clean: h = "*" else: @@ -475,12 +480,23 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic): return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.') - def stampcleanmask(self, stampbase, fn, taskname, extrainfo): - return self.stampfile(stampbase, fn, taskname, extrainfo, clean=True) + def stampcleanmask(self, stampbase, mcfn, taskname, extrainfo): + return self.stampfile(stampbase, mcfn, taskname, extrainfo, clean=True) + + def invalidate_task(self, task, mcfn): + bb.note("Tainting hash to force rebuild of task %s, %s" % (mcfn, task)) + + mc = bb.runqueue.mc_from_tid(mcfn) + stamp = self.datacaches[mc].stamp[mcfn] + + taintfn = stamp + '.' + task + '.taint' - def invalidate_task(self, task, d, fn): - bb.note("Tainting hash to force rebuild of task %s, %s" % (fn, task)) - bb.build.write_taint(task, d, fn) + import uuid + bb.utils.mkdirhier(os.path.dirname(taintfn)) + # The specific content of the taint file is not really important, + # we just need it to be random, so a random UUID is used + with open(taintfn, 'w') as taintf: + taintf.write(str(uuid.uuid4())) class SignatureGeneratorUniHashMixIn(object): def __init__(self, data): @@ -599,8 +615,8 @@ class SignatureGeneratorUniHashMixIn(object): unihash = d.getVar('BB_UNIHASH') report_taskdata = d.getVar('SSTATE_HASHEQUIV_REPORT_TASKDATA') == '1' tempdir = d.getVar('T') - fn = d.getVar('BB_FILENAME') - tid = fn + ':do_' + task + mcfn = d.getVar('BB_FILENAME') + tid = mcfn + ':do_' + task key = tid + ':' + taskhash if self.setscenetasks and tid not in self.setscenetasks: @@ -659,7 +675,7 @@ class SignatureGeneratorUniHashMixIn(object): if new_unihash != unihash: hashequiv_logger.debug('Task %s unihash changed %s -> %s by server %s' % (taskhash, unihash, new_unihash, self.server)) - bb.event.fire(bb.runqueue.taskUniHashUpdate(fn + ':do_' + task, new_unihash), d) + bb.event.fire(bb.runqueue.taskUniHashUpdate(mcfn + ':do_' + task, new_unihash), d) self.set_unihash(tid, new_unihash) d.setVar('BB_UNIHASH', new_unihash) else: @@ -719,19 +735,12 @@ class SignatureGeneratorTestEquivHash(SignatureGeneratorUniHashMixIn, SignatureG self.server = data.getVar('BB_HASHSERVE') self.method = "sstate_output_hash" -# -# Dummy class used for bitbake-selftest -# -class SignatureGeneratorTestMulticonfigDepends(SignatureGeneratorBasicHash): - name = "TestMulticonfigDepends" - supports_multiconfig_datacaches = True - def dump_this_task(outfile, d): import bb.parse - fn = d.getVar("BB_FILENAME") + mcfn = d.getVar("BB_FILENAME") task = "do_" + d.getVar("BB_CURRENTTASK") - referencestamp = bb.build.stamp_internal(task, d, None, True) - bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) + referencestamp = bb.parse.siggen.stampfile_base(mcfn) + bb.parse.siggen.dump_sigtask(mcfn, task, outfile, "customfile:" + referencestamp) def init_colors(enable_color): """Initialise colour dict for passing to compare_sigfiles()""" @@ -1056,7 +1065,7 @@ def calc_basehash(sigdata): basedata = '' alldeps = sigdata['taskdeps'] - for dep in alldeps: + for dep in sorted(alldeps): basedata = basedata + dep val = sigdata['varvals'][dep] if val is not None: diff --git a/poky/bitbake/lib/bb/tests/codeparser.py b/poky/bitbake/lib/bb/tests/codeparser.py index 71ed382ab8..a508f23bcb 100644 --- a/poky/bitbake/lib/bb/tests/codeparser.py +++ b/poky/bitbake/lib/bb/tests/codeparser.py @@ -318,7 +318,7 @@ d.getVar(a(), False) "filename": "example.bb", }) - deps, values = bb.data.build_dependencies("FOO", set(self.d.keys()), set(), set(), set(), self.d) + deps, values = bb.data.build_dependencies("FOO", set(self.d.keys()), set(), set(), set(), set(), self.d) self.assertEqual(deps, set(["somevar", "bar", "something", "inexpand", "test", "test2", "a"])) @@ -365,7 +365,7 @@ esac self.d.setVarFlags("FOO", {"func": True}) self.setEmptyVars(execs) - deps, values = bb.data.build_dependencies("FOO", set(self.d.keys()), set(), set(), set(), self.d) + deps, values = bb.data.build_dependencies("FOO", set(self.d.keys()), set(), set(), set(), set(), self.d) self.assertEqual(deps, set(["somevar", "inverted"] + execs)) @@ -375,7 +375,7 @@ esac self.d.setVar("FOO", "foo=oe_libinstall; eval $foo") self.d.setVarFlag("FOO", "vardeps", "oe_libinstall") - deps, values = bb.data.build_dependencies("FOO", set(self.d.keys()), set(), set(), set(), self.d) + deps, values = bb.data.build_dependencies("FOO", set(self.d.keys()), set(), set(), set(), set(), self.d) self.assertEqual(deps, set(["oe_libinstall"])) @@ -384,7 +384,7 @@ esac self.d.setVar("FOO", "foo=oe_libinstall; eval $foo") self.d.setVarFlag("FOO", "vardeps", "${@'oe_libinstall'}") - deps, values = bb.data.build_dependencies("FOO", set(self.d.keys()), set(), set(), set(), self.d) + deps, values = bb.data.build_dependencies("FOO", set(self.d.keys()), set(), set(), set(), set(), self.d) self.assertEqual(deps, set(["oe_libinstall"])) @@ -399,7 +399,7 @@ esac # Check dependencies self.d.setVar('ANOTHERVAR', expr) self.d.setVar('TESTVAR', 'anothervalue testval testval2') - deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), set(), self.d) + deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), set(), set(), self.d) self.assertEqual(sorted(values.splitlines()), sorted([expr, 'TESTVAR{anothervalue} = Set', @@ -418,14 +418,14 @@ esac self.d.setVar('ANOTHERVAR', varval) self.d.setVar('TESTVAR', 'anothervalue testval testval2') self.d.setVar('TESTVAR2', 'testval3') - deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), set(["TESTVAR"]), self.d) + deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), set(), set(["TESTVAR"]), self.d) self.assertEqual(sorted(values.splitlines()), sorted([varval])) self.assertEqual(deps, set(["TESTVAR2"])) self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['testval3', 'anothervalue']) # Check the vardepsexclude flag is handled by contains functionality self.d.setVarFlag('ANOTHERVAR', 'vardepsexclude', 'TESTVAR') - deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), set(), self.d) + deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), set(), set(), self.d) self.assertEqual(sorted(values.splitlines()), sorted([varval])) self.assertEqual(deps, set(["TESTVAR2"])) self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['testval3', 'anothervalue']) diff --git a/poky/bitbake/lib/bb/tests/color.py b/poky/bitbake/lib/bb/tests/color.py index 88dd278006..bb70cb393d 100644 --- a/poky/bitbake/lib/bb/tests/color.py +++ b/poky/bitbake/lib/bb/tests/color.py @@ -20,7 +20,7 @@ class ProgressWatcher: def __init__(self): self._reports = [] - def handle_event(self, event): + def handle_event(self, event, d): self._reports.append((event.progress, event.rate)) def reports(self): diff --git a/poky/bitbake/lib/bb/tests/event.py b/poky/bitbake/lib/bb/tests/event.py index 9ca7e9bc8e..d959f2d95d 100644 --- a/poky/bitbake/lib/bb/tests/event.py +++ b/poky/bitbake/lib/bb/tests/event.py @@ -157,7 +157,7 @@ class EventHandlingTest(unittest.TestCase): self._test_process.event_handler, event, None) - self._test_process.event_handler.assert_called_once_with(event) + self._test_process.event_handler.assert_called_once_with(event, None) def test_fire_class_handlers(self): """ Test fire_class_handlers method """ @@ -175,10 +175,10 @@ class EventHandlingTest(unittest.TestCase): bb.event.fire_class_handlers(event1, None) bb.event.fire_class_handlers(event2, None) bb.event.fire_class_handlers(event2, None) - expected_event_handler1 = [call(event1)] - expected_event_handler2 = [call(event1), - call(event2), - call(event2)] + expected_event_handler1 = [call(event1, None)] + expected_event_handler2 = [call(event1, None), + call(event2, None), + call(event2, None)] self.assertEqual(self._test_process.event_handler1.call_args_list, expected_event_handler1) self.assertEqual(self._test_process.event_handler2.call_args_list, @@ -205,7 +205,7 @@ class EventHandlingTest(unittest.TestCase): bb.event.fire_class_handlers(event2, None) bb.event.fire_class_handlers(event2, None) expected_event_handler1 = [] - expected_event_handler2 = [call(event1)] + expected_event_handler2 = [call(event1, None)] self.assertEqual(self._test_process.event_handler1.call_args_list, expected_event_handler1) self.assertEqual(self._test_process.event_handler2.call_args_list, @@ -223,7 +223,7 @@ class EventHandlingTest(unittest.TestCase): self.assertEqual(result, bb.event.Registered) bb.event.fire_class_handlers(event1, None) bb.event.fire_class_handlers(event2, None) - expected = [call(event1), call(event2)] + expected = [call(event1, None), call(event2, None)] self.assertEqual(self._test_process.event_handler1.call_args_list, expected) @@ -237,7 +237,7 @@ class EventHandlingTest(unittest.TestCase): self.assertEqual(result, bb.event.Registered) bb.event.fire_class_handlers(event1, None) bb.event.fire_class_handlers(event2, None) - expected = [call(event1), call(event2), call(event1)] + expected = [call(event1, None), call(event2, None), call(event1, None)] self.assertEqual(self._test_process.event_handler1.call_args_list, expected) @@ -251,7 +251,7 @@ class EventHandlingTest(unittest.TestCase): self.assertEqual(result, bb.event.Registered) bb.event.fire_class_handlers(event1, None) bb.event.fire_class_handlers(event2, None) - expected = [call(event1), call(event2), call(event1), call(event2)] + expected = [call(event1,None), call(event2, None), call(event1, None), call(event2, None)] self.assertEqual(self._test_process.event_handler1.call_args_list, expected) @@ -359,9 +359,10 @@ class EventHandlingTest(unittest.TestCase): event1 = bb.event.ConfigParsed() bb.event.fire(event1, None) - expected = [call(event1)] + expected = [call(event1, None)] self.assertEqual(self._test_process.event_handler1.call_args_list, expected) + expected = [call(event1)] self.assertEqual(self._test_ui1.event.send.call_args_list, expected) @@ -450,10 +451,9 @@ class EventHandlingTest(unittest.TestCase): and disable threadlocks tests """ bb.event.fire(bb.event.OperationStarted(), None) - def test_enable_threadlock(self): + def test_event_threadlock(self): """ Test enable_threadlock method """ self._set_threadlock_test_mockups() - bb.event.enable_threadlock() self._set_and_run_threadlock_test_workers() # Calls to UI handlers should be in order as all the registered # handlers for the event coming from the first worker should be @@ -461,20 +461,6 @@ class EventHandlingTest(unittest.TestCase): self.assertEqual(self._threadlock_test_calls, ["w1_ui1", "w1_ui2", "w2_ui1", "w2_ui2"]) - - def test_disable_threadlock(self): - """ Test disable_threadlock method """ - self._set_threadlock_test_mockups() - bb.event.disable_threadlock() - self._set_and_run_threadlock_test_workers() - # Calls to UI handlers should be intertwined together. Thanks to the - # delay in the registered handlers for the event coming from the first - # worker, the event coming from the second worker starts being - # processed before finishing handling the first worker event. - self.assertEqual(self._threadlock_test_calls, - ["w1_ui1", "w2_ui1", "w1_ui2", "w2_ui2"]) - - class EventClassesTest(unittest.TestCase): """ Event classes test class """ diff --git a/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/2.10/index.html b/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/2.10/index.html new file mode 100644 index 0000000000..4e41af6d6a --- /dev/null +++ b/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/2.10/index.html @@ -0,0 +1,20 @@ + + +Index of /sources/libxml2/2.10/ +

Index of /sources/libxml2/2.10/

+ + + + + + + + + + + + + + + +
File Name  ↓ File Size  ↓ Date  ↓ 
--
2.5 MiB2022-Oct-14 12:55
7.1 KiB2022-Aug-17 11:55
174 B2022-Aug-17 11:55
2.6 MiB2022-Aug-17 11:55
455 B2022-Aug-25 11:33
174 B2022-Aug-25 11:33
2.6 MiB2022-Aug-25 11:33
309 B2022-Aug-29 14:56
174 B2022-Aug-29 14:56
2.5 MiB2022-Aug-29 14:56
294 B2022-Oct-14 12:55
174 B2022-Oct-14 12:55
2.5 MiB2022-Oct-14 12:55
diff --git a/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/2.9/index.html b/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/2.9/index.html new file mode 100644 index 0000000000..abdfdd0fa2 --- /dev/null +++ b/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/2.9/index.html @@ -0,0 +1,40 @@ + + +Index of /sources/libxml2/2.9/ +

Index of /sources/libxml2/2.9/

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
File Name  ↓ File Size  ↓ Date  ↓ 
--
3.0 MiB2022-May-02 12:03
87 B2022-Feb-14 18:27
3.0 MiB2022-Feb-14 18:27
87 B2022-Feb-14 18:28
3.0 MiB2022-Feb-14 18:28
88 B2022-Feb-14 18:42
3.2 MiB2022-Feb-14 18:42
88 B2022-Feb-14 18:43
3.2 MiB2022-Feb-14 18:43
88 B2022-Feb-14 18:45
3.2 MiB2022-Feb-14 18:45
26.6 KiB2022-Feb-20 12:42
174 B2022-Feb-20 12:42
3.1 MiB2022-Feb-20 12:42
1.0 KiB2022-May-02 12:03
174 B2022-May-02 12:03
3.0 MiB2022-May-02 12:03
87 B2022-Feb-14 18:30
3.2 MiB2022-Feb-14 18:30
87 B2022-Feb-14 18:31
3.2 MiB2022-Feb-14 18:31
87 B2022-Feb-14 18:33
2.9 MiB2022-Feb-14 18:33
87 B2022-Feb-14 18:35
3.0 MiB2022-Feb-14 18:35
87 B2022-Feb-14 18:36
3.0 MiB2022-Feb-14 18:36
87 B2022-Feb-14 18:37
3.0 MiB2022-Feb-14 18:37
87 B2022-Feb-14 18:39
3.0 MiB2022-Feb-14 18:39
87 B2022-Feb-14 18:40
3.0 MiB2022-Feb-14 18:40
diff --git a/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/index.html b/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/index.html new file mode 100644 index 0000000000..c183e06a55 --- /dev/null +++ b/poky/bitbake/lib/bb/tests/fetch-testdata/software/libxml2/index.html @@ -0,0 +1,19 @@ + + +Index of /sources/libxml2/ +

Index of /sources/libxml2/

+ + + + + + + + + + + + + + +
File Name  ↓ File Size  ↓ Date  ↓ 
--
-2009-Jul-14 13:04
-2009-Jul-14 13:04
-2022-Oct-14 12:55
-2009-Jul-14 13:04
-2009-Jul-14 13:05
-2009-Jul-14 13:05
-2009-Jul-14 13:05
-2009-Jul-14 13:05
-2022-Feb-14 18:24
-2022-Feb-14 18:26
-2022-May-02 12:04
22.8 KiB2022-Oct-14 12:55
diff --git a/poky/bitbake/lib/bb/tests/fetch.py b/poky/bitbake/lib/bb/tests/fetch.py index 0af06e46e5..ad3d4dea7d 100644 --- a/poky/bitbake/lib/bb/tests/fetch.py +++ b/poky/bitbake/lib/bb/tests/fetch.py @@ -1401,6 +1401,9 @@ class FetchLatestVersionTest(FetcherTest): # http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz ("cmake", "/files/v2.8/cmake-2.8.12.1.tar.gz", "", "") : "2.8.12.1", + # https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.tar.xz + ("libxml2", "/software/libxml2/2.9/libxml2-2.9.14.tar.xz", "", "") + : "2.10.3", # # packages with versions only in current directory # diff --git a/poky/bitbake/lib/bb/tests/runqueue.py b/poky/bitbake/lib/bb/tests/runqueue.py index 061a5a1f80..cc87e8d6a8 100644 --- a/poky/bitbake/lib/bb/tests/runqueue.py +++ b/poky/bitbake/lib/bb/tests/runqueue.py @@ -288,7 +288,7 @@ class RunQueueTests(unittest.TestCase): with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: extraenv = { "BBMULTICONFIG" : "mc-1 mc_2", - "BB_SIGNATURE_HANDLER" : "TestMulticonfigDepends", + "BB_SIGNATURE_HANDLER" : "basichash", "EXTRA_BBFILES": "${COREBASE}/recipes/fails-mc/*.bb", } tasks = self.run_bitbakecmd(["bitbake", "mc:mc-1:f1"], tempdir, "", extraenv=extraenv, cleanup=True) diff --git a/poky/bitbake/lib/bb/tinfoil.py b/poky/bitbake/lib/bb/tinfoil.py index e68a3b879a..91fbf1b13e 100644 --- a/poky/bitbake/lib/bb/tinfoil.py +++ b/poky/bitbake/lib/bb/tinfoil.py @@ -10,6 +10,7 @@ import logging import os import sys +import time import atexit import re from collections import OrderedDict, defaultdict @@ -729,6 +730,7 @@ class Tinfoil: ret = self.run_command('buildTargets', targets, task) if handle_events: + lastevent = time.time() result = False # Borrowed from knotty, instead somewhat hackily we use the helper # as the object to store "shutdown" on @@ -741,6 +743,7 @@ class Tinfoil: try: event = self.wait_event(0.25) if event: + lastevent = time.time() if event_callback and event_callback(event): continue if helper.eventHandler(event): @@ -773,7 +776,7 @@ class Tinfoil: if isinstance(event, bb.command.CommandCompleted): result = True break - if isinstance(event, bb.command.CommandFailed): + if isinstance(event, (bb.command.CommandFailed, bb.command.CommandExit)): self.logger.error(str(event)) result = False break @@ -785,10 +788,13 @@ class Tinfoil: self.logger.error(str(event)) result = False break - elif helper.shutdown > 1: break termfilter.updateFooter() + if time.time() > (lastevent + (3*60)): + if not self.run_command('ping', handle_events=False): + print("\nUnable to ping server and no events, closing down...\n") + return False except KeyboardInterrupt: termfilter.clearFooter() if helper.shutdown == 1: diff --git a/poky/bitbake/lib/bb/ui/knotty.py b/poky/bitbake/lib/bb/ui/knotty.py index 61cf0a37f4..431baa15ef 100644 --- a/poky/bitbake/lib/bb/ui/knotty.py +++ b/poky/bitbake/lib/bb/ui/knotty.py @@ -625,25 +625,38 @@ def main(server, eventHandler, params, tf = TerminalFilter): printintervaldelta = 10 * 60 # 10 minutes printinterval = printintervaldelta - lastprint = time.time() + pinginterval = 1 * 60 # 1 minute + lastevent = lastprint = time.time() termfilter = tf(main, helper, console_handlers, params.options.quiet) atexit.register(termfilter.finish) - while True: + # shutdown levels + # 0 - normal operation + # 1 - no new task execution, let current running tasks finish + # 2 - interrupting currently executing tasks + # 3 - we're done, exit + while main.shutdown < 3: try: if (lastprint + printinterval) <= time.time(): termfilter.keepAlive(printinterval) printinterval += printintervaldelta event = eventHandler.waitEvent(0) if event is None: - if main.shutdown > 1: - break + if (lastevent + pinginterval) <= time.time(): + ret, error = server.runCommand(["ping"]) + if error or not ret: + termfilter.clearFooter() + print("No reply after pinging server (%s, %s), exiting." % (str(error), str(ret))) + return_value = 3 + main.shutdown = 3 + lastevent = time.time() if not parseprogress: termfilter.updateFooter() event = eventHandler.waitEvent(0.25) if event is None: continue + lastevent = time.time() helper.eventHandler(event) if isinstance(event, bb.runqueue.runQueueExitWait): if not main.shutdown: @@ -748,15 +761,15 @@ def main(server, eventHandler, params, tf = TerminalFilter): if event.error: errors = errors + 1 logger.error(str(event)) - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, bb.command.CommandExit): if not return_value: return_value = event.exitcode - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, (bb.command.CommandCompleted, bb.cooker.CookerExit)): - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, bb.event.MultipleProviders): logger.info(str(event)) diff --git a/poky/bitbake/lib/bb/ui/uievent.py b/poky/bitbake/lib/bb/ui/uievent.py index d595f172ac..adbe698939 100644 --- a/poky/bitbake/lib/bb/ui/uievent.py +++ b/poky/bitbake/lib/bb/ui/uievent.py @@ -70,30 +70,22 @@ class BBUIEventQueue: self.t.start() def getEvent(self): - - self.eventQueueLock.acquire() - - if not self.eventQueue: - self.eventQueueLock.release() - return None - - item = self.eventQueue.pop(0) - - if not self.eventQueue: - self.eventQueueNotify.clear() - - self.eventQueueLock.release() - return item + with bb.utils.lock_timeout(self.eventQueueLock): + if not self.eventQueue: + return None + item = self.eventQueue.pop(0) + if not self.eventQueue: + self.eventQueueNotify.clear() + return item def waitEvent(self, delay): self.eventQueueNotify.wait(delay) return self.getEvent() def queue_event(self, event): - self.eventQueueLock.acquire() - self.eventQueue.append(event) - self.eventQueueNotify.set() - self.eventQueueLock.release() + with bb.utils.lock_timeout(self.eventQueueLock): + self.eventQueue.append(event) + self.eventQueueNotify.set() def send_event(self, event): self.queue_event(pickle.loads(event)) diff --git a/poky/bitbake/lib/bb/utils.py b/poky/bitbake/lib/bb/utils.py index 64a004d0d8..8c79159573 100644 --- a/poky/bitbake/lib/bb/utils.py +++ b/poky/bitbake/lib/bb/utils.py @@ -13,6 +13,7 @@ import errno import logging import bb import bb.msg +import locale import multiprocessing import fcntl import importlib @@ -608,6 +609,21 @@ def preserved_envvars(): ] return v + preserved_envvars_exported() +def check_system_locale(): + """Make sure the required system locale are available and configured""" + default_locale = locale.getlocale(locale.LC_CTYPE) + + try: + locale.setlocale(locale.LC_CTYPE, ("en_US", "UTF-8")) + except: + sys.exit("Please make sure locale 'en_US.UTF-8' is available on your system") + else: + locale.setlocale(locale.LC_CTYPE, default_locale) + + if sys.getfilesystemencoding() != "utf-8": + sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\n" + "Python can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.") + def filter_environment(good_vars): """ Create a pristine environment for bitbake. This will remove variables that @@ -992,6 +1008,9 @@ def to_boolean(string, default=None): if not string: return default + if isinstance(string, int): + return string != 0 + normalized = string.lower() if normalized in ("y", "yes", "1", "true"): return True @@ -1822,3 +1841,16 @@ def mkstemp(suffix=None, prefix=None, dir=None, text=False): else: prefix = tempfile.gettempprefix() + entropy return tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir, text=text) + +# If we don't have a timeout of some kind and a process/thread exits badly (for example +# OOM killed) and held a lock, we'd just hang in the lock futex forever. It is better +# we exit at some point than hang. 5 minutes with no progress means we're probably deadlocked. +@contextmanager +def lock_timeout(lock): + held = lock.acquire(timeout=5*60) + try: + if not held: + os._exit(1) + yield held + finally: + lock.release() diff --git a/poky/documentation/.gitignore b/poky/documentation/.gitignore index 4e077d03fb..494b4f4de5 100644 --- a/poky/documentation/.gitignore +++ b/poky/documentation/.gitignore @@ -1,3 +1,4 @@ +sphinx/__pycache__ _build/ Pipfile.lock poky.yaml diff --git a/poky/documentation/_templates/footer.html b/poky/documentation/_templates/footer.html index 508129ede4..fb3c58d845 100644 --- a/poky/documentation/_templates/footer.html +++ b/poky/documentation/_templates/footer.html @@ -5,7 +5,7 @@
All Rights Reserved. Linux Foundation® and Yocto Project® are registered trademarks of the Linux Foundation.
Linux® is a registered trademark of Linus Torvalds.
© Copyright {{ copyright }} -
Last updated on {{ last_updated }} +
Last updated on {{ last_updated }} from the yocto-docs git repository.

diff --git a/poky/documentation/boilerplate.rst b/poky/documentation/boilerplate.rst index ad7bb64956..6b7f956707 100644 --- a/poky/documentation/boilerplate.rst +++ b/poky/documentation/boilerplate.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + .. include:: .. include:: diff --git a/poky/documentation/brief-yoctoprojectqs/index.rst b/poky/documentation/brief-yoctoprojectqs/index.rst index d322bbca6b..cfdd14ae4a 100644 --- a/poky/documentation/brief-yoctoprojectqs/index.rst +++ b/poky/documentation/brief-yoctoprojectqs/index.rst @@ -361,7 +361,7 @@ Follow these steps to add a hardware layer: You can find more information on adding layers in the - :ref:`dev-manual/common-tasks:adding a layer using the \`\`bitbake-layers\`\` script` + :ref:`dev-manual/layers:adding a layer using the \`\`bitbake-layers\`\` script` section. Completing these steps has added the ``meta-altera`` layer to your Yocto @@ -396,7 +396,7 @@ The following commands run the tool to create a layer named For more information on layers and how to create them, see the -:ref:`dev-manual/common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script` +:ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script` section in the Yocto Project Development Tasks Manual. Where To Go Next diff --git a/poky/documentation/bsp-guide/bsp.rst b/poky/documentation/bsp-guide/bsp.rst index 117056ebd1..fccf059ccc 100644 --- a/poky/documentation/bsp-guide/bsp.rst +++ b/poky/documentation/bsp-guide/bsp.rst @@ -127,7 +127,7 @@ you want to work with, such as:: and so on. For more information on layers, see the -":ref:`dev-manual/common-tasks:understanding and creating layers`" +":ref:`dev-manual/layers:understanding and creating layers`" section of the Yocto Project Development Tasks Manual. Preparing Your Build Host to Work With BSP Layers @@ -463,7 +463,7 @@ requirements are handled with the ``COPYING.MIT`` file. Licensing files can be MIT, BSD, GPLv*, and so forth. These files are recommended for the BSP but are optional and totally up to the BSP developer. For information on how to maintain license compliance, see -the ":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`" +the ":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`" section in the Yocto Project Development Tasks Manual. README File @@ -589,7 +589,7 @@ filenames correspond to the values to which users have set the These files define things such as the kernel package to use (:term:`PREFERRED_PROVIDER` of -:ref:`virtual/kernel `), +:ref:`virtual/kernel `), the hardware drivers to include in different types of images, any special software components that are needed, any bootloader information, and also any special image format requirements. @@ -757,7 +757,7 @@ workflow. OpenEmbedded build system knows about. For more information on layers, see the ":ref:`overview-manual/yp-intro:the yocto project layer model`" section in the Yocto Project Overview and Concepts Manual. You can also - reference the ":ref:`dev-manual/common-tasks:understanding and creating layers`" + reference the ":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual. For more information on BSP layers, see the ":ref:`bsp-guide/bsp:bsp layers`" section. @@ -816,7 +816,7 @@ workflow. key configuration files are configured appropriately: the ``conf/local.conf`` and the ``conf/bblayers.conf`` file. You must make the OpenEmbedded build system aware of your new layer. See the - ":ref:`dev-manual/common-tasks:enabling your layer`" + ":ref:`dev-manual/layers:enabling your layer`" section in the Yocto Project Development Tasks Manual for information on how to let the build system know about your new layer. @@ -845,7 +845,7 @@ Before looking at BSP requirements, you should consider the following: layer that can be added to the Yocto Project. For guidelines on creating a layer that meets these base requirements, see the ":ref:`bsp-guide/bsp:bsp layers`" section in this manual and the - ":ref:`dev-manual/common-tasks:understanding and creating layers`" + ":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual. - The requirements in this section apply regardless of how you package @@ -927,7 +927,7 @@ Yocto Project: - The name and contact information for the BSP layer maintainer. This is the person to whom patches and questions should be sent. For information on how to find the right person, see the - ":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" + ":ref:`dev-manual/changes:submitting a change to the yocto project`" section in the Yocto Project Development Tasks Manual. - Instructions on how to build the BSP using the BSP layer. @@ -1013,7 +1013,7 @@ the following: - Create a ``*.bbappend`` file for the modified recipe. For information on using append files, see the - ":ref:`dev-manual/common-tasks:appending other layers metadata with your layer`" + ":ref:`dev-manual/layers:appending other layers metadata with your layer`" section in the Yocto Project Development Tasks Manual. - Ensure your directory structure in the BSP layer that supports your @@ -1117,7 +1117,7 @@ list describes them in order of preference: Specifying the matching license string signifies that you agree to the license. Thus, the build system can build the corresponding recipe and include the component in the image. See the - ":ref:`dev-manual/common-tasks:enabling commercially licensed recipes`" + ":ref:`dev-manual/licenses:enabling commercially licensed recipes`" section in the Yocto Project Development Tasks Manual for details on how to use these variables. @@ -1169,7 +1169,7 @@ Use these steps to create a BSP layer: ``create-layer`` subcommand to create a new general layer. For instructions on how to create a general layer using the ``bitbake-layers`` script, see the - ":ref:`dev-manual/common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`" + ":ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`" section in the Yocto Project Development Tasks Manual. - *Create a Layer Configuration File:* Every layer needs a layer @@ -1229,7 +1229,7 @@ configuration files is to examine various files for BSP from the :yocto_git:`Source Repositories <>`. For a detailed description of this particular layer configuration file, -see ":ref:`step 3 `" +see ":ref:`step 3 `" in the discussion that describes how to create layers in the Yocto Project Development Tasks Manual. @@ -1365,7 +1365,7 @@ Project Reference Manual. - :term:`IMAGE_INSTALL`: Specifies packages to install into an image through the - :ref:`image ` class. Recipes + :ref:`ref-classes-image` class. Recipes use the :term:`IMAGE_INSTALL` variable. - ``do_image_wic[depends]``: A task that is constructed during the diff --git a/poky/documentation/dev-manual/bmaptool.rst b/poky/documentation/dev-manual/bmaptool.rst new file mode 100644 index 0000000000..9add72cf3b --- /dev/null +++ b/poky/documentation/dev-manual/bmaptool.rst @@ -0,0 +1,59 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Flashing Images Using ``bmaptool`` +********************************** + +A fast and easy way to flash an image to a bootable device is to use +Bmaptool, which is integrated into the OpenEmbedded build system. +Bmaptool is a generic tool that creates a file's block map (bmap) and +then uses that map to copy the file. As compared to traditional tools +such as dd or cp, Bmaptool can copy (or flash) large files like raw +system image files much faster. + +.. note:: + + - If you are using Ubuntu or Debian distributions, you can install + the ``bmap-tools`` package using the following command and then + use the tool without specifying ``PATH`` even from the root + account:: + + $ sudo apt install bmap-tools + + - If you are unable to install the ``bmap-tools`` package, you will + need to build Bmaptool before using it. Use the following command:: + + $ bitbake bmap-tools-native + +Following, is an example that shows how to flash a Wic image. Realize +that while this example uses a Wic image, you can use Bmaptool to flash +any type of image. Use these steps to flash an image using Bmaptool: + +#. *Update your local.conf File:* You need to have the following set + in your ``local.conf`` file before building your image:: + + IMAGE_FSTYPES += "wic wic.bmap" + +#. *Get Your Image:* Either have your image ready (pre-built with the + :term:`IMAGE_FSTYPES` + setting previously mentioned) or take the step to build the image:: + + $ bitbake image + +#. *Flash the Device:* Flash the device with the image by using Bmaptool + depending on your particular setup. The following commands assume the + image resides in the :term:`Build Directory`'s ``deploy/images/`` area: + + - If you have write access to the media, use this command form:: + + $ oe-run-native bmap-tools-native bmaptool copy build-directory/tmp/deploy/images/machine/image.wic /dev/sdX + + - If you do not have write access to the media, set your permissions + first and then use the same command form:: + + $ sudo chmod 666 /dev/sdX + $ oe-run-native bmap-tools-native bmaptool copy build-directory/tmp/deploy/images/machine/image.wic /dev/sdX + +For help on the ``bmaptool`` command, use the following command:: + + $ bmaptool --help + diff --git a/poky/documentation/dev-manual/build-quality.rst b/poky/documentation/dev-manual/build-quality.rst new file mode 100644 index 0000000000..713ea3a48e --- /dev/null +++ b/poky/documentation/dev-manual/build-quality.rst @@ -0,0 +1,409 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Maintaining Build Output Quality +******************************** + +Many factors can influence the quality of a build. For example, if you +upgrade a recipe to use a new version of an upstream software package or +you experiment with some new configuration options, subtle changes can +occur that you might not detect until later. Consider the case where +your recipe is using a newer version of an upstream package. In this +case, a new version of a piece of software might introduce an optional +dependency on another library, which is auto-detected. If that library +has already been built when the software is building, the software will +link to the built library and that library will be pulled into your +image along with the new software even if you did not want the library. + +The :ref:`ref-classes-buildhistory` class helps you maintain the quality of +your build output. You can use the class to highlight unexpected and possibly +unwanted changes in the build output. When you enable build history, it records +information about the contents of each package and image and then commits that +information to a local Git repository where you can examine the information. + +The remainder of this section describes the following: + +- :ref:`How you can enable and disable build history ` + +- :ref:`How to understand what the build history contains ` + +- :ref:`How to limit the information used for build history ` + +- :ref:`How to examine the build history from both a command-line and web interface ` + +Enabling and Disabling Build History +==================================== + +Build history is disabled by default. To enable it, add the following +:term:`INHERIT` statement and set the :term:`BUILDHISTORY_COMMIT` variable to +"1" at the end of your ``conf/local.conf`` file found in the +:term:`Build Directory`:: + + INHERIT += "buildhistory" + BUILDHISTORY_COMMIT = "1" + +Enabling build history as +previously described causes the OpenEmbedded build system to collect +build output information and commit it as a single commit to a local +:ref:`overview-manual/development-environment:git` repository. + +.. note:: + + Enabling build history increases your build times slightly, + particularly for images, and increases the amount of disk space used + during the build. + +You can disable build history by removing the previous statements from +your ``conf/local.conf`` file. + +Understanding What the Build History Contains +============================================= + +Build history information is kept in ``${``\ :term:`TOPDIR`\ ``}/buildhistory`` +in the :term:`Build Directory` as defined by the :term:`BUILDHISTORY_DIR` +variable. Here is an example abbreviated listing: + +.. image:: figures/buildhistory.png + :align: center + :width: 50% + +At the top level, there is a ``metadata-revs`` file that lists the +revisions of the repositories for the enabled layers when the build was +produced. The rest of the data splits into separate ``packages``, +``images`` and ``sdk`` directories, the contents of which are described +as follows. + +Build History Package Information +--------------------------------- + +The history for each package contains a text file that has name-value +pairs with information about the package. For example, +``buildhistory/packages/i586-poky-linux/busybox/busybox/latest`` +contains the following: + +.. code-block:: none + + PV = 1.22.1 + PR = r32 + RPROVIDES = + RDEPENDS = glibc (>= 2.20) update-alternatives-opkg + RRECOMMENDS = busybox-syslog busybox-udhcpc update-rc.d + PKGSIZE = 540168 + FILES = /usr/bin/* /usr/sbin/* /usr/lib/busybox/* /usr/lib/lib*.so.* \ + /etc /com /var /bin/* /sbin/* /lib/*.so.* /lib/udev/rules.d \ + /usr/lib/udev/rules.d /usr/share/busybox /usr/lib/busybox/* \ + /usr/share/pixmaps /usr/share/applications /usr/share/idl \ + /usr/share/omf /usr/share/sounds /usr/lib/bonobo/servers + FILELIST = /bin/busybox /bin/busybox.nosuid /bin/busybox.suid /bin/sh \ + /etc/busybox.links.nosuid /etc/busybox.links.suid + +Most of these +name-value pairs correspond to variables used to produce the package. +The exceptions are ``FILELIST``, which is the actual list of files in +the package, and ``PKGSIZE``, which is the total size of files in the +package in bytes. + +There is also a file that corresponds to the recipe from which the package +came (e.g. ``buildhistory/packages/i586-poky-linux/busybox/latest``): + +.. code-block:: none + + PV = 1.22.1 + PR = r32 + DEPENDS = initscripts kern-tools-native update-rc.d-native \ + virtual/i586-poky-linux-compilerlibs virtual/i586-poky-linux-gcc \ + virtual/libc virtual/update-alternatives + PACKAGES = busybox-ptest busybox-httpd busybox-udhcpd busybox-udhcpc \ + busybox-syslog busybox-mdev busybox-hwclock busybox-dbg \ + busybox-staticdev busybox-dev busybox-doc busybox-locale busybox + +Finally, for those recipes fetched from a version control system (e.g., +Git), there is a file that lists source revisions that are specified in +the recipe and the actual revisions used during the build. Listed +and actual revisions might differ when +:term:`SRCREV` is set to +${:term:`AUTOREV`}. Here is an +example assuming +``buildhistory/packages/qemux86-poky-linux/linux-yocto/latest_srcrev``):: + + # SRCREV_machine = "38cd560d5022ed2dbd1ab0dca9642e47c98a0aa1" + SRCREV_machine = "38cd560d5022ed2dbd1ab0dca9642e47c98a0aa1" + # SRCREV_meta = "a227f20eff056e511d504b2e490f3774ab260d6f" + SRCREV_meta ="a227f20eff056e511d504b2e490f3774ab260d6f" + +You can use the +``buildhistory-collect-srcrevs`` command with the ``-a`` option to +collect the stored :term:`SRCREV` values from build history and report them +in a format suitable for use in global configuration (e.g., +``local.conf`` or a distro include file) to override floating +:term:`AUTOREV` values to a fixed set of revisions. Here is some example +output from this command:: + + $ buildhistory-collect-srcrevs -a + # all-poky-linux + SRCREV:pn-ca-certificates = "07de54fdcc5806bde549e1edf60738c6bccf50e8" + SRCREV:pn-update-rc.d = "8636cf478d426b568c1be11dbd9346f67e03adac" + # core2-64-poky-linux + SRCREV:pn-binutils = "87d4632d36323091e731eb07b8aa65f90293da66" + SRCREV:pn-btrfs-tools = "8ad326b2f28c044cb6ed9016d7c3285e23b673c8" + SRCREV_bzip2-tests:pn-bzip2 = "f9061c030a25de5b6829e1abf373057309c734c0" + SRCREV:pn-e2fsprogs = "02540dedd3ddc52c6ae8aaa8a95ce75c3f8be1c0" + SRCREV:pn-file = "504206e53a89fd6eed71aeaf878aa3512418eab1" + SRCREV_glibc:pn-glibc = "24962427071fa532c3c48c918e9d64d719cc8a6c" + SRCREV:pn-gnome-desktop-testing = "e346cd4ed2e2102c9b195b614f3c642d23f5f6e7" + SRCREV:pn-init-system-helpers = "dbd9197569c0935029acd5c9b02b84c68fd937ee" + SRCREV:pn-kmod = "b6ecfc916a17eab8f93be5b09f4e4f845aabd3d1" + SRCREV:pn-libnsl2 = "82245c0c58add79a8e34ab0917358217a70e5100" + SRCREV:pn-libseccomp = "57357d2741a3b3d3e8425889a6b79a130e0fa2f3" + SRCREV:pn-libxcrypt = "50cf2b6dd4fdf04309445f2eec8de7051d953abf" + SRCREV:pn-ncurses = "51d0fd9cc3edb975f04224f29f777f8f448e8ced" + SRCREV:pn-procps = "19a508ea121c0c4ac6d0224575a036de745eaaf8" + SRCREV:pn-psmisc = "5fab6b7ab385080f1db725d6803136ec1841a15f" + SRCREV:pn-ptest-runner = "bcb82804daa8f725b6add259dcef2067e61a75aa" + SRCREV:pn-shared-mime-info = "18e558fa1c8b90b86757ade09a4ba4d6a6cf8f70" + SRCREV:pn-zstd = "e47e674cd09583ff0503f0f6defd6d23d8b718d3" + # qemux86_64-poky-linux + SRCREV_machine:pn-linux-yocto = "20301aeb1a64164b72bc72af58802b315e025c9c" + SRCREV_meta:pn-linux-yocto = "2d38a472b21ae343707c8bd64ac68a9eaca066a0" + # x86_64-linux + SRCREV:pn-binutils-cross-x86_64 = "87d4632d36323091e731eb07b8aa65f90293da66" + SRCREV_glibc:pn-cross-localedef-native = "24962427071fa532c3c48c918e9d64d719cc8a6c" + SRCREV_localedef:pn-cross-localedef-native = "794da69788cbf9bf57b59a852f9f11307663fa87" + SRCREV:pn-debianutils-native = "de14223e5bffe15e374a441302c528ffc1cbed57" + SRCREV:pn-libmodulemd-native = "ee80309bc766d781a144e6879419b29f444d94eb" + SRCREV:pn-virglrenderer-native = "363915595e05fb252e70d6514be2f0c0b5ca312b" + SRCREV:pn-zstd-native = "e47e674cd09583ff0503f0f6defd6d23d8b718d3" + +.. note:: + + Here are some notes on using the ``buildhistory-collect-srcrevs`` command: + + - By default, only values where the :term:`SRCREV` was not hardcoded + (usually when :term:`AUTOREV` is used) are reported. Use the ``-a`` + option to see all :term:`SRCREV` values. + + - The output statements might not have any effect if overrides are + applied elsewhere in the build system configuration. Use the + ``-f`` option to add the ``forcevariable`` override to each output + line if you need to work around this restriction. + + - The script does apply special handling when building for multiple + machines. However, the script does place a comment before each set + of values that specifies which triplet to which they belong as + previously shown (e.g., ``i586-poky-linux``). + +Build History Image Information +------------------------------- + +The files produced for each image are as follows: + +- ``image-files:`` A directory containing selected files from the root + filesystem. The files are defined by + :term:`BUILDHISTORY_IMAGE_FILES`. + +- ``build-id.txt:`` Human-readable information about the build + configuration and metadata source revisions. This file contains the + full build header as printed by BitBake. + +- ``*.dot:`` Dependency graphs for the image that are compatible with + ``graphviz``. + +- ``files-in-image.txt:`` A list of files in the image with + permissions, owner, group, size, and symlink information. + +- ``image-info.txt:`` A text file containing name-value pairs with + information about the image. See the following listing example for + more information. + +- ``installed-package-names.txt:`` A list of installed packages by name + only. + +- ``installed-package-sizes.txt:`` A list of installed packages ordered + by size. + +- ``installed-packages.txt:`` A list of installed packages with full + package filenames. + +.. note:: + + Installed package information is able to be gathered and produced + even if package management is disabled for the final image. + +Here is an example of ``image-info.txt``: + +.. code-block:: none + + DISTRO = poky + DISTRO_VERSION = 3.4+snapshot-a0245d7be08f3d24ea1875e9f8872aa6bbff93be + USER_CLASSES = buildstats + IMAGE_CLASSES = qemuboot qemuboot license_image + IMAGE_FEATURES = debug-tweaks + IMAGE_LINGUAS = + IMAGE_INSTALL = packagegroup-core-boot speex speexdsp + BAD_RECOMMENDATIONS = + NO_RECOMMENDATIONS = + PACKAGE_EXCLUDE = + ROOTFS_POSTPROCESS_COMMAND = write_package_manifest; license_create_manifest; cve_check_write_rootfs_manifest; ssh_allow_empty_password; ssh_allow_root_login; postinst_enable_logging; rootfs_update_timestamp; write_image_test_data; empty_var_volatile; sort_passwd; rootfs_reproducible; + IMAGE_POSTPROCESS_COMMAND = buildhistory_get_imageinfo ; + IMAGESIZE = 9265 + +Other than ``IMAGESIZE``, +which is the total size of the files in the image in Kbytes, the +name-value pairs are variables that may have influenced the content of +the image. This information is often useful when you are trying to +determine why a change in the package or file listings has occurred. + +Using Build History to Gather Image Information Only +---------------------------------------------------- + +As you can see, build history produces image information, including +dependency graphs, so you can see why something was pulled into the +image. If you are just interested in this information and not interested +in collecting specific package or SDK information, you can enable +writing only image information without any history by adding the +following to your ``conf/local.conf`` file found in the +:term:`Build Directory`:: + + INHERIT += "buildhistory" + BUILDHISTORY_COMMIT = "0" + BUILDHISTORY_FEATURES = "image" + +Here, you set the +:term:`BUILDHISTORY_FEATURES` +variable to use the image feature only. + +Build History SDK Information +----------------------------- + +Build history collects similar information on the contents of SDKs (e.g. +``bitbake -c populate_sdk imagename``) as compared to information it +collects for images. Furthermore, this information differs depending on +whether an extensible or standard SDK is being produced. + +The following list shows the files produced for SDKs: + +- ``files-in-sdk.txt:`` A list of files in the SDK with permissions, + owner, group, size, and symlink information. This list includes both + the host and target parts of the SDK. + +- ``sdk-info.txt:`` A text file containing name-value pairs with + information about the SDK. See the following listing example for more + information. + +- ``sstate-task-sizes.txt:`` A text file containing name-value pairs + with information about task group sizes (e.g. :ref:`ref-tasks-populate_sysroot` + tasks have a total size). The ``sstate-task-sizes.txt`` file exists + only when an extensible SDK is created. + +- ``sstate-package-sizes.txt:`` A text file containing name-value pairs + with information for the shared-state packages and sizes in the SDK. + The ``sstate-package-sizes.txt`` file exists only when an extensible + SDK is created. + +- ``sdk-files:`` A folder that contains copies of the files mentioned + in ``BUILDHISTORY_SDK_FILES`` if the files are present in the output. + Additionally, the default value of ``BUILDHISTORY_SDK_FILES`` is + specific to the extensible SDK although you can set it differently if + you would like to pull in specific files from the standard SDK. + + The default files are ``conf/local.conf``, ``conf/bblayers.conf``, + ``conf/auto.conf``, ``conf/locked-sigs.inc``, and + ``conf/devtool.conf``. Thus, for an extensible SDK, these files get + copied into the ``sdk-files`` directory. + +- The following information appears under each of the ``host`` and + ``target`` directories for the portions of the SDK that run on the + host and on the target, respectively: + + .. note:: + + The following files for the most part are empty when producing an + extensible SDK because this type of SDK is not constructed from + packages as is the standard SDK. + + - ``depends.dot:`` Dependency graph for the SDK that is compatible + with ``graphviz``. + + - ``installed-package-names.txt:`` A list of installed packages by + name only. + + - ``installed-package-sizes.txt:`` A list of installed packages + ordered by size. + + - ``installed-packages.txt:`` A list of installed packages with full + package filenames. + +Here is an example of ``sdk-info.txt``: + +.. code-block:: none + + DISTRO = poky + DISTRO_VERSION = 1.3+snapshot-20130327 + SDK_NAME = poky-glibc-i686-arm + SDK_VERSION = 1.3+snapshot + SDKMACHINE = + SDKIMAGE_FEATURES = dev-pkgs dbg-pkgs + BAD_RECOMMENDATIONS = + SDKSIZE = 352712 + +Other than ``SDKSIZE``, which is +the total size of the files in the SDK in Kbytes, the name-value pairs +are variables that might have influenced the content of the SDK. This +information is often useful when you are trying to determine why a +change in the package or file listings has occurred. + +Examining Build History Information +----------------------------------- + +You can examine build history output from the command line or from a web +interface. + +To see any changes that have occurred (assuming you have +:term:`BUILDHISTORY_COMMIT` = "1"), +you can simply use any Git command that allows you to view the history +of a repository. Here is one method:: + + $ git log -p + +You need to realize, +however, that this method does show changes that are not significant +(e.g. a package's size changing by a few bytes). + +There is a command-line tool called ``buildhistory-diff``, though, +that queries the Git repository and prints just the differences that +might be significant in human-readable form. Here is an example:: + + $ poky/poky/scripts/buildhistory-diff . HEAD^ + Changes to images/qemux86_64/glibc/core-image-minimal (files-in-image.txt): + /etc/anotherpkg.conf was added + /sbin/anotherpkg was added + * (installed-package-names.txt): + * anotherpkg was added + Changes to images/qemux86_64/glibc/core-image-minimal (installed-package-names.txt): + anotherpkg was added + packages/qemux86_64-poky-linux/v86d: PACKAGES: added "v86d-extras" + * PR changed from "r0" to "r1" + * PV changed from "0.1.10" to "0.1.12" + packages/qemux86_64-poky-linux/v86d/v86d: PKGSIZE changed from 110579 to 144381 (+30%) + * PR changed from "r0" to "r1" + * PV changed from "0.1.10" to "0.1.12" + +.. note:: + + The ``buildhistory-diff`` tool requires the ``GitPython`` + package. Be sure to install it using Pip3 as follows:: + + $ pip3 install GitPython --user + + + Alternatively, you can install ``python3-git`` using the appropriate + distribution package manager (e.g. ``apt``, ``dnf``, or ``zipper``). + +To see changes to the build history using a web interface, follow the +instruction in the ``README`` file +:yocto_git:`here `. + +Here is a sample screenshot of the interface: + +.. image:: figures/buildhistory-web.png + :width: 100% + diff --git a/poky/documentation/dev-manual/building.rst b/poky/documentation/dev-manual/building.rst new file mode 100644 index 0000000000..1f1642e846 --- /dev/null +++ b/poky/documentation/dev-manual/building.rst @@ -0,0 +1,939 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Building +******** + +This section describes various build procedures, such as the steps +needed for a simple build, building a target for multiple configurations, +generating an image for more than one machine, and so forth. + +Building a Simple Image +======================= + +In the development environment, you need to build an image whenever you +change hardware support, add or change system libraries, or add or +change services that have dependencies. There are several methods that allow +you to build an image within the Yocto Project. This section presents +the basic steps you need to build a simple image using BitBake from a +build host running Linux. + +.. note:: + + - For information on how to build an image using + :term:`Toaster`, see the + :doc:`/toaster-manual/index`. + + - For information on how to use ``devtool`` to build images, see the + ":ref:`sdk-manual/extensible:using \`\`devtool\`\` in your sdk workflow`" + section in the Yocto Project Application Development and the + Extensible Software Development Kit (eSDK) manual. + + - For a quick example on how to build an image using the + OpenEmbedded build system, see the + :doc:`/brief-yoctoprojectqs/index` document. + +The build process creates an entire Linux distribution from source and +places it in your :term:`Build Directory` under ``tmp/deploy/images``. For +detailed information on the build process using BitBake, see the +":ref:`overview-manual/concepts:images`" section in the Yocto Project Overview +and Concepts Manual. + +The following figure and list overviews the build process: + +.. image:: figures/bitbake-build-flow.png + :width: 100% + +#. *Set up Your Host Development System to Support Development Using the + Yocto Project*: See the ":doc:`start`" section for options on how to get a + build host ready to use the Yocto Project. + +#. *Initialize the Build Environment:* Initialize the build environment + by sourcing the build environment script (i.e. + :ref:`structure-core-script`):: + + $ source oe-init-build-env [build_dir] + + When you use the initialization script, the OpenEmbedded build system + uses ``build`` as the default :term:`Build Directory` in your current work + directory. You can use a `build_dir` argument with the script to + specify a different :term:`Build Directory`. + + .. note:: + + A common practice is to use a different :term:`Build Directory` for + different targets; for example, ``~/build/x86`` for a ``qemux86`` + target, and ``~/build/arm`` for a ``qemuarm`` target. In any + event, it's typically cleaner to locate the :term:`Build Directory` + somewhere outside of your source directory. + +#. *Make Sure Your* ``local.conf`` *File is Correct*: Ensure the + ``conf/local.conf`` configuration file, which is found in the + :term:`Build Directory`, is set up how you want it. This file defines many + aspects of the build environment including the target machine architecture + through the :term:`MACHINE` variable, the packaging format used during + the build (:term:`PACKAGE_CLASSES`), and a centralized tarball download + directory through the :term:`DL_DIR` variable. + +#. *Build the Image:* Build the image using the ``bitbake`` command:: + + $ bitbake target + + .. note:: + + For information on BitBake, see the :doc:`bitbake:index`. + + The target is the name of the recipe you want to build. Common + targets are the images in ``meta/recipes-core/images``, + ``meta/recipes-sato/images``, and so forth all found in the + :term:`Source Directory`. Alternatively, the target + can be the name of a recipe for a specific piece of software such as + BusyBox. For more details about the images the OpenEmbedded build + system supports, see the + ":ref:`ref-manual/images:Images`" chapter in the Yocto + Project Reference Manual. + + As an example, the following command builds the + ``core-image-minimal`` image:: + + $ bitbake core-image-minimal + + Once an + image has been built, it often needs to be installed. The images and + kernels built by the OpenEmbedded build system are placed in the + :term:`Build Directory` in ``tmp/deploy/images``. For information on how to + run pre-built images such as ``qemux86`` and ``qemuarm``, see the + :doc:`/sdk-manual/index` manual. For + information about how to install these images, see the documentation + for your particular board or machine. + +Building Images for Multiple Targets Using Multiple Configurations +================================================================== + +You can use a single ``bitbake`` command to build multiple images or +packages for different targets where each image or package requires a +different configuration (multiple configuration builds). The builds, in +this scenario, are sometimes referred to as "multiconfigs", and this +section uses that term throughout. + +This section describes how to set up for multiple configuration builds +and how to account for cross-build dependencies between the +multiconfigs. + +Setting Up and Running a Multiple Configuration Build +----------------------------------------------------- + +To accomplish a multiple configuration build, you must define each +target's configuration separately using a parallel configuration file in +the :term:`Build Directory` or configuration directory within a layer, and you +must follow a required file hierarchy. Additionally, you must enable the +multiple configuration builds in your ``local.conf`` file. + +Follow these steps to set up and execute multiple configuration builds: + +- *Create Separate Configuration Files*: You need to create a single + configuration file for each build target (each multiconfig). + The configuration definitions are implementation dependent but often + each configuration file will define the machine and the + temporary directory BitBake uses for the build. Whether the same + temporary directory (:term:`TMPDIR`) can be shared will depend on what is + similar and what is different between the configurations. Multiple MACHINE + targets can share the same (:term:`TMPDIR`) as long as the rest of the + configuration is the same, multiple :term:`DISTRO` settings would need separate + (:term:`TMPDIR`) directories. + + For example, consider a scenario with two different multiconfigs for the same + :term:`MACHINE`: "qemux86" built + for two distributions such as "poky" and "poky-lsb". In this case, + you would need to use the different :term:`TMPDIR`. + + Here is an example showing the minimal statements needed in a + configuration file for a "qemux86" target whose temporary build + directory is ``tmpmultix86``:: + + MACHINE = "qemux86" + TMPDIR = "${TOPDIR}/tmpmultix86" + + The location for these multiconfig configuration files is specific. + They must reside in the current :term:`Build Directory` in a sub-directory of + ``conf`` named ``multiconfig`` or within a layer's ``conf`` directory + under a directory named ``multiconfig``. Following is an example that defines + two configuration files for the "x86" and "arm" multiconfigs: + + .. image:: figures/multiconfig_files.png + :align: center + :width: 50% + + The usual :term:`BBPATH` search path is used to locate multiconfig files in + a similar way to other conf files. + +- *Add the BitBake Multi-configuration Variable to the Local + Configuration File*: Use the + :term:`BBMULTICONFIG` + variable in your ``conf/local.conf`` configuration file to specify + each multiconfig. Continuing with the example from the previous + figure, the :term:`BBMULTICONFIG` variable needs to enable two + multiconfigs: "x86" and "arm" by specifying each configuration file:: + + BBMULTICONFIG = "x86 arm" + + .. note:: + + A "default" configuration already exists by definition. This + configuration is named: "" (i.e. empty string) and is defined by + the variables coming from your ``local.conf`` + file. Consequently, the previous example actually adds two + additional configurations to your build: "arm" and "x86" along + with "". + +- *Launch BitBake*: Use the following BitBake command form to launch + the multiple configuration build:: + + $ bitbake [mc:multiconfigname:]target [[[mc:multiconfigname:]target] ... ] + + For the example in this section, the following command applies:: + + $ bitbake mc:x86:core-image-minimal mc:arm:core-image-sato mc::core-image-base + + The previous BitBake command builds a ``core-image-minimal`` image + that is configured through the ``x86.conf`` configuration file, a + ``core-image-sato`` image that is configured through the ``arm.conf`` + configuration file and a ``core-image-base`` that is configured + through your ``local.conf`` configuration file. + +.. note:: + + Support for multiple configuration builds in the Yocto Project &DISTRO; + (&DISTRO_NAME;) Release does not include Shared State (sstate) + optimizations. Consequently, if a build uses the same object twice + in, for example, two different :term:`TMPDIR` + directories, the build either loads from an existing sstate cache for + that build at the start or builds the object fresh. + +Enabling Multiple Configuration Build Dependencies +-------------------------------------------------- + +Sometimes dependencies can exist between targets (multiconfigs) in a +multiple configuration build. For example, suppose that in order to +build a ``core-image-sato`` image for an "x86" multiconfig, the root +filesystem of an "arm" multiconfig must exist. This dependency is +essentially that the +:ref:`ref-tasks-image` task in the +``core-image-sato`` recipe depends on the completion of the +:ref:`ref-tasks-rootfs` task of the +``core-image-minimal`` recipe. + +To enable dependencies in a multiple configuration build, you must +declare the dependencies in the recipe using the following statement +form:: + + task_or_package[mcdepends] = "mc:from_multiconfig:to_multiconfig:recipe_name:task_on_which_to_depend" + +To better show how to use this statement, consider the example scenario +from the first paragraph of this section. The following statement needs +to be added to the recipe that builds the ``core-image-sato`` image:: + + do_image[mcdepends] = "mc:x86:arm:core-image-minimal:do_rootfs" + +In this example, the `from_multiconfig` is "x86". The `to_multiconfig` is "arm". The +task on which the :ref:`ref-tasks-image` task in the recipe depends is the +:ref:`ref-tasks-rootfs` task from the ``core-image-minimal`` recipe associated +with the "arm" multiconfig. + +Once you set up this dependency, you can build the "x86" multiconfig +using a BitBake command as follows:: + + $ bitbake mc:x86:core-image-sato + +This command executes all the tasks needed to create the +``core-image-sato`` image for the "x86" multiconfig. Because of the +dependency, BitBake also executes through the :ref:`ref-tasks-rootfs` task for the +"arm" multiconfig build. + +Having a recipe depend on the root filesystem of another build might not +seem that useful. Consider this change to the statement in the +``core-image-sato`` recipe:: + + do_image[mcdepends] = "mc:x86:arm:core-image-minimal:do_image" + +In this case, BitBake must +create the ``core-image-minimal`` image for the "arm" build since the +"x86" build depends on it. + +Because "x86" and "arm" are enabled for multiple configuration builds +and have separate configuration files, BitBake places the artifacts for +each build in the respective temporary build directories (i.e. +:term:`TMPDIR`). + +Building an Initial RAM Filesystem (Initramfs) Image +==================================================== + +An initial RAM filesystem (:term:`Initramfs`) image provides a temporary root +filesystem used for early system initialization, typically providing tools and +loading modules needed to locate and mount the final root filesystem. + +Follow these steps to create an :term:`Initramfs` image: + +#. *Create the :term:`Initramfs` Image Recipe:* You can reference the + ``core-image-minimal-initramfs.bb`` recipe found in the + ``meta/recipes-core`` directory of the :term:`Source Directory` + as an example from which to work. + +#. *Decide if You Need to Bundle the :term:`Initramfs` Image Into the Kernel + Image:* If you want the :term:`Initramfs` image that is built to be bundled + in with the kernel image, set the :term:`INITRAMFS_IMAGE_BUNDLE` + variable to ``"1"`` in your ``local.conf`` configuration file and set the + :term:`INITRAMFS_IMAGE` variable in the recipe that builds the kernel image. + + Setting the :term:`INITRAMFS_IMAGE_BUNDLE` flag causes the :term:`Initramfs` + image to be unpacked into the ``${B}/usr/`` directory. The unpacked + :term:`Initramfs` image is then passed to the kernel's ``Makefile`` using the + :term:`CONFIG_INITRAMFS_SOURCE` variable, allowing the :term:`Initramfs` + image to be built into the kernel normally. + +#. *Optionally Add Items to the Initramfs Image Through the Initramfs + Image Recipe:* If you add items to the :term:`Initramfs` image by way of its + recipe, you should use :term:`PACKAGE_INSTALL` rather than + :term:`IMAGE_INSTALL`. :term:`PACKAGE_INSTALL` gives more direct control of + what is added to the image as compared to the defaults you might not + necessarily want that are set by the :ref:`ref-classes-image` + or :ref:`ref-classes-core-image` classes. + +#. *Build the Kernel Image and the Initramfs Image:* Build your kernel + image using BitBake. Because the :term:`Initramfs` image recipe is a + dependency of the kernel image, the :term:`Initramfs` image is built as well + and bundled with the kernel image if you used the + :term:`INITRAMFS_IMAGE_BUNDLE` variable described earlier. + +Bundling an Initramfs Image From a Separate Multiconfig +------------------------------------------------------- + +There may be a case where we want to build an :term:`Initramfs` image which does not +inherit the same distro policy as our main image, for example, we may want +our main image to use ``TCLIBC="glibc"``, but to use ``TCLIBC="musl"`` in our :term:`Initramfs` +image to keep a smaller footprint. However, by performing the steps mentioned +above the :term:`Initramfs` image will inherit ``TCLIBC="glibc"`` without allowing us +to override it. + +To achieve this, you need to perform some additional steps: + +#. *Create a multiconfig for your Initramfs image:* You can perform the steps + on ":ref:`dev-manual/building:building images for multiple targets using multiple configurations`" to create a separate multiconfig. + For the sake of simplicity let's assume such multiconfig is called: ``initramfscfg.conf`` and + contains the variables:: + + TMPDIR="${TOPDIR}/tmp-initramfscfg" + TCLIBC="musl" + +#. *Set additional Initramfs variables on your main configuration:* + Additionally, on your main configuration (``local.conf``) you need to set the + variables:: + + INITRAMFS_MULTICONFIG = "initramfscfg" + INITRAMFS_DEPLOY_DIR_IMAGE = "${TOPDIR}/tmp-initramfscfg/deploy/images/${MACHINE}" + + The variables :term:`INITRAMFS_MULTICONFIG` and :term:`INITRAMFS_DEPLOY_DIR_IMAGE` + are used to create a multiconfig dependency from the kernel to the :term:`INITRAMFS_IMAGE` + to be built coming from the ``initramfscfg`` multiconfig, and to let the + buildsystem know where the :term:`INITRAMFS_IMAGE` will be located. + + Building a system with such configuration will build the kernel using the + main configuration but the :ref:`ref-tasks-bundle_initramfs` task will grab the + selected :term:`INITRAMFS_IMAGE` from :term:`INITRAMFS_DEPLOY_DIR_IMAGE` + instead, resulting in a musl based :term:`Initramfs` image bundled in the kernel + but a glibc based main image. + + The same is applicable to avoid inheriting :term:`DISTRO_FEATURES` on :term:`INITRAMFS_IMAGE` + or to build a different :term:`DISTRO` for it such as ``poky-tiny``. + + +Building a Tiny System +====================== + +Very small distributions have some significant advantages such as +requiring less on-die or in-package memory (cheaper), better performance +through efficient cache usage, lower power requirements due to less +memory, faster boot times, and reduced development overhead. Some +real-world examples where a very small distribution gives you distinct +advantages are digital cameras, medical devices, and small headless +systems. + +This section presents information that shows you how you can trim your +distribution to even smaller sizes than the ``poky-tiny`` distribution, +which is around 5 Mbytes, that can be built out-of-the-box using the +Yocto Project. + +Tiny System Overview +-------------------- + +The following list presents the overall steps you need to consider and +perform to create distributions with smaller root filesystems, achieve +faster boot times, maintain your critical functionality, and avoid +initial RAM disks: + +- :ref:`Determine your goals and guiding principles + ` + +- :ref:`dev-manual/building:understand what contributes to your image size` + +- :ref:`Reduce the size of the root filesystem + ` + +- :ref:`Reduce the size of the kernel ` + +- :ref:`dev-manual/building:remove package management requirements` + +- :ref:`dev-manual/building:look for other ways to minimize size` + +- :ref:`dev-manual/building:iterate on the process` + +Goals and Guiding Principles +---------------------------- + +Before you can reach your destination, you need to know where you are +going. Here is an example list that you can use as a guide when creating +very small distributions: + +- Determine how much space you need (e.g. a kernel that is 1 Mbyte or + less and a root filesystem that is 3 Mbytes or less). + +- Find the areas that are currently taking 90% of the space and + concentrate on reducing those areas. + +- Do not create any difficult "hacks" to achieve your goals. + +- Leverage the device-specific options. + +- Work in a separate layer so that you keep changes isolated. For + information on how to create layers, see the + ":ref:`dev-manual/layers:understanding and creating layers`" section. + +Understand What Contributes to Your Image Size +---------------------------------------------- + +It is easiest to have something to start with when creating your own +distribution. You can use the Yocto Project out-of-the-box to create the +``poky-tiny`` distribution. Ultimately, you will want to make changes in +your own distribution that are likely modeled after ``poky-tiny``. + +.. note:: + + To use ``poky-tiny`` in your build, set the :term:`DISTRO` variable in your + ``local.conf`` file to "poky-tiny" as described in the + ":ref:`dev-manual/custom-distribution:creating your own distribution`" + section. + +Understanding some memory concepts will help you reduce the system size. +Memory consists of static, dynamic, and temporary memory. Static memory +is the TEXT (code), DATA (initialized data in the code), and BSS +(uninitialized data) sections. Dynamic memory represents memory that is +allocated at runtime: stacks, hash tables, and so forth. Temporary +memory is recovered after the boot process. This memory consists of +memory used for decompressing the kernel and for the ``__init__`` +functions. + +To help you see where you currently are with kernel and root filesystem +sizes, you can use two tools found in the :term:`Source Directory` +in the +``scripts/tiny/`` directory: + +- ``ksize.py``: Reports component sizes for the kernel build objects. + +- ``dirsize.py``: Reports component sizes for the root filesystem. + +This next tool and command help you organize configuration fragments and +view file dependencies in a human-readable form: + +- ``merge_config.sh``: Helps you manage configuration files and + fragments within the kernel. With this tool, you can merge individual + configuration fragments together. The tool allows you to make + overrides and warns you of any missing configuration options. The + tool is ideal for allowing you to iterate on configurations, create + minimal configurations, and create configuration files for different + machines without having to duplicate your process. + + The ``merge_config.sh`` script is part of the Linux Yocto kernel Git + repositories (i.e. ``linux-yocto-3.14``, ``linux-yocto-3.10``, + ``linux-yocto-3.8``, and so forth) in the ``scripts/kconfig`` + directory. + + For more information on configuration fragments, see the + ":ref:`kernel-dev/common:creating configuration fragments`" + section in the Yocto Project Linux Kernel Development Manual. + +- ``bitbake -u taskexp -g bitbake_target``: Using the BitBake command + with these options brings up a Dependency Explorer from which you can + view file dependencies. Understanding these dependencies allows you + to make informed decisions when cutting out various pieces of the + kernel and root filesystem. + +Trim the Root Filesystem +------------------------ + +The root filesystem is made up of packages for booting, libraries, and +applications. To change things, you can configure how the packaging +happens, which changes the way you build them. You can also modify the +filesystem itself or select a different filesystem. + +First, find out what is hogging your root filesystem by running the +``dirsize.py`` script from your root directory:: + + $ cd root-directory-of-image + $ dirsize.py 100000 > dirsize-100k.log + $ cat dirsize-100k.log + +You can apply a filter to the script to ignore files +under a certain size. The previous example filters out any files below +100 Kbytes. The sizes reported by the tool are uncompressed, and thus +will be smaller by a relatively constant factor in a compressed root +filesystem. When you examine your log file, you can focus on areas of +the root filesystem that take up large amounts of memory. + +You need to be sure that what you eliminate does not cripple the +functionality you need. One way to see how packages relate to each other +is by using the Dependency Explorer UI with the BitBake command:: + + $ cd image-directory + $ bitbake -u taskexp -g image + +Use the interface to +select potential packages you wish to eliminate and see their dependency +relationships. + +When deciding how to reduce the size, get rid of packages that result in +minimal impact on the feature set. For example, you might not need a VGA +display. Or, you might be able to get by with ``devtmpfs`` and ``mdev`` +instead of ``udev``. + +Use your ``local.conf`` file to make changes. For example, to eliminate +``udev`` and ``glib``, set the following in the local configuration +file:: + + VIRTUAL-RUNTIME_dev_manager = "" + +Finally, you should consider exactly the type of root filesystem you +need to meet your needs while also reducing its size. For example, +consider ``cramfs``, ``squashfs``, ``ubifs``, ``ext2``, or an +:term:`Initramfs` using ``initramfs``. Be aware that ``ext3`` requires a 1 +Mbyte journal. If you are okay with running read-only, you do not need +this journal. + +.. note:: + + After each round of elimination, you need to rebuild your system and + then use the tools to see the effects of your reductions. + +Trim the Kernel +--------------- + +The kernel is built by including policies for hardware-independent +aspects. What subsystems do you enable? For what architecture are you +building? Which drivers do you build by default? + +.. note:: + + You can modify the kernel source if you want to help with boot time. + +Run the ``ksize.py`` script from the top-level Linux build directory to +get an idea of what is making up the kernel:: + + $ cd top-level-linux-build-directory + $ ksize.py > ksize.log + $ cat ksize.log + +When you examine the log, you will see how much space is taken up with +the built-in ``.o`` files for drivers, networking, core kernel files, +filesystem, sound, and so forth. The sizes reported by the tool are +uncompressed, and thus will be smaller by a relatively constant factor +in a compressed kernel image. Look to reduce the areas that are large +and taking up around the "90% rule." + +To examine, or drill down, into any particular area, use the ``-d`` +option with the script:: + + $ ksize.py -d > ksize.log + +Using this option +breaks out the individual file information for each area of the kernel +(e.g. drivers, networking, and so forth). + +Use your log file to see what you can eliminate from the kernel based on +features you can let go. For example, if you are not going to need +sound, you do not need any drivers that support sound. + +After figuring out what to eliminate, you need to reconfigure the kernel +to reflect those changes during the next build. You could run +``menuconfig`` and make all your changes at once. However, that makes it +difficult to see the effects of your individual eliminations and also +makes it difficult to replicate the changes for perhaps another target +device. A better method is to start with no configurations using +``allnoconfig``, create configuration fragments for individual changes, +and then manage the fragments into a single configuration file using +``merge_config.sh``. The tool makes it easy for you to iterate using the +configuration change and build cycle. + +Each time you make configuration changes, you need to rebuild the kernel +and check to see what impact your changes had on the overall size. + +Remove Package Management Requirements +-------------------------------------- + +Packaging requirements add size to the image. One way to reduce the size +of the image is to remove all the packaging requirements from the image. +This reduction includes both removing the package manager and its unique +dependencies as well as removing the package management data itself. + +To eliminate all the packaging requirements for an image, be sure that +"package-management" is not part of your +:term:`IMAGE_FEATURES` +statement for the image. When you remove this feature, you are removing +the package manager as well as its dependencies from the root +filesystem. + +Look for Other Ways to Minimize Size +------------------------------------ + +Depending on your particular circumstances, other areas that you can +trim likely exist. The key to finding these areas is through tools and +methods described here combined with experimentation and iteration. Here +are a couple of areas to experiment with: + +- ``glibc``: In general, follow this process: + + #. Remove ``glibc`` features from + :term:`DISTRO_FEATURES` + that you think you do not need. + + #. Build your distribution. + + #. If the build fails due to missing symbols in a package, determine + if you can reconfigure the package to not need those features. For + example, change the configuration to not support wide character + support as is done for ``ncurses``. Or, if support for those + characters is needed, determine what ``glibc`` features provide + the support and restore the configuration. + + 4. Rebuild and repeat the process. + +- ``busybox``: For BusyBox, use a process similar as described for + ``glibc``. A difference is you will need to boot the resulting system + to see if you are able to do everything you expect from the running + system. You need to be sure to integrate configuration fragments into + Busybox because BusyBox handles its own core features and then allows + you to add configuration fragments on top. + +Iterate on the Process +---------------------- + +If you have not reached your goals on system size, you need to iterate +on the process. The process is the same. Use the tools and see just what +is taking up 90% of the root filesystem and the kernel. Decide what you +can eliminate without limiting your device beyond what you need. + +Depending on your system, a good place to look might be Busybox, which +provides a stripped down version of Unix tools in a single, executable +file. You might be able to drop virtual terminal services or perhaps +ipv6. + +Building Images for More than One Machine +========================================= + +A common scenario developers face is creating images for several +different machines that use the same software environment. In this +situation, it is tempting to set the tunings and optimization flags for +each build specifically for the targeted hardware (i.e. "maxing out" the +tunings). Doing so can considerably add to build times and package feed +maintenance collectively for the machines. For example, selecting tunes +that are extremely specific to a CPU core used in a system might enable +some micro optimizations in GCC for that particular system but would +otherwise not gain you much of a performance difference across the other +systems as compared to using a more general tuning across all the builds +(e.g. setting :term:`DEFAULTTUNE` +specifically for each machine's build). Rather than "max out" each +build's tunings, you can take steps that cause the OpenEmbedded build +system to reuse software across the various machines where it makes +sense. + +If build speed and package feed maintenance are considerations, you +should consider the points in this section that can help you optimize +your tunings to best consider build times and package feed maintenance. + +- *Share the :term:`Build Directory`:* If at all possible, share the + :term:`TMPDIR` across builds. The Yocto Project supports switching between + different :term:`MACHINE` values in the same :term:`TMPDIR`. This practice + is well supported and regularly used by developers when building for + multiple machines. When you use the same :term:`TMPDIR` for multiple + machine builds, the OpenEmbedded build system can reuse the existing native + and often cross-recipes for multiple machines. Thus, build time decreases. + + .. note:: + + If :term:`DISTRO` settings change or fundamental configuration settings + such as the filesystem layout, you need to work with a clean :term:`TMPDIR`. + Sharing :term:`TMPDIR` under these circumstances might work but since it is + not guaranteed, you should use a clean :term:`TMPDIR`. + +- *Enable the Appropriate Package Architecture:* By default, the + OpenEmbedded build system enables three levels of package + architectures: "all", "tune" or "package", and "machine". Any given + recipe usually selects one of these package architectures (types) for + its output. Depending for what a given recipe creates packages, + making sure you enable the appropriate package architecture can + directly impact the build time. + + A recipe that just generates scripts can enable "all" architecture + because there are no binaries to build. To specifically enable "all" + architecture, be sure your recipe inherits the + :ref:`ref-classes-allarch` class. + This class is useful for "all" architectures because it configures + many variables so packages can be used across multiple architectures. + + If your recipe needs to generate packages that are machine-specific + or when one of the build or runtime dependencies is already + machine-architecture dependent, which makes your recipe also + machine-architecture dependent, make sure your recipe enables the + "machine" package architecture through the + :term:`MACHINE_ARCH` + variable:: + + PACKAGE_ARCH = "${MACHINE_ARCH}" + + When you do not + specifically enable a package architecture through the + :term:`PACKAGE_ARCH`, The + OpenEmbedded build system defaults to the + :term:`TUNE_PKGARCH` setting:: + + PACKAGE_ARCH = "${TUNE_PKGARCH}" + +- *Choose a Generic Tuning File if Possible:* Some tunes are more + generic and can run on multiple targets (e.g. an ``armv5`` set of + packages could run on ``armv6`` and ``armv7`` processors in most + cases). Similarly, ``i486`` binaries could work on ``i586`` and + higher processors. You should realize, however, that advances on + newer processor versions would not be used. + + If you select the same tune for several different machines, the + OpenEmbedded build system reuses software previously built, thus + speeding up the overall build time. Realize that even though a new + sysroot for each machine is generated, the software is not recompiled + and only one package feed exists. + +- *Manage Granular Level Packaging:* Sometimes there are cases where + injecting another level of package architecture beyond the three + higher levels noted earlier can be useful. For example, consider how + NXP (formerly Freescale) allows for the easy reuse of binary packages + in their layer + :yocto_git:`meta-freescale `. + In this example, the + :yocto_git:`fsl-dynamic-packagearch ` + class shares GPU packages for i.MX53 boards because all boards share + the AMD GPU. The i.MX6-based boards can do the same because all + boards share the Vivante GPU. This class inspects the BitBake + datastore to identify if the package provides or depends on one of + the sub-architecture values. If so, the class sets the + :term:`PACKAGE_ARCH` value + based on the ``MACHINE_SUBARCH`` value. If the package does not + provide or depend on one of the sub-architecture values but it + matches a value in the machine-specific filter, it sets + :term:`MACHINE_ARCH`. This + behavior reduces the number of packages built and saves build time by + reusing binaries. + +- *Use Tools to Debug Issues:* Sometimes you can run into situations + where software is being rebuilt when you think it should not be. For + example, the OpenEmbedded build system might not be using shared + state between machines when you think it should be. These types of + situations are usually due to references to machine-specific + variables such as :term:`MACHINE`, + :term:`SERIAL_CONSOLES`, + :term:`XSERVER`, + :term:`MACHINE_FEATURES`, + and so forth in code that is supposed to only be tune-specific or + when the recipe depends + (:term:`DEPENDS`, + :term:`RDEPENDS`, + :term:`RRECOMMENDS`, + :term:`RSUGGESTS`, and so forth) + on some other recipe that already has + :term:`PACKAGE_ARCH` defined + as "${MACHINE_ARCH}". + + .. note:: + + Patches to fix any issues identified are most welcome as these + issues occasionally do occur. + + For such cases, you can use some tools to help you sort out the + situation: + + - ``state-diff-machines.sh``*:* You can find this tool in the + ``scripts`` directory of the Source Repositories. See the comments + in the script for information on how to use the tool. + + - *BitBake's "-S printdiff" Option:* Using this option causes + BitBake to try to establish the closest signature match it can + (e.g. in the shared state cache) and then run ``bitbake-diffsigs`` + over the matches to determine the stamps and delta where these two + stamp trees diverge. + +Building Software from an External Source +========================================= + +By default, the OpenEmbedded build system uses the :term:`Build Directory` +when building source code. The build process involves fetching the source +files, unpacking them, and then patching them if necessary before the build +takes place. + +There are situations where you might want to build software from source +files that are external to and thus outside of the OpenEmbedded build +system. For example, suppose you have a project that includes a new BSP +with a heavily customized kernel. And, you want to minimize exposing the +build system to the development team so that they can focus on their +project and maintain everyone's workflow as much as possible. In this +case, you want a kernel source directory on the development machine +where the development occurs. You want the recipe's +:term:`SRC_URI` variable to point to +the external directory and use it as is, not copy it. + +To build from software that comes from an external source, all you need to do +is inherit the :ref:`ref-classes-externalsrc` class and then set +the :term:`EXTERNALSRC` variable to point to your external source code. Here +are the statements to put in your ``local.conf`` file:: + + INHERIT += "externalsrc" + EXTERNALSRC:pn-myrecipe = "path-to-your-source-tree" + +This next example shows how to accomplish the same thing by setting +:term:`EXTERNALSRC` in the recipe itself or in the recipe's append file:: + + EXTERNALSRC = "path" + EXTERNALSRC_BUILD = "path" + +.. note:: + + In order for these settings to take effect, you must globally or + locally inherit the :ref:`ref-classes-externalsrc` class. + +By default, :ref:`ref-classes-externalsrc` builds the source code in a +directory separate from the external source directory as specified by +:term:`EXTERNALSRC`. If you need +to have the source built in the same directory in which it resides, or +some other nominated directory, you can set +:term:`EXTERNALSRC_BUILD` +to point to that directory:: + + EXTERNALSRC_BUILD:pn-myrecipe = "path-to-your-source-tree" + +Replicating a Build Offline +=========================== + +It can be useful to take a "snapshot" of upstream sources used in a +build and then use that "snapshot" later to replicate the build offline. +To do so, you need to first prepare and populate your downloads +directory your "snapshot" of files. Once your downloads directory is +ready, you can use it at any time and from any machine to replicate your +build. + +Follow these steps to populate your Downloads directory: + +#. *Create a Clean Downloads Directory:* Start with an empty downloads + directory (:term:`DL_DIR`). You + start with an empty downloads directory by either removing the files + in the existing directory or by setting :term:`DL_DIR` to point to either + an empty location or one that does not yet exist. + +#. *Generate Tarballs of the Source Git Repositories:* Edit your + ``local.conf`` configuration file as follows:: + + DL_DIR = "/home/your-download-dir/" + BB_GENERATE_MIRROR_TARBALLS = "1" + + During + the fetch process in the next step, BitBake gathers the source files + and creates tarballs in the directory pointed to by :term:`DL_DIR`. See + the + :term:`BB_GENERATE_MIRROR_TARBALLS` + variable for more information. + +#. *Populate Your Downloads Directory Without Building:* Use BitBake to + fetch your sources but inhibit the build:: + + $ bitbake target --runonly=fetch + + The downloads directory (i.e. ``${DL_DIR}``) now has + a "snapshot" of the source files in the form of tarballs, which can + be used for the build. + +#. *Optionally Remove Any Git or other SCM Subdirectories From the + Downloads Directory:* If you want, you can clean up your downloads + directory by removing any Git or other Source Control Management + (SCM) subdirectories such as ``${DL_DIR}/git2/*``. The tarballs + already contain these subdirectories. + +Once your downloads directory has everything it needs regarding source +files, you can create your "own-mirror" and build your target. +Understand that you can use the files to build the target offline from +any machine and at any time. + +Follow these steps to build your target using the files in the downloads +directory: + +#. *Using Local Files Only:* Inside your ``local.conf`` file, add the + :term:`SOURCE_MIRROR_URL` variable, inherit the + :ref:`ref-classes-own-mirrors` class, and use the + :term:`BB_NO_NETWORK` variable to your ``local.conf``:: + + SOURCE_MIRROR_URL ?= "file:///home/your-download-dir/" + INHERIT += "own-mirrors" + BB_NO_NETWORK = "1" + + The :term:`SOURCE_MIRROR_URL` and :ref:`ref-classes-own-mirrors` + class set up the system to use the downloads directory as your "own + mirror". Using the :term:`BB_NO_NETWORK` variable makes sure that + BitBake's fetching process in step 3 stays local, which means files + from your "own-mirror" are used. + +#. *Start With a Clean Build:* You can start with a clean build by + removing the ``${``\ :term:`TMPDIR`\ ``}`` directory or using a new + :term:`Build Directory`. + +#. *Build Your Target:* Use BitBake to build your target:: + + $ bitbake target + + The build completes using the known local "snapshot" of source + files from your mirror. The resulting tarballs for your "snapshot" of + source files are in the downloads directory. + + .. note:: + + The offline build does not work if recipes attempt to find the + latest version of software by setting + :term:`SRCREV` to + ``${``\ :term:`AUTOREV`\ ``}``:: + + SRCREV = "${AUTOREV}" + + When a recipe sets :term:`SRCREV` to + ``${``\ :term:`AUTOREV`\ ``}``, the build system accesses the network in an + attempt to determine the latest version of software from the SCM. + Typically, recipes that use :term:`AUTOREV` are custom or modified + recipes. Recipes that reside in public repositories usually do not + use :term:`AUTOREV`. + + If you do have recipes that use :term:`AUTOREV`, you can take steps to + still use the recipes in an offline build. Do the following: + + #. Use a configuration generated by enabling :ref:`build + history `. + + #. Use the ``buildhistory-collect-srcrevs`` command to collect the + stored :term:`SRCREV` values from the build's history. For more + information on collecting these values, see the + ":ref:`dev-manual/build-quality:build history package information`" + section. + + #. Once you have the correct source revisions, you can modify + those recipes to set :term:`SRCREV` to specific versions of the + software. + diff --git a/poky/documentation/dev-manual/changes.rst b/poky/documentation/dev-manual/changes.rst new file mode 100644 index 0000000000..9cb25f3549 --- /dev/null +++ b/poky/documentation/dev-manual/changes.rst @@ -0,0 +1,525 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Making Changes to the Yocto Project +*********************************** + +Because the Yocto Project is an open-source, community-based project, +you can effect changes to the project. This section presents procedures +that show you how to submit a defect against the project and how to +submit a change. + +Submitting a Defect Against the Yocto Project +============================================= + +Use the Yocto Project implementation of +`Bugzilla `__ to submit a defect (bug) +against the Yocto Project. For additional information on this +implementation of Bugzilla see the ":ref:`Yocto Project +Bugzilla `" section in the +Yocto Project Reference Manual. For more detail on any of the following +steps, see the Yocto Project +:yocto_wiki:`Bugzilla wiki page `. + +Use the following general steps to submit a bug: + +#. Open the Yocto Project implementation of :yocto_bugs:`Bugzilla <>`. + +#. Click "File a Bug" to enter a new bug. + +#. Choose the appropriate "Classification", "Product", and "Component" + for which the bug was found. Bugs for the Yocto Project fall into + one of several classifications, which in turn break down into + several products and components. For example, for a bug against the + ``meta-intel`` layer, you would choose "Build System, Metadata & + Runtime", "BSPs", and "bsps-meta-intel", respectively. + +#. Choose the "Version" of the Yocto Project for which you found the + bug (e.g. &DISTRO;). + +#. Determine and select the "Severity" of the bug. The severity + indicates how the bug impacted your work. + +#. Choose the "Hardware" that the bug impacts. + +#. Choose the "Architecture" that the bug impacts. + +#. Choose a "Documentation change" item for the bug. Fixing a bug might + or might not affect the Yocto Project documentation. If you are + unsure of the impact to the documentation, select "Don't Know". + +#. Provide a brief "Summary" of the bug. Try to limit your summary to + just a line or two and be sure to capture the essence of the bug. + +#. Provide a detailed "Description" of the bug. You should provide as + much detail as you can about the context, behavior, output, and so + forth that surrounds the bug. You can even attach supporting files + for output from logs by using the "Add an attachment" button. + +#. Click the "Submit Bug" button submit the bug. A new Bugzilla number + is assigned to the bug and the defect is logged in the bug tracking + system. + +Once you file a bug, the bug is processed by the Yocto Project Bug +Triage Team and further details concerning the bug are assigned (e.g. +priority and owner). You are the "Submitter" of the bug and any further +categorization, progress, or comments on the bug result in Bugzilla +sending you an automated email concerning the particular change or +progress to the bug. + +Submitting a Change to the Yocto Project +======================================== + +Contributions to the Yocto Project and OpenEmbedded are very welcome. +Because the system is extremely configurable and flexible, we recognize +that developers will want to extend, configure or optimize it for their +specific uses. + +The Yocto Project uses a mailing list and a patch-based workflow that is +similar to the Linux kernel but contains important differences. In +general, there is a mailing list through which you can submit patches. You +should send patches to the appropriate mailing list so that they can be +reviewed and merged by the appropriate maintainer. The specific mailing +list you need to use depends on the location of the code you are +changing. Each component (e.g. layer) should have a ``README`` file that +indicates where to send the changes and which process to follow. + +You can send the patch to the mailing list using whichever approach you +feel comfortable with to generate the patch. Once sent, the patch is +usually reviewed by the community at large. If somebody has concerns +with the patch, they will usually voice their concern over the mailing +list. If a patch does not receive any negative reviews, the maintainer +of the affected layer typically takes the patch, tests it, and then +based on successful testing, merges the patch. + +The "poky" repository, which is the Yocto Project's reference build +environment, is a hybrid repository that contains several individual +pieces (e.g. BitBake, Metadata, documentation, and so forth) built using +the combo-layer tool. The upstream location used for submitting changes +varies by component: + +- *Core Metadata:* Send your patch to the + :oe_lists:`openembedded-core ` + mailing list. For example, a change to anything under the ``meta`` or + ``scripts`` directories should be sent to this mailing list. + +- *BitBake:* For changes to BitBake (i.e. anything under the + ``bitbake`` directory), send your patch to the + :oe_lists:`bitbake-devel ` + mailing list. + +- *"meta-\*" trees:* These trees contain Metadata. Use the + :yocto_lists:`poky ` mailing list. + +- *Documentation*: For changes to the Yocto Project documentation, use the + :yocto_lists:`docs ` mailing list. + +For changes to other layers hosted in the Yocto Project source +repositories (i.e. ``yoctoproject.org``) and tools use the +:yocto_lists:`Yocto Project ` general mailing list. + +.. note:: + + Sometimes a layer's documentation specifies to use a particular + mailing list. If so, use that list. + +For additional recipes that do not fit into the core Metadata, you +should determine which layer the recipe should go into and submit the +change in the manner recommended by the documentation (e.g. the +``README`` file) supplied with the layer. If in doubt, please ask on the +Yocto general mailing list or on the openembedded-devel mailing list. + +You can also push a change upstream and request a maintainer to pull the +change into the component's upstream repository. You do this by pushing +to a contribution repository that is upstream. See the +":ref:`overview-manual/development-environment:git workflows and the yocto project`" +section in the Yocto Project Overview and Concepts Manual for additional +concepts on working in the Yocto Project development environment. + +Maintainers commonly use ``-next`` branches to test submissions prior to +merging patches. Thus, you can get an idea of the status of a patch based on +whether the patch has been merged into one of these branches. The commonly +used testing branches for OpenEmbedded-Core are as follows: + +- *openembedded-core "master-next" branch:* This branch is part of the + :oe_git:`openembedded-core ` repository and contains + proposed changes to the core metadata. + +- *poky "master-next" branch:* This branch is part of the + :yocto_git:`poky ` repository and combines proposed + changes to BitBake, the core metadata and the poky distro. + +Similarly, stable branches maintained by the project may have corresponding +``-next`` branches which collect proposed changes. For example, +``&DISTRO_NAME_NO_CAP;-next`` and ``&DISTRO_NAME_NO_CAP_MINUS_ONE;-next`` +branches in both the "openembdedded-core" and "poky" repositories. + +Other layers may have similar testing branches but there is no formal +requirement or standard for these so please check the documentation for the +layers you are contributing to. + +The following sections provide procedures for submitting a change. + +Preparing Changes for Submission +-------------------------------- + +#. *Make Your Changes Locally:* Make your changes in your local Git + repository. You should make small, controlled, isolated changes. + Keeping changes small and isolated aids review, makes + merging/rebasing easier and keeps the change history clean should + anyone need to refer to it in future. + +#. *Stage Your Changes:* Stage your changes by using the ``git add`` + command on each file you changed. + +#. *Commit Your Changes:* Commit the change by using the ``git commit`` + command. Make sure your commit information follows standards by + following these accepted conventions: + + - Be sure to include a "Signed-off-by:" line in the same style as + required by the Linux kernel. This can be done by using the + ``git commit -s`` command. Adding this line signifies that you, + the submitter, have agreed to the Developer's Certificate of + Origin 1.1 as follows: + + .. code-block:: none + + Developer's Certificate of Origin 1.1 + + By making a contribution to this project, I certify that: + + (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + + (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + + (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + + (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + + - Provide a single-line summary of the change and, if more + explanation is needed, provide more detail in the body of the + commit. This summary is typically viewable in the "shortlist" of + changes. Thus, providing something short and descriptive that + gives the reader a summary of the change is useful when viewing a + list of many commits. You should prefix this short description + with the recipe name (if changing a recipe), or else with the + short form path to the file being changed. + + - For the body of the commit message, provide detailed information + that describes what you changed, why you made the change, and the + approach you used. It might also be helpful if you mention how you + tested the change. Provide as much detail as you can in the body + of the commit message. + + .. note:: + + You do not need to provide a more detailed explanation of a + change if the change is minor to the point of the single line + summary providing all the information. + + - If the change addresses a specific bug or issue that is associated + with a bug-tracking ID, include a reference to that ID in your + detailed description. For example, the Yocto Project uses a + specific convention for bug references --- any commit that addresses + a specific bug should use the following form for the detailed + description. Be sure to use the actual bug-tracking ID from + Bugzilla for bug-id:: + + Fixes [YOCTO #bug-id] + + detailed description of change + +Using Email to Submit a Patch +----------------------------- + +Depending on the components changed, you need to submit the email to a +specific mailing list. For some guidance on which mailing list to use, +see the +:ref:`list ` +at the beginning of this section. For a description of all the available +mailing lists, see the ":ref:`Mailing Lists `" section in the +Yocto Project Reference Manual. + +Here is the general procedure on how to submit a patch through email +without using the scripts once the steps in +:ref:`dev-manual/changes:preparing changes for submission` have been followed: + +#. *Format the Commit:* Format the commit into an email message. To + format commits, use the ``git format-patch`` command. When you + provide the command, you must include a revision list or a number of + patches as part of the command. For example, either of these two + commands takes your most recent single commit and formats it as an + email message in the current directory:: + + $ git format-patch -1 + + or :: + + $ git format-patch HEAD~ + + After the command is run, the current directory contains a numbered + ``.patch`` file for the commit. + + If you provide several commits as part of the command, the + ``git format-patch`` command produces a series of numbered files in + the current directory – one for each commit. If you have more than + one patch, you should also use the ``--cover`` option with the + command, which generates a cover letter as the first "patch" in the + series. You can then edit the cover letter to provide a description + for the series of patches. For information on the + ``git format-patch`` command, see ``GIT_FORMAT_PATCH(1)`` displayed + using the ``man git-format-patch`` command. + + .. note:: + + If you are or will be a frequent contributor to the Yocto Project + or to OpenEmbedded, you might consider requesting a contrib area + and the necessary associated rights. + +#. *Send the patches via email:* Send the patches to the recipients and + relevant mailing lists by using the ``git send-email`` command. + + .. note:: + + In order to use ``git send-email``, you must have the proper Git packages + installed on your host. + For Ubuntu, Debian, and Fedora the package is ``git-email``. + + The ``git send-email`` command sends email by using a local or remote + Mail Transport Agent (MTA) such as ``msmtp``, ``sendmail``, or + through a direct ``smtp`` configuration in your Git ``~/.gitconfig`` + file. If you are submitting patches through email only, it is very + important that you submit them without any whitespace or HTML + formatting that either you or your mailer introduces. The maintainer + that receives your patches needs to be able to save and apply them + directly from your emails. A good way to verify that what you are + sending will be applicable by the maintainer is to do a dry run and + send them to yourself and then save and apply them as the maintainer + would. + + The ``git send-email`` command is the preferred method for sending + your patches using email since there is no risk of compromising + whitespace in the body of the message, which can occur when you use + your own mail client. The command also has several options that let + you specify recipients and perform further editing of the email + message. For information on how to use the ``git send-email`` + command, see ``GIT-SEND-EMAIL(1)`` displayed using the + ``man git-send-email`` command. + +The Yocto Project uses a `Patchwork instance `__ +to track the status of patches submitted to the various mailing lists and to +support automated patch testing. Each submitted patch is checked for common +mistakes and deviations from the expected patch format and submitters are +notified by patchtest if such mistakes are found. This process helps to +reduce the burden of patch review on maintainers. + +.. note:: + + This system is imperfect and changes can sometimes get lost in the flow. + Asking about the status of a patch or change is reasonable if the change + has been idle for a while with no feedback. + +Using Scripts to Push a Change Upstream and Request a Pull +---------------------------------------------------------- + +For larger patch series it is preferable to send a pull request which not +only includes the patch but also a pointer to a branch that can be pulled +from. This involves making a local branch for your changes, pushing this +branch to an accessible repository and then using the ``create-pull-request`` +and ``send-pull-request`` scripts from openembedded-core to create and send a +patch series with a link to the branch for review. + +Follow this procedure to push a change to an upstream "contrib" Git +repository once the steps in :ref:`dev-manual/changes:preparing changes for submission` have +been followed: + +.. note:: + + You can find general Git information on how to push a change upstream + in the + `Git Community Book `__. + +#. *Push Your Commits to a "Contrib" Upstream:* If you have arranged for + permissions to push to an upstream contrib repository, push the + change to that repository:: + + $ git push upstream_remote_repo local_branch_name + + For example, suppose you have permissions to push + into the upstream ``meta-intel-contrib`` repository and you are + working in a local branch named `your_name`\ ``/README``. The following + command pushes your local commits to the ``meta-intel-contrib`` + upstream repository and puts the commit in a branch named + `your_name`\ ``/README``:: + + $ git push meta-intel-contrib your_name/README + +#. *Determine Who to Notify:* Determine the maintainer or the mailing + list that you need to notify for the change. + + Before submitting any change, you need to be sure who the maintainer + is or what mailing list that you need to notify. Use either these + methods to find out: + + - *Maintenance File:* Examine the ``maintainers.inc`` file, which is + located in the :term:`Source Directory` at + ``meta/conf/distro/include``, to see who is responsible for code. + + - *Search by File:* Using :ref:`overview-manual/development-environment:git`, you can + enter the following command to bring up a short list of all + commits against a specific file:: + + git shortlog -- filename + + Just provide the name of the file for which you are interested. The + information returned is not ordered by history but does include a + list of everyone who has committed grouped by name. From the list, + you can see who is responsible for the bulk of the changes against + the file. + + - *Examine the List of Mailing Lists:* For a list of the Yocto + Project and related mailing lists, see the ":ref:`Mailing + lists `" section in + the Yocto Project Reference Manual. + +#. *Make a Pull Request:* Notify the maintainer or the mailing list that + you have pushed a change by making a pull request. + + The Yocto Project provides two scripts that conveniently let you + generate and send pull requests to the Yocto Project. These scripts + are ``create-pull-request`` and ``send-pull-request``. You can find + these scripts in the ``scripts`` directory within the + :term:`Source Directory` (e.g. + ``poky/scripts``). + + Using these scripts correctly formats the requests without + introducing any whitespace or HTML formatting. The maintainer that + receives your patches either directly or through the mailing list + needs to be able to save and apply them directly from your emails. + Using these scripts is the preferred method for sending patches. + + First, create the pull request. For example, the following command + runs the script, specifies the upstream repository in the contrib + directory into which you pushed the change, and provides a subject + line in the created patch files:: + + $ poky/scripts/create-pull-request -u meta-intel-contrib -s "Updated Manual Section Reference in README" + + Running this script forms ``*.patch`` files in a folder named + ``pull-``\ `PID` in the current directory. One of the patch files is a + cover letter. + + Before running the ``send-pull-request`` script, you must edit the + cover letter patch to insert information about your change. After + editing the cover letter, send the pull request. For example, the + following command runs the script and specifies the patch directory + and email address. In this example, the email address is a mailing + list:: + + $ poky/scripts/send-pull-request -p ~/meta-intel/pull-10565 -t meta-intel@lists.yoctoproject.org + + You need to follow the prompts as the script is interactive. + + .. note:: + + For help on using these scripts, simply provide the ``-h`` + argument as follows:: + + $ poky/scripts/create-pull-request -h + $ poky/scripts/send-pull-request -h + +Responding to Patch Review +-------------------------- + +You may get feedback on your submitted patches from other community members +or from the automated patchtest service. If issues are identified in your +patch then it is usually necessary to address these before the patch will be +accepted into the project. In this case you should amend the patch according +to the feedback and submit an updated version to the relevant mailing list, +copying in the reviewers who provided feedback to the previous version of the +patch. + +The patch should be amended using ``git commit --amend`` or perhaps ``git +rebase`` for more expert git users. You should also modify the ``[PATCH]`` +tag in the email subject line when sending the revised patch to mark the new +iteration as ``[PATCH v2]``, ``[PATCH v3]``, etc as appropriate. This can be +done by passing the ``-v`` argument to ``git format-patch`` with a version +number. + +Lastly please ensure that you also test your revised changes. In particular +please don't just edit the patch file written out by ``git format-patch`` and +resend it. + +Submitting Changes to Stable Release Branches +--------------------------------------------- + +The process for proposing changes to a Yocto Project stable branch differs +from the steps described above. Changes to a stable branch must address +identified bugs or CVEs and should be made carefully in order to avoid the +risk of introducing new bugs or breaking backwards compatibility. Typically +bug fixes must already be accepted into the master branch before they can be +backported to a stable branch unless the bug in question does not affect the +master branch or the fix on the master branch is unsuitable for backporting. + +The list of stable branches along with the status and maintainer for each +branch can be obtained from the +:yocto_wiki:`Releases wiki page `. + +.. note:: + + Changes will not typically be accepted for branches which are marked as + End-Of-Life (EOL). + +With this in mind, the steps to submit a change for a stable branch are as +follows: + +#. *Identify the bug or CVE to be fixed:* This information should be + collected so that it can be included in your submission. + + See :ref:`dev-manual/vulnerabilities:checking for vulnerabilities` + for details about CVE tracking. + +#. *Check if the fix is already present in the master branch:* This will + result in the most straightforward path into the stable branch for the + fix. + + #. *If the fix is present in the master branch --- submit a backport request + by email:* You should send an email to the relevant stable branch + maintainer and the mailing list with details of the bug or CVE to be + fixed, the commit hash on the master branch that fixes the issue and + the stable branches which you would like this fix to be backported to. + + #. *If the fix is not present in the master branch --- submit the fix to the + master branch first:* This will ensure that the fix passes through the + project's usual patch review and test processes before being accepted. + It will also ensure that bugs are not left unresolved in the master + branch itself. Once the fix is accepted in the master branch a backport + request can be submitted as above. + + #. *If the fix is unsuitable for the master branch --- submit a patch + directly for the stable branch:* This method should be considered as a + last resort. It is typically necessary when the master branch is using + a newer version of the software which includes an upstream fix for the + issue or when the issue has been fixed on the master branch in a way + that introduces backwards incompatible changes. In this case follow the + steps in :ref:`dev-manual/changes:preparing changes for submission` and + :ref:`dev-manual/changes:using email to submit a patch` but modify the subject header of your patch + email to include the name of the stable branch which you are + targetting. This can be done using the ``--subject-prefix`` argument to + ``git format-patch``, for example to submit a patch to the dunfell + branch use + ``git format-patch --subject-prefix='&DISTRO_NAME_NO_CAP_MINUS_ONE;][PATCH' ...``. + diff --git a/poky/documentation/dev-manual/common-tasks.rst b/poky/documentation/dev-manual/common-tasks.rst deleted file mode 100644 index b9c467526a..0000000000 --- a/poky/documentation/dev-manual/common-tasks.rst +++ /dev/null @@ -1,11875 +0,0 @@ -.. SPDX-License-Identifier: CC-BY-SA-2.0-UK - -************ -Common Tasks -************ - -This chapter describes fundamental procedures such as creating layers, -adding new software packages, extending or customizing images, porting -work to new hardware (adding a new machine), and so forth. You will find -that the procedures documented here occur often in the development cycle -using the Yocto Project. - -Understanding and Creating Layers -================================= - -The OpenEmbedded build system supports organizing -:term:`Metadata` into multiple layers. -Layers allow you to isolate different types of customizations from each -other. For introductory information on the Yocto Project Layer Model, -see the -":ref:`overview-manual/yp-intro:the yocto project layer model`" -section in the Yocto Project Overview and Concepts Manual. - -Creating Your Own Layer ------------------------ - -.. note:: - - It is very easy to create your own layers to use with the OpenEmbedded - build system, as the Yocto Project ships with tools that speed up creating - layers. This section describes the steps you perform by hand to create - layers so that you can better understand them. For information about the - layer-creation tools, see the - ":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`" - section in the Yocto Project Board Support Package (BSP) Developer's - Guide and the ":ref:`dev-manual/common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`" - section further down in this manual. - -Follow these general steps to create your layer without using tools: - -1. *Check Existing Layers:* Before creating a new layer, you should be - sure someone has not already created a layer containing the Metadata - you need. You can see the :oe_layerindex:`OpenEmbedded Metadata Index <>` - for a list of layers from the OpenEmbedded community that can be used in - the Yocto Project. You could find a layer that is identical or close - to what you need. - -2. *Create a Directory:* Create the directory for your layer. When you - create the layer, be sure to create the directory in an area not - associated with the Yocto Project :term:`Source Directory` - (e.g. the cloned ``poky`` repository). - - While not strictly required, prepend the name of the directory with - the string "meta-". For example:: - - meta-mylayer - meta-GUI_xyz - meta-mymachine - - With rare exceptions, a layer's name follows this form:: - - meta-root_name - - Following this layer naming convention can save - you trouble later when tools, components, or variables "assume" your - layer name begins with "meta-". A notable example is in configuration - files as shown in the following step where layer names without the - "meta-" string are appended to several variables used in the - configuration. - -3. *Create a Layer Configuration File:* Inside your new layer folder, - you need to create a ``conf/layer.conf`` file. It is easiest to take - an existing layer configuration file and copy that to your layer's - ``conf`` directory and then modify the file as needed. - - The ``meta-yocto-bsp/conf/layer.conf`` file in the Yocto Project - :yocto_git:`Source Repositories ` - demonstrates the required syntax. For your layer, you need to replace - "yoctobsp" with a unique identifier for your layer (e.g. "machinexyz" - for a layer named "meta-machinexyz"):: - - # We have a conf and classes directory, add to BBPATH - BBPATH .= ":${LAYERDIR}" - - # We have recipes-* directories, add to BBFILES - BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ - ${LAYERDIR}/recipes-*/*/*.bbappend" - - BBFILE_COLLECTIONS += "yoctobsp" - BBFILE_PATTERN_yoctobsp = "^${LAYERDIR}/" - BBFILE_PRIORITY_yoctobsp = "5" - LAYERVERSION_yoctobsp = "4" - LAYERSERIES_COMPAT_yoctobsp = "dunfell" - - Following is an explanation of the layer configuration file: - - - :term:`BBPATH`: Adds the layer's - root directory to BitBake's search path. Through the use of the - :term:`BBPATH` variable, BitBake locates class files (``.bbclass``), - configuration files, and files that are included with ``include`` - and ``require`` statements. For these cases, BitBake uses the - first file that matches the name found in :term:`BBPATH`. This is - similar to the way the ``PATH`` variable is used for binaries. It - is recommended, therefore, that you use unique class and - configuration filenames in your custom layer. - - - :term:`BBFILES`: Defines the - location for all recipes in the layer. - - - :term:`BBFILE_COLLECTIONS`: - Establishes the current layer through a unique identifier that is - used throughout the OpenEmbedded build system to refer to the - layer. In this example, the identifier "yoctobsp" is the - representation for the container layer named "meta-yocto-bsp". - - - :term:`BBFILE_PATTERN`: - Expands immediately during parsing to provide the directory of the - layer. - - - :term:`BBFILE_PRIORITY`: - Establishes a priority to use for recipes in the layer when the - OpenEmbedded build finds recipes of the same name in different - layers. - - - :term:`LAYERVERSION`: - Establishes a version number for the layer. You can use this - version number to specify this exact version of the layer as a - dependency when using the - :term:`LAYERDEPENDS` - variable. - - - :term:`LAYERDEPENDS`: - Lists all layers on which this layer depends (if any). - - - :term:`LAYERSERIES_COMPAT`: - Lists the :yocto_wiki:`Yocto Project ` - releases for which the current version is compatible. This - variable is a good way to indicate if your particular layer is - current. - -4. *Add Content:* Depending on the type of layer, add the content. If - the layer adds support for a machine, add the machine configuration - in a ``conf/machine/`` file within the layer. If the layer adds - distro policy, add the distro configuration in a ``conf/distro/`` - file within the layer. If the layer introduces new recipes, put the - recipes you need in ``recipes-*`` subdirectories within the layer. - - .. note:: - - For an explanation of layer hierarchy that is compliant with the - Yocto Project, see the ":ref:`bsp-guide/bsp:example filesystem layout`" - section in the Yocto Project Board Support Package (BSP) Developer's Guide. - -5. *Optionally Test for Compatibility:* If you want permission to use - the Yocto Project Compatibility logo with your layer or application - that uses your layer, perform the steps to apply for compatibility. - See the - ":ref:`dev-manual/common-tasks:making sure your layer is compatible with yocto project`" - section for more information. - -Following Best Practices When Creating Layers ---------------------------------------------- - -To create layers that are easier to maintain and that will not impact -builds for other machines, you should consider the information in the -following list: - -- *Avoid "Overlaying" Entire Recipes from Other Layers in Your - Configuration:* In other words, do not copy an entire recipe into - your layer and then modify it. Rather, use an append file - (``.bbappend``) to override only those parts of the original recipe - you need to modify. - -- *Avoid Duplicating Include Files:* Use append files (``.bbappend``) - for each recipe that uses an include file. Or, if you are introducing - a new recipe that requires the included file, use the path relative - to the original layer directory to refer to the file. For example, - use ``require recipes-core/``\ `package`\ ``/``\ `file`\ ``.inc`` instead - of ``require`` `file`\ ``.inc``. If you're finding you have to overlay - the include file, it could indicate a deficiency in the include file - in the layer to which it originally belongs. If this is the case, you - should try to address that deficiency instead of overlaying the - include file. For example, you could address this by getting the - maintainer of the include file to add a variable or variables to make - it easy to override the parts needing to be overridden. - -- *Structure Your Layers:* Proper use of overrides within append files - and placement of machine-specific files within your layer can ensure - that a build is not using the wrong Metadata and negatively impacting - a build for a different machine. Following are some examples: - - - *Modify Variables to Support a Different Machine:* Suppose you - have a layer named ``meta-one`` that adds support for building - machine "one". To do so, you use an append file named - ``base-files.bbappend`` and create a dependency on "foo" by - altering the :term:`DEPENDS` - variable:: - - DEPENDS = "foo" - - The dependency is created during any - build that includes the layer ``meta-one``. However, you might not - want this dependency for all machines. For example, suppose you - are building for machine "two" but your ``bblayers.conf`` file has - the ``meta-one`` layer included. During the build, the - ``base-files`` for machine "two" will also have the dependency on - ``foo``. - - To make sure your changes apply only when building machine "one", - use a machine override with the :term:`DEPENDS` statement:: - - DEPENDS:one = "foo" - - You should follow the same strategy when using ``:append`` - and ``:prepend`` operations:: - - DEPENDS:append:one = " foo" - DEPENDS:prepend:one = "foo " - - As an actual example, here's a - snippet from the generic kernel include file ``linux-yocto.inc``, - wherein the kernel compile and link options are adjusted in the - case of a subset of the supported architectures:: - - DEPENDS:append:aarch64 = " libgcc" - KERNEL_CC:append:aarch64 = " ${TOOLCHAIN_OPTIONS}" - KERNEL_LD:append:aarch64 = " ${TOOLCHAIN_OPTIONS}" - - DEPENDS:append:nios2 = " libgcc" - KERNEL_CC:append:nios2 = " ${TOOLCHAIN_OPTIONS}" - KERNEL_LD:append:nios2 = " ${TOOLCHAIN_OPTIONS}" - - DEPENDS:append:arc = " libgcc" - KERNEL_CC:append:arc = " ${TOOLCHAIN_OPTIONS}" - KERNEL_LD:append:arc = " ${TOOLCHAIN_OPTIONS}" - - KERNEL_FEATURES:append:qemuall=" features/debug/printk.scc" - - - *Place Machine-Specific Files in Machine-Specific Locations:* When - you have a base recipe, such as ``base-files.bb``, that contains a - :term:`SRC_URI` statement to a - file, you can use an append file to cause the build to use your - own version of the file. For example, an append file in your layer - at ``meta-one/recipes-core/base-files/base-files.bbappend`` could - extend :term:`FILESPATH` using :term:`FILESEXTRAPATHS` as follows:: - - FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" - - The build for machine "one" will pick up your machine-specific file as - long as you have the file in - ``meta-one/recipes-core/base-files/base-files/``. However, if you - are building for a different machine and the ``bblayers.conf`` - file includes the ``meta-one`` layer and the location of your - machine-specific file is the first location where that file is - found according to :term:`FILESPATH`, builds for all machines will - also use that machine-specific file. - - You can make sure that a machine-specific file is used for a - particular machine by putting the file in a subdirectory specific - to the machine. For example, rather than placing the file in - ``meta-one/recipes-core/base-files/base-files/`` as shown above, - put it in ``meta-one/recipes-core/base-files/base-files/one/``. - Not only does this make sure the file is used only when building - for machine "one", but the build process locates the file more - quickly. - - In summary, you need to place all files referenced from - :term:`SRC_URI` in a machine-specific subdirectory within the layer in - order to restrict those files to machine-specific builds. - -- *Perform Steps to Apply for Yocto Project Compatibility:* If you want - permission to use the Yocto Project Compatibility logo with your - layer or application that uses your layer, perform the steps to apply - for compatibility. See the - ":ref:`dev-manual/common-tasks:making sure your layer is compatible with yocto project`" - section for more information. - -- *Follow the Layer Naming Convention:* Store custom layers in a Git - repository that use the ``meta-layer_name`` format. - -- *Group Your Layers Locally:* Clone your repository alongside other - cloned ``meta`` directories from the :term:`Source Directory`. - -Making Sure Your Layer is Compatible With Yocto Project -------------------------------------------------------- - -When you create a layer used with the Yocto Project, it is advantageous -to make sure that the layer interacts well with existing Yocto Project -layers (i.e. the layer is compatible with the Yocto Project). Ensuring -compatibility makes the layer easy to be consumed by others in the Yocto -Project community and could allow you permission to use the Yocto -Project Compatible Logo. - -.. note:: - - Only Yocto Project member organizations are permitted to use the - Yocto Project Compatible Logo. The logo is not available for general - use. For information on how to become a Yocto Project member - organization, see the :yocto_home:`Yocto Project Website <>`. - -The Yocto Project Compatibility Program consists of a layer application -process that requests permission to use the Yocto Project Compatibility -Logo for your layer and application. The process consists of two parts: - -1. Successfully passing a script (``yocto-check-layer``) that when run - against your layer, tests it against constraints based on experiences - of how layers have worked in the real world and where pitfalls have - been found. Getting a "PASS" result from the script is required for - successful compatibility registration. - -2. Completion of an application acceptance form, which you can find at - :yocto_home:`/webform/yocto-project-compatible-registration`. - -To be granted permission to use the logo, you need to satisfy the -following: - -- Be able to check the box indicating that you got a "PASS" when - running the script against your layer. - -- Answer "Yes" to the questions on the form or have an acceptable - explanation for any questions answered "No". - -- Be a Yocto Project Member Organization. - -The remainder of this section presents information on the registration -form and on the ``yocto-check-layer`` script. - -Yocto Project Compatible Program Application -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Use the form to apply for your layer's approval. Upon successful -application, you can use the Yocto Project Compatibility Logo with your -layer and the application that uses your layer. - -To access the form, use this link: -:yocto_home:`/webform/yocto-project-compatible-registration`. -Follow the instructions on the form to complete your application. - -The application consists of the following sections: - -- *Contact Information:* Provide your contact information as the fields - require. Along with your information, provide the released versions - of the Yocto Project for which your layer is compatible. - -- *Acceptance Criteria:* Provide "Yes" or "No" answers for each of the - items in the checklist. There is space at the bottom of the form for - any explanations for items for which you answered "No". - -- *Recommendations:* Provide answers for the questions regarding Linux - kernel use and build success. - -``yocto-check-layer`` Script -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ``yocto-check-layer`` script provides you a way to assess how -compatible your layer is with the Yocto Project. You should run this -script prior to using the form to apply for compatibility as described -in the previous section. You need to achieve a "PASS" result in order to -have your application form successfully processed. - -The script divides tests into three areas: COMMON, BSP, and DISTRO. For -example, given a distribution layer (DISTRO), the layer must pass both -the COMMON and DISTRO related tests. Furthermore, if your layer is a BSP -layer, the layer must pass the COMMON and BSP set of tests. - -To execute the script, enter the following commands from your build -directory:: - - $ source oe-init-build-env - $ yocto-check-layer your_layer_directory - -Be sure to provide the actual directory for your -layer as part of the command. - -Entering the command causes the script to determine the type of layer -and then to execute a set of specific tests against the layer. The -following list overviews the test: - -- ``common.test_readme``: Tests if a ``README`` file exists in the - layer and the file is not empty. - -- ``common.test_parse``: Tests to make sure that BitBake can parse the - files without error (i.e. ``bitbake -p``). - -- ``common.test_show_environment``: Tests that the global or per-recipe - environment is in order without errors (i.e. ``bitbake -e``). - -- ``common.test_world``: Verifies that ``bitbake world`` works. - -- ``common.test_signatures``: Tests to be sure that BSP and DISTRO - layers do not come with recipes that change signatures. - -- ``common.test_layerseries_compat``: Verifies layer compatibility is - set properly. - -- ``bsp.test_bsp_defines_machines``: Tests if a BSP layer has machine - configurations. - -- ``bsp.test_bsp_no_set_machine``: Tests to ensure a BSP layer does not - set the machine when the layer is added. - -- ``bsp.test_machine_world``: Verifies that ``bitbake world`` works - regardless of which machine is selected. - -- ``bsp.test_machine_signatures``: Verifies that building for a - particular machine affects only the signature of tasks specific to - that machine. - -- ``distro.test_distro_defines_distros``: Tests if a DISTRO layer has - distro configurations. - -- ``distro.test_distro_no_set_distros``: Tests to ensure a DISTRO layer - does not set the distribution when the layer is added. - -Enabling Your Layer -------------------- - -Before the OpenEmbedded build system can use your new layer, you need to -enable it. To enable your layer, simply add your layer's path to the -:term:`BBLAYERS` variable in your ``conf/bblayers.conf`` file, which is -found in the :term:`Build Directory`. The following example shows how to -enable your new ``meta-mylayer`` layer (note how your new layer exists -outside of the official ``poky`` repository which you would have checked -out earlier):: - - # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf - # changes incompatibly - POKY_BBLAYERS_CONF_VERSION = "2" - BBPATH = "${TOPDIR}" - BBFILES ?= "" - BBLAYERS ?= " \ - /home/user/poky/meta \ - /home/user/poky/meta-poky \ - /home/user/poky/meta-yocto-bsp \ - /home/user/mystuff/meta-mylayer \ - " - -BitBake parses each ``conf/layer.conf`` file from the top down as -specified in the :term:`BBLAYERS` variable within the ``conf/bblayers.conf`` -file. During the processing of each ``conf/layer.conf`` file, BitBake -adds the recipes, classes and configurations contained within the -particular layer to the source directory. - -Appending Other Layers Metadata With Your Layer ------------------------------------------------ - -A recipe that appends Metadata to another recipe is called a BitBake -append file. A BitBake append file uses the ``.bbappend`` file type -suffix, while the corresponding recipe to which Metadata is being -appended uses the ``.bb`` file type suffix. - -You can use a ``.bbappend`` file in your layer to make additions or -changes to the content of another layer's recipe without having to copy -the other layer's recipe into your layer. Your ``.bbappend`` file -resides in your layer, while the main ``.bb`` recipe file to which you -are appending Metadata resides in a different layer. - -Being able to append information to an existing recipe not only avoids -duplication, but also automatically applies recipe changes from a -different layer into your layer. If you were copying recipes, you would -have to manually merge changes as they occur. - -When you create an append file, you must use the same root name as the -corresponding recipe file. For example, the append file -``someapp_3.1.bbappend`` must apply to ``someapp_3.1.bb``. This -means the original recipe and append filenames are version -number-specific. If the corresponding recipe is renamed to update to a -newer version, you must also rename and possibly update the -corresponding ``.bbappend`` as well. During the build process, BitBake -displays an error on starting if it detects a ``.bbappend`` file that -does not have a corresponding recipe with a matching name. See the -:term:`BB_DANGLINGAPPENDS_WARNONLY` -variable for information on how to handle this error. - -Overlaying a File Using Your Layer -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -As an example, consider the main formfactor recipe and a corresponding -formfactor append file both from the :term:`Source Directory`. -Here is the main -formfactor recipe, which is named ``formfactor_0.0.bb`` and located in -the "meta" layer at ``meta/recipes-bsp/formfactor``:: - - SUMMARY = "Device formfactor information" - DESCRIPTION = "A formfactor configuration file provides information about the \ - target hardware for which the image is being built and information that the \ - build system cannot obtain from other sources such as the kernel." - SECTION = "base" - LICENSE = "MIT" - LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - PR = "r45" - - SRC_URI = "file://config file://machconfig" - S = "${WORKDIR}" - - PACKAGE_ARCH = "${MACHINE_ARCH}" - INHIBIT_DEFAULT_DEPS = "1" - - do_install() { - # Install file only if it has contents - install -d ${D}${sysconfdir}/formfactor/ - install -m 0644 ${S}/config ${D}${sysconfdir}/formfactor/ - if [ -s "${S}/machconfig" ]; then - install -m 0644 ${S}/machconfig ${D}${sysconfdir}/formfactor/ - fi - } - -In the main recipe, note the :term:`SRC_URI` -variable, which tells the OpenEmbedded build system where to find files -during the build. - -Following is the append file, which is named ``formfactor_0.0.bbappend`` -and is from the Raspberry Pi BSP Layer named ``meta-raspberrypi``. The -file is in the layer at ``recipes-bsp/formfactor``:: - - FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - -By default, the build system uses the -:term:`FILESPATH` variable to -locate files. This append file extends the locations by setting the -:term:`FILESEXTRAPATHS` -variable. Setting this variable in the ``.bbappend`` file is the most -reliable and recommended method for adding directories to the search -path used by the build system to find files. - -The statement in this example extends the directories to include -``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}``, -which resolves to a directory named ``formfactor`` in the same directory -in which the append file resides (i.e. -``meta-raspberrypi/recipes-bsp/formfactor``. This implies that you must -have the supporting directory structure set up that will contain any -files or patches you will be including from the layer. - -Using the immediate expansion assignment operator ``:=`` is important -because of the reference to :term:`THISDIR`. The trailing colon character is -important as it ensures that items in the list remain colon-separated. - -.. note:: - - BitBake automatically defines the :term:`THISDIR` variable. You should - never set this variable yourself. Using ":prepend" as part of the - :term:`FILESEXTRAPATHS` ensures your path will be searched prior to other - paths in the final list. - - Also, not all append files add extra files. Many append files simply - allow to add build options (e.g. ``systemd``). For these cases, your - append file would not even use the :term:`FILESEXTRAPATHS` statement. - -The end result of this ``.bbappend`` file is that on a Raspberry Pi, where -``rpi`` will exist in the list of :term:`OVERRIDES`, the file -``meta-raspberrypi/recipes-bsp/formfactor/formfactor/rpi/machconfig`` will be -used during :ref:`ref-tasks-fetch` and the test for a non-zero file size in -:ref:`ref-tasks-install` will return true, and the file will be installed. - -Installing Additional Files Using Your Layer -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -As another example, consider the main ``xserver-xf86-config`` recipe and a -corresponding ``xserver-xf86-config`` append file both from the :term:`Source -Directory`. Here is the main ``xserver-xf86-config`` recipe, which is named -``xserver-xf86-config_0.1.bb`` and located in the "meta" layer at -``meta/recipes-graphics/xorg-xserver``:: - - SUMMARY = "X.Org X server configuration file" - HOMEPAGE = "http://www.x.org" - SECTION = "x11/base" - LICENSE = "MIT" - LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - PR = "r33" - - SRC_URI = "file://xorg.conf" - - S = "${WORKDIR}" - - CONFFILES:${PN} = "${sysconfdir}/X11/xorg.conf" - - PACKAGE_ARCH = "${MACHINE_ARCH}" - ALLOW_EMPTY:${PN} = "1" - - do_install () { - if test -s ${WORKDIR}/xorg.conf; then - install -d ${D}/${sysconfdir}/X11 - install -m 0644 ${WORKDIR}/xorg.conf ${D}/${sysconfdir}/X11/ - fi - } - -Following is the append file, which is named ``xserver-xf86-config_%.bbappend`` -and is from the Raspberry Pi BSP Layer named ``meta-raspberrypi``. The -file is in the layer at ``recipes-graphics/xorg-xserver``:: - - FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - - SRC_URI:append:rpi = " \ - file://xorg.conf.d/98-pitft.conf \ - file://xorg.conf.d/99-calibration.conf \ - " - do_install:append:rpi () { - PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}" - if [ "${PITFT}" = "1" ]; then - install -d ${D}/${sysconfdir}/X11/xorg.conf.d/ - install -m 0644 ${WORKDIR}/xorg.conf.d/98-pitft.conf ${D}/${sysconfdir}/X11/xorg.conf.d/ - install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/ - fi - } - - FILES:${PN}:append:rpi = " ${sysconfdir}/X11/xorg.conf.d/*" - -Building off of the previous example, we once again are setting the -:term:`FILESEXTRAPATHS` variable. In this case we are also using -:term:`SRC_URI` to list additional source files to use when ``rpi`` is found in -the list of :term:`OVERRIDES`. The :ref:`ref-tasks-install` task will then perform a -check for an additional :term:`MACHINE_FEATURES` that if set will cause these -additional files to be installed. These additional files are listed in -:term:`FILES` so that they will be packaged. - -Prioritizing Your Layer ------------------------ - -Each layer is assigned a priority value. Priority values control which -layer takes precedence if there are recipe files with the same name in -multiple layers. For these cases, the recipe file from the layer with a -higher priority number takes precedence. Priority values also affect the -order in which multiple ``.bbappend`` files for the same recipe are -applied. You can either specify the priority manually, or allow the -build system to calculate it based on the layer's dependencies. - -To specify the layer's priority manually, use the -:term:`BBFILE_PRIORITY` -variable and append the layer's root name:: - - BBFILE_PRIORITY_mylayer = "1" - -.. note:: - - It is possible for a recipe with a lower version number - :term:`PV` in a layer that has a higher - priority to take precedence. - - Also, the layer priority does not currently affect the precedence - order of ``.conf`` or ``.bbclass`` files. Future versions of BitBake - might address this. - -Managing Layers ---------------- - -You can use the BitBake layer management tool ``bitbake-layers`` to -provide a view into the structure of recipes across a multi-layer -project. Being able to generate output that reports on configured layers -with their paths and priorities and on ``.bbappend`` files and their -applicable recipes can help to reveal potential problems. - -For help on the BitBake layer management tool, use the following -command:: - - $ bitbake-layers --help - -The following list describes the available commands: - -- ``help:`` Displays general help or help on a specified command. - -- ``show-layers:`` Shows the current configured layers. - -- ``show-overlayed:`` Lists overlayed recipes. A recipe is overlayed - when a recipe with the same name exists in another layer that has a - higher layer priority. - -- ``show-recipes:`` Lists available recipes and the layers that - provide them. - -- ``show-appends:`` Lists ``.bbappend`` files and the recipe files to - which they apply. - -- ``show-cross-depends:`` Lists dependency relationships between - recipes that cross layer boundaries. - -- ``add-layer:`` Adds a layer to ``bblayers.conf``. - -- ``remove-layer:`` Removes a layer from ``bblayers.conf`` - -- ``flatten:`` Flattens the layer configuration into a separate - output directory. Flattening your layer configuration builds a - "flattened" directory that contains the contents of all layers, with - any overlayed recipes removed and any ``.bbappend`` files appended to - the corresponding recipes. You might have to perform some manual - cleanup of the flattened layer as follows: - - - Non-recipe files (such as patches) are overwritten. The flatten - command shows a warning for these files. - - - Anything beyond the normal layer setup has been added to the - ``layer.conf`` file. Only the lowest priority layer's - ``layer.conf`` is used. - - - Overridden and appended items from ``.bbappend`` files need to be - cleaned up. The contents of each ``.bbappend`` end up in the - flattened recipe. However, if there are appended or changed - variable values, you need to tidy these up yourself. Consider the - following example. Here, the ``bitbake-layers`` command adds the - line ``#### bbappended ...`` so that you know where the following - lines originate:: - - ... - DESCRIPTION = "A useful utility" - ... - EXTRA_OECONF = "--enable-something" - ... - - #### bbappended from meta-anotherlayer #### - - DESCRIPTION = "Customized utility" - EXTRA_OECONF += "--enable-somethingelse" - - - Ideally, you would tidy up these utilities as follows:: - - ... - DESCRIPTION = "Customized utility" - ... - EXTRA_OECONF = "--enable-something --enable-somethingelse" - ... - -- ``layerindex-fetch``: Fetches a layer from a layer index, along - with its dependent layers, and adds the layers to the - ``conf/bblayers.conf`` file. - -- ``layerindex-show-depends``: Finds layer dependencies from the - layer index. - -- ``save-build-conf``: Saves the currently active build configuration - (``conf/local.conf``, ``conf/bblayers.conf``) as a template into a layer. - This template can later be used for setting up builds via :term:``TEMPLATECONF``. - For information about saving and using configuration templates, see - ":ref:`dev-manual/common-tasks:creating a custom template configuration directory`". - -- ``create-layer``: Creates a basic layer. - -- ``create-layers-setup``: Writes out a configuration file and/or a script that - can replicate the directory structure and revisions of the layers in a current build. - For more information, see ":ref:`dev-manual/common-tasks:saving and restoring the layers setup`". - -Creating a General Layer Using the ``bitbake-layers`` Script ------------------------------------------------------------- - -The ``bitbake-layers`` script with the ``create-layer`` subcommand -simplifies creating a new general layer. - -.. note:: - - - For information on BSP layers, see the ":ref:`bsp-guide/bsp:bsp layers`" - section in the Yocto - Project Board Specific (BSP) Developer's Guide. - - - In order to use a layer with the OpenEmbedded build system, you - need to add the layer to your ``bblayers.conf`` configuration - file. See the ":ref:`dev-manual/common-tasks:adding a layer using the \`\`bitbake-layers\`\` script`" - section for more information. - -The default mode of the script's operation with this subcommand is to -create a layer with the following: - -- A layer priority of 6. - -- A ``conf`` subdirectory that contains a ``layer.conf`` file. - -- A ``recipes-example`` subdirectory that contains a further - subdirectory named ``example``, which contains an ``example.bb`` - recipe file. - -- A ``COPYING.MIT``, which is the license statement for the layer. The - script assumes you want to use the MIT license, which is typical for - most layers, for the contents of the layer itself. - -- A ``README`` file, which is a file describing the contents of your - new layer. - -In its simplest form, you can use the following command form to create a -layer. The command creates a layer whose name corresponds to -"your_layer_name" in the current directory:: - - $ bitbake-layers create-layer your_layer_name - -As an example, the following command creates a layer named ``meta-scottrif`` -in your home directory:: - - $ cd /usr/home - $ bitbake-layers create-layer meta-scottrif - NOTE: Starting bitbake server... - Add your new layer with 'bitbake-layers add-layer meta-scottrif' - -If you want to set the priority of the layer to other than the default -value of "6", you can either use the ``--priority`` option or you -can edit the -:term:`BBFILE_PRIORITY` value -in the ``conf/layer.conf`` after the script creates it. Furthermore, if -you want to give the example recipe file some name other than the -default, you can use the ``--example-recipe-name`` option. - -The easiest way to see how the ``bitbake-layers create-layer`` command -works is to experiment with the script. You can also read the usage -information by entering the following:: - - $ bitbake-layers create-layer --help - NOTE: Starting bitbake server... - usage: bitbake-layers create-layer [-h] [--priority PRIORITY] - [--example-recipe-name EXAMPLERECIPE] - layerdir - - Create a basic layer - - positional arguments: - layerdir Layer directory to create - - optional arguments: - -h, --help show this help message and exit - --priority PRIORITY, -p PRIORITY - Layer directory to create - --example-recipe-name EXAMPLERECIPE, -e EXAMPLERECIPE - Filename of the example recipe - -Adding a Layer Using the ``bitbake-layers`` Script --------------------------------------------------- - -Once you create your general layer, you must add it to your -``bblayers.conf`` file. Adding the layer to this configuration file -makes the OpenEmbedded build system aware of your layer so that it can -search it for metadata. - -Add your layer by using the ``bitbake-layers add-layer`` command:: - - $ bitbake-layers add-layer your_layer_name - -Here is an example that adds a -layer named ``meta-scottrif`` to the configuration file. Following the -command that adds the layer is another ``bitbake-layers`` command that -shows the layers that are in your ``bblayers.conf`` file:: - - $ bitbake-layers add-layer meta-scottrif - NOTE: Starting bitbake server... - Parsing recipes: 100% |##########################################################| Time: 0:00:49 - Parsing of 1441 .bb files complete (0 cached, 1441 parsed). 2055 targets, 56 skipped, 0 masked, 0 errors. - $ bitbake-layers show-layers - NOTE: Starting bitbake server... - layer path priority - ========================================================================== - meta /home/scottrif/poky/meta 5 - meta-poky /home/scottrif/poky/meta-poky 5 - meta-yocto-bsp /home/scottrif/poky/meta-yocto-bsp 5 - workspace /home/scottrif/poky/build/workspace 99 - meta-scottrif /home/scottrif/poky/build/meta-scottrif 6 - - -Adding the layer to this file -enables the build system to locate the layer during the build. - -.. note:: - - During a build, the OpenEmbedded build system looks in the layers - from the top of the list down to the bottom in that order. - -Saving and restoring the layers setup -------------------------------------- - -Once you have a working build with the correct set of layers, it is beneficial -to capture the layer setup --- what they are, which repositories they come from -and which SCM revisions they're at --- into a configuration file, so that this -setup can be easily replicated later, perhaps on a different machine. Here's -how to do this:: - - $ bitbake-layers create-layers-setup /srv/work/alex/meta-alex/ - NOTE: Starting bitbake server... - NOTE: Created /srv/work/alex/meta-alex/setup-layers.json - NOTE: Created /srv/work/alex/meta-alex/setup-layers - -The tool needs a single argument which tells where to place the output, consisting -of a json formatted layer configuration, and a ``setup-layers`` script that can use that configuration -to restore the layers in a different location, or on a different host machine. The argument -can point to a custom layer (which is then deemed a "bootstrap" layer that needs to be -checked out first), or into a completely independent location. - -The replication of the layers is performed by running the ``setup-layers`` script provided -above: - -1. Clone the bootstrap layer or some other repository to obtain - the json config and the setup script that can use it. - -2. Run the script directly with no options:: - - alex@Zen2:/srv/work/alex/my-build$ meta-alex/setup-layers - Note: not checking out source meta-alex, use --force-bootstraplayer-checkout to override. - - Setting up source meta-intel, revision 15.0-hardknott-3.3-310-g0a96edae, branch master - Running 'git init -q /srv/work/alex/my-build/meta-intel' - Running 'git remote remove origin > /dev/null 2>&1; git remote add origin git://git.yoctoproject.org/meta-intel' in /srv/work/alex/my-build/meta-intel - Running 'git fetch -q origin || true' in /srv/work/alex/my-build/meta-intel - Running 'git checkout -q 0a96edae609a3f48befac36af82cf1eed6786b4a' in /srv/work/alex/my-build/meta-intel - - Setting up source poky, revision 4.1_M1-372-g55483d28f2, branch akanavin/setup-layers - Running 'git init -q /srv/work/alex/my-build/poky' - Running 'git remote remove origin > /dev/null 2>&1; git remote add origin git://git.yoctoproject.org/poky' in /srv/work/alex/my-build/poky - Running 'git fetch -q origin || true' in /srv/work/alex/my-build/poky - Running 'git remote remove poky-contrib > /dev/null 2>&1; git remote add poky-contrib ssh://git@push.yoctoproject.org/poky-contrib' in /srv/work/alex/my-build/poky - Running 'git fetch -q poky-contrib || true' in /srv/work/alex/my-build/poky - Running 'git checkout -q 11db0390b02acac1324e0f827beb0e2e3d0d1d63' in /srv/work/alex/my-build/poky - -.. note:: - This will work to update an existing checkout as well. - -.. note:: - The script is self-sufficient and requires only python3 - and git on the build machine. - -.. note:: - Both the ``create-layers-setup`` and the ``setup-layers`` provided several additional options - that customize their behavior - you are welcome to study them via ``--help`` command line parameter. - -Customizing Images -================== - -You can customize images to satisfy particular requirements. This -section describes several methods and provides guidelines for each. - -Customizing Images Using ``local.conf`` ---------------------------------------- - -Probably the easiest way to customize an image is to add a package by -way of the ``local.conf`` configuration file. Because it is limited to -local use, this method generally only allows you to add packages and is -not as flexible as creating your own customized image. When you add -packages using local variables this way, you need to realize that these -variable changes are in effect for every build and consequently affect -all images, which might not be what you require. - -To add a package to your image using the local configuration file, use -the :term:`IMAGE_INSTALL` variable with the ``:append`` operator:: - - IMAGE_INSTALL:append = " strace" - -Use of the syntax is important; specifically, the leading space -after the opening quote and before the package name, which is -``strace`` in this example. This space is required since the ``:append`` -operator does not add the space. - -Furthermore, you must use ``:append`` instead of the ``+=`` operator if -you want to avoid ordering issues. The reason for this is because doing -so unconditionally appends to the variable and avoids ordering problems -due to the variable being set in image recipes and ``.bbclass`` files -with operators like ``?=``. Using ``:append`` ensures the operation -takes effect. - -As shown in its simplest use, ``IMAGE_INSTALL:append`` affects all -images. It is possible to extend the syntax so that the variable applies -to a specific image only. Here is an example:: - - IMAGE_INSTALL:append:pn-core-image-minimal = " strace" - -This example adds ``strace`` to the ``core-image-minimal`` image only. - -You can add packages using a similar approach through the -:term:`CORE_IMAGE_EXTRA_INSTALL` variable. If you use this variable, only -``core-image-*`` images are affected. - -Customizing Images Using Custom ``IMAGE_FEATURES`` and ``EXTRA_IMAGE_FEATURES`` -------------------------------------------------------------------------------- - -Another method for customizing your image is to enable or disable -high-level image features by using the -:term:`IMAGE_FEATURES` and -:term:`EXTRA_IMAGE_FEATURES` -variables. Although the functions for both variables are nearly -equivalent, best practices dictate using :term:`IMAGE_FEATURES` from within -a recipe and using :term:`EXTRA_IMAGE_FEATURES` from within your -``local.conf`` file, which is found in the :term:`Build Directory`. - -To understand how these features work, the best reference is -:ref:`meta/classes-recipe/image.bbclass `. -This class lists out the available -:term:`IMAGE_FEATURES` of which most map to package groups while some, such -as ``debug-tweaks`` and ``read-only-rootfs``, resolve as general -configuration settings. - -In summary, the file looks at the contents of the :term:`IMAGE_FEATURES` -variable and then maps or configures the feature accordingly. Based on -this information, the build system automatically adds the appropriate -packages or configurations to the -:term:`IMAGE_INSTALL` variable. -Effectively, you are enabling extra features by extending the class or -creating a custom class for use with specialized image ``.bb`` files. - -Use the :term:`EXTRA_IMAGE_FEATURES` variable from within your local -configuration file. Using a separate area from which to enable features -with this variable helps you avoid overwriting the features in the image -recipe that are enabled with :term:`IMAGE_FEATURES`. The value of -:term:`EXTRA_IMAGE_FEATURES` is added to :term:`IMAGE_FEATURES` within -``meta/conf/bitbake.conf``. - -To illustrate how you can use these variables to modify your image, -consider an example that selects the SSH server. The Yocto Project ships -with two SSH servers you can use with your images: Dropbear and OpenSSH. -Dropbear is a minimal SSH server appropriate for resource-constrained -environments, while OpenSSH is a well-known standard SSH server -implementation. By default, the ``core-image-sato`` image is configured -to use Dropbear. The ``core-image-full-cmdline`` and ``core-image-lsb`` -images both include OpenSSH. The ``core-image-minimal`` image does not -contain an SSH server. - -You can customize your image and change these defaults. Edit the -:term:`IMAGE_FEATURES` variable in your recipe or use the -:term:`EXTRA_IMAGE_FEATURES` in your ``local.conf`` file so that it -configures the image you are working with to include -``ssh-server-dropbear`` or ``ssh-server-openssh``. - -.. note:: - - See the ":ref:`ref-manual/features:image features`" section in the Yocto - Project Reference Manual for a complete list of image features that ship - with the Yocto Project. - -Customizing Images Using Custom .bb Files ------------------------------------------ - -You can also customize an image by creating a custom recipe that defines -additional software as part of the image. The following example shows -the form for the two lines you need:: - - IMAGE_INSTALL = "packagegroup-core-x11-base package1 package2" - inherit core-image - -Defining the software using a custom recipe gives you total control over -the contents of the image. It is important to use the correct names of -packages in the :term:`IMAGE_INSTALL` variable. You must use the -OpenEmbedded notation and not the Debian notation for the names (e.g. -``glibc-dev`` instead of ``libc6-dev``). - -The other method for creating a custom image is to base it on an -existing image. For example, if you want to create an image based on -``core-image-sato`` but add the additional package ``strace`` to the -image, copy the ``meta/recipes-sato/images/core-image-sato.bb`` to a new -``.bb`` and add the following line to the end of the copy:: - - IMAGE_INSTALL += "strace" - -Customizing Images Using Custom Package Groups ----------------------------------------------- - -For complex custom images, the best approach for customizing an image is -to create a custom package group recipe that is used to build the image -or images. A good example of a package group recipe is -``meta/recipes-core/packagegroups/packagegroup-base.bb``. - -If you examine that recipe, you see that the :term:`PACKAGES` variable lists -the package group packages to produce. The ``inherit packagegroup`` -statement sets appropriate default values and automatically adds -``-dev``, ``-dbg``, and ``-ptest`` complementary packages for each -package specified in the :term:`PACKAGES` statement. - -.. note:: - - The ``inherit packagegroup`` line should be located near the top of the - recipe, certainly before the :term:`PACKAGES` statement. - -For each package you specify in :term:`PACKAGES`, you can use :term:`RDEPENDS` -and :term:`RRECOMMENDS` entries to provide a list of packages the parent -task package should contain. You can see examples of these further down -in the ``packagegroup-base.bb`` recipe. - -Here is a short, fabricated example showing the same basic pieces for a -hypothetical packagegroup defined in ``packagegroup-custom.bb``, where -the variable :term:`PN` is the standard way to abbreviate the reference to -the full packagegroup name ``packagegroup-custom``:: - - DESCRIPTION = "My Custom Package Groups" - - inherit packagegroup - - PACKAGES = "\ - ${PN}-apps \ - ${PN}-tools \ - " - - RDEPENDS:${PN}-apps = "\ - dropbear \ - portmap \ - psplash" - - RDEPENDS:${PN}-tools = "\ - oprofile \ - oprofileui-server \ - lttng-tools" - - RRECOMMENDS:${PN}-tools = "\ - kernel-module-oprofile" - -In the previous example, two package group packages are created with -their dependencies and their recommended package dependencies listed: -``packagegroup-custom-apps``, and ``packagegroup-custom-tools``. To -build an image using these package group packages, you need to add -``packagegroup-custom-apps`` and/or ``packagegroup-custom-tools`` to -:term:`IMAGE_INSTALL`. For other forms of image dependencies see the other -areas of this section. - -Customizing an Image Hostname ------------------------------ - -By default, the configured hostname (i.e. ``/etc/hostname``) in an image -is the same as the machine name. For example, if -:term:`MACHINE` equals "qemux86", the -configured hostname written to ``/etc/hostname`` is "qemux86". - -You can customize this name by altering the value of the "hostname" -variable in the ``base-files`` recipe using either an append file or a -configuration file. Use the following in an append file:: - - hostname = "myhostname" - -Use the following in a configuration file:: - - hostname:pn-base-files = "myhostname" - -Changing the default value of the variable "hostname" can be useful in -certain situations. For example, suppose you need to do extensive -testing on an image and you would like to easily identify the image -under test from existing images with typical default hostnames. In this -situation, you could change the default hostname to "testme", which -results in all the images using the name "testme". Once testing is -complete and you do not need to rebuild the image for test any longer, -you can easily reset the default hostname. - -Another point of interest is that if you unset the variable, the image -will have no default hostname in the filesystem. Here is an example that -unsets the variable in a configuration file:: - - hostname:pn-base-files = "" - -Having no default hostname in the filesystem is suitable for -environments that use dynamic hostnames such as virtual machines. - -Writing a New Recipe -==================== - -Recipes (``.bb`` files) are fundamental components in the Yocto Project -environment. Each software component built by the OpenEmbedded build -system requires a recipe to define the component. This section describes -how to create, write, and test a new recipe. - -.. note:: - - For information on variables that are useful for recipes and for - information about recipe naming issues, see the - ":ref:`ref-manual/varlocality:recipes`" section of the Yocto Project - Reference Manual. - -Overview --------- - -The following figure shows the basic process for creating a new recipe. -The remainder of the section provides details for the steps. - -.. image:: figures/recipe-workflow.png - :align: center - :width: 50% - -Locate or Automatically Create a Base Recipe --------------------------------------------- - -You can always write a recipe from scratch. However, there are three choices -that can help you quickly get started with a new recipe: - -- ``devtool add``: A command that assists in creating a recipe and an - environment conducive to development. - -- ``recipetool create``: A command provided by the Yocto Project that - automates creation of a base recipe based on the source files. - -- *Existing Recipes:* Location and modification of an existing recipe - that is similar in function to the recipe you need. - -.. note:: - - For information on recipe syntax, see the - ":ref:`dev-manual/common-tasks:recipe syntax`" section. - -Creating the Base Recipe Using ``devtool add`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ``devtool add`` command uses the same logic for auto-creating the -recipe as ``recipetool create``, which is listed below. Additionally, -however, ``devtool add`` sets up an environment that makes it easy for -you to patch the source and to make changes to the recipe as is often -necessary when adding a recipe to build a new piece of software to be -included in a build. - -You can find a complete description of the ``devtool add`` command in -the ":ref:`sdk-manual/extensible:a closer look at \`\`devtool add\`\``" section -in the Yocto Project Application Development and the Extensible Software -Development Kit (eSDK) manual. - -Creating the Base Recipe Using ``recipetool create`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``recipetool create`` automates creation of a base recipe given a set of -source code files. As long as you can extract or point to the source -files, the tool will construct a recipe and automatically configure all -pre-build information into the recipe. For example, suppose you have an -application that builds using Autotools. Creating the base recipe using -``recipetool`` results in a recipe that has the pre-build dependencies, -license requirements, and checksums configured. - -To run the tool, you just need to be in your :term:`Build Directory` and -have sourced the build environment setup script (i.e. -:ref:`structure-core-script`). To get help on the tool, use the following -command:: - - $ recipetool -h - NOTE: Starting bitbake server... - usage: recipetool [-d] [-q] [--color COLOR] [-h] ... - - OpenEmbedded recipe tool - - options: - -d, --debug Enable debug output - -q, --quiet Print only errors - --color COLOR Colorize output (where COLOR is auto, always, never) - -h, --help show this help message and exit - - subcommands: - create Create a new recipe - newappend Create a bbappend for the specified target in the specified - layer - setvar Set a variable within a recipe - appendfile Create/update a bbappend to replace a target file - appendsrcfiles Create/update a bbappend to add or replace source files - appendsrcfile Create/update a bbappend to add or replace a source file - Use recipetool --help to get help on a specific command - -Running ``recipetool create -o OUTFILE`` creates the base recipe and -locates it properly in the layer that contains your source files. -Following are some syntax examples: - - - Use this syntax to generate a recipe based on source. Once generated, - the recipe resides in the existing source code layer:: - - recipetool create -o OUTFILE source - - - Use this syntax to generate a recipe using code that - you extract from source. The extracted code is placed in its own layer - defined by :term:`EXTERNALSRC`. - :: - - recipetool create -o OUTFILE -x EXTERNALSRC source - - - Use this syntax to generate a recipe based on source. The options - direct ``recipetool`` to generate debugging information. Once generated, - the recipe resides in the existing source code layer:: - - recipetool create -d -o OUTFILE source - -Locating and Using a Similar Recipe -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Before writing a recipe from scratch, it is often useful to discover -whether someone else has already written one that meets (or comes close -to meeting) your needs. The Yocto Project and OpenEmbedded communities -maintain many recipes that might be candidates for what you are doing. -You can find a good central index of these recipes in the -:oe_layerindex:`OpenEmbedded Layer Index <>`. - -Working from an existing recipe or a skeleton recipe is the best way to -get started. Here are some points on both methods: - -- *Locate and modify a recipe that is close to what you want to do:* - This method works when you are familiar with the current recipe - space. The method does not work so well for those new to the Yocto - Project or writing recipes. - - Some risks associated with this method are using a recipe that has - areas totally unrelated to what you are trying to accomplish with - your recipe, not recognizing areas of the recipe that you might have - to add from scratch, and so forth. All these risks stem from - unfamiliarity with the existing recipe space. - -- *Use and modify the following skeleton recipe:* If for some reason - you do not want to use ``recipetool`` and you cannot find an existing - recipe that is close to meeting your needs, you can use the following - structure to provide the fundamental areas of a new recipe. - :: - - DESCRIPTION = "" - HOMEPAGE = "" - LICENSE = "" - SECTION = "" - DEPENDS = "" - LIC_FILES_CHKSUM = "" - - SRC_URI = "" - -Storing and Naming the Recipe ------------------------------ - -Once you have your base recipe, you should put it in your own layer and -name it appropriately. Locating it correctly ensures that the -OpenEmbedded build system can find it when you use BitBake to process -the recipe. - -- *Storing Your Recipe:* The OpenEmbedded build system locates your - recipe through the layer's ``conf/layer.conf`` file and the - :term:`BBFILES` variable. This - variable sets up a path from which the build system can locate - recipes. Here is the typical use:: - - BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ - ${LAYERDIR}/recipes-*/*/*.bbappend" - - Consequently, you need to be sure you locate your new recipe inside - your layer such that it can be found. - - You can find more information on how layers are structured in the - ":ref:`dev-manual/common-tasks:understanding and creating layers`" section. - -- *Naming Your Recipe:* When you name your recipe, you need to follow - this naming convention:: - - basename_version.bb - - Use lower-cased characters and do not include the reserved suffixes - ``-native``, ``-cross``, ``-initial``, or ``-dev`` casually (i.e. do not use - them as part of your recipe name unless the string applies). Here are some - examples: - - .. code-block:: none - - cups_1.7.0.bb - gawk_4.0.2.bb - irssi_0.8.16-rc1.bb - -Running a Build on the Recipe ------------------------------ - -Creating a new recipe is usually an iterative process that requires -using BitBake to process the recipe multiple times in order to -progressively discover and add information to the recipe file. - -Assuming you have sourced the build environment setup script (i.e. -:ref:`structure-core-script`) and you are in the :term:`Build Directory`, use -BitBake to process your recipe. All you need to provide is the -``basename`` of the recipe as described in the previous section:: - - $ bitbake basename - -During the build, the OpenEmbedded build system creates a temporary work -directory for each recipe -(``${``\ :term:`WORKDIR`\ ``}``) -where it keeps extracted source files, log files, intermediate -compilation and packaging files, and so forth. - -The path to the per-recipe temporary work directory depends on the -context in which it is being built. The quickest way to find this path -is to have BitBake return it by running the following:: - - $ bitbake -e basename | grep ^WORKDIR= - -As an example, assume a Source Directory -top-level folder named ``poky``, a default :term:`Build Directory` at -``poky/build``, and a ``qemux86-poky-linux`` machine target system. -Furthermore, suppose your recipe is named ``foo_1.3.0.bb``. In this -case, the work directory the build system uses to build the package -would be as follows:: - - poky/build/tmp/work/qemux86-poky-linux/foo/1.3.0-r0 - -Inside this directory you can find sub-directories such as ``image``, -``packages-split``, and ``temp``. After the build, you can examine these -to determine how well the build went. - -.. note:: - - You can find log files for each task in the recipe's ``temp`` - directory (e.g. ``poky/build/tmp/work/qemux86-poky-linux/foo/1.3.0-r0/temp``). - Log files are named ``log.taskname`` (e.g. ``log.do_configure``, - ``log.do_fetch``, and ``log.do_compile``). - -You can find more information about the build process in -":doc:`/overview-manual/development-environment`" -chapter of the Yocto Project Overview and Concepts Manual. - -Fetching Code -------------- - -The first thing your recipe must do is specify how to fetch the source -files. Fetching is controlled mainly through the -:term:`SRC_URI` variable. Your recipe -must have a :term:`SRC_URI` variable that points to where the source is -located. For a graphical representation of source locations, see the -":ref:`overview-manual/concepts:sources`" section in -the Yocto Project Overview and Concepts Manual. - -The :ref:`ref-tasks-fetch` task uses -the prefix of each entry in the :term:`SRC_URI` variable value to determine -which :ref:`fetcher ` to use to get your -source files. It is the :term:`SRC_URI` variable that triggers the fetcher. -The :ref:`ref-tasks-patch` task uses -the variable after source is fetched to apply patches. The OpenEmbedded -build system uses -:term:`FILESOVERRIDES` for -scanning directory locations for local files in :term:`SRC_URI`. - -The :term:`SRC_URI` variable in your recipe must define each unique location -for your source files. It is good practice to not hard-code version -numbers in a URL used in :term:`SRC_URI`. Rather than hard-code these -values, use ``${``\ :term:`PV`\ ``}``, -which causes the fetch process to use the version specified in the -recipe filename. Specifying the version in this manner means that -upgrading the recipe to a future version is as simple as renaming the -recipe to match the new version. - -Here is a simple example from the -``meta/recipes-devtools/strace/strace_5.5.bb`` recipe where the source -comes from a single tarball. Notice the use of the -:term:`PV` variable:: - - SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \ - -Files mentioned in :term:`SRC_URI` whose names end in a typical archive -extension (e.g. ``.tar``, ``.tar.gz``, ``.tar.bz2``, ``.zip``, and so -forth), are automatically extracted during the -:ref:`ref-tasks-unpack` task. For -another example that specifies these types of files, see the -":ref:`dev-manual/common-tasks:autotooled package`" section. - -Another way of specifying source is from an SCM. For Git repositories, -you must specify :term:`SRCREV` and you should specify :term:`PV` to include -the revision with :term:`SRCPV`. Here is an example from the recipe -``meta/recipes-core/musl/gcompat_git.bb``:: - - SRC_URI = "git://git.adelielinux.org/adelie/gcompat.git;protocol=https;branch=current" - - PV = "1.0.0+1.1+git${SRCPV}" - SRCREV = "af5a49e489fdc04b9cf02547650d7aeaccd43793" - -If your :term:`SRC_URI` statement includes URLs pointing to individual files -fetched from a remote server other than a version control system, -BitBake attempts to verify the files against checksums defined in your -recipe to ensure they have not been tampered with or otherwise modified -since the recipe was written. Two checksums are used: -``SRC_URI[md5sum]`` and ``SRC_URI[sha256sum]``. - -If your :term:`SRC_URI` variable points to more than a single URL (excluding -SCM URLs), you need to provide the ``md5`` and ``sha256`` checksums for -each URL. For these cases, you provide a name for each URL as part of -the :term:`SRC_URI` and then reference that name in the subsequent checksum -statements. Here is an example combining lines from the files -``git.inc`` and ``git_2.24.1.bb``:: - - SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \ - ${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages" - - SRC_URI[tarball.md5sum] = "166bde96adbbc11c8843d4f8f4f9811b" - SRC_URI[tarball.sha256sum] = "ad5334956301c86841eb1e5b1bb20884a6bad89a10a6762c958220c7cf64da02" - SRC_URI[manpages.md5sum] = "31c2272a8979022497ba3d4202df145d" - SRC_URI[manpages.sha256sum] = "9a7ae3a093bea39770eb96ca3e5b40bff7af0b9f6123f089d7821d0e5b8e1230" - -Proper values for ``md5`` and ``sha256`` checksums might be available -with other signatures on the download page for the upstream source (e.g. -``md5``, ``sha1``, ``sha256``, ``GPG``, and so forth). Because the -OpenEmbedded build system only deals with ``sha256sum`` and ``md5sum``, -you should verify all the signatures you find by hand. - -If no :term:`SRC_URI` checksums are specified when you attempt to build the -recipe, or you provide an incorrect checksum, the build will produce an -error for each missing or incorrect checksum. As part of the error -message, the build system provides the checksum string corresponding to -the fetched file. Once you have the correct checksums, you can copy and -paste them into your recipe and then run the build again to continue. - -.. note:: - - As mentioned, if the upstream source provides signatures for - verifying the downloaded source code, you should verify those - manually before setting the checksum values in the recipe and - continuing with the build. - -This final example is a bit more complicated and is from the -``meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.20.bb`` recipe. The -example's :term:`SRC_URI` statement identifies multiple files as the source -files for the recipe: a tarball, a patch file, a desktop file, and an -icon. -:: - - SRC_URI = "http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${PV}.tar.bz2 \ - file://xwc.patch \ - file://rxvt.desktop \ - file://rxvt.png" - -When you specify local files using the ``file://`` URI protocol, the -build system fetches files from the local machine. The path is relative -to the :term:`FILESPATH` variable -and searches specific directories in a certain order: -``${``\ :term:`BP`\ ``}``, -``${``\ :term:`BPN`\ ``}``, and -``files``. The directories are assumed to be subdirectories of the -directory in which the recipe or append file resides. For another -example that specifies these types of files, see the -":ref:`dev-manual/common-tasks:single .c file package (hello world!)`" section. - -The previous example also specifies a patch file. Patch files are files -whose names usually end in ``.patch`` or ``.diff`` but can end with -compressed suffixes such as ``diff.gz`` and ``patch.bz2``, for example. -The build system automatically applies patches as described in the -":ref:`dev-manual/common-tasks:patching code`" section. - -Fetching Code Through Firewalls -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Some users are behind firewalls and need to fetch code through a proxy. -See the ":doc:`/ref-manual/faq`" chapter for advice. - -Limiting the Number of Parallel Connections -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Some users are behind firewalls or use servers where the number of parallel -connections is limited. In such cases, you can limit the number of fetch -tasks being run in parallel by adding the following to your ``local.conf`` -file:: - - do_fetch[number_threads] = "4" - -Unpacking Code --------------- - -During the build, the -:ref:`ref-tasks-unpack` task unpacks -the source with ``${``\ :term:`S`\ ``}`` -pointing to where it is unpacked. - -If you are fetching your source files from an upstream source archived -tarball and the tarball's internal structure matches the common -convention of a top-level subdirectory named -``${``\ :term:`BPN`\ ``}-${``\ :term:`PV`\ ``}``, -then you do not need to set :term:`S`. However, if :term:`SRC_URI` specifies to -fetch source from an archive that does not use this convention, or from -an SCM like Git or Subversion, your recipe needs to define :term:`S`. - -If processing your recipe using BitBake successfully unpacks the source -files, you need to be sure that the directory pointed to by ``${S}`` -matches the structure of the source. - -Patching Code -------------- - -Sometimes it is necessary to patch code after it has been fetched. Any -files mentioned in :term:`SRC_URI` whose names end in ``.patch`` or -``.diff`` or compressed versions of these suffixes (e.g. ``diff.gz`` are -treated as patches. The -:ref:`ref-tasks-patch` task -automatically applies these patches. - -The build system should be able to apply patches with the "-p1" option -(i.e. one directory level in the path will be stripped off). If your -patch needs to have more directory levels stripped off, specify the -number of levels using the "striplevel" option in the :term:`SRC_URI` entry -for the patch. Alternatively, if your patch needs to be applied in a -specific subdirectory that is not specified in the patch file, use the -"patchdir" option in the entry. - -As with all local files referenced in -:term:`SRC_URI` using ``file://``, -you should place patch files in a directory next to the recipe either -named the same as the base name of the recipe -(:term:`BP` and -:term:`BPN`) or "files". - -Licensing ---------- - -Your recipe needs to have both the -:term:`LICENSE` and -:term:`LIC_FILES_CHKSUM` -variables: - -- :term:`LICENSE`: This variable specifies the license for the software. - If you do not know the license under which the software you are - building is distributed, you should go to the source code and look - for that information. Typical files containing this information - include ``COPYING``, :term:`LICENSE`, and ``README`` files. You could - also find the information near the top of a source file. For example, - given a piece of software licensed under the GNU General Public - License version 2, you would set :term:`LICENSE` as follows:: - - LICENSE = "GPL-2.0-only" - - The licenses you specify within :term:`LICENSE` can have any name as long - as you do not use spaces, since spaces are used as separators between - license names. For standard licenses, use the names of the files in - ``meta/files/common-licenses/`` or the :term:`SPDXLICENSEMAP` flag names - defined in ``meta/conf/licenses.conf``. - -- :term:`LIC_FILES_CHKSUM`: The OpenEmbedded build system uses this - variable to make sure the license text has not changed. If it has, - the build produces an error and it affords you the chance to figure - it out and correct the problem. - - You need to specify all applicable licensing files for the software. - At the end of the configuration step, the build process will compare - the checksums of the files to be sure the text has not changed. Any - differences result in an error with the message containing the - current checksum. For more explanation and examples of how to set the - :term:`LIC_FILES_CHKSUM` variable, see the - ":ref:`dev-manual/common-tasks:tracking license changes`" section. - - To determine the correct checksum string, you can list the - appropriate files in the :term:`LIC_FILES_CHKSUM` variable with incorrect - md5 strings, attempt to build the software, and then note the - resulting error messages that will report the correct md5 strings. - See the ":ref:`dev-manual/common-tasks:fetching code`" section for - additional information. - - Here is an example that assumes the software has a ``COPYING`` file:: - - LIC_FILES_CHKSUM = "file://COPYING;md5=xxx" - - When you try to build the - software, the build system will produce an error and give you the - correct string that you can substitute into the recipe file for a - subsequent build. - -Dependencies ------------- - -Most software packages have a short list of other packages that they -require, which are called dependencies. These dependencies fall into two -main categories: build-time dependencies, which are required when the -software is built; and runtime dependencies, which are required to be -installed on the target in order for the software to run. - -Within a recipe, you specify build-time dependencies using the -:term:`DEPENDS` variable. Although there are nuances, -items specified in :term:`DEPENDS` should be names of other -recipes. It is important that you specify all build-time dependencies -explicitly. - -Another consideration is that configure scripts might automatically -check for optional dependencies and enable corresponding functionality -if those dependencies are found. If you wish to make a recipe that is -more generally useful (e.g. publish the recipe in a layer for others to -use), instead of hard-disabling the functionality, you can use the -:term:`PACKAGECONFIG` variable to allow functionality and the -corresponding dependencies to be enabled and disabled easily by other -users of the recipe. - -Similar to build-time dependencies, you specify runtime dependencies -through a variable - -:term:`RDEPENDS`, which is -package-specific. All variables that are package-specific need to have -the name of the package added to the end as an override. Since the main -package for a recipe has the same name as the recipe, and the recipe's -name can be found through the -``${``\ :term:`PN`\ ``}`` variable, then -you specify the dependencies for the main package by setting -``RDEPENDS:${PN}``. If the package were named ``${PN}-tools``, then you -would set ``RDEPENDS:${PN}-tools``, and so forth. - -Some runtime dependencies will be set automatically at packaging time. -These dependencies include any shared library dependencies (i.e. if a -package "example" contains "libexample" and another package "mypackage" -contains a binary that links to "libexample" then the OpenEmbedded build -system will automatically add a runtime dependency to "mypackage" on -"example"). See the -":ref:`overview-manual/concepts:automatically added runtime dependencies`" -section in the Yocto Project Overview and Concepts Manual for further -details. - -Configuring the Recipe ----------------------- - -Most software provides some means of setting build-time configuration -options before compilation. Typically, setting these options is -accomplished by running a configure script with options, or by modifying -a build configuration file. - -.. note:: - - As of Yocto Project Release 1.7, some of the core recipes that - package binary configuration scripts now disable the scripts due to - the scripts previously requiring error-prone path substitution. The - OpenEmbedded build system uses ``pkg-config`` now, which is much more - robust. You can find a list of the ``*-config`` scripts that are disabled - in the ":ref:`migration-1.7-binary-configuration-scripts-disabled`" section - in the Yocto Project Reference Manual. - -A major part of build-time configuration is about checking for -build-time dependencies and possibly enabling optional functionality as -a result. You need to specify any build-time dependencies for the -software you are building in your recipe's -:term:`DEPENDS` value, in terms of -other recipes that satisfy those dependencies. You can often find -build-time or runtime dependencies described in the software's -documentation. - -The following list provides configuration items of note based on how -your software is built: - -- *Autotools:* If your source files have a ``configure.ac`` file, then - your software is built using Autotools. If this is the case, you just - need to modify the configuration. - - When using Autotools, your recipe needs to inherit the - :ref:`autotools ` class - and your recipe does not have to contain a - :ref:`ref-tasks-configure` task. - However, you might still want to make some adjustments. For example, - you can set - :term:`EXTRA_OECONF` or - :term:`PACKAGECONFIG_CONFARGS` - to pass any needed configure options that are specific to the recipe. - -- *CMake:* If your source files have a ``CMakeLists.txt`` file, then - your software is built using CMake. If this is the case, you just - need to modify the configuration. - - When you use CMake, your recipe needs to inherit the - :ref:`cmake ` class and your - recipe does not have to contain a - :ref:`ref-tasks-configure` task. - You can make some adjustments by setting - :term:`EXTRA_OECMAKE` to - pass any needed configure options that are specific to the recipe. - - .. note:: - - If you need to install one or more custom CMake toolchain files - that are supplied by the application you are building, install the - files to ``${D}${datadir}/cmake/Modules`` during :ref:`ref-tasks-install`. - -- *Other:* If your source files do not have a ``configure.ac`` or - ``CMakeLists.txt`` file, then your software is built using some - method other than Autotools or CMake. If this is the case, you - normally need to provide a - :ref:`ref-tasks-configure` task - in your recipe unless, of course, there is nothing to configure. - - Even if your software is not being built by Autotools or CMake, you - still might not need to deal with any configuration issues. You need - to determine if configuration is even a required step. You might need - to modify a Makefile or some configuration file used for the build to - specify necessary build options. Or, perhaps you might need to run a - provided, custom configure script with the appropriate options. - - For the case involving a custom configure script, you would run - ``./configure --help`` and look for the options you need to set. - -Once configuration succeeds, it is always good practice to look at the -``log.do_configure`` file to ensure that the appropriate options have -been enabled and no additional build-time dependencies need to be added -to :term:`DEPENDS`. For example, if the configure script reports that it -found something not mentioned in :term:`DEPENDS`, or that it did not find -something that it needed for some desired optional functionality, then -you would need to add those to :term:`DEPENDS`. Looking at the log might -also reveal items being checked for, enabled, or both that you do not -want, or items not being found that are in :term:`DEPENDS`, in which case -you would need to look at passing extra options to the configure script -as needed. For reference information on configure options specific to -the software you are building, you can consult the output of the -``./configure --help`` command within ``${S}`` or consult the software's -upstream documentation. - -Using Headers to Interface with Devices ---------------------------------------- - -If your recipe builds an application that needs to communicate with some -device or needs an API into a custom kernel, you will need to provide -appropriate header files. Under no circumstances should you ever modify -the existing -``meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc`` file. -These headers are used to build ``libc`` and must not be compromised -with custom or machine-specific header information. If you customize -``libc`` through modified headers all other applications that use -``libc`` thus become affected. - -.. note:: - - Never copy and customize the ``libc`` header file (i.e. - ``meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc``). - -The correct way to interface to a device or custom kernel is to use a -separate package that provides the additional headers for the driver or -other unique interfaces. When doing so, your application also becomes -responsible for creating a dependency on that specific provider. - -Consider the following: - -- Never modify ``linux-libc-headers.inc``. Consider that file to be - part of the ``libc`` system, and not something you use to access the - kernel directly. You should access ``libc`` through specific ``libc`` - calls. - -- Applications that must talk directly to devices should either provide - necessary headers themselves, or establish a dependency on a special - headers package that is specific to that driver. - -For example, suppose you want to modify an existing header that adds I/O -control or network support. If the modifications are used by a small -number programs, providing a unique version of a header is easy and has -little impact. When doing so, bear in mind the guidelines in the -previous list. - -.. note:: - - If for some reason your changes need to modify the behavior of the ``libc``, - and subsequently all other applications on the system, use a ``.bbappend`` - to modify the ``linux-kernel-headers.inc`` file. However, take care to not - make the changes machine specific. - -Consider a case where your kernel is older and you need an older -``libc`` ABI. The headers installed by your recipe should still be a -standard mainline kernel, not your own custom one. - -When you use custom kernel headers you need to get them from -:term:`STAGING_KERNEL_DIR`, -which is the directory with kernel headers that are required to build -out-of-tree modules. Your recipe will also need the following:: - - do_configure[depends] += "virtual/kernel:do_shared_workdir" - -Compilation ------------ - -During a build, the :ref:`ref-tasks-compile` task happens after source is fetched, -unpacked, and configured. If the recipe passes through :ref:`ref-tasks-compile` -successfully, nothing needs to be done. - -However, if the compile step fails, you need to diagnose the failure. -Here are some common issues that cause failures. - -.. note:: - - For cases where improper paths are detected for configuration files - or for when libraries/headers cannot be found, be sure you are using - the more robust ``pkg-config``. See the note in section - ":ref:`dev-manual/common-tasks:Configuring the Recipe`" for additional information. - -- *Parallel build failures:* These failures manifest themselves as - intermittent errors, or errors reporting that a file or directory - that should be created by some other part of the build process could - not be found. This type of failure can occur even if, upon - inspection, the file or directory does exist after the build has - failed, because that part of the build process happened in the wrong - order. - - To fix the problem, you need to either satisfy the missing dependency - in the Makefile or whatever script produced the Makefile, or (as a - workaround) set :term:`PARALLEL_MAKE` to an empty string:: - - PARALLEL_MAKE = "" - - For information on parallel Makefile issues, see the - ":ref:`dev-manual/common-tasks:debugging parallel make races`" section. - -- *Improper host path usage:* This failure applies to recipes building - for the target or ``nativesdk`` only. The failure occurs when the - compilation process uses improper headers, libraries, or other files - from the host system when cross-compiling for the target. - - To fix the problem, examine the ``log.do_compile`` file to identify - the host paths being used (e.g. ``/usr/include``, ``/usr/lib``, and - so forth) and then either add configure options, apply a patch, or do - both. - -- *Failure to find required libraries/headers:* If a build-time - dependency is missing because it has not been declared in - :term:`DEPENDS`, or because the - dependency exists but the path used by the build process to find the - file is incorrect and the configure step did not detect it, the - compilation process could fail. For either of these failures, the - compilation process notes that files could not be found. In these - cases, you need to go back and add additional options to the - configure script as well as possibly add additional build-time - dependencies to :term:`DEPENDS`. - - Occasionally, it is necessary to apply a patch to the source to - ensure the correct paths are used. If you need to specify paths to - find files staged into the sysroot from other recipes, use the - variables that the OpenEmbedded build system provides (e.g. - :term:`STAGING_BINDIR`, :term:`STAGING_INCDIR`, :term:`STAGING_DATADIR`, and so - forth). - -Installing ----------- - -During :ref:`ref-tasks-install`, the task copies the built files along with their -hierarchy to locations that would mirror their locations on the target -device. The installation process copies files from the -``${``\ :term:`S`\ ``}``, -``${``\ :term:`B`\ ``}``, and -``${``\ :term:`WORKDIR`\ ``}`` -directories to the ``${``\ :term:`D`\ ``}`` -directory to create the structure as it should appear on the target -system. - -How your software is built affects what you must do to be sure your -software is installed correctly. The following list describes what you -must do for installation depending on the type of build system used by -the software being built: - -- *Autotools and CMake:* If the software your recipe is building uses - Autotools or CMake, the OpenEmbedded build system understands how to - install the software. Consequently, you do not have to have a - :ref:`ref-tasks-install` task as part of your recipe. You just need to make - sure the install portion of the build completes with no issues. - However, if you wish to install additional files not already being - installed by ``make install``, you should do this using a - ``do_install:append`` function using the install command as described - in the "Manual" bulleted item later in this list. - -- *Other (using* ``make install``\ *)*: You need to define a :ref:`ref-tasks-install` - function in your recipe. The function should call - ``oe_runmake install`` and will likely need to pass in the - destination directory as well. How you pass that path is dependent on - how the ``Makefile`` being run is written (e.g. ``DESTDIR=${D}``, - ``PREFIX=${D}``, ``INSTALLROOT=${D}``, and so forth). - - For an example recipe using ``make install``, see the - ":ref:`dev-manual/common-tasks:makefile-based package`" section. - -- *Manual:* You need to define a :ref:`ref-tasks-install` function in your - recipe. The function must first use ``install -d`` to create the - directories under - ``${``\ :term:`D`\ ``}``. Once the - directories exist, your function can use ``install`` to manually - install the built software into the directories. - - You can find more information on ``install`` at - https://www.gnu.org/software/coreutils/manual/html_node/install-invocation.html. - -For the scenarios that do not use Autotools or CMake, you need to track -the installation and diagnose and fix any issues until everything -installs correctly. You need to look in the default location of -``${D}``, which is ``${WORKDIR}/image``, to be sure your files have been -installed correctly. - -.. note:: - - - During the installation process, you might need to modify some of - the installed files to suit the target layout. For example, you - might need to replace hard-coded paths in an initscript with - values of variables provided by the build system, such as - replacing ``/usr/bin/`` with ``${bindir}``. If you do perform such - modifications during :ref:`ref-tasks-install`, be sure to modify the - destination file after copying rather than before copying. - Modifying after copying ensures that the build system can - re-execute :ref:`ref-tasks-install` if needed. - - - ``oe_runmake install``, which can be run directly or can be run - indirectly by the - :ref:`autotools ` and - :ref:`cmake ` classes, - runs ``make install`` in parallel. Sometimes, a Makefile can have - missing dependencies between targets that can result in race - conditions. If you experience intermittent failures during - :ref:`ref-tasks-install`, you might be able to work around them by disabling - parallel Makefile installs by adding the following to the recipe:: - - PARALLEL_MAKEINST = "" - - See :term:`PARALLEL_MAKEINST` for additional information. - - - If you need to install one or more custom CMake toolchain files - that are supplied by the application you are building, install the - files to ``${D}${datadir}/cmake/Modules`` during - :ref:`ref-tasks-install`. - -Enabling System Services ------------------------- - -If you want to install a service, which is a process that usually starts -on boot and runs in the background, then you must include some -additional definitions in your recipe. - -If you are adding services and the service initialization script or the -service file itself is not installed, you must provide for that -installation in your recipe using a ``do_install:append`` function. If -your recipe already has a :ref:`ref-tasks-install` function, update the function -near its end rather than adding an additional ``do_install:append`` -function. - -When you create the installation for your services, you need to -accomplish what is normally done by ``make install``. In other words, -make sure your installation arranges the output similar to how it is -arranged on the target system. - -The OpenEmbedded build system provides support for starting services two -different ways: - -- *SysVinit:* SysVinit is a system and service manager that manages the - init system used to control the very basic functions of your system. - The init program is the first program started by the Linux kernel - when the system boots. Init then controls the startup, running and - shutdown of all other programs. - - To enable a service using SysVinit, your recipe needs to inherit the - :ref:`update-rc.d ` - class. The class helps facilitate safely installing the package on - the target. - - You will need to set the - :term:`INITSCRIPT_PACKAGES`, - :term:`INITSCRIPT_NAME`, - and - :term:`INITSCRIPT_PARAMS` - variables within your recipe. - -- *systemd:* System Management Daemon (systemd) was designed to replace - SysVinit and to provide enhanced management of services. For more - information on systemd, see the systemd homepage at - https://freedesktop.org/wiki/Software/systemd/. - - To enable a service using systemd, your recipe needs to inherit the - :ref:`systemd ` class. See - the ``systemd.bbclass`` file located in your :term:`Source Directory` - section for - more information. - -Packaging ---------- - -Successful packaging is a combination of automated processes performed -by the OpenEmbedded build system and some specific steps you need to -take. The following list describes the process: - -- *Splitting Files*: The :ref:`ref-tasks-package` task splits the files produced - by the recipe into logical components. Even software that produces a - single binary might still have debug symbols, documentation, and - other logical components that should be split out. The :ref:`ref-tasks-package` - task ensures that files are split up and packaged correctly. - -- *Running QA Checks*: The - :ref:`insane ` class adds a - step to the package generation process so that output quality - assurance checks are generated by the OpenEmbedded build system. This - step performs a range of checks to be sure the build's output is free - of common problems that show up during runtime. For information on - these checks, see the - :ref:`insane ` class and - the ":ref:`ref-manual/qa-checks:qa error and warning messages`" - chapter in the Yocto Project Reference Manual. - -- *Hand-Checking Your Packages*: After you build your software, you - need to be sure your packages are correct. Examine the - ``${``\ :term:`WORKDIR`\ ``}/packages-split`` - directory and make sure files are where you expect them to be. If you - discover problems, you can set - :term:`PACKAGES`, - :term:`FILES`, - ``do_install(:append)``, and so forth as needed. - -- *Splitting an Application into Multiple Packages*: If you need to - split an application into several packages, see the - ":ref:`dev-manual/common-tasks:splitting an application into multiple packages`" - section for an example. - -- *Installing a Post-Installation Script*: For an example showing how - to install a post-installation script, see the - ":ref:`dev-manual/common-tasks:post-installation scripts`" section. - -- *Marking Package Architecture*: Depending on what your recipe is - building and how it is configured, it might be important to mark the - packages produced as being specific to a particular machine, or to - mark them as not being specific to a particular machine or - architecture at all. - - By default, packages apply to any machine with the same architecture - as the target machine. When a recipe produces packages that are - machine-specific (e.g. the - :term:`MACHINE` value is passed - into the configure script or a patch is applied only for a particular - machine), you should mark them as such by adding the following to the - recipe:: - - PACKAGE_ARCH = "${MACHINE_ARCH}" - - On the other hand, if the recipe produces packages that do not - contain anything specific to the target machine or architecture at - all (e.g. recipes that simply package script files or configuration - files), you should use the - :ref:`allarch ` class to - do this for you by adding this to your recipe:: - - inherit allarch - - Ensuring that the package architecture is correct is not critical - while you are doing the first few builds of your recipe. However, it - is important in order to ensure that your recipe rebuilds (or does - not rebuild) appropriately in response to changes in configuration, - and to ensure that you get the appropriate packages installed on the - target machine, particularly if you run separate builds for more than - one target machine. - -Sharing Files Between Recipes ------------------------------ - -Recipes often need to use files provided by other recipes on the build -host. For example, an application linking to a common library needs -access to the library itself and its associated headers. The way this -access is accomplished is by populating a sysroot with files. Each -recipe has two sysroots in its work directory, one for target files -(``recipe-sysroot``) and one for files that are native to the build host -(``recipe-sysroot-native``). - -.. note:: - - You could find the term "staging" used within the Yocto project - regarding files populating sysroots (e.g. the :term:`STAGING_DIR` - variable). - -Recipes should never populate the sysroot directly (i.e. write files -into sysroot). Instead, files should be installed into standard -locations during the -:ref:`ref-tasks-install` task within -the ``${``\ :term:`D`\ ``}`` directory. The -reason for this limitation is that almost all files that populate the -sysroot are cataloged in manifests in order to ensure the files can be -removed later when a recipe is either modified or removed. Thus, the -sysroot is able to remain free from stale files. - -A subset of the files installed by the :ref:`ref-tasks-install` task are -used by the :ref:`ref-tasks-populate_sysroot` task as defined by the -:term:`SYSROOT_DIRS` variable to automatically populate the sysroot. It -is possible to modify the list of directories that populate the sysroot. -The following example shows how you could add the ``/opt`` directory to -the list of directories within a recipe:: - - SYSROOT_DIRS += "/opt" - -.. note:: - - The `/sysroot-only` is to be used by recipes that generate artifacts - that are not included in the target filesystem, allowing them to share - these artifacts without needing to use the :term:`DEPLOY_DIR`. - -For a more complete description of the :ref:`ref-tasks-populate_sysroot` -task and its associated functions, see the -:ref:`staging ` class. - -Using Virtual Providers ------------------------ - -Prior to a build, if you know that several different recipes provide the -same functionality, you can use a virtual provider (i.e. ``virtual/*``) -as a placeholder for the actual provider. The actual provider is -determined at build-time. - -A common scenario where a virtual provider is used would be for the -kernel recipe. Suppose you have three kernel recipes whose -:term:`PN` values map to ``kernel-big``, -``kernel-mid``, and ``kernel-small``. Furthermore, each of these recipes -in some way uses a :term:`PROVIDES` -statement that essentially identifies itself as being able to provide -``virtual/kernel``. Here is one way through the -:ref:`kernel ` class:: - - PROVIDES += "virtual/kernel" - -Any recipe that inherits the :ref:`kernel ` class is -going to utilize a :term:`PROVIDES` statement that identifies that recipe as -being able to provide the ``virtual/kernel`` item. - -Now comes the time to actually build an image and you need a kernel -recipe, but which one? You can configure your build to call out the -kernel recipe you want by using the :term:`PREFERRED_PROVIDER` variable. As -an example, consider the :yocto_git:`x86-base.inc -` include file, which is a -machine (i.e. :term:`MACHINE`) configuration file. This include file is the -reason all x86-based machines use the ``linux-yocto`` kernel. Here are the -relevant lines from the include file:: - - PREFERRED_PROVIDER_virtual/kernel ??= "linux-yocto" - PREFERRED_VERSION_linux-yocto ??= "4.15%" - -When you use a virtual provider, you do not have to "hard code" a recipe -name as a build dependency. You can use the -:term:`DEPENDS` variable to state the -build is dependent on ``virtual/kernel`` for example:: - - DEPENDS = "virtual/kernel" - -During the build, the OpenEmbedded build system picks -the correct recipe needed for the ``virtual/kernel`` dependency based on -the :term:`PREFERRED_PROVIDER` variable. If you want to use the small kernel -mentioned at the beginning of this section, configure your build as -follows:: - - PREFERRED_PROVIDER_virtual/kernel ??= "kernel-small" - -.. note:: - - Any recipe that :term:`PROVIDES` a ``virtual/*`` item that is ultimately not - selected through :term:`PREFERRED_PROVIDER` does not get built. Preventing these - recipes from building is usually the desired behavior since this mechanism's - purpose is to select between mutually exclusive alternative providers. - -The following lists specific examples of virtual providers: - -- ``virtual/kernel``: Provides the name of the kernel recipe to use - when building a kernel image. - -- ``virtual/bootloader``: Provides the name of the bootloader to use - when building an image. - -- ``virtual/libgbm``: Provides ``gbm.pc``. - -- ``virtual/egl``: Provides ``egl.pc`` and possibly ``wayland-egl.pc``. - -- ``virtual/libgl``: Provides ``gl.pc`` (i.e. libGL). - -- ``virtual/libgles1``: Provides ``glesv1_cm.pc`` (i.e. libGLESv1_CM). - -- ``virtual/libgles2``: Provides ``glesv2.pc`` (i.e. libGLESv2). - -.. note:: - - Virtual providers only apply to build time dependencies specified with - :term:`PROVIDES` and :term:`DEPENDS`. They do not apply to runtime - dependencies specified with :term:`RPROVIDES` and :term:`RDEPENDS`. - -Properly Versioning Pre-Release Recipes ---------------------------------------- - -Sometimes the name of a recipe can lead to versioning problems when the -recipe is upgraded to a final release. For example, consider the -``irssi_0.8.16-rc1.bb`` recipe file in the list of example recipes in -the ":ref:`dev-manual/common-tasks:storing and naming the recipe`" section. -This recipe is at a release candidate stage (i.e. "rc1"). When the recipe is -released, the recipe filename becomes ``irssi_0.8.16.bb``. The version -change from ``0.8.16-rc1`` to ``0.8.16`` is seen as a decrease by the -build system and package managers, so the resulting packages will not -correctly trigger an upgrade. - -In order to ensure the versions compare properly, the recommended -convention is to set :term:`PV` within the -recipe to "previous_version+current_version". You can use an additional -variable so that you can use the current version elsewhere. Here is an -example:: - - REALPV = "0.8.16-rc1" - PV = "0.8.15+${REALPV}" - -Post-Installation Scripts -------------------------- - -Post-installation scripts run immediately after installing a package on -the target or during image creation when a package is included in an -image. To add a post-installation script to a package, add a -``pkg_postinst:``\ `PACKAGENAME`\ ``()`` function to the recipe file -(``.bb``) and replace `PACKAGENAME` with the name of the package you want -to attach to the ``postinst`` script. To apply the post-installation -script to the main package for the recipe, which is usually what is -required, specify -``${``\ :term:`PN`\ ``}`` in place of -PACKAGENAME. - -A post-installation function has the following structure:: - - pkg_postinst:PACKAGENAME() { - # Commands to carry out - } - -The script defined in the post-installation function is called when the -root filesystem is created. If the script succeeds, the package is -marked as installed. - -.. note:: - - Any RPM post-installation script that runs on the target should - return a 0 exit code. RPM does not allow non-zero exit codes for - these scripts, and the RPM package manager will cause the package to - fail installation on the target. - -Sometimes it is necessary for the execution of a post-installation -script to be delayed until the first boot. For example, the script might -need to be executed on the device itself. To delay script execution -until boot time, you must explicitly mark post installs to defer to the -target. You can use ``pkg_postinst_ontarget()`` or call -``postinst_intercept delay_to_first_boot`` from ``pkg_postinst()``. Any -failure of a ``pkg_postinst()`` script (including exit 1) triggers an -error during the -:ref:`ref-tasks-rootfs` task. - -If you have recipes that use ``pkg_postinst`` function and they require -the use of non-standard native tools that have dependencies during -root filesystem construction, you need to use the -:term:`PACKAGE_WRITE_DEPS` -variable in your recipe to list these tools. If you do not use this -variable, the tools might be missing and execution of the -post-installation script is deferred until first boot. Deferring the -script to the first boot is undesirable and impossible for read-only -root filesystems. - -.. note:: - - There is equivalent support for pre-install, pre-uninstall, and post-uninstall - scripts by way of ``pkg_preinst``, ``pkg_prerm``, and ``pkg_postrm``, - respectively. These scrips work in exactly the same way as does - ``pkg_postinst`` with the exception that they run at different times. Also, - because of when they run, they are not applicable to being run at image - creation time like ``pkg_postinst``. - -Testing -------- - -The final step for completing your recipe is to be sure that the -software you built runs correctly. To accomplish runtime testing, add -the build's output packages to your image and test them on the target. - -For information on how to customize your image by adding specific -packages, see ":ref:`dev-manual/common-tasks:customizing images`" section. - -Examples --------- - -To help summarize how to write a recipe, this section provides some -examples given various scenarios: - -- Recipes that use local files - -- Using an Autotooled package - -- Using a Makefile-based package - -- Splitting an application into multiple packages - -- Adding binaries to an image - -Single .c File Package (Hello World!) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Building an application from a single file that is stored locally (e.g. -under ``files``) requires a recipe that has the file listed in the -:term:`SRC_URI` variable. Additionally, you need to manually write the -:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The :term:`S` variable defines the -directory containing the source code, which is set to -:term:`WORKDIR` in this case --- the -directory BitBake uses for the build. -:: - - SUMMARY = "Simple helloworld application" - SECTION = "examples" - LICENSE = "MIT" - LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" - - SRC_URI = "file://helloworld.c" - - S = "${WORKDIR}" - - do_compile() { - ${CC} ${LDFLAGS} helloworld.c -o helloworld - } - - do_install() { - install -d ${D}${bindir} - install -m 0755 helloworld ${D}${bindir} - } - -By default, the ``helloworld``, ``helloworld-dbg``, and -``helloworld-dev`` packages are built. For information on how to -customize the packaging process, see the -":ref:`dev-manual/common-tasks:splitting an application into multiple packages`" -section. - -Autotooled Package -~~~~~~~~~~~~~~~~~~ - -Applications that use Autotools such as ``autoconf`` and ``automake`` -require a recipe that has a source archive listed in :term:`SRC_URI` and -also inherit the -:ref:`autotools ` class, -which contains the definitions of all the steps needed to build an -Autotool-based application. The result of the build is automatically -packaged. And, if the application uses NLS for localization, packages -with local information are generated (one package per language). -Following is one example: (``hello_2.3.bb``) -:: - - SUMMARY = "GNU Helloworld application" - SECTION = "examples" - LICENSE = "GPL-2.0-or-later" - LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" - - SRC_URI = "${GNU_MIRROR}/hello/hello-${PV}.tar.gz" - - inherit autotools gettext - -The variable :term:`LIC_FILES_CHKSUM` is used to track source license -changes as described in the -":ref:`dev-manual/common-tasks:tracking license changes`" section in -the Yocto Project Overview and Concepts Manual. You can quickly create -Autotool-based recipes in a manner similar to the previous example. - -Makefile-Based Package -~~~~~~~~~~~~~~~~~~~~~~ - -Applications that use GNU ``make`` also require a recipe that has the -source archive listed in :term:`SRC_URI`. You do not need to add a -:ref:`ref-tasks-compile` step since by default BitBake starts the ``make`` command -to compile the application. If you need additional ``make`` options, you -should store them in the -:term:`EXTRA_OEMAKE` or -:term:`PACKAGECONFIG_CONFARGS` -variables. BitBake passes these options into the GNU ``make`` -invocation. Note that a :ref:`ref-tasks-install` task is still required. -Otherwise, BitBake runs an empty :ref:`ref-tasks-install` task by default. - -Some applications might require extra parameters to be passed to the -compiler. For example, the application might need an additional header -path. You can accomplish this by adding to the :term:`CFLAGS` variable. The -following example shows this:: - - CFLAGS:prepend = "-I ${S}/include " - -In the following example, ``lz4`` is a makefile-based package:: - - SUMMARY = "Extremely Fast Compression algorithm" - DESCRIPTION = "LZ4 is a very fast lossless compression algorithm, providing compression speed at 400 MB/s per core, scalable with multi-cores CPU. It also features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems." - HOMEPAGE = "https://github.com/lz4/lz4" - - LICENSE = "BSD-2-Clause | GPL-2.0-only" - LIC_FILES_CHKSUM = "file://lib/LICENSE;md5=ebc2ea4814a64de7708f1571904b32cc \ - file://programs/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://LICENSE;md5=d57c0d21cb917fb4e0af2454aa48b956 \ - " - - PE = "1" - - SRCREV = "d44371841a2f1728a3f36839fd4b7e872d0927d3" - - SRC_URI = "git://github.com/lz4/lz4.git;branch=release;protocol=https \ - file://CVE-2021-3520.patch \ - " - UPSTREAM_CHECK_GITTAGREGEX = "v(?P.*)" - - S = "${WORKDIR}/git" - - # Fixed in r118, which is larger than the current version. - CVE_CHECK_IGNORE += "CVE-2014-4715" - - EXTRA_OEMAKE = "PREFIX=${prefix} CC='${CC}' CFLAGS='${CFLAGS}' DESTDIR=${D} LIBDIR=${libdir} INCLUDEDIR=${includedir} BUILD_STATIC=no" - - do_install() { - oe_runmake install - } - - BBCLASSEXTEND = "native nativesdk" - -Splitting an Application into Multiple Packages -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can use the variables :term:`PACKAGES` and :term:`FILES` to split an -application into multiple packages. - -Following is an example that uses the ``libxpm`` recipe. By default, -this recipe generates a single package that contains the library along -with a few binaries. You can modify the recipe to split the binaries -into separate packages:: - - require xorg-lib-common.inc - - SUMMARY = "Xpm: X Pixmap extension library" - LICENSE = "MIT" - LIC_FILES_CHKSUM = "file://COPYING;md5=51f4270b012ecd4ab1a164f5f4ed6cf7" - DEPENDS += "libxext libsm libxt" - PE = "1" - - XORG_PN = "libXpm" - - PACKAGES =+ "sxpm cxpm" - FILES:cxpm = "${bindir}/cxpm" - FILES:sxpm = "${bindir}/sxpm" - -In the previous example, we want to ship the ``sxpm`` and ``cxpm`` -binaries in separate packages. Since ``bindir`` would be packaged into -the main :term:`PN` package by default, we prepend the :term:`PACKAGES` variable -so additional package names are added to the start of list. This results -in the extra ``FILES:*`` variables then containing information that -define which files and directories go into which packages. Files -included by earlier packages are skipped by latter packages. Thus, the -main :term:`PN` package does not include the above listed files. - -Packaging Externally Produced Binaries -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Sometimes, you need to add pre-compiled binaries to an image. For -example, suppose that there are binaries for proprietary code, -created by a particular division of a company. Your part of the company -needs to use those binaries as part of an image that you are building -using the OpenEmbedded build system. Since you only have the binaries -and not the source code, you cannot use a typical recipe that expects to -fetch the source specified in -:term:`SRC_URI` and then compile it. - -One method is to package the binaries and then install them as part of -the image. Generally, it is not a good idea to package binaries since, -among other things, it can hinder the ability to reproduce builds and -could lead to compatibility problems with ABI in the future. However, -sometimes you have no choice. - -The easiest solution is to create a recipe that uses the -:ref:`bin_package ` class -and to be sure that you are using default locations for build artifacts. -In most cases, the :ref:`bin_package ` class handles "skipping" the -configure and compile steps as well as sets things up to grab packages -from the appropriate area. In particular, this class sets ``noexec`` on -both the :ref:`ref-tasks-configure` -and :ref:`ref-tasks-compile` tasks, -sets ``FILES:${PN}`` to "/" so that it picks up all files, and sets up a -:ref:`ref-tasks-install` task, which -effectively copies all files from ``${S}`` to ``${D}``. The -:ref:`bin_package ` class works well when the files extracted into ``${S}`` -are already laid out in the way they should be laid out on the target. -For more information on these variables, see the -:term:`FILES`, -:term:`PN`, -:term:`S`, and -:term:`D` variables in the Yocto Project -Reference Manual's variable glossary. - -.. note:: - - - Using :term:`DEPENDS` is a good - idea even for components distributed in binary form, and is often - necessary for shared libraries. For a shared library, listing the - library dependencies in :term:`DEPENDS` makes sure that the libraries - are available in the staging sysroot when other recipes link - against the library, which might be necessary for successful - linking. - - - Using :term:`DEPENDS` also allows runtime dependencies between - packages to be added automatically. See the - ":ref:`overview-manual/concepts:automatically added runtime dependencies`" - section in the Yocto Project Overview and Concepts Manual for more - information. - -If you cannot use the :ref:`bin_package ` class, you need to be sure you are -doing the following: - -- Create a recipe where the - :ref:`ref-tasks-configure` and - :ref:`ref-tasks-compile` tasks do - nothing: It is usually sufficient to just not define these tasks in - the recipe, because the default implementations do nothing unless a - Makefile is found in - ``${``\ :term:`S`\ ``}``. - - If ``${S}`` might contain a Makefile, or if you inherit some class - that replaces :ref:`ref-tasks-configure` and :ref:`ref-tasks-compile` with custom - versions, then you can use the - ``[``\ :ref:`noexec `\ ``]`` - flag to turn the tasks into no-ops, as follows:: - - do_configure[noexec] = "1" - do_compile[noexec] = "1" - - Unlike - :ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:deleting a task`, - using the flag preserves the dependency chain from the - :ref:`ref-tasks-fetch`, - :ref:`ref-tasks-unpack`, and - :ref:`ref-tasks-patch` tasks to the - :ref:`ref-tasks-install` task. - -- Make sure your :ref:`ref-tasks-install` task installs the binaries - appropriately. - -- Ensure that you set up :term:`FILES` - (usually - ``FILES:${``\ :term:`PN`\ ``}``) to - point to the files you have installed, which of course depends on - where you have installed them and whether those files are in - different locations than the defaults. - -Following Recipe Style Guidelines ---------------------------------- - -When writing recipes, it is good to conform to existing style -guidelines. The :oe_wiki:`OpenEmbedded Styleguide ` wiki page -provides rough guidelines for preferred recipe style. - -It is common for existing recipes to deviate a bit from this style. -However, aiming for at least a consistent style is a good idea. Some -practices, such as omitting spaces around ``=`` operators in assignments -or ordering recipe components in an erratic way, are widely seen as poor -style. - -Recipe Syntax -------------- - -Understanding recipe file syntax is important for writing recipes. The -following list overviews the basic items that make up a BitBake recipe -file. For more complete BitBake syntax descriptions, see the -":doc:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata`" -chapter of the BitBake User Manual. - -- *Variable Assignments and Manipulations:* Variable assignments allow - a value to be assigned to a variable. The assignment can be static - text or might include the contents of other variables. In addition to - the assignment, appending and prepending operations are also - supported. - - The following example shows some of the ways you can use variables in - recipes:: - - S = "${WORKDIR}/postfix-${PV}" - CFLAGS += "-DNO_ASM" - CFLAGS:append = " --enable-important-feature" - -- *Functions:* Functions provide a series of actions to be performed. - You usually use functions to override the default implementation of a - task function or to complement a default function (i.e. append or - prepend to an existing function). Standard functions use ``sh`` shell - syntax, although access to OpenEmbedded variables and internal - methods are also available. - - Here is an example function from the ``sed`` recipe:: - - do_install () { - autotools_do_install - install -d ${D}${base_bindir} - mv ${D}${bindir}/sed ${D}${base_bindir}/sed - rmdir ${D}${bindir}/ - } - - It is - also possible to implement new functions that are called between - existing tasks as long as the new functions are not replacing or - complementing the default functions. You can implement functions in - Python instead of shell. Both of these options are not seen in the - majority of recipes. - -- *Keywords:* BitBake recipes use only a few keywords. You use keywords - to include common functions (``inherit``), load parts of a recipe - from other files (``include`` and ``require``) and export variables - to the environment (``export``). - - The following example shows the use of some of these keywords:: - - export POSTCONF = "${STAGING_BINDIR}/postconf" - inherit autoconf - require otherfile.inc - -- *Comments (#):* Any lines that begin with the hash character (``#``) - are treated as comment lines and are ignored:: - - # This is a comment - -This next list summarizes the most important and most commonly used -parts of the recipe syntax. For more information on these parts of the -syntax, you can reference the -":doc:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata`" chapter -in the BitBake User Manual. - -- *Line Continuation (\\):* Use the backward slash (``\``) character to - split a statement over multiple lines. Place the slash character at - the end of the line that is to be continued on the next line:: - - VAR = "A really long \ - line" - - .. note:: - - You cannot have any characters including spaces or tabs after the - slash character. - -- *Using Variables (${VARNAME}):* Use the ``${VARNAME}`` syntax to - access the contents of a variable:: - - SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/zlib-${PV}.tar.gz" - - .. note:: - - It is important to understand that the value of a variable - expressed in this form does not get substituted automatically. The - expansion of these expressions happens on-demand later (e.g. - usually when a function that makes reference to the variable - executes). This behavior ensures that the values are most - appropriate for the context in which they are finally used. On the - rare occasion that you do need the variable expression to be - expanded immediately, you can use the - := - operator instead of - = - when you make the assignment, but this is not generally needed. - -- *Quote All Assignments ("value"):* Use double quotes around values in - all variable assignments (e.g. ``"value"``). Following is an example:: - - VAR1 = "${OTHERVAR}" - VAR2 = "The version is ${PV}" - -- *Conditional Assignment (?=):* Conditional assignment is used to - assign a value to a variable, but only when the variable is currently - unset. Use the question mark followed by the equal sign (``?=``) to - make a "soft" assignment used for conditional assignment. Typically, - "soft" assignments are used in the ``local.conf`` file for variables - that are allowed to come through from the external environment. - - Here is an example where ``VAR1`` is set to "New value" if it is - currently empty. However, if ``VAR1`` has already been set, it - remains unchanged:: - - VAR1 ?= "New value" - - In this next example, ``VAR1`` is left with the value "Original value":: - - VAR1 = "Original value" - VAR1 ?= "New value" - -- *Appending (+=):* Use the plus character followed by the equals sign - (``+=``) to append values to existing variables. - - .. note:: - - This operator adds a space between the existing content of the - variable and the new content. - - Here is an example:: - - SRC_URI += "file://fix-makefile.patch" - -- *Prepending (=+):* Use the equals sign followed by the plus character - (``=+``) to prepend values to existing variables. - - .. note:: - - This operator adds a space between the new content and the - existing content of the variable. - - Here is an example:: - - VAR =+ "Starts" - -- *Appending (:append):* Use the ``:append`` operator to append values - to existing variables. This operator does not add any additional - space. Also, the operator is applied after all the ``+=``, and ``=+`` - operators have been applied and after all ``=`` assignments have - occurred. This means that if ``:append`` is used in a recipe, it can - only be overridden by another layer using the special ``:remove`` - operator, which in turn will prevent further layers from adding it back. - - The following example shows the space being explicitly added to the - start to ensure the appended value is not merged with the existing - value:: - - CFLAGS:append = " --enable-important-feature" - - You can also use - the ``:append`` operator with overrides, which results in the actions - only being performed for the specified target or machine:: - - CFLAGS:append:sh4 = " --enable-important-sh4-specific-feature" - -- *Prepending (:prepend):* Use the ``:prepend`` operator to prepend - values to existing variables. This operator does not add any - additional space. Also, the operator is applied after all the ``+=``, - and ``=+`` operators have been applied and after all ``=`` - assignments have occurred. - - The following example shows the space being explicitly added to the - end to ensure the prepended value is not merged with the existing - value:: - - CFLAGS:prepend = "-I${S}/myincludes " - - You can also use the - ``:prepend`` operator with overrides, which results in the actions - only being performed for the specified target or machine:: - - CFLAGS:prepend:sh4 = "-I${S}/myincludes " - -- *Overrides:* You can use overrides to set a value conditionally, - typically based on how the recipe is being built. For example, to set - the :term:`KBRANCH` variable's - value to "standard/base" for any target - :term:`MACHINE`, except for - qemuarm where it should be set to "standard/arm-versatile-926ejs", - you would do the following:: - - KBRANCH = "standard/base" - KBRANCH:qemuarm = "standard/arm-versatile-926ejs" - - Overrides are also used to separate - alternate values of a variable in other situations. For example, when - setting variables such as - :term:`FILES` and - :term:`RDEPENDS` that are - specific to individual packages produced by a recipe, you should - always use an override that specifies the name of the package. - -- *Indentation:* Use spaces for indentation rather than tabs. For - shell functions, both currently work. However, it is a policy - decision of the Yocto Project to use tabs in shell functions. Realize - that some layers have a policy to use spaces for all indentation. - -- *Using Python for Complex Operations:* For more advanced processing, - it is possible to use Python code during variable assignments (e.g. - search and replacement on a variable). - - You indicate Python code using the ``${@python_code}`` syntax for the - variable assignment:: - - SRC_URI = "ftp://ftp.info-zip.org/pub/infozip/src/zip${@d.getVar('PV',1).replace('.', '')}.tgz - -- *Shell Function Syntax:* Write shell functions as if you were writing - a shell script when you describe a list of actions to take. You - should ensure that your script works with a generic ``sh`` and that - it does not require any ``bash`` or other shell-specific - functionality. The same considerations apply to various system - utilities (e.g. ``sed``, ``grep``, ``awk``, and so forth) that you - might wish to use. If in doubt, you should check with multiple - implementations --- including those from BusyBox. - -Adding a New Machine -==================== - -Adding a new machine to the Yocto Project is a straightforward process. -This section describes how to add machines that are similar to those -that the Yocto Project already supports. - -.. note:: - - Although well within the capabilities of the Yocto Project, adding a - totally new architecture might require changes to ``gcc``/``glibc`` - and to the site information, which is beyond the scope of this - manual. - -For a complete example that shows how to add a new machine, see the -":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`" -section in the Yocto Project Board Support Package (BSP) Developer's -Guide. - -Adding the Machine Configuration File -------------------------------------- - -To add a new machine, you need to add a new machine configuration file -to the layer's ``conf/machine`` directory. This configuration file -provides details about the device you are adding. - -The OpenEmbedded build system uses the root name of the machine -configuration file to reference the new machine. For example, given a -machine configuration file named ``crownbay.conf``, the build system -recognizes the machine as "crownbay". - -The most important variables you must set in your machine configuration -file or include from a lower-level configuration file are as follows: - -- :term:`TARGET_ARCH` (e.g. "arm") - -- ``PREFERRED_PROVIDER_virtual/kernel`` - -- :term:`MACHINE_FEATURES` (e.g. "apm screen wifi") - -You might also need these variables: - -- :term:`SERIAL_CONSOLES` (e.g. "115200;ttyS0 115200;ttyS1") - -- :term:`KERNEL_IMAGETYPE` (e.g. "zImage") - -- :term:`IMAGE_FSTYPES` (e.g. "tar.gz jffs2") - -You can find full details on these variables in the reference section. -You can leverage existing machine ``.conf`` files from -``meta-yocto-bsp/conf/machine/``. - -Adding a Kernel for the Machine -------------------------------- - -The OpenEmbedded build system needs to be able to build a kernel for the -machine. You need to either create a new kernel recipe for this machine, -or extend an existing kernel recipe. You can find several kernel recipe -examples in the Source Directory at ``meta/recipes-kernel/linux`` that -you can use as references. - -If you are creating a new kernel recipe, normal recipe-writing rules -apply for setting up a :term:`SRC_URI`. Thus, you need to specify any -necessary patches and set :term:`S` to point at the source code. You need to -create a :ref:`ref-tasks-configure` task that configures the unpacked kernel with -a ``defconfig`` file. You can do this by using a ``make defconfig`` -command or, more commonly, by copying in a suitable ``defconfig`` file -and then running ``make oldconfig``. By making use of ``inherit kernel`` -and potentially some of the ``linux-*.inc`` files, most other -functionality is centralized and the defaults of the class normally work -well. - -If you are extending an existing kernel recipe, it is usually a matter -of adding a suitable ``defconfig`` file. The file needs to be added into -a location similar to ``defconfig`` files used for other machines in a -given kernel recipe. A possible way to do this is by listing the file in -the :term:`SRC_URI` and adding the machine to the expression in -:term:`COMPATIBLE_MACHINE`:: - - COMPATIBLE_MACHINE = '(qemux86|qemumips)' - -For more information on ``defconfig`` files, see the -":ref:`kernel-dev/common:changing the configuration`" -section in the Yocto Project Linux Kernel Development Manual. - -Adding a Formfactor Configuration File --------------------------------------- - -A formfactor configuration file provides information about the target -hardware for which the image is being built and information that the -build system cannot obtain from other sources such as the kernel. Some -examples of information contained in a formfactor configuration file -include framebuffer orientation, whether or not the system has a -keyboard, the positioning of the keyboard in relation to the screen, and -the screen resolution. - -The build system uses reasonable defaults in most cases. However, if -customization is necessary, you need to create a ``machconfig`` file in -the ``meta/recipes-bsp/formfactor/files`` directory. This directory -contains directories for specific machines such as ``qemuarm`` and -``qemux86``. For information about the settings available and the -defaults, see the ``meta/recipes-bsp/formfactor/files/config`` file -found in the same area. - -Following is an example for "qemuarm" machine:: - - HAVE_TOUCHSCREEN=1 - HAVE_KEYBOARD=1 - DISPLAY_CAN_ROTATE=0 - DISPLAY_ORIENTATION=0 - #DISPLAY_WIDTH_PIXELS=640 - #DISPLAY_HEIGHT_PIXELS=480 - #DISPLAY_BPP=16 - DISPLAY_DPI=150 - DISPLAY_SUBPIXEL_ORDER=vrgb - -Upgrading Recipes -================= - -Over time, upstream developers publish new versions for software built -by layer recipes. It is recommended to keep recipes up-to-date with -upstream version releases. - -While there are several methods to upgrade a recipe, you might -consider checking on the upgrade status of a recipe first. You can do so -using the ``devtool check-upgrade-status`` command. See the -":ref:`devtool-checking-on-the-upgrade-status-of-a-recipe`" -section in the Yocto Project Reference Manual for more information. - -The remainder of this section describes three ways you can upgrade a -recipe. You can use the Automated Upgrade Helper (AUH) to set up -automatic version upgrades. Alternatively, you can use -``devtool upgrade`` to set up semi-automatic version upgrades. Finally, -you can manually upgrade a recipe by editing the recipe itself. - -Using the Auto Upgrade Helper (AUH) ------------------------------------ - -The AUH utility works in conjunction with the OpenEmbedded build system -in order to automatically generate upgrades for recipes based on new -versions being published upstream. Use AUH when you want to create a -service that performs the upgrades automatically and optionally sends -you an email with the results. - -AUH allows you to update several recipes with a single use. You can also -optionally perform build and integration tests using images with the -results saved to your hard drive and emails of results optionally sent -to recipe maintainers. Finally, AUH creates Git commits with appropriate -commit messages in the layer's tree for the changes made to recipes. - -.. note:: - - In some conditions, you should not use AUH to upgrade recipes - and should instead use either ``devtool upgrade`` or upgrade your - recipes manually: - - - When AUH cannot complete the upgrade sequence. This situation - usually results because custom patches carried by the recipe - cannot be automatically rebased to the new version. In this case, - ``devtool upgrade`` allows you to manually resolve conflicts. - - - When for any reason you want fuller control over the upgrade - process. For example, when you want special arrangements for - testing. - -The following steps describe how to set up the AUH utility: - -1. *Be Sure the Development Host is Set Up:* You need to be sure that - your development host is set up to use the Yocto Project. For - information on how to set up your host, see the - ":ref:`dev-manual/start:Preparing the Build Host`" section. - -2. *Make Sure Git is Configured:* The AUH utility requires Git to be - configured because AUH uses Git to save upgrades. Thus, you must have - Git user and email configured. The following command shows your - configurations:: - - $ git config --list - - If you do not have the user and - email configured, you can use the following commands to do so:: - - $ git config --global user.name some_name - $ git config --global user.email username@domain.com - -3. *Clone the AUH Repository:* To use AUH, you must clone the repository - onto your development host. The following command uses Git to create - a local copy of the repository on your system:: - - $ git clone git://git.yoctoproject.org/auto-upgrade-helper - Cloning into 'auto-upgrade-helper'... remote: Counting objects: 768, done. - remote: Compressing objects: 100% (300/300), done. - remote: Total 768 (delta 499), reused 703 (delta 434) - Receiving objects: 100% (768/768), 191.47 KiB | 98.00 KiB/s, done. - Resolving deltas: 100% (499/499), done. - Checking connectivity... done. - - AUH is not part of the :term:`OpenEmbedded-Core (OE-Core)` or - :term:`Poky` repositories. - -4. *Create a Dedicated Build Directory:* Run the :ref:`structure-core-script` - script to create a fresh :term:`Build Directory` that you use exclusively - for running the AUH utility:: - - $ cd poky - $ source oe-init-build-env your_AUH_build_directory - - Re-using an existing :term:`Build Directory` and its configurations is not - recommended as existing settings could cause AUH to fail or behave - undesirably. - -5. *Make Configurations in Your Local Configuration File:* Several - settings are needed in the ``local.conf`` file in the build - directory you just created for AUH. Make these following - configurations: - - - If you want to enable :ref:`Build - History `, - which is optional, you need the following lines in the - ``conf/local.conf`` file:: - - INHERIT =+ "buildhistory" - BUILDHISTORY_COMMIT = "1" - - With this configuration and a successful - upgrade, a build history "diff" file appears in the - ``upgrade-helper/work/recipe/buildhistory-diff.txt`` file found in - your :term:`Build Directory`. - - - If you want to enable testing through the - :ref:`testimage ` - class, which is optional, you need to have the following set in - your ``conf/local.conf`` file:: - - INHERIT += "testimage" - - .. note:: - - If your distro does not enable by default ptest, which Poky - does, you need the following in your ``local.conf`` file:: - - DISTRO_FEATURES:append = " ptest" - - -6. *Optionally Start a vncserver:* If you are running in a server - without an X11 session, you need to start a vncserver:: - - $ vncserver :1 - $ export DISPLAY=:1 - -7. *Create and Edit an AUH Configuration File:* You need to have the - ``upgrade-helper/upgrade-helper.conf`` configuration file in your - :term:`Build Directory`. You can find a sample configuration file in the - :yocto_git:`AUH source repository `. - - Read through the sample file and make configurations as needed. For - example, if you enabled build history in your ``local.conf`` as - described earlier, you must enable it in ``upgrade-helper.conf``. - - Also, if you are using the default ``maintainers.inc`` file supplied - with Poky and located in ``meta-yocto`` and you do not set a - "maintainers_whitelist" or "global_maintainer_override" in the - ``upgrade-helper.conf`` configuration, and you specify "-e all" on - the AUH command-line, the utility automatically sends out emails to - all the default maintainers. Please avoid this. - -This next set of examples describes how to use the AUH: - -- *Upgrading a Specific Recipe:* To upgrade a specific recipe, use the - following form:: - - $ upgrade-helper.py recipe_name - - For example, this command upgrades the ``xmodmap`` recipe:: - - $ upgrade-helper.py xmodmap - -- *Upgrading a Specific Recipe to a Particular Version:* To upgrade a - specific recipe to a particular version, use the following form:: - - $ upgrade-helper.py recipe_name -t version - - For example, this command upgrades the ``xmodmap`` recipe to version 1.2.3:: - - $ upgrade-helper.py xmodmap -t 1.2.3 - -- *Upgrading all Recipes to the Latest Versions and Suppressing Email - Notifications:* To upgrade all recipes to their most recent versions - and suppress the email notifications, use the following command:: - - $ upgrade-helper.py all - -- *Upgrading all Recipes to the Latest Versions and Send Email - Notifications:* To upgrade all recipes to their most recent versions - and send email messages to maintainers for each attempted recipe as - well as a status email, use the following command:: - - $ upgrade-helper.py -e all - -Once you have run the AUH utility, you can find the results in the AUH -:term:`Build Directory`:: - - ${BUILDDIR}/upgrade-helper/timestamp - -The AUH utility -also creates recipe update commits from successful upgrade attempts in -the layer tree. - -You can easily set up to run the AUH utility on a regular basis by using -a cron job. See the -:yocto_git:`weeklyjob.sh ` -file distributed with the utility for an example. - -Using ``devtool upgrade`` -------------------------- - -As mentioned earlier, an alternative method for upgrading recipes to -newer versions is to use -:doc:`devtool upgrade `. -You can read about ``devtool upgrade`` in general in the -":ref:`sdk-manual/extensible:use \`\`devtool upgrade\`\` to create a version of the recipe that supports a newer version of the software`" -section in the Yocto Project Application Development and the Extensible -Software Development Kit (eSDK) Manual. - -To see all the command-line options available with ``devtool upgrade``, -use the following help command:: - - $ devtool upgrade -h - -If you want to find out what version a recipe is currently at upstream -without any attempt to upgrade your local version of the recipe, you can -use the following command:: - - $ devtool latest-version recipe_name - -As mentioned in the previous section describing AUH, ``devtool upgrade`` -works in a less-automated manner than AUH. Specifically, -``devtool upgrade`` only works on a single recipe that you name on the -command line, cannot perform build and integration testing using images, -and does not automatically generate commits for changes in the source -tree. Despite all these "limitations", ``devtool upgrade`` updates the -recipe file to the new upstream version and attempts to rebase custom -patches contained by the recipe as needed. - -.. note:: - - AUH uses much of ``devtool upgrade`` behind the scenes making AUH somewhat - of a "wrapper" application for ``devtool upgrade``. - -A typical scenario involves having used Git to clone an upstream -repository that you use during build operations. Because you have built the -recipe in the past, the layer is likely added to your -configuration already. If for some reason, the layer is not added, you -could add it easily using the -":ref:`bitbake-layers `" -script. For example, suppose you use the ``nano.bb`` recipe from the -``meta-oe`` layer in the ``meta-openembedded`` repository. For this -example, assume that the layer has been cloned into following area:: - - /home/scottrif/meta-openembedded - -The following command from your :term:`Build Directory` adds the layer to -your build configuration (i.e. ``${BUILDDIR}/conf/bblayers.conf``):: - - $ bitbake-layers add-layer /home/scottrif/meta-openembedded/meta-oe - NOTE: Starting bitbake server... - Parsing recipes: 100% |##########################################| Time: 0:00:55 - Parsing of 1431 .bb files complete (0 cached, 1431 parsed). 2040 targets, 56 skipped, 0 masked, 0 errors. - Removing 12 recipes from the x86_64 sysroot: 100% |##############| Time: 0:00:00 - Removing 1 recipes from the x86_64_i586 sysroot: 100% |##########| Time: 0:00:00 - Removing 5 recipes from the i586 sysroot: 100% |#################| Time: 0:00:00 - Removing 5 recipes from the qemux86 sysroot: 100% |##############| Time: 0:00:00 - -For this example, assume that the ``nano.bb`` recipe that -is upstream has a 2.9.3 version number. However, the version in the -local repository is 2.7.4. The following command from your build -directory automatically upgrades the recipe for you: - -.. note:: - - Using the ``-V`` option is not necessary. Omitting the version number causes - ``devtool upgrade`` to upgrade the recipe to the most recent version. - -:: - - $ devtool upgrade nano -V 2.9.3 - NOTE: Starting bitbake server... - NOTE: Creating workspace layer in /home/scottrif/poky/build/workspace - Parsing recipes: 100% |##########################################| Time: 0:00:46 - Parsing of 1431 .bb files complete (0 cached, 1431 parsed). 2040 targets, 56 skipped, 0 masked, 0 errors. - NOTE: Extracting current version source... - NOTE: Resolving any missing task queue dependencies - . - . - . - NOTE: Executing SetScene Tasks - NOTE: Executing RunQueue Tasks - NOTE: Tasks Summary: Attempted 74 tasks of which 72 didn't need to be rerun and all succeeded. - Adding changed files: 100% |#####################################| Time: 0:00:00 - NOTE: Upgraded source extracted to /home/scottrif/poky/build/workspace/sources/nano - NOTE: New recipe is /home/scottrif/poky/build/workspace/recipes/nano/nano_2.9.3.bb - -Continuing with this example, you can use ``devtool build`` to build the -newly upgraded recipe:: - - $ devtool build nano - NOTE: Starting bitbake server... - Loading cache: 100% |################################################################################################| Time: 0:00:01 - Loaded 2040 entries from dependency cache. - Parsing recipes: 100% |##############################################################################################| Time: 0:00:00 - Parsing of 1432 .bb files complete (1431 cached, 1 parsed). 2041 targets, 56 skipped, 0 masked, 0 errors. - NOTE: Resolving any missing task queue dependencies - . - . - . - NOTE: Executing SetScene Tasks - NOTE: Executing RunQueue Tasks - NOTE: nano: compiling from external source tree /home/scottrif/poky/build/workspace/sources/nano - NOTE: Tasks Summary: Attempted 520 tasks of which 304 didn't need to be rerun and all succeeded. - -Within the ``devtool upgrade`` workflow, you can -deploy and test your rebuilt software. For this example, -however, running ``devtool finish`` cleans up the workspace once the -source in your workspace is clean. This usually means using Git to stage -and submit commits for the changes generated by the upgrade process. - -Once the tree is clean, you can clean things up in this example with the -following command from the ``${BUILDDIR}/workspace/sources/nano`` -directory:: - - $ devtool finish nano meta-oe - NOTE: Starting bitbake server... - Loading cache: 100% |################################################################################################| Time: 0:00:00 - Loaded 2040 entries from dependency cache. - Parsing recipes: 100% |##############################################################################################| Time: 0:00:01 - Parsing of 1432 .bb files complete (1431 cached, 1 parsed). 2041 targets, 56 skipped, 0 masked, 0 errors. - NOTE: Adding new patch 0001-nano.bb-Stuff-I-changed-when-upgrading-nano.bb.patch - NOTE: Updating recipe nano_2.9.3.bb - NOTE: Removing file /home/scottrif/meta-openembedded/meta-oe/recipes-support/nano/nano_2.7.4.bb - NOTE: Moving recipe file to /home/scottrif/meta-openembedded/meta-oe/recipes-support/nano - NOTE: Leaving source tree /home/scottrif/poky/build/workspace/sources/nano as-is; if you no longer need it then please delete it manually - - -Using the ``devtool finish`` command cleans up the workspace and creates a patch -file based on your commits. The tool puts all patch files back into the -source directory in a sub-directory named ``nano`` in this case. - -Manually Upgrading a Recipe ---------------------------- - -If for some reason you choose not to upgrade recipes using -:ref:`dev-manual/common-tasks:Using the Auto Upgrade Helper (AUH)` or -by :ref:`dev-manual/common-tasks:Using \`\`devtool upgrade\`\``, -you can manually edit the recipe files to upgrade the versions. - -.. note:: - - Manually updating multiple recipes scales poorly and involves many - steps. The recommendation to upgrade recipe versions is through AUH - or ``devtool upgrade``, both of which automate some steps and provide - guidance for others needed for the manual process. - -To manually upgrade recipe versions, follow these general steps: - -1. *Change the Version:* Rename the recipe such that the version (i.e. - the :term:`PV` part of the recipe name) - changes appropriately. If the version is not part of the recipe name, - change the value as it is set for :term:`PV` within the recipe itself. - -2. *Update* :term:`SRCREV` *if Needed*: If the source code your recipe builds - is fetched from Git or some other version control system, update - :term:`SRCREV` to point to the - commit hash that matches the new version. - -3. *Build the Software:* Try to build the recipe using BitBake. Typical - build failures include the following: - - - License statements were updated for the new version. For this - case, you need to review any changes to the license and update the - values of :term:`LICENSE` and - :term:`LIC_FILES_CHKSUM` - as needed. - - .. note:: - - License changes are often inconsequential. For example, the - license text's copyright year might have changed. - - - Custom patches carried by the older version of the recipe might - fail to apply to the new version. For these cases, you need to - review the failures. Patches might not be necessary for the new - version of the software if the upgraded version has fixed those - issues. If a patch is necessary and failing, you need to rebase it - into the new version. - -4. *Optionally Attempt to Build for Several Architectures:* Once you - successfully build the new software for a given architecture, you - could test the build for other architectures by changing the - :term:`MACHINE` variable and - rebuilding the software. This optional step is especially important - if the recipe is to be released publicly. - -5. *Check the Upstream Change Log or Release Notes:* Checking both these - reveals if there are new features that could break - backwards-compatibility. If so, you need to take steps to mitigate or - eliminate that situation. - -6. *Optionally Create a Bootable Image and Test:* If you want, you can - test the new software by booting it onto actual hardware. - -7. *Create a Commit with the Change in the Layer Repository:* After all - builds work and any testing is successful, you can create commits for - any changes in the layer holding your upgraded recipe. - -Finding Temporary Source Code -============================= - -You might find it helpful during development to modify the temporary -source code used by recipes to build packages. For example, suppose you -are developing a patch and you need to experiment a bit to figure out -your solution. After you have initially built the package, you can -iteratively tweak the source code, which is located in the -:term:`Build Directory`, and then you can force a re-compile and quickly -test your altered code. Once you settle on a solution, you can then preserve -your changes in the form of patches. - -During a build, the unpacked temporary source code used by recipes to -build packages is available in the :term:`Build Directory` as defined by the -:term:`S` variable. Below is the default value for the :term:`S` variable as -defined in the ``meta/conf/bitbake.conf`` configuration file in the -:term:`Source Directory`:: - - S = "${WORKDIR}/${BP}" - -You should be aware that many recipes override the -:term:`S` variable. For example, recipes that fetch their source from Git -usually set :term:`S` to ``${WORKDIR}/git``. - -.. note:: - - The :term:`BP` represents the base recipe name, which consists of the name - and version:: - - BP = "${BPN}-${PV}" - - -The path to the work directory for the recipe -(:term:`WORKDIR`) is defined as -follows:: - - ${TMPDIR}/work/${MULTIMACH_TARGET_SYS}/${PN}/${EXTENDPE}${PV}-${PR} - -The actual directory depends on several things: - -- :term:`TMPDIR`: The top-level build - output directory. - -- :term:`MULTIMACH_TARGET_SYS`: - The target system identifier. - -- :term:`PN`: The recipe name. - -- :term:`EXTENDPE`: The epoch --- if - :term:`PE` is not specified, which is - usually the case for most recipes, then :term:`EXTENDPE` is blank. - -- :term:`PV`: The recipe version. - -- :term:`PR`: The recipe revision. - -As an example, assume a Source Directory top-level folder named -``poky``, a default :term:`Build Directory` at ``poky/build``, and a -``qemux86-poky-linux`` machine target system. Furthermore, suppose your -recipe is named ``foo_1.3.0.bb``. In this case, the work directory the -build system uses to build the package would be as follows:: - - poky/build/tmp/work/qemux86-poky-linux/foo/1.3.0-r0 - -Using Quilt in Your Workflow -============================ - -`Quilt `__ is a powerful tool -that allows you to capture source code changes without having a clean -source tree. This section outlines the typical workflow you can use to -modify source code, test changes, and then preserve the changes in the -form of a patch all using Quilt. - -.. note:: - - With regard to preserving changes to source files, if you clean a - recipe or have ``rm_work`` enabled, the - :ref:`devtool workflow ` - as described in the Yocto Project Application Development and the - Extensible Software Development Kit (eSDK) manual is a safer - development flow than the flow that uses Quilt. - -Follow these general steps: - -1. *Find the Source Code:* Temporary source code used by the - OpenEmbedded build system is kept in the :term:`Build Directory`. See the - ":ref:`dev-manual/common-tasks:finding temporary source code`" section to - learn how to locate the directory that has the temporary source code for a - particular package. - -2. *Change Your Working Directory:* You need to be in the directory that - has the temporary source code. That directory is defined by the - :term:`S` variable. - -3. *Create a New Patch:* Before modifying source code, you need to - create a new patch. To create a new patch file, use ``quilt new`` as - below:: - - $ quilt new my_changes.patch - -4. *Notify Quilt and Add Files:* After creating the patch, you need to - notify Quilt about the files you plan to edit. You notify Quilt by - adding the files to the patch you just created:: - - $ quilt add file1.c file2.c file3.c - -5. *Edit the Files:* Make your changes in the source code to the files - you added to the patch. - -6. *Test Your Changes:* Once you have modified the source code, the - easiest way to test your changes is by calling the :ref:`ref-tasks-compile` - task as shown in the following example:: - - $ bitbake -c compile -f package - - The ``-f`` or ``--force`` option forces the specified task to - execute. If you find problems with your code, you can just keep - editing and re-testing iteratively until things work as expected. - - .. note:: - - All the modifications you make to the temporary source code disappear - once you run the :ref:`ref-tasks-clean` or :ref:`ref-tasks-cleanall` tasks using BitBake - (i.e. ``bitbake -c clean package`` and ``bitbake -c cleanall package``). - Modifications will also disappear if you use the ``rm_work`` feature as - described in the - ":ref:`dev-manual/common-tasks:conserving disk space during builds`" - section. - -7. *Generate the Patch:* Once your changes work as expected, you need to - use Quilt to generate the final patch that contains all your - modifications. - :: - - $ quilt refresh - - At this point, the - ``my_changes.patch`` file has all your edits made to the ``file1.c``, - ``file2.c``, and ``file3.c`` files. - - You can find the resulting patch file in the ``patches/`` - subdirectory of the source (:term:`S`) directory. - -8. *Copy the Patch File:* For simplicity, copy the patch file into a - directory named ``files``, which you can create in the same directory - that holds the recipe (``.bb``) file or the append (``.bbappend``) - file. Placing the patch here guarantees that the OpenEmbedded build - system will find the patch. Next, add the patch into the :term:`SRC_URI` - of the recipe. Here is an example:: - - SRC_URI += "file://my_changes.patch" - -Using a Development Shell -========================= - -When debugging certain commands or even when just editing packages, -``devshell`` can be a useful tool. When you invoke ``devshell``, all -tasks up to and including -:ref:`ref-tasks-patch` are run for the -specified target. Then, a new terminal is opened and you are placed in -``${``\ :term:`S`\ ``}``, the source -directory. In the new terminal, all the OpenEmbedded build-related -environment variables are still defined so you can use commands such as -``configure`` and ``make``. The commands execute just as if the -OpenEmbedded build system were executing them. Consequently, working -this way can be helpful when debugging a build or preparing software to -be used with the OpenEmbedded build system. - -Following is an example that uses ``devshell`` on a target named -``matchbox-desktop``:: - - $ bitbake matchbox-desktop -c devshell - -This command spawns a terminal with a shell prompt within the -OpenEmbedded build environment. The -:term:`OE_TERMINAL` variable -controls what type of shell is opened. - -For spawned terminals, the following occurs: - -- The ``PATH`` variable includes the cross-toolchain. - -- The ``pkgconfig`` variables find the correct ``.pc`` files. - -- The ``configure`` command finds the Yocto Project site files as well - as any other necessary files. - -Within this environment, you can run configure or compile commands as if -they were being run by the OpenEmbedded build system itself. As noted -earlier, the working directory also automatically changes to the Source -Directory (:term:`S`). - -To manually run a specific task using ``devshell``, run the -corresponding ``run.*`` script in the -``${``\ :term:`WORKDIR`\ ``}/temp`` -directory (e.g., ``run.do_configure.``\ `pid`). If a task's script does -not exist, which would be the case if the task was skipped by way of the -sstate cache, you can create the task by first running it outside of the -``devshell``:: - - $ bitbake -c task - -.. note:: - - - Execution of a task's ``run.*`` script and BitBake's execution of - a task are identical. In other words, running the script re-runs - the task just as it would be run using the ``bitbake -c`` command. - - - Any ``run.*`` file that does not have a ``.pid`` extension is a - symbolic link (symlink) to the most recent version of that file. - -Remember, that the ``devshell`` is a mechanism that allows you to get -into the BitBake task execution environment. And as such, all commands -must be called just as BitBake would call them. That means you need to -provide the appropriate options for cross-compilation and so forth as -applicable. - -When you are finished using ``devshell``, exit the shell or close the -terminal window. - -.. note:: - - - It is worth remembering that when using ``devshell`` you need to - use the full compiler name such as ``arm-poky-linux-gnueabi-gcc`` - instead of just using ``gcc``. The same applies to other - applications such as ``binutils``, ``libtool`` and so forth. - BitBake sets up environment variables such as :term:`CC` to assist - applications, such as ``make`` to find the correct tools. - - - It is also worth noting that ``devshell`` still works over X11 - forwarding and similar situations. - -Using a Python Development Shell -================================ - -Similar to working within a development shell as described in the -previous section, you can also spawn and work within an interactive -Python development shell. When debugging certain commands or even when -just editing packages, ``pydevshell`` can be a useful tool. When you -invoke the ``pydevshell`` task, all tasks up to and including -:ref:`ref-tasks-patch` are run for the -specified target. Then a new terminal is opened. Additionally, key -Python objects and code are available in the same way they are to -BitBake tasks, in particular, the data store 'd'. So, commands such as -the following are useful when exploring the data store and running -functions:: - - pydevshell> d.getVar("STAGING_DIR") - '/media/build1/poky/build/tmp/sysroots' - pydevshell> d.getVar("STAGING_DIR", False) - '${TMPDIR}/sysroots' - pydevshell> d.setVar("FOO", "bar") - pydevshell> d.getVar("FOO") - 'bar' - pydevshell> d.delVar("FOO") - pydevshell> d.getVar("FOO") - pydevshell> bb.build.exec_func("do_unpack", d) - pydevshell> - -See the ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:functions you can call from within python`" -section in the BitBake User Manual for details about available functions. - -The commands execute just as if the OpenEmbedded build -system were executing them. Consequently, working this way can be -helpful when debugging a build or preparing software to be used with the -OpenEmbedded build system. - -Following is an example that uses ``pydevshell`` on a target named -``matchbox-desktop``:: - - $ bitbake matchbox-desktop -c pydevshell - -This command spawns a terminal and places you in an interactive Python -interpreter within the OpenEmbedded build environment. The -:term:`OE_TERMINAL` variable -controls what type of shell is opened. - -When you are finished using ``pydevshell``, you can exit the shell -either by using Ctrl+d or closing the terminal window. - -Building -======== - -This section describes various build procedures, such as the steps -needed for a simple build, building a target for multiple configurations, -generating an image for more than one machine, and so forth. - -Building a Simple Image ------------------------ - -In the development environment, you need to build an image whenever you -change hardware support, add or change system libraries, or add or -change services that have dependencies. There are several methods that allow -you to build an image within the Yocto Project. This section presents -the basic steps you need to build a simple image using BitBake from a -build host running Linux. - -.. note:: - - - For information on how to build an image using - :term:`Toaster`, see the - :doc:`/toaster-manual/index`. - - - For information on how to use ``devtool`` to build images, see the - ":ref:`sdk-manual/extensible:using \`\`devtool\`\` in your sdk workflow`" - section in the Yocto Project Application Development and the - Extensible Software Development Kit (eSDK) manual. - - - For a quick example on how to build an image using the - OpenEmbedded build system, see the - :doc:`/brief-yoctoprojectqs/index` document. - -The build process creates an entire Linux distribution from source and -places it in your :term:`Build Directory` under ``tmp/deploy/images``. For -detailed information on the build process using BitBake, see the -":ref:`overview-manual/concepts:images`" section in the Yocto Project Overview -and Concepts Manual. - -The following figure and list overviews the build process: - -.. image:: figures/bitbake-build-flow.png - :width: 100% - -1. *Set up Your Host Development System to Support Development Using the - Yocto Project*: See the ":doc:`start`" section for options on how to get a - build host ready to use the Yocto Project. - -2. *Initialize the Build Environment:* Initialize the build environment - by sourcing the build environment script (i.e. - :ref:`structure-core-script`):: - - $ source oe-init-build-env [build_dir] - - When you use the initialization script, the OpenEmbedded build system - uses ``build`` as the default :term:`Build Directory` in your current work - directory. You can use a `build_dir` argument with the script to - specify a different :term:`Build Directory`. - - .. note:: - - A common practice is to use a different :term:`Build Directory` for - different targets; for example, ``~/build/x86`` for a ``qemux86`` - target, and ``~/build/arm`` for a ``qemuarm`` target. In any - event, it's typically cleaner to locate the :term:`Build Directory` - somewhere outside of your source directory. - -3. *Make Sure Your* ``local.conf`` *File is Correct*: Ensure the - ``conf/local.conf`` configuration file, which is found in the - :term:`Build Directory`, is set up how you want it. This file defines many - aspects of the build environment including the target machine architecture - through the :term:`MACHINE` variable, the packaging format used during - the build (:term:`PACKAGE_CLASSES`), and a centralized tarball download - directory through the :term:`DL_DIR` variable. - -4. *Build the Image:* Build the image using the ``bitbake`` command:: - - $ bitbake target - - .. note:: - - For information on BitBake, see the :doc:`bitbake:index`. - - The target is the name of the recipe you want to build. Common - targets are the images in ``meta/recipes-core/images``, - ``meta/recipes-sato/images``, and so forth all found in the - :term:`Source Directory`. Alternatively, the target - can be the name of a recipe for a specific piece of software such as - BusyBox. For more details about the images the OpenEmbedded build - system supports, see the - ":ref:`ref-manual/images:Images`" chapter in the Yocto - Project Reference Manual. - - As an example, the following command builds the - ``core-image-minimal`` image:: - - $ bitbake core-image-minimal - - Once an - image has been built, it often needs to be installed. The images and - kernels built by the OpenEmbedded build system are placed in the - :term:`Build Directory` in ``tmp/deploy/images``. For information on how to - run pre-built images such as ``qemux86`` and ``qemuarm``, see the - :doc:`/sdk-manual/index` manual. For - information about how to install these images, see the documentation - for your particular board or machine. - -Building Images for Multiple Targets Using Multiple Configurations ------------------------------------------------------------------- - -You can use a single ``bitbake`` command to build multiple images or -packages for different targets where each image or package requires a -different configuration (multiple configuration builds). The builds, in -this scenario, are sometimes referred to as "multiconfigs", and this -section uses that term throughout. - -This section describes how to set up for multiple configuration builds -and how to account for cross-build dependencies between the -multiconfigs. - -Setting Up and Running a Multiple Configuration Build -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To accomplish a multiple configuration build, you must define each -target's configuration separately using a parallel configuration file in -the :term:`Build Directory` or configuration directory within a layer, and you -must follow a required file hierarchy. Additionally, you must enable the -multiple configuration builds in your ``local.conf`` file. - -Follow these steps to set up and execute multiple configuration builds: - -- *Create Separate Configuration Files*: You need to create a single - configuration file for each build target (each multiconfig). - The configuration definitions are implementation dependent but often - each configuration file will define the machine and the - temporary directory BitBake uses for the build. Whether the same - temporary directory (:term:`TMPDIR`) can be shared will depend on what is - similar and what is different between the configurations. Multiple MACHINE - targets can share the same (:term:`TMPDIR`) as long as the rest of the - configuration is the same, multiple DISTRO settings would need separate - (:term:`TMPDIR`) directories. - - For example, consider a scenario with two different multiconfigs for the same - :term:`MACHINE`: "qemux86" built - for two distributions such as "poky" and "poky-lsb". In this case, - you would need to use the different :term:`TMPDIR`. - - Here is an example showing the minimal statements needed in a - configuration file for a "qemux86" target whose temporary build - directory is ``tmpmultix86``:: - - MACHINE = "qemux86" - TMPDIR = "${TOPDIR}/tmpmultix86" - - The location for these multiconfig configuration files is specific. - They must reside in the current :term:`Build Directory` in a sub-directory of - ``conf`` named ``multiconfig`` or within a layer's ``conf`` directory - under a directory named ``multiconfig``. Following is an example that defines - two configuration files for the "x86" and "arm" multiconfigs: - - .. image:: figures/multiconfig_files.png - :align: center - :width: 50% - - The usual :term:`BBPATH` search path is used to locate multiconfig files in - a similar way to other conf files. - -- *Add the BitBake Multi-configuration Variable to the Local - Configuration File*: Use the - :term:`BBMULTICONFIG` - variable in your ``conf/local.conf`` configuration file to specify - each multiconfig. Continuing with the example from the previous - figure, the :term:`BBMULTICONFIG` variable needs to enable two - multiconfigs: "x86" and "arm" by specifying each configuration file:: - - BBMULTICONFIG = "x86 arm" - - .. note:: - - A "default" configuration already exists by definition. This - configuration is named: "" (i.e. empty string) and is defined by - the variables coming from your ``local.conf`` - file. Consequently, the previous example actually adds two - additional configurations to your build: "arm" and "x86" along - with "". - -- *Launch BitBake*: Use the following BitBake command form to launch - the multiple configuration build:: - - $ bitbake [mc:multiconfigname:]target [[[mc:multiconfigname:]target] ... ] - - For the example in this section, the following command applies:: - - $ bitbake mc:x86:core-image-minimal mc:arm:core-image-sato mc::core-image-base - - The previous BitBake command builds a ``core-image-minimal`` image - that is configured through the ``x86.conf`` configuration file, a - ``core-image-sato`` image that is configured through the ``arm.conf`` - configuration file and a ``core-image-base`` that is configured - through your ``local.conf`` configuration file. - -.. note:: - - Support for multiple configuration builds in the Yocto Project &DISTRO; - (&DISTRO_NAME;) Release does not include Shared State (sstate) - optimizations. Consequently, if a build uses the same object twice - in, for example, two different :term:`TMPDIR` - directories, the build either loads from an existing sstate cache for - that build at the start or builds the object fresh. - -Enabling Multiple Configuration Build Dependencies -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Sometimes dependencies can exist between targets (multiconfigs) in a -multiple configuration build. For example, suppose that in order to -build a ``core-image-sato`` image for an "x86" multiconfig, the root -filesystem of an "arm" multiconfig must exist. This dependency is -essentially that the -:ref:`ref-tasks-image` task in the -``core-image-sato`` recipe depends on the completion of the -:ref:`ref-tasks-rootfs` task of the -``core-image-minimal`` recipe. - -To enable dependencies in a multiple configuration build, you must -declare the dependencies in the recipe using the following statement -form:: - - task_or_package[mcdepends] = "mc:from_multiconfig:to_multiconfig:recipe_name:task_on_which_to_depend" - -To better show how to use this statement, consider the example scenario -from the first paragraph of this section. The following statement needs -to be added to the recipe that builds the ``core-image-sato`` image:: - - do_image[mcdepends] = "mc:x86:arm:core-image-minimal:do_rootfs" - -In this example, the `from_multiconfig` is "x86". The `to_multiconfig` is "arm". The -task on which the :ref:`ref-tasks-image` task in the recipe depends is the -:ref:`ref-tasks-rootfs` task from the ``core-image-minimal`` recipe associated -with the "arm" multiconfig. - -Once you set up this dependency, you can build the "x86" multiconfig -using a BitBake command as follows:: - - $ bitbake mc:x86:core-image-sato - -This command executes all the tasks needed to create the -``core-image-sato`` image for the "x86" multiconfig. Because of the -dependency, BitBake also executes through the :ref:`ref-tasks-rootfs` task for the -"arm" multiconfig build. - -Having a recipe depend on the root filesystem of another build might not -seem that useful. Consider this change to the statement in the -``core-image-sato`` recipe:: - - do_image[mcdepends] = "mc:x86:arm:core-image-minimal:do_image" - -In this case, BitBake must -create the ``core-image-minimal`` image for the "arm" build since the -"x86" build depends on it. - -Because "x86" and "arm" are enabled for multiple configuration builds -and have separate configuration files, BitBake places the artifacts for -each build in the respective temporary build directories (i.e. -:term:`TMPDIR`). - -Building an Initial RAM Filesystem (Initramfs) Image ----------------------------------------------------- - -An initial RAM filesystem (:term:`Initramfs`) image provides a temporary root -filesystem used for early system initialization, typically providing tools and -loading modules needed to locate and mount the final root filesystem. - -Follow these steps to create an :term:`Initramfs` image: - -1. *Create the Initramfs Image Recipe:* You can reference the - ``core-image-minimal-initramfs.bb`` recipe found in the - ``meta/recipes-core`` directory of the :term:`Source Directory` - as an example from which to work. - -2. *Decide if You Need to Bundle the Initramfs Image Into the Kernel - Image:* If you want the :term:`Initramfs` image that is built to be bundled - in with the kernel image, set the :term:`INITRAMFS_IMAGE_BUNDLE` - variable to ``"1"`` in your ``local.conf`` configuration file and set the - :term:`INITRAMFS_IMAGE` variable in the recipe that builds the kernel image. - - Setting the :term:`INITRAMFS_IMAGE_BUNDLE` flag causes the :term:`Initramfs` - image to be unpacked into the ``${B}/usr/`` directory. The unpacked - :term:`Initramfs` image is then passed to the kernel's ``Makefile`` using the - :term:`CONFIG_INITRAMFS_SOURCE` variable, allowing the :term:`Initramfs` - image to be built into the kernel normally. - -3. *Optionally Add Items to the Initramfs Image Through the Initramfs - Image Recipe:* If you add items to the :term:`Initramfs` image by way of its - recipe, you should use :term:`PACKAGE_INSTALL` rather than - :term:`IMAGE_INSTALL`. :term:`PACKAGE_INSTALL` gives more direct control of - what is added to the image as compared to the defaults you might not - necessarily want that are set by the :ref:`image ` - or :ref:`core-image ` classes. - -4. *Build the Kernel Image and the Initramfs Image:* Build your kernel - image using BitBake. Because the :term:`Initramfs` image recipe is a - dependency of the kernel image, the :term:`Initramfs` image is built as well - and bundled with the kernel image if you used the - :term:`INITRAMFS_IMAGE_BUNDLE` variable described earlier. - -Bundling an Initramfs Image From a Separate Multiconfig -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -There may be a case where we want to build an :term:`Initramfs` image which does not -inherit the same distro policy as our main image, for example, we may want -our main image to use ``TCLIBC="glibc"``, but to use ``TCLIBC="musl"`` in our :term:`Initramfs` -image to keep a smaller footprint. However, by performing the steps mentioned -above the :term:`Initramfs` image will inherit ``TCLIBC="glibc"`` without allowing us -to override it. - -To achieve this, you need to perform some additional steps: - -1. *Create a multiconfig for your Initramfs image:* You can perform the steps - on ":ref:`dev-manual/common-tasks:building images for multiple targets using multiple configurations`" to create a separate multiconfig. - For the sake of simplicity let's assume such multiconfig is called: ``initramfscfg.conf`` and - contains the variables:: - - TMPDIR="${TOPDIR}/tmp-initramfscfg" - TCLIBC="musl" - -2. *Set additional Initramfs variables on your main configuration:* - Additionally, on your main configuration (``local.conf``) you need to set the - variables:: - - INITRAMFS_MULTICONFIG = "initramfscfg" - INITRAMFS_DEPLOY_DIR_IMAGE = "${TOPDIR}/tmp-initramfscfg/deploy/images/${MACHINE}" - - The variables :term:`INITRAMFS_MULTICONFIG` and :term:`INITRAMFS_DEPLOY_DIR_IMAGE` - are used to create a multiconfig dependency from the kernel to the :term:`INITRAMFS_IMAGE` - to be built coming from the ``initramfscfg`` multiconfig, and to let the - buildsystem know where the :term:`INITRAMFS_IMAGE` will be located. - - Building a system with such configuration will build the kernel using the - main configuration but the :ref:`ref-tasks-bundle_initramfs` task will grab the - selected :term:`INITRAMFS_IMAGE` from :term:`INITRAMFS_DEPLOY_DIR_IMAGE` - instead, resulting in a musl based :term:`Initramfs` image bundled in the kernel - but a glibc based main image. - - The same is applicable to avoid inheriting :term:`DISTRO_FEATURES` on :term:`INITRAMFS_IMAGE` - or to build a different :term:`DISTRO` for it such as ``poky-tiny``. - - -Building a Tiny System ----------------------- - -Very small distributions have some significant advantages such as -requiring less on-die or in-package memory (cheaper), better performance -through efficient cache usage, lower power requirements due to less -memory, faster boot times, and reduced development overhead. Some -real-world examples where a very small distribution gives you distinct -advantages are digital cameras, medical devices, and small headless -systems. - -This section presents information that shows you how you can trim your -distribution to even smaller sizes than the ``poky-tiny`` distribution, -which is around 5 Mbytes, that can be built out-of-the-box using the -Yocto Project. - -Tiny System Overview -~~~~~~~~~~~~~~~~~~~~ - -The following list presents the overall steps you need to consider and -perform to create distributions with smaller root filesystems, achieve -faster boot times, maintain your critical functionality, and avoid -initial RAM disks: - -- :ref:`Determine your goals and guiding principles - ` - -- :ref:`dev-manual/common-tasks:understand what contributes to your image size` - -- :ref:`Reduce the size of the root filesystem - ` - -- :ref:`Reduce the size of the kernel ` - -- :ref:`dev-manual/common-tasks:remove package management requirements` - -- :ref:`dev-manual/common-tasks:look for other ways to minimize size` - -- :ref:`dev-manual/common-tasks:iterate on the process` - -Goals and Guiding Principles -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Before you can reach your destination, you need to know where you are -going. Here is an example list that you can use as a guide when creating -very small distributions: - -- Determine how much space you need (e.g. a kernel that is 1 Mbyte or - less and a root filesystem that is 3 Mbytes or less). - -- Find the areas that are currently taking 90% of the space and - concentrate on reducing those areas. - -- Do not create any difficult "hacks" to achieve your goals. - -- Leverage the device-specific options. - -- Work in a separate layer so that you keep changes isolated. For - information on how to create layers, see the - ":ref:`dev-manual/common-tasks:understanding and creating layers`" section. - -Understand What Contributes to Your Image Size -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -It is easiest to have something to start with when creating your own -distribution. You can use the Yocto Project out-of-the-box to create the -``poky-tiny`` distribution. Ultimately, you will want to make changes in -your own distribution that are likely modeled after ``poky-tiny``. - -.. note:: - - To use ``poky-tiny`` in your build, set the :term:`DISTRO` variable in your - ``local.conf`` file to "poky-tiny" as described in the - ":ref:`dev-manual/common-tasks:creating your own distribution`" - section. - -Understanding some memory concepts will help you reduce the system size. -Memory consists of static, dynamic, and temporary memory. Static memory -is the TEXT (code), DATA (initialized data in the code), and BSS -(uninitialized data) sections. Dynamic memory represents memory that is -allocated at runtime: stacks, hash tables, and so forth. Temporary -memory is recovered after the boot process. This memory consists of -memory used for decompressing the kernel and for the ``__init__`` -functions. - -To help you see where you currently are with kernel and root filesystem -sizes, you can use two tools found in the :term:`Source Directory` -in the -``scripts/tiny/`` directory: - -- ``ksize.py``: Reports component sizes for the kernel build objects. - -- ``dirsize.py``: Reports component sizes for the root filesystem. - -This next tool and command help you organize configuration fragments and -view file dependencies in a human-readable form: - -- ``merge_config.sh``: Helps you manage configuration files and - fragments within the kernel. With this tool, you can merge individual - configuration fragments together. The tool allows you to make - overrides and warns you of any missing configuration options. The - tool is ideal for allowing you to iterate on configurations, create - minimal configurations, and create configuration files for different - machines without having to duplicate your process. - - The ``merge_config.sh`` script is part of the Linux Yocto kernel Git - repositories (i.e. ``linux-yocto-3.14``, ``linux-yocto-3.10``, - ``linux-yocto-3.8``, and so forth) in the ``scripts/kconfig`` - directory. - - For more information on configuration fragments, see the - ":ref:`kernel-dev/common:creating configuration fragments`" - section in the Yocto Project Linux Kernel Development Manual. - -- ``bitbake -u taskexp -g bitbake_target``: Using the BitBake command - with these options brings up a Dependency Explorer from which you can - view file dependencies. Understanding these dependencies allows you - to make informed decisions when cutting out various pieces of the - kernel and root filesystem. - -Trim the Root Filesystem -~~~~~~~~~~~~~~~~~~~~~~~~ - -The root filesystem is made up of packages for booting, libraries, and -applications. To change things, you can configure how the packaging -happens, which changes the way you build them. You can also modify the -filesystem itself or select a different filesystem. - -First, find out what is hogging your root filesystem by running the -``dirsize.py`` script from your root directory:: - - $ cd root-directory-of-image - $ dirsize.py 100000 > dirsize-100k.log - $ cat dirsize-100k.log - -You can apply a filter to the script to ignore files -under a certain size. The previous example filters out any files below -100 Kbytes. The sizes reported by the tool are uncompressed, and thus -will be smaller by a relatively constant factor in a compressed root -filesystem. When you examine your log file, you can focus on areas of -the root filesystem that take up large amounts of memory. - -You need to be sure that what you eliminate does not cripple the -functionality you need. One way to see how packages relate to each other -is by using the Dependency Explorer UI with the BitBake command:: - - $ cd image-directory - $ bitbake -u taskexp -g image - -Use the interface to -select potential packages you wish to eliminate and see their dependency -relationships. - -When deciding how to reduce the size, get rid of packages that result in -minimal impact on the feature set. For example, you might not need a VGA -display. Or, you might be able to get by with ``devtmpfs`` and ``mdev`` -instead of ``udev``. - -Use your ``local.conf`` file to make changes. For example, to eliminate -``udev`` and ``glib``, set the following in the local configuration -file:: - - VIRTUAL-RUNTIME_dev_manager = "" - -Finally, you should consider exactly the type of root filesystem you -need to meet your needs while also reducing its size. For example, -consider ``cramfs``, ``squashfs``, ``ubifs``, ``ext2``, or an -:term:`Initramfs` using ``initramfs``. Be aware that ``ext3`` requires a 1 -Mbyte journal. If you are okay with running read-only, you do not need -this journal. - -.. note:: - - After each round of elimination, you need to rebuild your system and - then use the tools to see the effects of your reductions. - -Trim the Kernel -~~~~~~~~~~~~~~~ - -The kernel is built by including policies for hardware-independent -aspects. What subsystems do you enable? For what architecture are you -building? Which drivers do you build by default? - -.. note:: - - You can modify the kernel source if you want to help with boot time. - -Run the ``ksize.py`` script from the top-level Linux build directory to -get an idea of what is making up the kernel:: - - $ cd top-level-linux-build-directory - $ ksize.py > ksize.log - $ cat ksize.log - -When you examine the log, you will see how much space is taken up with -the built-in ``.o`` files for drivers, networking, core kernel files, -filesystem, sound, and so forth. The sizes reported by the tool are -uncompressed, and thus will be smaller by a relatively constant factor -in a compressed kernel image. Look to reduce the areas that are large -and taking up around the "90% rule." - -To examine, or drill down, into any particular area, use the ``-d`` -option with the script:: - - $ ksize.py -d > ksize.log - -Using this option -breaks out the individual file information for each area of the kernel -(e.g. drivers, networking, and so forth). - -Use your log file to see what you can eliminate from the kernel based on -features you can let go. For example, if you are not going to need -sound, you do not need any drivers that support sound. - -After figuring out what to eliminate, you need to reconfigure the kernel -to reflect those changes during the next build. You could run -``menuconfig`` and make all your changes at once. However, that makes it -difficult to see the effects of your individual eliminations and also -makes it difficult to replicate the changes for perhaps another target -device. A better method is to start with no configurations using -``allnoconfig``, create configuration fragments for individual changes, -and then manage the fragments into a single configuration file using -``merge_config.sh``. The tool makes it easy for you to iterate using the -configuration change and build cycle. - -Each time you make configuration changes, you need to rebuild the kernel -and check to see what impact your changes had on the overall size. - -Remove Package Management Requirements -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Packaging requirements add size to the image. One way to reduce the size -of the image is to remove all the packaging requirements from the image. -This reduction includes both removing the package manager and its unique -dependencies as well as removing the package management data itself. - -To eliminate all the packaging requirements for an image, be sure that -"package-management" is not part of your -:term:`IMAGE_FEATURES` -statement for the image. When you remove this feature, you are removing -the package manager as well as its dependencies from the root -filesystem. - -Look for Other Ways to Minimize Size -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Depending on your particular circumstances, other areas that you can -trim likely exist. The key to finding these areas is through tools and -methods described here combined with experimentation and iteration. Here -are a couple of areas to experiment with: - -- ``glibc``: In general, follow this process: - - 1. Remove ``glibc`` features from - :term:`DISTRO_FEATURES` - that you think you do not need. - - 2. Build your distribution. - - 3. If the build fails due to missing symbols in a package, determine - if you can reconfigure the package to not need those features. For - example, change the configuration to not support wide character - support as is done for ``ncurses``. Or, if support for those - characters is needed, determine what ``glibc`` features provide - the support and restore the configuration. - - 4. Rebuild and repeat the process. - -- ``busybox``: For BusyBox, use a process similar as described for - ``glibc``. A difference is you will need to boot the resulting system - to see if you are able to do everything you expect from the running - system. You need to be sure to integrate configuration fragments into - Busybox because BusyBox handles its own core features and then allows - you to add configuration fragments on top. - -Iterate on the Process -~~~~~~~~~~~~~~~~~~~~~~ - -If you have not reached your goals on system size, you need to iterate -on the process. The process is the same. Use the tools and see just what -is taking up 90% of the root filesystem and the kernel. Decide what you -can eliminate without limiting your device beyond what you need. - -Depending on your system, a good place to look might be Busybox, which -provides a stripped down version of Unix tools in a single, executable -file. You might be able to drop virtual terminal services or perhaps -ipv6. - -Building Images for More than One Machine ------------------------------------------ - -A common scenario developers face is creating images for several -different machines that use the same software environment. In this -situation, it is tempting to set the tunings and optimization flags for -each build specifically for the targeted hardware (i.e. "maxing out" the -tunings). Doing so can considerably add to build times and package feed -maintenance collectively for the machines. For example, selecting tunes -that are extremely specific to a CPU core used in a system might enable -some micro optimizations in GCC for that particular system but would -otherwise not gain you much of a performance difference across the other -systems as compared to using a more general tuning across all the builds -(e.g. setting :term:`DEFAULTTUNE` -specifically for each machine's build). Rather than "max out" each -build's tunings, you can take steps that cause the OpenEmbedded build -system to reuse software across the various machines where it makes -sense. - -If build speed and package feed maintenance are considerations, you -should consider the points in this section that can help you optimize -your tunings to best consider build times and package feed maintenance. - -- *Share the :term:`Build Directory`:* If at all possible, share the - :term:`TMPDIR` across builds. The Yocto Project supports switching between - different :term:`MACHINE` values in the same :term:`TMPDIR`. This practice - is well supported and regularly used by developers when building for - multiple machines. When you use the same :term:`TMPDIR` for multiple - machine builds, the OpenEmbedded build system can reuse the existing native - and often cross-recipes for multiple machines. Thus, build time decreases. - - .. note:: - - If :term:`DISTRO` settings change or fundamental configuration settings - such as the filesystem layout, you need to work with a clean :term:`TMPDIR`. - Sharing :term:`TMPDIR` under these circumstances might work but since it is - not guaranteed, you should use a clean :term:`TMPDIR`. - -- *Enable the Appropriate Package Architecture:* By default, the - OpenEmbedded build system enables three levels of package - architectures: "all", "tune" or "package", and "machine". Any given - recipe usually selects one of these package architectures (types) for - its output. Depending for what a given recipe creates packages, - making sure you enable the appropriate package architecture can - directly impact the build time. - - A recipe that just generates scripts can enable "all" architecture - because there are no binaries to build. To specifically enable "all" - architecture, be sure your recipe inherits the - :ref:`allarch ` class. - This class is useful for "all" architectures because it configures - many variables so packages can be used across multiple architectures. - - If your recipe needs to generate packages that are machine-specific - or when one of the build or runtime dependencies is already - machine-architecture dependent, which makes your recipe also - machine-architecture dependent, make sure your recipe enables the - "machine" package architecture through the - :term:`MACHINE_ARCH` - variable:: - - PACKAGE_ARCH = "${MACHINE_ARCH}" - - When you do not - specifically enable a package architecture through the - :term:`PACKAGE_ARCH`, The - OpenEmbedded build system defaults to the - :term:`TUNE_PKGARCH` setting:: - - PACKAGE_ARCH = "${TUNE_PKGARCH}" - -- *Choose a Generic Tuning File if Possible:* Some tunes are more - generic and can run on multiple targets (e.g. an ``armv5`` set of - packages could run on ``armv6`` and ``armv7`` processors in most - cases). Similarly, ``i486`` binaries could work on ``i586`` and - higher processors. You should realize, however, that advances on - newer processor versions would not be used. - - If you select the same tune for several different machines, the - OpenEmbedded build system reuses software previously built, thus - speeding up the overall build time. Realize that even though a new - sysroot for each machine is generated, the software is not recompiled - and only one package feed exists. - -- *Manage Granular Level Packaging:* Sometimes there are cases where - injecting another level of package architecture beyond the three - higher levels noted earlier can be useful. For example, consider how - NXP (formerly Freescale) allows for the easy reuse of binary packages - in their layer - :yocto_git:`meta-freescale `. - In this example, the - :yocto_git:`fsl-dynamic-packagearch ` - class shares GPU packages for i.MX53 boards because all boards share - the AMD GPU. The i.MX6-based boards can do the same because all - boards share the Vivante GPU. This class inspects the BitBake - datastore to identify if the package provides or depends on one of - the sub-architecture values. If so, the class sets the - :term:`PACKAGE_ARCH` value - based on the ``MACHINE_SUBARCH`` value. If the package does not - provide or depend on one of the sub-architecture values but it - matches a value in the machine-specific filter, it sets - :term:`MACHINE_ARCH`. This - behavior reduces the number of packages built and saves build time by - reusing binaries. - -- *Use Tools to Debug Issues:* Sometimes you can run into situations - where software is being rebuilt when you think it should not be. For - example, the OpenEmbedded build system might not be using shared - state between machines when you think it should be. These types of - situations are usually due to references to machine-specific - variables such as :term:`MACHINE`, - :term:`SERIAL_CONSOLES`, - :term:`XSERVER`, - :term:`MACHINE_FEATURES`, - and so forth in code that is supposed to only be tune-specific or - when the recipe depends - (:term:`DEPENDS`, - :term:`RDEPENDS`, - :term:`RRECOMMENDS`, - :term:`RSUGGESTS`, and so forth) - on some other recipe that already has - :term:`PACKAGE_ARCH` defined - as "${MACHINE_ARCH}". - - .. note:: - - Patches to fix any issues identified are most welcome as these - issues occasionally do occur. - - For such cases, you can use some tools to help you sort out the - situation: - - - ``state-diff-machines.sh``*:* You can find this tool in the - ``scripts`` directory of the Source Repositories. See the comments - in the script for information on how to use the tool. - - - *BitBake's "-S printdiff" Option:* Using this option causes - BitBake to try to establish the closest signature match it can - (e.g. in the shared state cache) and then run ``bitbake-diffsigs`` - over the matches to determine the stamps and delta where these two - stamp trees diverge. - -Building Software from an External Source ------------------------------------------ - -By default, the OpenEmbedded build system uses the :term:`Build Directory` -when building source code. The build process involves fetching the source -files, unpacking them, and then patching them if necessary before the build -takes place. - -There are situations where you might want to build software from source -files that are external to and thus outside of the OpenEmbedded build -system. For example, suppose you have a project that includes a new BSP -with a heavily customized kernel. And, you want to minimize exposing the -build system to the development team so that they can focus on their -project and maintain everyone's workflow as much as possible. In this -case, you want a kernel source directory on the development machine -where the development occurs. You want the recipe's -:term:`SRC_URI` variable to point to -the external directory and use it as is, not copy it. - -To build from software that comes from an external source, all you need -to do is inherit the -:ref:`externalsrc ` class -and then set the -:term:`EXTERNALSRC` variable to -point to your external source code. Here are the statements to put in -your ``local.conf`` file:: - - INHERIT += "externalsrc" - EXTERNALSRC:pn-myrecipe = "path-to-your-source-tree" - -This next example shows how to accomplish the same thing by setting -:term:`EXTERNALSRC` in the recipe itself or in the recipe's append file:: - - EXTERNALSRC = "path" - EXTERNALSRC_BUILD = "path" - -.. note:: - - In order for these settings to take effect, you must globally or - locally inherit the :ref:`externalsrc ` - class. - -By default, :ref:`ref-classes-externalsrc` builds the source code in a -directory separate from the external source directory as specified by -:term:`EXTERNALSRC`. If you need -to have the source built in the same directory in which it resides, or -some other nominated directory, you can set -:term:`EXTERNALSRC_BUILD` -to point to that directory:: - - EXTERNALSRC_BUILD:pn-myrecipe = "path-to-your-source-tree" - -Replicating a Build Offline ---------------------------- - -It can be useful to take a "snapshot" of upstream sources used in a -build and then use that "snapshot" later to replicate the build offline. -To do so, you need to first prepare and populate your downloads -directory your "snapshot" of files. Once your downloads directory is -ready, you can use it at any time and from any machine to replicate your -build. - -Follow these steps to populate your Downloads directory: - -1. *Create a Clean Downloads Directory:* Start with an empty downloads - directory (:term:`DL_DIR`). You - start with an empty downloads directory by either removing the files - in the existing directory or by setting :term:`DL_DIR` to point to either - an empty location or one that does not yet exist. - -2. *Generate Tarballs of the Source Git Repositories:* Edit your - ``local.conf`` configuration file as follows:: - - DL_DIR = "/home/your-download-dir/" - BB_GENERATE_MIRROR_TARBALLS = "1" - - During - the fetch process in the next step, BitBake gathers the source files - and creates tarballs in the directory pointed to by :term:`DL_DIR`. See - the - :term:`BB_GENERATE_MIRROR_TARBALLS` - variable for more information. - -3. *Populate Your Downloads Directory Without Building:* Use BitBake to - fetch your sources but inhibit the build:: - - $ bitbake target --runonly=fetch - - The downloads directory (i.e. ``${DL_DIR}``) now has - a "snapshot" of the source files in the form of tarballs, which can - be used for the build. - -4. *Optionally Remove Any Git or other SCM Subdirectories From the - Downloads Directory:* If you want, you can clean up your downloads - directory by removing any Git or other Source Control Management - (SCM) subdirectories such as ``${DL_DIR}/git2/*``. The tarballs - already contain these subdirectories. - -Once your downloads directory has everything it needs regarding source -files, you can create your "own-mirror" and build your target. -Understand that you can use the files to build the target offline from -any machine and at any time. - -Follow these steps to build your target using the files in the downloads -directory: - -1. *Using Local Files Only:* Inside your ``local.conf`` file, add the - :term:`SOURCE_MIRROR_URL` variable, inherit the - :ref:`own-mirrors ` class, and use the - :term:`BB_NO_NETWORK` variable to your ``local.conf``. - :: - - SOURCE_MIRROR_URL ?= "file:///home/your-download-dir/" - INHERIT += "own-mirrors" - BB_NO_NETWORK = "1" - - The :term:`SOURCE_MIRROR_URL` and :ref:`own-mirrors ` - class set up the system to use the downloads directory as your "own - mirror". Using the :term:`BB_NO_NETWORK` variable makes sure that - BitBake's fetching process in step 3 stays local, which means files - from your "own-mirror" are used. - -2. *Start With a Clean Build:* You can start with a clean build by - removing the ``${``\ :term:`TMPDIR`\ ``}`` directory or using a new - :term:`Build Directory`. - -3. *Build Your Target:* Use BitBake to build your target:: - - $ bitbake target - - The build completes using the known local "snapshot" of source - files from your mirror. The resulting tarballs for your "snapshot" of - source files are in the downloads directory. - - .. note:: - - The offline build does not work if recipes attempt to find the - latest version of software by setting - :term:`SRCREV` to - ``${``\ :term:`AUTOREV`\ ``}``:: - - SRCREV = "${AUTOREV}" - - When a recipe sets :term:`SRCREV` to - ``${``\ :term:`AUTOREV`\ ``}``, the build system accesses the network in an - attempt to determine the latest version of software from the SCM. - Typically, recipes that use :term:`AUTOREV` are custom or modified - recipes. Recipes that reside in public repositories usually do not - use :term:`AUTOREV`. - - If you do have recipes that use :term:`AUTOREV`, you can take steps to - still use the recipes in an offline build. Do the following: - - 1. Use a configuration generated by enabling :ref:`build - history `. - - 2. Use the ``buildhistory-collect-srcrevs`` command to collect the - stored :term:`SRCREV` values from the build's history. For more - information on collecting these values, see the - ":ref:`dev-manual/common-tasks:build history package information`" - section. - - 3. Once you have the correct source revisions, you can modify - those recipes to set :term:`SRCREV` to specific versions of the - software. - -Speeding Up a Build -=================== - -Build time can be an issue. By default, the build system uses simple -controls to try and maximize build efficiency. In general, the default -settings for all the following variables result in the most efficient -build times when dealing with single socket systems (i.e. a single CPU). -If you have multiple CPUs, you might try increasing the default values -to gain more speed. See the descriptions in the glossary for each -variable for more information: - -- :term:`BB_NUMBER_THREADS`: - The maximum number of threads BitBake simultaneously executes. - -- :term:`BB_NUMBER_PARSE_THREADS`: - The number of threads BitBake uses during parsing. - -- :term:`PARALLEL_MAKE`: Extra - options passed to the ``make`` command during the - :ref:`ref-tasks-compile` task in - order to specify parallel compilation on the local build host. - -- :term:`PARALLEL_MAKEINST`: - Extra options passed to the ``make`` command during the - :ref:`ref-tasks-install` task in - order to specify parallel installation on the local build host. - -As mentioned, these variables all scale to the number of processor cores -available on the build system. For single socket systems, this -auto-scaling ensures that the build system fundamentally takes advantage -of potential parallel operations during the build based on the build -machine's capabilities. - -Following are additional factors that can affect build speed: - -- File system type: The file system type that the build is being - performed on can also influence performance. Using ``ext4`` is - recommended as compared to ``ext2`` and ``ext3`` due to ``ext4`` - improved features such as extents. - -- Disabling the updating of access time using ``noatime``: The - ``noatime`` mount option prevents the build system from updating file - and directory access times. - -- Setting a longer commit: Using the "commit=" mount option increases - the interval in seconds between disk cache writes. Changing this - interval from the five second default to something longer increases - the risk of data loss but decreases the need to write to the disk, - thus increasing the build performance. - -- Choosing the packaging backend: Of the available packaging backends, - IPK is the fastest. Additionally, selecting a singular packaging - backend also helps. - -- Using ``tmpfs`` for :term:`TMPDIR` - as a temporary file system: While this can help speed up the build, - the benefits are limited due to the compiler using ``-pipe``. The - build system goes to some lengths to avoid ``sync()`` calls into the - file system on the principle that if there was a significant failure, - the :term:`Build Directory` contents could easily be rebuilt. - -- Inheriting the - :ref:`rm_work ` class: - Inheriting this class has shown to speed up builds due to - significantly lower amounts of data stored in the data cache as well - as on disk. Inheriting this class also makes cleanup of - :term:`TMPDIR` faster, at the - expense of being easily able to dive into the source code. File - system maintainers have recommended that the fastest way to clean up - large numbers of files is to reformat partitions rather than delete - files due to the linear nature of partitions. This, of course, - assumes you structure the disk partitions and file systems in a way - that this is practical. - -Aside from the previous list, you should keep some trade offs in mind -that can help you speed up the build: - -- Remove items from - :term:`DISTRO_FEATURES` - that you might not need. - -- Exclude debug symbols and other debug information: If you do not need - these symbols and other debug information, disabling the ``*-dbg`` - package generation can speed up the build. You can disable this - generation by setting the - :term:`INHIBIT_PACKAGE_DEBUG_SPLIT` - variable to "1". - -- Disable static library generation for recipes derived from - ``autoconf`` or ``libtool``: Following is an example showing how to - disable static libraries and still provide an override to handle - exceptions:: - - STATICLIBCONF = "--disable-static" - STATICLIBCONF:sqlite3-native = "" - EXTRA_OECONF += "${STATICLIBCONF}" - - .. note:: - - - Some recipes need static libraries in order to work correctly - (e.g. ``pseudo-native`` needs ``sqlite3-native``). Overrides, - as in the previous example, account for these kinds of - exceptions. - - - Some packages have packaging code that assumes the presence of - the static libraries. If so, you might need to exclude them as - well. - -Working With Libraries -====================== - -Libraries are an integral part of your system. This section describes -some common practices you might find helpful when working with libraries -to build your system: - -- :ref:`How to include static library files - ` - -- :ref:`How to use the Multilib feature to combine multiple versions of - library files into a single image - ` - -- :ref:`How to install multiple versions of the same library in parallel on - the same system - ` - -Including Static Library Files ------------------------------- - -If you are building a library and the library offers static linking, you -can control which static library files (``*.a`` files) get included in -the built library. - -The :term:`PACKAGES` and -:term:`FILES:* ` variables in the -``meta/conf/bitbake.conf`` configuration file define how files installed -by the :ref:`ref-tasks-install` task are packaged. By default, the :term:`PACKAGES` -variable includes ``${PN}-staticdev``, which represents all static -library files. - -.. note:: - - Some previously released versions of the Yocto Project defined the - static library files through ``${PN}-dev``. - -Following is part of the BitBake configuration file, where you can see -how the static library files are defined:: - - PACKAGE_BEFORE_PN ?= "" - PACKAGES = "${PN}-src ${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN}-doc ${PN}-locale ${PACKAGE_BEFORE_PN} ${PN}" - PACKAGES_DYNAMIC = "^${PN}-locale-.*" - FILES = "" - - FILES:${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*${SOLIBS} \ - ${sysconfdir} ${sharedstatedir} ${localstatedir} \ - ${base_bindir}/* ${base_sbindir}/* \ - ${base_libdir}/*${SOLIBS} \ - ${base_prefix}/lib/udev ${prefix}/lib/udev \ - ${base_libdir}/udev ${libdir}/udev \ - ${datadir}/${BPN} ${libdir}/${BPN}/* \ - ${datadir}/pixmaps ${datadir}/applications \ - ${datadir}/idl ${datadir}/omf ${datadir}/sounds \ - ${libdir}/bonobo/servers" - - FILES:${PN}-bin = "${bindir}/* ${sbindir}/*" - - FILES:${PN}-doc = "${docdir} ${mandir} ${infodir} ${datadir}/gtk-doc \ - ${datadir}/gnome/help" - SECTION:${PN}-doc = "doc" - - FILES_SOLIBSDEV ?= "${base_libdir}/lib*${SOLIBSDEV} ${libdir}/lib*${SOLIBSDEV}" - FILES:${PN}-dev = "${includedir} ${FILES_SOLIBSDEV} ${libdir}/*.la \ - ${libdir}/*.o ${libdir}/pkgconfig ${datadir}/pkgconfig \ - ${datadir}/aclocal ${base_libdir}/*.o \ - ${libdir}/${BPN}/*.la ${base_libdir}/*.la \ - ${libdir}/cmake ${datadir}/cmake" - SECTION:${PN}-dev = "devel" - ALLOW_EMPTY:${PN}-dev = "1" - RDEPENDS:${PN}-dev = "${PN} (= ${EXTENDPKGV})" - - FILES:${PN}-staticdev = "${libdir}/*.a ${base_libdir}/*.a ${libdir}/${BPN}/*.a" - SECTION:${PN}-staticdev = "devel" - RDEPENDS:${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})" - -Combining Multiple Versions of Library Files into One Image ------------------------------------------------------------ - -The build system offers the ability to build libraries with different -target optimizations or architecture formats and combine these together -into one system image. You can link different binaries in the image -against the different libraries as needed for specific use cases. This -feature is called "Multilib". - -An example would be where you have most of a system compiled in 32-bit -mode using 32-bit libraries, but you have something large, like a -database engine, that needs to be a 64-bit application and uses 64-bit -libraries. Multilib allows you to get the best of both 32-bit and 64-bit -libraries. - -While the Multilib feature is most commonly used for 32 and 64-bit -differences, the approach the build system uses facilitates different -target optimizations. You could compile some binaries to use one set of -libraries and other binaries to use a different set of libraries. The -libraries could differ in architecture, compiler options, or other -optimizations. - -There are several examples in the ``meta-skeleton`` layer found in the -:term:`Source Directory`: - -- :oe_git:`conf/multilib-example.conf ` - configuration file. - -- :oe_git:`conf/multilib-example2.conf ` - configuration file. - -- :oe_git:`recipes-multilib/images/core-image-multilib-example.bb ` - recipe - -Preparing to Use Multilib -~~~~~~~~~~~~~~~~~~~~~~~~~ - -User-specific requirements drive the Multilib feature. Consequently, -there is no one "out-of-the-box" configuration that would -meet your needs. - -In order to enable Multilib, you first need to ensure your recipe is -extended to support multiple libraries. Many standard recipes are -already extended and support multiple libraries. You can check in the -``meta/conf/multilib.conf`` configuration file in the -:term:`Source Directory` to see how this is -done using the -:term:`BBCLASSEXTEND` variable. -Eventually, all recipes will be covered and this list will not be -needed. - -For the most part, the :ref:`Multilib ` -class extension works automatically to -extend the package name from ``${PN}`` to ``${MLPREFIX}${PN}``, where -:term:`MLPREFIX` is the particular multilib (e.g. "lib32-" or "lib64-"). -Standard variables such as -:term:`DEPENDS`, -:term:`RDEPENDS`, -:term:`RPROVIDES`, -:term:`RRECOMMENDS`, -:term:`PACKAGES`, and -:term:`PACKAGES_DYNAMIC` are -automatically extended by the system. If you are extending any manual -code in the recipe, you can use the ``${MLPREFIX}`` variable to ensure -those names are extended correctly. - -Using Multilib -~~~~~~~~~~~~~~ - -After you have set up the recipes, you need to define the actual -combination of multiple libraries you want to build. You accomplish this -through your ``local.conf`` configuration file in the -:term:`Build Directory`. An example configuration would be as follows:: - - MACHINE = "qemux86-64" - require conf/multilib.conf - MULTILIBS = "multilib:lib32" - DEFAULTTUNE:virtclass-multilib-lib32 = "x86" - IMAGE_INSTALL:append = " lib32-glib-2.0" - -This example enables an additional library named -``lib32`` alongside the normal target packages. When combining these -"lib32" alternatives, the example uses "x86" for tuning. For information -on this particular tuning, see -``meta/conf/machine/include/ia32/arch-ia32.inc``. - -The example then includes ``lib32-glib-2.0`` in all the images, which -illustrates one method of including a multiple library dependency. You -can use a normal image build to include this dependency, for example:: - - $ bitbake core-image-sato - -You can also build Multilib packages -specifically with a command like this:: - - $ bitbake lib32-glib-2.0 - -Additional Implementation Details -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -There are generic implementation details as well as details that are specific to -package management systems. Following are implementation details -that exist regardless of the package management system: - -- The typical convention used for the class extension code as used by - Multilib assumes that all package names specified in - :term:`PACKAGES` that contain - ``${PN}`` have ``${PN}`` at the start of the name. When that - convention is not followed and ``${PN}`` appears at the middle or the - end of a name, problems occur. - -- The :term:`TARGET_VENDOR` - value under Multilib will be extended to "-vendormlmultilib" (e.g. - "-pokymllib32" for a "lib32" Multilib with Poky). The reason for this - slightly unwieldy contraction is that any "-" characters in the - vendor string presently break Autoconf's ``config.sub``, and other - separators are problematic for different reasons. - -Here are the implementation details for the RPM Package Management System: - -- A unique architecture is defined for the Multilib packages, along - with creating a unique deploy folder under ``tmp/deploy/rpm`` in the - :term:`Build Directory`. For example, consider ``lib32`` in a - ``qemux86-64`` image. The possible architectures in the system are "all", - "qemux86_64", "lib32:qemux86_64", and "lib32:x86". - -- The ``${MLPREFIX}`` variable is stripped from ``${PN}`` during RPM - packaging. The naming for a normal RPM package and a Multilib RPM - package in a ``qemux86-64`` system resolves to something similar to - ``bash-4.1-r2.x86_64.rpm`` and ``bash-4.1.r2.lib32_x86.rpm``, - respectively. - -- When installing a Multilib image, the RPM backend first installs the - base image and then installs the Multilib libraries. - -- The build system relies on RPM to resolve the identical files in the - two (or more) Multilib packages. - -Here are the implementation details for the IPK Package Management System: - -- The ``${MLPREFIX}`` is not stripped from ``${PN}`` during IPK - packaging. The naming for a normal RPM package and a Multilib IPK - package in a ``qemux86-64`` system resolves to something like - ``bash_4.1-r2.x86_64.ipk`` and ``lib32-bash_4.1-rw:x86.ipk``, - respectively. - -- The IPK deploy folder is not modified with ``${MLPREFIX}`` because - packages with and without the Multilib feature can exist in the same - folder due to the ``${PN}`` differences. - -- IPK defines a sanity check for Multilib installation using certain - rules for file comparison, overridden, etc. - -Installing Multiple Versions of the Same Library ------------------------------------------------- - -There are be situations where you need to install and use multiple versions -of the same library on the same system at the same time. This -almost always happens when a library API changes and you have -multiple pieces of software that depend on the separate versions of the -library. To accommodate these situations, you can install multiple -versions of the same library in parallel on the same system. - -The process is straightforward as long as the libraries use proper -versioning. With properly versioned libraries, all you need to do to -individually specify the libraries is create separate, appropriately -named recipes where the :term:`PN` part of -the name includes a portion that differentiates each library version -(e.g. the major part of the version number). Thus, instead of having a -single recipe that loads one version of a library (e.g. ``clutter``), -you provide multiple recipes that result in different versions of the -libraries you want. As an example, the following two recipes would allow -the two separate versions of the ``clutter`` library to co-exist on the -same system: - -.. code-block:: none - - clutter-1.6_1.6.20.bb - clutter-1.8_1.8.4.bb - -Additionally, if -you have other recipes that depend on a given library, you need to use -the :term:`DEPENDS` variable to -create the dependency. Continuing with the same example, if you want to -have a recipe depend on the 1.8 version of the ``clutter`` library, use -the following in your recipe:: - - DEPENDS = "clutter-1.8" - -Working with Pre-Built Libraries -================================ - -Introduction -------------- - -Some library vendors do not release source code for their software but do -release pre-built binaries. When shared libraries are built, they should -be versioned (see `this article -`__ -for some background), but sometimes this is not done. - -To summarize, a versioned library must meet two conditions: - -#. The filename must have the version appended, for example: ``libfoo.so.1.2.3``. -#. The library must have the ELF tag ``SONAME`` set to the major version - of the library, for example: ``libfoo.so.1``. You can check this by - running ``readelf -d filename | grep SONAME``. - -This section shows how to deal with both versioned and unversioned -pre-built libraries. - -Versioned Libraries -------------------- - -In this example we work with pre-built libraries for the FT4222H USB I/O chip. -Libraries are built for several target architecture variants and packaged in -an archive as follows:: - - ├── build-arm-hisiv300 - │   └── libft4222.so.1.4.4.44 - ├── build-arm-v5-sf - │   └── libft4222.so.1.4.4.44 - ├── build-arm-v6-hf - │   └── libft4222.so.1.4.4.44 - ├── build-arm-v7-hf - │   └── libft4222.so.1.4.4.44 - ├── build-arm-v8 - │   └── libft4222.so.1.4.4.44 - ├── build-i386 - │   └── libft4222.so.1.4.4.44 - ├── build-i486 - │   └── libft4222.so.1.4.4.44 - ├── build-mips-eglibc-hf - │   └── libft4222.so.1.4.4.44 - ├── build-pentium - │   └── libft4222.so.1.4.4.44 - ├── build-x86_64 - │   └── libft4222.so.1.4.4.44 - ├── examples - │   ├── get-version.c - │   ├── i2cm.c - │   ├── spim.c - │   └── spis.c - ├── ftd2xx.h - ├── install4222.sh - ├── libft4222.h - ├── ReadMe.txt - └── WinTypes.h - -To write a recipe to use such a library in your system: - -- The vendor will probably have a proprietary licence, so set - :term:`LICENSE_FLAGS` in your recipe. -- The vendor provides a tarball containing libraries so set :term:`SRC_URI` - appropriately. -- Set :term:`COMPATIBLE_HOST` so that the recipe cannot be used with an - unsupported architecture. In the following example, we only support the 32 - and 64 bit variants of the ``x86`` architecture. -- As the vendor provides versioned libraries, we can use ``oe_soinstall`` - from :ref:`ref-classes-utils` to install the shared library and create - symbolic links. If the vendor does not do this, we need to follow the - non-versioned library guidelines in the next section. -- As the vendor likely used :term:`LDFLAGS` different from those in your Yocto - Project build, disable the corresponding checks by adding ``ldflags`` - to :term:`INSANE_SKIP`. -- The vendor will typically ship release builds without debugging symbols. - Avoid errors by preventing the packaging task from stripping out the symbols - and adding them to a separate debug package. This is done by setting the - ``INHIBIT_`` flags shown below. - -The complete recipe would look like this:: - - SUMMARY = "FTDI FT4222H Library" - SECTION = "libs" - LICENSE_FLAGS = "ftdi" - LICENSE = "CLOSED" - - COMPATIBLE_HOST = "(i.86|x86_64).*-linux" - - # Sources available in a .tgz file in .zip archive - # at https://ftdichip.com/wp-content/uploads/2021/01/libft4222-linux-1.4.4.44.zip - # Found on https://ftdichip.com/software-examples/ft4222h-software-examples/ - # Since dealing with this particular type of archive is out of topic here, - # we use a local link. - SRC_URI = "file://libft4222-linux-${PV}.tgz" - - S = "${WORKDIR}" - - ARCH_DIR:x86-64 = "build-x86_64" - ARCH_DIR:i586 = "build-i386" - ARCH_DIR:i686 = "build-i386" - - INSANE_SKIP:${PN} = "ldflags" - INHIBIT_PACKAGE_STRIP = "1" - INHIBIT_SYSROOT_STRIP = "1" - INHIBIT_PACKAGE_DEBUG_SPLIT = "1" - - do_install () { - install -m 0755 -d ${D}${libdir} - oe_soinstall ${S}/${ARCH_DIR}/libft4222.so.${PV} ${D}${libdir} - install -d ${D}${includedir} - install -m 0755 ${S}/*.h ${D}${includedir} - } - -If the precompiled binaries are not statically linked and have dependencies on -other libraries, then by adding those libraries to :term:`DEPENDS`, the linking -can be examined and the appropriate :term:`RDEPENDS` automatically added. - -Non-Versioned Libraries ------------------------ - -Some Background -~~~~~~~~~~~~~~~ - -Libraries in Linux systems are generally versioned so that it is possible -to have multiple versions of the same library installed, which eases upgrades -and support for older software. For example, suppose that in a versioned -library, an actual library is called ``libfoo.so.1.2``, a symbolic link named -``libfoo.so.1`` points to ``libfoo.so.1.2``, and a symbolic link named -``libfoo.so`` points to ``libfoo.so.1.2``. Given these conditions, when you -link a binary against a library, you typically provide the unversioned file -name (i.e. ``-lfoo`` to the linker). However, the linker follows the symbolic -link and actually links against the versioned filename. The unversioned symbolic -link is only used at development time. Consequently, the library is packaged -along with the headers in the development package ``${PN}-dev`` along with the -actual library and versioned symbolic links in ``${PN}``. Because versioned -libraries are far more common than unversioned libraries, the default packaging -rules assume versioned libraries. - -Yocto Library Packaging Overview -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -It follows that packaging an unversioned library requires a bit of work in the -recipe. By default, ``libfoo.so`` gets packaged into ``${PN}-dev``, which -triggers a QA warning that a non-symlink library is in a ``-dev`` package, -and binaries in the same recipe link to the library in ``${PN}-dev``, -which triggers more QA warnings. To solve this problem, you need to package the -unversioned library into ``${PN}`` where it belongs. The following are the abridged -default :term:`FILES` variables in ``bitbake.conf``:: - - SOLIBS = ".so.*" - SOLIBSDEV = ".so" - FILES_${PN} = "... ${libdir}/lib*${SOLIBS} ..." - FILES_SOLIBSDEV ?= "... ${libdir}/lib*${SOLIBSDEV} ..." - FILES_${PN}-dev = "... ${FILES_SOLIBSDEV} ..." - -:term:`SOLIBS` defines a pattern that matches real shared object libraries. -:term:`SOLIBSDEV` matches the development form (unversioned symlink). These two -variables are then used in ``FILES:${PN}`` and ``FILES:${PN}-dev``, which puts -the real libraries into ``${PN}`` and the unversioned symbolic link into ``${PN}-dev``. -To package unversioned libraries, you need to modify the variables in the recipe -as follows:: - - SOLIBS = ".so" - FILES_SOLIBSDEV = "" - -The modifications cause the ``.so`` file to be the real library -and unset :term:`FILES_SOLIBSDEV` so that no libraries get packaged into -``${PN}-dev``. The changes are required because unless :term:`PACKAGES` is changed, -``${PN}-dev`` collects files before `${PN}`. ``${PN}-dev`` must not collect any of -the files you want in ``${PN}``. - -Finally, loadable modules, essentially unversioned libraries that are linked -at runtime using ``dlopen()`` instead of at build time, should generally be -installed in a private directory. However, if they are installed in ``${libdir}``, -then the modules can be treated as unversioned libraries. - -Example -~~~~~~~ - -The example below installs an unversioned x86-64 pre-built library named -``libfoo.so``. The :term:`COMPATIBLE_HOST` variable limits recipes to the -x86-64 architecture while the :term:`INSANE_SKIP`, :term:`INHIBIT_PACKAGE_STRIP` -and :term:`INHIBIT_SYSROOT_STRIP` variables are all set as in the above -versioned library example. The "magic" is setting the :term:`SOLIBS` and -:term:`FILES_SOLIBSDEV` variables as explained above:: - - SUMMARY = "libfoo sample recipe" - SECTION = "libs" - LICENSE = "CLOSED" - - SRC_URI = "file://libfoo.so" - - COMPATIBLE_HOST = "x86_64.*-linux" - - INSANE_SKIP:${PN} = "ldflags" - INHIBIT_PACKAGE_STRIP = "1" - INHIBIT_SYSROOT_STRIP = "1" - SOLIBS = ".so" - FILES_SOLIBSDEV = "" - - do_install () { - install -d ${D}${libdir} - install -m 0755 ${WORKDIR}/libfoo.so ${D}${libdir} - } - -Using x32 psABI -=============== - -x32 processor-specific Application Binary Interface (`x32 -psABI `__) is a native -32-bit processor-specific ABI for Intel 64 (x86-64) architectures. An -ABI defines the calling conventions between functions in a processing -environment. The interface determines what registers are used and what -the sizes are for various C data types. - -Some processing environments prefer using 32-bit applications even when -running on Intel 64-bit platforms. Consider the i386 psABI, which is a -very old 32-bit ABI for Intel 64-bit platforms. The i386 psABI does not -provide efficient use and access of the Intel 64-bit processor -resources, leaving the system underutilized. Now consider the x86_64 -psABI. This ABI is newer and uses 64-bits for data sizes and program -pointers. The extra bits increase the footprint size of the programs, -libraries, and also increases the memory and file system size -requirements. Executing under the x32 psABI enables user programs to -utilize CPU and system resources more efficiently while keeping the -memory footprint of the applications low. Extra bits are used for -registers but not for addressing mechanisms. - -The Yocto Project supports the final specifications of x32 psABI as -follows: - -- You can create packages and images in x32 psABI format on x86_64 - architecture targets. - -- You can successfully build recipes with the x32 toolchain. - -- You can create and boot ``core-image-minimal`` and - ``core-image-sato`` images. - -- There is RPM Package Manager (RPM) support for x32 binaries. - -- There is support for large images. - -To use the x32 psABI, you need to edit your ``conf/local.conf`` -configuration file as follows:: - - MACHINE = "qemux86-64" - DEFAULTTUNE = "x86-64-x32" - baselib = "${@d.getVar('BASE_LIB:tune-' + (d.getVar('DEFAULTTUNE') \ - or 'INVALID')) or 'lib'}" - -Once you have set -up your configuration file, use BitBake to build an image that supports -the x32 psABI. Here is an example:: - - $ bitbake core-image-sato - -Enabling GObject Introspection Support -====================================== - -`GObject introspection `__ -is the standard mechanism for accessing GObject-based software from -runtime environments. GObject is a feature of the GLib library that -provides an object framework for the GNOME desktop and related software. -GObject Introspection adds information to GObject that allows objects -created within it to be represented across different programming -languages. If you want to construct GStreamer pipelines using Python, or -control UPnP infrastructure using Javascript and GUPnP, GObject -introspection is the only way to do it. - -This section describes the Yocto Project support for generating and -packaging GObject introspection data. GObject introspection data is a -description of the API provided by libraries built on top of the GLib -framework, and, in particular, that framework's GObject mechanism. -GObject Introspection Repository (GIR) files go to ``-dev`` packages, -``typelib`` files go to main packages as they are packaged together with -libraries that are introspected. - -The data is generated when building such a library, by linking the -library with a small executable binary that asks the library to describe -itself, and then executing the binary and processing its output. - -Generating this data in a cross-compilation environment is difficult -because the library is produced for the target architecture, but its -code needs to be executed on the build host. This problem is solved with -the OpenEmbedded build system by running the code through QEMU, which -allows precisely that. Unfortunately, QEMU does not always work -perfectly as mentioned in the ":ref:`dev-manual/common-tasks:known issues`" -section. - -Enabling the Generation of Introspection Data ---------------------------------------------- - -Enabling the generation of introspection data (GIR files) in your -library package involves the following: - -1. Inherit the - :ref:`gobject-introspection ` - class. - -2. Make sure introspection is not disabled anywhere in the recipe or - from anything the recipe includes. Also, make sure that - "gobject-introspection-data" is not in - :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` - and that "qemu-usermode" is not in - :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`. - In either of these conditions, nothing will happen. - -3. Try to build the recipe. If you encounter build errors that look like - something is unable to find ``.so`` libraries, check where these - libraries are located in the source tree and add the following to the - recipe:: - - GIR_EXTRA_LIBS_PATH = "${B}/something/.libs" - - .. note:: - - See recipes in the ``oe-core`` repository that use that - :term:`GIR_EXTRA_LIBS_PATH` variable as an example. - -4. Look for any other errors, which probably mean that introspection - support in a package is not entirely standard, and thus breaks down - in a cross-compilation environment. For such cases, custom-made fixes - are needed. A good place to ask and receive help in these cases is - the :ref:`Yocto Project mailing - lists `. - -.. note:: - - Using a library that no longer builds against the latest Yocto - Project release and prints introspection related errors is a good - candidate for the previous procedure. - -Disabling the Generation of Introspection Data ----------------------------------------------- - -You might find that you do not want to generate introspection data. Or, -perhaps QEMU does not work on your build host and target architecture -combination. If so, you can use either of the following methods to -disable GIR file generations: - -- Add the following to your distro configuration:: - - DISTRO_FEATURES_BACKFILL_CONSIDERED = "gobject-introspection-data" - - Adding this statement disables generating introspection data using - QEMU but will still enable building introspection tools and libraries - (i.e. building them does not require the use of QEMU). - -- Add the following to your machine configuration:: - - MACHINE_FEATURES_BACKFILL_CONSIDERED = "qemu-usermode" - - Adding this statement disables the use of QEMU when building packages for your - machine. Currently, this feature is used only by introspection - recipes and has the same effect as the previously described option. - - .. note:: - - Future releases of the Yocto Project might have other features - affected by this option. - -If you disable introspection data, you can still obtain it through other -means such as copying the data from a suitable sysroot, or by generating -it on the target hardware. The OpenEmbedded build system does not -currently provide specific support for these techniques. - -Testing that Introspection Works in an Image --------------------------------------------- - -Use the following procedure to test if generating introspection data is -working in an image: - -1. Make sure that "gobject-introspection-data" is not in - :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` - and that "qemu-usermode" is not in - :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`. - -2. Build ``core-image-sato``. - -3. Launch a Terminal and then start Python in the terminal. - -4. Enter the following in the terminal:: - - >>> from gi.repository import GLib - >>> GLib.get_host_name() - -5. For something a little more advanced, enter the following see: - https://python-gtk-3-tutorial.readthedocs.io/en/latest/introduction.html - -Known Issues ------------- - -Here are know issues in GObject Introspection Support: - -- ``qemu-ppc64`` immediately crashes. Consequently, you cannot build - introspection data on that architecture. - -- x32 is not supported by QEMU. Consequently, introspection data is - disabled. - -- musl causes transient GLib binaries to crash on assertion failures. - Consequently, generating introspection data is disabled. - -- Because QEMU is not able to run the binaries correctly, introspection - is disabled for some specific packages under specific architectures - (e.g. ``gcr``, ``libsecret``, and ``webkit``). - -- QEMU usermode might not work properly when running 64-bit binaries - under 32-bit host machines. In particular, "qemumips64" is known to - not work under i686. - -Optionally Using an External Toolchain -====================================== - -You might want to use an external toolchain as part of your development. -If this is the case, the fundamental steps you need to accomplish are as -follows: - -- Understand where the installed toolchain resides. For cases where you - need to build the external toolchain, you would need to take separate - steps to build and install the toolchain. - -- Make sure you add the layer that contains the toolchain to your - ``bblayers.conf`` file through the - :term:`BBLAYERS` variable. - -- Set the ``EXTERNAL_TOOLCHAIN`` variable in your ``local.conf`` file - to the location in which you installed the toolchain. - -A good example of an external toolchain used with the Yocto Project is -Mentor Graphics Sourcery G++ Toolchain. You can see information on how -to use that particular layer in the ``README`` file at -https://github.com/MentorEmbedded/meta-sourcery/. You can find -further information by reading about the -:term:`TCMODE` variable in the Yocto -Project Reference Manual's variable glossary. - -Creating Partitioned Images Using Wic -===================================== - -Creating an image for a particular hardware target using the -OpenEmbedded build system does not necessarily mean you can boot that -image as is on your device. Physical devices accept and boot images in -various ways depending on the specifics of the device. Usually, -information about the hardware can tell you what image format the device -requires. Should your device require multiple partitions on an SD card, -flash, or an HDD, you can use the OpenEmbedded Image Creator, Wic, to -create the properly partitioned image. - -The ``wic`` command generates partitioned images from existing -OpenEmbedded build artifacts. Image generation is driven by partitioning -commands contained in an OpenEmbedded kickstart file (``.wks``) -specified either directly on the command line or as one of a selection -of canned kickstart files as shown with the ``wic list images`` command -in the -":ref:`dev-manual/common-tasks:generate an image using an existing kickstart file`" -section. When you apply the command to a given set of build artifacts, the -result is an image or set of images that can be directly written onto media and -used on a particular system. - -.. note:: - - For a kickstart file reference, see the - ":ref:`ref-manual/kickstart:openembedded kickstart (\`\`.wks\`\`) reference`" - Chapter in the Yocto Project Reference Manual. - -The ``wic`` command and the infrastructure it is based on is by -definition incomplete. The purpose of the command is to allow the -generation of customized images, and as such, was designed to be -completely extensible through a plugin interface. See the -":ref:`dev-manual/common-tasks:using the wic plugin interface`" section -for information on these plugins. - -This section provides some background information on Wic, describes what -you need to have in place to run the tool, provides instruction on how -to use the Wic utility, provides information on using the Wic plugins -interface, and provides several examples that show how to use Wic. - -Background ----------- - -This section provides some background on the Wic utility. While none of -this information is required to use Wic, you might find it interesting. - -- The name "Wic" is derived from OpenEmbedded Image Creator (oeic). The - "oe" diphthong in "oeic" was promoted to the letter "w", because - "oeic" is both difficult to remember and to pronounce. - -- Wic is loosely based on the Meego Image Creator (``mic``) framework. - The Wic implementation has been heavily modified to make direct use - of OpenEmbedded build artifacts instead of package installation and - configuration, which are already incorporated within the OpenEmbedded - artifacts. - -- Wic is a completely independent standalone utility that initially - provides easier-to-use and more flexible replacements for an existing - functionality in OE-Core's - :ref:`image-live ` - class. The difference between Wic and those examples is that with Wic - the functionality of those scripts is implemented by a - general-purpose partitioning language, which is based on Redhat - kickstart syntax. - -Requirements ------------- - -In order to use the Wic utility with the OpenEmbedded Build system, your -system needs to meet the following requirements: - -- The Linux distribution on your development host must support the - Yocto Project. See the ":ref:`detailed-supported-distros`" - section in the Yocto Project Reference Manual for the list of - distributions that support the Yocto Project. - -- The standard system utilities, such as ``cp``, must be installed on - your development host system. - -- You must have sourced the build environment setup script (i.e. - :ref:`structure-core-script`) found in the :term:`Build Directory`. - -- You need to have the build artifacts already available, which - typically means that you must have already created an image using the - OpenEmbedded build system (e.g. ``core-image-minimal``). While it - might seem redundant to generate an image in order to create an image - using Wic, the current version of Wic requires the artifacts in the - form generated by the OpenEmbedded build system. - -- You must build several native tools, which are built to run on the - build system:: - - $ bitbake parted-native dosfstools-native mtools-native - -- Include "wic" as part of the - :term:`IMAGE_FSTYPES` - variable. - -- Include the name of the :ref:`wic kickstart file ` - as part of the :term:`WKS_FILE` variable. If multiple candidate files can - be provided by different layers, specify all the possible names through the - :term:`WKS_FILES` variable instead. - -Getting Help ------------- - -You can get general help for the ``wic`` command by entering the ``wic`` -command by itself or by entering the command with a help argument as -follows:: - - $ wic -h - $ wic --help - $ wic help - -Currently, Wic supports seven commands: ``cp``, ``create``, ``help``, -``list``, ``ls``, ``rm``, and ``write``. You can get help for all these -commands except "help" by using the following form:: - - $ wic help command - -For example, the following command returns help for the ``write`` -command:: - - $ wic help write - -Wic supports help for three topics: ``overview``, ``plugins``, and -``kickstart``. You can get help for any topic using the following form:: - - $ wic help topic - -For example, the following returns overview help for Wic:: - - $ wic help overview - -There is one additional level of help for Wic. You can get help on -individual images through the ``list`` command. You can use the ``list`` -command to return the available Wic images as follows:: - - $ wic list images - genericx86 Create an EFI disk image for genericx86* - edgerouter Create SD card image for Edgerouter - beaglebone-yocto Create SD card image for Beaglebone - qemux86-directdisk Create a qemu machine 'pcbios' direct disk image - systemd-bootdisk Create an EFI disk image with systemd-boot - mkhybridiso Create a hybrid ISO image - mkefidisk Create an EFI disk image - sdimage-bootpart Create SD card image with a boot partition - directdisk-multi-rootfs Create multi rootfs image using rootfs plugin - directdisk Create a 'pcbios' direct disk image - directdisk-bootloader-config Create a 'pcbios' direct disk image with custom bootloader config - qemuriscv Create qcow2 image for RISC-V QEMU machines - directdisk-gpt Create a 'pcbios' direct disk image - efi-bootdisk - -Once you know the list of available -Wic images, you can use ``help`` with the command to get help on a -particular image. For example, the following command returns help on the -"beaglebone-yocto" image:: - - $ wic list beaglebone-yocto help - - Creates a partitioned SD card image for Beaglebone. - Boot files are located in the first vfat partition. - -Operational Modes ------------------ - -You can use Wic in two different modes, depending on how much control -you need for specifying the OpenEmbedded build artifacts that are used -for creating the image: Raw and Cooked: - -- *Raw Mode:* You explicitly specify build artifacts through Wic - command-line arguments. - -- *Cooked Mode:* The current - :term:`MACHINE` setting and image - name are used to automatically locate and provide the build - artifacts. You just supply a kickstart file and the name of the image - from which to use artifacts. - -Regardless of the mode you use, you need to have the build artifacts -ready and available. - -Raw Mode -~~~~~~~~ - -Running Wic in raw mode allows you to specify all the partitions through -the ``wic`` command line. The primary use for raw mode is if you have -built your kernel outside of the Yocto Project :term:`Build Directory`. -In other words, you can point to arbitrary kernel, root filesystem locations, -and so forth. Contrast this behavior with cooked mode where Wic looks in the -:term:`Build Directory` (e.g. ``tmp/deploy/images/``\ machine). - -The general form of the ``wic`` command in raw mode is:: - - $ wic create wks_file options ... - - Where: - - wks_file: - An OpenEmbedded kickstart file. You can provide - your own custom file or use a file from a set of - existing files as described by further options. - - optional arguments: - -h, --help show this help message and exit - -o OUTDIR, --outdir OUTDIR - name of directory to create image in - -e IMAGE_NAME, --image-name IMAGE_NAME - name of the image to use the artifacts from e.g. core- - image-sato - -r ROOTFS_DIR, --rootfs-dir ROOTFS_DIR - path to the /rootfs dir to use as the .wks rootfs - source - -b BOOTIMG_DIR, --bootimg-dir BOOTIMG_DIR - path to the dir containing the boot artifacts (e.g. - /EFI or /syslinux dirs) to use as the .wks bootimg - source - -k KERNEL_DIR, --kernel-dir KERNEL_DIR - path to the dir containing the kernel to use in the - .wks bootimg - -n NATIVE_SYSROOT, --native-sysroot NATIVE_SYSROOT - path to the native sysroot containing the tools to use - to build the image - -s, --skip-build-check - skip the build check - -f, --build-rootfs build rootfs - -c {gzip,bzip2,xz}, --compress-with {gzip,bzip2,xz} - compress image with specified compressor - -m, --bmap generate .bmap - --no-fstab-update Do not change fstab file. - -v VARS_DIR, --vars VARS_DIR - directory with .env files that store bitbake - variables - -D, --debug output debug information - -.. note:: - - You do not need root privileges to run Wic. In fact, you should not - run as root when using the utility. - -Cooked Mode -~~~~~~~~~~~ - -Running Wic in cooked mode leverages off artifacts in the -:term:`Build Directory`. In other words, you do not have to specify kernel or -root filesystem locations as part of the command. All you need to provide is -a kickstart file and the name of the image from which to use artifacts -by using the "-e" option. Wic looks in the :term:`Build Directory` (e.g. -``tmp/deploy/images/``\ machine) for artifacts. - -The general form of the ``wic`` command using Cooked Mode is as follows:: - - $ wic create wks_file -e IMAGE_NAME - - Where: - - wks_file: - An OpenEmbedded kickstart file. You can provide - your own custom file or use a file from a set of - existing files provided with the Yocto Project - release. - - required argument: - -e IMAGE_NAME, --image-name IMAGE_NAME - name of the image to use the artifacts from e.g. core- - image-sato - -Using an Existing Kickstart File --------------------------------- - -If you do not want to create your own kickstart file, you can use an -existing file provided by the Wic installation. As shipped, kickstart -files can be found in the :ref:`overview-manual/development-environment:yocto project source repositories` in the -following two locations:: - - poky/meta-yocto-bsp/wic - poky/scripts/lib/wic/canned-wks - -Use the following command to list the available kickstart files:: - - $ wic list images - genericx86 Create an EFI disk image for genericx86* - beaglebone-yocto Create SD card image for Beaglebone - edgerouter Create SD card image for Edgerouter - qemux86-directdisk Create a QEMU machine 'pcbios' direct disk image - directdisk-gpt Create a 'pcbios' direct disk image - mkefidisk Create an EFI disk image - directdisk Create a 'pcbios' direct disk image - systemd-bootdisk Create an EFI disk image with systemd-boot - mkhybridiso Create a hybrid ISO image - sdimage-bootpart Create SD card image with a boot partition - directdisk-multi-rootfs Create multi rootfs image using rootfs plugin - directdisk-bootloader-config Create a 'pcbios' direct disk image with custom bootloader config - -When you use an existing file, you -do not have to use the ``.wks`` extension. Here is an example in Raw -Mode that uses the ``directdisk`` file:: - - $ wic create directdisk -r rootfs_dir -b bootimg_dir \ - -k kernel_dir -n native_sysroot - -Here are the actual partition language commands used in the -``genericx86.wks`` file to generate an image:: - - # short-description: Create an EFI disk image for genericx86* - # long-description: Creates a partitioned EFI disk image for genericx86* machines - part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 - part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid - part swap --ondisk sda --size 44 --label swap1 --fstype=swap - - bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0" - -Using the Wic Plugin Interface ------------------------------- - -You can extend and specialize Wic functionality by using Wic plugins. -This section explains the Wic plugin interface. - -.. note:: - - Wic plugins consist of "source" and "imager" plugins. Imager plugins - are beyond the scope of this section. - -Source plugins provide a mechanism to customize partition content during -the Wic image generation process. You can use source plugins to map -values that you specify using ``--source`` commands in kickstart files -(i.e. ``*.wks``) to a plugin implementation used to populate a given -partition. - -.. note:: - - If you use plugins that have build-time dependencies (e.g. native - tools, bootloaders, and so forth) when building a Wic image, you need - to specify those dependencies using the :term:`WKS_FILE_DEPENDS` - variable. - -Source plugins are subclasses defined in plugin files. As shipped, the -Yocto Project provides several plugin files. You can see the source -plugin files that ship with the Yocto Project -:yocto_git:`here `. -Each of these plugin files contains source plugins that are designed to -populate a specific Wic image partition. - -Source plugins are subclasses of the ``SourcePlugin`` class, which is -defined in the ``poky/scripts/lib/wic/pluginbase.py`` file. For example, -the ``BootimgEFIPlugin`` source plugin found in the ``bootimg-efi.py`` -file is a subclass of the ``SourcePlugin`` class, which is found in the -``pluginbase.py`` file. - -You can also implement source plugins in a layer outside of the Source -Repositories (external layer). To do so, be sure that your plugin files -are located in a directory whose path is -``scripts/lib/wic/plugins/source/`` within your external layer. When the -plugin files are located there, the source plugins they contain are made -available to Wic. - -When the Wic implementation needs to invoke a partition-specific -implementation, it looks for the plugin with the same name as the -``--source`` parameter used in the kickstart file given to that -partition. For example, if the partition is set up using the following -command in a kickstart file:: - - part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 - -The methods defined as class -members of the matching source plugin (i.e. ``bootimg-pcbios``) in the -``bootimg-pcbios.py`` plugin file are used. - -To be more concrete, here is the corresponding plugin definition from -the ``bootimg-pcbios.py`` file for the previous command along with an -example method called by the Wic implementation when it needs to prepare -a partition using an implementation-specific function:: - - . - . - . - class BootimgPcbiosPlugin(SourcePlugin): - """ - Create MBR boot partition and install syslinux on it. - """ - - name = 'bootimg-pcbios' - . - . - . - @classmethod - def do_prepare_partition(cls, part, source_params, creator, cr_workdir, - oe_builddir, bootimg_dir, kernel_dir, - rootfs_dir, native_sysroot): - """ - Called to do the actual content population for a partition i.e. it - 'prepares' the partition to be incorporated into the image. - In this case, prepare content for legacy bios boot partition. - """ - . - . - . - -If a -subclass (plugin) itself does not implement a particular function, Wic -locates and uses the default version in the superclass. It is for this -reason that all source plugins are derived from the ``SourcePlugin`` -class. - -The ``SourcePlugin`` class defined in the ``pluginbase.py`` file defines -a set of methods that source plugins can implement or override. Any -plugins (subclass of ``SourcePlugin``) that do not implement a -particular method inherit the implementation of the method from the -``SourcePlugin`` class. For more information, see the ``SourcePlugin`` -class in the ``pluginbase.py`` file for details: - -The following list describes the methods implemented in the -``SourcePlugin`` class: - -- ``do_prepare_partition()``: Called to populate a partition with - actual content. In other words, the method prepares the final - partition image that is incorporated into the disk image. - -- ``do_configure_partition()``: Called before - ``do_prepare_partition()`` to create custom configuration files for a - partition (e.g. syslinux or grub configuration files). - -- ``do_install_disk()``: Called after all partitions have been - prepared and assembled into a disk image. This method provides a hook - to allow finalization of a disk image (e.g. writing an MBR). - -- ``do_stage_partition()``: Special content-staging hook called - before ``do_prepare_partition()``. This method is normally empty. - - Typically, a partition just uses the passed-in parameters (e.g. the - unmodified value of ``bootimg_dir``). However, in some cases, things - might need to be more tailored. As an example, certain files might - additionally need to be taken from ``bootimg_dir + /boot``. This hook - allows those files to be staged in a customized fashion. - - .. note:: - - ``get_bitbake_var()`` allows you to access non-standard variables that - you might want to use for this behavior. - -You can extend the source plugin mechanism. To add more hooks, create -more source plugin methods within ``SourcePlugin`` and the corresponding -derived subclasses. The code that calls the plugin methods uses the -``plugin.get_source_plugin_methods()`` function to find the method or -methods needed by the call. Retrieval of those methods is accomplished -by filling up a dict with keys that contain the method names of -interest. On success, these will be filled in with the actual methods. -See the Wic implementation for examples and details. - -Wic Examples ------------- - -This section provides several examples that show how to use the Wic -utility. All the examples assume the list of requirements in the -":ref:`dev-manual/common-tasks:requirements`" section have been met. The -examples assume the previously generated image is -``core-image-minimal``. - -Generate an Image using an Existing Kickstart File -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This example runs in Cooked Mode and uses the ``mkefidisk`` kickstart -file:: - - $ wic create mkefidisk -e core-image-minimal - INFO: Building wic-tools... - . - . - . - INFO: The new image(s) can be found here: - ./mkefidisk-201804191017-sda.direct - - The following build artifacts were used to create the image(s): - ROOTFS_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/rootfs - BOOTIMG_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share - KERNEL_DIR: /home/stephano/yocto/build/tmp-glibc/deploy/images/qemux86 - NATIVE_SYSROOT: /home/stephano/yocto/build/tmp-glibc/work/i586-oe-linux/wic-tools/1.0-r0/recipe-sysroot-native - - INFO: The image(s) were created using OE kickstart file: - /home/stephano/yocto/openembedded-core/scripts/lib/wic/canned-wks/mkefidisk.wks - -The previous example shows the easiest way to create an image by running -in cooked mode and supplying a kickstart file and the "-e" option to -point to the existing build artifacts. Your ``local.conf`` file needs to -have the :term:`MACHINE` variable set -to the machine you are using, which is "qemux86" in this example. - -Once the image builds, the output provides image location, artifact use, -and kickstart file information. - -.. note:: - - You should always verify the details provided in the output to make - sure that the image was indeed created exactly as expected. - -Continuing with the example, you can now write the image from the -:term:`Build Directory` onto a USB stick, or whatever media for which you -built your image, and boot from the media. You can write the image by using -``bmaptool`` or ``dd``:: - - $ oe-run-native bmap-tools-native bmaptool copy mkefidisk-201804191017-sda.direct /dev/sdX - -or :: - - $ sudo dd if=mkefidisk-201804191017-sda.direct of=/dev/sdX - -.. note:: - - For more information on how to use the ``bmaptool`` - to flash a device with an image, see the - ":ref:`dev-manual/common-tasks:flashing images using \`\`bmaptool\`\``" - section. - -Using a Modified Kickstart File -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Because partitioned image creation is driven by the kickstart file, it -is easy to affect image creation by changing the parameters in the file. -This next example demonstrates that through modification of the -``directdisk-gpt`` kickstart file. - -As mentioned earlier, you can use the command ``wic list images`` to -show the list of existing kickstart files. The directory in which the -``directdisk-gpt.wks`` file resides is -``scripts/lib/image/canned-wks/``, which is located in the -:term:`Source Directory` (e.g. ``poky``). -Because available files reside in this directory, you can create and add -your own custom files to the directory. Subsequent use of the -``wic list images`` command would then include your kickstart files. - -In this example, the existing ``directdisk-gpt`` file already does most -of what is needed. However, for the hardware in this example, the image -will need to boot from ``sdb`` instead of ``sda``, which is what the -``directdisk-gpt`` kickstart file uses. - -The example begins by making a copy of the ``directdisk-gpt.wks`` file -in the ``scripts/lib/image/canned-wks`` directory and then by changing -the lines that specify the target disk from which to boot. -:: - - $ cp /home/stephano/yocto/poky/scripts/lib/wic/canned-wks/directdisk-gpt.wks \ - /home/stephano/yocto/poky/scripts/lib/wic/canned-wks/directdisksdb-gpt.wks - -Next, the example modifies the ``directdisksdb-gpt.wks`` file and -changes all instances of "``--ondisk sda``" to "``--ondisk sdb``". The -example changes the following two lines and leaves the remaining lines -untouched:: - - part /boot --source bootimg-pcbios --ondisk sdb --label boot --active --align 1024 - part / --source rootfs --ondisk sdb --fstype=ext4 --label platform --align 1024 --use-uuid - -Once the lines are changed, the -example generates the ``directdisksdb-gpt`` image. The command points -the process at the ``core-image-minimal`` artifacts for the Next Unit of -Computing (nuc) :term:`MACHINE` the -``local.conf``. -:: - - $ wic create directdisksdb-gpt -e core-image-minimal - INFO: Building wic-tools... - . - . - . - Initialising tasks: 100% |#######################################| Time: 0:00:01 - NOTE: Executing SetScene Tasks - NOTE: Executing RunQueue Tasks - NOTE: Tasks Summary: Attempted 1161 tasks of which 1157 didn't need to be rerun and all succeeded. - INFO: Creating image(s)... - - INFO: The new image(s) can be found here: - ./directdisksdb-gpt-201710090938-sdb.direct - - The following build artifacts were used to create the image(s): - ROOTFS_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/rootfs - BOOTIMG_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share - KERNEL_DIR: /home/stephano/yocto/build/tmp-glibc/deploy/images/qemux86 - NATIVE_SYSROOT: /home/stephano/yocto/build/tmp-glibc/work/i586-oe-linux/wic-tools/1.0-r0/recipe-sysroot-native - - INFO: The image(s) were created using OE kickstart file: - /home/stephano/yocto/poky/scripts/lib/wic/canned-wks/directdisksdb-gpt.wks - -Continuing with the example, you can now directly ``dd`` the image to a -USB stick, or whatever media for which you built your image, and boot -the resulting media:: - - $ sudo dd if=directdisksdb-gpt-201710090938-sdb.direct of=/dev/sdb - 140966+0 records in - 140966+0 records out - 72174592 bytes (72 MB, 69 MiB) copied, 78.0282 s, 925 kB/s - $ sudo eject /dev/sdb - -Using a Modified Kickstart File and Running in Raw Mode -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This next example manually specifies each build artifact (runs in Raw -Mode) and uses a modified kickstart file. The example also uses the -``-o`` option to cause Wic to create the output somewhere other than the -default output directory, which is the current directory:: - - $ wic create test.wks -o /home/stephano/testwic \ - --rootfs-dir /home/stephano/yocto/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/rootfs \ - --bootimg-dir /home/stephano/yocto/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share \ - --kernel-dir /home/stephano/yocto/build/tmp/deploy/images/qemux86 \ - --native-sysroot /home/stephano/yocto/build/tmp/work/i586-poky-linux/wic-tools/1.0-r0/recipe-sysroot-native - - INFO: Creating image(s)... - - INFO: The new image(s) can be found here: - /home/stephano/testwic/test-201710091445-sdb.direct - - The following build artifacts were used to create the image(s): - ROOTFS_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/rootfs - BOOTIMG_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share - KERNEL_DIR: /home/stephano/yocto/build/tmp-glibc/deploy/images/qemux86 - NATIVE_SYSROOT: /home/stephano/yocto/build/tmp-glibc/work/i586-oe-linux/wic-tools/1.0-r0/recipe-sysroot-native - - INFO: The image(s) were created using OE kickstart file: - test.wks - -For this example, -:term:`MACHINE` did not have to be -specified in the ``local.conf`` file since the artifact is manually -specified. - -Using Wic to Manipulate an Image -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Wic image manipulation allows you to shorten turnaround time during -image development. For example, you can use Wic to delete the kernel -partition of a Wic image and then insert a newly built kernel. This -saves you time from having to rebuild the entire image each time you -modify the kernel. - -.. note:: - - In order to use Wic to manipulate a Wic image as in this example, - your development machine must have the ``mtools`` package installed. - -The following example examines the contents of the Wic image, deletes -the existing kernel, and then inserts a new kernel: - -1. *List the Partitions:* Use the ``wic ls`` command to list all the - partitions in the Wic image:: - - $ wic ls tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic - Num Start End Size Fstype - 1 1048576 25041919 23993344 fat16 - 2 25165824 72157183 46991360 ext4 - - The previous output shows two partitions in the - ``core-image-minimal-qemux86.wic`` image. - -2. *Examine a Particular Partition:* Use the ``wic ls`` command again - but in a different form to examine a particular partition. - - .. note:: - - You can get command usage on any Wic command using the following - form:: - - $ wic help command - - - For example, the following command shows you the various ways to - use the - wic ls - command:: - - $ wic help ls - - - The following command shows what is in partition one:: - - $ wic ls tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1 - Volume in drive : is boot - Volume Serial Number is E894-1809 - Directory for ::/ - - libcom32 c32 186500 2017-10-09 16:06 - libutil c32 24148 2017-10-09 16:06 - syslinux cfg 220 2017-10-09 16:06 - vesamenu c32 27104 2017-10-09 16:06 - vmlinuz 6904608 2017-10-09 16:06 - 5 files 7 142 580 bytes - 16 582 656 bytes free - - The previous output shows five files, with the - ``vmlinuz`` being the kernel. - - .. note:: - - If you see the following error, you need to update or create a - ``~/.mtoolsrc`` file and be sure to have the line "mtools_skip_check=1" - in the file. Then, run the Wic command again:: - - ERROR: _exec_cmd: /usr/bin/mdir -i /tmp/wic-parttfokuwra ::/ returned '1' instead of 0 - output: Total number of sectors (47824) not a multiple of sectors per track (32)! - Add mtools_skip_check=1 to your .mtoolsrc file to skip this test - - -3. *Remove the Old Kernel:* Use the ``wic rm`` command to remove the - ``vmlinuz`` file (kernel):: - - $ wic rm tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1/vmlinuz - -4. *Add In the New Kernel:* Use the ``wic cp`` command to add the - updated kernel to the Wic image. Depending on how you built your - kernel, it could be in different places. If you used ``devtool`` and - an SDK to build your kernel, it resides in the ``tmp/work`` directory - of the extensible SDK. If you used ``make`` to build the kernel, the - kernel will be in the ``workspace/sources`` area. - - The following example assumes ``devtool`` was used to build the - kernel:: - - $ wic cp poky_sdk/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+git999-r0/linux-yocto-4.12.12+git999/arch/x86/boot/bzImage \ - poky/build/tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1/vmlinuz - - Once the new kernel is added back into the image, you can use the - ``dd`` command or :ref:`bmaptool - ` - to flash your wic image onto an SD card or USB stick and test your - target. - - .. note:: - - Using ``bmaptool`` is generally 10 to 20 times faster than using ``dd``. - -Flashing Images Using ``bmaptool`` -================================== - -A fast and easy way to flash an image to a bootable device is to use -Bmaptool, which is integrated into the OpenEmbedded build system. -Bmaptool is a generic tool that creates a file's block map (bmap) and -then uses that map to copy the file. As compared to traditional tools -such as dd or cp, Bmaptool can copy (or flash) large files like raw -system image files much faster. - -.. note:: - - - If you are using Ubuntu or Debian distributions, you can install - the ``bmap-tools`` package using the following command and then - use the tool without specifying ``PATH`` even from the root - account:: - - $ sudo apt install bmap-tools - - - If you are unable to install the ``bmap-tools`` package, you will - need to build Bmaptool before using it. Use the following command:: - - $ bitbake bmap-tools-native - -Following, is an example that shows how to flash a Wic image. Realize -that while this example uses a Wic image, you can use Bmaptool to flash -any type of image. Use these steps to flash an image using Bmaptool: - -1. *Update your local.conf File:* You need to have the following set - in your ``local.conf`` file before building your image:: - - IMAGE_FSTYPES += "wic wic.bmap" - -2. *Get Your Image:* Either have your image ready (pre-built with the - :term:`IMAGE_FSTYPES` - setting previously mentioned) or take the step to build the image:: - - $ bitbake image - -3. *Flash the Device:* Flash the device with the image by using Bmaptool - depending on your particular setup. The following commands assume the - image resides in the :term:`Build Directory`'s ``deploy/images/`` area: - - - If you have write access to the media, use this command form:: - - $ oe-run-native bmap-tools-native bmaptool copy build-directory/tmp/deploy/images/machine/image.wic /dev/sdX - - - If you do not have write access to the media, set your permissions - first and then use the same command form:: - - $ sudo chmod 666 /dev/sdX - $ oe-run-native bmap-tools-native bmaptool copy build-directory/tmp/deploy/images/machine/image.wic /dev/sdX - -For help on the ``bmaptool`` command, use the following command:: - - $ bmaptool --help - -Making Images More Secure -========================= - -Security is of increasing concern for embedded devices. Consider the -issues and problems discussed in just this sampling of work found across -the Internet: - -- *"*\ `Security Risks of Embedded - Systems `__\ *"* - by Bruce Schneier - -- *"*\ `Internet Census - 2012 `__\ *"* by Carna - Botnet - -- *"*\ `Security Issues for Embedded - Devices `__\ *"* - by Jake Edge - -When securing your image is of concern, there are steps, tools, and -variables that you can consider to help you reach the security goals you -need for your particular device. Not all situations are identical when -it comes to making an image secure. Consequently, this section provides -some guidance and suggestions for consideration when you want to make -your image more secure. - -.. note:: - - Because the security requirements and risks are different for every - type of device, this section cannot provide a complete reference on - securing your custom OS. It is strongly recommended that you also - consult other sources of information on embedded Linux system - hardening and on security. - -General Considerations ----------------------- - -There are general considerations that help you create more secure images. -You should consider the following suggestions to make your device -more secure: - -- Scan additional code you are adding to the system (e.g. application - code) by using static analysis tools. Look for buffer overflows and - other potential security problems. - -- Pay particular attention to the security for any web-based - administration interface. - - Web interfaces typically need to perform administrative functions and - tend to need to run with elevated privileges. Thus, the consequences - resulting from the interface's security becoming compromised can be - serious. Look for common web vulnerabilities such as - cross-site-scripting (XSS), unvalidated inputs, and so forth. - - As with system passwords, the default credentials for accessing a - web-based interface should not be the same across all devices. This - is particularly true if the interface is enabled by default as it can - be assumed that many end-users will not change the credentials. - -- Ensure you can update the software on the device to mitigate - vulnerabilities discovered in the future. This consideration - especially applies when your device is network-enabled. - -- Regularly scan and apply fixes for CVE security issues affecting - all software components in the product, see ":ref:`dev-manual/common-tasks:checking for vulnerabilities`". - -- Regularly update your version of Poky and OE-Core from their upstream - developers, e.g. to apply updates and security fixes from stable - and LTS branches. - -- Ensure you remove or disable debugging functionality before producing - the final image. For information on how to do this, see the - ":ref:`dev-manual/common-tasks:considerations specific to the openembedded build system`" - section. - -- Ensure you have no network services listening that are not needed. - -- Remove any software from the image that is not needed. - -- Enable hardware support for secure boot functionality when your - device supports this functionality. - -Security Flags --------------- - -The Yocto Project has security flags that you can enable that help make -your build output more secure. The security flags are in the -``meta/conf/distro/include/security_flags.inc`` file in your -:term:`Source Directory` (e.g. ``poky``). - -.. note:: - - Depending on the recipe, certain security flags are enabled and - disabled by default. - -Use the following line in your ``local.conf`` file or in your custom -distribution configuration file to enable the security compiler and -linker flags for your build:: - - require conf/distro/include/security_flags.inc - -Considerations Specific to the OpenEmbedded Build System --------------------------------------------------------- - -You can take some steps that are specific to the OpenEmbedded build -system to make your images more secure: - -- Ensure "debug-tweaks" is not one of your selected - :term:`IMAGE_FEATURES`. - When creating a new project, the default is to provide you with an - initial ``local.conf`` file that enables this feature using the - :term:`EXTRA_IMAGE_FEATURES` - variable with the line:: - - EXTRA_IMAGE_FEATURES = "debug-tweaks" - - To disable that feature, simply comment out that line in your - ``local.conf`` file, or make sure :term:`IMAGE_FEATURES` does not contain - "debug-tweaks" before producing your final image. Among other things, - leaving this in place sets the root password as blank, which makes - logging in for debugging or inspection easy during development but - also means anyone can easily log in during production. - -- It is possible to set a root password for the image and also to set - passwords for any extra users you might add (e.g. administrative or - service type users). When you set up passwords for multiple images or - users, you should not duplicate passwords. - - To set up passwords, use the - :ref:`extrausers ` - class, which is the preferred method. For an example on how to set up - both root and user passwords, see the - ":ref:`ref-classes-extrausers`" section. - - .. note:: - - When adding extra user accounts or setting a root password, be - cautious about setting the same password on every device. If you - do this, and the password you have set is exposed, then every - device is now potentially compromised. If you need this access but - want to ensure security, consider setting a different, random - password for each device. Typically, you do this as a separate - step after you deploy the image onto the device. - -- Consider enabling a Mandatory Access Control (MAC) framework such as - SMACK or SELinux and tuning it appropriately for your device's usage. - You can find more information in the - :yocto_git:`meta-selinux ` layer. - -Tools for Hardening Your Image ------------------------------- - -The Yocto Project provides tools for making your image more secure. You -can find these tools in the ``meta-security`` layer of the -:yocto_git:`Yocto Project Source Repositories <>`. - -Creating Your Own Distribution -============================== - -When you build an image using the Yocto Project and do not alter any -distribution :term:`Metadata`, you are -creating a Poky distribution. If you wish to gain more control over -package alternative selections, compile-time options, and other -low-level configurations, you can create your own distribution. - -To create your own distribution, the basic steps consist of creating -your own distribution layer, creating your own distribution -configuration file, and then adding any needed code and Metadata to the -layer. The following steps provide some more detail: - -- *Create a layer for your new distro:* Create your distribution layer - so that you can keep your Metadata and code for the distribution - separate. It is strongly recommended that you create and use your own - layer for configuration and code. Using your own layer as compared to - just placing configurations in a ``local.conf`` configuration file - makes it easier to reproduce the same build configuration when using - multiple build machines. See the - ":ref:`dev-manual/common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`" - section for information on how to quickly set up a layer. - -- *Create the distribution configuration file:* The distribution - configuration file needs to be created in the ``conf/distro`` - directory of your layer. You need to name it using your distribution - name (e.g. ``mydistro.conf``). - - .. note:: - - The :term:`DISTRO` variable in your ``local.conf`` file determines the - name of your distribution. - - You can split out parts of your configuration file into include files - and then "require" them from within your distribution configuration - file. Be sure to place the include files in the - ``conf/distro/include`` directory of your layer. A common example - usage of include files would be to separate out the selection of - desired version and revisions for individual recipes. - - Your configuration file needs to set the following required - variables: - - - :term:`DISTRO_NAME` - - - :term:`DISTRO_VERSION` - - These following variables are optional and you typically set them - from the distribution configuration file: - - - :term:`DISTRO_FEATURES` - - - :term:`DISTRO_EXTRA_RDEPENDS` - - - :term:`DISTRO_EXTRA_RRECOMMENDS` - - - :term:`TCLIBC` - - .. tip:: - - If you want to base your distribution configuration file on the - very basic configuration from OE-Core, you can use - ``conf/distro/defaultsetup.conf`` as a reference and just include - variables that differ as compared to ``defaultsetup.conf``. - Alternatively, you can create a distribution configuration file - from scratch using the ``defaultsetup.conf`` file or configuration files - from another distribution such as Poky as a reference. - -- *Provide miscellaneous variables:* Be sure to define any other - variables for which you want to create a default or enforce as part - of the distribution configuration. You can include nearly any - variable from the ``local.conf`` file. The variables you use are not - limited to the list in the previous bulleted item. - -- *Point to Your distribution configuration file:* In your ``local.conf`` - file in the :term:`Build Directory`, set your :term:`DISTRO` variable to - point to your distribution's configuration file. For example, if your - distribution's configuration file is named ``mydistro.conf``, then - you point to it as follows:: - - DISTRO = "mydistro" - -- *Add more to the layer if necessary:* Use your layer to hold other - information needed for the distribution: - - - Add recipes for installing distro-specific configuration files - that are not already installed by another recipe. If you have - distro-specific configuration files that are included by an - existing recipe, you should add an append file (``.bbappend``) for - those. For general information and recommendations on how to add - recipes to your layer, see the - ":ref:`dev-manual/common-tasks:creating your own layer`" and - ":ref:`dev-manual/common-tasks:following best practices when creating layers`" - sections. - - - Add any image recipes that are specific to your distribution. - - - Add a ``psplash`` append file for a branded splash screen. For - information on append files, see the - ":ref:`dev-manual/common-tasks:appending other layers metadata with your layer`" - section. - - - Add any other append files to make custom changes that are - specific to individual recipes. - -Creating a Custom Template Configuration Directory -================================================== - -If you are producing your own customized version of the build system for -use by other users, you might want to provide a custom build configuration -that includes all the necessary settings and layers (i.e. ``local.conf`` and -``bblayers.conf`` that are created in a new :term:`Build Directory`) and a custom -message that is shown when setting up the build. This can be done by -creating one or more template configuration directories in your -custom distribution layer. - -This can be done by using ``bitbake-layers save-build-conf``:: - - $ bitbake-layers save-build-conf ../../meta-alex/ test-1 - NOTE: Starting bitbake server... - NOTE: Configuration template placed into /srv/work/alex/meta-alex/conf/templates/test-1 - Please review the files in there, and particularly provide a configuration description in /srv/work/alex/meta-alex/conf/templates/test-1/conf-notes.txt - You can try out the configuration with - TEMPLATECONF=/srv/work/alex/meta-alex/conf/templates/test-1 . /srv/work/alex/poky/oe-init-build-env build-try-test-1 - -The above command takes the config files from the currently active :term:`Build Directory` under ``conf``, -replaces site-specific paths in ``bblayers.conf`` with ``##OECORE##``-relative paths, and copies -the config files into a specified layer under a specified template name. - -To use those saved templates as a starting point for a build, users should point -to one of them with :term:`TEMPLATECONF` environment variable:: - - TEMPLATECONF=/srv/work/alex/meta-alex/conf/templates/test-1 . /srv/work/alex/poky/oe-init-build-env build-try-test-1 - -The OpenEmbedded build system uses the environment variable -:term:`TEMPLATECONF` to locate the directory from which it gathers -configuration information that ultimately ends up in the -:term:`Build Directory` ``conf`` directory. - -If :term:`TEMPLATECONF` is not set, the default value is obtained -from ``.templateconf`` file that is read from the same directory as -``oe-init-build-env`` script. For the Poky reference distribution this -would be:: - - TEMPLATECONF=${TEMPLATECONF:-meta-poky/conf/templates/default} - -If you look at a configuration template directory, you will -see the ``bblayers.conf.sample``, ``local.conf.sample``, and -``conf-notes.txt`` files. The build system uses these files to form the -respective ``bblayers.conf`` file, ``local.conf`` file, and show -users a note about the build they're setting up -when running the ``oe-init-build-env`` setup script. These can be -edited further if needed to improve or change the build configurations -available to the users. - -Conserving Disk Space -===================== - -Conserving Disk Space During Builds ------------------------------------ - -To help conserve disk space during builds, you can add the following -statement to your project's ``local.conf`` configuration file found in -the :term:`Build Directory`:: - - INHERIT += "rm_work" - -Adding this statement deletes the work directory used for -building a recipe once the recipe is built. For more information on -"rm_work", see the -:ref:`rm_work ` class in the -Yocto Project Reference Manual. - -Purging Duplicate Shared State Cache Files -------------------------------------------- - -After multiple build iterations, the Shared State (sstate) cache can contain -duplicate cache files for a given package, while only the most recent one -is likely to be reusable. The following command purges all but the -newest sstate cache file for each package:: - - sstate-cache-management.sh --remove-duplicated --cache-dir=build/sstate-cache - -This command will ask you to confirm the deletions it identifies. - -.. note:: - - The duplicated sstate cache files of one package must have the same - architecture, which means that sstate cache files with multiple - architectures are not considered as duplicate. - -Run ``sstate-cache-management.sh`` for more details about this script. - -Working with Packages -===================== - -This section describes a few tasks that involve packages: - -- :ref:`dev-manual/common-tasks:excluding packages from an image` - -- :ref:`dev-manual/common-tasks:incrementing a package version` - -- :ref:`dev-manual/common-tasks:handling optional module packaging` - -- :ref:`dev-manual/common-tasks:using runtime package management` - -- :ref:`dev-manual/common-tasks:generating and using signed packages` - -- :ref:`Setting up and running package test - (ptest) ` - -- :ref:`dev-manual/common-tasks:creating node package manager (npm) packages` - -- :ref:`dev-manual/common-tasks:adding custom metadata to packages` - -Excluding Packages from an Image --------------------------------- - -You might find it necessary to prevent specific packages from being -installed into an image. If so, you can use several variables to direct -the build system to essentially ignore installing recommended packages -or to not install a package at all. - -The following list introduces variables you can use to prevent packages -from being installed into your image. Each of these variables only works -with IPK and RPM package types, not for Debian packages. -Also, you can use these variables from your ``local.conf`` file -or attach them to a specific image recipe by using a recipe name -override. For more detail on the variables, see the descriptions in the -Yocto Project Reference Manual's glossary chapter. - -- :term:`BAD_RECOMMENDATIONS`: - Use this variable to specify "recommended-only" packages that you do - not want installed. - -- :term:`NO_RECOMMENDATIONS`: - Use this variable to prevent all "recommended-only" packages from - being installed. - -- :term:`PACKAGE_EXCLUDE`: - Use this variable to prevent specific packages from being installed - regardless of whether they are "recommended-only" or not. You need to - realize that the build process could fail with an error when you - prevent the installation of a package whose presence is required by - an installed package. - -Incrementing a Package Version ------------------------------- - -This section provides some background on how binary package versioning -is accomplished and presents some of the services, variables, and -terminology involved. - -In order to understand binary package versioning, you need to consider -the following: - -- Binary Package: The binary package that is eventually built and - installed into an image. - -- Binary Package Version: The binary package version is composed of two - components --- a version and a revision. - - .. note:: - - Technically, a third component, the "epoch" (i.e. :term:`PE`) is involved - but this discussion for the most part ignores :term:`PE`. - - The version and revision are taken from the - :term:`PV` and - :term:`PR` variables, respectively. - -- :term:`PV`: The recipe version. :term:`PV` represents the version of the - software being packaged. Do not confuse :term:`PV` with the binary - package version. - -- :term:`PR`: The recipe revision. - -- :term:`SRCPV`: The OpenEmbedded - build system uses this string to help define the value of :term:`PV` when - the source code revision needs to be included in it. - -- :yocto_wiki:`PR Service `: A - network-based service that helps automate keeping package feeds - compatible with existing package manager applications such as RPM, - APT, and OPKG. - -Whenever the binary package content changes, the binary package version -must change. Changing the binary package version is accomplished by -changing or "bumping" the :term:`PR` and/or :term:`PV` values. Increasing these -values occurs one of two ways: - -- Automatically using a Package Revision Service (PR Service). - -- Manually incrementing the :term:`PR` and/or :term:`PV` variables. - -Given a primary challenge of any build system and its users is how to -maintain a package feed that is compatible with existing package manager -applications such as RPM, APT, and OPKG, using an automated system is -much preferred over a manual system. In either system, the main -requirement is that binary package version numbering increases in a -linear fashion and that there is a number of version components that -support that linear progression. For information on how to ensure -package revisioning remains linear, see the -":ref:`dev-manual/common-tasks:automatically incrementing a package version number`" -section. - -The following three sections provide related information on the PR -Service, the manual method for "bumping" :term:`PR` and/or :term:`PV`, and on -how to ensure binary package revisioning remains linear. - -Working With a PR Service -~~~~~~~~~~~~~~~~~~~~~~~~~ - -As mentioned, attempting to maintain revision numbers in the -:term:`Metadata` is error prone, inaccurate, -and causes problems for people submitting recipes. Conversely, the PR -Service automatically generates increasing numbers, particularly the -revision field, which removes the human element. - -.. note:: - - For additional information on using a PR Service, you can see the - :yocto_wiki:`PR Service ` wiki page. - -The Yocto Project uses variables in order of decreasing priority to -facilitate revision numbering (i.e. -:term:`PE`, -:term:`PV`, and -:term:`PR` for epoch, version, and -revision, respectively). The values are highly dependent on the policies -and procedures of a given distribution and package feed. - -Because the OpenEmbedded build system uses -":ref:`signatures `", which are -unique to a given build, the build system knows when to rebuild -packages. All the inputs into a given task are represented by a -signature, which can trigger a rebuild when different. Thus, the build -system itself does not rely on the :term:`PR`, :term:`PV`, and :term:`PE` numbers to -trigger a rebuild. The signatures, however, can be used to generate -these values. - -The PR Service works with both ``OEBasic`` and ``OEBasicHash`` -generators. The value of :term:`PR` bumps when the checksum changes and the -different generator mechanisms change signatures under different -circumstances. - -As implemented, the build system includes values from the PR Service -into the :term:`PR` field as an addition using the form "``.x``" so ``r0`` -becomes ``r0.1``, ``r0.2`` and so forth. This scheme allows existing -:term:`PR` values to be used for whatever reasons, which include manual -:term:`PR` bumps, should it be necessary. - -By default, the PR Service is not enabled or running. Thus, the packages -generated are just "self consistent". The build system adds and removes -packages and there are no guarantees about upgrade paths but images will -be consistent and correct with the latest changes. - -The simplest form for a PR Service is for a single host development system -that builds the package feed (building system). For this scenario, you can -enable a local PR Service by setting :term:`PRSERV_HOST` in your -``local.conf`` file in the :term:`Build Directory`:: - - PRSERV_HOST = "localhost:0" - -Once the service is started, packages will automatically -get increasing :term:`PR` values and BitBake takes care of starting and -stopping the server. - -If you have a more complex setup where multiple host development systems -work against a common, shared package feed, you have a single PR Service -running and it is connected to each building system. For this scenario, -you need to start the PR Service using the ``bitbake-prserv`` command:: - - bitbake-prserv --host ip --port port --start - -In addition to -hand-starting the service, you need to update the ``local.conf`` file of -each building system as described earlier so each system points to the -server and port. - -It is also recommended you use build history, which adds some sanity -checks to binary package versions, in conjunction with the server that -is running the PR Service. To enable build history, add the following to -each building system's ``local.conf`` file:: - - # It is recommended to activate "buildhistory" for testing the PR service - INHERIT += "buildhistory" - BUILDHISTORY_COMMIT = "1" - -For information on build -history, see the -":ref:`dev-manual/common-tasks:maintaining build output quality`" section. - -.. note:: - - The OpenEmbedded build system does not maintain :term:`PR` information as - part of the shared state (sstate) packages. If you maintain an sstate - feed, it's expected that either all your building systems that - contribute to the sstate feed use a shared PR Service, or you do not - run a PR Service on any of your building systems. Having some systems - use a PR Service while others do not leads to obvious problems. - - For more information on shared state, see the - ":ref:`overview-manual/concepts:shared state cache`" - section in the Yocto Project Overview and Concepts Manual. - -Manually Bumping PR -~~~~~~~~~~~~~~~~~~~ - -The alternative to setting up a PR Service is to manually "bump" the -:term:`PR` variable. - -If a committed change results in changing the package output, then the -value of the PR variable needs to be increased (or "bumped") as part of -that commit. For new recipes you should add the :term:`PR` variable and set -its initial value equal to "r0", which is the default. Even though the -default value is "r0", the practice of adding it to a new recipe makes -it harder to forget to bump the variable when you make changes to the -recipe in future. - -If you are sharing a common ``.inc`` file with multiple recipes, you can -also use the :term:`INC_PR` variable to ensure that the recipes sharing the -``.inc`` file are rebuilt when the ``.inc`` file itself is changed. The -``.inc`` file must set :term:`INC_PR` (initially to "r0"), and all recipes -referring to it should set :term:`PR` to "${INC_PR}.0" initially, -incrementing the last number when the recipe is changed. If the ``.inc`` -file is changed then its :term:`INC_PR` should be incremented. - -When upgrading the version of a binary package, assuming the :term:`PV` -changes, the :term:`PR` variable should be reset to "r0" (or "${INC_PR}.0" -if you are using :term:`INC_PR`). - -Usually, version increases occur only to binary packages. However, if -for some reason :term:`PV` changes but does not increase, you can increase -the :term:`PE` variable (Package Epoch). The :term:`PE` variable defaults to -"0". - -Binary package version numbering strives to follow the `Debian Version -Field Policy -Guidelines `__. -These guidelines define how versions are compared and what "increasing" -a version means. - -Automatically Incrementing a Package Version Number -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -When fetching a repository, BitBake uses the -:term:`SRCREV` variable to determine -the specific source code revision from which to build. You set the -:term:`SRCREV` variable to -:term:`AUTOREV` to cause the -OpenEmbedded build system to automatically use the latest revision of -the software:: - - SRCREV = "${AUTOREV}" - -Furthermore, you need to reference :term:`SRCPV` in :term:`PV` in order to -automatically update the version whenever the revision of the source -code changes. Here is an example:: - - PV = "1.0+git${SRCPV}" - -The OpenEmbedded build system substitutes :term:`SRCPV` with the following: - -.. code-block:: none - - AUTOINC+source_code_revision - -The build system replaces the ``AUTOINC`` -with a number. The number used depends on the state of the PR Service: - -- If PR Service is enabled, the build system increments the number, - which is similar to the behavior of - :term:`PR`. This behavior results in - linearly increasing package versions, which is desirable. Here is an - example: - - .. code-block:: none - - hello-world-git_0.0+git0+b6558dd387-r0.0_armv7a-neon.ipk - hello-world-git_0.0+git1+dd2f5c3565-r0.0_armv7a-neon.ipk - -- If PR Service is not enabled, the build system replaces the - ``AUTOINC`` placeholder with zero (i.e. "0"). This results in - changing the package version since the source revision is included. - However, package versions are not increased linearly. Here is an - example: - - .. code-block:: none - - hello-world-git_0.0+git0+b6558dd387-r0.0_armv7a-neon.ipk - hello-world-git_0.0+git0+dd2f5c3565-r0.0_armv7a-neon.ipk - -In summary, the OpenEmbedded build system does not track the history of -binary package versions for this purpose. ``AUTOINC``, in this case, is -comparable to :term:`PR`. If PR server is not enabled, ``AUTOINC`` in the -package version is simply replaced by "0". If PR server is enabled, the -build system keeps track of the package versions and bumps the number -when the package revision changes. - -Handling Optional Module Packaging ----------------------------------- - -Many pieces of software split functionality into optional modules (or -plugins) and the plugins that are built might depend on configuration -options. To avoid having to duplicate the logic that determines what -modules are available in your recipe or to avoid having to package each -module by hand, the OpenEmbedded build system provides functionality to -handle module packaging dynamically. - -To handle optional module packaging, you need to do two things: - -- Ensure the module packaging is actually done. - -- Ensure that any dependencies on optional modules from other recipes - are satisfied by your recipe. - -Making Sure the Packaging is Done -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To ensure the module packaging actually gets done, you use the -``do_split_packages`` function within the ``populate_packages`` Python -function in your recipe. The ``do_split_packages`` function searches for -a pattern of files or directories under a specified path and creates a -package for each one it finds by appending to the -:term:`PACKAGES` variable and -setting the appropriate values for ``FILES:packagename``, -``RDEPENDS:packagename``, ``DESCRIPTION:packagename``, and so forth. -Here is an example from the ``lighttpd`` recipe:: - - python populate_packages:prepend () { - lighttpd_libdir = d.expand('${libdir}') - do_split_packages(d, lighttpd_libdir, '^mod_(.*).so$', - 'lighttpd-module-%s', 'Lighttpd module for %s', - extra_depends='') - } - -The previous example specifies a number of things in the call to -``do_split_packages``. - -- A directory within the files installed by your recipe through - :ref:`ref-tasks-install` in which to search. - -- A regular expression used to match module files in that directory. In - the example, note the parentheses () that mark the part of the - expression from which the module name should be derived. - -- A pattern to use for the package names. - -- A description for each package. - -- An empty string for ``extra_depends``, which disables the default - dependency on the main ``lighttpd`` package. Thus, if a file in - ``${libdir}`` called ``mod_alias.so`` is found, a package called - ``lighttpd-module-alias`` is created for it and the - :term:`DESCRIPTION` is set to - "Lighttpd module for alias". - -Often, packaging modules is as simple as the previous example. However, -there are more advanced options that you can use within -``do_split_packages`` to modify its behavior. And, if you need to, you -can add more logic by specifying a hook function that is called for each -package. It is also perfectly acceptable to call ``do_split_packages`` -multiple times if you have more than one set of modules to package. - -For more examples that show how to use ``do_split_packages``, see the -``connman.inc`` file in the ``meta/recipes-connectivity/connman/`` -directory of the ``poky`` :ref:`source repository `. You can -also find examples in ``meta/classes-recipe/kernel.bbclass``. - -Following is a reference that shows ``do_split_packages`` mandatory and -optional arguments:: - - Mandatory arguments - - root - The path in which to search - file_regex - Regular expression to match searched files. - Use parentheses () to mark the part of this - expression that should be used to derive the - module name (to be substituted where %s is - used in other function arguments as noted below) - output_pattern - Pattern to use for the package names. Must - include %s. - description - Description to set for each package. Must - include %s. - - Optional arguments - - postinst - Postinstall script to use for all packages - (as a string) - recursive - True to perform a recursive search --- default - False - hook - A hook function to be called for every match. - The function will be called with the following - arguments (in the order listed): - - f - Full path to the file/directory match - pkg - The package name - file_regex - As above - output_pattern - As above - modulename - The module name derived using file_regex - extra_depends - Extra runtime dependencies (RDEPENDS) to be - set for all packages. The default value of None - causes a dependency on the main package - (${PN}) --- if you do not want this, pass empty - string '' for this parameter. - aux_files_pattern - Extra item(s) to be added to FILES for each - package. Can be a single string item or a list - of strings for multiple items. Must include %s. - postrm - postrm script to use for all packages (as a - string) - allow_dirs - True to allow directories to be matched - - default False - prepend - If True, prepend created packages to PACKAGES - instead of the default False which appends them - match_path - match file_regex on the whole relative path to - the root rather than just the filename - aux_files_pattern_verbatim - Extra item(s) to be added to FILES for each - package, using the actual derived module name - rather than converting it to something legal - for a package name. Can be a single string item - or a list of strings for multiple items. Must - include %s. - allow_links - True to allow symlinks to be matched --- default - False - summary - Summary to set for each package. Must include %s; - defaults to description if not set. - - - -Satisfying Dependencies -~~~~~~~~~~~~~~~~~~~~~~~ - -The second part for handling optional module packaging is to ensure that -any dependencies on optional modules from other recipes are satisfied by -your recipe. You can be sure these dependencies are satisfied by using -the :term:`PACKAGES_DYNAMIC` -variable. Here is an example that continues with the ``lighttpd`` recipe -shown earlier:: - - PACKAGES_DYNAMIC = "lighttpd-module-.*" - -The name -specified in the regular expression can of course be anything. In this -example, it is ``lighttpd-module-`` and is specified as the prefix to -ensure that any :term:`RDEPENDS` and -:term:`RRECOMMENDS` on a package -name starting with the prefix are satisfied during build time. If you -are using ``do_split_packages`` as described in the previous section, -the value you put in :term:`PACKAGES_DYNAMIC` should correspond to the name -pattern specified in the call to ``do_split_packages``. - -Using Runtime Package Management --------------------------------- - -During a build, BitBake always transforms a recipe into one or more -packages. For example, BitBake takes the ``bash`` recipe and produces a -number of packages (e.g. ``bash``, ``bash-bashbug``, -``bash-completion``, ``bash-completion-dbg``, ``bash-completion-dev``, -``bash-completion-extra``, ``bash-dbg``, and so forth). Not all -generated packages are included in an image. - -In several situations, you might need to update, add, remove, or query -the packages on a target device at runtime (i.e. without having to -generate a new image). Examples of such situations include: - -- You want to provide in-the-field updates to deployed devices (e.g. - security updates). - -- You want to have a fast turn-around development cycle for one or more - applications that run on your device. - -- You want to temporarily install the "debug" packages of various - applications on your device so that debugging can be greatly improved - by allowing access to symbols and source debugging. - -- You want to deploy a more minimal package selection of your device - but allow in-the-field updates to add a larger selection for - customization. - -In all these situations, you have something similar to a more -traditional Linux distribution in that in-field devices are able to -receive pre-compiled packages from a server for installation or update. -Being able to install these packages on a running, in-field device is -what is termed "runtime package management". - -In order to use runtime package management, you need a host or server -machine that serves up the pre-compiled packages plus the required -metadata. You also need package manipulation tools on the target. The -build machine is a likely candidate to act as the server. However, that -machine does not necessarily have to be the package server. The build -machine could push its artifacts to another machine that acts as the -server (e.g. Internet-facing). In fact, doing so is advantageous for a -production environment as getting the packages away from the development -system's :term:`Build Directory` prevents accidental overwrites. - -A simple build that targets just one device produces more than one -package database. In other words, the packages produced by a build are -separated out into a couple of different package groupings based on -criteria such as the target's CPU architecture, the target board, or the -C library used on the target. For example, a build targeting the -``qemux86`` device produces the following three package databases: -``noarch``, ``i586``, and ``qemux86``. If you wanted your ``qemux86`` -device to be aware of all the packages that were available to it, you -would need to point it to each of these databases individually. In a -similar way, a traditional Linux distribution usually is configured to -be aware of a number of software repositories from which it retrieves -packages. - -Using runtime package management is completely optional and not required -for a successful build or deployment in any way. But if you want to make -use of runtime package management, you need to do a couple things above -and beyond the basics. The remainder of this section describes what you -need to do. - -Build Considerations -~~~~~~~~~~~~~~~~~~~~ - -This section describes build considerations of which you need to be -aware in order to provide support for runtime package management. - -When BitBake generates packages, it needs to know what format or formats -to use. In your configuration, you use the -:term:`PACKAGE_CLASSES` -variable to specify the format: - -1. Open the ``local.conf`` file inside your :term:`Build Directory` (e.g. - ``poky/build/conf/local.conf``). - -2. Select the desired package format as follows:: - - PACKAGE_CLASSES ?= "package_packageformat" - - where packageformat can be "ipk", "rpm", - "deb", or "tar" which are the supported package formats. - - .. note:: - - Because the Yocto Project supports four different package formats, - you can set the variable with more than one argument. However, the - OpenEmbedded build system only uses the first argument when - creating an image or Software Development Kit (SDK). - -If you would like your image to start off with a basic package database -containing the packages in your current build as well as to have the -relevant tools available on the target for runtime package management, -you can include "package-management" in the -:term:`IMAGE_FEATURES` -variable. Including "package-management" in this configuration variable -ensures that when the image is assembled for your target, the image -includes the currently-known package databases as well as the -target-specific tools required for runtime package management to be -performed on the target. However, this is not strictly necessary. You -could start your image off without any databases but only include the -required on-target package tool(s). As an example, you could include -"opkg" in your -:term:`IMAGE_INSTALL` variable -if you are using the IPK package format. You can then initialize your -target's package database(s) later once your image is up and running. - -Whenever you perform any sort of build step that can potentially -generate a package or modify existing package, it is always a good idea -to re-generate the package index after the build by using the following -command:: - - $ bitbake package-index - -It might be tempting to build the -package and the package index at the same time with a command such as -the following:: - - $ bitbake some-package package-index - -Do not do this as -BitBake does not schedule the package index for after the completion of -the package you are building. Consequently, you cannot be sure of the -package index including information for the package you just built. -Thus, be sure to run the package update step separately after building -any packages. - -You can use the -:term:`PACKAGE_FEED_ARCHS`, -:term:`PACKAGE_FEED_BASE_PATHS`, -and -:term:`PACKAGE_FEED_URIS` -variables to pre-configure target images to use a package feed. If you -do not define these variables, then manual steps as described in the -subsequent sections are necessary to configure the target. You should -set these variables before building the image in order to produce a -correctly configured image. - -When your build is complete, your packages reside in the -``${TMPDIR}/deploy/packageformat`` directory. For example, if -``${``\ :term:`TMPDIR`\ ``}`` is -``tmp`` and your selected package type is RPM, then your RPM packages -are available in ``tmp/deploy/rpm``. - -Host or Server Machine Setup -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Although other protocols are possible, a server using HTTP typically -serves packages. If you want to use HTTP, then set up and configure a -web server such as Apache 2, lighttpd, or Python web server on the -machine serving the packages. - -To keep things simple, this section describes how to set up a -Python web server to share package feeds from the developer's -machine. Although this server might not be the best for a production -environment, the setup is simple and straight forward. Should you want -to use a different server more suited for production (e.g. Apache 2, -Lighttpd, or Nginx), take the appropriate steps to do so. - -From within the :term:`Build Directory` where you have built an image based on -your packaging choice (i.e. the :term:`PACKAGE_CLASSES` setting), simply start -the server. The following example assumes a :term:`Build Directory` of ``poky/build`` -and a :term:`PACKAGE_CLASSES` setting of "package_rpm":: - - $ cd poky/build/tmp/deploy/rpm - $ python3 -m http.server - -Target Setup -~~~~~~~~~~~~ - -Setting up the target differs depending on the package management -system. This section provides information for RPM, IPK, and DEB. - -Using RPM -^^^^^^^^^ - -The :wikipedia:`Dandified Packaging ` (DNF) performs -runtime package management of RPM packages. In order to use DNF for -runtime package management, you must perform an initial setup on the -target machine for cases where the ``PACKAGE_FEED_*`` variables were not -set as part of the image that is running on the target. This means if -you built your image and did not use these variables as part of the -build and your image is now running on the target, you need to perform -the steps in this section if you want to use runtime package management. - -.. note:: - - For information on the ``PACKAGE_FEED_*`` variables, see - :term:`PACKAGE_FEED_ARCHS`, :term:`PACKAGE_FEED_BASE_PATHS`, and - :term:`PACKAGE_FEED_URIS` in the Yocto Project Reference Manual variables - glossary. - -On the target, you must inform DNF that package databases are available. -You do this by creating a file named -``/etc/yum.repos.d/oe-packages.repo`` and defining the ``oe-packages``. - -As an example, assume the target is able to use the following package -databases: ``all``, ``i586``, and ``qemux86`` from a server named -``my.server``. The specifics for setting up the web server are up to -you. The critical requirement is that the URIs in the target repository -configuration point to the correct remote location for the feeds. - -.. note:: - - For development purposes, you can point the web server to the build - system's ``deploy`` directory. However, for production use, it is better to - copy the package directories to a location outside of the build area and use - that location. Doing so avoids situations where the build system - overwrites or changes the ``deploy`` directory. - -When telling DNF where to look for the package databases, you must -declare individual locations per architecture or a single location used -for all architectures. You cannot do both: - -- *Create an Explicit List of Architectures:* Define individual base - URLs to identify where each package database is located: - - .. code-block:: none - - [oe-packages] - baseurl=http://my.server/rpm/i586 http://my.server/rpm/qemux86 http://my.server/rpm/all - - This example - informs DNF about individual package databases for all three - architectures. - -- *Create a Single (Full) Package Index:* Define a single base URL that - identifies where a full package database is located:: - - [oe-packages] - baseurl=http://my.server/rpm - - This example informs DNF about a single - package database that contains all the package index information for - all supported architectures. - -Once you have informed DNF where to find the package databases, you need -to fetch them: - -.. code-block:: none - - # dnf makecache - -DNF is now able to find, install, and -upgrade packages from the specified repository or repositories. - -.. note:: - - See the `DNF documentation `__ for - additional information. - -Using IPK -^^^^^^^^^ - -The ``opkg`` application performs runtime package management of IPK -packages. You must perform an initial setup for ``opkg`` on the target -machine if the -:term:`PACKAGE_FEED_ARCHS`, -:term:`PACKAGE_FEED_BASE_PATHS`, -and -:term:`PACKAGE_FEED_URIS` -variables have not been set or the target image was built before the -variables were set. - -The ``opkg`` application uses configuration files to find available -package databases. Thus, you need to create a configuration file inside -the ``/etc/opkg/`` directory, which informs ``opkg`` of any repository -you want to use. - -As an example, suppose you are serving packages from a ``ipk/`` -directory containing the ``i586``, ``all``, and ``qemux86`` databases -through an HTTP server named ``my.server``. On the target, create a -configuration file (e.g. ``my_repo.conf``) inside the ``/etc/opkg/`` -directory containing the following: - -.. code-block:: none - - src/gz all http://my.server/ipk/all - src/gz i586 http://my.server/ipk/i586 - src/gz qemux86 http://my.server/ipk/qemux86 - -Next, instruct ``opkg`` to fetch the -repository information: - -.. code-block:: none - - # opkg update - -The ``opkg`` application is now able to find, install, and upgrade packages -from the specified repository. - -Using DEB -^^^^^^^^^ - -The ``apt`` application performs runtime package management of DEB -packages. This application uses a source list file to find available -package databases. You must perform an initial setup for ``apt`` on the -target machine if the -:term:`PACKAGE_FEED_ARCHS`, -:term:`PACKAGE_FEED_BASE_PATHS`, -and -:term:`PACKAGE_FEED_URIS` -variables have not been set or the target image was built before the -variables were set. - -To inform ``apt`` of the repository you want to use, you might create a -list file (e.g. ``my_repo.list``) inside the -``/etc/apt/sources.list.d/`` directory. As an example, suppose you are -serving packages from a ``deb/`` directory containing the ``i586``, -``all``, and ``qemux86`` databases through an HTTP server named -``my.server``. The list file should contain: - -.. code-block:: none - - deb http://my.server/deb/all ./ - deb http://my.server/deb/i586 ./ - deb http://my.server/deb/qemux86 ./ - -Next, instruct the ``apt`` application -to fetch the repository information: - -.. code-block:: none - - $ sudo apt update - -After this step, -``apt`` is able to find, install, and upgrade packages from the -specified repository. - -Generating and Using Signed Packages ------------------------------------- - -In order to add security to RPM packages used during a build, you can -take steps to securely sign them. Once a signature is verified, the -OpenEmbedded build system can use the package in the build. If security -fails for a signed package, the build system stops the build. - -This section describes how to sign RPM packages during a build and how -to use signed package feeds (repositories) when doing a build. - -Signing RPM Packages -~~~~~~~~~~~~~~~~~~~~ - -To enable signing RPM packages, you must set up the following -configurations in either your ``local.config`` or ``distro.config`` -file:: - - # Inherit sign_rpm.bbclass to enable signing functionality - INHERIT += " sign_rpm" - # Define the GPG key that will be used for signing. - RPM_GPG_NAME = "key_name" - # Provide passphrase for the key - RPM_GPG_PASSPHRASE = "passphrase" - -.. note:: - - Be sure to supply appropriate values for both `key_name` and - `passphrase`. - -Aside from the ``RPM_GPG_NAME`` and ``RPM_GPG_PASSPHRASE`` variables in -the previous example, two optional variables related to signing are available: - -- *GPG_BIN:* Specifies a ``gpg`` binary/wrapper that is executed - when the package is signed. - -- *GPG_PATH:* Specifies the ``gpg`` home directory used when the - package is signed. - -Processing Package Feeds -~~~~~~~~~~~~~~~~~~~~~~~~ - -In addition to being able to sign RPM packages, you can also enable -signed package feeds for IPK and RPM packages. - -The steps you need to take to enable signed package feed use are similar -to the steps used to sign RPM packages. You must define the following in -your ``local.config`` or ``distro.config`` file:: - - INHERIT += "sign_package_feed" - PACKAGE_FEED_GPG_NAME = "key_name" - PACKAGE_FEED_GPG_PASSPHRASE_FILE = "path_to_file_containing_passphrase" - -For signed package feeds, the passphrase must be specified in a separate file, -which is pointed to by the ``PACKAGE_FEED_GPG_PASSPHRASE_FILE`` -variable. Regarding security, keeping a plain text passphrase out of the -configuration is more secure. - -Aside from the ``PACKAGE_FEED_GPG_NAME`` and -``PACKAGE_FEED_GPG_PASSPHRASE_FILE`` variables, three optional variables -related to signed package feeds are available: - -- *GPG_BIN* Specifies a ``gpg`` binary/wrapper that is executed - when the package is signed. - -- *GPG_PATH:* Specifies the ``gpg`` home directory used when the - package is signed. - -- *PACKAGE_FEED_GPG_SIGNATURE_TYPE:* Specifies the type of ``gpg`` - signature. This variable applies only to RPM and IPK package feeds. - Allowable values for the ``PACKAGE_FEED_GPG_SIGNATURE_TYPE`` are - "ASC", which is the default and specifies ascii armored, and "BIN", - which specifies binary. - -Testing Packages With ptest ---------------------------- - -A Package Test (ptest) runs tests against packages built by the -OpenEmbedded build system on the target machine. A ptest contains at -least two items: the actual test, and a shell script (``run-ptest``) -that starts the test. The shell script that starts the test must not -contain the actual test --- the script only starts the test. On the other -hand, the test can be anything from a simple shell script that runs a -binary and checks the output to an elaborate system of test binaries and -data files. - -The test generates output in the format used by Automake:: - - result: testname - -where the result can be ``PASS``, ``FAIL``, or ``SKIP``, and -the testname can be any identifying string. - -For a list of Yocto Project recipes that are already enabled with ptest, -see the :yocto_wiki:`Ptest ` wiki page. - -.. note:: - - A recipe is "ptest-enabled" if it inherits the - :ref:`ptest ` class. - -Adding ptest to Your Build -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To add package testing to your build, add the :term:`DISTRO_FEATURES` and -:term:`EXTRA_IMAGE_FEATURES` variables to your ``local.conf`` file, which -is found in the :term:`Build Directory`:: - - DISTRO_FEATURES:append = " ptest" - EXTRA_IMAGE_FEATURES += "ptest-pkgs" - -Once your build is complete, the ptest files are installed into the -``/usr/lib/package/ptest`` directory within the image, where ``package`` -is the name of the package. - -Running ptest -~~~~~~~~~~~~~ - -The ``ptest-runner`` package installs a shell script that loops through -all installed ptest test suites and runs them in sequence. Consequently, -you might want to add this package to your image. - -Getting Your Package Ready -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In order to enable a recipe to run installed ptests on target hardware, -you need to prepare the recipes that build the packages you want to -test. Here is what you have to do for each recipe: - -- *Be sure the recipe inherits - the* :ref:`ptest ` *class:* - Include the following line in each recipe:: - - inherit ptest - -- *Create run-ptest:* This script starts your test. Locate the - script where you will refer to it using - :term:`SRC_URI`. Here is an - example that starts a test for ``dbus``:: - - #!/bin/sh - cd test - make -k runtest-TESTS - -- *Ensure dependencies are met:* If the test adds build or runtime - dependencies that normally do not exist for the package (such as - requiring "make" to run the test suite), use the - :term:`DEPENDS` and - :term:`RDEPENDS` variables in - your recipe in order for the package to meet the dependencies. Here - is an example where the package has a runtime dependency on "make":: - - RDEPENDS:${PN}-ptest += "make" - -- *Add a function to build the test suite:* Not many packages support - cross-compilation of their test suites. Consequently, you usually - need to add a cross-compilation function to the package. - - Many packages based on Automake compile and run the test suite by - using a single command such as ``make check``. However, the host - ``make check`` builds and runs on the same computer, while - cross-compiling requires that the package is built on the host but - executed for the target architecture (though often, as in the case - for ptest, the execution occurs on the host). The built version of - Automake that ships with the Yocto Project includes a patch that - separates building and execution. Consequently, packages that use the - unaltered, patched version of ``make check`` automatically - cross-compiles. - - Regardless, you still must add a ``do_compile_ptest`` function to - build the test suite. Add a function similar to the following to your - recipe:: - - do_compile_ptest() { - oe_runmake buildtest-TESTS - } - -- *Ensure special configurations are set:* If the package requires - special configurations prior to compiling the test code, you must - insert a ``do_configure_ptest`` function into the recipe. - -- *Install the test suite:* The ``ptest`` class automatically copies - the file ``run-ptest`` to the target and then runs make - ``install-ptest`` to run the tests. If this is not enough, you need - to create a ``do_install_ptest`` function and make sure it gets - called after the "make install-ptest" completes. - -Creating Node Package Manager (NPM) Packages --------------------------------------------- - -:wikipedia:`NPM ` is a package -manager for the JavaScript programming language. The Yocto Project -supports the NPM :ref:`fetcher `. You can -use this fetcher in combination with -:doc:`devtool ` to create -recipes that produce NPM packages. - -There are two workflows that allow you to create NPM packages using -``devtool``: the NPM registry modules method and the NPM project code -method. - -.. note:: - - While it is possible to create NPM recipes manually, using - ``devtool`` is far simpler. - -Additionally, some requirements and caveats exist. - -Requirements and Caveats -~~~~~~~~~~~~~~~~~~~~~~~~ - -You need to be aware of the following before using ``devtool`` to create -NPM packages: - -- Of the two methods that you can use ``devtool`` to create NPM - packages, the registry approach is slightly simpler. However, you - might consider the project approach because you do not have to - publish your module in the `NPM registry `__, - which is NPM's public registry. - -- Be familiar with - :doc:`devtool `. - -- The NPM host tools need the native ``nodejs-npm`` package, which is - part of the OpenEmbedded environment. You need to get the package by - cloning the :oe_git:`meta-openembedded ` - repository. Be sure to add the path to your local copy - to your ``bblayers.conf`` file. - -- ``devtool`` cannot detect native libraries in module dependencies. - Consequently, you must manually add packages to your recipe. - -- While deploying NPM packages, ``devtool`` cannot determine which - dependent packages are missing on the target (e.g. the node runtime - ``nodejs``). Consequently, you need to find out what files are - missing and be sure they are on the target. - -- Although you might not need NPM to run your node package, it is - useful to have NPM on your target. The NPM package name is - ``nodejs-npm``. - -Using the Registry Modules Method -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This section presents an example that uses the ``cute-files`` module, -which is a file browser web application. - -.. note:: - - You must know the ``cute-files`` module version. - -The first thing you need to do is use ``devtool`` and the NPM fetcher to -create the recipe:: - - $ devtool add "npm://registry.npmjs.org;package=cute-files;version=1.0.2" - -The -``devtool add`` command runs ``recipetool create`` and uses the same -fetch URI to download each dependency and capture license details where -possible. The result is a generated recipe. - -After running for quite a long time, in particular building the -``nodejs-native`` package, the command should end as follows:: - - INFO: Recipe /home/.../build/workspace/recipes/cute-files/cute-files_1.0.2.bb has been automatically created; further editing may be required to make it fully functional - -The recipe file is fairly simple and contains every license that -``recipetool`` finds and includes the licenses in the recipe's -:term:`LIC_FILES_CHKSUM` -variables. You need to examine the variables and look for those with -"unknown" in the :term:`LICENSE` -field. You need to track down the license information for "unknown" -modules and manually add the information to the recipe. - -``recipetool`` creates a "shrinkwrap" file for your recipe. Shrinkwrap -files capture the version of all dependent modules. Many packages do not -provide shrinkwrap files but ``recipetool`` will create a shrinkwrap file as it -runs. - -.. note:: - - A package is created for each sub-module. This policy is the only - practical way to have the licenses for all of the dependencies - represented in the license manifest of the image. - -The ``devtool edit-recipe`` command lets you take a look at the recipe:: - - $ devtool edit-recipe cute-files - # Recipe created by recipetool - # This is the basis of a recipe and may need further editing in order to be fully functional. - # (Feel free to remove these comments when editing.) - - SUMMARY = "Turn any folder on your computer into a cute file browser, available on the local network." - # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is - # your responsibility to verify that the values are complete and correct. - # - # NOTE: multiple licenses have been detected; they have been separated with & - # in the LICENSE value for now since it is a reasonable assumption that all - # of the licenses apply. If instead there is a choice between the multiple - # licenses then you should change the value to separate the licenses with | - # instead of &. If there is any doubt, check the accompanying documentation - # to determine which situation is applicable. - - SUMMARY = "Turn any folder on your computer into a cute file browser, available on the local network." - LICENSE = "BSD-3-Clause & ISC & MIT" - LIC_FILES_CHKSUM = "file://LICENSE;md5=71d98c0a1db42956787b1909c74a86ca \ - file://node_modules/accepts/LICENSE;md5=bf1f9ad1e2e1d507aef4883fff7103de \ - file://node_modules/array-flatten/LICENSE;md5=44088ba57cb871a58add36ce51b8de08 \ - ... - file://node_modules/cookie-signature/Readme.md;md5=57ae8b42de3dd0c1f22d5f4cf191e15a" - - SRC_URI = " \ - npm://registry.npmjs.org/;package=cute-files;version=${PV} \ - npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ - " - - S = "${WORKDIR}/npm" - - inherit npm - - LICENSE:${PN} = "MIT" - LICENSE:${PN}-accepts = "MIT" - LICENSE:${PN}-array-flatten = "MIT" - ... - LICENSE:${PN}-vary = "MIT" - -Here are three key points in the previous example: - -- :term:`SRC_URI` uses the NPM - scheme so that the NPM fetcher is used. - -- ``recipetool`` collects all the license information. If a - sub-module's license is unavailable, the sub-module's name appears in - the comments. - -- The ``inherit npm`` statement causes the - :ref:`npm ` class to package - up all the modules. - -You can run the following command to build the ``cute-files`` package:: - - $ devtool build cute-files - -Remember that ``nodejs`` must be installed on -the target before your package. - -Assuming 192.168.7.2 for the target's IP address, use the following -command to deploy your package:: - - $ devtool deploy-target -s cute-files root@192.168.7.2 - -Once the package is installed on the target, you can -test the application to show the contents of any directory:: - - $ cd /usr/lib/node_modules/cute-files - $ cute-files - -On a browser, -go to ``http://192.168.7.2:3000`` and you see the following: - -.. image:: figures/cute-files-npm-example.png - :width: 100% - -You can find the recipe in ``workspace/recipes/cute-files``. You can use -the recipe in any layer you choose. - -Using the NPM Projects Code Method -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Although it is useful to package modules already in the NPM registry, -adding ``node.js`` projects under development is a more common developer -use case. - -This section covers the NPM projects code method, which is very similar -to the "registry" approach described in the previous section. In the NPM -projects method, you provide ``devtool`` with an URL that points to the -source files. - -Replicating the same example, (i.e. ``cute-files``) use the following -command:: - - $ devtool add https://github.com/martinaglv/cute-files.git - -The recipe this command generates is very similar to the recipe created in -the previous section. However, the :term:`SRC_URI` looks like the following:: - - SRC_URI = " \ - git://github.com/martinaglv/cute-files.git;protocol=https;branch=master \ - npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ - " - -In this example, -the main module is taken from the Git repository and dependencies are -taken from the NPM registry. Other than those differences, the recipe is -basically the same between the two methods. You can build and deploy the -package exactly as described in the previous section that uses the -registry modules method. - -Adding custom metadata to packages ----------------------------------- - -The variable -:term:`PACKAGE_ADD_METADATA` -can be used to add additional metadata to packages. This is reflected in -the package control/spec file. To take the ipk format for example, the -CONTROL file stored inside would contain the additional metadata as -additional lines. - -The variable can be used in multiple ways, including using suffixes to -set it for a specific package type and/or package. Note that the order -of precedence is the same as this list: - -- ``PACKAGE_ADD_METADATA_:`` - -- ``PACKAGE_ADD_METADATA_`` - -- ``PACKAGE_ADD_METADATA:`` - -- :term:`PACKAGE_ADD_METADATA` - -`` is a parameter and expected to be a distinct name of specific -package type: - -- IPK for .ipk packages - -- DEB for .deb packages - -- RPM for .rpm packages - -`` is a parameter and expected to be a package name. - -The variable can contain multiple [one-line] metadata fields separated -by the literal sequence '\\n'. The separator can be redefined using the -variable flag ``separator``. - -Here is an example that adds two custom fields for ipk -packages:: - - PACKAGE_ADD_METADATA_IPK = "Vendor: CustomIpk\nGroup:Applications/Spreadsheets" - -Efficiently Fetching Source Files During a Build -================================================ - -The OpenEmbedded build system works with source files located through -the :term:`SRC_URI` variable. When -you build something using BitBake, a big part of the operation is -locating and downloading all the source tarballs. For images, -downloading all the source for various packages can take a significant -amount of time. - -This section shows you how you can use mirrors to speed up fetching -source files and how you can pre-fetch files all of which leads to more -efficient use of resources and time. - -Setting up Effective Mirrors ----------------------------- - -A good deal that goes into a Yocto Project build is simply downloading -all of the source tarballs. Maybe you have been working with another -build system for which you have built up a -sizable directory of source tarballs. Or, perhaps someone else has such -a directory for which you have read access. If so, you can save time by -adding statements to your configuration file so that the build process -checks local directories first for existing tarballs before checking the -Internet. - -Here is an efficient way to set it up in your ``local.conf`` file:: - - SOURCE_MIRROR_URL ?= "file:///home/you/your-download-dir/" - INHERIT += "own-mirrors" - BB_GENERATE_MIRROR_TARBALLS = "1" - # BB_NO_NETWORK = "1" - -In the previous example, the -:term:`BB_GENERATE_MIRROR_TARBALLS` -variable causes the OpenEmbedded build system to generate tarballs of -the Git repositories and store them in the -:term:`DL_DIR` directory. Due to -performance reasons, generating and storing these tarballs is not the -build system's default behavior. - -You can also use the -:term:`PREMIRRORS` variable. For -an example, see the variable's glossary entry in the Yocto Project -Reference Manual. - -Getting Source Files and Suppressing the Build ----------------------------------------------- - -Another technique you can use to ready yourself for a successive string -of build operations, is to pre-fetch all the source files without -actually starting a build. This technique lets you work through any -download issues and ultimately gathers all the source files into your -download directory :ref:`structure-build-downloads`, -which is located with :term:`DL_DIR`. - -Use the following BitBake command form to fetch all the necessary -sources without starting the build:: - - $ bitbake target --runall=fetch - -This -variation of the BitBake command guarantees that you have all the -sources for that BitBake target should you disconnect from the Internet -and want to do the build later offline. - -Selecting an Initialization Manager -=================================== - -By default, the Yocto Project uses SysVinit as the initialization -manager. However, there is also support for systemd, which is a full -replacement for init with parallel starting of services, reduced shell -overhead and other features that are used by many distributions. - -Within the system, SysVinit treats system components as services. These -services are maintained as shell scripts stored in the ``/etc/init.d/`` -directory. Services organize into different run levels. This -organization is maintained by putting links to the services in the -``/etc/rcN.d/`` directories, where `N/` is one of the following options: -"S", "0", "1", "2", "3", "4", "5", or "6". - -.. note:: - - Each runlevel has a dependency on the previous runlevel. This - dependency allows the services to work properly. - -In comparison, systemd treats components as units. Using units is a -broader concept as compared to using a service. A unit includes several -different types of entities. Service is one of the types of entities. -The runlevel concept in SysVinit corresponds to the concept of a target -in systemd, where target is also a type of supported unit. - -In a SysVinit-based system, services load sequentially (i.e. one by one) -during init and parallelization is not supported. With systemd, services -start in parallel. Needless to say, the method can have an impact on -system startup performance. - -If you want to use SysVinit, you do not have to do anything. But, if you -want to use systemd, you must take some steps as described in the -following sections. - -Using systemd Exclusively -------------------------- - -Set these variables in your distribution configuration file as follows:: - - DISTRO_FEATURES:append = " systemd" - VIRTUAL-RUNTIME_init_manager = "systemd" - -You can also prevent the SysVinit distribution feature from -being automatically enabled as follows:: - - DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" - -Doing so removes any -redundant SysVinit scripts. - -To remove initscripts from your image altogether, set this variable -also:: - - VIRTUAL-RUNTIME_initscripts = "" - -For information on the backfill variable, see -:term:`DISTRO_FEATURES_BACKFILL_CONSIDERED`. - -Using systemd for the Main Image and Using SysVinit for the Rescue Image ------------------------------------------------------------------------- - -Set these variables in your distribution configuration file as follows:: - - DISTRO_FEATURES:append = " systemd" - VIRTUAL-RUNTIME_init_manager = "systemd" - -Doing so causes your main image to use the -``packagegroup-core-boot.bb`` recipe and systemd. The rescue/minimal -image cannot use this package group. However, it can install SysVinit -and the appropriate packages will have support for both systemd and -SysVinit. - -Using systemd-journald without a traditional syslog daemon ----------------------------------------------------------- - -Counter-intuitively, ``systemd-journald`` is not a syslog runtime or provider, -and the proper way to use systemd-journald as your sole logging mechanism is to -effectively disable syslog entirely by setting these variables in your distribution -configuration file:: - - VIRTUAL-RUNTIME_syslog = "" - VIRTUAL-RUNTIME_base-utils-syslog = "" - -Doing so will prevent ``rsyslog`` / ``busybox-syslog`` from being pulled in by -default, leaving only ``journald``. - -Selecting a Device Manager -========================== - -The Yocto Project provides multiple ways to manage the device manager -(``/dev``): - -- Persistent and Pre-Populated ``/dev``: For this case, the ``/dev`` - directory is persistent and the required device nodes are created - during the build. - -- Use ``devtmpfs`` with a Device Manager: For this case, the ``/dev`` - directory is provided by the kernel as an in-memory file system and - is automatically populated by the kernel at runtime. Additional - configuration of device nodes is done in user space by a device - manager like ``udev`` or ``busybox-mdev``. - -Using Persistent and Pre-Populated ``/dev`` --------------------------------------------- - -To use the static method for device population, you need to set the -:term:`USE_DEVFS` variable to "0" -as follows:: - - USE_DEVFS = "0" - -The content of the resulting ``/dev`` directory is defined in a Device -Table file. The -:term:`IMAGE_DEVICE_TABLES` -variable defines the Device Table to use and should be set in the -machine or distro configuration file. Alternatively, you can set this -variable in your ``local.conf`` configuration file. - -If you do not define the :term:`IMAGE_DEVICE_TABLES` variable, the default -``device_table-minimal.txt`` is used:: - - IMAGE_DEVICE_TABLES = "device_table-mymachine.txt" - -The population is handled by the ``makedevs`` utility during image -creation: - -Using ``devtmpfs`` and a Device Manager ---------------------------------------- - -To use the dynamic method for device population, you need to use (or be -sure to set) the :term:`USE_DEVFS` -variable to "1", which is the default:: - - USE_DEVFS = "1" - -With this -setting, the resulting ``/dev`` directory is populated by the kernel -using ``devtmpfs``. Make sure the corresponding kernel configuration -variable ``CONFIG_DEVTMPFS`` is set when building you build a Linux -kernel. - -All devices created by ``devtmpfs`` will be owned by ``root`` and have -permissions ``0600``. - -To have more control over the device nodes, you can use a device manager -like ``udev`` or ``busybox-mdev``. You choose the device manager by -defining the ``VIRTUAL-RUNTIME_dev_manager`` variable in your machine or -distro configuration file. Alternatively, you can set this variable in -your ``local.conf`` configuration file:: - - VIRTUAL-RUNTIME_dev_manager = "udev" - - # Some alternative values - # VIRTUAL-RUNTIME_dev_manager = "busybox-mdev" - # VIRTUAL-RUNTIME_dev_manager = "systemd" - -Using an External SCM -===================== - -If you're working on a recipe that pulls from an external Source Code -Manager (SCM), it is possible to have the OpenEmbedded build system -notice new recipe changes added to the SCM and then build the resulting -packages that depend on the new recipes by using the latest versions. -This only works for SCMs from which it is possible to get a sensible -revision number for changes. Currently, you can do this with Apache -Subversion (SVN), Git, and Bazaar (BZR) repositories. - -To enable this behavior, the :term:`PV` of -the recipe needs to reference -:term:`SRCPV`. Here is an example:: - - PV = "1.2.3+git${SRCPV}" - -Then, you can add the following to your -``local.conf``:: - - SRCREV:pn-PN = "${AUTOREV}" - -:term:`PN` is the name of the recipe for -which you want to enable automatic source revision updating. - -If you do not want to update your local configuration file, you can add -the following directly to the recipe to finish enabling the feature:: - - SRCREV = "${AUTOREV}" - -The Yocto Project provides a distribution named ``poky-bleeding``, whose -configuration file contains the line:: - - require conf/distro/include/poky-floating-revisions.inc - -This line pulls in the -listed include file that contains numerous lines of exactly that form:: - - #SRCREV:pn-opkg-native ?= "${AUTOREV}" - #SRCREV:pn-opkg-sdk ?= "${AUTOREV}" - #SRCREV:pn-opkg ?= "${AUTOREV}" - #SRCREV:pn-opkg-utils-native ?= "${AUTOREV}" - #SRCREV:pn-opkg-utils ?= "${AUTOREV}" - SRCREV:pn-gconf-dbus ?= "${AUTOREV}" - SRCREV:pn-matchbox-common ?= "${AUTOREV}" - SRCREV:pn-matchbox-config-gtk ?= "${AUTOREV}" - SRCREV:pn-matchbox-desktop ?= "${AUTOREV}" - SRCREV:pn-matchbox-keyboard ?= "${AUTOREV}" - SRCREV:pn-matchbox-panel-2 ?= "${AUTOREV}" - SRCREV:pn-matchbox-themes-extra ?= "${AUTOREV}" - SRCREV:pn-matchbox-terminal ?= "${AUTOREV}" - SRCREV:pn-matchbox-wm ?= "${AUTOREV}" - SRCREV:pn-settings-daemon ?= "${AUTOREV}" - SRCREV:pn-screenshot ?= "${AUTOREV}" - . . . - -These lines allow you to -experiment with building a distribution that tracks the latest -development source for numerous packages. - -.. note:: - - The ``poky-bleeding`` distribution is not tested on a regular basis. Keep - this in mind if you use it. - -Creating a Read-Only Root Filesystem -==================================== - -Suppose, for security reasons, you need to disable your target device's -root filesystem's write permissions (i.e. you need a read-only root -filesystem). Or, perhaps you are running the device's operating system -from a read-only storage device. For either case, you can customize your -image for that behavior. - -.. note:: - - Supporting a read-only root filesystem requires that the system and - applications do not try to write to the root filesystem. You must - configure all parts of the target system to write elsewhere, or to - gracefully fail in the event of attempting to write to the root - filesystem. - -Creating the Root Filesystem ----------------------------- - -To create the read-only root filesystem, simply add the -"read-only-rootfs" feature to your image, normally in one of two ways. -The first way is to add the "read-only-rootfs" image feature in the -image's recipe file via the :term:`IMAGE_FEATURES` variable:: - - IMAGE_FEATURES += "read-only-rootfs" - -As an alternative, you can add the same feature -from within your :term:`Build Directory`'s ``local.conf`` file with the -associated :term:`EXTRA_IMAGE_FEATURES` variable, as in:: - - EXTRA_IMAGE_FEATURES = "read-only-rootfs" - -For more information on how to use these variables, see the -":ref:`dev-manual/common-tasks:Customizing Images Using Custom \`\`IMAGE_FEATURES\`\` and \`\`EXTRA_IMAGE_FEATURES\`\``" -section. For information on the variables, see -:term:`IMAGE_FEATURES` and -:term:`EXTRA_IMAGE_FEATURES`. - -Post-Installation Scripts and Read-Only Root Filesystem -------------------------------------------------------- - -It is very important that you make sure all post-Installation -(``pkg_postinst``) scripts for packages that are installed into the -image can be run at the time when the root filesystem is created during -the build on the host system. These scripts cannot attempt to run during -the first boot on the target device. With the "read-only-rootfs" feature -enabled, the build system makes sure that all post-installation scripts -succeed at file system creation time. If any of these scripts -still need to be run after the root filesystem is created, the build -immediately fails. These build-time checks ensure that the build fails -rather than the target device fails later during its initial boot -operation. - -Most of the common post-installation scripts generated by the build -system for the out-of-the-box Yocto Project are engineered so that they -can run during root filesystem creation (e.g. post-installation scripts -for caching fonts). However, if you create and add custom scripts, you -need to be sure they can be run during this file system creation. - -Here are some common problems that prevent post-installation scripts -from running during root filesystem creation: - -- *Not using $D in front of absolute paths:* The build system defines - ``$``\ :term:`D` when the root - filesystem is created. Furthermore, ``$D`` is blank when the script - is run on the target device. This implies two purposes for ``$D``: - ensuring paths are valid in both the host and target environments, - and checking to determine which environment is being used as a method - for taking appropriate actions. - -- *Attempting to run processes that are specific to or dependent on the - target architecture:* You can work around these attempts by using - native tools, which run on the host system, to accomplish the same - tasks, or by alternatively running the processes under QEMU, which - has the ``qemu_run_binary`` function. For more information, see the - :ref:`qemu ` class. - -Areas With Write Access ------------------------ - -With the "read-only-rootfs" feature enabled, any attempt by the target -to write to the root filesystem at runtime fails. Consequently, you must -make sure that you configure processes and applications that attempt -these types of writes do so to directories with write access (e.g. -``/tmp`` or ``/var/run``). - -Maintaining Build Output Quality -================================ - -Many factors can influence the quality of a build. For example, if you -upgrade a recipe to use a new version of an upstream software package or -you experiment with some new configuration options, subtle changes can -occur that you might not detect until later. Consider the case where -your recipe is using a newer version of an upstream package. In this -case, a new version of a piece of software might introduce an optional -dependency on another library, which is auto-detected. If that library -has already been built when the software is building, the software will -link to the built library and that library will be pulled into your -image along with the new software even if you did not want the library. - -The :ref:`buildhistory ` -class helps you maintain the quality of your build output. You -can use the class to highlight unexpected and possibly unwanted changes -in the build output. When you enable build history, it records -information about the contents of each package and image and then -commits that information to a local Git repository where you can examine -the information. - -The remainder of this section describes the following: - -- :ref:`How you can enable and disable build history ` - -- :ref:`How to understand what the build history contains ` - -- :ref:`How to limit the information used for build history ` - -- :ref:`How to examine the build history from both a command-line and web interface ` - -Enabling and Disabling Build History ------------------------------------- - -Build history is disabled by default. To enable it, add the following -:term:`INHERIT` statement and set the :term:`BUILDHISTORY_COMMIT` variable to -"1" at the end of your ``conf/local.conf`` file found in the -:term:`Build Directory`:: - - INHERIT += "buildhistory" - BUILDHISTORY_COMMIT = "1" - -Enabling build history as -previously described causes the OpenEmbedded build system to collect -build output information and commit it as a single commit to a local -:ref:`overview-manual/development-environment:git` repository. - -.. note:: - - Enabling build history increases your build times slightly, - particularly for images, and increases the amount of disk space used - during the build. - -You can disable build history by removing the previous statements from -your ``conf/local.conf`` file. - -Understanding What the Build History Contains ---------------------------------------------- - -Build history information is kept in ``${``\ :term:`TOPDIR`\ ``}/buildhistory`` -in the :term:`Build Directory` as defined by the :term:`BUILDHISTORY_DIR` -variable. Here is an example abbreviated listing: - -.. image:: figures/buildhistory.png - :align: center - :width: 50% - -At the top level, there is a ``metadata-revs`` file that lists the -revisions of the repositories for the enabled layers when the build was -produced. The rest of the data splits into separate ``packages``, -``images`` and ``sdk`` directories, the contents of which are described -as follows. - -Build History Package Information -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The history for each package contains a text file that has name-value -pairs with information about the package. For example, -``buildhistory/packages/i586-poky-linux/busybox/busybox/latest`` -contains the following: - -.. code-block:: none - - PV = 1.22.1 - PR = r32 - RPROVIDES = - RDEPENDS = glibc (>= 2.20) update-alternatives-opkg - RRECOMMENDS = busybox-syslog busybox-udhcpc update-rc.d - PKGSIZE = 540168 - FILES = /usr/bin/* /usr/sbin/* /usr/lib/busybox/* /usr/lib/lib*.so.* \ - /etc /com /var /bin/* /sbin/* /lib/*.so.* /lib/udev/rules.d \ - /usr/lib/udev/rules.d /usr/share/busybox /usr/lib/busybox/* \ - /usr/share/pixmaps /usr/share/applications /usr/share/idl \ - /usr/share/omf /usr/share/sounds /usr/lib/bonobo/servers - FILELIST = /bin/busybox /bin/busybox.nosuid /bin/busybox.suid /bin/sh \ - /etc/busybox.links.nosuid /etc/busybox.links.suid - -Most of these -name-value pairs correspond to variables used to produce the package. -The exceptions are ``FILELIST``, which is the actual list of files in -the package, and ``PKGSIZE``, which is the total size of files in the -package in bytes. - -There is also a file that corresponds to the recipe from which the package -came (e.g. ``buildhistory/packages/i586-poky-linux/busybox/latest``): - -.. code-block:: none - - PV = 1.22.1 - PR = r32 - DEPENDS = initscripts kern-tools-native update-rc.d-native \ - virtual/i586-poky-linux-compilerlibs virtual/i586-poky-linux-gcc \ - virtual/libc virtual/update-alternatives - PACKAGES = busybox-ptest busybox-httpd busybox-udhcpd busybox-udhcpc \ - busybox-syslog busybox-mdev busybox-hwclock busybox-dbg \ - busybox-staticdev busybox-dev busybox-doc busybox-locale busybox - -Finally, for those recipes fetched from a version control system (e.g., -Git), there is a file that lists source revisions that are specified in -the recipe and the actual revisions used during the build. Listed -and actual revisions might differ when -:term:`SRCREV` is set to -${:term:`AUTOREV`}. Here is an -example assuming -``buildhistory/packages/qemux86-poky-linux/linux-yocto/latest_srcrev``):: - - # SRCREV_machine = "38cd560d5022ed2dbd1ab0dca9642e47c98a0aa1" - SRCREV_machine = "38cd560d5022ed2dbd1ab0dca9642e47c98a0aa1" - # SRCREV_meta = "a227f20eff056e511d504b2e490f3774ab260d6f" - SRCREV_meta ="a227f20eff056e511d504b2e490f3774ab260d6f" - -You can use the -``buildhistory-collect-srcrevs`` command with the ``-a`` option to -collect the stored :term:`SRCREV` values from build history and report them -in a format suitable for use in global configuration (e.g., -``local.conf`` or a distro include file) to override floating -:term:`AUTOREV` values to a fixed set of revisions. Here is some example -output from this command:: - - $ buildhistory-collect-srcrevs -a - # all-poky-linux - SRCREV:pn-ca-certificates = "07de54fdcc5806bde549e1edf60738c6bccf50e8" - SRCREV:pn-update-rc.d = "8636cf478d426b568c1be11dbd9346f67e03adac" - # core2-64-poky-linux - SRCREV:pn-binutils = "87d4632d36323091e731eb07b8aa65f90293da66" - SRCREV:pn-btrfs-tools = "8ad326b2f28c044cb6ed9016d7c3285e23b673c8" - SRCREV_bzip2-tests:pn-bzip2 = "f9061c030a25de5b6829e1abf373057309c734c0" - SRCREV:pn-e2fsprogs = "02540dedd3ddc52c6ae8aaa8a95ce75c3f8be1c0" - SRCREV:pn-file = "504206e53a89fd6eed71aeaf878aa3512418eab1" - SRCREV_glibc:pn-glibc = "24962427071fa532c3c48c918e9d64d719cc8a6c" - SRCREV:pn-gnome-desktop-testing = "e346cd4ed2e2102c9b195b614f3c642d23f5f6e7" - SRCREV:pn-init-system-helpers = "dbd9197569c0935029acd5c9b02b84c68fd937ee" - SRCREV:pn-kmod = "b6ecfc916a17eab8f93be5b09f4e4f845aabd3d1" - SRCREV:pn-libnsl2 = "82245c0c58add79a8e34ab0917358217a70e5100" - SRCREV:pn-libseccomp = "57357d2741a3b3d3e8425889a6b79a130e0fa2f3" - SRCREV:pn-libxcrypt = "50cf2b6dd4fdf04309445f2eec8de7051d953abf" - SRCREV:pn-ncurses = "51d0fd9cc3edb975f04224f29f777f8f448e8ced" - SRCREV:pn-procps = "19a508ea121c0c4ac6d0224575a036de745eaaf8" - SRCREV:pn-psmisc = "5fab6b7ab385080f1db725d6803136ec1841a15f" - SRCREV:pn-ptest-runner = "bcb82804daa8f725b6add259dcef2067e61a75aa" - SRCREV:pn-shared-mime-info = "18e558fa1c8b90b86757ade09a4ba4d6a6cf8f70" - SRCREV:pn-zstd = "e47e674cd09583ff0503f0f6defd6d23d8b718d3" - # qemux86_64-poky-linux - SRCREV_machine:pn-linux-yocto = "20301aeb1a64164b72bc72af58802b315e025c9c" - SRCREV_meta:pn-linux-yocto = "2d38a472b21ae343707c8bd64ac68a9eaca066a0" - # x86_64-linux - SRCREV:pn-binutils-cross-x86_64 = "87d4632d36323091e731eb07b8aa65f90293da66" - SRCREV_glibc:pn-cross-localedef-native = "24962427071fa532c3c48c918e9d64d719cc8a6c" - SRCREV_localedef:pn-cross-localedef-native = "794da69788cbf9bf57b59a852f9f11307663fa87" - SRCREV:pn-debianutils-native = "de14223e5bffe15e374a441302c528ffc1cbed57" - SRCREV:pn-libmodulemd-native = "ee80309bc766d781a144e6879419b29f444d94eb" - SRCREV:pn-virglrenderer-native = "363915595e05fb252e70d6514be2f0c0b5ca312b" - SRCREV:pn-zstd-native = "e47e674cd09583ff0503f0f6defd6d23d8b718d3" - -.. note:: - - Here are some notes on using the ``buildhistory-collect-srcrevs`` command: - - - By default, only values where the :term:`SRCREV` was not hardcoded - (usually when :term:`AUTOREV` is used) are reported. Use the ``-a`` - option to see all :term:`SRCREV` values. - - - The output statements might not have any effect if overrides are - applied elsewhere in the build system configuration. Use the - ``-f`` option to add the ``forcevariable`` override to each output - line if you need to work around this restriction. - - - The script does apply special handling when building for multiple - machines. However, the script does place a comment before each set - of values that specifies which triplet to which they belong as - previously shown (e.g., ``i586-poky-linux``). - -Build History Image Information -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The files produced for each image are as follows: - -- ``image-files:`` A directory containing selected files from the root - filesystem. The files are defined by - :term:`BUILDHISTORY_IMAGE_FILES`. - -- ``build-id.txt:`` Human-readable information about the build - configuration and metadata source revisions. This file contains the - full build header as printed by BitBake. - -- ``*.dot:`` Dependency graphs for the image that are compatible with - ``graphviz``. - -- ``files-in-image.txt:`` A list of files in the image with - permissions, owner, group, size, and symlink information. - -- ``image-info.txt:`` A text file containing name-value pairs with - information about the image. See the following listing example for - more information. - -- ``installed-package-names.txt:`` A list of installed packages by name - only. - -- ``installed-package-sizes.txt:`` A list of installed packages ordered - by size. - -- ``installed-packages.txt:`` A list of installed packages with full - package filenames. - -.. note:: - - Installed package information is able to be gathered and produced - even if package management is disabled for the final image. - -Here is an example of ``image-info.txt``: - -.. code-block:: none - - DISTRO = poky - DISTRO_VERSION = 3.4+snapshot-a0245d7be08f3d24ea1875e9f8872aa6bbff93be - USER_CLASSES = buildstats - IMAGE_CLASSES = qemuboot qemuboot license_image - IMAGE_FEATURES = debug-tweaks - IMAGE_LINGUAS = - IMAGE_INSTALL = packagegroup-core-boot speex speexdsp - BAD_RECOMMENDATIONS = - NO_RECOMMENDATIONS = - PACKAGE_EXCLUDE = - ROOTFS_POSTPROCESS_COMMAND = write_package_manifest; license_create_manifest; cve_check_write_rootfs_manifest; ssh_allow_empty_password; ssh_allow_root_login; postinst_enable_logging; rootfs_update_timestamp; write_image_test_data; empty_var_volatile; sort_passwd; rootfs_reproducible; - IMAGE_POSTPROCESS_COMMAND = buildhistory_get_imageinfo ; - IMAGESIZE = 9265 - -Other than ``IMAGESIZE``, -which is the total size of the files in the image in Kbytes, the -name-value pairs are variables that may have influenced the content of -the image. This information is often useful when you are trying to -determine why a change in the package or file listings has occurred. - -Using Build History to Gather Image Information Only -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -As you can see, build history produces image information, including -dependency graphs, so you can see why something was pulled into the -image. If you are just interested in this information and not interested -in collecting specific package or SDK information, you can enable -writing only image information without any history by adding the -following to your ``conf/local.conf`` file found in the -:term:`Build Directory`:: - - INHERIT += "buildhistory" - BUILDHISTORY_COMMIT = "0" - BUILDHISTORY_FEATURES = "image" - -Here, you set the -:term:`BUILDHISTORY_FEATURES` -variable to use the image feature only. - -Build History SDK Information -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Build history collects similar information on the contents of SDKs (e.g. -``bitbake -c populate_sdk imagename``) as compared to information it -collects for images. Furthermore, this information differs depending on -whether an extensible or standard SDK is being produced. - -The following list shows the files produced for SDKs: - -- ``files-in-sdk.txt:`` A list of files in the SDK with permissions, - owner, group, size, and symlink information. This list includes both - the host and target parts of the SDK. - -- ``sdk-info.txt:`` A text file containing name-value pairs with - information about the SDK. See the following listing example for more - information. - -- ``sstate-task-sizes.txt:`` A text file containing name-value pairs - with information about task group sizes (e.g. :ref:`ref-tasks-populate_sysroot` - tasks have a total size). The ``sstate-task-sizes.txt`` file exists - only when an extensible SDK is created. - -- ``sstate-package-sizes.txt:`` A text file containing name-value pairs - with information for the shared-state packages and sizes in the SDK. - The ``sstate-package-sizes.txt`` file exists only when an extensible - SDK is created. - -- ``sdk-files:`` A folder that contains copies of the files mentioned - in ``BUILDHISTORY_SDK_FILES`` if the files are present in the output. - Additionally, the default value of ``BUILDHISTORY_SDK_FILES`` is - specific to the extensible SDK although you can set it differently if - you would like to pull in specific files from the standard SDK. - - The default files are ``conf/local.conf``, ``conf/bblayers.conf``, - ``conf/auto.conf``, ``conf/locked-sigs.inc``, and - ``conf/devtool.conf``. Thus, for an extensible SDK, these files get - copied into the ``sdk-files`` directory. - -- The following information appears under each of the ``host`` and - ``target`` directories for the portions of the SDK that run on the - host and on the target, respectively: - - .. note:: - - The following files for the most part are empty when producing an - extensible SDK because this type of SDK is not constructed from - packages as is the standard SDK. - - - ``depends.dot:`` Dependency graph for the SDK that is compatible - with ``graphviz``. - - - ``installed-package-names.txt:`` A list of installed packages by - name only. - - - ``installed-package-sizes.txt:`` A list of installed packages - ordered by size. - - - ``installed-packages.txt:`` A list of installed packages with full - package filenames. - -Here is an example of ``sdk-info.txt``: - -.. code-block:: none - - DISTRO = poky - DISTRO_VERSION = 1.3+snapshot-20130327 - SDK_NAME = poky-glibc-i686-arm - SDK_VERSION = 1.3+snapshot - SDKMACHINE = - SDKIMAGE_FEATURES = dev-pkgs dbg-pkgs - BAD_RECOMMENDATIONS = - SDKSIZE = 352712 - -Other than ``SDKSIZE``, which is -the total size of the files in the SDK in Kbytes, the name-value pairs -are variables that might have influenced the content of the SDK. This -information is often useful when you are trying to determine why a -change in the package or file listings has occurred. - -Examining Build History Information -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can examine build history output from the command line or from a web -interface. - -To see any changes that have occurred (assuming you have -:term:`BUILDHISTORY_COMMIT` = "1"), -you can simply use any Git command that allows you to view the history -of a repository. Here is one method:: - - $ git log -p - -You need to realize, -however, that this method does show changes that are not significant -(e.g. a package's size changing by a few bytes). - -There is a command-line tool called ``buildhistory-diff``, though, -that queries the Git repository and prints just the differences that -might be significant in human-readable form. Here is an example:: - - $ poky/poky/scripts/buildhistory-diff . HEAD^ - Changes to images/qemux86_64/glibc/core-image-minimal (files-in-image.txt): - /etc/anotherpkg.conf was added - /sbin/anotherpkg was added - * (installed-package-names.txt): - * anotherpkg was added - Changes to images/qemux86_64/glibc/core-image-minimal (installed-package-names.txt): - anotherpkg was added - packages/qemux86_64-poky-linux/v86d: PACKAGES: added "v86d-extras" - * PR changed from "r0" to "r1" - * PV changed from "0.1.10" to "0.1.12" - packages/qemux86_64-poky-linux/v86d/v86d: PKGSIZE changed from 110579 to 144381 (+30%) - * PR changed from "r0" to "r1" - * PV changed from "0.1.10" to "0.1.12" - -.. note:: - - The ``buildhistory-diff`` tool requires the ``GitPython`` - package. Be sure to install it using Pip3 as follows:: - - $ pip3 install GitPython --user - - - Alternatively, you can install ``python3-git`` using the appropriate - distribution package manager (e.g. ``apt``, ``dnf``, or ``zipper``). - -To see changes to the build history using a web interface, follow the -instruction in the ``README`` file -:yocto_git:`here `. - -Here is a sample screenshot of the interface: - -.. image:: figures/buildhistory-web.png - :width: 100% - -Performing Automated Runtime Testing -==================================== - -The OpenEmbedded build system makes available a series of automated -tests for images to verify runtime functionality. You can run these -tests on either QEMU or actual target hardware. Tests are written in -Python making use of the ``unittest`` module, and the majority of them -run commands on the target system over SSH. This section describes how -you set up the environment to use these tests, run available tests, and -write and add your own tests. - -For information on the test and QA infrastructure available within the -Yocto Project, see the ":ref:`ref-manual/release-process:testing and quality assurance`" -section in the Yocto Project Reference Manual. - -Enabling Tests --------------- - -Depending on whether you are planning to run tests using QEMU or on the -hardware, you have to take different steps to enable the tests. See the -following subsections for information on how to enable both types of -tests. - -Enabling Runtime Tests on QEMU -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In order to run tests, you need to do the following: - -- *Set up to avoid interaction with sudo for networking:* To - accomplish this, you must do one of the following: - - - Add ``NOPASSWD`` for your user in ``/etc/sudoers`` either for all - commands or just for ``runqemu-ifup``. You must provide the full - path as that can change if you are using multiple clones of the - source repository. - - .. note:: - - On some distributions, you also need to comment out "Defaults - requiretty" in ``/etc/sudoers``. - - - Manually configure a tap interface for your system. - - - Run as root the script in ``scripts/runqemu-gen-tapdevs``, which - should generate a list of tap devices. This is the option - typically chosen for Autobuilder-type environments. - - .. note:: - - - Be sure to use an absolute path when calling this script - with sudo. - - - The package recipe ``qemu-helper-native`` is required to run - this script. Build the package using the following command:: - - $ bitbake qemu-helper-native - -- *Set the DISPLAY variable:* You need to set this variable so that - you have an X server available (e.g. start ``vncserver`` for a - headless machine). - -- *Be sure your host's firewall accepts incoming connections from - 192.168.7.0/24:* Some of the tests (in particular DNF tests) start an - HTTP server on a random high number port, which is used to serve - files to the target. The DNF module serves - ``${WORKDIR}/oe-rootfs-repo`` so it can run DNF channel commands. - That means your host's firewall must accept incoming connections from - 192.168.7.0/24, which is the default IP range used for tap devices by - ``runqemu``. - -- *Be sure your host has the correct packages installed:* Depending - your host's distribution, you need to have the following packages - installed: - - - Ubuntu and Debian: ``sysstat`` and ``iproute2`` - - - openSUSE: ``sysstat`` and ``iproute2`` - - - Fedora: ``sysstat`` and ``iproute`` - - - CentOS: ``sysstat`` and ``iproute`` - -Once you start running the tests, the following happens: - -1. A copy of the root filesystem is written to ``${WORKDIR}/testimage``. - -2. The image is booted under QEMU using the standard ``runqemu`` script. - -3. A default timeout of 500 seconds occurs to allow for the boot process - to reach the login prompt. You can change the timeout period by - setting - :term:`TEST_QEMUBOOT_TIMEOUT` - in the ``local.conf`` file. - -4. Once the boot process is reached and the login prompt appears, the - tests run. The full boot log is written to - ``${WORKDIR}/testimage/qemu_boot_log``. - -5. Each test module loads in the order found in :term:`TEST_SUITES`. You can - find the full output of the commands run over SSH in - ``${WORKDIR}/testimgage/ssh_target_log``. - -6. If no failures occur, the task running the tests ends successfully. - You can find the output from the ``unittest`` in the task log at - ``${WORKDIR}/temp/log.do_testimage``. - -Enabling Runtime Tests on Hardware -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The OpenEmbedded build system can run tests on real hardware, and for -certain devices it can also deploy the image to be tested onto the -device beforehand. - -For automated deployment, a "controller image" is installed onto the -hardware once as part of setup. Then, each time tests are to be run, the -following occurs: - -1. The controller image is booted into and used to write the image to be - tested to a second partition. - -2. The device is then rebooted using an external script that you need to - provide. - -3. The device boots into the image to be tested. - -When running tests (independent of whether the image has been deployed -automatically or not), the device is expected to be connected to a -network on a pre-determined IP address. You can either use static IP -addresses written into the image, or set the image to use DHCP and have -your DHCP server on the test network assign a known IP address based on -the MAC address of the device. - -In order to run tests on hardware, you need to set :term:`TEST_TARGET` to an -appropriate value. For QEMU, you do not have to change anything, the -default value is "qemu". For running tests on hardware, the following -options are available: - -- *"simpleremote":* Choose "simpleremote" if you are going to run tests - on a target system that is already running the image to be tested and - is available on the network. You can use "simpleremote" in - conjunction with either real hardware or an image running within a - separately started QEMU or any other virtual machine manager. - -- *"SystemdbootTarget":* Choose "SystemdbootTarget" if your hardware is - an EFI-based machine with ``systemd-boot`` as bootloader and - ``core-image-testmaster`` (or something similar) is installed. Also, - your hardware under test must be in a DHCP-enabled network that gives - it the same IP address for each reboot. - - If you choose "SystemdbootTarget", there are additional requirements - and considerations. See the - ":ref:`dev-manual/common-tasks:selecting systemdboottarget`" section, which - follows, for more information. - -- *"BeagleBoneTarget":* Choose "BeagleBoneTarget" if you are deploying - images and running tests on the BeagleBone "Black" or original - "White" hardware. For information on how to use these tests, see the - comments at the top of the BeagleBoneTarget - ``meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py`` file. - -- *"EdgeRouterTarget":* Choose "EdgeRouterTarget" if you are deploying - images and running tests on the Ubiquiti Networks EdgeRouter Lite. - For information on how to use these tests, see the comments at the - top of the EdgeRouterTarget - ``meta-yocto-bsp/lib/oeqa/controllers/edgeroutertarget.py`` file. - -- *"GrubTarget":* Choose "GrubTarget" if you are deploying images and running - tests on any generic PC that boots using GRUB. For information on how - to use these tests, see the comments at the top of the GrubTarget - ``meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py`` file. - -- *"your-target":* Create your own custom target if you want to run - tests when you are deploying images and running tests on a custom - machine within your BSP layer. To do this, you need to add a Python - unit that defines the target class under ``lib/oeqa/controllers/`` - within your layer. You must also provide an empty ``__init__.py``. - For examples, see files in ``meta-yocto-bsp/lib/oeqa/controllers/``. - -Selecting SystemdbootTarget -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If you did not set :term:`TEST_TARGET` to "SystemdbootTarget", then you do -not need any information in this section. You can skip down to the -":ref:`dev-manual/common-tasks:running tests`" section. - -If you did set :term:`TEST_TARGET` to "SystemdbootTarget", you also need to -perform a one-time setup of your controller image by doing the following: - -1. *Set EFI_PROVIDER:* Be sure that :term:`EFI_PROVIDER` is as follows:: - - EFI_PROVIDER = "systemd-boot" - -2. *Build the controller image:* Build the ``core-image-testmaster`` image. - The ``core-image-testmaster`` recipe is provided as an example for a - "controller" image and you can customize the image recipe as you would - any other recipe. - - Here are the image recipe requirements: - - - Inherits ``core-image`` so that kernel modules are installed. - - - Installs normal linux utilities not BusyBox ones (e.g. ``bash``, - ``coreutils``, ``tar``, ``gzip``, and ``kmod``). - - - Uses a custom :term:`Initramfs` image with a custom - installer. A normal image that you can install usually creates a - single root filesystem partition. This image uses another installer that - creates a specific partition layout. Not all Board Support - Packages (BSPs) can use an installer. For such cases, you need to - manually create the following partition layout on the target: - - - First partition mounted under ``/boot``, labeled "boot". - - - The main root filesystem partition where this image gets installed, - which is mounted under ``/``. - - - Another partition labeled "testrootfs" where test images get - deployed. - -3. *Install image:* Install the image that you just built on the target - system. - -The final thing you need to do when setting :term:`TEST_TARGET` to -"SystemdbootTarget" is to set up the test image: - -1. *Set up your local.conf file:* Make sure you have the following - statements in your ``local.conf`` file:: - - IMAGE_FSTYPES += "tar.gz" - INHERIT += "testimage" - TEST_TARGET = "SystemdbootTarget" - TEST_TARGET_IP = "192.168.2.3" - -2. *Build your test image:* Use BitBake to build the image:: - - $ bitbake core-image-sato - -Power Control -~~~~~~~~~~~~~ - -For most hardware targets other than "simpleremote", you can control -power: - -- You can use :term:`TEST_POWERCONTROL_CMD` together with - :term:`TEST_POWERCONTROL_EXTRA_ARGS` as a command that runs on the host - and does power cycling. The test code passes one argument to that - command: off, on or cycle (off then on). Here is an example that - could appear in your ``local.conf`` file:: - - TEST_POWERCONTROL_CMD = "powercontrol.exp test 10.11.12.1 nuc1" - - In this example, the expect - script does the following: - - .. code-block:: shell - - ssh test@10.11.12.1 "pyctl nuc1 arg" - - It then runs a Python script that controls power for a label called - ``nuc1``. - - .. note:: - - You need to customize :term:`TEST_POWERCONTROL_CMD` and - :term:`TEST_POWERCONTROL_EXTRA_ARGS` for your own setup. The one requirement - is that it accepts "on", "off", and "cycle" as the last argument. - -- When no command is defined, it connects to the device over SSH and - uses the classic reboot command to reboot the device. Classic reboot - is fine as long as the machine actually reboots (i.e. the SSH test - has not failed). It is useful for scenarios where you have a simple - setup, typically with a single board, and where some manual - interaction is okay from time to time. - -If you have no hardware to automatically perform power control but still -wish to experiment with automated hardware testing, you can use the -``dialog-power-control`` script that shows a dialog prompting you to perform -the required power action. This script requires either KDialog or Zenity -to be installed. To use this script, set the -:term:`TEST_POWERCONTROL_CMD` -variable as follows:: - - TEST_POWERCONTROL_CMD = "${COREBASE}/scripts/contrib/dialog-power-control" - -Serial Console Connection -~~~~~~~~~~~~~~~~~~~~~~~~~ - -For test target classes requiring a serial console to interact with the -bootloader (e.g. BeagleBoneTarget, EdgeRouterTarget, and GrubTarget), -you need to specify a command to use to connect to the serial console of -the target machine by using the -:term:`TEST_SERIALCONTROL_CMD` -variable and optionally the -:term:`TEST_SERIALCONTROL_EXTRA_ARGS` -variable. - -These cases could be a serial terminal program if the machine is -connected to a local serial port, or a ``telnet`` or ``ssh`` command -connecting to a remote console server. Regardless of the case, the -command simply needs to connect to the serial console and forward that -connection to standard input and output as any normal terminal program -does. For example, to use the picocom terminal program on serial device -``/dev/ttyUSB0`` at 115200bps, you would set the variable as follows:: - - TEST_SERIALCONTROL_CMD = "picocom /dev/ttyUSB0 -b 115200" - -For local -devices where the serial port device disappears when the device reboots, -an additional "serdevtry" wrapper script is provided. To use this -wrapper, simply prefix the terminal command with -``${COREBASE}/scripts/contrib/serdevtry``:: - - TEST_SERIALCONTROL_CMD = "${COREBASE}/scripts/contrib/serdevtry picocom -b 115200 /dev/ttyUSB0" - -Running Tests -------------- - -You can start the tests automatically or manually: - -- *Automatically running tests:* To run the tests automatically after the - OpenEmbedded build system successfully creates an image, first set the - :term:`TESTIMAGE_AUTO` variable to "1" in your ``local.conf`` file in the - :term:`Build Directory`:: - - TESTIMAGE_AUTO = "1" - - Next, build your image. If the image successfully builds, the - tests run:: - - bitbake core-image-sato - -- *Manually running tests:* To manually run the tests, first globally - inherit the - :ref:`testimage ` class - by editing your ``local.conf`` file:: - - INHERIT += "testimage" - - Next, use BitBake to run the tests:: - - bitbake -c testimage image - -All test files reside in ``meta/lib/oeqa/runtime`` in the -:term:`Source Directory`. A test name maps -directly to a Python module. Each test module may contain a number of -individual tests. Tests are usually grouped together by the area tested -(e.g tests for systemd reside in ``meta/lib/oeqa/runtime/systemd.py``). - -You can add tests to any layer provided you place them in the proper -area and you extend :term:`BBPATH` in -the ``local.conf`` file as normal. Be sure that tests reside in -``layer/lib/oeqa/runtime``. - -.. note:: - - Be sure that module names do not collide with module names used in - the default set of test modules in ``meta/lib/oeqa/runtime``. - -You can change the set of tests run by appending or overriding -:term:`TEST_SUITES` variable in -``local.conf``. Each name in :term:`TEST_SUITES` represents a required test -for the image. Test modules named within :term:`TEST_SUITES` cannot be -skipped even if a test is not suitable for an image (e.g. running the -RPM tests on an image without ``rpm``). Appending "auto" to -:term:`TEST_SUITES` causes the build system to try to run all tests that are -suitable for the image (i.e. each test module may elect to skip itself). - -The order you list tests in :term:`TEST_SUITES` is important and influences -test dependencies. Consequently, tests that depend on other tests should -be added after the test on which they depend. For example, since the -``ssh`` test depends on the ``ping`` test, "ssh" needs to come after -"ping" in the list. The test class provides no re-ordering or dependency -handling. - -.. note:: - - Each module can have multiple classes with multiple test methods. - And, Python ``unittest`` rules apply. - -Here are some things to keep in mind when running tests: - -- The default tests for the image are defined as:: - - DEFAULT_TEST_SUITES:pn-image = "ping ssh df connman syslog xorg scp vnc date rpm dnf dmesg" - -- Add your own test to the list of the by using the following:: - - TEST_SUITES:append = " mytest" - -- Run a specific list of tests as follows:: - - TEST_SUITES = "test1 test2 test3" - - Remember, order is important. Be sure to place a test that is - dependent on another test later in the order. - -Exporting Tests ---------------- - -You can export tests so that they can run independently of the build -system. Exporting tests is required if you want to be able to hand the -test execution off to a scheduler. You can only export tests that are -defined in :term:`TEST_SUITES`. - -If your image is already built, make sure the following are set in your -``local.conf`` file:: - - INHERIT += "testexport" - TEST_TARGET_IP = "IP-address-for-the-test-target" - TEST_SERVER_IP = "IP-address-for-the-test-server" - -You can then export the tests with the -following BitBake command form:: - - $ bitbake image -c testexport - -Exporting the tests places them in the :term:`Build Directory` in -``tmp/testexport/``\ image, which is controlled by the :term:`TEST_EXPORT_DIR` -variable. - -You can now run the tests outside of the build environment:: - - $ cd tmp/testexport/image - $ ./runexported.py testdata.json - -Here is a complete example that shows IP addresses and uses the -``core-image-sato`` image:: - - INHERIT += "testexport" - TEST_TARGET_IP = "192.168.7.2" - TEST_SERVER_IP = "192.168.7.1" - -Use BitBake to export the tests:: - - $ bitbake core-image-sato -c testexport - -Run the tests outside of -the build environment using the following:: - - $ cd tmp/testexport/core-image-sato - $ ./runexported.py testdata.json - -Writing New Tests ------------------ - -As mentioned previously, all new test files need to be in the proper -place for the build system to find them. New tests for additional -functionality outside of the core should be added to the layer that adds -the functionality, in ``layer/lib/oeqa/runtime`` (as long as -:term:`BBPATH` is extended in the -layer's ``layer.conf`` file as normal). Just remember the following: - -- Filenames need to map directly to test (module) names. - -- Do not use module names that collide with existing core tests. - -- Minimally, an empty ``__init__.py`` file must be present in the runtime - directory. - -To create a new test, start by copying an existing module (e.g. -``syslog.py`` or ``gcc.py`` are good ones to use). Test modules can use -code from ``meta/lib/oeqa/utils``, which are helper classes. - -.. note:: - - Structure shell commands such that you rely on them and they return a - single code for success. Be aware that sometimes you will need to - parse the output. See the ``df.py`` and ``date.py`` modules for examples. - -You will notice that all test classes inherit ``oeRuntimeTest``, which -is found in ``meta/lib/oetest.py``. This base class offers some helper -attributes, which are described in the following sections: - -Class Methods -~~~~~~~~~~~~~ - -Class methods are as follows: - -- *hasPackage(pkg):* Returns "True" if ``pkg`` is in the installed - package list of the image, which is based on the manifest file that - is generated during the :ref:`ref-tasks-rootfs` task. - -- *hasFeature(feature):* Returns "True" if the feature is in - :term:`IMAGE_FEATURES` or - :term:`DISTRO_FEATURES`. - -Class Attributes -~~~~~~~~~~~~~~~~ - -Class attributes are as follows: - -- *pscmd:* Equals "ps -ef" if ``procps`` is installed in the image. - Otherwise, ``pscmd`` equals "ps" (busybox). - -- *tc:* The called test context, which gives access to the - following attributes: - - - *d:* The BitBake datastore, which allows you to use stuff such - as ``oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager")``. - - - *testslist and testsrequired:* Used internally. The tests - do not need these. - - - *filesdir:* The absolute path to - ``meta/lib/oeqa/runtime/files``, which contains helper files for - tests meant for copying on the target such as small files written - in C for compilation. - - - *target:* The target controller object used to deploy and - start an image on a particular target (e.g. Qemu, SimpleRemote, - and SystemdbootTarget). Tests usually use the following: - - - *ip:* The target's IP address. - - - *server_ip:* The host's IP address, which is usually used - by the DNF test suite. - - - *run(cmd, timeout=None):* The single, most used method. - This command is a wrapper for: ``ssh root@host "cmd"``. The - command returns a tuple: (status, output), which are what their - names imply - the return code of "cmd" and whatever output it - produces. The optional timeout argument represents the number - of seconds the test should wait for "cmd" to return. If the - argument is "None", the test uses the default instance's - timeout period, which is 300 seconds. If the argument is "0", - the test runs until the command returns. - - - *copy_to(localpath, remotepath):* - ``scp localpath root@ip:remotepath``. - - - *copy_from(remotepath, localpath):* - ``scp root@host:remotepath localpath``. - -Instance Attributes -~~~~~~~~~~~~~~~~~~~ - -There is a single instance attribute, which is ``target``. The ``target`` -instance attribute is identical to the class attribute of the same name, -which is described in the previous section. This attribute exists as -both an instance and class attribute so tests can use -``self.target.run(cmd)`` in instance methods instead of -``oeRuntimeTest.tc.target.run(cmd)``. - -Installing Packages in the DUT Without the Package Manager ----------------------------------------------------------- - -When a test requires a package built by BitBake, it is possible to -install that package. Installing the package does not require a package -manager be installed in the device under test (DUT). It does, however, -require an SSH connection and the target must be using the -``sshcontrol`` class. - -.. note:: - - This method uses ``scp`` to copy files from the host to the target, which - causes permissions and special attributes to be lost. - -A JSON file is used to define the packages needed by a test. This file -must be in the same path as the file used to define the tests. -Furthermore, the filename must map directly to the test module name with -a ``.json`` extension. - -The JSON file must include an object with the test name as keys of an -object or an array. This object (or array of objects) uses the following -data: - -- "pkg" --- a mandatory string that is the name of the package to be - installed. - -- "rm" --- an optional boolean, which defaults to "false", that specifies - to remove the package after the test. - -- "extract" --- an optional boolean, which defaults to "false", that - specifies if the package must be extracted from the package format. - When set to "true", the package is not automatically installed into - the DUT. - -Following is an example JSON file that handles test "foo" installing -package "bar" and test "foobar" installing packages "foo" and "bar". -Once the test is complete, the packages are removed from the DUT. -:: - - { - "foo": { - "pkg": "bar" - }, - "foobar": [ - { - "pkg": "foo", - "rm": true - }, - { - "pkg": "bar", - "rm": true - } - ] - } - -Debugging Tools and Techniques -============================== - -The exact method for debugging build failures depends on the nature of -the problem and on the system's area from which the bug originates. -Standard debugging practices such as comparison against the last known -working version with examination of the changes and the re-application -of steps to identify the one causing the problem are valid for the Yocto -Project just as they are for any other system. Even though it is -impossible to detail every possible potential failure, this section -provides some general tips to aid in debugging given a variety of -situations. - -.. note:: - - A useful feature for debugging is the error reporting tool. - Configuring the Yocto Project to use this tool causes the - OpenEmbedded build system to produce error reporting commands as part - of the console output. You can enter the commands after the build - completes to log error information into a common database, that can - help you figure out what might be going wrong. For information on how - to enable and use this feature, see the - ":ref:`dev-manual/common-tasks:using the error reporting tool`" - section. - -The following list shows the debugging topics in the remainder of this -section: - -- ":ref:`dev-manual/common-tasks:viewing logs from failed tasks`" describes - how to find and view logs from tasks that failed during the build - process. - -- ":ref:`dev-manual/common-tasks:viewing variable values`" describes how to - use the BitBake ``-e`` option to examine variable values after a - recipe has been parsed. - -- ":ref:`dev-manual/common-tasks:viewing package information with \`\`oe-pkgdata-util\`\``" - describes how to use the ``oe-pkgdata-util`` utility to query - :term:`PKGDATA_DIR` and - display package-related information for built packages. - -- ":ref:`dev-manual/common-tasks:viewing dependencies between recipes and tasks`" - describes how to use the BitBake ``-g`` option to display recipe - dependency information used during the build. - -- ":ref:`dev-manual/common-tasks:viewing task variable dependencies`" describes - how to use the ``bitbake-dumpsig`` command in conjunction with key - subdirectories in the :term:`Build Directory` to determine variable - dependencies. - -- ":ref:`dev-manual/common-tasks:running specific tasks`" describes - how to use several BitBake options (e.g. ``-c``, ``-C``, and ``-f``) - to run specific tasks in the build chain. It can be useful to run - tasks "out-of-order" when trying isolate build issues. - -- ":ref:`dev-manual/common-tasks:general BitBake problems`" describes how - to use BitBake's ``-D`` debug output option to reveal more about what - BitBake is doing during the build. - -- ":ref:`dev-manual/common-tasks:building with no dependencies`" - describes how to use the BitBake ``-b`` option to build a recipe - while ignoring dependencies. - -- ":ref:`dev-manual/common-tasks:recipe logging mechanisms`" - describes how to use the many recipe logging functions to produce - debugging output and report errors and warnings. - -- ":ref:`dev-manual/common-tasks:debugging parallel make races`" - describes how to debug situations where the build consists of several - parts that are run simultaneously and when the output or result of - one part is not ready for use with a different part of the build that - depends on that output. - -- ":ref:`dev-manual/common-tasks:debugging with the gnu project debugger (gdb) remotely`" - describes how to use GDB to allow you to examine running programs, which can - help you fix problems. - -- ":ref:`dev-manual/common-tasks:debugging with the gnu project debugger (gdb) on the target`" - describes how to use GDB directly on target hardware for debugging. - -- ":ref:`dev-manual/common-tasks:other debugging tips`" describes - miscellaneous debugging tips that can be useful. - -Viewing Logs from Failed Tasks ------------------------------- - -You can find the log for a task in the file -``${``\ :term:`WORKDIR`\ ``}/temp/log.do_``\ `taskname`. -For example, the log for the -:ref:`ref-tasks-compile` task of the -QEMU minimal image for the x86 machine (``qemux86``) might be in -``tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_compile``. -To see the commands :term:`BitBake` ran -to generate a log, look at the corresponding ``run.do_``\ `taskname` file -in the same directory. - -``log.do_``\ `taskname` and ``run.do_``\ `taskname` are actually symbolic -links to ``log.do_``\ `taskname`\ ``.``\ `pid` and -``log.run_``\ `taskname`\ ``.``\ `pid`, where `pid` is the PID the task had -when it ran. The symlinks always point to the files corresponding to the -most recent run. - -Viewing Variable Values ------------------------ - -Sometimes you need to know the value of a variable as a result of -BitBake's parsing step. This could be because some unexpected behavior -occurred in your project. Perhaps an attempt to :ref:`modify a variable -` did not work out as expected. - -BitBake's ``-e`` option is used to display variable values after -parsing. The following command displays the variable values after the -configuration files (i.e. ``local.conf``, ``bblayers.conf``, -``bitbake.conf`` and so forth) have been parsed:: - - $ bitbake -e - -The following command displays variable values after a specific recipe has -been parsed. The variables include those from the configuration as well:: - - $ bitbake -e recipename - -.. note:: - - Each recipe has its own private set of variables (datastore). - Internally, after parsing the configuration, a copy of the resulting - datastore is made prior to parsing each recipe. This copying implies - that variables set in one recipe will not be visible to other - recipes. - - Likewise, each task within a recipe gets a private datastore based on - the recipe datastore, which means that variables set within one task - will not be visible to other tasks. - -In the output of ``bitbake -e``, each variable is preceded by a -description of how the variable got its value, including temporary -values that were later overridden. This description also includes -variable flags (varflags) set on the variable. The output can be very -helpful during debugging. - -Variables that are exported to the environment are preceded by -``export`` in the output of ``bitbake -e``. See the following example:: - - export CC="i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/ulf/poky/build/tmp/sysroots/qemux86" - -In addition to variable values, the output of the ``bitbake -e`` and -``bitbake -e`` recipe commands includes the following information: - -- The output starts with a tree listing all configuration files and - classes included globally, recursively listing the files they include - or inherit in turn. Much of the behavior of the OpenEmbedded build - system (including the behavior of the :ref:`ref-manual/tasks:normal recipe build tasks`) is - implemented in the - :ref:`base ` class and the - classes it inherits, rather than being built into BitBake itself. - -- After the variable values, all functions appear in the output. For - shell functions, variables referenced within the function body are - expanded. If a function has been modified using overrides or using - override-style operators like ``:append`` and ``:prepend``, then the - final assembled function body appears in the output. - -Viewing Package Information with ``oe-pkgdata-util`` ----------------------------------------------------- - -You can use the ``oe-pkgdata-util`` command-line utility to query -:term:`PKGDATA_DIR` and display -various package-related information. When you use the utility, you must -use it to view information on packages that have already been built. - -Following are a few of the available ``oe-pkgdata-util`` subcommands. - -.. note:: - - You can use the standard \* and ? globbing wildcards as part of - package names and paths. - -- ``oe-pkgdata-util list-pkgs [pattern]``: Lists all packages - that have been built, optionally limiting the match to packages that - match pattern. - -- ``oe-pkgdata-util list-pkg-files package ...``: Lists the - files and directories contained in the given packages. - - .. note:: - - A different way to view the contents of a package is to look at - the - ``${``\ :term:`WORKDIR`\ ``}/packages-split`` - directory of the recipe that generates the package. This directory - is created by the - :ref:`ref-tasks-package` task - and has one subdirectory for each package the recipe generates, - which contains the files stored in that package. - - If you want to inspect the ``${WORKDIR}/packages-split`` - directory, make sure that - :ref:`rm_work ` is not - enabled when you build the recipe. - -- ``oe-pkgdata-util find-path path ...``: Lists the names of - the packages that contain the given paths. For example, the following - tells us that ``/usr/share/man/man1/make.1`` is contained in the - ``make-doc`` package:: - - $ oe-pkgdata-util find-path /usr/share/man/man1/make.1 - make-doc: /usr/share/man/man1/make.1 - -- ``oe-pkgdata-util lookup-recipe package ...``: Lists the name - of the recipes that produce the given packages. - -For more information on the ``oe-pkgdata-util`` command, use the help -facility:: - - $ oe-pkgdata-util --help - $ oe-pkgdata-util subcommand --help - -Viewing Dependencies Between Recipes and Tasks ----------------------------------------------- - -Sometimes it can be hard to see why BitBake wants to build other recipes -before the one you have specified. Dependency information can help you -understand why a recipe is built. - -To generate dependency information for a recipe, run the following -command:: - - $ bitbake -g recipename - -This command writes the following files in the current directory: - -- ``pn-buildlist``: A list of recipes/targets involved in building - `recipename`. "Involved" here means that at least one task from the - recipe needs to run when building `recipename` from scratch. Targets - that are in - :term:`ASSUME_PROVIDED` - are not listed. - -- ``task-depends.dot``: A graph showing dependencies between tasks. - -The graphs are in :wikipedia:`DOT ` -format and can be converted to images (e.g. using the ``dot`` tool from -`Graphviz `__). - -.. note:: - - - DOT files use a plain text format. The graphs generated using the - ``bitbake -g`` command are often so large as to be difficult to - read without special pruning (e.g. with BitBake's ``-I`` option) - and processing. Despite the form and size of the graphs, the - corresponding ``.dot`` files can still be possible to read and - provide useful information. - - As an example, the ``task-depends.dot`` file contains lines such - as the following:: - - "libxslt.do_configure" -> "libxml2.do_populate_sysroot" - - The above example line reveals that the - :ref:`ref-tasks-configure` - task in ``libxslt`` depends on the - :ref:`ref-tasks-populate_sysroot` - task in ``libxml2``, which is a normal - :term:`DEPENDS` dependency - between the two recipes. - - - For an example of how ``.dot`` files can be processed, see the - ``scripts/contrib/graph-tool`` Python script, which finds and - displays paths between graph nodes. - -You can use a different method to view dependency information by using -the following command:: - - $ bitbake -g -u taskexp recipename - -This command -displays a GUI window from which you can view build-time and runtime -dependencies for the recipes involved in building recipename. - -Viewing Task Variable Dependencies ----------------------------------- - -As mentioned in the -":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)`" section of the BitBake -User Manual, BitBake tries to automatically determine what variables a -task depends on so that it can rerun the task if any values of the -variables change. This determination is usually reliable. However, if -you do things like construct variable names at runtime, then you might -have to manually declare dependencies on those variables using -``vardeps`` as described in the -":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section of the BitBake -User Manual. - -If you are unsure whether a variable dependency is being picked up -automatically for a given task, you can list the variable dependencies -BitBake has determined by doing the following: - -1. Build the recipe containing the task:: - - $ bitbake recipename - -2. Inside the :term:`STAMPS_DIR` - directory, find the signature data (``sigdata``) file that - corresponds to the task. The ``sigdata`` files contain a pickled - Python database of all the metadata that went into creating the input - checksum for the task. As an example, for the - :ref:`ref-tasks-fetch` task of the - ``db`` recipe, the ``sigdata`` file might be found in the following - location:: - - ${BUILDDIR}/tmp/stamps/i586-poky-linux/db/6.0.30-r1.do_fetch.sigdata.7c048c18222b16ff0bcee2000ef648b1 - - For tasks that are accelerated through the shared state - (:ref:`sstate `) cache, an - additional ``siginfo`` file is written into - :term:`SSTATE_DIR` along with - the cached task output. The ``siginfo`` files contain exactly the - same information as ``sigdata`` files. - -3. Run ``bitbake-dumpsig`` on the ``sigdata`` or ``siginfo`` file. Here - is an example:: - - $ bitbake-dumpsig ${BUILDDIR}/tmp/stamps/i586-poky-linux/db/6.0.30-r1.do_fetch.sigdata.7c048c18222b16ff0bcee2000ef648b1 - - In the output of the above command, you will find a line like the - following, which lists all the (inferred) variable dependencies for - the task. This list also includes indirect dependencies from - variables depending on other variables, recursively. - :: - - Task dependencies: ['PV', 'SRCREV', 'SRC_URI', 'SRC_URI[md5sum]', 'SRC_URI[sha256sum]', 'base_do_fetch'] - - .. note:: - - Functions (e.g. ``base_do_fetch``) also count as variable dependencies. - These functions in turn depend on the variables they reference. - - The output of ``bitbake-dumpsig`` also includes the value each - variable had, a list of dependencies for each variable, and - :term:`BB_BASEHASH_IGNORE_VARS` - information. - -There is also a ``bitbake-diffsigs`` command for comparing two -``siginfo`` or ``sigdata`` files. This command can be helpful when -trying to figure out what changed between two versions of a task. If you -call ``bitbake-diffsigs`` with just one file, the command behaves like -``bitbake-dumpsig``. - -You can also use BitBake to dump out the signature construction -information without executing tasks by using either of the following -BitBake command-line options:: - - ‐‐dump-signatures=SIGNATURE_HANDLER - -S SIGNATURE_HANDLER - - -.. note:: - - Two common values for `SIGNATURE_HANDLER` are "none" and "printdiff", which - dump only the signature or compare the dumped signature with the cached one, - respectively. - -Using BitBake with either of these options causes BitBake to dump out -``sigdata`` files in the ``stamps`` directory for every task it would -have executed instead of building the specified target package. - -Viewing Metadata Used to Create the Input Signature of a Shared State Task --------------------------------------------------------------------------- - -Seeing what metadata went into creating the input signature of a shared -state (sstate) task can be a useful debugging aid. This information is -available in signature information (``siginfo``) files in -:term:`SSTATE_DIR`. For -information on how to view and interpret information in ``siginfo`` -files, see the -":ref:`dev-manual/common-tasks:viewing task variable dependencies`" section. - -For conceptual information on shared state, see the -":ref:`overview-manual/concepts:shared state`" -section in the Yocto Project Overview and Concepts Manual. - -Invalidating Shared State to Force a Task to Run ------------------------------------------------- - -The OpenEmbedded build system uses -:ref:`checksums ` and -:ref:`overview-manual/concepts:shared state` cache to avoid unnecessarily -rebuilding tasks. Collectively, this scheme is known as "shared state -code". - -As with all schemes, this one has some drawbacks. It is possible that -you could make implicit changes to your code that the checksum -calculations do not take into account. These implicit changes affect a -task's output but do not trigger the shared state code into rebuilding a -recipe. Consider an example during which a tool changes its output. -Assume that the output of ``rpmdeps`` changes. The result of the change -should be that all the ``package`` and ``package_write_rpm`` shared -state cache items become invalid. However, because the change to the -output is external to the code and therefore implicit, the associated -shared state cache items do not become invalidated. In this case, the -build process uses the cached items rather than running the task again. -Obviously, these types of implicit changes can cause problems. - -To avoid these problems during the build, you need to understand the -effects of any changes you make. Realize that changes you make directly -to a function are automatically factored into the checksum calculation. -Thus, these explicit changes invalidate the associated area of shared -state cache. However, you need to be aware of any implicit changes that -are not obvious changes to the code and could affect the output of a -given task. - -When you identify an implicit change, you can easily take steps to -invalidate the cache and force the tasks to run. The steps you can take -are as simple as changing a function's comments in the source code. For -example, to invalidate package shared state files, change the comment -statements of -:ref:`ref-tasks-package` or the -comments of one of the functions it calls. Even though the change is -purely cosmetic, it causes the checksum to be recalculated and forces -the build system to run the task again. - -.. note:: - - For an example of a commit that makes a cosmetic change to invalidate - shared state, see this - :yocto_git:`commit `. - -Running Specific Tasks ----------------------- - -Any given recipe consists of a set of tasks. The standard BitBake -behavior in most cases is: :ref:`ref-tasks-fetch`, :ref:`ref-tasks-unpack`, :ref:`ref-tasks-patch`, -:ref:`ref-tasks-configure`, :ref:`ref-tasks-compile`, :ref:`ref-tasks-install`, :ref:`ref-tasks-package`, -:ref:`do_package_write_* `, and :ref:`ref-tasks-build`. The default task is -:ref:`ref-tasks-build` and any tasks on which it depends build first. Some tasks, -such as :ref:`ref-tasks-devshell`, are not part of the default build chain. If you -wish to run a task that is not part of the default build chain, you can -use the ``-c`` option in BitBake. Here is an example:: - - $ bitbake matchbox-desktop -c devshell - -The ``-c`` option respects task dependencies, which means that all other -tasks (including tasks from other recipes) that the specified task -depends on will be run before the task. Even when you manually specify a -task to run with ``-c``, BitBake will only run the task if it considers -it "out of date". See the -":ref:`overview-manual/concepts:stamp files and the rerunning of tasks`" -section in the Yocto Project Overview and Concepts Manual for how -BitBake determines whether a task is "out of date". - -If you want to force an up-to-date task to be rerun (e.g. because you -made manual modifications to the recipe's -:term:`WORKDIR` that you want to try -out), then you can use the ``-f`` option. - -.. note:: - - The reason ``-f`` is never required when running the - :ref:`ref-tasks-devshell` task is because the - [\ :ref:`nostamp `\ ] - variable flag is already set for the task. - -The following example shows one way you can use the ``-f`` option:: - - $ bitbake matchbox-desktop - . - . - make some changes to the source code in the work directory - . - . - $ bitbake matchbox-desktop -c compile -f - $ bitbake matchbox-desktop - -This sequence first builds and then recompiles ``matchbox-desktop``. The -last command reruns all tasks (basically the packaging tasks) after the -compile. BitBake recognizes that the :ref:`ref-tasks-compile` task was rerun and -therefore understands that the other tasks also need to be run again. - -Another, shorter way to rerun a task and all -:ref:`ref-manual/tasks:normal recipe build tasks` -that depend on it is to use the ``-C`` option. - -.. note:: - - This option is upper-cased and is separate from the ``-c`` - option, which is lower-cased. - -Using this option invalidates the given task and then runs the -:ref:`ref-tasks-build` task, which is -the default task if no task is given, and the tasks on which it depends. -You could replace the final two commands in the previous example with -the following single command:: - - $ bitbake matchbox-desktop -C compile - -Internally, the ``-f`` and ``-C`` options work by tainting (modifying) -the input checksum of the specified task. This tainting indirectly -causes the task and its dependent tasks to be rerun through the normal -task dependency mechanisms. - -.. note:: - - BitBake explicitly keeps track of which tasks have been tainted in - this fashion, and will print warnings such as the following for - builds involving such tasks: - - .. code-block:: none - - WARNING: /home/ulf/poky/meta/recipes-sato/matchbox-desktop/matchbox-desktop_2.1.bb.do_compile is tainted from a forced run - - - The purpose of the warning is to let you know that the work directory - and build output might not be in the clean state they would be in for - a "normal" build, depending on what actions you took. To get rid of - such warnings, you can remove the work directory and rebuild the - recipe, as follows:: - - $ bitbake matchbox-desktop -c clean - $ bitbake matchbox-desktop - - -You can view a list of tasks in a given package by running the -:ref:`ref-tasks-listtasks` task as follows:: - - $ bitbake matchbox-desktop -c listtasks - -The results appear as output to the console and are also in -the file ``${WORKDIR}/temp/log.do_listtasks``. - -General BitBake Problems ------------------------- - -You can see debug output from BitBake by using the ``-D`` option. The -debug output gives more information about what BitBake is doing and the -reason behind it. Each ``-D`` option you use increases the logging -level. The most common usage is ``-DDD``. - -The output from ``bitbake -DDD -v targetname`` can reveal why BitBake -chose a certain version of a package or why BitBake picked a certain -provider. This command could also help you in a situation where you -think BitBake did something unexpected. - -Building with No Dependencies ------------------------------ - -To build a specific recipe (``.bb`` file), you can use the following -command form:: - - $ bitbake -b somepath/somerecipe.bb - -This command form does -not check for dependencies. Consequently, you should use it only when -you know existing dependencies have been met. - -.. note:: - - You can also specify fragments of the filename. In this case, BitBake - checks for a unique match. - -Recipe Logging Mechanisms -------------------------- - -The Yocto Project provides several logging functions for producing -debugging output and reporting errors and warnings. For Python -functions, the following logging functions are available. All of these functions -log to ``${T}/log.do_``\ `task`, and can also log to standard output -(stdout) with the right settings: - -- ``bb.plain(msg)``: Writes msg as is to the log while also - logging to stdout. - -- ``bb.note(msg)``: Writes "NOTE: msg" to the log. Also logs to - stdout if BitBake is called with "-v". - -- ``bb.debug(level, msg)``: Writes "DEBUG: msg" to the - log. Also logs to stdout if the log level is greater than or equal to - level. See the ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-intro:usage and syntax`" option - in the BitBake User Manual for more information. - -- ``bb.warn(msg)``: Writes "WARNING: msg" to the log while also - logging to stdout. - -- ``bb.error(msg)``: Writes "ERROR: msg" to the log while also - logging to standard out (stdout). - - .. note:: - - Calling this function does not cause the task to fail. - -- ``bb.fatal(msg)``: This logging function is similar to - ``bb.error(msg)`` but also causes the calling task to fail. - - .. note:: - - ``bb.fatal()`` raises an exception, which means you do not need to put a - "return" statement after the function. - -The same logging functions are also available in shell functions, under -the names ``bbplain``, ``bbnote``, ``bbdebug``, ``bbwarn``, ``bberror``, -and ``bbfatal``. The -:ref:`logging ` class -implements these functions. See that class in the ``meta/classes`` -folder of the :term:`Source Directory` for information. - -Logging With Python -~~~~~~~~~~~~~~~~~~~ - -When creating recipes using Python and inserting code that handles build -logs, keep in mind the goal is to have informative logs while keeping -the console as "silent" as possible. Also, if you want status messages -in the log, use the "debug" loglevel. - -Following is an example written in Python. The code handles logging for -a function that determines the number of tasks needed to be run. See the -":ref:`ref-tasks-listtasks`" -section for additional information:: - - python do_listtasks() { - bb.debug(2, "Starting to figure out the task list") - if noteworthy_condition: - bb.note("There are 47 tasks to run") - bb.debug(2, "Got to point xyz") - if warning_trigger: - bb.warn("Detected warning_trigger, this might be a problem later.") - if recoverable_error: - bb.error("Hit recoverable_error, you really need to fix this!") - if fatal_error: - bb.fatal("fatal_error detected, unable to print the task list") - bb.plain("The tasks present are abc") - bb.debug(2, "Finished figuring out the tasklist") - } - -Logging With Bash -~~~~~~~~~~~~~~~~~ - -When creating recipes using Bash and inserting code that handles build -logs, you have the same goals --- informative with minimal console output. -The syntax you use for recipes written in Bash is similar to that of -recipes written in Python described in the previous section. - -Following is an example written in Bash. The code logs the progress of -the ``do_my_function`` function. -:: - - do_my_function() { - bbdebug 2 "Running do_my_function" - if [ exceptional_condition ]; then - bbnote "Hit exceptional_condition" - fi - bbdebug 2 "Got to point xyz" - if [ warning_trigger ]; then - bbwarn "Detected warning_trigger, this might cause a problem later." - fi - if [ recoverable_error ]; then - bberror "Hit recoverable_error, correcting" - fi - if [ fatal_error ]; then - bbfatal "fatal_error detected" - fi - bbdebug 2 "Completed do_my_function" - } - - -Debugging Parallel Make Races ------------------------------ - -A parallel ``make`` race occurs when the build consists of several parts -that are run simultaneously and a situation occurs when the output or -result of one part is not ready for use with a different part of the -build that depends on that output. Parallel make races are annoying and -can sometimes be difficult to reproduce and fix. However, there are some simple -tips and tricks that can help you debug and fix them. This section -presents a real-world example of an error encountered on the Yocto -Project autobuilder and the process used to fix it. - -.. note:: - - If you cannot properly fix a ``make`` race condition, you can work around it - by clearing either the :term:`PARALLEL_MAKE` or :term:`PARALLEL_MAKEINST` - variables. - -The Failure -~~~~~~~~~~~ - -For this example, assume that you are building an image that depends on -the "neard" package. And, during the build, BitBake runs into problems -and creates the following output. - -.. note:: - - This example log file has longer lines artificially broken to make - the listing easier to read. - -If you examine the output or the log file, you see the failure during -``make``: - -.. code-block:: none - - | DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common'] - | DEBUG: Executing shell function do_compile - | NOTE: make -j 16 - | make --no-print-directory all-am - | /bin/mkdir -p include/near - | /bin/mkdir -p include/near - | /bin/mkdir -p include/near - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/types.h include/near/types.h - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/log.h include/near/log.h - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/plugin.h include/near/plugin.h - | /bin/mkdir -p include/near - | /bin/mkdir -p include/near - | /bin/mkdir -p include/near - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/tag.h include/near/tag.h - | /bin/mkdir -p include/near - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/adapter.h include/near/adapter.h - | /bin/mkdir -p include/near - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/ndef.h include/near/ndef.h - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/tlv.h include/near/tlv.h - | /bin/mkdir -p include/near - | /bin/mkdir -p include/near - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/setting.h include/near/setting.h - | /bin/mkdir -p include/near - | /bin/mkdir -p include/near - | /bin/mkdir -p include/near - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/device.h include/near/device.h - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/nfc_copy.h include/near/nfc_copy.h - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/snep.h include/near/snep.h - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/version.h include/near/version.h - | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ - 0.14-r0/neard-0.14/include/dbus.h include/near/dbus.h - | ./src/genbuiltin nfctype1 nfctype2 nfctype3 nfctype4 p2p > src/builtin.h - | i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/pokybuild/yocto-autobuilder/nightly-x86/ - build/build/tmp/sysroots/qemux86 -DHAVE_CONFIG_H -I. -I./include -I./src -I./gdbus -I/home/pokybuild/ - yocto-autobuilder/nightly-x86/build/build/tmp/sysroots/qemux86/usr/include/glib-2.0 - -I/home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/sysroots/qemux86/usr/ - lib/glib-2.0/include -I/home/pokybuild/yocto-autobuilder/nightly-x86/build/build/ - tmp/sysroots/qemux86/usr/include/dbus-1.0 -I/home/pokybuild/yocto-autobuilder/ - nightly-x86/build/build/tmp/sysroots/qemux86/usr/lib/dbus-1.0/include -I/home/pokybuild/yocto-autobuilder/ - nightly-x86/build/build/tmp/sysroots/qemux86/usr/include/libnl3 - -DNEAR_PLUGIN_BUILTIN -DPLUGINDIR=\""/usr/lib/near/plugins"\" - -DCONFIGDIR=\""/etc/neard\"" -O2 -pipe -g -feliminate-unused-debug-types -c - -o tools/snep-send.o tools/snep-send.c - | In file included from tools/snep-send.c:16:0: - | tools/../src/near.h:41:23: fatal error: near/dbus.h: No such file or directory - | #include - | ^ - | compilation terminated. - | make[1]: *** [tools/snep-send.o] Error 1 - | make[1]: *** Waiting for unfinished jobs.... - | make: *** [all] Error 2 - | ERROR: oe_runmake failed - -Reproducing the Error -~~~~~~~~~~~~~~~~~~~~~ - -Because race conditions are intermittent, they do not manifest -themselves every time you do the build. In fact, most times the build -will complete without problems even though the potential race condition -exists. Thus, once the error surfaces, you need a way to reproduce it. - -In this example, compiling the "neard" package is causing the problem. -So the first thing to do is build "neard" locally. Before you start the -build, set the -:term:`PARALLEL_MAKE` variable -in your ``local.conf`` file to a high number (e.g. "-j 20"). Using a -high value for :term:`PARALLEL_MAKE` increases the chances of the race -condition showing up:: - - $ bitbake neard - -Once the local build for "neard" completes, start a ``devshell`` build:: - - $ bitbake neard -c devshell - -For information on how to use a ``devshell``, see the -":ref:`dev-manual/common-tasks:using a development shell`" section. - -In the ``devshell``, do the following:: - - $ make clean - $ make tools/snep-send.o - -The ``devshell`` commands cause the failure to clearly -be visible. In this case, there is a missing dependency for the ``neard`` -Makefile target. Here is some abbreviated, sample output with the -missing dependency clearly visible at the end:: - - i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/scott-lenovo/...... - . - . - . - tools/snep-send.c - In file included from tools/snep-send.c:16:0: - tools/../src/near.h:41:23: fatal error: near/dbus.h: No such file or directory - #include - ^ - compilation terminated. - make: *** [tools/snep-send.o] Error 1 - $ - - -Creating a Patch for the Fix -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Because there is a missing dependency for the Makefile target, you need -to patch the ``Makefile.am`` file, which is generated from -``Makefile.in``. You can use Quilt to create the patch:: - - $ quilt new parallelmake.patch - Patch patches/parallelmake.patch is now on top - $ quilt add Makefile.am - File Makefile.am added to patch patches/parallelmake.patch - -For more information on using Quilt, see the -":ref:`dev-manual/common-tasks:using quilt in your workflow`" section. - -At this point you need to make the edits to ``Makefile.am`` to add the -missing dependency. For our example, you have to add the following line -to the file:: - - tools/snep-send.$(OBJEXT): include/near/dbus.h - -Once you have edited the file, use the ``refresh`` command to create the -patch:: - - $ quilt refresh - Refreshed patch patches/parallelmake.patch - -Once the patch file is created, you need to add it back to the originating -recipe folder. Here is an example assuming a top-level -:term:`Source Directory` named ``poky``:: - - $ cp patches/parallelmake.patch poky/meta/recipes-connectivity/neard/neard - -The final thing you need to do to implement the fix in the build is to -update the "neard" recipe (i.e. ``neard-0.14.bb``) so that the -:term:`SRC_URI` statement includes -the patch file. The recipe file is in the folder above the patch. Here -is what the edited :term:`SRC_URI` statement would look like:: - - SRC_URI = "${KERNELORG_MIRROR}/linux/network/nfc/${BPN}-${PV}.tar.xz \ - file://neard.in \ - file://neard.service.in \ - file://parallelmake.patch \ - " - -With the patch complete and moved to the correct folder and the -:term:`SRC_URI` statement updated, you can exit the ``devshell``:: - - $ exit - -Testing the Build -~~~~~~~~~~~~~~~~~ - -With everything in place, you can get back to trying the build again -locally:: - - $ bitbake neard - -This build should succeed. - -Now you can open up a ``devshell`` again and repeat the clean and make -operations as follows:: - - $ bitbake neard -c devshell - $ make clean - $ make tools/snep-send.o - -The build should work without issue. - -As with all solved problems, if they originated upstream, you need to -submit the fix for the recipe in OE-Core and upstream so that the -problem is taken care of at its source. See the -":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" -section for more information. - -Debugging With the GNU Project Debugger (GDB) Remotely ------------------------------------------------------- - -GDB allows you to examine running programs, which in turn helps you to -understand and fix problems. It also allows you to perform post-mortem -style analysis of program crashes. GDB is available as a package within -the Yocto Project and is installed in SDK images by default. See the -":ref:`ref-manual/images:Images`" chapter in the Yocto -Project Reference Manual for a description of these images. You can find -information on GDB at https://sourceware.org/gdb/. - -.. note:: - - For best results, install debug (``-dbg``) packages for the applications you - are going to debug. Doing so makes extra debug symbols available that give - you more meaningful output. - -Sometimes, due to memory or disk space constraints, it is not possible -to use GDB directly on the remote target to debug applications. These -constraints arise because GDB needs to load the debugging information -and the binaries of the process being debugged. Additionally, GDB needs -to perform many computations to locate information such as function -names, variable names and values, stack traces and so forth --- even -before starting the debugging process. These extra computations place -more load on the target system and can alter the characteristics of the -program being debugged. - -To help get past the previously mentioned constraints, there are two -methods you can use: running a debuginfod server and using gdbserver. - -Using the debuginfod server method -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``debuginfod`` from ``elfutils`` is a way to distribute ``debuginfo`` files. -Running a ``debuginfod`` server makes debug symbols readily available, -which means you don't need to download debugging information -and the binaries of the process being debugged. You can just fetch -debug symbols from the server. - -To run a ``debuginfod`` server, you need to do the following: - -- Ensure that ``debuginfod`` is present in :term:`DISTRO_FEATURES` - (it already is in ``OpenEmbedded-core`` defaults and ``poky`` reference distribution). - If not, set in your distro config file or in ``local.conf``:: - - DISTRO_FEATURES:append = " debuginfod" - - This distro feature enables the server and client library in ``elfutils``, - and enables ``debuginfod`` support in clients (at the moment, ``gdb`` and ``binutils``). - -- Run the following commands to launch the ``debuginfod`` server on the host:: - - $ oe-debuginfod - -- To use ``debuginfod`` on the target, you need to know the ip:port where - ``debuginfod`` is listening on the host (port defaults to 8002), and export - that into the shell environment, for example in ``qemu``:: - - root@qemux86-64:~# export DEBUGINFOD_URLS="http://192.168.7.1:8002/" - -- Then debug info fetching should simply work when running the target ``gdb``, - ``readelf`` or ``objdump``, for example:: - - root@qemux86-64:~# gdb /bin/cat - ... - Reading symbols from /bin/cat... - Downloading separate debug info for /bin/cat... - Reading symbols from /home/root/.cache/debuginfod_client/923dc4780cfbc545850c616bffa884b6b5eaf322/debuginfo... - -- It's also possible to use ``debuginfod-find`` to just query the server:: - - root@qemux86-64:~# debuginfod-find debuginfo /bin/ls - /home/root/.cache/debuginfod_client/356edc585f7f82d46f94fcb87a86a3fe2d2e60bd/debuginfo - - -Using the gdbserver method -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -gdbserver, which runs on the remote target and does not load any -debugging information from the debugged process. Instead, a GDB instance -processes the debugging information that is run on a remote computer - -the host GDB. The host GDB then sends control commands to gdbserver to -make it stop or start the debugged program, as well as read or write -memory regions of that debugged program. All the debugging information -loaded and processed as well as all the heavy debugging is done by the -host GDB. Offloading these processes gives the gdbserver running on the -target a chance to remain small and fast. - -Because the host GDB is responsible for loading the debugging -information and for doing the necessary processing to make actual -debugging happen, you have to make sure the host can access the -unstripped binaries complete with their debugging information and also -be sure the target is compiled with no optimizations. The host GDB must -also have local access to all the libraries used by the debugged -program. Because gdbserver does not need any local debugging -information, the binaries on the remote target can remain stripped. -However, the binaries must also be compiled without optimization so they -match the host's binaries. - -To remain consistent with GDB documentation and terminology, the binary -being debugged on the remote target machine is referred to as the -"inferior" binary. For documentation on GDB see the `GDB -site `__. - -The following steps show you how to debug using the GNU project -debugger. - -1. *Configure your build system to construct the companion debug - filesystem:* - - In your ``local.conf`` file, set the following:: - - IMAGE_GEN_DEBUGFS = "1" - IMAGE_FSTYPES_DEBUGFS = "tar.bz2" - - These options cause the - OpenEmbedded build system to generate a special companion filesystem - fragment, which contains the matching source and debug symbols to - your deployable filesystem. The build system does this by looking at - what is in the deployed filesystem, and pulling the corresponding - ``-dbg`` packages. - - The companion debug filesystem is not a complete filesystem, but only - contains the debug fragments. This filesystem must be combined with - the full filesystem for debugging. Subsequent steps in this procedure - show how to combine the partial filesystem with the full filesystem. - -2. *Configure the system to include gdbserver in the target filesystem:* - - Make the following addition in your ``local.conf`` file:: - - EXTRA_IMAGE_FEATURES:append = " tools-debug" - - The change makes - sure the ``gdbserver`` package is included. - -3. *Build the environment:* - - Use the following command to construct the image and the companion - Debug Filesystem:: - - $ bitbake image - - Build the cross GDB component and - make it available for debugging. Build the SDK that matches the - image. Building the SDK is best for a production build that can be - used later for debugging, especially during long term maintenance:: - - $ bitbake -c populate_sdk image - - Alternatively, you can build the minimal toolchain components that - match the target. Doing so creates a smaller than typical SDK and - only contains a minimal set of components with which to build simple - test applications, as well as run the debugger:: - - $ bitbake meta-toolchain - - A final method is to build Gdb itself within the build system:: - - $ bitbake gdb-cross- - - Doing so produces a temporary copy of - ``cross-gdb`` you can use for debugging during development. While - this is the quickest approach, the two previous methods in this step - are better when considering long-term maintenance strategies. - - .. note:: - - If you run ``bitbake gdb-cross``, the OpenEmbedded build system suggests - the actual image (e.g. ``gdb-cross-i586``). The suggestion is usually the - actual name you want to use. - -4. *Set up the* ``debugfs``\ *:* - - Run the following commands to set up the ``debugfs``:: - - $ mkdir debugfs - $ cd debugfs - $ tar xvfj build-dir/tmp/deploy/images/machine/image.rootfs.tar.bz2 - $ tar xvfj build-dir/tmp/deploy/images/machine/image-dbg.rootfs.tar.bz2 - -5. *Set up GDB:* - - Install the SDK (if you built one) and then source the correct - environment file. Sourcing the environment file puts the SDK in your - ``PATH`` environment variable and sets ``$GDB`` to the SDK's debugger. - - If you are using the build system, Gdb is located in - `build-dir`\ ``/tmp/sysroots/``\ `host`\ ``/usr/bin/``\ `architecture`\ ``/``\ `architecture`\ ``-gdb`` - -6. *Boot the target:* - - For information on how to run QEMU, see the `QEMU - Documentation `__. - - .. note:: - - Be sure to verify that your host can access the target via TCP. - -7. *Debug a program:* - - Debugging a program involves running gdbserver on the target and then - running Gdb on the host. The example in this step debugs ``gzip``: - - .. code-block:: shell - - root@qemux86:~# gdbserver localhost:1234 /bin/gzip —help - - For - additional gdbserver options, see the `GDB Server - Documentation `__. - - After running gdbserver on the target, you need to run Gdb on the - host and configure it and connect to the target. Use these commands:: - - $ cd directory-holding-the-debugfs-directory - $ arch-gdb - (gdb) set sysroot debugfs - (gdb) set substitute-path /usr/src/debug debugfs/usr/src/debug - (gdb) target remote IP-of-target:1234 - - At this - point, everything should automatically load (i.e. matching binaries, - symbols and headers). - - .. note:: - - The Gdb ``set`` commands in the previous example can be placed into the - users ``~/.gdbinit`` file. Upon starting, Gdb automatically runs whatever - commands are in that file. - -8. *Deploying without a full image rebuild:* - - In many cases, during development you want a quick method to deploy a - new binary to the target and debug it, without waiting for a full - image build. - - One approach to solving this situation is to just build the component - you want to debug. Once you have built the component, copy the - executable directly to both the target and the host ``debugfs``. - - If the binary is processed through the debug splitting in - OpenEmbedded, you should also copy the debug items (i.e. ``.debug`` - contents and corresponding ``/usr/src/debug`` files) from the work - directory. Here is an example:: - - $ bitbake bash - $ bitbake -c devshell bash - $ cd .. - $ scp packages-split/bash/bin/bash target:/bin/bash - $ cp -a packages-split/bash-dbg/\* path/debugfs - -Debugging with the GNU Project Debugger (GDB) on the Target ------------------------------------------------------------ - -The previous section addressed using GDB remotely for debugging -purposes, which is the most usual case due to the inherent hardware -limitations on many embedded devices. However, debugging in the target -hardware itself is also possible with more powerful devices. This -section describes what you need to do in order to support using GDB to -debug on the target hardware. - -To support this kind of debugging, you need do the following: - -- Ensure that GDB is on the target. You can do this by making - the following addition to your ``local.conf`` file:: - - EXTRA_IMAGE_FEATURES:append = " tools-debug" - -- Ensure that debug symbols are present. You can do so by adding the - corresponding ``-dbg`` package to :term:`IMAGE_INSTALL`:: - - IMAGE_INSTALL:append = " packagename-dbg" - - Alternatively, you can add the following to ``local.conf`` to include - all the debug symbols:: - - EXTRA_IMAGE_FEATURES:append = " dbg-pkgs" - -.. note:: - - To improve the debug information accuracy, you can reduce the level - of optimization used by the compiler. For example, when adding the - following line to your ``local.conf`` file, you will reduce optimization - from :term:`FULL_OPTIMIZATION` of "-O2" to :term:`DEBUG_OPTIMIZATION` - of "-O -fno-omit-frame-pointer":: - - DEBUG_BUILD = "1" - - Consider that this will reduce the application's performance and is - recommended only for debugging purposes. - -Other Debugging Tips --------------------- - -Here are some other tips that you might find useful: - -- When adding new packages, it is worth watching for undesirable items - making their way into compiler command lines. For example, you do not - want references to local system files like ``/usr/lib/`` or - ``/usr/include/``. - -- If you want to remove the ``psplash`` boot splashscreen, add - ``psplash=false`` to the kernel command line. Doing so prevents - ``psplash`` from loading and thus allows you to see the console. It - is also possible to switch out of the splashscreen by switching the - virtual console (e.g. Fn+Left or Fn+Right on a Zaurus). - -- Removing :term:`TMPDIR` (usually ``tmp/``, within the - :term:`Build Directory`) can often fix temporary build issues. Removing - :term:`TMPDIR` is usually a relatively cheap operation, because task output - will be cached in :term:`SSTATE_DIR` (usually ``sstate-cache/``, which is - also in the :term:`Build Directory`). - - .. note:: - - Removing :term:`TMPDIR` might be a workaround rather than a fix. - Consequently, trying to determine the underlying cause of an issue before - removing the directory is a good idea. - -- Understanding how a feature is used in practice within existing - recipes can be very helpful. It is recommended that you configure - some method that allows you to quickly search through files. - - Using GNU Grep, you can use the following shell function to - recursively search through common recipe-related files, skipping - binary files, ``.git`` directories, and the :term:`Build Directory` - (assuming its name starts with "build"):: - - g() { - grep -Ir \ - --exclude-dir=.git \ - --exclude-dir='build*' \ - --include='*.bb*' \ - --include='*.inc*' \ - --include='*.conf*' \ - --include='*.py*' \ - "$@" - } - - Following are some usage examples:: - - $ g FOO # Search recursively for "FOO" - $ g -i foo # Search recursively for "foo", ignoring case - $ g -w FOO # Search recursively for "FOO" as a word, ignoring e.g. "FOOBAR" - - If figuring - out how some feature works requires a lot of searching, it might - indicate that the documentation should be extended or improved. In - such cases, consider filing a documentation bug using the Yocto - Project implementation of - :yocto_bugs:`Bugzilla <>`. For information on - how to submit a bug against the Yocto Project, see the Yocto Project - Bugzilla :yocto_wiki:`wiki page ` - and the - ":ref:`dev-manual/common-tasks:submitting a defect against the yocto project`" - section. - - .. note:: - - The manuals might not be the right place to document variables - that are purely internal and have a limited scope (e.g. internal - variables used to implement a single ``.bbclass`` file). - -Making Changes to the Yocto Project -=================================== - -Because the Yocto Project is an open-source, community-based project, -you can effect changes to the project. This section presents procedures -that show you how to submit a defect against the project and how to -submit a change. - -Submitting a Defect Against the Yocto Project ---------------------------------------------- - -Use the Yocto Project implementation of -`Bugzilla `__ to submit a defect (bug) -against the Yocto Project. For additional information on this -implementation of Bugzilla see the ":ref:`Yocto Project -Bugzilla `" section in the -Yocto Project Reference Manual. For more detail on any of the following -steps, see the Yocto Project -:yocto_wiki:`Bugzilla wiki page `. - -Use the following general steps to submit a bug: - -1. Open the Yocto Project implementation of :yocto_bugs:`Bugzilla <>`. - -2. Click "File a Bug" to enter a new bug. - -3. Choose the appropriate "Classification", "Product", and "Component" - for which the bug was found. Bugs for the Yocto Project fall into - one of several classifications, which in turn break down into - several products and components. For example, for a bug against the - ``meta-intel`` layer, you would choose "Build System, Metadata & - Runtime", "BSPs", and "bsps-meta-intel", respectively. - -4. Choose the "Version" of the Yocto Project for which you found the - bug (e.g. &DISTRO;). - -5. Determine and select the "Severity" of the bug. The severity - indicates how the bug impacted your work. - -6. Choose the "Hardware" that the bug impacts. - -7. Choose the "Architecture" that the bug impacts. - -8. Choose a "Documentation change" item for the bug. Fixing a bug might - or might not affect the Yocto Project documentation. If you are - unsure of the impact to the documentation, select "Don't Know". - -9. Provide a brief "Summary" of the bug. Try to limit your summary to - just a line or two and be sure to capture the essence of the bug. - -10. Provide a detailed "Description" of the bug. You should provide as - much detail as you can about the context, behavior, output, and so - forth that surrounds the bug. You can even attach supporting files - for output from logs by using the "Add an attachment" button. - -11. Click the "Submit Bug" button submit the bug. A new Bugzilla number - is assigned to the bug and the defect is logged in the bug tracking - system. - -Once you file a bug, the bug is processed by the Yocto Project Bug -Triage Team and further details concerning the bug are assigned (e.g. -priority and owner). You are the "Submitter" of the bug and any further -categorization, progress, or comments on the bug result in Bugzilla -sending you an automated email concerning the particular change or -progress to the bug. - -Submitting a Change to the Yocto Project ----------------------------------------- - -Contributions to the Yocto Project and OpenEmbedded are very welcome. -Because the system is extremely configurable and flexible, we recognize -that developers will want to extend, configure or optimize it for their -specific uses. - -The Yocto Project uses a mailing list and a patch-based workflow that is -similar to the Linux kernel but contains important differences. In -general, there is a mailing list through which you can submit patches. You -should send patches to the appropriate mailing list so that they can be -reviewed and merged by the appropriate maintainer. The specific mailing -list you need to use depends on the location of the code you are -changing. Each component (e.g. layer) should have a ``README`` file that -indicates where to send the changes and which process to follow. - -You can send the patch to the mailing list using whichever approach you -feel comfortable with to generate the patch. Once sent, the patch is -usually reviewed by the community at large. If somebody has concerns -with the patch, they will usually voice their concern over the mailing -list. If a patch does not receive any negative reviews, the maintainer -of the affected layer typically takes the patch, tests it, and then -based on successful testing, merges the patch. - -The "poky" repository, which is the Yocto Project's reference build -environment, is a hybrid repository that contains several individual -pieces (e.g. BitBake, Metadata, documentation, and so forth) built using -the combo-layer tool. The upstream location used for submitting changes -varies by component: - -- *Core Metadata:* Send your patch to the - :oe_lists:`openembedded-core ` - mailing list. For example, a change to anything under the ``meta`` or - ``scripts`` directories should be sent to this mailing list. - -- *BitBake:* For changes to BitBake (i.e. anything under the - ``bitbake`` directory), send your patch to the - :oe_lists:`bitbake-devel ` - mailing list. - -- *"meta-\*" trees:* These trees contain Metadata. Use the - :yocto_lists:`poky ` mailing list. - -- *Documentation*: For changes to the Yocto Project documentation, use the - :yocto_lists:`docs ` mailing list. - -For changes to other layers hosted in the Yocto Project source -repositories (i.e. ``yoctoproject.org``) and tools use the -:yocto_lists:`Yocto Project ` general mailing list. - -.. note:: - - Sometimes a layer's documentation specifies to use a particular - mailing list. If so, use that list. - -For additional recipes that do not fit into the core Metadata, you -should determine which layer the recipe should go into and submit the -change in the manner recommended by the documentation (e.g. the -``README`` file) supplied with the layer. If in doubt, please ask on the -Yocto general mailing list or on the openembedded-devel mailing list. - -You can also push a change upstream and request a maintainer to pull the -change into the component's upstream repository. You do this by pushing -to a contribution repository that is upstream. See the -":ref:`overview-manual/development-environment:git workflows and the yocto project`" -section in the Yocto Project Overview and Concepts Manual for additional -concepts on working in the Yocto Project development environment. - -Maintainers commonly use ``-next`` branches to test submissions prior to -merging patches. Thus, you can get an idea of the status of a patch based on -whether the patch has been merged into one of these branches. The commonly -used testing branches for OpenEmbedded-Core are as follows: - -- *openembedded-core "master-next" branch:* This branch is part of the - :oe_git:`openembedded-core ` repository and contains - proposed changes to the core metadata. - -- *poky "master-next" branch:* This branch is part of the - :yocto_git:`poky ` repository and combines proposed - changes to BitBake, the core metadata and the poky distro. - -Similarly, stable branches maintained by the project may have corresponding -``-next`` branches which collect proposed changes. For example, -``&DISTRO_NAME_NO_CAP;-next`` and ``&DISTRO_NAME_NO_CAP_MINUS_ONE;-next`` -branches in both the "openembdedded-core" and "poky" repositories. - -Other layers may have similar testing branches but there is no formal -requirement or standard for these so please check the documentation for the -layers you are contributing to. - -The following sections provide procedures for submitting a change. - -Preparing Changes for Submission -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -1. *Make Your Changes Locally:* Make your changes in your local Git - repository. You should make small, controlled, isolated changes. - Keeping changes small and isolated aids review, makes - merging/rebasing easier and keeps the change history clean should - anyone need to refer to it in future. - -2. *Stage Your Changes:* Stage your changes by using the ``git add`` - command on each file you changed. - -3. *Commit Your Changes:* Commit the change by using the ``git commit`` - command. Make sure your commit information follows standards by - following these accepted conventions: - - - Be sure to include a "Signed-off-by:" line in the same style as - required by the Linux kernel. This can be done by using the - ``git commit -s`` command. Adding this line signifies that you, - the submitter, have agreed to the Developer's Certificate of - Origin 1.1 as follows: - - .. code-block:: none - - Developer's Certificate of Origin 1.1 - - By making a contribution to this project, I certify that: - - (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - - (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - - (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - - (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - - - Provide a single-line summary of the change and, if more - explanation is needed, provide more detail in the body of the - commit. This summary is typically viewable in the "shortlist" of - changes. Thus, providing something short and descriptive that - gives the reader a summary of the change is useful when viewing a - list of many commits. You should prefix this short description - with the recipe name (if changing a recipe), or else with the - short form path to the file being changed. - - - For the body of the commit message, provide detailed information - that describes what you changed, why you made the change, and the - approach you used. It might also be helpful if you mention how you - tested the change. Provide as much detail as you can in the body - of the commit message. - - .. note:: - - You do not need to provide a more detailed explanation of a - change if the change is minor to the point of the single line - summary providing all the information. - - - If the change addresses a specific bug or issue that is associated - with a bug-tracking ID, include a reference to that ID in your - detailed description. For example, the Yocto Project uses a - specific convention for bug references --- any commit that addresses - a specific bug should use the following form for the detailed - description. Be sure to use the actual bug-tracking ID from - Bugzilla for bug-id:: - - Fixes [YOCTO #bug-id] - - detailed description of change - -Using Email to Submit a Patch -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Depending on the components changed, you need to submit the email to a -specific mailing list. For some guidance on which mailing list to use, -see the -:ref:`list ` -at the beginning of this section. For a description of all the available -mailing lists, see the ":ref:`Mailing Lists `" section in the -Yocto Project Reference Manual. - -Here is the general procedure on how to submit a patch through email -without using the scripts once the steps in -:ref:`dev-manual/common-tasks:preparing changes for submission` have been followed: - -1. *Format the Commit:* Format the commit into an email message. To - format commits, use the ``git format-patch`` command. When you - provide the command, you must include a revision list or a number of - patches as part of the command. For example, either of these two - commands takes your most recent single commit and formats it as an - email message in the current directory:: - - $ git format-patch -1 - - or :: - - $ git format-patch HEAD~ - - After the command is run, the current directory contains a numbered - ``.patch`` file for the commit. - - If you provide several commits as part of the command, the - ``git format-patch`` command produces a series of numbered files in - the current directory – one for each commit. If you have more than - one patch, you should also use the ``--cover`` option with the - command, which generates a cover letter as the first "patch" in the - series. You can then edit the cover letter to provide a description - for the series of patches. For information on the - ``git format-patch`` command, see ``GIT_FORMAT_PATCH(1)`` displayed - using the ``man git-format-patch`` command. - - .. note:: - - If you are or will be a frequent contributor to the Yocto Project - or to OpenEmbedded, you might consider requesting a contrib area - and the necessary associated rights. - -2. *Send the patches via email:* Send the patches to the recipients and - relevant mailing lists by using the ``git send-email`` command. - - .. note:: - - In order to use ``git send-email``, you must have the proper Git packages - installed on your host. - For Ubuntu, Debian, and Fedora the package is ``git-email``. - - The ``git send-email`` command sends email by using a local or remote - Mail Transport Agent (MTA) such as ``msmtp``, ``sendmail``, or - through a direct ``smtp`` configuration in your Git ``~/.gitconfig`` - file. If you are submitting patches through email only, it is very - important that you submit them without any whitespace or HTML - formatting that either you or your mailer introduces. The maintainer - that receives your patches needs to be able to save and apply them - directly from your emails. A good way to verify that what you are - sending will be applicable by the maintainer is to do a dry run and - send them to yourself and then save and apply them as the maintainer - would. - - The ``git send-email`` command is the preferred method for sending - your patches using email since there is no risk of compromising - whitespace in the body of the message, which can occur when you use - your own mail client. The command also has several options that let - you specify recipients and perform further editing of the email - message. For information on how to use the ``git send-email`` - command, see ``GIT-SEND-EMAIL(1)`` displayed using the - ``man git-send-email`` command. - -The Yocto Project uses a `Patchwork instance `__ -to track the status of patches submitted to the various mailing lists and to -support automated patch testing. Each submitted patch is checked for common -mistakes and deviations from the expected patch format and submitters are -notified by patchtest if such mistakes are found. This process helps to -reduce the burden of patch review on maintainers. - -.. note:: - - This system is imperfect and changes can sometimes get lost in the flow. - Asking about the status of a patch or change is reasonable if the change - has been idle for a while with no feedback. - -Using Scripts to Push a Change Upstream and Request a Pull -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -For larger patch series it is preferable to send a pull request which not -only includes the patch but also a pointer to a branch that can be pulled -from. This involves making a local branch for your changes, pushing this -branch to an accessible repository and then using the ``create-pull-request`` -and ``send-pull-request`` scripts from openembedded-core to create and send a -patch series with a link to the branch for review. - -Follow this procedure to push a change to an upstream "contrib" Git -repository once the steps in :ref:`dev-manual/common-tasks:preparing changes for submission` have -been followed: - -.. note:: - - You can find general Git information on how to push a change upstream - in the - `Git Community Book `__. - -1. *Push Your Commits to a "Contrib" Upstream:* If you have arranged for - permissions to push to an upstream contrib repository, push the - change to that repository:: - - $ git push upstream_remote_repo local_branch_name - - For example, suppose you have permissions to push - into the upstream ``meta-intel-contrib`` repository and you are - working in a local branch named `your_name`\ ``/README``. The following - command pushes your local commits to the ``meta-intel-contrib`` - upstream repository and puts the commit in a branch named - `your_name`\ ``/README``:: - - $ git push meta-intel-contrib your_name/README - -2. *Determine Who to Notify:* Determine the maintainer or the mailing - list that you need to notify for the change. - - Before submitting any change, you need to be sure who the maintainer - is or what mailing list that you need to notify. Use either these - methods to find out: - - - *Maintenance File:* Examine the ``maintainers.inc`` file, which is - located in the :term:`Source Directory` at - ``meta/conf/distro/include``, to see who is responsible for code. - - - *Search by File:* Using :ref:`overview-manual/development-environment:git`, you can - enter the following command to bring up a short list of all - commits against a specific file:: - - git shortlog -- filename - - Just provide the name of the file for which you are interested. The - information returned is not ordered by history but does include a - list of everyone who has committed grouped by name. From the list, - you can see who is responsible for the bulk of the changes against - the file. - - - *Examine the List of Mailing Lists:* For a list of the Yocto - Project and related mailing lists, see the ":ref:`Mailing - lists `" section in - the Yocto Project Reference Manual. - -3. *Make a Pull Request:* Notify the maintainer or the mailing list that - you have pushed a change by making a pull request. - - The Yocto Project provides two scripts that conveniently let you - generate and send pull requests to the Yocto Project. These scripts - are ``create-pull-request`` and ``send-pull-request``. You can find - these scripts in the ``scripts`` directory within the - :term:`Source Directory` (e.g. - ``poky/scripts``). - - Using these scripts correctly formats the requests without - introducing any whitespace or HTML formatting. The maintainer that - receives your patches either directly or through the mailing list - needs to be able to save and apply them directly from your emails. - Using these scripts is the preferred method for sending patches. - - First, create the pull request. For example, the following command - runs the script, specifies the upstream repository in the contrib - directory into which you pushed the change, and provides a subject - line in the created patch files:: - - $ poky/scripts/create-pull-request -u meta-intel-contrib -s "Updated Manual Section Reference in README" - - Running this script forms ``*.patch`` files in a folder named - ``pull-``\ `PID` in the current directory. One of the patch files is a - cover letter. - - Before running the ``send-pull-request`` script, you must edit the - cover letter patch to insert information about your change. After - editing the cover letter, send the pull request. For example, the - following command runs the script and specifies the patch directory - and email address. In this example, the email address is a mailing - list:: - - $ poky/scripts/send-pull-request -p ~/meta-intel/pull-10565 -t meta-intel@lists.yoctoproject.org - - You need to follow the prompts as the script is interactive. - - .. note:: - - For help on using these scripts, simply provide the ``-h`` - argument as follows:: - - $ poky/scripts/create-pull-request -h - $ poky/scripts/send-pull-request -h - -Responding to Patch Review -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You may get feedback on your submitted patches from other community members -or from the automated patchtest service. If issues are identified in your -patch then it is usually necessary to address these before the patch will be -accepted into the project. In this case you should amend the patch according -to the feedback and submit an updated version to the relevant mailing list, -copying in the reviewers who provided feedback to the previous version of the -patch. - -The patch should be amended using ``git commit --amend`` or perhaps ``git -rebase`` for more expert git users. You should also modify the ``[PATCH]`` -tag in the email subject line when sending the revised patch to mark the new -iteration as ``[PATCH v2]``, ``[PATCH v3]``, etc as appropriate. This can be -done by passing the ``-v`` argument to ``git format-patch`` with a version -number. - -Lastly please ensure that you also test your revised changes. In particular -please don't just edit the patch file written out by ``git format-patch`` and -resend it. - -Submitting Changes to Stable Release Branches -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The process for proposing changes to a Yocto Project stable branch differs -from the steps described above. Changes to a stable branch must address -identified bugs or CVEs and should be made carefully in order to avoid the -risk of introducing new bugs or breaking backwards compatibility. Typically -bug fixes must already be accepted into the master branch before they can be -backported to a stable branch unless the bug in question does not affect the -master branch or the fix on the master branch is unsuitable for backporting. - -The list of stable branches along with the status and maintainer for each -branch can be obtained from the -:yocto_wiki:`Releases wiki page `. - -.. note:: - - Changes will not typically be accepted for branches which are marked as - End-Of-Life (EOL). - -With this in mind, the steps to submit a change for a stable branch are as -follows: - -1. *Identify the bug or CVE to be fixed:* This information should be - collected so that it can be included in your submission. - - See :ref:`dev-manual/common-tasks:checking for vulnerabilities` - for details about CVE tracking. - -2. *Check if the fix is already present in the master branch:* This will - result in the most straightforward path into the stable branch for the - fix. - - a. *If the fix is present in the master branch --- submit a backport request - by email:* You should send an email to the relevant stable branch - maintainer and the mailing list with details of the bug or CVE to be - fixed, the commit hash on the master branch that fixes the issue and - the stable branches which you would like this fix to be backported to. - - b. *If the fix is not present in the master branch --- submit the fix to the - master branch first:* This will ensure that the fix passes through the - project's usual patch review and test processes before being accepted. - It will also ensure that bugs are not left unresolved in the master - branch itself. Once the fix is accepted in the master branch a backport - request can be submitted as above. - - c. *If the fix is unsuitable for the master branch --- submit a patch - directly for the stable branch:* This method should be considered as a - last resort. It is typically necessary when the master branch is using - a newer version of the software which includes an upstream fix for the - issue or when the issue has been fixed on the master branch in a way - that introduces backwards incompatible changes. In this case follow the - steps in :ref:`dev-manual/common-tasks:preparing changes for submission` and - :ref:`dev-manual/common-tasks:using email to submit a patch` but modify the subject header of your patch - email to include the name of the stable branch which you are - targetting. This can be done using the ``--subject-prefix`` argument to - ``git format-patch``, for example to submit a patch to the dunfell - branch use - ``git format-patch --subject-prefix='&DISTRO_NAME_NO_CAP_MINUS_ONE;][PATCH' ...``. - -Working With Licenses -===================== - -As mentioned in the ":ref:`overview-manual/development-environment:licensing`" -section in the Yocto Project Overview and Concepts Manual, open source -projects are open to the public and they consequently have different -licensing structures in place. This section describes the mechanism by -which the :term:`OpenEmbedded Build System` -tracks changes to -licensing text and covers how to maintain open source license compliance -during your project's lifecycle. The section also describes how to -enable commercially licensed recipes, which by default are disabled. - -Tracking License Changes ------------------------- - -The license of an upstream project might change in the future. In order -to prevent these changes going unnoticed, the -:term:`LIC_FILES_CHKSUM` -variable tracks changes to the license text. The checksums are validated -at the end of the configure step, and if the checksums do not match, the -build will fail. - -Specifying the ``LIC_FILES_CHKSUM`` Variable -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The :term:`LIC_FILES_CHKSUM` variable contains checksums of the license text -in the source code for the recipe. Following is an example of how to -specify :term:`LIC_FILES_CHKSUM`:: - - LIC_FILES_CHKSUM = "file://COPYING;md5=xxxx \ - file://licfile1.txt;beginline=5;endline=29;md5=yyyy \ - file://licfile2.txt;endline=50;md5=zzzz \ - ..." - -.. note:: - - - When using "beginline" and "endline", realize that line numbering - begins with one and not zero. Also, the included lines are - inclusive (i.e. lines five through and including 29 in the - previous example for ``licfile1.txt``). - - - When a license check fails, the selected license text is included - as part of the QA message. Using this output, you can determine - the exact start and finish for the needed license text. - -The build system uses the :term:`S` -variable as the default directory when searching files listed in -:term:`LIC_FILES_CHKSUM`. The previous example employs the default -directory. - -Consider this next example:: - - LIC_FILES_CHKSUM = "file://src/ls.c;beginline=5;endline=16;\ - md5=bb14ed3c4cda583abc85401304b5cd4e" - LIC_FILES_CHKSUM = "file://${WORKDIR}/license.html;md5=5c94767cedb5d6987c902ac850ded2c6" - -The first line locates a file in ``${S}/src/ls.c`` and isolates lines -five through 16 as license text. The second line refers to a file in -:term:`WORKDIR`. - -Note that :term:`LIC_FILES_CHKSUM` variable is mandatory for all recipes, -unless the :term:`LICENSE` variable is set to "CLOSED". - -Explanation of Syntax -~~~~~~~~~~~~~~~~~~~~~ - -As mentioned in the previous section, the :term:`LIC_FILES_CHKSUM` variable -lists all the important files that contain the license text for the -source code. It is possible to specify a checksum for an entire file, or -a specific section of a file (specified by beginning and ending line -numbers with the "beginline" and "endline" parameters, respectively). -The latter is useful for source files with a license notice header, -README documents, and so forth. If you do not use the "beginline" -parameter, then it is assumed that the text begins on the first line of -the file. Similarly, if you do not use the "endline" parameter, it is -assumed that the license text ends with the last line of the file. - -The "md5" parameter stores the md5 checksum of the license text. If the -license text changes in any way as compared to this parameter then a -mismatch occurs. This mismatch triggers a build failure and notifies the -developer. Notification allows the developer to review and address the -license text changes. Also note that if a mismatch occurs during the -build, the correct md5 checksum is placed in the build log and can be -easily copied to the recipe. - -There is no limit to how many files you can specify using the -:term:`LIC_FILES_CHKSUM` variable. Generally, however, every project -requires a few specifications for license tracking. Many projects have a -"COPYING" file that stores the license information for all the source -code files. This practice allows you to just track the "COPYING" file as -long as it is kept up to date. - -.. note:: - - - If you specify an empty or invalid "md5" parameter, - :term:`BitBake` returns an md5 - mis-match error and displays the correct "md5" parameter value - during the build. The correct parameter is also captured in the - build log. - - - If the whole file contains only license text, you do not need to - use the "beginline" and "endline" parameters. - -Enabling Commercially Licensed Recipes --------------------------------------- - -By default, the OpenEmbedded build system disables components that have -commercial or other special licensing requirements. Such requirements -are defined on a recipe-by-recipe basis through the -:term:`LICENSE_FLAGS` variable -definition in the affected recipe. For instance, the -``poky/meta/recipes-multimedia/gstreamer/gst-plugins-ugly`` recipe -contains the following statement:: - - LICENSE_FLAGS = "commercial" - -Here is a -slightly more complicated example that contains both an explicit recipe -name and version (after variable expansion):: - - LICENSE_FLAGS = "license_${PN}_${PV}" - -In order for a component restricted by a -:term:`LICENSE_FLAGS` definition to be enabled and included in an image, it -needs to have a matching entry in the global -:term:`LICENSE_FLAGS_ACCEPTED` -variable, which is a variable typically defined in your ``local.conf`` -file. For example, to enable the -``poky/meta/recipes-multimedia/gstreamer/gst-plugins-ugly`` package, you -could add either the string "commercial_gst-plugins-ugly" or the more -general string "commercial" to :term:`LICENSE_FLAGS_ACCEPTED`. See the -":ref:`dev-manual/common-tasks:license flag matching`" section for a full -explanation of how :term:`LICENSE_FLAGS` matching works. Here is the -example:: - - LICENSE_FLAGS_ACCEPTED = "commercial_gst-plugins-ugly" - -Likewise, to additionally enable the package built from the recipe -containing ``LICENSE_FLAGS = "license_${PN}_${PV}"``, and assuming that -the actual recipe name was ``emgd_1.10.bb``, the following string would -enable that package as well as the original ``gst-plugins-ugly`` -package:: - - LICENSE_FLAGS_ACCEPTED = "commercial_gst-plugins-ugly license_emgd_1.10" - -As a convenience, you do not need to specify the -complete license string for every package. You can use -an abbreviated form, which consists of just the first portion or -portions of the license string before the initial underscore character -or characters. A partial string will match any license that contains the -given string as the first portion of its license. For example, the -following value will also match both of the packages -previously mentioned as well as any other packages that have licenses -starting with "commercial" or "license". -:: - - LICENSE_FLAGS_ACCEPTED = "commercial license" - -License Flag Matching -~~~~~~~~~~~~~~~~~~~~~ - -License flag matching allows you to control what recipes the -OpenEmbedded build system includes in the build. Fundamentally, the -build system attempts to match :term:`LICENSE_FLAGS` strings found in -recipes against strings found in :term:`LICENSE_FLAGS_ACCEPTED`. -A match causes the build system to include a recipe in the -build, while failure to find a match causes the build system to exclude -a recipe. - -In general, license flag matching is simple. However, understanding some -concepts will help you correctly and effectively use matching. - -Before a flag defined by a particular recipe is tested against the -entries of :term:`LICENSE_FLAGS_ACCEPTED`, the expanded -string ``_${PN}`` is appended to the flag. This expansion makes each -:term:`LICENSE_FLAGS` value recipe-specific. After expansion, the -string is then matched against the entries. Thus, specifying -``LICENSE_FLAGS = "commercial"`` in recipe "foo", for example, results -in the string ``"commercial_foo"``. And, to create a match, that string -must appear among the entries of :term:`LICENSE_FLAGS_ACCEPTED`. - -Judicious use of the :term:`LICENSE_FLAGS` strings and the contents of the -:term:`LICENSE_FLAGS_ACCEPTED` variable allows you a lot of flexibility for -including or excluding recipes based on licensing. For example, you can -broaden the matching capabilities by using license flags string subsets -in :term:`LICENSE_FLAGS_ACCEPTED`. - -.. note:: - - When using a string subset, be sure to use the part of the expanded - string that precedes the appended underscore character (e.g. - ``usethispart_1.3``, ``usethispart_1.4``, and so forth). - -For example, simply specifying the string "commercial" in the -:term:`LICENSE_FLAGS_ACCEPTED` variable matches any expanded -:term:`LICENSE_FLAGS` definition that starts with the string -"commercial" such as "commercial_foo" and "commercial_bar", which -are the strings the build system automatically generates for -hypothetical recipes named "foo" and "bar" assuming those recipes simply -specify the following:: - - LICENSE_FLAGS = "commercial" - -Thus, you can choose to exhaustively enumerate each license flag in the -list and allow only specific recipes into the image, or you can use a -string subset that causes a broader range of matches to allow a range of -recipes into the image. - -This scheme works even if the :term:`LICENSE_FLAGS` string already has -``_${PN}`` appended. For example, the build system turns the license -flag "commercial_1.2_foo" into "commercial_1.2_foo_foo" and would match -both the general "commercial" and the specific "commercial_1.2_foo" -strings found in the :term:`LICENSE_FLAGS_ACCEPTED` variable, as expected. - -Here are some other scenarios: - -- You can specify a versioned string in the recipe such as - "commercial_foo_1.2" in a "foo" recipe. The build system expands this - string to "commercial_foo_1.2_foo". Combine this license flag with a - :term:`LICENSE_FLAGS_ACCEPTED` variable that has the string - "commercial" and you match the flag along with any other flag that - starts with the string "commercial". - -- Under the same circumstances, you can add "commercial_foo" in the - :term:`LICENSE_FLAGS_ACCEPTED` variable and the build system not only - matches "commercial_foo_1.2" but also matches any license flag with - the string "commercial_foo", regardless of the version. - -- You can be very specific and use both the package and version parts - in the :term:`LICENSE_FLAGS_ACCEPTED` list (e.g. - "commercial_foo_1.2") to specifically match a versioned recipe. - -Other Variables Related to Commercial Licenses -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -There are other helpful variables related to commercial license handling, -defined in the -``poky/meta/conf/distro/include/default-distrovars.inc`` file:: - - COMMERCIAL_AUDIO_PLUGINS ?= "" - COMMERCIAL_VIDEO_PLUGINS ?= "" - -If you -want to enable these components, you can do so by making sure you have -statements similar to the following in your ``local.conf`` configuration -file:: - - COMMERCIAL_AUDIO_PLUGINS = "gst-plugins-ugly-mad \ - gst-plugins-ugly-mpegaudioparse" - COMMERCIAL_VIDEO_PLUGINS = "gst-plugins-ugly-mpeg2dec \ - gst-plugins-ugly-mpegstream gst-plugins-bad-mpegvideoparse" - LICENSE_FLAGS_ACCEPTED = "commercial_gst-plugins-ugly commercial_gst-plugins-bad commercial_qmmp" - - -Of course, you could also create a matching list for those -components using the more general "commercial" in the -:term:`LICENSE_FLAGS_ACCEPTED` variable, but that would also enable all -the other packages with :term:`LICENSE_FLAGS` -containing "commercial", which you may or may not want:: - - LICENSE_FLAGS_ACCEPTED = "commercial" - -Specifying audio and video plugins as part of the -``COMMERCIAL_AUDIO_PLUGINS`` and ``COMMERCIAL_VIDEO_PLUGINS`` statements -(along with the enabling :term:`LICENSE_FLAGS_ACCEPTED`) includes the -plugins or components into built images, thus adding support for media -formats or components. - -Maintaining Open Source License Compliance During Your Product's Lifecycle --------------------------------------------------------------------------- - -One of the concerns for a development organization using open source -software is how to maintain compliance with various open source -licensing during the lifecycle of the product. While this section does -not provide legal advice or comprehensively cover all scenarios, it does -present methods that you can use to assist you in meeting the compliance -requirements during a software release. - -With hundreds of different open source licenses that the Yocto Project -tracks, it is difficult to know the requirements of each and every -license. However, the requirements of the major FLOSS licenses can begin -to be covered by assuming that there are three main areas of concern: - -- Source code must be provided. - -- License text for the software must be provided. - -- Compilation scripts and modifications to the source code must be - provided. - -There are other requirements beyond the scope of these three and the -methods described in this section (e.g. the mechanism through which -source code is distributed). - -As different organizations have different methods of complying with open -source licensing, this section is not meant to imply that there is only -one single way to meet your compliance obligations, but rather to -describe one method of achieving compliance. The remainder of this -section describes methods supported to meet the previously mentioned -three requirements. Once you take steps to meet these requirements, and -prior to releasing images, sources, and the build system, you should -audit all artifacts to ensure completeness. - -.. note:: - - The Yocto Project generates a license manifest during image creation - that is located in ``${DEPLOY_DIR}/licenses/``\ `image_name`\ ``-``\ `datestamp` - to assist with any audits. - -Providing the Source Code -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Compliance activities should begin before you generate the final image. -The first thing you should look at is the requirement that tops the list -for most compliance groups --- providing the source. The Yocto Project has -a few ways of meeting this requirement. - -One of the easiest ways to meet this requirement is to provide the -entire :term:`DL_DIR` used by the -build. This method, however, has a few issues. The most obvious is the -size of the directory since it includes all sources used in the build -and not just the source used in the released image. It will include -toolchain source, and other artifacts, which you would not generally -release. However, the more serious issue for most companies is -accidental release of proprietary software. The Yocto Project provides -an :ref:`archiver ` class to -help avoid some of these concerns. - -Before you employ :term:`DL_DIR` or the :ref:`archiver ` class, you need to -decide how you choose to provide source. The source ``archiver`` class -can generate tarballs and SRPMs and can create them with various levels -of compliance in mind. - -One way of doing this (but certainly not the only way) is to release -just the source as a tarball. You can do this by adding the following to -the ``local.conf`` file found in the :term:`Build Directory`:: - - INHERIT += "archiver" - ARCHIVER_MODE[src] = "original" - -During the creation of your -image, the source from all recipes that deploy packages to the image is -placed within subdirectories of ``DEPLOY_DIR/sources`` based on the -:term:`LICENSE` for each recipe. -Releasing the entire directory enables you to comply with requirements -concerning providing the unmodified source. It is important to note that -the size of the directory can get large. - -A way to help mitigate the size issue is to only release tarballs for -licenses that require the release of source. Let us assume you are only -concerned with GPL code as identified by running the following script: - -.. code-block:: shell - - # Script to archive a subset of packages matching specific license(s) - # Source and license files are copied into sub folders of package folder - # Must be run from build folder - #!/bin/bash - src_release_dir="source-release" - mkdir -p $src_release_dir - for a in tmp/deploy/sources/*; do - for d in $a/*; do - # Get package name from path - p=`basename $d` - p=${p%-*} - p=${p%-*} - # Only archive GPL packages (update *GPL* regex for your license check) - numfiles=`ls tmp/deploy/licenses/$p/*GPL* 2> /dev/null | wc -l` - if [ $numfiles -ge 1 ]; then - echo Archiving $p - mkdir -p $src_release_dir/$p/source - cp $d/* $src_release_dir/$p/source 2> /dev/null - mkdir -p $src_release_dir/$p/license - cp tmp/deploy/licenses/$p/* $src_release_dir/$p/license 2> /dev/null - fi - done - done - -At this point, you -could create a tarball from the ``gpl_source_release`` directory and -provide that to the end user. This method would be a step toward -achieving compliance with section 3a of GPLv2 and with section 6 of -GPLv3. - -Providing License Text -~~~~~~~~~~~~~~~~~~~~~~ - -One requirement that is often overlooked is inclusion of license text. -This requirement also needs to be dealt with prior to generating the -final image. Some licenses require the license text to accompany the -binary. You can achieve this by adding the following to your -``local.conf`` file:: - - COPY_LIC_MANIFEST = "1" - COPY_LIC_DIRS = "1" - LICENSE_CREATE_PACKAGE = "1" - -Adding these statements to the -configuration file ensures that the licenses collected during package -generation are included on your image. - -.. note:: - - Setting all three variables to "1" results in the image having two - copies of the same license file. One copy resides in - ``/usr/share/common-licenses`` and the other resides in - ``/usr/share/license``. - - The reason for this behavior is because - :term:`COPY_LIC_DIRS` and - :term:`COPY_LIC_MANIFEST` - add a copy of the license when the image is built but do not offer a - path for adding licenses for newly installed packages to an image. - :term:`LICENSE_CREATE_PACKAGE` - adds a separate package and an upgrade path for adding licenses to an - image. - -As the source ``archiver`` class has already archived the original -unmodified source that contains the license files, you would have -already met the requirements for inclusion of the license information -with source as defined by the GPL and other open source licenses. - -Providing Compilation Scripts and Source Code Modifications -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -At this point, we have addressed all we need to prior to generating the -image. The next two requirements are addressed during the final -packaging of the release. - -By releasing the version of the OpenEmbedded build system and the layers -used during the build, you will be providing both compilation scripts -and the source code modifications in one step. - -If the deployment team has a :ref:`overview-manual/concepts:bsp layer` -and a distro layer, and those -those layers are used to patch, compile, package, or modify (in any way) -any open source software included in your released images, you might be -required to release those layers under section 3 of GPLv2 or section 1 -of GPLv3. One way of doing that is with a clean checkout of the version -of the Yocto Project and layers used during your build. Here is an -example: - -.. code-block:: shell - - # We built using the dunfell branch of the poky repo - $ git clone -b dunfell git://git.yoctoproject.org/poky - $ cd poky - # We built using the release_branch for our layers - $ git clone -b release_branch git://git.mycompany.com/meta-my-bsp-layer - $ git clone -b release_branch git://git.mycompany.com/meta-my-software-layer - # clean up the .git repos - $ find . -name ".git" -type d -exec rm -rf {} \; - -One thing a development organization might want to consider for end-user -convenience is to modify -``meta-poky/conf/templates/default/bblayers.conf.sample`` to ensure that when -the end user utilizes the released build system to build an image, the -development organization's layers are included in the ``bblayers.conf`` file -automatically:: - - # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf - # changes incompatibly - POKY_BBLAYERS_CONF_VERSION = "2" - - BBPATH = "${TOPDIR}" - BBFILES ?= "" - - BBLAYERS ?= " \ - ##OEROOT##/meta \ - ##OEROOT##/meta-poky \ - ##OEROOT##/meta-yocto-bsp \ - ##OEROOT##/meta-mylayer \ - " - -Creating and -providing an archive of the :term:`Metadata` -layers (recipes, configuration files, and so forth) enables you to meet -your requirements to include the scripts to control compilation as well -as any modifications to the original source. - -Compliance Limitations with Executables Built from Static Libraries -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -When package A is added to an image via the :term:`RDEPENDS` or :term:`RRECOMMENDS` -mechanisms as well as explicitly included in the image recipe with -:term:`IMAGE_INSTALL`, and depends on a static linked library recipe B -(``DEPENDS += "B"``), package B will neither appear in the generated license -manifest nor in the generated source tarballs. This occurs as the -:ref:`license ` and :ref:`archiver ` -classes assume that only packages included via :term:`RDEPENDS` or :term:`RRECOMMENDS` -end up in the image. - -As a result, potential obligations regarding license compliance for package B -may not be met. - -The Yocto Project doesn't enable static libraries by default, in part because -of this issue. Before a solution to this limitation is found, you need to -keep in mind that if your root filesystem is built from static libraries, -you will need to manually ensure that your deliveries are compliant -with the licenses of these libraries. - -Copying Non Standard Licenses ------------------------------ - -Some packages, such as the linux-firmware package, have many licenses -that are not in any way common. You can avoid adding a lot of these -types of common license files, which are only applicable to a specific -package, by using the -:term:`NO_GENERIC_LICENSE` -variable. Using this variable also avoids QA errors when you use a -non-common, non-CLOSED license in a recipe. - -Here is an example that uses the ``LICENSE.Abilis.txt`` file as -the license from the fetched source:: - - NO_GENERIC_LICENSE[Firmware-Abilis] = "LICENSE.Abilis.txt" - -Checking for Vulnerabilities -============================ - -Vulnerabilities in Poky and OE-Core ------------------------------------ - -The Yocto Project has an infrastructure to track and address unfixed -known security vulnerabilities, as tracked by the public -:wikipedia:`Common Vulnerabilities and Exposures (CVE) ` -database. - -The Yocto Project maintains a `list of known vulnerabilities -`__ -for packages in Poky and OE-Core, tracking the evolution of the number of -unpatched CVEs and the status of patches. Such information is available for -the current development version and for each supported release. - -Security is a process, not a product, and thus at any time, a number of security -issues may be impacting Poky and OE-Core. It is up to the maintainers, users, -contributors and anyone interested in the issues to investigate and possibly fix them by -updating software components to newer versions or by applying patches to address them. -It is recommended to work with Poky and OE-Core upstream maintainers and submit -patches to fix them, see ":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" for details. - -Vulnerability check at build time ---------------------------------- - -To enable a check for CVE security vulnerabilities using :ref:`cve-check ` in the specific image -or target you are building, add the following setting to your configuration:: - - INHERIT += "cve-check" - -The CVE database contains some old incomplete entries which have been -deemed not to impact Poky or OE-Core. These CVE entries can be excluded from the -check using build configuration:: - - include conf/distro/include/cve-extra-exclusions.inc - -With this CVE check enabled, BitBake build will try to map each compiled software component -recipe name and version information to the CVE database and generate recipe and -image specific reports. These reports will contain: - -- metadata about the software component like names and versions - -- metadata about the CVE issue such as description and NVD link - -- for each software component, a list of CVEs which are possibly impacting this version - -- status of each CVE: ``Patched``, ``Unpatched`` or ``Ignored`` - -The status ``Patched`` means that a patch file to address the security issue has been -applied. ``Unpatched`` status means that no patches to address the issue have been -applied and that the issue needs to be investigated. ``Ignored`` means that after -analysis, it has been deemed to ignore the issue as it for example affects -the software component on a different operating system platform. - -After a build with CVE check enabled, reports for each compiled source recipe will be -found in ``build/tmp/deploy/cve``. - -For example the CVE check report for the ``flex-native`` recipe looks like:: - - $ cat poky/build/tmp/deploy/cve/flex-native - LAYER: meta - PACKAGE NAME: flex-native - PACKAGE VERSION: 2.6.4 - CVE: CVE-2016-6354 - CVE STATUS: Patched - CVE SUMMARY: Heap-based buffer overflow in the yy_get_next_buffer function in Flex before 2.6.1 might allow context-dependent attackers to cause a denial of service or possibly execute arbitrary code via vectors involving num_to_read. - CVSS v2 BASE SCORE: 7.5 - CVSS v3 BASE SCORE: 9.8 - VECTOR: NETWORK - MORE INFORMATION: https://nvd.nist.gov/vuln/detail/CVE-2016-6354 - - LAYER: meta - PACKAGE NAME: flex-native - PACKAGE VERSION: 2.6.4 - CVE: CVE-2019-6293 - CVE STATUS: Ignored - CVE SUMMARY: An issue was discovered in the function mark_beginning_as_normal in nfa.c in flex 2.6.4. There is a stack exhaustion problem caused by the mark_beginning_as_normal function making recursive calls to itself in certain scenarios involving lots of '*' characters. Remote attackers could leverage this vulnerability to cause a denial-of-service. - CVSS v2 BASE SCORE: 4.3 - CVSS v3 BASE SCORE: 5.5 - VECTOR: NETWORK - MORE INFORMATION: https://nvd.nist.gov/vuln/detail/CVE-2019-6293 - -For images, a summary of all recipes included in the image and their CVEs is also -generated in textual and JSON formats. These ``.cve`` and ``.json`` reports can be found -in the ``tmp/deploy/images`` directory for each compiled image. - -At build time CVE check will also throw warnings about ``Unpatched`` CVEs:: - - WARNING: flex-2.6.4-r0 do_cve_check: Found unpatched CVE (CVE-2019-6293), for more information check /poky/build/tmp/work/core2-64-poky-linux/flex/2.6.4-r0/temp/cve.log - WARNING: libarchive-3.5.1-r0 do_cve_check: Found unpatched CVE (CVE-2021-36976), for more information check /poky/build/tmp/work/core2-64-poky-linux/libarchive/3.5.1-r0/temp/cve.log - -It is also possible to check the CVE status of individual packages as follows:: - - bitbake -c cve_check flex libarchive - -Fixing CVE product name and version mappings --------------------------------------------- - -By default, :ref:`cve-check ` uses the recipe name :term:`BPN` as CVE -product name when querying the CVE database. If this mapping contains false positives, e.g. -some reported CVEs are not for the software component in question, or false negatives like -some CVEs are not found to impact the recipe when they should, then the problems can be -in the recipe name to CVE product mapping. These mapping issues can be fixed by setting -the :term:`CVE_PRODUCT` variable inside the recipe. This defines the name of the software component in the -upstream `NIST CVE database `__. - -The variable supports using vendor and product names like this:: - - CVE_PRODUCT = "flex_project:flex" - -In this example the vendor name used in the CVE database is ``flex_project`` and the -product is ``flex``. With this setting the ``flex`` recipe only maps to this specific -product and not products from other vendors with same name ``flex``. - -Similarly, when the recipe version :term:`PV` is not compatible with software versions used by -the upstream software component releases and the CVE database, these can be fixed using -the :term:`CVE_VERSION` variable. - -Note that if the CVE entries in the NVD database contain bugs or have missing or incomplete -information, it is recommended to fix the information there directly instead of working -around the issues possibly for a long time in Poky and OE-Core side recipes. Feedback to -NVD about CVE entries can be provided through the `NVD contact form `__. - -Fixing vulnerabilities in recipes ---------------------------------- - -If a CVE security issue impacts a software component, it can be fixed by updating to a newer -version of the software component or by applying a patch. For Poky and OE-Core master branches, updating -to a newer software component release with fixes is the best option, but patches can be applied -if releases are not yet available. - -For stable branches, it is preferred to apply patches for the issues. For some software -components minor version updates can also be applied if they are backwards compatible. - -Here is an example of fixing CVE security issues with patch files, -an example from the :oe_layerindex:`ffmpeg recipe`:: - - SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ - file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ - file://fix-CVE-2020-20446.patch \ - file://fix-CVE-2020-20453.patch \ - file://fix-CVE-2020-22015.patch \ - file://fix-CVE-2020-22021.patch \ - file://fix-CVE-2020-22033-CVE-2020-22019.patch \ - file://fix-CVE-2021-33815.patch \ - -A good practice is to include the CVE identifier in both the patch file name -and inside the patch file commit message using the format:: - - CVE: CVE-2020-22033 - -CVE checker will then capture this information and change the CVE status to ``Patched`` -in the generated reports. - -If analysis shows that the CVE issue does not impact the recipe due to configuration, platform, -version or other reasons, the CVE can be marked as ``Ignored`` using the :term:`CVE_CHECK_IGNORE` variable. -As mentioned previously, if data in the CVE database is wrong, it is recommend to fix those -issues in the CVE database directly. - -Recipes can be completely skipped by CVE check by including the recipe name in -the :term:`CVE_CHECK_SKIP_RECIPE` variable. - -Implementation details ----------------------- - -Here's what the :ref:`cve-check ` class does to -find unpatched CVE IDs. - -First the code goes through each patch file provided by a recipe. If a valid CVE ID -is found in the name of the file, the corresponding CVE is considered as patched. -Don't forget that if multiple CVE IDs are found in the filename, only the last -one is considered. Then, the code looks for ``CVE: CVE-ID`` lines in the patch -file. The found CVE IDs are also considered as patched. - -Then, the code looks up all the CVE IDs in the NIST database for all the -products defined in :term:`CVE_PRODUCT`. Then, for each found CVE: - -- If the package name (:term:`PN`) is part of - :term:`CVE_CHECK_SKIP_RECIPE`, it is considered as ``Patched``. - -- If the CVE ID is part of :term:`CVE_CHECK_IGNORE`, it is - set as ``Ignored``. - -- If the CVE ID is part of the patched CVE for the recipe, it is - already considered as ``Patched``. - -- Otherwise, the code checks whether the recipe version (:term:`PV`) - is within the range of versions impacted by the CVE. If so, the CVE - is considered as ``Unpatched``. - -The CVE database is stored in :term:`DL_DIR` and can be inspected using -``sqlite3`` command as follows:: - - sqlite3 downloads/CVE_CHECK/nvdcve_1.1.db .dump | grep CVE-2021-37462 - -When analyzing CVEs, it is recommended to: - -- study the latest information in `CVE database `__. - -- check how upstream developers of the software component addressed the issue, e.g. - what patch was applied, which upstream release contains the fix. - -- check what other Linux distributions like `Debian `__ - did to analyze and address the issue. - -- follow security notices from other Linux distributions. - -- follow public `open source security mailing lists `__ for - discussions and advance notifications of CVE bugs and software releases with fixes. - -Creating a Software Bill of Materials -===================================== - -Once you are able to build an image for your project, once the licenses for -each software component are all identified (see -":ref:`dev-manual/common-tasks:working with licenses`") and once vulnerability -fixes are applied (see ":ref:`dev-manual/common-tasks:checking -for vulnerabilities`"), the OpenEmbedded build system can generate -a description of all the components you used, their licenses, their dependencies, -the changes that were applied and the known vulnerabilities that were fixed. - -This description is generated in the form of a *Software Bill of Materials* -(:term:`SBOM`), using the :term:`SPDX` standard. - -When you release software, this is the most standard way to provide information -about the Software Supply Chain of your software image and SDK. The -:term:`SBOM` tooling is often used to ensure open source license compliance by -providing the license texts used in the product which legal departments and end -users can read in standardized format. - -:term:`SBOM` information is also critical to performing vulnerability exposure -assessments, as all the components used in the Software Supply Chain are listed. - -The OpenEmbedded build system doesn't generate such information by default. -To make this happen, you must inherit the -:ref:`create-spdx ` class from a configuration file:: - - INHERIT += "create-spdx" - -You then get :term:`SPDX` output in JSON format as an -``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the -:term:`Build Directory`. - -This is a toplevel file accompanied by an ``IMAGE-MACHINE.spdx.index.json`` -containing an index of JSON :term:`SPDX` files for individual recipes, together -with an ``IMAGE-MACHINE.spdx.tar.zst`` compressed archive containing all such -files. - -The :ref:`create-spdx ` class offers options to include -more information in the output :term:`SPDX` data, such as making the generated -files more human readable (:term:`SPDX_PRETTY`), adding compressed archives of -the files in the generated target packages (:term:`SPDX_ARCHIVE_PACKAGED`), -adding a description of the source files handled by the target recipes -(:term:`SPDX_INCLUDE_SOURCES`) and adding archives of these source files -themselves (:term:`SPDX_ARCHIVE_SOURCES`). - -Though the toplevel :term:`SPDX` output is available in -``tmp/deploy/images/MACHINE/`` inside the :term:`Build Directory`, ancillary -generated files are available in ``tmp/deploy/spdx/MACHINE`` too, such as: - -- The individual :term:`SPDX` JSON files in the ``IMAGE-MACHINE.spdx.tar.zst`` - archive. - -- Compressed archives of the files in the generated target packages, - in ``packages/packagename.tar.zst`` (when :term:`SPDX_ARCHIVE_PACKAGED` - is set). - -- Compressed archives of the source files used to build the host tools - and the target packages in ``recipes/recipe-packagename.tar.zst`` - (when :term:`SPDX_ARCHIVE_SOURCES` is set). Those are needed to fulfill - "source code access" license requirements. - -See the `tools page `__ on the :term:`SPDX` -project website for a list of tools to consume and transform the :term:`SPDX` -data generated by the OpenEmbedded build system. - -Using the Error Reporting Tool -============================== - -The error reporting tool allows you to submit errors encountered during -builds to a central database. Outside of the build environment, you can -use a web interface to browse errors, view statistics, and query for -errors. The tool works using a client-server system where the client -portion is integrated with the installed Yocto Project -:term:`Source Directory` (e.g. ``poky``). -The server receives the information collected and saves it in a -database. - -There is a live instance of the error reporting server at -https://errors.yoctoproject.org. -When you want to get help with build failures, you can submit all of the -information on the failure easily and then point to the URL in your bug -report or send an email to the mailing list. - -.. note:: - - If you send error reports to this server, the reports become publicly - visible. - -Enabling and Using the Tool ---------------------------- - -By default, the error reporting tool is disabled. You can enable it by -inheriting the :ref:`report-error ` -class by adding the following statement to the end of your -``local.conf`` file in your :term:`Build Directory`:: - - INHERIT += "report-error" - -By default, the error reporting feature stores information in -``${``\ :term:`LOG_DIR`\ ``}/error-report``. -However, you can specify a directory to use by adding the following to -your ``local.conf`` file:: - - ERR_REPORT_DIR = "path" - -Enabling error -reporting causes the build process to collect the errors and store them -in a file as previously described. When the build system encounters an -error, it includes a command as part of the console output. You can run -the command to send the error file to the server. For example, the -following command sends the errors to an upstream server:: - - $ send-error-report /home/brandusa/project/poky/build/tmp/log/error-report/error_report_201403141617.txt - -In the previous example, the errors are sent to a public database -available at https://errors.yoctoproject.org, which is used by the -entire community. If you specify a particular server, you can send the -errors to a different database. Use the following command for more -information on available options:: - - $ send-error-report --help - -When sending the error file, you are prompted to review the data being -sent as well as to provide a name and optional email address. Once you -satisfy these prompts, the command returns a link from the server that -corresponds to your entry in the database. For example, here is a -typical link: https://errors.yoctoproject.org/Errors/Details/9522/ - -Following the link takes you to a web interface where you can browse, -query the errors, and view statistics. - -Disabling the Tool ------------------- - -To disable the error reporting feature, simply remove or comment out the -following statement from the end of your ``local.conf`` file in your -:term:`Build Directory`. -:: - - INHERIT += "report-error" - -Setting Up Your Own Error Reporting Server ------------------------------------------- - -If you want to set up your own error reporting server, you can obtain -the code from the Git repository at :yocto_git:`/error-report-web/`. -Instructions on how to set it up are in the README document. - -Using Wayland and Weston -======================== - -:wikipedia:`Wayland ` -is a computer display server protocol that provides a method for -compositing window managers to communicate directly with applications -and video hardware and expects them to communicate with input hardware -using other libraries. Using Wayland with supporting targets can result -in better control over graphics frame rendering than an application -might otherwise achieve. - -The Yocto Project provides the Wayland protocol libraries and the -reference :wikipedia:`Weston ` -compositor as part of its release. You can find the integrated packages -in the ``meta`` layer of the :term:`Source Directory`. -Specifically, you -can find the recipes that build both Wayland and Weston at -``meta/recipes-graphics/wayland``. - -You can build both the Wayland and Weston packages for use only with targets -that accept the :wikipedia:`Mesa 3D and Direct Rendering Infrastructure -`, which is also known as Mesa DRI. This implies that -you cannot build and use the packages if your target uses, for example, the -Intel Embedded Media and Graphics Driver (Intel EMGD) that overrides Mesa DRI. - -.. note:: - - Due to lack of EGL support, Weston 1.0.3 will not run directly on the - emulated QEMU hardware. However, this version of Weston will run - under X emulation without issues. - -This section describes what you need to do to implement Wayland and use -the Weston compositor when building an image for a supporting target. - -Enabling Wayland in an Image ----------------------------- - -To enable Wayland, you need to enable it to be built and enable it to be -included (installed) in the image. - -Building Wayland -~~~~~~~~~~~~~~~~ - -To cause Mesa to build the ``wayland-egl`` platform and Weston to build -Wayland with Kernel Mode Setting -(`KMS `__) -support, include the "wayland" flag in the -:term:`DISTRO_FEATURES` -statement in your ``local.conf`` file:: - - DISTRO_FEATURES:append = " wayland" - -.. note:: - - If X11 has been enabled elsewhere, Weston will build Wayland with X11 - support - -Installing Wayland and Weston -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To install the Wayland feature into an image, you must include the -following -:term:`CORE_IMAGE_EXTRA_INSTALL` -statement in your ``local.conf`` file:: - - CORE_IMAGE_EXTRA_INSTALL += "wayland weston" - -Running Weston --------------- - -To run Weston inside X11, enabling it as described earlier and building -a Sato image is sufficient. If you are running your image under Sato, a -Weston Launcher appears in the "Utility" category. - -Alternatively, you can run Weston through the command-line interpretor -(CLI), which is better suited for development work. To run Weston under -the CLI, you need to do the following after your image is built: - -1. Run these commands to export ``XDG_RUNTIME_DIR``:: - - mkdir -p /tmp/$USER-weston - chmod 0700 /tmp/$USER-weston - export XDG_RUNTIME_DIR=/tmp/$USER-weston - -2. Launch Weston in the shell:: - - weston diff --git a/poky/documentation/dev-manual/custom-distribution.rst b/poky/documentation/dev-manual/custom-distribution.rst new file mode 100644 index 0000000000..e5b1ad777a --- /dev/null +++ b/poky/documentation/dev-manual/custom-distribution.rst @@ -0,0 +1,108 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Creating Your Own Distribution +****************************** + +When you build an image using the Yocto Project and do not alter any +distribution :term:`Metadata`, you are +creating a Poky distribution. If you wish to gain more control over +package alternative selections, compile-time options, and other +low-level configurations, you can create your own distribution. + +To create your own distribution, the basic steps consist of creating +your own distribution layer, creating your own distribution +configuration file, and then adding any needed code and Metadata to the +layer. The following steps provide some more detail: + +- *Create a layer for your new distro:* Create your distribution layer + so that you can keep your Metadata and code for the distribution + separate. It is strongly recommended that you create and use your own + layer for configuration and code. Using your own layer as compared to + just placing configurations in a ``local.conf`` configuration file + makes it easier to reproduce the same build configuration when using + multiple build machines. See the + ":ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`" + section for information on how to quickly set up a layer. + +- *Create the distribution configuration file:* The distribution + configuration file needs to be created in the ``conf/distro`` + directory of your layer. You need to name it using your distribution + name (e.g. ``mydistro.conf``). + + .. note:: + + The :term:`DISTRO` variable in your ``local.conf`` file determines the + name of your distribution. + + You can split out parts of your configuration file into include files + and then "require" them from within your distribution configuration + file. Be sure to place the include files in the + ``conf/distro/include`` directory of your layer. A common example + usage of include files would be to separate out the selection of + desired version and revisions for individual recipes. + + Your configuration file needs to set the following required + variables: + + - :term:`DISTRO_NAME` + + - :term:`DISTRO_VERSION` + + These following variables are optional and you typically set them + from the distribution configuration file: + + - :term:`DISTRO_FEATURES` + + - :term:`DISTRO_EXTRA_RDEPENDS` + + - :term:`DISTRO_EXTRA_RRECOMMENDS` + + - :term:`TCLIBC` + + .. tip:: + + If you want to base your distribution configuration file on the + very basic configuration from OE-Core, you can use + ``conf/distro/defaultsetup.conf`` as a reference and just include + variables that differ as compared to ``defaultsetup.conf``. + Alternatively, you can create a distribution configuration file + from scratch using the ``defaultsetup.conf`` file or configuration files + from another distribution such as Poky as a reference. + +- *Provide miscellaneous variables:* Be sure to define any other + variables for which you want to create a default or enforce as part + of the distribution configuration. You can include nearly any + variable from the ``local.conf`` file. The variables you use are not + limited to the list in the previous bulleted item. + +- *Point to Your distribution configuration file:* In your ``local.conf`` + file in the :term:`Build Directory`, set your :term:`DISTRO` variable to + point to your distribution's configuration file. For example, if your + distribution's configuration file is named ``mydistro.conf``, then + you point to it as follows:: + + DISTRO = "mydistro" + +- *Add more to the layer if necessary:* Use your layer to hold other + information needed for the distribution: + + - Add recipes for installing distro-specific configuration files + that are not already installed by another recipe. If you have + distro-specific configuration files that are included by an + existing recipe, you should add an append file (``.bbappend``) for + those. For general information and recommendations on how to add + recipes to your layer, see the + ":ref:`dev-manual/layers:creating your own layer`" and + ":ref:`dev-manual/layers:following best practices when creating layers`" + sections. + + - Add any image recipes that are specific to your distribution. + + - Add a ``psplash`` append file for a branded splash screen. For + information on append files, see the + ":ref:`dev-manual/layers:appending other layers metadata with your layer`" + section. + + - Add any other append files to make custom changes that are + specific to individual recipes. + diff --git a/poky/documentation/dev-manual/custom-template-configuration-directory.rst b/poky/documentation/dev-manual/custom-template-configuration-directory.rst new file mode 100644 index 0000000000..9bffef35b4 --- /dev/null +++ b/poky/documentation/dev-manual/custom-template-configuration-directory.rst @@ -0,0 +1,52 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Creating a Custom Template Configuration Directory +************************************************** + +If you are producing your own customized version of the build system for +use by other users, you might want to provide a custom build configuration +that includes all the necessary settings and layers (i.e. ``local.conf`` and +``bblayers.conf`` that are created in a new :term:`Build Directory`) and a custom +message that is shown when setting up the build. This can be done by +creating one or more template configuration directories in your +custom distribution layer. + +This can be done by using ``bitbake-layers save-build-conf``:: + + $ bitbake-layers save-build-conf ../../meta-alex/ test-1 + NOTE: Starting bitbake server... + NOTE: Configuration template placed into /srv/work/alex/meta-alex/conf/templates/test-1 + Please review the files in there, and particularly provide a configuration description in /srv/work/alex/meta-alex/conf/templates/test-1/conf-notes.txt + You can try out the configuration with + TEMPLATECONF=/srv/work/alex/meta-alex/conf/templates/test-1 . /srv/work/alex/poky/oe-init-build-env build-try-test-1 + +The above command takes the config files from the currently active :term:`Build Directory` under ``conf``, +replaces site-specific paths in ``bblayers.conf`` with ``##OECORE##``-relative paths, and copies +the config files into a specified layer under a specified template name. + +To use those saved templates as a starting point for a build, users should point +to one of them with :term:`TEMPLATECONF` environment variable:: + + TEMPLATECONF=/srv/work/alex/meta-alex/conf/templates/test-1 . /srv/work/alex/poky/oe-init-build-env build-try-test-1 + +The OpenEmbedded build system uses the environment variable +:term:`TEMPLATECONF` to locate the directory from which it gathers +configuration information that ultimately ends up in the +:term:`Build Directory` ``conf`` directory. + +If :term:`TEMPLATECONF` is not set, the default value is obtained +from ``.templateconf`` file that is read from the same directory as +``oe-init-build-env`` script. For the Poky reference distribution this +would be:: + + TEMPLATECONF=${TEMPLATECONF:-meta-poky/conf/templates/default} + +If you look at a configuration template directory, you will +see the ``bblayers.conf.sample``, ``local.conf.sample``, and +``conf-notes.txt`` files. The build system uses these files to form the +respective ``bblayers.conf`` file, ``local.conf`` file, and show +users a note about the build they're setting up +when running the ``oe-init-build-env`` setup script. These can be +edited further if needed to improve or change the build configurations +available to the users. + diff --git a/poky/documentation/dev-manual/customizing-images.rst b/poky/documentation/dev-manual/customizing-images.rst new file mode 100644 index 0000000000..5b18958ade --- /dev/null +++ b/poky/documentation/dev-manual/customizing-images.rst @@ -0,0 +1,223 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Customizing Images +****************** + +You can customize images to satisfy particular requirements. This +section describes several methods and provides guidelines for each. + +Customizing Images Using ``local.conf`` +======================================= + +Probably the easiest way to customize an image is to add a package by +way of the ``local.conf`` configuration file. Because it is limited to +local use, this method generally only allows you to add packages and is +not as flexible as creating your own customized image. When you add +packages using local variables this way, you need to realize that these +variable changes are in effect for every build and consequently affect +all images, which might not be what you require. + +To add a package to your image using the local configuration file, use +the :term:`IMAGE_INSTALL` variable with the ``:append`` operator:: + + IMAGE_INSTALL:append = " strace" + +Use of the syntax is important; specifically, the leading space +after the opening quote and before the package name, which is +``strace`` in this example. This space is required since the ``:append`` +operator does not add the space. + +Furthermore, you must use ``:append`` instead of the ``+=`` operator if +you want to avoid ordering issues. The reason for this is because doing +so unconditionally appends to the variable and avoids ordering problems +due to the variable being set in image recipes and ``.bbclass`` files +with operators like ``?=``. Using ``:append`` ensures the operation +takes effect. + +As shown in its simplest use, ``IMAGE_INSTALL:append`` affects all +images. It is possible to extend the syntax so that the variable applies +to a specific image only. Here is an example:: + + IMAGE_INSTALL:append:pn-core-image-minimal = " strace" + +This example adds ``strace`` to the ``core-image-minimal`` image only. + +You can add packages using a similar approach through the +:term:`CORE_IMAGE_EXTRA_INSTALL` variable. If you use this variable, only +``core-image-*`` images are affected. + +Customizing Images Using Custom ``IMAGE_FEATURES`` and ``EXTRA_IMAGE_FEATURES`` +=============================================================================== + +Another method for customizing your image is to enable or disable +high-level image features by using the +:term:`IMAGE_FEATURES` and +:term:`EXTRA_IMAGE_FEATURES` +variables. Although the functions for both variables are nearly +equivalent, best practices dictate using :term:`IMAGE_FEATURES` from within +a recipe and using :term:`EXTRA_IMAGE_FEATURES` from within your +``local.conf`` file, which is found in the :term:`Build Directory`. + +To understand how these features work, the best reference is +:ref:`meta/classes-recipe/image.bbclass `. +This class lists out the available +:term:`IMAGE_FEATURES` of which most map to package groups while some, such +as ``debug-tweaks`` and ``read-only-rootfs``, resolve as general +configuration settings. + +In summary, the file looks at the contents of the :term:`IMAGE_FEATURES` +variable and then maps or configures the feature accordingly. Based on +this information, the build system automatically adds the appropriate +packages or configurations to the +:term:`IMAGE_INSTALL` variable. +Effectively, you are enabling extra features by extending the class or +creating a custom class for use with specialized image ``.bb`` files. + +Use the :term:`EXTRA_IMAGE_FEATURES` variable from within your local +configuration file. Using a separate area from which to enable features +with this variable helps you avoid overwriting the features in the image +recipe that are enabled with :term:`IMAGE_FEATURES`. The value of +:term:`EXTRA_IMAGE_FEATURES` is added to :term:`IMAGE_FEATURES` within +``meta/conf/bitbake.conf``. + +To illustrate how you can use these variables to modify your image, +consider an example that selects the SSH server. The Yocto Project ships +with two SSH servers you can use with your images: Dropbear and OpenSSH. +Dropbear is a minimal SSH server appropriate for resource-constrained +environments, while OpenSSH is a well-known standard SSH server +implementation. By default, the ``core-image-sato`` image is configured +to use Dropbear. The ``core-image-full-cmdline`` and ``core-image-lsb`` +images both include OpenSSH. The ``core-image-minimal`` image does not +contain an SSH server. + +You can customize your image and change these defaults. Edit the +:term:`IMAGE_FEATURES` variable in your recipe or use the +:term:`EXTRA_IMAGE_FEATURES` in your ``local.conf`` file so that it +configures the image you are working with to include +``ssh-server-dropbear`` or ``ssh-server-openssh``. + +.. note:: + + See the ":ref:`ref-manual/features:image features`" section in the Yocto + Project Reference Manual for a complete list of image features that ship + with the Yocto Project. + +Customizing Images Using Custom .bb Files +========================================= + +You can also customize an image by creating a custom recipe that defines +additional software as part of the image. The following example shows +the form for the two lines you need:: + + IMAGE_INSTALL = "packagegroup-core-x11-base package1 package2" + inherit core-image + +Defining the software using a custom recipe gives you total control over +the contents of the image. It is important to use the correct names of +packages in the :term:`IMAGE_INSTALL` variable. You must use the +OpenEmbedded notation and not the Debian notation for the names (e.g. +``glibc-dev`` instead of ``libc6-dev``). + +The other method for creating a custom image is to base it on an +existing image. For example, if you want to create an image based on +``core-image-sato`` but add the additional package ``strace`` to the +image, copy the ``meta/recipes-sato/images/core-image-sato.bb`` to a new +``.bb`` and add the following line to the end of the copy:: + + IMAGE_INSTALL += "strace" + +Customizing Images Using Custom Package Groups +============================================== + +For complex custom images, the best approach for customizing an image is +to create a custom package group recipe that is used to build the image +or images. A good example of a package group recipe is +``meta/recipes-core/packagegroups/packagegroup-base.bb``. + +If you examine that recipe, you see that the :term:`PACKAGES` variable lists +the package group packages to produce. The ``inherit packagegroup`` +statement sets appropriate default values and automatically adds +``-dev``, ``-dbg``, and ``-ptest`` complementary packages for each +package specified in the :term:`PACKAGES` statement. + +.. note:: + + The ``inherit packagegroup`` line should be located near the top of the + recipe, certainly before the :term:`PACKAGES` statement. + +For each package you specify in :term:`PACKAGES`, you can use :term:`RDEPENDS` +and :term:`RRECOMMENDS` entries to provide a list of packages the parent +task package should contain. You can see examples of these further down +in the ``packagegroup-base.bb`` recipe. + +Here is a short, fabricated example showing the same basic pieces for a +hypothetical packagegroup defined in ``packagegroup-custom.bb``, where +the variable :term:`PN` is the standard way to abbreviate the reference to +the full packagegroup name ``packagegroup-custom``:: + + DESCRIPTION = "My Custom Package Groups" + + inherit packagegroup + + PACKAGES = "\ + ${PN}-apps \ + ${PN}-tools \ + " + + RDEPENDS:${PN}-apps = "\ + dropbear \ + portmap \ + psplash" + + RDEPENDS:${PN}-tools = "\ + oprofile \ + oprofileui-server \ + lttng-tools" + + RRECOMMENDS:${PN}-tools = "\ + kernel-module-oprofile" + +In the previous example, two package group packages are created with +their dependencies and their recommended package dependencies listed: +``packagegroup-custom-apps``, and ``packagegroup-custom-tools``. To +build an image using these package group packages, you need to add +``packagegroup-custom-apps`` and/or ``packagegroup-custom-tools`` to +:term:`IMAGE_INSTALL`. For other forms of image dependencies see the other +areas of this section. + +Customizing an Image Hostname +============================= + +By default, the configured hostname (i.e. ``/etc/hostname``) in an image +is the same as the machine name. For example, if +:term:`MACHINE` equals "qemux86", the +configured hostname written to ``/etc/hostname`` is "qemux86". + +You can customize this name by altering the value of the "hostname" +variable in the ``base-files`` recipe using either an append file or a +configuration file. Use the following in an append file:: + + hostname = "myhostname" + +Use the following in a configuration file:: + + hostname:pn-base-files = "myhostname" + +Changing the default value of the variable "hostname" can be useful in +certain situations. For example, suppose you need to do extensive +testing on an image and you would like to easily identify the image +under test from existing images with typical default hostnames. In this +situation, you could change the default hostname to "testme", which +results in all the images using the name "testme". Once testing is +complete and you do not need to rebuild the image for test any longer, +you can easily reset the default hostname. + +Another point of interest is that if you unset the variable, the image +will have no default hostname in the filesystem. Here is an example that +unsets the variable in a configuration file:: + + hostname:pn-base-files = "" + +Having no default hostname in the filesystem is suitable for +environments that use dynamic hostnames such as virtual machines. + diff --git a/poky/documentation/dev-manual/debugging.rst b/poky/documentation/dev-manual/debugging.rst new file mode 100644 index 0000000000..9fb159eae6 --- /dev/null +++ b/poky/documentation/dev-manual/debugging.rst @@ -0,0 +1,1249 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Debugging Tools and Techniques +****************************** + +The exact method for debugging build failures depends on the nature of +the problem and on the system's area from which the bug originates. +Standard debugging practices such as comparison against the last known +working version with examination of the changes and the re-application +of steps to identify the one causing the problem are valid for the Yocto +Project just as they are for any other system. Even though it is +impossible to detail every possible potential failure, this section +provides some general tips to aid in debugging given a variety of +situations. + +.. note:: + + A useful feature for debugging is the error reporting tool. + Configuring the Yocto Project to use this tool causes the + OpenEmbedded build system to produce error reporting commands as part + of the console output. You can enter the commands after the build + completes to log error information into a common database, that can + help you figure out what might be going wrong. For information on how + to enable and use this feature, see the + ":ref:`dev-manual/error-reporting-tool:using the error reporting tool`" + section. + +The following list shows the debugging topics in the remainder of this +section: + +- ":ref:`dev-manual/debugging:viewing logs from failed tasks`" describes + how to find and view logs from tasks that failed during the build + process. + +- ":ref:`dev-manual/debugging:viewing variable values`" describes how to + use the BitBake ``-e`` option to examine variable values after a + recipe has been parsed. + +- ":ref:`dev-manual/debugging:viewing package information with \`\`oe-pkgdata-util\`\``" + describes how to use the ``oe-pkgdata-util`` utility to query + :term:`PKGDATA_DIR` and + display package-related information for built packages. + +- ":ref:`dev-manual/debugging:viewing dependencies between recipes and tasks`" + describes how to use the BitBake ``-g`` option to display recipe + dependency information used during the build. + +- ":ref:`dev-manual/debugging:viewing task variable dependencies`" describes + how to use the ``bitbake-dumpsig`` command in conjunction with key + subdirectories in the :term:`Build Directory` to determine variable + dependencies. + +- ":ref:`dev-manual/debugging:running specific tasks`" describes + how to use several BitBake options (e.g. ``-c``, ``-C``, and ``-f``) + to run specific tasks in the build chain. It can be useful to run + tasks "out-of-order" when trying isolate build issues. + +- ":ref:`dev-manual/debugging:general BitBake problems`" describes how + to use BitBake's ``-D`` debug output option to reveal more about what + BitBake is doing during the build. + +- ":ref:`dev-manual/debugging:building with no dependencies`" + describes how to use the BitBake ``-b`` option to build a recipe + while ignoring dependencies. + +- ":ref:`dev-manual/debugging:recipe logging mechanisms`" + describes how to use the many recipe logging functions to produce + debugging output and report errors and warnings. + +- ":ref:`dev-manual/debugging:debugging parallel make races`" + describes how to debug situations where the build consists of several + parts that are run simultaneously and when the output or result of + one part is not ready for use with a different part of the build that + depends on that output. + +- ":ref:`dev-manual/debugging:debugging with the gnu project debugger (gdb) remotely`" + describes how to use GDB to allow you to examine running programs, which can + help you fix problems. + +- ":ref:`dev-manual/debugging:debugging with the gnu project debugger (gdb) on the target`" + describes how to use GDB directly on target hardware for debugging. + +- ":ref:`dev-manual/debugging:other debugging tips`" describes + miscellaneous debugging tips that can be useful. + +Viewing Logs from Failed Tasks +============================== + +You can find the log for a task in the file +``${``\ :term:`WORKDIR`\ ``}/temp/log.do_``\ `taskname`. +For example, the log for the +:ref:`ref-tasks-compile` task of the +QEMU minimal image for the x86 machine (``qemux86``) might be in +``tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_compile``. +To see the commands :term:`BitBake` ran +to generate a log, look at the corresponding ``run.do_``\ `taskname` file +in the same directory. + +``log.do_``\ `taskname` and ``run.do_``\ `taskname` are actually symbolic +links to ``log.do_``\ `taskname`\ ``.``\ `pid` and +``log.run_``\ `taskname`\ ``.``\ `pid`, where `pid` is the PID the task had +when it ran. The symlinks always point to the files corresponding to the +most recent run. + +Viewing Variable Values +======================= + +Sometimes you need to know the value of a variable as a result of +BitBake's parsing step. This could be because some unexpected behavior +occurred in your project. Perhaps an attempt to :ref:`modify a variable +` did not work out as expected. + +BitBake's ``-e`` option is used to display variable values after +parsing. The following command displays the variable values after the +configuration files (i.e. ``local.conf``, ``bblayers.conf``, +``bitbake.conf`` and so forth) have been parsed:: + + $ bitbake -e + +The following command displays variable values after a specific recipe has +been parsed. The variables include those from the configuration as well:: + + $ bitbake -e recipename + +.. note:: + + Each recipe has its own private set of variables (datastore). + Internally, after parsing the configuration, a copy of the resulting + datastore is made prior to parsing each recipe. This copying implies + that variables set in one recipe will not be visible to other + recipes. + + Likewise, each task within a recipe gets a private datastore based on + the recipe datastore, which means that variables set within one task + will not be visible to other tasks. + +In the output of ``bitbake -e``, each variable is preceded by a +description of how the variable got its value, including temporary +values that were later overridden. This description also includes +variable flags (varflags) set on the variable. The output can be very +helpful during debugging. + +Variables that are exported to the environment are preceded by +``export`` in the output of ``bitbake -e``. See the following example:: + + export CC="i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/ulf/poky/build/tmp/sysroots/qemux86" + +In addition to variable values, the output of the ``bitbake -e`` and +``bitbake -e`` recipe commands includes the following information: + +- The output starts with a tree listing all configuration files and + classes included globally, recursively listing the files they include + or inherit in turn. Much of the behavior of the OpenEmbedded build + system (including the behavior of the :ref:`ref-manual/tasks:normal recipe build tasks`) is + implemented in the :ref:`ref-classes-base` class and the + classes it inherits, rather than being built into BitBake itself. + +- After the variable values, all functions appear in the output. For + shell functions, variables referenced within the function body are + expanded. If a function has been modified using overrides or using + override-style operators like ``:append`` and ``:prepend``, then the + final assembled function body appears in the output. + +Viewing Package Information with ``oe-pkgdata-util`` +==================================================== + +You can use the ``oe-pkgdata-util`` command-line utility to query +:term:`PKGDATA_DIR` and display +various package-related information. When you use the utility, you must +use it to view information on packages that have already been built. + +Following are a few of the available ``oe-pkgdata-util`` subcommands. + +.. note:: + + You can use the standard \* and ? globbing wildcards as part of + package names and paths. + +- ``oe-pkgdata-util list-pkgs [pattern]``: Lists all packages + that have been built, optionally limiting the match to packages that + match pattern. + +- ``oe-pkgdata-util list-pkg-files package ...``: Lists the + files and directories contained in the given packages. + + .. note:: + + A different way to view the contents of a package is to look at + the + ``${``\ :term:`WORKDIR`\ ``}/packages-split`` + directory of the recipe that generates the package. This directory + is created by the + :ref:`ref-tasks-package` task + and has one subdirectory for each package the recipe generates, + which contains the files stored in that package. + + If you want to inspect the ``${WORKDIR}/packages-split`` + directory, make sure that :ref:`ref-classes-rm-work` is not + enabled when you build the recipe. + +- ``oe-pkgdata-util find-path path ...``: Lists the names of + the packages that contain the given paths. For example, the following + tells us that ``/usr/share/man/man1/make.1`` is contained in the + ``make-doc`` package:: + + $ oe-pkgdata-util find-path /usr/share/man/man1/make.1 + make-doc: /usr/share/man/man1/make.1 + +- ``oe-pkgdata-util lookup-recipe package ...``: Lists the name + of the recipes that produce the given packages. + +For more information on the ``oe-pkgdata-util`` command, use the help +facility:: + + $ oe-pkgdata-util --help + $ oe-pkgdata-util subcommand --help + +Viewing Dependencies Between Recipes and Tasks +============================================== + +Sometimes it can be hard to see why BitBake wants to build other recipes +before the one you have specified. Dependency information can help you +understand why a recipe is built. + +To generate dependency information for a recipe, run the following +command:: + + $ bitbake -g recipename + +This command writes the following files in the current directory: + +- ``pn-buildlist``: A list of recipes/targets involved in building + `recipename`. "Involved" here means that at least one task from the + recipe needs to run when building `recipename` from scratch. Targets + that are in + :term:`ASSUME_PROVIDED` + are not listed. + +- ``task-depends.dot``: A graph showing dependencies between tasks. + +The graphs are in :wikipedia:`DOT ` +format and can be converted to images (e.g. using the ``dot`` tool from +`Graphviz `__). + +.. note:: + + - DOT files use a plain text format. The graphs generated using the + ``bitbake -g`` command are often so large as to be difficult to + read without special pruning (e.g. with BitBake's ``-I`` option) + and processing. Despite the form and size of the graphs, the + corresponding ``.dot`` files can still be possible to read and + provide useful information. + + As an example, the ``task-depends.dot`` file contains lines such + as the following:: + + "libxslt.do_configure" -> "libxml2.do_populate_sysroot" + + The above example line reveals that the + :ref:`ref-tasks-configure` + task in ``libxslt`` depends on the + :ref:`ref-tasks-populate_sysroot` + task in ``libxml2``, which is a normal + :term:`DEPENDS` dependency + between the two recipes. + + - For an example of how ``.dot`` files can be processed, see the + ``scripts/contrib/graph-tool`` Python script, which finds and + displays paths between graph nodes. + +You can use a different method to view dependency information by using +the following command:: + + $ bitbake -g -u taskexp recipename + +This command +displays a GUI window from which you can view build-time and runtime +dependencies for the recipes involved in building recipename. + +Viewing Task Variable Dependencies +================================== + +As mentioned in the +":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-execution:checksums (signatures)`" section of the BitBake +User Manual, BitBake tries to automatically determine what variables a +task depends on so that it can rerun the task if any values of the +variables change. This determination is usually reliable. However, if +you do things like construct variable names at runtime, then you might +have to manually declare dependencies on those variables using +``vardeps`` as described in the +":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:variable flags`" section of the BitBake +User Manual. + +If you are unsure whether a variable dependency is being picked up +automatically for a given task, you can list the variable dependencies +BitBake has determined by doing the following: + +#. Build the recipe containing the task:: + + $ bitbake recipename + +#. Inside the :term:`STAMPS_DIR` + directory, find the signature data (``sigdata``) file that + corresponds to the task. The ``sigdata`` files contain a pickled + Python database of all the metadata that went into creating the input + checksum for the task. As an example, for the + :ref:`ref-tasks-fetch` task of the + ``db`` recipe, the ``sigdata`` file might be found in the following + location:: + + ${BUILDDIR}/tmp/stamps/i586-poky-linux/db/6.0.30-r1.do_fetch.sigdata.7c048c18222b16ff0bcee2000ef648b1 + + For tasks that are accelerated through the shared state + (:ref:`sstate `) cache, an + additional ``siginfo`` file is written into + :term:`SSTATE_DIR` along with + the cached task output. The ``siginfo`` files contain exactly the + same information as ``sigdata`` files. + +#. Run ``bitbake-dumpsig`` on the ``sigdata`` or ``siginfo`` file. Here + is an example:: + + $ bitbake-dumpsig ${BUILDDIR}/tmp/stamps/i586-poky-linux/db/6.0.30-r1.do_fetch.sigdata.7c048c18222b16ff0bcee2000ef648b1 + + In the output of the above command, you will find a line like the + following, which lists all the (inferred) variable dependencies for + the task. This list also includes indirect dependencies from + variables depending on other variables, recursively:: + + Task dependencies: ['PV', 'SRCREV', 'SRC_URI', 'SRC_URI[md5sum]', 'SRC_URI[sha256sum]', 'base_do_fetch'] + + .. note:: + + Functions (e.g. ``base_do_fetch``) also count as variable dependencies. + These functions in turn depend on the variables they reference. + + The output of ``bitbake-dumpsig`` also includes the value each + variable had, a list of dependencies for each variable, and + :term:`BB_BASEHASH_IGNORE_VARS` + information. + +There is also a ``bitbake-diffsigs`` command for comparing two +``siginfo`` or ``sigdata`` files. This command can be helpful when +trying to figure out what changed between two versions of a task. If you +call ``bitbake-diffsigs`` with just one file, the command behaves like +``bitbake-dumpsig``. + +You can also use BitBake to dump out the signature construction +information without executing tasks by using either of the following +BitBake command-line options:: + + ‐‐dump-signatures=SIGNATURE_HANDLER + -S SIGNATURE_HANDLER + + +.. note:: + + Two common values for `SIGNATURE_HANDLER` are "none" and "printdiff", which + dump only the signature or compare the dumped signature with the cached one, + respectively. + +Using BitBake with either of these options causes BitBake to dump out +``sigdata`` files in the ``stamps`` directory for every task it would +have executed instead of building the specified target package. + +Viewing Metadata Used to Create the Input Signature of a Shared State Task +========================================================================== + +Seeing what metadata went into creating the input signature of a shared +state (sstate) task can be a useful debugging aid. This information is +available in signature information (``siginfo``) files in +:term:`SSTATE_DIR`. For +information on how to view and interpret information in ``siginfo`` +files, see the +":ref:`dev-manual/debugging:viewing task variable dependencies`" section. + +For conceptual information on shared state, see the +":ref:`overview-manual/concepts:shared state`" +section in the Yocto Project Overview and Concepts Manual. + +Invalidating Shared State to Force a Task to Run +================================================ + +The OpenEmbedded build system uses +:ref:`checksums ` and +:ref:`overview-manual/concepts:shared state` cache to avoid unnecessarily +rebuilding tasks. Collectively, this scheme is known as "shared state +code". + +As with all schemes, this one has some drawbacks. It is possible that +you could make implicit changes to your code that the checksum +calculations do not take into account. These implicit changes affect a +task's output but do not trigger the shared state code into rebuilding a +recipe. Consider an example during which a tool changes its output. +Assume that the output of ``rpmdeps`` changes. The result of the change +should be that all the ``package`` and ``package_write_rpm`` shared +state cache items become invalid. However, because the change to the +output is external to the code and therefore implicit, the associated +shared state cache items do not become invalidated. In this case, the +build process uses the cached items rather than running the task again. +Obviously, these types of implicit changes can cause problems. + +To avoid these problems during the build, you need to understand the +effects of any changes you make. Realize that changes you make directly +to a function are automatically factored into the checksum calculation. +Thus, these explicit changes invalidate the associated area of shared +state cache. However, you need to be aware of any implicit changes that +are not obvious changes to the code and could affect the output of a +given task. + +When you identify an implicit change, you can easily take steps to +invalidate the cache and force the tasks to run. The steps you can take +are as simple as changing a function's comments in the source code. For +example, to invalidate package shared state files, change the comment +statements of +:ref:`ref-tasks-package` or the +comments of one of the functions it calls. Even though the change is +purely cosmetic, it causes the checksum to be recalculated and forces +the build system to run the task again. + +.. note:: + + For an example of a commit that makes a cosmetic change to invalidate + shared state, see this + :yocto_git:`commit `. + +Running Specific Tasks +====================== + +Any given recipe consists of a set of tasks. The standard BitBake +behavior in most cases is: :ref:`ref-tasks-fetch`, :ref:`ref-tasks-unpack`, :ref:`ref-tasks-patch`, +:ref:`ref-tasks-configure`, :ref:`ref-tasks-compile`, :ref:`ref-tasks-install`, :ref:`ref-tasks-package`, +:ref:`do_package_write_* `, and :ref:`ref-tasks-build`. The default task is +:ref:`ref-tasks-build` and any tasks on which it depends build first. Some tasks, +such as :ref:`ref-tasks-devshell`, are not part of the default build chain. If you +wish to run a task that is not part of the default build chain, you can +use the ``-c`` option in BitBake. Here is an example:: + + $ bitbake matchbox-desktop -c devshell + +The ``-c`` option respects task dependencies, which means that all other +tasks (including tasks from other recipes) that the specified task +depends on will be run before the task. Even when you manually specify a +task to run with ``-c``, BitBake will only run the task if it considers +it "out of date". See the +":ref:`overview-manual/concepts:stamp files and the rerunning of tasks`" +section in the Yocto Project Overview and Concepts Manual for how +BitBake determines whether a task is "out of date". + +If you want to force an up-to-date task to be rerun (e.g. because you +made manual modifications to the recipe's +:term:`WORKDIR` that you want to try +out), then you can use the ``-f`` option. + +.. note:: + + The reason ``-f`` is never required when running the + :ref:`ref-tasks-devshell` task is because the + [\ :ref:`nostamp `\ ] + variable flag is already set for the task. + +The following example shows one way you can use the ``-f`` option:: + + $ bitbake matchbox-desktop + . + . + make some changes to the source code in the work directory + . + . + $ bitbake matchbox-desktop -c compile -f + $ bitbake matchbox-desktop + +This sequence first builds and then recompiles ``matchbox-desktop``. The +last command reruns all tasks (basically the packaging tasks) after the +compile. BitBake recognizes that the :ref:`ref-tasks-compile` task was rerun and +therefore understands that the other tasks also need to be run again. + +Another, shorter way to rerun a task and all +:ref:`ref-manual/tasks:normal recipe build tasks` +that depend on it is to use the ``-C`` option. + +.. note:: + + This option is upper-cased and is separate from the ``-c`` + option, which is lower-cased. + +Using this option invalidates the given task and then runs the +:ref:`ref-tasks-build` task, which is +the default task if no task is given, and the tasks on which it depends. +You could replace the final two commands in the previous example with +the following single command:: + + $ bitbake matchbox-desktop -C compile + +Internally, the ``-f`` and ``-C`` options work by tainting (modifying) +the input checksum of the specified task. This tainting indirectly +causes the task and its dependent tasks to be rerun through the normal +task dependency mechanisms. + +.. note:: + + BitBake explicitly keeps track of which tasks have been tainted in + this fashion, and will print warnings such as the following for + builds involving such tasks: + + .. code-block:: none + + WARNING: /home/ulf/poky/meta/recipes-sato/matchbox-desktop/matchbox-desktop_2.1.bb.do_compile is tainted from a forced run + + + The purpose of the warning is to let you know that the work directory + and build output might not be in the clean state they would be in for + a "normal" build, depending on what actions you took. To get rid of + such warnings, you can remove the work directory and rebuild the + recipe, as follows:: + + $ bitbake matchbox-desktop -c clean + $ bitbake matchbox-desktop + + +You can view a list of tasks in a given package by running the +:ref:`ref-tasks-listtasks` task as follows:: + + $ bitbake matchbox-desktop -c listtasks + +The results appear as output to the console and are also in +the file ``${WORKDIR}/temp/log.do_listtasks``. + +General BitBake Problems +======================== + +You can see debug output from BitBake by using the ``-D`` option. The +debug output gives more information about what BitBake is doing and the +reason behind it. Each ``-D`` option you use increases the logging +level. The most common usage is ``-DDD``. + +The output from ``bitbake -DDD -v targetname`` can reveal why BitBake +chose a certain version of a package or why BitBake picked a certain +provider. This command could also help you in a situation where you +think BitBake did something unexpected. + +Building with No Dependencies +============================= + +To build a specific recipe (``.bb`` file), you can use the following +command form:: + + $ bitbake -b somepath/somerecipe.bb + +This command form does +not check for dependencies. Consequently, you should use it only when +you know existing dependencies have been met. + +.. note:: + + You can also specify fragments of the filename. In this case, BitBake + checks for a unique match. + +Recipe Logging Mechanisms +========================= + +The Yocto Project provides several logging functions for producing +debugging output and reporting errors and warnings. For Python +functions, the following logging functions are available. All of these functions +log to ``${T}/log.do_``\ `task`, and can also log to standard output +(stdout) with the right settings: + +- ``bb.plain(msg)``: Writes msg as is to the log while also + logging to stdout. + +- ``bb.note(msg)``: Writes "NOTE: msg" to the log. Also logs to + stdout if BitBake is called with "-v". + +- ``bb.debug(level, msg)``: Writes "DEBUG: msg" to the + log. Also logs to stdout if the log level is greater than or equal to + level. See the ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-intro:usage and syntax`" option + in the BitBake User Manual for more information. + +- ``bb.warn(msg)``: Writes "WARNING: msg" to the log while also + logging to stdout. + +- ``bb.error(msg)``: Writes "ERROR: msg" to the log while also + logging to standard out (stdout). + + .. note:: + + Calling this function does not cause the task to fail. + +- ``bb.fatal(msg)``: This logging function is similar to + ``bb.error(msg)`` but also causes the calling task to fail. + + .. note:: + + ``bb.fatal()`` raises an exception, which means you do not need to put a + "return" statement after the function. + +The same logging functions are also available in shell functions, under +the names ``bbplain``, ``bbnote``, ``bbdebug``, ``bbwarn``, ``bberror``, +and ``bbfatal``. The :ref:`ref-classes-logging` class +implements these functions. See that class in the ``meta/classes`` +folder of the :term:`Source Directory` for information. + +Logging With Python +------------------- + +When creating recipes using Python and inserting code that handles build +logs, keep in mind the goal is to have informative logs while keeping +the console as "silent" as possible. Also, if you want status messages +in the log, use the "debug" loglevel. + +Following is an example written in Python. The code handles logging for +a function that determines the number of tasks needed to be run. See the +":ref:`ref-tasks-listtasks`" +section for additional information:: + + python do_listtasks() { + bb.debug(2, "Starting to figure out the task list") + if noteworthy_condition: + bb.note("There are 47 tasks to run") + bb.debug(2, "Got to point xyz") + if warning_trigger: + bb.warn("Detected warning_trigger, this might be a problem later.") + if recoverable_error: + bb.error("Hit recoverable_error, you really need to fix this!") + if fatal_error: + bb.fatal("fatal_error detected, unable to print the task list") + bb.plain("The tasks present are abc") + bb.debug(2, "Finished figuring out the tasklist") + } + +Logging With Bash +----------------- + +When creating recipes using Bash and inserting code that handles build +logs, you have the same goals --- informative with minimal console output. +The syntax you use for recipes written in Bash is similar to that of +recipes written in Python described in the previous section. + +Following is an example written in Bash. The code logs the progress of +the ``do_my_function`` function:: + + do_my_function() { + bbdebug 2 "Running do_my_function" + if [ exceptional_condition ]; then + bbnote "Hit exceptional_condition" + fi + bbdebug 2 "Got to point xyz" + if [ warning_trigger ]; then + bbwarn "Detected warning_trigger, this might cause a problem later." + fi + if [ recoverable_error ]; then + bberror "Hit recoverable_error, correcting" + fi + if [ fatal_error ]; then + bbfatal "fatal_error detected" + fi + bbdebug 2 "Completed do_my_function" + } + + +Debugging Parallel Make Races +============================= + +A parallel ``make`` race occurs when the build consists of several parts +that are run simultaneously and a situation occurs when the output or +result of one part is not ready for use with a different part of the +build that depends on that output. Parallel make races are annoying and +can sometimes be difficult to reproduce and fix. However, there are some simple +tips and tricks that can help you debug and fix them. This section +presents a real-world example of an error encountered on the Yocto +Project autobuilder and the process used to fix it. + +.. note:: + + If you cannot properly fix a ``make`` race condition, you can work around it + by clearing either the :term:`PARALLEL_MAKE` or :term:`PARALLEL_MAKEINST` + variables. + +The Failure +----------- + +For this example, assume that you are building an image that depends on +the "neard" package. And, during the build, BitBake runs into problems +and creates the following output. + +.. note:: + + This example log file has longer lines artificially broken to make + the listing easier to read. + +If you examine the output or the log file, you see the failure during +``make``: + +.. code-block:: none + + | DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common'] + | DEBUG: Executing shell function do_compile + | NOTE: make -j 16 + | make --no-print-directory all-am + | /bin/mkdir -p include/near + | /bin/mkdir -p include/near + | /bin/mkdir -p include/near + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/types.h include/near/types.h + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/log.h include/near/log.h + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/plugin.h include/near/plugin.h + | /bin/mkdir -p include/near + | /bin/mkdir -p include/near + | /bin/mkdir -p include/near + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/tag.h include/near/tag.h + | /bin/mkdir -p include/near + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/adapter.h include/near/adapter.h + | /bin/mkdir -p include/near + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/ndef.h include/near/ndef.h + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/tlv.h include/near/tlv.h + | /bin/mkdir -p include/near + | /bin/mkdir -p include/near + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/setting.h include/near/setting.h + | /bin/mkdir -p include/near + | /bin/mkdir -p include/near + | /bin/mkdir -p include/near + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/device.h include/near/device.h + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/nfc_copy.h include/near/nfc_copy.h + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/snep.h include/near/snep.h + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/version.h include/near/version.h + | ln -s /home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/work/i586-poky-linux/neard/ + 0.14-r0/neard-0.14/include/dbus.h include/near/dbus.h + | ./src/genbuiltin nfctype1 nfctype2 nfctype3 nfctype4 p2p > src/builtin.h + | i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/pokybuild/yocto-autobuilder/nightly-x86/ + build/build/tmp/sysroots/qemux86 -DHAVE_CONFIG_H -I. -I./include -I./src -I./gdbus -I/home/pokybuild/ + yocto-autobuilder/nightly-x86/build/build/tmp/sysroots/qemux86/usr/include/glib-2.0 + -I/home/pokybuild/yocto-autobuilder/nightly-x86/build/build/tmp/sysroots/qemux86/usr/ + lib/glib-2.0/include -I/home/pokybuild/yocto-autobuilder/nightly-x86/build/build/ + tmp/sysroots/qemux86/usr/include/dbus-1.0 -I/home/pokybuild/yocto-autobuilder/ + nightly-x86/build/build/tmp/sysroots/qemux86/usr/lib/dbus-1.0/include -I/home/pokybuild/yocto-autobuilder/ + nightly-x86/build/build/tmp/sysroots/qemux86/usr/include/libnl3 + -DNEAR_PLUGIN_BUILTIN -DPLUGINDIR=\""/usr/lib/near/plugins"\" + -DCONFIGDIR=\""/etc/neard\"" -O2 -pipe -g -feliminate-unused-debug-types -c + -o tools/snep-send.o tools/snep-send.c + | In file included from tools/snep-send.c:16:0: + | tools/../src/near.h:41:23: fatal error: near/dbus.h: No such file or directory + | #include + | ^ + | compilation terminated. + | make[1]: *** [tools/snep-send.o] Error 1 + | make[1]: *** Waiting for unfinished jobs.... + | make: *** [all] Error 2 + | ERROR: oe_runmake failed + +Reproducing the Error +--------------------- + +Because race conditions are intermittent, they do not manifest +themselves every time you do the build. In fact, most times the build +will complete without problems even though the potential race condition +exists. Thus, once the error surfaces, you need a way to reproduce it. + +In this example, compiling the "neard" package is causing the problem. +So the first thing to do is build "neard" locally. Before you start the +build, set the +:term:`PARALLEL_MAKE` variable +in your ``local.conf`` file to a high number (e.g. "-j 20"). Using a +high value for :term:`PARALLEL_MAKE` increases the chances of the race +condition showing up:: + + $ bitbake neard + +Once the local build for "neard" completes, start a ``devshell`` build:: + + $ bitbake neard -c devshell + +For information on how to use a ``devshell``, see the +":ref:`dev-manual/development-shell:using a development shell`" section. + +In the ``devshell``, do the following:: + + $ make clean + $ make tools/snep-send.o + +The ``devshell`` commands cause the failure to clearly +be visible. In this case, there is a missing dependency for the ``neard`` +Makefile target. Here is some abbreviated, sample output with the +missing dependency clearly visible at the end:: + + i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/scott-lenovo/...... + . + . + . + tools/snep-send.c + In file included from tools/snep-send.c:16:0: + tools/../src/near.h:41:23: fatal error: near/dbus.h: No such file or directory + #include + ^ + compilation terminated. + make: *** [tools/snep-send.o] Error 1 + $ + + +Creating a Patch for the Fix +---------------------------- + +Because there is a missing dependency for the Makefile target, you need +to patch the ``Makefile.am`` file, which is generated from +``Makefile.in``. You can use Quilt to create the patch:: + + $ quilt new parallelmake.patch + Patch patches/parallelmake.patch is now on top + $ quilt add Makefile.am + File Makefile.am added to patch patches/parallelmake.patch + +For more information on using Quilt, see the +":ref:`dev-manual/quilt:using quilt in your workflow`" section. + +At this point you need to make the edits to ``Makefile.am`` to add the +missing dependency. For our example, you have to add the following line +to the file:: + + tools/snep-send.$(OBJEXT): include/near/dbus.h + +Once you have edited the file, use the ``refresh`` command to create the +patch:: + + $ quilt refresh + Refreshed patch patches/parallelmake.patch + +Once the patch file is created, you need to add it back to the originating +recipe folder. Here is an example assuming a top-level +:term:`Source Directory` named ``poky``:: + + $ cp patches/parallelmake.patch poky/meta/recipes-connectivity/neard/neard + +The final thing you need to do to implement the fix in the build is to +update the "neard" recipe (i.e. ``neard-0.14.bb``) so that the +:term:`SRC_URI` statement includes +the patch file. The recipe file is in the folder above the patch. Here +is what the edited :term:`SRC_URI` statement would look like:: + + SRC_URI = "${KERNELORG_MIRROR}/linux/network/nfc/${BPN}-${PV}.tar.xz \ + file://neard.in \ + file://neard.service.in \ + file://parallelmake.patch \ + " + +With the patch complete and moved to the correct folder and the +:term:`SRC_URI` statement updated, you can exit the ``devshell``:: + + $ exit + +Testing the Build +----------------- + +With everything in place, you can get back to trying the build again +locally:: + + $ bitbake neard + +This build should succeed. + +Now you can open up a ``devshell`` again and repeat the clean and make +operations as follows:: + + $ bitbake neard -c devshell + $ make clean + $ make tools/snep-send.o + +The build should work without issue. + +As with all solved problems, if they originated upstream, you need to +submit the fix for the recipe in OE-Core and upstream so that the +problem is taken care of at its source. See the +":ref:`dev-manual/changes:submitting a change to the yocto project`" +section for more information. + +Debugging With the GNU Project Debugger (GDB) Remotely +====================================================== + +GDB allows you to examine running programs, which in turn helps you to +understand and fix problems. It also allows you to perform post-mortem +style analysis of program crashes. GDB is available as a package within +the Yocto Project and is installed in SDK images by default. See the +":ref:`ref-manual/images:Images`" chapter in the Yocto +Project Reference Manual for a description of these images. You can find +information on GDB at https://sourceware.org/gdb/. + +.. note:: + + For best results, install debug (``-dbg``) packages for the applications you + are going to debug. Doing so makes extra debug symbols available that give + you more meaningful output. + +Sometimes, due to memory or disk space constraints, it is not possible +to use GDB directly on the remote target to debug applications. These +constraints arise because GDB needs to load the debugging information +and the binaries of the process being debugged. Additionally, GDB needs +to perform many computations to locate information such as function +names, variable names and values, stack traces and so forth --- even +before starting the debugging process. These extra computations place +more load on the target system and can alter the characteristics of the +program being debugged. + +To help get past the previously mentioned constraints, there are two +methods you can use: running a debuginfod server and using gdbserver. + +Using the debuginfod server method +---------------------------------- + +``debuginfod`` from ``elfutils`` is a way to distribute ``debuginfo`` files. +Running a ``debuginfod`` server makes debug symbols readily available, +which means you don't need to download debugging information +and the binaries of the process being debugged. You can just fetch +debug symbols from the server. + +To run a ``debuginfod`` server, you need to do the following: + +- Ensure that ``debuginfod`` is present in :term:`DISTRO_FEATURES` + (it already is in ``OpenEmbedded-core`` defaults and ``poky`` reference distribution). + If not, set in your distro config file or in ``local.conf``:: + + DISTRO_FEATURES:append = " debuginfod" + + This distro feature enables the server and client library in ``elfutils``, + and enables ``debuginfod`` support in clients (at the moment, ``gdb`` and ``binutils``). + +- Run the following commands to launch the ``debuginfod`` server on the host:: + + $ oe-debuginfod + +- To use ``debuginfod`` on the target, you need to know the ip:port where + ``debuginfod`` is listening on the host (port defaults to 8002), and export + that into the shell environment, for example in ``qemu``:: + + root@qemux86-64:~# export DEBUGINFOD_URLS="http://192.168.7.1:8002/" + +- Then debug info fetching should simply work when running the target ``gdb``, + ``readelf`` or ``objdump``, for example:: + + root@qemux86-64:~# gdb /bin/cat + ... + Reading symbols from /bin/cat... + Downloading separate debug info for /bin/cat... + Reading symbols from /home/root/.cache/debuginfod_client/923dc4780cfbc545850c616bffa884b6b5eaf322/debuginfo... + +- It's also possible to use ``debuginfod-find`` to just query the server:: + + root@qemux86-64:~# debuginfod-find debuginfo /bin/ls + /home/root/.cache/debuginfod_client/356edc585f7f82d46f94fcb87a86a3fe2d2e60bd/debuginfo + + +Using the gdbserver method +-------------------------- + +gdbserver, which runs on the remote target and does not load any +debugging information from the debugged process. Instead, a GDB instance +processes the debugging information that is run on a remote computer - +the host GDB. The host GDB then sends control commands to gdbserver to +make it stop or start the debugged program, as well as read or write +memory regions of that debugged program. All the debugging information +loaded and processed as well as all the heavy debugging is done by the +host GDB. Offloading these processes gives the gdbserver running on the +target a chance to remain small and fast. + +Because the host GDB is responsible for loading the debugging +information and for doing the necessary processing to make actual +debugging happen, you have to make sure the host can access the +unstripped binaries complete with their debugging information and also +be sure the target is compiled with no optimizations. The host GDB must +also have local access to all the libraries used by the debugged +program. Because gdbserver does not need any local debugging +information, the binaries on the remote target can remain stripped. +However, the binaries must also be compiled without optimization so they +match the host's binaries. + +To remain consistent with GDB documentation and terminology, the binary +being debugged on the remote target machine is referred to as the +"inferior" binary. For documentation on GDB see the `GDB +site `__. + +The following steps show you how to debug using the GNU project +debugger. + +#. *Configure your build system to construct the companion debug + filesystem:* + + In your ``local.conf`` file, set the following:: + + IMAGE_GEN_DEBUGFS = "1" + IMAGE_FSTYPES_DEBUGFS = "tar.bz2" + + These options cause the + OpenEmbedded build system to generate a special companion filesystem + fragment, which contains the matching source and debug symbols to + your deployable filesystem. The build system does this by looking at + what is in the deployed filesystem, and pulling the corresponding + ``-dbg`` packages. + + The companion debug filesystem is not a complete filesystem, but only + contains the debug fragments. This filesystem must be combined with + the full filesystem for debugging. Subsequent steps in this procedure + show how to combine the partial filesystem with the full filesystem. + +#. *Configure the system to include gdbserver in the target filesystem:* + + Make the following addition in your ``local.conf`` file:: + + EXTRA_IMAGE_FEATURES:append = " tools-debug" + + The change makes + sure the ``gdbserver`` package is included. + +#. *Build the environment:* + + Use the following command to construct the image and the companion + Debug Filesystem:: + + $ bitbake image + + Build the cross GDB component and + make it available for debugging. Build the SDK that matches the + image. Building the SDK is best for a production build that can be + used later for debugging, especially during long term maintenance:: + + $ bitbake -c populate_sdk image + + Alternatively, you can build the minimal toolchain components that + match the target. Doing so creates a smaller than typical SDK and + only contains a minimal set of components with which to build simple + test applications, as well as run the debugger:: + + $ bitbake meta-toolchain + + A final method is to build Gdb itself within the build system:: + + $ bitbake gdb-cross- + + Doing so produces a temporary copy of + ``cross-gdb`` you can use for debugging during development. While + this is the quickest approach, the two previous methods in this step + are better when considering long-term maintenance strategies. + + .. note:: + + If you run ``bitbake gdb-cross``, the OpenEmbedded build system suggests + the actual image (e.g. ``gdb-cross-i586``). The suggestion is usually the + actual name you want to use. + +#. *Set up the* ``debugfs``\ *:* + + Run the following commands to set up the ``debugfs``:: + + $ mkdir debugfs + $ cd debugfs + $ tar xvfj build-dir/tmp/deploy/images/machine/image.rootfs.tar.bz2 + $ tar xvfj build-dir/tmp/deploy/images/machine/image-dbg.rootfs.tar.bz2 + +#. *Set up GDB:* + + Install the SDK (if you built one) and then source the correct + environment file. Sourcing the environment file puts the SDK in your + ``PATH`` environment variable and sets ``$GDB`` to the SDK's debugger. + + If you are using the build system, Gdb is located in + `build-dir`\ ``/tmp/sysroots/``\ `host`\ ``/usr/bin/``\ `architecture`\ ``/``\ `architecture`\ ``-gdb`` + +#. *Boot the target:* + + For information on how to run QEMU, see the `QEMU + Documentation `__. + + .. note:: + + Be sure to verify that your host can access the target via TCP. + +#. *Debug a program:* + + Debugging a program involves running gdbserver on the target and then + running Gdb on the host. The example in this step debugs ``gzip``: + + .. code-block:: shell + + root@qemux86:~# gdbserver localhost:1234 /bin/gzip —help + + For + additional gdbserver options, see the `GDB Server + Documentation `__. + + After running gdbserver on the target, you need to run Gdb on the + host and configure it and connect to the target. Use these commands:: + + $ cd directory-holding-the-debugfs-directory + $ arch-gdb + (gdb) set sysroot debugfs + (gdb) set substitute-path /usr/src/debug debugfs/usr/src/debug + (gdb) target remote IP-of-target:1234 + + At this + point, everything should automatically load (i.e. matching binaries, + symbols and headers). + + .. note:: + + The Gdb ``set`` commands in the previous example can be placed into the + users ``~/.gdbinit`` file. Upon starting, Gdb automatically runs whatever + commands are in that file. + +#. *Deploying without a full image rebuild:* + + In many cases, during development you want a quick method to deploy a + new binary to the target and debug it, without waiting for a full + image build. + + One approach to solving this situation is to just build the component + you want to debug. Once you have built the component, copy the + executable directly to both the target and the host ``debugfs``. + + If the binary is processed through the debug splitting in + OpenEmbedded, you should also copy the debug items (i.e. ``.debug`` + contents and corresponding ``/usr/src/debug`` files) from the work + directory. Here is an example:: + + $ bitbake bash + $ bitbake -c devshell bash + $ cd .. + $ scp packages-split/bash/bin/bash target:/bin/bash + $ cp -a packages-split/bash-dbg/\* path/debugfs + +Debugging with the GNU Project Debugger (GDB) on the Target +=========================================================== + +The previous section addressed using GDB remotely for debugging +purposes, which is the most usual case due to the inherent hardware +limitations on many embedded devices. However, debugging in the target +hardware itself is also possible with more powerful devices. This +section describes what you need to do in order to support using GDB to +debug on the target hardware. + +To support this kind of debugging, you need do the following: + +- Ensure that GDB is on the target. You can do this by making + the following addition to your ``local.conf`` file:: + + EXTRA_IMAGE_FEATURES:append = " tools-debug" + +- Ensure that debug symbols are present. You can do so by adding the + corresponding ``-dbg`` package to :term:`IMAGE_INSTALL`:: + + IMAGE_INSTALL:append = " packagename-dbg" + + Alternatively, you can add the following to ``local.conf`` to include + all the debug symbols:: + + EXTRA_IMAGE_FEATURES:append = " dbg-pkgs" + +.. note:: + + To improve the debug information accuracy, you can reduce the level + of optimization used by the compiler. For example, when adding the + following line to your ``local.conf`` file, you will reduce optimization + from :term:`FULL_OPTIMIZATION` of "-O2" to :term:`DEBUG_OPTIMIZATION` + of "-O -fno-omit-frame-pointer":: + + DEBUG_BUILD = "1" + + Consider that this will reduce the application's performance and is + recommended only for debugging purposes. + +Other Debugging Tips +==================== + +Here are some other tips that you might find useful: + +- When adding new packages, it is worth watching for undesirable items + making their way into compiler command lines. For example, you do not + want references to local system files like ``/usr/lib/`` or + ``/usr/include/``. + +- If you want to remove the ``psplash`` boot splashscreen, add + ``psplash=false`` to the kernel command line. Doing so prevents + ``psplash`` from loading and thus allows you to see the console. It + is also possible to switch out of the splashscreen by switching the + virtual console (e.g. Fn+Left or Fn+Right on a Zaurus). + +- Removing :term:`TMPDIR` (usually ``tmp/``, within the + :term:`Build Directory`) can often fix temporary build issues. Removing + :term:`TMPDIR` is usually a relatively cheap operation, because task output + will be cached in :term:`SSTATE_DIR` (usually ``sstate-cache/``, which is + also in the :term:`Build Directory`). + + .. note:: + + Removing :term:`TMPDIR` might be a workaround rather than a fix. + Consequently, trying to determine the underlying cause of an issue before + removing the directory is a good idea. + +- Understanding how a feature is used in practice within existing + recipes can be very helpful. It is recommended that you configure + some method that allows you to quickly search through files. + + Using GNU Grep, you can use the following shell function to + recursively search through common recipe-related files, skipping + binary files, ``.git`` directories, and the :term:`Build Directory` + (assuming its name starts with "build"):: + + g() { + grep -Ir \ + --exclude-dir=.git \ + --exclude-dir='build*' \ + --include='*.bb*' \ + --include='*.inc*' \ + --include='*.conf*' \ + --include='*.py*' \ + "$@" + } + + Following are some usage examples:: + + $ g FOO # Search recursively for "FOO" + $ g -i foo # Search recursively for "foo", ignoring case + $ g -w FOO # Search recursively for "FOO" as a word, ignoring e.g. "FOOBAR" + + If figuring + out how some feature works requires a lot of searching, it might + indicate that the documentation should be extended or improved. In + such cases, consider filing a documentation bug using the Yocto + Project implementation of + :yocto_bugs:`Bugzilla <>`. For information on + how to submit a bug against the Yocto Project, see the Yocto Project + Bugzilla :yocto_wiki:`wiki page ` + and the + ":ref:`dev-manual/changes:submitting a defect against the yocto project`" + section. + + .. note:: + + The manuals might not be the right place to document variables + that are purely internal and have a limited scope (e.g. internal + variables used to implement a single ``.bbclass`` file). + diff --git a/poky/documentation/dev-manual/development-shell.rst b/poky/documentation/dev-manual/development-shell.rst new file mode 100644 index 0000000000..a18d792150 --- /dev/null +++ b/poky/documentation/dev-manual/development-shell.rst @@ -0,0 +1,82 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Using a Development Shell +************************* + +When debugging certain commands or even when just editing packages, +``devshell`` can be a useful tool. When you invoke ``devshell``, all +tasks up to and including +:ref:`ref-tasks-patch` are run for the +specified target. Then, a new terminal is opened and you are placed in +``${``\ :term:`S`\ ``}``, the source +directory. In the new terminal, all the OpenEmbedded build-related +environment variables are still defined so you can use commands such as +``configure`` and ``make``. The commands execute just as if the +OpenEmbedded build system were executing them. Consequently, working +this way can be helpful when debugging a build or preparing software to +be used with the OpenEmbedded build system. + +Following is an example that uses ``devshell`` on a target named +``matchbox-desktop``:: + + $ bitbake matchbox-desktop -c devshell + +This command spawns a terminal with a shell prompt within the +OpenEmbedded build environment. The +:term:`OE_TERMINAL` variable +controls what type of shell is opened. + +For spawned terminals, the following occurs: + +- The ``PATH`` variable includes the cross-toolchain. + +- The ``pkgconfig`` variables find the correct ``.pc`` files. + +- The ``configure`` command finds the Yocto Project site files as well + as any other necessary files. + +Within this environment, you can run configure or compile commands as if +they were being run by the OpenEmbedded build system itself. As noted +earlier, the working directory also automatically changes to the Source +Directory (:term:`S`). + +To manually run a specific task using ``devshell``, run the +corresponding ``run.*`` script in the +``${``\ :term:`WORKDIR`\ ``}/temp`` +directory (e.g., ``run.do_configure.``\ `pid`). If a task's script does +not exist, which would be the case if the task was skipped by way of the +sstate cache, you can create the task by first running it outside of the +``devshell``:: + + $ bitbake -c task + +.. note:: + + - Execution of a task's ``run.*`` script and BitBake's execution of + a task are identical. In other words, running the script re-runs + the task just as it would be run using the ``bitbake -c`` command. + + - Any ``run.*`` file that does not have a ``.pid`` extension is a + symbolic link (symlink) to the most recent version of that file. + +Remember, that the ``devshell`` is a mechanism that allows you to get +into the BitBake task execution environment. And as such, all commands +must be called just as BitBake would call them. That means you need to +provide the appropriate options for cross-compilation and so forth as +applicable. + +When you are finished using ``devshell``, exit the shell or close the +terminal window. + +.. note:: + + - It is worth remembering that when using ``devshell`` you need to + use the full compiler name such as ``arm-poky-linux-gnueabi-gcc`` + instead of just using ``gcc``. The same applies to other + applications such as ``binutils``, ``libtool`` and so forth. + BitBake sets up environment variables such as :term:`CC` to assist + applications, such as ``make`` to find the correct tools. + + - It is also worth noting that ``devshell`` still works over X11 + forwarding and similar situations. + diff --git a/poky/documentation/dev-manual/device-manager.rst b/poky/documentation/dev-manual/device-manager.rst new file mode 100644 index 0000000000..4248c23b44 --- /dev/null +++ b/poky/documentation/dev-manual/device-manager.rst @@ -0,0 +1,72 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Selecting a Device Manager +************************** + +The Yocto Project provides multiple ways to manage the device manager +(``/dev``): + +- Persistent and Pre-Populated ``/dev``: For this case, the ``/dev`` + directory is persistent and the required device nodes are created + during the build. + +- Use ``devtmpfs`` with a Device Manager: For this case, the ``/dev`` + directory is provided by the kernel as an in-memory file system and + is automatically populated by the kernel at runtime. Additional + configuration of device nodes is done in user space by a device + manager like ``udev`` or ``busybox-mdev``. + +Using Persistent and Pre-Populated ``/dev`` +=========================================== + +To use the static method for device population, you need to set the +:term:`USE_DEVFS` variable to "0" +as follows:: + + USE_DEVFS = "0" + +The content of the resulting ``/dev`` directory is defined in a Device +Table file. The +:term:`IMAGE_DEVICE_TABLES` +variable defines the Device Table to use and should be set in the +machine or distro configuration file. Alternatively, you can set this +variable in your ``local.conf`` configuration file. + +If you do not define the :term:`IMAGE_DEVICE_TABLES` variable, the default +``device_table-minimal.txt`` is used:: + + IMAGE_DEVICE_TABLES = "device_table-mymachine.txt" + +The population is handled by the ``makedevs`` utility during image +creation: + +Using ``devtmpfs`` and a Device Manager +======================================= + +To use the dynamic method for device population, you need to use (or be +sure to set) the :term:`USE_DEVFS` +variable to "1", which is the default:: + + USE_DEVFS = "1" + +With this +setting, the resulting ``/dev`` directory is populated by the kernel +using ``devtmpfs``. Make sure the corresponding kernel configuration +variable ``CONFIG_DEVTMPFS`` is set when building you build a Linux +kernel. + +All devices created by ``devtmpfs`` will be owned by ``root`` and have +permissions ``0600``. + +To have more control over the device nodes, you can use a device manager +like ``udev`` or ``busybox-mdev``. You choose the device manager by +defining the ``VIRTUAL-RUNTIME_dev_manager`` variable in your machine or +distro configuration file. Alternatively, you can set this variable in +your ``local.conf`` configuration file:: + + VIRTUAL-RUNTIME_dev_manager = "udev" + + # Some alternative values + # VIRTUAL-RUNTIME_dev_manager = "busybox-mdev" + # VIRTUAL-RUNTIME_dev_manager = "systemd" + diff --git a/poky/documentation/dev-manual/disk-space.rst b/poky/documentation/dev-manual/disk-space.rst new file mode 100644 index 0000000000..3a5d2b7297 --- /dev/null +++ b/poky/documentation/dev-manual/disk-space.rst @@ -0,0 +1,39 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Conserving Disk Space +********************* + +Conserving Disk Space During Builds +=================================== + +To help conserve disk space during builds, you can add the following +statement to your project's ``local.conf`` configuration file found in +the :term:`Build Directory`:: + + INHERIT += "rm_work" + +Adding this statement deletes the work directory used for +building a recipe once the recipe is built. For more information on +"rm_work", see the :ref:`ref-classes-rm-work` class in the +Yocto Project Reference Manual. + +Purging Duplicate Shared State Cache Files +========================================== + +After multiple build iterations, the Shared State (sstate) cache can contain +duplicate cache files for a given package, while only the most recent one +is likely to be reusable. The following command purges all but the +newest sstate cache file for each package:: + + sstate-cache-management.sh --remove-duplicated --cache-dir=build/sstate-cache + +This command will ask you to confirm the deletions it identifies. + +.. note:: + + The duplicated sstate cache files of one package must have the same + architecture, which means that sstate cache files with multiple + architectures are not considered as duplicate. + +Run ``sstate-cache-management.sh`` for more details about this script. + diff --git a/poky/documentation/dev-manual/efficiently-fetching-sources.rst b/poky/documentation/dev-manual/efficiently-fetching-sources.rst new file mode 100644 index 0000000000..a15f0a92ce --- /dev/null +++ b/poky/documentation/dev-manual/efficiently-fetching-sources.rst @@ -0,0 +1,68 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Efficiently Fetching Source Files During a Build +************************************************ + +The OpenEmbedded build system works with source files located through +the :term:`SRC_URI` variable. When +you build something using BitBake, a big part of the operation is +locating and downloading all the source tarballs. For images, +downloading all the source for various packages can take a significant +amount of time. + +This section shows you how you can use mirrors to speed up fetching +source files and how you can pre-fetch files all of which leads to more +efficient use of resources and time. + +Setting up Effective Mirrors +============================ + +A good deal that goes into a Yocto Project build is simply downloading +all of the source tarballs. Maybe you have been working with another +build system for which you have built up a +sizable directory of source tarballs. Or, perhaps someone else has such +a directory for which you have read access. If so, you can save time by +adding statements to your configuration file so that the build process +checks local directories first for existing tarballs before checking the +Internet. + +Here is an efficient way to set it up in your ``local.conf`` file:: + + SOURCE_MIRROR_URL ?= "file:///home/you/your-download-dir/" + INHERIT += "own-mirrors" + BB_GENERATE_MIRROR_TARBALLS = "1" + # BB_NO_NETWORK = "1" + +In the previous example, the +:term:`BB_GENERATE_MIRROR_TARBALLS` +variable causes the OpenEmbedded build system to generate tarballs of +the Git repositories and store them in the +:term:`DL_DIR` directory. Due to +performance reasons, generating and storing these tarballs is not the +build system's default behavior. + +You can also use the +:term:`PREMIRRORS` variable. For +an example, see the variable's glossary entry in the Yocto Project +Reference Manual. + +Getting Source Files and Suppressing the Build +============================================== + +Another technique you can use to ready yourself for a successive string +of build operations, is to pre-fetch all the source files without +actually starting a build. This technique lets you work through any +download issues and ultimately gathers all the source files into your +download directory :ref:`structure-build-downloads`, +which is located with :term:`DL_DIR`. + +Use the following BitBake command form to fetch all the necessary +sources without starting the build:: + + $ bitbake target --runall=fetch + +This +variation of the BitBake command guarantees that you have all the +sources for that BitBake target should you disconnect from the Internet +and want to do the build later offline. + diff --git a/poky/documentation/dev-manual/error-reporting-tool.rst b/poky/documentation/dev-manual/error-reporting-tool.rst new file mode 100644 index 0000000000..84f3d9cd1e --- /dev/null +++ b/poky/documentation/dev-manual/error-reporting-tool.rst @@ -0,0 +1,84 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Using the Error Reporting Tool +****************************** + +The error reporting tool allows you to submit errors encountered during +builds to a central database. Outside of the build environment, you can +use a web interface to browse errors, view statistics, and query for +errors. The tool works using a client-server system where the client +portion is integrated with the installed Yocto Project +:term:`Source Directory` (e.g. ``poky``). +The server receives the information collected and saves it in a +database. + +There is a live instance of the error reporting server at +https://errors.yoctoproject.org. +When you want to get help with build failures, you can submit all of the +information on the failure easily and then point to the URL in your bug +report or send an email to the mailing list. + +.. note:: + + If you send error reports to this server, the reports become publicly + visible. + +Enabling and Using the Tool +=========================== + +By default, the error reporting tool is disabled. You can enable it by +inheriting the :ref:`ref-classes-report-error` class by adding the +following statement to the end of your ``local.conf`` file in your +:term:`Build Directory`:: + + INHERIT += "report-error" + +By default, the error reporting feature stores information in +``${``\ :term:`LOG_DIR`\ ``}/error-report``. +However, you can specify a directory to use by adding the following to +your ``local.conf`` file:: + + ERR_REPORT_DIR = "path" + +Enabling error +reporting causes the build process to collect the errors and store them +in a file as previously described. When the build system encounters an +error, it includes a command as part of the console output. You can run +the command to send the error file to the server. For example, the +following command sends the errors to an upstream server:: + + $ send-error-report /home/brandusa/project/poky/build/tmp/log/error-report/error_report_201403141617.txt + +In the previous example, the errors are sent to a public database +available at https://errors.yoctoproject.org, which is used by the +entire community. If you specify a particular server, you can send the +errors to a different database. Use the following command for more +information on available options:: + + $ send-error-report --help + +When sending the error file, you are prompted to review the data being +sent as well as to provide a name and optional email address. Once you +satisfy these prompts, the command returns a link from the server that +corresponds to your entry in the database. For example, here is a +typical link: https://errors.yoctoproject.org/Errors/Details/9522/ + +Following the link takes you to a web interface where you can browse, +query the errors, and view statistics. + +Disabling the Tool +================== + +To disable the error reporting feature, simply remove or comment out the +following statement from the end of your ``local.conf`` file in your +:term:`Build Directory`:: + + INHERIT += "report-error" + +Setting Up Your Own Error Reporting Server +========================================== + +If you want to set up your own error reporting server, you can obtain +the code from the Git repository at :yocto_git:`/error-report-web/`. +Instructions on how to set it up are in the README document. + diff --git a/poky/documentation/dev-manual/external-scm.rst b/poky/documentation/dev-manual/external-scm.rst new file mode 100644 index 0000000000..97a7e63e36 --- /dev/null +++ b/poky/documentation/dev-manual/external-scm.rst @@ -0,0 +1,67 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Using an External SCM +********************* + +If you're working on a recipe that pulls from an external Source Code +Manager (SCM), it is possible to have the OpenEmbedded build system +notice new recipe changes added to the SCM and then build the resulting +packages that depend on the new recipes by using the latest versions. +This only works for SCMs from which it is possible to get a sensible +revision number for changes. Currently, you can do this with Apache +Subversion (SVN), Git, and Bazaar (BZR) repositories. + +To enable this behavior, the :term:`PV` of +the recipe needs to reference +:term:`SRCPV`. Here is an example:: + + PV = "1.2.3+git${SRCPV}" + +Then, you can add the following to your +``local.conf``:: + + SRCREV:pn-PN = "${AUTOREV}" + +:term:`PN` is the name of the recipe for +which you want to enable automatic source revision updating. + +If you do not want to update your local configuration file, you can add +the following directly to the recipe to finish enabling the feature:: + + SRCREV = "${AUTOREV}" + +The Yocto Project provides a distribution named ``poky-bleeding``, whose +configuration file contains the line:: + + require conf/distro/include/poky-floating-revisions.inc + +This line pulls in the +listed include file that contains numerous lines of exactly that form:: + + #SRCREV:pn-opkg-native ?= "${AUTOREV}" + #SRCREV:pn-opkg-sdk ?= "${AUTOREV}" + #SRCREV:pn-opkg ?= "${AUTOREV}" + #SRCREV:pn-opkg-utils-native ?= "${AUTOREV}" + #SRCREV:pn-opkg-utils ?= "${AUTOREV}" + SRCREV:pn-gconf-dbus ?= "${AUTOREV}" + SRCREV:pn-matchbox-common ?= "${AUTOREV}" + SRCREV:pn-matchbox-config-gtk ?= "${AUTOREV}" + SRCREV:pn-matchbox-desktop ?= "${AUTOREV}" + SRCREV:pn-matchbox-keyboard ?= "${AUTOREV}" + SRCREV:pn-matchbox-panel-2 ?= "${AUTOREV}" + SRCREV:pn-matchbox-themes-extra ?= "${AUTOREV}" + SRCREV:pn-matchbox-terminal ?= "${AUTOREV}" + SRCREV:pn-matchbox-wm ?= "${AUTOREV}" + SRCREV:pn-settings-daemon ?= "${AUTOREV}" + SRCREV:pn-screenshot ?= "${AUTOREV}" + . . . + +These lines allow you to +experiment with building a distribution that tracks the latest +development source for numerous packages. + +.. note:: + + The ``poky-bleeding`` distribution is not tested on a regular basis. Keep + this in mind if you use it. + diff --git a/poky/documentation/dev-manual/external-toolchain.rst b/poky/documentation/dev-manual/external-toolchain.rst new file mode 100644 index 0000000000..238f8cf467 --- /dev/null +++ b/poky/documentation/dev-manual/external-toolchain.rst @@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Optionally Using an External Toolchain +************************************** + +You might want to use an external toolchain as part of your development. +If this is the case, the fundamental steps you need to accomplish are as +follows: + +- Understand where the installed toolchain resides. For cases where you + need to build the external toolchain, you would need to take separate + steps to build and install the toolchain. + +- Make sure you add the layer that contains the toolchain to your + ``bblayers.conf`` file through the + :term:`BBLAYERS` variable. + +- Set the :term:`EXTERNAL_TOOLCHAIN` variable in your ``local.conf`` file + to the location in which you installed the toolchain. + +The toolchain configuration is very flexible and customizable. It +is primarily controlled with the :term:`TCMODE` variable. This variable +controls which ``tcmode-*.inc`` file to include from the +``meta/conf/distro/include`` directory within the :term:`Source Directory`. + +The default value of :term:`TCMODE` is "default", which tells the +OpenEmbedded build system to use its internally built toolchain (i.e. +``tcmode-default.inc``). However, other patterns are accepted. In +particular, "external-\*" refers to external toolchains. One example is +the Mentor Graphics Sourcery G++ Toolchain. Support for this toolchain resides +in the separate ``meta-sourcery`` layer at +https://github.com/MentorEmbedded/meta-sourcery/. +See its ``README`` file for details about how to use this layer. + +Another example of external toolchain layer is +:yocto_git:`meta-arm-toolchain ` +supporting GNU toolchains released by ARM. + +You can find further information by reading about the :term:`TCMODE` variable +in the Yocto Project Reference Manual's variable glossary. diff --git a/poky/documentation/dev-manual/gobject-introspection.rst b/poky/documentation/dev-manual/gobject-introspection.rst new file mode 100644 index 0000000000..f7206e6fae --- /dev/null +++ b/poky/documentation/dev-manual/gobject-introspection.rst @@ -0,0 +1,155 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Enabling GObject Introspection Support +************************************** + +`GObject introspection `__ +is the standard mechanism for accessing GObject-based software from +runtime environments. GObject is a feature of the GLib library that +provides an object framework for the GNOME desktop and related software. +GObject Introspection adds information to GObject that allows objects +created within it to be represented across different programming +languages. If you want to construct GStreamer pipelines using Python, or +control UPnP infrastructure using Javascript and GUPnP, GObject +introspection is the only way to do it. + +This section describes the Yocto Project support for generating and +packaging GObject introspection data. GObject introspection data is a +description of the API provided by libraries built on top of the GLib +framework, and, in particular, that framework's GObject mechanism. +GObject Introspection Repository (GIR) files go to ``-dev`` packages, +``typelib`` files go to main packages as they are packaged together with +libraries that are introspected. + +The data is generated when building such a library, by linking the +library with a small executable binary that asks the library to describe +itself, and then executing the binary and processing its output. + +Generating this data in a cross-compilation environment is difficult +because the library is produced for the target architecture, but its +code needs to be executed on the build host. This problem is solved with +the OpenEmbedded build system by running the code through QEMU, which +allows precisely that. Unfortunately, QEMU does not always work +perfectly as mentioned in the ":ref:`dev-manual/gobject-introspection:known issues`" +section. + +Enabling the Generation of Introspection Data +============================================= + +Enabling the generation of introspection data (GIR files) in your +library package involves the following: + +#. Inherit the :ref:`ref-classes-gobject-introspection` class. + +#. Make sure introspection is not disabled anywhere in the recipe or + from anything the recipe includes. Also, make sure that + "gobject-introspection-data" is not in + :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` + and that "qemu-usermode" is not in + :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`. + In either of these conditions, nothing will happen. + +#. Try to build the recipe. If you encounter build errors that look like + something is unable to find ``.so`` libraries, check where these + libraries are located in the source tree and add the following to the + recipe:: + + GIR_EXTRA_LIBS_PATH = "${B}/something/.libs" + + .. note:: + + See recipes in the ``oe-core`` repository that use that + :term:`GIR_EXTRA_LIBS_PATH` variable as an example. + +#. Look for any other errors, which probably mean that introspection + support in a package is not entirely standard, and thus breaks down + in a cross-compilation environment. For such cases, custom-made fixes + are needed. A good place to ask and receive help in these cases is + the :ref:`Yocto Project mailing + lists `. + +.. note:: + + Using a library that no longer builds against the latest Yocto + Project release and prints introspection related errors is a good + candidate for the previous procedure. + +Disabling the Generation of Introspection Data +============================================== + +You might find that you do not want to generate introspection data. Or, +perhaps QEMU does not work on your build host and target architecture +combination. If so, you can use either of the following methods to +disable GIR file generations: + +- Add the following to your distro configuration:: + + DISTRO_FEATURES_BACKFILL_CONSIDERED = "gobject-introspection-data" + + Adding this statement disables generating introspection data using + QEMU but will still enable building introspection tools and libraries + (i.e. building them does not require the use of QEMU). + +- Add the following to your machine configuration:: + + MACHINE_FEATURES_BACKFILL_CONSIDERED = "qemu-usermode" + + Adding this statement disables the use of QEMU when building packages for your + machine. Currently, this feature is used only by introspection + recipes and has the same effect as the previously described option. + + .. note:: + + Future releases of the Yocto Project might have other features + affected by this option. + +If you disable introspection data, you can still obtain it through other +means such as copying the data from a suitable sysroot, or by generating +it on the target hardware. The OpenEmbedded build system does not +currently provide specific support for these techniques. + +Testing that Introspection Works in an Image +============================================ + +Use the following procedure to test if generating introspection data is +working in an image: + +#. Make sure that "gobject-introspection-data" is not in + :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` + and that "qemu-usermode" is not in + :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`. + +#. Build ``core-image-sato``. + +#. Launch a Terminal and then start Python in the terminal. + +#. Enter the following in the terminal:: + + >>> from gi.repository import GLib + >>> GLib.get_host_name() + +#. For something a little more advanced, enter the following see: + https://python-gtk-3-tutorial.readthedocs.io/en/latest/introduction.html + +Known Issues +============ + +Here are know issues in GObject Introspection Support: + +- ``qemu-ppc64`` immediately crashes. Consequently, you cannot build + introspection data on that architecture. + +- x32 is not supported by QEMU. Consequently, introspection data is + disabled. + +- musl causes transient GLib binaries to crash on assertion failures. + Consequently, generating introspection data is disabled. + +- Because QEMU is not able to run the binaries correctly, introspection + is disabled for some specific packages under specific architectures + (e.g. ``gcr``, ``libsecret``, and ``webkit``). + +- QEMU usermode might not work properly when running 64-bit binaries + under 32-bit host machines. In particular, "qemumips64" is known to + not work under i686. + diff --git a/poky/documentation/dev-manual/index.rst b/poky/documentation/dev-manual/index.rst index f16b135c4d..b0bb5576ad 100644 --- a/poky/documentation/dev-manual/index.rst +++ b/poky/documentation/dev-manual/index.rst @@ -12,7 +12,43 @@ Yocto Project Development Tasks Manual intro start - common-tasks + layers + customizing-images + new-recipe + new-machine + upgrading-recipes + temporary-source-code + quilt.rst + development-shell + python-development-shell + building + speeding-up-build + libraries + prebuilt-libraries + x32-psabi + gobject-introspection + external-toolchain + wic + bmaptool + securing-images + custom-distribution + custom-template-configuration-directory + disk-space + packages + efficiently-fetching-sources + init-manager + device-manager + external-scm + read-only-rootfs + build-quality + runtime-testing + debugging + changes + licenses + vulnerabilities + sbom + error-reporting-tool + wayland qemu .. include:: /boilerplate.rst diff --git a/poky/documentation/dev-manual/init-manager.rst b/poky/documentation/dev-manual/init-manager.rst new file mode 100644 index 0000000000..0617fed516 --- /dev/null +++ b/poky/documentation/dev-manual/init-manager.rst @@ -0,0 +1,89 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Selecting an Initialization Manager +*********************************** + +By default, the Yocto Project uses SysVinit as the initialization +manager. However, there is also support for systemd, which is a full +replacement for init with parallel starting of services, reduced shell +overhead and other features that are used by many distributions. + +Within the system, SysVinit treats system components as services. These +services are maintained as shell scripts stored in the ``/etc/init.d/`` +directory. Services organize into different run levels. This +organization is maintained by putting links to the services in the +``/etc/rcN.d/`` directories, where `N/` is one of the following options: +"S", "0", "1", "2", "3", "4", "5", or "6". + +.. note:: + + Each runlevel has a dependency on the previous runlevel. This + dependency allows the services to work properly. + +In comparison, systemd treats components as units. Using units is a +broader concept as compared to using a service. A unit includes several +different types of entities. Service is one of the types of entities. +The runlevel concept in SysVinit corresponds to the concept of a target +in systemd, where target is also a type of supported unit. + +In a SysVinit-based system, services load sequentially (i.e. one by one) +during init and parallelization is not supported. With systemd, services +start in parallel. Needless to say, the method can have an impact on +system startup performance. + +If you want to use SysVinit, you do not have to do anything. But, if you +want to use systemd, you must take some steps as described in the +following sections. + +Using systemd Exclusively +========================= + +Set these variables in your distribution configuration file as follows:: + + DISTRO_FEATURES:append = " systemd" + VIRTUAL-RUNTIME_init_manager = "systemd" + +You can also prevent the SysVinit distribution feature from +being automatically enabled as follows:: + + DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" + +Doing so removes any +redundant SysVinit scripts. + +To remove initscripts from your image altogether, set this variable +also:: + + VIRTUAL-RUNTIME_initscripts = "" + +For information on the backfill variable, see +:term:`DISTRO_FEATURES_BACKFILL_CONSIDERED`. + +Using systemd for the Main Image and Using SysVinit for the Rescue Image +======================================================================== + +Set these variables in your distribution configuration file as follows:: + + DISTRO_FEATURES:append = " systemd" + VIRTUAL-RUNTIME_init_manager = "systemd" + +Doing so causes your main image to use the +``packagegroup-core-boot.bb`` recipe and systemd. The rescue/minimal +image cannot use this package group. However, it can install SysVinit +and the appropriate packages will have support for both systemd and +SysVinit. + +Using systemd-journald without a traditional syslog daemon +========================================================== + +Counter-intuitively, ``systemd-journald`` is not a syslog runtime or provider, +and the proper way to use systemd-journald as your sole logging mechanism is to +effectively disable syslog entirely by setting these variables in your distribution +configuration file:: + + VIRTUAL-RUNTIME_syslog = "" + VIRTUAL-RUNTIME_base-utils-syslog = "" + +Doing so will prevent ``rsyslog`` / ``busybox-syslog`` from being pulled in by +default, leaving only ``journald``. + diff --git a/poky/documentation/dev-manual/layers.rst b/poky/documentation/dev-manual/layers.rst new file mode 100644 index 0000000000..2d809562d1 --- /dev/null +++ b/poky/documentation/dev-manual/layers.rst @@ -0,0 +1,905 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Understanding and Creating Layers +********************************* + +The OpenEmbedded build system supports organizing +:term:`Metadata` into multiple layers. +Layers allow you to isolate different types of customizations from each +other. For introductory information on the Yocto Project Layer Model, +see the +":ref:`overview-manual/yp-intro:the yocto project layer model`" +section in the Yocto Project Overview and Concepts Manual. + +Creating Your Own Layer +======================= + +.. note:: + + It is very easy to create your own layers to use with the OpenEmbedded + build system, as the Yocto Project ships with tools that speed up creating + layers. This section describes the steps you perform by hand to create + layers so that you can better understand them. For information about the + layer-creation tools, see the + ":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`" + section in the Yocto Project Board Support Package (BSP) Developer's + Guide and the ":ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`" + section further down in this manual. + +Follow these general steps to create your layer without using tools: + +#. *Check Existing Layers:* Before creating a new layer, you should be + sure someone has not already created a layer containing the Metadata + you need. You can see the :oe_layerindex:`OpenEmbedded Metadata Index <>` + for a list of layers from the OpenEmbedded community that can be used in + the Yocto Project. You could find a layer that is identical or close + to what you need. + +#. *Create a Directory:* Create the directory for your layer. When you + create the layer, be sure to create the directory in an area not + associated with the Yocto Project :term:`Source Directory` + (e.g. the cloned ``poky`` repository). + + While not strictly required, prepend the name of the directory with + the string "meta-". For example:: + + meta-mylayer + meta-GUI_xyz + meta-mymachine + + With rare exceptions, a layer's name follows this form:: + + meta-root_name + + Following this layer naming convention can save + you trouble later when tools, components, or variables "assume" your + layer name begins with "meta-". A notable example is in configuration + files as shown in the following step where layer names without the + "meta-" string are appended to several variables used in the + configuration. + +#. *Create a Layer Configuration File:* Inside your new layer folder, + you need to create a ``conf/layer.conf`` file. It is easiest to take + an existing layer configuration file and copy that to your layer's + ``conf`` directory and then modify the file as needed. + + The ``meta-yocto-bsp/conf/layer.conf`` file in the Yocto Project + :yocto_git:`Source Repositories ` + demonstrates the required syntax. For your layer, you need to replace + "yoctobsp" with a unique identifier for your layer (e.g. "machinexyz" + for a layer named "meta-machinexyz"):: + + # We have a conf and classes directory, add to BBPATH + BBPATH .= ":${LAYERDIR}" + + # We have recipes-* directories, add to BBFILES + BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + + BBFILE_COLLECTIONS += "yoctobsp" + BBFILE_PATTERN_yoctobsp = "^${LAYERDIR}/" + BBFILE_PRIORITY_yoctobsp = "5" + LAYERVERSION_yoctobsp = "4" + LAYERSERIES_COMPAT_yoctobsp = "dunfell" + + Following is an explanation of the layer configuration file: + + - :term:`BBPATH`: Adds the layer's + root directory to BitBake's search path. Through the use of the + :term:`BBPATH` variable, BitBake locates class files (``.bbclass``), + configuration files, and files that are included with ``include`` + and ``require`` statements. For these cases, BitBake uses the + first file that matches the name found in :term:`BBPATH`. This is + similar to the way the ``PATH`` variable is used for binaries. It + is recommended, therefore, that you use unique class and + configuration filenames in your custom layer. + + - :term:`BBFILES`: Defines the + location for all recipes in the layer. + + - :term:`BBFILE_COLLECTIONS`: + Establishes the current layer through a unique identifier that is + used throughout the OpenEmbedded build system to refer to the + layer. In this example, the identifier "yoctobsp" is the + representation for the container layer named "meta-yocto-bsp". + + - :term:`BBFILE_PATTERN`: + Expands immediately during parsing to provide the directory of the + layer. + + - :term:`BBFILE_PRIORITY`: + Establishes a priority to use for recipes in the layer when the + OpenEmbedded build finds recipes of the same name in different + layers. + + - :term:`LAYERVERSION`: + Establishes a version number for the layer. You can use this + version number to specify this exact version of the layer as a + dependency when using the + :term:`LAYERDEPENDS` + variable. + + - :term:`LAYERDEPENDS`: + Lists all layers on which this layer depends (if any). + + - :term:`LAYERSERIES_COMPAT`: + Lists the :yocto_wiki:`Yocto Project ` + releases for which the current version is compatible. This + variable is a good way to indicate if your particular layer is + current. + +#. *Add Content:* Depending on the type of layer, add the content. If + the layer adds support for a machine, add the machine configuration + in a ``conf/machine/`` file within the layer. If the layer adds + distro policy, add the distro configuration in a ``conf/distro/`` + file within the layer. If the layer introduces new recipes, put the + recipes you need in ``recipes-*`` subdirectories within the layer. + + .. note:: + + For an explanation of layer hierarchy that is compliant with the + Yocto Project, see the ":ref:`bsp-guide/bsp:example filesystem layout`" + section in the Yocto Project Board Support Package (BSP) Developer's Guide. + +#. *Optionally Test for Compatibility:* If you want permission to use + the Yocto Project Compatibility logo with your layer or application + that uses your layer, perform the steps to apply for compatibility. + See the + ":ref:`dev-manual/layers:making sure your layer is compatible with yocto project`" + section for more information. + +Following Best Practices When Creating Layers +============================================= + +To create layers that are easier to maintain and that will not impact +builds for other machines, you should consider the information in the +following list: + +- *Avoid "Overlaying" Entire Recipes from Other Layers in Your + Configuration:* In other words, do not copy an entire recipe into + your layer and then modify it. Rather, use an append file + (``.bbappend``) to override only those parts of the original recipe + you need to modify. + +- *Avoid Duplicating Include Files:* Use append files (``.bbappend``) + for each recipe that uses an include file. Or, if you are introducing + a new recipe that requires the included file, use the path relative + to the original layer directory to refer to the file. For example, + use ``require recipes-core/``\ `package`\ ``/``\ `file`\ ``.inc`` instead + of ``require`` `file`\ ``.inc``. If you're finding you have to overlay + the include file, it could indicate a deficiency in the include file + in the layer to which it originally belongs. If this is the case, you + should try to address that deficiency instead of overlaying the + include file. For example, you could address this by getting the + maintainer of the include file to add a variable or variables to make + it easy to override the parts needing to be overridden. + +- *Structure Your Layers:* Proper use of overrides within append files + and placement of machine-specific files within your layer can ensure + that a build is not using the wrong Metadata and negatively impacting + a build for a different machine. Following are some examples: + + - *Modify Variables to Support a Different Machine:* Suppose you + have a layer named ``meta-one`` that adds support for building + machine "one". To do so, you use an append file named + ``base-files.bbappend`` and create a dependency on "foo" by + altering the :term:`DEPENDS` + variable:: + + DEPENDS = "foo" + + The dependency is created during any + build that includes the layer ``meta-one``. However, you might not + want this dependency for all machines. For example, suppose you + are building for machine "two" but your ``bblayers.conf`` file has + the ``meta-one`` layer included. During the build, the + ``base-files`` for machine "two" will also have the dependency on + ``foo``. + + To make sure your changes apply only when building machine "one", + use a machine override with the :term:`DEPENDS` statement:: + + DEPENDS:one = "foo" + + You should follow the same strategy when using ``:append`` + and ``:prepend`` operations:: + + DEPENDS:append:one = " foo" + DEPENDS:prepend:one = "foo " + + As an actual example, here's a + snippet from the generic kernel include file ``linux-yocto.inc``, + wherein the kernel compile and link options are adjusted in the + case of a subset of the supported architectures:: + + DEPENDS:append:aarch64 = " libgcc" + KERNEL_CC:append:aarch64 = " ${TOOLCHAIN_OPTIONS}" + KERNEL_LD:append:aarch64 = " ${TOOLCHAIN_OPTIONS}" + + DEPENDS:append:nios2 = " libgcc" + KERNEL_CC:append:nios2 = " ${TOOLCHAIN_OPTIONS}" + KERNEL_LD:append:nios2 = " ${TOOLCHAIN_OPTIONS}" + + DEPENDS:append:arc = " libgcc" + KERNEL_CC:append:arc = " ${TOOLCHAIN_OPTIONS}" + KERNEL_LD:append:arc = " ${TOOLCHAIN_OPTIONS}" + + KERNEL_FEATURES:append:qemuall=" features/debug/printk.scc" + + - *Place Machine-Specific Files in Machine-Specific Locations:* When + you have a base recipe, such as ``base-files.bb``, that contains a + :term:`SRC_URI` statement to a + file, you can use an append file to cause the build to use your + own version of the file. For example, an append file in your layer + at ``meta-one/recipes-core/base-files/base-files.bbappend`` could + extend :term:`FILESPATH` using :term:`FILESEXTRAPATHS` as follows:: + + FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + + The build for machine "one" will pick up your machine-specific file as + long as you have the file in + ``meta-one/recipes-core/base-files/base-files/``. However, if you + are building for a different machine and the ``bblayers.conf`` + file includes the ``meta-one`` layer and the location of your + machine-specific file is the first location where that file is + found according to :term:`FILESPATH`, builds for all machines will + also use that machine-specific file. + + You can make sure that a machine-specific file is used for a + particular machine by putting the file in a subdirectory specific + to the machine. For example, rather than placing the file in + ``meta-one/recipes-core/base-files/base-files/`` as shown above, + put it in ``meta-one/recipes-core/base-files/base-files/one/``. + Not only does this make sure the file is used only when building + for machine "one", but the build process locates the file more + quickly. + + In summary, you need to place all files referenced from + :term:`SRC_URI` in a machine-specific subdirectory within the layer in + order to restrict those files to machine-specific builds. + +- *Perform Steps to Apply for Yocto Project Compatibility:* If you want + permission to use the Yocto Project Compatibility logo with your + layer or application that uses your layer, perform the steps to apply + for compatibility. See the + ":ref:`dev-manual/layers:making sure your layer is compatible with yocto project`" + section for more information. + +- *Follow the Layer Naming Convention:* Store custom layers in a Git + repository that use the ``meta-layer_name`` format. + +- *Group Your Layers Locally:* Clone your repository alongside other + cloned ``meta`` directories from the :term:`Source Directory`. + +Making Sure Your Layer is Compatible With Yocto Project +======================================================= + +When you create a layer used with the Yocto Project, it is advantageous +to make sure that the layer interacts well with existing Yocto Project +layers (i.e. the layer is compatible with the Yocto Project). Ensuring +compatibility makes the layer easy to be consumed by others in the Yocto +Project community and could allow you permission to use the Yocto +Project Compatible Logo. + +.. note:: + + Only Yocto Project member organizations are permitted to use the + Yocto Project Compatible Logo. The logo is not available for general + use. For information on how to become a Yocto Project member + organization, see the :yocto_home:`Yocto Project Website <>`. + +The Yocto Project Compatibility Program consists of a layer application +process that requests permission to use the Yocto Project Compatibility +Logo for your layer and application. The process consists of two parts: + +#. Successfully passing a script (``yocto-check-layer``) that when run + against your layer, tests it against constraints based on experiences + of how layers have worked in the real world and where pitfalls have + been found. Getting a "PASS" result from the script is required for + successful compatibility registration. + +#. Completion of an application acceptance form, which you can find at + :yocto_home:`/webform/yocto-project-compatible-registration`. + +To be granted permission to use the logo, you need to satisfy the +following: + +- Be able to check the box indicating that you got a "PASS" when + running the script against your layer. + +- Answer "Yes" to the questions on the form or have an acceptable + explanation for any questions answered "No". + +- Be a Yocto Project Member Organization. + +The remainder of this section presents information on the registration +form and on the ``yocto-check-layer`` script. + +Yocto Project Compatible Program Application +-------------------------------------------- + +Use the form to apply for your layer's approval. Upon successful +application, you can use the Yocto Project Compatibility Logo with your +layer and the application that uses your layer. + +To access the form, use this link: +:yocto_home:`/webform/yocto-project-compatible-registration`. +Follow the instructions on the form to complete your application. + +The application consists of the following sections: + +- *Contact Information:* Provide your contact information as the fields + require. Along with your information, provide the released versions + of the Yocto Project for which your layer is compatible. + +- *Acceptance Criteria:* Provide "Yes" or "No" answers for each of the + items in the checklist. There is space at the bottom of the form for + any explanations for items for which you answered "No". + +- *Recommendations:* Provide answers for the questions regarding Linux + kernel use and build success. + +``yocto-check-layer`` Script +---------------------------- + +The ``yocto-check-layer`` script provides you a way to assess how +compatible your layer is with the Yocto Project. You should run this +script prior to using the form to apply for compatibility as described +in the previous section. You need to achieve a "PASS" result in order to +have your application form successfully processed. + +The script divides tests into three areas: COMMON, BSP, and DISTRO. For +example, given a distribution layer (DISTRO), the layer must pass both +the COMMON and DISTRO related tests. Furthermore, if your layer is a BSP +layer, the layer must pass the COMMON and BSP set of tests. + +To execute the script, enter the following commands from your build +directory:: + + $ source oe-init-build-env + $ yocto-check-layer your_layer_directory + +Be sure to provide the actual directory for your +layer as part of the command. + +Entering the command causes the script to determine the type of layer +and then to execute a set of specific tests against the layer. The +following list overviews the test: + +- ``common.test_readme``: Tests if a ``README`` file exists in the + layer and the file is not empty. + +- ``common.test_parse``: Tests to make sure that BitBake can parse the + files without error (i.e. ``bitbake -p``). + +- ``common.test_show_environment``: Tests that the global or per-recipe + environment is in order without errors (i.e. ``bitbake -e``). + +- ``common.test_world``: Verifies that ``bitbake world`` works. + +- ``common.test_signatures``: Tests to be sure that BSP and DISTRO + layers do not come with recipes that change signatures. + +- ``common.test_layerseries_compat``: Verifies layer compatibility is + set properly. + +- ``bsp.test_bsp_defines_machines``: Tests if a BSP layer has machine + configurations. + +- ``bsp.test_bsp_no_set_machine``: Tests to ensure a BSP layer does not + set the machine when the layer is added. + +- ``bsp.test_machine_world``: Verifies that ``bitbake world`` works + regardless of which machine is selected. + +- ``bsp.test_machine_signatures``: Verifies that building for a + particular machine affects only the signature of tasks specific to + that machine. + +- ``distro.test_distro_defines_distros``: Tests if a DISTRO layer has + distro configurations. + +- ``distro.test_distro_no_set_distros``: Tests to ensure a DISTRO layer + does not set the distribution when the layer is added. + +Enabling Your Layer +=================== + +Before the OpenEmbedded build system can use your new layer, you need to +enable it. To enable your layer, simply add your layer's path to the +:term:`BBLAYERS` variable in your ``conf/bblayers.conf`` file, which is +found in the :term:`Build Directory`. The following example shows how to +enable your new ``meta-mylayer`` layer (note how your new layer exists +outside of the official ``poky`` repository which you would have checked +out earlier):: + + # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf + # changes incompatibly + POKY_BBLAYERS_CONF_VERSION = "2" + BBPATH = "${TOPDIR}" + BBFILES ?= "" + BBLAYERS ?= " \ + /home/user/poky/meta \ + /home/user/poky/meta-poky \ + /home/user/poky/meta-yocto-bsp \ + /home/user/mystuff/meta-mylayer \ + " + +BitBake parses each ``conf/layer.conf`` file from the top down as +specified in the :term:`BBLAYERS` variable within the ``conf/bblayers.conf`` +file. During the processing of each ``conf/layer.conf`` file, BitBake +adds the recipes, classes and configurations contained within the +particular layer to the source directory. + +Appending Other Layers Metadata With Your Layer +=============================================== + +A recipe that appends Metadata to another recipe is called a BitBake +append file. A BitBake append file uses the ``.bbappend`` file type +suffix, while the corresponding recipe to which Metadata is being +appended uses the ``.bb`` file type suffix. + +You can use a ``.bbappend`` file in your layer to make additions or +changes to the content of another layer's recipe without having to copy +the other layer's recipe into your layer. Your ``.bbappend`` file +resides in your layer, while the main ``.bb`` recipe file to which you +are appending Metadata resides in a different layer. + +Being able to append information to an existing recipe not only avoids +duplication, but also automatically applies recipe changes from a +different layer into your layer. If you were copying recipes, you would +have to manually merge changes as they occur. + +When you create an append file, you must use the same root name as the +corresponding recipe file. For example, the append file +``someapp_3.1.bbappend`` must apply to ``someapp_3.1.bb``. This +means the original recipe and append filenames are version +number-specific. If the corresponding recipe is renamed to update to a +newer version, you must also rename and possibly update the +corresponding ``.bbappend`` as well. During the build process, BitBake +displays an error on starting if it detects a ``.bbappend`` file that +does not have a corresponding recipe with a matching name. See the +:term:`BB_DANGLINGAPPENDS_WARNONLY` +variable for information on how to handle this error. + +Overlaying a File Using Your Layer +---------------------------------- + +As an example, consider the main formfactor recipe and a corresponding +formfactor append file both from the :term:`Source Directory`. +Here is the main +formfactor recipe, which is named ``formfactor_0.0.bb`` and located in +the "meta" layer at ``meta/recipes-bsp/formfactor``:: + + SUMMARY = "Device formfactor information" + DESCRIPTION = "A formfactor configuration file provides information about the \ + target hardware for which the image is being built and information that the \ + build system cannot obtain from other sources such as the kernel." + SECTION = "base" + LICENSE = "MIT" + LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + PR = "r45" + + SRC_URI = "file://config file://machconfig" + S = "${WORKDIR}" + + PACKAGE_ARCH = "${MACHINE_ARCH}" + INHIBIT_DEFAULT_DEPS = "1" + + do_install() { + # Install file only if it has contents + install -d ${D}${sysconfdir}/formfactor/ + install -m 0644 ${S}/config ${D}${sysconfdir}/formfactor/ + if [ -s "${S}/machconfig" ]; then + install -m 0644 ${S}/machconfig ${D}${sysconfdir}/formfactor/ + fi + } + +In the main recipe, note the :term:`SRC_URI` +variable, which tells the OpenEmbedded build system where to find files +during the build. + +Following is the append file, which is named ``formfactor_0.0.bbappend`` +and is from the Raspberry Pi BSP Layer named ``meta-raspberrypi``. The +file is in the layer at ``recipes-bsp/formfactor``:: + + FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +By default, the build system uses the +:term:`FILESPATH` variable to +locate files. This append file extends the locations by setting the +:term:`FILESEXTRAPATHS` +variable. Setting this variable in the ``.bbappend`` file is the most +reliable and recommended method for adding directories to the search +path used by the build system to find files. + +The statement in this example extends the directories to include +``${``\ :term:`THISDIR`\ ``}/${``\ :term:`PN`\ ``}``, +which resolves to a directory named ``formfactor`` in the same directory +in which the append file resides (i.e. +``meta-raspberrypi/recipes-bsp/formfactor``. This implies that you must +have the supporting directory structure set up that will contain any +files or patches you will be including from the layer. + +Using the immediate expansion assignment operator ``:=`` is important +because of the reference to :term:`THISDIR`. The trailing colon character is +important as it ensures that items in the list remain colon-separated. + +.. note:: + + BitBake automatically defines the :term:`THISDIR` variable. You should + never set this variable yourself. Using ":prepend" as part of the + :term:`FILESEXTRAPATHS` ensures your path will be searched prior to other + paths in the final list. + + Also, not all append files add extra files. Many append files simply + allow to add build options (e.g. ``systemd``). For these cases, your + append file would not even use the :term:`FILESEXTRAPATHS` statement. + +The end result of this ``.bbappend`` file is that on a Raspberry Pi, where +``rpi`` will exist in the list of :term:`OVERRIDES`, the file +``meta-raspberrypi/recipes-bsp/formfactor/formfactor/rpi/machconfig`` will be +used during :ref:`ref-tasks-fetch` and the test for a non-zero file size in +:ref:`ref-tasks-install` will return true, and the file will be installed. + +Installing Additional Files Using Your Layer +-------------------------------------------- + +As another example, consider the main ``xserver-xf86-config`` recipe and a +corresponding ``xserver-xf86-config`` append file both from the :term:`Source +Directory`. Here is the main ``xserver-xf86-config`` recipe, which is named +``xserver-xf86-config_0.1.bb`` and located in the "meta" layer at +``meta/recipes-graphics/xorg-xserver``:: + + SUMMARY = "X.Org X server configuration file" + HOMEPAGE = "http://www.x.org" + SECTION = "x11/base" + LICENSE = "MIT" + LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + PR = "r33" + + SRC_URI = "file://xorg.conf" + + S = "${WORKDIR}" + + CONFFILES:${PN} = "${sysconfdir}/X11/xorg.conf" + + PACKAGE_ARCH = "${MACHINE_ARCH}" + ALLOW_EMPTY:${PN} = "1" + + do_install () { + if test -s ${WORKDIR}/xorg.conf; then + install -d ${D}/${sysconfdir}/X11 + install -m 0644 ${WORKDIR}/xorg.conf ${D}/${sysconfdir}/X11/ + fi + } + +Following is the append file, which is named ``xserver-xf86-config_%.bbappend`` +and is from the Raspberry Pi BSP Layer named ``meta-raspberrypi``. The +file is in the layer at ``recipes-graphics/xorg-xserver``:: + + FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + + SRC_URI:append:rpi = " \ + file://xorg.conf.d/98-pitft.conf \ + file://xorg.conf.d/99-calibration.conf \ + " + do_install:append:rpi () { + PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}" + if [ "${PITFT}" = "1" ]; then + install -d ${D}/${sysconfdir}/X11/xorg.conf.d/ + install -m 0644 ${WORKDIR}/xorg.conf.d/98-pitft.conf ${D}/${sysconfdir}/X11/xorg.conf.d/ + install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/ + fi + } + + FILES:${PN}:append:rpi = " ${sysconfdir}/X11/xorg.conf.d/*" + +Building off of the previous example, we once again are setting the +:term:`FILESEXTRAPATHS` variable. In this case we are also using +:term:`SRC_URI` to list additional source files to use when ``rpi`` is found in +the list of :term:`OVERRIDES`. The :ref:`ref-tasks-install` task will then perform a +check for an additional :term:`MACHINE_FEATURES` that if set will cause these +additional files to be installed. These additional files are listed in +:term:`FILES` so that they will be packaged. + +Prioritizing Your Layer +======================= + +Each layer is assigned a priority value. Priority values control which +layer takes precedence if there are recipe files with the same name in +multiple layers. For these cases, the recipe file from the layer with a +higher priority number takes precedence. Priority values also affect the +order in which multiple ``.bbappend`` files for the same recipe are +applied. You can either specify the priority manually, or allow the +build system to calculate it based on the layer's dependencies. + +To specify the layer's priority manually, use the +:term:`BBFILE_PRIORITY` +variable and append the layer's root name:: + + BBFILE_PRIORITY_mylayer = "1" + +.. note:: + + It is possible for a recipe with a lower version number + :term:`PV` in a layer that has a higher + priority to take precedence. + + Also, the layer priority does not currently affect the precedence + order of ``.conf`` or ``.bbclass`` files. Future versions of BitBake + might address this. + +Managing Layers +=============== + +You can use the BitBake layer management tool ``bitbake-layers`` to +provide a view into the structure of recipes across a multi-layer +project. Being able to generate output that reports on configured layers +with their paths and priorities and on ``.bbappend`` files and their +applicable recipes can help to reveal potential problems. + +For help on the BitBake layer management tool, use the following +command:: + + $ bitbake-layers --help + +The following list describes the available commands: + +- ``help:`` Displays general help or help on a specified command. + +- ``show-layers:`` Shows the current configured layers. + +- ``show-overlayed:`` Lists overlayed recipes. A recipe is overlayed + when a recipe with the same name exists in another layer that has a + higher layer priority. + +- ``show-recipes:`` Lists available recipes and the layers that + provide them. + +- ``show-appends:`` Lists ``.bbappend`` files and the recipe files to + which they apply. + +- ``show-cross-depends:`` Lists dependency relationships between + recipes that cross layer boundaries. + +- ``add-layer:`` Adds a layer to ``bblayers.conf``. + +- ``remove-layer:`` Removes a layer from ``bblayers.conf`` + +- ``flatten:`` Flattens the layer configuration into a separate + output directory. Flattening your layer configuration builds a + "flattened" directory that contains the contents of all layers, with + any overlayed recipes removed and any ``.bbappend`` files appended to + the corresponding recipes. You might have to perform some manual + cleanup of the flattened layer as follows: + + - Non-recipe files (such as patches) are overwritten. The flatten + command shows a warning for these files. + + - Anything beyond the normal layer setup has been added to the + ``layer.conf`` file. Only the lowest priority layer's + ``layer.conf`` is used. + + - Overridden and appended items from ``.bbappend`` files need to be + cleaned up. The contents of each ``.bbappend`` end up in the + flattened recipe. However, if there are appended or changed + variable values, you need to tidy these up yourself. Consider the + following example. Here, the ``bitbake-layers`` command adds the + line ``#### bbappended ...`` so that you know where the following + lines originate:: + + ... + DESCRIPTION = "A useful utility" + ... + EXTRA_OECONF = "--enable-something" + ... + + #### bbappended from meta-anotherlayer #### + + DESCRIPTION = "Customized utility" + EXTRA_OECONF += "--enable-somethingelse" + + + Ideally, you would tidy up these utilities as follows:: + + ... + DESCRIPTION = "Customized utility" + ... + EXTRA_OECONF = "--enable-something --enable-somethingelse" + ... + +- ``layerindex-fetch``: Fetches a layer from a layer index, along + with its dependent layers, and adds the layers to the + ``conf/bblayers.conf`` file. + +- ``layerindex-show-depends``: Finds layer dependencies from the + layer index. + +- ``save-build-conf``: Saves the currently active build configuration + (``conf/local.conf``, ``conf/bblayers.conf``) as a template into a layer. + This template can later be used for setting up builds via :term:``TEMPLATECONF``. + For information about saving and using configuration templates, see + ":ref:`dev-manual/custom-template-configuration-directory:creating a custom template configuration directory`". + +- ``create-layer``: Creates a basic layer. + +- ``create-layers-setup``: Writes out a configuration file and/or a script that + can replicate the directory structure and revisions of the layers in a current build. + For more information, see ":ref:`dev-manual/layers:saving and restoring the layers setup`". + +Creating a General Layer Using the ``bitbake-layers`` Script +============================================================ + +The ``bitbake-layers`` script with the ``create-layer`` subcommand +simplifies creating a new general layer. + +.. note:: + + - For information on BSP layers, see the ":ref:`bsp-guide/bsp:bsp layers`" + section in the Yocto + Project Board Specific (BSP) Developer's Guide. + + - In order to use a layer with the OpenEmbedded build system, you + need to add the layer to your ``bblayers.conf`` configuration + file. See the ":ref:`dev-manual/layers:adding a layer using the \`\`bitbake-layers\`\` script`" + section for more information. + +The default mode of the script's operation with this subcommand is to +create a layer with the following: + +- A layer priority of 6. + +- A ``conf`` subdirectory that contains a ``layer.conf`` file. + +- A ``recipes-example`` subdirectory that contains a further + subdirectory named ``example``, which contains an ``example.bb`` + recipe file. + +- A ``COPYING.MIT``, which is the license statement for the layer. The + script assumes you want to use the MIT license, which is typical for + most layers, for the contents of the layer itself. + +- A ``README`` file, which is a file describing the contents of your + new layer. + +In its simplest form, you can use the following command form to create a +layer. The command creates a layer whose name corresponds to +"your_layer_name" in the current directory:: + + $ bitbake-layers create-layer your_layer_name + +As an example, the following command creates a layer named ``meta-scottrif`` +in your home directory:: + + $ cd /usr/home + $ bitbake-layers create-layer meta-scottrif + NOTE: Starting bitbake server... + Add your new layer with 'bitbake-layers add-layer meta-scottrif' + +If you want to set the priority of the layer to other than the default +value of "6", you can either use the ``--priority`` option or you +can edit the +:term:`BBFILE_PRIORITY` value +in the ``conf/layer.conf`` after the script creates it. Furthermore, if +you want to give the example recipe file some name other than the +default, you can use the ``--example-recipe-name`` option. + +The easiest way to see how the ``bitbake-layers create-layer`` command +works is to experiment with the script. You can also read the usage +information by entering the following:: + + $ bitbake-layers create-layer --help + NOTE: Starting bitbake server... + usage: bitbake-layers create-layer [-h] [--priority PRIORITY] + [--example-recipe-name EXAMPLERECIPE] + layerdir + + Create a basic layer + + positional arguments: + layerdir Layer directory to create + + optional arguments: + -h, --help show this help message and exit + --priority PRIORITY, -p PRIORITY + Layer directory to create + --example-recipe-name EXAMPLERECIPE, -e EXAMPLERECIPE + Filename of the example recipe + +Adding a Layer Using the ``bitbake-layers`` Script +================================================== + +Once you create your general layer, you must add it to your +``bblayers.conf`` file. Adding the layer to this configuration file +makes the OpenEmbedded build system aware of your layer so that it can +search it for metadata. + +Add your layer by using the ``bitbake-layers add-layer`` command:: + + $ bitbake-layers add-layer your_layer_name + +Here is an example that adds a +layer named ``meta-scottrif`` to the configuration file. Following the +command that adds the layer is another ``bitbake-layers`` command that +shows the layers that are in your ``bblayers.conf`` file:: + + $ bitbake-layers add-layer meta-scottrif + NOTE: Starting bitbake server... + Parsing recipes: 100% |##########################################################| Time: 0:00:49 + Parsing of 1441 .bb files complete (0 cached, 1441 parsed). 2055 targets, 56 skipped, 0 masked, 0 errors. + $ bitbake-layers show-layers + NOTE: Starting bitbake server... + layer path priority + ========================================================================== + meta /home/scottrif/poky/meta 5 + meta-poky /home/scottrif/poky/meta-poky 5 + meta-yocto-bsp /home/scottrif/poky/meta-yocto-bsp 5 + workspace /home/scottrif/poky/build/workspace 99 + meta-scottrif /home/scottrif/poky/build/meta-scottrif 6 + + +Adding the layer to this file +enables the build system to locate the layer during the build. + +.. note:: + + During a build, the OpenEmbedded build system looks in the layers + from the top of the list down to the bottom in that order. + +Saving and restoring the layers setup +===================================== + +Once you have a working build with the correct set of layers, it is beneficial +to capture the layer setup --- what they are, which repositories they come from +and which SCM revisions they're at --- into a configuration file, so that this +setup can be easily replicated later, perhaps on a different machine. Here's +how to do this:: + + $ bitbake-layers create-layers-setup /srv/work/alex/meta-alex/ + NOTE: Starting bitbake server... + NOTE: Created /srv/work/alex/meta-alex/setup-layers.json + NOTE: Created /srv/work/alex/meta-alex/setup-layers + +The tool needs a single argument which tells where to place the output, consisting +of a json formatted layer configuration, and a ``setup-layers`` script that can use that configuration +to restore the layers in a different location, or on a different host machine. The argument +can point to a custom layer (which is then deemed a "bootstrap" layer that needs to be +checked out first), or into a completely independent location. + +The replication of the layers is performed by running the ``setup-layers`` script provided +above: + +#. Clone the bootstrap layer or some other repository to obtain + the json config and the setup script that can use it. + +#. Run the script directly with no options:: + + alex@Zen2:/srv/work/alex/my-build$ meta-alex/setup-layers + Note: not checking out source meta-alex, use --force-bootstraplayer-checkout to override. + + Setting up source meta-intel, revision 15.0-hardknott-3.3-310-g0a96edae, branch master + Running 'git init -q /srv/work/alex/my-build/meta-intel' + Running 'git remote remove origin > /dev/null 2>&1; git remote add origin git://git.yoctoproject.org/meta-intel' in /srv/work/alex/my-build/meta-intel + Running 'git fetch -q origin || true' in /srv/work/alex/my-build/meta-intel + Running 'git checkout -q 0a96edae609a3f48befac36af82cf1eed6786b4a' in /srv/work/alex/my-build/meta-intel + + Setting up source poky, revision 4.1_M1-372-g55483d28f2, branch akanavin/setup-layers + Running 'git init -q /srv/work/alex/my-build/poky' + Running 'git remote remove origin > /dev/null 2>&1; git remote add origin git://git.yoctoproject.org/poky' in /srv/work/alex/my-build/poky + Running 'git fetch -q origin || true' in /srv/work/alex/my-build/poky + Running 'git remote remove poky-contrib > /dev/null 2>&1; git remote add poky-contrib ssh://git@push.yoctoproject.org/poky-contrib' in /srv/work/alex/my-build/poky + Running 'git fetch -q poky-contrib || true' in /srv/work/alex/my-build/poky + Running 'git checkout -q 11db0390b02acac1324e0f827beb0e2e3d0d1d63' in /srv/work/alex/my-build/poky + +.. note:: + This will work to update an existing checkout as well. + +.. note:: + The script is self-sufficient and requires only python3 + and git on the build machine. + +.. note:: + Both the ``create-layers-setup`` and the ``setup-layers`` provided several additional options + that customize their behavior - you are welcome to study them via ``--help`` command line parameter. + diff --git a/poky/documentation/dev-manual/libraries.rst b/poky/documentation/dev-manual/libraries.rst new file mode 100644 index 0000000000..ae4ca27209 --- /dev/null +++ b/poky/documentation/dev-manual/libraries.rst @@ -0,0 +1,267 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Working With Libraries +********************** + +Libraries are an integral part of your system. This section describes +some common practices you might find helpful when working with libraries +to build your system: + +- :ref:`How to include static library files + ` + +- :ref:`How to use the Multilib feature to combine multiple versions of + library files into a single image + ` + +- :ref:`How to install multiple versions of the same library in parallel on + the same system + ` + +Including Static Library Files +============================== + +If you are building a library and the library offers static linking, you +can control which static library files (``*.a`` files) get included in +the built library. + +The :term:`PACKAGES` and +:term:`FILES:* ` variables in the +``meta/conf/bitbake.conf`` configuration file define how files installed +by the :ref:`ref-tasks-install` task are packaged. By default, the :term:`PACKAGES` +variable includes ``${PN}-staticdev``, which represents all static +library files. + +.. note:: + + Some previously released versions of the Yocto Project defined the + static library files through ``${PN}-dev``. + +Following is part of the BitBake configuration file, where you can see +how the static library files are defined:: + + PACKAGE_BEFORE_PN ?= "" + PACKAGES = "${PN}-src ${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN}-doc ${PN}-locale ${PACKAGE_BEFORE_PN} ${PN}" + PACKAGES_DYNAMIC = "^${PN}-locale-.*" + FILES = "" + + FILES:${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*${SOLIBS} \ + ${sysconfdir} ${sharedstatedir} ${localstatedir} \ + ${base_bindir}/* ${base_sbindir}/* \ + ${base_libdir}/*${SOLIBS} \ + ${base_prefix}/lib/udev ${prefix}/lib/udev \ + ${base_libdir}/udev ${libdir}/udev \ + ${datadir}/${BPN} ${libdir}/${BPN}/* \ + ${datadir}/pixmaps ${datadir}/applications \ + ${datadir}/idl ${datadir}/omf ${datadir}/sounds \ + ${libdir}/bonobo/servers" + + FILES:${PN}-bin = "${bindir}/* ${sbindir}/*" + + FILES:${PN}-doc = "${docdir} ${mandir} ${infodir} ${datadir}/gtk-doc \ + ${datadir}/gnome/help" + SECTION:${PN}-doc = "doc" + + FILES_SOLIBSDEV ?= "${base_libdir}/lib*${SOLIBSDEV} ${libdir}/lib*${SOLIBSDEV}" + FILES:${PN}-dev = "${includedir} ${FILES_SOLIBSDEV} ${libdir}/*.la \ + ${libdir}/*.o ${libdir}/pkgconfig ${datadir}/pkgconfig \ + ${datadir}/aclocal ${base_libdir}/*.o \ + ${libdir}/${BPN}/*.la ${base_libdir}/*.la \ + ${libdir}/cmake ${datadir}/cmake" + SECTION:${PN}-dev = "devel" + ALLOW_EMPTY:${PN}-dev = "1" + RDEPENDS:${PN}-dev = "${PN} (= ${EXTENDPKGV})" + + FILES:${PN}-staticdev = "${libdir}/*.a ${base_libdir}/*.a ${libdir}/${BPN}/*.a" + SECTION:${PN}-staticdev = "devel" + RDEPENDS:${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})" + +Combining Multiple Versions of Library Files into One Image +=========================================================== + +The build system offers the ability to build libraries with different +target optimizations or architecture formats and combine these together +into one system image. You can link different binaries in the image +against the different libraries as needed for specific use cases. This +feature is called "Multilib". + +An example would be where you have most of a system compiled in 32-bit +mode using 32-bit libraries, but you have something large, like a +database engine, that needs to be a 64-bit application and uses 64-bit +libraries. Multilib allows you to get the best of both 32-bit and 64-bit +libraries. + +While the Multilib feature is most commonly used for 32 and 64-bit +differences, the approach the build system uses facilitates different +target optimizations. You could compile some binaries to use one set of +libraries and other binaries to use a different set of libraries. The +libraries could differ in architecture, compiler options, or other +optimizations. + +There are several examples in the ``meta-skeleton`` layer found in the +:term:`Source Directory`: + +- :oe_git:`conf/multilib-example.conf ` + configuration file. + +- :oe_git:`conf/multilib-example2.conf ` + configuration file. + +- :oe_git:`recipes-multilib/images/core-image-multilib-example.bb ` + recipe + +Preparing to Use Multilib +------------------------- + +User-specific requirements drive the Multilib feature. Consequently, +there is no one "out-of-the-box" configuration that would +meet your needs. + +In order to enable Multilib, you first need to ensure your recipe is +extended to support multiple libraries. Many standard recipes are +already extended and support multiple libraries. You can check in the +``meta/conf/multilib.conf`` configuration file in the +:term:`Source Directory` to see how this is +done using the +:term:`BBCLASSEXTEND` variable. +Eventually, all recipes will be covered and this list will not be +needed. + +For the most part, the :ref:`Multilib ` +class extension works automatically to +extend the package name from ``${PN}`` to ``${MLPREFIX}${PN}``, where +:term:`MLPREFIX` is the particular multilib (e.g. "lib32-" or "lib64-"). +Standard variables such as +:term:`DEPENDS`, +:term:`RDEPENDS`, +:term:`RPROVIDES`, +:term:`RRECOMMENDS`, +:term:`PACKAGES`, and +:term:`PACKAGES_DYNAMIC` are +automatically extended by the system. If you are extending any manual +code in the recipe, you can use the ``${MLPREFIX}`` variable to ensure +those names are extended correctly. + +Using Multilib +-------------- + +After you have set up the recipes, you need to define the actual +combination of multiple libraries you want to build. You accomplish this +through your ``local.conf`` configuration file in the +:term:`Build Directory`. An example configuration would be as follows:: + + MACHINE = "qemux86-64" + require conf/multilib.conf + MULTILIBS = "multilib:lib32" + DEFAULTTUNE:virtclass-multilib-lib32 = "x86" + IMAGE_INSTALL:append = " lib32-glib-2.0" + +This example enables an additional library named +``lib32`` alongside the normal target packages. When combining these +"lib32" alternatives, the example uses "x86" for tuning. For information +on this particular tuning, see +``meta/conf/machine/include/ia32/arch-ia32.inc``. + +The example then includes ``lib32-glib-2.0`` in all the images, which +illustrates one method of including a multiple library dependency. You +can use a normal image build to include this dependency, for example:: + + $ bitbake core-image-sato + +You can also build Multilib packages +specifically with a command like this:: + + $ bitbake lib32-glib-2.0 + +Additional Implementation Details +--------------------------------- + +There are generic implementation details as well as details that are specific to +package management systems. Following are implementation details +that exist regardless of the package management system: + +- The typical convention used for the class extension code as used by + Multilib assumes that all package names specified in + :term:`PACKAGES` that contain + ``${PN}`` have ``${PN}`` at the start of the name. When that + convention is not followed and ``${PN}`` appears at the middle or the + end of a name, problems occur. + +- The :term:`TARGET_VENDOR` + value under Multilib will be extended to "-vendormlmultilib" (e.g. + "-pokymllib32" for a "lib32" Multilib with Poky). The reason for this + slightly unwieldy contraction is that any "-" characters in the + vendor string presently break Autoconf's ``config.sub``, and other + separators are problematic for different reasons. + +Here are the implementation details for the RPM Package Management System: + +- A unique architecture is defined for the Multilib packages, along + with creating a unique deploy folder under ``tmp/deploy/rpm`` in the + :term:`Build Directory`. For example, consider ``lib32`` in a + ``qemux86-64`` image. The possible architectures in the system are "all", + "qemux86_64", "lib32:qemux86_64", and "lib32:x86". + +- The ``${MLPREFIX}`` variable is stripped from ``${PN}`` during RPM + packaging. The naming for a normal RPM package and a Multilib RPM + package in a ``qemux86-64`` system resolves to something similar to + ``bash-4.1-r2.x86_64.rpm`` and ``bash-4.1.r2.lib32_x86.rpm``, + respectively. + +- When installing a Multilib image, the RPM backend first installs the + base image and then installs the Multilib libraries. + +- The build system relies on RPM to resolve the identical files in the + two (or more) Multilib packages. + +Here are the implementation details for the IPK Package Management System: + +- The ``${MLPREFIX}`` is not stripped from ``${PN}`` during IPK + packaging. The naming for a normal RPM package and a Multilib IPK + package in a ``qemux86-64`` system resolves to something like + ``bash_4.1-r2.x86_64.ipk`` and ``lib32-bash_4.1-rw:x86.ipk``, + respectively. + +- The IPK deploy folder is not modified with ``${MLPREFIX}`` because + packages with and without the Multilib feature can exist in the same + folder due to the ``${PN}`` differences. + +- IPK defines a sanity check for Multilib installation using certain + rules for file comparison, overridden, etc. + +Installing Multiple Versions of the Same Library +================================================ + +There are be situations where you need to install and use multiple versions +of the same library on the same system at the same time. This +almost always happens when a library API changes and you have +multiple pieces of software that depend on the separate versions of the +library. To accommodate these situations, you can install multiple +versions of the same library in parallel on the same system. + +The process is straightforward as long as the libraries use proper +versioning. With properly versioned libraries, all you need to do to +individually specify the libraries is create separate, appropriately +named recipes where the :term:`PN` part of +the name includes a portion that differentiates each library version +(e.g. the major part of the version number). Thus, instead of having a +single recipe that loads one version of a library (e.g. ``clutter``), +you provide multiple recipes that result in different versions of the +libraries you want. As an example, the following two recipes would allow +the two separate versions of the ``clutter`` library to co-exist on the +same system: + +.. code-block:: none + + clutter-1.6_1.6.20.bb + clutter-1.8_1.8.4.bb + +Additionally, if +you have other recipes that depend on a given library, you need to use +the :term:`DEPENDS` variable to +create the dependency. Continuing with the same example, if you want to +have a recipe depend on the 1.8 version of the ``clutter`` library, use +the following in your recipe:: + + DEPENDS = "clutter-1.8" + diff --git a/poky/documentation/dev-manual/licenses.rst b/poky/documentation/dev-manual/licenses.rst new file mode 100644 index 0000000000..65914e5efe --- /dev/null +++ b/poky/documentation/dev-manual/licenses.rst @@ -0,0 +1,518 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Working With Licenses +********************* + +As mentioned in the ":ref:`overview-manual/development-environment:licensing`" +section in the Yocto Project Overview and Concepts Manual, open source +projects are open to the public and they consequently have different +licensing structures in place. This section describes the mechanism by +which the :term:`OpenEmbedded Build System` +tracks changes to +licensing text and covers how to maintain open source license compliance +during your project's lifecycle. The section also describes how to +enable commercially licensed recipes, which by default are disabled. + +Tracking License Changes +======================== + +The license of an upstream project might change in the future. In order +to prevent these changes going unnoticed, the +:term:`LIC_FILES_CHKSUM` +variable tracks changes to the license text. The checksums are validated +at the end of the configure step, and if the checksums do not match, the +build will fail. + +Specifying the ``LIC_FILES_CHKSUM`` Variable +-------------------------------------------- + +The :term:`LIC_FILES_CHKSUM` variable contains checksums of the license text +in the source code for the recipe. Following is an example of how to +specify :term:`LIC_FILES_CHKSUM`:: + + LIC_FILES_CHKSUM = "file://COPYING;md5=xxxx \ + file://licfile1.txt;beginline=5;endline=29;md5=yyyy \ + file://licfile2.txt;endline=50;md5=zzzz \ + ..." + +.. note:: + + - When using "beginline" and "endline", realize that line numbering + begins with one and not zero. Also, the included lines are + inclusive (i.e. lines five through and including 29 in the + previous example for ``licfile1.txt``). + + - When a license check fails, the selected license text is included + as part of the QA message. Using this output, you can determine + the exact start and finish for the needed license text. + +The build system uses the :term:`S` +variable as the default directory when searching files listed in +:term:`LIC_FILES_CHKSUM`. The previous example employs the default +directory. + +Consider this next example:: + + LIC_FILES_CHKSUM = "file://src/ls.c;beginline=5;endline=16;\ + md5=bb14ed3c4cda583abc85401304b5cd4e" + LIC_FILES_CHKSUM = "file://${WORKDIR}/license.html;md5=5c94767cedb5d6987c902ac850ded2c6" + +The first line locates a file in ``${S}/src/ls.c`` and isolates lines +five through 16 as license text. The second line refers to a file in +:term:`WORKDIR`. + +Note that :term:`LIC_FILES_CHKSUM` variable is mandatory for all recipes, +unless the :term:`LICENSE` variable is set to "CLOSED". + +Explanation of Syntax +--------------------- + +As mentioned in the previous section, the :term:`LIC_FILES_CHKSUM` variable +lists all the important files that contain the license text for the +source code. It is possible to specify a checksum for an entire file, or +a specific section of a file (specified by beginning and ending line +numbers with the "beginline" and "endline" parameters, respectively). +The latter is useful for source files with a license notice header, +README documents, and so forth. If you do not use the "beginline" +parameter, then it is assumed that the text begins on the first line of +the file. Similarly, if you do not use the "endline" parameter, it is +assumed that the license text ends with the last line of the file. + +The "md5" parameter stores the md5 checksum of the license text. If the +license text changes in any way as compared to this parameter then a +mismatch occurs. This mismatch triggers a build failure and notifies the +developer. Notification allows the developer to review and address the +license text changes. Also note that if a mismatch occurs during the +build, the correct md5 checksum is placed in the build log and can be +easily copied to the recipe. + +There is no limit to how many files you can specify using the +:term:`LIC_FILES_CHKSUM` variable. Generally, however, every project +requires a few specifications for license tracking. Many projects have a +"COPYING" file that stores the license information for all the source +code files. This practice allows you to just track the "COPYING" file as +long as it is kept up to date. + +.. note:: + + - If you specify an empty or invalid "md5" parameter, + :term:`BitBake` returns an md5 + mis-match error and displays the correct "md5" parameter value + during the build. The correct parameter is also captured in the + build log. + + - If the whole file contains only license text, you do not need to + use the "beginline" and "endline" parameters. + +Enabling Commercially Licensed Recipes +====================================== + +By default, the OpenEmbedded build system disables components that have +commercial or other special licensing requirements. Such requirements +are defined on a recipe-by-recipe basis through the +:term:`LICENSE_FLAGS` variable +definition in the affected recipe. For instance, the +``poky/meta/recipes-multimedia/gstreamer/gst-plugins-ugly`` recipe +contains the following statement:: + + LICENSE_FLAGS = "commercial" + +Here is a +slightly more complicated example that contains both an explicit recipe +name and version (after variable expansion):: + + LICENSE_FLAGS = "license_${PN}_${PV}" + +In order for a component restricted by a +:term:`LICENSE_FLAGS` definition to be enabled and included in an image, it +needs to have a matching entry in the global +:term:`LICENSE_FLAGS_ACCEPTED` +variable, which is a variable typically defined in your ``local.conf`` +file. For example, to enable the +``poky/meta/recipes-multimedia/gstreamer/gst-plugins-ugly`` package, you +could add either the string "commercial_gst-plugins-ugly" or the more +general string "commercial" to :term:`LICENSE_FLAGS_ACCEPTED`. See the +":ref:`dev-manual/licenses:license flag matching`" section for a full +explanation of how :term:`LICENSE_FLAGS` matching works. Here is the +example:: + + LICENSE_FLAGS_ACCEPTED = "commercial_gst-plugins-ugly" + +Likewise, to additionally enable the package built from the recipe +containing ``LICENSE_FLAGS = "license_${PN}_${PV}"``, and assuming that +the actual recipe name was ``emgd_1.10.bb``, the following string would +enable that package as well as the original ``gst-plugins-ugly`` +package:: + + LICENSE_FLAGS_ACCEPTED = "commercial_gst-plugins-ugly license_emgd_1.10" + +As a convenience, you do not need to specify the +complete license string for every package. You can use +an abbreviated form, which consists of just the first portion or +portions of the license string before the initial underscore character +or characters. A partial string will match any license that contains the +given string as the first portion of its license. For example, the +following value will also match both of the packages +previously mentioned as well as any other packages that have licenses +starting with "commercial" or "license":: + + LICENSE_FLAGS_ACCEPTED = "commercial license" + +License Flag Matching +--------------------- + +License flag matching allows you to control what recipes the +OpenEmbedded build system includes in the build. Fundamentally, the +build system attempts to match :term:`LICENSE_FLAGS` strings found in +recipes against strings found in :term:`LICENSE_FLAGS_ACCEPTED`. +A match causes the build system to include a recipe in the +build, while failure to find a match causes the build system to exclude +a recipe. + +In general, license flag matching is simple. However, understanding some +concepts will help you correctly and effectively use matching. + +Before a flag defined by a particular recipe is tested against the +entries of :term:`LICENSE_FLAGS_ACCEPTED`, the expanded +string ``_${PN}`` is appended to the flag. This expansion makes each +:term:`LICENSE_FLAGS` value recipe-specific. After expansion, the +string is then matched against the entries. Thus, specifying +``LICENSE_FLAGS = "commercial"`` in recipe "foo", for example, results +in the string ``"commercial_foo"``. And, to create a match, that string +must appear among the entries of :term:`LICENSE_FLAGS_ACCEPTED`. + +Judicious use of the :term:`LICENSE_FLAGS` strings and the contents of the +:term:`LICENSE_FLAGS_ACCEPTED` variable allows you a lot of flexibility for +including or excluding recipes based on licensing. For example, you can +broaden the matching capabilities by using license flags string subsets +in :term:`LICENSE_FLAGS_ACCEPTED`. + +.. note:: + + When using a string subset, be sure to use the part of the expanded + string that precedes the appended underscore character (e.g. + ``usethispart_1.3``, ``usethispart_1.4``, and so forth). + +For example, simply specifying the string "commercial" in the +:term:`LICENSE_FLAGS_ACCEPTED` variable matches any expanded +:term:`LICENSE_FLAGS` definition that starts with the string +"commercial" such as "commercial_foo" and "commercial_bar", which +are the strings the build system automatically generates for +hypothetical recipes named "foo" and "bar" assuming those recipes simply +specify the following:: + + LICENSE_FLAGS = "commercial" + +Thus, you can choose to exhaustively enumerate each license flag in the +list and allow only specific recipes into the image, or you can use a +string subset that causes a broader range of matches to allow a range of +recipes into the image. + +This scheme works even if the :term:`LICENSE_FLAGS` string already has +``_${PN}`` appended. For example, the build system turns the license +flag "commercial_1.2_foo" into "commercial_1.2_foo_foo" and would match +both the general "commercial" and the specific "commercial_1.2_foo" +strings found in the :term:`LICENSE_FLAGS_ACCEPTED` variable, as expected. + +Here are some other scenarios: + +- You can specify a versioned string in the recipe such as + "commercial_foo_1.2" in a "foo" recipe. The build system expands this + string to "commercial_foo_1.2_foo". Combine this license flag with a + :term:`LICENSE_FLAGS_ACCEPTED` variable that has the string + "commercial" and you match the flag along with any other flag that + starts with the string "commercial". + +- Under the same circumstances, you can add "commercial_foo" in the + :term:`LICENSE_FLAGS_ACCEPTED` variable and the build system not only + matches "commercial_foo_1.2" but also matches any license flag with + the string "commercial_foo", regardless of the version. + +- You can be very specific and use both the package and version parts + in the :term:`LICENSE_FLAGS_ACCEPTED` list (e.g. + "commercial_foo_1.2") to specifically match a versioned recipe. + +Other Variables Related to Commercial Licenses +---------------------------------------------- + +There are other helpful variables related to commercial license handling, +defined in the +``poky/meta/conf/distro/include/default-distrovars.inc`` file:: + + COMMERCIAL_AUDIO_PLUGINS ?= "" + COMMERCIAL_VIDEO_PLUGINS ?= "" + +If you +want to enable these components, you can do so by making sure you have +statements similar to the following in your ``local.conf`` configuration +file:: + + COMMERCIAL_AUDIO_PLUGINS = "gst-plugins-ugly-mad \ + gst-plugins-ugly-mpegaudioparse" + COMMERCIAL_VIDEO_PLUGINS = "gst-plugins-ugly-mpeg2dec \ + gst-plugins-ugly-mpegstream gst-plugins-bad-mpegvideoparse" + LICENSE_FLAGS_ACCEPTED = "commercial_gst-plugins-ugly commercial_gst-plugins-bad commercial_qmmp" + + +Of course, you could also create a matching list for those +components using the more general "commercial" in the +:term:`LICENSE_FLAGS_ACCEPTED` variable, but that would also enable all +the other packages with :term:`LICENSE_FLAGS` +containing "commercial", which you may or may not want:: + + LICENSE_FLAGS_ACCEPTED = "commercial" + +Specifying audio and video plugins as part of the +``COMMERCIAL_AUDIO_PLUGINS`` and ``COMMERCIAL_VIDEO_PLUGINS`` statements +(along with the enabling :term:`LICENSE_FLAGS_ACCEPTED`) includes the +plugins or components into built images, thus adding support for media +formats or components. + +Maintaining Open Source License Compliance During Your Product's Lifecycle +========================================================================== + +One of the concerns for a development organization using open source +software is how to maintain compliance with various open source +licensing during the lifecycle of the product. While this section does +not provide legal advice or comprehensively cover all scenarios, it does +present methods that you can use to assist you in meeting the compliance +requirements during a software release. + +With hundreds of different open source licenses that the Yocto Project +tracks, it is difficult to know the requirements of each and every +license. However, the requirements of the major FLOSS licenses can begin +to be covered by assuming that there are three main areas of concern: + +- Source code must be provided. + +- License text for the software must be provided. + +- Compilation scripts and modifications to the source code must be + provided. + +There are other requirements beyond the scope of these three and the +methods described in this section (e.g. the mechanism through which +source code is distributed). + +As different organizations have different methods of complying with open +source licensing, this section is not meant to imply that there is only +one single way to meet your compliance obligations, but rather to +describe one method of achieving compliance. The remainder of this +section describes methods supported to meet the previously mentioned +three requirements. Once you take steps to meet these requirements, and +prior to releasing images, sources, and the build system, you should +audit all artifacts to ensure completeness. + +.. note:: + + The Yocto Project generates a license manifest during image creation + that is located in ``${DEPLOY_DIR}/licenses/``\ `image_name`\ ``-``\ `datestamp` + to assist with any audits. + +Providing the Source Code +------------------------- + +Compliance activities should begin before you generate the final image. +The first thing you should look at is the requirement that tops the list +for most compliance groups --- providing the source. The Yocto Project has +a few ways of meeting this requirement. + +One of the easiest ways to meet this requirement is to provide the +entire :term:`DL_DIR` used by the +build. This method, however, has a few issues. The most obvious is the +size of the directory since it includes all sources used in the build +and not just the source used in the released image. It will include +toolchain source, and other artifacts, which you would not generally +release. However, the more serious issue for most companies is +accidental release of proprietary software. The Yocto Project provides +an :ref:`ref-classes-archiver` class to help avoid some of these concerns. + +Before you employ :term:`DL_DIR` or the :ref:`ref-classes-archiver` class, you +need to decide how you choose to provide source. The source +:ref:`ref-classes-archiver` class can generate tarballs and SRPMs and can +create them with various levels of compliance in mind. + +One way of doing this (but certainly not the only way) is to release +just the source as a tarball. You can do this by adding the following to +the ``local.conf`` file found in the :term:`Build Directory`:: + + INHERIT += "archiver" + ARCHIVER_MODE[src] = "original" + +During the creation of your +image, the source from all recipes that deploy packages to the image is +placed within subdirectories of ``DEPLOY_DIR/sources`` based on the +:term:`LICENSE` for each recipe. +Releasing the entire directory enables you to comply with requirements +concerning providing the unmodified source. It is important to note that +the size of the directory can get large. + +A way to help mitigate the size issue is to only release tarballs for +licenses that require the release of source. Let us assume you are only +concerned with GPL code as identified by running the following script: + +.. code-block:: shell + + # Script to archive a subset of packages matching specific license(s) + # Source and license files are copied into sub folders of package folder + # Must be run from build folder + #!/bin/bash + src_release_dir="source-release" + mkdir -p $src_release_dir + for a in tmp/deploy/sources/*; do + for d in $a/*; do + # Get package name from path + p=`basename $d` + p=${p%-*} + p=${p%-*} + # Only archive GPL packages (update *GPL* regex for your license check) + numfiles=`ls tmp/deploy/licenses/$p/*GPL* 2> /dev/null | wc -l` + if [ $numfiles -ge 1 ]; then + echo Archiving $p + mkdir -p $src_release_dir/$p/source + cp $d/* $src_release_dir/$p/source 2> /dev/null + mkdir -p $src_release_dir/$p/license + cp tmp/deploy/licenses/$p/* $src_release_dir/$p/license 2> /dev/null + fi + done + done + +At this point, you +could create a tarball from the ``gpl_source_release`` directory and +provide that to the end user. This method would be a step toward +achieving compliance with section 3a of GPLv2 and with section 6 of +GPLv3. + +Providing License Text +---------------------- + +One requirement that is often overlooked is inclusion of license text. +This requirement also needs to be dealt with prior to generating the +final image. Some licenses require the license text to accompany the +binary. You can achieve this by adding the following to your +``local.conf`` file:: + + COPY_LIC_MANIFEST = "1" + COPY_LIC_DIRS = "1" + LICENSE_CREATE_PACKAGE = "1" + +Adding these statements to the +configuration file ensures that the licenses collected during package +generation are included on your image. + +.. note:: + + Setting all three variables to "1" results in the image having two + copies of the same license file. One copy resides in + ``/usr/share/common-licenses`` and the other resides in + ``/usr/share/license``. + + The reason for this behavior is because + :term:`COPY_LIC_DIRS` and + :term:`COPY_LIC_MANIFEST` + add a copy of the license when the image is built but do not offer a + path for adding licenses for newly installed packages to an image. + :term:`LICENSE_CREATE_PACKAGE` + adds a separate package and an upgrade path for adding licenses to an + image. + +As the source :ref:`ref-classes-archiver` class has already archived the +original unmodified source that contains the license files, you would have +already met the requirements for inclusion of the license information +with source as defined by the GPL and other open source licenses. + +Providing Compilation Scripts and Source Code Modifications +----------------------------------------------------------- + +At this point, we have addressed all we need to prior to generating the +image. The next two requirements are addressed during the final +packaging of the release. + +By releasing the version of the OpenEmbedded build system and the layers +used during the build, you will be providing both compilation scripts +and the source code modifications in one step. + +If the deployment team has a :ref:`overview-manual/concepts:bsp layer` +and a distro layer, and those +those layers are used to patch, compile, package, or modify (in any way) +any open source software included in your released images, you might be +required to release those layers under section 3 of GPLv2 or section 1 +of GPLv3. One way of doing that is with a clean checkout of the version +of the Yocto Project and layers used during your build. Here is an +example: + +.. code-block:: shell + + # We built using the dunfell branch of the poky repo + $ git clone -b dunfell git://git.yoctoproject.org/poky + $ cd poky + # We built using the release_branch for our layers + $ git clone -b release_branch git://git.mycompany.com/meta-my-bsp-layer + $ git clone -b release_branch git://git.mycompany.com/meta-my-software-layer + # clean up the .git repos + $ find . -name ".git" -type d -exec rm -rf {} \; + +One thing a development organization might want to consider for end-user +convenience is to modify +``meta-poky/conf/templates/default/bblayers.conf.sample`` to ensure that when +the end user utilizes the released build system to build an image, the +development organization's layers are included in the ``bblayers.conf`` file +automatically:: + + # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf + # changes incompatibly + POKY_BBLAYERS_CONF_VERSION = "2" + + BBPATH = "${TOPDIR}" + BBFILES ?= "" + + BBLAYERS ?= " \ + ##OEROOT##/meta \ + ##OEROOT##/meta-poky \ + ##OEROOT##/meta-yocto-bsp \ + ##OEROOT##/meta-mylayer \ + " + +Creating and +providing an archive of the :term:`Metadata` +layers (recipes, configuration files, and so forth) enables you to meet +your requirements to include the scripts to control compilation as well +as any modifications to the original source. + +Compliance Limitations with Executables Built from Static Libraries +------------------------------------------------------------------- + +When package A is added to an image via the :term:`RDEPENDS` or :term:`RRECOMMENDS` +mechanisms as well as explicitly included in the image recipe with +:term:`IMAGE_INSTALL`, and depends on a static linked library recipe B +(``DEPENDS += "B"``), package B will neither appear in the generated license +manifest nor in the generated source tarballs. This occurs as the +:ref:`ref-classes-license` and :ref:`ref-classes-archiver` classes assume that +only packages included via :term:`RDEPENDS` or :term:`RRECOMMENDS` +end up in the image. + +As a result, potential obligations regarding license compliance for package B +may not be met. + +The Yocto Project doesn't enable static libraries by default, in part because +of this issue. Before a solution to this limitation is found, you need to +keep in mind that if your root filesystem is built from static libraries, +you will need to manually ensure that your deliveries are compliant +with the licenses of these libraries. + +Copying Non Standard Licenses +============================= + +Some packages, such as the linux-firmware package, have many licenses +that are not in any way common. You can avoid adding a lot of these +types of common license files, which are only applicable to a specific +package, by using the +:term:`NO_GENERIC_LICENSE` +variable. Using this variable also avoids QA errors when you use a +non-common, non-CLOSED license in a recipe. + +Here is an example that uses the ``LICENSE.Abilis.txt`` file as +the license from the fetched source:: + + NO_GENERIC_LICENSE[Firmware-Abilis] = "LICENSE.Abilis.txt" + diff --git a/poky/documentation/dev-manual/new-machine.rst b/poky/documentation/dev-manual/new-machine.rst new file mode 100644 index 0000000000..930dd7eac7 --- /dev/null +++ b/poky/documentation/dev-manual/new-machine.rst @@ -0,0 +1,118 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Adding a New Machine +******************** + +Adding a new machine to the Yocto Project is a straightforward process. +This section describes how to add machines that are similar to those +that the Yocto Project already supports. + +.. note:: + + Although well within the capabilities of the Yocto Project, adding a + totally new architecture might require changes to ``gcc``/``glibc`` + and to the site information, which is beyond the scope of this + manual. + +For a complete example that shows how to add a new machine, see the +":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`" +section in the Yocto Project Board Support Package (BSP) Developer's +Guide. + +Adding the Machine Configuration File +===================================== + +To add a new machine, you need to add a new machine configuration file +to the layer's ``conf/machine`` directory. This configuration file +provides details about the device you are adding. + +The OpenEmbedded build system uses the root name of the machine +configuration file to reference the new machine. For example, given a +machine configuration file named ``crownbay.conf``, the build system +recognizes the machine as "crownbay". + +The most important variables you must set in your machine configuration +file or include from a lower-level configuration file are as follows: + +- :term:`TARGET_ARCH` (e.g. "arm") + +- ``PREFERRED_PROVIDER_virtual/kernel`` + +- :term:`MACHINE_FEATURES` (e.g. "apm screen wifi") + +You might also need these variables: + +- :term:`SERIAL_CONSOLES` (e.g. "115200;ttyS0 115200;ttyS1") + +- :term:`KERNEL_IMAGETYPE` (e.g. "zImage") + +- :term:`IMAGE_FSTYPES` (e.g. "tar.gz jffs2") + +You can find full details on these variables in the reference section. +You can leverage existing machine ``.conf`` files from +``meta-yocto-bsp/conf/machine/``. + +Adding a Kernel for the Machine +=============================== + +The OpenEmbedded build system needs to be able to build a kernel for the +machine. You need to either create a new kernel recipe for this machine, +or extend an existing kernel recipe. You can find several kernel recipe +examples in the Source Directory at ``meta/recipes-kernel/linux`` that +you can use as references. + +If you are creating a new kernel recipe, normal recipe-writing rules +apply for setting up a :term:`SRC_URI`. Thus, you need to specify any +necessary patches and set :term:`S` to point at the source code. You need to +create a :ref:`ref-tasks-configure` task that configures the unpacked kernel with +a ``defconfig`` file. You can do this by using a ``make defconfig`` +command or, more commonly, by copying in a suitable ``defconfig`` file +and then running ``make oldconfig``. By making use of ``inherit kernel`` +and potentially some of the ``linux-*.inc`` files, most other +functionality is centralized and the defaults of the class normally work +well. + +If you are extending an existing kernel recipe, it is usually a matter +of adding a suitable ``defconfig`` file. The file needs to be added into +a location similar to ``defconfig`` files used for other machines in a +given kernel recipe. A possible way to do this is by listing the file in +the :term:`SRC_URI` and adding the machine to the expression in +:term:`COMPATIBLE_MACHINE`:: + + COMPATIBLE_MACHINE = '(qemux86|qemumips)' + +For more information on ``defconfig`` files, see the +":ref:`kernel-dev/common:changing the configuration`" +section in the Yocto Project Linux Kernel Development Manual. + +Adding a Formfactor Configuration File +====================================== + +A formfactor configuration file provides information about the target +hardware for which the image is being built and information that the +build system cannot obtain from other sources such as the kernel. Some +examples of information contained in a formfactor configuration file +include framebuffer orientation, whether or not the system has a +keyboard, the positioning of the keyboard in relation to the screen, and +the screen resolution. + +The build system uses reasonable defaults in most cases. However, if +customization is necessary, you need to create a ``machconfig`` file in +the ``meta/recipes-bsp/formfactor/files`` directory. This directory +contains directories for specific machines such as ``qemuarm`` and +``qemux86``. For information about the settings available and the +defaults, see the ``meta/recipes-bsp/formfactor/files/config`` file +found in the same area. + +Following is an example for "qemuarm" machine:: + + HAVE_TOUCHSCREEN=1 + HAVE_KEYBOARD=1 + DISPLAY_CAN_ROTATE=0 + DISPLAY_ORIENTATION=0 + #DISPLAY_WIDTH_PIXELS=640 + #DISPLAY_HEIGHT_PIXELS=480 + #DISPLAY_BPP=16 + DISPLAY_DPI=150 + DISPLAY_SUBPIXEL_ORDER=vrgb + diff --git a/poky/documentation/dev-manual/new-recipe.rst b/poky/documentation/dev-manual/new-recipe.rst new file mode 100644 index 0000000000..4751f64b7e --- /dev/null +++ b/poky/documentation/dev-manual/new-recipe.rst @@ -0,0 +1,1657 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Writing a New Recipe +******************** + +Recipes (``.bb`` files) are fundamental components in the Yocto Project +environment. Each software component built by the OpenEmbedded build +system requires a recipe to define the component. This section describes +how to create, write, and test a new recipe. + +.. note:: + + For information on variables that are useful for recipes and for + information about recipe naming issues, see the + ":ref:`ref-manual/varlocality:recipes`" section of the Yocto Project + Reference Manual. + +Overview +======== + +The following figure shows the basic process for creating a new recipe. +The remainder of the section provides details for the steps. + +.. image:: figures/recipe-workflow.png + :align: center + :width: 50% + +Locate or Automatically Create a Base Recipe +============================================ + +You can always write a recipe from scratch. However, there are three choices +that can help you quickly get started with a new recipe: + +- ``devtool add``: A command that assists in creating a recipe and an + environment conducive to development. + +- ``recipetool create``: A command provided by the Yocto Project that + automates creation of a base recipe based on the source files. + +- *Existing Recipes:* Location and modification of an existing recipe + that is similar in function to the recipe you need. + +.. note:: + + For information on recipe syntax, see the + ":ref:`dev-manual/new-recipe:recipe syntax`" section. + +Creating the Base Recipe Using ``devtool add`` +---------------------------------------------- + +The ``devtool add`` command uses the same logic for auto-creating the +recipe as ``recipetool create``, which is listed below. Additionally, +however, ``devtool add`` sets up an environment that makes it easy for +you to patch the source and to make changes to the recipe as is often +necessary when adding a recipe to build a new piece of software to be +included in a build. + +You can find a complete description of the ``devtool add`` command in +the ":ref:`sdk-manual/extensible:a closer look at \`\`devtool add\`\``" section +in the Yocto Project Application Development and the Extensible Software +Development Kit (eSDK) manual. + +Creating the Base Recipe Using ``recipetool create`` +---------------------------------------------------- + +``recipetool create`` automates creation of a base recipe given a set of +source code files. As long as you can extract or point to the source +files, the tool will construct a recipe and automatically configure all +pre-build information into the recipe. For example, suppose you have an +application that builds using Autotools. Creating the base recipe using +``recipetool`` results in a recipe that has the pre-build dependencies, +license requirements, and checksums configured. + +To run the tool, you just need to be in your :term:`Build Directory` and +have sourced the build environment setup script (i.e. +:ref:`structure-core-script`). To get help on the tool, use the following +command:: + + $ recipetool -h + NOTE: Starting bitbake server... + usage: recipetool [-d] [-q] [--color COLOR] [-h] ... + + OpenEmbedded recipe tool + + options: + -d, --debug Enable debug output + -q, --quiet Print only errors + --color COLOR Colorize output (where COLOR is auto, always, never) + -h, --help show this help message and exit + + subcommands: + create Create a new recipe + newappend Create a bbappend for the specified target in the specified + layer + setvar Set a variable within a recipe + appendfile Create/update a bbappend to replace a target file + appendsrcfiles Create/update a bbappend to add or replace source files + appendsrcfile Create/update a bbappend to add or replace a source file + Use recipetool --help to get help on a specific command + +Running ``recipetool create -o OUTFILE`` creates the base recipe and +locates it properly in the layer that contains your source files. +Following are some syntax examples: + + - Use this syntax to generate a recipe based on source. Once generated, + the recipe resides in the existing source code layer:: + + recipetool create -o OUTFILE source + + - Use this syntax to generate a recipe using code that + you extract from source. The extracted code is placed in its own layer + defined by :term:`EXTERNALSRC`:: + + recipetool create -o OUTFILE -x EXTERNALSRC source + + - Use this syntax to generate a recipe based on source. The options + direct ``recipetool`` to generate debugging information. Once generated, + the recipe resides in the existing source code layer:: + + recipetool create -d -o OUTFILE source + +Locating and Using a Similar Recipe +----------------------------------- + +Before writing a recipe from scratch, it is often useful to discover +whether someone else has already written one that meets (or comes close +to meeting) your needs. The Yocto Project and OpenEmbedded communities +maintain many recipes that might be candidates for what you are doing. +You can find a good central index of these recipes in the +:oe_layerindex:`OpenEmbedded Layer Index <>`. + +Working from an existing recipe or a skeleton recipe is the best way to +get started. Here are some points on both methods: + +- *Locate and modify a recipe that is close to what you want to do:* + This method works when you are familiar with the current recipe + space. The method does not work so well for those new to the Yocto + Project or writing recipes. + + Some risks associated with this method are using a recipe that has + areas totally unrelated to what you are trying to accomplish with + your recipe, not recognizing areas of the recipe that you might have + to add from scratch, and so forth. All these risks stem from + unfamiliarity with the existing recipe space. + +- *Use and modify the following skeleton recipe:* If for some reason + you do not want to use ``recipetool`` and you cannot find an existing + recipe that is close to meeting your needs, you can use the following + structure to provide the fundamental areas of a new recipe:: + + DESCRIPTION = "" + HOMEPAGE = "" + LICENSE = "" + SECTION = "" + DEPENDS = "" + LIC_FILES_CHKSUM = "" + + SRC_URI = "" + +Storing and Naming the Recipe +============================= + +Once you have your base recipe, you should put it in your own layer and +name it appropriately. Locating it correctly ensures that the +OpenEmbedded build system can find it when you use BitBake to process +the recipe. + +- *Storing Your Recipe:* The OpenEmbedded build system locates your + recipe through the layer's ``conf/layer.conf`` file and the + :term:`BBFILES` variable. This + variable sets up a path from which the build system can locate + recipes. Here is the typical use:: + + BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + + Consequently, you need to be sure you locate your new recipe inside + your layer such that it can be found. + + You can find more information on how layers are structured in the + ":ref:`dev-manual/layers:understanding and creating layers`" section. + +- *Naming Your Recipe:* When you name your recipe, you need to follow + this naming convention:: + + basename_version.bb + + Use lower-cased characters and do not include the reserved suffixes + ``-native``, ``-cross``, ``-initial``, or ``-dev`` casually (i.e. do not use + them as part of your recipe name unless the string applies). Here are some + examples: + + .. code-block:: none + + cups_1.7.0.bb + gawk_4.0.2.bb + irssi_0.8.16-rc1.bb + +Running a Build on the Recipe +============================= + +Creating a new recipe is usually an iterative process that requires +using BitBake to process the recipe multiple times in order to +progressively discover and add information to the recipe file. + +Assuming you have sourced the build environment setup script (i.e. +:ref:`structure-core-script`) and you are in the :term:`Build Directory`, use +BitBake to process your recipe. All you need to provide is the +``basename`` of the recipe as described in the previous section:: + + $ bitbake basename + +During the build, the OpenEmbedded build system creates a temporary work +directory for each recipe +(``${``\ :term:`WORKDIR`\ ``}``) +where it keeps extracted source files, log files, intermediate +compilation and packaging files, and so forth. + +The path to the per-recipe temporary work directory depends on the +context in which it is being built. The quickest way to find this path +is to have BitBake return it by running the following:: + + $ bitbake -e basename | grep ^WORKDIR= + +As an example, assume a Source Directory +top-level folder named ``poky``, a default :term:`Build Directory` at +``poky/build``, and a ``qemux86-poky-linux`` machine target system. +Furthermore, suppose your recipe is named ``foo_1.3.0.bb``. In this +case, the work directory the build system uses to build the package +would be as follows:: + + poky/build/tmp/work/qemux86-poky-linux/foo/1.3.0-r0 + +Inside this directory you can find sub-directories such as ``image``, +``packages-split``, and ``temp``. After the build, you can examine these +to determine how well the build went. + +.. note:: + + You can find log files for each task in the recipe's ``temp`` + directory (e.g. ``poky/build/tmp/work/qemux86-poky-linux/foo/1.3.0-r0/temp``). + Log files are named ``log.taskname`` (e.g. ``log.do_configure``, + ``log.do_fetch``, and ``log.do_compile``). + +You can find more information about the build process in +":doc:`/overview-manual/development-environment`" +chapter of the Yocto Project Overview and Concepts Manual. + +Fetching Code +============= + +The first thing your recipe must do is specify how to fetch the source +files. Fetching is controlled mainly through the +:term:`SRC_URI` variable. Your recipe +must have a :term:`SRC_URI` variable that points to where the source is +located. For a graphical representation of source locations, see the +":ref:`overview-manual/concepts:sources`" section in +the Yocto Project Overview and Concepts Manual. + +The :ref:`ref-tasks-fetch` task uses +the prefix of each entry in the :term:`SRC_URI` variable value to determine +which :ref:`fetcher ` to use to get your +source files. It is the :term:`SRC_URI` variable that triggers the fetcher. +The :ref:`ref-tasks-patch` task uses +the variable after source is fetched to apply patches. The OpenEmbedded +build system uses +:term:`FILESOVERRIDES` for +scanning directory locations for local files in :term:`SRC_URI`. + +The :term:`SRC_URI` variable in your recipe must define each unique location +for your source files. It is good practice to not hard-code version +numbers in a URL used in :term:`SRC_URI`. Rather than hard-code these +values, use ``${``\ :term:`PV`\ ``}``, +which causes the fetch process to use the version specified in the +recipe filename. Specifying the version in this manner means that +upgrading the recipe to a future version is as simple as renaming the +recipe to match the new version. + +Here is a simple example from the +``meta/recipes-devtools/strace/strace_5.5.bb`` recipe where the source +comes from a single tarball. Notice the use of the +:term:`PV` variable:: + + SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \ + +Files mentioned in :term:`SRC_URI` whose names end in a typical archive +extension (e.g. ``.tar``, ``.tar.gz``, ``.tar.bz2``, ``.zip``, and so +forth), are automatically extracted during the +:ref:`ref-tasks-unpack` task. For +another example that specifies these types of files, see the +":ref:`dev-manual/new-recipe:autotooled package`" section. + +Another way of specifying source is from an SCM. For Git repositories, +you must specify :term:`SRCREV` and you should specify :term:`PV` to include +the revision with :term:`SRCPV`. Here is an example from the recipe +``meta/recipes-core/musl/gcompat_git.bb``:: + + SRC_URI = "git://git.adelielinux.org/adelie/gcompat.git;protocol=https;branch=current" + + PV = "1.0.0+1.1+git${SRCPV}" + SRCREV = "af5a49e489fdc04b9cf02547650d7aeaccd43793" + +If your :term:`SRC_URI` statement includes URLs pointing to individual files +fetched from a remote server other than a version control system, +BitBake attempts to verify the files against checksums defined in your +recipe to ensure they have not been tampered with or otherwise modified +since the recipe was written. Two checksums are used: +``SRC_URI[md5sum]`` and ``SRC_URI[sha256sum]``. + +If your :term:`SRC_URI` variable points to more than a single URL (excluding +SCM URLs), you need to provide the ``md5`` and ``sha256`` checksums for +each URL. For these cases, you provide a name for each URL as part of +the :term:`SRC_URI` and then reference that name in the subsequent checksum +statements. Here is an example combining lines from the files +``git.inc`` and ``git_2.24.1.bb``:: + + SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \ + ${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages" + + SRC_URI[tarball.md5sum] = "166bde96adbbc11c8843d4f8f4f9811b" + SRC_URI[tarball.sha256sum] = "ad5334956301c86841eb1e5b1bb20884a6bad89a10a6762c958220c7cf64da02" + SRC_URI[manpages.md5sum] = "31c2272a8979022497ba3d4202df145d" + SRC_URI[manpages.sha256sum] = "9a7ae3a093bea39770eb96ca3e5b40bff7af0b9f6123f089d7821d0e5b8e1230" + +Proper values for ``md5`` and ``sha256`` checksums might be available +with other signatures on the download page for the upstream source (e.g. +``md5``, ``sha1``, ``sha256``, ``GPG``, and so forth). Because the +OpenEmbedded build system only deals with ``sha256sum`` and ``md5sum``, +you should verify all the signatures you find by hand. + +If no :term:`SRC_URI` checksums are specified when you attempt to build the +recipe, or you provide an incorrect checksum, the build will produce an +error for each missing or incorrect checksum. As part of the error +message, the build system provides the checksum string corresponding to +the fetched file. Once you have the correct checksums, you can copy and +paste them into your recipe and then run the build again to continue. + +.. note:: + + As mentioned, if the upstream source provides signatures for + verifying the downloaded source code, you should verify those + manually before setting the checksum values in the recipe and + continuing with the build. + +This final example is a bit more complicated and is from the +``meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.20.bb`` recipe. The +example's :term:`SRC_URI` statement identifies multiple files as the source +files for the recipe: a tarball, a patch file, a desktop file, and an icon:: + + SRC_URI = "http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${PV}.tar.bz2 \ + file://xwc.patch \ + file://rxvt.desktop \ + file://rxvt.png" + +When you specify local files using the ``file://`` URI protocol, the +build system fetches files from the local machine. The path is relative +to the :term:`FILESPATH` variable +and searches specific directories in a certain order: +``${``\ :term:`BP`\ ``}``, +``${``\ :term:`BPN`\ ``}``, and +``files``. The directories are assumed to be subdirectories of the +directory in which the recipe or append file resides. For another +example that specifies these types of files, see the +":ref:`dev-manual/new-recipe:single .c file package (hello world!)`" section. + +The previous example also specifies a patch file. Patch files are files +whose names usually end in ``.patch`` or ``.diff`` but can end with +compressed suffixes such as ``diff.gz`` and ``patch.bz2``, for example. +The build system automatically applies patches as described in the +":ref:`dev-manual/new-recipe:patching code`" section. + +Fetching Code Through Firewalls +------------------------------- + +Some users are behind firewalls and need to fetch code through a proxy. +See the ":doc:`/ref-manual/faq`" chapter for advice. + +Limiting the Number of Parallel Connections +------------------------------------------- + +Some users are behind firewalls or use servers where the number of parallel +connections is limited. In such cases, you can limit the number of fetch +tasks being run in parallel by adding the following to your ``local.conf`` +file:: + + do_fetch[number_threads] = "4" + +Unpacking Code +============== + +During the build, the +:ref:`ref-tasks-unpack` task unpacks +the source with ``${``\ :term:`S`\ ``}`` +pointing to where it is unpacked. + +If you are fetching your source files from an upstream source archived +tarball and the tarball's internal structure matches the common +convention of a top-level subdirectory named +``${``\ :term:`BPN`\ ``}-${``\ :term:`PV`\ ``}``, +then you do not need to set :term:`S`. However, if :term:`SRC_URI` specifies to +fetch source from an archive that does not use this convention, or from +an SCM like Git or Subversion, your recipe needs to define :term:`S`. + +If processing your recipe using BitBake successfully unpacks the source +files, you need to be sure that the directory pointed to by ``${S}`` +matches the structure of the source. + +Patching Code +============= + +Sometimes it is necessary to patch code after it has been fetched. Any +files mentioned in :term:`SRC_URI` whose names end in ``.patch`` or +``.diff`` or compressed versions of these suffixes (e.g. ``diff.gz`` are +treated as patches. The +:ref:`ref-tasks-patch` task +automatically applies these patches. + +The build system should be able to apply patches with the "-p1" option +(i.e. one directory level in the path will be stripped off). If your +patch needs to have more directory levels stripped off, specify the +number of levels using the "striplevel" option in the :term:`SRC_URI` entry +for the patch. Alternatively, if your patch needs to be applied in a +specific subdirectory that is not specified in the patch file, use the +"patchdir" option in the entry. + +As with all local files referenced in +:term:`SRC_URI` using ``file://``, +you should place patch files in a directory next to the recipe either +named the same as the base name of the recipe +(:term:`BP` and +:term:`BPN`) or "files". + +Licensing +========= + +Your recipe needs to have both the +:term:`LICENSE` and +:term:`LIC_FILES_CHKSUM` +variables: + +- :term:`LICENSE`: This variable specifies the license for the software. + If you do not know the license under which the software you are + building is distributed, you should go to the source code and look + for that information. Typical files containing this information + include ``COPYING``, :term:`LICENSE`, and ``README`` files. You could + also find the information near the top of a source file. For example, + given a piece of software licensed under the GNU General Public + License version 2, you would set :term:`LICENSE` as follows:: + + LICENSE = "GPL-2.0-only" + + The licenses you specify within :term:`LICENSE` can have any name as long + as you do not use spaces, since spaces are used as separators between + license names. For standard licenses, use the names of the files in + ``meta/files/common-licenses/`` or the :term:`SPDXLICENSEMAP` flag names + defined in ``meta/conf/licenses.conf``. + +- :term:`LIC_FILES_CHKSUM`: The OpenEmbedded build system uses this + variable to make sure the license text has not changed. If it has, + the build produces an error and it affords you the chance to figure + it out and correct the problem. + + You need to specify all applicable licensing files for the software. + At the end of the configuration step, the build process will compare + the checksums of the files to be sure the text has not changed. Any + differences result in an error with the message containing the + current checksum. For more explanation and examples of how to set the + :term:`LIC_FILES_CHKSUM` variable, see the + ":ref:`dev-manual/licenses:tracking license changes`" section. + + To determine the correct checksum string, you can list the + appropriate files in the :term:`LIC_FILES_CHKSUM` variable with incorrect + md5 strings, attempt to build the software, and then note the + resulting error messages that will report the correct md5 strings. + See the ":ref:`dev-manual/new-recipe:fetching code`" section for + additional information. + + Here is an example that assumes the software has a ``COPYING`` file:: + + LIC_FILES_CHKSUM = "file://COPYING;md5=xxx" + + When you try to build the + software, the build system will produce an error and give you the + correct string that you can substitute into the recipe file for a + subsequent build. + +Dependencies +============ + +Most software packages have a short list of other packages that they +require, which are called dependencies. These dependencies fall into two +main categories: build-time dependencies, which are required when the +software is built; and runtime dependencies, which are required to be +installed on the target in order for the software to run. + +Within a recipe, you specify build-time dependencies using the +:term:`DEPENDS` variable. Although there are nuances, +items specified in :term:`DEPENDS` should be names of other +recipes. It is important that you specify all build-time dependencies +explicitly. + +Another consideration is that configure scripts might automatically +check for optional dependencies and enable corresponding functionality +if those dependencies are found. If you wish to make a recipe that is +more generally useful (e.g. publish the recipe in a layer for others to +use), instead of hard-disabling the functionality, you can use the +:term:`PACKAGECONFIG` variable to allow functionality and the +corresponding dependencies to be enabled and disabled easily by other +users of the recipe. + +Similar to build-time dependencies, you specify runtime dependencies +through a variable - +:term:`RDEPENDS`, which is +package-specific. All variables that are package-specific need to have +the name of the package added to the end as an override. Since the main +package for a recipe has the same name as the recipe, and the recipe's +name can be found through the +``${``\ :term:`PN`\ ``}`` variable, then +you specify the dependencies for the main package by setting +``RDEPENDS:${PN}``. If the package were named ``${PN}-tools``, then you +would set ``RDEPENDS:${PN}-tools``, and so forth. + +Some runtime dependencies will be set automatically at packaging time. +These dependencies include any shared library dependencies (i.e. if a +package "example" contains "libexample" and another package "mypackage" +contains a binary that links to "libexample" then the OpenEmbedded build +system will automatically add a runtime dependency to "mypackage" on +"example"). See the +":ref:`overview-manual/concepts:automatically added runtime dependencies`" +section in the Yocto Project Overview and Concepts Manual for further +details. + +Configuring the Recipe +====================== + +Most software provides some means of setting build-time configuration +options before compilation. Typically, setting these options is +accomplished by running a configure script with options, or by modifying +a build configuration file. + +.. note:: + + As of Yocto Project Release 1.7, some of the core recipes that + package binary configuration scripts now disable the scripts due to + the scripts previously requiring error-prone path substitution. The + OpenEmbedded build system uses ``pkg-config`` now, which is much more + robust. You can find a list of the ``*-config`` scripts that are disabled + in the ":ref:`migration-1.7-binary-configuration-scripts-disabled`" section + in the Yocto Project Reference Manual. + +A major part of build-time configuration is about checking for +build-time dependencies and possibly enabling optional functionality as +a result. You need to specify any build-time dependencies for the +software you are building in your recipe's +:term:`DEPENDS` value, in terms of +other recipes that satisfy those dependencies. You can often find +build-time or runtime dependencies described in the software's +documentation. + +The following list provides configuration items of note based on how +your software is built: + +- *Autotools:* If your source files have a ``configure.ac`` file, then + your software is built using Autotools. If this is the case, you just + need to modify the configuration. + + When using Autotools, your recipe needs to inherit the + :ref:`ref-classes-autotools` class and it does not have to + contain a :ref:`ref-tasks-configure` task. However, you might still want to + make some adjustments. For example, you can set :term:`EXTRA_OECONF` or + :term:`PACKAGECONFIG_CONFARGS` to pass any needed configure options that + are specific to the recipe. + +- *CMake:* If your source files have a ``CMakeLists.txt`` file, then + your software is built using CMake. If this is the case, you just + need to modify the configuration. + + When you use CMake, your recipe needs to inherit the + :ref:`ref-classes-cmake` class and it does not have to contain a + :ref:`ref-tasks-configure` task. You can make some adjustments by setting + :term:`EXTRA_OECMAKE` to pass any needed configure options that are + specific to the recipe. + + .. note:: + + If you need to install one or more custom CMake toolchain files + that are supplied by the application you are building, install the + files to ``${D}${datadir}/cmake/Modules`` during :ref:`ref-tasks-install`. + +- *Other:* If your source files do not have a ``configure.ac`` or + ``CMakeLists.txt`` file, then your software is built using some + method other than Autotools or CMake. If this is the case, you + normally need to provide a + :ref:`ref-tasks-configure` task + in your recipe unless, of course, there is nothing to configure. + + Even if your software is not being built by Autotools or CMake, you + still might not need to deal with any configuration issues. You need + to determine if configuration is even a required step. You might need + to modify a Makefile or some configuration file used for the build to + specify necessary build options. Or, perhaps you might need to run a + provided, custom configure script with the appropriate options. + + For the case involving a custom configure script, you would run + ``./configure --help`` and look for the options you need to set. + +Once configuration succeeds, it is always good practice to look at the +``log.do_configure`` file to ensure that the appropriate options have +been enabled and no additional build-time dependencies need to be added +to :term:`DEPENDS`. For example, if the configure script reports that it +found something not mentioned in :term:`DEPENDS`, or that it did not find +something that it needed for some desired optional functionality, then +you would need to add those to :term:`DEPENDS`. Looking at the log might +also reveal items being checked for, enabled, or both that you do not +want, or items not being found that are in :term:`DEPENDS`, in which case +you would need to look at passing extra options to the configure script +as needed. For reference information on configure options specific to +the software you are building, you can consult the output of the +``./configure --help`` command within ``${S}`` or consult the software's +upstream documentation. + +Using Headers to Interface with Devices +======================================= + +If your recipe builds an application that needs to communicate with some +device or needs an API into a custom kernel, you will need to provide +appropriate header files. Under no circumstances should you ever modify +the existing +``meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc`` file. +These headers are used to build ``libc`` and must not be compromised +with custom or machine-specific header information. If you customize +``libc`` through modified headers all other applications that use +``libc`` thus become affected. + +.. note:: + + Never copy and customize the ``libc`` header file (i.e. + ``meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc``). + +The correct way to interface to a device or custom kernel is to use a +separate package that provides the additional headers for the driver or +other unique interfaces. When doing so, your application also becomes +responsible for creating a dependency on that specific provider. + +Consider the following: + +- Never modify ``linux-libc-headers.inc``. Consider that file to be + part of the ``libc`` system, and not something you use to access the + kernel directly. You should access ``libc`` through specific ``libc`` + calls. + +- Applications that must talk directly to devices should either provide + necessary headers themselves, or establish a dependency on a special + headers package that is specific to that driver. + +For example, suppose you want to modify an existing header that adds I/O +control or network support. If the modifications are used by a small +number programs, providing a unique version of a header is easy and has +little impact. When doing so, bear in mind the guidelines in the +previous list. + +.. note:: + + If for some reason your changes need to modify the behavior of the ``libc``, + and subsequently all other applications on the system, use a ``.bbappend`` + to modify the ``linux-kernel-headers.inc`` file. However, take care to not + make the changes machine specific. + +Consider a case where your kernel is older and you need an older +``libc`` ABI. The headers installed by your recipe should still be a +standard mainline kernel, not your own custom one. + +When you use custom kernel headers you need to get them from +:term:`STAGING_KERNEL_DIR`, +which is the directory with kernel headers that are required to build +out-of-tree modules. Your recipe will also need the following:: + + do_configure[depends] += "virtual/kernel:do_shared_workdir" + +Compilation +=========== + +During a build, the :ref:`ref-tasks-compile` task happens after source is fetched, +unpacked, and configured. If the recipe passes through :ref:`ref-tasks-compile` +successfully, nothing needs to be done. + +However, if the compile step fails, you need to diagnose the failure. +Here are some common issues that cause failures. + +.. note:: + + For cases where improper paths are detected for configuration files + or for when libraries/headers cannot be found, be sure you are using + the more robust ``pkg-config``. See the note in section + ":ref:`dev-manual/new-recipe:Configuring the Recipe`" for additional information. + +- *Parallel build failures:* These failures manifest themselves as + intermittent errors, or errors reporting that a file or directory + that should be created by some other part of the build process could + not be found. This type of failure can occur even if, upon + inspection, the file or directory does exist after the build has + failed, because that part of the build process happened in the wrong + order. + + To fix the problem, you need to either satisfy the missing dependency + in the Makefile or whatever script produced the Makefile, or (as a + workaround) set :term:`PARALLEL_MAKE` to an empty string:: + + PARALLEL_MAKE = "" + + For information on parallel Makefile issues, see the + ":ref:`dev-manual/debugging:debugging parallel make races`" section. + +- *Improper host path usage:* This failure applies to recipes building + for the target or ":ref:`ref-classes-nativesdk`" only. The + failure occurs when the compilation process uses improper headers, + libraries, or other files from the host system when cross-compiling for + the target. + + To fix the problem, examine the ``log.do_compile`` file to identify + the host paths being used (e.g. ``/usr/include``, ``/usr/lib``, and + so forth) and then either add configure options, apply a patch, or do + both. + +- *Failure to find required libraries/headers:* If a build-time + dependency is missing because it has not been declared in + :term:`DEPENDS`, or because the + dependency exists but the path used by the build process to find the + file is incorrect and the configure step did not detect it, the + compilation process could fail. For either of these failures, the + compilation process notes that files could not be found. In these + cases, you need to go back and add additional options to the + configure script as well as possibly add additional build-time + dependencies to :term:`DEPENDS`. + + Occasionally, it is necessary to apply a patch to the source to + ensure the correct paths are used. If you need to specify paths to + find files staged into the sysroot from other recipes, use the + variables that the OpenEmbedded build system provides (e.g. + :term:`STAGING_BINDIR`, :term:`STAGING_INCDIR`, :term:`STAGING_DATADIR`, and so + forth). + +Installing +========== + +During :ref:`ref-tasks-install`, the task copies the built files along with their +hierarchy to locations that would mirror their locations on the target +device. The installation process copies files from the +``${``\ :term:`S`\ ``}``, +``${``\ :term:`B`\ ``}``, and +``${``\ :term:`WORKDIR`\ ``}`` +directories to the ``${``\ :term:`D`\ ``}`` +directory to create the structure as it should appear on the target +system. + +How your software is built affects what you must do to be sure your +software is installed correctly. The following list describes what you +must do for installation depending on the type of build system used by +the software being built: + +- *Autotools and CMake:* If the software your recipe is building uses + Autotools or CMake, the OpenEmbedded build system understands how to + install the software. Consequently, you do not have to have a + :ref:`ref-tasks-install` task as part of your recipe. You just need to make + sure the install portion of the build completes with no issues. + However, if you wish to install additional files not already being + installed by ``make install``, you should do this using a + ``do_install:append`` function using the install command as described + in the "Manual" bulleted item later in this list. + +- *Other (using* ``make install``\ *)*: You need to define a :ref:`ref-tasks-install` + function in your recipe. The function should call + ``oe_runmake install`` and will likely need to pass in the + destination directory as well. How you pass that path is dependent on + how the ``Makefile`` being run is written (e.g. ``DESTDIR=${D}``, + ``PREFIX=${D}``, ``INSTALLROOT=${D}``, and so forth). + + For an example recipe using ``make install``, see the + ":ref:`dev-manual/new-recipe:makefile-based package`" section. + +- *Manual:* You need to define a :ref:`ref-tasks-install` function in your + recipe. The function must first use ``install -d`` to create the + directories under + ``${``\ :term:`D`\ ``}``. Once the + directories exist, your function can use ``install`` to manually + install the built software into the directories. + + You can find more information on ``install`` at + https://www.gnu.org/software/coreutils/manual/html_node/install-invocation.html. + +For the scenarios that do not use Autotools or CMake, you need to track +the installation and diagnose and fix any issues until everything +installs correctly. You need to look in the default location of +``${D}``, which is ``${WORKDIR}/image``, to be sure your files have been +installed correctly. + +.. note:: + + - During the installation process, you might need to modify some of + the installed files to suit the target layout. For example, you + might need to replace hard-coded paths in an initscript with + values of variables provided by the build system, such as + replacing ``/usr/bin/`` with ``${bindir}``. If you do perform such + modifications during :ref:`ref-tasks-install`, be sure to modify the + destination file after copying rather than before copying. + Modifying after copying ensures that the build system can + re-execute :ref:`ref-tasks-install` if needed. + + - ``oe_runmake install``, which can be run directly or can be run + indirectly by the :ref:`ref-classes-autotools` and + :ref:`ref-classes-cmake` classes, runs ``make install`` in parallel. + Sometimes, a Makefile can have missing dependencies between targets that + can result in race conditions. If you experience intermittent failures + during :ref:`ref-tasks-install`, you might be able to work around them by + disabling parallel Makefile installs by adding the following to the + recipe:: + + PARALLEL_MAKEINST = "" + + See :term:`PARALLEL_MAKEINST` for additional information. + + - If you need to install one or more custom CMake toolchain files + that are supplied by the application you are building, install the + files to ``${D}${datadir}/cmake/Modules`` during + :ref:`ref-tasks-install`. + +Enabling System Services +======================== + +If you want to install a service, which is a process that usually starts +on boot and runs in the background, then you must include some +additional definitions in your recipe. + +If you are adding services and the service initialization script or the +service file itself is not installed, you must provide for that +installation in your recipe using a ``do_install:append`` function. If +your recipe already has a :ref:`ref-tasks-install` function, update the function +near its end rather than adding an additional ``do_install:append`` +function. + +When you create the installation for your services, you need to +accomplish what is normally done by ``make install``. In other words, +make sure your installation arranges the output similar to how it is +arranged on the target system. + +The OpenEmbedded build system provides support for starting services two +different ways: + +- *SysVinit:* SysVinit is a system and service manager that manages the + init system used to control the very basic functions of your system. + The init program is the first program started by the Linux kernel + when the system boots. Init then controls the startup, running and + shutdown of all other programs. + + To enable a service using SysVinit, your recipe needs to inherit the + :ref:`ref-classes-update-rc.d` class. The class helps + facilitate safely installing the package on the target. + + You will need to set the + :term:`INITSCRIPT_PACKAGES`, + :term:`INITSCRIPT_NAME`, + and + :term:`INITSCRIPT_PARAMS` + variables within your recipe. + +- *systemd:* System Management Daemon (systemd) was designed to replace + SysVinit and to provide enhanced management of services. For more + information on systemd, see the systemd homepage at + https://freedesktop.org/wiki/Software/systemd/. + + To enable a service using systemd, your recipe needs to inherit the + :ref:`ref-classes-systemd` class. See the ``systemd.bbclass`` file + located in your :term:`Source Directory` section for more information. + +Packaging +========= + +Successful packaging is a combination of automated processes performed +by the OpenEmbedded build system and some specific steps you need to +take. The following list describes the process: + +- *Splitting Files*: The :ref:`ref-tasks-package` task splits the files produced + by the recipe into logical components. Even software that produces a + single binary might still have debug symbols, documentation, and + other logical components that should be split out. The :ref:`ref-tasks-package` + task ensures that files are split up and packaged correctly. + +- *Running QA Checks*: The :ref:`ref-classes-insane` class adds a + step to the package generation process so that output quality + assurance checks are generated by the OpenEmbedded build system. This + step performs a range of checks to be sure the build's output is free + of common problems that show up during runtime. For information on + these checks, see the :ref:`ref-classes-insane` class and + the ":ref:`ref-manual/qa-checks:qa error and warning messages`" + chapter in the Yocto Project Reference Manual. + +- *Hand-Checking Your Packages*: After you build your software, you + need to be sure your packages are correct. Examine the + ``${``\ :term:`WORKDIR`\ ``}/packages-split`` + directory and make sure files are where you expect them to be. If you + discover problems, you can set + :term:`PACKAGES`, + :term:`FILES`, + ``do_install(:append)``, and so forth as needed. + +- *Splitting an Application into Multiple Packages*: If you need to + split an application into several packages, see the + ":ref:`dev-manual/new-recipe:splitting an application into multiple packages`" + section for an example. + +- *Installing a Post-Installation Script*: For an example showing how + to install a post-installation script, see the + ":ref:`dev-manual/new-recipe:post-installation scripts`" section. + +- *Marking Package Architecture*: Depending on what your recipe is + building and how it is configured, it might be important to mark the + packages produced as being specific to a particular machine, or to + mark them as not being specific to a particular machine or + architecture at all. + + By default, packages apply to any machine with the same architecture + as the target machine. When a recipe produces packages that are + machine-specific (e.g. the + :term:`MACHINE` value is passed + into the configure script or a patch is applied only for a particular + machine), you should mark them as such by adding the following to the + recipe:: + + PACKAGE_ARCH = "${MACHINE_ARCH}" + + On the other hand, if the recipe produces packages that do not + contain anything specific to the target machine or architecture at + all (e.g. recipes that simply package script files or configuration + files), you should use the :ref:`ref-classes-allarch` class to + do this for you by adding this to your recipe:: + + inherit allarch + + Ensuring that the package architecture is correct is not critical + while you are doing the first few builds of your recipe. However, it + is important in order to ensure that your recipe rebuilds (or does + not rebuild) appropriately in response to changes in configuration, + and to ensure that you get the appropriate packages installed on the + target machine, particularly if you run separate builds for more than + one target machine. + +Sharing Files Between Recipes +============================= + +Recipes often need to use files provided by other recipes on the build +host. For example, an application linking to a common library needs +access to the library itself and its associated headers. The way this +access is accomplished is by populating a sysroot with files. Each +recipe has two sysroots in its work directory, one for target files +(``recipe-sysroot``) and one for files that are native to the build host +(``recipe-sysroot-native``). + +.. note:: + + You could find the term "staging" used within the Yocto project + regarding files populating sysroots (e.g. the :term:`STAGING_DIR` + variable). + +Recipes should never populate the sysroot directly (i.e. write files +into sysroot). Instead, files should be installed into standard +locations during the +:ref:`ref-tasks-install` task within +the ``${``\ :term:`D`\ ``}`` directory. The +reason for this limitation is that almost all files that populate the +sysroot are cataloged in manifests in order to ensure the files can be +removed later when a recipe is either modified or removed. Thus, the +sysroot is able to remain free from stale files. + +A subset of the files installed by the :ref:`ref-tasks-install` task are +used by the :ref:`ref-tasks-populate_sysroot` task as defined by the +:term:`SYSROOT_DIRS` variable to automatically populate the sysroot. It +is possible to modify the list of directories that populate the sysroot. +The following example shows how you could add the ``/opt`` directory to +the list of directories within a recipe:: + + SYSROOT_DIRS += "/opt" + +.. note:: + + The `/sysroot-only` is to be used by recipes that generate artifacts + that are not included in the target filesystem, allowing them to share + these artifacts without needing to use the :term:`DEPLOY_DIR`. + +For a more complete description of the :ref:`ref-tasks-populate_sysroot` +task and its associated functions, see the +:ref:`staging ` class. + +Using Virtual Providers +======================= + +Prior to a build, if you know that several different recipes provide the +same functionality, you can use a virtual provider (i.e. ``virtual/*``) +as a placeholder for the actual provider. The actual provider is +determined at build-time. + +A common scenario where a virtual provider is used would be for the kernel +recipe. Suppose you have three kernel recipes whose :term:`PN` values map to +``kernel-big``, ``kernel-mid``, and ``kernel-small``. Furthermore, each of +these recipes in some way uses a :term:`PROVIDES` statement that essentially +identifies itself as being able to provide ``virtual/kernel``. Here is one way +through the :ref:`ref-classes-kernel` class:: + + PROVIDES += "virtual/kernel" + +Any recipe that inherits the :ref:`ref-classes-kernel` class is +going to utilize a :term:`PROVIDES` statement that identifies that recipe as +being able to provide the ``virtual/kernel`` item. + +Now comes the time to actually build an image and you need a kernel +recipe, but which one? You can configure your build to call out the +kernel recipe you want by using the :term:`PREFERRED_PROVIDER` variable. As +an example, consider the :yocto_git:`x86-base.inc +` include file, which is a +machine (i.e. :term:`MACHINE`) configuration file. This include file is the +reason all x86-based machines use the ``linux-yocto`` kernel. Here are the +relevant lines from the include file:: + + PREFERRED_PROVIDER_virtual/kernel ??= "linux-yocto" + PREFERRED_VERSION_linux-yocto ??= "4.15%" + +When you use a virtual provider, you do not have to "hard code" a recipe +name as a build dependency. You can use the +:term:`DEPENDS` variable to state the +build is dependent on ``virtual/kernel`` for example:: + + DEPENDS = "virtual/kernel" + +During the build, the OpenEmbedded build system picks +the correct recipe needed for the ``virtual/kernel`` dependency based on +the :term:`PREFERRED_PROVIDER` variable. If you want to use the small kernel +mentioned at the beginning of this section, configure your build as +follows:: + + PREFERRED_PROVIDER_virtual/kernel ??= "kernel-small" + +.. note:: + + Any recipe that :term:`PROVIDES` a ``virtual/*`` item that is ultimately not + selected through :term:`PREFERRED_PROVIDER` does not get built. Preventing these + recipes from building is usually the desired behavior since this mechanism's + purpose is to select between mutually exclusive alternative providers. + +The following lists specific examples of virtual providers: + +- ``virtual/kernel``: Provides the name of the kernel recipe to use + when building a kernel image. + +- ``virtual/bootloader``: Provides the name of the bootloader to use + when building an image. + +- ``virtual/libgbm``: Provides ``gbm.pc``. + +- ``virtual/egl``: Provides ``egl.pc`` and possibly ``wayland-egl.pc``. + +- ``virtual/libgl``: Provides ``gl.pc`` (i.e. libGL). + +- ``virtual/libgles1``: Provides ``glesv1_cm.pc`` (i.e. libGLESv1_CM). + +- ``virtual/libgles2``: Provides ``glesv2.pc`` (i.e. libGLESv2). + +.. note:: + + Virtual providers only apply to build time dependencies specified with + :term:`PROVIDES` and :term:`DEPENDS`. They do not apply to runtime + dependencies specified with :term:`RPROVIDES` and :term:`RDEPENDS`. + +Properly Versioning Pre-Release Recipes +======================================= + +Sometimes the name of a recipe can lead to versioning problems when the +recipe is upgraded to a final release. For example, consider the +``irssi_0.8.16-rc1.bb`` recipe file in the list of example recipes in +the ":ref:`dev-manual/new-recipe:storing and naming the recipe`" section. +This recipe is at a release candidate stage (i.e. "rc1"). When the recipe is +released, the recipe filename becomes ``irssi_0.8.16.bb``. The version +change from ``0.8.16-rc1`` to ``0.8.16`` is seen as a decrease by the +build system and package managers, so the resulting packages will not +correctly trigger an upgrade. + +In order to ensure the versions compare properly, the recommended +convention is to set :term:`PV` within the +recipe to "previous_version+current_version". You can use an additional +variable so that you can use the current version elsewhere. Here is an +example:: + + REALPV = "0.8.16-rc1" + PV = "0.8.15+${REALPV}" + +Post-Installation Scripts +========================= + +Post-installation scripts run immediately after installing a package on +the target or during image creation when a package is included in an +image. To add a post-installation script to a package, add a +``pkg_postinst:``\ `PACKAGENAME`\ ``()`` function to the recipe file +(``.bb``) and replace `PACKAGENAME` with the name of the package you want +to attach to the ``postinst`` script. To apply the post-installation +script to the main package for the recipe, which is usually what is +required, specify +``${``\ :term:`PN`\ ``}`` in place of +PACKAGENAME. + +A post-installation function has the following structure:: + + pkg_postinst:PACKAGENAME() { + # Commands to carry out + } + +The script defined in the post-installation function is called when the +root filesystem is created. If the script succeeds, the package is +marked as installed. + +.. note:: + + Any RPM post-installation script that runs on the target should + return a 0 exit code. RPM does not allow non-zero exit codes for + these scripts, and the RPM package manager will cause the package to + fail installation on the target. + +Sometimes it is necessary for the execution of a post-installation +script to be delayed until the first boot. For example, the script might +need to be executed on the device itself. To delay script execution +until boot time, you must explicitly mark post installs to defer to the +target. You can use ``pkg_postinst_ontarget()`` or call +``postinst_intercept delay_to_first_boot`` from ``pkg_postinst()``. Any +failure of a ``pkg_postinst()`` script (including exit 1) triggers an +error during the +:ref:`ref-tasks-rootfs` task. + +If you have recipes that use ``pkg_postinst`` function and they require +the use of non-standard native tools that have dependencies during +root filesystem construction, you need to use the +:term:`PACKAGE_WRITE_DEPS` +variable in your recipe to list these tools. If you do not use this +variable, the tools might be missing and execution of the +post-installation script is deferred until first boot. Deferring the +script to the first boot is undesirable and impossible for read-only +root filesystems. + +.. note:: + + There is equivalent support for pre-install, pre-uninstall, and post-uninstall + scripts by way of ``pkg_preinst``, ``pkg_prerm``, and ``pkg_postrm``, + respectively. These scrips work in exactly the same way as does + ``pkg_postinst`` with the exception that they run at different times. Also, + because of when they run, they are not applicable to being run at image + creation time like ``pkg_postinst``. + +Testing +======= + +The final step for completing your recipe is to be sure that the +software you built runs correctly. To accomplish runtime testing, add +the build's output packages to your image and test them on the target. + +For information on how to customize your image by adding specific +packages, see ":ref:`dev-manual/customizing-images:customizing images`" section. + +Examples +======== + +To help summarize how to write a recipe, this section provides some +examples given various scenarios: + +- Recipes that use local files + +- Using an Autotooled package + +- Using a Makefile-based package + +- Splitting an application into multiple packages + +- Adding binaries to an image + +Single .c File Package (Hello World!) +------------------------------------- + +Building an application from a single file that is stored locally (e.g. +under ``files``) requires a recipe that has the file listed in the +:term:`SRC_URI` variable. Additionally, you need to manually write the +:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The :term:`S` variable defines the +directory containing the source code, which is set to +:term:`WORKDIR` in this case --- the +directory BitBake uses for the build:: + + SUMMARY = "Simple helloworld application" + SECTION = "examples" + LICENSE = "MIT" + LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + + SRC_URI = "file://helloworld.c" + + S = "${WORKDIR}" + + do_compile() { + ${CC} ${LDFLAGS} helloworld.c -o helloworld + } + + do_install() { + install -d ${D}${bindir} + install -m 0755 helloworld ${D}${bindir} + } + +By default, the ``helloworld``, ``helloworld-dbg``, and +``helloworld-dev`` packages are built. For information on how to +customize the packaging process, see the +":ref:`dev-manual/new-recipe:splitting an application into multiple packages`" +section. + +Autotooled Package +------------------ + +Applications that use Autotools such as ``autoconf`` and ``automake`` +require a recipe that has a source archive listed in :term:`SRC_URI` and +also inherit the :ref:`ref-classes-autotools` class, +which contains the definitions of all the steps needed to build an +Autotool-based application. The result of the build is automatically +packaged. And, if the application uses NLS for localization, packages +with local information are generated (one package per language). +Following is one example: (``hello_2.3.bb``):: + + SUMMARY = "GNU Helloworld application" + SECTION = "examples" + LICENSE = "GPL-2.0-or-later" + LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" + + SRC_URI = "${GNU_MIRROR}/hello/hello-${PV}.tar.gz" + + inherit autotools gettext + +The variable :term:`LIC_FILES_CHKSUM` is used to track source license +changes as described in the +":ref:`dev-manual/licenses:tracking license changes`" section in +the Yocto Project Overview and Concepts Manual. You can quickly create +Autotool-based recipes in a manner similar to the previous example. + +Makefile-Based Package +---------------------- + +Applications that use GNU ``make`` also require a recipe that has the +source archive listed in :term:`SRC_URI`. You do not need to add a +:ref:`ref-tasks-compile` step since by default BitBake starts the ``make`` command +to compile the application. If you need additional ``make`` options, you +should store them in the +:term:`EXTRA_OEMAKE` or +:term:`PACKAGECONFIG_CONFARGS` +variables. BitBake passes these options into the GNU ``make`` +invocation. Note that a :ref:`ref-tasks-install` task is still required. +Otherwise, BitBake runs an empty :ref:`ref-tasks-install` task by default. + +Some applications might require extra parameters to be passed to the +compiler. For example, the application might need an additional header +path. You can accomplish this by adding to the :term:`CFLAGS` variable. The +following example shows this:: + + CFLAGS:prepend = "-I ${S}/include " + +In the following example, ``lz4`` is a makefile-based package:: + + SUMMARY = "Extremely Fast Compression algorithm" + DESCRIPTION = "LZ4 is a very fast lossless compression algorithm, providing compression speed at 400 MB/s per core, scalable with multi-cores CPU. It also features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems." + HOMEPAGE = "https://github.com/lz4/lz4" + + LICENSE = "BSD-2-Clause | GPL-2.0-only" + LIC_FILES_CHKSUM = "file://lib/LICENSE;md5=ebc2ea4814a64de7708f1571904b32cc \ + file://programs/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://LICENSE;md5=d57c0d21cb917fb4e0af2454aa48b956 \ + " + + PE = "1" + + SRCREV = "d44371841a2f1728a3f36839fd4b7e872d0927d3" + + SRC_URI = "git://github.com/lz4/lz4.git;branch=release;protocol=https \ + file://CVE-2021-3520.patch \ + " + UPSTREAM_CHECK_GITTAGREGEX = "v(?P.*)" + + S = "${WORKDIR}/git" + + # Fixed in r118, which is larger than the current version. + CVE_CHECK_IGNORE += "CVE-2014-4715" + + EXTRA_OEMAKE = "PREFIX=${prefix} CC='${CC}' CFLAGS='${CFLAGS}' DESTDIR=${D} LIBDIR=${libdir} INCLUDEDIR=${includedir} BUILD_STATIC=no" + + do_install() { + oe_runmake install + } + + BBCLASSEXTEND = "native nativesdk" + +Splitting an Application into Multiple Packages +----------------------------------------------- + +You can use the variables :term:`PACKAGES` and :term:`FILES` to split an +application into multiple packages. + +Following is an example that uses the ``libxpm`` recipe. By default, +this recipe generates a single package that contains the library along +with a few binaries. You can modify the recipe to split the binaries +into separate packages:: + + require xorg-lib-common.inc + + SUMMARY = "Xpm: X Pixmap extension library" + LICENSE = "MIT" + LIC_FILES_CHKSUM = "file://COPYING;md5=51f4270b012ecd4ab1a164f5f4ed6cf7" + DEPENDS += "libxext libsm libxt" + PE = "1" + + XORG_PN = "libXpm" + + PACKAGES =+ "sxpm cxpm" + FILES:cxpm = "${bindir}/cxpm" + FILES:sxpm = "${bindir}/sxpm" + +In the previous example, we want to ship the ``sxpm`` and ``cxpm`` +binaries in separate packages. Since ``bindir`` would be packaged into +the main :term:`PN` package by default, we prepend the :term:`PACKAGES` variable +so additional package names are added to the start of list. This results +in the extra ``FILES:*`` variables then containing information that +define which files and directories go into which packages. Files +included by earlier packages are skipped by latter packages. Thus, the +main :term:`PN` package does not include the above listed files. + +Packaging Externally Produced Binaries +-------------------------------------- + +Sometimes, you need to add pre-compiled binaries to an image. For +example, suppose that there are binaries for proprietary code, +created by a particular division of a company. Your part of the company +needs to use those binaries as part of an image that you are building +using the OpenEmbedded build system. Since you only have the binaries +and not the source code, you cannot use a typical recipe that expects to +fetch the source specified in +:term:`SRC_URI` and then compile it. + +One method is to package the binaries and then install them as part of +the image. Generally, it is not a good idea to package binaries since, +among other things, it can hinder the ability to reproduce builds and +could lead to compatibility problems with ABI in the future. However, +sometimes you have no choice. + +The easiest solution is to create a recipe that uses the +:ref:`ref-classes-bin-package` class and to be sure that you are using default +locations for build artifacts. In most cases, the +:ref:`ref-classes-bin-package` class handles "skipping" the configure and +compile steps as well as sets things up to grab packages from the appropriate +area. In particular, this class sets ``noexec`` on both the +:ref:`ref-tasks-configure` and :ref:`ref-tasks-compile` tasks, sets +``FILES:${PN}`` to "/" so that it picks up all files, and sets up a +:ref:`ref-tasks-install` task, which effectively copies all files from ``${S}`` +to ``${D}``. The :ref:`ref-classes-bin-package` class works well when the files +extracted into ``${S}`` are already laid out in the way they should be laid out +on the target. For more information on these variables, see the :term:`FILES`, +:term:`PN`, :term:`S`, and :term:`D` variables in the Yocto Project Reference +Manual's variable glossary. + +.. note:: + + - Using :term:`DEPENDS` is a good + idea even for components distributed in binary form, and is often + necessary for shared libraries. For a shared library, listing the + library dependencies in :term:`DEPENDS` makes sure that the libraries + are available in the staging sysroot when other recipes link + against the library, which might be necessary for successful + linking. + + - Using :term:`DEPENDS` also allows runtime dependencies between + packages to be added automatically. See the + ":ref:`overview-manual/concepts:automatically added runtime dependencies`" + section in the Yocto Project Overview and Concepts Manual for more + information. + +If you cannot use the :ref:`ref-classes-bin-package` class, you need to be sure you are +doing the following: + +- Create a recipe where the + :ref:`ref-tasks-configure` and + :ref:`ref-tasks-compile` tasks do + nothing: It is usually sufficient to just not define these tasks in + the recipe, because the default implementations do nothing unless a + Makefile is found in + ``${``\ :term:`S`\ ``}``. + + If ``${S}`` might contain a Makefile, or if you inherit some class + that replaces :ref:`ref-tasks-configure` and :ref:`ref-tasks-compile` with custom + versions, then you can use the + ``[``\ :ref:`noexec `\ ``]`` + flag to turn the tasks into no-ops, as follows:: + + do_configure[noexec] = "1" + do_compile[noexec] = "1" + + Unlike + :ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:deleting a task`, + using the flag preserves the dependency chain from the + :ref:`ref-tasks-fetch`, + :ref:`ref-tasks-unpack`, and + :ref:`ref-tasks-patch` tasks to the + :ref:`ref-tasks-install` task. + +- Make sure your :ref:`ref-tasks-install` task installs the binaries + appropriately. + +- Ensure that you set up :term:`FILES` + (usually + ``FILES:${``\ :term:`PN`\ ``}``) to + point to the files you have installed, which of course depends on + where you have installed them and whether those files are in + different locations than the defaults. + +Following Recipe Style Guidelines +================================= + +When writing recipes, it is good to conform to existing style +guidelines. The :oe_wiki:`OpenEmbedded Styleguide ` wiki page +provides rough guidelines for preferred recipe style. + +It is common for existing recipes to deviate a bit from this style. +However, aiming for at least a consistent style is a good idea. Some +practices, such as omitting spaces around ``=`` operators in assignments +or ordering recipe components in an erratic way, are widely seen as poor +style. + +Recipe Syntax +============= + +Understanding recipe file syntax is important for writing recipes. The +following list overviews the basic items that make up a BitBake recipe +file. For more complete BitBake syntax descriptions, see the +":doc:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata`" +chapter of the BitBake User Manual. + +- *Variable Assignments and Manipulations:* Variable assignments allow + a value to be assigned to a variable. The assignment can be static + text or might include the contents of other variables. In addition to + the assignment, appending and prepending operations are also + supported. + + The following example shows some of the ways you can use variables in + recipes:: + + S = "${WORKDIR}/postfix-${PV}" + CFLAGS += "-DNO_ASM" + CFLAGS:append = " --enable-important-feature" + +- *Functions:* Functions provide a series of actions to be performed. + You usually use functions to override the default implementation of a + task function or to complement a default function (i.e. append or + prepend to an existing function). Standard functions use ``sh`` shell + syntax, although access to OpenEmbedded variables and internal + methods are also available. + + Here is an example function from the ``sed`` recipe:: + + do_install () { + autotools_do_install + install -d ${D}${base_bindir} + mv ${D}${bindir}/sed ${D}${base_bindir}/sed + rmdir ${D}${bindir}/ + } + + It is + also possible to implement new functions that are called between + existing tasks as long as the new functions are not replacing or + complementing the default functions. You can implement functions in + Python instead of shell. Both of these options are not seen in the + majority of recipes. + +- *Keywords:* BitBake recipes use only a few keywords. You use keywords + to include common functions (``inherit``), load parts of a recipe + from other files (``include`` and ``require``) and export variables + to the environment (``export``). + + The following example shows the use of some of these keywords:: + + export POSTCONF = "${STAGING_BINDIR}/postconf" + inherit autoconf + require otherfile.inc + +- *Comments (#):* Any lines that begin with the hash character (``#``) + are treated as comment lines and are ignored:: + + # This is a comment + +This next list summarizes the most important and most commonly used +parts of the recipe syntax. For more information on these parts of the +syntax, you can reference the +":doc:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata`" chapter +in the BitBake User Manual. + +- *Line Continuation (\\):* Use the backward slash (``\``) character to + split a statement over multiple lines. Place the slash character at + the end of the line that is to be continued on the next line:: + + VAR = "A really long \ + line" + + .. note:: + + You cannot have any characters including spaces or tabs after the + slash character. + +- *Using Variables (${VARNAME}):* Use the ``${VARNAME}`` syntax to + access the contents of a variable:: + + SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/zlib-${PV}.tar.gz" + + .. note:: + + It is important to understand that the value of a variable + expressed in this form does not get substituted automatically. The + expansion of these expressions happens on-demand later (e.g. + usually when a function that makes reference to the variable + executes). This behavior ensures that the values are most + appropriate for the context in which they are finally used. On the + rare occasion that you do need the variable expression to be + expanded immediately, you can use the + := + operator instead of + = + when you make the assignment, but this is not generally needed. + +- *Quote All Assignments ("value"):* Use double quotes around values in + all variable assignments (e.g. ``"value"``). Following is an example:: + + VAR1 = "${OTHERVAR}" + VAR2 = "The version is ${PV}" + +- *Conditional Assignment (?=):* Conditional assignment is used to + assign a value to a variable, but only when the variable is currently + unset. Use the question mark followed by the equal sign (``?=``) to + make a "soft" assignment used for conditional assignment. Typically, + "soft" assignments are used in the ``local.conf`` file for variables + that are allowed to come through from the external environment. + + Here is an example where ``VAR1`` is set to "New value" if it is + currently empty. However, if ``VAR1`` has already been set, it + remains unchanged:: + + VAR1 ?= "New value" + + In this next example, ``VAR1`` is left with the value "Original value":: + + VAR1 = "Original value" + VAR1 ?= "New value" + +- *Appending (+=):* Use the plus character followed by the equals sign + (``+=``) to append values to existing variables. + + .. note:: + + This operator adds a space between the existing content of the + variable and the new content. + + Here is an example:: + + SRC_URI += "file://fix-makefile.patch" + +- *Prepending (=+):* Use the equals sign followed by the plus character + (``=+``) to prepend values to existing variables. + + .. note:: + + This operator adds a space between the new content and the + existing content of the variable. + + Here is an example:: + + VAR =+ "Starts" + +- *Appending (:append):* Use the ``:append`` operator to append values + to existing variables. This operator does not add any additional + space. Also, the operator is applied after all the ``+=``, and ``=+`` + operators have been applied and after all ``=`` assignments have + occurred. This means that if ``:append`` is used in a recipe, it can + only be overridden by another layer using the special ``:remove`` + operator, which in turn will prevent further layers from adding it back. + + The following example shows the space being explicitly added to the + start to ensure the appended value is not merged with the existing + value:: + + CFLAGS:append = " --enable-important-feature" + + You can also use + the ``:append`` operator with overrides, which results in the actions + only being performed for the specified target or machine:: + + CFLAGS:append:sh4 = " --enable-important-sh4-specific-feature" + +- *Prepending (:prepend):* Use the ``:prepend`` operator to prepend + values to existing variables. This operator does not add any + additional space. Also, the operator is applied after all the ``+=``, + and ``=+`` operators have been applied and after all ``=`` + assignments have occurred. + + The following example shows the space being explicitly added to the + end to ensure the prepended value is not merged with the existing + value:: + + CFLAGS:prepend = "-I${S}/myincludes " + + You can also use the + ``:prepend`` operator with overrides, which results in the actions + only being performed for the specified target or machine:: + + CFLAGS:prepend:sh4 = "-I${S}/myincludes " + +- *Overrides:* You can use overrides to set a value conditionally, + typically based on how the recipe is being built. For example, to set + the :term:`KBRANCH` variable's + value to "standard/base" for any target + :term:`MACHINE`, except for + qemuarm where it should be set to "standard/arm-versatile-926ejs", + you would do the following:: + + KBRANCH = "standard/base" + KBRANCH:qemuarm = "standard/arm-versatile-926ejs" + + Overrides are also used to separate + alternate values of a variable in other situations. For example, when + setting variables such as + :term:`FILES` and + :term:`RDEPENDS` that are + specific to individual packages produced by a recipe, you should + always use an override that specifies the name of the package. + +- *Indentation:* Use spaces for indentation rather than tabs. For + shell functions, both currently work. However, it is a policy + decision of the Yocto Project to use tabs in shell functions. Realize + that some layers have a policy to use spaces for all indentation. + +- *Using Python for Complex Operations:* For more advanced processing, + it is possible to use Python code during variable assignments (e.g. + search and replacement on a variable). + + You indicate Python code using the ``${@python_code}`` syntax for the + variable assignment:: + + SRC_URI = "ftp://ftp.info-zip.org/pub/infozip/src/zip${@d.getVar('PV',1).replace('.', '')}.tgz + +- *Shell Function Syntax:* Write shell functions as if you were writing + a shell script when you describe a list of actions to take. You + should ensure that your script works with a generic ``sh`` and that + it does not require any ``bash`` or other shell-specific + functionality. The same considerations apply to various system + utilities (e.g. ``sed``, ``grep``, ``awk``, and so forth) that you + might wish to use. If in doubt, you should check with multiple + implementations --- including those from BusyBox. + diff --git a/poky/documentation/dev-manual/packages.rst b/poky/documentation/dev-manual/packages.rst new file mode 100644 index 0000000000..0c584c177a --- /dev/null +++ b/poky/documentation/dev-manual/packages.rst @@ -0,0 +1,1250 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Working with Packages +********************* + +This section describes a few tasks that involve packages: + +- :ref:`dev-manual/packages:excluding packages from an image` + +- :ref:`dev-manual/packages:incrementing a package version` + +- :ref:`dev-manual/packages:handling optional module packaging` + +- :ref:`dev-manual/packages:using runtime package management` + +- :ref:`dev-manual/packages:generating and using signed packages` + +- :ref:`Setting up and running package test + (ptest) ` + +- :ref:`dev-manual/packages:creating node package manager (npm) packages` + +- :ref:`dev-manual/packages:adding custom metadata to packages` + +Excluding Packages from an Image +================================ + +You might find it necessary to prevent specific packages from being +installed into an image. If so, you can use several variables to direct +the build system to essentially ignore installing recommended packages +or to not install a package at all. + +The following list introduces variables you can use to prevent packages +from being installed into your image. Each of these variables only works +with IPK and RPM package types, not for Debian packages. +Also, you can use these variables from your ``local.conf`` file +or attach them to a specific image recipe by using a recipe name +override. For more detail on the variables, see the descriptions in the +Yocto Project Reference Manual's glossary chapter. + +- :term:`BAD_RECOMMENDATIONS`: + Use this variable to specify "recommended-only" packages that you do + not want installed. + +- :term:`NO_RECOMMENDATIONS`: + Use this variable to prevent all "recommended-only" packages from + being installed. + +- :term:`PACKAGE_EXCLUDE`: + Use this variable to prevent specific packages from being installed + regardless of whether they are "recommended-only" or not. You need to + realize that the build process could fail with an error when you + prevent the installation of a package whose presence is required by + an installed package. + +Incrementing a Package Version +============================== + +This section provides some background on how binary package versioning +is accomplished and presents some of the services, variables, and +terminology involved. + +In order to understand binary package versioning, you need to consider +the following: + +- Binary Package: The binary package that is eventually built and + installed into an image. + +- Binary Package Version: The binary package version is composed of two + components --- a version and a revision. + + .. note:: + + Technically, a third component, the "epoch" (i.e. :term:`PE`) is involved + but this discussion for the most part ignores :term:`PE`. + + The version and revision are taken from the + :term:`PV` and + :term:`PR` variables, respectively. + +- :term:`PV`: The recipe version. :term:`PV` represents the version of the + software being packaged. Do not confuse :term:`PV` with the binary + package version. + +- :term:`PR`: The recipe revision. + +- :term:`SRCPV`: The OpenEmbedded + build system uses this string to help define the value of :term:`PV` when + the source code revision needs to be included in it. + +- :yocto_wiki:`PR Service `: A + network-based service that helps automate keeping package feeds + compatible with existing package manager applications such as RPM, + APT, and OPKG. + +Whenever the binary package content changes, the binary package version +must change. Changing the binary package version is accomplished by +changing or "bumping" the :term:`PR` and/or :term:`PV` values. Increasing these +values occurs one of two ways: + +- Automatically using a Package Revision Service (PR Service). + +- Manually incrementing the :term:`PR` and/or :term:`PV` variables. + +Given a primary challenge of any build system and its users is how to +maintain a package feed that is compatible with existing package manager +applications such as RPM, APT, and OPKG, using an automated system is +much preferred over a manual system. In either system, the main +requirement is that binary package version numbering increases in a +linear fashion and that there is a number of version components that +support that linear progression. For information on how to ensure +package revisioning remains linear, see the +":ref:`dev-manual/packages:automatically incrementing a package version number`" +section. + +The following three sections provide related information on the PR +Service, the manual method for "bumping" :term:`PR` and/or :term:`PV`, and on +how to ensure binary package revisioning remains linear. + +Working With a PR Service +------------------------- + +As mentioned, attempting to maintain revision numbers in the +:term:`Metadata` is error prone, inaccurate, +and causes problems for people submitting recipes. Conversely, the PR +Service automatically generates increasing numbers, particularly the +revision field, which removes the human element. + +.. note:: + + For additional information on using a PR Service, you can see the + :yocto_wiki:`PR Service ` wiki page. + +The Yocto Project uses variables in order of decreasing priority to +facilitate revision numbering (i.e. +:term:`PE`, +:term:`PV`, and +:term:`PR` for epoch, version, and +revision, respectively). The values are highly dependent on the policies +and procedures of a given distribution and package feed. + +Because the OpenEmbedded build system uses +":ref:`signatures `", which are +unique to a given build, the build system knows when to rebuild +packages. All the inputs into a given task are represented by a +signature, which can trigger a rebuild when different. Thus, the build +system itself does not rely on the :term:`PR`, :term:`PV`, and :term:`PE` numbers to +trigger a rebuild. The signatures, however, can be used to generate +these values. + +The PR Service works with both ``OEBasic`` and ``OEBasicHash`` +generators. The value of :term:`PR` bumps when the checksum changes and the +different generator mechanisms change signatures under different +circumstances. + +As implemented, the build system includes values from the PR Service +into the :term:`PR` field as an addition using the form "``.x``" so ``r0`` +becomes ``r0.1``, ``r0.2`` and so forth. This scheme allows existing +:term:`PR` values to be used for whatever reasons, which include manual +:term:`PR` bumps, should it be necessary. + +By default, the PR Service is not enabled or running. Thus, the packages +generated are just "self consistent". The build system adds and removes +packages and there are no guarantees about upgrade paths but images will +be consistent and correct with the latest changes. + +The simplest form for a PR Service is for a single host development system +that builds the package feed (building system). For this scenario, you can +enable a local PR Service by setting :term:`PRSERV_HOST` in your +``local.conf`` file in the :term:`Build Directory`:: + + PRSERV_HOST = "localhost:0" + +Once the service is started, packages will automatically +get increasing :term:`PR` values and BitBake takes care of starting and +stopping the server. + +If you have a more complex setup where multiple host development systems +work against a common, shared package feed, you have a single PR Service +running and it is connected to each building system. For this scenario, +you need to start the PR Service using the ``bitbake-prserv`` command:: + + bitbake-prserv --host ip --port port --start + +In addition to +hand-starting the service, you need to update the ``local.conf`` file of +each building system as described earlier so each system points to the +server and port. + +It is also recommended you use build history, which adds some sanity +checks to binary package versions, in conjunction with the server that +is running the PR Service. To enable build history, add the following to +each building system's ``local.conf`` file:: + + # It is recommended to activate "buildhistory" for testing the PR service + INHERIT += "buildhistory" + BUILDHISTORY_COMMIT = "1" + +For information on build +history, see the +":ref:`dev-manual/build-quality:maintaining build output quality`" section. + +.. note:: + + The OpenEmbedded build system does not maintain :term:`PR` information as + part of the shared state (sstate) packages. If you maintain an sstate + feed, it's expected that either all your building systems that + contribute to the sstate feed use a shared PR Service, or you do not + run a PR Service on any of your building systems. Having some systems + use a PR Service while others do not leads to obvious problems. + + For more information on shared state, see the + ":ref:`overview-manual/concepts:shared state cache`" + section in the Yocto Project Overview and Concepts Manual. + +Manually Bumping PR +------------------- + +The alternative to setting up a PR Service is to manually "bump" the +:term:`PR` variable. + +If a committed change results in changing the package output, then the +value of the :term:`PR` variable needs to be increased (or "bumped") as part of +that commit. For new recipes you should add the :term:`PR` variable and set +its initial value equal to "r0", which is the default. Even though the +default value is "r0", the practice of adding it to a new recipe makes +it harder to forget to bump the variable when you make changes to the +recipe in future. + +If you are sharing a common ``.inc`` file with multiple recipes, you can +also use the :term:`INC_PR` variable to ensure that the recipes sharing the +``.inc`` file are rebuilt when the ``.inc`` file itself is changed. The +``.inc`` file must set :term:`INC_PR` (initially to "r0"), and all recipes +referring to it should set :term:`PR` to "${INC_PR}.0" initially, +incrementing the last number when the recipe is changed. If the ``.inc`` +file is changed then its :term:`INC_PR` should be incremented. + +When upgrading the version of a binary package, assuming the :term:`PV` +changes, the :term:`PR` variable should be reset to "r0" (or "${INC_PR}.0" +if you are using :term:`INC_PR`). + +Usually, version increases occur only to binary packages. However, if +for some reason :term:`PV` changes but does not increase, you can increase +the :term:`PE` variable (Package Epoch). The :term:`PE` variable defaults to +"0". + +Binary package version numbering strives to follow the `Debian Version +Field Policy +Guidelines `__. +These guidelines define how versions are compared and what "increasing" +a version means. + +Automatically Incrementing a Package Version Number +--------------------------------------------------- + +When fetching a repository, BitBake uses the +:term:`SRCREV` variable to determine +the specific source code revision from which to build. You set the +:term:`SRCREV` variable to +:term:`AUTOREV` to cause the +OpenEmbedded build system to automatically use the latest revision of +the software:: + + SRCREV = "${AUTOREV}" + +Furthermore, you need to reference :term:`SRCPV` in :term:`PV` in order to +automatically update the version whenever the revision of the source +code changes. Here is an example:: + + PV = "1.0+git${SRCPV}" + +The OpenEmbedded build system substitutes :term:`SRCPV` with the following: + +.. code-block:: none + + AUTOINC+source_code_revision + +The build system replaces the ``AUTOINC`` +with a number. The number used depends on the state of the PR Service: + +- If PR Service is enabled, the build system increments the number, + which is similar to the behavior of + :term:`PR`. This behavior results in + linearly increasing package versions, which is desirable. Here is an + example: + + .. code-block:: none + + hello-world-git_0.0+git0+b6558dd387-r0.0_armv7a-neon.ipk + hello-world-git_0.0+git1+dd2f5c3565-r0.0_armv7a-neon.ipk + +- If PR Service is not enabled, the build system replaces the + ``AUTOINC`` placeholder with zero (i.e. "0"). This results in + changing the package version since the source revision is included. + However, package versions are not increased linearly. Here is an + example: + + .. code-block:: none + + hello-world-git_0.0+git0+b6558dd387-r0.0_armv7a-neon.ipk + hello-world-git_0.0+git0+dd2f5c3565-r0.0_armv7a-neon.ipk + +In summary, the OpenEmbedded build system does not track the history of +binary package versions for this purpose. ``AUTOINC``, in this case, is +comparable to :term:`PR`. If PR server is not enabled, ``AUTOINC`` in the +package version is simply replaced by "0". If PR server is enabled, the +build system keeps track of the package versions and bumps the number +when the package revision changes. + +Handling Optional Module Packaging +================================== + +Many pieces of software split functionality into optional modules (or +plugins) and the plugins that are built might depend on configuration +options. To avoid having to duplicate the logic that determines what +modules are available in your recipe or to avoid having to package each +module by hand, the OpenEmbedded build system provides functionality to +handle module packaging dynamically. + +To handle optional module packaging, you need to do two things: + +- Ensure the module packaging is actually done. + +- Ensure that any dependencies on optional modules from other recipes + are satisfied by your recipe. + +Making Sure the Packaging is Done +--------------------------------- + +To ensure the module packaging actually gets done, you use the +``do_split_packages`` function within the ``populate_packages`` Python +function in your recipe. The ``do_split_packages`` function searches for +a pattern of files or directories under a specified path and creates a +package for each one it finds by appending to the +:term:`PACKAGES` variable and +setting the appropriate values for ``FILES:packagename``, +``RDEPENDS:packagename``, ``DESCRIPTION:packagename``, and so forth. +Here is an example from the ``lighttpd`` recipe:: + + python populate_packages:prepend () { + lighttpd_libdir = d.expand('${libdir}') + do_split_packages(d, lighttpd_libdir, '^mod_(.*).so$', + 'lighttpd-module-%s', 'Lighttpd module for %s', + extra_depends='') + } + +The previous example specifies a number of things in the call to +``do_split_packages``. + +- A directory within the files installed by your recipe through + :ref:`ref-tasks-install` in which to search. + +- A regular expression used to match module files in that directory. In + the example, note the parentheses () that mark the part of the + expression from which the module name should be derived. + +- A pattern to use for the package names. + +- A description for each package. + +- An empty string for ``extra_depends``, which disables the default + dependency on the main ``lighttpd`` package. Thus, if a file in + ``${libdir}`` called ``mod_alias.so`` is found, a package called + ``lighttpd-module-alias`` is created for it and the + :term:`DESCRIPTION` is set to + "Lighttpd module for alias". + +Often, packaging modules is as simple as the previous example. However, +there are more advanced options that you can use within +``do_split_packages`` to modify its behavior. And, if you need to, you +can add more logic by specifying a hook function that is called for each +package. It is also perfectly acceptable to call ``do_split_packages`` +multiple times if you have more than one set of modules to package. + +For more examples that show how to use ``do_split_packages``, see the +``connman.inc`` file in the ``meta/recipes-connectivity/connman/`` +directory of the ``poky`` :ref:`source repository `. You can +also find examples in ``meta/classes-recipe/kernel.bbclass``. + +Following is a reference that shows ``do_split_packages`` mandatory and +optional arguments:: + + Mandatory arguments + + root + The path in which to search + file_regex + Regular expression to match searched files. + Use parentheses () to mark the part of this + expression that should be used to derive the + module name (to be substituted where %s is + used in other function arguments as noted below) + output_pattern + Pattern to use for the package names. Must + include %s. + description + Description to set for each package. Must + include %s. + + Optional arguments + + postinst + Postinstall script to use for all packages + (as a string) + recursive + True to perform a recursive search --- default + False + hook + A hook function to be called for every match. + The function will be called with the following + arguments (in the order listed): + + f + Full path to the file/directory match + pkg + The package name + file_regex + As above + output_pattern + As above + modulename + The module name derived using file_regex + extra_depends + Extra runtime dependencies (RDEPENDS) to be + set for all packages. The default value of None + causes a dependency on the main package + (${PN}) --- if you do not want this, pass empty + string '' for this parameter. + aux_files_pattern + Extra item(s) to be added to FILES for each + package. Can be a single string item or a list + of strings for multiple items. Must include %s. + postrm + postrm script to use for all packages (as a + string) + allow_dirs + True to allow directories to be matched - + default False + prepend + If True, prepend created packages to PACKAGES + instead of the default False which appends them + match_path + match file_regex on the whole relative path to + the root rather than just the filename + aux_files_pattern_verbatim + Extra item(s) to be added to FILES for each + package, using the actual derived module name + rather than converting it to something legal + for a package name. Can be a single string item + or a list of strings for multiple items. Must + include %s. + allow_links + True to allow symlinks to be matched --- default + False + summary + Summary to set for each package. Must include %s; + defaults to description if not set. + + + +Satisfying Dependencies +----------------------- + +The second part for handling optional module packaging is to ensure that +any dependencies on optional modules from other recipes are satisfied by +your recipe. You can be sure these dependencies are satisfied by using +the :term:`PACKAGES_DYNAMIC` +variable. Here is an example that continues with the ``lighttpd`` recipe +shown earlier:: + + PACKAGES_DYNAMIC = "lighttpd-module-.*" + +The name +specified in the regular expression can of course be anything. In this +example, it is ``lighttpd-module-`` and is specified as the prefix to +ensure that any :term:`RDEPENDS` and +:term:`RRECOMMENDS` on a package +name starting with the prefix are satisfied during build time. If you +are using ``do_split_packages`` as described in the previous section, +the value you put in :term:`PACKAGES_DYNAMIC` should correspond to the name +pattern specified in the call to ``do_split_packages``. + +Using Runtime Package Management +================================ + +During a build, BitBake always transforms a recipe into one or more +packages. For example, BitBake takes the ``bash`` recipe and produces a +number of packages (e.g. ``bash``, ``bash-bashbug``, +``bash-completion``, ``bash-completion-dbg``, ``bash-completion-dev``, +``bash-completion-extra``, ``bash-dbg``, and so forth). Not all +generated packages are included in an image. + +In several situations, you might need to update, add, remove, or query +the packages on a target device at runtime (i.e. without having to +generate a new image). Examples of such situations include: + +- You want to provide in-the-field updates to deployed devices (e.g. + security updates). + +- You want to have a fast turn-around development cycle for one or more + applications that run on your device. + +- You want to temporarily install the "debug" packages of various + applications on your device so that debugging can be greatly improved + by allowing access to symbols and source debugging. + +- You want to deploy a more minimal package selection of your device + but allow in-the-field updates to add a larger selection for + customization. + +In all these situations, you have something similar to a more +traditional Linux distribution in that in-field devices are able to +receive pre-compiled packages from a server for installation or update. +Being able to install these packages on a running, in-field device is +what is termed "runtime package management". + +In order to use runtime package management, you need a host or server +machine that serves up the pre-compiled packages plus the required +metadata. You also need package manipulation tools on the target. The +build machine is a likely candidate to act as the server. However, that +machine does not necessarily have to be the package server. The build +machine could push its artifacts to another machine that acts as the +server (e.g. Internet-facing). In fact, doing so is advantageous for a +production environment as getting the packages away from the development +system's :term:`Build Directory` prevents accidental overwrites. + +A simple build that targets just one device produces more than one +package database. In other words, the packages produced by a build are +separated out into a couple of different package groupings based on +criteria such as the target's CPU architecture, the target board, or the +C library used on the target. For example, a build targeting the +``qemux86`` device produces the following three package databases: +``noarch``, ``i586``, and ``qemux86``. If you wanted your ``qemux86`` +device to be aware of all the packages that were available to it, you +would need to point it to each of these databases individually. In a +similar way, a traditional Linux distribution usually is configured to +be aware of a number of software repositories from which it retrieves +packages. + +Using runtime package management is completely optional and not required +for a successful build or deployment in any way. But if you want to make +use of runtime package management, you need to do a couple things above +and beyond the basics. The remainder of this section describes what you +need to do. + +Build Considerations +-------------------- + +This section describes build considerations of which you need to be +aware in order to provide support for runtime package management. + +When BitBake generates packages, it needs to know what format or formats +to use. In your configuration, you use the +:term:`PACKAGE_CLASSES` +variable to specify the format: + +#. Open the ``local.conf`` file inside your :term:`Build Directory` (e.g. + ``poky/build/conf/local.conf``). + +#. Select the desired package format as follows:: + + PACKAGE_CLASSES ?= "package_packageformat" + + where packageformat can be "ipk", "rpm", + "deb", or "tar" which are the supported package formats. + + .. note:: + + Because the Yocto Project supports four different package formats, + you can set the variable with more than one argument. However, the + OpenEmbedded build system only uses the first argument when + creating an image or Software Development Kit (SDK). + +If you would like your image to start off with a basic package database +containing the packages in your current build as well as to have the +relevant tools available on the target for runtime package management, +you can include "package-management" in the +:term:`IMAGE_FEATURES` +variable. Including "package-management" in this configuration variable +ensures that when the image is assembled for your target, the image +includes the currently-known package databases as well as the +target-specific tools required for runtime package management to be +performed on the target. However, this is not strictly necessary. You +could start your image off without any databases but only include the +required on-target package tool(s). As an example, you could include +"opkg" in your +:term:`IMAGE_INSTALL` variable +if you are using the IPK package format. You can then initialize your +target's package database(s) later once your image is up and running. + +Whenever you perform any sort of build step that can potentially +generate a package or modify existing package, it is always a good idea +to re-generate the package index after the build by using the following +command:: + + $ bitbake package-index + +It might be tempting to build the +package and the package index at the same time with a command such as +the following:: + + $ bitbake some-package package-index + +Do not do this as +BitBake does not schedule the package index for after the completion of +the package you are building. Consequently, you cannot be sure of the +package index including information for the package you just built. +Thus, be sure to run the package update step separately after building +any packages. + +You can use the +:term:`PACKAGE_FEED_ARCHS`, +:term:`PACKAGE_FEED_BASE_PATHS`, +and +:term:`PACKAGE_FEED_URIS` +variables to pre-configure target images to use a package feed. If you +do not define these variables, then manual steps as described in the +subsequent sections are necessary to configure the target. You should +set these variables before building the image in order to produce a +correctly configured image. + +When your build is complete, your packages reside in the +``${TMPDIR}/deploy/packageformat`` directory. For example, if +``${``\ :term:`TMPDIR`\ ``}`` is +``tmp`` and your selected package type is RPM, then your RPM packages +are available in ``tmp/deploy/rpm``. + +Host or Server Machine Setup +---------------------------- + +Although other protocols are possible, a server using HTTP typically +serves packages. If you want to use HTTP, then set up and configure a +web server such as Apache 2, lighttpd, or Python web server on the +machine serving the packages. + +To keep things simple, this section describes how to set up a +Python web server to share package feeds from the developer's +machine. Although this server might not be the best for a production +environment, the setup is simple and straight forward. Should you want +to use a different server more suited for production (e.g. Apache 2, +Lighttpd, or Nginx), take the appropriate steps to do so. + +From within the :term:`Build Directory` where you have built an image based on +your packaging choice (i.e. the :term:`PACKAGE_CLASSES` setting), simply start +the server. The following example assumes a :term:`Build Directory` of ``poky/build`` +and a :term:`PACKAGE_CLASSES` setting of ":ref:`ref-classes-package_rpm`":: + + $ cd poky/build/tmp/deploy/rpm + $ python3 -m http.server + +Target Setup +------------ + +Setting up the target differs depending on the package management +system. This section provides information for RPM, IPK, and DEB. + +Using RPM +~~~~~~~~~ + +The :wikipedia:`Dandified Packaging ` (DNF) performs +runtime package management of RPM packages. In order to use DNF for +runtime package management, you must perform an initial setup on the +target machine for cases where the ``PACKAGE_FEED_*`` variables were not +set as part of the image that is running on the target. This means if +you built your image and did not use these variables as part of the +build and your image is now running on the target, you need to perform +the steps in this section if you want to use runtime package management. + +.. note:: + + For information on the ``PACKAGE_FEED_*`` variables, see + :term:`PACKAGE_FEED_ARCHS`, :term:`PACKAGE_FEED_BASE_PATHS`, and + :term:`PACKAGE_FEED_URIS` in the Yocto Project Reference Manual variables + glossary. + +On the target, you must inform DNF that package databases are available. +You do this by creating a file named +``/etc/yum.repos.d/oe-packages.repo`` and defining the ``oe-packages``. + +As an example, assume the target is able to use the following package +databases: ``all``, ``i586``, and ``qemux86`` from a server named +``my.server``. The specifics for setting up the web server are up to +you. The critical requirement is that the URIs in the target repository +configuration point to the correct remote location for the feeds. + +.. note:: + + For development purposes, you can point the web server to the build + system's ``deploy`` directory. However, for production use, it is better to + copy the package directories to a location outside of the build area and use + that location. Doing so avoids situations where the build system + overwrites or changes the ``deploy`` directory. + +When telling DNF where to look for the package databases, you must +declare individual locations per architecture or a single location used +for all architectures. You cannot do both: + +- *Create an Explicit List of Architectures:* Define individual base + URLs to identify where each package database is located: + + .. code-block:: none + + [oe-packages] + baseurl=http://my.server/rpm/i586 http://my.server/rpm/qemux86 http://my.server/rpm/all + + This example + informs DNF about individual package databases for all three + architectures. + +- *Create a Single (Full) Package Index:* Define a single base URL that + identifies where a full package database is located:: + + [oe-packages] + baseurl=http://my.server/rpm + + This example informs DNF about a single + package database that contains all the package index information for + all supported architectures. + +Once you have informed DNF where to find the package databases, you need +to fetch them: + +.. code-block:: none + + # dnf makecache + +DNF is now able to find, install, and +upgrade packages from the specified repository or repositories. + +.. note:: + + See the `DNF documentation `__ for + additional information. + +Using IPK +~~~~~~~~~ + +The ``opkg`` application performs runtime package management of IPK +packages. You must perform an initial setup for ``opkg`` on the target +machine if the +:term:`PACKAGE_FEED_ARCHS`, +:term:`PACKAGE_FEED_BASE_PATHS`, +and +:term:`PACKAGE_FEED_URIS` +variables have not been set or the target image was built before the +variables were set. + +The ``opkg`` application uses configuration files to find available +package databases. Thus, you need to create a configuration file inside +the ``/etc/opkg/`` directory, which informs ``opkg`` of any repository +you want to use. + +As an example, suppose you are serving packages from a ``ipk/`` +directory containing the ``i586``, ``all``, and ``qemux86`` databases +through an HTTP server named ``my.server``. On the target, create a +configuration file (e.g. ``my_repo.conf``) inside the ``/etc/opkg/`` +directory containing the following: + +.. code-block:: none + + src/gz all http://my.server/ipk/all + src/gz i586 http://my.server/ipk/i586 + src/gz qemux86 http://my.server/ipk/qemux86 + +Next, instruct ``opkg`` to fetch the +repository information: + +.. code-block:: none + + # opkg update + +The ``opkg`` application is now able to find, install, and upgrade packages +from the specified repository. + +Using DEB +~~~~~~~~~ + +The ``apt`` application performs runtime package management of DEB +packages. This application uses a source list file to find available +package databases. You must perform an initial setup for ``apt`` on the +target machine if the +:term:`PACKAGE_FEED_ARCHS`, +:term:`PACKAGE_FEED_BASE_PATHS`, +and +:term:`PACKAGE_FEED_URIS` +variables have not been set or the target image was built before the +variables were set. + +To inform ``apt`` of the repository you want to use, you might create a +list file (e.g. ``my_repo.list``) inside the +``/etc/apt/sources.list.d/`` directory. As an example, suppose you are +serving packages from a ``deb/`` directory containing the ``i586``, +``all``, and ``qemux86`` databases through an HTTP server named +``my.server``. The list file should contain: + +.. code-block:: none + + deb http://my.server/deb/all ./ + deb http://my.server/deb/i586 ./ + deb http://my.server/deb/qemux86 ./ + +Next, instruct the ``apt`` application +to fetch the repository information: + +.. code-block:: none + + $ sudo apt update + +After this step, +``apt`` is able to find, install, and upgrade packages from the +specified repository. + +Generating and Using Signed Packages +==================================== + +In order to add security to RPM packages used during a build, you can +take steps to securely sign them. Once a signature is verified, the +OpenEmbedded build system can use the package in the build. If security +fails for a signed package, the build system stops the build. + +This section describes how to sign RPM packages during a build and how +to use signed package feeds (repositories) when doing a build. + +Signing RPM Packages +-------------------- + +To enable signing RPM packages, you must set up the following +configurations in either your ``local.config`` or ``distro.config`` +file:: + + # Inherit sign_rpm.bbclass to enable signing functionality + INHERIT += " sign_rpm" + # Define the GPG key that will be used for signing. + RPM_GPG_NAME = "key_name" + # Provide passphrase for the key + RPM_GPG_PASSPHRASE = "passphrase" + +.. note:: + + Be sure to supply appropriate values for both `key_name` and + `passphrase`. + +Aside from the ``RPM_GPG_NAME`` and ``RPM_GPG_PASSPHRASE`` variables in +the previous example, two optional variables related to signing are available: + +- *GPG_BIN:* Specifies a ``gpg`` binary/wrapper that is executed + when the package is signed. + +- *GPG_PATH:* Specifies the ``gpg`` home directory used when the + package is signed. + +Processing Package Feeds +------------------------ + +In addition to being able to sign RPM packages, you can also enable +signed package feeds for IPK and RPM packages. + +The steps you need to take to enable signed package feed use are similar +to the steps used to sign RPM packages. You must define the following in +your ``local.config`` or ``distro.config`` file:: + + INHERIT += "sign_package_feed" + PACKAGE_FEED_GPG_NAME = "key_name" + PACKAGE_FEED_GPG_PASSPHRASE_FILE = "path_to_file_containing_passphrase" + +For signed package feeds, the passphrase must be specified in a separate file, +which is pointed to by the ``PACKAGE_FEED_GPG_PASSPHRASE_FILE`` +variable. Regarding security, keeping a plain text passphrase out of the +configuration is more secure. + +Aside from the ``PACKAGE_FEED_GPG_NAME`` and +``PACKAGE_FEED_GPG_PASSPHRASE_FILE`` variables, three optional variables +related to signed package feeds are available: + +- *GPG_BIN* Specifies a ``gpg`` binary/wrapper that is executed + when the package is signed. + +- *GPG_PATH:* Specifies the ``gpg`` home directory used when the + package is signed. + +- *PACKAGE_FEED_GPG_SIGNATURE_TYPE:* Specifies the type of ``gpg`` + signature. This variable applies only to RPM and IPK package feeds. + Allowable values for the ``PACKAGE_FEED_GPG_SIGNATURE_TYPE`` are + "ASC", which is the default and specifies ascii armored, and "BIN", + which specifies binary. + +Testing Packages With ptest +=========================== + +A Package Test (ptest) runs tests against packages built by the +OpenEmbedded build system on the target machine. A ptest contains at +least two items: the actual test, and a shell script (``run-ptest``) +that starts the test. The shell script that starts the test must not +contain the actual test --- the script only starts the test. On the other +hand, the test can be anything from a simple shell script that runs a +binary and checks the output to an elaborate system of test binaries and +data files. + +The test generates output in the format used by Automake:: + + result: testname + +where the result can be ``PASS``, ``FAIL``, or ``SKIP``, and +the testname can be any identifying string. + +For a list of Yocto Project recipes that are already enabled with ptest, +see the :yocto_wiki:`Ptest ` wiki page. + +.. note:: + + A recipe is "ptest-enabled" if it inherits the :ref:`ref-classes-ptest` + class. + +Adding ptest to Your Build +-------------------------- + +To add package testing to your build, add the :term:`DISTRO_FEATURES` and +:term:`EXTRA_IMAGE_FEATURES` variables to your ``local.conf`` file, which +is found in the :term:`Build Directory`:: + + DISTRO_FEATURES:append = " ptest" + EXTRA_IMAGE_FEATURES += "ptest-pkgs" + +Once your build is complete, the ptest files are installed into the +``/usr/lib/package/ptest`` directory within the image, where ``package`` +is the name of the package. + +Running ptest +------------- + +The ``ptest-runner`` package installs a shell script that loops through +all installed ptest test suites and runs them in sequence. Consequently, +you might want to add this package to your image. + +Getting Your Package Ready +-------------------------- + +In order to enable a recipe to run installed ptests on target hardware, +you need to prepare the recipes that build the packages you want to +test. Here is what you have to do for each recipe: + +- *Be sure the recipe inherits the* :ref:`ref-classes-ptest` *class:* + Include the following line in each recipe:: + + inherit ptest + +- *Create run-ptest:* This script starts your test. Locate the + script where you will refer to it using + :term:`SRC_URI`. Here is an + example that starts a test for ``dbus``:: + + #!/bin/sh + cd test + make -k runtest-TESTS + +- *Ensure dependencies are met:* If the test adds build or runtime + dependencies that normally do not exist for the package (such as + requiring "make" to run the test suite), use the + :term:`DEPENDS` and + :term:`RDEPENDS` variables in + your recipe in order for the package to meet the dependencies. Here + is an example where the package has a runtime dependency on "make":: + + RDEPENDS:${PN}-ptest += "make" + +- *Add a function to build the test suite:* Not many packages support + cross-compilation of their test suites. Consequently, you usually + need to add a cross-compilation function to the package. + + Many packages based on Automake compile and run the test suite by + using a single command such as ``make check``. However, the host + ``make check`` builds and runs on the same computer, while + cross-compiling requires that the package is built on the host but + executed for the target architecture (though often, as in the case + for ptest, the execution occurs on the host). The built version of + Automake that ships with the Yocto Project includes a patch that + separates building and execution. Consequently, packages that use the + unaltered, patched version of ``make check`` automatically + cross-compiles. + + Regardless, you still must add a ``do_compile_ptest`` function to + build the test suite. Add a function similar to the following to your + recipe:: + + do_compile_ptest() { + oe_runmake buildtest-TESTS + } + +- *Ensure special configurations are set:* If the package requires + special configurations prior to compiling the test code, you must + insert a ``do_configure_ptest`` function into the recipe. + +- *Install the test suite:* The :ref:`ref-classes-ptest` class + automatically copies the file ``run-ptest`` to the target and then runs make + ``install-ptest`` to run the tests. If this is not enough, you need + to create a ``do_install_ptest`` function and make sure it gets + called after the "make install-ptest" completes. + +Creating Node Package Manager (NPM) Packages +============================================ + +:wikipedia:`NPM ` is a package +manager for the JavaScript programming language. The Yocto Project +supports the NPM :ref:`fetcher `. You can +use this fetcher in combination with +:doc:`devtool ` to create +recipes that produce NPM packages. + +There are two workflows that allow you to create NPM packages using +``devtool``: the NPM registry modules method and the NPM project code +method. + +.. note:: + + While it is possible to create NPM recipes manually, using + ``devtool`` is far simpler. + +Additionally, some requirements and caveats exist. + +Requirements and Caveats +------------------------ + +You need to be aware of the following before using ``devtool`` to create +NPM packages: + +- Of the two methods that you can use ``devtool`` to create NPM + packages, the registry approach is slightly simpler. However, you + might consider the project approach because you do not have to + publish your module in the `NPM registry `__, + which is NPM's public registry. + +- Be familiar with + :doc:`devtool `. + +- The NPM host tools need the native ``nodejs-npm`` package, which is + part of the OpenEmbedded environment. You need to get the package by + cloning the :oe_git:`meta-openembedded ` + repository. Be sure to add the path to your local copy + to your ``bblayers.conf`` file. + +- ``devtool`` cannot detect native libraries in module dependencies. + Consequently, you must manually add packages to your recipe. + +- While deploying NPM packages, ``devtool`` cannot determine which + dependent packages are missing on the target (e.g. the node runtime + ``nodejs``). Consequently, you need to find out what files are + missing and be sure they are on the target. + +- Although you might not need NPM to run your node package, it is + useful to have NPM on your target. The NPM package name is + ``nodejs-npm``. + +Using the Registry Modules Method +--------------------------------- + +This section presents an example that uses the ``cute-files`` module, +which is a file browser web application. + +.. note:: + + You must know the ``cute-files`` module version. + +The first thing you need to do is use ``devtool`` and the NPM fetcher to +create the recipe:: + + $ devtool add "npm://registry.npmjs.org;package=cute-files;version=1.0.2" + +The +``devtool add`` command runs ``recipetool create`` and uses the same +fetch URI to download each dependency and capture license details where +possible. The result is a generated recipe. + +After running for quite a long time, in particular building the +``nodejs-native`` package, the command should end as follows:: + + INFO: Recipe /home/.../build/workspace/recipes/cute-files/cute-files_1.0.2.bb has been automatically created; further editing may be required to make it fully functional + +The recipe file is fairly simple and contains every license that +``recipetool`` finds and includes the licenses in the recipe's +:term:`LIC_FILES_CHKSUM` +variables. You need to examine the variables and look for those with +"unknown" in the :term:`LICENSE` +field. You need to track down the license information for "unknown" +modules and manually add the information to the recipe. + +``recipetool`` creates a "shrinkwrap" file for your recipe. Shrinkwrap +files capture the version of all dependent modules. Many packages do not +provide shrinkwrap files but ``recipetool`` will create a shrinkwrap file as it +runs. + +.. note:: + + A package is created for each sub-module. This policy is the only + practical way to have the licenses for all of the dependencies + represented in the license manifest of the image. + +The ``devtool edit-recipe`` command lets you take a look at the recipe:: + + $ devtool edit-recipe cute-files + # Recipe created by recipetool + # This is the basis of a recipe and may need further editing in order to be fully functional. + # (Feel free to remove these comments when editing.) + + SUMMARY = "Turn any folder on your computer into a cute file browser, available on the local network." + # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is + # your responsibility to verify that the values are complete and correct. + # + # NOTE: multiple licenses have been detected; they have been separated with & + # in the LICENSE value for now since it is a reasonable assumption that all + # of the licenses apply. If instead there is a choice between the multiple + # licenses then you should change the value to separate the licenses with | + # instead of &. If there is any doubt, check the accompanying documentation + # to determine which situation is applicable. + + SUMMARY = "Turn any folder on your computer into a cute file browser, available on the local network." + LICENSE = "BSD-3-Clause & ISC & MIT" + LIC_FILES_CHKSUM = "file://LICENSE;md5=71d98c0a1db42956787b1909c74a86ca \ + file://node_modules/accepts/LICENSE;md5=bf1f9ad1e2e1d507aef4883fff7103de \ + file://node_modules/array-flatten/LICENSE;md5=44088ba57cb871a58add36ce51b8de08 \ + ... + file://node_modules/cookie-signature/Readme.md;md5=57ae8b42de3dd0c1f22d5f4cf191e15a" + + SRC_URI = " \ + npm://registry.npmjs.org/;package=cute-files;version=${PV} \ + npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ + " + + S = "${WORKDIR}/npm" + + inherit npm + + LICENSE:${PN} = "MIT" + LICENSE:${PN}-accepts = "MIT" + LICENSE:${PN}-array-flatten = "MIT" + ... + LICENSE:${PN}-vary = "MIT" + +Here are three key points in the previous example: + +- :term:`SRC_URI` uses the NPM + scheme so that the NPM fetcher is used. + +- ``recipetool`` collects all the license information. If a + sub-module's license is unavailable, the sub-module's name appears in + the comments. + +- The ``inherit npm`` statement causes the :ref:`ref-classes-npm` class to + package up all the modules. + +You can run the following command to build the ``cute-files`` package:: + + $ devtool build cute-files + +Remember that ``nodejs`` must be installed on +the target before your package. + +Assuming 192.168.7.2 for the target's IP address, use the following +command to deploy your package:: + + $ devtool deploy-target -s cute-files root@192.168.7.2 + +Once the package is installed on the target, you can +test the application to show the contents of any directory:: + + $ cd /usr/lib/node_modules/cute-files + $ cute-files + +On a browser, +go to ``http://192.168.7.2:3000`` and you see the following: + +.. image:: figures/cute-files-npm-example.png + :width: 100% + +You can find the recipe in ``workspace/recipes/cute-files``. You can use +the recipe in any layer you choose. + +Using the NPM Projects Code Method +---------------------------------- + +Although it is useful to package modules already in the NPM registry, +adding ``node.js`` projects under development is a more common developer +use case. + +This section covers the NPM projects code method, which is very similar +to the "registry" approach described in the previous section. In the NPM +projects method, you provide ``devtool`` with an URL that points to the +source files. + +Replicating the same example, (i.e. ``cute-files``) use the following +command:: + + $ devtool add https://github.com/martinaglv/cute-files.git + +The recipe this command generates is very similar to the recipe created in +the previous section. However, the :term:`SRC_URI` looks like the following:: + + SRC_URI = " \ + git://github.com/martinaglv/cute-files.git;protocol=https;branch=master \ + npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ + " + +In this example, +the main module is taken from the Git repository and dependencies are +taken from the NPM registry. Other than those differences, the recipe is +basically the same between the two methods. You can build and deploy the +package exactly as described in the previous section that uses the +registry modules method. + +Adding custom metadata to packages +================================== + +The variable +:term:`PACKAGE_ADD_METADATA` +can be used to add additional metadata to packages. This is reflected in +the package control/spec file. To take the ipk format for example, the +CONTROL file stored inside would contain the additional metadata as +additional lines. + +The variable can be used in multiple ways, including using suffixes to +set it for a specific package type and/or package. Note that the order +of precedence is the same as this list: + +- ``PACKAGE_ADD_METADATA_:`` + +- ``PACKAGE_ADD_METADATA_`` + +- ``PACKAGE_ADD_METADATA:`` + +- :term:`PACKAGE_ADD_METADATA` + +`` is a parameter and expected to be a distinct name of specific +package type: + +- IPK for .ipk packages + +- DEB for .deb packages + +- RPM for .rpm packages + +`` is a parameter and expected to be a package name. + +The variable can contain multiple [one-line] metadata fields separated +by the literal sequence '\\n'. The separator can be redefined using the +variable flag ``separator``. + +Here is an example that adds two custom fields for ipk +packages:: + + PACKAGE_ADD_METADATA_IPK = "Vendor: CustomIpk\nGroup:Applications/Spreadsheets" + diff --git a/poky/documentation/dev-manual/prebuilt-libraries.rst b/poky/documentation/dev-manual/prebuilt-libraries.rst new file mode 100644 index 0000000000..ca43463820 --- /dev/null +++ b/poky/documentation/dev-manual/prebuilt-libraries.rst @@ -0,0 +1,209 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Working with Pre-Built Libraries +******************************** + +Introduction +============ + +Some library vendors do not release source code for their software but do +release pre-built binaries. When shared libraries are built, they should +be versioned (see `this article +`__ +for some background), but sometimes this is not done. + +To summarize, a versioned library must meet two conditions: + +#. The filename must have the version appended, for example: ``libfoo.so.1.2.3``. +#. The library must have the ELF tag ``SONAME`` set to the major version + of the library, for example: ``libfoo.so.1``. You can check this by + running ``readelf -d filename | grep SONAME``. + +This section shows how to deal with both versioned and unversioned +pre-built libraries. + +Versioned Libraries +=================== + +In this example we work with pre-built libraries for the FT4222H USB I/O chip. +Libraries are built for several target architecture variants and packaged in +an archive as follows:: + + ├── build-arm-hisiv300 + │   └── libft4222.so.1.4.4.44 + ├── build-arm-v5-sf + │   └── libft4222.so.1.4.4.44 + ├── build-arm-v6-hf + │   └── libft4222.so.1.4.4.44 + ├── build-arm-v7-hf + │   └── libft4222.so.1.4.4.44 + ├── build-arm-v8 + │   └── libft4222.so.1.4.4.44 + ├── build-i386 + │   └── libft4222.so.1.4.4.44 + ├── build-i486 + │   └── libft4222.so.1.4.4.44 + ├── build-mips-eglibc-hf + │   └── libft4222.so.1.4.4.44 + ├── build-pentium + │   └── libft4222.so.1.4.4.44 + ├── build-x86_64 + │   └── libft4222.so.1.4.4.44 + ├── examples + │   ├── get-version.c + │   ├── i2cm.c + │   ├── spim.c + │   └── spis.c + ├── ftd2xx.h + ├── install4222.sh + ├── libft4222.h + ├── ReadMe.txt + └── WinTypes.h + +To write a recipe to use such a library in your system: + +- The vendor will probably have a proprietary licence, so set + :term:`LICENSE_FLAGS` in your recipe. +- The vendor provides a tarball containing libraries so set :term:`SRC_URI` + appropriately. +- Set :term:`COMPATIBLE_HOST` so that the recipe cannot be used with an + unsupported architecture. In the following example, we only support the 32 + and 64 bit variants of the ``x86`` architecture. +- As the vendor provides versioned libraries, we can use ``oe_soinstall`` + from :ref:`ref-classes-utils` to install the shared library and create + symbolic links. If the vendor does not do this, we need to follow the + non-versioned library guidelines in the next section. +- As the vendor likely used :term:`LDFLAGS` different from those in your Yocto + Project build, disable the corresponding checks by adding ``ldflags`` + to :term:`INSANE_SKIP`. +- The vendor will typically ship release builds without debugging symbols. + Avoid errors by preventing the packaging task from stripping out the symbols + and adding them to a separate debug package. This is done by setting the + ``INHIBIT_`` flags shown below. + +The complete recipe would look like this:: + + SUMMARY = "FTDI FT4222H Library" + SECTION = "libs" + LICENSE_FLAGS = "ftdi" + LICENSE = "CLOSED" + + COMPATIBLE_HOST = "(i.86|x86_64).*-linux" + + # Sources available in a .tgz file in .zip archive + # at https://ftdichip.com/wp-content/uploads/2021/01/libft4222-linux-1.4.4.44.zip + # Found on https://ftdichip.com/software-examples/ft4222h-software-examples/ + # Since dealing with this particular type of archive is out of topic here, + # we use a local link. + SRC_URI = "file://libft4222-linux-${PV}.tgz" + + S = "${WORKDIR}" + + ARCH_DIR:x86-64 = "build-x86_64" + ARCH_DIR:i586 = "build-i386" + ARCH_DIR:i686 = "build-i386" + + INSANE_SKIP:${PN} = "ldflags" + INHIBIT_PACKAGE_STRIP = "1" + INHIBIT_SYSROOT_STRIP = "1" + INHIBIT_PACKAGE_DEBUG_SPLIT = "1" + + do_install () { + install -m 0755 -d ${D}${libdir} + oe_soinstall ${S}/${ARCH_DIR}/libft4222.so.${PV} ${D}${libdir} + install -d ${D}${includedir} + install -m 0755 ${S}/*.h ${D}${includedir} + } + +If the precompiled binaries are not statically linked and have dependencies on +other libraries, then by adding those libraries to :term:`DEPENDS`, the linking +can be examined and the appropriate :term:`RDEPENDS` automatically added. + +Non-Versioned Libraries +======================= + +Some Background +--------------- + +Libraries in Linux systems are generally versioned so that it is possible +to have multiple versions of the same library installed, which eases upgrades +and support for older software. For example, suppose that in a versioned +library, an actual library is called ``libfoo.so.1.2``, a symbolic link named +``libfoo.so.1`` points to ``libfoo.so.1.2``, and a symbolic link named +``libfoo.so`` points to ``libfoo.so.1.2``. Given these conditions, when you +link a binary against a library, you typically provide the unversioned file +name (i.e. ``-lfoo`` to the linker). However, the linker follows the symbolic +link and actually links against the versioned filename. The unversioned symbolic +link is only used at development time. Consequently, the library is packaged +along with the headers in the development package ``${PN}-dev`` along with the +actual library and versioned symbolic links in ``${PN}``. Because versioned +libraries are far more common than unversioned libraries, the default packaging +rules assume versioned libraries. + +Yocto Library Packaging Overview +-------------------------------- + +It follows that packaging an unversioned library requires a bit of work in the +recipe. By default, ``libfoo.so`` gets packaged into ``${PN}-dev``, which +triggers a QA warning that a non-symlink library is in a ``-dev`` package, +and binaries in the same recipe link to the library in ``${PN}-dev``, +which triggers more QA warnings. To solve this problem, you need to package the +unversioned library into ``${PN}`` where it belongs. The following are the abridged +default :term:`FILES` variables in ``bitbake.conf``:: + + SOLIBS = ".so.*" + SOLIBSDEV = ".so" + FILES_${PN} = "... ${libdir}/lib*${SOLIBS} ..." + FILES_SOLIBSDEV ?= "... ${libdir}/lib*${SOLIBSDEV} ..." + FILES_${PN}-dev = "... ${FILES_SOLIBSDEV} ..." + +:term:`SOLIBS` defines a pattern that matches real shared object libraries. +:term:`SOLIBSDEV` matches the development form (unversioned symlink). These two +variables are then used in ``FILES:${PN}`` and ``FILES:${PN}-dev``, which puts +the real libraries into ``${PN}`` and the unversioned symbolic link into ``${PN}-dev``. +To package unversioned libraries, you need to modify the variables in the recipe +as follows:: + + SOLIBS = ".so" + FILES_SOLIBSDEV = "" + +The modifications cause the ``.so`` file to be the real library +and unset :term:`FILES_SOLIBSDEV` so that no libraries get packaged into +``${PN}-dev``. The changes are required because unless :term:`PACKAGES` is changed, +``${PN}-dev`` collects files before `${PN}`. ``${PN}-dev`` must not collect any of +the files you want in ``${PN}``. + +Finally, loadable modules, essentially unversioned libraries that are linked +at runtime using ``dlopen()`` instead of at build time, should generally be +installed in a private directory. However, if they are installed in ``${libdir}``, +then the modules can be treated as unversioned libraries. + +Example +------- + +The example below installs an unversioned x86-64 pre-built library named +``libfoo.so``. The :term:`COMPATIBLE_HOST` variable limits recipes to the +x86-64 architecture while the :term:`INSANE_SKIP`, :term:`INHIBIT_PACKAGE_STRIP` +and :term:`INHIBIT_SYSROOT_STRIP` variables are all set as in the above +versioned library example. The "magic" is setting the :term:`SOLIBS` and +:term:`FILES_SOLIBSDEV` variables as explained above:: + + SUMMARY = "libfoo sample recipe" + SECTION = "libs" + LICENSE = "CLOSED" + + SRC_URI = "file://libfoo.so" + + COMPATIBLE_HOST = "x86_64.*-linux" + + INSANE_SKIP:${PN} = "ldflags" + INHIBIT_PACKAGE_STRIP = "1" + INHIBIT_SYSROOT_STRIP = "1" + SOLIBS = ".so" + FILES_SOLIBSDEV = "" + + do_install () { + install -d ${D}${libdir} + install -m 0755 ${WORKDIR}/libfoo.so ${D}${libdir} + } + diff --git a/poky/documentation/dev-manual/python-development-shell.rst b/poky/documentation/dev-manual/python-development-shell.rst new file mode 100644 index 0000000000..1b213318a5 --- /dev/null +++ b/poky/documentation/dev-manual/python-development-shell.rst @@ -0,0 +1,50 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Using a Python Development Shell +******************************** + +Similar to working within a development shell as described in the +previous section, you can also spawn and work within an interactive +Python development shell. When debugging certain commands or even when +just editing packages, ``pydevshell`` can be a useful tool. When you +invoke the ``pydevshell`` task, all tasks up to and including +:ref:`ref-tasks-patch` are run for the +specified target. Then a new terminal is opened. Additionally, key +Python objects and code are available in the same way they are to +BitBake tasks, in particular, the data store 'd'. So, commands such as +the following are useful when exploring the data store and running +functions:: + + pydevshell> d.getVar("STAGING_DIR") + '/media/build1/poky/build/tmp/sysroots' + pydevshell> d.getVar("STAGING_DIR", False) + '${TMPDIR}/sysroots' + pydevshell> d.setVar("FOO", "bar") + pydevshell> d.getVar("FOO") + 'bar' + pydevshell> d.delVar("FOO") + pydevshell> d.getVar("FOO") + pydevshell> bb.build.exec_func("do_unpack", d) + pydevshell> + +See the ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:functions you can call from within python`" +section in the BitBake User Manual for details about available functions. + +The commands execute just as if the OpenEmbedded build +system were executing them. Consequently, working this way can be +helpful when debugging a build or preparing software to be used with the +OpenEmbedded build system. + +Following is an example that uses ``pydevshell`` on a target named +``matchbox-desktop``:: + + $ bitbake matchbox-desktop -c pydevshell + +This command spawns a terminal and places you in an interactive Python +interpreter within the OpenEmbedded build environment. The +:term:`OE_TERMINAL` variable +controls what type of shell is opened. + +When you are finished using ``pydevshell``, you can exit the shell +either by using Ctrl+d or closing the terminal window. + diff --git a/poky/documentation/dev-manual/qemu.rst b/poky/documentation/dev-manual/qemu.rst index d9b9f69ab3..d431ea4b99 100644 --- a/poky/documentation/dev-manual/qemu.rst +++ b/poky/documentation/dev-manual/qemu.rst @@ -44,13 +44,13 @@ To use QEMU, you need to have QEMU installed and initialized as well as have the proper artifacts (i.e. image files and root filesystems) available. Follow these general steps to run QEMU: -1. *Install QEMU:* QEMU is made available with the Yocto Project a +#. *Install QEMU:* QEMU is made available with the Yocto Project a number of ways. One method is to install a Software Development Kit (SDK). See ":ref:`sdk-manual/intro:the qemu emulator`" section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual for information on how to install QEMU. -2. *Setting Up the Environment:* How you set up the QEMU environment +#. *Setting Up the Environment:* How you set up the QEMU environment depends on how you installed QEMU: - If you cloned the ``poky`` repository or you downloaded and @@ -66,7 +66,7 @@ available. Follow these general steps to run QEMU: . poky_sdk/environment-setup-core2-64-poky-linux -3. *Ensure the Artifacts are in Place:* You need to be sure you have a +#. *Ensure the Artifacts are in Place:* You need to be sure you have a pre-built kernel that will boot in QEMU. You also need the target root filesystem for your target machine's architecture: @@ -84,7 +84,7 @@ available. Follow these general steps to run QEMU: Extensible Software Development Kit (eSDK) manual for information on how to extract a root filesystem. -4. *Run QEMU:* The basic ``runqemu`` command syntax is as follows:: +#. *Run QEMU:* The basic ``runqemu`` command syntax is as follows:: $ runqemu [option ] [...] @@ -103,7 +103,9 @@ available. Follow these general steps to run QEMU: automatically finds the ``bzImage-qemux86-64.bin`` image file and the ``core-image-minimal-qemux86-64-20200218002850.rootfs.ext4`` (assuming the current build created a ``core-image-minimal`` - image). + image):: + + $ runqemu qemux86-64 .. note:: @@ -111,14 +113,9 @@ available. Follow these general steps to run QEMU: and uses the most recently built image according to the timestamp. - :: - - $ runqemu qemux86-64 - - This example produces the exact same results as the previous example. This command, however, specifically provides the image - and root filesystem type. - :: + and root filesystem type:: $ runqemu qemux86-64 core-image-minimal ext4 @@ -127,23 +124,20 @@ available. Follow these general steps to run QEMU: variable ``FSTYPE`` to ``cpio.gz``. Also, for audio to be enabled, an appropriate driver must be installed (see the ``audio`` option in :ref:`dev-manual/qemu:\`\`runqemu\`\` command-line options` - for more information). - :: + for more information):: $ runqemu qemux86-64 ramfs audio - This example does not provide enough information for QEMU to launch. While the command does provide a root filesystem type, it - must also minimally provide a `MACHINE`, `KERNEL`, or `VM` option. - :: + must also minimally provide a `MACHINE`, `KERNEL`, or `VM` option:: $ runqemu ext4 - This example specifies to boot a virtual machine image (``.wic.vmdk`` file). From the ``.wic.vmdk``, ``runqemu`` determines the QEMU architecture (`MACHINE`) to be "qemux86-64" and - the root filesystem type to be "vmdk". - :: + the root filesystem type to be "vmdk":: $ runqemu /home/scott-lenovo/vm/core-image-minimal-qemux86-64.wic.vmdk @@ -190,7 +184,7 @@ the system does not need root privileges to run. It uses a user space NFS server to avoid that. Follow these steps to set up for running QEMU using an NFS server. -1. *Extract a Root Filesystem:* Once you are able to run QEMU in your +#. *Extract a Root Filesystem:* Once you are able to run QEMU in your environment, you can use the ``runqemu-extract-sdk`` script, which is located in the ``scripts`` directory along with the ``runqemu`` script. @@ -204,7 +198,7 @@ using an NFS server. runqemu-extract-sdk ./tmp/deploy/images/qemux86-64/core-image-sato-qemux86-64.tar.bz2 test-nfs -2. *Start QEMU:* Once you have extracted the file system, you can run +#. *Start QEMU:* Once you have extracted the file system, you can run ``runqemu`` normally with the additional location of the file system. You can then also make changes to the files within ``./test-nfs`` and see those changes appear in the image in real time. Here is an @@ -329,7 +323,7 @@ Following is the command-line help output for the ``runqemu`` command:: Simplified QEMU command-line options can be passed with: nographic - disable video console serial - enable a serial console on /dev/ttyS0 - slirp - enable user networking, no root privileges is required + slirp - enable user networking, no root privileges required kvm - enable KVM when running x86/x86_64 (VT-capable CPU required) kvm-vhost - enable KVM with vhost when running x86/x86_64 (VT-capable CPU required) publicvnc - enable a VNC server open to all hosts @@ -427,6 +421,29 @@ command line: networking that does not need root access but also is not as easy to use or comprehensive as the default. + Using ``slirp`` by default will forward the guest machine's + 22 and 23 TCP ports to host machine's 2222 and 2323 ports + (or the next free ports). Specific forwarding rules can be configured + by setting ``QB_SLIRP_OPT`` as environment variable or in ``qemuboot.conf`` + in the :term:`Build Directory` ``deploy/image`` directory. + Examples:: + + QB_SLIRP_OPT="-netdev user,id=net0,hostfwd=tcp::8080-:80" + + QB_SLIRP_OPT="-netdev user,id=net0,hostfwd=tcp::8080-:80,hostfwd=tcp::2222-:22" + + The first example forwards TCP port 80 from the emulated system to + port 8080 (or the next free port) on the host system, + allowing access to an http server running in QEMU from + ``http://:8080/``. + + The second example does the same, but also forwards TCP port 22 on the + guest system to 2222 (or the next free port) on the host system, + allowing ssh access to the emulated system using + ``ssh -P 2222 @``. + + Keep in mind that proper configuration of firewall software is required. + - ``kvm``: Enables KVM when running "qemux86" or "qemux86-64" QEMU architectures. For KVM to work, all the following conditions must be met: diff --git a/poky/documentation/dev-manual/quilt.rst b/poky/documentation/dev-manual/quilt.rst new file mode 100644 index 0000000000..59240705ad --- /dev/null +++ b/poky/documentation/dev-manual/quilt.rst @@ -0,0 +1,89 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Using Quilt in Your Workflow +**************************** + +`Quilt `__ is a powerful tool +that allows you to capture source code changes without having a clean +source tree. This section outlines the typical workflow you can use to +modify source code, test changes, and then preserve the changes in the +form of a patch all using Quilt. + +.. note:: + + With regard to preserving changes to source files, if you clean a + recipe or have :ref:`ref-classes-rm-work` enabled, the + :ref:`devtool workflow ` + as described in the Yocto Project Application Development and the + Extensible Software Development Kit (eSDK) manual is a safer + development flow than the flow that uses Quilt. + +Follow these general steps: + +#. *Find the Source Code:* Temporary source code used by the + OpenEmbedded build system is kept in the :term:`Build Directory`. See the + ":ref:`dev-manual/temporary-source-code:finding temporary source code`" section to + learn how to locate the directory that has the temporary source code for a + particular package. + +#. *Change Your Working Directory:* You need to be in the directory that + has the temporary source code. That directory is defined by the + :term:`S` variable. + +#. *Create a New Patch:* Before modifying source code, you need to + create a new patch. To create a new patch file, use ``quilt new`` as + below:: + + $ quilt new my_changes.patch + +#. *Notify Quilt and Add Files:* After creating the patch, you need to + notify Quilt about the files you plan to edit. You notify Quilt by + adding the files to the patch you just created:: + + $ quilt add file1.c file2.c file3.c + +#. *Edit the Files:* Make your changes in the source code to the files + you added to the patch. + +#. *Test Your Changes:* Once you have modified the source code, the + easiest way to test your changes is by calling the :ref:`ref-tasks-compile` + task as shown in the following example:: + + $ bitbake -c compile -f package + + The ``-f`` or ``--force`` option forces the specified task to + execute. If you find problems with your code, you can just keep + editing and re-testing iteratively until things work as expected. + + .. note:: + + All the modifications you make to the temporary source code disappear + once you run the :ref:`ref-tasks-clean` or :ref:`ref-tasks-cleanall` + tasks using BitBake (i.e. ``bitbake -c clean package`` and + ``bitbake -c cleanall package``). Modifications will also disappear if + you use the :ref:`ref-classes-rm-work` feature as described in + the ":ref:`dev-manual/disk-space:conserving disk space during builds`" + section. + +#. *Generate the Patch:* Once your changes work as expected, you need to + use Quilt to generate the final patch that contains all your + modifications:: + + $ quilt refresh + + At this point, the + ``my_changes.patch`` file has all your edits made to the ``file1.c``, + ``file2.c``, and ``file3.c`` files. + + You can find the resulting patch file in the ``patches/`` + subdirectory of the source (:term:`S`) directory. + +#. *Copy the Patch File:* For simplicity, copy the patch file into a + directory named ``files``, which you can create in the same directory + that holds the recipe (``.bb``) file or the append (``.bbappend``) + file. Placing the patch here guarantees that the OpenEmbedded build + system will find the patch. Next, add the patch into the :term:`SRC_URI` + of the recipe. Here is an example:: + + SRC_URI += "file://my_changes.patch" + diff --git a/poky/documentation/dev-manual/read-only-rootfs.rst b/poky/documentation/dev-manual/read-only-rootfs.rst new file mode 100644 index 0000000000..251178ed54 --- /dev/null +++ b/poky/documentation/dev-manual/read-only-rootfs.rst @@ -0,0 +1,89 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Creating a Read-Only Root Filesystem +************************************ + +Suppose, for security reasons, you need to disable your target device's +root filesystem's write permissions (i.e. you need a read-only root +filesystem). Or, perhaps you are running the device's operating system +from a read-only storage device. For either case, you can customize your +image for that behavior. + +.. note:: + + Supporting a read-only root filesystem requires that the system and + applications do not try to write to the root filesystem. You must + configure all parts of the target system to write elsewhere, or to + gracefully fail in the event of attempting to write to the root + filesystem. + +Creating the Root Filesystem +============================ + +To create the read-only root filesystem, simply add the +"read-only-rootfs" feature to your image, normally in one of two ways. +The first way is to add the "read-only-rootfs" image feature in the +image's recipe file via the :term:`IMAGE_FEATURES` variable:: + + IMAGE_FEATURES += "read-only-rootfs" + +As an alternative, you can add the same feature +from within your :term:`Build Directory`'s ``local.conf`` file with the +associated :term:`EXTRA_IMAGE_FEATURES` variable, as in:: + + EXTRA_IMAGE_FEATURES = "read-only-rootfs" + +For more information on how to use these variables, see the +":ref:`dev-manual/customizing-images:Customizing Images Using Custom \`\`IMAGE_FEATURES\`\` and \`\`EXTRA_IMAGE_FEATURES\`\``" +section. For information on the variables, see +:term:`IMAGE_FEATURES` and +:term:`EXTRA_IMAGE_FEATURES`. + +Post-Installation Scripts and Read-Only Root Filesystem +======================================================= + +It is very important that you make sure all post-Installation +(``pkg_postinst``) scripts for packages that are installed into the +image can be run at the time when the root filesystem is created during +the build on the host system. These scripts cannot attempt to run during +the first boot on the target device. With the "read-only-rootfs" feature +enabled, the build system makes sure that all post-installation scripts +succeed at file system creation time. If any of these scripts +still need to be run after the root filesystem is created, the build +immediately fails. These build-time checks ensure that the build fails +rather than the target device fails later during its initial boot +operation. + +Most of the common post-installation scripts generated by the build +system for the out-of-the-box Yocto Project are engineered so that they +can run during root filesystem creation (e.g. post-installation scripts +for caching fonts). However, if you create and add custom scripts, you +need to be sure they can be run during this file system creation. + +Here are some common problems that prevent post-installation scripts +from running during root filesystem creation: + +- *Not using $D in front of absolute paths:* The build system defines + ``$``\ :term:`D` when the root + filesystem is created. Furthermore, ``$D`` is blank when the script + is run on the target device. This implies two purposes for ``$D``: + ensuring paths are valid in both the host and target environments, + and checking to determine which environment is being used as a method + for taking appropriate actions. + +- *Attempting to run processes that are specific to or dependent on the + target architecture:* You can work around these attempts by using + native tools, which run on the host system, to accomplish the same + tasks, or by alternatively running the processes under QEMU, which + has the ``qemu_run_binary`` function. For more information, see the + :ref:`ref-classes-qemu` class. + +Areas With Write Access +======================= + +With the "read-only-rootfs" feature enabled, any attempt by the target +to write to the root filesystem at runtime fails. Consequently, you must +make sure that you configure processes and applications that attempt +these types of writes do so to directories with write access (e.g. +``/tmp`` or ``/var/run``). + diff --git a/poky/documentation/dev-manual/runtime-testing.rst b/poky/documentation/dev-manual/runtime-testing.rst new file mode 100644 index 0000000000..c5c5653bef --- /dev/null +++ b/poky/documentation/dev-manual/runtime-testing.rst @@ -0,0 +1,598 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Performing Automated Runtime Testing +************************************ + +The OpenEmbedded build system makes available a series of automated +tests for images to verify runtime functionality. You can run these +tests on either QEMU or actual target hardware. Tests are written in +Python making use of the ``unittest`` module, and the majority of them +run commands on the target system over SSH. This section describes how +you set up the environment to use these tests, run available tests, and +write and add your own tests. + +For information on the test and QA infrastructure available within the +Yocto Project, see the ":ref:`ref-manual/release-process:testing and quality assurance`" +section in the Yocto Project Reference Manual. + +Enabling Tests +============== + +Depending on whether you are planning to run tests using QEMU or on the +hardware, you have to take different steps to enable the tests. See the +following subsections for information on how to enable both types of +tests. + +Enabling Runtime Tests on QEMU +------------------------------ + +In order to run tests, you need to do the following: + +- *Set up to avoid interaction with sudo for networking:* To + accomplish this, you must do one of the following: + + - Add ``NOPASSWD`` for your user in ``/etc/sudoers`` either for all + commands or just for ``runqemu-ifup``. You must provide the full + path as that can change if you are using multiple clones of the + source repository. + + .. note:: + + On some distributions, you also need to comment out "Defaults + requiretty" in ``/etc/sudoers``. + + - Manually configure a tap interface for your system. + + - Run as root the script in ``scripts/runqemu-gen-tapdevs``, which + should generate a list of tap devices. This is the option + typically chosen for Autobuilder-type environments. + + .. note:: + + - Be sure to use an absolute path when calling this script + with sudo. + + - The package recipe ``qemu-helper-native`` is required to run + this script. Build the package using the following command:: + + $ bitbake qemu-helper-native + +- *Set the DISPLAY variable:* You need to set this variable so that + you have an X server available (e.g. start ``vncserver`` for a + headless machine). + +- *Be sure your host's firewall accepts incoming connections from + 192.168.7.0/24:* Some of the tests (in particular DNF tests) start an + HTTP server on a random high number port, which is used to serve + files to the target. The DNF module serves + ``${WORKDIR}/oe-rootfs-repo`` so it can run DNF channel commands. + That means your host's firewall must accept incoming connections from + 192.168.7.0/24, which is the default IP range used for tap devices by + ``runqemu``. + +- *Be sure your host has the correct packages installed:* Depending + your host's distribution, you need to have the following packages + installed: + + - Ubuntu and Debian: ``sysstat`` and ``iproute2`` + + - openSUSE: ``sysstat`` and ``iproute2`` + + - Fedora: ``sysstat`` and ``iproute`` + + - CentOS: ``sysstat`` and ``iproute`` + +Once you start running the tests, the following happens: + +#. A copy of the root filesystem is written to ``${WORKDIR}/testimage``. + +#. The image is booted under QEMU using the standard ``runqemu`` script. + +#. A default timeout of 500 seconds occurs to allow for the boot process + to reach the login prompt. You can change the timeout period by + setting + :term:`TEST_QEMUBOOT_TIMEOUT` + in the ``local.conf`` file. + +#. Once the boot process is reached and the login prompt appears, the + tests run. The full boot log is written to + ``${WORKDIR}/testimage/qemu_boot_log``. + +#. Each test module loads in the order found in :term:`TEST_SUITES`. You can + find the full output of the commands run over SSH in + ``${WORKDIR}/testimgage/ssh_target_log``. + +#. If no failures occur, the task running the tests ends successfully. + You can find the output from the ``unittest`` in the task log at + ``${WORKDIR}/temp/log.do_testimage``. + +Enabling Runtime Tests on Hardware +---------------------------------- + +The OpenEmbedded build system can run tests on real hardware, and for +certain devices it can also deploy the image to be tested onto the +device beforehand. + +For automated deployment, a "controller image" is installed onto the +hardware once as part of setup. Then, each time tests are to be run, the +following occurs: + +#. The controller image is booted into and used to write the image to be + tested to a second partition. + +#. The device is then rebooted using an external script that you need to + provide. + +#. The device boots into the image to be tested. + +When running tests (independent of whether the image has been deployed +automatically or not), the device is expected to be connected to a +network on a pre-determined IP address. You can either use static IP +addresses written into the image, or set the image to use DHCP and have +your DHCP server on the test network assign a known IP address based on +the MAC address of the device. + +In order to run tests on hardware, you need to set :term:`TEST_TARGET` to an +appropriate value. For QEMU, you do not have to change anything, the +default value is "qemu". For running tests on hardware, the following +options are available: + +- *"simpleremote":* Choose "simpleremote" if you are going to run tests + on a target system that is already running the image to be tested and + is available on the network. You can use "simpleremote" in + conjunction with either real hardware or an image running within a + separately started QEMU or any other virtual machine manager. + +- *"SystemdbootTarget":* Choose "SystemdbootTarget" if your hardware is + an EFI-based machine with ``systemd-boot`` as bootloader and + ``core-image-testmaster`` (or something similar) is installed. Also, + your hardware under test must be in a DHCP-enabled network that gives + it the same IP address for each reboot. + + If you choose "SystemdbootTarget", there are additional requirements + and considerations. See the + ":ref:`dev-manual/runtime-testing:selecting systemdboottarget`" section, which + follows, for more information. + +- *"BeagleBoneTarget":* Choose "BeagleBoneTarget" if you are deploying + images and running tests on the BeagleBone "Black" or original + "White" hardware. For information on how to use these tests, see the + comments at the top of the BeagleBoneTarget + ``meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py`` file. + +- *"EdgeRouterTarget":* Choose "EdgeRouterTarget" if you are deploying + images and running tests on the Ubiquiti Networks EdgeRouter Lite. + For information on how to use these tests, see the comments at the + top of the EdgeRouterTarget + ``meta-yocto-bsp/lib/oeqa/controllers/edgeroutertarget.py`` file. + +- *"GrubTarget":* Choose "GrubTarget" if you are deploying images and running + tests on any generic PC that boots using GRUB. For information on how + to use these tests, see the comments at the top of the GrubTarget + ``meta-yocto-bsp/lib/oeqa/controllers/grubtarget.py`` file. + +- *"your-target":* Create your own custom target if you want to run + tests when you are deploying images and running tests on a custom + machine within your BSP layer. To do this, you need to add a Python + unit that defines the target class under ``lib/oeqa/controllers/`` + within your layer. You must also provide an empty ``__init__.py``. + For examples, see files in ``meta-yocto-bsp/lib/oeqa/controllers/``. + +Selecting SystemdbootTarget +--------------------------- + +If you did not set :term:`TEST_TARGET` to "SystemdbootTarget", then you do +not need any information in this section. You can skip down to the +":ref:`dev-manual/runtime-testing:running tests`" section. + +If you did set :term:`TEST_TARGET` to "SystemdbootTarget", you also need to +perform a one-time setup of your controller image by doing the following: + +#. *Set EFI_PROVIDER:* Be sure that :term:`EFI_PROVIDER` is as follows:: + + EFI_PROVIDER = "systemd-boot" + +#. *Build the controller image:* Build the ``core-image-testmaster`` image. + The ``core-image-testmaster`` recipe is provided as an example for a + "controller" image and you can customize the image recipe as you would + any other recipe. + + Here are the image recipe requirements: + + - Inherits ``core-image`` so that kernel modules are installed. + + - Installs normal linux utilities not BusyBox ones (e.g. ``bash``, + ``coreutils``, ``tar``, ``gzip``, and ``kmod``). + + - Uses a custom :term:`Initramfs` image with a custom + installer. A normal image that you can install usually creates a + single root filesystem partition. This image uses another installer that + creates a specific partition layout. Not all Board Support + Packages (BSPs) can use an installer. For such cases, you need to + manually create the following partition layout on the target: + + - First partition mounted under ``/boot``, labeled "boot". + + - The main root filesystem partition where this image gets installed, + which is mounted under ``/``. + + - Another partition labeled "testrootfs" where test images get + deployed. + +#. *Install image:* Install the image that you just built on the target + system. + +The final thing you need to do when setting :term:`TEST_TARGET` to +"SystemdbootTarget" is to set up the test image: + +#. *Set up your local.conf file:* Make sure you have the following + statements in your ``local.conf`` file:: + + IMAGE_FSTYPES += "tar.gz" + INHERIT += "testimage" + TEST_TARGET = "SystemdbootTarget" + TEST_TARGET_IP = "192.168.2.3" + +#. *Build your test image:* Use BitBake to build the image:: + + $ bitbake core-image-sato + +Power Control +------------- + +For most hardware targets other than "simpleremote", you can control +power: + +- You can use :term:`TEST_POWERCONTROL_CMD` together with + :term:`TEST_POWERCONTROL_EXTRA_ARGS` as a command that runs on the host + and does power cycling. The test code passes one argument to that + command: off, on or cycle (off then on). Here is an example that + could appear in your ``local.conf`` file:: + + TEST_POWERCONTROL_CMD = "powercontrol.exp test 10.11.12.1 nuc1" + + In this example, the expect + script does the following: + + .. code-block:: shell + + ssh test@10.11.12.1 "pyctl nuc1 arg" + + It then runs a Python script that controls power for a label called + ``nuc1``. + + .. note:: + + You need to customize :term:`TEST_POWERCONTROL_CMD` and + :term:`TEST_POWERCONTROL_EXTRA_ARGS` for your own setup. The one requirement + is that it accepts "on", "off", and "cycle" as the last argument. + +- When no command is defined, it connects to the device over SSH and + uses the classic reboot command to reboot the device. Classic reboot + is fine as long as the machine actually reboots (i.e. the SSH test + has not failed). It is useful for scenarios where you have a simple + setup, typically with a single board, and where some manual + interaction is okay from time to time. + +If you have no hardware to automatically perform power control but still +wish to experiment with automated hardware testing, you can use the +``dialog-power-control`` script that shows a dialog prompting you to perform +the required power action. This script requires either KDialog or Zenity +to be installed. To use this script, set the +:term:`TEST_POWERCONTROL_CMD` +variable as follows:: + + TEST_POWERCONTROL_CMD = "${COREBASE}/scripts/contrib/dialog-power-control" + +Serial Console Connection +------------------------- + +For test target classes requiring a serial console to interact with the +bootloader (e.g. BeagleBoneTarget, EdgeRouterTarget, and GrubTarget), +you need to specify a command to use to connect to the serial console of +the target machine by using the +:term:`TEST_SERIALCONTROL_CMD` +variable and optionally the +:term:`TEST_SERIALCONTROL_EXTRA_ARGS` +variable. + +These cases could be a serial terminal program if the machine is +connected to a local serial port, or a ``telnet`` or ``ssh`` command +connecting to a remote console server. Regardless of the case, the +command simply needs to connect to the serial console and forward that +connection to standard input and output as any normal terminal program +does. For example, to use the picocom terminal program on serial device +``/dev/ttyUSB0`` at 115200bps, you would set the variable as follows:: + + TEST_SERIALCONTROL_CMD = "picocom /dev/ttyUSB0 -b 115200" + +For local +devices where the serial port device disappears when the device reboots, +an additional "serdevtry" wrapper script is provided. To use this +wrapper, simply prefix the terminal command with +``${COREBASE}/scripts/contrib/serdevtry``:: + + TEST_SERIALCONTROL_CMD = "${COREBASE}/scripts/contrib/serdevtry picocom -b 115200 /dev/ttyUSB0" + +Running Tests +============= + +You can start the tests automatically or manually: + +- *Automatically running tests:* To run the tests automatically after the + OpenEmbedded build system successfully creates an image, first set the + :term:`TESTIMAGE_AUTO` variable to "1" in your ``local.conf`` file in the + :term:`Build Directory`:: + + TESTIMAGE_AUTO = "1" + + Next, build your image. If the image successfully builds, the + tests run:: + + bitbake core-image-sato + +- *Manually running tests:* To manually run the tests, first globally + inherit the :ref:`ref-classes-testimage` class by editing your + ``local.conf`` file:: + + INHERIT += "testimage" + + Next, use BitBake to run the tests:: + + bitbake -c testimage image + +All test files reside in ``meta/lib/oeqa/runtime/cases`` in the +:term:`Source Directory`. A test name maps +directly to a Python module. Each test module may contain a number of +individual tests. Tests are usually grouped together by the area tested +(e.g tests for systemd reside in ``meta/lib/oeqa/runtime/cases/systemd.py``). + +You can add tests to any layer provided you place them in the proper +area and you extend :term:`BBPATH` in +the ``local.conf`` file as normal. Be sure that tests reside in +``layer/lib/oeqa/runtime/cases``. + +.. note:: + + Be sure that module names do not collide with module names used in + the default set of test modules in ``meta/lib/oeqa/runtime/cases``. + +You can change the set of tests run by appending or overriding +:term:`TEST_SUITES` variable in +``local.conf``. Each name in :term:`TEST_SUITES` represents a required test +for the image. Test modules named within :term:`TEST_SUITES` cannot be +skipped even if a test is not suitable for an image (e.g. running the +RPM tests on an image without ``rpm``). Appending "auto" to +:term:`TEST_SUITES` causes the build system to try to run all tests that are +suitable for the image (i.e. each test module may elect to skip itself). + +The order you list tests in :term:`TEST_SUITES` is important and influences +test dependencies. Consequently, tests that depend on other tests should +be added after the test on which they depend. For example, since the +``ssh`` test depends on the ``ping`` test, "ssh" needs to come after +"ping" in the list. The test class provides no re-ordering or dependency +handling. + +.. note:: + + Each module can have multiple classes with multiple test methods. + And, Python ``unittest`` rules apply. + +Here are some things to keep in mind when running tests: + +- The default tests for the image are defined as:: + + DEFAULT_TEST_SUITES:pn-image = "ping ssh df connman syslog xorg scp vnc date rpm dnf dmesg" + +- Add your own test to the list of the by using the following:: + + TEST_SUITES:append = " mytest" + +- Run a specific list of tests as follows:: + + TEST_SUITES = "test1 test2 test3" + + Remember, order is important. Be sure to place a test that is + dependent on another test later in the order. + +Exporting Tests +=============== + +You can export tests so that they can run independently of the build +system. Exporting tests is required if you want to be able to hand the +test execution off to a scheduler. You can only export tests that are +defined in :term:`TEST_SUITES`. + +If your image is already built, make sure the following are set in your +``local.conf`` file:: + + INHERIT += "testexport" + TEST_TARGET_IP = "IP-address-for-the-test-target" + TEST_SERVER_IP = "IP-address-for-the-test-server" + +You can then export the tests with the +following BitBake command form:: + + $ bitbake image -c testexport + +Exporting the tests places them in the :term:`Build Directory` in +``tmp/testexport/``\ image, which is controlled by the :term:`TEST_EXPORT_DIR` +variable. + +You can now run the tests outside of the build environment:: + + $ cd tmp/testexport/image + $ ./runexported.py testdata.json + +Here is a complete example that shows IP addresses and uses the +``core-image-sato`` image:: + + INHERIT += "testexport" + TEST_TARGET_IP = "192.168.7.2" + TEST_SERVER_IP = "192.168.7.1" + +Use BitBake to export the tests:: + + $ bitbake core-image-sato -c testexport + +Run the tests outside of +the build environment using the following:: + + $ cd tmp/testexport/core-image-sato + $ ./runexported.py testdata.json + +Writing New Tests +================= + +As mentioned previously, all new test files need to be in the proper +place for the build system to find them. New tests for additional +functionality outside of the core should be added to the layer that adds +the functionality, in ``layer/lib/oeqa/runtime/cases`` (as long as +:term:`BBPATH` is extended in the +layer's ``layer.conf`` file as normal). Just remember the following: + +- Filenames need to map directly to test (module) names. + +- Do not use module names that collide with existing core tests. + +- Minimally, an empty ``__init__.py`` file must be present in the runtime + directory. + +To create a new test, start by copying an existing module (e.g. +``syslog.py`` or ``gcc.py`` are good ones to use). Test modules can use +code from ``meta/lib/oeqa/utils``, which are helper classes. + +.. note:: + + Structure shell commands such that you rely on them and they return a + single code for success. Be aware that sometimes you will need to + parse the output. See the ``df.py`` and ``date.py`` modules for examples. + +You will notice that all test classes inherit ``oeRuntimeTest``, which +is found in ``meta/lib/oetest.py``. This base class offers some helper +attributes, which are described in the following sections: + +Class Methods +------------- + +Class methods are as follows: + +- *hasPackage(pkg):* Returns "True" if ``pkg`` is in the installed + package list of the image, which is based on the manifest file that + is generated during the :ref:`ref-tasks-rootfs` task. + +- *hasFeature(feature):* Returns "True" if the feature is in + :term:`IMAGE_FEATURES` or + :term:`DISTRO_FEATURES`. + +Class Attributes +---------------- + +Class attributes are as follows: + +- *pscmd:* Equals "ps -ef" if ``procps`` is installed in the image. + Otherwise, ``pscmd`` equals "ps" (busybox). + +- *tc:* The called test context, which gives access to the + following attributes: + + - *d:* The BitBake datastore, which allows you to use stuff such + as ``oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager")``. + + - *testslist and testsrequired:* Used internally. The tests + do not need these. + + - *filesdir:* The absolute path to + ``meta/lib/oeqa/runtime/files``, which contains helper files for + tests meant for copying on the target such as small files written + in C for compilation. + + - *target:* The target controller object used to deploy and + start an image on a particular target (e.g. Qemu, SimpleRemote, + and SystemdbootTarget). Tests usually use the following: + + - *ip:* The target's IP address. + + - *server_ip:* The host's IP address, which is usually used + by the DNF test suite. + + - *run(cmd, timeout=None):* The single, most used method. + This command is a wrapper for: ``ssh root@host "cmd"``. The + command returns a tuple: (status, output), which are what their + names imply - the return code of "cmd" and whatever output it + produces. The optional timeout argument represents the number + of seconds the test should wait for "cmd" to return. If the + argument is "None", the test uses the default instance's + timeout period, which is 300 seconds. If the argument is "0", + the test runs until the command returns. + + - *copy_to(localpath, remotepath):* + ``scp localpath root@ip:remotepath``. + + - *copy_from(remotepath, localpath):* + ``scp root@host:remotepath localpath``. + +Instance Attributes +------------------- + +There is a single instance attribute, which is ``target``. The ``target`` +instance attribute is identical to the class attribute of the same name, +which is described in the previous section. This attribute exists as +both an instance and class attribute so tests can use +``self.target.run(cmd)`` in instance methods instead of +``oeRuntimeTest.tc.target.run(cmd)``. + +Installing Packages in the DUT Without the Package Manager +========================================================== + +When a test requires a package built by BitBake, it is possible to +install that package. Installing the package does not require a package +manager be installed in the device under test (DUT). It does, however, +require an SSH connection and the target must be using the +``sshcontrol`` class. + +.. note:: + + This method uses ``scp`` to copy files from the host to the target, which + causes permissions and special attributes to be lost. + +A JSON file is used to define the packages needed by a test. This file +must be in the same path as the file used to define the tests. +Furthermore, the filename must map directly to the test module name with +a ``.json`` extension. + +The JSON file must include an object with the test name as keys of an +object or an array. This object (or array of objects) uses the following +data: + +- "pkg" --- a mandatory string that is the name of the package to be + installed. + +- "rm" --- an optional boolean, which defaults to "false", that specifies + to remove the package after the test. + +- "extract" --- an optional boolean, which defaults to "false", that + specifies if the package must be extracted from the package format. + When set to "true", the package is not automatically installed into + the DUT. + +Following is an example JSON file that handles test "foo" installing +package "bar" and test "foobar" installing packages "foo" and "bar". +Once the test is complete, the packages are removed from the DUT:: + + { + "foo": { + "pkg": "bar" + }, + "foobar": [ + { + "pkg": "foo", + "rm": true + }, + { + "pkg": "bar", + "rm": true + } + ] + } + diff --git a/poky/documentation/dev-manual/sbom.rst b/poky/documentation/dev-manual/sbom.rst new file mode 100644 index 0000000000..c67b7344d1 --- /dev/null +++ b/poky/documentation/dev-manual/sbom.rst @@ -0,0 +1,69 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Creating a Software Bill of Materials +************************************* + +Once you are able to build an image for your project, once the licenses for +each software component are all identified (see +":ref:`dev-manual/licenses:working with licenses`") and once vulnerability +fixes are applied (see ":ref:`dev-manual/vulnerabilities:checking +for vulnerabilities`"), the OpenEmbedded build system can generate +a description of all the components you used, their licenses, their dependencies, +their sources, the changes that were applied to them and the known +vulnerabilities that were fixed. + +This description is generated in the form of a *Software Bill of Materials* +(:term:`SBOM`), using the :term:`SPDX` standard. + +When you release software, this is the most standard way to provide information +about the Software Supply Chain of your software image and SDK. The +:term:`SBOM` tooling is often used to ensure open source license compliance by +providing the license texts used in the product which legal departments and end +users can read in standardized format. + +:term:`SBOM` information is also critical to performing vulnerability exposure +assessments, as all the components used in the Software Supply Chain are listed. + +The OpenEmbedded build system doesn't generate such information by default. +To make this happen, you must inherit the +:ref:`ref-classes-create-spdx` class from a configuration file:: + + INHERIT += "create-spdx" + +You then get :term:`SPDX` output in JSON format as an +``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the +:term:`Build Directory`. + +This is a toplevel file accompanied by an ``IMAGE-MACHINE.spdx.index.json`` +containing an index of JSON :term:`SPDX` files for individual recipes, together +with an ``IMAGE-MACHINE.spdx.tar.zst`` compressed archive containing all such +files. + +The :ref:`ref-classes-create-spdx` class offers options to include +more information in the output :term:`SPDX` data, such as making the generated +files more human readable (:term:`SPDX_PRETTY`), adding compressed archives of +the files in the generated target packages (:term:`SPDX_ARCHIVE_PACKAGED`), +adding a description of the source files used to generate host tools and target +packages (:term:`SPDX_INCLUDE_SOURCES`) and adding archives of these source +files themselves (:term:`SPDX_ARCHIVE_SOURCES`). + +Though the toplevel :term:`SPDX` output is available in +``tmp/deploy/images/MACHINE/`` inside the :term:`Build Directory`, ancillary +generated files are available in ``tmp/deploy/spdx/MACHINE`` too, such as: + +- The individual :term:`SPDX` JSON files in the ``IMAGE-MACHINE.spdx.tar.zst`` + archive. + +- Compressed archives of the files in the generated target packages, + in ``packages/packagename.tar.zst`` (when :term:`SPDX_ARCHIVE_PACKAGED` + is set). + +- Compressed archives of the source files used to build the host tools + and the target packages in ``recipes/recipe-packagename.tar.zst`` + (when :term:`SPDX_ARCHIVE_SOURCES` is set). Those are needed to fulfill + "source code access" license requirements. + +See the `tools page `__ on the :term:`SPDX` +project website for a list of tools to consume and transform the :term:`SPDX` +data generated by the OpenEmbedded build system. + diff --git a/poky/documentation/dev-manual/securing-images.rst b/poky/documentation/dev-manual/securing-images.rst new file mode 100644 index 0000000000..6a9223c19c --- /dev/null +++ b/poky/documentation/dev-manual/securing-images.rst @@ -0,0 +1,156 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Making Images More Secure +************************* + +Security is of increasing concern for embedded devices. Consider the +issues and problems discussed in just this sampling of work found across +the Internet: + +- *"*\ `Security Risks of Embedded + Systems `__\ *"* + by Bruce Schneier + +- *"*\ `Internet Census + 2012 `__\ *"* by Carna + Botnet + +- *"*\ `Security Issues for Embedded + Devices `__\ *"* + by Jake Edge + +When securing your image is of concern, there are steps, tools, and +variables that you can consider to help you reach the security goals you +need for your particular device. Not all situations are identical when +it comes to making an image secure. Consequently, this section provides +some guidance and suggestions for consideration when you want to make +your image more secure. + +.. note:: + + Because the security requirements and risks are different for every + type of device, this section cannot provide a complete reference on + securing your custom OS. It is strongly recommended that you also + consult other sources of information on embedded Linux system + hardening and on security. + +General Considerations +====================== + +There are general considerations that help you create more secure images. +You should consider the following suggestions to make your device +more secure: + +- Scan additional code you are adding to the system (e.g. application + code) by using static analysis tools. Look for buffer overflows and + other potential security problems. + +- Pay particular attention to the security for any web-based + administration interface. + + Web interfaces typically need to perform administrative functions and + tend to need to run with elevated privileges. Thus, the consequences + resulting from the interface's security becoming compromised can be + serious. Look for common web vulnerabilities such as + cross-site-scripting (XSS), unvalidated inputs, and so forth. + + As with system passwords, the default credentials for accessing a + web-based interface should not be the same across all devices. This + is particularly true if the interface is enabled by default as it can + be assumed that many end-users will not change the credentials. + +- Ensure you can update the software on the device to mitigate + vulnerabilities discovered in the future. This consideration + especially applies when your device is network-enabled. + +- Regularly scan and apply fixes for CVE security issues affecting + all software components in the product, see ":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`". + +- Regularly update your version of Poky and OE-Core from their upstream + developers, e.g. to apply updates and security fixes from stable + and LTS branches. + +- Ensure you remove or disable debugging functionality before producing + the final image. For information on how to do this, see the + ":ref:`dev-manual/securing-images:considerations specific to the openembedded build system`" + section. + +- Ensure you have no network services listening that are not needed. + +- Remove any software from the image that is not needed. + +- Enable hardware support for secure boot functionality when your + device supports this functionality. + +Security Flags +============== + +The Yocto Project has security flags that you can enable that help make +your build output more secure. The security flags are in the +``meta/conf/distro/include/security_flags.inc`` file in your +:term:`Source Directory` (e.g. ``poky``). + +.. note:: + + Depending on the recipe, certain security flags are enabled and + disabled by default. + +Use the following line in your ``local.conf`` file or in your custom +distribution configuration file to enable the security compiler and +linker flags for your build:: + + require conf/distro/include/security_flags.inc + +Considerations Specific to the OpenEmbedded Build System +======================================================== + +You can take some steps that are specific to the OpenEmbedded build +system to make your images more secure: + +- Ensure "debug-tweaks" is not one of your selected + :term:`IMAGE_FEATURES`. + When creating a new project, the default is to provide you with an + initial ``local.conf`` file that enables this feature using the + :term:`EXTRA_IMAGE_FEATURES` + variable with the line:: + + EXTRA_IMAGE_FEATURES = "debug-tweaks" + + To disable that feature, simply comment out that line in your + ``local.conf`` file, or make sure :term:`IMAGE_FEATURES` does not contain + "debug-tweaks" before producing your final image. Among other things, + leaving this in place sets the root password as blank, which makes + logging in for debugging or inspection easy during development but + also means anyone can easily log in during production. + +- It is possible to set a root password for the image and also to set + passwords for any extra users you might add (e.g. administrative or + service type users). When you set up passwords for multiple images or + users, you should not duplicate passwords. + + To set up passwords, use the :ref:`ref-classes-extrausers` class, which + is the preferred method. For an example on how to set up both root and + user passwords, see the ":ref:`ref-classes-extrausers`" section. + + .. note:: + + When adding extra user accounts or setting a root password, be + cautious about setting the same password on every device. If you + do this, and the password you have set is exposed, then every + device is now potentially compromised. If you need this access but + want to ensure security, consider setting a different, random + password for each device. Typically, you do this as a separate + step after you deploy the image onto the device. + +- Consider enabling a Mandatory Access Control (MAC) framework such as + SMACK or SELinux and tuning it appropriately for your device's usage. + You can find more information in the + :yocto_git:`meta-selinux ` layer. + +Tools for Hardening Your Image +============================== + +The Yocto Project provides tools for making your image more secure. You +can find these tools in the ``meta-security`` layer of the +:yocto_git:`Yocto Project Source Repositories <>`. + diff --git a/poky/documentation/dev-manual/speeding-up-build.rst b/poky/documentation/dev-manual/speeding-up-build.rst new file mode 100644 index 0000000000..31b6f75ab0 --- /dev/null +++ b/poky/documentation/dev-manual/speeding-up-build.rst @@ -0,0 +1,109 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Speeding Up a Build +******************* + +Build time can be an issue. By default, the build system uses simple +controls to try and maximize build efficiency. In general, the default +settings for all the following variables result in the most efficient +build times when dealing with single socket systems (i.e. a single CPU). +If you have multiple CPUs, you might try increasing the default values +to gain more speed. See the descriptions in the glossary for each +variable for more information: + +- :term:`BB_NUMBER_THREADS`: + The maximum number of threads BitBake simultaneously executes. + +- :term:`BB_NUMBER_PARSE_THREADS`: + The number of threads BitBake uses during parsing. + +- :term:`PARALLEL_MAKE`: Extra + options passed to the ``make`` command during the + :ref:`ref-tasks-compile` task in + order to specify parallel compilation on the local build host. + +- :term:`PARALLEL_MAKEINST`: + Extra options passed to the ``make`` command during the + :ref:`ref-tasks-install` task in + order to specify parallel installation on the local build host. + +As mentioned, these variables all scale to the number of processor cores +available on the build system. For single socket systems, this +auto-scaling ensures that the build system fundamentally takes advantage +of potential parallel operations during the build based on the build +machine's capabilities. + +Following are additional factors that can affect build speed: + +- File system type: The file system type that the build is being + performed on can also influence performance. Using ``ext4`` is + recommended as compared to ``ext2`` and ``ext3`` due to ``ext4`` + improved features such as extents. + +- Disabling the updating of access time using ``noatime``: The + ``noatime`` mount option prevents the build system from updating file + and directory access times. + +- Setting a longer commit: Using the "commit=" mount option increases + the interval in seconds between disk cache writes. Changing this + interval from the five second default to something longer increases + the risk of data loss but decreases the need to write to the disk, + thus increasing the build performance. + +- Choosing the packaging backend: Of the available packaging backends, + IPK is the fastest. Additionally, selecting a singular packaging + backend also helps. + +- Using ``tmpfs`` for :term:`TMPDIR` + as a temporary file system: While this can help speed up the build, + the benefits are limited due to the compiler using ``-pipe``. The + build system goes to some lengths to avoid ``sync()`` calls into the + file system on the principle that if there was a significant failure, + the :term:`Build Directory` contents could easily be rebuilt. + +- Inheriting the :ref:`ref-classes-rm-work` class: + Inheriting this class has shown to speed up builds due to + significantly lower amounts of data stored in the data cache as well + as on disk. Inheriting this class also makes cleanup of + :term:`TMPDIR` faster, at the + expense of being easily able to dive into the source code. File + system maintainers have recommended that the fastest way to clean up + large numbers of files is to reformat partitions rather than delete + files due to the linear nature of partitions. This, of course, + assumes you structure the disk partitions and file systems in a way + that this is practical. + +Aside from the previous list, you should keep some trade offs in mind +that can help you speed up the build: + +- Remove items from + :term:`DISTRO_FEATURES` + that you might not need. + +- Exclude debug symbols and other debug information: If you do not need + these symbols and other debug information, disabling the ``*-dbg`` + package generation can speed up the build. You can disable this + generation by setting the + :term:`INHIBIT_PACKAGE_DEBUG_SPLIT` + variable to "1". + +- Disable static library generation for recipes derived from + ``autoconf`` or ``libtool``: Following is an example showing how to + disable static libraries and still provide an override to handle + exceptions:: + + STATICLIBCONF = "--disable-static" + STATICLIBCONF:sqlite3-native = "" + EXTRA_OECONF += "${STATICLIBCONF}" + + .. note:: + + - Some recipes need static libraries in order to work correctly + (e.g. ``pseudo-native`` needs ``sqlite3-native``). Overrides, + as in the previous example, account for these kinds of + exceptions. + + - Some packages have packaging code that assumes the presence of + the static libraries. If so, you might need to exclude them as + well. + diff --git a/poky/documentation/dev-manual/start.rst b/poky/documentation/dev-manual/start.rst index 63d63fc27e..498734a04d 100644 --- a/poky/documentation/dev-manual/start.rst +++ b/poky/documentation/dev-manual/start.rst @@ -29,7 +29,7 @@ however, keep in mind, the procedure here is simply a starting point. You can build off these steps and customize the procedure to fit any particular working environment and set of practices. -1. *Determine Who is Going to be Developing:* You first need to +#. *Determine Who is Going to be Developing:* You first need to understand who is going to be doing anything related to the Yocto Project and determine their roles. Making this determination is essential to completing subsequent steps, which are to get your @@ -52,7 +52,7 @@ particular working environment and set of practices. automated tests that are used to ensure all application and core system development meets desired quality standards. -2. *Gather the Hardware:* Based on the size and make-up of the team, +#. *Gather the Hardware:* Based on the size and make-up of the team, get the hardware together. Ideally, any development, build, or test engineer uses a system that runs a supported Linux distribution. These systems, in general, should be high performance (e.g. dual, @@ -66,13 +66,13 @@ particular working environment and set of practices. building Yocto Project development containers to be run under Docker, which is described later. -3. *Understand the Hardware Topology of the Environment:* Once you +#. *Understand the Hardware Topology of the Environment:* Once you understand the hardware involved and the make-up of the team, you can understand the hardware topology of the development environment. You can get a visual idea of the machines and their roles across the development environment. -4. *Use Git as Your Source Control Manager (SCM):* Keeping your +#. *Use Git as Your Source Control Manager (SCM):* Keeping your :term:`Metadata` (i.e. recipes, configuration files, classes, and so forth) and any software you are developing under the control of an SCM system that is compatible @@ -109,7 +109,7 @@ particular working environment and set of practices. Documentation on how to create interfaces and frontends for Git. -5. *Set up the Application Development Machines:* As mentioned earlier, +#. *Set up the Application Development Machines:* As mentioned earlier, application developers are creating applications on top of existing software stacks. Following are some best practices for setting up machines used for application development: @@ -128,7 +128,7 @@ particular working environment and set of practices. - Use multiple toolchains installed locally into different locations to allow development across versions. -6. *Set up the Core Development Machines:* As mentioned earlier, core +#. *Set up the Core Development Machines:* As mentioned earlier, core developers work on the contents of the operating system itself. Following are some best practices for setting up machines used for developing images: @@ -145,7 +145,7 @@ particular working environment and set of practices. - Share layers amongst the developers of a particular project and contain the policy configuration that defines the project. -7. *Set up an Autobuilder:* Autobuilders are often the core of the +#. *Set up an Autobuilder:* Autobuilders are often the core of the development environment. It is here that changes from individual developers are brought together and centrally tested. Based on this automated build and test environment, subsequent decisions about @@ -183,12 +183,12 @@ particular working environment and set of practices. - Allows scheduling of builds so that resources can be used efficiently. -8. *Set up Test Machines:* Use a small number of shared, high +#. *Set up Test Machines:* Use a small number of shared, high performance systems for testing purposes. Developers can use these systems for wider, more extensive testing while they continue to develop locally using their primary development system. -9. *Document Policies and Change Flow:* The Yocto Project uses a +#. *Document Policies and Change Flow:* The Yocto Project uses a hierarchical structure and a pull model. There are scripts to create and send pull requests (i.e. ``create-pull-request`` and ``send-pull-request``). This model is in line with other open source @@ -213,7 +213,7 @@ particular working environment and set of practices. possible. Chances are if you have discovered the need for changes, someone else in the community needs them also. -10. *Development Environment Summary:* Aside from the previous steps, +#. *Development Environment Summary:* Aside from the previous steps, here are best practices within the Yocto Project development environment: @@ -223,7 +223,7 @@ particular working environment and set of practices. - Maintain your Metadata in layers that make sense for your situation. See the ":ref:`overview-manual/yp-intro:the yocto project layer model`" section in the Yocto Project Overview and Concepts Manual and the - ":ref:`dev-manual/common-tasks:understanding and creating layers`" + ":ref:`dev-manual/layers:understanding and creating layers`" section for more information on layers. - Separate the project's Metadata and code by using separate Git @@ -247,13 +247,13 @@ particular working environment and set of practices. project to fix bugs or add features. If you do submit patches, follow the project commit guidelines for writing good commit messages. See the - ":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" + ":ref:`dev-manual/changes:submitting a change to the yocto project`" section. - Send changes to the core sooner than later as others are likely to run into the same issues. For some guidance on mailing lists to use, see the list in the - ":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" + ":ref:`dev-manual/changes:submitting a change to the yocto project`" section. For a description of the available mailing lists, see the ":ref:`resources-mailinglist`" section in the Yocto Project Reference Manual. @@ -296,7 +296,7 @@ Setting Up a Native Linux Host Follow these steps to prepare a native Linux machine as your Yocto Project Build Host: -1. *Use a Supported Linux Distribution:* You should have a reasonably +#. *Use a Supported Linux Distribution:* You should have a reasonably current Linux-based host system. You will have the best results with a recent release of Fedora, openSUSE, Debian, Ubuntu, RHEL or CentOS as these releases are frequently tested against the Yocto Project and @@ -306,10 +306,10 @@ Project Build Host: section in the Yocto Project Reference Manual and the wiki page at :yocto_wiki:`Distribution Support `. -2. *Have Enough Free Memory:* Your system should have at least 50 Gbytes +#. *Have Enough Free Memory:* Your system should have at least 50 Gbytes of free disk space for building images. -3. *Meet Minimal Version Requirements:* The OpenEmbedded build system +#. *Meet Minimal Version Requirements:* The OpenEmbedded build system should be able to run on any modern distribution that has the following versions for Git, tar, Python, gcc and make. @@ -329,7 +329,7 @@ Project Build Host: ":ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions`" section in the Yocto Project Reference Manual for information. -4. *Install Development Host Packages:* Required development host +#. *Install Development Host Packages:* Required development host packages vary depending on your build host and what you want to do with the Yocto Project. Collectively, the number of required packages is large if you want to be able to cover all cases. @@ -361,7 +361,7 @@ Yocto Project on a Windows, Mac, or Linux machine. Follow these general steps to prepare a Windows, Mac, or Linux machine as your Yocto Project build host: -1. *Determine What Your Build Host Needs:* +#. *Determine What Your Build Host Needs:* `Docker `__ is a software container platform that you need to install on the build host. Depending on your build host, you might have to install different @@ -370,20 +370,20 @@ as your Yocto Project build host: Platforms `__" your build host needs to run containers. -2. *Choose What To Install:* Depending on whether or not your build host +#. *Choose What To Install:* Depending on whether or not your build host meets system requirements, you need to install "Docker CE Stable" or the "Docker Toolbox". Most situations call for Docker CE. However, if you have a build host that does not meet requirements (e.g. Pre-Windows 10 or Windows 10 "Home" version), you must install Docker Toolbox instead. -3. *Go to the Install Site for Your Platform:* Click the link for the +#. *Go to the Install Site for Your Platform:* Click the link for the Docker edition associated with your build host's native software. For example, if your build host is running Microsoft Windows Version 10 and you want the Docker CE Stable edition, click that link under "Supported Platforms". -4. *Install the Software:* Once you have understood all the +#. *Install the Software:* Once you have understood all the pre-requisites, you can download and install the appropriate software. Follow the instructions for your specific machine and the type of the software you need to install: @@ -412,15 +412,15 @@ as your Yocto Project build host: Ubuntu `__ for Linux build hosts running the Ubuntu distribution. -5. *Optionally Orient Yourself With Docker:* If you are unfamiliar with +#. *Optionally Orient Yourself With Docker:* If you are unfamiliar with Docker and the container concept, you can learn more here - https://docs.docker.com/get-started/. -6. *Launch Docker or Docker Toolbox:* You should be able to launch +#. *Launch Docker or Docker Toolbox:* You should be able to launch Docker or the Docker Toolbox and have a terminal shell on your development host. -7. *Set Up the Containers to Use the Yocto Project:* Go to +#. *Set Up the Containers to Use the Yocto Project:* Go to https://github.com/crops/docker-win-mac-docs/wiki and follow the directions for your particular build host (i.e. Linux, Mac, or Windows). @@ -453,7 +453,7 @@ in which you can develop using the Yocto Project. Follow these general steps to prepare a Windows machine using WSL 2 as your Yocto Project build host: -1. *Make sure your Windows machine is capable of running WSL 2:* +#. *Make sure your Windows machine is capable of running WSL 2:* While all Windows 11 and Windows Server 2022 builds support WSL 2, the first versions of Windows 10 and Windows Server 2019 didn't. @@ -469,7 +469,7 @@ your Yocto Project build host: Microsoft Windows [Version 10.0.19041.153] -2. *Install the Linux distribution of your choice inside WSL 2:* +#. *Install the Linux distribution of your choice inside WSL 2:* Once you know your version of Windows supports WSL 2, you can install the distribution of your choice from the Microsoft Store. Open the Microsoft Store and search for Linux. While there are @@ -479,7 +479,7 @@ your Yocto Project build host: making your selection, simply click "Get" to download and install the distribution. -3. *Check which Linux distribution WSL 2 is using:* Open a Windows +#. *Check which Linux distribution WSL 2 is using:* Open a Windows PowerShell and run:: C:\WINDOWS\system32> wsl -l -v @@ -489,13 +489,13 @@ your Yocto Project build host: Note that WSL 2 supports running as many different Linux distributions as you want to install. -4. *Optionally Get Familiar with WSL:* You can learn more on +#. *Optionally Get Familiar with WSL:* You can learn more on https://docs.microsoft.com/en-us/windows/wsl/wsl2-about. -5. *Launch your WSL Distibution:* From the Windows start menu simply +#. *Launch your WSL Distibution:* From the Windows start menu simply launch your WSL distribution just like any other application. -6. *Optimize your WSL 2 storage often:* Due to the way storage is +#. *Optimize your WSL 2 storage often:* Due to the way storage is handled on WSL 2, the storage space used by the underlying Linux distribution is not reflected immediately, and since BitBake heavily uses storage, after several builds, you may be unaware you are @@ -597,14 +597,14 @@ repository at :yocto_git:`/poky`. Use the following procedure to locate the latest upstream copy of the ``poky`` Git repository: -1. *Access Repositories:* Open a browser and go to +#. *Access Repositories:* Open a browser and go to :yocto_git:`/` to access the GUI-based interface into the Yocto Project source repositories. -2. *Select the Repository:* Click on the repository in which you are +#. *Select the Repository:* Click on the repository in which you are interested (e.g. ``poky``). -3. *Find the URL Used to Clone the Repository:* At the bottom of the +#. *Find the URL Used to Clone the Repository:* At the bottom of the page, note the URL used to clone that repository (e.g. :yocto_git:`/poky`). @@ -630,7 +630,7 @@ of a given component. Follow these steps to locate and download a particular tarball: -1. *Access the Index of Releases:* Open a browser and go to +#. *Access the Index of Releases:* Open a browser and go to :yocto_dl:`Index of Releases `. The list represents released components (e.g. ``bitbake``, ``sato``, and so on). @@ -642,14 +642,14 @@ Follow these steps to locate and download a particular tarball: historically used for very early releases and exists now only for retroactive completeness. -2. *Select a Component:* Click on any released component in which you +#. *Select a Component:* Click on any released component in which you are interested (e.g. ``yocto``). -3. *Find the Tarball:* Drill down to find the associated tarball. For +#. *Find the Tarball:* Drill down to find the associated tarball. For example, click on ``yocto-&DISTRO;`` to view files associated with the Yocto Project &DISTRO; release. -4. *Download the Tarball:* Click the tarball to download and save a +#. *Download the Tarball:* Click the tarball to download and save a snapshot of the given component. Using the Downloads Page @@ -661,13 +661,13 @@ release. Rather than Git repositories, these files represent snapshot tarballs similar to the tarballs located in the Index of Releases described in the ":ref:`dev-manual/start:accessing index of releases`" section. -1. *Go to the Yocto Project Website:* Open The +#. *Go to the Yocto Project Website:* Open The :yocto_home:`Yocto Project Website <>` in your browser. -2. *Get to the Downloads Area:* Select the "DOWNLOADS" item from the +#. *Get to the Downloads Area:* Select the "DOWNLOADS" item from the pull-down "SOFTWARE" tab menu near the top of the page. -3. *Select a Yocto Project Release:* Use the menu next to "RELEASE" to +#. *Select a Yocto Project Release:* Use the menu next to "RELEASE" to display and choose a recent or past supported Yocto Project release (e.g. &DISTRO_NAME_NO_CAP;, &DISTRO_NAME_NO_CAP_MINUS_ONE;, and so forth). @@ -679,7 +679,7 @@ described in the ":ref:`dev-manual/start:accessing index of releases`" section. You can use the "RELEASE ARCHIVE" link to reveal a menu of all Yocto Project releases. -4. *Download Tools or Board Support Packages (BSPs):* From the +#. *Download Tools or Board Support Packages (BSPs):* From the "DOWNLOADS" page, you can download tools or BSPs as well. Just scroll down the page and look for what you need. @@ -707,10 +707,10 @@ Cloning the ``poky`` Repository Follow these steps to create a local version of the upstream :term:`Poky` Git repository. -1. *Set Your Directory:* Change your working directory to where you want +#. *Set Your Directory:* Change your working directory to where you want to create your local copy of ``poky``. -2. *Clone the Repository:* The following example command clones the +#. *Clone the Repository:* The following example command clones the ``poky`` repository and uses the default name "poky" for your local repository:: @@ -766,13 +766,13 @@ and then specifically check out that development branch. Further development on top of the branch that occurs after check it out can occur. -1. *Switch to the Poky Directory:* If you have a local poky Git +#. *Switch to the Poky Directory:* If you have a local poky Git repository, switch to that directory. If you do not have the local copy of poky, see the ":ref:`dev-manual/start:cloning the \`\`poky\`\` repository`" section. -2. *Determine Existing Branch Names:* +#. *Determine Existing Branch Names:* :: $ git branch -a @@ -793,7 +793,7 @@ and then specifically check out that development branch. remotes/origin/zeus-next ... and so on ... -3. *Check out the Branch:* Check out the development branch in which you +#. *Check out the Branch:* Check out the development branch in which you want to work. For example, to access the files for the Yocto Project &DISTRO; Release (&DISTRO_NAME;), use the following command:: @@ -827,19 +827,19 @@ similar to checking out by branch name except you use tag names. Checking out a branch based on a tag gives you a stable set of files not affected by development on the branch above the tag. -1. *Switch to the Poky Directory:* If you have a local poky Git +#. *Switch to the Poky Directory:* If you have a local poky Git repository, switch to that directory. If you do not have the local copy of poky, see the ":ref:`dev-manual/start:cloning the \`\`poky\`\` repository`" section. -2. *Fetch the Tag Names:* To checkout the branch based on a tag name, +#. *Fetch the Tag Names:* To checkout the branch based on a tag name, you need to fetch the upstream tags into your local repository:: $ git fetch --tags $ -3. *List the Tag Names:* You can list the tag names now:: +#. *List the Tag Names:* You can list the tag names now:: $ git tag 1.1_M1.final @@ -861,7 +861,7 @@ similar to checking out by branch name except you use tag names. yocto_1.5_M5.rc8 -4. *Check out the Branch:* +#. *Check out the Branch:* :: $ git checkout tags/yocto-&DISTRO; -b my_yocto_&DISTRO; diff --git a/poky/documentation/dev-manual/temporary-source-code.rst b/poky/documentation/dev-manual/temporary-source-code.rst new file mode 100644 index 0000000000..08bf68d982 --- /dev/null +++ b/poky/documentation/dev-manual/temporary-source-code.rst @@ -0,0 +1,66 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Finding Temporary Source Code +***************************** + +You might find it helpful during development to modify the temporary +source code used by recipes to build packages. For example, suppose you +are developing a patch and you need to experiment a bit to figure out +your solution. After you have initially built the package, you can +iteratively tweak the source code, which is located in the +:term:`Build Directory`, and then you can force a re-compile and quickly +test your altered code. Once you settle on a solution, you can then preserve +your changes in the form of patches. + +During a build, the unpacked temporary source code used by recipes to +build packages is available in the :term:`Build Directory` as defined by the +:term:`S` variable. Below is the default value for the :term:`S` variable as +defined in the ``meta/conf/bitbake.conf`` configuration file in the +:term:`Source Directory`:: + + S = "${WORKDIR}/${BP}" + +You should be aware that many recipes override the +:term:`S` variable. For example, recipes that fetch their source from Git +usually set :term:`S` to ``${WORKDIR}/git``. + +.. note:: + + The :term:`BP` represents the base recipe name, which consists of the name + and version:: + + BP = "${BPN}-${PV}" + + +The path to the work directory for the recipe +(:term:`WORKDIR`) is defined as +follows:: + + ${TMPDIR}/work/${MULTIMACH_TARGET_SYS}/${PN}/${EXTENDPE}${PV}-${PR} + +The actual directory depends on several things: + +- :term:`TMPDIR`: The top-level build + output directory. + +- :term:`MULTIMACH_TARGET_SYS`: + The target system identifier. + +- :term:`PN`: The recipe name. + +- :term:`EXTENDPE`: The epoch --- if + :term:`PE` is not specified, which is + usually the case for most recipes, then :term:`EXTENDPE` is blank. + +- :term:`PV`: The recipe version. + +- :term:`PR`: The recipe revision. + +As an example, assume a Source Directory top-level folder named +``poky``, a default :term:`Build Directory` at ``poky/build``, and a +``qemux86-poky-linux`` machine target system. Furthermore, suppose your +recipe is named ``foo_1.3.0.bb``. In this case, the work directory the +build system uses to build the package would be as follows:: + + poky/build/tmp/work/qemux86-poky-linux/foo/1.3.0-r0 + diff --git a/poky/documentation/dev-manual/upgrading-recipes.rst b/poky/documentation/dev-manual/upgrading-recipes.rst new file mode 100644 index 0000000000..13133fddcf --- /dev/null +++ b/poky/documentation/dev-manual/upgrading-recipes.rst @@ -0,0 +1,397 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Upgrading Recipes +***************** + +Over time, upstream developers publish new versions for software built +by layer recipes. It is recommended to keep recipes up-to-date with +upstream version releases. + +While there are several methods to upgrade a recipe, you might +consider checking on the upgrade status of a recipe first. You can do so +using the ``devtool check-upgrade-status`` command. See the +":ref:`devtool-checking-on-the-upgrade-status-of-a-recipe`" +section in the Yocto Project Reference Manual for more information. + +The remainder of this section describes three ways you can upgrade a +recipe. You can use the Automated Upgrade Helper (AUH) to set up +automatic version upgrades. Alternatively, you can use +``devtool upgrade`` to set up semi-automatic version upgrades. Finally, +you can manually upgrade a recipe by editing the recipe itself. + +Using the Auto Upgrade Helper (AUH) +=================================== + +The AUH utility works in conjunction with the OpenEmbedded build system +in order to automatically generate upgrades for recipes based on new +versions being published upstream. Use AUH when you want to create a +service that performs the upgrades automatically and optionally sends +you an email with the results. + +AUH allows you to update several recipes with a single use. You can also +optionally perform build and integration tests using images with the +results saved to your hard drive and emails of results optionally sent +to recipe maintainers. Finally, AUH creates Git commits with appropriate +commit messages in the layer's tree for the changes made to recipes. + +.. note:: + + In some conditions, you should not use AUH to upgrade recipes + and should instead use either ``devtool upgrade`` or upgrade your + recipes manually: + + - When AUH cannot complete the upgrade sequence. This situation + usually results because custom patches carried by the recipe + cannot be automatically rebased to the new version. In this case, + ``devtool upgrade`` allows you to manually resolve conflicts. + + - When for any reason you want fuller control over the upgrade + process. For example, when you want special arrangements for + testing. + +The following steps describe how to set up the AUH utility: + +#. *Be Sure the Development Host is Set Up:* You need to be sure that + your development host is set up to use the Yocto Project. For + information on how to set up your host, see the + ":ref:`dev-manual/start:Preparing the Build Host`" section. + +#. *Make Sure Git is Configured:* The AUH utility requires Git to be + configured because AUH uses Git to save upgrades. Thus, you must have + Git user and email configured. The following command shows your + configurations:: + + $ git config --list + + If you do not have the user and + email configured, you can use the following commands to do so:: + + $ git config --global user.name some_name + $ git config --global user.email username@domain.com + +#. *Clone the AUH Repository:* To use AUH, you must clone the repository + onto your development host. The following command uses Git to create + a local copy of the repository on your system:: + + $ git clone git://git.yoctoproject.org/auto-upgrade-helper + Cloning into 'auto-upgrade-helper'... remote: Counting objects: 768, done. + remote: Compressing objects: 100% (300/300), done. + remote: Total 768 (delta 499), reused 703 (delta 434) + Receiving objects: 100% (768/768), 191.47 KiB | 98.00 KiB/s, done. + Resolving deltas: 100% (499/499), done. + Checking connectivity... done. + + AUH is not part of the :term:`OpenEmbedded-Core (OE-Core)` or + :term:`Poky` repositories. + +#. *Create a Dedicated Build Directory:* Run the :ref:`structure-core-script` + script to create a fresh :term:`Build Directory` that you use exclusively + for running the AUH utility:: + + $ cd poky + $ source oe-init-build-env your_AUH_build_directory + + Re-using an existing :term:`Build Directory` and its configurations is not + recommended as existing settings could cause AUH to fail or behave + undesirably. + +#. *Make Configurations in Your Local Configuration File:* Several + settings are needed in the ``local.conf`` file in the build + directory you just created for AUH. Make these following + configurations: + + - If you want to enable :ref:`Build + History `, + which is optional, you need the following lines in the + ``conf/local.conf`` file:: + + INHERIT =+ "buildhistory" + BUILDHISTORY_COMMIT = "1" + + With this configuration and a successful + upgrade, a build history "diff" file appears in the + ``upgrade-helper/work/recipe/buildhistory-diff.txt`` file found in + your :term:`Build Directory`. + + - If you want to enable testing through the :ref:`ref-classes-testimage` + class, which is optional, you need to have the following set in + your ``conf/local.conf`` file:: + + INHERIT += "testimage" + + .. note:: + + If your distro does not enable by default ptest, which Poky + does, you need the following in your ``local.conf`` file:: + + DISTRO_FEATURES:append = " ptest" + + +#. *Optionally Start a vncserver:* If you are running in a server + without an X11 session, you need to start a vncserver:: + + $ vncserver :1 + $ export DISPLAY=:1 + +#. *Create and Edit an AUH Configuration File:* You need to have the + ``upgrade-helper/upgrade-helper.conf`` configuration file in your + :term:`Build Directory`. You can find a sample configuration file in the + :yocto_git:`AUH source repository `. + + Read through the sample file and make configurations as needed. For + example, if you enabled build history in your ``local.conf`` as + described earlier, you must enable it in ``upgrade-helper.conf``. + + Also, if you are using the default ``maintainers.inc`` file supplied + with Poky and located in ``meta-yocto`` and you do not set a + "maintainers_whitelist" or "global_maintainer_override" in the + ``upgrade-helper.conf`` configuration, and you specify "-e all" on + the AUH command-line, the utility automatically sends out emails to + all the default maintainers. Please avoid this. + +This next set of examples describes how to use the AUH: + +- *Upgrading a Specific Recipe:* To upgrade a specific recipe, use the + following form:: + + $ upgrade-helper.py recipe_name + + For example, this command upgrades the ``xmodmap`` recipe:: + + $ upgrade-helper.py xmodmap + +- *Upgrading a Specific Recipe to a Particular Version:* To upgrade a + specific recipe to a particular version, use the following form:: + + $ upgrade-helper.py recipe_name -t version + + For example, this command upgrades the ``xmodmap`` recipe to version 1.2.3:: + + $ upgrade-helper.py xmodmap -t 1.2.3 + +- *Upgrading all Recipes to the Latest Versions and Suppressing Email + Notifications:* To upgrade all recipes to their most recent versions + and suppress the email notifications, use the following command:: + + $ upgrade-helper.py all + +- *Upgrading all Recipes to the Latest Versions and Send Email + Notifications:* To upgrade all recipes to their most recent versions + and send email messages to maintainers for each attempted recipe as + well as a status email, use the following command:: + + $ upgrade-helper.py -e all + +Once you have run the AUH utility, you can find the results in the AUH +:term:`Build Directory`:: + + ${BUILDDIR}/upgrade-helper/timestamp + +The AUH utility +also creates recipe update commits from successful upgrade attempts in +the layer tree. + +You can easily set up to run the AUH utility on a regular basis by using +a cron job. See the +:yocto_git:`weeklyjob.sh ` +file distributed with the utility for an example. + +Using ``devtool upgrade`` +========================= + +As mentioned earlier, an alternative method for upgrading recipes to +newer versions is to use +:doc:`devtool upgrade `. +You can read about ``devtool upgrade`` in general in the +":ref:`sdk-manual/extensible:use \`\`devtool upgrade\`\` to create a version of the recipe that supports a newer version of the software`" +section in the Yocto Project Application Development and the Extensible +Software Development Kit (eSDK) Manual. + +To see all the command-line options available with ``devtool upgrade``, +use the following help command:: + + $ devtool upgrade -h + +If you want to find out what version a recipe is currently at upstream +without any attempt to upgrade your local version of the recipe, you can +use the following command:: + + $ devtool latest-version recipe_name + +As mentioned in the previous section describing AUH, ``devtool upgrade`` +works in a less-automated manner than AUH. Specifically, +``devtool upgrade`` only works on a single recipe that you name on the +command line, cannot perform build and integration testing using images, +and does not automatically generate commits for changes in the source +tree. Despite all these "limitations", ``devtool upgrade`` updates the +recipe file to the new upstream version and attempts to rebase custom +patches contained by the recipe as needed. + +.. note:: + + AUH uses much of ``devtool upgrade`` behind the scenes making AUH somewhat + of a "wrapper" application for ``devtool upgrade``. + +A typical scenario involves having used Git to clone an upstream +repository that you use during build operations. Because you have built the +recipe in the past, the layer is likely added to your +configuration already. If for some reason, the layer is not added, you +could add it easily using the +":ref:`bitbake-layers `" +script. For example, suppose you use the ``nano.bb`` recipe from the +``meta-oe`` layer in the ``meta-openembedded`` repository. For this +example, assume that the layer has been cloned into following area:: + + /home/scottrif/meta-openembedded + +The following command from your :term:`Build Directory` adds the layer to +your build configuration (i.e. ``${BUILDDIR}/conf/bblayers.conf``):: + + $ bitbake-layers add-layer /home/scottrif/meta-openembedded/meta-oe + NOTE: Starting bitbake server... + Parsing recipes: 100% |##########################################| Time: 0:00:55 + Parsing of 1431 .bb files complete (0 cached, 1431 parsed). 2040 targets, 56 skipped, 0 masked, 0 errors. + Removing 12 recipes from the x86_64 sysroot: 100% |##############| Time: 0:00:00 + Removing 1 recipes from the x86_64_i586 sysroot: 100% |##########| Time: 0:00:00 + Removing 5 recipes from the i586 sysroot: 100% |#################| Time: 0:00:00 + Removing 5 recipes from the qemux86 sysroot: 100% |##############| Time: 0:00:00 + +For this example, assume that the ``nano.bb`` recipe that +is upstream has a 2.9.3 version number. However, the version in the +local repository is 2.7.4. The following command from your build +directory automatically upgrades the recipe for you:: + + $ devtool upgrade nano -V 2.9.3 + NOTE: Starting bitbake server... + NOTE: Creating workspace layer in /home/scottrif/poky/build/workspace + Parsing recipes: 100% |##########################################| Time: 0:00:46 + Parsing of 1431 .bb files complete (0 cached, 1431 parsed). 2040 targets, 56 skipped, 0 masked, 0 errors. + NOTE: Extracting current version source... + NOTE: Resolving any missing task queue dependencies + . + . + . + NOTE: Executing SetScene Tasks + NOTE: Executing RunQueue Tasks + NOTE: Tasks Summary: Attempted 74 tasks of which 72 didn't need to be rerun and all succeeded. + Adding changed files: 100% |#####################################| Time: 0:00:00 + NOTE: Upgraded source extracted to /home/scottrif/poky/build/workspace/sources/nano + NOTE: New recipe is /home/scottrif/poky/build/workspace/recipes/nano/nano_2.9.3.bb + +.. note:: + + Using the ``-V`` option is not necessary. Omitting the version number causes + ``devtool upgrade`` to upgrade the recipe to the most recent version. + +Continuing with this example, you can use ``devtool build`` to build the +newly upgraded recipe:: + + $ devtool build nano + NOTE: Starting bitbake server... + Loading cache: 100% |################################################################################################| Time: 0:00:01 + Loaded 2040 entries from dependency cache. + Parsing recipes: 100% |##############################################################################################| Time: 0:00:00 + Parsing of 1432 .bb files complete (1431 cached, 1 parsed). 2041 targets, 56 skipped, 0 masked, 0 errors. + NOTE: Resolving any missing task queue dependencies + . + . + . + NOTE: Executing SetScene Tasks + NOTE: Executing RunQueue Tasks + NOTE: nano: compiling from external source tree /home/scottrif/poky/build/workspace/sources/nano + NOTE: Tasks Summary: Attempted 520 tasks of which 304 didn't need to be rerun and all succeeded. + +Within the ``devtool upgrade`` workflow, you can +deploy and test your rebuilt software. For this example, +however, running ``devtool finish`` cleans up the workspace once the +source in your workspace is clean. This usually means using Git to stage +and submit commits for the changes generated by the upgrade process. + +Once the tree is clean, you can clean things up in this example with the +following command from the ``${BUILDDIR}/workspace/sources/nano`` +directory:: + + $ devtool finish nano meta-oe + NOTE: Starting bitbake server... + Loading cache: 100% |################################################################################################| Time: 0:00:00 + Loaded 2040 entries from dependency cache. + Parsing recipes: 100% |##############################################################################################| Time: 0:00:01 + Parsing of 1432 .bb files complete (1431 cached, 1 parsed). 2041 targets, 56 skipped, 0 masked, 0 errors. + NOTE: Adding new patch 0001-nano.bb-Stuff-I-changed-when-upgrading-nano.bb.patch + NOTE: Updating recipe nano_2.9.3.bb + NOTE: Removing file /home/scottrif/meta-openembedded/meta-oe/recipes-support/nano/nano_2.7.4.bb + NOTE: Moving recipe file to /home/scottrif/meta-openembedded/meta-oe/recipes-support/nano + NOTE: Leaving source tree /home/scottrif/poky/build/workspace/sources/nano as-is; if you no longer need it then please delete it manually + + +Using the ``devtool finish`` command cleans up the workspace and creates a patch +file based on your commits. The tool puts all patch files back into the +source directory in a sub-directory named ``nano`` in this case. + +Manually Upgrading a Recipe +=========================== + +If for some reason you choose not to upgrade recipes using +:ref:`dev-manual/upgrading-recipes:Using the Auto Upgrade Helper (AUH)` or +by :ref:`dev-manual/upgrading-recipes:Using \`\`devtool upgrade\`\``, +you can manually edit the recipe files to upgrade the versions. + +.. note:: + + Manually updating multiple recipes scales poorly and involves many + steps. The recommendation to upgrade recipe versions is through AUH + or ``devtool upgrade``, both of which automate some steps and provide + guidance for others needed for the manual process. + +To manually upgrade recipe versions, follow these general steps: + +#. *Change the Version:* Rename the recipe such that the version (i.e. + the :term:`PV` part of the recipe name) + changes appropriately. If the version is not part of the recipe name, + change the value as it is set for :term:`PV` within the recipe itself. + +#. *Update* :term:`SRCREV` *if Needed*: If the source code your recipe builds + is fetched from Git or some other version control system, update + :term:`SRCREV` to point to the + commit hash that matches the new version. + +#. *Build the Software:* Try to build the recipe using BitBake. Typical + build failures include the following: + + - License statements were updated for the new version. For this + case, you need to review any changes to the license and update the + values of :term:`LICENSE` and + :term:`LIC_FILES_CHKSUM` + as needed. + + .. note:: + + License changes are often inconsequential. For example, the + license text's copyright year might have changed. + + - Custom patches carried by the older version of the recipe might + fail to apply to the new version. For these cases, you need to + review the failures. Patches might not be necessary for the new + version of the software if the upgraded version has fixed those + issues. If a patch is necessary and failing, you need to rebase it + into the new version. + +#. *Optionally Attempt to Build for Several Architectures:* Once you + successfully build the new software for a given architecture, you + could test the build for other architectures by changing the + :term:`MACHINE` variable and + rebuilding the software. This optional step is especially important + if the recipe is to be released publicly. + +#. *Check the Upstream Change Log or Release Notes:* Checking both these + reveals if there are new features that could break + backwards-compatibility. If so, you need to take steps to mitigate or + eliminate that situation. + +#. *Optionally Create a Bootable Image and Test:* If you want, you can + test the new software by booting it onto actual hardware. + +#. *Create a Commit with the Change in the Layer Repository:* After all + builds work and any testing is successful, you can create commits for + any changes in the layer holding your upgraded recipe. + diff --git a/poky/documentation/dev-manual/vulnerabilities.rst b/poky/documentation/dev-manual/vulnerabilities.rst new file mode 100644 index 0000000000..0ee3ec52c5 --- /dev/null +++ b/poky/documentation/dev-manual/vulnerabilities.rst @@ -0,0 +1,214 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Checking for Vulnerabilities +**************************** + +Vulnerabilities in Poky and OE-Core +=================================== + +The Yocto Project has an infrastructure to track and address unfixed +known security vulnerabilities, as tracked by the public +:wikipedia:`Common Vulnerabilities and Exposures (CVE) ` +database. + +The Yocto Project maintains a `list of known vulnerabilities +`__ +for packages in Poky and OE-Core, tracking the evolution of the number of +unpatched CVEs and the status of patches. Such information is available for +the current development version and for each supported release. + +Security is a process, not a product, and thus at any time, a number of security +issues may be impacting Poky and OE-Core. It is up to the maintainers, users, +contributors and anyone interested in the issues to investigate and possibly fix them by +updating software components to newer versions or by applying patches to address them. +It is recommended to work with Poky and OE-Core upstream maintainers and submit +patches to fix them, see ":ref:`dev-manual/changes:submitting a change to the yocto project`" for details. + +Vulnerability check at build time +================================= + +To enable a check for CVE security vulnerabilities using +:ref:`ref-classes-cve-check` in the specific image or target you are building, +add the following setting to your configuration:: + + INHERIT += "cve-check" + +The CVE database contains some old incomplete entries which have been +deemed not to impact Poky or OE-Core. These CVE entries can be excluded from the +check using build configuration:: + + include conf/distro/include/cve-extra-exclusions.inc + +With this CVE check enabled, BitBake build will try to map each compiled software component +recipe name and version information to the CVE database and generate recipe and +image specific reports. These reports will contain: + +- metadata about the software component like names and versions + +- metadata about the CVE issue such as description and NVD link + +- for each software component, a list of CVEs which are possibly impacting this version + +- status of each CVE: ``Patched``, ``Unpatched`` or ``Ignored`` + +The status ``Patched`` means that a patch file to address the security issue has been +applied. ``Unpatched`` status means that no patches to address the issue have been +applied and that the issue needs to be investigated. ``Ignored`` means that after +analysis, it has been deemed to ignore the issue as it for example affects +the software component on a different operating system platform. + +After a build with CVE check enabled, reports for each compiled source recipe will be +found in ``build/tmp/deploy/cve``. + +For example the CVE check report for the ``flex-native`` recipe looks like:: + + $ cat poky/build/tmp/deploy/cve/flex-native + LAYER: meta + PACKAGE NAME: flex-native + PACKAGE VERSION: 2.6.4 + CVE: CVE-2016-6354 + CVE STATUS: Patched + CVE SUMMARY: Heap-based buffer overflow in the yy_get_next_buffer function in Flex before 2.6.1 might allow context-dependent attackers to cause a denial of service or possibly execute arbitrary code via vectors involving num_to_read. + CVSS v2 BASE SCORE: 7.5 + CVSS v3 BASE SCORE: 9.8 + VECTOR: NETWORK + MORE INFORMATION: https://nvd.nist.gov/vuln/detail/CVE-2016-6354 + + LAYER: meta + PACKAGE NAME: flex-native + PACKAGE VERSION: 2.6.4 + CVE: CVE-2019-6293 + CVE STATUS: Ignored + CVE SUMMARY: An issue was discovered in the function mark_beginning_as_normal in nfa.c in flex 2.6.4. There is a stack exhaustion problem caused by the mark_beginning_as_normal function making recursive calls to itself in certain scenarios involving lots of '*' characters. Remote attackers could leverage this vulnerability to cause a denial-of-service. + CVSS v2 BASE SCORE: 4.3 + CVSS v3 BASE SCORE: 5.5 + VECTOR: NETWORK + MORE INFORMATION: https://nvd.nist.gov/vuln/detail/CVE-2019-6293 + +For images, a summary of all recipes included in the image and their CVEs is also +generated in textual and JSON formats. These ``.cve`` and ``.json`` reports can be found +in the ``tmp/deploy/images`` directory for each compiled image. + +At build time CVE check will also throw warnings about ``Unpatched`` CVEs:: + + WARNING: flex-2.6.4-r0 do_cve_check: Found unpatched CVE (CVE-2019-6293), for more information check /poky/build/tmp/work/core2-64-poky-linux/flex/2.6.4-r0/temp/cve.log + WARNING: libarchive-3.5.1-r0 do_cve_check: Found unpatched CVE (CVE-2021-36976), for more information check /poky/build/tmp/work/core2-64-poky-linux/libarchive/3.5.1-r0/temp/cve.log + +It is also possible to check the CVE status of individual packages as follows:: + + bitbake -c cve_check flex libarchive + +Fixing CVE product name and version mappings +============================================ + +By default, :ref:`ref-classes-cve-check` uses the recipe name :term:`BPN` as CVE +product name when querying the CVE database. If this mapping contains false positives, e.g. +some reported CVEs are not for the software component in question, or false negatives like +some CVEs are not found to impact the recipe when they should, then the problems can be +in the recipe name to CVE product mapping. These mapping issues can be fixed by setting +the :term:`CVE_PRODUCT` variable inside the recipe. This defines the name of the software component in the +upstream `NIST CVE database `__. + +The variable supports using vendor and product names like this:: + + CVE_PRODUCT = "flex_project:flex" + +In this example the vendor name used in the CVE database is ``flex_project`` and the +product is ``flex``. With this setting the ``flex`` recipe only maps to this specific +product and not products from other vendors with same name ``flex``. + +Similarly, when the recipe version :term:`PV` is not compatible with software versions used by +the upstream software component releases and the CVE database, these can be fixed using +the :term:`CVE_VERSION` variable. + +Note that if the CVE entries in the NVD database contain bugs or have missing or incomplete +information, it is recommended to fix the information there directly instead of working +around the issues possibly for a long time in Poky and OE-Core side recipes. Feedback to +NVD about CVE entries can be provided through the `NVD contact form `__. + +Fixing vulnerabilities in recipes +================================= + +If a CVE security issue impacts a software component, it can be fixed by updating to a newer +version of the software component or by applying a patch. For Poky and OE-Core master branches, updating +to a newer software component release with fixes is the best option, but patches can be applied +if releases are not yet available. + +For stable branches, it is preferred to apply patches for the issues. For some software +components minor version updates can also be applied if they are backwards compatible. + +Here is an example of fixing CVE security issues with patch files, +an example from the :oe_layerindex:`ffmpeg recipe`:: + + SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ + file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ + file://fix-CVE-2020-20446.patch \ + file://fix-CVE-2020-20453.patch \ + file://fix-CVE-2020-22015.patch \ + file://fix-CVE-2020-22021.patch \ + file://fix-CVE-2020-22033-CVE-2020-22019.patch \ + file://fix-CVE-2021-33815.patch \ + +A good practice is to include the CVE identifier in both the patch file name +and inside the patch file commit message using the format:: + + CVE: CVE-2020-22033 + +CVE checker will then capture this information and change the CVE status to ``Patched`` +in the generated reports. + +If analysis shows that the CVE issue does not impact the recipe due to configuration, platform, +version or other reasons, the CVE can be marked as ``Ignored`` using the :term:`CVE_CHECK_IGNORE` variable. +As mentioned previously, if data in the CVE database is wrong, it is recommend to fix those +issues in the CVE database directly. + +Recipes can be completely skipped by CVE check by including the recipe name in +the :term:`CVE_CHECK_SKIP_RECIPE` variable. + +Implementation details +====================== + +Here's what the :ref:`ref-classes-cve-check` class does to find unpatched CVE IDs. + +First the code goes through each patch file provided by a recipe. If a valid CVE ID +is found in the name of the file, the corresponding CVE is considered as patched. +Don't forget that if multiple CVE IDs are found in the filename, only the last +one is considered. Then, the code looks for ``CVE: CVE-ID`` lines in the patch +file. The found CVE IDs are also considered as patched. + +Then, the code looks up all the CVE IDs in the NIST database for all the +products defined in :term:`CVE_PRODUCT`. Then, for each found CVE: + +- If the package name (:term:`PN`) is part of + :term:`CVE_CHECK_SKIP_RECIPE`, it is considered as ``Patched``. + +- If the CVE ID is part of :term:`CVE_CHECK_IGNORE`, it is + set as ``Ignored``. + +- If the CVE ID is part of the patched CVE for the recipe, it is + already considered as ``Patched``. + +- Otherwise, the code checks whether the recipe version (:term:`PV`) + is within the range of versions impacted by the CVE. If so, the CVE + is considered as ``Unpatched``. + +The CVE database is stored in :term:`DL_DIR` and can be inspected using +``sqlite3`` command as follows:: + + sqlite3 downloads/CVE_CHECK/nvdcve_1.1.db .dump | grep CVE-2021-37462 + +When analyzing CVEs, it is recommended to: + +- study the latest information in `CVE database `__. + +- check how upstream developers of the software component addressed the issue, e.g. + what patch was applied, which upstream release contains the fix. + +- check what other Linux distributions like `Debian `__ + did to analyze and address the issue. + +- follow security notices from other Linux distributions. + +- follow public `open source security mailing lists `__ for + discussions and advance notifications of CVE bugs and software releases with fixes. + diff --git a/poky/documentation/dev-manual/wayland.rst b/poky/documentation/dev-manual/wayland.rst new file mode 100644 index 0000000000..097be9cbde --- /dev/null +++ b/poky/documentation/dev-manual/wayland.rst @@ -0,0 +1,90 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Using Wayland and Weston +************************ + +:wikipedia:`Wayland ` +is a computer display server protocol that provides a method for +compositing window managers to communicate directly with applications +and video hardware and expects them to communicate with input hardware +using other libraries. Using Wayland with supporting targets can result +in better control over graphics frame rendering than an application +might otherwise achieve. + +The Yocto Project provides the Wayland protocol libraries and the +reference :wikipedia:`Weston ` +compositor as part of its release. You can find the integrated packages +in the ``meta`` layer of the :term:`Source Directory`. +Specifically, you +can find the recipes that build both Wayland and Weston at +``meta/recipes-graphics/wayland``. + +You can build both the Wayland and Weston packages for use only with targets +that accept the :wikipedia:`Mesa 3D and Direct Rendering Infrastructure +`, which is also known as Mesa DRI. This implies that +you cannot build and use the packages if your target uses, for example, the +Intel Embedded Media and Graphics Driver (Intel EMGD) that overrides Mesa DRI. + +.. note:: + + Due to lack of EGL support, Weston 1.0.3 will not run directly on the + emulated QEMU hardware. However, this version of Weston will run + under X emulation without issues. + +This section describes what you need to do to implement Wayland and use +the Weston compositor when building an image for a supporting target. + +Enabling Wayland in an Image +============================ + +To enable Wayland, you need to enable it to be built and enable it to be +included (installed) in the image. + +Building Wayland +---------------- + +To cause Mesa to build the ``wayland-egl`` platform and Weston to build +Wayland with Kernel Mode Setting +(`KMS `__) +support, include the "wayland" flag in the +:term:`DISTRO_FEATURES` +statement in your ``local.conf`` file:: + + DISTRO_FEATURES:append = " wayland" + +.. note:: + + If X11 has been enabled elsewhere, Weston will build Wayland with X11 + support + +Installing Wayland and Weston +----------------------------- + +To install the Wayland feature into an image, you must include the +following +:term:`CORE_IMAGE_EXTRA_INSTALL` +statement in your ``local.conf`` file:: + + CORE_IMAGE_EXTRA_INSTALL += "wayland weston" + +Running Weston +============== + +To run Weston inside X11, enabling it as described earlier and building +a Sato image is sufficient. If you are running your image under Sato, a +Weston Launcher appears in the "Utility" category. + +Alternatively, you can run Weston through the command-line interpretor +(CLI), which is better suited for development work. To run Weston under +the CLI, you need to do the following after your image is built: + +#. Run these commands to export ``XDG_RUNTIME_DIR``:: + + mkdir -p /tmp/$USER-weston + chmod 0700 /tmp/$USER-weston + export XDG_RUNTIME_DIR=/tmp/$USER-weston + +#. Launch Weston in the shell:: + + weston + diff --git a/poky/documentation/dev-manual/wic.rst b/poky/documentation/dev-manual/wic.rst new file mode 100644 index 0000000000..a8d2f46955 --- /dev/null +++ b/poky/documentation/dev-manual/wic.rst @@ -0,0 +1,729 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Creating Partitioned Images Using Wic +************************************* + +Creating an image for a particular hardware target using the +OpenEmbedded build system does not necessarily mean you can boot that +image as is on your device. Physical devices accept and boot images in +various ways depending on the specifics of the device. Usually, +information about the hardware can tell you what image format the device +requires. Should your device require multiple partitions on an SD card, +flash, or an HDD, you can use the OpenEmbedded Image Creator, Wic, to +create the properly partitioned image. + +The ``wic`` command generates partitioned images from existing +OpenEmbedded build artifacts. Image generation is driven by partitioning +commands contained in an OpenEmbedded kickstart file (``.wks``) +specified either directly on the command line or as one of a selection +of canned kickstart files as shown with the ``wic list images`` command +in the +":ref:`dev-manual/wic:generate an image using an existing kickstart file`" +section. When you apply the command to a given set of build artifacts, the +result is an image or set of images that can be directly written onto media and +used on a particular system. + +.. note:: + + For a kickstart file reference, see the + ":ref:`ref-manual/kickstart:openembedded kickstart (\`\`.wks\`\`) reference`" + Chapter in the Yocto Project Reference Manual. + +The ``wic`` command and the infrastructure it is based on is by +definition incomplete. The purpose of the command is to allow the +generation of customized images, and as such, was designed to be +completely extensible through a plugin interface. See the +":ref:`dev-manual/wic:using the wic plugin interface`" section +for information on these plugins. + +This section provides some background information on Wic, describes what +you need to have in place to run the tool, provides instruction on how +to use the Wic utility, provides information on using the Wic plugins +interface, and provides several examples that show how to use Wic. + +Background +========== + +This section provides some background on the Wic utility. While none of +this information is required to use Wic, you might find it interesting. + +- The name "Wic" is derived from OpenEmbedded Image Creator (oeic). The + "oe" diphthong in "oeic" was promoted to the letter "w", because + "oeic" is both difficult to remember and to pronounce. + +- Wic is loosely based on the Meego Image Creator (``mic``) framework. + The Wic implementation has been heavily modified to make direct use + of OpenEmbedded build artifacts instead of package installation and + configuration, which are already incorporated within the OpenEmbedded + artifacts. + +- Wic is a completely independent standalone utility that initially + provides easier-to-use and more flexible replacements for an existing + functionality in OE-Core's :ref:`ref-classes-image-live` + class. The difference between Wic and those examples is that with Wic + the functionality of those scripts is implemented by a + general-purpose partitioning language, which is based on Redhat + kickstart syntax. + +Requirements +============ + +In order to use the Wic utility with the OpenEmbedded Build system, your +system needs to meet the following requirements: + +- The Linux distribution on your development host must support the + Yocto Project. See the ":ref:`detailed-supported-distros`" + section in the Yocto Project Reference Manual for the list of + distributions that support the Yocto Project. + +- The standard system utilities, such as ``cp``, must be installed on + your development host system. + +- You must have sourced the build environment setup script (i.e. + :ref:`structure-core-script`) found in the :term:`Build Directory`. + +- You need to have the build artifacts already available, which + typically means that you must have already created an image using the + OpenEmbedded build system (e.g. ``core-image-minimal``). While it + might seem redundant to generate an image in order to create an image + using Wic, the current version of Wic requires the artifacts in the + form generated by the OpenEmbedded build system. + +- You must build several native tools, which are built to run on the + build system:: + + $ bitbake parted-native dosfstools-native mtools-native + +- Include "wic" as part of the + :term:`IMAGE_FSTYPES` + variable. + +- Include the name of the :ref:`wic kickstart file ` + as part of the :term:`WKS_FILE` variable. If multiple candidate files can + be provided by different layers, specify all the possible names through the + :term:`WKS_FILES` variable instead. + +Getting Help +============ + +You can get general help for the ``wic`` command by entering the ``wic`` +command by itself or by entering the command with a help argument as +follows:: + + $ wic -h + $ wic --help + $ wic help + +Currently, Wic supports seven commands: ``cp``, ``create``, ``help``, +``list``, ``ls``, ``rm``, and ``write``. You can get help for all these +commands except "help" by using the following form:: + + $ wic help command + +For example, the following command returns help for the ``write`` +command:: + + $ wic help write + +Wic supports help for three topics: ``overview``, ``plugins``, and +``kickstart``. You can get help for any topic using the following form:: + + $ wic help topic + +For example, the following returns overview help for Wic:: + + $ wic help overview + +There is one additional level of help for Wic. You can get help on +individual images through the ``list`` command. You can use the ``list`` +command to return the available Wic images as follows:: + + $ wic list images + genericx86 Create an EFI disk image for genericx86* + edgerouter Create SD card image for Edgerouter + beaglebone-yocto Create SD card image for Beaglebone + qemux86-directdisk Create a qemu machine 'pcbios' direct disk image + systemd-bootdisk Create an EFI disk image with systemd-boot + mkhybridiso Create a hybrid ISO image + mkefidisk Create an EFI disk image + sdimage-bootpart Create SD card image with a boot partition + directdisk-multi-rootfs Create multi rootfs image using rootfs plugin + directdisk Create a 'pcbios' direct disk image + directdisk-bootloader-config Create a 'pcbios' direct disk image with custom bootloader config + qemuriscv Create qcow2 image for RISC-V QEMU machines + directdisk-gpt Create a 'pcbios' direct disk image + efi-bootdisk + +Once you know the list of available +Wic images, you can use ``help`` with the command to get help on a +particular image. For example, the following command returns help on the +"beaglebone-yocto" image:: + + $ wic list beaglebone-yocto help + + Creates a partitioned SD card image for Beaglebone. + Boot files are located in the first vfat partition. + +Operational Modes +================= + +You can use Wic in two different modes, depending on how much control +you need for specifying the OpenEmbedded build artifacts that are used +for creating the image: Raw and Cooked: + +- *Raw Mode:* You explicitly specify build artifacts through Wic + command-line arguments. + +- *Cooked Mode:* The current + :term:`MACHINE` setting and image + name are used to automatically locate and provide the build + artifacts. You just supply a kickstart file and the name of the image + from which to use artifacts. + +Regardless of the mode you use, you need to have the build artifacts +ready and available. + +Raw Mode +-------- + +Running Wic in raw mode allows you to specify all the partitions through +the ``wic`` command line. The primary use for raw mode is if you have +built your kernel outside of the Yocto Project :term:`Build Directory`. +In other words, you can point to arbitrary kernel, root filesystem locations, +and so forth. Contrast this behavior with cooked mode where Wic looks in the +:term:`Build Directory` (e.g. ``tmp/deploy/images/``\ machine). + +The general form of the ``wic`` command in raw mode is:: + + $ wic create wks_file options ... + + Where: + + wks_file: + An OpenEmbedded kickstart file. You can provide + your own custom file or use a file from a set of + existing files as described by further options. + + optional arguments: + -h, --help show this help message and exit + -o OUTDIR, --outdir OUTDIR + name of directory to create image in + -e IMAGE_NAME, --image-name IMAGE_NAME + name of the image to use the artifacts from e.g. core- + image-sato + -r ROOTFS_DIR, --rootfs-dir ROOTFS_DIR + path to the /rootfs dir to use as the .wks rootfs + source + -b BOOTIMG_DIR, --bootimg-dir BOOTIMG_DIR + path to the dir containing the boot artifacts (e.g. + /EFI or /syslinux dirs) to use as the .wks bootimg + source + -k KERNEL_DIR, --kernel-dir KERNEL_DIR + path to the dir containing the kernel to use in the + .wks bootimg + -n NATIVE_SYSROOT, --native-sysroot NATIVE_SYSROOT + path to the native sysroot containing the tools to use + to build the image + -s, --skip-build-check + skip the build check + -f, --build-rootfs build rootfs + -c {gzip,bzip2,xz}, --compress-with {gzip,bzip2,xz} + compress image with specified compressor + -m, --bmap generate .bmap + --no-fstab-update Do not change fstab file. + -v VARS_DIR, --vars VARS_DIR + directory with .env files that store bitbake + variables + -D, --debug output debug information + +.. note:: + + You do not need root privileges to run Wic. In fact, you should not + run as root when using the utility. + +Cooked Mode +----------- + +Running Wic in cooked mode leverages off artifacts in the +:term:`Build Directory`. In other words, you do not have to specify kernel or +root filesystem locations as part of the command. All you need to provide is +a kickstart file and the name of the image from which to use artifacts +by using the "-e" option. Wic looks in the :term:`Build Directory` (e.g. +``tmp/deploy/images/``\ machine) for artifacts. + +The general form of the ``wic`` command using Cooked Mode is as follows:: + + $ wic create wks_file -e IMAGE_NAME + + Where: + + wks_file: + An OpenEmbedded kickstart file. You can provide + your own custom file or use a file from a set of + existing files provided with the Yocto Project + release. + + required argument: + -e IMAGE_NAME, --image-name IMAGE_NAME + name of the image to use the artifacts from e.g. core- + image-sato + +Using an Existing Kickstart File +================================ + +If you do not want to create your own kickstart file, you can use an +existing file provided by the Wic installation. As shipped, kickstart +files can be found in the :ref:`overview-manual/development-environment:yocto project source repositories` in the +following two locations:: + + poky/meta-yocto-bsp/wic + poky/scripts/lib/wic/canned-wks + +Use the following command to list the available kickstart files:: + + $ wic list images + genericx86 Create an EFI disk image for genericx86* + beaglebone-yocto Create SD card image for Beaglebone + edgerouter Create SD card image for Edgerouter + qemux86-directdisk Create a QEMU machine 'pcbios' direct disk image + directdisk-gpt Create a 'pcbios' direct disk image + mkefidisk Create an EFI disk image + directdisk Create a 'pcbios' direct disk image + systemd-bootdisk Create an EFI disk image with systemd-boot + mkhybridiso Create a hybrid ISO image + sdimage-bootpart Create SD card image with a boot partition + directdisk-multi-rootfs Create multi rootfs image using rootfs plugin + directdisk-bootloader-config Create a 'pcbios' direct disk image with custom bootloader config + +When you use an existing file, you +do not have to use the ``.wks`` extension. Here is an example in Raw +Mode that uses the ``directdisk`` file:: + + $ wic create directdisk -r rootfs_dir -b bootimg_dir \ + -k kernel_dir -n native_sysroot + +Here are the actual partition language commands used in the +``genericx86.wks`` file to generate an image:: + + # short-description: Create an EFI disk image for genericx86* + # long-description: Creates a partitioned EFI disk image for genericx86* machines + part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 + part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid + part swap --ondisk sda --size 44 --label swap1 --fstype=swap + + bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0" + +Using the Wic Plugin Interface +============================== + +You can extend and specialize Wic functionality by using Wic plugins. +This section explains the Wic plugin interface. + +.. note:: + + Wic plugins consist of "source" and "imager" plugins. Imager plugins + are beyond the scope of this section. + +Source plugins provide a mechanism to customize partition content during +the Wic image generation process. You can use source plugins to map +values that you specify using ``--source`` commands in kickstart files +(i.e. ``*.wks``) to a plugin implementation used to populate a given +partition. + +.. note:: + + If you use plugins that have build-time dependencies (e.g. native + tools, bootloaders, and so forth) when building a Wic image, you need + to specify those dependencies using the :term:`WKS_FILE_DEPENDS` + variable. + +Source plugins are subclasses defined in plugin files. As shipped, the +Yocto Project provides several plugin files. You can see the source +plugin files that ship with the Yocto Project +:yocto_git:`here `. +Each of these plugin files contains source plugins that are designed to +populate a specific Wic image partition. + +Source plugins are subclasses of the ``SourcePlugin`` class, which is +defined in the ``poky/scripts/lib/wic/pluginbase.py`` file. For example, +the ``BootimgEFIPlugin`` source plugin found in the ``bootimg-efi.py`` +file is a subclass of the ``SourcePlugin`` class, which is found in the +``pluginbase.py`` file. + +You can also implement source plugins in a layer outside of the Source +Repositories (external layer). To do so, be sure that your plugin files +are located in a directory whose path is +``scripts/lib/wic/plugins/source/`` within your external layer. When the +plugin files are located there, the source plugins they contain are made +available to Wic. + +When the Wic implementation needs to invoke a partition-specific +implementation, it looks for the plugin with the same name as the +``--source`` parameter used in the kickstart file given to that +partition. For example, if the partition is set up using the following +command in a kickstart file:: + + part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024 + +The methods defined as class +members of the matching source plugin (i.e. ``bootimg-pcbios``) in the +``bootimg-pcbios.py`` plugin file are used. + +To be more concrete, here is the corresponding plugin definition from +the ``bootimg-pcbios.py`` file for the previous command along with an +example method called by the Wic implementation when it needs to prepare +a partition using an implementation-specific function:: + + . + . + . + class BootimgPcbiosPlugin(SourcePlugin): + """ + Create MBR boot partition and install syslinux on it. + """ + + name = 'bootimg-pcbios' + . + . + . + @classmethod + def do_prepare_partition(cls, part, source_params, creator, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + In this case, prepare content for legacy bios boot partition. + """ + . + . + . + +If a +subclass (plugin) itself does not implement a particular function, Wic +locates and uses the default version in the superclass. It is for this +reason that all source plugins are derived from the ``SourcePlugin`` +class. + +The ``SourcePlugin`` class defined in the ``pluginbase.py`` file defines +a set of methods that source plugins can implement or override. Any +plugins (subclass of ``SourcePlugin``) that do not implement a +particular method inherit the implementation of the method from the +``SourcePlugin`` class. For more information, see the ``SourcePlugin`` +class in the ``pluginbase.py`` file for details: + +The following list describes the methods implemented in the +``SourcePlugin`` class: + +- ``do_prepare_partition()``: Called to populate a partition with + actual content. In other words, the method prepares the final + partition image that is incorporated into the disk image. + +- ``do_configure_partition()``: Called before + ``do_prepare_partition()`` to create custom configuration files for a + partition (e.g. syslinux or grub configuration files). + +- ``do_install_disk()``: Called after all partitions have been + prepared and assembled into a disk image. This method provides a hook + to allow finalization of a disk image (e.g. writing an MBR). + +- ``do_stage_partition()``: Special content-staging hook called + before ``do_prepare_partition()``. This method is normally empty. + + Typically, a partition just uses the passed-in parameters (e.g. the + unmodified value of ``bootimg_dir``). However, in some cases, things + might need to be more tailored. As an example, certain files might + additionally need to be taken from ``bootimg_dir + /boot``. This hook + allows those files to be staged in a customized fashion. + + .. note:: + + ``get_bitbake_var()`` allows you to access non-standard variables that + you might want to use for this behavior. + +You can extend the source plugin mechanism. To add more hooks, create +more source plugin methods within ``SourcePlugin`` and the corresponding +derived subclasses. The code that calls the plugin methods uses the +``plugin.get_source_plugin_methods()`` function to find the method or +methods needed by the call. Retrieval of those methods is accomplished +by filling up a dict with keys that contain the method names of +interest. On success, these will be filled in with the actual methods. +See the Wic implementation for examples and details. + +Wic Examples +============ + +This section provides several examples that show how to use the Wic +utility. All the examples assume the list of requirements in the +":ref:`dev-manual/wic:requirements`" section have been met. The +examples assume the previously generated image is +``core-image-minimal``. + +Generate an Image using an Existing Kickstart File +-------------------------------------------------- + +This example runs in Cooked Mode and uses the ``mkefidisk`` kickstart +file:: + + $ wic create mkefidisk -e core-image-minimal + INFO: Building wic-tools... + . + . + . + INFO: The new image(s) can be found here: + ./mkefidisk-201804191017-sda.direct + + The following build artifacts were used to create the image(s): + ROOTFS_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/rootfs + BOOTIMG_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share + KERNEL_DIR: /home/stephano/yocto/build/tmp-glibc/deploy/images/qemux86 + NATIVE_SYSROOT: /home/stephano/yocto/build/tmp-glibc/work/i586-oe-linux/wic-tools/1.0-r0/recipe-sysroot-native + + INFO: The image(s) were created using OE kickstart file: + /home/stephano/yocto/openembedded-core/scripts/lib/wic/canned-wks/mkefidisk.wks + +The previous example shows the easiest way to create an image by running +in cooked mode and supplying a kickstart file and the "-e" option to +point to the existing build artifacts. Your ``local.conf`` file needs to +have the :term:`MACHINE` variable set +to the machine you are using, which is "qemux86" in this example. + +Once the image builds, the output provides image location, artifact use, +and kickstart file information. + +.. note:: + + You should always verify the details provided in the output to make + sure that the image was indeed created exactly as expected. + +Continuing with the example, you can now write the image from the +:term:`Build Directory` onto a USB stick, or whatever media for which you +built your image, and boot from the media. You can write the image by using +``bmaptool`` or ``dd``:: + + $ oe-run-native bmap-tools-native bmaptool copy mkefidisk-201804191017-sda.direct /dev/sdX + +or :: + + $ sudo dd if=mkefidisk-201804191017-sda.direct of=/dev/sdX + +.. note:: + + For more information on how to use the ``bmaptool`` + to flash a device with an image, see the + ":ref:`dev-manual/bmaptool:flashing images using \`\`bmaptool\`\``" + section. + +Using a Modified Kickstart File +------------------------------- + +Because partitioned image creation is driven by the kickstart file, it +is easy to affect image creation by changing the parameters in the file. +This next example demonstrates that through modification of the +``directdisk-gpt`` kickstart file. + +As mentioned earlier, you can use the command ``wic list images`` to +show the list of existing kickstart files. The directory in which the +``directdisk-gpt.wks`` file resides is +``scripts/lib/image/canned-wks/``, which is located in the +:term:`Source Directory` (e.g. ``poky``). +Because available files reside in this directory, you can create and add +your own custom files to the directory. Subsequent use of the +``wic list images`` command would then include your kickstart files. + +In this example, the existing ``directdisk-gpt`` file already does most +of what is needed. However, for the hardware in this example, the image +will need to boot from ``sdb`` instead of ``sda``, which is what the +``directdisk-gpt`` kickstart file uses. + +The example begins by making a copy of the ``directdisk-gpt.wks`` file +in the ``scripts/lib/image/canned-wks`` directory and then by changing +the lines that specify the target disk from which to boot:: + + $ cp /home/stephano/yocto/poky/scripts/lib/wic/canned-wks/directdisk-gpt.wks \ + /home/stephano/yocto/poky/scripts/lib/wic/canned-wks/directdisksdb-gpt.wks + +Next, the example modifies the ``directdisksdb-gpt.wks`` file and +changes all instances of "``--ondisk sda``" to "``--ondisk sdb``". The +example changes the following two lines and leaves the remaining lines +untouched:: + + part /boot --source bootimg-pcbios --ondisk sdb --label boot --active --align 1024 + part / --source rootfs --ondisk sdb --fstype=ext4 --label platform --align 1024 --use-uuid + +Once the lines are changed, the +example generates the ``directdisksdb-gpt`` image. The command points +the process at the ``core-image-minimal`` artifacts for the Next Unit of +Computing (nuc) :term:`MACHINE` the +``local.conf``:: + + $ wic create directdisksdb-gpt -e core-image-minimal + INFO: Building wic-tools... + . + . + . + Initialising tasks: 100% |#######################################| Time: 0:00:01 + NOTE: Executing SetScene Tasks + NOTE: Executing RunQueue Tasks + NOTE: Tasks Summary: Attempted 1161 tasks of which 1157 didn't need to be rerun and all succeeded. + INFO: Creating image(s)... + + INFO: The new image(s) can be found here: + ./directdisksdb-gpt-201710090938-sdb.direct + + The following build artifacts were used to create the image(s): + ROOTFS_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/rootfs + BOOTIMG_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share + KERNEL_DIR: /home/stephano/yocto/build/tmp-glibc/deploy/images/qemux86 + NATIVE_SYSROOT: /home/stephano/yocto/build/tmp-glibc/work/i586-oe-linux/wic-tools/1.0-r0/recipe-sysroot-native + + INFO: The image(s) were created using OE kickstart file: + /home/stephano/yocto/poky/scripts/lib/wic/canned-wks/directdisksdb-gpt.wks + +Continuing with the example, you can now directly ``dd`` the image to a +USB stick, or whatever media for which you built your image, and boot +the resulting media:: + + $ sudo dd if=directdisksdb-gpt-201710090938-sdb.direct of=/dev/sdb + 140966+0 records in + 140966+0 records out + 72174592 bytes (72 MB, 69 MiB) copied, 78.0282 s, 925 kB/s + $ sudo eject /dev/sdb + +Using a Modified Kickstart File and Running in Raw Mode +------------------------------------------------------- + +This next example manually specifies each build artifact (runs in Raw +Mode) and uses a modified kickstart file. The example also uses the +``-o`` option to cause Wic to create the output somewhere other than the +default output directory, which is the current directory:: + + $ wic create test.wks -o /home/stephano/testwic \ + --rootfs-dir /home/stephano/yocto/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/rootfs \ + --bootimg-dir /home/stephano/yocto/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share \ + --kernel-dir /home/stephano/yocto/build/tmp/deploy/images/qemux86 \ + --native-sysroot /home/stephano/yocto/build/tmp/work/i586-poky-linux/wic-tools/1.0-r0/recipe-sysroot-native + + INFO: Creating image(s)... + + INFO: The new image(s) can be found here: + /home/stephano/testwic/test-201710091445-sdb.direct + + The following build artifacts were used to create the image(s): + ROOTFS_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/rootfs + BOOTIMG_DIR: /home/stephano/yocto/build/tmp-glibc/work/qemux86-oe-linux/core-image-minimal/1.0-r0/recipe-sysroot/usr/share + KERNEL_DIR: /home/stephano/yocto/build/tmp-glibc/deploy/images/qemux86 + NATIVE_SYSROOT: /home/stephano/yocto/build/tmp-glibc/work/i586-oe-linux/wic-tools/1.0-r0/recipe-sysroot-native + + INFO: The image(s) were created using OE kickstart file: + test.wks + +For this example, +:term:`MACHINE` did not have to be +specified in the ``local.conf`` file since the artifact is manually +specified. + +Using Wic to Manipulate an Image +-------------------------------- + +Wic image manipulation allows you to shorten turnaround time during +image development. For example, you can use Wic to delete the kernel +partition of a Wic image and then insert a newly built kernel. This +saves you time from having to rebuild the entire image each time you +modify the kernel. + +.. note:: + + In order to use Wic to manipulate a Wic image as in this example, + your development machine must have the ``mtools`` package installed. + +The following example examines the contents of the Wic image, deletes +the existing kernel, and then inserts a new kernel: + +#. *List the Partitions:* Use the ``wic ls`` command to list all the + partitions in the Wic image:: + + $ wic ls tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic + Num Start End Size Fstype + 1 1048576 25041919 23993344 fat16 + 2 25165824 72157183 46991360 ext4 + + The previous output shows two partitions in the + ``core-image-minimal-qemux86.wic`` image. + +#. *Examine a Particular Partition:* Use the ``wic ls`` command again + but in a different form to examine a particular partition. + + .. note:: + + You can get command usage on any Wic command using the following + form:: + + $ wic help command + + + For example, the following command shows you the various ways to + use the + wic ls + command:: + + $ wic help ls + + + The following command shows what is in partition one:: + + $ wic ls tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1 + Volume in drive : is boot + Volume Serial Number is E894-1809 + Directory for ::/ + + libcom32 c32 186500 2017-10-09 16:06 + libutil c32 24148 2017-10-09 16:06 + syslinux cfg 220 2017-10-09 16:06 + vesamenu c32 27104 2017-10-09 16:06 + vmlinuz 6904608 2017-10-09 16:06 + 5 files 7 142 580 bytes + 16 582 656 bytes free + + The previous output shows five files, with the + ``vmlinuz`` being the kernel. + + .. note:: + + If you see the following error, you need to update or create a + ``~/.mtoolsrc`` file and be sure to have the line "mtools_skip_check=1" + in the file. Then, run the Wic command again:: + + ERROR: _exec_cmd: /usr/bin/mdir -i /tmp/wic-parttfokuwra ::/ returned '1' instead of 0 + output: Total number of sectors (47824) not a multiple of sectors per track (32)! + Add mtools_skip_check=1 to your .mtoolsrc file to skip this test + + +#. *Remove the Old Kernel:* Use the ``wic rm`` command to remove the + ``vmlinuz`` file (kernel):: + + $ wic rm tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1/vmlinuz + +#. *Add In the New Kernel:* Use the ``wic cp`` command to add the + updated kernel to the Wic image. Depending on how you built your + kernel, it could be in different places. If you used ``devtool`` and + an SDK to build your kernel, it resides in the ``tmp/work`` directory + of the extensible SDK. If you used ``make`` to build the kernel, the + kernel will be in the ``workspace/sources`` area. + + The following example assumes ``devtool`` was used to build the + kernel:: + + $ wic cp poky_sdk/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+git999-r0/linux-yocto-4.12.12+git999/arch/x86/boot/bzImage \ + poky/build/tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1/vmlinuz + + Once the new kernel is added back into the image, you can use the + ``dd`` command or :ref:`bmaptool + ` + to flash your wic image onto an SD card or USB stick and test your + target. + + .. note:: + + Using ``bmaptool`` is generally 10 to 20 times faster than using ``dd``. + diff --git a/poky/documentation/dev-manual/x32-psabi.rst b/poky/documentation/dev-manual/x32-psabi.rst new file mode 100644 index 0000000000..92b1f96fa4 --- /dev/null +++ b/poky/documentation/dev-manual/x32-psabi.rst @@ -0,0 +1,54 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Using x32 psABI +*************** + +x32 processor-specific Application Binary Interface (`x32 +psABI `__) is a native +32-bit processor-specific ABI for Intel 64 (x86-64) architectures. An +ABI defines the calling conventions between functions in a processing +environment. The interface determines what registers are used and what +the sizes are for various C data types. + +Some processing environments prefer using 32-bit applications even when +running on Intel 64-bit platforms. Consider the i386 psABI, which is a +very old 32-bit ABI for Intel 64-bit platforms. The i386 psABI does not +provide efficient use and access of the Intel 64-bit processor +resources, leaving the system underutilized. Now consider the x86_64 +psABI. This ABI is newer and uses 64-bits for data sizes and program +pointers. The extra bits increase the footprint size of the programs, +libraries, and also increases the memory and file system size +requirements. Executing under the x32 psABI enables user programs to +utilize CPU and system resources more efficiently while keeping the +memory footprint of the applications low. Extra bits are used for +registers but not for addressing mechanisms. + +The Yocto Project supports the final specifications of x32 psABI as +follows: + +- You can create packages and images in x32 psABI format on x86_64 + architecture targets. + +- You can successfully build recipes with the x32 toolchain. + +- You can create and boot ``core-image-minimal`` and + ``core-image-sato`` images. + +- There is RPM Package Manager (RPM) support for x32 binaries. + +- There is support for large images. + +To use the x32 psABI, you need to edit your ``conf/local.conf`` +configuration file as follows:: + + MACHINE = "qemux86-64" + DEFAULTTUNE = "x86-64-x32" + baselib = "${@d.getVar('BASE_LIB:tune-' + (d.getVar('DEFAULTTUNE') \ + or 'INVALID')) or 'lib'}" + +Once you have set +up your configuration file, use BitBake to build an image that supports +the x32 psABI. Here is an example:: + + $ bitbake core-image-sato + diff --git a/poky/documentation/genindex.rst b/poky/documentation/genindex.rst index a4af06f656..149e2d36b5 100644 --- a/poky/documentation/genindex.rst +++ b/poky/documentation/genindex.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + ===== Index ===== diff --git a/poky/documentation/kernel-dev/advanced.rst b/poky/documentation/kernel-dev/advanced.rst index b16b3e0517..a8734900a0 100644 --- a/poky/documentation/kernel-dev/advanced.rst +++ b/poky/documentation/kernel-dev/advanced.rst @@ -566,15 +566,7 @@ Example Many real-world examples are more complex. Like any other ``.scc`` file, BSP descriptions can aggregate features. Consider the Minnow BSP definition given the ``linux-yocto-4.4`` branch of the -``yocto-kernel-cache`` (i.e. -``yocto-kernel-cache/bsp/minnow/minnow.scc``): - -.. note:: - - Although the Minnow Board BSP is unused, the Metadata remains and is - being used here just as an example. - -:: +``yocto-kernel-cache`` (i.e. ``yocto-kernel-cache/bsp/minnow/minnow.scc``):: include cfg/x86.scc include features/eg20t/eg20t.scc @@ -597,6 +589,11 @@ definition given the ``linux-yocto-4.4`` branch of the kconf hardware minnow.cfg kconf hardware minnow-dev.cfg +.. note:: + + Although the Minnow Board BSP is unused, the Metadata remains and is + being used here just as an example. + The ``minnow.scc`` description file includes a hardware configuration fragment (``minnow.cfg``) specific to the Minnow BSP as well as several more general configuration fragments and features enabling hardware diff --git a/poky/documentation/kernel-dev/common.rst b/poky/documentation/kernel-dev/common.rst index 028b6af84c..dff8f504fd 100644 --- a/poky/documentation/kernel-dev/common.rst +++ b/poky/documentation/kernel-dev/common.rst @@ -52,7 +52,7 @@ image and ready to make modifications as described in the ":ref:`kernel-dev/common:using \`\`devtool\`\` to patch the kernel`" section: -1. *Initialize the BitBake Environment:* +#. *Initialize the BitBake Environment:* you need to initialize the BitBake build environment by sourcing the build environment script (i.e. :ref:`structure-core-script`):: @@ -66,7 +66,7 @@ section: (i.e. ``poky``) have been cloned using Git and the local repository is named "poky". -2. *Prepare Your local.conf File:* By default, the :term:`MACHINE` variable +#. *Prepare Your local.conf File:* By default, the :term:`MACHINE` variable is set to "qemux86-64", which is fine if you are building for the QEMU emulator in 64-bit mode. However, if you are not, you need to set the :term:`MACHINE` variable appropriately in your ``conf/local.conf`` file @@ -83,7 +83,7 @@ section: MACHINE = "qemux86" MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" -3. *Create a Layer for Patches:* You need to create a layer to hold +#. *Create a Layer for Patches:* You need to create a layer to hold patches created for the kernel image. You can use the ``bitbake-layers create-layer`` command as follows:: @@ -97,16 +97,16 @@ section: For background information on working with common and BSP layers, see the - ":ref:`dev-manual/common-tasks:understanding and creating layers`" + ":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual and the ":ref:`bsp-guide/bsp:bsp layers`" section in the Yocto Project Board Support (BSP) Developer's Guide, respectively. For information on how to use the ``bitbake-layers create-layer`` command to quickly set up a layer, see the - ":ref:`dev-manual/common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`" + ":ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`" section in the Yocto Project Development Tasks Manual. -4. *Inform the BitBake Build Environment About Your Layer:* As directed +#. *Inform the BitBake Build Environment About Your Layer:* As directed when you created your layer, you need to add the layer to the :term:`BBLAYERS` variable in the ``bblayers.conf`` file as follows:: @@ -116,7 +116,7 @@ section: NOTE: Starting bitbake server... $ -5. *Build the Clean Image:* The final step in preparing to work on the +#. *Build the Clean Image:* The final step in preparing to work on the kernel is to build an initial image using ``bitbake``:: $ bitbake core-image-minimal @@ -158,7 +158,7 @@ this procedure leaves you ready to make modifications to the kernel source as described in the ":ref:`kernel-dev/common:using traditional kernel development to patch the kernel`" section: -1. *Initialize the BitBake Environment:* Before you can do anything +#. *Initialize the BitBake Environment:* Before you can do anything using BitBake, you need to initialize the BitBake build environment by sourcing the build environment script (i.e. :ref:`structure-core-script`). @@ -166,8 +166,7 @@ section: checked out for ``poky`` is the Yocto Project &DISTRO_NAME; branch. If you need to checkout out the &DISTRO_NAME; branch, see the ":ref:`dev-manual/start:checking out by branch in poky`" - section in the Yocto Project Development Tasks Manual. - :: + section in the Yocto Project Development Tasks Manual:: $ cd poky $ git branch @@ -182,7 +181,7 @@ section: (i.e. ``poky``) have been cloned using Git and the local repository is named "poky". -2. *Prepare Your local.conf File:* By default, the :term:`MACHINE` variable is +#. *Prepare Your local.conf File:* By default, the :term:`MACHINE` variable is set to "qemux86-64", which is fine if you are building for the QEMU emulator in 64-bit mode. However, if you are not, you need to set the :term:`MACHINE` variable appropriately in your ``conf/local.conf`` file found in the @@ -200,7 +199,7 @@ section: MACHINE = "qemux86" MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules" -3. *Create a Layer for Patches:* You need to create a layer to hold +#. *Create a Layer for Patches:* You need to create a layer to hold patches created for the kernel image. You can use the ``bitbake-layers create-layer`` command as follows:: @@ -213,16 +212,16 @@ section: For background information on working with common and BSP layers, see the - ":ref:`dev-manual/common-tasks:understanding and creating layers`" + ":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual and the ":ref:`bsp-guide/bsp:bsp layers`" section in the Yocto Project Board Support (BSP) Developer's Guide, respectively. For information on how to use the ``bitbake-layers create-layer`` command to quickly set up a layer, see the - ":ref:`dev-manual/common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`" + ":ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`" section in the Yocto Project Development Tasks Manual. -4. *Inform the BitBake Build Environment About Your Layer:* As directed +#. *Inform the BitBake Build Environment About Your Layer:* As directed when you created your layer, you need to add the layer to the :term:`BBLAYERS` variable in the ``bblayers.conf`` file as follows:: @@ -232,7 +231,7 @@ section: NOTE: Starting bitbake server ... $ -5. *Create a Local Copy of the Kernel Git Repository:* You can find Git +#. *Create a Local Copy of the Kernel Git Repository:* You can find Git repositories of supported Yocto Project kernels organized under "Yocto Linux Kernel" in the Yocto Project Source Repositories at :yocto_git:`/`. @@ -244,16 +243,7 @@ section: ``standard/base`` branch. The following commands show how to create a local copy of the - ``linux-yocto-4.12`` kernel and be in the ``standard/base`` branch. - - .. note:: - - The ``linux-yocto-4.12`` kernel can be used with the Yocto Project 2.4 - release and forward. - You cannot use the ``linux-yocto-4.12`` kernel with releases prior to - Yocto Project 2.4. - - :: + ``linux-yocto-4.12`` kernel and be in the ``standard/base`` branch:: $ cd ~ $ git clone git://git.yoctoproject.org/linux-yocto-4.12 --branch standard/base @@ -265,7 +255,14 @@ section: Resolving deltas: 100% (5152604/5152604), done. Checking connectivity... done. Checking out files: 100% (59846/59846), done. -6. *Create a Local Copy of the Kernel Cache Git Repository:* For + .. note:: + + The ``linux-yocto-4.12`` kernel can be used with the Yocto Project 2.4 + release and forward. + You cannot use the ``linux-yocto-4.12`` kernel with releases prior to + Yocto Project 2.4. + +#. *Create a Local Copy of the Kernel Cache Git Repository:* For simplicity, it is recommended that you create your copy of the kernel cache Git repository outside of the :term:`Source Directory`, which is @@ -299,7 +296,7 @@ layer contains its own :term:`BitBake` append files (``.bbappend``) and provides a convenient mechanism to create your own recipe files (``.bb``) as well as store and use kernel patch files. For background information on working with layers, see the -":ref:`dev-manual/common-tasks:understanding and creating layers`" +":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual. .. note:: @@ -307,7 +304,7 @@ section in the Yocto Project Development Tasks Manual. The Yocto Project comes with many tools that simplify tasks you need to perform. One such tool is the ``bitbake-layers create-layer`` command, which simplifies creating a new layer. See the - ":ref:`dev-manual/common-tasks:creating a general layer using the \`\`bitbake-layers\`\` script`" + ":ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`" section in the Yocto Project Development Tasks Manual for information on how to use this script to quick set up a new layer. @@ -316,7 +313,7 @@ following section describes how to create a layer without the aid of tools. These steps assume creation of a layer named ``mylayer`` in your home directory: -1. *Create Structure*: Create the layer's structure:: +#. *Create Structure*: Create the layer's structure:: $ mkdir meta-mylayer $ mkdir meta-mylayer/conf @@ -328,7 +325,7 @@ home directory: ``recipes-kernel`` directory holds your append file and eventual patch files. -2. *Create the Layer Configuration File*: Move to the +#. *Create the Layer Configuration File*: Move to the ``meta-mylayer/conf`` directory and create the ``layer.conf`` file as follows:: @@ -345,7 +342,7 @@ home directory: Notice ``mylayer`` as part of the last three statements. -3. *Create the Kernel Recipe Append File*: Move to the +#. *Create the Kernel Recipe Append File*: Move to the ``meta-mylayer/recipes-kernel/linux`` directory and create the kernel's append file. This example uses the ``linux-yocto-4.12`` kernel. Thus, the name of the append file is @@ -360,7 +357,7 @@ home directory: The :term:`FILESEXTRAPATHS` and :term:`SRC_URI` statements enable the OpenEmbedded build system to find patch files. For more information on using append files, see the - ":ref:`dev-manual/common-tasks:appending other layers metadata with your layer`" + ":ref:`dev-manual/layers:appending other layers metadata with your layer`" section in the Yocto Project Development Tasks Manual. Modifying an Existing Recipe @@ -428,8 +425,7 @@ As an example, consider the following append file used by the BSPs in Here are the contents of this file. Be aware that the actual commit ID strings in this example listing might be different than the actual -strings in the file from the ``meta-yocto-bsp`` layer upstream. -:: +strings in the file from the ``meta-yocto-bsp`` layer upstream:: KBRANCH:genericx86 = "standard/base" KBRANCH:genericx86-64 = "standard/base" @@ -490,8 +486,7 @@ For example, suppose you had some configuration options in a file called ``network_configs.cfg``. You can place that file inside a directory named ``linux-yocto`` and then add a :term:`SRC_URI` statement such as the following to the append file. When the OpenEmbedded build system builds -the kernel, the configuration options are picked up and applied. -:: +the kernel, the configuration options are picked up and applied:: SRC_URI += "file://network_configs.cfg" @@ -700,7 +695,7 @@ modified image causes the added messages to appear on the emulator's console. The example is a continuation of the setup procedure found in the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Section. -1. *Check Out the Kernel Source Files:* First you must use ``devtool`` +#. *Check Out the Kernel Source Files:* First you must use ``devtool`` to checkout the kernel source code in its workspace. .. note:: @@ -728,10 +723,10 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se You can safely ignore these messages. The source code is correctly checked out. -2. *Edit the Source Files* Follow these steps to make some simple +#. *Edit the Source Files* Follow these steps to make some simple changes to the source files: - 1. *Change the working directory*: In the previous step, the output + #. *Change the working directory*: In the previous step, the output noted where you can find the source files (e.g. ``poky_sdk/workspace/sources/linux-yocto``). Change to where the kernel source code is before making your edits to the @@ -739,7 +734,7 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se $ cd poky_sdk/workspace/sources/linux-yocto - 2. *Edit the source file*: Edit the ``init/calibrate.c`` file to have + #. *Edit the source file*: Edit the ``init/calibrate.c`` file to have the following changes:: void calibrate_delay(void) @@ -759,14 +754,17 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se . . -3. *Build the Updated Kernel Source:* To build the updated kernel +#. *Build the Updated Kernel Source:* To build the updated kernel source, use ``devtool``:: $ devtool build linux-yocto -4. *Create the Image With the New Kernel:* Use the +#. *Create the Image With the New Kernel:* Use the ``devtool build-image`` command to create a new image that has the - new kernel. + new kernel:: + + $ cd ~ + $ devtool build-image core-image-minimal .. note:: @@ -776,20 +774,15 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se :yocto_wiki:`TipsAndTricks/KernelDevelopmentWithEsdk ` Wiki Page. - :: - - $ cd ~ - $ devtool build-image core-image-minimal - -5. *Test the New Image:* For this example, you can run the new image +#. *Test the New Image:* For this example, you can run the new image using QEMU to verify your changes: - 1. *Boot the image*: Boot the modified image in the QEMU emulator + #. *Boot the image*: Boot the modified image in the QEMU emulator using this command:: $ runqemu qemux86 - 2. *Verify the changes*: Log into the machine using ``root`` with no + #. *Verify the changes*: Log into the machine using ``root`` with no password and then use the following shell command to scroll through the console's boot output. @@ -801,7 +794,7 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se the results of your ``printk`` statements as part of the output when you scroll down the console window. -6. *Stage and commit your changes*: Change +#. *Stage and commit your changes*: Change your working directory to where you modified the ``calibrate.c`` file and use these Git commands to stage and commit your changes:: @@ -810,10 +803,9 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se $ git add init/calibrate.c $ git commit -m "calibrate: Add printk example" -7. *Export the Patches and Create an Append File:* To export your +#. *Export the Patches and Create an Append File:* To export your commits as patches and create a ``.bbappend`` file, use the following - command. This example uses the previously established layer named ``meta-mylayer``. - :: + command. This example uses the previously established layer named ``meta-mylayer``:: $ devtool finish linux-yocto ~/meta-mylayer @@ -827,7 +819,7 @@ the ":ref:`kernel-dev/common:getting ready to develop using \`\`devtool\`\``" Se finishes, the patches and the ``.bbappend`` file are located in the ``~/meta-mylayer/recipes-kernel/linux`` directory. -8. *Build the Image With Your Modified Kernel:* You can now build an +#. *Build the Image With Your Modified Kernel:* You can now build an image that includes your kernel patches. Execute the following command from your :term:`Build Directory` in the terminal set up to run BitBake:: @@ -865,20 +857,20 @@ found in the ":ref:`kernel-dev/common:getting ready for traditional kernel development`" Section. -1. *Edit the Source Files* Prior to this step, you should have used Git +#. *Edit the Source Files* Prior to this step, you should have used Git to create a local copy of the repository for your kernel. Assuming you created the repository as directed in the ":ref:`kernel-dev/common:getting ready for traditional kernel development`" section, use the following commands to edit the ``calibrate.c`` file: - 1. *Change the working directory*: You need to locate the source + #. *Change the working directory*: You need to locate the source files in the local copy of the kernel Git repository. Change to where the kernel source code is before making your edits to the ``calibrate.c`` file:: $ cd ~/linux-yocto-4.12/init - 2. *Edit the source file*: Edit the ``calibrate.c`` file to have the + #. *Edit the source file*: Edit the ``calibrate.c`` file to have the following changes:: void calibrate_delay(void) @@ -898,7 +890,7 @@ Section. . . -2. *Stage and Commit Your Changes:* Use standard Git commands to stage +#. *Stage and Commit Your Changes:* Use standard Git commands to stage and commit the changes you just made:: $ git add calibrate.c @@ -908,7 +900,7 @@ Section. stage and commit your changes, the OpenEmbedded Build System will not pick up the changes. -3. *Update Your local.conf File to Point to Your Source Files:* In +#. *Update Your local.conf File to Point to Your Source Files:* In addition to your ``local.conf`` file specifying to use "kernel-modules" and the "qemux86" machine, it must also point to the updated kernel source files. Add @@ -932,21 +924,21 @@ Section. be sure to specify the correct branch and machine types. For this example, the branch is ``standard/base`` and the machine is ``qemux86``. -4. *Build the Image:* With the source modified, your changes staged and +#. *Build the Image:* With the source modified, your changes staged and committed, and the ``local.conf`` file pointing to the kernel files, you can now use BitBake to build the image:: $ cd poky/build $ bitbake core-image-minimal -5. *Boot the image*: Boot the modified image in the QEMU emulator using +#. *Boot the image*: Boot the modified image in the QEMU emulator using this command. When prompted to login to the QEMU console, use "root" with no password:: $ cd poky/build $ runqemu qemux86 -6. *Look for Your Changes:* As QEMU booted, you might have seen your +#. *Look for Your Changes:* As QEMU booted, you might have seen your changes rapidly scroll by. If not, use these commands to see your changes: @@ -958,7 +950,7 @@ Section. ``printk`` statements as part of the output when you scroll down the console window. -7. *Generate the Patch File:* Once you are sure that your patch works +#. *Generate the Patch File:* Once you are sure that your patch works correctly, you can generate a ``*.patch`` file in the kernel source repository:: @@ -966,7 +958,7 @@ Section. $ git format-patch -1 0001-calibrate.c-Added-some-printk-statements.patch -8. *Move the Patch File to Your Layer:* In order for subsequent builds +#. *Move the Patch File to Your Layer:* In order for subsequent builds to pick up patches, you need to move the patch file you created in the previous step to your layer ``meta-mylayer``. For this example, the layer created earlier is located in your home directory as @@ -986,7 +978,7 @@ Section. $ mv ~/linux-yocto-4.12/init/0001-calibrate.c-Added-some-printk-statements.patch ~/meta-mylayer/recipes-kernel/linux/linux-yocto -9. *Create the Append File:* Finally, you need to create the +#. *Create the Append File:* Finally, you need to create the ``linux-yocto_4.12.bbappend`` file and insert statements that allow the OpenEmbedded build system to find the patch. The append file needs to be in your layer's ``recipes-kernel/linux`` directory and it @@ -1002,7 +994,7 @@ Section. For more information on append files and patches, see the ":ref:`kernel-dev/common:creating the append file`" and ":ref:`kernel-dev/common:applying patches`" sections. You can also see the - ":ref:`dev-manual/common-tasks:appending other layers metadata with your layer`" + ":ref:`dev-manual/layers:appending other layers metadata with your layer`" section in the Yocto Project Development Tasks Manual. .. note:: @@ -1231,7 +1223,7 @@ saved, and one freshly created using the ``menuconfig`` tool. To create a configuration fragment using this method, follow these steps: -1. *Complete a Build Through Kernel Configuration:* Complete a build at +#. *Complete a Build Through Kernel Configuration:* Complete a build at least through the kernel configuration task as follows:: $ bitbake linux-yocto -c kernel_configme -f @@ -1241,11 +1233,11 @@ steps: your build state might become unknown, it is best to run this task prior to starting ``menuconfig``. -2. *Launch menuconfig:* Run the ``menuconfig`` command:: +#. *Launch menuconfig:* Run the ``menuconfig`` command:: $ bitbake linux-yocto -c menuconfig -3. *Create the Configuration Fragment:* Run the ``diffconfig`` command +#. *Create the Configuration Fragment:* Run the ``diffconfig`` command to prepare a configuration fragment. The resulting file ``fragment.cfg`` is placed in the ``${``\ :term:`WORKDIR`\ ``}`` @@ -1416,17 +1408,17 @@ configuration. To streamline the configuration, do the following: -1. *Use a Working Configuration:* Start with a full configuration that +#. *Use a Working Configuration:* Start with a full configuration that you know works. Be sure the configuration builds and boots successfully. Use this configuration file as your baseline. -2. *Run Configure and Check Tasks:* Separately run the +#. *Run Configure and Check Tasks:* Separately run the :ref:`ref-tasks-kernel_configme` and :ref:`ref-tasks-kernel_configcheck` tasks:: $ bitbake linux-yocto -c kernel_configme -f $ bitbake linux-yocto -c kernel_configcheck -f -3. *Process the Results:* Take the resulting list of files from the +#. *Process the Results:* Take the resulting list of files from the :ref:`ref-tasks-kernel_configcheck` task warnings and do the following: - Drop values that are redefined in the fragment but do not change @@ -1439,7 +1431,7 @@ To streamline the configuration, do the following: - Remove repeated and invalid options. -4. *Re-Run Configure and Check Tasks:* After you have worked through the +#. *Re-Run Configure and Check Tasks:* After you have worked through the output of the kernel configuration audit, you can re-run the :ref:`ref-tasks-kernel_configme` and :ref:`ref-tasks-kernel_configcheck` tasks to see the results of your changes. If you have more issues, you can deal with @@ -1470,20 +1462,20 @@ If you build a kernel image and the version string has a "+" or a "-dirty" at the end, it means there are uncommitted modifications in the kernel's source directory. Follow these steps to clean up the version string: -1. *Discover the Uncommitted Changes:* Go to the kernel's locally cloned +#. *Discover the Uncommitted Changes:* Go to the kernel's locally cloned Git repository (source directory) and use the following Git command to list the files that have been changed, added, or removed:: $ git status -2. *Commit the Changes:* You should commit those changes to the kernel +#. *Commit the Changes:* You should commit those changes to the kernel source tree regardless of whether or not you will save, export, or use the changes:: $ git add $ git commit -s -a -m "getting rid of -dirty" -3. *Rebuild the Kernel Image:* Once you commit the changes, rebuild the +#. *Rebuild the Kernel Image:* Once you commit the changes, rebuild the kernel. Depending on your particular kernel development workflow, the @@ -1517,18 +1509,18 @@ You can find this recipe in the ``poky`` Git repository: Here are some basic steps you can use to work with your own sources: -1. *Create a Copy of the Kernel Recipe:* Copy the +#. *Create a Copy of the Kernel Recipe:* Copy the ``linux-yocto-custom.bb`` recipe to your layer and give it a meaningful name. The name should include the version of the Yocto Linux kernel you are using (e.g. ``linux-yocto-myproject_4.12.bb``, where "4.12" is the base version of the Linux kernel with which you would be working). -2. *Create a Directory for Your Patches:* In the same directory inside +#. *Create a Directory for Your Patches:* In the same directory inside your layer, create a matching directory to store your patches and configuration files (e.g. ``linux-yocto-myproject``). -3. *Ensure You Have Configurations:* Make sure you have either a +#. *Ensure You Have Configurations:* Make sure you have either a ``defconfig`` file or configuration fragment files in your layer. When you use the ``linux-yocto-custom.bb`` recipe, you must specify a configuration. If you do not have a ``defconfig`` file, you can run @@ -1553,7 +1545,7 @@ Here are some basic steps you can use to work with your own sources: ``arch/arm/configs`` and use the one that is the best starting point for your board). -4. *Edit the Recipe:* Edit the following variables in your recipe as +#. *Edit the Recipe:* Edit the following variables in your recipe as appropriate for your project: - :term:`SRC_URI`: The @@ -1602,7 +1594,7 @@ Here are some basic steps you can use to work with your own sources: COMPATIBLE_MACHINE = "qemux86|qemux86-64" -5. *Customize Your Recipe as Needed:* Provide further customizations to +#. *Customize Your Recipe as Needed:* Provide further customizations to your recipe as needed just as you would customize an existing linux-yocto recipe. See the ":ref:`ref-manual/devtool-reference:modifying an existing recipe`" section @@ -1693,12 +1685,10 @@ looks much like the one provided with the ``hello-mod`` template:: ... The important point to note here is the :term:`KERNEL_SRC` variable. The -:ref:`module ` class sets this variable and the -:term:`KERNEL_PATH` variable to -``${STAGING_KERNEL_DIR}`` with the necessary Linux kernel build -information to build modules. If your module ``Makefile`` uses a -different variable, you might want to override the -:ref:`ref-tasks-compile` step, or +:ref:`ref-classes-module` class sets this variable and the :term:`KERNEL_PATH` +variable to ``${STAGING_KERNEL_DIR}`` with the necessary Linux kernel build +information to build modules. If your module ``Makefile`` uses a different +variable, you might want to override the :ref:`ref-tasks-compile` step, or create a patch to the ``Makefile`` to work with the more typical :term:`KERNEL_SRC` or :term:`KERNEL_PATH` variables. @@ -1760,8 +1750,7 @@ Here is an example that looks at what has changed in the ``emenlow`` branch of the ``linux-yocto-3.19`` kernel. The lower commit range is the commit associated with the ``standard/base`` branch, while the upper commit range is the commit associated with the ``standard/emenlow`` -branch. -:: +branch:: $ git whatchanged origin/standard/base..origin/standard/emenlow @@ -1835,7 +1824,7 @@ kernel features. Consider the following example that adds the "test.scc" feature to the build. -1. *Create the Feature File:* Create a ``.scc`` file and locate it just +#. *Create the Feature File:* Create a ``.scc`` file and locate it just as you would any other patch file, ``.cfg`` file, or fetcher item you specify in the :term:`SRC_URI` statement. @@ -1863,7 +1852,7 @@ build. ``linux-yocto`` directory has both the feature ``test.scc`` file and a similarly named configuration fragment file ``test.cfg``. -2. *Add the Feature File to SRC_URI:* Add the ``.scc`` file to the +#. *Add the Feature File to SRC_URI:* Add the ``.scc`` file to the recipe's :term:`SRC_URI` statement:: SRC_URI += "file://test.scc" @@ -1871,7 +1860,7 @@ build. The leading space before the path is important as the path is appended to the existing path. -3. *Specify the Feature as a Kernel Feature:* Use the +#. *Specify the Feature as a Kernel Feature:* Use the :term:`KERNEL_FEATURES` statement to specify the feature as a kernel feature:: diff --git a/poky/documentation/kernel-dev/faq.rst b/poky/documentation/kernel-dev/faq.rst index e40e3ff372..4dffa90dbd 100644 --- a/poky/documentation/kernel-dev/faq.rst +++ b/poky/documentation/kernel-dev/faq.rst @@ -36,9 +36,9 @@ How do I install/not-install the kernel image on the root filesystem? The kernel image (e.g. ``vmlinuz``) is provided by the ``kernel-image`` package. Image recipes depend on ``kernel-base``. To specify whether or not the kernel image is installed in the generated -root filesystem, override ``RDEPENDS:${KERNEL_PACKAGE_NAME}-base`` to include or not +root filesystem, override ``RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base`` to include or not include "kernel-image". See the -":ref:`dev-manual/common-tasks:appending other layers metadata with your layer`" +":ref:`dev-manual/layers:appending other layers metadata with your layer`" section in the Yocto Project Development Tasks Manual for information on how to use an append file to override metadata. diff --git a/poky/documentation/kernel-dev/intro.rst b/poky/documentation/kernel-dev/intro.rst index 267b7e7797..a663733a1d 100644 --- a/poky/documentation/kernel-dev/intro.rst +++ b/poky/documentation/kernel-dev/intro.rst @@ -87,7 +87,7 @@ understand the following documentation: as described in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual. -- The ":ref:`dev-manual/common-tasks:understanding and creating layers`" +- The ":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual. - The ":ref:`kernel-dev/intro:kernel modification workflow`" section. @@ -108,12 +108,12 @@ general information and references for further information. .. image:: figures/kernel-dev-flow.png :width: 100% -1. *Set up Your Host Development System to Support Development Using the +#. *Set up Your Host Development System to Support Development Using the Yocto Project*: See the ":doc:`/dev-manual/start`" section in the Yocto Project Development Tasks Manual for options on how to get a build host ready to use the Yocto Project. -2. *Set Up Your Host Development System for Kernel Development:* It is +#. *Set Up Your Host Development System for Kernel Development:* It is recommended that you use ``devtool`` for kernel development. Alternatively, you can use traditional kernel development methods with the Yocto Project. Either way, there are @@ -131,7 +131,7 @@ general information and references for further information. ":ref:`kernel-dev/common:getting ready for traditional kernel development`" section. -3. *Make Changes to the Kernel Source Code if applicable:* Modifying the +#. *Make Changes to the Kernel Source Code if applicable:* Modifying the kernel does not always mean directly changing source files. However, if you have to do this, you make the changes to the files in the Yocto's :term:`Build Directory` if you are using ``devtool``. For more @@ -144,7 +144,7 @@ general information and references for further information. ":ref:`kernel-dev/common:using traditional kernel development to patch the kernel`" section. -4. *Make Kernel Configuration Changes if Applicable:* If your situation +#. *Make Kernel Configuration Changes if Applicable:* If your situation calls for changing the kernel's configuration, you can use :ref:`menuconfig `, which allows you to @@ -169,7 +169,7 @@ general information and references for further information. Additionally, if you are working in a BSP layer and need to modify the BSP's kernel's configuration, you can use ``menuconfig``. -5. *Rebuild the Kernel Image With Your Changes:* Rebuilding the kernel +#. *Rebuild the Kernel Image With Your Changes:* Rebuilding the kernel image applies your changes. Depending on your target hardware, you can verify your changes on actual hardware or perhaps QEMU. diff --git a/poky/documentation/kernel-dev/maint-appx.rst b/poky/documentation/kernel-dev/maint-appx.rst index 6aa2fb7cf1..53b7376089 100644 --- a/poky/documentation/kernel-dev/maint-appx.rst +++ b/poky/documentation/kernel-dev/maint-appx.rst @@ -92,11 +92,11 @@ top-level kernel feature or BSP. The following actions effectively provide the Metadata and create the tree that includes the new feature, patch, or BSP: -1. *Pass Feature to the OpenEmbedded Build System:* A top-level kernel +#. *Pass Feature to the OpenEmbedded Build System:* A top-level kernel feature is passed to the kernel build subsystem. Normally, this feature is a BSP for a particular kernel type. -2. *Locate Feature:* The file that describes the top-level feature is +#. *Locate Feature:* The file that describes the top-level feature is located by searching these system directories: - The in-tree kernel-cache directories, which are located in the @@ -112,31 +112,31 @@ patch, or BSP: bsp_root_name-kernel_type.scc -3. *Expand Feature:* Once located, the feature description is either +#. *Expand Feature:* Once located, the feature description is either expanded into a simple script of actions, or into an existing equivalent script that is already part of the shipped kernel. -4. *Append Extra Features:* Extra features are appended to the top-level +#. *Append Extra Features:* Extra features are appended to the top-level feature description. These features can come from the :term:`KERNEL_FEATURES` variable in recipes. -5. *Locate, Expand, and Append Each Feature:* Each extra feature is +#. *Locate, Expand, and Append Each Feature:* Each extra feature is located, expanded and appended to the script as described in step three. -6. *Execute the Script:* The script is executed to produce files +#. *Execute the Script:* The script is executed to produce files ``.scc`` and ``.cfg`` files in appropriate directories of the ``yocto-kernel-cache`` repository. These files are descriptions of all the branches, tags, patches and configurations that need to be applied to the base Git repository to completely create the source (build) branch for the new BSP or feature. -7. *Clone Base Repository:* The base repository is cloned, and the +#. *Clone Base Repository:* The base repository is cloned, and the actions listed in the ``yocto-kernel-cache`` directories are applied to the tree. -8. *Perform Cleanup:* The Git repositories are left with the desired +#. *Perform Cleanup:* The Git repositories are left with the desired branches checked out and any required branching, patching and tagging has been performed. diff --git a/poky/documentation/migration-guides/index.rst b/poky/documentation/migration-guides/index.rst index ce0ca8c659..6f7bcbef29 100644 --- a/poky/documentation/migration-guides/index.rst +++ b/poky/documentation/migration-guides/index.rst @@ -12,6 +12,7 @@ to move to one release of the Yocto Project from the previous one. .. toctree:: migration-general + release-4.2 release-4.1 release-4.0 release-3.4 diff --git a/poky/documentation/migration-guides/migration-1.3.rst b/poky/documentation/migration-guides/migration-1.3.rst index 3ba189b773..95f7e3572b 100644 --- a/poky/documentation/migration-guides/migration-1.3.rst +++ b/poky/documentation/migration-guides/migration-1.3.rst @@ -91,11 +91,11 @@ consistency. nativesdk ~~~~~~~~~ -The suffix ``nativesdk`` is now implemented as a prefix, which -simplifies a lot of the packaging code for ``nativesdk`` recipes. All -custom ``nativesdk`` recipes, which are relocatable packages that are -native to :term:`SDK_ARCH`, and any references need to -be updated to use ``nativesdk-*`` instead of ``*-nativesdk``. +The suffix ``nativesdk`` is now implemented as a prefix, which simplifies a lot +of the packaging code for :ref:`ref-classes-nativesdk` recipes. All custom +:ref:`ref-classes-nativesdk` recipes, which are relocatable packages that are +native to :term:`SDK_ARCH`, and any references need to be updated to use +``nativesdk-*`` instead of ``*-nativesdk``. .. _migration-1.3-task-recipes: @@ -109,12 +109,11 @@ automatic upgrade path for most packages. However, you should update references in your own recipes and configurations as they could be removed in future releases. You should also rename any custom ``task-*`` recipes to ``packagegroup-*``, and change them to inherit -``packagegroup`` instead of ``task``, as well as taking the opportunity -to remove anything now handled by :ref:`ref-classes-packagegroup`, such as -providing ``-dev`` and ``-dbg`` packages, setting -:term:`LIC_FILES_CHKSUM`, and so forth. See the -:ref:`ref-classes-packagegroup` section for -further details. +:ref:`ref-classes-packagegroup` instead of ``task``, as well +as taking the opportunity to remove anything now handled by +:ref:`ref-classes-packagegroup`, such as providing ``-dev`` and ``-dbg`` +packages, setting :term:`LIC_FILES_CHKSUM`, and so forth. See the +:ref:`ref-classes-packagegroup` section for further details. .. _migration-1.3-image-features: diff --git a/poky/documentation/migration-guides/migration-1.4.rst b/poky/documentation/migration-guides/migration-1.4.rst index baf3c08379..6db2a035b8 100644 --- a/poky/documentation/migration-guides/migration-1.4.rst +++ b/poky/documentation/migration-guides/migration-1.4.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 1.4 (dylan) =================== @@ -83,7 +85,7 @@ create an append file for the ``init-ifupdown`` recipe instead, which you can find in the :term:`Source Directory` at ``meta/recipes-core/init-ifupdown``. For information on how to use append files, see the -":ref:`dev-manual/common-tasks:appending other layers metadata with your layer`" +":ref:`dev-manual/layers:appending other layers metadata with your layer`" section in the Yocto Project Development Tasks Manual. .. _migration-1.4-remote-debugging: diff --git a/poky/documentation/migration-guides/migration-1.5.rst b/poky/documentation/migration-guides/migration-1.5.rst index 70a087ff1a..d82d33f91f 100644 --- a/poky/documentation/migration-guides/migration-1.5.rst +++ b/poky/documentation/migration-guides/migration-1.5.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 1.5 (dora) ================== @@ -26,8 +28,7 @@ provide packages for these, you can install and use the Buildtools tarball, which provides an SDK-like environment containing them. For more information on this requirement, see the -":ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions`" -section. +":ref:`system-requirements-buildtools`" section. .. _migration-1.5-atom-pc-bsp: @@ -94,9 +95,8 @@ The following changes have been made to the package QA checks: this file within :ref:`ref-tasks-install` if "make install" is installing it. -- If you are using the :ref:`buildhistory ` class, - the check for the package - version going backwards is now controlled using a standard QA check. +- If you are using the :ref:`ref-classes-buildhistory` class, the check for the + package version going backwards is now controlled using a standard QA check. Thus, if you have customized your :term:`ERROR_QA` or :term:`WARN_QA` values and still wish to have this check performed, you should add "version-going-backwards" to your value for one or the other @@ -130,6 +130,11 @@ The following directory changes exist: it easier to delete :term:`TMPDIR` and preserve the build history. Additionally, data for produced SDKs is now split by :term:`IMAGE_NAME`. +- When :ref:`ref-classes-buildhistory` is enabled, its output + is now written under the :term:`Build Directory` rather than :term:`TMPDIR`. + Doing so makes it easier to delete :term:`TMPDIR` and preserve the build + history. Additionally, data for produced SDKs is now split by :term:`IMAGE_NAME`. + - The ``pkgdata`` directory produced as part of the packaging process has been collapsed into a single machine-specific directory. This directory is located under ``sysroots`` and uses a machine-specific @@ -216,8 +221,8 @@ Task Recipes The previously deprecated ``task.bbclass`` has now been dropped. For recipes that previously inherited from this class, you should rename -them from ``task-*`` to ``packagegroup-*`` and inherit packagegroup -instead. +them from ``task-*`` to ``packagegroup-*`` and inherit +:ref:`ref-classes-packagegroup` instead. For more information, see the ":ref:`ref-classes-packagegroup`" section. @@ -243,7 +248,7 @@ A new automated image testing framework has been added through the framework replaces the older ``imagetest-qemu`` framework. You can learn more about performing automated image tests in the -":ref:`dev-manual/common-tasks:performing automated runtime testing`" +":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual. .. _migration-1.5-build-history: @@ -266,7 +271,7 @@ Following are changes to Build History: option for each utility for more information on the new syntax. For more information on Build History, see the -":ref:`dev-manual/common-tasks:maintaining build output quality`" +":ref:`dev-manual/build-quality:maintaining build output quality`" section in the Yocto Project Development Tasks Manual. .. _migration-1.5-udev: diff --git a/poky/documentation/migration-guides/migration-1.6.rst b/poky/documentation/migration-guides/migration-1.6.rst index d3de264650..916169e836 100644 --- a/poky/documentation/migration-guides/migration-1.6.rst +++ b/poky/documentation/migration-guides/migration-1.6.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 1.6 (daisy) =================== @@ -9,10 +11,9 @@ Project 1.6 Release (codename "daisy") from the prior release. ``archiver`` Class ------------------ -The :ref:`archiver ` class has been rewritten -and its configuration has been simplified. For more details on the -source archiver, see the -":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`" +The :ref:`ref-classes-archiver` class has been rewritten and its configuration +has been simplified. For more details on the source archiver, see the +":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`" section in the Yocto Project Development Tasks Manual. .. _migration-1.6-packaging-changes: @@ -147,7 +148,7 @@ NFS mount, an error occurs. The ``PRINC`` variable has been deprecated and triggers a warning if detected during a build. For :term:`PR` increments on changes, use the PR service instead. You can find out more about this service in -the ":ref:`dev-manual/common-tasks:working with a pr service`" +the ":ref:`dev-manual/packages:working with a pr service`" section in the Yocto Project Development Tasks Manual. .. _migration-1.6-variable-changes-IMAGE_TYPES: @@ -220,9 +221,9 @@ Package Test (ptest) Package Tests (ptest) are built but not installed by default. For information on using Package Tests, see the -":ref:`dev-manual/common-tasks:testing packages with ptest`" -section in the Yocto Project Development Tasks Manual. For information on the -``ptest`` class, see the ":ref:`ref-classes-ptest`" section. +":ref:`dev-manual/packages:testing packages with ptest`" section in the +Yocto Project Development Tasks Manual. See also the ":ref:`ref-classes-ptest`" +section. .. _migration-1.6-build-changes: @@ -231,13 +232,13 @@ Build Changes Separate build and source directories have been enabled by default for selected recipes where it is known to work and for all -recipes that inherit the :ref:`cmake ` class. In -future releases the :ref:`autotools ` class +recipes that inherit the :ref:`ref-classes-cmake` class. In +future releases the :ref:`ref-classes-autotools` class will enable a separate :term:`Build Directory` by default as well. Recipes building Autotools-based software that fails to build with a separate :term:`Build Directory` should be changed to inherit from the :ref:`autotools-brokensep ` class instead of -the ``autotools`` or ``autotools_stage``\ classes. +the :ref:`ref-classes-autotools` or ``autotools_stage`` classes. .. _migration-1.6-building-qemu-native: diff --git a/poky/documentation/migration-guides/migration-1.7.rst b/poky/documentation/migration-guides/migration-1.7.rst index e1a7594fb1..ca8222098a 100644 --- a/poky/documentation/migration-guides/migration-1.7.rst +++ b/poky/documentation/migration-guides/migration-1.7.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 1.7 (dizzy) =================== @@ -30,7 +32,7 @@ version required on the build host is now 1.7.8 because the ``--list`` option is now required by BitBake's Git fetcher. As always, if your host distribution does not provide a version of Git that meets this requirement, you can use the -``buildtools-tarball`` that does. See the +:term:`buildtools` tarball that does. See the ":ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions`" section for more information. @@ -39,13 +41,11 @@ section for more information. Autotools Class Changes ----------------------- -The following :ref:`autotools ` class changes -occurred: +The following :ref:`ref-classes-autotools` class changes occurred: - *A separate :term:`Build Directory` is now used by default:* The - :ref:`autotools ` class has been - changed to use a directory for building - (:term:`B`), which is separate from the source directory + :ref:`ref-classes-autotools` class has been changed to use a directory for + building (:term:`B`), which is separate from the source directory (:term:`S`). This is commonly referred to as ``B != S``, or an out-of-tree build. @@ -54,9 +54,8 @@ occurred: However, if the software is not capable of being built in this manner, you will need to either patch the software so that it can build separately, or you will need to change the recipe to inherit - the :ref:`autotools-brokensep ` class - instead of the :ref:`autotools ` - or ``autotools_stage`` classes. + the :ref:`autotools-brokensep ` class instead + of the :ref:`ref-classes-autotools` or ``autotools_stage`` classes. - The ``--foreign`` option is no longer passed to ``automake`` when running ``autoconf``: This option tells ``automake`` that a @@ -217,7 +216,7 @@ The following miscellaneous change occurred: should manually remove old "build-id" files from your existing build history repositories to avoid confusion. For information on the build history feature, see the - ":ref:`dev-manual/common-tasks:maintaining build output quality`" + ":ref:`dev-manual/build-quality:maintaining build output quality`" section in the Yocto Project Development Tasks Manual. diff --git a/poky/documentation/migration-guides/migration-1.8.rst b/poky/documentation/migration-guides/migration-1.8.rst index f058029b30..5cc5f8a047 100644 --- a/poky/documentation/migration-guides/migration-1.8.rst +++ b/poky/documentation/migration-guides/migration-1.8.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 1.8 (fido) ================== @@ -68,23 +70,22 @@ the following:: Kernel Build Changes -------------------- -The kernel build process was changed to place the source in a common -shared work area and to place build artifacts separately in the source -code tree. In theory, migration paths have been provided for most common -usages in kernel recipes but this might not work in all cases. In -particular, users need to ensure that ``${S}`` (source files) and -``${B}`` (build artifacts) are used correctly in functions such as -:ref:`ref-tasks-configure` and -:ref:`ref-tasks-install`. For kernel recipes that do not -inherit from ``kernel-yocto`` or include ``linux-yocto.inc``, you might -wish to refer to the ``linux.inc`` file in the ``meta-oe`` layer for the -kinds of changes you need to make. For reference, here is the +The kernel build process was changed to place the source in a common shared work +area and to place build artifacts separately in the source code tree. In theory, +migration paths have been provided for most common usages in kernel recipes but +this might not work in all cases. In particular, users need to ensure that +``${S}`` (source files) and ``${B}`` (build artifacts) are used correctly in +functions such as :ref:`ref-tasks-configure` and :ref:`ref-tasks-install`. For +kernel recipes that do not inherit from :ref:`ref-classes-kernel-yocto` or +include ``linux-yocto.inc``, you might wish to refer to the ``linux.inc`` file +in the ``meta-oe`` layer for the kinds of changes you need to make. For reference, +here is the :oe_git:`commit ` where the ``linux.inc`` file in ``meta-oe`` was updated. Recipes that rely on the kernel source code and do not inherit the -module classes might need to add explicit dependencies on the -:ref:`ref-tasks-shared_workdir` kernel task, for example:: +:ref:`module ` classes might need to add explicit +dependencies on the :ref:`ref-tasks-shared_workdir` kernel task, for example:: do_configure[depends] += "virtual/kernel:do_shared_workdir" @@ -121,10 +122,9 @@ need to take corrective steps. Rebuild Improvements -------------------- -Changes have been made to the :ref:`base `, -:ref:`autotools `, and -:ref:`cmake ` classes to clean out generated files -when the :ref:`ref-tasks-configure` task needs to be +Changes have been made to the :ref:`ref-classes-base`, +:ref:`ref-classes-autotools`, and :ref:`ref-classes-cmake` classes to clean out +generated files when the :ref:`ref-tasks-configure` task needs to be re-executed. One of the improvements is to attempt to run "make clean" during the diff --git a/poky/documentation/migration-guides/migration-2.0.rst b/poky/documentation/migration-guides/migration-2.0.rst index 7217853779..13be9846df 100644 --- a/poky/documentation/migration-guides/migration-2.0.rst +++ b/poky/documentation/migration-guides/migration-2.0.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 2.0 (jethro) ==================== @@ -214,7 +216,7 @@ modifications synchronized, it is not always obvious to developers how to manipulate the Metadata as compared to the source. Metadata processing has now been removed from the -:ref:`kernel-yocto ` class and the external +:ref:`ref-classes-kernel-yocto` class and the external Metadata repository ``yocto-kernel-cache``, which has always been used to seed the ``linux-yocto`` "meta" branch. This separate ``linux-yocto`` cache repository is now the primary location for this data. Due to this diff --git a/poky/documentation/migration-guides/migration-2.1.rst b/poky/documentation/migration-guides/migration-2.1.rst index c19ba5501c..18b05b52cc 100644 --- a/poky/documentation/migration-guides/migration-2.1.rst +++ b/poky/documentation/migration-guides/migration-2.1.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 2.1 (krogoth) ===================== @@ -64,7 +66,7 @@ Makefile Environment Changes :term:`EXTRA_OEMAKE` now defaults to "" instead of "-e MAKEFLAGS=". Setting :term:`EXTRA_OEMAKE` to "-e MAKEFLAGS=" by default was a historical accident that has required many classes (e.g. -``autotools``, ``module``) and recipes to override this default in order +:ref:`ref-classes-autotools`, ``module``) and recipes to override this default in order to work with sensible build systems. When upgrading to the release, you must edit any recipe that relies upon this old default by either setting :term:`EXTRA_OEMAKE` back to "-e MAKEFLAGS=" or by explicitly setting any @@ -98,7 +100,7 @@ breaking FHS. ``ac_cv_sizeof_off_t`` is No Longer Cached in Site Files -------------------------------------------------------- -For recipes inheriting the :ref:`autotools ` +For recipes inheriting the :ref:`ref-classes-autotools` class, ``ac_cv_sizeof_off_t`` is no longer cached in the site files for ``autoconf``. The reason for this change is because the ``ac_cv_sizeof_off_t`` value is not necessarily static per architecture @@ -106,12 +108,12 @@ as was previously assumed. Rather, the value changes based on whether large file support is enabled. For most software that uses ``autoconf``, this change should not be a problem. However, if you have a recipe that bypasses the standard :ref:`ref-tasks-configure` task -from the :ref:`autotools ` class and the software the recipe is building +from the :ref:`ref-classes-autotools` class and the software the recipe is building uses a very old version of ``autoconf``, the recipe might be incapable of determining the correct size of ``off_t`` during :ref:`ref-tasks-configure`. The best course of action is to patch the software as necessary to allow -the default implementation from the :ref:`autotools ` class to work such +the default implementation from the :ref:`ref-classes-autotools` class to work such that ``autoreconf`` succeeds and produces a working configure script, and to remove the overridden :ref:`ref-tasks-configure` task such that the default implementation does get used. @@ -136,9 +138,8 @@ should make edits so that those tasks are after the after :ref:`ref-tasks-rootfs` so that your added tasks run at the correct time. -A minor part of this restructuring is that the post-processing -definitions and functions have been moved from the -:ref:`image ` class to the +A minor part of this restructuring is that the post-processing definitions and +functions have been moved from the :ref:`ref-classes-image` class to the :ref:`rootfs-postcommands ` class. Functionally, however, they remain unchanged. @@ -189,18 +190,17 @@ Class Changes The following classes have changed: - ``autotools_stage``: Removed because the - :ref:`autotools ` class now provides its + :ref:`ref-classes-autotools` class now provides its functionality. Recipes that inherited from ``autotools_stage`` should - now inherit from ``autotools`` instead. + now inherit from :ref:`ref-classes-autotools` instead. - ``boot-directdisk``: Merged into the ``image-vm`` class. The ``boot-directdisk`` class was rarely directly used. Consequently, this change should not cause any issues. -- ``bootimg``: Merged into the - :ref:`image-live ` class. The ``bootimg`` - class was rarely directly used. Consequently, this change should not - cause any issues. +- ``bootimg``: Merged into the :ref:`ref-classes-image-live` class. The + ``bootimg`` class was rarely directly used. Consequently, this change should + not cause any issues. - ``packageinfo``: Removed due to its limited use by the Hob UI, which has itself been removed. @@ -255,14 +255,14 @@ The following changes have been made for the Poky distribution: not need to change anything unless you are relying on this naming elsewhere. -- The :ref:`uninative ` class is now enabled +- The :ref:`ref-classes-uninative` class is now enabled by default in Poky. This class attempts to isolate the build system from the host distribution's C library and makes re-use of native shared state artifacts across different host distributions practical. With this class enabled, a tarball containing a pre-built C library is downloaded at the start of the build. - The :ref:`uninative ` class is enabled through the + The :ref:`ref-classes-uninative` class is enabled through the ``meta/conf/distro/include/yocto-uninative.inc`` file, which for those not using the Poky distribution, can include to easily enable the same functionality. @@ -343,7 +343,7 @@ This release supports generation of GLib Introspective Repository (GIR) files through GObject introspection, which is the standard mechanism for accessing GObject-based software from runtime environments. You can enable, disable, and test the generation of this data. See the -":ref:`dev-manual/common-tasks:enabling gobject introspection support`" +":ref:`dev-manual/gobject-introspection:enabling gobject introspection support`" section in the Yocto Project Development Tasks Manual for more information. @@ -356,9 +356,9 @@ These additional changes exist: - The minimum Git version has been increased to 1.8.3.1. If your host distribution does not provide a sufficiently recent version, you can - install the buildtools, which will provide it. See the + install the :term:`buildtools`, which will provide it. See the :ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions` - section for more information on the buildtools tarball. + section for more information on the :term:`buildtools` tarball. - The buggy and incomplete support for the RPM version 4 package manager has been removed. The well-tested and maintained support for @@ -401,9 +401,9 @@ These additional changes exist: as these directories are automatically found and added. - Inaccurate disk and CPU percentage data has been dropped from - ``buildstats`` output. This data has been replaced with + :ref:`ref-classes-buildstats` output. This data has been replaced with ``getrusage()`` data and corrected IO statistics. You will probably - need to update any custom code that reads the ``buildstats`` data. + need to update any custom code that reads the :ref:`ref-classes-buildstats` data. - The ``meta/conf/distro/include/package_regex.inc`` is now deprecated. The contents of this file have been moved to individual recipes. diff --git a/poky/documentation/migration-guides/migration-2.2.rst b/poky/documentation/migration-guides/migration-2.2.rst index 16e48cc87c..2d4f4d603e 100644 --- a/poky/documentation/migration-guides/migration-2.2.rst +++ b/poky/documentation/migration-guides/migration-2.2.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 2.2 (morty) =================== @@ -103,7 +105,7 @@ online package-manager support through SMART still require Python 2. ``buildtools-tarball`` Includes Python 3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -``buildtools-tarball`` now includes Python 3. +The :term:`buildtools` tarball now includes Python 3. .. _migration-2.2-uclibc-replaced-by-musl: @@ -182,13 +184,7 @@ root filesystem, provides an image, and uses the ``nographic`` option:: $ runqemu qemux86-64 tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.ext4 tmp/deploy/images/qemux86-64/bzImage nographic Following is a list of variables that can be set in configuration files -such as ``bsp.conf`` to enable the BSP to be booted by ``runqemu``: - -.. note:: - - "QB" means "QEMU Boot". - -:: +such as ``bsp.conf`` to enable the BSP to be booted by ``runqemu``:: QB_SYSTEM_NAME: QEMU name (e.g. "qemu-system-i386") QB_OPT_APPEND: Options to append to QEMU (e.g. "-show-cursor") @@ -221,6 +217,10 @@ such as ``bsp.conf`` to enable the BSP to be booted by ``runqemu``: To use ``runqemu``, set :term:`IMAGE_CLASSES` as follows and run ``runqemu``: +.. note:: + + "QB" means "QEMU Boot". + .. note:: For command-line syntax, use ``runqemu help``. diff --git a/poky/documentation/migration-guides/migration-2.3.rst b/poky/documentation/migration-guides/migration-2.3.rst index d49ed474ca..38117d41b4 100644 --- a/poky/documentation/migration-guides/migration-2.3.rst +++ b/poky/documentation/migration-guides/migration-2.3.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 2.3 (pyro) ================== @@ -50,7 +52,7 @@ Consider the following: post-installation script that is installed by a function added to :term:`SYSROOT_PREPROCESS_FUNCS`. - For an example, see the :ref:`pixbufcache ` class in ``meta/classes/`` in + For an example, see the :ref:`ref-classes-pixbufcache` class in ``meta/classes/`` in the :ref:`overview-manual/development-environment:yocto project source repositories`. .. note:: @@ -363,7 +365,7 @@ The following changes have been made to Wic: .. note:: For more information on Wic, see the - ":ref:`dev-manual/common-tasks:creating partitioned images using wic`" + ":ref:`dev-manual/wic:creating partitioned images using wic`" section in the Yocto Project Development Tasks Manual. - *Default Output Directory Changed:* Wic's default output directory is @@ -400,7 +402,7 @@ The following QA checks have changed: warning, you need to address missing runtime dependencies. For additional information, see the - :ref:`insane ` class and the + :ref:`ref-classes-insane` class and the ":ref:`ref-manual/qa-checks:errors and warnings`" section. .. _migration-2.3-miscellaneous-changes: @@ -444,7 +446,7 @@ The following miscellaneous changes have occurred: RSA keys only, and with recent versions of OpenSSH, which deprecates DSA host keys. -- The :ref:`buildhistory ` class now +- The :ref:`ref-classes-buildhistory` class now correctly uses tabs as separators between all columns in ``installed-package-sizes.txt`` in order to aid import into other tools. @@ -481,29 +483,26 @@ The following miscellaneous changes have occurred: is an unnecessary burden. If you need to preserve these ``.la`` files (e.g. in a custom - distribution), you must change - :term:`INHERIT_DISTRO` such that - "remove-libtool" is not included in the value. + distribution), you must change :term:`INHERIT_DISTRO` such that + ":ref:`ref-classes-remove-libtool`" is not included + in the value. - Extensible SDKs built for GCC 5+ now refuse to install on a distribution where the host GCC version is 4.8 or 4.9. This change resulted from the fact that the installation is known to fail due to the way the ``uninative`` shared state (sstate) package is built. See - the :ref:`uninative ` class for additional - information. + the :ref:`ref-classes-uninative` class for additional information. -- All native and nativesdk recipes now use a separate - :term:`DISTRO_FEATURES` value instead of sharing the value used by - recipes for the target, in order to avoid unnecessary rebuilds. +- All :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` recipes now + use a separate :term:`DISTRO_FEATURES` value instead of sharing the value + used by recipes for the target, in order to avoid unnecessary rebuilds. - The :term:`DISTRO_FEATURES` for ``native`` recipes is - :term:`DISTRO_FEATURES_NATIVE` added to - an intersection of :term:`DISTRO_FEATURES` and - :term:`DISTRO_FEATURES_FILTER_NATIVE`. + The :term:`DISTRO_FEATURES` for :ref:`ref-classes-native` recipes + is :term:`DISTRO_FEATURES_NATIVE` added to an intersection of + :term:`DISTRO_FEATURES` and :term:`DISTRO_FEATURES_FILTER_NATIVE`. - For nativesdk recipes, the corresponding variables are - :term:`DISTRO_FEATURES_NATIVESDK` - and + For :ref:`ref-classes-nativesdk` recipes, the corresponding + variables are :term:`DISTRO_FEATURES_NATIVESDK` and :term:`DISTRO_FEATURES_FILTER_NATIVESDK`. - The ``FILESDIR`` variable, which was previously deprecated and rarely diff --git a/poky/documentation/migration-guides/migration-2.4.rst b/poky/documentation/migration-guides/migration-2.4.rst index 8904495022..9637301a47 100644 --- a/poky/documentation/migration-guides/migration-2.4.rst +++ b/poky/documentation/migration-guides/migration-2.4.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 2.4 (rocko) =================== @@ -195,12 +197,10 @@ Kernel Device Tree Move ----------------------- Kernel Device Tree support is now easier to enable in a kernel recipe. -The Device Tree code has moved to a -:ref:`kernel-devicetree ` class. +The Device Tree code has moved to a :ref:`ref-classes-kernel-devicetree` class. Functionality is automatically enabled for any recipe that inherits the -:ref:`kernel ` class and sets the -:term:`KERNEL_DEVICETREE` variable. The -previous mechanism for doing this, +:ref:`kernel ` class and sets the :term:`KERNEL_DEVICETREE` +variable. The previous mechanism for doing this, ``meta/recipes-kernel/linux/linux-dtb.inc``, is still available to avoid breakage, but triggers a deprecation warning. Future releases of the Yocto Project will remove ``meta/recipes-kernel/linux/linux-dtb.inc``. @@ -269,11 +269,11 @@ The following are additional changes: from ``meta-poky`` to OE-Core (i.e. from ``meta-poky/conf/distro/include`` to ``meta/conf/distro/include``). -- The :ref:`buildhistory ` class now makes +- The :ref:`ref-classes-buildhistory` class now makes a single commit per build rather than one commit per subdirectory in the repository. This behavior assumes the commits are enabled with :term:`BUILDHISTORY_COMMIT` = "1", which - is typical. Previously, the :ref:`buildhistory ` class made one commit + is typical. Previously, the :ref:`ref-classes-buildhistory` class made one commit per subdirectory in the repository in order to make it easier to see the changes for a particular subdirectory. To view a particular change, specify that subdirectory as the last parameter on the diff --git a/poky/documentation/migration-guides/migration-2.5.rst b/poky/documentation/migration-guides/migration-2.5.rst index 04f4cd7e73..9f089bb93b 100644 --- a/poky/documentation/migration-guides/migration-2.5.rst +++ b/poky/documentation/migration-guides/migration-2.5.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 2.5 (sumo) ================== @@ -137,7 +139,7 @@ The following are BitBake changes: - Several explicit "run this task for all recipes in the dependency tree" tasks have been removed (e.g. ``fetchall``, ``checkuriall``, and the ``*all`` tasks provided by the ``distrodata`` and - :ref:`archiver ` classes). There is a BitBake option to complete this for + :ref:`ref-classes-archiver` classes). There is a BitBake option to complete this for any arbitrary task. For example:: bitbake -c fetchall @@ -187,7 +189,7 @@ Miscellaneous Changes The following are additional changes: -- The :ref:`kernel ` class supports building packages for multiple kernels. +- The :ref:`ref-classes-kernel` class supports building packages for multiple kernels. If your kernel recipe or ``.bbappend`` file mentions packaging at all, you should replace references to the kernel in package names with ``${KERNEL_PACKAGE_NAME}``. For example, if you disable @@ -195,7 +197,7 @@ The following are additional changes: ``RDEPENDS_kernel-base = ""`` you can avoid warnings using ``RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""`` instead. -- The :ref:`buildhistory ` class commits changes to the repository by +- The :ref:`ref-classes-buildhistory` class commits changes to the repository by default so you no longer need to set ``BUILDHISTORY_COMMIT = "1"``. If you want to disable commits you need to set ``BUILDHISTORY_COMMIT = "0"`` in your configuration. @@ -207,12 +209,12 @@ The following are additional changes: maintains a full-featured BSP in the ``meta-ti`` layer. This rename avoids the previous name clash that existed between the two BSPs. -- The :ref:`update-alternatives ` class no longer works with SysV ``init`` +- The :ref:`ref-classes-update-alternatives` class no longer works with SysV ``init`` scripts because this usage has been problematic. Also, the ``sysklogd`` recipe no longer uses ``update-alternatives`` because it is incompatible with other implementations. -- By default, the :ref:`cmake ` class uses +- By default, the :ref:`ref-classes-cmake` class uses ``ninja`` instead of ``make`` for building. This improves build performance. If a recipe is broken with ``ninja``, then the recipe can set ``OECMAKE_GENERATOR = "Unix Makefiles"`` to change back to @@ -264,7 +266,7 @@ The following are additional changes: will trigger a warning during :ref:`ref-tasks-rootfs`. For more information, see the - ":ref:`dev-manual/common-tasks:post-installation scripts`" + ":ref:`dev-manual/new-recipe:post-installation scripts`" section in the Yocto Project Development Tasks Manual. - The ``elf`` image type has been removed. This image type was removed diff --git a/poky/documentation/migration-guides/migration-2.6.rst b/poky/documentation/migration-guides/migration-2.6.rst index eedede2457..477714b489 100644 --- a/poky/documentation/migration-guides/migration-2.6.rst +++ b/poky/documentation/migration-guides/migration-2.6.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 2.6 (thud) ================== @@ -126,9 +128,9 @@ missing from :term:`DEPENDS`). .. note:: - This change affects classes beyond just the two mentioned (i.e. - ``distutils`` and ``distutils3``). Any recipe that inherits ``distutils*`` - classes are affected. For example, the ``setuptools`` and ``setuptools3`` + This change affects classes beyond just the two mentioned (i.e. ``distutils`` + and ``distutils3``). Any recipe that inherits ``distutils*`` classes are + affected. For example, the ``setuptools`` and :ref:`ref-classes-setuptools3` recipes are affected since they inherit the ``distutils*`` classes. Fetching these types of dependencies that are not provided in the @@ -208,22 +210,19 @@ The following changes have been made: ``SERIAL_CONSOLE`` Deprecated ----------------------------- -The :term:`SERIAL_CONSOLE` variable has been -functionally replaced by the -:term:`SERIAL_CONSOLES` variable for some time. -With the Yocto Project 2.6 release, :term:`SERIAL_CONSOLE` has been -officially deprecated. +The ``SERIAL_CONSOLE`` variable has been functionally replaced by the +:term:`SERIAL_CONSOLES` variable for some time. With the Yocto Project 2.6 +release, ``SERIAL_CONSOLE`` has been officially deprecated. -:term:`SERIAL_CONSOLE` will continue to work as before for the 2.6 release. +``SERIAL_CONSOLE`` will continue to work as before for the 2.6 release. However, for the sake of future compatibility, it is recommended that -you replace all instances of :term:`SERIAL_CONSOLE` with -:term:`SERIAL_CONSOLES`. +you replace all instances of ``SERIAL_CONSOLE`` with :term:`SERIAL_CONSOLES`. .. note:: The only difference in usage is that :term:`SERIAL_CONSOLES` expects entries to be separated using semicolons as compared to - :term:`SERIAL_CONSOLE`, which expects spaces. + ``SERIAL_CONSOLE``, which expects spaces. .. _migration-2.6-poky-sets-unknown-configure-option-to-qa-error: @@ -315,13 +314,11 @@ This section provides information about automatic testing changes: exists and has been replaced by the :term:`TESTIMAGE_AUTO` variable. -- Inheriting the ``testimage`` and ``testsdk`` Classes: Best - practices now dictate that you use the - :term:`IMAGE_CLASSES` variable rather than the - :term:`INHERIT` variable when you inherit the - :ref:`testimage ` and - :ref:`testsdk ` classes used for automatic - testing. +- Inheriting the :ref:`ref-classes-testimage` and :ref:`ref-classes-testsdk` + classes: best practices now dictate that you use the :term:`IMAGE_CLASSES` + variable rather than the :term:`INHERIT` variable when you inherit the + :ref:`ref-classes-testimage` and :ref:`ref-classes-testsdk` classes used + for automatic testing. .. _migration-2.6-openssl-changes: @@ -367,7 +364,7 @@ Any failure of a ``pkg_postinst()`` script (including exit 1) triggers an error during the :ref:`ref-tasks-rootfs` task. For more information on post-installation behavior, see the -":ref:`dev-manual/common-tasks:post-installation scripts`" +":ref:`dev-manual/new-recipe:post-installation scripts`" section in the Yocto Project Development Tasks Manual. .. _migration-2.6-python-3-profile-guided-optimizations: diff --git a/poky/documentation/migration-guides/migration-2.7.rst b/poky/documentation/migration-guides/migration-2.7.rst index 1b8f1ce1bb..c49d2f05d2 100644 --- a/poky/documentation/migration-guides/migration-2.7.rst +++ b/poky/documentation/migration-guides/migration-2.7.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 2.7 (warrior) ===================== @@ -172,8 +174,7 @@ The following miscellaneous changes occurred: - ``base/pixbufcache``: Obsolete ``sstatecompletions`` code has been removed. -- :ref:`native ` class: - :term:`RDEPENDS` handling has been enabled. +- :ref:`ref-classes-native` class: :term:`RDEPENDS` handling has been enabled. - ``inetutils``: This recipe has rsh disabled. diff --git a/poky/documentation/migration-guides/migration-3.0.rst b/poky/documentation/migration-guides/migration-3.0.rst index 90736e6009..8e7a58e74d 100644 --- a/poky/documentation/migration-guides/migration-3.0.rst +++ b/poky/documentation/migration-guides/migration-3.0.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 3.0 (zeus) ================== @@ -47,7 +49,7 @@ The following recipes have been removed. - ``core-image-lsb-sdk``: Part of removed LSB support. - ``cve-check-tool``: Functionally replaced by the ``cve-update-db`` - recipe and :ref:`cve-check ` class. + recipe and :ref:`ref-classes-cve-check` class. - ``eglinfo``: No longer maintained. ``eglinfo`` from ``mesa-demos`` is an adequate and maintained alternative. @@ -142,7 +144,7 @@ CVE Checking ------------ ``cve-check-tool`` has been functionally replaced by a new -``cve-update-db`` recipe and functionality built into the :ref:`cve-check ` +``cve-update-db`` recipe and functionality built into the :ref:`ref-classes-cve-check` class. The result uses NVD JSON data feeds rather than the deprecated XML feeds that ``cve-check-tool`` was using, supports CVSSv3 scoring, and makes other improvements. @@ -222,7 +224,7 @@ The following sanity check changes occurred. - Github archive tarballs --- these are not guaranteed to be stable. Consequently, it is likely that the tarballs will be refreshed and - thus the SRC_URI checksums will fail to apply. It is recommended + thus the :term:`SRC_URI` checksums will fail to apply. It is recommended that you fetch either an official release tarball or a specific revision from the actual Git repository instead. @@ -259,7 +261,9 @@ The following miscellaneous changes have occurred. - The ``gnome`` class has been removed because it now does very little. You should update recipes that previously inherited this class to do - the following: inherit gnomebase gtk-icon-cache gconf mime + the following:: + + inherit gnomebase gtk-icon-cache gconf mime - The ``meta/recipes-kernel/linux/linux-dtb.inc`` file has been removed. This file was previously deprecated in favor of setting @@ -282,8 +286,8 @@ The following miscellaneous changes have occurred. - You must change the host distro identifier used in :term:`NATIVELSBSTRING` to use all lowercase characters even if it does not contain a version number. This change - is necessary only if you are not using ``uninative`` and - :term:`SANITY_TESTED_DISTROS`. + is necessary only if you are not using + :ref:`ref-classes-uninative` and :term:`SANITY_TESTED_DISTROS`. - In the ``base-files`` recipe, writing the hostname into ``/etc/hosts`` and ``/etc/hostname`` is now done within the main diff --git a/poky/documentation/migration-guides/migration-3.1.rst b/poky/documentation/migration-guides/migration-3.1.rst index 7fdd3b88a6..fdb959c4af 100644 --- a/poky/documentation/migration-guides/migration-3.1.rst +++ b/poky/documentation/migration-guides/migration-3.1.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 3.1 (dunfell) ===================== @@ -125,7 +127,7 @@ renamed to ``features_check``; the ``distro_features_check`` class still exists but generates a warning and redirects to the new class. In preparation for a future removal of the old class it is recommended that you update recipes currently inheriting ``distro_features_check`` to -inherit :ref:`features_check ` instead. +inherit :ref:`ref-classes-features_check` instead. .. _migration-3.1-removed-classes: @@ -238,10 +240,10 @@ Warnings will now be shown at :ref:`ref-tasks-package_qa` time in the following circumstances: - A recipe installs ``.desktop`` files containing ``MimeType`` keys but - does not inherit the new :ref:`mime-xdg ` class + does not inherit the new :ref:`ref-classes-mime-xdg` class - A recipe installs ``.xml`` files into ``${datadir}/mime/packages`` - but does not inherit the :ref:`mime ` class + but does not inherit the :ref:`ref-classes-mime` class .. _migration-3.1-x86-live-wic: diff --git a/poky/documentation/migration-guides/migration-3.2.rst b/poky/documentation/migration-guides/migration-3.2.rst index a714bd6bca..c538df04d2 100644 --- a/poky/documentation/migration-guides/migration-3.2.rst +++ b/poky/documentation/migration-guides/migration-3.2.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 3.2 (gatesgarth) ======================== @@ -11,7 +13,7 @@ Minimum system requirements ``gcc`` version 6.0 is now required at minimum on the build host. For older host distributions where this is not available, you can use the -``buildtools-extended-tarball`` (easily installable using +:term:`buildtools-extended` tarball (easily installable using ``scripts/install-buildtools``). @@ -175,13 +177,23 @@ errors: In addition, the following new checks were added and default to triggering an error: -- :ref:`shebang-size `: Check for shebang (#!) lines longer than 128 characters, which can give an error at runtime depending on the operating system. +- :ref:`shebang-size `: Check for shebang (#!) lines + longer than 128 characters, which can give an error at runtime depending on + the operating system. -- :ref:`unhandled-features-check `: Check if any of the variables supported by the :ref:`features_check ` class is set while not inheriting the class itself. +- :ref:`unhandled-features-check `: Check + if any of the variables supported by the :ref:`ref-classes-features_check` + class is set while not inheriting the class itself. -- :ref:`missing-update-alternatives `: Check if the recipe sets the :term:`ALTERNATIVE` variable for any of its packages, and does not inherit the :ref:`update-alternatives ` class. +- :ref:`missing-update-alternatives `: + Check if the recipe sets the :term:`ALTERNATIVE` variable for any of its + packages, and does not inherit the :ref:`ref-classes-update-alternatives` + class. -- A trailing slash or duplicated slashes in the value of :term:`S` or :term:`B` will now trigger a warning so that they can be removed and path comparisons can be more reliable --- remove any instances of these in your recipes if the warning is displayed. +- A trailing slash or duplicated slashes in the value of :term:`S` or :term:`B` + will now trigger a warning so that they can be removed and path comparisons + can be more reliable --- remove any instances of these in your recipes if the + warning is displayed. .. _migration-3.2-src-uri-file-globbing: @@ -207,9 +219,18 @@ files into a subdirectory and reference that instead. deploy class now cleans ``DEPLOYDIR`` before ``do_deploy`` ---------------------------------------------------------- -:ref:`ref-tasks-deploy` as implemented in the :ref:`deploy ` class now cleans up ${:term:`DEPLOYDIR`} before running, just as :ref:`ref-tasks-install` cleans up ${:term:`D`} before running. This reduces the risk of :term:`DEPLOYDIR` being accidentally contaminated by files from previous runs, possibly even with different config, in case of incremental builds. +:ref:`ref-tasks-deploy` as implemented in the :ref:`ref-classes-deploy` class +now cleans up ${:term:`DEPLOYDIR`} before running, just as +:ref:`ref-tasks-install` cleans up ${:term:`D`} before running. This reduces +the risk of :term:`DEPLOYDIR` being accidentally contaminated by files from +previous runs, possibly even with different config, in case of incremental +builds. -Most recipes and classes that inherit the :ref:`deploy ` class or interact with :ref:`ref-tasks-deploy` are unlikely to be affected by this unless they add ``prefuncs`` to :ref:`ref-tasks-deploy` *which also* put files into ``${DEPLOYDIR}`` --- these should be refactored to use ``do_deploy_prepend`` instead. +Most recipes and classes that inherit the :ref:`ref-classes-deploy` class or +interact with :ref:`ref-tasks-deploy` are unlikely to be affected by this +unless they add ``prefuncs`` to :ref:`ref-tasks-deploy` *which also* put files +into ``${DEPLOYDIR}`` --- these should be refactored to use +``do_deploy_prepend`` instead. .. _migration-3.2-nativesdk-sdk-provides-dummy: @@ -217,7 +238,13 @@ Most recipes and classes that inherit the :ref:`deploy ` cla Custom SDK / SDK-style recipes need to include ``nativesdk-sdk-provides-dummy`` ------------------------------------------------------------------------------- -All ``nativesdk`` packages require ``/bin/sh`` due to their postinstall scriptlets, thus this package has to be dummy-provided within the SDK and ``nativesdk-sdk-provides-dummy`` now does this. If you have a custom SDK recipe (or your own SDK-style recipe similar to e.g. ``buildtools-tarball``), you will need to ensure ``nativesdk-sdk-provides-dummy`` or an equivalent is included in :term:`TOOLCHAIN_HOST_TASK`. +All :ref:`ref-classes-nativesdk` packages require ``/bin/sh`` due +to their postinstall scriptlets, thus this package has to be dummy-provided +within the SDK and ``nativesdk-sdk-provides-dummy`` now does this. If you have +a custom SDK recipe (or your own SDK-style recipe similar to e.g. +``buildtools-tarball``), you will need to ensure +``nativesdk-sdk-provides-dummy`` or an equivalent is included in +:term:`TOOLCHAIN_HOST_TASK`. ``ld.so.conf`` now moved back to main ``glibc`` package diff --git a/poky/documentation/migration-guides/migration-3.3.rst b/poky/documentation/migration-guides/migration-3.3.rst index aba5c4237c..d1e589d7b4 100644 --- a/poky/documentation/migration-guides/migration-3.3.rst +++ b/poky/documentation/migration-guides/migration-3.3.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 3.3 (hardknott) ======================= @@ -12,7 +14,7 @@ Minimum system requirements You will now need at least Python 3.6 installed on your build host. Most recent distributions provide this, but should you be building on a distribution that -does not have it, you can use the ``buildtools-tarball`` (easily installable +does not have it, you can use the :term:`buildtools` tarball (easily installable using ``scripts/install-buildtools``) --- see :ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions` for details. @@ -61,13 +63,15 @@ need to update those. New ``python3targetconfig`` class --------------------------------- -A new :ref:`python3targetconfig ` class has been -created for situations where you would previously have inherited the -:ref:`python3native ` class but need access to target configuration data (such as -correct installation directories). Recipes where this situation applies should -be changed to inherit ``python3targetconfig`` instead of ``python3native``. This -also adds a dependency on target ``python3``, so it should only be used where -appropriate in order to avoid unnecessarily lengthening builds. +A new :ref:`ref-classes-python3targetconfig` class has +been created for situations where you would previously have inherited the +:ref:`ref-classes-python3native` class but need access to +target configuration data (such as correct installation directories). Recipes +where this situation applies should be changed to inherit +:ref:`ref-classes-python3targetconfig` instead of +:ref:`ref-classes-python3native`. This also adds a dependency +on target ``python3``, so it should only be used where appropriate in order to +avoid unnecessarily lengthening builds. Some example recipes where this change has been made: ``gpgme``, ``libcap-ng``, ``python3-pycairo``. @@ -95,11 +99,10 @@ variable so that recipes can specify it explicitly, for example:: S = "${WORKDIR}/git" DISTUTILS_SETUP_PATH = "${S}/python/pythonmodule" -Recipes that inherit from ``distutils3`` (or -:ref:`setuptools3 ` which itself inherits -``distutils3``) that also set :term:`S` to -point to a Python module within a subdirectory in the aforementioned -manner should be changed to set ``DISTUTILS_SETUP_PATH`` instead. +Recipes that inherit from ``distutils3`` (or :ref:`ref-classes-setuptools3` +which itself inherits ``distutils3``) that also set :term:`S` to point to a +Python module within a subdirectory in the aforementioned manner should be +changed to set ``DISTUTILS_SETUP_PATH`` instead. .. _migration-3.3-bitbake: diff --git a/poky/documentation/migration-guides/migration-3.4.rst b/poky/documentation/migration-guides/migration-3.4.rst index 4ceea7b0e4..076c589c8c 100644 --- a/poky/documentation/migration-guides/migration-3.4.rst +++ b/poky/documentation/migration-guides/migration-3.4.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Migration notes for 3.4 (honister) ---------------------------------- @@ -93,7 +95,7 @@ The ``lz4c``, ``pzstd`` and ``zstd`` commands are now required to be installed on the build host to support LZ4 and Zstandard compression functionality. These are typically provided by ``lz4`` and ``zstd`` packages in most Linux distributions. Alternatively they are available -as part of ``buildtools-tarball`` if your distribution does not provide +as part of :term:`buildtools` tarball if your distribution does not provide them. For more information see :ref:`ref-manual/system-requirements:required packages for the build host`. @@ -124,7 +126,7 @@ Removed classes - ``image-mklibs``: not actively tested and upstream mklibs still requires Python 2 - ``meta``: no longer useful. Recipes that need to skip installing - packages should inherit ``nopackages`` instead. + packages should inherit :ref:`ref-classes-nopackages` instead. Prelinking disabled by default ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -257,7 +259,7 @@ Miscellaneous instead. - The obsolete ``oe_machinstall`` function previously provided in the - :ref:`utils ` class has been removed. For + :ref:`ref-classes-utils` class has been removed. For machine-specific installation it is recommended that you use the built-in override support in the fetcher or overrides in general instead. diff --git a/poky/documentation/migration-guides/migration-4.0.rst b/poky/documentation/migration-guides/migration-4.0.rst index 17b1d3c619..3106498404 100644 --- a/poky/documentation/migration-guides/migration-4.0.rst +++ b/poky/documentation/migration-guides/migration-4.0.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 4.0 (kirkstone) ======================= @@ -117,7 +119,7 @@ License changes - The ``AVAILABLE_LICENSES`` variable has been removed. This variable was a performance liability and is highly dependent on which layers are added to the configuration, which can cause signature issues for users. In addition the ``available_licenses()`` - function has been removed from the :ref:`license ` class as + function has been removed from the :ref:`ref-classes-license` class as it is no longer needed. Removed recipes @@ -141,15 +143,14 @@ Python changes - The Python package build process is now based on `wheels `__. Here are the new Python packaging classes that should be used: - :ref:`python_flit_core `, - :ref:`python_setuptools_build_meta ` - and :ref:`python_poetry_core `. + :ref:`ref-classes-python_flit_core`, :ref:`ref-classes-python_setuptools_build_meta` + and :ref:`ref-classes-python_poetry_core`. -- The :ref:`setuptools3 ` class :ref:`ref-tasks-install` task now +- The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now installs the ``wheel`` binary archive. In current versions of ``setuptools`` the legacy ``setup.py install`` method is deprecated. If the ``setup.py`` cannot be used with wheels, for example it creates files outside of the Python module or standard - entry points, then :ref:`setuptools3_legacy ` should + entry points, then :ref:`ref-classes-setuptools3_legacy` should be used instead. Prelink removed @@ -171,7 +172,7 @@ Reproducible as standard Reproducibility is now considered as standard functionality, thus the ``reproducible`` class has been removed and its previous contents merged into the -:ref:`base ` class. If you have references in your configuration to +:ref:`ref-classes-base` class. If you have references in your configuration to ``reproducible`` in :term:`INHERIT`, :term:`USER_CLASSES` etc. then they should be removed. @@ -189,7 +190,7 @@ Supported host distribution changes - ``gcc`` version 7.5 is now required at minimum on the build host. For older host distributions where this is not available, you can use the - ``buildtools-extended-tarball`` (easily installable using + :term:`buildtools-extended` tarball (easily installable using ``scripts/install-buildtools``). :append/:prepend in combination with other operators @@ -213,15 +214,15 @@ Miscellaneous changes ~~~~~~~~~~~~~~~~~~~~~ - ``blacklist.bbclass`` is removed and the functionality moved to the - :ref:`base ` class with a more descriptive + :ref:`ref-classes-base` class with a more descriptive ``varflag`` variable named :term:`SKIP_RECIPE` which will use the `bb.parse.SkipRecipe()` function. The usage remains the same, for example:: SKIP_RECIPE[my-recipe] = "Reason for skipping recipe" -- :ref:`allarch ` packagegroups can no longer depend on packages +- :ref:`ref-classes-allarch` packagegroups can no longer depend on packages which use :term:`PKG` renaming such as :ref:`ref-classes-debian`. Such packagegroups - recipes should be changed to avoid inheriting :ref:`allarch `. + recipes should be changed to avoid inheriting :ref:`ref-classes-allarch`. - The ``lnr`` script has been removed. ``lnr`` implemented the same behaviour as `ln --relative --symbolic`, since at the time of creation `--relative` was only available in coreutils 8.16 @@ -230,7 +231,7 @@ Miscellaneous changes any calls to ``lnr`` in your recipes or classes, they should be replaced with `ln --relative --symbolic` or `ln -rs` if you prefer the short version. -- The ``package_qa_handle_error()`` function formerly in the :ref:`insane ` +- The ``package_qa_handle_error()`` function formerly in the :ref:`ref-classes-insane` class has been moved and renamed - if you have any references in your own custom classes they should be changed to ``oe.qa.handle_error()``. @@ -265,3 +266,6 @@ Miscellaneous changes when parsing recipes. Any code depending on the previous behaviour will no longer work - change any such code to explicitly use appropriate path variables instead. +- In order to exclude the kernel image from the image rootfs, + :term:`RRECOMMENDS`\ ``:${KERNEL_PACKAGE_NAME}-base`` should be set instead of + :term:`RDEPENDS`\ ``:${KERNEL_PACKAGE_NAME}-base``. diff --git a/poky/documentation/migration-guides/migration-4.1.rst b/poky/documentation/migration-guides/migration-4.1.rst index bb8c6dd697..86721b9873 100644 --- a/poky/documentation/migration-guides/migration-4.1.rst +++ b/poky/documentation/migration-guides/migration-4.1.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 4.1 (langdale) ====================== @@ -14,10 +16,10 @@ make 4.0 is now the minimum required make version ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ glibc now requires ``make`` 4.0 to build, thus it is now the version required to -be installed on the build host. A new ``buildtools-make-tarball`` has been +be installed on the build host. A new :term:`buildtools-make` tarball has been introduced to provide just make 4.0 for host distros without a current/working make 4.x version; if you also need other tools you can use the updated -``buildtools-tarball``. For more information see +:term:`buildtools` tarball. For more information see :ref:`ref-manual/system-requirements:required packages for the build host`. @@ -90,7 +92,7 @@ now cause an error:: INHERIT += "testimage" -Since :ref:`testimage ` is a class intended solely to +Since :ref:`ref-classes-testimage` is a class intended solely to affect image recipes, this would be correctly specified as:: IMAGE_CLASSES += "testimage" @@ -152,16 +154,16 @@ Miscellaneous changes you can set :term:`WATCHDOG_TIMEOUT` to the desired timeout in seconds. Note that the same :term:`WATCHDOG_TIMEOUT` variable also specifies the timeout used for the ``watchdog`` tool (if that is being built). -- The :ref:`image-buildinfo ` class now writes to +- The :ref:`ref-classes-image-buildinfo` class now writes to ``${sysconfdir}/buildinfo`` instead of ``${sysconfdir}/build`` by default (i.e. the default value of :term:`IMAGE_BUILDINFO_FILE` has been changed). If you have code that reads this from images at build or runtime you will need to update it or specify your own value for :term:`IMAGE_BUILDINFO_FILE`. -- In the :ref:`archiver ` class, the default +- In the :ref:`ref-classes-archiver` class, the default ``ARCHIVER_OUTDIR`` value no longer includes the :term:`MACHINE` value in order to avoid the archive task running multiple times in a multiconfig setup. If you have custom code that does something with the files archived by the - :ref:`archiver ` class then you may need to adjust it to + :ref:`ref-classes-archiver` class then you may need to adjust it to the new structure. - If you are not using `systemd` then udev is now configured to use labels (``LABEL`` or ``PARTLABEL``) to set the mount point for the device. For example:: @@ -182,7 +184,7 @@ Miscellaneous changes - The Python ``zoneinfo`` module is now split out to its own ``python3-zoneinfo`` package. - The :term:`PACKAGECONFIG` option to enable wpa_supplicant in the ``connman`` - recipe has been renamed to "wpa-supplicant". If you have set PACKAGECONFIG for + recipe has been renamed to "wpa-supplicant". If you have set :term:`PACKAGECONFIG` for the ``connman`` recipe to include this option you will need to update your configuration. Related to this, the :term:`WIRELESS_DAEMON` variable now expects the new ``wpa-supplicant`` naming and affects ``packagegroup-base`` @@ -192,7 +194,7 @@ Miscellaneous changes :term:`PACKAGECONFIG`. If you are customising this file you will need to update your customisations. - With the introduction of picobuild in - :ref:`python_pep517 `, The ``PEP517_BUILD_API`` + :ref:`ref-classes-python_pep517`, The ``PEP517_BUILD_API`` variable is no longer supported. If you have any references to this variable you should remove them. diff --git a/poky/documentation/migration-guides/migration-4.2.rst b/poky/documentation/migration-guides/migration-4.2.rst new file mode 100644 index 0000000000..944ad31a4c --- /dev/null +++ b/poky/documentation/migration-guides/migration-4.2.rst @@ -0,0 +1,48 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Release 4.2 (mickledore) +======================== + +Migration notes for 4.2 (mickledore) +------------------------------------ + +This section provides migration information for moving to the Yocto +Project 4.2 Release (codename "mickledore") from the prior release. + +.. _migration-4.2-python-3.8: + +Python 3.8 is now the minimum required Python version version +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~------------ + +BitBake and OpenEmbedded-Core are now relying on Python 3.8, +making it a requirement to use a distribution providing at least this +version, or to use :term:`buildtools`. + +.. _migration-4.2-qa-checks: + +QA check changes +~~~~~~~~~~~~~~~~ + +.. _migration-4.2-misc-changes: + +Miscellaneous changes +~~~~~~~~~~~~~~~~~~~~~ + +- The ``OEBasic`` signature handler (see :term:`BB_SIGNATURE_HANDLER`) has been + removed. + +.. _migration-4.2-removed-variables: + +Removed variables +~~~~~~~~~~~~~~~~~ + +The following variables have been removed: +- ``SERIAL_CONSOLE``, deprecated since version 2.6, replaced by :term:``SERIAL_CONSOLES``. + +.. _migration-4.2-removed-recipes: + +Removed recipes +~~~~~~~~~~~~~~~ + +The following recipes have been removed in this release: + diff --git a/poky/documentation/migration-guides/migration-general.rst b/poky/documentation/migration-guides/migration-general.rst index 847bdad739..1820f5cfd8 100644 --- a/poky/documentation/migration-guides/migration-general.rst +++ b/poky/documentation/migration-guides/migration-general.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Introduction ============ @@ -74,32 +76,33 @@ any new Yocto Project release. - *Checking Image / SDK Changes*: - The :ref:`buildhistory ` class can be used + The :ref:`ref-classes-buildhistory` class can be used if you wish to check the impact of changes to images / SDKs across the migration (e.g. added/removed packages, added/removed files, size changes etc.). To do this, follow these steps: - 1. Enable buildhistory before the migration + #. Enable :ref:`ref-classes-buildhistory` before the migration - 2. Run a pre-migration build + #. Run a pre-migration build - 3. Capture the buildhistory output (as specified by :term:`BUILDHISTORY_DIR`) - and ensure it is preserved for subsequent builds. How you would do this - depends on how you are running your builds - if you are doing this all on - one workstation in the same :term:`Build Directory` you may not need to do - anything other than not deleting the buildhistory output directory. For - builds in a pipeline it may be more complicated. + #. Capture the :ref:`ref-classes-buildhistory` output (as + specified by :term:`BUILDHISTORY_DIR`) and ensure it is preserved for + subsequent builds. How you would do this depends on how you are running + your builds - if you are doing this all on one workstation in the same + :term:`Build Directory` you may not need to do anything other than not + deleting the :ref:`ref-classes-buildhistory` output + directory. For builds in a pipeline it may be more complicated. - 4. Set a tag in the buildhistory output (which is a git repository) before + #. Set a tag in the :ref:`ref-classes-buildhistory` output (which is a git repository) before migration, to make the commit from the pre-migration build easy to find as you may end up running multiple builds during the migration. - 5. Perform the migration + #. Perform the migration - 6. Run a build + #. Run a build - 7. Check the output changes between the previously set tag and HEAD in the - buildhistory output using ``git diff`` or ``buildhistory-diff``. + #. Check the output changes between the previously set tag and HEAD in the + :ref:`ref-classes-buildhistory` output using ``git diff`` or ``buildhistory-diff``. - For more information on using buildhistory, see - :ref:`dev-manual/common-tasks:maintaining build output quality`. + For more information on using :ref:`ref-classes-buildhistory`, see + :ref:`dev-manual/build-quality:maintaining build output quality`. diff --git a/poky/documentation/migration-guides/release-3.4.rst b/poky/documentation/migration-guides/release-3.4.rst index 66023108c7..043fdd1c9f 100644 --- a/poky/documentation/migration-guides/release-3.4.rst +++ b/poky/documentation/migration-guides/release-3.4.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 3.4 (honister) ====================== diff --git a/poky/documentation/migration-guides/release-4.0.rst b/poky/documentation/migration-guides/release-4.0.rst index eb0744cc76..8ca8498838 100644 --- a/poky/documentation/migration-guides/release-4.0.rst +++ b/poky/documentation/migration-guides/release-4.0.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 4.0 (kirkstone) ======================= @@ -10,3 +12,4 @@ Release 4.0 (kirkstone) release-notes-4.0.3 release-notes-4.0.4 release-notes-4.0.5 + release-notes-4.0.6 diff --git a/poky/documentation/migration-guides/release-4.1.rst b/poky/documentation/migration-guides/release-4.1.rst index 8ebf4a4c95..10e8d5a2d5 100644 --- a/poky/documentation/migration-guides/release-4.1.rst +++ b/poky/documentation/migration-guides/release-4.1.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release 4.1 (langdale) ====================== @@ -5,3 +7,4 @@ Release 4.1 (langdale) migration-4.1 release-notes-4.1 + release-notes-4.1.1 diff --git a/poky/documentation/migration-guides/release-4.2.rst b/poky/documentation/migration-guides/release-4.2.rst new file mode 100644 index 0000000000..ae52d939c8 --- /dev/null +++ b/poky/documentation/migration-guides/release-4.2.rst @@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Release 4.2 (mickledore) +======================== + +.. toctree:: + + migration-4.2 + release-notes-4.2 diff --git a/poky/documentation/migration-guides/release-notes-3.4.1.rst b/poky/documentation/migration-guides/release-notes-3.4.1.rst index d15a8a8fbd..097c249a90 100644 --- a/poky/documentation/migration-guides/release-notes-3.4.1.rst +++ b/poky/documentation/migration-guides/release-notes-3.4.1.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for 3.4.1 (honister) ---------------------------------- @@ -53,9 +55,9 @@ Fixes in 3.4.1 - ca-certificates: update 20210119 -> 20211016 - classes/populate_sdk_base: Add setscene tasks - conf: update for release 3.4 -- convert-srcuri.py: use regex to check space in SRC_URI +- convert-srcuri.py: use regex to check space in :term:`SRC_URI` - create-spdx: Fix key errors in do_create_runtime_spdx -- create-spdx: Protect against None from LICENSE_PATH +- create-spdx: Protect against None from :term:`LICENSE_PATH` - create-spdx: Set the Organization field via a variable - create-spdx: add create_annotation function - create-spdx: cross recipes are native also @@ -82,18 +84,18 @@ Fixes in 3.4.1 - insane.bbclass: Add a check for directories that are expected to be empty - kernel-devsrc: Add vdso.lds and other build files for riscv64 as well - libnewt: Use python3targetconfig to fix reproducibility issue -- libpcre/libpcre2: correct SRC_URI -- libx11-compose-data: Update LICENSE to better reflect reality -- libx11: Update LICENSE to better reflect reality +- libpcre/libpcre2: correct :term:`SRC_URI` +- libx11-compose-data: Update :term:`LICENSE` to better reflect reality +- libx11: Update :term:`LICENSE` to better reflect reality - libxml2: Use python3targetconfig to fix reproducibility issue - linunistring: Add missing gperf-native dependency - linux-firmware: upgrade to 20211027 -- linux-yocto-dev: Ensure DEPENDS matches recent 5.14 kernel changes +- linux-yocto-dev: Ensure :term:`DEPENDS` matches recent 5.14 kernel changes - linux-yocto-rt/5.10: update to -rt54 - linux-yocto/5.10: update to v5.10.78 - linux-yocto/5.14: common-pc: enable CONFIG_ATA_PIIX as built-in - linux-yocto/5.14: update to v5.14.17 -- linux-yocto: add libmpc-native to DEPENDS +- linux-yocto: add libmpc-native to :term:`DEPENDS` - lttng-tools: replace ad hoc ptest fixup with upstream fixes - manuals: releases.rst: move gatesgarth to outdated releases section - mesa: Enable svga for x86 only @@ -126,13 +128,13 @@ Fixes in 3.4.1 - qemu.inc: Remove empty egg-info directories before running meson - recipes: Update github.com urls to use https - ref-manual: Update how to set a useradd password -- ref-manual: document "reproducible_build" class and SOURCE_DATE_EPOCH +- ref-manual: document "reproducible_build" class and :term:`SOURCE_DATE_EPOCH` - ref-manual: document BUILD_REPRODUCIBLE_BINARIES -- ref-manual: document TOOLCHAIN_HOST_TASK_ESDK +- ref-manual: document :term:`TOOLCHAIN_HOST_TASK_ESDK` - ref-manual: remove meta class - ref-manual: update system requirements - releases.rst: fix release number for 3.3.3 -- scripts/convert-srcuri: Update SRC_URI conversion script to handle github url changes +- scripts/convert-srcuri: Update :term:`SRC_URI` conversion script to handle github url changes - scripts/lib/wic/help.py: Update Fedora Kickstart URLs - scripts/oe-package-browser: Fix after overrides change - scripts/oe-package-browser: Handle no packages being built @@ -153,7 +155,7 @@ Fixes in 3.4.1 - waffle: convert to git, website is down - wayland: Fix wayland-tools packaging - wireless-regdb: upgrade 2021.07.14 -> 2021.08.28 -- wpa-supplicant: Match package override to PACKAGES for pkg_postinst +- wpa-supplicant: Match package override to :term:`PACKAGES` for pkg_postinst Contributors to 3.4.1 ~~~~~~~~~~~~~~~~~~~~~ diff --git a/poky/documentation/migration-guides/release-notes-3.4.2.rst b/poky/documentation/migration-guides/release-notes-3.4.2.rst index ddf25ef1bd..5ff42d3900 100644 --- a/poky/documentation/migration-guides/release-notes-3.4.2.rst +++ b/poky/documentation/migration-guides/release-notes-3.4.2.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for 3.4.2 (honister) ---------------------------------- @@ -15,7 +17,7 @@ Security Fixes in 3.4.2 - libsndfile1: fix :cve:`2021-4156` - xserver-xorg: whitelist two CVEs - grub2: fix :cve:`2021-3981` -- xserver-xorg: update CVE_PRODUCT +- xserver-xorg: update :term:`CVE_PRODUCT` - binutils: :cve:`2021-42574` - gcc: Fix :cve:`2021-42574` - gcc: Fix :cve:`2021-35465` @@ -38,7 +40,7 @@ Fixes in 3.4.2 - vim: upgrade to patch 4269 - vim: update to include latest CVE fixes - expat: upgrade to 2.4.4 -- libusb1: correct SRC_URI +- libusb1: correct :term:`SRC_URI` - yocto-check-layer: add debug output for the layers that were found - linux-firmware: Add CLM blob to linux-firmware-bcm4373 package - linux-yocto/5.10: update to v5.10.93 @@ -49,7 +51,7 @@ Fixes in 3.4.2 - kernel: introduce python3-dtschema-wrapper - vim: upgrade to 8.2 patch 3752 - bootchart2: Add missing python3-math dependency -- socat: update SRC_URI +- socat: update :term:`SRC_URI` - pigz: fix one failure of command "unpigz -l" - linux-yocto/5.14: update genericx86* machines to v5.14.21 - linux-yocto/5.10: update genericx86* machines to v5.10.87 @@ -69,7 +71,7 @@ Fixes in 3.4.2 - rpm: remove tmp folder created during install - package_manager: ipk: Fix host manifest generation - bitbake: utils: Update to use exec_module() instead of load_module() -- linux-yocto: add libmpc-native to DEPENDS +- linux-yocto: add libmpc-native to :term:`DEPENDS` - ref-manual: fix patch documentation - bitbake: tests/fetch: Drop gnu urls from wget connectivity test - bitbake: fetch: npm: Use temporary file for empty user config @@ -112,7 +114,7 @@ Fixes in 3.4.2 - classes/crate-fetch: Ensure crate fetcher is available - rootfs-postcommands: update systemd_create_users - classes/meson: Add optional rust definitions -- rust-cross: Replace TARGET_ARCH with TUNE_PKGARCH +- rust-cross: Replace :term:`TARGET_ARCH` with :term:`TUNE_PKGARCH` - maintainers.inc: fix up rust-cross entry - rust-cross: Fix directory not deleted for race glibc vs. musl - wic: use shutil.which diff --git a/poky/documentation/migration-guides/release-notes-3.4.3.rst b/poky/documentation/migration-guides/release-notes-3.4.3.rst index 9db53d71df..2af802307d 100644 --- a/poky/documentation/migration-guides/release-notes-3.4.3.rst +++ b/poky/documentation/migration-guides/release-notes-3.4.3.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for 3.4.3 (honister) ---------------------------------- @@ -28,7 +30,7 @@ Fixes in 3.4.3 - build-appliance-image: Update to honister head revision - coreutils: remove obsolete ignored CVE list - crate-fetch: fix setscene failures -- cups: Add --with-dbusdir to EXTRA_OECONF for deterministic build +- cups: Add --with-dbusdir to :term:`EXTRA_OECONF` for deterministic build - cve-check: create directory of CVE_CHECK_MANIFEST before copy - cve-check: get_cve_info should open the database read-only - default-distrovars.inc: Switch connectivity check to a yoctoproject.org page @@ -59,7 +61,7 @@ Fixes in 3.4.3 - kernel-devsrc: do not copy Module.symvers file during install - libarchive : update to 3.5.3 - libpcap: Disable DPDK explicitly -- libxml-parser-perl: Add missing RDEPENDS +- libxml-parser-perl: Add missing :term:`RDEPENDS` - linux-firmware: upgrade 20211216 -> 20220209 - linux-yocto/5.10: Fix ramoops/ftrace - linux-yocto/5.10: features/zram: remove CONFIG_ZRAM_DEF_COMP @@ -74,7 +76,7 @@ Fixes in 3.4.3 - poky.conf: bump version for 3.4.3 honister release - qemuboot: Fix build error if UNINATIVE_LOADER is unset - quilt: Disable external sendmail for deterministic build -- recipetool: Fix circular reference in SRC_URI +- recipetool: Fix circular reference in :term:`SRC_URI` - releases: update to include 3.3.5 - releases: update to include 3.4.2 - rootfs-postcommands: amend systemd_create_users add user to group check diff --git a/poky/documentation/migration-guides/release-notes-3.4.4.rst b/poky/documentation/migration-guides/release-notes-3.4.4.rst index 55a4583b29..0bf9a16209 100644 --- a/poky/documentation/migration-guides/release-notes-3.4.4.rst +++ b/poky/documentation/migration-guides/release-notes-3.4.4.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for 3.4.4 (honister) ---------------------------------- @@ -19,20 +21,20 @@ Fixes in 3.4.4 - bitbake: knotty: reduce keep-alive timeout from 5000s (83 minutes) to 10 minutes - bitbake: server/process: Disable gc around critical section - bitbake: server/xmlrpcserver: Add missing xmlrpcclient import -- bitbake: toaster: Fix IMAGE_INSTALL issues with _append vs :append +- bitbake: toaster: Fix :term:`IMAGE_INSTALL` issues with _append vs :append - bitbake: toaster: fixtures replace gatesgarth - build-appliance-image: Update to honister head revision - conf.py/poky.yaml: Move version information to poky.yaml and read in conf.py - conf/machine: fix QEMU x86 sound options -- devupstream: fix handling of SRC_URI +- devupstream: fix handling of :term:`SRC_URI` - documentation: update for 3.4.4 release - externalsrc/devtool: Fix to work with fixed export funcition flags handling - gmp: add missing COPYINGv3 -- gnu-config: update SRC_URI +- gnu-config: update :term:`SRC_URI` - libxml2: fix CVE-2022-23308 regression - libxml2: move to gitlab.gnome.org - libxml2: update to 2.9.13 -- libxshmfence: Correct LICENSE to HPND +- libxshmfence: Correct :term:`LICENSE` to HPND - license_image.bbclass: close package.manifest file - linux-firmware: correct license for ar3k firmware - linux-firmware: upgrade 20220310 -> 20220411 @@ -54,7 +56,7 @@ Fixes in 3.4.4 - u-boot: Inherit pkgconfig - uninative: Upgrade to 3.6 with gcc 12 support - vim: Upgrade 8.2.4524 -> 8.2.4681 -- virglrenderer: update SRC_URI +- virglrenderer: update :term:`SRC_URI` - webkitgtk: update to 2.32.4 - wireless-regdb: upgrade 2022.02.18 -> 2022.04.08 diff --git a/poky/documentation/migration-guides/release-notes-3.4.rst b/poky/documentation/migration-guides/release-notes-3.4.rst index 62683b4a5c..d76bb004b1 100644 --- a/poky/documentation/migration-guides/release-notes-3.4.rst +++ b/poky/documentation/migration-guides/release-notes-3.4.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for 3.4 (honister) -------------------------------- @@ -7,7 +9,7 @@ New Features / Enhancements in 3.4 - Linux kernel 5.14, glibc 2.34 and ~280 other recipe upgrades - Switched override character to ':' (replacing '_') for more robust parsing and improved performance --- see the above migration guide for help - Rust integrated into core, providing rust support for cross-compilation and SDK -- New create-spdx class for creating SPDX SBoM documents +- New :ref:`ref-classes-create-spdx` class for creating SPDX SBoM documents - New recipes: cargo, core-image-ptest-all, core-image-ptest-fast, core-image-weston-sdk, erofs-utils, gcompat, gi-docgen, libmicrohttpd, libseccomp, libstd-rs, perlcross, python3-markdown, python3-pyyaml, python3-smartypants, python3-typogrify, rust, rust-cross, rust-cross-canadian, rust-hello-world, rust-llvm, rust-tools-cross-canadian, rustfmt, xwayland - Several optimisations to reduce unnecessary task dependencies for faster builds - seccomp integrated into core, with additional enabling for gnutls, systemd, qemu @@ -38,7 +40,7 @@ New Features / Enhancements in 3.4 - Support zstd-compressed modules and :term:`Initramfs` images - Allow opt-out of split kernel modules - - linux-yocto-dev: base AUTOREV on specified version + - linux-yocto-dev: base :term:`AUTOREV` on specified version - kernel-yocto: provide debug / summary information for metadata - kernel-uboot: Handle gzip and lzo compression options - linux-yocto/5.14: added devupstream support @@ -68,7 +70,9 @@ New Features / Enhancements in 3.4 - SDK-related enhancements: - Enable :ref:`ref-tasks-populate_sdk` with multilibs - - New ``SDKPATHINSTALL`` variable decouples default install path from built in path to avoid rebuilding nativesdk components on e.g. :term:`DISTRO_VERSION` changes + - New ``SDKPATHINSTALL`` variable decouples default install path from + built in path to avoid rebuilding :ref:`ref-classes-nativesdk` + components on e.g. :term:`DISTRO_VERSION` changes - eSDK: Error if trying to generate an eSDK from a multiconfig - eSDK: introduce :term:`TOOLCHAIN_HOST_TASK_ESDK` to be used in place of :term:`TOOLCHAIN_HOST_TASK` to add components to the host part of the eSDK @@ -170,47 +174,47 @@ Known Issues in 3.4 Recipe Licenses changes in 3.4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The following corrections have been made to the LICENSE values set by recipes: - -- acpica: correct LICENSE to "Intel | BSD-3-Clause | GPLv2" -- dtc: correct LICENSE to "GPLv2 | BSD-2-Clause" -- e2fsprogs: correct LICENSE to "GPLv2 & LGPLv2 & BSD-3-Clause & MIT" -- ffmpeg: correct LICENSE to "GPLv2+ & LGPLv2.1+ & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG" -- flac: correct LICENSE to "GFDL-1.2 & GPLv2+ & LGPLv2.1+ & BSD-3-Clause" -- flex: correct LICENSE to "BSD-3-Clause & LGPL-2.0+" -- font-util: correct LICENSE to "MIT & MIT-style & BSD-4-Clause & BSD-2-Clause" -- glib-2.0: correct LICENSE to "LGPLv2.1+ & BSD-3-Clause & PD" -- gobject-introspection: correct LICENSE to "LGPLv2+ & GPLv2+ & MIT" (add MIT license) -- hdparm: correct LICENSE to "BSD-2-Clause & GPLv2 & hdparm" -- iputils: correct LICENSE to "BSD-3-Clause & GPLv2+" -- libcap: correct LICENSE to "BSD-3-Clause | GPLv2" -- libevent: correct LICENSE to "BSD-3-Clause & MIT" -- libjitterentropy: correct LICENSE to "GPLv2+ | BSD-3-Clause" -- libpam: correct LICENSE to "GPLv2+ | BSD-3-Clause" -- libwpe: correct LICENSE to "BSD-2-Clause" -- libx11-compose-data: correct LICENSE to "MIT & MIT-style & BSD-4-Clause & BSD-2-Clause" -- libx11: correct LICENSE to "MIT & MIT-style & BSD-4-Clause & BSD-2-Clause" -- libxfont2: correct LICENSE to "MIT & MIT-style & BSD-4-Clause & BSD-2-Clause" -- libxfont: correct LICENSE to "MIT & MIT-style & BSD-3-Clause" -- lsof: correct LICENSE to reflect that it uses a BSD-like (but not exactly BSD) license ("Spencer-94") -- nfs-utils: correct LICENSE to "MIT & GPLv2+ & BSD-3-Clause" +The following corrections have been made to the :term:`LICENSE` values set by recipes: + +- acpica: correct :term:`LICENSE` to "Intel | BSD-3-Clause | GPLv2" +- dtc: correct :term:`LICENSE` to "GPLv2 | BSD-2-Clause" +- e2fsprogs: correct :term:`LICENSE` to "GPLv2 & LGPLv2 & BSD-3-Clause & MIT" +- ffmpeg: correct :term:`LICENSE` to "GPLv2+ & LGPLv2.1+ & ISC & MIT & BSD-2-Clause & BSD-3-Clause & IJG" +- flac: correct :term:`LICENSE` to "GFDL-1.2 & GPLv2+ & LGPLv2.1+ & BSD-3-Clause" +- flex: correct :term:`LICENSE` to "BSD-3-Clause & LGPL-2.0+" +- font-util: correct :term:`LICENSE` to "MIT & MIT-style & BSD-4-Clause & BSD-2-Clause" +- glib-2.0: correct :term:`LICENSE` to "LGPLv2.1+ & BSD-3-Clause & PD" +- gobject-introspection: correct :term:`LICENSE` to "LGPLv2+ & GPLv2+ & MIT" (add MIT license) +- hdparm: correct :term:`LICENSE` to "BSD-2-Clause & GPLv2 & hdparm" +- iputils: correct :term:`LICENSE` to "BSD-3-Clause & GPLv2+" +- libcap: correct :term:`LICENSE` to "BSD-3-Clause | GPLv2" +- libevent: correct :term:`LICENSE` to "BSD-3-Clause & MIT" +- libjitterentropy: correct :term:`LICENSE` to "GPLv2+ | BSD-3-Clause" +- libpam: correct :term:`LICENSE` to "GPLv2+ | BSD-3-Clause" +- libwpe: correct :term:`LICENSE` to "BSD-2-Clause" +- libx11-compose-data: correct :term:`LICENSE` to "MIT & MIT-style & BSD-4-Clause & BSD-2-Clause" +- libx11: correct :term:`LICENSE` to "MIT & MIT-style & BSD-4-Clause & BSD-2-Clause" +- libxfont2: correct :term:`LICENSE` to "MIT & MIT-style & BSD-4-Clause & BSD-2-Clause" +- libxfont: correct :term:`LICENSE` to "MIT & MIT-style & BSD-3-Clause" +- lsof: correct :term:`LICENSE` to reflect that it uses a BSD-like (but not exactly BSD) license ("Spencer-94") +- nfs-utils: correct :term:`LICENSE` to "MIT & GPLv2+ & BSD-3-Clause" - ovmf: correct license to "BSD-2-Clause-Patent" -- ppp: correct LICENSE to "BSD-3-Clause & BSD-3-Clause-Attribution & GPLv2+ & LGPLv2+ & PD" -- python3-packaging: correct LICENSE to "Apache-2.0 | BSD-2-Clause" -- python-async-test: correct LICENSE to "BSD-3-Clause" +- ppp: correct :term:`LICENSE` to "BSD-3-Clause & BSD-3-Clause-Attribution & GPLv2+ & LGPLv2+ & PD" +- python3-packaging: correct :term:`LICENSE` to "Apache-2.0 | BSD-2-Clause" +- python-async-test: correct :term:`LICENSE` to "BSD-3-Clause" - quota: remove BSD license (only BSD licensed part of the code was removed in 4.05) -- shadow: correct LICENSE to "BSD-3-Clause | Artistic-1.0" -- shadow-sysroot: set LICENSE the same as shadow -- sudo: correct LICENSE to "ISC & BSD-3-Clause & BSD-2-Clause & Zlib" -- swig: correct LICENSE to "BSD-3-Clause & GPLv3" +- shadow: correct :term:`LICENSE` to "BSD-3-Clause | Artistic-1.0" +- shadow-sysroot: set :term:`LICENSE` the same as shadow +- sudo: correct :term:`LICENSE` to "ISC & BSD-3-Clause & BSD-2-Clause & Zlib" +- swig: correct :term:`LICENSE` to "BSD-3-Clause & GPLv3" - valgrind: correct license to "GPLv2 & GPLv2+ & BSD-3-Clause" -- webkitgtk: correct LICENSE to "BSD-2-Clause & LGPLv2+" -- wpebackend-fdo: correct LICENSE to "BSD-2-Clause" -- xinetd: correct LICENSE to reflect that it uses a unique BSD-like (but not exactly BSD) license +- webkitgtk: correct :term:`LICENSE` to "BSD-2-Clause & LGPLv2+" +- wpebackend-fdo: correct :term:`LICENSE` to "BSD-2-Clause" +- xinetd: correct :term:`LICENSE` to reflect that it uses a unique BSD-like (but not exactly BSD) license Other license-related notes: -- When creating recipes for Python software, recipetool will now treat "BSD" as "BSD-3-Clause" for the purposes of setting LICENSE, as that is the most common understanding. +- When creating recipes for Python software, recipetool will now treat "BSD" as "BSD-3-Clause" for the purposes of setting :term:`LICENSE`, as that is the most common understanding. - Please be aware that an :term:`Initramfs` bundled with the kernel using :term:`INITRAMFS_IMAGE_BUNDLE` should only contain GPLv2-compatible software; this is now mentioned in the documentation. Security Fixes in 3.4 diff --git a/poky/documentation/migration-guides/release-notes-4.0.1.rst b/poky/documentation/migration-guides/release-notes-4.0.1.rst index 28d1d71dcf..c46142a08a 100644 --- a/poky/documentation/migration-guides/release-notes-4.0.1.rst +++ b/poky/documentation/migration-guides/release-notes-4.0.1.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for 4.0.1 (kirkstone) ----------------------------------- @@ -39,7 +41,7 @@ Fixes in 4.0.1 - docs: migration-guides: migration-3.4: mention that hardcoded password are supported if hashed - docs: migration-guides: release-notes-4.0: fix risc-v typo - docs: migration-guides: release-notes-4.0: replace kernel placeholder with correct recipe name -- docs: ref-manual: variables: add hashed password example in EXTRA_USERS_PARAMS +- docs: ref-manual: variables: add hashed password example in :term:`EXTRA_USERS_PARAMS` - docs: set_versions.py: add information about obsolescence of a release - docs: set_versions.py: fix latest release of a branch being shown twice in switchers.js - docs: set_versions.py: fix latest version of an active release shown as obsolete @@ -81,7 +83,7 @@ Fixes in 4.0.1 - linux-yocto/5.15: update to v5.15.36 - linux-yocto: enable powerpc-debug fragment - mdadm: Drop clang specific cflags -- migration-3.4: add missing entry on EXTRA_USERS_PARAMS +- migration-3.4: add missing entry on :term:`EXTRA_USERS_PARAMS` - migration-guides: add release notes for 4.0 - migration-guides: complete migration guide for 4.0 - migration-guides: release-notes-4.0: mention LTS release @@ -89,7 +91,7 @@ Fixes in 4.0.1 - migration-guides: stop including documents with ".. include" - musl: Fix build when usrmerge distro feature is enabled - ncurses: use COPYING file -- neard: Switch SRC_URI to git repo +- neard: Switch :term:`SRC_URI` to git repo - oeqa/selftest: add test for git working correctly inside pseudo - openssl: minor security upgrade 3.0.2 -> 3.0.3 - package.bbclass: Prevent perform_packagecopy from removing /sysroot-only @@ -99,14 +101,14 @@ Fixes in 4.0.1 - poky.conf: bump version for 4.0.1 release - qemu.bbclass: Extend ppc/ppc64 extra options - qemuarm64: use virtio pci interfaces -- qemuarmv5: use arm-versatile-926ejs KMACHINE -- ref-manual: Add XZ_THREADS and XZ_MEMLIMIT -- ref-manual: add KERNEL_DEBUG_TIMESTAMPS -- ref-manual: add ZSTD_THREADS +- qemuarmv5: use arm-versatile-926ejs :term:`KMACHINE` +- ref-manual: Add :term:`XZ_THREADS` and :term:`XZ_MEMLIMIT` +- ref-manual: add :term:`KERNEL_DEBUG_TIMESTAMPS` +- ref-manual: add :term:`ZSTD_THREADS` - ref-manual: add a note about hard-coded passwords - ref-manual: add empty-dirs QA check and QA_EMPTY_DIRS* -- ref-manual: add mention of vendor filtering to CVE_PRODUCT -- ref-manual: mention wildcarding support in INCOMPATIBLE_LICENSE +- ref-manual: add mention of vendor filtering to :term:`CVE_PRODUCT` +- ref-manual: mention wildcarding support in :term:`INCOMPATIBLE_LICENSE` - releases: update for yocto 4.0 - rootfs-postcommands: fix symlinks where link and output path are equal - ruby: upgrade 3.1.1 -> 3.1.2 @@ -122,7 +124,7 @@ Fixes in 4.0.1 - systemd-boot: remove outdated EFI_LD comment - systemtap: Fix build with gcc-12 - terminal.py: Restore error output from Terminal -- u-boot: Correct the SRC_URI +- u-boot: Correct the :term:`SRC_URI` - u-boot: Inherit pkgconfig - update_udev_hwdb: fix multilib issue with systemd - util-linux: Create u-a symlink for findfs utility diff --git a/poky/documentation/migration-guides/release-notes-4.0.2.rst b/poky/documentation/migration-guides/release-notes-4.0.2.rst index 2c79969f4d..2f724e33c4 100644 --- a/poky/documentation/migration-guides/release-notes-4.0.2.rst +++ b/poky/documentation/migration-guides/release-notes-4.0.2.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for Yocto-4.0.2 (Kirkstone) ----------------------------------------- @@ -5,7 +7,7 @@ Security Fixes in Yocto-4.0.2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - libxslt: Mark :cve:`2022-29824` as not applying -- tiff: Add jbig PACKAGECONFIG and clarify IGNORE :cve:`2022-1210` +- tiff: Add jbig :term:`PACKAGECONFIG` and clarify IGNORE :cve:`2022-1210` - tiff: mark :cve:`2022-1622` and :cve:`2022-1623` as invalid - pcre2:fix :cve:`2022-1586` Out-of-bounds read - curl: fix :cve:`2022-22576`, :cve:`2022-27775`, :cve:`2022-27776`, :cve:`2022-27774`, :cve:`2022-30115`, :cve:`2022-27780`, :cve:`2022-27781`, :cve:`2022-27779` and :cve:`2022-27782` @@ -23,7 +25,7 @@ Fixes in Yocto-4.0.2 - bash: submit patch upstream - bind: upgrade 9.18.1 -> 9.18.2 - binutils: Bump to latest 2.38 release branch -- bitbake.conf: Make TCLIBC and TCMODE lazy assigned +- bitbake.conf: Make :term:`TCLIBC` and :term:`TCMODE` lazy assigned - bitbake: build: Add clean_stamp API function to allow removal of task stamps - bitbake: data: Do not depend on vardepvalueexclude flag - bitbake: fetch2/osc: Small fixes for osc fetcher @@ -56,7 +58,7 @@ Fixes in Yocto-4.0.2 - gcc-source: Fix incorrect task dependencies from ${B} - gcc: Upgrade to 11.3 release - gcc: depend on zstd-native -- git: fix override syntax in RDEPENDS +- git: fix override syntax in :term:`RDEPENDS` - glib-2.0: upgrade 2.72.1 -> 2.72.2 - glibc: Drop make-native dependency - go: upgrade 1.17.8 -> 1.17.10 @@ -83,7 +85,7 @@ Fixes in Yocto-4.0.2 - libpcre2: upgrade 10.39 -> 10.40 - librepo: upgrade 1.14.2 -> 1.14.3 - libseccomp: Add missing files for ptests -- libseccomp: Correct LIC_FILES_CHKSUM +- libseccomp: Correct :term:`LIC_FILES_CHKSUM` - libxkbcommon: upgrade 1.4.0 -> 1.4.1 - libxml2: Upgrade 2.9.13 -> 2.9.14 - license.bbclass: Bound beginline and endline in copy_license_files() @@ -125,8 +127,8 @@ Fixes in Yocto-4.0.2 - perl: Add dependency on make-native to avoid race issues - perl: Fix build with gcc-12 - poky.conf: bump version for 4.0.2 -- popt: fix override syntax in RDEPENDS -- pypi.bbclass: Set CVE_PRODUCT to PYPI_PACKAGE +- popt: fix override syntax in :term:`RDEPENDS` +- pypi.bbclass: Set :term:`CVE_PRODUCT` to :term:`PYPI_PACKAGE` - python3: Ensure stale empty python module directories don't break the build - python3: Remove problematic paths from sysroot files - python3: fix reproducibility issue with python3-core @@ -143,7 +145,7 @@ Fixes in Yocto-4.0.2 - sanity: Don't warn about make 4.2.1 for mint - sanity: Switch to make 4.0 as a minimum version - sed: Specify shell for "nobody" user in run-ptest -- selftest/imagefeatures/overlayfs: Always append to DISTRO_FEATURES +- selftest/imagefeatures/overlayfs: Always append to :term:`DISTRO_FEATURES` - selftest/multiconfig: Test that multiconfigs in separate layers works - sqlite3: upgrade to 3.38.5 - staging.bbclass: process direct dependencies in deterministic order diff --git a/poky/documentation/migration-guides/release-notes-4.0.3.rst b/poky/documentation/migration-guides/release-notes-4.0.3.rst index 9f51ff9b3e..46fe858cb7 100644 --- a/poky/documentation/migration-guides/release-notes-4.0.3.rst +++ b/poky/documentation/migration-guides/release-notes-4.0.3.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for Yocto-4.0.3 (Kirkstone) ----------------------------------------- @@ -29,7 +31,7 @@ Fixes in Yocto-4.0.3 - base.bbclass: Correct the test for obsolete license exceptions - base/reproducible: Change Source Date Epoch generation methods - bin_package: install into base_prefix -- bind: Remove legacy python3 PACKAGECONFIG code +- bind: Remove legacy python3 :term:`PACKAGECONFIG` code - bind: upgrade to 9.18.4 - binutils: stable 2.38 branch updates - build-appliance-image: Update to kirkstone head revision @@ -38,8 +40,8 @@ Fixes in Yocto-4.0.3 - curl: backport openssl fix CN check error code - cve-check: hook cleanup to the BuildCompleted event, not CookerExit - cve-extra-exclusions: Clean up and ignore three CVEs (2xqemu and nasm) -- devtool: finish: handle patching when S points to subdir of a git repo -- devtool: ignore pn- overrides when determining SRC_URI overrides +- devtool: finish: handle patching when :term:`S` points to subdir of a git repo +- devtool: ignore pn- overrides when determining :term:`SRC_URI` overrides - docs: BB_HASHSERVE_UPSTREAM: update to new host - dropbear: break dependency on base package for -dev package - efivar: fix import functionality @@ -48,7 +50,7 @@ Fixes in Yocto-4.0.3 - externalsrc.bbclass: support crate fetcher on externalsrc - font-util: update 1.3.2 -> 1.3.3 - gcc-runtime: Fix build when using gold -- gcc-runtime: Fix missing MLPREFIX in debug mappings +- gcc-runtime: Fix missing :term:`MLPREFIX` in debug mappings - gcc-runtime: Pass -nostartfiles when building dummy libstdc++.so - gcc: Backport a fix for gcc bug 105039 - git: upgrade to v2.35.4 @@ -56,8 +58,8 @@ Fixes in Yocto-4.0.3 - glib-networking: upgrade to 2.72.1 - glibc : stable 2.35 branch updates - glibc-tests: Avoid reproducibility issues -- glibc-tests: not clear BBCLASSEXTEND -- glibc: revert one upstream change to work around broken DEBUG_BUILD build +- glibc-tests: not clear :term:`BBCLASSEXTEND` +- glibc: revert one upstream change to work around broken :term:`DEBUG_BUILD` build - glibc: stable 2.35 branch updates - gnupg: upgrade to 2.3.7 - go: upgrade to v1.17.12 @@ -84,8 +86,8 @@ Fixes in Yocto-4.0.3 - kernel-arch: Fix buildpaths leaking into external module compiles - kernel-devsrc: fix reproducibility and buildpaths QA warning - kernel-devsrc: ppc32: fix reproducibility -- kernel-uboot.bbclass: Use vmlinux.initramfs when INITRAMFS_IMAGE_BUNDLE set -- kernel.bbclass: pass LD also in savedefconfig +- kernel-uboot.bbclass: Use vmlinux.initramfs when :term:`INITRAMFS_IMAGE_BUNDLE` set +- kernel.bbclass: pass :term:`LD` also in savedefconfig - libffi: fix native build being not portable - libgcc: Fix standalone target builds with usrmerge distro feature - libmodule-build-perl: Use env utility to find perl interpreter @@ -115,7 +117,7 @@ Fixes in Yocto-4.0.3 - oeqa/runtime/scp: Disable scp test for dropbear - oeqa/runtime: add test that the kernel has CONFIG_PREEMPT_RT enabled - oeqa/sdk: drop the nativesdk-python 2.x test -- openssh: Add openssh-sftp-server to openssh RDEPENDS +- openssh: Add openssh-sftp-server to openssh :term:`RDEPENDS` - openssh: break dependency on base package for -dev package - openssl: update to 3.0.5 - package.bbclass: Avoid stripping signed kernel modules in splitdebuginfo @@ -123,28 +125,28 @@ Fixes in Yocto-4.0.3 - package.bbclass: Fix kernel source handling when not using externalsrc - package_manager/ipk: do not pipe stderr to stdout - packagegroup-core-ssh-dropbear: Add openssh-sftp-server recommendation -- patch: handle if S points to a subdirectory of a git repo +- patch: handle if :term:`S` points to a subdirectory of a git repo - perf: fix reproducibility in 5.19+ - perf: fix reproduciblity in older releases of Linux - perf: sort-pmuevents: really keep array terminators - perl: don't install Makefile.old into perl-ptest - poky.conf: bump version for 4.0.3 -- pulseaudio: add m4-native to DEPENDS +- pulseaudio: add m4-native to :term:`DEPENDS` - python3: Backport patch to fix an issue in subinterpreters -- qemu: Add PACKAGECONFIG for brlapi +- qemu: Add :term:`PACKAGECONFIG` for brlapi - qemu: Avoid accidental librdmacm linkage - qemu: Avoid accidental libvdeplug linkage - qemu: Fix slirp determinism issue -- qemu: add PACKAGECONFIG for capstone -- recipetool/devtool: Fix python egg whitespace issues in PACKAGECONFIG +- qemu: add :term:`PACKAGECONFIG` for capstone +- recipetool/devtool: Fix python egg whitespace issues in :term:`PACKAGECONFIG` - ref-manual: variables: remove sphinx directive from literal block - rootfs-postcommands.bbclass: move host-user-contaminated.txt to ${S} -- ruby: add PACKAGECONFIG for capstone +- ruby: add :term:`PACKAGECONFIG` for capstone - rust: fix issue building cross-canadian tools for aarch64 on x86_64 - sanity.bbclass: Add ftps to accepted URI protocols for mirrors sanity - selftest/runtime_test/virgl: Disable for all almalinux - sstatesig: Include all dependencies in SPDX task signatures -- strace: set COMPATIBLE_HOST for riscv32 +- strace: set :term:`COMPATIBLE_HOST` for riscv32 - systemd: Added base_bindir into pkg_postinst:udev-hwdb. - udev-extraconf/initrdscripts/parted: Rename mount.blacklist -> mount.ignorelist - udev-extraconf/mount.sh: add LABELs to mountpoints @@ -169,7 +171,7 @@ Fixes in Yocto-4.0.3 - xev: upgrade to 1.2.5 - xf86-input-synaptics: upgrade to 1.9.2 - xmodmap: upgrade to 1.0.11 -- xorg-app: Tweak handling of compression changes in SRC_URI +- xorg-app: Tweak handling of compression changes in :term:`SRC_URI` - xserver-xorg: upgrade to 21.1.4 - xwayland: upgrade to 22.1.3 - yocto-bsps/5.10: fix buildpaths issue with gen-mach-types diff --git a/poky/documentation/migration-guides/release-notes-4.0.4.rst b/poky/documentation/migration-guides/release-notes-4.0.4.rst index 9068841783..bb4cc8b185 100644 --- a/poky/documentation/migration-guides/release-notes-4.0.4.rst +++ b/poky/documentation/migration-guides/release-notes-4.0.4.rst @@ -1,4 +1,6 @@ -Release notes for Yocto-4.0.4 (Kirkstone) +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Releae notes for Yocto-4.0.4 (Kirkstone) ----------------------------------------- Security Fixes in Yocto-4.0.4 @@ -28,13 +30,13 @@ Fixes in Yocto-4.0.4 - autoconf: Fix strict prototype errors in generated tests - autoconf: Update K & R stype functions - bind: upgrade to 9.18.5 -- bitbake.conf: set BB_DEFAULT_UMASK using ??= +- bitbake.conf: set :term:`BB_DEFAULT_UMASK` using ??= - bitbake: ConfHandler/BBHandler: Improve comment error messages and add tests - bitbake: ConfHandler: Remove lingering close - bitbake: bb/utils: movefile: use the logger for printing - bitbake: bb/utils: remove: check the path again the expand python glob - bitbake: bitbake-user-manual: Correct description of the ??= operator -- bitbake: bitbake-user-manual: npm fetcher: improve description of SRC_URI format +- bitbake: bitbake-user-manual: npm fetcher: improve description of :term:`SRC_URI` format - bitbake: bitbake: bitbake-user-manual: hashserv can be accessed on a dedicated domain - bitbake: bitbake: runqueue: add cpu/io pressure regulation - bitbake: bitbake: runqueue: add memory pressure regulation @@ -77,7 +79,7 @@ Fixes in Yocto-4.0.4 - iso-codes: upgrade to 4.11.0 - kernel-fitimage.bbclass: add padding algorithm property in config nodes - kernel-fitimage.bbclass: only package unique DTBs -- kernel: Always set CC and LD for the kernel build +- kernel: Always set :term:`CC` and :term:`LD` for the kernel build - kernel: Use consistent make flags for menuconfig - lib:npm_registry: initial checkin - libatomic-ops: upgrade to 7.6.14 @@ -94,18 +96,18 @@ Fixes in Yocto-4.0.4 - linux-yocto/5.10: update to v5.10.137 - linux-yocto/5.15: update genericx86* machines to v5.15.59 - linux-yocto/5.15: update to v5.15.62 -- linux-yocto: Fix COMPATIBLE_MACHINE regex match -- linux-yocto: prepend the value with a space when append to KERNEL_EXTRA_ARGS +- linux-yocto: Fix :term:`COMPATIBLE_MACHINE` regex match +- linux-yocto: prepend the value with a space when append to :term:`KERNEL_EXTRA_ARGS` - lttng-modules: fix 5.19+ build - lttng-modules: fix build against mips and v5.19 kernel - lttng-modules: fix build for kernel 5.10.137 - lttng-modules: replace mips compaction fix with upstream change - lz4: upgrade to 1.9.4 - maintainers: update opkg maintainer -- meta: introduce UBOOT_MKIMAGE_KERNEL_TYPE +- meta: introduce :term:`UBOOT_MKIMAGE_KERNEL_TYPE` - migration guides: add missing release notes - mobile-broadband-provider-info: upgrade to 20220725 -- nativesdk: Clear TUNE_FEATURES +- nativesdk: Clear :term:`TUNE_FEATURES` - npm: replace 'npm pack' call by 'tar czf' - npm: return content of 'package.json' in 'npm_pack' - npm: take 'version' directly from 'package.json' @@ -124,7 +126,7 @@ Fixes in Yocto-4.0.4 - poky.conf: add ubuntu-22.04 to tested distros - poky.conf: bump version for 4.0.4 - pseudo: Update to include recent upstream minor fixes -- python3-pip: Fix RDEPENDS after the update +- python3-pip: Fix :term:`RDEPENDS` after the update - ref-manual: add numa to machine features - relocate_sdk.py: ensure interpreter size error causes relocation to fail - rootfs-postcommands.bbclass: avoid moving ssh host keys if etc is writable @@ -140,12 +142,12 @@ Fixes in Yocto-4.0.4 - shadow: Avoid nss warning/error with musl - shadow: Enable subid support - system-requirements.rst: Add Ubuntu 22.04 to list of supported distros -- systemd: Add 'no-dns-fallback' PACKAGECONFIG option +- systemd: Add 'no-dns-fallback' :term:`PACKAGECONFIG` option - systemd: Fix unwritable /var/lock when no sysvinit handling - sysvinit-inittab/start_getty: Fix respawn too fast - tcp-wrappers: Fix implicit-function-declaration warnings - tzdata: upgrade to 2022b -- util-linux: Remove --enable-raw from EXTRA_OECONF +- util-linux: Remove --enable-raw from :term:`EXTRA_OECONF` - vala: upgrade to 0.56.3 - vim: Upgrade to 9.0.0453 - watchdog: Include needed system header for function decls diff --git a/poky/documentation/migration-guides/release-notes-4.0.5.rst b/poky/documentation/migration-guides/release-notes-4.0.5.rst index ea0280b03c..172b8b800d 100644 --- a/poky/documentation/migration-guides/release-notes-4.0.5.rst +++ b/poky/documentation/migration-guides/release-notes-4.0.5.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for Yocto-4.0.5 (Kirkstone) ----------------------------------------- @@ -28,7 +30,7 @@ Fixes in Yocto-4.0.5 - build-appliance-image: Update to kirkstone head revision (4a88ada) - busybox: add devmem 128-bit support - classes: files: Extend overlayfs-etc class -- coreutils: add openssl PACKAGECONFIG +- coreutils: add openssl :term:`PACKAGECONFIG` - create-pull-request: don't switch the git remote protocol to git:// - dev-manual: fix reference to BitBake user manual - expat: upgrade 2.4.8 -> 2.4.9 @@ -39,15 +41,15 @@ Fixes in Yocto-4.0.5 - glibc-locale: explicitly remove empty dirs in ${libdir} - glibc-tests: use += instead of :append - glibc: stable 2.35 branch updates.(8d125a1f) -- go-native: switch from SRC_URI:append to SRC_URI += +- go-native: switch from SRC_URI:append to :term:`SRC_URI` += - image_types_wic.bbclass: fix cross binutils dependency - kern-tools: allow 'y' or 'm' to avoid config audit warnings -- kern-tools: fix queue processing in relative TOPDIR configurations +- kern-tools: fix queue processing in relative :term:`TOPDIR` configurations - kernel-yocto: allow patch author date to be commit date - libpng: upgrade to 1.6.38 - linux-firmware: package new Qualcomm firmware - linux-firmware: upgrade 20220708 -> 20220913 -- linux-libc-headers: switch from SRC_URI:append to SRC_URI += +- linux-libc-headers: switch from SRC_URI:append to :term:`SRC_URI` += - linux-yocto-dev: add qemuarm64 - linux-yocto/5.10: update to v5.10.149 - linux-yocto/5.15: cfg: fix ACPI warnings for -tiny @@ -63,7 +65,7 @@ Fixes in Yocto-4.0.5 - perf: Fix for recent kernel upgrades - poky.conf: bump version for 4.0.5 - poky.yaml.in: update version requirements -- python3-rfc3986-validator: switch from SRC_URI:append to SRC_URI += +- python3-rfc3986-validator: switch from SRC_URI:append to :term:`SRC_URI` += - python3: upgrade 3.10.4 -> 3.10.7 - qemu: Backport patches from upstream to support float128 on qemu-ppc64 - rpm: Remove -Wimplicit-function-declaration warnings @@ -72,7 +74,7 @@ Fixes in Yocto-4.0.5 - stress-cpu: disable float128 math on powerpc64 to avoid SIGILL - tune-neoversen2: support tune-neoversen2 base on armv9a - tzdata: update to 2022d -- u-boot: switch from append to += in SRC_URI +- u-boot: switch from append to += in :term:`SRC_URI` - uninative: Upgrade to 3.7 to work with glibc 2.36 - vim: Upgrade to 9.0.0598 - webkitgtk: Update to 2.36.7 diff --git a/poky/documentation/migration-guides/release-notes-4.0.6.rst b/poky/documentation/migration-guides/release-notes-4.0.6.rst new file mode 100644 index 0000000000..76d23fcf0c --- /dev/null +++ b/poky/documentation/migration-guides/release-notes-4.0.6.rst @@ -0,0 +1,313 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Release notes for Yocto-4.0.6 (Kirkstone) +----------------------------------------- + +Security Fixes in Yocto-4.0.6 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- bash: Fix :cve:`2022-3715` +- curl: Fix :cve:`2022-32221`, :cve:`2022-42915` and :cve:`2022-42916` +- dbus: Fix :cve:`2022-42010`, :cve:`2022-42011` and :cve:`2022-42012` +- dropbear: Fix :cve:`2021-36369` +- ffmpeg: Fix :cve:`2022-3964`, :cve:`2022-3965` +- go: Fix :cve:`2022-2880` +- grub2: Fix :cve:`2022-2601`, :cve:`2022-3775` and :cve:`2022-28736` +- libarchive: Fix :cve:`2022-36227` +- libpam: Fix :cve:`2022-28321` +- libsndfile1: Fix :cve:`2021-4156` +- lighttpd: Fix :cve:`2022-41556` +- openssl: Fix :cve:`2022-3358` +- pixman: Fix :cve:`2022-44638` +- python3-mako: Fix :cve:`2022-40023` +- python3: Fix :cve:`2022-42919` +- qemu: Fix :cve:`2022-3165` +- sysstat: Fix :cve:`2022-39377` +- systemd: Fix :cve:`2022-3821` +- tiff: Fix :cve:`2022-2953`, :cve:`2022-3599`, :cve:`2022-3597`, :cve:`2022-3626`, :cve:`2022-3627`, :cve:`2022-3570`, :cve:`2022-3598` and :cve:`2022-3970` +- vim: Fix :cve:`2022-3352`, :cve:`2022-3705` and :cve:`2022-4141` +- wayland: Fix :cve:`2021-3782` +- xserver-xorg: Fix :cve:`2022-3550` and :cve:`2022-3551` + + +Fixes in Yocto-4.0.6 +~~~~~~~~~~~~~~~~~~~~ + +- archiver: avoid using machine variable as it breaks multiconfig +- babeltrace: upgrade to 1.5.11 +- bind: upgrade to 9.18.8 +- bitbake.conf: Drop export of SOURCE_DATE_EPOCH_FALLBACK +- bitbake: gitsm: Fix regression in gitsm submodule path parsing +- bitbake: runqueue: Fix race issues around hash equivalence and sstate reuse +- bluez5: Point hciattach bcm43xx firmware search path to /lib/firmware +- bluez5: add dbus to RDEPENDS +- build-appliance-image: Update to kirkstone head revision +- buildtools-tarball: export certificates to python and curl +- cargo_common.bbclass: Fix typos +- classes: make TOOLCHAIN more permissive for kernel +- cmake-native: Fix host tool contamination (Bug: 14951) +- common-tasks.rst: fix oeqa runtime test path +- create-spdx.bbclass: remove unused SPDX_INCLUDE_PACKAGED +- create-spdx: Remove ";name=..." for downloadLocation +- create-spdx: default share_src for shared sources +- cve-update-db-native: add timeout to urlopen() calls +- dbus: upgrade to 1.14.4 +- dhcpcd: fix to work with systemd +- expat: upgrade to 2.5.0 +- externalsrc.bbclass: Remove a trailing slash from ${B} +- externalsrc.bbclass: fix git repo detection +- externalsrc: git submodule--helper list unsupported +- gcc-shared-source: Fix source date epoch handling +- gcc-source: Drop gengtype manipulation +- gcc-source: Ensure deploy_source_date_epoch sstate hash doesn't change +- gcc-source: Fix gengtypes race +- gdk-pixbuf: upgrade to 2.42.10 +- get_module_deps3.py: Check attribute '__file__' +- glib-2.0: fix rare GFileInfo test case failure +- glibc-locale: Do not INHIBIT_DEFAULT_DEPS +- gnomebase.bbclass: return the whole version for tarball directory if it is a number +- gnutls: Unified package names to lower-case +- groff: submit patches upstream +- gstreamer1.0-libav: fix errors with ffmpeg 5.x +- gstreamer1.0: upgrade to 1.20.4 +- ifupdown: upgrade to 0.8.39 +- insane.bbclass: Allow hashlib version that only accepts on parameter +- iso-codes: upgrade to 4.12.0 +- kea: submit patch upstream (fix-multilib-conflict.patch) +- kern-tools: fix relative path processing +- kern-tools: integrate ZFS speedup patch +- kernel-yocto: improve fatal error messages of symbol_why.py +- kernel.bbclass: Include randstruct seed assets in STAGING_KERNEL_BUILDDIR +- kernel.bbclass: make KERNEL_DEBUG_TIMESTAMPS work at rebuild +- kernel: Clear SYSROOT_DIRS instead of replacing sysroot_stage_all +- libcap: upgrade to 2.66 +- libepoxy: convert to git +- libepoxy: update to 1.5.10 +- libffi: submit patch upstream (0001-arm-sysv-reverted-clang-VFP-mitigation.patch ) +- libffi: upgrade to 3.4.4 +- libical: upgrade to 3.0.16 +- libksba: upgrade to 1.6.2 +- libuv: fixup SRC_URI +- libxcrypt: upgrade to 4.4.30 +- lighttpd: upgrade to 1.4.67 +- linux-firmware: add new fw file to ${PN}-qcom-adreno-a530 +- linux-firmware: don't put the firmware into the sysroot +- linux-firmware: package amdgpu firmware +- linux-firmware: split rtl8761 firmware +- linux-firmware: upgrade to 20221109 +- linux-yocto/5.10: update genericx86* machines to v5.10.149 +- linux-yocto/5.15: fix CONFIG_CRYPTO_CCM mismatch warnings +- linux-yocto/5.15: update genericx86* machines to v5.15.72 +- linux-yocto/5.15: update to v5.15.78 +- ltp: backport clock_gettime04 fix from upstream +- lttng-modules: upgrade to 2.13.7 +- lttng-tools: Upgrade to 2.13.8 +- lttng-tools: submit determinism.patch upstream +- lttng-ust: upgrade to 2.13.5 +- meson: make wrapper options sub-command specific +- meta-selftest/staticids: add render group for systemd +- mirrors.bbclass: update CPAN_MIRROR +- mirrors.bbclass: use shallow tarball for binutils-native +- mobile-broadband-provider-info: upgrade 20220725 -> 20221107 +- mtd-utils: upgrade 2.1.4 -> 2.1.5 +- numactl: upgrade to 2.0.16 +- oe/packagemanager/rpm: don't leak file objects +- oeqa/selftest/lic_checksum: Cleanup changes to emptytest include +- oeqa/selftest/minidebuginfo: Create selftest for minidebuginfo +- oeqa/selftest/tinfoil: Add test for separate config_data with recipe_parse_file() +- openssl: Fix SSL_CERT_FILE to match ca-certs location +- openssl: upgrade to 3.0.7 +- openssl: export necessary env vars in SDK +- opkg-utils: use a git clone, not a dynamic snapshot +- opkg: Set correct info_dir and status_file in opkg.conf +- overlayfs: Allow not used mount points +- ovmf: correct patches status +- package: Fix handling of minidebuginfo with newer binutils +- perf: Depend on native setuptools3 +- poky.conf: bump version for 4.0.6 +- psplash: add psplash-default in rdepends +- psplash: consider the situation of psplash not exist for systemd +- python3: advance to version 3.10.8 +- qemu-helper-native: Correctly pass program name as argv[0] +- qemu-helper-native: Re-write bridge helper as C program +- qemu-native: Add PACKAGECONFIG option for jack +- qemu: add io_uring PACKAGECONFIG +- quilt: backport a patch to address grep 3.8 failures +- resolvconf: make it work +- rm_work: exclude the SSTATETASKS from the rm_work tasks sinature +- runqemu: Do not perturb script environment +- runqemu: Fix gl-es argument from causing other arguments to be ignored +- sanity: Drop data finalize call +- sanity: check for GNU tar specifically +- scripts/oe-check-sstate: cleanup +- scripts/oe-check-sstate: force build to run for all targets, specifically populate_sysroot +- scripts: convert-overrides: Allow command-line customizations +- socat: upgrade to 1.7.4.4 +- SPDX and CVE documentation updates +- sstate: Allow optimisation of do_deploy_archives task dependencies +- sstatesig: emit more helpful error message when not finding sstate manifest +- sstatesig: skip the rm_work task signature +- sudo: upgrade to 1.9.12p1 +- systemd: Consider PACKAGECONFIG in RRECOMMENDS +- systemd: add group render to udev package +- tcl: correct patch status +- tiff: refresh with devtool +- tiff: add CVE tag to b258ed69a485a9cfb299d9f060eb2a46c54e5903.patch +- u-boot: Remove duplicate inherit of cml1 +- uboot-sign: Fix using wrong KEY_REQ_ARGS +- vala: install vapigen-wrapper into /usr/bin/crosscripts and stage only that +- valgrind: remove most hidden tests for arm64 +- vim: Upgrade to 9.0.0947 +- vulkan-samples: add lfs=0 to SRC_URI to avoid git smudge errors in do_unpack +- wic: honor the SOURCE_DATE_EPOCH in case of updated fstab +- wic: make ext2/3/4 images reproducible +- wic: swap partitions are not added to fstab +- wpebackend-fdo: upgrade to 1.14.0 +- xserver-xorg: move some recommended dependencies in required +- xwayland: upgrade to 22.1.5 + + +Known Issues in Yocto-4.0.6 +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- N/A + + +Contributors to Yocto-4.0.6 +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Alex Kiernan +- Alexander Kanavin +- Alexey Smirnov +- Bartosz Golaszewski +- Bernhard Rosenkränzer +- Bhabu Bindu +- Bruce Ashfield +- Chee Yang Lee +- Chen Qi +- Christian Eggers +- Claus Stovgaard +- Diego Sueiro +- Dmitry Baryshkov +- Ed Tanous +- Enrico Jörns +- Etienne Cordonnier +- Frank de Brabander +- Harald Seiler +- Hitendra Prajapati +- Jan-Simon Moeller +- Jeremy Puhlman +- Joe Slater +- John Edward Broadbent +- Jose Quaresma +- Joshua Watt +- Kai Kang +- Keiya Nobuta +- Khem Raj +- Konrad Weihmann +- Leon Anavi +- Liam Beguin +- Marek Vasut +- Mark Hatle +- Martin Jansa +- Michael Opdenacker +- Mikko Rapeli +- Narpat Mali +- Nathan Rossi +- Niko Mauno +- Pavel Zhukov +- Peter Kjellerstedt +- Peter Marko +- Polampalli, Archana +- Qiu, Zheng +- Ravula Adhitya Siddartha +- Richard Purdie +- Ross Burton +- Sakib Sajal +- Sean Anderson +- Sergei Zhmylev +- Steve Sakoman +- Teoh Jay Shen +- Thomas Perrot +- Tim Orling +- Vincent Davis Jr +- Vivek Kumbhar +- Vyacheslav Yurkov +- Wang Mingyu +- Xiangyu Chen +- Zheng Qiu +- Ciaran Courtney +- Wang Mingyu + + +Repositories / Downloads for Yocto-4.0.6 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +poky + +- Repository Location: :yocto_git:`/poky` +- Branch: :yocto_git:`kirkstone ` +- Tag: :yocto_git:`yocto-4.0.6 ` +- Git Revision: :yocto_git:`c4e08719a782fd4119eaf643907b80cebf57f88f ` +- Release Artefact: poky-c4e08719a782fd4119eaf643907b80cebf57f88f +- sha: 2eb3b323dd2ccd25f9442bfbcbde82bc081fad5afd146a8e6dde439db24a99d4 +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.6/poky-c4e08719a782fd4119eaf643907b80cebf57f88f.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.0.6/poky-c4e08719a782fd4119eaf643907b80cebf57f88f.tar.bz2 + +openembedded-core + +- Repository Location: :oe_git:`/openembedded-core` +- Branch: :oe_git:`kirkstone ` +- Tag: :oe_git:`yocto-4.0.6 ` +- Git Revision: :oe_git:`45a8b4101b14453aa3020d3f2b8a76b4dc0ae3f2 ` +- Release Artefact: oecore-45a8b4101b14453aa3020d3f2b8a76b4dc0ae3f2 +- sha: de8b443365927befe67cc443b60db57563ff0726377223f836a3f3971cf405ec +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.6/oecore-45a8b4101b14453aa3020d3f2b8a76b4dc0ae3f2.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.0.6/oecore-45a8b4101b14453aa3020d3f2b8a76b4dc0ae3f2.tar.bz2 + +meta-mingw + +- Repository Location: :yocto_git:`/meta-mingw` +- Branch: :yocto_git:`kirkstone ` +- Tag: :yocto_git:`yocto-4.0.6 ` +- Git Revision: :yocto_git:`a90614a6498c3345704e9611f2842eb933dc51c1 ` +- Release Artefact: meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1 +- sha: 49f9900bfbbc1c68136f8115b314e95d0b7f6be75edf36a75d9bcd1cca7c6302 +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.6/meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.0.6/meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1.tar.bz2 + +meta-gplv2 + +- Repository Location: :yocto_git:`/meta-gplv2` +- Branch: :yocto_git:`kirkstone ` +- Tag: :yocto_git:`yocto-4.0.6 ` +- Git Revision: :yocto_git:`d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a ` +- Release Artefact: meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a +- sha: c386f59f8a672747dc3d0be1d4234b6039273d0e57933eb87caa20f56b9cca6d +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.6/meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.0.6/meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a.tar.bz2 + +bitbake + +- Repository Location: :oe_git:`/bitbake` +- Branch: :oe_git:`2.0 ` +- Tag: :oe_git:`yocto-4.0.6 ` +- Git Revision: :oe_git:`7e268c107bb0240d583d2c34e24a71e373382509 ` +- Release Artefact: bitbake-7e268c107bb0240d583d2c34e24a71e373382509 +- sha: c3e2899012358c95962c7a5c85cf98dc30c58eae0861c374124e96d9556bb901 +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.6/bitbake-7e268c107bb0240d583d2c34e24a71e373382509.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.0.6/bitbake-7e268c107bb0240d583d2c34e24a71e373382509.tar.bz2 + +yocto-docs + +- Repository Location: :yocto_git:`/yocto-docs` +- Branch: :yocto_git:`kirkstone ` +- Tag: :yocto_git:`yocto-4.0.6 ` +- Git Revision: :yocto_git:`c10d65ef3bbdf4fe3abc03e3aef3d4ca8c2ad87f ` + + diff --git a/poky/documentation/migration-guides/release-notes-4.0.rst b/poky/documentation/migration-guides/release-notes-4.0.rst index d57227502e..563113b4db 100644 --- a/poky/documentation/migration-guides/release-notes-4.0.rst +++ b/poky/documentation/migration-guides/release-notes-4.0.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for 4.0 (kirkstone) --------------------------------- @@ -8,9 +10,10 @@ New Features / Enhancements in 4.0 - Linux kernel 5.15, glibc 2.35 and ~300 other recipe upgrades -- Reproducibility: this release fixes the reproducibility issues with ``rust-llvm`` and - ``golang``. Recipes in OpenEmbedded-Core are now fully reproducible. Functionality - previously in the optional "reproducible" class has been merged into the base class. +- Reproducibility: this release fixes the reproducibility issues with + ``rust-llvm`` and ``golang``. Recipes in OpenEmbedded-Core are now fully + reproducible. Functionality previously in the optional "reproducible" + class has been merged into the :ref:`ref-classes-base` class. - Network access is now disabled by default for tasks other than where it is expected to ensure build integrity (where host kernel supports it) @@ -28,8 +31,7 @@ New Features / Enhancements in 4.0 - The Python package build process is now based on `wheels `__ in line with the upstream direction. -- New :ref:`overlayfs ` and - :ref:`overlayfs-etc ` classes and +- New :ref:`ref-classes-overlayfs` and :ref:`ref-classes-overlayfs-etc` classes and ``overlayroot`` support in the :term:`Initramfs` framework to make it easier to overlay read-only filesystems (for example) with :wikipedia:`OverlayFS `. @@ -143,7 +145,7 @@ New Features / Enhancements in 4.0 - qemuarm64: Add tiny ktype to qemuarm64 bsp - armv9a/tune: Add the support for the Neoverse N2 core - arch-armv8-5a.inc: Add tune include for armv8.5a - - grub-efi: Add xen_boot support when 'xen' is in DISTRO_FEATURES for aarch64 + - grub-efi: Add xen_boot support when 'xen' is in :term:`DISTRO_FEATURES` for aarch64 - tune-cortexa73: Introduce cortexa73-crypto tune - libacpi: Build libacpi also for 'aarch64' machines - core-image-tiny-initramfs: Mark recipe as 32 bit ARM compatible @@ -175,7 +177,7 @@ New Features / Enhancements in 4.0 - linux-yocto: cfg: add kcov feature fragment - linux-yocto: export pkgconfig variables to devshell - linux-yocto-dev: use versioned branch as default - - New ``KERNEL_DEBUG_TIMESTAMPS`` variable (to replace removed ``BUILD_REPRODUCIBLE_BINARIES`` for the kernel) + - New :term:`KERNEL_DEBUG_TIMESTAMPS` variable (to replace removed ``BUILD_REPRODUCIBLE_BINARIES`` for the kernel) - Introduce python3-dtschema-wrapper in preparation for mandatory schema checking on dtb files in 5.16 - Allow disabling kernel artifact symlink creation - Allow changing default .bin kernel artifact extension @@ -215,7 +217,7 @@ New Features / Enhancements in 4.0 - Ensure addition of patch-fuzz retriggers do_qa_patch - Added a sanity check for allarch packagegroups -- create-spdx class improvements: +- :ref:`ref-classes-create-spdx` class improvements: - Get SPDX-License-Identifier from source files - Generate manifest also for SDKs @@ -235,8 +237,10 @@ New Features / Enhancements in 4.0 - SDK-related enhancements: - - Extended recipes to ``nativesdk``: ``cargo``, ``librsvg``, ``libstd-rs``, ``libva``, ``python3-docutil``, ``python3-packaging`` - - Enabled nativesdk recipes to find a correct version of the rust cross compiler + - Extended recipes to :ref:`ref-classes-nativesdk`: ``cargo``, + ``librsvg``, ``libstd-rs``, ``libva``, ``python3-docutil``, ``python3-packaging`` + - Enabled :ref:`ref-classes-nativesdk` recipes to find a correct version + of the rust cross compiler - Support creating per-toolchain cmake file in SDK - Rust enhancements: @@ -289,7 +293,7 @@ New Features / Enhancements in 4.0 - libxkbcommon: allow building of API documentation - libxkbcommon: split libraries and xkbcli into separate packages - systemd: move systemd shared library into its own package -- systemd: Minimize udev package size if DISTRO_FEATURES doen't contain sysvinit +- systemd: Minimize udev package size if :term:`DISTRO_FEATURES` doen't contain sysvinit Known Issues in 4.0 ~~~~~~~~~~~~~~~~~~~ @@ -301,22 +305,22 @@ Known Issues in 4.0 Recipe License changes in 4.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The following corrections have been made to the LICENSE values set by recipes: +The following corrections have been made to the :term:`LICENSE` values set by recipes: -* cmake: add BSD-1-Clause & MIT & BSD-2-Clause to LICENSE due to additional vendored libraries in native/target context -* gettext: extend LICENSE conditional upon PACKAGECONFIG (due to vendored libraries) +* cmake: add BSD-1-Clause & MIT & BSD-2-Clause to :term:`LICENSE` due to additional vendored libraries in native/target context +* gettext: extend :term:`LICENSE` conditional upon :term:`PACKAGECONFIG` (due to vendored libraries) * gstreamer1.0: update licenses of all modules to LGPL-2.1-or-later (with some exceptions that are GPL-2.0-or-later) * gstreamer1.0-plugins-bad/ugly: use the GPL-2.0-or-later only when it is in use * kern-tools-native: add missing MIT license due to Kconfiglib -* libcap: add pam_cap license to LIC_FILES_CHKSUM if pam is enabled +* libcap: add pam_cap license to :term:`LIC_FILES_CHKSUM` if pam is enabled * libidn2: add Unicode-DFS-2016 license -* libsdl2: add BSD-2-Clause to LICENSE due to default yuv2rgb and hidapi inclusion -* libx11-compose-data: update LICENSE to "MIT & MIT-style & BSD-1-Clause & HPND & HPND-sell-variant" to better reflect reality -* libx11: update LICENSE to "MIT & MIT-style & BSD-1-Clause & HPND & HPND-sell-variant" to better reflect reality -* libxshmfence: correct LICENSE - MIT -> HPND -* newlib: add BSD-3-Clause to LICENSE -* python3-idna: correct LICENSE - Unicode -> Unicode-TOU -* python3-pip: add "Apache-2.0 & MPL-2.0 & LGPL-2.1-only & BSD-3-Clause & PSF-2.0 & BSD-2-Clause" to LICENSE due to vendored libraries +* libsdl2: add BSD-2-Clause to :term:`LICENSE` due to default yuv2rgb and hidapi inclusion +* libx11-compose-data: update :term:`LICENSE` to "MIT & MIT-style & BSD-1-Clause & HPND & HPND-sell-variant" to better reflect reality +* libx11: update :term:`LICENSE` to "MIT & MIT-style & BSD-1-Clause & HPND & HPND-sell-variant" to better reflect reality +* libxshmfence: correct :term:`LICENSE` - MIT -> HPND +* newlib: add BSD-3-Clause to :term:`LICENSE` +* python3-idna: correct :term:`LICENSE` - Unicode -> Unicode-TOU +* python3-pip: add "Apache-2.0 & MPL-2.0 & LGPL-2.1-only & BSD-3-Clause & PSF-2.0 & BSD-2-Clause" to :term:`LICENSE` due to vendored libraries Other license-related notes: diff --git a/poky/documentation/migration-guides/release-notes-4.1.1.rst b/poky/documentation/migration-guides/release-notes-4.1.1.rst new file mode 100644 index 0000000000..4f31fbf1c7 --- /dev/null +++ b/poky/documentation/migration-guides/release-notes-4.1.1.rst @@ -0,0 +1,319 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Release notes for Yocto-4.1.1 (Langdale) +---------------------------------------- + +Security Fixes in Yocto-4.1.1 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- curl: Fix :cve:`2022-32221`, :cve:`2022-35260`, :cve:`2022-42915` and :cve:`2022-42916` +- libx11: Fix :cve:`2022-3554` +- lighttpd: Fix :cve:`2022-41556` +- openssl: Fix :cve:`2022-3358`, :cve:`2022-3602` and :cve:`2022-3786` +- pixman: Fix :cve:`2022-44638` +- qemu: Fix :cve:`2022-3165` +- sudo: Fix :cve:`2022-43995` +- tiff: Fix :cve:`2022-3599`, :cve:`2022-3597`, :cve:`2022-3626`, :cve:`2022-3627`, :cve:`2022-3570` and :cve:`2022-3598` +- xserver-xorg: Fix :cve:`2022-3550` and :cve:`2022-3551` +- xserver-xorg: Ignore :cve:`2022-3553` + + +Fixes in Yocto-4.1.1 +~~~~~~~~~~~~~~~~~~~~ + +- Add 4.1 migration guide & release notes +- bitbake: asyncrpc: serv: correct closed client socket detection +- bitbake: bitbake-user-manual: details about variable flags starting with underscore +- bitbake: bitbake: bitbake-layers: checkout layer(s) branch when clone exists +- bitbake: bitbake: user-manual: inform about spaces in :remove +- bitbake: doc: bitbake-user-manual: expand description of BB_PRESSURE_MAX variables +- bitbake: fetch2/git: don't set core.fsyncobjectfiles=0 +- bitbake: tests/fetch: Allow handling of a file:// url within a submodule +- bitbake: tests: bb.tests.fetch.URLHandle: add 2 new tests +- bitbake: utils/ply: Update md5 to better report errors with hashlib +- bluez5: add dbus to :term:`RDEPENDS` +- build-appliance-image: Update to langdale head revision +- buildconf: compare abspath +- buildtools-tarball: export certificates to python and curl +- cmake-native: Fix host tool contamination +- create-spdx.bbclass: remove unused SPDX_INCLUDE_PACKAGED +- create-spdx: Remove ";name=..." for downloadLocation +- cve-update-db-native: add timeout to urlopen() calls +- dev-manual: common-tasks.rst: add reference to "do_clean" task +- dev-manual: common-tasks.rst: add reference to "do_listtasks" task +- docs: add support for langdale (4.1) release +- dropbear: add pam to :term:`PACKAGECONFIG` +- externalsrc.bbclass: fix git repo detection +- externalsrc.bbclass: Remove a trailing slash from ${B} +- externalsrc: move back to classes +- gcc: Allow -Wno-error=poison-system-directories to take effect +- glib-2.0: fix rare GFileInfo test case failure +- gnutls: Unified package names to lower-case +- gnutls: upgrade 3.7.7 -> 3.7.8 +- grub: disable build on armv7ve/a with hardfp +- gstreamer1.0-libav: fix errors with ffmpeg 5.x +- ifupdown: upgrade 0.8.37 -> 0.8.39 +- insane.bbclass: Allow hashlib version that only accepts on parameter +- install-buildtools: support buildtools-make-tarball and update to 4.1 +- kern-tools: fix relative path processing +- kernel-fitimage: Use KERNEL_OUTPUT_DIR where appropriate +- kernel-yocto: improve fatal error messages of symbol_why.py +- kernel: Clear :term:`SYSROOT_DIRS` instead of replacing sysroot_stage_all +- libcap: upgrade 2.65 -> 2.66 +- libical: upgrade 3.0.14 -> 3.0.15 +- libksba: upgrade 1.6.0 -> 1.6.2 +- libsdl2: upgrade 2.24.0 -> 2.24.1 +- lighttpd: upgrade 1.4.66 -> 1.4.67 +- linux-firmware: package amdgpu firmware +- linux-firmware: split rtl8761 firmware +- linux-yocto/5.15: update to v5.15.72 +- linux-yocto/5.19: update to v5.19.14 +- linux-yocto: add efi entry for machine features +- lttng-modules: upgrade 2.13.4 -> 2.13.5 +- lttng-ust: upgrade 2.13.4 -> 2.13.5 +- manuals: add reference to "do_configure" task +- manuals: add reference to the "do_compile" task +- manuals: add reference to the "do_install" task +- manuals: add reference to the "do_kernel_configcheck" task +- manuals: add reference to the "do_populate_sdk" task +- manuals: add references to "do_package_write_*" tasks +- manuals: add references to "do_populate_sysroot" task +- manuals: add references to the "do_build" task +- manuals: add references to the "do_bundle_initramfs" task +- manuals: add references to the "do_cleanall" task +- manuals: add references to the "do_deploy" task +- manuals: add references to the "do_devshell" task +- manuals: add references to the "do_fetch" task +- manuals: add references to the "do_image" task +- manuals: add references to the "do_kernel_configme" task +- manuals: add references to the "do_package" task +- manuals: add references to the "do_package_qa" task +- manuals: add references to the "do_patch" task +- manuals: add references to the "do_rootfs" task +- manuals: add references to the "do_unpack" task +- manuals: fix misc typos +- manuals: improve initramfs details +- manuals: updates for building on Windows (WSL 2) +- mesa: only apply patch to fix ALWAYS_INLINE for native +- mesa: update 22.2.0 -> 22.2.2 +- meson: make wrapper options sub-command specific +- meson: upgrade 0.63.2 -> 0.63.3 +- migration guides: 3.4: remove spurious space in example +- migration guides: add release notes for 4.0.4 +- migration-general: add section on using buildhistory +- migration-guides/release-notes-4.1.rst: add more known issues +- migration-guides/release-notes-4.1.rst: update Repositories / Downloads +- migration-guides: add known issues for 4.1 +- migration-guides: add reference to the "do_shared_workdir" task +- migration-guides: use contributor real name +- migration-guides: use contributor real name +- mirrors.bbclass: use shallow tarball for binutils-native +- mtools: upgrade 4.0.40 -> 4.0.41 +- numactl: upgrade 2.0.15 -> 2.0.16 +- oe/packagemanager/rpm: don't leak file objects +- openssl: export necessary env vars in SDK +- openssl: Fix SSL_CERT_FILE to match ca-certs location +- openssl: Upgrade 3.0.5 -> 3.0.7 +- opkg-utils: use a git clone, not a dynamic snapshot +- overlayfs: Allow not used mount points +- overview-manual: concepts.rst: add reference to "do_packagedata" task +- overview-manual: concepts.rst: add reference to "do_populate_sdk_ext" task +- overview-manual: concepts.rst: fix formating and add references +- own-mirrors: add crate +- pango: upgrade 1.50.9 -> 1.50.10 +- perf: Depend on native setuptools3 +- poky.conf: bump version for 4.1.1 +- poky.conf: remove Ubuntu 21.10 +- populate_sdk_base: ensure ptest-pkgs pulls in ptest-runner +- psplash: add psplash-default in rdepends +- qemu-native: Add :term:`PACKAGECONFIG` option for jack +- quilt: backport a patch to address grep 3.8 failures +- ref-manual/faq.rst: update references to products built with OE / Yocto Project +- ref-manual/variables.rst: clarify sentence +- ref-manual: add a note to ssh-server-dropbear feature +- ref-manual: add :term:`CVE_CHECK_SHOW_WARNINGS` +- ref-manual: add :term:`CVE_DB_UPDATE_INTERVAL` +- ref-manual: add :term:`DEV_PKG_DEPENDENCY` +- ref-manual: add :term:`DISABLE_STATIC` +- ref-manual: add :term:`FIT_PAD_ALG` +- ref-manual: add :term:`KERNEL_DEPLOY_DEPEND` +- ref-manual: add missing features +- ref-manual: add :term:`MOUNT_BASE` variable +- ref-manual: add overlayfs class variables +- ref-manual: add :term:`OVERLAYFS_ETC_EXPOSE_LOWER` +- ref-manual: add :term:`OVERLAYFS_QA_SKIP` +- ref-manual: add previous overlayfs-etc variables +- ref-manual: add pypi class +- ref-manual: add :term:`SDK_TOOLCHAIN_LANGS` +- ref-manual: add section for create-spdx class +- ref-manual: add serial-autologin-root to :term:`IMAGE_FEATURES` documentation +- ref-manual: add :term:`UBOOT_MKIMAGE_KERNEL_TYPE` +- ref-manual: add :term:`WATCHDOG_TIMEOUT` to variable glossary +- ref-manual: add :term:`WIRELESS_DAEMON` +- ref-manual: classes.rst: add links to all references to a class +- ref-manual: complementary package installation recommends +- ref-manual: correct default for :term:`BUILDHISTORY_COMMIT` +- ref-manual: document new github-releases class +- ref-manual: expand documentation on image-buildinfo class +- ref-manual: faq.rst: reorganize into subsections, contents at top +- ref-manual: remove reference to largefile in :term:`DISTRO_FEATURES` +- ref-manual: remove reference to testimage-auto class +- ref-manual: system-requirements: Ubuntu 22.04 now supported +- ref-manual: tasks.rst: add reference to the "do_image_complete" task +- ref-manual: tasks.rst: add reference to the "do_kernel_checkout" task +- ref-manual: tasks.rst: add reference to the "do_kernel_metadata" task +- ref-manual: tasks.rst: add reference to the "do_validate_branches" task +- ref-manual: tasks.rst: add references to the "do_cleansstate" task +- ref-manual: update buildpaths QA check documentation +- ref-manual: update pypi documentation for :term:`CVE_PRODUCT` default in 4.1 +- ref-manual: variables.rst: add reference to "do_populate_lic" task +- release-notes-4.1.rst remove bitbake-layers subcommand argument +- runqemu: Do not perturb script environment +- runqemu: Fix gl-es argument from causing other arguments to be ignored +- rust-target-config: match riscv target names with what rust expects +- rust: install rustfmt for riscv32 as well +- sanity: check for GNU tar specifically +- scripts/oe-check-sstate: cleanup +- scripts/oe-check-sstate: force build to run for all targets, specifically populate_sysroot +- sdk-manual: correct the bitbake target for a unified sysroot build +- shadow: update 4.12.1 -> 4.12.3 +- systemd: add systemd-creds and systemd-cryptenroll to systemd-extra-utils +- test-manual: fix typo in machine name +- tiff: fix a typo for :cve:`2022-2953`.patch +- u-boot: Add savedefconfig task +- u-boot: Remove duplicate inherit of cml1 +- uboot-sign: Fix using wrong KEY_REQ_ARGS +- Update documentation for classes split +- vim: upgrade to 9.0.0820 +- vulkan-samples: add lfs=0 to :term:`SRC_URI` to avoid git smudge errors in do_unpack +- wic: honor the :term:`SOURCE_DATE_EPOCH` in case of updated fstab +- wic: swap partitions are not added to fstab +- wpebackend-fdo: upgrade 1.12.1 -> 1.14.0 +- xserver-xorg: move some recommended dependencies in required +- zlib: do out-of-tree builds +- zlib: upgrade 1.2.12 -> 1.2.13 +- zlib: use .gz archive and set a PREMIRROR + + +Known Issues in Yocto-4.1.1 +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- N/A + + + +Contributors to Yocto-4.1.1 +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Adrian Freihofer +- Alex Kiernan +- Alexander Kanavin +- Bartosz Golaszewski +- Bernhard Rosenkränzer +- Bruce Ashfield +- Chen Qi +- Christian Eggers +- Claus Stovgaard +- Ed Tanous +- Etienne Cordonnier +- Frank de Brabander +- Hitendra Prajapati +- Jan-Simon Moeller +- Jeremy Puhlman +- Johan Korsnes +- Jon Mason +- Jose Quaresma +- Joshua Watt +- Justin Bronder +- Kai Kang +- Keiya Nobuta +- Khem Raj +- Lee Chee Yang +- Liam Beguin +- Luca Boccassi +- Mark Asselstine +- Mark Hatle +- Markus Volk +- Martin Jansa +- Michael Opdenacker +- Ming Liu +- Mingli Yu +- Paul Eggleton +- Peter Kjellerstedt +- Qiu, Zheng +- Quentin Schulz +- Richard Purdie +- Robert Joslyn +- Ross Burton +- Sean Anderson +- Sergei Zhmylev +- Steve Sakoman +- Takayasu Ito +- Teoh Jay Shen +- Thomas Perrot +- Tim Orling +- Vincent Davis Jr +- Vyacheslav Yurkov +- Ciaran Courtney +- Wang Mingyu + + +Repositories / Downloads for Yocto-4.1.1 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +poky + +- Repository Location: :yocto_git:`/poky` +- Branch: :yocto_git:`langdale ` +- Tag: :yocto_git:`yocto-4.1.1 ` +- Git Revision: :yocto_git:`d3cda9a3e0837eb2ac5482f5f2bd8e55e874feff ` +- Release Artefact: poky-d3cda9a3e0837eb2ac5482f5f2bd8e55e874feff +- sha: e92b694fbb74a26c7a875936dfeef4a13902f24b06127ee52f4d1c1e4b03ec24 +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.1.1/poky-d3cda9a3e0837eb2ac5482f5f2bd8e55e874feff.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.1.1/poky-d3cda9a3e0837eb2ac5482f5f2bd8e55e874feff.tar.bz2 + +openembedded-core + +- Repository Location: :oe_git:`/openembedded-core` +- Branch: :oe_git:`langdale ` +- Tag: :oe_git:`yocto-4.1.1 ` +- Git Revision: :oe_git:`9237ffc4feee2dd6ff5bdd672072509ef9e82f6d ` +- Release Artefact: oecore-9237ffc4feee2dd6ff5bdd672072509ef9e82f6d +- sha: d73198aef576f0fca0d746f9d805b1762c19c31786bc3f7d7326dfb2ed6fc1be +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.1.1/oecore-9237ffc4feee2dd6ff5bdd672072509ef9e82f6d.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.1.1/oecore-9237ffc4feee2dd6ff5bdd672072509ef9e82f6d.tar.bz2 + +meta-mingw + +- Repository Location: :yocto_git:`/meta-mingw` +- Branch: :yocto_git:`langdale ` +- Tag: :yocto_git:`yocto-4.1.1 ` +- Git Revision: :yocto_git:`b0067202db8573df3d23d199f82987cebe1bee2c ` +- Release Artefact: meta-mingw-b0067202db8573df3d23d199f82987cebe1bee2c +- sha: 704f2940322b81ce774e9cbd27c3cfa843111d497dc7b1eeaa39cd694d9a2366 +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.1.1/meta-mingw-b0067202db8573df3d23d199f82987cebe1bee2c.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.1.1/meta-mingw-b0067202db8573df3d23d199f82987cebe1bee2c.tar.bz2 + +bitbake + +- Repository Location: :oe_git:`/bitbake` +- Branch: :oe_git:`2.2 ` +- Tag: :oe_git:`yocto-4.1.1 ` +- Git Revision: :oe_git:`138dd7883ee2c521900b29985b6d24a23d96563c ` +- Release Artefact: bitbake-138dd7883ee2c521900b29985b6d24a23d96563c +- sha: 5dc5aff4b4a801253c627cdaab6b1a0ceee2c531f1a6b166d85d1265a35d4be5 +- Download Locations: + http://downloads.yoctoproject.org/releases/yocto/yocto-4.1.1/bitbake-138dd7883ee2c521900b29985b6d24a23d96563c.tar.bz2 + http://mirrors.kernel.org/yocto/yocto/yocto-4.1.1/bitbake-138dd7883ee2c521900b29985b6d24a23d96563c.tar.bz2 + +yocto-docs + +- Repository Location: :yocto_git:`/yocto-docs` +- Branch: :yocto_git:`langdale ` +- Tag: :yocto_git:`yocto-4.1.1 ` +- Git Revision: :yocto_git:`8e0841c3418caa227c66a60327db09dfbe72054a ` + + diff --git a/poky/documentation/migration-guides/release-notes-4.1.rst b/poky/documentation/migration-guides/release-notes-4.1.rst index 119cc4fd2e..cd48e202ab 100644 --- a/poky/documentation/migration-guides/release-notes-4.1.rst +++ b/poky/documentation/migration-guides/release-notes-4.1.rst @@ -1,3 +1,5 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + Release notes for 4.1 (langdale) --------------------------------- @@ -9,7 +11,7 @@ New Features / Enhancements in 4.1 - ``make`` 4.0 is now the minimum make version required on the build host. For host distros that do not provide it, this is included as part of the - ``buildtools-tarball``, and additionally a new ``buildtools-make-tarball`` + :term:`buildtools` tarball, and additionally a new :term:`buildtools-make` tarball has been introduced to provide this in particular for host distros with a broken make 4.x version. For more details see :ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions`. @@ -28,7 +30,7 @@ New Features / Enhancements in 4.1 - Support for building rust for the target - Significant SDK toolchain build optimisation - Support for building native components in the SDK - - Support ``crate://`` fetcher with :ref:`externalsrc ` + - Support ``crate://`` fetcher with :ref:`ref-classes-externalsrc` - New core recipes: @@ -50,7 +52,7 @@ New Features / Enhancements in 4.1 - Added support for Ignored CVEs - Enable recursive CVE checking also for ``do_populate_sdk`` - New :term:`CVE_CHECK_SHOW_WARNINGS` variable to disable unpatched CVE warning messages - - The :ref:`pypi ` class now defaults :term:`CVE_PRODUCT` from :term:`PYPI_PACKAGE` + - The :ref:`ref-classes-pypi` class now defaults :term:`CVE_PRODUCT` from :term:`PYPI_PACKAGE` - Added current kernel CVEs to ignore list since we stay as close to the kernel stable releases as we can - Optimisations to avoid dependencies on fetching @@ -58,9 +60,9 @@ New Features / Enhancements in 4.1 - Dependency of -dev package on main package is now an :term:`RRECOMMENDS` and can be easily set via new :term:`DEV_PKG_DEPENDENCY` variable - Support for CPU, I/O and memory pressure regulation in BitBake -- Pressure data gathering in ``buildstats`` and rendering in ``pybootchartgui`` +- Pressure data gathering in :ref:`ref-classes-buildstats` and rendering in ``pybootchartgui`` -- New Picobuild system for lightweight Python PEP-517 build support in the :ref:`python_pep517 ` class +- New Picobuild system for lightweight Python PEP-517 build support in the :ref:`ref-classes-python_pep517` class - Many classes are now split into global and recipe contexts for better validation. For more information, see @@ -81,7 +83,7 @@ New Features / Enhancements in 4.1 - linux-yocto: Enable mdio for qemu - linux-yocto/5.15: base: enable kernel crypto userspace API - kern-tools: allow 'y' or 'm' to avoid config audit warnings - - kernel-yocto.bbclass: say what SRC_URI entry is being dropped + - kernel-yocto.bbclass: say what :term:`SRC_URI` entry is being dropped - kernel.bbclass: Do not overwrite recipe's custom postinst - kmod: Enable xz support by default - Run depmod(wrapper) against each compiled kernel when multiple kernels are enabled @@ -97,10 +99,10 @@ New Features / Enhancements in 4.1 - SDK-related enhancements: - :ref:`Support for using the regular build system as an SDK ` - - :ref:`image-buildinfo ` class now also writes build information to SDKs + - :ref:`ref-classes-image-buildinfo` class now also writes build information to SDKs - New :term:`SDK_TOOLCHAIN_LANGS` variable to control support of rust / go in SDK - - rust-llvm: enabled nativesdk variant - - python3-pluggy: enabled for native/nativesdk + - rust-llvm: enabled :ref:`ref-classes-nativesdk` variant + - python3-pluggy: enabled for :ref:`ref-classes-native` / :ref:`ref-classes-nativesdk` - QEMU/runqemu enhancements: @@ -113,10 +115,11 @@ New Features / Enhancements in 4.1 - New variable :term:`UBOOT_MKIMAGE_KERNEL_TYPE` - New variable :term:`FIT_PAD_ALG` to control FIT image padding algorithm - New :term:`KERNEL_DEPLOY_DEPEND` variable to allow disabling image dependency on deploying the kernel - - image_types: isolate the write of UBI configuration to a ``write_ubi_config`` function that can be easily overridden + - :ref:`ref-classes-image_types`: isolate the write of UBI + configuration to a ``write_ubi_config`` function that can be easily overridden - openssh: add support for config snippet includes to ssh and sshd -- :ref:`create-spdx `: Add ``SPDX_PRETTY`` option +- :ref:`ref-classes-create-spdx`: Add :term:`SPDX_PRETTY` option - wpa-supplicant: build static library if not disabled via :term:`DISABLE_STATIC` - wpa-supplicant: package dynamic modules - openssl: extract legacy provider module to a separate package @@ -129,11 +132,11 @@ New Features / Enhancements in 4.1 - systemd: systemd-systemctl: Support instance conf files during enable - weston.init: enable ``xwayland`` in weston.ini if ``x11`` is in :term:`DISTRO_FEATURES` - New ``npm_registry`` Python module to enable caching with nodejs 16+ -- :ref:`npm `: replaced ``npm pack`` call with ``tar czf`` for nodejs 16+ compatibility and improved ``do_configure`` performance -- Enabled :ref:`bin_package ` class to work properly in the native case +- :ref:`ref-classes-npm`: replaced ``npm pack`` call with ``tar czf`` for nodejs 16+ compatibility and improved ``do_configure`` performance +- Enabled :ref:`ref-classes-bin-package` class to work properly in the native case - Enabled :ref:`buildpaths ` QA check as a warning by default -- New :term:`OVERLAYFS_ETC_EXPOSE_LOWER` to provide read-only access to the original ``/etc`` content with :ref:`overlayfs-etc ` -- New :term:`OVERLAYFS_QA_SKIP` variable to allow skipping check on :ref:`overlayfs ` mounts +- New :term:`OVERLAYFS_ETC_EXPOSE_LOWER` to provide read-only access to the original ``/etc`` content with :ref:`ref-classes-overlayfs-etc` +- New :term:`OVERLAYFS_QA_SKIP` variable to allow skipping check on :ref:`ref-classes-overlayfs` mounts - New :term:`PACKAGECONFIG` options for individual recipes: - apr: xsi-strerror @@ -169,11 +172,11 @@ New Features / Enhancements in 4.1 - meson: provide relocation script and native/cross wrappers also for meson-native - meson.bbclass: add cython binary to cross/native toolchain config - New ``musl-locales`` recipe to provide a limited set of locale data for musl based systems -- gobject-introspection: use ``OBJDUMP`` environment variable so that objdump tool can be picked up from the environment +- gobject-introspection: use :term:`OBJDUMP` environment variable so that objdump tool can be picked up from the environment - The Python ``zoneinfo`` module is now split out to its own ``python3-zoneinfo`` package. - busybox: added devmem 128-bit support - vim: split xxd out into its own package -- New :ref:`github-releases ` class to consolidate version checks for github-based packages +- New :ref:`ref-classes-github-releases` class to consolidate version checks for github-based packages - ``devtool reset`` now preserves ``workspace/sources`` source trees in ``workspace/attic/sources/`` instead of leaving them in-place - scripts/patchreview: Add commit to stored json data - scripts/patchreview: Make json output human parsable @@ -201,7 +204,7 @@ Known Issues in 4.1 :yocto_bugs:`bug 14626 `, which also details the fix. - The change to :ref:`migration-4.1-classes-split` inadvertently moved the - :ref:`externalsrc ` class to ``meta/classes-recipe``, + :ref:`ref-classes-externalsrc` class to ``meta/classes-recipe``, when it is not recipe-specific and can also be used in a global context. The class will be moved back to ``meta/classes`` in the next point release. Filed as :yocto_bugs:`bug 14940 `. @@ -210,7 +213,7 @@ Known Issues in 4.1 Recipe License changes in 4.1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The following corrections have been made to the LICENSE values set by recipes: +The following corrections have been made to the :term:`LICENSE` values set by recipes: - alsa-state: add GPL-2.0-or-later because of alsa-state-init file - git: add GPL-2.0-or-later & BSD-3-Clause & MIT & BSL-1.0 & LGPL-2.1-or-later due to embedded code diff --git a/poky/documentation/migration-guides/release-notes-4.2.rst b/poky/documentation/migration-guides/release-notes-4.2.rst new file mode 100644 index 0000000000..edafe378b0 --- /dev/null +++ b/poky/documentation/migration-guides/release-notes-4.2.rst @@ -0,0 +1,28 @@ +.. SPDX-License-Identifier: CC-BY-SA-2.0-UK + +Release notes for 4.2 (mickledore) +---------------------------------- + +New Features / Enhancements in 4.2 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Python 3.8 is the minimum Python version required on the build host. + For host distributions that do not provide it, this is included as part of the + :term:`buildtools` tarball. + +- This release now supports a new ``addpylib`` directive to enable + Python libraries within layers. + + This directive should be added to your layer configuration, + as in the below example from ``meta/conf/layer.conf``:: + + addpylib ${LAYERDIR}/lib oe + +- Architecture-specific enhancements: + +- Kernel-related enhancements: + +- QEMU/runqemu enhancements: + +- Image-related enhancements: + diff --git a/poky/documentation/overview-manual/concepts.rst b/poky/documentation/overview-manual/concepts.rst index c495e4cc41..4cee4bb169 100644 --- a/poky/documentation/overview-manual/concepts.rst +++ b/poky/documentation/overview-manual/concepts.rst @@ -34,7 +34,7 @@ itself is of various types: BitBake knows how to combine multiple data sources together and refers to each data source as a layer. For information on layers, see the -":ref:`dev-manual/common-tasks:understanding and creating layers`" +":ref:`dev-manual/layers:understanding and creating layers`" section of the Yocto Project Development Tasks Manual. Following are some brief details on these core components. For @@ -107,8 +107,7 @@ Classes ------- Class files (``.bbclass``) contain information that is useful to share -between recipes files. An example is the -:ref:`autotools ` class, +between recipes files. An example is the :ref:`ref-classes-autotools` class, which contains common settings for any application that is built with the :wikipedia:`GNU Autotools `. The ":ref:`ref-manual/classes:Classes`" chapter in the Yocto Project @@ -149,7 +148,7 @@ Conforming to a known structure allows BitBake to make assumptions during builds on where to find types of metadata. You can find procedures and learn about tools (i.e. ``bitbake-layers``) for creating layers suitable for the Yocto Project in the -":ref:`dev-manual/common-tasks:understanding and creating layers`" +":ref:`dev-manual/layers:understanding and creating layers`" section of the Yocto Project Development Tasks Manual. OpenEmbedded Build System Concepts @@ -307,7 +306,7 @@ during the build. By default, the layers listed in this file include layers minimally needed by the build system. However, you must manually add any custom layers you have created. You can find more information on working with the ``bblayers.conf`` file in the -":ref:`dev-manual/common-tasks:enabling your layer`" +":ref:`dev-manual/layers:enabling your layer`" section in the Yocto Project Development Tasks Manual. The files ``site.conf`` and ``auto.conf`` are not created by the @@ -398,7 +397,7 @@ a ``README`` file as good practice and especially if the layer is to be distributed, a configuration directory, and recipe directories. You can learn about the general structure for layers used with the Yocto Project in the -":ref:`dev-manual/common-tasks:creating your own layer`" +":ref:`dev-manual/layers:creating your own layer`" section in the Yocto Project Development Tasks Manual. For a general discussion on layers and the many layers from which you can draw, see the @@ -561,11 +560,11 @@ reside somewhere local to a project --- perhaps a directory into which the user checks in items (e.g. a local directory containing a development source tree used by the group). -The canonical method through which to include a local project is to use -the :ref:`externalsrc ` -class to include that local project. You use either the ``local.conf`` -or a recipe's append file to override or set the recipe to point to the -local directory on your disk to pull in the whole source tree. +The canonical method through which to include a local project is to use the +:ref:`ref-classes-externalsrc` class to include that local project. You use +either the ``local.conf`` or a recipe's append file to override or set the +recipe to point to the local directory on your disk to pull in the whole +source tree. Source Control Managers (Optional) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -582,8 +581,7 @@ module. .. note:: For information on how to have the OpenEmbedded build system generate - tarballs for Git repositories and place them in the - DL_DIR + tarballs for Git repositories and place them in the :term:`DL_DIR` directory, see the :term:`BB_GENERATE_MIRROR_TARBALLS` variable in the Yocto Project Reference Manual. @@ -629,8 +627,7 @@ types, and you specify which classes to enable through the :term:`PACKAGE_CLASSES` variable. Before placing the packages into package feeds, the build process validates them with generated output quality assurance checks -through the :ref:`insane ` -class. +through the :ref:`ref-classes-insane` class. The package feed area resides in the :term:`Build Directory`. The directory the build system uses to temporarily store packages is determined by a @@ -798,7 +795,7 @@ For more information on how the source directories are created, see the ":ref:`overview-manual/concepts:source fetching`" section. For more information on how to create patches and how the build system processes patches, see the -":ref:`dev-manual/common-tasks:patching code`" +":ref:`dev-manual/new-recipe:patching code`" section in the Yocto Project Development Tasks Manual. You can also see the ":ref:`sdk-manual/extensible:use \`\`devtool modify\`\` to modify the source of an existing component`" @@ -841,14 +838,12 @@ This step in the build process consists of the following tasks: are specific to configurations for the source code being built by the recipe. - If you are using the - :ref:`autotools ` class, + If you are using the :ref:`ref-classes-autotools` class, you can add additional configuration options by using the :term:`EXTRA_OECONF` or :term:`PACKAGECONFIG_CONFARGS` variables. For information on how this variable works within that - class, see the - :ref:`autotools ` class + class, see the :ref:`ref-classes-autotools` class :yocto_git:`here `. - *do_compile*: Once a configuration task has been satisfied, @@ -921,7 +916,7 @@ the analysis and package splitting process use several areas: - :term:`STAGING_DIR_TARGET`: The path for the sysroot used when a component that is built to execute on a system and it generates code for yet another machine - (e.g. cross-canadian recipes). + (e.g. :ref:`ref-classes-cross-canadian` recipes). The :term:`FILES` variable defines the files that go into each package in @@ -999,7 +994,7 @@ stage of package installation, post installation scripts that are part of the packages are run. Any scripts that fail to run on the build host are run on the target when the target system is first booted. If you are using a -:ref:`read-only root filesystem `, +:ref:`read-only root filesystem `, all the post installation scripts must succeed on the build host during the package installation phase since the root filesystem on the target is read-only. @@ -1007,13 +1002,11 @@ is read-only. The final stages of the :ref:`ref-tasks-rootfs` task handle post processing. Post processing includes creation of a manifest file and optimizations. -The manifest file (``.manifest``) resides in the same directory as the -root filesystem image. This file lists out, line-by-line, the installed -packages. The manifest file is useful for the -:ref:`testimage ` class, +The manifest file (``.manifest``) resides in the same directory as the root +filesystem image. This file lists out, line-by-line, the installed packages. +The manifest file is useful for the :ref:`ref-classes-testimage` class, for example, to determine whether or not to run specific tests. See the -:term:`IMAGE_MANIFEST` -variable for additional information. +:term:`IMAGE_MANIFEST` variable for additional information. Optimizing processes that are run across the image include ``mklibs`` and any other post-processing commands as defined by the @@ -1122,8 +1115,7 @@ checksum `. .. note:: - This naming scheme assumes that - BB_SIGNATURE_HANDLER + This naming scheme assumes that :term:`BB_SIGNATURE_HANDLER` is "OEBasicHash", which is almost always the case in current OpenEmbedded. @@ -1158,7 +1150,7 @@ varflag. If some other task depends on such a task, then that task will also always be considered out of date, which might not be what you want. For details on how to view information about a task's signature, see the -":ref:`dev-manual/common-tasks:viewing task variable dependencies`" +":ref:`dev-manual/debugging:viewing task variable dependencies`" section in the Yocto Project Development Tasks Manual. Setscene Tasks and Shared State @@ -1583,15 +1575,15 @@ them if they are deemed to be valid. the shared state packages. Consequently, there are considerations that affect maintaining shared state feeds. For information on how the build system works with packages and can track incrementing :term:`PR` - information, see the ":ref:`dev-manual/common-tasks:automatically incrementing a package version number`" + information, see the ":ref:`dev-manual/packages:automatically incrementing a package version number`" section in the Yocto Project Development Tasks Manual. - The code in the build system that supports incremental builds is complex. For techniques that help you work around issues related to shared state code, see the - ":ref:`dev-manual/common-tasks:viewing metadata used to create the input signature of a shared state task`" + ":ref:`dev-manual/debugging:viewing metadata used to create the input signature of a shared state task`" and - ":ref:`dev-manual/common-tasks:invalidating shared state to force a task to run`" + ":ref:`dev-manual/debugging:invalidating shared state to force a task to run`" sections both in the Yocto Project Development Tasks Manual. The rest of this section goes into detail about the overall incremental @@ -1753,12 +1745,11 @@ half the problem of supporting a shared state. The other half of the problem is being able to use checksum information during the build and being able to reuse or rebuild specific components. -The :ref:`sstate ` class is a -relatively generic implementation of how to "capture" a snapshot of a -given task. The idea is that the build process does not care about the -source of a task's output. Output could be freshly built or it could be -downloaded and unpacked from somewhere. In other words, the build -process does not need to worry about its origin. +The :ref:`ref-classes-sstate` class is a relatively generic implementation of +how to "capture" a snapshot of a given task. The idea is that the build process +does not care about the source of a task's output. Output could be freshly +built or it could be downloaded and unpacked from somewhere. In other words, +the build process does not need to worry about its origin. Two types of output exist. One type is just about creating a directory in :term:`WORKDIR`. A good example is @@ -1769,10 +1760,9 @@ type of output occurs when a set of data is merged into a shared directory tree such as the sysroot. The Yocto Project team has tried to keep the details of the -implementation hidden in the :ref:`sstate ` class. From a user's perspective, +implementation hidden in the :ref:`ref-classes-sstate` class. From a user's perspective, adding shared state wrapping to a task is as simple as this -:ref:`ref-tasks-deploy` example taken -from the :ref:`deploy ` class:: +:ref:`ref-tasks-deploy` example taken from the :ref:`ref-classes-deploy` class:: DEPLOYDIR = "${WORKDIR}/deploy-${PN}" SSTATETASKS += "do_deploy" @@ -1788,11 +1778,9 @@ from the :ref:`deploy ` class:: The following list explains the previous example: -- Adding ``do_deploy`` to ``SSTATETASKS`` adds some required - sstate-related processing, which is implemented in the - :ref:`sstate ` class, to - before and after the - :ref:`ref-tasks-deploy` task. +- Adding ``do_deploy`` to ``SSTATETASKS`` adds some required sstate-related + processing, which is implemented in the :ref:`ref-classes-sstate` class, to + before and after the :ref:`ref-tasks-deploy` task. - The ``do_deploy[sstate-inputdirs] = "${DEPLOYDIR}"`` declares that :ref:`ref-tasks-deploy` places its output in ``${DEPLOYDIR}`` when run normally diff --git a/poky/documentation/overview-manual/development-environment.rst b/poky/documentation/overview-manual/development-environment.rst index 7d5953db33..0d931df3dc 100644 --- a/poky/documentation/overview-manual/development-environment.rst +++ b/poky/documentation/overview-manual/development-environment.rst @@ -93,7 +93,7 @@ are several ways of working in the Yocto Project environment: through your Linux distribution and the Yocto Project. For a general flow of the build procedures, see the - ":ref:`dev-manual/common-tasks:building a simple image`" + ":ref:`dev-manual/building:building a simple image`" section in the Yocto Project Development Tasks Manual. - *Board Support Package (BSP) Development:* Development of BSPs @@ -244,7 +244,7 @@ and so forth. For information on finding out who is responsible for (maintains) a particular area of code in the Yocto Project, see the - ":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" + ":ref:`dev-manual/changes:submitting a change to the yocto project`" section of the Yocto Project Development Tasks Manual. The Yocto Project ``poky`` Git repository also has an upstream @@ -276,7 +276,7 @@ push them into the "contrib" area and subsequently request that the maintainer include them into an upstream branch. This process is called "submitting a patch" or "submitting a change." For information on submitting patches and changes, see the -":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" +":ref:`dev-manual/changes:submitting a change to the yocto project`" section in the Yocto Project Development Tasks Manual. In summary, there is a single point of entry for changes into the @@ -343,7 +343,7 @@ Book `__. the ``scripts`` folder of the :term:`Source Directory`. For information on how to use these scripts, see the - ":ref:`dev-manual/common-tasks:using scripts to push a change upstream and request a pull`" + ":ref:`dev-manual/changes:using scripts to push a change upstream and request a pull`" section in the Yocto Project Development Tasks Manual. - *Patch Workflow:* This workflow allows you to notify the maintainer @@ -352,7 +352,7 @@ Book `__. this type of change, you format the patch and then send the email using the Git commands ``git format-patch`` and ``git send-email``. For information on how to use these scripts, see the - ":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" + ":ref:`dev-manual/changes:submitting a change to the yocto project`" section in the Yocto Project Development Tasks Manual. Git @@ -647,5 +647,5 @@ Project uses in the ``meta/files/common-licenses`` directory in your For information that can help you maintain compliance with various open source licensing during the lifecycle of a product created using the Yocto Project, see the -":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`" +":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`" section in the Yocto Project Development Tasks Manual. diff --git a/poky/documentation/overview-manual/yp-intro.rst b/poky/documentation/overview-manual/yp-intro.rst index 8b476f43c4..4c847a09de 100644 --- a/poky/documentation/overview-manual/yp-intro.rst +++ b/poky/documentation/overview-manual/yp-intro.rst @@ -129,7 +129,7 @@ Here are features and advantages of the Yocto Project: arbitrarily include packages. - *License Manifest:* The Yocto Project provides a :ref:`license - manifest ` + manifest ` for review by people who need to track the use of open source licenses (e.g. legal teams). @@ -225,7 +225,7 @@ your Metadata, the easier it is to cope with future changes. - Layers support the inclusion of technologies, hardware components, and software components. The :ref:`Yocto Project - Compatible ` + Compatible ` designation provides a minimum level of standardization that contributes to a strong ecosystem. "YP Compatible" is applied to appropriate products and software components such as BSPs, other @@ -269,7 +269,7 @@ of the ``poky`` repository, you will see several layers: ``meta``, layer. For procedures on how to create layers, see the -":ref:`dev-manual/common-tasks:understanding and creating layers`" +":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual. Components and Tools @@ -351,7 +351,7 @@ Yocto Project: (BitBake and OE-Core) automatically generates upgrades for recipes that are based on new versions of the recipes published upstream. See - :ref:`dev-manual/common-tasks:using the auto upgrade helper (auh)` + :ref:`dev-manual/upgrading-recipes:using the auto upgrade helper (auh)` for how to set it up. - *Recipe Reporting System:* The Recipe Reporting System tracks recipe @@ -517,18 +517,18 @@ Historically, the Build Appliance was the second of three methods by which you could use the Yocto Project on a system that was not native to Linux. -1. *Hob:* Hob, which is now deprecated and is no longer available since +#. *Hob:* Hob, which is now deprecated and is no longer available since the 2.1 release of the Yocto Project provided a rudimentary, GUI-based interface to the Yocto Project. Toaster has fully replaced Hob. -2. *Build Appliance:* Post Hob, the Build Appliance became available. It +#. *Build Appliance:* Post Hob, the Build Appliance became available. It was never recommended that you use the Build Appliance as a day-to-day production development environment with the Yocto Project. Build Appliance was useful as a way to try out development in the Yocto Project environment. -3. *CROPS:* The final and best solution available now for developing +#. *CROPS:* The final and best solution available now for developing using the Yocto Project on a system not native to Linux is with :ref:`CROPS `. @@ -719,27 +719,27 @@ workflow: Following is a brief summary of the "workflow": -1. Developers specify architecture, policies, patches and configuration +#. Developers specify architecture, policies, patches and configuration details. -2. The build system fetches and downloads the source code from the +#. The build system fetches and downloads the source code from the specified location. The build system supports standard methods such as tarballs or source code repositories systems such as Git. -3. Once source code is downloaded, the build system extracts the sources +#. Once source code is downloaded, the build system extracts the sources into a local work area where patches are applied and common steps for configuring and compiling the software are run. -4. The build system then installs the software into a temporary staging +#. The build system then installs the software into a temporary staging area where the binary package format you select (DEB, RPM, or IPK) is used to roll up the software. -5. Different QA and sanity checks run throughout entire build process. +#. Different QA and sanity checks run throughout entire build process. -6. After the binaries are created, the build system generates a binary +#. After the binaries are created, the build system generates a binary package feed that is used to create the final root file image. -7. The build system generates the file system image and a customized +#. The build system generates the file system image and a customized Extensible SDK (eSDK) for application development in parallel. For a very detailed look at this workflow, see the @@ -776,7 +776,7 @@ helpful for getting started: Yocto Project. For more detailed information on layers, see the - ":ref:`dev-manual/common-tasks:understanding and creating layers`" + ":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual. For a discussion specifically on BSP Layers, see the ":ref:`bsp-guide/bsp:bsp layers`" section in the Yocto diff --git a/poky/documentation/poky.yaml.in b/poky/documentation/poky.yaml.in index ce67c4d3d3..cdccf6f3ca 100644 --- a/poky/documentation/poky.yaml.in +++ b/poky/documentation/poky.yaml.in @@ -41,7 +41,7 @@ CENTOS8_HOST_PACKAGES_ESSENTIAL : "-y epel-release python3-GitPython python3-jinja2 python3-pexpect xz which SDL-devel \ rpcgen mesa-libGL-devel zstd lz4" PIP3_HOST_PACKAGES_DOC : "$ sudo pip3 install sphinx sphinx_rtd_theme pyyaml" -MIN_PYTHON_VERSION : "3.6.0" +MIN_PYTHON_VERSION : "3.8.0" MIN_TAR_VERSION : "1.28" MIN_GIT_VERSION : "1.8.3.1" MIN_GCC_VERSION : "7.5" diff --git a/poky/documentation/profile-manual/intro.rst b/poky/documentation/profile-manual/intro.rst index e9208dfde8..93f8429ee3 100644 --- a/poky/documentation/profile-manual/intro.rst +++ b/poky/documentation/profile-manual/intro.rst @@ -38,7 +38,7 @@ an 'sdk' image e.g. :: $ bitbake core-image-sato-sdk -or alternatively by adding 'tools-profile' to the EXTRA_IMAGE_FEATURES line in +or alternatively by adding 'tools-profile' to the :term:`EXTRA_IMAGE_FEATURES` line in your local.conf:: EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile" @@ -65,7 +65,7 @@ If you've already built a stripped image, you can generate debug packages (xxx-dbg) which you can manually install as needed. To generate debug info for packages, you can add dbg-pkgs to -EXTRA_IMAGE_FEATURES in local.conf. For example:: +:term:`EXTRA_IMAGE_FEATURES` in local.conf. For example:: EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile dbg-pkgs" diff --git a/poky/documentation/profile-manual/usage.rst b/poky/documentation/profile-manual/usage.rst index 01fbde1411..1e31019897 100644 --- a/poky/documentation/profile-manual/usage.rst +++ b/poky/documentation/profile-manual/usage.rst @@ -1896,7 +1896,7 @@ manual, and boot the resulting target image. .. note:: If you have a :term:`Build Directory` containing multiple machines, you need - to have the MACHINE you're connecting to selected in local.conf, and + to have the :term:`MACHINE` you're connecting to selected in local.conf, and the kernel in that machine's :term:`Build Directory` must match the kernel on the booted system exactly, or you'll get the above 'crosstap' message when you try to invoke a script. diff --git a/poky/documentation/ref-manual/classes.rst b/poky/documentation/ref-manual/classes.rst index ffa3e50ab6..7dba617db5 100644 --- a/poky/documentation/ref-manual/classes.rst +++ b/poky/documentation/ref-manual/classes.rst @@ -34,10 +34,10 @@ information. .. _ref-classes-allarch: -``allarch.bbclass`` -=================== +``allarch`` +=========== -The :ref:`allarch ` class is inherited by recipes that do not produce +The :ref:`ref-classes-allarch` class is inherited by recipes that do not produce architecture-specific output. The class disables functionality that is normally needed for recipes that produce executable binaries (such as building the cross-compiler and a C library as pre-requisites, and @@ -49,7 +49,7 @@ splitting out of debug symbols during packaging). produce packages that depend on tunings through use of the :term:`RDEPENDS` and :term:`TUNE_PKGARCH` variables, should never be - configured for all architectures using :ref:`allarch `. This is the case + configured for all architectures using :ref:`ref-classes-allarch`. This is the case even if the recipes do not produce architecture-specific output. Configuring such recipes for all architectures causes the @@ -58,31 +58,31 @@ splitting out of debug symbols during packaging). Additionally, unnecessary rebuilds occur every time an image for a different :term:`MACHINE` is built even when the recipe never changes. -By default, all recipes inherit the :ref:`base ` and -:ref:`package ` classes, which enable +By default, all recipes inherit the :ref:`ref-classes-base` and +:ref:`ref-classes-package` classes, which enable functionality needed for recipes that produce executable output. If your recipe, for example, only produces packages that contain configuration files, media files, or scripts (e.g. Python and Perl), then it should -inherit the :ref:`allarch ` class. +inherit the :ref:`ref-classes-allarch` class. .. _ref-classes-archiver: -``archiver.bbclass`` -==================== +``archiver`` +============ -The :ref:`archiver ` class supports releasing source code and other +The :ref:`ref-classes-archiver` class supports releasing source code and other materials with the binaries. -For more details on the source :ref:`archiver `, see the -":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`" +For more details on the source :ref:`ref-classes-archiver`, see the +":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`" section in the Yocto Project Development Tasks Manual. You can also see the :term:`ARCHIVER_MODE` variable for information about the variable flags (varflags) that help control archive creation. .. _ref-classes-autotools: -``autotools*.bbclass`` -====================== +``autotools*`` +============== The :ref:`autotools* ` classes support packages built with the :wikipedia:`GNU Autotools `. @@ -93,7 +93,7 @@ standardization. This class defines a set of tasks (e.g. ``configure``, should usually be enough to define a few standard variables and then simply ``inherit autotools``. These classes can also work with software that emulates Autotools. For more information, see the -":ref:`dev-manual/common-tasks:autotooled package`" section +":ref:`dev-manual/new-recipe:autotooled package`" section in the Yocto Project Development Tasks Manual. By default, the :ref:`autotools* ` classes use out-of-tree builds (i.e. @@ -102,7 +102,7 @@ By default, the :ref:`autotools* ` classes use out-of-tre If the software being built by a recipe does not support using out-of-tree builds, you should have the recipe inherit the :ref:`autotools-brokensep ` class. The :ref:`autotools-brokensep ` class behaves -the same as the :ref:`autotools ` class but builds with :term:`B` +the same as the :ref:`ref-classes-autotools` class but builds with :term:`B` == :term:`S`. This method is useful when out-of-tree build support is either not present or is broken. @@ -130,17 +130,16 @@ It's useful to have some idea of how the tasks defined by the .. _ref-classes-base: -``base.bbclass`` -================ +``base`` +======== -The :ref:`base ` class is special in that every ``.bb`` file implicitly +The :ref:`ref-classes-base` class is special in that every ``.bb`` file implicitly inherits the class. This class contains definitions for standard basic tasks such as fetching, unpacking, configuring (empty by default), compiling (runs any ``Makefile`` present), installing (empty by default) and packaging (empty by default). These classes are often overridden or -extended by other classes such as the -:ref:`autotools ` class or the -:ref:`package ` class. +extended by other classes such as the :ref:`ref-classes-autotools` class or the +:ref:`ref-classes-package` class. The class also contains some commonly used functions such as ``oe_runmake``, which runs ``make`` with the arguments specified in @@ -149,18 +148,18 @@ arguments passed directly to ``oe_runmake``. .. _ref-classes-bash-completion: -``bash-completion.bbclass`` -=========================== +``bash-completion`` +=================== Sets up packaging and dependencies appropriate for recipes that build software that includes bash-completion data. .. _ref-classes-bin-package: -``bin_package.bbclass`` -======================= +``bin_package`` +=============== -The :ref:`bin_package ` class is a helper class for recipes that extract the +The :ref:`ref-classes-bin-package` class is a helper class for recipes that extract the contents of a binary package (e.g. an RPM) and install those contents rather than building the binary from source. The binary package is extracted and new packages in the configured output package format are @@ -184,10 +183,10 @@ example use for this class. .. _ref-classes-binconfig: -``binconfig.bbclass`` -===================== +``binconfig`` +============= -The :ref:`binconfig ` class helps to correct paths in shell scripts. +The :ref:`ref-classes-binconfig` class helps to correct paths in shell scripts. Before ``pkg-config`` had become widespread, libraries shipped shell scripts to give information about the libraries and include paths needed @@ -204,34 +203,33 @@ information. .. _ref-classes-binconfig-disabled: -``binconfig-disabled.bbclass`` -============================== +``binconfig-disabled`` +====================== -An alternative version of the :ref:`binconfig ` +An alternative version of the :ref:`ref-classes-binconfig` class, which disables binary configuration scripts by making them return an error in favor of using ``pkg-config`` to query the information. The -scripts to be disabled should be specified using the -:term:`BINCONFIG` variable within the recipe inheriting -the class. +scripts to be disabled should be specified using the :term:`BINCONFIG` +variable within the recipe inheriting the class. .. _ref-classes-buildhistory: -``buildhistory.bbclass`` -======================== +``buildhistory`` +================ -The :ref:`buildhistory ` class records a history of build output metadata, +The :ref:`ref-classes-buildhistory` class records a history of build output metadata, which can be used to detect possible regressions as well as used for analysis of the build output. For more information on using Build History, see the -":ref:`dev-manual/common-tasks:maintaining build output quality`" +":ref:`dev-manual/build-quality:maintaining build output quality`" section in the Yocto Project Development Tasks Manual. .. _ref-classes-buildstats: -``buildstats.bbclass`` -====================== +``buildstats`` +============== -The :ref:`buildstats ` class records performance statistics about each task +The :ref:`ref-classes-buildstats` class records performance statistics about each task executed during the build (e.g. elapsed time, CPU usage, and I/O usage). When you use this class, the output goes into the @@ -245,23 +243,23 @@ Collecting build statistics is enabled by default through the :term:`USER_CLASSES` variable from your ``local.conf`` file. Consequently, you do not have to do anything to enable the class. However, if you want to disable the class, simply -remove ":ref:`buildstats `" from the :term:`USER_CLASSES` list. +remove ":ref:`ref-classes-buildstats`" from the :term:`USER_CLASSES` list. .. _ref-classes-buildstats-summary: -``buildstats-summary.bbclass`` -============================== +``buildstats-summary`` +====================== When inherited globally, prints statistics at the end of the build on sstate re-use. In order to function, this class requires the -:ref:`buildstats ` class be enabled. +:ref:`ref-classes-buildstats` class be enabled. .. _ref-classes-ccache: -``ccache.bbclass`` -================== +``ccache`` +========== -The :ref:`ccache ` class enables the C/C++ Compiler Cache for the build. +The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build. This class is used to give a minor performance boost during the build. See https://ccache.samba.org/ for information on the C/C++ Compiler @@ -275,20 +273,20 @@ this class is not recommended. .. _ref-classes-chrpath: -``chrpath.bbclass`` -=================== +``chrpath`` +=========== -The :ref:`chrpath ` class is a wrapper around the "chrpath" utility, which -is used during the build process for :ref:`nativesdk `, :ref:`cross `, and -:ref:`cross-canadian ` recipes to change ``RPATH`` records within binaries +The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which +is used during the build process for :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, and +:ref:`ref-classes-cross-canadian` recipes to change ``RPATH`` records within binaries in order to make them relocatable. .. _ref-classes-cmake: -``cmake.bbclass`` -================= +``cmake`` +========= -The ref:`cmake ` class allows for recipes that need to build software using +The ref:`ref-classes-cmake` class allows for recipes that need to build software using the `CMake `__ build system. You can use the :term:`EXTRA_OECMAKE` variable to specify additional configuration options to be passed using the ``cmake`` @@ -302,16 +300,16 @@ Modules during .. _ref-classes-cml1: -``cml1.bbclass`` -================ +``cml1`` +======== -The :ref:`cml1 ` class provides basic support for the Linux kernel style +The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style build configuration system. .. _ref-classes-compress_doc: -``compress_doc.bbclass`` -======================== +``compress_doc`` +================ Enables compression for man pages and info pages. This class is intended to be inherited globally. The default compression mechanism is gz (gzip) @@ -320,37 +318,37 @@ but you can select an alternative mechanism by setting the .. _ref-classes-copyleft_compliance: -``copyleft_compliance.bbclass`` -=============================== +``copyleft_compliance`` +======================= -The :ref:`copyleft_compliance ` class preserves source code for the purposes -of license compliance. This class is an alternative to the :ref:`archiver ` +The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes +of license compliance. This class is an alternative to the :ref:`ref-classes-archiver` class and is still used by some users even though it has been deprecated -in favor of the :ref:`archiver ` class. +in favor of the :ref:`ref-classes-archiver` class. .. _ref-classes-copyleft_filter: -``copyleft_filter.bbclass`` -=========================== +``copyleft_filter`` +=================== -A class used by the :ref:`archiver ` and -:ref:`copyleft_compliance ` classes +A class used by the :ref:`ref-classes-archiver` and +:ref:`ref-classes-copyleft_compliance` classes for filtering licenses. The ``copyleft_filter`` class is an internal class and is not intended to be used directly. .. _ref-classes-core-image: -``core-image.bbclass`` -====================== +``core-image`` +============== -The :ref:`core-image ` class provides common definitions for the +The :ref:`ref-classes-core-image` class provides common definitions for the ``core-image-*`` image recipes, such as support for additional :term:`IMAGE_FEATURES`. .. _ref-classes-cpan: -``cpan*.bbclass`` -================= +``cpan*`` +========= The :ref:`cpan* ` classes support Perl modules. @@ -370,10 +368,10 @@ support. .. _ref-classes-create-spdx: -``create-spdx.bbclass`` -======================= +``create-spdx`` +=============== -The :ref:`create-spdx ` class provides support for +The :ref:`ref-classes-create-spdx` class provides support for automatically creating :term:`SPDX` :term:`SBOM` documents based upon image and SDK contents. @@ -391,23 +389,23 @@ by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`, :term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables. See the description of these variables and the -":ref:`dev-manual/common-tasks:creating a software bill of materials`" +":ref:`dev-manual/sbom:creating a software bill of materials`" section in the Yocto Project Development Manual for more details. .. _ref-classes-cross: -``cross.bbclass`` -================= +``cross`` +========= -The :ref:`cross ` class provides support for the recipes that build the +The :ref:`ref-classes-cross` class provides support for the recipes that build the cross-compilation tools. .. _ref-classes-cross-canadian: -``cross-canadian.bbclass`` -========================== +``cross-canadian`` +================== -The :ref:`cross-canadian ` class provides support for the recipes that build +The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build the Canadian Cross-compilation tools for SDKs. See the ":ref:`overview-manual/concepts:cross-development toolchain generation`" section in the Yocto Project Overview and Concepts Manual for more @@ -415,10 +413,10 @@ discussion on these cross-compilation tools. .. _ref-classes-crosssdk: -``crosssdk.bbclass`` -==================== +``crosssdk`` +============ -The :ref:`crosssdk ` class provides support for the recipes that build the +The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the cross-compilation tools used for building SDKs. See the ":ref:`overview-manual/concepts:cross-development toolchain generation`" section in the Yocto Project Overview and Concepts Manual for more @@ -426,10 +424,10 @@ discussion on these cross-compilation tools. .. _ref-classes-cve-check: -``cve-check.bbclass`` -===================== +``cve-check`` +============= -The :ref:`cve-check ` class looks for known CVEs (Common Vulnerabilities +The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities and Exposures) while building with BitBake. This class is meant to be inherited globally from a configuration file:: @@ -485,15 +483,15 @@ These can only be detected by reviewing the details of the issues and iterating and following what happens in other Linux distributions and in the greater open source community. You will find some more details in the -":ref:`dev-manual/common-tasks:checking for vulnerabilities`" +":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`" section in the Development Tasks Manual. .. _ref-classes-debian: -``debian.bbclass`` -================== +``debian`` +========== -The :ref:`debian ` class renames output packages so that they follow the +The :ref:`ref-classes-debian` class renames output packages so that they follow the Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and ``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library name and version as part of the package name. @@ -505,10 +503,10 @@ naming scheme. .. _ref-classes-deploy: -``deploy.bbclass`` -================== +``deploy`` +========== -The :ref:`deploy ` class handles deploying files to the +The :ref:`ref-classes-deploy` class handles deploying files to the :term:`DEPLOY_DIR_IMAGE` directory. The main function of this class is to allow the deploy step to be accelerated by shared state. Recipes that inherit this class should define their own @@ -521,20 +519,20 @@ staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`. .. _ref-classes-devshell: -``devshell.bbclass`` -==================== +``devshell`` +============ -The :ref:`devshell ` class adds the :ref:`ref-tasks-devshell` task. Distribution -policy dictates whether to include this class. See the ":ref:`dev-manual/common-tasks:using a development shell`" +The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution +policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`" section in the Yocto Project Development Tasks Manual for more -information about using :ref:`devshell `. +information about using :ref:`ref-classes-devshell`. .. _ref-classes-devupstream: -``devupstream.bbclass`` -======================= +``devupstream`` +=============== -The :ref:`devupstream ` class uses +The :ref:`ref-classes-devupstream` class uses :term:`BBCLASSEXTEND` to add a variant of the recipe that fetches from an alternative URI (e.g. Git) instead of a tarball. Following is an example:: @@ -556,10 +554,10 @@ Any development-specific adjustments can be done by using the The class currently only supports creating a development variant of the target -recipe, not :ref:`native ` or :ref:`nativesdk ` variants. +recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants. The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides -support for :ref:`native ` and :ref:`nativesdk ` variants. Consequently, this +support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this functionality can be added in a future release. Support for other version control systems such as Subversion is limited @@ -568,10 +566,10 @@ due to BitBake's automatic fetch dependencies (e.g. .. _ref-classes-externalsrc: -``externalsrc.bbclass`` -======================= +``externalsrc`` +=============== -The :ref:`externalsrc ` class supports building software from source code +The :ref:`ref-classes-externalsrc` class supports building software from source code that is external to the OpenEmbedded build system. Building software from an external source tree means that the build system's normal fetch, unpack, and patch process is not used. @@ -579,9 +577,8 @@ unpack, and patch process is not used. By default, the OpenEmbedded build system uses the :term:`S` and :term:`B` variables to locate unpacked recipe source code and to build it, respectively. When your recipe inherits the -:ref:`externalsrc ` class, you use the -:term:`EXTERNALSRC` and -:term:`EXTERNALSRC_BUILD` variables to +:ref:`ref-classes-externalsrc` class, you use the +:term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to ultimately define :term:`S` and :term:`B`. By default, this class expects the source code to support recipe builds @@ -596,19 +593,18 @@ See these variables for more information: :term:`WORKDIR`, :term:`BPN`, and :term:`PV`, -For more information on the :ref:`externalsrc ` class, see the comments in +For more information on the :ref:`ref-classes-externalsrc` class, see the comments in ``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`. -For information on how to use the -:ref:`externalsrc ` class, see the -":ref:`dev-manual/common-tasks:building software from an external source`" +For information on how to use the :ref:`ref-classes-externalsrc` class, see the +":ref:`dev-manual/building:building software from an external source`" section in the Yocto Project Development Tasks Manual. .. _ref-classes-extrausers: -``extrausers.bbclass`` -====================== +``extrausers`` +============== -The :ref:`extrausers ` class allows additional user and group configuration +The :ref:`ref-classes-extrausers` class allows additional user and group configuration to be applied at the image level. Inheriting this class either globally or from an image recipe allows additional user and group operations to be performed using the @@ -616,13 +612,11 @@ be performed using the .. note:: - The user and group operations added using the - :ref:`extrausers ` + The user and group operations added using the :ref:`ref-classes-extrausers` class are not tied to a specific recipe outside of the recipe for the image. Thus, the operations can be performed across the image as a - whole. Use the - :ref:`useradd ` - class to add user and group configuration to a specific recipe. + whole. Use the :ref:`ref-classes-useradd` class to add user and group + configuration to a specific recipe. Here is an example that uses this class in an image recipe:: @@ -667,12 +661,12 @@ Finally, here is an example that sets the root password:: .. _ref-classes-features_check: -``features_check.bbclass`` -================================= +``features_check`` +================== -The :ref:`features_check ` class allows individual recipes to check -for required and conflicting -:term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` or :term:`COMBINED_FEATURES`. +The :ref:`ref-classes-features_check` class allows individual recipes to check +for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` +or :term:`COMBINED_FEATURES`. This class provides support for the following variables: @@ -693,10 +687,10 @@ triggered. .. _ref-classes-fontcache: -``fontcache.bbclass`` -===================== +``fontcache`` +============= -The :ref:`fontcache ` class generates the proper post-install and +The :ref:`ref-classes-fontcache` class generates the proper post-install and post-remove (postinst and postrm) scriptlets for font packages. These scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts to the font information cache. Since the cache files are @@ -709,20 +703,20 @@ packages containing the fonts. .. _ref-classes-fs-uuid: -``fs-uuid.bbclass`` -=================== +``fs-uuid`` +=========== -The :ref:`fs-uuid ` class extracts UUID from +The :ref:`ref-classes-fs-uuid` class extracts UUID from ``${``\ :term:`ROOTFS`\ ``}``, which must have been built -by the time that this function gets called. The :ref:`fs-uuid ` class only +by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only works on ``ext`` file systems and depends on ``tune2fs``. .. _ref-classes-gconf: -``gconf.bbclass`` -================= +``gconf`` +========= -The :ref:`gconf ` class provides common functionality for recipes that need +The :ref:`ref-classes-gconf` class provides common functionality for recipes that need to install GConf schemas. The schemas will be put into a separate package (``${``\ :term:`PN`\ ``}-gconf``) that is created automatically when this class is inherited. This package uses the @@ -731,34 +725,34 @@ register and unregister the schemas in the target image. .. _ref-classes-gettext: -``gettext.bbclass`` -=================== +``gettext`` +=========== -The :ref:`gettext ` class provides support for building software that uses -the GNU ``gettext`` internationalization and localization system. All -recipes building software that use ``gettext`` should inherit this +The :ref:`ref-classes-gettext` class provides support for building +software that uses the GNU ``gettext`` internationalization and localization +system. All recipes building software that use ``gettext`` should inherit this class. .. _ref-classes-github-releases: -``github-releases.bbclass`` -=========================== +``github-releases`` +=================== -For recipes that fetch release tarballs from github, the :ref:`github-releases ` +For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases` class sets up a standard way for checking available upstream versions (to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)). -To use it, add ":ref:`github-releases `" to the inherit line in the recipe, +To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe, and if the default value of :term:`GITHUB_BASE_URI` is not suitable, then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}`` in the value you set for :term:`SRC_URI` within the recipe. .. _ref-classes-gnomebase: -``gnomebase.bbclass`` -===================== +``gnomebase`` +============= -The :ref:`gnomebase ` class is the base class for recipes that build +The :ref:`ref-classes-gnomebase` class is the base class for recipes that build software from the GNOME stack. This class sets :term:`SRC_URI` to download the source from the GNOME mirrors as well as extending :term:`FILES` with the typical @@ -766,8 +760,8 @@ GNOME installation paths. .. _ref-classes-gobject-introspection: -``gobject-introspection.bbclass`` -================================= +``gobject-introspection`` +========================= Provides support for recipes building software that supports GObject introspection. This functionality is only enabled if the @@ -784,10 +778,10 @@ introspection. This functionality is only enabled if the .. _ref-classes-grub-efi: -``grub-efi.bbclass`` -==================== +``grub-efi`` +============ -The :ref:`grub-efi ` class provides ``grub-efi``-specific functions for +The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for building bootable images. This class supports several variables: @@ -816,10 +810,10 @@ This class supports several variables: .. _ref-classes-gsettings: -``gsettings.bbclass`` -===================== +``gsettings`` +============= -The :ref:`gsettings ` class provides common functionality for recipes that +The :ref:`ref-classes-gsettings` class provides common functionality for recipes that need to install GSettings (glib) schemas. The schemas are assumed to be part of the main package. Appropriate post-install and post-remove (postinst/postrm) scriptlets are added to register and unregister the @@ -827,18 +821,18 @@ schemas in the target image. .. _ref-classes-gtk-doc: -``gtk-doc.bbclass`` -=================== +``gtk-doc`` +=========== -The :ref:`gtk-doc ` class is a helper class to pull in the appropriate +The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate ``gtk-doc`` dependencies and disable ``gtk-doc``. .. _ref-classes-gtk-icon-cache: -``gtk-icon-cache.bbclass`` -========================== +``gtk-icon-cache`` +================== -The :ref:`gtk-icon-cache ` class generates the proper post-install and +The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and post-remove (postinst/postrm) scriptlets for packages that use GTK+ and install icons. These scriptlets call ``gtk-update-icon-cache`` to add the fonts to GTK+'s icon cache. Since the cache files are @@ -848,10 +842,10 @@ creation. .. _ref-classes-gtk-immodules-cache: -``gtk-immodules-cache.bbclass`` -=============================== +``gtk-immodules-cache`` +======================= -The :ref:`gtk-immodules-cache ` class generates the proper post-install and +The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and post-remove (postinst/postrm) scriptlets for packages that install GTK+ input method modules for virtual keyboards. These scriptlets call ``gtk-update-icon-cache`` to add the input method modules to the cache. @@ -866,19 +860,19 @@ the packages containing the modules. .. _ref-classes-gzipnative: -``gzipnative.bbclass`` -====================== +``gzipnative`` +============== -The :ref:`gzipnative ` class enables the use of different native versions of +The :ref:`ref-classes-gzipnative` class enables the use of different native versions of ``gzip`` and ``pigz`` rather than the versions of these tools from the build host. .. _ref-classes-icecc: -``icecc.bbclass`` -================= +``icecc`` +========= -The :ref:`icecc ` class supports +The :ref:`ref-classes-icecc` class supports `Icecream `__, which facilitates taking compile jobs and distributing them among remote machines. @@ -926,13 +920,13 @@ Additionally, you can list recipes using the your ``local.conf`` file to force ``icecc`` to be enabled for recipes using an empty :term:`PARALLEL_MAKE` variable. -Inheriting the :ref:`icecc ` class changes all sstate signatures. +Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures. Consequently, if a development team has a dedicated build system that populates :term:`SSTATE_MIRRORS` and they want to reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build -system need to either inherit the :ref:`icecc ` class or nobody should. +system need to either inherit the :ref:`ref-classes-icecc` class or nobody should. -At the distribution level, you can inherit the :ref:`icecc ` class to be +At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be sure that all builders start with the same sstate signatures. After inheriting the class, you can then disable the feature by setting the :term:`ICECC_DISABLED` variable to "1" as follows:: @@ -949,10 +943,10 @@ individually as follows in your ``local.conf`` file:: .. _ref-classes-image: -``image.bbclass`` -================= +``image`` +========= -The :ref:`image ` class helps support creating images in different formats. +The :ref:`ref-classes-image` class helps support creating images in different formats. First, the root filesystem is created from packages using one of the ``rootfs*.bbclass`` files (depending on the package format used) and then one or more image files are created. @@ -964,7 +958,7 @@ then one or more image files are created. install into the image. For information on customizing images, see the -":ref:`dev-manual/common-tasks:customizing images`" section +":ref:`dev-manual/customizing-images:customizing images`" section in the Yocto Project Development Tasks Manual. For information on how images are created, see the ":ref:`overview-manual/concepts:images`" section in the @@ -972,20 +966,20 @@ Yocto Project Overview and Concepts Manual. .. _ref-classes-image-buildinfo: -``image-buildinfo.bbclass`` -=========================== +``image-buildinfo`` +=================== -The :ref:`image-buildinfo ` class writes a plain text file containing +The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing build information to the target filesystem at ``${sysconfdir}/buildinfo`` by default (as specified by :term:`IMAGE_BUILDINFO_FILE`). This can be useful for manually determining the origin of any given image. It writes out two sections: -1. `Build Configuration`: a list of variables and their values (specified +#. `Build Configuration`: a list of variables and their values (specified by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and :term:`DISTRO_VERSION`) -2. `Layer Revisions`: the revisions of all of the layers used in the +#. `Layer Revisions`: the revisions of all of the layers used in the build. Additionally, when building an SDK it will write the same contents @@ -994,17 +988,17 @@ to ``/buildinfo`` by default (as specified by .. _ref-classes-image_types: -``image_types.bbclass`` -======================= +``image_types`` +=============== -The :ref:`image_types ` class defines all of the standard image output types +The :ref:`ref-classes-image_types` class defines all of the standard image output types that you can enable through the :term:`IMAGE_FSTYPES` variable. You can use this class as a reference on how to add support for custom image output types. -By default, the :ref:`image ` class automatically -enables the :ref:`image_types ` class. The :ref:`image ` class uses the +By default, the :ref:`ref-classes-image` class automatically +enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the ``IMGCLASSES`` variable as follows:: IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}" @@ -1016,7 +1010,7 @@ enables the :ref:`image_types ` class. The :ref:`image IMGCLASSES += "image-postinst-intercepts" inherit ${IMGCLASSES} -The :ref:`image_types ` class also handles conversion and compression of images. +The :ref:`ref-classes-image_types` class also handles conversion and compression of images. .. note:: @@ -1026,8 +1020,8 @@ The :ref:`image_types ` class also handles conversion a .. _ref-classes-image-live: -``image-live.bbclass`` -====================== +``image-live`` +============== This class controls building "live" (i.e. HDDIMG and ISO) images. Live images contain syslinux for legacy booting, as well as the bootloader @@ -1039,10 +1033,10 @@ Normally, you do not use this class directly. Instead, you add "live" to .. _ref-classes-insane: -``insane.bbclass`` -================== +``insane`` +========== -The :ref:`insane ` class adds a step to the package generation process so +The :ref:`ref-classes-insane` class adds a step to the package generation process so that output quality assurance checks are generated by the OpenEmbedded build system. A range of checks are performed that check the build's output for common problems that show up during runtime. Distribution @@ -1102,7 +1096,7 @@ Here are the tests you can list with the :term:`WARN_QA` and the package is installed into the image during the :ref:`ref-tasks-rootfs` task because the auto-detected dependency was not satisfied. An example of this would be where the - :ref:`update-rc.d ` class automatically + :ref:`ref-classes-update-rc.d` class automatically adds a dependency on the ``initscripts-functions`` package to packages that install an initscript that refers to ``/etc/init.d/functions``. The recipe should really have an explicit @@ -1339,23 +1333,23 @@ Here are the tests you can list with the :term:`WARN_QA` and .. _ref-classes-insserv: -``insserv.bbclass`` -=================== +``insserv`` +=========== -The :ref:`insserv ` class uses the ``insserv`` utility to update the order +The :ref:`ref-classes-insserv` class uses the ``insserv`` utility to update the order of symbolic links in ``/etc/rc?.d/`` within an image based on dependencies specified by LSB headers in the ``init.d`` scripts themselves. .. _ref-classes-kernel: -``kernel.bbclass`` -================== +``kernel`` +========== -The :ref:`kernel ` class handles building Linux kernels. The class contains +The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains code to build all kernel trees. All needed headers are staged into the :term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds -using the :ref:`module ` class. +using the :ref:`ref-classes-module` class. This means that each built kernel module is packaged separately and inter-module dependencies are created by parsing the ``modinfo`` output. @@ -1363,50 +1357,48 @@ If all modules are required, then installing the ``kernel-modules`` package installs all packages with modules and various other kernel packages such as ``kernel-vmlinux``. -The :ref:`kernel ` class contains logic that allows you to embed an initial +The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For information on how to build an :term:`Initramfs`, see the -":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section in +":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in the Yocto Project Development Tasks Manual. -Various other classes are used by the :ref:`kernel ` and :ref:`module ` classes -internally including the :ref:`kernel-arch `, -:ref:`module-base `, and -:ref:`linux-kernel-base ` classes. +Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes +internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and +:ref:`ref-classes-linux-kernel-base` classes. .. _ref-classes-kernel-arch: -``kernel-arch.bbclass`` -======================= +``kernel-arch`` +=============== -The :ref:`kernel-arch ` class sets the ``ARCH`` environment variable for +The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for Linux kernel compilation (including modules). .. _ref-classes-kernel-devicetree: -``kernel-devicetree.bbclass`` -============================= +``kernel-devicetree`` +===================== -The :ref:`kernel-devicetree ` class, which is inherited by the -:ref:`kernel ` class, supports device tree -generation. +The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the +:ref:`ref-classes-kernel` class, supports device tree generation. .. _ref-classes-kernel-fitimage: -``kernel-fitimage.bbclass`` -=========================== +``kernel-fitimage`` +=================== -The :ref:`kernel-fitimage ` class provides support to pack a kernel image, -device trees, a U-boot script, a Initramfs bundle and a RAM disk +The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image, +device trees, a U-boot script, a :term:`Initramfs` bundle and a RAM disk into a single FIT image. In theory, a FIT image can support any number -of kernels, U-boot scripts, Initramfs bundles, RAM disks and device-trees. -However, :ref:`kernel-fitimage ` currently only supports +of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees. +However, :ref:`ref-classes-kernel-fitimage` currently only supports limited usecases: just one kernel image, an optional U-boot script, -an optional Initramfs bundle, an optional RAM disk, and any number of +an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of device tree. To create a FIT image, it is required that :term:`KERNEL_CLASSES` -is set to include "kernel-fitimage" and :term:`KERNEL_IMAGETYPE` +is set to include ":ref:`ref-classes-kernel-fitimage`" and :term:`KERNEL_IMAGETYPE` is set to "fitImage". The options for the device tree compiler passed to ``mkimage -D`` @@ -1414,107 +1406,107 @@ when creating the FIT image are specified using the :term:`UBOOT_MKIMAGE_DTCOPTS` variable. Only a single kernel can be added to the FIT image created by -:ref:`kernel-fitimage ` and the kernel image in FIT is mandatory. The +:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The address where the kernel image is to be loaded by U-Boot is specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`. Multiple device trees can be added to the FIT image created by -:ref:`kernel-fitimage ` and the device tree is optional. +:ref:`ref-classes-kernel-fitimage` and the device tree is optional. The address where the device tree is to be loaded by U-Boot is specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries. Only a single RAM disk can be added to the FIT image created by -:ref:`kernel-fitimage ` and the RAM disk in FIT is optional. +:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional. The address where the RAM disk image is to be loaded by U-Boot is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by :term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when :term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 0. -Only a single Initramfs bundle can be added to the FIT image created by -:ref:`kernel-fitimage ` and the Initramfs bundle in FIT is optional. -In case of Initramfs, the kernel is configured to be bundled with the root filesystem +Only a single :term:`Initramfs` bundle can be added to the FIT image created by +:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional. +In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin). -When the kernel is copied to RAM and executed, it unpacks the Initramfs root filesystem. -The Initramfs bundle can be enabled when :term:`INITRAMFS_IMAGE` +When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem. +The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1. -The address where the Initramfs bundle is to be loaded by U-boot is specified +The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`. Only a single U-boot boot script can be added to the FIT image created by -:ref:`kernel-fitimage ` and the boot script is optional. +:ref:`ref-classes-kernel-fitimage` and the boot script is optional. The boot script is specified in the ITS file as a text file containing U-boot commands. When using a boot script the user should configure the U-boot :ref:`ref-tasks-install` task to copy the script to sysroot. -So the script can be included in the FIT image by the :ref:`kernel-fitimage ` +So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage` class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to load the boot script from the FIT image and executes it. -The FIT image generated by :ref:`kernel-fitimage ` class is signed when the +The FIT image generated by :ref:`ref-classes-kernel-fitimage` class is signed when the variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`, :term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set appropriately. The default values used for :term:`FIT_HASH_ALG` and -:term:`FIT_SIGN_ALG` in :ref:`kernel-fitimage ` are "sha256" and +:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and "rsa2048" respectively. The keys for signing fitImage can be generated using -the :ref:`kernel-fitimage ` class when both :term:`FIT_GENERATE_KEYS` and +the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and :term:`UBOOT_SIGN_ENABLE` are set to "1". .. _ref-classes-kernel-grub: -``kernel-grub.bbclass`` -======================= +``kernel-grub`` +=============== -The :ref:`kernel-grub ` class updates the boot area and the boot menu with +The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with the kernel as the priority boot mechanism while installing a RPM to update the kernel on a deployed target. .. _ref-classes-kernel-module-split: -``kernel-module-split.bbclass`` -=============================== +``kernel-module-split`` +======================= -The :ref:`kernel-module-split ` class provides common functionality for +The :ref:`ref-classes-kernel-module-split` class provides common functionality for splitting Linux kernel modules into separate packages. .. _ref-classes-kernel-uboot: -``kernel-uboot.bbclass`` -======================== +``kernel-uboot`` +================ -The :ref:`kernel-uboot ` class provides support for building from +The :ref:`ref-classes-kernel-uboot` class provides support for building from vmlinux-style kernel sources. .. _ref-classes-kernel-uimage: -``kernel-uimage.bbclass`` -========================= +``kernel-uimage`` +================= -The :ref:`kernel-uimage ` class provides support to pack uImage. +The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage. .. _ref-classes-kernel-yocto: -``kernel-yocto.bbclass`` -======================== +``kernel-yocto`` +================ -The :ref:`kernel-yocto ` class provides common functionality for building +The :ref:`ref-classes-kernel-yocto` class provides common functionality for building from linux-yocto style kernel source repositories. .. _ref-classes-kernelsrc: -``kernelsrc.bbclass`` -===================== +``kernelsrc`` +============= -The :ref:`kernelsrc ` class sets the Linux kernel source and version. +The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version. .. _ref-classes-lib_package: -``lib_package.bbclass`` -======================= +``lib_package`` +=============== -The :ref:`lib_package ` class supports recipes that build libraries and +The :ref:`ref-classes-lib_package` class supports recipes that build libraries and produce executable binaries, where those binaries should not be installed by default along with the library. Instead, the binaries are added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to @@ -1522,10 +1514,10 @@ make their installation optional. .. _ref-classes-libc*: -``libc*.bbclass`` -================= +``libc*`` +========= -The :ref:`libc* ` classes support recipes that build packages with ``libc``: +The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``: - The :ref:`libc-common ` class provides common support for building with ``libc``. @@ -1535,27 +1527,27 @@ The :ref:`libc* ` classes support recipes that build packages .. _ref-classes-license: -``license.bbclass`` -=================== +``license`` +=========== -The :ref:`license ` class provides license manifest creation and license +The :ref:`ref-classes-license` class provides license manifest creation and license exclusion. This class is enabled by default using the default value for the :term:`INHERIT_DISTRO` variable. .. _ref-classes-linux-kernel-base: -``linux-kernel-base.bbclass`` -============================= +``linux-kernel-base`` +===================== -The :ref:`linux-kernel-base ` class provides common functionality for +The :ref:`ref-classes-linux-kernel-base` class provides common functionality for recipes that build out of the Linux kernel source tree. These builds goes beyond the kernel itself. For example, the Perf recipe also inherits this class. .. _ref-classes-linuxloader: -``linuxloader.bbclass`` -======================= +``linuxloader`` +=============== Provides the function ``linuxloader()``, which gives the value of the dynamic loader/linker provided on the platform. This value is used by a @@ -1563,53 +1555,53 @@ number of other classes. .. _ref-classes-logging: -``logging.bbclass`` -=================== +``logging`` +=========== -The :ref:`logging ` class provides the standard shell functions used to log +The :ref:`ref-classes-logging` class provides the standard shell functions used to log messages for various BitBake severity levels (i.e. ``bbplain``, ``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``). -This class is enabled by default since it is inherited by the :ref:`base ` +This class is enabled by default since it is inherited by the :ref:`ref-classes-base` class. .. _ref-classes-metadata_scm: -``metadata_scm.bbclass`` -======================== +``metadata_scm`` +================ -The :ref:`metadata_scm ` class provides functionality for querying the +The :ref:`ref-classes-metadata_scm` class provides functionality for querying the branch and revision of a Source Code Manager (SCM) repository. -The :ref:`base ` class uses this class to print the -revisions of each layer before starting every build. The -:ref:`metadata_scm ` class is enabled by default because it is inherited by -the :ref:`base ` class. +The :ref:`ref-classes-base` class uses this class to print the revisions of +each layer before starting every build. The :ref:`ref-classes-metadata_scm` +class is enabled by default because it is inherited by the +:ref:`ref-classes-base` class. .. _ref-classes-migrate_localcount: -``migrate_localcount.bbclass`` -============================== +``migrate_localcount`` +====================== -The :ref:`migrate_localcount ` class verifies a recipe's localcount data and +The :ref:`ref-classes-migrate_localcount` class verifies a recipe's localcount data and increments it appropriately. .. _ref-classes-mime: -``mime.bbclass`` -================ +``mime`` +======== -The :ref:`mime ` class generates the proper post-install and post-remove +The :ref:`ref-classes-mime` class generates the proper post-install and post-remove (postinst/postrm) scriptlets for packages that install MIME type files. These scriptlets call ``update-mime-database`` to add the MIME types to the shared database. .. _ref-classes-mime-xdg: -``mime-xdg.bbclass`` -==================== +``mime-xdg`` +============ -The :ref:`mime-xdg ` class generates the proper +The :ref:`ref-classes-mime-xdg` class generates the proper post-install and post-remove (postinst/postrm) scriptlets for packages that install ``.desktop`` files containing ``MimeType`` entries. These scriptlets call ``update-desktop-database`` to add the MIME types @@ -1627,28 +1619,26 @@ package names to the :term:`MIME_XDG_PACKAGES` variable. .. _ref-classes-mirrors: -``mirrors.bbclass`` -=================== +``mirrors`` +=========== -The :ref:`mirrors ` class sets up some standard +The :ref:`ref-classes-mirrors` class sets up some standard :term:`MIRRORS` entries for source code mirrors. These mirrors provide a fall-back path in case the upstream source specified in :term:`SRC_URI` within recipes is unavailable. This class is enabled by default since it is inherited by the -:ref:`base ` class. +:ref:`ref-classes-base` class. .. _ref-classes-module: -``module.bbclass`` -================== +``module`` +========== -The :ref:`module ` class provides support for building out-of-tree Linux -kernel modules. The class inherits the -:ref:`module-base ` and -:ref:`kernel-module-split ` classes, -and implements the :ref:`ref-tasks-compile` and -:ref:`ref-tasks-install` tasks. The class provides +The :ref:`ref-classes-module` class provides support for building out-of-tree Linux +kernel modules. The class inherits the :ref:`ref-classes-module-base` and +:ref:`ref-classes-kernel-module-split` classes, and implements the +:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides everything needed to build and package a kernel module. For general information on out-of-tree Linux kernel modules, see the @@ -1657,44 +1647,44 @@ section in the Yocto Project Linux Kernel Development Manual. .. _ref-classes-module-base: -``module-base.bbclass`` -======================= +``module-base`` +=============== -The :ref:`module-base ` class provides the base functionality for building -Linux kernel modules. Typically, a recipe that builds software that -includes one or more kernel modules and has its own means of building -the module inherits this class as opposed to inheriting the -:ref:`module ` class. +The :ref:`ref-classes-module-base` class provides the base functionality for +building Linux kernel modules. Typically, a recipe that builds software that +includes one or more kernel modules and has its own means of building the module +inherits this class as opposed to inheriting the :ref:`ref-classes-module` +class. .. _ref-classes-multilib*: -``multilib*.bbclass`` -===================== +``multilib*`` +============= -The :ref:`multilib* ` classes provide support for building libraries with +The :ref:`ref-classes-multilib*` classes provide support for building libraries with different target optimizations or target architectures and installing them side-by-side in the same image. For more information on using the Multilib feature, see the -":ref:`dev-manual/common-tasks:combining multiple versions of library files into one image`" +":ref:`dev-manual/libraries:combining multiple versions of library files into one image`" section in the Yocto Project Development Tasks Manual. .. _ref-classes-native: -``native.bbclass`` -================== +``native`` +========== -The :ref:`native ` class provides common functionality for recipes that +The :ref:`ref-classes-native` class provides common functionality for recipes that build tools to run on the :term:`Build Host` (i.e. tools that use the compiler or other tools from the build host). You can create a recipe that builds tools that run natively on the host a couple different ways: -- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`native ` +- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native` class. If you use this method, you must order the inherit statement in the recipe after all other inherit statements so that the - :ref:`native ` class is inherited last. + :ref:`ref-classes-native` class is inherited last. .. note:: @@ -1716,17 +1706,17 @@ a couple different ways: specify any functionality specific to the respective native or target case. -Although applied differently, the :ref:`native ` class is used with both +Although applied differently, the :ref:`ref-classes-native` class is used with both methods. The advantage of the second method is that you do not need to have two separate recipes (assuming you need both) for native and target. All common parts of the recipe are automatically shared. .. _ref-classes-nativesdk: -``nativesdk.bbclass`` -===================== +``nativesdk`` +============= -The :ref:`nativesdk ` class provides common functionality for recipes that +The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that wish to build tools to run as part of an SDK (i.e. tools that run on :term:`SDKMACHINE`). @@ -1734,11 +1724,11 @@ You can create a recipe that builds tools that run on the SDK machine a couple different ways: - Create a ``nativesdk-myrecipe.bb`` recipe that inherits the - :ref:`nativesdk ` class. If you use this method, you must order the + :ref:`ref-classes-nativesdk` class. If you use this method, you must order the inherit statement in the recipe after all other inherit statements so - that the :ref:`nativesdk ` class is inherited last. + that the :ref:`ref-classes-nativesdk` class is inherited last. -- Create a :ref:`nativesdk ` variant of any recipe by adding the following:: +- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following:: BBCLASSEXTEND = "nativesdk" @@ -1757,23 +1747,23 @@ couple different ways: Not doing so can lead to subtle problems because there is code that depends on the naming convention. -Although applied differently, the :ref:`nativesdk ` class is used with both +Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both methods. The advantage of the second method is that you do not need to have two separate recipes (assuming you need both) for the SDK machine and the target. All common parts of the recipe are automatically shared. .. _ref-classes-nopackages: -``nopackages.bbclass`` -====================== +``nopackages`` +============== Disables packaging tasks for those recipes and classes where packaging is not needed. .. _ref-classes-npm: -``npm.bbclass`` -=============== +``npm`` +======= Provides support for building Node.js software fetched using the :wikipedia:`node package manager (NPM) `. @@ -1784,33 +1774,33 @@ Provides support for building Node.js software fetched using the fetcher to have dependencies fetched and packaged automatically. For information on how to create NPM packages, see the -":ref:`dev-manual/common-tasks:creating node package manager (npm) packages`" +":ref:`dev-manual/packages:creating node package manager (npm) packages`" section in the Yocto Project Development Tasks Manual. .. _ref-classes-oelint: -``oelint.bbclass`` -================== +``oelint`` +========== -The :ref:`oelint ` class is an obsolete lint checking tool available in +The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in ``meta/classes`` in the :term:`Source Directory`. There are some classes that could be generally useful in OE-Core but -are never actually used within OE-Core itself. The :ref:`oelint ` class is +are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is one such example. However, being aware of this class can reduce the proliferation of different versions of similar classes across multiple layers. .. _ref-classes-overlayfs: -``overlayfs.bbclass`` -======================= +``overlayfs`` +============= It's often desired in Embedded System design to have a read-only root filesystem. But a lot of different applications might want to have read-write access to some parts of a filesystem. It can be especially useful when your update mechanism overwrites the whole root filesystem, but you may want your application data to be preserved -between updates. The :ref:`overlayfs ` class provides a way +between updates. The :ref:`ref-classes-overlayfs` class provides a way to achieve that by means of ``overlayfs`` and at the same time keeping the base root filesystem read-only. @@ -1850,7 +1840,7 @@ and then in your recipe:: On a practical note, your application recipe might require multiple overlays to be mounted before running to avoid writing to the underlying file system (which can be forbidden in case of read-only file system) -To achieve that :ref:`overlayfs ` provides a ``systemd`` +To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd`` helper service for mounting overlays. This helper service is named ``${PN}-overlays.service`` and can be depended on in your application recipe (named ``application`` in the following example) ``systemd`` unit by adding @@ -1863,12 +1853,12 @@ to the unit the following:: .. note:: The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it. - In order to get ``/etc`` in overlayfs, see :ref:`overlayfs-etc `. + In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`. .. _ref-classes-overlayfs-etc: -``overlayfs-etc.bbclass`` -========================= +``overlayfs-etc`` +================= In order to have the ``/etc`` directory in overlayfs a special handling at early boot stage is required. The idea is to supply a custom init script that mounts @@ -1912,10 +1902,10 @@ The class provides two options for ``/sbin/init`` generation: .. _ref-classes-own-mirrors: -``own-mirrors.bbclass`` -======================= +``own-mirrors`` +=============== -The :ref:`own-mirrors ` class makes it easier to set up your own +The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own :term:`PREMIRRORS` from which to first fetch source before attempting to fetch it from the upstream specified in :term:`SRC_URI` within each recipe. @@ -1931,21 +1921,19 @@ in :term:`SOURCE_MIRROR_URL`. .. _ref-classes-package: -``package.bbclass`` -=================== +``package`` +=========== -The :ref:`package ` class supports generating packages from a build's +The :ref:`ref-classes-package` class supports generating packages from a build's output. The core generic functionality is in ``package.bbclass``. The code specific to particular package types resides in these -package-specific classes: -:ref:`package_deb `, -:ref:`package_rpm `, -:ref:`package_ipk `, and -:ref:`package_tar `. +package-specific classes: :ref:`ref-classes-package_deb`, +:ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`, and +:ref:`ref-classes-package_tar`. .. note:: - The :ref:`package_tar ` class is broken and + The :ref:`ref-classes-package_tar` class is broken and not supported. It is recommended that you do not use this class. You can control the list of resulting package formats by using the @@ -1960,7 +1948,7 @@ If you take the optional step to set up a repository (package feed) on the development host that can be used by DNF, you can install packages from the feed while you are running the image on the target (i.e. runtime installation of packages). For more information, see the -":ref:`dev-manual/common-tasks:using runtime package management`" +":ref:`dev-manual/packages:using runtime package management`" section in the Yocto Project Development Tasks Manual. The package-specific class you choose can affect build-time performance @@ -1971,7 +1959,7 @@ complete build of the package with all dependencies previously built. The reason for this discrepancy is because the RPM package manager creates and processes more :term:`Metadata` than the IPK package manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to -":ref:`package_ipk `" if you are building smaller systems. +":ref:`ref-classes-package_ipk`" if you are building smaller systems. Before making your package manager decision, however, you should consider some further things about using RPM: @@ -1996,136 +1984,136 @@ at these two Yocto Project mailing list links: .. _ref-classes-package_deb: -``package_deb.bbclass`` -======================= +``package_deb`` +=============== -The :ref:`package_deb ` class provides support for creating packages that +The :ref:`ref-classes-package_deb` class provides support for creating packages that use the Debian (i.e. ``.deb``) file format. The class ensures the packages are written out in a ``.deb`` file format to the ``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory. -This class inherits the :ref:`package ` class and +This class inherits the :ref:`ref-classes-package` class and is enabled through the :term:`PACKAGE_CLASSES` variable in the ``local.conf`` file. .. _ref-classes-package_ipk: -``package_ipk.bbclass`` -======================= +``package_ipk`` +=============== -The :ref:`package_ipk ` class provides support for creating packages that +The :ref:`ref-classes-package_ipk` class provides support for creating packages that use the IPK (i.e. ``.ipk``) file format. The class ensures the packages are written out in a ``.ipk`` file format to the ``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory. -This class inherits the :ref:`package ` class and +This class inherits the :ref:`ref-classes-package` class and is enabled through the :term:`PACKAGE_CLASSES` variable in the ``local.conf`` file. .. _ref-classes-package_rpm: -``package_rpm.bbclass`` -======================= +``package_rpm`` +=============== -The :ref:`package_rpm ` class provides support for creating packages that +The :ref:`ref-classes-package_rpm` class provides support for creating packages that use the RPM (i.e. ``.rpm``) file format. The class ensures the packages are written out in a ``.rpm`` file format to the ``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory. -This class inherits the :ref:`package ` class and +This class inherits the :ref:`ref-classes-package` class and is enabled through the :term:`PACKAGE_CLASSES` variable in the ``local.conf`` file. .. _ref-classes-package_tar: -``package_tar.bbclass`` -======================= +``package_tar`` +=============== -The :ref:`package_tar ` class provides support for creating tarballs. The +The :ref:`ref-classes-package_tar` class provides support for creating tarballs. The class ensures the packages are written out in a tarball format to the ``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` directory. -This class inherits the :ref:`package ` class and +This class inherits the :ref:`ref-classes-package` class and is enabled through the :term:`PACKAGE_CLASSES` variable in the ``local.conf`` file. .. note:: - You cannot specify the :ref:`package_tar ` class first using the + You cannot specify the :ref:`ref-classes-package_tar` class first using the :term:`PACKAGE_CLASSES` variable. You must use ``.deb``, ``.ipk``, or ``.rpm`` file formats for your image or SDK. .. _ref-classes-packagedata: -``packagedata.bbclass`` -======================= +``packagedata`` +=============== -The :ref:`packagedata ` class provides common functionality for reading +The :ref:`ref-classes-packagedata` class provides common functionality for reading ``pkgdata`` files found in :term:`PKGDATA_DIR`. These files contain information about each output package produced by the OpenEmbedded build system. This class is enabled by default because it is inherited by the -:ref:`package ` class. +:ref:`ref-classes-package` class. .. _ref-classes-packagegroup: -``packagegroup.bbclass`` -======================== +``packagegroup`` +================ -The :ref:`packagegroup ` class sets default values appropriate for package +The :ref:`ref-classes-packagegroup` class sets default values appropriate for package group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and so forth). It is highly recommended that all package group recipes inherit this class. For information on how to use this class, see the -":ref:`dev-manual/common-tasks:customizing images using custom package groups`" +":ref:`dev-manual/customizing-images:customizing images using custom package groups`" section in the Yocto Project Development Tasks Manual. Previously, this class was called the ``task`` class. .. _ref-classes-patch: -``patch.bbclass`` -================= +``patch`` +========= -The :ref:`patch ` class provides all functionality for applying patches +The :ref:`ref-classes-patch` class provides all functionality for applying patches during the :ref:`ref-tasks-patch` task. This class is enabled by default because it is inherited by the -:ref:`base ` class. +:ref:`ref-classes-base` class. .. _ref-classes-perlnative: -``perlnative.bbclass`` -====================== +``perlnative`` +============== -When inherited by a recipe, the :ref:`perlnative ` class supports using the +When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the native version of Perl built by the build system rather than using the version provided by the build host. .. _ref-classes-pypi: -``pypi.bbclass`` -================ +``pypi`` +======== -The :ref:`pypi ` class sets variables appropriately for recipes that build +The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build Python modules from `PyPI `__, the Python Package Index. By default it determines the PyPI package name based upon :term:`BPN` (stripping the "python-" or "python3-" prefix off if present), however in some cases you may need to set it manually in the recipe by setting :term:`PYPI_PACKAGE`. -Variables set by the :ref:`pypi ` class include :term:`SRC_URI`, :term:`SECTION`, +Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`, :term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX` and :term:`CVE_PRODUCT`. .. _ref-classes-python_flit_core: -``python_flit_core.bbclass`` -============================ +``python_flit_core`` +==================== -The :ref:`python_flit_core ` class enables building Python modules which declare +The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare the `PEP-517 `__ compliant ``flit_core.buildapi`` ``build-backend`` in the ``[build-system]`` section of ``pyproject.toml`` (See `PEP-518 `__). @@ -2133,40 +2121,39 @@ section of ``pyproject.toml`` (See `PEP-518 ` class. +Internally this uses the :ref:`ref-classes-python_pep517` class. .. _ref-classes-python_pep517: -``python_pep517.bbclass`` -========================= +``python_pep517`` +================= -The :ref:`python_pep517 ` class builds and installs a Python ``wheel`` binary +The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary archive (see `PEP-517 `__). Recipes wouldn't inherit this directly, instead typically another class will inherit this and add the relevant native dependencies. -Examples of classes which do this are :ref:`python_flit_core -`, :ref:`python_setuptools_build_meta -`, and :ref:`python_poetry_core -`. +Examples of classes which do this are :ref:`ref-classes-python_flit_core`, +:ref:`ref-classes-python_setuptools_build_meta`, and +:ref:`ref-classes-python_poetry_core`. .. _ref-classes-python_poetry_core: -``python_poetry_core.bbclass`` -============================== +``python_poetry_core`` +====================== -The :ref:`python_poetry_core ` class enables building Python modules which use the +The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the `Poetry Core `__ build system. -Internally this uses the :ref:`python_pep517 ` class. +Internally this uses the :ref:`ref-classes-python_pep517` class. .. _ref-classes-pixbufcache: -``pixbufcache.bbclass`` -======================= +``pixbufcache`` +=============== -The :ref:`pixbufcache ` class generates the proper post-install and +The :ref:`ref-classes-pixbufcache` class generates the proper post-install and post-remove (postinst/postrm) scriptlets for packages that install pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache. @@ -2181,24 +2168,24 @@ containing the loaders. .. _ref-classes-pkgconfig: -``pkgconfig.bbclass`` -===================== +``pkgconfig`` +============= -The :ref:`pkgconfig ` class provides a standard way to get header and +The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and library information by using ``pkg-config``. This class aims to smooth integration of ``pkg-config`` into libraries that use it. During staging, BitBake installs ``pkg-config`` data into the ``sysroots/`` directory. By making use of sysroot functionality within -``pkg-config``, the :ref:`pkgconfig ` class no longer has to manipulate the +``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the files. .. _ref-classes-populate-sdk: -``populate_sdk.bbclass`` -======================== +``populate_sdk`` +================ -The :ref:`populate_sdk ` class provides support for SDK-only recipes. For +The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For information on advantages gained when building a cross-development toolchain using the :ref:`ref-tasks-populate_sdk` task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`" @@ -2207,10 +2194,10 @@ Software Development Kit (eSDK) manual. .. _ref-classes-populate-sdk-*: -``populate_sdk_*.bbclass`` -========================== +``populate_sdk_*`` +================== -The :ref:`populate_sdk_* ` classes support SDK creation and consist of the +The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the following classes: - :ref:`populate_sdk_base `: The base class supporting SDK creation under @@ -2264,10 +2251,10 @@ Software Development Kit (eSDK) manual. .. _ref-classes-prexport: -``prexport.bbclass`` -==================== +``prexport`` +============ -The :ref:`prexport ` class provides functionality for exporting +The :ref:`ref-classes-prexport` class provides functionality for exporting :term:`PR` values. .. note:: @@ -2277,10 +2264,10 @@ The :ref:`prexport ` class provides functionality for expo .. _ref-classes-primport: -``primport.bbclass`` -==================== +``primport`` +============ -The :ref:`primport ` class provides functionality for importing +The :ref:`ref-classes-primport` class provides functionality for importing :term:`PR` values. .. note:: @@ -2290,69 +2277,69 @@ The :ref:`primport ` class provides functionality for impo .. _ref-classes-prserv: -``prserv.bbclass`` -================== +``prserv`` +========== -The :ref:`prserv ` class provides functionality for using a :ref:`PR -service ` in order to +The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR +service ` in order to automatically manage the incrementing of the :term:`PR` variable for each recipe. This class is enabled by default because it is inherited by the -:ref:`package ` class. However, the OpenEmbedded +:ref:`ref-classes-package` class. However, the OpenEmbedded build system will not enable the functionality of this class unless :term:`PRSERV_HOST` has been set. .. _ref-classes-ptest: -``ptest.bbclass`` -================= +``ptest`` +========= -The :ref:`ptest ` class provides functionality for packaging and installing +The :ref:`ref-classes-ptest` class provides functionality for packaging and installing runtime tests for recipes that build software that provides these tests. This class is intended to be inherited by individual recipes. However, the class' functionality is largely disabled unless "ptest" appears in :term:`DISTRO_FEATURES`. See the -":ref:`dev-manual/common-tasks:testing packages with ptest`" +":ref:`dev-manual/packages:testing packages with ptest`" section in the Yocto Project Development Tasks Manual for more information on ptest. .. _ref-classes-ptest-gnome: -``ptest-gnome.bbclass`` -======================= +``ptest-gnome`` +=============== Enables package tests (ptests) specifically for GNOME packages, which have tests intended to be executed with ``gnome-desktop-testing``. For information on setting up and running ptests, see the -":ref:`dev-manual/common-tasks:testing packages with ptest`" +":ref:`dev-manual/packages:testing packages with ptest`" section in the Yocto Project Development Tasks Manual. .. _ref-classes-python3-dir: -``python3-dir.bbclass`` -======================= +``python3-dir`` +=============== -The :ref:`python3-dir ` class provides the base version, location, and site +The :ref:`ref-classes-python3-dir` class provides the base version, location, and site package location for Python 3. .. _ref-classes-python3native: -``python3native.bbclass`` -========================= +``python3native`` +================= -The :ref:`python3native ` class supports using the native version of Python +The :ref:`ref-classes-python3native` class supports using the native version of Python 3 built by the build system rather than support of the version provided by the build host. .. _ref-classes-python3targetconfig: -``python3targetconfig.bbclass`` -=============================== +``python3targetconfig`` +======================= -The :ref:`python3targetconfig ` class supports using the native version of Python +The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python 3 built by the build system rather than support of the version provided by the build host, except that the configuration for the target machine is accessible (such as correct installation directories). This also adds a @@ -2361,41 +2348,40 @@ in order to avoid unnecessarily lengthening builds. .. _ref-classes-qemu: -``qemu.bbclass`` -================ +``qemu`` +======== -The :ref:`qemu ` class provides functionality for recipes that either need +The :ref:`ref-classes-qemu` class provides functionality for recipes that either need QEMU or test for the existence of QEMU. Typically, this class is used to run programs for a target system on the build host using QEMU's application emulation mode. .. _ref-classes-recipe_sanity: -``recipe_sanity.bbclass`` -========================= +``recipe_sanity`` +================= -The :ref:`recipe_sanity ` class checks for the presence of any host system +The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system recipe prerequisites that might affect the build (e.g. variables that are set or software that is present). .. _ref-classes-relocatable: -``relocatable.bbclass`` -======================= +``relocatable`` +=============== -The :ref:`relocatable ` class enables relocation of binaries when they are +The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are installed into the sysroot. -This class makes use of the :ref:`chrpath ` class -and is used by both the :ref:`cross ` and -:ref:`native ` classes. +This class makes use of the :ref:`ref-classes-chrpath` class and is used by +both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes. .. _ref-classes-remove-libtool: -``remove-libtool.bbclass`` -========================== +``remove-libtool`` +================== -The :ref:`remove-libtool ` class adds a post function to the +The :ref:`ref-classes-remove-libtool` class adds a post function to the :ref:`ref-tasks-install` task to remove all ``.la`` files installed by ``libtool``. Removing these files results in them being absent from both the sysroot and target packages. @@ -2407,15 +2393,15 @@ override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows:: .. note:: - The :ref:`remove-libtool ` class is not enabled by default. + The :ref:`ref-classes-remove-libtool` class is not enabled by default. .. _ref-classes-report-error: -``report-error.bbclass`` -======================== +``report-error`` +================ -The :ref:`report-error ` class supports enabling the :ref:`error reporting -tool `", +The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting +tool `", which allows you to submit build error information to a central database. The class collects debug information for recipe, recipe version, task, @@ -2426,10 +2412,10 @@ are created and stored in .. _ref-classes-rm-work: -``rm_work.bbclass`` -=================== +``rm_work`` +=========== -The :ref:`rm_work ` class supports deletion of temporary workspace, which +The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which can ease your hard drive demands during builds. The OpenEmbedded build system can use a substantial amount of disk space @@ -2438,28 +2424,27 @@ under the ``${TMPDIR}/work`` directory for each recipe. Once the build system generates the packages for a recipe, the work files for that recipe are no longer needed. However, by default, the build system preserves these files for inspection and possible debugging purposes. If -you would rather have these files deleted to save disk space as the -build progresses, you can enable :ref:`rm_work ` by adding the following to +you would rather have these files deleted to save disk space as the build +progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to your ``local.conf`` file, which is found in the :term:`Build Directory`:: INHERIT += "rm_work" -If you are -modifying and building source code out of the work directory for a -recipe, enabling :ref:`rm_work ` will potentially result in your changes to -the source being lost. To exclude some recipes from having their work -directories deleted by :ref:`rm_work `, you can add the names of the recipe -or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable, which -can also be set in your ``local.conf`` file. Here is an example:: +If you are modifying and building source code out of the work directory for a +recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your +changes to the source being lost. To exclude some recipes from having their work +directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the +recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable, +which can also be set in your ``local.conf`` file. Here is an example:: RM_WORK_EXCLUDE += "busybox glibc" .. _ref-classes-rootfs*: -``rootfs*.bbclass`` -=================== +``rootfs*`` +=========== -The :ref:`rootfs* ` classes support creating the root filesystem for an +The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an image and consist of the following classes: - The :ref:`rootfs-postcommands ` class, which defines filesystem @@ -2478,8 +2463,8 @@ image and consist of the following classes: on the build host directly into the root filesystem. The root filesystem is created from packages using one of the -:ref:`rootfs*.bbclass ` files as determined by the -:term:`PACKAGE_CLASSES` variable. +:ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES` +variable. For information on how root filesystem images are created, see the ":ref:`overview-manual/concepts:image generation`" @@ -2487,10 +2472,10 @@ section in the Yocto Project Overview and Concepts Manual. .. _ref-classes-sanity: -``sanity.bbclass`` -================== +``sanity`` +========== -The :ref:`sanity ` class checks to see if prerequisite software is present +The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present on the host system so that users can be notified of potential problems that might affect their build. The class also performs basic user configuration checks from the ``local.conf`` configuration file to @@ -2499,29 +2484,29 @@ usually determines whether to include this class. .. _ref-classes-scons: -``scons.bbclass`` -================= +``scons`` +========= -The :ref:`scons ` class supports recipes that need to build software that -uses the SCons build system. You can use the -:term:`EXTRA_OESCONS` variable to specify -additional configuration options you want to pass SCons command line. +The :ref:`ref-classes-scons` class supports recipes that need to build software +that uses the SCons build system. You can use the :term:`EXTRA_OESCONS` +variable to specify additional configuration options you want to pass SCons +command line. .. _ref-classes-sdl: -``sdl.bbclass`` -=============== +``sdl`` +======= -The :ref:`sdl ` class supports recipes that need to build software that uses +The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses the Simple DirectMedia Layer (SDL) library. .. _ref-classes-python_setuptools_build_meta: -``python_setuptools_build_meta.bbclass`` -======================================== +``python_setuptools_build_meta`` +================================ -The :ref:`python_setuptools_build_meta ` class enables building Python modules which -declare the +The :ref:`ref-classes-python_setuptools_build_meta` class enables building +Python modules which declare the `PEP-517 `__ compliant ``setuptools.build_meta`` ``build-backend`` in the ``[build-system]`` section of ``pyproject.toml`` (See `PEP-518 `__). @@ -2529,21 +2514,22 @@ section of ``pyproject.toml`` (See `PEP-518 ` class. +Internally this uses the :ref:`ref-classes-python_pep517` class. .. _ref-classes-setuptools3: -``setuptools3.bbclass`` -======================= +``setuptools3`` +=============== -The :ref:`setuptools3 ` class supports Python version 3.x extensions that -use build systems based on ``setuptools`` (e.g. only have a ``setup.py`` and -have not migrated to the official ``pyproject.toml`` format). If your recipe -uses these build systems, the recipe needs to inherit the :ref:`setuptools3 ` class. +The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions +that use build systems based on ``setuptools`` (e.g. only have a ``setup.py`` +and have not migrated to the official ``pyproject.toml`` format). If your recipe +uses these build systems, the recipe needs to inherit the +:ref:`ref-classes-setuptools3` class. .. note:: - The :ref:`setuptools3 ` class :ref:`ref-tasks-compile` task now calls + The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format (See `PEP-427 `__). @@ -2554,69 +2540,61 @@ uses these build systems, the recipe needs to inherit the :ref:`setuptools3 ` class :ref:`ref-tasks-install` task now installs the ``wheel`` - binary archive. In current versions of ``setuptools`` the legacy ``setup.py - install`` method is deprecated. If the ``setup.py`` cannot be used with - wheels, for example it creates files outside of the Python module or - standard entry points, then :ref:`setuptools3_legacy - ` should be used. + The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now + installs the ``wheel`` binary archive. In current versions of + ``setuptools`` the legacy ``setup.py install`` method is deprecated. If + the ``setup.py`` cannot be used with wheels, for example it creates files + outside of the Python module or standard entry points, then + :ref:`ref-classes-setuptools3_legacy` should be used. .. _ref-classes-setuptools3_legacy: -``setuptools3_legacy.bbclass`` -============================== +``setuptools3_legacy`` +====================== -The :ref:`setuptools3_legacy ` class supports Python version 3.x extensions that use -build systems based on ``setuptools`` (e.g. only have a ``setup.py`` and have -not migrated to the official ``pyproject.toml`` format). Unlike -``setuptools3.bbclass``, this uses the traditional ``setup.py`` ``build`` and -``install`` commands and not wheels. This use of ``setuptools`` like this is +The :ref:`ref-classes-setuptools3_legacy` class supports +Python version 3.x extensions that use build systems based on ``setuptools`` +(e.g. only have a ``setup.py`` and have not migrated to the official +``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`, +this uses the traditional ``setup.py`` ``build`` and ``install`` commands and +not wheels. This use of ``setuptools`` like this is `deprecated `__ but still relatively common. .. _ref-classes-setuptools3-base: -``setuptools3-base.bbclass`` -============================ - -The :ref:`setuptools3-base ` class provides a reusable base for other classes -that support building Python version 3.x extensions. If you need -functionality that is not provided by the :ref:`setuptools3 ` class, you may -want to ``inherit setuptools3-base``. Some recipes do not need the tasks -in the :ref:`setuptools3 ` class and inherit this class instead. - -.. _ref-classes-sign_rpm: - -``sign_rpm.bbclass`` +``setuptools3-base`` ==================== -The :ref:`sign_rpm ` class supports generating signed RPM packages. +The :ref:`ref-classes-setuptools3-base` class provides a reusable base for +other classes that support building Python version 3.x extensions. If you need +functionality that is not provided by the :ref:`ref-classes-setuptools3` class, +you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks +in the :ref:`ref-classes-setuptools3` class and inherit this class instead. -.. _ref-classes-sip: +.. _ref-classes-sign_rpm: -``sip.bbclass`` -=============== +``sign_rpm`` +============ -The :ref:`sip ` class supports recipes that build or package SIP-based -Python bindings. +The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages. .. _ref-classes-siteconfig: -``siteconfig.bbclass`` -====================== +``siteconfig`` +============== -The :ref:`siteconfig ` class provides functionality for handling site -configuration. The class is used by the -:ref:`autotools ` class to accelerate the -:ref:`ref-tasks-configure` task. +The :ref:`ref-classes-siteconfig` class provides functionality for handling site +configuration. The class is used by the :ref:`ref-classes-autotools` class to +accelerate the :ref:`ref-tasks-configure` task. .. _ref-classes-siteinfo: -``siteinfo.bbclass`` -==================== +``siteinfo`` +============ -The :ref:`siteinfo ` class provides information about the targets that might -be needed by other classes or recipes. +The :ref:`ref-classes-siteinfo` class provides information about the targets +that might be needed by other classes or recipes. As an example, consider Autotools, which can require tests that must execute on the target hardware. Since this is not possible in general @@ -2633,12 +2611,12 @@ The class also provides variables like :term:`SITEINFO_ENDIANNESS` and .. _ref-classes-sstate: -``sstate.bbclass`` -================== +``sstate`` +========== -The :ref:`sstate ` class provides support for Shared State (sstate). By -default, the class is enabled through the -:term:`INHERIT_DISTRO` variable's default value. +The :ref:`ref-classes-sstate` class provides support for Shared State (sstate). +By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's +default value. For more information on sstate, see the ":ref:`overview-manual/concepts:shared state cache`" @@ -2646,10 +2624,10 @@ section in the Yocto Project Overview and Concepts Manual. .. _ref-classes-staging: -``staging.bbclass`` -=================== +``staging`` +=========== -The :ref:`staging ` class installs files into individual recipe work +The :ref:`ref-classes-staging` class installs files into individual recipe work directories for sysroots. The class contains the following key tasks: - The :ref:`ref-tasks-populate_sysroot` task, @@ -2662,8 +2640,8 @@ directories for sysroots. The class contains the following key tasks: installs the files into the individual recipe work directories (i.e. :term:`WORKDIR`). -The code in the :ref:`staging ` class is complex and basically works in two -stages: +The code in the :ref:`ref-classes-staging` class is complex and basically works +in two stages: - *Stage One:* The first stage addresses recipes that have files they want to share with other recipes that have dependencies on the @@ -2736,8 +2714,7 @@ stages: dependencies traversed or installed. The same sstate dependency code is used so that builds should be identical regardless of whether sstate was used or not. For a closer look, see the - ``setscene_depvalid()`` function in the - :ref:`sstate ` class. + ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class. The build system is careful to maintain manifests of the files it installs so that any given dependency can be installed as needed. The @@ -2746,11 +2723,11 @@ stages: .. _ref-classes-syslinux: -``syslinux.bbclass`` -==================== +``syslinux`` +============ -The :ref:`syslinux ` class provides syslinux-specific functions for building -bootable images. +The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for +building bootable images. The class supports the following variables: @@ -2789,11 +2766,11 @@ The class supports the following variables: .. _ref-classes-systemd: -``systemd.bbclass`` -=================== +``systemd`` +=========== -The :ref:`systemd ` class provides support for recipes that install systemd -unit files. +The :ref:`ref-classes-systemd` class provides support for recipes that install +systemd unit files. The functionality for this class is disabled unless you have "systemd" in :term:`DISTRO_FEATURES`. @@ -2818,27 +2795,27 @@ Services are set up to start on boot automatically unless you have set :term:`SYSTEMD_AUTO_ENABLE` to "disable". -For more information on :ref:`systemd `, see the -":ref:`dev-manual/common-tasks:selecting an initialization manager`" +For more information on :ref:`ref-classes-systemd`, see the +":ref:`dev-manual/init-manager:selecting an initialization manager`" section in the Yocto Project Development Tasks Manual. .. _ref-classes-systemd-boot: -``systemd-boot.bbclass`` -======================== +``systemd-boot`` +================ -The :ref:`systemd-boot ` class provides functions specific to the +The :ref:`ref-classes-systemd-boot` class provides functions specific to the systemd-boot bootloader for building bootable images. This is an internal class and is not intended to be used directly. .. note:: - The :ref:`systemd-boot ` class is a result from merging the ``gummiboot`` class + The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class used in previous Yocto Project releases with the ``systemd`` project. -Set the :term:`EFI_PROVIDER` variable to -":ref:`systemd-boot `" to use this class. Doing so creates a standalone EFI -bootloader that is not dependent on systemd. +Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to +use this class. Doing so creates a standalone EFI bootloader that is not +dependent on systemd. For information on more variables used and supported in this class, see the :term:`SYSTEMD_BOOT_CFG`, @@ -2851,27 +2828,25 @@ for more information. .. _ref-classes-terminal: -``terminal.bbclass`` -==================== +``terminal`` +============ -The :ref:`terminal ` class provides support for starting a terminal session. -The :term:`OE_TERMINAL` variable controls which -terminal emulator is used for the session. +The :ref:`ref-classes-terminal` class provides support for starting a terminal +session. The :term:`OE_TERMINAL` variable controls which terminal emulator is +used for the session. -Other classes use the :ref:`terminal ` class anywhere a separate terminal -session needs to be started. For example, the -:ref:`patch ` class assuming -:term:`PATCHRESOLVE` is set to "user", the -:ref:`cml1 ` class, and the -:ref:`devshell ` class all use the :ref:`terminal ` -class. +Other classes use the :ref:`ref-classes-terminal` class anywhere a separate +terminal session needs to be started. For example, the :ref:`ref-classes-patch` +class assuming :term:`PATCHRESOLVE` is set to "user", the +:ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all +use the :ref:`ref-classes-terminal` class. .. _ref-classes-testimage: -``testimage.bbclass`` -===================== +``testimage`` +============= -The :ref:`testimage ` class supports running automated tests against +The :ref:`ref-classes-testimage` class supports running automated tests against images using QEMU and on actual hardware. The classes handle loading the tests and starting the image. To use the classes, you need to perform steps to set up the environment. @@ -2883,7 +2858,7 @@ To enable this class, add the following to your configuration:: The tests are commands that run on the target system over ``ssh``. Each test is written in Python and makes use of the ``unittest`` module. -The :ref:`testimage ` class runs tests on an image when called using the +The :ref:`ref-classes-testimage` class runs tests on an image when called using the following:: $ bitbake -c testimage image @@ -2894,16 +2869,16 @@ after it is built, you can set :term:`TESTIMAGE_AUTO`:: TESTIMAGE_AUTO = "1" For information on how to enable, run, and create new tests, see the -":ref:`dev-manual/common-tasks:performing automated runtime testing`" +":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual. .. _ref-classes-testsdk: -``testsdk.bbclass`` -=================== +``testsdk`` +=========== This class supports running automated tests against software development -kits (SDKs). The :ref:`testsdk ` class runs tests on an SDK when called +kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called using the following:: $ bitbake -c testsdk image @@ -2911,13 +2886,13 @@ using the following:: .. note:: Best practices include using :term:`IMAGE_CLASSES` rather than - :term:`INHERIT` to inherit the :ref:`testsdk ` class for automated SDK + :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK testing. .. _ref-classes-texinfo: -``texinfo.bbclass`` -=================== +``texinfo`` +=========== This class should be inherited by recipes whose upstream packages invoke the ``texinfo`` utilities at build-time. Native and cross recipes are @@ -2934,10 +2909,10 @@ host system. .. _ref-classes-toaster: -``toaster.bbclass`` -=================== +``toaster`` +=========== -The :ref:`toaster ` class collects information about packages and images and +The :ref:`ref-classes-toaster` class collects information about packages and images and sends them as events that the BitBake user interface can receive. The class is enabled when the Toaster user interface is running. @@ -2945,18 +2920,18 @@ This class is not intended to be used directly. .. _ref-classes-toolchain-scripts: -``toolchain-scripts.bbclass`` -============================= +``toolchain-scripts`` +===================== -The :ref:`toolchain-scripts ` class provides the scripts used for setting up +The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up the environment for installed SDKs. .. _ref-classes-typecheck: -``typecheck.bbclass`` -===================== +``typecheck`` +============= -The :ref:`typecheck ` class provides support for validating the values of +The :ref:`ref-classes-typecheck` class provides support for validating the values of variables set at the configuration level against their defined types. The OpenEmbedded build system allows you to define the type of a variable using the "type" varflag. Here is an example:: @@ -2965,10 +2940,10 @@ variable using the "type" varflag. Here is an example:: .. _ref-classes-uboot-config: -``uboot-config.bbclass`` -======================== +``uboot-config`` +================ -The :ref:`uboot-config ` class provides support for U-Boot configuration for +The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for a machine. Specify the machine in your recipe as follows:: UBOOT_CONFIG ??= @@ -2983,8 +2958,8 @@ information. .. _ref-classes-uninative: -``uninative.bbclass`` -===================== +``uninative`` +============= Attempts to isolate the build system from the host distribution's C library in order to make re-use of native shared state artifacts across @@ -2999,21 +2974,21 @@ yourself, publish the resulting tarball (e.g. via HTTP) and set ``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an example, see the ``meta/conf/distro/include/yocto-uninative.inc``. -The :ref:`uninative ` class is also used unconditionally by the extensible +The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible SDK. When building the extensible SDK, ``uninative-tarball`` is built and the resulting tarball is included within the SDK. .. _ref-classes-update-alternatives: -``update-alternatives.bbclass`` -=============================== +``update-alternatives`` +======================= -The :ref:`update-alternatives ` class helps the alternatives system when +The :ref:`ref-classes-update-alternatives` class helps the alternatives system when multiple sources provide the same command. This situation occurs when several programs that have the same or similar function are installed with the same name. For example, the ``ar`` command is available from the ``busybox``, ``binutils`` and ``elfutils`` packages. The -:ref:`update-alternatives ` class handles renaming the binaries so that +:ref:`ref-classes-update-alternatives` class handles renaming the binaries so that multiple packages can be installed without conflicts. The ``ar`` command still works regardless of which packages are installed or subsequently removed. The class renames the conflicting binary in each package and @@ -3043,10 +3018,10 @@ file. .. _ref-classes-update-rc.d: -``update-rc.d.bbclass`` -======================= +``update-rc.d`` +=============== -The :ref:`update-rc.d ` class uses ``update-rc.d`` to safely install an +The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an initialization script on behalf of the package. The OpenEmbedded build system takes care of details such as making sure the script is stopped before a package is removed and started when the package is installed. @@ -3057,8 +3032,8 @@ for details. .. _ref-classes-useradd: -``useradd*.bbclass`` -==================== +``useradd*`` +============ The :ref:`useradd* ` classes support the addition of users or groups for usage by the package on the target. For example, if you have packages @@ -3094,13 +3069,11 @@ set static values, the OpenEmbedded build system looks in :term:`BBPATH` for ``files/passwd`` and ``files/group`` files for the values. -To use static ``uid`` and ``gid`` values, you need to set some -variables. See the :term:`USERADDEXTENSION`, -:term:`USERADD_UID_TABLES`, -:term:`USERADD_GID_TABLES`, and -:term:`USERADD_ERROR_DYNAMIC` variables. -You can also see the :ref:`useradd ` class for -additional information. +To use static ``uid`` and ``gid`` values, you need to set some variables. See +the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`, +:term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables. +You can also see the :ref:`ref-classes-useradd` class for additional +information. .. note:: @@ -3112,43 +3085,42 @@ additional information. .. _ref-classes-utility-tasks: -``utility-tasks.bbclass`` -========================= +``utility-tasks`` +================= -The :ref:`utility-tasks ` class provides support for various "utility" type -tasks that are applicable to all recipes, such as -:ref:`ref-tasks-clean` and -:ref:`ref-tasks-listtasks`. +The :ref:`ref-classes-utility-tasks` class provides support for various +"utility" type tasks that are applicable to all recipes, such as +:ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`. This class is enabled by default because it is inherited by the -:ref:`base ` class. +:ref:`ref-classes-base` class. .. _ref-classes-utils: -``utils.bbclass`` -================= +``utils`` +========= -The :ref:`utils ` class provides some useful Python functions that are +The :ref:`ref-classes-utils` class provides some useful Python functions that are typically used in inline Python expressions (e.g. ``${@...}``). One example use is for ``bb.utils.contains()``. This class is enabled by default because it is inherited by the -:ref:`base ` class. +:ref:`ref-classes-base` class. .. _ref-classes-vala: -``vala.bbclass`` -================ +``vala`` +======== -The :ref:`vala ` class supports recipes that need to build software written +The :ref:`ref-classes-vala` class supports recipes that need to build software written using the Vala programming language. .. _ref-classes-waf: -``waf.bbclass`` -=============== +``waf`` +======= -The :ref:`waf ` class supports recipes that need to build software that uses +The :ref:`ref-classes-waf` class supports recipes that need to build software that uses the Waf build system. You can use the :term:`EXTRA_OECONF` or :term:`PACKAGECONFIG_CONFARGS` variables diff --git a/poky/documentation/ref-manual/devtool-reference.rst b/poky/documentation/ref-manual/devtool-reference.rst index 997ec0351c..6aa09f6d6f 100644 --- a/poky/documentation/ref-manual/devtool-reference.rst +++ b/poky/documentation/ref-manual/devtool-reference.rst @@ -385,9 +385,7 @@ want to use it because the dependency on ``cdebconf`` is not easily satisfied. Maintainers can explicit the reason that is shown by adding the :term:`RECIPE_NO_UPDATE_REASON` variable to the corresponding recipe. See :yocto_git:`base-passwd.bb ` -for an example. - -:: +for an example:: $ devtool check-upgrade-status ... @@ -410,7 +408,7 @@ Upgrading a Recipe As software matures, upstream recipes are upgraded to newer versions. As a developer, you need to keep your local recipes up-to-date with the upstream version releases. There are several ways of upgrading recipes. -You can read about them in the ":ref:`dev-manual/common-tasks:upgrading recipes`" +You can read about them in the ":ref:`dev-manual/upgrading-recipes:upgrading recipes`" section of the Yocto Project Development Tasks Manual. This section overviews the ``devtool upgrade`` command. @@ -438,7 +436,7 @@ You can read more on the ``devtool upgrade`` workflow in the ":ref:`sdk-manual/extensible:use \`\`devtool upgrade\`\` to create a version of the recipe that supports a newer version of the software`" section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual. You can also see an example of -how to use ``devtool upgrade`` in the ":ref:`dev-manual/common-tasks:using \`\`devtool upgrade\`\``" +how to use ``devtool upgrade`` in the ":ref:`dev-manual/upgrading-recipes:using \`\`devtool upgrade\`\``" section in the Yocto Project Development Tasks Manual. .. _devtool-resetting-a-recipe: @@ -555,8 +553,7 @@ Use the ``devtool undeploy-target`` command to remove deployed build output from the target machine. For the ``devtool undeploy-target`` command to work, you must have previously used the ":ref:`devtool deploy-target `" -command. -:: +command:: $ devtool undeploy-target recipe target diff --git a/poky/documentation/ref-manual/faq.rst b/poky/documentation/ref-manual/faq.rst index d35ab78bff..a3a15506c3 100644 --- a/poky/documentation/ref-manual/faq.rst +++ b/poky/documentation/ref-manual/faq.rst @@ -168,23 +168,8 @@ Using the OpenEmbedded Build system How do I use an external toolchain? ----------------------------------- -The toolchain configuration is very flexible and customizable. It -is primarily controlled with the :term:`TCMODE` variable. This variable -controls which ``tcmode-*.inc`` file to include from the -``meta/conf/distro/include`` directory within the :term:`Source Directory`. - -The default value of :term:`TCMODE` is "default", which tells the -OpenEmbedded build system to use its internally built toolchain (i.e. -``tcmode-default.inc``). However, other patterns are accepted. In -particular, "external-\*" refers to external toolchains. One example is -the Sourcery G++ Toolchain. The support for this toolchain resides in -the separate ``meta-sourcery`` layer at -https://github.com/MentorEmbedded/meta-sourcery/. - -In addition to the toolchain configuration, you also need a -corresponding toolchain recipe file. This recipe file needs to package -up any pre-built objects in the toolchain such as ``libgcc``, -``libstdcc++``, any locales, and ``libc``. +See the ":ref:`dev-manual/external-toolchain:optionally using an external toolchain`" +section in the Development Task manual. Why do I get chmod permission issues? ------------------------------------- @@ -291,7 +276,7 @@ How do I make the Yocto Project support my board? Support for an additional board is added by creating a Board Support Package (BSP) layer for it. For more information on how to create a BSP layer, see the -":ref:`dev-manual/common-tasks:understanding and creating layers`" +":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual and the :doc:`/bsp-guide/index`. @@ -303,7 +288,7 @@ How do I make the Yocto Project support my package? To add a package, you need to create a BitBake recipe. For information on how to create a BitBake recipe, see the -":ref:`dev-manual/common-tasks:writing a new recipe`" +":ref:`dev-manual/new-recipe:writing a new recipe`" section in the Yocto Project Development Tasks Manual. What do I need to ship for license compliance? @@ -320,7 +305,7 @@ configured and built. You can find more information on licensing in the ":ref:`overview-manual/development-environment:licensing`" section in the Yocto Project Overview and Concepts Manual and also in the -":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`" +":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`" section in the Yocto Project Development Tasks Manual. Do I have to make a full reflash after recompiling one package? diff --git a/poky/documentation/ref-manual/features.rst b/poky/documentation/ref-manual/features.rst index 71d3c5e2aa..794a6fd15b 100644 --- a/poky/documentation/ref-manual/features.rst +++ b/poky/documentation/ref-manual/features.rst @@ -143,7 +143,7 @@ metadata, as extra layers can define their own: - *cramfs:* Include CramFS support. - *debuginfod:* Include support for getting ELF debugging information through - a :ref:`debuginfod ` + a :ref:`debuginfod ` server. - *directfb:* Include DirectFB support. @@ -202,7 +202,7 @@ metadata, as extra layers can define their own: - *ptest:* Enables building the package tests where supported by individual recipes. For more information on package tests, see the - ":ref:`dev-manual/common-tasks:testing packages with ptest`" section + ":ref:`dev-manual/packages:testing packages with ptest`" section in the Yocto Project Development Tasks Manual. - *pulseaudio:* Include support for @@ -325,7 +325,7 @@ Here are the image features available for all images: - *read-only-rootfs:* Creates an image whose root filesystem is read-only. See the - ":ref:`dev-manual/common-tasks:creating a read-only root filesystem`" + ":ref:`dev-manual/read-only-rootfs:creating a read-only root filesystem`" section in the Yocto Project Development Tasks Manual for more information. @@ -358,7 +358,7 @@ Here are the image features available for all images: a given image. Some image features are available only when you inherit the -:ref:`core-image ` class. The current list of +:ref:`ref-classes-core-image` class. The current list of these valid features is as follows: - *hwcodecs:* Installs hardware acceleration codecs. @@ -394,7 +394,7 @@ these valid features is as follows: - *tools-debug:* Installs debugging tools such as ``strace`` and ``gdb``. For information on GDB, see the - ":ref:`dev-manual/common-tasks:debugging with the gnu project debugger (gdb) remotely`" section + ":ref:`dev-manual/debugging:debugging with the gnu project debugger (gdb) remotely`" section in the Yocto Project Development Tasks Manual. For information on tracing and profiling, see the :doc:`/profile-manual/index`. diff --git a/poky/documentation/ref-manual/images.rst b/poky/documentation/ref-manual/images.rst index 4b771d0601..d3aeb0829f 100644 --- a/poky/documentation/ref-manual/images.rst +++ b/poky/documentation/ref-manual/images.rst @@ -18,11 +18,11 @@ image you want. are going to build an image using non-GPLv3 and similarly licensed components, you must make the following changes in the ``local.conf`` file before using the BitBake command to build the minimal or base - image:: + image: - 1. Comment out the EXTRA_IMAGE_FEATURES line - 2. Set INCOMPATIBLE_LICENSE = "GPL-3.0* LGPL-3.0* AGPL-3.0*" + #. Comment out the :term:`EXTRA_IMAGE_FEATURES` line + #. Set :term:`INCOMPATIBLE_LICENSE` to "GPL-3.0* LGPL-3.0* AGPL-3.0*" From within the ``poky`` Git repository, you can use the following command to display the list of directories within the :term:`Source Directory` @@ -117,7 +117,7 @@ Following is a list of supported recipes: deployed to a separate partition so that you can boot into it and use it to deploy a second image to be tested. You can find more information about runtime testing in the - ":ref:`dev-manual/common-tasks:performing automated runtime testing`" + ":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual. - ``core-image-testmaster-initramfs``: A RAM-based Initial Root @@ -127,7 +127,7 @@ Following is a list of supported recipes: - ``core-image-weston``: A very basic Wayland image with a terminal. This image provides the Wayland protocol libraries and the reference Weston compositor. For more information, see the - ":ref:`dev-manual/common-tasks:using wayland and weston`" + ":ref:`dev-manual/wayland:using wayland and weston`" section in the Yocto Project Development Tasks Manual. - ``core-image-x11``: A very basic X11 image with a terminal. diff --git a/poky/documentation/ref-manual/kickstart.rst b/poky/documentation/ref-manual/kickstart.rst index 11bc373b3c..297887805c 100644 --- a/poky/documentation/ref-manual/kickstart.rst +++ b/poky/documentation/ref-manual/kickstart.rst @@ -82,7 +82,7 @@ the ``part`` and ``partition`` commands: source of the data that populates the partition. The most common value for this option is "rootfs", but you can use any value that maps to a valid source plugin. For information on the source plugins, - see the ":ref:`dev-manual/common-tasks:using the wic plugin interface`" + see the ":ref:`dev-manual/wic:using the wic plugin interface`" section in the Yocto Project Development Tasks Manual. If you use ``--source rootfs``, Wic creates a partition as large as diff --git a/poky/documentation/ref-manual/qa-checks.rst b/poky/documentation/ref-manual/qa-checks.rst index 3947dcfc17..13096816d2 100644 --- a/poky/documentation/ref-manual/qa-checks.rst +++ b/poky/documentation/ref-manual/qa-checks.rst @@ -579,10 +579,10 @@ Errors and Warnings - ``package contains mime types but does not inherit mime: path '' [mime]`` The specified package contains mime type files (``.xml`` files in - ``${datadir}/mime/packages``) and yet does not inherit the mime - class which will ensure that these get properly installed. Either - add ``inherit mime`` to the recipe or remove the files at the - :ref:`ref-tasks-install` step if they are not needed. + ``${datadir}/mime/packages``) and yet does not inherit the + :ref:`ref-classes-mime` class which will ensure that these get + properly installed. Either add ``inherit mime`` to the recipe or remove the + files at the :ref:`ref-tasks-install` step if they are not needed. .. _qa-check-mime-xdg: @@ -590,7 +590,7 @@ Errors and Warnings - ``package contains desktop file with key 'MimeType' but does not inhert mime-xdg: path '' [mime-xdg]`` The specified package contains a .desktop file with a 'MimeType' key - present, but does not inherit the :ref:`mime-xdg ` + present, but does not inherit the :ref:`ref-classes-mime-xdg` class that is required in order for that to be activated. Either add ``inherit mime`` to the recipe or remove the files at the :ref:`ref-tasks-install` step if they are not needed. @@ -602,7 +602,7 @@ Errors and Warnings GitHub provides "archive" tarballs, however these can be re-generated on the fly and thus the file's signature will not necessarily match that - in the SRC_URI checksums in future leading to build failures. It is + in the :term:`SRC_URI` checksums in future leading to build failures. It is recommended that you use an official release tarball or switch to pulling the corresponding revision in the actual git repository instead. @@ -620,11 +620,13 @@ Errors and Warnings - ``: recipe doesn't inherit features_check [unhandled-features-check]`` - This check ensures that if one of the variables that the :ref:`features_check ` - class supports (e.g. :term:`REQUIRED_DISTRO_FEATURES`) is used, then the recipe - inherits ``features_check`` in order for the requirement to actually work. If - you are seeing this message, either add ``inherit features_check`` to your recipe - or remove the reference to the variable if it is not needed. + This check ensures that if one of the variables that the + :ref:`ref-classes-features_check` class supports (e.g. + :term:`REQUIRED_DISTRO_FEATURES`) is used, then the recipe + inherits :ref:`ref-classes-features_check` in order for + the requirement to actually work. If you are seeing this message, either + add ``inherit features_check`` to your recipe or remove the reference to + the variable if it is not needed. .. _qa-check-missing-update-alternatives: @@ -632,7 +634,7 @@ Errors and Warnings - ``: recipe defines ALTERNATIVE: but doesn't inherit update-alternatives. This might fail during do_rootfs later! [missing-update-alternatives]`` This check ensures that if a recipe sets the :term:`ALTERNATIVE` variable that the - recipe also inherits :ref:`update-alternatives ` such + recipe also inherits :ref:`ref-classes-update-alternatives` such that the alternative will be correctly set up. If you are seeing this message, either add ``inherit update-alternatives`` to your recipe or remove the reference to the variable if it is not needed. @@ -653,7 +655,7 @@ Errors and Warnings - `` contains perllocal.pod (), should not be installed [perllocalpod]`` ``perllocal.pod`` is an index file of locally installed modules and so shouldn't be - installed by any distribution packages. The :ref:`cpan ` class + installed by any distribution packages. The :ref:`ref-classes-cpan` class already sets ``NO_PERLLOCAL`` to stop this file being generated by most Perl recipes, but if a recipe is using ``MakeMaker`` directly then they might not be doing this correctly. This check ensures that perllocal.pod is not in any package in order to diff --git a/poky/documentation/ref-manual/release-process.rst b/poky/documentation/ref-manual/release-process.rst index c36fa557d8..19e8040638 100644 --- a/poky/documentation/ref-manual/release-process.rst +++ b/poky/documentation/ref-manual/release-process.rst @@ -107,7 +107,7 @@ Additionally, because the test strategies are visible to you as a developer, you can validate your projects. This section overviews the available test infrastructure used in the Yocto Project. For information on how to run available tests on your projects, see the -":ref:`dev-manual/common-tasks:performing automated runtime testing`" +":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual. The QA/testing infrastructure is woven into the project to the point @@ -134,7 +134,7 @@ consists of the following pieces: operation and functions. However, the test can also use the IP address of a machine to test. -- :ref:`ptest `: +- :ref:`ptest `: Runs tests against packages produced during the build for a given piece of software. The test allows the packages to be run within a target image. diff --git a/poky/documentation/ref-manual/resources.rst b/poky/documentation/ref-manual/resources.rst index 292a9d6f61..5a09909c70 100644 --- a/poky/documentation/ref-manual/resources.rst +++ b/poky/documentation/ref-manual/resources.rst @@ -23,7 +23,7 @@ The Yocto Project gladly accepts contributions. You can submit changes to the project either by creating and sending pull requests, or by submitting patches through email. For information on how to do both as well as information on how to identify the maintainer for each area of -code, see the ":ref:`dev-manual/common-tasks:submitting a change to the yocto project`" section in the +code, see the ":ref:`dev-manual/changes:submitting a change to the yocto project`" section in the Yocto Project Development Tasks Manual. .. _resources-bugtracker: @@ -46,7 +46,7 @@ your expectations). For a general procedure and guidelines on how to use Bugzilla to submit a bug against the Yocto Project, see the following: -- The ":ref:`dev-manual/common-tasks:submitting a defect against the yocto project`" +- The ":ref:`dev-manual/changes:submitting a defect against the yocto project`" section in the Yocto Project Development Tasks Manual. - The Yocto Project :yocto_wiki:`Bugzilla wiki page ` @@ -82,8 +82,10 @@ instructions: - :yocto_lists:`/g/yocto-announce` --- mailing list to receive official Yocto Project release and milestone announcements. -For more Yocto Project-related mailing lists, see the -:yocto_home:`Yocto Project Website <>`. +- :yocto_lists:`/g/docs` --- discussion mailing list about the Yocto Project + documentation. + +See also :yocto_home:`the description of all mailing lists `. .. _resources-irc: @@ -104,93 +106,91 @@ Links and Related Documentation Here is a list of resources you might find helpful: -- :yocto_home:`The Yocto Project Website <>`\ *:* The home site +- :yocto_home:`The Yocto Project Website <>`: The home site for the Yocto Project. -- :yocto_wiki:`The Yocto Project Main Wiki Page <>`\ *:* The main wiki page for +- :yocto_wiki:`The Yocto Project Main Wiki Page <>`: The main wiki page for the Yocto Project. This page contains information about project planning, release engineering, QA & automation, a reference site map, and other resources related to the Yocto Project. -- :oe_home:`OpenEmbedded <>`\ *:* The build system used by the +- :oe_home:`OpenEmbedded <>`: The build system used by the Yocto Project. This project is the upstream, generic, embedded distribution from which the Yocto Project derives its build system (Poky) and to which it contributes. -- :oe_wiki:`BitBake `\ *:* The tool used to process metadata. +- :oe_wiki:`BitBake `: The tool used to process metadata. -- :doc:`BitBake User Manual `\ *:* A comprehensive +- :doc:`BitBake User Manual `: A comprehensive guide to the BitBake tool. If you want information on BitBake, see this manual. -- :doc:`/brief-yoctoprojectqs/index` *:* This +- :doc:`/brief-yoctoprojectqs/index`: This short document lets you experience building an image using the Yocto Project without having to understand any concepts or details. -- :doc:`/overview-manual/index` *:* This manual provides overview +- :doc:`/overview-manual/index`: This manual provides overview and conceptual information about the Yocto Project. -- :doc:`/dev-manual/index` *:* This manual is a "how-to" guide +- :doc:`/dev-manual/index`: This manual is a "how-to" guide that presents procedures useful to both application and system developers who use the Yocto Project. -- :doc:`/sdk-manual/index` *manual :* This +- :doc:`/sdk-manual/index` manual: This guide provides information that lets you get going with the standard or extensible SDK. An SDK, with its cross-development toolchains, allows you to develop projects inside or outside of the Yocto Project environment. -- :doc:`/bsp-guide/bsp` *:* This guide defines the structure +- :doc:`/bsp-guide/bsp`: This guide defines the structure for BSP components. Having a commonly understood structure encourages standardization. -- :doc:`/kernel-dev/index` *:* This manual describes +- :doc:`/kernel-dev/index`: This manual describes how to work with Linux Yocto kernels as well as provides a bit of conceptual information on the construction of the Yocto Linux kernel tree. -- :doc:`/ref-manual/index` *:* This +- :doc:`/ref-manual/index`: This manual provides reference material such as variable, task, and class descriptions. -- :yocto_docs:`Yocto Project Mega-Manual `\ *:* This manual +- :yocto_docs:`Yocto Project Mega-Manual `: This manual is simply a single HTML file comprised of the bulk of the Yocto Project manuals. It makes it easy to search for phrases and terms used in the Yocto Project documentation set. -- :doc:`/profile-manual/index` *:* This manual presents a set of +- :doc:`/profile-manual/index`: This manual presents a set of common and generally useful tracing and profiling schemes along with their applications (as appropriate) to each tool. -- :doc:`/toaster-manual/index` *:* This manual +- :doc:`/toaster-manual/index`: This manual introduces and describes how to set up and use Toaster. Toaster is an Application Programming Interface (API) and web-based interface to the :term:`OpenEmbedded Build System`, which uses BitBake, that reports build information. -- :yocto_wiki:`FAQ `\ *:* A list of commonly asked +- :yocto_wiki:`FAQ `: A list of commonly asked questions and their answers. -- *Release Notes:* Features, updates and known issues for the current - release of the Yocto Project. To access the Release Notes, go to the - :yocto_home:`Downloads ` page on - the Yocto Project website and click on the "RELEASE INFORMATION" link - for the appropriate release. +- :yocto_docs:`Release Information `: + Migration guides, release notes, new features, updates and known issues + for the current and past releases of the Yocto Project. -- :yocto_bugs:`Bugzilla <>`\ *:* The bug tracking application +- :yocto_bugs:`Bugzilla <>`: The bug tracking application the Yocto Project uses. If you find problems with the Yocto Project, you should report them using this application. - :yocto_wiki:`Bugzilla Configuration and Bug Tracking Wiki Page - `\ *:* + `: Information on how to get set up and use the Yocto Project implementation of Bugzilla for logging and tracking Yocto Project defects. -- *Internet Relay Chat (IRC):* Two IRC channels on +- Internet Relay Chat (IRC): Two IRC channels on `Libera Chat `__ are available for Yocto Project and OpenEmbeddded discussions: ``#yocto`` and ``#oe``, respectively. -- `Quick EMUlator (QEMU) `__\ *:* An +- `Quick EMUlator (QEMU) `__: An open-source machine emulator and virtualizer. diff --git a/poky/documentation/ref-manual/structure.rst b/poky/documentation/ref-manual/structure.rst index 8b08f88969..e895382eec 100644 --- a/poky/documentation/ref-manual/structure.rst +++ b/poky/documentation/ref-manual/structure.rst @@ -177,7 +177,7 @@ within the :term:`Source Directory`. If you design a custom distribution, you can include your own version of this configuration file to mention the targets defined by your distribution. See the -":ref:`dev-manual/common-tasks:creating a custom template configuration directory`" +":ref:`dev-manual/custom-template-configuration-directory:creating a custom template configuration directory`" section in the Yocto Project Development Tasks Manual for more information. @@ -194,7 +194,7 @@ your choice. For example, the following command creates a The OpenEmbedded build system uses the template configuration files, which are found by default in the ``meta-poky/conf/templates/default`` directory in the Source Directory. See the -":ref:`dev-manual/common-tasks:creating a custom template configuration directory`" +":ref:`dev-manual/custom-template-configuration-directory:creating a custom template configuration directory`" section in the Yocto Project Development Tasks Manual for more information. @@ -233,10 +233,10 @@ is available via the :term:`TOPDIR` variable. ----------------------- The OpenEmbedded build system creates this directory when you enable -build history via the :ref:`buildhistory ` class file. The directory +build history via the :ref:`ref-classes-buildhistory` class file. The directory organizes build information into image, packages, and SDK subdirectories. For information on the build history feature, see the -":ref:`dev-manual/common-tasks:maintaining build output quality`" +":ref:`dev-manual/build-quality:maintaining build output quality`" section in the Yocto Project Development Tasks Manual. .. _structure-build-cache: @@ -303,7 +303,7 @@ file, it uses ``sed`` to substitute final ---------------------------- This configuration file defines -:ref:`layers `, +:ref:`layers `, which are directory trees, traversed (or walked) by BitBake. The ``bblayers.conf`` file uses the :term:`BBLAYERS` variable to list the layers BitBake tries to find. @@ -374,7 +374,8 @@ remove the ``build/sstate-cache`` directory. ``build/tmp/buildstats/`` ~~~~~~~~~~~~~~~~~~~~~~~~~ -This directory stores the build statistics. +This directory stores the build statistics as generated by the +:ref:`ref-classes-buildstats` class. .. _structure-build-tmp-cache: @@ -440,7 +441,7 @@ directory contains sub-directories for ``bash``, ``busybox``, and ``glibc`` (among others) that in turn contain appropriate ``COPYING`` license files with other licensing information. For information on licensing, see the -":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`" +":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`" section in the Yocto Project Development Tasks Manual. .. _structure-build-tmp-deploy-images: @@ -577,7 +578,7 @@ built within the Yocto Project. For this package, a work directory of ``tmp/work/qemux86-poky-linux/linux-yocto/3.0+git1+<.....>``, referred to as the :term:`WORKDIR`, is created. Within this directory, the source is unpacked to ``linux-qemux86-standard-build`` and then patched by Quilt. -(See the ":ref:`dev-manual/common-tasks:using quilt in your workflow`" section in +(See the ":ref:`dev-manual/quilt:using quilt in your workflow`" section in the Yocto Project Development Tasks Manual for more information.) Within the ``linux-qemux86-standard-build`` directory, standard Quilt directories ``linux-3.0/patches`` and ``linux-3.0/.pc`` are created, and diff --git a/poky/documentation/ref-manual/system-requirements.rst b/poky/documentation/ref-manual/system-requirements.rst index 1502633816..3cd0894687 100644 --- a/poky/documentation/ref-manual/system-requirements.rst +++ b/poky/documentation/ref-manual/system-requirements.rst @@ -34,8 +34,7 @@ and conceptual information in the :doc:`/overview-manual/index`. Supported Linux Distributions ============================= -Currently, the Yocto Project is supported on the following -distributions: +Currently, the Yocto Project is supported on the following distributions: - Ubuntu 18.04 (LTS) @@ -71,7 +70,13 @@ distributions: has no plans to support rolling-releases or development distributions due to their constantly changing nature. We welcome patches and bug reports, but keep in mind that our priority is on - the supported platforms listed below. + the supported platforms listed above. + + - If your Linux distribution is not in the above list, we recommend to + get the :term:`buildtools` or :term:`buildtools-extended` tarballs + containing the host tools required by your Yocto Project release, + typically by running ``scripts/install-buildtools`` as explained in + the ":ref:`system-requirements-buildtools`" section. - You may use Windows Subsystem For Linux v2 to set up a build host using Windows 10 or later, or Windows Server 2019 or later, but validation @@ -86,7 +91,7 @@ distributions: interested in hearing about your experience. For information on how to submit a bug, see the Yocto Project :yocto_wiki:`Bugzilla wiki page ` - and the ":ref:`dev-manual/common-tasks:submitting a defect against the yocto project`" + and the ":ref:`dev-manual/changes:submitting a defect against the yocto project`" section in the Yocto Project Development Tasks Manual. @@ -191,6 +196,8 @@ supported AlmaLinux-8 Linux distribution: $ sudo dnf install make python3-pip which inkscape texlive-fncychap &PIP3_HOST_PACKAGES_DOC; +.. _system-requirements-buildtools: + Required Git, tar, Python, make and gcc Versions ================================================ @@ -206,9 +213,9 @@ the following version requirements for Git, tar, and Python: - GNU make &MIN_MAKE_VERSION; or greater If your host development system does not meet all these requirements, -you can resolve this by installing a ``buildtools`` tarball that -contains these tools. You can get the tarball one of two ways: download -a pre-built tarball or use BitBake to build the tarball. +you can resolve this by installing a :term:`buildtools` tarball that +contains these tools. You can either download a pre-built tarball or +use BitBake to build one. In addition, your host development system must meet the following version requirement for gcc: @@ -216,26 +223,26 @@ version requirement for gcc: - gcc &MIN_GCC_VERSION; or greater If your host development system does not meet this requirement, you can -resolve this by installing a ``buildtools-extended`` tarball that +resolve this by installing a :term:`buildtools-extended` tarball that contains additional tools, the equivalent of the Debian/Ubuntu ``build-essential`` package. For systems with a broken make version (e.g. make 4.2.1 without patches) but -where the rest of the host tools are usable, you can use the ``buildtools-make`` +where the rest of the host tools are usable, you can use the :term:`buildtools-make` tarball instead. In the sections that follow, three different methods will be described for -installing the ``buildtools``, ``buildtools-extended`` or ``buildtools-make`` +installing the :term:`buildtools`, :term:`buildtools-extended` or :term:`buildtools-make` toolset. Installing a Pre-Built ``buildtools`` Tarball with ``install-buildtools`` script -------------------------------------------------------------------------------- The ``install-buildtools`` script is the easiest of the three methods by -which you can get these tools. It downloads a pre-built buildtools +which you can get these tools. It downloads a pre-built :term:`buildtools` installer and automatically installs the tools for you: -1. Execute the ``install-buildtools`` script. Here is an example:: +#. Execute the ``install-buildtools`` script. Here is an example:: $ cd poky $ scripts/install-buildtools \ @@ -244,7 +251,7 @@ installer and automatically installs the tools for you: --release yocto-&DISTRO; \ --installer-version &DISTRO; - During execution, the buildtools tarball will be downloaded, the + During execution, the :term:`buildtools` tarball will be downloaded, the checksum of the download will be verified, the installer will be run for you, and some basic checks will be run to make sure the installation is functional. @@ -255,7 +262,7 @@ installer and automatically installs the tools for you: /path/to/poky/buildtools If your host development system needs the additional tools provided - in the ``buildtools-extended`` tarball, you can instead execute the + in the :term:`buildtools-extended` tarball, you can instead execute the ``install-buildtools`` script with the default parameters:: $ cd poky @@ -263,24 +270,21 @@ installer and automatically installs the tools for you: Alternatively if your host development system has a broken ``make`` version such that you only need a known good version of ``make``, - you can use the ``--make-only`` option: + you can use the ``--make-only`` option:: $ cd poky $ scripts/install-buildtools --make-only -2. Source the tools environment setup script by using a command like the +#. Source the tools environment setup script by using a command like the following:: $ source /path/to/poky/buildtools/environment-setup-x86_64-pokysdk-linux - Of course, you need to supply your installation directory and be sure to - use the right file (i.e. i586 or x86_64). - After you have sourced the setup script, the tools are added to ``PATH`` and any other environment variables required to run the tools are initialized. The results are working versions versions of Git, tar, Python and ``chrpath``. And in the case of the - ``buildtools-extended`` tarball, additional working versions of tools + :term:`buildtools-extended` tarball, additional working versions of tools including ``gcc``, ``make`` and the other tools included in ``packagegroup-core-buildessential``. @@ -288,12 +292,14 @@ Downloading a Pre-Built ``buildtools`` Tarball ---------------------------------------------- If you would prefer not to use the ``install-buildtools`` script, you can instead -download and run a pre-built buildtools installer yourself with the following +download and run a pre-built :term:`buildtools` installer yourself with the following steps: -1. Locate and download the ``*.sh`` at :yocto_dl:`/releases/yocto/yocto-&DISTRO;/buildtools/` +#. Go to :yocto_dl:`/releases/yocto/yocto-&DISTRO;/buildtools/`, locate and + download the ``.sh`` file corresponding to your host architecture + and to :term:`buildtools`, :term:`buildtools-extended` or :term:`buildtools-make`. -2. Execute the installation script. Here is an example for the +#. Execute the installation script. Here is an example for the traditional installer:: $ sh ~/Downloads/x86_64-buildtools-nativesdk-standalone-&DISTRO;.sh @@ -310,44 +316,40 @@ steps: installation directory. For example, you could choose the following: ``/home/your-username/buildtools`` -3. Source the tools environment setup script by using a command like the - following:: +#. As instructed by the installer script, you will have to source the tools + environment setup script:: - $ source /home/your_username/buildtools/environment-setup-i586-poky-linux - - Of - course, you need to supply your installation directory and be sure to - use the right file (i.e. i585 or x86-64). + $ source /home/your_username/buildtools/environment-setup-x86_64-pokysdk-linux After you have sourced the setup script, the tools are added to ``PATH`` and any other environment variables required to run the tools are initialized. The results are working versions versions of Git, tar, Python and ``chrpath``. And in the case of the - ``buildtools-extended`` tarball, additional working versions of tools + :term:`buildtools-extended` tarball, additional working versions of tools including ``gcc``, ``make`` and the other tools included in ``packagegroup-core-buildessential``. Building Your Own ``buildtools`` Tarball ---------------------------------------- -Building and running your own buildtools installer applies only when you +Building and running your own :term:`buildtools` installer applies only when you have a build host that can already run BitBake. In this case, you use that machine to build the ``.sh`` file and then take steps to transfer and run it on a machine that does not meet the minimal Git, tar, and Python (or gcc) requirements. -Here are the steps to take to build and run your own buildtools +Here are the steps to take to build and run your own :term:`buildtools` installer: -1. On the machine that is able to run BitBake, be sure you have set up +#. On the machine that is able to run BitBake, be sure you have set up your build environment with the setup script (:ref:`structure-core-script`). -2. Run the BitBake command to build the tarball:: +#. Run the BitBake command to build the tarball:: $ bitbake buildtools-tarball - or run the BitBake command to build the extended tarball:: + or to build the extended tarball:: $ bitbake buildtools-extended-tarball @@ -363,22 +365,21 @@ installer: Once the build completes, you can find the ``.sh`` file that installs the tools in the ``tmp/deploy/sdk`` subdirectory of the :term:`Build Directory`. The installer file has the string - "buildtools" (or "buildtools-extended") in the name. + "buildtools" or "buildtools-extended" in the name. -3. Transfer the ``.sh`` file from the build host to the machine that +#. Transfer the ``.sh`` file from the build host to the machine that does not meet the Git, tar, or Python (or gcc) requirements. -4. On the machine that does not meet the requirements, run the ``.sh`` - file to install the tools. Here is an example for the traditional - installer:: +#. On this machine, run the ``.sh`` file to install the tools. Here is an + example for the traditional installer:: $ sh ~/Downloads/x86_64-buildtools-nativesdk-standalone-&DISTRO;.sh - Here is an example for the extended installer:: + For the extended installer:: $ sh ~/Downloads/x86_64-buildtools-extended-nativesdk-standalone-&DISTRO;.sh - or for the make-only installer:: + And for the make-only installer:: $ sh ~/Downloads/x86_64-buildtools-make-nativesdk-standalone-&DISTRO;.sh @@ -386,18 +387,15 @@ installer: installation directory. For example, you could choose the following: ``/home/your_username/buildtools`` -5. Source the tools environment setup script by using a command like the +#. Source the tools environment setup script by using a command like the following:: $ source /home/your_username/buildtools/environment-setup-x86_64-poky-linux - Of course, you need to supply your installation directory and be sure to - use the right file (i.e. i586 or x86_64). - After you have sourced the setup script, the tools are added to ``PATH`` and any other environment variables required to run the tools are initialized. The results are working versions versions of Git, tar, Python and ``chrpath``. And in the case of the - ``buildtools-extended`` tarball, additional working versions of tools + :term:`buildtools-extended` tarball, additional working versions of tools including ``gcc``, ``make`` and the other tools included in ``packagegroup-core-buildessential``. diff --git a/poky/documentation/ref-manual/tasks.rst b/poky/documentation/ref-manual/tasks.rst index b17c09cdc4..7a664cc6c0 100644 --- a/poky/documentation/ref-manual/tasks.rst +++ b/poky/documentation/ref-manual/tasks.rst @@ -78,9 +78,9 @@ task runs with the current working directory set to ``${``\ :term:`B`\ ``}``. Recipes implementing this task should inherit the -:ref:`deploy ` class and should write the output +:ref:`ref-classes-deploy` class and should write the output to ``${``\ :term:`DEPLOYDIR`\ ``}``, which is not to be -confused with ``${DEPLOY_DIR}``. The :ref:`deploy ` class sets up +confused with ``${DEPLOY_DIR}``. The :ref:`ref-classes-deploy` class sets up :ref:`ref-tasks-deploy` as a shared state (sstate) task that can be accelerated through sstate use. The sstate mechanism takes care of copying the output from ``${DEPLOYDIR}`` to ``${DEPLOY_DIR_IMAGE}``. @@ -102,7 +102,7 @@ Adding :ref:`ref-tasks-deploy` after other tasks works the same way. .. note:: You do not need to add ``before do_build`` to the ``addtask`` command - (though it is harmless), because the :ref:`base ` class contains the following:: + (though it is harmless), because the :ref:`ref-classes-base` class contains the following:: do_build[recrdeptask] += "do_deploy" @@ -225,7 +225,7 @@ section in the Yocto Project Overview and Concepts Manual. ----------------- Runs QA checks on packaged files. For more information on these checks, -see the :ref:`insane ` class. +see the :ref:`ref-classes-insane` class. .. _ref-tasks-package_write_deb: @@ -343,7 +343,7 @@ while ``file2.patch`` would not be applied. You can find out more about the patching process in the ":ref:`overview-manual/concepts:patching`" section in the Yocto Project Overview and Concepts Manual and the -":ref:`dev-manual/common-tasks:patching code`" section in the +":ref:`dev-manual/new-recipe:patching code`" section in the Yocto Project Development Tasks Manual. .. _ref-tasks-populate_lic: @@ -406,7 +406,7 @@ Installs the files into the individual recipe specific sysroots (i.e. ``recipe-sysroot`` and ``recipe-sysroot-native`` under ``${``\ :term:`WORKDIR`\ ``}`` based upon the dependencies specified by :term:`DEPENDS`). See the -":ref:`staging `" class for more information. +":ref:`ref-classes-staging`" class for more information. .. _ref-tasks-rm_work: @@ -522,7 +522,7 @@ scratch is guaranteed. Starts a shell in which an interactive Python interpreter allows you to interact with the BitBake build environment. From within this shell, you can directly examine and set bits from the data store and execute -functions as if within the BitBake environment. See the ":ref:`dev-manual/common-tasks:using a Python development shell`" section in +functions as if within the BitBake environment. See the ":ref:`dev-manual/python-development-shell:using a Python development shell`" section in the Yocto Project Development Tasks Manual for more information about using ``pydevshell``. @@ -532,7 +532,7 @@ using ``pydevshell``. --------------- Starts a shell whose environment is set up for development, debugging, -or both. See the ":ref:`dev-manual/common-tasks:using a development shell`" section in the +or both. See the ":ref:`dev-manual/development-shell:using a development shell`" section in the Yocto Project Development Tasks Manual for more information about using ``devshell``. @@ -595,7 +595,7 @@ information on how the root filesystem is created. Boots an image and performs runtime tests within the image. For information on automatically testing images, see the -":ref:`dev-manual/common-tasks:performing automated runtime testing`" +":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual. .. _ref-tasks-testimage_auto: @@ -608,7 +608,7 @@ after it has been built. This task is enabled when you set :term:`TESTIMAGE_AUTO` equal to "1". For information on automatically testing images, see the -":ref:`dev-manual/common-tasks:performing automated runtime testing`" +":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual. Kernel-Related Tasks diff --git a/poky/documentation/ref-manual/terms.rst b/poky/documentation/ref-manual/terms.rst index 51f6e79200..ec447d35d2 100644 --- a/poky/documentation/ref-manual/terms.rst +++ b/poky/documentation/ref-manual/terms.rst @@ -21,7 +21,7 @@ universal, the list includes them just in case: Information in append files extends or overrides the information in the similarly-named recipe file. For an example of an append file in use, see - the ":ref:`dev-manual/common-tasks:appending other layers metadata with your layer`" + the ":ref:`dev-manual/layers:appending other layers metadata with your layer`" section in the Yocto Project Development Tasks Manual. When you name an append file, you can use the "``%``" wildcard character @@ -109,6 +109,24 @@ universal, the list includes them just in case: environment. The build system is sometimes referred to as the development host. + :term:`buildtools` + Build tools in binary form, providing required versions of development + tools (such as Git, GCC, Python and make), to run the OpenEmbedded build + system on a development host without such minimum versions. + + See the ":ref:`system-requirements-buildtools`" paragraph in the + Reference Manual for details about downloading or building an archive + of such tools. + + :term:`buildtools-extended` + A set of :term:`buildtools` binaries extended with additional development + tools, such as a required version of the GCC compiler to run the + OpenEmbedded build system. + + :term:`buildtools-make` + A variant of :term:`buildtools`, just providing the required + version of ``make`` to run the OpenEmbedded build system. + :term:`Classes` Files that provide for logic encapsulation and inheritance so that commonly used patterns can be defined once and then easily used in @@ -203,7 +221,7 @@ universal, the list includes them just in case: ":ref:`overview-manual/yp-intro:The Yocto Project Layer Model`" section in the Yocto Project Overview and Concepts Manual. For more detailed information on layers, see the - ":ref:`dev-manual/common-tasks:Understanding and Creating + ":ref:`dev-manual/layers:Understanding and Creating Layers`" section in the Yocto Project Development Tasks Manual. For a discussion specifically on BSP Layers, see the ":ref:`bsp-guide/bsp:BSP Layers`" section in the Yocto Project Board Support Packages (BSP) @@ -335,7 +353,7 @@ universal, the list includes them just in case: The OpenEmbedded Build System can generate such documentation for your project, in :term:`SPDX` format, based on all the metadata it used to - build the software images. See the ":ref:`dev-manual/common-tasks:creating + build the software images. See the ":ref:`dev-manual/sbom:creating a software bill of materials`" section of the Development Tasks manual. :term:`Source Directory` @@ -406,7 +424,7 @@ universal, the list includes them just in case: provide an :term:`SBOM` associated to each a software image. For details, see Wikipedia's :wikipedia:`SPDX page ` - and the ":ref:`dev-manual/common-tasks:creating a software bill of materials`" + and the ":ref:`dev-manual/sbom:creating a software bill of materials`" section of the Development Tasks manual. :term:`Sysroot` diff --git a/poky/documentation/ref-manual/variables.rst b/poky/documentation/ref-manual/variables.rst index d3aae63308..f2decd713b 100644 --- a/poky/documentation/ref-manual/variables.rst +++ b/poky/documentation/ref-manual/variables.rst @@ -126,8 +126,7 @@ system and gives an overview of their function and contents. ":ref:`ref-classes-update-alternatives`" section. :term:`ANY_OF_DISTRO_FEATURES` - When inheriting the - :ref:`features_check ` + When inheriting the :ref:`ref-classes-features_check` class, this variable identifies a list of distribution features where at least one must be enabled in the current configuration in order for the OpenEmbedded build system to build the recipe. In other words, @@ -140,14 +139,14 @@ system and gives an overview of their function and contents. An override list of append strings for each target specified with :term:`LABELS`. - See the :ref:`grub-efi ` class for more + See the :ref:`ref-classes-grub-efi` class for more information on how this variable is used. :term:`AR` The minimal command and arguments used to run ``ar``. :term:`ARCHIVER_MODE` - When used with the :ref:`archiver ` class, + When used with the :ref:`ref-classes-archiver` class, determines the type of information used to create a released archive. You can use this variable to create archives of patched source, original source, configured source, and so forth by employing the @@ -198,13 +197,14 @@ system and gives an overview of their function and contents. order to send patches and forward bugs. :term:`AUTO_LIBNAME_PKGS` - When the :ref:`debian ` class is inherited, + When the :ref:`ref-classes-debian` class is inherited, which is the default behavior, :term:`AUTO_LIBNAME_PKGS` specifies which packages should be checked for libraries and renamed according to Debian library package naming. - The default value is "${PACKAGES}", which causes the debian class to - act on all packages that are explicitly generated by the recipe. + The default value is "${PACKAGES}", which causes the + :ref:`ref-classes-debian` class to act on all packages that are + explicitly generated by the recipe. :term:`AUTOREV` When :term:`SRCREV` is set to the value of this variable, it specifies to @@ -214,21 +214,20 @@ system and gives an overview of their function and contents. If you use the previous statement to retrieve the latest version of software, you need to be sure :term:`PV` contains - ``${``\ :term:`SRCPV`\ ``}``. For example, suppose you - have a kernel recipe that inherits the - :ref:`kernel ` class and you use the previous - statement. In this example, ``${SRCPV}`` does not automatically get - into :term:`PV`. Consequently, you need to change :term:`PV` in your recipe - so that it does contain ``${SRCPV}``. + ``${``\ :term:`SRCPV`\ ``}``. For example, suppose you have a kernel + recipe that inherits the :ref:`ref-classes-kernel` class and you + use the previous statement. In this example, ``${SRCPV}`` does not + automatically get into :term:`PV`. Consequently, you need to change + :term:`PV` in your recipe so that it does contain ``${SRCPV}``. For more information see the - ":ref:`dev-manual/common-tasks:automatically incrementing a package version number`" + ":ref:`dev-manual/packages:automatically incrementing a package version number`" section in the Yocto Project Development Tasks Manual. :term:`AUTO_SYSLINUXMENU` Enables creating an automatic menu for the syslinux bootloader. You must set this variable in your recipe. The - :ref:`syslinux ` class checks this variable. + :ref:`ref-classes-syslinux` class checks this variable. :term:`AVAILTUNES` The list of defined CPU and Application Binary Interface (ABI) @@ -238,7 +237,7 @@ system and gives an overview of their function and contents. The list simply presents the tunes that are available. Not all tunes may be compatible with a particular machine configuration, or with each other in a - :ref:`Multilib ` + :ref:`Multilib ` configuration. To add a tune to the list, be sure to append it with spaces using the @@ -251,8 +250,7 @@ system and gives an overview of their function and contents. Azure Storage Shared Access Signature, when using the :ref:`Azure Storage fetcher (az://) ` This variable can be defined to be used by the fetcher to authenticate - and gain access to non-public artifacts. - :: + and gain access to non-public artifacts:: AZ_SAS = ""se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=&sig="" @@ -303,7 +301,7 @@ system and gives an overview of their function and contents. :term:`BASE_LIB` The library directory name for the CPU or Application Binary Interface (ABI) tune. The :term:`BASE_LIB` applies only in the Multilib - context. See the ":ref:`dev-manual/common-tasks:combining multiple versions of library files into one image`" + context. See the ":ref:`dev-manual/libraries:combining multiple versions of library files into one image`" section in the Yocto Project Development Tasks Manual for information on Multilib. @@ -325,8 +323,7 @@ system and gives an overview of their function and contents. - There is limited support for wildcard matching against the beginning of host names. For example, the following setting matches - ``git.gnu.org``, ``ftp.gnu.org``, and ``foo.git.gnu.org``. - :: + ``git.gnu.org``, ``ftp.gnu.org``, and ``foo.git.gnu.org``:: BB_ALLOWED_NETWORKS = "*.gnu.org" @@ -354,6 +351,18 @@ system and gives an overview of their function and contents. host listed in :term:`SRC_URI` after a successful fetch from the :term:`PREMIRRORS` occurs. + :term:`BB_BASEHASH_IGNORE_VARS` + See :term:`bitbake:BB_BASEHASH_IGNORE_VARS` in the BitBake manual. + + :term:`BB_CHECK_SSL_CERTS` + See :term:`bitbake:BB_CHECK_SSL_CERTS` in the BitBake manual. + + :term:`BB_CONSOLELOG` + See :term:`bitbake:BB_CONSOLELOG` in the BitBake manual. + + :term:`BB_CURRENTTASK` + See :term:`bitbake:BB_CURRENTTASK` in the BitBake manual. + :term:`BB_DANGLINGAPPENDS_WARNONLY` Defines how BitBake handles situations where an append file (``.bbappend``) has no corresponding recipe file (``.bb``). This @@ -372,6 +381,12 @@ system and gives an overview of their function and contents. BB_DANGLINGAPPENDS_WARNONLY = "1" + :term:`BB_DEFAULT_TASK` + See :term:`bitbake:BB_DEFAULT_TASK` in the BitBake manual. + + :term:`BB_DEFAULT_UMASK` + See :term:`bitbake:BB_DEFAULT_UMASK` in the BitBake manual. + :term:`BB_DISKMON_DIRS` Monitors disk space and available inodes during the build and allows you to control the build based on these parameters. @@ -493,6 +508,18 @@ system and gives an overview of their function and contents. a respective interval is reached beyond the initial warning (i.e. 1 Gbytes and 100 Kbytes). + :term:`BB_ENV_PASSTHROUGH` + See :term:`bitbake:BB_ENV_PASSTHROUGH` in the BitBake manual. + + :term:`BB_ENV_PASSTHROUGH_ADDITIONS` + See :term:`bitbake:BB_ENV_PASSTHROUGH_ADDITIONS` in the BitBake manual. + + :term:`BB_FETCH_PREMIRRORONLY` + See :term:`bitbake:BB_FETCH_PREMIRRORONLY` in the BitBake manual. + + :term:`BB_FILENAME` + See :term:`bitbake:BB_FILENAME` in the BitBake manual. + :term:`BB_GENERATE_MIRROR_TARBALLS` Causes tarballs of the source control repositories (e.g. Git repositories), including metadata, to be placed in the @@ -500,8 +527,7 @@ system and gives an overview of their function and contents. For performance reasons, creating and placing tarballs of these repositories is not the default action by the OpenEmbedded build - system. - :: + system:: BB_GENERATE_MIRROR_TARBALLS = "1" @@ -512,6 +538,48 @@ system and gives an overview of their function and contents. clean up your :term:`DL_DIR` directory by deleting any Git or other source control work directories. + :term:`BB_GENERATE_SHALLOW_TARBALLS` + See :term:`bitbake:BB_GENERATE_SHALLOW_TARBALLS` in the BitBake manual. + + :term:`BB_GIT_SHALLOW` + See :term:`bitbake:BB_GIT_SHALLOW` in the BitBake manual. + + :term:`BB_GIT_SHALLOW_DEPTH` + See :term:`bitbake:BB_GIT_SHALLOW_DEPTH` in the BitBake manual. + + :term:`BB_HASHCHECK_FUNCTION` + See :term:`bitbake:BB_HASHCHECK_FUNCTION` in the BitBake manual. + + :term:`BB_HASHCONFIG_IGNORE_VARS` + See :term:`bitbake:BB_HASHCONFIG_IGNORE_VARS` in the BitBake manual. + + :term:`BB_HASHSERVE` + See :term:`bitbake:BB_HASHSERVE` in the BitBake manual. + + :term:`BB_HASHSERVE_UPSTREAM` + See :term:`bitbake:BB_HASHSERVE_UPSTREAM` in the BitBake manual. + + :term:`BB_INVALIDCONF` + See :term:`bitbake:BB_INVALIDCONF` in the BitBake manual. + + :term:`BB_LOGCONFIG` + See :term:`bitbake:BB_LOGCONFIG` in the BitBake manual. + + :term:`BB_LOGFMT` + See :term:`bitbake:BB_LOGFMT` in the BitBake manual. + + :term:`BB_MULTI_PROVIDER_ALLOWED` + See :term:`bitbake:BB_MULTI_PROVIDER_ALLOWED` in the BitBake manual. + + :term:`BB_NICE_LEVEL` + See :term:`bitbake:BB_NICE_LEVEL` in the BitBake manual. + + :term:`BB_NO_NETWORK` + See :term:`bitbake:BB_NO_NETWORK` in the BitBake manual. + + :term:`BB_NUMBER_PARSE_THREADS` + See :term:`bitbake:BB_NUMBER_PARSE_THREADS` in the BitBake manual. + :term:`BB_NUMBER_THREADS` The maximum number of tasks BitBake should run in parallel at any one time. The OpenEmbedded build system automatically configures this @@ -527,7 +595,7 @@ system and gives an overview of their function and contents. is not set higher than "20". For more information on speeding up builds, see the - ":ref:`dev-manual/common-tasks:speeding up a build`" + ":ref:`dev-manual/speeding-up-build:speeding up a build`" section in the Yocto Project Development Tasks Manual. On the other hand, if your goal is to limit the amount of system @@ -557,6 +625,33 @@ system and gives an overview of their function and contents. tasks already being run from using all CPU threads on the system if :term:`PARALLEL_MAKE` is not set to a low value. + :term:`BB_ORIGENV` + See :term:`bitbake:BB_ORIGENV` in the BitBake manual. + + :term:`BB_PRESERVE_ENV` + See :term:`bitbake:BB_PRESERVE_ENV` in the BitBake manual. + + :term:`BB_PRESSURE_MAX_CPU` + See :term:`bitbake:BB_PRESSURE_MAX_CPU` in the BitBake manual. + + :term:`BB_PRESSURE_MAX_IO` + See :term:`bitbake:BB_PRESSURE_MAX_IO` in the BitBake manual. + + :term:`BB_PRESSURE_MAX_MEMORY` + See :term:`bitbake:BB_PRESSURE_MAX_MEMORY` in the BitBake manual. + + :term:`BB_RUNFMT` + See :term:`bitbake:BB_RUNFMT` in the BitBake manual. + + :term:`BB_RUNTASK` + See :term:`bitbake:BB_RUNTASK` in the BitBake manual. + + :term:`BB_SCHEDULER` + See :term:`bitbake:BB_SCHEDULER` in the BitBake manual. + + :term:`BB_SCHEDULERS` + See :term:`bitbake:BB_SCHEDULERS` in the BitBake manual. + :term:`BB_SERVER_TIMEOUT` Specifies the time (in seconds) after which to unload the BitBake server due to inactivity. Set :term:`BB_SERVER_TIMEOUT` to determine how @@ -570,15 +665,45 @@ system and gives an overview of their function and contents. If you want the server to never be unloaded, set :term:`BB_SERVER_TIMEOUT` to "-1". + :term:`BB_SETSCENE_DEPVALID` + See :term:`bitbake:BB_SETSCENE_DEPVALID` in the BitBake manual. + + :term:`BB_SIGNATURE_EXCLUDE_FLAGS` + See :term:`bitbake:BB_SIGNATURE_EXCLUDE_FLAGS` in the BitBake manual. + + :term:`BB_SIGNATURE_HANDLER` + See :term:`bitbake:BB_SIGNATURE_HANDLER` in the BitBake manual. + + :term:`BB_SRCREV_POLICY` + See :term:`bitbake:BB_SRCREV_POLICY` in the BitBake manual. + + :term:`BB_STRICT_CHECKSUM` + See :term:`bitbake:BB_STRICT_CHECKSUM` in the BitBake manual. + + :term:`BB_TASK_IONICE_LEVEL` + See :term:`bitbake:BB_TASK_IONICE_LEVEL` in the BitBake manual. + + :term:`BB_TASK_NICE_LEVEL` + See :term:`bitbake:BB_TASK_NICE_LEVEL` in the BitBake manual. + + :term:`BB_TASKHASH` + See :term:`bitbake:BB_TASKHASH` in the BitBake manual. + + :term:`BB_VERBOSE_LOGS` + See :term:`bitbake:BB_VERBOSE_LOGS` in the BitBake manual. + + :term:`BB_WORKERCONTEXT` + See :term:`bitbake:BB_WORKERCONTEXT` in the BitBake manual. + :term:`BBCLASSEXTEND` Allows you to extend a recipe so that it builds variants of the software. There are common variants for recipes as "natives" like ``quilt-native``, which is a copy of Quilt built to run on the build system; "crosses" such as ``gcc-cross``, which is a compiler built to run on the build machine but produces binaries that run on the target - :term:`MACHINE`; "nativesdk", which targets the SDK - machine instead of :term:`MACHINE`; and "mulitlibs" in the form - "``multilib:``\ multilib_name". + :term:`MACHINE`; ":ref:`ref-classes-nativesdk`", which + targets the SDK machine instead of :term:`MACHINE`; and "mulitlibs" in + the form "``multilib:``\ multilib_name". To build a different variant of the recipe with a minimal amount of code, it usually is as simple as adding the following to your recipe:: @@ -600,6 +725,9 @@ system and gives an overview of their function and contents. since ``include`` statements are processed when the recipe is parsed. + :term:`BBDEBUG` + See :term:`bitbake:BBDEBUG` in the BitBake manual. + :term:`BBFILE_COLLECTIONS` Lists the names of configured layers. These names are used to find the other ``BBFILE_*`` variables. Typically, each layer will append @@ -675,6 +803,9 @@ system and gives an overview of their function and contents. /work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend /work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend + :term:`BBINCLUDED` + See :term:`bitbake:BBINCLUDED` in the BitBake manual. + :term:`BBINCLUDELOGS` Variable that controls how BitBake displays logs on build failure. @@ -699,6 +830,9 @@ system and gives an overview of their function and contents. This example enables four layers, one of which is a custom, user-defined layer named ``meta-mykernel``. + :term:`BBLAYERS_FETCH_DIR` + See :term:`bitbake:BBLAYERS_FETCH_DIR` in the BitBake manual. + :term:`BBMASK` Prevents BitBake from processing recipes and recipe append files. @@ -752,9 +886,12 @@ system and gives an overview of their function and contents. For information on how to use :term:`BBMULTICONFIG` in an environment that supports building targets with multiple configurations, see the - ":ref:`dev-manual/common-tasks:building images for multiple targets using multiple configurations`" + ":ref:`dev-manual/building:building images for multiple targets using multiple configurations`" section in the Yocto Project Development Tasks Manual. + :term:`BBPATH` + See :term:`bitbake:BBPATH` in the BitBake manual. + :term:`BBSERVER` If defined in the BitBake environment, :term:`BBSERVER` points to the BitBake remote server. @@ -768,14 +905,16 @@ system and gives an overview of their function and contents. Consequently, :term:`BBSERVER` is excluded from checksum and dependency data. + :term:`BBTARGETS` + See :term:`bitbake:BBTARGETS` in the BitBake manual. + :term:`BINCONFIG` - When inheriting the - :ref:`binconfig-disabled ` class, - this variable specifies binary configuration scripts to disable in - favor of using ``pkg-config`` to query the information. The - :ref:`binconfig-disabled ` class will modify the specified scripts to - return an error so that calls to them can be easily found and - replaced. + When inheriting the :ref:`ref-classes-binconfig-disabled` class, this + variable specifies binary configuration scripts to disable in favor of + using ``pkg-config`` to query the information. The + :ref:`ref-classes-binconfig-disabled` class will modify the specified + scripts to return an error so that calls to them can be easily found + and replaced. To add multiple scripts, separate them by spaces. Here is an example from the ``libpng`` recipe:: @@ -783,7 +922,7 @@ system and gives an overview of their function and contents. BINCONFIG = "${bindir}/libpng-config ${bindir}/libpng16-config" :term:`BINCONFIG_GLOB` - When inheriting the :ref:`binconfig ` class, + When inheriting the :ref:`ref-classes-binconfig` class, this variable specifies a wildcard for configuration scripts that need editing. The scripts are edited to correct any paths that have been set up during compilation so that they are correct for use when @@ -805,6 +944,9 @@ system and gives an overview of their function and contents. information on the class in the ":ref:`ref-classes-binconfig`" section. + :term:`BITBAKE_UI` + See :term:`bitbake:BITBAKE_UI` in the BitBake manual. + :term:`BP` The base recipe name and version but without any special recipe name suffix (i.e. ``-native``, ``lib64-``, and so forth). :term:`BP` is @@ -905,8 +1047,7 @@ system and gives an overview of their function and contents. :term:`BUILD_PREFIX` The toolchain binary prefix used for native recipes. The OpenEmbedded build system uses the :term:`BUILD_PREFIX` value to set the - :term:`TARGET_PREFIX` when building for - ``native`` recipes. + :term:`TARGET_PREFIX` when building for :ref:`ref-classes-native` recipes. :term:`BUILD_STRIP` Specifies the command to be used to strip debugging symbols from @@ -917,7 +1058,7 @@ system and gives an overview of their function and contents. :term:`BUILD_SYS` Specifies the system, including the architecture and the operating system, to use when building for the build host (i.e. when building - ``native`` recipes). + :ref:`ref-classes-native` recipes). The OpenEmbedded build system automatically sets this variable based on :term:`BUILD_ARCH`, @@ -937,22 +1078,22 @@ system and gives an overview of their function and contents. :term:`BUILDDIR` defaults to ``build`` in the current directory. :term:`BUILDHISTORY_COMMIT` - When inheriting the :ref:`buildhistory ` - class, this variable specifies whether or not to commit the build - history output in a local Git repository. If set to "1", this local - repository will be maintained automatically by the :ref:`buildhistory ` - class and a commit will be created on every build for changes to each - top-level subdirectory of the build history output (images, packages, - and sdk). If you want to track changes to build history over time, - you should set this value to "1". - - By default, the :ref:`buildhistory ` class + When inheriting the :ref:`ref-classes-buildhistory` class, this variable + specifies whether or not to commit the build history output in a local + Git repository. If set to "1", this local repository will be maintained + automatically by the :ref:`ref-classes-buildhistory` class and a commit + will be created on every build for changes to each top-level subdirectory + of the build history output (images, packages, and sdk). If you want to + track changes to build history over time, you should set this value to + "1". + + By default, the :ref:`ref-classes-buildhistory` class enables committing the buildhistory output in a local Git repository:: BUILDHISTORY_COMMIT ?= "1" :term:`BUILDHISTORY_COMMIT_AUTHOR` - When inheriting the :ref:`buildhistory ` + When inheriting the :ref:`ref-classes-buildhistory` class, this variable specifies the author to use for each Git commit. In order for the :term:`BUILDHISTORY_COMMIT_AUTHOR` variable to work, the :term:`BUILDHISTORY_COMMIT` variable must @@ -963,25 +1104,27 @@ system and gives an overview of their function and contents. email@host". Providing an email address or host that is not valid does not produce an error. - By default, the :ref:`buildhistory ` class sets the variable as follows:: + By default, the :ref:`ref-classes-buildhistory` class sets the variable + as follows:: BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory " :term:`BUILDHISTORY_DIR` - When inheriting the :ref:`buildhistory ` + When inheriting the :ref:`ref-classes-buildhistory` class, this variable specifies the directory in which build history information is kept. For more information on how the variable works, see the :ref:`ref-classes-buildhistory` class. - By default, the :ref:`buildhistory ` class sets the directory as follows:: + By default, the :ref:`ref-classes-buildhistory` class sets the directory + as follows:: BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory" :term:`BUILDHISTORY_FEATURES` - When inheriting the :ref:`buildhistory ` + When inheriting the :ref:`ref-classes-buildhistory` class, this variable specifies the build history features to be enabled. For more information on how build history works, see the - ":ref:`dev-manual/common-tasks:maintaining build output quality`" + ":ref:`dev-manual/build-quality:maintaining build output quality`" section in the Yocto Project Development Tasks Manual. You can specify these features in the form of a space-separated list: @@ -1000,13 +1143,13 @@ system and gives an overview of their function and contents. This saves one file per task and lists the SHA-256 checksums for each file staged (i.e. the output of the task). - By default, the :ref:`buildhistory ` class enables the following - features:: + By default, the :ref:`ref-classes-buildhistory` class enables the + following features:: BUILDHISTORY_FEATURES ?= "image package sdk" :term:`BUILDHISTORY_IMAGE_FILES` - When inheriting the :ref:`buildhistory ` + When inheriting the :ref:`ref-classes-buildhistory` class, this variable specifies a list of paths to files copied from the image contents into the build history directory under an "image-files" directory in the directory for the image, so that you @@ -1016,42 +1159,45 @@ system and gives an overview of their function and contents. any file. Specifying an invalid path does not produce an error. Consequently, you can include files that might not always be present. - By default, the :ref:`buildhistory ` class provides paths to the - following files:: + By default, the :ref:`ref-classes-buildhistory` class provides paths to + the following files:: BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group" :term:`BUILDHISTORY_PATH_PREFIX_STRIP` - When inheriting the :ref:`buildhistory ` + When inheriting the :ref:`ref-classes-buildhistory` class, this variable specifies a common path prefix that should be stripped off the beginning of paths in the task signature list when the ``task`` feature is active in :term:`BUILDHISTORY_FEATURES`. This can be useful when build history is populated from multiple sources that may not all use the same top level directory. - By default, the :ref:`buildhistory ` class sets the variable as follows:: + By default, the :ref:`ref-classes-buildhistory` class sets the variable + as follows:: BUILDHISTORY_PATH_PREFIX_STRIP ?= "" In this case, no prefixes will be stripped. :term:`BUILDHISTORY_PUSH_REPO` - When inheriting the :ref:`buildhistory ` - class, this variable optionally specifies a remote repository to - which build history pushes Git changes. In order for - :term:`BUILDHISTORY_PUSH_REPO` to work, - :term:`BUILDHISTORY_COMMIT` must be set to - "1". + When inheriting the :ref:`ref-classes-buildhistory` class, this variable + optionally specifies a remote repository to which build history pushes + Git changes. In order for :term:`BUILDHISTORY_PUSH_REPO` to work, + :term:`BUILDHISTORY_COMMIT` must be set to "1". The repository should correspond to a remote address that specifies a repository as understood by Git, or alternatively to a remote name that you have set up manually using ``git remote`` within the local repository. - By default, the :ref:`buildhistory ` class sets the variable as follows:: + By default, the :ref:`ref-classes-buildhistory` class sets the variable + as follows:: BUILDHISTORY_PUSH_REPO ?= "" + :term:`BUILDNAME` + See :term:`bitbake:BUILDNAME` in the BitBake manual. + :term:`BUILDSDK_CFLAGS` Specifies the flags to pass to the C compiler when building for the SDK. When building in the ``nativesdk-`` context, @@ -1078,8 +1224,7 @@ system and gives an overview of their function and contents. :term:`BUILDSTATS_BASE` Points to the location of the directory that holds build statistics - when you use and enable the - :ref:`buildstats ` class. The + when you use and enable the :ref:`ref-classes-buildstats` class. The :term:`BUILDSTATS_BASE` directory defaults to ``${``\ :term:`TMPDIR`\ ``}/buildstats/``. @@ -1093,6 +1238,9 @@ system and gives an overview of their function and contents. splitting the output executable file. Set the variable to "0" to get a single output executable file. + :term:`BZRDIR` + See :term:`bitbake:BZRDIR` in the BitBake manual. + :term:`CACHE` Specifies the directory BitBake uses to store a cache of the :term:`Metadata` so it does not need to be parsed every time @@ -1122,9 +1270,8 @@ system and gives an overview of their function and contents. An internal variable specifying the special class override that should currently apply (e.g. "class-target", "class-native", and so forth). The classes that use this variable (e.g. - :ref:`native `, - :ref:`nativesdk `, and so forth) set the - variable to appropriate values. + :ref:`ref-classes-native`, :ref:`ref-classes-nativesdk`, and so forth) + set the variable to appropriate values. .. note:: @@ -1288,7 +1435,7 @@ system and gives an overview of their function and contents. will be the aggregate of all of them. For information on creating an :term:`Initramfs`, see the - ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section + ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in the Yocto Project Development Tasks Manual. :term:`CONFIG_SITE` @@ -1300,8 +1447,7 @@ system and gives an overview of their function and contents. The minimal arguments for GNU configure. :term:`CONFLICT_DISTRO_FEATURES` - When inheriting the - :ref:`features_check ` + When inheriting the :ref:`ref-classes-features_check` class, this variable identifies distribution features that would be in conflict should the recipe be built. In other words, if the :term:`CONFLICT_DISTRO_FEATURES` variable lists a feature that also @@ -1317,8 +1463,8 @@ system and gives an overview of their function and contents. - Checksums for the image - An example of :term:`CONVERSION_CMD` from :ref:`image-types - ` class is:: + An example of :term:`CONVERSION_CMD` from :ref:`ref-classes-image_types` + class is:: CONVERSION_CMD:lzo = "lzop -9 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" @@ -1336,7 +1482,7 @@ system and gives an overview of their function and contents. newly installed packages to an image, which might be most suitable for read-only filesystems that cannot be upgraded. See the :term:`LICENSE_CREATE_PACKAGE` variable for additional information. - You can also reference the ":ref:`dev-manual/common-tasks:providing license text`" + You can also reference the ":ref:`dev-manual/licenses:providing license text`" section in the Yocto Project Development Tasks Manual for information on providing license text. @@ -1352,15 +1498,14 @@ system and gives an overview of their function and contents. newly installed packages to an image, which might be most suitable for read-only filesystems that cannot be upgraded. See the :term:`LICENSE_CREATE_PACKAGE` variable for additional information. - You can also reference the ":ref:`dev-manual/common-tasks:providing license text`" + You can also reference the ":ref:`dev-manual/licenses:providing license text`" section in the Yocto Project Development Tasks Manual for information on providing license text. :term:`COPYLEFT_LICENSE_EXCLUDE` - A space-separated list of licenses to exclude from the source - archived by the :ref:`archiver ` class. In - other words, if a license in a recipe's - :term:`LICENSE` value is in the value of + A space-separated list of licenses to exclude from the source archived by + the :ref:`ref-classes-archiver` class. In other words, if a license in a + recipe's :term:`LICENSE` value is in the value of :term:`COPYLEFT_LICENSE_EXCLUDE`, then its source is not archived by the class. @@ -1371,58 +1516,54 @@ system and gives an overview of their function and contents. The default value, which is "CLOSED Proprietary", for :term:`COPYLEFT_LICENSE_EXCLUDE` is set by the - :ref:`copyleft_filter ` class, which - is inherited by the :ref:`archiver ` class. + :ref:`ref-classes-copyleft_filter` class, which + is inherited by the :ref:`ref-classes-archiver` class. :term:`COPYLEFT_LICENSE_INCLUDE` A space-separated list of licenses to include in the source archived - by the :ref:`archiver ` class. In other + by the :ref:`ref-classes-archiver` class. In other words, if a license in a recipe's :term:`LICENSE` value is in the value of :term:`COPYLEFT_LICENSE_INCLUDE`, then its source is archived by the class. - The default value is set by the - :ref:`copyleft_filter ` class, which - is inherited by the :ref:`archiver ` class. The default value includes - "GPL*", "LGPL*", and "AGPL*". + The default value is set by the :ref:`ref-classes-copyleft_filter` class, + which is inherited by the :ref:`ref-classes-archiver` class. The default + value includes "GPL*", "LGPL*", and "AGPL*". :term:`COPYLEFT_PN_EXCLUDE` A list of recipes to exclude in the source archived by the - :ref:`archiver ` class. The - :term:`COPYLEFT_PN_EXCLUDE` variable overrides the license inclusion and - exclusion caused through the - :term:`COPYLEFT_LICENSE_INCLUDE` and - :term:`COPYLEFT_LICENSE_EXCLUDE` + :ref:`ref-classes-archiver` class. The :term:`COPYLEFT_PN_EXCLUDE` + variable overrides the license inclusion and exclusion caused through the + :term:`COPYLEFT_LICENSE_INCLUDE` and :term:`COPYLEFT_LICENSE_EXCLUDE` variables, respectively. The default value, which is "" indicating to not explicitly exclude any recipes by name, for :term:`COPYLEFT_PN_EXCLUDE` is set by the - :ref:`copyleft_filter ` class, which - is inherited by the :ref:`archiver ` class. + :ref:`ref-classes-copyleft_filter` class, which is inherited by the + :ref:`ref-classes-archiver` class. :term:`COPYLEFT_PN_INCLUDE` A list of recipes to include in the source archived by the - :ref:`archiver ` class. The - :term:`COPYLEFT_PN_INCLUDE` variable overrides the license inclusion and - exclusion caused through the - :term:`COPYLEFT_LICENSE_INCLUDE` and - :term:`COPYLEFT_LICENSE_EXCLUDE` + :ref:`ref-classes-archiver` class. The :term:`COPYLEFT_PN_INCLUDE` + variable overrides the license inclusion and exclusion caused through the + :term:`COPYLEFT_LICENSE_INCLUDE` and :term:`COPYLEFT_LICENSE_EXCLUDE` variables, respectively. The default value, which is "" indicating to not explicitly include any recipes by name, for :term:`COPYLEFT_PN_INCLUDE` is set by the - :ref:`copyleft_filter ` class, which - is inherited by the :ref:`archiver ` class. + :ref:`ref-classes-copyleft_filter` class, which is inherited by the + :ref:`ref-classes-archiver` class. :term:`COPYLEFT_RECIPE_TYPES` A space-separated list of recipe types to include in the source archived by the :ref:`archiver ` class. - Recipe types are ``target``, ``native``, ``nativesdk``, ``cross``, - ``crosssdk``, and ``cross-canadian``. + Recipe types are ``target``, :ref:`ref-classes-native`, + :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, + :ref:`ref-classes-crosssdk`, and :ref:`ref-classes-cross-canadian`. The default value, which is "target*", for :term:`COPYLEFT_RECIPE_TYPES` - is set by the :ref:`copyleft_filter ` - class, which is inherited by the :ref:`archiver ` class. + is set by the :ref:`ref-classes-copyleft_filter` class, which is + inherited by the :ref:`ref-classes-archiver` class. :term:`CORE_IMAGE_EXTRA_INSTALL` Specifies the list of packages to be added to the image. You should @@ -1496,7 +1637,7 @@ system and gives an overview of their function and contents. CVE_CHECK_IGNORE += "CVE-2020-15523" :term:`CVE_CHECK_SHOW_WARNINGS` - Specifies whether or not the :ref:`cve-check ` + Specifies whether or not the :ref:`ref-classes-cve-check` class should generate warning messages on the console when unpatched CVEs are found. The default is "1", but you may wish to set it to "0" if you are already examining/processing the logs after the build has @@ -1518,7 +1659,7 @@ system and gives an overview of their function and contents. against the name in the upstream `NIST CVE database `__. The default is ${:term:`BPN`} (except for recipes that inherit the - :ref:`pypi ` class where it is set based upon + :ref:`ref-classes-pypi` class where it is set based upon :term:`PYPI_PACKAGE`). If it does not match the name in the NIST CVE database or matches with multiple entries in the database, the default value needs to be changed. @@ -1537,12 +1678,12 @@ system and gives an overview of their function and contents. :term:`CVE_VERSION` In a recipe, defines the version used to match the recipe version against the version in the `NIST CVE database `__ - when usign :ref:`cve-check `. + when usign :ref:`ref-classes-cve-check`. The default is ${:term:`PV`} but if recipes use custom version numbers which do not map to upstream software component release versions and the versions used in the CVE database, then this variable can be used to set the - version number for :ref:`cve-check `. Example:: + version number for :ref:`ref-classes-cve-check`. Example:: CVE_VERSION = "2.39" @@ -1592,7 +1733,7 @@ system and gives an overview of their function and contents. suitable for timestamps. :term:`DEBIAN_NOAUTONAME` - When the :ref:`debian ` class is inherited, + When the :ref:`ref-classes-debian` class is inherited, which is the default behavior, :term:`DEBIAN_NOAUTONAME` specifies a particular package should not be renamed according to Debian library package naming. You must use the package name as an override when you @@ -1601,7 +1742,7 @@ system and gives an overview of their function and contents. DEBIAN_NOAUTONAME:fontconfig-utils = "1" :term:`DEBIANNAME` - When the :ref:`debian ` class is inherited, + When the :ref:`ref-classes-debian` class is inherited, which is the default behavior, :term:`DEBIANNAME` allows you to override the library name for an individual package. Overriding the library name in these cases is rare. You must use the package name as an @@ -1681,7 +1822,7 @@ system and gives an overview of their function and contents. the :ref:`ref-tasks-populate_sysroot` task of each recipe listed in :term:`DEPENDS`, through a ``[``\ :ref:`deptask `\ ``]`` - declaration in the :ref:`base ` class. + declaration in the :ref:`ref-classes-base` class. .. note:: @@ -1697,7 +1838,7 @@ system and gives an overview of their function and contents. DEPENDS = "codegen-native" For more - information, see the :ref:`native ` class and + information, see the :ref:`ref-classes-native` class and the :term:`EXTRANATIVEPATH` variable. .. note:: @@ -1751,9 +1892,8 @@ system and gives an overview of their function and contents. :term:`DEPLOY_DIR_DEB` Points to the area that the OpenEmbedded build system uses to place Debian packages that are ready to be used outside of the build - system. This variable applies only when - :term:`PACKAGE_CLASSES` contains - "package_deb". + system. This variable applies only when :term:`PACKAGE_CLASSES` contains + ":ref:`ref-classes-package_deb`". The BitBake configuration file initially defines the :term:`DEPLOY_DIR_DEB` variable as a sub-folder of @@ -1761,7 +1901,7 @@ system and gives an overview of their function and contents. DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb" - The :ref:`package_deb ` class uses the + The :ref:`ref-classes-package_deb` class uses the :term:`DEPLOY_DIR_DEB` variable to make sure the :ref:`ref-tasks-package_write_deb` task writes Debian packages into the appropriate folder. For more @@ -1780,9 +1920,8 @@ system and gives an overview of their function and contents. It must not be used directly in recipes when deploying files. Instead, it's only useful when a recipe needs to "read" a file already deployed by a dependency. So, it should be filled with the contents of - :term:`DEPLOYDIR` by the :ref:`deploy ` class or - with the contents of :term:`IMGDEPLOYDIR` by the :ref:`image - ` class. + :term:`DEPLOYDIR` by the :ref:`ref-classes-deploy` class or with the + contents of :term:`IMGDEPLOYDIR` by the :ref:`ref-classes-image` class. For more information on the structure of the :term:`Build Directory`, see ":ref:`ref-manual/structure:the build directory --- \`\`build/\`\``" section. @@ -1794,18 +1933,16 @@ system and gives an overview of their function and contents. :term:`DEPLOY_DIR_IPK` Points to the area that the OpenEmbedded build system uses to place IPK packages that are ready to be used outside of the build system. - This variable applies only when - :term:`PACKAGE_CLASSES` contains - "package_ipk". + This variable applies only when :term:`PACKAGE_CLASSES` contains + ":ref:`ref-classes-package_ipk`". The BitBake configuration file initially defines this variable as a sub-folder of :term:`DEPLOY_DIR`:: DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk" - The :ref:`package_ipk ` class uses the - :term:`DEPLOY_DIR_IPK` variable to make sure the - :ref:`ref-tasks-package_write_ipk` task + The :ref:`ref-classes-package_ipk` class uses the :term:`DEPLOY_DIR_IPK` + variable to make sure the :ref:`ref-tasks-package_write_ipk` task writes IPK packages into the appropriate folder. For more information on how packaging works, see the ":ref:`overview-manual/concepts:package feeds`" section @@ -1814,16 +1951,15 @@ system and gives an overview of their function and contents. :term:`DEPLOY_DIR_RPM` Points to the area that the OpenEmbedded build system uses to place RPM packages that are ready to be used outside of the build system. - This variable applies only when - :term:`PACKAGE_CLASSES` contains - "package_rpm". + This variable applies only when :term:`PACKAGE_CLASSES` contains + ":ref:`ref-classes-package_rpm`". The BitBake configuration file initially defines this variable as a sub-folder of :term:`DEPLOY_DIR`:: DEPLOY_DIR_RPM = "${DEPLOY_DIR}/rpm" - The :ref:`package_rpm ` class uses the + The :ref:`ref-classes-package_rpm` class uses the :term:`DEPLOY_DIR_RPM` variable to make sure the :ref:`ref-tasks-package_write_rpm` task writes RPM packages into the appropriate folder. For more information @@ -1834,16 +1970,15 @@ system and gives an overview of their function and contents. :term:`DEPLOY_DIR_TAR` Points to the area that the OpenEmbedded build system uses to place tarballs that are ready to be used outside of the build system. This - variable applies only when - :term:`PACKAGE_CLASSES` contains - "package_tar". + variable applies only when :term:`PACKAGE_CLASSES` contains + ":ref:`ref-classes-package_tar`". The BitBake configuration file initially defines this variable as a sub-folder of :term:`DEPLOY_DIR`:: DEPLOY_DIR_TAR = "${DEPLOY_DIR}/tar" - The :ref:`package_tar ` class uses the + The :ref:`ref-classes-package_tar` class uses the :term:`DEPLOY_DIR_TAR` variable to make sure the :ref:`ref-tasks-package_write_tar` task writes TAR packages into the appropriate folder. For more information @@ -1852,13 +1987,13 @@ system and gives an overview of their function and contents. in the Yocto Project Overview and Concepts Manual. :term:`DEPLOYDIR` - When inheriting the :ref:`deploy ` class, the + When inheriting the :ref:`ref-classes-deploy` class, the :term:`DEPLOYDIR` points to a temporary work area for deployed files that - is set in the :ref:`deploy ` class as follows:: + is set in the :ref:`ref-classes-deploy` class as follows:: DEPLOYDIR = "${WORKDIR}/deploy-${PN}" - Recipes inheriting the :ref:`deploy ` class should copy files to be + Recipes inheriting the :ref:`ref-classes-deploy` class should copy files to be deployed into :term:`DEPLOYDIR`, and the class will take care of copying them into :term:`DEPLOY_DIR_IMAGE` afterwards. @@ -1993,11 +2128,10 @@ system and gives an overview of their function and contents. :term:`DISTRO_FEATURES_FILTER_NATIVESDK` Specifies a list of features that if present in the target - :term:`DISTRO_FEATURES` value should be - included in :term:`DISTRO_FEATURES` when building nativesdk recipes. This - variable is used in addition to the features filtered using the - :term:`DISTRO_FEATURES_NATIVESDK` - variable. + :term:`DISTRO_FEATURES` value should be included in + :term:`DISTRO_FEATURES` when building :ref:`ref-classes-nativesdk` + recipes. This variable is used in addition to the features filtered using + the :term:`DISTRO_FEATURES_NATIVESDK` variable. :term:`DISTRO_FEATURES_NATIVE` Specifies a list of features that should be included in @@ -2010,10 +2144,9 @@ system and gives an overview of their function and contents. :term:`DISTRO_FEATURES_NATIVESDK` Specifies a list of features that should be included in :term:`DISTRO_FEATURES` when building - nativesdk recipes. This variable is used in addition to the features - filtered using the - :term:`DISTRO_FEATURES_FILTER_NATIVESDK` - variable. + :ref:`ref-classes-nativesdk` recipes. This variable is used + in addition to the features filtered using the + :term:`DISTRO_FEATURES_FILTER_NATIVESDK` variable. :term:`DISTRO_NAME` The long name of the distribution. For information on the short name @@ -2094,7 +2227,7 @@ system and gives an overview of their function and contents. Wiki page. :term:`DOC_COMPRESS` - When inheriting the :ref:`compress_doc ` + When inheriting the :ref:`ref-classes-compress_doc` class, this variable sets the compression policy used when the OpenEmbedded build system compresses man pages and info pages. By default, the compression method used is gz (gzip). Other policies @@ -2109,9 +2242,8 @@ system and gives an overview of their function and contents. :term:`EFI_PROVIDER` variable specifies the EFI bootloader to use. The default is "grub-efi", but "systemd-boot" can be used instead. - See the :ref:`systemd-boot ` and - :ref:`image-live ` classes for more - information. + See the :ref:`ref-classes-systemd-boot` and :ref:`ref-classes-image-live` + classes for more information. :term:`ENABLE_BINARY_LOCALE_GENERATION` Variable that controls which locales for ``glibc`` are generated @@ -2119,11 +2251,10 @@ system and gives an overview of their function and contents. less). :term:`ERR_REPORT_DIR` - When used with the :ref:`report-error ` - class, specifies the path used for storing the debug files created by - the :ref:`error reporting - tool `, which - allows you to submit build errors you encounter to a central + When used with the :ref:`ref-classes-report-error` class, specifies the + path used for storing the debug files created by the :ref:`error reporting + tool `, + which allows you to submit build errors you encounter to a central database. By default, the value of this variable is ``${``\ :term:`LOG_DIR`\ ``}/error-report``. @@ -2267,12 +2398,17 @@ system and gives an overview of their function and contents. When kernel tools are available in the tree, they are preferred over any externally installed tools. Setting the :term:`EXTERNAL_KERNEL_TOOLS` variable tells the OpenEmbedded build system to prefer the installed - external tools. See the - :ref:`kernel-yocto ` class in + external tools. See the :ref:`ref-classes-kernel-yocto` class in ``meta/classes-recipe`` to see how the variable is used. + :term:`EXTERNAL_TOOLCHAIN` + When you intend to use an + :ref:`external toolchain `, + this variable allows to specify the directory where this toolchain was + installed. + :term:`EXTERNALSRC` - When inheriting the :ref:`externalsrc ` + When inheriting the :ref:`ref-classes-externalsrc` class, this variable points to the source tree, which is outside of the OpenEmbedded build system. When set, this variable sets the :term:`S` variable, which is what the OpenEmbedded build @@ -2280,11 +2416,11 @@ system and gives an overview of their function and contents. See the ":ref:`ref-classes-externalsrc`" section for details. You can also find information on how to use this variable in the - ":ref:`dev-manual/common-tasks:building software from an external source`" + ":ref:`dev-manual/building:building software from an external source`" section in the Yocto Project Development Tasks Manual. :term:`EXTERNALSRC_BUILD` - When inheriting the :ref:`externalsrc ` + When inheriting the :ref:`ref-classes-externalsrc` class, this variable points to the directory in which the recipe's source code is built, which is outside of the OpenEmbedded build system. When set, this variable sets the :term:`B` variable, @@ -2293,11 +2429,11 @@ system and gives an overview of their function and contents. See the ":ref:`ref-classes-externalsrc`" section for details. You can also find information on how to use this variable in the - ":ref:`dev-manual/common-tasks:building software from an external source`" + ":ref:`dev-manual/building:building software from an external source`" section in the Yocto Project Development Tasks Manual. :term:`EXTRA_AUTORECONF` - For recipes inheriting the :ref:`autotools ` + For recipes inheriting the :ref:`ref-classes-autotools` class, you can use :term:`EXTRA_AUTORECONF` to specify extra options to pass to the ``autoreconf`` command that is executed during the :ref:`ref-tasks-configure` task. @@ -2330,7 +2466,7 @@ system and gives an overview of their function and contents. useful if you want to develop against the libraries in the image. - "read-only-rootfs" --- creates an image whose root filesystem is read-only. See the - ":ref:`dev-manual/common-tasks:creating a read-only root filesystem`" + ":ref:`dev-manual/read-only-rootfs:creating a read-only root filesystem`" section in the Yocto Project Development Tasks Manual for more information - "tools-debug" --- adds debugging tools such as gdb and strace. @@ -2343,7 +2479,7 @@ system and gives an overview of their function and contents. Project, see the ":ref:`ref-features-image`" section. For an example that shows how to customize your image by using this - variable, see the ":ref:`dev-manual/common-tasks:customizing images using custom \`\`image_features\`\` and \`\`extra_image_features\`\``" + variable, see the ":ref:`dev-manual/customizing-images:customizing images using custom \`\`image_features\`\` and \`\`extra_image_features\`\``" section in the Yocto Project Development Tasks Manual. :term:`EXTRA_IMAGECMD` @@ -2370,7 +2506,7 @@ system and gives an overview of their function and contents. :term:`EXTRA_OECMAKE` Additional `CMake `__ options. See the - :ref:`cmake ` class for additional information. + :ref:`ref-classes-cmake` class for additional information. :term:`EXTRA_OECONF` Additional ``configure`` script options. See @@ -2388,21 +2524,22 @@ system and gives an overview of their function and contents. :term:`EXTRA_OEMAKE` to pass the required flags. :term:`EXTRA_OESCONS` - When inheriting the :ref:`scons ` class, this + When inheriting the :ref:`ref-classes-scons` class, this variable specifies additional configuration options you want to pass to the ``scons`` command line. :term:`EXTRA_USERS_PARAMS` - When inheriting the :ref:`extrausers ` + When inheriting the :ref:`ref-classes-extrausers` class, this variable provides image level user and group operations. This is a more global method of providing user and group configuration as compared to using the - :ref:`useradd ` class, which ties user and + :ref:`ref-classes-useradd` class, which ties user and group configurations to a specific recipe. The set list of commands you can configure using the - :term:`EXTRA_USERS_PARAMS` is shown in the :ref:`extrausers ` class. These - commands map to the normal Unix commands of the same names:: + :term:`EXTRA_USERS_PARAMS` is shown in the + :ref:`ref-classes-extrausers` class. These commands map to the normal + Unix commands of the same names:: # EXTRA_USERS_PARAMS = "\ # useradd -p '' tester; \ @@ -2465,6 +2602,24 @@ system and gives an overview of their function and contents. EXTRANATIVEPATH = "foo bar" + :term:`FAKEROOT` + See :term:`bitbake:FAKEROOT` in the BitBake manual. + + :term:`FAKEROOTBASEENV` + See :term:`bitbake:FAKEROOTBASEENV` in the BitBake manual. + + :term:`FAKEROOTCMD` + See :term:`bitbake:FAKEROOTCMD` in the BitBake manual. + + :term:`FAKEROOTDIRS` + See :term:`bitbake:FAKEROOTDIRS` in the BitBake manual. + + :term:`FAKEROOTENV` + See :term:`bitbake:FAKEROOTENV` in the BitBake manual. + + :term:`FAKEROOTNOENV` + See :term:`bitbake:FAKEROOTNOENV` in the BitBake manual. + :term:`FEATURE_PACKAGES` Defines one or more packages to include in an image when a specific item is included in :term:`IMAGE_FEATURES`. @@ -2500,6 +2655,12 @@ system and gives an overview of their function and contents. a set of configuration files for you in your target that work with the feed. + :term:`FETCHCMD` + See :term:`bitbake:FETCHCMD` in the BitBake manual. + + :term:`FILE` + See :term:`bitbake:FILE` in the BitBake manual. + :term:`FILES` The list of files and directories that are placed in a package. The :term:`PACKAGES` variable lists the packages @@ -2688,7 +2849,7 @@ system and gives an overview of their function and contents. You can find out more about the patching process in the ":ref:`overview-manual/concepts:patching`" section in the Yocto Project Overview and Concepts Manual and the - ":ref:`dev-manual/common-tasks:patching code`" section in + ":ref:`dev-manual/new-recipe:patching code`" section in the Yocto Project Development Tasks Manual. See the :ref:`ref-tasks-patch` task as well. @@ -2716,7 +2877,7 @@ system and gives an overview of their function and contents. :term:`FIT_DESC` Specifies the description string encoded into a fitImage. The default - value is set by the :ref:`kernel-fitimage ` + value is set by the :ref:`ref-classes-kernel-fitimage` class as follows:: FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}" @@ -2762,7 +2923,7 @@ system and gives an overview of their function and contents. The default value is "pkcs-1.5". :term:`FIT_SIGN_INDIVIDUAL` - If set to "1", then the :ref:`kernel-fitimage ` + If set to "1", then the :ref:`ref-classes-kernel-fitimage` class will sign the kernel, dtb and ramdisk images individually in addition to signing the fitImage itself. This could be useful if you are intending to verify signatures in another context than booting via @@ -2773,14 +2934,14 @@ system and gives an overview of their function and contents. value is "2048". :term:`FONT_EXTRA_RDEPENDS` - When inheriting the :ref:`fontcache ` class, + When inheriting the :ref:`ref-classes-fontcache` class, this variable specifies the runtime dependencies for font packages. By default, the :term:`FONT_EXTRA_RDEPENDS` is set to "fontconfig-utils". :term:`FONT_PACKAGES` - When inheriting the :ref:`fontcache ` class, - this variable identifies packages containing font files that need to - be cached by Fontconfig. By default, the :ref:`fontcache ` class assumes + When inheriting the :ref:`ref-classes-fontcache` class, this variable + identifies packages containing font files that need to be cached by + Fontconfig. By default, the :ref:`ref-classes-fontcache` class assumes that fonts are in the recipe's main package (i.e. ``${``\ :term:`PN`\ ``}``). Use this variable if fonts you need are in a package other than that main package. @@ -2823,7 +2984,7 @@ system and gives an overview of their function and contents. Allows to specify an extra search path for ``.so`` files in GLib related recipes using GObject introspection, and which do not compile without this setting. - See the ":ref:`dev-manual/common-tasks:enabling gobject introspection support`" + See the ":ref:`dev-manual/gobject-introspection:enabling gobject introspection support`" section for details. :term:`GITDIR` @@ -2831,7 +2992,7 @@ system and gives an overview of their function and contents. when it is cloned. :term:`GITHUB_BASE_URI` - When inheriting the :ref:`github-releases ` + When inheriting the :ref:`ref-classes-github-releases` class, specifies the base URL for fetching releases for the github project you wish to fetch sources from. The default value is as follows:: @@ -2847,13 +3008,12 @@ system and gives an overview of their function and contents. :term:`IMAGE_LINGUAS` appropriately. You can set :term:`GLIBC_GENERATE_LOCALES` in your ``local.conf`` file. - By default, all locales are generated. - :: + By default, all locales are generated:: GLIBC_GENERATE_LOCALES = "en_GB.UTF-8 en_US.UTF-8" :term:`GROUPADD_PARAM` - When inheriting the :ref:`useradd ` class, + When inheriting the :ref:`ref-classes-useradd` class, this variable specifies for a package what parameters should be passed to the ``groupadd`` command if you wish to add a group to the system when the package is installed. @@ -2866,7 +3026,7 @@ system and gives an overview of their function and contents. ``groupadd``, see https://linux.die.net/man/8/groupadd. :term:`GROUPMEMS_PARAM` - When inheriting the :ref:`useradd ` class, + When inheriting the :ref:`ref-classes-useradd` class, this variable specifies for a package what parameters should be passed to the ``groupmems`` command if you wish to modify the members of a group when the package is installed. @@ -2880,7 +3040,7 @@ system and gives an overview of their function and contents. ``local.conf`` or distribution configuration file to enable graphics and serial in the menu. - See the :ref:`grub-efi ` class for more + See the :ref:`ref-classes-grub-efi` class for more information on how this variable is used. :term:`GRUB_OPTS` @@ -2889,7 +3049,7 @@ system and gives an overview of their function and contents. multiple options. The :term:`GRUB_OPTS` variable is optional. See the - :ref:`grub-efi ` class for more information + :ref:`ref-classes-grub-efi` class for more information on how this variable is used. :term:`GRUB_TIMEOUT` @@ -2897,16 +3057,18 @@ system and gives an overview of their function and contents. GNU GRand Unified Bootloader (GRUB). The :term:`GRUB_TIMEOUT` variable is optional. See the - :ref:`grub-efi ` class for more information + :ref:`ref-classes-grub-efi` class for more information on how this variable is used. :term:`GTKIMMODULES_PACKAGES` - When inheriting the - :ref:`gtk-immodules-cache ` class, + When inheriting the :ref:`ref-classes-gtk-immodules-cache` class, this variable specifies the packages that contain the GTK+ input method modules being installed when the modules are in packages other than the main package. + :term:`HGDIR` + See :term:`bitbake:HGDIR` in the BitBake manual. + :term:`HOMEPAGE` Website where more information about the software the recipe is building can be found. @@ -3002,7 +3164,7 @@ system and gives an overview of their function and contents. :term:`ICECC_CLASS_DISABLE` Identifies user classes that you do not want the Icecream distributed compile support to consider. This variable is used by the - :ref:`icecc ` class. You set this variable in + :ref:`ref-classes-icecc` class. You set this variable in your ``local.conf`` file. When you list classes using this variable, the recipes inheriting @@ -3026,7 +3188,7 @@ system and gives an overview of their function and contents. :term:`ICECC_ENV_EXEC` Points to the ``icecc-create-env`` script that you provide. This - variable is used by the :ref:`icecc ` class. You + variable is used by the :ref:`ref-classes-icecc` class. You set this variable in your ``local.conf`` file. If you do not point to a script that you provide, the OpenEmbedded @@ -3063,13 +3225,13 @@ system and gives an overview of their function and contents. :term:`ICECC_PATH` The location of the ``icecc`` binary. You can set this variable in your ``local.conf`` file. If your ``local.conf`` file does not define - this variable, the :ref:`icecc ` class attempts + this variable, the :ref:`ref-classes-icecc` class attempts to define it by locating ``icecc`` using ``which``. :term:`ICECC_RECIPE_DISABLE` Identifies user recipes that you do not want the Icecream distributed compile support to consider. This variable is used by the - :ref:`icecc ` class. You set this variable in + :ref:`ref-classes-icecc` class. You set this variable in your ``local.conf`` file. When you list recipes using this variable, you are excluding them @@ -3081,7 +3243,7 @@ system and gives an overview of their function and contents. :term:`PARALLEL_MAKE` variable that you want to force remote distributed compilation on using the Icecream distributed compile support. This variable is used by the - :ref:`icecc ` class. You set this variable in + :ref:`ref-classes-icecc` class. You set this variable in your ``local.conf`` file. :term:`IMAGE_BASENAME` @@ -3117,18 +3279,18 @@ system and gives an overview of their function and contents. the same files into a ``boot`` directory within the target partition. You can find information on how to use the Wic tool in the - ":ref:`dev-manual/common-tasks:creating partitioned images using wic`" + ":ref:`dev-manual/wic:creating partitioned images using wic`" section of the Yocto Project Development Tasks Manual. Reference material for Wic is located in the ":doc:`/ref-manual/kickstart`" chapter. :term:`IMAGE_BUILDINFO_FILE` - When using the :ref:`image-buildinfo ` class, + When using the :ref:`ref-classes-image-buildinfo` class, specifies the file in the image to write the build information into. The default value is "``${sysconfdir}/buildinfo``". :term:`IMAGE_BUILDINFO_VARS` - When using the :ref:`image-buildinfo ` class, + When using the :ref:`ref-classes-image-buildinfo` class, specifies the list of variables to include in the `Build Configuration` section of the output file (as a space-separated list). Defaults to ":term:`DISTRO` :term:`DISTRO_VERSION`". @@ -3153,7 +3315,7 @@ system and gives an overview of their function and contents. You typically do not need to set this variable unless you are adding support for a new image type. For more examples on how to set this - variable, see the :ref:`image_types ` + variable, see the :ref:`ref-classes-image_types` class file, which is ``meta/classes-recipe/image_types.bbclass``. :term:`IMAGE_DEVICE_TABLES` @@ -3195,7 +3357,7 @@ system and gives an overview of their function and contents. the same files into a ``boot`` directory within the target partition. You can find information on how to use the Wic tool in the - ":ref:`dev-manual/common-tasks:creating partitioned images using wic`" + ":ref:`dev-manual/wic:creating partitioned images using wic`" section of the Yocto Project Development Tasks Manual. Reference material for Wic is located in the ":doc:`/ref-manual/kickstart`" chapter. @@ -3216,7 +3378,7 @@ system and gives an overview of their function and contents. the ":ref:`ref-features-image`" section. For an example that shows how to customize your image by using this - variable, see the ":ref:`dev-manual/common-tasks:customizing images using custom \`\`image_features\`\` and \`\`extra_image_features\`\``" + variable, see the ":ref:`dev-manual/customizing-images:customizing images using custom \`\`image_features\`\` and \`\`extra_image_features\`\``" section in the Yocto Project Development Tasks Manual. :term:`IMAGE_FSTYPES` @@ -3243,16 +3405,15 @@ system and gives an overview of their function and contents. :term:`IMAGE_INSTALL` Used by recipes to specify the packages to install into an image - through the :ref:`image ` class. Use the + through the :ref:`ref-classes-image` class. Use the :term:`IMAGE_INSTALL` variable with care to avoid ordering issues. Image recipes set :term:`IMAGE_INSTALL` to specify the packages to install into an image through :ref:`ref-classes-image`. Additionally, - there are "helper" classes such as the - :ref:`core-image ` class which can - take lists used with :term:`IMAGE_FEATURES` and turn them into - auto-generated entries in :term:`IMAGE_INSTALL` in addition to its - default contents. + there are "helper" classes such as the :ref:`ref-classes-core-image` + class which can take lists used with :term:`IMAGE_FEATURES` and turn + them into auto-generated entries in :term:`IMAGE_INSTALL` in addition + to its default contents. When you use this variable, it is best to use it as follows:: @@ -3272,7 +3433,7 @@ system and gives an overview of their function and contents. allows the initial RAM filesystem (:term:`Initramfs`) recipe to use a fixed set of packages and not be affected by :term:`IMAGE_INSTALL`. For information on creating an :term:`Initramfs`, see the - ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" + ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in the Yocto Project Development Tasks Manual. - Using :term:`IMAGE_INSTALL` with the @@ -3385,19 +3546,16 @@ system and gives an overview of their function and contents. :term:`IMAGE_PKGTYPE` Defines the package type (i.e. DEB, RPM, IPK, or TAR) used by the OpenEmbedded build system. The variable is defined appropriately by - the :ref:`package_deb `, - :ref:`package_rpm `, - :ref:`package_ipk `, or - :ref:`package_tar ` class. + the :ref:`ref-classes-package_deb`, :ref:`ref-classes-package_rpm`, + :ref:`ref-classes-package_ipk`, or :ref:`ref-classes-package_tar` class. .. note:: The ``package_tar`` class is broken and is not supported. It is recommended that you do not use it. - The :ref:`populate_sdk_* ` and - :ref:`image ` classes use the :term:`IMAGE_PKGTYPE` - for packaging up images and SDKs. + The :ref:`ref-classes-populate-sdk-*` and :ref:`ref-classes-image` + classes use the :term:`IMAGE_PKGTYPE` for packaging up images and SDKs. You should not set the :term:`IMAGE_PKGTYPE` manually. Rather, the variable is set indirectly through the appropriate @@ -3494,7 +3652,7 @@ system and gives an overview of their function and contents. :term:`IMAGE_TYPEDEP` Specifies a dependency from one image type on another. Here is an - example from the :ref:`image-live ` class:: + example from the :ref:`ref-classes-image-live` class:: IMAGE_TYPEDEP:live = "ext3" @@ -3561,16 +3719,16 @@ system and gives an overview of their function and contents. the build artifacts. :term:`IMGDEPLOYDIR` - When inheriting the :ref:`image ` class directly or - through the :ref:`core-image ` class, the + When inheriting the :ref:`ref-classes-image` class directly or + through the :ref:`ref-classes-core-image` class, the :term:`IMGDEPLOYDIR` points to a temporary work area for deployed files that is set in the ``image`` class as follows:: IMGDEPLOYDIR = "${WORKDIR}/deploy-${PN}-image-complete" - Recipes inheriting the ``image`` class should copy files to be - deployed into :term:`IMGDEPLOYDIR`, and the class will take care of - copying them into :term:`DEPLOY_DIR_IMAGE` afterwards. + Recipes inheriting the :ref:`ref-classes-image` class should copy + files to be deployed into :term:`IMGDEPLOYDIR`, and the class will take + care of copying them into :term:`DEPLOY_DIR_IMAGE` afterwards. :term:`INC_PR` Helps define the recipe revision for recipes that share a common @@ -3711,10 +3869,9 @@ system and gives an overview of their function and contents. :term:`INHIBIT_SYSROOT_STRIP` variable to "1" in your recipe, you inhibit this stripping. - If you want to use this variable, include the - :ref:`staging ` class. This class uses a - ``sys_strip()`` function to test for the variable and acts - accordingly. + If you want to use this variable, include the :ref:`ref-classes-staging` + class. This class uses a ``sys_strip()`` function to test for the variable + and acts accordingly. .. note:: @@ -3746,7 +3903,7 @@ system and gives an overview of their function and contents. This kind of mechanism is typically used for two reasons: - For booting the same kernel binary on multiple systems requiring - different device drivers. The Initramfs image is then customized + different device drivers. The :term:`Initramfs` image is then customized for each type of system, to include the specific kernel modules necessary to access the final root filesystem. This technique is used on all GNU / Linux distributions for desktops and servers. @@ -3763,15 +3920,16 @@ system and gives an overview of their function and contents. or be included in the kernel binary. For information on creating and using an :term:`Initramfs`, see the - ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" + ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in the Yocto Project Development Tasks Manual. :term:`INITRAMFS_DEPLOY_DIR_IMAGE` - Indicates the deploy directory used by :ref:`ref-tasks-bundle_initramfs` where the - :term:`INITRAMFS_IMAGE` will be fetched from. - This variable is set by default to ``${DEPLOY_DIR_IMAGE}`` in the - :ref:`kernel ` class and it's only meant to be changed - when building an :term:`Initramfs` image from a separate multiconfig via :term:`INITRAMFS_MULTICONFIG`. + Indicates the deploy directory used by :ref:`ref-tasks-bundle_initramfs` + where the :term:`INITRAMFS_IMAGE` will be fetched from. This variable is + set by default to ``${DEPLOY_DIR_IMAGE}`` in the + :ref:`ref-classes-kernel` class and it's only meant to be changed when + building an :term:`Initramfs` image from a separate multiconfig via + :term:`INITRAMFS_MULTICONFIG`. :term:`INITRAMFS_FSTYPES` Defines the format for the output image of an initial RAM filesystem @@ -3810,9 +3968,9 @@ system and gives an overview of their function and contents. You can also find more information by referencing the ``meta-poky/conf/templates/default/local.conf.sample.extended`` - configuration file in the Source Directory, the :ref:`image - ` class, and the :ref:`kernel ` - class to see how to use the :term:`INITRAMFS_IMAGE` variable. + configuration file in the Source Directory, the :ref:`ref-classes-image` + class, and the :ref:`ref-classes-kernel` class to see how to use the + :term:`INITRAMFS_IMAGE` variable. If :term:`INITRAMFS_IMAGE` is empty, which is the default, then no :term:`Initramfs` image is built. @@ -3821,7 +3979,7 @@ system and gives an overview of their function and contents. :term:`INITRAMFS_IMAGE_BUNDLE` variable, which allows the generated image to be bundled inside the kernel image. Additionally, for information on creating an :term:`Initramfs` - image, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section + image, see the ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in the Yocto Project Development Tasks Manual. :term:`INITRAMFS_IMAGE_BUNDLE` @@ -3859,8 +4017,7 @@ system and gives an overview of their function and contents. INITRAMFS_IMAGE_BUNDLE = "1" - By default, the - :ref:`kernel ` class sets this variable to a + By default, the :ref:`ref-classes-kernel` class sets this variable to a null string as follows:: INITRAMFS_IMAGE_BUNDLE ?= "" @@ -3873,7 +4030,7 @@ system and gives an overview of their function and contents. See the :yocto_git:`local.conf.sample.extended ` file for additional information. Also, for information on creating an - :term:`Initramfs`, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section + :term:`Initramfs`, see the ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in the Yocto Project Development Tasks Manual. :term:`INITRAMFS_LINK_NAME` @@ -3893,13 +4050,14 @@ system and gives an overview of their function and contents. information. :term:`INITRAMFS_MULTICONFIG` - Defines the multiconfig to create a multiconfig dependency to be used by the :ref:`kernel ` class. + Defines the multiconfig to create a multiconfig dependency to be used by + the :ref:`ref-classes-kernel` class. This allows the kernel to bundle an :term:`INITRAMFS_IMAGE` coming from a separate multiconfig, this is meant to be used in addition to :term:`INITRAMFS_DEPLOY_DIR_IMAGE`. For more information on how to bundle an :term:`Initramfs` image from a separate - multiconfig see the ":ref:`dev-manual/common-tasks:Bundling an Initramfs Image From a Separate Multiconfig`" + multiconfig see the ":ref:`dev-manual/building:Bundling an Initramfs Image From a Separate Multiconfig`" section in the Yocto Project Development Tasks Manual. :term:`INITRAMFS_NAME` @@ -3919,7 +4077,7 @@ system and gives an overview of their function and contents. initial RAM disk (``initrd``). The :term:`INITRD` variable is an optional variable used with the - :ref:`image-live ` class. + :ref:`ref-classes-image-live` class. :term:`INITRD_IMAGE` When building a "live" bootable image (i.e. when @@ -3928,8 +4086,7 @@ system and gives an overview of their function and contents. provide the initial RAM disk image. The default value is "core-image-minimal-initramfs". - See the :ref:`image-live ` class for more - information. + See the :ref:`ref-classes-image-live` class for more information. :term:`INITSCRIPT_NAME` The filename of the initialization script as installed to @@ -3956,7 +4113,7 @@ system and gives an overview of their function and contents. in initlevels 2 and 5, and stops the script in levels 0, 1 and 6. The variable's default value is "defaults", which is set in the - :ref:`update-rc.d ` class. + :ref:`ref-classes-update-rc.d` class. The value in :term:`INITSCRIPT_PARAMS` is passed through to the ``update-rc.d`` command. For more information on valid parameters, @@ -4034,7 +4191,7 @@ system and gives an overview of their function and contents. BSP. :term:`KBUILD_DEFCONFIG` - When used with the :ref:`kernel-yocto ` + When used with the :ref:`ref-classes-kernel-yocto` class, specifies an "in-tree" kernel configuration file for use during a kernel build. @@ -4067,7 +4224,7 @@ system and gives an overview of their function and contents. section in the Yocto Project Linux Kernel Development Manual. :term:`KCONFIG_MODE` - When used with the :ref:`kernel-yocto ` + When used with the :ref:`ref-classes-kernel-yocto` class, specifies the kernel configuration values to use for options not specified in the provided ``defconfig`` file. Valid options are:: @@ -4124,12 +4281,12 @@ system and gives an overview of their function and contents. :term:`KERNEL_CLASSES` A list of classes defining kernel image types that the - :ref:`kernel ` class should inherit. You - typically append this variable to enable extended image types. An - example is the "kernel-fitimage", which enables fitImage support and - resides in ``meta/classes-recipe/kernel-fitimage.bbclass``. You can register - custom kernel image types with the :ref:`kernel ` class using this - variable. + :ref:`ref-classes-kernel` class should inherit. You typically + append this variable to enable extended image types. An example is + ":ref:`ref-classes-kernel-fitimage`", which enables + fitImage support and resides in ``meta/classes-recipe/kernel-fitimage.bbclass``. + You can register custom kernel image types with the + :ref:`ref-classes-kernel` class using this variable. :term:`KERNEL_DEBUG_TIMESTAMPS` If set to "1", enables timestamping functionality during building @@ -4151,9 +4308,8 @@ system and gives an overview of their function and contents. There is legacy support for specifying the full path to the device tree. However, providing just the ``.dtb`` file is preferred. - In order to use this variable, the - :ref:`kernel-devicetree ` class must - be inherited. + In order to use this variable, the :ref:`ref-classes-kernel-devicetree` + class must be inherited. :term:`KERNEL_DTB_LINK_NAME` The link name of the kernel device tree binary (DTB). This variable @@ -4188,9 +4344,8 @@ system and gives an overview of their function and contents. system when generating the device trees (via ``DTC_FLAGS`` environment variable). - In order to use this variable, the - :ref:`kernel-devicetree ` class must - be inherited. + In order to use this variable, the :ref:`ref-classes-kernel-devicetree` + class must be inherited. :term:`KERNEL_EXTRA_ARGS` Specifies additional ``make`` command-line arguments the OpenEmbedded @@ -4341,9 +4496,8 @@ system and gives an overview of their function and contents. :term:`KERNEL_PATH` The location of the kernel sources. This variable is set to the value - of the :term:`STAGING_KERNEL_DIR` within - the :ref:`module ` class. For information on - how this variable is used, see the + of the :term:`STAGING_KERNEL_DIR` within the :ref:`ref-classes-module` + class. For information on how this variable is used, see the ":ref:`kernel-dev/common:incorporating out-of-tree modules`" section in the Yocto Project Linux Kernel Development Manual. @@ -4355,9 +4509,8 @@ system and gives an overview of their function and contents. :term:`KERNEL_SRC` The location of the kernel sources. This variable is set to the value - of the :term:`STAGING_KERNEL_DIR` within - the :ref:`module ` class. For information on - how this variable is used, see the + of the :term:`STAGING_KERNEL_DIR` within the :ref:`ref-classes-module` + class. For information on how this variable is used, see the ":ref:`kernel-dev/common:incorporating out-of-tree modules`" section in the Yocto Project Linux Kernel Development Manual. @@ -4435,7 +4588,7 @@ system and gives an overview of their function and contents. :term:`LABELS` Provides a list of targets for automatic configuration. - See the :ref:`grub-efi ` class for more + See the :ref:`ref-classes-grub-efi` class for more information on how this variable is used. :term:`LAYERDEPENDS` @@ -4460,6 +4613,9 @@ system and gives an overview of their function and contents. available outside of ``layer.conf`` and references are expanded immediately when parsing of the file completes. + :term:`LAYERDIR_RE` + See :term:`bitbake:LAYERDIR_RE` in the BitBake manual. + :term:`LAYERRECOMMENDS` Lists the layers, separated by spaces, recommended for use with this layer. @@ -4501,7 +4657,7 @@ system and gives an overview of their function and contents. The OpenEmbedded build system produces a warning if the variable is not set for any given layer. - See the ":ref:`dev-manual/common-tasks:creating your own layer`" + See the ":ref:`dev-manual/layers:creating your own layer`" section in the Yocto Project Development Tasks Manual. :term:`LAYERVERSION` @@ -4534,10 +4690,11 @@ system and gives an overview of their function and contents. :term:`LEAD_SONAME` Specifies the lead (or primary) compiled library file (i.e. ``.so``) - that the :ref:`debian ` class applies its + that the :ref:`ref-classes-debian` class applies its naming policy to given a recipe that packages multiple libraries. - This variable works in conjunction with the :ref:`debian ` class. + This variable works in conjunction with the :ref:`ref-classes-debian` + class. :term:`LIC_FILES_CHKSUM` Checksums of the license text in the recipe source code. @@ -4550,7 +4707,7 @@ system and gives an overview of their function and contents. This variable must be defined for all recipes (unless :term:`LICENSE` is set to "CLOSED"). - For more information, see the ":ref:`dev-manual/common-tasks:tracking license changes`" + For more information, see the ":ref:`dev-manual/licenses:tracking license changes`" section in the Yocto Project Development Tasks Manual. :term:`LICENSE` @@ -4614,7 +4771,7 @@ system and gives an overview of their function and contents. For related information on providing license text, see the :term:`COPY_LIC_DIRS` variable, the :term:`COPY_LIC_MANIFEST` variable, and the - ":ref:`dev-manual/common-tasks:providing license text`" + ":ref:`dev-manual/licenses:providing license text`" section in the Yocto Project Development Tasks Manual. :term:`LICENSE_FLAGS` @@ -4627,14 +4784,14 @@ system and gives an overview of their function and contents. typically used to mark recipes that might require additional licenses in order to be used in a commercial product. For more information, see the - ":ref:`dev-manual/common-tasks:enabling commercially licensed recipes`" + ":ref:`dev-manual/licenses:enabling commercially licensed recipes`" section in the Yocto Project Development Tasks Manual. :term:`LICENSE_FLAGS_ACCEPTED` Lists license flags that when specified in :term:`LICENSE_FLAGS` within a recipe should not prevent that recipe from being built. For more information, see the - ":ref:`dev-manual/common-tasks:enabling commercially licensed recipes`" + ":ref:`dev-manual/licenses:enabling commercially licensed recipes`" section in the Yocto Project Development Tasks Manual. :term:`LICENSE_PATH` @@ -4922,7 +5079,7 @@ system and gives an overview of their function and contents. determined by :term:`COREBASE`). :term:`MIME_XDG_PACKAGES` - The current implementation of the :ref:`mime-xdg ` + The current implementation of the :ref:`ref-classes-mime-xdg` class cannot detect ``.desktop`` files installed through absolute symbolic links. Use this setting to make the class create post-install and post-remove scripts for these packages anyway, to invoke the @@ -4949,19 +5106,19 @@ system and gives an overview of their function and contents. .. note:: - The "ML" in :term:`MLPREFIX` stands for "MultiLib". This representation is - historical and comes from a time when ``nativesdk`` was a suffix - rather than a prefix on the recipe name. When ``nativesdk`` was turned - into a prefix, it made sense to set :term:`MLPREFIX` for it as well. + The "ML" in :term:`MLPREFIX` stands for "MultiLib". This representation + is historical and comes from a time when ":ref:`ref-classes-nativesdk`" + was a suffix rather than a prefix on the recipe name. When + ":ref:`ref-classes-nativesdk`" was turned into a prefix, it made sense + to set :term:`MLPREFIX` for it as well. To help understand when :term:`MLPREFIX` might be needed, consider when - :term:`BBCLASSEXTEND` is used to provide a - ``nativesdk`` version of a recipe in addition to the target version. - If that recipe declares build-time dependencies on tasks in other - recipes by using :term:`DEPENDS`, then a dependency on - "foo" will automatically get rewritten to a dependency on - "nativesdk-foo". However, dependencies like the following will not - get rewritten automatically:: + :term:`BBCLASSEXTEND` is used to provide a :ref:`ref-classes-nativesdk` + version of a recipe in addition to the target version. If that recipe + declares build-time dependencies on tasks in other recipes by using + :term:`DEPENDS`, then a dependency on "foo" will automatically get + rewritten to a dependency on "nativesdk-foo". However, dependencies like + the following will not get rewritten automatically:: do_foo[depends] += "recipe:do_foo" @@ -5060,8 +5217,7 @@ system and gives an overview of their function and contents. ${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS} - Some classes (e.g. - :ref:`cross-canadian `) modify the + Some classes (e.g. :ref:`ref-classes-cross-canadian`) modify the :term:`MULTIMACH_TARGET_SYS` value. See the :term:`STAMP` variable for an example. See the @@ -5163,7 +5319,7 @@ system and gives an overview of their function and contents. The minimal command and arguments to run ``objdump``. :term:`OE_BINCONFIG_EXTRA_MANGLE` - When inheriting the :ref:`binconfig ` class, + When inheriting the :ref:`ref-classes-binconfig` class, this variable specifies additional arguments passed to the "sed" command. The sed command alters any paths in configuration scripts that have been set up during compilation. Inheriting this class @@ -5195,7 +5351,7 @@ system and gives an overview of their function and contents. Controls how the OpenEmbedded build system spawns interactive terminals on the host development system (e.g. using the BitBake command with the ``-c devshell`` command-line option). For more - information, see the ":ref:`dev-manual/common-tasks:using a development shell`" section in + information, see the ":ref:`dev-manual/development-shell:using a development shell`" section in the Yocto Project Development Tasks Manual. You can use the following values for the :term:`OE_TERMINAL` variable: @@ -5229,68 +5385,67 @@ system and gives an overview of their function and contents. configuration file. :term:`OVERLAYFS_ETC_DEVICE` - When the :ref:`overlayfs-etc ` class is + When the :ref:`ref-classes-overlayfs-etc` class is inherited, specifies the device to be mounted for the read/write layer of ``/etc``. There is no default, so you must set this if you - wish to enable :ref:`overlayfs-etc `, for + wish to enable :ref:`ref-classes-overlayfs-etc`, for example, assuming ``/dev/mmcblk0p2`` was the desired device:: OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2" :term:`OVERLAYFS_ETC_EXPOSE_LOWER` - When the :ref:`overlayfs-etc ` class is + When the :ref:`ref-classes-overlayfs-etc` class is inherited, if set to "1" then a read-only access to the original ``/etc`` content will be provided as a ``lower/`` subdirectory of :term:`OVERLAYFS_ETC_MOUNT_POINT`. The default value is "0". :term:`OVERLAYFS_ETC_FSTYPE` - When the :ref:`overlayfs-etc ` class is + When the :ref:`ref-classes-overlayfs-etc` class is inherited, specifies the file system type for the read/write layer of ``/etc``. There is no default, so you must set this if you - wish to enable :ref:`overlayfs-etc `, + wish to enable :ref:`ref-classes-overlayfs-etc`, for example, assuming the file system is ext4:: OVERLAYFS_ETC_FSTYPE = "ext4" :term:`OVERLAYFS_ETC_MOUNT_OPTIONS` - When the :ref:`overlayfs-etc ` class is + When the :ref:`ref-classes-overlayfs-etc` class is inherited, specifies the mount options for the read-write layer. The default value is "defaults". :term:`OVERLAYFS_ETC_MOUNT_POINT` - When the :ref:`overlayfs-etc ` class is + When the :ref:`ref-classes-overlayfs-etc` class is inherited, specifies the parent mount path for the filesystem layers. There is no default, so you must set this if you wish to enable - :ref:`overlayfs-etc `, for example if - the desired path is "/data":: + :ref:`ref-classes-overlayfs-etc`, for example if the desired path is + "/data":: OVERLAYFS_ETC_MOUNT_POINT = "/data" :term:`OVERLAYFS_ETC_USE_ORIG_INIT_NAME` - When the :ref:`overlayfs-etc ` class is - inherited, controls how the generated init will be named. For more - information, see the :ref:`overlayfs-etc ` - class documentation. The default value is "1". + When the :ref:`ref-classes-overlayfs-etc` class is inherited, controls + how the generated init will be named. For more information, see the + :ref:`ref-classes-overlayfs-etc` class documentation. The default value + is "1". :term:`OVERLAYFS_MOUNT_POINT` - When inheriting the :ref:`overlayfs ` class, + When inheriting the :ref:`ref-classes-overlayfs` class, specifies mount point(s) to be used. For example:: OVERLAYFS_MOUNT_POINT[data] = "/data" - The assumes you have a ``data.mount`` systemd unit defined elsewhere - in your BSP (e.g. in ``systemd-machine-units`` recipe) and it is - installed into the image. For more information see - :ref:`overlayfs `. + The assumes you have a ``data.mount`` systemd unit defined elsewhere in + your BSP (e.g. in ``systemd-machine-units`` recipe) and it is installed + into the image. For more information see :ref:`ref-classes-overlayfs`. .. note:: - Although the :ref:`overlayfs ` class is + Although the :ref:`ref-classes-overlayfs` class is inherited by individual recipes, :term:`OVERLAYFS_MOUNT_POINT` should be set in your machine configuration. :term:`OVERLAYFS_QA_SKIP` - When inheriting the :ref:`overlayfs ` class, + When inheriting the :ref:`ref-classes-overlayfs` class, provides the ability to disable QA checks for particular overlayfs mounts. For example:: @@ -5298,12 +5453,12 @@ system and gives an overview of their function and contents. .. note:: - Although the :ref:`overlayfs ` class is + Although the :ref:`ref-classes-overlayfs` class is inherited by individual recipes, :term:`OVERLAYFS_QA_SKIP` should be set in your machine configuration. :term:`OVERLAYFS_WRITABLE_PATHS` - When inheriting the :ref:`overlayfs ` class, + When inheriting the :ref:`ref-classes-overlayfs` class, specifies writable paths used at runtime for the recipe. For example:: @@ -5343,7 +5498,7 @@ system and gives an overview of their function and contents. An easy way to see what overrides apply is to search for :term:`OVERRIDES` in the output of the ``bitbake -e`` command. See the - ":ref:`dev-manual/common-tasks:viewing variable values`" section in the Yocto + ":ref:`dev-manual/debugging:viewing variable values`" section in the Yocto Project Development Tasks Manual for more information. :term:`P` @@ -5351,6 +5506,9 @@ system and gives an overview of their function and contents. ${PN}-${PV} + :term:`P4DIR` + See :term:`bitbake:P4DIR` in the BitBake manual. + :term:`PACKAGE_ADD_METADATA` This variable defines additional metadata to add to packages. @@ -5364,7 +5522,7 @@ system and gives an overview of their function and contents. specific by using the package name as a suffix. You can find out more about applying this variable in the - ":ref:`dev-manual/common-tasks:adding custom metadata to packages`" + ":ref:`dev-manual/packages:adding custom metadata to packages`" section in the Yocto Project Development Tasks Manual. :term:`PACKAGE_ARCH` @@ -5406,12 +5564,13 @@ system and gives an overview of their function and contents. OpenEmbedded build system uses when packaging data. You can provide one or more of the following arguments for the - variable: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk - package_tar" + variable:: + + PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk package_tar" .. note:: - While it is a legal option, the ``package_tar`` + While it is a legal option, the :ref:`ref-classes-package_tar` class has limited functionality due to no support for package dependencies by that backend. Therefore, it is recommended that you do not use it. @@ -5471,7 +5630,7 @@ system and gives an overview of their function and contents. use of the :term:`INHIBIT_PACKAGE_DEBUG_SPLIT` variable. You can find out more about debugging using GDB by reading the - ":ref:`dev-manual/common-tasks:debugging with the gnu project debugger (gdb) remotely`" section + ":ref:`dev-manual/debugging:debugging with the gnu project debugger (gdb) remotely`" section in the Yocto Project Development Tasks Manual. :term:`PACKAGE_EXCLUDE` @@ -5630,7 +5789,7 @@ system and gives an overview of their function and contents. the :ref:`core-image-minimal-initramfs ` image. When working with an initial RAM filesystem (:term:`Initramfs`) image, use the :term:`PACKAGE_INSTALL` variable. For information on creating an - :term:`Initramfs`, see the ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section + :term:`Initramfs`, see the ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in the Yocto Project Development Tasks Manual. :term:`PACKAGE_INSTALL_ATTEMPTONLY` @@ -5653,7 +5812,7 @@ system and gives an overview of their function and contents. :term:`PACKAGE_WRITE_DEPS`. For information on running post-installation scripts, see the - ":ref:`dev-manual/common-tasks:post-installation scripts`" + ":ref:`dev-manual/new-recipe:post-installation scripts`" section in the Yocto Project Development Tasks Manual. :term:`PACKAGECONFIG` @@ -5681,31 +5840,30 @@ system and gives an overview of their function and contents. omit any argument you like but must retain the separating commas. The order is important and specifies the following: - 1. Extra arguments that should be added to the configure script + #. Extra arguments that should be added to the configure script argument list (:term:`EXTRA_OECONF` or :term:`PACKAGECONFIG_CONFARGS`) if the feature is enabled. - 2. Extra arguments that should be added to :term:`EXTRA_OECONF` or + #. Extra arguments that should be added to :term:`EXTRA_OECONF` or :term:`PACKAGECONFIG_CONFARGS` if the feature is disabled. - 3. Additional build dependencies (:term:`DEPENDS`) + #. Additional build dependencies (:term:`DEPENDS`) that should be added if the feature is enabled. - 4. Additional runtime dependencies (:term:`RDEPENDS`) + #. Additional runtime dependencies (:term:`RDEPENDS`) that should be added if the feature is enabled. - 5. Additional runtime recommendations + #. Additional runtime recommendations (:term:`RRECOMMENDS`) that should be added if the feature is enabled. - 6. Any conflicting (that is, mutually exclusive) :term:`PACKAGECONFIG` + #. Any conflicting (that is, mutually exclusive) :term:`PACKAGECONFIG` settings for this feature. Consider the following :term:`PACKAGECONFIG` block taken from the ``librsvg`` recipe. In this example the feature is ``gtk``, which has - three arguments that determine the feature's behavior. - :: + three arguments that determine the feature's behavior:: PACKAGECONFIG[gtk] = "--with-gtk3,--without-gtk3,gtk+3" @@ -5750,16 +5908,15 @@ system and gives an overview of their function and contents. A space-separated list of configuration options generated from the :term:`PACKAGECONFIG` setting. - Classes such as :ref:`autotools ` and - :ref:`cmake ` use :term:`PACKAGECONFIG_CONFARGS` to - pass :term:`PACKAGECONFIG` options to ``configure`` and ``cmake``, - respectively. If you are using :term:`PACKAGECONFIG` but not a class that - handles the :ref:`ref-tasks-configure` task, then you need to use + Classes such as :ref:`ref-classes-autotools` and :ref:`ref-classes-cmake` + use :term:`PACKAGECONFIG_CONFARGS` to pass :term:`PACKAGECONFIG` options + to ``configure`` and ``cmake``, respectively. If you are using + :term:`PACKAGECONFIG` but not a class that handles the + :ref:`ref-tasks-configure` task, then you need to use :term:`PACKAGECONFIG_CONFARGS` appropriately. :term:`PACKAGEGROUP_DISABLE_COMPLEMENTARY` - For recipes inheriting the - :ref:`packagegroup ` class, setting + For recipes inheriting the :ref:`ref-classes-packagegroup` class, setting :term:`PACKAGEGROUP_DISABLE_COMPLEMENTARY` to "1" specifies that the normal complementary packages (i.e. ``-dev``, ``-dbg``, and so forth) should not be automatically created by the ``packagegroup`` recipe, @@ -5804,7 +5961,7 @@ system and gives an overview of their function and contents. For an example of how to use the :term:`PACKAGES_DYNAMIC` variable when you are splitting packages, see the - ":ref:`dev-manual/common-tasks:handling optional module packaging`" + ":ref:`dev-manual/packages:handling optional module packaging`" section in the Yocto Project Development Tasks Manual. :term:`PACKAGESPLITFUNCS` @@ -5842,7 +5999,7 @@ system and gives an overview of their function and contents. the :ref:`ref-tasks-compile` task that result in race conditions, you can clear the :term:`PARALLEL_MAKE` variable within the recipe as a workaround. For information on addressing race conditions, see the - ":ref:`dev-manual/common-tasks:debugging parallel make races`" + ":ref:`dev-manual/debugging:debugging parallel make races`" section in the Yocto Project Development Tasks Manual. For single socket systems (i.e. one CPU), you should not have to @@ -5852,7 +6009,7 @@ system and gives an overview of their function and contents. not set higher than "-j 20". For more information on speeding up builds, see the - ":ref:`dev-manual/common-tasks:speeding up a build`" + ":ref:`dev-manual/speeding-up-build:speeding up a build`" section in the Yocto Project Development Tasks Manual. :term:`PARALLEL_MAKEINST` @@ -5873,7 +6030,7 @@ system and gives an overview of their function and contents. the :ref:`ref-tasks-install` task that result in race conditions, you can clear the :term:`PARALLEL_MAKEINST` variable within the recipe as a workaround. For information on addressing race conditions, see the - ":ref:`dev-manual/common-tasks:debugging parallel make races`" + ":ref:`dev-manual/debugging:debugging parallel make races`" section in the Yocto Project Development Tasks Manual. :term:`PATCHRESOLVE` @@ -5911,11 +6068,13 @@ system and gives an overview of their function and contents. :term:`PE` is the default value of the :term:`PKGE` variable. :term:`PEP517_WHEEL_PATH` - When used by recipes that inherit the - :ref:`python_pep517 ` class, - denotes the path to ``dist/`` (short for distribution) where the + When used by recipes that inherit the :ref:`ref-classes-python_pep517` + class, denotes the path to ``dist/`` (short for distribution) where the binary archive ``wheel`` is built. + :term:`PERSISTENT_DIR` + See :term:`bitbake:PERSISTENT_DIR` in the BitBake manual. + :term:`PF` Specifies the recipe or package name and includes all version and revision numbers (i.e. ``glibc-2.13-r20+svnr15508/`` and @@ -5923,10 +6082,11 @@ system and gives an overview of their function and contents. ${:term:`PN`}-${:term:`EXTENDPE`}${:term:`PV`}-${:term:`PR`} :term:`PIXBUF_PACKAGES` - When inheriting the :ref:`pixbufcache ` + When inheriting the :ref:`ref-classes-pixbufcache` class, this variable identifies packages that contain the pixbuf - loaders used with ``gdk-pixbuf``. By default, the ``pixbufcache`` - class assumes that the loaders are in the recipe's main package (i.e. + loaders used with ``gdk-pixbuf``. By default, the + :ref:`ref-classes-pixbufcache` class assumes that + the loaders are in the recipe's main package (i.e. ``${``\ :term:`PN`\ ``}``). Use this variable if the loaders you need are in a package other than that main package. @@ -5938,9 +6098,8 @@ system and gives an overview of their function and contents. When using the :term:`PKG` variable, you must use a package name override. - For example, when the :ref:`debian ` class - renames the output package, it does so by setting - ``PKG:packagename``. + For example, when the :ref:`ref-classes-debian` class renames the output + package, it does so by setting ``PKG:packagename``. :term:`PKG_CONFIG_PATH` The path to ``pkg-config`` files for the current build context. @@ -5968,7 +6127,7 @@ system and gives an overview of their function and contents. For examples of how this data is used, see the ":ref:`overview-manual/concepts:automatically added runtime dependencies`" section in the Yocto Project Overview and Concepts Manual and the - ":ref:`dev-manual/common-tasks:viewing package information with \`\`oe-pkgdata-util\`\``" + ":ref:`dev-manual/debugging:viewing package information with \`\`oe-pkgdata-util\`\``" section in the Yocto Project Development Tasks Manual. For more information on the shared, global-state directory, see :term:`STAGING_DIR_HOST`. @@ -6084,7 +6243,7 @@ system and gives an overview of their function and contents. Because manually managing :term:`PR` can be cumbersome and error-prone, an automated solution exists. See the - ":ref:`dev-manual/common-tasks:working with a pr service`" section + ":ref:`dev-manual/packages:working with a pr service`" section in the Yocto Project Development Tasks Manual for more information. :term:`PREFERRED_PROVIDER` @@ -6107,7 +6266,7 @@ system and gives an overview of their function and contents. PREFERRED_PROVIDER_virtual/libgl ?= "mesa" For more - information, see the ":ref:`dev-manual/common-tasks:using virtual providers`" + information, see the ":ref:`dev-manual/new-recipe:using virtual providers`" section in the Yocto Project Development Tasks Manual. .. note:: @@ -6118,6 +6277,9 @@ system and gives an overview of their function and contents. desirable since this mechanism is designed to select between mutually exclusive alternative providers. + :term:`PREFERRED_PROVIDERS` + See :term:`bitbake:PREFERRED_PROVIDERS` in the BitBake manual. + :term:`PREFERRED_VERSION` If there are multiple versions of a recipe available, this variable determines which version should be given preference. You must always @@ -6264,7 +6426,7 @@ system and gives an overview of their function and contents. .. note:: A recipe's own recipe name (:term:`PN`) is always implicitly prepended - to `PROVIDES`, so while using "+=" in the above example may not be + to :term:`PROVIDES`, so while using "+=" in the above example may not be strictly necessary it is recommended to avoid confusion. In addition to providing recipes under alternate names, the @@ -6307,7 +6469,7 @@ system and gives an overview of their function and contents. You must set the variable if you want to automatically start a local :ref:`PR - service `. You can + service `. You can set :term:`PRSERV_HOST` to other values to use a remote PR service. @@ -6321,7 +6483,7 @@ system and gives an overview of their function and contents. :term:`PTEST_ENABLED` Specifies whether or not :ref:`Package - Test ` (ptest) + Test ` (ptest) functionality is enabled when building a recipe. You should not set this variable directly. Enabling and disabling building Package Tests at build time should be done by adding "ptest" to (or removing it @@ -6338,7 +6500,7 @@ system and gives an overview of their function and contents. :term:`PV` is the default value of the :term:`PKGV` variable. :term:`PYPI_PACKAGE` - When inheriting the :ref:`pypi ` class, specifies the + When inheriting the :ref:`ref-classes-pypi` class, specifies the `PyPI `__ package name to be built. The default value is set based upon :term:`BPN` (stripping any "python-" or "python3-" prefix off if present), however for some packages it will need to be set @@ -6346,22 +6508,20 @@ system and gives an overview of their function and contents. package name has a prefix, underscores, uppercase letters etc.) :term:`PYTHON_ABI` - When used by recipes that inherit the - :ref:`setuptools3 ` class, denotes the - Application Binary Interface (ABI) currently in use for Python. By - default, the ABI is "m". You do not have to set this variable as the - OpenEmbedded build system sets it for you. + When used by recipes that inherit the :ref:`ref-classes-setuptools3` + class, denotes the Application Binary Interface (ABI) currently in use + for Python. By default, the ABI is "m". You do not have to set this + variable as the OpenEmbedded build system sets it for you. The OpenEmbedded build system uses the ABI to construct directory names used when installing the Python headers and libraries in sysroot (e.g. ``.../python3.3m/...``). :term:`PYTHON_PN` - When used by recipes that inherit the - :ref:`setuptools3 ` classe, specifies the - major Python version being built. For Python 3.x, :term:`PYTHON_PN` would - be "python3". You do not have to set this variable as the - OpenEmbedded build system automatically sets it for you. + When used by recipes that inherit the :ref:`ref-classes-setuptools3` + class, specifies the major Python version being built. For Python 3.x, + :term:`PYTHON_PN` would be "python3". You do not have to set this + variable as the OpenEmbedded build system automatically sets it for you. The variable allows recipes to use common infrastructure such as the following:: @@ -6492,7 +6652,7 @@ system and gives an overview of their function and contents. The package names you use with :term:`RDEPENDS` must appear as they would in the :term:`PACKAGES` variable. The :term:`PKG` variable allows a different name to be used for the final package (e.g. the - :ref:`debian ` class uses this to rename + :ref:`ref-classes-debian` class uses this to rename packages), but this final package name cannot be used with :term:`RDEPENDS`, which makes sense as :term:`RDEPENDS` is meant to be independent of the package format used. @@ -6539,9 +6699,11 @@ system and gives an overview of their function and contents. in the ":ref:`ref-manual/devtool-reference:checking on the upgrade status of a recipe`" section. + :term:`REPODIR` + See :term:`bitbake:REPODIR` in the BitBake manual. + :term:`REQUIRED_DISTRO_FEATURES` - When inheriting the - :ref:`features_check ` + When inheriting the :ref:`ref-classes-features_check` class, this variable identifies distribution features that must exist in the current configuration in order for the OpenEmbedded build system to build the recipe. In other words, if the @@ -6562,10 +6724,9 @@ system and gives an overview of their function and contents. for the same recipe, the :term:`REQUIRED_VERSION` value applies. :term:`RM_WORK_EXCLUDE` - With ``rm_work`` enabled, this variable specifies a list of recipes - whose work directories should not be removed. See the - ":ref:`ref-classes-rm-work`" section for more - details. + With :ref:`ref-classes-rm-work` enabled, this variable + specifies a list of recipes whose work directories should not be removed. + See the ":ref:`ref-classes-rm-work`" section for more details. :term:`ROOT_HOME` Defines the root home directory. By default, this directory is set as @@ -6595,7 +6756,7 @@ system and gives an overview of their function and contents. Indicates a filesystem image to include as the root filesystem. The :term:`ROOTFS` variable is an optional variable used with the - :ref:`image-live ` class. + :ref:`ref-classes-image-live` class. :term:`ROOTFS_POSTINSTALL_COMMAND` Specifies a list of functions to call after the OpenEmbedded build @@ -6819,7 +6980,7 @@ system and gives an overview of their function and contents. set this variable. Instead, use :term:`SDKMACHINE`. :term:`SDK_BUILDINFO_FILE` - When using the :ref:`image-buildinfo ` class, + When using the :ref:`ref-classes-image-buildinfo` class, specifies the file in the SDK to write the build information into. The default value is "``/buildinfo``". @@ -6830,9 +6991,9 @@ system and gives an overview of their function and contents. :term:`SDK_DEPLOY` The directory set up and used by the - :ref:`populate_sdk_base ` class to which - the SDK is deployed. The ``populate_sdk_base`` class defines - :term:`SDK_DEPLOY` as follows:: + :ref:`populate_sdk_base ` class to which the + SDK is deployed. The :ref:`populate_sdk_base ` + class defines :term:`SDK_DEPLOY` as follows:: SDK_DEPLOY = "${TMPDIR}/deploy/sdk" @@ -6950,7 +7111,8 @@ system and gives an overview of their function and contents. :term:`SDK_DIR` variable for more information. :term:`SDK_PREFIX` - The toolchain binary prefix used for ``nativesdk`` recipes. The + The toolchain binary prefix used for + :ref:`ref-classes-nativesdk` recipes. The OpenEmbedded build system uses the :term:`SDK_PREFIX` value to set the :term:`TARGET_PREFIX` when building ``nativesdk`` recipes. The default value is "${SDK_SYS}-". @@ -7110,19 +7272,6 @@ system and gives an overview of their function and contents. :term:`FULL_OPTIMIZATION` unless :term:`DEBUG_BUILD` = "1", in which case the value of :term:`DEBUG_OPTIMIZATION` is used. - :term:`SERIAL_CONSOLE` - Defines a serial console (TTY) to enable using - `getty `__. Provide a - value that specifies the baud rate followed by the TTY device name - separated by a space. You cannot specify more than one TTY device:: - - SERIAL_CONSOLE = "115200 ttyS0" - - .. note:: - - The :term:`SERIAL_CONSOLE` variable is deprecated. Please use the - :term:`SERIAL_CONSOLES` variable. - :term:`SERIAL_CONSOLES` Defines a serial console (TTY) to enable using `getty `__. Provide a @@ -7149,25 +7298,22 @@ system and gives an overview of their function and contents. EXTRA_IMAGE_FEATURES += "read-only-rootfs" :term:`SETUPTOOLS_BUILD_ARGS` - When used by recipes that inherit the - :ref:`setuptools3 ` class, this variable can - be used to specify additional arguments to be passed to ``setup.py build`` - in the ``setuptools3_do_compile()`` task. + When used by recipes that inherit the :ref:`ref-classes-setuptools3` + class, this variable can be used to specify additional arguments to be + passed to ``setup.py build`` in the ``setuptools3_do_compile()`` task. :term:`SETUPTOOLS_INSTALL_ARGS` - When used by recipes that inherit the - :ref:`setuptools3 ` class, this variable can - be used to specify additional arguments to be passed to ``setup.py install`` - in the ``setuptools3_do_install()`` task. + When used by recipes that inherit the :ref:`ref-classes-setuptools3` + class, this variable can be used to specify additional arguments to be + passed to ``setup.py install`` in the ``setuptools3_do_install()`` task. :term:`SETUPTOOLS_SETUP_PATH` - When used by recipes that inherit the - :ref:`setuptools3 ` class, this variable should - be used to specify the directory in which the ``setup.py`` file is - located if it is not at the root of the source tree (as specified by - :term:`S`). For example, in a recipe where the sources are fetched from - a Git repository and ``setup.py`` is in a ``python/pythonmodule`` - subdirectory, you would have this:: + When used by recipes that inherit the :ref:`ref-classes-setuptools3` + class, this variable should be used to specify the directory in which + the ``setup.py`` file is located if it is not at the root of the source + tree (as specified by :term:`S`). For example, in a recipe where the + sources are fetched from a Git repository and ``setup.py`` is in a + ``python/pythonmodule`` subdirectory, you would have this:: S = "${WORKDIR}/git" SETUPTOOLS_SETUP_PATH = "${S}/python/pythonmodule" @@ -7312,7 +7458,7 @@ system and gives an overview of their function and contents. specified in :term:`SRC_URI`. To use this variable, you must globally inherit the - :ref:`own-mirrors ` class and then provide + :ref:`ref-classes-own-mirrors` class and then provide the URL to your mirrors. Here is the general syntax:: INHERIT += "own-mirrors" @@ -7338,7 +7484,7 @@ system and gives an overview of their function and contents. ``core-image-minimal`` for the ``qemux86-64`` machine, enabling this option multiplied the size of the ``tmp/deploy/spdx`` directory by a factor of 13 (+1.6 GiB for this image), compared to just using the - :ref:`create-spdx ` class with no option. + :ref:`ref-classes-create-spdx` class with no option. Note that this option doesn't increase the size of :term:`SPDX` files in ``tmp/deploy/images/MACHINE``. @@ -7364,7 +7510,7 @@ system and gives an overview of their function and contents. ``core-image-minimal`` for the ``qemux86-64`` machine, enabling these options multiplied the size of the ``tmp/deploy/spdx`` directory by a factor of 11 (+1.4 GiB for this image), - compared to just using the :ref:`create-spdx ` + compared to just using the :ref:`ref-classes-create-spdx` class with no option. Note that using this option only marginally increases the size @@ -7390,8 +7536,8 @@ system and gives an overview of their function and contents. directory by a factor of 3 (+291 MiB for this image), and the size of the ``IMAGE-MACHINE.spdx.tar.zst`` in ``tmp/deploy/images/MACHINE`` by a factor of 130 (+15 MiB for this - image), compared to just using the - :ref:`create-spdx ` class with no option. + image), compared to just using the :ref:`ref-classes-create-spdx` class + with no option. :term:`SPDX_PRETTY` This option makes the SPDX output more human-readable, using @@ -7441,10 +7587,13 @@ system and gives an overview of their function and contents. various ``SPL_*`` variables used by the OpenEmbedded build system. See the BeagleBone machine configuration example in the - ":ref:`dev-manual/common-tasks:adding a layer using the \`\`bitbake-layers\`\` script`" + ":ref:`dev-manual/layers:adding a layer using the \`\`bitbake-layers\`\` script`" section in the Yocto Project Board Support Package Developer's Guide for additional information. + :term:`SRCREV_FORMAT` + See :term:`bitbake:SRCREV_FORMAT` in the BitBake manual. + :term:`SRC_URI` See the BitBake manual for the initial description for this variable: @@ -7533,20 +7682,20 @@ system and gives an overview of their function and contents. For information on limitations when inheriting the latest revision of software using :term:`SRCREV`, see the :term:`AUTOREV` variable description and the - ":ref:`dev-manual/common-tasks:automatically incrementing a package version number`" + ":ref:`dev-manual/packages:automatically incrementing a package version number`" section, which is in the Yocto Project Development Tasks Manual. :term:`SRCTREECOVEREDTASKS` A list of tasks that are typically not relevant (and therefore skipped) - when building using the :ref:`externalsrc ` + when building using the :ref:`ref-classes-externalsrc` class. The default value as set in that class file is the set of tasks that are rarely needed when using external source:: SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" The notable exception is when processing external kernel source as - defined in the :ref:`kernel-yocto ` - class file (formatted for aesthetics):: + defined in the :ref:`ref-classes-kernel-yocto` class file (formatted for + aesthetics):: SRCTREECOVEREDTASKS += "\ do_validate_branches \ @@ -7575,7 +7724,7 @@ system and gives an overview of their function and contents. prevented the reuse of prebuilt artifacts stored in the Shared State Cache. - ``SSTATE_EXCLUDEDEPS_SYSROOT`` is evaluated as two regular + :term:`SSTATE_EXCLUDEDEPS_SYSROOT` is evaluated as two regular expressions of recipe and dependency to ignore. An example is the rule in :oe_git:`meta/conf/layer.conf `:: @@ -7614,18 +7763,16 @@ system and gives an overview of their function and contents. a different GCC version for native builds, you must configure :term:`SSTATE_MIRRORS` with a regular expression that maps local search paths to server paths. The paths need to take into account - :term:`NATIVELSBSTRING` set by the - :ref:`uninative ` class. For example, the - following maps the local search path ``universal-4.9`` to the - server-provided path server_url_sstate_path:: + :term:`NATIVELSBSTRING` set by the :ref:`ref-classes-uninative` class. + For example, the following maps the local search path ``universal-4.9`` + to the server-provided path server_url_sstate_path:: SSTATE_MIRRORS ?= "file://universal-4.9/(.*) https://server_url_sstate_path/universal-4.8/\1" If a mirror uses the same structure as :term:`SSTATE_DIR`, you need to add "PATH" at the end as shown in the examples below. The build system substitutes the - correct path within the directory structure. - :: + correct path within the directory structure:: SSTATE_MIRRORS ?= "\ file://.* https://someserver.tld/share/sstate/PATH;downloadfilename=PATH \ @@ -7644,11 +7791,9 @@ system and gives an overview of their function and contents. by the :term:`SSTATE_SCAN_FILES` variable. Typically, recipes add files they want to be scanned to the value of :term:`SSTATE_SCAN_FILES` rather than the variable being comprehensively set. The - :ref:`sstate ` class specifies the default list - of files. + :ref:`ref-classes-sstate` class specifies the default list of files. - For details on the process, see the - :ref:`staging ` class. + For details on the process, see the :ref:`ref-classes-staging` class. :term:`STAGING_BASE_LIBDIR_NATIVE` Specifies the path to the ``/lib`` subdirectory of the sysroot @@ -7759,10 +7904,10 @@ system and gives an overview of their function and contents. which is the majority, :term:`STAGING_DIR_TARGET` is set to match :term:`STAGING_DIR_HOST`. - Some recipes build binaries that can run on the target system but - those binaries in turn generate code for another different system - (e.g. cross-canadian recipes). Using terminology from GNU, the - primary system is referred to as the "HOST" and the secondary, or + Some recipes build binaries that can run on the target system but those + binaries in turn generate code for another different system (e.g. + :ref:`ref-classes-cross-canadian` recipes). Using terminology from GNU, + the primary system is referred to as the "HOST" and the secondary, or different, system is referred to as the "TARGET". Thus, the binaries run on the "HOST" system and generate binaries for the "TARGET" system. The :term:`STAGING_DIR_HOST` variable points to the sysroot used @@ -7827,6 +7972,9 @@ system and gives an overview of their function and contents. :term:`PV`, and :term:`PR` for related variable information. + :term:`STAMPCLEAN` + See :term:`bitbake:STAMPCLEAN` in the BitBake manual. + :term:`STAMPS_DIR` Specifies the base directory in which the OpenEmbedded build system places stamps. The default directory is ``${TMPDIR}/stamps``. @@ -7853,7 +8001,7 @@ system and gives an overview of their function and contents. SYSLINUX_DEFAULT_CONSOLE = "console=ttyX" - The :ref:`syslinux ` class initially sets + The :ref:`ref-classes-syslinux` class initially sets this variable to null but then checks for a value later. :term:`SYSLINUX_OPTS` @@ -7861,14 +8009,14 @@ system and gives an overview of their function and contents. this variable in your recipe. If you want to list multiple options, separate the options with a semicolon character (``;``). - The :ref:`syslinux ` class uses this variable + The :ref:`ref-classes-syslinux` class uses this variable to create a set of options. :term:`SYSLINUX_SERIAL` Specifies the alternate serial port or turns it off. To turn off serial, set this variable to an empty string in your recipe. The variable's default value is set in the - :ref:`syslinux ` class as follows:: + :ref:`ref-classes-syslinux` class as follows:: SYSLINUX_SERIAL ?= "0 115200" @@ -7876,8 +8024,8 @@ system and gives an overview of their function and contents. :term:`SYSLINUX_SERIAL_TTY` Specifies the alternate console=tty... kernel boot argument. The - variable's default value is set in the - :ref:`syslinux ` class as follows:: + variable's default value is set in the :ref:`ref-classes-syslinux` + class as follows:: SYSLINUX_SERIAL_TTY ?= "console=ttyS0,115200" @@ -7887,7 +8035,7 @@ system and gives an overview of their function and contents. An ``.LSS`` file used as the background for the VGA boot menu when you use the boot menu. You need to set this variable in your recipe. - The :ref:`syslinux ` class checks for this + The :ref:`ref-classes-syslinux` class checks for this variable and if found, the OpenEmbedded build system installs the splash screen. @@ -7963,12 +8111,12 @@ system and gives an overview of their function and contents. processing on the staged files, or to stage additional files. :term:`SYSTEMD_AUTO_ENABLE` - When inheriting the :ref:`systemd ` class, + When inheriting the :ref:`ref-classes-systemd` class, this variable specifies whether the specified service in :term:`SYSTEMD_SERVICE` should start automatically or not. By default, the service is enabled to automatically start at boot time. The default setting is in the - :ref:`systemd ` class as follows:: + :ref:`ref-classes-systemd` class as follows:: SYSTEMD_AUTO_ENABLE ??= "enable" @@ -7978,7 +8126,7 @@ system and gives an overview of their function and contents. When :term:`EFI_PROVIDER` is set to "systemd-boot", the :term:`SYSTEMD_BOOT_CFG` variable specifies the configuration file that should be used. By default, the - :ref:`systemd-boot ` class sets the + :ref:`ref-classes-systemd-boot` class sets the :term:`SYSTEMD_BOOT_CFG` as follows:: SYSTEMD_BOOT_CFG ?= "${S}/loader.conf" @@ -7990,9 +8138,8 @@ system and gives an overview of their function and contents. When :term:`EFI_PROVIDER` is set to "systemd-boot", the :term:`SYSTEMD_BOOT_ENTRIES` variable specifies a list of entry files (``*.conf``) to install that contain one boot - entry per file. By default, the - :ref:`systemd-boot ` class sets the - :term:`SYSTEMD_BOOT_ENTRIES` as follows:: + entry per file. By default, the :ref:`ref-classes-systemd-boot` class + sets the :term:`SYSTEMD_BOOT_ENTRIES` as follows:: SYSTEMD_BOOT_ENTRIES ?= "" @@ -8003,7 +8150,7 @@ system and gives an overview of their function and contents. When :term:`EFI_PROVIDER` is set to "systemd-boot", the :term:`SYSTEMD_BOOT_TIMEOUT` variable specifies the boot menu timeout in seconds. By default, the - :ref:`systemd-boot ` class sets the + :ref:`ref-classes-systemd-boot` class sets the :term:`SYSTEMD_BOOT_TIMEOUT` as follows:: SYSTEMD_BOOT_TIMEOUT ?= "10" @@ -8029,7 +8176,7 @@ system and gives an overview of their function and contents. SYSTEMD_DEFAULT_TARGET = "graphical.target" :term:`SYSTEMD_PACKAGES` - When inheriting the :ref:`systemd ` class, + When inheriting the :ref:`ref-classes-systemd` class, this variable locates the systemd unit files when they are not found in the main recipe's package. By default, the :term:`SYSTEMD_PACKAGES` variable is set such that the systemd unit files are assumed to @@ -8042,7 +8189,7 @@ system and gives an overview of their function and contents. the build system can find the systemd unit files. :term:`SYSTEMD_SERVICE` - When inheriting the :ref:`systemd ` class, + When inheriting the :ref:`ref-classes-systemd` class, this variable specifies the systemd service name for a package. Multiple services can be specified, each one separated by a space. @@ -8054,12 +8201,12 @@ system and gives an overview of their function and contents. SYSTEMD_SERVICE:${PN} = "connman.service" The package overrides that can be specified are directly related to the value of - term:`SYSTEMD_PACKAGES`. Overrides not included in term:`SYSTEMD_PACKAGES` + :term:`SYSTEMD_PACKAGES`. Overrides not included in :term:`SYSTEMD_PACKAGES` will be silently ignored. :term:`SYSVINIT_ENABLED_GETTYS` When using - :ref:`SysVinit `, + :ref:`SysVinit `, specifies a space-separated list of the virtual terminals that should run a `getty `__ (allowing login), assuming :term:`USE_VT` is not set to @@ -8205,8 +8352,8 @@ system and gives an overview of their function and contents. - For native recipes, the build system sets the variable to the value of :term:`BUILD_PREFIX`. - - For native SDK recipes (``nativesdk``), the build system sets the - variable to the value of :term:`SDK_PREFIX`. + - For native SDK recipes (:ref:`ref-classes-nativesdk`), + the build system sets the variable to the value of :term:`SDK_PREFIX`. :term:`TARGET_SYS` Specifies the system, including the architecture and the operating @@ -8265,12 +8412,10 @@ system and gives an overview of their function and contents. If :term:`TCMODE` is set to a value other than "default", then it is your responsibility to ensure that the toolchain is compatible with the default toolchain. Using older or newer versions of these - components might cause build problems. See the Release Notes for - the Yocto Project release for the specific components with which - the toolchain must be compatible. To access the Release Notes, go - to the :yocto_home:`Downloads ` - page on the Yocto Project website and click on the "RELEASE - INFORMATION" link for the appropriate release. + components might cause build problems. See + :yocto_docs:`Release Information ` for your + version of the Yocto Project, to find the specific components with + which the toolchain must be compatible. The :term:`TCMODE` variable is similar to :term:`TCLIBC`, which controls the variant of the GNU standard C library (``libc``) @@ -8283,16 +8428,20 @@ system and gives an overview of their function and contents. https://github.com/MentorEmbedded/meta-sourcery/. The layer's ``README`` file contains information on how to use the - Sourcery G++ Toolchain as an external toolchain. In summary, you must - be sure to add the layer to your ``bblayers.conf`` file in front of - the ``meta`` layer and then set the ``EXTERNAL_TOOLCHAIN`` variable - in your ``local.conf`` file to the location in which you installed - the toolchain. + Sourcery G++ Toolchain as an external toolchain. You will have to + add the layer to your ``bblayers.conf`` file and then set the + :term:`EXTERNAL_TOOLCHAIN` variable in your ``local.conf`` file to + the location of the toolchain. The fundamentals used for this example apply to any external toolchain. You can use ``meta-sourcery`` as a template for adding support for other external toolchains. + In addition to toolchain configuration, you will also need a + corresponding toolchain recipe file. This recipe file needs to package + up any pre-built objects in the toolchain such as ``libgcc``, + ``libstdcc++``, any locales, and ``libc``. + :term:`TC_CXX_RUNTIME` Specifies the C/C++ STL and runtime variant to use during the build process. Default value is 'gnu' @@ -8306,7 +8455,7 @@ system and gives an overview of their function and contents. BitBake targets shown when sourcing the ``oe-init-build-env`` script. For details, see the - :ref:`dev-manual/common-tasks:creating a custom template configuration directory` + :ref:`dev-manual/custom-template-configuration-directory:creating a custom template configuration directory` section in the Yocto Project Development Tasks manual. .. note:: @@ -8361,7 +8510,7 @@ system and gives an overview of their function and contents. file. For more information on testing images, see the - ":ref:`dev-manual/common-tasks:performing automated runtime testing`" + ":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual. :term:`TEST_SERIALCONTROL_CMD` @@ -8416,8 +8565,7 @@ system and gives an overview of their function and contents. Alternatively, you can provide the "auto" option to have all applicable tests run against - the image. - :: + the image:: TEST_SUITES:append = " auto" @@ -8434,7 +8582,7 @@ system and gives an overview of their function and contents. TEST_SUITES = "test_A test_B" For more information on testing images, see the - ":ref:`dev-manual/common-tasks:performing automated runtime testing`" + ":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual. :term:`TEST_TARGET` @@ -8453,7 +8601,7 @@ system and gives an overview of their function and contents. You can provide the following arguments with :term:`TEST_TARGET`: - *"qemu":* Boots a QEMU image and runs the tests. See the - ":ref:`dev-manual/common-tasks:enabling runtime tests on qemu`" section + ":ref:`dev-manual/runtime-testing:enabling runtime tests on qemu`" section in the Yocto Project Development Tasks Manual for more information. @@ -8469,7 +8617,7 @@ system and gives an overview of their function and contents. ``meta/lib/oeqa/controllers/simpleremote.py``. For information on running tests on hardware, see the - ":ref:`dev-manual/common-tasks:enabling runtime tests on hardware`" + ":ref:`dev-manual/runtime-testing:enabling runtime tests on hardware`" section in the Yocto Project Development Tasks Manual. :term:`TEST_TARGET_IP` @@ -8506,7 +8654,7 @@ system and gives an overview of their function and contents. For more information on enabling, running, and writing these tests, see the - ":ref:`dev-manual/common-tasks:performing automated runtime testing`" + ":ref:`dev-manual/runtime-testing:performing automated runtime testing`" section in the Yocto Project Development Tasks Manual and the ":ref:`ref-classes-testimage`" section. @@ -8565,7 +8713,7 @@ system and gives an overview of their function and contents. :doc:`/sdk-manual/index` manual. Note that this variable applies to building an SDK, not an eSDK, - in which case the term:`TOOLCHAIN_HOST_TASK_ESDK` setting should be + in which case the :term:`TOOLCHAIN_HOST_TASK_ESDK` setting should be used instead. :term:`TOOLCHAIN_HOST_TASK_ESDK` @@ -8602,6 +8750,9 @@ system and gives an overview of their function and contents. information on setting up a cross-development environment, see the :doc:`/sdk-manual/index` manual. + :term:`TOPDIR` + See :term:`bitbake:TOPDIR` in the BitBake manual. + :term:`TRANSLATED_TARGET_ARCH` A sanitized version of :term:`TARGET_ARCH`. This variable is used where the architecture is needed in a value where @@ -8761,21 +8912,19 @@ system and gives an overview of their function and contents. "sdcard" specifies the :term:`IMAGE_FSTYPES` to use for the U-Boot image. For more information on how the :term:`UBOOT_CONFIG` is handled, see the - :ref:`uboot-config ` - class. + :ref:`ref-classes-uboot-config` class. :term:`UBOOT_DTB_LOADADDRESS` Specifies the load address for the dtb image used by U-Boot. During FIT image creation, the :term:`UBOOT_DTB_LOADADDRESS` variable is used in - :ref:`kernel-fitimage ` class to specify - the load address to be used in - creating the dtb sections of Image Tree Source for the FIT image. + :ref:`ref-classes-kernel-fitimage` class to specify the load address to be + used in creating the dtb sections of Image Tree Source for the FIT image. :term:`UBOOT_DTBO_LOADADDRESS` Specifies the load address for the dtbo image used by U-Boot. During FIT image creation, the :term:`UBOOT_DTBO_LOADADDRESS` variable is used in - :ref:`kernel-fitimage ` class to specify the load address to be used in - creating the dtbo sections of Image Tree Source for the FIT image. + :ref:`ref-classes-kernel-fitimage` class to specify the load address to be + used in creating the dtbo sections of Image Tree Source for the FIT image. :term:`UBOOT_ENTRYPOINT` Specifies the entry point for the U-Boot image. During U-Boot image @@ -8810,15 +8959,16 @@ system and gives an overview of their function and contents. :term:`UBOOT_MKIMAGE` Specifies the name of the mkimage command as used by the - :ref:`kernel-fitimage ` class to assemble + :ref:`ref-classes-kernel-fitimage` class to assemble the FIT image. This can be used to substitute an alternative command, wrapper script or function if desired. The default is "uboot-mkimage". :term:`UBOOT_MKIMAGE_DTCOPTS` - Options for the device tree compiler passed to mkimage '-D' - feature while creating FIT image in :ref:`kernel-fitimage ` class. - If :term:`UBOOT_MKIMAGE_DTCOPTS` is not set then kernel-fitimage will not - pass the ``-D`` option to mkimage. + Options for the device tree compiler passed to mkimage '-D' feature while + creating FIT image in :ref:`ref-classes-kernel-fitimage` class. If + :term:`UBOOT_MKIMAGE_DTCOPTS` is not set then + :ref:`ref-classes-kernel-fitimage` will not pass the ``-D`` option to + mkimage. :term:`UBOOT_MKIMAGE_KERNEL_TYPE` Specifies the type argument for the kernel as passed to ``uboot-mkimage``. @@ -8826,31 +8976,27 @@ system and gives an overview of their function and contents. :term:`UBOOT_MKIMAGE_SIGN` Specifies the name of the mkimage command as used by the - :ref:`kernel-fitimage ` class to sign + :ref:`ref-classes-kernel-fitimage` class to sign the FIT image after it has been assembled (if enabled). This can be used to substitute an alternative command, wrapper script or function if desired. The default is "${:term:`UBOOT_MKIMAGE`}". :term:`UBOOT_MKIMAGE_SIGN_ARGS` Optionally specifies additional arguments for the - :ref:`kernel-fitimage ` class to pass to the + :ref:`ref-classes-kernel-fitimage` class to pass to the mkimage command when signing the FIT image. :term:`UBOOT_RD_ENTRYPOINT` - Specifies the entrypoint for the RAM disk image. - During FIT image creation, the - :term:`UBOOT_RD_ENTRYPOINT` variable is used - in :ref:`kernel-fitimage ` class to specify the - entrypoint to be used in creating the Image Tree Source for - the FIT image. + Specifies the entrypoint for the RAM disk image. During FIT image + creation, the :term:`UBOOT_RD_ENTRYPOINT` variable is used in + :ref:`ref-classes-kernel-fitimage` class to specify the entrypoint to be + used in creating the Image Tree Source for the FIT image. :term:`UBOOT_RD_LOADADDRESS` - Specifies the load address for the RAM disk image. - During FIT image creation, the - :term:`UBOOT_RD_LOADADDRESS` variable is used - in :ref:`kernel-fitimage ` class to specify the - load address to be used in creating the Image Tree Source for - the FIT image. + Specifies the load address for the RAM disk image. During FIT image + creation, the :term:`UBOOT_RD_LOADADDRESS` variable is used in + :ref:`ref-classes-kernel-fitimage` class to specify the load address to + be used in creating the Image Tree Source for the FIT image. :term:`UBOOT_SIGN_ENABLE` Enable signing of FIT image. The default value is "0". @@ -8892,12 +9038,12 @@ system and gives an overview of their function and contents. The configure arguments check that uses :term:`UNKNOWN_CONFIGURE_OPT_IGNORE` is part of the - :ref:`insane ` class and is only enabled if the - recipe inherits the :ref:`autotools ` class. + :ref:`ref-classes-insane` class and is only enabled if the + recipe inherits the :ref:`ref-classes-autotools` class. :term:`UPDATERCPN` For recipes inheriting the - :ref:`update-rc.d ` class, :term:`UPDATERCPN` + :ref:`ref-classes-update-rc.d` class, :term:`UPDATERCPN` specifies the package that contains the initscript that is enabled. The default value is "${PN}". Given that almost all recipes that @@ -8911,8 +9057,7 @@ system and gives an overview of their function and contents. releases are not identified by Git tags, set :term:`UPSTREAM_CHECK_COMMITS` to ``1`` in the recipe, and the OpenEmbedded build system will compare the latest commit with the one currently specified - by the recipe (:term:`SRCREV`). - :: + by the recipe (:term:`SRCREV`):: UPSTREAM_CHECK_COMMITS = "1" @@ -8925,8 +9070,7 @@ system and gives an overview of their function and contents. You can use the :term:`UPSTREAM_CHECK_GITTAGREGEX` variable to provide a regular expression to filter only the relevant tags should the - default filter not work correctly. - :: + default filter not work correctly:: UPSTREAM_CHECK_GITTAGREGEX = "git_tag_regex" @@ -8934,8 +9078,7 @@ system and gives an overview of their function and contents. Use the :term:`UPSTREAM_CHECK_REGEX` variable to specify a different regular expression instead of the default one when the package checking system is parsing the page found using - :term:`UPSTREAM_CHECK_URI`. - :: + :term:`UPSTREAM_CHECK_URI`:: UPSTREAM_CHECK_REGEX = "package_regex" @@ -8946,8 +9089,7 @@ system and gives an overview of their function and contents. determined by fetching the directory listing where the tarball is and attempting to find a later tarball. When this approach does not work, you can use :term:`UPSTREAM_CHECK_URI` to provide a different URI that - contains the link to the latest tarball. - :: + contains the link to the latest tarball:: UPSTREAM_CHECK_URI = "recipe_url" @@ -8958,8 +9100,7 @@ system and gives an overview of their function and contents. :term:`UPSTREAM_CHECK_GITTAGREGEX` and :term:`UPSTREAM_CHECK_COMMITS` variables in the recipe allows to determine what the latest upstream version is, you can set :term:`UPSTREAM_VERSION_UNKNOWN` to ``1`` in the recipe - to acknowledge that the check cannot be performed. - :: + to acknowledge that the check cannot be performed:: UPSTREAM_VERSION_UNKNOWN = "1" @@ -8969,13 +9110,13 @@ system and gives an overview of their function and contents. specifically set. Typically, you would set :term:`USE_DEVFS` to "0" for a statically populated ``/dev`` directory. - See the ":ref:`dev-manual/common-tasks:selecting a device manager`" section in + See the ":ref:`dev-manual/device-manager:selecting a device manager`" section in the Yocto Project Development Tasks Manual for information on how to use this variable. :term:`USE_VT` When using - :ref:`SysVinit `, + :ref:`SysVinit `, determines whether or not to run a `getty `__ on any virtual terminals in order to enable logging in through those @@ -9056,7 +9197,7 @@ system and gives an overview of their function and contents. causes the build system to use static ``gid`` values. :term:`USERADD_PACKAGES` - When inheriting the :ref:`useradd ` class, + When inheriting the :ref:`ref-classes-useradd` class, this variable specifies the individual packages within the recipe that require users and/or groups to be added. @@ -9073,7 +9214,7 @@ system and gives an overview of their function and contents. :term:`GROUPADD_PARAM`, or :term:`GROUPMEMS_PARAM` variables. :term:`USERADD_PARAM` - When inheriting the :ref:`useradd ` class, + When inheriting the :ref:`ref-classes-useradd` class, this variable specifies for a package what parameters should pass to the ``useradd`` command if you add a user to the system when the package is installed. @@ -9156,7 +9297,7 @@ system and gives an overview of their function and contents. OpenEmbedded build system to create a partitioned image (``image.wic``). For information on how to create a partitioned image, see the - ":ref:`dev-manual/common-tasks:creating partitioned images using wic`" + ":ref:`dev-manual/wic:creating partitioned images using wic`" section in the Yocto Project Development Tasks Manual. For details on the kickstart file format, see the ":doc:`/ref-manual/kickstart`" Chapter. @@ -9213,7 +9354,7 @@ system and gives an overview of their function and contents. - :term:`MULTIMACH_TARGET_SYS`: The target system identifier - :term:`PN`: The recipe name - :term:`EXTENDPE`: The epoch --- if :term:`PE` is not specified, which - is usually the case for most recipes, then `EXTENDPE` is blank. + is usually the case for most recipes, then :term:`EXTENDPE` is blank. - :term:`PV`: The recipe version - :term:`PR`: The recipe revision @@ -9249,7 +9390,7 @@ system and gives an overview of their function and contents. On systems where many tasks run in parallel, setting a limit to this can be helpful in controlling system resource usage. - :term:`XZ_MEMLIMIT` + :term:`XZ_MEMLIMIT` Specifies the maximum memory the xz compression should use as a percentage of system memory. If unconstrained the xz compressor can use large amounts of memory and become problematic with parallelism elsewhere in the build. diff --git a/poky/documentation/sdk-manual/appendix-customizing.rst b/poky/documentation/sdk-manual/appendix-customizing.rst index 66218fccd6..2be76875e0 100644 --- a/poky/documentation/sdk-manual/appendix-customizing.rst +++ b/poky/documentation/sdk-manual/appendix-customizing.rst @@ -44,14 +44,12 @@ build system applies them against ``local.conf`` and ``auto.conf``: :term:`ESDK_LOCALCONF_ALLOW` overrides either of the previous two filters. The default value is blank. -- Classes inherited globally with - :term:`INHERIT` that are listed in - :term:`ESDK_CLASS_INHERIT_DISABLE` - are disabled. Using :term:`ESDK_CLASS_INHERIT_DISABLE` to disable these - classes is the typical method to disable classes that are problematic - or unnecessary in the SDK context. The default value disables the - :ref:`buildhistory ` - and :ref:`icecc ` classes. +- Classes inherited globally with :term:`INHERIT` that are listed in + :term:`ESDK_CLASS_INHERIT_DISABLE` are disabled. Using + :term:`ESDK_CLASS_INHERIT_DISABLE` to disable these classes is the typical + method to disable classes that are problematic or unnecessary in the SDK + context. The default value disables the + :ref:`ref-classes-buildhistory` and :ref:`ref-classes-icecc` classes. Additionally, the contents of ``conf/sdk-extra.conf``, when present, are appended to the end of ``conf/local.conf`` within the produced SDK, @@ -74,8 +72,7 @@ adjustments: .. note:: - The default value of - ESDK_CLASS_INHERIT_DISABLE + The default value of :term:`ESDK_CLASS_INHERIT_DISABLE` is set using the "?=" operator. Consequently, you will need to either define the entire list by using the "=" operator, or you will need to append a value using either ":append" or the "+=" @@ -175,12 +172,12 @@ perform additional steps. These steps make it possible for anyone using the installed SDKs to update the installed SDKs by using the ``devtool sdk-update`` command: -1. Create a directory that can be shared over HTTP or HTTPS. You can do +#. Create a directory that can be shared over HTTP or HTTPS. You can do this by setting up a web server such as an :wikipedia:`Apache HTTP Server ` or :wikipedia:`Nginx ` server in the cloud to host the directory. This directory must contain the published SDK. -2. Set the +#. Set the :term:`SDK_UPDATE_URL` variable to point to the corresponding HTTP or HTTPS URL. Setting this variable causes any SDK built to default to that URL and thus, @@ -189,10 +186,10 @@ the installed SDKs to update the installed SDKs by using the ":ref:`sdk-manual/extensible:applying updates to an installed extensible sdk`" section. -3. Build the extensible SDK normally (i.e., use the +#. Build the extensible SDK normally (i.e., use the ``bitbake -c populate_sdk_ext`` imagename command). -4. Publish the SDK using the following command:: +#. Publish the SDK using the following command:: $ oe-publish-sdk some_path/sdk-installer.sh path_to_shared_http_directory @@ -247,7 +244,7 @@ If you want the users of an extensible SDK you build to be able to add items to the SDK without requiring the users to build the items from source, you need to do a number of things: -1. Ensure the additional items you want the user to be able to install +#. Ensure the additional items you want the user to be able to install are already built: - Build the items explicitly. You could use one or more "meta" @@ -259,12 +256,12 @@ source, you need to do a number of things: :term:`EXCLUDE_FROM_WORLD` variable for additional information. -2. Expose the ``sstate-cache`` directory produced by the build. +#. Expose the ``sstate-cache`` directory produced by the build. Typically, you expose this directory by making it available through an :wikipedia:`Apache HTTP Server ` or :wikipedia:`Nginx ` server. -3. Set the appropriate configuration so that the produced SDK knows how +#. Set the appropriate configuration so that the produced SDK knows how to find the configuration. The variable you need to set is :term:`SSTATE_MIRRORS`:: diff --git a/poky/documentation/sdk-manual/appendix-obtain.rst b/poky/documentation/sdk-manual/appendix-obtain.rst index b90247d2e0..ba844507d3 100644 --- a/poky/documentation/sdk-manual/appendix-obtain.rst +++ b/poky/documentation/sdk-manual/appendix-obtain.rst @@ -28,14 +28,14 @@ and then run the script to hand-install the toolchain. Follow these steps to locate and hand-install the toolchain: -1. *Go to the Installers Directory:* Go to +#. *Go to the Installers Directory:* Go to :yocto_dl:`/releases/yocto/yocto-&DISTRO;/toolchain/` -2. *Open the Folder for Your Build Host:* Open the folder that matches +#. *Open the Folder for Your Build Host:* Open the folder that matches your :term:`Build Host` (i.e. ``i686`` for 32-bit machines or ``x86_64`` for 64-bit machines). -3. *Locate and Download the SDK Installer:* You need to find and +#. *Locate and Download the SDK Installer:* You need to find and download the installer appropriate for your build host, target hardware, and image type. @@ -72,7 +72,7 @@ Follow these steps to locate and hand-install the toolchain: poky-glibc-x86_64-core-image-sato-core2-64-toolchain-ext-&DISTRO;.sh -4. *Run the Installer:* Be sure you have execution privileges and run +#. *Run the Installer:* Be sure you have execution privileges and run the installer. Following is an example from the ``Downloads`` directory:: @@ -91,13 +91,13 @@ Building an SDK Installer As an alternative to locating and downloading an SDK installer, you can build the SDK installer. Follow these steps: -1. *Set Up the Build Environment:* Be sure you are set up to use BitBake +#. *Set Up the Build Environment:* Be sure you are set up to use BitBake in a shell. See the ":ref:`dev-manual/start:preparing the build host`" section in the Yocto Project Development Tasks Manual for information on how to get a build host ready that is either a native Linux machine or a machine that uses CROPS. -2. *Clone the ``poky`` Repository:* You need to have a local copy of the +#. *Clone the ``poky`` Repository:* You need to have a local copy of the Yocto Project :term:`Source Directory` (i.e. a local ``poky`` repository). See the ":ref:`dev-manual/start:cloning the \`\`poky\`\` repository`" and @@ -107,12 +107,11 @@ build the SDK installer. Follow these steps: how to clone the ``poky`` repository and check out the appropriate branch for your work. -3. *Initialize the Build Environment:* While in the root directory of +#. *Initialize the Build Environment:* While in the root directory of the Source Directory (i.e. ``poky``), run the :ref:`structure-core-script` environment setup script to define the OpenEmbedded build environment on your - build host. - :: + build host:: $ source oe-init-build-env @@ -121,12 +120,12 @@ build the SDK installer. Follow these steps: the script runs, your current working directory is set to the ``build`` directory. -4. *Make Sure You Are Building an Installer for the Correct Machine:* +#. *Make Sure You Are Building an Installer for the Correct Machine:* Check to be sure that your :term:`MACHINE` variable in the ``local.conf`` file in your :term:`Build Directory` matches the architecture for which you are building. -5. *Make Sure Your SDK Machine is Correctly Set:* If you are building a +#. *Make Sure Your SDK Machine is Correctly Set:* If you are building a toolchain designed to run on an architecture that differs from your current development host machine (i.e. the build host), be sure that the :term:`SDKMACHINE` variable in the ``local.conf`` file in your @@ -146,7 +145,7 @@ build the SDK installer. Follow these steps: different from the architecture of the build machine (``x86_64``). -6. *Build the SDK Installer:* To build the SDK installer for a standard +#. *Build the SDK Installer:* To build the SDK installer for a standard SDK and populate the SDK image, use the following command form. Be sure to replace ``image`` with an image (e.g. "core-image-sato"):: @@ -176,7 +175,7 @@ build the SDK installer. Follow these steps: static development libraries: TOOLCHAIN_TARGET_TASK:append = " libc-staticdev" -7. *Run the Installer:* You can now run the SDK installer from +#. *Run the Installer:* You can now run the SDK installer from ``tmp/deploy/sdk`` in the :term:`Build Directory`. Following is an example:: $ cd poky/build/tmp/deploy/sdk @@ -204,7 +203,7 @@ separately extract a root filesystem: Follow these steps to extract the root filesystem: -1. *Locate and Download the Tarball for the Pre-Built Root Filesystem +#. *Locate and Download the Tarball for the Pre-Built Root Filesystem Image File:* You need to find and download the root filesystem image file that is appropriate for your target system. These files are kept in machine-specific folders in the @@ -242,7 +241,7 @@ Follow these steps to extract the root filesystem: core-image-sato-sdk-beaglebone-yocto.tar.bz2 -2. *Initialize the Cross-Development Environment:* You must ``source`` +#. *Initialize the Cross-Development Environment:* You must ``source`` the cross-development environment setup script to establish necessary environment variables. @@ -254,7 +253,7 @@ Follow these steps to extract the root filesystem: $ source poky_sdk/environment-setup-core2-64-poky-linux -3. *Extract the Root Filesystem:* Use the ``runqemu-extract-sdk`` +#. *Extract the Root Filesystem:* Use the ``runqemu-extract-sdk`` command and provide the root filesystem image. Following is an example command that extracts the root filesystem diff --git a/poky/documentation/sdk-manual/extensible.rst b/poky/documentation/sdk-manual/extensible.rst index ed38ac3f3f..7c7ceb695a 100644 --- a/poky/documentation/sdk-manual/extensible.rst +++ b/poky/documentation/sdk-manual/extensible.rst @@ -47,7 +47,7 @@ Two ways to install the Extensible SDK Extensible SDK can be installed in two different ways, and both have their own pros and cons: -1. *Setting up the Extensible SDK environment directly in a Yocto build*. This +#. *Setting up the Extensible SDK environment directly in a Yocto build*. This avoids having to produce, test, distribute and maintain separate SDK installer archives, which can get very large. There is only one environment for the regular Yocto build and the SDK and less code paths where things can go not according to plan. @@ -56,7 +56,7 @@ git fetch or layer management tooling. The SDK extensibility is better than in t second option: just run ``bitbake`` again to add more things to the sysroot, or add layers if even more things are required. -2. *Setting up the Extensible SDK from a standalone installer*. This has the benefit of +#. *Setting up the Extensible SDK from a standalone installer*. This has the benefit of having a single, self-contained archive that includes all the needed binary artifacts. So nothing needs to be rebuilt, and there is no need to provide a well-functioning binary artefact cache over the network for developers with underpowered laptops. @@ -64,10 +64,10 @@ binary artefact cache over the network for developers with underpowered laptops. Setting up the Extensible SDK environment directly in a Yocto build ------------------------------------------------------------------- -1. Set up all the needed layers and a Yocto :term:`Build Directory`, e.g. a regular Yocto +#. Set up all the needed layers and a Yocto :term:`Build Directory`, e.g. a regular Yocto build where ``bitbake`` can be executed. -2. Run: +#. Run: $ bitbake meta-ide-support $ bitbake -c populate_sysroot gtk+3 (or any other target or native item that the application developer would need) @@ -138,16 +138,7 @@ must be writable for whichever users need to use the SDK. The following command shows how to run the installer given a toolchain tarball for a 64-bit x86 development host system and a 64-bit x86 target architecture. The example assumes the SDK installer is located in -``~/Downloads/`` and has execution rights. - -.. note:: - - If you do not have write permissions for the directory into which you - are installing the SDK, the installer notifies you and exits. For - that case, set up the proper permissions in the directory and run the - installer again. - -:: +``~/Downloads/`` and has execution rights:: $ ./Downloads/poky-glibc-x86_64-core-image-minimal-core2-64-toolchain-ext-2.5.sh Poky (Yocto Project Reference Distro) Extensible SDK installer version 2.5 @@ -168,6 +159,13 @@ architecture. The example assumes the SDK installer is located in Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. $ . /home/scottrif/poky_sdk/environment-setup-core2-64-poky-linux +.. note:: + + If you do not have write permissions for the directory into which you + are installing the SDK, the installer notifies you and exits. For + that case, set up the proper permissions in the directory and run the + installer again. + Running the Extensible SDK Environment Setup Script =================================================== @@ -281,7 +279,7 @@ command: .. image:: figures/sdk-devtool-add-flow.png :width: 100% -1. *Generating the New Recipe*: The top part of the flow shows three +#. *Generating the New Recipe*: The top part of the flow shows three scenarios by which you could use ``devtool add`` to generate a recipe based on existing source code. @@ -354,7 +352,7 @@ command: Aside from a recipe folder, the command also creates an associated append folder and places an initial ``*.bbappend`` file within. -2. *Edit the Recipe*: You can use ``devtool edit-recipe`` to open up the +#. *Edit the Recipe*: You can use ``devtool edit-recipe`` to open up the editor as defined by the ``$EDITOR`` environment variable and modify the file:: @@ -364,7 +362,7 @@ command: can make modifications to the recipe that take effect when you build it later. -3. *Build the Recipe or Rebuild the Image*: The next step you take +#. *Build the Recipe or Rebuild the Image*: The next step you take depends on what you are going to do with the new code. If you need to eventually move the build output to the target @@ -380,7 +378,7 @@ command: $ devtool build-image image -4. *Deploy the Build Output*: When you use the ``devtool build`` command +#. *Deploy the Build Output*: When you use the ``devtool build`` command to build out your recipe, you probably want to see if the resulting build output works as expected on the target hardware. @@ -402,12 +400,11 @@ command: ``devtool`` does not provide a specific command that allows you to deploy the image to actual hardware. -5. *Finish Your Work With the Recipe*: The ``devtool finish`` command +#. *Finish Your Work With the Recipe*: The ``devtool finish`` command creates any patches corresponding to commits in the local Git repository, moves the new recipe to a more permanent layer, and then resets the recipe so that the recipe is built normally rather than - from the workspace. - :: + from the workspace:: $ devtool finish recipe layer @@ -449,7 +446,7 @@ command: .. image:: figures/sdk-devtool-modify-flow.png :width: 100% -1. *Preparing to Modify the Code*: The top part of the flow shows three +#. *Preparing to Modify the Code*: The top part of the flow shows three scenarios by which you could use ``devtool modify`` to prepare to work on source files. Each scenario assumes the following: @@ -558,11 +555,11 @@ command: append file for the recipe in the ``devtool`` workspace. The recipe and the source code remain in their original locations. -2. *Edit the Source*: Once you have used the ``devtool modify`` command, +#. *Edit the Source*: Once you have used the ``devtool modify`` command, you are free to make changes to the source files. You can use any editor you like to make and save your source code modifications. -3. *Build the Recipe or Rebuild the Image*: The next step you take +#. *Build the Recipe or Rebuild the Image*: The next step you take depends on what you are going to do with the new code. If you need to eventually move the build output to the target @@ -575,7 +572,7 @@ command: (e.g. for testing purposes), you can use the ``devtool build-image`` command: $ devtool build-image image -4. *Deploy the Build Output*: When you use the ``devtool build`` command +#. *Deploy the Build Output*: When you use the ``devtool build`` command to build out your recipe, you probably want to see if the resulting build output works as expected on target hardware. @@ -600,13 +597,12 @@ command: ``devtool`` does not provide a specific command to deploy the image to actual hardware. -5. *Finish Your Work With the Recipe*: The ``devtool finish`` command +#. *Finish Your Work With the Recipe*: The ``devtool finish`` command creates any patches corresponding to commits in the local Git repository, updates the recipe to point to them (or creates a ``.bbappend`` file to do so, depending on the specified destination layer), and then resets the recipe so that the recipe is built - normally rather than from the workspace. - :: + normally rather than from the workspace:: $ devtool finish recipe layer @@ -652,7 +648,7 @@ counterparts. ``devtool upgrade`` happens to be one. You can read about all the methods by which you can upgrade recipes in the - :ref:`dev-manual/common-tasks:upgrading recipes` section + :ref:`dev-manual/upgrading-recipes:upgrading recipes` section of the Yocto Project Development Tasks Manual. The ``devtool upgrade`` command is flexible enough to allow you to @@ -668,7 +664,7 @@ The following diagram shows the common development flow used with the .. image:: figures/sdk-devtool-upgrade-flow.png :width: 100% -1. *Initiate the Upgrade*: The top part of the flow shows the typical +#. *Initiate the Upgrade*: The top part of the flow shows the typical scenario by which you use the ``devtool upgrade`` command. The following conditions exist: @@ -720,7 +716,7 @@ The following diagram shows the common development flow used with the are incorporated into the build the next time you build the software just as are other changes you might have made to the source. -2. *Resolve any Conflicts created by the Upgrade*: Conflicts could happen +#. *Resolve any Conflicts created by the Upgrade*: Conflicts could happen after upgrading the software to a new version. Conflicts occur if your recipe specifies some patch files in :term:`SRC_URI` that conflict with changes made in the new version of the software. For @@ -731,7 +727,7 @@ The following diagram shows the common development flow used with the conflicts created through use of a newer or different version of the software. -3. *Build the Recipe or Rebuild the Image*: The next step you take +#. *Build the Recipe or Rebuild the Image*: The next step you take depends on what you are going to do with the new code. If you need to eventually move the build output to the target @@ -746,7 +742,7 @@ The following diagram shows the common development flow used with the $ devtool build-image image -4. *Deploy the Build Output*: When you use the ``devtool build`` command +#. *Deploy the Build Output*: When you use the ``devtool build`` command or ``bitbake`` to build your recipe, you probably want to see if the resulting build output works as expected on target hardware. @@ -768,7 +764,7 @@ The following diagram shows the common development flow used with the ``devtool`` does not provide a specific command that allows you to do this. -5. *Finish Your Work With the Recipe*: The ``devtool finish`` command +#. *Finish Your Work With the Recipe*: The ``devtool finish`` command creates any patches corresponding to commits in the local Git repository, moves the new recipe to a more permanent layer, and then resets the recipe so that the recipe is built normally rather than @@ -780,8 +776,7 @@ The following diagram shows the common development flow used with the If you specify a destination layer that is the same as the original source, then the old version of the recipe and associated files are - removed prior to adding the new version. - :: + removed prior to adding the new version:: $ devtool finish recipe layer @@ -1059,17 +1054,17 @@ Working With Recipes When building a recipe using the ``devtool build`` command, the typical build progresses as follows: -1. Fetch the source +#. Fetch the source -2. Unpack the source +#. Unpack the source -3. Configure the source +#. Configure the source -4. Compile the source +#. Compile the source -5. Install the build output +#. Install the build output -6. Package the installed output +#. Package the installed output For recipes in the workspace, fetching and unpacking is disabled as the source tree has already been prepared and is persistent. Each of these @@ -1084,9 +1079,8 @@ does not include complete instructions for building the software. Instead, common functionality is encapsulated in classes inherited with the ``inherit`` directive. This technique leaves the recipe to describe just the things that are specific to the software being built. There is -a :ref:`base ` class that -is implicitly inherited by all recipes and provides the functionality -that most recipes typically need. +a :ref:`ref-classes-base` class that is implicitly inherited by all recipes +and provides the functionality that most recipes typically need. The remainder of this section presents information useful when working with recipes. @@ -1114,7 +1108,7 @@ links created within the source tree: - ``sysroot-destdir/``: Contains a subset of files installed within :ref:`ref-tasks-install` that have been put into the shared sysroot. For more information, see the - ":ref:`dev-manual/common-tasks:sharing files between recipes`" section. + ":ref:`dev-manual/new-recipe:sharing files between recipes`" section. - ``packages-split/``: Contains subdirectories for each package produced by the recipe. For more information, see the @@ -1327,15 +1321,15 @@ those customers need an SDK that has custom libraries. In such a case, you can produce a derivative SDK based on the currently installed SDK fairly easily by following these steps: -1. If necessary, install an extensible SDK that you want to use as a +#. If necessary, install an extensible SDK that you want to use as a base for your derivative SDK. -2. Source the environment script for the SDK. +#. Source the environment script for the SDK. -3. Add the extra libraries or other components you want by using the +#. Add the extra libraries or other components you want by using the ``devtool add`` command. -4. Run the ``devtool build-sdk`` command. +#. Run the ``devtool build-sdk`` command. The previous steps take the recipes added to the workspace and construct a new SDK installer that contains those recipes and the resulting binary diff --git a/poky/documentation/sdk-manual/intro.rst b/poky/documentation/sdk-manual/intro.rst index ce00538b2a..49aa921e70 100644 --- a/poky/documentation/sdk-manual/intro.rst +++ b/poky/documentation/sdk-manual/intro.rst @@ -164,11 +164,11 @@ image. You just need to follow these general steps: -1. *Install the SDK for your target hardware:* For information on how to +#. *Install the SDK for your target hardware:* For information on how to install the SDK, see the ":ref:`sdk-manual/using:installing the sdk`" section. -2. *Download or Build the Target Image:* The Yocto Project supports +#. *Download or Build the Target Image:* The Yocto Project supports several target architectures and has many pre-built kernel images and root filesystem images. @@ -195,7 +195,7 @@ You just need to follow these general steps: ":ref:`sdk-manual/appendix-obtain:extracting the root filesystem`" section for information on how to do this extraction. -3. *Develop and Test your Application:* At this point, you have the +#. *Develop and Test your Application:* At this point, you have the tools to develop your application. If you need to separately install and use the QEMU emulator, you can go to `QEMU Home Page `__ to download and learn about diff --git a/poky/documentation/sdk-manual/using.rst b/poky/documentation/sdk-manual/using.rst index 301627812c..f1ff0c76ca 100644 --- a/poky/documentation/sdk-manual/using.rst +++ b/poky/documentation/sdk-manual/using.rst @@ -52,8 +52,7 @@ libraries appropriate for developing against the corresponding image. The names of the tarball installer scripts are such that a string representing the host system appears first in the filename and then is -immediately followed by a string representing the target architecture. -:: +immediately followed by a string representing the target architecture:: poky-glibc-host_system-image_type-arch-toolchain-release_version.sh @@ -97,16 +96,7 @@ must be writable for whichever users need to use the SDK. The following command shows how to run the installer given a toolchain tarball for a 64-bit x86 development host system and a 64-bit x86 target architecture. The example assumes the SDK installer is located in -``~/Downloads/`` and has execution rights. - -.. note:: - - If you do not have write permissions for the directory into which you - are installing the SDK, the installer notifies you and exits. For - that case, set up the proper permissions in the directory and run the - installer again. - -:: +``~/Downloads/`` and has execution rights:: $ ./Downloads/poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh Poky (Yocto Project Reference Distro) SDK installer version &DISTRO; @@ -119,6 +109,13 @@ architecture. The example assumes the SDK installer is located in Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. $ . /opt/poky/&DISTRO;/environment-setup-i586-poky-linux +.. note:: + + If you do not have write permissions for the directory into which you + are installing the SDK, the installer notifies you and exits. For + that case, set up the proper permissions in the directory and run the + installer again. + Again, reference the ":ref:`sdk-manual/appendix-obtain:installed standard sdk directory structure`" section for more details on the resulting directory structure of the installed diff --git a/poky/documentation/sdk-manual/working-projects.rst b/poky/documentation/sdk-manual/working-projects.rst index 0eddee08e3..9a0db0099d 100644 --- a/poky/documentation/sdk-manual/working-projects.rst +++ b/poky/documentation/sdk-manual/working-projects.rst @@ -31,10 +31,9 @@ project: GNOME Developer site. -1. *Create a Working Directory and Populate It:* Create a clean +#. *Create a Working Directory and Populate It:* Create a clean directory for your project and then make that directory your working - location. - :: + location:: $ mkdir $HOME/helloworld $ cd $HOME/helloworld @@ -75,7 +74,7 @@ project: bin_PROGRAMS = hello hello_SOURCES = hello.c -2. *Source the Cross-Toolchain Environment Setup File:* As described +#. *Source the Cross-Toolchain Environment Setup File:* As described earlier in the manual, installing the cross-toolchain creates a cross-toolchain environment setup script in the directory that the SDK was installed. Before you can use the tools to develop your @@ -93,7 +92,7 @@ project: $ source tmp/deploy/images/qemux86-64/environment-setup-core2-64-poky-linux -3. *Create the configure Script:* Use the ``autoreconf`` command to +#. *Create the configure Script:* Use the ``autoreconf`` command to generate the ``configure`` script:: $ autoreconf @@ -109,7 +108,7 @@ project: which ensures missing auxiliary files are copied to the build host. -4. *Cross-Compile the Project:* This command compiles the project using +#. *Cross-Compile the Project:* This command compiles the project using the cross-compiler. The :term:`CONFIGURE_FLAGS` environment variable provides the minimal arguments for GNU @@ -130,7 +129,7 @@ project: $ ./configure --host=armv5te-poky-linux-gnueabi --with-libtool-sysroot=sysroot_dir -5. *Make and Install the Project:* These two commands generate and +#. *Make and Install the Project:* These two commands generate and install the project into the destination directory:: $ make @@ -146,12 +145,11 @@ project: This next command is a simple way to verify the installation of your project. Running the command prints the architecture on which the binary file can run. This architecture should be the same - architecture that the installed cross-toolchain supports. - :: + architecture that the installed cross-toolchain supports:: $ file ./tmp/usr/local/bin/hello -6. *Execute Your Project:* To execute the project, you would need to run +#. *Execute Your Project:* To execute the project, you would need to run it on your target hardware. If your target hardware happens to be your build host, you could run the project as follows:: @@ -210,8 +208,7 @@ demonstrates these variable behaviors. In a new shell environment variables are not established for the SDK until you run the setup script. For example, the following commands show a null value for the compiler variable (i.e. -:term:`CC`). -:: +:term:`CC`):: $ echo ${CC} @@ -230,10 +227,9 @@ established through the script:: To illustrate variable use, work through this simple "Hello World!" example: -1. *Create a Working Directory and Populate It:* Create a clean +#. *Create a Working Directory and Populate It:* Create a clean directory for your project and then make that directory your working - location. - :: + location:: $ mkdir $HOME/helloworld $ cd $HOME/helloworld @@ -270,7 +266,7 @@ example: printf("\n"); } -2. *Source the Cross-Toolchain Environment Setup File:* As described +#. *Source the Cross-Toolchain Environment Setup File:* As described earlier in the manual, installing the cross-toolchain creates a cross-toolchain environment setup script in the directory that the SDK was installed. Before you can use the tools to develop your @@ -288,7 +284,7 @@ example: $ source tmp/deploy/images/qemux86-64/environment-setup-core2-64-poky-linux -3. *Create the Makefile:* For this example, the Makefile contains +#. *Create the Makefile:* For this example, the Makefile contains two lines that can be used to set the :term:`CC` variable. One line is identical to the value that is set when you run the SDK environment setup script, and the other line sets :term:`CC` to "gcc", the default @@ -306,7 +302,7 @@ example: rm -rf *.o rm target_bin -4. *Make the Project:* Use the ``make`` command to create the binary +#. *Make the Project:* Use the ``make`` command to create the binary output file. Because variables are commented out in the Makefile, the value used for :term:`CC` is the value set when the SDK environment setup file was run:: @@ -322,8 +318,7 @@ example: You can override the :term:`CC` environment variable with the same variable as set from the Makefile by uncommenting the line in the - Makefile and running ``make`` again. - :: + Makefile and running ``make`` again:: $ make clean rm -rf *.o @@ -392,7 +387,7 @@ example: use the SDK environment variables regardless of the values in the Makefile. -5. *Execute Your Project:* To execute the project (i.e. ``target_bin``), +#. *Execute Your Project:* To execute the project (i.e. ``target_bin``), use the following command:: $ ./target_bin diff --git a/poky/documentation/test-manual/intro.rst b/poky/documentation/test-manual/intro.rst index 0831f80466..aaf64ae017 100644 --- a/poky/documentation/test-manual/intro.rst +++ b/poky/documentation/test-manual/intro.rst @@ -100,12 +100,11 @@ the following types of tests: different configurations, such as different init systems. The Autobuilder tests literally hundreds of configurations and targets. - - *Sanity Checks During the Build Process:* Tests initiated through - the :ref:`insane ` - class. These checks ensure the output of the builds are correct. - For example, does the ELF architecture in the generated binaries - match the target system? ARM binaries would not work in a MIPS - system! + - *Sanity Checks During the Build Process:* Tests initiated through the + :ref:`ref-classes-insane` class. These checks ensure the output of the + builds are correct. For example, does the ELF architecture in the + generated binaries match the target system? ARM binaries would not work + in a MIPS system! - *Build Performance Testing:* Tests whether or not commonly used steps during builds work efficiently and avoid regressions. Tests to time @@ -121,7 +120,8 @@ the following types of tests: $ bitbake image -c testsdkext - The tests utilize the :ref:`testsdkext ` class and the ``do_testsdkext`` task. + The tests utilize the :ref:`ref-classes-testsdk` class and the + ``do_testsdkext`` task. - *Feature Testing:* Various scenario-based tests are run through the :ref:`OpenEmbedded Self test (oe-selftest) `. We test oe-selftest on each of the main distributions @@ -131,7 +131,7 @@ the following types of tests: $ bitbake image -c testimage - The tests utilize the :ref:`testimage ` + The tests utilize the :ref:`ref-classes-testimage` class and the :ref:`ref-tasks-testimage` task. - *Layer Testing:* The Autobuilder has the possibility to test whether @@ -142,7 +142,7 @@ the following types of tests: - *Package Testing:* A Package Test (ptest) runs tests against packages built by the OpenEmbedded build system on the target machine. See the :ref:`Testing Packages With - ptest ` section + ptest ` section in the Yocto Project Development Tasks Manual and the ":yocto_wiki:`Ptest `" Wiki page for more information on Ptest. @@ -151,7 +151,7 @@ the following types of tests: $ bitbake image -c testsdk - The tests utilize the :ref:`testsdk ` class and + The tests utilize the :ref:`ref-classes-testsdk` class and the ``do_testsdk`` task. - *Unit Testing:* Unit tests on various components of the system run @@ -512,14 +512,14 @@ workers, consider the following: **Running "cleanall" is not permitted.** -This can delete files from DL_DIR which would potentially break other -builds running in parallel. If this is required, DL_DIR must be set to +This can delete files from :term:`DL_DIR` which would potentially break other +builds running in parallel. If this is required, :term:`DL_DIR` must be set to an isolated directory. **Running "cleansstate" is not permitted.** -This can delete files from SSTATE_DIR which would potentially break -other builds running in parallel. If this is required, SSTATE_DIR must +This can delete files from :term:`SSTATE_DIR` which would potentially break +other builds running in parallel. If this is required, :term:`SSTATE_DIR` must be set to an isolated directory. Alternatively, you can use the "-f" option with the ``bitbake`` command to "taint" tasks by changing the sstate checksums to ensure sstate cache items will not be reused. diff --git a/poky/documentation/test-manual/reproducible-builds.rst b/poky/documentation/test-manual/reproducible-builds.rst index 61127de23c..2a2f7790d2 100644 --- a/poky/documentation/test-manual/reproducible-builds.rst +++ b/poky/documentation/test-manual/reproducible-builds.rst @@ -71,7 +71,7 @@ things we do within the build system to ensure reproducibility include: .. note:: Because of an open bug in GCC, using ``DISTRO_FEATURES:append = " lto"`` or - adding ``-flto`` (Link Time Optimization) to ``CFLAGS`` makes the resulting + adding ``-flto`` (Link Time Optimization) to :term:`CFLAGS` makes the resulting binary non-reproducible, in that it depends on the full absolute build path to ``recipe-sysroot-native``, so installing the Yocto Project in a different directory results in a different binary. diff --git a/poky/documentation/test-manual/understand-autobuilder.rst b/poky/documentation/test-manual/understand-autobuilder.rst index 66471972de..7a6cb2443b 100644 --- a/poky/documentation/test-manual/understand-autobuilder.rst +++ b/poky/documentation/test-manual/understand-autobuilder.rst @@ -170,7 +170,7 @@ the system can checkout repositories. Shared DL_DIR ------------- -The Workers are all connected over NFS which allows DL_DIR to be shared +The Workers are all connected over NFS which allows :term:`DL_DIR` to be shared between them. This reduces network accesses from the system and allows the build to be sped up. Usage of the directory within the build system is designed to be able to be shared over NFS. @@ -204,9 +204,9 @@ The ``scripts/run-config`` execution is where most of the work within the Autobuilder happens. It runs through a number of steps; the first are general setup steps that are run once and include: -#. Set up any ``buildtools-tarball`` if configured. +#. Set up any :term:`buildtools` tarball if configured. -#. Call "buildhistory-init" if buildhistory is configured. +#. Call "buildhistory-init" if :ref:`ref-classes-buildhistory` is configured. For each step that is configured in ``config.json``, it will perform the following: diff --git a/poky/documentation/test-manual/yocto-project-compatible.rst b/poky/documentation/test-manual/yocto-project-compatible.rst index 96c12ac083..65d924fad9 100644 --- a/poky/documentation/test-manual/yocto-project-compatible.rst +++ b/poky/documentation/test-manual/yocto-project-compatible.rst @@ -27,7 +27,7 @@ In the second version of the program, a script was added to make validation easier and clearer, the script is called ``yocto-check-layer`` and is available in :term:`OpenEmbedded-Core (OE-Core)`. -See :ref:`dev-manual/common-tasks:making sure your layer is compatible with yocto project` +See :ref:`dev-manual/layers:making sure your layer is compatible with yocto project` for details. ======== diff --git a/poky/documentation/toaster-manual/intro.rst b/poky/documentation/toaster-manual/intro.rst index a324744b7d..046ff88ce8 100644 --- a/poky/documentation/toaster-manual/intro.rst +++ b/poky/documentation/toaster-manual/intro.rst @@ -76,9 +76,8 @@ extensive information about the build process. - See performance information such as build time, task time, CPU usage, and disk I/O. -For an overview of Toaster shipped with the Yocto Project &DISTRO; -Release, see the "`Toaster - Yocto Project -2.2 `__" video. +For an overview of Toaster, see this +`introduction video `__. Installation Options ==================== diff --git a/poky/documentation/toaster-manual/reference.rst b/poky/documentation/toaster-manual/reference.rst index f8aabeed04..755b895cee 100644 --- a/poky/documentation/toaster-manual/reference.rst +++ b/poky/documentation/toaster-manual/reference.rst @@ -65,7 +65,7 @@ layers. For general information on layers, see the ":ref:`overview-manual/yp-intro:the yocto project layer model`" section in the Yocto Project Overview and Concepts Manual. For information on how -to create layers, see the ":ref:`dev-manual/common-tasks:understanding and creating layers`" +to create layers, see the ":ref:`dev-manual/layers:understanding and creating layers`" section in the Yocto Project Development Tasks Manual. Configuring Toaster to Hook Into Your Layer Index @@ -188,17 +188,17 @@ The ``bldcontrol/management/commands/checksettings.py`` file controls workflow configuration. Here is the process to initially populate this database. -1. The default project settings are set from +#. The default project settings are set from ``orm/fixtures/settings.xml``. -2. The default project distro and layers are added from +#. The default project distro and layers are added from ``orm/fixtures/poky.xml`` if poky is installed. If poky is not installed, they are added from ``orm/fixtures/oe-core.xml``. -3. If the ``orm/fixtures/custom.xml`` file exists, then its values are +#. If the ``orm/fixtures/custom.xml`` file exists, then its values are added. -4. The layer index is then scanned and added to the database. +#. The layer index is then scanned and added to the database. Once these steps complete, Toaster is set up and ready to use. diff --git a/poky/documentation/transitioning-to-a-custom-environment.rst b/poky/documentation/transitioning-to-a-custom-environment.rst index ee1fc891ab..6ff55e5619 100644 --- a/poky/documentation/transitioning-to-a-custom-environment.rst +++ b/poky/documentation/transitioning-to-a-custom-environment.rst @@ -42,7 +42,7 @@ Transitioning to a custom environment for systems development You might want to start with the build specification that Poky provides (which is reference embedded distribution) and then add your newly chosen layers to that. Here is the information :ref:`about adding layers - `. + `. #. **Based on the layers you've chosen, make needed changes in your configuration**. @@ -58,7 +58,7 @@ Transitioning to a custom environment for systems development releases. If you are using a Yocto Project release earlier than 2.4, use the ``yocto-layer create`` tool. The ``bitbake-layers`` tool also provides a number of other useful layer-related commands. See - :ref:`dev-manual/common-tasks:creating a general layer using the + :ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script` section. #. **Create your own layer for the BSP you're going to use**. @@ -79,7 +79,7 @@ Transitioning to a custom environment for systems development process of refinement. Start by getting each step of the build process working beginning with fetching all the way through packaging. Next, run the software on your target and refine further as needed. See :ref:`Writing a New - Recipe ` in the + Recipe ` in the Yocto Project Development Tasks Manual for more information. #. **Now you're ready to create an image recipe**. @@ -103,7 +103,7 @@ Transitioning to a custom environment for systems development needs to change for your distribution. If you find yourself adding a lot of configuration to your local.conf file aside from paths and other typical local settings, it's time to :ref:`consider creating your own distribution - `. + `. You can add product specifications that can customize the distribution if needed in other layers. You can also add other functionality specific to the diff --git a/poky/documentation/what-i-wish-id-known.rst b/poky/documentation/what-i-wish-id-known.rst index 46c5cf19f9..10f746ff1f 100644 --- a/poky/documentation/what-i-wish-id-known.rst +++ b/poky/documentation/what-i-wish-id-known.rst @@ -132,7 +132,7 @@ contact us with other suggestions. say "bitbake foo" where "foo" is the name for a specific recipe. As you become more advanced using the Yocto Project, and if builds are failing, it can be useful to make sure the fetch itself works as desired. Here are some - valuable links: :ref:`dev-manual/common-tasks:Using a Development + valuable links: :ref:`dev-manual/development-shell:Using a Development Shell` for information on how to build and run a specific task using devshell. Also, the :ref:`SDK manual shows how to build out a specific recipe `. diff --git a/poky/meta-poky/conf/distro/poky-tiny.conf b/poky/meta-poky/conf/distro/poky-tiny.conf index 5772661588..ce466e30b7 100644 --- a/poky/meta-poky/conf/distro/poky-tiny.conf +++ b/poky/meta-poky/conf/distro/poky-tiny.conf @@ -82,9 +82,6 @@ DISTRO_FEATURES = "${DISTRO_FEATURES_TINY} \ ${DISTRO_FEATURES_WIFI} \ " -# Enable LFS - see bug YOCTO #5865 -DISTRO_FEATURES:append:libc-musl = " largefile" - DISTRO_FEATURES:class-native = "${DISTRO_FEATURES_DEFAULT} ${POKY_DEFAULT_DISTRO_FEATURES}" DISTRO_FEATURES:class-nativesdk = "${DISTRO_FEATURES_DEFAULT} ${POKY_DEFAULT_DISTRO_FEATURES}" diff --git a/poky/meta-poky/conf/distro/poky.conf b/poky/meta-poky/conf/distro/poky.conf index 3e90766349..dc0e8e76ab 100644 --- a/poky/meta-poky/conf/distro/poky.conf +++ b/poky/meta-poky/conf/distro/poky.conf @@ -14,7 +14,7 @@ TARGET_VENDOR = "-poky" LOCALCONF_VERSION = "2" # Override these in poky based distros -POKY_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch wayland vulkan" +POKY_DEFAULT_DISTRO_FEATURES = "opengl ptest multiarch wayland vulkan" POKY_DEFAULT_EXTRA_RDEPENDS = "packagegroup-core-boot" POKY_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet" @@ -41,6 +41,7 @@ SANITY_TESTED_DISTROS ?= " \ ubuntu-22.04 \n \ fedora-34 \n \ fedora-35 \n \ + fedora-36 \n \ debian-10 \n \ debian-11 \n \ opensuseleap-15.3 \n \ diff --git a/poky/meta-poky/conf/layer.conf b/poky/meta-poky/conf/layer.conf index 357cc803da..798269a0ef 100644 --- a/poky/meta-poky/conf/layer.conf +++ b/poky/meta-poky/conf/layer.conf @@ -9,7 +9,7 @@ BBFILE_COLLECTIONS += "yocto" BBFILE_PATTERN_yocto = "^${LAYERDIR}/" BBFILE_PRIORITY_yocto = "5" -LAYERSERIES_COMPAT_yocto = "kirkstone langdale" +LAYERSERIES_COMPAT_yocto = "mickledore" # This should only be incremented on significant changes that will # cause compatibility issues with other layers diff --git a/poky/meta-poky/conf/templates/default/local.conf.sample b/poky/meta-poky/conf/templates/default/local.conf.sample index 7be423ffed..f9cb8aa77d 100644 --- a/poky/meta-poky/conf/templates/default/local.conf.sample +++ b/poky/meta-poky/conf/templates/default/local.conf.sample @@ -143,7 +143,8 @@ DISTRO ?= "poky" # "debug-tweaks" - make an image suitable for development # e.g. ssh root access has a blank password # There are other application targets that can be used here too, see -# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# meta/classes-recipe/image.bbclass and +# meta/classes-recipe/core-image.bbclass for more details. # We default to enabling the debugging tweaks. EXTRA_IMAGE_FEATURES ?= "debug-tweaks" @@ -162,7 +163,7 @@ USER_CLASSES ?= "buildstats" # The build system can test booting virtual machine images under qemu (an emulator) # after any root filesystems are created and run tests against those images. It can also # run tests against any SDK that are built. To enable this uncomment these lines. -# See classes/test{image,sdk}.bbclass for further details. +# See meta/classes-recipe/test{image,sdk}.bbclass for further details. #IMAGE_CLASSES += "testimage testsdk" #TESTIMAGE_AUTO:qemuall = "1" diff --git a/poky/meta-selftest/conf/layer.conf b/poky/meta-selftest/conf/layer.conf index 0899806029..2eeea0444b 100644 --- a/poky/meta-selftest/conf/layer.conf +++ b/poky/meta-selftest/conf/layer.conf @@ -9,4 +9,6 @@ BBFILE_COLLECTIONS += "selftest" BBFILE_PATTERN_selftest = "^${LAYERDIR}/" BBFILE_PRIORITY_selftest = "5" -LAYERSERIES_COMPAT_selftest = "kirkstone langdale" +addpylib ${LAYERDIR}/lib oeqa + +LAYERSERIES_COMPAT_selftest = "mickledore" diff --git a/poky/meta-selftest/recipes-test/devtool/devtool-test-local/file3 b/poky/meta-selftest/recipes-test/devtool/devtool-test-local/file3 new file mode 100644 index 0000000000..0f30e9eec4 --- /dev/null +++ b/poky/meta-selftest/recipes-test/devtool/devtool-test-local/file3 @@ -0,0 +1 @@ +The third file. diff --git a/poky/meta-selftest/recipes-test/devtool/devtool-test-local_6.03.bb b/poky/meta-selftest/recipes-test/devtool/devtool-test-local_6.03.bb index 463cfe0a7a..d0fd697978 100644 --- a/poky/meta-selftest/recipes-test/devtool/devtool-test-local_6.03.bb +++ b/poky/meta-selftest/recipes-test/devtool/devtool-test-local_6.03.bb @@ -7,9 +7,12 @@ SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/syslinux-${PV}.tar.x file://file1 \ file://file2" +SRC_URI:append:class-native = " file://file3" + SRC_URI[md5sum] = "92a253df9211e9c20172796ecf388f13" SRC_URI[sha256sum] = "26d3986d2bea109d5dc0e4f8c4822a459276cf021125e8c9f23c3cca5d8c850e" S = "${WORKDIR}/syslinux-${PV}" EXCLUDE_FROM_WORLD = "1" +BBCLASSEXTEND = "native" diff --git a/poky/meta-selftest/recipes-test/devtool/devtool-test-localonly.bb b/poky/meta-selftest/recipes-test/devtool/devtool-test-localonly.bb index 3f7123cda0..e767619879 100644 --- a/poky/meta-selftest/recipes-test/devtool/devtool-test-localonly.bb +++ b/poky/meta-selftest/recipes-test/devtool/devtool-test-localonly.bb @@ -4,4 +4,7 @@ INHIBIT_DEFAULT_DEPS = "1" SRC_URI = "file://file1 \ file://file2" +SRC_URI:append:class-native = " file://file3" + EXCLUDE_FROM_WORLD = "1" +BBCLASSEXTEND = "native" diff --git a/poky/meta-selftest/recipes-test/devtool/devtool-test-localonly/file3 b/poky/meta-selftest/recipes-test/devtool/devtool-test-localonly/file3 new file mode 100644 index 0000000000..0f30e9eec4 --- /dev/null +++ b/poky/meta-selftest/recipes-test/devtool/devtool-test-localonly/file3 @@ -0,0 +1 @@ +The third file. diff --git a/poky/meta-skeleton/conf/layer.conf b/poky/meta-skeleton/conf/layer.conf index 1704a753a0..564ae26501 100644 --- a/poky/meta-skeleton/conf/layer.conf +++ b/poky/meta-skeleton/conf/layer.conf @@ -14,4 +14,4 @@ LAYERVERSION_skeleton = "1" LAYERDEPENDS_skeleton = "core" -LAYERSERIES_COMPAT_skeleton = "kirkstone langdale" +LAYERSERIES_COMPAT_skeleton = "mickledore" diff --git a/poky/meta-skeleton/recipes-baremetal/baremetal-examples/baremetal-helloworld_git.bb b/poky/meta-skeleton/recipes-baremetal/baremetal-examples/baremetal-helloworld_git.bb deleted file mode 100644 index d11e2e530e..0000000000 --- a/poky/meta-skeleton/recipes-baremetal/baremetal-examples/baremetal-helloworld_git.bb +++ /dev/null @@ -1,53 +0,0 @@ -SUMMARY = "Baremetal examples to work with the several QEMU architectures supported on OpenEmbedded" -HOMEPAGE = "https://github.com/aehs29/baremetal-helloqemu" -DESCRIPTION = "These are introductory examples to showcase the use of QEMU to run baremetal applications." -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=39346640a23c701e4f459e05f56f4449" - -SRCREV = "31b4e5a337018b4a00a7426b0e5ed83b81df30c7" -PV = "0.1+git${SRCPV}" - -SRC_URI = "git://github.com/aehs29/baremetal-helloqemu.git;protocol=https;branch=master" - -S = "${WORKDIR}/git" - -# The following variables should be set to accomodate each application -BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}" -IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}" -IMAGE_NAME_SUFFIX ?= "" - -# Baremetal-Image creates the proper wiring, assumes the output is provided in -# binary and ELF format, installed on ${base_libdir}/firmware/ , we want a -# package to be created since we might have some way of updating the baremetal -# firmware from Linux -inherit baremetal-image - - -# These parameters are app specific for this example -# This will be translated automatically to the architecture and -# machine that QEMU uses on OE, e.g. -machine virt -cpu cortex-a57 -# but the examples can also be run on other architectures/machines -# such as vexpress-a15 by overriding the setting on the machine.conf -COMPATIBLE_MACHINE = "qemuarmv5|qemuarm|qemuarm64|qemuriscv64|qemuriscv32" - -BAREMETAL_QEMUARCH ?= "" -BAREMETAL_QEMUARCH:qemuarmv5 = "versatile" -BAREMETAL_QEMUARCH:qemuarm = "arm" -BAREMETAL_QEMUARCH:qemuarm64 = "aarch64" -BAREMETAL_QEMUARCH:qemuriscv64 = "riscv64" -BAREMETAL_QEMUARCH:qemuriscv32 = "riscv32" - -EXTRA_OEMAKE:append = " QEMUARCH=${BAREMETAL_QEMUARCH} V=1" - - -# Install binaries on the proper location for baremetal-image to fetch and deploy -do_install(){ - install -d ${D}/${base_libdir}/firmware - install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.bin ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin - install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.elf ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf -} - -FILES:${PN} += " \ - ${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin \ - ${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf \ -" diff --git a/poky/meta-yocto-bsp/conf/layer.conf b/poky/meta-yocto-bsp/conf/layer.conf index 29f6037cce..a4c9f09916 100644 --- a/poky/meta-yocto-bsp/conf/layer.conf +++ b/poky/meta-yocto-bsp/conf/layer.conf @@ -9,4 +9,4 @@ BBFILE_COLLECTIONS += "yoctobsp" BBFILE_PATTERN_yoctobsp = "^${LAYERDIR}/" BBFILE_PRIORITY_yoctobsp = "5" LAYERVERSION_yoctobsp = "4" -LAYERSERIES_COMPAT_yoctobsp = "kirkstone langdale" +LAYERSERIES_COMPAT_yoctobsp = "mickledore" diff --git a/poky/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.15.bbappend b/poky/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.15.bbappend index a5c0ecdbd9..a969222442 100644 --- a/poky/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.15.bbappend +++ b/poky/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.15.bbappend @@ -7,17 +7,17 @@ KMACHINE:genericx86 ?= "common-pc" KMACHINE:genericx86-64 ?= "common-pc-64" KMACHINE:beaglebone-yocto ?= "beaglebone" -SRCREV_machine:genericx86 ?= "a40d2daf2795d89e3ef8af0413b25190558831ec" -SRCREV_machine:genericx86-64 ?= "a40d2daf2795d89e3ef8af0413b25190558831ec" -SRCREV_machine:edgerouter ?= "90f1ee6589264545f548d731c2480b08a007230f" -SRCREV_machine:beaglebone-yocto ?= "9aabbaa89fcb21af7028e814c1f5b61171314d5a" +SRCREV_machine:genericx86 ?= "1275299b4a49c5845378537d2d623dfbe027dcca" +SRCREV_machine:genericx86-64 ?= "1275299b4a49c5845378537d2d623dfbe027dcca" +SRCREV_machine:edgerouter ?= "28658152bb865c3e7ffde6ac277fab5dc1940c0a" +SRCREV_machine:beaglebone-yocto ?= "4f8b81b735ff381cde5ae840552727175393b77a" COMPATIBLE_MACHINE:genericx86 = "genericx86" COMPATIBLE_MACHINE:genericx86-64 = "genericx86-64" COMPATIBLE_MACHINE:edgerouter = "edgerouter" COMPATIBLE_MACHINE:beaglebone-yocto = "beaglebone-yocto" -LINUX_VERSION:genericx86 = "5.15.54" -LINUX_VERSION:genericx86-64 = "5.15.54" -LINUX_VERSION:edgerouter = "5.15.54" -LINUX_VERSION:beaglebone-yocto = "5.15.54" +LINUX_VERSION:genericx86 = "5.15.80" +LINUX_VERSION:genericx86-64 = "5.15.80" +LINUX_VERSION:edgerouter = "5.15.80" +LINUX_VERSION:beaglebone-yocto = "5.15.80" diff --git a/poky/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.19.bbappend b/poky/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.19.bbappend index ff5070ba4a..5794657cfe 100644 --- a/poky/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.19.bbappend +++ b/poky/meta-yocto-bsp/recipes-kernel/linux/linux-yocto_5.19.bbappend @@ -7,8 +7,8 @@ KMACHINE:genericx86 ?= "common-pc" KMACHINE:genericx86-64 ?= "common-pc-64" KMACHINE:beaglebone-yocto ?= "beaglebone" -SRCREV_machine:genericx86 ?= "43e6ab6ed043f4bc8e7cffbb08af86af0bdb5e12" -SRCREV_machine:genericx86-64 ?= "43e6ab6ed043f4bc8e7cffbb08af86af0bdb5e12" +SRCREV_machine:genericx86 ?= "aaf4490d1807c49e3e0ceab1372533937ef2c82b" +SRCREV_machine:genericx86-64 ?= "aaf4490d1807c49e3e0ceab1372533937ef2c82b" SRCREV_machine:edgerouter ?= "43e6ab6ed043f4bc8e7cffbb08af86af0bdb5e12" SRCREV_machine:beaglebone-yocto ?= "43e6ab6ed043f4bc8e7cffbb08af86af0bdb5e12" @@ -17,7 +17,7 @@ COMPATIBLE_MACHINE:genericx86-64 = "genericx86-64" COMPATIBLE_MACHINE:edgerouter = "edgerouter" COMPATIBLE_MACHINE:beaglebone-yocto = "beaglebone-yocto" -LINUX_VERSION:genericx86 = "5.19" -LINUX_VERSION:genericx86-64 = "5.19" +LINUX_VERSION:genericx86 = "5.19.17" +LINUX_VERSION:genericx86-64 = "5.19.17" LINUX_VERSION:edgerouter = "5.19" LINUX_VERSION:beaglebone-yocto = "5.19" diff --git a/poky/meta/classes-global/base.bbclass b/poky/meta/classes-global/base.bbclass index 8203f54519..64e805c947 100644 --- a/poky/meta/classes-global/base.bbclass +++ b/poky/meta/classes-global/base.bbclass @@ -15,31 +15,8 @@ inherit utils inherit utility-tasks inherit logging -OE_EXTRA_IMPORTS ?= "" - -OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust oe.buildcfg ${OE_EXTRA_IMPORTS}" -OE_IMPORTS[type] = "list" - PACKAGECONFIG_CONFARGS ??= "" -def oe_import(d): - import sys - - bbpath = [os.path.join(dir, "lib") for dir in d.getVar("BBPATH").split(":")] - sys.path[0:0] = [dir for dir in bbpath if dir not in sys.path] - - import oe.data - for toimport in oe.data.typed_value("OE_IMPORTS", d): - try: - # Make a python object accessible from the metadata - bb.utils._context[toimport.split(".", 1)[0]] = __import__(toimport) - except AttributeError as e: - bb.error("Error importing OE modules: %s" % str(e)) - return "" - -# We need the oe module name space early (before INHERITs get added) -OE_IMPORTED := "${@oe_import(d)}" - inherit metadata_scm def lsb_distro_identifier(d): @@ -139,7 +116,7 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True): # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc) # would return /usr/local/bin/ccache/gcc, but what we need is # /usr/bin/gcc, this code can check and fix that. - if "ccache" in srctool: + if os.path.islink(srctool) and os.path.basename(os.readlink(srctool)) == 'ccache': srctool = bb.utils.which(path, tool, executable=True, direction=1) if srctool: os.symlink(srctool, desttool) @@ -381,10 +358,6 @@ base_do_install() { : } -base_do_package() { - : -} - addtask build after do_populate_sysroot do_build[noexec] = "1" do_build[recrdeptask] += "do_deploy" @@ -786,4 +759,4 @@ python do_cleanall() { do_cleanall[nostamp] = "1" -EXPORT_FUNCTIONS do_fetch do_unpack do_configure do_compile do_install do_package +EXPORT_FUNCTIONS do_fetch do_unpack do_configure do_compile do_install diff --git a/poky/meta/classes-global/insane.bbclass b/poky/meta/classes-global/insane.bbclass index df2c40c3c5..ada8a7ef4e 100644 --- a/poky/meta/classes-global/insane.bbclass +++ b/poky/meta/classes-global/insane.bbclass @@ -506,6 +506,134 @@ def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages): trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "") oe.qa.add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (trimmed, name)) +QAPATHTEST[32bit-time] = "check_32bit_symbols" +def check_32bit_symbols(path, packagename, d, elf, messages): + """ + Check that ELF files do not use any 32 bit time APIs from glibc. + """ + import re + # This list is manually constructed by searching the image folder of the + # glibc recipe for __USE_TIME_BITS64. There is no good way to do this + # automatically. + api32 = { + # /usr/include/time.h + "clock_getres", "clock_gettime", "clock_nanosleep", "clock_settime", + "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r", "localtime", + "localtime_r", "mktime", "nanosleep", "time", "timegm", "timelocal", + "timer_gettime", "timer_settime", "timespec_get", "timespec_getres", + # /usr/include/bits/time.h + "clock_adjtime", + # /usr/include/signal.h + "sigtimedwait", + # /usr/include/sys/time.h + "futimes", "futimesat", "getitimer", "gettimeofday", "lutimes", + "setitimer", "settimeofday", "utimes", + # /usr/include/sys/timex.h + "adjtimex", "ntp_adjtime", "ntp_gettime", "ntp_gettimex", + # /usr/include/sys/wait.h + "wait3", "wait4", + # /usr/include/sys/stat.h + "fstat", "fstat64", "fstatat", "fstatat64", "futimens", "lstat", + "lstat64", "stat", "stat64", "utimensat", + # /usr/include/sys/poll.h + "ppoll", + # /usr/include/sys/resource.h + "getrusage", + # /usr/include/sys/ioctl.h + "ioctl", + # /usr/include/sys/select.h + "select", "pselect", + # /usr/include/sys/prctl.h + "prctl", + # /usr/include/sys/epoll.h + "epoll_pwait2", + # /usr/include/sys/timerfd.h + "timerfd_gettime", "timerfd_settime", + # /usr/include/sys/socket.h + "getsockopt", "recvmmsg", "recvmsg", "sendmmsg", "sendmsg", + "setsockopt", + # /usr/include/sys/msg.h + "msgctl", + # /usr/include/sys/sem.h + "semctl", "semtimedop", + # /usr/include/sys/shm.h + "shmctl", + # /usr/include/pthread.h + "pthread_clockjoin_np", "pthread_cond_clockwait", + "pthread_cond_timedwait", "pthread_mutex_clocklock", + "pthread_mutex_timedlock", "pthread_rwlock_clockrdlock", + "pthread_rwlock_clockwrlock", "pthread_rwlock_timedrdlock", + "pthread_rwlock_timedwrlock", "pthread_timedjoin_np", + # /usr/include/semaphore.h + "sem_clockwait", "sem_timedwait", + # /usr/include/threads.h + "cnd_timedwait", "mtx_timedlock", "thrd_sleep", + # /usr/include/aio.h + "aio_cancel", "aio_error", "aio_read", "aio_return", "aio_suspend", + "aio_write", "lio_listio", + # /usr/include/mqueue.h + "mq_timedreceive", "mq_timedsend", + # /usr/include/glob.h + "glob", "glob64", "globfree", "globfree64", + # /usr/include/sched.h + "sched_rr_get_interval", + # /usr/include/fcntl.h + "fcntl", "fcntl64", + # /usr/include/utime.h + "utime", + # /usr/include/ftw.h + "ftw", "ftw64", "nftw", "nftw64", + # /usr/include/fts.h + "fts64_children", "fts64_close", "fts64_open", "fts64_read", + "fts64_set", "fts_children", "fts_close", "fts_open", "fts_read", + "fts_set", + # /usr/include/netdb.h + "gai_suspend", + } + + ptrn = re.compile( + r''' + (?P[\da-fA-F]+) \s+ + (?P[lgu! ][w ][C ][W ][Ii ][dD ]F) \s+ + (?P
\*UND\*) \s+ + (?P(?P[\da-fA-F]+)) \s+ + (?P + ''' + + r'(?P' + r'|'.join(sorted(api32)) + r')' + + r''' + (@+(?PGLIBC_\d+\.\d+\S*))) + ''', re.VERBOSE + ) + + # elf is a oe.qa.ELFFile object + if elf is not None: + phdrs = elf.run_objdump("-tw", d) + syms = re.finditer(ptrn, phdrs) + usedapis = {sym.group('notag') for sym in syms} + if usedapis: + elfpath = package_qa_clean_path(path, d, packagename) + # Remove any .debug dir, heuristic that probably works + # At this point, any symbol information is stripped into the debug + # package, so that is the only place we will find them. + elfpath = elfpath.replace('.debug/', '') + allowed = ( + d.getVarFlag( + 'INSANE_SKIP:' + d.getVar('PN'), elfpath.replace('/', '_') + ) or '' + ).split() + usedapis -= set(allowed) + if usedapis: + msgformat = elfpath + " uses 32-bit api '%s'" + for sym in usedapis: + oe.qa.add_message(messages, '32bit-time', msgformat % sym) + oe.qa.add_message( + messages, '32bit-time', + 'Suppress with INSANE_SKIP:%s[%s] = "%s"' % ( + d.getVar('PN'), elfpath.replace('/', '_'), + ' '.join(usedapis) + ) + ) + # Check license variables do_populate_lic[postfuncs] += "populate_lic_qa_checksum" python populate_lic_qa_checksum() { diff --git a/poky/meta/classes-global/mirrors.bbclass b/poky/meta/classes-global/mirrors.bbclass index 8b984de3bf..cda431ce89 100644 --- a/poky/meta/classes-global/mirrors.bbclass +++ b/poky/meta/classes-global/mirrors.bbclass @@ -67,8 +67,7 @@ osc://.*/.* http://sources.openembedded.org/ \ https?://.*/.* http://sources.openembedded.org/ \ ftp://.*/.* http://sources.openembedded.org/ \ npm://.*/?.* http://sources.openembedded.org/ \ -${CPAN_MIRROR} http://cpan.metacpan.org/ \ -${CPAN_MIRROR} http://search.cpan.org/CPAN/ \ +${CPAN_MIRROR} https://cpan.metacpan.org/ \ https?://downloads.yoctoproject.org/releases/uninative/ https://mirrors.kernel.org/yocto/uninative/ \ https?://downloads.yoctoproject.org/mirror/sources/ https://mirrors.kernel.org/yocto-sources/ \ " diff --git a/poky/meta/classes-global/package.bbclass b/poky/meta/classes-global/package.bbclass index 7a0a428b30..7e96601cd9 100644 --- a/poky/meta/classes-global/package.bbclass +++ b/poky/meta/classes-global/package.bbclass @@ -69,21 +69,7 @@ PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native" PACKAGE_WRITE_DEPS ??= "" def legitimize_package_name(s): - """ - Make sure package names are legitimate strings - """ - import re - - def fixutf(m): - cp = m.group(1) - if cp: - return ('\\u%s' % cp).encode('latin-1').decode('unicode_escape') - - # Handle unicode codepoints encoded as , as in glibc locale files. - s = re.sub(r'', fixutf, s) - - # Remaining package name validity fixes - return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-') + return oe.package.legitimize_package_name(s) def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None, allow_links=False, summary=None): """ @@ -195,7 +181,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst mode = os.lstat(f).st_mode if not (stat.S_ISREG(mode) or (allow_links and stat.S_ISLNK(mode)) or (allow_dirs and stat.S_ISDIR(mode))): continue - on = legitimize_package_name(m.group(1)) + on = oe.package.legitimize_package_name(m.group(1)) pkg = output_pattern % on split_packages.add(pkg) if not pkg in packages: @@ -257,449 +243,6 @@ python () { d.appendVarFlag('do_package', 'deptask', " do_packagedata") } -# Get a list of files from file vars by searching files under current working directory -# The list contains symlinks, directories and normal files. -def files_from_filevars(filevars): - import os,glob - cpath = oe.cachedpath.CachedPath() - files = [] - for f in filevars: - if os.path.isabs(f): - f = '.' + f - if not f.startswith("./"): - f = './' + f - globbed = glob.glob(f) - if globbed: - if [ f ] != globbed: - files += globbed - continue - files.append(f) - - symlink_paths = [] - for ind, f in enumerate(files): - # Handle directory symlinks. Truncate path to the lowest level symlink - parent = '' - for dirname in f.split('/')[:-1]: - parent = os.path.join(parent, dirname) - if dirname == '.': - continue - if cpath.islink(parent): - bb.warn("FILES contains file '%s' which resides under a " - "directory symlink. Please fix the recipe and use the " - "real path for the file." % f[1:]) - symlink_paths.append(f) - files[ind] = parent - f = parent - break - - if not cpath.islink(f): - if cpath.isdir(f): - newfiles = [ os.path.join(f,x) for x in os.listdir(f) ] - if newfiles: - files += newfiles - - return files, symlink_paths - -# Called in package_.bbclass to get the correct list of configuration files -def get_conffiles(pkg, d): - pkgdest = d.getVar('PKGDEST') - root = os.path.join(pkgdest, pkg) - cwd = os.getcwd() - os.chdir(root) - - conffiles = d.getVar('CONFFILES:%s' % pkg); - if conffiles == None: - conffiles = d.getVar('CONFFILES') - if conffiles == None: - conffiles = "" - conffiles = conffiles.split() - conf_orig_list = files_from_filevars(conffiles)[0] - - # Remove links and directories from conf_orig_list to get conf_list which only contains normal files - conf_list = [] - for f in conf_orig_list: - if os.path.isdir(f): - continue - if os.path.islink(f): - continue - if not os.path.exists(f): - continue - conf_list.append(f) - - # Remove the leading './' - for i in range(0, len(conf_list)): - conf_list[i] = conf_list[i][1:] - - os.chdir(cwd) - return conf_list - -def checkbuildpath(file, d): - tmpdir = d.getVar('TMPDIR') - with open(file) as f: - file_content = f.read() - if tmpdir in file_content: - return True - - return False - -def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output): - debugfiles = {} - - for line in dwarfsrcfiles_output.splitlines(): - if line.startswith("\t"): - debugfiles[os.path.normpath(line.split()[0])] = "" - - return debugfiles.keys() - -def source_info(file, d, fatal=True): - import subprocess - - cmd = ["dwarfsrcfiles", file] - try: - output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT) - retval = 0 - except subprocess.CalledProcessError as exc: - output = exc.output - retval = exc.returncode - - # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure - if retval != 0 and retval != 255: - msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "") - if fatal: - bb.fatal(msg) - bb.note(msg) - - debugsources = parse_debugsources_from_dwarfsrcfiles_output(output) - - return list(debugsources) - -def splitdebuginfo(file, dvar, dv, d): - # Function to split a single file into two components, one is the stripped - # target system binary, the other contains any debugging information. The - # two files are linked to reference each other. - # - # return a mapping of files:debugsources - - import stat - import subprocess - - src = file[len(dvar):] - dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"] - debugfile = dvar + dest - sources = [] - - if file.endswith(".ko") and file.find("/lib/modules/") != -1: - if oe.package.is_kernel_module_signed(file): - bb.debug(1, "Skip strip on signed module %s" % file) - return (file, sources) - - # Split the file... - bb.utils.mkdirhier(os.path.dirname(debugfile)) - #bb.note("Split %s -> %s" % (file, debugfile)) - # Only store off the hard link reference if we successfully split! - - dvar = d.getVar('PKGD') - objcopy = d.getVar("OBJCOPY") - - newmode = None - if not os.access(file, os.W_OK) or os.access(file, os.R_OK): - origmode = os.stat(file)[stat.ST_MODE] - newmode = origmode | stat.S_IWRITE | stat.S_IREAD - os.chmod(file, newmode) - - # We need to extract the debug src information here... - if dv["srcdir"]: - sources = source_info(file, d) - - bb.utils.mkdirhier(os.path.dirname(debugfile)) - - subprocess.check_output([objcopy, '--only-keep-debug', file, debugfile], stderr=subprocess.STDOUT) - - # Set the debuglink to have the view of the file path on the target - subprocess.check_output([objcopy, '--add-gnu-debuglink', debugfile, file], stderr=subprocess.STDOUT) - - if newmode: - os.chmod(file, origmode) - - return (file, sources) - -def splitstaticdebuginfo(file, dvar, dv, d): - # Unlike the function above, there is no way to split a static library - # two components. So to get similar results we will copy the unmodified - # static library (containing the debug symbols) into a new directory. - # We will then strip (preserving symbols) the static library in the - # typical location. - # - # return a mapping of files:debugsources - - import stat - - src = file[len(dvar):] - dest = dv["staticlibdir"] + os.path.dirname(src) + dv["staticdir"] + "/" + os.path.basename(src) + dv["staticappend"] - debugfile = dvar + dest - sources = [] - - # Copy the file... - bb.utils.mkdirhier(os.path.dirname(debugfile)) - #bb.note("Copy %s -> %s" % (file, debugfile)) - - dvar = d.getVar('PKGD') - - newmode = None - if not os.access(file, os.W_OK) or os.access(file, os.R_OK): - origmode = os.stat(file)[stat.ST_MODE] - newmode = origmode | stat.S_IWRITE | stat.S_IREAD - os.chmod(file, newmode) - - # We need to extract the debug src information here... - if dv["srcdir"]: - sources = source_info(file, d) - - bb.utils.mkdirhier(os.path.dirname(debugfile)) - - # Copy the unmodified item to the debug directory - shutil.copy2(file, debugfile) - - if newmode: - os.chmod(file, origmode) - - return (file, sources) - -def inject_minidebuginfo(file, dvar, dv, d): - # Extract just the symbols from debuginfo into minidebuginfo, - # compress it with xz and inject it back into the binary in a .gnu_debugdata section. - # https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html - - import subprocess - - readelf = d.getVar('READELF') - nm = d.getVar('NM') - objcopy = d.getVar('OBJCOPY') - - minidebuginfodir = d.expand('${WORKDIR}/minidebuginfo') - - src = file[len(dvar):] - dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"] - debugfile = dvar + dest - minidebugfile = minidebuginfodir + src + '.minidebug' - bb.utils.mkdirhier(os.path.dirname(minidebugfile)) - - # If we didn't produce debuginfo for any reason, we can't produce minidebuginfo either - # so skip it. - if not os.path.exists(debugfile): - bb.debug(1, 'ELF file {} has no debuginfo, skipping minidebuginfo injection'.format(file)) - return - - # minidebuginfo does not make sense to apply to ELF objects other than - # executables and shared libraries, skip applying the minidebuginfo - # generation for objects like kernel modules. - for line in subprocess.check_output([readelf, '-h', debugfile], universal_newlines=True).splitlines(): - if not line.strip().startswith("Type:"): - continue - elftype = line.split(":")[1].strip() - if not any(elftype.startswith(i) for i in ["EXEC", "DYN"]): - bb.debug(1, 'ELF file {} is not executable/shared, skipping minidebuginfo injection'.format(file)) - return - break - - # Find non-allocated PROGBITS, NOTE, and NOBITS sections in the debuginfo. - # We will exclude all of these from minidebuginfo to save space. - remove_section_names = [] - for line in subprocess.check_output([readelf, '-W', '-S', debugfile], universal_newlines=True).splitlines(): - # strip the leading " [ 1]" section index to allow splitting on space - if ']' not in line: - continue - fields = line[line.index(']') + 1:].split() - if len(fields) < 7: - continue - name = fields[0] - type = fields[1] - flags = fields[6] - # .debug_ sections will be removed by objcopy -S so no need to explicitly remove them - if name.startswith('.debug_'): - continue - if 'A' not in flags and type in ['PROGBITS', 'NOTE', 'NOBITS']: - remove_section_names.append(name) - - # List dynamic symbols in the binary. We can exclude these from minidebuginfo - # because they are always present in the binary. - dynsyms = set() - for line in subprocess.check_output([nm, '-D', file, '--format=posix', '--defined-only'], universal_newlines=True).splitlines(): - dynsyms.add(line.split()[0]) - - # Find all function symbols from debuginfo which aren't in the dynamic symbols table. - # These are the ones we want to keep in minidebuginfo. - keep_symbols_file = minidebugfile + '.symlist' - found_any_symbols = False - with open(keep_symbols_file, 'w') as f: - for line in subprocess.check_output([nm, debugfile, '--format=sysv', '--defined-only'], universal_newlines=True).splitlines(): - fields = line.split('|') - if len(fields) < 7: - continue - name = fields[0].strip() - type = fields[3].strip() - if type == 'FUNC' and name not in dynsyms: - f.write('{}\n'.format(name)) - found_any_symbols = True - - if not found_any_symbols: - bb.debug(1, 'ELF file {} contains no symbols, skipping minidebuginfo injection'.format(file)) - return - - bb.utils.remove(minidebugfile) - bb.utils.remove(minidebugfile + '.xz') - - subprocess.check_call([objcopy, '-S'] + - ['--remove-section={}'.format(s) for s in remove_section_names] + - ['--keep-symbols={}'.format(keep_symbols_file), debugfile, minidebugfile]) - - subprocess.check_call(['xz', '--keep', minidebugfile]) - - subprocess.check_call([objcopy, '--add-section', '.gnu_debugdata={}.xz'.format(minidebugfile), file]) - -def copydebugsources(debugsrcdir, sources, d): - # The debug src information written out to sourcefile is further processed - # and copied to the destination here. - - import stat - import subprocess - - if debugsrcdir and sources: - sourcefile = d.expand("${WORKDIR}/debugsources.list") - bb.utils.remove(sourcefile) - - # filenames are null-separated - this is an artefact of the previous use - # of rpm's debugedit, which was writing them out that way, and the code elsewhere - # is still assuming that. - debuglistoutput = '\0'.join(sources) + '\0' - with open(sourcefile, 'a') as sf: - sf.write(debuglistoutput) - - dvar = d.getVar('PKGD') - strip = d.getVar("STRIP") - objcopy = d.getVar("OBJCOPY") - workdir = d.getVar("WORKDIR") - sdir = d.getVar("S") - cflags = d.expand("${CFLAGS}") - - prefixmap = {} - for flag in cflags.split(): - if not flag.startswith("-fdebug-prefix-map"): - continue - if "recipe-sysroot" in flag: - continue - flag = flag.split("=") - prefixmap[flag[1]] = flag[2] - - nosuchdir = [] - basepath = dvar - for p in debugsrcdir.split("/"): - basepath = basepath + "/" + p - if not cpath.exists(basepath): - nosuchdir.append(basepath) - bb.utils.mkdirhier(basepath) - cpath.updatecache(basepath) - - for pmap in prefixmap: - # Ignore files from the recipe sysroots (target and native) - cmd = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((|)$|/.*recipe-sysroot.*/)' | " % sourcefile - # We need to ignore files that are not actually ours - # we do this by only paying attention to items from this package - cmd += "fgrep -zw '%s' | " % prefixmap[pmap] - # Remove prefix in the source paths - cmd += "sed 's#%s/##g' | " % (prefixmap[pmap]) - cmd += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)" % (pmap, dvar, prefixmap[pmap]) - - try: - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - # Can "fail" if internal headers/transient sources are attempted - pass - # cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced. - # Work around this by manually finding and copying any symbolic links that made it through. - cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s')" % \ - (dvar, prefixmap[pmap], dvar, prefixmap[pmap], pmap, dvar, prefixmap[pmap]) - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) - - # debugsources.list may be polluted from the host if we used externalsrc, - # cpio uses copy-pass and may have just created a directory structure - # matching the one from the host, if thats the case move those files to - # debugsrcdir to avoid host contamination. - # Empty dir structure will be deleted in the next step. - - # Same check as above for externalsrc - if workdir not in sdir: - if os.path.exists(dvar + debugsrcdir + sdir): - cmd = "mv %s%s%s/* %s%s" % (dvar, debugsrcdir, sdir, dvar,debugsrcdir) - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) - - # The copy by cpio may have resulted in some empty directories! Remove these - cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir) - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) - - # Also remove debugsrcdir if its empty - for p in nosuchdir[::-1]: - if os.path.exists(p) and not os.listdir(p): - os.rmdir(p) - -# -# Package data handling routines -# - -def get_package_mapping (pkg, basepkg, d, depversions=None): - import oe.packagedata - - data = oe.packagedata.read_subpkgdata(pkg, d) - key = "PKG:%s" % pkg - - if key in data: - if bb.data.inherits_class('allarch', d) and bb.data.inherits_class('packagegroup', d) and pkg != data[key]: - bb.error("An allarch packagegroup shouldn't depend on packages which are dynamically renamed (%s to %s)" % (pkg, data[key])) - # Have to avoid undoing the write_extra_pkgs(global_variants...) - if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \ - and data[key] == basepkg: - return pkg - if depversions == []: - # Avoid returning a mapping if the renamed package rprovides its original name - rprovkey = "RPROVIDES:%s" % pkg - if rprovkey in data: - if pkg in bb.utils.explode_dep_versions2(data[rprovkey]): - bb.note("%s rprovides %s, not replacing the latter" % (data[key], pkg)) - return pkg - # Do map to rewritten package name - return data[key] - - return pkg - -def get_package_additional_metadata (pkg_type, d): - base_key = "PACKAGE_ADD_METADATA" - for key in ("%s_%s" % (base_key, pkg_type.upper()), base_key): - if d.getVar(key, False) is None: - continue - d.setVarFlag(key, "type", "list") - if d.getVarFlag(key, "separator") is None: - d.setVarFlag(key, "separator", "\\n") - metadata_fields = [field.strip() for field in oe.data.typed_value(key, d)] - return "\n".join(metadata_fields).strip() - -def runtime_mapping_rename (varname, pkg, d): - #bb.note("%s before: %s" % (varname, d.getVar(varname))) - - new_depends = {} - deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "") - for depend, depversions in deps.items(): - new_depend = get_package_mapping(depend, pkg, d, depversions) - if depend != new_depend: - bb.note("package name mapping done: %s -> %s" % (depend, new_depend)) - new_depends[new_depend] = deps[depend] - - d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False)) - - #bb.note("%s after: %s" % (varname, d.getVar(varname))) - -# -# Used by do_packagedata (and possibly other routines post do_package) -# PRSERV_ACTIVE = "${@bool(d.getVar("PRSERV_HOST"))}" PRSERV_ACTIVE[vardepvalue] = "${PRSERV_ACTIVE}" @@ -787,58 +330,7 @@ python package_convert_pr_autoinc() { LOCALEBASEPN ??= "${PN}" python package_do_split_locales() { - if (d.getVar('PACKAGE_NO_LOCALE') == '1'): - bb.debug(1, "package requested not splitting locales") - return - - packages = (d.getVar('PACKAGES') or "").split() - - datadir = d.getVar('datadir') - if not datadir: - bb.note("datadir not defined") - return - - dvar = d.getVar('PKGD') - pn = d.getVar('LOCALEBASEPN') - - if pn + '-locale' in packages: - packages.remove(pn + '-locale') - - localedir = os.path.join(dvar + datadir, 'locale') - - if not cpath.isdir(localedir): - bb.debug(1, "No locale files in this package") - return - - locales = os.listdir(localedir) - - summary = d.getVar('SUMMARY') or pn - description = d.getVar('DESCRIPTION') or "" - locale_section = d.getVar('LOCALE_SECTION') - mlprefix = d.getVar('MLPREFIX') or "" - for l in sorted(locales): - ln = legitimize_package_name(l) - pkg = pn + '-locale-' + ln - packages.append(pkg) - d.setVar('FILES:' + pkg, os.path.join(datadir, 'locale', l)) - d.setVar('RRECOMMENDS:' + pkg, '%svirtual-locale-%s' % (mlprefix, ln)) - d.setVar('RPROVIDES:' + pkg, '%s-locale %s%s-translation' % (pn, mlprefix, ln)) - d.setVar('SUMMARY:' + pkg, '%s - %s translations' % (summary, l)) - d.setVar('DESCRIPTION:' + pkg, '%s This package contains language translation files for the %s locale.' % (description, l)) - if locale_section: - d.setVar('SECTION:' + pkg, locale_section) - - d.setVar('PACKAGES', ' '.join(packages)) - - # Disabled by RP 18/06/07 - # Wildcards aren't supported in debian - # They break with ipkg since glibc-locale* will mean that - # glibc-localedata-translit* won't install as a dependency - # for some other package which breaks meta-toolchain - # Probably breaks since virtual-locale- isn't provided anywhere - #rdep = (d.getVar('RDEPENDS:%s' % pn) or "").split() - #rdep.append('%s-locale*' % pn) - #d.setVar('RDEPENDS:%s' % pn, ' '.join(rdep)) + oe.package.split_locales(d) } python perform_packagecopy () { @@ -861,728 +353,15 @@ python perform_packagecopy () { perform_packagecopy[cleandirs] = "${PKGD}" perform_packagecopy[dirs] = "${PKGD}" -# We generate a master list of directories to process, we start by -# seeding this list with reasonable defaults, then load from -# the fs-perms.txt files -python fixup_perms () { - import pwd, grp - - # init using a string with the same format as a line as documented in - # the fs-perms.txt file - # - # link - # - # __str__ can be used to print out an entry in the input format - # - # if fs_perms_entry.path is None: - # an error occurred - # if fs_perms_entry.link, you can retrieve: - # fs_perms_entry.path = path - # fs_perms_entry.link = target of link - # if not fs_perms_entry.link, you can retrieve: - # fs_perms_entry.path = path - # fs_perms_entry.mode = expected dir mode or None - # fs_perms_entry.uid = expected uid or -1 - # fs_perms_entry.gid = expected gid or -1 - # fs_perms_entry.walk = 'true' or something else - # fs_perms_entry.fmode = expected file mode or None - # fs_perms_entry.fuid = expected file uid or -1 - # fs_perms_entry_fgid = expected file gid or -1 - class fs_perms_entry(): - def __init__(self, line): - lsplit = line.split() - if len(lsplit) == 3 and lsplit[1].lower() == "link": - self._setlink(lsplit[0], lsplit[2]) - elif len(lsplit) == 8: - self._setdir(lsplit[0], lsplit[1], lsplit[2], lsplit[3], lsplit[4], lsplit[5], lsplit[6], lsplit[7]) - else: - msg = "Fixup Perms: invalid config line %s" % line - oe.qa.handle_error("perm-config", msg, d) - self.path = None - self.link = None - - def _setdir(self, path, mode, uid, gid, walk, fmode, fuid, fgid): - self.path = os.path.normpath(path) - self.link = None - self.mode = self._procmode(mode) - self.uid = self._procuid(uid) - self.gid = self._procgid(gid) - self.walk = walk.lower() - self.fmode = self._procmode(fmode) - self.fuid = self._procuid(fuid) - self.fgid = self._procgid(fgid) - - def _setlink(self, path, link): - self.path = os.path.normpath(path) - self.link = link - - def _procmode(self, mode): - if not mode or (mode and mode == "-"): - return None - else: - return int(mode,8) - - # Note uid/gid -1 has special significance in os.lchown - def _procuid(self, uid): - if uid is None or uid == "-": - return -1 - elif uid.isdigit(): - return int(uid) - else: - return pwd.getpwnam(uid).pw_uid - - def _procgid(self, gid): - if gid is None or gid == "-": - return -1 - elif gid.isdigit(): - return int(gid) - else: - return grp.getgrnam(gid).gr_gid - - # Use for debugging the entries - def __str__(self): - if self.link: - return "%s link %s" % (self.path, self.link) - else: - mode = "-" - if self.mode: - mode = "0%o" % self.mode - fmode = "-" - if self.fmode: - fmode = "0%o" % self.fmode - uid = self._mapugid(self.uid) - gid = self._mapugid(self.gid) - fuid = self._mapugid(self.fuid) - fgid = self._mapugid(self.fgid) - return "%s %s %s %s %s %s %s %s" % (self.path, mode, uid, gid, self.walk, fmode, fuid, fgid) - - def _mapugid(self, id): - if id is None or id == -1: - return "-" - else: - return "%d" % id - - # Fix the permission, owner and group of path - def fix_perms(path, mode, uid, gid, dir): - if mode and not os.path.islink(path): - #bb.note("Fixup Perms: chmod 0%o %s" % (mode, dir)) - os.chmod(path, mode) - # -1 is a special value that means don't change the uid/gid - # if they are BOTH -1, don't bother to lchown - if not (uid == -1 and gid == -1): - #bb.note("Fixup Perms: lchown %d:%d %s" % (uid, gid, dir)) - os.lchown(path, uid, gid) - - # Return a list of configuration files based on either the default - # files/fs-perms.txt or the contents of FILESYSTEM_PERMS_TABLES - # paths are resolved via BBPATH - def get_fs_perms_list(d): - str = "" - bbpath = d.getVar('BBPATH') - fs_perms_tables = d.getVar('FILESYSTEM_PERMS_TABLES') or "" - for conf_file in fs_perms_tables.split(): - confpath = bb.utils.which(bbpath, conf_file) - if confpath: - str += " %s" % bb.utils.which(bbpath, conf_file) - else: - bb.warn("cannot find %s specified in FILESYSTEM_PERMS_TABLES" % conf_file) - return str - - - - dvar = d.getVar('PKGD') - - fs_perms_table = {} - fs_link_table = {} - - # By default all of the standard directories specified in - # bitbake.conf will get 0755 root:root. - target_path_vars = [ 'base_prefix', - 'prefix', - 'exec_prefix', - 'base_bindir', - 'base_sbindir', - 'base_libdir', - 'datadir', - 'sysconfdir', - 'servicedir', - 'sharedstatedir', - 'localstatedir', - 'infodir', - 'mandir', - 'docdir', - 'bindir', - 'sbindir', - 'libexecdir', - 'libdir', - 'includedir', - 'oldincludedir' ] - - for path in target_path_vars: - dir = d.getVar(path) or "" - if dir == "": - continue - fs_perms_table[dir] = fs_perms_entry(d.expand("%s 0755 root root false - - -" % (dir))) - - # Now we actually load from the configuration files - for conf in get_fs_perms_list(d).split(): - if not os.path.exists(conf): - continue - with open(conf) as f: - for line in f: - if line.startswith('#'): - continue - lsplit = line.split() - if len(lsplit) == 0: - continue - if len(lsplit) != 8 and not (len(lsplit) == 3 and lsplit[1].lower() == "link"): - msg = "Fixup perms: %s invalid line: %s" % (conf, line) - oe.qa.handle_error("perm-line", msg, d) - continue - entry = fs_perms_entry(d.expand(line)) - if entry and entry.path: - if entry.link: - fs_link_table[entry.path] = entry - if entry.path in fs_perms_table: - fs_perms_table.pop(entry.path) - else: - fs_perms_table[entry.path] = entry - if entry.path in fs_link_table: - fs_link_table.pop(entry.path) - - # Debug -- list out in-memory table - #for dir in fs_perms_table: - # bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir]))) - #for link in fs_link_table: - # bb.note("Fixup Perms: %s: %s" % (link, str(fs_link_table[link]))) - - # We process links first, so we can go back and fixup directory ownership - # for any newly created directories - # Process in sorted order so /run gets created before /run/lock, etc. - for entry in sorted(fs_link_table.values(), key=lambda x: x.link): - link = entry.link - dir = entry.path - origin = dvar + dir - if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)): - continue - - if link[0] == "/": - target = dvar + link - ptarget = link - else: - target = os.path.join(os.path.dirname(origin), link) - ptarget = os.path.join(os.path.dirname(dir), link) - if os.path.exists(target): - msg = "Fixup Perms: Unable to correct directory link, target already exists: %s -> %s" % (dir, ptarget) - oe.qa.handle_error("perm-link", msg, d) - continue - - # Create path to move directory to, move it, and then setup the symlink - bb.utils.mkdirhier(os.path.dirname(target)) - #bb.note("Fixup Perms: Rename %s -> %s" % (dir, ptarget)) - bb.utils.rename(origin, target) - #bb.note("Fixup Perms: Link %s -> %s" % (dir, link)) - os.symlink(link, origin) - - for dir in fs_perms_table: - origin = dvar + dir - if not (cpath.exists(origin) and cpath.isdir(origin)): - continue - - fix_perms(origin, fs_perms_table[dir].mode, fs_perms_table[dir].uid, fs_perms_table[dir].gid, dir) - - if fs_perms_table[dir].walk == 'true': - for root, dirs, files in os.walk(origin): - for dr in dirs: - each_dir = os.path.join(root, dr) - fix_perms(each_dir, fs_perms_table[dir].mode, fs_perms_table[dir].uid, fs_perms_table[dir].gid, dir) - for f in files: - each_file = os.path.join(root, f) - fix_perms(each_file, fs_perms_table[dir].fmode, fs_perms_table[dir].fuid, fs_perms_table[dir].fgid, dir) -} - -def package_debug_vars(d): - # We default to '.debug' style - if d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-file-directory': - # Single debug-file-directory style debug info - debug_vars = { - "append": ".debug", - "staticappend": "", - "dir": "", - "staticdir": "", - "libdir": "/usr/lib/debug", - "staticlibdir": "/usr/lib/debug-static", - "srcdir": "/usr/src/debug", - } - elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-without-src': - # Original OE-core, a.k.a. ".debug", style debug info, but without sources in /usr/src/debug - debug_vars = { - "append": "", - "staticappend": "", - "dir": "/.debug", - "staticdir": "/.debug-static", - "libdir": "", - "staticlibdir": "", - "srcdir": "", - } - elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg': - debug_vars = { - "append": "", - "staticappend": "", - "dir": "/.debug", - "staticdir": "/.debug-static", - "libdir": "", - "staticlibdir": "", - "srcdir": "/usr/src/debug", - } - else: - # Original OE-core, a.k.a. ".debug", style debug info - debug_vars = { - "append": "", - "staticappend": "", - "dir": "/.debug", - "staticdir": "/.debug-static", - "libdir": "", - "staticlibdir": "", - "srcdir": "/usr/src/debug", - } - - return debug_vars - -python split_and_strip_files () { - import stat, errno - import subprocess - - dvar = d.getVar('PKGD') - pn = d.getVar('PN') - hostos = d.getVar('HOST_OS') - - oldcwd = os.getcwd() - os.chdir(dvar) - - dv = package_debug_vars(d) - - # - # First lets figure out all of the files we may have to process ... do this only once! - # - elffiles = {} - symlinks = {} - staticlibs = [] - inodes = {} - libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir")) - baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir")) - skipfiles = (d.getVar("INHIBIT_PACKAGE_STRIP_FILES") or "").split() - if (d.getVar('INHIBIT_PACKAGE_STRIP') != '1' or \ - d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'): - checkelf = {} - checkelflinks = {} - for root, dirs, files in cpath.walk(dvar): - for f in files: - file = os.path.join(root, f) - - # Skip debug files - if dv["append"] and file.endswith(dv["append"]): - continue - if dv["dir"] and dv["dir"] in os.path.dirname(file[len(dvar):]): - continue - - if file in skipfiles: - continue - - if oe.package.is_static_lib(file): - staticlibs.append(file) - continue - - try: - ltarget = cpath.realpath(file, dvar, False) - s = cpath.lstat(ltarget) - except OSError as e: - (err, strerror) = e.args - if err != errno.ENOENT: - raise - # Skip broken symlinks - continue - if not s: - continue - # Check its an executable - if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) \ - or (s[stat.ST_MODE] & stat.S_IXOTH) \ - or ((file.startswith(libdir) or file.startswith(baselibdir)) \ - and (".so" in f or ".node" in f)) \ - or (f.startswith('vmlinux') or ".ko" in f): - - if cpath.islink(file): - checkelflinks[file] = ltarget - continue - # Use a reference of device ID and inode number to identify files - file_reference = "%d_%d" % (s.st_dev, s.st_ino) - checkelf[file] = (file, file_reference) - - results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelflinks.values(), d) - results_map = {} - for (ltarget, elf_file) in results: - results_map[ltarget] = elf_file - for file in checkelflinks: - ltarget = checkelflinks[file] - # If it's a symlink, and points to an ELF file, we capture the readlink target - if results_map[ltarget]: - target = os.readlink(file) - #bb.note("Sym: %s (%d)" % (ltarget, results_map[ltarget])) - symlinks[file] = target - - results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelf.keys(), d) - - # Sort results by file path. This ensures that the files are always - # processed in the same order, which is important to make sure builds - # are reproducible when dealing with hardlinks - results.sort(key=lambda x: x[0]) - - for (file, elf_file) in results: - # It's a file (or hardlink), not a link - # ...but is it ELF, and is it already stripped? - if elf_file & 1: - if elf_file & 2: - if 'already-stripped' in (d.getVar('INSANE_SKIP:' + pn) or "").split(): - bb.note("Skipping file %s from %s for already-stripped QA test" % (file[len(dvar):], pn)) - else: - msg = "File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dvar):], pn) - oe.qa.handle_error("already-stripped", msg, d) - continue - - # At this point we have an unstripped elf file. We need to: - # a) Make sure any file we strip is not hardlinked to anything else outside this tree - # b) Only strip any hardlinked file once (no races) - # c) Track any hardlinks between files so that we can reconstruct matching debug file hardlinks - - # Use a reference of device ID and inode number to identify files - file_reference = checkelf[file][1] - if file_reference in inodes: - os.unlink(file) - os.link(inodes[file_reference][0], file) - inodes[file_reference].append(file) - else: - inodes[file_reference] = [file] - # break hardlink - bb.utils.break_hardlinks(file) - elffiles[file] = elf_file - # Modified the file so clear the cache - cpath.updatecache(file) - - def strip_pkgd_prefix(f): - nonlocal dvar - - if f.startswith(dvar): - return f[len(dvar):] - - return f - - # - # First lets process debug splitting - # - if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'): - results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, dv, d)) - - if dv["srcdir"] and not hostos.startswith("mingw"): - if (d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'): - results = oe.utils.multiprocess_launch(splitstaticdebuginfo, staticlibs, d, extraargs=(dvar, dv, d)) - else: - for file in staticlibs: - results.append( (file,source_info(file, d)) ) - - d.setVar("PKGDEBUGSOURCES", {strip_pkgd_prefix(f): sorted(s) for f, s in results}) - - sources = set() - for r in results: - sources.update(r[1]) - - # Hardlink our debug symbols to the other hardlink copies - for ref in inodes: - if len(inodes[ref]) == 1: - continue - - target = inodes[ref][0][len(dvar):] - for file in inodes[ref][1:]: - src = file[len(dvar):] - dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(target) + dv["append"] - fpath = dvar + dest - ftarget = dvar + dv["libdir"] + os.path.dirname(target) + dv["dir"] + "/" + os.path.basename(target) + dv["append"] - bb.utils.mkdirhier(os.path.dirname(fpath)) - # Only one hardlink of separated debug info file in each directory - if not os.access(fpath, os.R_OK): - #bb.note("Link %s -> %s" % (fpath, ftarget)) - os.link(ftarget, fpath) - - # Create symlinks for all cases we were able to split symbols - for file in symlinks: - src = file[len(dvar):] - dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"] - fpath = dvar + dest - # Skip it if the target doesn't exist - try: - s = os.stat(fpath) - except OSError as e: - (err, strerror) = e.args - if err != errno.ENOENT: - raise - continue - - ltarget = symlinks[file] - lpath = os.path.dirname(ltarget) - lbase = os.path.basename(ltarget) - ftarget = "" - if lpath and lpath != ".": - ftarget += lpath + dv["dir"] + "/" - ftarget += lbase + dv["append"] - if lpath.startswith(".."): - ftarget = os.path.join("..", ftarget) - bb.utils.mkdirhier(os.path.dirname(fpath)) - #bb.note("Symlink %s -> %s" % (fpath, ftarget)) - os.symlink(ftarget, fpath) - - # Process the dv["srcdir"] if requested... - # This copies and places the referenced sources for later debugging... - copydebugsources(dv["srcdir"], sources, d) - # - # End of debug splitting - # - - # - # Now lets go back over things and strip them - # - if (d.getVar('INHIBIT_PACKAGE_STRIP') != '1'): - strip = d.getVar("STRIP") - sfiles = [] - for file in elffiles: - elf_file = int(elffiles[file]) - #bb.note("Strip %s" % file) - sfiles.append((file, elf_file, strip)) - if (d.getVar('PACKAGE_STRIP_STATIC') == '1' or d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'): - for f in staticlibs: - sfiles.append((f, 16, strip)) - - oe.utils.multiprocess_launch(oe.package.runstrip, sfiles, d) - - # Build "minidebuginfo" and reinject it back into the stripped binaries - if d.getVar('PACKAGE_MINIDEBUGINFO') == '1': - oe.utils.multiprocess_launch(inject_minidebuginfo, list(elffiles), d, - extraargs=(dvar, dv, d)) - - # - # End of strip - # - os.chdir(oldcwd) -} - python populate_packages () { - import glob, re - - workdir = d.getVar('WORKDIR') - outdir = d.getVar('DEPLOY_DIR') - dvar = d.getVar('PKGD') - packages = d.getVar('PACKAGES').split() - pn = d.getVar('PN') - - bb.utils.mkdirhier(outdir) - os.chdir(dvar) - - autodebug = not (d.getVar("NOAUTOPACKAGEDEBUG") or False) - - split_source_package = (d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg') - - # If debug-with-srcpkg mode is enabled then add the source package if it - # doesn't exist and add the source file contents to the source package. - if split_source_package: - src_package_name = ('%s-src' % d.getVar('PN')) - if not src_package_name in packages: - packages.append(src_package_name) - d.setVar('FILES:%s' % src_package_name, '/usr/src/debug') - - # Sanity check PACKAGES for duplicates - # Sanity should be moved to sanity.bbclass once we have the infrastructure - package_dict = {} - - for i, pkg in enumerate(packages): - if pkg in package_dict: - msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg - oe.qa.handle_error("packages-list", msg, d) - # Ensure the source package gets the chance to pick up the source files - # before the debug package by ordering it first in PACKAGES. Whether it - # actually picks up any source files is controlled by - # PACKAGE_DEBUG_SPLIT_STYLE. - elif pkg.endswith("-src"): - package_dict[pkg] = (10, i) - elif autodebug and pkg.endswith("-dbg"): - package_dict[pkg] = (30, i) - else: - package_dict[pkg] = (50, i) - packages = sorted(package_dict.keys(), key=package_dict.get) - d.setVar('PACKAGES', ' '.join(packages)) - pkgdest = d.getVar('PKGDEST') - - seen = [] - - # os.mkdir masks the permissions with umask so we have to unset it first - oldumask = os.umask(0) - - debug = [] - for root, dirs, files in cpath.walk(dvar): - dir = root[len(dvar):] - if not dir: - dir = os.sep - for f in (files + dirs): - path = "." + os.path.join(dir, f) - if "/.debug/" in path or "/.debug-static/" in path or path.endswith("/.debug"): - debug.append(path) - - for pkg in packages: - root = os.path.join(pkgdest, pkg) - bb.utils.mkdirhier(root) - - filesvar = d.getVar('FILES:%s' % pkg) or "" - if "//" in filesvar: - msg = "FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg - oe.qa.handle_error("files-invalid", msg, d) - filesvar.replace("//", "/") - - origfiles = filesvar.split() - files, symlink_paths = files_from_filevars(origfiles) - - if autodebug and pkg.endswith("-dbg"): - files.extend(debug) - - for file in files: - if (not cpath.islink(file)) and (not cpath.exists(file)): - continue - if file in seen: - continue - seen.append(file) - - def mkdir(src, dest, p): - src = os.path.join(src, p) - dest = os.path.join(dest, p) - fstat = cpath.stat(src) - os.mkdir(dest) - os.chmod(dest, fstat.st_mode) - os.chown(dest, fstat.st_uid, fstat.st_gid) - if p not in seen: - seen.append(p) - cpath.updatecache(dest) - - def mkdir_recurse(src, dest, paths): - if cpath.exists(dest + '/' + paths): - return - while paths.startswith("./"): - paths = paths[2:] - p = "." - for c in paths.split("/"): - p = os.path.join(p, c) - if not cpath.exists(os.path.join(dest, p)): - mkdir(src, dest, p) - - if cpath.isdir(file) and not cpath.islink(file): - mkdir_recurse(dvar, root, file) - continue - - mkdir_recurse(dvar, root, os.path.dirname(file)) - fpath = os.path.join(root,file) - if not cpath.islink(file): - os.link(file, fpath) - continue - ret = bb.utils.copyfile(file, fpath) - if ret is False or ret == 0: - bb.fatal("File population failed") - - # Check if symlink paths exist - for file in symlink_paths: - if not os.path.exists(os.path.join(root,file)): - bb.fatal("File '%s' cannot be packaged into '%s' because its " - "parent directory structure does not exist. One of " - "its parent directories is a symlink whose target " - "directory is not included in the package." % - (file, pkg)) - - os.umask(oldumask) - os.chdir(workdir) - - # Handle excluding packages with incompatible licenses - package_list = [] - for pkg in packages: - licenses = d.getVar('_exclude_incompatible-' + pkg) - if licenses: - msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, licenses) - oe.qa.handle_error("incompatible-license", msg, d) - else: - package_list.append(pkg) - d.setVar('PACKAGES', ' '.join(package_list)) - - unshipped = [] - for root, dirs, files in cpath.walk(dvar): - dir = root[len(dvar):] - if not dir: - dir = os.sep - for f in (files + dirs): - path = os.path.join(dir, f) - if ('.' + path) not in seen: - unshipped.append(path) - - if unshipped != []: - msg = pn + ": Files/directories were installed but not shipped in any package:" - if "installed-vs-shipped" in (d.getVar('INSANE_SKIP:' + pn) or "").split(): - bb.note("Package %s skipping QA tests: installed-vs-shipped" % pn) - else: - for f in unshipped: - msg = msg + "\n " + f - msg = msg + "\nPlease set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.\n" - msg = msg + "%s: %d installed and not shipped files." % (pn, len(unshipped)) - oe.qa.handle_error("installed-vs-shipped", msg, d) + oe.package.populate_packages(d) } populate_packages[dirs] = "${D}" python package_fixsymlinks () { - import errno - pkgdest = d.getVar('PKGDEST') - packages = d.getVar("PACKAGES", False).split() - - dangling_links = {} - pkg_files = {} - for pkg in packages: - dangling_links[pkg] = [] - pkg_files[pkg] = [] - inst_root = os.path.join(pkgdest, pkg) - for path in pkgfiles[pkg]: - rpath = path[len(inst_root):] - pkg_files[pkg].append(rpath) - rtarget = cpath.realpath(path, inst_root, True, assume_dir = True) - if not cpath.lexists(rtarget): - dangling_links[pkg].append(os.path.normpath(rtarget[len(inst_root):])) - - newrdepends = {} - for pkg in dangling_links: - for l in dangling_links[pkg]: - found = False - bb.debug(1, "%s contains dangling link %s" % (pkg, l)) - for p in packages: - if l in pkg_files[p]: - found = True - bb.debug(1, "target found in %s" % p) - if p == pkg: - break - if pkg not in newrdepends: - newrdepends[pkg] = [] - newrdepends[pkg].append(p) - break - if found == False: - bb.note("%s contains dangling symlink to %s" % (pkg, l)) - - for pkg in newrdepends: - rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "") - for p in newrdepends[pkg]: - if p not in rdepends: - rdepends[p] = [] - d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False)) + oe.package.process_fixsymlinks(pkgfiles, d) } - python package_package_name_hook() { """ A package_name_hook function can be used to rewrite the package names by @@ -1599,185 +378,10 @@ PKGDESTWORK = "${WORKDIR}/pkgdata" PKGDATA_VARS = "PN PE PV PR PKGE PKGV PKGR LICENSE DESCRIPTION SUMMARY RDEPENDS RPROVIDES RRECOMMENDS RSUGGESTS RREPLACES RCONFLICTS SECTION PKG ALLOW_EMPTY FILES CONFFILES FILES_INFO PACKAGE_ADD_METADATA pkg_postinst pkg_postrm pkg_preinst pkg_prerm" python emit_pkgdata() { - from glob import glob - import json - import bb.compress.zstd - - def process_postinst_on_target(pkg, mlprefix): - pkgval = d.getVar('PKG:%s' % pkg) - if pkgval is None: - pkgval = pkg - - defer_fragment = """ -if [ -n "$D" ]; then - $INTERCEPT_DIR/postinst_intercept delay_to_first_boot %s mlprefix=%s - exit 0 -fi -""" % (pkgval, mlprefix) - - postinst = d.getVar('pkg_postinst:%s' % pkg) - postinst_ontarget = d.getVar('pkg_postinst_ontarget:%s' % pkg) - - if postinst_ontarget: - bb.debug(1, 'adding deferred pkg_postinst_ontarget() to pkg_postinst() for %s' % pkg) - if not postinst: - postinst = '#!/bin/sh\n' - postinst += defer_fragment - postinst += postinst_ontarget - d.setVar('pkg_postinst:%s' % pkg, postinst) - - def add_set_e_to_scriptlets(pkg): - for scriptlet_name in ('pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm'): - scriptlet = d.getVar('%s:%s' % (scriptlet_name, pkg)) - if scriptlet: - scriptlet_split = scriptlet.split('\n') - if scriptlet_split[0].startswith("#!"): - scriptlet = scriptlet_split[0] + "\nset -e\n" + "\n".join(scriptlet_split[1:]) - else: - scriptlet = "set -e\n" + "\n".join(scriptlet_split[0:]) - d.setVar('%s:%s' % (scriptlet_name, pkg), scriptlet) - - def write_if_exists(f, pkg, var): - def encode(str): - import codecs - c = codecs.getencoder("unicode_escape") - return c(str)[0].decode("latin1") - - val = d.getVar('%s:%s' % (var, pkg)) - if val: - f.write('%s:%s: %s\n' % (var, pkg, encode(val))) - return val - val = d.getVar('%s' % (var)) - if val: - f.write('%s: %s\n' % (var, encode(val))) - return val - - def write_extra_pkgs(variants, pn, packages, pkgdatadir): - for variant in variants: - with open("%s/%s-%s" % (pkgdatadir, variant, pn), 'w') as fd: - fd.write("PACKAGES: %s\n" % ' '.join( - map(lambda pkg: '%s-%s' % (variant, pkg), packages.split()))) - - def write_extra_runtime_pkgs(variants, packages, pkgdatadir): - for variant in variants: - for pkg in packages.split(): - ml_pkg = "%s-%s" % (variant, pkg) - subdata_file = "%s/runtime/%s" % (pkgdatadir, ml_pkg) - with open(subdata_file, 'w') as fd: - fd.write("PKG:%s: %s" % (ml_pkg, pkg)) - - packages = d.getVar('PACKAGES') - pkgdest = d.getVar('PKGDEST') - pkgdatadir = d.getVar('PKGDESTWORK') - - data_file = pkgdatadir + d.expand("/${PN}") - with open(data_file, 'w') as fd: - fd.write("PACKAGES: %s\n" % packages) - - pkgdebugsource = d.getVar("PKGDEBUGSOURCES") or [] - - pn = d.getVar('PN') - global_variants = (d.getVar('MULTILIB_GLOBAL_VARIANTS') or "").split() - variants = (d.getVar('MULTILIB_VARIANTS') or "").split() - - if bb.data.inherits_class('kernel', d) or bb.data.inherits_class('module-base', d): - write_extra_pkgs(variants, pn, packages, pkgdatadir) - - if bb.data.inherits_class('allarch', d) and not variants \ - and not bb.data.inherits_class('packagegroup', d): - write_extra_pkgs(global_variants, pn, packages, pkgdatadir) - - workdir = d.getVar('WORKDIR') - - for pkg in packages.split(): - pkgval = d.getVar('PKG:%s' % pkg) - if pkgval is None: - pkgval = pkg - d.setVar('PKG:%s' % pkg, pkg) - - extended_data = { - "files_info": {} - } - - pkgdestpkg = os.path.join(pkgdest, pkg) - files = {} - files_extra = {} - total_size = 0 - seen = set() - for f in pkgfiles[pkg]: - fpath = os.sep + os.path.relpath(f, pkgdestpkg) - - fstat = os.lstat(f) - files[fpath] = fstat.st_size - - extended_data["files_info"].setdefault(fpath, {}) - extended_data["files_info"][fpath]['size'] = fstat.st_size - - if fstat.st_ino not in seen: - seen.add(fstat.st_ino) - total_size += fstat.st_size - - if fpath in pkgdebugsource: - extended_data["files_info"][fpath]['debugsrc'] = pkgdebugsource[fpath] - del pkgdebugsource[fpath] - - d.setVar('FILES_INFO:' + pkg , json.dumps(files, sort_keys=True)) - - process_postinst_on_target(pkg, d.getVar("MLPREFIX")) - add_set_e_to_scriptlets(pkg) - - subdata_file = pkgdatadir + "/runtime/%s" % pkg - with open(subdata_file, 'w') as sf: - for var in (d.getVar('PKGDATA_VARS') or "").split(): - val = write_if_exists(sf, pkg, var) - - write_if_exists(sf, pkg, 'FILERPROVIDESFLIST') - for dfile in sorted((d.getVar('FILERPROVIDESFLIST:' + pkg) or "").split()): - write_if_exists(sf, pkg, 'FILERPROVIDES:' + dfile) - - write_if_exists(sf, pkg, 'FILERDEPENDSFLIST') - for dfile in sorted((d.getVar('FILERDEPENDSFLIST:' + pkg) or "").split()): - write_if_exists(sf, pkg, 'FILERDEPENDS:' + dfile) - - sf.write('%s:%s: %d\n' % ('PKGSIZE', pkg, total_size)) - - subdata_extended_file = pkgdatadir + "/extended/%s.json.zstd" % pkg - num_threads = int(d.getVar("BB_NUMBER_THREADS")) - with bb.compress.zstd.open(subdata_extended_file, "wt", encoding="utf-8", num_threads=num_threads) as f: - json.dump(extended_data, f, sort_keys=True, separators=(",", ":")) - - # Symlinks needed for rprovides lookup - rprov = d.getVar('RPROVIDES:%s' % pkg) or d.getVar('RPROVIDES') - if rprov: - for p in bb.utils.explode_deps(rprov): - subdata_sym = pkgdatadir + "/runtime-rprovides/%s/%s" % (p, pkg) - bb.utils.mkdirhier(os.path.dirname(subdata_sym)) - oe.path.symlink("../../runtime/%s" % pkg, subdata_sym, True) - - allow_empty = d.getVar('ALLOW_EMPTY:%s' % pkg) - if not allow_empty: - allow_empty = d.getVar('ALLOW_EMPTY') - root = "%s/%s" % (pkgdest, pkg) - os.chdir(root) - g = glob('*') - if g or allow_empty == "1": - # Symlinks needed for reverse lookups (from the final package name) - subdata_sym = pkgdatadir + "/runtime-reverse/%s" % pkgval - oe.path.symlink("../runtime/%s" % pkg, subdata_sym, True) - - packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg - open(packagedfile, 'w').close() - - if bb.data.inherits_class('kernel', d) or bb.data.inherits_class('module-base', d): - write_extra_runtime_pkgs(variants, packages, pkgdatadir) - - if bb.data.inherits_class('allarch', d) and not variants \ - and not bb.data.inherits_class('packagegroup', d): - write_extra_runtime_pkgs(global_variants, packages, pkgdatadir) - + import oe.packagedata + oe.packagedata.emit_pkgdata(pkgfiles, d) } emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides ${PKGDESTWORK}/extended" -emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS" ldconfig_postinst_fragment() { if [ x"$D" = "x" ]; then @@ -1787,456 +391,23 @@ fi RPMDEPS = "${STAGING_LIBDIR_NATIVE}/rpm/rpmdeps --alldeps --define '__font_provides %{nil}'" -# Collect perfile run-time dependency metadata -# Output: -# FILERPROVIDESFLIST:pkg - list of all files w/ deps -# FILERPROVIDES:filepath:pkg - per file dep -# -# FILERDEPENDSFLIST:pkg - list of all files w/ deps -# FILERDEPENDS:filepath:pkg - per file dep - python package_do_filedeps() { - if d.getVar('SKIP_FILEDEPS') == '1': - return - - pkgdest = d.getVar('PKGDEST') - packages = d.getVar('PACKAGES') - rpmdeps = d.getVar('RPMDEPS') - - def chunks(files, n): - return [files[i:i+n] for i in range(0, len(files), n)] - - pkglist = [] - for pkg in packages.split(): - if d.getVar('SKIP_FILEDEPS:' + pkg) == '1': - continue - if pkg.endswith('-dbg') or pkg.endswith('-doc') or pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or pkg.startswith('kernel-module-') or pkg.endswith('-src'): - continue - for files in chunks(pkgfiles[pkg], 100): - pkglist.append((pkg, files, rpmdeps, pkgdest)) - - processed = oe.utils.multiprocess_launch(oe.package.filedeprunner, pkglist, d) - - provides_files = {} - requires_files = {} - - for result in processed: - (pkg, provides, requires) = result - - if pkg not in provides_files: - provides_files[pkg] = [] - if pkg not in requires_files: - requires_files[pkg] = [] - - for file in sorted(provides): - provides_files[pkg].append(file) - key = "FILERPROVIDES:" + file + ":" + pkg - d.appendVar(key, " " + " ".join(provides[file])) - - for file in sorted(requires): - requires_files[pkg].append(file) - key = "FILERDEPENDS:" + file + ":" + pkg - d.appendVar(key, " " + " ".join(requires[file])) - - for pkg in requires_files: - d.setVar("FILERDEPENDSFLIST:" + pkg, " ".join(sorted(requires_files[pkg]))) - for pkg in provides_files: - d.setVar("FILERPROVIDESFLIST:" + pkg, " ".join(sorted(provides_files[pkg]))) + oe.package.process_filedeps(pkgfiles, d) } SHLIBSDIRS = "${WORKDIR_PKGDATA}/${MLPREFIX}shlibs2" SHLIBSWORKDIR = "${PKGDESTWORK}/${MLPREFIX}shlibs2" python package_do_shlibs() { - import itertools - import re, pipes - import subprocess - - exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', False) - if exclude_shlibs: - bb.note("not generating shlibs") - return - - lib_re = re.compile(r"^.*\.so") - libdir_re = re.compile(r".*/%s$" % d.getVar('baselib')) - - packages = d.getVar('PACKAGES') - - shlib_pkgs = [] - exclusion_list = d.getVar("EXCLUDE_PACKAGES_FROM_SHLIBS") - if exclusion_list: - for pkg in packages.split(): - if pkg not in exclusion_list.split(): - shlib_pkgs.append(pkg) - else: - bb.note("not generating shlibs for %s" % pkg) - else: - shlib_pkgs = packages.split() - - hostos = d.getVar('HOST_OS') - - workdir = d.getVar('WORKDIR') - - ver = d.getVar('PKGV') - if not ver: - msg = "PKGV not defined" - oe.qa.handle_error("pkgv-undefined", msg, d) - return - - pkgdest = d.getVar('PKGDEST') - - shlibswork_dir = d.getVar('SHLIBSWORKDIR') - - def linux_so(file, pkg, pkgver, d): - needs_ldconfig = False - needed = set() - sonames = set() - renames = [] - ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '') - cmd = d.getVar('OBJDUMP') + " -p " + pipes.quote(file) + " 2>/dev/null" - fd = os.popen(cmd) - lines = fd.readlines() - fd.close() - rpath = tuple() - for l in lines: - m = re.match(r"\s+RPATH\s+([^\s]*)", l) - if m: - rpaths = m.group(1).replace("$ORIGIN", ldir).split(":") - rpath = tuple(map(os.path.normpath, rpaths)) - for l in lines: - m = re.match(r"\s+NEEDED\s+([^\s]*)", l) - if m: - dep = m.group(1) - if dep not in needed: - needed.add((dep, file, rpath)) - m = re.match(r"\s+SONAME\s+([^\s]*)", l) - if m: - this_soname = m.group(1) - prov = (this_soname, ldir, pkgver) - if not prov in sonames: - # if library is private (only used by package) then do not build shlib for it - import fnmatch - if not private_libs or len([i for i in private_libs if fnmatch.fnmatch(this_soname, i)]) == 0: - sonames.add(prov) - if libdir_re.match(os.path.dirname(file)): - needs_ldconfig = True - if needs_ldconfig and snap_symlinks and (os.path.basename(file) != this_soname): - renames.append((file, os.path.join(os.path.dirname(file), this_soname))) - return (needs_ldconfig, needed, sonames, renames) - - def darwin_so(file, needed, sonames, renames, pkgver): - if not os.path.exists(file): - return - ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '') - - def get_combinations(base): - # - # Given a base library name, find all combinations of this split by "." and "-" - # - combos = [] - options = base.split(".") - for i in range(1, len(options) + 1): - combos.append(".".join(options[0:i])) - options = base.split("-") - for i in range(1, len(options) + 1): - combos.append("-".join(options[0:i])) - return combos - - if (file.endswith('.dylib') or file.endswith('.so')) and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-src'): - # Drop suffix - name = os.path.basename(file).rsplit(".",1)[0] - # Find all combinations - combos = get_combinations(name) - for combo in combos: - if not combo in sonames: - prov = (combo, ldir, pkgver) - sonames.add(prov) - if file.endswith('.dylib') or file.endswith('.so'): - rpath = [] - p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() - # If returned successfully, process stdout for results - if p.returncode == 0: - for l in out.split("\n"): - l = l.strip() - if l.startswith('path '): - rpath.append(l.split()[1]) - - p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() - # If returned successfully, process stdout for results - if p.returncode == 0: - for l in out.split("\n"): - l = l.strip() - if not l or l.endswith(":"): - continue - if "is not an object file" in l: - continue - name = os.path.basename(l.split()[0]).rsplit(".", 1)[0] - if name and name not in needed[pkg]: - needed[pkg].add((name, file, tuple())) - - def mingw_dll(file, needed, sonames, renames, pkgver): - if not os.path.exists(file): - return - - if file.endswith(".dll"): - # assume all dlls are shared objects provided by the package - sonames.add((os.path.basename(file), os.path.dirname(file).replace(pkgdest + "/" + pkg, ''), pkgver)) - - if (file.endswith(".dll") or file.endswith(".exe")): - # use objdump to search for "DLL Name: .*\.dll" - p = subprocess.Popen([d.expand("${HOST_PREFIX}objdump"), "-p", file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() - # process the output, grabbing all .dll names - if p.returncode == 0: - for m in re.finditer(r"DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE): - dllname = m.group(1) - if dllname: - needed[pkg].add((dllname, file, tuple())) - - if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS') == "1": - snap_symlinks = True - else: - snap_symlinks = False - - needed = {} - - shlib_provider = oe.package.read_shlib_providers(d) - - for pkg in shlib_pkgs: - private_libs = d.getVar('PRIVATE_LIBS:' + pkg) or d.getVar('PRIVATE_LIBS') or "" - private_libs = private_libs.split() - needs_ldconfig = False - bb.debug(2, "calculating shlib provides for %s" % pkg) - - pkgver = d.getVar('PKGV:' + pkg) - if not pkgver: - pkgver = d.getVar('PV_' + pkg) - if not pkgver: - pkgver = ver - - needed[pkg] = set() - sonames = set() - renames = [] - linuxlist = [] - for file in pkgfiles[pkg]: - soname = None - if cpath.islink(file): - continue - if hostos == "darwin" or hostos == "darwin8": - darwin_so(file, needed, sonames, renames, pkgver) - elif hostos.startswith("mingw"): - mingw_dll(file, needed, sonames, renames, pkgver) - elif os.access(file, os.X_OK) or lib_re.match(file): - linuxlist.append(file) - - if linuxlist: - results = oe.utils.multiprocess_launch(linux_so, linuxlist, d, extraargs=(pkg, pkgver, d)) - for r in results: - ldconfig = r[0] - needed[pkg] |= r[1] - sonames |= r[2] - renames.extend(r[3]) - needs_ldconfig = needs_ldconfig or ldconfig - - for (old, new) in renames: - bb.note("Renaming %s to %s" % (old, new)) - bb.utils.rename(old, new) - pkgfiles[pkg].remove(old) - - shlibs_file = os.path.join(shlibswork_dir, pkg + ".list") - if len(sonames): - with open(shlibs_file, 'w') as fd: - for s in sorted(sonames): - if s[0] in shlib_provider and s[1] in shlib_provider[s[0]]: - (old_pkg, old_pkgver) = shlib_provider[s[0]][s[1]] - if old_pkg != pkg: - bb.warn('%s-%s was registered as shlib provider for %s, changing it to %s-%s because it was built later' % (old_pkg, old_pkgver, s[0], pkg, pkgver)) - bb.debug(1, 'registering %s-%s as shlib provider for %s' % (pkg, pkgver, s[0])) - fd.write(s[0] + ':' + s[1] + ':' + s[2] + '\n') - if s[0] not in shlib_provider: - shlib_provider[s[0]] = {} - shlib_provider[s[0]][s[1]] = (pkg, pkgver) - if needs_ldconfig: - bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) - postinst = d.getVar('pkg_postinst:%s' % pkg) - if not postinst: - postinst = '#!/bin/sh\n' - postinst += d.getVar('ldconfig_postinst_fragment') - d.setVar('pkg_postinst:%s' % pkg, postinst) - bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames)) - - assumed_libs = d.getVar('ASSUME_SHLIBS') - if assumed_libs: - libdir = d.getVar("libdir") - for e in assumed_libs.split(): - l, dep_pkg = e.split(":") - lib_ver = None - dep_pkg = dep_pkg.rsplit("_", 1) - if len(dep_pkg) == 2: - lib_ver = dep_pkg[1] - dep_pkg = dep_pkg[0] - if l not in shlib_provider: - shlib_provider[l] = {} - shlib_provider[l][libdir] = (dep_pkg, lib_ver) - - libsearchpath = [d.getVar('libdir'), d.getVar('base_libdir')] - - for pkg in shlib_pkgs: - bb.debug(2, "calculating shlib requirements for %s" % pkg) - - private_libs = d.getVar('PRIVATE_LIBS:' + pkg) or d.getVar('PRIVATE_LIBS') or "" - private_libs = private_libs.split() - - deps = list() - for n in needed[pkg]: - # if n is in private libraries, don't try to search provider for it - # this could cause problem in case some abc.bb provides private - # /opt/abc/lib/libfoo.so.1 and contains /usr/bin/abc depending on system library libfoo.so.1 - # but skipping it is still better alternative than providing own - # version and then adding runtime dependency for the same system library - import fnmatch - if private_libs and len([i for i in private_libs if fnmatch.fnmatch(n[0], i)]) > 0: - bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n[0])) - continue - if n[0] in shlib_provider.keys(): - shlib_provider_map = shlib_provider[n[0]] - matches = set() - for p in itertools.chain(list(n[2]), sorted(shlib_provider_map.keys()), libsearchpath): - if p in shlib_provider_map: - matches.add(p) - if len(matches) > 1: - matchpkgs = ', '.join([shlib_provider_map[match][0] for match in matches]) - bb.error("%s: Multiple shlib providers for %s: %s (used by files: %s)" % (pkg, n[0], matchpkgs, n[1])) - elif len(matches) == 1: - (dep_pkg, ver_needed) = shlib_provider_map[matches.pop()] - - bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1])) - - if dep_pkg == pkg: - continue - - if ver_needed: - dep = "%s (>= %s)" % (dep_pkg, ver_needed) - else: - dep = dep_pkg - if not dep in deps: - deps.append(dep) - continue - bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1])) - - deps_file = os.path.join(pkgdest, pkg + ".shlibdeps") - if os.path.exists(deps_file): - os.remove(deps_file) - if deps: - with open(deps_file, 'w') as fd: - for dep in sorted(deps): - fd.write(dep + '\n') + oe.package.process_shlibs(pkgfiles, d) } python package_do_pkgconfig () { - import re - - packages = d.getVar('PACKAGES') - workdir = d.getVar('WORKDIR') - pkgdest = d.getVar('PKGDEST') - - shlibs_dirs = d.getVar('SHLIBSDIRS').split() - shlibswork_dir = d.getVar('SHLIBSWORKDIR') - - pc_re = re.compile(r'(.*)\.pc$') - var_re = re.compile(r'(.*)=(.*)') - field_re = re.compile(r'(.*): (.*)') - - pkgconfig_provided = {} - pkgconfig_needed = {} - for pkg in packages.split(): - pkgconfig_provided[pkg] = [] - pkgconfig_needed[pkg] = [] - for file in sorted(pkgfiles[pkg]): - m = pc_re.match(file) - if m: - pd = bb.data.init() - name = m.group(1) - pkgconfig_provided[pkg].append(os.path.basename(name)) - if not os.access(file, os.R_OK): - continue - with open(file, 'r') as f: - lines = f.readlines() - for l in lines: - m = var_re.match(l) - if m: - name = m.group(1) - val = m.group(2) - pd.setVar(name, pd.expand(val)) - continue - m = field_re.match(l) - if m: - hdr = m.group(1) - exp = pd.expand(m.group(2)) - if hdr == 'Requires': - pkgconfig_needed[pkg] += exp.replace(',', ' ').split() - - for pkg in packages.split(): - pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist") - if pkgconfig_provided[pkg] != []: - with open(pkgs_file, 'w') as f: - for p in sorted(pkgconfig_provided[pkg]): - f.write('%s\n' % p) - - # Go from least to most specific since the last one found wins - for dir in reversed(shlibs_dirs): - if not os.path.exists(dir): - continue - for file in sorted(os.listdir(dir)): - m = re.match(r'^(.*)\.pclist$', file) - if m: - pkg = m.group(1) - with open(os.path.join(dir, file)) as fd: - lines = fd.readlines() - pkgconfig_provided[pkg] = [] - for l in lines: - pkgconfig_provided[pkg].append(l.rstrip()) - - for pkg in packages.split(): - deps = [] - for n in pkgconfig_needed[pkg]: - found = False - for k in pkgconfig_provided.keys(): - if n in pkgconfig_provided[k]: - if k != pkg and not (k in deps): - deps.append(k) - found = True - if found == False: - bb.note("couldn't find pkgconfig module '%s' in any package" % n) - deps_file = os.path.join(pkgdest, pkg + ".pcdeps") - if len(deps): - with open(deps_file, 'w') as fd: - for dep in deps: - fd.write(dep + '\n') + oe.package.process_pkgconfig(pkgfiles, d) } -def read_libdep_files(d): - pkglibdeps = {} - packages = d.getVar('PACKAGES').split() - for pkg in packages: - pkglibdeps[pkg] = {} - for extension in ".shlibdeps", ".pcdeps", ".clilibdeps": - depsfile = d.expand("${PKGDEST}/" + pkg + extension) - if os.access(depsfile, os.R_OK): - with open(depsfile) as fd: - lines = fd.readlines() - for l in lines: - l.rstrip() - deps = bb.utils.explode_dep_versions2(l) - for dep in deps: - if not dep in pkglibdeps[pkg]: - pkglibdeps[pkg][dep] = deps[dep] - return pkglibdeps - python read_shlibdeps () { - pkglibdeps = read_libdep_files(d) + pkglibdeps = oe.package.read_libdep_files(d) packages = d.getVar('PACKAGES').split() for pkg in packages: @@ -2252,125 +423,7 @@ python read_shlibdeps () { } python package_depchains() { - """ - For a given set of prefix and postfix modifiers, make those packages - RRECOMMENDS on the corresponding packages for its RDEPENDS. - - Example: If package A depends upon package B, and A's .bb emits an - A-dev package, this would make A-dev Recommends: B-dev. - - If only one of a given suffix is specified, it will take the RRECOMMENDS - based on the RDEPENDS of *all* other packages. If more than one of a given - suffix is specified, its will only use the RDEPENDS of the single parent - package. - """ - - packages = d.getVar('PACKAGES') - postfixes = (d.getVar('DEPCHAIN_POST') or '').split() - prefixes = (d.getVar('DEPCHAIN_PRE') or '').split() - - def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d): - - #bb.note('depends for %s is %s' % (base, depends)) - rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS:' + pkg) or "") - - for depend in sorted(depends): - if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'): - #bb.note("Skipping %s" % depend) - continue - if depend.endswith('-dev'): - depend = depend[:-4] - if depend.endswith('-dbg'): - depend = depend[:-4] - pkgname = getname(depend, suffix) - #bb.note("Adding %s for %s" % (pkgname, depend)) - if pkgname not in rreclist and pkgname != pkg: - rreclist[pkgname] = [] - - #bb.note('setting: RRECOMMENDS:%s=%s' % (pkg, ' '.join(rreclist))) - d.setVar('RRECOMMENDS:%s' % pkg, bb.utils.join_deps(rreclist, commasep=False)) - - def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): - - #bb.note('rdepends for %s is %s' % (base, rdepends)) - rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS:' + pkg) or "") - - for depend in sorted(rdepends): - if depend.find('virtual-locale-') != -1: - #bb.note("Skipping %s" % depend) - continue - if depend.endswith('-dev'): - depend = depend[:-4] - if depend.endswith('-dbg'): - depend = depend[:-4] - pkgname = getname(depend, suffix) - #bb.note("Adding %s for %s" % (pkgname, depend)) - if pkgname not in rreclist and pkgname != pkg: - rreclist[pkgname] = [] - - #bb.note('setting: RRECOMMENDS:%s=%s' % (pkg, ' '.join(rreclist))) - d.setVar('RRECOMMENDS:%s' % pkg, bb.utils.join_deps(rreclist, commasep=False)) - - def add_dep(list, dep): - if dep not in list: - list.append(dep) - - depends = [] - for dep in bb.utils.explode_deps(d.getVar('DEPENDS') or ""): - add_dep(depends, dep) - - rdepends = [] - for pkg in packages.split(): - for dep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + pkg) or ""): - add_dep(rdepends, dep) - - #bb.note('rdepends is %s' % rdepends) - - def post_getname(name, suffix): - return '%s%s' % (name, suffix) - def pre_getname(name, suffix): - return '%s%s' % (suffix, name) - - pkgs = {} - for pkg in packages.split(): - for postfix in postfixes: - if pkg.endswith(postfix): - if not postfix in pkgs: - pkgs[postfix] = {} - pkgs[postfix][pkg] = (pkg[:-len(postfix)], post_getname) - - for prefix in prefixes: - if pkg.startswith(prefix): - if not prefix in pkgs: - pkgs[prefix] = {} - pkgs[prefix][pkg] = (pkg[:-len(prefix)], pre_getname) - - if "-dbg" in pkgs: - pkglibdeps = read_libdep_files(d) - pkglibdeplist = [] - for pkg in pkglibdeps: - for k in pkglibdeps[pkg]: - add_dep(pkglibdeplist, k) - dbgdefaultdeps = ((d.getVar('DEPCHAIN_DBGDEFAULTDEPS') == '1') or (bb.data.inherits_class('packagegroup', d))) - - for suffix in pkgs: - for pkg in pkgs[suffix]: - if d.getVarFlag('RRECOMMENDS:' + pkg, 'nodeprrecs'): - continue - (base, func) = pkgs[suffix][pkg] - if suffix == "-dev": - pkg_adddeprrecs(pkg, base, suffix, func, depends, d) - elif suffix == "-dbg": - if not dbgdefaultdeps: - pkg_addrrecs(pkg, base, suffix, func, pkglibdeplist, d) - continue - if len(pkgs[suffix]) == 1: - pkg_addrrecs(pkg, base, suffix, func, rdepends, d) - else: - rdeps = [] - for dep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + base) or ""): - add_dep(rdeps, dep) - pkg_addrrecs(pkg, base, suffix, func, rdeps, d) + oe.package.process_depchains(pkgfiles, d) } # Since bitbake can't determine which variables are accessed during package @@ -2392,15 +445,9 @@ def gen_packagevar(d, pkgvars="PACKAGEVARS"): ret.append('_exclude_incompatible-%s' % p) return " ".join(ret) -PACKAGE_PREPROCESS_FUNCS ?= "" + # Functions for setting up PKGD -PACKAGEBUILDPKGD ?= " \ - package_prepare_pkgdata \ - perform_packagecopy \ - ${PACKAGE_PREPROCESS_FUNCS} \ - split_and_strip_files \ - fixup_perms \ - " +PACKAGE_PREPROCESS_FUNCS ?= "" # Functions which split PKGD up into separate packages PACKAGESPLITFUNCS ?= " \ package_do_split_locales \ @@ -2467,8 +514,12 @@ python do_package () { # Setup PKGD (from D) ########################################################################### - for f in (d.getVar('PACKAGEBUILDPKGD') or '').split(): + bb.build.exec_func("package_prepare_pkgdata", d) + bb.build.exec_func("perform_packagecopy", d) + for f in (d.getVar('PACKAGE_PREPROCESS_FUNCS') or '').split(): bb.build.exec_func(f, d) + oe.package.process_split_and_strip_files(d) + oe.package.fixup_perms(d) ########################################################################### # Split up PKGD into PKGDEST @@ -2501,7 +552,7 @@ python do_package () { } do_package[dirs] = "${SHLIBSWORKDIR} ${D}" -do_package[vardeps] += "${PACKAGEBUILDPKGD} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}" +do_package[vardeps] += "${PACKAGE_PREPROCESS_FUNCS} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}" addtask package after do_install SSTATETASKS += "do_package" @@ -2546,16 +597,3 @@ python do_packagedata_setscene () { } addtask do_packagedata_setscene -# -# Helper functions for the package writing classes -# - -def mapping_rename_hook(d): - """ - Rewrite variables to account for package renaming in things - like debian.bbclass or manual PKG variable name changes - """ - pkg = d.getVar("PKG") - runtime_mapping_rename("RDEPENDS", pkg, d) - runtime_mapping_rename("RRECOMMENDS", pkg, d) - runtime_mapping_rename("RSUGGESTS", pkg, d) diff --git a/poky/meta/classes-global/package_deb.bbclass b/poky/meta/classes-global/package_deb.bbclass index ec7e10dbc9..5aba3837bd 100644 --- a/poky/meta/classes-global/package_deb.bbclass +++ b/poky/meta/classes-global/package_deb.bbclass @@ -169,12 +169,12 @@ def deb_write_pkg(pkg, d): # more fields - custom_fields_chunk = get_package_additional_metadata("deb", localdata) + custom_fields_chunk = oe.packagedata.get_package_additional_metadata("deb", localdata) if custom_fields_chunk: ctrlfile.write(custom_fields_chunk) ctrlfile.write("\n") - mapping_rename_hook(localdata) + oe.packagedata.mapping_rename_hook(localdata) def debian_cmp_remap(var): # dpkg does not allow for '(', ')' or ':' in a dependency name @@ -269,7 +269,7 @@ def deb_write_pkg(pkg, d): scriptfile.close() os.chmod(os.path.join(controldir, script), 0o755) - conffiles_str = ' '.join(get_conffiles(pkg, d)) + conffiles_str = ' '.join(oe.package.get_conffiles(pkg, d)) if conffiles_str: conffiles = open(os.path.join(controldir, 'conffiles'), 'w') for f in conffiles_str.split(): diff --git a/poky/meta/classes-global/package_ipk.bbclass b/poky/meta/classes-global/package_ipk.bbclass index c43592af7e..b4b7bc9ac2 100644 --- a/poky/meta/classes-global/package_ipk.bbclass +++ b/poky/meta/classes-global/package_ipk.bbclass @@ -162,12 +162,12 @@ def ipk_write_pkg(pkg, d): else: ctrlfile.write(c % tuple(pullData(fs, localdata))) - custom_fields_chunk = get_package_additional_metadata("ipk", localdata) + custom_fields_chunk = oe.packagedata.get_package_additional_metadata("ipk", localdata) if custom_fields_chunk is not None: ctrlfile.write(custom_fields_chunk) ctrlfile.write("\n") - mapping_rename_hook(localdata) + oe.packagedata.mapping_rename_hook(localdata) def debian_cmp_remap(var): # In debian '>' and '<' do not mean what it appears they mean @@ -226,7 +226,7 @@ def ipk_write_pkg(pkg, d): scriptfile.close() os.chmod(os.path.join(controldir, script), 0o755) - conffiles_str = ' '.join(get_conffiles(pkg, d)) + conffiles_str = ' '.join(oe.package.get_conffiles(pkg, d)) if conffiles_str: conffiles = open(os.path.join(controldir, 'conffiles'), 'w') for f in conffiles_str.split(): diff --git a/poky/meta/classes-global/package_rpm.bbclass b/poky/meta/classes-global/package_rpm.bbclass index 81a2060b68..85d0bd7fce 100644 --- a/poky/meta/classes-global/package_rpm.bbclass +++ b/poky/meta/classes-global/package_rpm.bbclass @@ -159,7 +159,9 @@ python write_specfile () { pv = subd['PV'] pkgv = subd['PKGV'] reppv = pkgv.replace('-', '+') - ver = ver.replace(pv, reppv).replace(pkgv, reppv) + if ver.startswith(pv): + ver = ver.replace(pv, reppv) + ver = ver.replace(pkgv, reppv) if 'PKGR' in subd: # Make sure PKGR rather than PR in ver pr = '-' + subd['PR'] @@ -297,7 +299,7 @@ python write_specfile () { srcmaintainer = localdata.getVar('MAINTAINER') srchomepage = localdata.getVar('HOMEPAGE') srcdescription = localdata.getVar('DESCRIPTION') or "." - srccustomtagschunk = get_package_additional_metadata("rpm", localdata) + srccustomtagschunk = oe.packagedata.get_package_additional_metadata("rpm", localdata) srcdepends = d.getVar('DEPENDS') srcrdepends = "" @@ -339,7 +341,7 @@ python write_specfile () { localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg) - conffiles = get_conffiles(pkg, d) + conffiles = oe.package.get_conffiles(pkg, d) dirfiles = localdata.getVar('DIRFILES') if dirfiles is not None: dirfiles = dirfiles.split() @@ -353,7 +355,7 @@ python write_specfile () { splitlicense = (localdata.getVar('LICENSE') or "") splitsection = (localdata.getVar('SECTION') or "") splitdescription = (localdata.getVar('DESCRIPTION') or ".") - splitcustomtagschunk = get_package_additional_metadata("rpm", localdata) + splitcustomtagschunk = oe.packagedata.get_package_additional_metadata("rpm", localdata) translate_vers('RDEPENDS', localdata) translate_vers('RRECOMMENDS', localdata) @@ -363,7 +365,7 @@ python write_specfile () { translate_vers('RCONFLICTS', localdata) # Map the dependencies into their final form - mapping_rename_hook(localdata) + oe.packagedata.mapping_rename_hook(localdata) splitrdepends = localdata.getVar('RDEPENDS') or "" splitrrecommends = localdata.getVar('RRECOMMENDS') or "" diff --git a/poky/meta/classes-global/sanity.bbclass b/poky/meta/classes-global/sanity.bbclass index bc188eefb7..b42fc526c4 100644 --- a/poky/meta/classes-global/sanity.bbclass +++ b/poky/meta/classes-global/sanity.bbclass @@ -759,10 +759,10 @@ def check_sanity_everybuild(status, d): if 0 == os.getuid(): raise_sanity_error("Do not use Bitbake as root.", d) - # Check the Python version, we now have a minimum of Python 3.6 + # Check the Python version, we now have a minimum of Python 3.8 import sys - if sys.hexversion < 0x030600F0: - status.addresult('The system requires at least Python 3.6 to run. Please update your Python interpreter.\n') + if sys.hexversion < 0x030800F0: + status.addresult('The system requires at least Python 3.8 to run. Please update your Python interpreter.\n') # Check the bitbake version meets minimum requirements minversion = d.getVar('BB_MIN_VERSION') diff --git a/poky/meta/classes-global/sstate.bbclass b/poky/meta/classes-global/sstate.bbclass index 21959ff13b..77e3ea34e1 100644 --- a/poky/meta/classes-global/sstate.bbclass +++ b/poky/meta/classes-global/sstate.bbclass @@ -925,6 +925,8 @@ sstate_unpack_package () { BB_HASHCHECK_FUNCTION = "sstate_checkhashes" def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, **kwargs): + import itertools + found = set() missed = set() @@ -1019,7 +1021,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, connection_cache_pool.put(connection_cache) if progress: - bb.event.fire(bb.event.ProcessProgress(msg, len(tasklist) - thread_worker.tasks.qsize()), d) + bb.event.fire(bb.event.ProcessProgress(msg, next(cnt_tasks_done)), d) tasklist = [] for tid in missed: @@ -1029,6 +1031,8 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True, if tasklist: nproc = min(int(d.getVar("BB_NUMBER_THREADS")), len(tasklist)) + ## thread-safe counter + cnt_tasks_done = itertools.count(start = 1) progress = len(tasklist) >= 100 if progress: msg = "Checking sstate mirror object availability" diff --git a/poky/meta/classes-global/uninative.bbclass b/poky/meta/classes-global/uninative.bbclass index 42c5f8fdf2..366f7ac793 100644 --- a/poky/meta/classes-global/uninative.bbclass +++ b/poky/meta/classes-global/uninative.bbclass @@ -40,6 +40,8 @@ python uninative_event_fetchloader() { with open(loaderchksum, "r") as f: readchksum = f.read().strip() if readchksum == chksum: + if "uninative" not in d.getVar("SSTATEPOSTUNPACKFUNCS"): + enable_uninative(d) return import subprocess diff --git a/poky/meta/classes-recipe/baremetal-image.bbclass b/poky/meta/classes-recipe/baremetal-image.bbclass index d3377a92fa..70791f999a 100644 --- a/poky/meta/classes-recipe/baremetal-image.bbclass +++ b/poky/meta/classes-recipe/baremetal-image.bbclass @@ -15,15 +15,6 @@ # # See meta-skeleton for a working example. -## Emulate image.bbclass -# Handle inherits of any of the image classes we need -IMAGE_CLASSES ??= "" -IMGCLASSES = " ${IMAGE_CLASSES}" -inherit ${IMGCLASSES} -# Set defaults to satisfy IMAGE_FEATURES check -IMAGE_FEATURES ?= "" -IMAGE_FEATURES[type] = "list" -IMAGE_FEATURES[validitems] += "" # Toolchain should be baremetal or newlib based. # TCLIBC="baremetal" or TCLIBC="newlib" @@ -95,6 +86,11 @@ QB_DEFAULT_FSTYPE ?= "bin" QB_DTB ?= "" QB_OPT_APPEND:append = " -nographic" +# QEMU x86 requires an .elf kernel to boot rather than a .bin +QB_DEFAULT_KERNEL:qemux86 ?= "${IMAGE_LINK_NAME}.elf" +# QEMU x86-64 refuses to boot from -kernel, needs a multiboot compatible image +QB_DEFAULT_FSTYPE:qemux86-64 ?= "iso" + # RISC-V tunes set the BIOS, unset, and instruct QEMU to # ignore the BIOS and boot from -kernel QB_DEFAULT_BIOS:qemuriscv64 = "" @@ -110,6 +106,17 @@ QB_OPT_APPEND:append:qemuriscv32 = " -bios none" CFLAGS:append:qemuriscv64 = " -mcmodel=medany" +## Emulate image.bbclass +# Handle inherits of any of the image classes we need +IMAGE_CLASSES ??= "" +IMGCLASSES = " ${IMAGE_CLASSES}" +inherit ${IMGCLASSES} +# Set defaults to satisfy IMAGE_FEATURES check +IMAGE_FEATURES ?= "" +IMAGE_FEATURES[type] = "list" +IMAGE_FEATURES[validitems] += "" + + # This next part is necessary to trick the build system into thinking # its building an image recipe so it generates the qemuboot.conf addtask do_rootfs before do_image after do_install diff --git a/poky/meta/classes-recipe/image.bbclass b/poky/meta/classes-recipe/image.bbclass index e387645503..d9472a795a 100644 --- a/poky/meta/classes-recipe/image.bbclass +++ b/poky/meta/classes-recipe/image.bbclass @@ -182,8 +182,7 @@ python () { IMAGE_POSTPROCESS_COMMAND ?= "" -# some default locales -IMAGE_LINGUAS ?= "de-de fr-fr en-gb" +IMAGE_LINGUAS ??= "" LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}" @@ -203,6 +202,7 @@ fakeroot python do_rootfs () { from oe.rootfs import create_rootfs from oe.manifest import create_manifest import logging + import oe.packagedata logger = d.getVar('BB_TASK_LOGGER', False) if logger: @@ -247,9 +247,9 @@ fakeroot python do_rootfs () { # otherwise, the multilib renaming could step in and squash any fixups that # may have occurred. pn = d.getVar('PN') - runtime_mapping_rename("PACKAGE_INSTALL", pn, d) - runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d) - runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d) + oe.packagedata.runtime_mapping_rename("PACKAGE_INSTALL", pn, d) + oe.packagedata.runtime_mapping_rename("PACKAGE_INSTALL_ATTEMPTONLY", pn, d) + oe.packagedata.runtime_mapping_rename("BAD_RECOMMENDATIONS", pn, d) # Generate the initial manifest create_manifest(d) diff --git a/poky/meta/classes-recipe/kernel-arch.bbclass b/poky/meta/classes-recipe/kernel-arch.bbclass index 6f5d3bde6c..1531ae6cd5 100644 --- a/poky/meta/classes-recipe/kernel-arch.bbclass +++ b/poky/meta/classes-recipe/kernel-arch.bbclass @@ -70,5 +70,5 @@ HOST_AR_KERNEL_ARCH ?= "${TARGET_AR_KERNEL_ARCH}" KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH}" KERNEL_LD = "${CCACHE}${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}" KERNEL_AR = "${CCACHE}${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}" -TOOLCHAIN = "gcc" +TOOLCHAIN ?= "gcc" diff --git a/poky/meta/classes-recipe/kernel-fitimage.bbclass b/poky/meta/classes-recipe/kernel-fitimage.bbclass index 7980910aa8..b77747404f 100644 --- a/poky/meta/classes-recipe/kernel-fitimage.bbclass +++ b/poky/meta/classes-recipe/kernel-fitimage.bbclass @@ -89,6 +89,9 @@ FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name" FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio" +# Allow user to select the default DTB for FIT image when multiple dtb's exists. +FIT_CONF_DEFAULT_DTB ?= "" + # Keys used to sign individually image nodes. # The keys to sign image nodes must be different from those used to sign # configuration nodes, otherwise the "required" property, from @@ -412,6 +415,7 @@ fitimage_emit_section_config() { bootscr_line="" setup_line="" default_line="" + default_dtb_image="${FIT_CONF_DEFAULT_DTB}" dtb_image_sect=$(symlink_points_below $dtb_image "${EXTERNAL_KERNEL_DEVICETREE}") if [ -z "$dtb_image_sect" ]; then @@ -462,7 +466,17 @@ fitimage_emit_section_config() { # default node is selected based on dtb ID if it is present, # otherwise its selected based on kernel ID if [ -n "$dtb_image" ]; then - default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";" + # Select default node as user specified dtb when + # multiple dtb exists. + if [ -n "$default_dtb_image" ]; then + if [ -s "${EXTERNAL_KERNEL_DEVICETREE}/$default_dtb_image" ]; then + default_line="default = \"${FIT_CONF_PREFIX}$default_dtb_image\";" + else + bbwarn "Couldn't find a valid user specified dtb in ${EXTERNAL_KERNEL_DEVICETREE}/$default_dtb_image" + fi + else + default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";" + fi else default_line="default = \"${FIT_CONF_PREFIX}$kernel_id\";" fi @@ -590,8 +604,9 @@ fitimage_assemble() { if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ]; then dtbcount=1 - for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" \( -name '*.dtb' -o -name '*.dtbo' \) -printf '%P\n' | sort); do - # Skip DTB if we've picked it up previously + for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" -name '*.dtb' -printf '%P\n' | sort) \ + $(find "${EXTERNAL_KERNEL_DEVICETREE}" -name '*.dtbo' -printf '%P\n' | sort); do + # Skip DTB/DTBO if we've picked it up previously echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue DTBS="$DTBS $DTB" diff --git a/poky/meta/classes-recipe/kernel-module-split.bbclass b/poky/meta/classes-recipe/kernel-module-split.bbclass index 08c2e54e86..50882c31a7 100644 --- a/poky/meta/classes-recipe/kernel-module-split.bbclass +++ b/poky/meta/classes-recipe/kernel-module-split.bbclass @@ -35,7 +35,7 @@ do_install:append() { } KERNEL_SPLIT_MODULES ?= "1" -PACKAGESPLITFUNCS:prepend = "split_kernel_module_packages " +PACKAGESPLITFUNCS =+ "split_kernel_module_packages" KERNEL_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME") or "kernel" }-modules" diff --git a/poky/meta/classes-recipe/kernel.bbclass b/poky/meta/classes-recipe/kernel.bbclass index 3834a42fb9..bd3b6471c6 100644 --- a/poky/meta/classes-recipe/kernel.bbclass +++ b/poky/meta/classes-recipe/kernel.bbclass @@ -367,6 +367,10 @@ kernel_do_compile() { export KBUILD_BUILD_TIMESTAMP="$ts" export KCONFIG_NOTIMESTAMP=1 bbnote "KBUILD_BUILD_TIMESTAMP: $ts" + else + ts=`LC_ALL=C date` + export KBUILD_BUILD_TIMESTAMP="$ts" + bbnote "KBUILD_BUILD_TIMESTAMP: $ts" fi # The $use_alternate_initrd is only set from # do_bundle_initramfs() This variable is specifically for the @@ -412,6 +416,10 @@ do_compile_kernelmodules() { export KBUILD_BUILD_TIMESTAMP="$ts" export KCONFIG_NOTIMESTAMP=1 bbnote "KBUILD_BUILD_TIMESTAMP: $ts" + else + ts=`LC_ALL=C date` + export KBUILD_BUILD_TIMESTAMP="$ts" + bbnote "KBUILD_BUILD_TIMESTAMP: $ts" fi if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then oe_runmake -C ${B} ${PARALLEL_MAKE} modules ${KERNEL_EXTRA_ARGS} @@ -442,8 +450,8 @@ kernel_do_install() { oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build" rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source" - # If the kernel/ directory is empty remove it to prevent QA issues - rmdir --ignore-fail-on-non-empty "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" + # Remove empty module directories to prevent QA issues + find "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel" -type d -empty -delete else bbnote "no modules to install" fi @@ -697,7 +705,7 @@ pkg_postinst:${KERNEL_PACKAGE_NAME}-base () { fi } -PACKAGESPLITFUNCS:prepend = "split_kernel_packages " +PACKAGESPLITFUNCS =+ "split_kernel_packages" python split_kernel_packages () { do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex=r'^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') diff --git a/poky/meta/classes-recipe/meson.bbclass b/poky/meta/classes-recipe/meson.bbclass index 765e81bc4f..48688bed75 100644 --- a/poky/meta/classes-recipe/meson.bbclass +++ b/poky/meta/classes-recipe/meson.bbclass @@ -72,7 +72,7 @@ strip = ${@meson_array('STRIP', d)} readelf = ${@meson_array('READELF', d)} objcopy = ${@meson_array('OBJCOPY', d)} pkgconfig = 'pkg-config' -llvm-config = 'llvm-config${LLVMVERSION}' +llvm-config = 'llvm-config' cups-config = 'cups-config' g-ir-scanner = '${STAGING_BINDIR}/g-ir-scanner-wrapper' g-ir-compiler = '${STAGING_BINDIR}/g-ir-compiler-wrapper' @@ -152,7 +152,7 @@ meson_do_configure() { mkdir -p "${B}/meson-private/tmp" export TMPDIR="${B}/meson-private/tmp" bbnote Executing meson ${EXTRA_OEMESON}... - if ! meson ${MESONOPTS} "${MESON_SOURCEPATH}" "${B}" ${MESON_CROSS_FILE} ${EXTRA_OEMESON}; then + if ! meson setup ${MESONOPTS} "${MESON_SOURCEPATH}" "${B}" ${MESON_CROSS_FILE} ${EXTRA_OEMESON}; then bbfatal_log meson failed fi } @@ -169,11 +169,11 @@ do_configure[postfuncs] += "meson_do_qa_configure" do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+" meson_do_compile() { - ninja -v ${PARALLEL_MAKE} + meson compile -v ${PARALLEL_MAKE} } meson_do_install() { - DESTDIR='${D}' ninja -v ${PARALLEL_MAKEINST} install + meson install --destdir ${D} --no-rebuild } EXPORT_FUNCTIONS do_configure do_compile do_install diff --git a/poky/meta/classes-recipe/populate_sdk_base.bbclass b/poky/meta/classes-recipe/populate_sdk_base.bbclass index 917619962c..7cc9535356 100644 --- a/poky/meta/classes-recipe/populate_sdk_base.bbclass +++ b/poky/meta/classes-recipe/populate_sdk_base.bbclass @@ -162,6 +162,7 @@ SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; archive_sdk; $ def populate_sdk_common(d): from oe.sdk import populate_sdk from oe.manifest import create_manifest, Manifest + import oe.packagedata # Handle package exclusions excl_pkgs = (d.getVar("PACKAGE_EXCLUDE") or "").split() @@ -184,13 +185,13 @@ def populate_sdk_common(d): d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", ' '.join(inst_attempt_pkgs)) pn = d.getVar('PN') - runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d) - runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d) + oe.packagedata.runtime_mapping_rename("TOOLCHAIN_TARGET_TASK", pn, d) + oe.packagedata.runtime_mapping_rename("TOOLCHAIN_TARGET_TASK_ATTEMPTONLY", pn, d) ld = bb.data.createCopy(d) ld.setVar("PKGDATA_DIR", "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}/pkgdata") - runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld) - runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld) + oe.packagedata.runtime_mapping_rename("TOOLCHAIN_HOST_TASK", pn, ld) + oe.packagedata.runtime_mapping_rename("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", pn, ld) d.setVar("TOOLCHAIN_HOST_TASK", ld.getVar("TOOLCHAIN_HOST_TASK")) d.setVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY", ld.getVar("TOOLCHAIN_HOST_TASK_ATTEMPTONLY")) diff --git a/poky/meta/classes-recipe/populate_sdk_ext.bbclass b/poky/meta/classes-recipe/populate_sdk_ext.bbclass index 01d8a693a7..f78a9f4e9b 100644 --- a/poky/meta/classes-recipe/populate_sdk_ext.bbclass +++ b/poky/meta/classes-recipe/populate_sdk_ext.bbclass @@ -255,7 +255,7 @@ python copy_buildsystem () { bbpath = d.getVar('BBPATH') env = os.environ.copy() env['PYTHONDONTWRITEBYTECODE'] = '1' - bb.process.run(['devtool', '--bbpath', bbpath, '--basepath', baseoutpath, 'create-workspace', '--create-only', os.path.join(baseoutpath, 'workspace')], env=env) + bb.process.run(['devtool', '--bbpath', bbpath, '--basepath', baseoutpath, 'create-workspace', '--layerseries', d.getVar("LAYERSERIES_CORENAMES"), '--create-only', os.path.join(baseoutpath, 'workspace')], env=env) # Create bblayers.conf bb.utils.mkdirhier(baseoutpath + '/conf') @@ -498,7 +498,6 @@ python copy_buildsystem () { else: tasklistfn = None - cachedir = os.path.join(baseoutpath, 'cache') bb.utils.mkdirhier(cachedir) bb.parse.siggen.copy_unitaskhashes(cachedir) diff --git a/poky/meta/classes-recipe/python3targetconfig.bbclass b/poky/meta/classes-recipe/python3targetconfig.bbclass index 3f89e5e09e..22305fe176 100644 --- a/poky/meta/classes-recipe/python3targetconfig.bbclass +++ b/poky/meta/classes-recipe/python3targetconfig.bbclass @@ -10,26 +10,32 @@ EXTRA_PYTHON_DEPENDS ?= "" EXTRA_PYTHON_DEPENDS:class-target = "python3" DEPENDS:append = " ${EXTRA_PYTHON_DEPENDS}" -do_configure:prepend:class-target() { +setup_target_config() { export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" + export PYTHONPATH=${STAGING_LIBDIR}/python-sysconfigdata + export PATH=${STAGING_EXECPREFIXDIR}/python-target-config/:$PATH +} + +do_configure:prepend:class-target() { + setup_target_config } do_compile:prepend:class-target() { - export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" + setup_target_config } do_install:prepend:class-target() { - export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" + setup_target_config } do_configure:prepend:class-nativesdk() { - export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" + setup_target_config } do_compile:prepend:class-nativesdk() { - export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" + setup_target_config } do_install:prepend:class-nativesdk() { - export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" + setup_target_config } diff --git a/poky/meta/classes-recipe/qemuboot.bbclass b/poky/meta/classes-recipe/qemuboot.bbclass index 018c000ca2..5a0e50ccfc 100644 --- a/poky/meta/classes-recipe/qemuboot.bbclass +++ b/poky/meta/classes-recipe/qemuboot.bbclass @@ -13,6 +13,7 @@ # QB_OPT_APPEND: options to append to qemu, e.g., "-device usb-mouse" # # QB_DEFAULT_KERNEL: default kernel to boot, e.g., "bzImage" +# e.g., "bzImage-initramfs-qemux86-64.bin" if INITRAMFS_IMAGE_BUNDLE is set to 1. # # QB_DEFAULT_FSTYPE: default FSTYPE to boot, e.g., "ext4" # @@ -93,7 +94,7 @@ QB_MEM ?= "-m 256" QB_SMP ?= "" QB_SERIAL_OPT ?= "-serial mon:stdio -serial null" -QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}" +QB_DEFAULT_KERNEL ?= "${@bb.utils.contains("INITRAMFS_IMAGE_BUNDLE", "1", "${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin", "${KERNEL_IMAGETYPE}", d)}" QB_DEFAULT_FSTYPE ?= "ext4" QB_RNG ?= "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0" QB_OPT_APPEND ?= "" diff --git a/poky/meta/classes-recipe/rust-common.bbclass b/poky/meta/classes-recipe/rust-common.bbclass index 3338de7502..e0cedd7aa2 100644 --- a/poky/meta/classes-recipe/rust-common.bbclass +++ b/poky/meta/classes-recipe/rust-common.bbclass @@ -66,6 +66,12 @@ def rust_base_triple(d, thing): elif "musl" in os: libc = "-musl" os = "linux" + elif "elf" in os: + libc = "-elf" + os = "none" + elif "eabi" in os: + libc = "-eabi" + os = "none" return arch + vendor + '-' + os + libc @@ -91,7 +97,7 @@ RUST_BUILD_ARCH = "${@oe.rust.arch_to_rust_arch(d.getVar('BUILD_ARCH'))}" # Rust additionally will use two additional cases: # - undecorated (e.g. CC) - equivalent to TARGET # - triple suffix (e.g. CC:x86_64_unknown_linux_gnu) - both -# see: https://github.com/alexcrichton/gcc-rs +# see: https://github.com/rust-lang/cc-rs # The way that Rust's internal triples and Yocto triples are mapped together # its likely best to not use the triple suffix due to potential confusion. @@ -122,12 +128,22 @@ create_wrapper_rust () { shift extras="$1" shift + crate_cc_extras="$1" + shift cat <<- EOF > "${file}" #!/usr/bin/env python3 import os, sys orig_binary = "$@" extras = "${extras}" + + # Apply a required subset of CC crate compiler flags + # when we build a target recipe for a non-bare-metal target. + # https://github.com/rust-lang/cc-rs/blob/main/src/lib.rs#L1614 + if "CRATE_CC_NO_DEFAULTS" in os.environ.keys() and \ + "TARGET" in os.environ.keys() and not "-none-" in os.environ["TARGET"]: + orig_binary += "${crate_cc_extras}" + binary = orig_binary.split()[0] args = orig_binary.split() + sys.argv[1:] if extras: @@ -151,22 +167,22 @@ do_rust_create_wrappers () { mkdir -p "${WRAPPER_DIR}" # Yocto Build / Rust Host C compiler - create_wrapper_rust "${RUST_BUILD_CC}" "" "${BUILD_CC}" + create_wrapper_rust "${RUST_BUILD_CC}" "" "${CRATE_CC_FLAGS}" "${BUILD_CC}" # Yocto Build / Rust Host C++ compiler - create_wrapper_rust "${RUST_BUILD_CXX}" "" "${BUILD_CXX}" + create_wrapper_rust "${RUST_BUILD_CXX}" "" "${CRATE_CC_FLAGS}" "${BUILD_CXX}" # Yocto Build / Rust Host linker - create_wrapper_rust "${RUST_BUILD_CCLD}" "" "${BUILD_CCLD}" "${BUILD_LDFLAGS}" + create_wrapper_rust "${RUST_BUILD_CCLD}" "" "" "${BUILD_CCLD}" "${BUILD_LDFLAGS}" # Yocto Build / Rust Host archiver - create_wrapper_rust "${RUST_BUILD_AR}" "" "${BUILD_AR}" + create_wrapper_rust "${RUST_BUILD_AR}" "" "" "${BUILD_AR}" # Yocto Target / Rust Target C compiler - create_wrapper_rust "${RUST_TARGET_CC}" "${WRAPPER_TARGET_EXTRALD}" "${WRAPPER_TARGET_CC}" "${WRAPPER_TARGET_LDFLAGS}" + create_wrapper_rust "${RUST_TARGET_CC}" "${WRAPPER_TARGET_EXTRALD}" "${CRATE_CC_FLAGS}" "${WRAPPER_TARGET_CC}" "${WRAPPER_TARGET_LDFLAGS}" # Yocto Target / Rust Target C++ compiler - create_wrapper_rust "${RUST_TARGET_CXX}" "${WRAPPER_TARGET_EXTRALD}" "${WRAPPER_TARGET_CXX}" "${CXXFLAGS}" + create_wrapper_rust "${RUST_TARGET_CXX}" "${WRAPPER_TARGET_EXTRALD}" "${CRATE_CC_FLAGS}" "${WRAPPER_TARGET_CXX}" "${CXXFLAGS}" # Yocto Target / Rust Target linker - create_wrapper_rust "${RUST_TARGET_CCLD}" "${WRAPPER_TARGET_EXTRALD}" "${WRAPPER_TARGET_CCLD}" "${WRAPPER_TARGET_LDFLAGS}" + create_wrapper_rust "${RUST_TARGET_CCLD}" "${WRAPPER_TARGET_EXTRALD}" "" "${WRAPPER_TARGET_CCLD}" "${WRAPPER_TARGET_LDFLAGS}" # Yocto Target / Rust Target archiver - create_wrapper_rust "${RUST_TARGET_AR}" "" "${WRAPPER_TARGET_AR}" + create_wrapper_rust "${RUST_TARGET_AR}" "" "" "${WRAPPER_TARGET_AR}" } diff --git a/poky/meta/classes-recipe/rust-target-config.bbclass b/poky/meta/classes-recipe/rust-target-config.bbclass index 2710b4325d..939dd13d2f 100644 --- a/poky/meta/classes-recipe/rust-target-config.bbclass +++ b/poky/meta/classes-recipe/rust-target-config.bbclass @@ -355,7 +355,10 @@ def rust_gen_target(d, thing, wd, arch): tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi) tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi) tspec['arch'] = arch_to_rust_target_arch(rust_arch) - tspec['os'] = "linux" + if "baremetal" in d.getVar('TCLIBC'): + tspec['os'] = "none" + else: + tspec['os'] = "linux" if "musl" in tspec['llvm-target']: tspec['env'] = "musl" else: @@ -401,3 +404,19 @@ python do_rust_gen_targets () { addtask rust_gen_targets after do_patch before do_compile do_rust_gen_targets[dirs] += "${RUST_TARGETS_DIR}" +# For building target C dependecies use only compiler parameters defined in OE +# and ignore the CC crate defaults which conflicts with OE ones in some cases. +# https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables +# Some CC crate compiler flags are still required. +# We apply them conditionally in rust wrappers. + +CRATE_CC_FLAGS:class-native = "" +CRATE_CC_FLAGS:class-nativesdk = "" +CRATE_CC_FLAGS:class-target = " -ffunction-sections -fdata-sections -fPIC" + +do_compile:prepend:class-target() { + export CRATE_CC_NO_DEFAULTS=1 +} +do_install:prepend:class-target() { + export CRATE_CC_NO_DEFAULTS=1 +} diff --git a/poky/meta/classes-recipe/setuptools3_legacy.bbclass b/poky/meta/classes-recipe/setuptools3_legacy.bbclass index 21748f922a..57de956d0a 100644 --- a/poky/meta/classes-recipe/setuptools3_legacy.bbclass +++ b/poky/meta/classes-recipe/setuptools3_legacy.bbclass @@ -49,7 +49,7 @@ setuptools3_legacy_do_install() { install -d ${D}${PYTHON_SITEPACKAGES_DIR} STAGING_INCDIR=${STAGING_INCDIR} \ STAGING_LIBDIR=${STAGING_LIBDIR} \ - PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR} \ + PYTHONPATH=${D}${PYTHON_SITEPACKAGES_DIR}:$PYTHONPATH \ ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} setup.py \ build --build-base=${B} install --skip-build ${SETUPTOOLS_INSTALL_ARGS} || \ bbfatal_log "'${PYTHON_PN} setup.py install ${SETUPTOOLS_INSTALL_ARGS}' execution failed." diff --git a/poky/meta/classes-recipe/systemd.bbclass b/poky/meta/classes-recipe/systemd.bbclass index f6564c2b31..f9c92e6c2a 100644 --- a/poky/meta/classes-recipe/systemd.bbclass +++ b/poky/meta/classes-recipe/systemd.bbclass @@ -205,7 +205,7 @@ python systemd_populate_packages() { systemd_check_services() } -PACKAGESPLITFUNCS:prepend = "systemd_populate_packages " +PACKAGESPLITFUNCS =+ "systemd_populate_packages" python rm_systemd_unitdir (){ import shutil diff --git a/poky/meta/classes-recipe/toolchain-scripts.bbclass b/poky/meta/classes-recipe/toolchain-scripts.bbclass index 3cc823fe63..fa658a6596 100644 --- a/poky/meta/classes-recipe/toolchain-scripts.bbclass +++ b/poky/meta/classes-recipe/toolchain-scripts.bbclass @@ -37,7 +37,7 @@ toolchain_create_sdk_env_script () { echo '# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80' >> $script echo '# http://xahlee.info/UnixResource_dir/_/ldpath.html' >> $script echo '# Only disable this check if you are absolutely know what you are doing!' >> $script - echo 'if [ ! -z "$LD_LIBRARY_PATH" ]; then' >> $script + echo 'if [ ! -z "${LD_LIBRARY_PATH:-}" ]; then' >> $script echo " echo \"Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'\"" >> $script echo " echo \"but please check why this was set in the first place and that it's safe to unset.\"" >> $script echo ' echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."' >> $script diff --git a/poky/meta/classes-recipe/uboot-sign.bbclass b/poky/meta/classes-recipe/uboot-sign.bbclass index 3dc029c429..3065c54577 100644 --- a/poky/meta/classes-recipe/uboot-sign.bbclass +++ b/poky/meta/classes-recipe/uboot-sign.bbclass @@ -149,7 +149,7 @@ deploy_dtb() { fi if [ -f "${UBOOT_NODTB_BINARY}" ]; then - install -Dm644 ${UBOOT_DTB_BINARY} ${DEPLOYDIR}/${uboot_nodtb_binary} + install -Dm644 ${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${uboot_nodtb_binary} if [ -n "${type}" ]; then ln -sf ${uboot_nodtb_binary} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE} fi @@ -407,7 +407,9 @@ do_deploy:prepend() { deploy_helper ${type} fi done + unset j done + unset i else cd ${B} deploy_helper "" diff --git a/poky/meta/classes-recipe/update-alternatives.bbclass b/poky/meta/classes-recipe/update-alternatives.bbclass index 970d9bcd45..55e0b954d6 100644 --- a/poky/meta/classes-recipe/update-alternatives.bbclass +++ b/poky/meta/classes-recipe/update-alternatives.bbclass @@ -265,7 +265,7 @@ def update_alternatives_alt_targets(d, pkg): return updates -PACKAGESPLITFUNCS:prepend = "populate_packages_updatealternatives " +PACKAGESPLITFUNCS =+ "populate_packages_updatealternatives" python populate_packages_updatealternatives () { if not update_alternatives_enabled(d): diff --git a/poky/meta/classes-recipe/update-rc.d.bbclass b/poky/meta/classes-recipe/update-rc.d.bbclass index cb2aaba57c..a19e704741 100644 --- a/poky/meta/classes-recipe/update-rc.d.bbclass +++ b/poky/meta/classes-recipe/update-rc.d.bbclass @@ -68,8 +68,8 @@ python __anonymous() { update_rc_after_parse(d) } -PACKAGESPLITFUNCS:prepend = "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'populate_packages_updatercd ', '', d)}" -PACKAGESPLITFUNCS:remove:class-nativesdk = "populate_packages_updatercd " +PACKAGESPLITFUNCS =+ "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'populate_packages_updatercd', '', d)}" +PACKAGESPLITFUNCS:remove:class-nativesdk = "populate_packages_updatercd" populate_packages_updatercd[vardeps] += "updatercd_prerm updatercd_postrm updatercd_postinst" populate_packages_updatercd[vardepsexclude] += "OVERRIDES" diff --git a/poky/meta/classes/externalsrc.bbclass b/poky/meta/classes/externalsrc.bbclass index 75fb91bcb0..0deb5dbf5f 100644 --- a/poky/meta/classes/externalsrc.bbclass +++ b/poky/meta/classes/externalsrc.bbclass @@ -230,7 +230,7 @@ def srctree_hash_files(d, srcdir=None): env['GIT_INDEX_FILE'] = tmp_index.name subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env) git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8") - if os.path.exists(".gitmodules"): + if os.path.exists(os.path.join(s_dir, ".gitmodules")): submodule_helper = subprocess.check_output(["git", "config", "--file", ".gitmodules", "--get-regexp", "path"], cwd=s_dir, env=env).decode("utf-8") for line in submodule_helper.splitlines(): module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1]) diff --git a/poky/meta/classes/rm_work.bbclass b/poky/meta/classes/rm_work.bbclass index 4121a13279..52ecfafb72 100644 --- a/poky/meta/classes/rm_work.bbclass +++ b/poky/meta/classes/rm_work.bbclass @@ -33,6 +33,13 @@ BB_SCHEDULER ?= "completion" BB_TASK_IONICE_LEVEL:task-rm_work = "3.0" do_rm_work () { + # Force using the HOSTTOOLS 'rm' - otherwise the SYSROOT_NATIVE 'rm' can be selected depending on PATH + # Avoids race-condition accessing 'rm' when deleting WORKDIR folders at the end of this function + RM_BIN="$(PATH=${HOSTTOOLS_DIR} command -v rm)" + if [ -z "${RM_BIN}" ]; then + bbfatal "Binary 'rm' not found in HOSTTOOLS_DIR, cannot remove WORKDIR data." + fi + # If the recipe name is in the RM_WORK_EXCLUDE, skip the recipe. for p in ${RM_WORK_EXCLUDE}; do if [ "$p" = "${PN}" ]; then @@ -50,55 +57,58 @@ do_rm_work () { # Change normal stamps into setscene stamps as they better reflect the # fact WORKDIR is now empty # Also leave noexec stamps since setscene stamps don't cover them - cd `dirname ${STAMP}` - for i in `basename ${STAMP}`* - do - case $i in - *sigdata*|*sigbasedata*) - # Save/skip anything that looks like a signature data file. - ;; - *do_image_complete_setscene*|*do_image_qa_setscene*) - # Ensure we don't 'stack' setscene extensions to these stamps with the sections below - ;; - *do_image_complete*) - # Promote do_image_complete stamps to setscene versions (ahead of *do_image* below) - mv $i `echo $i | sed -e "s#do_image_complete#do_image_complete_setscene#"` - ;; - *do_image_qa*) - # Promote do_image_qa stamps to setscene versions (ahead of *do_image* below) - mv $i `echo $i | sed -e "s#do_image_qa#do_image_qa_setscene#"` - ;; - *do_package_write*|*do_rootfs*|*do_image*|*do_bootimg*|*do_write_qemuboot_conf*|*do_build*) - ;; - *do_addto_recipe_sysroot*) - # Preserve recipe-sysroot-native if do_addto_recipe_sysroot has been used - excludes="$excludes recipe-sysroot-native" - ;; - *do_package|*do_package.*|*do_package_setscene.*) - # We remove do_package entirely, including any - # sstate version since otherwise we'd need to leave 'plaindirs' around - # such as 'packages' and 'packages-split' and these can be large. No end - # of chain tasks depend directly on do_package anymore. - rm -f -- $i; - ;; - *_setscene*) - # Skip stamps which are already setscene versions - ;; - *) - # For everything else: if suitable, promote the stamp to a setscene - # version, otherwise remove it - for j in ${SSTATETASKS} do_shared_workdir - do - case $i in - *$j|*$j.*) - mv $i `echo $i | sed -e "s#${j}#${j}_setscene#"` - break - ;; - esac - done - rm -f -- $i - esac - done + STAMPDIR=`dirname ${STAMP}` + if test -d $STAMPDIR; then + cd $STAMPDIR + for i in `basename ${STAMP}`* + do + case $i in + *sigdata*|*sigbasedata*) + # Save/skip anything that looks like a signature data file. + ;; + *do_image_complete_setscene*|*do_image_qa_setscene*) + # Ensure we don't 'stack' setscene extensions to these stamps with the sections below + ;; + *do_image_complete*) + # Promote do_image_complete stamps to setscene versions (ahead of *do_image* below) + mv $i `echo $i | sed -e "s#do_image_complete#do_image_complete_setscene#"` + ;; + *do_image_qa*) + # Promote do_image_qa stamps to setscene versions (ahead of *do_image* below) + mv $i `echo $i | sed -e "s#do_image_qa#do_image_qa_setscene#"` + ;; + *do_package_write*|*do_rootfs*|*do_image*|*do_bootimg*|*do_write_qemuboot_conf*|*do_build*) + ;; + *do_addto_recipe_sysroot*) + # Preserve recipe-sysroot-native if do_addto_recipe_sysroot has been used + excludes="$excludes recipe-sysroot-native" + ;; + *do_package|*do_package.*|*do_package_setscene.*) + # We remove do_package entirely, including any + # sstate version since otherwise we'd need to leave 'plaindirs' around + # such as 'packages' and 'packages-split' and these can be large. No end + # of chain tasks depend directly on do_package anymore. + "${RM_BIN}" -f -- $i; + ;; + *_setscene*) + # Skip stamps which are already setscene versions + ;; + *) + # For everything else: if suitable, promote the stamp to a setscene + # version, otherwise remove it + for j in ${SSTATETASKS} do_shared_workdir + do + case $i in + *$j|*$j.*) + mv $i `echo $i | sed -e "s#${j}#${j}_setscene#"` + break + ;; + esac + done + "${RM_BIN}" -f -- $i + esac + done + fi cd ${WORKDIR} for dir in * @@ -106,9 +116,9 @@ do_rm_work () { # Retain only logs and other files in temp, safely ignore # failures of removing pseudo folers on NFS2/3 server. if [ $dir = 'pseudo' ]; then - rm -rf -- $dir 2> /dev/null || true + "${RM_BIN}" -rf -- $dir 2> /dev/null || true elif ! echo "$excludes" | grep -q -w "$dir"; then - rm -rf -- $dir + "${RM_BIN}" -rf -- $dir fi done } @@ -180,7 +190,7 @@ python inject_rm_work() { # other recipes and thus will typically run much later than completion of # work in the recipe itself. # In practice, addtask() here merely updates the dependencies. - bb.build.addtask('do_rm_work', 'do_build', ' '.join(deps), d) + bb.build.addtask('do_rm_work', 'do_rm_work_all do_build', ' '.join(deps), d) # Always update do_build_without_rm_work dependencies. bb.build.addtask('do_build_without_rm_work', '', ' '.join(deps), d) diff --git a/poky/meta/conf/bitbake.conf b/poky/meta/conf/bitbake.conf index a1f0f624e9..05d5a844de 100644 --- a/poky/meta/conf/bitbake.conf +++ b/poky/meta/conf/bitbake.conf @@ -392,7 +392,7 @@ TCLIBC ??= "glibc" TC_CXX_RUNTIME ??= "gnu" TMPDIR ?= "${TOPDIR}/tmp" -CACHE = "${TMPDIR}/cache/${TCMODE}-${TCLIBC}${@['', '/' + str(d.getVar('MACHINE'))][bool(d.getVar('MACHINE'))]}${@['', '/' + str(d.getVar('SDKMACHINE'))][bool(d.getVar('SDKMACHINE'))]}" +CACHE = "${TMPDIR}/cache" # The persistent cache should be shared by all builds PERSISTENT_DIR = "${TOPDIR}/cache" LOG_DIR = "${TMPDIR}/log" @@ -914,8 +914,7 @@ MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode" COMBINED_FEATURES = "${@oe.utils.set_intersect('DISTRO_FEATURES', 'MACHINE_FEATURES', d)}" COMBINED_FEATURES[vardeps] += "DISTRO_FEATURES MACHINE_FEATURES" -SERIAL_CONSOLE ??= "" -SERIAL_CONSOLES ??= "${@d.getVar('SERIAL_CONSOLE').replace(' ', ';')}" +SERIAL_CONSOLES ??= "" NO_RECOMMENDATIONS ??= "" BAD_RECOMMENDATIONS ?= "" @@ -969,3 +968,9 @@ MULTILIB_VARIANTS ??= "" # what it would be anyway if the signature generator (e.g. OEEquivHash) doesn't # support unihashes. BB_UNIHASH ?= "${BB_TASKHASH}" + +oe.sstatesig.find_sstate_manifest[vardepsexclude] = "BBEXTENDCURR BBEXTENDVARIANT OVERRIDES PACKAGE_EXTRA_ARCHS" +oe.utils.get_multilib_datastore[vardepsexclude] = "DEFAULTTUNE_MULTILIB_ORIGINAL OVERRIDES" +oe.path.format_display[vardepsexclude] = "TOPDIR" +oe.utils.multiprocess_launch[vardepsexclude] = "BB_NUMBER_THREADS" +oe.packagedata.emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS" diff --git a/poky/meta/conf/distro/include/default-distrovars.inc b/poky/meta/conf/distro/include/default-distrovars.inc index abf48f79f0..d05390d3cc 100644 --- a/poky/meta/conf/distro/include/default-distrovars.inc +++ b/poky/meta/conf/distro/include/default-distrovars.inc @@ -4,7 +4,10 @@ OEINCLUDELOGS ?= "yes" KERNEL_CONSOLE ?= "ttyS0" KEEPUIMAGE ??= "yes" -IMAGE_LINGUAS ?= "en-us en-gb" +DEFAULT_IMAGE_LINGUAS = "en-us en-gb" +DEFAULT_IMAGE_LINGUAS:libc-glibc = "c en-us en-gb" +IMAGE_LINGUAS ?= "${DEFAULT_IMAGE_LINGUAS}" + ENABLE_BINARY_LOCALE_GENERATION ?= "1" LOCALE_UTF8_ONLY ?= "0" LOCALE_UTF8_IS_DEFAULT ?= "1" diff --git a/poky/meta/conf/distro/include/default-providers.inc b/poky/meta/conf/distro/include/default-providers.inc index 6defdca12d..3a4e989c1f 100644 --- a/poky/meta/conf/distro/include/default-providers.inc +++ b/poky/meta/conf/distro/include/default-providers.inc @@ -5,6 +5,7 @@ PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg" PREFERRED_PROVIDER_virtual/xserver-xf86 ?= "xserver-xorg" PREFERRED_PROVIDER_virtual/egl ?= "mesa" PREFERRED_PROVIDER_virtual/libgl ?= "mesa" +PREFERRED_PROVIDER_virtual/libglx ?= "mesa" PREFERRED_PROVIDER_virtual/libgl-native ?= "mesa-native" PREFERRED_PROVIDER_virtual/nativesdk-libgl ?= "nativesdk-mesa" PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa" diff --git a/poky/meta/conf/distro/include/maintainers.inc b/poky/meta/conf/distro/include/maintainers.inc index 5b7ce77c3c..8c2201c91b 100644 --- a/poky/meta/conf/distro/include/maintainers.inc +++ b/poky/meta/conf/distro/include/maintainers.inc @@ -46,9 +46,7 @@ RECIPE_MAINTAINER:pn-argp-standalone = "Khem Raj " RECIPE_MAINTAINER:pn-asciidoc = "Yi Zhao " RECIPE_MAINTAINER:pn-aspell = "Anuj Mittal " RECIPE_MAINTAINER:pn-at = "Chen Qi " -RECIPE_MAINTAINER:pn-at-spi2-atk = "Tim Orling " RECIPE_MAINTAINER:pn-at-spi2-core = "Tim Orling " -RECIPE_MAINTAINER:pn-atk = "Tim Orling " RECIPE_MAINTAINER:pn-attr = "Chen Qi " RECIPE_MAINTAINER:pn-autoconf = "Robert Yang " RECIPE_MAINTAINER:pn-autoconf-archive = "Robert Yang " @@ -56,6 +54,7 @@ RECIPE_MAINTAINER:pn-automake = "Robert Yang " RECIPE_MAINTAINER:pn-avahi = "Yi Zhao " RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin " RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin " +RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez " RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal " RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal " RECIPE_MAINTAINER:pn-bash = "Hongxu Jia " @@ -190,6 +189,7 @@ RECIPE_MAINTAINER:pn-gcc-runtime = "Khem Raj " RECIPE_MAINTAINER:pn-gcc-sanitizers = "Khem Raj " RECIPE_MAINTAINER:pn-gcc-source-12.2.0 = "Khem Raj " RECIPE_MAINTAINER:pn-gconf = "Ross Burton " +RECIPE_MAINTAINER:pn-gcr3 = "Markus Volk " RECIPE_MAINTAINER:pn-gcr = "Alexander Kanavin " RECIPE_MAINTAINER:pn-gdb = "Khem Raj " RECIPE_MAINTAINER:pn-gdb-cross-${TARGET_ARCH} = "Khem Raj " @@ -231,6 +231,7 @@ RECIPE_MAINTAINER:pn-gperf = "Alexander Kanavin " RECIPE_MAINTAINER:pn-gpgme = "Hongxu Jia " RECIPE_MAINTAINER:pn-gptfdisk = "Alexander Kanavin " RECIPE_MAINTAINER:pn-gcompat = "Khem Raj " +RECIPE_MAINTAINER:pn-graphene = "Markus Volk " RECIPE_MAINTAINER:pn-grep = "Denys Dmytriyenko " RECIPE_MAINTAINER:pn-groff = "Hongxu Jia " RECIPE_MAINTAINER:pn-grub = "Anuj Mittal " @@ -251,6 +252,7 @@ RECIPE_MAINTAINER:pn-gstreamer1.0-python = "Anuj Mittal " RECIPE_MAINTAINER:pn-gstreamer1.0-rtsp-server = "Anuj Mittal " RECIPE_MAINTAINER:pn-gstreamer1.0-vaapi = "Anuj Mittal " RECIPE_MAINTAINER:pn-gtk+3 = "Ross Burton " +RECIPE_MAINTAINER:pn-gtk4 = "Markus Volk " RECIPE_MAINTAINER:pn-gtk-doc = "Alexander Kanavin " RECIPE_MAINTAINER:pn-gzip = "Denys Dmytriyenko " RECIPE_MAINTAINER:pn-harfbuzz = "Anuj Mittal " @@ -370,6 +372,7 @@ RECIPE_MAINTAINER:pn-libpcre = "Yi Zhao " RECIPE_MAINTAINER:pn-libpcre2 = "Unassigned " RECIPE_MAINTAINER:pn-libpipeline = "Wang Mingyu " RECIPE_MAINTAINER:pn-libpng = "Anuj Mittal " +RECIPE_MAINTAINER:pn-libportal = "Alexander Kanavin " RECIPE_MAINTAINER:pn-libproxy = "Anuj Mittal " RECIPE_MAINTAINER:pn-libpthread-stubs = "Alexander Kanavin " RECIPE_MAINTAINER:pn-libptytty = "Alexander Kanavin " @@ -381,6 +384,7 @@ RECIPE_MAINTAINER:pn-libsamplerate0 = "Unassigned " RECIPE_MAINTAINER:pn-libsdl2 = "Yi Zhao " RECIPE_MAINTAINER:pn-libseccomp = "Unassigned " RECIPE_MAINTAINER:pn-libsecret = "Alexander Kanavin " +RECIPE_MAINTAINER:pn-libslirp = "Unassigned " RECIPE_MAINTAINER:pn-libsm = "Unassigned " RECIPE_MAINTAINER:pn-libsndfile1 = "Unassigned " RECIPE_MAINTAINER:pn-libsolv = "Anuj Mittal " @@ -389,13 +393,16 @@ RECIPE_MAINTAINER:pn-libsoup-2.4 = "Anuj Mittal " RECIPE_MAINTAINER:pn-libssh2 = "Unassigned " RECIPE_MAINTAINER:pn-libssp-nonshared = "Khem Raj " RECIPE_MAINTAINER:pn-libtasn1 = "Anuj Mittal " +RECIPE_MAINTAINER:pn-libtest-fatal-perl = "Tim Orling " RECIPE_MAINTAINER:pn-libtest-needs-perl = "Tim Orling " +RECIPE_MAINTAINER:pn-libtest-warnings-perl = "Tim Orling " RECIPE_MAINTAINER:pn-libtheora = "Alexander Kanavin " RECIPE_MAINTAINER:pn-libtimedate-perl = "Tim Orling " RECIPE_MAINTAINER:pn-libtirpc = "Anuj Mittal " RECIPE_MAINTAINER:pn-libtool = "Robert Yang " RECIPE_MAINTAINER:pn-libtool-cross = "Robert Yang " RECIPE_MAINTAINER:pn-libtool-native = "Robert Yang " +RECIPE_MAINTAINER:pn-libtry-tiny-perl = "Tim Orling " RECIPE_MAINTAINER:pn-libucontext = "Khem Raj " RECIPE_MAINTAINER:pn-libunistring = "Anuj Mittal " RECIPE_MAINTAINER:pn-libunwind = "Bruce Ashfield " @@ -685,7 +692,6 @@ RECIPE_MAINTAINER:pn-python3-sphinxcontrib-serializinghtml = "Tim Orling + # link + # + # __str__ can be used to print out an entry in the input format + # + # if fs_perms_entry.path is None: + # an error occurred + # if fs_perms_entry.link, you can retrieve: + # fs_perms_entry.path = path + # fs_perms_entry.link = target of link + # if not fs_perms_entry.link, you can retrieve: + # fs_perms_entry.path = path + # fs_perms_entry.mode = expected dir mode or None + # fs_perms_entry.uid = expected uid or -1 + # fs_perms_entry.gid = expected gid or -1 + # fs_perms_entry.walk = 'true' or something else + # fs_perms_entry.fmode = expected file mode or None + # fs_perms_entry.fuid = expected file uid or -1 + # fs_perms_entry_fgid = expected file gid or -1 + class fs_perms_entry(): + def __init__(self, line): + lsplit = line.split() + if len(lsplit) == 3 and lsplit[1].lower() == "link": + self._setlink(lsplit[0], lsplit[2]) + elif len(lsplit) == 8: + self._setdir(lsplit[0], lsplit[1], lsplit[2], lsplit[3], lsplit[4], lsplit[5], lsplit[6], lsplit[7]) + else: + msg = "Fixup Perms: invalid config line %s" % line + oe.qa.handle_error("perm-config", msg, d) + self.path = None + self.link = None + + def _setdir(self, path, mode, uid, gid, walk, fmode, fuid, fgid): + self.path = os.path.normpath(path) + self.link = None + self.mode = self._procmode(mode) + self.uid = self._procuid(uid) + self.gid = self._procgid(gid) + self.walk = walk.lower() + self.fmode = self._procmode(fmode) + self.fuid = self._procuid(fuid) + self.fgid = self._procgid(fgid) + + def _setlink(self, path, link): + self.path = os.path.normpath(path) + self.link = link + + def _procmode(self, mode): + if not mode or (mode and mode == "-"): + return None + else: + return int(mode,8) + + # Note uid/gid -1 has special significance in os.lchown + def _procuid(self, uid): + if uid is None or uid == "-": + return -1 + elif uid.isdigit(): + return int(uid) + else: + return pwd.getpwnam(uid).pw_uid + + def _procgid(self, gid): + if gid is None or gid == "-": + return -1 + elif gid.isdigit(): + return int(gid) + else: + return grp.getgrnam(gid).gr_gid + + # Use for debugging the entries + def __str__(self): + if self.link: + return "%s link %s" % (self.path, self.link) + else: + mode = "-" + if self.mode: + mode = "0%o" % self.mode + fmode = "-" + if self.fmode: + fmode = "0%o" % self.fmode + uid = self._mapugid(self.uid) + gid = self._mapugid(self.gid) + fuid = self._mapugid(self.fuid) + fgid = self._mapugid(self.fgid) + return "%s %s %s %s %s %s %s %s" % (self.path, mode, uid, gid, self.walk, fmode, fuid, fgid) + + def _mapugid(self, id): + if id is None or id == -1: + return "-" + else: + return "%d" % id + + # Fix the permission, owner and group of path + def fix_perms(path, mode, uid, gid, dir): + if mode and not os.path.islink(path): + #bb.note("Fixup Perms: chmod 0%o %s" % (mode, dir)) + os.chmod(path, mode) + # -1 is a special value that means don't change the uid/gid + # if they are BOTH -1, don't bother to lchown + if not (uid == -1 and gid == -1): + #bb.note("Fixup Perms: lchown %d:%d %s" % (uid, gid, dir)) + os.lchown(path, uid, gid) + + # Return a list of configuration files based on either the default + # files/fs-perms.txt or the contents of FILESYSTEM_PERMS_TABLES + # paths are resolved via BBPATH + def get_fs_perms_list(d): + str = "" + bbpath = d.getVar('BBPATH') + fs_perms_tables = d.getVar('FILESYSTEM_PERMS_TABLES') or "" + for conf_file in fs_perms_tables.split(): + confpath = bb.utils.which(bbpath, conf_file) + if confpath: + str += " %s" % bb.utils.which(bbpath, conf_file) + else: + bb.warn("cannot find %s specified in FILESYSTEM_PERMS_TABLES" % conf_file) + return str + + fs_perms_table = {} + fs_link_table = {} + + # By default all of the standard directories specified in + # bitbake.conf will get 0755 root:root. + target_path_vars = [ 'base_prefix', + 'prefix', + 'exec_prefix', + 'base_bindir', + 'base_sbindir', + 'base_libdir', + 'datadir', + 'sysconfdir', + 'servicedir', + 'sharedstatedir', + 'localstatedir', + 'infodir', + 'mandir', + 'docdir', + 'bindir', + 'sbindir', + 'libexecdir', + 'libdir', + 'includedir', + 'oldincludedir' ] + + for path in target_path_vars: + dir = d.getVar(path) or "" + if dir == "": + continue + fs_perms_table[dir] = fs_perms_entry(d.expand("%s 0755 root root false - - -" % (dir))) + + # Now we actually load from the configuration files + for conf in get_fs_perms_list(d).split(): + if not os.path.exists(conf): + continue + with open(conf) as f: + for line in f: + if line.startswith('#'): + continue + lsplit = line.split() + if len(lsplit) == 0: + continue + if len(lsplit) != 8 and not (len(lsplit) == 3 and lsplit[1].lower() == "link"): + msg = "Fixup perms: %s invalid line: %s" % (conf, line) + oe.qa.handle_error("perm-line", msg, d) + continue + entry = fs_perms_entry(d.expand(line)) + if entry and entry.path: + if entry.link: + fs_link_table[entry.path] = entry + if entry.path in fs_perms_table: + fs_perms_table.pop(entry.path) + else: + fs_perms_table[entry.path] = entry + if entry.path in fs_link_table: + fs_link_table.pop(entry.path) + + # Debug -- list out in-memory table + #for dir in fs_perms_table: + # bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir]))) + #for link in fs_link_table: + # bb.note("Fixup Perms: %s: %s" % (link, str(fs_link_table[link]))) + + # We process links first, so we can go back and fixup directory ownership + # for any newly created directories + # Process in sorted order so /run gets created before /run/lock, etc. + for entry in sorted(fs_link_table.values(), key=lambda x: x.link): + link = entry.link + dir = entry.path + origin = dvar + dir + if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)): + continue + + if link[0] == "/": + target = dvar + link + ptarget = link + else: + target = os.path.join(os.path.dirname(origin), link) + ptarget = os.path.join(os.path.dirname(dir), link) + if os.path.exists(target): + msg = "Fixup Perms: Unable to correct directory link, target already exists: %s -> %s" % (dir, ptarget) + oe.qa.handle_error("perm-link", msg, d) + continue + + # Create path to move directory to, move it, and then setup the symlink + bb.utils.mkdirhier(os.path.dirname(target)) + #bb.note("Fixup Perms: Rename %s -> %s" % (dir, ptarget)) + bb.utils.rename(origin, target) + #bb.note("Fixup Perms: Link %s -> %s" % (dir, link)) + os.symlink(link, origin) + + for dir in fs_perms_table: + origin = dvar + dir + if not (cpath.exists(origin) and cpath.isdir(origin)): + continue + + fix_perms(origin, fs_perms_table[dir].mode, fs_perms_table[dir].uid, fs_perms_table[dir].gid, dir) + + if fs_perms_table[dir].walk == 'true': + for root, dirs, files in os.walk(origin): + for dr in dirs: + each_dir = os.path.join(root, dr) + fix_perms(each_dir, fs_perms_table[dir].mode, fs_perms_table[dir].uid, fs_perms_table[dir].gid, dir) + for f in files: + each_file = os.path.join(root, f) + fix_perms(each_file, fs_perms_table[dir].fmode, fs_perms_table[dir].fuid, fs_perms_table[dir].fgid, dir) + +# Get a list of files from file vars by searching files under current working directory +# The list contains symlinks, directories and normal files. +def files_from_filevars(filevars): + cpath = oe.cachedpath.CachedPath() + files = [] + for f in filevars: + if os.path.isabs(f): + f = '.' + f + if not f.startswith("./"): + f = './' + f + globbed = glob.glob(f) + if globbed: + if [ f ] != globbed: + files += globbed + continue + files.append(f) + + symlink_paths = [] + for ind, f in enumerate(files): + # Handle directory symlinks. Truncate path to the lowest level symlink + parent = '' + for dirname in f.split('/')[:-1]: + parent = os.path.join(parent, dirname) + if dirname == '.': + continue + if cpath.islink(parent): + bb.warn("FILES contains file '%s' which resides under a " + "directory symlink. Please fix the recipe and use the " + "real path for the file." % f[1:]) + symlink_paths.append(f) + files[ind] = parent + f = parent + break + + if not cpath.islink(f): + if cpath.isdir(f): + newfiles = [ os.path.join(f,x) for x in os.listdir(f) ] + if newfiles: + files += newfiles + + return files, symlink_paths + +# Called in package_.bbclass to get the correct list of configuration files +def get_conffiles(pkg, d): + pkgdest = d.getVar('PKGDEST') + root = os.path.join(pkgdest, pkg) + cwd = os.getcwd() + os.chdir(root) + + conffiles = d.getVar('CONFFILES:%s' % pkg); + if conffiles == None: + conffiles = d.getVar('CONFFILES') + if conffiles == None: + conffiles = "" + conffiles = conffiles.split() + conf_orig_list = files_from_filevars(conffiles)[0] + + # Remove links and directories from conf_orig_list to get conf_list which only contains normal files + conf_list = [] + for f in conf_orig_list: + if os.path.isdir(f): + continue + if os.path.islink(f): + continue + if not os.path.exists(f): + continue + conf_list.append(f) + + # Remove the leading './' + for i in range(0, len(conf_list)): + conf_list[i] = conf_list[i][1:] + + os.chdir(cwd) + return conf_list + +def legitimize_package_name(s): + """ + Make sure package names are legitimate strings + """ + + def fixutf(m): + cp = m.group(1) + if cp: + return ('\\u%s' % cp).encode('latin-1').decode('unicode_escape') + + # Handle unicode codepoints encoded as , as in glibc locale files. + s = re.sub(r'', fixutf, s) + + # Remaining package name validity fixes + return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-') + +def split_locales(d): + cpath = oe.cachedpath.CachedPath() + if (d.getVar('PACKAGE_NO_LOCALE') == '1'): + bb.debug(1, "package requested not splitting locales") + return + + packages = (d.getVar('PACKAGES') or "").split() + + datadir = d.getVar('datadir') + if not datadir: + bb.note("datadir not defined") + return + + dvar = d.getVar('PKGD') + pn = d.getVar('LOCALEBASEPN') + + if pn + '-locale' in packages: + packages.remove(pn + '-locale') + + localedir = os.path.join(dvar + datadir, 'locale') + + if not cpath.isdir(localedir): + bb.debug(1, "No locale files in this package") + return + + locales = os.listdir(localedir) + + summary = d.getVar('SUMMARY') or pn + description = d.getVar('DESCRIPTION') or "" + locale_section = d.getVar('LOCALE_SECTION') + mlprefix = d.getVar('MLPREFIX') or "" + for l in sorted(locales): + ln = legitimize_package_name(l) + pkg = pn + '-locale-' + ln + packages.append(pkg) + d.setVar('FILES:' + pkg, os.path.join(datadir, 'locale', l)) + d.setVar('RRECOMMENDS:' + pkg, '%svirtual-locale-%s' % (mlprefix, ln)) + d.setVar('RPROVIDES:' + pkg, '%s-locale %s%s-translation' % (pn, mlprefix, ln)) + d.setVar('SUMMARY:' + pkg, '%s - %s translations' % (summary, l)) + d.setVar('DESCRIPTION:' + pkg, '%s This package contains language translation files for the %s locale.' % (description, l)) + if locale_section: + d.setVar('SECTION:' + pkg, locale_section) + + d.setVar('PACKAGES', ' '.join(packages)) + + # Disabled by RP 18/06/07 + # Wildcards aren't supported in debian + # They break with ipkg since glibc-locale* will mean that + # glibc-localedata-translit* won't install as a dependency + # for some other package which breaks meta-toolchain + # Probably breaks since virtual-locale- isn't provided anywhere + #rdep = (d.getVar('RDEPENDS:%s' % pn) or "").split() + #rdep.append('%s-locale*' % pn) + #d.setVar('RDEPENDS:%s' % pn, ' '.join(rdep)) + +def package_debug_vars(d): + # We default to '.debug' style + if d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-file-directory': + # Single debug-file-directory style debug info + debug_vars = { + "append": ".debug", + "staticappend": "", + "dir": "", + "staticdir": "", + "libdir": "/usr/lib/debug", + "staticlibdir": "/usr/lib/debug-static", + "srcdir": "/usr/src/debug", + } + elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-without-src': + # Original OE-core, a.k.a. ".debug", style debug info, but without sources in /usr/src/debug + debug_vars = { + "append": "", + "staticappend": "", + "dir": "/.debug", + "staticdir": "/.debug-static", + "libdir": "", + "staticlibdir": "", + "srcdir": "", + } + elif d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg': + debug_vars = { + "append": "", + "staticappend": "", + "dir": "/.debug", + "staticdir": "/.debug-static", + "libdir": "", + "staticlibdir": "", + "srcdir": "/usr/src/debug", + } + else: + # Original OE-core, a.k.a. ".debug", style debug info + debug_vars = { + "append": "", + "staticappend": "", + "dir": "/.debug", + "staticdir": "/.debug-static", + "libdir": "", + "staticlibdir": "", + "srcdir": "/usr/src/debug", + } + + return debug_vars + + +def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output): + debugfiles = {} + + for line in dwarfsrcfiles_output.splitlines(): + if line.startswith("\t"): + debugfiles[os.path.normpath(line.split()[0])] = "" + + return debugfiles.keys() + +def source_info(file, d, fatal=True): + cmd = ["dwarfsrcfiles", file] + try: + output = subprocess.check_output(cmd, universal_newlines=True, stderr=subprocess.STDOUT) + retval = 0 + except subprocess.CalledProcessError as exc: + output = exc.output + retval = exc.returncode + + # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure + if retval != 0 and retval != 255: + msg = "dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else "") + if fatal: + bb.fatal(msg) + bb.note(msg) + + debugsources = parse_debugsources_from_dwarfsrcfiles_output(output) + + return list(debugsources) + +def splitdebuginfo(file, dvar, dv, d): + # Function to split a single file into two components, one is the stripped + # target system binary, the other contains any debugging information. The + # two files are linked to reference each other. + # + # return a mapping of files:debugsources + + src = file[len(dvar):] + dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"] + debugfile = dvar + dest + sources = [] + + if file.endswith(".ko") and file.find("/lib/modules/") != -1: + if oe.package.is_kernel_module_signed(file): + bb.debug(1, "Skip strip on signed module %s" % file) + return (file, sources) + + # Split the file... + bb.utils.mkdirhier(os.path.dirname(debugfile)) + #bb.note("Split %s -> %s" % (file, debugfile)) + # Only store off the hard link reference if we successfully split! + + dvar = d.getVar('PKGD') + objcopy = d.getVar("OBJCOPY") + + newmode = None + if not os.access(file, os.W_OK) or os.access(file, os.R_OK): + origmode = os.stat(file)[stat.ST_MODE] + newmode = origmode | stat.S_IWRITE | stat.S_IREAD + os.chmod(file, newmode) + + # We need to extract the debug src information here... + if dv["srcdir"]: + sources = source_info(file, d) + + bb.utils.mkdirhier(os.path.dirname(debugfile)) + + subprocess.check_output([objcopy, '--only-keep-debug', file, debugfile], stderr=subprocess.STDOUT) + + # Set the debuglink to have the view of the file path on the target + subprocess.check_output([objcopy, '--add-gnu-debuglink', debugfile, file], stderr=subprocess.STDOUT) + + if newmode: + os.chmod(file, origmode) + + return (file, sources) + +def splitstaticdebuginfo(file, dvar, dv, d): + # Unlike the function above, there is no way to split a static library + # two components. So to get similar results we will copy the unmodified + # static library (containing the debug symbols) into a new directory. + # We will then strip (preserving symbols) the static library in the + # typical location. + # + # return a mapping of files:debugsources + + src = file[len(dvar):] + dest = dv["staticlibdir"] + os.path.dirname(src) + dv["staticdir"] + "/" + os.path.basename(src) + dv["staticappend"] + debugfile = dvar + dest + sources = [] + + # Copy the file... + bb.utils.mkdirhier(os.path.dirname(debugfile)) + #bb.note("Copy %s -> %s" % (file, debugfile)) + + dvar = d.getVar('PKGD') + + newmode = None + if not os.access(file, os.W_OK) or os.access(file, os.R_OK): + origmode = os.stat(file)[stat.ST_MODE] + newmode = origmode | stat.S_IWRITE | stat.S_IREAD + os.chmod(file, newmode) + + # We need to extract the debug src information here... + if dv["srcdir"]: + sources = source_info(file, d) + + bb.utils.mkdirhier(os.path.dirname(debugfile)) + + # Copy the unmodified item to the debug directory + shutil.copy2(file, debugfile) + + if newmode: + os.chmod(file, origmode) + + return (file, sources) + +def inject_minidebuginfo(file, dvar, dv, d): + # Extract just the symbols from debuginfo into minidebuginfo, + # compress it with xz and inject it back into the binary in a .gnu_debugdata section. + # https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html + + readelf = d.getVar('READELF') + nm = d.getVar('NM') + objcopy = d.getVar('OBJCOPY') + + minidebuginfodir = d.expand('${WORKDIR}/minidebuginfo') + + src = file[len(dvar):] + dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"] + debugfile = dvar + dest + minidebugfile = minidebuginfodir + src + '.minidebug' + bb.utils.mkdirhier(os.path.dirname(minidebugfile)) + + # If we didn't produce debuginfo for any reason, we can't produce minidebuginfo either + # so skip it. + if not os.path.exists(debugfile): + bb.debug(1, 'ELF file {} has no debuginfo, skipping minidebuginfo injection'.format(file)) + return + + # minidebuginfo does not make sense to apply to ELF objects other than + # executables and shared libraries, skip applying the minidebuginfo + # generation for objects like kernel modules. + for line in subprocess.check_output([readelf, '-h', debugfile], universal_newlines=True).splitlines(): + if not line.strip().startswith("Type:"): + continue + elftype = line.split(":")[1].strip() + if not any(elftype.startswith(i) for i in ["EXEC", "DYN"]): + bb.debug(1, 'ELF file {} is not executable/shared, skipping minidebuginfo injection'.format(file)) + return + break + + # Find non-allocated PROGBITS, NOTE, and NOBITS sections in the debuginfo. + # We will exclude all of these from minidebuginfo to save space. + remove_section_names = [] + for line in subprocess.check_output([readelf, '-W', '-S', debugfile], universal_newlines=True).splitlines(): + # strip the leading " [ 1]" section index to allow splitting on space + if ']' not in line: + continue + fields = line[line.index(']') + 1:].split() + if len(fields) < 7: + continue + name = fields[0] + type = fields[1] + flags = fields[6] + # .debug_ sections will be removed by objcopy -S so no need to explicitly remove them + if name.startswith('.debug_'): + continue + if 'A' not in flags and type in ['PROGBITS', 'NOTE', 'NOBITS']: + remove_section_names.append(name) + + # List dynamic symbols in the binary. We can exclude these from minidebuginfo + # because they are always present in the binary. + dynsyms = set() + for line in subprocess.check_output([nm, '-D', file, '--format=posix', '--defined-only'], universal_newlines=True).splitlines(): + dynsyms.add(line.split()[0]) + + # Find all function symbols from debuginfo which aren't in the dynamic symbols table. + # These are the ones we want to keep in minidebuginfo. + keep_symbols_file = minidebugfile + '.symlist' + found_any_symbols = False + with open(keep_symbols_file, 'w') as f: + for line in subprocess.check_output([nm, debugfile, '--format=sysv', '--defined-only'], universal_newlines=True).splitlines(): + fields = line.split('|') + if len(fields) < 7: + continue + name = fields[0].strip() + type = fields[3].strip() + if type == 'FUNC' and name not in dynsyms: + f.write('{}\n'.format(name)) + found_any_symbols = True + + if not found_any_symbols: + bb.debug(1, 'ELF file {} contains no symbols, skipping minidebuginfo injection'.format(file)) + return + + bb.utils.remove(minidebugfile) + bb.utils.remove(minidebugfile + '.xz') + + subprocess.check_call([objcopy, '-S'] + + ['--remove-section={}'.format(s) for s in remove_section_names] + + ['--keep-symbols={}'.format(keep_symbols_file), debugfile, minidebugfile]) + + subprocess.check_call(['xz', '--keep', minidebugfile]) + + subprocess.check_call([objcopy, '--add-section', '.gnu_debugdata={}.xz'.format(minidebugfile), file]) + +def copydebugsources(debugsrcdir, sources, d): + # The debug src information written out to sourcefile is further processed + # and copied to the destination here. + + cpath = oe.cachedpath.CachedPath() + + if debugsrcdir and sources: + sourcefile = d.expand("${WORKDIR}/debugsources.list") + bb.utils.remove(sourcefile) + + # filenames are null-separated - this is an artefact of the previous use + # of rpm's debugedit, which was writing them out that way, and the code elsewhere + # is still assuming that. + debuglistoutput = '\0'.join(sources) + '\0' + with open(sourcefile, 'a') as sf: + sf.write(debuglistoutput) + + dvar = d.getVar('PKGD') + strip = d.getVar("STRIP") + objcopy = d.getVar("OBJCOPY") + workdir = d.getVar("WORKDIR") + sdir = d.getVar("S") + cflags = d.expand("${CFLAGS}") + + prefixmap = {} + for flag in cflags.split(): + if not flag.startswith("-fdebug-prefix-map"): + continue + if "recipe-sysroot" in flag: + continue + flag = flag.split("=") + prefixmap[flag[1]] = flag[2] + + nosuchdir = [] + basepath = dvar + for p in debugsrcdir.split("/"): + basepath = basepath + "/" + p + if not cpath.exists(basepath): + nosuchdir.append(basepath) + bb.utils.mkdirhier(basepath) + cpath.updatecache(basepath) + + for pmap in prefixmap: + # Ignore files from the recipe sysroots (target and native) + cmd = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((|)$|/.*recipe-sysroot.*/)' | " % sourcefile + # We need to ignore files that are not actually ours + # we do this by only paying attention to items from this package + cmd += "fgrep -zw '%s' | " % prefixmap[pmap] + # Remove prefix in the source paths + cmd += "sed 's#%s/##g' | " % (prefixmap[pmap]) + cmd += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)" % (pmap, dvar, prefixmap[pmap]) + + try: + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + # Can "fail" if internal headers/transient sources are attempted + pass + # cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced. + # Work around this by manually finding and copying any symbolic links that made it through. + cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s')" % \ + (dvar, prefixmap[pmap], dvar, prefixmap[pmap], pmap, dvar, prefixmap[pmap]) + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + + # debugsources.list may be polluted from the host if we used externalsrc, + # cpio uses copy-pass and may have just created a directory structure + # matching the one from the host, if thats the case move those files to + # debugsrcdir to avoid host contamination. + # Empty dir structure will be deleted in the next step. + + # Same check as above for externalsrc + if workdir not in sdir: + if os.path.exists(dvar + debugsrcdir + sdir): + cmd = "mv %s%s%s/* %s%s" % (dvar, debugsrcdir, sdir, dvar,debugsrcdir) + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + + # The copy by cpio may have resulted in some empty directories! Remove these + cmd = "find %s%s -empty -type d -delete" % (dvar, debugsrcdir) + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + + # Also remove debugsrcdir if its empty + for p in nosuchdir[::-1]: + if os.path.exists(p) and not os.listdir(p): + os.rmdir(p) + + +def process_split_and_strip_files(d): + cpath = oe.cachedpath.CachedPath() + + dvar = d.getVar('PKGD') + pn = d.getVar('PN') + hostos = d.getVar('HOST_OS') + + oldcwd = os.getcwd() + os.chdir(dvar) + + dv = package_debug_vars(d) + + # + # First lets figure out all of the files we may have to process ... do this only once! + # + elffiles = {} + symlinks = {} + staticlibs = [] + inodes = {} + libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir")) + baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir")) + skipfiles = (d.getVar("INHIBIT_PACKAGE_STRIP_FILES") or "").split() + if (d.getVar('INHIBIT_PACKAGE_STRIP') != '1' or \ + d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'): + checkelf = {} + checkelflinks = {} + for root, dirs, files in cpath.walk(dvar): + for f in files: + file = os.path.join(root, f) + + # Skip debug files + if dv["append"] and file.endswith(dv["append"]): + continue + if dv["dir"] and dv["dir"] in os.path.dirname(file[len(dvar):]): + continue + + if file in skipfiles: + continue + + if oe.package.is_static_lib(file): + staticlibs.append(file) + continue + + try: + ltarget = cpath.realpath(file, dvar, False) + s = cpath.lstat(ltarget) + except OSError as e: + (err, strerror) = e.args + if err != errno.ENOENT: + raise + # Skip broken symlinks + continue + if not s: + continue + # Check its an executable + if (s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) \ + or (s[stat.ST_MODE] & stat.S_IXOTH) \ + or ((file.startswith(libdir) or file.startswith(baselibdir)) \ + and (".so" in f or ".node" in f)) \ + or (f.startswith('vmlinux') or ".ko" in f): + + if cpath.islink(file): + checkelflinks[file] = ltarget + continue + # Use a reference of device ID and inode number to identify files + file_reference = "%d_%d" % (s.st_dev, s.st_ino) + checkelf[file] = (file, file_reference) + + results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelflinks.values(), d) + results_map = {} + for (ltarget, elf_file) in results: + results_map[ltarget] = elf_file + for file in checkelflinks: + ltarget = checkelflinks[file] + # If it's a symlink, and points to an ELF file, we capture the readlink target + if results_map[ltarget]: + target = os.readlink(file) + #bb.note("Sym: %s (%d)" % (ltarget, results_map[ltarget])) + symlinks[file] = target + + results = oe.utils.multiprocess_launch(oe.package.is_elf, checkelf.keys(), d) + + # Sort results by file path. This ensures that the files are always + # processed in the same order, which is important to make sure builds + # are reproducible when dealing with hardlinks + results.sort(key=lambda x: x[0]) + + for (file, elf_file) in results: + # It's a file (or hardlink), not a link + # ...but is it ELF, and is it already stripped? + if elf_file & 1: + if elf_file & 2: + if 'already-stripped' in (d.getVar('INSANE_SKIP:' + pn) or "").split(): + bb.note("Skipping file %s from %s for already-stripped QA test" % (file[len(dvar):], pn)) + else: + msg = "File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dvar):], pn) + oe.qa.handle_error("already-stripped", msg, d) + continue + + # At this point we have an unstripped elf file. We need to: + # a) Make sure any file we strip is not hardlinked to anything else outside this tree + # b) Only strip any hardlinked file once (no races) + # c) Track any hardlinks between files so that we can reconstruct matching debug file hardlinks + + # Use a reference of device ID and inode number to identify files + file_reference = checkelf[file][1] + if file_reference in inodes: + os.unlink(file) + os.link(inodes[file_reference][0], file) + inodes[file_reference].append(file) + else: + inodes[file_reference] = [file] + # break hardlink + bb.utils.break_hardlinks(file) + elffiles[file] = elf_file + # Modified the file so clear the cache + cpath.updatecache(file) + + def strip_pkgd_prefix(f): + nonlocal dvar + + if f.startswith(dvar): + return f[len(dvar):] + + return f + + # + # First lets process debug splitting + # + if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT') != '1'): + results = oe.utils.multiprocess_launch(splitdebuginfo, list(elffiles), d, extraargs=(dvar, dv, d)) + + if dv["srcdir"] and not hostos.startswith("mingw"): + if (d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'): + results = oe.utils.multiprocess_launch(splitstaticdebuginfo, staticlibs, d, extraargs=(dvar, dv, d)) + else: + for file in staticlibs: + results.append( (file,source_info(file, d)) ) + + d.setVar("PKGDEBUGSOURCES", {strip_pkgd_prefix(f): sorted(s) for f, s in results}) + + sources = set() + for r in results: + sources.update(r[1]) + + # Hardlink our debug symbols to the other hardlink copies + for ref in inodes: + if len(inodes[ref]) == 1: + continue + + target = inodes[ref][0][len(dvar):] + for file in inodes[ref][1:]: + src = file[len(dvar):] + dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(target) + dv["append"] + fpath = dvar + dest + ftarget = dvar + dv["libdir"] + os.path.dirname(target) + dv["dir"] + "/" + os.path.basename(target) + dv["append"] + bb.utils.mkdirhier(os.path.dirname(fpath)) + # Only one hardlink of separated debug info file in each directory + if not os.access(fpath, os.R_OK): + #bb.note("Link %s -> %s" % (fpath, ftarget)) + os.link(ftarget, fpath) + + # Create symlinks for all cases we were able to split symbols + for file in symlinks: + src = file[len(dvar):] + dest = dv["libdir"] + os.path.dirname(src) + dv["dir"] + "/" + os.path.basename(src) + dv["append"] + fpath = dvar + dest + # Skip it if the target doesn't exist + try: + s = os.stat(fpath) + except OSError as e: + (err, strerror) = e.args + if err != errno.ENOENT: + raise + continue + + ltarget = symlinks[file] + lpath = os.path.dirname(ltarget) + lbase = os.path.basename(ltarget) + ftarget = "" + if lpath and lpath != ".": + ftarget += lpath + dv["dir"] + "/" + ftarget += lbase + dv["append"] + if lpath.startswith(".."): + ftarget = os.path.join("..", ftarget) + bb.utils.mkdirhier(os.path.dirname(fpath)) + #bb.note("Symlink %s -> %s" % (fpath, ftarget)) + os.symlink(ftarget, fpath) + + # Process the dv["srcdir"] if requested... + # This copies and places the referenced sources for later debugging... + copydebugsources(dv["srcdir"], sources, d) + # + # End of debug splitting + # + + # + # Now lets go back over things and strip them + # + if (d.getVar('INHIBIT_PACKAGE_STRIP') != '1'): + strip = d.getVar("STRIP") + sfiles = [] + for file in elffiles: + elf_file = int(elffiles[file]) + #bb.note("Strip %s" % file) + sfiles.append((file, elf_file, strip)) + if (d.getVar('PACKAGE_STRIP_STATIC') == '1' or d.getVar('PACKAGE_DEBUG_STATIC_SPLIT') == '1'): + for f in staticlibs: + sfiles.append((f, 16, strip)) + + oe.utils.multiprocess_launch(oe.package.runstrip, sfiles, d) + + # Build "minidebuginfo" and reinject it back into the stripped binaries + if d.getVar('PACKAGE_MINIDEBUGINFO') == '1': + oe.utils.multiprocess_launch(inject_minidebuginfo, list(elffiles), d, + extraargs=(dvar, dv, d)) + + # + # End of strip + # + os.chdir(oldcwd) + + +def populate_packages(d): + cpath = oe.cachedpath.CachedPath() + + workdir = d.getVar('WORKDIR') + outdir = d.getVar('DEPLOY_DIR') + dvar = d.getVar('PKGD') + packages = d.getVar('PACKAGES').split() + pn = d.getVar('PN') + + bb.utils.mkdirhier(outdir) + os.chdir(dvar) + + autodebug = not (d.getVar("NOAUTOPACKAGEDEBUG") or False) + + split_source_package = (d.getVar('PACKAGE_DEBUG_SPLIT_STYLE') == 'debug-with-srcpkg') + + # If debug-with-srcpkg mode is enabled then add the source package if it + # doesn't exist and add the source file contents to the source package. + if split_source_package: + src_package_name = ('%s-src' % d.getVar('PN')) + if not src_package_name in packages: + packages.append(src_package_name) + d.setVar('FILES:%s' % src_package_name, '/usr/src/debug') + + # Sanity check PACKAGES for duplicates + # Sanity should be moved to sanity.bbclass once we have the infrastructure + package_dict = {} + + for i, pkg in enumerate(packages): + if pkg in package_dict: + msg = "%s is listed in PACKAGES multiple times, this leads to packaging errors." % pkg + oe.qa.handle_error("packages-list", msg, d) + # Ensure the source package gets the chance to pick up the source files + # before the debug package by ordering it first in PACKAGES. Whether it + # actually picks up any source files is controlled by + # PACKAGE_DEBUG_SPLIT_STYLE. + elif pkg.endswith("-src"): + package_dict[pkg] = (10, i) + elif autodebug and pkg.endswith("-dbg"): + package_dict[pkg] = (30, i) + else: + package_dict[pkg] = (50, i) + packages = sorted(package_dict.keys(), key=package_dict.get) + d.setVar('PACKAGES', ' '.join(packages)) + pkgdest = d.getVar('PKGDEST') + + seen = [] + + # os.mkdir masks the permissions with umask so we have to unset it first + oldumask = os.umask(0) + + debug = [] + for root, dirs, files in cpath.walk(dvar): + dir = root[len(dvar):] + if not dir: + dir = os.sep + for f in (files + dirs): + path = "." + os.path.join(dir, f) + if "/.debug/" in path or "/.debug-static/" in path or path.endswith("/.debug"): + debug.append(path) + + for pkg in packages: + root = os.path.join(pkgdest, pkg) + bb.utils.mkdirhier(root) + + filesvar = d.getVar('FILES:%s' % pkg) or "" + if "//" in filesvar: + msg = "FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg + oe.qa.handle_error("files-invalid", msg, d) + filesvar.replace("//", "/") + + origfiles = filesvar.split() + files, symlink_paths = oe.package.files_from_filevars(origfiles) + + if autodebug and pkg.endswith("-dbg"): + files.extend(debug) + + for file in files: + if (not cpath.islink(file)) and (not cpath.exists(file)): + continue + if file in seen: + continue + seen.append(file) + + def mkdir(src, dest, p): + src = os.path.join(src, p) + dest = os.path.join(dest, p) + fstat = cpath.stat(src) + os.mkdir(dest) + os.chmod(dest, fstat.st_mode) + os.chown(dest, fstat.st_uid, fstat.st_gid) + if p not in seen: + seen.append(p) + cpath.updatecache(dest) + + def mkdir_recurse(src, dest, paths): + if cpath.exists(dest + '/' + paths): + return + while paths.startswith("./"): + paths = paths[2:] + p = "." + for c in paths.split("/"): + p = os.path.join(p, c) + if not cpath.exists(os.path.join(dest, p)): + mkdir(src, dest, p) + + if cpath.isdir(file) and not cpath.islink(file): + mkdir_recurse(dvar, root, file) + continue + + mkdir_recurse(dvar, root, os.path.dirname(file)) + fpath = os.path.join(root,file) + if not cpath.islink(file): + os.link(file, fpath) + continue + ret = bb.utils.copyfile(file, fpath) + if ret is False or ret == 0: + bb.fatal("File population failed") + + # Check if symlink paths exist + for file in symlink_paths: + if not os.path.exists(os.path.join(root,file)): + bb.fatal("File '%s' cannot be packaged into '%s' because its " + "parent directory structure does not exist. One of " + "its parent directories is a symlink whose target " + "directory is not included in the package." % + (file, pkg)) + + os.umask(oldumask) + os.chdir(workdir) + + # Handle excluding packages with incompatible licenses + package_list = [] + for pkg in packages: + licenses = d.getVar('_exclude_incompatible-' + pkg) + if licenses: + msg = "Excluding %s from packaging as it has incompatible license(s): %s" % (pkg, licenses) + oe.qa.handle_error("incompatible-license", msg, d) + else: + package_list.append(pkg) + d.setVar('PACKAGES', ' '.join(package_list)) + + unshipped = [] + for root, dirs, files in cpath.walk(dvar): + dir = root[len(dvar):] + if not dir: + dir = os.sep + for f in (files + dirs): + path = os.path.join(dir, f) + if ('.' + path) not in seen: + unshipped.append(path) + + if unshipped != []: + msg = pn + ": Files/directories were installed but not shipped in any package:" + if "installed-vs-shipped" in (d.getVar('INSANE_SKIP:' + pn) or "").split(): + bb.note("Package %s skipping QA tests: installed-vs-shipped" % pn) + else: + for f in unshipped: + msg = msg + "\n " + f + msg = msg + "\nPlease set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.\n" + msg = msg + "%s: %d installed and not shipped files." % (pn, len(unshipped)) + oe.qa.handle_error("installed-vs-shipped", msg, d) + +def process_fixsymlinks(pkgfiles, d): + cpath = oe.cachedpath.CachedPath() + pkgdest = d.getVar('PKGDEST') + packages = d.getVar("PACKAGES", False).split() + + dangling_links = {} + pkg_files = {} + for pkg in packages: + dangling_links[pkg] = [] + pkg_files[pkg] = [] + inst_root = os.path.join(pkgdest, pkg) + for path in pkgfiles[pkg]: + rpath = path[len(inst_root):] + pkg_files[pkg].append(rpath) + rtarget = cpath.realpath(path, inst_root, True, assume_dir = True) + if not cpath.lexists(rtarget): + dangling_links[pkg].append(os.path.normpath(rtarget[len(inst_root):])) + + newrdepends = {} + for pkg in dangling_links: + for l in dangling_links[pkg]: + found = False + bb.debug(1, "%s contains dangling link %s" % (pkg, l)) + for p in packages: + if l in pkg_files[p]: + found = True + bb.debug(1, "target found in %s" % p) + if p == pkg: + break + if pkg not in newrdepends: + newrdepends[pkg] = [] + newrdepends[pkg].append(p) + break + if found == False: + bb.note("%s contains dangling symlink to %s" % (pkg, l)) + + for pkg in newrdepends: + rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS:' + pkg) or "") + for p in newrdepends[pkg]: + if p not in rdepends: + rdepends[p] = [] + d.setVar('RDEPENDS:' + pkg, bb.utils.join_deps(rdepends, commasep=False)) + +def process_filedeps(pkgfiles, d): + """ + Collect perfile run-time dependency metadata + Output: + FILERPROVIDESFLIST:pkg - list of all files w/ deps + FILERPROVIDES:filepath:pkg - per file dep + + FILERDEPENDSFLIST:pkg - list of all files w/ deps + FILERDEPENDS:filepath:pkg - per file dep + """ + if d.getVar('SKIP_FILEDEPS') == '1': + return + + pkgdest = d.getVar('PKGDEST') + packages = d.getVar('PACKAGES') + rpmdeps = d.getVar('RPMDEPS') + + def chunks(files, n): + return [files[i:i+n] for i in range(0, len(files), n)] + + pkglist = [] + for pkg in packages.split(): + if d.getVar('SKIP_FILEDEPS:' + pkg) == '1': + continue + if pkg.endswith('-dbg') or pkg.endswith('-doc') or pkg.find('-locale-') != -1 or pkg.find('-localedata-') != -1 or pkg.find('-gconv-') != -1 or pkg.find('-charmap-') != -1 or pkg.startswith('kernel-module-') or pkg.endswith('-src'): + continue + for files in chunks(pkgfiles[pkg], 100): + pkglist.append((pkg, files, rpmdeps, pkgdest)) + + processed = oe.utils.multiprocess_launch(oe.package.filedeprunner, pkglist, d) + + provides_files = {} + requires_files = {} + + for result in processed: + (pkg, provides, requires) = result + + if pkg not in provides_files: + provides_files[pkg] = [] + if pkg not in requires_files: + requires_files[pkg] = [] + + for file in sorted(provides): + provides_files[pkg].append(file) + key = "FILERPROVIDES:" + file + ":" + pkg + d.appendVar(key, " " + " ".join(provides[file])) + + for file in sorted(requires): + requires_files[pkg].append(file) + key = "FILERDEPENDS:" + file + ":" + pkg + d.appendVar(key, " " + " ".join(requires[file])) + + for pkg in requires_files: + d.setVar("FILERDEPENDSFLIST:" + pkg, " ".join(sorted(requires_files[pkg]))) + for pkg in provides_files: + d.setVar("FILERPROVIDESFLIST:" + pkg, " ".join(sorted(provides_files[pkg]))) + +def process_shlibs(pkgfiles, d): + cpath = oe.cachedpath.CachedPath() + + exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', False) + if exclude_shlibs: + bb.note("not generating shlibs") + return + + lib_re = re.compile(r"^.*\.so") + libdir_re = re.compile(r".*/%s$" % d.getVar('baselib')) + + packages = d.getVar('PACKAGES') + + shlib_pkgs = [] + exclusion_list = d.getVar("EXCLUDE_PACKAGES_FROM_SHLIBS") + if exclusion_list: + for pkg in packages.split(): + if pkg not in exclusion_list.split(): + shlib_pkgs.append(pkg) + else: + bb.note("not generating shlibs for %s" % pkg) + else: + shlib_pkgs = packages.split() + + hostos = d.getVar('HOST_OS') + + workdir = d.getVar('WORKDIR') + + ver = d.getVar('PKGV') + if not ver: + msg = "PKGV not defined" + oe.qa.handle_error("pkgv-undefined", msg, d) + return + + pkgdest = d.getVar('PKGDEST') + + shlibswork_dir = d.getVar('SHLIBSWORKDIR') + + def linux_so(file, pkg, pkgver, d): + needs_ldconfig = False + needed = set() + sonames = set() + renames = [] + ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '') + cmd = d.getVar('OBJDUMP') + " -p " + pipes.quote(file) + " 2>/dev/null" + fd = os.popen(cmd) + lines = fd.readlines() + fd.close() + rpath = tuple() + for l in lines: + m = re.match(r"\s+RPATH\s+([^\s]*)", l) + if m: + rpaths = m.group(1).replace("$ORIGIN", ldir).split(":") + rpath = tuple(map(os.path.normpath, rpaths)) + for l in lines: + m = re.match(r"\s+NEEDED\s+([^\s]*)", l) + if m: + dep = m.group(1) + if dep not in needed: + needed.add((dep, file, rpath)) + m = re.match(r"\s+SONAME\s+([^\s]*)", l) + if m: + this_soname = m.group(1) + prov = (this_soname, ldir, pkgver) + if not prov in sonames: + # if library is private (only used by package) then do not build shlib for it + if not private_libs or len([i for i in private_libs if fnmatch.fnmatch(this_soname, i)]) == 0: + sonames.add(prov) + if libdir_re.match(os.path.dirname(file)): + needs_ldconfig = True + if needs_ldconfig and snap_symlinks and (os.path.basename(file) != this_soname): + renames.append((file, os.path.join(os.path.dirname(file), this_soname))) + return (needs_ldconfig, needed, sonames, renames) + + def darwin_so(file, needed, sonames, renames, pkgver): + if not os.path.exists(file): + return + ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '') + + def get_combinations(base): + # + # Given a base library name, find all combinations of this split by "." and "-" + # + combos = [] + options = base.split(".") + for i in range(1, len(options) + 1): + combos.append(".".join(options[0:i])) + options = base.split("-") + for i in range(1, len(options) + 1): + combos.append("-".join(options[0:i])) + return combos + + if (file.endswith('.dylib') or file.endswith('.so')) and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-src'): + # Drop suffix + name = os.path.basename(file).rsplit(".",1)[0] + # Find all combinations + combos = get_combinations(name) + for combo in combos: + if not combo in sonames: + prov = (combo, ldir, pkgver) + sonames.add(prov) + if file.endswith('.dylib') or file.endswith('.so'): + rpath = [] + p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + # If returned successfully, process stdout for results + if p.returncode == 0: + for l in out.split("\n"): + l = l.strip() + if l.startswith('path '): + rpath.append(l.split()[1]) + + p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + # If returned successfully, process stdout for results + if p.returncode == 0: + for l in out.split("\n"): + l = l.strip() + if not l or l.endswith(":"): + continue + if "is not an object file" in l: + continue + name = os.path.basename(l.split()[0]).rsplit(".", 1)[0] + if name and name not in needed[pkg]: + needed[pkg].add((name, file, tuple())) + + def mingw_dll(file, needed, sonames, renames, pkgver): + if not os.path.exists(file): + return + + if file.endswith(".dll"): + # assume all dlls are shared objects provided by the package + sonames.add((os.path.basename(file), os.path.dirname(file).replace(pkgdest + "/" + pkg, ''), pkgver)) + + if (file.endswith(".dll") or file.endswith(".exe")): + # use objdump to search for "DLL Name: .*\.dll" + p = subprocess.Popen([d.expand("${HOST_PREFIX}objdump"), "-p", file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + # process the output, grabbing all .dll names + if p.returncode == 0: + for m in re.finditer(r"DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE): + dllname = m.group(1) + if dllname: + needed[pkg].add((dllname, file, tuple())) + + if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS') == "1": + snap_symlinks = True + else: + snap_symlinks = False + + needed = {} + + shlib_provider = oe.package.read_shlib_providers(d) + + for pkg in shlib_pkgs: + private_libs = d.getVar('PRIVATE_LIBS:' + pkg) or d.getVar('PRIVATE_LIBS') or "" + private_libs = private_libs.split() + needs_ldconfig = False + bb.debug(2, "calculating shlib provides for %s" % pkg) + + pkgver = d.getVar('PKGV:' + pkg) + if not pkgver: + pkgver = d.getVar('PV_' + pkg) + if not pkgver: + pkgver = ver + + needed[pkg] = set() + sonames = set() + renames = [] + linuxlist = [] + for file in pkgfiles[pkg]: + soname = None + if cpath.islink(file): + continue + if hostos == "darwin" or hostos == "darwin8": + darwin_so(file, needed, sonames, renames, pkgver) + elif hostos.startswith("mingw"): + mingw_dll(file, needed, sonames, renames, pkgver) + elif os.access(file, os.X_OK) or lib_re.match(file): + linuxlist.append(file) + + if linuxlist: + results = oe.utils.multiprocess_launch(linux_so, linuxlist, d, extraargs=(pkg, pkgver, d)) + for r in results: + ldconfig = r[0] + needed[pkg] |= r[1] + sonames |= r[2] + renames.extend(r[3]) + needs_ldconfig = needs_ldconfig or ldconfig + + for (old, new) in renames: + bb.note("Renaming %s to %s" % (old, new)) + bb.utils.rename(old, new) + pkgfiles[pkg].remove(old) + + shlibs_file = os.path.join(shlibswork_dir, pkg + ".list") + if len(sonames): + with open(shlibs_file, 'w') as fd: + for s in sorted(sonames): + if s[0] in shlib_provider and s[1] in shlib_provider[s[0]]: + (old_pkg, old_pkgver) = shlib_provider[s[0]][s[1]] + if old_pkg != pkg: + bb.warn('%s-%s was registered as shlib provider for %s, changing it to %s-%s because it was built later' % (old_pkg, old_pkgver, s[0], pkg, pkgver)) + bb.debug(1, 'registering %s-%s as shlib provider for %s' % (pkg, pkgver, s[0])) + fd.write(s[0] + ':' + s[1] + ':' + s[2] + '\n') + if s[0] not in shlib_provider: + shlib_provider[s[0]] = {} + shlib_provider[s[0]][s[1]] = (pkg, pkgver) + if needs_ldconfig: + bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) + postinst = d.getVar('pkg_postinst:%s' % pkg) + if not postinst: + postinst = '#!/bin/sh\n' + postinst += d.getVar('ldconfig_postinst_fragment') + d.setVar('pkg_postinst:%s' % pkg, postinst) + bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames)) + + assumed_libs = d.getVar('ASSUME_SHLIBS') + if assumed_libs: + libdir = d.getVar("libdir") + for e in assumed_libs.split(): + l, dep_pkg = e.split(":") + lib_ver = None + dep_pkg = dep_pkg.rsplit("_", 1) + if len(dep_pkg) == 2: + lib_ver = dep_pkg[1] + dep_pkg = dep_pkg[0] + if l not in shlib_provider: + shlib_provider[l] = {} + shlib_provider[l][libdir] = (dep_pkg, lib_ver) + + libsearchpath = [d.getVar('libdir'), d.getVar('base_libdir')] + + for pkg in shlib_pkgs: + bb.debug(2, "calculating shlib requirements for %s" % pkg) + + private_libs = d.getVar('PRIVATE_LIBS:' + pkg) or d.getVar('PRIVATE_LIBS') or "" + private_libs = private_libs.split() + + deps = list() + for n in needed[pkg]: + # if n is in private libraries, don't try to search provider for it + # this could cause problem in case some abc.bb provides private + # /opt/abc/lib/libfoo.so.1 and contains /usr/bin/abc depending on system library libfoo.so.1 + # but skipping it is still better alternative than providing own + # version and then adding runtime dependency for the same system library + if private_libs and len([i for i in private_libs if fnmatch.fnmatch(n[0], i)]) > 0: + bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n[0])) + continue + if n[0] in shlib_provider.keys(): + shlib_provider_map = shlib_provider[n[0]] + matches = set() + for p in itertools.chain(list(n[2]), sorted(shlib_provider_map.keys()), libsearchpath): + if p in shlib_provider_map: + matches.add(p) + if len(matches) > 1: + matchpkgs = ', '.join([shlib_provider_map[match][0] for match in matches]) + bb.error("%s: Multiple shlib providers for %s: %s (used by files: %s)" % (pkg, n[0], matchpkgs, n[1])) + elif len(matches) == 1: + (dep_pkg, ver_needed) = shlib_provider_map[matches.pop()] + + bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1])) + + if dep_pkg == pkg: + continue + + if ver_needed: + dep = "%s (>= %s)" % (dep_pkg, ver_needed) + else: + dep = dep_pkg + if not dep in deps: + deps.append(dep) + continue + bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1])) + + deps_file = os.path.join(pkgdest, pkg + ".shlibdeps") + if os.path.exists(deps_file): + os.remove(deps_file) + if deps: + with open(deps_file, 'w') as fd: + for dep in sorted(deps): + fd.write(dep + '\n') + +def process_pkgconfig(pkgfiles, d): + packages = d.getVar('PACKAGES') + workdir = d.getVar('WORKDIR') + pkgdest = d.getVar('PKGDEST') + + shlibs_dirs = d.getVar('SHLIBSDIRS').split() + shlibswork_dir = d.getVar('SHLIBSWORKDIR') + + pc_re = re.compile(r'(.*)\.pc$') + var_re = re.compile(r'(.*)=(.*)') + field_re = re.compile(r'(.*): (.*)') + + pkgconfig_provided = {} + pkgconfig_needed = {} + for pkg in packages.split(): + pkgconfig_provided[pkg] = [] + pkgconfig_needed[pkg] = [] + for file in sorted(pkgfiles[pkg]): + m = pc_re.match(file) + if m: + pd = bb.data.init() + name = m.group(1) + pkgconfig_provided[pkg].append(os.path.basename(name)) + if not os.access(file, os.R_OK): + continue + with open(file, 'r') as f: + lines = f.readlines() + for l in lines: + m = var_re.match(l) + if m: + name = m.group(1) + val = m.group(2) + pd.setVar(name, pd.expand(val)) + continue + m = field_re.match(l) + if m: + hdr = m.group(1) + exp = pd.expand(m.group(2)) + if hdr == 'Requires': + pkgconfig_needed[pkg] += exp.replace(',', ' ').split() + + for pkg in packages.split(): + pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist") + if pkgconfig_provided[pkg] != []: + with open(pkgs_file, 'w') as f: + for p in sorted(pkgconfig_provided[pkg]): + f.write('%s\n' % p) + + # Go from least to most specific since the last one found wins + for dir in reversed(shlibs_dirs): + if not os.path.exists(dir): + continue + for file in sorted(os.listdir(dir)): + m = re.match(r'^(.*)\.pclist$', file) + if m: + pkg = m.group(1) + with open(os.path.join(dir, file)) as fd: + lines = fd.readlines() + pkgconfig_provided[pkg] = [] + for l in lines: + pkgconfig_provided[pkg].append(l.rstrip()) + + for pkg in packages.split(): + deps = [] + for n in pkgconfig_needed[pkg]: + found = False + for k in pkgconfig_provided.keys(): + if n in pkgconfig_provided[k]: + if k != pkg and not (k in deps): + deps.append(k) + found = True + if found == False: + bb.note("couldn't find pkgconfig module '%s' in any package" % n) + deps_file = os.path.join(pkgdest, pkg + ".pcdeps") + if len(deps): + with open(deps_file, 'w') as fd: + for dep in deps: + fd.write(dep + '\n') + +def read_libdep_files(d): + pkglibdeps = {} + packages = d.getVar('PACKAGES').split() + for pkg in packages: + pkglibdeps[pkg] = {} + for extension in ".shlibdeps", ".pcdeps", ".clilibdeps": + depsfile = d.expand("${PKGDEST}/" + pkg + extension) + if os.access(depsfile, os.R_OK): + with open(depsfile) as fd: + lines = fd.readlines() + for l in lines: + l.rstrip() + deps = bb.utils.explode_dep_versions2(l) + for dep in deps: + if not dep in pkglibdeps[pkg]: + pkglibdeps[pkg][dep] = deps[dep] + return pkglibdeps + +def process_depchains(pkgfiles, d): + """ + For a given set of prefix and postfix modifiers, make those packages + RRECOMMENDS on the corresponding packages for its RDEPENDS. + + Example: If package A depends upon package B, and A's .bb emits an + A-dev package, this would make A-dev Recommends: B-dev. + + If only one of a given suffix is specified, it will take the RRECOMMENDS + based on the RDEPENDS of *all* other packages. If more than one of a given + suffix is specified, its will only use the RDEPENDS of the single parent + package. + """ + + packages = d.getVar('PACKAGES') + postfixes = (d.getVar('DEPCHAIN_POST') or '').split() + prefixes = (d.getVar('DEPCHAIN_PRE') or '').split() + + def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d): + + #bb.note('depends for %s is %s' % (base, depends)) + rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS:' + pkg) or "") + + for depend in sorted(depends): + if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'): + #bb.note("Skipping %s" % depend) + continue + if depend.endswith('-dev'): + depend = depend[:-4] + if depend.endswith('-dbg'): + depend = depend[:-4] + pkgname = getname(depend, suffix) + #bb.note("Adding %s for %s" % (pkgname, depend)) + if pkgname not in rreclist and pkgname != pkg: + rreclist[pkgname] = [] + + #bb.note('setting: RRECOMMENDS:%s=%s' % (pkg, ' '.join(rreclist))) + d.setVar('RRECOMMENDS:%s' % pkg, bb.utils.join_deps(rreclist, commasep=False)) + + def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): + + #bb.note('rdepends for %s is %s' % (base, rdepends)) + rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS:' + pkg) or "") + + for depend in sorted(rdepends): + if depend.find('virtual-locale-') != -1: + #bb.note("Skipping %s" % depend) + continue + if depend.endswith('-dev'): + depend = depend[:-4] + if depend.endswith('-dbg'): + depend = depend[:-4] + pkgname = getname(depend, suffix) + #bb.note("Adding %s for %s" % (pkgname, depend)) + if pkgname not in rreclist and pkgname != pkg: + rreclist[pkgname] = [] + + #bb.note('setting: RRECOMMENDS:%s=%s' % (pkg, ' '.join(rreclist))) + d.setVar('RRECOMMENDS:%s' % pkg, bb.utils.join_deps(rreclist, commasep=False)) + + def add_dep(list, dep): + if dep not in list: + list.append(dep) + + depends = [] + for dep in bb.utils.explode_deps(d.getVar('DEPENDS') or ""): + add_dep(depends, dep) + + rdepends = [] + for pkg in packages.split(): + for dep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + pkg) or ""): + add_dep(rdepends, dep) + + #bb.note('rdepends is %s' % rdepends) + + def post_getname(name, suffix): + return '%s%s' % (name, suffix) + def pre_getname(name, suffix): + return '%s%s' % (suffix, name) + + pkgs = {} + for pkg in packages.split(): + for postfix in postfixes: + if pkg.endswith(postfix): + if not postfix in pkgs: + pkgs[postfix] = {} + pkgs[postfix][pkg] = (pkg[:-len(postfix)], post_getname) + + for prefix in prefixes: + if pkg.startswith(prefix): + if not prefix in pkgs: + pkgs[prefix] = {} + pkgs[prefix][pkg] = (pkg[:-len(prefix)], pre_getname) + + if "-dbg" in pkgs: + pkglibdeps = read_libdep_files(d) + pkglibdeplist = [] + for pkg in pkglibdeps: + for k in pkglibdeps[pkg]: + add_dep(pkglibdeplist, k) + dbgdefaultdeps = ((d.getVar('DEPCHAIN_DBGDEFAULTDEPS') == '1') or (bb.data.inherits_class('packagegroup', d))) + + for suffix in pkgs: + for pkg in pkgs[suffix]: + if d.getVarFlag('RRECOMMENDS:' + pkg, 'nodeprrecs'): + continue + (base, func) = pkgs[suffix][pkg] + if suffix == "-dev": + pkg_adddeprrecs(pkg, base, suffix, func, depends, d) + elif suffix == "-dbg": + if not dbgdefaultdeps: + pkg_addrrecs(pkg, base, suffix, func, pkglibdeplist, d) + continue + if len(pkgs[suffix]) == 1: + pkg_addrrecs(pkg, base, suffix, func, rdepends, d) + else: + rdeps = [] + for dep in bb.utils.explode_deps(d.getVar('RDEPENDS:' + base) or ""): + add_dep(rdeps, dep) + pkg_addrrecs(pkg, base, suffix, func, rdeps, d) + diff --git a/poky/meta/lib/oe/packagedata.py b/poky/meta/lib/oe/packagedata.py index b2ed8b5a3d..162ff60d72 100644 --- a/poky/meta/lib/oe/packagedata.py +++ b/poky/meta/lib/oe/packagedata.py @@ -6,6 +6,11 @@ import codecs import os +import json +import bb.compress.zstd +import oe.path + +from glob import glob def packaged(pkg, d): return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK) @@ -110,3 +115,237 @@ def recipename(pkg, d): """Return the recipe name for the given binary package name.""" return pkgmap(d).get(pkg) + +def get_package_mapping(pkg, basepkg, d, depversions=None): + import oe.packagedata + + data = oe.packagedata.read_subpkgdata(pkg, d) + key = "PKG:%s" % pkg + + if key in data: + if bb.data.inherits_class('allarch', d) and bb.data.inherits_class('packagegroup', d) and pkg != data[key]: + bb.error("An allarch packagegroup shouldn't depend on packages which are dynamically renamed (%s to %s)" % (pkg, data[key])) + # Have to avoid undoing the write_extra_pkgs(global_variants...) + if bb.data.inherits_class('allarch', d) and not d.getVar('MULTILIB_VARIANTS') \ + and data[key] == basepkg: + return pkg + if depversions == []: + # Avoid returning a mapping if the renamed package rprovides its original name + rprovkey = "RPROVIDES:%s" % pkg + if rprovkey in data: + if pkg in bb.utils.explode_dep_versions2(data[rprovkey]): + bb.note("%s rprovides %s, not replacing the latter" % (data[key], pkg)) + return pkg + # Do map to rewritten package name + return data[key] + + return pkg + +def get_package_additional_metadata(pkg_type, d): + base_key = "PACKAGE_ADD_METADATA" + for key in ("%s_%s" % (base_key, pkg_type.upper()), base_key): + if d.getVar(key, False) is None: + continue + d.setVarFlag(key, "type", "list") + if d.getVarFlag(key, "separator") is None: + d.setVarFlag(key, "separator", "\\n") + metadata_fields = [field.strip() for field in oe.data.typed_value(key, d)] + return "\n".join(metadata_fields).strip() + +def runtime_mapping_rename(varname, pkg, d): + #bb.note("%s before: %s" % (varname, d.getVar(varname))) + + new_depends = {} + deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "") + for depend, depversions in deps.items(): + new_depend = get_package_mapping(depend, pkg, d, depversions) + if depend != new_depend: + bb.note("package name mapping done: %s -> %s" % (depend, new_depend)) + new_depends[new_depend] = deps[depend] + + d.setVar(varname, bb.utils.join_deps(new_depends, commasep=False)) + + #bb.note("%s after: %s" % (varname, d.getVar(varname))) + +def emit_pkgdata(pkgfiles, d): + def process_postinst_on_target(pkg, mlprefix): + pkgval = d.getVar('PKG:%s' % pkg) + if pkgval is None: + pkgval = pkg + + defer_fragment = """ +if [ -n "$D" ]; then + $INTERCEPT_DIR/postinst_intercept delay_to_first_boot %s mlprefix=%s + exit 0 +fi +""" % (pkgval, mlprefix) + + postinst = d.getVar('pkg_postinst:%s' % pkg) + postinst_ontarget = d.getVar('pkg_postinst_ontarget:%s' % pkg) + + if postinst_ontarget: + bb.debug(1, 'adding deferred pkg_postinst_ontarget() to pkg_postinst() for %s' % pkg) + if not postinst: + postinst = '#!/bin/sh\n' + postinst += defer_fragment + postinst += postinst_ontarget + d.setVar('pkg_postinst:%s' % pkg, postinst) + + def add_set_e_to_scriptlets(pkg): + for scriptlet_name in ('pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm'): + scriptlet = d.getVar('%s:%s' % (scriptlet_name, pkg)) + if scriptlet: + scriptlet_split = scriptlet.split('\n') + if scriptlet_split[0].startswith("#!"): + scriptlet = scriptlet_split[0] + "\nset -e\n" + "\n".join(scriptlet_split[1:]) + else: + scriptlet = "set -e\n" + "\n".join(scriptlet_split[0:]) + d.setVar('%s:%s' % (scriptlet_name, pkg), scriptlet) + + def write_if_exists(f, pkg, var): + def encode(str): + import codecs + c = codecs.getencoder("unicode_escape") + return c(str)[0].decode("latin1") + + val = d.getVar('%s:%s' % (var, pkg)) + if val: + f.write('%s:%s: %s\n' % (var, pkg, encode(val))) + return val + val = d.getVar('%s' % (var)) + if val: + f.write('%s: %s\n' % (var, encode(val))) + return val + + def write_extra_pkgs(variants, pn, packages, pkgdatadir): + for variant in variants: + with open("%s/%s-%s" % (pkgdatadir, variant, pn), 'w') as fd: + fd.write("PACKAGES: %s\n" % ' '.join( + map(lambda pkg: '%s-%s' % (variant, pkg), packages.split()))) + + def write_extra_runtime_pkgs(variants, packages, pkgdatadir): + for variant in variants: + for pkg in packages.split(): + ml_pkg = "%s-%s" % (variant, pkg) + subdata_file = "%s/runtime/%s" % (pkgdatadir, ml_pkg) + with open(subdata_file, 'w') as fd: + fd.write("PKG:%s: %s" % (ml_pkg, pkg)) + + packages = d.getVar('PACKAGES') + pkgdest = d.getVar('PKGDEST') + pkgdatadir = d.getVar('PKGDESTWORK') + + data_file = pkgdatadir + d.expand("/${PN}") + with open(data_file, 'w') as fd: + fd.write("PACKAGES: %s\n" % packages) + + pkgdebugsource = d.getVar("PKGDEBUGSOURCES") or [] + + pn = d.getVar('PN') + global_variants = (d.getVar('MULTILIB_GLOBAL_VARIANTS') or "").split() + variants = (d.getVar('MULTILIB_VARIANTS') or "").split() + + if bb.data.inherits_class('kernel', d) or bb.data.inherits_class('module-base', d): + write_extra_pkgs(variants, pn, packages, pkgdatadir) + + if bb.data.inherits_class('allarch', d) and not variants \ + and not bb.data.inherits_class('packagegroup', d): + write_extra_pkgs(global_variants, pn, packages, pkgdatadir) + + workdir = d.getVar('WORKDIR') + + for pkg in packages.split(): + pkgval = d.getVar('PKG:%s' % pkg) + if pkgval is None: + pkgval = pkg + d.setVar('PKG:%s' % pkg, pkg) + + extended_data = { + "files_info": {} + } + + pkgdestpkg = os.path.join(pkgdest, pkg) + files = {} + files_extra = {} + total_size = 0 + seen = set() + for f in pkgfiles[pkg]: + fpath = os.sep + os.path.relpath(f, pkgdestpkg) + + fstat = os.lstat(f) + files[fpath] = fstat.st_size + + extended_data["files_info"].setdefault(fpath, {}) + extended_data["files_info"][fpath]['size'] = fstat.st_size + + if fstat.st_ino not in seen: + seen.add(fstat.st_ino) + total_size += fstat.st_size + + if fpath in pkgdebugsource: + extended_data["files_info"][fpath]['debugsrc'] = pkgdebugsource[fpath] + del pkgdebugsource[fpath] + + d.setVar('FILES_INFO:' + pkg , json.dumps(files, sort_keys=True)) + + process_postinst_on_target(pkg, d.getVar("MLPREFIX")) + add_set_e_to_scriptlets(pkg) + + subdata_file = pkgdatadir + "/runtime/%s" % pkg + with open(subdata_file, 'w') as sf: + for var in (d.getVar('PKGDATA_VARS') or "").split(): + val = write_if_exists(sf, pkg, var) + + write_if_exists(sf, pkg, 'FILERPROVIDESFLIST') + for dfile in sorted((d.getVar('FILERPROVIDESFLIST:' + pkg) or "").split()): + write_if_exists(sf, pkg, 'FILERPROVIDES:' + dfile) + + write_if_exists(sf, pkg, 'FILERDEPENDSFLIST') + for dfile in sorted((d.getVar('FILERDEPENDSFLIST:' + pkg) or "").split()): + write_if_exists(sf, pkg, 'FILERDEPENDS:' + dfile) + + sf.write('%s:%s: %d\n' % ('PKGSIZE', pkg, total_size)) + + subdata_extended_file = pkgdatadir + "/extended/%s.json.zstd" % pkg + num_threads = int(d.getVar("BB_NUMBER_THREADS")) + with bb.compress.zstd.open(subdata_extended_file, "wt", encoding="utf-8", num_threads=num_threads) as f: + json.dump(extended_data, f, sort_keys=True, separators=(",", ":")) + + # Symlinks needed for rprovides lookup + rprov = d.getVar('RPROVIDES:%s' % pkg) or d.getVar('RPROVIDES') + if rprov: + for p in bb.utils.explode_deps(rprov): + subdata_sym = pkgdatadir + "/runtime-rprovides/%s/%s" % (p, pkg) + bb.utils.mkdirhier(os.path.dirname(subdata_sym)) + oe.path.symlink("../../runtime/%s" % pkg, subdata_sym, True) + + allow_empty = d.getVar('ALLOW_EMPTY:%s' % pkg) + if not allow_empty: + allow_empty = d.getVar('ALLOW_EMPTY') + root = "%s/%s" % (pkgdest, pkg) + os.chdir(root) + g = glob('*') + if g or allow_empty == "1": + # Symlinks needed for reverse lookups (from the final package name) + subdata_sym = pkgdatadir + "/runtime-reverse/%s" % pkgval + oe.path.symlink("../runtime/%s" % pkg, subdata_sym, True) + + packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg + open(packagedfile, 'w').close() + + if bb.data.inherits_class('kernel', d) or bb.data.inherits_class('module-base', d): + write_extra_runtime_pkgs(variants, packages, pkgdatadir) + + if bb.data.inherits_class('allarch', d) and not variants \ + and not bb.data.inherits_class('packagegroup', d): + write_extra_runtime_pkgs(global_variants, packages, pkgdatadir) + +def mapping_rename_hook(d): + """ + Rewrite variables to account for package renaming in things + like debian.bbclass or manual PKG variable name changes + """ + pkg = d.getVar("PKG") + oe.packagedata.runtime_mapping_rename("RDEPENDS", pkg, d) + oe.packagedata.runtime_mapping_rename("RRECOMMENDS", pkg, d) + oe.packagedata.runtime_mapping_rename("RSUGGESTS", pkg, d) diff --git a/poky/meta/lib/oe/sstatesig.py b/poky/meta/lib/oe/sstatesig.py index aa273df970..f0224454c9 100644 --- a/poky/meta/lib/oe/sstatesig.py +++ b/poky/meta/lib/oe/sstatesig.py @@ -101,15 +101,6 @@ def sstate_lockedsigs(d): sigs[pn][task] = [h, siggen_lockedsigs_var] return sigs -class SignatureGeneratorOEBasic(bb.siggen.SignatureGeneratorBasic): - name = "OEBasic" - def init_rundepcheck(self, data): - self.abisaferecipes = (data.getVar("SIGGEN_EXCLUDERECIPES_ABISAFE") or "").split() - self.saferecipedeps = (data.getVar("SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS") or "").split() - pass - def rundep_check(self, fn, recipename, task, dep, depname, dataCaches = None): - return sstate_rundepfilter(self, fn, recipename, task, dep, depname, dataCaches) - class SignatureGeneratorOEBasicHashMixIn(object): supports_multiconfig_datacaches = True @@ -326,7 +317,6 @@ class SignatureGeneratorOEEquivHash(SignatureGeneratorOEBasicHashMixIn, bb.sigge bb.fatal("OEEquivHash requires SSTATE_HASHEQUIV_METHOD to be set") # Insert these classes into siggen's namespace so it can see and select them -bb.siggen.SignatureGeneratorOEBasic = SignatureGeneratorOEBasic bb.siggen.SignatureGeneratorOEBasicHash = SignatureGeneratorOEBasicHash bb.siggen.SignatureGeneratorOEEquivHash = SignatureGeneratorOEEquivHash @@ -469,11 +459,15 @@ def find_sstate_manifest(taskdata, taskdata2, taskname, d, multilibcache): pkgarchs.append('allarch') pkgarchs.append('${SDK_ARCH}_${SDK_ARCH}-${SDKPKGSUFFIX}') + searched_manifests = [] + for pkgarch in pkgarchs: manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-%s-%s.%s" % (pkgarch, taskdata, taskname)) if os.path.exists(manifest): return manifest, d2 - bb.fatal("Manifest %s not found in %s (variant '%s')?" % (manifest, d2.expand(" ".join(pkgarchs)), variant)) + searched_manifests.append(manifest) + bb.fatal("The sstate manifest for task '%s:%s' (multilib variant '%s') could not be found.\nThe pkgarchs considered were: %s.\nBut none of these manifests exists:\n %s" + % (taskdata, taskname, variant, d2.expand(", ".join(pkgarchs)),"\n ".join(searched_manifests))) return None, d2 def OEOuthashBasic(path, sigfile, task, d): diff --git a/poky/meta/lib/oeqa/core/utils/concurrencytest.py b/poky/meta/lib/oeqa/core/utils/concurrencytest.py index 383479c959..4f77589b00 100644 --- a/poky/meta/lib/oeqa/core/utils/concurrencytest.py +++ b/poky/meta/lib/oeqa/core/utils/concurrencytest.py @@ -59,6 +59,7 @@ class BBThreadsafeForwardingResult(ThreadsafeForwardingResult): self.outputbuf = output self.finalresult = finalresult self.finalresult.buffer = True + self.target = target def _add_result_with_semaphore(self, method, test, *args, **kwargs): self.semaphore.acquire() @@ -67,13 +68,14 @@ class BBThreadsafeForwardingResult(ThreadsafeForwardingResult): self.result.starttime[test.id()] = self._test_start.timestamp() self.result.threadprogress[self.threadnum].append(test.id()) totalprogress = sum(len(x) for x in self.result.threadprogress.values()) - self.result.progressinfo[test.id()] = "%s: %s/%s %s/%s (%ss) (%s)" % ( + self.result.progressinfo[test.id()] = "%s: %s/%s %s/%s (%ss) (%s failed) (%s)" % ( self.threadnum, len(self.result.threadprogress[self.threadnum]), self.totalinprocess, totalprogress, self.totaltests, "{0:.2f}".format(time.time()-self._test_start.timestamp()), + self.target.failed_tests, test.id()) finally: self.semaphore.release() diff --git a/poky/meta/lib/oeqa/files/test.rs b/poky/meta/lib/oeqa/files/test.rs new file mode 100644 index 0000000000..f79c691f08 --- /dev/null +++ b/poky/meta/lib/oeqa/files/test.rs @@ -0,0 +1,2 @@ +fn main() { +} diff --git a/poky/meta/lib/oeqa/runtime/cases/rpm.py b/poky/meta/lib/oeqa/runtime/cases/rpm.py index e3cd818b2b..fa86eb0537 100644 --- a/poky/meta/lib/oeqa/runtime/cases/rpm.py +++ b/poky/meta/lib/oeqa/runtime/cases/rpm.py @@ -51,21 +51,20 @@ class RpmBasicTest(OERuntimeTestCase): msg = 'status: %s. Cannot run rpm -qa: %s' % (status, output) self.assertEqual(status, 0, msg=msg) - def check_no_process_for_user(u): - _, output = self.target.run(self.tc.target_cmds['ps']) - if u + ' ' in output: - return False - else: - return True + def wait_for_no_process_for_user(u, timeout = 120): + timeout_at = time.time() + timeout + while time.time() < timeout_at: + _, output = self.target.run(self.tc.target_cmds['ps']) + if u + ' ' not in output: + return + time.sleep(1) + user_pss = [ps for ps in output.split("\n") if u + ' ' in ps] + msg = "There're %s 's process(es) still running: %s".format(u, "\n".join(user_pss)) + assertTrue(True, msg=msg) def unset_up_test_user(u): # ensure no test1 process in running - timeout = time.time() + 30 - while time.time() < timeout: - if check_no_process_for_user(u): - break - else: - time.sleep(1) + wait_for_no_process_for_user(u) status, output = self.target.run('userdel -r %s' % u) msg = 'Failed to erase user: %s' % output self.assertTrue(status == 0, msg=msg) diff --git a/poky/meta/lib/oeqa/runtime/cases/rust.py b/poky/meta/lib/oeqa/runtime/cases/rust.py index 55b280d61d..c9c60e16fd 100644 --- a/poky/meta/lib/oeqa/runtime/cases/rust.py +++ b/poky/meta/lib/oeqa/runtime/cases/rust.py @@ -8,6 +8,47 @@ from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.runtime.decorator.package import OEHasPackage +class RustCompileTest(OERuntimeTestCase): + + @classmethod + def setUp(cls): + dst = '/tmp/' + src = os.path.join(cls.tc.files_dir, 'test.rs') + cls.tc.target.copyTo(src, dst) + + @classmethod + def tearDown(cls): + files = '/tmp/test.rs /tmp/test' + cls.tc.target.run('rm %s' % files) + dirs = '/tmp/hello' + cls.tc.target.run('rm -r %s' % dirs) + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['rust']) + def test_rust_compile(self): + status, output = self.target.run('rustc /tmp/test.rs -o /tmp/test') + msg = 'rust compile failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + + status, output = self.target.run('/tmp/test') + msg = 'running compiled file failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + + @OETestDepends(['ssh.SSHTest.test_ssh']) + @OEHasPackage(['cargo']) + def test_cargo_compile(self): + status, output = self.target.run('cargo new /tmp/hello') + msg = 'cargo new failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + + status, output = self.target.run('cargo build --manifest-path=/tmp/hello/Cargo.toml') + msg = 'cargo build failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + + status, output = self.target.run('cargo run --manifest-path=/tmp/hello/Cargo.toml') + msg = 'running compiled file failed, output: %s' % output + self.assertEqual(status, 0, msg=msg) + class RustHelloworldTest(OERuntimeTestCase): @OETestDepends(['ssh.SSHTest.test_ssh']) @OEHasPackage(['rust-hello-world']) diff --git a/poky/meta/lib/oeqa/selftest/cases/baremetal.py b/poky/meta/lib/oeqa/selftest/cases/baremetal.py new file mode 100644 index 0000000000..cadaea2f1a --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/baremetal.py @@ -0,0 +1,14 @@ + +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake + +class BaremetalTest(OESelftestTestCase): + def test_baremetal(self): + self.write_config('TCLIBC = "baremetal"') + bitbake('baremetal-helloworld') diff --git a/poky/meta/lib/oeqa/selftest/cases/debuginfod.py b/poky/meta/lib/oeqa/selftest/cases/debuginfod.py index 3c40119282..37f51760fb 100644 --- a/poky/meta/lib/oeqa/selftest/cases/debuginfod.py +++ b/poky/meta/lib/oeqa/selftest/cases/debuginfod.py @@ -12,6 +12,36 @@ from oeqa.utils.commands import bitbake, get_bb_var, runqemu class Debuginfod(OESelftestTestCase): + + def wait_for_debuginfod(self, port): + """ + debuginfod takes time to scan the packages and requesting too early may + result in a test failure if the right packages haven't been scanned yet. + + Request the metrics endpoint periodically and wait for there to be no + busy scanning threads. + + Returns True if debuginfod is ready, False if we timed out + """ + import time, urllib + + # Wait a minute + countdown = 6 + delay = 10 + + while countdown: + time.sleep(delay) + try: + with urllib.request.urlopen("http://localhost:%d/metrics" % port) as f: + lines = f.read().decode("ascii").splitlines() + if "thread_busy{role=\"scan\"} 0" in lines: + return True + except urllib.error.URLError as e: + self.logger.error(e) + countdown -= 1 + return False + + def test_debuginfod(self): self.write_config( """ @@ -25,29 +55,50 @@ CORE_IMAGE_EXTRA_INSTALL += "elfutils" cmd = [ os.path.join(native_sysroot, "usr", "bin", "debuginfod"), "--verbose", + # In-memory database, this is a one-shot test "--database=:memory:", + # Don't use all the host cores + "--concurrency=8", + "--connection-pool=8", + # Disable rescanning, this is a one-shot test + "--rescan-time=0", + "--groom-time=0", get_bb_var("DEPLOY_DIR"), ] - for format in get_bb_var("PACKAGE_CLASSES").split(): - if format == "package_deb": - cmd.append("--scan-deb-dir") - elif format == "package_ipk": - cmd.append("--scan-deb-dir") - elif format == "package_rpm": - cmd.append("--scan-rpm-dir") + + format = get_bb_var("PACKAGE_CLASSES").split()[0] + if format == "package_deb": + cmd.append("--scan-deb-dir") + elif format == "package_ipk": + cmd.append("--scan-deb-dir") + elif format == "package_rpm": + cmd.append("--scan-rpm-dir") + else: + self.fail("Unknown package class %s" % format) + # Find a free port with socketserver.TCPServer(("localhost", 0), None) as s: port = s.server_address[1] cmd.append("--port=%d" % port) try: - debuginfod = subprocess.Popen(cmd) + # Remove DEBUGINFOD_URLS from the environment so we don't try + # looking in the distro debuginfod + env = os.environ.copy() + if "DEBUGINFOD_URLS" in env: + del env["DEBUGINFOD_URLS"] + + self.logger.info(f"Starting server {cmd}") + debuginfod = subprocess.Popen(cmd, env=env) with runqemu("core-image-minimal", runqemuparams="nographic") as qemu: + self.assertTrue(self.wait_for_debuginfod(port)) + cmd = ( "DEBUGINFOD_URLS=http://%s:%d/ debuginfod-find debuginfo /usr/bin/debuginfod" % (qemu.server_ip, port) ) + self.logger.info(f"Starting client {cmd}") status, output = qemu.run_serial(cmd) # This should be more comprehensive self.assertIn("/.cache/debuginfod_client/", output) diff --git a/poky/meta/lib/oeqa/selftest/cases/devtool.py b/poky/meta/lib/oeqa/selftest/cases/devtool.py index 0cb7403f16..c78a68be5b 100644 --- a/poky/meta/lib/oeqa/selftest/cases/devtool.py +++ b/poky/meta/lib/oeqa/selftest/cases/devtool.py @@ -1076,9 +1076,10 @@ class DevtoolUpdateTests(DevtoolBase): def test_devtool_update_recipe_append_git(self): # Check preconditions testrecipe = 'mtd-utils-selftest' - bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) + bb_vars = get_bb_vars(['FILE', 'SRC_URI', 'LAYERSERIES_CORENAMES'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] + corenames = bb_vars['LAYERSERIES_CORENAMES'] self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) for entry in src_uri.split(): if entry.startswith('git://'): @@ -1109,7 +1110,7 @@ class DevtoolUpdateTests(DevtoolBase): f.write('BBFILE_PATTERN_oeselftesttemplayer = "^${LAYERDIR}/"\n') f.write('BBFILE_PRIORITY_oeselftesttemplayer = "999"\n') f.write('BBFILE_PATTERN_IGNORE_EMPTY_oeselftesttemplayer = "1"\n') - f.write('LAYERSERIES_COMPAT_oeselftesttemplayer = "${LAYERSERIES_COMPAT_core}"\n') + f.write('LAYERSERIES_COMPAT_oeselftesttemplayer = "%s"\n' % corenames) self.add_command_to_tearDown('bitbake-layers remove-layer %s || true' % templayerdir) result = runCmd('bitbake-layers add-layer %s' % templayerdir, cwd=self.builddir) # Create the bbappend diff --git a/poky/meta/lib/oeqa/selftest/cases/externalsrc.py b/poky/meta/lib/oeqa/selftest/cases/externalsrc.py new file mode 100644 index 0000000000..1d800dc82c --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/externalsrc.py @@ -0,0 +1,44 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +import os +import shutil +import tempfile + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import get_bb_var, runCmd + +class ExternalSrc(OESelftestTestCase): + # test that srctree_hash_files does not crash + # we should be actually checking do_compile[file-checksums] but oeqa currently does not support it + # so we check only that a recipe with externalsrc can be parsed + def test_externalsrc_srctree_hash_files(self): + test_recipe = "git-submodule-test" + git_url = "git://git.yoctoproject.org/git-submodule-test" + externalsrc_dir = tempfile.TemporaryDirectory(prefix="externalsrc").name + + self.write_config( + """ +INHERIT += "externalsrc" +EXTERNALSRC:pn-%s = "%s" +""" % (test_recipe, externalsrc_dir) + ) + + # test with git without submodules + runCmd('git clone %s %s' % (git_url, externalsrc_dir)) + os.unlink(externalsrc_dir + "/.gitmodules") + open(".gitmodules", 'w').close() # local file .gitmodules in cwd should not affect externalsrc parsing + self.assertEqual(get_bb_var("S", test_recipe), externalsrc_dir, msg = "S does not equal to EXTERNALSRC") + os.unlink(".gitmodules") + + # test with git with submodules + runCmd('git checkout .gitmodules', cwd=externalsrc_dir) + runCmd('git submodule update --init --recursive', cwd=externalsrc_dir) + self.assertEqual(get_bb_var("S", test_recipe), externalsrc_dir, msg = "S does not equal to EXTERNALSRC") + + # test without git + shutil.rmtree(os.path.join(externalsrc_dir, ".git")) + self.assertEqual(get_bb_var("S", test_recipe), externalsrc_dir, msg = "S does not equal to EXTERNALSRC") diff --git a/poky/meta/lib/oeqa/selftest/cases/runqemu.py b/poky/meta/lib/oeqa/selftest/cases/runqemu.py index 58a4526df6..c2c3fbc924 100644 --- a/poky/meta/lib/oeqa/selftest/cases/runqemu.py +++ b/poky/meta/lib/oeqa/selftest/cases/runqemu.py @@ -199,22 +199,12 @@ class QemuTest(OESelftestTestCase): qemu_shutdown_succeeded = self._start_qemu_shutdown_check_if_shutdown_succeeded(qemu, shutdown_timeout) self.assertTrue(qemu_shutdown_succeeded, 'Failed: %s does not shutdown within timeout(%s)' % (self.machine, shutdown_timeout)) - # Need to have portmap/rpcbind running to allow this test to work and - # current autobuilder setup does not have this. - def disabled_test_qemu_can_boot_nfs_and_shutdown(self): - self.assertExists(self.qemuboot_conf) - bitbake('meta-ide-support') + def test_qemu_can_boot_nfs_and_shutdown(self): rootfs_tar = "%s-%s.tar.bz2" % (self.recipe, self.machine) rootfs_tar = os.path.join(self.deploy_dir_image, rootfs_tar) self.assertExists(rootfs_tar) - tmpdir = tempfile.mkdtemp(prefix='qemu_nfs') - tmpdir_nfs = os.path.join(tmpdir, 'nfs') - cmd_extract_nfs = 'runqemu-extract-sdk %s %s' % (rootfs_tar, tmpdir_nfs) - result = runCmd(cmd_extract_nfs) - self.assertEqual(0, result.status, "runqemu-extract-sdk didn't run as expected. %s" % result.output) - cmd = "%s nfs %s %s" % (self.cmd_common, self.qemuboot_conf, tmpdir_nfs) + cmd = "%s %s" % (self.cmd_common, rootfs_tar) shutdown_timeout = 120 with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu: qemu_shutdown_succeeded = self._start_qemu_shutdown_check_if_shutdown_succeeded(qemu, shutdown_timeout) self.assertTrue(qemu_shutdown_succeeded, 'Failed: %s does not shutdown within timeout(%s)' % (self.machine, shutdown_timeout)) - runCmd('rm -rf %s' % tmpdir) diff --git a/poky/meta/lib/oeqa/selftest/cases/tinfoil.py b/poky/meta/lib/oeqa/selftest/cases/tinfoil.py index 0a66615fd1..dd13c20402 100644 --- a/poky/meta/lib/oeqa/selftest/cases/tinfoil.py +++ b/poky/meta/lib/oeqa/selftest/cases/tinfoil.py @@ -66,6 +66,20 @@ class TinfoilTests(OESelftestTestCase): localdata.setVar('PN', 'hello') self.assertEqual('hello', localdata.getVar('BPN')) + # The config_data API tp parse_recipe_file is used by: + # layerindex-web layerindex/update_layer.py + def test_parse_recipe_custom_data(self): + with bb.tinfoil.Tinfoil() as tinfoil: + tinfoil.prepare(config_only=False, quiet=2) + localdata = bb.data.createCopy(tinfoil.config_data) + localdata.setVar("TESTVAR", "testval") + testrecipe = 'mdadm' + best = tinfoil.find_best_provider(testrecipe) + if not best: + self.fail('Unable to find recipe providing %s' % testrecipe) + rd = tinfoil.parse_recipe_file(best[3], config_data=localdata) + self.assertEqual("testval", rd.getVar('TESTVAR')) + def test_list_recipes(self): with bb.tinfoil.Tinfoil() as tinfoil: tinfoil.prepare(config_only=False, quiet=2) diff --git a/poky/meta/lib/oeqa/selftest/context.py b/poky/meta/lib/oeqa/selftest/context.py index 78c7a467e2..c7dd03ce37 100644 --- a/poky/meta/lib/oeqa/selftest/context.py +++ b/poky/meta/lib/oeqa/selftest/context.py @@ -154,9 +154,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor): group.add_argument('-a', '--run-all-tests', default=False, action="store_true", dest="run_all_tests", help='Run all (unhidden) tests') - group.add_argument('-R', '--skip-tests', required=False, action='store', - nargs='+', dest="skips", default=None, - help='Run all (unhidden) tests except the ones specified. Format should be [.[.]]') group.add_argument('-r', '--run-tests', required=False, action='store', nargs='+', dest="run_tests", default=None, help='Select what tests to run (modules, classes or test methods). Format should be: ..') @@ -171,6 +168,9 @@ class OESelftestTestContextExecutor(OETestContextExecutor): action="store_true", default=False, help='List all available tests.') + parser.add_argument('-R', '--skip-tests', required=False, action='store', + nargs='+', dest="skips", default=None, + help='Skip the tests specified. Format should be [.[.]]') parser.add_argument('-j', '--num-processes', dest='processes', action='store', type=int, help="number of processes to execute in parallel with") diff --git a/poky/meta/lib/oeqa/utils/commands.py b/poky/meta/lib/oeqa/utils/commands.py index f733fcdf3c..f4daea2507 100644 --- a/poky/meta/lib/oeqa/utils/commands.py +++ b/poky/meta/lib/oeqa/utils/commands.py @@ -300,6 +300,7 @@ def get_test_layer(): def create_temp_layer(templayerdir, templayername, priority=999, recipepathspec='recipes-*/*'): os.makedirs(os.path.join(templayerdir, 'conf')) + corenames = get_bb_var('LAYERSERIES_CORENAMES') with open(os.path.join(templayerdir, 'conf', 'layer.conf'), 'w') as f: f.write('BBPATH .= ":${LAYERDIR}"\n') f.write('BBFILES += "${LAYERDIR}/%s/*.bb \\' % recipepathspec) @@ -308,7 +309,7 @@ def create_temp_layer(templayerdir, templayername, priority=999, recipepathspec= f.write('BBFILE_PATTERN_%s = "^${LAYERDIR}/"\n' % templayername) f.write('BBFILE_PRIORITY_%s = "%d"\n' % (templayername, priority)) f.write('BBFILE_PATTERN_IGNORE_EMPTY_%s = "1"\n' % templayername) - f.write('LAYERSERIES_COMPAT_%s = "${LAYERSERIES_COMPAT_core}"\n' % templayername) + f.write('LAYERSERIES_COMPAT_%s = "%s"\n' % (templayername, corenames)) @contextlib.contextmanager def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None, qemuparams=None, overrides={}, discard_writes=True): diff --git a/poky/meta/lib/oeqa/utils/nfs.py b/poky/meta/lib/oeqa/utils/nfs.py index c1218656ce..b66ed42a58 100644 --- a/poky/meta/lib/oeqa/utils/nfs.py +++ b/poky/meta/lib/oeqa/utils/nfs.py @@ -30,7 +30,7 @@ def unfs_server(directory, logger = None): nenv = dict(os.environ) nenv['PATH'] = "{0}/sbin:{0}/usr/sbin:{0}/usr/bin:".format(unfs_sysroot) + nenv.get('PATH', '') - cmd = Command(["unfsd", "-d", "-p", "-N", "-e", exports.name, "-n", str(nfsport), "-m", str(mountport)], + cmd = Command(["unfsd", "-d", "-p", "-e", exports.name, "-n", str(nfsport), "-m", str(mountport)], bg = True, env = nenv, output_log = logger) cmd.run() yield nfsport, mountport diff --git a/poky/meta/lib/oeqa/utils/qemurunner.py b/poky/meta/lib/oeqa/utils/qemurunner.py index e602399232..b5fed6c9fe 100644 --- a/poky/meta/lib/oeqa/utils/qemurunner.py +++ b/poky/meta/lib/oeqa/utils/qemurunner.py @@ -177,7 +177,11 @@ class QemuRunner: launch_cmd += ' slirp' if self.use_ovmf: launch_cmd += ' ovmf' - launch_cmd += ' %s %s %s' % (runqemuparams, self.machine, self.rootfs) + launch_cmd += ' %s %s' % (runqemuparams, self.machine) + if self.rootfs.endswith('.vmdk'): + self.logger.debug('Bypassing VMDK rootfs for runqemu') + else: + launch_cmd += ' %s' % (self.rootfs) return self.launch(launch_cmd, qemuparams=qemuparams, get_ip=get_ip, extra_bootparams=extra_bootparams, env=env) @@ -401,9 +405,10 @@ class QemuRunner: cmdline = re_control_char.sub(' ', cmdline) try: if self.use_slirp: - tcp_ports = cmdline.split("hostfwd=tcp::")[1] + tcp_ports = cmdline.split("hostfwd=tcp:")[1] + ip, tcp_ports = tcp_ports.split(":")[:2] host_port = tcp_ports[:tcp_ports.find('-')] - self.ip = "localhost:%s" % host_port + self.ip = "%s:%s" % (ip, host_port) else: ips = re.findall(r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) self.ip = ips[0] diff --git a/poky/meta/recipes-bsp/acpid/acpid.inc b/poky/meta/recipes-bsp/acpid/acpid.inc index 98910bab29..7b2f1c71c5 100644 --- a/poky/meta/recipes-bsp/acpid/acpid.inc +++ b/poky/meta/recipes-bsp/acpid/acpid.inc @@ -13,7 +13,8 @@ LICENSE = "GPL-2.0-or-later" SRC_URI = "${SOURCEFORGE_MIRROR}/acpid2/acpid-${PV}.tar.xz \ file://init \ file://acpid.service \ - " + file://0001-Replace-stat64-with-stat.patch \ + " CVE_PRODUCT = "acpid2" diff --git a/poky/meta/recipes-bsp/acpid/acpid/0001-Replace-stat64-with-stat.patch b/poky/meta/recipes-bsp/acpid/acpid/0001-Replace-stat64-with-stat.patch new file mode 100644 index 0000000000..10abfc8388 --- /dev/null +++ b/poky/meta/recipes-bsp/acpid/acpid/0001-Replace-stat64-with-stat.patch @@ -0,0 +1,31 @@ +From 4b729235a9e96f120feee7e3746818aad0f3b924 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 14 Dec 2022 15:04:30 -0800 +Subject: [PATCH] Replace stat64 with stat + +It already checks for largefile support in configure.ac via +AC_SYS_LARGEFILE macro, which will ensure that 64bit elements +are correctly setup for stat APIs on platforms needing large +file support. + +Upstream-Status: Submitted [https://sourceforge.net/p/acpid2/code/merge-requests/5/] +Signed-off-by: Khem Raj +--- + sock.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sock.c b/sock.c +index 9e04501..3121fb7 100644 +--- a/sock.c ++++ b/sock.c +@@ -54,8 +54,8 @@ int non_root_clients; + static int + isfdtype(int fd, int fdtype) + { +- struct stat64 st; +- if (fstat64(fd, &st) != 0) ++ struct stat st; ++ if (fstat(fd, &st) != 0) + return -1; + return ((st.st_mode & S_IFMT) == (mode_t)fdtype); + } diff --git a/poky/meta/recipes-bsp/efibootmgr/efibootmgr_18.bb b/poky/meta/recipes-bsp/efibootmgr/efibootmgr_18.bb index cbcaac1e97..fbd2f5dbc8 100644 --- a/poky/meta/recipes-bsp/efibootmgr/efibootmgr_18.bb +++ b/poky/meta/recipes-bsp/efibootmgr/efibootmgr_18.bb @@ -30,6 +30,3 @@ do_install () { } CLEANBROKEN = "1" -# https://github.com/rhboot/efivar/issues/202 -COMPATIBLE_HOST:libc-musl = 'null' - diff --git a/poky/meta/recipes-bsp/efivar/efivar/0001-Use-off_t-instead-of-off64_t.patch b/poky/meta/recipes-bsp/efivar/efivar/0001-Use-off_t-instead-of-off64_t.patch new file mode 100644 index 0000000000..f47a457386 --- /dev/null +++ b/poky/meta/recipes-bsp/efivar/efivar/0001-Use-off_t-instead-of-off64_t.patch @@ -0,0 +1,39 @@ +From 1eb0fa531301a5045af1b020fc093c4fcfd38680 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 14 Dec 2022 16:55:51 -0800 +Subject: [PATCH] Use off_t instead of off64_t + +Pass _FILE_OFFSET_BITS=64 to ensure 64bit off_t + +Upstream-Status: Submitted [https://github.com/rhboot/efivar/pull/237] +Signed-off-by: Khem Raj +--- + src/error.c | 2 +- + src/include/defaults.mk | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/error.c b/src/error.c +index fcbba0d..9530e22 100644 +--- a/src/error.c ++++ b/src/error.c +@@ -191,7 +191,7 @@ dbglog_write(void *cookie, const char *buf, size_t size) + } + + static int +-dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence) ++dbglog_seek(void *cookie UNUSED, off_t *offset, int whence) + { + FILE *log = efi_errlog ? efi_errlog : stderr; + int rc; +diff --git a/src/include/defaults.mk b/src/include/defaults.mk +index 632b155..95be8be 100644 +--- a/src/include/defaults.mk ++++ b/src/include/defaults.mk +@@ -34,6 +34,7 @@ CPPFLAGS ?= + override _CPPFLAGS := $(CPPFLAGS) + override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \ + -D_GNU_SOURCE \ ++ -D_FILE_OFFSET_BITS=64 \ + -I$(TOPDIR)/src/include/ + CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS) + CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \ diff --git a/poky/meta/recipes-bsp/efivar/efivar_38.bb b/poky/meta/recipes-bsp/efivar/efivar_38.bb index 6a6918931b..5523329699 100644 --- a/poky/meta/recipes-bsp/efivar/efivar_38.bb +++ b/poky/meta/recipes-bsp/efivar/efivar_38.bb @@ -13,6 +13,7 @@ SRC_URI = "git://github.com/rhinstaller/efivar.git;branch=main;protocol=https \ file://efisecdb-fix-build-with-musl-libc.patch \ file://0001-Fix-invalid-free-in-main.patch \ file://0001-Fix-glibc-2.36-build-mount.h-conflicts.patch \ + file://0001-Use-off_t-instead-of-off64_t.patch \ " SRCREV = "1753149d4176ebfb2b135ac0aaf79340bf0e7a93" diff --git a/poky/meta/recipes-bsp/grub/files/0001-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch b/poky/meta/recipes-bsp/grub/files/0001-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch new file mode 100644 index 0000000000..efa00a3c6c --- /dev/null +++ b/poky/meta/recipes-bsp/grub/files/0001-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch @@ -0,0 +1,115 @@ +From 1f511ae054fe42dce7aedfbfe0f234fa1e0a7a3e Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Fri, 5 Aug 2022 00:51:20 +0800 +Subject: [PATCH] font: Fix size overflow in grub_font_get_glyph_internal() + +The length of memory allocation and file read may overflow. This patch +fixes the problem by using safemath macros. + +There is a lot of code repetition like "(x * y + 7) / 8". It is unsafe +if overflow happens. This patch introduces grub_video_bitmap_calc_1bpp_bufsz(). +It is safe replacement for such code. It has safemath-like prototype. + +This patch also introduces grub_cast(value, pointer), it casts value to +typeof(*pointer) then store the value to *pointer. It returns true when +overflow occurs or false if there is no overflow. The semantics of arguments +and return value are designed to be consistent with other safemath macros. + +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper + +Upstream-Status: Backport from +[https://git.savannah.gnu.org/cgit/grub.git/commit/?id=9c76ec09ae08155df27cd237eaea150b4f02f532] + +Signed-off-by: Xiangyu Chen + +--- + grub-core/font/font.c | 17 +++++++++++++---- + include/grub/bitmap.h | 18 ++++++++++++++++++ + include/grub/safemath.h | 2 ++ + 3 files changed, 33 insertions(+), 4 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index d09bb38..876b5b6 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -739,7 +739,8 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) + grub_int16_t xoff; + grub_int16_t yoff; + grub_int16_t dwidth; +- int len; ++ grub_ssize_t len; ++ grub_size_t sz; + + if (index_entry->glyph) + /* Return cached glyph. */ +@@ -766,9 +767,17 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) + return 0; + } + +- len = (width * height + 7) / 8; +- glyph = grub_malloc (sizeof (struct grub_font_glyph) + len); +- if (!glyph) ++ /* Calculate real struct size of current glyph. */ ++ if (grub_video_bitmap_calc_1bpp_bufsz (width, height, &len) || ++ grub_add (sizeof (struct grub_font_glyph), len, &sz)) ++ { ++ remove_font (font); ++ return 0; ++ } ++ ++ /* Allocate and initialize the glyph struct. */ ++ glyph = grub_malloc (sz); ++ if (glyph == NULL) + { + remove_font (font); + return 0; +diff --git a/include/grub/bitmap.h b/include/grub/bitmap.h +index 5728f8c..0d9603f 100644 +--- a/include/grub/bitmap.h ++++ b/include/grub/bitmap.h +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + struct grub_video_bitmap + { +@@ -79,6 +80,23 @@ grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap) + return bitmap->mode_info.height; + } + ++/* ++ * Calculate and store the size of data buffer of 1bit bitmap in result. ++ * Equivalent to "*result = (width * height + 7) / 8" if no overflow occurs. ++ * Return true when overflow occurs or false if there is no overflow. ++ * This function is intentionally implemented as a macro instead of ++ * an inline function. Although a bit awkward, it preserves data types for ++ * safemath macros and reduces macro side effects as much as possible. ++ * ++ * XXX: Will report false overflow if width * height > UINT64_MAX. ++ */ ++#define grub_video_bitmap_calc_1bpp_bufsz(width, height, result) \ ++({ \ ++ grub_uint64_t _bitmap_pixels; \ ++ grub_mul ((width), (height), &_bitmap_pixels) ? 1 : \ ++ grub_cast (_bitmap_pixels / GRUB_CHAR_BIT + !!(_bitmap_pixels % GRUB_CHAR_BIT), (result)); \ ++}) ++ + void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap, + struct grub_video_mode_info *mode_info); + +diff --git a/include/grub/safemath.h b/include/grub/safemath.h +index c17b89b..bb0f826 100644 +--- a/include/grub/safemath.h ++++ b/include/grub/safemath.h +@@ -30,6 +30,8 @@ + #define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res) + #define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res) + ++#define grub_cast(a, res) grub_add ((a), 0, (res)) ++ + #else + #error gcc 5.1 or newer or clang 3.8 or newer is required + #endif diff --git a/poky/meta/recipes-bsp/grub/files/CVE-2022-2601.patch b/poky/meta/recipes-bsp/grub/files/CVE-2022-2601.patch new file mode 100644 index 0000000000..727c509694 --- /dev/null +++ b/poky/meta/recipes-bsp/grub/files/CVE-2022-2601.patch @@ -0,0 +1,85 @@ +From e8060722acf0bcca037982d7fb29472363ccdfd4 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Fri, 5 Aug 2022 01:58:27 +0800 +Subject: [PATCH] font: Fix several integer overflows in + grub_font_construct_glyph() + +This patch fixes several integer overflows in grub_font_construct_glyph(). +Glyphs of invalid size, zero or leading to an overflow, are rejected. +The inconsistency between "glyph" and "max_glyph_size" when grub_malloc() +returns NULL is fixed too. + +Fixes: CVE-2022-2601 + +Reported-by: Zhang Boyang +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper + +Upstream-Status: Backport from +[https://git.savannah.gnu.org/cgit/grub.git/commit/?id=768e1ef2fc159f6e14e7246e4be09363708ac39e] +CVE: CVE-2022-2601 + +Signed-off-by: Xiangyu Chen + +--- + grub-core/font/font.c | 29 +++++++++++++++++------------ + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 876b5b6..0ff5525 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -1515,6 +1515,7 @@ grub_font_construct_glyph (grub_font_t hinted_font, + struct grub_video_signed_rect bounds; + static struct grub_font_glyph *glyph = 0; + static grub_size_t max_glyph_size = 0; ++ grub_size_t cur_glyph_size; + + ensure_comb_space (glyph_id); + +@@ -1531,29 +1532,33 @@ grub_font_construct_glyph (grub_font_t hinted_font, + if (!glyph_id->ncomb && !glyph_id->attributes) + return main_glyph; + +- if (max_glyph_size < sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) ++ if (grub_video_bitmap_calc_1bpp_bufsz (bounds.width, bounds.height, &cur_glyph_size) || ++ grub_add (sizeof (*glyph), cur_glyph_size, &cur_glyph_size)) ++ return main_glyph; ++ ++ if (max_glyph_size < cur_glyph_size) + { + grub_free (glyph); +- max_glyph_size = (sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) * 2; +- if (max_glyph_size < 8) +- max_glyph_size = 8; +- glyph = grub_malloc (max_glyph_size); ++ if (grub_mul (cur_glyph_size, 2, &max_glyph_size)) ++ max_glyph_size = 0; ++ glyph = max_glyph_size > 0 ? grub_malloc (max_glyph_size) : NULL; + } + if (!glyph) + { ++ max_glyph_size = 0; + grub_errno = GRUB_ERR_NONE; + return main_glyph; + } + +- grub_memset (glyph, 0, sizeof (*glyph) +- + (bounds.width * bounds.height +- + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT); ++ grub_memset (glyph, 0, cur_glyph_size); + + glyph->font = main_glyph->font; +- glyph->width = bounds.width; +- glyph->height = bounds.height; +- glyph->offset_x = bounds.x; +- glyph->offset_y = bounds.y; ++ if (bounds.width == 0 || bounds.height == 0 || ++ grub_cast (bounds.width, &glyph->width) || ++ grub_cast (bounds.height, &glyph->height) || ++ grub_cast (bounds.x, &glyph->offset_x) || ++ grub_cast (bounds.y, &glyph->offset_y)) ++ return main_glyph; + + if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR) + grub_font_blit_glyph_mirror (glyph, main_glyph, diff --git a/poky/meta/recipes-bsp/grub/files/CVE-2022-28736-loader-efi-chainloader-Use-grub_loader_set_ex.patch b/poky/meta/recipes-bsp/grub/files/CVE-2022-28736-loader-efi-chainloader-Use-grub_loader_set_ex.patch new file mode 100644 index 0000000000..5741e53f42 --- /dev/null +++ b/poky/meta/recipes-bsp/grub/files/CVE-2022-28736-loader-efi-chainloader-Use-grub_loader_set_ex.patch @@ -0,0 +1,86 @@ +From 04c86e0bb7b58fc2f913f798cdb18934933e532d Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Tue, 5 Apr 2022 11:48:58 +0100 +Subject: [PATCH] loader/efi/chainloader: Use grub_loader_set_ex() + +This ports the EFI chainloader to use grub_loader_set_ex() in order to fix +a use-after-free bug that occurs when grub_cmd_chainloader() is executed +more than once before a boot attempt is performed. + +Fixes: CVE-2022-28736 + +Signed-off-by: Chris Coulson +Reviewed-by: Daniel Kiper + +Upstream-Status: Backport +CVE: CVE-2022-28736 + +Reference to upstream patch: +https://git.savannah.gnu.org/cgit/grub.git/commit/?id=04c86e0bb7b58fc2f913f798cdb18934933e532d + +Signed-off-by: Xiangyu Chen +--- + grub-core/loader/efi/chainloader.c | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index d1602c89b..7557eb269 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -44,11 +44,10 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + static grub_dl_t my_mod; + +-static grub_efi_handle_t image_handle; +- + static grub_err_t +-grub_chainloader_unload (void) ++grub_chainloader_unload (void *context) + { ++ grub_efi_handle_t image_handle = (grub_efi_handle_t) context; + grub_efi_loaded_image_t *loaded_image; + grub_efi_boot_services_t *b; + +@@ -64,8 +63,9 @@ grub_chainloader_unload (void) + } + + static grub_err_t +-grub_chainloader_boot (void) ++grub_chainloader_boot (void *context) + { ++ grub_efi_handle_t image_handle = (grub_efi_handle_t) context; + grub_efi_boot_services_t *b; + grub_efi_status_t status; + grub_efi_uintn_t exit_data_size; +@@ -225,6 +225,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_efi_physical_address_t address = 0; + grub_efi_uintn_t pages = 0; + grub_efi_char16_t *cmdline = NULL; ++ grub_efi_handle_t image_handle = NULL; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); +@@ -405,7 +406,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + efi_call_2 (b->free_pages, address, pages); + grub_free (file_path); + +- grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); ++ grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0); + return 0; + + fail: +@@ -423,10 +424,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + efi_call_2 (b->free_pages, address, pages); + + if (image_handle != NULL) +- { +- efi_call_1 (b->unload_image, image_handle); +- image_handle = NULL; +- } ++ efi_call_1 (b->unload_image, image_handle); + + grub_dl_unref (my_mod); + +-- +2.34.1 + diff --git a/poky/meta/recipes-bsp/grub/files/CVE-2022-3775.patch b/poky/meta/recipes-bsp/grub/files/CVE-2022-3775.patch new file mode 100644 index 0000000000..853efd0486 --- /dev/null +++ b/poky/meta/recipes-bsp/grub/files/CVE-2022-3775.patch @@ -0,0 +1,95 @@ +From fdbe7209152ad6f09a1166f64f162017f2145ba3 Mon Sep 17 00:00:00 2001 +From: Zhang Boyang +Date: Mon, 24 Oct 2022 08:05:35 +0800 +Subject: [PATCH] font: Fix an integer underflow in blit_comb() + +The expression (ctx.bounds.height - combining_glyphs[i]->height) / 2 may +evaluate to a very big invalid value even if both ctx.bounds.height and +combining_glyphs[i]->height are small integers. For example, if +ctx.bounds.height is 10 and combining_glyphs[i]->height is 12, this +expression evaluates to 2147483647 (expected -1). This is because +coordinates are allowed to be negative but ctx.bounds.height is an +unsigned int. So, the subtraction operates on unsigned ints and +underflows to a very big value. The division makes things even worse. +The quotient is still an invalid value even if converted back to int. + +This patch fixes the problem by casting ctx.bounds.height to int. As +a result the subtraction will operate on int and grub_uint16_t which +will be promoted to an int. So, the underflow will no longer happen. Other +uses of ctx.bounds.height (and ctx.bounds.width) are also casted to int, +to ensure coordinates are always calculated on signed integers. + +Fixes: CVE-2022-3775 + +Reported-by: Daniel Axtens +Signed-off-by: Zhang Boyang +Reviewed-by: Daniel Kiper + +Upstream-Status: Backport from +[https://git.savannah.gnu.org/cgit/grub.git/commit/?id=992c06191babc1e109caf40d6a07ec6fdef427af] +CVE: CVE-2022-3775 + +Signed-off-by: Xiangyu Chen + +--- + grub-core/font/font.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/grub-core/font/font.c b/grub-core/font/font.c +index 0ff5525..7b1cbde 100644 +--- a/grub-core/font/font.c ++++ b/grub-core/font/font.c +@@ -1206,12 +1206,12 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + ctx.bounds.height = main_glyph->height; + + above_rightx = main_glyph->offset_x + main_glyph->width; +- above_righty = ctx.bounds.y + ctx.bounds.height; ++ above_righty = ctx.bounds.y + (int) ctx.bounds.height; + + above_leftx = main_glyph->offset_x; +- above_lefty = ctx.bounds.y + ctx.bounds.height; ++ above_lefty = ctx.bounds.y + (int) ctx.bounds.height; + +- below_rightx = ctx.bounds.x + ctx.bounds.width; ++ below_rightx = ctx.bounds.x + (int) ctx.bounds.width; + below_righty = ctx.bounds.y; + + comb = grub_unicode_get_comb (glyph_id); +@@ -1224,7 +1224,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + + if (!combining_glyphs[i]) + continue; +- targetx = (ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x; ++ targetx = ((int) ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x; + /* CGJ is to avoid diacritics reordering. */ + if (comb[i].code + == GRUB_UNICODE_COMBINING_GRAPHEME_JOINER) +@@ -1234,8 +1234,8 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + case GRUB_UNICODE_COMB_OVERLAY: + do_blit (combining_glyphs[i], + targetx, +- (ctx.bounds.height - combining_glyphs[i]->height) / 2 +- - (ctx.bounds.height + ctx.bounds.y), &ctx); ++ ((int) ctx.bounds.height - combining_glyphs[i]->height) / 2 ++ - ((int) ctx.bounds.height + ctx.bounds.y), &ctx); + if (min_devwidth < combining_glyphs[i]->width) + min_devwidth = combining_glyphs[i]->width; + break; +@@ -1308,7 +1308,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + /* Fallthrough. */ + case GRUB_UNICODE_STACK_ATTACHED_ABOVE: + do_blit (combining_glyphs[i], targetx, +- -(ctx.bounds.height + ctx.bounds.y + space ++ -((int) ctx.bounds.height + ctx.bounds.y + space + + combining_glyphs[i]->height), &ctx); + if (min_devwidth < combining_glyphs[i]->width) + min_devwidth = combining_glyphs[i]->width; +@@ -1316,7 +1316,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id, + + case GRUB_UNICODE_COMB_HEBREW_DAGESH: + do_blit (combining_glyphs[i], targetx, +- -(ctx.bounds.height / 2 + ctx.bounds.y ++ -((int) ctx.bounds.height / 2 + ctx.bounds.y + + combining_glyphs[i]->height / 2), &ctx); + if (min_devwidth < combining_glyphs[i]->width) + min_devwidth = combining_glyphs[i]->width; diff --git a/poky/meta/recipes-bsp/grub/files/commands-boot-Add-API-to-pass-context-to-loader.patch b/poky/meta/recipes-bsp/grub/files/commands-boot-Add-API-to-pass-context-to-loader.patch new file mode 100644 index 0000000000..a2c0530f04 --- /dev/null +++ b/poky/meta/recipes-bsp/grub/files/commands-boot-Add-API-to-pass-context-to-loader.patch @@ -0,0 +1,168 @@ +From 14ceb3b3ff6db664649138442b6562c114dcf56e Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Tue, 5 Apr 2022 10:58:28 +0100 +Subject: [PATCH] commands/boot: Add API to pass context to loader + +Loaders rely on global variables for saving context which is consumed +in the boot hook and freed in the unload hook. In the case where a loader +command is executed twice, calling grub_loader_set() a second time executes +the unload hook, but in some cases this runs when the loader's global +context has already been updated, resulting in the updated context being +freed and potential use-after-free bugs when the boot hook is subsequently +called. + +This adds a new API, grub_loader_set_ex(), which allows a loader to specify +context that is passed to its boot and unload hooks. This is an alternative +to requiring that loaders call grub_loader_unset() before mutating their +global context. + +Signed-off-by: Chris Coulson +Reviewed-by: Daniel Kiper + +Upstream-Status: Backport + +Reference to upstream patch: +https://git.savannah.gnu.org/cgit/grub.git/commit/?id=14ceb3b3ff6db664649138442b6562c114dcf56e + +Signed-off-by: Xiangyu Chen +--- + grub-core/commands/boot.c | 66 ++++++++++++++++++++++++++++++++++----- + include/grub/loader.h | 5 +++ + 2 files changed, 63 insertions(+), 8 deletions(-) + +diff --git a/grub-core/commands/boot.c b/grub-core/commands/boot.c +index bbca81e94..61514788e 100644 +--- a/grub-core/commands/boot.c ++++ b/grub-core/commands/boot.c +@@ -27,10 +27,20 @@ + + GRUB_MOD_LICENSE ("GPLv3+"); + +-static grub_err_t (*grub_loader_boot_func) (void); +-static grub_err_t (*grub_loader_unload_func) (void); ++static grub_err_t (*grub_loader_boot_func) (void *context); ++static grub_err_t (*grub_loader_unload_func) (void *context); ++static void *grub_loader_context; + static int grub_loader_flags; + ++struct grub_simple_loader_hooks ++{ ++ grub_err_t (*boot) (void); ++ grub_err_t (*unload) (void); ++}; ++ ++/* Don't heap allocate this to avoid making grub_loader_set() fallible. */ ++static struct grub_simple_loader_hooks simple_loader_hooks; ++ + struct grub_preboot + { + grub_err_t (*preboot_func) (int); +@@ -44,6 +54,29 @@ static int grub_loader_loaded; + static struct grub_preboot *preboots_head = 0, + *preboots_tail = 0; + ++static grub_err_t ++grub_simple_boot_hook (void *context) ++{ ++ struct grub_simple_loader_hooks *hooks; ++ ++ hooks = (struct grub_simple_loader_hooks *) context; ++ return hooks->boot (); ++} ++ ++static grub_err_t ++grub_simple_unload_hook (void *context) ++{ ++ struct grub_simple_loader_hooks *hooks; ++ grub_err_t ret; ++ ++ hooks = (struct grub_simple_loader_hooks *) context; ++ ++ ret = hooks->unload (); ++ grub_memset (hooks, 0, sizeof (*hooks)); ++ ++ return ret; ++} ++ + int + grub_loader_is_loaded (void) + { +@@ -110,28 +143,45 @@ grub_loader_unregister_preboot_hook (struct grub_preboot *hnd) + } + + void +-grub_loader_set (grub_err_t (*boot) (void), +- grub_err_t (*unload) (void), +- int flags) ++grub_loader_set_ex (grub_err_t (*boot) (void *context), ++ grub_err_t (*unload) (void *context), ++ void *context, ++ int flags) + { + if (grub_loader_loaded && grub_loader_unload_func) +- grub_loader_unload_func (); ++ grub_loader_unload_func (grub_loader_context); + + grub_loader_boot_func = boot; + grub_loader_unload_func = unload; ++ grub_loader_context = context; + grub_loader_flags = flags; + + grub_loader_loaded = 1; + } + ++void ++grub_loader_set (grub_err_t (*boot) (void), ++ grub_err_t (*unload) (void), ++ int flags) ++{ ++ grub_loader_set_ex (grub_simple_boot_hook, ++ grub_simple_unload_hook, ++ &simple_loader_hooks, ++ flags); ++ ++ simple_loader_hooks.boot = boot; ++ simple_loader_hooks.unload = unload; ++} ++ + void + grub_loader_unset(void) + { + if (grub_loader_loaded && grub_loader_unload_func) +- grub_loader_unload_func (); ++ grub_loader_unload_func (grub_loader_context); + + grub_loader_boot_func = 0; + grub_loader_unload_func = 0; ++ grub_loader_context = 0; + + grub_loader_loaded = 0; + } +@@ -158,7 +208,7 @@ grub_loader_boot (void) + return err; + } + } +- err = (grub_loader_boot_func) (); ++ err = (grub_loader_boot_func) (grub_loader_context); + + for (cur = preboots_tail; cur; cur = cur->prev) + if (! err) +diff --git a/include/grub/loader.h b/include/grub/loader.h +index b20864282..97f231054 100644 +--- a/include/grub/loader.h ++++ b/include/grub/loader.h +@@ -40,6 +40,11 @@ void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void), + grub_err_t (*unload) (void), + int flags); + ++void EXPORT_FUNC (grub_loader_set_ex) (grub_err_t (*boot) (void *context), ++ grub_err_t (*unload) (void *context), ++ void *context, ++ int flags); ++ + /* Unset current loader, if any. */ + void EXPORT_FUNC (grub_loader_unset) (void); + +-- +2.34.1 + diff --git a/poky/meta/recipes-bsp/grub/files/loader-efi-chainloader-Simplify-the-loader-state.patch b/poky/meta/recipes-bsp/grub/files/loader-efi-chainloader-Simplify-the-loader-state.patch new file mode 100644 index 0000000000..a43025d425 --- /dev/null +++ b/poky/meta/recipes-bsp/grub/files/loader-efi-chainloader-Simplify-the-loader-state.patch @@ -0,0 +1,129 @@ +From 1469983ebb9674753ad333d37087fb8cb20e1dce Mon Sep 17 00:00:00 2001 +From: Chris Coulson +Date: Tue, 5 Apr 2022 10:02:04 +0100 +Subject: [PATCH] loader/efi/chainloader: Simplify the loader state + +The chainloader command retains the source buffer and device path passed +to LoadImage(), requiring the unload hook passed to grub_loader_set() to +free them. It isn't required to retain this state though - they aren't +required by StartImage() or anything else in the boot hook, so clean them +up before grub_cmd_chainloader() finishes. + +Signed-off-by: Chris Coulson +Reviewed-by: Daniel Kiper + +Upstream-Status: Backport + +Reference to upstream patch: +https://git.savannah.gnu.org/cgit/grub.git/commit/?id=1469983ebb9674753ad333d37087fb8cb20e1dce + +Signed-off-by: Xiangyu Chen +--- + grub-core/loader/efi/chainloader.c | 38 +++++++++++++++++------------- + 1 file changed, 21 insertions(+), 17 deletions(-) + +diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c +index 2bd80f4db..d1602c89b 100644 +--- a/grub-core/loader/efi/chainloader.c ++++ b/grub-core/loader/efi/chainloader.c +@@ -44,25 +44,20 @@ GRUB_MOD_LICENSE ("GPLv3+"); + + static grub_dl_t my_mod; + +-static grub_efi_physical_address_t address; +-static grub_efi_uintn_t pages; +-static grub_efi_device_path_t *file_path; + static grub_efi_handle_t image_handle; +-static grub_efi_char16_t *cmdline; + + static grub_err_t + grub_chainloader_unload (void) + { ++ grub_efi_loaded_image_t *loaded_image; + grub_efi_boot_services_t *b; + ++ loaded_image = grub_efi_get_loaded_image (image_handle); ++ if (loaded_image != NULL) ++ grub_free (loaded_image->load_options); ++ + b = grub_efi_system_table->boot_services; + efi_call_1 (b->unload_image, image_handle); +- efi_call_2 (b->free_pages, address, pages); +- +- grub_free (file_path); +- grub_free (cmdline); +- cmdline = 0; +- file_path = 0; + + grub_dl_unref (my_mod); + return GRUB_ERR_NONE; +@@ -140,7 +135,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename) + char *dir_start; + char *dir_end; + grub_size_t size; +- grub_efi_device_path_t *d; ++ grub_efi_device_path_t *d, *file_path; + + dir_start = grub_strchr (filename, ')'); + if (! dir_start) +@@ -222,11 +217,14 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_efi_status_t status; + grub_efi_boot_services_t *b; + grub_device_t dev = 0; +- grub_efi_device_path_t *dp = 0; ++ grub_efi_device_path_t *dp = NULL, *file_path = NULL; + grub_efi_loaded_image_t *loaded_image; + char *filename; + void *boot_image = 0; + grub_efi_handle_t dev_handle = 0; ++ grub_efi_physical_address_t address = 0; ++ grub_efi_uintn_t pages = 0; ++ grub_efi_char16_t *cmdline = NULL; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); +@@ -234,11 +232,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + + grub_dl_ref (my_mod); + +- /* Initialize some global variables. */ +- address = 0; +- image_handle = 0; +- file_path = 0; +- + b = grub_efi_system_table->boot_services; + + file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE); +@@ -408,6 +401,10 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + grub_file_close (file); + grub_device_close (dev); + ++ /* We're finished with the source image buffer and file path now. */ ++ efi_call_2 (b->free_pages, address, pages); ++ grub_free (file_path); ++ + grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0); + return 0; + +@@ -419,11 +416,18 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), + if (file) + grub_file_close (file); + ++ grub_free (cmdline); + grub_free (file_path); + + if (address) + efi_call_2 (b->free_pages, address, pages); + ++ if (image_handle != NULL) ++ { ++ efi_call_1 (b->unload_image, image_handle); ++ image_handle = NULL; ++ } ++ + grub_dl_unref (my_mod); + + return grub_errno; +-- +2.34.1 + diff --git a/poky/meta/recipes-bsp/grub/grub2.inc b/poky/meta/recipes-bsp/grub/grub2.inc index 7161c4560b..bf7aba6b1c 100644 --- a/poky/meta/recipes-bsp/grub/grub2.inc +++ b/poky/meta/recipes-bsp/grub/grub2.inc @@ -34,6 +34,12 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ file://CVE-2022-28735-kern-efi-sb-Reject-non-kernel-files-in-the-shim_lock.patch \ file://0001-configure-Remove-obsoleted-malign-jumps-loops-functi.patch \ file://0002-configure-Check-for-falign-jumps-1-beside-falign-loo.patch \ + file://loader-efi-chainloader-Simplify-the-loader-state.patch \ + file://commands-boot-Add-API-to-pass-context-to-loader.patch \ + file://CVE-2022-28736-loader-efi-chainloader-Use-grub_loader_set_ex.patch\ + file://0001-font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch \ + file://CVE-2022-2601.patch \ + file://CVE-2022-3775.patch \ " SRC_URI[sha256sum] = "23b64b4c741569f9426ed2e3d0e6780796fca081bee4c99f62aa3f53ae803f5f" diff --git a/poky/meta/recipes-bsp/pciutils/pciutils/configure.patch b/poky/meta/recipes-bsp/pciutils/pciutils/configure.patch index cf55b94808..91bd255899 100644 --- a/poky/meta/recipes-bsp/pciutils/pciutils/configure.patch +++ b/poky/meta/recipes-bsp/pciutils/pciutils/configure.patch @@ -1,4 +1,4 @@ -From 502c01e180d9085fcbeaf2fb46239999c4f335d2 Mon Sep 17 00:00:00 2001 +From 42e7d5f5f1d84a56b125aa05de33d31e28ad1124 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 31 Dec 2008 17:20:38 +0000 Subject: [PATCH] pciutils: Upgarde 2.2.4 -> 3.0.3 @@ -24,20 +24,20 @@ Upstream-Status: Inappropriate [embedded specific] 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile -index 9319bb4..78a2d54 100644 +index 3df076d..9b247d3 100644 --- a/Makefile +++ b/Makefile -@@ -108,7 +108,7 @@ example$(EXEEXT): example.o lib/$(PCILIB) +@@ -110,7 +110,7 @@ example$(EXEEXT): example.o lib/$(PCIIMPLIB) example.o: example.c $(PCIINC) %$(EXEEXT): %.o - $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@ + $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LIB_LDLIBS) $(LDLIBS) -o $@ - %.8 %.7 %.5: %.man - M=`echo $(DATE) | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <$< >$@ "s/@TODAY@/$$M/;s/@VERSION@/pciutils-$(VERSION)/;s#@IDSDIR@#$(IDSDIR)#;s#@PCI_IDS@#$(PCI_IDS)#" + ifdef PCI_OS_WINDOWS + comma := , diff --git a/lib/configure b/lib/configure -index 45a416a..1afdaa6 100755 +index 57b064b..b269332 100755 --- a/lib/configure +++ b/lib/configure @@ -9,6 +9,10 @@ echo_n() { diff --git a/poky/meta/recipes-bsp/pciutils/pciutils_3.8.0.bb b/poky/meta/recipes-bsp/pciutils/pciutils_3.8.0.bb deleted file mode 100644 index 4f57342e1e..0000000000 --- a/poky/meta/recipes-bsp/pciutils/pciutils_3.8.0.bb +++ /dev/null @@ -1,64 +0,0 @@ -SUMMARY = "PCI utilities" -DESCRIPTION = 'The PCI Utilities package contains a library for portable access \ -to PCI bus configuration space and several utilities based on this library.' -HOMEPAGE = "http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml" -SECTION = "console/utils" - -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" -# Can drop make-native when all systems have make 4.3 -# https://git.savannah.gnu.org/cgit/make.git/commit/?id=b90fabc8d6f34fb37d428dc0fb1b8b1951a9fbed -# causes space issues in lib/libpci.pc -DEPENDS = "zlib kmod make-native" - -SRC_URI = "${KERNELORG_MIRROR}/software/utils/pciutils/pciutils-${PV}.tar.xz \ - file://configure.patch" - -SRC_URI[sha256sum] = "91edbd0429a84705c9ad156d4ff38ccc724d41ea54c4c5b88e38e996f8a34f05" - -inherit multilib_header pkgconfig update-alternatives - -PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'hwdb', '', d)}" -PACKAGECONFIG[hwdb] = "HWDB=yes,HWDB=no,udev" - -PCI_CONF_FLAG = "ZLIB=yes DNS=yes SHARED=yes STRIP= LIBDIR=${libdir}" - -# see configure.patch -do_configure () { - ( - cd lib && \ - # PACKAGECONFIG_CONFARGS for this recipe could only possibly contain 'HWDB=yes/no', - # so we put it before ./configure - ${PCI_CONF_FLAG} ${PACKAGECONFIG_CONFARGS} ./configure ${PV} ${datadir} ${TARGET_OS} ${TARGET_ARCH} - ) -} - -export PREFIX = "${prefix}" -export SBINDIR = "${sbindir}" -export SHAREDIR = "${datadir}" -export MANDIR = "${mandir}" - -EXTRA_OEMAKE = "-e MAKEFLAGS= ${PCI_CONF_FLAG}" - -ASNEEDED = "" - -# The configure script breaks if the HOST variable is set -HOST[unexport] = "1" - -do_install () { - oe_runmake DESTDIR=${D} install install-lib - - install -d ${D}${bindir} - - oe_multilib_header pci/config.h -} - -PACKAGES =+ "${PN}-ids libpci" -FILES:${PN}-ids = "${datadir}/pci.ids*" -FILES:libpci = "${libdir}/libpci.so.*" -SUMMARY:${PN}-ids = "PCI utilities - device ID database" -DESCRIPTION:${PN}-ids = "Package providing the PCI device ID database for pciutils." -RDEPENDS:${PN} += "${PN}-ids" - -ALTERNATIVE:${PN} = "lspci" -ALTERNATIVE_PRIORITY = "100" diff --git a/poky/meta/recipes-bsp/pciutils/pciutils_3.9.0.bb b/poky/meta/recipes-bsp/pciutils/pciutils_3.9.0.bb new file mode 100644 index 0000000000..f9fe7aa76a --- /dev/null +++ b/poky/meta/recipes-bsp/pciutils/pciutils_3.9.0.bb @@ -0,0 +1,64 @@ +SUMMARY = "PCI utilities" +DESCRIPTION = 'The PCI Utilities package contains a library for portable access \ +to PCI bus configuration space and several utilities based on this library.' +HOMEPAGE = "http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml" +SECTION = "console/utils" + +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" +# Can drop make-native when all systems have make 4.3 +# https://git.savannah.gnu.org/cgit/make.git/commit/?id=b90fabc8d6f34fb37d428dc0fb1b8b1951a9fbed +# causes space issues in lib/libpci.pc +DEPENDS = "zlib kmod make-native" + +SRC_URI = "${KERNELORG_MIRROR}/software/utils/pciutils/pciutils-${PV}.tar.xz \ + file://configure.patch" + +SRC_URI[sha256sum] = "cdea7ae97239dee23249a09c68a19a287a3f109fbeb2c232ebb616cb38599012" + +inherit multilib_header pkgconfig update-alternatives + +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'hwdb', '', d)}" +PACKAGECONFIG[hwdb] = "HWDB=yes,HWDB=no,udev" + +PCI_CONF_FLAG = "ZLIB=yes DNS=yes SHARED=yes STRIP= LIBDIR=${libdir}" + +# see configure.patch +do_configure () { + ( + cd lib && \ + # PACKAGECONFIG_CONFARGS for this recipe could only possibly contain 'HWDB=yes/no', + # so we put it before ./configure + ${PCI_CONF_FLAG} ${PACKAGECONFIG_CONFARGS} ./configure ${PV} ${datadir} ${TARGET_OS} ${TARGET_ARCH} + ) +} + +export PREFIX = "${prefix}" +export SBINDIR = "${sbindir}" +export SHAREDIR = "${datadir}" +export MANDIR = "${mandir}" + +EXTRA_OEMAKE = "-e MAKEFLAGS= ${PCI_CONF_FLAG}" + +ASNEEDED = "" + +# The configure script breaks if the HOST variable is set +HOST[unexport] = "1" + +do_install () { + oe_runmake DESTDIR=${D} install install-lib + + install -d ${D}${bindir} + + oe_multilib_header pci/config.h +} + +PACKAGES =+ "${PN}-ids libpci" +FILES:${PN}-ids = "${datadir}/pci.ids*" +FILES:libpci = "${libdir}/libpci.so.*" +SUMMARY:${PN}-ids = "PCI utilities - device ID database" +DESCRIPTION:${PN}-ids = "Package providing the PCI device ID database for pciutils." +RDEPENDS:${PN} += "${PN}-ids" + +ALTERNATIVE:${PN} = "lspci" +ALTERNATIVE_PRIORITY = "100" diff --git a/poky/meta/recipes-bsp/u-boot/u-boot.inc b/poky/meta/recipes-bsp/u-boot/u-boot.inc index 15e949b8b4..4636dd733b 100644 --- a/poky/meta/recipes-bsp/u-boot/u-boot.inc +++ b/poky/meta/recipes-bsp/u-boot/u-boot.inc @@ -206,6 +206,7 @@ FILES:${PN}-env = " \ FILES:${PN}-extlinux = "${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}" RDEPENDS:${PN} += "${@bb.utils.contains('UBOOT_EXTLINUX', '1', '${PN}-extlinux', '', d)}" +SYSROOT_DIRS += "/boot" FILES:${PN} = "/boot ${datadir}" RDEPENDS:${PN} += "${PN}-env" diff --git a/poky/meta/recipes-bsp/usbutils/usbutils_014.bb b/poky/meta/recipes-bsp/usbutils/usbutils_014.bb deleted file mode 100644 index e728f1a190..0000000000 --- a/poky/meta/recipes-bsp/usbutils/usbutils_014.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "Host side USB console utilities" -DESCRIPTION = "Contains the lsusb utility for inspecting the devices connected to the USB bus." -HOMEPAGE = "http://www.linux-usb.org" -SECTION = "base" - -LICENSE = "GPL-2.0-or-later & (GPL-2.0-only | GPL-3.0-only)" -# License files went missing in 010, when 011 is released add LICENSES/* back -LIC_FILES_CHKSUM = "file://lsusb.c;endline=1;md5=7226e442a172bcf25807246d7ef1eba1 \ - file://lsusb.py.in;beginline=2;endline=2;md5=c443ada211d701156e42ea36d41625b3 \ - " - -DEPENDS = "libusb1 virtual/libiconv udev" - -SRC_URI = "${KERNELORG_MIRROR}/linux/utils/usb/usbutils/usbutils-${PV}.tar.gz \ - " -SRC_URI[sha256sum] = "59398ab012888dfe0fd12e447b45f36801e9d7b71d9a865fc38e2f549afdb9d0" - -inherit autotools pkgconfig update-alternatives - -ALTERNATIVE:${PN} = "lsusb" -ALTERNATIVE_PRIORITY = "100" - -# The binaries are mostly GPL-2.0-or-later apart from lsusb.py which is -# GPL-2.0-only or GPL-3.0-only. -LICENSE:${PN} = "GPL-2.0-or-later" -LICENSE:${PN}-python = "GPL-2.0-only | GPL-3.0-only" - -RRECOMMENDS:${PN} = "udev-hwdb" - -PACKAGE_BEFORE_PN =+ "${PN}-python" -FILES:${PN}-python += "${bindir}/lsusb.py" -RDEPENDS:${PN}-python = "python3-core" diff --git a/poky/meta/recipes-bsp/usbutils/usbutils_015.bb b/poky/meta/recipes-bsp/usbutils/usbutils_015.bb new file mode 100644 index 0000000000..a30037b693 --- /dev/null +++ b/poky/meta/recipes-bsp/usbutils/usbutils_015.bb @@ -0,0 +1,32 @@ +SUMMARY = "Host side USB console utilities" +DESCRIPTION = "Contains the lsusb utility for inspecting the devices connected to the USB bus." +HOMEPAGE = "http://www.linux-usb.org" +SECTION = "base" + +LICENSE = "GPL-2.0-or-later & (GPL-2.0-only | GPL-3.0-only)" +# License files went missing in 010, when 011 is released add LICENSES/* back +LIC_FILES_CHKSUM = "file://lsusb.c;endline=1;md5=7226e442a172bcf25807246d7ef1eba1 \ + file://lsusb.py.in;beginline=2;endline=2;md5=c443ada211d701156e42ea36d41625b3 \ + " + +DEPENDS = "libusb1 virtual/libiconv udev" + +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/usb/usbutils/usbutils-${PV}.tar.gz \ + " +SRC_URI[sha256sum] = "2b8140664578f39c3f6f0166a1b950f8655304e63e3d7f89899acb99bc5cb8e7" + +inherit autotools pkgconfig update-alternatives + +ALTERNATIVE:${PN} = "lsusb" +ALTERNATIVE_PRIORITY = "100" + +# The binaries are mostly GPL-2.0-or-later apart from lsusb.py which is +# GPL-2.0-only or GPL-3.0-only. +LICENSE:${PN} = "GPL-2.0-or-later" +LICENSE:${PN}-python = "GPL-2.0-only | GPL-3.0-only" + +RRECOMMENDS:${PN} = "udev-hwdb" + +PACKAGE_BEFORE_PN =+ "${PN}-python" +FILES:${PN}-python += "${bindir}/lsusb.py" +RDEPENDS:${PN}-python = "python3-core" diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/0001-avoid-start-failure-with-bind-user.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.10/0001-avoid-start-failure-with-bind-user.patch new file mode 100644 index 0000000000..ec1bc7b567 --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/0001-avoid-start-failure-with-bind-user.patch @@ -0,0 +1,27 @@ +From 31dde3562f287429eea94b77250d184818b49063 Mon Sep 17 00:00:00 2001 +From: Chen Qi +Date: Mon, 15 Oct 2018 16:55:09 +0800 +Subject: [PATCH] avoid start failure with bind user + +Upstream-Status: Pending + +Signed-off-by: Chen Qi +--- + init.d | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/init.d b/init.d +index b2eec60..6e03936 100644 +--- a/init.d ++++ b/init.d +@@ -57,6 +57,7 @@ case "$1" in + modprobe capability >/dev/null 2>&1 || true + if [ ! -f /etc/bind/rndc.key ]; then + /usr/sbin/rndc-confgen -a -b 512 ++ chown root:bind /etc/bind/rndc.key >/dev/null 2>&1 || true + chmod 0640 /etc/bind/rndc.key + fi + if [ -f /var/run/named/named.pid ]; then +-- +2.7.4 + diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/0001-named-lwresd-V-and-start-log-hide-build-options.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.10/0001-named-lwresd-V-and-start-log-hide-build-options.patch new file mode 100644 index 0000000000..4c10f33f04 --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/0001-named-lwresd-V-and-start-log-hide-build-options.patch @@ -0,0 +1,35 @@ +From 4e83392e840fa7b05e778710b8c202d102477a13 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Mon, 27 Aug 2018 21:24:20 +0800 +Subject: [PATCH] `named/lwresd -V' and start log hide build options + +The build options expose build path directories, so hide them. +[snip] +$ named -V +|built by make with *** (options are hidden) +[snip] + +Upstream-Status: Inappropriate [oe-core specific] + +Signed-off-by: Hongxu Jia + +Refreshed for 9.16.0 +Signed-off-by: Armin Kuster + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index bf20690..c5d330f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -35,7 +35,7 @@ AC_DEFINE([PACKAGE_VERSION_EXTRA], ["][bind_VERSION_EXTRA]["], [BIND 9 Extra par + AC_DEFINE([PACKAGE_DESCRIPTION], [m4_ifnblank(bind_DESCRIPTION, [" ]bind_DESCRIPTION["], [])], [An extra string to print after PACKAGE_STRING]) + AC_DEFINE([PACKAGE_SRCID], ["][bind_SRCID]["], [A short hash from git]) + +-bind_CONFIGARGS="${ac_configure_args:-default}" ++bind_CONFIGARGS="(removed for reproducibility)" + AC_DEFINE_UNQUOTED([PACKAGE_CONFIGARGS], ["$bind_CONFIGARGS"], [Either 'defaults' or used ./configure options]) + + AC_DEFINE([PACKAGE_BUILDER], ["make"], [make or Visual Studio]) diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/bind-ensure-searching-for-json-headers-searches-sysr.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.10/bind-ensure-searching-for-json-headers-searches-sysr.patch new file mode 100644 index 0000000000..f1abd179e8 --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/bind-ensure-searching-for-json-headers-searches-sysr.patch @@ -0,0 +1,47 @@ +From 246087f89e9434b726c7884e4c0964f71084f091 Mon Sep 17 00:00:00 2001 +From: Paul Gortmaker +Date: Tue, 9 Jun 2015 11:22:00 -0400 +Subject: [PATCH] bind: ensure searching for json headers searches sysroot + +Bind can fail configure by detecting headers w/o libs[1], or +it can fail the host contamination check as per below: + +ERROR: This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. +Rerun configure task after fixing this. The path was 'build/tmp/work/core2-64-poky-linux/bind/9.10.2-r1/build' +ERROR: Function failed: do_qa_configure +ERROR: Logfile of failure stored in: build/tmp/work/core2-64-poky-linux/bind/9.10.2-r1/temp/log.do_configure.5242 +ERROR: Task 5 (meta/recipes-connectivity/bind/bind_9.10.2.bb, do_configure) failed with exit code '1' +NOTE: Tasks Summary: Attempted 773 tasks of which 768 didn't need to be rerun and 1 failed. +No currently running tasks (773 of 781) + +Summary: 1 task failed: + /meta/recipes-connectivity/bind/bind_9.10.2.bb, do_configure + +One way to fix it would be to unconditionally disable json in bind +configure[2] but here we fix it by using the path to where we would +put the header if we had json in the sysroot, in case someone wants +to make use of the combination some day. + +[1] https://trac.macports.org/ticket/45305 +[2] https://trac.macports.org/changeset/126406 + +Upstream-Status: Inappropriate [OE Specific] +Signed-off-by: Paul Gortmaker + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 10e8bf6..bf20690 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -814,7 +814,7 @@ AS_CASE([$with_lmdb], + [no],[], + [auto|yes], [PKG_CHECK_MODULES([LMDB], [lmdb], + [ac_lib_lmdb_found=yes], +- [for ac_lib_lmdb_path in /usr /usr/local /opt /opt/local; do ++ [for ac_lib_lmdb_path in "${STAGING_INCDIR}"; do + AX_LIB_LMDB([$ac_lib_lmdb_path], + [ac_lib_lmdb_found=yes + break]) diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/bind9 b/poky/meta/recipes-connectivity/bind/bind-9.18.10/bind9 new file mode 100644 index 0000000000..968679ff7f --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/bind9 @@ -0,0 +1,2 @@ +# startup options for the server +OPTIONS="-u bind" diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/conf.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.10/conf.patch new file mode 100644 index 0000000000..aa3642acec --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/conf.patch @@ -0,0 +1,330 @@ +Upstream-Status: Inappropriate [configuration] + +the patch is imported from openembedded project + +11/30/2010 - Qing He + +diff -urN bind-9.3.1.orig/conf/db.0 bind-9.3.1/conf/db.0 +--- bind-9.3.1.orig/conf/db.0 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/db.0 2005-07-10 22:14:00.000000000 +0200 +@@ -0,0 +1,12 @@ ++; ++; BIND reverse data file for broadcast zone ++; ++$TTL 604800 ++@ IN SOA localhost. root.localhost. ( ++ 1 ; Serial ++ 604800 ; Refresh ++ 86400 ; Retry ++ 2419200 ; Expire ++ 604800 ) ; Negative Cache TTL ++; ++@ IN NS localhost. +diff -urN bind-9.3.1.orig/conf/db.127 bind-9.3.1/conf/db.127 +--- bind-9.3.1.orig/conf/db.127 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/db.127 2005-07-10 22:14:00.000000000 +0200 +@@ -0,0 +1,13 @@ ++; ++; BIND reverse data file for local loopback interface ++; ++$TTL 604800 ++@ IN SOA localhost. root.localhost. ( ++ 1 ; Serial ++ 604800 ; Refresh ++ 86400 ; Retry ++ 2419200 ; Expire ++ 604800 ) ; Negative Cache TTL ++; ++@ IN NS localhost. ++1.0.0 IN PTR localhost. +diff -urN bind-9.3.1.orig/conf/db.empty bind-9.3.1/conf/db.empty +--- bind-9.3.1.orig/conf/db.empty 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/db.empty 2005-07-10 22:14:00.000000000 +0200 +@@ -0,0 +1,14 @@ ++; BIND reverse data file for empty rfc1918 zone ++; ++; DO NOT EDIT THIS FILE - it is used for multiple zones. ++; Instead, copy it, edit named.conf, and use that copy. ++; ++$TTL 86400 ++@ IN SOA localhost. root.localhost. ( ++ 1 ; Serial ++ 604800 ; Refresh ++ 86400 ; Retry ++ 2419200 ; Expire ++ 86400 ) ; Negative Cache TTL ++; ++@ IN NS localhost. +diff -urN bind-9.3.1.orig/conf/db.255 bind-9.3.1/conf/db.255 +--- bind-9.3.1.orig/conf/db.255 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/db.255 2005-07-10 22:14:00.000000000 +0200 +@@ -0,0 +1,12 @@ ++; ++; BIND reserve data file for broadcast zone ++; ++$TTL 604800 ++@ IN SOA localhost. root.localhost. ( ++ 1 ; Serial ++ 604800 ; Refresh ++ 86400 ; Retry ++ 2419200 ; Expire ++ 604800 ) ; Negative Cache TTL ++; ++@ IN NS localhost. +diff -urN bind-9.3.1.orig/conf/db.local bind-9.3.1/conf/db.local +--- bind-9.3.1.orig/conf/db.local 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/db.local 2005-07-10 22:14:00.000000000 +0200 +@@ -0,0 +1,13 @@ ++; ++; BIND data file for local loopback interface ++; ++$TTL 604800 ++@ IN SOA localhost. root.localhost. ( ++ 1 ; Serial ++ 604800 ; Refresh ++ 86400 ; Retry ++ 2419200 ; Expire ++ 604800 ) ; Negative Cache TTL ++; ++@ IN NS localhost. ++@ IN A 127.0.0.1 +diff -urN bind-9.3.1.orig/conf/db.root bind-9.3.1/conf/db.root +--- bind-9.3.1.orig/conf/db.root 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/db.root 2005-07-10 22:14:00.000000000 +0200 +@@ -0,0 +1,45 @@ ++ ++; <<>> DiG 9.2.3 <<>> ns . @a.root-servers.net. ++;; global options: printcmd ++;; Got answer: ++;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18944 ++;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13 ++ ++;; QUESTION SECTION: ++;. IN NS ++ ++;; ANSWER SECTION: ++. 518400 IN NS A.ROOT-SERVERS.NET. ++. 518400 IN NS B.ROOT-SERVERS.NET. ++. 518400 IN NS C.ROOT-SERVERS.NET. ++. 518400 IN NS D.ROOT-SERVERS.NET. ++. 518400 IN NS E.ROOT-SERVERS.NET. ++. 518400 IN NS F.ROOT-SERVERS.NET. ++. 518400 IN NS G.ROOT-SERVERS.NET. ++. 518400 IN NS H.ROOT-SERVERS.NET. ++. 518400 IN NS I.ROOT-SERVERS.NET. ++. 518400 IN NS J.ROOT-SERVERS.NET. ++. 518400 IN NS K.ROOT-SERVERS.NET. ++. 518400 IN NS L.ROOT-SERVERS.NET. ++. 518400 IN NS M.ROOT-SERVERS.NET. ++ ++;; ADDITIONAL SECTION: ++A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4 ++B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201 ++C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12 ++D.ROOT-SERVERS.NET. 3600000 IN A 128.8.10.90 ++E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10 ++F.ROOT-SERVERS.NET. 3600000 IN A 192.5.5.241 ++G.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4 ++H.ROOT-SERVERS.NET. 3600000 IN A 128.63.2.53 ++I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17 ++J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30 ++K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129 ++L.ROOT-SERVERS.NET. 3600000 IN A 198.32.64.12 ++M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33 ++ ++;; Query time: 81 msec ++;; SERVER: 198.41.0.4#53(a.root-servers.net.) ++;; WHEN: Sun Feb 1 11:27:14 2004 ++;; MSG SIZE rcvd: 436 ++ +diff -urN bind-9.3.1.orig/conf/named.conf bind-9.3.1/conf/named.conf +--- bind-9.3.1.orig/conf/named.conf 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/named.conf 2005-07-10 22:33:46.000000000 +0200 +@@ -0,0 +1,49 @@ ++// This is the primary configuration file for the BIND DNS server named. ++// ++// If you are just adding zones, please do that in /etc/bind/named.conf.local ++ ++include "/etc/bind/named.conf.options"; ++ ++// prime the server with knowledge of the root servers ++zone "." { ++ type hint; ++ file "/etc/bind/db.root"; ++}; ++ ++// be authoritative for the localhost forward and reverse zones, and for ++// broadcast zones as per RFC 1912 ++ ++zone "localhost" { ++ type master; ++ file "/etc/bind/db.local"; ++}; ++ ++zone "127.in-addr.arpa" { ++ type master; ++ file "/etc/bind/db.127"; ++}; ++ ++zone "0.in-addr.arpa" { ++ type master; ++ file "/etc/bind/db.0"; ++}; ++ ++zone "255.in-addr.arpa" { ++ type master; ++ file "/etc/bind/db.255"; ++}; ++ ++// zone "com" { type delegation-only; }; ++// zone "net" { type delegation-only; }; ++ ++// From the release notes: ++// Because many of our users are uncomfortable receiving undelegated answers ++// from root or top level domains, other than a few for whom that behaviour ++// has been trusted and expected for quite some length of time, we have now ++// introduced the "root-delegations-only" feature which applies delegation-only ++// logic to all top level domains, and to the root domain. An exception list ++// should be specified, including "MUSEUM" and "DE", and any other top level ++// domains from whom undelegated responses are expected and trusted. ++// root-delegation-only exclude { "DE"; "MUSEUM"; }; ++ ++include "/etc/bind/named.conf.local"; +diff -urN bind-9.3.1.orig/conf/named.conf.local bind-9.3.1/conf/named.conf.local +--- bind-9.3.1.orig/conf/named.conf.local 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/named.conf.local 2005-07-10 22:14:06.000000000 +0200 +@@ -0,0 +1,8 @@ ++// ++// Do any local configuration here ++// ++ ++// Consider adding the 1918 zones here, if they are not used in your ++// organization ++//include "/etc/bind/zones.rfc1918"; ++ +diff -urN bind-9.3.1.orig/conf/named.conf.options bind-9.3.1/conf/named.conf.options +--- bind-9.3.1.orig/conf/named.conf.options 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/named.conf.options 2005-07-10 22:14:06.000000000 +0200 +@@ -0,0 +1,24 @@ ++options { ++ directory "/var/cache/bind"; ++ ++ // If there is a firewall between you and nameservers you want ++ // to talk to, you might need to uncomment the query-source ++ // directive below. Previous versions of BIND always asked ++ // questions using port 53, but BIND 8.1 and later use an unprivileged ++ // port by default. ++ ++ // query-source address * port 53; ++ ++ // If your ISP provided one or more IP addresses for stable ++ // nameservers, you probably want to use them as forwarders. ++ // Uncomment the following block, and insert the addresses replacing ++ // the all-0's placeholder. ++ ++ // forwarders { ++ // 0.0.0.0; ++ // }; ++ ++ auth-nxdomain no; # conform to RFC1035 ++ ++}; ++ +diff -urN bind-9.3.1.orig/conf/zones.rfc1918 bind-9.3.1/conf/zones.rfc1918 +--- bind-9.3.1.orig/conf/zones.rfc1918 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/conf/zones.rfc1918 2005-07-10 22:14:10.000000000 +0200 +@@ -0,0 +1,20 @@ ++zone "10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++ ++zone "16.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "17.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "18.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "19.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "20.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "21.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "22.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "23.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "24.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "25.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "26.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "27.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "28.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "29.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "30.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++zone "31.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; ++ ++zone "168.192.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; +diff -urN bind-9.3.1.orig/init.d bind-9.3.1/init.d +--- bind-9.3.1.orig/init.d 1970-01-01 01:00:00.000000000 +0100 ++++ bind-9.3.1/init.d 2005-07-10 23:09:58.000000000 +0200 +@@ -0,0 +1,70 @@ ++#!/bin/sh ++ ++PATH=/sbin:/bin:/usr/sbin:/usr/bin ++ ++# for a chrooted server: "-u bind -t /var/lib/named" ++# Don't modify this line, change or create /etc/default/bind9. ++OPTIONS="" ++ ++test -f /etc/default/bind9 && . /etc/default/bind9 ++ ++test -x /usr/sbin/rndc || exit 0 ++ ++case "$1" in ++ start) ++ echo -n "Starting domain name service: named" ++ ++ modprobe capability >/dev/null 2>&1 || true ++ if [ ! -f /etc/bind/rndc.key ]; then ++ /usr/sbin/rndc-confgen -a -b 512 ++ chmod 0640 /etc/bind/rndc.key ++ fi ++ if [ -f /var/run/named/named.pid ]; then ++ ps `cat /var/run/named/named.pid` > /dev/null && exit 1 ++ fi ++ ++ # dirs under /var/run can go away on reboots. ++ mkdir -p /var/run/named ++ mkdir -p /var/cache/bind ++ chmod 775 /var/run/named ++ chown root:bind /var/run/named >/dev/null 2>&1 || true ++ ++ if [ ! -x /usr/sbin/named ]; then ++ echo "named binary missing - not starting" ++ exit 1 ++ fi ++ if start-stop-daemon --start --quiet --exec /usr/sbin/named \ ++ --pidfile /var/run/named/named.pid -- $OPTIONS; then ++ if [ -x /sbin/resolvconf ] ; then ++ echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo ++ fi ++ fi ++ echo "." ++ ;; ++ ++ stop) ++ echo -n "Stopping domain name service: named" ++ if [ -x /sbin/resolvconf ]; then ++ /sbin/resolvconf -d lo ++ fi ++ /usr/sbin/rndc stop >/dev/null 2>&1 ++ echo "." ++ ;; ++ ++ reload) ++ /usr/sbin/rndc reload ++ ;; ++ ++ restart|force-reload) ++ $0 stop ++ sleep 2 ++ $0 start ++ ;; ++ ++ *) ++ echo "Usage: /etc/init.d/bind {start|stop|reload|restart|force-reload}" >&2 ++ exit 1 ++ ;; ++esac ++ ++exit 0 diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/generate-rndc-key.sh b/poky/meta/recipes-connectivity/bind/bind-9.18.10/generate-rndc-key.sh new file mode 100644 index 0000000000..633e29c0e6 --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/generate-rndc-key.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ ! -s /etc/bind/rndc.key ]; then + echo -n "Generating /etc/bind/rndc.key:" + /usr/sbin/rndc-confgen -a -b 512 + chown root:bind /etc/bind/rndc.key + chmod 0640 /etc/bind/rndc.key +fi diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/init.d-add-support-for-read-only-rootfs.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.10/init.d-add-support-for-read-only-rootfs.patch new file mode 100644 index 0000000000..11db95ede1 --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/init.d-add-support-for-read-only-rootfs.patch @@ -0,0 +1,65 @@ +Subject: init.d: add support for read-only rootfs + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Chen Qi +--- + init.d | 40 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + +diff --git a/init.d b/init.d +index 0111ed4..24677c8 100644 +--- a/init.d ++++ b/init.d +@@ -6,8 +6,48 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin + # Don't modify this line, change or create /etc/default/bind9. + OPTIONS="" + ++test -f /etc/default/rcS && . /etc/default/rcS + test -f /etc/default/bind9 && . /etc/default/bind9 + ++# This function is here because it's possible that /var and / are on different partitions. ++is_on_read_only_partition () { ++ DIRECTORY=$1 ++ dir=`readlink -f $DIRECTORY` ++ while true; do ++ if [ ! -d "$dir" ]; then ++ echo "ERROR: $dir is not a directory" ++ exit 1 ++ else ++ for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; \ ++ END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do ++ [ "$flag" = "FOUND" ] && partition="read-write" ++ [ "$flag" = "ro" ] && { partition="read-only"; break; } ++ done ++ if [ "$dir" = "/" -o -n "$partition" ]; then ++ break ++ else ++ dir=`dirname $dir` ++ fi ++ fi ++ done ++ [ "$partition" = "read-only" ] && echo "yes" || echo "no" ++} ++ ++bind_mount () { ++ olddir=$1 ++ newdir=$2 ++ mkdir -p $olddir ++ cp -a $newdir/* $olddir ++ mount --bind $olddir $newdir ++} ++ ++# Deal with read-only rootfs ++if [ "$ROOTFS_READ_ONLY" = "yes" ]; then ++ [ "$VERBOSE" != "no" ] && echo "WARN: start bind service in read-only rootfs" ++ [ `is_on_read_only_partition /etc/bind` = "yes" ] && bind_mount /var/volatile/bind/etc /etc/bind ++ [ `is_on_read_only_partition /var/named` = "yes" ] && bind_mount /var/volatile/bind/named /var/named ++fi ++ + test -x /usr/sbin/rndc || exit 0 + + case "$1" in +-- +1.7.9.5 + diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/make-etc-initd-bind-stop-work.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.10/make-etc-initd-bind-stop-work.patch new file mode 100644 index 0000000000..146f3e35db --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/make-etc-initd-bind-stop-work.patch @@ -0,0 +1,42 @@ +bind: make "/etc/init.d/bind stop" work + +Upstream-Status: Inappropriate [configuration] + +Add some configurations, make rndc command be able to controls +the named daemon. + +Signed-off-by: Roy Li +--- + conf/named.conf | 5 +++++ + conf/rndc.conf | 5 +++++ + 2 files changed, 10 insertions(+), 0 deletions(-) + create mode 100644 conf/rndc.conf + +diff --git a/conf/named.conf b/conf/named.conf +index 95829cf..c8899e7 100644 +--- a/conf/named.conf ++++ b/conf/named.conf +@@ -47,3 +47,8 @@ zone "255.in-addr.arpa" { + // root-delegation-only exclude { "DE"; "MUSEUM"; }; + + include "/etc/bind/named.conf.local"; ++include "/etc/bind/rndc.key" ; ++controls { ++ inet 127.0.0.1 allow { localhost; } ++ keys { rndc-key; }; ++}; +diff --git a/conf/rndc.conf b/conf/rndc.conf +new file mode 100644 +index 0000000..a0b481d +--- /dev/null ++++ b/conf/rndc.conf +@@ -0,0 +1,5 @@ ++include "/etc/bind/rndc.key"; ++options { ++ default-server localhost; ++ default-key rndc-key; ++}; + +-- +1.7.5.4 + diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.10/named.service b/poky/meta/recipes-connectivity/bind/bind-9.18.10/named.service new file mode 100644 index 0000000000..cda56ef015 --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind-9.18.10/named.service @@ -0,0 +1,22 @@ +[Unit] +Description=Berkeley Internet Name Domain (DNS) +Wants=nss-lookup.target +Before=nss-lookup.target +After=network.target + +[Service] +Type=forking +EnvironmentFile=-/etc/default/bind9 +PIDFile=/run/named/named.pid + +ExecStartPre=@SBINDIR@/generate-rndc-key.sh +ExecStart=@SBINDIR@/named $OPTIONS + +ExecReload=@BASE_BINDIR@/sh -c '@SBINDIR@/rndc reload > /dev/null 2>&1 || @BASE_BINDIR@/kill -HUP $MAINPID' + +ExecStop=@BASE_BINDIR@/sh -c '@SBINDIR@/rndc stop > /dev/null 2>&1 || @BASE_BINDIR@/kill -TERM $MAINPID' + +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/0001-avoid-start-failure-with-bind-user.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.8/0001-avoid-start-failure-with-bind-user.patch deleted file mode 100644 index ec1bc7b567..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/0001-avoid-start-failure-with-bind-user.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 31dde3562f287429eea94b77250d184818b49063 Mon Sep 17 00:00:00 2001 -From: Chen Qi -Date: Mon, 15 Oct 2018 16:55:09 +0800 -Subject: [PATCH] avoid start failure with bind user - -Upstream-Status: Pending - -Signed-off-by: Chen Qi ---- - init.d | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/init.d b/init.d -index b2eec60..6e03936 100644 ---- a/init.d -+++ b/init.d -@@ -57,6 +57,7 @@ case "$1" in - modprobe capability >/dev/null 2>&1 || true - if [ ! -f /etc/bind/rndc.key ]; then - /usr/sbin/rndc-confgen -a -b 512 -+ chown root:bind /etc/bind/rndc.key >/dev/null 2>&1 || true - chmod 0640 /etc/bind/rndc.key - fi - if [ -f /var/run/named/named.pid ]; then --- -2.7.4 - diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/0001-named-lwresd-V-and-start-log-hide-build-options.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.8/0001-named-lwresd-V-and-start-log-hide-build-options.patch deleted file mode 100644 index 4c10f33f04..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/0001-named-lwresd-V-and-start-log-hide-build-options.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 4e83392e840fa7b05e778710b8c202d102477a13 Mon Sep 17 00:00:00 2001 -From: Hongxu Jia -Date: Mon, 27 Aug 2018 21:24:20 +0800 -Subject: [PATCH] `named/lwresd -V' and start log hide build options - -The build options expose build path directories, so hide them. -[snip] -$ named -V -|built by make with *** (options are hidden) -[snip] - -Upstream-Status: Inappropriate [oe-core specific] - -Signed-off-by: Hongxu Jia - -Refreshed for 9.16.0 -Signed-off-by: Armin Kuster - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index bf20690..c5d330f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -35,7 +35,7 @@ AC_DEFINE([PACKAGE_VERSION_EXTRA], ["][bind_VERSION_EXTRA]["], [BIND 9 Extra par - AC_DEFINE([PACKAGE_DESCRIPTION], [m4_ifnblank(bind_DESCRIPTION, [" ]bind_DESCRIPTION["], [])], [An extra string to print after PACKAGE_STRING]) - AC_DEFINE([PACKAGE_SRCID], ["][bind_SRCID]["], [A short hash from git]) - --bind_CONFIGARGS="${ac_configure_args:-default}" -+bind_CONFIGARGS="(removed for reproducibility)" - AC_DEFINE_UNQUOTED([PACKAGE_CONFIGARGS], ["$bind_CONFIGARGS"], [Either 'defaults' or used ./configure options]) - - AC_DEFINE([PACKAGE_BUILDER], ["make"], [make or Visual Studio]) diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/bind-ensure-searching-for-json-headers-searches-sysr.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.8/bind-ensure-searching-for-json-headers-searches-sysr.patch deleted file mode 100644 index f1abd179e8..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/bind-ensure-searching-for-json-headers-searches-sysr.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 246087f89e9434b726c7884e4c0964f71084f091 Mon Sep 17 00:00:00 2001 -From: Paul Gortmaker -Date: Tue, 9 Jun 2015 11:22:00 -0400 -Subject: [PATCH] bind: ensure searching for json headers searches sysroot - -Bind can fail configure by detecting headers w/o libs[1], or -it can fail the host contamination check as per below: - -ERROR: This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. -Rerun configure task after fixing this. The path was 'build/tmp/work/core2-64-poky-linux/bind/9.10.2-r1/build' -ERROR: Function failed: do_qa_configure -ERROR: Logfile of failure stored in: build/tmp/work/core2-64-poky-linux/bind/9.10.2-r1/temp/log.do_configure.5242 -ERROR: Task 5 (meta/recipes-connectivity/bind/bind_9.10.2.bb, do_configure) failed with exit code '1' -NOTE: Tasks Summary: Attempted 773 tasks of which 768 didn't need to be rerun and 1 failed. -No currently running tasks (773 of 781) - -Summary: 1 task failed: - /meta/recipes-connectivity/bind/bind_9.10.2.bb, do_configure - -One way to fix it would be to unconditionally disable json in bind -configure[2] but here we fix it by using the path to where we would -put the header if we had json in the sysroot, in case someone wants -to make use of the combination some day. - -[1] https://trac.macports.org/ticket/45305 -[2] https://trac.macports.org/changeset/126406 - -Upstream-Status: Inappropriate [OE Specific] -Signed-off-by: Paul Gortmaker - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 10e8bf6..bf20690 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -814,7 +814,7 @@ AS_CASE([$with_lmdb], - [no],[], - [auto|yes], [PKG_CHECK_MODULES([LMDB], [lmdb], - [ac_lib_lmdb_found=yes], -- [for ac_lib_lmdb_path in /usr /usr/local /opt /opt/local; do -+ [for ac_lib_lmdb_path in "${STAGING_INCDIR}"; do - AX_LIB_LMDB([$ac_lib_lmdb_path], - [ac_lib_lmdb_found=yes - break]) diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/bind9 b/poky/meta/recipes-connectivity/bind/bind-9.18.8/bind9 deleted file mode 100644 index 968679ff7f..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/bind9 +++ /dev/null @@ -1,2 +0,0 @@ -# startup options for the server -OPTIONS="-u bind" diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/conf.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.8/conf.patch deleted file mode 100644 index aa3642acec..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/conf.patch +++ /dev/null @@ -1,330 +0,0 @@ -Upstream-Status: Inappropriate [configuration] - -the patch is imported from openembedded project - -11/30/2010 - Qing He - -diff -urN bind-9.3.1.orig/conf/db.0 bind-9.3.1/conf/db.0 ---- bind-9.3.1.orig/conf/db.0 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/db.0 2005-07-10 22:14:00.000000000 +0200 -@@ -0,0 +1,12 @@ -+; -+; BIND reverse data file for broadcast zone -+; -+$TTL 604800 -+@ IN SOA localhost. root.localhost. ( -+ 1 ; Serial -+ 604800 ; Refresh -+ 86400 ; Retry -+ 2419200 ; Expire -+ 604800 ) ; Negative Cache TTL -+; -+@ IN NS localhost. -diff -urN bind-9.3.1.orig/conf/db.127 bind-9.3.1/conf/db.127 ---- bind-9.3.1.orig/conf/db.127 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/db.127 2005-07-10 22:14:00.000000000 +0200 -@@ -0,0 +1,13 @@ -+; -+; BIND reverse data file for local loopback interface -+; -+$TTL 604800 -+@ IN SOA localhost. root.localhost. ( -+ 1 ; Serial -+ 604800 ; Refresh -+ 86400 ; Retry -+ 2419200 ; Expire -+ 604800 ) ; Negative Cache TTL -+; -+@ IN NS localhost. -+1.0.0 IN PTR localhost. -diff -urN bind-9.3.1.orig/conf/db.empty bind-9.3.1/conf/db.empty ---- bind-9.3.1.orig/conf/db.empty 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/db.empty 2005-07-10 22:14:00.000000000 +0200 -@@ -0,0 +1,14 @@ -+; BIND reverse data file for empty rfc1918 zone -+; -+; DO NOT EDIT THIS FILE - it is used for multiple zones. -+; Instead, copy it, edit named.conf, and use that copy. -+; -+$TTL 86400 -+@ IN SOA localhost. root.localhost. ( -+ 1 ; Serial -+ 604800 ; Refresh -+ 86400 ; Retry -+ 2419200 ; Expire -+ 86400 ) ; Negative Cache TTL -+; -+@ IN NS localhost. -diff -urN bind-9.3.1.orig/conf/db.255 bind-9.3.1/conf/db.255 ---- bind-9.3.1.orig/conf/db.255 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/db.255 2005-07-10 22:14:00.000000000 +0200 -@@ -0,0 +1,12 @@ -+; -+; BIND reserve data file for broadcast zone -+; -+$TTL 604800 -+@ IN SOA localhost. root.localhost. ( -+ 1 ; Serial -+ 604800 ; Refresh -+ 86400 ; Retry -+ 2419200 ; Expire -+ 604800 ) ; Negative Cache TTL -+; -+@ IN NS localhost. -diff -urN bind-9.3.1.orig/conf/db.local bind-9.3.1/conf/db.local ---- bind-9.3.1.orig/conf/db.local 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/db.local 2005-07-10 22:14:00.000000000 +0200 -@@ -0,0 +1,13 @@ -+; -+; BIND data file for local loopback interface -+; -+$TTL 604800 -+@ IN SOA localhost. root.localhost. ( -+ 1 ; Serial -+ 604800 ; Refresh -+ 86400 ; Retry -+ 2419200 ; Expire -+ 604800 ) ; Negative Cache TTL -+; -+@ IN NS localhost. -+@ IN A 127.0.0.1 -diff -urN bind-9.3.1.orig/conf/db.root bind-9.3.1/conf/db.root ---- bind-9.3.1.orig/conf/db.root 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/db.root 2005-07-10 22:14:00.000000000 +0200 -@@ -0,0 +1,45 @@ -+ -+; <<>> DiG 9.2.3 <<>> ns . @a.root-servers.net. -+;; global options: printcmd -+;; Got answer: -+;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18944 -+;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13 -+ -+;; QUESTION SECTION: -+;. IN NS -+ -+;; ANSWER SECTION: -+. 518400 IN NS A.ROOT-SERVERS.NET. -+. 518400 IN NS B.ROOT-SERVERS.NET. -+. 518400 IN NS C.ROOT-SERVERS.NET. -+. 518400 IN NS D.ROOT-SERVERS.NET. -+. 518400 IN NS E.ROOT-SERVERS.NET. -+. 518400 IN NS F.ROOT-SERVERS.NET. -+. 518400 IN NS G.ROOT-SERVERS.NET. -+. 518400 IN NS H.ROOT-SERVERS.NET. -+. 518400 IN NS I.ROOT-SERVERS.NET. -+. 518400 IN NS J.ROOT-SERVERS.NET. -+. 518400 IN NS K.ROOT-SERVERS.NET. -+. 518400 IN NS L.ROOT-SERVERS.NET. -+. 518400 IN NS M.ROOT-SERVERS.NET. -+ -+;; ADDITIONAL SECTION: -+A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4 -+B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201 -+C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12 -+D.ROOT-SERVERS.NET. 3600000 IN A 128.8.10.90 -+E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10 -+F.ROOT-SERVERS.NET. 3600000 IN A 192.5.5.241 -+G.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4 -+H.ROOT-SERVERS.NET. 3600000 IN A 128.63.2.53 -+I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17 -+J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30 -+K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129 -+L.ROOT-SERVERS.NET. 3600000 IN A 198.32.64.12 -+M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33 -+ -+;; Query time: 81 msec -+;; SERVER: 198.41.0.4#53(a.root-servers.net.) -+;; WHEN: Sun Feb 1 11:27:14 2004 -+;; MSG SIZE rcvd: 436 -+ -diff -urN bind-9.3.1.orig/conf/named.conf bind-9.3.1/conf/named.conf ---- bind-9.3.1.orig/conf/named.conf 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/named.conf 2005-07-10 22:33:46.000000000 +0200 -@@ -0,0 +1,49 @@ -+// This is the primary configuration file for the BIND DNS server named. -+// -+// If you are just adding zones, please do that in /etc/bind/named.conf.local -+ -+include "/etc/bind/named.conf.options"; -+ -+// prime the server with knowledge of the root servers -+zone "." { -+ type hint; -+ file "/etc/bind/db.root"; -+}; -+ -+// be authoritative for the localhost forward and reverse zones, and for -+// broadcast zones as per RFC 1912 -+ -+zone "localhost" { -+ type master; -+ file "/etc/bind/db.local"; -+}; -+ -+zone "127.in-addr.arpa" { -+ type master; -+ file "/etc/bind/db.127"; -+}; -+ -+zone "0.in-addr.arpa" { -+ type master; -+ file "/etc/bind/db.0"; -+}; -+ -+zone "255.in-addr.arpa" { -+ type master; -+ file "/etc/bind/db.255"; -+}; -+ -+// zone "com" { type delegation-only; }; -+// zone "net" { type delegation-only; }; -+ -+// From the release notes: -+// Because many of our users are uncomfortable receiving undelegated answers -+// from root or top level domains, other than a few for whom that behaviour -+// has been trusted and expected for quite some length of time, we have now -+// introduced the "root-delegations-only" feature which applies delegation-only -+// logic to all top level domains, and to the root domain. An exception list -+// should be specified, including "MUSEUM" and "DE", and any other top level -+// domains from whom undelegated responses are expected and trusted. -+// root-delegation-only exclude { "DE"; "MUSEUM"; }; -+ -+include "/etc/bind/named.conf.local"; -diff -urN bind-9.3.1.orig/conf/named.conf.local bind-9.3.1/conf/named.conf.local ---- bind-9.3.1.orig/conf/named.conf.local 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/named.conf.local 2005-07-10 22:14:06.000000000 +0200 -@@ -0,0 +1,8 @@ -+// -+// Do any local configuration here -+// -+ -+// Consider adding the 1918 zones here, if they are not used in your -+// organization -+//include "/etc/bind/zones.rfc1918"; -+ -diff -urN bind-9.3.1.orig/conf/named.conf.options bind-9.3.1/conf/named.conf.options ---- bind-9.3.1.orig/conf/named.conf.options 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/named.conf.options 2005-07-10 22:14:06.000000000 +0200 -@@ -0,0 +1,24 @@ -+options { -+ directory "/var/cache/bind"; -+ -+ // If there is a firewall between you and nameservers you want -+ // to talk to, you might need to uncomment the query-source -+ // directive below. Previous versions of BIND always asked -+ // questions using port 53, but BIND 8.1 and later use an unprivileged -+ // port by default. -+ -+ // query-source address * port 53; -+ -+ // If your ISP provided one or more IP addresses for stable -+ // nameservers, you probably want to use them as forwarders. -+ // Uncomment the following block, and insert the addresses replacing -+ // the all-0's placeholder. -+ -+ // forwarders { -+ // 0.0.0.0; -+ // }; -+ -+ auth-nxdomain no; # conform to RFC1035 -+ -+}; -+ -diff -urN bind-9.3.1.orig/conf/zones.rfc1918 bind-9.3.1/conf/zones.rfc1918 ---- bind-9.3.1.orig/conf/zones.rfc1918 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/conf/zones.rfc1918 2005-07-10 22:14:10.000000000 +0200 -@@ -0,0 +1,20 @@ -+zone "10.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+ -+zone "16.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "17.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "18.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "19.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "20.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "21.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "22.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "23.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "24.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "25.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "26.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "27.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "28.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "29.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "30.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+zone "31.172.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -+ -+zone "168.192.in-addr.arpa" { type master; file "/etc/bind/db.empty"; }; -diff -urN bind-9.3.1.orig/init.d bind-9.3.1/init.d ---- bind-9.3.1.orig/init.d 1970-01-01 01:00:00.000000000 +0100 -+++ bind-9.3.1/init.d 2005-07-10 23:09:58.000000000 +0200 -@@ -0,0 +1,70 @@ -+#!/bin/sh -+ -+PATH=/sbin:/bin:/usr/sbin:/usr/bin -+ -+# for a chrooted server: "-u bind -t /var/lib/named" -+# Don't modify this line, change or create /etc/default/bind9. -+OPTIONS="" -+ -+test -f /etc/default/bind9 && . /etc/default/bind9 -+ -+test -x /usr/sbin/rndc || exit 0 -+ -+case "$1" in -+ start) -+ echo -n "Starting domain name service: named" -+ -+ modprobe capability >/dev/null 2>&1 || true -+ if [ ! -f /etc/bind/rndc.key ]; then -+ /usr/sbin/rndc-confgen -a -b 512 -+ chmod 0640 /etc/bind/rndc.key -+ fi -+ if [ -f /var/run/named/named.pid ]; then -+ ps `cat /var/run/named/named.pid` > /dev/null && exit 1 -+ fi -+ -+ # dirs under /var/run can go away on reboots. -+ mkdir -p /var/run/named -+ mkdir -p /var/cache/bind -+ chmod 775 /var/run/named -+ chown root:bind /var/run/named >/dev/null 2>&1 || true -+ -+ if [ ! -x /usr/sbin/named ]; then -+ echo "named binary missing - not starting" -+ exit 1 -+ fi -+ if start-stop-daemon --start --quiet --exec /usr/sbin/named \ -+ --pidfile /var/run/named/named.pid -- $OPTIONS; then -+ if [ -x /sbin/resolvconf ] ; then -+ echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo -+ fi -+ fi -+ echo "." -+ ;; -+ -+ stop) -+ echo -n "Stopping domain name service: named" -+ if [ -x /sbin/resolvconf ]; then -+ /sbin/resolvconf -d lo -+ fi -+ /usr/sbin/rndc stop >/dev/null 2>&1 -+ echo "." -+ ;; -+ -+ reload) -+ /usr/sbin/rndc reload -+ ;; -+ -+ restart|force-reload) -+ $0 stop -+ sleep 2 -+ $0 start -+ ;; -+ -+ *) -+ echo "Usage: /etc/init.d/bind {start|stop|reload|restart|force-reload}" >&2 -+ exit 1 -+ ;; -+esac -+ -+exit 0 diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/generate-rndc-key.sh b/poky/meta/recipes-connectivity/bind/bind-9.18.8/generate-rndc-key.sh deleted file mode 100644 index 633e29c0e6..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/generate-rndc-key.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ ! -s /etc/bind/rndc.key ]; then - echo -n "Generating /etc/bind/rndc.key:" - /usr/sbin/rndc-confgen -a -b 512 - chown root:bind /etc/bind/rndc.key - chmod 0640 /etc/bind/rndc.key -fi diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/init.d-add-support-for-read-only-rootfs.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.8/init.d-add-support-for-read-only-rootfs.patch deleted file mode 100644 index 11db95ede1..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/init.d-add-support-for-read-only-rootfs.patch +++ /dev/null @@ -1,65 +0,0 @@ -Subject: init.d: add support for read-only rootfs - -Upstream-Status: Inappropriate [oe specific] - -Signed-off-by: Chen Qi ---- - init.d | 40 ++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 40 insertions(+) - -diff --git a/init.d b/init.d -index 0111ed4..24677c8 100644 ---- a/init.d -+++ b/init.d -@@ -6,8 +6,48 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin - # Don't modify this line, change or create /etc/default/bind9. - OPTIONS="" - -+test -f /etc/default/rcS && . /etc/default/rcS - test -f /etc/default/bind9 && . /etc/default/bind9 - -+# This function is here because it's possible that /var and / are on different partitions. -+is_on_read_only_partition () { -+ DIRECTORY=$1 -+ dir=`readlink -f $DIRECTORY` -+ while true; do -+ if [ ! -d "$dir" ]; then -+ echo "ERROR: $dir is not a directory" -+ exit 1 -+ else -+ for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; \ -+ END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do -+ [ "$flag" = "FOUND" ] && partition="read-write" -+ [ "$flag" = "ro" ] && { partition="read-only"; break; } -+ done -+ if [ "$dir" = "/" -o -n "$partition" ]; then -+ break -+ else -+ dir=`dirname $dir` -+ fi -+ fi -+ done -+ [ "$partition" = "read-only" ] && echo "yes" || echo "no" -+} -+ -+bind_mount () { -+ olddir=$1 -+ newdir=$2 -+ mkdir -p $olddir -+ cp -a $newdir/* $olddir -+ mount --bind $olddir $newdir -+} -+ -+# Deal with read-only rootfs -+if [ "$ROOTFS_READ_ONLY" = "yes" ]; then -+ [ "$VERBOSE" != "no" ] && echo "WARN: start bind service in read-only rootfs" -+ [ `is_on_read_only_partition /etc/bind` = "yes" ] && bind_mount /var/volatile/bind/etc /etc/bind -+ [ `is_on_read_only_partition /var/named` = "yes" ] && bind_mount /var/volatile/bind/named /var/named -+fi -+ - test -x /usr/sbin/rndc || exit 0 - - case "$1" in --- -1.7.9.5 - diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/make-etc-initd-bind-stop-work.patch b/poky/meta/recipes-connectivity/bind/bind-9.18.8/make-etc-initd-bind-stop-work.patch deleted file mode 100644 index 146f3e35db..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/make-etc-initd-bind-stop-work.patch +++ /dev/null @@ -1,42 +0,0 @@ -bind: make "/etc/init.d/bind stop" work - -Upstream-Status: Inappropriate [configuration] - -Add some configurations, make rndc command be able to controls -the named daemon. - -Signed-off-by: Roy Li ---- - conf/named.conf | 5 +++++ - conf/rndc.conf | 5 +++++ - 2 files changed, 10 insertions(+), 0 deletions(-) - create mode 100644 conf/rndc.conf - -diff --git a/conf/named.conf b/conf/named.conf -index 95829cf..c8899e7 100644 ---- a/conf/named.conf -+++ b/conf/named.conf -@@ -47,3 +47,8 @@ zone "255.in-addr.arpa" { - // root-delegation-only exclude { "DE"; "MUSEUM"; }; - - include "/etc/bind/named.conf.local"; -+include "/etc/bind/rndc.key" ; -+controls { -+ inet 127.0.0.1 allow { localhost; } -+ keys { rndc-key; }; -+}; -diff --git a/conf/rndc.conf b/conf/rndc.conf -new file mode 100644 -index 0000000..a0b481d ---- /dev/null -+++ b/conf/rndc.conf -@@ -0,0 +1,5 @@ -+include "/etc/bind/rndc.key"; -+options { -+ default-server localhost; -+ default-key rndc-key; -+}; - --- -1.7.5.4 - diff --git a/poky/meta/recipes-connectivity/bind/bind-9.18.8/named.service b/poky/meta/recipes-connectivity/bind/bind-9.18.8/named.service deleted file mode 100644 index cda56ef015..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind-9.18.8/named.service +++ /dev/null @@ -1,22 +0,0 @@ -[Unit] -Description=Berkeley Internet Name Domain (DNS) -Wants=nss-lookup.target -Before=nss-lookup.target -After=network.target - -[Service] -Type=forking -EnvironmentFile=-/etc/default/bind9 -PIDFile=/run/named/named.pid - -ExecStartPre=@SBINDIR@/generate-rndc-key.sh -ExecStart=@SBINDIR@/named $OPTIONS - -ExecReload=@BASE_BINDIR@/sh -c '@SBINDIR@/rndc reload > /dev/null 2>&1 || @BASE_BINDIR@/kill -HUP $MAINPID' - -ExecStop=@BASE_BINDIR@/sh -c '@SBINDIR@/rndc stop > /dev/null 2>&1 || @BASE_BINDIR@/kill -TERM $MAINPID' - -PrivateTmp=true - -[Install] -WantedBy=multi-user.target diff --git a/poky/meta/recipes-connectivity/bind/bind_9.18.10.bb b/poky/meta/recipes-connectivity/bind/bind_9.18.10.bb new file mode 100644 index 0000000000..cb0e251d51 --- /dev/null +++ b/poky/meta/recipes-connectivity/bind/bind_9.18.10.bb @@ -0,0 +1,114 @@ +SUMMARY = "ISC Internet Domain Name Server" +HOMEPAGE = "https://www.isc.org/bind/" +DESCRIPTION = "BIND 9 provides a full-featured Domain Name Server system" +SECTION = "console/network" + +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=9a4a897f202c0710e07f2f2836bc2b62" + +DEPENDS = "openssl libcap zlib libuv" + +SRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.xz \ + file://conf.patch \ + file://named.service \ + file://bind9 \ + file://generate-rndc-key.sh \ + file://make-etc-initd-bind-stop-work.patch \ + file://init.d-add-support-for-read-only-rootfs.patch \ + file://bind-ensure-searching-for-json-headers-searches-sysr.patch \ + file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \ + file://0001-avoid-start-failure-with-bind-user.patch \ + " + +SRC_URI[sha256sum] = "f415a92feb62568b50854a063cb231e257351f8672186d0ab031a49b3de2cac6" + +UPSTREAM_CHECK_URI = "https://ftp.isc.org/isc/bind9/" +# follow the ESV versions divisible by 2 +UPSTREAM_CHECK_REGEX = "(?P9.(\d*[02468])+(\.\d+)+(-P\d+)*)/" + +# Issue only affects dhcpd with recent bind versions. We don't ship dhcpd anymore +# so the issue doesn't affect us. +CVE_CHECK_IGNORE += "CVE-2019-6470" + +inherit autotools update-rc.d systemd useradd pkgconfig multilib_header update-alternatives + +# PACKAGECONFIGs readline and libedit should NOT be set at same time +PACKAGECONFIG ?= "readline" +PACKAGECONFIG[httpstats] = "--with-libxml2=${STAGING_DIR_HOST}${prefix},--without-libxml2,libxml2" +PACKAGECONFIG[readline] = "--with-readline=readline,,readline" +PACKAGECONFIG[libedit] = "--with-readline=libedit,,libedit" +PACKAGECONFIG[dns-over-http] = "--enable-doh,--disable-doh,nghttp2" + +EXTRA_OECONF = " --disable-devpoll --disable-auto-validation --enable-epoll \ + --with-gssapi=no --with-lmdb=no --with-zlib \ + --sysconfdir=${sysconfdir}/bind \ + --with-openssl=${STAGING_DIR_HOST}${prefix} \ + " +LDFLAGS:append = " -lz" + +# dhcp needs .la so keep them +REMOVE_LIBTOOL_LA = "0" + +USERADD_PACKAGES = "${PN}" +USERADD_PARAM:${PN} = "--system --home ${localstatedir}/cache/bind --no-create-home \ + --user-group bind" + +INITSCRIPT_NAME = "bind" +INITSCRIPT_PARAMS = "defaults" + +SYSTEMD_SERVICE:${PN} = "named.service" + +do_install:append() { + + install -d -o bind "${D}${localstatedir}/cache/bind" + install -d "${D}${sysconfdir}/bind" + install -d "${D}${sysconfdir}/init.d" + install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/" + install -m 755 "${S}/init.d" "${D}${sysconfdir}/init.d/bind" + + # Install systemd related files + install -d ${D}${sbindir} + install -m 755 ${WORKDIR}/generate-rndc-key.sh ${D}${sbindir} + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/named.service ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + ${D}${systemd_system_unitdir}/named.service + + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/bind9 ${D}${sysconfdir}/default + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/tmpfiles.d + echo "d /run/named 0755 bind bind - -" > ${D}${sysconfdir}/tmpfiles.d/bind.conf + fi +} + +CONFFILES:${PN} = " \ + ${sysconfdir}/bind/named.conf \ + ${sysconfdir}/bind/named.conf.local \ + ${sysconfdir}/bind/named.conf.options \ + ${sysconfdir}/bind/db.0 \ + ${sysconfdir}/bind/db.127 \ + ${sysconfdir}/bind/db.empty \ + ${sysconfdir}/bind/db.local \ + ${sysconfdir}/bind/db.root \ + " + +ALTERNATIVE:${PN}-utils = "nslookup" +ALTERNATIVE_LINK_NAME[nslookup] = "${bindir}/nslookup" +ALTERNATIVE_PRIORITY = "100" + +PACKAGE_BEFORE_PN += "${PN}-utils" +FILES:${PN}-utils = "${bindir}/host ${bindir}/dig ${bindir}/mdig ${bindir}/nslookup ${bindir}/nsupdate" +FILES:${PN}-dev += "${bindir}/isc-config.h" +FILES:${PN} += "${sbindir}/generate-rndc-key.sh" + +PACKAGE_BEFORE_PN += "${PN}-libs" +# special arrangement below due to +# https://github.com/isc-projects/bind9/commit/0e25af628cd776f98c04fc4cc59048f5448f6c88 +FILES_SOLIBSDEV = "${libdir}/*[!0-9].so ${libdir}/libbind9.so" +FILES:${PN}-libs = "${libdir}/named/*.so* ${libdir}/*-${PV}.so" +FILES:${PN}-staticdev += "${libdir}/*.la" + +DEV_PKG_DEPENDENCY = "" diff --git a/poky/meta/recipes-connectivity/bind/bind_9.18.8.bb b/poky/meta/recipes-connectivity/bind/bind_9.18.8.bb deleted file mode 100644 index 4925c092c7..0000000000 --- a/poky/meta/recipes-connectivity/bind/bind_9.18.8.bb +++ /dev/null @@ -1,114 +0,0 @@ -SUMMARY = "ISC Internet Domain Name Server" -HOMEPAGE = "https://www.isc.org/bind/" -DESCRIPTION = "BIND 9 provides a full-featured Domain Name Server system" -SECTION = "console/network" - -LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=9a4a897f202c0710e07f2f2836bc2b62" - -DEPENDS = "openssl libcap zlib libuv" - -SRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.xz \ - file://conf.patch \ - file://named.service \ - file://bind9 \ - file://generate-rndc-key.sh \ - file://make-etc-initd-bind-stop-work.patch \ - file://init.d-add-support-for-read-only-rootfs.patch \ - file://bind-ensure-searching-for-json-headers-searches-sysr.patch \ - file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \ - file://0001-avoid-start-failure-with-bind-user.patch \ - " - -SRC_URI[sha256sum] = "0e3c3ab9378db84ba0f37073d67ba125ae4f2ff8daf366c9db287e3f1b2c35f0" - -UPSTREAM_CHECK_URI = "https://ftp.isc.org/isc/bind9/" -# follow the ESV versions divisible by 2 -UPSTREAM_CHECK_REGEX = "(?P9.(\d*[02468])+(\.\d+)+(-P\d+)*)/" - -# Issue only affects dhcpd with recent bind versions. We don't ship dhcpd anymore -# so the issue doesn't affect us. -CVE_CHECK_IGNORE += "CVE-2019-6470" - -inherit autotools update-rc.d systemd useradd pkgconfig multilib_header update-alternatives - -# PACKAGECONFIGs readline and libedit should NOT be set at same time -PACKAGECONFIG ?= "readline" -PACKAGECONFIG[httpstats] = "--with-libxml2=${STAGING_DIR_HOST}${prefix},--without-libxml2,libxml2" -PACKAGECONFIG[readline] = "--with-readline=readline,,readline" -PACKAGECONFIG[libedit] = "--with-readline=libedit,,libedit" -PACKAGECONFIG[dns-over-http] = "--enable-doh,--disable-doh,nghttp2" - -EXTRA_OECONF = " --disable-devpoll --disable-auto-validation --enable-epoll \ - --with-gssapi=no --with-lmdb=no --with-zlib \ - --sysconfdir=${sysconfdir}/bind \ - --with-openssl=${STAGING_DIR_HOST}${prefix} \ - " -LDFLAGS:append = " -lz" - -# dhcp needs .la so keep them -REMOVE_LIBTOOL_LA = "0" - -USERADD_PACKAGES = "${PN}" -USERADD_PARAM:${PN} = "--system --home ${localstatedir}/cache/bind --no-create-home \ - --user-group bind" - -INITSCRIPT_NAME = "bind" -INITSCRIPT_PARAMS = "defaults" - -SYSTEMD_SERVICE:${PN} = "named.service" - -do_install:append() { - - install -d -o bind "${D}${localstatedir}/cache/bind" - install -d "${D}${sysconfdir}/bind" - install -d "${D}${sysconfdir}/init.d" - install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/" - install -m 755 "${S}/init.d" "${D}${sysconfdir}/init.d/bind" - - # Install systemd related files - install -d ${D}${sbindir} - install -m 755 ${WORKDIR}/generate-rndc-key.sh ${D}${sbindir} - install -d ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/named.service ${D}${systemd_system_unitdir} - sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ - -e 's,@SBINDIR@,${sbindir},g' \ - ${D}${systemd_system_unitdir}/named.service - - install -d ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/bind9 ${D}${sysconfdir}/default - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${sysconfdir}/tmpfiles.d - echo "d /run/named 0755 bind bind - -" > ${D}${sysconfdir}/tmpfiles.d/bind.conf - fi -} - -CONFFILES:${PN} = " \ - ${sysconfdir}/bind/named.conf \ - ${sysconfdir}/bind/named.conf.local \ - ${sysconfdir}/bind/named.conf.options \ - ${sysconfdir}/bind/db.0 \ - ${sysconfdir}/bind/db.127 \ - ${sysconfdir}/bind/db.empty \ - ${sysconfdir}/bind/db.local \ - ${sysconfdir}/bind/db.root \ - " - -ALTERNATIVE:${PN}-utils = "nslookup" -ALTERNATIVE_LINK_NAME[nslookup] = "${bindir}/nslookup" -ALTERNATIVE_PRIORITY = "100" - -PACKAGE_BEFORE_PN += "${PN}-utils" -FILES:${PN}-utils = "${bindir}/host ${bindir}/dig ${bindir}/mdig ${bindir}/nslookup ${bindir}/nsupdate" -FILES:${PN}-dev += "${bindir}/isc-config.h" -FILES:${PN} += "${sbindir}/generate-rndc-key.sh" - -PACKAGE_BEFORE_PN += "${PN}-libs" -# special arrangement below due to -# https://github.com/isc-projects/bind9/commit/0e25af628cd776f98c04fc4cc59048f5448f6c88 -FILES_SOLIBSDEV = "${libdir}/*[!0-9].so ${libdir}/libbind9.so" -FILES:${PN}-libs = "${libdir}/named/*.so* ${libdir}/*-${PV}.so" -FILES:${PN}-staticdev += "${libdir}/*.la" - -DEV_PKG_DEPENDENCY = "" diff --git a/poky/meta/recipes-connectivity/bluez5/bluez5.inc b/poky/meta/recipes-connectivity/bluez5/bluez5.inc index a8eaba1dd6..e10158a6e5 100644 --- a/poky/meta/recipes-connectivity/bluez5/bluez5.inc +++ b/poky/meta/recipes-connectivity/bluez5/bluez5.inc @@ -54,6 +54,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \ file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ file://0001-test-gatt-Fix-hung-issue.patch \ + file://0004-src-shared-util.c-include-linux-limits.h.patch \ " S = "${WORKDIR}/bluez-${PV}" @@ -65,6 +66,7 @@ EXTRA_OECONF = "\ --enable-test \ --enable-datafiles \ --enable-library \ + --enable-pie \ --without-zsh-completion-dir \ " diff --git a/poky/meta/recipes-connectivity/bluez5/bluez5/0004-src-shared-util.c-include-linux-limits.h.patch b/poky/meta/recipes-connectivity/bluez5/bluez5/0004-src-shared-util.c-include-linux-limits.h.patch new file mode 100644 index 0000000000..f954f6dab2 --- /dev/null +++ b/poky/meta/recipes-connectivity/bluez5/bluez5/0004-src-shared-util.c-include-linux-limits.h.patch @@ -0,0 +1,26 @@ +From 51584158b9a2e58f3790f8a7387b5cf167eca88b Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Mon, 12 Dec 2022 13:10:19 +0100 +Subject: [PATCH] src/shared/util.c: include linux/limits.h + +MAX_INPUT is defined in that file. This matters on non-glibc +systems such as those using musl. + +Upstream-Status: Submitted [to linux-bluetooth@vger.kernel.org,luiz.von.dentz@intel.com,frederic.danis@collabora.com] +Signed-off-by: Alexander Kanavin +--- + src/shared/util.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/shared/util.c b/src/shared/util.c +index 0a0308c..1f61314 100644 +--- a/src/shared/util.c ++++ b/src/shared/util.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + + #ifdef HAVE_SYS_RANDOM_H diff --git a/poky/meta/recipes-connectivity/bluez5/bluez5_5.65.bb b/poky/meta/recipes-connectivity/bluez5/bluez5_5.65.bb deleted file mode 100644 index 4c15aeb46d..0000000000 --- a/poky/meta/recipes-connectivity/bluez5/bluez5_5.65.bb +++ /dev/null @@ -1,70 +0,0 @@ -require bluez5.inc - -SRC_URI[sha256sum] = "2565a4d48354b576e6ad92e25b54ed66808296581c8abb80587051f9993d96d4" - -# These issues have kernel fixes rather than bluez fixes so exclude here -CVE_CHECK_IGNORE += "CVE-2020-12352 CVE-2020-24490" - -# noinst programs in Makefile.tools that are conditional on READLINE -# support -NOINST_TOOLS_READLINE ?= " \ - ${@bb.utils.contains('PACKAGECONFIG', 'deprecated', 'attrib/gatttool', '', d)} \ - tools/obex-client-tool \ - tools/obex-server-tool \ - tools/bluetooth-player \ - tools/obexctl \ - tools/btmgmt \ -" - -# noinst programs in Makefile.tools that are conditional on TESTING -# support -NOINST_TOOLS_TESTING ?= " \ - emulator/btvirt \ - emulator/b1ee \ - emulator/hfp \ - peripheral/btsensor \ - tools/3dsp \ - tools/mgmt-tester \ - tools/gap-tester \ - tools/l2cap-tester \ - tools/sco-tester \ - tools/smp-tester \ - tools/hci-tester \ - tools/rfcomm-tester \ - tools/bnep-tester \ - tools/userchan-tester \ -" - -# noinst programs in Makefile.tools that are conditional on TOOLS -# support -NOINST_TOOLS_BT ?= " \ - tools/bdaddr \ - tools/avinfo \ - tools/avtest \ - tools/scotest \ - tools/amptest \ - tools/hwdb \ - tools/hcieventmask \ - tools/hcisecfilter \ - tools/btinfo \ - tools/btsnoop \ - tools/btproxy \ - tools/btiotest \ - tools/bneptest \ - tools/mcaptest \ - tools/cltest \ - tools/oobtest \ - tools/advtest \ - tools/seq2bseq \ - tools/nokfw \ - tools/create-image \ - tools/eddystone \ - tools/ibeacon \ - tools/btgatt-client \ - tools/btgatt-server \ - tools/test-runner \ - tools/check-selftest \ - tools/gatt-service \ - profiles/iap/iapd \ - ${@bb.utils.contains('PACKAGECONFIG', 'btpclient', 'tools/btpclient', '', d)} \ -" diff --git a/poky/meta/recipes-connectivity/bluez5/bluez5_5.66.bb b/poky/meta/recipes-connectivity/bluez5/bluez5_5.66.bb new file mode 100644 index 0000000000..2208b730b0 --- /dev/null +++ b/poky/meta/recipes-connectivity/bluez5/bluez5_5.66.bb @@ -0,0 +1,70 @@ +require bluez5.inc + +SRC_URI[sha256sum] = "39fea64b590c9492984a0c27a89fc203e1cdc74866086efb8f4698677ab2b574" + +# These issues have kernel fixes rather than bluez fixes so exclude here +CVE_CHECK_IGNORE += "CVE-2020-12352 CVE-2020-24490" + +# noinst programs in Makefile.tools that are conditional on READLINE +# support +NOINST_TOOLS_READLINE ?= " \ + ${@bb.utils.contains('PACKAGECONFIG', 'deprecated', 'attrib/gatttool', '', d)} \ + tools/obex-client-tool \ + tools/obex-server-tool \ + tools/bluetooth-player \ + tools/obexctl \ + tools/btmgmt \ +" + +# noinst programs in Makefile.tools that are conditional on TESTING +# support +NOINST_TOOLS_TESTING ?= " \ + emulator/btvirt \ + emulator/b1ee \ + emulator/hfp \ + peripheral/btsensor \ + tools/3dsp \ + tools/mgmt-tester \ + tools/gap-tester \ + tools/l2cap-tester \ + tools/sco-tester \ + tools/smp-tester \ + tools/hci-tester \ + tools/rfcomm-tester \ + tools/bnep-tester \ + tools/userchan-tester \ +" + +# noinst programs in Makefile.tools that are conditional on TOOLS +# support +NOINST_TOOLS_BT ?= " \ + tools/bdaddr \ + tools/avinfo \ + tools/avtest \ + tools/scotest \ + tools/amptest \ + tools/hwdb \ + tools/hcieventmask \ + tools/hcisecfilter \ + tools/btinfo \ + tools/btsnoop \ + tools/btproxy \ + tools/btiotest \ + tools/bneptest \ + tools/mcaptest \ + tools/cltest \ + tools/oobtest \ + tools/advtest \ + tools/seq2bseq \ + tools/nokfw \ + tools/create-image \ + tools/eddystone \ + tools/ibeacon \ + tools/btgatt-client \ + tools/btgatt-server \ + tools/test-runner \ + tools/check-selftest \ + tools/gatt-service \ + profiles/iap/iapd \ + ${@bb.utils.contains('PACKAGECONFIG', 'btpclient', 'tools/btpclient', '', d)} \ +" diff --git a/poky/meta/recipes-connectivity/dhcpcd/dhcpcd_9.4.1.bb b/poky/meta/recipes-connectivity/dhcpcd/dhcpcd_9.4.1.bb index ab6ffe986c..5cf77fa0f6 100644 --- a/poky/meta/recipes-connectivity/dhcpcd/dhcpcd_9.4.1.bb +++ b/poky/meta/recipes-connectivity/dhcpcd/dhcpcd_9.4.1.bb @@ -13,6 +13,9 @@ UPSTREAM_CHECK_URI = "https://roy.marples.name/downloads/dhcpcd/" SRC_URI = "https://roy.marples.name/downloads/${BPN}/${BPN}-${PV}.tar.xz \ file://0001-remove-INCLUDEDIR-to-prevent-build-issues.patch \ + file://0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch \ + file://0001-privsep-Allow-getrandom-sysctl-for-newer-glibc.patch \ + file://0002-privsep-Allow-newfstatat-syscall-as-well.patch \ file://dhcpcd.service \ file://dhcpcd@.service \ " diff --git a/poky/meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch b/poky/meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch new file mode 100644 index 0000000000..6f90c88249 --- /dev/null +++ b/poky/meta/recipes-connectivity/dhcpcd/files/0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch @@ -0,0 +1,82 @@ +From 02acc4d875ee81e6fd19ef66d69c9f55b4b4a7e7 Mon Sep 17 00:00:00 2001 +From: Chen Qi +Date: Wed, 9 Nov 2022 16:33:18 +0800 +Subject: [PATCH] 20-resolv.conf: improve the sitation of working with systemd + +systemd's resolvconf implementation ignores the protocol part. +See https://github.com/systemd/systemd/issues/25032. + +When using 'dhcp server + dns server + dhcpcd + systemd', we +get an integration issue, that is dhcpcd runs 'resolvconf -d eth0.ra', +yet systemd's resolvconf treats it as eth0. This will delete the +DNS information set by 'resolvconf -a eth0.dhcp'. + +Fortunately, 20-resolv.conf has the ability to build the resolv.conf +file contents itself. We can just pass the generated contents to +systemd's resolvconf. This way, the DNS information is not incorrectly +deleted. Also, it does not cause behavior regression for dhcpcd +in other cases. + +Upstream-Status: Inappropriate [OE Specific] +This patch has been rejected by dhcpcd upstream. +See details in https://github.com/NetworkConfiguration/dhcpcd/pull/152 + +Signed-off-by: Chen Qi +--- + hooks/20-resolv.conf | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/hooks/20-resolv.conf b/hooks/20-resolv.conf +index 504a6c53..eb6e5845 100644 +--- a/hooks/20-resolv.conf ++++ b/hooks/20-resolv.conf +@@ -11,8 +11,12 @@ nocarrier_roaming_dir="$state_dir/roaming" + NL=" + " + : ${resolvconf:=resolvconf} ++resolvconf_from_systemd=false + if type "$resolvconf" >/dev/null 2>&1; then + have_resolvconf=true ++ if [ $(basename $(readlink -f $(which $resolvconf))) = resolvectl ]; then ++ resolvconf_from_systemd=true ++ fi + else + have_resolvconf=false + fi +@@ -69,8 +73,13 @@ build_resolv_conf() + else + echo "# /etc/resolv.conf.tail can replace this line" >> "$cf" + fi +- if change_file /etc/resolv.conf "$cf"; then +- chmod 644 /etc/resolv.conf ++ if $resolvconf_from_systemd; then ++ [ -n "$ifmetric" ] && export IF_METRIC="$ifmetric" ++ "$resolvconf" -a "$ifname" <"$cf" ++ else ++ if change_file /etc/resolv.conf "$cf"; then ++ chmod 644 /etc/resolv.conf ++ fi + fi + rm -f "$cf" + } +@@ -170,7 +179,7 @@ add_resolv_conf() + for x in ${new_domain_name_servers}; do + conf="${conf}nameserver $x$NL" + done +- if $have_resolvconf; then ++ if $have_resolvconf && ! $resolvconf_from_systemd; then + [ -n "$ifmetric" ] && export IF_METRIC="$ifmetric" + printf %s "$conf" | "$resolvconf" -a "$ifname" + return $? +@@ -186,7 +195,7 @@ add_resolv_conf() + + remove_resolv_conf() + { +- if $have_resolvconf; then ++ if $have_resolvconf && ($if_down || ! $resolvconf_from_systemd); then + "$resolvconf" -d "$ifname" -f + else + if [ -e "$resolv_conf_dir/$ifname" ]; then +-- +2.17.1 + diff --git a/poky/meta/recipes-connectivity/dhcpcd/files/0001-privsep-Allow-getrandom-sysctl-for-newer-glibc.patch b/poky/meta/recipes-connectivity/dhcpcd/files/0001-privsep-Allow-getrandom-sysctl-for-newer-glibc.patch new file mode 100644 index 0000000000..68ab93416a --- /dev/null +++ b/poky/meta/recipes-connectivity/dhcpcd/files/0001-privsep-Allow-getrandom-sysctl-for-newer-glibc.patch @@ -0,0 +1,30 @@ +From c6cdf0aee71ab4126d36b045f02428ee3c6ec50b Mon Sep 17 00:00:00 2001 +From: Roy Marples +Date: Fri, 26 Aug 2022 09:08:36 +0100 +Subject: [PATCH 1/2] privsep: Allow getrandom sysctl for newer glibc + +Fixes #120 + +Upstream-Status: Backport [c6cdf0aee71ab4126d36b045f02428ee3c6ec50b] +Signed-off-by: Chen Qi +--- + src/privsep-linux.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/privsep-linux.c b/src/privsep-linux.c +index b238644b..479a1d82 100644 +--- a/src/privsep-linux.c ++++ b/src/privsep-linux.c +@@ -300,6 +300,9 @@ static struct sock_filter ps_seccomp_filter[] = { + #ifdef __NR_getpid + SECCOMP_ALLOW(__NR_getpid), + #endif ++#ifdef __NR_getrandom ++ SECCOMP_ALLOW(__NR_getrandom), ++#endif + #ifdef __NR_getsockopt + /* For route socket overflow */ + SECCOMP_ALLOW_ARG(__NR_getsockopt, 1, SOL_SOCKET), +-- +2.17.1 + diff --git a/poky/meta/recipes-connectivity/dhcpcd/files/0002-privsep-Allow-newfstatat-syscall-as-well.patch b/poky/meta/recipes-connectivity/dhcpcd/files/0002-privsep-Allow-newfstatat-syscall-as-well.patch new file mode 100644 index 0000000000..c5d2cba305 --- /dev/null +++ b/poky/meta/recipes-connectivity/dhcpcd/files/0002-privsep-Allow-newfstatat-syscall-as-well.patch @@ -0,0 +1,31 @@ +From 7625a555797f587a89dc2447fd9d621024d5165c Mon Sep 17 00:00:00 2001 +From: Roy Marples +Date: Fri, 26 Aug 2022 09:24:50 +0100 +Subject: [PATCH 2/2] privsep: Allow newfstatat syscall as well + +Allows newer glibc variants to work apparently. +As reported in #84 and #89. + +Upstream-Status: Backport [7625a555797f587a89dc2447fd9d621024d5165c] +Signed-off-by: Chen Qi +--- + src/privsep-linux.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/privsep-linux.c b/src/privsep-linux.c +index 479a1d82..6327b1bc 100644 +--- a/src/privsep-linux.c ++++ b/src/privsep-linux.c +@@ -328,6 +328,9 @@ static struct sock_filter ps_seccomp_filter[] = { + #ifdef __NR_nanosleep + SECCOMP_ALLOW(__NR_nanosleep), /* XXX should use ppoll instead */ + #endif ++#ifdef __NR_newfstatat ++ SECCOMP_ALLOW(__NR_newfstatat), ++#endif + #ifdef __NR_ppoll + SECCOMP_ALLOW(__NR_ppoll), + #endif +-- +2.17.1 + diff --git a/poky/meta/recipes-connectivity/iproute2/iproute2_6.0.0.bb b/poky/meta/recipes-connectivity/iproute2/iproute2_6.0.0.bb deleted file mode 100644 index 9373dba5f5..0000000000 --- a/poky/meta/recipes-connectivity/iproute2/iproute2_6.0.0.bb +++ /dev/null @@ -1,98 +0,0 @@ -SUMMARY = "TCP / IP networking and traffic control utilities" -DESCRIPTION = "Iproute2 is a collection of utilities for controlling \ -TCP / IP networking and traffic control in Linux. Of the utilities ip \ -and tc are the most important. ip controls IPv4 and IPv6 \ -configuration and tc stands for traffic control." -HOMEPAGE = "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2" -SECTION = "base" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \ - file://ip/ip.c;beginline=3;endline=8;md5=689d691d0410a4b64d3899f8d6e31817" - -DEPENDS = "flex-native bison-native iptables libcap" - -SRC_URI = "${KERNELORG_MIRROR}/linux/utils/net/${BPN}/${BP}.tar.xz \ - file://0001-libc-compat.h-add-musl-workaround.patch \ - " - -SRC_URI[sha256sum] = "523139e9e72aec996374fa2de74be4c53d2dd05589488934d21ff97bae19580a" - -inherit update-alternatives bash-completion pkgconfig - -PACKAGECONFIG ??= "tipc elf devlink" -PACKAGECONFIG[tipc] = ",,libmnl," -PACKAGECONFIG[elf] = ",,elfutils," -PACKAGECONFIG[devlink] = ",,libmnl," -PACKAGECONFIG[rdma] = ",,libmnl," - -IPROUTE2_MAKE_SUBDIRS = "lib tc ip bridge misc genl ${@bb.utils.filter('PACKAGECONFIG', 'devlink tipc rdma', d)}" - -# CFLAGS are computed in Makefile and reference CCOPTS -# -EXTRA_OEMAKE = "\ - CC='${CC}' \ - KERNEL_INCLUDE=${STAGING_INCDIR} \ - DOCDIR=${docdir}/iproute2 \ - SUBDIRS='${IPROUTE2_MAKE_SUBDIRS}' \ - SBINDIR='${base_sbindir}' \ - LIBDIR='${libdir}' \ - CCOPTS='${CFLAGS}' \ -" - -do_configure:append () { - sh configure ${STAGING_INCDIR} - # Explicitly disable ATM support - sed -i -e '/TC_CONFIG_ATM/d' config.mk -} - -do_install () { - oe_runmake DESTDIR=${D} install - mv ${D}${base_sbindir}/ip ${D}${base_sbindir}/ip.iproute2 - install -d ${D}${datadir} - mv ${D}/share/* ${D}${datadir}/ || true - rm ${D}/share -rf || true -} - -# The .so files in iproute2-tc are modules, not traditional libraries -INSANE_SKIP:${PN}-tc = "dev-so" - -IPROUTE2_PACKAGES =+ "\ - ${PN}-devlink \ - ${PN}-genl \ - ${PN}-ifstat \ - ${PN}-ip \ - ${PN}-lnstat \ - ${PN}-nstat \ - ${PN}-rtacct \ - ${PN}-ss \ - ${PN}-tc \ - ${PN}-tipc \ - ${PN}-rdma \ -" - -PACKAGE_BEFORE_PN = "${IPROUTE2_PACKAGES}" -RDEPENDS:${PN} += "${PN}-ip" - -FILES:${PN}-tc = "${base_sbindir}/tc* \ - ${libdir}/tc/*.so" -FILES:${PN}-lnstat = "${base_sbindir}/lnstat \ - ${base_sbindir}/ctstat \ - ${base_sbindir}/rtstat" -FILES:${PN}-ifstat = "${base_sbindir}/ifstat" -FILES:${PN}-ip = "${base_sbindir}/ip.${PN} ${sysconfdir}/iproute2" -FILES:${PN}-genl = "${base_sbindir}/genl" -FILES:${PN}-rtacct = "${base_sbindir}/rtacct" -FILES:${PN}-nstat = "${base_sbindir}/nstat" -FILES:${PN}-ss = "${base_sbindir}/ss" -FILES:${PN}-tipc = "${base_sbindir}/tipc" -FILES:${PN}-devlink = "${base_sbindir}/devlink" -FILES:${PN}-rdma = "${base_sbindir}/rdma" - -ALTERNATIVE:${PN}-ip = "ip" -ALTERNATIVE_TARGET[ip] = "${base_sbindir}/ip.${BPN}" -ALTERNATIVE_LINK_NAME[ip] = "${base_sbindir}/ip" -ALTERNATIVE_PRIORITY = "100" - -ALTERNATIVE:${PN}-tc = "tc" -ALTERNATIVE_LINK_NAME[tc] = "${base_sbindir}/tc" -ALTERNATIVE_PRIORITY_${PN}-tc = "100" diff --git a/poky/meta/recipes-connectivity/iproute2/iproute2_6.1.0.bb b/poky/meta/recipes-connectivity/iproute2/iproute2_6.1.0.bb new file mode 100644 index 0000000000..4c6dd1f7f4 --- /dev/null +++ b/poky/meta/recipes-connectivity/iproute2/iproute2_6.1.0.bb @@ -0,0 +1,99 @@ +SUMMARY = "TCP / IP networking and traffic control utilities" +DESCRIPTION = "Iproute2 is a collection of utilities for controlling \ +TCP / IP networking and traffic control in Linux. Of the utilities ip \ +and tc are the most important. ip controls IPv4 and IPv6 \ +configuration and tc stands for traffic control." +HOMEPAGE = "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2" +SECTION = "base" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a \ + file://ip/ip.c;beginline=3;endline=8;md5=689d691d0410a4b64d3899f8d6e31817" + +DEPENDS = "flex-native bison-native iptables libcap" + +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/net/${BPN}/${BP}.tar.xz \ + file://0001-libc-compat.h-add-musl-workaround.patch \ + " + +SRC_URI[sha256sum] = "5ce12a0fec6b212725ef218735941b2dab76244db7e72646a76021b0537b43ab" + +inherit update-alternatives bash-completion pkgconfig + +PACKAGECONFIG ??= "tipc elf devlink" +PACKAGECONFIG[tipc] = ",,libmnl," +PACKAGECONFIG[elf] = ",,elfutils," +PACKAGECONFIG[devlink] = ",,libmnl," +PACKAGECONFIG[rdma] = ",,libmnl," +PACKAGECONFIG[selinux] = ",,libselinux" + +IPROUTE2_MAKE_SUBDIRS = "lib tc ip bridge misc genl ${@bb.utils.filter('PACKAGECONFIG', 'devlink tipc rdma', d)}" + +# CFLAGS are computed in Makefile and reference CCOPTS +# +EXTRA_OEMAKE = "\ + CC='${CC}' \ + KERNEL_INCLUDE=${STAGING_INCDIR} \ + DOCDIR=${docdir}/iproute2 \ + SUBDIRS='${IPROUTE2_MAKE_SUBDIRS}' \ + SBINDIR='${base_sbindir}' \ + LIBDIR='${libdir}' \ + CCOPTS='${CFLAGS}' \ +" + +do_configure:append () { + sh configure ${STAGING_INCDIR} + # Explicitly disable ATM support + sed -i -e '/TC_CONFIG_ATM/d' config.mk +} + +do_install () { + oe_runmake DESTDIR=${D} install + mv ${D}${base_sbindir}/ip ${D}${base_sbindir}/ip.iproute2 + install -d ${D}${datadir} + mv ${D}/share/* ${D}${datadir}/ || true + rm ${D}/share -rf || true +} + +# The .so files in iproute2-tc are modules, not traditional libraries +INSANE_SKIP:${PN}-tc = "dev-so" + +IPROUTE2_PACKAGES =+ "\ + ${PN}-devlink \ + ${PN}-genl \ + ${PN}-ifstat \ + ${PN}-ip \ + ${PN}-lnstat \ + ${PN}-nstat \ + ${PN}-rtacct \ + ${PN}-ss \ + ${PN}-tc \ + ${PN}-tipc \ + ${PN}-rdma \ +" + +PACKAGE_BEFORE_PN = "${IPROUTE2_PACKAGES}" +RDEPENDS:${PN} += "${PN}-ip" + +FILES:${PN}-tc = "${base_sbindir}/tc* \ + ${libdir}/tc/*.so" +FILES:${PN}-lnstat = "${base_sbindir}/lnstat \ + ${base_sbindir}/ctstat \ + ${base_sbindir}/rtstat" +FILES:${PN}-ifstat = "${base_sbindir}/ifstat" +FILES:${PN}-ip = "${base_sbindir}/ip.${PN} ${sysconfdir}/iproute2" +FILES:${PN}-genl = "${base_sbindir}/genl" +FILES:${PN}-rtacct = "${base_sbindir}/rtacct" +FILES:${PN}-nstat = "${base_sbindir}/nstat" +FILES:${PN}-ss = "${base_sbindir}/ss" +FILES:${PN}-tipc = "${base_sbindir}/tipc" +FILES:${PN}-devlink = "${base_sbindir}/devlink" +FILES:${PN}-rdma = "${base_sbindir}/rdma" + +ALTERNATIVE:${PN}-ip = "ip" +ALTERNATIVE_TARGET[ip] = "${base_sbindir}/ip.${BPN}" +ALTERNATIVE_LINK_NAME[ip] = "${base_sbindir}/ip" +ALTERNATIVE_PRIORITY = "100" + +ALTERNATIVE:${PN}-tc = "tc" +ALTERNATIVE_LINK_NAME[tc] = "${base_sbindir}/tc" +ALTERNATIVE_PRIORITY_${PN}-tc = "100" diff --git a/poky/meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb b/poky/meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb deleted file mode 100644 index dbe2fd8157..0000000000 --- a/poky/meta/recipes-connectivity/libpcap/libpcap_1.10.1.bb +++ /dev/null @@ -1,43 +0,0 @@ -SUMMARY = "Interface for user-level network packet capture" -DESCRIPTION = "Libpcap provides a portable framework for low-level network \ -monitoring. Libpcap can provide network statistics collection, \ -security monitoring and network debugging." -HOMEPAGE = "http://www.tcpdump.org/" -BUGTRACKER = "http://sourceforge.net/tracker/?group_id=53067&atid=469577" -SECTION = "libs/network" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5eb289217c160e2920d2e35bddc36453 \ - file://pcap.h;beginline=1;endline=32;md5=39af3510e011f34b8872f120b1dc31d2" -DEPENDS = "flex-native bison-native" - -SRC_URI = "https://www.tcpdump.org/release/${BP}.tar.gz" -SRC_URI[sha256sum] = "ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4" - -inherit autotools binconfig-disabled pkgconfig - -BINCONFIG = "${bindir}/pcap-config" - -# Explicitly disable dag support. We don't have recipe for it and if enabled here, -# configure script poisons the include dirs with /usr/local/include even when the -# support hasn't been detected. Do the same thing for DPDK. -EXTRA_OECONF = " \ - --with-pcap=linux \ - --without-dag \ - --without-dpdk \ - " -EXTRA_AUTORECONF += "--exclude=aclocal" - -PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez5', '', d)} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ -" -PACKAGECONFIG[bluez5] = "--enable-bluetooth,--disable-bluetooth,bluez5" -PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus" -PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," -PACKAGECONFIG[libnl] = "--with-libnl,--without-libnl,libnl" - -do_configure:prepend () { - #remove hardcoded references to /usr/include - sed 's|\([ "^'\''I]\+\)/usr/include/|\1${STAGING_INCDIR}/|g' -i ${S}/configure.ac -} - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-connectivity/libpcap/libpcap_1.10.2.bb b/poky/meta/recipes-connectivity/libpcap/libpcap_1.10.2.bb new file mode 100644 index 0000000000..48c9bb09d3 --- /dev/null +++ b/poky/meta/recipes-connectivity/libpcap/libpcap_1.10.2.bb @@ -0,0 +1,43 @@ +SUMMARY = "Interface for user-level network packet capture" +DESCRIPTION = "Libpcap provides a portable framework for low-level network \ +monitoring. Libpcap can provide network statistics collection, \ +security monitoring and network debugging." +HOMEPAGE = "http://www.tcpdump.org/" +BUGTRACKER = "http://sourceforge.net/tracker/?group_id=53067&atid=469577" +SECTION = "libs/network" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=5eb289217c160e2920d2e35bddc36453 \ + file://pcap.h;beginline=1;endline=32;md5=39af3510e011f34b8872f120b1dc31d2" +DEPENDS = "flex-native bison-native" + +SRC_URI = "https://www.tcpdump.org/release/${BP}.tar.gz" +SRC_URI[sha256sum] = "db6d79d4ad03b8b15fb16c42447d093ad3520c0ec0ae3d331104dcfb1ce77560" + +inherit autotools binconfig-disabled pkgconfig + +BINCONFIG = "${bindir}/pcap-config" + +# Explicitly disable dag support. We don't have recipe for it and if enabled here, +# configure script poisons the include dirs with /usr/local/include even when the +# support hasn't been detected. Do the same thing for DPDK. +EXTRA_OECONF = " \ + --with-pcap=linux \ + --without-dag \ + --without-dpdk \ + " +EXTRA_AUTORECONF += "--exclude=aclocal" + +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez5', '', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ +" +PACKAGECONFIG[bluez5] = "--enable-bluetooth,--disable-bluetooth,bluez5" +PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus" +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," +PACKAGECONFIG[libnl] = "--with-libnl,--without-libnl,libnl" + +do_configure:prepend () { + #remove hardcoded references to /usr/include + sed 's|\([ "^'\''I]\+\)/usr/include/|\1${STAGING_INCDIR}/|g' -i ${S}/configure.ac +} + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch b/poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch new file mode 100644 index 0000000000..40ceff9ae9 --- /dev/null +++ b/poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch @@ -0,0 +1,171 @@ +From e89652b853ca7de671093ae44305fa3435e13d3d Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 13:29:43 -0800 +Subject: [PATCH] Replace statfs64 with statfs + +autoconf AC_SYS_LARGEFILE is used by configure to add needed defines +when needed for enabling 64bit off_t, therefore replacing statfs64 with +statfs should be functionally same. Additionally this helps compiling +with latest musl where 64bit LFS functions like statfs64 and friends are +now moved under _LARGEFILE64_SOURCE feature test macro, this works on +glibc systems because _GNU_SOURCE macros also enables +_LARGEFILE64_SOURCE indirectly. This is not case with musl and this +latest issue is exposed. + +Upstream-Status: Submitted [https://lore.kernel.org/linux-nfs/20221215213605.4061853-1-raj.khem@gmail.com/T/#u] +Signed-off-by: Khem Raj +--- + support/export/cache.c | 14 +++++++------- + support/include/nfsd_path.h | 6 +++--- + support/misc/nfsd_path.c | 24 ++++++++++++------------ + utils/exportfs/exportfs.c | 4 ++-- + 4 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/support/export/cache.c b/support/export/cache.c +index a5823e9..2497d4f 100644 +--- a/support/export/cache.c ++++ b/support/export/cache.c +@@ -346,27 +346,27 @@ static int uuid_by_path(char *path, int type, size_t uuidlen, char *uuid) + + /* Possible sources of uuid are + * - blkid uuid +- * - statfs64 uuid ++ * - statfs uuid + * +- * On some filesystems (e.g. vfat) the statfs64 uuid is simply an ++ * On some filesystems (e.g. vfat) the statfs uuid is simply an + * encoding of the device that the filesystem is mounted from, so + * it we be very bad to use that (as device numbers change). blkid + * must be preferred. +- * On other filesystems (e.g. btrfs) the statfs64 uuid contains ++ * On other filesystems (e.g. btrfs) the statfs uuid contains + * important info that the blkid uuid cannot contain: This happens + * when multiple subvolumes are exported (they have the same +- * blkid uuid but different statfs64 uuids). ++ * blkid uuid but different statfs uuids). + * We rely on get_uuid_blkdev *knowing* which is which and not returning +- * a uuid for filesystems where the statfs64 uuid is better. ++ * a uuid for filesystems where the statfs uuid is better. + * + */ +- struct statfs64 st; ++ struct statfs st; + char fsid_val[17]; + const char *blkid_val = NULL; + const char *val; + int rc; + +- rc = nfsd_path_statfs64(path, &st); ++ rc = nfsd_path_statfs(path, &st); + + if (type == 0 && rc == 0) { + const unsigned long *bad; +diff --git a/support/include/nfsd_path.h b/support/include/nfsd_path.h +index 3b73aad..aa1e1dd 100644 +--- a/support/include/nfsd_path.h ++++ b/support/include/nfsd_path.h +@@ -7,7 +7,7 @@ + #include + + struct file_handle; +-struct statfs64; ++struct statfs; + + void nfsd_path_init(void); + +@@ -18,8 +18,8 @@ char * nfsd_path_prepend_dir(const char *dir, const char *pathname); + int nfsd_path_stat(const char *pathname, struct stat *statbuf); + int nfsd_path_lstat(const char *pathname, struct stat *statbuf); + +-int nfsd_path_statfs64(const char *pathname, +- struct statfs64 *statbuf); ++int nfsd_path_statfs(const char *pathname, ++ struct statfs *statbuf); + + char * nfsd_realpath(const char *path, char *resolved_path); + +diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c +index 65e53c1..c3dea4f 100644 +--- a/support/misc/nfsd_path.c ++++ b/support/misc/nfsd_path.c +@@ -184,46 +184,46 @@ nfsd_path_lstat(const char *pathname, struct stat *statbuf) + return nfsd_run_stat(nfsd_wq, nfsd_lstatfunc, pathname, statbuf); + } + +-struct nfsd_statfs64_data { ++struct nfsd_statfs_data { + const char *pathname; +- struct statfs64 *statbuf; ++ struct statfs *statbuf; + int ret; + int err; + }; + + static void +-nfsd_statfs64func(void *data) ++nfsd_statfsfunc(void *data) + { +- struct nfsd_statfs64_data *d = data; ++ struct nfsd_statfs_data *d = data; + +- d->ret = statfs64(d->pathname, d->statbuf); ++ d->ret = statfs(d->pathname, d->statbuf); + if (d->ret < 0) + d->err = errno; + } + + static int +-nfsd_run_statfs64(struct xthread_workqueue *wq, ++nfsd_run_statfs(struct xthread_workqueue *wq, + const char *pathname, +- struct statfs64 *statbuf) ++ struct statfs *statbuf) + { +- struct nfsd_statfs64_data data = { ++ struct nfsd_statfs_data data = { + pathname, + statbuf, + 0, + 0 + }; +- xthread_work_run_sync(wq, nfsd_statfs64func, &data); ++ xthread_work_run_sync(wq, nfsd_statfsfunc, &data); + if (data.ret < 0) + errno = data.err; + return data.ret; + } + + int +-nfsd_path_statfs64(const char *pathname, struct statfs64 *statbuf) ++nfsd_path_statfs(const char *pathname, struct statfs *statbuf) + { + if (!nfsd_wq) +- return statfs64(pathname, statbuf); +- return nfsd_run_statfs64(nfsd_wq, pathname, statbuf); ++ return statfs(pathname, statbuf); ++ return nfsd_run_statfs(nfsd_wq, pathname, statbuf); + } + + struct nfsd_realpath_data { +diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c +index 0897b22..6d79a5b 100644 +--- a/utils/exportfs/exportfs.c ++++ b/utils/exportfs/exportfs.c +@@ -513,7 +513,7 @@ validate_export(nfs_export *exp) + */ + struct stat stb; + char *path = exportent_realpath(&exp->m_export); +- struct statfs64 stf; ++ struct statfs stf; + int fs_has_fsid = 0; + + if (stat(path, &stb) < 0) { +@@ -528,7 +528,7 @@ validate_export(nfs_export *exp) + if (!can_test()) + return; + +- if (!statfs64(path, &stf) && ++ if (!statfs(path, &stf) && + (stf.f_fsid.__val[0] || stf.f_fsid.__val[1])) + fs_has_fsid = 1; + diff --git a/poky/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb b/poky/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb index 4b5c28c27b..21df1803c5 100644 --- a/poky/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb +++ b/poky/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb @@ -32,6 +32,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x file://clang-warnings.patch \ file://0005-mountd-Check-for-return-of-stat-function.patch \ file://0006-Fix-function-prototypes.patch \ + file://0001-Replace-statfs64-with-statfs.patch \ " SRC_URI[sha256sum] = "5200873e81c4d610e2462fc262fe18135f2dbe78b7979f95accd159ae64d5011" diff --git a/poky/meta/recipes-connectivity/openssh/openssh_9.1p1.bb b/poky/meta/recipes-connectivity/openssh/openssh_9.1p1.bb index 85f97b1bbb..23ae8d5b0c 100644 --- a/poky/meta/recipes-connectivity/openssh/openssh_9.1p1.bb +++ b/poky/meta/recipes-connectivity/openssh/openssh_9.1p1.bb @@ -52,15 +52,12 @@ SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket" inherit autotools-brokensep ptest -PACKAGECONFIG ??= "rng-tools" +PACKAGECONFIG ??= "" PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5" PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns" PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit" PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat" -# Add RRECOMMENDS to rng-tools for sshd package -PACKAGECONFIG[rng-tools] = "" - EXTRA_AUTORECONF += "--exclude=aclocal" # login path is hardcoded in sshd @@ -160,10 +157,6 @@ FILES:${PN}-keygen = "${bindir}/ssh-keygen" RDEPENDS:${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen ${PN}-sftp-server" RDEPENDS:${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}" -RRECOMMENDS:${PN}-sshd:append:class-target = "\ - ${@bb.utils.filter('PACKAGECONFIG', 'rng-tools', d)} \ -" - # gdb would make attach-ptrace test pass rather than skip but not worth the build dependencies RDEPENDS:${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make sed sudo coreutils" diff --git a/poky/meta/recipes-connectivity/resolvconf/resolvconf/0001-avoid-using-m-option-for-readlink.patch b/poky/meta/recipes-connectivity/resolvconf/resolvconf/0001-avoid-using-m-option-for-readlink.patch new file mode 100644 index 0000000000..ab32f26754 --- /dev/null +++ b/poky/meta/recipes-connectivity/resolvconf/resolvconf/0001-avoid-using-m-option-for-readlink.patch @@ -0,0 +1,37 @@ +From 6bf2bb136a0b3961339369bc08e58b661fba0edb Mon Sep 17 00:00:00 2001 +From: Chen Qi +Date: Thu, 17 Nov 2022 17:26:30 +0800 +Subject: [PATCH] avoid using -m option for readlink + +Use a more widely used option '-f' instead of '-m' here to +avoid dependency on coreutils. + +Looking at the git history of the resolvconf repo, the '-m' +is deliberately used. And it wants to depend on coreutils. +But in case of OE, the existence of /etc is ensured, and busybox +readlink provides '-f' option, so we can just use '-f'. In this +way, the coreutils dependency is not necessary any more. + +Upstream-Status: Inappropriate [OE Specific] + +Signed-off-by: Chen Qi +--- + etc/resolvconf/update.d/libc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/etc/resolvconf/update.d/libc b/etc/resolvconf/update.d/libc +index 1c4f6bc..f75d22c 100755 +--- a/etc/resolvconf/update.d/libc ++++ b/etc/resolvconf/update.d/libc +@@ -57,7 +57,7 @@ fi + report_warning() { echo "$0: Warning: $*" >&2 ; } + + resolv_conf_is_symlinked_to_dynamic_file() { +- [ -L ${ETC}/resolv.conf ] && [ "$(readlink -m ${ETC}/resolv.conf)" = "$DYNAMICRSLVCNFFILE" ] ++ [ -L ${ETC}/resolv.conf ] && [ "$(readlink -f ${ETC}/resolv.conf)" = "$DYNAMICRSLVCNFFILE" ] + } + + if ! resolv_conf_is_symlinked_to_dynamic_file ; then +-- +2.17.1 + diff --git a/poky/meta/recipes-connectivity/resolvconf/resolvconf_1.91.bb b/poky/meta/recipes-connectivity/resolvconf/resolvconf_1.91.bb index 94fd2c1a70..3f1b75d07d 100644 --- a/poky/meta/recipes-connectivity/resolvconf/resolvconf_1.91.bb +++ b/poky/meta/recipes-connectivity/resolvconf/resolvconf_1.91.bb @@ -9,10 +9,11 @@ LICENSE = "GPL-2.0-or-later" LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b" AUTHOR = "Thomas Hood" HOMEPAGE = "http://packages.debian.org/resolvconf" -RDEPENDS:${PN} = "bash" +RDEPENDS:${PN} = "bash sed util-linux-flock" SRC_URI = "git://salsa.debian.org/debian/resolvconf.git;protocol=https;branch=unstable \ file://99_resolvconf \ + file://0001-avoid-using-m-option-for-readlink.patch \ " SRCREV = "859209d573e7aec0e95d812c6b52444591a628d1" @@ -23,8 +24,6 @@ S = "${WORKDIR}/git" # so we check the latest upstream from a directory that does get updated UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/r/resolvconf/" -inherit allarch - do_compile () { : } @@ -39,12 +38,14 @@ do_install () { fi install -d ${D}${base_libdir}/${BPN} install -d ${D}${sysconfdir}/${BPN} + install -d ${D}${nonarch_base_libdir}/${BPN} ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run install -d ${D}${sysconfdir} ${D}${base_sbindir} install -d ${D}${mandir}/man8 ${D}${docdir}/${P} cp -pPR etc/resolvconf ${D}${sysconfdir}/ chown -R root:root ${D}${sysconfdir}/ install -m 0755 bin/resolvconf ${D}${base_sbindir}/ + install -m 0755 bin/normalize-resolvconf ${D}${nonarch_base_libdir}/${BPN} install -m 0755 bin/list-records ${D}${base_libdir}/${BPN} install -d ${D}/${sysconfdir}/network/if-up.d install -m 0755 debian/resolvconf.000resolvconf.if-up ${D}/${sysconfdir}/network/if-up.d/000resolvconf @@ -64,4 +65,4 @@ pkg_postinst:${PN} () { fi } -FILES:${PN} += "${base_libdir}/${BPN}" +FILES:${PN} += "${base_libdir}/${BPN} ${nonarch_base_libdir}/${BPN}" diff --git a/poky/meta/recipes-connectivity/slirp/libslirp_git.bb b/poky/meta/recipes-connectivity/slirp/libslirp_git.bb new file mode 100644 index 0000000000..334b786b9b --- /dev/null +++ b/poky/meta/recipes-connectivity/slirp/libslirp_git.bb @@ -0,0 +1,18 @@ +SUMMARY = "A general purpose TCP-IP emulator" +DESCRIPTION = "A general purpose TCP-IP emulator used by virtual machine hypervisors to provide virtual networking services." +HOMEPAGE = "https://gitlab.freedesktop.org/slirp/libslirp" +LICENSE = "BSD-3-Clause & MIT" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=bca0186b14e6b05e338e729f106db727" + +SRC_URI = "git://gitlab.freedesktop.org/slirp/libslirp.git;protocol=https;branch=master" +SRCREV = "3ad1710a96678fe79066b1469cead4058713a1d9" +PV = "4.7.0" +S = "${WORKDIR}/git" + +DEPENDS = " \ + glib-2.0 \ +" + +inherit meson pkgconfig + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.10.bb b/poky/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.10.bb index 4e27b92bc6..46604045da 100644 --- a/poky/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.10.bb +++ b/poky/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant_2.10.bb @@ -134,4 +134,4 @@ python split_wpa_supplicant_libs () { d.setVar('RRECOMMENDS:' + pn + '-plugins', ' '.join(split_packages)) d.appendVar('RRECOMMENDS:' + pn + '-dbg', ' ' + ' '.join(split_dbg_packages)) } -PACKAGESPLITFUNCS:prepend = "split_wpa_supplicant_libs " +PACKAGESPLITFUNCS += "split_wpa_supplicant_libs" diff --git a/poky/meta/recipes-core/busybox/busybox.inc b/poky/meta/recipes-core/busybox/busybox.inc index 5f1c473d5e..62dc839245 100644 --- a/poky/meta/recipes-core/busybox/busybox.inc +++ b/poky/meta/recipes-core/busybox/busybox.inc @@ -138,19 +138,26 @@ do_configure () { do_prepare_config merge_config.sh -m .config ${@" ".join(find_cfgs(d))} cml1_do_configure + + # Save a copy of .config and autoconf.h. + cp .config .config.orig + cp include/autoconf.h include/autoconf.h.orig } do_compile() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS export KCONFIG_NOTIMESTAMP=1 + # Ensure we start do_compile with the original .config and autoconf.h. + # These files should always have matching timestamps. + cp .config.orig .config + cp include/autoconf.h.orig include/autoconf.h + if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then + # Guard againt interrupted do_compile: clean temporary files. + rm -f .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps + # split the .config into two parts, and make two busybox binaries - if [ -e .config.orig ]; then - # Need to guard again an interrupted do_compile - restore any backup - cp .config.orig .config - fi - cp .config .config.orig oe_runmake busybox.cfg.suid oe_runmake busybox.cfg.nosuid @@ -187,15 +194,18 @@ do_compile() { bbfatal "busybox suid binary incorrectly provides /bin/sh" fi - # copy .config.orig back to .config, because the install process may check this file - cp .config.orig .config # cleanup - rm .config.orig .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps + rm .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps else oe_runmake busybox_unstripped cp busybox_unstripped busybox oe_runmake busybox.links fi + + # restore original .config and autoconf.h, because the install process + # may check these files + cp .config.orig .config + cp include/autoconf.h.orig include/autoconf.h } do_install () { diff --git a/poky/meta/recipes-core/dbus/dbus_1.14.4.bb b/poky/meta/recipes-core/dbus/dbus_1.14.4.bb index cf7f830f16..5f91ec2dc1 100644 --- a/poky/meta/recipes-core/dbus/dbus_1.14.4.bb +++ b/poky/meta/recipes-core/dbus/dbus_1.14.4.bb @@ -183,3 +183,5 @@ do_install:class-nativesdk() { rm -rf ${D}${localstatedir}/run } BBCLASSEXTEND = "native nativesdk" + +CVE_PRODUCT += "d-bus_project:d-bus" diff --git a/poky/meta/recipes-core/dropbear/dropbear/0007-Fix-X11-build-failure-use-DROPBEAR_PRIO_LOWDELAY.patch b/poky/meta/recipes-core/dropbear/dropbear/0007-Fix-X11-build-failure-use-DROPBEAR_PRIO_LOWDELAY.patch deleted file mode 100644 index 042dccbb94..0000000000 --- a/poky/meta/recipes-core/dropbear/dropbear/0007-Fix-X11-build-failure-use-DROPBEAR_PRIO_LOWDELAY.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 64292091fe3e8ea7c9bfe74af730b2ff5428bf10 Mon Sep 17 00:00:00 2001 -From: Matt Johnston -Date: Sat, 23 Apr 2022 22:33:31 +0800 -Subject: [PATCH] Fix X11 build failure, use DROPBEAR_PRIO_LOWDELAY - -Upstream-Status: Backport - -Signed-off-by: Daniel Gomez ---- - svr-x11fwd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/svr-x11fwd.c b/svr-x11fwd.c -index 353cb12..5d9e6a9 100644 ---- a/svr-x11fwd.c -+++ b/svr-x11fwd.c -@@ -206,7 +206,7 @@ void x11cleanup(struct ChanSess *chansess) { - } - - static int x11_inithandler(struct Channel *channel) { -- channel->prio = DROPBEAR_CHANNEL_PRIO_INTERACTIVE; -+ channel->prio = DROPBEAR_PRIO_LOWDELAY; - return 0; - } - --- -2.35.1 - diff --git a/poky/meta/recipes-core/dropbear/dropbear_2022.82.bb b/poky/meta/recipes-core/dropbear/dropbear_2022.82.bb deleted file mode 100644 index 4ed4c65cc1..0000000000 --- a/poky/meta/recipes-core/dropbear/dropbear_2022.82.bb +++ /dev/null @@ -1,133 +0,0 @@ -SUMMARY = "A lightweight SSH and SCP implementation" -HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html" -DESCRIPTION = "Dropbear is a relatively small SSH server and client. It runs on a variety of POSIX-based platforms. Dropbear is open source software, distributed under a MIT-style license. Dropbear is particularly useful for "embedded"-type Linux (or other Unix) systems, such as wireless routers." -SECTION = "console/network" - -# some files are from other projects and have others license terms: -# public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY -LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD" -LIC_FILES_CHKSUM = "file://LICENSE;md5=25cf44512b7bc8966a48b6b1a9b7605f" - -DEPENDS = "zlib virtual/crypt" -RPROVIDES:${PN} = "ssh sshd" -RCONFLICTS:${PN} = "openssh-sshd openssh" - -SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \ - file://0001-urandom-xauth-changes-to-options.h.patch \ - file://init \ - file://dropbearkey.service \ - file://dropbear@.service \ - file://dropbear.socket \ - file://dropbear.default \ - ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', '', d)} \ - file://0007-Fix-X11-build-failure-use-DROPBEAR_PRIO_LOWDELAY.patch" - -SRC_URI[sha256sum] = "3a038d2bbc02bf28bbdd20c012091f741a3ec5cbe460691811d714876aad75d1" - -PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \ - file://0006-dropbear-configuration-file.patch \ - file://dropbear" - -PAM_PLUGINS = "libpam-runtime \ - pam-plugin-deny \ - pam-plugin-permit \ - pam-plugin-unix \ - " -inherit autotools update-rc.d systemd - -CVE_PRODUCT = "dropbear_ssh" - -INITSCRIPT_NAME = "dropbear" -INITSCRIPT_PARAMS = "defaults 10" - -SYSTEMD_SERVICE:${PN} = "dropbear.socket" - -SBINCOMMANDS = "dropbear dropbearkey dropbearconvert" -BINCOMMANDS = "dbclient ssh scp" -EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"' - -PACKAGECONFIG ?= "disable-weak-ciphers ${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" -PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam,${PAM_PLUGINS}" -PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt" -PACKAGECONFIG[disable-weak-ciphers] = "" -PACKAGECONFIG[enable-x11-forwarding] = "" - -# This option appends to CFLAGS and LDFLAGS from OE -# This is causing [textrel] QA warning -EXTRA_OECONF += "--disable-harden" - -# musl does not implement wtmp/logwtmp APIs -EXTRA_OECONF:append:libc-musl = " --disable-wtmp --disable-lastlog" - -do_configure:append() { - echo "/* Dropbear features */" > ${B}/localoptions.h - if ${@bb.utils.contains('PACKAGECONFIG', 'enable-x11-forwarding', 'true', 'false', d)}; then - echo "#define DROPBEAR_X11FWD 1" >> ${B}/localoptions.h - fi -} - -do_install() { - install -d ${D}${sysconfdir} \ - ${D}${sysconfdir}/init.d \ - ${D}${sysconfdir}/default \ - ${D}${sysconfdir}/dropbear \ - ${D}${bindir} \ - ${D}${sbindir} \ - ${D}${localstatedir} - - install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear - - install -m 0755 dropbearmulti ${D}${sbindir}/ - - for i in ${BINCOMMANDS} - do - # ssh and scp symlinks are created by update-alternatives - if [ $i = ssh ] || [ $i = scp ]; then continue; fi - ln -s ${sbindir}/dropbearmulti ${D}${bindir}/$i - done - for i in ${SBINCOMMANDS} - do - ln -s ./dropbearmulti ${D}${sbindir}/$i - done - sed -e 's,/etc,${sysconfdir},g' \ - -e 's,/usr/sbin,${sbindir},g' \ - -e 's,/var,${localstatedir},g' \ - -e 's,/usr/bin,${bindir},g' \ - -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear - chmod 755 ${D}${sysconfdir}/init.d/dropbear - if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then - install -d ${D}${sysconfdir}/pam.d - install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/ - fi - - # deal with systemd unit files - install -d ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_system_unitdir} - install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_system_unitdir} - sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ - -e 's,@BINDIR@,${bindir},g' \ - -e 's,@SBINDIR@,${sbindir},g' \ - ${D}${systemd_system_unitdir}/dropbear.socket ${D}${systemd_system_unitdir}/*.service -} - -inherit update-alternatives - -ALTERNATIVE_PRIORITY = "20" -ALTERNATIVE:${PN} = "${@bb.utils.filter('BINCOMMANDS', 'scp ssh', d)}" - -ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti" - -pkg_postrm:${PN} () { - if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then - rm ${sysconfdir}/dropbear/dropbear_rsa_host_key - fi - if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then - rm ${sysconfdir}/dropbear/dropbear_dss_host_key - fi -} - -CONFFILES:${PN} = "${sysconfdir}/default/dropbear" - -FILES:${PN} += "${bindir}" diff --git a/poky/meta/recipes-core/dropbear/dropbear_2022.83.bb b/poky/meta/recipes-core/dropbear/dropbear_2022.83.bb new file mode 100644 index 0000000000..0c7a8f4caa --- /dev/null +++ b/poky/meta/recipes-core/dropbear/dropbear_2022.83.bb @@ -0,0 +1,133 @@ +SUMMARY = "A lightweight SSH and SCP implementation" +HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html" +DESCRIPTION = "Dropbear is a relatively small SSH server and client. It runs on a variety of POSIX-based platforms. Dropbear is open source software, distributed under a MIT-style license. Dropbear is particularly useful for "embedded"-type Linux (or other Unix) systems, such as wireless routers." +SECTION = "console/network" + +# some files are from other projects and have others license terms: +# public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY +LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD" +LIC_FILES_CHKSUM = "file://LICENSE;md5=25cf44512b7bc8966a48b6b1a9b7605f" + +DEPENDS = "zlib virtual/crypt" +RPROVIDES:${PN} = "ssh sshd" +RCONFLICTS:${PN} = "openssh-sshd openssh" + +SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \ + file://0001-urandom-xauth-changes-to-options.h.patch \ + file://init \ + file://dropbearkey.service \ + file://dropbear@.service \ + file://dropbear.socket \ + file://dropbear.default \ + ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', '', d)} \ + " + +SRC_URI[sha256sum] = "bc5a121ffbc94b5171ad5ebe01be42746d50aa797c9549a4639894a16749443b" + +PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \ + file://0006-dropbear-configuration-file.patch \ + file://dropbear" + +PAM_PLUGINS = "libpam-runtime \ + pam-plugin-deny \ + pam-plugin-permit \ + pam-plugin-unix \ + " +inherit autotools update-rc.d systemd + +CVE_PRODUCT = "dropbear_ssh" + +INITSCRIPT_NAME = "dropbear" +INITSCRIPT_PARAMS = "defaults 10" + +SYSTEMD_SERVICE:${PN} = "dropbear.socket" + +SBINCOMMANDS = "dropbear dropbearkey dropbearconvert" +BINCOMMANDS = "dbclient ssh scp" +EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"' + +PACKAGECONFIG ?= "disable-weak-ciphers ${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" +PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam,${PAM_PLUGINS}" +PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt" +PACKAGECONFIG[disable-weak-ciphers] = "" +PACKAGECONFIG[enable-x11-forwarding] = "" + +# This option appends to CFLAGS and LDFLAGS from OE +# This is causing [textrel] QA warning +EXTRA_OECONF += "--disable-harden" + +# musl does not implement wtmp/logwtmp APIs +EXTRA_OECONF:append:libc-musl = " --disable-wtmp --disable-lastlog" + +do_configure:append() { + echo "/* Dropbear features */" > ${B}/localoptions.h + if ${@bb.utils.contains('PACKAGECONFIG', 'enable-x11-forwarding', 'true', 'false', d)}; then + echo "#define DROPBEAR_X11FWD 1" >> ${B}/localoptions.h + fi +} + +do_install() { + install -d ${D}${sysconfdir} \ + ${D}${sysconfdir}/init.d \ + ${D}${sysconfdir}/default \ + ${D}${sysconfdir}/dropbear \ + ${D}${bindir} \ + ${D}${sbindir} \ + ${D}${localstatedir} + + install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear + + install -m 0755 dropbearmulti ${D}${sbindir}/ + + for i in ${BINCOMMANDS} + do + # ssh and scp symlinks are created by update-alternatives + if [ $i = ssh ] || [ $i = scp ]; then continue; fi + ln -s ${sbindir}/dropbearmulti ${D}${bindir}/$i + done + for i in ${SBINCOMMANDS} + do + ln -s ./dropbearmulti ${D}${sbindir}/$i + done + sed -e 's,/etc,${sysconfdir},g' \ + -e 's,/usr/sbin,${sbindir},g' \ + -e 's,/var,${localstatedir},g' \ + -e 's,/usr/bin,${bindir},g' \ + -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear + chmod 755 ${D}${sysconfdir}/init.d/dropbear + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then + install -d ${D}${sysconfdir}/pam.d + install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/ + fi + + # deal with systemd unit files + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + ${D}${systemd_system_unitdir}/dropbear.socket ${D}${systemd_system_unitdir}/*.service +} + +inherit update-alternatives + +ALTERNATIVE_PRIORITY = "20" +ALTERNATIVE:${PN} = "${@bb.utils.filter('BINCOMMANDS', 'scp ssh', d)}" + +ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti" + +pkg_postrm:${PN} () { + if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then + rm ${sysconfdir}/dropbear/dropbear_rsa_host_key + fi + if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then + rm ${sysconfdir}/dropbear/dropbear_dss_host_key + fi +} + +CONFFILES:${PN} = "${sysconfdir}/default/dropbear" + +FILES:${PN} += "${bindir}" diff --git a/poky/meta/recipes-core/ell/ell_0.53.bb b/poky/meta/recipes-core/ell/ell_0.53.bb deleted file mode 100644 index 7817476030..0000000000 --- a/poky/meta/recipes-core/ell/ell_0.53.bb +++ /dev/null @@ -1,22 +0,0 @@ -SUMMARY = "Embedded Linux Library" -HOMEPAGE = "https://01.org/ell" -DESCRIPTION = "The Embedded Linux Library (ELL) provides core, \ -low-level functionality for system daemons. It typically has no \ -dependencies other than the Linux kernel, C standard library, and \ -libdl (for dynamic linking). While ELL is designed to be efficient \ -and compact enough for use on embedded Linux platforms, it is not \ -limited to resource-constrained systems." -SECTION = "libs" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09" - -DEPENDS = "dbus" - -inherit autotools pkgconfig - -SRC_URI = "https://mirrors.edge.kernel.org/pub/linux/libs/${BPN}/${BPN}-${PV}.tar.xz" -SRC_URI[sha256sum] = "a7d0df846af839bbea1b80f292166371070328854b3fa785b5c607fe600552ad" - -do_configure:prepend () { - mkdir -p ${S}/build-aux -} diff --git a/poky/meta/recipes-core/ell/ell_0.55.bb b/poky/meta/recipes-core/ell/ell_0.55.bb new file mode 100644 index 0000000000..7184701e4e --- /dev/null +++ b/poky/meta/recipes-core/ell/ell_0.55.bb @@ -0,0 +1,22 @@ +SUMMARY = "Embedded Linux Library" +HOMEPAGE = "https://01.org/ell" +DESCRIPTION = "The Embedded Linux Library (ELL) provides core, \ +low-level functionality for system daemons. It typically has no \ +dependencies other than the Linux kernel, C standard library, and \ +libdl (for dynamic linking). While ELL is designed to be efficient \ +and compact enough for use on embedded Linux platforms, it is not \ +limited to resource-constrained systems." +SECTION = "libs" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09" + +DEPENDS = "dbus" + +inherit autotools pkgconfig + +SRC_URI = "https://mirrors.edge.kernel.org/pub/linux/libs/${BPN}/${BPN}-${PV}.tar.xz" +SRC_URI[sha256sum] = "a7e1fd3e13d9083f80eb9787546add49fba5c3d9e9f166b06e2ff9fd8030dc6d" + +do_configure:prepend () { + mkdir -p ${S}/build-aux +} diff --git a/poky/meta/recipes-core/glib-2.0/glib-2.0/fix-errno.patch b/poky/meta/recipes-core/glib-2.0/glib-2.0/fix-errno.patch new file mode 100644 index 0000000000..144fe8bbd8 --- /dev/null +++ b/poky/meta/recipes-core/glib-2.0/glib-2.0/fix-errno.patch @@ -0,0 +1,31 @@ +From 6626765a79f125cf0ec9cdaefa51ceef718d41e7 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Tue, 20 Dec 2022 17:10:41 -0600 +Subject: [PATCH] gthread-posix: need to #include + +a79c6af23eff5ee978db62e048828c9a992a1261 uses errno without the required +header. + + +(cherry picked from commit 03cb4261e00cf505790f4fd4e69f97b2ef4fcccd) + +Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/6626765a79f125cf0ec9cdaefa51ceef718d41e7] +Signed-off-by: Alexander Kanavin +--- + glib/gthreadprivate.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/glib/gthreadprivate.h b/glib/gthreadprivate.h +index 6eaf422753..f34368a7c2 100644 +--- a/glib/gthreadprivate.h ++++ b/glib/gthreadprivate.h +@@ -41,6 +41,7 @@ struct _GRealThread + /* system thread implementation (gthread-posix.c, gthread-win32.c) */ + + #if defined(HAVE_FUTEX) || defined(HAVE_FUTEX_TIME64) ++#include + #include + #include + #include +-- +GitLab diff --git a/poky/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch b/poky/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch index 7723ac6672..168dc73290 100644 --- a/poky/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch +++ b/poky/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch @@ -1,4 +1,4 @@ -From 0da0b608fdbb144c39225233cbdd89995b76904b Mon Sep 17 00:00:00 2001 +From 2adfd458507c8c832955d6ffb9408d6c574b94f6 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 11 Mar 2016 15:35:55 +0000 Subject: [PATCH] glib-2.0: relocate the GIO module directory for native builds @@ -19,7 +19,7 @@ Signed-off-by: Jussi Kukkonen 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gio/giomodule.c b/gio/giomodule.c -index f5dbb4555..c926e77a8 100644 +index f5dbb45..c926e77 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -58,6 +58,8 @@ diff --git a/poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.1.bb b/poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.1.bb deleted file mode 100644 index 8fd785a7fd..0000000000 --- a/poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.1.bb +++ /dev/null @@ -1,55 +0,0 @@ -require glib.inc - -PE = "1" - -SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" - -SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \ - file://run-ptest \ - file://0001-Fix-DATADIRNAME-on-uclibc-Linux.patch \ - file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \ - file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \ - file://0010-Do-not-hardcode-python-path-into-various-tools.patch \ - file://0001-Set-host_machine-correctly-when-building-with-mingw3.patch \ - file://0001-Do-not-write-bindir-into-pkg-config-files.patch \ - file://0001-meson-Run-atomics-test-on-clang-as-well.patch \ - file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \ - file://0001-gio-tests-g-file-info-don-t-assume-million-in-one-ev.patch \ - file://0001-gio-tests-meson.build-do-not-use-can_run_host_binari.patch \ - file://cpp-null.patch \ - file://cpp-null2.patch \ - " -SRC_URI:append:class-native = " file://relocate-modules.patch" - -SRC_URI[sha256sum] = "0ab981618d1db47845e56417b0d7c123f81a3427b2b9c93f5a46ff5bbb964964" - -# Find any meson cross files in FILESPATH that are relevant for the current -# build (using siteinfo) and add them to EXTRA_OEMESON. -inherit siteinfo -def find_meson_cross_files(d): - if bb.data.inherits_class('native', d): - return "" - - thisdir = os.path.normpath(d.getVar("THISDIR")) - import collections - sitedata = siteinfo_data(d) - # filename -> found - files = collections.OrderedDict() - for path in d.getVar("FILESPATH").split(":"): - for element in sitedata: - filename = os.path.normpath(os.path.join(path, "meson.cross.d", element)) - sanitized_path = filename.replace(thisdir, "${THISDIR}") - if sanitized_path == filename: - if os.path.exists(filename): - bb.error("Cannot add '%s' to --cross-file, because it's not relative to THISDIR '%s' and sstate signature would contain this full path" % (filename, thisdir)) - continue - files[filename.replace(thisdir, "${THISDIR}")] = os.path.exists(filename) - - items = ["--cross-file=" + k for k,v in files.items() if v] - d.appendVar("EXTRA_OEMESON", " " + " ".join(items)) - items = ["%s:%s" % (k, "True" if v else "False") for k,v in files.items()] - d.appendVarFlag("do_configure", "file-checksums", " " + " ".join(items)) - -python () { - find_meson_cross_files(d) -} diff --git a/poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb b/poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb new file mode 100644 index 0000000000..e5279e946c --- /dev/null +++ b/poky/meta/recipes-core/glib-2.0/glib-2.0_2.74.4.bb @@ -0,0 +1,56 @@ +require glib.inc + +PE = "1" + +SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" + +SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \ + file://run-ptest \ + file://0001-Fix-DATADIRNAME-on-uclibc-Linux.patch \ + file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \ + file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \ + file://0010-Do-not-hardcode-python-path-into-various-tools.patch \ + file://0001-Set-host_machine-correctly-when-building-with-mingw3.patch \ + file://0001-Do-not-write-bindir-into-pkg-config-files.patch \ + file://0001-meson-Run-atomics-test-on-clang-as-well.patch \ + file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \ + file://0001-gio-tests-g-file-info-don-t-assume-million-in-one-ev.patch \ + file://0001-gio-tests-meson.build-do-not-use-can_run_host_binari.patch \ + file://cpp-null.patch \ + file://cpp-null2.patch \ + file://fix-errno.patch \ + " +SRC_URI:append:class-native = " file://relocate-modules.patch" + +SRC_URI[sha256sum] = "0e82da5ea129b4444227c7e4a9e598f7288d1994bf63f129c44b90cfd2432172" + +# Find any meson cross files in FILESPATH that are relevant for the current +# build (using siteinfo) and add them to EXTRA_OEMESON. +inherit siteinfo +def find_meson_cross_files(d): + if bb.data.inherits_class('native', d): + return "" + + thisdir = os.path.normpath(d.getVar("THISDIR")) + import collections + sitedata = siteinfo_data(d) + # filename -> found + files = collections.OrderedDict() + for path in d.getVar("FILESPATH").split(":"): + for element in sitedata: + filename = os.path.normpath(os.path.join(path, "meson.cross.d", element)) + sanitized_path = filename.replace(thisdir, "${THISDIR}") + if sanitized_path == filename: + if os.path.exists(filename): + bb.error("Cannot add '%s' to --cross-file, because it's not relative to THISDIR '%s' and sstate signature would contain this full path" % (filename, thisdir)) + continue + files[filename.replace(thisdir, "${THISDIR}")] = os.path.exists(filename) + + items = ["--cross-file=" + k for k,v in files.items() if v] + d.appendVar("EXTRA_OEMESON", " " + " ".join(items)) + items = ["%s:%s" % (k, "True" if v else "False") for k,v in files.items()] + d.appendVarFlag("do_configure", "file-checksums", " " + " ".join(items)) + +python () { + find_meson_cross_files(d) +} diff --git a/poky/meta/recipes-core/glibc/glibc-tests_2.36.bb b/poky/meta/recipes-core/glibc/glibc-tests_2.36.bb index c71c0831c6..bb6ef06162 100644 --- a/poky/meta/recipes-core/glibc/glibc-tests_2.36.bb +++ b/poky/meta/recipes-core/glibc/glibc-tests_2.36.bb @@ -16,7 +16,6 @@ python __anonymous() { d.setVar("PACKAGES", "${PN} ${PN}-ptest") d.setVar("PROVIDES", "${PN} ${PN}-ptest") - d.setVar("RPROVIDES", "${PN} ${PN}-ptest") bbclassextend = d.getVar("BBCLASSEXTEND").replace("nativesdk", "").strip() d.setVar("BBCLASSEXTEND", bbclassextend) @@ -29,6 +28,7 @@ python __anonymous() { RPROVIDES:${PN} = "${PN}" RRECOMMENDS:${PN} = "" RDEPENDS:${PN} = " glibc sed" +RDEPENDS:${PN}-ptest = "${PN}" DEPENDS += "sed" export oe_srcdir="${exec_prefix}/src/debug/glibc/${PV}/" diff --git a/poky/meta/recipes-core/glibc/glibc/0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch b/poky/meta/recipes-core/glibc/glibc/0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch new file mode 100644 index 0000000000..678dc2af2c --- /dev/null +++ b/poky/meta/recipes-core/glibc/glibc/0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch @@ -0,0 +1,528 @@ +From 69318192d16adc7d57adcd69fbbb1e3e107b2783 Mon Sep 17 00:00:00 2001 +From: Adhemerval Zanella +Date: Fri, 4 Nov 2022 16:02:52 -0300 +Subject: [PATCH] Linux: Add ppoll fortify symbol for 64 bit time_t (BZ# 29746) + +Similar to ppoll, the poll.h header needs to redirect the poll call +to a proper fortified ppoll with 64 bit time_t support. + +The implementation is straightforward, just need to add a similar +check as __poll_chk and call the 64 bit time_t ppoll version. The +debug fortify tests are also extended to cover 64 bit time_t for +affected ABIs. + +Unfortunately it requires an aditional symbol, which makes backport +tricky. One possibility is to add a static inline version if compiler +supports is and call abort instead of __chk_fail, so fortified version +will call __poll64 in the end. + +Another possibility is to just remove the fortify support for +_TIME_BITS=64. + +Checked on i686-linux-gnu. + +Upstream-Status: Backport + +Signed-off-by: Ola Nilsson +--- + debug/Makefile | 41 ++++++++++++------ + include/sys/poll.h | 5 ++- + io/bits/poll2.h | 25 +++++++++++ + sysdeps/unix/sysv/linux/Versions | 5 +++ + sysdeps/unix/sysv/linux/arm/be/libc.abilist | 1 + + sysdeps/unix/sysv/linux/arm/le/libc.abilist | 1 + + sysdeps/unix/sysv/linux/csky/libc.abilist | 1 + + sysdeps/unix/sysv/linux/hppa/libc.abilist | 1 + + sysdeps/unix/sysv/linux/i386/libc.abilist | 1 + + .../sysv/linux/m68k/coldfire/libc.abilist | 1 + + .../unix/sysv/linux/m68k/m680x0/libc.abilist | 1 + + .../sysv/linux/microblaze/be/libc.abilist | 1 + + .../sysv/linux/microblaze/le/libc.abilist | 1 + + .../sysv/linux/mips/mips32/fpu/libc.abilist | 1 + + .../sysv/linux/mips/mips32/nofpu/libc.abilist | 1 + + .../sysv/linux/mips/mips64/n32/libc.abilist | 1 + + sysdeps/unix/sysv/linux/nios2/libc.abilist | 1 + + .../linux/powerpc/powerpc32/fpu/libc.abilist | 1 + + .../powerpc/powerpc32/nofpu/libc.abilist | 1 + + sysdeps/unix/sysv/linux/ppoll.c | 3 +- + sysdeps/unix/sysv/linux/ppoll_chk.c | 42 +++++++++++++++++++ + .../unix/sysv/linux/s390/s390-32/libc.abilist | 1 + + sysdeps/unix/sysv/linux/sh/be/libc.abilist | 1 + + sysdeps/unix/sysv/linux/sh/le/libc.abilist | 1 + + .../sysv/linux/sparc/sparc32/libc.abilist | 1 + + 25 files changed, 125 insertions(+), 15 deletions(-) + create mode 100644 sysdeps/unix/sysv/linux/ppoll_chk.c + +diff --git a/debug/Makefile b/debug/Makefile +index 456b349c4d..075a135a2b 100644 +--- a/debug/Makefile ++++ b/debug/Makefile +@@ -120,8 +120,10 @@ CPPFLAGS-tst-read-chk-cancel.c += -D_FORTIFY_SOURCE=2 + # CFLAGS for the file. + + tests-all-chk = tst-fortify +-tests-c-chk = +-tests-cc-chk = ++tests-c-def-chk = ++tests-cc-def-chk = ++tests-c-time64-chk = ++tests-cc-time64-chk = + + CFLAGS-tst-fortify.c += -Wno-format -Wno-deprecated-declarations -Wno-error + +@@ -130,11 +132,11 @@ define cflags-default + endef + + define cflags-lfs +-CFLAGS-tst-fortify-$(1)-lfs-$(2).$(1) += -D_FILE_OFFSET_BITS=64 ++CFLAGS-tst-fortify-$(1)-lfs-$(2)-$(3).$(1) += -D_FILE_OFFSET_BITS=64 + endef + + define cflags-nongnu +-CFLAGS-tst-fortify-$(1)-nongnu-$(2).$(1) += -D_LARGEFILE64_SOURCE=1 ++CFLAGS-tst-fortify-$(1)-nongnu-$(2)-$(3).$(1) += -D_LARGEFILE64_SOURCE=1 + endef + + src-chk-nongnu = \#undef _GNU_SOURCE +@@ -145,12 +147,12 @@ src-chk-nongnu = \#undef _GNU_SOURCE + # And they also generate warnings from warning attributes, which + # cannot be disabled via pragmas, so require -Wno-error to be used. + define gen-chk-test +-tests-$(1)-chk += tst-fortify-$(1)-$(2)-$(3) +-CFLAGS-tst-fortify-$(1)-$(2)-$(3).$(1) += -D_FORTIFY_SOURCE=$(3) -Wno-format \ ++tests-$(1)-$(4)-chk += tst-fortify-$(1)-$(2)-$(3)-$(4) ++CFLAGS-tst-fortify-$(1)-$(2)-$(3)-$(4).$(1) += -D_FORTIFY_SOURCE=$(3) -Wno-format \ + -Wno-deprecated-declarations \ + -Wno-error +-$(eval $(call cflags-$(2),$(1),$(3))) +-$(objpfx)tst-fortify-$(1)-$(2)-$(3).$(1): tst-fortify.c Makefile ++$(eval $(call cflags-$(2),$(1),$(3),$(4))) ++$(objpfx)tst-fortify-$(1)-$(2)-$(3)-$(4).$(1): tst-fortify.c Makefile + ( echo "/* Autogenerated from Makefile. */"; \ + echo "$(src-chk-$(2))"; \ + echo "#include \"tst-fortify.c\"" ) > $$@.tmp +@@ -159,19 +161,29 @@ endef + + chk-extensions = c cc + chk-types = default lfs nongnu ++# 64 bit time_t implies LFS. ++chk-types-time64 = default nongnu + chk-levels = 1 2 3 + + $(foreach e,$(chk-extensions), \ + $(foreach t,$(chk-types), \ + $(foreach l,$(chk-levels), \ +- $(eval $(call gen-chk-test,$(e),$(t),$(l)))))) ++ $(eval $(call gen-chk-test,$(e),$(t),$(l),def))))) + +-tests-all-chk += $(tests-c-chk) $(tests-cc-chk) ++tests-all-chk += $(tests-c-def-chk) $(tests-cc-def-chk) ++ ++$(foreach e,$(chk-extensions), \ ++ $(foreach t,$(chk-types-time64), \ ++ $(foreach l,$(chk-levels), \ ++ $(eval $(call gen-chk-test,$(e),$(t),$(l),time64))))) ++ ++tests-all-time64-chk += $(tests-c-time64-chk) $(tests-cc-time64-chk) + + define link-cc + LDLIBS-$(1) = -lstdc++ + endef +-$(foreach t,$(tests-cc-chk), $(eval $(call link-cc,$(t)))) ++$(foreach t,$(tests-cc-def-chk), $(eval $(call link-cc,$(t)))) ++$(foreach t,$(tests-cc-time64-chk), $(eval $(call link-cc,$(t)))) + + # backtrace_symbols only works if we link with -rdynamic. backtrace + # requires unwind tables on most architectures. +@@ -201,6 +213,10 @@ tests = backtrace-tst \ + tst-realpath-chk \ + $(tests-all-chk) + ++tests-time64 += \ ++ $(tests-all-time64-chk) \ ++ # tests-time64 ++ + ifeq ($(have-ssp),yes) + tests += tst-ssp-1 + endif +@@ -210,7 +226,7 @@ tests += tst-read-chk-cancel + endif + + ifeq (,$(CXX)) +-tests-unsupported = $(tests-cc-chk) ++tests-unsupported = $(tests-cc-def-chk) $(test-cc-time64-chk) + endif + + extra-libs = libpcprofile +@@ -235,6 +251,7 @@ define chk-gen-locales + $(objpfx)$(1).out: $(gen-locales) + endef + $(foreach t, $(tests-all-chk), $(eval $(call chk-gen-locales,$(t)))) ++$(foreach t, $(tests-all-time64-chk), $(eval $(call chk-gen-locales,$(t)))) + endif + + sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,') +diff --git a/include/sys/poll.h b/include/sys/poll.h +index f904e21f89..228704fe79 100644 +--- a/include/sys/poll.h ++++ b/include/sys/poll.h +@@ -2,13 +2,16 @@ + # include + + #ifndef _ISOMAC ++#include ++ + extern int __poll (struct pollfd *__fds, unsigned long int __nfds, + int __timeout); + libc_hidden_proto (__poll) + libc_hidden_proto (ppoll) + + # if __TIMESIZE == 64 +-# define __ppoll64 __ppoll ++# define __ppoll64 ppoll ++# define __ppoll64_chk __ppoll_chk + # else + # include + # include +diff --git a/io/bits/poll2.h b/io/bits/poll2.h +index 3679d8451a..90f5574969 100644 +--- a/io/bits/poll2.h ++++ b/io/bits/poll2.h +@@ -43,6 +43,30 @@ poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) + + + #ifdef __USE_GNU ++# ifdef __USE_TIME_BITS64 ++extern int __REDIRECT (__ppoll64_alias, (struct pollfd *__fds, nfds_t __nfds, ++ const struct timespec *__timeout, ++ const __sigset_t *__ss), __ppoll64); ++extern int __ppoll64_chk (struct pollfd *__fds, nfds_t __nfds, ++ const struct timespec *__timeout, ++ const __sigset_t *__ss, __SIZE_TYPE__ __fdslen) ++ __attr_access ((__write_only__, 1, 2)); ++extern int __REDIRECT (__ppoll64_chk_warn, (struct pollfd *__fds, nfds_t __n, ++ const struct timespec *__timeout, ++ const __sigset_t *__ss, ++ __SIZE_TYPE__ __fdslen), ++ __ppoll64_chk) ++ __warnattr ("ppoll called with fds buffer too small file nfds entries"); ++ ++__fortify_function __fortified_attr_access (__write_only__, 1, 2) int ++ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, ++ const __sigset_t *__ss) ++{ ++ return __glibc_fortify (ppoll64, __nfds, sizeof (*__fds), ++ __glibc_objsize (__fds), ++ __fds, __nfds, __timeout, __ss); ++} ++# else + extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss), ppoll); +@@ -65,6 +89,7 @@ ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, + __glibc_objsize (__fds), + __fds, __nfds, __timeout, __ss); + } ++# endif + #endif + + __END_DECLS +diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions +index 65d2ceda2c..ca6eb1a49e 100644 +--- a/sysdeps/unix/sysv/linux/Versions ++++ b/sysdeps/unix/sysv/linux/Versions +@@ -313,6 +313,11 @@ libc { + process_madvise; + process_mrelease; + } ++ GLIBC_2.37 { ++%ifdef TIME64_NON_DEFAULT ++ __ppoll64_chk; ++%endif ++ } + GLIBC_PRIVATE { + # functions used in other libraries + __syscall_rt_sigqueueinfo; +diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist +index e0668a80cf..f28402fe03 100644 +--- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist ++++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist +@@ -513,6 +513,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 _Exit F + GLIBC_2.4 _IO_2_1_stderr_ D 0xa0 + GLIBC_2.4 _IO_2_1_stdin_ D 0xa0 +diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist +index d28e7c60b7..e2f56880ed 100644 +--- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist ++++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist +@@ -510,6 +510,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 _Exit F + GLIBC_2.4 _IO_2_1_stderr_ D 0xa0 + GLIBC_2.4 _IO_2_1_stdin_ D 0xa0 +diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist +index 922b05062f..319d92356e 100644 +--- a/sysdeps/unix/sysv/linux/csky/libc.abilist ++++ b/sysdeps/unix/sysv/linux/csky/libc.abilist +@@ -2669,3 +2669,4 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F +diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist +index 412144f94c..6450e17ebe 100644 +--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist ++++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist +@@ -2618,6 +2618,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 __confstr_chk F + GLIBC_2.4 __fgets_chk F + GLIBC_2.4 __fgets_unlocked_chk F +diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist +index 134393900a..0a24ec9afd 100644 +--- a/sysdeps/unix/sysv/linux/i386/libc.abilist ++++ b/sysdeps/unix/sysv/linux/i386/libc.abilist +@@ -2802,6 +2802,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 __confstr_chk F + GLIBC_2.4 __fgets_chk F + GLIBC_2.4 __fgets_unlocked_chk F +diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist +index 0604029c68..16243a7a92 100644 +--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist ++++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist +@@ -514,6 +514,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 _Exit F + GLIBC_2.4 _IO_2_1_stderr_ D 0x98 + GLIBC_2.4 _IO_2_1_stdin_ D 0x98 +diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +index af2be5c80d..564a553b27 100644 +--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist ++++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +@@ -2745,6 +2745,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 __confstr_chk F + GLIBC_2.4 __fgets_chk F + GLIBC_2.4 __fgets_unlocked_chk F +diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +index e090b8d48f..e850f47b21 100644 +--- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist ++++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +@@ -2718,3 +2718,4 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F +diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist +index 8c5b2db243..37178c503f 100644 +--- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist ++++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist +@@ -2715,3 +2715,4 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F +diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +index 68847134a2..3b30b31466 100644 +--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist ++++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +@@ -2710,6 +2710,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 __confstr_chk F + GLIBC_2.4 __fgets_chk F + GLIBC_2.4 __fgets_unlocked_chk F +diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist +index daa44e64fa..0e358570a2 100644 +--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist ++++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist +@@ -2708,6 +2708,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 __confstr_chk F + GLIBC_2.4 __fgets_chk F + GLIBC_2.4 __fgets_unlocked_chk F +diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +index 6169188c96..59c598b98f 100644 +--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist ++++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +@@ -2716,6 +2716,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 __confstr_chk F + GLIBC_2.4 __fgets_chk F + GLIBC_2.4 __fgets_unlocked_chk F +diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist +index 58e9b486b0..463e01ab84 100644 +--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist ++++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist +@@ -2757,3 +2757,4 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +index 8c9ca32cbe..405d40d11c 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +@@ -2772,6 +2772,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 _IO_fprintf F + GLIBC_2.4 _IO_printf F + GLIBC_2.4 _IO_sprintf F +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist +index 08a6604aab..ce89602b93 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist +@@ -2805,6 +2805,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 _IO_fprintf F + GLIBC_2.4 _IO_printf F + GLIBC_2.4 _IO_sprintf F +diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c +index 1105e29b00..2e173b931d 100644 +--- a/sysdeps/unix/sysv/linux/ppoll.c ++++ b/sysdeps/unix/sysv/linux/ppoll.c +@@ -67,7 +67,7 @@ __ppoll64 (struct pollfd *fds, nfds_t nfds, const struct __timespec64 *timeout, + libc_hidden_def (__ppoll64) + + int +-__ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, ++ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, + const sigset_t *sigmask) + { + struct __timespec64 ts64; +@@ -77,5 +77,4 @@ __ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, + return __ppoll64 (fds, nfds, timeout ? &ts64 : NULL, sigmask); + } + #endif +-strong_alias (__ppoll, ppoll) + libc_hidden_def (ppoll) +diff --git a/sysdeps/unix/sysv/linux/ppoll_chk.c b/sysdeps/unix/sysv/linux/ppoll_chk.c +new file mode 100644 +index 0000000000..65c4b56671 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/ppoll_chk.c +@@ -0,0 +1,42 @@ ++/* Fortify ppoll implementation. Linux version. ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++ ++int ++__ppoll64_chk (struct pollfd *fds, nfds_t nfds, ++ const struct __timespec64 *tmo, const __sigset_t *ss, ++ __SIZE_TYPE__ fdslen) ++{ ++ if (fdslen / sizeof (*fds) < nfds) ++ __chk_fail (); ++ ++ return __ppoll64 (fds, nfds, tmo, ss); ++} ++ ++#if __TIMESIZE != 64 ++int ++__ppoll_chk (struct pollfd *fds, nfds_t nfds, const struct timespec *tmo, ++ const __sigset_t *ss, __SIZE_TYPE__ fdslen) ++{ ++ if (fdslen / sizeof (*fds) < nfds) ++ __chk_fail (); ++ ++ return ppoll (fds, nfds, tmo, ss); ++} ++#endif +diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +index 009f22931e..5ca051a9eb 100644 +--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist ++++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +@@ -2770,6 +2770,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 _IO_fprintf F + GLIBC_2.4 _IO_printf F + GLIBC_2.4 _IO_sprintf F +diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist +index afb5bc37b1..5b48168ec6 100644 +--- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist ++++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist +@@ -2625,6 +2625,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 __confstr_chk F + GLIBC_2.4 __fgets_chk F + GLIBC_2.4 __fgets_unlocked_chk F +diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist +index 2b53a3cf92..c42b39cea8 100644 +--- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist ++++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist +@@ -2622,6 +2622,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 __confstr_chk F + GLIBC_2.4 __fgets_chk F + GLIBC_2.4 __fgets_unlocked_chk F +diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +index 43b9844a99..5a0a662dee 100644 +--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist ++++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +@@ -2765,6 +2765,7 @@ GLIBC_2.36 pidfd_open F + GLIBC_2.36 pidfd_send_signal F + GLIBC_2.36 process_madvise F + GLIBC_2.36 process_mrelease F ++GLIBC_2.37 __ppoll64_chk F + GLIBC_2.4 _IO_fprintf F + GLIBC_2.4 _IO_printf F + GLIBC_2.4 _IO_sprintf F diff --git a/poky/meta/recipes-core/glibc/glibc_2.36.bb b/poky/meta/recipes-core/glibc/glibc_2.36.bb index 45bc784b33..3010f783ac 100644 --- a/poky/meta/recipes-core/glibc/glibc_2.36.bb +++ b/poky/meta/recipes-core/glibc/glibc_2.36.bb @@ -54,6 +54,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://0023-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ file://0024-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \ file://0025-startup-Force-O2.patch \ + file://0001-Linux-Add-ppoll-fortify-symbol-for-64-bit-time_t-BZ-.patch \ " S = "${WORKDIR}/git" B = "${WORKDIR}/build-${TARGET_SYS}" diff --git a/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb index f3f2bb2da1..f16b12d20f 100644 --- a/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb +++ b/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb @@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk wic.vhd wic.vhdx" inherit core-image setuptools3 -SRCREV ?= "4f942c272d4417b5b719df25b80a6a6b54669a73" +SRCREV ?= "dc9f64cc66a858c08e462b89ee96c715fc61c971" SRC_URI = "git://git.yoctoproject.org/poky;branch=master \ file://Yocto_Build_Appliance.vmx \ file://Yocto_Build_Appliance.vmxf \ diff --git a/poky/meta/recipes-core/kbd/kbd_2.5.1.bb b/poky/meta/recipes-core/kbd/kbd_2.5.1.bb index aa3ab6e121..7662b8f685 100644 --- a/poky/meta/recipes-core/kbd/kbd_2.5.1.bb +++ b/poky/meta/recipes-core/kbd/kbd_2.5.1.bb @@ -18,6 +18,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \ SRC_URI[sha256sum] = "ccdf452387a6380973d2927363e9cbb939fa2068915a6f937ff9d24522024683" +EXTRA_OECONF = "--disable-tests" PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \ " diff --git a/poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.30.bb b/poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.30.bb deleted file mode 100644 index ec9f9f4fa3..0000000000 --- a/poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.30.bb +++ /dev/null @@ -1,18 +0,0 @@ -# -# This provides libcrypto.so.1 which contains obsolete APIs, needed for uninative in particular -# - -require libxcrypt.inc - -PROVIDES = "" -AUTO_LIBNAME_PKGS = "" -EXCLUDE_FROM_WORLD = "1" - -API = "--enable-obsolete-api" - -do_install:append () { - rm -rf ${D}${includedir} - rm -rf ${D}${libdir}/pkgconfig - rm -rf ${D}${datadir} -} - diff --git a/poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.33.bb b/poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.33.bb new file mode 100644 index 0000000000..ec9f9f4fa3 --- /dev/null +++ b/poky/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.33.bb @@ -0,0 +1,18 @@ +# +# This provides libcrypto.so.1 which contains obsolete APIs, needed for uninative in particular +# + +require libxcrypt.inc + +PROVIDES = "" +AUTO_LIBNAME_PKGS = "" +EXCLUDE_FROM_WORLD = "1" + +API = "--enable-obsolete-api" + +do_install:append () { + rm -rf ${D}${includedir} + rm -rf ${D}${libdir}/pkgconfig + rm -rf ${D}${datadir} +} + diff --git a/poky/meta/recipes-core/libxcrypt/libxcrypt.inc b/poky/meta/recipes-core/libxcrypt/libxcrypt.inc index 2bdedcba6d..61b0381076 100644 --- a/poky/meta/recipes-core/libxcrypt/libxcrypt.inc +++ b/poky/meta/recipes-core/libxcrypt/libxcrypt.inc @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSING;md5=c0a30e2b1502c55a7f37e412cd6c6a4b \ inherit autotools pkgconfig SRC_URI = "git://github.com/besser82/libxcrypt.git;branch=${SRCBRANCH};protocol=https" -SRCREV = "fee2687bad66e351a3dcc963a34ae80125923ff8" +SRCREV = "d7fe1ac04c326dba7e0440868889d1dccb41a175" SRCBRANCH ?= "develop" SRC_URI += "file://fix_cflags_handling.patch" diff --git a/poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.30.bb b/poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.30.bb deleted file mode 100644 index 79dba2f6dc..0000000000 --- a/poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.30.bb +++ /dev/null @@ -1,2 +0,0 @@ -require libxcrypt.inc - diff --git a/poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.33.bb b/poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.33.bb new file mode 100644 index 0000000000..79dba2f6dc --- /dev/null +++ b/poky/meta/recipes-core/libxcrypt/libxcrypt_4.4.33.bb @@ -0,0 +1,2 @@ +require libxcrypt.inc + diff --git a/poky/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch b/poky/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch deleted file mode 100644 index 6d9ede6194..0000000000 --- a/poky/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch +++ /dev/null @@ -1,86 +0,0 @@ -From ea1993d1d9a18c5e61b9cb271892b0a48f508d32 Mon Sep 17 00:00:00 2001 -From: Peter Kjellerstedt -Date: Fri, 9 Jun 2017 17:50:46 +0200 -Subject: [PATCH] Make ptest run the python tests if python is enabled - -One of the tests (tstLastError.py) needed a minor correction. It might -be due to the fact that the tests are forced to run with Python 3. - -Upstream-Status: Inappropriate [OE specific] -Signed-off-by: Peter Kjellerstedt ---- - Makefile.am | 2 +- - python/Makefile.am | 9 +++++++++ - python/tests/Makefile.am | 10 ++++++++++ - 3 files changed, 20 insertions(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index b428452b..dc18d6dd 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -203,9 +203,9 @@ install-ptest: - install $(check_PROGRAMS) $(DESTDIR)) - cp -r $(srcdir)/test $(DESTDIR) - cp -r $(srcdir)/result $(DESTDIR) -- cp -r $(srcdir)/python $(DESTDIR) - cp Makefile $(DESTDIR) - sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile -+ $(MAKE) -C python install-ptest - - runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \ - testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT) -diff --git a/python/Makefile.am b/python/Makefile.am -index 34aed96c..ba3ec6a4 100644 ---- a/python/Makefile.am -+++ b/python/Makefile.am -@@ -48,7 +48,16 @@ GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES) - - $(GENERATED): $(srcdir)/generator.py $(API_DESC) - $(PYTHON) $(srcdir)/generator.py $(srcdir) -+ -+install-ptest: -+ cp -r $(srcdir) $(DESTDIR) -+ sed -e 's|^Makefile:|_Makefile:|' \ -+ -e 's|^\(tests test:\) all|\1|' Makefile >$(DESTDIR)/python/Makefile -+ $(MAKE) -C tests install-ptest -+else -+install-ptest: - endif - -+.PHONY: tests test - tests test: all - cd tests && $(MAKE) tests -diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am -index 227e24df..3568c2d2 100644 ---- a/python/tests/Makefile.am -+++ b/python/tests/Makefile.am -@@ -59,6 +59,11 @@ XMLS= \ - CLEANFILES = core tmp.xml *.pyc - - if WITH_PYTHON -+install-ptest: -+ cp -r $(srcdir) $(DESTDIR)/python -+ sed -e 's|^Makefile:|_Makefile:|' \ -+ -e 's|^\(srcdir = \).*|\1.|' Makefile >$(DESTDIR)/python/tests/Makefile -+ - tests: $(PYTESTS) - @for f in $(XMLS) ; do test -f $$f || $(LN_S) $(srcdir)/$$f . ; done - @echo "## running Python regression tests" -@@ -70,9 +75,14 @@ tests: $(PYTESTS) - if [ "$$?" -ne 0 ] ; then \ - echo "-- $$test" ; \ - echo "$$log" ; \ -+ echo "FAIL: $$test"; \ - exit 1 ; \ -+ else \ -+ echo "PASS: $$test"; \ - fi ; \ - done) - else -+install-ptest: -+ - tests: - endif --- -2.25.1 - diff --git a/poky/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch b/poky/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch deleted file mode 100644 index c6567ac878..0000000000 --- a/poky/meta/recipes-core/libxml/libxml2/0001-Port-gentest.py-to-Python-3.patch +++ /dev/null @@ -1,814 +0,0 @@ -From 2c20198b1ddb1bfb47269b8caf929ffb83748f78 Mon Sep 17 00:00:00 2001 -From: Nick Wellnhofer -Date: Thu, 21 Apr 2022 00:45:58 +0200 -Subject: [PATCH] Port gentest.py to Python 3 - -Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/343fc1421cdae097fa6c4cffeb1a065a40be6bbb] - -* fixes: - -make[1]: 'testReader' is up to date. - File "../libxml2-2.9.10/gentest.py", line 11 - print "libxml2 python bindings not available, skipping testapi.c generation" - ^ -SyntaxError: Missing parentheses in call to 'print'. Did you mean print("libxml2 python bindings not available, skipping testapi.c generation")? -make[1]: [Makefile:2078: testapi.c] Error 1 (ignored) - -... - -make[1]: 'testReader' is up to date. - File "../libxml2-2.9.10/gentest.py", line 271 - return 1 - ^ -TabError: inconsistent use of tabs and spaces in indentation -make[1]: [Makefile:2078: testapi.c] Error 1 (ignored) - -... - -aarch64-oe-linux-gcc: error: testapi.c: No such file or directory -aarch64-oe-linux-gcc: fatal error: no input files -compilation terminated. -make[1]: *** [Makefile:1275: testapi.o] Error 1 - -But there is still a bit mystery why it worked before, because check-am -calls gentest.py with $(PYTHON), so it ignores the shebang in the script -and libxml2 is using python3native (through python3targetconfig.bbclass) -so something like: - -libxml2/2.9.10-r0/recipe-sysroot-native/usr/bin/python3-native/python3 gentest.py - -But that still fails (now without SyntaxError) with: -libxml2 python bindings not available, skipping testapi.c generation - -because we don't have dependency on libxml2-native (to provide libxml2 -python bindings form python3native) and exported PYTHON_SITE_PACKAGES -might be useless (e.g. /usr/lib/python3.8/site-packages on Ubuntu-22.10 -which uses python 3.10 and there is no site-packages with libxml2) - -Signed-off-by: Martin Jansa - ---- - gentest.py | 421 ++++++++++++++++++++++++++--------------------------- - 1 file changed, 209 insertions(+), 212 deletions(-) - -diff --git a/gentest.py b/gentest.py -index b6cd866..af15a4f 100755 ---- a/gentest.py -+++ b/gentest.py -@@ -8,7 +8,7 @@ import string - try: - import libxml2 - except: -- print "libxml2 python bindings not available, skipping testapi.c generation" -+ print("libxml2 python bindings not available, skipping testapi.c generation") - sys.exit(0) - - if len(sys.argv) > 1: -@@ -227,7 +227,7 @@ extra_post_call = { - if (old != NULL) { - xmlUnlinkNode(old); - xmlFreeNode(old) ; old = NULL ; } -- ret_val = NULL;""", -+\t ret_val = NULL;""", - "xmlTextMerge": - """if ((first != NULL) && (first->type != XML_TEXT_NODE)) { - xmlUnlinkNode(second); -@@ -236,7 +236,7 @@ extra_post_call = { - """if ((ret_val != NULL) && (ret_val != ncname) && - (ret_val != prefix) && (ret_val != memory)) - xmlFree(ret_val); -- ret_val = NULL;""", -+\t ret_val = NULL;""", - "xmlNewDocElementContent": - """xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""", - "xmlDictReference": "xmlDictFree(dict);", -@@ -268,29 +268,29 @@ modules = [] - def is_skipped_module(name): - for mod in skipped_modules: - if mod == name: -- return 1 -+ return 1 - return 0 - - def is_skipped_function(name): - for fun in skipped_functions: - if fun == name: -- return 1 -+ return 1 - # Do not test destructors -- if string.find(name, 'Free') != -1: -+ if name.find('Free') != -1: - return 1 - return 0 - - def is_skipped_memcheck(name): - for fun in skipped_memcheck: - if fun == name: -- return 1 -+ return 1 - return 0 - - missing_types = {} - def add_missing_type(name, func): - try: - list = missing_types[name] -- list.append(func) -+ list.append(func) - except: - missing_types[name] = [func] - -@@ -310,7 +310,7 @@ def add_missing_functions(name, module): - missing_functions_nr = missing_functions_nr + 1 - try: - list = missing_functions[module] -- list.append(name) -+ list.append(name) - except: - missing_functions[module] = [name] - -@@ -319,45 +319,45 @@ def add_missing_functions(name, module): - # - - def type_convert(str, name, info, module, function, pos): --# res = string.replace(str, " ", " ") --# res = string.replace(str, " ", " ") --# res = string.replace(str, " ", " ") -- res = string.replace(str, " *", "_ptr") --# res = string.replace(str, "*", "_ptr") -- res = string.replace(res, " ", "_") -+# res = str.replace(" ", " ") -+# res = str.replace(" ", " ") -+# res = str.replace(" ", " ") -+ res = str.replace(" *", "_ptr") -+# res = str.replace("*", "_ptr") -+ res = res.replace(" ", "_") - if res == 'const_char_ptr': -- if string.find(name, "file") != -1 or \ -- string.find(name, "uri") != -1 or \ -- string.find(name, "URI") != -1 or \ -- string.find(info, "filename") != -1 or \ -- string.find(info, "URI") != -1 or \ -- string.find(info, "URL") != -1: -- if string.find(function, "Save") != -1 or \ -- string.find(function, "Create") != -1 or \ -- string.find(function, "Write") != -1 or \ -- string.find(function, "Fetch") != -1: -- return('fileoutput') -- return('filepath') -+ if name.find("file") != -1 or \ -+ name.find("uri") != -1 or \ -+ name.find("URI") != -1 or \ -+ info.find("filename") != -1 or \ -+ info.find("URI") != -1 or \ -+ info.find("URL") != -1: -+ if function.find("Save") != -1 or \ -+ function.find("Create") != -1 or \ -+ function.find("Write") != -1 or \ -+ function.find("Fetch") != -1: -+ return('fileoutput') -+ return('filepath') - if res == 'void_ptr': - if module == 'nanoftp' and name == 'ctx': -- return('xmlNanoFTPCtxtPtr') -+ return('xmlNanoFTPCtxtPtr') - if function == 'xmlNanoFTPNewCtxt' or \ -- function == 'xmlNanoFTPConnectTo' or \ -- function == 'xmlNanoFTPOpen': -- return('xmlNanoFTPCtxtPtr') -+ function == 'xmlNanoFTPConnectTo' or \ -+ function == 'xmlNanoFTPOpen': -+ return('xmlNanoFTPCtxtPtr') - if module == 'nanohttp' and name == 'ctx': -- return('xmlNanoHTTPCtxtPtr') -- if function == 'xmlNanoHTTPMethod' or \ -- function == 'xmlNanoHTTPMethodRedir' or \ -- function == 'xmlNanoHTTPOpen' or \ -- function == 'xmlNanoHTTPOpenRedir': -- return('xmlNanoHTTPCtxtPtr'); -+ return('xmlNanoHTTPCtxtPtr') -+ if function == 'xmlNanoHTTPMethod' or \ -+ function == 'xmlNanoHTTPMethodRedir' or \ -+ function == 'xmlNanoHTTPOpen' or \ -+ function == 'xmlNanoHTTPOpenRedir': -+ return('xmlNanoHTTPCtxtPtr'); - if function == 'xmlIOHTTPOpen': -- return('xmlNanoHTTPCtxtPtr') -- if string.find(name, "data") != -1: -- return('userdata') -- if string.find(name, "user") != -1: -- return('userdata') -+ return('xmlNanoHTTPCtxtPtr') -+ if name.find("data") != -1: -+ return('userdata') -+ if name.find("user") != -1: -+ return('userdata') - if res == 'xmlDoc_ptr': - res = 'xmlDocPtr' - if res == 'xmlNode_ptr': -@@ -366,18 +366,18 @@ def type_convert(str, name, info, module, function, pos): - res = 'xmlDictPtr' - if res == 'xmlNodePtr' and pos != 0: - if (function == 'xmlAddChild' and pos == 2) or \ -- (function == 'xmlAddChildList' and pos == 2) or \ -+ (function == 'xmlAddChildList' and pos == 2) or \ - (function == 'xmlAddNextSibling' and pos == 2) or \ - (function == 'xmlAddSibling' and pos == 2) or \ - (function == 'xmlDocSetRootElement' and pos == 2) or \ - (function == 'xmlReplaceNode' and pos == 2) or \ - (function == 'xmlTextMerge') or \ -- (function == 'xmlAddPrevSibling' and pos == 2): -- return('xmlNodePtr_in'); -+ (function == 'xmlAddPrevSibling' and pos == 2): -+ return('xmlNodePtr_in'); - if res == 'const xmlBufferPtr': - res = 'xmlBufferPtr' - if res == 'xmlChar_ptr' and name == 'name' and \ -- string.find(function, "EatName") != -1: -+ function.find("EatName") != -1: - return('eaten_name') - if res == 'void_ptr*': - res = 'void_ptr_ptr' -@@ -393,7 +393,7 @@ def type_convert(str, name, info, module, function, pos): - res = 'debug_FILE_ptr'; - if res == 'int' and name == 'options': - if module == 'parser' or module == 'xmlreader': -- res = 'parseroptions' -+ res = 'parseroptions' - - return res - -@@ -402,28 +402,28 @@ known_param_types = [] - def is_known_param_type(name): - for type in known_param_types: - if type == name: -- return 1 -+ return 1 - return name[-3:] == 'Ptr' or name[-4:] == '_ptr' - - def generate_param_type(name, rtype): - global test - for type in known_param_types: - if type == name: -- return -+ return - for type in generated_param_types: - if type == name: -- return -+ return - - if name[-3:] == 'Ptr' or name[-4:] == '_ptr': - if rtype[0:6] == 'const ': -- crtype = rtype[6:] -- else: -- crtype = rtype -+ crtype = rtype[6:] -+ else: -+ crtype = rtype - - define = 0 -- if modules_defines.has_key(module): -- test.write("#ifdef %s\n" % (modules_defines[module])) -- define = 1 -+ if module in modules_defines: -+ test.write("#ifdef %s\n" % (modules_defines[module])) -+ define = 1 - test.write(""" - #define gen_nb_%s 1 - static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -@@ -433,7 +433,7 @@ static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTR - } - """ % (name, crtype, name, name, rtype)) - if define == 1: -- test.write("#endif\n\n") -+ test.write("#endif\n\n") - add_generated_param_type(name) - - # -@@ -445,7 +445,7 @@ known_return_types = [] - def is_known_return_type(name): - for type in known_return_types: - if type == name: -- return 1 -+ return 1 - return 0 - - # -@@ -471,7 +471,7 @@ def compare_and_save(): - try: - os.system("rm testapi.c; mv testapi.c.new testapi.c") - except: -- os.system("mv testapi.c.new testapi.c") -+ os.system("mv testapi.c.new testapi.c") - print("Updated testapi.c") - else: - print("Generated testapi.c is identical") -@@ -481,17 +481,17 @@ while line != "": - if line == "/* CUT HERE: everything below that line is generated */\n": - break; - if line[0:15] == "#define gen_nb_": -- type = string.split(line[15:])[0] -- known_param_types.append(type) -+ type = line[15:].split()[0] -+ known_param_types.append(type) - if line[0:19] == "static void desret_": -- type = string.split(line[19:], '(')[0] -- known_return_types.append(type) -+ type = line[19:].split('(')[0] -+ known_return_types.append(type) - test.write(line) - line = input.readline() - input.close() - - if line == "": -- print "Could not find the CUT marker in testapi.c skipping generation" -+ print("Could not find the CUT marker in testapi.c skipping generation") - test.close() - sys.exit(0) - -@@ -505,7 +505,7 @@ test.write("/* CUT HERE: everything below that line is generated */\n") - # - doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0) - if doc == None: -- print "Failed to load doc/libxml2-api.xml" -+ print("Failed to load doc/libxml2-api.xml") - sys.exit(1) - ctxt = doc.xpathNewContext() - -@@ -519,9 +519,9 @@ for arg in args: - mod = arg.xpathEval('string(../@file)') - func = arg.xpathEval('string(../@name)') - if (mod not in skipped_modules) and (func not in skipped_functions): -- type = arg.xpathEval('string(@type)') -- if not argtypes.has_key(type): -- argtypes[type] = func -+ type = arg.xpathEval('string(@type)') -+ if type not in argtypes: -+ argtypes[type] = func - - # similarly for return types - rettypes = {} -@@ -531,8 +531,8 @@ for ret in rets: - func = ret.xpathEval('string(../@name)') - if (mod not in skipped_modules) and (func not in skipped_functions): - type = ret.xpathEval('string(@type)') -- if not rettypes.has_key(type): -- rettypes[type] = func -+ if type not in rettypes: -+ rettypes[type] = func - - # - # Generate constructors and return type handling for all enums -@@ -549,49 +549,49 @@ for enum in enums: - continue; - define = 0 - -- if argtypes.has_key(name) and is_known_param_type(name) == 0: -- values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name) -- i = 0 -- vals = [] -- for value in values: -- vname = value.xpathEval('string(@name)') -- if vname == None: -- continue; -- i = i + 1 -- if i >= 5: -- break; -- vals.append(vname) -- if vals == []: -- print "Didn't find any value for enum %s" % (name) -- continue -- if modules_defines.has_key(module): -- test.write("#ifdef %s\n" % (modules_defines[module])) -- define = 1 -- test.write("#define gen_nb_%s %d\n" % (name, len(vals))) -- test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" % -- (name, name)) -- i = 1 -- for value in vals: -- test.write(" if (no == %d) return(%s);\n" % (i, value)) -- i = i + 1 -- test.write(""" return(0); -+ if (name in argtypes) and is_known_param_type(name) == 0: -+ values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name) -+ i = 0 -+ vals = [] -+ for value in values: -+ vname = value.xpathEval('string(@name)') -+ if vname == None: -+ continue; -+ i = i + 1 -+ if i >= 5: -+ break; -+ vals.append(vname) -+ if vals == []: -+ print("Didn't find any value for enum %s" % (name)) -+ continue -+ if module in modules_defines: -+ test.write("#ifdef %s\n" % (modules_defines[module])) -+ define = 1 -+ test.write("#define gen_nb_%s %d\n" % (name, len(vals))) -+ test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" % -+ (name, name)) -+ i = 1 -+ for value in vals: -+ test.write(" if (no == %d) return(%s);\n" % (i, value)) -+ i = i + 1 -+ test.write(""" return(0); - } - - static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - } - - """ % (name, name)); -- known_param_types.append(name) -+ known_param_types.append(name) - - if (is_known_return_type(name) == 0) and (name in rettypes): -- if define == 0 and modules_defines.has_key(module): -- test.write("#ifdef %s\n" % (modules_defines[module])) -- define = 1 -+ if define == 0 and (module in modules_defines): -+ test.write("#ifdef %s\n" % (modules_defines[module])) -+ define = 1 - test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) { - } - - """ % (name, name)) -- known_return_types.append(name) -+ known_return_types.append(name) - if define == 1: - test.write("#endif\n\n") - -@@ -615,9 +615,9 @@ for file in headers: - # do not test deprecated APIs - # - desc = file.xpathEval('string(description)') -- if string.find(desc, 'DEPRECATED') != -1: -- print "Skipping deprecated interface %s" % name -- continue; -+ if desc.find('DEPRECATED') != -1: -+ print("Skipping deprecated interface %s" % name) -+ continue; - - test.write("#include \n" % name) - modules.append(name) -@@ -679,7 +679,7 @@ def generate_test(module, node): - # and store the information for the generation - # - try: -- args = node.xpathEval("arg") -+ args = node.xpathEval("arg") - except: - args = [] - t_args = [] -@@ -687,37 +687,37 @@ def generate_test(module, node): - for arg in args: - n = n + 1 - rtype = arg.xpathEval("string(@type)") -- if rtype == 'void': -- break; -- info = arg.xpathEval("string(@info)") -- nam = arg.xpathEval("string(@name)") -+ if rtype == 'void': -+ break; -+ info = arg.xpathEval("string(@info)") -+ nam = arg.xpathEval("string(@name)") - type = type_convert(rtype, nam, info, module, name, n) -- if is_known_param_type(type) == 0: -- add_missing_type(type, name); -- no_gen = 1 -+ if is_known_param_type(type) == 0: -+ add_missing_type(type, name); -+ no_gen = 1 - if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \ -- rtype[0:6] == 'const ': -- crtype = rtype[6:] -- else: -- crtype = rtype -- t_args.append((nam, type, rtype, crtype, info)) -+ rtype[0:6] == 'const ': -+ crtype = rtype[6:] -+ else: -+ crtype = rtype -+ t_args.append((nam, type, rtype, crtype, info)) - - try: -- rets = node.xpathEval("return") -+ rets = node.xpathEval("return") - except: - rets = [] - t_ret = None - for ret in rets: - rtype = ret.xpathEval("string(@type)") -- info = ret.xpathEval("string(@info)") -+ info = ret.xpathEval("string(@info)") - type = type_convert(rtype, 'return', info, module, name, 0) -- if rtype == 'void': -- break -- if is_known_return_type(type) == 0: -- add_missing_type(type, name); -- no_gen = 1 -- t_ret = (type, rtype, info) -- break -+ if rtype == 'void': -+ break -+ if is_known_return_type(type) == 0: -+ add_missing_type(type, name); -+ no_gen = 1 -+ t_ret = (type, rtype, info) -+ break - - if no_gen == 0: - for t_arg in t_args: -@@ -733,7 +733,7 @@ test_%s(void) { - - if no_gen == 1: - add_missing_functions(name, module) -- test.write(""" -+ test.write(""" - /* missing type support */ - return(test_ret); - } -@@ -742,22 +742,22 @@ test_%s(void) { - return - - try: -- conds = node.xpathEval("cond") -- for cond in conds: -- test.write("#if %s\n" % (cond.get_content())) -- nb_cond = nb_cond + 1 -+ conds = node.xpathEval("cond") -+ for cond in conds: -+ test.write("#if %s\n" % (cond.get_content())) -+ nb_cond = nb_cond + 1 - except: - pass - - define = 0 -- if function_defines.has_key(name): -+ if name in function_defines: - test.write("#ifdef %s\n" % (function_defines[name])) -- define = 1 -+ define = 1 - - # Declare the memory usage counter - no_mem = is_skipped_memcheck(name) - if no_mem == 0: -- test.write(" int mem_base;\n"); -+ test.write(" int mem_base;\n"); - - # Declare the return value - if t_ret != None: -@@ -766,29 +766,29 @@ test_%s(void) { - # Declare the arguments - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; -- # add declaration -- test.write(" %s %s; /* %s */\n" % (crtype, nam, info)) -- test.write(" int n_%s;\n" % (nam)) -+ # add declaration -+ test.write(" %s %s; /* %s */\n" % (crtype, nam, info)) -+ test.write(" int n_%s;\n" % (nam)) - test.write("\n") - - # Cascade loop on of each argument list of values - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; -- # -- test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % ( -- nam, nam, type, nam)) -+ # -+ test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % ( -+ nam, nam, type, nam)) - - # log the memory usage - if no_mem == 0: -- test.write(" mem_base = xmlMemBlocks();\n"); -+ test.write(" mem_base = xmlMemBlocks();\n"); - - # prepare the call - i = 0; - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; -- # -- test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i)) -- i = i + 1; -+ # -+ test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i)) -+ i = i + 1; - - # add checks to avoid out-of-bounds array access - i = 0; -@@ -797,7 +797,7 @@ test_%s(void) { - # assume that "size", "len", and "start" parameters apply to either - # the nearest preceding or following char pointer - if type == "int" and (nam == "size" or nam == "len" or nam == "start"): -- for j in range(i - 1, -1, -1) + range(i + 1, len(t_args)): -+ for j in (*range(i - 1, -1, -1), *range(i + 1, len(t_args))): - (bnam, btype) = t_args[j][:2] - if btype == "const_char_ptr" or btype == "const_xmlChar_ptr": - test.write( -@@ -806,42 +806,42 @@ test_%s(void) { - " continue;\n" - % (bnam, nam, bnam)) - break -- i = i + 1; -+ i = i + 1; - - # do the call, and clanup the result -- if extra_pre_call.has_key(name): -- test.write(" %s\n"% (extra_pre_call[name])) -+ if name in extra_pre_call: -+ test.write(" %s\n"% (extra_pre_call[name])) - if t_ret != None: -- test.write("\n ret_val = %s(" % (name)) -- need = 0 -- for arg in t_args: -- (nam, type, rtype, crtype, info) = arg -- if need: -- test.write(", ") -- else: -- need = 1 -- if rtype != crtype: -- test.write("(%s)" % rtype) -- test.write("%s" % nam); -- test.write(");\n") -- if extra_post_call.has_key(name): -- test.write(" %s\n"% (extra_post_call[name])) -- test.write(" desret_%s(ret_val);\n" % t_ret[0]) -+ test.write("\n ret_val = %s(" % (name)) -+ need = 0 -+ for arg in t_args: -+ (nam, type, rtype, crtype, info) = arg -+ if need: -+ test.write(", ") -+ else: -+ need = 1 -+ if rtype != crtype: -+ test.write("(%s)" % rtype) -+ test.write("%s" % nam); -+ test.write(");\n") -+ if name in extra_post_call: -+ test.write(" %s\n"% (extra_post_call[name])) -+ test.write(" desret_%s(ret_val);\n" % t_ret[0]) - else: -- test.write("\n %s(" % (name)); -- need = 0; -- for arg in t_args: -- (nam, type, rtype, crtype, info) = arg; -- if need: -- test.write(", ") -- else: -- need = 1 -- if rtype != crtype: -- test.write("(%s)" % rtype) -- test.write("%s" % nam) -- test.write(");\n") -- if extra_post_call.has_key(name): -- test.write(" %s\n"% (extra_post_call[name])) -+ test.write("\n %s(" % (name)); -+ need = 0; -+ for arg in t_args: -+ (nam, type, rtype, crtype, info) = arg; -+ if need: -+ test.write(", ") -+ else: -+ need = 1 -+ if rtype != crtype: -+ test.write("(%s)" % rtype) -+ test.write("%s" % nam) -+ test.write(");\n") -+ if name in extra_post_call: -+ test.write(" %s\n"% (extra_post_call[name])) - - test.write(" call_tests++;\n"); - -@@ -849,32 +849,32 @@ test_%s(void) { - i = 0; - for arg in t_args: - (nam, type, rtype, crtype, info) = arg; -- # This is a hack to prevent generating a destructor for the -- # 'input' argument in xmlTextReaderSetup. There should be -- # a better, more generic way to do this! -- if string.find(info, 'destroy') == -1: -- test.write(" des_%s(n_%s, " % (type, nam)) -- if rtype != crtype: -- test.write("(%s)" % rtype) -- test.write("%s, %d);\n" % (nam, i)) -- i = i + 1; -+ # This is a hack to prevent generating a destructor for the -+ # 'input' argument in xmlTextReaderSetup. There should be -+ # a better, more generic way to do this! -+ if info.find('destroy') == -1: -+ test.write(" des_%s(n_%s, " % (type, nam)) -+ if rtype != crtype: -+ test.write("(%s)" % rtype) -+ test.write("%s, %d);\n" % (nam, i)) -+ i = i + 1; - - test.write(" xmlResetLastError();\n"); - # Check the memory usage - if no_mem == 0: -- test.write(""" if (mem_base != xmlMemBlocks()) { -+ test.write(""" if (mem_base != xmlMemBlocks()) { - printf("Leak of %%d blocks found in %s", -- xmlMemBlocks() - mem_base); -- test_ret++; -+\t xmlMemBlocks() - mem_base); -+\t test_ret++; - """ % (name)); -- for arg in t_args: -- (nam, type, rtype, crtype, info) = arg; -- test.write(""" printf(" %%d", n_%s);\n""" % (nam)) -- test.write(""" printf("\\n");\n""") -- test.write(" }\n") -+ for arg in t_args: -+ (nam, type, rtype, crtype, info) = arg; -+ test.write(""" printf(" %%d", n_%s);\n""" % (nam)) -+ test.write(""" printf("\\n");\n""") -+ test.write(" }\n") - - for arg in t_args: -- test.write(" }\n") -+ test.write(" }\n") - - test.write(" function_tests++;\n") - # -@@ -882,7 +882,7 @@ test_%s(void) { - # - while nb_cond > 0: - test.write("#endif\n") -- nb_cond = nb_cond -1 -+ nb_cond = nb_cond -1 - if define == 1: - test.write("#endif\n") - -@@ -900,10 +900,10 @@ test_%s(void) { - for module in modules: - # gather all the functions exported by that module - try: -- functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module)) -+ functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module)) - except: -- print "Failed to gather functions from module %s" % (module) -- continue; -+ print("Failed to gather functions from module %s" % (module)) -+ continue; - - # iterate over all functions in the module generating the test - i = 0 -@@ -923,14 +923,14 @@ test_%s(void) { - # iterate over all functions in the module generating the call - for function in functions: - name = function.xpathEval('string(@name)') -- if is_skipped_function(name): -- continue -- test.write(" test_ret += test_%s();\n" % (name)) -+ if is_skipped_function(name): -+ continue -+ test.write(" test_ret += test_%s();\n" % (name)) - - # footer - test.write(""" - if (test_ret != 0) -- printf("Module %s: %%d errors\\n", test_ret); -+\tprintf("Module %s: %%d errors\\n", test_ret); - return(test_ret); - } - """ % (module)) -@@ -948,7 +948,7 @@ test.write(""" return(0); - } - """); - --print "Generated test for %d modules and %d functions" %(len(modules), nb_tests) -+print("Generated test for %d modules and %d functions" %(len(modules), nb_tests)) - - compare_and_save() - -@@ -960,11 +960,8 @@ for missing in missing_types.keys(): - n = len(missing_types[missing]) - missing_list.append((n, missing)) - --def compare_missing(a, b): -- return b[0] - a[0] -- --missing_list.sort(compare_missing) --print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list)) -+missing_list.sort(key=lambda a: a[0]) -+print("Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list))) - lst = open("missing.lst", "w") - lst.write("Missing support for %d types" % (len(missing_list))) - lst.write("\n") -@@ -974,9 +971,9 @@ for miss in missing_list: - for n in missing_types[miss[1]]: - i = i + 1 - if i > 5: -- lst.write(" ...") -- break -- lst.write(" %s" % (n)) -+ lst.write(" ...") -+ break -+ lst.write(" %s" % (n)) - lst.write("\n") - lst.write("\n") - lst.write("\n") diff --git a/poky/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch b/poky/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch deleted file mode 100644 index ad719d4f5f..0000000000 --- a/poky/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 395c0f53ec226aaabedb166e6b3a7f8590b95a5f Mon Sep 17 00:00:00 2001 -From: Hongxu Jia -Date: Sat, 11 May 2019 20:39:15 +0800 -Subject: [PATCH] Make sure that Makefile doesn't try to compile these tests - again on the target where the source dependencies won't be available. - -Upstream-Status: Inappropriate [cross-compile specific] - -Signed-off-by: Anuj Mittal - -Rebase to 2.9.9 -Signed-off-by: Hongxu Jia ---- - Makefile.am | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 8f4e43d..5edb930 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -211,8 +211,7 @@ install-ptest: - sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile - $(MAKE) -C python install-ptest - --runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \ -- testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT) -+runtests: - [ -d test ] || $(LN_S) $(srcdir)/test . - [ -d result ] || $(LN_S) $(srcdir)/result . - $(CHECKER) ./runtest$(EXEEXT) && \ --- -2.7.4 - diff --git a/poky/meta/recipes-core/libxml/libxml2/fix-tests.patch b/poky/meta/recipes-core/libxml/libxml2/fix-tests.patch new file mode 100644 index 0000000000..80678efcfe --- /dev/null +++ b/poky/meta/recipes-core/libxml/libxml2/fix-tests.patch @@ -0,0 +1,222 @@ +Backport the following patches to fix the reader2 and runsuite test cases: + +b92768cd tests: Enable "runsuite" test +0ac8c15e python/tests/reader2: use absolute paths everywhere +b9ba5e1d python/tests/reader2: always exit(1) if a test fails + +Upstream-Status: Backport +Signed-off-by: Ross Burton + +diff --git a/python/tests/reader2.py b/python/tests/reader2.py +index 65cecd47..6e6353b4 100755 +--- a/python/tests/reader2.py ++++ b/python/tests/reader2.py +@@ -6,7 +6,6 @@ + import sys + import glob + import os +-import string + import libxml2 + try: + import StringIO +@@ -20,103 +19,104 @@ libxml2.debugMemory(1) + + err = "" + basedir = os.path.dirname(os.path.realpath(__file__)) +-dir_prefix = os.path.join(basedir, "../../test/valid/") ++dir_prefix = os.path.realpath(os.path.join(basedir, "..", "..", "test", "valid")) ++ + # This dictionary reflects the contents of the files + # ../../test/valid/*.xml.err that are not empty, except that + # the file paths in the messages start with ../../test/ + + expect = { + '766956': +-"""../../test/valid/dtds/766956.dtd:2: parser error : PEReference: expecting ';' ++"""{0}/dtds/766956.dtd:2: parser error : PEReference: expecting ';' + %ä%ent; + ^ +-../../test/valid/dtds/766956.dtd:2: parser error : Content error in the external subset ++{0}/dtds/766956.dtd:2: parser error : Content error in the external subset + %ä%ent; + ^ + Entity: line 1: + value + ^ +-""", ++""".format(dir_prefix), + '781333': +-"""../../test/valid/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got ++"""{0}/781333.xml:4: element a: validity error : Element a content does not follow the DTD, expecting ( ..., got + + ^ +-../../test/valid/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more child ++{0}/781333.xml:5: element a: validity error : Element a content does not follow the DTD, Expecting more child + + ^ +-""", ++""".format(dir_prefix), + 'cond_sect2': +-"""../../test/valid/dtds/cond_sect2.dtd:15: parser error : All markup of the conditional section is not in the same entity ++"""{0}/dtds/cond_sect2.dtd:15: parser error : All markup of the conditional section is not in the same entity + %ent; + ^ + Entity: line 1: + ]]> + ^ +-../../test/valid/dtds/cond_sect2.dtd:17: parser error : Content error in the external subset ++{0}/dtds/cond_sect2.dtd:17: parser error : Content error in the external subset + + ^ +-""", ++""".format(dir_prefix), + 'rss': +-"""../../test/valid/rss.xml:177: element rss: validity error : Element rss does not carry attribute version ++"""{0}/rss.xml:177: element rss: validity error : Element rss does not carry attribute version + + ^ +-""", ++""".format(dir_prefix), + 't8': +-"""../../test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration ++"""{0}/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration + + %defroot; %defmiddle; %deftest; + ^ + Entity: line 1: + <!ELEMENT root (middle) > + ^ +-../../test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration ++{0}/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration + + %defroot; %defmiddle; %deftest; + ^ + Entity: line 1: + <!ELEMENT middle (test) > + ^ +-../../test/valid/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration ++{0}/t8.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration + + %defroot; %defmiddle; %deftest; + ^ + Entity: line 1: + <!ELEMENT test (#PCDATA) > + ^ +-""", ++""".format(dir_prefix), + 't8a': +-"""../../test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration ++"""{0}/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration + + %defroot;%defmiddle;%deftest; + ^ + Entity: line 1: + <!ELEMENT root (middle) > + ^ +-../../test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration ++{0}/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration + + %defroot;%defmiddle;%deftest; + ^ + Entity: line 1: + <!ELEMENT middle (test) > + ^ +-../../test/valid/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration ++{0}/t8a.xml:6: parser error : internal error: xmlParseInternalSubset: error detected in Markup declaration + + %defroot;%defmiddle;%deftest; + ^ + Entity: line 1: + <!ELEMENT test (#PCDATA) > + ^ +-""", ++""".format(dir_prefix), + 'xlink': +-"""../../test/valid/xlink.xml:450: element termdef: validity error : ID dt-arc already defined ++"""{0}/xlink.xml:450: element termdef: validity error : ID dt-arc already defined +

An + +From c7809dc6947324ea506a0c2bf132ecd37156f211 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Mon, 5 Dec 2022 17:02:32 +0000 +Subject: [PATCH] add yocto-specific install-ptest target + +--- + Makefile.am | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index 316109b1..15e100be 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -26,6 +26,16 @@ check_PROGRAMS = \ + testlimits \ + testrecurse + ++ptestdir=$(libexecdir) ++install-test-data: $(check_PROGRAMS) ++ install -d $(DESTDIR)$(ptestdir) $(DESTDIR)$(ptestdir)/python/ ++ for T in $(check_PROGRAMS); do \ ++ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$T $(DESTDIR)$(ptestdir) ;\ ++ done ++ cp -r $(srcdir)/test $(DESTDIR)$(ptestdir) ++ cp -r $(srcdir)/result $(DESTDIR)$(ptestdir) ++ cp -r $(srcdir)/python/tests $(DESTDIR)$(ptestdir)/python ++ + bin_PROGRAMS = xmllint xmlcatalog + + nodist_bin_SCRIPTS = xml2-config +-- +2.34.1 + diff --git a/poky/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch b/poky/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch index cc9da88a29..639c80bd6c 100644 --- a/poky/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch +++ b/poky/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch @@ -1,26 +1,8 @@ -From 7196bce35954c4b46391cb0139aeb15ed628fa54 Mon Sep 17 00:00:00 2001 -From: Tony Tascioglu -Date: Fri, 14 May 2021 11:50:35 -0400 -Subject: [PATCH] AM_PATH_XML2 uses xml-config which we disable through +Change the AM_PATH_XML2 macros to use pkg-config instead of xml2-config. -binconfig-disabled.bbclass, so port it to use pkg-config instead. +Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/d598d8af0913b6e3d4e61ffa62397a275b669dca] +Signed-off-by: Ross Burton -This cannot be upstreamed, as the original macro supports various -optional arguments which cannot be supported with a direct call -to pkg-config. - -Upstream-Status: Inappropriate [oe-core specific; see above] -Signed-off-by: Ross Burton - -Rebase to 2.9.9 -Signed-off-by: Hongxu Jia - -Updated to apply cleanly to v2.9.12 -Signed-off-by: Tony Tascioglu - -Rebase to 2.9.14 -Signed-off-by: Jiaqing Zhao ---- libxml.m4 | 189 ++---------------------------------------------------- 1 file changed, 5 insertions(+), 184 deletions(-) diff --git a/poky/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch b/poky/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch deleted file mode 100644 index 956ff3f33e..0000000000 --- a/poky/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch +++ /dev/null @@ -1,35 +0,0 @@ -From b038c3452667ed17ddb0e791cd7bdc7f8774ac29 Mon Sep 17 00:00:00 2001 -From: Hongxu Jia -Date: Sat, 11 May 2019 20:35:20 +0800 -Subject: [PATCH] Allow us to pass in PYTHON_SITE_PACKAGES - -The python binary used when building for nativesdk doesn't give us the -correct path here so we need to be able to specify it ourselves. - -Upstream-Status: Inappropriate [config] -Signed-off-by: Paul Eggleton - -Rebase to 2.9.9 - -Signed-off-by: Hongxu Jia ---- - configure.ac | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index ca911f3..3bbd654 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -808,7 +808,8 @@ dnl - - PYTHON_VERSION= - PYTHON_INCLUDES= --PYTHON_SITE_PACKAGES= -+# Allow this to be set externally -+#PYTHON_SITE_PACKAGES= - PYTHON_TESTS= - pythondir= - if test "$with_python" != "no" ; then --- -2.7.4 - diff --git a/poky/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch b/poky/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch deleted file mode 100644 index 66694af388..0000000000 --- a/poky/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch +++ /dev/null @@ -1,44 +0,0 @@ -From e49a0d4a8f3f725d6f683854e1cad36a3cd02962 Mon Sep 17 00:00:00 2001 -From: Tony Tascioglu -Date: Wed, 19 May 2021 19:43:56 -0400 -Subject: [PATCH] Remove fuzz testing from executing with ptests. - -Upstream version 2.9.12 introduced new fuzz-testing and a corresponding -folder fuzz. These tests are not required for ptests of this package. - -This patch removes the fuzz testing targets from the Makefile. -Otherwise, running the ptests will fail due to the invalid directory. - -Upstream-Status: Inappropriate [oe specific] -Signed-off-by: Tony Tascioglu ---- - Makefile.am | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index a9284b95..3d7b344d 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -2,9 +2,9 @@ - - ACLOCAL_AMFLAGS = -I m4 - --SUBDIRS = include . doc example fuzz xstc $(PYTHON_SUBDIR) -+SUBDIRS = include . doc example xstc $(PYTHON_SUBDIR) - --DIST_SUBDIRS = include . doc example fuzz python xstc -+DIST_SUBDIRS = include . doc example python xstc - - AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include - -@@ -210,7 +210,6 @@ runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \ - $(CHECKER) ./runxmlconf$(EXEEXT) - @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \ - $(MAKE) tests ; fi) -- @cd fuzz; $(MAKE) tests - - check: all runtests - --- -2.25.1 - diff --git a/poky/meta/recipes-core/libxml/libxml2/run-ptest b/poky/meta/recipes-core/libxml/libxml2/run-ptest old mode 100644 new mode 100755 index c313d83263..f252a78f17 --- a/poky/meta/recipes-core/libxml/libxml2/run-ptest +++ b/poky/meta/recipes-core/libxml/libxml2/run-ptest @@ -1,4 +1,20 @@ #!/bin/sh +set -e + export LC_ALL=en_US.UTF-8 -make -k runtests + +# testModule isn't that useful and hard-codes buildtree, so we don't run that +TESTS="runtest runsuite testrecurse testchar testdict testThreads runxmlconf testapi" + +for T in $TESTS; do + echo Running $T + ./$T && echo PASS: $T || echo FAIL: $T +done + +if test -d python/tests; then + cd python/tests + for T in *.py; do + python3 ./$T && echo PASS: $T || echo FAIL: $T + done +fi diff --git a/poky/meta/recipes-core/libxml/libxml2/runtest.patch b/poky/meta/recipes-core/libxml/libxml2/runtest.patch deleted file mode 100644 index 42bb22cfd4..0000000000 --- a/poky/meta/recipes-core/libxml/libxml2/runtest.patch +++ /dev/null @@ -1,849 +0,0 @@ -From 6172ccd1e74bc181f5298f19e240234e12876abe Mon Sep 17 00:00:00 2001 -From: Tony Tascioglu -Date: Tue, 11 May 2021 11:57:46 -0400 -Subject: [PATCH] Add 'install-ptest' rule. - -Print a standard result line for each test. - -The patch needs a rework according to comments in the merge request. - -Signed-off-by: Mihaela Sendrea -Signed-off-by: Andrej Valek -Upstream-Status: Inappropriate [https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/137] - -Signed-off-by: Hongxu Jia -Signed-off-by: Tony Tascioglu ---- - Makefile.am | 9 +++ - runsuite.c | 1 + - runtest.c | 2 + - runxmlconf.c | 1 + - testapi.c | 122 ++++++++++++++++++++++++++------------- - testchar.c | 156 +++++++++++++++++++++++++++++++++++--------------- - testdict.c | 1 + - testlimits.c | 1 + - testrecurse.c | 2 + - 9 files changed, 210 insertions(+), 85 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 05d1671f..ae622745 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -198,6 +198,15 @@ runxmlconf_LDADD= $(LDADDS) - #testOOM_DEPENDENCIES = $(DEPS) - #testOOM_LDADD= $(LDADDS) - -+install-ptest: -+ @(if [ -d .libs ] ; then cd .libs; fi; \ -+ install $(check_PROGRAMS) $(DESTDIR)) -+ cp -r $(srcdir)/test $(DESTDIR) -+ cp -r $(srcdir)/result $(DESTDIR) -+ cp -r $(srcdir)/python $(DESTDIR) -+ cp Makefile $(DESTDIR) -+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile -+ - runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \ - testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT) - [ -d test ] || $(LN_S) $(srcdir)/test . -diff --git a/runsuite.c b/runsuite.c -index d24b5ec3..f7ff2521 100644 ---- a/runsuite.c -+++ b/runsuite.c -@@ -1147,6 +1147,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - - if (logfile != NULL) - fclose(logfile); -+ printf("%s: runsuite\n\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } - #else /* !SCHEMAS */ -diff --git a/runtest.c b/runtest.c -index ffa98d04..470f95cb 100644 ---- a/runtest.c -+++ b/runtest.c -@@ -4508,6 +4508,7 @@ launchTests(testDescPtr tst) { - xmlCharEncCloseFunc(ebcdicHandler); - xmlCharEncCloseFunc(eucJpHandler); - -+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc); - return(err); - } - -@@ -4588,6 +4589,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - xmlCleanupParser(); - xmlMemoryDump(); - -+ printf("%s: runtest\n\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } - -diff --git a/runxmlconf.c b/runxmlconf.c -index 70f61017..e882b3a1 100644 ---- a/runxmlconf.c -+++ b/runxmlconf.c -@@ -595,6 +595,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - - if (logfile != NULL) - fclose(logfile); -+ printf("%s: runxmlconf\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } - -diff --git a/testapi.c b/testapi.c -index ff8b470d..52b51d78 100644 ---- a/testapi.c -+++ b/testapi.c -@@ -1246,49 +1246,91 @@ static int - testlibxml2(void) - { - int test_ret = 0; -- -- test_ret += test_HTMLparser(); -- test_ret += test_HTMLtree(); -- test_ret += test_SAX2(); -- test_ret += test_c14n(); -- test_ret += test_catalog(); -- test_ret += test_chvalid(); -- test_ret += test_debugXML(); -- test_ret += test_dict(); -- test_ret += test_encoding(); -- test_ret += test_entities(); -- test_ret += test_hash(); -- test_ret += test_list(); -- test_ret += test_nanoftp(); -- test_ret += test_nanohttp(); -- test_ret += test_parser(); -- test_ret += test_parserInternals(); -- test_ret += test_pattern(); -- test_ret += test_relaxng(); -- test_ret += test_schemasInternals(); -- test_ret += test_schematron(); -- test_ret += test_tree(); -- test_ret += test_uri(); -- test_ret += test_valid(); -- test_ret += test_xinclude(); -- test_ret += test_xmlIO(); -- test_ret += test_xmlautomata(); -- test_ret += test_xmlerror(); -- test_ret += test_xmlmodule(); -- test_ret += test_xmlreader(); -- test_ret += test_xmlregexp(); -- test_ret += test_xmlsave(); -- test_ret += test_xmlschemas(); -- test_ret += test_xmlschemastypes(); -- test_ret += test_xmlstring(); -- test_ret += test_xmlunicode(); -- test_ret += test_xmlwriter(); -- test_ret += test_xpath(); -- test_ret += test_xpathInternals(); -- test_ret += test_xpointer(); -+ int ret = 0; -+ -+ test_ret += (ret = test_HTMLparser()); -+ printf("%s: HTMLparser\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_HTMLtree()); -+ printf("%s: HTMLtree\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_SAX2()); -+ printf("%s: SAX2\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_c14n()); -+ printf("%s: c14n\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_catalog()); -+ printf("%s: catalog\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_chvalid()); -+ printf("%s: chvalid\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_debugXML()); -+ printf("%s: debugXML\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_dict()); -+ printf("%s: dict\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_encoding()); -+ printf("%s: encoding\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_entities()); -+ printf("%s: entities\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_hash()); -+ printf("%s: hash\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_list()); -+ printf("%s: list\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_nanoftp()); -+ printf("%s: nanoftp\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_nanohttp()); -+ printf("%s: nanohttp\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_parser()); -+ printf("%s: parser\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_parserInternals()); -+ printf("%s: parserInternals\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_pattern()); -+ printf("%s: pattern\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_relaxng()); -+ printf("%s: relaxng\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_schemasInternals()); -+ printf("%s: schemasInternals\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_schematron()); -+ printf("%s: schematron\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_tree()); -+ printf("%s: tree\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_uri()); -+ printf("%s: uri\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_valid()); -+ printf("%s: valid\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xinclude()); -+ printf("%s: xinclude\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlIO()); -+ printf("%s: xmlIO\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlautomata()); -+ printf("%s: xmlautomata\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlerror()); -+ printf("%s: xmlerror\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlmodule()); -+ printf("%s: xmlmodule\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlreader()); -+ printf("%s: xmlreader\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlregexp()); -+ printf("%s: xmlregexp\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlsave()); -+ printf("%s: xmlsave\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlschemas()); -+ printf("%s: xmlschemas\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlschemastypes()); -+ printf("%s: xmlschemastypes\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlstring()); -+ printf("%s: xmlstring\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlunicode()); -+ printf("%s: xmlunicode\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xmlwriter()); -+ printf("%s: xmlwriter\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xpath()); -+ printf("%s: xpath\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xpathInternals()); -+ printf("%s: xpathInternals\n", (ret == 0) ? "PASS" : "FAIL"); -+ test_ret += (ret = test_xpointer()); -+ printf("%s: xpointer\n", (ret == 0) ? "PASS" : "FAIL"); - - printf("Total: %d functions, %d tests, %d errors\n", - function_tests, call_tests, test_ret); -+ -+ printf("%s: testapi\n\n", (test_ret == 0) ? "PASS" : "FAIL"); - return(test_ret); - } - -diff --git a/testchar.c b/testchar.c -index 6866a175..7bce0132 100644 ---- a/testchar.c -+++ b/testchar.c -@@ -23,7 +23,7 @@ static void errorHandler(void *unused, xmlErrorPtr err) { - char document1[100] = "XXXX"; - char document2[100] = ""; - --static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, -+static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, - int len, char *data, int forbid1, int forbid2) { - int i; - xmlDocPtr res; -@@ -37,33 +37,41 @@ static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, - res = xmlReadMemory(document, len, "test", NULL, 0); - - if ((i == forbid1) || (i == forbid2)) { -- if ((lastError == 0) || (res != NULL)) -+ if ((lastError == 0) || (res != NULL)) { - fprintf(stderr, - "Failed to detect invalid char for Byte 0x%02X: %c\n", - i, i); -+ return(1); -+ } - } - - else if ((i == '<') || (i == '&')) { -- if ((lastError == 0) || (res != NULL)) -+ if ((lastError == 0) || (res != NULL)) { - fprintf(stderr, - "Failed to detect illegal char %c for Byte 0x%02X\n", i, i); -+ return(1); -+ } - } - else if (((i < 0x20) || (i >= 0x80)) && - (i != 0x9) && (i != 0xA) && (i != 0xD)) { -- if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) -+ if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) { - fprintf(stderr, - "Failed to detect invalid char for Byte 0x%02X\n", i); -+ return(1); -+ } - } - else if (res == NULL) { - fprintf(stderr, - "Failed to parse valid char for Byte 0x%02X : %c\n", i, i); -+ return(1); - } - if (res != NULL) - xmlFreeDoc(res); - } -+ return(0); - } - --static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, -+static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, - int len, char *data) { - int i, j; - xmlDocPtr res; -@@ -80,10 +88,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, - - /* if first bit of first char is set, then second bit must too */ - if ((i & 0x80) && ((i & 0x40) == 0)) { -- if ((lastError == 0) || (res != NULL)) -+ if ((lastError == 0) || (res != NULL)) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", - i, j); -+ return(1); -+ } - } - - /* -@@ -91,10 +101,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, - * bits must be 10 - */ - else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { -- if ((lastError == 0) || (res != NULL)) -+ if ((lastError == 0) || (res != NULL)) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", - i, j); -+ return(1); -+ } - } - - /* -@@ -102,10 +114,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, - * than 0x80, i.e. one of bits 5 to 1 of i must be set - */ - else if ((i & 0x80) && ((i & 0x1E) == 0)) { -- if ((lastError == 0) || (res != NULL)) -+ if ((lastError == 0) || (res != NULL)) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", - i, j); -+ return(1); -+ } - } - - /* -@@ -113,10 +127,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, - * at least 3 bytes, but we give only 2 ! - */ - else if ((i & 0xE0) == 0xE0) { -- if ((lastError == 0) || (res != NULL)) -+ if ((lastError == 0) || (res != NULL)) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", - i, j); -+ return(1); -+ } - } - - /* -@@ -125,11 +141,13 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, - else if ((lastError != 0) || (res == NULL)) { - fprintf(stderr, - "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j); -+ return(1); - } - if (res != NULL) - xmlFreeDoc(res); - } - } -+ return(0); - } - - /** -@@ -141,9 +159,10 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, - * CDATA in text or in attribute values. - */ - --static void testDocumentRanges(void) { -+static int testDocumentRanges(void) { - xmlParserCtxtPtr ctxt; - char *data; -+ int test_ret = 0; - - /* - * Set up a parsing context using the first document as -@@ -152,7 +171,7 @@ static void testDocumentRanges(void) { - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) { - fprintf(stderr, "Failed to allocate parser context\n"); -- return; -+ return(1); - } - - printf("testing 1 byte char in document: 1"); -@@ -163,7 +182,7 @@ static void testDocumentRanges(void) { - data[2] = ' '; - data[3] = ' '; - /* test 1 byte injection at beginning of area */ -- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), -+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), - data, -1, -1); - printf(" 2"); - fflush(stdout); -@@ -172,7 +191,7 @@ static void testDocumentRanges(void) { - data[2] = ' '; - data[3] = ' '; - /* test 1 byte injection at end of area */ -- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), -+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), - data + 3, -1, -1); - - printf(" 3"); -@@ -183,7 +202,7 @@ static void testDocumentRanges(void) { - data[2] = ' '; - data[3] = ' '; - /* test 1 byte injection at beginning of area */ -- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), -+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), - data, '\'', -1); - printf(" 4"); - fflush(stdout); -@@ -192,7 +211,7 @@ static void testDocumentRanges(void) { - data[2] = ' '; - data[3] = ' '; - /* test 1 byte injection at end of area */ -- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), -+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), - data + 3, '\'', -1); - printf(" done\n"); - -@@ -204,7 +223,7 @@ static void testDocumentRanges(void) { - data[2] = ' '; - data[3] = ' '; - /* test 2 byte injection at beginning of area */ -- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), -+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), - data); - printf(" 2"); - fflush(stdout); -@@ -213,7 +232,7 @@ static void testDocumentRanges(void) { - data[2] = ' '; - data[3] = ' '; - /* test 2 byte injection at end of area */ -- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), -+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), - data + 2); - - printf(" 3"); -@@ -224,7 +243,7 @@ static void testDocumentRanges(void) { - data[2] = ' '; - data[3] = ' '; - /* test 2 byte injection at beginning of area */ -- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), -+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), - data); - printf(" 4"); - fflush(stdout); -@@ -233,14 +252,15 @@ static void testDocumentRanges(void) { - data[2] = ' '; - data[3] = ' '; - /* test 2 byte injection at end of area */ -- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), -+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), - data + 2); - printf(" done\n"); - - xmlFreeParserCtxt(ctxt); -+ return(test_ret); - } - --static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { -+static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { - int i = 0; - int len, c; - -@@ -255,19 +275,25 @@ static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { - c = xmlCurrentChar(ctxt, &len); - if ((i == 0) || (i >= 0x80)) { - /* we must see an error there */ -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Byte 0x%02X\n", i); -+ return(1); -+ } - } else if (i == 0xD) { -- if ((c != 0xA) || (len != 1)) -+ if ((c != 0xA) || (len != 1)) { - fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i); -+ return(1); -+ } - } else if ((c != i) || (len != 1)) { - fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i); -+ return(1); - } - } -+ return(0); - } - --static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { -+static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { - int i, j; - int len, c; - -@@ -284,10 +310,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { - - /* if first bit of first char is set, then second bit must too */ - if ((i & 0x80) && ((i & 0x40) == 0)) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", - i, j); -+ return(1); -+ } - } - - /* -@@ -295,10 +323,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { - * bits must be 10 - */ - else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", - i, j, c); -+ return(1); -+ } - } - - /* -@@ -306,10 +336,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { - * than 0x80, i.e. one of bits 5 to 1 of i must be set - */ - else if ((i & 0x80) && ((i & 0x1E) == 0)) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", - i, j, c); -+ return(1); -+ } - } - - /* -@@ -317,10 +349,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { - * at least 3 bytes, but we give only 2 ! - */ - else if ((i & 0xE0) == 0xE0) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", - i, j); -+ return(1); -+ } - } - - /* -@@ -329,6 +363,7 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { - else if ((lastError != 0) || (len != 2)) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j); -+ return(1); - } - - /* -@@ -338,12 +373,14 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n", - i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c); -+ return(1); - } - } - } -+ return(0); - } - --static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { -+static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { - int i, j, k, K; - int len, c; - unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; -@@ -368,20 +405,24 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { - * at least 4 bytes, but we give only 3 ! - */ - if ((i & 0xF0) == 0xF0) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - i, j, K, data[3]); -+ return(1); -+ } - } - - /* - * The second and the third bytes must start with 10 - */ - else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); -+ return(1); -+ } - } - - /* -@@ -390,10 +431,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { - * the 6th byte of data[1] must be set - */ - else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); -+ return(1); -+ } - } - - /* -@@ -401,10 +444,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { - */ - else if (((value > 0xD7FF) && (value <0xE000)) || - ((value > 0xFFFD) && (value <0x10000))) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n", - value, i, j, K); -+ return(1); -+ } - } - - /* -@@ -414,6 +459,7 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); -+ return(1); - } - - /* -@@ -423,13 +469,15 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", - i, j, data[2], value, c); -+ return(1); - } - } - } - } -+ return(0); - } - --static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { -+static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - int i, j, k, K, l, L; - int len, c; - unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; -@@ -458,10 +506,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - * at least 5 bytes, but we give only 4 ! - */ - if ((i & 0xF8) == 0xF8) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - i, j, K, data[3]); -+ return(1); -+ } - } - - /* -@@ -469,10 +519,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - */ - else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) || - ((L & 0xC0) != 0x80)) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - i, j, K, L); -+ return(1); -+ } - } - - /* -@@ -481,10 +533,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - * the 6 or 5th byte of j must be set - */ - else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - i, j, K, L); -+ return(1); -+ } - } - - /* -@@ -493,10 +547,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - else if (((value > 0xD7FF) && (value <0xE000)) || - ((value > 0xFFFD) && (value <0x10000)) || - (value > 0x10FFFF)) { -- if (lastError != XML_ERR_INVALID_CHAR) -+ if (lastError != XML_ERR_INVALID_CHAR) { - fprintf(stderr, - "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", - value, i, j, K, L); -+ return(1); -+ } - } - - /* -@@ -506,6 +562,7 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", - i, j, K); -+ return(1); - } - - /* -@@ -515,11 +572,13 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - fprintf(stderr, - "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", - i, j, data[2], value, c); -+ return(1); - } - } - } - } - } -+ return(0); - } - - /** -@@ -530,11 +589,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { - * cover the full range of UTF-8 chars accepted by XML-1.0 - */ - --static void testCharRanges(void) { -+static int testCharRanges(void) { - char data[5]; - xmlParserCtxtPtr ctxt; - xmlParserInputBufferPtr buf; - xmlParserInputPtr input; -+ int test_ret = 0; - - memset(data, 0, 5); - -@@ -545,17 +605,19 @@ static void testCharRanges(void) { - ctxt = xmlNewParserCtxt(); - if (ctxt == NULL) { - fprintf(stderr, "Failed to allocate parser context\n"); -- return; -+ return(1); - } - buf = xmlParserInputBufferCreateStatic(data, sizeof(data), - XML_CHAR_ENCODING_NONE); - if (buf == NULL) { - fprintf(stderr, "Failed to allocate input buffer\n"); -+ test_ret = 1; - goto error; - } - input = xmlNewInputStream(ctxt); - if (input == NULL) { - xmlFreeParserInputBuffer(buf); -+ test_ret = 1; - goto error; - } - input->filename = NULL; -@@ -567,25 +629,28 @@ static void testCharRanges(void) { - - printf("testing char range: 1"); - fflush(stdout); -- testCharRangeByte1(ctxt, data); -+ test_ret += testCharRangeByte1(ctxt, data); - printf(" 2"); - fflush(stdout); -- testCharRangeByte2(ctxt, data); -+ test_ret += testCharRangeByte2(ctxt, data); - printf(" 3"); - fflush(stdout); -- testCharRangeByte3(ctxt, data); -+ test_ret += testCharRangeByte3(ctxt, data); - printf(" 4"); - fflush(stdout); -- testCharRangeByte4(ctxt, data); -+ test_ret += testCharRangeByte4(ctxt, data); - printf(" done\n"); - fflush(stdout); - - error: - xmlFreeParserCtxt(ctxt); -+ return(test_ret); - } - - int main(void) { - -+ int ret = 0; -+ - /* - * this initialize the library and check potential ABI mismatches - * between the version it was compiled for and the actual shared -@@ -602,8 +667,9 @@ int main(void) { - /* - * Run the tests - */ -- testCharRanges(); -- testDocumentRanges(); -+ ret += testCharRanges(); -+ ret += testDocumentRanges(); -+ printf("%s: testchar\n\n", (ret == 0) ? "PASS" : "FAIL"); - - /* - * Cleanup function for the XML library. -diff --git a/testdict.c b/testdict.c -index 40bebd05..114b9347 100644 ---- a/testdict.c -+++ b/testdict.c -@@ -440,5 +440,6 @@ int main(void) - clean_strings(); - xmlCleanupParser(); - xmlMemoryDump(); -+ printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } -diff --git a/testlimits.c b/testlimits.c -index 059116a6..f0bee68d 100644 ---- a/testlimits.c -+++ b/testlimits.c -@@ -1634,5 +1634,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - xmlCleanupParser(); - xmlMemoryDump(); - -+ printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } -diff --git a/testrecurse.c b/testrecurse.c -index 0cbe25a6..3ecadb40 100644 ---- a/testrecurse.c -+++ b/testrecurse.c -@@ -892,6 +892,7 @@ launchTests(testDescPtr tst) { - err++; - } - } -+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc); - return(err); - } - -@@ -961,5 +962,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { - xmlCleanupParser(); - xmlMemoryDump(); - -+ printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL"); - return(ret); - } --- -2.25.1 - diff --git a/poky/meta/recipes-core/libxml/libxml2_2.10.3.bb b/poky/meta/recipes-core/libxml/libxml2_2.10.3.bb new file mode 100644 index 0000000000..6b3dd3ec42 --- /dev/null +++ b/poky/meta/recipes-core/libxml/libxml2_2.10.3.bb @@ -0,0 +1,96 @@ +SUMMARY = "XML C Parser Library and Toolkit" +DESCRIPTION = "The XML Parser Library allows for manipulation of XML files. Libxml2 exports Push and Pull type parser interfaces for both XML and HTML. It can do DTD validation at parse time, on a parsed document instance or with an arbitrary DTD. Libxml2 includes complete XPath, XPointer and Xinclude implementations. It also has a SAX like interface, which is designed to be compatible with Expat." +HOMEPAGE = "https://gitlab.gnome.org/GNOME/libxml2" +BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2" +SECTION = "libs" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://Copyright;md5=2044417e2e5006b65a8b9067b683fcf1 \ + file://hash.c;beginline=6;endline=15;md5=e77f77b12cb69e203d8b4090a0eee879 \ + file://list.c;beginline=4;endline=13;md5=b9c25b021ccaf287e50060602d20f3a7 \ + file://trio.c;beginline=5;endline=14;md5=cd4f61e27f88c1d43df112966b1cd28f" + +DEPENDS = "zlib virtual/libiconv" + +inherit gnomebase + +SRC_URI += "http://www.w3.org/XML/Test/xmlts20130923.tar;subdir=${BP};name=testtar \ + file://run-ptest \ + file://libxml-64bit.patch \ + file://fix-tests.patch \ + file://install-tests.patch \ + file://libxml-m4-use-pkgconfig.patch \ + " + +SRC_URI[archive.sha256sum] = "5d2cc3d78bec3dbe212a9d7fa629ada25a7da928af432c93060ff5c17ee28a9c" +SRC_URI[testtar.sha256sum] = "c6b2d42ee50b8b236e711a97d68e6c4b5c8d83e69a2be4722379f08702ea7273" + +BINCONFIG = "${bindir}/xml2-config" + +# Fixed since 2.9.11 via +# https://gitlab.gnome.org/GNOME/libxml2/-/commit/c1ba6f54d32b707ca6d91cb3257ce9de82876b6f +CVE_CHECK_IGNORE += "CVE-2016-3709" + +PACKAGECONFIG ??= "python \ + ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ +" +PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3" +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," + +inherit autotools pkgconfig binconfig-disabled ptest + +inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)} + +RDEPENDS:${PN}-ptest += "bash make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}" + +RDEPENDS:${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}" + +RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-ebcdic-us \ + glibc-gconv-ibm1141 \ + glibc-gconv-iso8859-5 \ + glibc-gconv-euc-jp \ + locale-base-en-us \ + " + +# WARNING: zlib is required for RPM use +EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --with-c14n --without-lzma --with-fexceptions" +EXTRA_OECONF:class-native = "--without-legacy --with-c14n --without-lzma --with-zlib" +EXTRA_OECONF:class-nativesdk = "--without-legacy --with-c14n --without-lzma --with-zlib" +EXTRA_OECONF:linuxstdbase = "--with-debug --with-legacy --with-c14n --without-lzma --with-zlib" + +python populate_packages:prepend () { + # autonamer would call this libxml2-2, but we don't want that + if d.getVar('DEBIAN_NAMES'): + d.setVar('PKG:libxml2', '${MLPREFIX}libxml2') +} + +PACKAGE_BEFORE_PN += "${PN}-utils" +PACKAGES += "${PN}-python" + +FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" +FILES:${PN}-utils = "${bindir}/*" +FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}" + +do_configure:prepend () { + # executables take longer to package: these should not be executable + find ${S}/xmlconf/ -type f -exec chmod -x {} \+ +} + +do_install_ptest () { + oe_runmake DESTDIR=${D} ptestdir=${PTEST_PATH} install-test-data + + cp -r ${S}/xmlconf ${D}${PTEST_PATH} + + if ! ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then + rm -rf ${D}${PTEST_DIR}/python + fi +} + +do_install:append:class-native () { + # Docs are not needed in the native case + rm ${D}${datadir}/gtk-doc -rf + + create_wrapper ${D}${bindir}/xmllint 'XML_CATALOG_FILES=${XML_CATALOG_FILES:-${sysconfdir}/xml/catalog}' +} +do_install[vardepsexclude] += "XML_CATALOG_FILES:-${sysconfdir}/xml/catalog" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-core/libxml/libxml2_2.9.14.bb b/poky/meta/recipes-core/libxml/libxml2_2.9.14.bb deleted file mode 100644 index a2ed8d71bc..0000000000 --- a/poky/meta/recipes-core/libxml/libxml2_2.9.14.bb +++ /dev/null @@ -1,128 +0,0 @@ -SUMMARY = "XML C Parser Library and Toolkit" -DESCRIPTION = "The XML Parser Library allows for manipulation of XML files. Libxml2 exports Push and Pull type parser interfaces for both XML and HTML. It can do DTD validation at parse time, on a parsed document instance or with an arbitrary DTD. Libxml2 includes complete XPath, XPointer and Xinclude implementations. It also has a SAX like interface, which is designed to be compatible with Expat." -HOMEPAGE = "https://gitlab.gnome.org/GNOME/libxml2" -BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2" -SECTION = "libs" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://Copyright;md5=2044417e2e5006b65a8b9067b683fcf1 \ - file://hash.c;beginline=6;endline=15;md5=e77f77b12cb69e203d8b4090a0eee879 \ - file://list.c;beginline=4;endline=13;md5=b9c25b021ccaf287e50060602d20f3a7 \ - file://trio.c;beginline=5;endline=14;md5=cd4f61e27f88c1d43df112966b1cd28f" - -DEPENDS = "zlib virtual/libiconv" - -inherit gnomebase - -SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=testtar \ - file://libxml-64bit.patch \ - file://runtest.patch \ - file://run-ptest \ - file://python-sitepackages-dir.patch \ - file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \ - file://fix-execution-of-ptests.patch \ - file://remove-fuzz-from-ptests.patch \ - file://libxml-m4-use-pkgconfig.patch \ - file://0001-Port-gentest.py-to-Python-3.patch \ - " - -SRC_URI[archive.sha256sum] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee" -SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7" - -BINCONFIG = "${bindir}/xml2-config" - -# Fixed since 2.9.11 via -# https://gitlab.gnome.org/GNOME/libxml2/-/commit/c1ba6f54d32b707ca6d91cb3257ce9de82876b6f -CVE_CHECK_IGNORE += "CVE-2016-3709" - -PACKAGECONFIG ??= "python \ - ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ -" -PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3" -PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," - -inherit autotools pkgconfig binconfig-disabled ptest - -inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)} - -RDEPENDS:${PN}-ptest += "bash make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}" - -RDEPENDS:${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}" - -RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-ebcdic-us \ - glibc-gconv-ibm1141 \ - glibc-gconv-iso8859-5 \ - glibc-gconv-euc-jp \ - locale-base-en-us \ - " - -export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}" - -# WARNING: zlib is required for RPM use -EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions" -EXTRA_OECONF:class-native = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib" -EXTRA_OECONF:class-nativesdk = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib" -EXTRA_OECONF:linuxstdbase = "--with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib" - -python populate_packages:prepend () { - # autonamer would call this libxml2-2, but we don't want that - if d.getVar('DEBIAN_NAMES'): - d.setVar('PKG:libxml2', '${MLPREFIX}libxml2') -} - -PACKAGE_BEFORE_PN += "${PN}-utils" -PACKAGES += "${PN}-python" - -FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" -FILES:${PN}-dev += "${libdir}/xml2Conf.sh" -FILES:${PN}-utils = "${bindir}/*" -FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}" - -do_configure:prepend () { - # executables take longer to package: these should not be executable - find ${S}/xmlconf/ -type f -exec chmod -x {} \+ -} - -do_compile_ptest() { - # Make sure that testapi.c is newer than gentests.py, because - # with reproducible builds, they will both get e.g. Jan 1 1970 - # modification time from SOURCE_DATE_EPOCH and then check-am - # might try to rebuild_testapi, which will fail even with - # 0001-Port-gentest.py-to-Python-3.patch, because it needs - # libxml2 module (libxml2-native dependency and correctly - # set PYTHON_SITE_PACKAGES), it's easier to - # just rely on pre-generated testapi.c from the release - touch ${S}/testapi.c - - oe_runmake check-am -} - -do_install_ptest () { - cp -r ${S}/xmlconf ${D}${PTEST_PATH} - if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then - sed -i -e 's|^\(PYTHON = \).*|\1${USRBINPATH}/${PYTHON_PN}|' \ - ${D}${PTEST_PATH}/python/tests/Makefile - grep -lrZ '#!/usr/bin/python' ${D}${PTEST_PATH}/python | - xargs -0 sed -i -e 's|/usr/bin/python|${USRBINPATH}/${PYTHON_PN}|' - fi - #Remove build host references from various Makefiles - find "${D}${PTEST_PATH}" -name Makefile -type f -exec \ - sed -i \ - -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ - -e 's|${DEBUG_PREFIX_MAP}||g' \ - -e 's:${HOSTTOOLS_DIR}/::g' \ - -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ - -e 's:${RECIPE_SYSROOT}::g' \ - -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ - -e '/^RELDATE/d' \ - {} + -} - -do_install:append:class-native () { - # Docs are not needed in the native case - rm ${D}${datadir}/gtk-doc -rf - - create_wrapper ${D}${bindir}/xmllint 'XML_CATALOG_FILES=${XML_CATALOG_FILES:-${sysconfdir}/xml/catalog}' -} -do_install[vardepsexclude] += "XML_CATALOG_FILES:-${sysconfdir}/xml/catalog" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-core/meta/cve-update-db-native.bb b/poky/meta/recipes-core/meta/cve-update-db-native.bb index 9b9dbbd75f..079f062f79 100644 --- a/poky/meta/recipes-core/meta/cve-update-db-native.bb +++ b/poky/meta/recipes-core/meta/cve-update-db-native.bb @@ -21,6 +21,8 @@ CVE_DB_UPDATE_INTERVAL ?= "86400" # Timeout for blocking socket operations, such as the connection attempt. CVE_SOCKET_TIMEOUT ?= "60" +CVE_DB_TEMP_FILE ?= "${CVE_CHECK_DB_DIR}/temp_nvdcve_1.1.db" + python () { if not bb.data.inherits_class("cve-check", d): raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.") @@ -32,25 +34,15 @@ python do_fetch() { """ import bb.utils import bb.progress - import sqlite3, urllib, urllib.parse, gzip - from datetime import date + import shutil bb.utils.export_proxies(d) - YEAR_START = 2002 - db_file = d.getVar("CVE_CHECK_DB_FILE") db_dir = os.path.dirname(db_file) + db_tmp_file = d.getVar("CVE_DB_TEMP_FILE") - cve_socket_timeout = int(d.getVar("CVE_SOCKET_TIMEOUT")) - - if os.path.exists("{0}-journal".format(db_file)): - # If a journal is present the last update might have been interrupted. In that case, - # just wipe any leftovers and force the DB to be recreated. - os.remove("{0}-journal".format(db_file)) - - if os.path.exists(db_file): - os.remove(db_file) + cleanup_db_download(db_file, db_tmp_file) # The NVD database changes once a day, so no need to update more frequently # Allow the user to force-update @@ -68,9 +60,60 @@ python do_fetch() { pass bb.utils.mkdirhier(db_dir) + if os.path.exists(db_file): + shutil.copy2(db_file, db_tmp_file) + + if update_db_file(db_tmp_file, d) == True: + # Update downloaded correctly, can swap files + shutil.move(db_tmp_file, db_file) + else: + # Update failed, do not modify the database + bb.note("CVE database update failed") + os.remove(db_tmp_file) +} + +do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}" +do_fetch[file-checksums] = "" +do_fetch[vardeps] = "" + +def cleanup_db_download(db_file, db_tmp_file): + """ + Cleanup the download space from possible failed downloads + """ + + # Clean up the updates done on the main file + # Remove it only if a journal file exists - it means a complete re-download + if os.path.exists("{0}-journal".format(db_file)): + # If a journal is present the last update might have been interrupted. In that case, + # just wipe any leftovers and force the DB to be recreated. + os.remove("{0}-journal".format(db_file)) + + if os.path.exists(db_file): + os.remove(db_file) + + # Clean-up the temporary file downloads, we can remove both journal + # and the temporary database + if os.path.exists("{0}-journal".format(db_tmp_file)): + # If a journal is present the last update might have been interrupted. In that case, + # just wipe any leftovers and force the DB to be recreated. + os.remove("{0}-journal".format(db_tmp_file)) + + if os.path.exists(db_tmp_file): + os.remove(db_tmp_file) + +def update_db_file(db_tmp_file, d): + """ + Update the given database file + """ + import bb.utils, bb.progress + from datetime import date + import urllib, gzip, sqlite3 + + YEAR_START = 2002 + cve_socket_timeout = int(d.getVar("CVE_SOCKET_TIMEOUT")) # Connect to database - conn = sqlite3.connect(db_file) + conn = sqlite3.connect(db_tmp_file) initialize_db(conn) with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f: @@ -88,7 +131,7 @@ python do_fetch() { except urllib.error.URLError as e: cve_f.write('Warning: CVE db update error, Unable to fetch CVE data.\n\n') bb.warn("Failed to fetch CVE data (%s)" % e.reason) - return + return False if response: for l in response.read().decode("utf-8").splitlines(): @@ -98,7 +141,7 @@ python do_fetch() { break else: bb.warn("Cannot parse CVE metadata, update failed") - return + return False # Compare with current db last modified date cursor = conn.execute("select DATE from META where YEAR = ?", (year,)) @@ -119,7 +162,7 @@ python do_fetch() { except urllib.error.URLError as e: cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n') bb.warn("Cannot parse CVE data (%s), update failed" % e.reason) - return + return False else: bb.debug(2, "Already up to date (last modified %s)" % last_modified) # Update success, set the date to cve_check file. @@ -128,11 +171,7 @@ python do_fetch() { conn.commit() conn.close() -} - -do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}" -do_fetch[file-checksums] = "" -do_fetch[vardeps] = "" + return True def initialize_db(conn): with conn: diff --git a/poky/meta/recipes-core/meta/uninative-tarball.bb b/poky/meta/recipes-core/meta/uninative-tarball.bb index a21d08b591..4aecf39b89 100644 --- a/poky/meta/recipes-core/meta/uninative-tarball.bb +++ b/poky/meta/recipes-core/meta/uninative-tarball.bb @@ -20,6 +20,7 @@ TOOLCHAIN_HOST_TASK = "\ nativesdk-libxcrypt-compat \ nativesdk-libnss-nis \ nativesdk-sdk-provides-dummy \ + nativesdk-libgcc \ " INHIBIT_DEFAULT_DEPS = "1" diff --git a/poky/meta/recipes-core/musl/musl_git.bb b/poky/meta/recipes-core/musl/musl_git.bb index a72d87ea6f..7749495ec6 100644 --- a/poky/meta/recipes-core/musl/musl_git.bb +++ b/poky/meta/recipes-core/musl/musl_git.bb @@ -4,7 +4,7 @@ require musl.inc inherit linuxloader -SRCREV = "dc9285ad1dc19349c407072cc48ba70dab86de45" +SRCREV = "f47a8cdd250d9163fcfb39bf4e9d813957c0b187" BASEVER = "1.2.3" diff --git a/poky/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb b/poky/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb index ca5fa32572..fb8c11582b 100644 --- a/poky/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb +++ b/poky/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb @@ -10,7 +10,6 @@ SRCREV = "20db1fb41ec91cd8a1f528e770362092c5403378" S = "${WORKDIR}/git" EXTRA_OECONF += "--with-abi-version=5" UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+(\.\d+)+)$" -UPSTREAM_VERSION_UNKNOWN = "1" # This is needed when using patchlevel versions like 6.1+20181013 CVE_VERSION = "${@d.getVar("PV").split('+')[0]}.${@d.getVar("PV").split('+')[1]}" diff --git a/poky/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch b/poky/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch index 9e345f4dda..1b6687cfaf 100644 --- a/poky/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch +++ b/poky/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch @@ -1,7 +1,7 @@ -From 860bb1979f3578bb83257076fe0f3bd33f9d68bf Mon Sep 17 00:00:00 2001 +From 9f28dd5f183f6e4d2b023cd555bb30446ae5f618 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Mon, 14 Jun 2021 19:56:28 +0200 -Subject: [PATCH 5/6] debug prefix map +Subject: [PATCH] debug prefix map We want to pass ${DEBUG_PREFIX_MAP} to gcc commands and also pass in --debug-prefix-map to nasm (we carry a patch to nasm for this). The @@ -22,10 +22,10 @@ Signed-off-by: Alexander Kanavin 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template -index 36241b6ede..947fbf2e8d 100755 +index c4e4c7ded0..058205da72 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template -@@ -1863,7 +1863,7 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N +@@ -1849,7 +1849,7 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N *_*_*_DTCPP_PATH = DEF(DTCPP_BIN) *_*_*_DTC_PATH = DEF(DTC_BIN) @@ -34,9 +34,9 @@ index 36241b6ede..947fbf2e8d 100755 DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie -@@ -1881,8 +1881,8 @@ DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _Ref - DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) +@@ -1871,8 +1871,8 @@ DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,Refere DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS) + DEFINE GCC_LOONGARCH64_ASLDLINK_FLAGS = DEF(GCC_LOONGARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map -DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h -DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h @@ -45,7 +45,7 @@ index 36241b6ede..947fbf2e8d 100755 DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h DEFINE GCC_ASLCC_FLAGS = -x c -@@ -2027,7 +2027,7 @@ DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include A +@@ -2026,7 +2026,7 @@ DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include A *_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS) *_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC48_IA32_OBJCOPY_FLAGS = @@ -54,7 +54,7 @@ index 36241b6ede..947fbf2e8d 100755 DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable -@@ -2055,7 +2055,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but +@@ -2054,7 +2054,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but *_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS) *_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_GCC48_X64_OBJCOPY_FLAGS = @@ -63,7 +63,7 @@ index 36241b6ede..947fbf2e8d 100755 DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable -@@ -2167,7 +2167,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s +@@ -2166,7 +2166,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s *_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) *_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC49_IA32_OBJCOPY_FLAGS = @@ -72,7 +72,7 @@ index 36241b6ede..947fbf2e8d 100755 DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable -@@ -2195,7 +2195,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but +@@ -2194,7 +2194,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but *_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) *_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_GCC49_X64_OBJCOPY_FLAGS = @@ -81,7 +81,7 @@ index 36241b6ede..947fbf2e8d 100755 DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable -@@ -2313,7 +2313,7 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 +@@ -2312,7 +2312,7 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 *_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -no-pie *_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC5_IA32_OBJCOPY_FLAGS = @@ -90,7 +90,7 @@ index 36241b6ede..947fbf2e8d 100755 DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386 -@@ -2345,7 +2345,7 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl, +@@ -2344,7 +2344,7 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl, *_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) *_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_GCC5_X64_OBJCOPY_FLAGS = @@ -100,5 +100,5 @@ index 36241b6ede..947fbf2e8d 100755 DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os -- -2.32.0 +2.30.2 diff --git a/poky/meta/recipes-core/ovmf/ovmf_git.bb b/poky/meta/recipes-core/ovmf/ovmf_git.bb index d1bf8b080d..5ca0b49b69 100644 --- a/poky/meta/recipes-core/ovmf/ovmf_git.bb +++ b/poky/meta/recipes-core/ovmf/ovmf_git.bb @@ -26,8 +26,8 @@ SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \ file://0006-reproducible.patch \ " -PV = "edk2-stable202208" -SRCREV = "ba0e0e4c6a174b71b18ccd6e47319cc45878893c" +PV = "edk2-stable202211" +SRCREV = "fff6d81270b57ee786ea18ad74f43149b9f03494" UPSTREAM_CHECK_GITTAGREGEX = "(?Pedk2-stable.*)" inherit deploy diff --git a/poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb b/poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb index d70aff22c7..104f3549d5 100644 --- a/poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +++ b/poky/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb @@ -11,6 +11,11 @@ inherit packagegroup #PACKAGEFUNCS =+ 'generate_sdk_pkgs' +TARGET_TOOLCHAIN_LANGS ??= "${SDK_TOOLCHAIN_LANGS}" +TARGET_TOOLCHAIN_LANGS:remove:sdkmingw32 = "rust" +# libstd-rs doesn't build for mips n32 with compiler constraint errors +TARGET_TOOLCHAIN_LANGS:remove:mipsarchn32 = "rust" + RDEPENDS:packagegroup-core-sdk = "\ packagegroup-core-buildessential \ coreutils \ @@ -23,7 +28,10 @@ RDEPENDS:packagegroup-core-sdk = "\ less \ ldd \ file \ - tcl" + tcl \ + ${@bb.utils.contains('TARGET_TOOLCHAIN_LANGS', 'go', 'packagegroup-go-sdk-target', '', d)} \ + ${@bb.utils.contains('TARGET_TOOLCHAIN_LANGS', 'rust', 'packagegroup-rust-sdk-target', '', d)} \ +" SANITIZERS = "libasan-dev libubsan-dev" SANITIZERS:arc = "" diff --git a/poky/meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb b/poky/meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb new file mode 100644 index 0000000000..59874c4c2c --- /dev/null +++ b/poky/meta/recipes-core/packagegroups/packagegroup-rust-sdk-target.bb @@ -0,0 +1,14 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +SUMMARY = "Target packages for the Rust SDK" + +inherit packagegroup + +RDEPENDS:${PN} = " \ + rust \ + cargo \ +" diff --git a/poky/meta/recipes-core/psplash/files/psplash-start.service b/poky/meta/recipes-core/psplash/files/psplash-start.service index 36c2bb38e0..bec9368427 100644 --- a/poky/meta/recipes-core/psplash/files/psplash-start.service +++ b/poky/meta/recipes-core/psplash/files/psplash-start.service @@ -2,6 +2,7 @@ Description=Start psplash boot splash screen DefaultDependencies=no RequiresMountsFor=/run +ConditionFileIsExecutable=/usr/bin/psplash [Service] Type=notify diff --git a/poky/meta/recipes-core/psplash/files/psplash-systemd.service b/poky/meta/recipes-core/psplash/files/psplash-systemd.service index 082207f232..e93e3deb35 100644 --- a/poky/meta/recipes-core/psplash/files/psplash-systemd.service +++ b/poky/meta/recipes-core/psplash/files/psplash-systemd.service @@ -4,6 +4,7 @@ DefaultDependencies=no After=psplash-start.service Requires=psplash-start.service RequiresMountsFor=/run +ConditionFileIsExecutable=/usr/bin/psplash [Service] ExecStart=/usr/bin/psplash-systemd diff --git a/poky/meta/recipes-core/systemd/systemd-boot_251.8.bb b/poky/meta/recipes-core/systemd/systemd-boot_251.8.bb deleted file mode 100644 index b67706b731..0000000000 --- a/poky/meta/recipes-core/systemd/systemd-boot_251.8.bb +++ /dev/null @@ -1,73 +0,0 @@ -require systemd.inc -FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" - -require conf/image-uefi.conf - -DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native python3-jinja2-native" - -inherit meson pkgconfig gettext -inherit deploy - -LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " - -do_write_config[vardeps] += "CC OBJCOPY" -do_write_config:append() { - cat >${WORKDIR}/meson-${PN}.cross <${WORKDIR}/meson-${PN}.cross < src/udev/udev-builtin-net_id.c | 2 +- 37 files changed, 44 insertions(+), 42 deletions(-) -diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c -index b346a50d78..7884d4c1cd 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -5,7 +5,7 @@ @@ -60,8 +58,6 @@ index b346a50d78..7884d4c1cd 100644 #include #include "sd-dhcp6-client.h" -diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c -index 8ff0eb1360..7e06b8d57d 100644 --- a/src/network/netdev/bareudp.c +++ b/src/network/netdev/bareudp.c @@ -2,7 +2,7 @@ @@ -73,8 +69,6 @@ index 8ff0eb1360..7e06b8d57d 100644 #include "bareudp.h" #include "netlink-util.h" -diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c -index 15f3aee3a6..ec76428436 100644 --- a/src/network/netdev/batadv.c +++ b/src/network/netdev/batadv.c @@ -3,7 +3,7 @@ @@ -86,8 +80,6 @@ index 15f3aee3a6..ec76428436 100644 #include "batadv.h" #include "fileio.h" -diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c -index 5d94aa1d68..4e379a326d 100644 --- a/src/network/netdev/bond.c +++ b/src/network/netdev/bond.c @@ -1,7 +1,7 @@ @@ -99,8 +91,6 @@ index 5d94aa1d68..4e379a326d 100644 #include "alloc-util.h" #include "bond.h" -diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c -index b974f2ae0a..9a5f18d556 100644 --- a/src/network/netdev/bridge.c +++ b/src/network/netdev/bridge.c @@ -2,7 +2,7 @@ @@ -112,8 +102,6 @@ index b974f2ae0a..9a5f18d556 100644 #include #include "bridge.h" -diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c -index 00df1d2787..77b506b422 100644 --- a/src/network/netdev/dummy.c +++ b/src/network/netdev/dummy.c @@ -1,6 +1,6 @@ @@ -124,8 +112,6 @@ index 00df1d2787..77b506b422 100644 #include "dummy.h" -diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c -index 224c17e979..fb79cc13f6 100644 --- a/src/network/netdev/geneve.c +++ b/src/network/netdev/geneve.c @@ -2,7 +2,7 @@ @@ -137,8 +123,6 @@ index 224c17e979..fb79cc13f6 100644 #include "alloc-util.h" #include "conf-parser.h" -diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c -index d7ff44cb9e..e037629ae4 100644 --- a/src/network/netdev/ifb.c +++ b/src/network/netdev/ifb.c @@ -1,7 +1,7 @@ @@ -150,8 +134,6 @@ index d7ff44cb9e..e037629ae4 100644 #include "ifb.h" -diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c -index e0ff9e8c62..ab085c1f6d 100644 --- a/src/network/netdev/ipoib.c +++ b/src/network/netdev/ipoib.c @@ -1,6 +1,6 @@ @@ -162,8 +144,6 @@ index e0ff9e8c62..ab085c1f6d 100644 #include #include "ipoib.h" -diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c -index d15766cd7b..60728b4f94 100644 --- a/src/network/netdev/ipvlan.c +++ b/src/network/netdev/ipvlan.c @@ -2,7 +2,7 @@ @@ -175,8 +155,6 @@ index d15766cd7b..60728b4f94 100644 #include "conf-parser.h" #include "ipvlan.h" -diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c -index f1a566a9ca..1f37927a83 100644 --- a/src/network/netdev/macsec.c +++ b/src/network/netdev/macsec.c @@ -1,7 +1,7 @@ @@ -188,8 +166,6 @@ index f1a566a9ca..1f37927a83 100644 #include #include #include -diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c -index c41be6e78f..ee2660c5bf 100644 --- a/src/network/netdev/macvlan.c +++ b/src/network/netdev/macvlan.c @@ -2,7 +2,7 @@ @@ -201,8 +177,6 @@ index c41be6e78f..ee2660c5bf 100644 #include "conf-parser.h" #include "macvlan.h" -diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c -index 8e7fe11c18..701ab2bd69 100644 --- a/src/network/netdev/netdev.c +++ b/src/network/netdev/netdev.c @@ -2,7 +2,7 @@ @@ -214,8 +188,6 @@ index 8e7fe11c18..701ab2bd69 100644 #include #include "alloc-util.h" -diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c -index 15d5c132f9..a3ffa48b15 100644 --- a/src/network/netdev/netdevsim.c +++ b/src/network/netdev/netdevsim.c @@ -1,6 +1,6 @@ @@ -226,8 +198,6 @@ index 15d5c132f9..a3ffa48b15 100644 #include "netdevsim.h" -diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c -index ff372092e6..eef66811f4 100644 --- a/src/network/netdev/nlmon.c +++ b/src/network/netdev/nlmon.c @@ -1,6 +1,6 @@ @@ -238,8 +208,6 @@ index ff372092e6..eef66811f4 100644 #include "nlmon.h" -diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c -index 97e534fe99..0302c1cb94 100644 --- a/src/network/netdev/tunnel.c +++ b/src/network/netdev/tunnel.c @@ -2,7 +2,7 @@ @@ -251,8 +219,6 @@ index 97e534fe99..0302c1cb94 100644 #include #include #include -diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c -index 380547ee1e..137c1adf8a 100644 --- a/src/network/netdev/vcan.c +++ b/src/network/netdev/vcan.c @@ -1,6 +1,6 @@ @@ -263,8 +229,6 @@ index 380547ee1e..137c1adf8a 100644 #include "vcan.h" -diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c -index c946e81fc0..d1a6be73f9 100644 --- a/src/network/netdev/veth.c +++ b/src/network/netdev/veth.c @@ -3,7 +3,7 @@ @@ -276,8 +240,6 @@ index c946e81fc0..d1a6be73f9 100644 #include #include "netlink-util.h" -diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c -index af3e77963e..efa4b0a164 100644 --- a/src/network/netdev/vlan.c +++ b/src/network/netdev/vlan.c @@ -2,7 +2,7 @@ @@ -289,8 +251,6 @@ index af3e77963e..efa4b0a164 100644 #include #include "parse-util.h" -diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c -index b1b6707441..1c6d1982e1 100644 --- a/src/network/netdev/vrf.c +++ b/src/network/netdev/vrf.c @@ -2,7 +2,7 @@ @@ -302,8 +262,6 @@ index b1b6707441..1c6d1982e1 100644 #include "vrf.h" -diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c -index a0ba048eb1..875f2e5901 100644 --- a/src/network/netdev/vxcan.c +++ b/src/network/netdev/vxcan.c @@ -1,7 +1,7 @@ @@ -315,8 +273,6 @@ index a0ba048eb1..875f2e5901 100644 #include "vxcan.h" -diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c -index 30b0855598..a065158801 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -2,7 +2,7 @@ @@ -328,8 +284,6 @@ index 30b0855598..a065158801 100644 #include "conf-parser.h" #include "alloc-util.h" -diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c -index 88f668753a..5fc753384b 100644 --- a/src/network/netdev/wireguard.c +++ b/src/network/netdev/wireguard.c @@ -6,7 +6,7 @@ @@ -341,8 +295,6 @@ index 88f668753a..5fc753384b 100644 #include #include "sd-resolve.h" -diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c -index ef5e735b2b..419afd75f2 100644 --- a/src/network/netdev/xfrm.c +++ b/src/network/netdev/xfrm.c @@ -1,6 +1,6 @@ @@ -353,8 +305,6 @@ index ef5e735b2b..419afd75f2 100644 #include "missing_network.h" #include "xfrm.h" -diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c -index 10025a97ae..a0239ea83a 100644 --- a/src/network/networkd-bridge-mdb.c +++ b/src/network/networkd-bridge-mdb.c @@ -1,7 +1,5 @@ @@ -374,8 +324,6 @@ index 10025a97ae..a0239ea83a 100644 #define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U -diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c -index 7996960bd1..e870b9ba26 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -1,7 +1,8 @@ @@ -387,9 +335,7 @@ index 7996960bd1..e870b9ba26 100644 +#include #include "bus-error.h" - #include "dhcp-identifier.h" -diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c -index 7be9713d46..e830fcd575 100644 + #include "bus-locator.h" --- a/src/network/networkd-dhcp-prefix-delegation.c +++ b/src/network/networkd-dhcp-prefix-delegation.c @@ -1,7 +1,5 @@ @@ -409,8 +355,6 @@ index 7be9713d46..e830fcd575 100644 bool link_dhcp_pd_is_enabled(Link *link) { assert(link); -diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c -index 9acfd17d49..3108289602 100644 --- a/src/network/networkd-dhcp-server.c +++ b/src/network/networkd-dhcp-server.c @@ -1,7 +1,7 @@ @@ -422,8 +366,6 @@ index 9acfd17d49..3108289602 100644 #include #include "sd-dhcp-server.h" -diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c -index cb9c428ae9..a35d58f3f1 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -3,7 +3,7 @@ @@ -435,21 +377,17 @@ index cb9c428ae9..a35d58f3f1 100644 #include "alloc-util.h" #include "dhcp-client-internal.h" -diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c -index dc09171afe..5b93ef3dd4 100644 --- a/src/network/networkd-ipv6ll.c +++ b/src/network/networkd-ipv6ll.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ - + #include -#include +//#include - + #include "in-addr-util.h" #include "networkd-address.h" -diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c -index 63679505f7..825ea76ff2 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -3,7 +3,7 @@ @@ -461,8 +399,6 @@ index 63679505f7..825ea76ff2 100644 #include #include #include -diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c -index efe407fedb..46a086cdf5 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -6,7 +6,7 @@ @@ -471,11 +407,9 @@ index efe407fedb..46a086cdf5 100644 #include -#include +//#include - + #include "sd-ndisc.h" - -diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c -index 934fed3b7f..fdb89313dd 100644 + --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -1,9 +1,5 @@ @@ -499,8 +433,6 @@ index 934fed3b7f..fdb89313dd 100644 int route_new(Route **ret) { _cleanup_(route_freep) Route *route = NULL; -diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c -index e00cc1e589..e392c7e1a2 100644 --- a/src/network/networkd-setlink.c +++ b/src/network/networkd-setlink.c @@ -2,7 +2,7 @@ @@ -512,8 +444,6 @@ index e00cc1e589..e392c7e1a2 100644 #include #include "missing_network.h" -diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h -index cf20b6dba5..c3a46dda11 100644 --- a/src/shared/linux/ethtool.h +++ b/src/shared/linux/ethtool.h @@ -16,7 +16,8 @@ @@ -526,8 +456,6 @@ index cf20b6dba5..c3a46dda11 100644 #ifndef __KERNEL__ #include /* for INT_MAX */ -diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c -index f56c5646c1..5af28ff119 100644 --- a/src/shared/netif-util.c +++ b/src/shared/netif-util.c @@ -1,7 +1,7 @@ @@ -539,8 +467,6 @@ index f56c5646c1..5af28ff119 100644 #include "arphrd-util.h" #include "device-util.h" -diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c -index f2ea2a7cd5..fe60a0744d 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -18,7 +18,7 @@ diff --git a/poky/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/poky/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch index a19a025559..2a033b134e 100644 --- a/poky/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch +++ b/poky/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch @@ -29,7 +29,7 @@ diff --git a/units/meson.build b/units/meson.build index a9bf28f6d9..11d3644168 100644 --- a/units/meson.build +++ b/units/meson.build -@@ -63,8 +63,7 @@ units = [ +@@ -62,8 +62,7 @@ units = [ ['poweroff.target', '', (with_runlevels ? 'runlevel0.target' : '')], ['printer.target', ''], @@ -64,7 +64,7 @@ diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in index 96f595ad72..7c010bb224 100644 --- a/units/systemd-binfmt.service.in +++ b/units/systemd-binfmt.service.in -@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm +@@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems DefaultDependencies=no Conflicts=shutdown.target diff --git a/poky/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch b/poky/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch new file mode 100644 index 0000000000..c02d495d31 --- /dev/null +++ b/poky/meta/recipes-core/systemd/systemd/0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch @@ -0,0 +1,42 @@ +From 5b5675913e2dbe6c5acda935b5814a8991829ec5 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 8 Nov 2022 13:31:34 -0800 +Subject: [PATCH 2/2] test-bus-error: strerror() is assumed to be GNU specific version mark it so + +Upstream-Status: Inappropriate [Upstream systemd only supports glibc] + +Signed-off-by: Khem Raj +--- + src/libsystemd/sd-bus/test-bus-error.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/src/libsystemd/sd-bus/test-bus-error.c ++++ b/src/libsystemd/sd-bus/test-bus-error.c +@@ -99,7 +99,9 @@ TEST(error) { + assert_se(!sd_bus_error_is_set(&error)); + assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY); + assert_se(streq(error.name, "System.Error.EBUSY")); ++#ifdef __GLIBC__ + assert_se(streq(error.message, STRERROR(EBUSY))); ++#endif + assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY")); + assert_se(sd_bus_error_get_errno(&error) == EBUSY); + assert_se(sd_bus_error_is_set(&error)); +--- a/src/test/test-errno-util.c ++++ b/src/test/test-errno-util.c +@@ -4,7 +4,7 @@ + #include "stdio-util.h" + #include "string-util.h" + #include "tests.h" +- ++#ifdef __GLIBC__ + TEST(strerror_not_threadsafe) { + /* Just check that strerror really is not thread-safe. */ + log_info("strerror(%d) → %s", 200, strerror(200)); +@@ -46,5 +46,6 @@ TEST(STRERROR_OR_ELSE) { + log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM)); + log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM)); + } ++#endif /* __GLIBC__ */ + + DEFINE_TEST_MAIN(LOG_INFO); diff --git a/poky/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch b/poky/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch index 58767c7c35..e6abaadfcb 100644 --- a/poky/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch +++ b/poky/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch @@ -13,11 +13,9 @@ Signed-off-by: Khem Raj src/shared/mkdir-label.c | 1 + 1 file changed, 1 insertion(+) -diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c -index 5b1ac5d1e0..fa5802b894 100644 --- a/src/shared/mkdir-label.c +++ b/src/shared/mkdir-label.c -@@ -6,6 +6,7 @@ +@@ -7,6 +7,7 @@ #include "selinux-util.h" #include "smack-util.h" #include "user-util.h" diff --git a/poky/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/poky/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch index 0c85f2bcbe..f9c7ced947 100644 --- a/poky/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch +++ b/poky/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch @@ -22,11 +22,9 @@ Signed-off-by: Scott Murray create mode 100644 src/basic/parse-printf-format.c create mode 100644 src/basic/parse-printf-format.h -diff --git a/meson.build b/meson.build -index 36cbfa4893..30b5305b89 100644 --- a/meson.build +++ b/meson.build -@@ -694,6 +694,7 @@ endif +@@ -739,6 +739,7 @@ endif foreach header : ['crypt.h', 'linux/memfd.h', 'linux/vm_sockets.h', @@ -34,11 +32,9 @@ index 36cbfa4893..30b5305b89 100644 'sys/auxv.h', 'valgrind/memcheck.h', 'valgrind/valgrind.h', -diff --git a/src/basic/meson.build b/src/basic/meson.build -index 9b89fdcdea..0b1ef91016 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build -@@ -336,6 +336,11 @@ endforeach +@@ -337,6 +337,11 @@ endforeach basic_sources += generated_gperf_headers @@ -50,9 +46,6 @@ index 9b89fdcdea..0b1ef91016 100644 ############################################################ arch_list = [ -diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c -new file mode 100644 -index 0000000000..49437e5445 --- /dev/null +++ b/src/basic/parse-printf-format.c @@ -0,0 +1,273 @@ @@ -329,9 +322,6 @@ index 0000000000..49437e5445 + + return last; +} -diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h -new file mode 100644 -index 0000000000..47be7522d7 --- /dev/null +++ b/src/basic/parse-printf-format.h @@ -0,0 +1,57 @@ @@ -392,8 +382,6 @@ index 0000000000..47be7522d7 +size_t parse_printf_format(const char *fmt, size_t n, int *types); + +#endif /* HAVE_PRINTF_H */ -diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h -index 69d7062ec6..f55c5aab2c 100644 --- a/src/basic/stdio-util.h +++ b/src/basic/stdio-util.h @@ -1,13 +1,13 @@ @@ -409,10 +397,8 @@ index 69d7062ec6..f55c5aab2c 100644 #include "memory-util.h" +#include "parse-printf-format.h" - #define snprintf_ok(buf, len, fmt, ...) \ - ({ \ -diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c -index 1e10ed5524..e6ceba54f9 100644 + #define snprintf_ok(buf, len, fmt, ...) \ + ({ \ --- a/src/libsystemd/sd-journal/journal-send.c +++ b/src/libsystemd/sd-journal/journal-send.c @@ -2,7 +2,6 @@ diff --git a/poky/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/poky/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch index 9e02666698..2c33033e91 100644 --- a/poky/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch +++ b/poky/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch @@ -72,11 +72,9 @@ Signed-off-by: Luca Boccassi src/udev/udev-rules.c | 1 + 52 files changed, 63 insertions(+) -diff --git a/meson.build b/meson.build -index 30b5305b89..0189ef8ce6 100644 --- a/meson.build +++ b/meson.build -@@ -512,6 +512,7 @@ foreach ident : ['secure_getenv', '__secure_getenv'] +@@ -557,6 +557,7 @@ foreach ident : ['secure_getenv', '__sec endforeach foreach ident : [ @@ -84,8 +82,6 @@ index 30b5305b89..0189ef8ce6 100644 ['memfd_create', '''#include '''], ['gettid', '''#include #include '''], -diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c -index a4e5d77f6c..fc12da4c53 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c @@ -20,6 +20,7 @@ @@ -94,10 +90,8 @@ index a4e5d77f6c..fc12da4c53 100644 #include "util.h" +#include "missing_stdlib.h" - static int help(void) { - _cleanup_free_ char *link = NULL; -diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c -index b03cc70e2e..f4615ffce1 100644 + #define PCI_CLASS_GRAPHICS_CARD 0x30000 + --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -37,6 +37,7 @@ @@ -108,8 +102,6 @@ index b03cc70e2e..f4615ffce1 100644 static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) { _cleanup_free_ char *fs = NULL; -diff --git a/src/basic/env-util.c b/src/basic/env-util.c -index 885967e7f3..d0b7dc845e 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -19,6 +19,7 @@ @@ -120,8 +112,6 @@ index 885967e7f3..d0b7dc845e 100644 /* We follow bash for the character set. Different shells have different rules. */ #define VALID_BASH_ENV_NAME_CHARS \ -diff --git a/src/basic/log.c b/src/basic/log.c -index 12071e2ebd..15254c7bbc 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -36,6 +36,7 @@ @@ -132,8 +122,6 @@ index 12071e2ebd..15254c7bbc 100644 #define SNDBUF_SIZE (8*1024*1024) -diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h -index 8c76f93eb2..9068bfb4f0 100644 --- a/src/basic/missing_stdlib.h +++ b/src/basic/missing_stdlib.h @@ -11,3 +11,15 @@ @@ -152,8 +140,6 @@ index 8c76f93eb2..9068bfb4f0 100644 + (char *)memcpy(__new, __old, __len); \ + }) +#endif -diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c -index 51a0d74e87..03569f71f8 100644 --- a/src/basic/mkdir.c +++ b/src/basic/mkdir.c @@ -15,6 +15,7 @@ @@ -164,8 +150,6 @@ index 51a0d74e87..03569f71f8 100644 int mkdir_safe_internal( const char *path, -diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c -index 82a33a6829..d947774b40 100644 --- a/src/basic/mountpoint-util.c +++ b/src/basic/mountpoint-util.c @@ -13,6 +13,7 @@ @@ -176,8 +160,6 @@ index 82a33a6829..d947774b40 100644 #include "mountpoint-util.h" #include "nulstr-util.h" #include "parse-util.h" -diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c -index 2888ab6523..d941afec2d 100644 --- a/src/basic/parse-util.c +++ b/src/basic/parse-util.c @@ -18,6 +18,7 @@ @@ -188,8 +170,6 @@ index 2888ab6523..d941afec2d 100644 int parse_boolean(const char *v) { if (!v) -diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c -index 6fb8c40e7a..c4b59e8518 100644 --- a/src/basic/path-lookup.c +++ b/src/basic/path-lookup.c @@ -16,6 +16,7 @@ @@ -200,8 +180,6 @@ index 6fb8c40e7a..c4b59e8518 100644 int xdg_user_runtime_dir(char **ret, const char *suffix) { const char *e; -diff --git a/src/basic/percent-util.c b/src/basic/percent-util.c -index cab9d0eaea..5f6ca258e9 100644 --- a/src/basic/percent-util.c +++ b/src/basic/percent-util.c @@ -3,6 +3,7 @@ @@ -212,8 +190,6 @@ index cab9d0eaea..5f6ca258e9 100644 static int parse_parts_value_whole(const char *p, const char *symbol) { const char *pc, *n; -diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c -index 410b8a3eb5..f2c4355609 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -15,6 +15,7 @@ @@ -224,8 +200,6 @@ index 410b8a3eb5..f2c4355609 100644 int proc_cmdline(char **ret) { const char *e; -diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c -index 65f96abb06..e485a0196b 100644 --- a/src/basic/procfs-util.c +++ b/src/basic/procfs-util.c @@ -12,6 +12,7 @@ @@ -236,8 +210,6 @@ index 65f96abb06..e485a0196b 100644 int procfs_get_pid_max(uint64_t *ret) { _cleanup_free_ char *value = NULL; -diff --git a/src/basic/time-util.c b/src/basic/time-util.c -index b659d6905d..020112be24 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -26,6 +26,7 @@ @@ -248,8 +220,6 @@ index b659d6905d..020112be24 100644 static clockid_t map_clock_id(clockid_t c) { -diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c -index d9c901d73b..79a035274c 100644 --- a/src/boot/bless-boot.c +++ b/src/boot/bless-boot.c @@ -22,6 +22,7 @@ @@ -260,8 +230,6 @@ index d9c901d73b..79a035274c 100644 static char **arg_path = NULL; -diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c -index f0d8759e85..b4c1053e64 100644 --- a/src/core/dbus-cgroup.c +++ b/src/core/dbus-cgroup.c @@ -21,6 +21,7 @@ @@ -272,8 +240,6 @@ index f0d8759e85..b4c1053e64 100644 #include "socket-util.h" BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve); -diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c -index 5c499e5d06..e7ab1bb9a5 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -44,6 +44,7 @@ @@ -284,8 +250,6 @@ index 5c499e5d06..e7ab1bb9a5 100644 BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput); static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput); -diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c -index 32a2ec0ff9..36be2511e4 100644 --- a/src/core/dbus-util.c +++ b/src/core/dbus-util.c @@ -9,6 +9,7 @@ @@ -296,11 +260,9 @@ index 32a2ec0ff9..36be2511e4 100644 int bus_property_get_triggered_unit( sd_bus *bus, -diff --git a/src/core/execute.c b/src/core/execute.c -index 2762b10287..a8aeec7f6e 100644 --- a/src/core/execute.c +++ b/src/core/execute.c -@@ -103,6 +103,7 @@ +@@ -104,6 +104,7 @@ #include "unit-serialize.h" #include "user-util.h" #include "utmp-wtmp.h" @@ -308,8 +270,6 @@ index 2762b10287..a8aeec7f6e 100644 #define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC) #define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC) -diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c -index f4488dd692..1d331a7ee2 100644 --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -11,6 +11,7 @@ @@ -320,8 +280,6 @@ index f4488dd692..1d331a7ee2 100644 #if HAVE_KMOD #include "module-util.h" -diff --git a/src/core/service.c b/src/core/service.c -index 9f7af9dffb..3ec5e30c8b 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -42,6 +42,7 @@ @@ -331,9 +289,7 @@ index 9f7af9dffb..3ec5e30c8b 100644 +#include "missing_stdlib.h" #define service_spawn(...) service_spawn_internal(__func__, __VA_ARGS__) - -diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c -index c6e201ecf2..ab034475e2 100644 + --- a/src/coredump/coredump-vacuum.c +++ b/src/coredump/coredump-vacuum.c @@ -17,6 +17,7 @@ @@ -344,11 +300,9 @@ index c6e201ecf2..ab034475e2 100644 #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */ #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */ -diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c -index 9b32383a76..f8d3397a06 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c -@@ -29,6 +29,7 @@ +@@ -32,6 +32,7 @@ #include "util.h" #include "virt.h" #include "volatile-util.h" @@ -356,8 +310,6 @@ index 9b32383a76..f8d3397a06 100644 typedef enum MountPointFlags { MOUNT_NOAUTO = 1 << 0, -diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c -index 3e3646e45f..6a8fc60f6d 100644 --- a/src/journal-remote/journal-remote-main.c +++ b/src/journal-remote/journal-remote-main.c @@ -24,6 +24,7 @@ @@ -368,11 +320,9 @@ index 3e3646e45f..6a8fc60f6d 100644 #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem" #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem" -diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c -index cff34fd585..a5003e47e9 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c -@@ -74,6 +74,7 @@ +@@ -70,6 +70,7 @@ #include "unit-name.h" #include "user-util.h" #include "varlink.h" @@ -380,20 +330,16 @@ index cff34fd585..a5003e47e9 100644 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE) #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */ -diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c -index 96529b422b..ddb5e9c698 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c -@@ -20,6 +20,7 @@ +@@ -19,6 +19,7 @@ #include "strv.h" #include "time-util.h" #include "utf8.h" +#include "missing_stdlib.h" static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); - -diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c -index 909dfe4d3a..254b7ce866 100644 + static int message_parse_fields(sd_bus_message *m); --- a/src/libsystemd/sd-bus/bus-objects.c +++ b/src/libsystemd/sd-bus/bus-objects.c @@ -11,6 +11,7 @@ @@ -404,8 +350,6 @@ index 909dfe4d3a..254b7ce866 100644 static int node_vtable_get_userdata( sd_bus *bus, -diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c -index 14951ccb33..b7f86ca501 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -28,6 +28,7 @@ @@ -416,11 +360,9 @@ index 14951ccb33..b7f86ca501 100644 #define SNDBUF_SIZE (8*1024*1024) -diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c -index 9e1d29cc1d..8c3165f0ce 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c -@@ -43,6 +43,7 @@ +@@ -44,6 +44,7 @@ #include "string-util.h" #include "strv.h" #include "user-util.h" @@ -428,8 +370,6 @@ index 9e1d29cc1d..8c3165f0ce 100644 #define log_debug_bus_message(m) \ do { \ -diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c -index 317653bedc..d028216c48 100644 --- a/src/libsystemd/sd-bus/test-bus-benchmark.c +++ b/src/libsystemd/sd-bus/test-bus-benchmark.c @@ -14,6 +14,7 @@ @@ -440,8 +380,6 @@ index 317653bedc..d028216c48 100644 #define MAX_SIZE (2*1024*1024) -diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c -index 7a6cc4aca3..b7f7cd65c5 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -41,6 +41,7 @@ @@ -452,23 +390,9 @@ index 7a6cc4aca3..b7f7cd65c5 100644 #define JOURNAL_FILES_MAX 7168 -diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c -index 10d2ed7aec..4fbe3f6b4a 100644 ---- a/src/locale/keymap-util.c -+++ b/src/locale/keymap-util.c -@@ -24,6 +24,7 @@ - #include "string-util.h" - #include "strv.h" - #include "tmpfile-util.h" -+#include "missing_stdlib.h" - - static bool startswith_comma(const char *s, const char *prefix) { - s = startswith(s, prefix); -diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c -index 5bd7efc3e8..282899601e 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c -@@ -31,6 +31,7 @@ +@@ -32,6 +32,7 @@ #include "locale-util.h" #include "login-util.h" #include "macro.h" @@ -476,8 +400,6 @@ index 5bd7efc3e8..282899601e 100644 #include "pam-util.h" #include "parse-util.h" #include "path-util.h" -diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c -index 063ad08d80..f9823a433b 100644 --- a/src/network/generator/network-generator.c +++ b/src/network/generator/network-generator.c @@ -13,6 +13,7 @@ @@ -488,8 +410,6 @@ index 063ad08d80..f9823a433b 100644 /* # .network -diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c -index 1f58bf3ed4..8457a3b0e3 100644 --- a/src/nspawn/nspawn-settings.c +++ b/src/nspawn/nspawn-settings.c @@ -17,6 +17,7 @@ @@ -500,8 +420,6 @@ index 1f58bf3ed4..8457a3b0e3 100644 Settings *settings_new(void) { Settings *s; -diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c -index c64e79bdff..eda26b0b9a 100644 --- a/src/nss-mymachines/nss-mymachines.c +++ b/src/nss-mymachines/nss-mymachines.c @@ -21,6 +21,7 @@ @@ -512,8 +430,6 @@ index c64e79bdff..eda26b0b9a 100644 static void setup_logging_once(void) { static pthread_once_t once = PTHREAD_ONCE_INIT; -diff --git a/src/portable/portable.c b/src/portable/portable.c -index 0e6461ba93..54148d5924 100644 --- a/src/portable/portable.c +++ b/src/portable/portable.c @@ -39,6 +39,7 @@ @@ -524,20 +440,16 @@ index 0e6461ba93..54148d5924 100644 /* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was * dropped there by the portable service logic and b) for which image it was dropped there. */ -diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c -index 5b3ceeff36..d36d1d57ae 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c -@@ -43,6 +43,7 @@ - #include "utf8.h" +@@ -46,6 +46,7 @@ + #include "varlink.h" #include "verb-log-control.h" #include "verbs.h" +#include "missing_stdlib.h" static int arg_family = AF_UNSPEC; static int arg_ifindex = 0; -diff --git a/src/shared/bus-get-properties.c b/src/shared/bus-get-properties.c -index 8b4f66b22e..5926e4c61b 100644 --- a/src/shared/bus-get-properties.c +++ b/src/shared/bus-get-properties.c @@ -4,6 +4,7 @@ @@ -548,11 +460,9 @@ index 8b4f66b22e..5926e4c61b 100644 int bus_property_get_bool( sd_bus *bus, -diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c -index 87c0334fec..402ab3493b 100644 --- a/src/shared/bus-unit-procs.c +++ b/src/shared/bus-unit-procs.c -@@ -10,6 +10,7 @@ +@@ -11,6 +11,7 @@ #include "sort-util.h" #include "string-util.h" #include "terminal-util.h" @@ -560,8 +470,6 @@ index 87c0334fec..402ab3493b 100644 struct CGroupInfo { char *cgroup_path; -diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c -index dcce530c99..faf5a5bda0 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -49,6 +49,7 @@ @@ -572,8 +480,6 @@ index dcce530c99..faf5a5bda0 100644 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { assert(message); -diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c -index 4a2b7684bc..ee6d687c58 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -21,6 +21,7 @@ @@ -583,12 +489,10 @@ index 4a2b7684bc..ee6d687c58 100644 +#include "missing_stdlib.h" static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { - sd_event *e = userdata; -diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c -index f54b187a1b..299758c7e4 100644 + sd_event *e = ASSERT_PTR(userdata); --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c -@@ -17,6 +17,7 @@ +@@ -18,6 +18,7 @@ #include "string-util.h" #include "strv.h" #include "utf8.h" @@ -596,8 +500,6 @@ index f54b187a1b..299758c7e4 100644 int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) { const char *n; -diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c -index c6caf9330a..ebe33bd44a 100644 --- a/src/shared/journal-importer.c +++ b/src/shared/journal-importer.c @@ -15,6 +15,7 @@ @@ -608,8 +510,6 @@ index c6caf9330a..ebe33bd44a 100644 enum { IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */ -diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c -index cf83eb6bca..e672a003a3 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -42,6 +42,7 @@ @@ -620,8 +520,6 @@ index cf83eb6bca..e672a003a3 100644 /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ #define PRINT_LINE_THRESHOLD 3 -diff --git a/src/shared/pager.c b/src/shared/pager.c -index f75ef62d2d..530001a821 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -26,6 +26,7 @@ @@ -632,20 +530,6 @@ index f75ef62d2d..530001a821 100644 static pid_t pager_pid = 0; -diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c -index 1b4396a34c..c2f72b185f 100644 ---- a/src/shared/uid-range.c -+++ b/src/shared/uid-range.c -@@ -14,6 +14,7 @@ - #include "stat-util.h" - #include "uid-range.h" - #include "user-util.h" -+#include "missing_stdlib.h" - - static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { - assert(range); -diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c -index 7e9ab19666..56f619e54e 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -26,6 +26,7 @@ @@ -656,8 +540,6 @@ index 7e9ab19666..56f619e54e 100644 #define BUFFER_SIZE (256 * 1024) -diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c -index cc9a7cb838..a679614a47 100644 --- a/src/test/test-hexdecoct.c +++ b/src/test/test-hexdecoct.c @@ -7,6 +7,7 @@ @@ -668,8 +550,6 @@ index cc9a7cb838..a679614a47 100644 #include "tests.h" TEST(hexchar) { -diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c -index ae92e45205..1e6f3205cb 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c @@ -22,6 +22,7 @@ @@ -680,11 +560,9 @@ index ae92e45205..1e6f3205cb 100644 _printf_(2,3) static void path_prepend(char **path, const char *fmt, ...) { -diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c -index a60e4f294c..571c43765b 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c -@@ -35,6 +35,7 @@ +@@ -34,6 +34,7 @@ #include "udev-util.h" #include "udev-watch.h" #include "user-util.h" @@ -692,8 +570,6 @@ index a60e4f294c..571c43765b 100644 typedef struct Spawn { sd_device *device; -diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c -index 1a384d6b38..0089833e3f 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -34,6 +34,7 @@ diff --git a/poky/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/poky/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch index eeaaac1b9a..2a5770c515 100644 --- a/poky/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch +++ b/poky/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch @@ -23,8 +23,6 @@ Signed-off-by: Scott Murray src/tmpfiles/tmpfiles.c | 10 ++++++++++ 3 files changed, 38 insertions(+) -diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c -index e026b29478..815e56ef68 100644 --- a/src/basic/glob-util.c +++ b/src/basic/glob-util.c @@ -12,6 +12,12 @@ @@ -48,7 +46,7 @@ index e026b29478..815e56ef68 100644 /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */ assert(!(flags & GLOB_ALTDIRFUNC)); -@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { +@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag pglob->gl_lstat = lstat; if (!pglob->gl_stat) pglob->gl_stat = stat; @@ -63,13 +61,11 @@ index e026b29478..815e56ef68 100644 if (k == GLOB_NOMATCH) return -ENOENT; if (k == GLOB_NOSPACE) -diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c -index ec8b74f48f..d99a6095df 100644 --- a/src/test/test-glob-util.c +++ b/src/test/test-glob-util.c -@@ -13,6 +13,12 @@ - #include "tests.h" - #include "tmpfile-util.h" +@@ -34,6 +34,12 @@ TEST(glob_first) { + assert_se(first == NULL); + } +/* Don't fail if the standard library + * doesn't provide brace expansion */ @@ -80,7 +76,7 @@ index ec8b74f48f..d99a6095df 100644 TEST(glob_exists) { char name[] = "/tmp/test-glob_exists.XXXXXX"; int fd = -1; -@@ -40,11 +46,13 @@ TEST(glob_no_dot) { +@@ -61,11 +67,13 @@ TEST(glob_no_dot) { const char *fn; _cleanup_globfree_ glob_t g = { @@ -94,7 +90,7 @@ index ec8b74f48f..d99a6095df 100644 }; int r; -@@ -52,11 +60,19 @@ TEST(glob_no_dot) { +@@ -73,11 +81,19 @@ TEST(glob_no_dot) { assert_se(mkdtemp(template)); fn = strjoina(template, "/*"); @@ -114,13 +110,11 @@ index ec8b74f48f..d99a6095df 100644 assert_se(r == GLOB_NOMATCH); (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); -diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c -index fcab51c208..fdef1807ae 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c -@@ -67,6 +67,12 @@ - #include "umask-util.h" +@@ -71,6 +71,12 @@ #include "user-util.h" + #include "virt.h" +/* Don't fail if the standard library + * doesn't provide brace expansion */ @@ -131,7 +125,7 @@ index fcab51c208..fdef1807ae 100644 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates * them in the file system. This is intended to be used to create * properly owned directories beneath /tmp, /var/tmp, /run, which are -@@ -1934,7 +1940,9 @@ finish: +@@ -2174,7 +2180,9 @@ finish: static int glob_item(Item *i, action_t action) { _cleanup_globfree_ glob_t g = { @@ -140,8 +134,8 @@ index fcab51c208..fdef1807ae 100644 +#endif }; int r = 0, k; - -@@ -1953,7 +1961,9 @@ static int glob_item(Item *i, action_t action) { + +@@ -2194,7 +2202,9 @@ static int glob_item(Item *i, action_t a static int glob_item_recursively(Item *i, fdaction_t action) { _cleanup_globfree_ glob_t g = { @@ -150,3 +144,4 @@ index fcab51c208..fdef1807ae 100644 +#endif }; int r = 0, k; + diff --git a/poky/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/poky/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch index 3a47d09e8a..aac4ad49d7 100644 --- a/poky/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch +++ b/poky/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch @@ -27,11 +27,9 @@ Signed-off-by: Chen Qi src/core/execute.c | 4 ++-- 3 files changed, 9 insertions(+), 15 deletions(-) -diff --git a/src/basic/format-util.h b/src/basic/format-util.h -index 8719df3e29..9becc96066 100644 --- a/src/basic/format-util.h +++ b/src/basic/format-util.h -@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t)); +@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32 # error Unknown timex member size #endif @@ -46,11 +44,9 @@ index 8719df3e29..9becc96066 100644 #if SIZEOF_DEV_T == 8 # define DEV_FMT "%" PRIu64 -diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c -index 33dfde9d6c..e018fd81fd 100644 --- a/src/basic/rlimit-util.c +++ b/src/basic/rlimit-util.c -@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) { +@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, cons fixed.rlim_max == highest.rlim_max) return 0; @@ -59,7 +55,7 @@ index 33dfde9d6c..e018fd81fd 100644 return RET_NERRNO(setrlimit(resource, &fixed)); } -@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { +@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *r if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) r = free_and_strdup(&s, "infinity"); else if (rl->rlim_cur >= RLIM_INFINITY) @@ -86,11 +82,9 @@ index 33dfde9d6c..e018fd81fd 100644 return 1; } -diff --git a/src/core/execute.c b/src/core/execute.c -index fccfb9268c..90f00e10a5 100644 --- a/src/core/execute.c +++ b/src/core/execute.c -@@ -5633,9 +5633,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { +@@ -5869,9 +5869,9 @@ void exec_context_dump(const ExecContext for (unsigned i = 0; i < RLIM_NLIMITS; i++) if (c->rlimit[i]) { fprintf(f, "%sLimit%s: " RLIM_FMT "\n", diff --git a/poky/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/poky/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch index e1a2512ec3..6367adce07 100644 --- a/poky/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch +++ b/poky/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch @@ -31,11 +31,9 @@ Signed-off-by: Andre McCurdy src/shared/base-filesystem.c | 6 +++--- 2 files changed, 23 insertions(+), 4 deletions(-) -diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h -index 0bbb3f6298..3dc494dbfb 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h -@@ -46,8 +46,27 @@ int futimens_opath(int fd, const struct timespec ts[2]); +@@ -47,8 +47,27 @@ int futimens_opath(int fd, const struct int fd_warn_permissions(const char *path, int fd); int stat_warn_permissions(const char *path, const struct stat *st); @@ -63,12 +61,10 @@ index 0bbb3f6298..3dc494dbfb 100644 + RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0)) int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); - int touch(const char *path); -diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c -index 6dacc1d20a..909a6818f6 100644 + --- a/src/shared/base-filesystem.c +++ b/src/shared/base-filesystem.c -@@ -131,7 +131,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -131,7 +131,7 @@ int base_filesystem_create(const char *r return log_error_errno(errno, "Failed to open root file system: %m"); for (size_t i = 0; i < ELEMENTSOF(table); i++) { @@ -77,7 +73,7 @@ index 6dacc1d20a..909a6818f6 100644 continue; if (table[i].target) { -@@ -139,7 +139,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -139,7 +139,7 @@ int base_filesystem_create(const char *r /* check if one of the targets exists */ NULSTR_FOREACH(s, table[i].target) { @@ -86,7 +82,7 @@ index 6dacc1d20a..909a6818f6 100644 continue; /* check if a specific file exists at the target path */ -@@ -150,7 +150,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -150,7 +150,7 @@ int base_filesystem_create(const char *r if (!p) return log_oom(); diff --git a/poky/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/poky/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch index 7b22d6214f..3228f1716b 100644 --- a/poky/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch +++ b/poky/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch @@ -14,13 +14,11 @@ Signed-off-by: Khem Raj src/machine/machine-dbus.c | 5 +++++ 1 file changed, 5 insertions(+) -diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c -index 8f11afd65b..a2b57deb7a 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c -@@ -10,6 +10,11 @@ - #include - #undef basename +@@ -4,6 +4,11 @@ + #include + #include +#if !defined(__GLIBC__) +#include diff --git a/poky/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/poky/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch index e5e592a837..da56d8b4b6 100644 --- a/poky/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +++ b/poky/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch @@ -24,11 +24,9 @@ Signed-off-by: Scott Murray src/basic/process-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/src/basic/process-util.c b/src/basic/process-util.c -index 6980e0c4f6..45ec26ea45 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c -@@ -1460,7 +1460,7 @@ int set_oom_score_adjust(int value) { +@@ -1466,7 +1466,7 @@ int set_oom_score_adjust(int value) { xsprintf(t, "%i", value); return write_string_file("/proc/self/oom_score_adj", t, diff --git a/poky/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/poky/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch index c563982607..7533fde1e1 100644 --- a/poky/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +++ b/poky/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch @@ -24,11 +24,9 @@ Signed-off-by: Chen Qi src/libsystemd/sd-journal/journal-send.c | 5 +++++ 2 files changed, 10 insertions(+) -diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c -index bdfa145ab7..61928f4bf3 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c -@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { +@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_er return; errno = 0; @@ -41,11 +39,23 @@ index bdfa145ab7..61928f4bf3 100644 if (errno == ERANGE || strlen(x) >= k - 1) { free(m); k *= 2; -diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c -index e6ceba54f9..285ebbc9ef 100644 +@@ -594,8 +599,12 @@ const char* _bus_error_message(const sd_ + + if (e && e->message) + return e->message; +- ++#ifndef __GLIBC__ ++ strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++ return buf; ++#else + return strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++#endif + } + + static bool map_ok(const sd_bus_error_map *map) { --- a/src/libsystemd/sd-journal/journal-send.c +++ b/src/libsystemd/sd-journal/journal-send.c -@@ -370,7 +370,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove +@@ -381,7 +381,12 @@ static int fill_iovec_perror_and_send(co char* j; errno = 0; diff --git a/poky/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/poky/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch index 00131de7d0..6edab0dfe2 100644 --- a/poky/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch +++ b/poky/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch @@ -43,11 +43,9 @@ Signed-off-by: Scott Murray src/vconsole/vconsole-setup.c | 2 +- 21 files changed, 39 insertions(+), 40 deletions(-) -diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c -index f4615ffce1..07cb8ed669 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c -@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *controller, const char *path) { +@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *c if (r < 0) return r; @@ -56,7 +54,7 @@ index f4615ffce1..07cb8ed669 100644 if (r < 0) return r; -@@ -805,7 +805,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { +@@ -805,7 +805,7 @@ int cg_install_release_agent(const char sc = strstrip(contents); if (isempty(sc)) { @@ -65,7 +63,7 @@ index f4615ffce1..07cb8ed669 100644 if (r < 0) return r; } else if (!path_equal(sc, agent)) -@@ -823,7 +823,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { +@@ -823,7 +823,7 @@ int cg_install_release_agent(const char sc = strstrip(contents); if (streq(sc, "0")) { @@ -74,7 +72,7 @@ index f4615ffce1..07cb8ed669 100644 if (r < 0) return r; -@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const char *controller) { +@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const cha if (r < 0) return r; @@ -83,7 +81,7 @@ index f4615ffce1..07cb8ed669 100644 if (r < 0) return r; -@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const char *controller) { +@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const cha if (r < 0) return r; @@ -92,7 +90,7 @@ index f4615ffce1..07cb8ed669 100644 if (r < 0) return r; -@@ -1730,7 +1730,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri +@@ -1730,7 +1730,7 @@ int cg_set_attribute(const char *control if (r < 0) return r; @@ -101,11 +99,9 @@ index f4615ffce1..07cb8ed669 100644 } int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { -diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c -index b9120a5ed0..78e460b75f 100644 --- a/src/basic/namespace-util.c +++ b/src/basic/namespace-util.c -@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) { +@@ -220,12 +220,12 @@ int userns_acquire(const char *uid_map, freeze(); xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); @@ -120,11 +116,9 @@ index b9120a5ed0..78e460b75f 100644 if (r < 0) return log_error_errno(r, "Failed to write GID map: %m"); -diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c -index e485a0196b..8bff210356 100644 --- a/src/basic/procfs-util.c +++ b/src/basic/procfs-util.c -@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limit) { +@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi * decrease it, as threads-max is the much more relevant sysctl. */ if (limit > pid_max-1) { sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ @@ -140,11 +134,9 @@ index e485a0196b..8bff210356 100644 if (r < 0) { uint64_t threads_max; -diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c -index b66a6622ae..8d1c93008a 100644 --- a/src/basic/sysctl-util.c +++ b/src/basic/sysctl-util.c -@@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) { +@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c log_debug("Setting '%s' to '%s'", p, value); @@ -153,11 +145,9 @@ index b66a6622ae..8d1c93008a 100644 } int sysctl_writef(const char *property, const char *format, ...) { -diff --git a/src/basic/util.c b/src/basic/util.c -index d7ef382737..31c35118d1 100644 --- a/src/basic/util.c +++ b/src/basic/util.c -@@ -168,7 +168,7 @@ void disable_coredumps(void) { +@@ -134,7 +134,7 @@ void disable_coredumps(void) { if (detect_container() > 0) return; @@ -166,8 +156,6 @@ index d7ef382737..31c35118d1 100644 if (r < 0) log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); } -diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c -index 18231c2618..6c598d55c8 100644 --- a/src/binfmt/binfmt.c +++ b/src/binfmt/binfmt.c @@ -29,7 +29,7 @@ static bool arg_unregister = false; @@ -179,7 +167,7 @@ index 18231c2618..6c598d55c8 100644 } static int apply_rule(const char *filename, unsigned line, const char *rule) { -@@ -59,7 +59,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) { +@@ -59,7 +59,7 @@ static int apply_rule(const char *filena if (r >= 0) log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename); @@ -197,24 +185,20 @@ index 18231c2618..6c598d55c8 100644 if (r < 0) log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m"); else -diff --git a/src/core/cgroup.c b/src/core/cgroup.c -index 9282b1ff20..7781e0f8eb 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c -@@ -4182,7 +4182,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { - else - u->freezer_state = FREEZER_THAWING; +@@ -4210,7 +4210,7 @@ int unit_cgroup_freezer_action(Unit *u, + u->freezer_state = FREEZER_THAWING; + } - r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0); if (r < 0) return r; -diff --git a/src/core/main.c b/src/core/main.c -index 409b84a006..b1631e57ce 100644 --- a/src/core/main.c +++ b/src/core/main.c -@@ -1374,7 +1374,7 @@ static int bump_unix_max_dgram_qlen(void) { +@@ -1404,7 +1404,7 @@ static int bump_unix_max_dgram_qlen(void if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) return 0; @@ -223,7 +207,7 @@ index 409b84a006..b1631e57ce 100644 "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); if (r < 0) return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, -@@ -1646,7 +1646,7 @@ static void initialize_core_pattern(bool skip_setup) { +@@ -1676,7 +1676,7 @@ static void initialize_core_pattern(bool if (getpid_cached() != 1) return; @@ -232,11 +216,9 @@ index 409b84a006..b1631e57ce 100644 if (r < 0) log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); -diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c -index f88cb80834..68055fb64a 100644 --- a/src/core/smack-setup.c +++ b/src/core/smack-setup.c -@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy) { +@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy) } #if HAVE_SMACK_RUN_LABEL @@ -258,8 +240,6 @@ index f88cb80834..68055fb64a 100644 if (r < 0) log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); #endif -diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c -index 1c7d9179d8..3ae78ee580 100644 --- a/src/hibernate-resume/hibernate-resume.c +++ b/src/hibernate-resume/hibernate-resume.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { @@ -271,24 +251,20 @@ index 1c7d9179d8..3ae78ee580 100644 if (r < 0) { log_error_errno(r, "Failed to write '" DEVNUM_FORMAT_STR "' to /sys/power/resume: %m", DEVNUM_FORMAT_VAL(st.st_rdev)); return EXIT_FAILURE; -diff --git a/src/home/homework.c b/src/home/homework.c -index 0014a7f598..ec3e9caa1c 100644 --- a/src/home/homework.c +++ b/src/home/homework.c @@ -278,7 +278,7 @@ static void drop_caches_now(void) { - * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not - * more. */ + * for details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but + * not more. */ - r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0); if (r < 0) log_warning_errno(r, "Failed to drop caches, ignoring: %m"); else -diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c -index aaf951ced8..45a9d70f0d 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c -@@ -2215,7 +2215,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, +@@ -2444,7 +2444,7 @@ _public_ int sd_device_set_sysattr_value if (!value) return -ENOMEM; @@ -297,11 +273,9 @@ index aaf951ced8..45a9d70f0d 100644 if (r < 0) { /* On failure, clear cache entry, as we do not know how it fails. */ device_remove_cached_sysattr_value(device, sysattr); -diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c -index 9e6379ae7b..546a03a7f5 100644 --- a/src/nspawn/nspawn-cgroup.c +++ b/src/nspawn/nspawn-cgroup.c -@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { +@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified fn = strjoina(tree, cgroup, "/cgroup.procs"); sprintf(pid_string, PID_FMT, pid); @@ -310,11 +284,9 @@ index 9e6379ae7b..546a03a7f5 100644 if (r < 0) { log_error_errno(r, "Failed to move process: %m"); goto finish; -diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index c5fd978395..fefe8a21e5 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c -@@ -2759,7 +2759,7 @@ static int reset_audit_loginuid(void) { +@@ -2762,7 +2762,7 @@ static int reset_audit_loginuid(void) { if (streq(p, "4294967295")) return 0; @@ -341,8 +313,6 @@ index c5fd978395..fefe8a21e5 100644 if (r < 0) return log_error_errno(r, "Failed to write GID map: %m"); -diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c -index 724d7f27d9..dd725cff92 100644 --- a/src/shared/binfmt-util.c +++ b/src/shared/binfmt-util.c @@ -26,7 +26,7 @@ int disable_binfmt(void) { @@ -354,11 +324,9 @@ index 724d7f27d9..dd725cff92 100644 if (r < 0) return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m"); -diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c -index a1fabc73c1..c5c8fc417e 100644 --- a/src/shared/cgroup-setup.c +++ b/src/shared/cgroup-setup.c -@@ -344,7 +344,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { +@@ -350,7 +350,7 @@ int cg_attach(const char *controller, co xsprintf(c, PID_FMT "\n", pid); @@ -367,7 +335,7 @@ index a1fabc73c1..c5c8fc417e 100644 if (r == -EOPNOTSUPP && cg_is_threaded(controller, path) > 0) /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */ return -EUCLEAN; -@@ -879,7 +879,7 @@ int cg_enable_everywhere( +@@ -887,7 +887,7 @@ int cg_enable_everywhere( return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); } @@ -376,22 +344,18 @@ index a1fabc73c1..c5c8fc417e 100644 if (r < 0) { log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); -diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c -index a0b648bf79..13f921390d 100644 --- a/src/shared/coredump-util.c +++ b/src/shared/coredump-util.c -@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value) { +@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value) sprintf(t, "0x%"PRIx64, value); return write_string_file("/proc/self/coredump_filter", t, - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); + WRITE_STRING_FILE_VERIFY_ON_FAILURE); } -diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c -index 0df1778cb2..3b9a0c934e 100644 --- a/src/shared/smack-util.c +++ b/src/shared/smack-util.c -@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { +@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const return 0; p = procfs_file_alloca(pid, "attr/current"); @@ -400,11 +364,9 @@ index 0df1778cb2..3b9a0c934e 100644 if (r < 0) return r; -diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c -index 7064f3a905..8f2a7d9da2 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c -@@ -46,7 +46,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca +@@ -50,7 +50,7 @@ static int write_hibernate_location_info assert(hibernate_location->swap); xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno)); @@ -413,7 +375,7 @@ index 7064f3a905..8f2a7d9da2 100644 if (r < 0) return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m", hibernate_location->swap->device, resume_str); -@@ -73,7 +73,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca +@@ -77,7 +77,7 @@ static int write_hibernate_location_info } xsprintf(offset_str, "%" PRIu64, hibernate_location->offset); @@ -422,7 +384,7 @@ index 7064f3a905..8f2a7d9da2 100644 if (r < 0) return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m", hibernate_location->swap->device, offset_str); -@@ -89,7 +89,7 @@ static int write_mode(char **modes) { +@@ -93,7 +93,7 @@ static int write_mode(char **modes) { STRV_FOREACH(mode, modes) { int k; @@ -431,7 +393,7 @@ index 7064f3a905..8f2a7d9da2 100644 if (k >= 0) return 0; -@@ -110,7 +110,7 @@ static int write_state(FILE **f, char **states) { +@@ -114,7 +114,7 @@ static int write_state(FILE **f, char ** STRV_FOREACH(state, states) { int k; @@ -440,11 +402,9 @@ index 7064f3a905..8f2a7d9da2 100644 if (k >= 0) return 0; log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); -diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c -index cd858c9cca..0feb9669a0 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c -@@ -2335,7 +2335,6 @@ static int udev_rule_apply_token_to_event( +@@ -2354,7 +2354,6 @@ static int udev_rule_apply_token_to_even log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value); r = write_string_file(buf, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | @@ -452,11 +412,9 @@ index cd858c9cca..0feb9669a0 100644 WRITE_STRING_FILE_AVOID_NEWLINE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); if (r < 0) -diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c -index 50930d4af3..5efd5d3728 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c -@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { +@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na static int toggle_utf8_sysfs(bool utf8) { int r; diff --git a/poky/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/poky/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch index 2c56838644..45778541c3 100644 --- a/poky/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch +++ b/poky/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch @@ -17,8 +17,6 @@ Signed-off-by: Luca Boccassi src/shared/userdb.c | 7 ++++++- 3 files changed, 30 insertions(+), 1 deletion(-) -diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c -index 88b8fc2f8f..a819d41bac 100644 --- a/src/shared/user-record-nss.c +++ b/src/shared/user-record-nss.c @@ -331,8 +331,10 @@ int nss_group_to_group_record( @@ -48,7 +46,7 @@ index 88b8fc2f8f..a819d41bac 100644 r = json_build(&g->json, JSON_BUILD_OBJECT( JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), -@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re +@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct grou assert(ret_sgrp); assert(ret_buffer); @@ -56,7 +54,7 @@ index 88b8fc2f8f..a819d41bac 100644 for (;;) { _cleanup_free_ char *buf = NULL; struct sgrp sgrp, *result; -@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re +@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct grou buflen *= 2; buf = mfree(buf); } @@ -122,8 +120,6 @@ index 88b8fc2f8f..a819d41bac 100644 if (r < 0) return r; -diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h -index 22ab04d6ee..4e52e7a911 100644 --- a/src/shared/user-record-nss.h +++ b/src/shared/user-record-nss.h @@ -2,7 +2,11 @@ @@ -138,11 +134,9 @@ index 22ab04d6ee..4e52e7a911 100644 #include #include -diff --git a/src/shared/userdb.c b/src/shared/userdb.c -index 0eddd382e6..d506b8e263 100644 --- a/src/shared/userdb.c +++ b/src/shared/userdb.c -@@ -1046,13 +1046,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { +@@ -1044,13 +1044,15 @@ int groupdb_iterator_get(UserDBIterator if (gr) { _cleanup_free_ char *buffer = NULL; bool incomplete = false; @@ -159,7 +153,7 @@ index 0eddd382e6..d506b8e263 100644 if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) { r = nss_sgrp_for_group(gr, &sgrp, &buffer); if (r < 0) { -@@ -1065,6 +1067,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { +@@ -1063,6 +1065,9 @@ int groupdb_iterator_get(UserDBIterator } r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); diff --git a/poky/meta/recipes-core/systemd/systemd_251.8.bb b/poky/meta/recipes-core/systemd/systemd_251.8.bb deleted file mode 100644 index 5fb0e86982..0000000000 --- a/poky/meta/recipes-core/systemd/systemd_251.8.bb +++ /dev/null @@ -1,801 +0,0 @@ -require systemd.inc - -PROVIDES = "udev" - -PE = "1" - -DEPENDS = "intltool-native gperf-native libcap util-linux python3-jinja2-native" - -SECTION = "base/shell" - -inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check - -# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so -# that we don't build both udev and systemd in world builds. -REQUIRED_DISTRO_FEATURES = "systemd" - -SRC_URI += " \ - file://touchscreen.rules \ - file://00-create-volatile.conf \ - ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \ - file://init \ - file://99-default.preset \ - file://systemd-pager.sh \ - file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ - file://0003-implment-systemd-sysv-install-for-OE.patch \ - file://0001-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \ - " - -# patches needed by musl -SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}" -SRC_URI_MUSL = "\ - file://0003-missing_type.h-add-comparison_fn_t.patch \ - file://0004-add-fallback-parse_printf_format-implementation.patch \ - file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ - file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ - file://0008-add-missing-FTW_-macros-for-musl.patch \ - file://0010-Use-uintmax_t-for-handling-rlim_t.patch \ - file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ - file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ - file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ - file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ - file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ - file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \ - file://0022-do-not-disable-buffer-in-writing-files.patch \ - file://0025-Handle-__cpu_mask-usage.patch \ - file://0026-Handle-missing-gshadow.patch \ - file://0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \ - file://0001-pass-correct-parameters-to-getdents64.patch \ - file://0002-Add-sys-stat.h-for-S_IFDIR.patch \ - file://0001-Adjust-for-musl-headers.patch \ - " - -PAM_PLUGINS = " \ - pam-plugin-unix \ - pam-plugin-loginuid \ - pam-plugin-keyinit \ -" - -PACKAGECONFIG ??= " \ - ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \ - backlight \ - binfmt \ - gshadow \ - hibernate \ - hostnamed \ - idn \ - ima \ - kmod \ - localed \ - logind \ - machined \ - myhostname \ - networkd \ - nss \ - nss-mymachines \ - nss-resolve \ - quotacheck \ - randomseed \ - resolved \ - set-time-epoch \ - sysusers \ - sysvinit \ - timedated \ - timesyncd \ - userdb \ - utmp \ - vconsole \ - wheel-group \ - zstd \ -" - -PACKAGECONFIG:remove:libc-musl = " \ - gshadow \ - idn \ - localed \ - myhostname \ - nss \ - nss-mymachines \ - nss-resolve \ - sysusers \ - userdb \ - utmp \ -" - -# https://github.com/seccomp/libseccomp/issues/347 -PACKAGECONFIG:remove:mipsarch = "seccomp" - -CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 " - -# Some of the dependencies are weak-style recommends - if not available at runtime, -# systemd won't fail but the library-related feature will be skipped with a warning. - -# Use the upstream systemd serial-getty@.service and rely on -# systemd-getty-generator instead of using the OE-core specific -# systemd-serialgetty.bb - not enabled by default. -PACKAGECONFIG[serial-getty-generator] = "" - -PACKAGECONFIG[acl] = "-Dacl=true,-Dacl=false,acl" -PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit" -PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false" -PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false" -PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2" -PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid" -PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false" -PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup" -PACKAGECONFIG[tpm2] = "-Dtpm2=true,-Dtpm2=false,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device" -PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus" -PACKAGECONFIG[efi] = "-Defi=true,-Defi=false" -PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi" -PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils" -PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false" -PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false" -PACKAGECONFIG[homed] = "-Dhomed=true,-Dhomed=false" -# Sign the journal for anti-tampering -PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt" -PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" -PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false" -PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false" -PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false" -PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" -PACKAGECONFIG[ima] = "-Dima=true,-Dima=false" -# importd requires journal-upload/xz/zlib/bzip2/gcrypt -PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false" -# Update NAT firewall rules -PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables" -PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl" -PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod" -PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig" -PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn" -PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2" -# Link udev shared with systemd helper library. -# If enabled the udev package depends on the systemd package (which has the needed shared library). -PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false" -PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false" -PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false" -PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4" -PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false" -PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" -PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd" -PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname" -PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false" -PACKAGECONFIG[no-dns-fallback] = "-Ddns-servers=" -PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false" -PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false" -PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false" -PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false" -PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl" -PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}" -PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2" -PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false" -# If polkit is disabled and networkd+hostnamed are in use, enabling this option and -# using dbus-broker will allow networkd to be authorized to change the -# hostname without acquiring additional privileges -PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit" -PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false" -PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode" -PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false" -PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false" -PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false" -PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false" -PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" -PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell" -PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false" -PACKAGECONFIG[sysext] = "-Dsysext=true, -Dsysext=false" -PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" -PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d" -# When enabled use reproducble build timestamp if set as time epoch, -# or build time if not. When disabled, time epoch is unset. -def build_epoch(d): - epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1" - return '-Dtime-epoch=%d' % int(epoch) -PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0" -PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false" -PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false" -PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true" -PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true" -PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false" -PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false" -PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind" -PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup" -PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false" -PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false" -# Verify keymaps on locale change -PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon" -PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz" -PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib" -PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd" - -# Helper variables to clarify locations. This mirrors the logic in systemd's -# build system. -rootprefix ?= "${root_prefix}" -rootlibdir ?= "${base_libdir}" -rootlibexecdir = "${rootprefix}/lib" - -EXTRA_OEMESON += "-Dnobody-user=nobody \ - -Dnobody-group=nobody \ - -Drootlibdir=${rootlibdir} \ - -Drootprefix=${rootprefix} \ - -Ddefault-locale=C \ - -Dmode=release \ - -Dsystem-alloc-uid-min=101 \ - -Dsystem-uid-max=999 \ - -Dsystem-alloc-gid-min=101 \ - -Dsystem-gid-max=999 \ - " - -# Hardcode target binary paths to avoid using paths from sysroot -EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \ - -Dkmod-path=${base_bindir}/kmod \ - -Dmount-path=${base_bindir}/mount \ - -Dquotacheck-path=${sbindir}/quotacheck \ - -Dquotaon-path=${sbindir}/quotaon \ - -Dsulogin-path=${base_sbindir}/sulogin \ - -Dnologin-path=${base_sbindir}/nologin \ - -Dumount-path=${base_bindir}/umount" - -# The 60 seconds is watchdog's default vaule. -WATCHDOG_TIMEOUT ??= "60" - -do_install() { - meson_do_install - install -d ${D}/${base_sbindir} - if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then - # Provided by a separate recipe - rm ${D}${systemd_system_unitdir}/serial-getty* -f - fi - - # Provide support for initramfs - [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init - [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd - - install -d ${D}${sysconfdir}/udev/rules.d/ - install -d ${D}${sysconfdir}/tmpfiles.d - for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do - install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/ - done - - install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ - - if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd - sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd - install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install - fi - - if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then - # /var/log is typically a symbolic link to inside /var/volatile, - # which is expected to be empty. - rm -rf ${D}${localstatedir}/log - else - chown root:systemd-journal ${D}${localstatedir}/log/journal - - # journal-remote creates this at start - rm -rf ${D}${localstatedir}/log/journal/remote - fi - - install -d ${D}${systemd_system_unitdir}/graphical.target.wants - install -d ${D}${systemd_system_unitdir}/multi-user.target.wants - install -d ${D}${systemd_system_unitdir}/poweroff.target.wants - install -d ${D}${systemd_system_unitdir}/reboot.target.wants - install -d ${D}${systemd_system_unitdir}/rescue.target.wants - - # Create symlinks for systemd-update-utmp-runlevel.service - if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service - fi - - # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it - # for existence else it fails - if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ] && - ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', d)}; then - echo 'd /run/systemd/netif/links 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf - fi - if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then - echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf - echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf - echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf - ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd - else - sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf - ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd - fi - if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then - rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf - rm -r ${D}${sysconfdir}/X11 - fi - - # If polkit is setup fixup permissions and ownership - if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then - if [ -d ${D}${datadir}/polkit-1/rules.d ]; then - chmod 700 ${D}${datadir}/polkit-1/rules.d - chown polkitd:root ${D}${datadir}/polkit-1/rules.d - fi - fi - - # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to - # request hostname changes via DBUS without elevating its privileges - if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then - install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ - install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ - install -d ${D}${datadir}/dbus-1/system.d/ - install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/ - fi - - # create link for existing udev rules - ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm - - # install default policy for presets - # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto - install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset - - # add a profile fragment to disable systemd pager with busybox less - install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh - - if [ -n "${WATCHDOG_TIMEOUT}" ]; then - sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \ - ${D}/${sysconfdir}/systemd/system.conf - fi -} - -python populate_packages:prepend (){ - systemdlibdir = d.getVar("rootlibdir") - do_split_packages(d, systemdlibdir, r'^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) -} -PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*" - -PACKAGE_BEFORE_PN = "\ - ${PN}-gui \ - ${PN}-vconsole-setup \ - ${PN}-initramfs \ - ${PN}-analyze \ - ${PN}-kernel-install \ - ${PN}-rpm-macros \ - ${PN}-binfmt \ - ${PN}-zsh-completion \ - ${PN}-container \ - ${PN}-journal-gatewayd \ - ${PN}-journal-upload \ - ${PN}-journal-remote \ - ${PN}-extra-utils \ - ${PN}-udev-rules \ - libsystemd-shared \ - udev \ - udev-hwdb \ -" - -SUMMARY:${PN}-container = "Tools for containers and VMs" -DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." - -SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events" -DESCRIPTION:${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default." - -SUMMARY:${PN}-journal-upload = "Send journal messages over the network" -DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." - -SUMMARY:${PN}-journal-remote = "Receive journal messages over the network" -DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." - -SUMMARY:libsystemd-shared = "Systemd shared library" - -SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ -" -SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service" - -USERADD_PACKAGES = "${PN} ${PN}-extra-utils \ - udev \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ -" -GROUPADD_PARAM:${PN} = "-r systemd-journal;" -GROUPADD_PARAM:udev = "-r render" -GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}" -USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}" -USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}" -USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" -USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}" -USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}" -USERADD_PARAM:${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy" -USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway" -USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote" -USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload" - -FILES:${PN}-analyze = "${bindir}/systemd-analyze" - -FILES:${PN}-initramfs = "/init" -RDEPENDS:${PN}-initramfs = "${PN}" - -FILES:${PN}-gui = "${bindir}/systemadm" - -FILES:${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ - ${systemd_system_unitdir}/systemd-vconsole-setup.service \ - ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service" - -RDEPENDS:${PN}-kernel-install += "bash" -FILES:${PN}-kernel-install = "${bindir}/kernel-install \ - ${sysconfdir}/kernel/ \ - ${exec_prefix}/lib/kernel \ - " -FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ - " - -FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions" - -FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ - ${exec_prefix}/lib/binfmt.d \ - ${rootlibexecdir}/systemd/systemd-binfmt \ - ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \ - ${systemd_system_unitdir}/systemd-binfmt.service" -RRECOMMENDS:${PN}-binfmt = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', 'kernel-module-binfmt-misc', '', d)}" - -RRECOMMENDS:${PN}-vconsole-setup = "${@bb.utils.contains('PACKAGECONFIG', 'vconsole', 'kbd kbd-consolefonts kbd-keymaps', '', d)}" - - -FILES:${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ - ${systemd_system_unitdir}/systemd-journal-gatewayd.service \ - ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \ - ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \ - ${datadir}/systemd/gatewayd/browse.html \ - " -SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" - -FILES:${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ - ${systemd_system_unitdir}/systemd-journal-upload.service \ - ${sysconfdir}/systemd/journal-upload.conf \ - " -SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service" - -FILES:${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ - ${sysconfdir}/systemd/journal-remote.conf \ - ${systemd_system_unitdir}/systemd-journal-remote.service \ - ${systemd_system_unitdir}/systemd-journal-remote.socket \ - " -SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket" - - -FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ - ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \ - ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \ - ${base_bindir}/machinectl \ - ${bindir}/systemd-nspawn \ - ${nonarch_libdir}/systemd/import-pubring.gpg \ - ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \ - ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \ - ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \ - ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \ - ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \ - ${systemd_system_unitdir}/machine.slice \ - ${systemd_system_unitdir}/machines.target \ - ${systemd_system_unitdir}/org.freedesktop.import1.busname \ - ${systemd_system_unitdir}/org.freedesktop.machine1.busname \ - ${systemd_system_unitdir}/systemd-importd.service \ - ${systemd_system_unitdir}/systemd-machined.service \ - ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \ - ${systemd_system_unitdir}/var-lib-machines.mount \ - ${rootlibexecdir}/systemd/systemd-import \ - ${rootlibexecdir}/systemd/systemd-importd \ - ${rootlibexecdir}/systemd/systemd-machined \ - ${rootlibexecdir}/systemd/systemd-pull \ - ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ - ${exec_prefix}/lib/tmpfiles.d/README \ - ${systemd_system_unitdir}/systemd-nspawn@.service \ - ${libdir}/libnss_mymachines.so.2 \ - ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \ - ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \ - ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \ - ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \ - ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \ - " - -# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox. -RRECOMMENDS:${PN}-container += "\ - ${PN}-journal-gatewayd \ - ${PN}-journal-remote \ - ${PN}-journal-upload \ - kernel-module-dm-mod \ - kernel-module-loop \ - kernel-module-tun \ - tar \ - " - -FILES:${PN}-extra-utils = "\ - ${base_bindir}/systemd-escape \ - ${base_bindir}/systemd-inhibit \ - ${bindir}/systemd-detect-virt \ - ${bindir}/systemd-dissect \ - ${bindir}/systemd-path \ - ${bindir}/systemd-run \ - ${bindir}/systemd-cat \ - ${bindir}/systemd-creds \ - ${bindir}/systemd-cryptenroll \ - ${bindir}/systemd-delta \ - ${bindir}/systemd-cgls \ - ${bindir}/systemd-cgtop \ - ${bindir}/systemd-stdio-bridge \ - ${base_bindir}/systemd-ask-password \ - ${base_bindir}/systemd-tty-ask-password-agent \ - ${systemd_system_unitdir}/systemd-ask-password-console.path \ - ${systemd_system_unitdir}/systemd-ask-password-console.service \ - ${systemd_system_unitdir}/systemd-ask-password-wall.path \ - ${systemd_system_unitdir}/systemd-ask-password-wall.service \ - ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-console.path \ - ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-wall.path \ - ${systemd_system_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path \ - ${rootlibexecdir}/systemd/systemd-resolve-host \ - ${rootlibexecdir}/systemd/systemd-ac-power \ - ${rootlibexecdir}/systemd/systemd-activate \ - ${rootlibexecdir}/systemd/systemd-bus-proxyd \ - ${systemd_system_unitdir}/systemd-bus-proxyd.service \ - ${systemd_system_unitdir}/systemd-bus-proxyd.socket \ - ${rootlibexecdir}/systemd/systemd-socket-proxyd \ - ${rootlibexecdir}/systemd/systemd-reply-password \ - ${rootlibexecdir}/systemd/systemd-sleep \ - ${rootlibexecdir}/systemd/system-sleep \ - ${systemd_system_unitdir}/systemd-hibernate.service \ - ${systemd_system_unitdir}/systemd-hybrid-sleep.service \ - ${systemd_system_unitdir}/systemd-suspend.service \ - ${systemd_system_unitdir}/sleep.target \ - ${rootlibexecdir}/systemd/systemd-initctl \ - ${systemd_system_unitdir}/systemd-initctl.service \ - ${systemd_system_unitdir}/systemd-initctl.socket \ - ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \ - ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ - ${rootlibexecdir}/systemd/systemd-cgroups-agent \ -" - -FILES:${PN}-udev-rules = "\ - ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \ - ${rootlibexecdir}/udev/rules.d/71-seat.rules \ - ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \ - ${rootlibexecdir}/udev/rules.d/99-systemd.rules \ -" - -CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \ - ${sysconfdir}/systemd/journald.conf \ - ${sysconfdir}/systemd/logind.conf \ - ${sysconfdir}/systemd/networkd.conf \ - ${sysconfdir}/systemd/pstore.conf \ - ${sysconfdir}/systemd/resolved.conf \ - ${sysconfdir}/systemd/sleep.conf \ - ${sysconfdir}/systemd/system.conf \ - ${sysconfdir}/systemd/timesyncd.conf \ - ${sysconfdir}/systemd/user.conf \ -" - -FILES:${PN} = " ${base_bindir}/* \ - ${base_sbindir}/shutdown \ - ${base_sbindir}/halt \ - ${base_sbindir}/poweroff \ - ${base_sbindir}/runlevel \ - ${base_sbindir}/telinit \ - ${base_sbindir}/resolvconf \ - ${base_sbindir}/reboot \ - ${base_sbindir}/init \ - ${datadir}/dbus-1/services \ - ${datadir}/dbus-1/system-services \ - ${datadir}/polkit-1 \ - ${datadir}/${BPN} \ - ${datadir}/factory \ - ${sysconfdir}/dbus-1/ \ - ${sysconfdir}/modules-load.d/ \ - ${sysconfdir}/pam.d/ \ - ${sysconfdir}/profile.d/ \ - ${sysconfdir}/sysctl.d/ \ - ${sysconfdir}/systemd/ \ - ${sysconfdir}/tmpfiles.d/ \ - ${sysconfdir}/xdg/ \ - ${sysconfdir}/init.d/README \ - ${sysconfdir}/resolv-conf.systemd \ - ${sysconfdir}/X11/xinit/xinitrc.d/* \ - ${rootlibexecdir}/systemd/* \ - ${libdir}/pam.d \ - ${nonarch_libdir}/pam.d \ - ${systemd_unitdir}/* \ - ${base_libdir}/security/*.so \ - /cgroup \ - ${bindir}/systemd* \ - ${bindir}/busctl \ - ${bindir}/coredumpctl \ - ${bindir}/localectl \ - ${bindir}/hostnamectl \ - ${bindir}/resolvectl \ - ${bindir}/timedatectl \ - ${bindir}/bootctl \ - ${bindir}/oomctl \ - ${exec_prefix}/lib/tmpfiles.d/*.conf \ - ${exec_prefix}/lib/systemd \ - ${exec_prefix}/lib/modules-load.d \ - ${exec_prefix}/lib/sysctl.d \ - ${exec_prefix}/lib/sysusers.d \ - ${exec_prefix}/lib/environment.d \ - ${localstatedir} \ - ${rootlibexecdir}/modprobe.d/systemd.conf \ - ${rootlibexecdir}/modprobe.d/README \ - ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \ - ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \ - ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \ - ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \ - " - -FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" - -RDEPENDS:${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck" -RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" -RDEPENDS:${PN} += "volatile-binds" - -RRECOMMENDS:${PN} += "systemd-extra-utils \ - udev-hwdb \ - e2fsprogs-e2fsck \ - kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \ - os-release \ - systemd-conf \ -" - -INSANE_SKIP:${PN} += "dev-so libdir" -INSANE_SKIP:${PN}-dbg += "libdir" -INSANE_SKIP:${PN}-doc += " libdir" -INSANE_SKIP:libsystemd-shared += "libdir" - -FILES:libsystemd-shared = "${rootlibexecdir}/systemd/libsystemd-shared*.so" - -RPROVIDES:udev = "hotplug" - -RDEPENDS:udev-hwdb += "udev" - -FILES:udev += "${base_sbindir}/udevd \ - ${rootlibexecdir}/systemd/network/99-default.link \ - ${rootlibexecdir}/systemd/systemd-udevd \ - ${rootlibexecdir}/udev/accelerometer \ - ${rootlibexecdir}/udev/ata_id \ - ${rootlibexecdir}/udev/cdrom_id \ - ${rootlibexecdir}/udev/collect \ - ${rootlibexecdir}/udev/dmi_memory_id \ - ${rootlibexecdir}/udev/fido_id \ - ${rootlibexecdir}/udev/findkeyboards \ - ${rootlibexecdir}/udev/keyboard-force-release.sh \ - ${rootlibexecdir}/udev/keymap \ - ${rootlibexecdir}/udev/mtd_probe \ - ${rootlibexecdir}/udev/scsi_id \ - ${rootlibexecdir}/udev/v4l_id \ - ${rootlibexecdir}/udev/keymaps \ - ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \ - ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \ - ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \ - ${rootlibexecdir}/udev/rules.d/60-block.rules \ - ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \ - ${rootlibexecdir}/udev/rules.d/60-drm.rules \ - ${rootlibexecdir}/udev/rules.d/60-evdev.rules \ - ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \ - ${rootlibexecdir}/udev/rules.d/60-input-id.rules \ - ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \ - ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \ - ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \ - ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \ - ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \ - ${rootlibexecdir}/udev/rules.d/60-sensor.rules \ - ${rootlibexecdir}/udev/rules.d/60-serial.rules \ - ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \ - ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \ - ${rootlibexecdir}/udev/rules.d/70-camera.rules \ - ${rootlibexecdir}/udev/rules.d/70-joystick.rules \ - ${rootlibexecdir}/udev/rules.d/70-memory.rules \ - ${rootlibexecdir}/udev/rules.d/70-mouse.rules \ - ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \ - ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \ - ${rootlibexecdir}/udev/rules.d/75-net-description.rules \ - ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \ - ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \ - ${rootlibexecdir}/udev/rules.d/80-drivers.rules \ - ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \ - ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \ - ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \ - ${rootlibexecdir}/udev/rules.d/README \ - ${sysconfdir}/udev \ - ${sysconfdir}/init.d/systemd-udevd \ - ${systemd_system_unitdir}/*udev* \ - ${systemd_system_unitdir}/*.wants/*udev* \ - ${base_bindir}/systemd-hwdb \ - ${base_bindir}/udevadm \ - ${base_sbindir}/udevadm \ - ${datadir}/bash-completion/completions/udevadm \ - ${systemd_system_unitdir}/systemd-hwdb-update.service \ - " - -FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \ - " - -RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}" - -INITSCRIPT_PACKAGES = "udev" -INITSCRIPT_NAME:udev = "systemd-udevd" -INITSCRIPT_PARAMS:udev = "start 03 S ." - -python __anonymous() { - if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): - d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") - - if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d): - bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]") - - if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d): - bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]") -} - -python do_warn_musl() { - if d.getVar('TCLIBC') == "musl": - bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.") -} -addtask warn_musl before do_configure - -ALTERNATIVE:${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" - -ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" -ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" -ALTERNATIVE_PRIORITY[resolv-conf] ?= "50" - -ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt" -ALTERNATIVE_PRIORITY[halt] ?= "300" - -ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot" -ALTERNATIVE_PRIORITY[reboot] ?= "300" - -ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown" -ALTERNATIVE_PRIORITY[shutdown] ?= "300" - -ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff" -ALTERNATIVE_PRIORITY[poweroff] ?= "300" - -ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl" -ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" -ALTERNATIVE_PRIORITY[runlevel] ?= "300" - -pkg_postinst:${PN}:libc-glibc () { - sed -e '/^hosts:/s/\s*\//' \ - -e 's/\(^hosts:.*\)\(\\)\(.*\)\(\\)\(.*\)/\1\2 myhostname \3\4\5/' \ - -i $D${sysconfdir}/nsswitch.conf -} - -pkg_prerm:${PN}:libc-glibc () { - sed -e '/^hosts:/s/\s*\//' \ - -e '/^hosts:/s/\s*myhostname//' \ - -i $D${sysconfdir}/nsswitch.conf -} - -PACKAGE_WRITE_DEPS += "qemu-native" -pkg_postinst:udev-hwdb () { - if test -n "$D"; then - $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" base_bindir="${base_bindir}" - else - udevadm hwdb --update - fi -} - -pkg_prerm:udev-hwdb () { - rm -f $D${sysconfdir}/udev/hwdb.bin -} diff --git a/poky/meta/recipes-core/systemd/systemd_252.4.bb b/poky/meta/recipes-core/systemd/systemd_252.4.bb new file mode 100644 index 0000000000..7c3c78a364 --- /dev/null +++ b/poky/meta/recipes-core/systemd/systemd_252.4.bb @@ -0,0 +1,812 @@ +require systemd.inc + +PROVIDES = "udev" + +PE = "1" + +DEPENDS = "intltool-native gperf-native libcap util-linux python3-jinja2-native" + +SECTION = "base/shell" + +inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check + +# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so +# that we don't build both udev and systemd in world builds. +REQUIRED_DISTRO_FEATURES = "systemd" + +SRC_URI += " \ + file://touchscreen.rules \ + file://00-create-volatile.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \ + file://init \ + file://99-default.preset \ + file://systemd-pager.sh \ + file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ + file://0003-implment-systemd-sysv-install-for-OE.patch \ + file://0001-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \ + " + +# patches needed by musl +SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}" +SRC_URI_MUSL = "\ + file://0003-missing_type.h-add-comparison_fn_t.patch \ + file://0004-add-fallback-parse_printf_format-implementation.patch \ + file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ + file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ + file://0008-add-missing-FTW_-macros-for-musl.patch \ + file://0010-Use-uintmax_t-for-handling-rlim_t.patch \ + file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ + file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ + file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ + file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ + file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \ + file://0022-do-not-disable-buffer-in-writing-files.patch \ + file://0025-Handle-__cpu_mask-usage.patch \ + file://0026-Handle-missing-gshadow.patch \ + file://0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \ + file://0001-pass-correct-parameters-to-getdents64.patch \ + file://0002-Add-sys-stat.h-for-S_IFDIR.patch \ + file://0001-Adjust-for-musl-headers.patch \ + file://0001-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \ + " + +PAM_PLUGINS = " \ + pam-plugin-unix \ + pam-plugin-loginuid \ + pam-plugin-keyinit \ +" + +PACKAGECONFIG ??= " \ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \ + backlight \ + binfmt \ + gshadow \ + hibernate \ + hostnamed \ + idn \ + ima \ + kmod \ + localed \ + logind \ + machined \ + myhostname \ + networkd \ + nss \ + nss-mymachines \ + nss-resolve \ + quotacheck \ + randomseed \ + resolved \ + set-time-epoch \ + sysusers \ + sysvinit \ + timedated \ + timesyncd \ + userdb \ + utmp \ + vconsole \ + wheel-group \ + zstd \ +" + +PACKAGECONFIG:remove:libc-musl = " \ + gshadow \ + idn \ + localed \ + myhostname \ + nss \ + nss-mymachines \ + nss-resolve \ + sysusers \ + userdb \ + utmp \ +" + +# https://github.com/seccomp/libseccomp/issues/347 +PACKAGECONFIG:remove:mipsarch = "seccomp" + +TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE" + +# Some of the dependencies are weak-style recommends - if not available at runtime, +# systemd won't fail but the library-related feature will be skipped with a warning. + +# Use the upstream systemd serial-getty@.service and rely on +# systemd-getty-generator instead of using the OE-core specific +# systemd-serialgetty.bb - not enabled by default. +PACKAGECONFIG[serial-getty-generator] = "" + +PACKAGECONFIG[acl] = "-Dacl=true,-Dacl=false,acl" +PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit" +PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false" +PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false" +PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2" +PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid" +PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false" +PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup" +PACKAGECONFIG[tpm2] = "-Dtpm2=true,-Dtpm2=false,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device" +PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus" +PACKAGECONFIG[efi] = "-Defi=true,-Defi=false" +PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi" +PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils" +PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false" +PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false" +PACKAGECONFIG[homed] = "-Dhomed=true,-Dhomed=false" +# Sign the journal for anti-tampering +PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt" +PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" +PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false" +PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false" +PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false" +PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" +PACKAGECONFIG[ima] = "-Dima=true,-Dima=false" +# importd requires journal-upload/xz/zlib/bzip2/gcrypt +PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false,glib-2.0" +# Update NAT firewall rules +PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables" +PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl" +PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod" +PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig" +PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn" +PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2" +# Link udev shared with systemd helper library. +# If enabled the udev package depends on the systemd package (which has the needed shared library). +PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false" +PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false" +PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false" +PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4" +PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false" +PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" +PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd" +PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname" +PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false" +PACKAGECONFIG[no-dns-fallback] = "-Ddns-servers=" +PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false" +PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false" +PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false" +PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false" +PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl" +PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}" +PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2" +PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false" +# If polkit is disabled and networkd+hostnamed are in use, enabling this option and +# using dbus-broker will allow networkd to be authorized to change the +# hostname without acquiring additional privileges +PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit" +PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false" +PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode" +PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false" +PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false" +PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false" +PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false" +PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" +PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell" +PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false" +PACKAGECONFIG[sysext] = "-Dsysext=true, -Dsysext=false" +PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" +PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d" +# When enabled use reproducble build timestamp if set as time epoch, +# or build time if not. When disabled, time epoch is unset. +def build_epoch(d): + epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1" + return '-Dtime-epoch=%d' % int(epoch) +PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0" +PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false" +PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false" +PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true" +PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true" +PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false" +PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false" +PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind" +PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup" +PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false" +PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false" +# Verify keymaps on locale change +PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon" +PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz" +PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib" +PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd" + +# Helper variables to clarify locations. This mirrors the logic in systemd's +# build system. +rootprefix ?= "${root_prefix}" +rootlibdir ?= "${base_libdir}" +rootlibexecdir = "${rootprefix}/lib" + +EXTRA_OEMESON += "-Dnobody-user=nobody \ + -Dnobody-group=nobody \ + -Drootlibdir=${rootlibdir} \ + -Drootprefix=${rootprefix} \ + -Ddefault-locale=C \ + -Dmode=release \ + -Dsystem-alloc-uid-min=101 \ + -Dsystem-uid-max=999 \ + -Dsystem-alloc-gid-min=101 \ + -Dsystem-gid-max=999 \ + " + +# Hardcode target binary paths to avoid using paths from sysroot +EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \ + -Dkmod-path=${base_bindir}/kmod \ + -Dmount-path=${base_bindir}/mount \ + -Dquotacheck-path=${sbindir}/quotacheck \ + -Dquotaon-path=${sbindir}/quotaon \ + -Dsulogin-path=${base_sbindir}/sulogin \ + -Dnologin-path=${base_sbindir}/nologin \ + -Dumount-path=${base_bindir}/umount" + +# The 60 seconds is watchdog's default vaule. +WATCHDOG_TIMEOUT ??= "60" + +do_install() { + meson_do_install + install -d ${D}/${base_sbindir} + if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then + # Provided by a separate recipe + rm ${D}${systemd_system_unitdir}/serial-getty* -f + fi + + # Provide support for initramfs + [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init + [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd + + install -d ${D}${sysconfdir}/udev/rules.d/ + install -d ${D}${sysconfdir}/tmpfiles.d + for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do + install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/ + done + + install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ + + if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd + sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd + install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install + fi + + if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then + # /var/log is typically a symbolic link to inside /var/volatile, + # which is expected to be empty. + rm -rf ${D}${localstatedir}/log + else + chown root:systemd-journal ${D}${localstatedir}/log/journal + + # journal-remote creates this at start + rm -rf ${D}${localstatedir}/log/journal/remote + fi + + install -d ${D}${systemd_system_unitdir}/graphical.target.wants + install -d ${D}${systemd_system_unitdir}/multi-user.target.wants + install -d ${D}${systemd_system_unitdir}/poweroff.target.wants + install -d ${D}${systemd_system_unitdir}/reboot.target.wants + install -d ${D}${systemd_system_unitdir}/rescue.target.wants + + # Create symlinks for systemd-update-utmp-runlevel.service + if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service + fi + + # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it + # for existence else it fails + if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ] && + ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', d)}; then + echo 'd /run/systemd/netif/links 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf + fi + if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then + echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf + echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf + echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf + ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd + else + sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf + ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd + fi + if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then + rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf + rm -r ${D}${sysconfdir}/X11 + fi + + # If polkit is setup fixup permissions and ownership + if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then + if [ -d ${D}${datadir}/polkit-1/rules.d ]; then + chmod 700 ${D}${datadir}/polkit-1/rules.d + chown polkitd:root ${D}${datadir}/polkit-1/rules.d + fi + fi + + # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to + # request hostname changes via DBUS without elevating its privileges + if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then + install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ + install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ + install -d ${D}${datadir}/dbus-1/system.d/ + install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/ + fi + + # create link for existing udev rules + ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm + + # install default policy for presets + # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto + install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset + + # add a profile fragment to disable systemd pager with busybox less + install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh + + if [ -n "${WATCHDOG_TIMEOUT}" ]; then + sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \ + ${D}/${sysconfdir}/systemd/system.conf + fi +} + +python populate_packages:prepend (){ + systemdlibdir = d.getVar("rootlibdir") + do_split_packages(d, systemdlibdir, r'^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) +} +PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*" + +PACKAGE_BEFORE_PN = "\ + ${PN}-gui \ + ${PN}-vconsole-setup \ + ${PN}-initramfs \ + ${PN}-analyze \ + ${PN}-kernel-install \ + ${PN}-rpm-macros \ + ${PN}-binfmt \ + ${PN}-zsh-completion \ + ${PN}-container \ + ${PN}-journal-gatewayd \ + ${PN}-journal-upload \ + ${PN}-journal-remote \ + ${PN}-extra-utils \ + ${PN}-udev-rules \ + libsystemd-shared \ + udev \ + udev-hwdb \ +" + +SUMMARY:${PN}-container = "Tools for containers and VMs" +DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." + +SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events" +DESCRIPTION:${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default." + +SUMMARY:${PN}-journal-upload = "Send journal messages over the network" +DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." + +SUMMARY:${PN}-journal-remote = "Receive journal messages over the network" +DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." + +SUMMARY:libsystemd-shared = "Systemd shared library" + +SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ +" +SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service" + +USERADD_PACKAGES = "${PN} ${PN}-extra-utils \ + udev \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ +" +GROUPADD_PARAM:${PN} = "-r systemd-journal;" +GROUPADD_PARAM:udev = "-r render" +GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}" +USERADD_PARAM:${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy" +USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway" +USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote" +USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload" + +FILES:${PN}-analyze = "${bindir}/systemd-analyze" + +FILES:${PN}-initramfs = "/init" +RDEPENDS:${PN}-initramfs = "${PN}" + +FILES:${PN}-gui = "${bindir}/systemadm" + +FILES:${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ + ${systemd_system_unitdir}/systemd-vconsole-setup.service \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service" + +RDEPENDS:${PN}-kernel-install += "bash" +FILES:${PN}-kernel-install = "${bindir}/kernel-install \ + ${sysconfdir}/kernel/ \ + ${exec_prefix}/lib/kernel \ + " +FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ + " + +FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions" + +FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ + ${exec_prefix}/lib/binfmt.d \ + ${rootlibexecdir}/systemd/systemd-binfmt \ + ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \ + ${systemd_system_unitdir}/systemd-binfmt.service" +RRECOMMENDS:${PN}-binfmt = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', 'kernel-module-binfmt-misc', '', d)}" + +RRECOMMENDS:${PN}-vconsole-setup = "${@bb.utils.contains('PACKAGECONFIG', 'vconsole', 'kbd kbd-consolefonts kbd-keymaps', '', d)}" + + +FILES:${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ + ${systemd_system_unitdir}/systemd-journal-gatewayd.service \ + ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \ + ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \ + ${datadir}/systemd/gatewayd/browse.html \ + " +SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" + +FILES:${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ + ${systemd_system_unitdir}/systemd-journal-upload.service \ + ${sysconfdir}/systemd/journal-upload.conf \ + " +SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service" + +FILES:${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ + ${sysconfdir}/systemd/journal-remote.conf \ + ${systemd_system_unitdir}/systemd-journal-remote.service \ + ${systemd_system_unitdir}/systemd-journal-remote.socket \ + " +SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket" + + +FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ + ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \ + ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \ + ${base_bindir}/machinectl \ + ${bindir}/systemd-nspawn \ + ${nonarch_libdir}/systemd/import-pubring.gpg \ + ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \ + ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \ + ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \ + ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \ + ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \ + ${systemd_system_unitdir}/machine.slice \ + ${systemd_system_unitdir}/machines.target \ + ${systemd_system_unitdir}/org.freedesktop.import1.busname \ + ${systemd_system_unitdir}/org.freedesktop.machine1.busname \ + ${systemd_system_unitdir}/systemd-importd.service \ + ${systemd_system_unitdir}/systemd-machined.service \ + ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \ + ${systemd_system_unitdir}/var-lib-machines.mount \ + ${rootlibexecdir}/systemd/systemd-import \ + ${rootlibexecdir}/systemd/systemd-importd \ + ${rootlibexecdir}/systemd/systemd-machined \ + ${rootlibexecdir}/systemd/systemd-pull \ + ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ + ${exec_prefix}/lib/tmpfiles.d/README \ + ${systemd_system_unitdir}/systemd-nspawn@.service \ + ${libdir}/libnss_mymachines.so.2 \ + ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \ + ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \ + ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \ + ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \ + ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \ + " + +# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox. +RRECOMMENDS:${PN}-container += "\ + ${PN}-journal-gatewayd \ + ${PN}-journal-remote \ + ${PN}-journal-upload \ + kernel-module-dm-mod \ + kernel-module-loop \ + kernel-module-tun \ + tar \ + " + +FILES:${PN}-extra-utils = "\ + ${base_bindir}/systemd-escape \ + ${base_bindir}/systemd-inhibit \ + ${bindir}/systemd-detect-virt \ + ${bindir}/systemd-dissect \ + ${bindir}/systemd-path \ + ${bindir}/systemd-run \ + ${bindir}/systemd-cat \ + ${bindir}/systemd-creds \ + ${bindir}/systemd-cryptenroll \ + ${bindir}/systemd-delta \ + ${bindir}/systemd-cgls \ + ${bindir}/systemd-cgtop \ + ${bindir}/systemd-stdio-bridge \ + ${base_bindir}/systemd-ask-password \ + ${base_bindir}/systemd-tty-ask-password-agent \ + ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \ + ${systemd_system_unitdir}/systemd-ask-password-console.path \ + ${systemd_system_unitdir}/systemd-ask-password-console.service \ + ${systemd_system_unitdir}/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/systemd-ask-password-wall.service \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-console.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase-sysinit.path \ + ${systemd_system_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path \ + ${rootlibexecdir}/systemd/systemd-resolve-host \ + ${rootlibexecdir}/systemd/systemd-ac-power \ + ${rootlibexecdir}/systemd/systemd-activate \ + ${rootlibexecdir}/systemd/systemd-bus-proxyd \ + ${systemd_system_unitdir}/systemd-bus-proxyd.service \ + ${systemd_system_unitdir}/systemd-bus-proxyd.socket \ + ${rootlibexecdir}/systemd/systemd-measure \ + ${rootlibexecdir}/systemd/systemd-pcrphase \ + ${rootlibexecdir}/systemd/systemd-socket-proxyd \ + ${rootlibexecdir}/systemd/systemd-reply-password \ + ${rootlibexecdir}/systemd/systemd-sleep \ + ${rootlibexecdir}/systemd/system-sleep \ + ${systemd_system_unitdir}/systemd-hibernate.service \ + ${systemd_system_unitdir}/systemd-hybrid-sleep.service \ + ${systemd_system_unitdir}/systemd-pcrphase-initrd.service \ + ${systemd_system_unitdir}/systemd-pcrphase.service \ + ${systemd_system_unitdir}/systemd-pcrphase-sysinit.service \ + ${systemd_system_unitdir}/systemd-suspend.service \ + ${systemd_system_unitdir}/sleep.target \ + ${rootlibexecdir}/systemd/systemd-initctl \ + ${systemd_system_unitdir}/systemd-initctl.service \ + ${systemd_system_unitdir}/systemd-initctl.socket \ + ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \ + ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ + ${rootlibexecdir}/systemd/systemd-cgroups-agent \ +" + +FILES:${PN}-udev-rules = "\ + ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \ + ${rootlibexecdir}/udev/rules.d/71-seat.rules \ + ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \ + ${rootlibexecdir}/udev/rules.d/99-systemd.rules \ +" + +CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \ + ${sysconfdir}/systemd/journald.conf \ + ${sysconfdir}/systemd/logind.conf \ + ${sysconfdir}/systemd/networkd.conf \ + ${sysconfdir}/systemd/pstore.conf \ + ${sysconfdir}/systemd/resolved.conf \ + ${sysconfdir}/systemd/sleep.conf \ + ${sysconfdir}/systemd/system.conf \ + ${sysconfdir}/systemd/timesyncd.conf \ + ${sysconfdir}/systemd/user.conf \ +" + +FILES:${PN} = " ${base_bindir}/* \ + ${base_sbindir}/shutdown \ + ${base_sbindir}/halt \ + ${base_sbindir}/poweroff \ + ${base_sbindir}/runlevel \ + ${base_sbindir}/telinit \ + ${base_sbindir}/resolvconf \ + ${base_sbindir}/reboot \ + ${base_sbindir}/init \ + ${datadir}/dbus-1/services \ + ${datadir}/dbus-1/system-services \ + ${datadir}/polkit-1 \ + ${datadir}/${BPN} \ + ${datadir}/factory \ + ${sysconfdir}/dbus-1/ \ + ${sysconfdir}/modules-load.d/ \ + ${sysconfdir}/pam.d/ \ + ${sysconfdir}/profile.d/ \ + ${sysconfdir}/sysctl.d/ \ + ${sysconfdir}/systemd/ \ + ${sysconfdir}/tmpfiles.d/ \ + ${sysconfdir}/xdg/ \ + ${sysconfdir}/init.d/README \ + ${sysconfdir}/resolv-conf.systemd \ + ${sysconfdir}/X11/xinit/xinitrc.d/* \ + ${rootlibexecdir}/systemd/* \ + ${rootlibdir}/systemd/libsystemd-core* \ + ${libdir}/pam.d \ + ${nonarch_libdir}/pam.d \ + ${systemd_unitdir}/* \ + ${base_libdir}/security/*.so \ + /cgroup \ + ${bindir}/systemd* \ + ${bindir}/busctl \ + ${bindir}/coredumpctl \ + ${bindir}/localectl \ + ${bindir}/hostnamectl \ + ${bindir}/resolvectl \ + ${bindir}/timedatectl \ + ${bindir}/bootctl \ + ${bindir}/oomctl \ + ${bindir}/userdbctl \ + ${exec_prefix}/lib/tmpfiles.d/*.conf \ + ${exec_prefix}/lib/systemd \ + ${exec_prefix}/lib/modules-load.d \ + ${exec_prefix}/lib/sysctl.d \ + ${exec_prefix}/lib/sysusers.d \ + ${exec_prefix}/lib/environment.d \ + ${localstatedir} \ + ${rootlibexecdir}/modprobe.d/systemd.conf \ + ${rootlibexecdir}/modprobe.d/README \ + ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \ + ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \ + " + +FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" + +RDEPENDS:${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck" +RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" +RDEPENDS:${PN} += "volatile-binds" + +RRECOMMENDS:${PN} += "systemd-extra-utils \ + udev-hwdb \ + e2fsprogs-e2fsck \ + kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \ + os-release \ + systemd-conf \ +" + +INSANE_SKIP:${PN} += "dev-so libdir" +INSANE_SKIP:${PN}-dbg += "libdir" +INSANE_SKIP:${PN}-doc += " libdir" +INSANE_SKIP:libsystemd-shared += "libdir" + +FILES:libsystemd-shared = "${rootlibdir}/systemd/libsystemd-shared*.so" + +RPROVIDES:udev = "hotplug" + +RDEPENDS:udev-hwdb += "udev" + +FILES:udev += "${base_sbindir}/udevd \ + ${rootlibexecdir}/systemd/network/99-default.link \ + ${rootlibexecdir}/systemd/systemd-udevd \ + ${rootlibexecdir}/udev/accelerometer \ + ${rootlibexecdir}/udev/ata_id \ + ${rootlibexecdir}/udev/cdrom_id \ + ${rootlibexecdir}/udev/collect \ + ${rootlibexecdir}/udev/dmi_memory_id \ + ${rootlibexecdir}/udev/fido_id \ + ${rootlibexecdir}/udev/findkeyboards \ + ${rootlibexecdir}/udev/keyboard-force-release.sh \ + ${rootlibexecdir}/udev/keymap \ + ${rootlibexecdir}/udev/mtd_probe \ + ${rootlibexecdir}/udev/scsi_id \ + ${rootlibexecdir}/udev/v4l_id \ + ${rootlibexecdir}/udev/keymaps \ + ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \ + ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \ + ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \ + ${rootlibexecdir}/udev/rules.d/60-block.rules \ + ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \ + ${rootlibexecdir}/udev/rules.d/60-drm.rules \ + ${rootlibexecdir}/udev/rules.d/60-evdev.rules \ + ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \ + ${rootlibexecdir}/udev/rules.d/60-input-id.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \ + ${rootlibexecdir}/udev/rules.d/60-sensor.rules \ + ${rootlibexecdir}/udev/rules.d/60-serial.rules \ + ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \ + ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \ + ${rootlibexecdir}/udev/rules.d/70-camera.rules \ + ${rootlibexecdir}/udev/rules.d/70-joystick.rules \ + ${rootlibexecdir}/udev/rules.d/70-memory.rules \ + ${rootlibexecdir}/udev/rules.d/70-mouse.rules \ + ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \ + ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \ + ${rootlibexecdir}/udev/rules.d/75-net-description.rules \ + ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \ + ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \ + ${rootlibexecdir}/udev/rules.d/80-drivers.rules \ + ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \ + ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \ + ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \ + ${rootlibexecdir}/udev/rules.d/README \ + ${sysconfdir}/udev \ + ${sysconfdir}/init.d/systemd-udevd \ + ${systemd_system_unitdir}/*udev* \ + ${systemd_system_unitdir}/*.wants/*udev* \ + ${base_bindir}/systemd-hwdb \ + ${base_bindir}/udevadm \ + ${base_sbindir}/udevadm \ + ${datadir}/bash-completion/completions/udevadm \ + ${systemd_system_unitdir}/systemd-hwdb-update.service \ + " + +FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \ + " + +RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}" + +INITSCRIPT_PACKAGES = "udev" +INITSCRIPT_NAME:udev = "systemd-udevd" +INITSCRIPT_PARAMS:udev = "start 03 S ." + +python __anonymous() { + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") + + if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d): + bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]") + + if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d): + bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]") +} + +python do_warn_musl() { + if d.getVar('TCLIBC') == "musl": + bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.") +} +addtask warn_musl before do_configure + +ALTERNATIVE:${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" + +ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" +ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" +ALTERNATIVE_PRIORITY[resolv-conf] ?= "50" + +ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt" +ALTERNATIVE_PRIORITY[halt] ?= "300" + +ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot" +ALTERNATIVE_PRIORITY[reboot] ?= "300" + +ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown" +ALTERNATIVE_PRIORITY[shutdown] ?= "300" + +ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff" +ALTERNATIVE_PRIORITY[poweroff] ?= "300" + +ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl" +ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" +ALTERNATIVE_PRIORITY[runlevel] ?= "300" + +pkg_postinst:${PN}:libc-glibc () { + sed -e '/^hosts:/s/\s*\//' \ + -e 's/\(^hosts:.*\)\(\\)\(.*\)\(\\)\(.*\)/\1\2 myhostname \3\4\5/' \ + -i $D${sysconfdir}/nsswitch.conf +} + +pkg_prerm:${PN}:libc-glibc () { + sed -e '/^hosts:/s/\s*\//' \ + -e '/^hosts:/s/\s*myhostname//' \ + -i $D${sysconfdir}/nsswitch.conf +} + +PACKAGE_WRITE_DEPS += "qemu-native" +pkg_postinst:udev-hwdb () { + if test -n "$D"; then + $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" base_bindir="${base_bindir}" + else + udevadm hwdb --update + fi +} + +pkg_prerm:udev-hwdb () { + rm -f $D${sysconfdir}/udev/hwdb.bin +} diff --git a/poky/meta/recipes-core/util-linux/util-linux_2.38.1.bb b/poky/meta/recipes-core/util-linux/util-linux_2.38.1.bb index 50ecc106dd..9ea7a04e8a 100644 --- a/poky/meta/recipes-core/util-linux/util-linux_2.38.1.bb +++ b/poky/meta/recipes-core/util-linux/util-linux_2.38.1.bb @@ -107,6 +107,7 @@ PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" PACKAGECONFIG[pcre2] = ",,libpcre2" PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup" PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh," +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'" diff --git a/poky/meta/recipes-devtools/binutils/binutils-2.39.inc b/poky/meta/recipes-devtools/binutils/binutils-2.39.inc index b040e57037..419571d56c 100644 --- a/poky/meta/recipes-devtools/binutils/binutils-2.39.inc +++ b/poky/meta/recipes-devtools/binutils/binutils-2.39.inc @@ -35,6 +35,7 @@ SRC_URI = "\ file://0014-CVE-2022-38128-1.patch \ file://0014-CVE-2022-38128-2.patch \ file://0014-CVE-2022-38128-3.patch \ + file://0015-CVE-2022-4285.patch \ " S = "${WORKDIR}/git" # Already in 2.39 branch diff --git a/poky/meta/recipes-devtools/binutils/binutils/0015-CVE-2022-4285.patch b/poky/meta/recipes-devtools/binutils/binutils/0015-CVE-2022-4285.patch new file mode 100644 index 0000000000..46ec0b15a3 --- /dev/null +++ b/poky/meta/recipes-devtools/binutils/binutils/0015-CVE-2022-4285.patch @@ -0,0 +1,37 @@ +From 5c831a3c7f3ca98d6aba1200353311e1a1f84c70 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Wed, 19 Oct 2022 15:09:12 +0100 +Subject: [PATCH] Fix an illegal memory access when parsing an ELF file + containing corrupt symbol version information. + + PR 29699 + * elf.c (_bfd_elf_slurp_version_tables): Fail if the sh_info field + of the section header is zero. + +Upstream-Status: Backport +[https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5c831a3c7f3ca98d6aba1200353311e1a1f84c70] + +Signed-off-by: Pgowda +--- + bfd/ChangeLog | 6 ++++++ + bfd/elf.c | 4 +++- + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/bfd/elf.c b/bfd/elf.c +index fe00e0f9189..7cd7febcf95 100644 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -8918,7 +8918,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver) + bfd_set_error (bfd_error_file_too_big); + goto error_return_verref; + } +- elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) bfd_alloc (abfd, amt); ++ if (amt == 0) ++ goto error_return_verref; ++ elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) bfd_zalloc (abfd, amt); + if (elf_tdata (abfd)->verref == NULL) + goto error_return_verref; + +-- +2.31.1 + diff --git a/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch b/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch new file mode 100644 index 0000000000..2618687088 --- /dev/null +++ b/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch @@ -0,0 +1,903 @@ +From 37425f422e46003ed623f8e6387bed1aa5778b96 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 11 Nov 2022 11:26:05 -0800 +Subject: [PATCH] Use pread/pwrite/ftruncate/stat instead of 64bit equivalents + +64bit functions are aliases to original functions when largefile feature +is enabled via autoconf or right macro is passed on compiler cmdline + +-D_FILE_OFFSET_BITS=64 + +Upstream-Status: Submitted [https://lore.kernel.org/linux-btrfs/20221215084046.122836-1-raj.khem@gmail.com/T/#u] +Signed-off-by: Khem Raj +--- + cmds/rescue-chunk-recover.c | 4 +- + image/main.c | 14 +-- + kernel-shared/zoned.c | 6 +- + kernel-shared/zoned.h | 4 +- + mkfs/main.c | 4 +- + mkfs/rootdir.c | 10 +- + tests/fsstress.c | 192 ++++++++++++++++++------------------ + tests/fssum.c | 8 +- + 8 files changed, 121 insertions(+), 121 deletions(-) + +--- a/cmds/rescue-chunk-recover.c ++++ b/cmds/rescue-chunk-recover.c +@@ -755,7 +755,7 @@ static int scan_one_device(void *dev_sca + if (is_super_block_address(bytenr)) + bytenr += rc->sectorsize; + +- if (pread64(fd, buf->data, rc->nodesize, bytenr) < ++ if (pread(fd, buf->data, rc->nodesize, bytenr) < + rc->nodesize) + break; + +@@ -1875,7 +1875,7 @@ static int check_one_csum(int fd, u64 st + data = malloc(len); + if (!data) + return -1; +- ret = pread64(fd, data, len, start); ++ ret = pread(fd, data, len, start); + if (ret < 0 || ret != len) { + ret = -1; + goto out; +--- a/image/main.c ++++ b/image/main.c +@@ -691,7 +691,7 @@ static int flush_pending(struct metadump + if (start == BTRFS_SUPER_INFO_OFFSET) { + int fd = get_dev_fd(md->root); + +- ret = pread64(fd, async->buffer, size, start); ++ ret = pread(fd, async->buffer, size, start); + if (ret < size) { + free(async->buffer); + free(async); +@@ -1366,7 +1366,7 @@ static void write_backup_supers(int fd, + break; + btrfs_set_super_bytenr(super, bytenr); + csum_block(buf, BTRFS_SUPER_INFO_SIZE); +- ret = pwrite64(fd, buf, BTRFS_SUPER_INFO_SIZE, bytenr); ++ ret = pwrite(fd, buf, BTRFS_SUPER_INFO_SIZE, bytenr); + if (ret < BTRFS_SUPER_INFO_SIZE) { + if (ret < 0) + error( +@@ -1487,12 +1487,12 @@ static int restore_one_work(struct mdres + else + bytenr = logical; + +- ret = pwrite64(outfd, buffer + offset, chunk_size, bytenr); ++ ret = pwrite(outfd, buffer + offset, chunk_size, bytenr); + if (ret != chunk_size) + goto write_error; + + if (physical_dup) +- ret = pwrite64(outfd, buffer + offset, ++ ret = pwrite(outfd, buffer + offset, + chunk_size, physical_dup); + if (ret != chunk_size) + goto write_error; +@@ -2454,7 +2454,7 @@ static int fixup_device_size(struct btrf + } + if (S_ISREG(buf.st_mode)) { + /* Don't forget to enlarge the real file */ +- ret = ftruncate64(out_fd, dev_size); ++ ret = ftruncate(out_fd, dev_size); + if (ret < 0) { + error("failed to enlarge result image: %m"); + return -errno; +@@ -2913,7 +2913,7 @@ static int restore_metadump(const char * + goto out; + } + if (S_ISREG(st.st_mode) && st.st_size < dev_size) { +- ret = ftruncate64(fileno(out), dev_size); ++ ret = ftruncate(fileno(out), dev_size); + if (ret < 0) { + error( + "failed to enlarge result image file from %llu to %llu: %m", +@@ -3010,7 +3010,7 @@ static int update_disk_super_on_device(s + memcpy(dev_item->fsid, fs_uuid, BTRFS_UUID_SIZE); + csum_block((u8 *)&disk_super, BTRFS_SUPER_INFO_SIZE); + +- ret = pwrite64(fp, &disk_super, BTRFS_SUPER_INFO_SIZE, BTRFS_SUPER_INFO_OFFSET); ++ ret = pwrite(fp, &disk_super, BTRFS_SUPER_INFO_SIZE, BTRFS_SUPER_INFO_OFFSET); + if (ret != BTRFS_SUPER_INFO_SIZE) { + if (ret < 0) { + errno = ret; +--- a/kernel-shared/zoned.c ++++ b/kernel-shared/zoned.c +@@ -194,7 +194,7 @@ static int sb_write_pointer(int fd, stru + bytenr = ((zones[i].start + zones[i].len) + << SECTOR_SHIFT) - BTRFS_SUPER_INFO_SIZE; + +- ret = pread64(fd, buf[i], BTRFS_SUPER_INFO_SIZE, bytenr); ++ ret = pread(fd, buf[i], BTRFS_SUPER_INFO_SIZE, bytenr); + if (ret != BTRFS_SUPER_INFO_SIZE) + return -EIO; + super[i] = (struct btrfs_super_block *)&buf[i]; +@@ -515,8 +515,8 @@ size_t btrfs_sb_io(int fd, void *buf, of + /* We can call pread/pwrite if 'fd' is non-zoned device/file */ + if (zone_size_sector == 0) { + if (rw == READ) +- return pread64(fd, buf, count, offset); +- return pwrite64(fd, buf, count, offset); ++ return pread(fd, buf, count, offset); ++ return pwrite(fd, buf, count, offset); + } + + ASSERT(IS_ALIGNED(zone_size_sector, sb_size_sector)); +--- a/kernel-shared/zoned.h ++++ b/kernel-shared/zoned.h +@@ -150,9 +150,9 @@ int btrfs_wipe_temporary_sb(struct btrfs + #else + + #define sbread(fd, buf, offset) \ +- pread64(fd, buf, BTRFS_SUPER_INFO_SIZE, offset) ++ pread(fd, buf, BTRFS_SUPER_INFO_SIZE, offset) + #define sbwrite(fd, buf, offset) \ +- pwrite64(fd, buf, BTRFS_SUPER_INFO_SIZE, offset) ++ pwrite(fd, buf, BTRFS_SUPER_INFO_SIZE, offset) + + static inline int btrfs_reset_dev_zone(int fd, struct blk_zone *zone) + { +--- a/mkfs/main.c ++++ b/mkfs/main.c +@@ -453,14 +453,14 @@ static int zero_output_file(int out_fd, + /* Only zero out the first 1M */ + loop_num = SZ_1M / SZ_4K; + for (i = 0; i < loop_num; i++) { +- written = pwrite64(out_fd, buf, SZ_4K, location); ++ written = pwrite(out_fd, buf, SZ_4K, location); + if (written != SZ_4K) + ret = -EIO; + location += SZ_4K; + } + + /* Then enlarge the file to size */ +- written = pwrite64(out_fd, buf, 1, size - 1); ++ written = pwrite(out_fd, buf, 1, size - 1); + if (written < 1) + ret = -EIO; + return ret; +--- a/mkfs/rootdir.c ++++ b/mkfs/rootdir.c +@@ -340,7 +340,7 @@ static int add_file_items(struct btrfs_t + goto end; + } + +- ret_read = pread64(fd, buffer, st->st_size, bytes_read); ++ ret_read = pread(fd, buffer, st->st_size, bytes_read); + if (ret_read == -1) { + error("cannot read %s at offset %llu length %llu: %m", + path_name, bytes_read, (unsigned long long)st->st_size); +@@ -386,7 +386,7 @@ again: + + memset(eb->data, 0, sectorsize); + +- ret_read = pread64(fd, eb->data, sectorsize, file_pos + ++ ret_read = pread(fd, eb->data, sectorsize, file_pos + + bytes_read); + if (ret_read == -1) { + error("cannot read %s at offset %llu length %u: %m", +@@ -929,7 +929,7 @@ int btrfs_mkfs_shrink_fs(struct btrfs_fs + u64 new_size; + struct btrfs_device *device; + struct list_head *cur; +- struct stat64 file_stat; ++ struct stat file_stat; + int nr_devs = 0; + int ret; + +@@ -963,14 +963,14 @@ int btrfs_mkfs_shrink_fs(struct btrfs_fs + *new_size_ret = new_size; + + if (shrink_file_size) { +- ret = fstat64(device->fd, &file_stat); ++ ret = fstat(device->fd, &file_stat); + if (ret < 0) { + error("failed to stat devid %llu: %m", device->devid); + return ret; + } + if (!S_ISREG(file_stat.st_mode)) + return ret; +- ret = ftruncate64(device->fd, new_size); ++ ret = ftruncate(device->fd, new_size); + if (ret < 0) { + error("failed to truncate device file of devid %llu: %m", + device->devid); +--- a/tests/fsstress.c ++++ b/tests/fsstress.c +@@ -458,7 +458,7 @@ int get_fname(int, long, pathname_t *, f + void init_pathname(pathname_t *); + int lchown_path(pathname_t *, uid_t, gid_t); + int link_path(pathname_t *, pathname_t *); +-int lstat64_path(pathname_t *, struct stat64 *); ++int lstat_path(pathname_t *, struct stat *); + void make_freq_table(void); + int mkdir_path(pathname_t *, mode_t); + int mknod_path(pathname_t *, mode_t, dev_t); +@@ -472,9 +472,9 @@ int rename_path(pathname_t *, pathname_t + int rmdir_path(pathname_t *); + void separate_pathname(pathname_t *, char *, pathname_t *); + void show_ops(int, char *); +-int stat64_path(pathname_t *, struct stat64 *); ++int stat_path(pathname_t *, struct stat *); + int symlink_path(const char *, pathname_t *); +-int truncate64_path(pathname_t *, off64_t); ++int truncate_path(pathname_t *, off64_t); + int unlink_path(pathname_t *); + void usage(void); + void write_freq(void); +@@ -998,12 +998,12 @@ void + check_cwd(void) + { + #ifdef DEBUG +- struct stat64 statbuf; ++ struct stat statbuf; + int ret; + +- ret = stat64(".", &statbuf); ++ ret = stat(".", &statbuf); + if (ret != 0) { +- fprintf(stderr, "fsstress: check_cwd stat64() returned %d with errno: %d (%m)\n", ++ fprintf(stderr, "fsstress: check_cwd stat() returned %d with errno: %d (%m)\n", + ret, errno); + goto out; + } +@@ -1171,7 +1171,7 @@ again: + void + doproc(void) + { +- struct stat64 statbuf; ++ struct stat statbuf; + char buf[10]; + char cmd[64]; + opnum_t opno; +@@ -1182,7 +1182,7 @@ doproc(void) + dividend = (operations + execute_freq) / (execute_freq + 1); + sprintf(buf, "p%x", procid); + (void)mkdir(buf, 0777); +- if (chdir(buf) < 0 || stat64(".", &statbuf) < 0) { ++ if (chdir(buf) < 0 || stat(".", &statbuf) < 0) { + perror(buf); + _exit(1); + } +@@ -1214,7 +1214,7 @@ doproc(void) + * the forced shutdown happened. + */ + if (errtag != 0 && opno % 100 == 0) { +- rval = stat64(".", &statbuf); ++ rval = stat(".", &statbuf); + if (rval == EIO) { + fprintf(stderr, "Detected EIO\n"); + goto errout; +@@ -1537,18 +1537,18 @@ link_path(pathname_t *name1, pathname_t + } + + int +-lstat64_path(pathname_t *name, struct stat64 *sbuf) ++lstat_path(pathname_t *name, struct stat *sbuf) + { + char buf[NAME_MAX + 1]; + pathname_t newname; + int rval; + +- rval = lstat64(name->path, sbuf); ++ rval = lstat(name->path, sbuf); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { +- rval = lstat64_path(&newname, sbuf); ++ rval = lstat_path(&newname, sbuf); + assert(chdir("..") == 0); + } + free_pathname(&newname); +@@ -1870,18 +1870,18 @@ show_ops(int flag, char *lead_str) + } + + int +-stat64_path(pathname_t *name, struct stat64 *sbuf) ++stat_path(pathname_t *name, struct stat *sbuf) + { + char buf[NAME_MAX + 1]; + pathname_t newname; + int rval; + +- rval = stat64(name->path, sbuf); ++ rval = stat(name->path, sbuf); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { +- rval = stat64_path(&newname, sbuf); ++ rval = stat_path(&newname, sbuf); + assert(chdir("..") == 0); + } + free_pathname(&newname); +@@ -1913,18 +1913,18 @@ symlink_path(const char *name1, pathname + } + + int +-truncate64_path(pathname_t *name, off64_t length) ++truncate_path(pathname_t *name, off64_t length) + { + char buf[NAME_MAX + 1]; + pathname_t newname; + int rval; + +- rval = truncate64(name->path, length); ++ rval = truncate(name->path, length); + if (rval >= 0 || errno != ENAMETOOLONG) + return rval; + separate_pathname(name, buf, &newname); + if (chdir(buf) == 0) { +- rval = truncate64_path(&newname, length); ++ rval = truncate_path(&newname, length); + assert(chdir("..") == 0); + } + free_pathname(&newname); +@@ -2026,7 +2026,7 @@ non_btrfs_freq(const char *path) + ops[btrfs_ops[i]].freq = 0; + } + +-void inode_info(char *str, size_t sz, struct stat64 *s, int verbose) ++void inode_info(char *str, size_t sz, struct stat *s, int verbose) + { + if (verbose) + snprintf(str, sz, "[%ld %ld %d %d %lld %lld]", +@@ -2101,7 +2101,7 @@ allocsp_f(opnum_t opno, long r) + struct xfs_flock64 fl; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + +@@ -2122,9 +2122,9 @@ allocsp_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: allocsp - fstat64 %s failed %d\n", ++ printf("%d/%lld: allocsp - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -2160,7 +2160,7 @@ do_aio_rw(opnum_t opno, long r, int flag + size_t len; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + char *dio_env; +@@ -2184,9 +2184,9 @@ do_aio_rw(opnum_t opno, long r, int flag + procid, opno, f.path, e); + goto aio_out; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: do_aio_rw - fstat64 %s failed %d\n", ++ printf("%d/%lld: do_aio_rw - fstat %s failed %d\n", + procid, opno, f.path, errno); + goto aio_out; + } +@@ -2278,7 +2278,7 @@ do_uring_rw(opnum_t opno, long r, int fl + size_t len; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + struct io_uring_sqe *sqe; +@@ -2304,9 +2304,9 @@ do_uring_rw(opnum_t opno, long r, int fl + procid, opno, f.path, e); + goto uring_out; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: do_uring_rw - fstat64 %s failed %d\n", ++ printf("%d/%lld: do_uring_rw - fstat %s failed %d\n", + procid, opno, f.path, errno); + goto uring_out; + } +@@ -2522,7 +2522,7 @@ bulkstat1_f(opnum_t opno, long r) + int fd; + int good; + __u64 ino; +- struct stat64 s; ++ struct stat s; + struct xfs_bstat t; + int v; + struct xfs_fsop_bulkreq bsr; +@@ -2534,7 +2534,7 @@ bulkstat1_f(opnum_t opno, long r) + init_pathname(&f); + if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v)) + append_pathname(&f, "."); +- ino = stat64_path(&f, &s) < 0 ? (ino64_t)r : s.st_ino; ++ ino = stat_path(&f, &s) < 0 ? (ino64_t)r : s.st_ino; + check_cwd(); + free_pathname(&f); + } else { +@@ -2605,8 +2605,8 @@ clonerange_f( + struct file_clone_range fcr; + struct pathname fpath1; + struct pathname fpath2; +- struct stat64 stat1; +- struct stat64 stat2; ++ struct stat stat1; ++ struct stat stat2; + char inoinfo1[1024]; + char inoinfo2[1024]; + off64_t lr; +@@ -2660,17 +2660,17 @@ clonerange_f( + } + + /* Get file stats */ +- if (fstat64(fd1, &stat1) < 0) { ++ if (fstat(fd1, &stat1) < 0) { + if (v1) +- printf("%d/%lld: clonerange read - fstat64 %s failed %d\n", ++ printf("%d/%lld: clonerange read - fstat %s failed %d\n", + procid, opno, fpath1.path, errno); + goto out_fd2; + } + inode_info(inoinfo1, sizeof(inoinfo1), &stat1, v1); + +- if (fstat64(fd2, &stat2) < 0) { ++ if (fstat(fd2, &stat2) < 0) { + if (v2) +- printf("%d/%lld: clonerange write - fstat64 %s failed %d\n", ++ printf("%d/%lld: clonerange write - fstat %s failed %d\n", + procid, opno, fpath2.path, errno); + goto out_fd2; + } +@@ -2743,8 +2743,8 @@ copyrange_f( + #ifdef HAVE_COPY_FILE_RANGE + struct pathname fpath1; + struct pathname fpath2; +- struct stat64 stat1; +- struct stat64 stat2; ++ struct stat stat1; ++ struct stat stat2; + char inoinfo1[1024]; + char inoinfo2[1024]; + loff_t lr; +@@ -2802,17 +2802,17 @@ copyrange_f( + } + + /* Get file stats */ +- if (fstat64(fd1, &stat1) < 0) { ++ if (fstat(fd1, &stat1) < 0) { + if (v1) +- printf("%d/%lld: copyrange read - fstat64 %s failed %d\n", ++ printf("%d/%lld: copyrange read - fstat %s failed %d\n", + procid, opno, fpath1.path, errno); + goto out_fd2; + } + inode_info(inoinfo1, sizeof(inoinfo1), &stat1, v1); + +- if (fstat64(fd2, &stat2) < 0) { ++ if (fstat(fd2, &stat2) < 0) { + if (v2) +- printf("%d/%lld: copyrange write - fstat64 %s failed %d\n", ++ printf("%d/%lld: copyrange write - fstat %s failed %d\n", + procid, opno, fpath2.path, errno); + goto out_fd2; + } +@@ -2900,7 +2900,7 @@ deduperange_f( + #define INFO_SZ 1024 + struct file_dedupe_range *fdr; + struct pathname *fpath; +- struct stat64 *stat; ++ struct stat *stat; + char *info; + off64_t *off; + int *v; +@@ -2938,7 +2938,7 @@ deduperange_f( + goto out_fdr; + } + +- stat = calloc(nr, sizeof(struct stat64)); ++ stat = calloc(nr, sizeof(struct stat)); + if (!stat) { + printf("%d/%lld: line %d error %d\n", + procid, opno, __LINE__, errno); +@@ -3017,9 +3017,9 @@ deduperange_f( + } + + /* Get file stats */ +- if (fstat64(fd[0], &stat[0]) < 0) { ++ if (fstat(fd[0], &stat[0]) < 0) { + if (v[0]) +- printf("%d/%lld: deduperange read - fstat64 %s failed %d\n", ++ printf("%d/%lld: deduperange read - fstat %s failed %d\n", + procid, opno, fpath[0].path, errno); + goto out_fds; + } +@@ -3027,9 +3027,9 @@ deduperange_f( + inode_info(&info[0], INFO_SZ, &stat[0], v[0]); + + for (i = 1; i < nr; i++) { +- if (fstat64(fd[i], &stat[i]) < 0) { ++ if (fstat(fd[i], &stat[i]) < 0) { + if (v[i]) +- printf("%d/%lld: deduperange write - fstat64 %s failed %d\n", ++ printf("%d/%lld: deduperange write - fstat %s failed %d\n", + procid, opno, fpath[i].path, errno); + goto out_fds; + } +@@ -3179,8 +3179,8 @@ splice_f(opnum_t opno, long r) + { + struct pathname fpath1; + struct pathname fpath2; +- struct stat64 stat1; +- struct stat64 stat2; ++ struct stat stat1; ++ struct stat stat2; + char inoinfo1[1024]; + char inoinfo2[1024]; + loff_t lr; +@@ -3237,17 +3237,17 @@ splice_f(opnum_t opno, long r) + } + + /* Get file stats */ +- if (fstat64(fd1, &stat1) < 0) { ++ if (fstat(fd1, &stat1) < 0) { + if (v1) +- printf("%d/%lld: splice read - fstat64 %s failed %d\n", ++ printf("%d/%lld: splice read - fstat %s failed %d\n", + procid, opno, fpath1.path, errno); + goto out_fd2; + } + inode_info(inoinfo1, sizeof(inoinfo1), &stat1, v1); + +- if (fstat64(fd2, &stat2) < 0) { ++ if (fstat(fd2, &stat2) < 0) { + if (v2) +- printf("%d/%lld: splice write - fstat64 %s failed %d\n", ++ printf("%d/%lld: splice write - fstat %s failed %d\n", + procid, opno, fpath2.path, errno); + goto out_fd2; + } +@@ -3432,7 +3432,7 @@ dread_f(opnum_t opno, long r) + size_t len; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + char *dio_env; +@@ -3454,9 +3454,9 @@ dread_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: dread - fstat64 %s failed %d\n", ++ printf("%d/%lld: dread - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -3522,7 +3522,7 @@ dwrite_f(opnum_t opno, long r) + size_t len; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + char *dio_env; +@@ -3544,9 +3544,9 @@ dwrite_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: dwrite - fstat64 %s failed %d\n", ++ printf("%d/%lld: dwrite - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -3620,7 +3620,7 @@ do_fallocate(opnum_t opno, long r, int m + int64_t lr; + off64_t off; + off64_t len; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + +@@ -3640,9 +3640,9 @@ do_fallocate(opnum_t opno, long r, int m + return; + } + check_cwd(); +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: do_fallocate - fstat64 %s failed %d\n", ++ printf("%d/%lld: do_fallocate - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -3734,7 +3734,7 @@ fiemap_f(opnum_t opno, long r) + int fd; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + int blocks_to_map; +@@ -3757,9 +3757,9 @@ fiemap_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: fiemap - fstat64 %s failed %d\n", ++ printf("%d/%lld: fiemap - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -3807,7 +3807,7 @@ freesp_f(opnum_t opno, long r) + struct xfs_flock64 fl; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + +@@ -3828,9 +3828,9 @@ freesp_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: freesp - fstat64 %s failed %d\n", ++ printf("%d/%lld: freesp - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -4226,7 +4226,7 @@ do_mmap(opnum_t opno, long r, int prot) + int64_t lr; + off64_t off; + int flags; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + sigjmp_buf sigbus_jmpbuf; +@@ -4248,9 +4248,9 @@ do_mmap(opnum_t opno, long r, int prot) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: do_mmap - fstat64 %s failed %d\n", ++ printf("%d/%lld: do_mmap - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -4370,7 +4370,7 @@ read_f(opnum_t opno, long r) + size_t len; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + +@@ -4391,9 +4391,9 @@ read_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: read - fstat64 %s failed %d\n", ++ printf("%d/%lld: read - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -4454,7 +4454,7 @@ readv_f(opnum_t opno, long r) + size_t len; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + struct iovec *iov = NULL; +@@ -4480,9 +4480,9 @@ readv_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: readv - fstat64 %s failed %d\n", ++ printf("%d/%lld: readv - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -4739,7 +4739,7 @@ resvsp_f(opnum_t opno, long r) + struct xfs_flock64 fl; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + +@@ -4760,9 +4760,9 @@ resvsp_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: resvsp - fstat64 %s failed %d\n", ++ printf("%d/%lld: resvsp - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -4971,7 +4971,7 @@ stat_f(opnum_t opno, long r) + { + int e; + pathname_t f; +- struct stat64 stb; ++ struct stat stb; + int v; + + init_pathname(&f); +@@ -4981,7 +4981,7 @@ stat_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- e = lstat64_path(&f, &stb) < 0 ? errno : 0; ++ e = lstat_path(&f, &stb) < 0 ? errno : 0; + check_cwd(); + if (v) + printf("%d/%lld: stat %s %d\n", procid, opno, f.path, e); +@@ -5133,7 +5133,7 @@ truncate_f(opnum_t opno, long r) + pathname_t f; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + +@@ -5144,11 +5144,11 @@ truncate_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- e = stat64_path(&f, &stb) < 0 ? errno : 0; ++ e = stat_path(&f, &stb) < 0 ? errno : 0; + check_cwd(); + if (e > 0) { + if (v) +- printf("%d/%lld: truncate - stat64 %s failed %d\n", ++ printf("%d/%lld: truncate - stat %s failed %d\n", + procid, opno, f.path, e); + free_pathname(&f); + return; +@@ -5157,7 +5157,7 @@ truncate_f(opnum_t opno, long r) + lr = ((int64_t)random() << 32) + random(); + off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE)); + off %= maxfsize; +- e = truncate64_path(&f, off) < 0 ? errno : 0; ++ e = truncate_path(&f, off) < 0 ? errno : 0; + check_cwd(); + if (v) + printf("%d/%lld: truncate %s%s %lld %d\n", procid, opno, f.path, +@@ -5209,7 +5209,7 @@ unresvsp_f(opnum_t opno, long r) + struct xfs_flock64 fl; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + +@@ -5230,9 +5230,9 @@ unresvsp_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: unresvsp - fstat64 %s failed %d\n", ++ printf("%d/%lld: unresvsp - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -5281,7 +5281,7 @@ write_f(opnum_t opno, long r) + size_t len; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + +@@ -5302,9 +5302,9 @@ write_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: write - fstat64 %s failed %d\n", ++ printf("%d/%lld: write - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +@@ -5337,7 +5337,7 @@ writev_f(opnum_t opno, long r) + size_t len; + int64_t lr; + off64_t off; +- struct stat64 stb; ++ struct stat stb; + int v; + char st[1024]; + struct iovec *iov = NULL; +@@ -5363,9 +5363,9 @@ writev_f(opnum_t opno, long r) + free_pathname(&f); + return; + } +- if (fstat64(fd, &stb) < 0) { ++ if (fstat(fd, &stb) < 0) { + if (v) +- printf("%d/%lld: writev - fstat64 %s failed %d\n", ++ printf("%d/%lld: writev - fstat %s failed %d\n", + procid, opno, f.path, errno); + free_pathname(&f); + close(fd); +--- a/tests/fssum.c ++++ b/tests/fssum.c +@@ -519,9 +519,9 @@ sum(int dirfd, int level, sum_t *dircs, + int excl; + sum_file_data_t sum_file_data = flags[FLAG_STRUCTURE] ? + sum_file_data_strict : sum_file_data_permissive; +- struct stat64 dir_st; ++ struct stat dir_st; + +- if (fstat64(dirfd, &dir_st)) { ++ if (fstat(dirfd, &dir_st)) { + perror("fstat"); + exit(-1); + } +@@ -552,7 +552,7 @@ sum(int dirfd, int level, sum_t *dircs, + } + qsort(namelist, entries, sizeof(*namelist), namecmp); + for (i = 0; i < entries; ++i) { +- struct stat64 st; ++ struct stat st; + sum_t cs; + sum_t meta; + char *path; +@@ -572,7 +572,7 @@ sum(int dirfd, int level, sum_t *dircs, + perror("fchdir"); + exit(-1); + } +- ret = lstat64(namelist[i], &st); ++ ret = lstat(namelist[i], &st); + if (ret) { + fprintf(stderr, "stat failed for %s/%s: %m\n", + path_prefix, path); diff --git a/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb b/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb deleted file mode 100644 index 887a530a52..0000000000 --- a/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.0.bb +++ /dev/null @@ -1,72 +0,0 @@ -SUMMARY = "Checksumming Copy on Write Filesystem utilities" -DESCRIPTION = "Btrfs is a new copy on write filesystem for Linux aimed at \ -implementing advanced features while focusing on fault tolerance, repair and \ -easy administration. \ -This package contains utilities (mkfs, fsck, btrfsctl) used to work with \ -btrfs and an utility (btrfs-convert) to make a btrfs filesystem from an ext3." - -HOMEPAGE = "https://btrfs.wiki.kernel.org" - -LICENSE = "GPL-2.0-only & LGPL-2.1-or-later" -LIC_FILES_CHKSUM = " \ - file://COPYING;md5=fcb02dc552a041dee27e4b85c7396067 \ - file://libbtrfsutil/COPYING;md5=4fbd65380cdd255951079008b364516c \ -" -SECTION = "base" -DEPENDS = "util-linux zlib" - -SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git;branch=master \ - file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \ - " -SRCREV = "3db756352685f38c1de0aa886d380c733e0f53e7" -S = "${WORKDIR}/git" - -PACKAGECONFIG ??= " \ - programs \ - convert \ - python \ - crypto-builtin \ -" -PACKAGECONFIG[manpages] = "--enable-documentation, --disable-documentation, python3-sphinx-native" -PACKAGECONFIG[programs] = "--enable-programs,--disable-programs" -PACKAGECONFIG[convert] = "--enable-convert --with-convert=ext2,--disable-convert --without-convert,e2fsprogs" -PACKAGECONFIG[zoned] = "--enable-zoned,--disable-zoned" -PACKAGECONFIG[python] = "--enable-python,--disable-python,python3-setuptools-native" -PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" -PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd" -PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev" - -# Pick only one crypto provider -PACKAGECONFIG[crypto-builtin] = "--with-crypto=builtin" -PACKAGECONFIG[crypto-libgcrypt] = "--with-crypto=libgcrypt,,libgcrypt" -PACKAGECONFIG[crypto-libsodium] = "--with-crypto=libsodium,,libsodium" -PACKAGECONFIG[crypto-libkcapi] = "--with-crypto=libkcapi,,libkcapi" - -inherit autotools-brokensep pkgconfig manpages -inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'setuptools3-base', '', d)} - -CLEANBROKEN = "1" - -EXTRA_OECONF = "--enable-largefile" -EXTRA_OECONF:append:libc-musl = " --disable-backtrace " -EXTRA_PYTHON_CFLAGS = "${DEBUG_PREFIX_MAP}" -EXTRA_PYTHON_CFLAGS:class-native = "" -EXTRA_PYTHON_LDFLAGS = "${LDFLAGS}" -EXTRA_OEMAKE = "V=1 'EXTRA_PYTHON_CFLAGS=${EXTRA_PYTHON_CFLAGS}' 'EXTRA_PYTHON_LDFLAGS=${EXTRA_PYTHON_LDFLAGS}'" - -do_configure:prepend() { - # Upstream doesn't ship this and autoreconf won't install it as automake isn't used. - mkdir -p ${S}/config - cp -f $(automake --print-libdir)/install-sh ${S}/config/ -} - - -do_install:append() { - if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then - oe_runmake 'DESTDIR=${D}' 'PYTHON_SITEPACKAGES_DIR=${PYTHON_SITEPACKAGES_DIR}' install_python - fi -} - -RDEPENDS:${PN} = "libgcc" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.1.bb b/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.1.bb new file mode 100644 index 0000000000..44ec2e1f16 --- /dev/null +++ b/poky/meta/recipes-devtools/btrfs-tools/btrfs-tools_6.1.bb @@ -0,0 +1,73 @@ +SUMMARY = "Checksumming Copy on Write Filesystem utilities" +DESCRIPTION = "Btrfs is a new copy on write filesystem for Linux aimed at \ +implementing advanced features while focusing on fault tolerance, repair and \ +easy administration. \ +This package contains utilities (mkfs, fsck, btrfsctl) used to work with \ +btrfs and an utility (btrfs-convert) to make a btrfs filesystem from an ext3." + +HOMEPAGE = "https://btrfs.wiki.kernel.org" + +LICENSE = "GPL-2.0-only & LGPL-2.1-or-later" +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=fcb02dc552a041dee27e4b85c7396067 \ + file://libbtrfsutil/COPYING;md5=4fbd65380cdd255951079008b364516c \ +" +SECTION = "base" +DEPENDS = "util-linux zlib" + +SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git;branch=master \ + file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \ + file://0001-Use-pread-pwrite-ftruncate-stat-instead-of-64bit-equ.patch \ + " +SRCREV = "cde5faa6787e6fa720c99d2f10caa187a493c13f" +S = "${WORKDIR}/git" + +PACKAGECONFIG ??= " \ + programs \ + convert \ + python \ + crypto-builtin \ +" +PACKAGECONFIG[manpages] = "--enable-documentation, --disable-documentation, python3-sphinx-native" +PACKAGECONFIG[programs] = "--enable-programs,--disable-programs" +PACKAGECONFIG[convert] = "--enable-convert --with-convert=ext2,--disable-convert --without-convert,e2fsprogs" +PACKAGECONFIG[zoned] = "--enable-zoned,--disable-zoned" +PACKAGECONFIG[python] = "--enable-python,--disable-python,python3-setuptools-native" +PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" +PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd" +PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev" + +# Pick only one crypto provider +PACKAGECONFIG[crypto-builtin] = "--with-crypto=builtin" +PACKAGECONFIG[crypto-libgcrypt] = "--with-crypto=libgcrypt,,libgcrypt" +PACKAGECONFIG[crypto-libsodium] = "--with-crypto=libsodium,,libsodium" +PACKAGECONFIG[crypto-libkcapi] = "--with-crypto=libkcapi,,libkcapi" + +inherit autotools-brokensep pkgconfig manpages +inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'setuptools3-base', '', d)} + +CLEANBROKEN = "1" + +EXTRA_OECONF = "--enable-largefile" +EXTRA_OECONF:append:libc-musl = " --disable-backtrace " +EXTRA_PYTHON_CFLAGS = "${DEBUG_PREFIX_MAP}" +EXTRA_PYTHON_CFLAGS:class-native = "" +EXTRA_PYTHON_LDFLAGS = "${LDFLAGS}" +EXTRA_OEMAKE = "V=1 'EXTRA_PYTHON_CFLAGS=${EXTRA_PYTHON_CFLAGS}' 'EXTRA_PYTHON_LDFLAGS=${EXTRA_PYTHON_LDFLAGS}'" + +do_configure:prepend() { + # Upstream doesn't ship this and autoreconf won't install it as automake isn't used. + mkdir -p ${S}/config + cp -f $(automake --print-libdir)/install-sh ${S}/config/ +} + + +do_install:append() { + if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then + oe_runmake 'DESTDIR=${D}' 'PYTHON_SITEPACKAGES_DIR=${PYTHON_SITEPACKAGES_DIR}' install_python + fi +} + +RDEPENDS:${PN} = "libgcc" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/cargo/cargo.inc b/poky/meta/recipes-devtools/cargo/cargo.inc deleted file mode 100644 index 40421df4f7..0000000000 --- a/poky/meta/recipes-devtools/cargo/cargo.inc +++ /dev/null @@ -1,69 +0,0 @@ -SUMMARY ?= "Cargo, a package manager for Rust." -HOMEPAGE = "https://crates.io" -LICENSE = "MIT | Apache-2.0" -SECTION = "devel" - -DEPENDS = "openssl zlib curl ca-certificates libssh2" - -LIC_FILES_CHKSUM = " \ - file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \ - file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \ - file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \ -" - - -S = "${RUSTSRC}/src/tools/cargo" -CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" -EXCLUDE_FROM_WORLD = "1" - -inherit cargo pkgconfig - -do_cargo_setup_snapshot () { - ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig - # Need to use uninative's loader if enabled/present since the library paths - # are used internally by rust and result in symbol mismatches if we don't - if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then - patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER} - fi -} - -addtask cargo_setup_snapshot after do_unpack before do_configure -do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}" -do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" - - -do_compile:prepend () { - export RUSTC_BOOTSTRAP="1" -} - -do_install () { - install -d "${D}${bindir}" - install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" -} - -do_install:append:class-nativesdk() { - # To quote the cargo docs, "Cargo also sets the dynamic library path when compiling - # and running binaries with commands like `cargo run` and `cargo test`". Sadly it - # sets to libdir but not base_libdir leading to symbol mismatches depending on the - # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this. - create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir} -} - -# Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) -# as shipped by Yocto Dunfell. -# According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between -# libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off. -#export LIBGIT2_SYS_USE_PKG_CONFIG = "1" - -# Needed for pkg-config to be used -export LIBSSH2_SYS_USE_PKG_CONFIG = "1" - -# When building cargo-native we don't have cargo-native to use and depend on, -# so we must use the locally set up snapshot to bootstrap the build. -BASEDEPENDS:remove:class-native = "cargo-native" -CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" - -DEPENDS:append:class-nativesdk = " nativesdk-rust" -RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib" - - diff --git a/poky/meta/recipes-devtools/cargo/cargo_1.65.0.bb b/poky/meta/recipes-devtools/cargo/cargo_1.65.0.bb deleted file mode 100644 index 5c8527708c..0000000000 --- a/poky/meta/recipes-devtools/cargo/cargo_1.65.0.bb +++ /dev/null @@ -1,5 +0,0 @@ -require recipes-devtools/rust/rust-source.inc -require recipes-devtools/rust/rust-snapshot.inc -require cargo.inc -BBCLASSEXTEND = "native nativesdk" -RUSTLIB_DEP:class-nativesdk = "" \ No newline at end of file diff --git a/poky/meta/recipes-devtools/ccache/ccache_4.7.2.bb b/poky/meta/recipes-devtools/ccache/ccache_4.7.2.bb deleted file mode 100644 index b8598af639..0000000000 --- a/poky/meta/recipes-devtools/ccache/ccache_4.7.2.bb +++ /dev/null @@ -1,26 +0,0 @@ -SUMMARY = "a fast C/C++ compiler cache" -DESCRIPTION = "ccache is a compiler cache. It speeds up recompilation \ -by caching the result of previous compilations and detecting when the \ -same compilation is being done again. Supported languages are C, C\+\+, \ -Objective-C and Objective-C++." -HOMEPAGE = "http://ccache.samba.org" -SECTION = "devel" - -LICENSE = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=8fc2cae2bbabeb9236cacfa1c83a3dc5" - -DEPENDS = "zstd" - -SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz \ - file://0001-xxhash.h-Fix-build-with-gcc-12.patch \ - " -SRC_URI[sha256sum] = "6b346f441342a25a6c1d7e010957a593f416e94b5d66fdf2e2992953b3860b9d" - -inherit cmake github-releases - -PATCHTOOL = "patch" - -BBCLASSEXTEND = "native nativesdk" - -PACKAGECONFIG[docs] = "-DENABLE_DOCUMENTATION=ON,-DENABLE_DOCUMENTATION=OFF,asciidoc" -PACKAGECONFIG[redis] = "-DREDIS_STORAGE_BACKEND=ON,-DREDIS_STORAGE_BACKEND=OFF,hiredis" diff --git a/poky/meta/recipes-devtools/ccache/ccache_4.7.4.bb b/poky/meta/recipes-devtools/ccache/ccache_4.7.4.bb new file mode 100644 index 0000000000..0419d07c4e --- /dev/null +++ b/poky/meta/recipes-devtools/ccache/ccache_4.7.4.bb @@ -0,0 +1,26 @@ +SUMMARY = "a fast C/C++ compiler cache" +DESCRIPTION = "ccache is a compiler cache. It speeds up recompilation \ +by caching the result of previous compilations and detecting when the \ +same compilation is being done again. Supported languages are C, C\+\+, \ +Objective-C and Objective-C++." +HOMEPAGE = "http://ccache.samba.org" +SECTION = "devel" + +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=8fc2cae2bbabeb9236cacfa1c83a3dc5" + +DEPENDS = "zstd" + +SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz \ + file://0001-xxhash.h-Fix-build-with-gcc-12.patch \ + " +SRC_URI[sha256sum] = "dc283906b73bd7c461178ca472a459e9d86b5523405035921bd8204e77620264" + +inherit cmake github-releases + +PATCHTOOL = "patch" + +BBCLASSEXTEND = "native nativesdk" + +PACKAGECONFIG[docs] = "-DENABLE_DOCUMENTATION=ON,-DENABLE_DOCUMENTATION=OFF,asciidoc" +PACKAGECONFIG[redis] = "-DREDIS_STORAGE_BACKEND=ON,-DREDIS_STORAGE_BACKEND=OFF,hiredis" diff --git a/poky/meta/recipes-devtools/cmake/cmake-native_3.24.2.bb b/poky/meta/recipes-devtools/cmake/cmake-native_3.24.2.bb deleted file mode 100644 index bcc87eb8f2..0000000000 --- a/poky/meta/recipes-devtools/cmake/cmake-native_3.24.2.bb +++ /dev/null @@ -1,65 +0,0 @@ -require cmake.inc -inherit native - -DEPENDS += "bzip2-replacement-native xz-native zlib-native curl-native ncurses-native zstd-native" - -SRC_URI += "file://OEToolchainConfig.cmake \ - file://environment.d-cmake.sh \ - file://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \ - file://0005-Disable-use-of-ext2fs-ext2_fs.h-by-cmake-s-internal-.patch \ - " - -LICENSE:append = " & BSD-1-Clause & MIT & BSD-2-Clause" -LIC_FILES_CHKSUM:append = " \ - file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \ - file://Utilities/cmlibarchive/COPYING;md5=d499814247adaee08d88080841cb5665 \ - file://Utilities/cmexpat/COPYING;md5=9e2ce3b3c4c0f2670883a23bbd7c37a9 \ - file://Utilities/cmlibrhash/COPYING;md5=a8c2a557a5c53b1c12cddbee98c099af \ - file://Utilities/cmlibuv/LICENSE;md5=ad93ca1fffe931537fcf64f6fcce084d \ -" - -B = "${WORKDIR}/build" -do_configure[cleandirs] = "${B}" - -CMAKE_EXTRACONF = "\ - -DCMAKE_LIBRARY_PATH=${STAGING_LIBDIR_NATIVE} \ - -DBUILD_CursesDialog=1 \ - -DCMAKE_USE_SYSTEM_LIBRARIES=1 \ - -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \ - -DCMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE=0 \ - -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \ - -DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \ - -DCMAKE_USE_SYSTEM_LIBRARY_EXPAT=0 \ - -DENABLE_ACL=0 -DHAVE_ACL_LIBACL_H=0 \ - -DHAVE_SYS_ACL_H=0 \ - -DCURL_LIBRARIES=-lcurl \ -" - -do_configure () { - ${S}/configure --verbose --prefix=${prefix} \ - ${@oe.utils.parallel_make_argument(d, '--parallel=%d')} \ - ${@bb.utils.contains('CCACHE', 'ccache ', '--enable-ccache', '', d)} \ - -- ${CMAKE_EXTRACONF} -} - -do_compile() { - oe_runmake -} - -do_install() { - oe_runmake 'DESTDIR=${D}' install - - # The following codes are here because eSDK needs to provide compatibilty - # for SDK. That is, eSDK could also be used like traditional SDK. - mkdir -p ${D}${datadir}/cmake - install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/ - mkdir -p ${D}${base_prefix}/environment-setup.d - install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${base_prefix}/environment-setup.d/cmake.sh - - # Help docs create tons of files in the native sysroot and aren't needed there - rm -rf ${D}${datadir}/cmake-*/Help -} - -do_compile[progress] = "percent" - -SYSROOT_DIRS_NATIVE += "${datadir}/cmake ${base_prefix}/environment-setup.d" diff --git a/poky/meta/recipes-devtools/cmake/cmake-native_3.25.1.bb b/poky/meta/recipes-devtools/cmake/cmake-native_3.25.1.bb new file mode 100644 index 0000000000..bcc87eb8f2 --- /dev/null +++ b/poky/meta/recipes-devtools/cmake/cmake-native_3.25.1.bb @@ -0,0 +1,65 @@ +require cmake.inc +inherit native + +DEPENDS += "bzip2-replacement-native xz-native zlib-native curl-native ncurses-native zstd-native" + +SRC_URI += "file://OEToolchainConfig.cmake \ + file://environment.d-cmake.sh \ + file://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \ + file://0005-Disable-use-of-ext2fs-ext2_fs.h-by-cmake-s-internal-.patch \ + " + +LICENSE:append = " & BSD-1-Clause & MIT & BSD-2-Clause" +LIC_FILES_CHKSUM:append = " \ + file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \ + file://Utilities/cmlibarchive/COPYING;md5=d499814247adaee08d88080841cb5665 \ + file://Utilities/cmexpat/COPYING;md5=9e2ce3b3c4c0f2670883a23bbd7c37a9 \ + file://Utilities/cmlibrhash/COPYING;md5=a8c2a557a5c53b1c12cddbee98c099af \ + file://Utilities/cmlibuv/LICENSE;md5=ad93ca1fffe931537fcf64f6fcce084d \ +" + +B = "${WORKDIR}/build" +do_configure[cleandirs] = "${B}" + +CMAKE_EXTRACONF = "\ + -DCMAKE_LIBRARY_PATH=${STAGING_LIBDIR_NATIVE} \ + -DBUILD_CursesDialog=1 \ + -DCMAKE_USE_SYSTEM_LIBRARIES=1 \ + -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_EXPAT=0 \ + -DENABLE_ACL=0 -DHAVE_ACL_LIBACL_H=0 \ + -DHAVE_SYS_ACL_H=0 \ + -DCURL_LIBRARIES=-lcurl \ +" + +do_configure () { + ${S}/configure --verbose --prefix=${prefix} \ + ${@oe.utils.parallel_make_argument(d, '--parallel=%d')} \ + ${@bb.utils.contains('CCACHE', 'ccache ', '--enable-ccache', '', d)} \ + -- ${CMAKE_EXTRACONF} +} + +do_compile() { + oe_runmake +} + +do_install() { + oe_runmake 'DESTDIR=${D}' install + + # The following codes are here because eSDK needs to provide compatibilty + # for SDK. That is, eSDK could also be used like traditional SDK. + mkdir -p ${D}${datadir}/cmake + install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/ + mkdir -p ${D}${base_prefix}/environment-setup.d + install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${base_prefix}/environment-setup.d/cmake.sh + + # Help docs create tons of files in the native sysroot and aren't needed there + rm -rf ${D}${datadir}/cmake-*/Help +} + +do_compile[progress] = "percent" + +SYSROOT_DIRS_NATIVE += "${datadir}/cmake ${base_prefix}/environment-setup.d" diff --git a/poky/meta/recipes-devtools/cmake/cmake.inc b/poky/meta/recipes-devtools/cmake/cmake.inc index 7561e851c6..7da9a2fb55 100644 --- a/poky/meta/recipes-devtools/cmake/cmake.inc +++ b/poky/meta/recipes-devtools/cmake/cmake.inc @@ -10,7 +10,7 @@ HOMEPAGE = "http://www.cmake.org/" BUGTRACKER = "http://public.kitware.com/Bug/my_view_page.php" SECTION = "console/utils" LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://Copyright.txt;md5=45025187a129339459b6f1a24f7fac6e \ +LIC_FILES_CHKSUM = "file://Copyright.txt;md5=09069e0fffe4e5eaf6dde04c3b1932e5 \ file://Source/cmake.h;beginline=1;endline=2;md5=a5f70e1fef8614734eae0d62b4f5891b \ " @@ -19,7 +19,7 @@ CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}" SRC_URI = "https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${PV}.tar.gz \ " -SRC_URI[sha256sum] = "0d9020f06f3ddf17fb537dc228e1a56c927ee506b486f55fe2dc19f69bf0c8db" +SRC_URI[sha256sum] = "1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8" UPSTREAM_CHECK_REGEX = "cmake-(?P\d+(\.\d+)+)\.tar" diff --git a/poky/meta/recipes-devtools/cmake/cmake/0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch b/poky/meta/recipes-devtools/cmake/cmake/0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch index 9a2287f517..451b6ebfad 100644 --- a/poky/meta/recipes-devtools/cmake/cmake/0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch +++ b/poky/meta/recipes-devtools/cmake/cmake/0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch @@ -1,4 +1,4 @@ -From 89f6c846f02ad6d30b9ebb7eaaaa4fb6f9cec054 Mon Sep 17 00:00:00 2001 +From 8e53dd7f6f534ad933e7e9c7fc20cc1a6cded3f4 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Thu, 27 Apr 2017 11:35:05 -0400 Subject: [PATCH] CMakeDetermineSystem: use oe environment vars to load default @@ -25,7 +25,7 @@ Signed-off-by: Otavio Salvador 1 file changed, 7 insertions(+) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake -index 8c7af067..ade2b189 100644 +index 2c2c2ac3..fae4f97f 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -112,6 +112,13 @@ else() diff --git a/poky/meta/recipes-devtools/cmake/cmake_3.24.2.bb b/poky/meta/recipes-devtools/cmake/cmake_3.24.2.bb deleted file mode 100644 index bb7ed83e30..0000000000 --- a/poky/meta/recipes-devtools/cmake/cmake_3.24.2.bb +++ /dev/null @@ -1,67 +0,0 @@ -require cmake.inc - -inherit cmake bash-completion - -DEPENDS += "curl expat zlib libarchive xz ncurses bzip2" - -SRC_URI:append:class-nativesdk = " \ - file://OEToolchainConfig.cmake \ - file://SDKToolchainConfig.cmake.template \ - file://cmake-setup.py \ - file://environment.d-cmake.sh \ - file://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \ -" - -LICENSE:append = " & BSD-1-Clause & MIT" -LIC_FILES_CHKSUM:append = " \ - file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \ - file://Utilities/cmlibrhash/COPYING;md5=a8c2a557a5c53b1c12cddbee98c099af \ - file://Utilities/cmlibuv/LICENSE;md5=ad93ca1fffe931537fcf64f6fcce084d \ -" - -# Strip ${prefix} from ${docdir}, set result into docdir_stripped -python () { - prefix=d.getVar("prefix") - docdir=d.getVar("docdir") - - if not docdir.startswith(prefix): - bb.fatal('docdir must contain prefix as its prefix') - - docdir_stripped = docdir[len(prefix):] - if len(docdir_stripped) > 0 and docdir_stripped[0] == '/': - docdir_stripped = docdir_stripped[1:] - - d.setVar("docdir_stripped", docdir_stripped) -} - -EXTRA_OECMAKE=" \ - -DCMAKE_DOC_DIR=${docdir_stripped}/cmake-${CMAKE_MAJOR_VERSION} \ - -DCMAKE_USE_SYSTEM_LIBRARIES=1 \ - -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \ - -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \ - -DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \ - -DKWSYS_CHAR_IS_SIGNED=1 \ - -DBUILD_CursesDialog=0 \ - -DKWSYS_LFS_WORKS=1 \ -" - -do_install:append:class-nativesdk() { - mkdir -p ${D}${datadir}/cmake - install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/ - - mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d - install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${SDKPATHNATIVE}/environment-setup.d/cmake.sh - - # install cmake-setup.py to create arch-specific toolchain cmake file from template - install -m 0644 ${WORKDIR}/SDKToolchainConfig.cmake.template ${D}${datadir}/cmake/ - install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d - install -m 0755 ${WORKDIR}/cmake-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/ -} - -FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}" - -FILES:${PN} += "${datadir}/cmake-${CMAKE_MAJOR_VERSION} ${datadir}/cmake ${datadir}/aclocal ${datadir}/emacs ${datadir}/vim" -FILES:${PN}-doc += "${docdir}/cmake-${CMAKE_MAJOR_VERSION}" -FILES:${PN}-dev = "" - -BBCLASSEXTEND = "nativesdk" diff --git a/poky/meta/recipes-devtools/cmake/cmake_3.25.1.bb b/poky/meta/recipes-devtools/cmake/cmake_3.25.1.bb new file mode 100644 index 0000000000..bb7ed83e30 --- /dev/null +++ b/poky/meta/recipes-devtools/cmake/cmake_3.25.1.bb @@ -0,0 +1,67 @@ +require cmake.inc + +inherit cmake bash-completion + +DEPENDS += "curl expat zlib libarchive xz ncurses bzip2" + +SRC_URI:append:class-nativesdk = " \ + file://OEToolchainConfig.cmake \ + file://SDKToolchainConfig.cmake.template \ + file://cmake-setup.py \ + file://environment.d-cmake.sh \ + file://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \ +" + +LICENSE:append = " & BSD-1-Clause & MIT" +LIC_FILES_CHKSUM:append = " \ + file://Utilities/cmjsoncpp/LICENSE;md5=5d73c165a0f9e86a1342f32d19ec5926 \ + file://Utilities/cmlibrhash/COPYING;md5=a8c2a557a5c53b1c12cddbee98c099af \ + file://Utilities/cmlibuv/LICENSE;md5=ad93ca1fffe931537fcf64f6fcce084d \ +" + +# Strip ${prefix} from ${docdir}, set result into docdir_stripped +python () { + prefix=d.getVar("prefix") + docdir=d.getVar("docdir") + + if not docdir.startswith(prefix): + bb.fatal('docdir must contain prefix as its prefix') + + docdir_stripped = docdir[len(prefix):] + if len(docdir_stripped) > 0 and docdir_stripped[0] == '/': + docdir_stripped = docdir_stripped[1:] + + d.setVar("docdir_stripped", docdir_stripped) +} + +EXTRA_OECMAKE=" \ + -DCMAKE_DOC_DIR=${docdir_stripped}/cmake-${CMAKE_MAJOR_VERSION} \ + -DCMAKE_USE_SYSTEM_LIBRARIES=1 \ + -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \ + -DKWSYS_CHAR_IS_SIGNED=1 \ + -DBUILD_CursesDialog=0 \ + -DKWSYS_LFS_WORKS=1 \ +" + +do_install:append:class-nativesdk() { + mkdir -p ${D}${datadir}/cmake + install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/ + + mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d + install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${SDKPATHNATIVE}/environment-setup.d/cmake.sh + + # install cmake-setup.py to create arch-specific toolchain cmake file from template + install -m 0644 ${WORKDIR}/SDKToolchainConfig.cmake.template ${D}${datadir}/cmake/ + install -d ${D}${SDKPATHNATIVE}/post-relocate-setup.d + install -m 0755 ${WORKDIR}/cmake-setup.py ${D}${SDKPATHNATIVE}/post-relocate-setup.d/ +} + +FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}" + +FILES:${PN} += "${datadir}/cmake-${CMAKE_MAJOR_VERSION} ${datadir}/cmake ${datadir}/aclocal ${datadir}/emacs ${datadir}/vim" +FILES:${PN}-doc += "${docdir}/cmake-${CMAKE_MAJOR_VERSION}" +FILES:${PN}-dev = "" + +BBCLASSEXTEND = "nativesdk" diff --git a/poky/meta/recipes-devtools/dpkg/dpkg.inc b/poky/meta/recipes-devtools/dpkg/dpkg.inc index 0d17a98b80..b3e8c05d62 100644 --- a/poky/meta/recipes-devtools/dpkg/dpkg.inc +++ b/poky/meta/recipes-devtools/dpkg/dpkg.inc @@ -4,8 +4,8 @@ HOMEPAGE = "https://salsa.debian.org/dpkg-team/dpkg" DESCRIPTION = "The primary interface for the dpkg suite is the dselect program. A more low-level and less user-friendly interface is available in the form of the dpkg command." SECTION = "base" -DEPENDS = "zlib bzip2 perl ncurses" -DEPENDS:class-native = "bzip2-replacement-native zlib-native virtual/update-alternatives-native gettext-native perl-native" +DEPENDS = "zlib bzip2 perl ncurses libmd" +DEPENDS:class-native = "bzip2-replacement-native zlib-native virtual/update-alternatives-native gettext-native perl-native libmd-native" RDEPENDS:${PN} = "${VIRTUAL-RUNTIME_update-alternatives} perl" RDEPENDS:${PN}:class-native = "" diff --git a/poky/meta/recipes-devtools/dpkg/dpkg/0001-build.c-ignore-return-of-1-from-tar-cf.patch b/poky/meta/recipes-devtools/dpkg/dpkg/0001-build.c-ignore-return-of-1-from-tar-cf.patch index dc0d9bfc2e..1b5b89644f 100644 --- a/poky/meta/recipes-devtools/dpkg/dpkg/0001-build.c-ignore-return-of-1-from-tar-cf.patch +++ b/poky/meta/recipes-devtools/dpkg/dpkg/0001-build.c-ignore-return-of-1-from-tar-cf.patch @@ -1,4 +1,4 @@ -From 839f228556c00739f72534e8635195935eb3752f Mon Sep 17 00:00:00 2001 +From 54ca20a18253bcf0915b2e2985bbee79bf881ebe Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 16 Jun 2020 03:57:25 +0000 Subject: [PATCH] build.c: ignore return of 1 from tar -cf @@ -29,7 +29,7 @@ Signed-off-by: Paul Eggleton 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/deb/build.c b/src/deb/build.c -index 76613ad..7c216d1 100644 +index 76613adec..7c216d1a9 100644 --- a/src/deb/build.c +++ b/src/deb/build.c @@ -482,6 +482,7 @@ tarball_pack(const char *dir, filenames_feed_func *tar_filenames_feeder, @@ -51,6 +51,3 @@ index 76613ad..7c216d1 100644 } static intmax_t --- -2.25.1 - diff --git a/poky/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch b/poky/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch index 75ae848264..bd4d5d5353 100644 --- a/poky/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch +++ b/poky/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch @@ -1,4 +1,4 @@ -From dd11ed66640f79143e42d778b58fdd5a61fb5836 Mon Sep 17 00:00:00 2001 +From ff325b35639a797edd92b373fbebf7b8b9f3f0c3 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Wed, 26 Aug 2015 16:25:45 +0300 Subject: [PATCH] Our pre/postinsts expect $D to be set when running in a @@ -11,22 +11,23 @@ RP 2011/12/07 ALIMON 2016/05/26 ALIMON 2017/02/21 KKang 2019/02/20 + --- - src/main/script.c | 54 +++-------------------------------------------- - 1 file changed, 3 insertions(+), 51 deletions(-) + src/main/script.c | 53 +++-------------------------------------------- + 1 file changed, 3 insertions(+), 50 deletions(-) diff --git a/src/main/script.c b/src/main/script.c -index abe65b6..0edb8f1 100644 +index ecce4d842..16f4e6ff5 100644 --- a/src/main/script.c +++ b/src/main/script.c -@@ -96,58 +96,10 @@ setexecute(const char *path, struct stat *stab) - static const char * +@@ -97,58 +97,11 @@ static const char * maintscript_pre_exec(struct command *cmd) { + const char *instdir = dpkg_fsys_get_dir(); - const char *admindir = dpkg_db_get_dir(); - const char *changedir; - size_t instdirlen = strlen(instdir); -- + - if (instdirlen > 0 && in_force(FORCE_SCRIPT_CHROOTLESS)) - changedir = instdir; - else @@ -81,6 +82,3 @@ index abe65b6..0edb8f1 100644 } /** --- -2.25.1 - diff --git a/poky/meta/recipes-devtools/dpkg/dpkg_1.21.17.bb b/poky/meta/recipes-devtools/dpkg/dpkg_1.21.17.bb new file mode 100644 index 0000000000..f6687671f0 --- /dev/null +++ b/poky/meta/recipes-devtools/dpkg/dpkg_1.21.17.bb @@ -0,0 +1,23 @@ +require dpkg.inc +LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" + +SRC_URI = "git://salsa.debian.org/dpkg-team/dpkg.git;protocol=https;branch=main \ + file://noman.patch \ + file://remove-tar-no-timestamp.patch \ + file://arch_pm.patch \ + file://add_armeb_triplet_entry.patch \ + file://0002-Adapt-to-linux-wrs-kernel-version-which-has-characte.patch \ + file://0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch \ + file://0004-The-lutimes-function-doesn-t-work-properly-for-all-s.patch \ + file://0006-add-musleabi-to-known-target-tripets.patch \ + file://0007-dpkg-deb-build.c-Remove-usage-of-clamp-mtime-in-tar.patch \ + file://0001-dpkg-Support-muslx32-build.patch \ + file://pager.patch \ + file://0001-Add-support-for-riscv32-CPU.patch \ + " + +SRC_URI:append:class-native = " file://0001-build.c-ignore-return-of-1-from-tar-cf.patch" + +SRCREV = "e91be752ecfc3d4f5514835c79609804940d4b97" + +S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-devtools/dpkg/dpkg_1.21.9.bb b/poky/meta/recipes-devtools/dpkg/dpkg_1.21.9.bb deleted file mode 100644 index feb579723f..0000000000 --- a/poky/meta/recipes-devtools/dpkg/dpkg_1.21.9.bb +++ /dev/null @@ -1,23 +0,0 @@ -require dpkg.inc -LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" - -SRC_URI = "git://salsa.debian.org/dpkg-team/dpkg.git;protocol=https;branch=main \ - file://noman.patch \ - file://remove-tar-no-timestamp.patch \ - file://arch_pm.patch \ - file://add_armeb_triplet_entry.patch \ - file://0002-Adapt-to-linux-wrs-kernel-version-which-has-characte.patch \ - file://0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch \ - file://0004-The-lutimes-function-doesn-t-work-properly-for-all-s.patch \ - file://0006-add-musleabi-to-known-target-tripets.patch \ - file://0007-dpkg-deb-build.c-Remove-usage-of-clamp-mtime-in-tar.patch \ - file://0001-dpkg-Support-muslx32-build.patch \ - file://pager.patch \ - file://0001-Add-support-for-riscv32-CPU.patch \ - " - -SRC_URI:append:class-native = " file://0001-build.c-ignore-return-of-1-from-tar-cf.patch" - -SRCREV = "c2d6b7de5849c62d3a4f55f61dbc53c1992f74ee" - -S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch new file mode 100644 index 0000000000..a770d0cf89 --- /dev/null +++ b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-Add-option-to-enable-disable-largefile-support.patch @@ -0,0 +1,57 @@ +From 6fab3346d448298a24cee1faeb5fc8507a3b9712 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 10 Nov 2022 20:34:54 -0800 +Subject: [PATCH] Add option to enable/disable largefile support + +fallocate can be used to have 64bit off_t provided its compiled with +_FILE_OFFSET_BITS=64 which will be added automatically when +--enable-largefile is used. + +Upstream-Status: Submitted [https://github.com/tytso/e2fsprogs/pull/129] +Signed-off-by: Khem Raj +--- + configure.ac | 3 +++ + misc/e4defrag.c | 6 +----- + 2 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/configure.ac b/configure.ac +index dff3d1ca..ec1c5b64 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1800,6 +1800,9 @@ OS_IO_FILE="" + ;; + esac] + AC_SUBST(OS_IO_FILE) ++ ++AC_SYS_LARGEFILE ++ + dnl + dnl Make our output files, being sure that we create the some miscellaneous + dnl directories +diff --git a/misc/e4defrag.c b/misc/e4defrag.c +index 86e97ee3..e7175c37 100644 +--- a/misc/e4defrag.c ++++ b/misc/e4defrag.c +@@ -195,10 +195,6 @@ static struct frag_statistic_ino frag_rank[SHOW_FRAG_FILES]; + #error posix_fadvise not available! + #endif + +-#ifndef HAVE_FALLOCATE64 +-#error fallocate64 not available! +-#endif /* ! HAVE_FALLOCATE64 */ +- + /* + * get_mount_point() - Get device's mount point. + * +@@ -1568,7 +1564,7 @@ static int file_defrag(const char *file, const struct stat64 *buf, + /* Allocate space for donor inode */ + orig_group_tmp = orig_group_head; + do { +- ret = fallocate64(donor_fd, 0, ++ ret = fallocate(donor_fd, 0, + (ext2_loff_t)orig_group_tmp->start->data.logical * block_size, + (ext2_loff_t)orig_group_tmp->len * block_size); + if (ret < 0) { +-- +2.38.1 + diff --git a/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch new file mode 100644 index 0000000000..20ed6ecb3b --- /dev/null +++ b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch @@ -0,0 +1,37 @@ +From 1a8aaa8ff7f4aca68b5ae964458e49ab16b4315f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 14 Dec 2022 20:56:44 -0800 +Subject: [PATCH] ext2fs: Use 64bit lseek when _FILE_OFFSET_BITS is 64 + +Use lseek() with 64bit off_t when _FILE_OFFSET_BITS is 64 +this fixes build with musl where there is no _llseek but lseek +is using off_t which is 64bit on musl + +Upstream-Status: Submitted [https://github.com/tytso/e2fsprogs/pull/129] +Signe-off-by: Khem Raj +--- + lib/ext2fs/llseek.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/ext2fs/llseek.c b/lib/ext2fs/llseek.c +index 922a0d56..45f21d09 100644 +--- a/lib/ext2fs/llseek.c ++++ b/lib/ext2fs/llseek.c +@@ -51,7 +51,7 @@ extern long long llseek (int fd, long long offset, int origin); + + #else /* ! HAVE_LLSEEK */ + +-#if SIZEOF_LONG == SIZEOF_LONG_LONG ++#if SIZEOF_LONG == SIZEOF_LONG_LONG || _FILE_OFFSET_BITS+0 == 64 + + #define my_llseek lseek + +@@ -69,7 +69,7 @@ static int _llseek (unsigned int, unsigned long, + + static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high, + unsigned long, offset_low,ext2_loff_t *,result, +- unsigned int, origin) ++ unsigned int, origin); + #endif + + static ext2_loff_t my_llseek (int fd, ext2_loff_t offset, int origin) diff --git a/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/e2fsprogs-fix-missing-check-for-permission-denied.patch b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/e2fsprogs-fix-missing-check-for-permission-denied.patch index 29078f9dd3..92bd0d0c1f 100644 --- a/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/e2fsprogs-fix-missing-check-for-permission-denied.patch +++ b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/e2fsprogs-fix-missing-check-for-permission-denied.patch @@ -1,4 +1,4 @@ -From 22d7557905534d9e1b39f7d2a6d2036a40bf0c4e Mon Sep 17 00:00:00 2001 +From cce489c96aa3f4272a19d2137c2a46b439636712 Mon Sep 17 00:00:00 2001 From: Jackie Huang Date: Wed, 10 Aug 2016 11:19:44 +0800 Subject: [PATCH] Fix missing check for permission denied. diff --git a/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch index 902a369eb0..d695580c92 100644 --- a/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch +++ b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs/quiet-debugfs.patch @@ -1,4 +1,4 @@ -From 5408b6463ee700a080a15102bccccdeb2615d734 Mon Sep 17 00:00:00 2001 +From 20bf59365646af0466c1910e8763b352380b26d6 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 23 Dec 2013 13:38:34 +0000 Subject: [PATCH] e2fsprogs: silence debugfs diff --git a/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb index 5b2d1921f0..ceceb7edcc 100644 --- a/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb +++ b/poky/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb @@ -5,6 +5,8 @@ SRC_URI += "file://remove.ldconfig.call.patch \ file://ptest.patch \ file://mkdir_p.patch \ file://extents.patch \ + file://0001-Add-option-to-enable-disable-largefile-support.patch \ + file://0001-ext2fs-Use-64bit-lseek-when-_FILE_OFFSET_BITS-is-64.patch \ " SRC_URI:append:class-native = " \ file://e2fsprogs-fix-missing-check-for-permission-denied.patch \ @@ -17,7 +19,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "v(?P\d+\.\d+(\.\d+)*)$" EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} \ --enable-elf-shlibs --disable-libuuid --disable-uuidd \ --disable-libblkid --enable-verbose-makecmds \ - --with-crond-dir=no" + --enable-largefile --with-crond-dir=no" EXTRA_OECONF:darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs" diff --git a/poky/meta/recipes-devtools/elfutils/elfutils_0.187.bb b/poky/meta/recipes-devtools/elfutils/elfutils_0.187.bb deleted file mode 100644 index 40c51c8814..0000000000 --- a/poky/meta/recipes-devtools/elfutils/elfutils_0.187.bb +++ /dev/null @@ -1,172 +0,0 @@ -SUMMARY = "Utilities and libraries for handling compiled object files" -HOMEPAGE = "https://sourceware.org/elfutils" -DESCRIPTION = "elfutils is a collection of utilities and libraries to read, create and modify ELF binary files, find and handle DWARF debug data, symbols, thread state and stacktraces for processes and core files on GNU/Linux." -SECTION = "base" -LICENSE = "GPL-2.0-only & GPL-2.0-or-later & LGPL-3.0-or-later & GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ - file://debuginfod/debuginfod-client.c;endline=28;md5=f0a7c3170776866ee94e8f9225a6ad79 \ - " -DEPENDS = "zlib virtual/libintl" -DEPENDS:append:libc-musl = " argp-standalone fts musl-obstack " -# The Debian patches below are from: -# http://ftp.de.debian.org/debian/pool/main/e/elfutils/elfutils_0.176-1.debian.tar.xz -SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \ - file://0001-dso-link-change.patch \ - file://0002-Fix-elf_cvt_gunhash-if-dest-and-src-are-same.patch \ - file://0003-fixheadercheck.patch \ - file://0006-Fix-build-on-aarch64-musl.patch \ - file://0001-libasm-may-link-with-libbz2-if-found.patch \ - file://0001-libelf-elf_end.c-check-data_list.data.d.d_buf-before.patch \ - file://0001-skip-the-test-when-gcc-not-deployed.patch \ - file://run-ptest \ - file://ptest.patch \ - file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \ - file://0001-tests-Add-libeu-to-tests-needing-error-API.patch \ - " -SRC_URI:append:libc-musl = " \ - file://0003-musl-utils.patch \ - file://0015-config-eu.am-do-not-use-Werror.patch \ - " -SRC_URI[sha256sum] = "e70b0dfbe610f90c4d1fe0d71af142a4e25c3c4ef9ebab8d2d72b65159d454c8" - -inherit autotools gettext ptest pkgconfig - -EXTRA_OECONF = "--program-prefix=eu-" - -BUILD_CFLAGS += "-Wno-error=stringop-overflow" - -DEPENDS_BZIP2 = "bzip2-replacement-native" -DEPENDS_BZIP2:class-target = "bzip2" - -PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'debuginfod', 'debuginfod libdebuginfod', '', d)}" -PACKAGECONFIG[bzip2] = "--with-bzlib,--without-bzlib,${DEPENDS_BZIP2}" -PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz" -PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd" -PACKAGECONFIG[libdebuginfod] = "--enable-libdebuginfod,--disable-libdebuginfod,curl" -PACKAGECONFIG[debuginfod] = "--enable-debuginfod,--disable-debuginfod,libarchive sqlite3 libmicrohttpd" - -RDEPENDS:${PN}-ptest += "libasm libelf bash make coreutils ${PN}-binutils iproute2-ss bsdtar gcc-symlinks binutils-symlinks libgcc-dev" - -EXTRA_OECONF:append:class-target = " --disable-tests-rpath" - -# symver functions not currently supported on microblaze -EXTRA_OECONF:append:class-target:microblaze = " --disable-symbol-versioning" - -RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-dbg glibc-dev" -INSANE_SKIP:${PN}-ptest = "debug-deps dev-deps" - -do_compile_ptest() { - cd ${B}/tests - oe_runmake buildtest-TESTS oecheck -} -PTEST_PARALLEL_MAKE = "" - -do_install_ptest() { - if [ ${PTEST_ENABLED} = "1" ]; then - # copy the files which needed by the cases - TEST_FILES="strip strip.o addr2line elfcmp objdump readelf size.o nm.o nm elflint elfcompress elfclassify stack unstrip" - install -d -m 755 ${D}${PTEST_PATH}/src - install -d -m 755 ${D}${PTEST_PATH}/lib - install -d -m 755 ${D}${PTEST_PATH}/libelf - install -d -m 755 ${D}${PTEST_PATH}/libdw - install -d -m 755 ${D}${PTEST_PATH}/libdwfl - install -d -m 755 ${D}${PTEST_PATH}/libdwelf - install -d -m 755 ${D}${PTEST_PATH}/libasm - install -d -m 755 ${D}${PTEST_PATH}/libcpu - install -d -m 755 ${D}${PTEST_PATH}/libebl - for test_file in ${TEST_FILES}; do - if [ -f ${B}/src/${test_file} ]; then - cp -r ${B}/src/${test_file} ${D}${PTEST_PATH}/src - fi - done - cp ${D}${libdir}/libelf-${PV}.so ${D}${PTEST_PATH}/libelf/libelf.so - cp ${D}${libdir}/libdw-${PV}.so ${D}${PTEST_PATH}/libdw/libdw.so - cp ${D}${libdir}/libasm-${PV}.so ${D}${PTEST_PATH}/libasm/libasm.so - cp ${B}/libcpu/libcpu.a ${D}${PTEST_PATH}/libcpu/ - cp ${B}/libebl/libebl.a ${D}${PTEST_PATH}/libebl/ - cp ${B}/lib/libeu.a ${D}${PTEST_PATH}/lib/ - cp ${S}/libelf/*.h ${D}${PTEST_PATH}/libelf/ - cp ${S}/libdw/*.h ${D}${PTEST_PATH}/libdw/ - cp ${S}/libdwfl/*.h ${D}${PTEST_PATH}/libdwfl/ - cp ${S}/libdwelf/*.h ${D}${PTEST_PATH}/libdwelf/ - cp ${S}/libasm/*.h ${D}${PTEST_PATH}/libasm/ - cp -r ${S}/tests/ ${D}${PTEST_PATH} - cp -r ${B}/tests/* ${D}${PTEST_PATH}/tests - cp -r ${B}/config.h ${D}${PTEST_PATH} - cp -r ${B}/backends ${D}${PTEST_PATH} - cp -r ${B}/debuginfod ${D}${PTEST_PATH} - sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile - find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {} - fi -} - -EXTRA_OEMAKE:class-native = "" -EXTRA_OEMAKE:class-nativesdk = "" - -BBCLASSEXTEND = "native nativesdk" - -# Package utilities separately -PACKAGES =+ "${PN}-binutils libelf libasm libdw libdebuginfod" - -# Shared libraries are licensed GPL-2.0-only or GPL-3.0-or-later, binaries -# GPL-3.0-or-later. According to NEWS file: -# "The license is now GPLv2/LGPLv3+ for the libraries and GPLv3+ for stand-alone -# programs. There is now also a formal CONTRIBUTING document describing how to -# submit patches." -LICENSE:${PN}-binutils = "GPL-3.0-or-later" -LICENSE:${PN} = "GPL-3.0-or-later" -LICENSE:libelf = "GPL-2.0-only | LGPL-3.0-or-later" -LICENSE:libasm = "GPL-2.0-only | LGPL-3.0-or-later" -LICENSE:libdw = "GPL-2.0-only | LGPL-3.0-or-later" -LICENSE:libdebuginfod = "GPL-2.0-or-later | LGPL-3.0-or-later" - -FILES:${PN}-binutils = "\ - ${bindir}/eu-addr2line \ - ${bindir}/eu-ld \ - ${bindir}/eu-nm \ - ${bindir}/eu-readelf \ - ${bindir}/eu-size \ - ${bindir}/eu-strip" - -FILES:libelf = "${libdir}/libelf-${PV}.so ${libdir}/libelf.so.*" -FILES:libasm = "${libdir}/libasm-${PV}.so ${libdir}/libasm.so.*" -FILES:libdw = "${libdir}/libdw-${PV}.so ${libdir}/libdw.so.* ${libdir}/elfutils/lib*" -FILES:libdebuginfod = "${libdir}/libdebuginfod-${PV}.so ${libdir}/libdebuginfod.so.*" -# Some packages have the version preceeding the .so instead properly -# versioned .so., so we need to reorder and repackage. -#FILES:${PN} += "${libdir}/*-${PV}.so ${base_libdir}/*-${PV}.so" -#FILES_SOLIBSDEV = "${libdir}/libasm.so ${libdir}/libdw.so ${libdir}/libelf.so" - -# The package contains symlinks that trip up insane -INSANE_SKIP:${MLPREFIX}libdw = "dev-so" -# The nlist binary in the tests uses explicitly minimal compiler flags -INSANE_SKIP:${PN}-ptest += "ldflags" - -# avoid stripping some generated binaries otherwise some of the tests such as test-nlist, -# run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail -INHIBIT_PACKAGE_STRIP_FILES = "\ - ${PKGD}${PTEST_PATH}/tests/test-nlist \ - ${PKGD}${PTEST_PATH}/tests/elfstrmerge \ - ${PKGD}${PTEST_PATH}/tests/backtrace-child \ - ${PKGD}${PTEST_PATH}/tests/backtrace-data \ - ${PKGD}${PTEST_PATH}/tests/backtrace-dwarf \ - ${PKGD}${PTEST_PATH}/tests/deleted \ - ${PKGD}${PTEST_PATH}/tests/dwfllines \ - ${PKGD}${PTEST_PATH}/src/strip \ - ${PKGD}${PTEST_PATH}/src/addr2line \ - ${PKGD}${PTEST_PATH}/src/elfcmp \ - ${PKGD}${PTEST_PATH}/src/objdump \ - ${PKGD}${PTEST_PATH}/src/readelf \ - ${PKGD}${PTEST_PATH}/src/nm \ - ${PKGD}${PTEST_PATH}/src/elflint \ - ${PKGD}${PTEST_PATH}/src/elfclassify \ - ${PKGD}${PTEST_PATH}/src/stack \ - ${PKGD}${PTEST_PATH}/src/unstrip \ - ${PKGD}${PTEST_PATH}/libelf/libelf.so \ - ${PKGD}${PTEST_PATH}/libdw/libdw.so \ - ${PKGD}${PTEST_PATH}/libasm/libasm.so \ - ${PKGD}${PTEST_PATH}/backends/libebl_i386.so \ - ${PKGD}${PTEST_PATH}/backends/libebl_x86_64.so \ -" - -PRIVATE_LIBS:${PN}-ptest = "libdw.so.1 libelf.so.1 libasm.so.1 libdebuginfod.so.1" diff --git a/poky/meta/recipes-devtools/elfutils/elfutils_0.188.bb b/poky/meta/recipes-devtools/elfutils/elfutils_0.188.bb new file mode 100644 index 0000000000..084908a38c --- /dev/null +++ b/poky/meta/recipes-devtools/elfutils/elfutils_0.188.bb @@ -0,0 +1,173 @@ +SUMMARY = "Utilities and libraries for handling compiled object files" +HOMEPAGE = "https://sourceware.org/elfutils" +DESCRIPTION = "elfutils is a collection of utilities and libraries to read, create and modify ELF binary files, find and handle DWARF debug data, symbols, thread state and stacktraces for processes and core files on GNU/Linux." +SECTION = "base" +LICENSE = "GPL-2.0-only & GPL-2.0-or-later & LGPL-3.0-or-later & GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ + file://debuginfod/debuginfod-client.c;endline=28;md5=f0a7c3170776866ee94e8f9225a6ad79 \ + " +DEPENDS = "zlib virtual/libintl" +DEPENDS:append:libc-musl = " argp-standalone fts musl-obstack " +# The Debian patches below are from: +# http://ftp.de.debian.org/debian/pool/main/e/elfutils/elfutils_0.176-1.debian.tar.xz +SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \ + file://run-ptest \ + file://0001-dso-link-change.patch \ + file://0002-Fix-elf_cvt_gunhash-if-dest-and-src-are-same.patch \ + file://0003-fixheadercheck.patch \ + file://0006-Fix-build-on-aarch64-musl.patch \ + file://0001-libasm-may-link-with-libbz2-if-found.patch \ + file://0001-libelf-elf_end.c-check-data_list.data.d.d_buf-before.patch \ + file://0001-skip-the-test-when-gcc-not-deployed.patch \ + file://ptest.patch \ + file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \ + " +SRC_URI:append:libc-musl = " \ + file://0003-musl-utils.patch \ + file://0015-config-eu.am-do-not-use-Werror.patch \ + " +SRC_URI[sha256sum] = "fb8b0e8d0802005b9a309c60c1d8de32dd2951b56f0c3a3cb56d21ce01595dff" + +inherit autotools gettext ptest pkgconfig + +EXTRA_OECONF = "--program-prefix=eu-" + +BUILD_CFLAGS += "-Wno-error=stringop-overflow" +# compatibility with curl 7.87; can be removed when elfutils upstream fixes the deprecation fails +CFLAGS:append = " -Wno-error=deprecated-declarations" + +DEPENDS_BZIP2 = "bzip2-replacement-native" +DEPENDS_BZIP2:class-target = "bzip2" + +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'debuginfod', 'debuginfod libdebuginfod', '', d)}" +PACKAGECONFIG[bzip2] = "--with-bzlib,--without-bzlib,${DEPENDS_BZIP2}" +PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz" +PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd" +PACKAGECONFIG[libdebuginfod] = "--enable-libdebuginfod,--disable-libdebuginfod,curl" +PACKAGECONFIG[debuginfod] = "--enable-debuginfod,--disable-debuginfod,libarchive sqlite3 libmicrohttpd" + +RDEPENDS:${PN}-ptest += "libasm libelf bash make coreutils ${PN}-binutils iproute2-ss bsdtar gcc-symlinks binutils-symlinks libgcc-dev" + +EXTRA_OECONF:append:class-target = " --disable-tests-rpath" + +# symver functions not currently supported on microblaze +EXTRA_OECONF:append:class-target:microblaze = " --disable-symbol-versioning" + +RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-dbg glibc-dev" +INSANE_SKIP:${PN}-ptest = "debug-deps dev-deps" + +do_compile_ptest() { + cd ${B}/tests + oe_runmake buildtest-TESTS oecheck +} +PTEST_PARALLEL_MAKE = "" + +do_install_ptest() { + if [ ${PTEST_ENABLED} = "1" ]; then + # copy the files which needed by the cases + TEST_FILES="strip strip.o addr2line elfcmp objdump readelf size.o nm.o nm elflint elfcompress elfclassify stack unstrip" + install -d -m 755 ${D}${PTEST_PATH}/src + install -d -m 755 ${D}${PTEST_PATH}/lib + install -d -m 755 ${D}${PTEST_PATH}/libelf + install -d -m 755 ${D}${PTEST_PATH}/libdw + install -d -m 755 ${D}${PTEST_PATH}/libdwfl + install -d -m 755 ${D}${PTEST_PATH}/libdwelf + install -d -m 755 ${D}${PTEST_PATH}/libasm + install -d -m 755 ${D}${PTEST_PATH}/libcpu + install -d -m 755 ${D}${PTEST_PATH}/libebl + for test_file in ${TEST_FILES}; do + if [ -f ${B}/src/${test_file} ]; then + cp -r ${B}/src/${test_file} ${D}${PTEST_PATH}/src + fi + done + cp ${D}${libdir}/libelf-${PV}.so ${D}${PTEST_PATH}/libelf/libelf.so + cp ${D}${libdir}/libdw-${PV}.so ${D}${PTEST_PATH}/libdw/libdw.so + cp ${D}${libdir}/libasm-${PV}.so ${D}${PTEST_PATH}/libasm/libasm.so + cp ${B}/libcpu/libcpu.a ${D}${PTEST_PATH}/libcpu/ + cp ${B}/libebl/libebl.a ${D}${PTEST_PATH}/libebl/ + cp ${B}/lib/libeu.a ${D}${PTEST_PATH}/lib/ + cp ${S}/libelf/*.h ${D}${PTEST_PATH}/libelf/ + cp ${S}/libdw/*.h ${D}${PTEST_PATH}/libdw/ + cp ${S}/libdwfl/*.h ${D}${PTEST_PATH}/libdwfl/ + cp ${S}/libdwelf/*.h ${D}${PTEST_PATH}/libdwelf/ + cp ${S}/libasm/*.h ${D}${PTEST_PATH}/libasm/ + cp -r ${S}/tests/ ${D}${PTEST_PATH} + cp -r ${B}/tests/* ${D}${PTEST_PATH}/tests + cp -r ${B}/config.h ${D}${PTEST_PATH} + cp -r ${B}/backends ${D}${PTEST_PATH} + cp -r ${B}/debuginfod ${D}${PTEST_PATH} + sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile + find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {} + fi +} + +EXTRA_OEMAKE:class-native = "" +EXTRA_OEMAKE:class-nativesdk = "" + +BBCLASSEXTEND = "native nativesdk" + +# Package utilities separately +PACKAGES =+ "${PN}-binutils libelf libasm libdw libdebuginfod" + +# Shared libraries are licensed GPL-2.0-only or GPL-3.0-or-later, binaries +# GPL-3.0-or-later. According to NEWS file: +# "The license is now GPLv2/LGPLv3+ for the libraries and GPLv3+ for stand-alone +# programs. There is now also a formal CONTRIBUTING document describing how to +# submit patches." +LICENSE:${PN}-binutils = "GPL-3.0-or-later" +LICENSE:${PN} = "GPL-3.0-or-later" +LICENSE:libelf = "GPL-2.0-only | LGPL-3.0-or-later" +LICENSE:libasm = "GPL-2.0-only | LGPL-3.0-or-later" +LICENSE:libdw = "GPL-2.0-only | LGPL-3.0-or-later" +LICENSE:libdebuginfod = "GPL-2.0-or-later | LGPL-3.0-or-later" + +FILES:${PN}-binutils = "\ + ${bindir}/eu-addr2line \ + ${bindir}/eu-ld \ + ${bindir}/eu-nm \ + ${bindir}/eu-readelf \ + ${bindir}/eu-size \ + ${bindir}/eu-strip" + +FILES:libelf = "${libdir}/libelf-${PV}.so ${libdir}/libelf.so.*" +FILES:libasm = "${libdir}/libasm-${PV}.so ${libdir}/libasm.so.*" +FILES:libdw = "${libdir}/libdw-${PV}.so ${libdir}/libdw.so.* ${libdir}/elfutils/lib*" +FILES:libdebuginfod = "${libdir}/libdebuginfod-${PV}.so ${libdir}/libdebuginfod.so.*" +# Some packages have the version preceeding the .so instead properly +# versioned .so., so we need to reorder and repackage. +#FILES:${PN} += "${libdir}/*-${PV}.so ${base_libdir}/*-${PV}.so" +#FILES_SOLIBSDEV = "${libdir}/libasm.so ${libdir}/libdw.so ${libdir}/libelf.so" + +# The package contains symlinks that trip up insane +INSANE_SKIP:${MLPREFIX}libdw = "dev-so" +# The nlist binary in the tests uses explicitly minimal compiler flags +INSANE_SKIP:${PN}-ptest += "ldflags" + +# avoid stripping some generated binaries otherwise some of the tests such as test-nlist, +# run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail +INHIBIT_PACKAGE_STRIP_FILES = "\ + ${PKGD}${PTEST_PATH}/tests/test-nlist \ + ${PKGD}${PTEST_PATH}/tests/elfstrmerge \ + ${PKGD}${PTEST_PATH}/tests/backtrace-child \ + ${PKGD}${PTEST_PATH}/tests/backtrace-data \ + ${PKGD}${PTEST_PATH}/tests/backtrace-dwarf \ + ${PKGD}${PTEST_PATH}/tests/deleted \ + ${PKGD}${PTEST_PATH}/tests/dwfllines \ + ${PKGD}${PTEST_PATH}/src/strip \ + ${PKGD}${PTEST_PATH}/src/addr2line \ + ${PKGD}${PTEST_PATH}/src/elfcmp \ + ${PKGD}${PTEST_PATH}/src/objdump \ + ${PKGD}${PTEST_PATH}/src/readelf \ + ${PKGD}${PTEST_PATH}/src/nm \ + ${PKGD}${PTEST_PATH}/src/elflint \ + ${PKGD}${PTEST_PATH}/src/elfclassify \ + ${PKGD}${PTEST_PATH}/src/stack \ + ${PKGD}${PTEST_PATH}/src/unstrip \ + ${PKGD}${PTEST_PATH}/libelf/libelf.so \ + ${PKGD}${PTEST_PATH}/libdw/libdw.so \ + ${PKGD}${PTEST_PATH}/libasm/libasm.so \ + ${PKGD}${PTEST_PATH}/backends/libebl_i386.so \ + ${PKGD}${PTEST_PATH}/backends/libebl_x86_64.so \ +" + +PRIVATE_LIBS:${PN}-ptest = "libdw.so.1 libelf.so.1 libasm.so.1 libdebuginfod.so.1" diff --git a/poky/meta/recipes-devtools/elfutils/files/0001-tests-Add-libeu-to-tests-needing-error-API.patch b/poky/meta/recipes-devtools/elfutils/files/0001-tests-Add-libeu-to-tests-needing-error-API.patch deleted file mode 100644 index 7c1bc87cbf..0000000000 --- a/poky/meta/recipes-devtools/elfutils/files/0001-tests-Add-libeu-to-tests-needing-error-API.patch +++ /dev/null @@ -1,147 +0,0 @@ -From c05c787070a390a2061bfcb845e1e35e8b1373b3 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 13 Sep 2022 09:33:00 -0700 -Subject: [PATCH] tests: Add libeu to tests needing error() API - -A local error() impelmentation is used when libc does not provide it, -therefore link in libeu.a which contains this function in tests needing -error() API - -Upstream-Status: Submitted [https://sourceware.org/pipermail/elfutils-devel/2022q3/005375.html] -Signed-off-by: Khem Raj ---- - tests/Makefile.am | 60 +++++++++++++++++++++++------------------------ - 1 file changed, 30 insertions(+), 30 deletions(-) - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 3943e17..1acc49b 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -638,17 +638,17 @@ libeu = ../lib/libeu.a - arextract_LDADD = $(libelf) - arsymtest_LDADD = $(libelf) - newfile_LDADD = $(libelf) --saridx_LDADD = $(libelf) -+saridx_LDADD = $(libeu) $(libelf) - scnnames_LDADD = $(libelf) --sectiondump_LDADD = $(libelf) -+sectiondump_LDADD = $(libeu) $(libelf) - showptable_LDADD = $(libelf) - hash_LDADD = $(libelf) - test_nlist_CFLAGS =-g -O0 $(EXTRA_NLIST_CFLAGS) - test_nlist_LDADD = $(libelf) - msg_tst_LDADD = $(libelf) - newscn_LDADD = $(libelf) --early_offscn_LDADD = $(libelf) --ecp_LDADD = $(libelf) -+early_offscn_LDADD = $(libeu) $(libelf) -+ecp_LDADD = $(libeu) $(libelf) - update1_LDADD = $(libelf) - update2_LDADD = $(libelf) - update3_LDADD = $(libdw) $(libelf) -@@ -662,12 +662,12 @@ get_files_LDADD = $(libdw) $(libelf) - next_files_LDADD = $(libdw) $(libelf) - get_aranges_LDADD = $(libdw) $(libelf) - allfcts_LDADD = $(libdw) $(libelf) --line2addr_LDADD = $(libdw) $(argp_LDADD) --addrscopes_LDADD = $(libdw) $(argp_LDADD) --funcscopes_LDADD = $(libdw) $(argp_LDADD) --funcretval_LDADD = $(libdw) $(argp_LDADD) --allregs_LDADD = $(libdw) $(argp_LDADD) --find_prologues_LDADD = $(libdw) $(argp_LDADD) -+line2addr_LDADD = $(libeu) $(libdw) $(argp_LDADD) -+addrscopes_LDADD = $(libeu) $(libdw) $(argp_LDADD) -+funcscopes_LDADD = $(libeu) $(libdw) $(argp_LDADD) -+funcretval_LDADD = $(libeu) $(libdw) $(argp_LDADD) -+allregs_LDADD = $(libeu) $(libdw) $(argp_LDADD) -+find_prologues_LDADD = $(libeu) $(libdw) $(argp_LDADD) - #show_ciefde_LDADD = ../libdwarf/libdwarf.so $(libelf) - asm_tst1_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) - asm_tst2_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) -@@ -678,19 +678,19 @@ asm_tst6_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) - asm_tst7_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) - asm_tst8_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) - asm_tst9_LDADD = $(libasm) $(libebl) $(libelf) $(libdw) --dwflmodtest_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) --rdwrmmap_LDADD = $(libelf) -+dwflmodtest_LDADD = $(libeu) $(libdw) $(libebl) $(libelf) $(argp_LDADD) -+rdwrmmap_LDADD = $(libeu) $(libelf) - dwfl_bug_addr_overflow_LDADD = $(libdw) $(libebl) $(libelf) - arls_LDADD = $(libelf) --dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) -+dwfl_bug_fd_leak_LDADD = $(libeu) $(libdw) $(libebl) $(libelf) - dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) --dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) --dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) -+dwfl_bug_getmodules_LDADD = $(libeu) $(libdw) $(libebl) $(libelf) -+dwfl_addr_sect_LDADD = $(libeu) $(libdw) $(libebl) $(libelf) $(argp_LDADD) - dwarf_getmacros_LDADD = $(libdw) - dwarf_ranges_LDADD = $(libdw) - dwarf_getstring_LDADD = $(libdw) - addrcfi_LDADD = $(libdw) $(libebl) $(libelf) $(argp_LDADD) --dwarfcfi_LDADD = $(libdw) $(libelf) -+dwarfcfi_LDADD = $(libeu) $(libdw) $(libelf) - test_flag_nobits_LDADD = $(libelf) - rerequest_tag_LDADD = $(libdw) - alldts_LDADD = $(libdw) $(libelf) -@@ -699,35 +699,35 @@ typeiter2_LDADD = $(libdw) $(libelf) - low_high_pc_LDADD = $(libdw) $(libelf) $(argp_LDADD) - test_elf_cntl_gelf_getshdr_LDADD = $(libelf) - dwflsyms_LDADD = $(libdw) $(libelf) $(argp_LDADD) --dwfllines_LDADD = $(libdw) $(libelf) $(argp_LDADD) --dwfl_report_elf_align_LDADD = $(libdw) -+dwfllines_LDADD = $(libeu) $(libdw) $(libelf) $(argp_LDADD) -+dwfl_report_elf_align_LDADD = $(libeu) $(libdw) - dwfl_report_segment_contiguous_LDADD = $(libdw) $(libebl) $(libelf) --varlocs_LDADD = $(libdw) $(libelf) $(argp_LDADD) --backtrace_LDADD = $(libdw) $(libelf) $(argp_LDADD) -+varlocs_LDADD = $(libeu) $(libdw) $(libelf) $(argp_LDADD) -+backtrace_LDADD = $(libeu) $(libdw) $(libelf) $(argp_LDADD) - # backtrace-child-biarch also uses those *_CFLAGS and *_LDLAGS variables: - backtrace_child_CFLAGS = $(fpie_CFLAGS) - backtrace_child_LDFLAGS = -pie -pthread - backtrace_child_biarch_SOURCES = backtrace-child.c --backtrace_data_LDADD = $(libdw) $(libelf) -+backtrace_data_LDADD = $(libeu) $(libdw) $(libelf) - backtrace_dwarf_CFLAGS = -Wno-unused-parameter --backtrace_dwarf_LDADD = $(libdw) $(libelf) --debuglink_LDADD = $(libdw) $(libelf) --debugaltlink_LDADD = $(libdw) $(libelf) --buildid_LDADD = $(libdw) $(libelf) -+backtrace_dwarf_LDADD = $(libeu) $(libdw) $(libelf) -+debuglink_LDADD = $(libeu) $(libdw) $(libelf) -+debugaltlink_LDADD = $(libeu) $(libdw) $(libelf) -+buildid_LDADD = $(libeu) $(libdw) $(libelf) - deleted_LDADD = ./deleted-lib.so - deleted_lib_so_LDFLAGS = -shared - deleted_lib_so_CFLAGS = $(fpic_CFLAGS) -fasynchronous-unwind-tables - aggregate_size_LDADD = $(libdw) $(libelf) $(argp_LDADD) - peel_type_LDADD = $(libdw) $(libelf) $(argp_LDADD) --vdsosyms_LDADD = $(libdw) $(libelf) --getsrc_die_LDADD = $(libdw) $(libelf) -+vdsosyms_LDADD = $(libeu) $(libdw) $(libelf) -+getsrc_die_LDADD = $(libeu) $(libdw) $(libelf) - strptr_LDADD = $(libelf) - newdata_LDADD = $(libelf) - elfstrtab_LDADD = $(libelf) --dwfl_proc_attach_LDADD = $(libdw) -+dwfl_proc_attach_LDADD = $(libeu) $(libdw) - dwfl_proc_attach_LDFLAGS = -pthread -rdynamic $(AM_LDFLAGS) - elfshphehdr_LDADD =$(libelf) --elfstrmerge_LDADD = $(libdw) $(libelf) -+elfstrmerge_LDADD = $(libeu) $(libdw) $(libelf) - dwelfgnucompressed_LDADD = $(libelf) $(libdw) - elfgetchdr_LDADD = $(libelf) $(libdw) - elfgetzdata_LDADD = $(libelf) -@@ -743,7 +743,7 @@ get_units_split_LDADD = $(libdw) - attr_integrate_skel_LDADD = $(libdw) - all_dwarf_ranges_LDADD = $(libdw) - unit_info_LDADD = $(libdw) --next_cfi_LDADD = $(libelf) $(libdw) -+next_cfi_LDADD = $(libeu) $(libelf) $(libdw) - elfcopy_LDADD = $(libelf) - addsections_LDADD = $(libelf) - debuginfod_build_id_find_LDADD = $(libelf) $(libdw) --- -2.37.3 - diff --git a/poky/meta/recipes-devtools/elfutils/files/0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch b/poky/meta/recipes-devtools/elfutils/files/0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch index c494d7f2e5..a2c0b90227 100644 --- a/poky/meta/recipes-devtools/elfutils/files/0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch +++ b/poky/meta/recipes-devtools/elfutils/files/0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch @@ -1,4 +1,4 @@ -From 22e0e1c01ec680a2970f4d5ca9e47f90259cbdcf Mon Sep 17 00:00:00 2001 +From e355ca3b8ddcc6e73ee140f53d25634afdaec0da Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 23 Jun 2020 07:49:35 +0000 Subject: [PATCH] tests/Makefile.am: compile test_nlist with standard CFLAGS @@ -14,10 +14,10 @@ Signed-off-by: Alexander Kanavin 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am -index a2dfd43..40a0228 100644 +index 2ade5d9..f85cdba 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am -@@ -90,7 +90,7 @@ endif +@@ -98,7 +98,7 @@ endif test-nlist$(EXEEXT): test-nlist.c $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) \ @@ -25,4 +25,4 @@ index a2dfd43..40a0228 100644 + $(CFLAGS) $(GCOV_FLAGS) -o $@ $< $(test_nlist_LDADD) TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \ - update1 update2 update3 update4 \ + run-ar-N.sh \ diff --git a/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0001-configure-use-AC_SYS_LARGEFILE.patch b/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0001-configure-use-AC_SYS_LARGEFILE.patch new file mode 100644 index 0000000000..75c91f51a7 --- /dev/null +++ b/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0001-configure-use-AC_SYS_LARGEFILE.patch @@ -0,0 +1,43 @@ +From fef3b16dba2c5f6ad88951b80cdfbedd423e80a0 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 7 Dec 2022 20:16:52 -0800 +Subject: [PATCH v3 1/3] configure: use AC_SYS_LARGEFILE + +The autoconf macro AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS=64 +where necessary to ensure that off_t and all interfaces using off_t +are 64bit, even on 32bit systems. + +Pass -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=66 via CFLAGS + +Upstream-Status: Submitted [https://lore.kernel.org/linux-erofs/20221215064758.93821-1-raj.khem@gmail.com/T/#t] +Signed-off-by: Khem Raj +--- + configure.ac | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/configure.ac b/configure.ac +index a736ff0..e8bb003 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -13,6 +13,8 @@ AC_CONFIG_MACRO_DIR([m4]) + AC_CONFIG_AUX_DIR(config) + AM_INIT_AUTOMAKE([foreign -Wall]) + ++AC_SYS_LARGEFILE ++ + # Checks for programs. + AM_PROG_AR + AC_PROG_CC +@@ -319,6 +321,9 @@ if test "x$enable_lzma" = "xyes"; then + CPPFLAGS="${saved_CPPFLAGS}" + fi + ++# Enable 64-bit off_t ++CFLAGS+=" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" ++ + # Set up needed symbols, conditionals and compiler/linker flags + AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"]) + AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"]) +-- +2.39.0 + diff --git a/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch b/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch new file mode 100644 index 0000000000..d12bebbf87 --- /dev/null +++ b/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch @@ -0,0 +1,109 @@ +From 856189c324834b838f0e9cfc0d2e05f12518f264 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 7 Dec 2022 22:17:35 -0800 +Subject: [PATCH v3 2/3] erofs: replace [l]stat64 by equivalent [l]stat + +Upstream-Status: Submitted [https://lore.kernel.org/linux-erofs/20221215064758.93821-2-raj.khem@gmail.com/T/#u] +Signed-off-by: Khem Raj +--- + lib/inode.c | 10 +++++----- + lib/xattr.c | 4 ++-- + mkfs/main.c | 4 ++-- + 3 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/lib/inode.c b/lib/inode.c +index f192510..38003fc 100644 +--- a/lib/inode.c ++++ b/lib/inode.c +@@ -773,7 +773,7 @@ static u32 erofs_new_encode_dev(dev_t dev) + + #ifdef WITH_ANDROID + int erofs_droid_inode_fsconfig(struct erofs_inode *inode, +- struct stat64 *st, ++ struct stat *st, + const char *path) + { + /* filesystem_config does not preserve file type bits */ +@@ -818,7 +818,7 @@ int erofs_droid_inode_fsconfig(struct erofs_inode *inode, + } + #else + static int erofs_droid_inode_fsconfig(struct erofs_inode *inode, +- struct stat64 *st, ++ struct stat *st, + const char *path) + { + return 0; +@@ -826,7 +826,7 @@ static int erofs_droid_inode_fsconfig(struct erofs_inode *inode, + #endif + + static int erofs_fill_inode(struct erofs_inode *inode, +- struct stat64 *st, ++ struct stat *st, + const char *path) + { + int err = erofs_droid_inode_fsconfig(inode, st, path); +@@ -910,7 +910,7 @@ static struct erofs_inode *erofs_new_inode(void) + /* get the inode from the (source) path */ + static struct erofs_inode *erofs_iget_from_path(const char *path, bool is_src) + { +- struct stat64 st; ++ struct stat st; + struct erofs_inode *inode; + int ret; + +@@ -918,7 +918,7 @@ static struct erofs_inode *erofs_iget_from_path(const char *path, bool is_src) + if (!is_src) + return ERR_PTR(-EINVAL); + +- ret = lstat64(path, &st); ++ ret = lstat(path, &st); + if (ret) + return ERR_PTR(-errno); + +diff --git a/lib/xattr.c b/lib/xattr.c +index 71ffe3e..fd0e728 100644 +--- a/lib/xattr.c ++++ b/lib/xattr.c +@@ -467,7 +467,7 @@ static int erofs_count_all_xattrs_from_path(const char *path) + { + int ret; + DIR *_dir; +- struct stat64 st; ++ struct stat st; + + _dir = opendir(path); + if (!_dir) { +@@ -502,7 +502,7 @@ static int erofs_count_all_xattrs_from_path(const char *path) + goto fail; + } + +- ret = lstat64(buf, &st); ++ ret = lstat(buf, &st); + if (ret) { + ret = -errno; + goto fail; +diff --git a/mkfs/main.c b/mkfs/main.c +index d2c9830..5279805 100644 +--- a/mkfs/main.c ++++ b/mkfs/main.c +@@ -581,7 +581,7 @@ int main(int argc, char **argv) + struct erofs_buffer_head *sb_bh; + struct erofs_inode *root_inode; + erofs_nid_t root_nid; +- struct stat64 st; ++ struct stat st; + erofs_blk_t nblocks; + struct timeval t; + char uuid_str[37] = "not available"; +@@ -609,7 +609,7 @@ int main(int argc, char **argv) + return 1; + } + +- err = lstat64(cfg.c_src_path, &st); ++ err = lstat(cfg.c_src_path, &st); + if (err) + return 1; + if (!S_ISDIR(st.st_mode)) { +-- +2.39.0 + diff --git a/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch b/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch new file mode 100644 index 0000000000..97faa5d673 --- /dev/null +++ b/poky/meta/recipes-devtools/erofs-utils/erofs-utils/0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch @@ -0,0 +1,41 @@ +From 8f8cbc7b773da63bce8226249784ba6824635c9c Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 7 Dec 2022 20:19:27 -0800 +Subject: [PATCH v3 3/3] internal.h: Make LFS mandatory for all usecases + +erosfs depend on the consistent use of a 64bit offset +type, force downstreams to use transparent LFS (_FILE_OFFSET_BITS=64), +so that it becomes impossible for them to use 32bit interfaces. + +Upstream-Status: Submitted [https://lore.kernel.org/linux-erofs/20221215064758.93821-3-raj.khem@gmail.com/T/#u] +Signed-off-by: Khem Raj +--- + include/erofs/internal.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/include/erofs/internal.h b/include/erofs/internal.h +index 6a70f11..d3b2986 100644 +--- a/include/erofs/internal.h ++++ b/include/erofs/internal.h +@@ -21,6 +21,7 @@ typedef unsigned short umode_t; + + #include "erofs_fs.h" + #include ++#include /* for off_t definition */ + + #ifndef PATH_MAX + #define PATH_MAX 4096 /* # chars in a path name including nul */ +@@ -104,6 +105,10 @@ struct erofs_sb_info { + }; + }; + ++ ++/* make sure that any user of the erofs headers has atleast 64bit off_t type */ ++extern int erofs_assert_largefile[sizeof(off_t)-8]; ++ + /* global sbi */ + extern struct erofs_sb_info sbi; + +-- +2.39.0 + diff --git a/poky/meta/recipes-devtools/erofs-utils/erofs-utils_1.5.bb b/poky/meta/recipes-devtools/erofs-utils/erofs-utils_1.5.bb index b9a97b3e53..6ce5843570 100644 --- a/poky/meta/recipes-devtools/erofs-utils/erofs-utils_1.5.bb +++ b/poky/meta/recipes-devtools/erofs-utils/erofs-utils_1.5.bb @@ -6,7 +6,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=73001d804ea1e3d84365f652242cca20" HOMEPAGE = "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/tree/README" SRCREV = "a2821a66b42aee5430bccee82c280e38d1e9ab29" -SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git;branch=master" +SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git;branch=master \ + file://0001-configure-use-AC_SYS_LARGEFILE.patch \ + file://0002-erofs-replace-l-stat64-by-equivalent-l-stat.patch \ + file://0003-internal.h-Make-LFS-mandatory-for-all-usecases.patch \ + " UPSTREAM_CHECK_GITTAGREGEX = "v(?P(\d+(\.\d+)+))" @@ -19,7 +23,7 @@ inherit pkgconfig autotools PACKAGECONFIG ??= "lz4" PACKAGECONFIG[lz4] = "--enable-lz4,--disable-lz4,lz4" -EXTRA_OECONF = "${PACKAGECONFIG_CONFARGS} --disable-fuse" +EXTRA_OECONF = "${PACKAGECONFIG_CONFARGS} --disable-fuse --enable-largefile" CFLAGS:append:powerpc64le = " -D__SANE_USERSPACE_TYPES__" diff --git a/poky/meta/recipes-devtools/fdisk/gptfdisk/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch b/poky/meta/recipes-devtools/fdisk/gptfdisk/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch new file mode 100644 index 0000000000..218d9d6713 --- /dev/null +++ b/poky/meta/recipes-devtools/fdisk/gptfdisk/0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch @@ -0,0 +1,59 @@ +From 5d5e76d369a412bfb3d2cebb5fc0a7509cef878d Mon Sep 17 00:00:00 2001 +From: Rod Smith +Date: Fri, 15 Apr 2022 18:10:14 -0400 +Subject: [PATCH] Fix failure & crash of sgdisk when compiled with latest popt + (commit 740; presumably eventually release 1.19) + +Upstream-Status: Backport [https://sourceforge.net/p/gptfdisk/code/ci/5d5e76d369a412bfb3d2cebb5fc0a7509cef878d/] +Signed-off-by: Alexander Kanavin +--- + NEWS | 8 ++++++++ + gptcl.cc | 2 +- + support.h | 2 +- + 3 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/NEWS b/NEWS +index c7add56..9e153fd 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,11 @@ ++1.0.10 (?/??/2022): ++------------------- ++ ++- Fixed problem that caused sgdisk to crash with errors about being unable ++ to read the disk's partition table when compiled with the latest popt ++ (commit 740, which is pre-release as I type; presumably version 1.19 and ++ later once released). ++ + 1.0.9 (4/14/2022): + ------------------ + +diff --git a/gptcl.cc b/gptcl.cc +index 34c9421..0d578eb 100644 +--- a/gptcl.cc ++++ b/gptcl.cc +@@ -155,7 +155,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { + } // while + + // Assume first non-option argument is the device filename.... +- device = (char*) poptGetArg(poptCon); ++ device = strdup((char*) poptGetArg(poptCon)); + poptResetContext(poptCon); + + if (device != NULL) { +diff --git a/support.h b/support.h +index 8ba9ad1..f91f1bc 100644 +--- a/support.h ++++ b/support.h +@@ -8,7 +8,7 @@ + #include + #include + +-#define GPTFDISK_VERSION "1.0.9" ++#define GPTFDISK_VERSION "1.0.9.1" + + #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) + // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 +-- +2.30.2 + diff --git a/poky/meta/recipes-devtools/fdisk/gptfdisk/0001-Use-64bit-time_t-on-linux-as-well.patch b/poky/meta/recipes-devtools/fdisk/gptfdisk/0001-Use-64bit-time_t-on-linux-as-well.patch new file mode 100644 index 0000000000..80e6f1bc9c --- /dev/null +++ b/poky/meta/recipes-devtools/fdisk/gptfdisk/0001-Use-64bit-time_t-on-linux-as-well.patch @@ -0,0 +1,32 @@ +From cbdbabcc14e4ae4debcc64e41c0bb97d47b4eeef Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 12 Dec 2022 12:50:07 -0800 +Subject: [PATCH] Use 64bit time_t on linux as well + +Alias 64bit version of stat functions to original functions +we are already passing -D_FILE_OFFSET_BITS=64 in linux Makefile + +Upstream-Status: Submitted [https://sourceforge.net/p/gptfdisk/code/merge-requests/29/] +Signed-off-by: Khem Raj +--- + diskio-unix.cc | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/diskio-unix.cc b/diskio-unix.cc +index 7780aeb..0897c56 100644 +--- a/diskio-unix.cc ++++ b/diskio-unix.cc +@@ -37,8 +37,12 @@ + + using namespace std; + +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__linux__) + #define off64_t off_t ++#define stat64 stat ++#define fstat64 fstat ++#define lstat64 lstat ++#define lseek64 lseek + #endif + + // Returns the official "real" name for a shortened version of same. diff --git a/poky/meta/recipes-devtools/fdisk/gptfdisk_1.0.9.bb b/poky/meta/recipes-devtools/fdisk/gptfdisk_1.0.9.bb index 2c093c20ae..66935b7fbb 100644 --- a/poky/meta/recipes-devtools/fdisk/gptfdisk_1.0.9.bb +++ b/poky/meta/recipes-devtools/fdisk/gptfdisk_1.0.9.bb @@ -10,6 +10,8 @@ DEPENDS = "util-linux" SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${PV}/${BP}.tar.gz \ file://0001-gptcurses-correctly-include-curses.h.patch \ file://0001-Updated-guid.cc-to-deal-with-minor-change-in-libuuid.patch \ + file://0001-Fix-failure-crash-of-sgdisk-when-compiled-with-lates.patch \ + file://0001-Use-64bit-time_t-on-linux-as-well.patch \ " SRC_URI[sha256sum] = "dafead2693faeb8e8b97832b23407f6ed5b3219bc1784f482dd855774e2d50c2" diff --git a/poky/meta/recipes-devtools/file/file_5.43.bb b/poky/meta/recipes-devtools/file/file_5.43.bb deleted file mode 100644 index 102d0fda26..0000000000 --- a/poky/meta/recipes-devtools/file/file_5.43.bb +++ /dev/null @@ -1,54 +0,0 @@ -SUMMARY = "File classification tool" -DESCRIPTION = "File attempts to classify files depending \ -on their contents and prints a description if a match is found." -HOMEPAGE = "http://www.darwinsys.com/file/" -SECTION = "console/utils" - -# two clause BSD -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://COPYING;beginline=2;md5=0251eaec1188b20d9a72c502ecfdda1b" - -DEPENDS = "file-replacement-native" -DEPENDS:class-native = "bzip2-replacement-native" - -SRC_URI = "git://github.com/file/file.git;branch=master;protocol=https" - -SRCREV = "011778a2877f75597ed83c1a2716d917770920ee" -S = "${WORKDIR}/git" - -inherit autotools update-alternatives - -PACKAGECONFIG ??= "bz2 lzma zlib" -PACKAGECONFIG[bz2] = "--enable-bzlib, --disable-bzlib, bzip2" -PACKAGECONFIG[lzma] = "--enable-xzlib, --disable-xzlib, xz" -PACKAGECONFIG[zlib] = "--enable-zlib, --disable-zlib, zlib" - -EXTRA_OECONF += "--disable-libseccomp" - -ALTERNATIVE:${PN} = "file" -ALTERNATIVE_LINK_NAME[file] = "${bindir}/file" - -EXTRA_OEMAKE:append:class-target = " -e FILE_COMPILE=${STAGING_BINDIR_NATIVE}/file-native/file" -EXTRA_OEMAKE:append:class-nativesdk = " -e FILE_COMPILE=${STAGING_BINDIR_NATIVE}/file-native/file" - -FILES:${PN} += "${datadir}/misc/*.mgc" - -do_compile:append:class-native() { - oe_runmake check -} - -do_install:append:class-native() { - create_cmdline_wrapper ${D}/${bindir}/file \ - --magic-file ${datadir}/misc/magic.mgc -} - -do_install:append:class-nativesdk() { - create_cmdline_wrapper ${D}/${bindir}/file \ - --magic-file ${datadir}/misc/magic.mgc -} - -BBCLASSEXTEND = "native nativesdk" -PROVIDES:append:class-native = " file-replacement-native" -# Don't use NATIVE_PACKAGE_PATH_SUFFIX as that hides libmagic from anyone who -# depends on file-replacement-native. -bindir:append:class-native = "/file-native" diff --git a/poky/meta/recipes-devtools/file/file_5.44.bb b/poky/meta/recipes-devtools/file/file_5.44.bb new file mode 100644 index 0000000000..b3d821518a --- /dev/null +++ b/poky/meta/recipes-devtools/file/file_5.44.bb @@ -0,0 +1,54 @@ +SUMMARY = "File classification tool" +DESCRIPTION = "File attempts to classify files depending \ +on their contents and prints a description if a match is found." +HOMEPAGE = "http://www.darwinsys.com/file/" +SECTION = "console/utils" + +# two clause BSD +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://COPYING;beginline=2;md5=0251eaec1188b20d9a72c502ecfdda1b" + +DEPENDS = "file-replacement-native" +DEPENDS:class-native = "bzip2-replacement-native" + +SRC_URI = "git://github.com/file/file.git;branch=master;protocol=https" + +SRCREV = "b92eed41b1bc0739c5c5d70c444e0c574429321b" +S = "${WORKDIR}/git" + +inherit autotools update-alternatives + +PACKAGECONFIG ??= "bz2 lzma zlib" +PACKAGECONFIG[bz2] = "--enable-bzlib, --disable-bzlib, bzip2" +PACKAGECONFIG[lzma] = "--enable-xzlib, --disable-xzlib, xz" +PACKAGECONFIG[zlib] = "--enable-zlib, --disable-zlib, zlib" + +EXTRA_OECONF += "--disable-libseccomp" + +ALTERNATIVE:${PN} = "file" +ALTERNATIVE_LINK_NAME[file] = "${bindir}/file" + +EXTRA_OEMAKE:append:class-target = " -e FILE_COMPILE=${STAGING_BINDIR_NATIVE}/file-native/file" +EXTRA_OEMAKE:append:class-nativesdk = " -e FILE_COMPILE=${STAGING_BINDIR_NATIVE}/file-native/file" + +FILES:${PN} += "${datadir}/misc/*.mgc" + +do_compile:append:class-native() { + oe_runmake check +} + +do_install:append:class-native() { + create_cmdline_wrapper ${D}/${bindir}/file \ + --magic-file ${datadir}/misc/magic.mgc +} + +do_install:append:class-nativesdk() { + create_cmdline_wrapper ${D}/${bindir}/file \ + --magic-file ${datadir}/misc/magic.mgc +} + +BBCLASSEXTEND = "native nativesdk" +PROVIDES:append:class-native = " file-replacement-native" +# Don't use NATIVE_PACKAGE_PATH_SUFFIX as that hides libmagic from anyone who +# depends on file-replacement-native. +bindir:append:class-native = "/file-native" diff --git a/poky/meta/recipes-devtools/git/git_2.38.1.bb b/poky/meta/recipes-devtools/git/git_2.38.1.bb deleted file mode 100644 index ef64dba7ac..0000000000 --- a/poky/meta/recipes-devtools/git/git_2.38.1.bb +++ /dev/null @@ -1,169 +0,0 @@ -SUMMARY = "Distributed version control system" -HOMEPAGE = "http://git-scm.com" -DESCRIPTION = "Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency." -SECTION = "console/utils" -LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & MIT & BSL-1.0 & LGPL-2.1-or-later" -DEPENDS = "openssl zlib" - -PROVIDES:append:class-native = " git-replacement-native" - -SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \ - file://fixsort.patch \ - file://0001-config.mak.uname-do-not-force-RHEL-7-specific-build-.patch \ - " - -S = "${WORKDIR}/git-${PV}" - -LIC_FILES_CHKSUM = "\ - file://COPYING;md5=7c0d7ef03a7eb04ce795b0f60e68e7e1 \ - file://reftable/LICENSE;md5=1a6424cafc4c9c88c689848e165af33b \ - file://sha1dc/LICENSE.txt;md5=9bbe4c990a9e98ea4b98ef5d3bcb8a7a \ - file://compat/nedmalloc/License.txt;md5=e4224ccaecb14d942c71d31bef20d78c \ - file://compat/inet_ntop.c;md5=76593c6f74e8ced5b24520175688d59b;endline=16 \ - file://compat/obstack.h;md5=08ad25fee5428cd879ceef451ce3a22e;endline=18 \ - file://compat/poll/poll.h;md5=9fc00170a53b8e3e52157c91ac688dd1;endline=19 \ - file://compat/regex/regex.h;md5=30cc8af0e6f0f8a25acec6d8783bb763;beginline=4;endline=22 \ -" - -CVE_PRODUCT = "git-scm:git" - -# This is about a manpage not mentioning --mirror may "leak" information -# in mirrored git repos. Most OE users wouldn't build the docs and -# we don't see this as a major issue for our general users/usecases. -CVE_CHECK_IGNORE += "CVE-2022-24975" - -PACKAGECONFIG ??= "expat curl" -PACKAGECONFIG[cvsserver] = "" -PACKAGECONFIG[svn] = "" -PACKAGECONFIG[manpages] = ",,asciidoc-native xmlto-native" -PACKAGECONFIG[curl] = "--with-curl,--without-curl,curl" -PACKAGECONFIG[expat] = "--with-expat,--without-expat,expat" - -EXTRA_OECONF = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl \ - --without-tcltk \ - --without-iconv \ -" -EXTRA_OECONF:append:class-nativesdk = " --with-gitconfig=/etc/gitconfig " - -# Needs brokensep as this doesn't use automake -inherit autotools-brokensep perlnative bash-completion manpages - -EXTRA_OEMAKE = "NO_PYTHON=1 CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'" -EXTRA_OEMAKE += "'PERL_PATH=/usr/bin/env perl'" -EXTRA_OEMAKE += "COMPUTE_HEADER_DEPENDENCIES=no" -EXTRA_OEMAKE:append:class-native = " NO_CROSS_DIRECTORY_HARDLINKS=1" - -do_compile:prepend () { - # Remove perl/perl.mak to fix the out-of-date perl.mak error - # during rebuild - rm -f perl/perl.mak - - if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then - oe_runmake man - fi -} - -do_install () { - oe_runmake install DESTDIR="${D}" bindir=${bindir} \ - template_dir=${datadir}/git-core/templates - - install -d ${D}/${datadir}/bash-completion/completions/ - install -m 644 ${S}/contrib/completion/git-completion.bash ${D}/${datadir}/bash-completion/completions/git - - if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then - # Needs to be serial with make 4.4 due to https://savannah.gnu.org/bugs/index.php?63362 - make install-man DESTDIR="${D}" - fi -} - -perl_native_fixup () { - sed -i -e 's#${STAGING_BINDIR_NATIVE}/perl-native/#${bindir}/#' \ - -e 's#${libdir}/perl-native/#${libdir}/#' \ - ${@d.getVar("PERLTOOLS").replace(' /',d.getVar('D') + '/')} - - if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'cvsserver', d)}" ]; then - # Only install the git cvsserver command if explicitly requested - # as it requires the DBI Perl module, which does not exist in - # OE-Core. - rm ${D}${libexecdir}/git-core/git-cvsserver \ - ${D}${bindir}/git-cvsserver - fi - - if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'svn', d)}" ]; then - # Only install the git svn command and all Git::SVN Perl modules - # if explicitly requested as they require the SVN::Core Perl - # module, which does not exist in OE-Core. - rm -r ${D}${libexecdir}/git-core/git-svn \ - ${D}${datadir}/perl5/Git/SVN* - fi -} - -REL_GIT_EXEC_PATH = "${@os.path.relpath(libexecdir, bindir)}/git-core" -REL_GIT_TEMPLATE_DIR = "${@os.path.relpath(datadir, bindir)}/git-core/templates" - -do_install:append:class-target () { - perl_native_fixup -} - -do_install:append:class-native() { - create_wrapper ${D}${bindir}/git \ - GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \ - GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR} -} - -do_install:append:class-nativesdk() { - create_wrapper ${D}${bindir}/git \ - GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \ - GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR} - perl_native_fixup -} - -FILES:${PN} += "${datadir}/git-core ${libexecdir}/git-core/" - -PERLTOOLS = " \ - ${bindir}/git-cvsserver \ - ${libexecdir}/git-core/git-add--interactive \ - ${libexecdir}/git-core/git-archimport \ - ${libexecdir}/git-core/git-cvsexportcommit \ - ${libexecdir}/git-core/git-cvsimport \ - ${libexecdir}/git-core/git-cvsserver \ - ${libexecdir}/git-core/git-send-email \ - ${libexecdir}/git-core/git-svn \ - ${libexecdir}/git-core/git-instaweb \ - ${datadir}/gitweb/gitweb.cgi \ - ${datadir}/git-core/templates/hooks/prepare-commit-msg.sample \ - ${datadir}/git-core/templates/hooks/pre-rebase.sample \ - ${datadir}/git-core/templates/hooks/fsmonitor-watchman.sample \ -" - -# Git tools requiring perl -PACKAGES =+ "${PN}-perltools" -FILES:${PN}-perltools += " \ - ${PERLTOOLS} \ - ${libdir}/perl \ - ${datadir}/perl5 \ -" - -RDEPENDS:${PN}-perltools = "${PN} perl perl-module-file-path findutils" - -# git-tk package with gitk and git-gui -PACKAGES =+ "${PN}-tk" -#RDEPENDS:${PN}-tk = "${PN} tk tcl" -#EXTRA_OEMAKE = "TCL_PATH=${STAGING_BINDIR_CROSS}/tclsh" -FILES:${PN}-tk = " \ - ${bindir}/gitk \ - ${datadir}/gitk \ -" - -PACKAGES =+ "gitweb" -FILES:gitweb = "${datadir}/gitweb/" -RDEPENDS:gitweb = "perl" - -BBCLASSEXTEND = "native nativesdk" - -EXTRA_OECONF += "ac_cv_snprintf_returns_bogus=no \ - ac_cv_fread_reads_directories=${ac_cv_fread_reads_directories=yes} \ - " -EXTRA_OEMAKE += "NO_GETTEXT=1" - -SRC_URI[tarball.sha256sum] = "620ed3df572a34e782a2be4c7d958d443469b2665eac4ae33f27da554d88b270" diff --git a/poky/meta/recipes-devtools/git/git_2.39.0.bb b/poky/meta/recipes-devtools/git/git_2.39.0.bb new file mode 100644 index 0000000000..3622b9709d --- /dev/null +++ b/poky/meta/recipes-devtools/git/git_2.39.0.bb @@ -0,0 +1,169 @@ +SUMMARY = "Distributed version control system" +HOMEPAGE = "http://git-scm.com" +DESCRIPTION = "Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency." +SECTION = "console/utils" +LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & MIT & BSL-1.0 & LGPL-2.1-or-later" +DEPENDS = "openssl zlib" + +PROVIDES:append:class-native = " git-replacement-native" + +SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \ + file://fixsort.patch \ + file://0001-config.mak.uname-do-not-force-RHEL-7-specific-build-.patch \ + " + +S = "${WORKDIR}/git-${PV}" + +LIC_FILES_CHKSUM = "\ + file://COPYING;md5=7c0d7ef03a7eb04ce795b0f60e68e7e1 \ + file://reftable/LICENSE;md5=1a6424cafc4c9c88c689848e165af33b \ + file://sha1dc/LICENSE.txt;md5=9bbe4c990a9e98ea4b98ef5d3bcb8a7a \ + file://compat/nedmalloc/License.txt;md5=e4224ccaecb14d942c71d31bef20d78c \ + file://compat/inet_ntop.c;md5=76593c6f74e8ced5b24520175688d59b;endline=16 \ + file://compat/obstack.h;md5=08ad25fee5428cd879ceef451ce3a22e;endline=18 \ + file://compat/poll/poll.h;md5=9fc00170a53b8e3e52157c91ac688dd1;endline=19 \ + file://compat/regex/regex.h;md5=30cc8af0e6f0f8a25acec6d8783bb763;beginline=4;endline=22 \ +" + +CVE_PRODUCT = "git-scm:git" + +# This is about a manpage not mentioning --mirror may "leak" information +# in mirrored git repos. Most OE users wouldn't build the docs and +# we don't see this as a major issue for our general users/usecases. +CVE_CHECK_IGNORE += "CVE-2022-24975" + +PACKAGECONFIG ??= "expat curl" +PACKAGECONFIG[cvsserver] = "" +PACKAGECONFIG[svn] = "" +PACKAGECONFIG[manpages] = ",,asciidoc-native xmlto-native" +PACKAGECONFIG[curl] = "--with-curl,--without-curl,curl" +PACKAGECONFIG[expat] = "--with-expat,--without-expat,expat" + +EXTRA_OECONF = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl \ + --without-tcltk \ + --without-iconv \ +" +EXTRA_OECONF:append:class-nativesdk = " --with-gitconfig=/etc/gitconfig " + +# Needs brokensep as this doesn't use automake +inherit autotools-brokensep perlnative bash-completion manpages + +EXTRA_OEMAKE = "NO_PYTHON=1 CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'" +EXTRA_OEMAKE += "'PERL_PATH=/usr/bin/env perl'" +EXTRA_OEMAKE += "COMPUTE_HEADER_DEPENDENCIES=no" +EXTRA_OEMAKE:append:class-native = " NO_CROSS_DIRECTORY_HARDLINKS=1" + +do_compile:prepend () { + # Remove perl/perl.mak to fix the out-of-date perl.mak error + # during rebuild + rm -f perl/perl.mak + + if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then + oe_runmake man + fi +} + +do_install () { + oe_runmake install DESTDIR="${D}" bindir=${bindir} \ + template_dir=${datadir}/git-core/templates + + install -d ${D}/${datadir}/bash-completion/completions/ + install -m 644 ${S}/contrib/completion/git-completion.bash ${D}/${datadir}/bash-completion/completions/git + + if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then + # Needs to be serial with make 4.4 due to https://savannah.gnu.org/bugs/index.php?63362 + make install-man DESTDIR="${D}" + fi +} + +perl_native_fixup () { + sed -i -e 's#${STAGING_BINDIR_NATIVE}/perl-native/#${bindir}/#' \ + -e 's#${libdir}/perl-native/#${libdir}/#' \ + ${@d.getVar("PERLTOOLS").replace(' /',d.getVar('D') + '/')} + + if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'cvsserver', d)}" ]; then + # Only install the git cvsserver command if explicitly requested + # as it requires the DBI Perl module, which does not exist in + # OE-Core. + rm ${D}${libexecdir}/git-core/git-cvsserver \ + ${D}${bindir}/git-cvsserver + fi + + if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'svn', d)}" ]; then + # Only install the git svn command and all Git::SVN Perl modules + # if explicitly requested as they require the SVN::Core Perl + # module, which does not exist in OE-Core. + rm -r ${D}${libexecdir}/git-core/git-svn \ + ${D}${datadir}/perl5/Git/SVN* + fi +} + +REL_GIT_EXEC_PATH = "${@os.path.relpath(libexecdir, bindir)}/git-core" +REL_GIT_TEMPLATE_DIR = "${@os.path.relpath(datadir, bindir)}/git-core/templates" + +do_install:append:class-target () { + perl_native_fixup +} + +do_install:append:class-native() { + create_wrapper ${D}${bindir}/git \ + GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \ + GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR} +} + +do_install:append:class-nativesdk() { + create_wrapper ${D}${bindir}/git \ + GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \ + GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR} + perl_native_fixup +} + +FILES:${PN} += "${datadir}/git-core ${libexecdir}/git-core/" + +PERLTOOLS = " \ + ${bindir}/git-cvsserver \ + ${libexecdir}/git-core/git-add--interactive \ + ${libexecdir}/git-core/git-archimport \ + ${libexecdir}/git-core/git-cvsexportcommit \ + ${libexecdir}/git-core/git-cvsimport \ + ${libexecdir}/git-core/git-cvsserver \ + ${libexecdir}/git-core/git-send-email \ + ${libexecdir}/git-core/git-svn \ + ${libexecdir}/git-core/git-instaweb \ + ${datadir}/gitweb/gitweb.cgi \ + ${datadir}/git-core/templates/hooks/prepare-commit-msg.sample \ + ${datadir}/git-core/templates/hooks/pre-rebase.sample \ + ${datadir}/git-core/templates/hooks/fsmonitor-watchman.sample \ +" + +# Git tools requiring perl +PACKAGES =+ "${PN}-perltools" +FILES:${PN}-perltools += " \ + ${PERLTOOLS} \ + ${libdir}/perl \ + ${datadir}/perl5 \ +" + +RDEPENDS:${PN}-perltools = "${PN} perl perl-module-file-path findutils" + +# git-tk package with gitk and git-gui +PACKAGES =+ "${PN}-tk" +#RDEPENDS:${PN}-tk = "${PN} tk tcl" +#EXTRA_OEMAKE = "TCL_PATH=${STAGING_BINDIR_CROSS}/tclsh" +FILES:${PN}-tk = " \ + ${bindir}/gitk \ + ${datadir}/gitk \ +" + +PACKAGES =+ "gitweb" +FILES:gitweb = "${datadir}/gitweb/" +RDEPENDS:gitweb = "perl" + +BBCLASSEXTEND = "native nativesdk" + +EXTRA_OECONF += "ac_cv_snprintf_returns_bogus=no \ + ac_cv_fread_reads_directories=${ac_cv_fread_reads_directories=yes} \ + " +EXTRA_OEMAKE += "NO_GETTEXT=1" + +SRC_URI[tarball.sha256sum] = "d929fe67cef7ac3ca709d2b56a9920f17112d5a524bf8112af37ec045a7a5109" diff --git a/poky/meta/recipes-devtools/gnu-config/gnu-config_git.bb b/poky/meta/recipes-devtools/gnu-config/gnu-config_git.bb index e298e31714..e35e9008f9 100644 --- a/poky/meta/recipes-devtools/gnu-config/gnu-config_git.bb +++ b/poky/meta/recipes-devtools/gnu-config/gnu-config_git.bb @@ -9,8 +9,8 @@ DEPENDS:class-native = "hostperl-runtime-native" INHIBIT_DEFAULT_DEPS = "1" -SRCREV = "20403c5701973a4cbd7e0b4bbeb627fcd424a0f1" -PV = "20220927+git${SRCPV}" +SRCREV = "f992bcc08219edb283d2ab31dd3871a4a0e8220e" +PV = "20221007+git${SRCPV}" SRC_URI = "git://git.savannah.gnu.org/git/config.git;protocol=https;branch=master \ file://gnu-configize.in" diff --git a/poky/meta/recipes-devtools/go/go-1.19.3.inc b/poky/meta/recipes-devtools/go/go-1.19.3.inc deleted file mode 100644 index 1245faba93..0000000000 --- a/poky/meta/recipes-devtools/go/go-1.19.3.inc +++ /dev/null @@ -1,18 +0,0 @@ -require go-common.inc - -FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go:" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" - -SRC_URI += "\ - file://0001-cmd-go-make-content-based-hash-generation-less-pedan.patch \ - file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \ - file://0004-ld-add-soname-to-shareable-objects.patch \ - file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \ - file://0006-cmd-dist-separate-host-and-target-builds.patch \ - file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ - file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \ - file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ - file://filter-build-paths.patch \ -" -SRC_URI[main.sha256sum] = "18ac263e39210bcf68d85f4370e97fb1734166995a1f63fb38b4f6e07d90d212" diff --git a/poky/meta/recipes-devtools/go/go-1.19.4.inc b/poky/meta/recipes-devtools/go/go-1.19.4.inc new file mode 100644 index 0000000000..49349ba6ec --- /dev/null +++ b/poky/meta/recipes-devtools/go/go-1.19.4.inc @@ -0,0 +1,18 @@ +require go-common.inc + +FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go:" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" + +SRC_URI += "\ + file://0001-cmd-go-make-content-based-hash-generation-less-pedan.patch \ + file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \ + file://0004-ld-add-soname-to-shareable-objects.patch \ + file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \ + file://0006-cmd-dist-separate-host-and-target-builds.patch \ + file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ + file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \ + file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \ + file://filter-build-paths.patch \ +" +SRC_URI[main.sha256sum] = "eda74db4ac494800a3e66ee784e495bfbb9b8e535df924a8b01b1a8028b7f368" diff --git a/poky/meta/recipes-devtools/go/go-binary-native_1.19.3.bb b/poky/meta/recipes-devtools/go/go-binary-native_1.19.3.bb deleted file mode 100644 index 1eed2cde41..0000000000 --- a/poky/meta/recipes-devtools/go/go-binary-native_1.19.3.bb +++ /dev/null @@ -1,48 +0,0 @@ -# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org. - -SUMMARY = "Go programming language compiler (upstream binary for bootstrap)" -HOMEPAGE = " http://golang.org/" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" - -PROVIDES = "go-native" - -# Checksums available at https://go.dev/dl/ -SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}" -SRC_URI[go_linux_amd64.sha256sum] = "74b9640724fd4e6bb0ed2a1bc44ae813a03f1e72a4c76253e2d5c015494430ba" -SRC_URI[go_linux_arm64.sha256sum] = "99de2fe112a52ab748fb175edea64b313a0c8d51d6157dba683a6be163fd5eab" -SRC_URI[go_linux_ppc64le.sha256sum] = "741dad06e7b17fe2c9cd9586b4048cec087ca1f7a317389b14e89b26c25d3542" - -UPSTREAM_CHECK_URI = "https://golang.org/dl/" -UPSTREAM_CHECK_REGEX = "go(?P\d+(\.\d+)+)\.linux" - -S = "${WORKDIR}/go" - -inherit goarch native - -do_compile() { - : -} - -make_wrapper() { - rm -f ${D}${bindir}/$1 - cat <${D}${bindir}/$1 -#!/bin/bash -here=\`dirname \$0\` -export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" -\$here/../lib/go/bin/$1 "\$@" -END - chmod +x ${D}${bindir}/$1 -} - -do_install() { - find ${S} -depth -type d -name testdata -exec rm -rf {} + - - install -d ${D}${bindir} ${D}${libdir}/go - cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/ - - for f in ${S}/bin/* - do - make_wrapper `basename $f` - done -} diff --git a/poky/meta/recipes-devtools/go/go-binary-native_1.19.4.bb b/poky/meta/recipes-devtools/go/go-binary-native_1.19.4.bb new file mode 100644 index 0000000000..8dc8bdf8e2 --- /dev/null +++ b/poky/meta/recipes-devtools/go/go-binary-native_1.19.4.bb @@ -0,0 +1,48 @@ +# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org. + +SUMMARY = "Go programming language compiler (upstream binary for bootstrap)" +HOMEPAGE = " http://golang.org/" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" + +PROVIDES = "go-native" + +# Checksums available at https://go.dev/dl/ +SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}" +SRC_URI[go_linux_amd64.sha256sum] = "c9c08f783325c4cf840a94333159cc937f05f75d36a8b307951d5bd959cf2ab8" +SRC_URI[go_linux_arm64.sha256sum] = "9df122d6baf6f2275270306b92af3b09d7973fb1259257e284dba33c0db14f1b" +SRC_URI[go_linux_ppc64le.sha256sum] = "fbc6c7d1d169bbdc82223d861d2fadc6add01c126533d3efbba3fdca9b362035" + +UPSTREAM_CHECK_URI = "https://golang.org/dl/" +UPSTREAM_CHECK_REGEX = "go(?P\d+(\.\d+)+)\.linux" + +S = "${WORKDIR}/go" + +inherit goarch native + +do_compile() { + : +} + +make_wrapper() { + rm -f ${D}${bindir}/$1 + cat <${D}${bindir}/$1 +#!/bin/bash +here=\`dirname \$0\` +export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" +\$here/../lib/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$1 +} + +do_install() { + find ${S} -depth -type d -name testdata -exec rm -rf {} + + + install -d ${D}${bindir} ${D}${libdir}/go + cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/ + + for f in ${S}/bin/* + do + make_wrapper `basename $f` + done +} diff --git a/poky/meta/recipes-devtools/go/go-cross-canadian_1.19.3.bb b/poky/meta/recipes-devtools/go/go-cross-canadian_1.19.3.bb deleted file mode 100644 index 7ac9449e47..0000000000 --- a/poky/meta/recipes-devtools/go/go-cross-canadian_1.19.3.bb +++ /dev/null @@ -1,2 +0,0 @@ -require go-cross-canadian.inc -require go-${PV}.inc diff --git a/poky/meta/recipes-devtools/go/go-cross-canadian_1.19.4.bb b/poky/meta/recipes-devtools/go/go-cross-canadian_1.19.4.bb new file mode 100644 index 0000000000..7ac9449e47 --- /dev/null +++ b/poky/meta/recipes-devtools/go/go-cross-canadian_1.19.4.bb @@ -0,0 +1,2 @@ +require go-cross-canadian.inc +require go-${PV}.inc diff --git a/poky/meta/recipes-devtools/go/go-cross_1.19.3.bb b/poky/meta/recipes-devtools/go/go-cross_1.19.3.bb deleted file mode 100644 index 80b5a03f6c..0000000000 --- a/poky/meta/recipes-devtools/go/go-cross_1.19.3.bb +++ /dev/null @@ -1,2 +0,0 @@ -require go-cross.inc -require go-${PV}.inc diff --git a/poky/meta/recipes-devtools/go/go-cross_1.19.4.bb b/poky/meta/recipes-devtools/go/go-cross_1.19.4.bb new file mode 100644 index 0000000000..80b5a03f6c --- /dev/null +++ b/poky/meta/recipes-devtools/go/go-cross_1.19.4.bb @@ -0,0 +1,2 @@ +require go-cross.inc +require go-${PV}.inc diff --git a/poky/meta/recipes-devtools/go/go-crosssdk.inc b/poky/meta/recipes-devtools/go/go-crosssdk.inc index cd23cca2fe..766938670a 100644 --- a/poky/meta/recipes-devtools/go/go-crosssdk.inc +++ b/poky/meta/recipes-devtools/go/go-crosssdk.inc @@ -4,6 +4,8 @@ DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TA PN = "go-crosssdk-${SDK_SYS}" PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk" +export GOCACHE = "${B}/.cache" + do_configure[noexec] = "1" do_compile() { diff --git a/poky/meta/recipes-devtools/go/go-crosssdk_1.19.3.bb b/poky/meta/recipes-devtools/go/go-crosssdk_1.19.3.bb deleted file mode 100644 index 1857c8a577..0000000000 --- a/poky/meta/recipes-devtools/go/go-crosssdk_1.19.3.bb +++ /dev/null @@ -1,2 +0,0 @@ -require go-crosssdk.inc -require go-${PV}.inc diff --git a/poky/meta/recipes-devtools/go/go-crosssdk_1.19.4.bb b/poky/meta/recipes-devtools/go/go-crosssdk_1.19.4.bb new file mode 100644 index 0000000000..1857c8a577 --- /dev/null +++ b/poky/meta/recipes-devtools/go/go-crosssdk_1.19.4.bb @@ -0,0 +1,2 @@ +require go-crosssdk.inc +require go-${PV}.inc diff --git a/poky/meta/recipes-devtools/go/go-native_1.19.3.bb b/poky/meta/recipes-devtools/go/go-native_1.19.3.bb deleted file mode 100644 index ddf25b2c9b..0000000000 --- a/poky/meta/recipes-devtools/go/go-native_1.19.3.bb +++ /dev/null @@ -1,58 +0,0 @@ -# This recipe builds a native Go (written in Go) by first building an old Go 1.4 -# (written in C). However this old Go does not support all hosts platforms. - -require go-${PV}.inc - -inherit native - -SRC_URI += "https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4" -SRC_URI[bootstrap.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52" - -export GOOS = "${BUILD_GOOS}" -export GOARCH = "${BUILD_GOARCH}" -CC = "${@d.getVar('BUILD_CC').strip()}" - -GOMAKEARGS ?= "--no-banner" - -do_configure() { - cd ${WORKDIR}/go1.4/go/src - CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash -} - -do_compile() { - export GOROOT_FINAL="${libdir_native}/go" - export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go" - - cd src - ./make.bash ${GOMAKEARGS} - cd ${B} -} -do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin" - -make_wrapper() { - rm -f ${D}${bindir}/$2$3 - cat <${D}${bindir}/$2$3 -#!/bin/bash -here=\`dirname \$0\` -export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" -\$here/../lib/go/bin/$1 "\$@" -END - chmod +x ${D}${bindir}/$2 -} - -do_install() { - install -d ${D}${libdir}/go - cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ - install -d ${D}${libdir}/go/src - (cd ${S}/src; for d in *; do \ - [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ - done) - find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; - install -d ${D}${bindir} ${D}${libdir}/go/bin - for f in ${B}/bin/* - do - base=`basename $f` - install -m755 $f ${D}${libdir}/go/bin - make_wrapper $base $base - done -} diff --git a/poky/meta/recipes-devtools/go/go-native_1.19.4.bb b/poky/meta/recipes-devtools/go/go-native_1.19.4.bb new file mode 100644 index 0000000000..ddf25b2c9b --- /dev/null +++ b/poky/meta/recipes-devtools/go/go-native_1.19.4.bb @@ -0,0 +1,58 @@ +# This recipe builds a native Go (written in Go) by first building an old Go 1.4 +# (written in C). However this old Go does not support all hosts platforms. + +require go-${PV}.inc + +inherit native + +SRC_URI += "https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4" +SRC_URI[bootstrap.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52" + +export GOOS = "${BUILD_GOOS}" +export GOARCH = "${BUILD_GOARCH}" +CC = "${@d.getVar('BUILD_CC').strip()}" + +GOMAKEARGS ?= "--no-banner" + +do_configure() { + cd ${WORKDIR}/go1.4/go/src + CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash +} + +do_compile() { + export GOROOT_FINAL="${libdir_native}/go" + export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go" + + cd src + ./make.bash ${GOMAKEARGS} + cd ${B} +} +do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin" + +make_wrapper() { + rm -f ${D}${bindir}/$2$3 + cat <${D}${bindir}/$2$3 +#!/bin/bash +here=\`dirname \$0\` +export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" +\$here/../lib/go/bin/$1 "\$@" +END + chmod +x ${D}${bindir}/$2 +} + +do_install() { + install -d ${D}${libdir}/go + cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ + install -d ${D}${libdir}/go/src + (cd ${S}/src; for d in *; do \ + [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ + done) + find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; + install -d ${D}${bindir} ${D}${libdir}/go/bin + for f in ${B}/bin/* + do + base=`basename $f` + install -m755 $f ${D}${libdir}/go/bin + make_wrapper $base $base + done +} diff --git a/poky/meta/recipes-devtools/go/go-runtime_1.19.3.bb b/poky/meta/recipes-devtools/go/go-runtime_1.19.3.bb deleted file mode 100644 index 63464a1501..0000000000 --- a/poky/meta/recipes-devtools/go/go-runtime_1.19.3.bb +++ /dev/null @@ -1,3 +0,0 @@ -require go-${PV}.inc -require go-runtime.inc - diff --git a/poky/meta/recipes-devtools/go/go-runtime_1.19.4.bb b/poky/meta/recipes-devtools/go/go-runtime_1.19.4.bb new file mode 100644 index 0000000000..63464a1501 --- /dev/null +++ b/poky/meta/recipes-devtools/go/go-runtime_1.19.4.bb @@ -0,0 +1,3 @@ +require go-${PV}.inc +require go-runtime.inc + diff --git a/poky/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch b/poky/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch index 17fa9d9831..43be5cd2e8 100644 --- a/poky/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch +++ b/poky/meta/recipes-devtools/go/go/0001-cmd-go-make-content-based-hash-generation-less-pedan.patch @@ -74,7 +74,7 @@ index c88b315..a06455c 100644 + cppflags, cflags, cxxflags, fflags, ldflags, _ := b.CFlags(p, true) - ccExe := b.ccExe() -+ ccExe := filterCompilerFlags(b.ccExe()) ++ ccExe := filterCompilerFlags(b.ccExe(), true) fmt.Fprintf(h, "CC=%q %q %q %q\n", ccExe, cppflags, cflags, ldflags) // Include the C compiler tool ID so that if the C // compiler changes we rebuild the package. @@ -83,7 +83,7 @@ index c88b315..a06455c 100644 } if len(p.CXXFiles)+len(p.SwigCXXFiles) > 0 { - cxxExe := b.cxxExe() -+ cxxExe := filterCompilerFlags(b.cxxExe()) ++ cxxExe := filterCompilerFlags(b.cxxExe(), true) fmt.Fprintf(h, "CXX=%q %q\n", cxxExe, cxxflags) if cxxID, err := b.gccToolID(cxxExe[0], "c++"); err == nil { fmt.Fprintf(h, "CXX ID=%q\n", cxxID) @@ -91,7 +91,7 @@ index c88b315..a06455c 100644 } if len(p.FFiles) > 0 { - fcExe := b.fcExe() -+ fcExe := filterCompilerFlags(b.fcExe()) ++ fcExe := filterCompilerFlags(b.fcExe(), true) fmt.Fprintf(h, "FC=%q %q\n", fcExe, fflags) if fcID, err := b.gccToolID(fcExe[0], "f95"); err == nil { fmt.Fprintf(h, "FC ID=%q\n", fcID) @@ -104,20 +104,22 @@ index c88b315..a06455c 100644 } // Configuration specific to compiler toolchain. -@@ -2705,8 +2707,23 @@ func envList(key, def string) []string { +@@ -2705,8 +2707,25 @@ func envList(key, def string) []string { return args } +var filterFlags = os.Getenv("CGO_PEDANTIC") == "" + -+func filterCompilerFlags(flags []string) []string { ++func filterCompilerFlags(flags []string, keepfirst bool) []string { + var newflags []string ++ var realkeepfirst bool = keepfirst + if !filterFlags { + return flags + } + for _, flag := range flags { -+ if strings.HasPrefix(flag, "-m") { ++ if strings.HasPrefix(flag, "-m") || realkeepfirst { + newflags = append(newflags, flag) ++ realkeepfirst = false + } + } + return newflags @@ -129,21 +131,21 @@ index c88b315..a06455c 100644 defaults := "-g -O2" if cppflags, err = buildFlags("CPPFLAGS", "", p.CgoCPPFLAGS, checkCompilerFlags); err != nil { -@@ -2724,6 +2741,13 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l +@@ -2724,6 +2743,13 @@ func (b *Builder) CFlags(p *load.Package) (cppflags, cflags, cxxflags, fflags, l if ldflags, err = buildFlags("LDFLAGS", defaults, p.CgoLDFLAGS, checkLinkerFlags); err != nil { return } + if filtered { -+ cppflags = filterCompilerFlags(cppflags) -+ cflags = filterCompilerFlags(cflags) -+ cxxflags = filterCompilerFlags(cxxflags) -+ fflags = filterCompilerFlags(fflags) -+ ldflags = filterCompilerFlags(ldflags) ++ cppflags = filterCompilerFlags(cppflags, false) ++ cflags = filterCompilerFlags(cflags, false) ++ cxxflags = filterCompilerFlags(cxxflags, false) ++ fflags = filterCompilerFlags(fflags, false) ++ ldflags = filterCompilerFlags(ldflags, false) + } return } -@@ -2739,7 +2763,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`) +@@ -2739,7 +2765,7 @@ var cgoRe = lazyregexp.New(`[/\\:]`) func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles, ffiles []string) (outGo, outObj []string, err error) { p := a.Package @@ -152,7 +154,7 @@ index c88b315..a06455c 100644 if err != nil { return nil, nil, err } -@@ -3246,7 +3270,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) { +@@ -3246,7 +3272,7 @@ func (b *Builder) swigIntSize(objdir string) (intsize string, err error) { // Run SWIG on one SWIG input file. func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) { diff --git a/poky/meta/recipes-devtools/go/go_1.19.3.bb b/poky/meta/recipes-devtools/go/go_1.19.3.bb deleted file mode 100644 index 98977673ee..0000000000 --- a/poky/meta/recipes-devtools/go/go_1.19.3.bb +++ /dev/null @@ -1,18 +0,0 @@ -require go-${PV}.inc -require go-target.inc - -inherit linuxloader - -CGO_LDFLAGS:append:mips = " -no-pie" - -export GO_LDSO = "${@get_linuxloader(d)}" -export CC_FOR_TARGET = "gcc" -export CXX_FOR_TARGET = "g++" - -# mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv32 and its -# variants. -python() { - if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv32' in d.getVar('TARGET_ARCH',True): - d.appendVar('INSANE_SKIP:%s' % d.getVar('PN',True), " textrel") -} - diff --git a/poky/meta/recipes-devtools/go/go_1.19.4.bb b/poky/meta/recipes-devtools/go/go_1.19.4.bb new file mode 100644 index 0000000000..98977673ee --- /dev/null +++ b/poky/meta/recipes-devtools/go/go_1.19.4.bb @@ -0,0 +1,18 @@ +require go-${PV}.inc +require go-target.inc + +inherit linuxloader + +CGO_LDFLAGS:append:mips = " -no-pie" + +export GO_LDSO = "${@get_linuxloader(d)}" +export CC_FOR_TARGET = "gcc" +export CXX_FOR_TARGET = "g++" + +# mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv32 and its +# variants. +python() { + if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv32' in d.getVar('TARGET_ARCH',True): + d.appendVar('INSANE_SKIP:%s' % d.getVar('PN',True), " textrel") +} + diff --git a/poky/meta/recipes-devtools/help2man/help2man_1.49.2.bb b/poky/meta/recipes-devtools/help2man/help2man_1.49.2.bb deleted file mode 100644 index 62e1f67b55..0000000000 --- a/poky/meta/recipes-devtools/help2man/help2man_1.49.2.bb +++ /dev/null @@ -1,24 +0,0 @@ -SUMMARY = "Program for creating simple man pages" -HOMEPAGE = "https://www.gnu.org/software/help2man/" -DESCRIPTION = "help2man is a tool for automatically generating simple manual pages from program output." -SECTION = "devel" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" - -SRC_URI = "${GNU_MIRROR}/${BPN}/${BPN}-${PV}.tar.xz" -SRC_URI[sha256sum] = "9e2e0e213a7e0a36244eed6204d902b6504602a578b6ecd15268b1454deadd36" - -inherit autotools - -# This is a hand-maintained aclocal.m4 but our autotools class currently deletes -# aclocal.m4. -EXTRA_AUTORECONF += "--exclude=aclocal" - -EXTRA_OECONF = "--disable-nls" - -do_install:append () { - # Make sure we use /usr/bin/env perl - sed -i -e "1s:#!.*:#! /usr/bin/env perl:" ${D}${bindir}/help2man -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/help2man/help2man_1.49.3.bb b/poky/meta/recipes-devtools/help2man/help2man_1.49.3.bb new file mode 100644 index 0000000000..75931a511f --- /dev/null +++ b/poky/meta/recipes-devtools/help2man/help2man_1.49.3.bb @@ -0,0 +1,24 @@ +SUMMARY = "Program for creating simple man pages" +HOMEPAGE = "https://www.gnu.org/software/help2man/" +DESCRIPTION = "help2man is a tool for automatically generating simple manual pages from program output." +SECTION = "devel" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" + +SRC_URI = "${GNU_MIRROR}/${BPN}/${BPN}-${PV}.tar.xz" +SRC_URI[sha256sum] = "4d7e4fdef2eca6afe07a2682151cea78781e0a4e8f9622142d9f70c083a2fd4f" + +inherit autotools + +# This is a hand-maintained aclocal.m4 but our autotools class currently deletes +# aclocal.m4. +EXTRA_AUTORECONF += "--exclude=aclocal" + +EXTRA_OECONF = "--disable-nls" + +do_install:append () { + # Make sure we use /usr/bin/env perl + sed -i -e "1s:#!.*:#! /usr/bin/env perl:" ${D}${bindir}/help2man +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/jquery/jquery_3.6.1.bb b/poky/meta/recipes-devtools/jquery/jquery_3.6.1.bb deleted file mode 100644 index a474889099..0000000000 --- a/poky/meta/recipes-devtools/jquery/jquery_3.6.1.bb +++ /dev/null @@ -1,39 +0,0 @@ -SUMMARY = "jQuery is a fast, small, and feature-rich JavaScript library" -HOMEPAGE = "https://jquery.com/" -DESCRIPTION = "${SUMMARY}" -LICENSE = "MIT" -SECTION = "devel" -LIC_FILES_CHKSUM = "file://${S}/${BP}.js;beginline=8;endline=10;md5=9c7c6e9ab275fc1e0d99cb7180ecd14c" - -# unpack items to ${S} so the archiver can see them -# -SRC_URI = "\ - https://code.jquery.com/${BP}.js;name=js;subdir=${BP} \ - https://code.jquery.com/${BP}.min.js;name=min;subdir=${BP} \ - https://code.jquery.com/${BP}.min.map;name=map;subdir=${BP} \ - " - -SRC_URI[js.sha256sum] = "df3941e6cdaec28533ad72b7053ec05f7172be88ecada345c42736bc2ffba4d2" -SRC_URI[min.sha256sum] = "a3cf00c109d907e543bc4f6dbc85eb31068f94515251347e9e57509b52ee3d74" -SRC_URI[map.sha256sum] = "856ee620cebac56e872d6e99b09de05f81ccd3f3dc346e9b55eb694611a6d5e1" - -UPSTREAM_CHECK_REGEX = "jquery-(?P\d+(\.\d+)+)\.js" - -# https://github.com/jquery/jquery/issues/3927 -# There are ways jquery can expose security issues but any issues are in the apps exposing them -# and there is little we can directly do -CVE_CHECK_IGNORE += "CVE-2007-2379" - -inherit allarch - -do_install() { - install -d ${D}${datadir}/javascript/${BPN}/ - install -m 644 ${S}/${BP}.js ${D}${datadir}/javascript/${BPN}/${BPN}.js - install -m 644 ${S}/${BP}.min.js ${D}${datadir}/javascript/${BPN}/${BPN}.min.js - install -m 644 ${S}/${BP}.min.map ${D}${datadir}/javascript/${BPN}/${BPN}.min.map -} - -PACKAGES = "${PN}" -FILES:${PN} = "${datadir}" - -BBCLASSEXTEND += "native nativesdk" diff --git a/poky/meta/recipes-devtools/jquery/jquery_3.6.3.bb b/poky/meta/recipes-devtools/jquery/jquery_3.6.3.bb new file mode 100644 index 0000000000..93f87f730d --- /dev/null +++ b/poky/meta/recipes-devtools/jquery/jquery_3.6.3.bb @@ -0,0 +1,39 @@ +SUMMARY = "jQuery is a fast, small, and feature-rich JavaScript library" +HOMEPAGE = "https://jquery.com/" +DESCRIPTION = "${SUMMARY}" +LICENSE = "MIT" +SECTION = "devel" +LIC_FILES_CHKSUM = "file://${S}/${BP}.js;beginline=8;endline=10;md5=9c7c6e9ab275fc1e0d99cb7180ecd14c" + +# unpack items to ${S} so the archiver can see them +# +SRC_URI = "\ + https://code.jquery.com/${BP}.js;name=js;subdir=${BP} \ + https://code.jquery.com/${BP}.min.js;name=min;subdir=${BP} \ + https://code.jquery.com/${BP}.min.map;name=map;subdir=${BP} \ + " + +SRC_URI[js.sha256sum] = "9d02ee01919145c20b03ee9d3013af7118793dedf5d2c0696a773af90066c953" +SRC_URI[min.sha256sum] = "a6f3f0faea4b3d48e03176341bef0ed3151ffbf226d4c6635f1c6039c0500575" +SRC_URI[map.sha256sum] = "156b740931ade6c1a98d99713eeb186f93847ffc56057e973becab4d037ed53a" + +UPSTREAM_CHECK_REGEX = "jquery-(?P\d+(\.\d+)+)\.js" + +# https://github.com/jquery/jquery/issues/3927 +# There are ways jquery can expose security issues but any issues are in the apps exposing them +# and there is little we can directly do +CVE_CHECK_IGNORE += "CVE-2007-2379" + +inherit allarch + +do_install() { + install -d ${D}${datadir}/javascript/${BPN}/ + install -m 644 ${S}/${BP}.js ${D}${datadir}/javascript/${BPN}/${BPN}.js + install -m 644 ${S}/${BP}.min.js ${D}${datadir}/javascript/${BPN}/${BPN}.min.js + install -m 644 ${S}/${BP}.min.map ${D}${datadir}/javascript/${BPN}/${BPN}.min.map +} + +PACKAGES = "${PN}" +FILES:${PN} = "${datadir}" + +BBCLASSEXTEND += "native nativesdk" diff --git a/poky/meta/recipes-devtools/librepo/librepo_1.14.5.bb b/poky/meta/recipes-devtools/librepo/librepo_1.14.5.bb deleted file mode 100644 index 46cfce53ff..0000000000 --- a/poky/meta/recipes-devtools/librepo/librepo_1.14.5.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "A library providing C and Python (libcURL like) API \ - for downloading linux repository metadata and packages." -HOMEPAGE = "https://github.com/rpm-software-management/librepo" -DESCRIPTION = "${SUMMARY}" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" - -SRC_URI = "git://github.com/rpm-software-management/librepo.git;branch=master;protocol=https \ - file://0002-Do-not-try-to-obtain-PYTHON_INSTALL_DIR-by-running-p.patch \ - file://0004-Set-gpgme-variables-with-pkg-config-not-with-cmake-m.patch \ - " - -SRCREV = "f4b915be5e04e88263097f65addfcac5919fef41" - -S = "${WORKDIR}/git" - -DEPENDS = "curl glib-2.0 openssl attr gpgme libxml2" - -inherit cmake setuptools3-base pkgconfig - -EXTRA_OECMAKE = " \ - -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} \ - -DPYTHON_DESIRED=3 \ - -DENABLE_TESTS=OFF \ - -DENABLE_DOCS=OFF \ - -DWITH_ZCHUNK=OFF \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/librepo/librepo_1.15.1.bb b/poky/meta/recipes-devtools/librepo/librepo_1.15.1.bb new file mode 100644 index 0000000000..2c8d6fc719 --- /dev/null +++ b/poky/meta/recipes-devtools/librepo/librepo_1.15.1.bb @@ -0,0 +1,29 @@ +SUMMARY = "A library providing C and Python (libcURL like) API \ + for downloading linux repository metadata and packages." +HOMEPAGE = "https://github.com/rpm-software-management/librepo" +DESCRIPTION = "${SUMMARY}" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI = "git://github.com/rpm-software-management/librepo.git;branch=master;protocol=https \ + file://0002-Do-not-try-to-obtain-PYTHON_INSTALL_DIR-by-running-p.patch \ + file://0004-Set-gpgme-variables-with-pkg-config-not-with-cmake-m.patch \ + " + +SRCREV = "5f4de4a4e85845d4184fbd30c03ff8a8ec7df4af" + +S = "${WORKDIR}/git" + +DEPENDS = "curl glib-2.0 openssl attr gpgme libxml2" + +inherit cmake setuptools3-base pkgconfig + +EXTRA_OECMAKE = " \ + -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} \ + -DPYTHON_DESIRED=3 \ + -DENABLE_TESTS=OFF \ + -DENABLE_DOCS=OFF \ + -DWITH_ZCHUNK=OFF \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/llvm/llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch b/poky/meta/recipes-devtools/llvm/llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch new file mode 100644 index 0000000000..fe98e3e4c0 --- /dev/null +++ b/poky/meta/recipes-devtools/llvm/llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch @@ -0,0 +1,79 @@ +From cd2fa12d715929642513fc441287c402f4560096 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 25 Dec 2022 15:13:41 -0800 +Subject: [PATCH] build: Enable 64bit off_t on 32bit glibc systems + +Pass -D_FILE_OFFSET_BITS=64 to compiler flags on 32bit glibc based +systems. This will make sure that 64bit versions of LFS functions are +used e.g. lseek will behave same as lseek64. Also revert [1] partially +because this added a cmake test to detect lseek64 but then forgot to +pass the needed macro during actual compile, this test was incomplete too +since libc implementations like musl has 64-bit off_t by default on 32-bit +systems and does not bundle -D_LARGEFILE64_SOURCE [2] under -D_GNU_SOURCE +like glibc, which means the compile now fails on musl because the cmake +check passes but we do not have _LARGEFILE64_SOURCE defined. Moreover, +Using the *64 function was transitional anyways so use +-D_FILE_OFFSET_BITS=64 instead + +[1] https://github.com/llvm/llvm-project/commit/8db7e5e4eed4c4e697dc3164f2c9351d8c3e942b +[2] https://git.musl-libc.org/cgit/musl/commit/?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc + +Upstream-Status: Submitted [https://reviews.llvm.org/D139752] +Signed-off-by: Khem Raj +--- + llvm/cmake/config-ix.cmake | 8 +++++--- + llvm/include/llvm/Config/config.h.cmake | 3 --- + llvm/lib/Support/raw_ostream.cpp | 2 -- + llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn | 2 -- + utils/bazel/llvm-project-overlay/llvm/config.bzl | 1 - + .../llvm/include/llvm/Config/config.h | 3 --- + utils/bazel/llvm_configs/config.h.cmake | 3 --- + 7 files changed, 5 insertions(+), 17 deletions(-) + +--- a/llvm/cmake/config-ix.cmake ++++ b/llvm/cmake/config-ix.cmake +@@ -284,9 +284,6 @@ check_symbol_exists(futimes sys/time.h H + if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE ) + check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK) + endif() +-set(CMAKE_REQUIRED_DEFINITIONS "-D_LARGEFILE64_SOURCE") +-check_symbol_exists(lseek64 "sys/types.h;unistd.h" HAVE_LSEEK64) +-set(CMAKE_REQUIRED_DEFINITIONS "") + check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL) + check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) + check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2) +@@ -350,6 +347,11 @@ check_symbol_exists(__GLIBC__ stdio.h LL + if( LLVM_USING_GLIBC ) + add_definitions( -D_GNU_SOURCE ) + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") ++# enable 64bit off_t on 32bit systems using glibc ++ if (CMAKE_SIZEOF_VOID_P EQUAL 4) ++ add_compile_definitions(_FILE_OFFSET_BITS=64) ++ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") ++ endif() + endif() + # This check requires _GNU_SOURCE + if (NOT PURE_WINDOWS) +--- a/llvm/include/llvm/Config/config.h.cmake ++++ b/llvm/include/llvm/Config/config.h.cmake +@@ -128,9 +128,6 @@ + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_LINK_H ${HAVE_LINK_H} + +-/* Define to 1 if you have the `lseek64' function. */ +-#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64} +- + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} + +--- a/llvm/lib/Support/raw_ostream.cpp ++++ b/llvm/lib/Support/raw_ostream.cpp +@@ -804,8 +804,6 @@ uint64_t raw_fd_ostream::seek(uint64_t o + flush(); + #ifdef _WIN32 + pos = ::_lseeki64(FD, off, SEEK_SET); +-#elif defined(HAVE_LSEEK64) +- pos = ::lseek64(FD, off, SEEK_SET); + #else + pos = ::lseek(FD, off, SEEK_SET); + #endif diff --git a/poky/meta/recipes-devtools/llvm/llvm_git.bb b/poky/meta/recipes-devtools/llvm/llvm_git.bb index 2d346b70cf..77fccbccc2 100644 --- a/poky/meta/recipes-devtools/llvm/llvm_git.bb +++ b/poky/meta/recipes-devtools/llvm/llvm_git.bb @@ -19,17 +19,18 @@ inherit cmake pkgconfig PROVIDES += "llvm${PV}" -PV = "15.0.4" +PV = "15.0.6" MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" LLVM_RELEASE = "${PV}" BRANCH = "release/${MAJOR_VERSION}.x" -SRCREV = "5c68a1cb123161b54b72ce90e7975d95a8eaf2a4" +SRCREV = "088f33605d8a61ff519c580a71b1dd57d16a03f8" SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH};protocol=https \ file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ + file://0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch;striplevel=2 \ file://llvm-config \ " diff --git a/poky/meta/recipes-devtools/m4/m4-1.4.19.inc b/poky/meta/recipes-devtools/m4/m4-1.4.19.inc index 2adf4de6f2..6ee9742277 100644 --- a/poky/meta/recipes-devtools/m4/m4-1.4.19.inc +++ b/poky/meta/recipes-devtools/m4/m4-1.4.19.inc @@ -54,6 +54,7 @@ do_install_ptest() { RDEPENDS:${PN}-ptest += "make coreutils diffutils" RDEPENDS:${PN}-ptest:append:libc-glibc = "\ + locale-base-fr-fr \ locale-base-fr-fr.iso-8859-1 \ " diff --git a/poky/meta/recipes-devtools/meson/meson/0001-is_debianlike-always-return-False.patch b/poky/meta/recipes-devtools/meson/meson/0001-is_debianlike-always-return-False.patch deleted file mode 100644 index a9a32e2b7a..0000000000 --- a/poky/meta/recipes-devtools/meson/meson/0001-is_debianlike-always-return-False.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 361f51c2c7685491186703e8f26be991ab698edc Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Mon, 18 Oct 2021 15:55:59 +0200 -Subject: [PATCH] is_debianlike(): always return False - -Otherwise, host contamination happens. - -Upstream-Status: Inappropriate [oe-core specific] -Signed-off-by: Alexander Kanavin - ---- - mesonbuild/utils/universal.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py -index 570edd6..4119aa5 100644 ---- a/mesonbuild/utils/universal.py -+++ b/mesonbuild/utils/universal.py -@@ -634,7 +634,7 @@ def is_cygwin() -> bool: - - - def is_debianlike() -> bool: -- return os.path.isfile('/etc/debian_version') -+ return False - - - def is_dragonflybsd() -> bool: diff --git a/poky/meta/recipes-devtools/meson/meson_0.64.0.bb b/poky/meta/recipes-devtools/meson/meson_0.64.0.bb deleted file mode 100644 index 84c3c84515..0000000000 --- a/poky/meta/recipes-devtools/meson/meson_0.64.0.bb +++ /dev/null @@ -1,156 +0,0 @@ -HOMEPAGE = "http://mesonbuild.com" -SUMMARY = "A high performance build system" -DESCRIPTION = "Meson is a build system designed to increase programmer \ -productivity. It does this by providing a fast, simple and easy to use \ -interface for modern software development tools and practices." - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" - -GITHUB_BASE_URI = "https://github.com/mesonbuild/meson/releases/" -SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/meson-${PV}.tar.gz \ - file://meson-setup.py \ - file://meson-wrapper \ - file://0001-python-module-do-not-manipulate-the-environment-when.patch \ - file://disable-rpath-handling.patch \ - file://0001-Make-CPU-family-warnings-fatal.patch \ - file://0002-Support-building-allarch-recipes-again.patch \ - file://0001-is_debianlike-always-return-False.patch \ - file://0001-Check-for-clang-before-guessing-gcc-or-lcc.patch \ - " -SRC_URI[sha256sum] = "c5e27e091c2a35b9049e152a6535045ebbd057253aeb67856de6ecbb7b917bab" - -inherit python_setuptools_build_meta github-releases - -RDEPENDS:${PN} = "ninja python3-modules python3-pkg-resources" - -FILES:${PN} += "${datadir}/polkit-1" - -do_install:append () { - # As per the same issue in the python recipe itself: - # Unfortunately the following pyc files are non-deterministc due to 'frozenset' - # being written without strict ordering, even with PYTHONHASHSEED = 0 - # Upstream is discussing ways to solve the issue properly, until then let's - # just not install the problematic files. - # More info: http://benno.id.au/blog/2013/01/15/python-determinism - rm ${D}${libdir}/python*/site-packages/mesonbuild/dependencies/__pycache__/mpi.cpython* -} - -BBCLASSEXTEND = "native nativesdk" - -inherit meson-routines - -# The cross file logic is similar but not identical to that in meson.bbclass, -# since it's generating for an SDK rather than a cross-compile. Important -# differences are: -# - We can't set vars like CC, CXX, etc. yet because they will be filled in with -# real paths by meson-setup.sh when the SDK is extracted. -# - Some overrides aren't needed, since the SDK injects paths that take care of -# them. -def var_list2str(var, d): - items = d.getVar(var).split() - return items[0] if len(items) == 1 else ', '.join(repr(s) for s in items) - -def generate_native_link_template(d): - val = ['-L@{OECORE_NATIVE_SYSROOT}${libdir_native}', - '-L@{OECORE_NATIVE_SYSROOT}${base_libdir_native}', - '-Wl,-rpath-link,@{OECORE_NATIVE_SYSROOT}${libdir_native}', - '-Wl,-rpath-link,@{OECORE_NATIVE_SYSROOT}${base_libdir_native}', - '-Wl,--allow-shlib-undefined' - ] - build_arch = d.getVar('BUILD_ARCH') - if 'x86_64' in build_arch: - loader = 'ld-linux-x86-64.so.2' - elif 'i686' in build_arch: - loader = 'ld-linux.so.2' - elif 'aarch64' in build_arch: - loader = 'ld-linux-aarch64.so.1' - elif 'ppc64le' in build_arch: - loader = 'ld64.so.2' - - if loader: - val += ['-Wl,--dynamic-linker=@{OECORE_NATIVE_SYSROOT}${base_libdir_native}/' + loader] - - return repr(val) - -install_templates() { - install -d ${D}${datadir}/meson - - cat >${D}${datadir}/meson/meson.native.template <${D}${datadir}/meson/meson.cross.template <${D}${datadir}/meson/meson.native.template <${D}${datadir}/meson/meson.cross.template < Date: Tue, 19 Nov 2019 12:47:30 -0600 Subject: [PATCH] stdlib: Add strlcat @@ -17,23 +17,23 @@ Signed-off-by: Joshua Watt create mode 100644 stdlib/strlcat.c diff --git a/Makefile.in b/Makefile.in -index bfae1f8..156dc4c 100644 +index b85ebee..045fabe 100644 --- a/Makefile.in +++ b/Makefile.in -@@ -101,7 +101,7 @@ NASM = asm/nasm.$(O) - NDISASM = disasm/ndisasm.$(O) +@@ -104,7 +104,7 @@ PROGOBJ = $(NASM) $(NDISASM) + PROGS = nasm$(X) ndisasm$(X) - LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \ + LIBOBJ_NW = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \ - stdlib/strnlen.$(O) stdlib/strrchrnul.$(O) \ + stdlib/strnlen.$(O) stdlib/strrchrnul.$(O) stdlib/strlcat.$(O) \ \ nasmlib/ver.$(O) \ nasmlib/alloc.$(O) nasmlib/asprintf.$(O) nasmlib/errfile.$(O) \ diff --git a/configure.ac b/configure.ac -index 7b72769..14fd033 100644 +index 42cd198..e206338 100644 --- a/configure.ac +++ b/configure.ac -@@ -234,6 +234,7 @@ PA_FUNC_SNPRINTF +@@ -236,6 +236,7 @@ PA_FUNC_SNPRINTF PA_FUNC_VSNPRINTF AC_CHECK_FUNCS([strlcpy]) AC_CHECK_FUNCS([strrchrnul]) @@ -41,7 +41,7 @@ index 7b72769..14fd033 100644 dnl These types are POSIX-specific, and Windows does it differently... AC_CHECK_TYPES([struct _stati64]) -@@ -253,6 +254,7 @@ AC_CHECK_DECLS(strsep) +@@ -255,6 +256,7 @@ AC_CHECK_DECLS(strsep) AC_CHECK_DECLS(strlcpy) AC_CHECK_DECLS(strnlen) AC_CHECK_DECLS(strrchrnul) @@ -50,7 +50,7 @@ index 7b72769..14fd033 100644 dnl Check for missing types AC_TYPE_UINTPTR_T diff --git a/include/compiler.h b/include/compiler.h -index b4fd3a8..7fb4821 100644 +index 407c160..b64da6a 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -169,6 +169,10 @@ size_t strlcpy(char *, const char *, size_t); diff --git a/poky/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch b/poky/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch index 9f4c8dc0bd..84fcca0fe1 100644 --- a/poky/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch +++ b/poky/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch @@ -1,4 +1,4 @@ -From 81d6519499dcfebe7d21e65e002a8885a4e8d852 Mon Sep 17 00:00:00 2001 +From e28c8883050d34d18ee2d66dfeece51e13adb6d5 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Tue, 19 Nov 2019 13:12:17 -0600 Subject: [PATCH] Add --debug-prefix-map option @@ -17,17 +17,17 @@ Signed-off-by: Joshua Watt nasmlib/filename.c | 20 ++++++++++++++++++++ output/outas86.c | 4 +++- output/outcoff.c | 4 ++-- - output/outelf.c | 2 +- + output/outelf.c | 13 ++++++++----- output/outieee.c | 2 +- output/outobj.c | 2 +- stdlib/strlcat.c | 2 +- test/elfdebugprefix.asm | 6 ++++++ test/performtest.pl | 12 ++++++++++-- - 12 files changed, 82 insertions(+), 9 deletions(-) + 12 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 test/elfdebugprefix.asm diff --git a/asm/nasm.c b/asm/nasm.c -index e5ae89a..7a7f8b4 100644 +index 76c70f6..08ff119 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -939,6 +939,7 @@ enum text_options { @@ -46,7 +46,7 @@ index e5ae89a..7a7f8b4 100644 {"reproducible", OPT_REPRODUCIBLE, ARG_NO, 0}, {NULL, OPT_BOGUS, ARG_NO, 0} }; -@@ -1337,6 +1339,26 @@ static bool process_arg(char *p, char *q, int pass) +@@ -1335,6 +1337,26 @@ static bool process_arg(char *p, char *q, int pass) case OPT_REPRODUCIBLE: reproducible = true; break; @@ -73,7 +73,7 @@ index e5ae89a..7a7f8b4 100644 case OPT_HELP: help(stdout); exit(0); -@@ -2304,6 +2326,8 @@ static void help(FILE *out) +@@ -2298,6 +2320,8 @@ static void help(FILE *out) " -w-x disable warning x (also -Wno-x)\n" " -w[+-]error promote all warnings to errors (also -Werror)\n" " -w[+-]error=x promote warning x to errors (also -Werror=x)\n" @@ -83,7 +83,7 @@ index e5ae89a..7a7f8b4 100644 fprintf(out, " %-20s %s\n", diff --git a/include/nasmlib.h b/include/nasmlib.h -index 438178d..4c3e90d 100644 +index 87a7fc6..a3e5144 100644 --- a/include/nasmlib.h +++ b/include/nasmlib.h @@ -250,10 +250,19 @@ int64_t readstrnum(char *str, int length, bool *warn); @@ -107,7 +107,7 @@ index 438178d..4c3e90d 100644 /* * Utility macros... diff --git a/nasm.txt b/nasm.txt -index cc7fa27..d3485c9 100644 +index 950c361..784618c 100644 --- a/nasm.txt +++ b/nasm.txt @@ -147,6 +147,10 @@ OPTIONS @@ -179,10 +179,10 @@ index 54b22f8..c4a412c 100644 static void as86_cleanup(void) diff --git a/output/outcoff.c b/output/outcoff.c -index 58fa024..14baf7b 100644 +index c2b4eb6..e242db2 100644 --- a/output/outcoff.c +++ b/output/outcoff.c -@@ -1072,14 +1072,14 @@ static void coff_symbol(char *name, int32_t strpos, int32_t value, +@@ -1259,7 +1259,7 @@ static void coff_symbol(char *name, int32_t strpos, int32_t value, static void coff_write_symbols(void) { @@ -191,29 +191,61 @@ index 58fa024..14baf7b 100644 uint32_t i; /* - * The `.file' record, and the file name auxiliary record. - */ - coff_symbol(".file", 0L, 0L, -2, 0, 0x67, 1); -- strncpy(filename, inname, 18); -+ filename_debug_remap(filename, inname, 19); +@@ -1269,7 +1269,7 @@ static void coff_write_symbols(void) + if (reproducible) + memset(filename, 0, 18); + else +- strncpy(filename, inname, 18); ++ filename_debug_remap(filename, inname, 19); nasm_write(filename, 18, ofile); /* diff --git a/output/outelf.c b/output/outelf.c -index 61af020..1292958 100644 +index ad8d210..29f1dc1 100644 --- a/output/outelf.c +++ b/output/outelf.c -@@ -553,7 +553,7 @@ static void elf_init(void) - }; +@@ -546,8 +546,8 @@ static void elf_init(void) const char * const *p; + const char * cur_path = nasm_realpath(inname); - strlcpy(elf_module, inname, sizeof(elf_module)); +- strlcpy(elf_dir, nasm_dirname(cur_path), sizeof(elf_dir)); + filename_debug_remap(elf_module, inname, sizeof(elf_module)); ++ filename_debug_remap(elf_dir, nasm_dirname(cur_path), sizeof(elf_dir)); sects = NULL; nsects = sectlen = 0; syms = saa_init((int32_t)sizeof(struct elf_symbol)); +@@ -3590,13 +3590,17 @@ static void dwarf_findfile(const char * fname) + if (dwarf_clist && !(strcmp(fname, dwarf_clist->filename))) + return; + ++ char * fname_remapped = nasm_malloc(FILENAME_MAX); ++ filename_debug_remap(fname_remapped,fname,FILENAME_MAX); ++ + /* search for match */ + match = 0; + if (dwarf_flist) { + match = dwarf_flist; + for (finx = 0; finx < dwarf_numfiles; finx++) { +- if (!(strcmp(fname, match->filename))) { ++ if (!(strcmp(fname_remapped, match->filename))) { + dwarf_clist = match; ++ nasm_free(fname_remapped); + return; + } + match = match->next; +@@ -3607,8 +3611,7 @@ static void dwarf_findfile(const char * fname) + dwarf_clist = nasm_malloc(sizeof(struct linelist)); + dwarf_numfiles++; + dwarf_clist->line = dwarf_numfiles; +- dwarf_clist->filename = nasm_malloc(strlen(fname) + 1); +- strcpy(dwarf_clist->filename,fname); ++ dwarf_clist->filename = fname_remapped; + dwarf_clist->next = 0; + if (!dwarf_flist) { /* if first entry */ + dwarf_flist = dwarf_elist = dwarf_clist; diff --git a/output/outieee.c b/output/outieee.c -index 6d6d4b2..cdb8333 100644 +index 7ba9036..796e5af 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -207,7 +207,7 @@ static void ieee_unqualified_name(char *, char *); @@ -226,7 +258,7 @@ index 6d6d4b2..cdb8333 100644 fpubhead = NULL; fpubtail = &fpubhead; diff --git a/output/outobj.c b/output/outobj.c -index 56b43f9..fefea94 100644 +index 281839d..fc336c1 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -644,7 +644,7 @@ static enum directive_result obj_directive(enum directive, char *); @@ -264,7 +296,7 @@ index 0000000..a67ba29 + ret + diff --git a/test/performtest.pl b/test/performtest.pl -index f7865b3..096f960 100755 +index 46b1bdf..2426848 100755 --- a/test/performtest.pl +++ b/test/performtest.pl @@ -42,14 +42,22 @@ sub perform { diff --git a/poky/meta/recipes-devtools/nasm/nasm_2.15.05.bb b/poky/meta/recipes-devtools/nasm/nasm_2.15.05.bb deleted file mode 100644 index edc17aeebf..0000000000 --- a/poky/meta/recipes-devtools/nasm/nasm_2.15.05.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "General-purpose x86 assembler" -SECTION = "devel" -HOMEPAGE = "http://www.nasm.us/" -DESCRIPTION = "The Netwide Assembler (NASM) is an assembler and disassembler for the Intel x86 architecture." -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=90904486f8fbf1861cf42752e1a39efe" - -SRC_URI = "http://www.nasm.us/pub/nasm/releasebuilds/${PV}/nasm-${PV}.tar.bz2 \ - file://0001-stdlib-Add-strlcat.patch \ - file://0002-Add-debug-prefix-map-option.patch \ - " - -SRC_URI[sha256sum] = "3c4b8339e5ab54b1bcb2316101f8985a5da50a3f9e504d43fa6f35668bee2fd0" - -EXTRA_AUTORECONF:append = " -I autoconf/m4" - -inherit autotools-brokensep - -BBCLASSEXTEND = "native" - -DEPENDS = "groff-native" - -CVE_PRODUCT = "netwide_assembler" diff --git a/poky/meta/recipes-devtools/nasm/nasm_2.16.01.bb b/poky/meta/recipes-devtools/nasm/nasm_2.16.01.bb new file mode 100644 index 0000000000..219cc49360 --- /dev/null +++ b/poky/meta/recipes-devtools/nasm/nasm_2.16.01.bb @@ -0,0 +1,23 @@ +SUMMARY = "General-purpose x86 assembler" +SECTION = "devel" +HOMEPAGE = "http://www.nasm.us/" +DESCRIPTION = "The Netwide Assembler (NASM) is an assembler and disassembler for the Intel x86 architecture." +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=90904486f8fbf1861cf42752e1a39efe" + +SRC_URI = "http://www.nasm.us/pub/nasm/releasebuilds/${PV}/nasm-${PV}.tar.bz2 \ + file://0001-stdlib-Add-strlcat.patch \ + file://0002-Add-debug-prefix-map-option.patch \ + " + +SRC_URI[sha256sum] = "35b6ad2ee048d41c4779f073f3efca7762a822b7d2d4ef4e8df24cf65747bb2e" + +EXTRA_AUTORECONF:append = " -I autoconf/m4" + +inherit autotools-brokensep + +BBCLASSEXTEND = "native" + +DEPENDS = "groff-native" + +CVE_PRODUCT = "netwide_assembler" diff --git a/poky/meta/recipes-devtools/opkg/opkg/0002-opkg-key-remove-no-options-flag-from-gpg-calls.patch b/poky/meta/recipes-devtools/opkg/opkg/0002-opkg-key-remove-no-options-flag-from-gpg-calls.patch new file mode 100644 index 0000000000..f216950002 --- /dev/null +++ b/poky/meta/recipes-devtools/opkg/opkg/0002-opkg-key-remove-no-options-flag-from-gpg-calls.patch @@ -0,0 +1,34 @@ +From a658e6402382250f0164c5b47b744740e04f3611 Mon Sep 17 00:00:00 2001 +From: Charlie Johnston +Date: Fri, 30 Dec 2022 15:21:14 -0600 +Subject: [PATCH] opkg-key: Remove --no-options flag from gpg calls. + +The opkg-key script was always passing the --no-options +flag to gpg, which uses /dev/null as the options file. +As a result, the opkg gpg.conf file was not getting +used. This change removes that flag so that gpg.conf +in the GPGHOMEDIR for opkg (currently /etc/opkg/gpg/) +will be used if present. + +Upstream-Status: Accepted [https://git.yoctoproject.org/opkg/commit/?id=cee294e72d257417b5e55ef7a76a0fd15313e46b] +Signed-off-by: Charlie Johnston +--- + utils/opkg-key | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/utils/opkg-key b/utils/opkg-key +index e395a59..8645ebc 100755 +--- a/utils/opkg-key ++++ b/utils/opkg-key +@@ -53,7 +53,7 @@ else + exit 1 + fi + +-GPG="$GPGCMD --no-options --homedir $GPGHOMEDIR" ++GPG="$GPGCMD --homedir $GPGHOMEDIR" + + # Gpg home dir isn't created automatically when --homedir option is used + if [ ! -e "$GPGHOMEDIR" ]; then +-- +2.30.2 + diff --git a/poky/meta/recipes-devtools/opkg/opkg_0.6.0.bb b/poky/meta/recipes-devtools/opkg/opkg_0.6.0.bb deleted file mode 100644 index 4cd589cd29..0000000000 --- a/poky/meta/recipes-devtools/opkg/opkg_0.6.0.bb +++ /dev/null @@ -1,73 +0,0 @@ -SUMMARY = "Open Package Manager" -SUMMARY:libopkg = "Open Package Manager library" -SECTION = "base" -HOMEPAGE = "http://code.google.com/p/opkg/" -DESCRIPTION = "Opkg is a lightweight package management system based on Ipkg." -BUGTRACKER = "http://code.google.com/p/opkg/issues/list" -LICENSE = "GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ - file://src/opkg.c;beginline=4;endline=18;md5=d6200b0f2b41dee278aa5fad333eecae" - -DEPENDS = "libarchive" - -PE = "1" - -SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \ - file://opkg.conf \ - file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ - file://run-ptest \ -" - -SRC_URI[sha256sum] = "56844722eff237daf14aa6e681436f3245213c5590ed0cda37a79df637ff3a4c" - -# This needs to be before ptest inherit, otherwise all ptest files end packaged -# in libopkg package if OPKGLIBDIR == libdir, because default -# PTEST_PATH ?= "${libdir}/${BPN}/ptest" -PACKAGES =+ "libopkg" - -inherit autotools pkgconfig ptest - -target_localstatedir := "${localstatedir}" -OPKGLIBDIR ??= "${target_localstatedir}/lib" - -PACKAGECONFIG ??= "libsolv" - -PACKAGECONFIG[gpg] = "--enable-gpg,--disable-gpg,\ - gnupg gpgme libgpg-error,\ - ${@ "gnupg" if ("native" in d.getVar("PN")) else "gnupg-gpg"}\ - " -PACKAGECONFIG[curl] = "--enable-curl,--disable-curl,curl" -PACKAGECONFIG[ssl-curl] = "--enable-ssl-curl,--disable-ssl-curl,curl openssl" -PACKAGECONFIG[sha256] = "--enable-sha256,--disable-sha256" -PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd" -PACKAGECONFIG[libsolv] = "--with-libsolv,--without-libsolv,libsolv" - -EXTRA_OECONF:class-native = "--localstatedir=/${@os.path.relpath('${localstatedir}', '${STAGING_DIR_NATIVE}')} --sysconfdir=/${@os.path.relpath('${sysconfdir}', '${STAGING_DIR_NATIVE}')}" - -do_install:append () { - install -d ${D}${sysconfdir}/opkg - install -m 0644 ${WORKDIR}/opkg.conf ${D}${sysconfdir}/opkg/opkg.conf - echo "option lists_dir ${OPKGLIBDIR}/opkg/lists" >>${D}${sysconfdir}/opkg/opkg.conf - - # We need to create the lock directory - install -d ${D}${OPKGLIBDIR}/opkg -} - -do_install_ptest () { - sed -i -e '/@echo $^/d' ${D}${PTEST_PATH}/tests/Makefile - sed -i -e '/@PYTHONPATH=. $(PYTHON) $^/a\\t@if [ "$$?" != "0" ];then echo "FAIL:"$^;else echo "PASS:"$^;fi' ${D}${PTEST_PATH}/tests/Makefile -} - -RDEPENDS:${PN} = "${VIRTUAL-RUNTIME_update-alternatives} opkg-arch-config libarchive" -RDEPENDS:${PN}:class-native = "" -RDEPENDS:${PN}:class-nativesdk = "" -RDEPENDS:${PN}-ptest += "make binutils python3-core python3-compression" -RREPLACES:${PN} = "opkg-nogpg opkg-collateral" -RCONFLICTS:${PN} = "opkg-collateral" -RPROVIDES:${PN} = "opkg-collateral" - -FILES:libopkg = "${libdir}/*.so.* ${OPKGLIBDIR}/opkg/" - -BBCLASSEXTEND = "native nativesdk" - -CONFFILES:${PN} = "${sysconfdir}/opkg/opkg.conf" diff --git a/poky/meta/recipes-devtools/opkg/opkg_0.6.1.bb b/poky/meta/recipes-devtools/opkg/opkg_0.6.1.bb new file mode 100644 index 0000000000..712f066f0e --- /dev/null +++ b/poky/meta/recipes-devtools/opkg/opkg_0.6.1.bb @@ -0,0 +1,76 @@ +SUMMARY = "Open Package Manager" +SUMMARY:libopkg = "Open Package Manager library" +SECTION = "base" +HOMEPAGE = "http://code.google.com/p/opkg/" +DESCRIPTION = "Opkg is a lightweight package management system based on Ipkg." +BUGTRACKER = "http://code.google.com/p/opkg/issues/list" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ + file://src/opkg.c;beginline=4;endline=18;md5=d6200b0f2b41dee278aa5fad333eecae" + +DEPENDS = "libarchive" + +PE = "1" + +SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \ + file://opkg.conf \ + file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ + file://0002-opkg-key-remove-no-options-flag-from-gpg-calls.patch \ + file://run-ptest \ +" + +SRC_URI[sha256sum] = "e87fccb575c64d3ac0559444016a2795f12125986a0da896bab97c4a1a2f1b2a" + +# This needs to be before ptest inherit, otherwise all ptest files end packaged +# in libopkg package if OPKGLIBDIR == libdir, because default +# PTEST_PATH ?= "${libdir}/${BPN}/ptest" +PACKAGES =+ "libopkg" + +inherit autotools pkgconfig ptest + +target_localstatedir := "${localstatedir}" +OPKGLIBDIR ??= "${target_localstatedir}/lib" + +PACKAGECONFIG ??= "libsolv" + +PACKAGECONFIG[gpg] = "--enable-gpg,--disable-gpg,\ + gnupg gpgme libgpg-error,\ + ${@ "gnupg" if ("native" in d.getVar("PN")) else "gnupg-gpg"}\ + " +PACKAGECONFIG[curl] = "--enable-curl,--disable-curl,curl" +PACKAGECONFIG[ssl-curl] = "--enable-ssl-curl,--disable-ssl-curl,curl openssl" +PACKAGECONFIG[sha256] = "--enable-sha256,--disable-sha256" +PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd" +PACKAGECONFIG[libsolv] = "--with-libsolv,--without-libsolv,libsolv" + +EXTRA_OECONF:class-native = "--localstatedir=/${@os.path.relpath('${localstatedir}', '${STAGING_DIR_NATIVE}')} --sysconfdir=/${@os.path.relpath('${sysconfdir}', '${STAGING_DIR_NATIVE}')}" + +do_install:append () { + install -d ${D}${sysconfdir}/opkg + install -m 0644 ${WORKDIR}/opkg.conf ${D}${sysconfdir}/opkg/opkg.conf + echo "option lists_dir ${OPKGLIBDIR}/opkg/lists" >>${D}${sysconfdir}/opkg/opkg.conf + echo "option info_dir ${OPKGLIBDIR}/opkg/info" >>${D}${sysconfdir}/opkg/opkg.conf + echo "option status_file ${OPKGLIBDIR}/opkg/status" >>${D}${sysconfdir}/opkg/opkg.conf + + # We need to create the lock directory + install -d ${D}${OPKGLIBDIR}/opkg +} + +do_install_ptest () { + sed -i -e '/@echo $^/d' ${D}${PTEST_PATH}/tests/Makefile + sed -i -e '/@PYTHONPATH=. $(PYTHON) $^/a\\t@if [ "$$?" != "0" ];then echo "FAIL:"$^;else echo "PASS:"$^;fi' ${D}${PTEST_PATH}/tests/Makefile +} + +RDEPENDS:${PN} = "${VIRTUAL-RUNTIME_update-alternatives} opkg-arch-config libarchive" +RDEPENDS:${PN}:class-native = "" +RDEPENDS:${PN}:class-nativesdk = "" +RDEPENDS:${PN}-ptest += "make binutils python3-core python3-compression" +RREPLACES:${PN} = "opkg-nogpg opkg-collateral" +RCONFLICTS:${PN} = "opkg-collateral" +RPROVIDES:${PN} = "opkg-collateral" + +FILES:libopkg = "${libdir}/*.so.* ${OPKGLIBDIR}/opkg/" + +BBCLASSEXTEND = "native nativesdk" + +CONFFILES:${PN} = "${sysconfdir}/opkg/opkg.conf" diff --git a/poky/meta/recipes-devtools/patchelf/patchelf/8d2cb4f9ab8d564904c292099a022ffb3cccd52d.patch b/poky/meta/recipes-devtools/patchelf/patchelf/8d2cb4f9ab8d564904c292099a022ffb3cccd52d.patch new file mode 100644 index 0000000000..6296f0e44b --- /dev/null +++ b/poky/meta/recipes-devtools/patchelf/patchelf/8d2cb4f9ab8d564904c292099a022ffb3cccd52d.patch @@ -0,0 +1,104 @@ +From 8d2cb4f9ab8d564904c292099a022ffb3cccd52d Mon Sep 17 00:00:00 2001 +From: Jason +Date: Fri, 2 Dec 2022 10:01:41 -0500 +Subject: [PATCH] Fix bug in file shifting that could cause conflicting PT_LOAD + segments + +When a section in the file needs to be enlarged (e.g. to accommodate +setting a larger RPATH), shiftFile() is used to shift all content +following the growing section to a later position in the file. + +Commit 109b771f53ee3d37ede8c0f165665605183c0975 introduced logic to +ensure that, after the segment split, no sections span multiple +segments. This is done by sliding the portion of the segment after the +split point later in the file, then adding a new PT_LOAD segment that +contains the preceding data plus the extra room that is being added. The +existing implementation does this by simply adding +`extraPages*getPageSize()` bytes to the number of bytes ahead of the +split point in the segment. + +However, this approach can result in two PT_LOAD segments that overlap +when page boundaries are taken into account. As an example, this PT_LOAD +section (taken from a Python 3.10 binary): + +LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000 + 0x0000000000000948 0x0000000000000948 R E 0x200000 + +is split into the following two sections: + +LOAD 0x0000000000000000 0x00000000003ff000 0x00000000003ff000 + 0x0000000000001594 0x0000000000001594 R E 0x1000 +LOAD 0x0000000000001594 0x0000000000400594 0x0000000000400594 + 0x00000000000003b4 0x00000000000003b4 R E 0x1000 + +Note that the two PT_LOAD sections both contain the memory page at +address 0x400000. The Linux kernel's ELF loader (at least as of v4.18) +does not accept this as a valid ELF executable, triggering a segfault +with si_code=SI_KERNEL immediately when the binary is executed. + +The fix here is to set the length of the segment that comes before the +split point more carefully; instead of adding `extraPages*getPageSize()` +bytes to the portion of the segment that came before the split, the +actual number of padding bytes that were needed (before rounding up to +the next multiple of the page size) are used. This avoids the overlap +in the PT_LOAD segments and makes the output files executable again. +--- + src/patchelf.cc | 10 ++++++---- + src/patchelf.h | 2 +- + 2 files changed, 7 insertions(+), 5 deletions(-) + +Upstream-Status: Submitted [https://github.com/NixOS/patchelf/pull/447] +Signed-off-by: Richard Purdie + +Index: git/src/patchelf.cc +=================================================================== +--- git.orig/src/patchelf.cc ++++ git/src/patchelf.cc +@@ -432,7 +432,7 @@ static uint64_t roundUp(uint64_t n, uint + + + template +-void ElfFile::shiftFile(unsigned int extraPages, size_t startOffset) ++void ElfFile::shiftFile(unsigned int extraPages, size_t startOffset, size_t extraBytes) + { + assert(startOffset >= sizeof(Elf_Ehdr)); + +@@ -508,7 +508,7 @@ void ElfFile::shiftFi + wri(phdr.p_offset, phdrs.at(splitIndex).p_offset - splitShift - shift); + wri(phdr.p_paddr, phdrs.at(splitIndex).p_paddr - splitShift - shift); + wri(phdr.p_vaddr, phdrs.at(splitIndex).p_vaddr - splitShift - shift); +- wri(phdr.p_filesz, wri(phdr.p_memsz, splitShift + shift)); ++ wri(phdr.p_filesz, wri(phdr.p_memsz, splitShift + extraBytes)); + wri(phdr.p_flags, PF_R | PF_W); + wri(phdr.p_align, getPageSize()); + } +@@ -898,12 +898,14 @@ void ElfFile::rewrite + neededSpace += sizeof(Elf_Phdr); + debug("needed space is %d\n", neededSpace); + +- unsigned int neededPages = roundUp(neededSpace - startOffset, getPageSize()) / getPageSize(); ++ /* Calculate how many bytes are needed out of the additional pages. */ ++ size_t extraSpace = neededSpace - startOffset; ++ unsigned int neededPages = roundUp(extraSpace, getPageSize()) / getPageSize(); + debug("needed pages is %d\n", neededPages); + if (neededPages * getPageSize() > firstPage) + error("virtual address space underrun!"); + +- shiftFile(neededPages, startOffset); ++ shiftFile(neededPages, startOffset, extraSpace); + + firstPage -= neededPages * getPageSize(); + startOffset += neededPages * getPageSize(); +Index: git/src/patchelf.h +=================================================================== +--- git.orig/src/patchelf.h ++++ git/src/patchelf.h +@@ -77,7 +77,7 @@ private: + + void sortShdrs(); + +- void shiftFile(unsigned int extraPages, size_t sizeOffset); ++ void shiftFile(unsigned int extraPages, size_t sizeOffset, size_t extraBytes); + + std::string getSectionName(const Elf_Shdr & shdr) const; + diff --git a/poky/meta/recipes-devtools/patchelf/patchelf_0.16.1.bb b/poky/meta/recipes-devtools/patchelf/patchelf_0.16.1.bb deleted file mode 100644 index 8ce9e99520..0000000000 --- a/poky/meta/recipes-devtools/patchelf/patchelf_0.16.1.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "Tool to allow editing of RPATH and interpreter fields in ELF binaries" -DESCRIPTION = "PatchELF is a simple utility for modifying existing ELF executables and libraries." -HOMEPAGE = "https://github.com/NixOS/patchelf" - -LICENSE = "GPL-3.0-only" - -SRC_URI = "git://github.com/NixOS/patchelf;protocol=https;branch=master \ - " -SRCREV = "438d23e29c73beb8f16e04efe2a91daa6819ef34" - -S = "${WORKDIR}/git" - -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -inherit autotools - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/patchelf/patchelf_0.17.0.bb b/poky/meta/recipes-devtools/patchelf/patchelf_0.17.0.bb new file mode 100644 index 0000000000..b32abc7b87 --- /dev/null +++ b/poky/meta/recipes-devtools/patchelf/patchelf_0.17.0.bb @@ -0,0 +1,18 @@ +SUMMARY = "Tool to allow editing of RPATH and interpreter fields in ELF binaries" +DESCRIPTION = "PatchELF is a simple utility for modifying existing ELF executables and libraries." +HOMEPAGE = "https://github.com/NixOS/patchelf" + +LICENSE = "GPL-3.0-only" + +SRC_URI = "git://github.com/NixOS/patchelf;protocol=https;branch=master \ + file://8d2cb4f9ab8d564904c292099a022ffb3cccd52d.patch \ + " +SRCREV = "ad0265668f12eff59027259345fed4b0f315336a" + +S = "${WORKDIR}/git" + +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +inherit autotools + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/perl/libmodule-build-perl_0.4231.bb b/poky/meta/recipes-devtools/perl/libmodule-build-perl_0.4231.bb deleted file mode 100644 index 881d5e672e..0000000000 --- a/poky/meta/recipes-devtools/perl/libmodule-build-perl_0.4231.bb +++ /dev/null @@ -1,124 +0,0 @@ -SUMMARY = "Module::Build - Build and install Perl modules" -DESCRIPTION = "Many Perl distributions use a Build.PL file instead of a \ -Makefile.PL file to drive distribution configuration, build, test and \ -installation. Traditionally, Build.PL uses Module::Build as the underlying \ -build system. This module provides a simple, lightweight, drop-in replacement. \ -Whereas Module::Build has over 6,700 lines of code; this module has less than \ -120, yet supports the features needed by most distributions." - -SECTION = "libs" - -HOMEPAGE = "https://metacpan.org/release/Module-Build" - -LICENSE = "Artistic-1.0 | GPL-1.0-or-later" -LIC_FILES_CHKSUM = "file://README;beginline=949;endline=954;md5=624c06db56a2af4d70cf9edc29fcae1b" - -SRC_URI = "${CPAN_MIRROR}/authors/id/L/LE/LEONT/Module-Build-${PV}.tar.gz \ - file://run-ptest \ - " -SRC_URI[md5sum] = "066b193e461d7dfe1eca17a139353001" -SRC_URI[sha256sum] = "7e0f4c692c1740c1ac84ea14d7ea3d8bc798b2fb26c09877229e04f430b2b717" - -S = "${WORKDIR}/Module-Build-${PV}" - -inherit cpan_build ptest-perl - -# From: -# https://github.com/rehsack/meta-cpan/blob/master/recipes-devel/module-build-perl/module-build-perl_0.4216.bb -# -do_patch_module_build () { - cd ${S} - sed -i -e 's,my $interpreter = $self->{properties}{perl};,my $interpreter = "${bindir}/perl";,g' lib/Module/Build/Base.pm -} - -do_patch[postfuncs] += "do_patch_module_build" - -EXTRA_CPAN_BUILD_FLAGS = "--create_packlist=0" - -do_install:append () { - rm -rf ${D}${docdir}/perl/html - sed -i "s:^#!.*:#!/usr/bin/env perl:" ${D}${bindir}/config_data -} - -do_install_ptest() { - cp -r ${B}/inc ${D}${PTEST_PATH} - cp -r ${B}/blib ${D}${PTEST_PATH} - cp -r ${B}/_build ${D}${PTEST_PATH} - cp -r ${B}/lib ${D}${PTEST_PATH} - chown -R root:root ${D}${PTEST_PATH} - sed -i -e "s,'perl' => .*,'perl' => '/usr/bin/perl'\,,g" \ - -e "s,${STAGING_BINDIR_NATIVE}/perl-native/\.\.,${bindir}/,g" \ - -e "s,${S},,g" \ - -e "s,${D},,g" \ - ${D}${PTEST_PATH}/_build/build_params \ - ${D}${PTEST_PATH}/_build/runtime_params - rm -rf ${D}${PTEST_PATH}/blib/libhtml/site/lib/Module/ - rm -rf ${D}${PTEST_PATH}/_build/magicnum -} - -RDEPENDS:${PN} += " \ - perl-module-carp \ - perl-module-cpan \ - perl-module-config \ - perl-module-cwd \ - perl-module-data-dumper \ - perl-module-encode \ - perl-module-extutils-cbuilder \ - perl-module-extutils-command \ - perl-module-extutils-install \ - perl-module-extutils-installed \ - perl-module-extutils-mkbootstrap \ - perl-module-extutils-packlist \ - perl-module-extutils-parsexs \ - perl-module-file-basename \ - perl-module-file-compare \ - perl-module-file-copy \ - perl-module-file-find \ - perl-module-file-glob \ - perl-module-file-path \ - perl-module-file-spec \ - perl-module-file-spec-functions \ - perl-module-getopt-long \ - perl-module-metadata \ - perl-module-perl-ostype \ - perl-module-pod-man \ - perl-module-tap-harness \ - perl-module-text-abbrev \ - perl-module-text-parsewords \ - perl-module-utf8 \ -" - -RDEPENDS:${PN}-ptest += " \ - packagegroup-core-buildessential \ - perl-dev \ - perl-module-blib \ - perl-module-extutils-command-mm \ - perl-module-file-temp \ - perl-module-lib \ - perl-module-perlio \ - perl-module-perlio-encoding \ - perl-module-pod-text \ - perl-module-tap-harness-env \ - perl-module-tap-parser \ - perl-module-tap-parser-scheduler \ - perl-module-test-harness \ - perl-module-test-more \ -" - -RPROVIDES:${PN} += "\ - libmodule-build-base-perl \ - libmodule-build-compat-perl \ - libmodule-build-config-perl \ - libmodule-build-cookbook-perl \ - libmodule-build-dumper-perl \ - libmodule-build-notes-perl \ - libmodule-build-ppmaker-perl \ - libmodule-build-platform-default-perl \ - libmodule-build-platform-unix-perl \ - libmodule-build-podparser-perl \ -" - -# t/xs.t RDEPENDS on "EXTERN.h" provided by perl-dev -INSANE_SKIP:${PN}-ptest = "dev-deps" - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/perl/libmodule-build-perl_0.4232.bb b/poky/meta/recipes-devtools/perl/libmodule-build-perl_0.4232.bb new file mode 100644 index 0000000000..748412b414 --- /dev/null +++ b/poky/meta/recipes-devtools/perl/libmodule-build-perl_0.4232.bb @@ -0,0 +1,123 @@ +SUMMARY = "Module::Build - Build and install Perl modules" +DESCRIPTION = "Many Perl distributions use a Build.PL file instead of a \ +Makefile.PL file to drive distribution configuration, build, test and \ +installation. Traditionally, Build.PL uses Module::Build as the underlying \ +build system. This module provides a simple, lightweight, drop-in replacement. \ +Whereas Module::Build has over 6,700 lines of code; this module has less than \ +120, yet supports the features needed by most distributions." + +SECTION = "libs" + +HOMEPAGE = "https://metacpan.org/release/Module-Build" + +LICENSE = "Artistic-1.0 | GPL-1.0-or-later" +LIC_FILES_CHKSUM = "file://README;beginline=881;endline=886;md5=3027f56c664545e54678c26b7f1ac19c" + +SRC_URI = "${CPAN_MIRROR}/authors/id/L/LE/LEONT/Module-Build-${PV}.tar.gz \ + file://run-ptest \ + " +SRC_URI[sha256sum] = "67c82ee245d94ba06decfa25572ab75fdcd26a9009094289d8f45bc54041771b" + +S = "${WORKDIR}/Module-Build-${PV}" + +inherit cpan_build ptest-perl + +# From: +# https://github.com/rehsack/meta-cpan/blob/master/recipes-devel/module-build-perl/module-build-perl_0.4216.bb +# +do_patch_module_build () { + cd ${S} + sed -i -e 's,my $interpreter = $self->{properties}{perl};,my $interpreter = "${bindir}/perl";,g' lib/Module/Build/Base.pm +} + +do_patch[postfuncs] += "do_patch_module_build" + +EXTRA_CPAN_BUILD_FLAGS = "--create_packlist=0" + +do_install:append () { + rm -rf ${D}${docdir}/perl/html + sed -i "s:^#!.*:#!/usr/bin/env perl:" ${D}${bindir}/config_data +} + +do_install_ptest() { + cp -r ${B}/inc ${D}${PTEST_PATH} + cp -r ${B}/blib ${D}${PTEST_PATH} + cp -r ${B}/_build ${D}${PTEST_PATH} + cp -r ${B}/lib ${D}${PTEST_PATH} + chown -R root:root ${D}${PTEST_PATH} + sed -i -e "s,'perl' => .*,'perl' => '/usr/bin/perl'\,,g" \ + -e "s,${STAGING_BINDIR_NATIVE}/perl-native/\.\.,${bindir}/,g" \ + -e "s,${S},,g" \ + -e "s,${D},,g" \ + ${D}${PTEST_PATH}/_build/build_params \ + ${D}${PTEST_PATH}/_build/runtime_params + rm -rf ${D}${PTEST_PATH}/blib/libhtml/site/lib/Module/ + rm -rf ${D}${PTEST_PATH}/_build/magicnum +} + +RDEPENDS:${PN} += " \ + perl-module-carp \ + perl-module-cpan \ + perl-module-config \ + perl-module-cwd \ + perl-module-data-dumper \ + perl-module-encode \ + perl-module-extutils-cbuilder \ + perl-module-extutils-command \ + perl-module-extutils-install \ + perl-module-extutils-installed \ + perl-module-extutils-mkbootstrap \ + perl-module-extutils-packlist \ + perl-module-extutils-parsexs \ + perl-module-file-basename \ + perl-module-file-compare \ + perl-module-file-copy \ + perl-module-file-find \ + perl-module-file-glob \ + perl-module-file-path \ + perl-module-file-spec \ + perl-module-file-spec-functions \ + perl-module-getopt-long \ + perl-module-metadata \ + perl-module-perl-ostype \ + perl-module-pod-man \ + perl-module-tap-harness \ + perl-module-text-abbrev \ + perl-module-text-parsewords \ + perl-module-utf8 \ +" + +RDEPENDS:${PN}-ptest += " \ + packagegroup-core-buildessential \ + perl-dev \ + perl-module-blib \ + perl-module-extutils-command-mm \ + perl-module-file-temp \ + perl-module-lib \ + perl-module-perlio \ + perl-module-perlio-encoding \ + perl-module-pod-text \ + perl-module-tap-harness-env \ + perl-module-tap-parser \ + perl-module-tap-parser-scheduler \ + perl-module-test-harness \ + perl-module-test-more \ +" + +RPROVIDES:${PN} += "\ + libmodule-build-base-perl \ + libmodule-build-compat-perl \ + libmodule-build-config-perl \ + libmodule-build-cookbook-perl \ + libmodule-build-dumper-perl \ + libmodule-build-notes-perl \ + libmodule-build-ppmaker-perl \ + libmodule-build-platform-default-perl \ + libmodule-build-platform-unix-perl \ + libmodule-build-podparser-perl \ +" + +# t/xs.t RDEPENDS on "EXTERN.h" provided by perl-dev +INSANE_SKIP:${PN}-ptest = "dev-deps" + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/perl/libtest-fatal-perl_0.017.bb b/poky/meta/recipes-devtools/perl/libtest-fatal-perl_0.017.bb new file mode 100644 index 0000000000..1c3a7e5136 --- /dev/null +++ b/poky/meta/recipes-devtools/perl/libtest-fatal-perl_0.017.bb @@ -0,0 +1,36 @@ +SUMMARY = "Incredibly simple helpers for testing code with exceptions" +DESCRIPTION = "Test::Fatal is an alternative to the popular Test::Exception.\ +It does much less, but should allow greater flexibility in testing \ +exception-throwing code with about the same amount of typing." +HOMEPAGE = "https://github.com/rjbs/Test-Fatal" +BUGTRACKER = "https://github.com/rjbs/Test-Fatal/issues" +SECTION = "libs" +LICENSE = "Artistic-1.0 | GPL-1.0-or-later" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=b5c851290cab1dda12fcfb0e9ec43639" + +SRC_URI = "${CPAN_MIRROR}/authors/id/R/RJ/RJBS/Test-Fatal-${PV}.tar.gz" + +SRC_URI[sha256sum] = "37dfffdafb84b762efe96b02fb2aa41f37026c73e6b83590db76229697f3c4a6" + +S = "${WORKDIR}/Test-Fatal-${PV}" + +inherit cpan ptest-perl + +RDEPENDS:${PN} += "\ + libtry-tiny-perl \ + perl-module-carp \ + perl-module-exporter \ + perl-module-test-builder \ +" + +RDEPENDS:${PN}-ptest += "\ + perl-module-extutils-makemaker \ + perl-module-extutils-mm-unix \ + perl-module-file-spec \ + perl-module-overload \ + perl-module-test-builder-tester \ + perl-module-test-more \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/perl/libtest-warnings-perl_0.031.bb b/poky/meta/recipes-devtools/perl/libtest-warnings-perl_0.031.bb new file mode 100644 index 0000000000..e03deaf15f --- /dev/null +++ b/poky/meta/recipes-devtools/perl/libtest-warnings-perl_0.031.bb @@ -0,0 +1,39 @@ +# Copyright (C) 2020 Jens Rehsack +# Released under the MIT license (see COPYING.MIT for the terms) + +SUMMARY = "Test::Warnings - Test for warnings and the lack of them" +DESCRIPTION = "If you've ever tried to use Test::NoWarnings to confirm there are no \ +warnings generated by your tests, combined with the convenience of \ +\\"done_testing\\" to not have to declare a test count, you'll have discovered \ +that these two features do not play well together, as the test count will \ +be calculated *before* the warnings test is run, resulting in a TAP error. \ +(See "examples/test_nowarnings.pl" in this distribution for a \ +demonstration.)" +HOMEPAGE = "https://github.com/karenetheridge/Test-Warnings" +BUGTRACKER = "https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Warnings" +SECTION = "libs" +LICENSE = "Artistic-1.0 | GPL-1.0-or-later" + +LIC_FILES_CHKSUM = "file://LICENCE;md5=6f2b02f39e7d359efd9525fbc56c84a1" + +SRC_URI = "${CPAN_MIRROR}/authors/id/E/ET/ETHER/Test-Warnings-${PV}.tar.gz" + +SRC_URI[sha256sum] = "1e542909fef305e45563e9878ea1c3b0c7cef1b28bb7ae07eba2e1efabec477b" + +S = "${WORKDIR}/Test-Warnings-${PV}" + +inherit cpan ptest-perl + +RDEPENDS:${PN} += "\ + perl-module-test-builder \ +" + +# Many hidden dependencies and mysterious failures occur without full perl-modules +RDEPENDS:${PN}-ptest += "perl-modules" + +do_install_ptest_perl:append () { + cp -r ${B}/t/lib ${D}${PTEST_PATH}/t/ + chown -R root:root ${D}${PTEST_PATH}/t/lib +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/perl/libtry-tiny-perl_0.31.bb b/poky/meta/recipes-devtools/perl/libtry-tiny-perl_0.31.bb new file mode 100644 index 0000000000..a3728d8435 --- /dev/null +++ b/poky/meta/recipes-devtools/perl/libtry-tiny-perl_0.31.bb @@ -0,0 +1,36 @@ +SUMMARY = "Try::Tiny - Minimal try/catch with proper preservation of $@" +DESCRIPTION = "This module provides bare bones try/catch/finally statements \ +that are designed to minimize common mistakes with eval blocks, and NOTHING \ +else." +HOMEPAGE = "https://github.com/p5sagit/Try-Tiny" +BUGTRACKER = "https://rt.cpan.org/Public/Dist/Display.html?Name=Try-Tiny" +SECTION = "libs" +LICENSE = "MIT" + +LIC_FILES_CHKSUM = "file://LICENCE;md5=5dc332c2d4aade55f5db244681000091" + +SRC_URI = "${CPAN_MIRROR}/authors/id/E/ET/ETHER/Try-Tiny-${PV}.tar.gz" + +SRC_URI[sha256sum] = "3300d31d8a4075b26d8f46ce864a1d913e0e8467ceeba6655d5d2b2e206c11be" + +S = "${WORKDIR}/Try-Tiny-${PV}" + +inherit cpan ptest-perl + +RDEPENDS:${PN} += "\ + perl-module-carp \ + perl-module-constant \ + perl-module-exporter \ +" +RRECOMMENDS:${PN} += "\ + perl-module-sub-util \ +" +RDEPENDS:${PN}-ptest += "\ + perl-module-extutils-makemaker \ + perl-module-extutils-mm-unix \ + perl-module-file-spec \ + perl-module-if \ + perl-module-test-more \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/perl/liburi-perl/0001-Skip-TODO-test-cases-that-fail.patch b/poky/meta/recipes-devtools/perl/liburi-perl/0001-Skip-TODO-test-cases-that-fail.patch new file mode 100644 index 0000000000..68ccd06120 --- /dev/null +++ b/poky/meta/recipes-devtools/perl/liburi-perl/0001-Skip-TODO-test-cases-that-fail.patch @@ -0,0 +1,110 @@ +From 858daa5047b00e7d5aa795302a9fad5504c8f0b9 Mon Sep 17 00:00:00 2001 +From: Tim Orling +Date: Thu, 17 Nov 2022 16:33:20 -0800 +Subject: [PATCH] Skip TODO test cases that fail + +TODO cases report as "not ok" with ptest-runner + +Upstream-Status: Inappropriate [ptest-runner specific] + +Signed-off-by: Tim Orling + +--- + t/escape-char.t | 20 ++++++++++---------- + t/iri.t | 18 +++++++++--------- + t/mailto.t | 12 ++++++------ + 3 files changed, 25 insertions(+), 25 deletions(-) + +diff --git a/t/escape-char.t b/t/escape-char.t +index c6ce79c..5e62ad5 100644 +--- a/t/escape-char.t ++++ b/t/escape-char.t +@@ -6,16 +6,16 @@ use warnings; + use Test::More; + use URI (); + +-TODO: { +- my $str = "http://foo/\xE9"; +- utf8::upgrade($str); +- my $uri = URI->new($str); +- +- local $TODO = 'URI::Escape::escape_char misunderstands utf8'; +- +- # http://foo/%C3%A9 +- is("$uri", 'http://foo/%E9', 'correctly created a URI from a utf8-upgraded string'); +-} ++#TODO: { ++# my $str = "http://foo/\xE9"; ++# utf8::upgrade($str); ++# my $uri = URI->new($str); ++# ++# local $TODO = 'URI::Escape::escape_char misunderstands utf8'; ++# ++# # http://foo/%C3%A9 ++# is("$uri", 'http://foo/%E9', 'correctly created a URI from a utf8-upgraded string'); ++#} + + { + my $str = "http://foo/\xE9"; +diff --git a/t/iri.t b/t/iri.t +index 2eb64b2..9c663c9 100644 +--- a/t/iri.t ++++ b/t/iri.t +@@ -6,7 +6,7 @@ use Test::More; + use Config qw( %Config ); + + if (defined $Config{useperlio}) { +- plan tests=>26; ++ plan tests=>24; + } else { + plan skip_all=>'this perl doesn\'t support PerlIO layers'; + } +@@ -60,17 +60,17 @@ is $u->as_iri, "http://➡.ws/"; + # draft-duerst-iri-bis.txt examples (section 3.7.1): + is(URI->new("http://www.example.org/D%C3%BCrst")->as_iri, "http://www.example.org/D\xFCrst"); + is(URI->new("http://www.example.org/D%FCrst")->as_iri, "http://www.example.org/D%FCrst"); +-TODO: { +- local $TODO = "some chars (like U+202E, RIGHT-TO-LEFT OVERRIDE) need to stay escaped"; +-is(URI->new("http://xn--99zt52a.example.org/%e2%80%ae")->as_iri, "http://\x{7D0D}\x{8C46}.example.org/%e2%80%ae"); +-} ++#TODO: { ++# local $TODO = "some chars (like U+202E, RIGHT-TO-LEFT OVERRIDE) need to stay escaped"; ++#is(URI->new("http://xn--99zt52a.example.org/%e2%80%ae")->as_iri, "http://\x{7D0D}\x{8C46}.example.org/%e2%80%ae"); ++#} + + # try some URLs that can't be IDNA encoded (fallback to encoded UTF8 bytes) + $u = URI->new("http://" . ("ü" x 128)); + is $u, "http://" . ("%C3%BC" x 128); + is $u->host, ("\xC3\xBC" x 128); +-TODO: { +- local $TODO = "should ihost decode UTF8 bytes?"; +- is $u->ihost, ("ü" x 128); +-} ++#TODO: { ++# local $TODO = "should ihost decode UTF8 bytes?"; ++# is $u->ihost, ("ü" x 128); ++#} + is $u->as_iri, "http://" . ("ü" x 128); +diff --git a/t/mailto.t b/t/mailto.t +index 79e9a13..c68cfb2 100644 +--- a/t/mailto.t ++++ b/t/mailto.t +@@ -48,12 +48,12 @@ $u = URI->new('mailto:user+detail@example.com'); + is $u->to, 'user+detail@example.com', 'subaddress with `+` parsed correctly'; + is $u, 'mailto:user+detail@example.com', '... and stringification works'; + +-TODO: { +- local $TODO = "We can't handle quoted local parts without properly parsing the email addresses"; +- $u = URI->new('mailto:"foo bar+baz"@example.com'); +- is $u->to, '"foo bar+baz"@example.com', 'address with quoted local part containing spaces is parsed correctly'; +- is $u, 'mailto:%22foo%20bar+baz%22@example.com', '... and stringification works'; +-} ++#TODO: { ++# local $TODO = "We can't handle quoted local parts without properly parsing the email addresses"; ++# $u = URI->new('mailto:"foo bar+baz"@example.com'); ++# is $u->to, '"foo bar+baz"@example.com', 'address with quoted local part containing spaces is parsed correctly'; ++# is $u, 'mailto:%22foo%20bar+baz%22@example.com', '... and stringification works'; ++#} + + # RFC 5321 (4.1.3) - Address Literals + diff --git a/poky/meta/recipes-devtools/perl/liburi-perl_5.08.bb b/poky/meta/recipes-devtools/perl/liburi-perl_5.08.bb deleted file mode 100644 index 5428c9ddf9..0000000000 --- a/poky/meta/recipes-devtools/perl/liburi-perl_5.08.bb +++ /dev/null @@ -1,50 +0,0 @@ -SUMMARY = "Perl module to manipulate and access URI strings" -DESCRIPTION = "This package contains the URI.pm module with friends. \ -The module implements the URI class. URI objects can be used to access \ -and manipulate the various components that make up these strings." - -HOMEPAGE = "http://search.cpan.org/dist/URI/" -SECTION = "libs" -LICENSE = "Artistic-1.0 | GPL-1.0-or-later" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=c453e94fae672800f83bc1bd7a38b53f" - -DEPENDS += "perl" - -SRC_URI = "http://www.cpan.org/authors/id/E/ET/ETHER/URI-${PV}.tar.gz" - -SRC_URI[md5sum] = "cdbbf8f8ccdec5c162c8505077a35c2c" -SRC_URI[sha256sum] = "7e2c6fe3b1d5947da334fa558a96e748aaa619213b85bcdce5b5347d4d26c46e" - -S = "${WORKDIR}/URI-${PV}" - -EXTRA_CPANFLAGS = "EXPATLIBPATH=${STAGING_LIBDIR} EXPATINCPATH=${STAGING_INCDIR}" - -inherit cpan ptest-perl - -do_compile() { - export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')" - cpan_do_compile -} - -do_install:prepend() { - # these tests require "-T" (taint) command line option - rm -rf ${B}/t/cwd.t - rm -rf ${B}/t/file.t -} - -RDEPENDS:${PN} += "perl-module-integer perl-module-mime-base64" -RDEPENDS:${PN}-ptest += " \ - libtest-needs-perl \ - perl-module-test-more \ - perl-module-test \ - perl-module-utf8 \ - perl-module-extutils-makemaker \ - perl-module-net-domain \ - perl-module-encode \ - perl-module-extutils-mm-unix \ - perl-module-file-spec-functions \ - perl-module-perlio \ -" - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/perl/liburi-perl_5.17.bb b/poky/meta/recipes-devtools/perl/liburi-perl_5.17.bb new file mode 100644 index 0000000000..5e15004dd0 --- /dev/null +++ b/poky/meta/recipes-devtools/perl/liburi-perl_5.17.bb @@ -0,0 +1,56 @@ +SUMMARY = "Perl module to manipulate and access URI strings" +DESCRIPTION = "This package contains the URI.pm module with friends. \ +The module implements the URI class. URI objects can be used to access \ +and manipulate the various components that make up these strings." +HOMEPAGE = "https://metacpan.org/dist/URI" +SECTION = "libs" +LICENSE = "Artistic-1.0 | GPL-1.0-or-later" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=d8ca5f628bf2cd180bc4fa044cb8ef41" + +SRC_URI = "${CPAN_MIRROR}/authors/id/O/OA/OALDERS/URI-${PV}.tar.gz \ + file://0001-Skip-TODO-test-cases-that-fail.patch \ + " + +SRC_URI[sha256sum] = "5f7e42b769cb27499113cfae4b786c37d49e7c7d32dbb469602cd808308568f8" + +S = "${WORKDIR}/URI-${PV}" + +EXTRA_CPANFLAGS = "EXPATLIBPATH=${STAGING_LIBDIR} EXPATINCPATH=${STAGING_INCDIR}" + +inherit cpan ptest-perl + +do_compile() { + export LIBC="$(find ${STAGING_DIR_TARGET}/${base_libdir}/ -name 'libc-*.so')" + cpan_do_compile +} + +do_install:prepend() { + # these tests require "-T" (taint) command line option + rm -rf ${B}/t/cwd.t + rm -rf ${B}/t/file.t +} + +RDEPENDS:${PN} += "\ + perl-module-integer \ + perl-module-mime-base64 \ +" + +RDEPENDS:${PN}-ptest += " \ + libtest-fatal-perl \ + libtest-needs-perl \ + libtest-warnings-perl \ + perl-module-encode \ + perl-module-encode-encoding \ + perl-module-extutils-makemaker \ + perl-module-extutils-mm-unix \ + perl-module-file-spec-functions \ + perl-module-net-domain \ + perl-module-perlio \ + perl-module-perlio-encoding \ + perl-module-test \ + perl-module-test-more \ + perl-module-utf8 \ +" + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/perl/perl_5.36.0.bb b/poky/meta/recipes-devtools/perl/perl_5.36.0.bb index 2dc558aaa5..4d8a919d1e 100644 --- a/poky/meta/recipes-devtools/perl/perl_5.36.0.bb +++ b/poky/meta/recipes-devtools/perl/perl_5.36.0.bb @@ -302,7 +302,7 @@ ALTERNATIVE_LINK_NAME[Thread.3] = "${mandir}/man3/Thread.3" ALLOW_EMPTY:${PN}-modules = "1" PACKAGES += "${PN}-modules " -PACKAGESPLITFUNCS:prepend = "split_perl_packages " +PACKAGESPLITFUNCS =+ "split_perl_packages" python split_perl_packages () { libdir = d.expand('${libdir}/perl5/${PV}') diff --git a/poky/meta/recipes-devtools/pseudo/pseudo_git.bb b/poky/meta/recipes-devtools/pseudo/pseudo_git.bb index c34580b4ff..1a708066f7 100644 --- a/poky/meta/recipes-devtools/pseudo/pseudo_git.bb +++ b/poky/meta/recipes-devtools/pseudo/pseudo_git.bb @@ -17,5 +17,12 @@ SRCREV = "c9670c27ff67ab899007ce749254b16091577e55" S = "${WORKDIR}/git" PV = "1.9.0+git${SRCPV}" +# largefile and 64bit time_t support adds these macros via compiler flags globally +# remove them for pseudo since pseudo intercepts some of the functions which will be +# aliased due to this e.g. open/open64 and it will complain about duplicate definitions +# pseudo on 32bit systems is not much of use anyway and these features are not of much +# use for it. +TARGET_CC_ARCH:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" + # error: use of undeclared identifier '_STAT_VER' COMPATIBLE_HOST:libc-musl = 'null' diff --git a/poky/meta/recipes-devtools/python/python-gitdb.inc b/poky/meta/recipes-devtools/python/python-gitdb.inc index 9482964f30..d92d6453d8 100644 --- a/poky/meta/recipes-devtools/python/python-gitdb.inc +++ b/poky/meta/recipes-devtools/python/python-gitdb.inc @@ -8,7 +8,7 @@ inherit pypi PYPI_PACKAGE = "gitdb" -SRC_URI[sha256sum] = "bac2fd45c0a1c9cf619e63a90d62bdc63892ef92387424b855792a6cabe789aa" +SRC_URI[sha256sum] = "6eb990b69df4e15bad899ea868dc46572c3f75339735663b81de79b06f17eb9a" DEPENDS = "${PYTHON_PN}-async ${PYTHON_PN}-setuptools-native ${PYTHON_PN}-smmap" diff --git a/poky/meta/recipes-devtools/python/python3-attrs_22.1.0.bb b/poky/meta/recipes-devtools/python/python3-attrs_22.1.0.bb deleted file mode 100644 index ba07ac71e3..0000000000 --- a/poky/meta/recipes-devtools/python/python3-attrs_22.1.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -DESCRIPTION = "Classes Without Boilerplate" -HOMEPAGE = "http://www.attrs.org/" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5e55731824cf9205cfabeab9a0600887" - -SRC_URI[sha256sum] = "29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6" - -inherit pypi python_setuptools_build_meta - -RDEPENDS:${PN}:class-target += " \ - ${PYTHON_PN}-crypt \ - ${PYTHON_PN}-ctypes \ -" -RDEPENDS:${PN}:class-nativesdk += " \ - ${PYTHON_PN}-crypt \ - ${PYTHON_PN}-ctypes \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-attrs_22.2.0.bb b/poky/meta/recipes-devtools/python/python3-attrs_22.2.0.bb new file mode 100644 index 0000000000..20dccc6639 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-attrs_22.2.0.bb @@ -0,0 +1,19 @@ +DESCRIPTION = "Classes Without Boilerplate" +HOMEPAGE = "http://www.attrs.org/" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=5e55731824cf9205cfabeab9a0600887" + +SRC_URI[sha256sum] = "c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99" + +inherit pypi python_setuptools_build_meta + +RDEPENDS:${PN}:class-target += " \ + ${PYTHON_PN}-crypt \ + ${PYTHON_PN}-ctypes \ +" +RDEPENDS:${PN}:class-nativesdk += " \ + ${PYTHON_PN}-crypt \ + ${PYTHON_PN}-ctypes \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-certifi_2022.12.7.bb b/poky/meta/recipes-devtools/python/python3-certifi_2022.12.7.bb new file mode 100644 index 0000000000..dca3d26811 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-certifi_2022.12.7.bb @@ -0,0 +1,14 @@ +SUMMARY = "Python package for providing Mozilla's CA Bundle." +DESCRIPTION = "This installable Python package contains a CA Bundle that you can reference in your \ +Python code. This is useful for verifying HTTP requests, for example. This is the same CA Bundle \ +which ships with the Requests codebase, and is derived from Mozilla Firefox's canonical set." +HOMEPAGE = " http://certifi.io/" + +LICENSE = "ISC" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3c2b7404369c587c3559afb604fce2f2" + +SRC_URI[sha256sum] = "35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3" + +inherit pypi setuptools3 + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-certifi_2022.9.24.bb b/poky/meta/recipes-devtools/python/python3-certifi_2022.9.24.bb deleted file mode 100644 index a6b7467052..0000000000 --- a/poky/meta/recipes-devtools/python/python3-certifi_2022.9.24.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "Python package for providing Mozilla's CA Bundle." -DESCRIPTION = "This installable Python package contains a CA Bundle that you can reference in your \ -Python code. This is useful for verifying HTTP requests, for example. This is the same CA Bundle \ -which ships with the Requests codebase, and is derived from Mozilla Firefox's canonical set." -HOMEPAGE = " http://certifi.io/" - -LICENSE = "ISC" -LIC_FILES_CHKSUM = "file://LICENSE;md5=3c2b7404369c587c3559afb604fce2f2" - -SRC_URI[sha256sum] = "0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14" - -inherit pypi setuptools3 - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-chardet_5.0.0.bb b/poky/meta/recipes-devtools/python/python3-chardet_5.0.0.bb deleted file mode 100644 index 80baed7986..0000000000 --- a/poky/meta/recipes-devtools/python/python3-chardet_5.0.0.bb +++ /dev/null @@ -1,24 +0,0 @@ -SUMMARY = "Universal encoding detector for Python 2 and 3" -HOMEPAGE = "https://pypi.org/project/chardet/" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c" - -SRC_URI[sha256sum] = "0368df2bfd78b5fc20572bb4e9bb7fb53e2c094f60ae9993339e8671d0afb8aa" - -# setup.py of chardet needs this. -DEPENDS += "${PYTHON_PN}-pytest-runner-native" - -inherit pypi setuptools3 - -PACKAGES =+ "${PN}-cli" -FILES:${PN}-cli += " \ - ${PYTHON_SITEPACKAGES_DIR}/chardet/cli \ -" - -RDEPENDS:${PN}-cli = "${PN} " - -RDEPENDS:${PN}:class-target += " \ - ${PYTHON_PN}-logging \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-chardet_5.1.0.bb b/poky/meta/recipes-devtools/python/python3-chardet_5.1.0.bb new file mode 100644 index 0000000000..9b2644e648 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-chardet_5.1.0.bb @@ -0,0 +1,24 @@ +SUMMARY = "Universal encoding detector for Python 2 and 3" +HOMEPAGE = "https://pypi.org/project/chardet/" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI[sha256sum] = "0d62712b956bc154f85fb0a266e2a3c5913c2967e00348701b32411d6def31e5" + +# setup.py of chardet needs this. +DEPENDS += "${PYTHON_PN}-pytest-runner-native" + +inherit pypi python_setuptools_build_meta + +PACKAGES =+ "${PN}-cli" +FILES:${PN}-cli += " \ + ${PYTHON_SITEPACKAGES_DIR}/chardet/cli \ +" + +RDEPENDS:${PN}-cli = "${PN} " + +RDEPENDS:${PN}:class-target += " \ + ${PYTHON_PN}-logging \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-cryptography-vectors_38.0.3.bb b/poky/meta/recipes-devtools/python/python3-cryptography-vectors_38.0.3.bb deleted file mode 100644 index 9e4c40e0c4..0000000000 --- a/poky/meta/recipes-devtools/python/python3-cryptography-vectors_38.0.3.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "Test vectors for the cryptography package." -HOMEPAGE = "https://cryptography.io/" -SECTION = "devel/python" -LICENSE = "Apache-2.0 | BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=8c3617db4fb6fae01f1d253ab91511e4 \ - file://LICENSE.APACHE;md5=4e168cce331e5c827d4c2b68a6200e1b \ - file://LICENSE.BSD;md5=5ae30ba4123bc4f2fa49aa0b0dce887b" - -# NOTE: Make sure to keep this recipe at the same version as python3-cryptography -# Upgrade both recipes at the same time - -SRC_URI[sha256sum] = "1cdafd42f5348d77e4e7e4791aefd1f62b16bd552a0274afc9346533fe32e925" - -PYPI_PACKAGE = "cryptography_vectors" - -inherit pypi setuptools3 - -DEPENDS += " \ - ${PYTHON_PN}-cryptography \ -" - -do_install:append () { - # Remove the sha256 checksum lines for pycache files - sed ${D}${PYTHON_SITEPACKAGES_DIR}/cryptography_vectors-${PV}.dist-info/RECORD -e '/__pycache__/d' -i -} - -BBCLASSEXTEND = "native nativesdk" - -UPSTREAM_CHECK_REGEX = "" diff --git a/poky/meta/recipes-devtools/python/python3-cryptography-vectors_38.0.4.bb b/poky/meta/recipes-devtools/python/python3-cryptography-vectors_38.0.4.bb new file mode 100644 index 0000000000..a36cbeb09a --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-cryptography-vectors_38.0.4.bb @@ -0,0 +1,29 @@ +SUMMARY = "Test vectors for the cryptography package." +HOMEPAGE = "https://cryptography.io/" +SECTION = "devel/python" +LICENSE = "Apache-2.0 | BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=8c3617db4fb6fae01f1d253ab91511e4 \ + file://LICENSE.APACHE;md5=4e168cce331e5c827d4c2b68a6200e1b \ + file://LICENSE.BSD;md5=5ae30ba4123bc4f2fa49aa0b0dce887b" + +# NOTE: Make sure to keep this recipe at the same version as python3-cryptography +# Upgrade both recipes at the same time + +SRC_URI[sha256sum] = "6ec62695bec5df810288ddceae998ae691cdb8a162808d6cbc960d3deb9a7db1" + +PYPI_PACKAGE = "cryptography_vectors" + +inherit pypi setuptools3 + +DEPENDS += " \ + ${PYTHON_PN}-cryptography \ +" + +do_install:append () { + # Remove the sha256 checksum lines for pycache files + sed ${D}${PYTHON_SITEPACKAGES_DIR}/cryptography_vectors-${PV}.dist-info/RECORD -e '/__pycache__/d' -i +} + +BBCLASSEXTEND = "native nativesdk" + +UPSTREAM_CHECK_REGEX = "" diff --git a/poky/meta/recipes-devtools/python/python3-cryptography_38.0.3.bb b/poky/meta/recipes-devtools/python/python3-cryptography_38.0.3.bb deleted file mode 100644 index 14ad459c1b..0000000000 --- a/poky/meta/recipes-devtools/python/python3-cryptography_38.0.3.bb +++ /dev/null @@ -1,72 +0,0 @@ -SUMMARY = "Provides cryptographic recipes and primitives to python developers" -HOMEPAGE = "https://cryptography.io/" -SECTION = "devel/python" -LICENSE = "( Apache-2.0 | BSD-3-Clause ) & PSF-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=bf405a8056a6647e7d077b0e7bc36aba \ - file://LICENSE.APACHE;md5=4e168cce331e5c827d4c2b68a6200e1b \ - file://LICENSE.BSD;md5=5ae30ba4123bc4f2fa49aa0b0dce887b \ - file://LICENSE.PSF;md5=43c37d21e1dbad10cddcd150ba2c0595 \ - " -LDSHARED += "-pthread" - -SRC_URI[sha256sum] = "bfbe6ee19615b07a98b1d2287d6a6073f734735b49ee45b11324d85efc4d5cbd" - -SRC_URI += "\ - file://0002-Cargo.toml-edition-2018-2021.patch \ - file://0001-pyproject.toml-remove-benchmark-disable-option.patch \ - file://check-memfree.py \ - file://run-ptest \ -" - -require ${BPN}-crates.inc - -inherit pypi python_setuptools3_rust cargo-update-recipe-crates - -DEPENDS += " \ - ${PYTHON_PN}-cffi-native \ -" - -RDEPENDS:${PN} += " \ - ${PYTHON_PN}-cffi \ -" - -RDEPENDS:${PN}:append:class-target = " \ - ${PYTHON_PN}-numbers \ - ${PYTHON_PN}-threading \ -" - -RDEPENDS:${PN}-ptest += " \ - ${PYTHON_PN}-bcrypt \ - ${PYTHON_PN}-cryptography-vectors (= ${PV}) \ - ${PYTHON_PN}-hypothesis \ - ${PYTHON_PN}-iso8601 \ - ${PYTHON_PN}-pretend \ - ${PYTHON_PN}-psutil \ - ${PYTHON_PN}-pytest \ - ${PYTHON_PN}-pytest-subtests \ - ${PYTHON_PN}-pytz \ - ${PYTHON_PN}-tomli \ -" - -inherit ptest - -do_install_ptest() { - install -D ${WORKDIR}/check-memfree.py ${D}${PTEST_PATH}/ - install -d ${D}${PTEST_PATH}/tests - cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/ - # remove test_x509.py as it needs benchmark and we don't - # want to introduce the benchmark dependency - rm -rf ${D}${PTEST_PATH}/tests/bench/test_x509.py - install -d ${D}${PTEST_PATH}/tests/hazmat - cp -rf ${S}/tests/hazmat/* ${D}${PTEST_PATH}/tests/hazmat/ - cp -r ${S}/pyproject.toml ${D}${PTEST_PATH}/ -} - -FILES:${PN}-ptest += " \ - ${PTEST_PATH}/check-memfree.py \ -" -FILES:${PN}-dbg += " \ - ${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/hazmat/bindings/.debug \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-cryptography_38.0.4.bb b/poky/meta/recipes-devtools/python/python3-cryptography_38.0.4.bb new file mode 100644 index 0000000000..5d279e7db1 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-cryptography_38.0.4.bb @@ -0,0 +1,71 @@ +SUMMARY = "Provides cryptographic recipes and primitives to python developers" +HOMEPAGE = "https://cryptography.io/" +SECTION = "devel/python" +LICENSE = "( Apache-2.0 | BSD-3-Clause ) & PSF-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=bf405a8056a6647e7d077b0e7bc36aba \ + file://LICENSE.APACHE;md5=4e168cce331e5c827d4c2b68a6200e1b \ + file://LICENSE.BSD;md5=5ae30ba4123bc4f2fa49aa0b0dce887b \ + file://LICENSE.PSF;md5=43c37d21e1dbad10cddcd150ba2c0595 \ + " +LDSHARED += "-pthread" + +SRC_URI[sha256sum] = "175c1a818b87c9ac80bb7377f5520b7f31b3ef2a0004e2420319beadedb67290" + +SRC_URI += "\ + file://0002-Cargo.toml-edition-2018-2021.patch \ + file://0001-pyproject.toml-remove-benchmark-disable-option.patch \ + file://check-memfree.py \ + file://run-ptest \ +" + +require ${BPN}-crates.inc + +inherit pypi python_setuptools3_rust cargo-update-recipe-crates + +DEPENDS += " \ + ${PYTHON_PN}-cffi-native \ +" + +RDEPENDS:${PN} += " \ + ${PYTHON_PN}-cffi \ +" + +RDEPENDS:${PN}:append:class-target = " \ + ${PYTHON_PN}-numbers \ + ${PYTHON_PN}-threading \ +" + +RDEPENDS:${PN}-ptest += " \ + ${PYTHON_PN}-bcrypt \ + ${PYTHON_PN}-cryptography-vectors (= ${PV}) \ + ${PYTHON_PN}-hypothesis \ + ${PYTHON_PN}-iso8601 \ + ${PYTHON_PN}-pretend \ + ${PYTHON_PN}-psutil \ + ${PYTHON_PN}-pytest \ + ${PYTHON_PN}-pytest-subtests \ + ${PYTHON_PN}-pytz \ +" + +inherit ptest + +do_install_ptest() { + install -D ${WORKDIR}/check-memfree.py ${D}${PTEST_PATH}/ + install -d ${D}${PTEST_PATH}/tests + cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/ + # remove test_x509.py as it needs benchmark and we don't + # want to introduce the benchmark dependency + rm -rf ${D}${PTEST_PATH}/tests/bench/test_x509.py + install -d ${D}${PTEST_PATH}/tests/hazmat + cp -rf ${S}/tests/hazmat/* ${D}${PTEST_PATH}/tests/hazmat/ + cp -r ${S}/pyproject.toml ${D}${PTEST_PATH}/ +} + +FILES:${PN}-ptest += " \ + ${PTEST_PATH}/check-memfree.py \ +" +FILES:${PN}-dbg += " \ + ${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/hazmat/bindings/.debug \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-cython_0.29.32.bb b/poky/meta/recipes-devtools/python/python3-cython_0.29.32.bb index 8fed1cf94d..78be2b94ed 100644 --- a/poky/meta/recipes-devtools/python/python3-cython_0.29.32.bb +++ b/poky/meta/recipes-devtools/python/python3-cython_0.29.32.bb @@ -17,7 +17,7 @@ do_install:append() { mv ${D}${bindir}/cygdb ${D}${bindir}/cygdb3 } -PACKAGEBUILDPKGD += "cython_fix_sources" +PACKAGESPLITFUNCS =+ "cython_fix_sources" cython_fix_sources () { for f in ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/FlowControl.c \ diff --git a/poky/meta/recipes-devtools/python/python3-dbusmock_0.28.4.bb b/poky/meta/recipes-devtools/python/python3-dbusmock_0.28.4.bb deleted file mode 100644 index e895d87b7b..0000000000 --- a/poky/meta/recipes-devtools/python/python3-dbusmock_0.28.4.bb +++ /dev/null @@ -1,18 +0,0 @@ -SUMMARY = "With this program/Python library you can easily create mock objects on D-Bus" -HOMEPAGE = "https://pypi.org/project/python-dbusmock/" - -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=e6a600fd5e1d9cbde2d983680233ad02" - -SRC_URI[sha256sum] = "52ad024a44d46602084fd91c0c467ab95b7ecf27c4e2168e0d2160623f18c0a2" - -PYPI_PACKAGE = "python-dbusmock" - -inherit pypi setuptools3 - -RDEPENDS:${PN} += "\ - ${PYTHON_PN}-dbus \ - ${PYTHON_PN}-pygobject \ - ${PYTHON_PN}-unittest \ - ${PYTHON_PN}-xml \ - " diff --git a/poky/meta/recipes-devtools/python/python3-dbusmock_0.28.6.bb b/poky/meta/recipes-devtools/python/python3-dbusmock_0.28.6.bb new file mode 100644 index 0000000000..1290fcd2f1 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-dbusmock_0.28.6.bb @@ -0,0 +1,21 @@ +SUMMARY = "With this program/Python library you can easily create mock objects on D-Bus" +HOMEPAGE = "https://pypi.org/project/python-dbusmock/" + +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=e6a600fd5e1d9cbde2d983680233ad02" + +SRC_URI[sha256sum] = "3b496fab84aff3936054f747e9a22bb07ac5783b1d967c6cc39536c7ba315fce" + +PYPI_PACKAGE = "python-dbusmock" + +inherit pypi python_setuptools_build_meta +DEPENDS += "python3-setuptools-scm-native" + +RDEPENDS:${PN} += "\ + ${PYTHON_PN}-dbus \ + ${PYTHON_PN}-pygobject \ + ${PYTHON_PN}-unittest \ + ${PYTHON_PN}-xml \ + " + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/python/python3-dtschema_2022.11.bb b/poky/meta/recipes-devtools/python/python3-dtschema_2022.11.bb deleted file mode 100644 index fd87db2c2b..0000000000 --- a/poky/meta/recipes-devtools/python/python3-dtschema_2022.11.bb +++ /dev/null @@ -1,15 +0,0 @@ -DESCRIPTION = "Tooling for devicetree validation using YAML and jsonschema" -HOMEPAGE = "https://github.com/devicetree-org/dt-schema" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=457495c8fa03540db4a576bf7869e811" - -inherit pypi setuptools3 - -PYPI_PACKAGE = "dtschema" - -SRC_URI[sha256sum] = "825e51b8bb82a2d4833d15c25ff2b9a3f5a53b36a490d7c4b6b136037e823320" - -DEPENDS += "python3-setuptools-scm-native" -RDEPENDS:${PN} += "python3-ruamel-yaml python3-jsonschema python3-rfc3987" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-dtschema_2022.12.bb b/poky/meta/recipes-devtools/python/python3-dtschema_2022.12.bb new file mode 100644 index 0000000000..9d860111c1 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-dtschema_2022.12.bb @@ -0,0 +1,15 @@ +DESCRIPTION = "Tooling for devicetree validation using YAML and jsonschema" +HOMEPAGE = "https://github.com/devicetree-org/dt-schema" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=457495c8fa03540db4a576bf7869e811" + +inherit pypi setuptools3 + +PYPI_PACKAGE = "dtschema" + +SRC_URI[sha256sum] = "f532d433a915e507d4b426b7ef57a6730d23c0938b682fb4866f9dfa80a58ec6" + +DEPENDS += "python3-setuptools-scm-native" +RDEPENDS:${PN} += "python3-ruamel-yaml python3-jsonschema python3-rfc3987" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-git_3.1.29.bb b/poky/meta/recipes-devtools/python/python3-git_3.1.29.bb deleted file mode 100644 index e75f8b4e3f..0000000000 --- a/poky/meta/recipes-devtools/python/python3-git_3.1.29.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "Python library used to interact with Git repositories" -DESCRIPTION = "GitPython provides object model read and write access to \ -a git repository. Access repository information conveniently, alter the \ -index directly, handle remotes, or go down to low-level object database \ -access with big-files support." -HOMEPAGE = "http://github.com/gitpython-developers/GitPython" -SECTION = "devel/python" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=8b8d26c37c1d5a04f9b0186edbebc183" - -PYPI_PACKAGE = "GitPython" - -inherit pypi python_setuptools_build_meta - -SRC_URI[sha256sum] = "cc36bfc4a3f913e66805a28e84703e419d9c264c1077e537b54f0e1af85dbefd" - -DEPENDS += " ${PYTHON_PN}-gitdb" - -RDEPENDS:${PN} += " \ - ${PYTHON_PN}-datetime \ - ${PYTHON_PN}-gitdb \ - ${PYTHON_PN}-io \ - ${PYTHON_PN}-logging \ - ${PYTHON_PN}-math \ - ${PYTHON_PN}-netclient \ - ${PYTHON_PN}-stringold \ - ${PYTHON_PN}-unittest \ - ${PYTHON_PN}-unixadmin \ - git \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-git_3.1.30.bb b/poky/meta/recipes-devtools/python/python3-git_3.1.30.bb new file mode 100644 index 0000000000..80f50019b1 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-git_3.1.30.bb @@ -0,0 +1,32 @@ +SUMMARY = "Python library used to interact with Git repositories" +DESCRIPTION = "GitPython provides object model read and write access to \ +a git repository. Access repository information conveniently, alter the \ +index directly, handle remotes, or go down to low-level object database \ +access with big-files support." +HOMEPAGE = "http://github.com/gitpython-developers/GitPython" +SECTION = "devel/python" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=8b8d26c37c1d5a04f9b0186edbebc183" + +PYPI_PACKAGE = "GitPython" + +inherit pypi python_setuptools_build_meta + +SRC_URI[sha256sum] = "769c2d83e13f5d938b7688479da374c4e3d49f71549aaf462b646db9602ea6f8" + +DEPENDS += " ${PYTHON_PN}-gitdb" + +RDEPENDS:${PN} += " \ + ${PYTHON_PN}-datetime \ + ${PYTHON_PN}-gitdb \ + ${PYTHON_PN}-io \ + ${PYTHON_PN}-logging \ + ${PYTHON_PN}-math \ + ${PYTHON_PN}-netclient \ + ${PYTHON_PN}-stringold \ + ${PYTHON_PN}-unittest \ + ${PYTHON_PN}-unixadmin \ + git \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-gitdb_4.0.10.bb b/poky/meta/recipes-devtools/python/python3-gitdb_4.0.10.bb new file mode 100644 index 0000000000..2dcd9c8aff --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-gitdb_4.0.10.bb @@ -0,0 +1,3 @@ +inherit setuptools3 +require python-gitdb.inc + diff --git a/poky/meta/recipes-devtools/python/python3-gitdb_4.0.9.bb b/poky/meta/recipes-devtools/python/python3-gitdb_4.0.9.bb deleted file mode 100644 index 2dcd9c8aff..0000000000 --- a/poky/meta/recipes-devtools/python/python3-gitdb_4.0.9.bb +++ /dev/null @@ -1,3 +0,0 @@ -inherit setuptools3 -require python-gitdb.inc - diff --git a/poky/meta/recipes-devtools/python/python3-hatch-vcs_0.2.0.bb b/poky/meta/recipes-devtools/python/python3-hatch-vcs_0.2.0.bb deleted file mode 100644 index cca2c49d2b..0000000000 --- a/poky/meta/recipes-devtools/python/python3-hatch-vcs_0.2.0.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "Hatch plugin for versioning with your preferred VCS" -HOMEPAGE = "https://pypi.org/project/hatch-vcs/" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=26501cfd0bbddf830ee820e95551fa3d" - -inherit pypi python_hatchling - -PYPI_PACKAGE = "hatch_vcs" - -SRC_URI[sha256sum] = "9913d733b34eec9bb0345d0626ca32165a4ad2de15d1ce643c36d09ca908abff" - -BBCLASSEXTEND = "native nativesdk" - -UPSTREAM_CHECK_REGEX = "/hatch-vcs/(?P(\d+[\.\-_]*)+)/" diff --git a/poky/meta/recipes-devtools/python/python3-hatch-vcs_0.3.0.bb b/poky/meta/recipes-devtools/python/python3-hatch-vcs_0.3.0.bb new file mode 100644 index 0000000000..b4db10e767 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-hatch-vcs_0.3.0.bb @@ -0,0 +1,14 @@ +SUMMARY = "Hatch plugin for versioning with your preferred VCS" +HOMEPAGE = "https://pypi.org/project/hatch-vcs/" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=26501cfd0bbddf830ee820e95551fa3d" + +inherit pypi python_hatchling + +PYPI_PACKAGE = "hatch_vcs" + +SRC_URI[sha256sum] = "cec5107cfce482c67f8bc96f18bbc320c9aa0d068180e14ad317bbee5a153fee" + +BBCLASSEXTEND = "native nativesdk" + +UPSTREAM_CHECK_REGEX = "/hatch-vcs/(?P(\d+[\.\-_]*)+)/" diff --git a/poky/meta/recipes-devtools/python/python3-hatchling_1.11.1.bb b/poky/meta/recipes-devtools/python/python3-hatchling_1.11.1.bb deleted file mode 100644 index d98d874606..0000000000 --- a/poky/meta/recipes-devtools/python/python3-hatchling_1.11.1.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "The extensible, standards compliant build backend used by Hatch" -HOMEPAGE = "https://hatch.pypa.io/" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=cbe2fd33fc9297692812fc94b7d27fd9" - -inherit pypi python_hatchling - -DEPENDS += "python3-pluggy-native python3-tomli-native python3-pathspec-native python3-packaging-native python3-editables-native" -DEPENDS:remove:class-native = "python3-hatchling-native" - -SRC_URI[sha256sum] = "9f84361f70cf3a7ab9543b0c3ecc64211ed2ba8a606a71eb6a473c1c9b08e1d0" - -do_compile:prepend() { - export PYTHONPATH=src -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-hatchling_1.12.1.bb b/poky/meta/recipes-devtools/python/python3-hatchling_1.12.1.bb new file mode 100644 index 0000000000..fa56d7a42a --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-hatchling_1.12.1.bb @@ -0,0 +1,17 @@ +SUMMARY = "The extensible, standards compliant build backend used by Hatch" +HOMEPAGE = "https://hatch.pypa.io/" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=cbe2fd33fc9297692812fc94b7d27fd9" + +inherit pypi python_hatchling + +DEPENDS += "python3-pluggy-native python3-pathspec-native python3-packaging-native python3-editables-native" +DEPENDS:remove:class-native = "python3-hatchling-native" + +SRC_URI[sha256sum] = "5b36c903d4d76790b1c1f2b7c8f5446fb733fab6ce39b203401d2337d441b411" + +do_compile:prepend() { + export PYTHONPATH=src +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-hypothesis_6.56.4.bb b/poky/meta/recipes-devtools/python/python3-hypothesis_6.56.4.bb deleted file mode 100644 index 040ecaff3e..0000000000 --- a/poky/meta/recipes-devtools/python/python3-hypothesis_6.56.4.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "A library for property-based testing" -HOMEPAGE = "https://github.com/HypothesisWorks/hypothesis/tree/master/hypothesis-python" -LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=4ee62c16ebd0f4f99d906f36b7de8c3c" - -PYPI_PACKAGE = "hypothesis" - -inherit pypi setuptools3 ptest - -SRC_URI += " \ - file://run-ptest \ - file://test_binary_search.py \ - file://test_rle.py \ - " - -SRC_URI[sha256sum] = "313bc1c0f377ec6c98815d3237a69add7558eadee4effe4ed613d0ba36513a52" - -RDEPENDS:${PN} += " \ - python3-attrs \ - python3-compression \ - python3-core \ - python3-json \ - python3-sortedcontainers \ - python3-statistics \ - python3-unittest \ - " - -RDEPENDS:${PN}-ptest += " \ - ${PYTHON_PN}-pytest \ - " - -do_install_ptest() { - install -d ${D}${PTEST_PATH}/examples - install -m 0755 ${WORKDIR}/test_binary_search.py ${D}${PTEST_PATH}/examples/ - install -m 0755 ${WORKDIR}/test_rle.py ${D}${PTEST_PATH}/examples/ -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-hypothesis_6.61.0.bb b/poky/meta/recipes-devtools/python/python3-hypothesis_6.61.0.bb new file mode 100644 index 0000000000..204471c186 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-hypothesis_6.61.0.bb @@ -0,0 +1,38 @@ +SUMMARY = "A library for property-based testing" +HOMEPAGE = "https://github.com/HypothesisWorks/hypothesis/tree/master/hypothesis-python" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=4ee62c16ebd0f4f99d906f36b7de8c3c" + +PYPI_PACKAGE = "hypothesis" + +inherit pypi setuptools3 ptest + +SRC_URI += " \ + file://run-ptest \ + file://test_binary_search.py \ + file://test_rle.py \ + " + +SRC_URI[sha256sum] = "fbf7da30aea839d88898f74bcc027f0f997060498a8a7605880688c8a2166215" + +RDEPENDS:${PN} += " \ + python3-attrs \ + python3-compression \ + python3-core \ + python3-json \ + python3-sortedcontainers \ + python3-statistics \ + python3-unittest \ + " + +RDEPENDS:${PN}-ptest += " \ + ${PYTHON_PN}-pytest \ + " + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/examples + install -m 0755 ${WORKDIR}/test_binary_search.py ${D}${PTEST_PATH}/examples/ + install -m 0755 ${WORKDIR}/test_rle.py ${D}${PTEST_PATH}/examples/ +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-importlib-metadata_5.0.0.bb b/poky/meta/recipes-devtools/python/python3-importlib-metadata_5.0.0.bb deleted file mode 100644 index f0623669d7..0000000000 --- a/poky/meta/recipes-devtools/python/python3-importlib-metadata_5.0.0.bb +++ /dev/null @@ -1,20 +0,0 @@ -DESCRIPTION = "Read metadata from Python packages" -HOMEPAGE = "https://pypi.org/project/importlib-metadata/" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" - -inherit pypi python_setuptools_build_meta - -PYPI_PACKAGE = "importlib_metadata" -UPSTREAM_CHECK_REGEX = "/importlib-metadata/(?P(\d+[\.\-_]*)+)/" - -SRC_URI[sha256sum] = "da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab" - -S = "${WORKDIR}/importlib_metadata-${PV}" - -DEPENDS += "${PYTHON_PN}-setuptools-scm-native ${PYTHON_PN}-toml-native" -RDEPENDS:${PN} += "${PYTHON_PN}-zipp ${PYTHON_PN}-pathlib2" -RDEPENDS:${PN}:append:class-target = " python3-misc" -RDEPENDS:${PN}:append:class-nativesdk = " python3-misc" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-importlib-metadata_5.2.0.bb b/poky/meta/recipes-devtools/python/python3-importlib-metadata_5.2.0.bb new file mode 100644 index 0000000000..893c63d7e5 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-importlib-metadata_5.2.0.bb @@ -0,0 +1,20 @@ +DESCRIPTION = "Read metadata from Python packages" +HOMEPAGE = "https://pypi.org/project/importlib-metadata/" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +inherit pypi python_setuptools_build_meta + +PYPI_PACKAGE = "importlib_metadata" +UPSTREAM_CHECK_REGEX = "/importlib-metadata/(?P(\d+[\.\-_]*)+)/" + +SRC_URI[sha256sum] = "404d48d62bba0b7a77ff9d405efd91501bef2e67ff4ace0bed40a0cf28c3c7cd" + +S = "${WORKDIR}/importlib_metadata-${PV}" + +DEPENDS += "${PYTHON_PN}-setuptools-scm-native ${PYTHON_PN}-toml-native" +RDEPENDS:${PN} += "${PYTHON_PN}-zipp ${PYTHON_PN}-pathlib2" +RDEPENDS:${PN}:append:class-target = " python3-misc" +RDEPENDS:${PN}:append:class-nativesdk = " python3-misc" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-installer/interpreter.patch b/poky/meta/recipes-devtools/python/python3-installer/interpreter.patch index ef10ef1b45..7906769b90 100644 --- a/poky/meta/recipes-devtools/python/python3-installer/interpreter.patch +++ b/poky/meta/recipes-devtools/python/python3-installer/interpreter.patch @@ -1,3 +1,8 @@ +From 74fe171fa4a25c120607e9f8450cbdfee675c959 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Mon, 14 Mar 2022 14:39:22 +0000 +Subject: [PATCH] python3-installer: add installer module + Let us override the hashbang directly (possibly upstreamable), and don't play games with hashbangs: for now assume that even hashbangs with spaces are simple (assume the spaces are only used to separate arguments) and @@ -6,13 +11,18 @@ we don't have long hashbangs. Upstream-Status: Inappropriate Signed-off-by: Ross Burton +--- + src/installer/__main__.py | 9 ++++++++- + src/installer/scripts.py | 15 +-------------- + 2 files changed, 9 insertions(+), 15 deletions(-) + diff --git a/src/installer/__main__.py b/src/installer/__main__.py -index 3357ec5..d2fd8d2 100644 +index 51014b9..38de286 100644 --- a/src/installer/__main__.py +++ b/src/installer/__main__.py -@@ -23,6 +23,13 @@ def _get_main_parser() -> argparse.ArgumentParser: +@@ -30,6 +30,13 @@ def _get_main_parser() -> argparse.ArgumentParser: type=str, - help="destination directory (prefix to prepend to each file)", + help="override prefix to install packages to", ) + parser.add_argument( + "--interpreter", @@ -24,10 +34,10 @@ index 3357ec5..d2fd8d2 100644 parser.add_argument( "--compile-bytecode", action="append", -@@ -73,7 +80,7 @@ def _main(cli_args: Sequence[str], program: Optional[str] = None) -> None: +@@ -86,7 +93,7 @@ def _main(cli_args: Sequence[str], program: Optional[str] = None) -> None: with WheelFile.open(args.wheel) as source: destination = SchemeDictionaryDestination( - scheme_dict=_get_scheme_dict(source.distribution), + scheme_dict=_get_scheme_dict(source.distribution, prefix=args.prefix), - interpreter=sys.executable, + interpreter=args.interpreter, script_kind=get_launcher_kind(), @@ -56,6 +66,6 @@ index 7e3c8fc..ba6ed5a 100644 - # I don't understand a lick what this is trying to do. - return b"#!/bin/sh\n'''exec' " + quoted + b' "$0" "$@"\n' + b"' '''" + return b"#!" + executable_bytes - - + + class InvalidScript(ValueError): diff --git a/poky/meta/recipes-devtools/python/python3-installer_0.5.1.bb b/poky/meta/recipes-devtools/python/python3-installer_0.5.1.bb deleted file mode 100644 index 07bbafa81f..0000000000 --- a/poky/meta/recipes-devtools/python/python3-installer_0.5.1.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "Library and tool for installing Python wheels" -DESCRIPTION = "A low-level library for installing a Python package from a wheel distribution." -HOMEPAGE = "https://installer.readthedocs.io/" -BUGTRACKER = "https://github.com/pypa/installer/issues" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5038641aec7a77451e31da828ebfae00" - -SRC_URI += "file://interpreter.patch" - -SRC_URI[sha256sum] = "f970995ec2bb815e2fdaf7977b26b2091e1e386f0f42eafd5ac811953dc5d445" - -inherit pypi python_flit_core - -# Bootstrap the native build -DEPENDS:remove:class-native = "python3-picobuild-native python3-installer-native" - -INSTALL_WHEEL_COMPILE_BYTECODE:class-native = "--no-compile-bytecode" - -do_compile:class-native () { - python_flit_core_do_manual_build -} - -do_install:prepend:class-native() { - export PYTHONPATH="${S}/src" -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-installer_0.6.0.bb b/poky/meta/recipes-devtools/python/python3-installer_0.6.0.bb new file mode 100644 index 0000000000..e728e47cec --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-installer_0.6.0.bb @@ -0,0 +1,28 @@ +SUMMARY = "Library and tool for installing Python wheels" +DESCRIPTION = "A low-level library for installing a Python package from a wheel distribution." +HOMEPAGE = "https://installer.readthedocs.io/" +BUGTRACKER = "https://github.com/pypa/installer/issues" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=5038641aec7a77451e31da828ebfae00" + +SRC_URI += "file://interpreter.patch" + +SRC_URI[sha256sum] = "f3bd36cd261b440a88a1190b1becca0578fee90b4b62decc796932fdd5ae8839" + +inherit pypi python_flit_core + +# Bootstrap the native build +DEPENDS:remove:class-native = "python3-picobuild-native python3-installer-native" + +INSTALL_WHEEL_COMPILE_BYTECODE:class-native = "--no-compile-bytecode" + +do_compile:class-native () { + python_flit_core_do_manual_build +} + +do_install:prepend:class-native() { + export PYTHONPATH="${S}/src" +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-jsonschema_4.17.0.bb b/poky/meta/recipes-devtools/python/python3-jsonschema_4.17.0.bb deleted file mode 100644 index 02337fe85b..0000000000 --- a/poky/meta/recipes-devtools/python/python3-jsonschema_4.17.0.bb +++ /dev/null @@ -1,48 +0,0 @@ -SUMMARY = "An implementation of JSON Schema validation for Python" -HOMEPAGE = "https://github.com/Julian/jsonschema" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=7a60a81c146ec25599a3e1dabb8610a8 \ - file://json/LICENSE;md5=9d4de43111d33570c8fe49b4cb0e01af" - -SRC_URI[sha256sum] = "5bfcf2bca16a087ade17e02b282d34af7ccd749ef76241e7f9bd7c0cb8a9424d" - -inherit pypi python_hatchling - -PACKAGES =+ "${PN}-tests" -FILES:${PN}-tests = "${libdir}/${PYTHON_DIR}/site-packages/jsonschema/tests" - -DEPENDS += "${PYTHON_PN}-hatch-fancy-pypi-readme-native ${PYTHON_PN}-hatch-vcs-native " - -PACKAGECONFIG ??= "format" -PACKAGECONFIG[format] = ",,,\ - ${PYTHON_PN}-idna \ - ${PYTHON_PN}-jsonpointer \ - ${PYTHON_PN}-webcolors \ - ${PYTHON_PN}-rfc3987 \ - ${PYTHON_PN}-strict-rfc3339 \ -" -PACKAGECONFIG[nongpl] = ",,,\ - ${PYTHON_PN}-idna \ - ${PYTHON_PN}-jsonpointer \ - ${PYTHON_PN}-webcolors \ - ${PYTHON_PN}-rfc3986-validator \ - ${PYTHON_PN}-rfc3339-validator \ -" - -RDEPENDS:${PN} += " \ - ${PYTHON_PN}-attrs \ - ${PYTHON_PN}-core \ - ${PYTHON_PN}-datetime \ - ${PYTHON_PN}-importlib-metadata \ - ${PYTHON_PN}-io \ - ${PYTHON_PN}-json \ - ${PYTHON_PN}-netclient \ - ${PYTHON_PN}-numbers \ - ${PYTHON_PN}-pprint \ - ${PYTHON_PN}-pyrsistent \ - ${PYTHON_PN}-zipp \ -" - -RDEPENDS:${PN}-tests = "${PN}" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-jsonschema_4.17.3.bb b/poky/meta/recipes-devtools/python/python3-jsonschema_4.17.3.bb new file mode 100644 index 0000000000..24cde3711c --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-jsonschema_4.17.3.bb @@ -0,0 +1,48 @@ +SUMMARY = "An implementation of JSON Schema validation for Python" +HOMEPAGE = "https://github.com/Julian/jsonschema" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=7a60a81c146ec25599a3e1dabb8610a8 \ + file://json/LICENSE;md5=9d4de43111d33570c8fe49b4cb0e01af" + +SRC_URI[sha256sum] = "0f864437ab8b6076ba6707453ef8f98a6a0d512a80e93f8abdb676f737ecb60d" + +inherit pypi python_hatchling + +PACKAGES =+ "${PN}-tests" +FILES:${PN}-tests = "${libdir}/${PYTHON_DIR}/site-packages/jsonschema/tests" + +DEPENDS += "${PYTHON_PN}-hatch-fancy-pypi-readme-native ${PYTHON_PN}-hatch-vcs-native " + +PACKAGECONFIG ??= "format" +PACKAGECONFIG[format] = ",,,\ + ${PYTHON_PN}-idna \ + ${PYTHON_PN}-jsonpointer \ + ${PYTHON_PN}-webcolors \ + ${PYTHON_PN}-rfc3987 \ + ${PYTHON_PN}-rfc3339-validator \ +" +PACKAGECONFIG[nongpl] = ",,,\ + ${PYTHON_PN}-idna \ + ${PYTHON_PN}-jsonpointer \ + ${PYTHON_PN}-webcolors \ + ${PYTHON_PN}-rfc3986-validator \ + ${PYTHON_PN}-rfc3339-validator \ +" + +RDEPENDS:${PN} += " \ + ${PYTHON_PN}-attrs \ + ${PYTHON_PN}-core \ + ${PYTHON_PN}-datetime \ + ${PYTHON_PN}-importlib-metadata \ + ${PYTHON_PN}-io \ + ${PYTHON_PN}-json \ + ${PYTHON_PN}-netclient \ + ${PYTHON_PN}-numbers \ + ${PYTHON_PN}-pprint \ + ${PYTHON_PN}-pyrsistent \ + ${PYTHON_PN}-zipp \ +" + +RDEPENDS:${PN}-tests = "${PN}" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-lxml_4.9.1.bb b/poky/meta/recipes-devtools/python/python3-lxml_4.9.1.bb deleted file mode 100644 index 92a30f7907..0000000000 --- a/poky/meta/recipes-devtools/python/python3-lxml_4.9.1.bb +++ /dev/null @@ -1,42 +0,0 @@ -SUMMARY = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API." -DESCRIPTION = "lxml is a Pythonic, mature binding for the libxml2 and \ -libxslt libraries. It provides safe and convenient access to these \ -libraries using the ElementTree API. It extends the ElementTree API \ -significantly to offer support for XPath, RelaxNG, XML Schema, XSLT, \ -C14N and much more." -HOMEPAGE = "https://lxml.de/" -SECTION = "devel/python" -LICENSE = "BSD-3-Clause & GPL-2.0-only & MIT & PSF-2.0" -LIC_FILES_CHKSUM = "file://LICENSES.txt;md5=e4c045ebad958ead4b48008f70838403 \ - file://doc/licenses/elementtree.txt;md5=eb34d036a6e3d56314ee49a6852ac891 \ - file://doc/licenses/BSD.txt;md5=700a1fc17f4797d4f2d34970c8ee694b \ - file://doc/licenses/GPL.txt;md5=94d55d512a9ba36caa9b7df079bae19f \ - file://src/lxml/isoschematron/resources/rng/iso-schematron.rng;beginline=2;endline=7;md5=fc85684a8dd5fa272c086bceb0d99e10 \ - file://src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl;beginline=2;endline=24;md5=cc86b7b2bbc678e13f58ea403eb9929b \ - file://src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl;beginline=2;endline=7;md5=5b03236d293dc3784205542b409d2f53 \ - " - -DEPENDS += "libxml2 libxslt" - -SRC_URI[sha256sum] = "fe749b052bb7233fe5d072fcb549221a8cb1a16725c47c37e42b0b9cb3ff2c3f" - -SRC_URI += "${PYPI_SRC_URI}" -inherit pkgconfig pypi setuptools3 - -# {standard input}: Assembler messages: -# {standard input}:1488805: Error: branch out of range -DEBUG_OPTIMIZATION:remove:mips = " -Og" -DEBUG_OPTIMIZATION:append:mips = " -O" -BUILD_OPTIMIZATION:remove:mips = " -Og" -BUILD_OPTIMIZATION:append:mips = " -O" - -DEBUG_OPTIMIZATION:remove:mipsel = " -Og" -DEBUG_OPTIMIZATION:append:mipsel = " -O" -BUILD_OPTIMIZATION:remove:mipsel = " -Og" -BUILD_OPTIMIZATION:append:mipsel = " -O" - -BBCLASSEXTEND = "native nativesdk" - -RDEPENDS:${PN} += "libxml2 libxslt ${PYTHON_PN}-compression" - -CLEANBROKEN = "1" diff --git a/poky/meta/recipes-devtools/python/python3-lxml_4.9.2.bb b/poky/meta/recipes-devtools/python/python3-lxml_4.9.2.bb new file mode 100644 index 0000000000..c7f1e1fc3c --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-lxml_4.9.2.bb @@ -0,0 +1,42 @@ +SUMMARY = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API." +DESCRIPTION = "lxml is a Pythonic, mature binding for the libxml2 and \ +libxslt libraries. It provides safe and convenient access to these \ +libraries using the ElementTree API. It extends the ElementTree API \ +significantly to offer support for XPath, RelaxNG, XML Schema, XSLT, \ +C14N and much more." +HOMEPAGE = "https://lxml.de/" +SECTION = "devel/python" +LICENSE = "BSD-3-Clause & GPL-2.0-only & MIT & PSF-2.0" +LIC_FILES_CHKSUM = "file://LICENSES.txt;md5=e4c045ebad958ead4b48008f70838403 \ + file://doc/licenses/elementtree.txt;md5=eb34d036a6e3d56314ee49a6852ac891 \ + file://doc/licenses/BSD.txt;md5=700a1fc17f4797d4f2d34970c8ee694b \ + file://doc/licenses/GPL.txt;md5=94d55d512a9ba36caa9b7df079bae19f \ + file://src/lxml/isoschematron/resources/rng/iso-schematron.rng;beginline=2;endline=7;md5=fc85684a8dd5fa272c086bceb0d99e10 \ + file://src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl;beginline=2;endline=24;md5=cc86b7b2bbc678e13f58ea403eb9929b \ + file://src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl;beginline=2;endline=7;md5=5b03236d293dc3784205542b409d2f53 \ + " + +DEPENDS += "libxml2 libxslt" + +SRC_URI[sha256sum] = "2455cfaeb7ac70338b3257f41e21f0724f4b5b0c0e7702da67ee6c3640835b67" + +SRC_URI += "${PYPI_SRC_URI}" +inherit pkgconfig pypi setuptools3 + +# {standard input}: Assembler messages: +# {standard input}:1488805: Error: branch out of range +DEBUG_OPTIMIZATION:remove:mips = " -Og" +DEBUG_OPTIMIZATION:append:mips = " -O" +BUILD_OPTIMIZATION:remove:mips = " -Og" +BUILD_OPTIMIZATION:append:mips = " -O" + +DEBUG_OPTIMIZATION:remove:mipsel = " -Og" +DEBUG_OPTIMIZATION:append:mipsel = " -O" +BUILD_OPTIMIZATION:remove:mipsel = " -Og" +BUILD_OPTIMIZATION:append:mipsel = " -O" + +BBCLASSEXTEND = "native nativesdk" + +RDEPENDS:${PN} += "libxml2 libxslt ${PYTHON_PN}-compression" + +CLEANBROKEN = "1" diff --git a/poky/meta/recipes-devtools/python/python3-mako_1.2.3.bb b/poky/meta/recipes-devtools/python/python3-mako_1.2.3.bb deleted file mode 100644 index 12acfee777..0000000000 --- a/poky/meta/recipes-devtools/python/python3-mako_1.2.3.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "Templating library for Python" -HOMEPAGE = "http://www.makotemplates.org/" -SECTION = "devel/python" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=ad08dd28df88e64b35bcac27c822ee34" - -PYPI_PACKAGE = "Mako" - -inherit pypi python_setuptools_build_meta - -SRC_URI[sha256sum] = "7fde96466fcfeedb0eed94f187f20b23d85e4cb41444be0e542e2c8c65c396cd" - -RDEPENDS:${PN} = "${PYTHON_PN}-html \ - ${PYTHON_PN}-markupsafe \ - ${PYTHON_PN}-netclient \ - ${PYTHON_PN}-pygments \ - ${PYTHON_PN}-threading \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-mako_1.2.4.bb b/poky/meta/recipes-devtools/python/python3-mako_1.2.4.bb new file mode 100644 index 0000000000..9860058723 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-mako_1.2.4.bb @@ -0,0 +1,20 @@ +SUMMARY = "Templating library for Python" +HOMEPAGE = "http://www.makotemplates.org/" +SECTION = "devel/python" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=ad08dd28df88e64b35bcac27c822ee34" + +PYPI_PACKAGE = "Mako" + +inherit pypi python_setuptools_build_meta + +SRC_URI[sha256sum] = "d60a3903dc3bb01a18ad6a89cdbe2e4eadc69c0bc8ef1e3773ba53d44c3f7a34" + +RDEPENDS:${PN} = "${PYTHON_PN}-html \ + ${PYTHON_PN}-markupsafe \ + ${PYTHON_PN}-netclient \ + ${PYTHON_PN}-pygments \ + ${PYTHON_PN}-threading \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-markdown_3.4.1.bb b/poky/meta/recipes-devtools/python/python3-markdown_3.4.1.bb index e99c3310ac..b398cd8bc4 100644 --- a/poky/meta/recipes-devtools/python/python3-markdown_3.4.1.bb +++ b/poky/meta/recipes-devtools/python/python3-markdown_3.4.1.bb @@ -8,6 +8,6 @@ inherit pypi python_setuptools_build_meta PYPI_PACKAGE = "Markdown" SRC_URI[sha256sum] = "3b809086bb6efad416156e00a0da66fe47618a5d6918dd688f53f40c8e4cfeff" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" RDEPENDS:${PN} += "${PYTHON_PN}-logging ${PYTHON_PN}-setuptools" diff --git a/poky/meta/recipes-devtools/python/python3-numpy/0001-generate_umath.py-do-not-write-full-path-to-output-f.patch b/poky/meta/recipes-devtools/python/python3-numpy/0001-generate_umath.py-do-not-write-full-path-to-output-f.patch deleted file mode 100644 index 41dea89682..0000000000 --- a/poky/meta/recipes-devtools/python/python3-numpy/0001-generate_umath.py-do-not-write-full-path-to-output-f.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 3c7deaa3a961a0f3ce4ff108468e3d70118f17b3 Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Thu, 9 Jun 2022 17:23:42 +0200 -Subject: [PATCH] generate_umath.py: do not write full path to output files - -This helps reproducibility as those paths vary in automated -build environments. - -Upstream-Status: Submitted [https://github.com/numpy/numpy/pull/21707] -Signed-off-by: Alexander Kanavin - ---- - numpy/core/code_generators/generate_umath.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py -index 292d9e0..df37941 100644 ---- a/numpy/core/code_generators/generate_umath.py -+++ b/numpy/core/code_generators/generate_umath.py -@@ -1233,7 +1233,7 @@ def make_code(funcdict, filename): - - return 0; - } -- """) % (filename, code1, code2, code3) -+ """) % (os.path.basename(filename), code1, code2, code3) - return code - - diff --git a/poky/meta/recipes-devtools/python/python3-numpy_1.23.4.bb b/poky/meta/recipes-devtools/python/python3-numpy_1.23.4.bb deleted file mode 100644 index d9172692b5..0000000000 --- a/poky/meta/recipes-devtools/python/python3-numpy_1.23.4.bb +++ /dev/null @@ -1,72 +0,0 @@ -SUMMARY = "A sophisticated Numeric Processing Package for Python" -HOMEPAGE = "https://numpy.org/" -DESCRIPTION = "NumPy is the fundamental package needed for scientific computing with Python." -SECTION = "devel/python" -LICENSE = "BSD-3-Clause & BSD-2-Clause & PSF-2.0 & Apache-2.0 & MIT" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8026691468924fb6ec155dadfe2a1a7f" - -SRCNAME = "numpy" - -SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${SRCNAME}-${PV}.tar.gz \ - file://0001-Don-t-search-usr-and-so-on-for-libraries-by-default-.patch \ - file://0001-numpy-core-Define-RISCV-32-support.patch \ - file://run-ptest \ - file://0001-generate_umath.py-do-not-write-full-path-to-output-f.patch \ - " -SRC_URI[sha256sum] = "ed2cc92af0efad20198638c69bb0fc2870a58dabfba6eb722c933b48556c686c" - -GITHUB_BASE_URI = "https://github.com/numpy/numpy/releases" - -DEPENDS += "python3-cython-native" - -inherit ptest setuptools3 github-releases - -S = "${WORKDIR}/numpy-${PV}" - -CLEANBROKEN = "1" - -do_compile:prepend() { - export NPY_DISABLE_SVML=1 -} - -# Unfortunately the following pyc files are non-deterministc due to 'frozenset' -# being written without strict ordering, even with PYTHONHASHSEED = 0 -# Upstream is discussing ways to solve the issue properly, until then let's -# just not install the problematic files. -# More info: http://benno.id.au/blog/2013/01/15/python-determinism -do_install:append() { - rm ${D}${PYTHON_SITEPACKAGES_DIR}/numpy/typing/tests/data/pass/__pycache__/literal.cpython* -} - -FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/numpy/core/lib/*.a ${PYTHON_SITEPACKAGES_DIR}/numpy/random/lib/*.a" - -# install what is needed for numpy.test() -RDEPENDS:${PN} = "${PYTHON_PN}-unittest \ - ${PYTHON_PN}-difflib \ - ${PYTHON_PN}-pprint \ - ${PYTHON_PN}-pickle \ - ${PYTHON_PN}-shell \ - ${PYTHON_PN}-doctest \ - ${PYTHON_PN}-datetime \ - ${PYTHON_PN}-distutils \ - ${PYTHON_PN}-misc \ - ${PYTHON_PN}-mmap \ - ${PYTHON_PN}-netclient \ - ${PYTHON_PN}-numbers \ - ${PYTHON_PN}-pydoc \ - ${PYTHON_PN}-pkgutil \ - ${PYTHON_PN}-email \ - ${PYTHON_PN}-compression \ - ${PYTHON_PN}-ctypes \ - ${PYTHON_PN}-threading \ - ${PYTHON_PN}-multiprocessing \ - ${PYTHON_PN}-json \ -" -RDEPENDS:${PN}-ptest += "${PYTHON_PN}-pytest \ - ${PYTHON_PN}-hypothesis \ - ${PYTHON_PN}-sortedcontainers \ - ${PYTHON_PN}-resource \ - ldd \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-numpy_1.24.1.bb b/poky/meta/recipes-devtools/python/python3-numpy_1.24.1.bb new file mode 100644 index 0000000000..83b8ac4232 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-numpy_1.24.1.bb @@ -0,0 +1,72 @@ +SUMMARY = "A sophisticated Numeric Processing Package for Python" +HOMEPAGE = "https://numpy.org/" +DESCRIPTION = "NumPy is the fundamental package needed for scientific computing with Python." +SECTION = "devel/python" +LICENSE = "BSD-3-Clause & BSD-2-Clause & PSF-2.0 & Apache-2.0 & MIT" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8026691468924fb6ec155dadfe2a1a7f" + +SRCNAME = "numpy" + +SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${SRCNAME}-${PV}.tar.gz \ + file://0001-Don-t-search-usr-and-so-on-for-libraries-by-default-.patch \ + file://0001-numpy-core-Define-RISCV-32-support.patch \ + file://run-ptest \ + " +SRC_URI[sha256sum] = "2386da9a471cc00a1f47845e27d916d5ec5346ae9696e01a8a34760858fe9dd2" + +GITHUB_BASE_URI = "https://github.com/numpy/numpy/releases" +UPSTREAM_CHECK_REGEX = "releases/tag/v?(?P\d+(\.\d+)+)$" + +DEPENDS += "python3-cython-native" + +inherit ptest setuptools3 github-releases + +S = "${WORKDIR}/numpy-${PV}" + +CLEANBROKEN = "1" + +do_compile:prepend() { + export NPY_DISABLE_SVML=1 +} + +# Unfortunately the following pyc files are non-deterministc due to 'frozenset' +# being written without strict ordering, even with PYTHONHASHSEED = 0 +# Upstream is discussing ways to solve the issue properly, until then let's +# just not install the problematic files. +# More info: http://benno.id.au/blog/2013/01/15/python-determinism +do_install:append() { + rm ${D}${PYTHON_SITEPACKAGES_DIR}/numpy/typing/tests/data/pass/__pycache__/literal.cpython* +} + +FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/numpy/core/lib/*.a ${PYTHON_SITEPACKAGES_DIR}/numpy/random/lib/*.a" + +# install what is needed for numpy.test() +RDEPENDS:${PN} = "${PYTHON_PN}-unittest \ + ${PYTHON_PN}-difflib \ + ${PYTHON_PN}-pprint \ + ${PYTHON_PN}-pickle \ + ${PYTHON_PN}-shell \ + ${PYTHON_PN}-doctest \ + ${PYTHON_PN}-datetime \ + ${PYTHON_PN}-distutils \ + ${PYTHON_PN}-misc \ + ${PYTHON_PN}-mmap \ + ${PYTHON_PN}-netclient \ + ${PYTHON_PN}-numbers \ + ${PYTHON_PN}-pydoc \ + ${PYTHON_PN}-pkgutil \ + ${PYTHON_PN}-email \ + ${PYTHON_PN}-compression \ + ${PYTHON_PN}-ctypes \ + ${PYTHON_PN}-threading \ + ${PYTHON_PN}-multiprocessing \ + ${PYTHON_PN}-json \ +" +RDEPENDS:${PN}-ptest += "${PYTHON_PN}-pytest \ + ${PYTHON_PN}-hypothesis \ + ${PYTHON_PN}-sortedcontainers \ + ${PYTHON_PN}-resource \ + ldd \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-packaging_21.3.bb b/poky/meta/recipes-devtools/python/python3-packaging_21.3.bb deleted file mode 100644 index e3b9a440c4..0000000000 --- a/poky/meta/recipes-devtools/python/python3-packaging_21.3.bb +++ /dev/null @@ -1,12 +0,0 @@ -DESCRIPTION = "Core utilities for Python packages" -HOMEPAGE = "https://github.com/pypa/packaging" -LICENSE = "Apache-2.0 | BSD-2-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=faadaedca9251a90b205c9167578ce91" - -SRC_URI[sha256sum] = "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb" - -inherit pypi python_setuptools_build_meta - -BBCLASSEXTEND = "native nativesdk" - -RDEPENDS:${PN} += "${PYTHON_PN}-pyparsing" diff --git a/poky/meta/recipes-devtools/python/python3-packaging_22.0.bb b/poky/meta/recipes-devtools/python/python3-packaging_22.0.bb new file mode 100644 index 0000000000..bcf077d2c7 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-packaging_22.0.bb @@ -0,0 +1,10 @@ +DESCRIPTION = "Core utilities for Python packages" +HOMEPAGE = "https://github.com/pypa/packaging" +LICENSE = "Apache-2.0 | BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=faadaedca9251a90b205c9167578ce91" + +SRC_URI[sha256sum] = "2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3" + +inherit pypi python_flit_core + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-pathspec_0.10.1.bb b/poky/meta/recipes-devtools/python/python3-pathspec_0.10.1.bb deleted file mode 100644 index 8f2af0ec99..0000000000 --- a/poky/meta/recipes-devtools/python/python3-pathspec_0.10.1.bb +++ /dev/null @@ -1,11 +0,0 @@ -SUMMARY = "Utility library for gitignore style pattern matching of file paths." -HOMEPAGE = "https://github.com/cpburnz/python-path-specification" -SECTION = "devel/python" -LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=815ca599c9df247a0c7f619bab123dad" - -SRC_URI[sha256sum] = "7ace6161b621d31e7902eb6b5ae148d12cfd23f4a249b9ffb6b9fee12084323d" - -inherit pypi setuptools3 - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-pathspec_0.10.3.bb b/poky/meta/recipes-devtools/python/python3-pathspec_0.10.3.bb new file mode 100644 index 0000000000..bd1e7e3639 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-pathspec_0.10.3.bb @@ -0,0 +1,11 @@ +SUMMARY = "Utility library for gitignore style pattern matching of file paths." +HOMEPAGE = "https://github.com/cpburnz/python-path-specification" +SECTION = "devel/python" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=815ca599c9df247a0c7f619bab123dad" + +SRC_URI[sha256sum] = "56200de4077d9d0791465aa9095a01d421861e405b5096955051deefd697d6f6" + +inherit pypi setuptools3 + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-poetry-core/deterministic.patch b/poky/meta/recipes-devtools/python/python3-poetry-core/deterministic.patch new file mode 100644 index 0000000000..402ee53094 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-poetry-core/deterministic.patch @@ -0,0 +1,23 @@ +builders/wheel: Ensure dist-info is written determinisically + +glob() returns values in "on disk" order. To make the RECORD file +deterministic and consistent between builds we need to sort the +data before adding to the records list. + +Signed-off-by: Richard Purdie + +Upstream-Status: Submitted [https://github.com/python-poetry/poetry-core/pull/545] + +Index: builders/wheel.py +=================================================================== +--- a/src/poetry/core/masonry/builders/wheel.py ++++ b/src/poetry/core/masonry/builders/wheel.py +@@ -294,7 +294,7 @@ class WheelBuilder(Builder): + + def _copy_dist_info(self, wheel: zipfile.ZipFile, source: Path) -> None: + dist_info = Path(self.dist_info) +- for file in source.glob("**/*"): ++ for file in sorted(source.glob("**/*") ): + if not file.is_file(): + continue + diff --git a/poky/meta/recipes-devtools/python/python3-poetry-core_1.3.2.bb b/poky/meta/recipes-devtools/python/python3-poetry-core_1.3.2.bb deleted file mode 100644 index 1b6c76323b..0000000000 --- a/poky/meta/recipes-devtools/python/python3-poetry-core_1.3.2.bb +++ /dev/null @@ -1,45 +0,0 @@ -SUMMARY = "Poetry PEP 517 Build Backend" -DESCRIPTION = "Poetry PEP 517 Build Backend" -HOMEPAGE = "https://github.com/python-poetry/poetry-core" -BUGTRACKER = "https://github.com/python-poetry/poetry-core" -CHANGELOG = "https://github.com/python-poetry/poetry-core/blob/master/CHANGELOG.md" - -LICENSE = "Apache-2.0 & BSD-2-Clause & MIT" -LIC_FILES_CHKSUM = "\ - file://LICENSE;md5=78c39cfd009863ae44237a7ab1f9cedc \ - file://src/poetry/core/_vendor/attr/_version_info.py;beginline=1;endline=1;md5=b2dccaa94b3629a08bfb4f983cad6f89 \ - file://src/poetry/core/_vendor/attrs/LICENSE;md5=5e55731824cf9205cfabeab9a0600887 \ - file://src/poetry/core/_vendor/jsonschema/COPYING;md5=7a60a81c146ec25599a3e1dabb8610a8 \ - file://src/poetry/core/_vendor/lark/LICENSE;md5=b37b83a9cf129d92ee65aaa71c01ce72 \ - file://src/poetry/core/_vendor/packaging/LICENSE;md5=faadaedca9251a90b205c9167578ce91 \ - file://src/poetry/core/_vendor/packaging/LICENSE.APACHE;md5=2ee41112a44fe7014dce33e26468ba93 \ - file://src/poetry/core/_vendor/packaging/LICENSE.BSD;md5=7bef9bf4a8e4263634d0597e7ba100b8 \ - file://src/poetry/core/_vendor/pyparsing/LICENSE;md5=657a566233888513e1f07ba13e2f47f1 \ - file://src/poetry/core/_vendor/pyrsistent/LICENSE.mit;md5=b695eb9c6e7a6fb1b1bc2d193c42776e \ - file://src/poetry/core/_vendor/tomlkit/LICENSE;md5=31aac0dbc1babd278d5386dadb7f8e82 \ - file://src/poetry/core/_vendor/typing_extensions.LICENSE;md5=64fc2b30b67d0a8423c250e0386ed72f \ -" - -SRC_URI[sha256sum] = "0ab006a40cb38d6a38b97264f6835da2f08a96912f2728ce668e9ac6a34f686f" - -inherit python_poetry_core pypi - -RDEPENDS:${PN}:append:class-target = "\ - python3-compression \ - python3-core \ - python3-crypt \ - python3-io \ - python3-json \ - python3-logging \ - python3-netclient \ - python3-pathlib2 \ - python3-pprint \ - python3-shell \ -" - -RDEPENDS:${PN} += "\ - python3-pip \ - python3-six \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-poetry-core_1.4.0.bb b/poky/meta/recipes-devtools/python/python3-poetry-core_1.4.0.bb new file mode 100644 index 0000000000..8a95022012 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-poetry-core_1.4.0.bb @@ -0,0 +1,49 @@ +SUMMARY = "Poetry PEP 517 Build Backend" +DESCRIPTION = "Poetry PEP 517 Build Backend" +HOMEPAGE = "https://github.com/python-poetry/poetry-core" +BUGTRACKER = "https://github.com/python-poetry/poetry-core" +CHANGELOG = "https://github.com/python-poetry/poetry-core/blob/master/CHANGELOG.md" + +LICENSE = "Apache-2.0 & BSD-2-Clause & MIT" +LIC_FILES_CHKSUM = "\ + file://LICENSE;md5=78c39cfd009863ae44237a7ab1f9cedc \ + file://src/poetry/core/_vendor/attr/_version_info.py;beginline=1;endline=1;md5=b2dccaa94b3629a08bfb4f983cad6f89 \ + file://src/poetry/core/_vendor/attrs/LICENSE;md5=5e55731824cf9205cfabeab9a0600887 \ + file://src/poetry/core/_vendor/jsonschema/COPYING;md5=7a60a81c146ec25599a3e1dabb8610a8 \ + file://src/poetry/core/_vendor/lark/LICENSE;md5=fcfbf1e2ecc0f37acbb5871aa0267500 \ + file://src/poetry/core/_vendor/packaging/LICENSE;md5=faadaedca9251a90b205c9167578ce91 \ + file://src/poetry/core/_vendor/packaging/LICENSE.APACHE;md5=2ee41112a44fe7014dce33e26468ba93 \ + file://src/poetry/core/_vendor/packaging/LICENSE.BSD;md5=7bef9bf4a8e4263634d0597e7ba100b8 \ + file://src/poetry/core/_vendor/pyparsing/LICENSE;md5=657a566233888513e1f07ba13e2f47f1 \ + file://src/poetry/core/_vendor/pyrsistent/LICENSE.mit;md5=b695eb9c6e7a6fb1b1bc2d193c42776e \ + file://src/poetry/core/_vendor/tomlkit/LICENSE;md5=31aac0dbc1babd278d5386dadb7f8e82 \ + file://src/poetry/core/_vendor/typing_extensions.LICENSE;md5=f16b323917992e0f8a6f0071bc9913e2 \ +" + +SRC_URI[sha256sum] = "514bd33c30e0bf56b0ed44ee15e120d7e47b61ad908b2b1011da68c48a84ada9" + +inherit python_poetry_core pypi +PYPI_ARCHIVE_NAME = "poetry_core-${PV}.${PYPI_PACKAGE_EXT}" +S = "${WORKDIR}/poetry_core-${PV}" + +SRC_URI += "file://deterministic.patch" + +RDEPENDS:${PN}:append:class-target = "\ + python3-compression \ + python3-core \ + python3-crypt \ + python3-io \ + python3-json \ + python3-logging \ + python3-netclient \ + python3-pathlib2 \ + python3-pprint \ + python3-shell \ +" + +RDEPENDS:${PN} += "\ + python3-pip \ + python3-six \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-pycairo_1.21.0.bb b/poky/meta/recipes-devtools/python/python3-pycairo_1.21.0.bb deleted file mode 100644 index b692067809..0000000000 --- a/poky/meta/recipes-devtools/python/python3-pycairo_1.21.0.bb +++ /dev/null @@ -1,26 +0,0 @@ -SUMMARY = "Python bindings for the Cairo canvas library" -HOMEPAGE = "http://cairographics.org/pycairo" -BUGTRACKER = "http://bugs.freedesktop.org" -SECTION = "python-devel" -LICENSE = "LGPL-2.1-only & MPL-1.1" -LIC_FILES_CHKSUM = "file://COPYING;md5=f3713ca2c28d9312ad718520b6dc3eee \ - file://COPYING-LGPL-2.1;md5=fad9b3332be894bab9bc501572864b29 \ - file://COPYING-MPL-1.1;md5=bfe1f75d606912a4111c90743d6c7325" - -# cairo >= 1.14 -DEPENDS = "cairo python3" - -SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/pycairo-${PV}.tar.gz" -GITHUB_BASE_URI = "https://github.com/pygobject/pycairo/releases/" - -SRC_URI[sha256sum] = "251907f18a552df938aa3386657ff4b5a4937dde70e11aa042bc297957f4b74b" - -S = "${WORKDIR}/pycairo-${PV}" - -inherit meson pkgconfig python3targetconfig github-releases - -CFLAGS += "-fPIC" - -BBCLASSEXTEND = "native" - -FILES:${PN} = "${PYTHON_SITEPACKAGES_DIR}/*" diff --git a/poky/meta/recipes-devtools/python/python3-pycairo_1.23.0.bb b/poky/meta/recipes-devtools/python/python3-pycairo_1.23.0.bb new file mode 100644 index 0000000000..5214a05d53 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-pycairo_1.23.0.bb @@ -0,0 +1,26 @@ +SUMMARY = "Python bindings for the Cairo canvas library" +HOMEPAGE = "http://cairographics.org/pycairo" +BUGTRACKER = "http://bugs.freedesktop.org" +SECTION = "python-devel" +LICENSE = "LGPL-2.1-only & MPL-1.1" +LIC_FILES_CHKSUM = "file://COPYING;md5=f3713ca2c28d9312ad718520b6dc3eee \ + file://COPYING-LGPL-2.1;md5=fad9b3332be894bab9bc501572864b29 \ + file://COPYING-MPL-1.1;md5=bfe1f75d606912a4111c90743d6c7325" + +# cairo >= 1.14 +DEPENDS = "cairo python3" + +SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/pycairo-${PV}.tar.gz" +GITHUB_BASE_URI = "https://github.com/pygobject/pycairo/releases/" + +SRC_URI[sha256sum] = "9b61ac818723adc04367301317eb2e814a83522f07bbd1f409af0dada463c44c" + +S = "${WORKDIR}/pycairo-${PV}" + +inherit meson pkgconfig python3targetconfig github-releases + +CFLAGS += "-fPIC" + +BBCLASSEXTEND = "native" + +FILES:${PN} = "${PYTHON_SITEPACKAGES_DIR}/*" diff --git a/poky/meta/recipes-devtools/python/python3-pycryptodome_3.15.0.bb b/poky/meta/recipes-devtools/python/python3-pycryptodome_3.15.0.bb deleted file mode 100644 index cabe9189f2..0000000000 --- a/poky/meta/recipes-devtools/python/python3-pycryptodome_3.15.0.bb +++ /dev/null @@ -1,5 +0,0 @@ -require python-pycryptodome.inc -inherit setuptools3 - -SRC_URI[sha256sum] = "9135dddad504592bcc18b0d2d95ce86c3a5ea87ec6447ef25cfedea12d6018b8" - diff --git a/poky/meta/recipes-devtools/python/python3-pycryptodome_3.16.0.bb b/poky/meta/recipes-devtools/python/python3-pycryptodome_3.16.0.bb new file mode 100644 index 0000000000..15ee31c66a --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-pycryptodome_3.16.0.bb @@ -0,0 +1,5 @@ +require python-pycryptodome.inc +inherit setuptools3 + +SRC_URI[sha256sum] = "0e45d2d852a66ecfb904f090c3f87dc0dfb89a499570abad8590f10d9cffb350" + diff --git a/poky/meta/recipes-devtools/python/python3-pycryptodomex_3.15.0.bb b/poky/meta/recipes-devtools/python/python3-pycryptodomex_3.15.0.bb deleted file mode 100644 index e22ce30833..0000000000 --- a/poky/meta/recipes-devtools/python/python3-pycryptodomex_3.15.0.bb +++ /dev/null @@ -1,9 +0,0 @@ -require python-pycryptodome.inc -inherit setuptools3 - -SRC_URI[sha256sum] = "7341f1bb2dadb0d1a0047f34c3a58208a92423cdbd3244d998e4b28df5eac0ed" - -FILES:${PN}-tests = " \ - ${PYTHON_SITEPACKAGES_DIR}/Cryptodome/SelfTest/ \ - ${PYTHON_SITEPACKAGES_DIR}/Cryptodome/SelfTest/__pycache__/ \ -" diff --git a/poky/meta/recipes-devtools/python/python3-pycryptodomex_3.16.0.bb b/poky/meta/recipes-devtools/python/python3-pycryptodomex_3.16.0.bb new file mode 100644 index 0000000000..36ef772863 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-pycryptodomex_3.16.0.bb @@ -0,0 +1,9 @@ +require python-pycryptodome.inc +inherit setuptools3 + +SRC_URI[sha256sum] = "e9ba9d8ed638733c9e95664470b71d624a6def149e2db6cc52c1aca5a6a2df1d" + +FILES:${PN}-tests = " \ + ${PYTHON_SITEPACKAGES_DIR}/Cryptodome/SelfTest/ \ + ${PYTHON_SITEPACKAGES_DIR}/Cryptodome/SelfTest/__pycache__/ \ +" diff --git a/poky/meta/recipes-devtools/python/python3-pyrsistent_0.19.2.bb b/poky/meta/recipes-devtools/python/python3-pyrsistent_0.19.2.bb deleted file mode 100644 index 0b309de8b1..0000000000 --- a/poky/meta/recipes-devtools/python/python3-pyrsistent_0.19.2.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "Persistent/Immutable/Functional data structures for Python" -HOMEPAGE = "https://github.com/tobgu/pyrsistent" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE.mit;md5=b695eb9c6e7a6fb1b1bc2d193c42776e" - -SRC_URI[sha256sum] = "bfa0351be89c9fcbcb8c9879b826f4353be10f58f8a677efab0c017bf7137ec2" - -inherit pypi python_setuptools_build_meta - -RDEPENDS:${PN} += " \ - ${PYTHON_PN}-numbers \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-pyrsistent_0.19.3.bb b/poky/meta/recipes-devtools/python/python3-pyrsistent_0.19.3.bb new file mode 100644 index 0000000000..05654c348d --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-pyrsistent_0.19.3.bb @@ -0,0 +1,14 @@ +SUMMARY = "Persistent/Immutable/Functional data structures for Python" +HOMEPAGE = "https://github.com/tobgu/pyrsistent" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.mit;md5=b695eb9c6e7a6fb1b1bc2d193c42776e" + +SRC_URI[sha256sum] = "1a2994773706bbb4995c31a97bc94f1418314923bd1048c6d964837040376440" + +inherit pypi python_setuptools_build_meta + +RDEPENDS:${PN} += " \ + ${PYTHON_PN}-numbers \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-pytz_2022.6.bb b/poky/meta/recipes-devtools/python/python3-pytz_2022.6.bb deleted file mode 100644 index 9631f59288..0000000000 --- a/poky/meta/recipes-devtools/python/python3-pytz_2022.6.bb +++ /dev/null @@ -1,35 +0,0 @@ -SUMMARY = "World timezone definitions, modern and historical" -HOMEPAGE = "http://pythonhosted.org/pytz" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=1a67fc46c1b596cce5d21209bbe75999" - -inherit pypi setuptools3 ptest - -SRC_URI[sha256sum] = "e89512406b793ca39f5971bc999cc538ce125c0e51c27941bef4568b460095e2" - -RDEPENDS:${PN}:class-target += "\ - ${PYTHON_PN}-datetime \ - ${PYTHON_PN}-doctest \ - ${PYTHON_PN}-io \ - ${PYTHON_PN}-pickle \ - ${PYTHON_PN}-pprint \ - ${PYTHON_PN}-threading \ -" - -BBCLASSEXTEND = "native nativesdk" - -SRC_URI += " \ - file://run-ptest \ -" - -RDEPENDS:${PN}-ptest += " \ - ${PYTHON_PN}-pytest \ -" - -do_install_ptest() { - install -d ${D}${PTEST_PATH}/pytz - install -d ${D}${PTEST_PATH}/pytz/tests - cp -rf ${S}/pytz/tests/* ${D}${PTEST_PATH}/pytz/tests/ - cp -f ${S}/README.rst ${D}${PTEST_PATH}/ - -} diff --git a/poky/meta/recipes-devtools/python/python3-pytz_2022.7.bb b/poky/meta/recipes-devtools/python/python3-pytz_2022.7.bb new file mode 100644 index 0000000000..a6a69c8b59 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-pytz_2022.7.bb @@ -0,0 +1,35 @@ +SUMMARY = "World timezone definitions, modern and historical" +HOMEPAGE = "http://pythonhosted.org/pytz" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=1a67fc46c1b596cce5d21209bbe75999" + +inherit pypi setuptools3 ptest + +SRC_URI[sha256sum] = "7ccfae7b4b2c067464a6733c6261673fdb8fd1be905460396b97a073e9fa683a" + +RDEPENDS:${PN}:class-target += "\ + ${PYTHON_PN}-datetime \ + ${PYTHON_PN}-doctest \ + ${PYTHON_PN}-io \ + ${PYTHON_PN}-pickle \ + ${PYTHON_PN}-pprint \ + ${PYTHON_PN}-threading \ +" + +BBCLASSEXTEND = "native nativesdk" + +SRC_URI += " \ + file://run-ptest \ +" + +RDEPENDS:${PN}-ptest += " \ + ${PYTHON_PN}-pytest \ +" + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/pytz + install -d ${D}${PTEST_PATH}/pytz/tests + cp -rf ${S}/pytz/tests/* ${D}${PTEST_PATH}/pytz/tests/ + cp -f ${S}/README.rst ${D}${PTEST_PATH}/ + +} diff --git a/poky/meta/recipes-devtools/python/python3-setuptools-scm_7.0.5.bb b/poky/meta/recipes-devtools/python/python3-setuptools-scm_7.0.5.bb deleted file mode 100644 index a1e719f54b..0000000000 --- a/poky/meta/recipes-devtools/python/python3-setuptools-scm_7.0.5.bb +++ /dev/null @@ -1,30 +0,0 @@ -SUMMARY = "the blessed package to manage your versions by scm tags" -HOMEPAGE = "https://pypi.org/project/setuptools-scm/" -DESCRIPTION = "setuptools_scm handles managing your Python package versions in SCM metadata instead of declaring them as the version argument or in a SCM managed file." -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=8227180126797a0148f94f483f3e1489" - -SRC_URI[sha256sum] = "031e13af771d6f892b941adb6ea04545bbf91ebc5ce68c78aaf3fff6e1fb4844" - -PYPI_PACKAGE = "setuptools_scm" -inherit pypi python_setuptools_build_meta - -UPSTREAM_CHECK_REGEX = "setuptools_scm-(?P.*)\.tar" - -DEPENDS += "python3-tomli-native python3-packaging-native python3-typing-extensions-native" - -RDEPENDS:${PN} = "\ - ${PYTHON_PN}-packaging \ - ${PYTHON_PN}-pip \ - ${PYTHON_PN}-pyparsing \ - ${PYTHON_PN}-setuptools \ - ${PYTHON_PN}-tomli \ - ${PYTHON_PN}-typing-extensions \ -" - -RDEPENDS:${PN}:append:class-target = " \ - ${PYTHON_PN}-debugger \ - ${PYTHON_PN}-json \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-setuptools-scm_7.1.0.bb b/poky/meta/recipes-devtools/python/python3-setuptools-scm_7.1.0.bb new file mode 100644 index 0000000000..7961ff7198 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-setuptools-scm_7.1.0.bb @@ -0,0 +1,30 @@ +SUMMARY = "the blessed package to manage your versions by scm tags" +HOMEPAGE = "https://pypi.org/project/setuptools-scm/" +DESCRIPTION = "setuptools_scm handles managing your Python package versions in SCM metadata instead of declaring them as the version argument or in a SCM managed file." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=8227180126797a0148f94f483f3e1489" + +SRC_URI[sha256sum] = "6c508345a771aad7d56ebff0e70628bf2b0ec7573762be9960214730de278f27" + +PYPI_PACKAGE = "setuptools_scm" +inherit pypi python_setuptools_build_meta + +UPSTREAM_CHECK_REGEX = "setuptools_scm-(?P.*)\.tar" + +DEPENDS += "python3-tomli-native python3-packaging-native python3-typing-extensions-native" + +RDEPENDS:${PN} = "\ + ${PYTHON_PN}-packaging \ + ${PYTHON_PN}-pip \ + ${PYTHON_PN}-pyparsing \ + ${PYTHON_PN}-setuptools \ + ${PYTHON_PN}-tomli \ + ${PYTHON_PN}-typing-extensions \ +" + +RDEPENDS:${PN}:append:class-target = " \ + ${PYTHON_PN}-debugger \ + ${PYTHON_PN}-json \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-setuptools/0001-conditionally-do-not-fetch-code-by-easy_install.patch b/poky/meta/recipes-devtools/python/python3-setuptools/0001-conditionally-do-not-fetch-code-by-easy_install.patch index 1b5f9c7577..2110c4a877 100644 --- a/poky/meta/recipes-devtools/python/python3-setuptools/0001-conditionally-do-not-fetch-code-by-easy_install.patch +++ b/poky/meta/recipes-devtools/python/python3-setuptools/0001-conditionally-do-not-fetch-code-by-easy_install.patch @@ -1,4 +1,4 @@ -From a0e0873a8ee6674d43e604d66bf66d94fc8eeb6f Mon Sep 17 00:00:00 2001 +From 2e57369593ede5336f947e7b9903ebc673f98fef Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Tue, 17 Jul 2018 10:13:38 +0800 Subject: [PATCH] conditionally do not fetch code by easy_install diff --git a/poky/meta/recipes-devtools/python/python3-setuptools_65.5.1.bb b/poky/meta/recipes-devtools/python/python3-setuptools_65.5.1.bb deleted file mode 100644 index 8dc724e55a..0000000000 --- a/poky/meta/recipes-devtools/python/python3-setuptools_65.5.1.bb +++ /dev/null @@ -1,55 +0,0 @@ -SUMMARY = "Download, build, install, upgrade, and uninstall Python packages" -HOMEPAGE = "https://pypi.org/project/setuptools" -SECTION = "devel/python" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;beginline=1;endline=19;md5=7a7126e068206290f3fe9f8d6c713ea6" - -inherit pypi python_setuptools_build_meta - -SRC_URI:append:class-native = " file://0001-conditionally-do-not-fetch-code-by-easy_install.patch" - -SRC_URI += "file://0001-change-shebang-to-python3.patch \ - file://0001-_distutils-sysconfig.py-make-it-possible-to-substite.patch" - -SRC_URI[sha256sum] = "e197a19aa8ec9722928f2206f8de752def0e4c9fc6953527360d1c36d94ddb2f" - -DEPENDS += "${PYTHON_PN}" - -RDEPENDS:${PN} = "\ - ${PYTHON_PN}-2to3 \ - ${PYTHON_PN}-compile \ - ${PYTHON_PN}-compression \ - ${PYTHON_PN}-ctypes \ - ${PYTHON_PN}-email \ - ${PYTHON_PN}-html \ - ${PYTHON_PN}-json \ - ${PYTHON_PN}-netserver \ - ${PYTHON_PN}-numbers \ - ${PYTHON_PN}-pickle \ - ${PYTHON_PN}-pkg-resources \ - ${PYTHON_PN}-pkgutil \ - ${PYTHON_PN}-plistlib \ - ${PYTHON_PN}-shell \ - ${PYTHON_PN}-stringold \ - ${PYTHON_PN}-threading \ - ${PYTHON_PN}-unittest \ - ${PYTHON_PN}-xml \ -" - -BBCLASSEXTEND = "native nativesdk" - -# The pkg-resources module can be used by itself, without the package downloader -# and easy_install. Ship it in a separate package so that it can be used by -# minimal distributions. -PACKAGES =+ "${PYTHON_PN}-pkg-resources " -FILES:${PYTHON_PN}-pkg-resources = "${PYTHON_SITEPACKAGES_DIR}/pkg_resources/*" -RDEPENDS:${PYTHON_PN}-pkg-resources = "\ - ${PYTHON_PN}-compression \ - ${PYTHON_PN}-email \ - ${PYTHON_PN}-plistlib \ - ${PYTHON_PN}-pprint \ -" - -# This used to use the bootstrap install which didn't compile. Until we bump the -# tmpdir version we can't compile the native otherwise the sysroot unpack fails -INSTALL_WHEEL_COMPILE_BYTECODE:class-native = "--no-compile-bytecode" diff --git a/poky/meta/recipes-devtools/python/python3-setuptools_65.6.3.bb b/poky/meta/recipes-devtools/python/python3-setuptools_65.6.3.bb new file mode 100644 index 0000000000..a8bcb3a602 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-setuptools_65.6.3.bb @@ -0,0 +1,55 @@ +SUMMARY = "Download, build, install, upgrade, and uninstall Python packages" +HOMEPAGE = "https://pypi.org/project/setuptools" +SECTION = "devel/python" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;beginline=1;endline=19;md5=7a7126e068206290f3fe9f8d6c713ea6" + +inherit pypi python_setuptools_build_meta + +SRC_URI:append:class-native = " file://0001-conditionally-do-not-fetch-code-by-easy_install.patch" + +SRC_URI += "file://0001-change-shebang-to-python3.patch \ + file://0001-_distutils-sysconfig.py-make-it-possible-to-substite.patch" + +SRC_URI[sha256sum] = "a7620757bf984b58deaf32fc8a4577a9bbc0850cf92c20e1ce41c38c19e5fb75" + +DEPENDS += "${PYTHON_PN}" + +RDEPENDS:${PN} = "\ + ${PYTHON_PN}-2to3 \ + ${PYTHON_PN}-compile \ + ${PYTHON_PN}-compression \ + ${PYTHON_PN}-ctypes \ + ${PYTHON_PN}-email \ + ${PYTHON_PN}-html \ + ${PYTHON_PN}-json \ + ${PYTHON_PN}-netserver \ + ${PYTHON_PN}-numbers \ + ${PYTHON_PN}-pickle \ + ${PYTHON_PN}-pkg-resources \ + ${PYTHON_PN}-pkgutil \ + ${PYTHON_PN}-plistlib \ + ${PYTHON_PN}-shell \ + ${PYTHON_PN}-stringold \ + ${PYTHON_PN}-threading \ + ${PYTHON_PN}-unittest \ + ${PYTHON_PN}-xml \ +" + +BBCLASSEXTEND = "native nativesdk" + +# The pkg-resources module can be used by itself, without the package downloader +# and easy_install. Ship it in a separate package so that it can be used by +# minimal distributions. +PACKAGES =+ "${PYTHON_PN}-pkg-resources " +FILES:${PYTHON_PN}-pkg-resources = "${PYTHON_SITEPACKAGES_DIR}/pkg_resources/*" +RDEPENDS:${PYTHON_PN}-pkg-resources = "\ + ${PYTHON_PN}-compression \ + ${PYTHON_PN}-email \ + ${PYTHON_PN}-plistlib \ + ${PYTHON_PN}-pprint \ +" + +# This used to use the bootstrap install which didn't compile. Until we bump the +# tmpdir version we can't compile the native otherwise the sysroot unpack fails +INSTALL_WHEEL_COMPILE_BYTECODE:class-native = "--no-compile-bytecode" diff --git a/poky/meta/recipes-devtools/python/python3-smartypants_2.0.0.bb b/poky/meta/recipes-devtools/python/python3-smartypants_2.0.0.bb index 05c94c390f..d089a89b95 100644 --- a/poky/meta/recipes-devtools/python/python3-smartypants_2.0.0.bb +++ b/poky/meta/recipes-devtools/python/python3-smartypants_2.0.0.bb @@ -9,6 +9,6 @@ PYPI_PACKAGE = "smartypants" SRC_URI += "file://0001-Change-hash-bang-to-python3.patch" SRC_URI[sha256sum] = "7812353a32022699a1aa8cd5626e01c94a946dcaeedaee2d0b382bae4c4cbf36" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" UPSTREAM_CHECK_REGEX = "/${PYPI_PACKAGE}/(?P(?!2\.0\.1)(\d+[\.\-_]*)+)/" diff --git a/poky/meta/recipes-devtools/python/python3-sphinx_5.3.0.bb b/poky/meta/recipes-devtools/python/python3-sphinx_5.3.0.bb deleted file mode 100644 index 70b4e23def..0000000000 --- a/poky/meta/recipes-devtools/python/python3-sphinx_5.3.0.bb +++ /dev/null @@ -1,37 +0,0 @@ -DESCRIPTION = "Python documentation generator" -HOMEPAGE = "http://sphinx-doc.org/" -SECTION = "devel/python" -LICENSE = "BSD-2-Clause & MIT & BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE;md5=72c536e78c21c567311b193fe00cd253" - -PYPI_PACKAGE = "Sphinx" - -SRC_URI[sha256sum] = "51026de0a9ff9fc13c05d74913ad66047e104f56a129ff73e174eb5c3ee794b5" - -inherit python_flit_core pypi - - -do_install:append () { - # The cache format of "{None, 'en', 'ja'}" doesn't seem to be consistent (dict ordering?) - rm ${D}${libdir}/${PYTHON_DIR}/site-packages/sphinx/writers/__pycache__/*latex* -} - -RDEPENDS:${PN} = "\ - python3-alabaster \ - python3-babel \ - python3-docutils \ - python3-imagesize \ - python3-jinja2 \ - python3-packaging \ - python3-pygments \ - python3-requests \ - python3-snowballstemmer \ - python3-sphinxcontrib-applehelp \ - python3-sphinxcontrib-devhelp \ - python3-sphinxcontrib-htmlhelp \ - python3-sphinxcontrib-jsmath \ - python3-sphinxcontrib-qthelp \ - python3-sphinxcontrib-serializinghtml \ - " - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-sphinx_6.0.0.bb b/poky/meta/recipes-devtools/python/python3-sphinx_6.0.0.bb new file mode 100644 index 0000000000..5e565e745d --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-sphinx_6.0.0.bb @@ -0,0 +1,37 @@ +DESCRIPTION = "Python documentation generator" +HOMEPAGE = "http://sphinx-doc.org/" +SECTION = "devel/python" +LICENSE = "BSD-2-Clause & MIT & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=2214a89317448c7f792f5b75dd6726e4" + +PYPI_PACKAGE = "Sphinx" + +SRC_URI[sha256sum] = "58c140ecd9aa0abbc8ff6da48a266648eac9e5bfc8e49576efd2979bf46f5961" + +inherit python_flit_core pypi + + +do_install:append () { + # The cache format of "{None, 'en', 'ja'}" doesn't seem to be consistent (dict ordering?) + rm ${D}${libdir}/${PYTHON_DIR}/site-packages/sphinx/writers/__pycache__/*latex* +} + +RDEPENDS:${PN} = "\ + python3-alabaster \ + python3-babel \ + python3-docutils \ + python3-imagesize \ + python3-jinja2 \ + python3-packaging \ + python3-pygments \ + python3-requests \ + python3-snowballstemmer \ + python3-sphinxcontrib-applehelp \ + python3-sphinxcontrib-devhelp \ + python3-sphinxcontrib-htmlhelp \ + python3-sphinxcontrib-jsmath \ + python3-sphinxcontrib-qthelp \ + python3-sphinxcontrib-serializinghtml \ + " + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-strict-rfc3339/0001-setup.py-use-vendored-_distutils.patch b/poky/meta/recipes-devtools/python/python3-strict-rfc3339/0001-setup.py-use-vendored-_distutils.patch deleted file mode 100644 index ba1c3d3363..0000000000 --- a/poky/meta/recipes-devtools/python/python3-strict-rfc3339/0001-setup.py-use-vendored-_distutils.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 857719e82daea0d85b734cac34cf569050724068 Mon Sep 17 00:00:00 2001 -From: Tim Orling -Date: Sun, 20 Feb 2022 20:26:51 -0800 -Subject: [PATCH] setup.py: use vendored _distutils - -Deprecation warning of distutils is interferring with bdist_wheel build. - -For now, use the vendored setuptools._distutils.core. - -Upstream-Status: Pending [upstream appears unmaintained] - -Signed-off-by: Tim Orling ---- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index 1bf87cf..a49fb8e 100644 ---- a/setup.py -+++ b/setup.py -@@ -1,5 +1,5 @@ - import os.path --from distutils.core import setup -+from setuptools._distutils.core import setup - - readme_file = os.path.join(os.path.dirname(__file__), 'README.md') - readme = open(readme_file).read() diff --git a/poky/meta/recipes-devtools/python/python3-strict-rfc3339_0.7.bb b/poky/meta/recipes-devtools/python/python3-strict-rfc3339_0.7.bb deleted file mode 100644 index c377c3bfb0..0000000000 --- a/poky/meta/recipes-devtools/python/python3-strict-rfc3339_0.7.bb +++ /dev/null @@ -1,11 +0,0 @@ -SUMMARY = "Strict, simple, lightweight RFC3339 function.s" -HOMEPAGE = "https://pypi.org/project/strict-rfc3339/" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://LICENSE;md5=8f0e2cd40e05189ec81232da84bd6e1a" - -SRC_URI += "file://0001-setup.py-use-vendored-_distutils.patch" -SRC_URI[sha256sum] = "5cad17bedfc3af57b399db0fed32771f18fc54bbd917e85546088607ac5e1277" - -inherit pypi setuptools3 - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-subunit_1.4.1.bb b/poky/meta/recipes-devtools/python/python3-subunit_1.4.1.bb deleted file mode 100644 index c5faeaa513..0000000000 --- a/poky/meta/recipes-devtools/python/python3-subunit_1.4.1.bb +++ /dev/null @@ -1,15 +0,0 @@ -SUMMARY = "Python implementation of subunit test streaming protocol" -HOMEPAGE = "https://pypi.org/project/python-subunit/" -SECTION = "devel/python" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://README.rst;beginline=1;endline=20;md5=909c08e291647fd985fbe5d9836d51b6" - -PYPI_PACKAGE = "python-subunit" - -SRC_URI[sha256sum] = "5fe5686904428501376e7b11593226d37638fbd981c1fc9ed6aac180525d78c1" - -inherit pypi setuptools3 - -RDEPENDS:${PN} = " python3-testtools" - -BBCLASSEXTEND = "nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-subunit_1.4.2.bb b/poky/meta/recipes-devtools/python/python3-subunit_1.4.2.bb new file mode 100644 index 0000000000..a018ef1dc8 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-subunit_1.4.2.bb @@ -0,0 +1,15 @@ +SUMMARY = "Python implementation of subunit test streaming protocol" +HOMEPAGE = "https://pypi.org/project/python-subunit/" +SECTION = "devel/python" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://README.rst;beginline=1;endline=20;md5=909c08e291647fd985fbe5d9836d51b6" + +PYPI_PACKAGE = "python-subunit" + +SRC_URI[sha256sum] = "2988d324d55ec35dd037e502e3f74ac38f4e457bd44ee0edf5e898f7ee1134d4" + +inherit pypi setuptools3 + +RDEPENDS:${PN} = " python3-testtools" + +BBCLASSEXTEND = "nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-typogrify_2.0.7.bb b/poky/meta/recipes-devtools/python/python3-typogrify_2.0.7.bb index 83e9b5eadb..826f126ad9 100644 --- a/poky/meta/recipes-devtools/python/python3-typogrify_2.0.7.bb +++ b/poky/meta/recipes-devtools/python/python3-typogrify_2.0.7.bb @@ -8,7 +8,7 @@ inherit pypi setuptools3 PYPI_PACKAGE = "typogrify" SRC_URI[sha256sum] = "8be4668cda434163ce229d87ca273a11922cb1614cb359970b7dc96eed13cb38" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" RDEPENDS:${PN} += "${PYTHON_PN}-smartypants" diff --git a/poky/meta/recipes-devtools/python/python3-urllib3_1.26.12.bb b/poky/meta/recipes-devtools/python/python3-urllib3_1.26.12.bb deleted file mode 100644 index 1cd69bcb10..0000000000 --- a/poky/meta/recipes-devtools/python/python3-urllib3_1.26.12.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "Python HTTP library with thread-safe connection pooling, file post support, sanity friendly, and more" -HOMEPAGE = "https://github.com/shazow/urllib3" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=c2823cb995439c984fd62a973d79815c" - -SRC_URI[sha256sum] = "3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e" - -inherit pypi setuptools3 - -RDEPENDS:${PN} += "\ - ${PYTHON_PN}-certifi \ - ${PYTHON_PN}-cryptography \ - ${PYTHON_PN}-email \ - ${PYTHON_PN}-idna \ - ${PYTHON_PN}-netclient \ - ${PYTHON_PN}-pyopenssl \ - ${PYTHON_PN}-threading \ - ${PYTHON_PN}-logging \ -" - -CVE_PRODUCT = "urllib3" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-urllib3_1.26.13.bb b/poky/meta/recipes-devtools/python/python3-urllib3_1.26.13.bb new file mode 100644 index 0000000000..7af95117cf --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-urllib3_1.26.13.bb @@ -0,0 +1,23 @@ +SUMMARY = "Python HTTP library with thread-safe connection pooling, file post support, sanity friendly, and more" +HOMEPAGE = "https://github.com/shazow/urllib3" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=c2823cb995439c984fd62a973d79815c" + +SRC_URI[sha256sum] = "c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8" + +inherit pypi setuptools3 + +RDEPENDS:${PN} += "\ + ${PYTHON_PN}-certifi \ + ${PYTHON_PN}-cryptography \ + ${PYTHON_PN}-email \ + ${PYTHON_PN}-idna \ + ${PYTHON_PN}-netclient \ + ${PYTHON_PN}-pyopenssl \ + ${PYTHON_PN}-threading \ + ${PYTHON_PN}-logging \ +" + +CVE_PRODUCT = "urllib3" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-zipp_3.10.0.bb b/poky/meta/recipes-devtools/python/python3-zipp_3.10.0.bb deleted file mode 100644 index 56d8e706c8..0000000000 --- a/poky/meta/recipes-devtools/python/python3-zipp_3.10.0.bb +++ /dev/null @@ -1,18 +0,0 @@ -DESCRIPTION = "Backport of pathlib-compatible object wrapper for zip files" -HOMEPAGE = "https://github.com/jaraco/zipp" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=7a7126e068206290f3fe9f8d6c713ea6" - -SRC_URI[sha256sum] = "7a7262fd930bd3e36c50b9a64897aec3fafff3dfdeec9623ae22b40e93f99bb8" - -DEPENDS += "${PYTHON_PN}-setuptools-scm-native" - -inherit pypi python_setuptools_build_meta - -DEPENDS += "${PYTHON_PN}-toml-native" - -RDEPENDS:${PN} += "${PYTHON_PN}-compression \ - ${PYTHON_PN}-math \ - ${PYTHON_PN}-more-itertools" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3-zipp_3.11.0.bb b/poky/meta/recipes-devtools/python/python3-zipp_3.11.0.bb new file mode 100644 index 0000000000..70ebafc168 --- /dev/null +++ b/poky/meta/recipes-devtools/python/python3-zipp_3.11.0.bb @@ -0,0 +1,18 @@ +DESCRIPTION = "Backport of pathlib-compatible object wrapper for zip files" +HOMEPAGE = "https://github.com/jaraco/zipp" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=7a7126e068206290f3fe9f8d6c713ea6" + +SRC_URI[sha256sum] = "a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766" + +DEPENDS += "${PYTHON_PN}-setuptools-scm-native" + +inherit pypi python_setuptools_build_meta + +DEPENDS += "${PYTHON_PN}-toml-native" + +RDEPENDS:${PN} += "${PYTHON_PN}-compression \ + ${PYTHON_PN}-math \ + ${PYTHON_PN}-more-itertools" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch b/poky/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch index 921da8de7c..db08435004 100644 --- a/poky/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch +++ b/poky/meta/recipes-devtools/python/python3/0001-Avoid-shebang-overflow-on-python-config.py.patch @@ -1,7 +1,7 @@ -From f0c9dec63d452a7cd1e15ea653f4aced281f021c Mon Sep 17 00:00:00 2001 +From 78f482b91d94b44a02e02c4580166757119061ea Mon Sep 17 00:00:00 2001 From: Paulo Neves Date: Tue, 7 Jun 2022 16:16:41 +0200 -Subject: [PATCH 1/1] Avoid shebang overflow on python-config.py +Subject: [PATCH] Avoid shebang overflow on python-config.py The whole native path may be too big, leading to shebang overflow. Let's just use the env shebang. @@ -11,15 +11,16 @@ Denial reason: [1] Upstream-Status: Denied [distribution] [1] https://github.com/python/cpython/pull/93760#pullrequestreview-1005365737 + --- Makefile.pre.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.pre.in b/Makefile.pre.in -index f0aedb76cb58999427804255da56fa53284d7032..dd88e43114730f7681715777cc76dabb31113176 100644 +index 55c7c46..1f6500a 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1638,6 +1638,8 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh +@@ -2115,6 +2115,8 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh @ # Substitution happens here, as the completely-expanded BINDIR @ # is not available in configure sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py @@ -27,7 +28,4 @@ index f0aedb76cb58999427804255da56fa53284d7032..dd88e43114730f7681715777cc76dabb + sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' python-config.py @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config - @ # In OpenEmbedded, always use the python version of the script, the shell --- -2.25.1 - + @ # On Darwin, always use the python version of the script, the shell diff --git a/poky/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch b/poky/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch deleted file mode 100644 index d98f243cb1..0000000000 --- a/poky/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 2406432449784243b7590009d42bd0e871253b2e Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Tue, 29 Jan 2019 15:03:01 +0100 -Subject: [PATCH] Do not use the shell version of python-config that was - introduced in 3.4 - -Revert instead to the original python version: it has our tweaks and -outputs directories correctly. - -Upstream-Status: Inappropriate [oe-specific] -Signed-off-by: Alexander Kanavin - ---- - Makefile.pre.in | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -diff --git a/Makefile.pre.in b/Makefile.pre.in -index ee85f35..f0aedb7 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -1640,12 +1640,9 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh - sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py - @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} - LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config -- @ # On Darwin, always use the python version of the script, the shell -- @ # version doesn't use the compiler customizations that are provided -- @ # in python (_osx_support.py). -- @if test `uname -s` = Darwin; then \ -- cp python-config.py python-config; \ -- fi -+ @ # In OpenEmbedded, always use the python version of the script, the shell -+ @ # version is broken in multiple ways, and doesn't return correct directories -+ cp python-config.py python-config - - - # Install the include files diff --git a/poky/meta/recipes-devtools/python/python3/0001-Don-t-search-system-for-headers-libraries.patch b/poky/meta/recipes-devtools/python/python3/0001-Don-t-search-system-for-headers-libraries.patch index d6d9e451ff..bd696ade92 100644 --- a/poky/meta/recipes-devtools/python/python3/0001-Don-t-search-system-for-headers-libraries.patch +++ b/poky/meta/recipes-devtools/python/python3/0001-Don-t-search-system-for-headers-libraries.patch @@ -1,4 +1,4 @@ -From 910a905aaeb6edb6b042ef65b3e2b73faada80aa Mon Sep 17 00:00:00 2001 +From 32aba1dfba1e27103e7367bbb9e4bef0e31aeac5 Mon Sep 17 00:00:00 2001 From: Jeremy Puhlman Date: Wed, 4 Mar 2020 00:06:42 +0000 Subject: [PATCH] Don't search system for headers/libraries diff --git a/poky/meta/recipes-devtools/python/python3/0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch b/poky/meta/recipes-devtools/python/python3/0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch index 2f519e4917..dc06baf504 100644 --- a/poky/meta/recipes-devtools/python/python3/0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch +++ b/poky/meta/recipes-devtools/python/python3/0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch @@ -1,4 +1,4 @@ -From 05d676ddf675d9c8229b723e64717aa485d6809e Mon Sep 17 00:00:00 2001 +From a73020a9c388b4882c384087882a77ab2c7b3729 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Fri, 10 Sep 2021 12:28:31 +0200 Subject: [PATCH] Lib/sysconfig.py: use prefix value from build configuration diff --git a/poky/meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch b/poky/meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch deleted file mode 100644 index f303eb35dc..0000000000 --- a/poky/meta/recipes-devtools/python/python3/0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch +++ /dev/null @@ -1,227 +0,0 @@ -From d2abe7328cea770425405aa0da2f4c2dac89fcad Mon Sep 17 00:00:00 2001 -From: Matthias Schoepfer -Date: Fri, 31 May 2019 15:34:34 +0200 -Subject: [PATCH] bpo-36852: proper detection of mips architecture for soft - - float - -When (cross) compiling for softfloat mips, __mips_hard_float will not be -defined and detection of OS triplet in configure.ac / configure will fail. - -This also has to do with the custom detection of the build triplet. Trying -to do this in a more autoconf/autotools manner. - -Upstream-Status: Submitted [https://github.com/python/cpython/pull/13196] -Signed-off-by: Matthias Schoepfer - ---- - configure.ac | 196 ++++++--------------------------------------------- - 1 file changed, 21 insertions(+), 175 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 358b6ea..085fc0b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -907,181 +907,27 @@ then - fi - - --AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) --cat > conftest.c <=6) && defined(_MIPSEL) --# if _MIPS_SIM == _ABIO32 -- mipsisa32r6el-linux-gnu --# elif _MIPS_SIM == _ABIN32 -- mipsisa64r6el-linux-gnuabin32 --# elif _MIPS_SIM == _ABI64 -- mipsisa64r6el-linux-gnuabi64 --# else --# error unknown platform triplet --# endif --# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) --# if _MIPS_SIM == _ABIO32 -- mipsisa32r6-linux-gnu --# elif _MIPS_SIM == _ABIN32 -- mipsisa64r6-linux-gnuabin32 --# elif _MIPS_SIM == _ABI64 -- mipsisa64r6-linux-gnuabi64 --# else --# error unknown platform triplet --# endif --# elif defined(__mips_hard_float) && defined(_MIPSEL) --# if _MIPS_SIM == _ABIO32 -- mipsel-linux-gnu --# elif _MIPS_SIM == _ABIN32 -- mips64el-linux-gnuabin32 --# elif _MIPS_SIM == _ABI64 -- mips64el-linux-gnuabi64 --# else --# error unknown platform triplet --# endif --# elif defined(__mips_hard_float) --# if _MIPS_SIM == _ABIO32 -- mips-linux-gnu --# elif _MIPS_SIM == _ABIN32 -- mips64-linux-gnuabin32 --# elif _MIPS_SIM == _ABI64 -- mips64-linux-gnuabi64 --# else --# error unknown platform triplet --# endif --# elif defined(__or1k__) -- or1k-linux-gnu --# elif defined(__powerpc__) && defined(__SPE__) -- powerpc-linux-gnuspe --# elif defined(__powerpc64__) --# if defined(__LITTLE_ENDIAN__) -- powerpc64le-linux-gnu --# else -- powerpc64-linux-gnu --# endif --# elif defined(__powerpc__) -- powerpc-linux-gnu --# elif defined(__s390x__) -- s390x-linux-gnu --# elif defined(__s390__) -- s390-linux-gnu --# elif defined(__sh__) && defined(__LITTLE_ENDIAN__) -- sh4-linux-gnu --# elif defined(__sparc__) && defined(__arch64__) -- sparc64-linux-gnu --# elif defined(__sparc__) -- sparc-linux-gnu --# elif defined(__riscv) --# if __riscv_xlen == 32 -- riscv32-linux-gnu --# elif __riscv_xlen == 64 -- riscv64-linux-gnu --# else --# error unknown platform triplet --# endif --# else --# error unknown platform triplet --# endif --#elif defined(__FreeBSD_kernel__) --# if defined(__LP64__) -- x86_64-kfreebsd-gnu --# elif defined(__i386__) -- i386-kfreebsd-gnu --# else --# error unknown platform triplet --# endif --#elif defined(__gnu_hurd__) -- i386-gnu --#elif defined(__APPLE__) -- darwin --#elif defined(__VXWORKS__) -- vxworks --#elif defined(__wasm32__) --# if defined(__EMSCRIPTEN__) -- wasm32-emscripten --# elif defined(__wasi__) -- wasm32-wasi --# else --# error unknown wasm32 platform --# endif --#elif defined(__wasm64__) --# if defined(__EMSCRIPTEN) -- wasm64-emscripten --# elif defined(__wasi__) -- wasm64-wasi --# else --# error unknown wasm64 platform --# endif --#else --# error unknown platform triplet --#endif -- --EOF -- --if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then -- PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` -- case "$build_os" in -- linux-musl*) -- PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'` -- ;; -- esac -- AC_MSG_RESULT([$PLATFORM_TRIPLET]) --else -- AC_MSG_RESULT([none]) --fi --rm -f conftest.c conftest.out -+AC_CANONICAL_TARGET -+## Not using $target to filter out vendor -+## Need to handle macos, vxworks and hurd special (?) :-/ -+case ${target_os} in -+ darwin*) -+ PLATFORM_TRIPLET=darwin -+ ;; -+ hurd*) -+ PLATFORM_TRIPLET=i386-gnu -+ ;; -+ vxworks*) -+ PLATFORM_TRIPLET=vxworks -+ ;; -+ *) -+ if test "${target_cpu}" != "i686"; then -+ PLATFORM_TRIPLET=${target_cpu}-${target_os} -+ else -+ PLATFORM_TRIPLET=i386-${target_os} -+ fi -+ ;; -+esac - - AC_MSG_CHECKING([for multiarch]) - AS_CASE([$ac_sys_system], diff --git a/poky/meta/recipes-devtools/python/python3/0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch b/poky/meta/recipes-devtools/python/python3/0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch deleted file mode 100644 index 45a37ed1a9..0000000000 --- a/poky/meta/recipes-devtools/python/python3/0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 9c6b9f46179c8f9c9391767e2b02f268a1ee7a9c Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Thu, 31 Jan 2019 16:46:30 +0100 -Subject: [PATCH] distutils/sysconfig: append - STAGING_LIBDIR/python-sysconfigdata to sys.path - -So that target configuration can be used when running native python - -Upstream-Status: Inappropriate [oe-core specific] -Signed-off-by: Alexander Kanavin - ---- - Lib/sysconfig.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py -index ff399e2..95844cf 100644 ---- a/Lib/sysconfig.py -+++ b/Lib/sysconfig.py -@@ -528,6 +528,8 @@ def _init_posix(vars): - """Initialize the module as appropriate for POSIX systems.""" - # _sysconfigdata is generated at build time, see _generate_posix_vars() - name = _get_sysconfigdata_name() -+ if 'STAGING_LIBDIR' in os.environ: -+ sys.path.append(os.environ['STAGING_LIBDIR']+'/python-sysconfigdata') - _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) - build_time_vars = _temp.build_time_vars - vars.update(build_time_vars) diff --git a/poky/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch b/poky/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch index 4d589dd759..ef8edca51f 100644 --- a/poky/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch +++ b/poky/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch @@ -1,4 +1,4 @@ -From 175ed10e0a59a5395546ef88702f23d100b909f9 Mon Sep 17 00:00:00 2001 +From 4ba40ee527f844a804be571e52d9dc5447ae4cdd Mon Sep 17 00:00:00 2001 From: Changqing Li Date: Mon, 22 Oct 2018 15:19:51 +0800 Subject: [PATCH] python3: use cc_basename to replace CC for checking compiler @@ -27,7 +27,7 @@ Signed-off-by: Changqing Li 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac -index 77fb609..358b6ea 100644 +index 90008bc..bf56195 100644 --- a/configure.ac +++ b/configure.ac @@ -134,6 +134,7 @@ AC_CONFIG_HEADERS([pyconfig.h]) @@ -38,7 +38,7 @@ index 77fb609..358b6ea 100644 AS_VAR_IF([cross_compiling], [maybe], [AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])] -@@ -877,7 +878,7 @@ AC_MSG_RESULT($with_cxx_main) +@@ -887,7 +888,7 @@ AC_MSG_RESULT($with_cxx_main) preset_cxx="$CXX" if test -z "$CXX" then @@ -47,7 +47,7 @@ index 77fb609..358b6ea 100644 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;; cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;; clang|*/clang) AC_PATH_TOOL(CXX, [clang++], [clang++], [notfound]) ;; -@@ -1290,7 +1291,7 @@ rmdir CaseSensitiveTestDir +@@ -1300,7 +1301,7 @@ rmdir CaseSensitiveTestDir case $ac_sys_system in hp*|HP*) @@ -56,16 +56,16 @@ index 77fb609..358b6ea 100644 cc|*/cc) CC="$CC -Ae";; esac;; esac -@@ -1798,7 +1799,7 @@ esac +@@ -1834,7 +1835,7 @@ esac ], [AC_MSG_RESULT(no)]) if test "$Py_LTO" = 'true' ; then - case $CC in + case $cc_basename in *clang*) - dnl flag to disable lto during linking LDFLAGS_NOLTO="-fno-lto" -@@ -1917,7 +1918,7 @@ then + dnl Clang linker requires -flto in order to link objects with LTO information. +@@ -1955,7 +1956,7 @@ then fi fi LLVM_PROF_ERR=no @@ -74,7 +74,7 @@ index 77fb609..358b6ea 100644 *clang*) # Any changes made here should be reflected in the GCC+Darwin case below PGO_PROF_GEN_FLAG="-fprofile-instr-generate" -@@ -1978,7 +1979,7 @@ esac +@@ -2016,7 +2017,7 @@ esac # compiler and platform. BASECFLAGS tweaks need to be made even if the # user set OPT. @@ -83,7 +83,7 @@ index 77fb609..358b6ea 100644 *clang*) cc_is_clang=1 ;; -@@ -2197,7 +2198,7 @@ yes) +@@ -2235,7 +2236,7 @@ yes) # ICC doesn't recognize the option, but only emits a warning ## XXX does it emit an unused result warning and can it be disabled? @@ -92,7 +92,7 @@ index 77fb609..358b6ea 100644 [*icc*], [ac_cv_disable_unused_result_warning=no] [PY_CHECK_CC_WARNING([disable], [unused-result])]) AS_VAR_IF([ac_cv_disable_unused_result_warning], [yes], -@@ -2439,7 +2440,7 @@ yes) +@@ -2477,7 +2478,7 @@ yes) ;; esac @@ -101,7 +101,7 @@ index 77fb609..358b6ea 100644 *icc*) # ICC needs -fp-model strict or floats behave badly CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict" -@@ -3281,7 +3282,7 @@ then +@@ -3319,7 +3320,7 @@ then then LINKFORSHARED="-Wl,--export-dynamic" fi;; @@ -110,7 +110,7 @@ index 77fb609..358b6ea 100644 *gcc*) if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null then -@@ -6370,7 +6371,7 @@ if test "$ac_cv_gcc_asm_for_x87" = yes; then +@@ -6410,7 +6411,7 @@ if test "$ac_cv_gcc_asm_for_x87" = yes; then # Some versions of gcc miscompile inline asm: # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491 # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html diff --git a/poky/meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch b/poky/meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch index 7b497b83ca..1879024e16 100644 --- a/poky/meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch +++ b/poky/meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch @@ -1,4 +1,4 @@ -From 2918d431cb5607933755fc80a6220135dd7fcb1d Mon Sep 17 00:00:00 2001 +From 3bdf292be303e239e78ed39dd8106fbd5f7ee645 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 14 May 2013 15:00:26 -0700 Subject: [PATCH] python3: Add target and native recipes diff --git a/poky/meta/recipes-devtools/python/python3/python-config.patch b/poky/meta/recipes-devtools/python/python3/python-config.patch deleted file mode 100644 index 4da399e46e..0000000000 --- a/poky/meta/recipes-devtools/python/python3/python-config.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 8632f25ac4e2c53a3c2c8a1b4fc97fc86e8aad5a Mon Sep 17 00:00:00 2001 -From: Tyler Hall -Date: Sun, 4 May 2014 20:06:43 -0400 -Subject: [PATCH] python-config: Revert to using distutils.sysconfig - -The newer sysconfig module shares some code with distutils.sysconfig, but the same modifications as in - -12-distutils-prefix-is-inside-staging-area.patch makes distutils.sysconfig - -affect the native runtime as well as cross building. Use the old, patched -implementation which returns paths in the staging directory and for the target, -as appropriate. - -Upstream-Status: Inappropriate [Embedded Specific] - -Signed-off-by: Tyler Hall - ---- - Misc/python-config.in | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/Misc/python-config.in b/Misc/python-config.in -index ebd99da..0492e08 100644 ---- a/Misc/python-config.in -+++ b/Misc/python-config.in -@@ -6,7 +6,9 @@ - import getopt - import os - import sys --import sysconfig -+import warnings -+warnings.filterwarnings("ignore", category=DeprecationWarning) -+from distutils import sysconfig - - valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', - 'ldflags', 'extension-suffix', 'help', 'abiflags', 'configdir', -@@ -35,14 +37,14 @@ if '--help' in opt_flags: - - for opt in opt_flags: - if opt == '--prefix': -- print(getvar('prefix')) -+ print(sysconfig.PREFIX) - - elif opt == '--exec-prefix': -- print(getvar('exec_prefix')) -+ print(sysconfig.EXEC_PREFIX) - - elif opt in ('--includes', '--cflags'): -- flags = ['-I' + sysconfig.get_path('include'), -- '-I' + sysconfig.get_path('platinclude')] -+ flags = ['-I' + sysconfig.get_python_inc(), -+ '-I' + sysconfig.get_python_inc(plat_specific=True)] - if opt == '--cflags': - flags.extend(getvar('CFLAGS').split()) - print(' '.join(flags)) diff --git a/poky/meta/recipes-devtools/python/python3/python3-manifest.json b/poky/meta/recipes-devtools/python/python3/python3-manifest.json index 64203cf0fc..58e6f28a69 100644 --- a/poky/meta/recipes-devtools/python/python3/python3-manifest.json +++ b/poky/meta/recipes-devtools/python/python3/python3-manifest.json @@ -1173,6 +1173,7 @@ "core" ], "files": [ + "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_tkinter.*.so", "${libdir}/python${PYTHON_MAJMIN}/tkinter" ], "cached": [] diff --git a/poky/meta/recipes-devtools/python/python3_3.11.0.bb b/poky/meta/recipes-devtools/python/python3_3.11.0.bb deleted file mode 100644 index 92a1f69320..0000000000 --- a/poky/meta/recipes-devtools/python/python3_3.11.0.bb +++ /dev/null @@ -1,430 +0,0 @@ -SUMMARY = "The Python Programming Language" -HOMEPAGE = "http://www.python.org" -DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively." -LICENSE = "PSF-2.0" -SECTION = "devel/python" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=4b8801e752a2c70ac41a5f9aa243f766" - -SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ - file://run-ptest \ - file://create_manifest3.py \ - file://get_module_deps3.py \ - file://python3-manifest.json \ - file://check_build_completeness.py \ - file://reformat_sysconfig.py \ - file://cgi_py.patch \ - file://0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \ - file://0001-Do-not-use-the-shell-version-of-python-config-that-w.patch \ - file://python-config.patch \ - file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \ - file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \ - file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \ - file://crosspythonpath.patch \ - file://0001-test_locale.py-correct-the-test-output-format.patch \ - file://0017-setup.py-do-not-report-missing-dependencies-for-disa.patch \ - file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \ - file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ - file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \ - file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \ - file://makerace.patch \ - file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \ - file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \ - file://0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch \ - file://deterministic_imports.patch \ - file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ - " - -SRC_URI:append:class-native = " \ - file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \ - file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \ - file://12-distutils-prefix-is-inside-staging-area.patch \ - file://0001-Don-t-search-system-for-headers-libraries.patch \ - " -SRC_URI[sha256sum] = "a57dc82d77358617ba65b9841cee1e3b441f386c3789ddc0676eca077f2951c3" - -# exclude pre-releases for both python 2.x and 3.x -UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P\d+(\.\d+)+).tar" -UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/" - -CVE_PRODUCT = "python" - -# Upstream consider this expected behaviour -CVE_CHECK_IGNORE += "CVE-2007-4559" -# This is not exploitable when glibc has CVE-2016-10739 fixed. -CVE_CHECK_IGNORE += "CVE-2019-18348" -# These are specific to Microsoft Windows -CVE_CHECK_IGNORE += "CVE-2020-15523 CVE-2022-26488" -# The mailcap module is insecure by design, so this can't be fixed in a meaningful way. -# The module will be removed in the future and flaws documented. -CVE_CHECK_IGNORE += "CVE-2015-20107" - -PYTHON_MAJMIN = "3.11" - -S = "${WORKDIR}/Python-${PV}" - -BBCLASSEXTEND = "native nativesdk" - -inherit autotools pkgconfig qemu ptest multilib_header update-alternatives - -MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" - -ALTERNATIVE:${PN}-dev = "python3-config" -ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config" -ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}" - - -DEPENDS = "bzip2-replacement-native libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux-libuuid libtirpc libnsl2 autoconf-archive-native ncurses" -DEPENDS:append:class-target = " python3-native" -DEPENDS:append:class-nativesdk = " python3-native" - -EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib}" -EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}" -EXTRA_OECONF:append:class-target = " --with-build-python=nativepython3" -EXTRA_OECONF:append:class-nativesdk = " --with-build-python=nativepython3" - -export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/" - -EXTRANATIVEPATH += "python3-native" - -# LTO will be enabled via packageconfig depending upong distro features -LTO:class-target = "" - -CACHED_CONFIGUREVARS = " \ - ac_cv_file__dev_ptmx=yes \ - ac_cv_file__dev_ptc=no \ - ac_cv_working_tzset=yes \ -" - -# PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407 -PACKAGECONFIG:class-target ??= "readline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}" -PACKAGECONFIG:class-native ??= "readline gdbm" -PACKAGECONFIG:class-nativesdk ??= "readline gdbm" -PACKAGECONFIG[readline] = ",,readline" -PACKAGECONFIG[editline] = "--with-readline=editline,,libedit,,,readline" -# Use profile guided optimisation by running PyBench inside qemu-user -PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native" -PACKAGECONFIG[tk] = ",,tk" -PACKAGECONFIG[gdbm] = ",,gdbm" -PACKAGECONFIG[lto] = "--with-lto,," - -do_configure:prepend () { - mkdir -p ${B}/Modules - cat > ${B}/Modules/Setup.local << EOF -*disabled* -${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)} -${@bb.utils.contains('PACKAGECONFIG', 'readline', '', 'readline', d)} -EOF -} - -CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid" - -EXTRA_OEMAKE = '\ - STAGING_LIBDIR=${STAGING_LIBDIR} \ - STAGING_INCDIR=${STAGING_INCDIR} \ - LIB=${baselib} \ -' - -do_compile:prepend:class-target() { - if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then - qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" - cat >pgo-wrapper < ${B}/Modules/Setup.local << EOF +*disabled* +${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)} +${@bb.utils.contains('PACKAGECONFIG', 'readline', '', 'readline', d)} +EOF +} + +CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid" + +EXTRA_OEMAKE = '\ + STAGING_LIBDIR=${STAGING_LIBDIR} \ + STAGING_INCDIR=${STAGING_INCDIR} \ + LIB=${baselib} \ +' + +do_compile:prepend:class-target() { + if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then + qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" + cat >pgo-wrapper < #include +#include void try_program(char const* path, char** args) { if (access(path, X_OK) == 0) { @@ -18,22 +19,14 @@ void try_program(char const* path, char** args) { int main(int argc, char** argv) { char* var; - /* Copy arguments so that they are a NULL terminated list, skipping argv[0] - * since it is this program name */ - char** args = malloc(argc * sizeof(char*)); - for (int i = 0; i < argc - 1; i++) { - args[i] = argv[i + 1]; - } - args[argc - 1] = NULL; - var = getenv("QEMU_BRIDGE_HELPER"); if (var && var[0] != '\0') { - execvp(var, args); + execvp(var, argv); return 1; } - try_program("/usr/libexec/qemu-bridge-helper", args); - try_program("/usr/lib/qemu/qemu-bridge-helper", args); + try_program("/usr/libexec/qemu-bridge-helper", argv); + try_program("/usr/lib/qemu/qemu-bridge-helper", argv); fprintf(stderr, "No bridge helper found\n"); return 1; diff --git a/poky/meta/recipes-devtools/qemu/qemu-native_7.1.0.bb b/poky/meta/recipes-devtools/qemu/qemu-native_7.1.0.bb deleted file mode 100644 index a94dc0b61e..0000000000 --- a/poky/meta/recipes-devtools/qemu/qemu-native_7.1.0.bb +++ /dev/null @@ -1,9 +0,0 @@ -BPN = "qemu" - -DEPENDS = "glib-2.0-native zlib-native ninja-native meson-native" - -require qemu-native.inc - -EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" - -PACKAGECONFIG ??= "pie" diff --git a/poky/meta/recipes-devtools/qemu/qemu-native_7.2.0.bb b/poky/meta/recipes-devtools/qemu/qemu-native_7.2.0.bb new file mode 100644 index 0000000000..a94dc0b61e --- /dev/null +++ b/poky/meta/recipes-devtools/qemu/qemu-native_7.2.0.bb @@ -0,0 +1,9 @@ +BPN = "qemu" + +DEPENDS = "glib-2.0-native zlib-native ninja-native meson-native" + +require qemu-native.inc + +EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" + +PACKAGECONFIG ??= "pie" diff --git a/poky/meta/recipes-devtools/qemu/qemu-system-native_7.1.0.bb b/poky/meta/recipes-devtools/qemu/qemu-system-native_7.1.0.bb deleted file mode 100644 index 04c7c2a6ac..0000000000 --- a/poky/meta/recipes-devtools/qemu/qemu-system-native_7.1.0.bb +++ /dev/null @@ -1,33 +0,0 @@ -BPN = "qemu" - -inherit python3-dir - -require qemu-native.inc - -# As some of the files installed by qemu-native and qemu-system-native -# are the same, we depend on qemu-native to get the full installation set -# and avoid file clashes -DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native meson-native ninja-native" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" - -PACKAGECONFIG ??= "fdt alsa kvm pie slirp \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ -" - -# Handle distros such as CentOS 5 32-bit that do not have kvm support -PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" - -do_install:append() { - install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu - - # The following is also installed by qemu-native - rm -f ${D}${datadir}/qemu/trace-events-all - rm -rf ${D}${datadir}/qemu/keymaps - rm -rf ${D}${datadir}/icons/ - rm -rf ${D}${includedir}/qemu-plugin.h - - # Install qmp.py to be used with testimage - install -d ${D}${libdir}/qemu-python/qmp/ - install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ -} diff --git a/poky/meta/recipes-devtools/qemu/qemu-system-native_7.2.0.bb b/poky/meta/recipes-devtools/qemu/qemu-system-native_7.2.0.bb new file mode 100644 index 0000000000..04c7c2a6ac --- /dev/null +++ b/poky/meta/recipes-devtools/qemu/qemu-system-native_7.2.0.bb @@ -0,0 +1,33 @@ +BPN = "qemu" + +inherit python3-dir + +require qemu-native.inc + +# As some of the files installed by qemu-native and qemu-system-native +# are the same, we depend on qemu-native to get the full installation set +# and avoid file clashes +DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native meson-native ninja-native" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" + +PACKAGECONFIG ??= "fdt alsa kvm pie slirp \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ +" + +# Handle distros such as CentOS 5 32-bit that do not have kvm support +PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" + +do_install:append() { + install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu + + # The following is also installed by qemu-native + rm -f ${D}${datadir}/qemu/trace-events-all + rm -rf ${D}${datadir}/qemu/keymaps + rm -rf ${D}${datadir}/icons/ + rm -rf ${D}${includedir}/qemu-plugin.h + + # Install qmp.py to be used with testimage + install -d ${D}${libdir}/qemu-python/qmp/ + install -D ${S}/python/qemu/qmp/* ${D}${libdir}/qemu-python/qmp/ +} diff --git a/poky/meta/recipes-devtools/qemu/qemu.inc b/poky/meta/recipes-devtools/qemu/qemu.inc index 55aced9f9a..80f6edd2b9 100644 --- a/poky/meta/recipes-devtools/qemu/qemu.inc +++ b/poky/meta/recipes-devtools/qemu/qemu.inc @@ -27,13 +27,13 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \ file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ - file://0001-net-tulip-Restrict-DMA-engine-to-memories.patch \ - file://arm-cpreg-fix.patch \ - file://CVE-2022-3165.patch \ + file://0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch \ + file://0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch \ + file://0001-configure-Fix-check-tcg-not-executing-any-tests.patch \ " UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar" -SRC_URI[sha256sum] = "a0634e536bded57cf38ec8a751adb124b89c776fe0846f21ab6c6728f1cbbbe6" +SRC_URI[sha256sum] = "5b49ce2687744dad494ae90a898c52204a3406e84d072482a1e1be854eeb2157" SRC_URI:append:class-target = " file://cross.patch" SRC_URI:append:class-nativesdk = " file://cross.patch" @@ -70,16 +70,19 @@ do_install_ptest() { sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh # Strip the paths from the QEMU variable, we can use PATH - sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" ${D}${PTEST_PATH}/tests/tcg/*.mak + makfiles=$(find ${D}${PTEST_PATH} -name "*.mak") + sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" $makfiles # Strip compiler flags as they break reproducibility sed -i -e "s,^CC=.*,CC=gcc," \ -e "s,^CCAS=.*,CCAS=gcc," \ - -e "s,^LD=.*,LD=ld," ${D}${PTEST_PATH}/tests/tcg/*.mak + -e "s,^LD=.*,LD=ld," $makfiles # Update SRC_PATH variable to the right place on target - sed -i -e "s#^SRC_PATH=.*#SRC_PATH=${PTEST_PATH}#g" ${D}${PTEST_PATH}/tests/tcg/*.mak + sed -i -e "s#^SRC_PATH=.*#SRC_PATH=${PTEST_PATH}#g" $makfiles + # https://gitlab.com/qemu-project/qemu/-/issues/1403 + rm ${D}${PTEST_PATH}/tests/unit/test-io-channel-command } # QEMU_TARGETS is overridable variable @@ -148,6 +151,7 @@ PACKAGECONFIG:remove:darwin = "kvm virglrenderer epoxy gtk+" PACKAGECONFIG:remove:mingw32 = "kvm virglrenderer epoxy gtk+" PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" +PACKAGECONFIG[png] = "--enable-png,--disable-png,libpng" PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr," PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," PACKAGECONFIG[uring] = "--enable-linux-io-uring,--disable-linux-io-uring,liburing" @@ -197,7 +201,7 @@ PACKAGECONFIG[bpf] = "--enable-bpf,--disable-bpf,libbpf" PACKAGECONFIG[capstone] = "--enable-capstone,--disable-capstone" PACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma" PACKAGECONFIG[vde] = "--enable-vde,--disable-vde" -PACKAGECONFIG[slirp] = "--enable-slirp=internal,--disable-slirp" +PACKAGECONFIG[slirp] = "--enable-slirp,--disable-slirp,libslirp" PACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi" PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack," diff --git a/poky/meta/recipes-devtools/qemu/qemu/0001-configure-Fix-check-tcg-not-executing-any-tests.patch b/poky/meta/recipes-devtools/qemu/qemu/0001-configure-Fix-check-tcg-not-executing-any-tests.patch new file mode 100644 index 0000000000..66ae4deae1 --- /dev/null +++ b/poky/meta/recipes-devtools/qemu/qemu/0001-configure-Fix-check-tcg-not-executing-any-tests.patch @@ -0,0 +1,56 @@ +From f295491361ed7fbe729ef6f029d83f68b8e2bee3 Mon Sep 17 00:00:00 2001 +From: Mukilan Thiyagarajan +Date: Wed, 21 Dec 2022 09:04:06 +0000 +Subject: [PATCH] configure: Fix check-tcg not executing any tests +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +After configuring with --target-list=hexagon-linux-user +running `make check-tcg` just prints the following: + +``` +make: Nothing to be done for 'check-tcg' +``` + +In the probe_target_compiler function, the 'break' +command is used incorrectly. There are no lexically +enclosing loops associated with that break command which +is an unspecfied behaviour in the POSIX standard. + +The dash shell implementation aborts the currently executing +loop, in this case, causing the rest of the logic for the loop +in line 2490 to be skipped, which means no Makefiles are +generated for the tcg target tests. + +Fixes: c3b570b5a9a24d25 (configure: don't enable +cross compilers unless in target_list) + +Signed-off-by: Mukilan Thiyagarajan +Reviewed-by: Richard Henderson +Link: https://patchew.org/QEMU/20221207082309.9966-1-quic._5Fmthiyaga@quicinc.com/ +Message-Id: <20221207082309.9966-1-quic_mthiyaga@quicinc.com> +Signed-off-by: Alex Bennée +Message-Id: <20221221090411.1995037-2-alex.bennee@linaro.org> + +Upstream-Status: Backport [https://github.com/qemu/qemu/commit/73acb87be536d23e42db73a306104d8fd316ff20] +Signed-off-by: Alexander Kanavin +--- + configure | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/configure b/configure +index 0c1db72b8..6b4589273 100755 +--- a/configure ++++ b/configure +@@ -1881,9 +1881,7 @@ probe_target_compiler() { + # We shall skip configuring the target compiler if the user didn't + # bother enabling an appropriate guest. This avoids building + # extraneous firmware images and tests. +- if test "${target_list#*$1}" != "$1"; then +- break; +- else ++ if test "${target_list#*$1}" = "$1"; then + return 1 + fi + diff --git a/poky/meta/recipes-devtools/qemu/qemu/0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch b/poky/meta/recipes-devtools/qemu/qemu/0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch new file mode 100644 index 0000000000..1838c88f0e --- /dev/null +++ b/poky/meta/recipes-devtools/qemu/qemu/0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch @@ -0,0 +1,37 @@ +From 38f5c88bf296dbbc04dcd57f36d64695055a2d3f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 16 Dec 2022 20:19:49 -0800 +Subject: [PATCH 1/2] contrib/vhost-user-blk: Replace lseek64 with lseek + +64bit off_t is already in use since build uses _FILE_OFFSET_BITS=64 +already. Using lseek/off_t also makes it work with latest must without +using _LARGEFILE64_SOURCE macro. This macro is implied with _GNU_SOURCE +when using glibc but not with musl. + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2022-12/msg02840.html] +Signed-off-by: Khem Raj +Cc: Michael S. Tsirkin +CC: Raphael Norwitz +--- + contrib/vhost-user-blk/vhost-user-blk.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c +index aa99877fcd..7941694e53 100644 +--- a/contrib/vhost-user-blk/vhost-user-blk.c ++++ b/contrib/vhost-user-blk/vhost-user-blk.c +@@ -532,9 +532,9 @@ vub_get_blocksize(int fd) + static void + vub_initialize_config(int fd, struct virtio_blk_config *config) + { +- off64_t capacity; ++ off_t capacity; + +- capacity = lseek64(fd, 0, SEEK_END); ++ capacity = lseek(fd, 0, SEEK_END); + config->capacity = capacity >> 9; + config->blk_size = vub_get_blocksize(fd); + config->size_max = 65536; +-- +2.39.0 + diff --git a/poky/meta/recipes-devtools/qemu/qemu/0001-net-tulip-Restrict-DMA-engine-to-memories.patch b/poky/meta/recipes-devtools/qemu/qemu/0001-net-tulip-Restrict-DMA-engine-to-memories.patch deleted file mode 100644 index 6c85a77ba7..0000000000 --- a/poky/meta/recipes-devtools/qemu/qemu/0001-net-tulip-Restrict-DMA-engine-to-memories.patch +++ /dev/null @@ -1,64 +0,0 @@ -CVE: CVE-2022-2962 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 5c5c50b0a73d78ffe18336c9996fef5eae9bbbb0 Mon Sep 17 00:00:00 2001 -From: Zheyu Ma -Date: Sun, 21 Aug 2022 20:43:43 +0800 -Subject: [PATCH] net: tulip: Restrict DMA engine to memories - -The DMA engine is started by I/O access and then itself accesses the -I/O registers, triggering a reentrancy bug. - -The following log can reveal it: -==5637==ERROR: AddressSanitizer: stack-overflow - #0 0x5595435f6078 in tulip_xmit_list_update qemu/hw/net/tulip.c:673 - #1 0x5595435f204a in tulip_write qemu/hw/net/tulip.c:805:13 - #2 0x559544637f86 in memory_region_write_accessor qemu/softmmu/memory.c:492:5 - #3 0x5595446379fa in access_with_adjusted_size qemu/softmmu/memory.c:554:18 - #4 0x5595446372fa in memory_region_dispatch_write qemu/softmmu/memory.c - #5 0x55954468b74c in flatview_write_continue qemu/softmmu/physmem.c:2825:23 - #6 0x559544683662 in flatview_write qemu/softmmu/physmem.c:2867:12 - #7 0x5595446833f3 in address_space_write qemu/softmmu/physmem.c:2963:18 - #8 0x5595435fb082 in dma_memory_rw_relaxed qemu/include/sysemu/dma.h:87:12 - #9 0x5595435fb082 in dma_memory_rw qemu/include/sysemu/dma.h:130:12 - #10 0x5595435fb082 in dma_memory_write qemu/include/sysemu/dma.h:171:12 - #11 0x5595435fb082 in stl_le_dma qemu/include/sysemu/dma.h:272:1 - #12 0x5595435fb082 in stl_le_pci_dma qemu/include/hw/pci/pci.h:910:1 - #13 0x5595435fb082 in tulip_desc_write qemu/hw/net/tulip.c:101:9 - #14 0x5595435f7e3d in tulip_xmit_list_update qemu/hw/net/tulip.c:706:9 - #15 0x5595435f204a in tulip_write qemu/hw/net/tulip.c:805:13 - -Fix this bug by restricting the DMA engine to memories regions. - -Signed-off-by: Zheyu Ma -Signed-off-by: Jason Wang ---- - hw/net/tulip.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/hw/net/tulip.c b/hw/net/tulip.c -index 097e905bec..b9e42c322a 100644 ---- a/hw/net/tulip.c -+++ b/hw/net/tulip.c -@@ -70,7 +70,7 @@ static const VMStateDescription vmstate_pci_tulip = { - static void tulip_desc_read(TULIPState *s, hwaddr p, - struct tulip_descriptor *desc) - { -- const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; -+ const MemTxAttrs attrs = { .memory = true }; - - if (s->csr[0] & CSR0_DBO) { - ldl_be_pci_dma(&s->dev, p, &desc->status, attrs); -@@ -88,7 +88,7 @@ static void tulip_desc_read(TULIPState *s, hwaddr p, - static void tulip_desc_write(TULIPState *s, hwaddr p, - struct tulip_descriptor *desc) - { -- const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; -+ const MemTxAttrs attrs = { .memory = true }; - - if (s->csr[0] & CSR0_DBO) { - stl_be_pci_dma(&s->dev, p, desc->status, attrs); --- -2.34.1 - diff --git a/poky/meta/recipes-devtools/qemu/qemu/0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch b/poky/meta/recipes-devtools/qemu/qemu/0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch new file mode 100644 index 0000000000..14b5338eb2 --- /dev/null +++ b/poky/meta/recipes-devtools/qemu/qemu/0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch @@ -0,0 +1,358 @@ +From 71f14902256e3c3529710b713e1ea43100bf4c40 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 17 Dec 2022 08:37:46 -0800 +Subject: [PATCH 2/2] linux-user: Replace use of lfs64 related functions and + macros + +Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions +anf macros behave same as their 64 suffixed counterparts. This also +helps in compiling with latest musl C library, where these macros and +functions are no more available under _GNU_SOURCE feature macro + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2022-12/msg02841.html] +Signed-off-by: Khem Raj +Cc: Laurent Vivier +--- + linux-user/syscall.c | 153 +++++++++++-------------------------------- + 1 file changed, 39 insertions(+), 114 deletions(-) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 1f8c10f8ef..30d83ed162 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -795,8 +795,8 @@ safe_syscall6(ssize_t, copy_file_range, int, infd, loff_t *, pinoff, + */ + #define safe_ioctl(...) safe_syscall(__NR_ioctl, __VA_ARGS__) + /* Similarly for fcntl. Note that callers must always: +- * pass the F_GETLK64 etc constants rather than the unsuffixed F_GETLK +- * use the flock64 struct rather than unsuffixed flock ++ * pass the F_GETLK etc constants rather than the unsuffixed F_GETLK ++ * use the flock struct rather than unsuffixed flock + * This will then work and use a 64-bit offset for both 32-bit and 64-bit hosts. + */ + #ifdef __NR_fcntl64 +@@ -6797,13 +6797,13 @@ static int target_to_host_fcntl_cmd(int cmd) + ret = cmd; + break; + case TARGET_F_GETLK: +- ret = F_GETLK64; ++ ret = F_GETLK; + break; + case TARGET_F_SETLK: +- ret = F_SETLK64; ++ ret = F_SETLK; + break; + case TARGET_F_SETLKW: +- ret = F_SETLKW64; ++ ret = F_SETLKW; + break; + case TARGET_F_GETOWN: + ret = F_GETOWN; +@@ -6817,17 +6817,6 @@ static int target_to_host_fcntl_cmd(int cmd) + case TARGET_F_SETSIG: + ret = F_SETSIG; + break; +-#if TARGET_ABI_BITS == 32 +- case TARGET_F_GETLK64: +- ret = F_GETLK64; +- break; +- case TARGET_F_SETLK64: +- ret = F_SETLK64; +- break; +- case TARGET_F_SETLKW64: +- ret = F_SETLKW64; +- break; +-#endif + case TARGET_F_SETLEASE: + ret = F_SETLEASE; + break; +@@ -6879,8 +6868,8 @@ static int target_to_host_fcntl_cmd(int cmd) + * them to 5, 6 and 7 before making the syscall(). Since we make the + * syscall directly, adjust to what is supported by the kernel. + */ +- if (ret >= F_GETLK64 && ret <= F_SETLKW64) { +- ret -= F_GETLK64 - 5; ++ if (ret >= F_GETLK && ret <= F_SETLKW) { ++ ret -= F_GETLK - 5; + } + #endif + +@@ -6913,55 +6902,11 @@ static int host_to_target_flock(int type) + return type; + } + +-static inline abi_long copy_from_user_flock(struct flock64 *fl, +- abi_ulong target_flock_addr) +-{ +- struct target_flock *target_fl; +- int l_type; +- +- if (!lock_user_struct(VERIFY_READ, target_fl, target_flock_addr, 1)) { +- return -TARGET_EFAULT; +- } +- +- __get_user(l_type, &target_fl->l_type); +- l_type = target_to_host_flock(l_type); +- if (l_type < 0) { +- return l_type; +- } +- fl->l_type = l_type; +- __get_user(fl->l_whence, &target_fl->l_whence); +- __get_user(fl->l_start, &target_fl->l_start); +- __get_user(fl->l_len, &target_fl->l_len); +- __get_user(fl->l_pid, &target_fl->l_pid); +- unlock_user_struct(target_fl, target_flock_addr, 0); +- return 0; +-} +- +-static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, +- const struct flock64 *fl) +-{ +- struct target_flock *target_fl; +- short l_type; +- +- if (!lock_user_struct(VERIFY_WRITE, target_fl, target_flock_addr, 0)) { +- return -TARGET_EFAULT; +- } +- +- l_type = host_to_target_flock(fl->l_type); +- __put_user(l_type, &target_fl->l_type); +- __put_user(fl->l_whence, &target_fl->l_whence); +- __put_user(fl->l_start, &target_fl->l_start); +- __put_user(fl->l_len, &target_fl->l_len); +- __put_user(fl->l_pid, &target_fl->l_pid); +- unlock_user_struct(target_fl, target_flock_addr, 1); +- return 0; +-} +- +-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr); +-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl); ++typedef abi_long from_flock_fn(struct flock *fl, abi_ulong target_addr); ++typedef abi_long to_flock_fn(abi_ulong target_addr, const struct flock *fl); + + #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32 +-struct target_oabi_flock64 { ++struct target_oabi_flock { + abi_short l_type; + abi_short l_whence; + abi_llong l_start; +@@ -6969,10 +6914,10 @@ struct target_oabi_flock64 { + abi_int l_pid; + } QEMU_PACKED; + +-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, ++static inline abi_long copy_from_user_oabi_flock(struct flock *fl, + abi_ulong target_flock_addr) + { +- struct target_oabi_flock64 *target_fl; ++ struct target_oabi_flock *target_fl; + int l_type; + + if (!lock_user_struct(VERIFY_READ, target_fl, target_flock_addr, 1)) { +@@ -6993,10 +6938,10 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, + return 0; + } + +-static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++static inline abi_long copy_to_user_oabi_flock(abi_ulong target_flock_addr, ++ const struct flock *fl) + { +- struct target_oabi_flock64 *target_fl; ++ struct target_oabi_flock *target_fl; + short l_type; + + if (!lock_user_struct(VERIFY_WRITE, target_fl, target_flock_addr, 0)) { +@@ -7014,10 +6959,10 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, + } + #endif + +-static inline abi_long copy_from_user_flock64(struct flock64 *fl, ++static inline abi_long copy_from_user_flock(struct flock *fl, + abi_ulong target_flock_addr) + { +- struct target_flock64 *target_fl; ++ struct target_flock *target_fl; + int l_type; + + if (!lock_user_struct(VERIFY_READ, target_fl, target_flock_addr, 1)) { +@@ -7038,10 +6983,10 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl, + return 0; + } + +-static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, +- const struct flock64 *fl) ++static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, ++ const struct flock *fl) + { +- struct target_flock64 *target_fl; ++ struct target_flock *target_fl; + short l_type; + + if (!lock_user_struct(VERIFY_WRITE, target_fl, target_flock_addr, 0)) { +@@ -7060,7 +7005,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, + + static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) + { +- struct flock64 fl64; ++ struct flock fl64; + #ifdef F_GETOWN_EX + struct f_owner_ex fox; + struct target_f_owner_ex *target_fox; +@@ -7073,6 +7018,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) + + switch(cmd) { + case TARGET_F_GETLK: ++ case TARGET_F_OFD_GETLK: + ret = copy_from_user_flock(&fl64, arg); + if (ret) { + return ret; +@@ -7082,32 +7028,11 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) + ret = copy_to_user_flock(arg, &fl64); + } + break; +- + case TARGET_F_SETLK: + case TARGET_F_SETLKW: +- ret = copy_from_user_flock(&fl64, arg); +- if (ret) { +- return ret; +- } +- ret = get_errno(safe_fcntl(fd, host_cmd, &fl64)); +- break; +- +- case TARGET_F_GETLK64: +- case TARGET_F_OFD_GETLK: +- ret = copy_from_user_flock64(&fl64, arg); +- if (ret) { +- return ret; +- } +- ret = get_errno(safe_fcntl(fd, host_cmd, &fl64)); +- if (ret == 0) { +- ret = copy_to_user_flock64(arg, &fl64); +- } +- break; +- case TARGET_F_SETLK64: +- case TARGET_F_SETLKW64: + case TARGET_F_OFD_SETLK: + case TARGET_F_OFD_SETLKW: +- ret = copy_from_user_flock64(&fl64, arg); ++ ret = copy_from_user_flock(&fl64, arg); + if (ret) { + return ret; + } +@@ -7332,7 +7257,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1 + arg2 = arg3; + arg3 = arg4; + } +- return get_errno(truncate64(arg1, target_offset64(arg2, arg3))); ++ return get_errno(truncate(arg1, target_offset64(arg2, arg3))); + } + #endif + +@@ -7346,7 +7271,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1, + arg2 = arg3; + arg3 = arg4; + } +- return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3))); ++ return get_errno(ftruncate(arg1, target_offset64(arg2, arg3))); + } + #endif + +@@ -8452,7 +8377,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) + void *tdirp; + int hlen, hoff, toff; + int hreclen, treclen; +- off64_t prev_diroff = 0; ++ off_t prev_diroff = 0; + + hdirp = g_try_malloc(count); + if (!hdirp) { +@@ -8505,7 +8430,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) + * Return what we have, resetting the file pointer to the + * location of the first record not returned. + */ +- lseek64(dirfd, prev_diroff, SEEK_SET); ++ lseek(dirfd, prev_diroff, SEEK_SET); + break; + } + +@@ -8539,7 +8464,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) + void *tdirp; + int hlen, hoff, toff; + int hreclen, treclen; +- off64_t prev_diroff = 0; ++ off_t prev_diroff = 0; + + hdirp = g_try_malloc(count); + if (!hdirp) { +@@ -8581,7 +8506,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) + * Return what we have, resetting the file pointer to the + * location of the first record not returned. + */ +- lseek64(dirfd, prev_diroff, SEEK_SET); ++ lseek(dirfd, prev_diroff, SEEK_SET); + break; + } + +@@ -11114,7 +11039,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + return -TARGET_EFAULT; + } + } +- ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); ++ ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, ret); + return ret; + case TARGET_NR_pwrite64: +@@ -11131,7 +11056,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + return -TARGET_EFAULT; + } + } +- ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); ++ ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, 0); + return ret; + #endif +@@ -11954,14 +11879,14 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + case TARGET_NR_fcntl64: + { + int cmd; +- struct flock64 fl; +- from_flock64_fn *copyfrom = copy_from_user_flock64; +- to_flock64_fn *copyto = copy_to_user_flock64; ++ struct flock fl; ++ from_flock_fn *copyfrom = copy_from_user_flock; ++ to_flock_fn *copyto = copy_to_user_flock; + + #ifdef TARGET_ARM + if (!cpu_env->eabi) { +- copyfrom = copy_from_user_oabi_flock64; +- copyto = copy_to_user_oabi_flock64; ++ copyfrom = copy_from_user_oabi_flock; ++ copyto = copy_to_user_oabi_flock; + } + #endif + +@@ -11971,7 +11896,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + } + + switch(arg2) { +- case TARGET_F_GETLK64: ++ case TARGET_F_GETLK: + ret = copyfrom(&fl, arg3); + if (ret) { + break; +@@ -11982,8 +11907,8 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, + } + break; + +- case TARGET_F_SETLK64: +- case TARGET_F_SETLKW64: ++ case TARGET_F_SETLK: ++ case TARGET_F_SETLKW: + ret = copyfrom(&fl, arg3); + if (ret) { + break; +-- +2.39.0 + diff --git a/poky/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch b/poky/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch deleted file mode 100644 index 3b4a6694c2..0000000000 --- a/poky/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch +++ /dev/null @@ -1,59 +0,0 @@ -CVE: CVE-2022-3165 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From d307040b18bfcb1393b910f1bae753d5c12a4dc7 Mon Sep 17 00:00:00 2001 -From: Mauro Matteo Cascella -Date: Sun, 25 Sep 2022 22:45:11 +0200 -Subject: [PATCH] ui/vnc-clipboard: fix integer underflow in - vnc_client_cut_text_ext - -Extended ClientCutText messages start with a 4-byte header. If len < 4, -an integer underflow occurs in vnc_client_cut_text_ext. The result is -used to decompress data in a while loop in inflate_buffer, leading to -CPU consumption and denial of service. Prevent this by checking dlen in -protocol_client_msg. - -Fixes: CVE-2022-3165 -Fixes: 0bf41cab93e5 ("ui/vnc: clipboard support") -Reported-by: TangPeng -Signed-off-by: Mauro Matteo Cascella -Message-Id: <20220925204511.1103214-1-mcascell@redhat.com> -Signed-off-by: Gerd Hoffmann ---- - ui/vnc.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/ui/vnc.c b/ui/vnc.c -index 6a05d06147..acb3629cd8 100644 ---- a/ui/vnc.c -+++ b/ui/vnc.c -@@ -2442,8 +2442,8 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) - if (len == 1) { - return 8; - } -+ uint32_t dlen = abs(read_s32(data, 4)); - if (len == 8) { -- uint32_t dlen = abs(read_s32(data, 4)); - if (dlen > (1 << 20)) { - error_report("vnc: client_cut_text msg payload has %u bytes" - " which exceeds our limit of 1MB.", dlen); -@@ -2456,8 +2456,13 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) - } - - if (read_s32(data, 4) < 0) { -- vnc_client_cut_text_ext(vs, abs(read_s32(data, 4)), -- read_u32(data, 8), data + 12); -+ if (dlen < 4) { -+ error_report("vnc: malformed payload (header less than 4 bytes)" -+ " in extended clipboard pseudo-encoding."); -+ vnc_client_error(vs); -+ break; -+ } -+ vnc_client_cut_text_ext(vs, dlen, read_u32(data, 8), data + 12); - break; - } - vnc_client_cut_text(vs, read_u32(data, 4), data + 8); --- -GitLab - diff --git a/poky/meta/recipes-devtools/qemu/qemu/arm-cpreg-fix.patch b/poky/meta/recipes-devtools/qemu/qemu/arm-cpreg-fix.patch deleted file mode 100644 index 071691f8ca..0000000000 --- a/poky/meta/recipes-devtools/qemu/qemu/arm-cpreg-fix.patch +++ /dev/null @@ -1,27 +0,0 @@ -target/arm: mark SP_EL1 with ARM_CP_EL3_NO_EL2_KEEP - -SP_EL1 must be kept when EL3 is present but EL2 is not. Therefore mark -it with ARM_CP_EL3_NO_EL2_KEEP. - -Fixes: 696ba3771894 ("target/arm: Handle cpreg registration for missing EL") -Signed-off-by: Jerome Forissier - -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2022-09/msg04515.html] - ---- - target/arm/helper.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: qemu-7.1.0/target/arm/helper.c -=================================================================== ---- qemu-7.1.0.orig/target/arm/helper.c -+++ qemu-7.1.0/target/arm/helper.c -@@ -4971,7 +4971,7 @@ static const ARMCPRegInfo v8_cp_reginfo[ - .fieldoffset = offsetof(CPUARMState, sp_el[0]) }, - { .name = "SP_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 1, .opc2 = 0, -- .access = PL2_RW, .type = ARM_CP_ALIAS, -+ .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_KEEP, - .fieldoffset = offsetof(CPUARMState, sp_el[1]) }, - { .name = "SPSel", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0, diff --git a/poky/meta/recipes-devtools/qemu/qemu_7.1.0.bb b/poky/meta/recipes-devtools/qemu/qemu_7.1.0.bb deleted file mode 100644 index 42e133967e..0000000000 --- a/poky/meta/recipes-devtools/qemu/qemu_7.1.0.bb +++ /dev/null @@ -1,27 +0,0 @@ -BBCLASSEXTEND = "nativesdk" - -require qemu.inc - -DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native meson-native" - -DEPENDS:append:libc-musl = " libucontext" - -CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" - -RDEPENDS:${PN}:class-target += "bash" - -EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" -EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" - -PACKAGECONFIG ??= " \ - fdt sdl kvm pie slirp \ - ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ -" -PACKAGECONFIG:class-nativesdk ??= "fdt sdl kvm pie slirp \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ -" -# ppc32 hosts are no longer supported in qemu -COMPATIBLE_HOST:powerpc = "null" diff --git a/poky/meta/recipes-devtools/qemu/qemu_7.2.0.bb b/poky/meta/recipes-devtools/qemu/qemu_7.2.0.bb new file mode 100644 index 0000000000..42e133967e --- /dev/null +++ b/poky/meta/recipes-devtools/qemu/qemu_7.2.0.bb @@ -0,0 +1,27 @@ +BBCLASSEXTEND = "nativesdk" + +require qemu.inc + +DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native meson-native" + +DEPENDS:append:libc-musl = " libucontext" + +CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" + +RDEPENDS:${PN}:class-target += "bash" + +EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" +EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" + +PACKAGECONFIG ??= " \ + fdt sdl kvm pie slirp \ + ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ +" +PACKAGECONFIG:class-nativesdk ??= "fdt sdl kvm pie slirp \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ +" +# ppc32 hosts are no longer supported in qemu +COMPATIBLE_HOST:powerpc = "null" diff --git a/poky/meta/recipes-devtools/repo/repo_2.29.9.bb b/poky/meta/recipes-devtools/repo/repo_2.29.9.bb deleted file mode 100644 index a5a5c5ce87..0000000000 --- a/poky/meta/recipes-devtools/repo/repo_2.29.9.bb +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: MIT -# Copyright (C) 2021 iris-GmbH infrared & intelligent sensors - -SUMMARY = "Tool for managing many Git repositories" -DESCRIPTION = "Repo is a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to revision control systems, and automates parts of the development workflow." -HOMEPAGE = "https://android.googlesource.com/tools/repo" -SECTION = "console/utils" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" - -SRC_URI = "git://gerrit.googlesource.com/git-repo.git;protocol=https;branch=main \ - file://0001-python3-shebang.patch \ - " -SRCREV = "47020ba249c39783a66c0031fd9200caecfbbdc8" - -MIRRORS += "git://gerrit.googlesource.com/git-repo.git git://github.com/GerritCodeReview/git-repo.git" - -S = "${WORKDIR}/git" - -do_configure:prepend() { - sed -Ei "s/REPO_REV\s*=\s*('|\")stable('|\")/REPO_REV = '${SRCREV}'/g" ${S}/repo -} - -do_install() { - install -D ${WORKDIR}/git/repo ${D}${bindir}/repo -} - -RDEPENDS:${PN} = "python3 git" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/repo/repo_2.31.bb b/poky/meta/recipes-devtools/repo/repo_2.31.bb new file mode 100644 index 0000000000..27bb5d163e --- /dev/null +++ b/poky/meta/recipes-devtools/repo/repo_2.31.bb @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: MIT +# Copyright (C) 2021 iris-GmbH infrared & intelligent sensors + +SUMMARY = "Tool for managing many Git repositories" +DESCRIPTION = "Repo is a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to revision control systems, and automates parts of the development workflow." +HOMEPAGE = "https://android.googlesource.com/tools/repo" +SECTION = "console/utils" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +SRC_URI = "git://gerrit.googlesource.com/git-repo.git;protocol=https;branch=main \ + file://0001-python3-shebang.patch \ + " +SRCREV = "a621254b263664efa308a645214d3d140e068676" + +MIRRORS += "git://gerrit.googlesource.com/git-repo.git git://github.com/GerritCodeReview/git-repo.git" + +S = "${WORKDIR}/git" + +do_configure:prepend() { + sed -Ei "s/REPO_REV\s*=\s*('|\")stable('|\")/REPO_REV = '${SRCREV}'/g" ${S}/repo +} + +do_install() { + install -D ${WORKDIR}/git/repo ${D}${bindir}/repo +} + +RDEPENDS:${PN} = "python3 git" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/rpm/files/environment.d-rpm.sh b/poky/meta/recipes-devtools/rpm/files/environment.d-rpm.sh deleted file mode 100644 index 9b669a18d1..0000000000 --- a/poky/meta/recipes-devtools/rpm/files/environment.d-rpm.sh +++ /dev/null @@ -1 +0,0 @@ -export RPM_CONFIGDIR="$OECORE_NATIVE_SYSROOT/usr/lib/rpm" diff --git a/poky/meta/recipes-devtools/rpm/rpm_4.18.0.bb b/poky/meta/recipes-devtools/rpm/rpm_4.18.0.bb index 5f3986d8a3..8eb0ab207e 100644 --- a/poky/meta/recipes-devtools/rpm/rpm_4.18.0.bb +++ b/poky/meta/recipes-devtools/rpm/rpm_4.18.0.bb @@ -25,7 +25,6 @@ LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=c4eec0c20c6034b9407a09945b48a43f" SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protocol=https \ - file://environment.d-rpm.sh \ file://0001-Do-not-add-an-unsatisfiable-dependency-when-building.patch \ file://0001-Do-not-read-config-files-from-HOME.patch \ file://0001-When-cross-installing-execute-package-scriptlets-wit.patch \ @@ -118,18 +117,15 @@ do_install:append:class-native() { } do_install:append:class-nativesdk() { - for tool in ${WRAPPER_TOOLS}; do - test -x ${D}$tool && create_wrapper ${D}$tool \ - RPM_CONFIGDIR='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir'), d.getVar('bindir'))}/rpm \ - RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir'), d.getVar('bindir'))}/..} \ - MAGIC='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir'), d.getVar('bindir'))}/misc/magic.mgc \ - RPM_NO_CHROOT_FOR_SCRIPTS=1 - done - rm -rf ${D}/var - mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d - install -m 644 ${WORKDIR}/environment.d-rpm.sh ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh + mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d + cat <<- EOF > ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh + export RPM_CONFIGDIR="$OECORE_NATIVE_SYSROOT${libdir}/rpm" + export RPM_ETCCONFIGDIR="$OECORE_NATIVE_SYSROOT${sysconfdir}" + export MAGIC="$OECORE_NATIVE_SYSROOT${datadir}/misc/magic.mgc" + export RPM_NO_CHROOT_FOR_SCRIPTS=1 + EOF } # Rpm's make install creates var/tmp which clashes with base-files packaging diff --git a/poky/meta/recipes-devtools/rsync/files/0001-Add-missing-prototypes-to-function-declarations.patch b/poky/meta/recipes-devtools/rsync/files/0001-Add-missing-prototypes-to-function-declarations.patch index 474d82db22..8895adad74 100644 --- a/poky/meta/recipes-devtools/rsync/files/0001-Add-missing-prototypes-to-function-declarations.patch +++ b/poky/meta/recipes-devtools/rsync/files/0001-Add-missing-prototypes-to-function-declarations.patch @@ -1,4 +1,4 @@ -From 785c0072c80c2f6e0839478453cf65fdeac15da0 Mon Sep 17 00:00:00 2001 +From 651425fced0691d9063fe417388ba6ca1c38c40b Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 29 Aug 2022 19:53:28 -0700 Subject: [PATCH] Add missing prototypes to function declarations @@ -15,6 +15,7 @@ Fixes errors like Upstream-Status: Submitted [https://lists.samba.org/archive/rsync/2022-August/032858.html] Signed-off-by: Khem Raj + --- checksum.c | 2 +- exclude.c | 2 +- @@ -29,23 +30,23 @@ Signed-off-by: Khem Raj 10 files changed, 12 insertions(+), 13 deletions(-) diff --git a/checksum.c b/checksum.c -index fb8c0a0..174c28c 100644 +index 60de365..67a9e16 100644 --- a/checksum.c +++ b/checksum.c -@@ -629,7 +629,7 @@ int sum_end(char *sum) - return csum_len_for_type(cursum_type, 0); +@@ -778,7 +778,7 @@ static void verify_digest(struct name_num_item *nni, BOOL check_auth_list) } + #endif -void init_checksum_choices() +void init_checksum_choices(void) { - #ifdef SUPPORT_XXH3 - char buf[32816]; + #if defined SUPPORT_XXH3 || defined USE_OPENSSL + struct name_num_item *nni; diff --git a/exclude.c b/exclude.c -index adc82e2..79f5a82 100644 +index ffe55b1..a85ea76 100644 --- a/exclude.c +++ b/exclude.c -@@ -358,7 +358,7 @@ void implied_include_partial_string(const char *s_start, const char *s_end) +@@ -363,7 +363,7 @@ void implied_include_partial_string(const char *s_start, const char *s_end) memcpy(partial_string_buf, s_start, partial_string_len); } @@ -53,9 +54,9 @@ index adc82e2..79f5a82 100644 +void free_implied_include_partial_string(void) { if (partial_string_buf) { - free(partial_string_buf); + if (partial_string_len) diff --git a/hlink.c b/hlink.c -index 66810a3..6511dfb 100644 +index 20291f2..5c26a6b 100644 --- a/hlink.c +++ b/hlink.c @@ -117,8 +117,7 @@ static void match_gnums(int32 *ndx_list, int ndx_count) @@ -82,7 +83,7 @@ index a1a7245..4eae062 100644 /* statistical data */ diff --git a/log.c b/log.c -index 44344e2..991e359 100644 +index e4ba1cc..8482b71 100644 --- a/log.c +++ b/log.c @@ -131,7 +131,7 @@ static void logit(int priority, const char *buf) @@ -95,7 +96,7 @@ index 44344e2..991e359 100644 int options = LOG_PID; diff --git a/main.c b/main.c -index 9ebfbea..affa244 100644 +index d2a7b9b..c50af45 100644 --- a/main.c +++ b/main.c @@ -244,7 +244,7 @@ void read_del_stats(int f) @@ -168,6 +169,3 @@ index bbba7b2..61f8dc9 100644 { uLong flags; --- -2.37.2 - diff --git a/poky/meta/recipes-devtools/rsync/files/0001-Turn-on-pedantic-errors-at-the-end-of-configure.patch b/poky/meta/recipes-devtools/rsync/files/0001-Turn-on-pedantic-errors-at-the-end-of-configure.patch deleted file mode 100644 index 1d9c4bfe48..0000000000 --- a/poky/meta/recipes-devtools/rsync/files/0001-Turn-on-pedantic-errors-at-the-end-of-configure.patch +++ /dev/null @@ -1,68 +0,0 @@ -From e64a58387db46239902b610871a0eb81626e99ff Mon Sep 17 00:00:00 2001 -From: Paul Eggert -Date: Thu, 18 Aug 2022 07:46:28 -0700 -Subject: [PATCH] Turn on -pedantic-errors at the end of 'configure' - -Problem reported by Khem Raj in: -https://lists.gnu.org/r/autoconf-patches/2022-08/msg00009.html -Upstream-Status: Submitted [https://lists.samba.org/archive/rsync/2022-August/032862.html] ---- - configure.ac | 35 ++++++++++++++++++++--------------- - 1 file changed, 20 insertions(+), 15 deletions(-) - -diff --git a/configure.ac b/configure.ac -index d185b2d3..7e9514f7 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1071,21 +1071,6 @@ elif test x"$ac_cv_header_popt_h" != x"yes"; then - with_included_popt=yes - fi - --if test x"$GCC" = x"yes"; then -- if test x"$with_included_popt" != x"yes"; then -- # Turn pedantic warnings into errors to ensure an array-init overflow is an error. -- CFLAGS="$CFLAGS -pedantic-errors" -- else -- # Our internal popt code cannot be compiled with pedantic warnings as errors, so try to -- # turn off pedantic warnings (which will not lose the error for array-init overflow). -- # Older gcc versions don't understand -Wno-pedantic, so check if --help=warnings lists -- # -Wpedantic and use that as a flag. -- case `$CC --help=warnings 2>/dev/null | grep Wpedantic` in -- *-Wpedantic*) CFLAGS="$CFLAGS -pedantic-errors -Wno-pedantic" ;; -- esac -- fi --fi -- - AC_MSG_CHECKING([whether to use included libpopt]) - if test x"$with_included_popt" = x"yes"; then - AC_MSG_RESULT($srcdir/popt) -@@ -1444,6 +1429,26 @@ case "$CC" in - ;; - esac - -+# Enable -pedantic-errors last, so that it doesn't mess up other -+# 'configure' tests. For example, Autoconf uses empty function -+# prototypes like 'int main () {}' which Clang 15's -pedantic-errors -+# would reject. Generally it's not a good idea to try to run -+# 'configure' itself with strict compiler checking. -+if test x"$GCC" = x"yes"; then -+ if test x"$with_included_popt" != x"yes"; then -+ # Turn pedantic warnings into errors to ensure an array-init overflow is an error. -+ CFLAGS="$CFLAGS -pedantic-errors" -+ else -+ # Our internal popt code cannot be compiled with pedantic warnings as errors, so try to -+ # turn off pedantic warnings (which will not lose the error for array-init overflow). -+ # Older gcc versions don't understand -Wno-pedantic, so check if --help=warnings lists -+ # -Wpedantic and use that as a flag. -+ case `$CC --help=warnings 2>/dev/null | grep Wpedantic` in -+ *-Wpedantic*) CFLAGS="$CFLAGS -pedantic-errors -Wno-pedantic" ;; -+ esac -+ fi -+fi -+ - AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) - AC_OUTPUT - --- -2.37.1 - diff --git a/poky/meta/recipes-devtools/rsync/rsync_3.2.5.bb b/poky/meta/recipes-devtools/rsync/rsync_3.2.5.bb deleted file mode 100644 index 0bbbac7ace..0000000000 --- a/poky/meta/recipes-devtools/rsync/rsync_3.2.5.bb +++ /dev/null @@ -1,71 +0,0 @@ -SUMMARY = "File synchronization tool" -HOMEPAGE = "http://rsync.samba.org/" -DESCRIPTION = "rsync is an open source utility that provides fast incremental file transfer." -BUGTRACKER = "http://rsync.samba.org/bugzilla.html" -SECTION = "console/network" -# GPL-2.0-or-later (<< 3.0.0), GPL-3.0-or-later (>= 3.0.0) -# Includes opennsh and xxhash dynamic link exception -LICENSE = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=24423708fe159c9d12be1ea29fcb18c7" - -DEPENDS = "popt" - -SRC_URI = "https://download.samba.org/pub/${BPN}/src/${BP}.tar.gz \ - file://rsyncd.conf \ - file://makefile-no-rebuild.patch \ - file://determism.patch \ - file://0001-Add-missing-prototypes-to-function-declarations.patch \ - file://0001-Turn-on-pedantic-errors-at-the-end-of-configure.patch \ - " -SRC_URI[sha256sum] = "2ac4d21635cdf791867bc377c35ca6dda7f50d919a58be45057fd51600c69aba" - -# -16548 required for v3.1.3pre1. Already in v3.1.3. -CVE_CHECK_IGNORE += " CVE-2017-16548 " - -inherit autotools-brokensep - -PACKAGECONFIG ??= "acl attr \ - ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ -" - -PACKAGECONFIG[acl] = "--enable-acl-support,--disable-acl-support,acl," -PACKAGECONFIG[attr] = "--enable-xattr-support,--disable-xattr-support,attr," -PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," -PACKAGECONFIG[lz4] = "--enable-lz4,--disable-lz4,lz4" -PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" -PACKAGECONFIG[xxhash] = "--enable-xxhash,--disable-xxhash,xxhash" -PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd" - -# By default, if crosscompiling, rsync disables a number of -# capabilities, hardlinking symlinks and special files (i.e. devices) -CACHED_CONFIGUREVARS += "rsync_cv_can_hardlink_special=yes rsync_cv_can_hardlink_symlink=yes" - -EXTRA_OEMAKE = 'STRIP=""' -EXTRA_OECONF = "--disable-md2man --with-nobody-group=nogroup" - -#| ./simd-checksum-x86_64.cpp: In function 'uint32_t get_checksum1_cpp(char*, int32_t)': -#| ./simd-checksum-x86_64.cpp:89:52: error: multiversioning needs 'ifunc' which is not supported on this target -#| 89 | __attribute__ ((target("default"))) MVSTATIC int32 get_checksum1_avx2_64(schar* buf, int32 len, int32 i, uint32* ps1, uint32* ps2) { return i; } -#| | ^~~~~~~~~~~~~~~~~~~~~ -#| ./simd-checksum-x86_64.cpp:480:1: error: use of multiversioned function without a default -#| 480 | } -#| | ^ -#| If you can't fix the issue, re-run ./configure with --disable-roll-simd. -EXTRA_OECONF:append:libc-musl = " --disable-roll-simd" - -# rsync 3.0 uses configure.sh instead of configure, and -# makefile checks the existence of configure.sh -do_configure:prepend () { - rm -f ${S}/configure ${S}/configure.sh -} - -do_configure:append () { - cp -f ${S}/configure ${S}/configure.sh -} - -do_install:append() { - install -d ${D}${sysconfdir} - install -m 0644 ${WORKDIR}/rsyncd.conf ${D}${sysconfdir} -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/rsync/rsync_3.2.7.bb b/poky/meta/recipes-devtools/rsync/rsync_3.2.7.bb new file mode 100644 index 0000000000..19574bcb1c --- /dev/null +++ b/poky/meta/recipes-devtools/rsync/rsync_3.2.7.bb @@ -0,0 +1,70 @@ +SUMMARY = "File synchronization tool" +HOMEPAGE = "http://rsync.samba.org/" +DESCRIPTION = "rsync is an open source utility that provides fast incremental file transfer." +BUGTRACKER = "http://rsync.samba.org/bugzilla.html" +SECTION = "console/network" +# GPL-2.0-or-later (<< 3.0.0), GPL-3.0-or-later (>= 3.0.0) +# Includes opennsh and xxhash dynamic link exception +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=24423708fe159c9d12be1ea29fcb18c7" + +DEPENDS = "popt" + +SRC_URI = "https://download.samba.org/pub/${BPN}/src/${BP}.tar.gz \ + file://rsyncd.conf \ + file://makefile-no-rebuild.patch \ + file://determism.patch \ + file://0001-Add-missing-prototypes-to-function-declarations.patch \ + " +SRC_URI[sha256sum] = "4e7d9d3f6ed10878c58c5fb724a67dacf4b6aac7340b13e488fb2dc41346f2bb" + +# -16548 required for v3.1.3pre1. Already in v3.1.3. +CVE_CHECK_IGNORE += " CVE-2017-16548 " + +inherit autotools-brokensep + +PACKAGECONFIG ??= "acl attr \ + ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ +" + +PACKAGECONFIG[acl] = "--enable-acl-support,--disable-acl-support,acl," +PACKAGECONFIG[attr] = "--enable-xattr-support,--disable-xattr-support,attr," +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," +PACKAGECONFIG[lz4] = "--enable-lz4,--disable-lz4,lz4" +PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl" +PACKAGECONFIG[xxhash] = "--enable-xxhash,--disable-xxhash,xxhash" +PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd" + +# By default, if crosscompiling, rsync disables a number of +# capabilities, hardlinking symlinks and special files (i.e. devices) +CACHED_CONFIGUREVARS += "rsync_cv_can_hardlink_special=yes rsync_cv_can_hardlink_symlink=yes" + +EXTRA_OEMAKE = 'STRIP=""' +EXTRA_OECONF = "--disable-md2man --with-nobody-group=nogroup" + +#| ./simd-checksum-x86_64.cpp: In function 'uint32_t get_checksum1_cpp(char*, int32_t)': +#| ./simd-checksum-x86_64.cpp:89:52: error: multiversioning needs 'ifunc' which is not supported on this target +#| 89 | __attribute__ ((target("default"))) MVSTATIC int32 get_checksum1_avx2_64(schar* buf, int32 len, int32 i, uint32* ps1, uint32* ps2) { return i; } +#| | ^~~~~~~~~~~~~~~~~~~~~ +#| ./simd-checksum-x86_64.cpp:480:1: error: use of multiversioned function without a default +#| 480 | } +#| | ^ +#| If you can't fix the issue, re-run ./configure with --disable-roll-simd. +EXTRA_OECONF:append:libc-musl = " --disable-roll-simd" + +# rsync 3.0 uses configure.sh instead of configure, and +# makefile checks the existence of configure.sh +do_configure:prepend () { + rm -f ${S}/configure ${S}/configure.sh +} + +do_configure:append () { + cp -f ${S}/configure ${S}/configure.sh +} + +do_install:append() { + install -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/rsyncd.conf ${D}${sysconfdir} +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/ruby/ruby.inc b/poky/meta/recipes-devtools/ruby/ruby.inc deleted file mode 100644 index ebff5efd1f..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby.inc +++ /dev/null @@ -1,39 +0,0 @@ -SUMMARY = "An interpreter of object-oriented scripting language" -DESCRIPTION = "Ruby is an interpreted scripting language for quick \ -and easy object-oriented programming. It has many features to process \ -text files and to do system management tasks (as in Perl). \ -It is simple, straight-forward, and extensible. \ -" -HOMEPAGE = "http://www.ruby-lang.org/" -SECTION = "devel/ruby" -LICENSE = "Ruby | BSD-2-Clause | BSD-3-Clause | GPL-2.0-only | ISC | MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=5b8c87559868796979806100db3f3805 \ - file://BSDL;md5=8b50bc6de8f586dc66790ba11d064d75 \ - file://GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://LEGAL;md5=f260190bc1e92e363f0ee3c0463d4c7c \ - " - -DEPENDS = "zlib openssl libyaml gdbm readline libffi" -DEPENDS:append:class-target = " ruby-native" - -SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" -SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \ - file://0001-extmk-fix-cross-compilation-of-external-gems.patch \ - file://0002-Obey-LDFLAGS-for-the-link-of-libruby.patch \ - " -UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" - -inherit autotools ptest pkgconfig - - -# This snippet lets compiled extensions which rely on external libraries, -# such as zlib, compile properly. If we don't do this, then when extmk.rb -# runs, it uses the native libraries instead of the target libraries, and so -# none of the linking operations succeed -- which makes extconf.rb think -# that the libraries aren't available and hence that the extension can't be -# built. - -do_configure:prepend() { - sed -i "s#%%TARGET_CFLAGS%%#$CFLAGS#; s#%%TARGET_LDFLAGS%%#$LDFLAGS#" ${S}/common.mk - rm -rf ${S}/ruby/ -} diff --git a/poky/meta/recipes-devtools/ruby/ruby/0001-Remove-dependency-on-libcapstone.patch b/poky/meta/recipes-devtools/ruby/ruby/0001-Remove-dependency-on-libcapstone.patch deleted file mode 100644 index 5d0f8fcc09..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby/0001-Remove-dependency-on-libcapstone.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 222203297966f312109e8eaa2520f2cf2f59c09d Mon Sep 17 00:00:00 2001 -From: Alan Wu -Date: Thu, 31 Mar 2022 17:26:28 -0400 -Subject: [PATCH] Remove dependency on libcapstone - -We have received reports of build failures due to this configuration -check modifying compile flags. Since only YJIT devs use this library -we can remove it to make Ruby easier to build for users. - -See: https://github.com/rbenv/ruby-build/discussions/1933 - -Upstream-Status: Backport ---- - configure.ac | 9 --------- - 1 file changed, 9 deletions(-) - -Index: ruby-3.1.2/configure.ac -=================================================================== ---- ruby-3.1.2.orig/configure.ac -+++ ruby-3.1.2/configure.ac -@@ -1244,15 +1244,6 @@ AC_CHECK_LIB(dl, dlopen) # Dynamic linki - AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX - AC_CHECK_LIB(socket, shutdown) # SunOS/Solaris - --if pkg-config --exists capstone; then -- CAPSTONE_CFLAGS=`pkg-config --cflags capstone` -- CAPSTONE_LIB_L=`pkg-config --libs-only-L capstone` -- LDFLAGS="$LDFLAGS $CAPSTONE_LIB_L" -- CFLAGS="$CFLAGS $CAPSTONE_CFLAGS" --fi -- --AC_CHECK_LIB(capstone, cs_open) # Capstone disassembler for debugging YJIT -- - dnl Checks for header files. - AC_HEADER_DIRENT - dnl AC_HEADER_STDC has been checked in AC_USE_SYSTEM_EXTENSIONS diff --git a/poky/meta/recipes-devtools/ruby/ruby/0002-Obey-LDFLAGS-for-the-link-of-libruby.patch b/poky/meta/recipes-devtools/ruby/ruby/0002-Obey-LDFLAGS-for-the-link-of-libruby.patch index 4b954e439b..96ae86263b 100644 --- a/poky/meta/recipes-devtools/ruby/ruby/0002-Obey-LDFLAGS-for-the-link-of-libruby.patch +++ b/poky/meta/recipes-devtools/ruby/ruby/0002-Obey-LDFLAGS-for-the-link-of-libruby.patch @@ -1,4 +1,4 @@ -From 07fd1ada322eda6c05ac45c08fc814976f31b596 Mon Sep 17 00:00:00 2001 +From 21d8e7700fa0a9c4bf569dd366134060ae858832 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Thu, 5 May 2016 10:59:07 -0700 Subject: [PATCH] Obey LDFLAGS for the link of libruby @@ -11,10 +11,10 @@ Upstream-Status: Pending 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/Makefile.in b/template/Makefile.in -index f5a3149..5cc75ae 100644 +index 1456313..15b98a4 100644 --- a/template/Makefile.in +++ b/template/Makefile.in -@@ -114,7 +114,7 @@ ENABLE_SHARED = @ENABLE_SHARED@ +@@ -127,7 +127,7 @@ ENABLE_SHARED = @ENABLE_SHARED@ LDSHARED = @LIBRUBY_LDSHARED@ DLDSHARED = @DLDSHARED@ XDLDFLAGS = @DLDFLAGS@ @@ -22,4 +22,4 @@ index f5a3149..5cc75ae 100644 +DLDFLAGS = @LIBRUBY_DLDFLAGS@ @LDFLAGS@ $(XLDFLAGS) $(ARCH_FLAG) SOLIBS = @SOLIBS@ ENABLE_DEBUG_ENV = @ENABLE_DEBUG_ENV@ - MAINLIBS = @MAINLIBS@ + MAINLIBS = $(YJIT_LIBS) @MAINLIBS@ diff --git a/poky/meta/recipes-devtools/ruby/ruby/0006-Make-gemspecs-reproducible.patch b/poky/meta/recipes-devtools/ruby/ruby/0006-Make-gemspecs-reproducible.patch index 1e4a298317..0a87cae17f 100644 --- a/poky/meta/recipes-devtools/ruby/ruby/0006-Make-gemspecs-reproducible.patch +++ b/poky/meta/recipes-devtools/ruby/ruby/0006-Make-gemspecs-reproducible.patch @@ -1,4 +1,4 @@ -From 6e1dc610724a7aa8368cbcddf4bbe21cccc0f731 Mon Sep 17 00:00:00 2001 +From 3f60710bc29c1b08e128314d40101e87b7d2c9a1 Mon Sep 17 00:00:00 2001 From: Lucas Kanashiro Date: Fri, 1 Nov 2019 15:25:17 -0300 Subject: [PATCH] Make gemspecs reproducible @@ -17,19 +17,19 @@ Upstream-Status: Backport [debian] 5 files changed, 5 insertions(+) diff --git a/ext/bigdecimal/bigdecimal.gemspec b/ext/bigdecimal/bigdecimal.gemspec -index fd49c1b..5b8bb00 100644 +index d215757..5148d56 100644 --- a/ext/bigdecimal/bigdecimal.gemspec +++ b/ext/bigdecimal/bigdecimal.gemspec @@ -4,6 +4,7 @@ Gem::Specification.new do |s| s.name = "bigdecimal" - s.version = "3.1.1" + s.version = "3.1.3" s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"] + s.date = RUBY_RELEASE_DATE s.email = ["mrkn@mrkn.jp"] s.summary = "Arbitrary-precision decimal floating-point number library." diff --git a/ext/fiddle/fiddle.gemspec b/ext/fiddle/fiddle.gemspec -index a9c0ec4..89da078 100644 +index 8781093..efdca32 100644 --- a/ext/fiddle/fiddle.gemspec +++ b/ext/fiddle/fiddle.gemspec @@ -8,6 +8,7 @@ end @@ -41,10 +41,10 @@ index a9c0ec4..89da078 100644 spec.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org"] diff --git a/ext/io/console/io-console.gemspec b/ext/io/console/io-console.gemspec -index aa57f8a..ba7f8e5 100644 +index d26a757..cc88c55 100644 --- a/ext/io/console/io-console.gemspec +++ b/ext/io/console/io-console.gemspec -@@ -4,6 +4,7 @@ _VERSION = "0.5.11" +@@ -4,6 +4,7 @@ _VERSION = "0.6.0" Gem::Specification.new do |s| s.name = "io-console" s.version = _VERSION @@ -65,7 +65,7 @@ index 1f4798e..48743cf 100644 spec.email = ["knu@idaemons.org", "ume@mahoroba.org"] diff --git a/lib/rdoc/rdoc.gemspec b/lib/rdoc/rdoc.gemspec -index 525a15f..f6d0e22 100644 +index 3c96f7d..fec0872 100644 --- a/lib/rdoc/rdoc.gemspec +++ b/lib/rdoc/rdoc.gemspec @@ -7,6 +7,7 @@ end @@ -76,6 +76,3 @@ index 525a15f..f6d0e22 100644 s.version = RDoc::VERSION s.authors = [ --- -2.25.1 - diff --git a/poky/meta/recipes-devtools/ruby/ruby_3.1.2.bb b/poky/meta/recipes-devtools/ruby/ruby_3.1.2.bb deleted file mode 100644 index 387bfa9b44..0000000000 --- a/poky/meta/recipes-devtools/ruby/ruby_3.1.2.bb +++ /dev/null @@ -1,108 +0,0 @@ -require ruby.inc - -DEPENDS:append:libc-musl = " libucontext" - -SRC_URI += " \ - file://remove_has_include_macros.patch \ - file://run-ptest \ - file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \ - file://0002-template-Makefile.in-filter-out-f-prefix-map.patch \ - file://0003-rdoc-build-reproducible-documentation.patch \ - file://0004-lib-mkmf.rb-sort-list-of-object-files-in-generated-M.patch \ - file://0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch \ - file://0006-Make-gemspecs-reproducible.patch \ - file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \ - file://0001-Remove-dependency-on-libcapstone.patch \ - " - -SRC_URI[sha256sum] = "61843112389f02b735428b53bb64cf988ad9fb81858b8248e22e57336f24a83e" - -PACKAGECONFIG ??= "" -PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" - -PACKAGECONFIG[valgrind] = "--with-valgrind=yes, --with-valgrind=no, valgrind" -PACKAGECONFIG[gmp] = "--with-gmp=yes, --with-gmp=no, gmp" -PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6," -# rdoc is off by default due to non-reproducibility reported in -# https://bugs.ruby-lang.org/issues/18456 -PACKAGECONFIG[rdoc] = "--enable-install-rdoc,--disable-install-rdoc," - -EXTRA_OECONF = "\ - --disable-versioned-paths \ - --disable-rpath \ - --disable-dtrace \ - --enable-shared \ - --enable-load-relative \ - --with-pkg-config=pkg-config \ - --with-static-linked-ext \ -" - -EXTRA_OECONF:append:libc-musl = "\ - ac_cv_func_isnan=yes \ - ac_cv_func_isinf=yes \ -" - -PARALLEL_MAKEINST = "" - -do_install:append:class-target () { - # Find out rbconfig.rb from .installed.list - rbconfig_rb=`grep rbconfig.rb ${B}/.installed.list` - # Remove build host directories - sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \ - -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ - -e 's|${DEBUG_PREFIX_MAP}||g' \ - -e 's:${HOSTTOOLS_DIR}/::g' \ - -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ - -e 's:${RECIPE_SYSROOT}::g' \ - -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ - ${D}$rbconfig_rb - - sed -i -e 's|${DEBUG_PREFIX_MAP}||g' \ - ${D}${libdir}/pkgconfig/*.pc - - # logs that may contain host-specific paths - find ${D} -name gem_make.out -delete -} - -do_install_ptest () { - cp -rf ${S}/test ${D}${PTEST_PATH}/ - - install -D ${S}/tool/test/runner.rb ${D}${PTEST_PATH}/tool/test/runner.rb - cp -r ${S}/tool/lib ${D}${PTEST_PATH}/tool/ - mkdir -p ${D}${PTEST_PATH}/lib - cp -r ${S}/lib/did_you_mean ${S}/lib/rdoc ${D}${PTEST_PATH}/lib - - # install test-binaries - # These .so files have sporadic reproducibility fails as seen here: - # https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20220107-rm1diuww/packages/diff-html/ - # As they are needed only in ruby-ptest, and that is currently altogether disabled, let's take them out. - # If someone wants to look at where the non-determinism comes from, one possible reason is use of - # -rdynamic -Wl,-export-dynamic - #find $(find ./.ext -path '*/-test-') -name '*.so' -print0 \ - # | tar --no-recursion --null -T - --no-same-owner --preserve-permissions -cf - \ - # | tar -C ${D}${libdir}/ruby/${SHRT_VER}.0/ --no-same-owner --preserve-permissions --strip-components=2 -xf - - # adjust path to not assume build directory layout - sed -e 's|File.expand_path(.*\.\./bin/erb[^)]*|File.expand_path("${bindir}/erb"|g' \ - -i ${D}${PTEST_PATH}/test/erb/test_erb_command.rb - - cp -r ${S}/include ${D}/${libdir}/ruby/ -} - -PACKAGES =+ "${PN}-ri-docs ${PN}-rdoc" - -SUMMARY:${PN}-ri-docs = "ri (Ruby Interactive) documentation for the Ruby standard library" -RDEPENDS:${PN}-ri-docs = "${PN}" -FILES:${PN}-ri-docs += "${datadir}/ri" - -SUMMARY:${PN}-rdoc = "RDoc documentation generator from Ruby source" -RDEPENDS:${PN}-rdoc = "${PN}" -FILES:${PN}-rdoc += "${libdir}/ruby/*/rdoc ${bindir}/rdoc" - -FILES:${PN} += "${datadir}/rubygems" - -FILES:${PN}-ptest:append:class-target = "\ - ${libdir}/ruby/include \ - ${libdir}/ruby/${SHRT_VER}.0/*/-test- \ -" - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/ruby/ruby_3.2.0.bb b/poky/meta/recipes-devtools/ruby/ruby_3.2.0.bb new file mode 100644 index 0000000000..1981a7524c --- /dev/null +++ b/poky/meta/recipes-devtools/ruby/ruby_3.2.0.bb @@ -0,0 +1,143 @@ +SUMMARY = "An interpreter of object-oriented scripting language" +DESCRIPTION = "Ruby is an interpreted scripting language for quick \ +and easy object-oriented programming. It has many features to process \ +text files and to do system management tasks (as in Perl). \ +It is simple, straight-forward, and extensible. \ +" +HOMEPAGE = "http://www.ruby-lang.org/" +SECTION = "devel/ruby" +LICENSE = "Ruby | BSD-2-Clause | BSD-3-Clause | GPL-2.0-only | ISC | MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=5b8c87559868796979806100db3f3805 \ + file://BSDL;md5=8b50bc6de8f586dc66790ba11d064d75 \ + file://GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://LEGAL;md5=f260190bc1e92e363f0ee3c0463d4c7c \ + " + +DEPENDS = "zlib openssl libyaml gdbm readline libffi" +DEPENDS:append:class-target = " ruby-native" +DEPENDS:append:class-nativesdk = " ruby-native" + +SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" +SRC_URI = "http://cache.ruby-lang.org/pub/ruby/${SHRT_VER}/ruby-${PV}.tar.gz \ + file://0001-extmk-fix-cross-compilation-of-external-gems.patch \ + file://0002-Obey-LDFLAGS-for-the-link-of-libruby.patch \ + file://remove_has_include_macros.patch \ + file://run-ptest \ + file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \ + file://0002-template-Makefile.in-filter-out-f-prefix-map.patch \ + file://0003-rdoc-build-reproducible-documentation.patch \ + file://0004-lib-mkmf.rb-sort-list-of-object-files-in-generated-M.patch \ + file://0005-Mark-Gemspec-reproducible-change-fixing-784225-too.patch \ + file://0006-Make-gemspecs-reproducible.patch \ + file://0001-vm_dump.c-Define-REG_S1-and-REG_S2-for-musl-riscv.patch \ + " +UPSTREAM_CHECK_URI = "https://www.ruby-lang.org/en/downloads/" + +inherit autotools ptest pkgconfig + + +# This snippet lets compiled extensions which rely on external libraries, +# such as zlib, compile properly. If we don't do this, then when extmk.rb +# runs, it uses the native libraries instead of the target libraries, and so +# none of the linking operations succeed -- which makes extconf.rb think +# that the libraries aren't available and hence that the extension can't be +# built. + +do_configure:prepend() { + sed -i "s#%%TARGET_CFLAGS%%#$CFLAGS#; s#%%TARGET_LDFLAGS%%#$LDFLAGS#" ${S}/common.mk + rm -rf ${S}/ruby/ +} + +DEPENDS:append:libc-musl = " libucontext" + +SRC_URI[sha256sum] = "daaa78e1360b2783f98deeceb677ad900f3a36c0ffa6e2b6b19090be77abc272" + +PACKAGECONFIG ??= "" +PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" + +PACKAGECONFIG[valgrind] = "--with-valgrind=yes, --with-valgrind=no, valgrind" +PACKAGECONFIG[gmp] = "--with-gmp=yes, --with-gmp=no, gmp" +PACKAGECONFIG[ipv6] = "--enable-ipv6, --disable-ipv6," +# rdoc is off by default due to non-reproducibility reported in +# https://bugs.ruby-lang.org/issues/18456 +PACKAGECONFIG[rdoc] = "--enable-install-rdoc,--disable-install-rdoc," + +EXTRA_OECONF = "\ + --disable-versioned-paths \ + --disable-rpath \ + --disable-dtrace \ + --enable-shared \ + --enable-load-relative \ + --with-pkg-config=pkg-config \ + --with-static-linked-ext \ +" + +EXTRA_OECONF:append:libc-musl = "\ + ac_cv_func_isnan=yes \ + ac_cv_func_isinf=yes \ +" + +PARALLEL_MAKEINST = "" + +do_install:append:class-target () { + # Find out rbconfig.rb from .installed.list + rbconfig_rb=`grep rbconfig.rb ${B}/.installed.list` + # Remove build host directories + sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \ + -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's:${HOSTTOOLS_DIR}/::g' \ + -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ + -e 's:${RECIPE_SYSROOT}::g' \ + -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ + ${D}$rbconfig_rb + + sed -i -e 's|${DEBUG_PREFIX_MAP}||g' \ + ${D}${libdir}/pkgconfig/*.pc + + # logs that may contain host-specific paths + find ${D} -name gem_make.out -delete +} + +do_install_ptest () { + cp -rf ${S}/test ${D}${PTEST_PATH}/ + + install -D ${S}/tool/test/runner.rb ${D}${PTEST_PATH}/tool/test/runner.rb + cp -r ${S}/tool/lib ${D}${PTEST_PATH}/tool/ + mkdir -p ${D}${PTEST_PATH}/lib + cp -r ${S}/lib/did_you_mean ${S}/lib/rdoc ${D}${PTEST_PATH}/lib + + # install test-binaries + # These .so files have sporadic reproducibility fails as seen here: + # https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20220107-rm1diuww/packages/diff-html/ + # As they are needed only in ruby-ptest, and that is currently altogether disabled, let's take them out. + # If someone wants to look at where the non-determinism comes from, one possible reason is use of + # -rdynamic -Wl,-export-dynamic + #find $(find ./.ext -path '*/-test-') -name '*.so' -print0 \ + # | tar --no-recursion --null -T - --no-same-owner --preserve-permissions -cf - \ + # | tar -C ${D}${libdir}/ruby/${SHRT_VER}.0/ --no-same-owner --preserve-permissions --strip-components=2 -xf - + # adjust path to not assume build directory layout + sed -e 's|File.expand_path(.*\.\./bin/erb[^)]*|File.expand_path("${bindir}/erb"|g' \ + -i ${D}${PTEST_PATH}/test/erb/test_erb_command.rb + + cp -r ${S}/include ${D}/${libdir}/ruby/ +} + +PACKAGES =+ "${PN}-ri-docs ${PN}-rdoc" + +SUMMARY:${PN}-ri-docs = "ri (Ruby Interactive) documentation for the Ruby standard library" +RDEPENDS:${PN}-ri-docs = "${PN}" +FILES:${PN}-ri-docs += "${datadir}/ri" + +SUMMARY:${PN}-rdoc = "RDoc documentation generator from Ruby source" +RDEPENDS:${PN}-rdoc = "${PN}" +FILES:${PN}-rdoc += "${libdir}/ruby/*/rdoc ${bindir}/rdoc" + +FILES:${PN} += "${datadir}/rubygems" + +FILES:${PN}-ptest:append:class-target = "\ + ${libdir}/ruby/include \ + ${libdir}/ruby/${SHRT_VER}.0/*/-test- \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/rust/cargo_1.66.0.bb b/poky/meta/recipes-devtools/rust/cargo_1.66.0.bb new file mode 100644 index 0000000000..2b2394e898 --- /dev/null +++ b/poky/meta/recipes-devtools/rust/cargo_1.66.0.bb @@ -0,0 +1,73 @@ +SUMMARY ?= "Cargo, a package manager for Rust." +HOMEPAGE = "https://crates.io" +LICENSE = "MIT | Apache-2.0" +SECTION = "devel" + +DEPENDS = "openssl zlib curl ca-certificates libssh2" + +LIC_FILES_CHKSUM = " \ + file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \ + file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \ + file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \ +" + +require rust-source.inc +require rust-snapshot.inc + +S = "${RUSTSRC}/src/tools/cargo" +CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" + +inherit cargo pkgconfig + +DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" + +do_cargo_setup_snapshot () { + ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig + # Need to use uninative's loader if enabled/present since the library paths + # are used internally by rust and result in symbol mismatches if we don't + if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then + patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER} + fi +} + +addtask cargo_setup_snapshot after do_unpack before do_configure +do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}" +do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" + + +do_compile:prepend () { + export RUSTC_BOOTSTRAP="1" +} + +do_install () { + install -d "${D}${bindir}" + install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" +} + +do_install:append:class-nativesdk() { + # To quote the cargo docs, "Cargo also sets the dynamic library path when compiling + # and running binaries with commands like `cargo run` and `cargo test`". Sadly it + # sets to libdir but not base_libdir leading to symbol mismatches depending on the + # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this. + create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir} +} + +# Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) +# as shipped by Yocto Dunfell. +# According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between +# libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off. +#export LIBGIT2_SYS_USE_PKG_CONFIG = "1" + +# Needed for pkg-config to be used +export LIBSSH2_SYS_USE_PKG_CONFIG = "1" + +# When building cargo-native we don't have cargo-native to use and depend on, +# so we must use the locally set up snapshot to bootstrap the build. +BASEDEPENDS:remove:class-native = "cargo-native" +CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" + +DEPENDS:append:class-nativesdk = " nativesdk-rust" +RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib" +RUSTLIB_DEP:class-nativesdk = "" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch b/poky/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch new file mode 100644 index 0000000000..da72665bbd --- /dev/null +++ b/poky/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch @@ -0,0 +1,168 @@ +From 3ecce665198e3420d70139d86ed22e74804c9379 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 28 Dec 2022 22:35:55 -0800 +Subject: [PATCH] Do not use LFS64 on linux with musl + +glibc is providing open64 and other lfs64 functions but musl aliases +them to normal equivalents since off_t is always 64-bit on musl, +therefore check for target env along when target OS is linux before +using open64, this is more available. Latest Musl has made these +namespace changes [1] + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4 + +Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/106246] +Signed-off-by: Khem Raj +--- + library/std/src/os/linux/fs.rs | 9 ++++++++- + library/std/src/sys/unix/fd.rs | 14 ++++++++++---- + library/std/src/sys/unix/fs.rs | 27 ++++++++++++++++++++------- + 3 files changed, 38 insertions(+), 12 deletions(-) + +diff --git a/library/std/src/os/linux/fs.rs b/library/std/src/os/linux/fs.rs +index 479bbcc17a8..ab0b2a3eda3 100644 +--- a/library/std/src/os/linux/fs.rs ++++ b/library/std/src/os/linux/fs.rs +@@ -329,7 +329,14 @@ pub trait MetadataExt { + impl MetadataExt for Metadata { + #[allow(deprecated)] + fn as_raw_stat(&self) -> &raw::stat { +- unsafe { &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) } ++ #[cfg(target_env = "musl")] ++ unsafe { ++ &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) ++ } ++ #[cfg(not(target_env = "musl"))] ++ unsafe { ++ &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) ++ } + } + fn st_dev(&self) -> u64 { + self.as_inner().as_inner().st_dev as u64 +diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs +index dbaa3c33e2e..5d31557bd11 100644 +--- a/library/std/src/sys/unix/fd.rs ++++ b/library/std/src/sys/unix/fd.rs +@@ -115,9 +115,12 @@ pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { + } + + pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result { +- #[cfg(not(any(target_os = "linux", target_os = "android")))] ++ #[cfg(not(any( ++ all(target_os = "linux", not(target_env = "musl")), ++ target_os = "android" ++ )))] + use libc::pread as pread64; +- #[cfg(any(target_os = "linux", target_os = "android"))] ++ #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "android"))] + use libc::pread64; + + unsafe { +@@ -181,9 +184,12 @@ pub fn is_write_vectored(&self) -> bool { + } + + pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result { +- #[cfg(not(any(target_os = "linux", target_os = "android")))] ++ #[cfg(not(any( ++ all(target_os = "linux", not(target_env = "musl")), ++ target_os = "android" ++ )))] + use libc::pwrite as pwrite64; +- #[cfg(any(target_os = "linux", target_os = "android"))] ++ #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "android"))] + use libc::pwrite64; + + unsafe { +diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs +index aea0c26ee8b..e7be4729ca6 100644 +--- a/library/std/src/sys/unix/fs.rs ++++ b/library/std/src/sys/unix/fs.rs +@@ -45,19 +45,24 @@ + all(target_os = "linux", target_env = "gnu") + ))] + use libc::c_char; +-#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))] ++#[cfg(any( ++ all(target_os = "linux", not(target_env = "musl")), ++ target_os = "emscripten", ++ target_os = "android" ++))] + use libc::dirfd; +-#[cfg(any(target_os = "linux", target_os = "emscripten"))] ++#[cfg(any(not(target_env = "musl"), target_os = "emscripten"))] + use libc::fstatat64; + #[cfg(any( + target_os = "android", + target_os = "solaris", + target_os = "fuchsia", + target_os = "redox", +- target_os = "illumos" ++ target_os = "illumos", ++ target_env = "musl" + ))] + use libc::readdir as readdir64; +-#[cfg(target_os = "linux")] ++#[cfg(all(target_os = "linux", not(target_env = "musl")))] + use libc::readdir64; + #[cfg(any(target_os = "emscripten", target_os = "l4re"))] + use libc::readdir64_r; +@@ -77,7 +82,13 @@ + dirent as dirent64, fstat as fstat64, fstatat as fstatat64, ftruncate64, lseek64, + lstat as lstat64, off64_t, open as open64, stat as stat64, + }; ++#[cfg(target_env = "musl")] ++use libc::{ ++ dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64, ++ lstat as lstat64, off_t as off64_t, open as open64, stat as stat64, ++}; + #[cfg(not(any( ++ target_env = "musl", + target_os = "linux", + target_os = "emscripten", + target_os = "l4re", +@@ -87,7 +98,7 @@ + dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64, + lstat as lstat64, off_t as off64_t, open as open64, stat as stat64, + }; +-#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))] ++#[cfg(any(not(target_env = "musl"), target_os = "emscripten", target_os = "l4re"))] + use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64}; + + pub use crate::sys_common::fs::try_exists; +@@ -260,6 +271,7 @@ unsafe impl Sync for Dir {} + #[cfg(any( + target_os = "android", + target_os = "linux", ++ not(target_env = "musl"), + target_os = "solaris", + target_os = "illumos", + target_os = "fuchsia", +@@ -292,6 +304,7 @@ struct dirent64_min { + } + + #[cfg(not(any( ++ target_env = "musl", + target_os = "android", + target_os = "linux", + target_os = "solaris", +@@ -745,7 +758,7 @@ pub fn file_name(&self) -> OsString { + } + + #[cfg(all( +- any(target_os = "linux", target_os = "emscripten", target_os = "android"), ++ any(not(target_env = "musl"), target_os = "emscripten", target_os = "android"), + not(miri) + ))] + pub fn metadata(&self) -> io::Result { +@@ -769,7 +782,7 @@ pub fn metadata(&self) -> io::Result { + } + + #[cfg(any( +- not(any(target_os = "linux", target_os = "emscripten", target_os = "android")), ++ not(any(not(target_env = "musl"), target_os = "emscripten", target_os = "android")), + miri + ))] + pub fn metadata(&self) -> io::Result { +-- +2.39.0 + diff --git a/poky/meta/recipes-devtools/rust/files/crossbeam_atomic.patch b/poky/meta/recipes-devtools/rust/files/crossbeam_atomic.patch new file mode 100644 index 0000000000..b24ac439c6 --- /dev/null +++ b/poky/meta/recipes-devtools/rust/files/crossbeam_atomic.patch @@ -0,0 +1,81 @@ +crossbeam-utils is taking the target triplet and comparing it against a +known list of platforms that have issues either with any atomics or with +64 bit atomics. Since OE encodes TARGET_VENDOR into the rust triplet (to +differentiate host vs. target) this means that platforms that should match, +don't. + +We could make a list of platforms and pass in configuration values but +having one list in rust and another in our recipes is likely to cause +problems in the future. We do already have this issue in the librsvg recipe. +Instead, switch out the value of TARGET_VENDOR for "-unknown" which +them makes the list in no_atomics.rs work correctly. + +Someone with more rust knowledge could split up the triplets in no_atmoics.rs +and compare against the architecture/processor, or replace -unknown with a glob +to create a patch that upstream might accept. + +Upstream-Status: Submitted [https://github.com/crossbeam-rs/crossbeam/pull/922] +Signed-off-by: Richard Purdie + +Index: rustc-1.66.0-src/vendor/crossbeam-utils/build.rs +=================================================================== +--- rustc-1.66.0-src.orig/vendor/crossbeam-utils/build.rs ++++ rustc-1.66.0-src/vendor/crossbeam-utils/build.rs +@@ -29,7 +29,7 @@ use std::env; + include!("no_atomic.rs"); + + fn main() { +- let target = match env::var("TARGET") { ++ let mut target = match env::var("TARGET") { + Ok(target) => target, + Err(e) => { + println!( +@@ -40,6 +40,8 @@ fn main() { + return; + } + }; ++ let vendor = env::var("TARGET_VENDOR").unwrap(); ++ target = target.replace(&vendor, "-unknown"); + + // Note that this is `no_`*, not `has_*`. This allows treating as the latest + // stable rustc is used when the build script doesn't run. This is useful +Index: rustc-1.66.0-src/vendor/crossbeam-utils/.cargo-checksum.json +=================================================================== +--- rustc-1.66.0-src.orig/vendor/crossbeam-utils/.cargo-checksum.json ++++ rustc-1.66.0-src/vendor/crossbeam-utils/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"CHANGELOG.md":"65d3e11edf9498bdbc930c8c3878b7d3a90c1a0b1698597dc4a396a547fa0948","Cargo.toml":"1e4259a5a47271e8ae040b91e17652b5a4e0e7e45c3f22de5008db276f3a50bf","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"2a19af38a52dd965c2d66bb39f90a85b430b51ee9ccb29e9e1978ee7091e5087","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"4859f9c926c230023e861bf01c4b225b460035faf8cf6240108530efedbb747f","no_atomic.rs":"f58085b9d0666ccf62e0ae17fb5dae937c0a86fcc55dc0ae04ad8659e696a49c","src/atomic/atomic_cell.rs":"0fc99463e633144c5d59d39c35b5477da1f1b90f5448cadc37454b7f4b97707e","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"8fd5e3dcccc05860680e49c8498de8096bee9140bcfee8723d97117106a020d0","src/cache_padded.rs":"8bb8925e2df44224ffa29f31a2f9c08d88d8bd3df6c1ce47003598225055fdb5","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"eca73c04f821859b8434d2b93db87d160dc6a3f65498ca201cd40d732ca4c134","src/sync/once_lock.rs":"c03dc9c05a817e087dccf8b682f7307501542805533551da3c2bab442bc40743","src/sync/parker.rs":"91f3a7d4ee8d9e06b6558d180e8a0df08ff5c6cef612b4ce4790f9f75cb34f84","src/sync/sharded_lock.rs":"6391b3b99b194b8e0888446c2dec340e4fb095753bcf0c1a80bc654f9c8be0e3","src/sync/wait_group.rs":"3e339aab014f50e214fea535c841755113ea058153378ed54e50a4acb403c937","src/thread.rs":"21cf9b3e965529e5c0a6ff8fc1ec846bfe0006c41deb238a149be8d07384e955","tests/atomic_cell.rs":"bf8bc869c922a1cbf929c3b741bae0cae98f2157f572b5a4eb2873d20a407c22","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"314adeb8a651a28935f7a49c9a261b8fa1fd82bf6a16c865a5aced6216d7e40b","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"02661c2a820a5abe8b0c8fe15a6650aead707b57cdda0610d1b09a2680ed6969"},"package":"edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"} +\ No newline at end of file ++{"files":{"CHANGELOG.md":"65d3e11edf9498bdbc930c8c3878b7d3a90c1a0b1698597dc4a396a547fa0948","Cargo.toml":"1e4259a5a47271e8ae040b91e17652b5a4e0e7e45c3f22de5008db276f3a50bf","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"2a19af38a52dd965c2d66bb39f90a85b430b51ee9ccb29e9e1978ee7091e5087","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"108ba75398e3169c35b0e9754782391e4e4a9f9bf0ae2b216b55d836c4ac9ba8","no_atomic.rs":"f58085b9d0666ccf62e0ae17fb5dae937c0a86fcc55dc0ae04ad8659e696a49c","src/atomic/atomic_cell.rs":"0fc99463e633144c5d59d39c35b5477da1f1b90f5448cadc37454b7f4b97707e","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"8fd5e3dcccc05860680e49c8498de8096bee9140bcfee8723d97117106a020d0","src/cache_padded.rs":"8bb8925e2df44224ffa29f31a2f9c08d88d8bd3df6c1ce47003598225055fdb5","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"eca73c04f821859b8434d2b93db87d160dc6a3f65498ca201cd40d732ca4c134","src/sync/once_lock.rs":"c03dc9c05a817e087dccf8b682f7307501542805533551da3c2bab442bc40743","src/sync/parker.rs":"91f3a7d4ee8d9e06b6558d180e8a0df08ff5c6cef612b4ce4790f9f75cb34f84","src/sync/sharded_lock.rs":"6391b3b99b194b8e0888446c2dec340e4fb095753bcf0c1a80bc654f9c8be0e3","src/sync/wait_group.rs":"3e339aab014f50e214fea535c841755113ea058153378ed54e50a4acb403c937","src/thread.rs":"21cf9b3e965529e5c0a6ff8fc1ec846bfe0006c41deb238a149be8d07384e955","tests/atomic_cell.rs":"bf8bc869c922a1cbf929c3b741bae0cae98f2157f572b5a4eb2873d20a407c22","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"314adeb8a651a28935f7a49c9a261b8fa1fd82bf6a16c865a5aced6216d7e40b","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"02661c2a820a5abe8b0c8fe15a6650aead707b57cdda0610d1b09a2680ed6969"},"package":"edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"} +\ No newline at end of file +Index: rustc-1.66.0-src/vendor/crossbeam-utils-0.8.8/.cargo-checksum.json +=================================================================== +--- rustc-1.66.0-src.orig/vendor/crossbeam-utils-0.8.8/.cargo-checksum.json ++++ rustc-1.66.0-src/vendor/crossbeam-utils-0.8.8/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"CHANGELOG.md":"665a9f2c5fd37c98bef7c1b6eda753b58bb925d87e5b42d7298df973d7590631","Cargo.toml":"fe22292acd6a868e65baf225f90d5678678971642814d2d8e92a03954b8bdb40","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"dfa9fbed47c344c134a63c84b7c0e4651baeac1554b7b3266d0e38643743fc33","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"7e74dc72343ff57e83d0a84a9fbdd9ff1645894165909999b4c3d2fba94bc96c","no_atomic.rs":"71b5f78fd701ce604aa766dd3d825fa5bed774282aae4d6c31d7acb01b1b242f","src/atomic/atomic_cell.rs":"01185588e0e16ba81425677966d0c11887dedc4ac0d4a65991a34057c418adc4","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"7cc7754e15f69b52e92a70d4f49d1bc274693455a0933a2d7eb0605806566af3","src/cache_padded.rs":"6a512698115ad0d5a5b163dbd7a83247e1f1c146c4a30f3fc74b952e3b767b59","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"59986f559a8f170a4b3247ab2eea2460b09809d87c8110ed88e4e7103d3519dc","src/sync/parker.rs":"3f997f5b41fec286ccedcf3d36f801d741387badb574820b8e3456117ecd9154","src/sync/sharded_lock.rs":"14be659744918d0b27db24c56b41c618b0f0484b6761da46561023d96c4c120f","src/sync/wait_group.rs":"32e946a7581c55f8aa9904527b92b177c538fa0cf7cbcfa1d1f25990582cb6ea","src/thread.rs":"6a7676fd4e50af63aec6f655121a10cd6e8c704f4677125388186ba58dc5842d","tests/atomic_cell.rs":"d64faa1ca8896373468308031220940d988aa3a1679ea25d2291a7a7d22bc51a","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"eb6c5b59f007e0d290dd0f58758e8ccb5cacd38af34e3341368ced815f0c41be","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"ad8f0cdfed31f9594a2e0737234d418f8b924d784a4db8d7e469deab8c95f5f8"},"package":"0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"} +\ No newline at end of file ++{"files":{"CHANGELOG.md":"665a9f2c5fd37c98bef7c1b6eda753b58bb925d87e5b42d7298df973d7590631","Cargo.toml":"fe22292acd6a868e65baf225f90d5678678971642814d2d8e92a03954b8bdb40","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"dfa9fbed47c344c134a63c84b7c0e4651baeac1554b7b3266d0e38643743fc33","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"d983d511c89607ce89473779d1ee195e3eb509cc4d3043b9efe6aa2f94c98158","no_atomic.rs":"71b5f78fd701ce604aa766dd3d825fa5bed774282aae4d6c31d7acb01b1b242f","src/atomic/atomic_cell.rs":"01185588e0e16ba81425677966d0c11887dedc4ac0d4a65991a34057c418adc4","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"7cc7754e15f69b52e92a70d4f49d1bc274693455a0933a2d7eb0605806566af3","src/cache_padded.rs":"6a512698115ad0d5a5b163dbd7a83247e1f1c146c4a30f3fc74b952e3b767b59","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"59986f559a8f170a4b3247ab2eea2460b09809d87c8110ed88e4e7103d3519dc","src/sync/parker.rs":"3f997f5b41fec286ccedcf3d36f801d741387badb574820b8e3456117ecd9154","src/sync/sharded_lock.rs":"14be659744918d0b27db24c56b41c618b0f0484b6761da46561023d96c4c120f","src/sync/wait_group.rs":"32e946a7581c55f8aa9904527b92b177c538fa0cf7cbcfa1d1f25990582cb6ea","src/thread.rs":"6a7676fd4e50af63aec6f655121a10cd6e8c704f4677125388186ba58dc5842d","tests/atomic_cell.rs":"d64faa1ca8896373468308031220940d988aa3a1679ea25d2291a7a7d22bc51a","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"eb6c5b59f007e0d290dd0f58758e8ccb5cacd38af34e3341368ced815f0c41be","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"ad8f0cdfed31f9594a2e0737234d418f8b924d784a4db8d7e469deab8c95f5f8"},"package":"0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"} +\ No newline at end of file +Index: rustc-1.66.0-src/vendor/crossbeam-utils-0.8.8/build.rs +=================================================================== +--- rustc-1.66.0-src.orig/vendor/crossbeam-utils-0.8.8/build.rs ++++ rustc-1.66.0-src/vendor/crossbeam-utils-0.8.8/build.rs +@@ -29,7 +29,7 @@ use std::env; + include!("no_atomic.rs"); + + fn main() { +- let target = match env::var("TARGET") { ++ let mut target = match env::var("TARGET") { + Ok(target) => target, + Err(e) => { + println!( +@@ -40,6 +40,8 @@ fn main() { + return; + } + }; ++ let vendor = env::var("TARGET_VENDOR").unwrap(); ++ target = target.replace(&vendor, "-unknown"); + + // Note that this is `no_*`, not `has_*`. This allows treating + // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't diff --git a/poky/meta/recipes-devtools/rust/files/getrandom-open64.patch b/poky/meta/recipes-devtools/rust/files/getrandom-open64.patch new file mode 100644 index 0000000000..6fc981e2aa --- /dev/null +++ b/poky/meta/recipes-devtools/rust/files/getrandom-open64.patch @@ -0,0 +1,29 @@ +Do not use open64 on linux with musl + +glibc is providing open64 and other lfs64 functions but musl aliases +them to normal equivalents since off_t is always 64-bit on musl, +therefore check for target env along when target OS is linux before +using open64, this is more available. Latest Musl has made these +namespace changes [1] + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4 + +Upstream-Status: Submitted [https://github.com/rust-random/getrandom/pull/326] +Signed-off-by: Khem Raj +--- a/vendor/getrandom-0.2.0/.cargo-checksum.json ++++ b/vendor/getrandom-0.2.0/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"CHANGELOG.md":"4a5b61c82668507beffc7ad33f602257013263d7847cf17a246ef1128ba27950","Cargo.toml":"b59322815506cf16acd6e0cbe2634dec1be0886e686b51fa5cdf5a5ac9fdcf32","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"209fbbe0ad52d9235e37badf9cadfe4dbdc87203179c0899e738b39ade42177b","README.md":"e0bacefbe4310c23578c65926bda6e4318750f6718bb6b97ff9a4fa9056af6a6","benches/mod.rs":"5495735ff210a50cab23c2cc84191ed910af7c30395a3d9d6095b722765b3864","build.rs":"90355b5e76dedd97d604cd83b4a0a5ab074bbd4dde9632ee2b56c87c175b1e14","src/bsd_arandom.rs":"d2ee195acd80c7d1364a369ad0d2dad46f5f9f973f9d3960367413fd87acfcd6","src/cloudabi.rs":"9201af65a607587aa8615ec92cfab9d176f4199f6799dad9ca743c51d175028b","src/custom.rs":"f75ef80ec024fe3c97c7faff79de9f7d457993ed3c5f69f21593e140c8b62790","src/error.rs":"f40aa6cb36bc024285dc2e40349fdd3754db949a307ec73831ec253549d2b0a3","src/error_impls.rs":"733ed75ab89a9d0d5a7cc7abd85f31a23d772ea9c1e7c10def1477207d19fd8b","src/fuchsia.rs":"470d8509deb5b06fa6417f294c0a49e0e35a580249a5d8944c3be5aa746f64ea","src/ios.rs":"cc46ee9c48ab746d2af342a242e383b8de840045d3f52fd77ee337161367a1a1","src/lib.rs":"6aff4b429e4b1a07aad2ab7148d7cc9d0987b230597649af42041508320592e0","src/linux_android.rs":"39cb80999c8534145240a350976d261b8924436bf9a4563960c7bd8c2c83c773","src/macos.rs":"b692f2fcc2319a5195f47751d5bd7dd87c7c24a61d14fa4e3dbc992ae66212b7","src/openbsd.rs":"066b2dd395c190444a658bb0b52a052eabbd68ea5a534fb729c7e5373abc0a6a","src/rdrand.rs":"79d23183b1905d61bd9df9729dc798505a2ed750d3339e342ab144e1709827e4","src/solaris_illumos.rs":"9c7004446fabe5a7a21c73d5a65d7e2115b5bd1d1dbb735c984cab3dba239785","src/stdweb.rs":"f140081e47cfbb61937212e7840391bce5adf7829039d732d62b82a19e567dfa","src/test_common.rs":"895d71c06722e3a6f365999d29430f37f571aeb1eb4a525777b760005c9818be","src/test_rdrand.rs":"8c8df6de836463a41808396016428bf0a2a69c715ae96e7e0e7598fcea61ace8","src/use_file.rs":"c9fe635a83614be6f303e40f98b8e678c36ac6d9724b024430d3ea1ad1510add","src/util.rs":"da6964dc1523f1cb8d26365fa6a8ece46360587e6974931624b271f0c72cda8b","src/util_libc.rs":"d851394bc9c43dc09afde1e03401aa6c207858ec58fdffbc5131911b116418c7","src/vxworks.rs":"a5aa0e40f890e0f35626458bb656a3340b8af3111e4bacd2e12505a8d50a3505","src/wasi.rs":"3413e5a391b156f5d05600f4651f7f8eb4df2c8984fca7766ca50c0cfe0b2e9c","src/wasm-bindgen.rs":"0648388724c46697a9b3c654b8d931b2bf187a3193ca1888221d4529f764e376","src/windows.rs":"39dfae2814d958993619c3654bb39745de897971aea7a414fa32f90770850ce2","src/windows_uwp.rs":"672f41a0fac79a71bfaaecad59826c948b8538f69a0133ab1c09a1865ecd6114"},"package":"ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"} +\ No newline at end of file ++{"files":{"CHANGELOG.md":"4a5b61c82668507beffc7ad33f602257013263d7847cf17a246ef1128ba27950","Cargo.toml":"b59322815506cf16acd6e0cbe2634dec1be0886e686b51fa5cdf5a5ac9fdcf32","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"209fbbe0ad52d9235e37badf9cadfe4dbdc87203179c0899e738b39ade42177b","README.md":"e0bacefbe4310c23578c65926bda6e4318750f6718bb6b97ff9a4fa9056af6a6","benches/mod.rs":"5495735ff210a50cab23c2cc84191ed910af7c30395a3d9d6095b722765b3864","build.rs":"90355b5e76dedd97d604cd83b4a0a5ab074bbd4dde9632ee2b56c87c175b1e14","src/bsd_arandom.rs":"d2ee195acd80c7d1364a369ad0d2dad46f5f9f973f9d3960367413fd87acfcd6","src/cloudabi.rs":"9201af65a607587aa8615ec92cfab9d176f4199f6799dad9ca743c51d175028b","src/custom.rs":"f75ef80ec024fe3c97c7faff79de9f7d457993ed3c5f69f21593e140c8b62790","src/error.rs":"f40aa6cb36bc024285dc2e40349fdd3754db949a307ec73831ec253549d2b0a3","src/error_impls.rs":"733ed75ab89a9d0d5a7cc7abd85f31a23d772ea9c1e7c10def1477207d19fd8b","src/fuchsia.rs":"470d8509deb5b06fa6417f294c0a49e0e35a580249a5d8944c3be5aa746f64ea","src/ios.rs":"cc46ee9c48ab746d2af342a242e383b8de840045d3f52fd77ee337161367a1a1","src/lib.rs":"6aff4b429e4b1a07aad2ab7148d7cc9d0987b230597649af42041508320592e0","src/linux_android.rs":"39cb80999c8534145240a350976d261b8924436bf9a4563960c7bd8c2c83c773","src/macos.rs":"b692f2fcc2319a5195f47751d5bd7dd87c7c24a61d14fa4e3dbc992ae66212b7","src/openbsd.rs":"066b2dd395c190444a658bb0b52a052eabbd68ea5a534fb729c7e5373abc0a6a","src/rdrand.rs":"79d23183b1905d61bd9df9729dc798505a2ed750d3339e342ab144e1709827e4","src/solaris_illumos.rs":"9c7004446fabe5a7a21c73d5a65d7e2115b5bd1d1dbb735c984cab3dba239785","src/stdweb.rs":"f140081e47cfbb61937212e7840391bce5adf7829039d732d62b82a19e567dfa","src/test_common.rs":"895d71c06722e3a6f365999d29430f37f571aeb1eb4a525777b760005c9818be","src/test_rdrand.rs":"8c8df6de836463a41808396016428bf0a2a69c715ae96e7e0e7598fcea61ace8","src/use_file.rs":"c9fe635a83614be6f303e40f98b8e678c36ac6d9724b024430d3ea1ad1510add","src/util.rs":"da6964dc1523f1cb8d26365fa6a8ece46360587e6974931624b271f0c72cda8b","src/util_libc.rs":"c602b47e2958fa94443b3690faddf52a8c545689d18579c86dd8a07927c145b1","src/vxworks.rs":"a5aa0e40f890e0f35626458bb656a3340b8af3111e4bacd2e12505a8d50a3505","src/wasi.rs":"3413e5a391b156f5d05600f4651f7f8eb4df2c8984fca7766ca50c0cfe0b2e9c","src/wasm-bindgen.rs":"0648388724c46697a9b3c654b8d931b2bf187a3193ca1888221d4529f764e376","src/windows.rs":"39dfae2814d958993619c3654bb39745de897971aea7a414fa32f90770850ce2","src/windows_uwp.rs":"672f41a0fac79a71bfaaecad59826c948b8538f69a0133ab1c09a1865ecd6114"},"package":"ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"} +--- a/vendor/getrandom-0.2.0/src/util_libc.rs ++++ b/vendor/getrandom-0.2.0/src/util_libc.rs +@@ -97,7 +97,7 @@ impl Weak { + } + + cfg_if! { +- if #[cfg(any(target_os = "linux", target_os = "emscripten"))] { ++ if #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "emscripten"))] { + use libc::open64 as open; + } else { + use libc::open; diff --git a/poky/meta/recipes-devtools/rust/files/hardcodepaths.patch b/poky/meta/recipes-devtools/rust/files/hardcodepaths.patch new file mode 100644 index 0000000000..178f354cf8 --- /dev/null +++ b/poky/meta/recipes-devtools/rust/files/hardcodepaths.patch @@ -0,0 +1,70 @@ +When building for the target, some build paths end up embedded in the binaries. +These changes remove that. Further investigation is needed to work out the way +to resolve these issues properly upstream. + +Upstream-Status: Inappropriate [patches need rework] +Signed-off-by: Richard Purdie + +Index: rustc-1.66.0-src/src/tools/clippy/src/driver.rs +=================================================================== +--- rustc-1.66.0-src.orig/src/tools/clippy/src/driver.rs ++++ rustc-1.66.0-src/src/tools/clippy/src/driver.rs +@@ -259,7 +259,6 @@ pub fn main() { + .and_then(|out| String::from_utf8(out.stdout).ok()) + .map(|s| PathBuf::from(s.trim())) + }) +- .or_else(|| option_env!("SYSROOT").map(PathBuf::from)) + .or_else(|| { + let home = option_env!("RUSTUP_HOME") + .or(option_env!("MULTIRUST_HOME")) +Index: rustc-1.66.0-src/compiler/rustc_codegen_llvm/src/context.rs +=================================================================== +--- rustc-1.66.0-src.orig/compiler/rustc_codegen_llvm/src/context.rs ++++ rustc-1.66.0-src/compiler/rustc_codegen_llvm/src/context.rs +@@ -160,46 +160,6 @@ pub unsafe fn create_module<'ll>( + } + } + +- // Ensure the data-layout values hardcoded remain the defaults. +- if sess.target.is_builtin { +- let tm = crate::back::write::create_informational_target_machine(tcx.sess); +- llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm); +- llvm::LLVMRustDisposeTargetMachine(tm); +- +- let llvm_data_layout = llvm::LLVMGetDataLayoutStr(llmod); +- let llvm_data_layout = str::from_utf8(CStr::from_ptr(llvm_data_layout).to_bytes()) +- .expect("got a non-UTF8 data-layout from LLVM"); +- +- // Unfortunately LLVM target specs change over time, and right now we +- // don't have proper support to work with any more than one +- // `data_layout` than the one that is in the rust-lang/rust repo. If +- // this compiler is configured against a custom LLVM, we may have a +- // differing data layout, even though we should update our own to use +- // that one. +- // +- // As an interim hack, if CFG_LLVM_ROOT is not an empty string then we +- // disable this check entirely as we may be configured with something +- // that has a different target layout. +- // +- // Unsure if this will actually cause breakage when rustc is configured +- // as such. +- // +- // FIXME(#34960) +- let cfg_llvm_root = option_env!("CFG_LLVM_ROOT").unwrap_or(""); +- let custom_llvm_used = cfg_llvm_root.trim() != ""; +- +- if !custom_llvm_used && target_data_layout != llvm_data_layout { +- bug!( +- "data-layout for target `{rustc_target}`, `{rustc_layout}`, \ +- differs from LLVM target's `{llvm_target}` default layout, `{llvm_layout}`", +- rustc_target = sess.opts.target_triple, +- rustc_layout = target_data_layout, +- llvm_target = sess.target.llvm_target, +- llvm_layout = llvm_data_layout +- ); +- } +- } +- + let data_layout = SmallCStr::new(&target_data_layout); + llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr()); + diff --git a/poky/meta/recipes-devtools/rust/files/zlib-off64_t.patch b/poky/meta/recipes-devtools/rust/files/zlib-off64_t.patch new file mode 100644 index 0000000000..78c8a2a1fb --- /dev/null +++ b/poky/meta/recipes-devtools/rust/files/zlib-off64_t.patch @@ -0,0 +1,31 @@ +Do not undefine _FILE_OFFSET_BITS when +_LARGEFILE64_SOURCE is defined. This ends up +causing 64bit time_t to fail the build because +it needs 64 bit off_t + +Upstream-Status: Submitted [https://github.com/madler/zlib/pull/764] +Signed-off-by: Khem Raj +--- a/vendor/libz-sys/src/zlib/gzguts.h ++++ b/vendor/libz-sys/src/zlib/gzguts.h +@@ -3,15 +3,6 @@ + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +-#ifdef _LARGEFILE64_SOURCE +-# ifndef _LARGEFILE_SOURCE +-# define _LARGEFILE_SOURCE 1 +-# endif +-# ifdef _FILE_OFFSET_BITS +-# undef _FILE_OFFSET_BITS +-# endif +-#endif +- + #ifdef HAVE_HIDDEN + # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) + #else +--- a/vendor/libz-sys/.cargo-checksum.json ++++ b/vendor/libz-sys/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"Cargo.toml":"ce67ce7c1f3c4ad7832d58ed198b8dd745abacc620738d575c4b1a9ac9e79449","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"34c467b6945a22696d060b8fdd2379d464acb3408d4c599d3dc5fe4fa1b4c84f","README.md":"b23e18bdce29fabc3d34e88576219f50d1d735a355e427e6d6ebc09254138070","build.rs":"e034f7828ff43a0bb0f7b690e8e99b09b8f4e1ae0560b6fb4008006e9cd4d9dd","ci/Dockerfile":"4d479ea63b9e384b3864fa1204894bfae4890017d6bf03486274457fe2c26cf8","ci/run-docker.sh":"0ea7a4fdc9f6026110e20fa2e25dbadfc1e6dafed9ded5981ae36772ad207e26","ci/set_rust_version.bash":"4284f86ac3923a73dd79e89bef2d0b136c6d104d6dae92e24b4a96eaffa28890","ci/test.bash":"73a936768549eedf96a7cddb350ada128e058d5d9004244ebf3d993363b69599","src/lib.rs":"40476f4e896c936c21f908396255c7a4951ef8bf93788858ade6cace2539927b","src/smoke.c":"10607c81b73811bfcb9718767312bf97ba2ccf7048ea2f18a2085aa06ad7f91b","src/zlib-ng/CMakeLists.txt":"60b836817b51e5893b1e3203adaf57a98678af17957eccaef679bd96bcf5d90b","src/zlib-ng/FAQ.zlib":"d1777aa057caeef50fc291aac7a414363b2186bb3d65bb0f8bfa2bfd61cf0ad5","src/zlib-ng/INDEX.md":"989545e90d8e9ac149034f762ce78ed8976ebf9324326228dea37ca190154609","src/zlib-ng/LICENSE.md":"d3c80be055d94d798eaa786116e84fa0b010bc11420b5d2060d978ea77845436","src/zlib-ng/Makefile.in":"15027511a77e76b423eccf10ebfe66398ea96862cbce2415e5ebac7c7cbb6ab6","src/zlib-ng/PORTING.md":"5cff8c878c7958f6a4bada5a403dcc88961c9607826faece1aef202b5d95c550","src/zlib-ng/README.md":"9cac4a98ecf45f50adf5030d4dc58b3cf9f3ae8e3ec78d30fdae4a99a2b4b8d9","src/zlib-ng/adler32.c":"82ffa1b4fc4b198ba8004135f79b8819d9f2b28e851c30c0ab41e6d32dfbf70d","src/zlib-ng/adler32_p.h":"f56915c59a345baf4558374447385a317e29365a4db2fbb38af4de3e1a1a0201","src/zlib-ng/arch/arm/Makefile.in":"95464884ba75a7b12c9ceda5845d8d68d5a7d7dac8a8dc24b27beb2192e5b97b","src/zlib-ng/arch/arm/adler32_neon.c":"3990b8d5570b12c2162218fe0e9bc723a03f1c89b5ed3ba70a74a98976260ee7","src/zlib-ng/arch/arm/arm.h":"855adbb02d7b9a5714a17d9dcff493610e7cd2b9a1f4e58e1c99626ab536e868","src/zlib-ng/arch/arm/armfeature.c":"dd09ad2712b037e8d52173402f39cc2be1bc89d47fc10259ef81b4c64aef7110","src/zlib-ng/arch/arm/chunkset_neon.c":"65b70014888e9fbdb89bfbfa52f23b8953dc015466577da292d4780b55c5d95a","src/zlib-ng/arch/arm/crc32_acle.c":"5a96afc594697d1399870d1bfb0623a03869eff42caae74013f147cec4aa982e","src/zlib-ng/arch/arm/ctzl.h":"feb70d55e66025fff806e30e48002b35cfff79533d352585cfa5f118edbc90b1","src/zlib-ng/arch/arm/insert_string_acle.c":"d1b1dae5aeada70f2b03c2cbf3112ce55a92401c2d87709081b04dcf5992e1ad","src/zlib-ng/arch/arm/slide_neon.c":"19d8cf5c742ac6b82164c7a183538ad1129f9f17e9b8bce8b40daac3820fb6c4","src/zlib-ng/arch/generic/Makefile.in":"f41a34839986eac8dd52cf91fada0efff4171c059ab5d7db6347c91bd6d9db09","src/zlib-ng/arch/power/Makefile.in":"69644d1a0ff8e7f38005c0a55cdbaf3f0d87f42abf8fc4f4136271c4fedfb846","src/zlib-ng/arch/power/adler32_power8.c":"79b75e98ad3a62facbbdd8c0b178d3f993b57f6e34d320bf47eca33aa8c330a1","src/zlib-ng/arch/power/power.c":"0647afb3b3b7ce2a19b4815ec8fdeee0b37c759413e5ef0a668a2dba22d94803","src/zlib-ng/arch/power/power.h":"f3f15f94fed98a2f7dd5d4568c5172e597228be4141d6895062703c3f70024da","src/zlib-ng/arch/power/slide_hash_power8.c":"932ea533d25e2f5478afe0c47830e7ef24276cad0d75fd91f2d8c799bd4b5d36","src/zlib-ng/arch/s390/Makefile.in":"eef6c3169723f089b0b5f852423ec55bf0364caeddd7cda991f2e76bc1682107","src/zlib-ng/arch/s390/README.md":"4f5018cb7c8ee217710a90193088889a15f1675d205a104140f6a1ac07ce412c","src/zlib-ng/arch/s390/dfltcc_common.c":"6771ec4457da9f4b00c74bcc0828735e21c74b9162cb37383c297c3b5028cddf","src/zlib-ng/arch/s390/dfltcc_common.h":"ed339007feae58d1879e096addb30ed86cd5cf11222db22c45f48b47328cf6db","src/zlib-ng/arch/s390/dfltcc_deflate.c":"7b3dec7be4055c7748defc626dc91db99787c9f3b70b7d7b40282558bbb478e9","src/zlib-ng/arch/s390/dfltcc_deflate.h":"c4c411f221cc0f6b218326e973fef05c65840ba49878aff052dac0bb38121cbd","src/zlib-ng/arch/s390/dfltcc_detail.h":"01dbdfaf5e8ccf522663b4daa76e9138dde514292c35a623be4bcbbf4b82dea2","src/zlib-ng/arch/s390/dfltcc_inflate.c":"a96226eba3538d3904893cfe1b08395668e6a722b56f28d5b5debb3176161b4b","src/zlib-ng/arch/s390/dfltcc_inflate.h":"d7a4a5ae79abd1a5456521926b918becfe86c253a4fc23723fbc09f7c3303128","src/zlib-ng/arch/x86/INDEX.md":"c12f9bf0d66743a6472fb756bf46def8eea1dd235be7fca994dcb22f693a3524","src/zlib-ng/arch/x86/Makefile.in":"9f6fe7567a99e81aaa3bef8ccfa1ad40f524efc285cf8dfe0f497a1530f8016c","src/zlib-ng/arch/x86/adler32_avx.c":"99056732c7bd5d53dc108f282811a40bf21570926781af5dc7b17cb9218963de","src/zlib-ng/arch/x86/adler32_ssse3.c":"883a5520b4481225d097c90c5359106a3c8eb7b921499c94276e999b7c39adc5","src/zlib-ng/arch/x86/chunkset_avx.c":"15060e7ee487fb1daef9be25343ae387392276933921e4b4db0c67831dc0854f","src/zlib-ng/arch/x86/chunkset_sse.c":"f7ccb55b67101ddb9def951a6d6f9dd4cb108fdd9e65f0f21d82723d1b093a22","src/zlib-ng/arch/x86/compare258_avx.c":"8b2838d168de4608327f25fe52d53763a82413ee911d87947d3fcd72c7f9bf26","src/zlib-ng/arch/x86/compare258_sse.c":"b5049722ffd4a43a96868eeba5e000271cfc5fcbf3c2657026ead15b1df28a10","src/zlib-ng/arch/x86/crc_folding.c":"75199cdd06ec2f8f43bf38583b2c4d98bbbbd924e659267fdc1fa5134f1472eb","src/zlib-ng/arch/x86/crc_folding.h":"939212546611917e9e066e8ed30cdda95680ec1f5fe0890cc4865b4e6d7fc215","src/zlib-ng/arch/x86/insert_string_sse.c":"9e84a75b6a565422eb105261b6729d2a02b89133bd14372c949d5381b5deed3e","src/zlib-ng/arch/x86/slide_avx.c":"5e448e439ac24e7cb10eee176ca37f2c63f73c135c0a2af040e232bad490997d","src/zlib-ng/arch/x86/slide_sse.c":"1946cabb634c905fddef0a22b2fad19dfd99110169567c3beceef71145b2e316","src/zlib-ng/arch/x86/x86.c":"1af56e27b2e951e1ad1344e62c2f7a8c49a776fcdd1cb0f4ea9d6152118a479e","src/zlib-ng/arch/x86/x86.h":"4d2d20ea0087089141e250e77bb3d419954b9092810028b151581b9115a5fe8c","src/zlib-ng/chunkset.c":"c0dbc7abbdad5137a9efb2b0a76a212e77d4bf44beebe721c68359fa83002ff2","src/zlib-ng/chunkset_tpl.h":"35d15e97bd72d4e03dcec3ee804a08ea6a74faac2ef835caecc0e38bc9daf0c0","src/zlib-ng/cmake/detect-arch.c":"a9509327c2f4395955466b0acce453c29592d4686022714cb9e8b411d7e60c29","src/zlib-ng/cmake/detect-arch.cmake":"9cbb09b297f79e94b55fffb9acbafbee8d6761e854d818f1a0c686e3fcddf574","src/zlib-ng/cmake/detect-coverage.cmake":"e4e372991ba80a16ad47df2716708a56013cc628aa7ed01573a2360c60610125","src/zlib-ng/cmake/detect-install-dirs.cmake":"87031a40428a104f5cf38ecdb8a5028d8c679cfa772a58adde8380c809b34eff","src/zlib-ng/cmake/detect-sanitizer.cmake":"5e6fe6d2d877540811313f0c8e9884adb21a9ace2e24f23190f0fac1d52dd2b8","src/zlib-ng/cmake/run-and-compare.cmake":"dc45eeb6d3e4854049834ec1ec2891342646c7fb803a0b6c2644d6316f89b668","src/zlib-ng/cmake/run-and-redirect.cmake":"2de9c784da3e04331465a3c56125b9c7d8e74b898b4cf85353aca196f90ea9bb","src/zlib-ng/cmake/test-compress.cmake":"3f37319963a80a31f752fca1c82571d552fd4701326bc40fdb02b54ec3f7a3f0","src/zlib-ng/cmake/test-tools.cmake":"4dcf099245085ee2b6d8ec41620bca3f7b718365dbb9bb0ad23931e83bf36aeb","src/zlib-ng/cmake/toolchain-aarch64.cmake":"8d7ba07ee1cb9fbc7817da1c5e74ce6c85ff81c10962a33941f0e24471956e59","src/zlib-ng/cmake/toolchain-arm.cmake":"0b0ab2b1093ef851c3dbd6fe53f855628df0778841a488aaef85d2c70f04a257","src/zlib-ng/cmake/toolchain-mingw-i686.cmake":"6551576324fed6ccedffcfe8da762402dc863c20a2789a9b0030b9d32e15a15f","src/zlib-ng/cmake/toolchain-mingw-x86_64.cmake":"ec7bf5c8640fb61d2e30f8db7b588ca9b66da92d4a59e88ce16c5fc7f9ce02b6","src/zlib-ng/cmake/toolchain-powerpc.cmake":"6373abe883a99616aa51422a9b714894dc521211be49502463576f58d3d26b2a","src/zlib-ng/cmake/toolchain-powerpc64.cmake":"328d1ea039a30e03ee9a552858b9f180b3da2614b712f618da1a0fa98f30a53b","src/zlib-ng/cmake/toolchain-powerpc64le.cmake":"ec90270bd1f4aa649abddddd2618168d399d58a1c1c35b3d8d909e570eb9be1c","src/zlib-ng/cmake/toolchain-s390x.cmake":"cb634252c21c4f55d06cdc49ce522a5546aae592daa0f12aa4282c0aef323828","src/zlib-ng/cmake/toolchain-sparc64.cmake":"d70d39760a23886ebd1c5a1a87651bfb47a9b24def9e7955ee1cbec60b40925b","src/zlib-ng/compare258.c":"56bfd48d5ff9ca422fbb728df7a373436c73796561dff118c7d4039fe70d29e2","src/zlib-ng/compress.c":"1abf5b13e3e805becc14f4f16dad9bf816f4fe41754b1abf75f670dcc84567cc","src/zlib-ng/configure":"681d5b1303aab0523334c90ff049757e7ee6b2683f2411204b7245ba4adca4b2","src/zlib-ng/crc32.c":"98440be8a99381151a2d740f2e2228e8c1b23b9193c3642c52a4e34799506336","src/zlib-ng/crc32_comb.c":"78cd1a3d31963bfa5bd9d476250b2bb7777b12b6ebe0475acf021ca794757165","src/zlib-ng/crc32_comb_tbl.h":"d6615d209d6c7d5248c6f7fe4e5dbded13c0eb87997b37693032c2902927407d","src/zlib-ng/crc32_p.h":"1fa91375a18e090c0a0dfda39de3df36346a0b1be36c808be6b6c29c32eba922","src/zlib-ng/crc32_tbl.h":"d629378ba38ff5775095b64e277bcd41c4b89fab9b5647a9fb29e15da0db0161","src/zlib-ng/deflate.c":"1a5ff34bf68b88e30f578ce7b15dd996c05fed7bf42f58f4616af470ee18f103","src/zlib-ng/deflate.h":"a074e9a5dd5d689db63655251d6a0948e7a7c0c4a4f6d0ca60bfe18291f3c34f","src/zlib-ng/deflate_fast.c":"b3b261b3a02b089599fcd9448965ef5d8e8b0e8e9556857357c9632930c7c748","src/zlib-ng/deflate_medium.c":"1c3d95cbac76052d39595ea750c5536541c18302b9abb398c27b58955318bba8","src/zlib-ng/deflate_p.h":"95026b1b48aa78204381b32617dd44e8c820c9bb21b415ebfcb33e6b5255233e","src/zlib-ng/deflate_quick.c":"280905a191d2b2a7274f2453ac537e01a0fb6e7540a0b212c1514bfb8c9415ea","src/zlib-ng/deflate_slow.c":"a2c66723e1e71ffd6ff856407459ab311a4c6546ecf50285081fc7afcd0ccd2e","src/zlib-ng/doc/algorithm.txt":"992590931e982c0765286c2d83f6e9ff0a95aabb08e28c30c52bae3e8c4bd5ad","src/zlib-ng/doc/rfc1950.txt":"8f0475a5c984657bf26277f73df9456c9b97f175084f0c1748f1eb1f0b9b10b9","src/zlib-ng/doc/rfc1951.txt":"5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009","src/zlib-ng/doc/rfc1952.txt":"164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67","src/zlib-ng/doc/txtvsbin.txt":"47c273bb22c9773248d380549a330e5c262266b1292154b0d3014f731cc73f47","src/zlib-ng/fallback_builtins.h":"f07e83c5c444554577c4240ff7722057ea2a689f6baa0f9e8bda32b9a46888ca","src/zlib-ng/functable.c":"d3747a4674ddbc903ab1d06efe63a1c4b52bf42f7dd38cde3701fa82b1d953f0","src/zlib-ng/functable.h":"e5a2d0c10411d23f04295bcb9ddb9889388974b723caef65aa5c4ea4739f4aa7","src/zlib-ng/gzguts.h":"cbf2afc8a6183002254a73cabe8376e54b1aea2ba042e36138f292c9cdb95d5c","src/zlib-ng/gzlib.c":"5b5bea4f319e5d0a96b92aa431fb33926686cd20686c90d75e42e1481872bbcf","src/zlib-ng/gzread.c":"fc4a187ba45ceb7b4b50f4f8dedc7685fe8687e6f034638a6437bebf71d51a13","src/zlib-ng/gzwrite.c":"7c86058ae23f856c099e2663a5676c97cfa4fb5df9b92893c94076ba4aa9a56b","src/zlib-ng/infback.c":"97a35de1a3d3bec50e112853e03bf1628cbed3b0fb84459cc423e3f9f61fbea7","src/zlib-ng/inffast.c":"701519ee11d39cdf4e808395722415c42ff2be9445f66408fd879370f3242b57","src/zlib-ng/inffast.h":"42e74a92b496ab0726be317e8497a12bf3c3cf3d0d533440ce65befd3929c71c","src/zlib-ng/inffixed_tbl.h":"a94225335396245e9f0ccb2e9b4b334fe7ee0111ed8e32a26bcd52187f364314","src/zlib-ng/inflate.c":"a665bf717ee257a16a8ab993241f2cf9e71d49882addddb9518b88186f82a5cf","src/zlib-ng/inflate.h":"eb25527d1bdedaa45167926dce4c39d9aaa3147b0f4a95f38f5916528c30a09b","src/zlib-ng/inflate_p.h":"4a94c51194da119770cf662ef289994f0c78d95184d54d6ae5d50a393e8f5a62","src/zlib-ng/inftrees.c":"d1d88f98f9129c87f3ce1d6de5bea3ec867de23b1b2bdd585257d231aac82a4f","src/zlib-ng/inftrees.h":"624c6653a454447c6274adf922430a19c96ef73c7687e4559d247ff48970bab5","src/zlib-ng/insert_string.c":"aa22ba53a1e75821499809277f9ca0e5ef92b07a618136dd11ae1734e233b7c9","src/zlib-ng/insert_string_tpl.h":"1ceba9903324d10aad6e1d83653c4d534a5b06fd09076414a06215482be00bac","src/zlib-ng/match_tpl.h":"eeab4c6eea8511a7579738e622af062ad16f4016312e93ad34bc5903d8b3c4a1","src/zlib-ng/test/CVE-2002-0059/test.gz":"60bf96b8f433bd7e057ce3496aceaccd70ec80f596a4aa8bcc7786056705ce66","src/zlib-ng/test/CVE-2003-0107.c":"1bfbc88dc501cd92b8b26bd8944af6b150b376ebfe7241d90e2b93109be3d68c","src/zlib-ng/test/CVE-2004-0797/test.gz":"38caae524705f676bde13a8df9fc8c7d2fe105ba6bdbab62a405b0276fd3aa2e","src/zlib-ng/test/CVE-2005-1849/test.gz":"e4d5a60617df4b5dd44eda94751ce1eacdb325792bba6e3cc4676719a3adf742","src/zlib-ng/test/CVE-2005-2096/test.gz":"8f702d4861aa3ec98ac03a59ff26b430939630cb5cd4266d2658d3b836d576f9","src/zlib-ng/test/GH-361/test.txt":"358497d0a7251ea42101dc77b02337f46fd89af09643a8288e2a3082e5d24128","src/zlib-ng/test/GH-364/test.bin":"af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc","src/zlib-ng/test/GH-382/defneg3.dat":"b22bef6b7392401c9e7b079402c4a4074053d7a914d050400e37fd7af6fe26d5","src/zlib-ng/test/GH-751/test.txt":"b83d833803b7bc3124fb2a0034081f0b999ad10c33a8dfa3bfd181dc078ae3ee","src/zlib-ng/test/Makefile.in":"c3b6a1ec62838c140a78bc361448d5739756bbfa3bbbf1ffa64c342599949701","src/zlib-ng/test/README.md":"fc485cfaaede6b3d3dc61fdd17cc7eee715c35d6f62e6e502f9251fd1b5edac9","src/zlib-ng/test/abi/ignore":"02aa87f77656dbc1fbddd23f436cd15465a92df0722da4055cae1bc8bf013097","src/zlib-ng/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi":"f5e91f25b558a891fecbeb6e2e9575698630ab700d055a38f3bc4fe66257f513","src/zlib-ng/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi":"038337383cf780587d810cf5400d632f3a1f8517e63ac4a71b6e5224db8b1413","src/zlib-ng/test/abicheck.md":"fa5d6d33ff0fd95eefb7c6c0c7f67351282e6eda20c4e38842235a610cc10382","src/zlib-ng/test/abicheck.sh":"b23ee3678acb24caf36fc8402a07452de73c50640ebe641f185c7f9d5ea257e7","src/zlib-ng/test/adler32_test.c":"db3e8ad9a4e2ecce0c052b0bfe19834d3ff2fb2e9239cc3438a2c95db00b1d21","src/zlib-ng/test/data/fireworks.jpg":"93b986ce7d7e361f0d3840f9d531b5f40fb6ca8c14d6d74364150e255f126512","src/zlib-ng/test/data/lcet10.txt":"938e69e61b3411d8a9e2e630f4265000d810f3dbf66bac58cac19493753526ec","src/zlib-ng/test/data/paper-100k.pdf":"60f73a051b7ca35bfec44734b2eed7736cb5c0b7f728beb7b97ade6c5e44849b","src/zlib-ng/test/deflate_quick_bi_valid.c":"0e00da0e048c46204c39aff4b8fb79890274d3c6183a9409aefd5c93e4e92a48","src/zlib-ng/test/deflate_quick_block_open.c":"455bd347bb88debdfacb409846170274991ec9ba71c52b8fd0e526daf57265eb","src/zlib-ng/test/example.c":"8bfad1221a8df5b6202e11f6be4bae5dbccd8a24fb7bbd8dd88e7ecd318907e7","src/zlib-ng/test/fuzz/checksum_fuzzer.c":"3a15479f2cb40b6c5760dadb246328fab7315f3e3b8e28c1bc246c9b9a867c69","src/zlib-ng/test/fuzz/compress_fuzzer.c":"1ab70608075c4bc60f89aa2f327cff88362ee7b1d31da88ed54ca51e5f99e5c9","src/zlib-ng/test/fuzz/example_dict_fuzzer.c":"042621053050f0fde90a0428cd1afabda8cc7c3fa59e3e0a55c43ab1e03d3988","src/zlib-ng/test/fuzz/example_flush_fuzzer.c":"f12246a184dcfe0a19a98cdc742a1fe8da388ad20b406635d63f1fa10d45b9ca","src/zlib-ng/test/fuzz/example_large_fuzzer.c":"f490abcd332fb4e7921292adf6876d38d7f71c8d2443212c781ba88957ff9303","src/zlib-ng/test/fuzz/example_small_fuzzer.c":"a9b3436b291ace821b6013311a1100e19a9e1c67fefd3f97dbd60688f9bf22b1","src/zlib-ng/test/fuzz/minigzip_fuzzer.c":"7b0e7da9b6c60f3b3a13f140cc445050d9e8958d4f59cbb9a498c08f3a53adab","src/zlib-ng/test/fuzz/standalone_fuzz_target_runner.c":"306e8ac4e08ea72d18ffae8c908abfef8c6feedf83b068a7ec675ade6a5791a8","src/zlib-ng/test/hash_head_0.c":"d88105a80e756b7206a20c7b2490a2e7e743a2ceb1f20d3e433ce9848f054e1b","src/zlib-ng/test/infcover.c":"b9acffc102fdd140941073ca47e30c938aa937b4929061500c36ffba12c86449","src/zlib-ng/test/minideflate.c":"93de8ffcbe7c414abf3ea36acdf729bcedb40393ec7bd10b356ebe225406e173","src/zlib-ng/test/minigzip.c":"291e2ea30778a3e829b96cb47211e89494ece036cd74591178710b4276c9b48f","src/zlib-ng/test/pkgcheck.sh":"75b3155125f235e27ee434d76b6f72bd825899b55f6d59ef2d032fe67a2896ed","src/zlib-ng/test/switchlevels.c":"c30ae3d27ce6041934532553719622e7ed473541aa7bdad8d11d0c55e5220f14","src/zlib-ng/test/testCVEinputs.sh":"5de6198444c16726f8e0a8f2beb5b89c5ae7e7e3736ce760b9fbc719493e7e4f","src/zlib-ng/tools/codecov-upload.sh":"ec7a8f1405820810e486e3d7e2fda7eb958c17877b0000b93abdf09d87732a2f","src/zlib-ng/tools/config.sub":"32186cfeb5db62c99e1dfbfb07f24c1a50977447b4c26d2907021c74422a70d2","src/zlib-ng/tools/makecrct.c":"55c8f7b8e29393e95988a29de8cb1a1bdf2738a69d53627bd0f9d7bf169bf0a8","src/zlib-ng/tools/makefixed.c":"bffd02540231304f9bcc755b8cb9ae5cfbc48975857bbb4547f1d6acce21ef57","src/zlib-ng/tools/maketrees.c":"2dbfe34691dde327618be496b380fc91daaa30474352815773a8b70114b0541a","src/zlib-ng/trees.c":"956ce5b3f3330320cb5baadbf7721572259ec41edc4d8c132a20888b7f6f60c3","src/zlib-ng/trees.h":"24174f3543b01ee1ef370bbf6d15551a21871cded18b2aadf09a71e7904b6f99","src/zlib-ng/trees_emit.h":"f68904e04caee0482c72ea92cc775cabe35a0bf7cffce85566c15ace27666af4","src/zlib-ng/trees_tbl.h":"35f4fd0ec080c1ade342e2dd1b0f5cdc7e9f18990faa48d7a8a69bc318ebe607","src/zlib-ng/uncompr.c":"4ebb486b27930f8a6ec4a3cc90a207d0bcf8a4779d1dbf3b2184a2b2a5735cd1","src/zlib-ng/win32/DLL_FAQ.txt":"d2ec63cb4a51886e0813f75bca49a051bede364d855f938e1a7992ab97a79800","src/zlib-ng/win32/Makefile.a64":"775d6902373d1583430b5d7467f001746be323610c89be27e02bbfe0205994f3","src/zlib-ng/win32/Makefile.arm":"7535e022f482920c3fa7a267e84e39ad790d150f72e5c30414baa156c2fdd9b6","src/zlib-ng/win32/Makefile.msc":"deee44d5624890e692d87db311216075e967c3ac8aeea6ffcdcac3d03eea260b","src/zlib-ng/win32/README-WIN32.txt":"a8c2d052960b963a49cee5a2ad891f2ff7b34db038f00985eba4eefc99966261","src/zlib-ng/win32/zlib-ng.def":"f240276caf805a10d024fc6a66efe915c435734c69732818d92fb04d08ab350c","src/zlib-ng/win32/zlib-ng1.rc":"b567a276407998bae40aacd48a50beba87c0bfbae470d28e66331ac99eb575c8","src/zlib-ng/win32/zlib.def":"d9c371ff2677567350386441a2e3d0258010d6502290bbac5ac42ea168bd5212","src/zlib-ng/win32/zlib1.rc":"d7f269379144d65bcd1b67c1065e5d4120579f14ce54ecf246eaba394fa989a5","src/zlib-ng/win32/zlibcompat.def":"73728b9df4379dc70ebd9b2a9f20d6e4ed7c031fa1f351cdeae1de7d1db05bd1","src/zlib-ng/zbuild.h":"f73424f5f10370ffe8f45f6e3dc52dd095ea778153832461d712a838e3a01098","src/zlib-ng/zconf-ng.h.in":"708106f26c4a0d877e2ea644320a2b48b144524b61429c7490e2e742a0c0c1e4","src/zlib-ng/zconf.h.in":"dacec2360fd9607f85bdf651409fa3831dd26f74414d242e812b06c3b9c9926d","src/zlib-ng/zendian.h":"f5cfa865281d2c5d0b097d318500f27daeec346e7882de68e279486d79c52e77","src/zlib-ng/zlib-ng.h":"7a15bda0297b2611da695f895cc57ce44c284b030fe98817281e868a1a86ae35","src/zlib-ng/zlib-ng.map":"e8202981574d814cb2a9f06bca7900d0959c24766bd86681bd3843ab0e71f8ef","src/zlib-ng/zlib.h":"703bead0c02381c8df8d14d805fde913973b2960811f35e2de4f4aaf29ad905c","src/zlib-ng/zlib.map":"e3549810f821d433d57f921ca2fceb8674574f778485255a7dc691bf26b5281b","src/zlib-ng/zlib.pc.cmakein":"17668e07edbe5971043bea26a2f2b92c4c7cf4724620f1156f3ea1436d2aac93","src/zlib-ng/zlib.pc.in":"cf94c9aa44878a62e27c2f75354c08326b3bb5250a9b11496855cf59691177bb","src/zlib-ng/zutil.c":"7544aa2d2cfce4693d4e2a639f0631c3e8b3e7d0d846313be0e250c477e6812c","src/zlib-ng/zutil.h":"c0e9152d078ca1774c93910fd84531b2f593b3a6b1035e4d97a0d28b720ec98b","src/zlib-ng/zutil_p.h":"1e5a2fb8d15212ad094e9a5d5f607f11f8191498b54e0af48d722f92d9c71ffd","src/zlib/CMakeLists.txt":"b87275731cc3ebdfea144187875cea204f555c343279c0f35f2d46d661bfe34a","src/zlib/ChangeLog":"4c9f1a65b9b4be8bf164a97775ef50e4db4e02ea8c9933fdbe629a640691375e","src/zlib/FAQ":"1e8a0078be0ff1b60d57561a9e4a8cad72892318a8831946cba1abd30d65521c","src/zlib/INDEX":"3b4e325d47ae66456d43fcf143ba21ab67a02a4f81be7ef2da480ba30d774266","src/zlib/Makefile":"ef23b08ce01239843f1ded3f373bfc432627a477d62f945cbf63b2ac03db118a","src/zlib/Makefile.in":"5021b2bac4164f48b17c91c8a2e3c225be7ad31d8bfab1bbaadd90370afe9991","src/zlib/README":"7960b6b1cc63e619abb77acaea5427159605afee8c8b362664f4effc7d7f7d15","src/zlib/adler32.c":"d7f1b6e44fee20ab41cef1d650776a039a2348935eb96bcbd294a4096139be3a","src/zlib/amiga/Makefile.pup":"a65cb3cd40b1b8ec77e288974dd9dc53d91ed78bbe495e94ccc84ddd423edf1f","src/zlib/amiga/Makefile.sas":"0e63cf88b505a1a04327bb666af3a985c5e11835c0c00aed4058c0dcc315d60e","src/zlib/compress.c":"5c11e1fc22e219cb986f6fa9e4ba939315227e84aef042737d38ec668b89b6d2","src/zlib/configure":"86b38f27f31d2fec76d9355872550dc63cb3949774473fd6313c5a3fd1def0e2","src/zlib/contrib/README.contrib":"ca39b78bd7ad84f1df7b0da90770c5b3fa4c8e2c75d132e9222812fac8839630","src/zlib/contrib/ada/buffer_demo.adb":"469cf566a6965767fee6b987a239ed8cedcc66614940d45a9b434331fbb435ce","src/zlib/contrib/ada/mtest.adb":"41b6f31684770334afdc4375871eb1408542f37a823a073556fdbfdb63753160","src/zlib/contrib/ada/read.adb":"fa5b989aef0c5715a3fcb15de93985f7f10aeb0a7f5716745c95ed820eb9af9c","src/zlib/contrib/ada/readme.txt":"8fe9e5303f2e8e8b746c78250e74b7c4aeb7ce6212fdce751fc3a0ce56a47fe2","src/zlib/contrib/ada/test.adb":"5e3abe79b387e09a9a42bd0543105e228f39a335240cffc33d71f0ba66ff2511","src/zlib/contrib/ada/zlib-streams.adb":"f45988e2bac76eb25a0dc981f46576e7432c35dde1790bbc2b650f0090b7fa72","src/zlib/contrib/ada/zlib-streams.ads":"969e8edb0611810fb52159dcb7c40228f4e5da810a7a3576b778116a93038c6b","src/zlib/contrib/ada/zlib-thin.adb":"03d89244ee5ec9771d9b5050e586c609f851af551b2e64eb151f1d5be0b63ae9","src/zlib/contrib/ada/zlib-thin.ads":"631ef170bde16c3ca8d412b54a0e519815b80197d208f8f393e6fe017bb0968e","src/zlib/contrib/ada/zlib.adb":"c9ca5dc34fbcdf06e2dc777b7e9dcd0ba31085b772b440eb0e12421323ab672c","src/zlib/contrib/ada/zlib.ads":"02634bec0d5e4c69d8d2859124380074a57de8d8bd928398379bfacc514236d2","src/zlib/contrib/ada/zlib.gpr":"859bb69dce38dbe9dca06753cf7ae7bd16d48f4fece8b87582dab8e30681d3de","src/zlib/contrib/amd64/amd64-match.S":"166007f7e9adb58fe8b83d85bbfe823f5e05858ba1d06edf637b78886caa2c69","src/zlib/contrib/asm686/README.686":"c21cc7147c956ecae17dd084cb41a206b086216fa521012871fb07fafd203c6d","src/zlib/contrib/asm686/match.S":"873799062495629f21cd3f779ea4b927add7aae0144e32d3594d9ce70185e99d","src/zlib/contrib/blast/Makefile":"17d5d26c24bf51cad51045a38ffb73cc3539d29e89885aa249fcfd45a8659d5c","src/zlib/contrib/blast/README":"baa763ae03d88ef7ece6eb80d9a099b43d0b57639d6d281e1c7c6ca79d81daba","src/zlib/contrib/blast/blast.c":"1ab3e479d342bfc144167b808fb00142264bc50f24a110ca88cc774e351c218e","src/zlib/contrib/blast/blast.h":"4d4e3e6f893316f0be77bfd642c857a77f1fa2925acb5df9753e543d35aa3a6a","src/zlib/contrib/blast/test.pk":"5f5c262c545574a5c221132d5ef832478d222d70b015341795b3860204140d7c","src/zlib/contrib/blast/test.txt":"9679b2c98e1283222d0782b25a1c198dc64ba9ebd1addd6dc6f643a45947cda3","src/zlib/contrib/delphi/ZLib.pas":"1b20e173443a68c189cdaa4795620fb1ac165d9e61a27a1ed2cf690f13530d6f","src/zlib/contrib/delphi/ZLibConst.pas":"84bcc580bdf397e570f86f3f5a5b8c7bf537828f30b4b72648b81911f6bf5095","src/zlib/contrib/delphi/readme.txt":"f7420ed2de77d4b498eefbbe6402a1d17dc2d411735289c78a265c7f10fdaee5","src/zlib/contrib/delphi/zlibd32.mak":"850e91b6c9ea05de61a411cbda16fa0f10118cd88bb32c4b7226988776f8d511","src/zlib/contrib/dotzlib/DotZLib.build":"b96137097669644ecb9f42cdd3399d1fce9c512788374609303f7e50abf597f0","src/zlib/contrib/dotzlib/DotZLib.chm":"20d0e3edd57f849143255a7f0df1cd59d41db464a72c0d5ab42846438a729579","src/zlib/contrib/dotzlib/DotZLib.sln":"a979198c5b8d144c1ac8f993bfb6f4085d135aa58ca9dcf63ebabf52b5c695f7","src/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs":"314afcfb339ea95f5431047b7ab24631b11c3532c7ce5dc2094ed0cf80a7c16d","src/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs":"e7c047a2c3bcf88d3d002ee3d2d05af414acf53cb4451efacc0f2e95a474ea0f","src/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs":"be84c9736fe7bdc2bfae70466d8fff582504e928d5b5e110fd758090090c8cb7","src/zlib/contrib/dotzlib/DotZLib/CodecBase.cs":"259bdda1b7d6052134e631fa24bfd9dca6e2362563496c8b85257b56c848908c","src/zlib/contrib/dotzlib/DotZLib/Deflater.cs":"06ba6696a3c15c53ba5fd5a1c2bf50b51f217010228fc1e4c8495ee578f480de","src/zlib/contrib/dotzlib/DotZLib/DotZLib.cs":"9837fe993fd631233cc5e53ff084d86754b97f05ec77c54b0764c2706f186134","src/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj":"21606db31dfef6410dd438b73f1db68856eacabcce6c0f0411fc4f17e17001f3","src/zlib/contrib/dotzlib/DotZLib/GZipStream.cs":"8d1de9755c77046b4ac71340a0a54434ebf4fd11b085c44454d7663a9b4df1c5","src/zlib/contrib/dotzlib/DotZLib/Inflater.cs":"9016ca73818f5b6a28791abc3af6da7c4d2773b6a3804f593f6d5737a62b99ad","src/zlib/contrib/dotzlib/DotZLib/UnitTests.cs":"ad66ac08de34d253e9615b96a745f3dfeda93f4a978d65d5d3ddb9d0d9b3e099","src/zlib/contrib/dotzlib/LICENSE_1_0.txt":"36266a8fd073568394cb81cdb2b124f7fdae2c64c1a7ed09db34b4d22efa2951","src/zlib/contrib/dotzlib/readme.txt":"d04972a91b1563fb4b7acab4b9ff2b84e57368953cc0596d5f5ea17d97315fd0","src/zlib/contrib/gcc_gvmat64/gvmat64.S":"22ff411b8b1d1b04aeaa8418b68245400267dc43c6f44104f6ccd37f0daee89f","src/zlib/contrib/infback9/README":"890288f02bb3b1f9cc654b87a07fcea695f90f6b9bd672d25bf6be1da2ec1688","src/zlib/contrib/infback9/infback9.c":"0a715c85a1ce3bb8b5a18d60941ffabc0186a886bcc66ba2ee0c4115a8e274e9","src/zlib/contrib/infback9/infback9.h":"dda2302f28157fe43a6143f84802af1740393572c2766559593996fd7a5a3245","src/zlib/contrib/infback9/inffix9.h":"84a2ba4727767c18af6505f0e81d9c814489c8b9ed330a25dad433db72997e43","src/zlib/contrib/infback9/inflate9.h":"32a907676cc36e27d0fdc0d99adb83a0b23f20ab61896269216d40fecf08d349","src/zlib/contrib/infback9/inftree9.c":"0c7f10396703b230c504207fe1595a2f2f8ba9c43158c4bd79d5b22ca36e04e0","src/zlib/contrib/infback9/inftree9.h":"8ae61d52e50d2dbdb0378548ecc54fcd88f108c8b6fc30562a3ebec1ca6a599e","src/zlib/contrib/inflate86/inffas86.c":"6f266f3c7e0faca653256d0189c0f00d7dc0b062d02e25df4e1202e49369595c","src/zlib/contrib/inflate86/inffast.S":"70777bd21526680005fc34f086d108af49e2668ad86d1749e8e8100a81bfb288","src/zlib/contrib/iostream/test.cpp":"0f3c77e013949eb9c91e6b690ea894e19d97944d6b0885b82806fc3ad99680cf","src/zlib/contrib/iostream/zfstream.cpp":"8ebb9b3d521cc3392953f27658cf1f6dcb763216079f69a1518ec5ca0e42a63b","src/zlib/contrib/iostream/zfstream.h":"4369c35e66f63f52ca4a5e1759bf720507ccabb8f3f132e2f18e68686c812401","src/zlib/contrib/iostream2/zstream.h":"d0343e0c57ff58008b6f29643d289c72713aa2d653fe3dcd2e939fc77e7e20b6","src/zlib/contrib/iostream2/zstream_test.cpp":"f789df183cc58b78751985466380c656308490a9036eb48a7ef79704c3d3f229","src/zlib/contrib/iostream3/README":"43ec48ecbd95a8c45db20b107fac73b740bb11595a4737329188f06b713972cc","src/zlib/contrib/iostream3/TODO":"af5ebc83fb88f69706c8af896733784753dead147687e1c046f410c0997fd88b","src/zlib/contrib/iostream3/test.cc":"8e17fc48dfdbc6e268838b8b427491b5843b6d18bc97caa6924de9fad7abe3da","src/zlib/contrib/iostream3/zfstream.cc":"8cdd67ed0b13c192c11e5ea90e9d5782d6627eb303fbc4aa5ebda2531ec00ff8","src/zlib/contrib/iostream3/zfstream.h":"1bd74778fac45ee090dfc0f182a23e8a849152deb630606884b2635987b357b1","src/zlib/contrib/masmx64/bld_ml64.bat":"1c0561908a07ebdff271b12ed757241e1813d3db0f3551501b2595c23f0833aa","src/zlib/contrib/masmx64/gvmat64.asm":"390c1e6d63cb615b5ba042842738953f9cdc688b2fe35aaca981fd3fae213f3f","src/zlib/contrib/masmx64/inffas8664.c":"f6c585e43e6e524107566b1f10104949d0ef902159ac8203e1d98e50d4bedd62","src/zlib/contrib/masmx64/inffasx64.asm":"8448d0041fe6e8f4188fe5916181a1b274c6d35d75cfb28da60cf4f1edde44ec","src/zlib/contrib/masmx64/readme.txt":"9bb66b5028100855683853f12da0be479c7bccf74365fdbf37da2542edff9927","src/zlib/contrib/masmx86/bld_ml32.bat":"b0b05b62715d4a81a7db5b7ca4a372d109ec95634c9d3bef9e0041ff52de22fc","src/zlib/contrib/masmx86/inffas32.asm":"78d2cc88f8ed0e32ef960efc987c257bc1688afe7d031a8ba18761e95a6a7c3f","src/zlib/contrib/masmx86/match686.asm":"9e9bea3b5517b089da7d39caded07982746a33f94f0907ca7e8afefed7be36b6","src/zlib/contrib/masmx86/readme.txt":"1f29a04e0227b74e20ba1b7c764b3ca5bf596dd2c06e89bc19a05fb8f9689778","src/zlib/contrib/minizip/Makefile":"087034de3dc0223b29e64bb3a4fc3eda7b948e93d2a9ff154aecf9fed2a1eb5b","src/zlib/contrib/minizip/Makefile.am":"2313a3480a2c3745fa7ce216829cd0367058907d3a0902e5832c66c84a2fdfc6","src/zlib/contrib/minizip/MiniZip64_Changes.txt":"302c62b328647f5472fb7755249a83459be7f8ffb1fae07e8ba318fce8f4126c","src/zlib/contrib/minizip/MiniZip64_info.txt":"122719c32ef1763a5f6ba9c8cdefc1d78a76f7156b09e7b6f69b73f968e0dac3","src/zlib/contrib/minizip/configure.ac":"35330dc0c6188127afd339829d91b19739d23bf3b7301bfb04f775a6fcbbdad7","src/zlib/contrib/minizip/crypt.h":"8e872b60255b8447da99885c7159c2e1f1bb8143523bdbe71784e60f98bfd67b","src/zlib/contrib/minizip/ioapi.c":"66b39c27042f6ad12cc12efb0c82cdf100c6640b5fa959b8b866e252966113a9","src/zlib/contrib/minizip/ioapi.h":"8655408534b78dc0889a45f9359fc6d2d5c8e8d8443b81ede596f954c720ef48","src/zlib/contrib/minizip/iowin32.c":"2c05bc374d3d847c6a9f29eac9d674abba7659d1e91e34e172248fcb5c274d51","src/zlib/contrib/minizip/iowin32.h":"586f22b9c3c64da253ce2b518e0fad61f19a7b47b289fc704cc9708242294c49","src/zlib/contrib/minizip/make_vms.com":"65736d9c4888f2373d3db0a13864d150c5040453f5bc2a5c8784379a7ea67590","src/zlib/contrib/minizip/miniunz.c":"ced49f20c62536a8ffb270b35cfa4994a1dcdce45f8cf059b941c94ca0022666","src/zlib/contrib/minizip/miniunzip.1":"66d8684392167091ef0fe01598d6a0daa26e7e448e2df6c3cb257487735b83f7","src/zlib/contrib/minizip/minizip.1":"5404596e8e5587a52f563906119f32ceee30a6d97a966afa5c7afbe4d373e210","src/zlib/contrib/minizip/minizip.c":"fdfcf83979ef2324c1455d369e8add8678c804939d412ce53f8b024578ceabad","src/zlib/contrib/minizip/minizip.pc.in":"8b6670b42d8e5e519e1cc89db093efc07ba23cb1ddfedd3c93ff2df08c3ce8ac","src/zlib/contrib/minizip/mztools.c":"cd887c4af6d20823bd15f24008b10acf01969b4165d7848656bde843a92428d7","src/zlib/contrib/minizip/mztools.h":"6f82c52279e8f79165f4446be652e5741a49992ac58632470335aa34c564072a","src/zlib/contrib/minizip/unzip.c":"497adf676b1cae2a7afa834e4aba86383f7b697f5fdd03a8179ea9024a431cf9","src/zlib/contrib/minizip/unzip.h":"d8dc58fc0121b6a4b98f3028205bb253f956b1ddf791e9ced3cf44892502a01f","src/zlib/contrib/minizip/zip.c":"00f403cb7810578b4b2687dd55fb132c850c3630fba2f3704a8ab896fcc8209a","src/zlib/contrib/minizip/zip.h":"96163fc140e4bf08752e014d20a1eac3f5adcdc408366f6d79c1895f2599cf08","src/zlib/contrib/pascal/example.pas":"d842d456ecb6ff80e34cee2da31deb2072cc69ca837497bea8b8bee203403474","src/zlib/contrib/pascal/readme.txt":"02f997c37991ddae0cb986039f7b4f6fc816b3fd0ffd332cad371d04c12cf1b9","src/zlib/contrib/pascal/zlibd32.mak":"850e91b6c9ea05de61a411cbda16fa0f10118cd88bb32c4b7226988776f8d511","src/zlib/contrib/pascal/zlibpas.pas":"28b90aeeb3da8d1f6a98ab9f5f1603d08aba5bfabc50827d3f15e661268a51cf","src/zlib/contrib/puff/Makefile":"d9d738030464aaae354196c14fd928adf591832fce7d71ac1977c1d8d4923a4b","src/zlib/contrib/puff/README":"aceca4bc1bce7d9445b8bc9b6640c672d95708185f6070d3a3baae7a9d102caf","src/zlib/contrib/puff/puff.c":"6d0eef92e115a42e570b79d8b07a04af5ccbd6b3f3fbca9cbc61c49db9c9df43","src/zlib/contrib/puff/puff.h":"969b7be2a930db0cdcb19b0e5b29ae6741f5a8f663b6dba6d647e12ec60cfa8e","src/zlib/contrib/puff/pufftest.c":"8ee0da78a1221a3c2036e22eed06c2faa27a671a46565a60e10111d4ee9c30ee","src/zlib/contrib/puff/zeros.raw":"b7b0887089f7af1f6d1e0b4c0a1e8eddd10223b23554299455c6c9be71b653a3","src/zlib/contrib/testzlib/testzlib.c":"c6c37b35c6ecc9986a9041f86d879cc37a9e4d8315af9d725071eb3b2cade0c5","src/zlib/contrib/testzlib/testzlib.txt":"2359bbdc84eb8a04e0f1cd16cd81a2896e957f2ad58dab3ca78ef55b7d0dc577","src/zlib/contrib/untgz/Makefile":"8f5ab1564813e091cea8f1bb63da32fd80ac763d029277b0cabf50f60aceefe1","src/zlib/contrib/untgz/Makefile.msc":"d0f537de11d9e0e36e2a98b3971c537265f4b533b4c48797094365ad9ae8388b","src/zlib/contrib/untgz/untgz.c":"9a12d774301d252dcd38bba07ac369319da4c04c4fef8a50fcbf40aebf29c2a1","src/zlib/contrib/vstudio/readme.txt":"2a9ca40b68274f4d37649dfab9e5e867a000883592b4ab8fdaec8425a63052c3","src/zlib/contrib/vstudio/vc10/miniunz.vcxproj":"dd607d43c64581172c20c22112821924dfe862f56b2e5eb8780bdd0714d9527b","src/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters":"c3db9f97952683e688ad83c13bb94c816ac3e6b5f277fdea545b0650c125aa6d","src/zlib/contrib/vstudio/vc10/minizip.vcxproj":"af73f2cf8ae51e65e85342faeb40849a2310c97bc77def42b38d7070460a6cf0","src/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters":"83db58d87f5d7ca84b6087aa1f62b15cbc296194c8cf76e47a271f9077b4f3bd","src/zlib/contrib/vstudio/vc10/testzlib.vcxproj":"1525ed0893db56db44ec68675c8da3c229dc7867166dfc0428816783d16ad43b","src/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters":"d7e04ffa467d417dfa3c0f1c64234cadc84882101bbae483f0a0f5d3d6b566a7","src/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj":"3f317d8964f17901c3e68bff5deaec10b6ccc50a572235999e8097292692984c","src/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters":"682a485f0184aabba94e12e1b284499195f37c176d43ecee0484f31e4d636f6f","src/zlib/contrib/vstudio/vc10/zlib.rc":"e8b581eb16930e0213d37143a5f17868839b22c758b23981a29484e17093c494","src/zlib/contrib/vstudio/vc10/zlibstat.vcxproj":"2a38222d6c034d7e0b843c3f0540dc6c53dd48f942ae29f31620ca0327248c8e","src/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters":"d9a2c381e51e4d6f027f3517db7db81656e43cec02ed9abf267a0fde6f360180","src/zlib/contrib/vstudio/vc10/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc10/zlibvc.sln":"e659860f705f31b87ea9139a3cb4ebe1561e120bce495383a54614fc82b49990","src/zlib/contrib/vstudio/vc10/zlibvc.vcxproj":"3108badf710e2f4a64eab4e7deae6642fb68cc0d94018e537149f1761e215133","src/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters":"58404ba7703c68025bec64b8a17ff1fc7f3a35d15d17ae3bcc4fa753f1348425","src/zlib/contrib/vstudio/vc11/miniunz.vcxproj":"746e4c11fb8af4bcd6a9d68ba81ed1dc366a5de3bed56b291ee969ad733a7bb0","src/zlib/contrib/vstudio/vc11/minizip.vcxproj":"340617cae9cf4fcb003308021d3782ec3639e60d62d79a3aafc0a50bb55b061e","src/zlib/contrib/vstudio/vc11/testzlib.vcxproj":"589eec6ef6d818564ead938a629fda50abb6cbf8054b9f66ea780765c1a1b3db","src/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj":"583bdef522b0176829f0d8139ea2a88b9cbc14379d1334f3a863989ed3df9b67","src/zlib/contrib/vstudio/vc11/zlib.rc":"e8b581eb16930e0213d37143a5f17868839b22c758b23981a29484e17093c494","src/zlib/contrib/vstudio/vc11/zlibstat.vcxproj":"51aa752698d96df065a9ece02e293492f681b59a8077f036a5a60367dc621e87","src/zlib/contrib/vstudio/vc11/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc11/zlibvc.sln":"27389b515997defd080519f95aff87e89fcbe8b26d73c5ebb73c544cfef4d60e","src/zlib/contrib/vstudio/vc11/zlibvc.vcxproj":"c3dd05e56159aba411475b83656275872524cb3c2fd24d690397d8b634e7e0ed","src/zlib/contrib/vstudio/vc12/miniunz.vcxproj":"1494af54570f6e93852932956d49a8c25e57b5abc1ac979945605ca9143df9f8","src/zlib/contrib/vstudio/vc12/minizip.vcxproj":"9bf128ed6760ca5f019006f178b1c65f4c7ff122dba8d297b64b0eb72feeb120","src/zlib/contrib/vstudio/vc12/testzlib.vcxproj":"367a06caa399bd09f6b9cb60706820943dd6a6cf05794275baaf421da9c2a0b7","src/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj":"93416510256935d79625dc9fd349cfce6968c062d42a138bec404a26b2f92f5e","src/zlib/contrib/vstudio/vc12/zlib.rc":"92d5d3a4938a6350395934153416a7eb74353cdfb2321f45b9ee0b9b16257f39","src/zlib/contrib/vstudio/vc12/zlibstat.vcxproj":"744ff6ac0d4e2dcdf74c7d33b979fbfd2b18550947eb99bfd46dc6a73eb1c68d","src/zlib/contrib/vstudio/vc12/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc12/zlibvc.sln":"162e0faa80a56d89eea71a0b89377708eec2faa0dc72091cc0abb07fbdea49a0","src/zlib/contrib/vstudio/vc12/zlibvc.vcxproj":"754671c59d8996a846241af76082cc8be1aa5fc079eff530d91a9ab15a0bee5b","src/zlib/contrib/vstudio/vc14/miniunz.vcxproj":"0312511d4a30cea979c4e36edf994a537ed8a9d924f6b5c536cbcd094773c11f","src/zlib/contrib/vstudio/vc14/minizip.vcxproj":"9e7bb7a6ac723e4b2db900627c366f9bb93a351381995d9c69a50c0126f64233","src/zlib/contrib/vstudio/vc14/testzlib.vcxproj":"c3a9369670af4ebea13d036b452be7418591fbb4c03a675699facac5d8dff5d0","src/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj":"69f544898b4275cd3d8e19b8f1f8cb39c1cb98a30cdb033242e4b94c57bfa150","src/zlib/contrib/vstudio/vc14/zlib.rc":"92d5d3a4938a6350395934153416a7eb74353cdfb2321f45b9ee0b9b16257f39","src/zlib/contrib/vstudio/vc14/zlibstat.vcxproj":"9c7c096b47e7875412c98525efcd16db62e094215f0011b9cd739a33ab35d48c","src/zlib/contrib/vstudio/vc14/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc14/zlibvc.sln":"47a50bbde8ca6336cecd8c0e4b65e515fc46ae84c7b61008ac9864162f777286","src/zlib/contrib/vstudio/vc14/zlibvc.vcxproj":"71fb6ef3b079bfdf4182af17e74c3361ead757467edfc591d9cbe303ccc47b52","src/zlib/contrib/vstudio/vc9/miniunz.vcproj":"b2b53bd9e704bfbe769b863acdc2a3368692ca149c4b4ed2a0761b0cd16c6726","src/zlib/contrib/vstudio/vc9/minizip.vcproj":"80a701fb41a61871ce1d25f6b03e571edb6c3abf0aa45375554b6fac52115eb6","src/zlib/contrib/vstudio/vc9/testzlib.vcproj":"05fc5a87682b17690d199f424f57f6ad7767b8dabb29a1039bfcb88bca1b302f","src/zlib/contrib/vstudio/vc9/testzlibdll.vcproj":"25c1cc5319f1c4b7dbdb595c3cfd6ec3ba217818b03b7055ef5ef440b575a43d","src/zlib/contrib/vstudio/vc9/zlib.rc":"e8b581eb16930e0213d37143a5f17868839b22c758b23981a29484e17093c494","src/zlib/contrib/vstudio/vc9/zlibstat.vcproj":"e8653eea37f3bef097eec2caa55e1f698c3c74c959689bc4e97568e88d2bbc60","src/zlib/contrib/vstudio/vc9/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc9/zlibvc.sln":"26e58d4b2cfcd941c367fb2a18537b3b9f002f2ac1278b700ea1129c50501452","src/zlib/contrib/vstudio/vc9/zlibvc.vcproj":"86aa6e33db104c0a0ed4a9f21f0db8572cc7755170217aef18219fdd74b75e9d","src/zlib/crc32.c":"a04af273e83ecc351bf3794974ab2098d8d960df4044b7b44734c41443ee26d0","src/zlib/crc32.h":"407af59d0abfea84a6507c603eb29809411797f98249614fe76a661def783ce1","src/zlib/deflate.c":"11fd6b0328b65c4ad4b5c204d892a97a9083628a7e77dc47836c8e0c799f8da0","src/zlib/deflate.h":"0ca7fb0cf1dd63001c6e9e4ff93c8dbff2fe521199be51a4dda38a11b44919f6","src/zlib/doc/algorithm.txt":"992590931e982c0765286c2d83f6e9ff0a95aabb08e28c30c52bae3e8c4bd5ad","src/zlib/doc/rfc1950.txt":"8f0475a5c984657bf26277f73df9456c9b97f175084f0c1748f1eb1f0b9b10b9","src/zlib/doc/rfc1951.txt":"5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009","src/zlib/doc/rfc1952.txt":"164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67","src/zlib/doc/txtvsbin.txt":"47c273bb22c9773248d380549a330e5c262266b1292154b0d3014f731cc73f47","src/zlib/examples/README.examples":"402d72eb69c2e03a25034f4b3c02b110f0f67149ecfa4fa0e4b2bf0ceb49a8b3","src/zlib/examples/enough.c":"704e273f65b62c5d2eb06d5bb10c4ccffba56544aa477f0e3957e2296c501b78","src/zlib/examples/fitblk.c":"950769163c41aff897ee41746a8685d9aa41073b1307f42da19dabe9d3fc8b85","src/zlib/examples/gun.c":"d60ca6eb0a3e62ee7fb4a1ab69e8d1525ff06b06ce46889cbdfc13fb8f7534c2","src/zlib/examples/gzappend.c":"4182d38bf97ffbdf1110df7f65c0e8fab0b28b1ea36ebba8621c14e8e76f1caa","src/zlib/examples/gzjoin.c":"90b9d6c39a5fc91cf1cc9b96b025a508a8015dc502cd9374c754b44078593f57","src/zlib/examples/gzlog.c":"433d34b71b4e769ece1cceb8bd7d902d2c0a24ccd7550ab1856a5ba87f84f835","src/zlib/examples/gzlog.h":"309556e2d7d39250924946b78e2cce0ac927857d6e1a02cab64e438f533c20c3","src/zlib/examples/zlib_how.html":"80fb647be8450bd7a07d8495244e1f061dfbdbdb53172ca24e7ffff8ace9c72f","src/zlib/examples/zpipe.c":"68140a82582ede938159630bca0fb13a93b4bf1cb2e85b08943c26242cf8f3a6","src/zlib/examples/zran.c":"840ebeb058cd0ca9e92dcb1db665932462a4695fc649b34e865b8d1ad7c5bf77","src/zlib/gzclose.c":"94446cf8cde67c30e64d0a335b0c941fd3fbad2e77f30180d12e61f9c2a5a6b8","src/zlib/gzguts.h":"1ef4741cf10441feeca5c8dde2b6c754f0cbd96fcae697d54a604757289a5e9b","src/zlib/gzlib.c":"5daf11e44149e0aba2956d35f73f04f35dca99c3dfa43f5ad43ec20b336e4a1b","src/zlib/gzread.c":"6f928512cb1792cfeab31a51ff0b211814d2e455bc75290eb31079dc1e5ad2ec","src/zlib/gzwrite.c":"ba3b7b7ad2ff7ef0c19319b8408c333491a4cd495da55d0b156bc73d9ddb4df4","src/zlib/infback.c":"abe44873b5af2ea68ea1d281d915b2800f1832f846d2c05442a4711adbe6f269","src/zlib/inffast.c":"4d496ab2a3d29df5fadc3dbff6067e039806aaceae6cfcd09ea77d46c2b848fd","src/zlib/inffast.h":"7d8c1c873ce9bc346ad6005bb9d75cce5c6352aaf7395385be216a9452a34908","src/zlib/inffixed.h":"237ba710f090e432b62ebf963bee8b302867e9691406b2d3f8ee89ee7bfef9b0","src/zlib/inflate.c":"8b6c599c3563c14c447c47db0d7dc9a16e8c246a078ec95a169ddcebaaebd811","src/zlib/inflate.h":"8ec9ac297790276f7e46a961d4c6f9f944fb1dec92401339ec2666973cc5983c","src/zlib/inftrees.c":"1960ca67384376f65b6ce8c08fdb501f8eb33923e11ef5f61a855708c6cb0a8a","src/zlib/inftrees.h":"c510b36402784b1f898be3b049b923469aa92701de2d9195aed19f6b65c0dce2","src/zlib/make_vms.com":"3064eb153a7684115f1494364f80759bc5a2c227799fdf08df7b9e6e50884720","src/zlib/msdos/Makefile.bor":"292ab363f7ffbc4ae84d37cd9bdffd2dac1003bee52d223a8489844870f20702","src/zlib/msdos/Makefile.dj2":"9208450c2ae6dcbfcc25560b5b9ca763f461e7246e37b0552474edf8fa898906","src/zlib/msdos/Makefile.emx":"c749d6ec7f88e8e639d4f03bdbdcbbe9d1c304210be4c4be621ceb22961d3d64","src/zlib/msdos/Makefile.msc":"0e021a6f42212415b060e4ad468eb415d0a8c1f343137fb9dff2cb8f9ead3027","src/zlib/msdos/Makefile.tc":"2ae12ee2a3e62f7c5a0520d0fbe4adee772bc07fe816002b07ccb43db3daa76a","src/zlib/nintendods/Makefile":"ea5823efe6830132294eddf2f56dbd7db8712244c210bb4968c431b1a91bd066","src/zlib/nintendods/README":"e362426c47b39ff6a7d6c75c6660b20abf076cdfa5e1e421716dc629a71aef95","src/zlib/old/Makefile.emx":"d811f032272aae50123a889297af3a02fbd60d1e42bbef11466462f627ff7b5b","src/zlib/old/Makefile.riscos":"d1a488b160fbfd53272b68a913283a4be08ba9d490796b196dddb2ba535b41e0","src/zlib/old/README":"551a0f4d91fe0f827a31cbdfbb4a71d1f3dc4d06564d80a3f526b749dd104d11","src/zlib/old/descrip.mms":"8ff08c35c056df9c986f23c09cf8936db63ccf12c3c42f7d18a48b36f060cff7","src/zlib/old/os2/Makefile.os2":"6ad247c00f00ff42fd2d62555e86251cef06e4079378241b5f320c227507d51d","src/zlib/old/os2/zlib.def":"ea9c61876d2e20b67ef2d9495991a32798eb40d13ede95859a2f4f03b65b9b61","src/zlib/old/visual-basic.txt":"1727650acbde9a9e6aec9438896377e46a12699cca5d46c5399cef524dedc614","src/zlib/os400/README400":"6f95a1beb0fbf943a3312eaa3dd2c279f1cef93062bebbff63dd37ac9e2aa8d6","src/zlib/os400/bndsrc":"cfe00b1528d5c27813cd6b1ad7aa34b493fd63d615623fb21fd1a7bf99d2255e","src/zlib/os400/make.sh":"143394d1e3876c61c29078c0e47310e726e1f5bd42739fe92df9ece65711655f","src/zlib/os400/zlib.inc":"c501c522185ba1f0506caf90d72f1088b34b2addc169471e949e443ab65e8a75","src/zlib/qnx/package.qpg":"90b5c8364d9dc5ef67405b352c19710ebad2905f3f20b9e56ded74661f96743b","src/zlib/test/example.c":"520799662a8286725540d6d5a356efe6f595618e5fe2e591972491d719bd99aa","src/zlib/test/infcover.c":"f654f3fcc74b33bd95cda63d13fe0ce589bcfe965544e0c17ee597d75efbd090","src/zlib/test/minigzip.c":"91089b21e692797bb6208b2b45eeb90f5f1f1e4f6b67b99dea5676f51b811193","src/zlib/treebuild.xml":"d816c764c8ec2d5b2ebfa7f053f747097926c13fce7fa8628c5d14c991411421","src/zlib/trees.c":"f2a5f949ea70dde7c23a54c793aeed630a03df4bb72417cd3aa008000c44699b","src/zlib/trees.h":"bb0a9d3ca88ee00c81adb7c636e73b97085f6ef1b52d6d58edbe2b6dc3adeb4d","src/zlib/uncompr.c":"31922aa982ee12fd28d1ce5fe6a94a3f07c2a941c821b566a881ca21845cdfaf","src/zlib/watcom/watcom_f.mak":"7e039b912f9cffaa40835281430bb284fa9042b0a0d12f6b34700a06bca6576e","src/zlib/watcom/watcom_l.mak":"d11b4064604a034725860e63e3f6d347056372e4b1675b183e20a93533b20cc9","src/zlib/win32/DLL_FAQ.txt":"9e00778319381e6275691dd3a89410c99065b8c0c5db96473abe8c859cbdefd8","src/zlib/win32/Makefile.bor":"e878fed2313417db085fea621c110889f6a32233b5b6db46e3c4e824c1d0ed6b","src/zlib/win32/Makefile.gcc":"ea8feddce7b9707253b9bf86623cf7ebe5294d7aea2b3b0b1b1c1b8cfd73009d","src/zlib/win32/Makefile.msc":"7c495d63c5afea1d77d162a41b73bab89cee952c12e4647e9684a7ac79bfc3f5","src/zlib/win32/README-WIN32.txt":"b71f1f4e4760812c3a11b2bae6f40d1066741a90e6646010a32ce50a0e348cde","src/zlib/win32/VisualC.txt":"9ec0babd46eaa012371dee2d3a8a55d9c7130f7895512c3371c737e4a7f6a997","src/zlib/win32/zlib.def":"24fa6dd00f3f4c0d14507a03ddbfa42707a04e3901bb9ff6f90096037a75185a","src/zlib/win32/zlib1.rc":"8fc5f2b5abee40ad66e6d6cfc9f926c2f446e13a7c9ee7df8bf58a266d8cade5","src/zlib/zconf.h":"9c0087f31cd45fe4bfa0ca79b51df2c69d67c44f2fbb2223d7cf9ab8d971c360","src/zlib/zconf.h.cmakein":"d740b750e9c98e6a4b4529cc2a857a3fa8001514b1ce91e0e1d9d293652bf388","src/zlib/zconf.h.in":"9c0087f31cd45fe4bfa0ca79b51df2c69d67c44f2fbb2223d7cf9ab8d971c360","src/zlib/zlib.3":"5abef003e545566e5599e5ab2e7528e978be59d54546b19d763d062f7a69bac7","src/zlib/zlib.3.pdf":"7f0f633641d782e360eff9fe831716c5767faf1000e38382a8a8c65b0b67f374","src/zlib/zlib.h":"4ddc82b4af931ab55f44d977bde81bfbc4151b5dcdccc03142831a301b5ec3c8","src/zlib/zlib.map":"7eb1070ba6bf12e6895e5da06b84a92af683827587afaa72bdd45e80b9d8e4e9","src/zlib/zlib.pc.cmakein":"2f1d0b18ce37c2af415a469857f02aee2c41a58877aff21d29e9c6db32b55cb7","src/zlib/zlib.pc.in":"04c01cc2e1a0ed123518b5855f585c93a24526dd88982c414111ea1fc9f07997","src/zlib/zlib2ansi":"d316e3e79054f5f9fe921d35f4bbf4bf0a37b859d29d2b34ae4d7d92afc3e55c","src/zlib/zutil.c":"f7fdc9ef326a2683eb33c794face54e83c751ec17f3d1ba581847a62af36ddcd","src/zlib/zutil.h":"9a63f6690fac1620aa3cecee5752af618806da438a256b4a047fbcd289cac159"},"package":"de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"} +\ No newline at end of file ++{"files":{"Cargo.toml":"ce67ce7c1f3c4ad7832d58ed198b8dd745abacc620738d575c4b1a9ac9e79449","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"34c467b6945a22696d060b8fdd2379d464acb3408d4c599d3dc5fe4fa1b4c84f","README.md":"b23e18bdce29fabc3d34e88576219f50d1d735a355e427e6d6ebc09254138070","build.rs":"e034f7828ff43a0bb0f7b690e8e99b09b8f4e1ae0560b6fb4008006e9cd4d9dd","ci/Dockerfile":"4d479ea63b9e384b3864fa1204894bfae4890017d6bf03486274457fe2c26cf8","ci/run-docker.sh":"0ea7a4fdc9f6026110e20fa2e25dbadfc1e6dafed9ded5981ae36772ad207e26","ci/set_rust_version.bash":"4284f86ac3923a73dd79e89bef2d0b136c6d104d6dae92e24b4a96eaffa28890","ci/test.bash":"73a936768549eedf96a7cddb350ada128e058d5d9004244ebf3d993363b69599","src/lib.rs":"40476f4e896c936c21f908396255c7a4951ef8bf93788858ade6cace2539927b","src/smoke.c":"10607c81b73811bfcb9718767312bf97ba2ccf7048ea2f18a2085aa06ad7f91b","src/zlib-ng/CMakeLists.txt":"60b836817b51e5893b1e3203adaf57a98678af17957eccaef679bd96bcf5d90b","src/zlib-ng/FAQ.zlib":"d1777aa057caeef50fc291aac7a414363b2186bb3d65bb0f8bfa2bfd61cf0ad5","src/zlib-ng/INDEX.md":"989545e90d8e9ac149034f762ce78ed8976ebf9324326228dea37ca190154609","src/zlib-ng/LICENSE.md":"d3c80be055d94d798eaa786116e84fa0b010bc11420b5d2060d978ea77845436","src/zlib-ng/Makefile.in":"15027511a77e76b423eccf10ebfe66398ea96862cbce2415e5ebac7c7cbb6ab6","src/zlib-ng/PORTING.md":"5cff8c878c7958f6a4bada5a403dcc88961c9607826faece1aef202b5d95c550","src/zlib-ng/README.md":"9cac4a98ecf45f50adf5030d4dc58b3cf9f3ae8e3ec78d30fdae4a99a2b4b8d9","src/zlib-ng/adler32.c":"82ffa1b4fc4b198ba8004135f79b8819d9f2b28e851c30c0ab41e6d32dfbf70d","src/zlib-ng/adler32_p.h":"f56915c59a345baf4558374447385a317e29365a4db2fbb38af4de3e1a1a0201","src/zlib-ng/arch/arm/Makefile.in":"95464884ba75a7b12c9ceda5845d8d68d5a7d7dac8a8dc24b27beb2192e5b97b","src/zlib-ng/arch/arm/adler32_neon.c":"3990b8d5570b12c2162218fe0e9bc723a03f1c89b5ed3ba70a74a98976260ee7","src/zlib-ng/arch/arm/arm.h":"855adbb02d7b9a5714a17d9dcff493610e7cd2b9a1f4e58e1c99626ab536e868","src/zlib-ng/arch/arm/armfeature.c":"dd09ad2712b037e8d52173402f39cc2be1bc89d47fc10259ef81b4c64aef7110","src/zlib-ng/arch/arm/chunkset_neon.c":"65b70014888e9fbdb89bfbfa52f23b8953dc015466577da292d4780b55c5d95a","src/zlib-ng/arch/arm/crc32_acle.c":"5a96afc594697d1399870d1bfb0623a03869eff42caae74013f147cec4aa982e","src/zlib-ng/arch/arm/ctzl.h":"feb70d55e66025fff806e30e48002b35cfff79533d352585cfa5f118edbc90b1","src/zlib-ng/arch/arm/insert_string_acle.c":"d1b1dae5aeada70f2b03c2cbf3112ce55a92401c2d87709081b04dcf5992e1ad","src/zlib-ng/arch/arm/slide_neon.c":"19d8cf5c742ac6b82164c7a183538ad1129f9f17e9b8bce8b40daac3820fb6c4","src/zlib-ng/arch/generic/Makefile.in":"f41a34839986eac8dd52cf91fada0efff4171c059ab5d7db6347c91bd6d9db09","src/zlib-ng/arch/power/Makefile.in":"69644d1a0ff8e7f38005c0a55cdbaf3f0d87f42abf8fc4f4136271c4fedfb846","src/zlib-ng/arch/power/adler32_power8.c":"79b75e98ad3a62facbbdd8c0b178d3f993b57f6e34d320bf47eca33aa8c330a1","src/zlib-ng/arch/power/power.c":"0647afb3b3b7ce2a19b4815ec8fdeee0b37c759413e5ef0a668a2dba22d94803","src/zlib-ng/arch/power/power.h":"f3f15f94fed98a2f7dd5d4568c5172e597228be4141d6895062703c3f70024da","src/zlib-ng/arch/power/slide_hash_power8.c":"932ea533d25e2f5478afe0c47830e7ef24276cad0d75fd91f2d8c799bd4b5d36","src/zlib-ng/arch/s390/Makefile.in":"eef6c3169723f089b0b5f852423ec55bf0364caeddd7cda991f2e76bc1682107","src/zlib-ng/arch/s390/README.md":"4f5018cb7c8ee217710a90193088889a15f1675d205a104140f6a1ac07ce412c","src/zlib-ng/arch/s390/dfltcc_common.c":"6771ec4457da9f4b00c74bcc0828735e21c74b9162cb37383c297c3b5028cddf","src/zlib-ng/arch/s390/dfltcc_common.h":"ed339007feae58d1879e096addb30ed86cd5cf11222db22c45f48b47328cf6db","src/zlib-ng/arch/s390/dfltcc_deflate.c":"7b3dec7be4055c7748defc626dc91db99787c9f3b70b7d7b40282558bbb478e9","src/zlib-ng/arch/s390/dfltcc_deflate.h":"c4c411f221cc0f6b218326e973fef05c65840ba49878aff052dac0bb38121cbd","src/zlib-ng/arch/s390/dfltcc_detail.h":"01dbdfaf5e8ccf522663b4daa76e9138dde514292c35a623be4bcbbf4b82dea2","src/zlib-ng/arch/s390/dfltcc_inflate.c":"a96226eba3538d3904893cfe1b08395668e6a722b56f28d5b5debb3176161b4b","src/zlib-ng/arch/s390/dfltcc_inflate.h":"d7a4a5ae79abd1a5456521926b918becfe86c253a4fc23723fbc09f7c3303128","src/zlib-ng/arch/x86/INDEX.md":"c12f9bf0d66743a6472fb756bf46def8eea1dd235be7fca994dcb22f693a3524","src/zlib-ng/arch/x86/Makefile.in":"9f6fe7567a99e81aaa3bef8ccfa1ad40f524efc285cf8dfe0f497a1530f8016c","src/zlib-ng/arch/x86/adler32_avx.c":"99056732c7bd5d53dc108f282811a40bf21570926781af5dc7b17cb9218963de","src/zlib-ng/arch/x86/adler32_ssse3.c":"883a5520b4481225d097c90c5359106a3c8eb7b921499c94276e999b7c39adc5","src/zlib-ng/arch/x86/chunkset_avx.c":"15060e7ee487fb1daef9be25343ae387392276933921e4b4db0c67831dc0854f","src/zlib-ng/arch/x86/chunkset_sse.c":"f7ccb55b67101ddb9def951a6d6f9dd4cb108fdd9e65f0f21d82723d1b093a22","src/zlib-ng/arch/x86/compare258_avx.c":"8b2838d168de4608327f25fe52d53763a82413ee911d87947d3fcd72c7f9bf26","src/zlib-ng/arch/x86/compare258_sse.c":"b5049722ffd4a43a96868eeba5e000271cfc5fcbf3c2657026ead15b1df28a10","src/zlib-ng/arch/x86/crc_folding.c":"75199cdd06ec2f8f43bf38583b2c4d98bbbbd924e659267fdc1fa5134f1472eb","src/zlib-ng/arch/x86/crc_folding.h":"939212546611917e9e066e8ed30cdda95680ec1f5fe0890cc4865b4e6d7fc215","src/zlib-ng/arch/x86/insert_string_sse.c":"9e84a75b6a565422eb105261b6729d2a02b89133bd14372c949d5381b5deed3e","src/zlib-ng/arch/x86/slide_avx.c":"5e448e439ac24e7cb10eee176ca37f2c63f73c135c0a2af040e232bad490997d","src/zlib-ng/arch/x86/slide_sse.c":"1946cabb634c905fddef0a22b2fad19dfd99110169567c3beceef71145b2e316","src/zlib-ng/arch/x86/x86.c":"1af56e27b2e951e1ad1344e62c2f7a8c49a776fcdd1cb0f4ea9d6152118a479e","src/zlib-ng/arch/x86/x86.h":"4d2d20ea0087089141e250e77bb3d419954b9092810028b151581b9115a5fe8c","src/zlib-ng/chunkset.c":"c0dbc7abbdad5137a9efb2b0a76a212e77d4bf44beebe721c68359fa83002ff2","src/zlib-ng/chunkset_tpl.h":"35d15e97bd72d4e03dcec3ee804a08ea6a74faac2ef835caecc0e38bc9daf0c0","src/zlib-ng/cmake/detect-arch.c":"a9509327c2f4395955466b0acce453c29592d4686022714cb9e8b411d7e60c29","src/zlib-ng/cmake/detect-arch.cmake":"9cbb09b297f79e94b55fffb9acbafbee8d6761e854d818f1a0c686e3fcddf574","src/zlib-ng/cmake/detect-coverage.cmake":"e4e372991ba80a16ad47df2716708a56013cc628aa7ed01573a2360c60610125","src/zlib-ng/cmake/detect-install-dirs.cmake":"87031a40428a104f5cf38ecdb8a5028d8c679cfa772a58adde8380c809b34eff","src/zlib-ng/cmake/detect-sanitizer.cmake":"5e6fe6d2d877540811313f0c8e9884adb21a9ace2e24f23190f0fac1d52dd2b8","src/zlib-ng/cmake/run-and-compare.cmake":"dc45eeb6d3e4854049834ec1ec2891342646c7fb803a0b6c2644d6316f89b668","src/zlib-ng/cmake/run-and-redirect.cmake":"2de9c784da3e04331465a3c56125b9c7d8e74b898b4cf85353aca196f90ea9bb","src/zlib-ng/cmake/test-compress.cmake":"3f37319963a80a31f752fca1c82571d552fd4701326bc40fdb02b54ec3f7a3f0","src/zlib-ng/cmake/test-tools.cmake":"4dcf099245085ee2b6d8ec41620bca3f7b718365dbb9bb0ad23931e83bf36aeb","src/zlib-ng/cmake/toolchain-aarch64.cmake":"8d7ba07ee1cb9fbc7817da1c5e74ce6c85ff81c10962a33941f0e24471956e59","src/zlib-ng/cmake/toolchain-arm.cmake":"0b0ab2b1093ef851c3dbd6fe53f855628df0778841a488aaef85d2c70f04a257","src/zlib-ng/cmake/toolchain-mingw-i686.cmake":"6551576324fed6ccedffcfe8da762402dc863c20a2789a9b0030b9d32e15a15f","src/zlib-ng/cmake/toolchain-mingw-x86_64.cmake":"ec7bf5c8640fb61d2e30f8db7b588ca9b66da92d4a59e88ce16c5fc7f9ce02b6","src/zlib-ng/cmake/toolchain-powerpc.cmake":"6373abe883a99616aa51422a9b714894dc521211be49502463576f58d3d26b2a","src/zlib-ng/cmake/toolchain-powerpc64.cmake":"328d1ea039a30e03ee9a552858b9f180b3da2614b712f618da1a0fa98f30a53b","src/zlib-ng/cmake/toolchain-powerpc64le.cmake":"ec90270bd1f4aa649abddddd2618168d399d58a1c1c35b3d8d909e570eb9be1c","src/zlib-ng/cmake/toolchain-s390x.cmake":"cb634252c21c4f55d06cdc49ce522a5546aae592daa0f12aa4282c0aef323828","src/zlib-ng/cmake/toolchain-sparc64.cmake":"d70d39760a23886ebd1c5a1a87651bfb47a9b24def9e7955ee1cbec60b40925b","src/zlib-ng/compare258.c":"56bfd48d5ff9ca422fbb728df7a373436c73796561dff118c7d4039fe70d29e2","src/zlib-ng/compress.c":"1abf5b13e3e805becc14f4f16dad9bf816f4fe41754b1abf75f670dcc84567cc","src/zlib-ng/configure":"681d5b1303aab0523334c90ff049757e7ee6b2683f2411204b7245ba4adca4b2","src/zlib-ng/crc32.c":"98440be8a99381151a2d740f2e2228e8c1b23b9193c3642c52a4e34799506336","src/zlib-ng/crc32_comb.c":"78cd1a3d31963bfa5bd9d476250b2bb7777b12b6ebe0475acf021ca794757165","src/zlib-ng/crc32_comb_tbl.h":"d6615d209d6c7d5248c6f7fe4e5dbded13c0eb87997b37693032c2902927407d","src/zlib-ng/crc32_p.h":"1fa91375a18e090c0a0dfda39de3df36346a0b1be36c808be6b6c29c32eba922","src/zlib-ng/crc32_tbl.h":"d629378ba38ff5775095b64e277bcd41c4b89fab9b5647a9fb29e15da0db0161","src/zlib-ng/deflate.c":"1a5ff34bf68b88e30f578ce7b15dd996c05fed7bf42f58f4616af470ee18f103","src/zlib-ng/deflate.h":"a074e9a5dd5d689db63655251d6a0948e7a7c0c4a4f6d0ca60bfe18291f3c34f","src/zlib-ng/deflate_fast.c":"b3b261b3a02b089599fcd9448965ef5d8e8b0e8e9556857357c9632930c7c748","src/zlib-ng/deflate_medium.c":"1c3d95cbac76052d39595ea750c5536541c18302b9abb398c27b58955318bba8","src/zlib-ng/deflate_p.h":"95026b1b48aa78204381b32617dd44e8c820c9bb21b415ebfcb33e6b5255233e","src/zlib-ng/deflate_quick.c":"280905a191d2b2a7274f2453ac537e01a0fb6e7540a0b212c1514bfb8c9415ea","src/zlib-ng/deflate_slow.c":"a2c66723e1e71ffd6ff856407459ab311a4c6546ecf50285081fc7afcd0ccd2e","src/zlib-ng/doc/algorithm.txt":"992590931e982c0765286c2d83f6e9ff0a95aabb08e28c30c52bae3e8c4bd5ad","src/zlib-ng/doc/rfc1950.txt":"8f0475a5c984657bf26277f73df9456c9b97f175084f0c1748f1eb1f0b9b10b9","src/zlib-ng/doc/rfc1951.txt":"5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009","src/zlib-ng/doc/rfc1952.txt":"164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67","src/zlib-ng/doc/txtvsbin.txt":"47c273bb22c9773248d380549a330e5c262266b1292154b0d3014f731cc73f47","src/zlib-ng/fallback_builtins.h":"f07e83c5c444554577c4240ff7722057ea2a689f6baa0f9e8bda32b9a46888ca","src/zlib-ng/functable.c":"d3747a4674ddbc903ab1d06efe63a1c4b52bf42f7dd38cde3701fa82b1d953f0","src/zlib-ng/functable.h":"e5a2d0c10411d23f04295bcb9ddb9889388974b723caef65aa5c4ea4739f4aa7","src/zlib-ng/gzguts.h":"cbf2afc8a6183002254a73cabe8376e54b1aea2ba042e36138f292c9cdb95d5c","src/zlib-ng/gzlib.c":"5b5bea4f319e5d0a96b92aa431fb33926686cd20686c90d75e42e1481872bbcf","src/zlib-ng/gzread.c":"fc4a187ba45ceb7b4b50f4f8dedc7685fe8687e6f034638a6437bebf71d51a13","src/zlib-ng/gzwrite.c":"7c86058ae23f856c099e2663a5676c97cfa4fb5df9b92893c94076ba4aa9a56b","src/zlib-ng/infback.c":"97a35de1a3d3bec50e112853e03bf1628cbed3b0fb84459cc423e3f9f61fbea7","src/zlib-ng/inffast.c":"701519ee11d39cdf4e808395722415c42ff2be9445f66408fd879370f3242b57","src/zlib-ng/inffast.h":"42e74a92b496ab0726be317e8497a12bf3c3cf3d0d533440ce65befd3929c71c","src/zlib-ng/inffixed_tbl.h":"a94225335396245e9f0ccb2e9b4b334fe7ee0111ed8e32a26bcd52187f364314","src/zlib-ng/inflate.c":"a665bf717ee257a16a8ab993241f2cf9e71d49882addddb9518b88186f82a5cf","src/zlib-ng/inflate.h":"eb25527d1bdedaa45167926dce4c39d9aaa3147b0f4a95f38f5916528c30a09b","src/zlib-ng/inflate_p.h":"4a94c51194da119770cf662ef289994f0c78d95184d54d6ae5d50a393e8f5a62","src/zlib-ng/inftrees.c":"d1d88f98f9129c87f3ce1d6de5bea3ec867de23b1b2bdd585257d231aac82a4f","src/zlib-ng/inftrees.h":"624c6653a454447c6274adf922430a19c96ef73c7687e4559d247ff48970bab5","src/zlib-ng/insert_string.c":"aa22ba53a1e75821499809277f9ca0e5ef92b07a618136dd11ae1734e233b7c9","src/zlib-ng/insert_string_tpl.h":"1ceba9903324d10aad6e1d83653c4d534a5b06fd09076414a06215482be00bac","src/zlib-ng/match_tpl.h":"eeab4c6eea8511a7579738e622af062ad16f4016312e93ad34bc5903d8b3c4a1","src/zlib-ng/test/CVE-2002-0059/test.gz":"60bf96b8f433bd7e057ce3496aceaccd70ec80f596a4aa8bcc7786056705ce66","src/zlib-ng/test/CVE-2003-0107.c":"1bfbc88dc501cd92b8b26bd8944af6b150b376ebfe7241d90e2b93109be3d68c","src/zlib-ng/test/CVE-2004-0797/test.gz":"38caae524705f676bde13a8df9fc8c7d2fe105ba6bdbab62a405b0276fd3aa2e","src/zlib-ng/test/CVE-2005-1849/test.gz":"e4d5a60617df4b5dd44eda94751ce1eacdb325792bba6e3cc4676719a3adf742","src/zlib-ng/test/CVE-2005-2096/test.gz":"8f702d4861aa3ec98ac03a59ff26b430939630cb5cd4266d2658d3b836d576f9","src/zlib-ng/test/GH-361/test.txt":"358497d0a7251ea42101dc77b02337f46fd89af09643a8288e2a3082e5d24128","src/zlib-ng/test/GH-364/test.bin":"af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc","src/zlib-ng/test/GH-382/defneg3.dat":"b22bef6b7392401c9e7b079402c4a4074053d7a914d050400e37fd7af6fe26d5","src/zlib-ng/test/GH-751/test.txt":"b83d833803b7bc3124fb2a0034081f0b999ad10c33a8dfa3bfd181dc078ae3ee","src/zlib-ng/test/Makefile.in":"c3b6a1ec62838c140a78bc361448d5739756bbfa3bbbf1ffa64c342599949701","src/zlib-ng/test/README.md":"fc485cfaaede6b3d3dc61fdd17cc7eee715c35d6f62e6e502f9251fd1b5edac9","src/zlib-ng/test/abi/ignore":"02aa87f77656dbc1fbddd23f436cd15465a92df0722da4055cae1bc8bf013097","src/zlib-ng/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi":"f5e91f25b558a891fecbeb6e2e9575698630ab700d055a38f3bc4fe66257f513","src/zlib-ng/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi":"038337383cf780587d810cf5400d632f3a1f8517e63ac4a71b6e5224db8b1413","src/zlib-ng/test/abicheck.md":"fa5d6d33ff0fd95eefb7c6c0c7f67351282e6eda20c4e38842235a610cc10382","src/zlib-ng/test/abicheck.sh":"b23ee3678acb24caf36fc8402a07452de73c50640ebe641f185c7f9d5ea257e7","src/zlib-ng/test/adler32_test.c":"db3e8ad9a4e2ecce0c052b0bfe19834d3ff2fb2e9239cc3438a2c95db00b1d21","src/zlib-ng/test/data/fireworks.jpg":"93b986ce7d7e361f0d3840f9d531b5f40fb6ca8c14d6d74364150e255f126512","src/zlib-ng/test/data/lcet10.txt":"938e69e61b3411d8a9e2e630f4265000d810f3dbf66bac58cac19493753526ec","src/zlib-ng/test/data/paper-100k.pdf":"60f73a051b7ca35bfec44734b2eed7736cb5c0b7f728beb7b97ade6c5e44849b","src/zlib-ng/test/deflate_quick_bi_valid.c":"0e00da0e048c46204c39aff4b8fb79890274d3c6183a9409aefd5c93e4e92a48","src/zlib-ng/test/deflate_quick_block_open.c":"455bd347bb88debdfacb409846170274991ec9ba71c52b8fd0e526daf57265eb","src/zlib-ng/test/example.c":"8bfad1221a8df5b6202e11f6be4bae5dbccd8a24fb7bbd8dd88e7ecd318907e7","src/zlib-ng/test/fuzz/checksum_fuzzer.c":"3a15479f2cb40b6c5760dadb246328fab7315f3e3b8e28c1bc246c9b9a867c69","src/zlib-ng/test/fuzz/compress_fuzzer.c":"1ab70608075c4bc60f89aa2f327cff88362ee7b1d31da88ed54ca51e5f99e5c9","src/zlib-ng/test/fuzz/example_dict_fuzzer.c":"042621053050f0fde90a0428cd1afabda8cc7c3fa59e3e0a55c43ab1e03d3988","src/zlib-ng/test/fuzz/example_flush_fuzzer.c":"f12246a184dcfe0a19a98cdc742a1fe8da388ad20b406635d63f1fa10d45b9ca","src/zlib-ng/test/fuzz/example_large_fuzzer.c":"f490abcd332fb4e7921292adf6876d38d7f71c8d2443212c781ba88957ff9303","src/zlib-ng/test/fuzz/example_small_fuzzer.c":"a9b3436b291ace821b6013311a1100e19a9e1c67fefd3f97dbd60688f9bf22b1","src/zlib-ng/test/fuzz/minigzip_fuzzer.c":"7b0e7da9b6c60f3b3a13f140cc445050d9e8958d4f59cbb9a498c08f3a53adab","src/zlib-ng/test/fuzz/standalone_fuzz_target_runner.c":"306e8ac4e08ea72d18ffae8c908abfef8c6feedf83b068a7ec675ade6a5791a8","src/zlib-ng/test/hash_head_0.c":"d88105a80e756b7206a20c7b2490a2e7e743a2ceb1f20d3e433ce9848f054e1b","src/zlib-ng/test/infcover.c":"b9acffc102fdd140941073ca47e30c938aa937b4929061500c36ffba12c86449","src/zlib-ng/test/minideflate.c":"93de8ffcbe7c414abf3ea36acdf729bcedb40393ec7bd10b356ebe225406e173","src/zlib-ng/test/minigzip.c":"291e2ea30778a3e829b96cb47211e89494ece036cd74591178710b4276c9b48f","src/zlib-ng/test/pkgcheck.sh":"75b3155125f235e27ee434d76b6f72bd825899b55f6d59ef2d032fe67a2896ed","src/zlib-ng/test/switchlevels.c":"c30ae3d27ce6041934532553719622e7ed473541aa7bdad8d11d0c55e5220f14","src/zlib-ng/test/testCVEinputs.sh":"5de6198444c16726f8e0a8f2beb5b89c5ae7e7e3736ce760b9fbc719493e7e4f","src/zlib-ng/tools/codecov-upload.sh":"ec7a8f1405820810e486e3d7e2fda7eb958c17877b0000b93abdf09d87732a2f","src/zlib-ng/tools/config.sub":"32186cfeb5db62c99e1dfbfb07f24c1a50977447b4c26d2907021c74422a70d2","src/zlib-ng/tools/makecrct.c":"55c8f7b8e29393e95988a29de8cb1a1bdf2738a69d53627bd0f9d7bf169bf0a8","src/zlib-ng/tools/makefixed.c":"bffd02540231304f9bcc755b8cb9ae5cfbc48975857bbb4547f1d6acce21ef57","src/zlib-ng/tools/maketrees.c":"2dbfe34691dde327618be496b380fc91daaa30474352815773a8b70114b0541a","src/zlib-ng/trees.c":"956ce5b3f3330320cb5baadbf7721572259ec41edc4d8c132a20888b7f6f60c3","src/zlib-ng/trees.h":"24174f3543b01ee1ef370bbf6d15551a21871cded18b2aadf09a71e7904b6f99","src/zlib-ng/trees_emit.h":"f68904e04caee0482c72ea92cc775cabe35a0bf7cffce85566c15ace27666af4","src/zlib-ng/trees_tbl.h":"35f4fd0ec080c1ade342e2dd1b0f5cdc7e9f18990faa48d7a8a69bc318ebe607","src/zlib-ng/uncompr.c":"4ebb486b27930f8a6ec4a3cc90a207d0bcf8a4779d1dbf3b2184a2b2a5735cd1","src/zlib-ng/win32/DLL_FAQ.txt":"d2ec63cb4a51886e0813f75bca49a051bede364d855f938e1a7992ab97a79800","src/zlib-ng/win32/Makefile.a64":"775d6902373d1583430b5d7467f001746be323610c89be27e02bbfe0205994f3","src/zlib-ng/win32/Makefile.arm":"7535e022f482920c3fa7a267e84e39ad790d150f72e5c30414baa156c2fdd9b6","src/zlib-ng/win32/Makefile.msc":"deee44d5624890e692d87db311216075e967c3ac8aeea6ffcdcac3d03eea260b","src/zlib-ng/win32/README-WIN32.txt":"a8c2d052960b963a49cee5a2ad891f2ff7b34db038f00985eba4eefc99966261","src/zlib-ng/win32/zlib-ng.def":"f240276caf805a10d024fc6a66efe915c435734c69732818d92fb04d08ab350c","src/zlib-ng/win32/zlib-ng1.rc":"b567a276407998bae40aacd48a50beba87c0bfbae470d28e66331ac99eb575c8","src/zlib-ng/win32/zlib.def":"d9c371ff2677567350386441a2e3d0258010d6502290bbac5ac42ea168bd5212","src/zlib-ng/win32/zlib1.rc":"d7f269379144d65bcd1b67c1065e5d4120579f14ce54ecf246eaba394fa989a5","src/zlib-ng/win32/zlibcompat.def":"73728b9df4379dc70ebd9b2a9f20d6e4ed7c031fa1f351cdeae1de7d1db05bd1","src/zlib-ng/zbuild.h":"f73424f5f10370ffe8f45f6e3dc52dd095ea778153832461d712a838e3a01098","src/zlib-ng/zconf-ng.h.in":"708106f26c4a0d877e2ea644320a2b48b144524b61429c7490e2e742a0c0c1e4","src/zlib-ng/zconf.h.in":"dacec2360fd9607f85bdf651409fa3831dd26f74414d242e812b06c3b9c9926d","src/zlib-ng/zendian.h":"f5cfa865281d2c5d0b097d318500f27daeec346e7882de68e279486d79c52e77","src/zlib-ng/zlib-ng.h":"7a15bda0297b2611da695f895cc57ce44c284b030fe98817281e868a1a86ae35","src/zlib-ng/zlib-ng.map":"e8202981574d814cb2a9f06bca7900d0959c24766bd86681bd3843ab0e71f8ef","src/zlib-ng/zlib.h":"703bead0c02381c8df8d14d805fde913973b2960811f35e2de4f4aaf29ad905c","src/zlib-ng/zlib.map":"e3549810f821d433d57f921ca2fceb8674574f778485255a7dc691bf26b5281b","src/zlib-ng/zlib.pc.cmakein":"17668e07edbe5971043bea26a2f2b92c4c7cf4724620f1156f3ea1436d2aac93","src/zlib-ng/zlib.pc.in":"cf94c9aa44878a62e27c2f75354c08326b3bb5250a9b11496855cf59691177bb","src/zlib-ng/zutil.c":"7544aa2d2cfce4693d4e2a639f0631c3e8b3e7d0d846313be0e250c477e6812c","src/zlib-ng/zutil.h":"c0e9152d078ca1774c93910fd84531b2f593b3a6b1035e4d97a0d28b720ec98b","src/zlib-ng/zutil_p.h":"1e5a2fb8d15212ad094e9a5d5f607f11f8191498b54e0af48d722f92d9c71ffd","src/zlib/CMakeLists.txt":"b87275731cc3ebdfea144187875cea204f555c343279c0f35f2d46d661bfe34a","src/zlib/ChangeLog":"4c9f1a65b9b4be8bf164a97775ef50e4db4e02ea8c9933fdbe629a640691375e","src/zlib/FAQ":"1e8a0078be0ff1b60d57561a9e4a8cad72892318a8831946cba1abd30d65521c","src/zlib/INDEX":"3b4e325d47ae66456d43fcf143ba21ab67a02a4f81be7ef2da480ba30d774266","src/zlib/Makefile":"ef23b08ce01239843f1ded3f373bfc432627a477d62f945cbf63b2ac03db118a","src/zlib/Makefile.in":"5021b2bac4164f48b17c91c8a2e3c225be7ad31d8bfab1bbaadd90370afe9991","src/zlib/README":"7960b6b1cc63e619abb77acaea5427159605afee8c8b362664f4effc7d7f7d15","src/zlib/adler32.c":"d7f1b6e44fee20ab41cef1d650776a039a2348935eb96bcbd294a4096139be3a","src/zlib/amiga/Makefile.pup":"a65cb3cd40b1b8ec77e288974dd9dc53d91ed78bbe495e94ccc84ddd423edf1f","src/zlib/amiga/Makefile.sas":"0e63cf88b505a1a04327bb666af3a985c5e11835c0c00aed4058c0dcc315d60e","src/zlib/compress.c":"5c11e1fc22e219cb986f6fa9e4ba939315227e84aef042737d38ec668b89b6d2","src/zlib/configure":"86b38f27f31d2fec76d9355872550dc63cb3949774473fd6313c5a3fd1def0e2","src/zlib/contrib/README.contrib":"ca39b78bd7ad84f1df7b0da90770c5b3fa4c8e2c75d132e9222812fac8839630","src/zlib/contrib/ada/buffer_demo.adb":"469cf566a6965767fee6b987a239ed8cedcc66614940d45a9b434331fbb435ce","src/zlib/contrib/ada/mtest.adb":"41b6f31684770334afdc4375871eb1408542f37a823a073556fdbfdb63753160","src/zlib/contrib/ada/read.adb":"fa5b989aef0c5715a3fcb15de93985f7f10aeb0a7f5716745c95ed820eb9af9c","src/zlib/contrib/ada/readme.txt":"8fe9e5303f2e8e8b746c78250e74b7c4aeb7ce6212fdce751fc3a0ce56a47fe2","src/zlib/contrib/ada/test.adb":"5e3abe79b387e09a9a42bd0543105e228f39a335240cffc33d71f0ba66ff2511","src/zlib/contrib/ada/zlib-streams.adb":"f45988e2bac76eb25a0dc981f46576e7432c35dde1790bbc2b650f0090b7fa72","src/zlib/contrib/ada/zlib-streams.ads":"969e8edb0611810fb52159dcb7c40228f4e5da810a7a3576b778116a93038c6b","src/zlib/contrib/ada/zlib-thin.adb":"03d89244ee5ec9771d9b5050e586c609f851af551b2e64eb151f1d5be0b63ae9","src/zlib/contrib/ada/zlib-thin.ads":"631ef170bde16c3ca8d412b54a0e519815b80197d208f8f393e6fe017bb0968e","src/zlib/contrib/ada/zlib.adb":"c9ca5dc34fbcdf06e2dc777b7e9dcd0ba31085b772b440eb0e12421323ab672c","src/zlib/contrib/ada/zlib.ads":"02634bec0d5e4c69d8d2859124380074a57de8d8bd928398379bfacc514236d2","src/zlib/contrib/ada/zlib.gpr":"859bb69dce38dbe9dca06753cf7ae7bd16d48f4fece8b87582dab8e30681d3de","src/zlib/contrib/amd64/amd64-match.S":"166007f7e9adb58fe8b83d85bbfe823f5e05858ba1d06edf637b78886caa2c69","src/zlib/contrib/asm686/README.686":"c21cc7147c956ecae17dd084cb41a206b086216fa521012871fb07fafd203c6d","src/zlib/contrib/asm686/match.S":"873799062495629f21cd3f779ea4b927add7aae0144e32d3594d9ce70185e99d","src/zlib/contrib/blast/Makefile":"17d5d26c24bf51cad51045a38ffb73cc3539d29e89885aa249fcfd45a8659d5c","src/zlib/contrib/blast/README":"baa763ae03d88ef7ece6eb80d9a099b43d0b57639d6d281e1c7c6ca79d81daba","src/zlib/contrib/blast/blast.c":"1ab3e479d342bfc144167b808fb00142264bc50f24a110ca88cc774e351c218e","src/zlib/contrib/blast/blast.h":"4d4e3e6f893316f0be77bfd642c857a77f1fa2925acb5df9753e543d35aa3a6a","src/zlib/contrib/blast/test.pk":"5f5c262c545574a5c221132d5ef832478d222d70b015341795b3860204140d7c","src/zlib/contrib/blast/test.txt":"9679b2c98e1283222d0782b25a1c198dc64ba9ebd1addd6dc6f643a45947cda3","src/zlib/contrib/delphi/ZLib.pas":"1b20e173443a68c189cdaa4795620fb1ac165d9e61a27a1ed2cf690f13530d6f","src/zlib/contrib/delphi/ZLibConst.pas":"84bcc580bdf397e570f86f3f5a5b8c7bf537828f30b4b72648b81911f6bf5095","src/zlib/contrib/delphi/readme.txt":"f7420ed2de77d4b498eefbbe6402a1d17dc2d411735289c78a265c7f10fdaee5","src/zlib/contrib/delphi/zlibd32.mak":"850e91b6c9ea05de61a411cbda16fa0f10118cd88bb32c4b7226988776f8d511","src/zlib/contrib/dotzlib/DotZLib.build":"b96137097669644ecb9f42cdd3399d1fce9c512788374609303f7e50abf597f0","src/zlib/contrib/dotzlib/DotZLib.chm":"20d0e3edd57f849143255a7f0df1cd59d41db464a72c0d5ab42846438a729579","src/zlib/contrib/dotzlib/DotZLib.sln":"a979198c5b8d144c1ac8f993bfb6f4085d135aa58ca9dcf63ebabf52b5c695f7","src/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs":"314afcfb339ea95f5431047b7ab24631b11c3532c7ce5dc2094ed0cf80a7c16d","src/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs":"e7c047a2c3bcf88d3d002ee3d2d05af414acf53cb4451efacc0f2e95a474ea0f","src/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs":"be84c9736fe7bdc2bfae70466d8fff582504e928d5b5e110fd758090090c8cb7","src/zlib/contrib/dotzlib/DotZLib/CodecBase.cs":"259bdda1b7d6052134e631fa24bfd9dca6e2362563496c8b85257b56c848908c","src/zlib/contrib/dotzlib/DotZLib/Deflater.cs":"06ba6696a3c15c53ba5fd5a1c2bf50b51f217010228fc1e4c8495ee578f480de","src/zlib/contrib/dotzlib/DotZLib/DotZLib.cs":"9837fe993fd631233cc5e53ff084d86754b97f05ec77c54b0764c2706f186134","src/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj":"21606db31dfef6410dd438b73f1db68856eacabcce6c0f0411fc4f17e17001f3","src/zlib/contrib/dotzlib/DotZLib/GZipStream.cs":"8d1de9755c77046b4ac71340a0a54434ebf4fd11b085c44454d7663a9b4df1c5","src/zlib/contrib/dotzlib/DotZLib/Inflater.cs":"9016ca73818f5b6a28791abc3af6da7c4d2773b6a3804f593f6d5737a62b99ad","src/zlib/contrib/dotzlib/DotZLib/UnitTests.cs":"ad66ac08de34d253e9615b96a745f3dfeda93f4a978d65d5d3ddb9d0d9b3e099","src/zlib/contrib/dotzlib/LICENSE_1_0.txt":"36266a8fd073568394cb81cdb2b124f7fdae2c64c1a7ed09db34b4d22efa2951","src/zlib/contrib/dotzlib/readme.txt":"d04972a91b1563fb4b7acab4b9ff2b84e57368953cc0596d5f5ea17d97315fd0","src/zlib/contrib/gcc_gvmat64/gvmat64.S":"22ff411b8b1d1b04aeaa8418b68245400267dc43c6f44104f6ccd37f0daee89f","src/zlib/contrib/infback9/README":"890288f02bb3b1f9cc654b87a07fcea695f90f6b9bd672d25bf6be1da2ec1688","src/zlib/contrib/infback9/infback9.c":"0a715c85a1ce3bb8b5a18d60941ffabc0186a886bcc66ba2ee0c4115a8e274e9","src/zlib/contrib/infback9/infback9.h":"dda2302f28157fe43a6143f84802af1740393572c2766559593996fd7a5a3245","src/zlib/contrib/infback9/inffix9.h":"84a2ba4727767c18af6505f0e81d9c814489c8b9ed330a25dad433db72997e43","src/zlib/contrib/infback9/inflate9.h":"32a907676cc36e27d0fdc0d99adb83a0b23f20ab61896269216d40fecf08d349","src/zlib/contrib/infback9/inftree9.c":"0c7f10396703b230c504207fe1595a2f2f8ba9c43158c4bd79d5b22ca36e04e0","src/zlib/contrib/infback9/inftree9.h":"8ae61d52e50d2dbdb0378548ecc54fcd88f108c8b6fc30562a3ebec1ca6a599e","src/zlib/contrib/inflate86/inffas86.c":"6f266f3c7e0faca653256d0189c0f00d7dc0b062d02e25df4e1202e49369595c","src/zlib/contrib/inflate86/inffast.S":"70777bd21526680005fc34f086d108af49e2668ad86d1749e8e8100a81bfb288","src/zlib/contrib/iostream/test.cpp":"0f3c77e013949eb9c91e6b690ea894e19d97944d6b0885b82806fc3ad99680cf","src/zlib/contrib/iostream/zfstream.cpp":"8ebb9b3d521cc3392953f27658cf1f6dcb763216079f69a1518ec5ca0e42a63b","src/zlib/contrib/iostream/zfstream.h":"4369c35e66f63f52ca4a5e1759bf720507ccabb8f3f132e2f18e68686c812401","src/zlib/contrib/iostream2/zstream.h":"d0343e0c57ff58008b6f29643d289c72713aa2d653fe3dcd2e939fc77e7e20b6","src/zlib/contrib/iostream2/zstream_test.cpp":"f789df183cc58b78751985466380c656308490a9036eb48a7ef79704c3d3f229","src/zlib/contrib/iostream3/README":"43ec48ecbd95a8c45db20b107fac73b740bb11595a4737329188f06b713972cc","src/zlib/contrib/iostream3/TODO":"af5ebc83fb88f69706c8af896733784753dead147687e1c046f410c0997fd88b","src/zlib/contrib/iostream3/test.cc":"8e17fc48dfdbc6e268838b8b427491b5843b6d18bc97caa6924de9fad7abe3da","src/zlib/contrib/iostream3/zfstream.cc":"8cdd67ed0b13c192c11e5ea90e9d5782d6627eb303fbc4aa5ebda2531ec00ff8","src/zlib/contrib/iostream3/zfstream.h":"1bd74778fac45ee090dfc0f182a23e8a849152deb630606884b2635987b357b1","src/zlib/contrib/masmx64/bld_ml64.bat":"1c0561908a07ebdff271b12ed757241e1813d3db0f3551501b2595c23f0833aa","src/zlib/contrib/masmx64/gvmat64.asm":"390c1e6d63cb615b5ba042842738953f9cdc688b2fe35aaca981fd3fae213f3f","src/zlib/contrib/masmx64/inffas8664.c":"f6c585e43e6e524107566b1f10104949d0ef902159ac8203e1d98e50d4bedd62","src/zlib/contrib/masmx64/inffasx64.asm":"8448d0041fe6e8f4188fe5916181a1b274c6d35d75cfb28da60cf4f1edde44ec","src/zlib/contrib/masmx64/readme.txt":"9bb66b5028100855683853f12da0be479c7bccf74365fdbf37da2542edff9927","src/zlib/contrib/masmx86/bld_ml32.bat":"b0b05b62715d4a81a7db5b7ca4a372d109ec95634c9d3bef9e0041ff52de22fc","src/zlib/contrib/masmx86/inffas32.asm":"78d2cc88f8ed0e32ef960efc987c257bc1688afe7d031a8ba18761e95a6a7c3f","src/zlib/contrib/masmx86/match686.asm":"9e9bea3b5517b089da7d39caded07982746a33f94f0907ca7e8afefed7be36b6","src/zlib/contrib/masmx86/readme.txt":"1f29a04e0227b74e20ba1b7c764b3ca5bf596dd2c06e89bc19a05fb8f9689778","src/zlib/contrib/minizip/Makefile":"087034de3dc0223b29e64bb3a4fc3eda7b948e93d2a9ff154aecf9fed2a1eb5b","src/zlib/contrib/minizip/Makefile.am":"2313a3480a2c3745fa7ce216829cd0367058907d3a0902e5832c66c84a2fdfc6","src/zlib/contrib/minizip/MiniZip64_Changes.txt":"302c62b328647f5472fb7755249a83459be7f8ffb1fae07e8ba318fce8f4126c","src/zlib/contrib/minizip/MiniZip64_info.txt":"122719c32ef1763a5f6ba9c8cdefc1d78a76f7156b09e7b6f69b73f968e0dac3","src/zlib/contrib/minizip/configure.ac":"35330dc0c6188127afd339829d91b19739d23bf3b7301bfb04f775a6fcbbdad7","src/zlib/contrib/minizip/crypt.h":"8e872b60255b8447da99885c7159c2e1f1bb8143523bdbe71784e60f98bfd67b","src/zlib/contrib/minizip/ioapi.c":"66b39c27042f6ad12cc12efb0c82cdf100c6640b5fa959b8b866e252966113a9","src/zlib/contrib/minizip/ioapi.h":"8655408534b78dc0889a45f9359fc6d2d5c8e8d8443b81ede596f954c720ef48","src/zlib/contrib/minizip/iowin32.c":"2c05bc374d3d847c6a9f29eac9d674abba7659d1e91e34e172248fcb5c274d51","src/zlib/contrib/minizip/iowin32.h":"586f22b9c3c64da253ce2b518e0fad61f19a7b47b289fc704cc9708242294c49","src/zlib/contrib/minizip/make_vms.com":"65736d9c4888f2373d3db0a13864d150c5040453f5bc2a5c8784379a7ea67590","src/zlib/contrib/minizip/miniunz.c":"ced49f20c62536a8ffb270b35cfa4994a1dcdce45f8cf059b941c94ca0022666","src/zlib/contrib/minizip/miniunzip.1":"66d8684392167091ef0fe01598d6a0daa26e7e448e2df6c3cb257487735b83f7","src/zlib/contrib/minizip/minizip.1":"5404596e8e5587a52f563906119f32ceee30a6d97a966afa5c7afbe4d373e210","src/zlib/contrib/minizip/minizip.c":"fdfcf83979ef2324c1455d369e8add8678c804939d412ce53f8b024578ceabad","src/zlib/contrib/minizip/minizip.pc.in":"8b6670b42d8e5e519e1cc89db093efc07ba23cb1ddfedd3c93ff2df08c3ce8ac","src/zlib/contrib/minizip/mztools.c":"cd887c4af6d20823bd15f24008b10acf01969b4165d7848656bde843a92428d7","src/zlib/contrib/minizip/mztools.h":"6f82c52279e8f79165f4446be652e5741a49992ac58632470335aa34c564072a","src/zlib/contrib/minizip/unzip.c":"497adf676b1cae2a7afa834e4aba86383f7b697f5fdd03a8179ea9024a431cf9","src/zlib/contrib/minizip/unzip.h":"d8dc58fc0121b6a4b98f3028205bb253f956b1ddf791e9ced3cf44892502a01f","src/zlib/contrib/minizip/zip.c":"00f403cb7810578b4b2687dd55fb132c850c3630fba2f3704a8ab896fcc8209a","src/zlib/contrib/minizip/zip.h":"96163fc140e4bf08752e014d20a1eac3f5adcdc408366f6d79c1895f2599cf08","src/zlib/contrib/pascal/example.pas":"d842d456ecb6ff80e34cee2da31deb2072cc69ca837497bea8b8bee203403474","src/zlib/contrib/pascal/readme.txt":"02f997c37991ddae0cb986039f7b4f6fc816b3fd0ffd332cad371d04c12cf1b9","src/zlib/contrib/pascal/zlibd32.mak":"850e91b6c9ea05de61a411cbda16fa0f10118cd88bb32c4b7226988776f8d511","src/zlib/contrib/pascal/zlibpas.pas":"28b90aeeb3da8d1f6a98ab9f5f1603d08aba5bfabc50827d3f15e661268a51cf","src/zlib/contrib/puff/Makefile":"d9d738030464aaae354196c14fd928adf591832fce7d71ac1977c1d8d4923a4b","src/zlib/contrib/puff/README":"aceca4bc1bce7d9445b8bc9b6640c672d95708185f6070d3a3baae7a9d102caf","src/zlib/contrib/puff/puff.c":"6d0eef92e115a42e570b79d8b07a04af5ccbd6b3f3fbca9cbc61c49db9c9df43","src/zlib/contrib/puff/puff.h":"969b7be2a930db0cdcb19b0e5b29ae6741f5a8f663b6dba6d647e12ec60cfa8e","src/zlib/contrib/puff/pufftest.c":"8ee0da78a1221a3c2036e22eed06c2faa27a671a46565a60e10111d4ee9c30ee","src/zlib/contrib/puff/zeros.raw":"b7b0887089f7af1f6d1e0b4c0a1e8eddd10223b23554299455c6c9be71b653a3","src/zlib/contrib/testzlib/testzlib.c":"c6c37b35c6ecc9986a9041f86d879cc37a9e4d8315af9d725071eb3b2cade0c5","src/zlib/contrib/testzlib/testzlib.txt":"2359bbdc84eb8a04e0f1cd16cd81a2896e957f2ad58dab3ca78ef55b7d0dc577","src/zlib/contrib/untgz/Makefile":"8f5ab1564813e091cea8f1bb63da32fd80ac763d029277b0cabf50f60aceefe1","src/zlib/contrib/untgz/Makefile.msc":"d0f537de11d9e0e36e2a98b3971c537265f4b533b4c48797094365ad9ae8388b","src/zlib/contrib/untgz/untgz.c":"9a12d774301d252dcd38bba07ac369319da4c04c4fef8a50fcbf40aebf29c2a1","src/zlib/contrib/vstudio/readme.txt":"2a9ca40b68274f4d37649dfab9e5e867a000883592b4ab8fdaec8425a63052c3","src/zlib/contrib/vstudio/vc10/miniunz.vcxproj":"dd607d43c64581172c20c22112821924dfe862f56b2e5eb8780bdd0714d9527b","src/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters":"c3db9f97952683e688ad83c13bb94c816ac3e6b5f277fdea545b0650c125aa6d","src/zlib/contrib/vstudio/vc10/minizip.vcxproj":"af73f2cf8ae51e65e85342faeb40849a2310c97bc77def42b38d7070460a6cf0","src/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters":"83db58d87f5d7ca84b6087aa1f62b15cbc296194c8cf76e47a271f9077b4f3bd","src/zlib/contrib/vstudio/vc10/testzlib.vcxproj":"1525ed0893db56db44ec68675c8da3c229dc7867166dfc0428816783d16ad43b","src/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters":"d7e04ffa467d417dfa3c0f1c64234cadc84882101bbae483f0a0f5d3d6b566a7","src/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj":"3f317d8964f17901c3e68bff5deaec10b6ccc50a572235999e8097292692984c","src/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters":"682a485f0184aabba94e12e1b284499195f37c176d43ecee0484f31e4d636f6f","src/zlib/contrib/vstudio/vc10/zlib.rc":"e8b581eb16930e0213d37143a5f17868839b22c758b23981a29484e17093c494","src/zlib/contrib/vstudio/vc10/zlibstat.vcxproj":"2a38222d6c034d7e0b843c3f0540dc6c53dd48f942ae29f31620ca0327248c8e","src/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters":"d9a2c381e51e4d6f027f3517db7db81656e43cec02ed9abf267a0fde6f360180","src/zlib/contrib/vstudio/vc10/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc10/zlibvc.sln":"e659860f705f31b87ea9139a3cb4ebe1561e120bce495383a54614fc82b49990","src/zlib/contrib/vstudio/vc10/zlibvc.vcxproj":"3108badf710e2f4a64eab4e7deae6642fb68cc0d94018e537149f1761e215133","src/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters":"58404ba7703c68025bec64b8a17ff1fc7f3a35d15d17ae3bcc4fa753f1348425","src/zlib/contrib/vstudio/vc11/miniunz.vcxproj":"746e4c11fb8af4bcd6a9d68ba81ed1dc366a5de3bed56b291ee969ad733a7bb0","src/zlib/contrib/vstudio/vc11/minizip.vcxproj":"340617cae9cf4fcb003308021d3782ec3639e60d62d79a3aafc0a50bb55b061e","src/zlib/contrib/vstudio/vc11/testzlib.vcxproj":"589eec6ef6d818564ead938a629fda50abb6cbf8054b9f66ea780765c1a1b3db","src/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj":"583bdef522b0176829f0d8139ea2a88b9cbc14379d1334f3a863989ed3df9b67","src/zlib/contrib/vstudio/vc11/zlib.rc":"e8b581eb16930e0213d37143a5f17868839b22c758b23981a29484e17093c494","src/zlib/contrib/vstudio/vc11/zlibstat.vcxproj":"51aa752698d96df065a9ece02e293492f681b59a8077f036a5a60367dc621e87","src/zlib/contrib/vstudio/vc11/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc11/zlibvc.sln":"27389b515997defd080519f95aff87e89fcbe8b26d73c5ebb73c544cfef4d60e","src/zlib/contrib/vstudio/vc11/zlibvc.vcxproj":"c3dd05e56159aba411475b83656275872524cb3c2fd24d690397d8b634e7e0ed","src/zlib/contrib/vstudio/vc12/miniunz.vcxproj":"1494af54570f6e93852932956d49a8c25e57b5abc1ac979945605ca9143df9f8","src/zlib/contrib/vstudio/vc12/minizip.vcxproj":"9bf128ed6760ca5f019006f178b1c65f4c7ff122dba8d297b64b0eb72feeb120","src/zlib/contrib/vstudio/vc12/testzlib.vcxproj":"367a06caa399bd09f6b9cb60706820943dd6a6cf05794275baaf421da9c2a0b7","src/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj":"93416510256935d79625dc9fd349cfce6968c062d42a138bec404a26b2f92f5e","src/zlib/contrib/vstudio/vc12/zlib.rc":"92d5d3a4938a6350395934153416a7eb74353cdfb2321f45b9ee0b9b16257f39","src/zlib/contrib/vstudio/vc12/zlibstat.vcxproj":"744ff6ac0d4e2dcdf74c7d33b979fbfd2b18550947eb99bfd46dc6a73eb1c68d","src/zlib/contrib/vstudio/vc12/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc12/zlibvc.sln":"162e0faa80a56d89eea71a0b89377708eec2faa0dc72091cc0abb07fbdea49a0","src/zlib/contrib/vstudio/vc12/zlibvc.vcxproj":"754671c59d8996a846241af76082cc8be1aa5fc079eff530d91a9ab15a0bee5b","src/zlib/contrib/vstudio/vc14/miniunz.vcxproj":"0312511d4a30cea979c4e36edf994a537ed8a9d924f6b5c536cbcd094773c11f","src/zlib/contrib/vstudio/vc14/minizip.vcxproj":"9e7bb7a6ac723e4b2db900627c366f9bb93a351381995d9c69a50c0126f64233","src/zlib/contrib/vstudio/vc14/testzlib.vcxproj":"c3a9369670af4ebea13d036b452be7418591fbb4c03a675699facac5d8dff5d0","src/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj":"69f544898b4275cd3d8e19b8f1f8cb39c1cb98a30cdb033242e4b94c57bfa150","src/zlib/contrib/vstudio/vc14/zlib.rc":"92d5d3a4938a6350395934153416a7eb74353cdfb2321f45b9ee0b9b16257f39","src/zlib/contrib/vstudio/vc14/zlibstat.vcxproj":"9c7c096b47e7875412c98525efcd16db62e094215f0011b9cd739a33ab35d48c","src/zlib/contrib/vstudio/vc14/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc14/zlibvc.sln":"47a50bbde8ca6336cecd8c0e4b65e515fc46ae84c7b61008ac9864162f777286","src/zlib/contrib/vstudio/vc14/zlibvc.vcxproj":"71fb6ef3b079bfdf4182af17e74c3361ead757467edfc591d9cbe303ccc47b52","src/zlib/contrib/vstudio/vc9/miniunz.vcproj":"b2b53bd9e704bfbe769b863acdc2a3368692ca149c4b4ed2a0761b0cd16c6726","src/zlib/contrib/vstudio/vc9/minizip.vcproj":"80a701fb41a61871ce1d25f6b03e571edb6c3abf0aa45375554b6fac52115eb6","src/zlib/contrib/vstudio/vc9/testzlib.vcproj":"05fc5a87682b17690d199f424f57f6ad7767b8dabb29a1039bfcb88bca1b302f","src/zlib/contrib/vstudio/vc9/testzlibdll.vcproj":"25c1cc5319f1c4b7dbdb595c3cfd6ec3ba217818b03b7055ef5ef440b575a43d","src/zlib/contrib/vstudio/vc9/zlib.rc":"e8b581eb16930e0213d37143a5f17868839b22c758b23981a29484e17093c494","src/zlib/contrib/vstudio/vc9/zlibstat.vcproj":"e8653eea37f3bef097eec2caa55e1f698c3c74c959689bc4e97568e88d2bbc60","src/zlib/contrib/vstudio/vc9/zlibvc.def":"0124fea28bfee49c8a19dad0ed5a49277d451018b4affda5a389e64ad15f44d7","src/zlib/contrib/vstudio/vc9/zlibvc.sln":"26e58d4b2cfcd941c367fb2a18537b3b9f002f2ac1278b700ea1129c50501452","src/zlib/contrib/vstudio/vc9/zlibvc.vcproj":"86aa6e33db104c0a0ed4a9f21f0db8572cc7755170217aef18219fdd74b75e9d","src/zlib/crc32.c":"a04af273e83ecc351bf3794974ab2098d8d960df4044b7b44734c41443ee26d0","src/zlib/crc32.h":"407af59d0abfea84a6507c603eb29809411797f98249614fe76a661def783ce1","src/zlib/deflate.c":"11fd6b0328b65c4ad4b5c204d892a97a9083628a7e77dc47836c8e0c799f8da0","src/zlib/deflate.h":"0ca7fb0cf1dd63001c6e9e4ff93c8dbff2fe521199be51a4dda38a11b44919f6","src/zlib/doc/algorithm.txt":"992590931e982c0765286c2d83f6e9ff0a95aabb08e28c30c52bae3e8c4bd5ad","src/zlib/doc/rfc1950.txt":"8f0475a5c984657bf26277f73df9456c9b97f175084f0c1748f1eb1f0b9b10b9","src/zlib/doc/rfc1951.txt":"5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009","src/zlib/doc/rfc1952.txt":"164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67","src/zlib/doc/txtvsbin.txt":"47c273bb22c9773248d380549a330e5c262266b1292154b0d3014f731cc73f47","src/zlib/examples/README.examples":"402d72eb69c2e03a25034f4b3c02b110f0f67149ecfa4fa0e4b2bf0ceb49a8b3","src/zlib/examples/enough.c":"704e273f65b62c5d2eb06d5bb10c4ccffba56544aa477f0e3957e2296c501b78","src/zlib/examples/fitblk.c":"950769163c41aff897ee41746a8685d9aa41073b1307f42da19dabe9d3fc8b85","src/zlib/examples/gun.c":"d60ca6eb0a3e62ee7fb4a1ab69e8d1525ff06b06ce46889cbdfc13fb8f7534c2","src/zlib/examples/gzappend.c":"4182d38bf97ffbdf1110df7f65c0e8fab0b28b1ea36ebba8621c14e8e76f1caa","src/zlib/examples/gzjoin.c":"90b9d6c39a5fc91cf1cc9b96b025a508a8015dc502cd9374c754b44078593f57","src/zlib/examples/gzlog.c":"433d34b71b4e769ece1cceb8bd7d902d2c0a24ccd7550ab1856a5ba87f84f835","src/zlib/examples/gzlog.h":"309556e2d7d39250924946b78e2cce0ac927857d6e1a02cab64e438f533c20c3","src/zlib/examples/zlib_how.html":"80fb647be8450bd7a07d8495244e1f061dfbdbdb53172ca24e7ffff8ace9c72f","src/zlib/examples/zpipe.c":"68140a82582ede938159630bca0fb13a93b4bf1cb2e85b08943c26242cf8f3a6","src/zlib/examples/zran.c":"840ebeb058cd0ca9e92dcb1db665932462a4695fc649b34e865b8d1ad7c5bf77","src/zlib/gzclose.c":"94446cf8cde67c30e64d0a335b0c941fd3fbad2e77f30180d12e61f9c2a5a6b8","src/zlib/gzguts.h":"6a54a06d269245d73201e76280c0f11c282dc6ec51729ccd9051fe6c9907e851","src/zlib/gzlib.c":"5daf11e44149e0aba2956d35f73f04f35dca99c3dfa43f5ad43ec20b336e4a1b","src/zlib/gzread.c":"6f928512cb1792cfeab31a51ff0b211814d2e455bc75290eb31079dc1e5ad2ec","src/zlib/gzwrite.c":"ba3b7b7ad2ff7ef0c19319b8408c333491a4cd495da55d0b156bc73d9ddb4df4","src/zlib/infback.c":"abe44873b5af2ea68ea1d281d915b2800f1832f846d2c05442a4711adbe6f269","src/zlib/inffast.c":"4d496ab2a3d29df5fadc3dbff6067e039806aaceae6cfcd09ea77d46c2b848fd","src/zlib/inffast.h":"7d8c1c873ce9bc346ad6005bb9d75cce5c6352aaf7395385be216a9452a34908","src/zlib/inffixed.h":"237ba710f090e432b62ebf963bee8b302867e9691406b2d3f8ee89ee7bfef9b0","src/zlib/inflate.c":"8b6c599c3563c14c447c47db0d7dc9a16e8c246a078ec95a169ddcebaaebd811","src/zlib/inflate.h":"8ec9ac297790276f7e46a961d4c6f9f944fb1dec92401339ec2666973cc5983c","src/zlib/inftrees.c":"1960ca67384376f65b6ce8c08fdb501f8eb33923e11ef5f61a855708c6cb0a8a","src/zlib/inftrees.h":"c510b36402784b1f898be3b049b923469aa92701de2d9195aed19f6b65c0dce2","src/zlib/make_vms.com":"3064eb153a7684115f1494364f80759bc5a2c227799fdf08df7b9e6e50884720","src/zlib/msdos/Makefile.bor":"292ab363f7ffbc4ae84d37cd9bdffd2dac1003bee52d223a8489844870f20702","src/zlib/msdos/Makefile.dj2":"9208450c2ae6dcbfcc25560b5b9ca763f461e7246e37b0552474edf8fa898906","src/zlib/msdos/Makefile.emx":"c749d6ec7f88e8e639d4f03bdbdcbbe9d1c304210be4c4be621ceb22961d3d64","src/zlib/msdos/Makefile.msc":"0e021a6f42212415b060e4ad468eb415d0a8c1f343137fb9dff2cb8f9ead3027","src/zlib/msdos/Makefile.tc":"2ae12ee2a3e62f7c5a0520d0fbe4adee772bc07fe816002b07ccb43db3daa76a","src/zlib/nintendods/Makefile":"ea5823efe6830132294eddf2f56dbd7db8712244c210bb4968c431b1a91bd066","src/zlib/nintendods/README":"e362426c47b39ff6a7d6c75c6660b20abf076cdfa5e1e421716dc629a71aef95","src/zlib/old/Makefile.emx":"d811f032272aae50123a889297af3a02fbd60d1e42bbef11466462f627ff7b5b","src/zlib/old/Makefile.riscos":"d1a488b160fbfd53272b68a913283a4be08ba9d490796b196dddb2ba535b41e0","src/zlib/old/README":"551a0f4d91fe0f827a31cbdfbb4a71d1f3dc4d06564d80a3f526b749dd104d11","src/zlib/old/descrip.mms":"8ff08c35c056df9c986f23c09cf8936db63ccf12c3c42f7d18a48b36f060cff7","src/zlib/old/os2/Makefile.os2":"6ad247c00f00ff42fd2d62555e86251cef06e4079378241b5f320c227507d51d","src/zlib/old/os2/zlib.def":"ea9c61876d2e20b67ef2d9495991a32798eb40d13ede95859a2f4f03b65b9b61","src/zlib/old/visual-basic.txt":"1727650acbde9a9e6aec9438896377e46a12699cca5d46c5399cef524dedc614","src/zlib/os400/README400":"6f95a1beb0fbf943a3312eaa3dd2c279f1cef93062bebbff63dd37ac9e2aa8d6","src/zlib/os400/bndsrc":"cfe00b1528d5c27813cd6b1ad7aa34b493fd63d615623fb21fd1a7bf99d2255e","src/zlib/os400/make.sh":"143394d1e3876c61c29078c0e47310e726e1f5bd42739fe92df9ece65711655f","src/zlib/os400/zlib.inc":"c501c522185ba1f0506caf90d72f1088b34b2addc169471e949e443ab65e8a75","src/zlib/qnx/package.qpg":"90b5c8364d9dc5ef67405b352c19710ebad2905f3f20b9e56ded74661f96743b","src/zlib/test/example.c":"520799662a8286725540d6d5a356efe6f595618e5fe2e591972491d719bd99aa","src/zlib/test/infcover.c":"f654f3fcc74b33bd95cda63d13fe0ce589bcfe965544e0c17ee597d75efbd090","src/zlib/test/minigzip.c":"91089b21e692797bb6208b2b45eeb90f5f1f1e4f6b67b99dea5676f51b811193","src/zlib/treebuild.xml":"d816c764c8ec2d5b2ebfa7f053f747097926c13fce7fa8628c5d14c991411421","src/zlib/trees.c":"f2a5f949ea70dde7c23a54c793aeed630a03df4bb72417cd3aa008000c44699b","src/zlib/trees.h":"bb0a9d3ca88ee00c81adb7c636e73b97085f6ef1b52d6d58edbe2b6dc3adeb4d","src/zlib/uncompr.c":"31922aa982ee12fd28d1ce5fe6a94a3f07c2a941c821b566a881ca21845cdfaf","src/zlib/watcom/watcom_f.mak":"7e039b912f9cffaa40835281430bb284fa9042b0a0d12f6b34700a06bca6576e","src/zlib/watcom/watcom_l.mak":"d11b4064604a034725860e63e3f6d347056372e4b1675b183e20a93533b20cc9","src/zlib/win32/DLL_FAQ.txt":"9e00778319381e6275691dd3a89410c99065b8c0c5db96473abe8c859cbdefd8","src/zlib/win32/Makefile.bor":"e878fed2313417db085fea621c110889f6a32233b5b6db46e3c4e824c1d0ed6b","src/zlib/win32/Makefile.gcc":"ea8feddce7b9707253b9bf86623cf7ebe5294d7aea2b3b0b1b1c1b8cfd73009d","src/zlib/win32/Makefile.msc":"7c495d63c5afea1d77d162a41b73bab89cee952c12e4647e9684a7ac79bfc3f5","src/zlib/win32/README-WIN32.txt":"b71f1f4e4760812c3a11b2bae6f40d1066741a90e6646010a32ce50a0e348cde","src/zlib/win32/VisualC.txt":"9ec0babd46eaa012371dee2d3a8a55d9c7130f7895512c3371c737e4a7f6a997","src/zlib/win32/zlib.def":"24fa6dd00f3f4c0d14507a03ddbfa42707a04e3901bb9ff6f90096037a75185a","src/zlib/win32/zlib1.rc":"8fc5f2b5abee40ad66e6d6cfc9f926c2f446e13a7c9ee7df8bf58a266d8cade5","src/zlib/zconf.h":"9c0087f31cd45fe4bfa0ca79b51df2c69d67c44f2fbb2223d7cf9ab8d971c360","src/zlib/zconf.h.cmakein":"d740b750e9c98e6a4b4529cc2a857a3fa8001514b1ce91e0e1d9d293652bf388","src/zlib/zconf.h.in":"9c0087f31cd45fe4bfa0ca79b51df2c69d67c44f2fbb2223d7cf9ab8d971c360","src/zlib/zlib.3":"5abef003e545566e5599e5ab2e7528e978be59d54546b19d763d062f7a69bac7","src/zlib/zlib.3.pdf":"7f0f633641d782e360eff9fe831716c5767faf1000e38382a8a8c65b0b67f374","src/zlib/zlib.h":"4ddc82b4af931ab55f44d977bde81bfbc4151b5dcdccc03142831a301b5ec3c8","src/zlib/zlib.map":"7eb1070ba6bf12e6895e5da06b84a92af683827587afaa72bdd45e80b9d8e4e9","src/zlib/zlib.pc.cmakein":"2f1d0b18ce37c2af415a469857f02aee2c41a58877aff21d29e9c6db32b55cb7","src/zlib/zlib.pc.in":"04c01cc2e1a0ed123518b5855f585c93a24526dd88982c414111ea1fc9f07997","src/zlib/zlib2ansi":"d316e3e79054f5f9fe921d35f4bbf4bf0a37b859d29d2b34ae4d7d92afc3e55c","src/zlib/zutil.c":"f7fdc9ef326a2683eb33c794face54e83c751ec17f3d1ba581847a62af36ddcd","src/zlib/zutil.h":"9a63f6690fac1620aa3cecee5752af618806da438a256b4a047fbcd289cac159"},"package":"de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"} diff --git a/poky/meta/recipes-devtools/rust/libstd-rs.inc b/poky/meta/recipes-devtools/rust/libstd-rs.inc deleted file mode 100644 index d49383ced5..0000000000 --- a/poky/meta/recipes-devtools/rust/libstd-rs.inc +++ /dev/null @@ -1,40 +0,0 @@ -SUMMARY = "Rust standard libaries" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "MIT | Apache-2.0" -LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0" - -RUSTLIB_DEP = "" -inherit cargo - -DEPENDS:append:libc-musl = " libunwind" -# rv32 does not have libunwind ported yet -DEPENDS:remove:riscv32 = "libunwind" -DEPENDS:remove:riscv64 = "libunwind" - -# Embed bitcode in order to allow compiling both with and without LTO -RUSTFLAGS += "-Cembed-bitcode=yes" -# Needed so cargo can find libbacktrace -RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so" - -S = "${RUSTSRC}/src/libstd" - -CARGO_FEATURES ?= "panic-unwind backtrace" -CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'" -CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" - -do_compile:prepend () { - export CARGO_TARGET_DIR="${B}" - # For Rust 1.13.0 and newer - export RUSTC_BOOTSTRAP="1" -} - -do_install () { - mkdir -p ${D}${rustlibdir} - - # With the incremental build support added in 1.24, the libstd deps directory also includes dependency - # files that get installed. Those are really only needed to incrementally rebuild the libstd library - # itself and don't need to be installed. - rm -f ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/*.d - cp ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir} -} diff --git a/poky/meta/recipes-devtools/rust/libstd-rs_1.65.0.bb b/poky/meta/recipes-devtools/rust/libstd-rs_1.65.0.bb deleted file mode 100644 index eec0245ae1..0000000000 --- a/poky/meta/recipes-devtools/rust/libstd-rs_1.65.0.bb +++ /dev/null @@ -1,7 +0,0 @@ -require rust-source.inc -require libstd-rs.inc - -# libstd moved from src/libstd to library/std in 1.47+ -S = "${RUSTSRC}/library/std" - -BBCLASSEXTEND = "nativesdk" diff --git a/poky/meta/recipes-devtools/rust/libstd-rs_1.66.0.bb b/poky/meta/recipes-devtools/rust/libstd-rs_1.66.0.bb new file mode 100644 index 0000000000..8802e9790c --- /dev/null +++ b/poky/meta/recipes-devtools/rust/libstd-rs_1.66.0.bb @@ -0,0 +1,47 @@ +SUMMARY = "Rust standard libaries" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" +LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=92289ed52a60b63ab715612ad2915603" + +require rust-source.inc + +# Building with library/std omits proc_macro from the sysroot. Using +# library/test causes that to be installed which then allows cargo to +# build (https://github.com/meta-rust/meta-rust/issues/266) +S = "${RUSTSRC}/library/test" + +RUSTLIB_DEP = "" +inherit cargo + +DEPENDS:append:libc-musl = " libunwind" +# rv32 does not have libunwind ported yet +DEPENDS:remove:riscv32 = "libunwind" +DEPENDS:remove:riscv64 = "libunwind" + +# Embed bitcode in order to allow compiling both with and without LTO +RUSTFLAGS += "-Cembed-bitcode=yes" +# Needed so cargo can find libbacktrace +RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so" + +CARGO_FEATURES ?= "panic-unwind backtrace" +CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'" +CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" + +do_compile:prepend () { + export CARGO_TARGET_DIR="${B}" + # For Rust 1.13.0 and newer + export RUSTC_BOOTSTRAP="1" +} + +do_install () { + mkdir -p ${D}${rustlibdir} + + # With the incremental build support added in 1.24, the libstd deps directory also includes dependency + # files that get installed. Those are really only needed to incrementally rebuild the libstd library + # itself and don't need to be installed. + rm -f ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/*.d + cp ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir} +} + +BBCLASSEXTEND = "nativesdk" diff --git a/poky/meta/recipes-devtools/rust/rust-cross-canadian_1.65.0.bb b/poky/meta/recipes-devtools/rust/rust-cross-canadian_1.65.0.bb deleted file mode 100644 index 55865238ab..0000000000 --- a/poky/meta/recipes-devtools/rust/rust-cross-canadian_1.65.0.bb +++ /dev/null @@ -1,2 +0,0 @@ -inherit cross-canadian -require rust-cross-canadian.inc \ No newline at end of file diff --git a/poky/meta/recipes-devtools/rust/rust-cross-canadian_1.66.0.bb b/poky/meta/recipes-devtools/rust/rust-cross-canadian_1.66.0.bb new file mode 100644 index 0000000000..55865238ab --- /dev/null +++ b/poky/meta/recipes-devtools/rust/rust-cross-canadian_1.66.0.bb @@ -0,0 +1,2 @@ +inherit cross-canadian +require rust-cross-canadian.inc \ No newline at end of file diff --git a/poky/meta/recipes-devtools/rust/rust-llvm.inc b/poky/meta/recipes-devtools/rust/rust-llvm.inc deleted file mode 100644 index 625eb57041..0000000000 --- a/poky/meta/recipes-devtools/rust/rust-llvm.inc +++ /dev/null @@ -1,78 +0,0 @@ -SUMMARY = "LLVM compiler framework (packaged with rust)" -LICENSE ?= "Apache-2.0-with-LLVM-exception" -HOMEPAGE = "http://www.rust-lang.org" - -SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ - file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ - file://0003-llvm-fix-include-benchmarks.patch;striplevel=2" - -S = "${RUSTSRC}/src/llvm-project/llvm" - -LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe" - -inherit cmake python3native - -DEPENDS += "ninja-native rust-llvm-native" - -ARM_INSTRUCTION_SET:armv5 = "arm" -ARM_INSTRUCTION_SET:armv4t = "arm" - -# rustc_llvm with debug info is not recognized as a valid crate that's -# generated by rust-llvm-native. -CFLAGS:remove = "-g" -CXXFLAGS:remove = "-g" - -LLVM_DIR = "llvm${LLVM_RELEASE}" - -EXTRA_OECMAKE = " \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_TARGETS_TO_BUILD='ARM;AArch64;Mips;PowerPC;RISCV;X86' \ - -DLLVM_BUILD_DOCS=OFF \ - -DLLVM_ENABLE_TERMINFO=OFF \ - -DLLVM_ENABLE_ZLIB=OFF \ - -DLLVM_ENABLE_LIBXML2=OFF \ - -DLLVM_ENABLE_FFI=OFF \ - -DLLVM_INSTALL_UTILS=ON \ - -DLLVM_BUILD_EXAMPLES=OFF \ - -DLLVM_INCLUDE_EXAMPLES=OFF \ - -DLLVM_BUILD_TESTS=OFF \ - -DLLVM_INCLUDE_TESTS=OFF \ - -DLLVM_TARGET_ARCH=${TARGET_ARCH} \ - -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \ -" -EXTRA_OECMAKE:append:class-target = "\ - -DCMAKE_CROSSCOMPILING:BOOL=ON \ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ - -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ -" - -EXTRA_OECMAKE:append:class-nativesdk = "\ - -DCMAKE_CROSSCOMPILING:BOOL=ON \ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ - -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ -" - -# The debug symbols are huge here (>2GB) so suppress them since they -# provide almost no value. If you really need them then override this -INHIBIT_PACKAGE_DEBUG_SPLIT = "1" - -export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" - -do_install:append () { - # we don't need any of this stuff to build Rust - rm -rf "${D}/usr/lib/cmake" -} - -PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto" - -# Add the extra locations to avoid the complaints about unpackaged files -FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so" -FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so" -FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*" -FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a" -FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin" -FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch b/poky/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch new file mode 100644 index 0000000000..fe98e3e4c0 --- /dev/null +++ b/poky/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch @@ -0,0 +1,79 @@ +From cd2fa12d715929642513fc441287c402f4560096 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 25 Dec 2022 15:13:41 -0800 +Subject: [PATCH] build: Enable 64bit off_t on 32bit glibc systems + +Pass -D_FILE_OFFSET_BITS=64 to compiler flags on 32bit glibc based +systems. This will make sure that 64bit versions of LFS functions are +used e.g. lseek will behave same as lseek64. Also revert [1] partially +because this added a cmake test to detect lseek64 but then forgot to +pass the needed macro during actual compile, this test was incomplete too +since libc implementations like musl has 64-bit off_t by default on 32-bit +systems and does not bundle -D_LARGEFILE64_SOURCE [2] under -D_GNU_SOURCE +like glibc, which means the compile now fails on musl because the cmake +check passes but we do not have _LARGEFILE64_SOURCE defined. Moreover, +Using the *64 function was transitional anyways so use +-D_FILE_OFFSET_BITS=64 instead + +[1] https://github.com/llvm/llvm-project/commit/8db7e5e4eed4c4e697dc3164f2c9351d8c3e942b +[2] https://git.musl-libc.org/cgit/musl/commit/?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc + +Upstream-Status: Submitted [https://reviews.llvm.org/D139752] +Signed-off-by: Khem Raj +--- + llvm/cmake/config-ix.cmake | 8 +++++--- + llvm/include/llvm/Config/config.h.cmake | 3 --- + llvm/lib/Support/raw_ostream.cpp | 2 -- + llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn | 2 -- + utils/bazel/llvm-project-overlay/llvm/config.bzl | 1 - + .../llvm/include/llvm/Config/config.h | 3 --- + utils/bazel/llvm_configs/config.h.cmake | 3 --- + 7 files changed, 5 insertions(+), 17 deletions(-) + +--- a/llvm/cmake/config-ix.cmake ++++ b/llvm/cmake/config-ix.cmake +@@ -284,9 +284,6 @@ check_symbol_exists(futimes sys/time.h H + if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE ) + check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK) + endif() +-set(CMAKE_REQUIRED_DEFINITIONS "-D_LARGEFILE64_SOURCE") +-check_symbol_exists(lseek64 "sys/types.h;unistd.h" HAVE_LSEEK64) +-set(CMAKE_REQUIRED_DEFINITIONS "") + check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL) + check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) + check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2) +@@ -350,6 +347,11 @@ check_symbol_exists(__GLIBC__ stdio.h LL + if( LLVM_USING_GLIBC ) + add_definitions( -D_GNU_SOURCE ) + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") ++# enable 64bit off_t on 32bit systems using glibc ++ if (CMAKE_SIZEOF_VOID_P EQUAL 4) ++ add_compile_definitions(_FILE_OFFSET_BITS=64) ++ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") ++ endif() + endif() + # This check requires _GNU_SOURCE + if (NOT PURE_WINDOWS) +--- a/llvm/include/llvm/Config/config.h.cmake ++++ b/llvm/include/llvm/Config/config.h.cmake +@@ -128,9 +128,6 @@ + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_LINK_H ${HAVE_LINK_H} + +-/* Define to 1 if you have the `lseek64' function. */ +-#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64} +- + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} + +--- a/llvm/lib/Support/raw_ostream.cpp ++++ b/llvm/lib/Support/raw_ostream.cpp +@@ -804,8 +804,6 @@ uint64_t raw_fd_ostream::seek(uint64_t o + flush(); + #ifdef _WIN32 + pos = ::_lseeki64(FD, off, SEEK_SET); +-#elif defined(HAVE_LSEEK64) +- pos = ::lseek64(FD, off, SEEK_SET); + #else + pos = ::lseek(FD, off, SEEK_SET); + #endif diff --git a/poky/meta/recipes-devtools/rust/rust-llvm_1.65.0.bb b/poky/meta/recipes-devtools/rust/rust-llvm_1.65.0.bb deleted file mode 100644 index 396f741953..0000000000 --- a/poky/meta/recipes-devtools/rust/rust-llvm_1.65.0.bb +++ /dev/null @@ -1,6 +0,0 @@ -# check src/llvm-project/llvm/CMakeLists.txt for llvm version in use -# -LLVM_RELEASE = "14.0.5" -require rust-source.inc -require rust-llvm.inc - diff --git a/poky/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb b/poky/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb new file mode 100644 index 0000000000..4cc57d12ae --- /dev/null +++ b/poky/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb @@ -0,0 +1,85 @@ +SUMMARY = "LLVM compiler framework (packaged with rust)" +LICENSE ?= "Apache-2.0-with-LLVM-exception" +HOMEPAGE = "http://www.rust-lang.org" + +# check src/llvm-project/llvm/CMakeLists.txt for llvm version in use +# +LLVM_RELEASE = "15.0.2" + +require rust-source.inc + +SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ + file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ + file://0003-llvm-fix-include-benchmarks.patch;striplevel=2 \ + file://0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch;striplevel=2" + +S = "${RUSTSRC}/src/llvm-project/llvm" + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe" + +inherit cmake python3native + +DEPENDS += "ninja-native rust-llvm-native" + +ARM_INSTRUCTION_SET:armv5 = "arm" +ARM_INSTRUCTION_SET:armv4t = "arm" + +# rustc_llvm with debug info is not recognized as a valid crate that's +# generated by rust-llvm-native. +CFLAGS:remove = "-g" +CXXFLAGS:remove = "-g" + +LLVM_DIR = "llvm${LLVM_RELEASE}" + +EXTRA_OECMAKE = " \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_TARGETS_TO_BUILD='ARM;AArch64;Mips;PowerPC;RISCV;X86' \ + -DLLVM_BUILD_DOCS=OFF \ + -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_ENABLE_ZLIB=OFF \ + -DLLVM_ENABLE_LIBXML2=OFF \ + -DLLVM_ENABLE_FFI=OFF \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_BUILD_EXAMPLES=OFF \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_BUILD_TESTS=OFF \ + -DLLVM_INCLUDE_TESTS=OFF \ + -DLLVM_TARGET_ARCH=${TARGET_ARCH} \ + -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \ +" +EXTRA_OECMAKE:append:class-target = "\ + -DCMAKE_CROSSCOMPILING:BOOL=ON \ + -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ + -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ +" + +EXTRA_OECMAKE:append:class-nativesdk = "\ + -DCMAKE_CROSSCOMPILING:BOOL=ON \ + -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ + -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ +" + +# The debug symbols are huge here (>2GB) so suppress them since they +# provide almost no value. If you really need them then override this +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" + +export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" + +do_install:append () { + # we don't need any of this stuff to build Rust + rm -rf "${D}/usr/lib/cmake" +} + +PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto" + +# Add the extra locations to avoid the complaints about unpackaged files +FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so" +FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so" +FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*" +FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a" +FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin" +FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/rust/rust-snapshot.inc b/poky/meta/recipes-devtools/rust/rust-snapshot.inc index 2f9cdb9566..6420bcff55 100644 --- a/poky/meta/recipes-devtools/rust/rust-snapshot.inc +++ b/poky/meta/recipes-devtools/rust/rust-snapshot.inc @@ -5,21 +5,22 @@ ## The version is replicated here. ## TODO: find a way to add additional SRC_URIs based on the contents of an ## earlier SRC_URI. -RS_VERSION = "1.64.0" -CARGO_VERSION = "1.64.0" + +SNAPSHOT_VERSION = "1.65.0" +CARGO_VERSION = "1.65.0" # TODO: Add hashes for other architecture toolchains as well. Make a script? -SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "6ace34bcbba9557aa2fc3a0515c3da4a83ca24d7d45506c5e1b32f589fa38a8b" -SRC_URI[rustc-snapshot-x86_64.sha256sum] = "1f5756a03119853b53358018c5b1592940a2354c3c9f84ee7faf684e3478f8f0" -SRC_URI[cargo-snapshot-x86_64.sha256sum] = "21434d83a30ad3fa4e4831487c5574a20b07dd57d213b26e1246290c57d4ec41" +SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "2b588cd2d49688c0c33b7466614123e8fe4c910f4d802fc0ff0662b1772816a9" +SRC_URI[rustc-snapshot-x86_64.sha256sum] = "62b89786e195fc5a8a262f83118d6689832b24228c9d303cba8ac14dc1e9adc8" +SRC_URI[cargo-snapshot-x86_64.sha256sum] = "82547aacaf42fc3c2970ec31b96751dfbeba3dffe1a042a3780bd670c29a89bf" -SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "40abc9ec4f86ff0e37ba176e4c68dfa708e9857bb0372169c865367593127566" -SRC_URI[rustc-snapshot-aarch64.sha256sum] = "8f10b379bcc8caaab983b7d04a3f105dae42f95718f231b46d7e68685d239191" -SRC_URI[cargo-snapshot-aarch64.sha256sum] = "103d69e4f2f49f5a6309d7d195747b31f94cf707f90fb49cf76039a5ce6295c7" +SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "735b681c8a6e60925c76d6cc899e78b4cb4562ada24a1f265b2021c1faad78ad" +SRC_URI[rustc-snapshot-aarch64.sha256sum] = "67c3d3545fd898c1383071c0f6296453565e0da10903c50652d7bf679b53e8a2" +SRC_URI[cargo-snapshot-aarch64.sha256sum] = "3fd483c0d58673ab69862824408c8a48612827ddcdeaaca0f8fbe5ca02214a4c" -SRC_URI[rust-std-snapshot-powerpc64le.sha256sum] = "ef697469b2a3ea8897f49b70e3be0c7aaca3f26fd3234812113e2e85cafac738" -SRC_URI[rustc-snapshot-powerpc64le.sha256sum] = "11630fc51fffe722e52f649357b5948c24b5305cfb61a8114527234e054451c4" -SRC_URI[cargo-snapshot-powerpc64le.sha256sum] = "ba7188b2c7890e61bf58d3aa9e94c323fec375f67cf03841bbcc0f6c800fe6ad" +SRC_URI[rust-std-snapshot-powerpc64le.sha256sum] = "ce18b44300f7d5d94856cef5b270ba010061fafa411beb9782207e26cbab88a6" +SRC_URI[rustc-snapshot-powerpc64le.sha256sum] = "a6ce7aadd10a3fd84fe4717a59378421a65b101b61f27eed8b09336b8daf62cf" +SRC_URI[cargo-snapshot-powerpc64le.sha256sum] = "9393de910df7cd6947e380460a1144ac2373a36c776c7367a81212a51a92d9a7" SRC_URI += " \ https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \ @@ -27,6 +28,6 @@ SRC_URI += " \ https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \ " -RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" -RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" +RUST_STD_SNAPSHOT = "rust-std-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" +RUSTC_SNAPSHOT = "rustc-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" diff --git a/poky/meta/recipes-devtools/rust/rust-source.inc b/poky/meta/recipes-devtools/rust/rust-source.inc index 0c85b4b480..6f1df4561b 100644 --- a/poky/meta/recipes-devtools/rust/rust-source.inc +++ b/poky/meta/recipes-devtools/rust/rust-source.inc @@ -1,13 +1,23 @@ -SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz;name=rust" -SRC_URI[rust.sha256sum] = "2d6aa2ea3fedd55acbbd65f78349385f9daa9c14e25db7a8df5d015588eee1cf" +RUST_VERSION ?= "${@d.getVar('PV').split('-')[0]}" -SRC_URI:append:class-target:pn-rust = " \ - file://hardcodepaths.patch \ - file://crossbeam_atomic.patch \ - file://0001-Add-ENOTSUP-constant-for-riscv32-musl.patch" -SRC_URI:append:class-nativesdk:pn-nativesdk-rust = " file://hardcodepaths.patch" +SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;name=rust \ + file://crossbeam_atomic.patch;patchdir=${RUSTSRC} \ + file://hardcodepaths.patch;patchdir=${RUSTSRC} \ + file://getrandom-open64.patch;patchdir=${RUSTSRC} \ + file://0001-Do-not-use-LFS64-on-linux-with-musl.patch;patchdir=${RUSTSRC} \ + file://zlib-off64_t.patch;patchdir=${RUSTSRC} \ +" +SRC_URI[rust.sha256sum] = "0dc176e34fae9871f855a6ba4cb30fa19d69c5b4428d29281a07419c4950715c" -RUSTSRC = "${WORKDIR}/rustc-${PV}-src" +RUSTSRC = "${WORKDIR}/rustc-${RUST_VERSION}-src" + +# Used by crossbeam_atomic.patch +export TARGET_VENDOR UPSTREAM_CHECK_URI = "https://forge.rust-lang.org/infra/other-installation-methods.html" UPSTREAM_CHECK_REGEX = "rustc-(?P\d+(\.\d+)+)-src" + +# see recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch +# we need to link with ssp_nonshared on musl to avoid "undefined reference to `__stack_chk_fail_local'" +# when building MACHINE=qemux86 for musl +WRAPPER_TARGET_EXTRALD:libc-musl = "-lssp_nonshared" diff --git a/poky/meta/recipes-devtools/rust/rust-target.inc b/poky/meta/recipes-devtools/rust/rust-target.inc deleted file mode 100644 index dce2b47517..0000000000 --- a/poky/meta/recipes-devtools/rust/rust-target.inc +++ /dev/null @@ -1,10 +0,0 @@ -require rust.inc - -DEPENDS += "rust-llvm (=${PV})" - -# Otherwise we'll depend on what we provide -INHIBIT_DEFAULT_RUST_DEPS:class-native = "1" -# We don't need to depend on gcc-native because yocto assumes it exists -PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/rust/rust.inc b/poky/meta/recipes-devtools/rust/rust.inc deleted file mode 100644 index 956301023a..0000000000 --- a/poky/meta/recipes-devtools/rust/rust.inc +++ /dev/null @@ -1,219 +0,0 @@ -SUMMARY = "Rust compiler and runtime libaries" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "MIT | Apache-2.0" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0" - -inherit rust -inherit cargo_common - -DEPENDS += "file-native python3-native" -DEPENDS:append:class-native = " rust-llvm-native" -DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" - -S = "${RUSTSRC}" - -export FORCE_CRATE_HASH="${BB_TASKHASH}" - -RUST_ALTERNATE_EXE_PATH ?= "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" -RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" - -# We don't want to use bitbakes vendoring because the rust sources do their -# own vendoring. -CARGO_DISABLE_BITBAKE_VENDORING = "1" - -# We can't use RUST_BUILD_SYS here because that may be "musl" if -# TCLIBC="musl". Snapshots are always -unknown-linux-gnu -setup_cargo_environment () { - # The first step is to build bootstrap and some early stage tools, - # these are build for the same target as the snapshot, e.g. - # x86_64-unknown-linux-gnu. - # Later stages are build for the native target (i.e. target.x86_64-linux) - cargo_common_do_configure -} - -inherit rust-target-config - -do_rust_setup_snapshot () { - for installer in "${WORKDIR}/rust-snapshot-components/"*"/install.sh"; do - "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig - done - - # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo - # and fail without it there. - mkdir -p ${RUSTSRC}/build/${BUILD_SYS} - ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 - - # Need to use uninative's loader if enabled/present since the library paths - # are used internally by rust and result in symbol mismatches if we don't - if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then - for bin in cargo rustc rustdoc; do - patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER} - done - fi -} -addtask rust_setup_snapshot after do_unpack before do_configure -do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot" -do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" - -python do_configure() { - import json - try: - import configparser - except ImportError: - import ConfigParser as configparser - - # toml is rather similar to standard ini like format except it likes values - # that look more JSON like. So for our purposes simply escaping all values - # as JSON seem to work fine. - - e = lambda s: json.dumps(s) - - config = configparser.RawConfigParser() - - # [target.ARCH-poky-linux] - host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True)) - config.add_section(host_section) - - llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") - llvm_config_build = d.expand("${RUST_ALTERNATE_EXE_PATH_NATIVE}") - config.set(host_section, "llvm-config", e(llvm_config_target)) - - config.set(host_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) - config.set(host_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) - config.set(host_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) - if "musl" in host_section: - config.set(host_section, "musl-root", e(d.expand("${STAGING_DIR_HOST}${exec_prefix}"))) - - # If we don't do this rust-native will compile it's own llvm for BUILD. - # [target.${BUILD_ARCH}-unknown-linux-gnu] - build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS', True)) - if build_section != host_section: - config.add_section(build_section) - - config.set(build_section, "llvm-config", e(llvm_config_build)) - - config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) - config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) - config.set(build_section, "linker", e(d.expand("${RUST_BUILD_CCLD}"))) - - target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) - if target_section != host_section and target_section != build_section: - config.add_section(target_section) - - config.set(target_section, "llvm-config", e(llvm_config_target)) - - config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) - config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) - config.set(target_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) - - # [llvm] - config.add_section("llvm") - config.set("llvm", "static-libstdcpp", e(False)) - if "llvm" in (d.getVar('TC_CXX_RUNTIME') or ""): - config.set("llvm", "use-libcxx", e(True)) - - # [rust] - config.add_section("rust") - config.set("rust", "rpath", e(True)) - config.set("rust", "channel", e("stable")) - - # Whether or not to optimize the compiler and standard library - config.set("rust", "optimize", e(True)) - - # Emits extraneous output from tests to ensure that failures of the test - # harness are debuggable just from logfiles - config.set("rust", "verbose-tests", e(True)) - - # [build] - config.add_section("build") - config.set("build", "submodules", e(False)) - config.set("build", "docs", e(False)) - - rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc") - config.set("build", "rustc", e(rustc)) - - # Support for the profiler runtime to generate e.g. coverage report, - # PGO etc. - config.set("build", "profiler", e(True)) - - cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo") - config.set("build", "cargo", e(cargo)) - - config.set("build", "vendor", e(True)) - - if not "targets" in locals(): - targets = [d.getVar("RUST_TARGET_SYS", True)] - config.set("build", "target", e(targets)) - - if not "hosts" in locals(): - hosts = [d.getVar("RUST_HOST_SYS", True)] - config.set("build", "host", e(hosts)) - - # We can't use BUILD_SYS since that is something the rust snapshot knows - # nothing about when trying to build some stage0 tools (like fabricate) - config.set("build", "build", e(d.getVar("RUST_BUILD_SYS", True))) - - # [install] - config.add_section("install") - # ./x.py install doesn't have any notion of "destdir" - # but we can prepend ${D} to all the directories instead - config.set("install", "prefix", e(d.getVar("D", True) + d.getVar("prefix", True))) - config.set("install", "bindir", e(d.getVar("D", True) + d.getVar("bindir", True))) - config.set("install", "libdir", e(d.getVar("D", True) + d.getVar("libdir", True))) - config.set("install", "datadir", e(d.getVar("D", True) + d.getVar("datadir", True))) - config.set("install", "mandir", e(d.getVar("D", True) + d.getVar("mandir", True))) - - with open("config.toml", "w") as f: - f.write('changelog-seen = 2\n\n') - config.write(f) - - # set up ${WORKDIR}/cargo_home - bb.build.exec_func("setup_cargo_environment", d) -} - - -rust_runx () { - echo "COMPILE ${PN}" "$@" - - # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a - # wide range of targets (not just TARGET). Yocto's settings for them will - # be inappropriate, avoid using. - unset CFLAGS - unset LDFLAGS - unset CXXFLAGS - unset CPPFLAGS - - export RUSTFLAGS="${RUST_DEBUG_REMAP}" - - # Copy the natively built llvm-config into the target so we can run it. Horrible, - # but works! - if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} ]; then - mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` - cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} - chrpath -d ${RUST_ALTERNATE_EXE_PATH} - fi - - oe_cargo_fix_env - - python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose -} -rust_runx[vardepsexclude] += "PARALLEL_MAKE" - -do_compile () { - rust_runx build -} - -rust_do_install () { - mkdir -p ${D}${bindir} - cp build/${RUST_HOST_SYS}/stage2/bin/* ${D}${bindir} - - mkdir -p ${D}${libdir}/rustlib - cp -pRd build/${RUST_HOST_SYS}/stage2/lib/* ${D}${libdir} - # Remove absolute symlink so bitbake doesn't complain - rm -f ${D}${libdir}/rustlib/src/rust -} - -do_install () { - rust_do_install -} diff --git a/poky/meta/recipes-devtools/rust/rust/0001-Add-ENOTSUP-constant-for-riscv32-musl.patch b/poky/meta/recipes-devtools/rust/rust/0001-Add-ENOTSUP-constant-for-riscv32-musl.patch deleted file mode 100644 index ecfe0fe9b0..0000000000 --- a/poky/meta/recipes-devtools/rust/rust/0001-Add-ENOTSUP-constant-for-riscv32-musl.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e9fb036eeffaaa5cb7b1e6fc1dabb92ed6263f0f Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 19 Aug 2022 10:26:43 -0700 -Subject: [PATCH] Add ENOTSUP constant for riscv32/musl - -Upstream-Status: Backport [https://github.com/rust-lang/libc/commit/e9fb036eeffaaa5cb7b1e6fc1dabb92ed6263f0f] -Signed-off-by: Khem Raj ---- - vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs | 1 + - 1 file changed, 1 insertion(+) - -Index: rustc-1.65.0-src/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs -=================================================================== ---- rustc-1.65.0-src.orig/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs -+++ rustc-1.65.0-src/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs -@@ -271,6 +271,7 @@ pub const ENOPROTOOPT: ::c_int = 92; - pub const EPROTONOSUPPORT: ::c_int = 93; - pub const ESOCKTNOSUPPORT: ::c_int = 94; - pub const EOPNOTSUPP: ::c_int = 95; -+pub const ENOTSUP: ::c_int = EOPNOTSUPP; - pub const EPFNOSUPPORT: ::c_int = 96; - pub const EAFNOSUPPORT: ::c_int = 97; - pub const EADDRINUSE: ::c_int = 98; -Index: rustc-1.65.0-src/vendor/libc/.cargo-checksum.json -=================================================================== ---- rustc-1.65.0-src.orig/vendor/libc/.cargo-checksum.json -+++ rustc-1.65.0-src/vendor/libc/.cargo-checksum.json -@@ -1 +1 @@ --{"files":{"CONTRIBUTING.md":"f480d10d2a506eecd23ae2e2dedb7a28b8bf6dae5f46f438dbb61be2003426fb","Cargo.toml":"1549dc2db0ecd74316f52b2d14b15144ae970a848bf3d54c048844ed7a35df2a","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"a8d47ff51ca256f56a8932dba07660672dbfe3004257ca8de708aac1415937a1","README.md":"776affa26b66843a2b4f1a1c8f88d92f6461b74568911450fea717e9db6f877b","build.rs":"1d0cbe878e98e970c3318cac0772215a9f44bd286d859d665da27872ba9d8818","rustfmt.toml":"eaa2ea84fc1ba0359b77680804903e07bb38d257ab11986b95b158e460f787b2","src/fixed_width_ints.rs":"7f986e5f5e68d25ef04d386fd2f640e8be8f15427a8d4a458ea01d26b8dca0ca","src/fuchsia/aarch64.rs":"378776a9e40766154a54c94c2a7b4675b5c302a38e6e42da99e67bfbaee60e56","src/fuchsia/align.rs":"ae1cf8f011a99737eabeb14ffff768e60f13b13363d7646744dbb0f443dab3d6","src/fuchsia/mod.rs":"94cbaad15021e287a1b9546a697b04c1e560f1204b52204ffaaea5975c5d03b9","src/fuchsia/no_align.rs":"303f3f1b255e0088b5715094353cf00476131d8e94e6aebb3f469557771c8b8a","src/fuchsia/x86_64.rs":"93a3632b5cf67d2a6bcb7dc0a558605252d5fe689e0f38d8aa2ec5852255ac87","src/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/hermit/mod.rs":"d3bfce41e4463d4be8020a2d063c9bfa8b665f45f1cc6cbf3163f5d01e7cb21f","src/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/lib.rs":"ce753ef318b300bbd441feabdd77d00322dfb6ce9eee8c78a38afe02b57aa4c0","src/macros.rs":"b457eb028b8e8ab3c24bb7292b874ad4e491edbb83594f6a3da024df5348c088","src/psp.rs":"dd31aabd46171d474ec5828372e28588935120e7355c90c105360d8fa9264c1c","src/sgx.rs":"16a95cdefc81c5ee00d8353a60db363c4cc3e0f75abcd5d0144723f2a306ed1b","src/solid/aarch64.rs":"a726e47f324adf73a4a0b67a2c183408d0cad105ae66acf36db37a42ab7f8707","src/solid/arm.rs":"e39a4f74ebbef3b97b8c95758ad741123d84ed3eb48d9cf4f1f4872097fc27fe","src/solid/mod.rs":"5f4151dca5132e4b4e4c23ab9737e12856dddbdc0ca3f7dbc004328ef3c8acde","src/switch.rs":"9da3dd39b3de45a7928789926e8572d00e1e11a39e6f7289a1349aadce90edba","src/unix/align.rs":"2cdc7c826ef7ae61f5171c5ae8c445a743d86f1a7f2d9d7e4ceeec56d6874f65","src/unix/bsd/apple/b32/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b32/mod.rs":"2546ad3eb6aecb95f916648bc63264117c92b4b4859532b34cb011e4c75a5a72","src/unix/bsd/apple/b64/aarch64/align.rs":"e8eb38d064b5fefec6f37d42873820a0483e7c758ed336cc59a7155455ca89c9","src/unix/bsd/apple/b64/aarch64/mod.rs":"a3f0dfff62d0f7f4f1b5f9a4e2b662acf233a46badbc5419d3cc2d735629a710","src/unix/bsd/apple/b64/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b64/mod.rs":"f5e278a1af7fb358891d1c9be4eb7e815aaca0c5cb738d0c3604ba2208a856f7","src/unix/bsd/apple/b64/x86_64/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b64/x86_64/mod.rs":"8c87c5855038aae5d433c8f5eb3b29b0a175879a0245342b3bfd83bdf4cfd936","src/unix/bsd/apple/mod.rs":"56dc7604509f49b274770cade97a1874c8955c3b0a445fb857707ae0ca6df41b","src/unix/bsd/freebsdlike/dragonfly/errno.rs":"8295b8bb0dfd38d2cdb4d9192cdeeb534cc6c3b208170e64615fa3e0edb3e578","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"d0e8246063cae113806524a63a47c6c0628cc54a3ef03e938e89964f8b4f08b4","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"2a215bd6136b8617aacedf9be738ccee94da9d29b418e9a78101d6291c182352","src/unix/bsd/freebsdlike/freebsd/arm.rs":"59d6a670eea562fb87686e243e0a84603d29a2028a3d4b3f99ccc01bd04d2f47","src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs":"9808d152c1196aa647f1b0f0cf84dac8c930da7d7f897a44975545e3d9d17681","src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs":"a6eee615e6ca5a6e04b526bb6b22d13b9356e87e51825cda33476c37a46cb0ef","src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs":"61cbe45f8499bedb168106b686d4f8239472f25c7553b069eec2afe197ff2df6","src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs":"755dafaf3f0945e798c34ea94c48e8552804ce60e2a15a4f0649f9d1aceaf422","src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs":"2df36a7f122f6d6e5753cfb4d22e915cc80f6bc91c0161b3daae55a481bfd052","src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs":"61cbe45f8499bedb168106b686d4f8239472f25c7553b069eec2afe197ff2df6","src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs":"cc65a73b0fa95a77044a4b3ee76d6eceb9773b55aea7d73bdf070e6f66e9ea38","src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs":"2df36a7f122f6d6e5753cfb4d22e915cc80f6bc91c0161b3daae55a481bfd052","src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs":"61cbe45f8499bedb168106b686d4f8239472f25c7553b069eec2afe197ff2df6","src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs":"0ed92eb93e78299cd7de0ae9daebb04a53b3c2d5e6a078e1fcd977f2a86bffc3","src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs":"2df36a7f122f6d6e5753cfb4d22e915cc80f6bc91c0161b3daae55a481bfd052","src/unix/bsd/freebsdlike/freebsd/mod.rs":"ec229cc7af2511cb510c078e87e90ee2625090bfe94f40eb35f73d79143533aa","src/unix/bsd/freebsdlike/freebsd/powerpc.rs":"9ca3f82f88974e6db5569f2d76a5a3749b248a31747a6c0da5820492bdfeca42","src/unix/bsd/freebsdlike/freebsd/powerpc64.rs":"2dae3ecc87eac3b11657aa98915def55fc4b5c0de11fe26aae23329a54628a9a","src/unix/bsd/freebsdlike/freebsd/riscv64.rs":"8f591bd273464d684c4f64365f8ed56a8138175daa70d96008541393057a0dae","src/unix/bsd/freebsdlike/freebsd/x86.rs":"c5005e3249eb7c93cfbac72a9e9272320d80ce7983da990ceb05a447f59a02c5","src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs":"0e1f69a88fca1c32874b1daf5db3d446fefbe518dca497f096cc9168c39dde70","src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs":"51e4dd0c8ae247bb652feda5adad9333ea3bb30c750c3a3935e0b0e47d7803eb","src/unix/bsd/freebsdlike/mod.rs":"1e35b4773384ea143810cdce4b96f47108b37446430da30c96a0d1651656d73d","src/unix/bsd/mod.rs":"817ca5719c36a74c84e52c6a56a5998b60d7f02351a405e034f08ebab079b63a","src/unix/bsd/netbsdlike/mod.rs":"b07a0e81085bd811fce7270f3b90fbfea29faf9593d9e39d9d2ebbb9a78bf25f","src/unix/bsd/netbsdlike/netbsd/aarch64.rs":"65dcb58d11e8d8028401a9d07ca3eb4cb4f053e04249cc877353449d84ccc4cb","src/unix/bsd/netbsdlike/netbsd/arm.rs":"58cdbb70b0d6f536551f0f3bb3725d2d75c4690db12c26c034e7d6ec4a924452","src/unix/bsd/netbsdlike/netbsd/mod.rs":"8f9613e50c2771b33d7cf817a735d536b389ec57f861b9486d870373c768276e","src/unix/bsd/netbsdlike/netbsd/powerpc.rs":"ee7ff5d89d0ed22f531237b5059aa669df93a3b5c489fa641465ace8d405bf41","src/unix/bsd/netbsdlike/netbsd/sparc64.rs":"9489f4b3e4566f43bb12dfb92238960613dac7f6a45cc13068a8d152b902d7d9","src/unix/bsd/netbsdlike/netbsd/x86.rs":"20692320e36bfe028d1a34d16fe12ca77aa909cb02bda167376f98f1a09aefe7","src/unix/bsd/netbsdlike/netbsd/x86_64.rs":"1afe5ef46b14397cdd68664b5b232e4f5b035b6db1d4cf411c899d51ebca9f30","src/unix/bsd/netbsdlike/openbsd/aarch64.rs":"dd91931d373b7ecaf6e2de25adadee10d16fa9b12c2cbacdff3eb291e1ba36af","src/unix/bsd/netbsdlike/openbsd/arm.rs":"01580d261bc6447bb327a0d982181b7bdabfa066cee65a30373d3ced729ad307","src/unix/bsd/netbsdlike/openbsd/mips64.rs":"8532a189ae10c7d668d9d4065da8b05d124e09bd39442c9f74a7f231c43eca48","src/unix/bsd/netbsdlike/openbsd/mod.rs":"228505fa48292e74b06acbed96196801595a4b822da2126a6d6c7fa773cff8bc","src/unix/bsd/netbsdlike/openbsd/powerpc.rs":"01580d261bc6447bb327a0d982181b7bdabfa066cee65a30373d3ced729ad307","src/unix/bsd/netbsdlike/openbsd/powerpc64.rs":"1dd5449dd1fd3d51e30ffdeeaece91d0aaf05c710e0ac699fecc5461cfa2c28e","src/unix/bsd/netbsdlike/openbsd/riscv64.rs":"1dd5449dd1fd3d51e30ffdeeaece91d0aaf05c710e0ac699fecc5461cfa2c28e","src/unix/bsd/netbsdlike/openbsd/sparc64.rs":"d04fd287afbaa2c5df9d48c94e8374a532a3ba491b424ddf018270c7312f4085","src/unix/bsd/netbsdlike/openbsd/x86.rs":"6f7f5c4fde2a2259eb547890cbd86570cea04ef85347d7569e94e679448bec87","src/unix/bsd/netbsdlike/openbsd/x86_64.rs":"d31db31630289c85af3339dbe357998a21ca584cbae31607448fe2cf7675a4e1","src/unix/haiku/b32.rs":"a2efdbf7158a6da341e1db9176b0ab193ba88b449616239ed95dced11f54d87b","src/unix/haiku/b64.rs":"ff8115367d3d7d354f792d6176dfaaa26353f57056197b563bf4681f91ff7985","src/unix/haiku/mod.rs":"df7b6b7d8dd3441665bfe87f2abc942bddc65b8b10dfa9c83dd0422f68107891","src/unix/haiku/native.rs":"dbfcbf4954a79d1df2ff58e0590bbcb8c57dfc7a32392aa73ee4726b66bd6cc8","src/unix/haiku/x86_64.rs":"3ec3aeeb7ed208b8916f3e32d42bfd085ff5e16936a1a35d9a52789f043b7237","src/unix/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/unix/hermit/mod.rs":"859814f5df89e28fd4b345db399d181e11e7ed413841b6ff703a1fcbdbf013ae","src/unix/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/unix/linux_like/android/b32/arm.rs":"433c1530f602cc5ed26610c58055dde0c4ceea5e00150063b24ddc60768332a4","src/unix/linux_like/android/b32/mod.rs":"7c173e0375119bf06a3081652faede95e5bcd6858e7576b7533d037978737c8f","src/unix/linux_like/android/b32/x86/align.rs":"812914e4241df82e32b12375ca3374615dc3a4bdd4cf31f0423c5815320c0dab","src/unix/linux_like/android/b32/x86/mod.rs":"8388bd3a0fcb5636bf965eee6dc95ae6860b85a2b555b387c868aa4d4e01ec89","src/unix/linux_like/android/b64/aarch64/align.rs":"2179c3b1608fa4bf68840482bfc2b2fa3ee2faf6fcae3770f9e505cddca35c7b","src/unix/linux_like/android/b64/aarch64/int128.rs":"1735f6f5c56770d20dd426442f09724d9b2052b46a7cd82f23f3288a4a7276de","src/unix/linux_like/android/b64/aarch64/mod.rs":"ef230d49fd0d182adf2dae6f8e10babf18d72259d65980bf1c4c2dc8a4f84501","src/unix/linux_like/android/b64/mod.rs":"71e4fcbe952bfa4a5f9022f3972e906917b38f729b9d8ef57cd5d179104894ac","src/unix/linux_like/android/b64/riscv64/align.rs":"0bf138f84e5327d8339bcd4adf071a6832b516445e597552c82bbd881095e3a8","src/unix/linux_like/android/b64/riscv64/mod.rs":"80e9f93fed838a48b4e2e8d77b95c72cfd7c0647bcce63851555c5ad16dad143","src/unix/linux_like/android/b64/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/android/b64/x86_64/mod.rs":"e10d19bea39f719723ab6666a5ddbd378b6958769441c5904629e1df173b1dc2","src/unix/linux_like/android/mod.rs":"962741303dc24a5b9653f2e9b0b4ad9eb42fc54daa0a70ca70a7ce175e75094b","src/unix/linux_like/emscripten/align.rs":"86c95cbed7a7161b1f23ee06843e7b0e2340ad92b2cb86fe2a8ef3e0e8c36216","src/unix/linux_like/emscripten/mod.rs":"c69c90606d4362f8de89b8816df0ded724ed64b53bf55d15681fde171b7bb361","src/unix/linux_like/emscripten/no_align.rs":"0128e4aa721a9902754828b61b5ec7d8a86619983ed1e0544a85d35b1051fad6","src/unix/linux_like/linux/align.rs":"d6c259942c8e843373accd180fc8f4f45f03544dfd21b93a8d02641ead3ef63e","src/unix/linux_like/linux/arch/generic/mod.rs":"e20013ed91edcfb7f84f3f9f5a9ef827fd5c406e24b65989d8438da332236ef6","src/unix/linux_like/linux/arch/mips/mod.rs":"2d166054a586bb4bf6e4a4ba35f7574907b217225eff8f1a43adc4277e142460","src/unix/linux_like/linux/arch/mod.rs":"466a29622e47c6c7f1500682b2eb17f5566dd81b322cd6348f0fdd355cec593a","src/unix/linux_like/linux/arch/powerpc/mod.rs":"3f6da7b0fa7b394c7d4eea2bb3caa7a7729ab0d6c1491fef02206a912c41b815","src/unix/linux_like/linux/arch/sparc/mod.rs":"91593ec0440f1dd8f8e612028f432c44c14089286e2aca50e10511ab942db8c3","src/unix/linux_like/linux/gnu/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/linux_like/linux/gnu/b32/arm/align.rs":"6ec0eb3ee93f7ae99fd714b4deabfb5e97fbcefd8c26f5a45fb8e7150899cdeb","src/unix/linux_like/linux/gnu/b32/arm/mod.rs":"92ea7edc0e24f79dfbf5e3efc2d7509bed230562036e6aa85ef4f2c8088ecc8f","src/unix/linux_like/linux/gnu/b32/m68k/align.rs":"8faa92f77a9232c035418d45331774e64a9a841d99c91791570a203bf2b45bcb","src/unix/linux_like/linux/gnu/b32/m68k/mod.rs":"a2a0a9400dae44086ebf579e0448e0676d4a3214d1ae7d13a024857251e23b6b","src/unix/linux_like/linux/gnu/b32/mips/align.rs":"429fb5e005cb7143602d430098b6ebfb7d360685b194f333dfd587472ae954ee","src/unix/linux_like/linux/gnu/b32/mips/mod.rs":"0d7849eb2435ec1f49b6774872a0518f0129c50f37c9d38b37b1535722777a22","src/unix/linux_like/linux/gnu/b32/mod.rs":"8da281da578cdee972e952b118b903b370320897a7e335342a15e1359864bef2","src/unix/linux_like/linux/gnu/b32/powerpc.rs":"049d6211ba4a9304bd4497c160bc21ae847c24e0528dd9d76263f16192e6aff5","src/unix/linux_like/linux/gnu/b32/riscv32/align.rs":"d321491612be8d5c61b6ec2dc0111beb3a22e58803f99cd37543efe86621b119","src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs":"a4256148cec0bb672c8dfa605866930d9761af9655721de72ae41eeeb8fdbf6d","src/unix/linux_like/linux/gnu/b32/sparc/align.rs":"21adbed27df73e2d1ed934aaf733a643003d7baf2bde9c48ea440895bcca6d41","src/unix/linux_like/linux/gnu/b32/sparc/mod.rs":"525618615aa0cb80c6c90860bf579dfed8db307fffd56b97dc235fb945419434","src/unix/linux_like/linux/gnu/b32/x86/align.rs":"e4bafdc4a519a7922a81b37a62bbfd1177a2f620890eef8f1fbc47162e9eb413","src/unix/linux_like/linux/gnu/b32/x86/mod.rs":"78b4038852986436888c63be9258037cf642124daee9d5fa5cef2bf8e412bf54","src/unix/linux_like/linux/gnu/b64/aarch64/align.rs":"5b32fcc0d60356c92ded4e0ba9bb32f0140a8bd75ba800486bf38294f61dbdbb","src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs":"21a21503ef2e095f4371044915d4bfb07a8578011cb5c713cd9f45947b0b5730","src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs":"1735f6f5c56770d20dd426442f09724d9b2052b46a7cd82f23f3288a4a7276de","src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs":"e78c3cd197f44832338b414d1a9bc0d194f44c74db77bd7bf830c1fff62b2690","src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs":"c72a08011c32f82919e930e0d89044d8feb65fd41bf80647436756c290344eb8","src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs":"387808d5398b24339e7e2bf7591150735011befc5b421fa713d7017c04a7b1da","src/unix/linux_like/linux/gnu/b64/mips64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/gnu/b64/mips64/mod.rs":"17aad16329431d83e1909e3a08022f6e28f4bcba7dec4a967fe1a321a6a43b99","src/unix/linux_like/linux/gnu/b64/mod.rs":"3c6555f30a7a8852757b31a542ea73fb6a16a6e27e838397e819278ad56e57a4","src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs":"e29c4868bbecfa4a6cd8a2ad06193f3bbc78a468cc1dc9df83f002f1268130d9","src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs":"97e0ecf11ecce793a13fec39654fb513c5479edf7faa7a276fa714b61993d0fc","src/unix/linux_like/linux/gnu/b64/riscv64/align.rs":"d321491612be8d5c61b6ec2dc0111beb3a22e58803f99cd37543efe86621b119","src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs":"b3fe290afe63d2d6e315d0cf1f775464e9c1f2a1906d243c1af74a137a4031cb","src/unix/linux_like/linux/gnu/b64/s390x.rs":"254f00266ecf9644a4b469457cb37c4dd6c055820926c1de0fb9035b6048e75c","src/unix/linux_like/linux/gnu/b64/sparc64/align.rs":"e29c4868bbecfa4a6cd8a2ad06193f3bbc78a468cc1dc9df83f002f1268130d9","src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs":"87dd7f3d5bf3c09f4064ec738e306cc9cc41ad49b4a5df62c5983301c3bbf99a","src/unix/linux_like/linux/gnu/b64/x86_64/align.rs":"62e822478356db4a73b6bbd1b36d825b893939ab4b308ec11b0578bcc4b49769","src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs":"f0db9914315d5a3d51bf5ec04a0ae6584f2e1688b9258ce132b617e67d9bd7a9","src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs":"b88ef8a1eaa9ed73bf2acb8192afb73af987a92abb94140c6376fc83f2fa5553","src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs":"79305936a60d342efdc10519ba89507d6b48e65f13f33090d3b04dc9655ceed0","src/unix/linux_like/linux/gnu/mod.rs":"fd62b48974dd2f97f6e8fa2a30624e8d69fdedc5d3b0ab2f3f09516e88a8769a","src/unix/linux_like/linux/gnu/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/linux_like/linux/mod.rs":"af94b1a6d844bed87bb4c93de0a12f160ca1f918f5234d7fe17511d4e424dedc","src/unix/linux_like/linux/musl/b32/arm/align.rs":"3e8ac052c1043764776b54c93ba4260e061df998631737a897d9d47d54f7b80c","src/unix/linux_like/linux/musl/b32/arm/mod.rs":"e5faee8efda8a225ea0b17d4d6f9e893a678e73773fa62c549a8e19c106b9f04","src/unix/linux_like/linux/musl/b32/hexagon.rs":"226a8b64ce9c75abbbee6d2dceb0b44f7b6c750c4102ebd4d015194afee6666e","src/unix/linux_like/linux/musl/b32/mips/align.rs":"429fb5e005cb7143602d430098b6ebfb7d360685b194f333dfd587472ae954ee","src/unix/linux_like/linux/musl/b32/mips/mod.rs":"df8f8b529a6cc6b8a7326639e83303cf1320c6c50d76517c17d42bcf45f6240a","src/unix/linux_like/linux/musl/b32/mod.rs":"7b3d9dfd8605b00bb9b5fa1439abe5ebf60199c7fa033eee555e8d181e93ffa2","src/unix/linux_like/linux/musl/b32/powerpc.rs":"c957d99a4d4371d2411a5769be8cf344516bf9ddc1011f977501a4eb57cb4e82","src/unix/linux_like/linux/musl/b32/riscv32/align.rs":"efd2accf33b87de7c7547903359a5da896edc33cd6c719552c7474b60d4a5d48","src/unix/linux_like/linux/musl/b32/riscv32/mod.rs":"698f77bfcc838f82126c54f7387881fe3e89490117e5a4f333d1b4433823a672","src/unix/linux_like/linux/musl/b32/x86/align.rs":"08e77fbd7435d7dec2ff56932433bece3f02e47ce810f89004a275a86d39cbe1","src/unix/linux_like/linux/musl/b32/x86/mod.rs":"199a91e90b454f9dc32770d5204cc4f6e5b8f144e0e34a1c91829949d6e804b3","src/unix/linux_like/linux/musl/b64/aarch64/align.rs":"6ba32725d24d7d8e6aa111f3b57aafa318f83b606abe96561329151829821133","src/unix/linux_like/linux/musl/b64/aarch64/int128.rs":"1735f6f5c56770d20dd426442f09724d9b2052b46a7cd82f23f3288a4a7276de","src/unix/linux_like/linux/musl/b64/aarch64/mod.rs":"9c4878df0fea0e0affd85346e0bc191abdc5e41e74dc9199b5644ec33d29c300","src/unix/linux_like/linux/musl/b64/mips64.rs":"1fa4974fe412b22c3555d3e240dbf00cc04a5287c751035ddf08a0470d4a7c9a","src/unix/linux_like/linux/musl/b64/mod.rs":"8c10627bd582cb272514e7350ae4743a65d489356eae039d2e7e55cd533fbbc8","src/unix/linux_like/linux/musl/b64/powerpc64.rs":"36694cbdcdc33879e00502d55cb95eaa0096d213538993dd39c3da800cdd06d1","src/unix/linux_like/linux/musl/b64/riscv64/align.rs":"d321491612be8d5c61b6ec2dc0111beb3a22e58803f99cd37543efe86621b119","src/unix/linux_like/linux/musl/b64/riscv64/mod.rs":"36621aca8ecf714f8dd42662dc2997833d95b9f129ef8c220503362e21efd695","src/unix/linux_like/linux/musl/b64/s390x.rs":"c7ebabc4e1bdbbd97e5065faa3a57f41f473570920582d979f9e9d4f77448546","src/unix/linux_like/linux/musl/b64/x86_64/align.rs":"77309276ad7a42cbe59ca381f23590b7a143aded05555b34a5b307b808cbca6e","src/unix/linux_like/linux/musl/b64/x86_64/mod.rs":"238789097a26abc8b7cd578ed1a8e6cb8672083054303902781983902cd66854","src/unix/linux_like/linux/musl/mod.rs":"c3365480375bc258ffe267e7a299d7b3bb542a908bef8881f503ddc25ba8fc1f","src/unix/linux_like/linux/no_align.rs":"da2a8721becaaaa528781f97f5d9aae6a982ae5d4f5f6d2ffc0150bed72319b3","src/unix/linux_like/linux/non_exhaustive.rs":"181a05bf94fdb911db83ce793b993bd6548a4115b306a7ef3c10f745a8fea3e9","src/unix/linux_like/linux/uclibc/align.rs":"9ed16138d8e439bd90930845a65eafa7ebd67366e6bf633936d44014f6e4c959","src/unix/linux_like/linux/uclibc/arm/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/linux_like/linux/uclibc/arm/mod.rs":"a056bbf718ddd775519058706bdb4909b56e6256985869e3c3132aa8ec5faca0","src/unix/linux_like/linux/uclibc/arm/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/linux_like/linux/uclibc/mips/mips32/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs":"b84def53a49587e87f884c2bc28b21b290463b00b52e1d0309f2ba233a5b4a99","src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/linux_like/linux/uclibc/mips/mips64/align.rs":"a7bdcb18a37a2d91e64d5fad83ea3edc78f5412adb28f77ab077dbb26dd08b2d","src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs":"256a428290a560163ef7dc7d18b27bd3c6ce9748a0f28d5dc7f82203ee228220","src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs":"4a18e3875698c85229599225ac3401a2a40da87e77b2ad4ef47c6fcd5a24ed30","src/unix/linux_like/linux/uclibc/mips/mod.rs":"367ec5483ad317e6ccba1ac0888da6cf088a8d32689214cc8d16129aa692260c","src/unix/linux_like/linux/uclibc/mod.rs":"1c3d25cddcfefa2bd17bdc81550826be31a08eef235e13f825f169a5029c8bca","src/unix/linux_like/linux/uclibc/no_align.rs":"3f28637046524618adaa1012e26cb7ffe94b9396e6b518cccdc69d59f274d709","src/unix/linux_like/linux/uclibc/x86_64/l4re.rs":"024eba5753e852dbdd212427351affe7e83f9916c1864bce414d7aa2618f192e","src/unix/linux_like/linux/uclibc/x86_64/mod.rs":"bf6985e901041a61e90ccee1296b35a4c62ef90aa528d31989e1d647f072e79a","src/unix/linux_like/linux/uclibc/x86_64/other.rs":"42c3f71e58cabba373f6a55a623f3c31b85049eb64824c09c2b082b3b2d6a0a8","src/unix/linux_like/mod.rs":"09fa012e027bfcdaabee221c1b676804a9c7e0e04a4b64fdd98a50c9b5c2f674","src/unix/mod.rs":"fbd5520d160a32a127608cd408905febe387773bbf05bfe199ef385fb5562e9c","src/unix/newlib/aarch64/mod.rs":"bac93836a9a57b2c710f32f852e92a4d11ad6759ab0fb6ad33e71d60e53278af","src/unix/newlib/align.rs":"28aaf87fafbc6b312622719d472d8cf65f9e5467d15339df5f73e66d8502b28a","src/unix/newlib/arm/mod.rs":"cbba6b3e957eceb496806e60de8725a23ff3fa0015983b4b4fa27b233732b526","src/unix/newlib/espidf/mod.rs":"816f235f4aa4baabba7f2606b31d0fdb03988c52194c966728de8690bf17299d","src/unix/newlib/generic.rs":"eab066d9f0a0f3eb53cc1073d01496bba0110989e1f6a59838afd19f870cd599","src/unix/newlib/horizon/mod.rs":"7cc5cc120437421db139bfa6a90b18168cd3070bdd0f5be96d40fe4c996f3ca1","src/unix/newlib/mod.rs":"54633d606e4e0413274af0b5beb5e697e6c061b63feaa0704b026554cc9d9c3e","src/unix/newlib/no_align.rs":"e0743b2179495a9514bc3a4d1781e492878c4ec834ee0085d0891dd1712e82fb","src/unix/newlib/powerpc/mod.rs":"0202ffd57caf75b6afa2c9717750ffb96e375ac33df0ae9609a3f831be393b67","src/unix/no_align.rs":"c06e95373b9088266e0b14bba0954eef95f93fb2b01d951855e382d22de78e53","src/unix/redox/mod.rs":"033768cb273daf2c8090d97252c2de9dba6809e6a5d2457f5727d724807695db","src/unix/solarish/compat.rs":"b07a5bfac925eb012003a459ba6bddbd3bfa9c44b3394da2ac5a602e54beae9c","src/unix/solarish/illumos.rs":"29387916ee7dc58f07478746024003215e631cd30953e8fa2a5c415f81839007","src/unix/solarish/mod.rs":"8914a68865af026c1f4fb1d5f02ba0053362ef34b813ad60cc4aa3a88aa4999e","src/unix/solarish/solaris.rs":"65b005453aefa9b9d4fc860fe77cfec80d8c97a51342b15daf55fc3e808bb384","src/unix/solarish/x86.rs":"e86e806df0caed72765040eaa2f3c883198d1aa91508540adf9b7008c77f522e","src/unix/solarish/x86_64.rs":"9074e813949f3c613afeac39d4118fb942c0b3c476232fc536489357cff5790f","src/unix/solarish/x86_common.rs":"ac869d9c3c95645c22460468391eb1982023c3a8e02b9e06a72e3aef3d5f1eac","src/vxworks/aarch64.rs":"98f0afdc511cd02557e506c21fed6737585490a1dce7a9d4941d08c437762b99","src/vxworks/arm.rs":"acb7968ce99fe3f4abdf39d98f8133d21a4fba435b8ef7084777cb181d788e88","src/vxworks/mod.rs":"aea3da66f2140f2a82dfc9c58f6e6531d2dd9c15ea696e0f95a0d4a2a187b5b6","src/vxworks/powerpc.rs":"acb7968ce99fe3f4abdf39d98f8133d21a4fba435b8ef7084777cb181d788e88","src/vxworks/powerpc64.rs":"98f0afdc511cd02557e506c21fed6737585490a1dce7a9d4941d08c437762b99","src/vxworks/x86.rs":"552f007f38317620b23889cb7c49d1d115841252439060122f52f434fbc6e5ba","src/vxworks/x86_64.rs":"018d92be3ad628a129eff9f2f5dfbc0883d8b8e5f2fa917b900a7f98ed6b514a","src/wasi.rs":"4fae202af0327d768ed9e1b586b75816cce14fe2dc16947d2f3d381f209a54c1","src/windows/gnu/align.rs":"b2c13ec1b9f3b39a75c452c80c951dff9d0215e31d77e883b4502afb31794647","src/windows/gnu/mod.rs":"3c8c7edb7cdf5d0c44af936db2a94869585c69dfabeef30571b4f4e38375767a","src/windows/mod.rs":"090dd8fcd951d18f1905bca96188783c2e3f1433484926ecdcda144237ecec0f","src/windows/msvc/mod.rs":"c068271e00fca6b62bc4bf44bcf142cfc38caeded9b6c4e01d1ceef3ccf986f4","tests/const_fn.rs":"cb75a1f0864f926aebe79118fc34d51a0d1ade2c20a394e7774c7e545f21f1f4"},"package":"8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"} -\ No newline at end of file -+{"files":{"CONTRIBUTING.md":"f480d10d2a506eecd23ae2e2dedb7a28b8bf6dae5f46f438dbb61be2003426fb","Cargo.toml":"1549dc2db0ecd74316f52b2d14b15144ae970a848bf3d54c048844ed7a35df2a","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"a8d47ff51ca256f56a8932dba07660672dbfe3004257ca8de708aac1415937a1","README.md":"776affa26b66843a2b4f1a1c8f88d92f6461b74568911450fea717e9db6f877b","build.rs":"1d0cbe878e98e970c3318cac0772215a9f44bd286d859d665da27872ba9d8818","rustfmt.toml":"eaa2ea84fc1ba0359b77680804903e07bb38d257ab11986b95b158e460f787b2","src/fixed_width_ints.rs":"7f986e5f5e68d25ef04d386fd2f640e8be8f15427a8d4a458ea01d26b8dca0ca","src/fuchsia/aarch64.rs":"378776a9e40766154a54c94c2a7b4675b5c302a38e6e42da99e67bfbaee60e56","src/fuchsia/align.rs":"ae1cf8f011a99737eabeb14ffff768e60f13b13363d7646744dbb0f443dab3d6","src/fuchsia/mod.rs":"94cbaad15021e287a1b9546a697b04c1e560f1204b52204ffaaea5975c5d03b9","src/fuchsia/no_align.rs":"303f3f1b255e0088b5715094353cf00476131d8e94e6aebb3f469557771c8b8a","src/fuchsia/x86_64.rs":"93a3632b5cf67d2a6bcb7dc0a558605252d5fe689e0f38d8aa2ec5852255ac87","src/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/hermit/mod.rs":"d3bfce41e4463d4be8020a2d063c9bfa8b665f45f1cc6cbf3163f5d01e7cb21f","src/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/lib.rs":"ce753ef318b300bbd441feabdd77d00322dfb6ce9eee8c78a38afe02b57aa4c0","src/macros.rs":"b457eb028b8e8ab3c24bb7292b874ad4e491edbb83594f6a3da024df5348c088","src/psp.rs":"dd31aabd46171d474ec5828372e28588935120e7355c90c105360d8fa9264c1c","src/sgx.rs":"16a95cdefc81c5ee00d8353a60db363c4cc3e0f75abcd5d0144723f2a306ed1b","src/solid/aarch64.rs":"a726e47f324adf73a4a0b67a2c183408d0cad105ae66acf36db37a42ab7f8707","src/solid/arm.rs":"e39a4f74ebbef3b97b8c95758ad741123d84ed3eb48d9cf4f1f4872097fc27fe","src/solid/mod.rs":"5f4151dca5132e4b4e4c23ab9737e12856dddbdc0ca3f7dbc004328ef3c8acde","src/switch.rs":"9da3dd39b3de45a7928789926e8572d00e1e11a39e6f7289a1349aadce90edba","src/unix/align.rs":"2cdc7c826ef7ae61f5171c5ae8c445a743d86f1a7f2d9d7e4ceeec56d6874f65","src/unix/bsd/apple/b32/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b32/mod.rs":"2546ad3eb6aecb95f916648bc63264117c92b4b4859532b34cb011e4c75a5a72","src/unix/bsd/apple/b64/aarch64/align.rs":"e8eb38d064b5fefec6f37d42873820a0483e7c758ed336cc59a7155455ca89c9","src/unix/bsd/apple/b64/aarch64/mod.rs":"a3f0dfff62d0f7f4f1b5f9a4e2b662acf233a46badbc5419d3cc2d735629a710","src/unix/bsd/apple/b64/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b64/mod.rs":"f5e278a1af7fb358891d1c9be4eb7e815aaca0c5cb738d0c3604ba2208a856f7","src/unix/bsd/apple/b64/x86_64/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b64/x86_64/mod.rs":"8c87c5855038aae5d433c8f5eb3b29b0a175879a0245342b3bfd83bdf4cfd936","src/unix/bsd/apple/mod.rs":"56dc7604509f49b274770cade97a1874c8955c3b0a445fb857707ae0ca6df41b","src/unix/bsd/freebsdlike/dragonfly/errno.rs":"8295b8bb0dfd38d2cdb4d9192cdeeb534cc6c3b208170e64615fa3e0edb3e578","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"d0e8246063cae113806524a63a47c6c0628cc54a3ef03e938e89964f8b4f08b4","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"2a215bd6136b8617aacedf9be738ccee94da9d29b418e9a78101d6291c182352","src/unix/bsd/freebsdlike/freebsd/arm.rs":"59d6a670eea562fb87686e243e0a84603d29a2028a3d4b3f99ccc01bd04d2f47","src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs":"9808d152c1196aa647f1b0f0cf84dac8c930da7d7f897a44975545e3d9d17681","src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs":"a6eee615e6ca5a6e04b526bb6b22d13b9356e87e51825cda33476c37a46cb0ef","src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs":"61cbe45f8499bedb168106b686d4f8239472f25c7553b069eec2afe197ff2df6","src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs":"755dafaf3f0945e798c34ea94c48e8552804ce60e2a15a4f0649f9d1aceaf422","src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs":"2df36a7f122f6d6e5753cfb4d22e915cc80f6bc91c0161b3daae55a481bfd052","src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs":"61cbe45f8499bedb168106b686d4f8239472f25c7553b069eec2afe197ff2df6","src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs":"cc65a73b0fa95a77044a4b3ee76d6eceb9773b55aea7d73bdf070e6f66e9ea38","src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs":"2df36a7f122f6d6e5753cfb4d22e915cc80f6bc91c0161b3daae55a481bfd052","src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs":"61cbe45f8499bedb168106b686d4f8239472f25c7553b069eec2afe197ff2df6","src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs":"0ed92eb93e78299cd7de0ae9daebb04a53b3c2d5e6a078e1fcd977f2a86bffc3","src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs":"2df36a7f122f6d6e5753cfb4d22e915cc80f6bc91c0161b3daae55a481bfd052","src/unix/bsd/freebsdlike/freebsd/mod.rs":"ec229cc7af2511cb510c078e87e90ee2625090bfe94f40eb35f73d79143533aa","src/unix/bsd/freebsdlike/freebsd/powerpc.rs":"9ca3f82f88974e6db5569f2d76a5a3749b248a31747a6c0da5820492bdfeca42","src/unix/bsd/freebsdlike/freebsd/powerpc64.rs":"2dae3ecc87eac3b11657aa98915def55fc4b5c0de11fe26aae23329a54628a9a","src/unix/bsd/freebsdlike/freebsd/riscv64.rs":"8f591bd273464d684c4f64365f8ed56a8138175daa70d96008541393057a0dae","src/unix/bsd/freebsdlike/freebsd/x86.rs":"c5005e3249eb7c93cfbac72a9e9272320d80ce7983da990ceb05a447f59a02c5","src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs":"0e1f69a88fca1c32874b1daf5db3d446fefbe518dca497f096cc9168c39dde70","src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs":"51e4dd0c8ae247bb652feda5adad9333ea3bb30c750c3a3935e0b0e47d7803eb","src/unix/bsd/freebsdlike/mod.rs":"1e35b4773384ea143810cdce4b96f47108b37446430da30c96a0d1651656d73d","src/unix/bsd/mod.rs":"817ca5719c36a74c84e52c6a56a5998b60d7f02351a405e034f08ebab079b63a","src/unix/bsd/netbsdlike/mod.rs":"b07a0e81085bd811fce7270f3b90fbfea29faf9593d9e39d9d2ebbb9a78bf25f","src/unix/bsd/netbsdlike/netbsd/aarch64.rs":"65dcb58d11e8d8028401a9d07ca3eb4cb4f053e04249cc877353449d84ccc4cb","src/unix/bsd/netbsdlike/netbsd/arm.rs":"58cdbb70b0d6f536551f0f3bb3725d2d75c4690db12c26c034e7d6ec4a924452","src/unix/bsd/netbsdlike/netbsd/mod.rs":"8f9613e50c2771b33d7cf817a735d536b389ec57f861b9486d870373c768276e","src/unix/bsd/netbsdlike/netbsd/powerpc.rs":"ee7ff5d89d0ed22f531237b5059aa669df93a3b5c489fa641465ace8d405bf41","src/unix/bsd/netbsdlike/netbsd/sparc64.rs":"9489f4b3e4566f43bb12dfb92238960613dac7f6a45cc13068a8d152b902d7d9","src/unix/bsd/netbsdlike/netbsd/x86.rs":"20692320e36bfe028d1a34d16fe12ca77aa909cb02bda167376f98f1a09aefe7","src/unix/bsd/netbsdlike/netbsd/x86_64.rs":"1afe5ef46b14397cdd68664b5b232e4f5b035b6db1d4cf411c899d51ebca9f30","src/unix/bsd/netbsdlike/openbsd/aarch64.rs":"dd91931d373b7ecaf6e2de25adadee10d16fa9b12c2cbacdff3eb291e1ba36af","src/unix/bsd/netbsdlike/openbsd/arm.rs":"01580d261bc6447bb327a0d982181b7bdabfa066cee65a30373d3ced729ad307","src/unix/bsd/netbsdlike/openbsd/mips64.rs":"8532a189ae10c7d668d9d4065da8b05d124e09bd39442c9f74a7f231c43eca48","src/unix/bsd/netbsdlike/openbsd/mod.rs":"228505fa48292e74b06acbed96196801595a4b822da2126a6d6c7fa773cff8bc","src/unix/bsd/netbsdlike/openbsd/powerpc.rs":"01580d261bc6447bb327a0d982181b7bdabfa066cee65a30373d3ced729ad307","src/unix/bsd/netbsdlike/openbsd/powerpc64.rs":"1dd5449dd1fd3d51e30ffdeeaece91d0aaf05c710e0ac699fecc5461cfa2c28e","src/unix/bsd/netbsdlike/openbsd/riscv64.rs":"1dd5449dd1fd3d51e30ffdeeaece91d0aaf05c710e0ac699fecc5461cfa2c28e","src/unix/bsd/netbsdlike/openbsd/sparc64.rs":"d04fd287afbaa2c5df9d48c94e8374a532a3ba491b424ddf018270c7312f4085","src/unix/bsd/netbsdlike/openbsd/x86.rs":"6f7f5c4fde2a2259eb547890cbd86570cea04ef85347d7569e94e679448bec87","src/unix/bsd/netbsdlike/openbsd/x86_64.rs":"d31db31630289c85af3339dbe357998a21ca584cbae31607448fe2cf7675a4e1","src/unix/haiku/b32.rs":"a2efdbf7158a6da341e1db9176b0ab193ba88b449616239ed95dced11f54d87b","src/unix/haiku/b64.rs":"ff8115367d3d7d354f792d6176dfaaa26353f57056197b563bf4681f91ff7985","src/unix/haiku/mod.rs":"df7b6b7d8dd3441665bfe87f2abc942bddc65b8b10dfa9c83dd0422f68107891","src/unix/haiku/native.rs":"dbfcbf4954a79d1df2ff58e0590bbcb8c57dfc7a32392aa73ee4726b66bd6cc8","src/unix/haiku/x86_64.rs":"3ec3aeeb7ed208b8916f3e32d42bfd085ff5e16936a1a35d9a52789f043b7237","src/unix/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/unix/hermit/mod.rs":"859814f5df89e28fd4b345db399d181e11e7ed413841b6ff703a1fcbdbf013ae","src/unix/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/unix/linux_like/android/b32/arm.rs":"433c1530f602cc5ed26610c58055dde0c4ceea5e00150063b24ddc60768332a4","src/unix/linux_like/android/b32/mod.rs":"7c173e0375119bf06a3081652faede95e5bcd6858e7576b7533d037978737c8f","src/unix/linux_like/android/b32/x86/align.rs":"812914e4241df82e32b12375ca3374615dc3a4bdd4cf31f0423c5815320c0dab","src/unix/linux_like/android/b32/x86/mod.rs":"8388bd3a0fcb5636bf965eee6dc95ae6860b85a2b555b387c868aa4d4e01ec89","src/unix/linux_like/android/b64/aarch64/align.rs":"2179c3b1608fa4bf68840482bfc2b2fa3ee2faf6fcae3770f9e505cddca35c7b","src/unix/linux_like/android/b64/aarch64/int128.rs":"1735f6f5c56770d20dd426442f09724d9b2052b46a7cd82f23f3288a4a7276de","src/unix/linux_like/android/b64/aarch64/mod.rs":"ef230d49fd0d182adf2dae6f8e10babf18d72259d65980bf1c4c2dc8a4f84501","src/unix/linux_like/android/b64/mod.rs":"71e4fcbe952bfa4a5f9022f3972e906917b38f729b9d8ef57cd5d179104894ac","src/unix/linux_like/android/b64/riscv64/align.rs":"0bf138f84e5327d8339bcd4adf071a6832b516445e597552c82bbd881095e3a8","src/unix/linux_like/android/b64/riscv64/mod.rs":"80e9f93fed838a48b4e2e8d77b95c72cfd7c0647bcce63851555c5ad16dad143","src/unix/linux_like/android/b64/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/android/b64/x86_64/mod.rs":"e10d19bea39f719723ab6666a5ddbd378b6958769441c5904629e1df173b1dc2","src/unix/linux_like/android/mod.rs":"962741303dc24a5b9653f2e9b0b4ad9eb42fc54daa0a70ca70a7ce175e75094b","src/unix/linux_like/emscripten/align.rs":"86c95cbed7a7161b1f23ee06843e7b0e2340ad92b2cb86fe2a8ef3e0e8c36216","src/unix/linux_like/emscripten/mod.rs":"c69c90606d4362f8de89b8816df0ded724ed64b53bf55d15681fde171b7bb361","src/unix/linux_like/emscripten/no_align.rs":"0128e4aa721a9902754828b61b5ec7d8a86619983ed1e0544a85d35b1051fad6","src/unix/linux_like/linux/align.rs":"d6c259942c8e843373accd180fc8f4f45f03544dfd21b93a8d02641ead3ef63e","src/unix/linux_like/linux/arch/generic/mod.rs":"e20013ed91edcfb7f84f3f9f5a9ef827fd5c406e24b65989d8438da332236ef6","src/unix/linux_like/linux/arch/mips/mod.rs":"2d166054a586bb4bf6e4a4ba35f7574907b217225eff8f1a43adc4277e142460","src/unix/linux_like/linux/arch/mod.rs":"466a29622e47c6c7f1500682b2eb17f5566dd81b322cd6348f0fdd355cec593a","src/unix/linux_like/linux/arch/powerpc/mod.rs":"3f6da7b0fa7b394c7d4eea2bb3caa7a7729ab0d6c1491fef02206a912c41b815","src/unix/linux_like/linux/arch/sparc/mod.rs":"91593ec0440f1dd8f8e612028f432c44c14089286e2aca50e10511ab942db8c3","src/unix/linux_like/linux/gnu/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/linux_like/linux/gnu/b32/arm/align.rs":"6ec0eb3ee93f7ae99fd714b4deabfb5e97fbcefd8c26f5a45fb8e7150899cdeb","src/unix/linux_like/linux/gnu/b32/arm/mod.rs":"92ea7edc0e24f79dfbf5e3efc2d7509bed230562036e6aa85ef4f2c8088ecc8f","src/unix/linux_like/linux/gnu/b32/m68k/align.rs":"8faa92f77a9232c035418d45331774e64a9a841d99c91791570a203bf2b45bcb","src/unix/linux_like/linux/gnu/b32/m68k/mod.rs":"a2a0a9400dae44086ebf579e0448e0676d4a3214d1ae7d13a024857251e23b6b","src/unix/linux_like/linux/gnu/b32/mips/align.rs":"429fb5e005cb7143602d430098b6ebfb7d360685b194f333dfd587472ae954ee","src/unix/linux_like/linux/gnu/b32/mips/mod.rs":"0d7849eb2435ec1f49b6774872a0518f0129c50f37c9d38b37b1535722777a22","src/unix/linux_like/linux/gnu/b32/mod.rs":"8da281da578cdee972e952b118b903b370320897a7e335342a15e1359864bef2","src/unix/linux_like/linux/gnu/b32/powerpc.rs":"049d6211ba4a9304bd4497c160bc21ae847c24e0528dd9d76263f16192e6aff5","src/unix/linux_like/linux/gnu/b32/riscv32/align.rs":"d321491612be8d5c61b6ec2dc0111beb3a22e58803f99cd37543efe86621b119","src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs":"a4256148cec0bb672c8dfa605866930d9761af9655721de72ae41eeeb8fdbf6d","src/unix/linux_like/linux/gnu/b32/sparc/align.rs":"21adbed27df73e2d1ed934aaf733a643003d7baf2bde9c48ea440895bcca6d41","src/unix/linux_like/linux/gnu/b32/sparc/mod.rs":"525618615aa0cb80c6c90860bf579dfed8db307fffd56b97dc235fb945419434","src/unix/linux_like/linux/gnu/b32/x86/align.rs":"e4bafdc4a519a7922a81b37a62bbfd1177a2f620890eef8f1fbc47162e9eb413","src/unix/linux_like/linux/gnu/b32/x86/mod.rs":"78b4038852986436888c63be9258037cf642124daee9d5fa5cef2bf8e412bf54","src/unix/linux_like/linux/gnu/b64/aarch64/align.rs":"5b32fcc0d60356c92ded4e0ba9bb32f0140a8bd75ba800486bf38294f61dbdbb","src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs":"21a21503ef2e095f4371044915d4bfb07a8578011cb5c713cd9f45947b0b5730","src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs":"1735f6f5c56770d20dd426442f09724d9b2052b46a7cd82f23f3288a4a7276de","src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs":"e78c3cd197f44832338b414d1a9bc0d194f44c74db77bd7bf830c1fff62b2690","src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs":"c72a08011c32f82919e930e0d89044d8feb65fd41bf80647436756c290344eb8","src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs":"387808d5398b24339e7e2bf7591150735011befc5b421fa713d7017c04a7b1da","src/unix/linux_like/linux/gnu/b64/mips64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/gnu/b64/mips64/mod.rs":"17aad16329431d83e1909e3a08022f6e28f4bcba7dec4a967fe1a321a6a43b99","src/unix/linux_like/linux/gnu/b64/mod.rs":"3c6555f30a7a8852757b31a542ea73fb6a16a6e27e838397e819278ad56e57a4","src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs":"e29c4868bbecfa4a6cd8a2ad06193f3bbc78a468cc1dc9df83f002f1268130d9","src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs":"97e0ecf11ecce793a13fec39654fb513c5479edf7faa7a276fa714b61993d0fc","src/unix/linux_like/linux/gnu/b64/riscv64/align.rs":"d321491612be8d5c61b6ec2dc0111beb3a22e58803f99cd37543efe86621b119","src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs":"b3fe290afe63d2d6e315d0cf1f775464e9c1f2a1906d243c1af74a137a4031cb","src/unix/linux_like/linux/gnu/b64/s390x.rs":"254f00266ecf9644a4b469457cb37c4dd6c055820926c1de0fb9035b6048e75c","src/unix/linux_like/linux/gnu/b64/sparc64/align.rs":"e29c4868bbecfa4a6cd8a2ad06193f3bbc78a468cc1dc9df83f002f1268130d9","src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs":"87dd7f3d5bf3c09f4064ec738e306cc9cc41ad49b4a5df62c5983301c3bbf99a","src/unix/linux_like/linux/gnu/b64/x86_64/align.rs":"62e822478356db4a73b6bbd1b36d825b893939ab4b308ec11b0578bcc4b49769","src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs":"f0db9914315d5a3d51bf5ec04a0ae6584f2e1688b9258ce132b617e67d9bd7a9","src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs":"b88ef8a1eaa9ed73bf2acb8192afb73af987a92abb94140c6376fc83f2fa5553","src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs":"79305936a60d342efdc10519ba89507d6b48e65f13f33090d3b04dc9655ceed0","src/unix/linux_like/linux/gnu/mod.rs":"fd62b48974dd2f97f6e8fa2a30624e8d69fdedc5d3b0ab2f3f09516e88a8769a","src/unix/linux_like/linux/gnu/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/linux_like/linux/mod.rs":"af94b1a6d844bed87bb4c93de0a12f160ca1f918f5234d7fe17511d4e424dedc","src/unix/linux_like/linux/musl/b32/arm/align.rs":"3e8ac052c1043764776b54c93ba4260e061df998631737a897d9d47d54f7b80c","src/unix/linux_like/linux/musl/b32/arm/mod.rs":"e5faee8efda8a225ea0b17d4d6f9e893a678e73773fa62c549a8e19c106b9f04","src/unix/linux_like/linux/musl/b32/hexagon.rs":"226a8b64ce9c75abbbee6d2dceb0b44f7b6c750c4102ebd4d015194afee6666e","src/unix/linux_like/linux/musl/b32/mips/align.rs":"429fb5e005cb7143602d430098b6ebfb7d360685b194f333dfd587472ae954ee","src/unix/linux_like/linux/musl/b32/mips/mod.rs":"df8f8b529a6cc6b8a7326639e83303cf1320c6c50d76517c17d42bcf45f6240a","src/unix/linux_like/linux/musl/b32/mod.rs":"7b3d9dfd8605b00bb9b5fa1439abe5ebf60199c7fa033eee555e8d181e93ffa2","src/unix/linux_like/linux/musl/b32/powerpc.rs":"c957d99a4d4371d2411a5769be8cf344516bf9ddc1011f977501a4eb57cb4e82","src/unix/linux_like/linux/musl/b32/riscv32/align.rs":"efd2accf33b87de7c7547903359a5da896edc33cd6c719552c7474b60d4a5d48","src/unix/linux_like/linux/musl/b32/riscv32/mod.rs":"e57dc5562553aab6d0765e0ec266254aa52975f8757bfe97e0c6028fa7d5d37c","src/unix/linux_like/linux/musl/b32/x86/align.rs":"08e77fbd7435d7dec2ff56932433bece3f02e47ce810f89004a275a86d39cbe1","src/unix/linux_like/linux/musl/b32/x86/mod.rs":"199a91e90b454f9dc32770d5204cc4f6e5b8f144e0e34a1c91829949d6e804b3","src/unix/linux_like/linux/musl/b64/aarch64/align.rs":"6ba32725d24d7d8e6aa111f3b57aafa318f83b606abe96561329151829821133","src/unix/linux_like/linux/musl/b64/aarch64/int128.rs":"1735f6f5c56770d20dd426442f09724d9b2052b46a7cd82f23f3288a4a7276de","src/unix/linux_like/linux/musl/b64/aarch64/mod.rs":"9c4878df0fea0e0affd85346e0bc191abdc5e41e74dc9199b5644ec33d29c300","src/unix/linux_like/linux/musl/b64/mips64.rs":"1fa4974fe412b22c3555d3e240dbf00cc04a5287c751035ddf08a0470d4a7c9a","src/unix/linux_like/linux/musl/b64/mod.rs":"8c10627bd582cb272514e7350ae4743a65d489356eae039d2e7e55cd533fbbc8","src/unix/linux_like/linux/musl/b64/powerpc64.rs":"36694cbdcdc33879e00502d55cb95eaa0096d213538993dd39c3da800cdd06d1","src/unix/linux_like/linux/musl/b64/riscv64/align.rs":"d321491612be8d5c61b6ec2dc0111beb3a22e58803f99cd37543efe86621b119","src/unix/linux_like/linux/musl/b64/riscv64/mod.rs":"36621aca8ecf714f8dd42662dc2997833d95b9f129ef8c220503362e21efd695","src/unix/linux_like/linux/musl/b64/s390x.rs":"c7ebabc4e1bdbbd97e5065faa3a57f41f473570920582d979f9e9d4f77448546","src/unix/linux_like/linux/musl/b64/x86_64/align.rs":"77309276ad7a42cbe59ca381f23590b7a143aded05555b34a5b307b808cbca6e","src/unix/linux_like/linux/musl/b64/x86_64/mod.rs":"238789097a26abc8b7cd578ed1a8e6cb8672083054303902781983902cd66854","src/unix/linux_like/linux/musl/mod.rs":"c3365480375bc258ffe267e7a299d7b3bb542a908bef8881f503ddc25ba8fc1f","src/unix/linux_like/linux/no_align.rs":"da2a8721becaaaa528781f97f5d9aae6a982ae5d4f5f6d2ffc0150bed72319b3","src/unix/linux_like/linux/non_exhaustive.rs":"181a05bf94fdb911db83ce793b993bd6548a4115b306a7ef3c10f745a8fea3e9","src/unix/linux_like/linux/uclibc/align.rs":"9ed16138d8e439bd90930845a65eafa7ebd67366e6bf633936d44014f6e4c959","src/unix/linux_like/linux/uclibc/arm/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/linux_like/linux/uclibc/arm/mod.rs":"a056bbf718ddd775519058706bdb4909b56e6256985869e3c3132aa8ec5faca0","src/unix/linux_like/linux/uclibc/arm/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/linux_like/linux/uclibc/mips/mips32/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs":"b84def53a49587e87f884c2bc28b21b290463b00b52e1d0309f2ba233a5b4a99","src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/linux_like/linux/uclibc/mips/mips64/align.rs":"a7bdcb18a37a2d91e64d5fad83ea3edc78f5412adb28f77ab077dbb26dd08b2d","src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs":"256a428290a560163ef7dc7d18b27bd3c6ce9748a0f28d5dc7f82203ee228220","src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs":"4a18e3875698c85229599225ac3401a2a40da87e77b2ad4ef47c6fcd5a24ed30","src/unix/linux_like/linux/uclibc/mips/mod.rs":"367ec5483ad317e6ccba1ac0888da6cf088a8d32689214cc8d16129aa692260c","src/unix/linux_like/linux/uclibc/mod.rs":"1c3d25cddcfefa2bd17bdc81550826be31a08eef235e13f825f169a5029c8bca","src/unix/linux_like/linux/uclibc/no_align.rs":"3f28637046524618adaa1012e26cb7ffe94b9396e6b518cccdc69d59f274d709","src/unix/linux_like/linux/uclibc/x86_64/l4re.rs":"024eba5753e852dbdd212427351affe7e83f9916c1864bce414d7aa2618f192e","src/unix/linux_like/linux/uclibc/x86_64/mod.rs":"bf6985e901041a61e90ccee1296b35a4c62ef90aa528d31989e1d647f072e79a","src/unix/linux_like/linux/uclibc/x86_64/other.rs":"42c3f71e58cabba373f6a55a623f3c31b85049eb64824c09c2b082b3b2d6a0a8","src/unix/linux_like/mod.rs":"09fa012e027bfcdaabee221c1b676804a9c7e0e04a4b64fdd98a50c9b5c2f674","src/unix/mod.rs":"fbd5520d160a32a127608cd408905febe387773bbf05bfe199ef385fb5562e9c","src/unix/newlib/aarch64/mod.rs":"bac93836a9a57b2c710f32f852e92a4d11ad6759ab0fb6ad33e71d60e53278af","src/unix/newlib/align.rs":"28aaf87fafbc6b312622719d472d8cf65f9e5467d15339df5f73e66d8502b28a","src/unix/newlib/arm/mod.rs":"cbba6b3e957eceb496806e60de8725a23ff3fa0015983b4b4fa27b233732b526","src/unix/newlib/espidf/mod.rs":"816f235f4aa4baabba7f2606b31d0fdb03988c52194c966728de8690bf17299d","src/unix/newlib/generic.rs":"eab066d9f0a0f3eb53cc1073d01496bba0110989e1f6a59838afd19f870cd599","src/unix/newlib/horizon/mod.rs":"7cc5cc120437421db139bfa6a90b18168cd3070bdd0f5be96d40fe4c996f3ca1","src/unix/newlib/mod.rs":"54633d606e4e0413274af0b5beb5e697e6c061b63feaa0704b026554cc9d9c3e","src/unix/newlib/no_align.rs":"e0743b2179495a9514bc3a4d1781e492878c4ec834ee0085d0891dd1712e82fb","src/unix/newlib/powerpc/mod.rs":"0202ffd57caf75b6afa2c9717750ffb96e375ac33df0ae9609a3f831be393b67","src/unix/no_align.rs":"c06e95373b9088266e0b14bba0954eef95f93fb2b01d951855e382d22de78e53","src/unix/redox/mod.rs":"033768cb273daf2c8090d97252c2de9dba6809e6a5d2457f5727d724807695db","src/unix/solarish/compat.rs":"b07a5bfac925eb012003a459ba6bddbd3bfa9c44b3394da2ac5a602e54beae9c","src/unix/solarish/illumos.rs":"29387916ee7dc58f07478746024003215e631cd30953e8fa2a5c415f81839007","src/unix/solarish/mod.rs":"8914a68865af026c1f4fb1d5f02ba0053362ef34b813ad60cc4aa3a88aa4999e","src/unix/solarish/solaris.rs":"65b005453aefa9b9d4fc860fe77cfec80d8c97a51342b15daf55fc3e808bb384","src/unix/solarish/x86.rs":"e86e806df0caed72765040eaa2f3c883198d1aa91508540adf9b7008c77f522e","src/unix/solarish/x86_64.rs":"9074e813949f3c613afeac39d4118fb942c0b3c476232fc536489357cff5790f","src/unix/solarish/x86_common.rs":"ac869d9c3c95645c22460468391eb1982023c3a8e02b9e06a72e3aef3d5f1eac","src/vxworks/aarch64.rs":"98f0afdc511cd02557e506c21fed6737585490a1dce7a9d4941d08c437762b99","src/vxworks/arm.rs":"acb7968ce99fe3f4abdf39d98f8133d21a4fba435b8ef7084777cb181d788e88","src/vxworks/mod.rs":"aea3da66f2140f2a82dfc9c58f6e6531d2dd9c15ea696e0f95a0d4a2a187b5b6","src/vxworks/powerpc.rs":"acb7968ce99fe3f4abdf39d98f8133d21a4fba435b8ef7084777cb181d788e88","src/vxworks/powerpc64.rs":"98f0afdc511cd02557e506c21fed6737585490a1dce7a9d4941d08c437762b99","src/vxworks/x86.rs":"552f007f38317620b23889cb7c49d1d115841252439060122f52f434fbc6e5ba","src/vxworks/x86_64.rs":"018d92be3ad628a129eff9f2f5dfbc0883d8b8e5f2fa917b900a7f98ed6b514a","src/wasi.rs":"4fae202af0327d768ed9e1b586b75816cce14fe2dc16947d2f3d381f209a54c1","src/windows/gnu/align.rs":"b2c13ec1b9f3b39a75c452c80c951dff9d0215e31d77e883b4502afb31794647","src/windows/gnu/mod.rs":"3c8c7edb7cdf5d0c44af936db2a94869585c69dfabeef30571b4f4e38375767a","src/windows/mod.rs":"090dd8fcd951d18f1905bca96188783c2e3f1433484926ecdcda144237ecec0f","src/windows/msvc/mod.rs":"c068271e00fca6b62bc4bf44bcf142cfc38caeded9b6c4e01d1ceef3ccf986f4","tests/const_fn.rs":"cb75a1f0864f926aebe79118fc34d51a0d1ade2c20a394e7774c7e545f21f1f4"},"package":"8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"} -\ No newline at end of file diff --git a/poky/meta/recipes-devtools/rust/rust/crossbeam_atomic.patch b/poky/meta/recipes-devtools/rust/rust/crossbeam_atomic.patch deleted file mode 100644 index 1c0d5a1974..0000000000 --- a/poky/meta/recipes-devtools/rust/rust/crossbeam_atomic.patch +++ /dev/null @@ -1,81 +0,0 @@ -crossbeam-utils is taking the target triplet and comparing it against a -known list of platforms that have issues either with any atomics or with -64 bit atomics. Since OE encodes TARGET_VENDOR into the rust triplet (to -differentiate host vs. target) this means that platforms that should match, -don't. - -We could make a list of platforms and pass in configuration values but -having one list in rust and another in our recipes is likely to cause -problems in the future. We do already have this issue in the librsvg recipe. -Instead, switch out the value of TARGET_VENDOR for "-unknown" which -them makes the list in no_atomics.rs work correctly. - -Someone with more rust knowledge could split up the triplets in no_atmoics.rs -and compare against the architecture/processor, or replace -unknown with a glob -to create a patch that upstream might accept. - -Upstream-Status: Submitted [https://github.com/crossbeam-rs/crossbeam/pull/922] -Signed-off-by: Richard Purdie - -Index: rustc-1.65.0-src/vendor/crossbeam-utils/build.rs -=================================================================== ---- rustc-1.65.0-src.orig/vendor/crossbeam-utils/build.rs -+++ rustc-1.65.0-src/vendor/crossbeam-utils/build.rs -@@ -29,7 +29,7 @@ use std::env; - include!("no_atomic.rs"); - - fn main() { -- let target = match env::var("TARGET") { -+ let mut target = match env::var("TARGET") { - Ok(target) => target, - Err(e) => { - println!( -@@ -40,6 +40,8 @@ fn main() { - return; - } - }; -+ let vendor = env::var("TARGET_VENDOR").unwrap(); -+ target = target.replace(&vendor, "-unknown"); - - // Note that this is `no_`*, not `has_*`. This allows treating as the latest - // stable rustc is used when the build script doesn't run. This is useful -Index: rustc-1.65.0-src/vendor/crossbeam-utils/.cargo-checksum.json -=================================================================== ---- rustc-1.65.0-src.orig/vendor/crossbeam-utils/.cargo-checksum.json -+++ rustc-1.65.0-src/vendor/crossbeam-utils/.cargo-checksum.json -@@ -1 +1 @@ --{"files":{"CHANGELOG.md":"eb2f46ecf2eee5f591c4d4e789f18735bb1ed771782a5e0f16eab3a77001e7c2","Cargo.toml":"9ce8b596c9789e65bef4c952bdcac84fc88e50ba9ecb01a818036eff4e6ecfec","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"2a19af38a52dd965c2d66bb39f90a85b430b51ee9ccb29e9e1978ee7091e5087","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"4859f9c926c230023e861bf01c4b225b460035faf8cf6240108530efedbb747f","no_atomic.rs":"916ed15218bb7b75a4e0d432430e7134efd27ca43ca8a8766e0c90e89febb602","src/atomic/atomic_cell.rs":"0fc99463e633144c5d59d39c35b5477da1f1b90f5448cadc37454b7f4b97707e","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"8fd5e3dcccc05860680e49c8498de8096bee9140bcfee8723d97117106a020d0","src/cache_padded.rs":"6a512698115ad0d5a5b163dbd7a83247e1f1c146c4a30f3fc74b952e3b767b59","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"59986f559a8f170a4b3247ab2eea2460b09809d87c8110ed88e4e7103d3519dc","src/sync/parker.rs":"91f3a7d4ee8d9e06b6558d180e8a0df08ff5c6cef612b4ce4790f9f75cb34f84","src/sync/sharded_lock.rs":"78433f55ee3defeea348d65abc78e03d63d6a304e09c568b27b403e9ad205771","src/sync/wait_group.rs":"32e946a7581c55f8aa9904527b92b177c538fa0cf7cbcfa1d1f25990582cb6ea","src/thread.rs":"21cf9b3e965529e5c0a6ff8fc1ec846bfe0006c41deb238a149be8d07384e955","tests/atomic_cell.rs":"bf8bc869c922a1cbf929c3b741bae0cae98f2157f572b5a4eb2873d20a407c22","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"314adeb8a651a28935f7a49c9a261b8fa1fd82bf6a16c865a5aced6216d7e40b","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"02661c2a820a5abe8b0c8fe15a6650aead707b57cdda0610d1b09a2680ed6969"},"package":"51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"} -\ No newline at end of file -+{"files":{"CHANGELOG.md":"eb2f46ecf2eee5f591c4d4e789f18735bb1ed771782a5e0f16eab3a77001e7c2","Cargo.toml":"9ce8b596c9789e65bef4c952bdcac84fc88e50ba9ecb01a818036eff4e6ecfec","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"2a19af38a52dd965c2d66bb39f90a85b430b51ee9ccb29e9e1978ee7091e5087","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"108ba75398e3169c35b0e9754782391e4e4a9f9bf0ae2b216b55d836c4ac9ba8","no_atomic.rs":"916ed15218bb7b75a4e0d432430e7134efd27ca43ca8a8766e0c90e89febb602","src/atomic/atomic_cell.rs":"0fc99463e633144c5d59d39c35b5477da1f1b90f5448cadc37454b7f4b97707e","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"8fd5e3dcccc05860680e49c8498de8096bee9140bcfee8723d97117106a020d0","src/cache_padded.rs":"6a512698115ad0d5a5b163dbd7a83247e1f1c146c4a30f3fc74b952e3b767b59","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"59986f559a8f170a4b3247ab2eea2460b09809d87c8110ed88e4e7103d3519dc","src/sync/parker.rs":"91f3a7d4ee8d9e06b6558d180e8a0df08ff5c6cef612b4ce4790f9f75cb34f84","src/sync/sharded_lock.rs":"78433f55ee3defeea348d65abc78e03d63d6a304e09c568b27b403e9ad205771","src/sync/wait_group.rs":"32e946a7581c55f8aa9904527b92b177c538fa0cf7cbcfa1d1f25990582cb6ea","src/thread.rs":"21cf9b3e965529e5c0a6ff8fc1ec846bfe0006c41deb238a149be8d07384e955","tests/atomic_cell.rs":"bf8bc869c922a1cbf929c3b741bae0cae98f2157f572b5a4eb2873d20a407c22","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"314adeb8a651a28935f7a49c9a261b8fa1fd82bf6a16c865a5aced6216d7e40b","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"02661c2a820a5abe8b0c8fe15a6650aead707b57cdda0610d1b09a2680ed6969"},"package":"51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"} -\ No newline at end of file -Index: rustc-1.65.0-src/vendor/crossbeam-utils-0.8.8/.cargo-checksum.json -=================================================================== ---- rustc-1.65.0-src.orig/vendor/crossbeam-utils-0.8.8/.cargo-checksum.json -+++ rustc-1.65.0-src/vendor/crossbeam-utils-0.8.8/.cargo-checksum.json -@@ -1 +1 @@ --{"files":{"CHANGELOG.md":"665a9f2c5fd37c98bef7c1b6eda753b58bb925d87e5b42d7298df973d7590631","Cargo.toml":"fe22292acd6a868e65baf225f90d5678678971642814d2d8e92a03954b8bdb40","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"dfa9fbed47c344c134a63c84b7c0e4651baeac1554b7b3266d0e38643743fc33","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"7e74dc72343ff57e83d0a84a9fbdd9ff1645894165909999b4c3d2fba94bc96c","no_atomic.rs":"71b5f78fd701ce604aa766dd3d825fa5bed774282aae4d6c31d7acb01b1b242f","src/atomic/atomic_cell.rs":"01185588e0e16ba81425677966d0c11887dedc4ac0d4a65991a34057c418adc4","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"7cc7754e15f69b52e92a70d4f49d1bc274693455a0933a2d7eb0605806566af3","src/cache_padded.rs":"6a512698115ad0d5a5b163dbd7a83247e1f1c146c4a30f3fc74b952e3b767b59","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"59986f559a8f170a4b3247ab2eea2460b09809d87c8110ed88e4e7103d3519dc","src/sync/parker.rs":"3f997f5b41fec286ccedcf3d36f801d741387badb574820b8e3456117ecd9154","src/sync/sharded_lock.rs":"14be659744918d0b27db24c56b41c618b0f0484b6761da46561023d96c4c120f","src/sync/wait_group.rs":"32e946a7581c55f8aa9904527b92b177c538fa0cf7cbcfa1d1f25990582cb6ea","src/thread.rs":"6a7676fd4e50af63aec6f655121a10cd6e8c704f4677125388186ba58dc5842d","tests/atomic_cell.rs":"d64faa1ca8896373468308031220940d988aa3a1679ea25d2291a7a7d22bc51a","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"eb6c5b59f007e0d290dd0f58758e8ccb5cacd38af34e3341368ced815f0c41be","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"ad8f0cdfed31f9594a2e0737234d418f8b924d784a4db8d7e469deab8c95f5f8"},"package":"0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"} -\ No newline at end of file -+{"files":{"CHANGELOG.md":"665a9f2c5fd37c98bef7c1b6eda753b58bb925d87e5b42d7298df973d7590631","Cargo.toml":"fe22292acd6a868e65baf225f90d5678678971642814d2d8e92a03954b8bdb40","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"dfa9fbed47c344c134a63c84b7c0e4651baeac1554b7b3266d0e38643743fc33","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"d983d511c89607ce89473779d1ee195e3eb509cc4d3043b9efe6aa2f94c98158","no_atomic.rs":"71b5f78fd701ce604aa766dd3d825fa5bed774282aae4d6c31d7acb01b1b242f","src/atomic/atomic_cell.rs":"01185588e0e16ba81425677966d0c11887dedc4ac0d4a65991a34057c418adc4","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"7cc7754e15f69b52e92a70d4f49d1bc274693455a0933a2d7eb0605806566af3","src/cache_padded.rs":"6a512698115ad0d5a5b163dbd7a83247e1f1c146c4a30f3fc74b952e3b767b59","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"59986f559a8f170a4b3247ab2eea2460b09809d87c8110ed88e4e7103d3519dc","src/sync/parker.rs":"3f997f5b41fec286ccedcf3d36f801d741387badb574820b8e3456117ecd9154","src/sync/sharded_lock.rs":"14be659744918d0b27db24c56b41c618b0f0484b6761da46561023d96c4c120f","src/sync/wait_group.rs":"32e946a7581c55f8aa9904527b92b177c538fa0cf7cbcfa1d1f25990582cb6ea","src/thread.rs":"6a7676fd4e50af63aec6f655121a10cd6e8c704f4677125388186ba58dc5842d","tests/atomic_cell.rs":"d64faa1ca8896373468308031220940d988aa3a1679ea25d2291a7a7d22bc51a","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"eb6c5b59f007e0d290dd0f58758e8ccb5cacd38af34e3341368ced815f0c41be","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"ad8f0cdfed31f9594a2e0737234d418f8b924d784a4db8d7e469deab8c95f5f8"},"package":"0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"} -\ No newline at end of file -Index: rustc-1.65.0-src/vendor/crossbeam-utils-0.8.8/build.rs -=================================================================== ---- rustc-1.65.0-src.orig/vendor/crossbeam-utils-0.8.8/build.rs -+++ rustc-1.65.0-src/vendor/crossbeam-utils-0.8.8/build.rs -@@ -29,7 +29,7 @@ use std::env; - include!("no_atomic.rs"); - - fn main() { -- let target = match env::var("TARGET") { -+ let mut target = match env::var("TARGET") { - Ok(target) => target, - Err(e) => { - println!( -@@ -40,6 +40,8 @@ fn main() { - return; - } - }; -+ let vendor = env::var("TARGET_VENDOR").unwrap(); -+ target = target.replace(&vendor, "-unknown"); - - // Note that this is `no_*`, not `has_*`. This allows treating - // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't diff --git a/poky/meta/recipes-devtools/rust/rust/hardcodepaths.patch b/poky/meta/recipes-devtools/rust/rust/hardcodepaths.patch deleted file mode 100644 index 87ac0c3989..0000000000 --- a/poky/meta/recipes-devtools/rust/rust/hardcodepaths.patch +++ /dev/null @@ -1,70 +0,0 @@ -When building for the target, some build paths end up embedded in the binaries. -These changes remove that. Further investigation is needed to work out the way -to resolve these issues properly upstream. - -Upstream-Status: Inappropriate [patches need rework] -Signed-off-by: Richard Purdie - -Index: rustc-1.65.0-src/src/tools/clippy/src/driver.rs -=================================================================== ---- rustc-1.65.0-src.orig/src/tools/clippy/src/driver.rs -+++ rustc-1.65.0-src/src/tools/clippy/src/driver.rs -@@ -259,7 +259,6 @@ pub fn main() { - .and_then(|out| String::from_utf8(out.stdout).ok()) - .map(|s| PathBuf::from(s.trim())) - }) -- .or_else(|| option_env!("SYSROOT").map(PathBuf::from)) - .or_else(|| { - let home = option_env!("RUSTUP_HOME") - .or(option_env!("MULTIRUST_HOME")) -Index: rustc-1.65.0-src/compiler/rustc_codegen_llvm/src/context.rs -=================================================================== ---- rustc-1.65.0-src.orig/compiler/rustc_codegen_llvm/src/context.rs -+++ rustc-1.65.0-src/compiler/rustc_codegen_llvm/src/context.rs -@@ -155,46 +155,6 @@ pub unsafe fn create_module<'ll>( - } - } - -- // Ensure the data-layout values hardcoded remain the defaults. -- if sess.target.is_builtin { -- let tm = crate::back::write::create_informational_target_machine(tcx.sess); -- llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm); -- llvm::LLVMRustDisposeTargetMachine(tm); -- -- let llvm_data_layout = llvm::LLVMGetDataLayoutStr(llmod); -- let llvm_data_layout = str::from_utf8(CStr::from_ptr(llvm_data_layout).to_bytes()) -- .expect("got a non-UTF8 data-layout from LLVM"); -- -- // Unfortunately LLVM target specs change over time, and right now we -- // don't have proper support to work with any more than one -- // `data_layout` than the one that is in the rust-lang/rust repo. If -- // this compiler is configured against a custom LLVM, we may have a -- // differing data layout, even though we should update our own to use -- // that one. -- // -- // As an interim hack, if CFG_LLVM_ROOT is not an empty string then we -- // disable this check entirely as we may be configured with something -- // that has a different target layout. -- // -- // Unsure if this will actually cause breakage when rustc is configured -- // as such. -- // -- // FIXME(#34960) -- let cfg_llvm_root = option_env!("CFG_LLVM_ROOT").unwrap_or(""); -- let custom_llvm_used = cfg_llvm_root.trim() != ""; -- -- if !custom_llvm_used && target_data_layout != llvm_data_layout { -- bug!( -- "data-layout for target `{rustc_target}`, `{rustc_layout}`, \ -- differs from LLVM target's `{llvm_target}` default layout, `{llvm_layout}`", -- rustc_target = sess.opts.target_triple, -- rustc_layout = target_data_layout, -- llvm_target = sess.target.llvm_target, -- llvm_layout = llvm_data_layout -- ); -- } -- } -- - let data_layout = SmallCStr::new(&target_data_layout); - llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr()); - diff --git a/poky/meta/recipes-devtools/rust/rust_1.65.0.bb b/poky/meta/recipes-devtools/rust/rust_1.65.0.bb deleted file mode 100644 index dbf74cec8f..0000000000 --- a/poky/meta/recipes-devtools/rust/rust_1.65.0.bb +++ /dev/null @@ -1,86 +0,0 @@ -require rust-target.inc -require rust-source.inc -require rust-snapshot.inc - -INSANE_SKIP:${PN}:class-native = "already-stripped" -FILES:${PN} += "${libdir}/rustlib" -FILES:${PN} += "${libdir}/*.so" -FILES:${PN}-dev = "" - -# Used by crossbeam_atomic.patch -export TARGET_VENDOR - -do_compile () { - rust_runx build --stage 2 -} - -do_compile:append:class-target () { - rust_runx build --stage 2 src/tools/clippy - rust_runx build --stage 2 src/tools/rustfmt -} - -do_compile:append:class-nativesdk () { - rust_runx build --stage 2 src/tools/clippy - rust_runx build --stage 2 src/tools/rustfmt -} - -ALLOW_EMPTY:${PN} = "1" - -PACKAGES =+ "${PN}-tools-clippy ${PN}-tools-rustfmt" -FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver" -FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt" -RDEPENDS:${PN}-tools-clippy = "${PN}" -RDEPENDS:${PN}-tools-rustfmt = "${PN}" - -SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" -SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" - -rust_do_install() { - rust_runx install -} - -rust_do_install:class-nativesdk() { - export PSEUDO_UNLOAD=1 - rust_runx install - unset PSEUDO_UNLOAD - - install -d ${D}${bindir} - for i in cargo-clippy clippy-driver rustfmt; do - cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} - chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i - done - - chown root:root ${D}/ -R - rm ${D}${libdir}/rustlib/uninstall.sh - rm ${D}${libdir}/rustlib/install.log - rm ${D}${libdir}/rustlib/manifest* -} - -EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt" -rust_do_install:class-target() { - export PSEUDO_UNLOAD=1 - rust_runx install - unset PSEUDO_UNLOAD - - install -d ${D}${bindir} - for i in ${EXTRA_TOOLS}; do - cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} - chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i - done - - chown root:root ${D}/ -R - rm ${D}${libdir}/rustlib/uninstall.sh - rm ${D}${libdir}/rustlib/install.log - rm ${D}${libdir}/rustlib/manifest* -} - -# see recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch -# we need to link with ssp_nonshared on musl to avoid "undefined reference to `__stack_chk_fail_local'" -# when building MACHINE=qemux86 for musl -WRAPPER_TARGET_EXTRALD:libc-musl = "-lssp_nonshared" - -RUSTLIB_DEP:class-nativesdk = "" - -# musl builds include libunwind.a -INSANE_SKIP:${PN} = "staticdev" - diff --git a/poky/meta/recipes-devtools/rust/rust_1.66.0.bb b/poky/meta/recipes-devtools/rust/rust_1.66.0.bb new file mode 100644 index 0000000000..eba933dded --- /dev/null +++ b/poky/meta/recipes-devtools/rust/rust_1.66.0.bb @@ -0,0 +1,297 @@ +SUMMARY = "Rust compiler and runtime libaries" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=92289ed52a60b63ab715612ad2915603" + +inherit rust +inherit cargo_common + +DEPENDS += "file-native python3-native" +DEPENDS:append:class-native = " rust-llvm-native" +DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" + +DEPENDS += "rust-llvm (=${PV})" + +# Otherwise we'll depend on what we provide +INHIBIT_DEFAULT_RUST_DEPS:class-native = "1" +# We don't need to depend on gcc-native because yocto assumes it exists +PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust" + +S = "${RUSTSRC}" + +# Use at your own risk, accepted values are stable, beta and nightly +RUST_CHANNEL ?= "stable" +PV .= "${@bb.utils.contains('RUST_CHANNEL', 'stable', '', '-${RUST_CHANNEL}', d)}" + +export FORCE_CRATE_HASH="${BB_TASKHASH}" + +RUST_ALTERNATE_EXE_PATH ?= "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" +RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" + +# We don't want to use bitbakes vendoring because the rust sources do their +# own vendoring. +CARGO_DISABLE_BITBAKE_VENDORING = "1" + +# We can't use RUST_BUILD_SYS here because that may be "musl" if +# TCLIBC="musl". Snapshots are always -unknown-linux-gnu +setup_cargo_environment () { + # The first step is to build bootstrap and some early stage tools, + # these are build for the same target as the snapshot, e.g. + # x86_64-unknown-linux-gnu. + # Later stages are build for the native target (i.e. target.x86_64-linux) + cargo_common_do_configure +} + +inherit rust-target-config + +do_rust_setup_snapshot () { + for installer in "${WORKDIR}/rust-snapshot-components/"*"/install.sh"; do + "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig + done + + # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo + # and fail without it there. + mkdir -p ${RUSTSRC}/build/${BUILD_SYS} + ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 + + # Need to use uninative's loader if enabled/present since the library paths + # are used internally by rust and result in symbol mismatches if we don't + if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then + for bin in cargo rustc rustdoc; do + patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER} + done + fi +} +addtask rust_setup_snapshot after do_unpack before do_configure +do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot" +do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" + +python do_configure() { + import json + try: + import configparser + except ImportError: + import ConfigParser as configparser + + # toml is rather similar to standard ini like format except it likes values + # that look more JSON like. So for our purposes simply escaping all values + # as JSON seem to work fine. + + e = lambda s: json.dumps(s) + + config = configparser.RawConfigParser() + + # [target.ARCH-poky-linux] + host_section = "target.{}".format(d.getVar('RUST_HOST_SYS', True)) + config.add_section(host_section) + + llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") + llvm_config_build = d.expand("${RUST_ALTERNATE_EXE_PATH_NATIVE}") + config.set(host_section, "llvm-config", e(llvm_config_target)) + + config.set(host_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) + config.set(host_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) + config.set(host_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) + if "musl" in host_section: + config.set(host_section, "musl-root", e(d.expand("${STAGING_DIR_HOST}${exec_prefix}"))) + + # If we don't do this rust-native will compile it's own llvm for BUILD. + # [target.${BUILD_ARCH}-unknown-linux-gnu] + build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS', True)) + if build_section != host_section: + config.add_section(build_section) + + config.set(build_section, "llvm-config", e(llvm_config_build)) + + config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) + config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) + config.set(build_section, "linker", e(d.expand("${RUST_BUILD_CCLD}"))) + + target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True)) + if target_section != host_section and target_section != build_section: + config.add_section(target_section) + + config.set(target_section, "llvm-config", e(llvm_config_target)) + + config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) + config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) + config.set(target_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) + + # [llvm] + config.add_section("llvm") + config.set("llvm", "static-libstdcpp", e(False)) + if "llvm" in (d.getVar('TC_CXX_RUNTIME') or ""): + config.set("llvm", "use-libcxx", e(True)) + + # [rust] + config.add_section("rust") + config.set("rust", "rpath", e(True)) + config.set("rust", "channel", e(d.expand("${RUST_CHANNEL}"))) + + # Whether or not to optimize the compiler and standard library + config.set("rust", "optimize", e(True)) + + # Emits extraneous output from tests to ensure that failures of the test + # harness are debuggable just from logfiles + config.set("rust", "verbose-tests", e(True)) + + # [build] + config.add_section("build") + config.set("build", "submodules", e(False)) + config.set("build", "docs", e(False)) + + rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc") + config.set("build", "rustc", e(rustc)) + + # Support for the profiler runtime to generate e.g. coverage report, + # PGO etc. + config.set("build", "profiler", e(True)) + + cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo") + config.set("build", "cargo", e(cargo)) + + config.set("build", "vendor", e(True)) + + if not "targets" in locals(): + targets = [d.getVar("RUST_TARGET_SYS", True)] + config.set("build", "target", e(targets)) + + if not "hosts" in locals(): + hosts = [d.getVar("RUST_HOST_SYS", True)] + config.set("build", "host", e(hosts)) + + # We can't use BUILD_SYS since that is something the rust snapshot knows + # nothing about when trying to build some stage0 tools (like fabricate) + config.set("build", "build", e(d.getVar("RUST_BUILD_SYS", True))) + + # [install] + config.add_section("install") + # ./x.py install doesn't have any notion of "destdir" + # but we can prepend ${D} to all the directories instead + config.set("install", "prefix", e(d.getVar("D", True) + d.getVar("prefix", True))) + config.set("install", "bindir", e(d.getVar("D", True) + d.getVar("bindir", True))) + config.set("install", "libdir", e(d.getVar("D", True) + d.getVar("libdir", True))) + config.set("install", "datadir", e(d.getVar("D", True) + d.getVar("datadir", True))) + config.set("install", "mandir", e(d.getVar("D", True) + d.getVar("mandir", True))) + + with open("config.toml", "w") as f: + f.write('changelog-seen = 2\n\n') + config.write(f) + + # set up ${WORKDIR}/cargo_home + bb.build.exec_func("setup_cargo_environment", d) +} + +rust_runx () { + echo "COMPILE ${PN}" "$@" + + # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a + # wide range of targets (not just TARGET). Yocto's settings for them will + # be inappropriate, avoid using. + unset CFLAGS + unset LDFLAGS + unset CXXFLAGS + unset CPPFLAGS + + export RUSTFLAGS="${RUST_DEBUG_REMAP}" + + # Copy the natively built llvm-config into the target so we can run it. Horrible, + # but works! + if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} ]; then + mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` + cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} + chrpath -d ${RUST_ALTERNATE_EXE_PATH} + fi + + oe_cargo_fix_env + + python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose +} +rust_runx[vardepsexclude] += "PARALLEL_MAKE" + +require rust-source.inc +require rust-snapshot.inc + +INSANE_SKIP:${PN}:class-native = "already-stripped" +FILES:${PN} += "${libdir}/rustlib" +FILES:${PN} += "${libdir}/*.so" +FILES:${PN}-dev = "" + +do_compile () { + rust_runx build --stage 2 +} + +do_compile:append:class-target () { + rust_runx build --stage 2 src/tools/clippy + rust_runx build --stage 2 src/tools/rustfmt +} + +do_compile:append:class-nativesdk () { + rust_runx build --stage 2 src/tools/clippy + rust_runx build --stage 2 src/tools/rustfmt +} + +ALLOW_EMPTY:${PN} = "1" + +PACKAGES =+ "${PN}-tools-clippy ${PN}-tools-rustfmt" +FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver" +FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt" +RDEPENDS:${PN}-tools-clippy = "${PN}" +RDEPENDS:${PN}-tools-rustfmt = "${PN}" + +SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" +SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" + +do_install () { + rust_do_install +} + +rust_do_install() { + rust_runx install +} + +rust_do_install:class-nativesdk() { + export PSEUDO_UNLOAD=1 + rust_runx install + unset PSEUDO_UNLOAD + + install -d ${D}${bindir} + for i in cargo-clippy clippy-driver rustfmt; do + cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} + chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i + done + + chown root:root ${D}/ -R + rm ${D}${libdir}/rustlib/uninstall.sh + rm ${D}${libdir}/rustlib/install.log + rm ${D}${libdir}/rustlib/manifest* +} + +EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt" +rust_do_install:class-target() { + export PSEUDO_UNLOAD=1 + rust_runx install + unset PSEUDO_UNLOAD + + install -d ${D}${bindir} + for i in ${EXTRA_TOOLS}; do + cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} + chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i + done + + install -d ${D}${libdir}/rustlib/${RUST_HOST_SYS} + install -m 0644 ${WORKDIR}/rust-targets/${RUST_HOST_SYS}.json ${D}${libdir}/rustlib/${RUST_HOST_SYS}/target.json + + chown root:root ${D}/ -R + rm ${D}${libdir}/rustlib/uninstall.sh + rm ${D}${libdir}/rustlib/install.log + rm ${D}${libdir}/rustlib/manifest* +} + +RUSTLIB_DEP:class-nativesdk = "" + +# musl builds include libunwind.a +INSANE_SKIP:${PN} = "staticdev" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/strace/strace/0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch b/poky/meta/recipes-devtools/strace/strace/0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch new file mode 100644 index 0000000000..76ca7a76a8 --- /dev/null +++ b/poky/meta/recipes-devtools/strace/strace/0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch @@ -0,0 +1,27 @@ +From 470399f3636c412b74f9daf6ae430b13c3126f02 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 15:54:27 -0800 +Subject: [PATCH] configure: Use autoconf macro to detect largefile support + +Adds --enable-largefile/--disable-largefile configure knobs +where default is to detect the support + +Upstream-Status: Submitted [https://github.com/strace/strace/pull/230] +Signed-off-by: Khem Raj +--- + configure.ac | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 4797b42dd..7d57fb254 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -43,6 +43,8 @@ AC_PROG_INSTALL + AC_PROG_RANLIB + AC_PROG_LN_S + ++AC_SYS_LARGEFILE ++ + AC_USE_SYSTEM_EXTENSIONS + AX_CODE_COVERAGE + diff --git a/poky/meta/recipes-devtools/strace/strace/0002-tests-Replace-off64_t-with-off_t.patch b/poky/meta/recipes-devtools/strace/strace/0002-tests-Replace-off64_t-with-off_t.patch new file mode 100644 index 0000000000..0cabdfe99f --- /dev/null +++ b/poky/meta/recipes-devtools/strace/strace/0002-tests-Replace-off64_t-with-off_t.patch @@ -0,0 +1,52 @@ +From 579b2ebe52d4b97f954e6188df2d07e137820075 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 15:56:13 -0800 +Subject: [PATCH] tests: Replace off64_t with off_t + +when _FILE_OFFSET_BITS=64 then off_t is 64bit wide, this also fixes +build on musl where off64_t is not available without _LARGEFILE64_SOURCE + +Upstream-Status: Submitted [https://github.com/strace/strace/pull/230] +Signed-off-by: Khem Raj +--- + tests/readahead.c | 2 +- + tests/sync_file_range2.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/tests/readahead.c ++++ b/tests/readahead.c +@@ -42,7 +42,7 @@ static const int fds[] = { + 0x7fffffff, + }; + +-static const off64_t offsets[] = { ++static const off_t offsets[] = { + -0x8000000000000000LL, + -0x5060708090a0b0c0LL, + -1LL, +--- a/tests/sync_file_range2.c ++++ b/tests/sync_file_range2.c +@@ -20,8 +20,8 @@ int + main(void) + { + const int fd = -1; +- const off64_t offset = 0xdeadbeefbadc0ded; +- const off64_t nbytes = 0xfacefeedcafef00d; ++ const off_t offset = 0xdeadbeefbadc0ded; ++ const off_t nbytes = 0xfacefeedcafef00d; + const unsigned int flags = -1; + + int rc = sync_file_range(fd, offset, nbytes, flags); +--- a/tests/sync_file_range.c ++++ b/tests/sync_file_range.c +@@ -20,8 +20,8 @@ int + main(void) + { + const int fd = -1; +- const off64_t offset = 0xdeadbeefbadc0dedULL; +- const off64_t nbytes = 0xfacefeedcafef00dULL; ++ const off_t offset = 0xdeadbeefbadc0dedULL; ++ const off_t nbytes = 0xfacefeedcafef00dULL; + const unsigned int flags = -1; + + int rc = sync_file_range(fd, offset, nbytes, flags); diff --git a/poky/meta/recipes-devtools/strace/strace_6.0.bb b/poky/meta/recipes-devtools/strace/strace_6.0.bb deleted file mode 100644 index 4fa3589d15..0000000000 --- a/poky/meta/recipes-devtools/strace/strace_6.0.bb +++ /dev/null @@ -1,57 +0,0 @@ -SUMMARY = "System call tracing tool" -HOMEPAGE = "http://strace.io" -DESCRIPTION = "strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state." -SECTION = "console/utils" -LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=59a33f0a3e6122d67c0b3befccbdaa6b" - -SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \ - file://update-gawk-paths.patch \ - file://Makefile-ptest.patch \ - file://run-ptest \ - file://0001-caps-abbrev.awk-fix-gawk-s-path.patch \ - file://ptest-spacesave.patch \ - file://0001-strace-fix-reproducibilty-issues.patch \ - file://skip-load.patch \ - " -SRC_URI[sha256sum] = "92d720a666855e9f1c6a11512fd6e99674a82bbfe1442557815f2ce8e1293338" - -inherit autotools ptest - -# Not yet ported to rv32 -COMPATIBLE_HOST:riscv32 = "null" - -PACKAGECONFIG:class-target ??= "\ - ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \ -" - -PACKAGECONFIG[bluez] = "ac_cv_header_bluetooth_bluetooth_h=yes,ac_cv_header_bluetooth_bluetooth_h=no,bluez5" -PACKAGECONFIG[libunwind] = "--with-libunwind,--without-libunwind,libunwind" - -EXTRA_OECONF += "--enable-mpers=no --disable-gcc-Werror" - -CFLAGS:append:libc-musl = " -Dsigcontext_struct=sigcontext" - -TESTDIR = "tests" -PTEST_BUILD_HOST_PATTERN = "^(DEB_CHANGELOGTIME|RPM_CHANGELOGTIME|WARN_CFLAGS_FOR_BUILD|LDFLAGS_FOR_BUILD)" - -do_compile_ptest() { - oe_runmake -C ${TESTDIR} buildtest-TESTS -} - -do_install_ptest() { - oe_runmake -C ${TESTDIR} install-ptest BUILDDIR=${B} DESTDIR=${D}${PTEST_PATH} TESTDIR=${TESTDIR} - mkdir -p ${D}${PTEST_PATH}/build-aux - mkdir -p ${D}${PTEST_PATH}/src - install -m 755 ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ - install -m 644 ${B}/src/config.h ${D}${PTEST_PATH}/src/ - sed -i -e '/^src/s/strace.*[0-9]/ptest/' ${D}/${PTEST_PATH}/${TESTDIR}/Makefile -} - -RDEPENDS:${PN}-ptest += "make coreutils grep gawk sed" - -RDEPENDS:${PN}-ptest:append:libc-glibc = "\ - locale-base-en-us.iso-8859-1 \ -" - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/strace/strace_6.1.bb b/poky/meta/recipes-devtools/strace/strace_6.1.bb new file mode 100644 index 0000000000..ec5c10c80d --- /dev/null +++ b/poky/meta/recipes-devtools/strace/strace_6.1.bb @@ -0,0 +1,59 @@ +SUMMARY = "System call tracing tool" +HOMEPAGE = "http://strace.io" +DESCRIPTION = "strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state." +SECTION = "console/utils" +LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=59a33f0a3e6122d67c0b3befccbdaa6b" + +SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \ + file://update-gawk-paths.patch \ + file://Makefile-ptest.patch \ + file://run-ptest \ + file://0001-caps-abbrev.awk-fix-gawk-s-path.patch \ + file://ptest-spacesave.patch \ + file://0001-strace-fix-reproducibilty-issues.patch \ + file://skip-load.patch \ + file://0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch \ + file://0002-tests-Replace-off64_t-with-off_t.patch \ + " +SRC_URI[sha256sum] = "2579e9cec37dbb786f6ea0bebd15f40dd561ef2bde2a2a2ecdce5963b01859fd" + +inherit autotools ptest + +# Not yet ported to rv32 +COMPATIBLE_HOST:riscv32 = "null" + +PACKAGECONFIG:class-target ??= "\ + ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \ +" + +PACKAGECONFIG[bluez] = "ac_cv_header_bluetooth_bluetooth_h=yes,ac_cv_header_bluetooth_bluetooth_h=no,bluez5" +PACKAGECONFIG[libunwind] = "--with-libunwind,--without-libunwind,libunwind" + +EXTRA_OECONF += "--enable-mpers=no --disable-gcc-Werror" + +CFLAGS:append:libc-musl = " -Dsigcontext_struct=sigcontext" + +TESTDIR = "tests" +PTEST_BUILD_HOST_PATTERN = "^(DEB_CHANGELOGTIME|RPM_CHANGELOGTIME|WARN_CFLAGS_FOR_BUILD|LDFLAGS_FOR_BUILD)" + +do_compile_ptest() { + oe_runmake -C ${TESTDIR} buildtest-TESTS +} + +do_install_ptest() { + oe_runmake -C ${TESTDIR} install-ptest BUILDDIR=${B} DESTDIR=${D}${PTEST_PATH} TESTDIR=${TESTDIR} + mkdir -p ${D}${PTEST_PATH}/build-aux + mkdir -p ${D}${PTEST_PATH}/src + install -m 755 ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ + install -m 644 ${B}/src/config.h ${D}${PTEST_PATH}/src/ + sed -i -e '/^src/s/strace.*[0-9]/ptest/' ${D}/${PTEST_PATH}/${TESTDIR}/Makefile +} + +RDEPENDS:${PN}-ptest += "make coreutils grep gawk sed" + +RDEPENDS:${PN}-ptest:append:libc-glibc = "\ + locale-base-en-us.iso-8859-1 \ +" + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-devtools/swig/swig.inc b/poky/meta/recipes-devtools/swig/swig.inc index 13470c1094..7a6c4d7359 100644 --- a/poky/meta/recipes-devtools/swig/swig.inc +++ b/poky/meta/recipes-devtools/swig/swig.inc @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e7807a6282784a7dde4c846626b08fc6 \ SECTION = "devel" -DEPENDS = "libpcre bison-native" +DEPENDS = "libpcre2 bison-native" SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz" UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/swig/files/swig/" diff --git a/poky/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch b/poky/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch index fdb9760e89..cfcbd8c73a 100644 --- a/poky/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch +++ b/poky/meta/recipes-devtools/swig/swig/0001-configure-use-pkg-config-for-pcre-detection.patch @@ -1,52 +1,56 @@ -From 5c4d6d8538994d5fe9b3b46bfafaf0a605e3bda6 Mon Sep 17 00:00:00 2001 +From ffb785ed8d3cac3c28e014b1238d93e2bc1f0c01 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Tue, 17 Jun 2014 08:18:17 +0200 Subject: [PATCH] configure: use pkg-config for pcre detection Signed-off-by: Koen Kooi Upstream-Status: Pending + --- - configure.ac | 38 +++++++------------------------------- - 1 file changed, 7 insertions(+), 31 deletions(-) + configure.ac | 39 +++++++-------------------------------- + 1 file changed, 7 insertions(+), 32 deletions(-) +diff --git a/configure.ac b/configure.ac +index f88004a..3a2b47c 100644 --- a/configure.ac +++ b/configure.ac -@@ -52,38 +52,14 @@ AC_MSG_RESULT([$with_pcre]) +@@ -57,39 +57,14 @@ AC_MSG_RESULT([$with_pcre]) dnl To make configuring easier, check for a locally built PCRE using the Tools/pcre-build.sh script if test x"${with_pcre}" = xyes ; then -- AC_MSG_CHECKING([whether to use local PCRE]) +- AC_MSG_CHECKING([whether to use local PCRE2]) - local_pcre_config=no -- if test -z $PCRE_CONFIG; then -- if test -f `pwd`/pcre/pcre-swig-install/bin/pcre-config; then -- PCRE_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre-config -- local_pcre_config=$PCRE_CONFIG +- if test -z "$PCRE2_CONFIG"; then +- if test -f `pwd`/pcre/pcre-swig-install/bin/pcre2-config; then +- PCRE2_CONFIG=`pwd`/pcre/pcre-swig-install/bin/pcre2-config +- local_pcre_config=$PCRE2_CONFIG - fi - fi - AC_MSG_RESULT([$local_pcre_config]) -fi -AS_IF([test "x$with_pcre" != xno], -- [AX_PATH_GENERIC([pcre], +- [AX_PATH_GENERIC([pcre2], - [], dnl Minimal version of PCRE we need -- accept any - [], dnl custom sed script for version parsing is not needed -- [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library]) -- LIBS="$LIBS $PCRE_LIBS" -- CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS" +- [AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE2 library]) +- LIBS="$LIBS $PCRE2_LIBS" +- CPPFLAGS="$CPPFLAGS $PCRE2_CFLAGS" - ], - [AC_MSG_FAILURE([ -- Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions) +- Cannot find pcre2-config script from PCRE2 (Perl Compatible Regular Expressions) - library package. This dependency is needed for configure to complete, - Either: -- - Install the PCRE developer package on your system (preferred approach). -- - Download the PCRE source tarball, build and install on your system +- - Install the PCRE2 developer package on your system (preferred approach). +- - Download the PCRE2 source tarball, build and install on your system - as you would for any package built from source distribution. -- - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically +- - Use the Tools/pcre-build.sh script to build PCRE2 just for SWIG to statically - link against. Run 'Tools/pcre-build.sh --help' for instructions. -- (quite easy and does not require privileges to install PCRE on your system) +- (quite easy and does not require privileges to install PCRE2 on your system) - - Use configure --without-pcre to disable regular expressions support in SWIG - (not recommended).]) -- ]) -+ PKG_CHECK_MODULES([PCRE], [libpcre], [ +- ], +- [],[],[--libs8]) ++ PKG_CHECK_MODULES([PCRE], [libpcre2], [ + AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library]) + LIBS="$LIBS $PCRE_LIBS" + CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS" diff --git a/poky/meta/recipes-devtools/swig/swig_4.0.2.bb b/poky/meta/recipes-devtools/swig/swig_4.0.2.bb deleted file mode 100644 index 718ad89a5d..0000000000 --- a/poky/meta/recipes-devtools/swig/swig_4.0.2.bb +++ /dev/null @@ -1,7 +0,0 @@ -require ${BPN}.inc - -SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \ - file://0001-configure-use-pkg-config-for-pcre-detection.patch \ - file://determinism.patch \ - " -SRC_URI[sha256sum] = "d53be9730d8d58a16bf0cbd1f8ac0c0c3e1090573168bfa151b01eb47fa906fc" diff --git a/poky/meta/recipes-devtools/swig/swig_4.1.1.bb b/poky/meta/recipes-devtools/swig/swig_4.1.1.bb new file mode 100644 index 0000000000..b9e0175299 --- /dev/null +++ b/poky/meta/recipes-devtools/swig/swig_4.1.1.bb @@ -0,0 +1,7 @@ +require ${BPN}.inc + +SRC_URI += "file://0001-Use-proc-self-exe-for-swig-swiglib-on-non-Win32-plat.patch \ + file://0001-configure-use-pkg-config-for-pcre-detection.patch \ + file://determinism.patch \ + " +SRC_URI[sha256sum] = "2af08aced8fcd65cdb5cc62426768914bedc735b1c250325203716f78e39ac9b" diff --git a/poky/meta/recipes-devtools/tcltk/tcl/alter-includedir.patch b/poky/meta/recipes-devtools/tcltk/tcl/alter-includedir.patch index 5b25af2c0c..96d0ab2ad4 100644 --- a/poky/meta/recipes-devtools/tcltk/tcl/alter-includedir.patch +++ b/poky/meta/recipes-devtools/tcltk/tcl/alter-includedir.patch @@ -1,3 +1,8 @@ +From 27e5595c065ce3af687818555a882ab5e1dfbc2b Mon Sep 17 00:00:00 2001 +From: Mingli Yu +Date: Tue, 22 Nov 2022 18:48:27 +0800 +Subject: [PATCH] tcl: update the header location + Lets install the include header and private header files into usr/include/tcl8.6 when version of tcl is 8.6.x @@ -7,17 +12,22 @@ Signed-off-by: Khem Raj Fixed the TCL_INCLUDE_SPEC +Also update the header location in tcl.pc to correct the header +location in case some package such python3 which use pkg-config +to detect tcl doesn't find the header. + Signed-off-by: Robert Yang Signed-off-by: Yi Zhao +Signed-off-by: Mingli Yu --- - Makefile.in | 2 +- - configure | 4 ++-- - configure.in | 4 ++-- - 3 files changed, 5 insertions(+), 5 deletions(-) + unix/Makefile.in | 2 +- + unix/configure.in | 4 ++-- + unix/tcl.pc.in | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) -diff --git a/Makefile.in b/Makefile.in -index 0370491..daa569a 100644 +diff --git a/unix/Makefile.in b/unix/Makefile.in +index 0b8179f..4824b28 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -57,7 +57,7 @@ SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY) @@ -29,11 +39,11 @@ index 0370491..daa569a 100644 # Path to the private tcl header dir: PRIVATE_INCLUDE_DIR = @PRIVATE_INCLUDE_DIR@ -diff --git a/configure.in b/configure.in -index 9f96e2b..e323e02 100644 +diff --git a/unix/configure.in b/unix/configure.in +index 0354a0b..2d0c00f 100644 --- a/unix/configure.in +++ b/unix/configure.in -@@ -773,7 +773,7 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" +@@ -774,7 +774,7 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" eval "TCL_LIB_FILE=${TCL_LIB_FILE}" test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(libdir)/tcl$(VERSION)' @@ -42,7 +52,7 @@ index 9f96e2b..e323e02 100644 HTML_DIR='$(DISTDIR)/html' # Note: in the following variable, it's important to use the absolute -@@ -894,7 +894,7 @@ TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}" +@@ -895,7 +895,7 @@ TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}" TCL_STUB_LIB_PATH="${TCL_STUB_LIB_DIR}/${TCL_STUB_LIB_FILE}" # Install time header dir can be set via --includedir @@ -51,6 +61,16 @@ index 9f96e2b..e323e02 100644 #------------------------------------------------------------------------ # tclConfig.sh refers to this by a different name --- -2.25.1 - +diff --git a/unix/tcl.pc.in b/unix/tcl.pc.in +index 93b5e69..dcd51d7 100644 +--- a/unix/tcl.pc.in ++++ b/unix/tcl.pc.in +@@ -3,7 +3,7 @@ + prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ +-includedir=@includedir@ ++includedir=@includedir@/tcl@PACKAGE_VERSION@ + libfile=@TCL_LIB_FILE@ + + Name: Tool Command Language diff --git a/poky/meta/recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch b/poky/meta/recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch index 5a10c93a31..6dbef7077f 100644 --- a/poky/meta/recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch +++ b/poky/meta/recipes-devtools/tcltk/tcl/fix_non_native_build_issue.patch @@ -1,10 +1,19 @@ +From 8a6c77cdd265fe7ce35929f58f1ade0c6bc4025b Mon Sep 17 00:00:00 2001 +From: Nitin A Kamble +Date: Fri, 13 Aug 2010 12:24:00 -0700 +Subject: [PATCH] tcl: fix a build issue + Upstream-Status: Inappropriate [upstream does not support installed tests] -Index: unix/Makefile.in -=================================================================== ---- a/unix.orig/Makefile.in 2013-11-10 23:37:34.243424934 -0800 -+++ b/unix/Makefile.in 2013-11-10 23:37:34.243424934 -0800 -@@ -709,23 +709,23 @@ +--- + unix/Makefile.in | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/unix/Makefile.in b/unix/Makefile.in +index b110fe9..d7b35a8 100644 +--- a/unix/Makefile.in ++++ b/unix/Makefile.in +@@ -814,23 +814,23 @@ tcltest-real: test: test-tcl test-packages test-tcl: ${TCLTEST_EXE} @@ -32,7 +41,7 @@ Index: unix/Makefile.in # The following target generates the shared libraries in dltest/ that are used # for testing; they are included as part of the "tcltest" target (via the -@@ -743,23 +743,23 @@ +@@ -848,28 +848,28 @@ dltest.marker: ${STUB_LIB_FILE} # This target can be used to run tclsh from the build directory # via `make shell SCRIPT=/tmp/foo.tcl` shell: ${TCL_EXE} @@ -44,9 +53,14 @@ Index: unix/Makefile.in - $(SHELL_ENV) $(GDB) ./${TCL_EXE} + $(SHELL_ENV) $(GDB) ${TCL_EXE} + lldb: ${TCL_EXE} + $(SHELL_ENV) $(LLDB) ./${TCL_EXE} + valgrind: ${TCL_EXE} ${TCLTEST_EXE} -- $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ./${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl -singleproc 1 -constraints valgrind $(TESTFLAGS) -+ $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ${TCLTEST_EXE} $(TOP_DIR)/tests/all.tcl -singleproc 1 -constraints valgrind $(TESTFLAGS) +- $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ./${TCLTEST_EXE} \ ++ $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ${TCLTEST_EXE} \ + $(TOP_DIR)/tests/all.tcl -singleproc 1 -constraints valgrind \ + $(TESTFLAGS) valgrindshell: ${TCL_EXE} - $(SHELL_ENV) $(VALGRIND) $(VALGRINDARGS) ./${TCL_EXE} $(SCRIPT) diff --git a/poky/meta/recipes-devtools/tcltk/tcl/tcl-add-soname.patch b/poky/meta/recipes-devtools/tcltk/tcl/tcl-add-soname.patch index c4283c4f34..3123d289a1 100644 --- a/poky/meta/recipes-devtools/tcltk/tcl/tcl-add-soname.patch +++ b/poky/meta/recipes-devtools/tcltk/tcl/tcl-add-soname.patch @@ -1,25 +1,21 @@ +From d6155ec08b355d64f1a7db407254d159037bb72a Mon Sep 17 00:00:00 2001 +From: Richard Purdie +Date: Wed, 9 Dec 2009 23:59:44 +0000 +Subject: [PATCH] tcl: Add tcltk from OE.dev but with legacy staging function + Upstream-Status: Pending -Index: unix/tcl.m4 -=================================================================== ---- a/unix.orig/tcl.m4 2013-09-19 13:17:13.000000000 -0700 -+++ b/unix/tcl.m4 2013-11-11 00:17:24.263485123 -0800 -@@ -1415,6 +1415,9 @@ - # get rid of the warnings. - #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" - -+ # following line added by CW for Debian GNU/Linux -+ TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\${TCL_LIB_FILE}.0" -+ - SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' - DL_OBJS="tclLoadDl.o" - DL_LIBS="-ldl" -Index: unix/Makefile.in -=================================================================== ---- a/unix.orig/Makefile.in 2013-09-19 13:17:13.000000000 -0700 -+++ b/unix/Makefile.in 2013-11-11 00:20:32.423489861 -0800 -@@ -796,7 +796,10 @@ - done; +--- + unix/Makefile.in | 5 ++++- + unix/tcl.m4 | 3 +++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/unix/Makefile.in b/unix/Makefile.in +index 398afd0..804532e 100644 +--- a/unix/Makefile.in ++++ b/unix/Makefile.in +@@ -893,7 +893,10 @@ install-binaries: binaries + done @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/" @@INSTALL_LIB@ - @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @@ -30,3 +26,17 @@ Index: unix/Makefile.in @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" +diff --git a/unix/tcl.m4 b/unix/tcl.m4 +index f3d08ec..797c93f 100644 +--- a/unix/tcl.m4 ++++ b/unix/tcl.m4 +@@ -1382,6 +1382,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ + # get rid of the warnings. + #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" + ++ # following line added by CW for Debian GNU/Linux ++ TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\${TCL_LIB_FILE}.0" ++ + SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" diff --git a/poky/meta/recipes-devtools/tcltk/tcl_8.6.11.bb b/poky/meta/recipes-devtools/tcltk/tcl_8.6.11.bb deleted file mode 100644 index f8b2a69b9f..0000000000 --- a/poky/meta/recipes-devtools/tcltk/tcl_8.6.11.bb +++ /dev/null @@ -1,104 +0,0 @@ -SUMMARY = "Tool Command Language" -HOMEPAGE = "http://tcl.sourceforge.net" -DESCRIPTION = "Tool Command Language, is an open-source multi-purpose C library which includes a powerful dynamic scripting language. Together they provide ideal cross-platform development environment for any programming project." -SECTION = "devel/tcltk" - -# http://www.tcl.tk/software/tcltk/license.html -LICENSE = "TCL & BSD-3-Clause" -LIC_FILES_CHKSUM = "file://license.terms;md5=058f6229798281bbcac4239c788cfa38 \ - file://compat/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ - file://library/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ - file://macosx/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ - file://tests/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ - file://win/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ -" - -DEPENDS = "tcl-native zlib" - -BASE_SRC_URI = "${SOURCEFORGE_MIRROR}/tcl/tcl-core${PV}-src.tar.gz \ - file://tcl-add-soname.patch" -SRC_URI = "${BASE_SRC_URI} \ - file://fix_non_native_build_issue.patch \ - file://fix_issue_with_old_distro_glibc.patch \ - file://tcl-remove-hardcoded-install-path.patch \ - file://alter-includedir.patch \ - file://interp.patch \ - file://run-ptest \ -" -SRC_URI[sha256sum] = "cfb49aab82bd179651e23eeeb69606f51b0ddc575ca55c3d35e2457469024cfa" - -SRC_URI:class-native = "${BASE_SRC_URI}" - -# Upstream don't believe this is an exploitable issue -# https://core.tcl-lang.org/tcl/info/7079e4f91601e9c7 -CVE_CHECK_IGNORE += "CVE-2021-35331" - -UPSTREAM_CHECK_URI = "https://www.tcl.tk/software/tcltk/download.html" -UPSTREAM_CHECK_REGEX = "tcl(?P\d+(\.\d+)+)-src" - -S = "${WORKDIR}/${BPN}${PV}" - -VER = "${PV}" - -inherit autotools ptest binconfig - -AUTOTOOLS_SCRIPT_PATH = "${S}/unix" -EXTRA_OECONF = "--enable-threads --disable-rpath --enable-man-suffix" - -do_install() { - autotools_do_install - oe_runmake 'DESTDIR=${D}' install-private-headers - ln -sf ./tclsh${VER} ${D}${bindir}/tclsh - ln -sf tclsh8.6 ${D}${bindir}/tclsh${VER} - sed -i "s;-L${B};-L${STAGING_LIBDIR};g" tclConfig.sh - sed -i "s;'${WORKDIR};'${STAGING_INCDIR};g" tclConfig.sh - install -d ${D}${bindir_crossscripts} - install -m 0755 tclConfig.sh ${D}${bindir_crossscripts} - install -m 0755 tclConfig.sh ${D}${libdir} - for dir in compat generic unix; do - install -d ${D}${includedir}/${BPN}${VER}/$dir - install -m 0644 ${S}/$dir/*.h ${D}${includedir}/${BPN}${VER}/$dir/ - done -} - -SYSROOT_DIRS += "${bindir_crossscripts}" - -PACKAGES =+ "tcl-lib" -FILES:tcl-lib = "${libdir}/libtcl8.6.so.*" -FILES:${PN} += "${libdir}/tcl${VER} ${libdir}/tcl8.6 ${libdir}/tcl8" -FILES:${PN}-dev += "${libdir}/tclConfig.sh ${libdir}/tclooConfig.sh" - -# isn't getting picked up by shlibs code -RDEPENDS:${PN} += "tcl-lib" -RDEPENDS:${PN}-ptest += "libgcc" - -BBCLASSEXTEND = "native nativesdk" - -do_compile_ptest() { - oe_runmake tcltest -} - -do_install_ptest() { - cp ${B}/tcltest ${D}${PTEST_PATH} - cp -r ${S}/library ${D}${PTEST_PATH} - cp -r ${S}/tests ${D}${PTEST_PATH} -} - -# Fix some paths that might be used by Tcl extensions -BINCONFIG_GLOB = "*Config.sh" - -# Fix the path in sstate -SSTATE_SCAN_FILES += "*Config.sh" - -# Cleanup host path from ${libdir}/tclConfig.sh and remove the -# ${bindir_crossscripts}/tclConfig.sh from target -PACKAGE_PREPROCESS_FUNCS += "tcl_package_preprocess" -tcl_package_preprocess() { - sed -i -e "s;${DEBUG_PREFIX_MAP};;g" \ - -e "s;-L${STAGING_LIBDIR};-L${libdir};g" \ - -e "s;${STAGING_INCDIR};${includedir};g" \ - -e "s;--sysroot=${RECIPE_SYSROOT};;g" \ - ${PKGD}${libdir}/tclConfig.sh - - rm -f ${PKGD}${bindir_crossscripts}/tclConfig.sh -} diff --git a/poky/meta/recipes-devtools/tcltk/tcl_8.6.13.bb b/poky/meta/recipes-devtools/tcltk/tcl_8.6.13.bb new file mode 100644 index 0000000000..982f370edb --- /dev/null +++ b/poky/meta/recipes-devtools/tcltk/tcl_8.6.13.bb @@ -0,0 +1,104 @@ +SUMMARY = "Tool Command Language" +HOMEPAGE = "http://tcl.sourceforge.net" +DESCRIPTION = "Tool Command Language, is an open-source multi-purpose C library which includes a powerful dynamic scripting language. Together they provide ideal cross-platform development environment for any programming project." +SECTION = "devel/tcltk" + +# http://www.tcl.tk/software/tcltk/license.html +LICENSE = "TCL & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://compat/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://library/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://macosx/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://tests/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ + file://win/license.terms;md5=058f6229798281bbcac4239c788cfa38 \ +" + +DEPENDS = "tcl-native zlib" + +BASE_SRC_URI = "${SOURCEFORGE_MIRROR}/tcl/tcl-core${PV}-src.tar.gz \ + file://tcl-add-soname.patch" +SRC_URI = "${BASE_SRC_URI} \ + file://fix_non_native_build_issue.patch \ + file://fix_issue_with_old_distro_glibc.patch \ + file://tcl-remove-hardcoded-install-path.patch \ + file://alter-includedir.patch \ + file://interp.patch \ + file://run-ptest \ +" +SRC_URI[sha256sum] = "c61f0d6699e2bc7691f119b41963aaa8dc980f23532c4e937739832a5f4a6642" + +SRC_URI:class-native = "${BASE_SRC_URI}" + +# Upstream don't believe this is an exploitable issue +# https://core.tcl-lang.org/tcl/info/7079e4f91601e9c7 +CVE_CHECK_IGNORE += "CVE-2021-35331" + +UPSTREAM_CHECK_URI = "https://www.tcl.tk/software/tcltk/download.html" +UPSTREAM_CHECK_REGEX = "tcl(?P\d+(\.\d+)+)-src" + +S = "${WORKDIR}/${BPN}${PV}" + +VER = "${PV}" + +inherit autotools ptest binconfig + +AUTOTOOLS_SCRIPT_PATH = "${S}/unix" +EXTRA_OECONF = "--enable-threads --disable-rpath --enable-man-suffix" + +do_install() { + autotools_do_install + oe_runmake 'DESTDIR=${D}' install-private-headers + ln -sf ./tclsh${VER} ${D}${bindir}/tclsh + ln -sf tclsh8.6 ${D}${bindir}/tclsh${VER} + sed -i "s;-L${B};-L${STAGING_LIBDIR};g" tclConfig.sh + sed -i "s;'${WORKDIR};'${STAGING_INCDIR};g" tclConfig.sh + install -d ${D}${bindir_crossscripts} + install -m 0755 tclConfig.sh ${D}${bindir_crossscripts} + install -m 0755 tclConfig.sh ${D}${libdir} + for dir in compat generic unix; do + install -d ${D}${includedir}/${BPN}${VER}/$dir + install -m 0644 ${S}/$dir/*.h ${D}${includedir}/${BPN}${VER}/$dir/ + done +} + +SYSROOT_DIRS += "${bindir_crossscripts}" + +PACKAGES =+ "tcl-lib" +FILES:tcl-lib = "${libdir}/libtcl8.6.so.*" +FILES:${PN} += "${libdir}/tcl${VER} ${libdir}/tcl8.6 ${libdir}/tcl8" +FILES:${PN}-dev += "${libdir}/tclConfig.sh ${libdir}/tclooConfig.sh" + +# isn't getting picked up by shlibs code +RDEPENDS:${PN} += "tcl-lib" +RDEPENDS:${PN}-ptest += "libgcc" + +BBCLASSEXTEND = "native nativesdk" + +do_compile_ptest() { + oe_runmake tcltest +} + +do_install_ptest() { + cp ${B}/tcltest ${D}${PTEST_PATH} + cp -r ${S}/library ${D}${PTEST_PATH} + cp -r ${S}/tests ${D}${PTEST_PATH} +} + +# Fix some paths that might be used by Tcl extensions +BINCONFIG_GLOB = "*Config.sh" + +# Fix the path in sstate +SSTATE_SCAN_FILES += "*Config.sh" + +# Cleanup host path from ${libdir}/tclConfig.sh and remove the +# ${bindir_crossscripts}/tclConfig.sh from target +PACKAGE_PREPROCESS_FUNCS += "tcl_package_preprocess" +tcl_package_preprocess() { + sed -i -e "s;${DEBUG_PREFIX_MAP};;g" \ + -e "s;-L${STAGING_LIBDIR};-L${libdir};g" \ + -e "s;${STAGING_INCDIR};${includedir};g" \ + -e "s;--sysroot=${RECIPE_SYSROOT};;g" \ + ${PKGD}${libdir}/tclConfig.sh + + rm -f ${PKGD}${bindir_crossscripts}/tclConfig.sh +} diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/0001-Add-listen-action-for-a-tcp-socket.patch b/poky/meta/recipes-devtools/unfs3/unfs3/0001-Add-listen-action-for-a-tcp-socket.patch deleted file mode 100644 index e9b9d3df46..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/0001-Add-listen-action-for-a-tcp-socket.patch +++ /dev/null @@ -1,54 +0,0 @@ -From b42ab8e1aca951dd06c113159491b3fd5cf06f2e Mon Sep 17 00:00:00 2001 -From: Haiqing Bai -Date: Thu, 24 Oct 2019 09:39:04 +0800 -Subject: [PATCH] Add "listen" action for a tcp socket which does not call - 'listen' after 'bind' - -It is found that /usr/bin/unfsd customus 100% cpu after starting qemu with 'nfs' -option, and below lots of error messages shows when strace the process: - -poll([{fd=3, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND},{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, -{fd=5, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND},{fd=6, events =POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], -4, 2000) = 2 ([{fd=4, revents=POLLHUP},{fd=6, revents=POLLHUP}]) -accept(4, 0x7ffd5e6dddc0, [128]) = -1 EINVAL (Invalid argument) -accept(6, 0x7ffd5e6dddc0, [128]) = -1 EINVAL (Invalid argument) - -% time seconds usecs/call calls errors syscall ------- ----------- ----------- --------- --------- ---------------- - 70.87 0.005392 0 513886 513886 accept - 29.13 0.002216 0 256943 poll - 0.00 0.000000 0 4 read - -The root cause is that 'listen' is not called for the binded -socket. The depended libtipc does not call 'listen' if found -the incomming socket is binded, so 'accept' reports the error -in the 'for' loop and cpu consumed. - -Upstream-Status: Pending - -Signed-off-by: Haiqing Bai ---- - daemon.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/daemon.c b/daemon.c -index 028a181..4c85903 100644 ---- a/daemon.c -+++ b/daemon.c -@@ -814,6 +814,13 @@ static SVCXPRT *create_tcp_transport(unsigned int port) - fprintf(stderr, "Couldn't bind to tcp port %d\n", port); - exit(1); - } -+ -+ if (listen(sock, SOMAXCONN) < 0) { -+ perror("listen"); -+ fprintf(stderr, "Couldn't listen on the address \n"); -+ close(sock); -+ exit(1); -+ } - } - - transp = svctcp_create(sock, 0, 0); --- -1.9.1 - diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch b/poky/meta/recipes-devtools/unfs3/unfs3/0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch new file mode 100644 index 0000000000..91909fa236 --- /dev/null +++ b/poky/meta/recipes-devtools/unfs3/unfs3/0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch @@ -0,0 +1,28 @@ +From 949db882e487d728c44bb68139682b38396dd275 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 14 Dec 2022 14:50:10 -0800 +Subject: [PATCH] Alias off64_t to off_t on linux if not defined + +Musl C library does not define off64_t and has 64-bit default off_t +therefore define off64_t as an alias on linux as well when configure +detects that off64_t is not provided by a linux system + +Upstream-Status: Submitted [https://github.com/unfs3/unfs3/pull/29] +Signed-off-by: Khem Raj +--- + nfs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nfs.h b/nfs.h +index aded011..7996c67 100644 +--- a/nfs.h ++++ b/nfs.h +@@ -62,7 +62,7 @@ typedef int32_t int32; + #endif + + #ifndef HAVE_OFF64_T +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__linux__) + typedef off_t off64_t; + #endif + #endif diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch b/poky/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch deleted file mode 100644 index 6957d102b8..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/0001-attr-fix-utime-for-symlink.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 3f4fcb62661059bad77a2e957b4621137797bc2f Mon Sep 17 00:00:00 2001 -From: Rui Wang -Date: Fri, 15 Jun 2018 14:19:10 +0800 -Subject: [PATCH] attr: fix utime for symlink - -unfs3 has an old defect that it can not change the timestamps of a -symlink file because it only uses utime(), which will follow the -symlink. This will not cause an error if the symlink points to an -existent file. But under some special situation, such as installing -a rpm package, rpm tool will create the symlink first and try to -modify the timestamps of it, when the target file is non-existent. -This will cause an ESTALE error. Making rpm tool ignore this error -is a solution, but not the best one. An acceptable approach is -Making unfs3 support lutimes(), which can modify the symlink file -itself. Considering not every system support this function, so a -function checking is necessary. - -Upstream-Status: Submitted [https://sourceforge.net/p/unfs3/bugs/12/] - -Signed-off-by: Rui Wang ---- - attr.c | 15 +++++++++++---- - backend_unix.h | 2 ++ - configure.ac | 1 + - 3 files changed, 14 insertions(+), 4 deletions(-) - -diff --git a/attr.c b/attr.c -index 73e5c75..427d0e2 100644 ---- a/attr.c -+++ b/attr.c -@@ -280,7 +280,7 @@ post_op_attr get_post_cached(struct svc_req * req) - static nfsstat3 set_time(const char *path, backend_statstruct buf, sattr3 new) - { - time_t new_atime, new_mtime; -- struct utimbuf utim; -+ struct timeval stamps[2]; - int res; - - /* set atime and mtime */ -@@ -302,10 +302,17 @@ static nfsstat3 set_time(const char *path, backend_statstruct buf, sattr3 new) - else /* DONT_CHANGE */ - new_mtime = buf.st_mtime; - -- utim.actime = new_atime; -- utim.modtime = new_mtime; -+ stamps[0].tv_sec = new_atime; -+ stamps[0].tv_usec = 0; -+ stamps[1].tv_sec = new_mtime; -+ stamps[1].tv_usec = 0; -+ -+#if HAVE_LUTIMES -+ res = backend_lutimes(path, stamps); -+#else -+ res = backend_utimes(path, stamps); -+#endif - -- res = backend_utime(path, &utim); - if (res == -1) - return setattr_err(); - } -diff --git a/backend_unix.h b/backend_unix.h -index fbc2af3..813ffd3 100644 ---- a/backend_unix.h -+++ b/backend_unix.h -@@ -61,6 +61,8 @@ - #define backend_symlink symlink - #define backend_truncate truncate - #define backend_utime utime -+#define backend_utimes utimes -+#define backend_lutimes lutimes - #define backend_statstruct struct stat - #define backend_dirstream DIR - #define backend_statvfsstruct struct statvfs -diff --git a/configure.ac b/configure.ac -index aeec598..ea7f167 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -37,6 +37,7 @@ AC_CHECK_FUNCS(setresuid setresgid) - AC_CHECK_FUNCS(vsyslog) - AC_CHECK_FUNCS(lchown) - AC_CHECK_FUNCS(setgroups) -+AC_CHECK_FUNCS(lutimes) - UNFS3_SOLARIS_RPC - UNFS3_PORTMAP_DEFINE - UNFS3_COMPILE_WARNINGS diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/0001-daemon.c-Fix-race-window-for-writing-of-the-pid-file.patch b/poky/meta/recipes-devtools/unfs3/unfs3/0001-daemon.c-Fix-race-window-for-writing-of-the-pid-file.patch new file mode 100644 index 0000000000..20bbee90a0 --- /dev/null +++ b/poky/meta/recipes-devtools/unfs3/unfs3/0001-daemon.c-Fix-race-window-for-writing-of-the-pid-file.patch @@ -0,0 +1,68 @@ +From 212a947e776e7a25c1f2259615f461179bcb3663 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Wed, 23 Nov 2022 21:38:38 +0100 +Subject: [PATCH] daemon.c: Fix race window for writing of the pid file + +The parent process should write the pid file such that the pid file +will can be checked immediately following exit of the fork from the +parent. + +This allows external monitoring applications to watch the daemon +without having to add sleep calls to wait for the pid file be written +on a busy system. + +Upstream-Status: Submitted [https://github.com/unfs3/unfs3/pull/28] +Signed-off-by: Jason Wessel +Signed-off-by: Alexander Kanavin +--- + daemon.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/daemon.c b/daemon.c +index ff53b7a..13b06a4 100644 +--- a/daemon.c ++++ b/daemon.c +@@ -166,7 +166,7 @@ int get_socket_type(struct svc_req *rqstp) + /* + * write current pid to a file + */ +-static void create_pid_file(void) ++static void create_pid_file(int pid) + { + char buf[16]; + int fd, res, len; +@@ -188,7 +188,7 @@ static void create_pid_file(void) + } + #endif + +- sprintf(buf, "%i\n", backend_getpid()); ++ sprintf(buf, "%i\n", pid); + len = strlen(buf); + + res = backend_pwrite(fd, buf, len, 0); +@@ -1122,6 +1122,10 @@ int main(int argc, char **argv) + fprintf(stderr, "could not fork into background\n"); + daemon_exit(0); + } ++ if (pid) ++ create_pid_file(pid); ++ } else { ++ create_pid_file(backend_getpid()); + } + #endif /* WIN32 */ + +@@ -1161,8 +1165,10 @@ int main(int argc, char **argv) + /* no umask to not screw up create modes */ + umask(0); + ++#ifdef WIN32 + /* create pid file if wanted */ +- create_pid_file(); ++ create_pid_file(backend_getpid()); ++#endif + + /* initialize internal stuff */ + fh_cache_init(); +-- +2.30.2 + diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/0001-daemon.c-Libtirpc-porting-fixes.patch b/poky/meta/recipes-devtools/unfs3/unfs3/0001-daemon.c-Libtirpc-porting-fixes.patch deleted file mode 100644 index 6eee6748f9..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/0001-daemon.c-Libtirpc-porting-fixes.patch +++ /dev/null @@ -1,37 +0,0 @@ -From c7a2a65d6c2a433312540c207860740d6e4e7629 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 11 Mar 2018 17:32:54 -0700 -Subject: [PATCH] daemon.c: Libtirpc porting fixes - -Signed-off-by: Khem Raj ---- -Upstream-Status: Pending - - daemon.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/daemon.c b/daemon.c -index 22f30f6..028a181 100644 ---- a/daemon.c -+++ b/daemon.c -@@ -117,7 +117,7 @@ void logmsg(int prio, const char *fmt, ...) - */ - struct in_addr get_remote(struct svc_req *rqstp) - { -- return (svc_getcaller(rqstp->rq_xprt))->sin_addr; -+ return ((struct sockaddr_in*)svc_getcaller(rqstp->rq_xprt))->sin_addr; - } - - /* -@@ -125,7 +125,7 @@ struct in_addr get_remote(struct svc_req *rqstp) - */ - short get_port(struct svc_req *rqstp) - { -- return (svc_getcaller(rqstp->rq_xprt))->sin_port; -+ return ((struct sockaddr_in*)svc_getcaller(rqstp->rq_xprt))->sin_port; - } - - /* --- -2.16.2 - diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch b/poky/meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch deleted file mode 100644 index ff745d4774..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/alternate_rpc_ports.patch +++ /dev/null @@ -1,158 +0,0 @@ -Add ability to specify rcp port numbers - -In order to run more than one unfs server on a host system, you must -be able to specify alternate rpc port numbers. - -Jason Wessel - -Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/ - ---- - daemon.c | 44 +++++++++++++++++++++++++++++++------------- - mount.c | 4 ++-- - 2 files changed, 33 insertions(+), 15 deletions(-) - ---- a/daemon.c -+++ b/daemon.c -@@ -78,6 +78,8 @@ int opt_testconfig = FALSE; - struct in_addr opt_bind_addr; - int opt_readable_executables = FALSE; - char *opt_pid_file = NULL; -+int nfs_prog = NFS3_PROGRAM; -+int mount_prog = MOUNTPROG; - - /* Register with portmapper? */ - int opt_portmapper = TRUE; -@@ -206,7 +208,7 @@ static void parse_options(int argc, char - { - - int opt = 0; -- char *optstring = "bcC:de:hl:m:n:prstTuwi:"; -+ char *optstring = "bcC:de:hl:m:n:prstTuwi:x:y:"; - - while (opt != -1) { - opt = getopt(argc, argv, optstring); -@@ -261,8 +263,24 @@ static void parse_options(int argc, char - printf - ("\t-r report unreadable executables as readable\n"); - printf("\t-T test exports file and exit\n"); -+ printf("\t-x alternate NFS RPC port\n"); -+ printf("\t-y alternate MOUNTD RPC port\n"); - exit(0); - break; -+ case 'x': -+ nfs_prog = strtol(optarg, NULL, 10); -+ if (nfs_prog == 0) { -+ fprintf(stderr, "Invalid NFS RPC port\n"); -+ exit(1); -+ } -+ break; -+ case 'y': -+ mount_prog = strtol(optarg, NULL, 10); -+ if (mount_prog == 0) { -+ fprintf(stderr, "Invalid MOUNTD RPC port\n"); -+ exit(1); -+ } -+ break; - case 'l': - opt_bind_addr.s_addr = inet_addr(optarg); - if (opt_bind_addr.s_addr == (unsigned) -1) { -@@ -347,12 +365,12 @@ void daemon_exit(int error) - #endif /* WIN32 */ - - if (opt_portmapper) { -- svc_unregister(MOUNTPROG, MOUNTVERS1); -- svc_unregister(MOUNTPROG, MOUNTVERS3); -+ svc_unregister(mount_prog, MOUNTVERS1); -+ svc_unregister(mount_prog, MOUNTVERS3); - } - - if (opt_portmapper) { -- svc_unregister(NFS3_PROGRAM, NFS_V3); -+ svc_unregister(nfs_prog, NFS_V3); - } - - if (error == SIGSEGV) -@@ -657,13 +675,13 @@ static void mountprog_3(struct svc_req * - static void register_nfs_service(SVCXPRT * udptransp, SVCXPRT * tcptransp) - { - if (opt_portmapper) { -- pmap_unset(NFS3_PROGRAM, NFS_V3); -+ pmap_unset(nfs_prog, NFS_V3); - } - - if (udptransp != NULL) { - /* Register NFS service for UDP */ - if (!svc_register -- (udptransp, NFS3_PROGRAM, NFS_V3, nfs3_program_3, -+ (udptransp, nfs_prog, NFS_V3, nfs3_program_3, - opt_portmapper ? IPPROTO_UDP : 0)) { - fprintf(stderr, "%s\n", - "unable to register (NFS3_PROGRAM, NFS_V3, udp)."); -@@ -674,7 +692,7 @@ static void register_nfs_service(SVCXPRT - if (tcptransp != NULL) { - /* Register NFS service for TCP */ - if (!svc_register -- (tcptransp, NFS3_PROGRAM, NFS_V3, nfs3_program_3, -+ (tcptransp, nfs_prog, NFS_V3, nfs3_program_3, - opt_portmapper ? IPPROTO_TCP : 0)) { - fprintf(stderr, "%s\n", - "unable to register (NFS3_PROGRAM, NFS_V3, tcp)."); -@@ -686,14 +704,14 @@ static void register_nfs_service(SVCXPRT - static void register_mount_service(SVCXPRT * udptransp, SVCXPRT * tcptransp) - { - if (opt_portmapper) { -- pmap_unset(MOUNTPROG, MOUNTVERS1); -- pmap_unset(MOUNTPROG, MOUNTVERS3); -+ pmap_unset(mount_prog, MOUNTVERS1); -+ pmap_unset(mount_prog, MOUNTVERS3); - } - - if (udptransp != NULL) { - /* Register MOUNT service (v1) for UDP */ - if (!svc_register -- (udptransp, MOUNTPROG, MOUNTVERS1, mountprog_3, -+ (udptransp, mount_prog, MOUNTVERS1, mountprog_3, - opt_portmapper ? IPPROTO_UDP : 0)) { - fprintf(stderr, "%s\n", - "unable to register (MOUNTPROG, MOUNTVERS1, udp)."); -@@ -702,7 +720,7 @@ static void register_mount_service(SVCXP - - /* Register MOUNT service (v3) for UDP */ - if (!svc_register -- (udptransp, MOUNTPROG, MOUNTVERS3, mountprog_3, -+ (udptransp, mount_prog, MOUNTVERS3, mountprog_3, - opt_portmapper ? IPPROTO_UDP : 0)) { - fprintf(stderr, "%s\n", - "unable to register (MOUNTPROG, MOUNTVERS3, udp)."); -@@ -713,7 +731,7 @@ static void register_mount_service(SVCXP - if (tcptransp != NULL) { - /* Register MOUNT service (v1) for TCP */ - if (!svc_register -- (tcptransp, MOUNTPROG, MOUNTVERS1, mountprog_3, -+ (tcptransp, mount_prog, MOUNTVERS1, mountprog_3, - opt_portmapper ? IPPROTO_TCP : 0)) { - fprintf(stderr, "%s\n", - "unable to register (MOUNTPROG, MOUNTVERS1, tcp)."); -@@ -722,7 +740,7 @@ static void register_mount_service(SVCXP - - /* Register MOUNT service (v3) for TCP */ - if (!svc_register -- (tcptransp, MOUNTPROG, MOUNTVERS3, mountprog_3, -+ (tcptransp, mount_prog, MOUNTVERS3, mountprog_3, - opt_portmapper ? IPPROTO_TCP : 0)) { - fprintf(stderr, "%s\n", - "unable to register (MOUNTPROG, MOUNTVERS3, tcp)."); ---- a/mount.c -+++ b/mount.c -@@ -155,8 +155,8 @@ mountres3 *mountproc_mnt_3_svc(dirpath * - /* error out if not version 3 */ - if (rqstp->rq_vers != 3) { - logmsg(LOG_INFO, -- "%s attempted mount with unsupported protocol version", -- inet_ntoa(get_remote(rqstp))); -+ "%s attempted mount with unsupported protocol version: %i", -+ inet_ntoa(get_remote(rqstp)), rqstp->rq_vers); - result.fhs_status = MNT3ERR_INVAL; - return &result; - } diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/fix_compile_warning.patch b/poky/meta/recipes-devtools/unfs3/unfs3/fix_compile_warning.patch deleted file mode 100644 index aada014117..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/fix_compile_warning.patch +++ /dev/null @@ -1,25 +0,0 @@ -daemon.c: Check exit code of chdir() - -Stop the compile warning and fix the code to act on a chdir() failure. -If this one does fail something is very, very wrong. - -Signed-off-by: Jason Wessel - -Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/ - ---- - daemon.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/daemon.c -+++ b/daemon.c -@@ -964,7 +964,8 @@ int main(int argc, char **argv) - sigaction(SIGALRM, &act, NULL); - - /* don't make directory we started in busy */ -- chdir("/"); -+ if(chdir("/") < 0) -+ daemon_exit(0); - - /* detach from terminal */ - if (opt_detach) { diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch b/poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch deleted file mode 100644 index 46b187e5f3..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/fix_pid_race_parent_writes_child_pid.patch +++ /dev/null @@ -1,61 +0,0 @@ -daemon.c: Fix race window for writing of the pid file - -The parent process should write the pid file such that the pid file -will can be checked immediately following exit of the fork from the -parent. - -This allows external monitoring applications to watch the daemon -without having to add sleep calls to wait for the pid file be written -on a busy system. - -Signed-off-by: Jason Wessel - -Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/ - ---- - daemon.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/daemon.c -+++ b/daemon.c -@@ -153,7 +153,7 @@ int get_socket_type(struct svc_req *rqst - /* - * write current pid to a file - */ --static void create_pid_file(void) -+static void create_pid_file(int pid) - { - char buf[16]; - int fd, res, len; -@@ -175,7 +175,7 @@ static void create_pid_file(void) - } - #endif - -- sprintf(buf, "%i\n", backend_getpid()); -+ sprintf(buf, "%i\n", pid); - len = strlen(buf); - - res = backend_pwrite(fd, buf, len, 0); -@@ -970,6 +970,10 @@ int main(int argc, char **argv) - fprintf(stderr, "could not fork into background\n"); - daemon_exit(0); - } -+ if (pid) -+ create_pid_file(pid); -+ } else { -+ create_pid_file(backend_getpid()); - } - #endif /* WIN32 */ - -@@ -1006,8 +1010,10 @@ int main(int argc, char **argv) - /* no umask to not screw up create modes */ - umask(0); - -+#ifdef WIN32 - /* create pid file if wanted */ -- create_pid_file(); -+ create_pid_file(backend_getpid()); -+#endif - - /* initialize internal stuff */ - fh_cache_init(); diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/no-yywrap.patch b/poky/meta/recipes-devtools/unfs3/unfs3/no-yywrap.patch deleted file mode 100644 index e3496814d8..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/no-yywrap.patch +++ /dev/null @@ -1,14 +0,0 @@ -Upstream-Status: Backport [https://github.com/unfs3/unfs3/commit/3fa0568e6ef96e045286afe18444bc28fe93962b] - -diff --git a/Config/exports.l b/Config/exports.l -index 662603c..7e7c4fc 100644 ---- a/Config/exports.l -+++ b/Config/exports.l -@@ -50,6 +50,7 @@ OLDNET {IP}"/"{IP} - - %option nounput - %option noinput -+%option noyywrap - - %% - diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch b/poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch deleted file mode 100644 index 219dd35aec..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/relative_max_socket_path_len.patch +++ /dev/null @@ -1,74 +0,0 @@ -nfs.c: Allow max sa.sun_path for a localdomain socket with the user nfs-server - -There is a hard limit for the kernel of 108 characters for a -localdomain socket name. To avoid problems with the user nfs -server it should maximize the number of characters by using -a relative path on the server side. - -Previously the nfs-server used the absolute path name passed to -the sa.sunpath arg for binding the socket and this has caused -problems for both the X server and UST binaries which make -heavy use of named sockets with long names. - -Signed-off-by: Jason Wessel - -Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/ - ---- - nfs.c | 29 +++++++++++++++++++++++++++-- - 1 file changed, 27 insertions(+), 2 deletions(-) - ---- a/nfs.c -+++ b/nfs.c -@@ -672,6 +672,7 @@ SYMLINK3res *nfsproc3_symlink_3_svc(SYML - } - - #ifndef WIN32 -+static char pathbuf_tmp[NFS_MAXPATHLEN + NFS_MAXNAMLEN + 1]; - - /* - * create Unix socket -@@ -680,17 +681,41 @@ static int mksocket(const char *path, mo - { - int res, sock; - struct sockaddr_un addr; -+ unsigned int len = strlen(path); - - sock = socket(PF_UNIX, SOCK_STREAM, 0); -- addr.sun_family = AF_UNIX; -- strcpy(addr.sun_path, path); - res = sock; - if (res != -1) { -+ addr.sun_family = AF_UNIX; -+ if (len < sizeof(addr.sun_path) -1) { -+ strcpy(addr.sun_path, path); -+ } else { -+ char *ptr; -+ res = -1; -+ if (len >= sizeof(path)) -+ goto out; -+ strcpy(pathbuf_tmp, path); -+ ptr = strrchr(pathbuf_tmp,'/'); -+ if (ptr) { -+ *ptr = '\0'; -+ ptr++; -+ if (chdir(pathbuf_tmp)) -+ goto out; -+ } else { -+ ptr = pathbuf_tmp; -+ } -+ if (strlen(ptr) >= sizeof(addr.sun_path)) -+ goto out; -+ strcpy(addr.sun_path, ptr); -+ } - umask(~mode); - res = - bind(sock, (struct sockaddr *) &addr, - sizeof(addr.sun_family) + strlen(addr.sun_path)); - umask(0); -+out: -+ if (chdir("/")) -+ fprintf(stderr, "Internal failure to chdir /\n"); - close(sock); - } - return res; diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch b/poky/meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch deleted file mode 100644 index e6d89530f8..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/rename_fh_cache.patch +++ /dev/null @@ -1,64 +0,0 @@ -From: Jason Wessel -Date: Sat, 23 Feb 2013 08:49:08 -0600 -Subject: [PATCH] fh_cache: fix statle nfs handle on rename problem - -The following test case fails with modern linunx kernels which cache -the renamed inode. - - % mkdir a;mkdir b;mv b a/;ls -l a - ls: a/b: Stale NFS file handle - -The issue is that nfserver was not updating the fh_cache with the new -location of the inode, when it moves directories. - -Signed-off-by: Jason Wessel - -Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/ - ---- - fh_cache.c | 12 ++++++++++++ - fh_cache.h | 1 + - nfs.c | 2 ++ - 3 files changed, 15 insertions(+) - ---- a/fh_cache.c -+++ b/fh_cache.c -@@ -199,6 +199,18 @@ static char *fh_cache_lookup(uint32 dev, - } - - /* -+ * update a fh inode cache for an operation like rename -+ */ -+void fh_cache_update(nfs_fh3 fh, char *path) -+{ -+ unfs3_fh_t *obj = (void *) fh.data.data_val; -+ backend_statstruct buf; -+ -+ if (backend_lstat(path, &buf) != -1) { -+ fh_cache_add(obj->dev, buf.st_ino, path); -+ } -+} -+/* - * resolve a filename into a path - * cache-using wrapper for fh_decomp_raw - */ ---- a/fh_cache.h -+++ b/fh_cache.h -@@ -19,5 +19,6 @@ unfs3_fh_t fh_comp(const char *path, str - unfs3_fh_t *fh_comp_ptr(const char *path, struct svc_req *rqstp, int need_dir); - - char *fh_cache_add(uint32 dev, uint64 ino, const char *path); -+void fh_cache_update(nfs_fh3 fh, char *path); - - #endif ---- a/nfs.c -+++ b/nfs.c -@@ -876,6 +876,8 @@ RENAME3res *nfsproc3_rename_3_svc(RENAME - res = backend_rename(from_obj, to_obj); - if (res == -1) - result.status = rename_err(); -+ /* Update the fh_cache with moved inode value */ -+ fh_cache_update(argp->to.dir, to_obj); - } - } - diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/tcp_no_delay.patch b/poky/meta/recipes-devtools/unfs3/unfs3/tcp_no_delay.patch deleted file mode 100644 index b3521c63eb..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/tcp_no_delay.patch +++ /dev/null @@ -1,56 +0,0 @@ -daemon.c: Add option for tcp no delay - -Allow the NFS tcp sockets to conditionally use TCP_NODELAY - -Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/ - ---- - daemon.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/daemon.c -+++ b/daemon.c -@@ -17,6 +17,7 @@ - #ifndef WIN32 - #include - #include -+#include - #include - #include - #else /* WIN32 */ -@@ -75,6 +76,7 @@ unsigned int opt_mount_port = NFS_PORT; - int opt_singleuser = FALSE; - int opt_brute_force = FALSE; - int opt_testconfig = FALSE; -+int opt_tcp_nodelay = FALSE; - struct in_addr opt_bind_addr; - int opt_readable_executables = FALSE; - char *opt_pid_file = NULL; -@@ -208,7 +210,7 @@ static void parse_options(int argc, char - { - - int opt = 0; -- char *optstring = "bcC:de:hl:m:n:prstTuwi:x:y:"; -+ char *optstring = "bcC:de:hl:m:Nn:prstTuwi:x:y:"; - - while (opt != -1) { - opt = getopt(argc, argv, optstring); -@@ -295,6 +297,9 @@ static void parse_options(int argc, char - exit(1); - } - break; -+ case 'N': -+ opt_tcp_nodelay = TRUE; -+ break; - case 'n': - opt_nfs_port = strtol(optarg, NULL, 10); - if (opt_nfs_port == 0) { -@@ -802,6 +807,8 @@ static SVCXPRT *create_tcp_transport(uns - sin.sin_addr.s_addr = opt_bind_addr.s_addr; - sock = socket(PF_INET, SOCK_STREAM, 0); - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on)); -+ if (opt_tcp_nodelay) -+ setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)); - if (bind(sock, (struct sockaddr *) &sin, sizeof(struct sockaddr))) { - perror("bind"); - fprintf(stderr, "Couldn't bind to tcp port %d\n", port); diff --git a/poky/meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch b/poky/meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch deleted file mode 100644 index 6f64dd5b3e..0000000000 --- a/poky/meta/recipes-devtools/unfs3/unfs3/unfs3_parallel_build.patch +++ /dev/null @@ -1,37 +0,0 @@ -Fix parallel build dependency issue - -If building with make -j2 the lib.a will not get built in time. - -Jason Wessel - -Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/ - ---- - Config/Makefile.in | 3 +++ - Makefile.in | 3 ++- - 2 files changed, 5 insertions(+), 1 deletion(-) - ---- a/Makefile.in -+++ b/Makefile.in -@@ -29,7 +29,8 @@ DESTDIR = - - VPATH = $(srcdir) - --all: subdirs unfsd$(EXEEXT) -+all: subdirs -+ $(MAKE) unfsd$(EXEEXT) - - unfsd$(EXEEXT): $(OBJS) $(CONFOBJ) $(EXTRAOBJ) - $(CC) -o $@ $(OBJS) $(CONFOBJ) $(EXTRAOBJ) $(LDFLAGS) ---- a/Config/Makefile.in -+++ b/Config/Makefile.in -@@ -16,6 +16,9 @@ lib.a: $(OBJS) - $(AR) crs lib.a $(OBJS) - - y.tab.h y.tab.c: $(srcdir)/exports.y -+y.tab.h: y.tab.c -+ -+y.tab.c: $(srcdir)/exports.y - $(YACC) -d $(srcdir)/exports.y - - y.tab.o: y.tab.c $(srcdir)/exports.h $(top_srcdir)/nfs.h $(top_srcdir)/mount.h $(top_srcdir)/daemon.h diff --git a/poky/meta/recipes-devtools/unfs3/unfs3_git.bb b/poky/meta/recipes-devtools/unfs3/unfs3_git.bb index 66016a2949..a4701bdb57 100644 --- a/poky/meta/recipes-devtools/unfs3/unfs3_git.bb +++ b/poky/meta/recipes-devtools/unfs3/unfs3_git.bb @@ -11,35 +11,17 @@ DEPENDS = "flex-native bison-native flex" DEPENDS += "libtirpc" DEPENDS:append:class-nativesdk = " flex-nativesdk" -ASNEEDED = "" - S = "${WORKDIR}/git" SRC_URI = "git://github.com/unfs3/unfs3.git;protocol=https;branch=master \ - file://unfs3_parallel_build.patch \ - file://alternate_rpc_ports.patch \ - file://fix_pid_race_parent_writes_child_pid.patch \ - file://fix_compile_warning.patch \ - file://rename_fh_cache.patch \ - file://relative_max_socket_path_len.patch \ - file://tcp_no_delay.patch \ - file://0001-daemon.c-Libtirpc-porting-fixes.patch \ - file://0001-attr-fix-utime-for-symlink.patch \ - file://0001-Add-listen-action-for-a-tcp-socket.patch \ - file://no-yywrap.patch \ - " -SRCREV = "c12a5c69a8d59be6916cbd0e0f41c159f1962425" + file://0001-daemon.c-Fix-race-window-for-writing-of-the-pid-file.patch \ + file://0001-Alias-off64_t-to-off_t-on-linux-if-not-defined.patch \ + " +SRCREV = "c8f2d2cd4529955419bad0e163f88d47ff176b8d" UPSTREAM_CHECK_GITTAGREGEX = "unfs3\-(?P\d+(\.\d+)+)" -PV = "0.9.22+${SRCPV}" +PV = "0.10.0" BBCLASSEXTEND = "native nativesdk" -inherit autotools +inherit autotools pkgconfig EXTRA_OECONF:append:class-native = " --sbindir=${bindir}" -CFLAGS:append = " -I${STAGING_INCDIR}/tirpc" -EXTRA_OECONF:append = " LIBS=-ltirpc" - -# Turn off these header detects else the inode search -# will walk entire file systems and this is a real problem -# if you have 2 TB of files to walk in your file system -CACHED_CONFIGUREVARS = "ac_cv_header_mntent_h=no ac_cv_header_sys_mnttab_h=no" diff --git a/poky/meta/recipes-devtools/unifdef/unifdef_2.12.bb b/poky/meta/recipes-devtools/unifdef/unifdef_2.12.bb index b42051b8b6..3e08b3a0a4 100644 --- a/poky/meta/recipes-devtools/unifdef/unifdef_2.12.bb +++ b/poky/meta/recipes-devtools/unifdef/unifdef_2.12.bb @@ -18,4 +18,4 @@ do_install() { oe_runmake install DESTDIR=${D} prefix=${prefix} } -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 b/poky/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 index 887bfd2766..4477f39132 100644 --- a/poky/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 +++ b/poky/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 @@ -1,211 +1,7 @@ -gdbserver_tests/hgtls -cachegrind/tests/ann1 -callgrind/tests/simwork1 -callgrind/tests/simwork2 -callgrind/tests/simwork3 -callgrind/tests/simwork-both -callgrind/tests/simwork-cache -callgrind/tests/threads -callgrind/tests/threads-use -drd/tests/annotate_barrier -drd/tests/annotate_barrier_xml -drd/tests/annotate_hbefore -drd/tests/annotate_hb_err -drd/tests/annotate_hb_race -drd/tests/annotate_ignore_read -drd/tests/annotate_ignore_rw -drd/tests/annotate_ignore_rw2 -drd/tests/annotate_ignore_write -drd/tests/annotate_ignore_write2 -drd/tests/annotate_order_1 -drd/tests/annotate_order_2 -drd/tests/annotate_order_3 -drd/tests/annotate_publish_hg -drd/tests/annotate_rwlock -drd/tests/annotate_rwlock_hg -drd/tests/annotate_sem -drd/tests/annotate_smart_pointer -drd/tests/annotate_smart_pointer2 -drd/tests/annotate_spinlock -drd/tests/annotate_static -drd/tests/annotate_trace_memory -drd/tests/annotate_trace_memory_xml -drd/tests/atomic_var -drd/tests/bar_bad -drd/tests/bar_trivial drd/tests/boost_thread -drd/tests/bug-235681 -drd/tests/bug322621 -drd/tests/circular_buffer -drd/tests/concurrent_close -drd/tests/custom_alloc -drd/tests/custom_alloc_fiw -drd/tests/dlopen -drd/tests/fork-parallel -drd/tests/fork-serial -drd/tests/fp_race -drd/tests/fp_race2 -drd/tests/fp_race_xml -drd/tests/free_is_write -drd/tests/free_is_write2 -drd/tests/hg01_all_ok -drd/tests/hg02_deadlock -drd/tests/hg03_inherit -drd/tests/hg04_race -drd/tests/hg05_race2 -drd/tests/hg06_readshared -drd/tests/hold_lock_1 -drd/tests/hold_lock_2 -drd/tests/linuxthreads_det -drd/tests/matinv -drd/tests/memory_allocation -drd/tests/monitor_example -drd/tests/new_delete -drd/tests/pth_barrier -drd/tests/pth_barrier2 -drd/tests/pth_barrier3 -drd/tests/pth_barrier_race -drd/tests/pth_barrier_reinit -drd/tests/pth_broadcast -drd/tests/pth_cancel_locked -drd/tests/pth_cleanup_handler -drd/tests/pth_cond_race -drd/tests/pth_cond_race2 -drd/tests/pth_detached2 -drd/tests/pth_detached3 -drd/tests/pth_detached_sem -drd/tests/pth_inconsistent_cond_wait -drd/tests/pth_mutex_reinit -drd/tests/pth_once -drd/tests/pth_process_shared_mutex -drd/tests/pth_spinlock -drd/tests/pth_uninitialized_cond -drd/tests/read_and_free_race -drd/tests/recursive_mutex -drd/tests/rwlock_race -drd/tests/rwlock_test -drd/tests/rwlock_type_checking -drd/tests/sem_as_mutex -drd/tests/sem_as_mutex2 -drd/tests/sem_as_mutex3 -drd/tests/sem_open -drd/tests/sem_open2 -drd/tests/sem_open3 -drd/tests/sem_open_traced -drd/tests/sem_wait -drd/tests/sigalrm -drd/tests/sigaltstack -drd/tests/std_atomic -drd/tests/std_string -drd/tests/std_thread -drd/tests/std_thread2 -drd/tests/str_tester -drd/tests/tc01_simple_race -drd/tests/tc02_simple_tls -drd/tests/tc03_re_excl -drd/tests/tc04_free_lock -drd/tests/tc05_simple_race -drd/tests/tc06_two_races -drd/tests/tc07_hbl1 -drd/tests/tc08_hbl2 -drd/tests/tc10_rec_lock -drd/tests/tc11_XCHG -drd/tests/tc12_rwl_trivial -drd/tests/tc13_laog1 -drd/tests/tc15_laog_lockdel -drd/tests/tc16_byterace -drd/tests/tc17_sembar -drd/tests/tc18_semabuse -drd/tests/tc19_shadowmem -drd/tests/tc21_pthonce -drd/tests/tc22_exit_w_lock -drd/tests/tc23_bogus_condwait -helgrind/tests/annotate_rwlock -helgrind/tests/annotate_smart_pointer -helgrind/tests/bar_bad -helgrind/tests/bar_trivial -helgrind/tests/bug322621 -helgrind/tests/cond_init_destroy -helgrind/tests/cond_timedwait_invalid -helgrind/tests/cond_timedwait_test -helgrind/tests/free_is_write -helgrind/tests/hg01_all_ok -helgrind/tests/hg03_inherit -helgrind/tests/hg04_race -helgrind/tests/hg05_race2 -helgrind/tests/hg06_readshared -helgrind/tests/locked_vs_unlocked1_fwd -helgrind/tests/locked_vs_unlocked1_rev -helgrind/tests/locked_vs_unlocked2 -helgrind/tests/locked_vs_unlocked3 -helgrind/tests/pth_barrier1 -helgrind/tests/pth_barrier2 -helgrind/tests/pth_barrier3 -helgrind/tests/pth_destroy_cond -helgrind/tests/rwlock_race -helgrind/tests/rwlock_test -helgrind/tests/shmem_abits -helgrind/tests/stackteardown -helgrind/tests/t2t_laog -helgrind/tests/tc01_simple_race -helgrind/tests/tc02_simple_tls -helgrind/tests/tc03_re_excl -helgrind/tests/tc04_free_lock -helgrind/tests/tc05_simple_race -helgrind/tests/tc06_two_races -helgrind/tests/tc06_two_races_xml -helgrind/tests/tc07_hbl1 -helgrind/tests/tc08_hbl2 -helgrind/tests/tc09_bad_unlock -helgrind/tests/tc10_rec_lock -helgrind/tests/tc11_XCHG -helgrind/tests/tc12_rwl_trivial -helgrind/tests/tc13_laog1 -helgrind/tests/tc14_laog_dinphils -helgrind/tests/tc15_laog_lockdel -helgrind/tests/tc16_byterace -helgrind/tests/tc17_sembar -helgrind/tests/tc18_semabuse -helgrind/tests/tc19_shadowmem -helgrind/tests/tc20_verifywrap -helgrind/tests/tc21_pthonce -helgrind/tests/tc22_exit_w_lock -helgrind/tests/tc23_bogus_condwait -helgrind/tests/tc24_nonzero_sem -memcheck/tests/accounting -memcheck/tests/addressable -memcheck/tests/arm64-linux/scalar -memcheck/tests/atomic_incs -memcheck/tests/badaddrvalue -memcheck/tests/badfree -memcheck/tests/badfree-2trace -memcheck/tests/badfree3 -memcheck/tests/badjump -memcheck/tests/badjump2 -memcheck/tests/badloop -memcheck/tests/badpoll -memcheck/tests/badrw -memcheck/tests/big_blocks_freed_list -memcheck/tests/brk2 +gdbserver_tests/hgtls memcheck/tests/dw4 -memcheck/tests/err_disable4 -memcheck/tests/err_disable_arange1 -memcheck/tests/leak-autofreepool-5 -memcheck/tests/linux/lsframe1 -memcheck/tests/linux/lsframe2 -memcheck/tests/linux/with-space -memcheck/tests/origin5-bz2 -memcheck/tests/origin6-fp -memcheck/tests/partial_load_dflt -memcheck/tests/pdb-realloc2 -memcheck/tests/sh-mem -memcheck/tests/sh-mem-random -memcheck/tests/sigaltstack -memcheck/tests/sigkill -memcheck/tests/signal2 -memcheck/tests/threadname -memcheck/tests/threadname_xml -memcheck/tests/unit_oset +memcheck/tests/leak_cpp_interior memcheck/tests/varinfo1 memcheck/tests/varinfo2 memcheck/tests/varinfo3 @@ -213,21 +9,5 @@ memcheck/tests/varinfo4 memcheck/tests/varinfo5 memcheck/tests/varinfo6 memcheck/tests/varinforestrict -memcheck/tests/vcpu_bz2 -memcheck/tests/vcpu_fbench -memcheck/tests/vcpu_fnfns -memcheck/tests/wcs -memcheck/tests/wrap1 -memcheck/tests/wrap2 -memcheck/tests/wrap3 -memcheck/tests/wrap4 -memcheck/tests/wrap5 -memcheck/tests/wrap6 -memcheck/tests/wrap7 -memcheck/tests/wrap8 -memcheck/tests/wrapmalloc -memcheck/tests/wrapmallocstatic -memcheck/tests/writev1 -memcheck/tests/xml1 -memcheck/tests/linux/stack_changes -memcheck/tests/linux/timerfd-syscall +helgrind/tests/hg05_race2 +helgrind/tests/tc20_verifywrap diff --git a/poky/meta/recipes-devtools/valgrind/valgrind_3.20.0.bb b/poky/meta/recipes-devtools/valgrind/valgrind_3.20.0.bb index cd9c4d9fe9..1e1f0ccdd3 100644 --- a/poky/meta/recipes-devtools/valgrind/valgrind_3.20.0.bb +++ b/poky/meta/recipes-devtools/valgrind/valgrind_3.20.0.bb @@ -242,6 +242,15 @@ do_install_ptest() { install ${S}/none/tests/tls.c ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/none/tests/ } +do_install_ptest:append:x86-64 () { + # https://bugs.kde.org/show_bug.cgi?id=463456 + rm ${D}${PTEST_PATH}/memcheck/tests/origin6-fp.vgtest + # https://bugs.kde.org/show_bug.cgi?id=463458 + rm ${D}${PTEST_PATH}/memcheck/tests/vcpu_fnfns.vgtest + # https://bugs.kde.org/show_bug.cgi?id=463463 + rm ${D}${PTEST_PATH}/none/tests/amd64/fma.vgtest +} + # avoid stripping some generated binaries otherwise some of the tests will fail # run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail INHIBIT_PACKAGE_STRIP_FILES += "\ diff --git a/poky/meta/recipes-extended/at/at_3.2.5.bb b/poky/meta/recipes-extended/at/at_3.2.5.bb index 87a436173f..c0c876a644 100644 --- a/poky/meta/recipes-extended/at/at_3.2.5.bb +++ b/poky/meta/recipes-extended/at/at_3.2.5.bb @@ -52,8 +52,10 @@ INITSCRIPT_PARAMS = "defaults" SYSTEMD_SERVICE:${PN} = "atd.service" -do_configure:prepend() { - cp -f ${WORKDIR}/posixtm.[ch] ${S} +do_patch[postfuncs] += "copy_posix_files" + +copy_posix_files() { + cp -f ${WORKDIR}/posixtm.[ch] ${S} } do_install () { diff --git a/poky/meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb b/poky/meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb new file mode 100644 index 0000000000..82b2901d51 --- /dev/null +++ b/poky/meta/recipes-extended/baremetal-example/baremetal-helloworld_git.bb @@ -0,0 +1,72 @@ +SUMMARY = "Baremetal examples to work with the several QEMU architectures supported on OpenEmbedded" +HOMEPAGE = "https://github.com/aehs29/baremetal-helloqemu" +DESCRIPTION = "These are introductory examples to showcase the use of QEMU to run baremetal applications." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=39346640a23c701e4f459e05f56f4449" + +SRCREV = "22016ecbb9fb6c5f3a7a06698aea7ff8a701c166" +PV = "0.1+git${SRCPV}" + +SRC_URI = "git://github.com/aehs29/baremetal-helloqemu.git;protocol=https;branch=master" +UPSTREAM_VERSION_UNKNOWN="1" + +S = "${WORKDIR}/git" + +# The following variables should be set to accomodate each application +BAREMETAL_BINNAME ?= "hello_baremetal_${MACHINE}" +IMAGE_LINK_NAME ?= "baremetal-helloworld-image-${MACHINE}" +IMAGE_NAME_SUFFIX ?= "" + +# Baremetal-Image creates the proper wiring, assumes the output is provided in +# binary and ELF format, installed on ${base_libdir}/firmware/ , we want a +# package to be created since we might have some way of updating the baremetal +# firmware from Linux +inherit baremetal-image + + +# startup code for x86 uses NASM syntax +DEPENDS:qemux86:append = " nasm-native" + +# These parameters are app specific for this example +# This will be translated automatically to the architecture and +# machine that QEMU uses on OE, e.g. -machine virt -cpu cortex-a57 +# but the examples can also be run on other architectures/machines +# such as vexpress-a15 by overriding the setting on the machine.conf +COMPATIBLE_MACHINE = "qemuarmv5|qemuarm|qemuarm64|qemuriscv64|qemuriscv32|qemux86|qemux86-64" + +BAREMETAL_QEMUARCH ?= "" +BAREMETAL_QEMUARCH:qemuarmv5 = "versatile" +BAREMETAL_QEMUARCH:qemuarm = "arm" +BAREMETAL_QEMUARCH:qemuarm64 = "aarch64" +BAREMETAL_QEMUARCH:qemuriscv64 = "riscv64" +BAREMETAL_QEMUARCH:qemuriscv32 = "riscv32" +BAREMETAL_QEMUARCH:qemux86 = "x86" +BAREMETAL_QEMUARCH:qemux86-64 = "x86-64" + +EXTRA_OEMAKE:append = " QEMUARCH=${BAREMETAL_QEMUARCH} V=1" + +# qemux86-64 uses a different Makefile +do_compile:prepend:qemux86-64(){ + cd x86-64 +} + +# Install binaries on the proper location for baremetal-image to fetch and deploy +do_install(){ + install -d ${D}/${base_libdir}/firmware + install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.bin ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin + install -m 755 ${B}/build/hello_baremetal_${BAREMETAL_QEMUARCH}.elf ${D}/${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf +} + +FILES:${PN} += " \ + ${base_libdir}/firmware/${BAREMETAL_BINNAME}.bin \ + ${base_libdir}/firmware/${BAREMETAL_BINNAME}.elf \ +" + +# qemux86-64 boots from iso rather than -kernel, create image to boot from +do_image:append:qemux86-64(){ + dd if=/dev/zero of=${B}/build/img.iso bs=1M count=10 status=none + dd if=${B}/build/stage1.bin of=${B}/build/img.iso bs=512 count=1 conv=notrunc + dd if=${B}/build/stage2.bin of=${B}/build/img.iso bs=512 seek=1 count=64 conv=notrunc + dd if=${B}/build/hello_baremetal_x86-64.bin of=${B}/build/img.iso bs=512 seek=65 conv=notrunc + install ${B}/build/img.iso ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.iso +} diff --git a/poky/meta/recipes-extended/bash/bash_5.2.15.bb b/poky/meta/recipes-extended/bash/bash_5.2.15.bb new file mode 100644 index 0000000000..f78f79fcc5 --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash_5.2.15.bb @@ -0,0 +1,22 @@ +require bash.inc + +# GPL-2.0-or-later (< 4.0), GPL-3.0-or-later (>= 4.0) +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \ + file://mkbuiltins_have_stringize.patch \ + file://build-tests.patch \ + file://test-output.patch \ + file://run-ptest \ + file://run-bash-ptests \ + file://fix-run-builtins.patch \ + file://use_aclocal.patch \ + " + +SRC_URI[tarball.sha256sum] = "13720965b5f4fc3a0d4b61dd37e7565c741da9a5be24edc2ae00182fc1b3588c" + +DEBUG_OPTIMIZATION:append:armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" +DEBUG_OPTIMIZATION:append:armv5 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" + +BBCLASSEXTEND = "nativesdk" diff --git a/poky/meta/recipes-extended/bash/bash_5.2.9.bb b/poky/meta/recipes-extended/bash/bash_5.2.9.bb deleted file mode 100644 index 39a5d3de86..0000000000 --- a/poky/meta/recipes-extended/bash/bash_5.2.9.bb +++ /dev/null @@ -1,22 +0,0 @@ -require bash.inc - -# GPL-2.0-or-later (< 4.0), GPL-3.0-or-later (>= 4.0) -LICENSE = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \ - file://mkbuiltins_have_stringize.patch \ - file://build-tests.patch \ - file://test-output.patch \ - file://run-ptest \ - file://run-bash-ptests \ - file://fix-run-builtins.patch \ - file://use_aclocal.patch \ - " - -SRC_URI[tarball.sha256sum] = "68d978264253bc933d692f1de195e2e5b463a3984dfb4e5504b076865f16b6dd" - -DEBUG_OPTIMIZATION:append:armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" -DEBUG_OPTIMIZATION:append:armv5 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" - -BBCLASSEXTEND = "nativesdk" diff --git a/poky/meta/recipes-extended/bc/bc_1.07.1.bb b/poky/meta/recipes-extended/bc/bc_1.07.1.bb index 178588f11b..819da6cda6 100644 --- a/poky/meta/recipes-extended/bc/bc_1.07.1.bb +++ b/poky/meta/recipes-extended/bc/bc_1.07.1.bb @@ -37,4 +37,4 @@ do_install_ptest() { ALTERNATIVE:${PN} = "bc dc" ALTERNATIVE_PRIORITY = "100" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/cronie/cronie_1.6.1.bb b/poky/meta/recipes-extended/cronie/cronie_1.6.1.bb index 078187534e..1b31bf0db2 100644 --- a/poky/meta/recipes-extended/cronie/cronie_1.6.1.bb +++ b/poky/meta/recipes-extended/cronie/cronie_1.6.1.bb @@ -35,6 +35,7 @@ PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit," PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam,${PAM_DEPS}" PACKAGECONFIG[anacron] = "--enable-anacron,--disable-anacron,anacron" +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" INITSCRIPT_NAME = "crond" INITSCRIPT_PARAMS = "start 90 2 3 4 5 . stop 60 0 1 6 ." diff --git a/poky/meta/recipes-extended/gawk/gawk/remove-sensitive-tests.patch b/poky/meta/recipes-extended/gawk/gawk/remove-sensitive-tests.patch index 167c0787ee..ffae55058b 100644 --- a/poky/meta/recipes-extended/gawk/gawk/remove-sensitive-tests.patch +++ b/poky/meta/recipes-extended/gawk/gawk/remove-sensitive-tests.patch @@ -1,24 +1,43 @@ +From 354d24baf7c51977d22ff61ad42e6a2cbd4dc8ac Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Tue, 21 Dec 2021 17:09:12 +0000 +Subject: [PATCH] gawk: remove load-sensitive tests + These tests require an unloaded host as otherwise timing sensitive tests can fail https://bugzilla.yoctoproject.org/show_bug.cgi?id=14371 Upstream-Status: Inappropriate Signed-off-by: Ross Burton ---- a/test/Maketests~ -+++ b/test/Maketests -@@ -2069,7 +2069,2 @@ +--- + test/Maketests | 10 ---------- + 1 file changed, 10 deletions(-) +diff --git a/test/Maketests b/test/Maketests +index 3a667af..f117697 100644 +--- a/test/Maketests ++++ b/test/Maketests +@@ -2137,11 +2137,6 @@ symtab12: + @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + -timeout: - @echo $@ $(ZOS_FAIL) -- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ +- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - typedregex1: -@@ -2297,7 +2292,2 @@ + @echo $@ + @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ +@@ -2371,11 +2366,6 @@ rwarray: + @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -- + -time: - @echo $@ -- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ +- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - +- + mpfrbigint: + @echo $@ + @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk -M >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/poky/meta/recipes-extended/gawk/gawk/run-ptest b/poky/meta/recipes-extended/gawk/gawk/run-ptest index f67a95874f..2675650600 100644 --- a/poky/meta/recipes-extended/gawk/gawk/run-ptest +++ b/poky/meta/recipes-extended/gawk/gawk/run-ptest @@ -2,7 +2,7 @@ cd test for i in `grep -E "^[a-z0-9_-]*:$" Maketests |awk -F: '{print $1}'`; do - #LC_ALL=${GAWKLOCALE:-C} LANG=${GAWKLOCALE:-C} + unset LANG srcdir=`pwd` AWKPROG=gawk AWK=gawk CMP=cmp make -f Maketests $i >$i.tmp 2>&1 if [ -e _$i ]; then cat _$i diff --git a/poky/meta/recipes-extended/gawk/gawk_5.1.1.bb b/poky/meta/recipes-extended/gawk/gawk_5.1.1.bb deleted file mode 100644 index fe339805d0..0000000000 --- a/poky/meta/recipes-extended/gawk/gawk_5.1.1.bb +++ /dev/null @@ -1,64 +0,0 @@ -SUMMARY = "GNU awk text processing utility" -DESCRIPTION = "The GNU version of awk, a text processing utility. \ -Awk interprets a special-purpose programming language to do \ -quick and easy text pattern matching and reformatting jobs." -HOMEPAGE = "https://www.gnu.org/software/gawk/" -BUGTRACKER = "bug-gawk@gnu.org" -SECTION = "console/utils" - -# gawk <= 3.1.5: GPL-2.0-only -# gawk >= 3.1.6: GPL-3.0-only -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -PACKAGECONFIG ??= "readline" -PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" -PACKAGECONFIG[mpfr] = "--with-mpfr,--without-mpfr, mpfr" - -SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \ - file://remove-sensitive-tests.patch \ - file://run-ptest \ - " - -SRC_URI[sha256sum] = "6168d8d1dc8f74bd17d9dc22fa9634c49070f232343b744901da15fb4f06bffd" - -inherit autotools gettext texinfo update-alternatives - -FILES:${PN} += "${datadir}/awk" -FILES:${PN}-dev += "${libdir}/${BPN}/*.la" - -ALTERNATIVE:${PN} = "awk" -ALTERNATIVE_TARGET[awk] = "${bindir}/gawk" -ALTERNATIVE_PRIORITY = "100" - -do_install:append() { - # remove the link since we don't package it - rm ${D}${bindir}/awk -} - -inherit ptest - -do_install_ptest() { - mkdir ${D}${PTEST_PATH}/test - ln -s ${bindir}/gawk ${D}${PTEST_PATH}/gawk - # The list of tests is all targets in Maketests, apart from the dummy Gt-dummy - TESTS=$(awk -F: '$1 == "Gt-dummy" { next } /[[:alnum:]]+:$/ { print $1 }' ${S}/test/Maketests) - for i in $TESTS Maketests inclib.awk; do - cp ${S}/test/$i* ${D}${PTEST_PATH}/test - done - sed -i -e 's|/usr/local/bin|${bindir}|g' \ - -e 's|#!${base_bindir}/awk|#!${bindir}/awk|g' ${D}${PTEST_PATH}/test/*.awk - - sed -i -e "s|GAWKLOCALE|LANG|g" ${D}${PTEST_PATH}/test/Maketests - - # These tests require an unloaded host as otherwise timing sensitive tests can fail - # https://bugzilla.yoctoproject.org/show_bug.cgi?id=14371 - rm -f ${D}${PTEST_PATH}/test/time.* - rm -f ${D}${PTEST_PATH}/test/timeout.* -} - -RDEPENDS:${PN}-ptest += "make" - -RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-en-us.iso-8859-1" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/gawk/gawk_5.2.1.bb b/poky/meta/recipes-extended/gawk/gawk_5.2.1.bb new file mode 100644 index 0000000000..fbe6e7040b --- /dev/null +++ b/poky/meta/recipes-extended/gawk/gawk_5.2.1.bb @@ -0,0 +1,69 @@ +SUMMARY = "GNU awk text processing utility" +DESCRIPTION = "The GNU version of awk, a text processing utility. \ +Awk interprets a special-purpose programming language to do \ +quick and easy text pattern matching and reformatting jobs." +HOMEPAGE = "https://www.gnu.org/software/gawk/" +BUGTRACKER = "bug-gawk@gnu.org" +SECTION = "console/utils" + +# gawk <= 3.1.5: GPL-2.0-only +# gawk >= 3.1.6: GPL-3.0-only +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +PACKAGECONFIG ??= "readline" +PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" +PACKAGECONFIG[mpfr] = "--with-mpfr,--without-mpfr, mpfr" + +SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \ + file://remove-sensitive-tests.patch \ + file://run-ptest \ + " + +SRC_URI[sha256sum] = "529e7c8c6acf21ff3a6183f4d763c632810908989c24675c77995d51ac37b79c" + +inherit autotools gettext texinfo update-alternatives + +FILES:${PN} += "${datadir}/awk" +FILES:${PN}-dev += "${libdir}/${BPN}/*.la" + +PACKAGES =+ "${PN}-gawkbug" +FILES:${PN}-gawkbug += "${bindir}/gawkbug" + +ALTERNATIVE:${PN} = "awk" +ALTERNATIVE_TARGET[awk] = "${bindir}/gawk" +ALTERNATIVE_PRIORITY = "100" + +do_install:append() { + # remove the link since we don't package it + rm ${D}${bindir}/awk + # Strip non-reproducible build flags (containing build paths) + sed -i -e 's|^CC.*|CC=""|g' -e 's|^CFLAGS.*|CFLAGS=""|g' ${D}${bindir}/gawkbug +} + +inherit ptest + +do_install_ptest() { + mkdir ${D}${PTEST_PATH}/test + ln -s ${bindir}/gawk ${D}${PTEST_PATH}/gawk + # The list of tests is all targets in Maketests, apart from the dummy Gt-dummy + TESTS=$(awk -F: '$1 == "Gt-dummy" { next } /[[:alnum:]]+:$/ { print $1 }' ${S}/test/Maketests) + for i in $TESTS Maketests inclib.awk; do + cp ${S}/test/$i* ${D}${PTEST_PATH}/test + done + sed -i \ + -e 's|#!${base_bindir}/awk|#!${bindir}/awk|g' ${D}${PTEST_PATH}/test/*.awk + + sed -i -e "s|GAWKLOCALE|LANG|g" ${D}${PTEST_PATH}/test/Maketests + + # These tests require an unloaded host as otherwise timing sensitive tests can fail + # https://bugzilla.yoctoproject.org/show_bug.cgi?id=14371 + rm -f ${D}${PTEST_PATH}/test/time.* + rm -f ${D}${PTEST_PATH}/test/timeout.* +} + +RDEPENDS:${PN}-ptest += "make" + +RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-en-us.iso-8859-1" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch b/poky/meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch deleted file mode 100644 index a9afb9948c..0000000000 --- a/poky/meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 2adaa7366064a8f18af864eda74e52877a89620c Mon Sep 17 00:00:00 2001 -From: Hongxu Jia -Date: Mon, 18 Jan 2016 01:00:30 -0500 -Subject: [PATCH] configure.ac: do not check local png source - -In oe-core, it did not need to compile local libpng -source in ghostscript, so do not check local png -source, and directly check the existance of shared -libpng library. - -Upstream-Status: Inappropriate [OE-Core specific] - -Signed-off-by: Hongxu Jia - ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 698abd3..e65ac8b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1241,7 +1241,7 @@ else - PNGDEVS='' - PNGDEVS_ALL='png48 png16m pnggray pngmono pngmonod png256 png16 pngalpha' - AC_MSG_CHECKING([for local png library source]) -- if test -f $srcdir/libpng/pngread.c; then -+ if false; then - AC_MSG_RESULT([yes]) - SHARE_LIBPNG=0 - LIBPNGDIR=$srcdir/libpng diff --git a/poky/meta/recipes-extended/ghostscript/ghostscript/cross-compile.patch b/poky/meta/recipes-extended/ghostscript/ghostscript/cross-compile.patch new file mode 100644 index 0000000000..ba62820df1 --- /dev/null +++ b/poky/meta/recipes-extended/ghostscript/ghostscript/cross-compile.patch @@ -0,0 +1,40 @@ +From 4c3575346b9c7d394ebc73b4e5fabebadd8877ec Mon Sep 17 00:00:00 2001 +From: Chris Liddell +Date: Thu, 24 Nov 2022 16:33:47 +0000 +Subject: [PATCH] Fix a little bitrot in the cross-compiling logic + +Removing the option to disable FAPI meant configuring for cross compiling would +fail because the option being passed to the sub-call to configure would include +an unknown command line option. + +Upstream-Status: Backport [https://git.ghostscript.com/?p=ghostpdl.git;a=patch;f=configure.ac;h=4c3575346b9c7d394ebc73b4e5fabebadd8877ec] +Signed-off-by: Alexander Kanavin +--- + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index d5c68c4b3..738eb10a9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -138,7 +138,7 @@ if test x"$host" != x"$build" ; then + echo $AUXFLAGS_MAK_LINE07 >> $AUXFLAGS_MAK.in + + AC_MSG_NOTICE([Begin recursive call to configure script (for auxiliary tools)]) +- "$absolute_source_path/configure" CC="$CCAUX" CFLAGS="$CFLAGSAUX" CPPFLAGS="$CPPFLAGSAUX" LDFLAGS="$LDFLAGSAUX" CCAUX= CFLAGSAUX= CFLAGSAUX= MAKEFILE=$AUXFLAGS_MAK --host=$build --build=$build --enable-auxtools_only --disable-hidden-visibility --with-local-zlib --without-libtiff --disable-contrib --disable-fontconfig --disable-dbus --disable-freetype --disable-fapi --disable-cups --disable-openjpeg --disable-gtk --with-libiconv=no --without-libidn --without-libpaper --without-pdftoraster --without-ijs --without-jbig2dec --without-x --with-drivers="" ++ "$absolute_source_path/configure" CC="$CCAUX" CFLAGS="$CFLAGSAUX" CPPFLAGS="$CPPFLAGSAUX" LDFLAGS="$LDFLAGSAUX" CCAUX= CFLAGSAUX= CFLAGSAUX= MAKEFILE=$AUXFLAGS_MAK --host=$build --build=$build --enable-auxtools_only --disable-hidden-visibility --with-local-zlib --without-libtiff --disable-contrib --disable-fontconfig --disable-dbus --disable-freetype --disable-cups --disable-openjpeg --disable-gtk --with-libiconv=no --without-libidn --without-libpaper --without-pdftoraster --without-ijs --without-jbig2dec --without-x --with-drivers="" + status=$? + cp config.log "$olddir/configaux.log" + if test $status -eq 0 ; then +@@ -2530,7 +2530,7 @@ PDF= + PDF_MAK="\$(GLSRCDIR)\$(D)stub.mak" + PDFROMFS_MAK="\$(GLSRCDIR)\$(D)stub.mak" + +-if test x"$with_pdf" != x"no" ; then ++if test x"$with_pdf" != x"no" -a x"$enable_auxtools_only" != x"yes" ; then + + if test x"$JBIG2_DECODER" = x""; then + AC_MSG_ERROR([No JBIG2 decoder available, required for PDF support]) +-- +2.25.1 + diff --git a/poky/meta/recipes-extended/ghostscript/ghostscript/do-not-check-local-libpng-source.patch b/poky/meta/recipes-extended/ghostscript/ghostscript/do-not-check-local-libpng-source.patch new file mode 100644 index 0000000000..13e71c824f --- /dev/null +++ b/poky/meta/recipes-extended/ghostscript/ghostscript/do-not-check-local-libpng-source.patch @@ -0,0 +1,31 @@ +From 108a7d3f79af8c669af129bd87401402e76edfa9 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Mon, 18 Jan 2016 01:00:30 -0500 +Subject: [PATCH] configure.ac: do not check local png source + +In oe-core, it did not need to compile local libpng +source in ghostscript, so do not check local png +source, and directly check the existance of shared +libpng library. + +Upstream-Status: Inappropriate [OE-Core specific] + +Signed-off-by: Hongxu Jia + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index bb57825..389c473 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1441,7 +1441,7 @@ else + PNGDEVS='' + PNGDEVS_ALL='png48 png16m pnggray pngmono pngmonod png256 png16 pngalpha png16malpha' + AC_MSG_CHECKING([for local png library source]) +- if test -f $srcdir/libpng/pngread.c; then ++ if false; then + AC_MSG_RESULT([yes]) + SHARE_LIBPNG=0 + LIBPNGDIR=$srcdir/libpng diff --git a/poky/meta/recipes-extended/ghostscript/ghostscript_10.0.0.bb b/poky/meta/recipes-extended/ghostscript/ghostscript_10.0.0.bb new file mode 100644 index 0000000000..56a93632e2 --- /dev/null +++ b/poky/meta/recipes-extended/ghostscript/ghostscript_10.0.0.bb @@ -0,0 +1,129 @@ +SUMMARY = "The GPL Ghostscript PostScript/PDF interpreter" +DESCRIPTION = "Ghostscript is used for PostScript/PDF preview and printing. Usually as \ +a back-end to a program such as ghostview, it can display PostScript and PDF \ +documents in an X11 environment. \ +\ +Furthermore, it can render PostScript and PDF files as graphics to be printed \ +on non-PostScript printers. Supported printers include common \ +dot-matrix, inkjet and laser models. \ +" +HOMEPAGE = "http://www.ghostscript.com" +SECTION = "console/utils" + +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://LICENSE;md5=f98ffa763e50cded76f49bce73aade16" + +DEPENDS = "ghostscript-native tiff jpeg fontconfig cups libpng" +DEPENDS:class-native = "libpng-native" + +UPSTREAM_CHECK_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases" +UPSTREAM_CHECK_REGEX = "(?P\d+(\.\d+)+)\.tar" + +# As of ghostscript 9.54.0 the jpeg issue in the CVE is present in the gs jpeg sources +# however we use an external jpeg which doesn't have the issue. +CVE_CHECK_IGNORE += "CVE-2013-6629" + +def gs_verdir(v): + return "".join(v.split(".")) + + +SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${@gs_verdir("${PV}")}/${BPN}-${PV}.tar.gz \ + file://ghostscript-9.15-parallel-make.patch \ + file://ghostscript-9.16-Werror-return-type.patch \ + file://do-not-check-local-libpng-source.patch \ + file://avoid-host-contamination.patch \ + file://mkdir-p.patch \ + file://cross-compile.patch \ +" + +SRC_URI = "${SRC_URI_BASE} \ + file://cups-no-gcrypt.patch \ + " + +SRC_URI:class-native = "${SRC_URI_BASE} \ + file://ghostscript-9.21-native-fix-disable-system-libtiff.patch \ + file://base-genht.c-add-a-preprocessor-define-to-allow-fope.patch \ + " + +SRC_URI[sha256sum] = "a57764d70caf85e2fc0b0f59b83b92e25775631714dcdb97cc6e0cea414bb5a3" + +# Put something like +# +# PACKAGECONFIG:append:pn-ghostscript = " x11" +# +# in local.conf to enable building with X11. Be careful. The order +# of the overrides matters! +# +#PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" +PACKAGECONFIG:class-native = "" + +PACKAGECONFIG[x11] = "--with-x --x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR}, \ + --without-x, virtual/libx11 libxext libxt gtk+3\ + " + +EXTRA_OECONF = "--without-libpaper --with-system-libtiff --with-jbig2dec \ + --with-fontpath=${datadir}/fonts \ + --without-libidn --with-cups-serverbin=${exec_prefix}/lib/cups \ + --with-cups-datadir=${datadir}/cups \ + CUPSCONFIG="${STAGING_BINDIR_CROSS}/cups-config" \ + " + +EXTRA_OECONF:append:mipsarcho32 = " --with-large_color_index=0" + +# Explicity disable libtiff, fontconfig, +# freetype, cups for ghostscript-native +EXTRA_OECONF:class-native = "--without-x --with-system-libtiff=no \ + --without-libpaper \ + --with-fontpath=${datadir}/fonts \ + --without-libidn --disable-fontconfig \ + --enable-freetype --disable-cups " + +# This has been fixed upstream but for now we need to subvert the check for time.h +# http://bugs.ghostscript.com/show_bug.cgi?id=692443 +# http://bugs.ghostscript.com/show_bug.cgi?id=692426 +CFLAGS += "-DHAVE_SYS_TIME_H=1" +BUILD_CFLAGS += "-DHAVE_SYS_TIME_H=1" + +inherit autotools-brokensep + +do_configure:prepend:class-target () { + rm -rf ${S}/jpeg/ +} + +do_configure:append () { + # copy tools from the native ghostscript build + if [ "${PN}" != "ghostscript-native" ]; then + mkdir -p obj/aux soobj + for i in genarch genconf mkromfs echogs gendev genht packps; do + cp ${STAGING_BINDIR_NATIVE}/ghostscript-${PV}/$i obj/aux/$i + done + fi +} + +do_install:append () { + mkdir -p ${D}${datadir}/ghostscript/${PV}/ + cp -r ${S}/Resource ${D}${datadir}/ghostscript/${PV}/ + cp -r ${S}/iccprofiles ${D}${datadir}/ghostscript/${PV}/ +} + +do_compile:class-native () { + mkdir -p obj + for i in genarch genconf mkromfs echogs gendev genht packps; do + oe_runmake obj/aux/$i + done +} + +do_install:class-native () { + install -d ${D}${bindir}/ghostscript-${PV} + for i in genarch genconf mkromfs echogs gendev genht packps; do + install -m 755 obj/aux/$i ${D}${bindir}/ghostscript-${PV}/$i + done +} + +BBCLASSEXTEND = "native" + +# ghostscript does not supports "arc" +COMPATIBLE_HOST = "^(?!arc).*" + +# some entries in NVD uses gpl_ghostscript +CVE_PRODUCT = "ghostscript gpl_ghostscript" diff --git a/poky/meta/recipes-extended/ghostscript/ghostscript_9.56.1.bb b/poky/meta/recipes-extended/ghostscript/ghostscript_9.56.1.bb deleted file mode 100644 index e71a6cc0d3..0000000000 --- a/poky/meta/recipes-extended/ghostscript/ghostscript_9.56.1.bb +++ /dev/null @@ -1,128 +0,0 @@ -SUMMARY = "The GPL Ghostscript PostScript/PDF interpreter" -DESCRIPTION = "Ghostscript is used for PostScript/PDF preview and printing. Usually as \ -a back-end to a program such as ghostview, it can display PostScript and PDF \ -documents in an X11 environment. \ -\ -Furthermore, it can render PostScript and PDF files as graphics to be printed \ -on non-PostScript printers. Supported printers include common \ -dot-matrix, inkjet and laser models. \ -" -HOMEPAGE = "http://www.ghostscript.com" -SECTION = "console/utils" - -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://LICENSE;md5=f98ffa763e50cded76f49bce73aade16" - -DEPENDS = "ghostscript-native tiff jpeg fontconfig cups libpng" -DEPENDS:class-native = "libpng-native" - -UPSTREAM_CHECK_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases" -UPSTREAM_CHECK_REGEX = "(?P\d+(\.\d+)+)\.tar" - -# As of ghostscript 9.54.0 the jpeg issue in the CVE is present in the gs jpeg sources -# however we use an external jpeg which doesn't have the issue. -CVE_CHECK_IGNORE += "CVE-2013-6629" - -def gs_verdir(v): - return "".join(v.split(".")) - - -SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${@gs_verdir("${PV}")}/${BPN}-${PV}.tar.gz \ - file://ghostscript-9.15-parallel-make.patch \ - file://ghostscript-9.16-Werror-return-type.patch \ - file://do-not-check-local-libpng-source.patch \ - file://avoid-host-contamination.patch \ - file://mkdir-p.patch \ -" - -SRC_URI = "${SRC_URI_BASE} \ - file://cups-no-gcrypt.patch \ - " - -SRC_URI:class-native = "${SRC_URI_BASE} \ - file://ghostscript-9.21-native-fix-disable-system-libtiff.patch \ - file://base-genht.c-add-a-preprocessor-define-to-allow-fope.patch \ - " - -SRC_URI[sha256sum] = "1598b9a38659cce8448d42a73054b2f9cbfcc40a9b97eeec5f22d4d6cd1de8e6" - -# Put something like -# -# PACKAGECONFIG:append:pn-ghostscript = " x11" -# -# in local.conf to enable building with X11. Be careful. The order -# of the overrides matters! -# -#PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}" -PACKAGECONFIG:class-native = "" - -PACKAGECONFIG[x11] = "--with-x --x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR}, \ - --without-x, virtual/libx11 libxext libxt gtk+3\ - " - -EXTRA_OECONF = "--without-libpaper --with-system-libtiff --with-jbig2dec \ - --with-fontpath=${datadir}/fonts \ - --without-libidn --with-cups-serverbin=${exec_prefix}/lib/cups \ - --with-cups-datadir=${datadir}/cups \ - CUPSCONFIG="${STAGING_BINDIR_CROSS}/cups-config" \ - " - -EXTRA_OECONF:append:mipsarcho32 = " --with-large_color_index=0" - -# Explicity disable libtiff, fontconfig, -# freetype, cups for ghostscript-native -EXTRA_OECONF:class-native = "--without-x --with-system-libtiff=no \ - --without-jbig2dec --without-libpaper \ - --with-fontpath=${datadir}/fonts \ - --without-libidn --disable-fontconfig \ - --enable-freetype --disable-cups " - -# This has been fixed upstream but for now we need to subvert the check for time.h -# http://bugs.ghostscript.com/show_bug.cgi?id=692443 -# http://bugs.ghostscript.com/show_bug.cgi?id=692426 -CFLAGS += "-DHAVE_SYS_TIME_H=1" -BUILD_CFLAGS += "-DHAVE_SYS_TIME_H=1" - -inherit autotools-brokensep - -do_configure:prepend:class-target () { - rm -rf ${S}/jpeg/ -} - -do_configure:append () { - # copy tools from the native ghostscript build - if [ "${PN}" != "ghostscript-native" ]; then - mkdir -p obj/aux soobj - for i in genarch genconf mkromfs echogs gendev genht packps; do - cp ${STAGING_BINDIR_NATIVE}/ghostscript-${PV}/$i obj/aux/$i - done - fi -} - -do_install:append () { - mkdir -p ${D}${datadir}/ghostscript/${PV}/ - cp -r ${S}/Resource ${D}${datadir}/ghostscript/${PV}/ - cp -r ${S}/iccprofiles ${D}${datadir}/ghostscript/${PV}/ -} - -do_compile:class-native () { - mkdir -p obj - for i in genarch genconf mkromfs echogs gendev genht packps; do - oe_runmake obj/aux/$i - done -} - -do_install:class-native () { - install -d ${D}${bindir}/ghostscript-${PV} - for i in genarch genconf mkromfs echogs gendev genht packps; do - install -m 755 obj/aux/$i ${D}${bindir}/ghostscript-${PV}/$i - done -} - -BBCLASSEXTEND = "native" - -# ghostscript does not supports "arc" -COMPATIBLE_HOST = "^(?!arc).*" - -# some entries in NVD uses gpl_ghostscript -CVE_PRODUCT = "ghostscript gpl_ghostscript" diff --git a/poky/meta/recipes-extended/gperf/gperf_3.1.bb b/poky/meta/recipes-extended/gperf/gperf_3.1.bb index c9f09c7931..4c32a5dc83 100644 --- a/poky/meta/recipes-extended/gperf/gperf_3.1.bb +++ b/poky/meta/recipes-extended/gperf/gperf_3.1.bb @@ -17,4 +17,4 @@ inherit autotools # it where to look explicitly (mirroring the behaviour of upstream's Makefile.devel). EXTRA_AUTORECONF += " -I ${S} --exclude=aclocal" -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/iputils/iputils/0001-rarpd-rdisc-Drop-PrivateUsers.patch b/poky/meta/recipes-extended/iputils/iputils/0001-rarpd-rdisc-Drop-PrivateUsers.patch deleted file mode 100644 index c61e39dc80..0000000000 --- a/poky/meta/recipes-extended/iputils/iputils/0001-rarpd-rdisc-Drop-PrivateUsers.patch +++ /dev/null @@ -1,27 +0,0 @@ -From dfeeb3f1328d09f516edeb6349bd63e3c87f9397 Mon Sep 17 00:00:00 2001 -From: Alex Kiernan -Date: Thu, 13 Feb 2020 06:08:45 +0000 -Subject: [PATCH] rarpd:Drop PrivateUsers - -rarpd cannot gain the necessary capabilities with -PrivateUsers enabled. - -Upstream-Status: Pending -Signed-off-by: Alex Kiernan - ---- - systemd/rarpd.service.in | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/systemd/rarpd.service.in b/systemd/rarpd.service.in -index e600c10..f5d7621 100644 ---- a/systemd/rarpd.service.in -+++ b/systemd/rarpd.service.in -@@ -12,7 +12,6 @@ AmbientCapabilities=CAP_NET_RAW - DynamicUser=yes - PrivateTmp=yes - PrivateDevices=yes --PrivateUsers=yes - ProtectSystem=strict - ProtectHome=yes - ProtectControlGroups=yes diff --git a/poky/meta/recipes-extended/iputils/iputils_20211215.bb b/poky/meta/recipes-extended/iputils/iputils_20211215.bb deleted file mode 100644 index 3ddce0be54..0000000000 --- a/poky/meta/recipes-extended/iputils/iputils_20211215.bb +++ /dev/null @@ -1,66 +0,0 @@ -SUMMARY = "Network monitoring tools" -DESCRIPTION = "Utilities for the IP protocol, including \ -tracepath, tracepath6, ping, ping6 and arping." -HOMEPAGE = "https://github.com/iputils/iputils" -SECTION = "console/network" - -LICENSE = "BSD-3-Clause & GPL-2.0-or-later" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=bb64c89bb0e23b72930d2380894c47a1" - -DEPENDS = "gnutls" - -SRC_URI = "git://github.com/iputils/iputils;branch=master;protocol=https \ - file://0001-rarpd-rdisc-Drop-PrivateUsers.patch \ - " -SRCREV = "1d1e7c43210d8af316a41cb2c53d612a4c16f34d" - -S = "${WORKDIR}/git" - -UPSTREAM_CHECK_GITTAGREGEX = "(?P20\d+)" - -# Fixed in 2000-10-10, but the versioning of iputils -# breaks the version order. -CVE_CHECK_IGNORE += "CVE-2000-1213 CVE-2000-1214" - -PACKAGECONFIG ??= "libcap rarpd \ - ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ninfod', '', d)} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" -PACKAGECONFIG[libcap] = "-DUSE_CAP=true, -DUSE_CAP=false -DNO_SETCAP_OR_SUID=true, libcap libcap-native" -PACKAGECONFIG[libidn] = "-DUSE_IDN=true, -DUSE_IDN=false, libidn2" -PACKAGECONFIG[gettext] = "-DUSE_GETTEXT=true, -DUSE_GETTEXT=false, gettext" -PACKAGECONFIG[ninfod] = "-DBUILD_NINFOD=true,-DBUILD_NINFOD=false," -PACKAGECONFIG[rarpd] = "-DBUILD_RARPD=true,-DBUILD_RARPD=false," -PACKAGECONFIG[systemd] = "-Dsystemdunitdir=${systemd_system_unitdir},,systemd" -PACKAGECONFIG[docs] = "-DBUILD_HTML_MANS=true -DBUILD_MANS=true,-DBUILD_HTML_MANS=false -DBUILD_MANS=false, libxslt" - -inherit meson systemd update-alternatives pkgconfig - -EXTRA_OEMESON += "--prefix=${root_prefix}/ -DSKIP_TESTS=true" - -ALTERNATIVE_PRIORITY = "100" - -ALTERNATIVE:${PN}-ping = "ping" -ALTERNATIVE_LINK_NAME[ping] = "${base_bindir}/ping" - -SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-clockdiff ${PN}-rdisc \ - ${@bb.utils.contains('PACKAGECONFIG', 'rarpd', '${PN}-rarpd', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', '${PN}-ninfod', '', d)}" -PACKAGES += "${SPLITPKGS}" - -ALLOW_EMPTY:${PN} = "1" -RDEPENDS:${PN} += "${SPLITPKGS}" - -FILES:${PN} = "" -FILES:${PN}-ping = "${base_bindir}/ping.${BPN}" -FILES:${PN}-arping = "${base_bindir}/arping" -FILES:${PN}-tracepath = "${base_bindir}/tracepath" -FILES:${PN}-clockdiff = "${base_bindir}/clockdiff" -FILES:${PN}-rarpd = "${base_sbindir}/rarpd ${systemd_system_unitdir}/rarpd@.service" -FILES:${PN}-rdisc = "${base_sbindir}/rdisc" -FILES:${PN}-ninfod = "${base_sbindir}/ninfod ${sysconfdir}/init.d/ninfod.sh" - -SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', '${PN}-ninfod', '', d)} \ - ${PN}-rdisc" -SYSTEMD_SERVICE:${PN}-ninfod = "ninfod.service" -SYSTEMD_SERVICE:${PN}-rdisc = "rdisc.service" diff --git a/poky/meta/recipes-extended/iputils/iputils_20221126.bb b/poky/meta/recipes-extended/iputils/iputils_20221126.bb new file mode 100644 index 0000000000..cd5fe9bd3e --- /dev/null +++ b/poky/meta/recipes-extended/iputils/iputils_20221126.bb @@ -0,0 +1,49 @@ +SUMMARY = "Network monitoring tools" +DESCRIPTION = "Utilities for the IP protocol, including \ +tracepath, tracepath6, ping, ping6 and arping." +HOMEPAGE = "https://github.com/iputils/iputils" +SECTION = "console/network" + +LICENSE = "BSD-3-Clause & GPL-2.0-or-later" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=627cc07ec86a45951d43e30658bbd819" + +DEPENDS = "gnutls" + +SRC_URI = "git://github.com/iputils/iputils;branch=master;protocol=https" +SRCREV = "5ffabc4190cab975c7332645259e286a032e183b" + +S = "${WORKDIR}/git" + +UPSTREAM_CHECK_GITTAGREGEX = "(?P20\d+)" + +# Fixed in 2000-10-10, but the versioning of iputils +# breaks the version order. +CVE_CHECK_IGNORE += "CVE-2000-1213 CVE-2000-1214" + +PACKAGECONFIG ??= "libcap" +PACKAGECONFIG[libcap] = "-DUSE_CAP=true, -DUSE_CAP=false -DNO_SETCAP_OR_SUID=true, libcap libcap-native" +PACKAGECONFIG[libidn] = "-DUSE_IDN=true, -DUSE_IDN=false, libidn2" +PACKAGECONFIG[gettext] = "-DUSE_GETTEXT=true, -DUSE_GETTEXT=false, gettext" +PACKAGECONFIG[docs] = "-DBUILD_HTML_MANS=true -DBUILD_MANS=true,-DBUILD_HTML_MANS=false -DBUILD_MANS=false, libxslt" + +inherit meson update-alternatives pkgconfig + +EXTRA_OEMESON += "--prefix=${root_prefix}/ -DSKIP_TESTS=true" + +ALTERNATIVE_PRIORITY = "100" + +ALTERNATIVE:${PN}-ping = "ping" +ALTERNATIVE_LINK_NAME[ping] = "${base_bindir}/ping" + +SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-clockdiff" +PACKAGES += "${SPLITPKGS}" + +ALLOW_EMPTY:${PN} = "1" +RDEPENDS:${PN} += "${SPLITPKGS}" + +FILES:${PN} = "" +FILES:${PN}-ping = "${base_bindir}/ping.${BPN}" +FILES:${PN}-arping = "${base_bindir}/arping" +FILES:${PN}-tracepath = "${base_bindir}/tracepath" +FILES:${PN}-clockdiff = "${base_bindir}/clockdiff" diff --git a/poky/meta/recipes-extended/libarchive/libarchive/0001-libarchive-Do-not-include-sys-mount.h-when-linux-fs..patch b/poky/meta/recipes-extended/libarchive/libarchive/0001-libarchive-Do-not-include-sys-mount.h-when-linux-fs..patch deleted file mode 100644 index 0d21799682..0000000000 --- a/poky/meta/recipes-extended/libarchive/libarchive/0001-libarchive-Do-not-include-sys-mount.h-when-linux-fs..patch +++ /dev/null @@ -1,47 +0,0 @@ -From a2f68263a1da5ad227bcb9cd8fa91b93c8b6c99f Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 25 Jul 2022 10:56:53 -0700 -Subject: [PATCH] libarchive: Do not include sys/mount.h when linux/fs.h is - present - -These headers are in conflict and only one is needed by -archive_read_disk_posix.c therefore include linux/fs.h if it exists -otherwise include sys/mount.h - -It also helps compiling with glibc 2.36 -where sys/mount.h conflicts with linux/mount.h see [1] - -[1] https://sourceware.org/glibc/wiki/Release/2.36 - -Upstream-Status: Submitted [https://github.com/libarchive/libarchive/pull/1761] -Signed-off-by: Khem Raj ---- - libarchive/archive_read_disk_posix.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c -index 2b39e672..a96008db 100644 ---- a/libarchive/archive_read_disk_posix.c -+++ b/libarchive/archive_read_disk_posix.c -@@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$"); - #ifdef HAVE_SYS_PARAM_H - #include - #endif --#ifdef HAVE_SYS_MOUNT_H --#include --#endif - #ifdef HAVE_SYS_STAT_H - #include - #endif -@@ -54,6 +51,8 @@ __FBSDID("$FreeBSD$"); - #endif - #ifdef HAVE_LINUX_FS_H - #include -+#elif HAVE_SYS_MOUNT_H -+#include - #endif - /* - * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h. --- -2.25.1 - diff --git a/poky/meta/recipes-extended/libarchive/libarchive_3.6.1.bb b/poky/meta/recipes-extended/libarchive/libarchive_3.6.1.bb deleted file mode 100644 index 24d7918bf9..0000000000 --- a/poky/meta/recipes-extended/libarchive/libarchive_3.6.1.bb +++ /dev/null @@ -1,69 +0,0 @@ -SUMMARY = "Support for reading various archive formats" -DESCRIPTION = "C library and command-line tools for reading and writing tar, cpio, zip, ISO, and other archive formats" -HOMEPAGE = "http://www.libarchive.org/" -SECTION = "devel" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://COPYING;md5=d499814247adaee08d88080841cb5665" - -DEPENDS = "e2fsprogs-native" - -PACKAGECONFIG ?= "zlib bz2 xz zstd" - -PACKAGECONFIG:append:class-target = "\ - ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \ -" - -DEPENDS_BZIP2 = "bzip2-replacement-native" -DEPENDS_BZIP2:class-target = "bzip2" - -PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," -PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr," -PACKAGECONFIG[zlib] = "--with-zlib,--without-zlib,zlib," -PACKAGECONFIG[bz2] = "--with-bz2lib,--without-bz2lib,${DEPENDS_BZIP2}," -PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz," -PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl," -PACKAGECONFIG[libxml2] = "--with-xml2,--without-xml2,libxml2," -PACKAGECONFIG[expat] = "--with-expat,--without-expat,expat," -PACKAGECONFIG[lzo] = "--with-lzo2,--without-lzo2,lzo," -PACKAGECONFIG[nettle] = "--with-nettle,--without-nettle,nettle," -PACKAGECONFIG[lz4] = "--with-lz4,--without-lz4,lz4," -PACKAGECONFIG[mbedtls] = "--with-mbedtls,--without-mbedtls,mbedtls," -PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd," - -EXTRA_OECONF += "--enable-largefile" - -SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz \ - file://0001-libarchive-Do-not-include-sys-mount.h-when-linux-fs..patch \ - " -UPSTREAM_CHECK_URI = "http://libarchive.org/" - -SRC_URI[sha256sum] = "c676146577d989189940f1959d9e3980d28513d74eedfbc6b7f15ea45fe54ee2" - -inherit autotools update-alternatives pkgconfig - -CPPFLAGS += "-I${WORKDIR}/extra-includes" - -do_configure[cleandirs] += "${WORKDIR}/extra-includes" -do_configure:prepend() { - # We just need the headers for some type constants, so no need to - # build all of e2fsprogs for the target - cp -R ${STAGING_INCDIR_NATIVE}/ext2fs ${WORKDIR}/extra-includes/ -} - -ALTERNATIVE_PRIORITY = "80" - -PACKAGES =+ "bsdtar" -FILES:bsdtar = "${bindir}/bsdtar" - -ALTERNATIVE:bsdtar = "tar" -ALTERNATIVE_LINK_NAME[tar] = "${base_bindir}/tar" -ALTERNATIVE_TARGET[tar] = "${bindir}/bsdtar" - -PACKAGES =+ "bsdcpio" -FILES:bsdcpio = "${bindir}/bsdcpio" - -ALTERNATIVE:bsdcpio = "cpio" -ALTERNATIVE_LINK_NAME[cpio] = "${base_bindir}/cpio" -ALTERNATIVE_TARGET[cpio] = "${bindir}/bsdcpio" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/libarchive/libarchive_3.6.2.bb b/poky/meta/recipes-extended/libarchive/libarchive_3.6.2.bb new file mode 100644 index 0000000000..f447035b67 --- /dev/null +++ b/poky/meta/recipes-extended/libarchive/libarchive_3.6.2.bb @@ -0,0 +1,67 @@ +SUMMARY = "Support for reading various archive formats" +DESCRIPTION = "C library and command-line tools for reading and writing tar, cpio, zip, ISO, and other archive formats" +HOMEPAGE = "http://www.libarchive.org/" +SECTION = "devel" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://COPYING;md5=d499814247adaee08d88080841cb5665" + +DEPENDS = "e2fsprogs-native" + +PACKAGECONFIG ?= "zlib bz2 xz zstd" + +PACKAGECONFIG:append:class-target = "\ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \ +" + +DEPENDS_BZIP2 = "bzip2-replacement-native" +DEPENDS_BZIP2:class-target = "bzip2" + +PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," +PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr," +PACKAGECONFIG[zlib] = "--with-zlib,--without-zlib,zlib," +PACKAGECONFIG[bz2] = "--with-bz2lib,--without-bz2lib,${DEPENDS_BZIP2}," +PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz," +PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl," +PACKAGECONFIG[libxml2] = "--with-xml2,--without-xml2,libxml2," +PACKAGECONFIG[expat] = "--with-expat,--without-expat,expat," +PACKAGECONFIG[lzo] = "--with-lzo2,--without-lzo2,lzo," +PACKAGECONFIG[nettle] = "--with-nettle,--without-nettle,nettle," +PACKAGECONFIG[lz4] = "--with-lz4,--without-lz4,lz4," +PACKAGECONFIG[mbedtls] = "--with-mbedtls,--without-mbedtls,mbedtls," +PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd," + +EXTRA_OECONF += "--enable-largefile --without-iconv" + +SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz" +UPSTREAM_CHECK_URI = "http://libarchive.org/" + +SRC_URI[sha256sum] = "ba6d02f15ba04aba9c23fd5f236bb234eab9d5209e95d1c4df85c44d5f19b9b3" + +inherit autotools update-alternatives pkgconfig + +CPPFLAGS += "-I${WORKDIR}/extra-includes" + +do_configure[cleandirs] += "${WORKDIR}/extra-includes" +do_configure:prepend() { + # We just need the headers for some type constants, so no need to + # build all of e2fsprogs for the target + cp -R ${STAGING_INCDIR_NATIVE}/ext2fs ${WORKDIR}/extra-includes/ +} + +ALTERNATIVE_PRIORITY = "80" + +PACKAGES =+ "bsdtar" +FILES:bsdtar = "${bindir}/bsdtar" + +ALTERNATIVE:bsdtar = "tar" +ALTERNATIVE_LINK_NAME[tar] = "${base_bindir}/tar" +ALTERNATIVE_TARGET[tar] = "${bindir}/bsdtar" + +PACKAGES =+ "bsdcpio" +FILES:bsdcpio = "${bindir}/bsdcpio" + +ALTERNATIVE:bsdcpio = "cpio" +ALTERNATIVE_LINK_NAME[cpio] = "${base_bindir}/cpio" +ALTERNATIVE_TARGET[cpio] = "${bindir}/bsdcpio" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/libpipeline/libpipeline_1.5.6.bb b/poky/meta/recipes-extended/libpipeline/libpipeline_1.5.6.bb deleted file mode 100644 index 7007608a39..0000000000 --- a/poky/meta/recipes-extended/libpipeline/libpipeline_1.5.6.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "pipeline manipulation library" -DESCRIPTION = "This is a C library for setting up and running pipelines of processes, \ -without needing to involve shell command-line parsing which is often \ -error-prone and insecure." -HOMEPAGE = "http://libpipeline.nongnu.org/" -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" - -SRC_URI = "${SAVANNAH_GNU_MIRROR}/libpipeline/libpipeline-${PV}.tar.gz" -SRC_URI[sha256sum] = "60fbb9e7dc398528e5f3a776af57bb28ca3fe5d9f0cd8a961ac6cebfe6e9b797" - -inherit pkgconfig autotools - -acpaths = "-I ${S}/gl/m4 -I ${S}/m4" diff --git a/poky/meta/recipes-extended/libpipeline/libpipeline_1.5.7.bb b/poky/meta/recipes-extended/libpipeline/libpipeline_1.5.7.bb new file mode 100644 index 0000000000..73c7aaaa91 --- /dev/null +++ b/poky/meta/recipes-extended/libpipeline/libpipeline_1.5.7.bb @@ -0,0 +1,14 @@ +SUMMARY = "pipeline manipulation library" +DESCRIPTION = "This is a C library for setting up and running pipelines of processes, \ +without needing to involve shell command-line parsing which is often \ +error-prone and insecure." +HOMEPAGE = "http://libpipeline.nongnu.org/" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" + +SRC_URI = "${SAVANNAH_GNU_MIRROR}/libpipeline/libpipeline-${PV}.tar.gz" +SRC_URI[sha256sum] = "b8b45194989022a79ec1317f64a2a75b1551b2a55bea06f67704cb2a2e4690b0" + +inherit pkgconfig autotools + +acpaths = "-I ${S}/gl/m4 -I ${S}/m4" diff --git a/poky/meta/recipes-extended/libsolv/libsolv_0.7.22.bb b/poky/meta/recipes-extended/libsolv/libsolv_0.7.22.bb deleted file mode 100644 index c27bf9c67e..0000000000 --- a/poky/meta/recipes-extended/libsolv/libsolv_0.7.22.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "Library for solving packages and reading repositories" -DESCRIPTION = "This is libsolv, a free package dependency solver using a satisfiability algorithm for solving packages and reading repositories" -HOMEPAGE = "https://github.com/openSUSE/libsolv" -BUGTRACKER = "https://github.com/openSUSE/libsolv/issues" -SECTION = "devel" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8" - -DEPENDS = "expat zlib" - -SRC_URI = "git://github.com/openSUSE/libsolv.git;branch=master;protocol=https \ - file://0001-utils-Conside-musl-when-wrapping-qsort_r.patch \ -" - -SRCREV = "ea114b257b78bda6ee3e4238118ed93bc57c5984" - -UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+(\.\d+)+)" - -S = "${WORKDIR}/git" - -inherit cmake - -PACKAGECONFIG ??= "${@bb.utils.contains('PACKAGE_CLASSES','package_rpm','rpm','',d)}" -PACKAGECONFIG[rpm] = "-DENABLE_RPMMD=ON -DENABLE_RPMDB=ON,,rpm" - -EXTRA_OECMAKE = "-DMULTI_SEMANTICS=ON -DENABLE_COMPLEX_DEPS=ON" - -PACKAGES =+ "${PN}-tools ${PN}ext" - -FILES:${PN}-tools = "${bindir}/*" -FILES:${PN}ext = "${libdir}/${PN}ext.so.*" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/libsolv/libsolv_0.7.23.bb b/poky/meta/recipes-extended/libsolv/libsolv_0.7.23.bb new file mode 100644 index 0000000000..1256905720 --- /dev/null +++ b/poky/meta/recipes-extended/libsolv/libsolv_0.7.23.bb @@ -0,0 +1,33 @@ +SUMMARY = "Library for solving packages and reading repositories" +DESCRIPTION = "This is libsolv, a free package dependency solver using a satisfiability algorithm for solving packages and reading repositories" +HOMEPAGE = "https://github.com/openSUSE/libsolv" +BUGTRACKER = "https://github.com/openSUSE/libsolv/issues" +SECTION = "devel" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8" + +DEPENDS = "expat zlib" + +SRC_URI = "git://github.com/openSUSE/libsolv.git;branch=master;protocol=https \ + file://0001-utils-Conside-musl-when-wrapping-qsort_r.patch \ +" + +SRCREV = "6deaca7cf61ec2b32c4a3b494a751c8d15efbe8b" + +UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+(\.\d+)+)" + +S = "${WORKDIR}/git" + +inherit cmake + +PACKAGECONFIG ??= "${@bb.utils.contains('PACKAGE_CLASSES','package_rpm','rpm','',d)}" +PACKAGECONFIG[rpm] = "-DENABLE_RPMMD=ON -DENABLE_RPMDB=ON,,rpm" + +EXTRA_OECMAKE = "-DMULTI_SEMANTICS=ON -DENABLE_COMPLEX_DEPS=ON" + +PACKAGES =+ "${PN}-tools ${PN}ext" + +FILES:${PN}-tools = "${bindir}/*" +FILES:${PN}ext = "${libdir}/${PN}ext.so.*" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/logrotate/logrotate_3.20.1.bb b/poky/meta/recipes-extended/logrotate/logrotate_3.20.1.bb deleted file mode 100644 index 034c37b429..0000000000 --- a/poky/meta/recipes-extended/logrotate/logrotate_3.20.1.bb +++ /dev/null @@ -1,88 +0,0 @@ -SUMMARY = "Rotates, compresses, removes and mails system log files" -SECTION = "console/utils" -HOMEPAGE = "https://github.com/logrotate/logrotate/" -DESCRIPTION = "The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files." -LICENSE = "GPL-2.0-only" - -# TODO: Document coreutils dependency. Why not RDEPENDS? Why not busybox? - -DEPENDS="coreutils popt" - -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.xz" - -SRC_URI[sha256sum] = "742f6d6e18eceffa49a4bacd933686d3e42931cfccfb694d7f6369b704e5d094" - -# These CVEs are debian, gentoo or SUSE specific on the way logrotate was installed/used -CVE_CHECK_IGNORE += "CVE-2011-1548 CVE-2011-1549 CVE-2011-1550" - -PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" - -PACKAGECONFIG[acl] = ",,acl" -PACKAGECONFIG[selinux] = ",,libselinux" - -CONFFILES:${PN} += "${localstatedir}/lib/logrotate.status \ - ${sysconfdir}/logrotate.conf \ - ${sysconfdir}/logrotate.d/btmp \ - ${sysconfdir}/logrotate.d/wtmp" - -# If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our -# optimization variables, so use it rather than EXTRA_CFLAGS. -EXTRA_OEMAKE = "\ - LFS= \ - OS_NAME='${OS_NAME}' \ - 'CC=${CC}' \ - 'RPM_OPT_FLAGS=${CFLAGS}' \ - 'EXTRA_LDFLAGS=${LDFLAGS}' \ - ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'WITH_ACL=yes', '', d)} \ - ${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'WITH_SELINUX=yes', '', d)} \ -" - -# OS_NAME in the makefile defaults to `uname -s`. The behavior for -# freebsd/netbsd is questionable, so leave it as Linux, which only sets -# INSTALL=install and BASEDIR=/usr. -OS_NAME = "Linux" - -inherit autotools systemd github-releases - -SYSTEMD_SERVICE:${PN} = "\ - ${BPN}.service \ - ${BPN}.timer \ -" - -LOGROTATE_OPTIONS ?= "" - -LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily" -LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h" -LOGROTATE_SYSTEMD_TIMER_PERSISTENT ?= "true" - -do_install(){ - oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} - mkdir -p ${D}${sysconfdir}/logrotate.d - mkdir -p ${D}${localstatedir}/lib - install -p -m 644 ${S}/examples/logrotate.conf ${D}${sysconfdir}/logrotate.conf - install -p -m 644 ${S}/examples/btmp ${D}${sysconfdir}/logrotate.d/btmp - install -p -m 644 ${S}/examples/wtmp ${D}${sysconfdir}/logrotate.d/wtmp - touch ${D}${localstatedir}/lib/logrotate.status - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${systemd_system_unitdir} - install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service - install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer - [ -z "${LOGROTATE_OPTIONS}" ] || - sed -ri \ - -e 's|(ExecStart=.*/logrotate.*)$|\1 ${LOGROTATE_OPTIONS}|g' \ - ${D}${systemd_system_unitdir}/logrotate.service - sed -ri \ - -e 's|(OnCalendar=).*$|\1${LOGROTATE_SYSTEMD_TIMER_BASIS}|g' \ - -e 's|(AccuracySec=).*$|\1${LOGROTATE_SYSTEMD_TIMER_ACCURACY}|g' \ - -e 's|(Persistent=).*$|\1${LOGROTATE_SYSTEMD_TIMER_PERSISTENT}|g' \ - ${D}${systemd_system_unitdir}/logrotate.timer - fi - - if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then - mkdir -p ${D}${sysconfdir}/cron.daily - install -p -m 0755 ${S}/examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate - fi -} diff --git a/poky/meta/recipes-extended/logrotate/logrotate_3.21.0.bb b/poky/meta/recipes-extended/logrotate/logrotate_3.21.0.bb new file mode 100644 index 0000000000..4e4ea10628 --- /dev/null +++ b/poky/meta/recipes-extended/logrotate/logrotate_3.21.0.bb @@ -0,0 +1,88 @@ +SUMMARY = "Rotates, compresses, removes and mails system log files" +SECTION = "console/utils" +HOMEPAGE = "https://github.com/logrotate/logrotate/" +DESCRIPTION = "The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files." +LICENSE = "GPL-2.0-only" + +# TODO: Document coreutils dependency. Why not RDEPENDS? Why not busybox? + +DEPENDS="coreutils popt" + +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.xz" + +SRC_URI[sha256sum] = "8fa12015e3b8415c121fc9c0ca53aa872f7b0702f543afda7e32b6c4900f6516" + +# These CVEs are debian, gentoo or SUSE specific on the way logrotate was installed/used +CVE_CHECK_IGNORE += "CVE-2011-1548 CVE-2011-1549 CVE-2011-1550" + +PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}" + +PACKAGECONFIG[acl] = ",,acl" +PACKAGECONFIG[selinux] = ",,libselinux" + +CONFFILES:${PN} += "${localstatedir}/lib/logrotate.status \ + ${sysconfdir}/logrotate.conf \ + ${sysconfdir}/logrotate.d/btmp \ + ${sysconfdir}/logrotate.d/wtmp" + +# If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our +# optimization variables, so use it rather than EXTRA_CFLAGS. +EXTRA_OEMAKE = "\ + LFS= \ + OS_NAME='${OS_NAME}' \ + 'CC=${CC}' \ + 'RPM_OPT_FLAGS=${CFLAGS}' \ + 'EXTRA_LDFLAGS=${LDFLAGS}' \ + ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'WITH_ACL=yes', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'selinux', 'WITH_SELINUX=yes', '', d)} \ +" + +# OS_NAME in the makefile defaults to `uname -s`. The behavior for +# freebsd/netbsd is questionable, so leave it as Linux, which only sets +# INSTALL=install and BASEDIR=/usr. +OS_NAME = "Linux" + +inherit autotools systemd github-releases + +SYSTEMD_SERVICE:${PN} = "\ + ${BPN}.service \ + ${BPN}.timer \ +" + +LOGROTATE_OPTIONS ?= "" + +LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily" +LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h" +LOGROTATE_SYSTEMD_TIMER_PERSISTENT ?= "true" + +do_install(){ + oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} + mkdir -p ${D}${sysconfdir}/logrotate.d + mkdir -p ${D}${localstatedir}/lib + install -p -m 644 ${S}/examples/logrotate.conf ${D}${sysconfdir}/logrotate.conf + install -p -m 644 ${S}/examples/btmp ${D}${sysconfdir}/logrotate.d/btmp + install -p -m 644 ${S}/examples/wtmp ${D}${sysconfdir}/logrotate.d/wtmp + touch ${D}${localstatedir}/lib/logrotate.status + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service + install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer + [ -z "${LOGROTATE_OPTIONS}" ] || + sed -ri \ + -e 's|(ExecStart=.*/logrotate.*)$|\1 ${LOGROTATE_OPTIONS}|g' \ + ${D}${systemd_system_unitdir}/logrotate.service + sed -ri \ + -e 's|(OnCalendar=).*$|\1${LOGROTATE_SYSTEMD_TIMER_BASIS}|g' \ + -e 's|(AccuracySec=).*$|\1${LOGROTATE_SYSTEMD_TIMER_ACCURACY}|g' \ + -e 's|(Persistent=).*$|\1${LOGROTATE_SYSTEMD_TIMER_PERSISTENT}|g' \ + ${D}${systemd_system_unitdir}/logrotate.timer + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + mkdir -p ${D}${sysconfdir}/cron.daily + install -p -m 0755 ${S}/examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate + fi +} diff --git a/poky/meta/recipes-extended/lsof/lsof_4.96.4.bb b/poky/meta/recipes-extended/lsof/lsof_4.96.4.bb deleted file mode 100644 index bdd883d0ce..0000000000 --- a/poky/meta/recipes-extended/lsof/lsof_4.96.4.bb +++ /dev/null @@ -1,39 +0,0 @@ -SUMMARY = "LiSt Open Files tool" -DESCRIPTION = "Lsof is a Unix-specific diagnostic tool. \ -Its name stands for LiSt Open Files, and it does just that." -HOMEPAGE = "http://people.freebsd.org/~abe/" -SECTION = "devel" -LICENSE = "Spencer-94" -LIC_FILES_CHKSUM = "file://00README;beginline=645;endline=679;md5=964df275d26429ba3b39dbb9f205172a" - -SRC_URI = "git://github.com/lsof-org/lsof;branch=master;protocol=https \ - file://remove-host-information.patch" -SRCREV = "669c33a253e414feb60fbbcf2984c25dc413cd75" - -S = "${WORKDIR}/git" - -export LSOF_INCLUDE = "${STAGING_INCDIR}" - -do_configure () { - export LSOF_AR="${AR} cr" - export LSOF_RANLIB="${RANLIB}" - if [ "x${GLIBCVERSION}" != "x" ]; then - LINUX_CLIB=`echo ${GLIBCVERSION} |sed -e 's,\.,,g'` - LINUX_CLIB="-DGLIBCV=${LINUX_CLIB}" - export LINUX_CLIB - fi - yes | ./Configure linux -} - -export I = "${STAGING_INCDIR}" -export L = "${STAGING_INCDIR}" - -do_compile () { - oe_runmake 'CC=${CC}' 'CFGL=${LDFLAGS} -L./lib -llsof' 'DEBUG=' 'INCL=${CFLAGS}' -} - -do_install () { - install -d ${D}${sbindir} ${D}${mandir}/man8 - install -m 0755 lsof ${D}${sbindir}/lsof - install -m 0644 Lsof.8 ${D}${mandir}/man8/lsof.8 -} diff --git a/poky/meta/recipes-extended/lsof/lsof_4.96.5.bb b/poky/meta/recipes-extended/lsof/lsof_4.96.5.bb new file mode 100644 index 0000000000..9f80176ee1 --- /dev/null +++ b/poky/meta/recipes-extended/lsof/lsof_4.96.5.bb @@ -0,0 +1,48 @@ +SUMMARY = "LiSt Open Files tool" +DESCRIPTION = "Lsof is a Unix-specific diagnostic tool. \ +Its name stands for LiSt Open Files, and it does just that." +HOMEPAGE = "http://people.freebsd.org/~abe/" +SECTION = "devel" +LICENSE = "Spencer-94" +LIC_FILES_CHKSUM = "file://00README;beginline=645;endline=679;md5=964df275d26429ba3b39dbb9f205172a" + +SRC_URI = "git://github.com/lsof-org/lsof;branch=master;protocol=https \ + file://remove-host-information.patch" +SRCREV = "898916d4c7c390ea4610aebaf1d32b8a3c49f26b" + +S = "${WORKDIR}/git" + + +inherit update-alternatives + +ALTERNATIVE_${PN} = "lsof" +ALTERNATIVE_LINK_NAME[lsof] = "${sbindir}/lsof" +# Make our priority higher than busybox +ALTERNATIVE_PRIORITY = "100" + + +export LSOF_INCLUDE = "${STAGING_INCDIR}" + +do_configure () { + export LSOF_AR="${AR} cr" + export LSOF_RANLIB="${RANLIB}" + if [ "x${GLIBCVERSION}" != "x" ]; then + LINUX_CLIB=`echo ${GLIBCVERSION} |sed -e 's,\.,,g'` + LINUX_CLIB="-DGLIBCV=${LINUX_CLIB}" + export LINUX_CLIB + fi + yes | ./Configure linux +} + +export I = "${STAGING_INCDIR}" +export L = "${STAGING_INCDIR}" + +do_compile () { + oe_runmake 'CC=${CC}' 'CFGL=${LDFLAGS} -L./lib -llsof' 'DEBUG=' 'INCL=${CFLAGS}' +} + +do_install () { + install -d ${D}${sbindir} ${D}${mandir}/man8 + install -m 0755 lsof ${D}${sbindir}/lsof + install -m 0644 Lsof.8 ${D}${mandir}/man8/lsof.8 +} diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-testcases-Fix-largefile-support.patch b/poky/meta/recipes-extended/ltp/ltp/0001-testcases-Fix-largefile-support.patch new file mode 100644 index 0000000000..e9b48c392f --- /dev/null +++ b/poky/meta/recipes-extended/ltp/ltp/0001-testcases-Fix-largefile-support.patch @@ -0,0 +1,426 @@ +From 3cca69b85c88c6eb4f02313b3c6a9e0f6cc0b5d7 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 14 Dec 2022 18:14:22 -0800 +Subject: [PATCH] testcases: Fix largefile support + +Use standard functions ( not 64-bit equivalents ) which operate on off_t +and pass -D_FILE_OFFSET_BITS=64 to enable LFS always so off_t is 64bit +for these tests. + +This helps making it portable across musl which has removed the 64bit +transition functions from _GNU_SOURCE namespace. + +Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2022-December/032310.html] +Signed-off-by: Khem Raj +--- + testcases/kernel/io/direct_io/Makefile | 2 +- + testcases/kernel/io/direct_io/diotest2.c | 4 ++-- + testcases/kernel/io/direct_io/diotest5.c | 10 +++++----- + testcases/kernel/io/direct_io/diotest6.c | 4 ++-- + testcases/kernel/syscalls/fcntl/fcntl18.c | 6 +++--- + testcases/kernel/syscalls/fcntl/fcntl34.c | 2 +- + testcases/kernel/syscalls/fcntl/fcntl36.c | 4 ++-- + testcases/kernel/syscalls/llseek/Makefile | 2 ++ + testcases/kernel/syscalls/llseek/llseek01.c | 14 +++++++------- + testcases/kernel/syscalls/llseek/llseek02.c | 12 ++++++------ + testcases/kernel/syscalls/llseek/llseek03.c | 6 +++--- + testcases/kernel/syscalls/open/Makefile | 2 ++ + testcases/kernel/syscalls/open/open12.c | 6 +++--- + testcases/kernel/syscalls/openat/Makefile | 2 ++ + testcases/kernel/syscalls/openat/openat02.c | 6 +++--- + testcases/kernel/syscalls/sync_file_range/Makefile | 2 ++ + .../syscalls/sync_file_range/sync_file_range01.c | 4 ++-- + .../syscalls/sync_file_range/sync_file_range02.c | 6 +++--- + 18 files changed, 51 insertions(+), 43 deletions(-) + +diff --git a/testcases/kernel/io/direct_io/Makefile b/testcases/kernel/io/direct_io/Makefile +index 777f7b166..7480d7b0d 100644 +--- a/testcases/kernel/io/direct_io/Makefile ++++ b/testcases/kernel/io/direct_io/Makefile +@@ -5,7 +5,7 @@ top_srcdir ?= ../../../.. + + include $(top_srcdir)/include/mk/testcases.mk + +-CFLAGS += -DSHARED_OFILE -D_GNU_SOURCE ++CFLAGS += -DSHARED_OFILE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + + LDLIBS += -lpthread + +diff --git a/testcases/kernel/io/direct_io/diotest2.c b/testcases/kernel/io/direct_io/diotest2.c +index c407c46ae..db47ee8ef 100644 +--- a/testcases/kernel/io/direct_io/diotest2.c ++++ b/testcases/kernel/io/direct_io/diotest2.c +@@ -78,7 +78,7 @@ int bufsize = BUFSIZE; + * For each iteration, write data starting at offse+iter*bufsize + * location in the file and read from there. + */ +-int runtest(int fd_r, int fd_w, int iter, off64_t offset, int action) ++int runtest(int fd_r, int fd_w, int iter, off_t offset, int action) + { + char *buf1; + char *buf2; +@@ -136,7 +136,7 @@ static void cleanup(void); + int main(int argc, char *argv[]) + { + int iter = 100; /* Iterations. Default 100 */ +- off64_t offset = 0; /* Offset. Default 0 */ ++ off_t offset = 0; /* Offset. Default 0 */ + int i, action, fd_r, fd_w; + int fail_count = 0, total = 0, failed = 0; + +diff --git a/testcases/kernel/io/direct_io/diotest5.c b/testcases/kernel/io/direct_io/diotest5.c +index 9bf917c64..ac66f2a04 100644 +--- a/testcases/kernel/io/direct_io/diotest5.c ++++ b/testcases/kernel/io/direct_io/diotest5.c +@@ -75,14 +75,14 @@ int TST_TOTAL = 3; /* Total number of test conditions */ + static int bufsize = BUFSIZE; /* Buffer size. Default 4k */ + static int iter = 20; /* Iterations. Default 20 */ + static int nvector = 20; /* Vector array. Default 20 */ +-static off64_t offset = 0; /* Start offset. Default 0 */ ++static off_t offset = 0; /* Start offset. Default 0 */ + static char filename[LEN]; /* Test data file */ + static int fd1 = -1; + /* + * runtest: Write the data in vector array to the file. Read the data + * from the file into another vectory array and verify. Repeat the test. + */ +-int runtest(int fd_r, int fd_w, int iter, off64_t offset, int action) ++int runtest(int fd_r, int fd_w, int iter, off_t offset, int action) + { + int i; + struct iovec *iov1, *iov2, *iovp; +@@ -218,7 +218,7 @@ int main(int argc, char *argv[]) + tst_brkm(TBROK, cleanup, "fd_w open failed for %s: %s", + filename, strerror(errno)); + } +- if ((fd_r = open64(filename, O_DIRECT | O_RDONLY | O_CREAT, 0666)) < 0) { ++ if ((fd_r = open(filename, O_DIRECT | O_RDONLY | O_CREAT, 0666)) < 0) { + tst_brkm(TBROK, cleanup, "fd_r open failed for %s: %s", + filename, strerror(errno)); + } +@@ -240,7 +240,7 @@ int main(int argc, char *argv[]) + tst_brkm(TBROK, cleanup, "fd_w open failed for %s: %s", + filename, strerror(errno)); + } +- if ((fd_r = open64(filename, O_RDONLY | O_CREAT, 0666)) < 0) { ++ if ((fd_r = open(filename, O_RDONLY | O_CREAT, 0666)) < 0) { + tst_brkm(TBROK, cleanup, "fd_r open failed for %s: %s", + filename, strerror(errno)); + } +@@ -261,7 +261,7 @@ int main(int argc, char *argv[]) + tst_brkm(TBROK, cleanup, "fd_w open failed for %s: %s", + filename, strerror(errno)); + } +- if ((fd_r = open64(filename, O_DIRECT | O_RDONLY | O_CREAT, 0666)) < 0) { ++ if ((fd_r = open(filename, O_DIRECT | O_RDONLY | O_CREAT, 0666)) < 0) { + tst_brkm(TBROK, cleanup, "fd_r open failed for %s: %s", + filename, strerror(errno)); + } +diff --git a/testcases/kernel/io/direct_io/diotest6.c b/testcases/kernel/io/direct_io/diotest6.c +index a06e6b82b..1905380f0 100644 +--- a/testcases/kernel/io/direct_io/diotest6.c ++++ b/testcases/kernel/io/direct_io/diotest6.c +@@ -62,7 +62,7 @@ int TST_TOTAL = 3; + + static int iter = 100; + static int bufsize = BUFSIZE; +-static off64_t offset = 0; ++static off_t offset = 0; + static int nvector = 20; + static char filename[LEN]; + static int fd1 = -1; +@@ -84,7 +84,7 @@ static void prg_usage(void) + */ + int runtest(int fd_r, int fd_w, int childnum, int action) + { +- off64_t seekoff; ++ off_t seekoff; + int i, ret = -1; + ssize_t n = 0; + struct iovec *iov_r, *iov_w; +diff --git a/testcases/kernel/syscalls/fcntl/fcntl18.c b/testcases/kernel/syscalls/fcntl/fcntl18.c +index 5eefbd128..1105dd393 100644 +--- a/testcases/kernel/syscalls/fcntl/fcntl18.c ++++ b/testcases/kernel/syscalls/fcntl/fcntl18.c +@@ -103,11 +103,11 @@ int main(int ac, char **av) + tst_resm(TINFO, "Enter block 2"); + fail = 0; + /* Error condition if address is bad */ +- retval = fcntl(fd, F_GETLK64, (struct flock *)INVAL_FLAG); ++ retval = fcntl(fd, F_GETLK, (struct flock *)INVAL_FLAG); + if (errno == EFAULT) { +- tst_resm(TPASS, "Test F_GETLK64: for errno EFAULT PASSED"); ++ tst_resm(TPASS, "Test F_GETLK: for errno EFAULT PASSED"); + } else { +- tst_resm(TFAIL, "Test F_GETLK64: for errno EFAULT FAILED"); ++ tst_resm(TFAIL, "Test F_GETLK: for errno EFAULT FAILED"); + fail = 1; + } + if (fail) { +diff --git a/testcases/kernel/syscalls/fcntl/fcntl34.c b/testcases/kernel/syscalls/fcntl/fcntl34.c +index 3442114ff..536dead29 100644 +--- a/testcases/kernel/syscalls/fcntl/fcntl34.c ++++ b/testcases/kernel/syscalls/fcntl/fcntl34.c +@@ -54,7 +54,7 @@ void *thread_fn_01(void *arg) + + memset(buf, (intptr_t)arg, write_size); + +- struct flock64 lck = { ++ struct flock lck = { + .l_whence = SEEK_SET, + .l_start = 0, + .l_len = 1, +diff --git a/testcases/kernel/syscalls/fcntl/fcntl36.c b/testcases/kernel/syscalls/fcntl/fcntl36.c +index d6b07fc41..4e4d48afc 100644 +--- a/testcases/kernel/syscalls/fcntl/fcntl36.c ++++ b/testcases/kernel/syscalls/fcntl/fcntl36.c +@@ -72,7 +72,7 @@ static void *fn_ofd_w(void *arg) + int fd = SAFE_OPEN(fname, O_RDWR); + long wt = pa->cnt; + +- struct flock64 lck = { ++ struct flock lck = { + .l_whence = SEEK_SET, + .l_start = pa->offset, + .l_len = pa->length, +@@ -151,7 +151,7 @@ static void *fn_ofd_r(void *arg) + int i; + int fd = SAFE_OPEN(fname, O_RDWR); + +- struct flock64 lck = { ++ struct flock lck = { + .l_whence = SEEK_SET, + .l_start = pa->offset, + .l_len = pa->length, +diff --git a/testcases/kernel/syscalls/llseek/Makefile b/testcases/kernel/syscalls/llseek/Makefile +index 044619fb8..8a916d0fa 100644 +--- a/testcases/kernel/syscalls/llseek/Makefile ++++ b/testcases/kernel/syscalls/llseek/Makefile +@@ -6,3 +6,5 @@ top_srcdir ?= ../../../.. + include $(top_srcdir)/include/mk/testcases.mk + + include $(top_srcdir)/include/mk/generic_leaf_target.mk ++ ++CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE +diff --git a/testcases/kernel/syscalls/llseek/llseek01.c b/testcases/kernel/syscalls/llseek/llseek01.c +index 50f35493d..efb444dc8 100644 +--- a/testcases/kernel/syscalls/llseek/llseek01.c ++++ b/testcases/kernel/syscalls/llseek/llseek01.c +@@ -4,7 +4,7 @@ + * 07/2001 Ported by Wayne Boyer + */ + /* +- * Verify that lseek64() call succeeds to set the file pointer position to an ++ * Verify that lseek() call succeeds to set the file pointer position to an + * offset larger than file size limit (RLIMIT_FSIZE). Also, verify that any + * attempt to write to this location fails. + */ +@@ -27,22 +27,22 @@ static int fildes; + + static void verify_llseek(void) + { +- TEST(lseek64(fildes, (loff_t) (80 * BUFSIZ), SEEK_SET)); ++ TEST(lseek(fildes, (loff_t) (80 * BUFSIZ), SEEK_SET)); + if (TST_RET == (80 * BUFSIZ)) +- tst_res(TPASS, "lseek64() can set file pointer position larger than file size limit"); ++ tst_res(TPASS, "lseek() can set file pointer position larger than file size limit"); + else +- tst_res(TFAIL, "lseek64() returned wrong value %ld when write past file size", TST_RET); ++ tst_res(TFAIL, "lseek() returned wrong value %ld when write past file size", TST_RET); + + if (write(fildes, write_buff, BUFSIZ) == -1) + tst_res(TPASS,"write failed after file size limit"); + else + tst_brk(TFAIL, "write successful after file size limit"); + +- TEST(lseek64(fildes, (loff_t) BUFSIZ, SEEK_SET)); ++ TEST(lseek(fildes, (loff_t) BUFSIZ, SEEK_SET)); + if (TST_RET == BUFSIZ) +- tst_res(TPASS,"lseek64() can set file pointer position under filer size limit"); ++ tst_res(TPASS,"lseek() can set file pointer position under filer size limit"); + else +- tst_brk(TFAIL,"lseek64() returns wrong value %ld when write under file size", TST_RET); ++ tst_brk(TFAIL,"lseek() returns wrong value %ld when write under file size", TST_RET); + + if (write(fildes, write_buff, BUFSIZ) != -1) + tst_res(TPASS, "write succcessfully under file size limit"); +diff --git a/testcases/kernel/syscalls/llseek/llseek02.c b/testcases/kernel/syscalls/llseek/llseek02.c +index 3d9c21fc9..5431969f9 100644 +--- a/testcases/kernel/syscalls/llseek/llseek02.c ++++ b/testcases/kernel/syscalls/llseek/llseek02.c +@@ -5,8 +5,8 @@ + */ + /* + * Description: +- * 1) lseek64(2) fails and sets errno to EINVAL when whence is invalid. +- * 2) lseek64(2) fails ans sets errno to EBADF when fd is not an open ++ * 1) lseek(2) fails and sets errno to EINVAL when whence is invalid. ++ * 2) lseek(2) fails ans sets errno to EBADF when fd is not an open + * file descriptor. + */ + +@@ -39,17 +39,17 @@ static void verify_llseek(unsigned int n) + { + struct tcase *tc = &tcases[n]; + +- TEST(lseek64(*tc->fd, (loff_t) 1, tc->whence)); ++ TEST(lseek(*tc->fd, (loff_t) 1, tc->whence)); + if (TST_RET != (off_t) -1) { +- tst_res(TFAIL, "lseek64(%d, 1, %d) succeeded unexpectedly (%ld)", ++ tst_res(TFAIL, "lseek(%d, 1, %d) succeeded unexpectedly (%ld)", + *tc->fd, tc->whence, TST_RET); + return; + } + if (TST_ERR == tc->exp_err) { +- tst_res(TPASS | TTERRNO, "lseek64(%d, 1, %d) failed as expected", ++ tst_res(TPASS | TTERRNO, "lseek(%d, 1, %d) failed as expected", + *tc->fd, tc->whence); + } else { +- tst_res(TFAIL | TTERRNO, "lseek64(%d, 1, %d) failed " ++ tst_res(TFAIL | TTERRNO, "lseek(%d, 1, %d) failed " + "unexpectedly, expected %s", *tc->fd, tc->whence, + tst_strerrno(tc->exp_err)); + } +diff --git a/testcases/kernel/syscalls/llseek/llseek03.c b/testcases/kernel/syscalls/llseek/llseek03.c +index d780f2af6..6c34119e5 100644 +--- a/testcases/kernel/syscalls/llseek/llseek03.c ++++ b/testcases/kernel/syscalls/llseek/llseek03.c +@@ -72,7 +72,7 @@ static const char *str_whence(int whence) + } + } + +-static void verify_lseek64(unsigned int n) ++static void verify_lseek(unsigned int n) + { + struct tcase *tc = &tcases[n]; + char read_buf[128]; +@@ -82,7 +82,7 @@ static void verify_lseek64(unsigned int n) + + SAFE_READ(1, fd, read_buf, 4); + +- TEST(lseek64(fd, tc->off, tc->whence)); ++ TEST(lseek(fd, tc->off, tc->whence)); + + if (TST_RET == -1) { + tst_res(TFAIL | TTERRNO, "llseek failed on %s ", TEST_FILE); +@@ -121,6 +121,6 @@ exit: + static struct tst_test test = { + .needs_tmpdir = 1, + .setup = setup, +- .test = verify_lseek64, ++ .test = verify_lseek, + .tcnt = ARRAY_SIZE(tcases), + }; +diff --git a/testcases/kernel/syscalls/open/Makefile b/testcases/kernel/syscalls/open/Makefile +index 044619fb8..8a916d0fa 100644 +--- a/testcases/kernel/syscalls/open/Makefile ++++ b/testcases/kernel/syscalls/open/Makefile +@@ -6,3 +6,5 @@ top_srcdir ?= ../../../.. + include $(top_srcdir)/include/mk/testcases.mk + + include $(top_srcdir)/include/mk/generic_leaf_target.mk ++ ++CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE +diff --git a/testcases/kernel/syscalls/open/open12.c b/testcases/kernel/syscalls/open/open12.c +index bdf29a9a8..c840de53d 100644 +--- a/testcases/kernel/syscalls/open/open12.c ++++ b/testcases/kernel/syscalls/open/open12.c +@@ -233,14 +233,14 @@ static void test_cloexec(void) + static void test_largefile(void) + { + int fd; +- off64_t offset; ++ off_t offset; + + fd = SAFE_OPEN(cleanup, LARGE_FILE, + O_LARGEFILE | O_RDWR | O_CREAT, 0777); + +- offset = lseek64(fd, 4.1*1024*1024*1024, SEEK_SET); ++ offset = lseek(fd, 4.1*1024*1024*1024, SEEK_SET); + if (offset == -1) +- tst_brkm(TBROK | TERRNO, cleanup, "lseek64 failed"); ++ tst_brkm(TBROK | TERRNO, cleanup, "lseek failed"); + + SAFE_WRITE(cleanup, 1, fd, LARGE_FILE, sizeof(LARGE_FILE)); + +diff --git a/testcases/kernel/syscalls/openat/Makefile b/testcases/kernel/syscalls/openat/Makefile +index 044619fb8..8a916d0fa 100644 +--- a/testcases/kernel/syscalls/openat/Makefile ++++ b/testcases/kernel/syscalls/openat/Makefile +@@ -6,3 +6,5 @@ top_srcdir ?= ../../../.. + include $(top_srcdir)/include/mk/testcases.mk + + include $(top_srcdir)/include/mk/generic_leaf_target.mk ++ ++CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE +diff --git a/testcases/kernel/syscalls/openat/openat02.c b/testcases/kernel/syscalls/openat/openat02.c +index 2ce119033..f6113852a 100644 +--- a/testcases/kernel/syscalls/openat/openat02.c ++++ b/testcases/kernel/syscalls/openat/openat02.c +@@ -22,7 +22,7 @@ + * 2)openat() succeeds to enable the close-on-exec flag for a + * file descriptor, when 'flags' is set to O_CLOEXEC. + * 3)openat() succeeds to allow files whose sizes cannot be +- * represented in an off_t but can be represented in an off64_t ++ * represented in an off_t but can be represented in an off_t + * to be opened, when 'flags' is set to O_LARGEFILE. + * 4)openat() succeeds to not update the file last access time + * (st_atime in the inode) when the file is read, when 'flags' +@@ -193,12 +193,12 @@ void testfunc_cloexec(void) + void testfunc_largefile(void) + { + int fd; +- off64_t offset; ++ off_t offset; + + fd = SAFE_OPEN(cleanup, LARGE_FILE, + O_LARGEFILE | O_RDWR | O_CREAT, 0777); + +- offset = lseek64(fd, 4.1*1024*1024*1024, SEEK_SET); ++ offset = lseek(fd, 4.1*1024*1024*1024, SEEK_SET); + if (offset == -1) + tst_brkm(TBROK | TERRNO, cleanup, "lseek64 failed"); + +diff --git a/testcases/kernel/syscalls/sync_file_range/Makefile b/testcases/kernel/syscalls/sync_file_range/Makefile +index 044619fb8..8a916d0fa 100644 +--- a/testcases/kernel/syscalls/sync_file_range/Makefile ++++ b/testcases/kernel/syscalls/sync_file_range/Makefile +@@ -6,3 +6,5 @@ top_srcdir ?= ../../../.. + include $(top_srcdir)/include/mk/testcases.mk + + include $(top_srcdir)/include/mk/generic_leaf_target.mk ++ ++CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE +diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c +index 187ef6071..47188aa48 100644 +--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c ++++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c +@@ -44,8 +44,8 @@ static int bfd = -1; + + struct test_case { + int *fd; +- off64_t offset; +- off64_t nbytes; ++ off_t offset; ++ off_t nbytes; + unsigned int flags; + int error; + } tcases[] = { +diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c +index 5da751c70..28a8156c8 100644 +--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c ++++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c +@@ -31,10 +31,10 @@ + + struct testcase { + char *fname; +- off64_t sync_off; +- off64_t sync_size; ++ off_t sync_off; ++ off_t sync_size; + size_t exp_sync_size; +- off64_t write_off; ++ off_t write_off; + size_t write_size_mb; + const char *desc; + }; diff --git a/poky/meta/recipes-extended/ltp/ltp_20220930.bb b/poky/meta/recipes-extended/ltp/ltp_20220930.bb index 405b17b637..568a6320c1 100644 --- a/poky/meta/recipes-extended/ltp/ltp_20220930.bb +++ b/poky/meta/recipes-extended/ltp/ltp_20220930.bb @@ -29,6 +29,7 @@ SRCREV = "b763f81998f19f783982d3937d1fd05bcf649c16" SRC_URI = "git://github.com/linux-test-project/ltp.git;branch=master;protocol=https \ file://0001-Remove-OOM-tests-from-runtest-mm.patch \ file://disable_hanging_tests.patch \ + file://0001-testcases-Fix-largefile-support.patch \ " S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-extended/man-db/man-db_2.10.2.bb b/poky/meta/recipes-extended/man-db/man-db_2.10.2.bb deleted file mode 100644 index a41e2dd4d8..0000000000 --- a/poky/meta/recipes-extended/man-db/man-db_2.10.2.bb +++ /dev/null @@ -1,68 +0,0 @@ -SUMMARY = "An implementation of the standard Unix documentation system accessed using the man command" -HOMEPAGE = "http://man-db.nongnu.org/" -DESCRIPTION = "man-db is an implementation of the standard Unix documentation system accessed using the man command. It uses a Berkeley DB database in place of the traditional flat-text whatis databases." -LICENSE = "LGPL-2.1-only & GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c \ - file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -SRC_URI = "${SAVANNAH_NONGNU_MIRROR}/man-db/man-db-${PV}.tar.xz \ - file://99_mandb \ - file://0001-man-Move-local-variable-declaration-to-function-scop.patch \ - file://man_db.conf-avoid-multilib-install-file-conflict.patch" -SRC_URI[sha256sum] = "ee97954d492a13731903c9d0727b9b01e5089edbd695f0cdb58d405a5af5514d" - -DEPENDS = "libpipeline gdbm groff-native base-passwd" -RDEPENDS:${PN} += "base-passwd" -PACKAGE_WRITE_DEPS += "base-passwd" - -# | /usr/src/debug/man-db/2.8.0-r0/man-db-2.8.0/src/whatis.c:939: undefined reference to `_nl_msg_cat_cntr' -USE_NLS:libc-musl = "no" - -inherit gettext pkgconfig autotools systemd - -EXTRA_OECONF = "--with-pager=less --with-systemdsystemunitdir=${systemd_system_unitdir}" -EXTRA_AUTORECONF += "-I ${S}/gl/m4" - -PACKAGECONFIG[bzip2] = "--with-bzip2=bzip2,ac_cv_prog_have_bzip2='',bzip2" -PACKAGECONFIG[gzip] = "--with-gzip=gzip,ac_cv_prog_have_gzip='',gzip" -PACKAGECONFIG[lzip] = "--with-lzip=lzip,ac_cv_prog_have_lzip='',lzip" -PACKAGECONFIG[lzma] = "--with-lzma=lzma,ac_cv_prog_have_lzma='',xz" -PACKAGECONFIG[zstd] = "--with-zstd=zstd,ac_cv_prog_have_zstd='',zstd" -PACKAGECONFIG[xz] = "--with-xz=xz,ac_cv_prog_have_xz='',xz" - -do_install() { - autotools_do_install - - if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then - install -d ${D}/etc/default/volatiles - install -m 0644 ${WORKDIR}/99_mandb ${D}/etc/default/volatiles - fi -} - -do_install:append:libc-musl() { - rm -f ${D}${libdir}/charset.alias -} - -FILES:${PN} += "${prefix}/lib/tmpfiles.d" - -FILES:${PN}-dev += "${libdir}/man-db/libman.so ${libdir}/${BPN}/libmandb.so" - -RDEPENDS:${PN} += "groff" -RRECOMMENDS:${PN} += "less" -RPROVIDES:${PN} += " man" - -def compress_pkg(d): - if bb.utils.contains("INHERIT", "compress_doc", True, False, d): - compress = d.getVar("DOC_COMPRESS") - if compress == "gz": - return "gzip" - elif compress == "bz2": - return "bzip2" - elif compress == "xz": - return "xz" - return "" - -RDEPENDS:${PN} += "${@compress_pkg(d)}" - -SYSTEMD_SERVICE:${PN} = "man-db.timer man-db.service" -SYSTEMD_AUTO_ENABLE ?= "disable" diff --git a/poky/meta/recipes-extended/man-db/man-db_2.11.1.bb b/poky/meta/recipes-extended/man-db/man-db_2.11.1.bb new file mode 100644 index 0000000000..2d539c4a5b --- /dev/null +++ b/poky/meta/recipes-extended/man-db/man-db_2.11.1.bb @@ -0,0 +1,70 @@ +SUMMARY = "An implementation of the standard Unix documentation system accessed using the man command" +HOMEPAGE = "http://man-db.nongnu.org/" +DESCRIPTION = "man-db is an implementation of the standard Unix documentation system accessed using the man command. It uses a Berkeley DB database in place of the traditional flat-text whatis databases." +LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later & GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \ + file://docs/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://docs/COPYING.LIB;md5=4fbd65380cdd255951079008b364516c \ + " + +SRC_URI = "${SAVANNAH_NONGNU_MIRROR}/man-db/man-db-${PV}.tar.xz \ + file://99_mandb \ + file://0001-man-Move-local-variable-declaration-to-function-scop.patch \ + file://man_db.conf-avoid-multilib-install-file-conflict.patch" +SRC_URI[sha256sum] = "2eabaa5251349847de9c9e43c634d986cbcc6f87642d1d9cb8608ec18487b6cc" + +DEPENDS = "libpipeline gdbm groff-native base-passwd" +RDEPENDS:${PN} += "base-passwd" +PACKAGE_WRITE_DEPS += "base-passwd" + +# | /usr/src/debug/man-db/2.8.0-r0/man-db-2.8.0/src/whatis.c:939: undefined reference to `_nl_msg_cat_cntr' +USE_NLS:libc-musl = "no" + +inherit gettext pkgconfig autotools systemd + +EXTRA_OECONF = "--with-pager=less --with-systemdsystemunitdir=${systemd_system_unitdir}" +EXTRA_AUTORECONF += "-I ${S}/gl/m4" + +PACKAGECONFIG[bzip2] = "--with-bzip2=bzip2,ac_cv_prog_have_bzip2='',bzip2" +PACKAGECONFIG[gzip] = "--with-gzip=gzip,ac_cv_prog_have_gzip='',gzip" +PACKAGECONFIG[lzip] = "--with-lzip=lzip,ac_cv_prog_have_lzip='',lzip" +PACKAGECONFIG[lzma] = "--with-lzma=lzma,ac_cv_prog_have_lzma='',xz" +PACKAGECONFIG[zstd] = "--with-zstd=zstd,ac_cv_prog_have_zstd='',zstd" +PACKAGECONFIG[xz] = "--with-xz=xz,ac_cv_prog_have_xz='',xz" + +do_install() { + autotools_do_install + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}/etc/default/volatiles + install -m 0644 ${WORKDIR}/99_mandb ${D}/etc/default/volatiles + fi +} + +do_install:append:libc-musl() { + rm -f ${D}${libdir}/charset.alias +} + +FILES:${PN} += "${prefix}/lib/tmpfiles.d" + +FILES:${PN}-dev += "${libdir}/man-db/libman.so ${libdir}/${BPN}/libmandb.so" + +RDEPENDS:${PN} += "groff" +RRECOMMENDS:${PN} += "less" +RPROVIDES:${PN} += " man" + +def compress_pkg(d): + if bb.utils.contains("INHERIT", "compress_doc", True, False, d): + compress = d.getVar("DOC_COMPRESS") + if compress == "gz": + return "gzip" + elif compress == "bz2": + return "bzip2" + elif compress == "xz": + return "xz" + return "" + +RDEPENDS:${PN} += "${@compress_pkg(d)}" + +SYSTEMD_SERVICE:${PN} = "man-db.timer man-db.service" +SYSTEMD_AUTO_ENABLE ?= "disable" diff --git a/poky/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch b/poky/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch new file mode 100644 index 0000000000..142ed355ef --- /dev/null +++ b/poky/meta/recipes-extended/mdadm/files/0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch @@ -0,0 +1,147 @@ +From 6b861a267a6ef6f60f6cc21e4c8e6d7cdd2451dc Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 10 Nov 2022 12:31:22 -0800 +Subject: [PATCH] restripe.c: Use _FILE_OFFSET_BITS to enable largefile support + +Instead of using the lseek64 and friends, its better to enable it via +the feature macro _FILE_OFFSET_BITS = 64 and let the C library deal with +the width of types + +Upstream-Status: Submitted [https://lore.kernel.org/linux-raid/20221110225546.337164-1-raj.khem@gmail.com/] +Signed-off-by: Khem Raj +--- + restripe.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/restripe.c ++++ b/restripe.c +@@ -22,6 +22,9 @@ + * Email: + */ + ++/* Enable largefile support */ ++#define _FILE_OFFSET_BITS 64 ++ + #include "mdadm.h" + #include + +@@ -581,7 +584,7 @@ int save_stripes(int *source, unsigned l + raid_disks, level, layout); + if (dnum < 0) abort(); + if (source[dnum] < 0 || +- lseek64(source[dnum], ++ lseek(source[dnum], + offsets[dnum] + offset, 0) < 0 || + read(source[dnum], buf+disk * chunk_size, + chunk_size) != chunk_size) { +@@ -754,8 +757,8 @@ int restore_stripes(int *dest, unsigned + raid_disks, level, layout); + if (src_buf == NULL) { + /* read from file */ +- if (lseek64(source, read_offset, 0) != +- (off64_t)read_offset) { ++ if (lseek(source, read_offset, 0) != ++ (off_t)read_offset) { + rv = -1; + goto abort; + } +@@ -816,7 +819,7 @@ int restore_stripes(int *dest, unsigned + } + for (i=0; i < raid_disks ; i++) + if (dest[i] >= 0) { +- if (lseek64(dest[i], ++ if (lseek(dest[i], + offsets[i]+offset, 0) < 0) { + rv = -1; + goto abort; +@@ -866,7 +869,7 @@ int test_stripes(int *source, unsigned l + int disk; + + for (i = 0 ; i < raid_disks ; i++) { +- if ((lseek64(source[i], offsets[i]+start, 0) < 0) || ++ if ((lseek(source[i], offsets[i]+start, 0) < 0) || + (read(source[i], stripes[i], chunk_size) != + chunk_size)) { + free(q); +--- a/raid6check.c ++++ b/raid6check.c +@@ -22,6 +22,9 @@ + * Based on "restripe.c" from "mdadm" codebase + */ + ++/* Enable largefile support */ ++#define _FILE_OFFSET_BITS 64 ++ + #include "mdadm.h" + #include + #include +@@ -279,9 +282,9 @@ int manual_repair(int chunk_size, int sy + } + + int write_res1, write_res2; +- off64_t seek_res; ++ off_t seek_res; + +- seek_res = lseek64(source[fd1], ++ seek_res = lseek(source[fd1], + offsets[fd1] + start * chunk_size, SEEK_SET); + if (seek_res < 0) { + fprintf(stderr, "lseek failed for failed_disk1\n"); +@@ -289,7 +292,7 @@ int manual_repair(int chunk_size, int sy + } + write_res1 = write(source[fd1], blocks[failed_slot1], chunk_size); + +- seek_res = lseek64(source[fd2], ++ seek_res = lseek(source[fd2], + offsets[fd2] + start * chunk_size, SEEK_SET); + if (seek_res < 0) { + fprintf(stderr, "lseek failed for failed_disk2\n"); +@@ -374,7 +377,7 @@ int check_stripes(struct mdinfo *info, i + goto exitCheck; + } + for (i = 0 ; i < raid_disks ; i++) { +- off64_t seek_res = lseek64(source[i], offsets[i] + start * chunk_size, ++ off_t seek_res = lseek(source[i], offsets[i] + start * chunk_size, + SEEK_SET); + if (seek_res < 0) { + fprintf(stderr, "lseek to source %d failed\n", i); +--- a/swap_super.c ++++ b/swap_super.c +@@ -1,3 +1,6 @@ ++/* Enable largefile support */ ++#define _FILE_OFFSET_BITS 64 ++ + #include + #include + #include +@@ -16,8 +19,6 @@ + + #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) + +-extern long long lseek64(int, long long, int); +- + int main(int argc, char *argv[]) + { + int fd, i; +@@ -38,8 +39,8 @@ int main(int argc, char *argv[]) + exit(1); + } + offset = MD_NEW_SIZE_SECTORS(size) * 512LL; +- if (lseek64(fd, offset, 0) < 0LL) { +- perror("lseek64"); ++ if (lseek(fd, offset, 0) < 0LL) { ++ perror("lseek"); + exit(1); + } + if (read(fd, super, 4096) != 4096) { +@@ -68,8 +69,8 @@ int main(int argc, char *argv[]) + super[32*4+10*4 +i] = t; + } + +- if (lseek64(fd, offset, 0) < 0LL) { +- perror("lseek64"); ++ if (lseek(fd, offset, 0) < 0LL) { ++ perror("lseek"); + exit(1); + } + if (write(fd, super, 4096) != 4096) { diff --git a/poky/meta/recipes-extended/mdadm/mdadm_4.2.bb b/poky/meta/recipes-extended/mdadm/mdadm_4.2.bb index 19035caaec..7298860241 100644 --- a/poky/meta/recipes-extended/mdadm/mdadm_4.2.bb +++ b/poky/meta/recipes-extended/mdadm/mdadm_4.2.bb @@ -24,6 +24,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ file://0001-mdadm-skip-test-11spare-migration.patch \ file://0001-Fix-parsing-of-r-in-monitor-manager-mode.patch \ file://0001-Makefile-install-mdcheck.patch \ + file://0001-restripe.c-Use-_FILE_OFFSET_BITS-to-enable-largefile.patch \ " SRC_URI[sha256sum] = "461c215670864bb74a4d1a3620684aa2b2f8296dffa06743f26dda5557acf01d" diff --git a/poky/meta/recipes-extended/newt/files/0001-detect-gold-as-GNU-linker-too.patch b/poky/meta/recipes-extended/newt/files/0001-detect-gold-as-GNU-linker-too.patch index a4b3afd959..090ed5c1c9 100644 --- a/poky/meta/recipes-extended/newt/files/0001-detect-gold-as-GNU-linker-too.patch +++ b/poky/meta/recipes-extended/newt/files/0001-detect-gold-as-GNU-linker-too.patch @@ -1,4 +1,4 @@ -From 58245b859ffbcb1780575bf1b0a018d55e74e434 Mon Sep 17 00:00:00 2001 +From 08ba909500412611953aea0fa2fe0d8fe76b6e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Wed, 21 Sep 2016 21:14:40 +0200 Subject: [PATCH] detect gold as GNU linker too @@ -9,23 +9,21 @@ Content-Transfer-Encoding: 8bit Upstream-Status: Pending Signed-off-by: Andreas Müller + --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 03e8bda..c2fce51 100644 +index 468c718..cd93f30 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,7 @@ AC_CHECK_SIZEOF([void *]) AC_MSG_CHECKING([for GNU ld]) - LD=`$CC -print-prog-name=ld 2>&5` + LD=$($CC -print-prog-name=ld 2>&5) --if test `$LD -v 2>&1 | $ac_cv_path_GREP -c "GNU ld"` = 0; then -+if test `$LD -v 2>&1 | $ac_cv_path_GREP -c "GNU "` = 0; then +-if test $($LD -v 2>&1 | $ac_cv_path_GREP -c "GNU ld") = 0; then ++if test $($LD -v 2>&1 | $ac_cv_path_GREP -c "GNU ") = 0; then # Not GNU_LD="" AC_MSG_RESULT([no]) --- -2.5.5 - diff --git a/poky/meta/recipes-extended/newt/files/0002-don-t-ignore-CFLAGS-when-building-snack.patch b/poky/meta/recipes-extended/newt/files/0002-don-t-ignore-CFLAGS-when-building-snack.patch deleted file mode 100644 index ca235d5108..0000000000 --- a/poky/meta/recipes-extended/newt/files/0002-don-t-ignore-CFLAGS-when-building-snack.patch +++ /dev/null @@ -1,29 +0,0 @@ -From f60dc1063607ca1f201ba4cbda467d8af3f78f64 Mon Sep 17 00:00:00 2001 -From: Miroslav Lichvar -Date: Tue, 1 Oct 2019 16:37:55 +0200 -Subject: [PATCH] don't ignore CFLAGS when building snack - -In addition to the flags returned by python-config --cflags, use the -user-specified CFLAGS when building the snack object. - -Upstream-Status: Backport from master -Signed-off-by: Joshua Watt ---- - Makefile.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile.in b/Makefile.in -index be5f87b..6facd5e 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -96,8 +96,8 @@ _snack.$(SOEXT): snack.c $(LIBNEWTSH) - PIFLAGS=`$$pyconfig --includes`; \ - PLDFLAGS=`$$pyconfig --ldflags`; \ - PLFLAGS=`$$pyconfig --libs`; \ -- echo $(CC) $(SHCFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \ -- $(CC) $(SHCFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \ -+ echo $(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \ -+ $(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \ - echo $(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \ - $(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \ - done || : diff --git a/poky/meta/recipes-extended/newt/libnewt_0.52.21.bb b/poky/meta/recipes-extended/newt/libnewt_0.52.21.bb deleted file mode 100644 index 430e481b36..0000000000 --- a/poky/meta/recipes-extended/newt/libnewt_0.52.21.bb +++ /dev/null @@ -1,58 +0,0 @@ -SUMMARY = "A library for text mode user interfaces" - -DESCRIPTION = "Newt is a programming library for color text mode, widget based user \ -interfaces. Newt can be used to add stacked windows, entry widgets, \ -checkboxes, radio buttons, labels, plain text fields, scrollbars, \ -etc., to text mode user interfaces. This package also contains the \ -shared library needed by programs built with newt, as well as a \ -/usr/bin/dialog replacement called whiptail. Newt is based on the \ -slang library." - -HOMEPAGE = "https://releases.pagure.org/newt/" -SECTION = "libs" - -LICENSE = "LGPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" - -# slang needs to be >= 2.2 -DEPENDS = "slang popt python3" - -SRC_URI = "https://releases.pagure.org/newt/newt-${PV}.tar.gz \ - file://cross_ar.patch \ - file://Makefile.in-Add-tinfo-library-to-the-linking-librari.patch \ - file://0001-detect-gold-as-GNU-linker-too.patch \ - file://0002-don-t-ignore-CFLAGS-when-building-snack.patch \ - " - -SRC_URI[md5sum] = "a0a5fd6b53bb167a65e15996b249ebb5" -SRC_URI[sha256sum] = "265eb46b55d7eaeb887fca7a1d51fe115658882dfe148164b6c49fccac5abb31" - -S = "${WORKDIR}/newt-${PV}" - -inherit autotools-brokensep python3native python3-dir python3targetconfig - -EXTRA_OECONF = "--without-tcl --with-python" - -EXTRA_OEMAKE += "PYTHONVERS=${PYTHON_DIR}" - -CLEANBROKEN = "1" - -export CPPFLAGS - -PACKAGES:prepend = "whiptail ${PN}-python " - -RDEPENDS:${PN}-python += "python3-core" -FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*" - -do_configure:prepend() { - sh autogen.sh -} - -do_compile:prepend() { - # Make sure the recompile is OK - rm -f ${B}/.depend -} - -FILES:whiptail = "${bindir}/whiptail" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/newt/libnewt_0.52.23.bb b/poky/meta/recipes-extended/newt/libnewt_0.52.23.bb new file mode 100644 index 0000000000..cd3731cf74 --- /dev/null +++ b/poky/meta/recipes-extended/newt/libnewt_0.52.23.bb @@ -0,0 +1,56 @@ +SUMMARY = "A library for text mode user interfaces" + +DESCRIPTION = "Newt is a programming library for color text mode, widget based user \ +interfaces. Newt can be used to add stacked windows, entry widgets, \ +checkboxes, radio buttons, labels, plain text fields, scrollbars, \ +etc., to text mode user interfaces. This package also contains the \ +shared library needed by programs built with newt, as well as a \ +/usr/bin/dialog replacement called whiptail. Newt is based on the \ +slang library." + +HOMEPAGE = "https://releases.pagure.org/newt/" +SECTION = "libs" + +LICENSE = "LGPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" + +# slang needs to be >= 2.2 +DEPENDS = "slang popt python3" + +SRC_URI = "https://releases.pagure.org/newt/newt-${PV}.tar.gz \ + file://cross_ar.patch \ + file://Makefile.in-Add-tinfo-library-to-the-linking-librari.patch \ + file://0001-detect-gold-as-GNU-linker-too.patch \ + " + +SRC_URI[sha256sum] = "caa372907b14ececfe298f0d512a62f41d33b290610244a58aed07bbc5ada12a" + +S = "${WORKDIR}/newt-${PV}" + +inherit autotools-brokensep python3native python3-dir python3targetconfig + +EXTRA_OECONF = "--without-tcl --with-python" + +EXTRA_OEMAKE += "PYTHONVERS=${PYTHON_DIR}" + +CLEANBROKEN = "1" + +export CPPFLAGS + +PACKAGES:prepend = "whiptail ${PN}-python " + +RDEPENDS:${PN}-python += "python3-core" +FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}/*" + +do_configure:prepend() { + sh autogen.sh +} + +do_compile:prepend() { + # Make sure the recompile is OK + rm -f ${B}/.depend +} + +FILES:whiptail = "${bindir}/whiptail" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/pam/libpam/CVE-2022-28321-0002.patch b/poky/meta/recipes-extended/pam/libpam/CVE-2022-28321-0002.patch new file mode 100644 index 0000000000..e7bf03f9f7 --- /dev/null +++ b/poky/meta/recipes-extended/pam/libpam/CVE-2022-28321-0002.patch @@ -0,0 +1,205 @@ +From 23393bef92c1e768eda329813d7af55481c6ca9f Mon Sep 17 00:00:00 2001 +From: Thorsten Kukuk +Date: Thu, 24 Feb 2022 10:37:32 +0100 +Subject: [PATCH 2/2] pam_access: handle hostnames in access.conf + +According to the manual page, the following entry is valid but does not +work: +-:root:ALL EXCEPT localhost + +See https://bugzilla.suse.com/show_bug.cgi?id=1019866 + +Patched is based on PR#226 from Josef Moellers + +Upstream-Status: Backport +CVE: CVE-2022-28321 + +Reference to upstream patch: +[https://github.com/linux-pam/linux-pam/commit/23393bef92c1e768eda329813d7af55481c6ca9f] + +Signed-off-by: Stefan Ghinea +--- + modules/pam_access/pam_access.c | 95 ++++++++++++++++++++++++++------- + 1 file changed, 76 insertions(+), 19 deletions(-) + +diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c +index 277192b..bca424f 100644 +--- a/modules/pam_access/pam_access.c ++++ b/modules/pam_access/pam_access.c +@@ -637,7 +637,7 @@ remote_match (pam_handle_t *pamh, char *tok, struct login_info *item) + if ((str_len = strlen(string)) > tok_len + && strcasecmp(tok, string + str_len - tok_len) == 0) + return YES; +- } else if (tok[tok_len - 1] == '.') { ++ } else if (tok[tok_len - 1] == '.') { /* internet network numbers (end with ".") */ + struct addrinfo hint; + + memset (&hint, '\0', sizeof (hint)); +@@ -678,7 +678,7 @@ remote_match (pam_handle_t *pamh, char *tok, struct login_info *item) + return NO; + } + +- /* Assume network/netmask with an IP of a host. */ ++ /* Assume network/netmask, IP address or hostname. */ + return network_netmask_match(pamh, tok, string, item); + } + +@@ -696,7 +696,7 @@ string_match (pam_handle_t *pamh, const char *tok, const char *string, + /* + * If the token has the magic value "ALL" the match always succeeds. + * Otherwise, return YES if the token fully matches the string. +- * "NONE" token matches NULL string. ++ * "NONE" token matches NULL string. + */ + + if (strcasecmp(tok, "ALL") == 0) { /* all: always matches */ +@@ -714,7 +714,8 @@ string_match (pam_handle_t *pamh, const char *tok, const char *string, + + /* network_netmask_match - match a string against one token + * where string is a hostname or ip (v4,v6) address and tok +- * represents either a single ip (v4,v6) address or a network/netmask ++ * represents either a hostname, a single ip (v4,v6) address ++ * or a network/netmask + */ + static int + network_netmask_match (pam_handle_t *pamh, +@@ -723,10 +724,12 @@ network_netmask_match (pam_handle_t *pamh, + char *netmask_ptr; + char netmask_string[MAXHOSTNAMELEN + 1]; + int addr_type; ++ struct addrinfo *ai = NULL; + + if (item->debug) +- pam_syslog (pamh, LOG_DEBUG, ++ pam_syslog (pamh, LOG_DEBUG, + "network_netmask_match: tok=%s, item=%s", tok, string); ++ + /* OK, check if tok is of type addr/mask */ + if ((netmask_ptr = strchr(tok, '/')) != NULL) + { +@@ -760,54 +763,108 @@ network_netmask_match (pam_handle_t *pamh, + netmask_ptr = number_to_netmask(netmask, addr_type, + netmask_string, MAXHOSTNAMELEN); + } +- } ++ ++ /* ++ * Construct an addrinfo list from the IP address. ++ * This should not fail as the input is a correct IP address... ++ */ ++ if (getaddrinfo (tok, NULL, NULL, &ai) != 0) ++ { ++ return NO; ++ } ++ } + else +- /* NO, then check if it is only an addr */ +- if (isipaddr(tok, NULL, NULL) != YES) ++ { ++ /* ++ * It is either an IP address or a hostname. ++ * Let getaddrinfo sort everything out ++ */ ++ if (getaddrinfo (tok, NULL, NULL, &ai) != 0) + { ++ pam_syslog(pamh, LOG_ERR, "cannot resolve hostname \"%s\"", tok); ++ + return NO; + } ++ netmask_ptr = NULL; ++ } + + if (isipaddr(string, NULL, NULL) != YES) + { +- /* Assume network/netmask with a name of a host. */ + struct addrinfo hint; + ++ /* Assume network/netmask with a name of a host. */ + memset (&hint, '\0', sizeof (hint)); + hint.ai_flags = AI_CANONNAME; + hint.ai_family = AF_UNSPEC; + + if (item->gai_rv != 0) ++ { ++ freeaddrinfo(ai); + return NO; ++ } + else if (!item->res && + (item->gai_rv = getaddrinfo (string, NULL, &hint, &item->res)) != 0) ++ { ++ freeaddrinfo(ai); + return NO; ++ } + else + { + struct addrinfo *runp = item->res; ++ struct addrinfo *runp1; + + while (runp != NULL) + { + char buf[INET6_ADDRSTRLEN]; + +- DIAG_PUSH_IGNORE_CAST_ALIGN; +- inet_ntop (runp->ai_family, +- runp->ai_family == AF_INET +- ? (void *) &((struct sockaddr_in *) runp->ai_addr)->sin_addr +- : (void *) &((struct sockaddr_in6 *) runp->ai_addr)->sin6_addr, +- buf, sizeof (buf)); +- DIAG_POP_IGNORE_CAST_ALIGN; ++ if (getnameinfo (runp->ai_addr, runp->ai_addrlen, buf, sizeof (buf), NULL, 0, NI_NUMERICHOST) != 0) ++ { ++ freeaddrinfo(ai); ++ return NO; ++ } + +- if (are_addresses_equal(buf, tok, netmask_ptr)) ++ for (runp1 = ai; runp1 != NULL; runp1 = runp1->ai_next) + { +- return YES; ++ char buf1[INET6_ADDRSTRLEN]; ++ ++ if (runp->ai_family != runp1->ai_family) ++ continue; ++ ++ if (getnameinfo (runp1->ai_addr, runp1->ai_addrlen, buf1, sizeof (buf1), NULL, 0, NI_NUMERICHOST) != 0) ++ { ++ freeaddrinfo(ai); ++ return NO; ++ } ++ ++ if (are_addresses_equal (buf, buf1, netmask_ptr)) ++ { ++ freeaddrinfo(ai); ++ return YES; ++ } + } + runp = runp->ai_next; + } + } + } + else +- return (are_addresses_equal(string, tok, netmask_ptr)); ++ { ++ struct addrinfo *runp1; ++ ++ for (runp1 = ai; runp1 != NULL; runp1 = runp1->ai_next) ++ { ++ char buf1[INET6_ADDRSTRLEN]; ++ ++ (void) getnameinfo (runp1->ai_addr, runp1->ai_addrlen, buf1, sizeof (buf1), NULL, 0, NI_NUMERICHOST); ++ ++ if (are_addresses_equal(string, buf1, netmask_ptr)) ++ { ++ freeaddrinfo(ai); ++ return YES; ++ } ++ } ++ } ++ ++ freeaddrinfo(ai); + + return NO; + } +-- +2.37.3 + diff --git a/poky/meta/recipes-extended/psmisc/psmisc.inc b/poky/meta/recipes-extended/psmisc/psmisc.inc index 12539dad53..a429c2ee96 100644 --- a/poky/meta/recipes-extended/psmisc/psmisc.inc +++ b/poky/meta/recipes-extended/psmisc/psmisc.inc @@ -26,6 +26,7 @@ do_configure:prepend() { PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," +PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux" ALLOW_EMPTY:${PN} = "1" diff --git a/poky/meta/recipes-extended/psmisc/psmisc_23.5.bb b/poky/meta/recipes-extended/psmisc/psmisc_23.5.bb deleted file mode 100644 index 1c390f3615..0000000000 --- a/poky/meta/recipes-extended/psmisc/psmisc_23.5.bb +++ /dev/null @@ -1,9 +0,0 @@ -require psmisc.inc -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3" - -SRC_URI = "git://gitlab.com/psmisc/psmisc.git;protocol=https;branch=master \ - file://0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch \ - " -SRCREV = "17353f3fddef6b360bc47f7834f2cd011bea2b87" -S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-extended/psmisc/psmisc_23.6.bb b/poky/meta/recipes-extended/psmisc/psmisc_23.6.bb new file mode 100644 index 0000000000..2e55ad00bd --- /dev/null +++ b/poky/meta/recipes-extended/psmisc/psmisc_23.6.bb @@ -0,0 +1,9 @@ +require psmisc.inc +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3" + +SRC_URI = "git://gitlab.com/psmisc/psmisc.git;protocol=https;branch=master \ + file://0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch \ + " +SRCREV = "3098e641dc1ddb210186f53464255670b480377b" +S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-extended/quota/quota/0001-quota-Use-realloc-3-instead-of-reallocarray-3.patch b/poky/meta/recipes-extended/quota/quota/0001-quota-Use-realloc-3-instead-of-reallocarray-3.patch deleted file mode 100644 index 34ded2d857..0000000000 --- a/poky/meta/recipes-extended/quota/quota/0001-quota-Use-realloc-3-instead-of-reallocarray-3.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 02b222a335527f1031cc9495d8c5ebc1bc5b1d4e Mon Sep 17 00:00:00 2001 -From: Fabrice Fontaine -Date: Wed, 11 Nov 2020 15:00:47 +0100 -Subject: [PATCH] quota: Use realloc(3) instead of reallocarray(3) - -reallocarray(3) has been added to glibc relatively recently (version -2.26, from 2017) and apparently not all users run new enough glibc. Just -use realloc(3) for now since in this case there's no real risk of -overflow. - -Signed-off-by: Fabrice Fontaine -Signed-off-by: Jan Kara -Upstream-Status: Backport -Signed-off-by: Alexander Kanavin ---- - quota.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/quota.c b/quota.c -index a6ed61f..a60de12 100644 ---- a/quota.c -+++ b/quota.c -@@ -385,7 +385,7 @@ int main(int argc, char **argv) - break; - case 259: - fscount++; -- fsnames = reallocarray(fsnames, fscount, sizeof(char *)); -+ fsnames = realloc(fsnames, fscount * sizeof(char *)); - if (!fsnames) - die(1, _("Not enough memory for filesystem names")); - fsnames[fscount - 1] = optarg; --- -2.17.1 - diff --git a/poky/meta/recipes-extended/quota/quota/fcntl.patch b/poky/meta/recipes-extended/quota/quota/fcntl.patch index 51a770ce6e..09a0c687b6 100644 --- a/poky/meta/recipes-extended/quota/quota/fcntl.patch +++ b/poky/meta/recipes-extended/quota/quota/fcntl.patch @@ -1,3 +1,8 @@ +From 00a456145531d194d3993c9f4cd404d5ca16c9df Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 6 Apr 2015 17:36:44 +0000 +Subject: [PATCH] quota: Fix build with musl + Include fcntl.h to pacify compiler errors on musl like @@ -9,20 +14,14 @@ Upstream-Status: Pending Signed-off-by: Khem Raj -diff --git a/quota.h b/quota.h -index 4c21411..d20c217 100644 ---- a/quota.h -+++ b/quota.h -@@ -182,6 +182,6 @@ enum { - #endif - #endif - --long quotactl __P((int, const char *, qid_t, caddr_t)); -+long quotactl (int, const char *, qid_t, caddr_t); - - #endif /* _QUOTA_ */ +--- + quotacheck.c | 1 + + quotaio.c | 1 + + rquota_client.c | 4 ++++ + 3 files changed, 6 insertions(+) + diff --git a/quotacheck.c b/quotacheck.c -index 2cdf475..07c18a7 100644 +index bd62d9a..772a27d 100644 --- a/quotacheck.c +++ b/quotacheck.c @@ -19,6 +19,7 @@ @@ -46,7 +45,7 @@ index 94ae458..d57fc1a 100644 #include #include diff --git a/rquota_client.c b/rquota_client.c -index a3a4ae3..0ffe7a9 100644 +index 7f8e821..d48505a 100644 --- a/rquota_client.c +++ b/rquota_client.c @@ -19,7 +19,9 @@ diff --git a/poky/meta/recipes-extended/quota/quota_4.06.bb b/poky/meta/recipes-extended/quota/quota_4.06.bb deleted file mode 100644 index 0535d14c20..0000000000 --- a/poky/meta/recipes-extended/quota/quota_4.06.bb +++ /dev/null @@ -1,35 +0,0 @@ -SUMMARY = "Tools for monitoring & limiting user disk usage per filesystem" -SECTION = "base" -HOMEPAGE = "http://sourceforge.net/projects/linuxquota/" -DESCRIPTION = "Tools and patches for the Linux Diskquota system as part of the Linux kernel" -BUGTRACKER = "http://sourceforge.net/tracker/?group_id=18136&atid=118136" -LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://rquota_server.c;beginline=1;endline=20;md5=fe7e0d7e11c6f820f8fa62a5af71230f \ - file://svc_socket.c;beginline=1;endline=17;md5=24d5a8792da45910786eeac750be8ceb" - -SRC_URI = "${SOURCEFORGE_MIRROR}/project/linuxquota/quota-tools/${PV}/quota-${PV}.tar.gz \ - file://fcntl.patch \ - file://0001-quota-Use-realloc-3-instead-of-reallocarray-3.patch \ - " -SRC_URI[sha256sum] = "2f3e03039f378d4f0d97acdb49daf581dcaad64d2e1ddf129495fd579fbd268d" - -CVE_PRODUCT = "linux_diskquota" - -UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/linuxquota/files/quota-tools/" -UPSTREAM_CHECK_REGEX = "/quota-tools/(?P(\d+[\.\-_]*)+)/" - -DEPENDS = "gettext-native e2fsprogs libnl dbus" - -inherit autotools-brokensep gettext pkgconfig - -CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'rpc', '-I${STAGING_INCDIR}/tirpc', '', d)}" -LDFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'rpc', '-ltirpc', '', d)}" -ASNEEDED = "" - -PACKAGECONFIG ??= "tcp-wrappers rpc bsd" -PACKAGECONFIG:libc-musl = "tcp-wrappers rpc" - -PACKAGECONFIG[tcp-wrappers] = "--enable-libwrap,--disable-libwrap,tcp-wrappers" -PACKAGECONFIG[rpc] = "--enable-rpc,--disable-rpc,libtirpc" -PACKAGECONFIG[bsd] = "--enable-bsd_behaviour=yes,--enable-bsd_behaviour=no," -PACKAGECONFIG[ldapmail] = "--enable-ldapmail,--disable-ldapmail,openldap" diff --git a/poky/meta/recipes-extended/quota/quota_4.09.bb b/poky/meta/recipes-extended/quota/quota_4.09.bb new file mode 100644 index 0000000000..b779657dfc --- /dev/null +++ b/poky/meta/recipes-extended/quota/quota_4.09.bb @@ -0,0 +1,34 @@ +SUMMARY = "Tools for monitoring & limiting user disk usage per filesystem" +SECTION = "base" +HOMEPAGE = "http://sourceforge.net/projects/linuxquota/" +DESCRIPTION = "Tools and patches for the Linux Diskquota system as part of the Linux kernel" +BUGTRACKER = "http://sourceforge.net/tracker/?group_id=18136&atid=118136" +LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://rquota_server.c;beginline=1;endline=20;md5=fe7e0d7e11c6f820f8fa62a5af71230f \ + file://svc_socket.c;beginline=1;endline=17;md5=24d5a8792da45910786eeac750be8ceb" + +SRC_URI = "${SOURCEFORGE_MIRROR}/project/linuxquota/quota-tools/${PV}/quota-${PV}.tar.gz \ + file://fcntl.patch \ + " +SRC_URI[sha256sum] = "9cdaca154bc92afc3117f0e5f5b3208dd5f84583af1cf061c39baa0a2bb142f9" + +CVE_PRODUCT = "linux_diskquota" + +UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/linuxquota/files/quota-tools/" +UPSTREAM_CHECK_REGEX = "/quota-tools/(?P(\d+[\.\-_]*)+)/" + +DEPENDS = "gettext-native e2fsprogs libnl dbus" + +inherit autotools-brokensep gettext pkgconfig + +CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'rpc', '-I${STAGING_INCDIR}/tirpc', '', d)}" +LDFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'rpc', '-ltirpc', '', d)}" +ASNEEDED = "" + +PACKAGECONFIG ??= "tcp-wrappers rpc bsd" +PACKAGECONFIG:libc-musl = "tcp-wrappers rpc" + +PACKAGECONFIG[tcp-wrappers] = "--enable-libwrap,--disable-libwrap,tcp-wrappers" +PACKAGECONFIG[rpc] = "--enable-rpc,--disable-rpc,libtirpc" +PACKAGECONFIG[bsd] = "--enable-bsd_behaviour=yes,--enable-bsd_behaviour=no," +PACKAGECONFIG[ldapmail] = "--enable-ldapmail,--disable-ldapmail,openldap" diff --git a/poky/meta/recipes-extended/rpcsvc-proto/rpcsvc-proto.bb b/poky/meta/recipes-extended/rpcsvc-proto/rpcsvc-proto.bb index dd7bd2b1be..00919a3d70 100644 --- a/poky/meta/recipes-extended/rpcsvc-proto/rpcsvc-proto.bb +++ b/poky/meta/recipes-extended/rpcsvc-proto/rpcsvc-proto.bb @@ -21,7 +21,8 @@ SRCREV = "71e0a12c04d130a78674ac6309eefffa6ecee612" SRC_URI = "git://github.com/thkukuk/${BPN};branch=master;protocol=https \ file://0001-Use-cross-compiled-rpcgen.patch \ - " + file://0001-Use-AC_SYS_LARGEFILE-macro-to-control-largefile-supp.patch \ + " S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-extended/rpcsvc-proto/rpcsvc-proto/0001-Use-AC_SYS_LARGEFILE-macro-to-control-largefile-supp.patch b/poky/meta/recipes-extended/rpcsvc-proto/rpcsvc-proto/0001-Use-AC_SYS_LARGEFILE-macro-to-control-largefile-supp.patch new file mode 100644 index 0000000000..f07866d55a --- /dev/null +++ b/poky/meta/recipes-extended/rpcsvc-proto/rpcsvc-proto/0001-Use-AC_SYS_LARGEFILE-macro-to-control-largefile-supp.patch @@ -0,0 +1,80 @@ +From 6820c53c3952f78185beb59f767c372fc745dcf3 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 11 Dec 2022 21:42:59 -0800 +Subject: [PATCH] Use AC_SYS_LARGEFILE macro to control largefile support + +The autoconf macro AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS=64 +where necessary to ensure that off_t and all interfaces using off_t +are 64bit, even on 32bit systems. + +replace stat64 by equivalent stat struct/func + +Upstream-Status: Accepted [https://github.com/thkukuk/rpcsvc-proto/pull/15] +Signed-off-by: Khem Raj +--- + configure.ac | 1 + + rpcgen/rpc_main.c | 16 +++++----------- + 2 files changed, 6 insertions(+), 11 deletions(-) + +diff --git a/configure.ac b/configure.ac +index bacc2fb..a9fc730 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -8,6 +8,7 @@ AC_PREFIX_DEFAULT(/usr) + AC_SUBST(PACKAGE) + AC_SUBST(VERSION) + ++AC_SYS_LARGEFILE + AC_PROG_CC + AC_GNU_SOURCE + AM_PROG_CC_C_O +diff --git a/rpcgen/rpc_main.c b/rpcgen/rpc_main.c +index 277adc6..fd7dea9 100644 +--- a/rpcgen/rpc_main.c ++++ b/rpcgen/rpc_main.c +@@ -62,12 +62,6 @@ + #define EXTEND 1 /* alias for TRUE */ + #define DONT_EXTEND 0 /* alias for FALSE */ + +-#ifdef __APPLE__ +-# if __DARWIN_ONLY_64_BIT_INO_T +-# define stat64 stat +-# endif +-#endif +- + struct commandline + { + int cflag; /* xdr C routines */ +@@ -337,9 +331,9 @@ clear_args (void) + static void + find_cpp (void) + { +- struct stat64 buf; ++ struct stat buf; + +- if (stat64 (CPP, &buf) == 0) ++ if (stat (CPP, &buf) == 0) + return; + + if (cppDefined) /* user specified cpp but it does not exist */ +@@ -1125,17 +1119,17 @@ putarg (int whereto, const char *cp) + static void + checkfiles (const char *infile, const char *outfile) + { +- struct stat64 buf; ++ struct stat buf; + + if (infile) /* infile ! = NULL */ +- if (stat64 (infile, &buf) < 0) ++ if (stat (infile, &buf) < 0) + { + perror (infile); + crash (); + } + if (outfile) + { +- if (stat64 (outfile, &buf) < 0) ++ if (stat (outfile, &buf) < 0) + return; /* file does not exist */ + else + { diff --git a/poky/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch b/poky/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch index 628db42136..fa1532c831 100644 --- a/poky/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch +++ b/poky/meta/recipes-extended/shadow/files/0001-Disable-use-of-syslog-for-sysroot.patch @@ -1,4 +1,4 @@ -From 8b845fff891798a03bdf21354b52e4487c2c0200 Mon Sep 17 00:00:00 2001 +From 85d0444229ee3d14fefcf10d093f49c862826f82 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 14 Apr 2022 23:11:53 +0000 Subject: [PATCH] Disable use of syslog for shadow-native tools @@ -17,10 +17,10 @@ Signed-off-by: Peter Kjellerstedt 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 5dcae19..b2c58f5 100644 +index 924254a..603af81 100644 --- a/configure.ac +++ b/configure.ac -@@ -204,7 +204,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd", +@@ -191,7 +191,7 @@ AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd", [Path to passwd program.]) dnl XXX - quick hack, should disappear before anyone notices :). diff --git a/poky/meta/recipes-extended/shadow/files/0001-Drop-nsswitch.conf-message-when-not-in-place-eg.-musl.patch b/poky/meta/recipes-extended/shadow/files/0001-Drop-nsswitch.conf-message-when-not-in-place-eg.-musl.patch deleted file mode 100644 index 21c9a1415c..0000000000 --- a/poky/meta/recipes-extended/shadow/files/0001-Drop-nsswitch.conf-message-when-not-in-place-eg.-musl.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 11290e897a49adddee215833944a518443d9b0d6 Mon Sep 17 00:00:00 2001 -From: Andrei Gherzan -Date: Wed, 24 Aug 2022 00:54:47 +0200 -Subject: [PATCH] Drop nsswitch.conf message when not in place - eg. musl - -Upstream-Status: Inappropriate [issue reported at https://github.com/shadow-maint/shadow/issues/557] -Signed-off-by: Andrei Gherzan ---- - lib/nss.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/nss.c b/lib/nss.c -index 06fa48e..44245da 100644 ---- a/lib/nss.c -+++ b/lib/nss.c -@@ -59,7 +59,7 @@ void nss_init(const char *nsswitch_path) { - // subid: files - nssfp = fopen(nsswitch_path, "r"); - if (!nssfp) { -- fprintf(shadow_logfd, "Failed opening %s: %m\n", nsswitch_path); -+ //fprintf(shadow_logfd, "Failed opening %s: %m\n", nsswitch_path); - atomic_store(&nss_init_completed, true); - return; - } --- -2.25.1 - diff --git a/poky/meta/recipes-extended/shadow/files/0001-shadow-use-relaxed-usernames.patch b/poky/meta/recipes-extended/shadow/files/0001-shadow-use-relaxed-usernames.patch deleted file mode 100644 index 6c7abcef1d..0000000000 --- a/poky/meta/recipes-extended/shadow/files/0001-shadow-use-relaxed-usernames.patch +++ /dev/null @@ -1,104 +0,0 @@ -From b182c52d63bea0f08e1befcec5c3797dd97cdef5 Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Tue, 16 Aug 2022 13:46:22 +0200 -Subject: [PATCH] shadow: use relaxed usernames - -The groupadd from shadow does not allow upper case group names, the -same is true for the upstream shadow. But distributions like -Debian/Ubuntu/CentOS has their own way to cope with this problem, -this patch is picked up from CentOS release 7.0 to relax the usernames -restrictions to allow the upper case group names, and the relaxation is -POSIX compliant because POSIX indicate that usernames are composed of -characters from the portable filename character set [A-Za-z0-9._-]. - -Upstream-Status: Submitted [https://github.com/shadow-maint/shadow/pull/551] - -Signed-off-by: Shan Hai -Signed-off-by: Alexander Kanavin ---- - libmisc/chkname.c | 29 ++++++++++++++++++----------- - man/groupadd.8.xml | 6 ------ - man/useradd.8.xml | 6 ------ - 3 files changed, 18 insertions(+), 23 deletions(-) - -diff --git a/libmisc/chkname.c b/libmisc/chkname.c -index cb002a14..c0306c5a 100644 ---- a/libmisc/chkname.c -+++ b/libmisc/chkname.c -@@ -32,21 +32,28 @@ static bool is_valid_name (const char *name) - } - - /* -- * User/group names must match [a-z_][a-z0-9_-]*[$] -- */ -- -- if (('\0' == *name) || -- !((('a' <= *name) && ('z' >= *name)) || ('_' == *name))) { -+ * User/group names must match gnu e-regex: -+ * [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]? -+ * -+ * as a non-POSIX, extension, allow "$" as the last char for -+ * sake of Samba 3.x "add machine script" -+ */ -+ if ( ('\0' == *name) || -+ !((*name >= 'a' && *name <= 'z') || -+ (*name >= 'A' && *name <= 'Z') || -+ (*name >= '0' && *name <= '9') || -+ (*name == '_') || (*name == '.') -+ )) { - return false; - } - - while ('\0' != *++name) { -- if (!(( ('a' <= *name) && ('z' >= *name) ) || -- ( ('0' <= *name) && ('9' >= *name) ) || -- ('_' == *name) || -- ('-' == *name) || -- ( ('$' == *name) && ('\0' == *(name + 1)) ) -- )) { -+ if (!( (*name >= 'a' && *name <= 'z') || -+ (*name >= 'A' && *name <= 'Z') || -+ (*name >= '0' && *name <= '9') || -+ (*name == '_') || (*name == '.') || (*name == '-') || -+ (*name == '$' && *(name + 1) == '\0') -+ )) { - return false; - } - } -diff --git a/man/groupadd.8.xml b/man/groupadd.8.xml -index 26671f92..3eacaa09 100644 ---- a/man/groupadd.8.xml -+++ b/man/groupadd.8.xml -@@ -63,12 +63,6 @@ - values from the system. The new group will be entered into the system - files as needed. - -- -- Groupnames must start with a lower case letter or an underscore, -- followed by lower case letters, digits, underscores, or dashes. -- They can end with a dollar sign. -- In regular expression terms: [a-z_][a-z0-9_-]*[$]? -- - - Groupnames may only be up to &GROUP_NAME_MAX_LENGTH; characters long. - -diff --git a/man/useradd.8.xml b/man/useradd.8.xml -index c7f95b47..e056d141 100644 ---- a/man/useradd.8.xml -+++ b/man/useradd.8.xml -@@ -691,12 +691,6 @@ - the user account creation request. - - -- -- Usernames must start with a lower case letter or an underscore, -- followed by lower case letters, digits, underscores, or dashes. -- They can end with a dollar sign. -- In regular expression terms: [a-z_][a-z0-9_-]*[$]? -- - - Usernames may only be up to 32 characters long. - --- -2.30.2 - diff --git a/poky/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch b/poky/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch index 173e8a937d..85d9175105 100644 --- a/poky/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch +++ b/poky/meta/recipes-extended/shadow/files/commonio.c-fix-unexpected-open-failure-in-chroot-env.patch @@ -1,4 +1,4 @@ -From d767f776e631f1493fd7b266f2026d630ecf70fe Mon Sep 17 00:00:00 2001 +From 21583da072aa66901d859ac00ce209bac87ddecc Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Thu, 17 Jul 2014 15:53:34 +0800 Subject: [PATCH] commonio.c-fix-unexpected-open-failure-in-chroot-env @@ -21,10 +21,10 @@ Signed-off-by: Chen Qi 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/commonio.c b/lib/commonio.c -index 9e0fde6..7c3a1da 100644 +index 9a02ce1..61384ec 100644 --- a/lib/commonio.c +++ b/lib/commonio.c -@@ -624,10 +624,18 @@ int commonio_open (struct commonio_db *db, int mode) +@@ -616,10 +616,18 @@ int commonio_open (struct commonio_db *db, int mode) db->cursor = NULL; db->changed = false; diff --git a/poky/meta/recipes-extended/shadow/shadow.inc b/poky/meta/recipes-extended/shadow/shadow.inc index 5656a375b7..2c70a2d00e 100644 --- a/poky/meta/recipes-extended/shadow/shadow.inc +++ b/poky/meta/recipes-extended/shadow/shadow.inc @@ -12,7 +12,6 @@ DEPENDS = "virtual/crypt" GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases" SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \ - file://0001-shadow-use-relaxed-usernames.patch \ ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \ file://useradd \ " @@ -25,12 +24,11 @@ SRC_URI:append:class-target = " \ SRC_URI:append:class-native = " \ file://0001-Disable-use-of-syslog-for-sysroot.patch \ file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \ - file://0001-Drop-nsswitch.conf-message-when-not-in-place-eg.-musl.patch \ " SRC_URI:append:class-nativesdk = " \ file://0001-Disable-use-of-syslog-for-sysroot.patch \ " -SRC_URI[sha256sum] = "f525154adc5605e4ebf03d3e7ee8be4d7f3c7cf9df2c2244043406b6eefca2da" +SRC_URI[sha256sum] = "813057047499c7fe81108adcf0cffa3ad4ec75e19a80151f9cbaa458ff2e86cd" # Additional Policy files for PAM diff --git a/poky/meta/recipes-extended/shadow/shadow_4.12.3.bb b/poky/meta/recipes-extended/shadow/shadow_4.12.3.bb deleted file mode 100644 index 40b11345c9..0000000000 --- a/poky/meta/recipes-extended/shadow/shadow_4.12.3.bb +++ /dev/null @@ -1,11 +0,0 @@ -require shadow.inc - -# Build falsely assumes that if --enable-libpam is set, we don't need to link against -# libcrypt. This breaks chsh. -BUILD_LDFLAGS:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-lcrypt', '', d)}" - -BBCLASSEXTEND = "native nativesdk" - -# Severity is low and marked as closed and won't fix. -# https://bugzilla.redhat.com/show_bug.cgi?id=884658 -CVE_CHECK_IGNORE += "CVE-2013-4235" diff --git a/poky/meta/recipes-extended/shadow/shadow_4.13.bb b/poky/meta/recipes-extended/shadow/shadow_4.13.bb new file mode 100644 index 0000000000..40b11345c9 --- /dev/null +++ b/poky/meta/recipes-extended/shadow/shadow_4.13.bb @@ -0,0 +1,11 @@ +require shadow.inc + +# Build falsely assumes that if --enable-libpam is set, we don't need to link against +# libcrypt. This breaks chsh. +BUILD_LDFLAGS:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '-lcrypt', '', d)}" + +BBCLASSEXTEND = "native nativesdk" + +# Severity is low and marked as closed and won't fix. +# https://bugzilla.redhat.com/show_bug.cgi?id=884658 +CVE_CHECK_IGNORE += "CVE-2013-4235" diff --git a/poky/meta/recipes-extended/stress-ng/stress-ng/0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch b/poky/meta/recipes-extended/stress-ng/stress-ng/0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch new file mode 100644 index 0000000000..821e4d910f --- /dev/null +++ b/poky/meta/recipes-extended/stress-ng/stress-ng/0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch @@ -0,0 +1,65 @@ +From 32386c13420f676bd938a8b1ceaeab8a5da46d17 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 3 Jan 2023 11:00:09 -0800 +Subject: [PATCH] Pass LD_GOLD=1 via makefile to enable gold linker + +Current logic prefers gold if a toolchain has gold linker installed and +does not offer any option to chose default linker which might not be +gold linker. Its better to pass this control to user instead of auto +detecting and deciding. + +Upstream-Status: Submitted [https://github.com/ColinIanKing/stress-ng/pull/251] +Signed-off-by: Khem Raj +--- + Makefile | 7 +++++++ + Makefile.config | 9 +-------- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/Makefile b/Makefile +index f2fd4b6c..bff6b8ac 100644 +--- a/Makefile ++++ b/Makefile +@@ -69,6 +69,13 @@ endif + #CFLAGS += -Weverything + #endif + ++# ++# Use gold linker ++# ++ifeq ($(LD_GOLD),1) ++LDFLAGS += -fuse-ld=gold ++endif ++ + GREP = grep + # + # SunOS requires special grep for -e support +diff --git a/Makefile.config b/Makefile.config +index 394ed20d..48c94fa1 100644 +--- a/Makefile.config ++++ b/Makefile.config +@@ -241,7 +241,7 @@ define check_ld + $(call check_ld_tmp,$1,$2,$3) + endef + +-all: linkers libraries headers cpufeatures types functions ++all: libraries headers cpufeatures types functions + @for I in $$(ls $(CONFIGS)); do \ + if [ -s $(CONFIGS)/$$I ]; then \ + echo "#define $$I"; \ +@@ -262,13 +262,6 @@ configdir: + clean: + @rm -rf $(CONFIGS) config config.h + +-linkers: \ +- configdir \ +- LD_GOLD +- +-LD_GOLD: +- $(call check_ld,test-ld,HAVE_LD_GOLD,gold) +- + libraries: \ + configdir \ + LIB_AIO LIB_APPARMOR LIB_BSD LIB_CRYPT LIB_DL \ +-- +2.39.0 + diff --git a/poky/meta/recipes-extended/stress-ng/stress-ng_0.14.06.bb b/poky/meta/recipes-extended/stress-ng/stress-ng_0.14.06.bb deleted file mode 100644 index b4068b0598..0000000000 --- a/poky/meta/recipes-extended/stress-ng/stress-ng_0.14.06.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "System load testing utility" -DESCRIPTION = "Deliberately simple workload generator for POSIX systems. It \ -imposes a configurable amount of CPU, memory, I/O, and disk stress on the system." -HOMEPAGE = "https://github.com/ColinIanKing/stress-ng#readme" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -SRC_URI = "git://github.com/ColinIanKing/stress-ng.git;protocol=https;branch=master" -SRCREV = "03493cb69e91c29718ff9f645514355cd99762c6" -S = "${WORKDIR}/git" - -DEPENDS = "coreutils-native" - -PROVIDES = "stress" -RPROVIDES:${PN} = "stress" -RREPLACES:${PN} = "stress" -RCONFLICTS:${PN} = "stress" - -inherit bash-completion - -EXTRA_OEMAKE = "VERBOSE=1" - -do_configure() { - mkdir -p configs - touch configs/HAVE_APPARMOR - oe_runmake makeconfig -} - -do_install() { - oe_runmake DESTDIR=${D} BINDIR=${bindir} install - ln -s stress-ng ${D}${bindir}/stress -} diff --git a/poky/meta/recipes-extended/stress-ng/stress-ng_0.15.01.bb b/poky/meta/recipes-extended/stress-ng/stress-ng_0.15.01.bb new file mode 100644 index 0000000000..0d95cad69f --- /dev/null +++ b/poky/meta/recipes-extended/stress-ng/stress-ng_0.15.01.bb @@ -0,0 +1,33 @@ +SUMMARY = "System load testing utility" +DESCRIPTION = "Deliberately simple workload generator for POSIX systems. It \ +imposes a configurable amount of CPU, memory, I/O, and disk stress on the system." +HOMEPAGE = "https://github.com/ColinIanKing/stress-ng#readme" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +SRC_URI = "git://github.com/ColinIanKing/stress-ng.git;protocol=https;branch=master \ + file://0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch" +SRCREV = "8c7c3d95555c50148470553b55477db895a4f1ad" +S = "${WORKDIR}/git" + +DEPENDS = "coreutils-native libbsd" + +PROVIDES = "stress" +RPROVIDES:${PN} = "stress" +RREPLACES:${PN} = "stress" +RCONFLICTS:${PN} = "stress" + +inherit bash-completion + +EXTRA_OEMAKE = "VERBOSE=1" + +do_configure() { + mkdir -p configs + touch configs/HAVE_APPARMOR + oe_runmake makeconfig +} + +do_install() { + oe_runmake DESTDIR=${D} BINDIR=${bindir} install + ln -s stress-ng ${D}${bindir}/stress +} diff --git a/poky/meta/recipes-extended/sudo/sudo.inc b/poky/meta/recipes-extended/sudo/sudo.inc index fd5bbf103d..498d60d534 100644 --- a/poky/meta/recipes-extended/sudo/sudo.inc +++ b/poky/meta/recipes-extended/sudo/sudo.inc @@ -23,6 +23,8 @@ inherit autotools PACKAGECONFIG ??= "" PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib" PACKAGECONFIG[pam-wheel] = ",,,pam-plugin-wheel" +PACKAGECONFIG[audit] = "--with-linux-audit,--without-linux-audit,audit" +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" EXTRA_OECONF = "--with-editor=${base_bindir}/vi --with-env-editor" diff --git a/poky/meta/recipes-extended/texinfo/texinfo/0001-gnulib-Update.patch b/poky/meta/recipes-extended/texinfo/texinfo/0001-gnulib-Update.patch deleted file mode 100644 index 470212cabd..0000000000 --- a/poky/meta/recipes-extended/texinfo/texinfo/0001-gnulib-Update.patch +++ /dev/null @@ -1,11765 +0,0 @@ -From 4908050c39dbcdcbd59955ea23d692f25f342307 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 7 Jul 2021 13:42:35 -0700 -Subject: [PATCH] gnulib: Update - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - gnulib/lib/Makefile.am | 782 +++++++++++-------- - gnulib/lib/_Noreturn.h | 8 +- - gnulib/lib/alloca.in.h | 20 +- - gnulib/lib/arg-nonnull.h | 8 +- - gnulib/lib/argz.c | 16 +- - gnulib/lib/argz.in.h | 14 +- - gnulib/lib/asnprintf.c | 16 +- - gnulib/lib/asprintf.c | 16 +- - gnulib/lib/attribute.h | 16 +- - gnulib/lib/basename-lgpl.c | 14 +- - gnulib/lib/basename-lgpl.h | 26 +- - gnulib/lib/btowc.c | 14 +- - gnulib/lib/c++defs.h | 8 +- - gnulib/lib/calloc.c | 55 ++ - gnulib/lib/cdefs.h | 26 +- - gnulib/lib/cloexec.c | 18 +- - gnulib/lib/cloexec.h | 18 +- - gnulib/lib/close.c | 14 +- - gnulib/lib/dup2.c | 14 +- - gnulib/lib/dynarray.h | 24 +- - gnulib/lib/errno.in.h | 16 +- - gnulib/lib/error.c | 14 +- - gnulib/lib/error.h | 14 +- - gnulib/lib/exitfail.c | 14 +- - gnulib/lib/exitfail.h | 14 +- - gnulib/lib/fcntl.c | 14 +- - gnulib/lib/fcntl.in.h | 14 +- - gnulib/lib/fd-hook.c | 16 +- - gnulib/lib/fd-hook.h | 16 +- - gnulib/lib/filename.h | 8 +- - gnulib/lib/float+.h | 16 +- - gnulib/lib/float.c | 14 +- - gnulib/lib/float.in.h | 14 +- - gnulib/lib/free.c | 53 ++ - gnulib/lib/fstat.c | 14 +- - gnulib/lib/getdtablesize.c | 14 +- - gnulib/lib/getopt-cdefs.in.h | 21 +- - gnulib/lib/getopt-core.h | 8 +- - gnulib/lib/getopt-ext.h | 8 +- - gnulib/lib/getopt-pfx-core.h | 21 +- - gnulib/lib/getopt-pfx-ext.h | 21 +- - gnulib/lib/getopt.c | 8 +- - gnulib/lib/getopt.in.h | 24 +- - gnulib/lib/getopt1.c | 8 +- - gnulib/lib/getopt_int.h | 8 +- - gnulib/lib/getprogname.c | 18 +- - gnulib/lib/getprogname.h | 8 +- - gnulib/lib/gettext.h | 16 +- - gnulib/lib/glthread/lock.c | 16 +- - gnulib/lib/glthread/lock.h | 16 +- - gnulib/lib/glthread/threadlib.c | 16 +- - gnulib/lib/hard-locale.c | 14 +- - gnulib/lib/hard-locale.h | 14 +- - gnulib/lib/ialloc.c | 21 + - gnulib/lib/ialloc.h | 94 +++ - gnulib/lib/idx.h | 114 +++ - gnulib/lib/intprops.h | 26 +- - gnulib/lib/inttypes.in.h | 14 +- - gnulib/lib/iswblank.c | 16 +- - gnulib/lib/iswdigit.c | 16 +- - gnulib/lib/iswxdigit.c | 16 +- - gnulib/lib/itold.c | 14 +- - gnulib/lib/langinfo.in.h | 16 +- - gnulib/lib/lc-charset-dispatch.c | 14 +- - gnulib/lib/lc-charset-dispatch.h | 14 +- - gnulib/lib/libc-config.h | 25 +- - gnulib/lib/limits.in.h | 16 +- - gnulib/lib/localcharset.c | 16 +- - gnulib/lib/localcharset.h | 16 +- - gnulib/lib/locale.in.h | 14 +- - gnulib/lib/localeconv.c | 14 +- - gnulib/lib/malloc.c | 51 +- - gnulib/lib/malloc/dynarray-skeleton.c | 8 +- - gnulib/lib/malloc/dynarray.h | 8 +- - gnulib/lib/malloc/dynarray_at_failure.c | 8 +- - gnulib/lib/malloc/dynarray_emplace_enlarge.c | 8 +- - gnulib/lib/malloc/dynarray_finalize.c | 8 +- - gnulib/lib/malloc/dynarray_resize.c | 8 +- - gnulib/lib/malloc/dynarray_resize_clear.c | 8 +- - gnulib/lib/malloca.c | 24 +- - gnulib/lib/malloca.h | 21 +- - gnulib/lib/mbchar.c | 14 +- - gnulib/lib/mbchar.h | 14 +- - gnulib/lib/mbiter.c | 18 + - gnulib/lib/mbiter.h | 14 +- - gnulib/lib/mbrtowc-impl-utf8.h | 16 +- - gnulib/lib/mbrtowc-impl.h | 14 +- - gnulib/lib/mbrtowc.c | 14 +- - gnulib/lib/mbscasecmp.c | 14 +- - gnulib/lib/mbschr.c | 14 +- - gnulib/lib/mbsinit.c | 14 +- - gnulib/lib/mbslen.c | 14 +- - gnulib/lib/mbsncasecmp.c | 14 +- - gnulib/lib/mbsstr.c | 14 +- - gnulib/lib/mbtowc-impl.h | 14 +- - gnulib/lib/mbtowc-lock.c | 14 +- - gnulib/lib/mbtowc-lock.h | 14 +- - gnulib/lib/mbtowc.c | 14 +- - gnulib/lib/mbuiter.c | 17 + - gnulib/lib/mbuiter.h | 14 +- - gnulib/lib/memchr.c | 24 +- - gnulib/lib/memchr.valgrind | 14 +- - gnulib/lib/mempcpy.c | 16 +- - gnulib/lib/memrchr.c | 14 +- - gnulib/lib/minmax.h | 60 ++ - gnulib/lib/msvc-inval.c | 16 +- - gnulib/lib/msvc-inval.h | 16 +- - gnulib/lib/msvc-nothrow.c | 16 +- - gnulib/lib/msvc-nothrow.h | 16 +- - gnulib/lib/nl_langinfo-lock.c | 14 +- - gnulib/lib/nl_langinfo.c | 14 +- - gnulib/lib/open.c | 14 +- - gnulib/lib/pathmax.h | 16 +- - gnulib/lib/printf-args.c | 16 +- - gnulib/lib/printf-args.h | 16 +- - gnulib/lib/printf-parse.c | 27 +- - gnulib/lib/printf-parse.h | 16 +- - gnulib/lib/realloc.c | 63 ++ - gnulib/lib/reallocarray.c | 39 + - gnulib/lib/regcomp.c | 8 +- - gnulib/lib/regex.c | 8 +- - gnulib/lib/regex.h | 8 +- - gnulib/lib/regex_internal.c | 8 +- - gnulib/lib/regex_internal.h | 8 +- - gnulib/lib/regexec.c | 20 +- - gnulib/lib/setlocale-lock.c | 14 +- - gnulib/lib/setlocale_null.c | 14 +- - gnulib/lib/setlocale_null.h | 14 +- - gnulib/lib/size_max.h | 16 +- - gnulib/lib/stat-time.c | 18 + - gnulib/lib/stat-time.h | 14 +- - gnulib/lib/stat-w32.c | 14 +- - gnulib/lib/stat-w32.h | 14 +- - gnulib/lib/stat.c | 14 +- - gnulib/lib/stdarg.in.h | 16 +- - gnulib/lib/stdbool.in.h | 16 +- - gnulib/lib/stddef.in.h | 16 +- - gnulib/lib/stdint.in.h | 20 +- - gnulib/lib/stdio.in.h | 24 +- - gnulib/lib/stdlib.in.h | 146 +++- - gnulib/lib/stpcpy.c | 14 +- - gnulib/lib/str-kmp.h | 26 +- - gnulib/lib/str-two-way.h | 16 +- - gnulib/lib/strcasecmp.c | 16 +- - gnulib/lib/strcasestr.c | 16 +- - gnulib/lib/strdup.c | 16 +- - gnulib/lib/streq.h | 16 +- - gnulib/lib/strerror-override.c | 100 +-- - gnulib/lib/strerror-override.h | 15 +- - gnulib/lib/strerror.c | 14 +- - gnulib/lib/string.in.h | 18 +- - gnulib/lib/strings.in.h | 16 +- - gnulib/lib/strncasecmp.c | 16 +- - gnulib/lib/strndup.c | 16 +- - gnulib/lib/strnlen.c | 16 +- - gnulib/lib/strnlen1.c | 14 +- - gnulib/lib/strnlen1.h | 14 +- - gnulib/lib/strstr.c | 16 +- - gnulib/lib/sys_stat.in.h | 16 +- - gnulib/lib/sys_types.in.h | 16 +- - gnulib/lib/time.in.h | 58 +- - gnulib/lib/unistd.c | 18 + - gnulib/lib/unistd.in.h | 29 +- - gnulib/lib/unitypes.in.h | 16 +- - gnulib/lib/uniwidth.in.h | 16 +- - gnulib/lib/uniwidth/cjk.h | 16 +- - gnulib/lib/uniwidth/width.c | 16 +- - gnulib/lib/vasnprintf.c | 71 +- - gnulib/lib/vasnprintf.h | 16 +- - gnulib/lib/vasprintf.c | 16 +- - gnulib/lib/verify.h | 14 +- - gnulib/lib/warn-on-use.h | 8 +- - gnulib/lib/wchar.in.h | 18 +- - gnulib/lib/wcrtomb.c | 14 +- - gnulib/lib/wctype-h.c | 19 + - gnulib/lib/wctype.in.h | 26 +- - gnulib/lib/wcwidth.c | 14 +- - gnulib/lib/windows-initguard.h | 16 +- - gnulib/lib/windows-mutex.c | 16 +- - gnulib/lib/windows-mutex.h | 16 +- - gnulib/lib/windows-once.c | 16 +- - gnulib/lib/windows-once.h | 16 +- - gnulib/lib/windows-recmutex.c | 16 +- - gnulib/lib/windows-recmutex.h | 16 +- - gnulib/lib/windows-rwlock.c | 16 +- - gnulib/lib/windows-rwlock.h | 16 +- - gnulib/lib/xalloc-oversized.h | 53 +- - gnulib/lib/xalloc.h | 143 +--- - gnulib/lib/xmalloc.c | 293 +++++-- - gnulib/lib/xsize.c | 18 + - gnulib/lib/xsize.h | 16 +- - gnulib/m4/calloc.m4 | 82 ++ - gnulib/m4/fcntl_h.m4 | 39 +- - gnulib/m4/free.m4 | 52 ++ - gnulib/m4/fstat.m4 | 4 +- - gnulib/m4/gnulib-common.m4 | 84 +- - gnulib/m4/gnulib-comp.m4 | 192 ++++- - gnulib/m4/inttypes.m4 | 31 +- - gnulib/m4/iswdigit.m4 | 6 +- - gnulib/m4/iswxdigit.m4 | 4 +- - gnulib/m4/langinfo_h.m4 | 25 +- - gnulib/m4/largefile.m4 | 28 +- - gnulib/m4/locale_h.m4 | 37 +- - gnulib/m4/malloc.m4 | 152 +++- - gnulib/m4/math_h.m4 | 227 +++--- - gnulib/m4/mbslen.m4 | 4 +- - gnulib/m4/memchr.m4 | 4 +- - gnulib/m4/mempcpy.m4 | 4 +- - gnulib/m4/memrchr.m4 | 4 +- - gnulib/m4/minmax.m4 | 44 ++ - gnulib/m4/printf.m4 | 5 +- - gnulib/m4/realloc.m4 | 63 ++ - gnulib/m4/reallocarray.m4 | 23 + - gnulib/m4/stat.m4 | 4 +- - gnulib/m4/stddef_h.m4 | 23 +- - gnulib/m4/stdint.m4 | 6 +- - gnulib/m4/stdio_h.m4 | 168 ++-- - gnulib/m4/stdlib_h.m4 | 122 +-- - gnulib/m4/stpcpy.m4 | 4 +- - gnulib/m4/strcase.m4 | 6 +- - gnulib/m4/strcasestr.m4 | 4 +- - gnulib/m4/strdup.m4 | 6 +- - gnulib/m4/strerror.m4 | 4 +- - gnulib/m4/string_h.m4 | 124 +-- - gnulib/m4/strings_h.m4 | 38 +- - gnulib/m4/strndup.m4 | 4 +- - gnulib/m4/strnlen.m4 | 4 +- - gnulib/m4/strstr.m4 | 4 +- - gnulib/m4/sys_socket_h.m4 | 53 +- - gnulib/m4/sys_stat_h.m4 | 65 +- - gnulib/m4/sys_types_h.m4 | 16 +- - gnulib/m4/time_h.m4 | 62 +- - gnulib/m4/unistd_h.m4 | 194 ++--- - gnulib/m4/visibility.m4 | 6 +- - gnulib/m4/wchar_h.m4 | 109 +-- - gnulib/m4/wctype_h.m4 | 39 +- - gnulib/m4/wint_t.m4 | 10 +- - gnulib/m4/year2038.m4 | 112 +++ - 238 files changed, 4521 insertions(+), 2636 deletions(-) - create mode 100644 gnulib/lib/calloc.c - create mode 100644 gnulib/lib/free.c - create mode 100644 gnulib/lib/ialloc.c - create mode 100644 gnulib/lib/ialloc.h - create mode 100644 gnulib/lib/idx.h - create mode 100644 gnulib/lib/minmax.h - create mode 100644 gnulib/lib/realloc.c - create mode 100644 gnulib/lib/reallocarray.c - create mode 100644 gnulib/m4/calloc.m4 - create mode 100644 gnulib/m4/free.m4 - create mode 100644 gnulib/m4/minmax.m4 - create mode 100644 gnulib/m4/realloc.m4 - create mode 100644 gnulib/m4/reallocarray.m4 - create mode 100644 gnulib/m4/year2038.m4 - ---- a/gnulib/lib/Makefile.am -+++ b/gnulib/lib/Makefile.am -@@ -165,6 +165,24 @@ EXTRA_libgnu_a_SOURCES += btowc.c - - ## end gnulib module btowc - -+## begin gnulib module calloc-gnu -+ -+ -+EXTRA_DIST += calloc.c -+ -+EXTRA_libgnu_a_SOURCES += calloc.c -+ -+## end gnulib module calloc-gnu -+ -+## begin gnulib module calloc-posix -+ -+ -+EXTRA_DIST += calloc.c -+ -+EXTRA_libgnu_a_SOURCES += calloc.c -+ -+## end gnulib module calloc-posix -+ - ## begin gnulib module cloexec - - if gl_GNULIB_ENABLED_cloexec -@@ -200,6 +218,32 @@ EXTRA_libgnu_a_SOURCES += dup2.c - ## begin gnulib module dynarray - - if gl_GNULIB_ENABLED_dynarray -+BUILT_SOURCES += malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h -+ -+malloc/dynarray.gl.h: malloc/dynarray.h -+ $(AM_V_at)$(MKDIR_P) malloc -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -+ sed -e '/libc_hidden_proto/d' < $(srcdir)/malloc/dynarray.h; \ -+ } > $@-t && \ -+ mv $@-t $@ -+MOSTLYCLEANFILES += malloc/dynarray.gl.h malloc/dynarray.gl.h-t -+ -+malloc/dynarray-skeleton.gl.h: malloc/dynarray-skeleton.c -+ $(AM_V_at)$(MKDIR_P) malloc -+ $(AM_V_GEN)rm -f $@-t $@ && \ -+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ -+ sed -e 's|||g' \ -+ -e 's|__attribute_maybe_unused__|_GL_ATTRIBUTE_MAYBE_UNUSED|g' \ -+ -e 's|__attribute_nonnull__|_GL_ATTRIBUTE_NONNULL|g' \ -+ -e 's|__attribute_warn_unused_result__|_GL_ATTRIBUTE_NODISCARD|g' \ -+ -e 's|__glibc_likely|_GL_LIKELY|g' \ -+ -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ -+ < $(srcdir)/malloc/dynarray-skeleton.c; \ -+ } > $@-t && \ -+ mv $@-t $@ -+MOSTLYCLEANFILES += malloc/dynarray-skeleton.gl.h malloc/dynarray-skeleton.gl.h-t -+ - libgnu_a_SOURCES += malloc/dynarray_at_failure.c malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c malloc/dynarray_resize.c malloc/dynarray_resize_clear.c - - endif -@@ -285,13 +329,13 @@ fcntl.h: fcntl.in.h $(top_builddir)/conf - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ -- -e 's/@''GNULIB_CREAT''@/$(GNULIB_CREAT)/g' \ -- -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \ -- -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ -- -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ -- -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ -- -e 's/@''GNULIB_MDA_CREAT''@/$(GNULIB_MDA_CREAT)/g' \ -- -e 's/@''GNULIB_MDA_OPEN''@/$(GNULIB_MDA_OPEN)/g' \ -+ -e 's/@''GNULIB_CREAT''@/$(GL_GNULIB_CREAT)/g' \ -+ -e 's/@''GNULIB_FCNTL''@/$(GL_GNULIB_FCNTL)/g' \ -+ -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \ -+ -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \ -+ -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \ -+ -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \ -+ -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \ - -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ - -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ - -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ -@@ -358,6 +402,17 @@ EXTRA_libgnu_a_SOURCES += float.c itold. - - ## end gnulib module float - -+## begin gnulib module free-posix -+ -+if gl_GNULIB_ENABLED_ef07dc4b3077c11ea9cef586db4e5955 -+ -+endif -+EXTRA_DIST += free.c -+ -+EXTRA_libgnu_a_SOURCES += free.c -+ -+## end gnulib module free-posix -+ - ## begin gnulib module fstat - - if gl_GNULIB_ENABLED_fstat -@@ -445,11 +500,23 @@ EXTRA_DIST += $(top_srcdir)/build-aux/co - - ## end gnulib module havelib - -+## begin gnulib module ialloc -+ -+libgnu_a_SOURCES += ialloc.c -+ -+EXTRA_DIST += ialloc.h -+ -+## end gnulib module ialloc -+ -+## begin gnulib module idx -+ -+libgnu_a_SOURCES += idx.h -+ -+## end gnulib module idx -+ - ## begin gnulib module intprops - --if gl_GNULIB_ENABLED_intprops - --endif - EXTRA_DIST += intprops.h - - ## end gnulib module intprops -@@ -470,10 +537,10 @@ inttypes.h: inttypes.in.h $(top_builddir - -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ - -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ - -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \ -- -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \ -- -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \ -- -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \ -- -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \ -+ -e 's/@''GNULIB_IMAXABS''@/$(GL_GNULIB_IMAXABS)/g' \ -+ -e 's/@''GNULIB_IMAXDIV''@/$(GL_GNULIB_IMAXDIV)/g' \ -+ -e 's/@''GNULIB_STRTOIMAX''@/$(GL_GNULIB_STRTOIMAX)/g' \ -+ -e 's/@''GNULIB_STRTOUMAX''@/$(GL_GNULIB_STRTOUMAX)/g' \ - -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \ - -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ - -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ -@@ -540,7 +607,7 @@ langinfo.h: langinfo.in.h $(top_builddir - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \ -- -e 's/@''GNULIB_NL_LANGINFO''@/$(GNULIB_NL_LANGINFO)/g' \ -+ -e 's/@''GNULIB_NL_LANGINFO''@/$(GL_GNULIB_NL_LANGINFO)/g' \ - -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \ - -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \ - -e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \ -@@ -622,11 +689,11 @@ locale.h: locale.in.h $(top_builddir)/co - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ -- -e 's/@''GNULIB_LOCALECONV''@/$(GNULIB_LOCALECONV)/g' \ -- -e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \ -- -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GNULIB_SETLOCALE_NULL)/g' \ -- -e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \ -- -e 's/@''GNULIB_LOCALENAME''@/$(GNULIB_LOCALENAME)/g' \ -+ -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \ -+ -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \ -+ -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \ -+ -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \ -+ -e 's/@''GNULIB_LOCALENAME''@/$(GL_GNULIB_LOCALENAME)/g' \ - -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \ - -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ - -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \ -@@ -670,11 +737,18 @@ libgnu_a_SOURCES += glthread/lock.h glth - endif - ## end gnulib module lock - -+## begin gnulib module malloc-gnu -+ -+ -+EXTRA_DIST += malloc.c -+ -+EXTRA_libgnu_a_SOURCES += malloc.c -+ -+## end gnulib module malloc-gnu -+ - ## begin gnulib module malloc-posix - --if gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866 - --endif - EXTRA_DIST += malloc.c - - EXTRA_libgnu_a_SOURCES += malloc.c -@@ -805,6 +879,12 @@ EXTRA_libgnu_a_SOURCES += memrchr.c - - ## end gnulib module memrchr - -+## begin gnulib module minmax -+ -+libgnu_a_SOURCES += minmax.h -+ -+## end gnulib module minmax -+ - ## begin gnulib module msvc-inval - - if gl_GNULIB_ENABLED_f691f076f650964c9f5598c3ee487616 -@@ -856,6 +936,33 @@ EXTRA_DIST += pathmax.h - - ## end gnulib module pathmax - -+## begin gnulib module realloc-gnu -+ -+ -+EXTRA_DIST += realloc.c -+ -+EXTRA_libgnu_a_SOURCES += realloc.c -+ -+## end gnulib module realloc-gnu -+ -+## begin gnulib module realloc-posix -+ -+ -+EXTRA_DIST += realloc.c -+ -+EXTRA_libgnu_a_SOURCES += realloc.c -+ -+## end gnulib module realloc-posix -+ -+## begin gnulib module reallocarray -+ -+ -+EXTRA_DIST += reallocarray.c -+ -+EXTRA_libgnu_a_SOURCES += reallocarray.c -+ -+## end gnulib module reallocarray -+ - ## begin gnulib module regex - - -@@ -1072,7 +1179,7 @@ stdint.h: stdint.in.h $(top_builddir)/co - -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ - -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ - -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ -- -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -+ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ - < $(srcdir)/stdint.in.h; \ - } > $@-t && \ - mv $@-t $@ -@@ -1100,65 +1207,65 @@ stdio.h: stdio.in.h $(top_builddir)/conf - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ -- -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \ -- -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \ -- -e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \ -- -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \ -- -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \ -- -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \ -- -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \ -- -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \ -- -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \ -- -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \ -- -e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \ -- -e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \ -- -e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \ -- -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \ -- -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \ -- -e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \ -- -e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \ -- -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \ -- -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \ -- -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \ -- -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \ -- -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \ -- -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \ -- -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \ -- -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ -- -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ -- -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \ -- -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \ -- -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \ -- -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \ -- -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \ -- -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \ -- -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \ -- -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \ -- -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \ -- -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \ -- -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \ -- -e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \ -- -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \ -- -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \ -- -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \ -- -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \ -- -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \ -- -e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \ -- -e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \ -- -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \ -- -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \ -- -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \ -- -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \ -- -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \ -- -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \ -- -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \ -- -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \ -- -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GNULIB_MDA_FCLOSEALL)/g' \ -- -e 's/@''GNULIB_MDA_FDOPEN''@/$(GNULIB_MDA_FDOPEN)/g' \ -- -e 's/@''GNULIB_MDA_FILENO''@/$(GNULIB_MDA_FILENO)/g' \ -- -e 's/@''GNULIB_MDA_GETW''@/$(GNULIB_MDA_GETW)/g' \ -- -e 's/@''GNULIB_MDA_PUTW''@/$(GNULIB_MDA_PUTW)/g' \ -- -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GNULIB_MDA_TEMPNAM)/g' \ -+ -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ -+ -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ -+ -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ -+ -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \ -+ -e 's/@''GNULIB_FGETC''@/$(GL_GNULIB_FGETC)/g' \ -+ -e 's/@''GNULIB_FGETS''@/$(GL_GNULIB_FGETS)/g' \ -+ -e 's/@''GNULIB_FOPEN''@/$(GL_GNULIB_FOPEN)/g' \ -+ -e 's/@''GNULIB_FPRINTF''@/$(GL_GNULIB_FPRINTF)/g' \ -+ -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GL_GNULIB_FPRINTF_POSIX)/g' \ -+ -e 's/@''GNULIB_FPURGE''@/$(GL_GNULIB_FPURGE)/g' \ -+ -e 's/@''GNULIB_FPUTC''@/$(GL_GNULIB_FPUTC)/g' \ -+ -e 's/@''GNULIB_FPUTS''@/$(GL_GNULIB_FPUTS)/g' \ -+ -e 's/@''GNULIB_FREAD''@/$(GL_GNULIB_FREAD)/g' \ -+ -e 's/@''GNULIB_FREOPEN''@/$(GL_GNULIB_FREOPEN)/g' \ -+ -e 's/@''GNULIB_FSCANF''@/$(GL_GNULIB_FSCANF)/g' \ -+ -e 's/@''GNULIB_FSEEK''@/$(GL_GNULIB_FSEEK)/g' \ -+ -e 's/@''GNULIB_FSEEKO''@/$(GL_GNULIB_FSEEKO)/g' \ -+ -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ -+ -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ -+ -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ -+ -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ -+ -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ -+ -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ -+ -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ -+ -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ -+ -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ -+ -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ -+ -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ -+ -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \ -+ -e 's/@''GNULIB_PRINTF''@/$(GL_GNULIB_PRINTF)/g' \ -+ -e 's/@''GNULIB_PRINTF_POSIX''@/$(GL_GNULIB_PRINTF_POSIX)/g' \ -+ -e 's/@''GNULIB_PUTC''@/$(GL_GNULIB_PUTC)/g' \ -+ -e 's/@''GNULIB_PUTCHAR''@/$(GL_GNULIB_PUTCHAR)/g' \ -+ -e 's/@''GNULIB_PUTS''@/$(GL_GNULIB_PUTS)/g' \ -+ -e 's/@''GNULIB_REMOVE''@/$(GL_GNULIB_REMOVE)/g' \ -+ -e 's/@''GNULIB_RENAME''@/$(GL_GNULIB_RENAME)/g' \ -+ -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ -+ -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ -+ -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ -+ -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ -+ -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ -+ -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \ -+ -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ -+ -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ -+ -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ -+ -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ -+ -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ -+ -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ -+ -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ -+ -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ -+ -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ -+ -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ -+ -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ -+ -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ -+ -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ -+ -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \ -+ -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \ -+ -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ -+ -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \ - < $(srcdir)/stdio.in.h | \ - sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ - -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ -@@ -1236,49 +1343,51 @@ stdlib.h: stdlib.in.h $(top_builddir)/co - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ -- -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \ -- -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GNULIB_ALIGNED_ALLOC)/g' \ -- -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \ -- -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \ -- -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \ -- -e 's/@''GNULIB_FREE_POSIX''@/$(GNULIB_FREE_POSIX)/g' \ -- -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \ -- -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \ -- -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \ -- -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \ -- -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \ -- -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \ -- -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \ -- -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ -- -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ -- -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ -- -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GNULIB_POSIX_MEMALIGN)/g' \ -- -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \ -- -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ -- -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \ -- -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ -- -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \ -- -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ -- -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ -- -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ -- -e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \ -- -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ -- -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ -- -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ -- -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ -- -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ -- -e 's/@''GNULIB_STRTOLD''@/$(GNULIB_STRTOLD)/g' \ -- -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ -- -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ -- -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ -- -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \ -- -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \ -- -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \ -- -e 's/@''GNULIB_MDA_ECVT''@/$(GNULIB_MDA_ECVT)/g' \ -- -e 's/@''GNULIB_MDA_FCVT''@/$(GNULIB_MDA_FCVT)/g' \ -- -e 's/@''GNULIB_MDA_GCVT''@/$(GNULIB_MDA_GCVT)/g' \ -- -e 's/@''GNULIB_MDA_MKTEMP''@/$(GNULIB_MDA_MKTEMP)/g' \ -- -e 's/@''GNULIB_MDA_PUTENV''@/$(GNULIB_MDA_PUTENV)/g' \ -+ -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \ -+ -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \ -+ -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \ -+ -e 's/@''GNULIB_CALLOC_POSIX''@/$(GL_GNULIB_CALLOC_POSIX)/g' \ -+ -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GL_GNULIB_CANONICALIZE_FILE_NAME)/g' \ -+ -e 's/@''GNULIB_FREE_POSIX''@/$(GL_GNULIB_FREE_POSIX)/g' \ -+ -e 's/@''GNULIB_GETLOADAVG''@/$(GL_GNULIB_GETLOADAVG)/g' \ -+ -e 's/@''GNULIB_GETSUBOPT''@/$(GL_GNULIB_GETSUBOPT)/g' \ -+ -e 's/@''GNULIB_GRANTPT''@/$(GL_GNULIB_GRANTPT)/g' \ -+ -e 's/@''GNULIB_MALLOC_POSIX''@/$(GL_GNULIB_MALLOC_POSIX)/g' \ -+ -e 's/@''GNULIB_MBTOWC''@/$(GL_GNULIB_MBTOWC)/g' \ -+ -e 's/@''GNULIB_MKDTEMP''@/$(GL_GNULIB_MKDTEMP)/g' \ -+ -e 's/@''GNULIB_MKOSTEMP''@/$(GL_GNULIB_MKOSTEMP)/g' \ -+ -e 's/@''GNULIB_MKOSTEMPS''@/$(GL_GNULIB_MKOSTEMPS)/g' \ -+ -e 's/@''GNULIB_MKSTEMP''@/$(GL_GNULIB_MKSTEMP)/g' \ -+ -e 's/@''GNULIB_MKSTEMPS''@/$(GL_GNULIB_MKSTEMPS)/g' \ -+ -e 's/@''GNULIB_POSIX_MEMALIGN''@/$(GL_GNULIB_POSIX_MEMALIGN)/g' \ -+ -e 's/@''GNULIB_POSIX_OPENPT''@/$(GL_GNULIB_POSIX_OPENPT)/g' \ -+ -e 's/@''GNULIB_PTSNAME''@/$(GL_GNULIB_PTSNAME)/g' \ -+ -e 's/@''GNULIB_PTSNAME_R''@/$(GL_GNULIB_PTSNAME_R)/g' \ -+ -e 's/@''GNULIB_PUTENV''@/$(GL_GNULIB_PUTENV)/g' \ -+ -e 's/@''GNULIB_QSORT_R''@/$(GL_GNULIB_QSORT_R)/g' \ -+ -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ -+ -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ -+ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \ -+ -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \ -+ -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \ -+ -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \ -+ -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ -+ -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ -+ -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ -+ -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ -+ -e 's/@''GNULIB_STRTOLD''@/$(GL_GNULIB_STRTOLD)/g' \ -+ -e 's/@''GNULIB_STRTOLL''@/$(GL_GNULIB_STRTOLL)/g' \ -+ -e 's/@''GNULIB_STRTOUL''@/$(GL_GNULIB_STRTOUL)/g' \ -+ -e 's/@''GNULIB_STRTOULL''@/$(GL_GNULIB_STRTOULL)/g' \ -+ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GL_GNULIB_SYSTEM_POSIX)/g' \ -+ -e 's/@''GNULIB_UNLOCKPT''@/$(GL_GNULIB_UNLOCKPT)/g' \ -+ -e 's/@''GNULIB_UNSETENV''@/$(GL_GNULIB_UNSETENV)/g' \ -+ -e 's/@''GNULIB_WCTOMB''@/$(GL_GNULIB_WCTOMB)/g' \ -+ -e 's/@''GNULIB_MDA_ECVT''@/$(GL_GNULIB_MDA_ECVT)/g' \ -+ -e 's/@''GNULIB_MDA_FCVT''@/$(GL_GNULIB_MDA_FCVT)/g' \ -+ -e 's/@''GNULIB_MDA_GCVT''@/$(GL_GNULIB_MDA_GCVT)/g' \ -+ -e 's/@''GNULIB_MDA_MKTEMP''@/$(GL_GNULIB_MDA_MKTEMP)/g' \ -+ -e 's/@''GNULIB_MDA_PUTENV''@/$(GL_GNULIB_MDA_PUTENV)/g' \ - < $(srcdir)/stdlib.in.h | \ - sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ - -e 's|@''HAVE_ALIGNED_ALLOC''@|$(HAVE_ALIGNED_ALLOC)|g' \ -@@ -1314,8 +1423,10 @@ stdlib.h: stdlib.in.h $(top_builddir)/co - -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ - -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ - -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -+ -e 's|@''HAVE_STRTOL''@|$(HAVE_STRTOL)|g' \ - -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ - -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -+ -e 's|@''HAVE_STRTOUL''@|$(HAVE_STRTOUL)|g' \ - -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ - -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ - -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ -@@ -1337,11 +1448,16 @@ stdlib.h: stdlib.in.h $(top_builddir)/co - -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ - -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ - -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -+ -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \ - -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ - -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ - -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ - -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ -+ -e 's|@''REPLACE_STRTOL''@|$(REPLACE_STRTOL)|g' \ - -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ -+ -e 's|@''REPLACE_STRTOLL''@|$(REPLACE_STRTOLL)|g' \ -+ -e 's|@''REPLACE_STRTOUL''@|$(REPLACE_STRTOUL)|g' \ -+ -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \ - -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ - -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ - -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -@@ -1444,49 +1560,49 @@ string.h: string.in.h $(top_builddir)/co - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ -- -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \ -- -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ -- -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ -- -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ -- -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \ -- -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \ -- -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \ -- -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \ -- -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \ -- -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \ -- -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \ -- -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \ -- -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \ -- -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \ -- -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \ -- -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \ -- -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \ -- -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \ -- -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \ -- -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \ -- -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \ -- -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \ -- -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \ -- -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \ -- -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \ -- -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \ -- -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \ -- -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \ -- -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \ -- -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \ -- -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \ -- -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \ -- -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \ -- -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \ -- -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \ -- -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \ -- -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GNULIB_STRERRORNAME_NP)/g' \ -- -e 's/@''GNULIB_SIGABBREV_NP''@/$(GNULIB_SIGABBREV_NP)/g' \ -- -e 's/@''GNULIB_SIGDESCR_NP''@/$(GNULIB_SIGDESCR_NP)/g' \ -- -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ -- -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ -- -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GNULIB_MDA_MEMCCPY)/g' \ -- -e 's/@''GNULIB_MDA_STRDUP''@/$(GNULIB_MDA_STRDUP)/g' \ -+ -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GL_GNULIB_EXPLICIT_BZERO)/g' \ -+ -e 's/@''GNULIB_FFSL''@/$(GL_GNULIB_FFSL)/g' \ -+ -e 's/@''GNULIB_FFSLL''@/$(GL_GNULIB_FFSLL)/g' \ -+ -e 's/@''GNULIB_MBSLEN''@/$(GL_GNULIB_MBSLEN)/g' \ -+ -e 's/@''GNULIB_MBSNLEN''@/$(GL_GNULIB_MBSNLEN)/g' \ -+ -e 's/@''GNULIB_MBSCHR''@/$(GL_GNULIB_MBSCHR)/g' \ -+ -e 's/@''GNULIB_MBSRCHR''@/$(GL_GNULIB_MBSRCHR)/g' \ -+ -e 's/@''GNULIB_MBSSTR''@/$(GL_GNULIB_MBSSTR)/g' \ -+ -e 's/@''GNULIB_MBSCASECMP''@/$(GL_GNULIB_MBSCASECMP)/g' \ -+ -e 's/@''GNULIB_MBSNCASECMP''@/$(GL_GNULIB_MBSNCASECMP)/g' \ -+ -e 's/@''GNULIB_MBSPCASECMP''@/$(GL_GNULIB_MBSPCASECMP)/g' \ -+ -e 's/@''GNULIB_MBSCASESTR''@/$(GL_GNULIB_MBSCASESTR)/g' \ -+ -e 's/@''GNULIB_MBSCSPN''@/$(GL_GNULIB_MBSCSPN)/g' \ -+ -e 's/@''GNULIB_MBSPBRK''@/$(GL_GNULIB_MBSPBRK)/g' \ -+ -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ -+ -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ -+ -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ -+ -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ -+ -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ -+ -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ -+ -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \ -+ -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \ -+ -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \ -+ -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ -+ -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ -+ -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ -+ -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ -+ -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ -+ -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ -+ -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \ -+ -e 's/@''GNULIB_STRSEP''@/$(GL_GNULIB_STRSEP)/g' \ -+ -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ -+ -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ -+ -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ -+ -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ -+ -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ -+ -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ -+ -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ -+ -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ -+ -e 's/@''GNULIB_STRSIGNAL''@/$(GL_GNULIB_STRSIGNAL)/g' \ -+ -e 's/@''GNULIB_STRVERSCMP''@/$(GL_GNULIB_STRVERSCMP)/g' \ -+ -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \ -+ -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \ - < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ - -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -@@ -1556,7 +1672,7 @@ strings.h: strings.in.h $(top_builddir)/ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ -- -e 's/@''GNULIB_FFS''@/$(GNULIB_FFS)/g' \ -+ -e 's/@''GNULIB_FFS''@/$(GL_GNULIB_FFS)/g' \ - -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \ - -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ - -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ -@@ -1638,25 +1754,25 @@ sys/stat.h: sys_stat.in.h $(top_builddir - -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ - -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ - -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ -- -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ -- -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ -- -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ -- -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ -- -e 's/@''GNULIB_GETUMASK''@/$(GNULIB_GETUMASK)/g' \ -- -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ -- -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \ -- -e 's/@''GNULIB_MKDIR''@/$(GNULIB_MKDIR)/g' \ -- -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \ -- -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \ -- -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \ -- -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \ -- -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ -- -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ -- -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ -- -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GNULIB_OVERRIDES_STRUCT_STAT)/g' \ -- -e 's/@''GNULIB_MDA_CHMOD''@/$(GNULIB_MDA_CHMOD)/g' \ -- -e 's/@''GNULIB_MDA_MKDIR''@/$(GNULIB_MDA_MKDIR)/g' \ -- -e 's/@''GNULIB_MDA_UMASK''@/$(GNULIB_MDA_UMASK)/g' \ -+ -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \ -+ -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \ -+ -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \ -+ -e 's/@''GNULIB_FUTIMENS''@/$(GL_GNULIB_FUTIMENS)/g' \ -+ -e 's/@''GNULIB_GETUMASK''@/$(GL_GNULIB_GETUMASK)/g' \ -+ -e 's/@''GNULIB_LCHMOD''@/$(GL_GNULIB_LCHMOD)/g' \ -+ -e 's/@''GNULIB_LSTAT''@/$(GL_GNULIB_LSTAT)/g' \ -+ -e 's/@''GNULIB_MKDIR''@/$(GL_GNULIB_MKDIR)/g' \ -+ -e 's/@''GNULIB_MKDIRAT''@/$(GL_GNULIB_MKDIRAT)/g' \ -+ -e 's/@''GNULIB_MKFIFO''@/$(GL_GNULIB_MKFIFO)/g' \ -+ -e 's/@''GNULIB_MKFIFOAT''@/$(GL_GNULIB_MKFIFOAT)/g' \ -+ -e 's/@''GNULIB_MKNOD''@/$(GL_GNULIB_MKNOD)/g' \ -+ -e 's/@''GNULIB_MKNODAT''@/$(GL_GNULIB_MKNODAT)/g' \ -+ -e 's/@''GNULIB_STAT''@/$(GL_GNULIB_STAT)/g' \ -+ -e 's/@''GNULIB_UTIMENSAT''@/$(GL_GNULIB_UTIMENSAT)/g' \ -+ -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GL_GNULIB_OVERRIDES_STRUCT_STAT)/g' \ -+ -e 's/@''GNULIB_MDA_CHMOD''@/$(GL_GNULIB_MDA_CHMOD)/g' \ -+ -e 's/@''GNULIB_MDA_MKDIR''@/$(GL_GNULIB_MDA_MKDIR)/g' \ -+ -e 's/@''GNULIB_MDA_UMASK''@/$(GL_GNULIB_MDA_UMASK)/g' \ - -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ - -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ - -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ -@@ -1744,18 +1860,18 @@ time.h: time.in.h $(top_builddir)/config - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ -- -e 's/@''GNULIB_CTIME''@/$(GNULIB_CTIME)/g' \ -- -e 's/@''GNULIB_LOCALTIME''@/$(GNULIB_LOCALTIME)/g' \ -- -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ -- -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ -- -e 's/@''GNULIB_STRFTIME''@/$(GNULIB_STRFTIME)/g' \ -- -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ -- -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ -- -e 's/@''GNULIB_TIMESPEC_GET''@/$(GNULIB_TIMESPEC_GET)/g' \ -- -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ -- -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \ -- -e 's/@''GNULIB_TZSET''@/$(GNULIB_TZSET)/g' \ -- -e 's/@''GNULIB_MDA_TZSET''@/$(GNULIB_MDA_TZSET)/g' \ -+ -e 's/@''GNULIB_CTIME''@/$(GL_GNULIB_CTIME)/g' \ -+ -e 's/@''GNULIB_LOCALTIME''@/$(GL_GNULIB_LOCALTIME)/g' \ -+ -e 's/@''GNULIB_MKTIME''@/$(GL_GNULIB_MKTIME)/g' \ -+ -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \ -+ -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \ -+ -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \ -+ -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \ -+ -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \ -+ -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ -+ -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ -+ -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ -+ -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ - -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ - -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ - -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -@@ -1806,89 +1922,89 @@ unistd.h: unistd.in.h $(top_builddir)/co - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ - -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ -- -e 's/@''GNULIB_ACCESS''@/$(GNULIB_ACCESS)/g' \ -- -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ -- -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ -- -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ -- -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GNULIB_COPY_FILE_RANGE)/g' \ -- -e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \ -- -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ -- -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ -- -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ -- -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \ -- -e 's/@''GNULIB_EXECL''@/$(GNULIB_EXECL)/g' \ -- -e 's/@''GNULIB_EXECLE''@/$(GNULIB_EXECLE)/g' \ -- -e 's/@''GNULIB_EXECLP''@/$(GNULIB_EXECLP)/g' \ -- -e 's/@''GNULIB_EXECV''@/$(GNULIB_EXECV)/g' \ -- -e 's/@''GNULIB_EXECVE''@/$(GNULIB_EXECVE)/g' \ -- -e 's/@''GNULIB_EXECVP''@/$(GNULIB_EXECVP)/g' \ -- -e 's/@''GNULIB_EXECVPE''@/$(GNULIB_EXECVPE)/g' \ -- -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ -- -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ -- -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ -- -e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \ -- -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ -- -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ -- -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ -- -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \ -- -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \ -- -e 's/@''GNULIB_GETENTROPY''@/$(GNULIB_GETENTROPY)/g' \ -- -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \ -- -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \ -- -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \ -- -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \ -- -e 's/@''GNULIB_GETOPT_POSIX''@/$(GNULIB_GETOPT_POSIX)/g' \ -- -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ -- -e 's/@''GNULIB_GETPASS''@/$(GNULIB_GETPASS)/g' \ -- -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ -- -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ -- -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \ -- -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \ -- -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \ -- -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \ -- -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \ -- -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \ -- -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \ -- -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \ -- -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \ -- -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \ -- -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \ -- -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \ -- -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \ -- -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \ -- -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ -- -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ -- -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ -- -e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \ -- -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ -- -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \ -- -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ -- -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \ -- -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \ -- -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \ -- -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \ -- -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ -- -e 's/@''GNULIB_MDA_ACCESS''@/$(GNULIB_MDA_ACCESS)/g' \ -- -e 's/@''GNULIB_MDA_CHDIR''@/$(GNULIB_MDA_CHDIR)/g' \ -- -e 's/@''GNULIB_MDA_CLOSE''@/$(GNULIB_MDA_CLOSE)/g' \ -- -e 's/@''GNULIB_MDA_DUP''@/$(GNULIB_MDA_DUP)/g' \ -- -e 's/@''GNULIB_MDA_DUP2''@/$(GNULIB_MDA_DUP2)/g' \ -- -e 's/@''GNULIB_MDA_EXECL''@/$(GNULIB_MDA_EXECL)/g' \ -- -e 's/@''GNULIB_MDA_EXECLE''@/$(GNULIB_MDA_EXECLE)/g' \ -- -e 's/@''GNULIB_MDA_EXECLP''@/$(GNULIB_MDA_EXECLP)/g' \ -- -e 's/@''GNULIB_MDA_EXECV''@/$(GNULIB_MDA_EXECV)/g' \ -- -e 's/@''GNULIB_MDA_EXECVE''@/$(GNULIB_MDA_EXECVE)/g' \ -- -e 's/@''GNULIB_MDA_EXECVP''@/$(GNULIB_MDA_EXECVP)/g' \ -- -e 's/@''GNULIB_MDA_EXECVPE''@/$(GNULIB_MDA_EXECVPE)/g' \ -- -e 's/@''GNULIB_MDA_GETCWD''@/$(GNULIB_MDA_GETCWD)/g' \ -- -e 's/@''GNULIB_MDA_GETPID''@/$(GNULIB_MDA_GETPID)/g' \ -- -e 's/@''GNULIB_MDA_ISATTY''@/$(GNULIB_MDA_ISATTY)/g' \ -- -e 's/@''GNULIB_MDA_LSEEK''@/$(GNULIB_MDA_LSEEK)/g' \ -- -e 's/@''GNULIB_MDA_READ''@/$(GNULIB_MDA_READ)/g' \ -- -e 's/@''GNULIB_MDA_RMDIR''@/$(GNULIB_MDA_RMDIR)/g' \ -- -e 's/@''GNULIB_MDA_SWAB''@/$(GNULIB_MDA_SWAB)/g' \ -- -e 's/@''GNULIB_MDA_UNLINK''@/$(GNULIB_MDA_UNLINK)/g' \ -- -e 's/@''GNULIB_MDA_WRITE''@/$(GNULIB_MDA_WRITE)/g' \ -+ -e 's/@''GNULIB_ACCESS''@/$(GL_GNULIB_ACCESS)/g' \ -+ -e 's/@''GNULIB_CHDIR''@/$(GL_GNULIB_CHDIR)/g' \ -+ -e 's/@''GNULIB_CHOWN''@/$(GL_GNULIB_CHOWN)/g' \ -+ -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \ -+ -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GL_GNULIB_COPY_FILE_RANGE)/g' \ -+ -e 's/@''GNULIB_DUP''@/$(GL_GNULIB_DUP)/g' \ -+ -e 's/@''GNULIB_DUP2''@/$(GL_GNULIB_DUP2)/g' \ -+ -e 's/@''GNULIB_DUP3''@/$(GL_GNULIB_DUP3)/g' \ -+ -e 's/@''GNULIB_ENVIRON''@/$(GL_GNULIB_ENVIRON)/g' \ -+ -e 's/@''GNULIB_EUIDACCESS''@/$(GL_GNULIB_EUIDACCESS)/g' \ -+ -e 's/@''GNULIB_EXECL''@/$(GL_GNULIB_EXECL)/g' \ -+ -e 's/@''GNULIB_EXECLE''@/$(GL_GNULIB_EXECLE)/g' \ -+ -e 's/@''GNULIB_EXECLP''@/$(GL_GNULIB_EXECLP)/g' \ -+ -e 's/@''GNULIB_EXECV''@/$(GL_GNULIB_EXECV)/g' \ -+ -e 's/@''GNULIB_EXECVE''@/$(GL_GNULIB_EXECVE)/g' \ -+ -e 's/@''GNULIB_EXECVP''@/$(GL_GNULIB_EXECVP)/g' \ -+ -e 's/@''GNULIB_EXECVPE''@/$(GL_GNULIB_EXECVPE)/g' \ -+ -e 's/@''GNULIB_FACCESSAT''@/$(GL_GNULIB_FACCESSAT)/g' \ -+ -e 's/@''GNULIB_FCHDIR''@/$(GL_GNULIB_FCHDIR)/g' \ -+ -e 's/@''GNULIB_FCHOWNAT''@/$(GL_GNULIB_FCHOWNAT)/g' \ -+ -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \ -+ -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \ -+ -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \ -+ -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \ -+ -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \ -+ -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \ -+ -e 's/@''GNULIB_GETENTROPY''@/$(GL_GNULIB_GETENTROPY)/g' \ -+ -e 's/@''GNULIB_GETGROUPS''@/$(GL_GNULIB_GETGROUPS)/g' \ -+ -e 's/@''GNULIB_GETHOSTNAME''@/$(GL_GNULIB_GETHOSTNAME)/g' \ -+ -e 's/@''GNULIB_GETLOGIN''@/$(GL_GNULIB_GETLOGIN)/g' \ -+ -e 's/@''GNULIB_GETLOGIN_R''@/$(GL_GNULIB_GETLOGIN_R)/g' \ -+ -e 's/@''GNULIB_GETOPT_POSIX''@/$(GL_GNULIB_GETOPT_POSIX)/g' \ -+ -e 's/@''GNULIB_GETPAGESIZE''@/$(GL_GNULIB_GETPAGESIZE)/g' \ -+ -e 's/@''GNULIB_GETPASS''@/$(GL_GNULIB_GETPASS)/g' \ -+ -e 's/@''GNULIB_GETUSERSHELL''@/$(GL_GNULIB_GETUSERSHELL)/g' \ -+ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GL_GNULIB_GROUP_MEMBER)/g' \ -+ -e 's/@''GNULIB_ISATTY''@/$(GL_GNULIB_ISATTY)/g' \ -+ -e 's/@''GNULIB_LCHOWN''@/$(GL_GNULIB_LCHOWN)/g' \ -+ -e 's/@''GNULIB_LINK''@/$(GL_GNULIB_LINK)/g' \ -+ -e 's/@''GNULIB_LINKAT''@/$(GL_GNULIB_LINKAT)/g' \ -+ -e 's/@''GNULIB_LSEEK''@/$(GL_GNULIB_LSEEK)/g' \ -+ -e 's/@''GNULIB_PIPE''@/$(GL_GNULIB_PIPE)/g' \ -+ -e 's/@''GNULIB_PIPE2''@/$(GL_GNULIB_PIPE2)/g' \ -+ -e 's/@''GNULIB_PREAD''@/$(GL_GNULIB_PREAD)/g' \ -+ -e 's/@''GNULIB_PWRITE''@/$(GL_GNULIB_PWRITE)/g' \ -+ -e 's/@''GNULIB_READ''@/$(GL_GNULIB_READ)/g' \ -+ -e 's/@''GNULIB_READLINK''@/$(GL_GNULIB_READLINK)/g' \ -+ -e 's/@''GNULIB_READLINKAT''@/$(GL_GNULIB_READLINKAT)/g' \ -+ -e 's/@''GNULIB_RMDIR''@/$(GL_GNULIB_RMDIR)/g' \ -+ -e 's/@''GNULIB_SETHOSTNAME''@/$(GL_GNULIB_SETHOSTNAME)/g' \ -+ -e 's/@''GNULIB_SLEEP''@/$(GL_GNULIB_SLEEP)/g' \ -+ -e 's/@''GNULIB_SYMLINK''@/$(GL_GNULIB_SYMLINK)/g' \ -+ -e 's/@''GNULIB_SYMLINKAT''@/$(GL_GNULIB_SYMLINKAT)/g' \ -+ -e 's/@''GNULIB_TRUNCATE''@/$(GL_GNULIB_TRUNCATE)/g' \ -+ -e 's/@''GNULIB_TTYNAME_R''@/$(GL_GNULIB_TTYNAME_R)/g' \ -+ -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GL_GNULIB_UNISTD_H_GETOPT)/g' \ -+ -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GL_GNULIB_UNISTD_H_NONBLOCKING)/g' \ -+ -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GL_GNULIB_UNISTD_H_SIGPIPE)/g' \ -+ -e 's/@''GNULIB_UNLINK''@/$(GL_GNULIB_UNLINK)/g' \ -+ -e 's/@''GNULIB_UNLINKAT''@/$(GL_GNULIB_UNLINKAT)/g' \ -+ -e 's/@''GNULIB_USLEEP''@/$(GL_GNULIB_USLEEP)/g' \ -+ -e 's/@''GNULIB_WRITE''@/$(GL_GNULIB_WRITE)/g' \ -+ -e 's/@''GNULIB_MDA_ACCESS''@/$(GL_GNULIB_MDA_ACCESS)/g' \ -+ -e 's/@''GNULIB_MDA_CHDIR''@/$(GL_GNULIB_MDA_CHDIR)/g' \ -+ -e 's/@''GNULIB_MDA_CLOSE''@/$(GL_GNULIB_MDA_CLOSE)/g' \ -+ -e 's/@''GNULIB_MDA_DUP''@/$(GL_GNULIB_MDA_DUP)/g' \ -+ -e 's/@''GNULIB_MDA_DUP2''@/$(GL_GNULIB_MDA_DUP2)/g' \ -+ -e 's/@''GNULIB_MDA_EXECL''@/$(GL_GNULIB_MDA_EXECL)/g' \ -+ -e 's/@''GNULIB_MDA_EXECLE''@/$(GL_GNULIB_MDA_EXECLE)/g' \ -+ -e 's/@''GNULIB_MDA_EXECLP''@/$(GL_GNULIB_MDA_EXECLP)/g' \ -+ -e 's/@''GNULIB_MDA_EXECV''@/$(GL_GNULIB_MDA_EXECV)/g' \ -+ -e 's/@''GNULIB_MDA_EXECVE''@/$(GL_GNULIB_MDA_EXECVE)/g' \ -+ -e 's/@''GNULIB_MDA_EXECVP''@/$(GL_GNULIB_MDA_EXECVP)/g' \ -+ -e 's/@''GNULIB_MDA_EXECVPE''@/$(GL_GNULIB_MDA_EXECVPE)/g' \ -+ -e 's/@''GNULIB_MDA_GETCWD''@/$(GL_GNULIB_MDA_GETCWD)/g' \ -+ -e 's/@''GNULIB_MDA_GETPID''@/$(GL_GNULIB_MDA_GETPID)/g' \ -+ -e 's/@''GNULIB_MDA_ISATTY''@/$(GL_GNULIB_MDA_ISATTY)/g' \ -+ -e 's/@''GNULIB_MDA_LSEEK''@/$(GL_GNULIB_MDA_LSEEK)/g' \ -+ -e 's/@''GNULIB_MDA_READ''@/$(GL_GNULIB_MDA_READ)/g' \ -+ -e 's/@''GNULIB_MDA_RMDIR''@/$(GL_GNULIB_MDA_RMDIR)/g' \ -+ -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \ -+ -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \ -+ -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \ - < $(srcdir)/unistd.in.h | \ - sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ - -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ -@@ -2080,49 +2196,49 @@ wchar.h: wchar.in.h $(top_builddir)/conf - -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ - -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ - -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -- -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -- -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ -- -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ -- -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \ -- -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \ -- -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \ -- -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \ -- -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \ -- -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \ -- -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \ -- -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \ -- -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \ -- -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \ -- -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \ -- -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \ -- -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \ -- -e 's/@''GNULIB_WMEMPCPY''@/$(GNULIB_WMEMPCPY)/g' \ -- -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \ -- -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \ -- -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \ -- -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \ -- -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \ -- -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \ -- -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \ -- -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \ -- -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \ -- -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \ -- -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \ -- -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \ -- -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \ -- -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \ -- -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \ -- -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \ -- -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \ -- -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \ -- -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \ -- -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \ -- -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \ -- -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ -- -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ -- -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ -- -e 's/@''GNULIB_WCSFTIME''@/$(GNULIB_WCSFTIME)/g' \ -- -e 's/@''GNULIB_MDA_WCSDUP''@/$(GNULIB_MDA_WCSDUP)/g' \ -+ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ -+ -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \ -+ -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \ -+ -e 's/@''GNULIB_MBSINIT''@/$(GL_GNULIB_MBSINIT)/g' \ -+ -e 's/@''GNULIB_MBRTOWC''@/$(GL_GNULIB_MBRTOWC)/g' \ -+ -e 's/@''GNULIB_MBRLEN''@/$(GL_GNULIB_MBRLEN)/g' \ -+ -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \ -+ -e 's/@''GNULIB_MBSNRTOWCS''@/$(GL_GNULIB_MBSNRTOWCS)/g' \ -+ -e 's/@''GNULIB_WCRTOMB''@/$(GL_GNULIB_WCRTOMB)/g' \ -+ -e 's/@''GNULIB_WCSRTOMBS''@/$(GL_GNULIB_WCSRTOMBS)/g' \ -+ -e 's/@''GNULIB_WCSNRTOMBS''@/$(GL_GNULIB_WCSNRTOMBS)/g' \ -+ -e 's/@''GNULIB_WCWIDTH''@/$(GL_GNULIB_WCWIDTH)/g' \ -+ -e 's/@''GNULIB_WMEMCHR''@/$(GL_GNULIB_WMEMCHR)/g' \ -+ -e 's/@''GNULIB_WMEMCMP''@/$(GL_GNULIB_WMEMCMP)/g' \ -+ -e 's/@''GNULIB_WMEMCPY''@/$(GL_GNULIB_WMEMCPY)/g' \ -+ -e 's/@''GNULIB_WMEMMOVE''@/$(GL_GNULIB_WMEMMOVE)/g' \ -+ -e 's/@''GNULIB_WMEMPCPY''@/$(GL_GNULIB_WMEMPCPY)/g' \ -+ -e 's/@''GNULIB_WMEMSET''@/$(GL_GNULIB_WMEMSET)/g' \ -+ -e 's/@''GNULIB_WCSLEN''@/$(GL_GNULIB_WCSLEN)/g' \ -+ -e 's/@''GNULIB_WCSNLEN''@/$(GL_GNULIB_WCSNLEN)/g' \ -+ -e 's/@''GNULIB_WCSCPY''@/$(GL_GNULIB_WCSCPY)/g' \ -+ -e 's/@''GNULIB_WCPCPY''@/$(GL_GNULIB_WCPCPY)/g' \ -+ -e 's/@''GNULIB_WCSNCPY''@/$(GL_GNULIB_WCSNCPY)/g' \ -+ -e 's/@''GNULIB_WCPNCPY''@/$(GL_GNULIB_WCPNCPY)/g' \ -+ -e 's/@''GNULIB_WCSCAT''@/$(GL_GNULIB_WCSCAT)/g' \ -+ -e 's/@''GNULIB_WCSNCAT''@/$(GL_GNULIB_WCSNCAT)/g' \ -+ -e 's/@''GNULIB_WCSCMP''@/$(GL_GNULIB_WCSCMP)/g' \ -+ -e 's/@''GNULIB_WCSNCMP''@/$(GL_GNULIB_WCSNCMP)/g' \ -+ -e 's/@''GNULIB_WCSCASECMP''@/$(GL_GNULIB_WCSCASECMP)/g' \ -+ -e 's/@''GNULIB_WCSNCASECMP''@/$(GL_GNULIB_WCSNCASECMP)/g' \ -+ -e 's/@''GNULIB_WCSCOLL''@/$(GL_GNULIB_WCSCOLL)/g' \ -+ -e 's/@''GNULIB_WCSXFRM''@/$(GL_GNULIB_WCSXFRM)/g' \ -+ -e 's/@''GNULIB_WCSDUP''@/$(GL_GNULIB_WCSDUP)/g' \ -+ -e 's/@''GNULIB_WCSCHR''@/$(GL_GNULIB_WCSCHR)/g' \ -+ -e 's/@''GNULIB_WCSRCHR''@/$(GL_GNULIB_WCSRCHR)/g' \ -+ -e 's/@''GNULIB_WCSCSPN''@/$(GL_GNULIB_WCSCSPN)/g' \ -+ -e 's/@''GNULIB_WCSSPN''@/$(GL_GNULIB_WCSSPN)/g' \ -+ -e 's/@''GNULIB_WCSPBRK''@/$(GL_GNULIB_WCSPBRK)/g' \ -+ -e 's/@''GNULIB_WCSSTR''@/$(GL_GNULIB_WCSSTR)/g' \ -+ -e 's/@''GNULIB_WCSTOK''@/$(GL_GNULIB_WCSTOK)/g' \ -+ -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \ -+ -e 's/@''GNULIB_WCSFTIME''@/$(GL_GNULIB_WCSFTIME)/g' \ -+ -e 's/@''GNULIB_MDA_WCSDUP''@/$(GL_GNULIB_MDA_WCSDUP)/g' \ - < $(srcdir)/wchar.in.h | \ - sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ - -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ -@@ -2222,14 +2338,14 @@ wctype.h: wctype.in.h $(top_builddir)/co - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ - -e 's/@''HAVE_CRTDEFS_H''@/$(HAVE_CRTDEFS_H)/g' \ -- -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ -- -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ -- -e 's/@''GNULIB_ISWDIGIT''@/$(GNULIB_ISWDIGIT)/g' \ -- -e 's/@''GNULIB_ISWXDIGIT''@/$(GNULIB_ISWXDIGIT)/g' \ -- -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \ -- -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \ -- -e 's/@''GNULIB_WCTRANS''@/$(GNULIB_WCTRANS)/g' \ -- -e 's/@''GNULIB_TOWCTRANS''@/$(GNULIB_TOWCTRANS)/g' \ -+ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ -+ -e 's/@''GNULIB_ISWBLANK''@/$(GL_GNULIB_ISWBLANK)/g' \ -+ -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \ -+ -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \ -+ -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \ -+ -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \ -+ -e 's/@''GNULIB_WCTRANS''@/$(GL_GNULIB_WCTRANS)/g' \ -+ -e 's/@''GNULIB_TOWCTRANS''@/$(GL_GNULIB_TOWCTRANS)/g' \ - -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ - -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ - -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \ ---- a/gnulib/lib/_Noreturn.h -+++ b/gnulib/lib/_Noreturn.h -@@ -2,16 +2,16 @@ - Copyright (C) 2011-2021 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -+ under the terms of the GNU Lesser General Public License as published -+ by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _Noreturn ---- a/gnulib/lib/alloca.in.h -+++ b/gnulib/lib/alloca.in.h -@@ -3,20 +3,18 @@ - Copyright (C) 1995, 1999, 2001-2004, 2006-2021 Free Software Foundation, - Inc. - -- This program is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -- License along with this program; if not, see -- . -- */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H - means there is a real alloca function. */ ---- a/gnulib/lib/arg-nonnull.h -+++ b/gnulib/lib/arg-nonnull.h -@@ -2,16 +2,16 @@ - Copyright (C) 2009-2021 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -+ under the terms of the GNU Lesser General Public License as published -+ by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools ---- a/gnulib/lib/argz.c -+++ b/gnulib/lib/argz.c -@@ -3,18 +3,18 @@ - Foundation, Inc. - This file is part of the GNU C Library. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/argz.in.h -+++ b/gnulib/lib/argz.in.h -@@ -3,17 +3,17 @@ - Inc. - This file is part of the GNU C Library. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _ARGZ_H ---- a/gnulib/lib/asnprintf.c -+++ b/gnulib/lib/asnprintf.c -@@ -1,18 +1,18 @@ - /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006, 2009-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/asprintf.c -+++ b/gnulib/lib/asprintf.c -@@ -2,18 +2,18 @@ - Copyright (C) 1999, 2002, 2006-2007, 2009-2021 Free Software Foundation, - Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/attribute.h -+++ b/gnulib/lib/attribute.h -@@ -2,17 +2,17 @@ - - Copyright 2020-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Paul Eggert. */ ---- a/gnulib/lib/basename-lgpl.c -+++ b/gnulib/lib/basename-lgpl.c -@@ -3,17 +3,17 @@ - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2021 Free Software - Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/basename-lgpl.h -+++ b/gnulib/lib/basename-lgpl.h -@@ -1,20 +1,20 @@ --/* Extract the last component (base name) of a file name. -+/* Extract the last component (base name) of a file name. - -- Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation, -- Inc. -+ Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation, -+ Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _BASENAME_LGPL_H - #define _BASENAME_LGPL_H ---- a/gnulib/lib/btowc.c -+++ b/gnulib/lib/btowc.c -@@ -2,17 +2,17 @@ - Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2008. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/c++defs.h -+++ b/gnulib/lib/c++defs.h -@@ -2,16 +2,16 @@ - Copyright (C) 2010-2021 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -+ under the terms of the GNU Lesser General Public License as published -+ by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _GL_CXXDEFS_H ---- /dev/null -+++ b/gnulib/lib/calloc.c -@@ -0,0 +1,55 @@ -+/* calloc() function that is glibc compatible. -+ This wrapper function is required at least on Tru64 UNIX 5.1 and mingw. -+ Copyright (C) 2004-2007, 2009-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ -+/* written by Jim Meyering and Bruno Haible */ -+ -+#include -+ -+/* Specification. */ -+#include -+ -+#include -+ -+#include "xalloc-oversized.h" -+ -+/* Call the system's calloc below. */ -+#undef calloc -+ -+/* Allocate and zero-fill an NxS-byte block of memory from the heap, -+ even if N or S is zero. */ -+ -+void * -+rpl_calloc (size_t n, size_t s) -+{ -+ if (n == 0 || s == 0) -+ n = s = 1; -+ -+ if (xalloc_oversized (n, s)) -+ { -+ errno = ENOMEM; -+ return NULL; -+ } -+ -+ void *result = calloc (n, s); -+ -+#if !HAVE_MALLOC_POSIX -+ if (result == NULL) -+ errno = ENOMEM; -+#endif -+ -+ return result; -+} ---- a/gnulib/lib/cdefs.h -+++ b/gnulib/lib/cdefs.h -@@ -2,16 +2,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -@@ -259,10 +259,12 @@ - # define __attribute_const__ /* Ignore */ - #endif - --#if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__ --# define __attribute_maybe_unused__ [[__maybe_unused__]] --#elif __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) -+#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) - # define __attribute_maybe_unused__ __attribute__ ((__unused__)) -+/* Once the next version of the C standard comes out, we can -+ do something like the following here: -+ #elif defined __STDC_VERSION__ && 202???L <= __STDC_VERSION__ -+ # define __attribute_maybe_unused__ [[__maybe_unused__]] */ - #else - # define __attribute_maybe_unused__ /* Ignore */ - #endif -@@ -320,7 +322,9 @@ - #endif - - /* The nonnull function attribute marks pointer parameters that -- must not be NULL. */ -+ must not be NULL. This has the name __nonnull in glibc, -+ and __attribute_nonnull__ in files shared with Gnulib to avoid -+ collision with a different __nonnull in DragonFlyBSD 5.9. */ - #ifndef __attribute_nonnull__ - # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) - # define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params)) -@@ -485,9 +489,9 @@ - [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] - #endif - --/* The #ifndef lets Gnulib avoid including these on non-glibc -- platforms, where the includes typically do not exist. */ --#ifndef __WORDSIZE -+/* Gnulib avoids including these, as they don't work on non-glibc or -+ older glibc platforms. */ -+#ifndef __GNULIB_CDEFS - # include - # include - #endif ---- a/gnulib/lib/cloexec.c -+++ b/gnulib/lib/cloexec.c -@@ -2,20 +2,20 @@ - - Copyright (C) 1991, 2004-2006, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - -- The code is taken from glibc/manual/llio.texi */ -+/* The code is taken from glibc/manual/llio.texi */ - - #include - ---- a/gnulib/lib/cloexec.h -+++ b/gnulib/lib/cloexec.h -@@ -2,20 +2,18 @@ - - Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --*/ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/close.c -+++ b/gnulib/lib/close.c -@@ -1,17 +1,17 @@ - /* close replacement. - Copyright (C) 2008-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/dup2.c -+++ b/gnulib/lib/dup2.c -@@ -2,17 +2,17 @@ - - Copyright (C) 1999, 2004-2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* written by Paul Eggert */ ---- a/gnulib/lib/dynarray.h -+++ b/gnulib/lib/dynarray.h -@@ -1,17 +1,17 @@ - /* Type-safe arrays which grow dynamically. - Copyright 2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Paul Eggert and Bruno Haible, 2021. */ -@@ -257,18 +257,22 @@ static DYNARRAY_ELEMENT * - - #if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX - --# include -+# ifndef _GL_LIKELY -+/* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */ -+# define _GL_LIKELY(cond) __builtin_expect ((cond), 1) -+# define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0) -+# endif - - /* Define auxiliary structs and declare auxiliary functions, common to all - instantiations of dynarray. */ --# include -+# include - - /* Define the instantiation, specified through - DYNARRAY_STRUCT - DYNARRAY_ELEMENT - DYNARRAY_PREFIX - etc. */ --# include -+# include - - #else - ---- a/gnulib/lib/errno.in.h -+++ b/gnulib/lib/errno.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2008-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _@GUARD_PREFIX@_ERRNO_H - ---- a/gnulib/lib/error.c -+++ b/gnulib/lib/error.c -@@ -2,17 +2,17 @@ - Copyright (C) 1990-1998, 2000-2007, 2009-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by David MacKenzie . */ ---- a/gnulib/lib/error.h -+++ b/gnulib/lib/error.h -@@ -3,17 +3,17 @@ - Inc. - This file is part of the GNU C Library. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _ERROR_H ---- a/gnulib/lib/exitfail.c -+++ b/gnulib/lib/exitfail.c -@@ -2,17 +2,17 @@ - - Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/exitfail.h -+++ b/gnulib/lib/exitfail.h -@@ -2,17 +2,17 @@ - - Copyright (C) 2002, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - extern int volatile exit_failure; ---- a/gnulib/lib/fcntl.c -+++ b/gnulib/lib/fcntl.c -@@ -2,17 +2,17 @@ - - Copyright (C) 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Eric Blake . */ ---- a/gnulib/lib/fcntl.in.h -+++ b/gnulib/lib/fcntl.in.h -@@ -2,17 +2,17 @@ - - Copyright (C) 2006-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* written by Paul Eggert */ ---- a/gnulib/lib/fd-hook.c -+++ b/gnulib/lib/fd-hook.c -@@ -2,17 +2,17 @@ - Copyright (C) 2009-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2009. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/fd-hook.h -+++ b/gnulib/lib/fd-hook.h -@@ -1,17 +1,17 @@ - /* Hook for making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - ---- a/gnulib/lib/filename.h -+++ b/gnulib/lib/filename.h -@@ -3,16 +3,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/float+.h -+++ b/gnulib/lib/float+.h -@@ -2,18 +2,18 @@ - Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2007. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _FLOATPLUS_H - #define _FLOATPLUS_H ---- a/gnulib/lib/float.c -+++ b/gnulib/lib/float.c -@@ -2,17 +2,17 @@ - Copyright (C) 2011-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2011. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/float.in.h -+++ b/gnulib/lib/float.in.h -@@ -2,17 +2,17 @@ - - Copyright (C) 2007-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _@GUARD_PREFIX@_FLOAT_H ---- /dev/null -+++ b/gnulib/lib/free.c -@@ -0,0 +1,53 @@ -+/* Make free() preserve errno. -+ -+ Copyright (C) 2003, 2006, 2009-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ -+/* written by Paul Eggert */ -+ -+#include -+ -+/* Specification. */ -+#include -+ -+/* A function definition is only needed if HAVE_FREE_POSIX is not defined. */ -+#if !HAVE_FREE_POSIX -+ -+# include -+ -+void -+rpl_free (void *p) -+# undef free -+{ -+# if defined __GNUC__ && !defined __clang__ -+ /* An invalid GCC optimization -+ -+ would optimize away the assignments in the code below, when link-time -+ optimization (LTO) is enabled. Make the code more complicated, so that -+ GCC does not grok how to optimize it. */ -+ int err[2]; -+ err[0] = errno; -+ err[1] = errno; -+ errno = 0; -+ free (p); -+ errno = err[errno == 0]; -+# else -+ int err = errno; -+ free (p); -+ errno = err; -+# endif -+} -+ -+#endif ---- a/gnulib/lib/fstat.c -+++ b/gnulib/lib/fstat.c -@@ -1,17 +1,17 @@ - /* fstat() replacement. - Copyright (C) 2011-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* If the user's config.h happens to include , let it include only ---- a/gnulib/lib/getdtablesize.c -+++ b/gnulib/lib/getdtablesize.c -@@ -2,17 +2,17 @@ - Copyright (C) 2008-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2008. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/getopt-cdefs.in.h -+++ b/gnulib/lib/getopt-cdefs.in.h -@@ -4,19 +4,18 @@ - Unlike most of the getopt implementation, it is NOT shared - with the GNU C Library. - -- This file is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This file is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -- License along with gnulib; if not, see -- . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _GETOPT_CDEFS_H - #define _GETOPT_CDEFS_H 1 ---- a/gnulib/lib/getopt-core.h -+++ b/gnulib/lib/getopt-core.h -@@ -4,16 +4,16 @@ - Patches to this file should be submitted to both projects. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/getopt-ext.h -+++ b/gnulib/lib/getopt-ext.h -@@ -4,16 +4,16 @@ - Patches to this file should be submitted to both projects. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/getopt-pfx-core.h -+++ b/gnulib/lib/getopt-pfx-core.h -@@ -4,19 +4,18 @@ - Unlike most of the getopt implementation, it is NOT shared - with the GNU C Library. - -- This file is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This file is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -- License along with gnulib; if not, see -- . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _GETOPT_PFX_CORE_H - #define _GETOPT_PFX_CORE_H 1 ---- a/gnulib/lib/getopt-pfx-ext.h -+++ b/gnulib/lib/getopt-pfx-ext.h -@@ -4,19 +4,18 @@ - Unlike most of the getopt implementation, it is NOT shared - with the GNU C Library. - -- This file is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This file is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -- License along with gnulib; if not, see -- . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _GETOPT_PFX_EXT_H - #define _GETOPT_PFX_EXT_H 1 ---- a/gnulib/lib/getopt.c -+++ b/gnulib/lib/getopt.c -@@ -4,16 +4,16 @@ - Patches to this file should be submitted to both projects. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/getopt.in.h -+++ b/gnulib/lib/getopt.in.h -@@ -5,18 +5,18 @@ - with the GNU C Library, which supplies a different version of - this file. - -- This file is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as -- published by the Free Software Foundation; either version 3 of -- the License, or (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This file is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -- License along with gnulib; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _@GUARD_PREFIX@_GETOPT_H - ---- a/gnulib/lib/getopt1.c -+++ b/gnulib/lib/getopt1.c -@@ -4,16 +4,16 @@ - Patches to this file should be submitted to both projects. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/getopt_int.h -+++ b/gnulib/lib/getopt_int.h -@@ -4,16 +4,16 @@ - Patches to this file should be submitted to both projects. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/getprogname.c -+++ b/gnulib/lib/getprogname.c -@@ -2,16 +2,16 @@ - Copyright (C) 2016-2021 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -+ it under the terms of the GNU Lesser General Public License as published by -+ the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include -@@ -43,7 +43,7 @@ - # include - #endif - --#ifdef __sgi -+#if defined __sgi || defined __osf__ - # include - # include - # include -@@ -224,11 +224,15 @@ getprogname (void) - free (buf.ps_pathptr); - } - return p; --# elif defined __sgi /* IRIX */ -+# elif defined __sgi || defined __osf__ /* IRIX or Tru64 */ - char filename[50]; - int fd; - -- sprintf (filename, "/proc/pinfo/%d", (int) getpid ()); -+ # if defined __sgi -+ sprintf (filename, "/proc/pinfo/%d", (int) getpid ()); -+ # else -+ sprintf (filename, "/proc/%d", (int) getpid ()); -+ # endif - fd = open (filename, O_RDONLY | O_CLOEXEC); - if (0 <= fd) - { ---- a/gnulib/lib/getprogname.h -+++ b/gnulib/lib/getprogname.h -@@ -2,16 +2,16 @@ - Copyright (C) 2016-2021 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -+ it under the terms of the GNU Lesser General Public License as published by -+ the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _GL_GETPROGNAME_H ---- a/gnulib/lib/gettext.h -+++ b/gnulib/lib/gettext.h -@@ -2,18 +2,18 @@ - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 Free Software - Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _LIBGETTEXT_H - #define _LIBGETTEXT_H 1 ---- a/gnulib/lib/glthread/lock.c -+++ b/gnulib/lib/glthread/lock.c -@@ -1,18 +1,18 @@ - /* Locking in multithreaded situations. - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-posix.h, gthr-posix95.h. */ ---- a/gnulib/lib/glthread/lock.h -+++ b/gnulib/lib/glthread/lock.h -@@ -1,18 +1,18 @@ - /* Locking in multithreaded situations. - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */ ---- a/gnulib/lib/glthread/threadlib.c -+++ b/gnulib/lib/glthread/threadlib.c -@@ -1,18 +1,18 @@ - /* Multithreading primitives. - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. */ - ---- a/gnulib/lib/hard-locale.c -+++ b/gnulib/lib/hard-locale.c -@@ -3,17 +3,17 @@ - Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2021 Free Software - Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/hard-locale.h -+++ b/gnulib/lib/hard-locale.h -@@ -2,17 +2,17 @@ - - Copyright (C) 1999, 2003-2004, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef HARD_LOCALE_H_ ---- /dev/null -+++ b/gnulib/lib/ialloc.c -@@ -0,0 +1,21 @@ -+/* malloc with idx_t rather than size_t -+ -+ Copyright 2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+#define IALLOC_INLINE _GL_EXTERN_INLINE -+#include "ialloc.h" ---- /dev/null -+++ b/gnulib/lib/ialloc.h -@@ -0,0 +1,94 @@ -+/* ialloc.h -- malloc with idx_t rather than size_t -+ -+ Copyright 2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ -+#ifndef IALLOC_H_ -+#define IALLOC_H_ -+ -+#include "idx.h" -+ -+#include -+#include -+#include -+ -+#ifndef _GL_INLINE_HEADER_BEGIN -+ #error "Please include config.h first." -+#endif -+_GL_INLINE_HEADER_BEGIN -+#ifndef IALLOC_INLINE -+# define IALLOC_INLINE _GL_INLINE -+#endif -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+IALLOC_INLINE void * _GL_ATTRIBUTE_COLD -+_gl_alloc_nomem (void) -+{ -+ errno = ENOMEM; -+ return NULL; -+} -+ -+IALLOC_INLINE void * -+imalloc (idx_t s) -+{ -+ return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem (); -+} -+ -+IALLOC_INLINE void * -+irealloc (void *p, idx_t s) -+{ -+ /* Work around GNU realloc glitch by treating a zero size as if it -+ were 1, so that returning NULL is equivalent to failing. */ -+ return s <= SIZE_MAX ? realloc (p, s | !s) : _gl_alloc_nomem (); -+} -+ -+IALLOC_INLINE void * -+icalloc (idx_t n, idx_t s) -+{ -+ if (SIZE_MAX < n) -+ { -+ if (s != 0) -+ return _gl_alloc_nomem (); -+ n = 0; -+ } -+ if (SIZE_MAX < s) -+ { -+ if (n != 0) -+ return _gl_alloc_nomem (); -+ s = 0; -+ } -+ return calloc (n, s); -+} -+ -+IALLOC_INLINE void * -+ireallocarray (void *p, idx_t n, idx_t s) -+{ -+ /* Work around GNU reallocarray glitch by treating a zero size as if -+ it were 1, so that returning NULL is equivalent to failing. */ -+ if (n == 0 || s == 0) -+ n = s = 1; -+ return (n <= SIZE_MAX && s <= SIZE_MAX -+ ? reallocarray (p, n, s) -+ : _gl_alloc_nomem ()); -+} -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif ---- /dev/null -+++ b/gnulib/lib/idx.h -@@ -0,0 +1,114 @@ -+/* A type for indices and sizes. -+ Copyright (C) 2020-2021 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#ifndef _IDX_H -+#define _IDX_H -+ -+/* Get ptrdiff_t. */ -+#include -+ -+/* Get PTRDIFF_MAX. */ -+#include -+ -+/* The type 'idx_t' holds an (array) index or an (object) size. -+ Its implementation promotes to a signed integer type, -+ which can hold the values -+ 0..2^63-1 (on 64-bit platforms) or -+ 0..2^31-1 (on 32-bit platforms). -+ -+ Why a signed integer type? -+ -+ * Security: Signed types can be checked for overflow via -+ '-fsanitize=undefined', but unsigned types cannot. -+ -+ * Comparisons without surprises: ISO C99 § 6.3.1.8 specifies a few -+ surprising results for comparisons, such as -+ -+ (int) -3 < (unsigned long) 7 => false -+ (int) -3 < (unsigned int) 7 => false -+ and on 32-bit machines: -+ (long) -3 < (unsigned int) 7 => false -+ -+ This is surprising because the natural comparison order is by -+ value in the realm of infinite-precision signed integers (ℤ). -+ -+ The best way to get rid of such surprises is to use signed types -+ for numerical integer values, and use unsigned types only for -+ bit masks and enums. -+ -+ Why not use 'size_t' directly? -+ -+ * Because 'size_t' is an unsigned type, and a signed type is better. -+ See above. -+ -+ Why not use 'ptrdiff_t' directly? -+ -+ * Maintainability: When reading and modifying code, it helps to know that -+ a certain variable cannot have negative values. For example, when you -+ have a loop -+ -+ int n = ...; -+ for (int i = 0; i < n; i++) ... -+ -+ or -+ -+ ptrdiff_t n = ...; -+ for (ptrdiff_t i = 0; i < n; i++) ... -+ -+ you have to ask yourself "what if n < 0?". Whereas in -+ -+ idx_t n = ...; -+ for (idx_t i = 0; i < n; i++) ... -+ -+ you know that this case cannot happen. -+ -+ Similarly, when a programmer writes -+ -+ idx_t = ptr2 - ptr1; -+ -+ there is an implied assertion that ptr1 and ptr2 point into the same -+ object and that ptr1 <= ptr2. -+ -+ * Being future-proof: In the future, range types (integers which are -+ constrained to a certain range of values) may be added to C compilers -+ or to the C standard. Several programming languages (Ada, Haskell, -+ Common Lisp, Pascal) already have range types. Such range types may -+ help producing good code and good warnings. The type 'idx_t' could -+ then be typedef'ed to a range type that is signed after promotion. */ -+ -+/* In the future, idx_t could be typedef'ed to a signed range type. -+ The clang "extended integer types", supported in Clang 11 or newer -+ , -+ are a special case of range types. However, these types don't support binary -+ operators with plain integer types (e.g. expressions such as x > 1). -+ Therefore, they don't behave like signed types (and not like unsigned types -+ either). So, we cannot use them here. */ -+ -+/* Use the signed type 'ptrdiff_t'. */ -+/* Note: ISO C does not mandate that 'size_t' and 'ptrdiff_t' have the same -+ size, but it is so on all platforms we have seen since 1990. */ -+typedef ptrdiff_t idx_t; -+ -+/* IDX_MAX is the maximum value of an idx_t. */ -+#define IDX_MAX PTRDIFF_MAX -+ -+/* So far no need has been found for an IDX_WIDTH macro. -+ Perhaps there should be another macro IDX_VALUE_BITS that does not -+ count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ -+ -+#endif /* _IDX_H */ ---- a/gnulib/lib/intprops.h -+++ b/gnulib/lib/intprops.h -@@ -3,16 +3,16 @@ - Copyright (C) 2001-2021 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -+ under the terms of the GNU Lesser General Public License as published -+ by the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Paul Eggert. */ -@@ -133,7 +133,8 @@ - operators might not yield numerically correct answers due to - arithmetic overflow. They do not rely on undefined or - implementation-defined behavior. Their implementations are simple -- and straightforward, but they are a bit harder to use than the -+ and straightforward, but they are harder to use and may be less -+ efficient than the INT__WRAPV, INT__OK, and - INT__OVERFLOW macros described below. - - Example usage: -@@ -158,6 +159,9 @@ - must have minimum value MIN and maximum MAX. Unsigned types should - use a zero MIN of the proper type. - -+ Because all arguments are subject to integer promotions, these -+ macros typically do not work on types narrower than 'int'. -+ - These macros are tuned for constant MIN and MAX. For commutative - operations such as A + B, they are also tuned for constant B. */ - -@@ -339,9 +343,15 @@ - arguments should not have side effects. - - The WRAPV macros are not constant expressions. They support only -- +, binary -, and *. Because the WRAPV macros convert the result, -- they report overflow in different circumstances than the OVERFLOW -- macros do. -+ +, binary -, and *. -+ -+ Because the WRAPV macros convert the result, they report overflow -+ in different circumstances than the OVERFLOW macros do. For -+ example, in the typical case with 16-bit 'short' and 32-bit 'int', -+ if A, B and R are all of type 'short' then INT_ADD_OVERFLOW (A, B) -+ returns false because the addition cannot overflow after A and B -+ are converted to 'int', whereas INT_ADD_WRAPV (A, B, &R) returns -+ true or false depending on whether the sum fits into 'short'. - - These macros are tuned for their last input argument being a constant. - ---- a/gnulib/lib/inttypes.in.h -+++ b/gnulib/lib/inttypes.in.h -@@ -2,17 +2,17 @@ - Written by Paul Eggert, Bruno Haible, Derek Price. - This file is part of gnulib. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* ---- a/gnulib/lib/iswblank.c -+++ b/gnulib/lib/iswblank.c -@@ -1,18 +1,18 @@ - /* Test wide character for being blank. - Copyright (C) 2008-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/iswdigit.c -+++ b/gnulib/lib/iswdigit.c -@@ -1,18 +1,18 @@ - /* Test wide character for being a digit. - Copyright (C) 2020-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/iswxdigit.c -+++ b/gnulib/lib/iswxdigit.c -@@ -1,18 +1,18 @@ - /* Test wide character for being a hexadecimal digit. - Copyright (C) 2020-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/itold.c -+++ b/gnulib/lib/itold.c -@@ -2,17 +2,17 @@ - Copyright (C) 2011-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2011. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/langinfo.in.h -+++ b/gnulib/lib/langinfo.in.h -@@ -1,18 +1,18 @@ - /* Substitute for and wrapper around . - Copyright (C) 2009-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* - * POSIX for platforms that lack it or have an incomplete one. ---- a/gnulib/lib/lc-charset-dispatch.c -+++ b/gnulib/lib/lc-charset-dispatch.c -@@ -1,17 +1,17 @@ - /* Dispatching based on the current locale's character encoding. - Copyright (C) 2018-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2018. */ ---- a/gnulib/lib/lc-charset-dispatch.h -+++ b/gnulib/lib/lc-charset-dispatch.h -@@ -1,17 +1,17 @@ - /* Dispatching based on the current locale's character encoding. - Copyright (C) 2018-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2018. */ ---- a/gnulib/lib/libc-config.h -+++ b/gnulib/lib/libc-config.h -@@ -3,16 +3,16 @@ - Copyright 2017-2021 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with this program; if not, see - . */ - -@@ -28,7 +28,10 @@ - - When compiled as part of glibc this is a no-op; when compiled as - part of Gnulib this includes Gnulib's and defines macros -- that glibc library code would normally assume. */ -+ that glibc library code would normally assume. -+ -+ Note: This header file MUST NOT be included by public header files -+ of Gnulib. */ - - #include - -@@ -71,7 +74,7 @@ - # endif - #endif - --#ifndef __attribute_maybe_unused__ -+#ifndef __attribute_nonnull__ - /* either does not exist, or is too old for Gnulib. - Prepare to include , which is Gnulib's version of a - more-recent glibc . */ -@@ -80,13 +83,9 @@ - # ifndef _FEATURES_H - # define _FEATURES_H 1 - # endif --/* Define __WORDSIZE so that does not attempt to include -- nonexistent files. Make it a syntax error, since Gnulib does not -- use __WORDSIZE now, and if Gnulib uses it later the syntax error -- will let us know that __WORDSIZE needs configuring. */ --# ifndef __WORDSIZE --# define __WORDSIZE %%% --# endif -+/* Define __GNULIB_CDEFS so that does not attempt to include -+ nonexistent files. */ -+# define __GNULIB_CDEFS - /* Undef the macros unconditionally defined by our copy of glibc - , so that they do not clash with any system-defined - versions. */ ---- a/gnulib/lib/limits.in.h -+++ b/gnulib/lib/limits.in.h -@@ -2,18 +2,18 @@ - - Copyright 2016-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 3, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #if __GNUC__ >= 3 - @PRAGMA_SYSTEM_HEADER@ ---- a/gnulib/lib/localcharset.c -+++ b/gnulib/lib/localcharset.c -@@ -2,18 +2,18 @@ - - Copyright (C) 2000-2006, 2008-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible . */ - ---- a/gnulib/lib/localcharset.h -+++ b/gnulib/lib/localcharset.h -@@ -2,18 +2,18 @@ - Copyright (C) 2000-2003, 2009-2021 Free Software Foundation, Inc. - This file is part of the GNU CHARSET Library. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _LOCALCHARSET_H - #define _LOCALCHARSET_H ---- a/gnulib/lib/locale.in.h -+++ b/gnulib/lib/locale.in.h -@@ -1,17 +1,17 @@ - /* A POSIX . - Copyright (C) 2007-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #if __GNUC__ >= 3 ---- a/gnulib/lib/localeconv.c -+++ b/gnulib/lib/localeconv.c -@@ -1,17 +1,17 @@ - /* Query locale dependent information for formatting numbers. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/malloc.c -+++ b/gnulib/lib/malloc.c -@@ -2,61 +2,50 @@ - - Copyright (C) 1997-1998, 2006-2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* written by Jim Meyering and Bruno Haible */ - - #define _GL_USE_STDLIB_ALLOC 1 - #include --/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ --#ifdef malloc --# define NEED_MALLOC_GNU 1 --# undef malloc --/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */ --#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU --# define NEED_MALLOC_GNU 1 --#endif - - #include - --/* A function definition is only needed if NEED_MALLOC_GNU is defined above -- or if the module 'malloc-posix' requests it. */ --#if NEED_MALLOC_GNU || (GNULIB_MALLOC_POSIX && !HAVE_MALLOC_POSIX) -+#include - --# include -+#include "xalloc-oversized.h" - --/* Allocate an N-byte block of memory from the heap. -- If N is zero, allocate a 1-byte block. */ -+/* Allocate an N-byte block of memory from the heap, even if N is 0. */ - - void * - rpl_malloc (size_t n) - { -- void *result; -- --# if NEED_MALLOC_GNU - if (n == 0) - n = 1; --# endif - -- result = malloc (n); -+ if (xalloc_oversized (n, 1)) -+ { -+ errno = ENOMEM; -+ return NULL; -+ } -+ -+ void *result = malloc (n); - --# if !HAVE_MALLOC_POSIX -+#if !HAVE_MALLOC_POSIX - if (result == NULL) - errno = ENOMEM; --# endif -+#endif - - return result; - } -- --#endif ---- a/gnulib/lib/malloc/dynarray-skeleton.c -+++ b/gnulib/lib/malloc/dynarray-skeleton.c -@@ -3,16 +3,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/malloc/dynarray.h -+++ b/gnulib/lib/malloc/dynarray.h -@@ -3,16 +3,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/malloc/dynarray_at_failure.c -+++ b/gnulib/lib/malloc/dynarray_at_failure.c -@@ -3,16 +3,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/malloc/dynarray_emplace_enlarge.c -+++ b/gnulib/lib/malloc/dynarray_emplace_enlarge.c -@@ -3,16 +3,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/malloc/dynarray_finalize.c -+++ b/gnulib/lib/malloc/dynarray_finalize.c -@@ -3,16 +3,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/malloc/dynarray_resize.c -+++ b/gnulib/lib/malloc/dynarray_resize.c -@@ -3,16 +3,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/malloc/dynarray_resize_clear.c -+++ b/gnulib/lib/malloc/dynarray_resize_clear.c -@@ -3,16 +3,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/malloca.c -+++ b/gnulib/lib/malloca.c -@@ -2,18 +2,18 @@ - Copyright (C) 2003, 2006-2007, 2009-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2003, 2018. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #define _GL_USE_STDLIB_ALLOC 1 - #include -@@ -21,6 +21,8 @@ - /* Specification. */ - #include "malloca.h" - -+#include "idx.h" -+#include "intprops.h" - #include "verify.h" - - /* The speed critical point in this file is freea() applied to an alloca() -@@ -45,9 +47,9 @@ mmalloca (size_t n) - #if HAVE_ALLOCA - /* Allocate one more word, used to determine the address to pass to freea(), - and room for the alignment ≡ sa_alignment_max mod 2*sa_alignment_max. */ -- size_t nplus = n + sizeof (small_t) + 2 * sa_alignment_max - 1; -- -- if (nplus >= n) -+ int plus = sizeof (small_t) + 2 * sa_alignment_max - 1; -+ idx_t nplus; -+ if (!INT_ADD_WRAPV (n, plus, &nplus) && !xalloc_oversized (nplus, 1)) - { - char *mem = (char *) malloc (nplus); - ---- a/gnulib/lib/malloca.h -+++ b/gnulib/lib/malloca.h -@@ -2,18 +2,18 @@ - Copyright (C) 2003-2007, 2009-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2003. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _MALLOCA_H - #define _MALLOCA_H -@@ -76,9 +76,10 @@ extern void freea (void *p); - - /* nmalloca(N,S) is an overflow-safe variant of malloca (N * S). - It allocates an array of N objects, each with S bytes of memory, -- on the stack. S must be positive and N must be nonnegative. -+ on the stack. N and S should be nonnegative and free of side effects. - The array must be freed using freea() before the function returns. */ --#define nmalloca(n, s) (xalloc_oversized (n, s) ? NULL : malloca ((n) * (s))) -+#define nmalloca(n, s) \ -+ (xalloc_oversized (n, s) ? NULL : malloca ((n) * (size_t) (s))) - - - #ifdef __cplusplus ---- a/gnulib/lib/mbchar.c -+++ b/gnulib/lib/mbchar.c -@@ -1,16 +1,16 @@ - /* Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - ---- a/gnulib/lib/mbchar.h -+++ b/gnulib/lib/mbchar.h -@@ -1,17 +1,17 @@ - /* Multibyte character data type. - Copyright (C) 2001, 2005-2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible . */ ---- a/gnulib/lib/mbiter.c -+++ b/gnulib/lib/mbiter.c -@@ -1,3 +1,21 @@ -+/* Iterating through multibyte strings: macros for multi-byte encodings. -+ -+ Copyright (C) 2012-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ - #include -+ - #define MBITER_INLINE _GL_EXTERN_INLINE - #include "mbiter.h" ---- a/gnulib/lib/mbiter.h -+++ b/gnulib/lib/mbiter.h -@@ -1,17 +1,17 @@ - /* Iterating through multibyte strings: macros for multi-byte encodings. - Copyright (C) 2001, 2005, 2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible . */ ---- a/gnulib/lib/mbrtowc-impl-utf8.h -+++ b/gnulib/lib/mbrtowc-impl-utf8.h -@@ -1,17 +1,17 @@ - /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2008. */ -@@ -96,7 +96,7 @@ - - if ((c2 ^ 0x80) < 0x40 - && (c >= 0xf1 || c2 >= 0x90) -- && (c < 0xf4 || (c == 0xf4 && c2 < 0x90))) -+ && (c < 0xf4 || (/* c == 0xf4 && */ c2 < 0x90))) - { - if (m == 2) - goto incomplete; ---- a/gnulib/lib/mbrtowc-impl.h -+++ b/gnulib/lib/mbrtowc-impl.h -@@ -1,17 +1,17 @@ - /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2008. */ ---- a/gnulib/lib/mbrtowc.c -+++ b/gnulib/lib/mbrtowc.c -@@ -2,17 +2,17 @@ - Copyright (C) 1999-2002, 2005-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2008. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/mbscasecmp.c -+++ b/gnulib/lib/mbscasecmp.c -@@ -3,17 +3,17 @@ - Written by Bruno Haible , 2005, - based on earlier glibc code. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/mbschr.c -+++ b/gnulib/lib/mbschr.c -@@ -2,17 +2,17 @@ - Copyright (C) 2007-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2007. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/mbsinit.c -+++ b/gnulib/lib/mbsinit.c -@@ -2,17 +2,17 @@ - Copyright (C) 2008-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2008. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/mbslen.c -+++ b/gnulib/lib/mbslen.c -@@ -2,17 +2,17 @@ - Copyright (C) 2007-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2007. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/mbsncasecmp.c -+++ b/gnulib/lib/mbsncasecmp.c -@@ -3,17 +3,17 @@ - Written by Bruno Haible , 2005, - based on earlier glibc code. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/mbsstr.c -+++ b/gnulib/lib/mbsstr.c -@@ -2,17 +2,17 @@ - Copyright (C) 2005-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2005. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/mbtowc-impl.h -+++ b/gnulib/lib/mbtowc-impl.h -@@ -2,17 +2,17 @@ - Copyright (C) 2011-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2011. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* We don't need a static internal state, because the encoding is not state ---- a/gnulib/lib/mbtowc-lock.c -+++ b/gnulib/lib/mbtowc-lock.c -@@ -1,17 +1,17 @@ - /* Return the internal lock used by mbrtowc and mbrtoc32. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2019-2020. */ ---- a/gnulib/lib/mbtowc-lock.h -+++ b/gnulib/lib/mbtowc-lock.h -@@ -1,17 +1,17 @@ - /* Use the internal lock used by mbrtowc and mbrtoc32. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2019-2020. */ ---- a/gnulib/lib/mbtowc.c -+++ b/gnulib/lib/mbtowc.c -@@ -2,17 +2,17 @@ - Copyright (C) 2011-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2011. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/mbuiter.c -+++ b/gnulib/lib/mbuiter.c -@@ -1,3 +1,20 @@ -+/* Iterating through multibyte strings: macros for multi-byte encodings. -+ Copyright (C) 2012-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ - #include -+ - #define MBUITER_INLINE _GL_EXTERN_INLINE - #include "mbuiter.h" ---- a/gnulib/lib/mbuiter.h -+++ b/gnulib/lib/mbuiter.h -@@ -1,17 +1,17 @@ - /* Iterating through multibyte strings: macros for multi-byte encodings. - Copyright (C) 2001, 2005, 2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible . */ ---- a/gnulib/lib/memchr.c -+++ b/gnulib/lib/memchr.c -@@ -7,21 +7,21 @@ - adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), - and implemented by Roland McGrath (roland@ai.mit.edu). - --NOTE: The canonical source of this file is maintained with the GNU C Library. --Bugs can be reported to bug-glibc@prep.ai.mit.edu. -+ NOTE: The canonical source of this file is maintained with the GNU C Library. -+ Bugs can be reported to bug-glibc@prep.ai.mit.edu. - --This program is free software: you can redistribute it and/or modify it --under the terms of the GNU General Public License as published by the --Free Software Foundation; either version 3 of the License, or any --later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - --This program is distributed in the hope that it will be useful, --but WITHOUT ANY WARRANTY; without even the implied warranty of --MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --GNU General Public License for more details. -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - --You should have received a copy of the GNU General Public License --along with this program. If not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _LIBC - # include ---- a/gnulib/lib/memchr.valgrind -+++ b/gnulib/lib/memchr.valgrind -@@ -2,17 +2,17 @@ - - # Copyright (C) 2009-2021 Free Software Foundation, Inc. - # --# This program is free software: you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 3 of the License, or --# (at your option) any later version. -+# This file is free software: you can redistribute it and/or modify -+# it under the terms of the GNU Lesser General Public License as -+# published by the Free Software Foundation; either version 2.1 of the -+# License, or (at your option) any later version. - # --# This program is distributed in the hope that it will be useful, -+# This file is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. -+# GNU Lesser General Public License for more details. - # --# You should have received a copy of the GNU General Public License -+# You should have received a copy of the GNU Lesser General Public License - # along with this program. If not, see . - - # POSIX states that when the character is found, memchr must not read extra ---- a/gnulib/lib/mempcpy.c -+++ b/gnulib/lib/mempcpy.c -@@ -1,18 +1,18 @@ - /* Copy memory area and return pointer after last written byte. - Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/memrchr.c -+++ b/gnulib/lib/memrchr.c -@@ -9,17 +9,17 @@ - adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), - and implemented by Roland McGrath (roland@ai.mit.edu). - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 3 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #if defined _LIBC ---- /dev/null -+++ b/gnulib/lib/minmax.h -@@ -0,0 +1,60 @@ -+/* MIN, MAX macros. -+ Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2021 Free Software -+ Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ -+#ifndef _MINMAX_H -+#define _MINMAX_H -+ -+/* Note: MIN, MAX are also defined in on some systems -+ (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about -+ MIN, MAX macro redefinitions on some systems; the workaround is to -+ #include this file as the last one among the #include list. */ -+ -+/* Before we define the following symbols we get the file -+ since otherwise we get redefinitions on some systems if is -+ included after this file. Likewise for . -+ If more than one of these system headers define MIN and MAX, pick just -+ one of the headers (because the definitions most likely are the same). */ -+#if HAVE_MINMAX_IN_LIMITS_H -+# include -+#elif HAVE_MINMAX_IN_SYS_PARAM_H -+# include -+#endif -+ -+/* Note: MIN and MAX should be used with two arguments of the -+ same type. They might not return the minimum and maximum of their two -+ arguments, if the arguments have different types or have unusual -+ floating-point values. For example, on a typical host with 32-bit 'int', -+ 64-bit 'long long', and 64-bit IEEE 754 'double' types: -+ -+ MAX (-1, 2147483648) returns 4294967295. -+ MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0. -+ MAX (NaN, 0.0) returns 0.0. -+ MAX (+0.0, -0.0) returns -0.0. -+ -+ and in each case the answer is in some sense bogus. */ -+ -+/* MAX(a,b) returns the maximum of A and B. */ -+#ifndef MAX -+# define MAX(a,b) ((a) > (b) ? (a) : (b)) -+#endif -+ -+/* MIN(a,b) returns the minimum of A and B. */ -+#ifndef MIN -+# define MIN(a,b) ((a) < (b) ? (a) : (b)) -+#endif -+ -+#endif /* _MINMAX_H */ ---- a/gnulib/lib/msvc-inval.c -+++ b/gnulib/lib/msvc-inval.c -@@ -1,18 +1,18 @@ - /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/msvc-inval.h -+++ b/gnulib/lib/msvc-inval.h -@@ -1,18 +1,18 @@ - /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _MSVC_INVAL_H - #define _MSVC_INVAL_H ---- a/gnulib/lib/msvc-nothrow.c -+++ b/gnulib/lib/msvc-nothrow.c -@@ -2,18 +2,18 @@ - with MSVC runtime libraries. - Copyright (C) 2011-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/msvc-nothrow.h -+++ b/gnulib/lib/msvc-nothrow.h -@@ -2,18 +2,18 @@ - with MSVC runtime libraries. - Copyright (C) 2011-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _MSVC_NOTHROW_H - #define _MSVC_NOTHROW_H ---- a/gnulib/lib/nl_langinfo-lock.c -+++ b/gnulib/lib/nl_langinfo-lock.c -@@ -1,17 +1,17 @@ - /* Return the internal lock used by nl_langinfo. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2019-2020. */ ---- a/gnulib/lib/nl_langinfo.c -+++ b/gnulib/lib/nl_langinfo.c -@@ -2,17 +2,17 @@ - - Copyright (C) 2007-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/open.c -+++ b/gnulib/lib/open.c -@@ -1,17 +1,17 @@ - /* Open a descriptor to a file. - Copyright (C) 2007-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2007. */ ---- a/gnulib/lib/pathmax.h -+++ b/gnulib/lib/pathmax.h -@@ -2,18 +2,18 @@ - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2021 Free Software - Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _PATHMAX_H - # define _PATHMAX_H ---- a/gnulib/lib/printf-args.c -+++ b/gnulib/lib/printf-args.c -@@ -2,18 +2,18 @@ - Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2021 Free Software - Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* This file can be parametrized with the following macros: - ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ---- a/gnulib/lib/printf-args.h -+++ b/gnulib/lib/printf-args.h -@@ -2,18 +2,18 @@ - Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2021 Free Software - Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _PRINTF_ARGS_H - #define _PRINTF_ARGS_H ---- a/gnulib/lib/printf-parse.c -+++ b/gnulib/lib/printf-parse.c -@@ -1,18 +1,18 @@ - /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003, 2006-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* This file can be parametrized with the following macros: - CHAR_T The element type of the format string. -@@ -48,16 +48,7 @@ - #include - - /* Get intmax_t. */ --#if defined IN_LIBINTL || defined IN_LIBASPRINTF --# if HAVE_STDINT_H_WITH_UINTMAX --# include --# endif --# if HAVE_INTTYPES_H_WITH_UINTMAX --# include --# endif --#else --# include --#endif -+#include - - /* malloc(), realloc(), free(). */ - #include ---- a/gnulib/lib/printf-parse.h -+++ b/gnulib/lib/printf-parse.h -@@ -2,18 +2,18 @@ - Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2021 Free Software - Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _PRINTF_PARSE_H - #define _PRINTF_PARSE_H ---- /dev/null -+++ b/gnulib/lib/realloc.c -@@ -0,0 +1,63 @@ -+/* realloc() function that is glibc compatible. -+ -+ Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2021 Free Software -+ Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ -+/* written by Jim Meyering and Bruno Haible */ -+ -+#include -+ -+#include -+ -+#include -+ -+#include "xalloc-oversized.h" -+ -+/* Call the system's realloc below. This file does not define -+ _GL_USE_STDLIB_ALLOC because it needs Gnulib's malloc if present. */ -+#undef realloc -+ -+/* Change the size of an allocated block of memory P to N bytes, -+ with error checking. If P is NULL, use malloc. Otherwise if N is zero, -+ free P and return NULL. */ -+ -+void * -+rpl_realloc (void *p, size_t n) -+{ -+ if (p == NULL) -+ return malloc (n); -+ -+ if (n == 0) -+ { -+ free (p); -+ return NULL; -+ } -+ -+ if (xalloc_oversized (n, 1)) -+ { -+ errno = ENOMEM; -+ return NULL; -+ } -+ -+ void *result = realloc (p, n); -+ -+#if !HAVE_MALLOC_POSIX -+ if (result == NULL) -+ errno = ENOMEM; -+#endif -+ -+ return result; -+} ---- /dev/null -+++ b/gnulib/lib/reallocarray.c -@@ -0,0 +1,39 @@ -+/* reallocarray function that is glibc compatible. -+ -+ Copyright (C) 2017-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ -+/* written by Darshit Shah */ -+ -+#include -+ -+#include -+#include -+ -+#include "intprops.h" -+ -+void * -+reallocarray (void *ptr, size_t nmemb, size_t size) -+{ -+ size_t nbytes; -+ if (INT_MULTIPLY_WRAPV (nmemb, size, &nbytes)) -+ { -+ errno = ENOMEM; -+ return NULL; -+ } -+ -+ /* Rely on the semantics of GNU realloc. */ -+ return realloc (ptr, nbytes); -+} ---- a/gnulib/lib/regcomp.c -+++ b/gnulib/lib/regcomp.c -@@ -4,16 +4,16 @@ - Contributed by Isamu Hasegawa . - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/regex.c -+++ b/gnulib/lib/regex.c -@@ -4,16 +4,16 @@ - Contributed by Isamu Hasegawa . - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/regex.h -+++ b/gnulib/lib/regex.h -@@ -4,16 +4,16 @@ - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/regex_internal.c -+++ b/gnulib/lib/regex_internal.c -@@ -4,16 +4,16 @@ - Contributed by Isamu Hasegawa . - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/regex_internal.h -+++ b/gnulib/lib/regex_internal.h -@@ -4,16 +4,16 @@ - Contributed by Isamu Hasegawa . - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - ---- a/gnulib/lib/regexec.c -+++ b/gnulib/lib/regexec.c -@@ -4,16 +4,16 @@ - Contributed by Isamu Hasegawa . - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -@@ -1220,9 +1220,13 @@ proceed_next_node (const re_match_contex - { - re_node_set *cur_nodes = &mctx->state_log[*pidx]->nodes; - re_node_set *edests = &dfa->edests[node]; -- bool ok = re_node_set_insert (eps_via_nodes, node); -- if (__glibc_unlikely (! ok)) -- return -2; -+ -+ if (! re_node_set_contains (eps_via_nodes, node)) -+ { -+ bool ok = re_node_set_insert (eps_via_nodes, node); -+ if (__glibc_unlikely (! ok)) -+ return -2; -+ } - - /* Pick a valid destination, or return -1 if none is found. */ - Idx dest_node = -1; -@@ -1414,7 +1418,7 @@ set_regs (const regex_t *preg, const re_ - update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); - - if ((idx == pmatch[0].rm_eo && cur_node == mctx->last_node) -- || re_node_set_contains (&eps_via_nodes, cur_node)) -+ || (fs && re_node_set_contains (&eps_via_nodes, cur_node))) - { - Idx reg_idx; - cur_node = -1; ---- a/gnulib/lib/setlocale-lock.c -+++ b/gnulib/lib/setlocale-lock.c -@@ -1,17 +1,17 @@ - /* Return the internal lock used by setlocale_null_r. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2019. */ ---- a/gnulib/lib/setlocale_null.c -+++ b/gnulib/lib/setlocale_null.c -@@ -1,17 +1,17 @@ - /* Query the name of the current global locale. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2019. */ ---- a/gnulib/lib/setlocale_null.h -+++ b/gnulib/lib/setlocale_null.h -@@ -1,17 +1,17 @@ - /* Query the name of the current global locale. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2019. */ ---- a/gnulib/lib/size_max.h -+++ b/gnulib/lib/size_max.h -@@ -2,18 +2,18 @@ - Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. - Written by Simon Josefsson. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef GNULIB_SIZE_MAX_H - #define GNULIB_SIZE_MAX_H ---- a/gnulib/lib/stat-time.c -+++ b/gnulib/lib/stat-time.c -@@ -1,3 +1,21 @@ -+/* stat-related time functions. -+ -+ Copyright (C) 2012-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ - #include -+ - #define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE - #include "stat-time.h" ---- a/gnulib/lib/stat-time.h -+++ b/gnulib/lib/stat-time.h -@@ -2,17 +2,17 @@ - - Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Paul Eggert. */ ---- a/gnulib/lib/stat-w32.c -+++ b/gnulib/lib/stat-w32.c -@@ -1,17 +1,17 @@ - /* Core of implementation of fstat and stat for native Windows. - Copyright (C) 2017-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible. */ ---- a/gnulib/lib/stat-w32.h -+++ b/gnulib/lib/stat-w32.h -@@ -1,17 +1,17 @@ - /* Core of implementation of fstat and stat for native Windows. - Copyright (C) 2017-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _STAT_W32_H ---- a/gnulib/lib/stat.c -+++ b/gnulib/lib/stat.c -@@ -1,17 +1,17 @@ - /* Work around platform bugs in stat. - Copyright (C) 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Eric Blake and Bruno Haible. */ ---- a/gnulib/lib/stdarg.in.h -+++ b/gnulib/lib/stdarg.in.h -@@ -1,18 +1,18 @@ - /* Substitute for and wrapper around . - Copyright (C) 2008-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _@GUARD_PREFIX@_STDARG_H - ---- a/gnulib/lib/stdbool.in.h -+++ b/gnulib/lib/stdbool.in.h -@@ -1,18 +1,18 @@ - /* Copyright (C) 2001-2003, 2006-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2001. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _GL_STDBOOL_H - #define _GL_STDBOOL_H ---- a/gnulib/lib/stddef.in.h -+++ b/gnulib/lib/stddef.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2009-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Eric Blake. */ - ---- a/gnulib/lib/stdint.in.h -+++ b/gnulib/lib/stdint.in.h -@@ -2,18 +2,18 @@ - Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. - This file is part of gnulib. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* - * ISO C 99 for platforms that lack it. -@@ -85,7 +85,7 @@ - - /* Override WINT_MIN and WINT_MAX if gnulib's or overrides - wint_t. */ --#if @GNULIB_OVERRIDES_WINT_T@ -+#if @GNULIBHEADERS_OVERRIDE_WINT_T@ - # undef WINT_MIN - # undef WINT_MAX - # define WINT_MIN 0x0U -@@ -598,7 +598,7 @@ typedef int _verify_intmax_size[sizeof ( - /* wint_t limits */ - /* If gnulib's or overrides wint_t, @WINT_T_SUFFIX@ is not - accurate, therefore use the definitions from above. */ --# if !@GNULIB_OVERRIDES_WINT_T@ -+# if !@GNULIBHEADERS_OVERRIDE_WINT_T@ - # undef WINT_MIN - # undef WINT_MAX - # if @HAVE_SIGNED_WINT_T@ ---- a/gnulib/lib/stdio.in.h -+++ b/gnulib/lib/stdio.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #if __GNUC__ >= 3 - @PRAGMA_SYSTEM_HEADER@ -@@ -242,7 +242,7 @@ _GL_WARN_ON_USE (fclose, "fclose is not - _GL_CXXALIAS_MDA (fcloseall, int, (void)); - # else - # if @HAVE_DECL_FCLOSEALL@ --# if defined __FreeBSD__ -+# if defined __FreeBSD__ || defined __DragonFly__ - _GL_CXXALIAS_SYS (fcloseall, void, (void)); - # else - _GL_CXXALIAS_SYS (fcloseall, int, (void)); -@@ -1257,6 +1257,7 @@ _GL_CXXALIASWARN (scanf); - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # define snprintf rpl_snprintf - # endif -+# define GNULIB_overrides_snprintf 1 - _GL_FUNCDECL_RPL (snprintf, int, - (char *restrict str, size_t size, - const char *restrict format, ...) -@@ -1302,6 +1303,7 @@ _GL_WARN_ON_USE (snprintf, "snprintf is - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # define sprintf rpl_sprintf - # endif -+# define GNULIB_overrides_sprintf 1 - _GL_FUNCDECL_RPL (sprintf, int, - (char *restrict str, const char *restrict format, ...) - _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) -@@ -1369,6 +1371,7 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is no - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # define asprintf rpl_asprintf - # endif -+# define GNULIB_overrides_asprintf - _GL_FUNCDECL_RPL (asprintf, int, - (char **result, const char *format, ...) - _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) -@@ -1390,6 +1393,7 @@ _GL_CXXALIASWARN (asprintf); - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # define vasprintf rpl_vasprintf - # endif -+# define GNULIB_overrides_vasprintf 1 - _GL_FUNCDECL_RPL (vasprintf, int, - (char **result, const char *format, va_list args) - _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) -@@ -1573,6 +1577,7 @@ _GL_CXXALIASWARN (vscanf); - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # define vsnprintf rpl_vsnprintf - # endif -+# define GNULIB_overrides_vsnprintf 1 - _GL_FUNCDECL_RPL (vsnprintf, int, - (char *restrict str, size_t size, - const char *restrict format, va_list args) -@@ -1609,6 +1614,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf i - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # define vsprintf rpl_vsprintf - # endif -+# define GNULIB_overrides_vsprintf 1 - _GL_FUNCDECL_RPL (vsprintf, int, - (char *restrict str, - const char *restrict format, va_list args) ---- a/gnulib/lib/stdlib.in.h -+++ b/gnulib/lib/stdlib.in.h -@@ -2,17 +2,17 @@ - - Copyright (C) 1995, 2001-2004, 2006-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #if __GNUC__ >= 3 -@@ -1032,12 +1032,23 @@ _GL_WARN_ON_USE (realloc, "realloc is no - - - #if @GNULIB_REALLOCARRAY@ --# if ! @HAVE_REALLOCARRAY@ -+# if @REPLACE_REALLOCARRAY@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# undef reallocarray -+# define reallocarray rpl_reallocarray -+# endif -+_GL_FUNCDECL_RPL (reallocarray, void *, -+ (void *ptr, size_t nmemb, size_t size)); -+_GL_CXXALIAS_RPL (reallocarray, void *, -+ (void *ptr, size_t nmemb, size_t size)); -+# else -+# if ! @HAVE_REALLOCARRAY@ - _GL_FUNCDECL_SYS (reallocarray, void *, - (void *ptr, size_t nmemb, size_t size)); --# endif -+# endif - _GL_CXXALIAS_SYS (reallocarray, void *, - (void *ptr, size_t nmemb, size_t size)); -+# endif - _GL_CXXALIASWARN (reallocarray); - #elif defined GNULIB_POSIXCHECK - # undef reallocarray -@@ -1202,6 +1213,47 @@ _GL_WARN_ON_USE (strtold, "strtold is un - # endif - #endif - -+#if @GNULIB_STRTOL@ -+/* Parse a signed integer whose textual representation starts at STRING. -+ The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, -+ it may be decimal or octal (with prefix "0") or hexadecimal (with prefix -+ "0x"). -+ If ENDPTR is not NULL, the address of the first byte after the integer is -+ stored in *ENDPTR. -+ Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set -+ to ERANGE. */ -+# if @REPLACE_STRTOL@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define strtol rpl_strtol -+# endif -+# define GNULIB_defined_strtol_function 1 -+_GL_FUNCDECL_RPL (strtol, long, -+ (const char *restrict string, char **restrict endptr, -+ int base) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (strtol, long, -+ (const char *restrict string, char **restrict endptr, -+ int base)); -+# else -+# if !@HAVE_STRTOL@ -+_GL_FUNCDECL_SYS (strtol, long, -+ (const char *restrict string, char **restrict endptr, -+ int base) -+ _GL_ARG_NONNULL ((1))); -+# endif -+_GL_CXXALIAS_SYS (strtol, long, -+ (const char *restrict string, char **restrict endptr, -+ int base)); -+# endif -+_GL_CXXALIASWARN (strtol); -+#elif defined GNULIB_POSIXCHECK -+# undef strtol -+# if HAVE_RAW_DECL_STRTOL -+_GL_WARN_ON_USE (strtol, "strtol is unportable - " -+ "use gnulib module strtol for portability"); -+# endif -+#endif -+ - #if @GNULIB_STRTOLL@ - /* Parse a signed integer whose textual representation starts at STRING. - The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, -@@ -1211,15 +1263,29 @@ _GL_WARN_ON_USE (strtold, "strtold is un - stored in *ENDPTR. - Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set - to ERANGE. */ --# if !@HAVE_STRTOLL@ -+# if @REPLACE_STRTOLL@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define strtoll rpl_strtoll -+# endif -+# define GNULIB_defined_strtoll_function 1 -+_GL_FUNCDECL_RPL (strtoll, long long, -+ (const char *restrict string, char **restrict endptr, -+ int base) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (strtoll, long long, -+ (const char *restrict string, char **restrict endptr, -+ int base)); -+# else -+# if !@HAVE_STRTOLL@ - _GL_FUNCDECL_SYS (strtoll, long long, - (const char *restrict string, char **restrict endptr, - int base) - _GL_ARG_NONNULL ((1))); --# endif -+# endif - _GL_CXXALIAS_SYS (strtoll, long long, - (const char *restrict string, char **restrict endptr, - int base)); -+# endif - _GL_CXXALIASWARN (strtoll); - #elif defined GNULIB_POSIXCHECK - # undef strtoll -@@ -1229,6 +1295,46 @@ _GL_WARN_ON_USE (strtoll, "strtoll is un - # endif - #endif - -+#if @GNULIB_STRTOUL@ -+/* Parse an unsigned integer whose textual representation starts at STRING. -+ The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, -+ it may be decimal or octal (with prefix "0") or hexadecimal (with prefix -+ "0x"). -+ If ENDPTR is not NULL, the address of the first byte after the integer is -+ stored in *ENDPTR. -+ Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE. */ -+# if @REPLACE_STRTOUL@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define strtoul rpl_strtoul -+# endif -+# define GNULIB_defined_strtoul_function 1 -+_GL_FUNCDECL_RPL (strtoul, unsigned long, -+ (const char *restrict string, char **restrict endptr, -+ int base) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (strtoul, unsigned long, -+ (const char *restrict string, char **restrict endptr, -+ int base)); -+# else -+# if !@HAVE_STRTOUL@ -+_GL_FUNCDECL_SYS (strtoul, unsigned long, -+ (const char *restrict string, char **restrict endptr, -+ int base) -+ _GL_ARG_NONNULL ((1))); -+# endif -+_GL_CXXALIAS_SYS (strtoul, unsigned long, -+ (const char *restrict string, char **restrict endptr, -+ int base)); -+# endif -+_GL_CXXALIASWARN (strtoul); -+#elif defined GNULIB_POSIXCHECK -+# undef strtoul -+# if HAVE_RAW_DECL_STRTOUL -+_GL_WARN_ON_USE (strtoul, "strtoul is unportable - " -+ "use gnulib module strtoul for portability"); -+# endif -+#endif -+ - #if @GNULIB_STRTOULL@ - /* Parse an unsigned integer whose textual representation starts at STRING. - The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, -@@ -1238,15 +1344,29 @@ _GL_WARN_ON_USE (strtoll, "strtoll is un - stored in *ENDPTR. - Upon overflow, the return value is ULLONG_MAX, and errno is set to - ERANGE. */ --# if !@HAVE_STRTOULL@ -+# if @REPLACE_STRTOULL@ -+# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -+# define strtoull rpl_strtoull -+# endif -+# define GNULIB_defined_strtoull_function 1 -+_GL_FUNCDECL_RPL (strtoull, unsigned long long, -+ (const char *restrict string, char **restrict endptr, -+ int base) -+ _GL_ARG_NONNULL ((1))); -+_GL_CXXALIAS_RPL (strtoull, unsigned long long, -+ (const char *restrict string, char **restrict endptr, -+ int base)); -+# else -+# if !@HAVE_STRTOULL@ - _GL_FUNCDECL_SYS (strtoull, unsigned long long, - (const char *restrict string, char **restrict endptr, - int base) - _GL_ARG_NONNULL ((1))); --# endif -+# endif - _GL_CXXALIAS_SYS (strtoull, unsigned long long, - (const char *restrict string, char **restrict endptr, - int base)); -+# endif - _GL_CXXALIASWARN (strtoull); - #elif defined GNULIB_POSIXCHECK - # undef strtoull ---- a/gnulib/lib/stpcpy.c -+++ b/gnulib/lib/stpcpy.c -@@ -5,17 +5,17 @@ - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@prep.ai.mit.edu. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 3 of the License, or any -- later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/str-kmp.h -+++ b/gnulib/lib/str-kmp.h -@@ -3,18 +3,26 @@ - Copyright (C) 2005-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2005. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software. -+ It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+". -+ You can redistribute it and/or modify it under either -+ - the terms of the GNU Lesser General Public License as published -+ by the Free Software Foundation; either version 3, or (at your -+ option) any later version, or -+ - the terms of the GNU General Public License as published by the -+ Free Software Foundation; either version 2, or (at your option) -+ any later version, or -+ - the same dual license "the GNU LGPLv3+ or the GNU GPLv2+". - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License and the GNU General Public License -+ for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public -+ License and of the GNU General Public License along with this -+ program. If not, see . */ - - /* Before including this file, you need to define: - UNIT The element type of the needle and haystack. ---- a/gnulib/lib/str-two-way.h -+++ b/gnulib/lib/str-two-way.h -@@ -3,18 +3,18 @@ - This file is part of the GNU C Library. - Written by Eric Blake , 2008. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Before including this file, you need to include and - , and define: ---- a/gnulib/lib/strcasecmp.c -+++ b/gnulib/lib/strcasecmp.c -@@ -1,18 +1,18 @@ - /* Case-insensitive string comparison function. - Copyright (C) 1998-1999, 2005-2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/strcasestr.c -+++ b/gnulib/lib/strcasestr.c -@@ -2,18 +2,18 @@ - Copyright (C) 2005-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2005. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/strdup.c -+++ b/gnulib/lib/strdup.c -@@ -3,18 +3,18 @@ - - This file is part of the GNU C Library. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _LIBC - # include ---- a/gnulib/lib/streq.h -+++ b/gnulib/lib/streq.h -@@ -1,17 +1,17 @@ - /* Optimized string comparison. - Copyright (C) 2001-2002, 2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible . */ ---- a/gnulib/lib/strerror-override.c -+++ b/gnulib/lib/strerror-override.c -@@ -2,17 +2,17 @@ - - Copyright (C) 2010-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Bruno Haible , 2010. */ -@@ -29,6 +29,8 @@ - # endif - #endif - -+#if !GNULIB_defined_strerror_override_macro -+ - /* If ERRNUM maps to an errno value defined by gnulib, return a string - describing the error. Otherwise return NULL. */ - const char * -@@ -37,12 +39,12 @@ strerror_override (int errnum) - /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ - switch (errnum) - { --#if REPLACE_STRERROR_0 -+# if REPLACE_STRERROR_0 - case 0: - return "Success"; --#endif -+# endif - --#if GNULIB_defined_ESOCK /* native Windows platforms with older */ -+# if GNULIB_defined_ESOCK /* native Windows platforms with older */ - case EINPROGRESS: - return "Operation now in progress"; - case EALREADY: -@@ -89,8 +91,8 @@ strerror_override (int errnum) - return "No route to host"; - case EWOULDBLOCK: - return "Operation would block"; --#endif --#if GNULIB_defined_ESTREAMS /* native Windows platforms with older */ -+# endif -+# if GNULIB_defined_ESTREAMS /* native Windows platforms with older */ - case ETXTBSY: - return "Text file busy"; - case ENODATA: -@@ -103,8 +105,8 @@ strerror_override (int errnum) - return "Timer expired"; - case EOTHER: - return "Other error"; --#endif --#if GNULIB_defined_EWINSOCK /* native Windows platforms */ -+# endif -+# if GNULIB_defined_EWINSOCK /* native Windows platforms */ - case ESOCKTNOSUPPORT: - return "Socket type not supported"; - case EPFNOSUPPORT: -@@ -125,7 +127,7 @@ strerror_override (int errnum) - return "Stale NFS file handle"; - case EREMOTE: - return "Object is remote"; --# if HAVE_WINSOCK2_H -+# if HAVE_WINSOCK2_H - /* WSA_INVALID_HANDLE maps to EBADF */ - /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ - /* WSA_INVALID_PARAMETER maps to EINVAL */ -@@ -213,90 +215,92 @@ strerror_override (int errnum) - case WSANO_DATA: - return "Valid name, no data record of requested type"; - /* WSA_QOS_* omitted */ -+# endif - # endif --#endif - --#if GNULIB_defined_ENOMSG -+# if GNULIB_defined_ENOMSG - case ENOMSG: - return "No message of desired type"; --#endif -+# endif - --#if GNULIB_defined_EIDRM -+# if GNULIB_defined_EIDRM - case EIDRM: - return "Identifier removed"; --#endif -+# endif - --#if GNULIB_defined_ENOLINK -+# if GNULIB_defined_ENOLINK - case ENOLINK: - return "Link has been severed"; --#endif -+# endif - --#if GNULIB_defined_EPROTO -+# if GNULIB_defined_EPROTO - case EPROTO: - return "Protocol error"; --#endif -+# endif - --#if GNULIB_defined_EMULTIHOP -+# if GNULIB_defined_EMULTIHOP - case EMULTIHOP: - return "Multihop attempted"; --#endif -+# endif - --#if GNULIB_defined_EBADMSG -+# if GNULIB_defined_EBADMSG - case EBADMSG: - return "Bad message"; --#endif -+# endif - --#if GNULIB_defined_EOVERFLOW -+# if GNULIB_defined_EOVERFLOW - case EOVERFLOW: - return "Value too large for defined data type"; --#endif -+# endif - --#if GNULIB_defined_ENOTSUP -+# if GNULIB_defined_ENOTSUP - case ENOTSUP: - return "Not supported"; --#endif -+# endif - --#if GNULIB_defined_ENETRESET -+# if GNULIB_defined_ENETRESET - case ENETRESET: - return "Network dropped connection on reset"; --#endif -+# endif - --#if GNULIB_defined_ECONNABORTED -+# if GNULIB_defined_ECONNABORTED - case ECONNABORTED: - return "Software caused connection abort"; --#endif -+# endif - --#if GNULIB_defined_ESTALE -+# if GNULIB_defined_ESTALE - case ESTALE: - return "Stale NFS file handle"; --#endif -+# endif - --#if GNULIB_defined_EDQUOT -+# if GNULIB_defined_EDQUOT - case EDQUOT: - return "Disk quota exceeded"; --#endif -+# endif - --#if GNULIB_defined_ECANCELED -+# if GNULIB_defined_ECANCELED - case ECANCELED: - return "Operation canceled"; --#endif -+# endif - --#if GNULIB_defined_EOWNERDEAD -+# if GNULIB_defined_EOWNERDEAD - case EOWNERDEAD: - return "Owner died"; --#endif -+# endif - --#if GNULIB_defined_ENOTRECOVERABLE -+# if GNULIB_defined_ENOTRECOVERABLE - case ENOTRECOVERABLE: - return "State not recoverable"; --#endif -+# endif - --#if GNULIB_defined_EILSEQ -+# if GNULIB_defined_EILSEQ - case EILSEQ: - return "Invalid or incomplete multibyte or wide character"; --#endif -+# endif - - default: - return NULL; - } - } -+ -+#endif ---- a/gnulib/lib/strerror-override.h -+++ b/gnulib/lib/strerror-override.h -@@ -2,17 +2,17 @@ - - Copyright (C) 2010-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _GL_STRERROR_OVERRIDE_H -@@ -51,6 +51,7 @@ - extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; - # else - # define strerror_override(ignored) NULL -+# define GNULIB_defined_strerror_override_macro 1 - # endif - - #endif /* _GL_STRERROR_OVERRIDE_H */ ---- a/gnulib/lib/strerror.c -+++ b/gnulib/lib/strerror.c -@@ -2,17 +2,17 @@ - - Copyright (C) 2007-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/string.in.h -+++ b/gnulib/lib/string.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #if __GNUC__ >= 3 - @PRAGMA_SYSTEM_HEADER@ -@@ -446,7 +446,7 @@ _GL_WARN_ON_USE (strdup, "strdup is unpo - #elif @GNULIB_MDA_STRDUP@ - /* On native Windows, map 'creat' to '_creat', so that -loldnames is not - required. In C++ with GNULIB_NAMESPACE, avoid differences between -- platforms by defining GNULIB_NAMESPACE::creat always. */ -+ platforms by defining GNULIB_NAMESPACE::strdup always. */ - # if defined _WIN32 && !defined __CYGWIN__ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef strdup ---- a/gnulib/lib/strings.in.h -+++ b/gnulib/lib/strings.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2007-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _@GUARD_PREFIX@_STRINGS_H - ---- a/gnulib/lib/strncasecmp.c -+++ b/gnulib/lib/strncasecmp.c -@@ -1,18 +1,18 @@ - /* strncasecmp.c -- case insensitive string comparator - Copyright (C) 1998-1999, 2005-2007, 2009-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/strndup.c -+++ b/gnulib/lib/strndup.c -@@ -3,18 +3,18 @@ - Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2021 Free Software - Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the -- Free Software Foundation; either version 3, or (at your option) any -- later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/strnlen.c -+++ b/gnulib/lib/strnlen.c -@@ -2,18 +2,18 @@ - Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. - Written by Simon Josefsson. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/strnlen1.c -+++ b/gnulib/lib/strnlen1.c -@@ -1,17 +1,17 @@ - /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/strnlen1.h -+++ b/gnulib/lib/strnlen1.h -@@ -1,17 +1,17 @@ - /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _STRNLEN1_H ---- a/gnulib/lib/strstr.c -+++ b/gnulib/lib/strstr.c -@@ -2,18 +2,18 @@ - Foundation, Inc. - This file is part of the GNU C Library. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* This particular implementation was written by Eric Blake, 2008. */ - ---- a/gnulib/lib/sys_stat.in.h -+++ b/gnulib/lib/sys_stat.in.h -@@ -1,18 +1,18 @@ - /* Provide a more complete sys/stat.h header file. - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ - ---- a/gnulib/lib/sys_types.in.h -+++ b/gnulib/lib/sys_types.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2011-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #if __GNUC__ >= 3 - @PRAGMA_SYSTEM_HEADER@ ---- a/gnulib/lib/time.in.h -+++ b/gnulib/lib/time.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2007-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #if __GNUC__ >= 3 - @PRAGMA_SYSTEM_HEADER@ -@@ -340,22 +340,60 @@ _GL_CXXALIASWARN (strftime); - # endif - - # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ -+/* Functions that use a first-class time zone data type, instead of -+ relying on an implicit global time zone. -+ Inspired by NetBSD. */ -+ -+/* Represents a time zone. -+ (timezone_t) NULL stands for UTC. */ - typedef struct tm_zone *timezone_t; -+ -+/* tzalloc (name) -+ Returns a time zone object for the given time zone NAME. This object -+ represents the time zone that other functions would use it the TZ -+ environment variable was set to NAME. -+ If NAME is NULL, the result represents the time zone that other functions -+ would use it the TZ environment variable was unset. -+ May return NULL if NAME is invalid (this is platform dependent) or -+ upon memory allocation failure. */ - _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); - _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); -+ -+/* tzfree (tz) -+ Frees a time zone object. -+ The argument must have been returned by tzalloc(). */ - _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); - _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); -+ -+/* localtime_rz (tz, &t, &result) -+ Converts an absolute time T to a broken-down time RESULT, assuming the -+ time zone TZ. -+ This function is like 'localtime_r', but relies on the argument TZ instead -+ of an implicit global time zone. */ - _GL_FUNCDECL_SYS (localtime_rz, struct tm *, - (timezone_t __tz, time_t const *restrict __timer, - struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); - _GL_CXXALIAS_SYS (localtime_rz, struct tm *, - (timezone_t __tz, time_t const *restrict __timer, - struct tm *restrict __result)); -+ -+/* mktime_z (tz, &tm) -+ Normalizes the broken-down time TM and converts it to an absolute time, -+ assuming the time zone TZ. Returns the absolute time. -+ This function is like 'mktime', but relies on the argument TZ instead -+ of an implicit global time zone. */ - _GL_FUNCDECL_SYS (mktime_z, time_t, -- (timezone_t __tz, struct tm *restrict __result) -+ (timezone_t __tz, struct tm *restrict __tm) - _GL_ARG_NONNULL ((2))); - _GL_CXXALIAS_SYS (mktime_z, time_t, -- (timezone_t __tz, struct tm *restrict __result)); -+ (timezone_t __tz, struct tm *restrict __tm)); -+ -+/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' -+ in the 'tm_zone' member of 'struct tm') are valid as long as -+ - the 'struct tm' argument is not destroyed or overwritten, -+ and -+ - the 'timezone_t' argument is not freed through tzfree(). */ -+ - # endif - - /* Convert TM to a time_t value, assuming UTC. */ ---- a/gnulib/lib/unistd.c -+++ b/gnulib/lib/unistd.c -@@ -1,4 +1,22 @@ -+/* Inline functions for . -+ -+ Copyright (C) 2012-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ - #include -+ - #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE - #include "unistd.h" - typedef int dummy; ---- a/gnulib/lib/unistd.in.h -+++ b/gnulib/lib/unistd.in.h -@@ -1,18 +1,18 @@ - /* Substitute for and wrapper around . - Copyright (C) 2003-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _@GUARD_PREFIX@_UNISTD_H - -@@ -1521,6 +1521,7 @@ _GL_WARN_ON_USE (group_member, "group_me - # undef isatty - # define isatty rpl_isatty - # endif -+# define GNULIB_defined_isatty 1 - _GL_FUNCDECL_RPL (isatty, int, (int fd)); - _GL_CXXALIAS_RPL (isatty, int, (int fd)); - # elif defined _WIN32 && !defined __CYGWIN__ -@@ -2027,15 +2028,23 @@ _GL_WARN_ON_USE (sleep, "sleep is unport - #if @GNULIB_MDA_SWAB@ - /* On native Windows, map 'swab' to '_swab', so that -loldnames is not - required. In C++ with GNULIB_NAMESPACE, avoid differences between -- platforms by defining GNULIB_NAMESPACE::creat always. */ -+ platforms by defining GNULIB_NAMESPACE::swab always. */ - # if defined _WIN32 && !defined __CYGWIN__ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef swab - # define swab _swab - # endif --_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n)); --# else -+/* Need to cast, because in old mingw the arguments are -+ (const char *from, char *to, size_t n). */ -+_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n)); -+# else -+# if defined __hpux /* HP-UX */ -+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n)); -+# elif defined __sun && !defined _XPG4 /* Solaris */ -+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n)); -+# else - _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n)); -+# endif - # endif - _GL_CXXALIASWARN (swab); - #endif ---- a/gnulib/lib/unitypes.in.h -+++ b/gnulib/lib/unitypes.in.h -@@ -1,17 +1,17 @@ - /* Elementary types and macros for the GNU UniString library. - Copyright (C) 2002, 2005-2006, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _UNITYPES_H ---- a/gnulib/lib/uniwidth.in.h -+++ b/gnulib/lib/uniwidth.in.h -@@ -2,17 +2,17 @@ - Copyright (C) 2001-2002, 2005, 2007, 2009-2021 Free Software Foundation, - Inc. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef _UNIWIDTH_H ---- a/gnulib/lib/uniwidth/cjk.h -+++ b/gnulib/lib/uniwidth/cjk.h -@@ -2,17 +2,17 @@ - Copyright (C) 2001-2002, 2005-2007, 2009-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2002. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include "streq.h" ---- a/gnulib/lib/uniwidth/width.c -+++ b/gnulib/lib/uniwidth/width.c -@@ -2,17 +2,17 @@ - Copyright (C) 2001-2002, 2006-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2002. - -- This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/vasnprintf.c -+++ b/gnulib/lib/vasnprintf.c -@@ -1,18 +1,18 @@ - /* vsprintf with automatic memory allocation. - Copyright (C) 1999, 2002-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* This file can be parametrized with the following macros: - VASNPRINTF The name of the function being defined. -@@ -60,9 +60,7 @@ - #ifndef VASNPRINTF - # include - #endif --#ifndef IN_LIBINTL --# include --#endif -+#include - - /* Specification. */ - #ifndef VASNPRINTF -@@ -1859,6 +1857,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - /* errno is already set. */ - return NULL; - -+ /* Frees the memory allocated by this function. Preserves errno. */ - #define CLEANUP() \ - if (d.dir != d.direct_alloc_dir) \ - free (d.dir); \ -@@ -1923,7 +1922,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - - /* Ensures that allocated >= needed. Aborts through a jump to - out_of_memory if needed is SIZE_MAX or otherwise too big. */ --#define ENSURE_ALLOCATION(needed) \ -+#define ENSURE_ALLOCATION_ELSE(needed, oom_statement) \ - if ((needed) > allocated) \ - { \ - size_t memory_size; \ -@@ -1934,17 +1933,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - allocated = (needed); \ - memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ - if (size_overflow_p (memory_size)) \ -- goto out_of_memory; \ -+ oom_statement \ - if (result == resultbuf || result == NULL) \ - memory = (DCHAR_T *) malloc (memory_size); \ - else \ - memory = (DCHAR_T *) realloc (result, memory_size); \ - if (memory == NULL) \ -- goto out_of_memory; \ -+ oom_statement \ - if (result == resultbuf && length > 0) \ - DCHAR_CPY (memory, result, length); \ - result = memory; \ - } -+#define ENSURE_ALLOCATION(needed) \ -+ ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; ) - - for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) - { -@@ -2183,18 +2184,17 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - # endif - if (converted == NULL) - { -- int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); -- errno = saved_errno; - return NULL; - } - if (converted != result + length) - { -- ENSURE_ALLOCATION (xsum (length, converted_len)); -+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), -+ { free (converted); goto out_of_memory; }); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } -@@ -2309,18 +2309,17 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - # endif - if (converted == NULL) - { -- int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); -- errno = saved_errno; - return NULL; - } - if (converted != result + length) - { -- ENSURE_ALLOCATION (xsum (length, converted_len)); -+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), -+ { free (converted); goto out_of_memory; }); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } -@@ -2435,18 +2434,17 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - # endif - if (converted == NULL) - { -- int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); -- errno = saved_errno; - return NULL; - } - if (converted != result + length) - { -- ENSURE_ALLOCATION (xsum (length, converted_len)); -+ ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), -+ { free (converted); goto out_of_memory; }); - DCHAR_CPY (result + length, converted, converted_len); - free (converted); - } -@@ -2852,14 +2850,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - NULL, &tmpdst_len); - if (tmpdst == NULL) - { -- int saved_errno = errno; - free (tmpsrc); - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); -- errno = saved_errno; - return NULL; - } - free (tmpsrc); -@@ -2951,7 +2947,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - } - } - # else -- ENSURE_ALLOCATION (xsum (length, tmpdst_len)); -+ ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), -+ { free (tmpdst); goto out_of_memory; }); - DCHAR_CPY (result + length, tmpdst, tmpdst_len); - free (tmpdst); - length += tmpdst_len; -@@ -3079,13 +3076,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - NULL, &tmpdst_len); - if (tmpdst == NULL) - { -- int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); -- errno = saved_errno; - return NULL; - } - # endif -@@ -3156,7 +3151,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - } - } - # else -- ENSURE_ALLOCATION (xsum (length, tmpdst_len)); -+ ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), -+ { free (tmpdst); goto out_of_memory; }); - DCHAR_CPY (result + length, tmpdst, tmpdst_len); - free (tmpdst); - length += tmpdst_len; -@@ -5449,15 +5445,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - /* Attempt to handle failure. */ - if (count < 0) - { -- /* SNPRINTF or sprintf failed. Save and use the errno -- that it has set, if any. */ -- int saved_errno = errno; -- if (saved_errno == 0) -+ /* SNPRINTF or sprintf failed. Use the errno that it -+ has set, if any. */ -+ if (errno == 0) - { - if (dp->conversion == 'c' || dp->conversion == 's') -- saved_errno = EILSEQ; -+ errno = EILSEQ; - else -- saved_errno = EINVAL; -+ errno = EINVAL; - } - - if (!(result == resultbuf || result == NULL)) -@@ -5466,7 +5461,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - free (buf_malloced); - CLEANUP (); - -- errno = saved_errno; - return NULL; - } - -@@ -5602,16 +5596,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * - NULL, &tmpdst_len); - if (tmpdst == NULL) - { -- int saved_errno = errno; - if (!(result == resultbuf || result == NULL)) - free (result); - if (buf_malloced != NULL) - free (buf_malloced); - CLEANUP (); -- errno = saved_errno; - return NULL; - } -- ENSURE_ALLOCATION (xsum (length, tmpdst_len)); -+ ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), -+ { free (tmpdst); goto out_of_memory; }); - DCHAR_CPY (result + length, tmpdst, tmpdst_len); - free (tmpdst); - count = tmpdst_len; ---- a/gnulib/lib/vasnprintf.h -+++ b/gnulib/lib/vasnprintf.h -@@ -1,18 +1,18 @@ - /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004, 2007-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _VASNPRINTF_H - #define _VASNPRINTF_H ---- a/gnulib/lib/vasprintf.c -+++ b/gnulib/lib/vasprintf.c -@@ -1,18 +1,18 @@ - /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License along -- with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #include - ---- a/gnulib/lib/verify.h -+++ b/gnulib/lib/verify.h -@@ -2,17 +2,17 @@ - - Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ ---- a/gnulib/lib/warn-on-use.h -+++ b/gnulib/lib/warn-on-use.h -@@ -2,16 +2,16 @@ - Copyright (C) 2010-2021 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published -- by the Free Software Foundation; either version 3 of the License, or -+ under the terms of the GNU Lesser General Public License as published -+ by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - /* _GL_WARN_ON_USE (function, "literal string") issues a declaration ---- a/gnulib/lib/wchar.in.h -+++ b/gnulib/lib/wchar.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2007-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Eric Blake. */ - -@@ -111,7 +111,7 @@ - /* mingw and MSVC define wint_t as 'unsigned short' in or - . This is too small: ISO C 99 section 7.24.1.(2) says that - wint_t must be "unchanged by default argument promotions". Override it. */ --# if @GNULIB_OVERRIDES_WINT_T@ -+# if @GNULIBHEADERS_OVERRIDE_WINT_T@ - # if !GNULIB_defined_wint_t - # if @HAVE_CRTDEFS_H@ - # include ---- a/gnulib/lib/wcrtomb.c -+++ b/gnulib/lib/wcrtomb.c -@@ -2,17 +2,17 @@ - Copyright (C) 2008-2021 Free Software Foundation, Inc. - Written by Bruno Haible , 2008. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/wctype-h.c -+++ b/gnulib/lib/wctype-h.c -@@ -1,4 +1,23 @@ -+/* Inline functions for . -+ -+ Copyright (C) 2012-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ - /* Normally this would be wctype.c, but that name's already taken. */ -+ - #include -+ - #define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE - #include "wctype.h" ---- a/gnulib/lib/wctype.in.h -+++ b/gnulib/lib/wctype.in.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2006-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible and Paul Eggert. */ - -@@ -103,7 +103,7 @@ _GL_INLINE_HEADER_BEGIN - /* mingw and MSVC define wint_t as 'unsigned short' in or - . This is too small: ISO C 99 section 7.24.1.(2) says that - wint_t must be "unchanged by default argument promotions". Override it. */ --# if @GNULIB_OVERRIDES_WINT_T@ -+# if @GNULIBHEADERS_OVERRIDE_WINT_T@ - # if !GNULIB_defined_wint_t - # if @HAVE_CRTDEFS_H@ - # include -@@ -132,7 +132,7 @@ typedef unsigned int rpl_wint_t; - same way, or not at all. */ - # if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ - --# if @GNULIB_OVERRIDES_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */ -+# if @GNULIBHEADERS_OVERRIDE_WINT_T@ /* implies @REPLACE_ISWCNTRL@ */ - - _GL_WCTYPE_INLINE int - rpl_iswalnum (wint_t wc) -@@ -496,7 +496,7 @@ _GL_FUNCDECL_RPL (iswxdigit, int, (wint_ - - # endif - --# if defined __MINGW32__ && !@GNULIB_OVERRIDES_WINT_T@ -+# if defined __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ - - /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. - The functions towlower and towupper are implemented in the MSVCRT library -@@ -529,7 +529,7 @@ rpl_towupper (wint_t wc) - # define towupper rpl_towupper - # endif - --# endif /* __MINGW32__ && !@GNULIB_OVERRIDES_WINT_T@ */ -+# endif /* __MINGW32__ && !@GNULIBHEADERS_OVERRIDE_WINT_T@ */ - - # define GNULIB_defined_wctype_functions 1 - #endif -@@ -646,7 +646,7 @@ _GL_WARN_ON_USE (wctype, "wctype is unpo - The argument WC must be either a wchar_t value or WEOF. - The argument DESC must have been returned by the wctype() function. */ - #if @GNULIB_ISWCTYPE@ --# if @GNULIB_OVERRIDES_WINT_T@ -+# if @GNULIBHEADERS_OVERRIDE_WINT_T@ - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef iswctype - # define iswctype rpl_iswctype ---- a/gnulib/lib/wcwidth.c -+++ b/gnulib/lib/wcwidth.c -@@ -1,17 +1,17 @@ - /* Determine the number of screen columns needed for a character. - Copyright (C) 2006-2007, 2010-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #include ---- a/gnulib/lib/windows-initguard.h -+++ b/gnulib/lib/windows-initguard.h -@@ -1,18 +1,18 @@ - /* Init guards, somewhat like spinlocks (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/windows-mutex.c -+++ b/gnulib/lib/windows-mutex.c -@@ -1,18 +1,18 @@ - /* Plain mutexes (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/windows-mutex.h -+++ b/gnulib/lib/windows-mutex.h -@@ -1,18 +1,18 @@ - /* Plain mutexes (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/windows-once.c -+++ b/gnulib/lib/windows-once.c -@@ -1,18 +1,18 @@ - /* Once-only control (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/windows-once.h -+++ b/gnulib/lib/windows-once.h -@@ -1,18 +1,18 @@ - /* Once-only control (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/windows-recmutex.c -+++ b/gnulib/lib/windows-recmutex.c -@@ -1,18 +1,18 @@ - /* Plain recursive mutexes (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/windows-recmutex.h -+++ b/gnulib/lib/windows-recmutex.h -@@ -1,18 +1,18 @@ - /* Plain recursive mutexes (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/windows-rwlock.c -+++ b/gnulib/lib/windows-rwlock.c -@@ -1,18 +1,18 @@ - /* Read-write locks (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/windows-rwlock.h -+++ b/gnulib/lib/windows-rwlock.h -@@ -1,18 +1,18 @@ - /* Read-write locks (native Windows implementation). - Copyright (C) 2005-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - /* Written by Bruno Haible , 2005. - Based on GCC's gthr-win32.h. */ ---- a/gnulib/lib/xalloc-oversized.h -+++ b/gnulib/lib/xalloc-oversized.h -@@ -2,17 +2,17 @@ - - Copyright (C) 1990-2000, 2003-2004, 2006-2021 Free Software Foundation, Inc. - -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -+ You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - - #ifndef XALLOC_OVERSIZED_H_ -@@ -21,34 +21,39 @@ - #include - #include - --/* True if N * S would overflow in a size_t calculation, -- or would generate a value larger than PTRDIFF_MAX. -+/* True if N * S does not fit into both ptrdiff_t and size_t. -+ N and S should be nonnegative and free of side effects. - This expands to a constant expression if N and S are both constants. -- By gnulib convention, SIZE_MAX represents overflow in size -+ By gnulib convention, SIZE_MAX represents overflow in size_t - calculations, so the conservative size_t-based dividend to use here - is SIZE_MAX - 1. */ - #define __xalloc_oversized(n, s) \ -- ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) -- --#if PTRDIFF_MAX < SIZE_MAX --typedef ptrdiff_t __xalloc_count_type; --#else --typedef size_t __xalloc_count_type; --#endif -- --/* Return 1 if an array of N objects, each of size S, cannot exist -- reliably due to size or ptrdiff_t arithmetic overflow. S must be -- positive and N must be nonnegative. This is a macro, not a -- function, so that it works correctly even when SIZE_MAX < N. */ -- --#if 7 <= __GNUC__ && !defined __clang__ -+ ((s) != 0 \ -+ && ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) \ -+ < (n))) -+ -+/* Return 1 if and only if an array of N objects, each of size S, -+ cannot exist reliably because its total size in bytes would exceed -+ MIN (PTRDIFF_MAX, SIZE_MAX - 1). -+ -+ N and S should be nonnegative and free of side effects. -+ -+ Warning: (xalloc_oversized (N, S) ? NULL : malloc (N * S)) can -+ misbehave if N and S are both narrower than ptrdiff_t and size_t, -+ and can be rewritten as (xalloc_oversized (N, S) ? NULL -+ : malloc (N * (size_t) S)). -+ -+ This is a macro, not a function, so that it works even if an -+ argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX). */ -+#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX - # define xalloc_oversized(n, s) \ -- __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) --#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ -+ __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) -+#elif (5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ \ -+ && PTRDIFF_MAX < SIZE_MAX) - # define xalloc_oversized(n, s) \ - (__builtin_constant_p (n) && __builtin_constant_p (s) \ - ? __xalloc_oversized (n, s) \ -- : ({ __xalloc_count_type __xalloc_count; \ -+ : ({ ptrdiff_t __xalloc_count; \ - __builtin_mul_overflow (n, s, &__xalloc_count); })) - - /* Other compilers use integer division; this may be slower but is ---- a/gnulib/lib/xalloc.h -+++ b/gnulib/lib/xalloc.h -@@ -21,7 +21,10 @@ - #include - #include - --#include "xalloc-oversized.h" -+#if GNULIB_XALLOC -+# include "idx.h" -+# include "intprops.h" -+#endif - - #ifndef _GL_INLINE_HEADER_BEGIN - #error "Please include config.h first." -@@ -50,17 +53,26 @@ extern "C" { - - #if GNULIB_XALLOC - --void *xmalloc (size_t s) -- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); --void *xzalloc (size_t s) -- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); -+void *xmalloc (size_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); -+void *ximalloc (idx_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); -+void *xzalloc (size_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); -+void *xizalloc (idx_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); - void *xcalloc (size_t n, size_t s) -- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); --void *xrealloc (void *p, size_t s) -- _GL_ATTRIBUTE_ALLOC_SIZE ((2)); --void *x2realloc (void *p, size_t *pn); --void *xmemdup (void const *p, size_t s) -- _GL_ATTRIBUTE_ALLOC_SIZE ((2)); -+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); -+void *xicalloc (idx_t n, idx_t s) -+ _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); -+void *xrealloc (void *p, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); -+void *xirealloc (void *p, idx_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); -+void *xreallocarray (void *p, size_t n, size_t s) -+ _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)); -+void *xireallocarray (void *p, idx_t n, idx_t s) -+ _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)); -+void *x2realloc (void *p, size_t *ps); /* superseded by xpalloc */ -+void *x2nrealloc (void *p, size_t *pn, size_t s); /* superseded by xpalloc */ -+void *xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s); -+void *xmemdup (void const *p, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); -+void *ximemdup (void const *p, idx_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); -+char *ximemdup0 (void const *p, idx_t s) _GL_ATTRIBUTE_MALLOC; - char *xstrdup (char const *str) - _GL_ATTRIBUTE_MALLOC; - -@@ -98,11 +110,10 @@ XALLOC_INLINE void *xnmalloc (size_t n, - XALLOC_INLINE void * - xnmalloc (size_t n, size_t s) - { -- if (xalloc_oversized (n, s)) -- xalloc_die (); -- return xmalloc (n * s); -+ return xreallocarray (NULL, n, s); - } - -+/* FIXME: Deprecate this in favor of xreallocarray? */ - /* Change the size of an allocated block of memory P to an array of N - objects each of S bytes, with error checking. S must be nonzero. */ - -@@ -111,100 +122,7 @@ XALLOC_INLINE void *xnrealloc (void *p, - XALLOC_INLINE void * - xnrealloc (void *p, size_t n, size_t s) - { -- if (xalloc_oversized (n, s)) -- xalloc_die (); -- return xrealloc (p, n * s); --} -- --/* If P is null, allocate a block of at least *PN such objects; -- otherwise, reallocate P so that it contains more than *PN objects -- each of S bytes. S must be nonzero. Set *PN to the new number of -- objects, and return the pointer to the new block. *PN is never set -- to zero, and the returned pointer is never null. -- -- Repeated reallocations are guaranteed to make progress, either by -- allocating an initial block with a nonzero size, or by allocating a -- larger block. -- -- In the following implementation, nonzero sizes are increased by a -- factor of approximately 1.5 so that repeated reallocations have -- O(N) overall cost rather than O(N**2) cost, but the -- specification for this function does not guarantee that rate. -- -- Here is an example of use: -- -- int *p = NULL; -- size_t used = 0; -- size_t allocated = 0; -- -- void -- append_int (int value) -- { -- if (used == allocated) -- p = x2nrealloc (p, &allocated, sizeof *p); -- p[used++] = value; -- } -- -- This causes x2nrealloc to allocate a block of some nonzero size the -- first time it is called. -- -- To have finer-grained control over the initial size, set *PN to a -- nonzero value before calling this function with P == NULL. For -- example: -- -- int *p = NULL; -- size_t used = 0; -- size_t allocated = 0; -- size_t allocated1 = 1000; -- -- void -- append_int (int value) -- { -- if (used == allocated) -- { -- p = x2nrealloc (p, &allocated1, sizeof *p); -- allocated = allocated1; -- } -- p[used++] = value; -- } -- -- */ -- --XALLOC_INLINE void * --x2nrealloc (void *p, size_t *pn, size_t s) --{ -- size_t n = *pn; -- -- if (! p) -- { -- if (! n) -- { -- /* The approximate size to use for initial small allocation -- requests, when the invoking code specifies an old size of -- zero. This is the largest "small" request for the GNU C -- library malloc. */ -- enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; -- -- n = DEFAULT_MXFAST / s; -- n += !n; -- } -- if (xalloc_oversized (n, s)) -- xalloc_die (); -- } -- else -- { -- /* Set N = floor (1.5 * N) + 1 so that progress is made even if N == 0. -- Check for overflow, so that N * S stays in both ptrdiff_t and -- size_t range. The check may be slightly conservative, but an -- exact check isn't worth the trouble. */ -- if ((PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX) / 3 * 2 / s -- <= n) -- xalloc_die (); -- n += n / 2 + 1; -- } -- -- *pn = n; -- return xrealloc (p, n * s); -+ return xreallocarray (p, n, s); - } - - /* Return a pointer to a new buffer of N bytes. This is like xmalloc, -@@ -239,9 +157,16 @@ xrealloc (T *p, size_t s) - } - - template inline T * -+xreallocarray (T *p, size_t n, size_t s) -+{ -+ return (T *) xreallocarray ((void *) p, n, s); -+} -+ -+/* FIXME: Deprecate this in favor of xreallocarray? */ -+template inline T * - xnrealloc (T *p, size_t n, size_t s) - { -- return (T *) xnrealloc ((void *) p, n, s); -+ return xreallocarray (p, n, s); - } - - template inline T * ---- a/gnulib/lib/xmalloc.c -+++ b/gnulib/lib/xmalloc.c -@@ -21,80 +21,250 @@ - - #include "xalloc.h" - -+#include "ialloc.h" -+#include "intprops.h" -+#include "minmax.h" -+ - #include - #include - --/* 1 if calloc, malloc and realloc are known to be compatible with GNU. -- This matters if we are not also using the calloc-gnu, malloc-gnu -- and realloc-gnu modules, which define HAVE_CALLOC_GNU, -- HAVE_MALLOC_GNU and HAVE_REALLOC_GNU and support the GNU API even -- on non-GNU platforms. */ --#if defined HAVE_CALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__) --enum { HAVE_GNU_CALLOC = 1 }; --#else --enum { HAVE_GNU_CALLOC = 0 }; --#endif --#if defined HAVE_MALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__) --enum { HAVE_GNU_MALLOC = 1 }; --#else --enum { HAVE_GNU_MALLOC = 0 }; --#endif --#if defined HAVE_REALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__) --enum { HAVE_GNU_REALLOC = 1 }; --#else --enum { HAVE_GNU_REALLOC = 0 }; --#endif -+static void * _GL_ATTRIBUTE_PURE -+nonnull (void *p) -+{ -+ if (!p) -+ xalloc_die (); -+ return p; -+} - --/* Allocate N bytes of memory dynamically, with error checking. */ -+/* Allocate S bytes of memory dynamically, with error checking. */ - - void * --xmalloc (size_t n) -+xmalloc (size_t s) - { -- void *p = malloc (n); -- if (!p && (HAVE_GNU_MALLOC || n)) -- xalloc_die (); -- return p; -+ return nonnull (malloc (s)); -+} -+ -+void * -+ximalloc (idx_t s) -+{ -+ return nonnull (imalloc (s)); - } - --/* Change the size of an allocated block of memory P to N bytes, -+/* Change the size of an allocated block of memory P to S bytes, - with error checking. */ - - void * --xrealloc (void *p, size_t n) -+xrealloc (void *p, size_t s) - { -- if (!HAVE_GNU_REALLOC && !n && p) -- { -- /* The GNU and C99 realloc behaviors disagree here. Act like GNU. */ -- free (p); -- return NULL; -- } -+ void *r = realloc (p, s); -+ if (!r && (!p || s)) -+ xalloc_die (); -+ return r; -+} -+ -+void * -+xirealloc (void *p, idx_t s) -+{ -+ return nonnull (irealloc (p, s)); -+} -+ -+/* Change the size of an allocated block of memory P to an array of N -+ objects each of S bytes, with error checking. */ - -- void *r = realloc (p, n); -- if (!r && (n || (HAVE_GNU_REALLOC && !p))) -+void * -+xreallocarray (void *p, size_t n, size_t s) -+{ -+ void *r = reallocarray (p, n, s); -+ if (!r && (!p || (n && s))) - xalloc_die (); - return r; - } - --/* If P is null, allocate a block of at least *PN bytes; otherwise, -- reallocate P so that it contains more than *PN bytes. *PN must be -- nonzero unless P is null. Set *PN to the new block's size, and -- return the pointer to the new block. *PN is never set to zero, and -+void * -+xireallocarray (void *p, idx_t n, idx_t s) -+{ -+ return nonnull (ireallocarray (p, n, s)); -+} -+ -+/* If P is null, allocate a block of at least *PS bytes; otherwise, -+ reallocate P so that it contains more than *PS bytes. *PS must be -+ nonzero unless P is null. Set *PS to the new block's size, and -+ return the pointer to the new block. *PS is never set to zero, and - the returned pointer is never null. */ - - void * --x2realloc (void *p, size_t *pn) -+x2realloc (void *p, size_t *ps) -+{ -+ return x2nrealloc (p, ps, 1); -+} -+ -+/* If P is null, allocate a block of at least *PN such objects; -+ otherwise, reallocate P so that it contains more than *PN objects -+ each of S bytes. S must be nonzero. Set *PN to the new number of -+ objects, and return the pointer to the new block. *PN is never set -+ to zero, and the returned pointer is never null. -+ -+ Repeated reallocations are guaranteed to make progress, either by -+ allocating an initial block with a nonzero size, or by allocating a -+ larger block. -+ -+ In the following implementation, nonzero sizes are increased by a -+ factor of approximately 1.5 so that repeated reallocations have -+ O(N) overall cost rather than O(N**2) cost, but the -+ specification for this function does not guarantee that rate. -+ -+ Here is an example of use: -+ -+ int *p = NULL; -+ size_t used = 0; -+ size_t allocated = 0; -+ -+ void -+ append_int (int value) -+ { -+ if (used == allocated) -+ p = x2nrealloc (p, &allocated, sizeof *p); -+ p[used++] = value; -+ } -+ -+ This causes x2nrealloc to allocate a block of some nonzero size the -+ first time it is called. -+ -+ To have finer-grained control over the initial size, set *PN to a -+ nonzero value before calling this function with P == NULL. For -+ example: -+ -+ int *p = NULL; -+ size_t used = 0; -+ size_t allocated = 0; -+ size_t allocated1 = 1000; -+ -+ void -+ append_int (int value) -+ { -+ if (used == allocated) -+ { -+ p = x2nrealloc (p, &allocated1, sizeof *p); -+ allocated = allocated1; -+ } -+ p[used++] = value; -+ } -+ -+ */ -+ -+void * -+x2nrealloc (void *p, size_t *pn, size_t s) - { -- return x2nrealloc (p, pn, 1); -+ size_t n = *pn; -+ -+ if (! p) -+ { -+ if (! n) -+ { -+ /* The approximate size to use for initial small allocation -+ requests, when the invoking code specifies an old size of -+ zero. This is the largest "small" request for the GNU C -+ library malloc. */ -+ enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; -+ -+ n = DEFAULT_MXFAST / s; -+ n += !n; -+ } -+ } -+ else -+ { -+ /* Set N = floor (1.5 * N) + 1 to make progress even if N == 0. */ -+ if (INT_ADD_WRAPV (n, (n >> 1) + 1, &n)) -+ xalloc_die (); -+ } -+ -+ p = xreallocarray (p, n, s); -+ *pn = n; -+ return p; - } - --/* Allocate N bytes of zeroed memory dynamically, with error checking. -+/* Grow PA, which points to an array of *PN items, and return the -+ location of the reallocated array, updating *PN to reflect its -+ new size. The new array will contain at least N_INCR_MIN more -+ items, but will not contain more than N_MAX items total. -+ S is the size of each item, in bytes. -+ -+ S and N_INCR_MIN must be positive. *PN must be -+ nonnegative. If N_MAX is -1, it is treated as if it were -+ infinity. -+ -+ If PA is null, then allocate a new array instead of reallocating -+ the old one. -+ -+ Thus, to grow an array A without saving its old contents, do -+ { free (A); A = xpalloc (NULL, &AITEMS, ...); }. */ -+ -+void * -+xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s) -+{ -+ idx_t n0 = *pn; -+ -+ /* The approximate size to use for initial small allocation -+ requests. This is the largest "small" request for the GNU C -+ library malloc. */ -+ enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; -+ -+ /* If the array is tiny, grow it to about (but no greater than) -+ DEFAULT_MXFAST bytes. Otherwise, grow it by about 50%. -+ Adjust the growth according to three constraints: N_INCR_MIN, -+ N_MAX, and what the C language can represent safely. */ -+ -+ idx_t n; -+ if (INT_ADD_WRAPV (n0, n0 >> 1, &n)) -+ n = IDX_MAX; -+ if (0 <= n_max && n_max < n) -+ n = n_max; -+ -+ /* NBYTES is of a type suitable for holding the count of bytes in an object. -+ This is typically idx_t, but it should be size_t on (theoretical?) -+ platforms where SIZE_MAX < IDX_MAX so xpalloc does not pass -+ values greater than SIZE_MAX to xrealloc. */ -+#if IDX_MAX <= SIZE_MAX -+ idx_t nbytes; -+#else -+ size_t nbytes; -+#endif -+ idx_t adjusted_nbytes -+ = (INT_MULTIPLY_WRAPV (n, s, &nbytes) -+ ? MIN (IDX_MAX, SIZE_MAX) -+ : nbytes < DEFAULT_MXFAST ? DEFAULT_MXFAST : 0); -+ if (adjusted_nbytes) -+ { -+ n = adjusted_nbytes / s; -+ nbytes = adjusted_nbytes - adjusted_nbytes % s; -+ } -+ -+ if (! pa) -+ *pn = 0; -+ if (n - n0 < n_incr_min -+ && (INT_ADD_WRAPV (n0, n_incr_min, &n) -+ || (0 <= n_max && n_max < n) -+ || INT_MULTIPLY_WRAPV (n, s, &nbytes))) -+ xalloc_die (); -+ pa = xrealloc (pa, nbytes); -+ *pn = n; -+ return pa; -+} -+ -+/* Allocate S bytes of zeroed memory dynamically, with error checking. - There's no need for xnzalloc (N, S), since it would be equivalent - to xcalloc (N, S). */ - - void * --xzalloc (size_t n) -+xzalloc (size_t s) -+{ -+ return xcalloc (s, 1); -+} -+ -+void * -+xizalloc (idx_t s) - { -- return xcalloc (n, 1); -+ return xicalloc (s, 1); - } - - /* Allocate zeroed memory for N elements of S bytes, with error -@@ -103,15 +273,13 @@ xzalloc (size_t n) - void * - xcalloc (size_t n, size_t s) - { -- void *p; -- /* Test for overflow, since objects with size greater than -- PTRDIFF_MAX cause pointer subtraction to go awry. Omit size-zero -- tests if HAVE_GNU_CALLOC, since GNU calloc never returns NULL if -- successful. */ -- if (xalloc_oversized (n, s) -- || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) -- xalloc_die (); -- return p; -+ return nonnull (calloc (n, s)); -+} -+ -+void * -+xicalloc (idx_t n, idx_t s) -+{ -+ return nonnull (icalloc (n, s)); - } - - /* Clone an object P of size S, with error checking. There's no need -@@ -124,6 +292,23 @@ xmemdup (void const *p, size_t s) - return memcpy (xmalloc (s), p, s); - } - -+void * -+ximemdup (void const *p, idx_t s) -+{ -+ return memcpy (ximalloc (s), p, s); -+} -+ -+/* Clone an object P of size S, with error checking. Append -+ a terminating NUL byte. */ -+ -+char * -+ximemdup0 (void const *p, idx_t s) -+{ -+ char *result = ximalloc (s + 1); -+ result[s] = 0; -+ return memcpy (result, p, s); -+} -+ - /* Clone STRING. */ - - char * ---- a/gnulib/lib/xsize.c -+++ b/gnulib/lib/xsize.c -@@ -1,3 +1,21 @@ -+/* Checked size_t computations. -+ -+ Copyright (C) 2012-2021 Free Software Foundation, Inc. -+ -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. -+ -+ This file is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ -+ - #include -+ - #define XSIZE_INLINE _GL_EXTERN_INLINE - #include "xsize.h" ---- a/gnulib/lib/xsize.h -+++ b/gnulib/lib/xsize.h -@@ -2,18 +2,18 @@ - - Copyright (C) 2003, 2008-2021 Free Software Foundation, Inc. - -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -+ This file is free software: you can redistribute it and/or modify -+ it under the terms of the GNU Lesser General Public License as -+ published by the Free Software Foundation; either version 2.1 of the -+ License, or (at your option) any later version. - -- This program is distributed in the hope that it will be useful, -+ This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -+ GNU Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public License -- along with this program; if not, see . */ -+ You should have received a copy of the GNU Lesser General Public License -+ along with this program. If not, see . */ - - #ifndef _XSIZE_H - #define _XSIZE_H ---- /dev/null -+++ b/gnulib/m4/calloc.m4 -@@ -0,0 +1,82 @@ -+# calloc.m4 serial 27 -+ -+# Copyright (C) 2004-2021 Free Software Foundation, Inc. -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# Written by Jim Meyering. -+ -+# Determine whether calloc (N, S) returns non-NULL when N*S is zero, -+# and returns NULL when N*S overflows. -+# If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc -+# and arrange to use a calloc wrapper function that does work in that case. -+ -+# _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) -+# ------------------------------------- -+# If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. -+AC_DEFUN([_AC_FUNC_CALLOC_IF], -+[ -+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles -+ AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], -+ [ac_cv_func_calloc_0_nonnull], -+ [if test $cross_compiling != yes; then -+ ac_cv_func_calloc_0_nonnull=yes -+ AC_RUN_IFELSE( -+ [AC_LANG_PROGRAM( -+ [AC_INCLUDES_DEFAULT], -+ [[int result = 0; -+ char * volatile p = calloc (0, 0); -+ if (!p) -+ result |= 1; -+ free (p); -+ return result; -+ ]])], -+ [], -+ [ac_cv_func_calloc_0_nonnull=no]) -+ else -+ case "$host_os" in -+ # Guess yes on glibc systems. -+ *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; -+ # Guess yes on musl systems. -+ *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; -+ # Guess yes on native Windows. -+ mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; -+ # If we don't know, obey --enable-cross-guesses. -+ *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; -+ esac -+ fi -+ ]) -+ AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) -+]) -+ -+ -+# gl_FUNC_CALLOC_GNU -+# ------------------ -+# Replace calloc if it is not compatible with GNU libc. -+AC_DEFUN([gl_FUNC_CALLOC_GNU], -+[ -+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) -+ if test $REPLACE_CALLOC = 0; then -+ _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC=1]) -+ fi -+])# gl_FUNC_CALLOC_GNU -+ -+# gl_FUNC_CALLOC_POSIX -+# -------------------- -+# Test whether 'calloc' is POSIX compliant (sets errno to ENOMEM when it -+# fails, and doesn't mess up with ptrdiff_t or size_t overflow), -+# and replace calloc if it is not. -+AC_DEFUN([gl_FUNC_CALLOC_POSIX], -+[ -+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) -+ if test $REPLACE_MALLOC = 1; then -+ REPLACE_CALLOC=1 -+ fi -+ dnl Although in theory we should also test for size_t overflow, -+ dnl in practice testing for ptrdiff_t overflow suffices -+ dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. -+ dnl A separate size_t test would slow down 'configure'. -+]) ---- a/gnulib/m4/fcntl_h.m4 -+++ b/gnulib/m4/fcntl_h.m4 -@@ -1,4 +1,4 @@ --# serial 17 -+# serial 20 - # Configure fcntl.h. - dnl Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation -@@ -7,7 +7,7 @@ dnl with or without modifications, as lo - - dnl Written by Paul Eggert. - --AC_DEFUN([gl_FCNTL_H], -+AC_DEFUN_ONCE([gl_FCNTL_H], - [ - AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) - AC_REQUIRE([gl_FCNTL_O_FLAGS]) -@@ -26,25 +26,40 @@ AC_DEFUN([gl_FCNTL_H], - ]], [fcntl openat]) - ]) - -+# gl_FCNTL_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_FCNTL_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) -+ dnl Support Microsoft deprecated alias function names by default. -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_FCNTL_H_DEFAULTS], - [ -- GNULIB_CREAT=0; AC_SUBST([GNULIB_CREAT]) -- GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) -- GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING]) -- GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) -- GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) -- dnl Support Microsoft deprecated alias function names by default. -- GNULIB_MDA_CREAT=1; AC_SUBST([GNULIB_MDA_CREAT]) -- GNULIB_MDA_OPEN=1; AC_SUBST([GNULIB_MDA_OPEN]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) - HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) ---- /dev/null -+++ b/gnulib/m4/free.m4 -@@ -0,0 +1,52 @@ -+# free.m4 serial 6 -+# Copyright (C) 2003-2005, 2009-2021 Free Software Foundation, Inc. -+# This file is free software; the Free Software Foundation -+# gives unlimited permission to copy and/or distribute it, -+# with or without modifications, as long as this notice is preserved. -+ -+# Written by Paul Eggert and Bruno Haible. -+ -+AC_DEFUN([gl_FUNC_FREE], -+[ -+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ -+ dnl In the next release of POSIX, free must preserve errno. -+ dnl https://www.austingroupbugs.net/view.php?id=385 -+ dnl https://sourceware.org/bugzilla/show_bug.cgi?id=17924 -+ dnl So far, we know of three platforms that do this: -+ dnl * glibc >= 2.33, thanks to the fix for this bug: -+ dnl -+ dnl * OpenBSD >= 4.5, thanks to this commit: -+ dnl -+ dnl * Solaris, because its malloc() implementation is based on brk(), -+ dnl not mmap(); hence its free() implementation makes no system calls. -+ dnl For other platforms, you can only be sure if they state it in their -+ dnl documentation, or by code inspection of the free() implementation in libc. -+ AC_CACHE_CHECK([whether free is known to preserve errno], -+ [gl_cv_func_free_preserves_errno], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ ]], -+ [[#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__) -+ #elif defined __OpenBSD__ -+ #elif defined __sun -+ #else -+ #error "'free' is not known to preserve errno" -+ #endif -+ ]])], -+ [gl_cv_func_free_preserves_errno=yes], -+ [gl_cv_func_free_preserves_errno=no]) -+ ]) -+ -+ case $gl_cv_func_free_preserves_errno in -+ *yes) -+ AC_DEFINE([HAVE_FREE_POSIX], [1], -+ [Define if the 'free' function is guaranteed to preserve errno.]) -+ ;; -+ *) REPLACE_FREE=1 ;; -+ esac -+]) -+ -+# Prerequisites of lib/free.c. -+AC_DEFUN([gl_PREREQ_FREE], [:]) ---- a/gnulib/m4/fstat.m4 -+++ b/gnulib/m4/fstat.m4 -@@ -1,4 +1,4 @@ --# fstat.m4 serial 7 -+# fstat.m4 serial 8 - dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -34,7 +34,7 @@ AC_DEFUN([gl_FUNC_FSTAT], - - # Prerequisites of lib/fstat.c and lib/stat-w32.c. - AC_DEFUN([gl_PREREQ_FSTAT], [ -- AC_REQUIRE([gl_HEADER_SYS_STAT_H]) -+ AC_REQUIRE([gl_SYS_STAT_H]) - AC_REQUIRE([gl_PREREQ_STAT_W32]) - : - ]) ---- a/gnulib/m4/gnulib-common.m4 -+++ b/gnulib/m4/gnulib-common.m4 -@@ -1,4 +1,4 @@ --# gnulib-common.m4 serial 63 -+# gnulib-common.m4 serial 66 - dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -357,6 +357,16 @@ AC_DEFUN([gl_COMMON_BODY], [ - export LIBC_FATAL_STDERR_ - ]) - -+# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename]) -+# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename], [initialvalue]) -+# initializes the shell variable that indicates the presence of the given module -+# as a C preprocessor expression. -+AC_DEFUN([gl_MODULE_INDICATOR_INIT_VARIABLE], -+[ -+ GL_MODULE_INDICATOR_PREFIX[]_[$1]=m4_if([$2], , [0], [$2]) -+ AC_SUBST(GL_MODULE_INDICATOR_PREFIX[]_[$1]) -+]) -+ - # gl_MODULE_INDICATOR_CONDITION - # expands to a C preprocessor expression that evaluates to 1 or 0, depending - # whether a gnulib module that has been requested shall be considered present -@@ -369,9 +379,9 @@ m4_define([gl_MODULE_INDICATOR_CONDITION - AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], - [ - gl_MODULE_INDICATOR_SET_VARIABLE_AUX( -- [GNULIB_[]m4_translit([[$1]], -- [abcdefghijklmnopqrstuvwxyz./-], -- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], -+ [GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]m4_translit([[$1]], -+ [abcdefghijklmnopqrstuvwxyz./-], -+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], - [gl_MODULE_INDICATOR_CONDITION]) - ]) - -@@ -656,6 +666,72 @@ AC_DEFUN([gl_CACHE_VAL_SILENT], - ]) - ]) - -+# gl_CC_ALLOW_WARNINGS -+# sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option -+# that reverts a preceding '-Werror' option, if available. -+# This is expected to be '-Wno-error' on gcc, clang (except clang/MSVC), xlclang -+# and empty otherwise. -+AC_DEFUN([gl_CC_ALLOW_WARNINGS], -+[ -+ AC_REQUIRE([AC_PROG_CC]) -+ AC_CACHE_CHECK([for C compiler option to allow warnings], -+ [gl_cv_cc_wallow], -+ [rm -f conftest* -+ echo 'int dummy;' > conftest.c -+ AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null -+ AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null -+ dnl Test the number of error output lines, because AIX xlc accepts the -+ dnl option '-Wno-error', just to produce a warning -+ dnl "Option -Wno-error was incorrectly specified. The option will be ignored." -+ dnl afterwards. -+ if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then -+ gl_cv_cc_wallow='-Wno-error' -+ else -+ gl_cv_cc_wallow=none -+ fi -+ rm -f conftest* -+ ]) -+ case "$gl_cv_cc_wallow" in -+ none) GL_CFLAG_ALLOW_WARNINGS='' ;; -+ *) GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;; -+ esac -+ AC_SUBST([GL_CFLAG_ALLOW_WARNINGS]) -+]) -+ -+# gl_CXX_ALLOW_WARNINGS -+# sets and substitutes a variable GL_CXXFLAG_ALLOW_WARNINGS, to a $(CC) option -+# that reverts a preceding '-Werror' option, if available. -+AC_DEFUN([gl_CXX_ALLOW_WARNINGS], -+[ -+ dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX. -+ if test -n "$CXX" && test "$CXX" != no; then -+ AC_CACHE_CHECK([for C++ compiler option to allow warnings], -+ [gl_cv_cxx_wallow], -+ [rm -f conftest* -+ echo 'int dummy;' > conftest.cc -+ AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null -+ AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null -+ dnl Test the number of error output lines, because AIX xlC accepts the -+ dnl option '-Wno-error', just to produce a warning -+ dnl "Option -Wno-error was incorrectly specified. The option will be ignored." -+ dnl afterwards. -+ if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then -+ gl_cv_cxx_wallow='-Wno-error' -+ else -+ gl_cv_cxx_wallow=none -+ fi -+ rm -f conftest* -+ ]) -+ case "$gl_cv_cxx_wallow" in -+ none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; -+ *) GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;; -+ esac -+ else -+ GL_CXXFLAG_ALLOW_WARNINGS='' -+ fi -+ AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS]) -+]) -+ - dnl Expands to some code for use in .c programs that, on native Windows, defines - dnl the Microsoft deprecated alias function names to the underscore-prefixed - dnl actual function names. With this macro, these function names are available ---- a/gnulib/m4/gnulib-comp.m4 -+++ b/gnulib/m4/gnulib-comp.m4 -@@ -51,6 +51,8 @@ AC_DEFUN([gl_EARLY], - # Code from module btowc: - # Code from module builtin-expect: - # Code from module c99: -+ # Code from module calloc-gnu: -+ # Code from module calloc-posix: - # Code from module cloexec: - # Code from module close: - # Code from module double-slash-root: -@@ -66,6 +68,7 @@ AC_DEFUN([gl_EARLY], - # Code from module fd-hook: - # Code from module filename: - # Code from module float: -+ # Code from module free-posix: - # Code from module fstat: - # Code from module getdtablesize: - # Code from module getopt-gnu: -@@ -74,7 +77,9 @@ AC_DEFUN([gl_EARLY], - # Code from module gettext-h: - # Code from module hard-locale: - # Code from module havelib: -+ # Code from module ialloc: - # Code from module iconv: -+ # Code from module idx: - # Code from module include_next: - # Code from module intprops: - # Code from module inttypes-incomplete: -@@ -84,12 +89,14 @@ AC_DEFUN([gl_EARLY], - # Code from module langinfo: - # Code from module largefile: - AC_REQUIRE([AC_SYS_LARGEFILE]) -+ AC_REQUIRE([gl_YEAR2038_EARLY]) - # Code from module libc-config: - # Code from module limits-h: - # Code from module localcharset: - # Code from module locale: - # Code from module localeconv: - # Code from module lock: -+ # Code from module malloc-gnu: - # Code from module malloc-posix: - # Code from module malloca: - # Code from module mbchar: -@@ -107,6 +114,7 @@ AC_DEFUN([gl_EARLY], - # Code from module memchr: - # Code from module mempcpy: - # Code from module memrchr: -+ # Code from module minmax: - # Code from module msvc-inval: - # Code from module msvc-nothrow: - # Code from module multiarch: -@@ -114,6 +122,9 @@ AC_DEFUN([gl_EARLY], - # Code from module nocrash: - # Code from module open: - # Code from module pathmax: -+ # Code from module realloc-gnu: -+ # Code from module realloc-posix: -+ # Code from module reallocarray: - # Code from module regex: - # Code from module setlocale-null: - # Code from module size_max: -@@ -189,6 +200,8 @@ AC_DEFUN([gl_INIT], - m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) - m4_pushdef([gl_LIBSOURCES_LIST], []) - m4_pushdef([gl_LIBSOURCES_DIR], []) -+ m4_pushdef([GL_MACRO_PREFIX], [gl]) -+ m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) - gl_COMMON - gl_source_base='gnulib/lib' - gl_FUNC_ALLOCA -@@ -196,6 +209,15 @@ AC_DEFUN([gl_INIT], - if test -n "$ARGZ_H"; then - AC_LIBOBJ([argz]) - fi -+ gl_FUNC_CALLOC_GNU -+ if test $REPLACE_CALLOC = 1; then -+ AC_LIBOBJ([calloc]) -+ fi -+ gl_FUNC_CALLOC_POSIX -+ if test $REPLACE_CALLOC = 1; then -+ AC_LIBOBJ([calloc]) -+ fi -+ gl_STDLIB_MODULE_INDICATOR([calloc-posix]) - gl_DOUBLE_SLASH_ROOT - gl_HEADER_ERRNO_H - gl_ERROR -@@ -208,6 +230,7 @@ AC_DEFUN([gl_INIT], - AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) - AC_REQUIRE([gl_EXTERN_INLINE]) - gl_FCNTL_H -+ gl_FCNTL_H_REQUIRE_DEFAULTS - gl_FLOAT_H - if test $REPLACE_FLOAT_LDBL = 1; then - AC_LIBOBJ([float]) -@@ -223,10 +246,10 @@ AC_DEFUN([gl_INIT], - if test $REPLACE_GETOPT = 1; then - AC_LIBOBJ([getopt]) - AC_LIBOBJ([getopt1]) -- dnl Arrange for unistd.h to include getopt.h. -- GNULIB_GL_UNISTD_H_GETOPT=1 -+ dnl Define the substituted variable GNULIB_UNISTD_H_GETOPT to 1. -+ gl_UNISTD_H_REQUIRE_DEFAULTS -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) - fi -- AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT]) - gl_UNISTD_MODULE_INDICATOR([getopt-posix]) - gl_FUNC_GETPROGNAME - AC_SUBST([LIBINTL]) -@@ -236,6 +259,7 @@ AC_DEFUN([gl_INIT], - m4_ifdef([gl_ICONV_MODULE_INDICATOR], - [gl_ICONV_MODULE_INDICATOR([iconv])]) - gl_INTTYPES_INCOMPLETE -+ gl_INTTYPES_H_REQUIRE_DEFAULTS - gl_FUNC_ISWBLANK - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then - : -@@ -265,6 +289,15 @@ AC_DEFUN([gl_INIT], - gl_WCTYPE_MODULE_INDICATOR([iswxdigit]) - AC_REQUIRE([gl_LARGEFILE]) - gl_LIMITS_H -+ gl_FUNC_MALLOC_GNU -+ if test $REPLACE_MALLOC = 1; then -+ AC_LIBOBJ([malloc]) -+ fi -+ AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) -+ if test $REPLACE_MALLOC = 1; then -+ AC_LIBOBJ([malloc]) -+ fi -+ gl_STDLIB_MODULE_INDICATOR([malloc-posix]) - gl_MALLOCA - gl_MBCHAR - gl_MBITER -@@ -305,6 +338,7 @@ AC_DEFUN([gl_INIT], - gl_PREREQ_MEMRCHR - fi - gl_STRING_MODULE_INDICATOR([memrchr]) -+ gl_MINMAX - gl_MULTIARCH - gl_FUNC_OPEN - if test $REPLACE_OPEN = 1; then -@@ -312,6 +346,22 @@ AC_DEFUN([gl_INIT], - gl_PREREQ_OPEN - fi - gl_FCNTL_MODULE_INDICATOR([open]) -+ gl_FUNC_REALLOC_GNU -+ if test $REPLACE_REALLOC = 1; then -+ AC_LIBOBJ([realloc]) -+ fi -+ gl_FUNC_REALLOC_POSIX -+ if test $REPLACE_REALLOC = 1; then -+ AC_LIBOBJ([realloc]) -+ fi -+ gl_STDLIB_MODULE_INDICATOR([realloc-posix]) -+ gl_FUNC_REALLOCARRAY -+ if test $HAVE_REALLOCARRAY = 0 || test $REPLACE_REALLOCARRAY = 1; then -+ AC_LIBOBJ([reallocarray]) -+ gl_PREREQ_REALLOCARRAY -+ fi -+ gl_MODULE_INDICATOR([reallocarray]) -+ gl_STDLIB_MODULE_INDICATOR([reallocarray]) - gl_REGEX - if test $ac_use_included_regex = yes; then - AC_LIBOBJ([regex]) -@@ -321,9 +371,35 @@ AC_DEFUN([gl_INIT], - gl_STDARG_H - AM_STDBOOL_H - gl_STDDEF_H -+ gl_STDDEF_H_REQUIRE_DEFAULTS - gl_STDINT_H - gl_STDIO_H -+ gl_STDIO_H_REQUIRE_DEFAULTS -+ dnl No need to create extra modules for these functions. Everyone who uses -+ dnl likely needs them. -+ gl_STDIO_MODULE_INDICATOR([fscanf]) -+ gl_MODULE_INDICATOR([fscanf]) -+ gl_STDIO_MODULE_INDICATOR([scanf]) -+ gl_MODULE_INDICATOR([scanf]) -+ gl_STDIO_MODULE_INDICATOR([fgetc]) -+ gl_STDIO_MODULE_INDICATOR([getc]) -+ gl_STDIO_MODULE_INDICATOR([getchar]) -+ gl_STDIO_MODULE_INDICATOR([fgets]) -+ gl_STDIO_MODULE_INDICATOR([fread]) -+ dnl No need to create extra modules for these functions. Everyone who uses -+ dnl likely needs them. -+ gl_STDIO_MODULE_INDICATOR([fprintf]) -+ gl_STDIO_MODULE_INDICATOR([printf]) -+ gl_STDIO_MODULE_INDICATOR([vfprintf]) -+ gl_STDIO_MODULE_INDICATOR([vprintf]) -+ gl_STDIO_MODULE_INDICATOR([fputc]) -+ gl_STDIO_MODULE_INDICATOR([putc]) -+ gl_STDIO_MODULE_INDICATOR([putchar]) -+ gl_STDIO_MODULE_INDICATOR([fputs]) -+ gl_STDIO_MODULE_INDICATOR([puts]) -+ gl_STDIO_MODULE_INDICATOR([fwrite]) - gl_STDLIB_H -+ gl_STDLIB_H_REQUIRE_DEFAULTS - gl_STRCASE - if test $HAVE_STRCASECMP = 0; then - AC_LIBOBJ([strcasecmp]) -@@ -356,8 +432,10 @@ AC_DEFUN([gl_INIT], - fi - gl_MODULE_INDICATOR([strerror]) - gl_STRING_MODULE_INDICATOR([strerror]) -- gl_HEADER_STRING_H -- gl_HEADER_STRINGS_H -+ gl_STRING_H -+ gl_STRING_H_REQUIRE_DEFAULTS -+ gl_STRINGS_H -+ gl_STRINGS_H_REQUIRE_DEFAULTS - gl_FUNC_STRNLEN - if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then - AC_LIBOBJ([strnlen]) -@@ -365,10 +443,27 @@ AC_DEFUN([gl_INIT], - fi - gl_STRING_MODULE_INDICATOR([strnlen]) - gl_SYS_TYPES_H -+ gl_SYS_TYPES_H_REQUIRE_DEFAULTS - AC_PROG_MKDIR_P - gl_UNISTD_H -- gl_LIBUNISTRING_LIBHEADER([0.9.4], [unitypes.h]) -- gl_LIBUNISTRING_LIBHEADER([0.9.4], [uniwidth.h]) -+ gl_UNISTD_H_REQUIRE_DEFAULTS -+ gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h]) -+ AH_VERBATIM([unitypes_restrict], [ -+ /* This definition is a duplicate of the one in unitypes.h. -+ It is here so that we can cope with an older version of unitypes.h -+ that does not contain this definition and that is pre-installed among -+ the public header files. */ -+ # if defined __restrict \ -+ || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ -+ || __clang_major__ >= 3 -+ # define _UC_RESTRICT __restrict -+ # elif 199901L <= __STDC_VERSION__ || defined restrict -+ # define _UC_RESTRICT restrict -+ # else -+ # define _UC_RESTRICT -+ # endif -+ ]) -+ gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/width]) - gl_FUNC_VASPRINTF - gl_STDIO_MODULE_INDICATOR([vasprintf]) -@@ -376,7 +471,9 @@ AC_DEFUN([gl_INIT], - [AM_][XGETTEXT_OPTION([--flag=asprintf:2:c-format]) - AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) - gl_WCHAR_H -+ gl_WCHAR_H_REQUIRE_DEFAULTS - gl_WCTYPE_H -+ gl_WCTYPE_H_REQUIRE_DEFAULTS - gl_FUNC_WCWIDTH - if test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1; then - AC_LIBOBJ([wcwidth]) -@@ -395,17 +492,16 @@ AC_DEFUN([gl_INIT], - gl_gnulib_enabled_dynarray=false - gl_gnulib_enabled_fcntl=false - gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239=false -+ gl_gnulib_enabled_ef07dc4b3077c11ea9cef586db4e5955=false - gl_gnulib_enabled_fstat=false - gl_gnulib_enabled_getdtablesize=false - gl_gnulib_enabled_30838f5439487421042f2225bed3af76=false -- gl_gnulib_enabled_intprops=false - gl_gnulib_enabled_langinfo=false - gl_gnulib_enabled_21ee726a3540c09237a8e70c0baf7467=false - gl_gnulib_enabled_localcharset=false - gl_gnulib_enabled_locale=false - gl_gnulib_enabled_localeconv=false - gl_gnulib_enabled_lock=false -- gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866=false - gl_gnulib_enabled_mbtowc=false - gl_gnulib_enabled_mempcpy=false - gl_gnulib_enabled_f691f076f650964c9f5598c3ee487616=false -@@ -506,8 +602,9 @@ AC_DEFUN([gl_INIT], - func_gl_gnulib_m4code_dynarray () - { - if ! $gl_gnulib_enabled_dynarray; then -+ AC_PROG_MKDIR_P - gl_gnulib_enabled_dynarray=true -- func_gl_gnulib_m4code_intprops -+ func_gl_gnulib_m4code_37f71b604aa9c54446783d80f42fe547 - func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467 - fi - } -@@ -540,6 +637,18 @@ AC_DEFUN([gl_INIT], - gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239=true - fi - } -+ func_gl_gnulib_m4code_ef07dc4b3077c11ea9cef586db4e5955 () -+ { -+ if ! $gl_gnulib_enabled_ef07dc4b3077c11ea9cef586db4e5955; then -+ gl_FUNC_FREE -+ if test $REPLACE_FREE = 1; then -+ AC_LIBOBJ([free]) -+ gl_PREREQ_FREE -+ fi -+ gl_STDLIB_MODULE_INDICATOR([free-posix]) -+ gl_gnulib_enabled_ef07dc4b3077c11ea9cef586db4e5955=true -+ fi -+ } - func_gl_gnulib_m4code_fstat () - { - if ! $gl_gnulib_enabled_fstat; then -@@ -595,16 +704,11 @@ AC_DEFUN([gl_INIT], - func_gl_gnulib_m4code_e7e881d32ca02f1c997b13c737c64bbd - fi - } -- func_gl_gnulib_m4code_intprops () -- { -- if ! $gl_gnulib_enabled_intprops; then -- gl_gnulib_enabled_intprops=true -- fi -- } - func_gl_gnulib_m4code_langinfo () - { - if ! $gl_gnulib_enabled_langinfo; then - gl_LANGINFO_H -+ gl_LANGINFO_H_REQUIRE_DEFAULTS - gl_gnulib_enabled_langinfo=true - fi - } -@@ -629,6 +733,7 @@ AC_DEFUN([gl_INIT], - { - if ! $gl_gnulib_enabled_locale; then - gl_LOCALE_H -+ gl_LOCALE_H_REQUIRE_DEFAULTS - gl_gnulib_enabled_locale=true - fi - } -@@ -666,18 +771,6 @@ AC_DEFUN([gl_INIT], - fi - fi - } -- func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 () -- { -- if ! $gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866; then -- gl_FUNC_MALLOC_POSIX -- if test $REPLACE_MALLOC = 1; then -- AC_LIBOBJ([malloc]) -- fi -- gl_STDLIB_MODULE_INDICATOR([malloc-posix]) -- gl_MODULE_INDICATOR([malloc-posix]) -- gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866=true -- fi -- } - func_gl_gnulib_m4code_mbtowc () - { - if ! $gl_gnulib_enabled_mbtowc; then -@@ -803,7 +896,6 @@ AC_DEFUN([gl_INIT], - gl_STAT_TIME - gl_STAT_BIRTHTIME - gl_gnulib_enabled_0137e3d3638b33e5819d132d0b23165c=true -- func_gl_gnulib_m4code_intprops - func_gl_gnulib_m4code_time - fi - } -@@ -870,7 +962,8 @@ AC_DEFUN([gl_INIT], - func_gl_gnulib_m4code_sys_stat () - { - if ! $gl_gnulib_enabled_sys_stat; then -- gl_HEADER_SYS_STAT_H -+ gl_SYS_STAT_H -+ gl_SYS_STAT_H_REQUIRE_DEFAULTS - AC_PROG_MKDIR_P - gl_gnulib_enabled_sys_stat=true - func_gl_gnulib_m4code_time -@@ -886,7 +979,8 @@ AC_DEFUN([gl_INIT], - func_gl_gnulib_m4code_time () - { - if ! $gl_gnulib_enabled_time; then -- gl_HEADER_TIME_H -+ gl_TIME_H -+ gl_TIME_H_REQUIRE_DEFAULTS - gl_gnulib_enabled_time=true - fi - } -@@ -897,6 +991,7 @@ AC_DEFUN([gl_INIT], - gl_FUNC_VASNPRINTF - gl_gnulib_enabled_vasnprintf=true - func_gl_gnulib_m4code_attribute -+ func_gl_gnulib_m4code_ef07dc4b3077c11ea9cef586db4e5955 - func_gl_gnulib_m4code_xsize - fi - } -@@ -1002,6 +1097,9 @@ AC_DEFUN([gl_INIT], - if test $REPLACE_OPEN = 1; then - func_gl_gnulib_m4code_stat - fi -+ if test $REPLACE_REALLOC = 1; then -+ func_gl_gnulib_m4code_ef07dc4b3077c11ea9cef586db4e5955 -+ fi - if test $ac_use_included_regex = yes; then - func_gl_gnulib_m4code_attribute - fi -@@ -1015,9 +1113,6 @@ AC_DEFUN([gl_INIT], - func_gl_gnulib_m4code_dynarray - fi - if test $ac_use_included_regex = yes; then -- func_gl_gnulib_m4code_intprops -- fi -- if test $ac_use_included_regex = yes; then - func_gl_gnulib_m4code_langinfo - fi - if test $ac_use_included_regex = yes; then -@@ -1032,12 +1127,6 @@ AC_DEFUN([gl_INIT], - if test $ac_use_included_regex = yes; then - func_gl_gnulib_m4code_wcrtomb - fi -- if test $REPLACE_STRDUP = 1; then -- func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 -- fi -- if test $REPLACE_STRERROR = 1; then -- func_gl_gnulib_m4code_intprops -- fi - if test $REPLACE_STRERROR = 1; then - func_gl_gnulib_m4code_dbb57f49352be8fb86869629a254fb72 - fi -@@ -1057,17 +1146,16 @@ AC_DEFUN([gl_INIT], - AM_CONDITIONAL([gl_GNULIB_ENABLED_dynarray], [$gl_gnulib_enabled_dynarray]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_fcntl], [$gl_gnulib_enabled_fcntl]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_43fe87a341d9b4b93c47c3ad819a5239], [$gl_gnulib_enabled_43fe87a341d9b4b93c47c3ad819a5239]) -+ AM_CONDITIONAL([gl_GNULIB_ENABLED_ef07dc4b3077c11ea9cef586db4e5955], [$gl_gnulib_enabled_ef07dc4b3077c11ea9cef586db4e5955]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_fstat], [$gl_gnulib_enabled_fstat]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], [$gl_gnulib_enabled_getdtablesize]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76], [$gl_gnulib_enabled_30838f5439487421042f2225bed3af76]) -- AM_CONDITIONAL([gl_GNULIB_ENABLED_intprops], [$gl_gnulib_enabled_intprops]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_langinfo], [$gl_gnulib_enabled_langinfo]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_21ee726a3540c09237a8e70c0baf7467], [$gl_gnulib_enabled_21ee726a3540c09237a8e70c0baf7467]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_localcharset], [$gl_gnulib_enabled_localcharset]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_locale], [$gl_gnulib_enabled_locale]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_localeconv], [$gl_gnulib_enabled_localeconv]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_lock], [$gl_gnulib_enabled_lock]) -- AM_CONDITIONAL([gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866], [$gl_gnulib_enabled_ef455225c00f5049c808c2eda3e76866]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_mbtowc], [$gl_gnulib_enabled_mbtowc]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_mempcpy], [$gl_gnulib_enabled_mempcpy]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_f691f076f650964c9f5598c3ee487616], [$gl_gnulib_enabled_f691f076f650964c9f5598c3ee487616]) -@@ -1105,6 +1193,8 @@ AC_DEFUN([gl_INIT], - m4_if(m4_sysval, [0], [], - [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) - ]) -+ m4_popdef([GL_MODULE_INDICATOR_PREFIX]) -+ m4_popdef([GL_MACRO_PREFIX]) - m4_popdef([gl_LIBSOURCES_DIR]) - m4_popdef([gl_LIBSOURCES_LIST]) - m4_popdef([AC_LIBSOURCES]) -@@ -1131,6 +1221,8 @@ AC_DEFUN([gl_INIT], - m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) - m4_pushdef([gltests_LIBSOURCES_LIST], []) - m4_pushdef([gltests_LIBSOURCES_DIR], []) -+ m4_pushdef([GL_MACRO_PREFIX], [gltests]) -+ m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) - gl_COMMON - gl_source_base='tests' - changequote(,)dnl -@@ -1152,6 +1244,8 @@ changequote([, ])dnl - m4_if(m4_sysval, [0], [], - [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) - ]) -+ m4_popdef([GL_MODULE_INDICATOR_PREFIX]) -+ m4_popdef([GL_MACRO_PREFIX]) - m4_popdef([gltests_LIBSOURCES_DIR]) - m4_popdef([gltests_LIBSOURCES_LIST]) - m4_popdef([AC_LIBSOURCES]) -@@ -1247,6 +1341,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/basename-lgpl.h - lib/btowc.c - lib/c++defs.h -+ lib/calloc.c - lib/cdefs.h - lib/cloexec.c - lib/cloexec.h -@@ -1266,6 +1361,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/float+.h - lib/float.c - lib/float.in.h -+ lib/free.c - lib/fstat.c - lib/getdtablesize.c - lib/getopt-cdefs.in.h -@@ -1285,6 +1381,9 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/glthread/threadlib.c - lib/hard-locale.c - lib/hard-locale.h -+ lib/ialloc.c -+ lib/ialloc.h -+ lib/idx.h - lib/intprops.h - lib/inttypes.in.h - lib/iswblank.c -@@ -1335,6 +1434,7 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/memchr.valgrind - lib/mempcpy.c - lib/memrchr.c -+ lib/minmax.h - lib/msvc-inval.c - lib/msvc-inval.h - lib/msvc-nothrow.c -@@ -1347,6 +1447,8 @@ AC_DEFUN([gl_FILE_LIST], [ - lib/printf-args.h - lib/printf-parse.c - lib/printf-parse.h -+ lib/realloc.c -+ lib/reallocarray.c - lib/regcomp.c - lib/regex.c - lib/regex.h -@@ -1427,6 +1529,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/argz.m4 - m4/btowc.m4 - m4/builtin-expect.m4 -+ m4/calloc.m4 - m4/close.m4 - m4/codeset.m4 - m4/double-slash-root.m4 -@@ -1441,6 +1544,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/fcntl.m4 - m4/fcntl_h.m4 - m4/float_h.m4 -+ m4/free.m4 - m4/fstat.m4 - m4/getdtablesize.m4 - m4/getopt.m4 -@@ -1483,6 +1587,7 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/memchr.m4 - m4/mempcpy.m4 - m4/memrchr.m4 -+ m4/minmax.m4 - m4/mmap-anon.m4 - m4/mode_t.m4 - m4/msvc-inval.m4 -@@ -1498,6 +1603,8 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/pid_t.m4 - m4/printf.m4 - m4/pthread_rwlock_rdlock.m4 -+ m4/realloc.m4 -+ m4/reallocarray.m4 - m4/regex.m4 - m4/setlocale_null.m4 - m4/size_max.m4 -@@ -1540,5 +1647,6 @@ AC_DEFUN([gl_FILE_LIST], [ - m4/wint_t.m4 - m4/xalloc.m4 - m4/xsize.m4 -+ m4/year2038.m4 - m4/zzgnulib.m4 - ]) ---- a/gnulib/m4/inttypes.m4 -+++ b/gnulib/m4/inttypes.m4 -@@ -1,4 +1,4 @@ --# inttypes.m4 serial 32 -+# inttypes.m4 serial 35 - dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -7,7 +7,7 @@ dnl with or without modifications, as lo - dnl From Derek Price, Bruno Haible. - dnl Test whether is supported or must be substituted. - --AC_DEFUN([gl_INTTYPES_H], -+AC_DEFUN_ONCE([gl_INTTYPES_H], - [ - AC_REQUIRE([gl_INTTYPES_INCOMPLETE]) - gl_INTTYPES_PRI_SCN -@@ -136,19 +136,34 @@ AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_IN - AC_SUBST([$1]) - ]) - -+# gl_INTTYPES_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_INTTYPES_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_INTTYPES_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXABS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXDIV]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOIMAX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUMAX]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_INTTYPES_H_DEFAULTS], - [ -- GNULIB_IMAXABS=0; AC_SUBST([GNULIB_IMAXABS]) -- GNULIB_IMAXDIV=0; AC_SUBST([GNULIB_IMAXDIV]) -- GNULIB_STRTOIMAX=0; AC_SUBST([GNULIB_STRTOIMAX]) -- GNULIB_STRTOUMAX=0; AC_SUBST([GNULIB_STRTOUMAX]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS]) - HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) ---- a/gnulib/m4/iswdigit.m4 -+++ b/gnulib/m4/iswdigit.m4 -@@ -1,4 +1,4 @@ --# iswdigit.m4 serial 2 -+# iswdigit.m4 serial 3 - dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -81,12 +81,12 @@ main (int argc, char *argv[]) - } - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) - { -- /* This fails on FreeBSD 12, NetBSD 8.0, MSVC 14. */ -+ /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ - /* U+0663 ARABIC-INDIC DIGIT THREE */ - is = for_character ("\331\243", 2); - if (!(is == 0)) - result |= 4; -- /* This fails on FreeBSD 12, NetBSD 8.0, MSVC 14. */ -+ /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ - /* U+FF11 FULLWIDTH DIGIT ONE */ - is = for_character ("\357\274\221", 3); - if (!(is == 0)) ---- a/gnulib/m4/iswxdigit.m4 -+++ b/gnulib/m4/iswxdigit.m4 -@@ -1,4 +1,4 @@ --# iswxdigit.m4 serial 2 -+# iswxdigit.m4 serial 3 - dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -72,7 +72,7 @@ main (int argc, char *argv[]) - } - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) - { -- /* This fails on FreeBSD 12. */ -+ /* This fails on FreeBSD 13.0. */ - /* U+0663 ARABIC-INDIC DIGIT THREE */ - is = for_character ("\331\243", 2); - if (!(is == 0)) ---- a/gnulib/m4/langinfo_h.m4 -+++ b/gnulib/m4/langinfo_h.m4 -@@ -1,10 +1,10 @@ --# langinfo_h.m4 serial 9 -+# langinfo_h.m4 serial 12 - dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, - dnl with or without modifications, as long as this notice is preserved. - --AC_DEFUN([gl_LANGINFO_H], -+AC_DEFUN_ONCE([gl_LANGINFO_H], - [ - AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) - -@@ -104,18 +104,33 @@ int a = YESEXPR; - ]], [nl_langinfo]) - ]) - -+# gl_LANGINFO_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_LANGINFO_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_LANGINFO_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NL_LANGINFO]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_LANGINFO_H_DEFAULTS], - [ -- GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO]) - REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO]) ---- a/gnulib/m4/largefile.m4 -+++ b/gnulib/m4/largefile.m4 -@@ -22,7 +22,8 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE], - esac - ]) - --# The following implementation works around a problem in autoconf <= 2.69; -+# Work around a problem in Autoconf through at least 2.71 on glibc 2.34+ -+# with _TIME_BITS. Also, work around a problem in autoconf <= 2.69: - # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, - # or configures them incorrectly in some cases. - m4_version_prereq([2.70], [], [ -@@ -40,6 +41,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUD - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]];[]dnl - ]) -+])# m4_version_prereq 2.70 - - - # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, -@@ -54,7 +56,8 @@ m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE - [AC_LANG_PROGRAM([$5], [$6])], - [$3=no; break]) - m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( -- [AC_LANG_PROGRAM([#define $1 $2 -+ [AC_LANG_PROGRAM([#undef $1 -+#define $1 $2 - $5], [$6])], - [$3=$2; break]) - $3=unknown -@@ -80,9 +83,8 @@ rm -rf conftest*[]dnl - AC_DEFUN([AC_SYS_LARGEFILE], - [AC_ARG_ENABLE(largefile, - [ --disable-largefile omit support for large files]) --if test "$enable_largefile" != no; then -- -- AC_CACHE_CHECK([for special C compiler options needed for large files], -+AS_IF([test "$enable_largefile" != no], -+ [AC_CACHE_CHECK([for special C compiler options needed for large files], - ac_cv_sys_largefile_CC, - [ac_cv_sys_largefile_CC=no - if test "$GCC" != yes; then -@@ -107,15 +109,15 @@ if test "$enable_largefile" != no; then - ac_cv_sys_file_offset_bits, - [Number of bits in a file offset, on hosts where this is settable.], - [_AC_SYS_LARGEFILE_TEST_INCLUDES]) -- if test $ac_cv_sys_file_offset_bits = unknown; then -- _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, -- ac_cv_sys_large_files, -- [Define for large files, on AIX-style hosts.], -- [_AC_SYS_LARGEFILE_TEST_INCLUDES]) -- fi --fi -+ AS_CASE([$ac_cv_sys_file_offset_bits], -+ [unknown], -+ [_AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1], -+ [ac_cv_sys_large_files], -+ [Define for large files, on AIX-style hosts.], -+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])], -+ [64], -+ [gl_YEAR2038_BODY([])])]) - ])# AC_SYS_LARGEFILE --])# m4_version_prereq 2.70 - - # Enable large files on systems where this is implemented by Gnulib, not by the - # system headers. ---- a/gnulib/m4/locale_h.m4 -+++ b/gnulib/m4/locale_h.m4 -@@ -1,13 +1,13 @@ --# locale_h.m4 serial 25 -+# locale_h.m4 serial 28 - dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, - dnl with or without modifications, as long as this notice is preserved. - --AC_DEFUN([gl_LOCALE_H], -+AC_DEFUN_ONCE([gl_LOCALE_H], - [ -- dnl Use AC_REQUIRE here, so that the default behavior below is expanded -- dnl once only, before all statements that occur in other macros. -+ dnl Ensure to expand the default settings once only, before all statements -+ dnl that occur in other macros. - AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) - - dnl Persuade glibc to define locale_t and the int_p_*, int_n_* -@@ -129,22 +129,37 @@ AC_DEFUN([gl_LOCALE_T], - AC_SUBST([HAVE_XLOCALE_H]) - ]) - -+# gl_LOCALE_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_LOCALE_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_LOCALE_H_DEFAULTS], - [ -- GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV]) -- GNULIB_SETLOCALE=0; AC_SUBST([GNULIB_SETLOCALE]) -- GNULIB_SETLOCALE_NULL=0; AC_SUBST([GNULIB_SETLOCALE_NULL]) -- GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE]) -- GNULIB_LOCALENAME=0; AC_SUBST([GNULIB_LOCALENAME]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) - HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) ---- a/gnulib/m4/malloc.m4 -+++ b/gnulib/m4/malloc.m4 -@@ -1,21 +1,21 @@ --# malloc.m4 serial 22 -+# malloc.m4 serial 27 - dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, - dnl with or without modifications, as long as this notice is preserved. - - # This is adapted with modifications from upstream Autoconf here: --# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c -+# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 - AC_DEFUN([_AC_FUNC_MALLOC_IF], - [ - AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles -- AC_CACHE_CHECK([for GNU libc compatible malloc], -+ AC_CACHE_CHECK([whether malloc (0) returns nonnull], - [ac_cv_func_malloc_0_nonnull], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], -- [[char *p = malloc (0); -+ [[void *p = malloc (0); - int result = !p; - free (p); - return result;]]) -@@ -24,75 +24,151 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], - [ac_cv_func_malloc_0_nonnull=no], - [case "$host_os" in - # Guess yes on platforms where we know the result. -- *-gnu* | gnu* | *-musl* | freebsd* | midnightbsd* | netbsd* | openbsd* \ -- | hpux* | solaris* | cygwin* | mingw*) -+ *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ -+ | gnu* | *-musl* | midnightbsd* \ -+ | hpux* | solaris* | cygwin* | mingw* | msys* ) - ac_cv_func_malloc_0_nonnull="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; - esac - ]) - ]) -- case "$ac_cv_func_malloc_0_nonnull" in -- *yes) -- $1 -- ;; -- *) -- $2 -- ;; -- esac -+ AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) - ])# _AC_FUNC_MALLOC_IF - - # gl_FUNC_MALLOC_GNU - # ------------------ --# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if --# it is not. -+# Replace malloc if it is not compatible with GNU libc. - AC_DEFUN([gl_FUNC_MALLOC_GNU], - [ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -- dnl _AC_FUNC_MALLOC_IF is defined in Autoconf. -- _AC_FUNC_MALLOC_IF( -- [AC_DEFINE([HAVE_MALLOC_GNU], [1], -- [Define to 1 if your system has a GNU libc compatible 'malloc' -- function, and to 0 otherwise.])], -- [AC_DEFINE([HAVE_MALLOC_GNU], [0]) -- REPLACE_MALLOC=1 -+ AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) -+ if test $REPLACE_MALLOC = 0; then -+ _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC=1]) -+ fi -+]) -+ -+# gl_FUNC_MALLOC_PTRDIFF -+# ---------------------- -+# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, -+# and replace malloc otherwise. -+AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], -+[ -+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) -+ test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC=1 -+]) -+ -+# Test whether malloc, realloc, calloc refuse to create objects -+# larger than what can be expressed in ptrdiff_t. -+# Set gl_cv_func_malloc_gnu to yes or no accordingly. -+AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], -+[ -+ AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], -+ [gl_cv_malloc_ptrdiff], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ ]], -+ [[/* 64-bit ptrdiff_t is so wide that no practical platform -+ can exceed it. */ -+ #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0) -+ -+ /* On rare machines where size_t fits in ptrdiff_t there -+ is no problem. */ -+ #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX) -+ -+ /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t -+ bounds even on 32-bit platforms. We don't know which -+ non-glibc systems are safe. */ -+ #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__)) -+ -+ #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE -+ return 0; -+ #else -+ #error "malloc might not be ptrdiff_t safe" -+ syntax error -+ #endif -+ ]])], -+ [gl_cv_malloc_ptrdiff=yes], -+ [gl_cv_malloc_ptrdiff=no]) - ]) - ]) - - # gl_FUNC_MALLOC_POSIX - # -------------------- - # Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it --# fails), and replace malloc if it is not. -+# fails, and doesn't mess up with ptrdiff_t overflow), and replace -+# malloc if it is not. - AC_DEFUN([gl_FUNC_MALLOC_POSIX], - [ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) - AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) -- if test $gl_cv_func_malloc_posix = yes; then -+ if test "$gl_cv_func_malloc_posix" = yes; then - AC_DEFINE([HAVE_MALLOC_POSIX], [1], -- [Define if the 'malloc' function is POSIX compliant.]) -+ [Define if malloc, realloc, and calloc set errno on allocation failure.]) - else - REPLACE_MALLOC=1 - fi - ]) - --# Test whether malloc, realloc, calloc are POSIX compliant, -+# Test whether malloc, realloc, calloc set errno to ENOMEM on failure. - # Set gl_cv_func_malloc_posix to yes or no accordingly. - AC_DEFUN([gl_CHECK_MALLOC_POSIX], - [ -- AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], -+ AC_REQUIRE([AC_CANONICAL_HOST]) -+ AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], - [gl_cv_func_malloc_posix], - [ - dnl It is too dangerous to try to allocate a large amount of memory: - dnl some systems go to their knees when you do that. So assume that -- dnl all Unix implementations of the function are POSIX compliant. -- AC_COMPILE_IFELSE( -- [AC_LANG_PROGRAM( -- [[]], -- [[#if defined _WIN32 && ! defined __CYGWIN__ -- choke me -- #endif -- ]])], -- [gl_cv_func_malloc_posix=yes], -- [gl_cv_func_malloc_posix=no]) -+ dnl all Unix implementations of the function set errno on failure, -+ dnl except on those platforms where we have seen 'test-malloc-gnu', -+ dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. -+ case "$host_os" in -+ mingw*) -+ gl_cv_func_malloc_posix=no ;; -+ irix* | solaris*) -+ dnl On IRIX 6.5, the three functions return NULL with errno unset -+ dnl when the argument is larger than PTRDIFF_MAX. -+ dnl On Solaris 11.3, the three functions return NULL with errno set -+ dnl to EAGAIN, not ENOMEM, when the argument is larger than -+ dnl PTRDIFF_MAX. -+ dnl Here is a test program: -+m4_divert_push([KILL]) -+#include -+#include -+#include -+#define ptrdiff_t long -+#ifndef PTRDIFF_MAX -+# define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1)) -+#endif -+ -+int main () -+{ -+ void *p; -+ -+ fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX); -+ -+ errno = 0; -+ p = malloc ((unsigned long) PTRDIFF_MAX + 1); -+ fprintf (stderr, "p=%p errno=%d\n", p, errno); -+ -+ errno = 0; -+ p = calloc (PTRDIFF_MAX / 2 + 1, 2); -+ fprintf (stderr, "p=%p errno=%d\n", p, errno); -+ -+ errno = 0; -+ p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1); -+ fprintf (stderr, "p=%p errno=%d\n", p, errno); -+ -+ return 0; -+} -+m4_divert_pop([KILL]) -+ gl_cv_func_malloc_posix=no ;; -+ *) -+ gl_cv_func_malloc_posix=yes ;; -+ esac - ]) - ]) ---- a/gnulib/m4/mbslen.m4 -+++ b/gnulib/m4/mbslen.m4 -@@ -1,4 +1,4 @@ --# mbslen.m4 serial 2 -+# mbslen.m4 serial 3 - dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,7 +6,7 @@ dnl with or without modifications, as lo - - AC_DEFUN([gl_FUNC_MBSLEN], - [ -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_CHECK_FUNCS_ONCE([mbslen]) - if test $ac_cv_func_mbslen = yes; then - HAVE_MBSLEN=1 ---- a/gnulib/m4/memchr.m4 -+++ b/gnulib/m4/memchr.m4 -@@ -1,4 +1,4 @@ --# memchr.m4 serial 17 -+# memchr.m4 serial 18 - dnl Copyright (C) 2002-2004, 2009-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -13,7 +13,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], - AC_CHECK_HEADERS_ONCE([sys/mman.h]) - AC_CHECK_FUNCS_ONCE([mprotect]) - -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - # Detect platform-specific bugs in some versions of glibc: - # memchr should not dereference anything with length 0 - # https://bugzilla.redhat.com/show_bug.cgi?id=499689 ---- a/gnulib/m4/mempcpy.m4 -+++ b/gnulib/m4/mempcpy.m4 -@@ -1,4 +1,4 @@ --# mempcpy.m4 serial 11 -+# mempcpy.m4 serial 12 - dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software Foundation, - dnl Inc. - dnl This file is free software; the Free Software Foundation -@@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_MEMPCPY], - dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'. - AC_REQUIRE([AC_C_RESTRICT]) - -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_CHECK_FUNCS([mempcpy]) - if test $ac_cv_func_mempcpy = no; then - HAVE_MEMPCPY=0 ---- a/gnulib/m4/memrchr.m4 -+++ b/gnulib/m4/memrchr.m4 -@@ -1,4 +1,4 @@ --# memrchr.m4 serial 10 -+# memrchr.m4 serial 11 - dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, - dnl Inc. - dnl This file is free software; the Free Software Foundation -@@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_MEMRCHR], - dnl Persuade glibc to declare memrchr(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_CHECK_DECLS_ONCE([memrchr]) - if test $ac_cv_have_decl_memrchr = no; then - HAVE_DECL_MEMRCHR=0 ---- /dev/null -+++ b/gnulib/m4/minmax.m4 -@@ -0,0 +1,44 @@ -+# minmax.m4 serial 4 -+dnl Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_PREREQ([2.53]) -+ -+AC_DEFUN([gl_MINMAX], -+[ -+ AC_REQUIRE([gl_PREREQ_MINMAX]) -+]) -+ -+# Prerequisites of lib/minmax.h. -+AC_DEFUN([gl_PREREQ_MINMAX], -+[ -+ gl_MINMAX_IN_HEADER([limits.h]) -+ gl_MINMAX_IN_HEADER([sys/param.h]) -+]) -+ -+dnl gl_MINMAX_IN_HEADER(HEADER) -+dnl The parameter has to be a literal header name; it cannot be macro, -+dnl nor a shell variable. (Because autoheader collects only AC_DEFINE -+dnl invocations with a literal macro name.) -+AC_DEFUN([gl_MINMAX_IN_HEADER], -+[ -+ m4_pushdef([header], AS_TR_SH([$1])) -+ m4_pushdef([HEADER], AS_TR_CPP([$1])) -+ AC_CACHE_CHECK([whether <$1> defines MIN and MAX], -+ [gl_cv_minmax_in_]header, -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include <$1> -+ int x = MIN (42, 17);]], -+ [[]])], -+ [gl_cv_minmax_in_]header[=yes], -+ [gl_cv_minmax_in_]header[=no])]) -+ if test $gl_cv_minmax_in_[]header = yes; then -+ AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1, -+ [Define to 1 if <$1> defines the MIN and MAX macros.]) -+ fi -+ m4_popdef([HEADER]) -+ m4_popdef([header]) -+]) ---- a/gnulib/m4/printf.m4 -+++ b/gnulib/m4/printf.m4 -@@ -1,4 +1,4 @@ --# printf.m4 serial 72 -+# printf.m4 serial 73 - dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -537,7 +537,7 @@ int main () - && strcmp (buf, "-0X6.488P-1 33") != 0 - && strcmp (buf, "-0XC.91P-2 33") != 0)) - result |= 2; -- /* This catches a FreeBSD 6.1 bug: it doesn't round. */ -+ /* This catches a FreeBSD 13.0 bug: it doesn't round. */ - if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.83p+0 33") != 0 - && strcmp (buf, "0x3.05p-1 33") != 0 -@@ -1690,6 +1690,7 @@ dnl - dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . - dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . -+dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . . - dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . - dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . . - dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . ---- /dev/null -+++ b/gnulib/m4/realloc.m4 -@@ -0,0 +1,63 @@ -+# realloc.m4 serial 24 -+dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+# This is adapted with modifications from upstream Autoconf here: -+# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 -+AC_DEFUN([_AC_FUNC_REALLOC_IF], -+[ -+ AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles -+ AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], -+ [ac_cv_func_realloc_0_nonnull], -+ [AC_RUN_IFELSE( -+ [AC_LANG_PROGRAM( -+ [[#include -+ ]], -+ [[void *p = realloc (0, 0); -+ int result = !p; -+ free (p); -+ return result;]]) -+ ], -+ [ac_cv_func_realloc_0_nonnull=yes], -+ [ac_cv_func_realloc_0_nonnull=no], -+ [case "$host_os" in -+ # Guess yes on platforms where we know the result. -+ *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ -+ | gnu* | *-musl* | midnightbsd* \ -+ | hpux* | solaris* | cygwin* | mingw* | msys* ) -+ ac_cv_func_realloc_0_nonnull="guessing yes" ;; -+ # If we don't know, obey --enable-cross-guesses. -+ *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; -+ esac -+ ]) -+ ]) -+ AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2]) -+])# AC_FUNC_REALLOC -+ -+# gl_FUNC_REALLOC_GNU -+# ------------------- -+# Replace realloc if it is not compatible with GNU libc. -+AC_DEFUN([gl_FUNC_REALLOC_GNU], -+[ -+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) -+ if test $REPLACE_REALLOC = 0; then -+ _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC=1]) -+ fi -+])# gl_FUNC_REALLOC_GNU -+ -+# gl_FUNC_REALLOC_POSIX -+# --------------------- -+# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it -+# fails, and doesn't mess up with ptrdiff_t overflow), -+# and replace realloc if it is not. -+AC_DEFUN([gl_FUNC_REALLOC_POSIX], -+[ -+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) -+ if test $REPLACE_MALLOC = 1; then -+ REPLACE_REALLOC=1 -+ fi -+]) ---- /dev/null -+++ b/gnulib/m4/reallocarray.m4 -@@ -0,0 +1,23 @@ -+# reallocarray.m4 serial 3 -+dnl Copyright (C) 2017-2021 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+AC_DEFUN([gl_FUNC_REALLOCARRAY], -+[ -+ dnl Persuade glibc to declare reallocarray. -+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) -+ -+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) -+ AC_CHECK_FUNCS([reallocarray]) -+ if test "$ac_cv_func_reallocarray" = no; then -+ HAVE_REALLOCARRAY=0 -+ elif test "$gl_cv_malloc_ptrdiff" = no; then -+ REPLACE_REALLOCARRAY=1 -+ fi -+]) -+ -+# Prerequisites of lib/reallocarray.c. -+AC_DEFUN([gl_PREREQ_REALLOCARRAY], [:]) ---- a/gnulib/m4/stat.m4 -+++ b/gnulib/m4/stat.m4 -@@ -1,4 +1,4 @@ --# serial 17 -+# serial 18 - - # Copyright (C) 2009-2021 Free Software Foundation, Inc. - # -@@ -69,7 +69,7 @@ AC_DEFUN([gl_FUNC_STAT], - - # Prerequisites of lib/stat.c and lib/stat-w32.c. - AC_DEFUN([gl_PREREQ_STAT], [ -- AC_REQUIRE([gl_HEADER_SYS_STAT_H]) -+ AC_REQUIRE([gl_SYS_STAT_H]) - AC_REQUIRE([gl_PREREQ_STAT_W32]) - : - ]) ---- a/gnulib/m4/stddef_h.m4 -+++ b/gnulib/m4/stddef_h.m4 -@@ -1,4 +1,4 @@ --# stddef_h.m4 serial 9 -+# stddef_h.m4 serial 11 - dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,7 +6,7 @@ dnl with or without modifications, as lo - - dnl A placeholder for , for platforms that have issues. - --AC_DEFUN([gl_STDDEF_H], -+AC_DEFUN_ONCE([gl_STDDEF_H], - [ - AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) -@@ -68,13 +68,28 @@ AC_DEFUN([gl_STDDEF_H], - fi - ]) - -+# gl_STDDEF_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_STDDEF_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS], [ -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_STDDEF_H_DEFAULTS], - [ - dnl Assume proper GNU behavior unless another module says otherwise. ---- a/gnulib/m4/stdint.m4 -+++ b/gnulib/m4/stdint.m4 -@@ -1,4 +1,4 @@ --# stdint.m4 serial 58 -+# stdint.m4 serial 60 - dnl Copyright (C) 2001-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -170,7 +170,7 @@ struct s { - PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) - && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) - ? 1 : -1; -- /* Detect bug in FreeBSD 6.0 / ia64. */ -+ /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ - int check_SIG_ATOMIC: - SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) - && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) -@@ -527,7 +527,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], - dnl requirement that wint_t is "unchanged by default argument promotions". - dnl In this case gnulib's and override wint_t. - dnl Set the variable BITSIZEOF_WINT_T accordingly. -- if test $GNULIB_OVERRIDES_WINT_T = 1; then -+ if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then - BITSIZEOF_WINT_T=32 - fi - ]) ---- a/gnulib/m4/stdio_h.m4 -+++ b/gnulib/m4/stdio_h.m4 -@@ -1,11 +1,12 @@ --# stdio_h.m4 serial 52 -+# stdio_h.m4 serial 56 - dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, - dnl with or without modifications, as long as this notice is preserved. - --AC_DEFUN([gl_STDIO_H], -+AC_DEFUN_ONCE([gl_STDIO_H], - [ -+ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AH_VERBATIM([MINGW_ANSI_STDIO], - [/* Use GNU style printf and scanf. */ - #ifndef __USE_MINGW_ANSI_STDIO -@@ -13,7 +14,6 @@ AC_DEFUN([gl_STDIO_H], - #endif - ]) - AC_DEFINE([__USE_MINGW_ANSI_STDIO]) -- AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - gl_NEXT_HEADERS([stdio.h]) - - dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and -@@ -40,17 +40,6 @@ AC_DEFUN([gl_STDIO_H], - attribute "__gnu_printf__" instead of "__printf__"]) - fi - -- dnl No need to create extra modules for these functions. Everyone who uses -- dnl likely needs them. -- GNULIB_FSCANF=1 -- gl_MODULE_INDICATOR([fscanf]) -- GNULIB_SCANF=1 -- gl_MODULE_INDICATOR([scanf]) -- GNULIB_FGETC=1 -- GNULIB_GETC=1 -- GNULIB_GETCHAR=1 -- GNULIB_FGETS=1 -- GNULIB_FREAD=1 - dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" - dnl "expected source file, required through AC_LIBSOURCES, not found". It is - dnl also an optimization, to avoid performing a configure check whose result -@@ -64,18 +53,6 @@ AC_DEFUN([gl_STDIO_H], - fi - ]) - -- dnl No need to create extra modules for these functions. Everyone who uses -- dnl likely needs them. -- GNULIB_FPRINTF=1 -- GNULIB_PRINTF=1 -- GNULIB_VFPRINTF=1 -- GNULIB_VPRINTF=1 -- GNULIB_FPUTC=1 -- GNULIB_PUTC=1 -- GNULIB_PUTCHAR=1 -- GNULIB_FPUTS=1 -- GNULIB_PUTS=1 -- GNULIB_FWRITE=1 - dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" - dnl "expected source file, required through AC_LIBSOURCES, not found". It is - dnl also an optimization, to avoid performing a configure check whose result -@@ -116,77 +93,92 @@ AC_DEFUN([gl_STDIO_H], - fi - ]) - -+# gl_STDIO_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_STDIO_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_STDIO_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_STDIO_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREAD]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREOPEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSCANF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEKO]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTCHAR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMOVE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) -+ dnl Support Microsoft deprecated alias function names by default. -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FILENO], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETW], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTW], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_STDIO_H_DEFAULTS], - [ -- GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) -- GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) -- GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN]) -- GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) -- GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC]) -- GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS]) -- GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) -- GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) -- GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) -- GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) -- GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) -- GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) -- GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD]) -- GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) -- GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF]) -- GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) -- GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) -- GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) -- GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) -- GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) -- GNULIB_GETC=0; AC_SUBST([GNULIB_GETC]) -- GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR]) -- GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) -- GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) -- GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) -- GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) -- GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE]) -- GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) -- GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) -- GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) -- GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) -- GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) -- GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) -- GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) -- GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) -- GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) -- GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) -- GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF]) -- GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) -- GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) -- GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING]) -- GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) -- GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) -- GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) -- GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF]) -- GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF]) -- GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) -- GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) -- GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) -- GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) -- GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) -- GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) -- GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) -- dnl Support Microsoft deprecated alias function names by default. -- GNULIB_MDA_FCLOSEALL=1; AC_SUBST([GNULIB_MDA_FCLOSEALL]) -- GNULIB_MDA_FDOPEN=1; AC_SUBST([GNULIB_MDA_FDOPEN]) -- GNULIB_MDA_FILENO=1; AC_SUBST([GNULIB_MDA_FILENO]) -- GNULIB_MDA_GETW=1; AC_SUBST([GNULIB_MDA_GETW]) -- GNULIB_MDA_PUTW=1; AC_SUBST([GNULIB_MDA_PUTW]) -- GNULIB_MDA_TEMPNAM=1; AC_SUBST([GNULIB_MDA_TEMPNAM]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_DECL_FCLOSEALL=1; AC_SUBST([HAVE_DECL_FCLOSEALL]) - HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) ---- a/gnulib/m4/stdlib_h.m4 -+++ b/gnulib/m4/stdlib_h.m4 -@@ -1,10 +1,10 @@ --# stdlib_h.m4 serial 55 -+# stdlib_h.m4 serial 63 - dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, - dnl with or without modifications, as long as this notice is preserved. - --AC_DEFUN([gl_STDLIB_H], -+AC_DEFUN_ONCE([gl_STDLIB_H], - [ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - gl_NEXT_HEADERS([stdlib.h]) -@@ -28,7 +28,7 @@ AC_DEFUN([gl_STDLIB_H], - posix_memalign posix_openpt ptsname ptsname_r qsort_r - random random_r reallocarray realpath rpmatch secure_getenv setenv - setstate setstate_r srandom srandom_r -- strtod strtold strtoll strtoull unlockpt unsetenv]) -+ strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) - - AC_REQUIRE([AC_C_RESTRICT]) - -@@ -46,61 +46,78 @@ AC_DEFUN([gl_STDLIB_H], - fi - ]) - -+# gl_STDLIB_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_STDLIB_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMPS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMPS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_MEMALIGN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_OPENPT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOULL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYSTEM_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLOCKPT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNSETENV]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOMB]) -+ dnl Support Microsoft deprecated alias function names by default. -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ECVT], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCVT], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GCVT], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKTEMP], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTENV], [1]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_STDLIB_H_DEFAULTS], - [ -- GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) -- GNULIB_ALIGNED_ALLOC=0; AC_SUBST([GNULIB_ALIGNED_ALLOC]) -- GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) -- GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) -- GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) -- GNULIB_FREE_POSIX=0; AC_SUBST([GNULIB_FREE_POSIX]) -- GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) -- GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) -- GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) -- GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) -- GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) -- GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) -- GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) -- GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) -- GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) -- GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) -- GNULIB_POSIX_MEMALIGN=0;AC_SUBST([GNULIB_POSIX_MEMALIGN]) -- GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT]) -- GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) -- GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) -- GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) -- GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R]) -- GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) -- GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) -- GNULIB_REALLOCARRAY=0; AC_SUBST([GNULIB_REALLOCARRAY]) -- GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) -- GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) -- GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) -- GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) -- GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) -- GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) -- GNULIB_STRTOLD=0; AC_SUBST([GNULIB_STRTOLD]) -- GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) -- GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) -- GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) -- GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) -- GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) -- GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) -- dnl Support Microsoft deprecated alias function names by default. -- GNULIB_MDA_ECVT=1; AC_SUBST([GNULIB_MDA_ECVT]) -- GNULIB_MDA_FCVT=1; AC_SUBST([GNULIB_MDA_FCVT]) -- GNULIB_MDA_GCVT=1; AC_SUBST([GNULIB_MDA_GCVT]) -- GNULIB_MDA_MKTEMP=1; AC_SUBST([GNULIB_MDA_MKTEMP]) -- GNULIB_MDA_PUTENV=1; AC_SUBST([GNULIB_MDA_PUTENV]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) - HAVE_ALIGNED_ALLOC=1; AC_SUBST([HAVE_ALIGNED_ALLOC]) -@@ -137,8 +154,10 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], - HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) - HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) - HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) -+ HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) - HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) - HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) -+ HAVE_STRTOUL=1; AC_SUBST([HAVE_STRTOUL]) - HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) - HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) - HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) -@@ -160,11 +179,16 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], - REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) - REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) - REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) -+ REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) - REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) - REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) - REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) - REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) -+ REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) - REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) -+ REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) -+ REPLACE_STRTOUL=0; AC_SUBST([REPLACE_STRTOUL]) -+ REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) - REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) - REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) - ]) ---- a/gnulib/m4/stpcpy.m4 -+++ b/gnulib/m4/stpcpy.m4 -@@ -1,4 +1,4 @@ --# stpcpy.m4 serial 8 -+# stpcpy.m4 serial 9 - dnl Copyright (C) 2002, 2007, 2009-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -12,7 +12,7 @@ AC_DEFUN([gl_FUNC_STPCPY], - dnl The stpcpy() declaration in lib/string.in.h uses 'restrict'. - AC_REQUIRE([AC_C_RESTRICT]) - -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_CHECK_FUNCS([stpcpy]) - if test $ac_cv_func_stpcpy = no; then - HAVE_STPCPY=0 ---- a/gnulib/m4/strcase.m4 -+++ b/gnulib/m4/strcase.m4 -@@ -1,4 +1,4 @@ --# strcase.m4 serial 11 -+# strcase.m4 serial 12 - dnl Copyright (C) 2002, 2005-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -12,7 +12,7 @@ AC_DEFUN([gl_STRCASE], - - AC_DEFUN([gl_FUNC_STRCASECMP], - [ -- AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) - AC_CHECK_FUNCS([strcasecmp]) - if test $ac_cv_func_strcasecmp = no; then - HAVE_STRCASECMP=0 -@@ -21,7 +21,7 @@ AC_DEFUN([gl_FUNC_STRCASECMP], - - AC_DEFUN([gl_FUNC_STRNCASECMP], - [ -- AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) - AC_CHECK_FUNCS([strncasecmp]) - if test $ac_cv_func_strncasecmp = yes; then - HAVE_STRNCASECMP=1 ---- a/gnulib/m4/strcasestr.m4 -+++ b/gnulib/m4/strcasestr.m4 -@@ -1,4 +1,4 @@ --# strcasestr.m4 serial 26 -+# strcasestr.m4 serial 27 - dnl Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -7,7 +7,7 @@ dnl with or without modifications, as lo - dnl Check that strcasestr is present and works. - AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], - [ -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - - dnl Persuade glibc to declare strcasestr(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ---- a/gnulib/m4/strdup.m4 -+++ b/gnulib/m4/strdup.m4 -@@ -1,4 +1,4 @@ --# strdup.m4 serial 14 -+# strdup.m4 serial 15 - - dnl Copyright (C) 2002-2021 Free Software Foundation, Inc. - -@@ -8,7 +8,7 @@ dnl with or without modifications, as lo - - AC_DEFUN([gl_FUNC_STRDUP], - [ -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_CHECK_DECLS_ONCE([strdup]) - if test $ac_cv_have_decl_strdup = no; then - HAVE_DECL_STRDUP=0 -@@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_STRDUP], - - AC_DEFUN([gl_FUNC_STRDUP_POSIX], - [ -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test $gl_cv_func_malloc_posix != yes; then - REPLACE_STRDUP=1 ---- a/gnulib/m4/strerror.m4 -+++ b/gnulib/m4/strerror.m4 -@@ -1,4 +1,4 @@ --# strerror.m4 serial 21 -+# strerror.m4 serial 22 - dnl Copyright (C) 2002, 2007-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,7 +6,7 @@ dnl with or without modifications, as lo - - AC_DEFUN([gl_FUNC_STRERROR], - [ -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_REQUIRE([gl_HEADER_ERRNO_H]) - AC_REQUIRE([gl_FUNC_STRERROR_0]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ---- a/gnulib/m4/string_h.m4 -+++ b/gnulib/m4/string_h.m4 -@@ -5,20 +5,15 @@ - # gives unlimited permission to copy and/or distribute it, - # with or without modifications, as long as this notice is preserved. - --# serial 29 -+# serial 32 - - # Written by Paul Eggert. - --AC_DEFUN([gl_HEADER_STRING_H], -+AC_DEFUN_ONCE([gl_STRING_H], - [ -- dnl Use AC_REQUIRE here, so that the default behavior below is expanded -- dnl once only, before all statements that occur in other macros. -- AC_REQUIRE([gl_HEADER_STRING_H_BODY]) --]) -- --AC_DEFUN([gl_HEADER_STRING_H_BODY], --[ -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only, before all statements -+ dnl that occur in other macros. -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - gl_NEXT_HEADERS([string.h]) - - dnl Check for declarations of anything we want to poison if the -@@ -33,62 +28,77 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], - AC_REQUIRE([AC_C_RESTRICT]) - ]) - -+# gl_STRING_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_STRING_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_STRING_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - --AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP]) -+ dnl Support Microsoft deprecated alias function names by default. -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) -+]) -+ -+AC_DEFUN([gl_STRING_H_DEFAULTS], - [ -- GNULIB_EXPLICIT_BZERO=0; AC_SUBST([GNULIB_EXPLICIT_BZERO]) -- GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) -- GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) -- GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) -- GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) -- GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) -- GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) -- GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) -- GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) -- GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) -- GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) -- GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) -- GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) -- GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) -- GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) -- GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) -- GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) -- GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) -- GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) -- GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) -- GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) -- GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) -- GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) -- GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) -- GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) -- GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) -- GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) -- GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) -- GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) -- GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) -- GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) -- GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) -- GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) -- GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) -- GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) -- GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R]) -- GNULIB_STRERRORNAME_NP=0; AC_SUBST([GNULIB_STRERRORNAME_NP]) -- GNULIB_SIGABBREV_NP=0; AC_SUBST([GNULIB_SIGABBREV_NP]) -- GNULIB_SIGDESCR_NP=0; AC_SUBST([GNULIB_SIGDESCR_NP]) -- GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) -- GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) - HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) -- dnl Support Microsoft deprecated alias function names by default. -- GNULIB_MDA_MEMCCPY=1; AC_SUBST([GNULIB_MDA_MEMCCPY]) -- GNULIB_MDA_STRDUP=1; AC_SUBST([GNULIB_MDA_STRDUP]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) - HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) ---- a/gnulib/m4/strings_h.m4 -+++ b/gnulib/m4/strings_h.m4 -@@ -1,21 +1,16 @@ - # Configure a replacement for . --# serial 6 -+# serial 9 - - # Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. - # This file is free software; the Free Software Foundation - # gives unlimited permission to copy and/or distribute it, - # with or without modifications, as long as this notice is preserved. - --AC_DEFUN([gl_HEADER_STRINGS_H], -+AC_DEFUN_ONCE([gl_STRINGS_H], - [ -- dnl Use AC_REQUIRE here, so that the default behavior below is expanded -- dnl once only, before all statements that occur in other macros. -- AC_REQUIRE([gl_HEADER_STRINGS_H_BODY]) --]) -- --AC_DEFUN([gl_HEADER_STRINGS_H_BODY], --[ -- AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only, before all statements -+ dnl that occur in other macros. -+ AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) - - gl_CHECK_NEXT_HEADERS([strings.h]) - if test $ac_cv_header_strings_h = yes; then -@@ -35,16 +30,31 @@ AC_DEFUN([gl_HEADER_STRINGS_H_BODY], - ]], [ffs strcasecmp strncasecmp]) - ]) - -+# gl_STRINGS_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_STRINGS_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_STRINGS_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - ]) - --AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS], -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) -+]) -+ -+AC_DEFUN([gl_STRINGS_H_DEFAULTS], - [ -- GNULIB_FFS=0; AC_SUBST([GNULIB_FFS]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_FFS=1; AC_SUBST([HAVE_FFS]) - HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) ---- a/gnulib/m4/strndup.m4 -+++ b/gnulib/m4/strndup.m4 -@@ -1,4 +1,4 @@ --# strndup.m4 serial 22 -+# strndup.m4 serial 23 - dnl Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_STRNDUP], - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_CHECK_DECLS_ONCE([strndup]) - AC_CHECK_FUNCS_ONCE([strndup]) - if test $ac_cv_have_decl_strndup = no; then ---- a/gnulib/m4/strnlen.m4 -+++ b/gnulib/m4/strnlen.m4 -@@ -1,4 +1,4 @@ --# strnlen.m4 serial 13 -+# strnlen.m4 serial 14 - dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, - dnl Inc. - dnl This file is free software; the Free Software Foundation -@@ -7,7 +7,7 @@ dnl with or without modifications, as lo - - AC_DEFUN([gl_FUNC_STRNLEN], - [ -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - - dnl Persuade glibc to declare strnlen(). - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ---- a/gnulib/m4/strstr.m4 -+++ b/gnulib/m4/strstr.m4 -@@ -1,4 +1,4 @@ --# strstr.m4 serial 22 -+# strstr.m4 serial 23 - dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -7,7 +7,7 @@ dnl with or without modifications, as lo - dnl Check that strstr works. - AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], - [ -- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) -+ AC_REQUIRE([gl_STRING_H_DEFAULTS]) - AC_REQUIRE([gl_FUNC_MEMCHR]) - if test $REPLACE_MEMCHR = 1; then - REPLACE_STRSTR=1 ---- a/gnulib/m4/sys_socket_h.m4 -+++ b/gnulib/m4/sys_socket_h.m4 -@@ -1,4 +1,4 @@ --# sys_socket_h.m4 serial 25 -+# sys_socket_h.m4 serial 28 - dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,7 +6,7 @@ dnl with or without modifications, as lo - - dnl From Simon Josefsson. - --AC_DEFUN([gl_HEADER_SYS_SOCKET], -+AC_DEFUN_ONCE([gl_SYS_SOCKET_H], - [ - AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) - AC_REQUIRE([AC_CANONICAL_HOST]) -@@ -156,32 +156,47 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], - AC_SUBST([HAVE_WS2TCPIP_H]) - ]) - -+# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_SYS_SOCKET_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], - [ -- GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) -- GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) -- GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) -- GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) -- GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) -- GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) -- GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) -- GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) -- GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) -- GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) -- GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) -- GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) -- GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) -- GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) -- GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) - HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) - HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; - AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) ---- a/gnulib/m4/sys_stat_h.m4 -+++ b/gnulib/m4/sys_stat_h.m4 -@@ -1,4 +1,4 @@ --# sys_stat_h.m4 serial 38 -*- Autoconf -*- -+# sys_stat_h.m4 serial 41 -*- Autoconf -*- - dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -7,7 +7,7 @@ dnl with or without modifications, as lo - dnl From Eric Blake. - dnl Provide a GNU-like . - --AC_DEFUN([gl_HEADER_SYS_STAT_H], -+AC_DEFUN_ONCE([gl_SYS_STAT_H], - [ - AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) - -@@ -52,38 +52,53 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], - AC_REQUIRE([AC_C_RESTRICT]) - ]) - -+# gl_SYS_STAT_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_SYS_STAT_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT]) -+ dnl Support Microsoft deprecated alias function names by default. -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], - [ -- AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR -- GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) -- GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT]) -- GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) -- GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) -- GNULIB_GETUMASK=0; AC_SUBST([GNULIB_GETUMASK]) -- GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) -- GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) -- GNULIB_MKDIR=0; AC_SUBST([GNULIB_MKDIR]) -- GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) -- GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) -- GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) -- GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) -- GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) -- GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) -- GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) -- GNULIB_OVERRIDES_STRUCT_STAT=0; AC_SUBST([GNULIB_OVERRIDES_STRUCT_STAT]) -- dnl Support Microsoft deprecated alias function names by default. -- GNULIB_MDA_CHMOD=1; AC_SUBST([GNULIB_MDA_CHMOD]) -- GNULIB_MDA_MKDIR=1; AC_SUBST([GNULIB_MDA_MKDIR]) -- GNULIB_MDA_UMASK=1; AC_SUBST([GNULIB_MDA_UMASK]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) - HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) ---- a/gnulib/m4/sys_types_h.m4 -+++ b/gnulib/m4/sys_types_h.m4 -@@ -1,4 +1,4 @@ --# sys_types_h.m4 serial 11 -+# sys_types_h.m4 serial 13 - dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,10 +6,11 @@ dnl with or without modifications, as lo - - AC_DEFUN_ONCE([gl_SYS_TYPES_H], - [ -+ AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) -+ - dnl Use sane struct stat types in OpenVMS 8.2 and later. - AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) - -- AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) - gl_NEXT_HEADERS([sys/types.h]) - - dnl Ensure the type pid_t gets defined. -@@ -30,6 +31,17 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], - AC_SUBST([WINDOWS_STAT_INODES]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [ -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], - [ - ]) ---- a/gnulib/m4/time_h.m4 -+++ b/gnulib/m4/time_h.m4 -@@ -2,7 +2,7 @@ - - # Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc. - --# serial 15 -+# serial 18 - - # This file is free software; the Free Software Foundation - # gives unlimited permission to copy and/or distribute it, -@@ -10,16 +10,11 @@ - - # Written by Paul Eggert and Jim Meyering. - --AC_DEFUN([gl_HEADER_TIME_H], -+AC_DEFUN_ONCE([gl_TIME_H], - [ -- dnl Use AC_REQUIRE here, so that the default behavior below is expanded -- dnl once only, before all statements that occur in other macros. -- AC_REQUIRE([gl_HEADER_TIME_H_BODY]) --]) -- --AC_DEFUN([gl_HEADER_TIME_H_BODY], --[ -- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only, before all statements -+ dnl that occur in other macros. -+ AC_REQUIRE([gl_TIME_H_DEFAULTS]) - - gl_NEXT_HEADERS([time.h]) - AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) -@@ -111,30 +106,45 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC] - AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC]) - ]) - -+# gl_TIME_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_TIME_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_TIME_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - --AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CTIME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKTIME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALTIME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) -+ dnl Support Microsoft deprecated alias function names by default. -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_TIME_H_DEFAULTS]) -+]) -+ -+AC_DEFUN([gl_TIME_H_DEFAULTS], - [ -- GNULIB_CTIME=0; AC_SUBST([GNULIB_CTIME]) -- GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME]) -- GNULIB_LOCALTIME=0; AC_SUBST([GNULIB_LOCALTIME]) -- GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP]) -- GNULIB_STRFTIME=0; AC_SUBST([GNULIB_STRFTIME]) -- GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) -- GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) -- GNULIB_TIMESPEC_GET=0; AC_SUBST([GNULIB_TIMESPEC_GET]) -- GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) -- GNULIB_TIME_RZ=0; AC_SUBST([GNULIB_TIME_RZ]) -- GNULIB_TZSET=0; AC_SUBST([GNULIB_TZSET]) -- dnl Support Microsoft deprecated alias function names by default. -- GNULIB_MDA_TZSET=1; AC_SUBST([GNULIB_MDA_TZSET]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) - HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) ---- a/gnulib/m4/unistd_h.m4 -+++ b/gnulib/m4/unistd_h.m4 -@@ -1,4 +1,4 @@ --# unistd_h.m4 serial 85 -+# unistd_h.m4 serial 89 - dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -6,10 +6,10 @@ dnl with or without modifications, as lo - - dnl Written by Simon Josefsson, Bruno Haible. - --AC_DEFUN([gl_UNISTD_H], -+AC_DEFUN_ONCE([gl_UNISTD_H], - [ -- dnl Use AC_REQUIRE here, so that the default behavior below is expanded -- dnl once only, before all statements that occur in other macros. -+ dnl Ensure to expand the default settings once only, before all statements -+ dnl that occur in other macros. - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - - gl_CHECK_NEXT_HEADERS([unistd.h]) -@@ -59,100 +59,116 @@ AC_DEFUN([gl_UNISTD_H], - fi - ]) - -+# gl_UNISTD_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_UNISTD_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCESS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHDIR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHOWN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPY_FILE_RANGE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP2]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP3]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ENVIRON]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EUIDACCESS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECV]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVPE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FACCESSAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHDIR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHOWNAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDATASYNC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSYNC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTRUNCATE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCWD]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDOMAINNAME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDTABLESIZE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETENTROPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETGROUPS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETHOSTNAME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHOWN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINKAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSEEK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE2]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PREAD]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PWRITE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READ]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINKAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RMDIR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETHOSTNAME]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SLEEP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINKAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCATE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TTYNAME_R]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_NONBLOCKING]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_SIGPIPE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINKAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_USLEEP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WRITE]) -+ dnl Support Microsoft deprecated alias function names by default. -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ACCESS], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHDIR], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CLOSE], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP2], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECL], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLE], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLP], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECV], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVE], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVP], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVPE], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETCWD], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETPID], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ISATTY], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEEK], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_READ], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_RMDIR], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_SWAB], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UNLINK], [1]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WRITE], [1]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_UNISTD_H_DEFAULTS], - [ -- GNULIB_ACCESS=0; AC_SUBST([GNULIB_ACCESS]) -- GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) -- GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) -- GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) -- GNULIB_COPY_FILE_RANGE=0; AC_SUBST([GNULIB_COPY_FILE_RANGE]) -- GNULIB_DUP=0; AC_SUBST([GNULIB_DUP]) -- GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) -- GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) -- GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) -- GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) -- GNULIB_EXECL=0; AC_SUBST([GNULIB_EXECL]) -- GNULIB_EXECLE=0; AC_SUBST([GNULIB_EXECLE]) -- GNULIB_EXECLP=0; AC_SUBST([GNULIB_EXECLP]) -- GNULIB_EXECV=0; AC_SUBST([GNULIB_EXECV]) -- GNULIB_EXECVE=0; AC_SUBST([GNULIB_EXECVE]) -- GNULIB_EXECVP=0; AC_SUBST([GNULIB_EXECVP]) -- GNULIB_EXECVPE=0; AC_SUBST([GNULIB_EXECVPE]) -- GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) -- GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) -- GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) -- GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC]) -- GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) -- GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) -- GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) -- GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) -- GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) -- GNULIB_GETENTROPY=0; AC_SUBST([GNULIB_GETENTROPY]) -- GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) -- GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) -- GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) -- GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) -- GNULIB_GETOPT_POSIX=0; AC_SUBST([GNULIB_GETOPT_POSIX]) -- GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) -- GNULIB_GETPASS=0; AC_SUBST([GNULIB_GETPASS]) -- GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) -- GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) -- GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY]) -- GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) -- GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) -- GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) -- GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) -- GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) -- GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) -- GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) -- GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) -- GNULIB_READ=0; AC_SUBST([GNULIB_READ]) -- GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) -- GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) -- GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) -- GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME]) -- GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) -- GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) -- GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) -- GNULIB_TRUNCATE=0; AC_SUBST([GNULIB_TRUNCATE]) -- GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) -- GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) -- GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) -- GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) -- GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) -- GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) -- GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) -- dnl Support Microsoft deprecated alias function names by default. -- GNULIB_MDA_ACCESS=1; AC_SUBST([GNULIB_MDA_ACCESS]) -- GNULIB_MDA_CHDIR=1; AC_SUBST([GNULIB_MDA_CHDIR]) -- GNULIB_MDA_CLOSE=1; AC_SUBST([GNULIB_MDA_CLOSE]) -- GNULIB_MDA_DUP=1; AC_SUBST([GNULIB_MDA_DUP]) -- GNULIB_MDA_DUP2=1; AC_SUBST([GNULIB_MDA_DUP2]) -- GNULIB_MDA_EXECL=1; AC_SUBST([GNULIB_MDA_EXECL]) -- GNULIB_MDA_EXECLE=1; AC_SUBST([GNULIB_MDA_EXECLE]) -- GNULIB_MDA_EXECLP=1; AC_SUBST([GNULIB_MDA_EXECLP]) -- GNULIB_MDA_EXECV=1; AC_SUBST([GNULIB_MDA_EXECV]) -- GNULIB_MDA_EXECVE=1; AC_SUBST([GNULIB_MDA_EXECVE]) -- GNULIB_MDA_EXECVP=1; AC_SUBST([GNULIB_MDA_EXECVP]) -- GNULIB_MDA_EXECVPE=1; AC_SUBST([GNULIB_MDA_EXECVPE]) -- GNULIB_MDA_GETCWD=1; AC_SUBST([GNULIB_MDA_GETCWD]) -- GNULIB_MDA_GETPID=1; AC_SUBST([GNULIB_MDA_GETPID]) -- GNULIB_MDA_ISATTY=1; AC_SUBST([GNULIB_MDA_ISATTY]) -- GNULIB_MDA_LSEEK=1; AC_SUBST([GNULIB_MDA_LSEEK]) -- GNULIB_MDA_READ=1; AC_SUBST([GNULIB_MDA_READ]) -- GNULIB_MDA_RMDIR=1; AC_SUBST([GNULIB_MDA_RMDIR]) -- GNULIB_MDA_SWAB=1; AC_SUBST([GNULIB_MDA_SWAB]) -- GNULIB_MDA_UNLINK=1; AC_SUBST([GNULIB_MDA_UNLINK]) -- GNULIB_MDA_WRITE=1; AC_SUBST([GNULIB_MDA_WRITE]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) - HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) ---- a/gnulib/m4/visibility.m4 -+++ b/gnulib/m4/visibility.m4 -@@ -1,4 +1,4 @@ --# visibility.m4 serial 7 -+# visibility.m4 serial 8 - dnl Copyright (C) 2005, 2008, 2010-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -59,6 +59,10 @@ AC_DEFUN([gl_VISIBILITY], - extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); - extern __attribute__((__visibility__("default"))) int exportedfunc (void); - void dummyfunc (void); -+ int hiddenvar; -+ int exportedvar; -+ int hiddenfunc (void) { return 51; } -+ int exportedfunc (void) { return 1225736919; } - void dummyfunc (void) {} - ]], - [[]])], ---- a/gnulib/m4/wchar_h.m4 -+++ b/gnulib/m4/wchar_h.m4 -@@ -7,9 +7,9 @@ dnl with or without modifications, as lo - - dnl Written by Eric Blake. - --# wchar_h.m4 serial 50 -+# wchar_h.m4 serial 53 - --AC_DEFUN([gl_WCHAR_H], -+AC_DEFUN_ONCE([gl_WCHAR_H], - [ - AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) - AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) -@@ -125,60 +125,75 @@ Configuration aborted.]) - fi - ]) - -+# gl_WCHAR_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_WCHAR_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOWCS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCRTOMB]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRTOMBS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNRTOMBS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCWIDTH]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCHR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMMOVE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMPCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMSET]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSLEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNLEN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPNCPY]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCAT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCASECMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCASECMP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCOLL]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSXFRM]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSDUP]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCHR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRCHR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCSPN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSPN]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSPBRK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSTR]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) -+ dnl Support Microsoft deprecated alias function names by default. -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_WCHAR_H_DEFAULTS], - [ -- GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) -- GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) -- GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) -- GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) -- GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) -- GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) -- GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) -- GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) -- GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) -- GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) -- GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) -- GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR]) -- GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP]) -- GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY]) -- GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE]) -- GNULIB_WMEMPCPY=0; AC_SUBST([GNULIB_WMEMPCPY]) -- GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET]) -- GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN]) -- GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN]) -- GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY]) -- GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY]) -- GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY]) -- GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY]) -- GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT]) -- GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT]) -- GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP]) -- GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP]) -- GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP]) -- GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP]) -- GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL]) -- GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM]) -- GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP]) -- GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR]) -- GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR]) -- GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN]) -- GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN]) -- GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK]) -- GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR]) -- GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK]) -- GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH]) -- GNULIB_WCSFTIME=0; AC_SUBST([GNULIB_WCSFTIME]) -- dnl Support Microsoft deprecated alias function names by default. -- GNULIB_MDA_WCSDUP=1; AC_SUBST([GNULIB_MDA_WCSDUP]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) - HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) ---- a/gnulib/m4/wctype_h.m4 -+++ b/gnulib/m4/wctype_h.m4 -@@ -1,4 +1,4 @@ --# wctype_h.m4 serial 26 -+# wctype_h.m4 serial 30 - - dnl A placeholder for ISO C99 , for platforms that lack it. - -@@ -9,7 +9,7 @@ dnl with or without modifications, as lo - - dnl Written by Paul Eggert. - --AC_DEFUN([gl_WCTYPE_H], -+AC_DEFUN_ONCE([gl_WCTYPE_H], - [ - AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) - AC_REQUIRE([AC_PROG_CC]) -@@ -62,7 +62,7 @@ AC_DEFUN([gl_WCTYPE_H], - fi - AC_SUBST([HAVE_WCTYPE_H]) - -- if test $GNULIB_OVERRIDES_WINT_T = 1; then -+ if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then - REPLACE_ISWCNTRL=1 - else - case "$gl_cv_func_iswcntrl_works" in -@@ -157,24 +157,39 @@ AC_DEFUN([gl_WCTYPE_H], - ]) - ]) - -+# gl_WCTYPE_MODULE_INDICATOR([modulename]) -+# sets the shell variable that indicates the presence of the given module -+# to a C preprocessor expression that will evaluate to 1. -+# This macro invocation must not occur in macros that are AC_REQUIREd. - AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], - [ -- dnl Use AC_REQUIRE here, so that the default settings are expanded once only. -- AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) -+ dnl Ensure to expand the default settings once only. -+ gl_WCTYPE_H_REQUIRE_DEFAULTS - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) - dnl Define it also as a C macro, for the benefit of the unit tests. - gl_MODULE_INDICATOR_FOR_TESTS([$1]) - ]) - -+# Initializes the default values for AC_SUBSTed shell variables. -+# This macro must not be AC_REQUIREd. It must only be invoked, and only -+# outside of macros or in macros that are not AC_REQUIREd. -+AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS], -+[ -+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTRANS]) -+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOWCTRANS]) -+ ]) -+ m4_require(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS]) -+ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) -+]) -+ - AC_DEFUN([gl_WCTYPE_H_DEFAULTS], - [ -- GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK]) -- GNULIB_ISWDIGIT=0; AC_SUBST([GNULIB_ISWDIGIT]) -- GNULIB_ISWXDIGIT=0; AC_SUBST([GNULIB_ISWXDIGIT]) -- GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE]) -- GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE]) -- GNULIB_WCTRANS=0; AC_SUBST([GNULIB_WCTRANS]) -- GNULIB_TOWCTRANS=0; AC_SUBST([GNULIB_TOWCTRANS]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) - HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) ---- a/gnulib/m4/wint_t.m4 -+++ b/gnulib/m4/wint_t.m4 -@@ -1,4 +1,4 @@ --# wint_t.m4 serial 10 -+# wint_t.m4 serial 11 - dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. - dnl This file is free software; the Free Software Foundation - dnl gives unlimited permission to copy and/or distribute it, -@@ -34,14 +34,14 @@ AC_DEFUN([gt_TYPE_WINT_T], - [gl_cv_type_wint_t_large_enough=yes], - [gl_cv_type_wint_t_large_enough=no])]) - if test $gl_cv_type_wint_t_large_enough = no; then -- GNULIB_OVERRIDES_WINT_T=1 -+ GNULIBHEADERS_OVERRIDE_WINT_T=1 - else -- GNULIB_OVERRIDES_WINT_T=0 -+ GNULIBHEADERS_OVERRIDE_WINT_T=0 - fi - else -- GNULIB_OVERRIDES_WINT_T=0 -+ GNULIBHEADERS_OVERRIDE_WINT_T=0 - fi -- AC_SUBST([GNULIB_OVERRIDES_WINT_T]) -+ AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T]) - ]) - - dnl Prerequisites of the 'wint_t' override. ---- /dev/null -+++ b/gnulib/m4/year2038.m4 -@@ -0,0 +1,112 @@ -+# year2038.m4 serial 5 -+dnl Copyright (C) 2017-2021 Free Software Foundation, Inc. -+dnl This file is free software; the Free Software Foundation -+dnl gives unlimited permission to copy and/or distribute it, -+dnl with or without modifications, as long as this notice is preserved. -+ -+dnl Attempt to ensure that 'time_t' is a 64-bit type -+dnl and that the functions time(), stat(), etc. return 64-bit times. -+ -+AC_DEFUN([gl_YEAR2038_EARLY], -+[ -+ AC_REQUIRE([AC_CANONICAL_HOST]) -+ case "$host_os" in -+ mingw*) -+ AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], -+ [For 64-bit time_t on 32-bit mingw.]) -+ ;; -+ esac -+]) -+ -+# gl_YEAR2038_TEST_INCLUDES -+# ------------------------- -+AC_DEFUN([gl_YEAR2038_TEST_INCLUDES], -+[[ -+ #include -+ /* Check that time_t can represent 2**63 - 1 correctly. -+ We can't simply define LARGE_TIME_T to be 9223372036854775807, -+ since some C++ compilers masquerading as C compilers -+ incorrectly reject 9223372036854775807. */ -+ #define LARGE_TIME_T (((time_t) 1 << 31 << 31) - 1 + ((time_t) 1 << 31 << 31)) -+ int verify_time_t_range[(LARGE_TIME_T % 2147483629 == 721 -+ && LARGE_TIME_T % 2147483647 == 1) -+ ? 1 : -1]; -+]]) -+ -+# gl_YEAR2038_BODY(REQUIRE-64-BIT) -+---------------------------------- -+AC_DEFUN([gl_YEAR2038_BODY], -+[ -+ AC_ARG_ENABLE([year2038], -+ [ --disable-year2038 omit support for timestamps past the year 2038]) -+ AS_IF([test "$enable_year2038" != no], -+ [ -+ dnl On many systems, time_t is already a 64-bit type. -+ dnl On those systems where time_t is still 32-bit, it requires kernel -+ dnl and libc support to make it 64-bit. For glibc 2.34 and later on Linux, -+ dnl defining _TIME_BITS=64 and _FILE_OFFSET_BITS=64 is needed on x86 and ARM. -+ dnl -+ dnl On native Windows, the system include files define types __time32_t -+ dnl and __time64_t. By default, time_t is an alias of -+ dnl - __time32_t on 32-bit mingw, -+ dnl - __time64_t on 64-bit mingw and on MSVC (since MSVC 8). -+ dnl But when compiling with -D__MINGW_USE_VC2005_COMPAT, time_t is an -+ dnl alias of __time64_t. -+ dnl And when compiling with -D_USE_32BIT_TIME_T, time_t is an alias of -+ dnl __time32_t. -+ AC_CACHE_CHECK([for 64-bit time_t], [gl_cv_type_time_t_64], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_SOURCE([gl_YEAR2038_TEST_INCLUDES])], -+ [gl_cv_type_time_t_64=yes], [gl_cv_type_time_t_64=no]) -+ ]) -+ if test "$gl_cv_type_time_t_64" = no; then -+ AC_CACHE_CHECK([for 64-bit time_t with _TIME_BITS=64], -+ [gl_cv_type_time_t_bits_macro], -+ [AC_COMPILE_IFELSE( -+ [AC_LANG_SOURCE([[#define _TIME_BITS 64 -+ #define _FILE_OFFSET_BITS 64 -+ ]gl_YEAR2038_TEST_INCLUDES])], -+ [gl_cv_type_time_t_bits_macro=yes], -+ [gl_cv_type_time_t_bits_macro=no]) -+ ]) -+ if test "$gl_cv_type_time_t_bits_macro" = yes; then -+ AC_DEFINE([_TIME_BITS], [64], -+ [Number of bits in a timestamp, on hosts where this is settable.]) -+ dnl AC_SYS_LARGFILE also defines this; it's OK if we do too. -+ AC_DEFINE([_FILE_OFFSET_BITS], [64], -+ [Number of bits in a file offset, on hosts where this is settable.]) -+ gl_cv_type_time_t_64=yes -+ fi -+ fi -+ if test $gl_cv_type_time_t_64 = no; then -+ AC_COMPILE_IFELSE( -+ [AC_LANG_SOURCE( -+ [[#ifdef _USE_32BIT_TIME_T -+ int ok; -+ #else -+ error fail -+ #endif -+ ]])], -+ [AC_MSG_FAILURE([This package requires a 64-bit 'time_t' type. Remove _USE_32BIT_TIME_T from the compiler flags.])], -+ [# If not cross-compiling and $1 says we should check, -+ # and 'touch' works with a large timestamp, then evidently 64-bit time_t -+ # is desired and supported, so fail and ask the builder to fix the -+ # problem. Otherwise, just warn the builder. -+ m4_ifval([$1], -+ [if test $cross_compiling = no \ -+ && TZ=UTC0 touch -t 210602070628.16 conftest.time 2>/dev/null; then -+ rm -f conftest.time -+ AC_MSG_FAILURE([This package requires a 64-bit 'time_t' type, which your system appears to support. You might try configuring with 'CPPFLAGS="-m64" LDFLAGS="-m64"'. To build with a 32-bit time_t anyway (not recommended), configure with '--disable-year2038'.]) -+ fi]) -+ if test "$gl_warned_about_64_bit_time_t" != yes; then -+ AC_MSG_WARN([This package requires a 64-bit 'time_t' type if there is any way to access timestamps outside the year range 1901-2038 on your platform. Perhaps you should configure with 'CPPFLAGS="-m64" LDFLAGS="-m64"'?]) -+ gl_warned_about_64_bit_time_t=yes -+ fi -+ ]) -+ fi]) -+]) -+ -+AC_DEFUN([gl_YEAR2038], -+[ -+ gl_YEAR2038_BODY([require-64-bit]) -+]) diff --git a/poky/meta/recipes-extended/texinfo/texinfo/disable-native-tools.patch b/poky/meta/recipes-extended/texinfo/texinfo/disable-native-tools.patch index ab6f1658aa..3801d73883 100644 --- a/poky/meta/recipes-extended/texinfo/texinfo/disable-native-tools.patch +++ b/poky/meta/recipes-extended/texinfo/texinfo/disable-native-tools.patch @@ -1,3 +1,8 @@ +From e5d8f6d4a7652ea95c8d069ce9333494f2db868c Mon Sep 17 00:00:00 2001 +From: Joshua Lock +Date: Fri, 16 Sep 2011 15:35:48 -0700 +Subject: [PATCH] texinfo: several changes to build without zlib and ncurses + We already DEPEND on the native texinfo being present before building so there isn't any need to try and build the required native texinfo binaries before cross-compiling. This simplifies the recipe somewhat! @@ -6,11 +11,15 @@ Upstream-Status: Inappropriate oe specific Signed-off-by: Joshua Lock -Index: texinfo-4.13/configure.ac -=================================================================== ---- texinfo-4.13.orig/configure.ac -+++ texinfo-4.13/configure.ac -@@ -100,29 +100,7 @@ AC_CANONICAL_BUILD +--- + configure.ac | 24 +----------------------- + 1 file changed, 1 insertion(+), 23 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 6fcd3a0..c108df7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -180,29 +180,7 @@ AC_CANONICAL_BUILD # $native_tools is also added to SUBDIRS in the main Makefile.am, # so that make compiles the native tools first. # diff --git a/poky/meta/recipes-extended/texinfo/texinfo/dont-depend-on-help2man.patch b/poky/meta/recipes-extended/texinfo/texinfo/dont-depend-on-help2man.patch index 0d6bbafadd..825887cc2e 100644 --- a/poky/meta/recipes-extended/texinfo/texinfo/dont-depend-on-help2man.patch +++ b/poky/meta/recipes-extended/texinfo/texinfo/dont-depend-on-help2man.patch @@ -1,4 +1,4 @@ -From 63a803ead3656353329a801846a9a3beb7210c46 Mon Sep 17 00:00:00 2001 +From 451a9b9c3874872d575693fc7733fae02690a7d3 Mon Sep 17 00:00:00 2001 From: Edwin Plauchu Date: Tue, 29 Nov 2016 13:43:24 -0600 Subject: [PATCH] dont-depend-on-help2man @@ -14,18 +14,18 @@ Signed-off-by: Edwin Plauchu 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am -index 732833e..041cb9b 100644 +index 407a38c..6b5ff3e 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am -@@ -37,7 +37,7 @@ refcard_files = refcard/Makefile refcard/txicmdcheck \ +@@ -55,7 +55,7 @@ refcard_files = refcard/Makefile refcard/txicmdcheck \ # Include our texinfo.tex, not Automake's. EXTRA_DIST = epsf.tex texinfo.tex \ fdl.texi \ - $(man_MANS) $(TXI_XLATE) \ + $(TXI_XLATE) \ $(refcard_files) \ + gendocs.chapter/gendocs_template \ texinfo-tex-test.texi texinfo-tex-test.WIDOWs \ - texinfo-ja.tex short-sample-ja.texi diff --git a/man/Makefile.am b/man/Makefile.am index d0cd72c..a19e52a 100644 --- a/man/Makefile.am diff --git a/poky/meta/recipes-extended/texinfo/texinfo/link-zip.patch b/poky/meta/recipes-extended/texinfo/texinfo/link-zip.patch index 15c030c0c6..72d7067aa9 100644 --- a/poky/meta/recipes-extended/texinfo/texinfo/link-zip.patch +++ b/poky/meta/recipes-extended/texinfo/texinfo/link-zip.patch @@ -1,4 +1,4 @@ -From c1002138033fcccb2d1abfc41f5c2e46c836f7a0 Mon Sep 17 00:00:00 2001 +From c5050ac84c8a3cc3ff8c7e558f8c2fdb57f410d9 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Mon, 29 Jul 2013 15:02:34 -0700 Subject: [PATCH] install-info uses symbols from zlib so must link against it. diff --git a/poky/meta/recipes-extended/texinfo/texinfo/use_host_makedoc.patch b/poky/meta/recipes-extended/texinfo/texinfo/use_host_makedoc.patch index 5b7f32d9a9..c6c9952c9e 100644 --- a/poky/meta/recipes-extended/texinfo/texinfo/use_host_makedoc.patch +++ b/poky/meta/recipes-extended/texinfo/texinfo/use_host_makedoc.patch @@ -1,12 +1,21 @@ +From 81ccd162b869c20e450073fa834b5cabbea8e3d4 Mon Sep 17 00:00:00 2001 +From: Saul Wold +Date: Mon, 29 Jul 2013 15:02:34 -0700 +Subject: [PATCH] texinfo: Update to 5.1 + Upstream-Status: Inappropriate [cross build specific] Signed-off-by: Saul Wold -Index: texinfo-5.1/info/Makefile.am -=================================================================== ---- texinfo-5.1.orig/info/Makefile.am -+++ texinfo-5.1/info/Makefile.am -@@ -76,7 +76,7 @@ cmd_sources = $(srcdir)/session.c $(srcd +--- + info/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/info/Makefile.am b/info/Makefile.am +index 35596b1..cae1421 100644 +--- a/info/Makefile.am ++++ b/info/Makefile.am +@@ -69,7 +69,7 @@ cmd_sources = $(srcdir)/session.c $(srcdir)/echo-area.c $(srcdir)/infodoc.c \ # more than once. funs.h: makedoc$(EXEEXT) $(cmd_sources) rm -f $(generated_sources) diff --git a/poky/meta/recipes-extended/texinfo/texinfo_6.8.bb b/poky/meta/recipes-extended/texinfo/texinfo_6.8.bb deleted file mode 100644 index 33dcd943b4..0000000000 --- a/poky/meta/recipes-extended/texinfo/texinfo_6.8.bb +++ /dev/null @@ -1,90 +0,0 @@ -SUMMARY = "Documentation system for on-line information and printed output" -DESCRIPTION = "Texinfo is a documentation system that can produce both \ -online information and printed output from a single source file. The \ -GNU Project uses the Texinfo file format for most of its documentation." -HOMEPAGE = "http://www.gnu.org/software/texinfo/" -SECTION = "console/utils" -LICENSE = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" - -PROVIDES:append:class-native = " texinfo-replacement-native" - -def compress_pkg(d): - if bb.data.inherits_class('compress_doc', d): - compress = d.getVar("DOC_COMPRESS") - if compress == "gz": - return "gzip" - elif compress == "bz2": - return "bzip2" - elif compress == "xz": - return "xz" - return "" - -RDEPENDS:info += "${@compress_pkg(d)}" - -DEPENDS = "zlib ncurses texinfo-replacement-native" -DEPENDS:class-native = "zlib-native ncurses-native" - -TARGET_PATCH = "file://use_host_makedoc.patch" -TARGET_PATCH:class-native = "" - -SRC_URI = "${GNU_MIRROR}/texinfo/${BP}.tar.gz \ - file://0001-gnulib-Update.patch \ - file://disable-native-tools.patch \ - file://link-zip.patch \ - file://dont-depend-on-help2man.patch \ - ${TARGET_PATCH} \ - " - -SRC_URI[sha256sum] = "8e09cf753ad1833695d2bac0f57dc3bd6bcbbfbf279450e1ba3bc2d7fb297d08" - -tex_texinfo = "texmf/tex/texinfo" - -inherit gettext autotools multilib_script - -MULTILIB_SCRIPTS = "${PN}:${bindir}/texi2any" - -EXTRA_AUTORECONF += "-I ${S}/gnulib/m4" - -do_configure:prepend () { - # autotools_do_configure updates po/Makefile.in.in, we also need - # update po_document. - cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po_document/ -} - -do_compile:prepend() { - if [ -d tools ];then - oe_runmake -C tools/gnulib/lib - fi -} - -do_install:append() { - mkdir -p ${D}${datadir}/${tex_texinfo} - install -p -m644 ${S}/doc/texinfo.tex ${S}/doc/txi-??.tex ${D}${datadir}/${tex_texinfo} - sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/texi2any ${D}${bindir}/pod2texi -} - -do_install:append:class-native() { - install -m 755 info/makedoc ${D}${bindir} -} - -PACKAGES += "info info-doc" - -FILES:info = "${bindir}/info ${bindir}/infokey ${bindir}/install-info" -FILES:info-doc = "${infodir}/info.info* ${infodir}/dir ${infodir}/info-*.info* \ - ${mandir}/man1/info.1* ${mandir}/man5/info.5* \ - ${mandir}/man1/infokey.1* ${mandir}/man1/install-info.1*" - -FILES:${PN} = "${bindir}/makeinfo ${bindir}/texi* ${bindir}/pdftexi2dvi ${bindir}/pod2texi ${datadir}/texinfo" -RDEPENDS:${PN} = "perl" -FILES:${PN}-doc = "${infodir}/texinfo* \ - ${datadir}/${tex_texinfo} \ - ${mandir}/man1 ${mandir}/man5" - -# Lie about providing the Locale::gettext_xs module. It is not actually built, -# but the code will test for it and if not found use Locale::gettext_pp instead. -# However, this causes a file dependency on perl(Locale::gettext_xs) to be -# generated, which must be satisfied. -RPROVIDES:${PN} += "perl(Locale::gettext_xs)" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/texinfo/texinfo_7.0.1.bb b/poky/meta/recipes-extended/texinfo/texinfo_7.0.1.bb new file mode 100644 index 0000000000..f0f9211594 --- /dev/null +++ b/poky/meta/recipes-extended/texinfo/texinfo_7.0.1.bb @@ -0,0 +1,90 @@ +SUMMARY = "Documentation system for on-line information and printed output" +DESCRIPTION = "Texinfo is a documentation system that can produce both \ +online information and printed output from a single source file. The \ +GNU Project uses the Texinfo file format for most of its documentation." +HOMEPAGE = "http://www.gnu.org/software/texinfo/" +SECTION = "console/utils" +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" + +PROVIDES:append:class-native = " texinfo-replacement-native" + +def compress_pkg(d): + if bb.data.inherits_class('compress_doc', d): + compress = d.getVar("DOC_COMPRESS") + if compress == "gz": + return "gzip" + elif compress == "bz2": + return "bzip2" + elif compress == "xz": + return "xz" + return "" + +RDEPENDS:info += "${@compress_pkg(d)}" + +DEPENDS = "zlib ncurses texinfo-replacement-native" +DEPENDS:class-native = "zlib-native ncurses-native" + +TARGET_PATCH = "file://use_host_makedoc.patch" +TARGET_PATCH:class-native = "" + +SRC_URI = "${GNU_MIRROR}/texinfo/${BP}.tar.gz \ + file://disable-native-tools.patch \ + file://link-zip.patch \ + file://dont-depend-on-help2man.patch \ + ${TARGET_PATCH} \ + " + +SRC_URI[sha256sum] = "53c01dd34c9bf116866d03aabd38c5cd9ee95ac10043d61aa33dec0d27825d8d" + +tex_texinfo = "texmf/tex/texinfo" + +inherit gettext autotools multilib_script + +MULTILIB_SCRIPTS = "${PN}:${bindir}/texi2any" + +EXTRA_AUTORECONF += "-I ${S}/gnulib/m4" + +do_configure:prepend () { + # autotools_do_configure updates po/Makefile.in.in, we also need + # update po_document. + cp -f ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ${S}/po_document/ +} + +do_compile:prepend() { + if [ -d tools ];then + oe_runmake -C tools/gnulib/lib + fi +} + +do_install:append() { + mkdir -p ${D}${datadir}/${tex_texinfo} + install -p -m644 ${S}/doc/texinfo.tex ${S}/doc/txi-??.tex ${D}${datadir}/${tex_texinfo} + sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/texi2any ${D}${bindir}/pod2texi + sed -i -e 's,${HOSTTOOLS_DIR},,' ${D}${bindir}/texindex +} + +do_install:append:class-native() { + install -m 755 info/makedoc ${D}${bindir} +} + +PACKAGES += "info info-doc" + +FILES:info = "${bindir}/info ${bindir}/infokey ${bindir}/install-info" +FILES:info-doc = "${infodir}/info.info* ${infodir}/dir ${infodir}/info-*.info* \ + ${mandir}/man1/info.1* ${mandir}/man5/info.5* \ + ${mandir}/man1/infokey.1* ${mandir}/man1/install-info.1*" + +FILES:${PN} = "${bindir}/makeinfo ${bindir}/texi* ${bindir}/pdftexi2dvi ${bindir}/pod2texi ${datadir}/texinfo" +RDEPENDS:${PN} = "perl" +FILES:${PN}-doc = "${infodir}/texi* \ + ${datadir}/${tex_texinfo} \ + ${mandir}/man1 ${mandir}/man5" + +# Lie about providing the Locale::gettext_xs module. It is not actually built, +# but the code will test for it and if not found use Locale::gettext_pp instead. +# However, this causes a file dependency on perl(Locale::gettext_xs) to be +# generated, which must be satisfied. +RPROVIDES:${PN} += "perl(Locale::gettext_xs)" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/timezone/timezone.inc b/poky/meta/recipes-extended/timezone/timezone.inc index d3c78e9157..1834665a1e 100644 --- a/poky/meta/recipes-extended/timezone/timezone.inc +++ b/poky/meta/recipes-extended/timezone/timezone.inc @@ -6,7 +6,7 @@ SECTION = "base" LICENSE = "PD & BSD-3-Clause" LIC_FILES_CHKSUM = "file://LICENSE;md5=c679c9d6b02bc2757b3eaf8f53c43fba" -PV = "2022d" +PV = "2022g" SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz;name=tzcode \ http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata \ @@ -14,6 +14,5 @@ SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones" -SRC_URI[tzcode.sha256sum] = "d644ba0f938899374ea8cb554e35fb4afa0f7bd7b716c61777cd00500b8759e0" -SRC_URI[tzdata.sha256sum] = "6ecdbee27fa43dcfa49f3d4fd8bb1dfef54c90da1abcd82c9abcf2dc4f321de0" - +SRC_URI[tzcode.sha256sum] = "9610bb0b9656ff404c361a41f3286da53064b5469d84f00c9cb2314c8614da74" +SRC_URI[tzdata.sha256sum] = "4491db8281ae94a84d939e427bdd83dc389f26764d27d9a5c52d782c16764478" diff --git a/poky/meta/recipes-extended/xz/xz_5.2.7.bb b/poky/meta/recipes-extended/xz/xz_5.2.7.bb deleted file mode 100644 index 88ec847c15..0000000000 --- a/poky/meta/recipes-extended/xz/xz_5.2.7.bb +++ /dev/null @@ -1,44 +0,0 @@ -SUMMARY = "Utilities for managing LZMA compressed files" -HOMEPAGE = "https://tukaani.org/xz/" -DESCRIPTION = "XZ Utils is free general-purpose data compression software with a high compression ratio. XZ Utils were written for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils." -SECTION = "base" - -# The source includes bits of PD, GPL-2.0, GPL-3.0, LGPL-2.1-or-later, but the -# only file which is GPL-3.0 is an m4 macro which isn't shipped in any of our -# packages, and the LGPL bits are under lib/, which appears to be used for -# libgnu, which appears to be used for DOS builds. So we're left with -# GPL-2.0-or-later and PD. -LICENSE = "GPL-2.0-or-later & GPL-3.0-with-autoconf-exception & LGPL-2.1-or-later & PD" -LICENSE:${PN} = "GPL-2.0-or-later" -LICENSE:${PN}-dev = "GPL-2.0-or-later" -LICENSE:${PN}-staticdev = "GPL-2.0-or-later" -LICENSE:${PN}-doc = "GPL-2.0-or-later" -LICENSE:${PN}-dbg = "GPL-2.0-or-later" -LICENSE:${PN}-locale = "GPL-2.0-or-later" -LICENSE:liblzma = "PD" - -LIC_FILES_CHKSUM = "file://COPYING;md5=97d554a32881fee0aa283d96e47cb24a \ - file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=4fbd65380cdd255951079008b364516c \ - file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 \ - " - -SRC_URI = "https://tukaani.org/xz/xz-${PV}.tar.gz" -SRC_URI[sha256sum] = "06327c2ddc81e126a6d9a78b0be5014b976a2c0832f492dcfc4755d7facf6d33" -UPSTREAM_CHECK_REGEX = "xz-(?P\d+(\.\d+)+)\.tar" - -CACHED_CONFIGUREVARS += "gl_cv_posix_shell=/bin/sh" - -inherit autotools gettext - -PACKAGES =+ "liblzma" - -FILES:liblzma = "${libdir}/liblzma*${SOLIBS}" - -inherit update-alternatives -ALTERNATIVE_PRIORITY = "100" -ALTERNATIVE:${PN} = "xz xzcat unxz \ - lzma lzcat unlzma" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-extended/xz/xz_5.4.0.bb b/poky/meta/recipes-extended/xz/xz_5.4.0.bb new file mode 100644 index 0000000000..75b763533f --- /dev/null +++ b/poky/meta/recipes-extended/xz/xz_5.4.0.bb @@ -0,0 +1,44 @@ +SUMMARY = "Utilities for managing LZMA compressed files" +HOMEPAGE = "https://tukaani.org/xz/" +DESCRIPTION = "XZ Utils is free general-purpose data compression software with a high compression ratio. XZ Utils were written for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils." +SECTION = "base" + +# The source includes bits of PD, GPL-2.0, GPL-3.0, LGPL-2.1-or-later, but the +# only file which is GPL-3.0 is an m4 macro which isn't shipped in any of our +# packages, and the LGPL bits are under lib/, which appears to be used for +# libgnu, which appears to be used for DOS builds. So we're left with +# GPL-2.0-or-later and PD. +LICENSE = "GPL-2.0-or-later & GPL-3.0-with-autoconf-exception & LGPL-2.1-or-later & PD" +LICENSE:${PN} = "GPL-2.0-or-later" +LICENSE:${PN}-dev = "GPL-2.0-or-later" +LICENSE:${PN}-staticdev = "GPL-2.0-or-later" +LICENSE:${PN}-doc = "GPL-2.0-or-later" +LICENSE:${PN}-dbg = "GPL-2.0-or-later" +LICENSE:${PN}-locale = "GPL-2.0-or-later" +LICENSE:liblzma = "PD" + +LIC_FILES_CHKSUM = "file://COPYING;md5=97d554a32881fee0aa283d96e47cb24a \ + file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=4fbd65380cdd255951079008b364516c \ + file://lib/getopt.c;endline=23;md5=2069b0ee710572c03bb3114e4532cd84 \ + " + +SRC_URI = "https://tukaani.org/xz/xz-${PV}.tar.gz" +SRC_URI[sha256sum] = "7471ef5991f690268a8f2be019acec2e0564b7b233ca40035f339fe9a07f830b" +UPSTREAM_CHECK_REGEX = "xz-(?P\d+(\.\d+)+)\.tar" + +CACHED_CONFIGUREVARS += "gl_cv_posix_shell=/bin/sh" + +inherit autotools gettext + +PACKAGES =+ "liblzma" + +FILES:liblzma = "${libdir}/liblzma*${SOLIBS}" + +inherit update-alternatives +ALTERNATIVE_PRIORITY = "100" +ALTERNATIVE:${PN} = "xz xzcat unxz \ + lzma lzcat unlzma" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-gnome/epiphany/epiphany_42.4.bb b/poky/meta/recipes-gnome/epiphany/epiphany_42.4.bb deleted file mode 100644 index afaaefc46f..0000000000 --- a/poky/meta/recipes-gnome/epiphany/epiphany_42.4.bb +++ /dev/null @@ -1,43 +0,0 @@ -SUMMARY = "WebKit based web browser for GNOME" -DESCRIPTION = "Epiphany is an open source web browser for the Linux desktop environment. \ -It provides a simple and easy-to-use internet browsing experience." -HOMEPAGE = "https://wiki.gnome.org/Apps/Web" -BUGTRACKER = "https://gitlab.gnome.org/GNOME/epiphany" -LICENSE = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -DEPENDS = " \ - webkitgtk \ - gcr \ - gsettings-desktop-schemas \ - nettle \ - json-glib \ - libarchive \ - libdazzle \ - libhandy \ - glib-2.0-native \ - coreutils-native \ - " - -GNOMEBASEBUILDCLASS = "meson" -inherit gnomebase gsettings features_check gettext mime-xdg -REQUIRED_DISTRO_FEATURES = "x11 opengl" - -SRC_URI = "${GNOME_MIRROR}/${GNOMEBN}/${@oe.utils.trim_version("${PV}", 1)}/${GNOMEBN}-${PV}.tar.${GNOME_COMPRESS_TYPE};name=archive \ - file://0002-help-meson.build-disable-the-use-of-yelp.patch \ - file://migrator.patch \ - file://distributor.patch \ - " -SRC_URI[archive.sha256sum] = "370938ad2920eeb28bc2435944776b7ba55a0e2ede65836f79818cfb7e8f0860" - -PACKAGECONFIG_SOUP ?= "soup3" -PACKAGECONFIG ??= "${PACKAGECONFIG_SOUP}" - -# Developer mode enables debugging -PACKAGECONFIG[developer-mode] = "-Ddeveloper_mode=true,-Ddeveloper_mode=false" -PACKAGECONFIG[soup2] = "-Dsoup2=enabled,-Dsoup2=disabled,libsoup-2.4,,,soup3" -PACKAGECONFIG[soup3] = ",,libsoup,,,soup2" -PACKAGECONFIG[libportal] = "-Dlibportal=enabled,-Dlibportal=disabled,libportal" - -FILES:${PN} += "${datadir}/dbus-1 ${datadir}/gnome-shell/search-providers ${datadir}/metainfo" -RDEPENDS:${PN} = "iso-codes adwaita-icon-theme gsettings-desktop-schemas" diff --git a/poky/meta/recipes-gnome/epiphany/epiphany_43.0.bb b/poky/meta/recipes-gnome/epiphany/epiphany_43.0.bb new file mode 100644 index 0000000000..4a6007b0df --- /dev/null +++ b/poky/meta/recipes-gnome/epiphany/epiphany_43.0.bb @@ -0,0 +1,40 @@ +SUMMARY = "WebKit based web browser for GNOME" +DESCRIPTION = "Epiphany is an open source web browser for the Linux desktop environment. \ +It provides a simple and easy-to-use internet browsing experience." +HOMEPAGE = "https://wiki.gnome.org/Apps/Web" +BUGTRACKER = "https://gitlab.gnome.org/GNOME/epiphany" +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +DEPENDS = " \ + webkitgtk \ + gcr3 \ + gsettings-desktop-schemas \ + nettle \ + json-glib \ + libarchive \ + libdazzle \ + libhandy \ + libportal \ + libsoup \ + glib-2.0-native \ + coreutils-native \ + desktop-file-utils-native \ + " + +GNOMEBASEBUILDCLASS = "meson" +inherit gnomebase gsettings features_check gettext mime-xdg gtk-icon-cache +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +SRC_URI = "${GNOME_MIRROR}/${GNOMEBN}/${@oe.utils.trim_version("${PV}", 1)}/${GNOMEBN}-${PV}.tar.${GNOME_COMPRESS_TYPE};name=archive \ + file://0002-help-meson.build-disable-the-use-of-yelp.patch \ + file://migrator.patch \ + file://distributor.patch \ + " +SRC_URI[archive.sha256sum] = "b66d499f9ee72696d83cf844125377181a954554a4bb3785b73293380ac0c227" + +# Developer mode enables debugging +PACKAGECONFIG[developer-mode] = "-Ddeveloper_mode=true,-Ddeveloper_mode=false" + +FILES:${PN} += "${datadir}/dbus-1 ${datadir}/gnome-shell/search-providers ${datadir}/metainfo" +RDEPENDS:${PN} = "iso-codes adwaita-icon-theme gsettings-desktop-schemas" diff --git a/poky/meta/recipes-gnome/gcr/gcr/0001-gcr-meson.build-fix-one-parallel-build-failure.patch b/poky/meta/recipes-gnome/gcr/gcr/0001-gcr-meson.build-fix-one-parallel-build-failure.patch deleted file mode 100644 index 81c4bdbbcc..0000000000 --- a/poky/meta/recipes-gnome/gcr/gcr/0001-gcr-meson.build-fix-one-parallel-build-failure.patch +++ /dev/null @@ -1,37 +0,0 @@ -From cb3708bad88e713e4ccf705cb8c14c5996cd9d06 Mon Sep 17 00:00:00 2001 -From: Changqing Li -Date: Fri, 23 Apr 2021 16:32:38 +0800 -Subject: [PATCH] gcr/meson.build: fix one parallel build failure - -ui/gcr-live-search.c includes gcr/gcr-marshal.h. Because missing -dependency, following error occurred intermittently during doing parallel -build: - - -o ui/libgcr-ui-3.so.1.0.0.p/gcr-live-search.c.o -c ../gcr-3.38.1/ui/gcr-live-search.c -../gcr-3.38.1/ui/gcr-live-search.c:32:10: fatal error: gcr/gcr-marshal.h: No such file or directory - 32 | #include "gcr/gcr-marshal.h" - | ^~~~~~~~~~~~~~~~~~~ -compilation terminated. - -Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gcr/-/merge_requests/68/diffs] - -Signed-off-by: Changqing Li ---- - gcr/meson.build | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/gcr/meson.build b/gcr/meson.build -index 06c3a63..d9d4b8f 100644 ---- a/gcr/meson.build -+++ b/gcr/meson.build -@@ -181,6 +181,7 @@ gcr_base_dep = declare_dependency( - sources: [ - gcr_enums_gen[1], - gcr_oids[1], -+ gcr_marshal_gen[1], - ], - ) - --- -2.17.1 - diff --git a/poky/meta/recipes-gnome/gcr/gcr/0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch b/poky/meta/recipes-gnome/gcr/gcr/0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch new file mode 100644 index 0000000000..940f78ebab --- /dev/null +++ b/poky/meta/recipes-gnome/gcr/gcr/0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch @@ -0,0 +1,49 @@ +From 9b67bb18d8409e0e693cc6000507acbd73a30eab Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Wed, 16 Nov 2022 11:27:24 +0100 +Subject: [PATCH 1/2] meson.build: correctly handle disabled ssh_agent option + +Existing code produces these errors: +| gcr/meson.build:61:0: ERROR: Unable to get the path of a not-found external program +| gcr/meson.build:101:5: ERROR: Unknown variable "ssh_add_path". + +Signed-off-by: Alexander Kanavin + +Upstream-Status: Backport [ https://gitlab.gnome.org/GNOME/gcr/-/commit/9b67bb18d8409e0e693cc6000507acbd73a30eab ] +--- + meson.build | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/meson.build b/meson.build +index 3f35173..11d7fa7 100644 +--- a/meson.build ++++ b/meson.build +@@ -58,8 +58,10 @@ if p11_system_config_modules == '' + error('Couldn\'t find location for pkcs11 module config') + endif + libsecret_dep = dependency('libsecret-1', version: '>= 0.20', required: get_option('ssh_agent')) +-ssh_add_path = find_program('ssh-add', required: get_option('ssh_agent')).full_path() +-ssh_agent_path = find_program('ssh-agent', required: get_option('ssh_agent')).full_path() ++if get_option('ssh_agent') ++ ssh_add_path = find_program('ssh-add').full_path() ++ ssh_agent_path = find_program('ssh-agent').full_path() ++endif + + with_systemd = false + libsystemd_deps = [] +@@ -96,8 +98,10 @@ conf.set('HAVE_TIMEGM', cc.has_function('timegm')) + conf.set('HAVE_MLOCK', cc.has_function('mlock')) + conf.set_quoted('GPG_EXECUTABLE', gpg_path) + conf.set_quoted('LIBGCRYPT_VERSION', libgcrypt_dep.version()) +-conf.set_quoted('SSH_ADD_EXECUTABLE', ssh_add_path) +-conf.set_quoted('SSH_AGENT_EXECUTABLE', ssh_agent_path) ++if get_option('ssh_agent') ++ conf.set_quoted('SSH_ADD_EXECUTABLE', ssh_add_path) ++ conf.set_quoted('SSH_AGENT_EXECUTABLE', ssh_agent_path) ++endif + conf.set10('WITH_SYSTEMD', with_systemd) + config_file = configure_file( + output: 'config.h', +-- +2.34.1 + diff --git a/poky/meta/recipes-gnome/gcr/gcr/b3ca1d02bb0148ca787ac4aead164d7c8ce2c4d8.patch b/poky/meta/recipes-gnome/gcr/gcr/b3ca1d02bb0148ca787ac4aead164d7c8ce2c4d8.patch deleted file mode 100644 index ae4e2ac1eb..0000000000 --- a/poky/meta/recipes-gnome/gcr/gcr/b3ca1d02bb0148ca787ac4aead164d7c8ce2c4d8.patch +++ /dev/null @@ -1,61 +0,0 @@ -From b3ca1d02bb0148ca787ac4aead164d7c8ce2c4d8 Mon Sep 17 00:00:00 2001 -From: Jakub Jirutka -Date: Wed, 12 Jan 2022 00:24:20 +0100 -Subject: [PATCH] meson: Fix unknown kw argument in gnome.generate_gir - -This argument has been removed in Meson 0.61.0: - - gck/meson.build:130:2: ERROR: gnome.generate_gir got unknown keyword arguments "packages" - -https://github.com/mesonbuild/meson/commit/f8fc5cb860465718fe7c79a1bf1fe00659f138de: - -> The packages argument to gnome.generate_gir was allowed, but never did anything, so stop passing it. - -Fixes #89 -Upstream-Status: Backport -Signed-off-by: Alexander Kanavin ---- - gck/meson.build | 1 - - gcr/meson.build | 1 - - ui/meson.build | 1 - - 3 files changed, 3 deletions(-) - -diff --git a/gck/meson.build b/gck/meson.build -index 756b486..a21a1e9 100644 ---- a/gck/meson.build -+++ b/gck/meson.build -@@ -131,7 +131,6 @@ if get_option('introspection') - sources: gck_gir_sources, - namespace: 'Gck', - nsversion: '@0@'.format(gck_major_version), -- packages: gck_deps, - export_packages: 'gck-@0@'.format(gck_major_version), - includes: [ 'GObject-2.0', 'Gio-2.0' ], - header: 'gck/gck.h', -diff --git a/gcr/meson.build b/gcr/meson.build -index 2233a44..c83641b 100644 ---- a/gcr/meson.build -+++ b/gcr/meson.build -@@ -190,7 +190,6 @@ if get_option('introspection') - sources: [ gcr_base_public_sources, gcr_base_headers ], - namespace: 'Gcr', - nsversion: '@0@'.format(gcr_major_version), -- packages: gcr_base_deps, - export_packages: 'gcr-base-@0@'.format(gcr_major_version), - includes: [ - 'GObject-2.0', -diff --git a/ui/meson.build b/ui/meson.build -index e656ea2..32ee057 100644 ---- a/ui/meson.build -+++ b/ui/meson.build -@@ -152,7 +152,6 @@ if get_option('introspection') - export_packages: 'gcr-ui-@0@'.format(gcr_major_version), - identifier_prefix: 'Gcr', - symbol_prefix: 'gcr', -- packages: gcr_ui_deps, - includes: [ - 'GObject-2.0', - 'Gio-2.0', --- -GitLab - diff --git a/poky/meta/recipes-gnome/gcr/gcr3/0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch b/poky/meta/recipes-gnome/gcr/gcr3/0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch new file mode 100644 index 0000000000..d3c26d97ae --- /dev/null +++ b/poky/meta/recipes-gnome/gcr/gcr3/0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch @@ -0,0 +1,36 @@ +From 9b67bb18d8409e0e693cc6000507acbd73a30eab Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Wed, 16 Nov 2022 11:27:24 +0100 +Subject: [PATCH 1/2] meson.build: correctly handle disabled ssh_agent option + +Existing code produces these errors: +| gcr/meson.build:61:0: ERROR: Unable to get the path of a not-found external program +| gcr/meson.build:101:5: ERROR: Unknown variable "ssh_add_path". + +Signed-off-by: Alexander Kanavin + +Upstream-Status: Backport [ https://gitlab.gnome.org/GNOME/gcr/-/commit/9b67bb18d8409e0e693cc6000507acbd73a30eab ] +--- + meson.build | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/meson.build b/meson.build +index 3f35173..11d7fa7 100644 +--- a/meson.build ++++ b/meson.build +@@ -96,8 +98,10 @@ conf.set('HAVE_TIMEGM', cc.has_function('timegm')) + conf.set('HAVE_MLOCK', cc.has_function('mlock')) + conf.set_quoted('GPG_EXECUTABLE', gpg_path) + conf.set_quoted('LIBGCRYPT_VERSION', libgcrypt_dep.version()) +-conf.set_quoted('SSH_ADD_EXECUTABLE', ssh_add_path) +-conf.set_quoted('SSH_AGENT_EXECUTABLE', ssh_agent_path) ++if get_option('ssh_agent') ++ conf.set_quoted('SSH_ADD_EXECUTABLE', ssh_add_path) ++ conf.set_quoted('SSH_AGENT_EXECUTABLE', ssh_agent_path) ++endif + conf.set10('WITH_SYSTEMD', with_systemd) + config_file = configure_file( + output: 'config.h', +-- +2.34.1 + diff --git a/poky/meta/recipes-gnome/gcr/gcr3_3.41.1.bb b/poky/meta/recipes-gnome/gcr/gcr3_3.41.1.bb new file mode 100644 index 0000000000..ba5660a5ed --- /dev/null +++ b/poky/meta/recipes-gnome/gcr/gcr3_3.41.1.bb @@ -0,0 +1,59 @@ +SUMMARY = "A library for bits of crypto UI and parsing etc" +DESCRIPTION = "GCR is a library for displaying certificates, and crypto UI, \ +accessing key stores. It also provides the viewer for crypto files on the \ +GNOME desktop." +HOMEPAGE = "https://gitlab.gnome.org/GNOME/gcr" +BUGTRACKER = "https://gitlab.gnome.org/GNOME/gcr/issues" + +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=55ca817ccb7d5b5b66355690e9abc605" + +DEPENDS = "p11-kit glib-2.0 libgcrypt gnupg-native \ + ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'libxslt-native', '', d)}" + +CACHED_CONFIGUREVARS += "ac_cv_path_GPG='gpg2'" + +CFLAGS += "-D_GNU_SOURCE" + +GNOMEBASEBUILDCLASS = "meson" +GTKDOC_MESON_OPTION = "gtk_doc" +inherit gnomebase gtk-icon-cache gi-docgen features_check upstream-version-is-even vala gobject-introspection gettext mime mime-xdg +UPSTREAM_CHECK_REGEX = "[^\d\.](?P3.(?!9\d+)\d+(\.\d+)+)\.tar" + +SRC_URI = "https://download.gnome.org/sources/gcr/3.41/gcr-${PV}.tar.xz;name=archive" +SRC_URI += "file://0001-meson.build-correctly-handle-disabled-ssh_agent-opti.patch" +SRC_URI[archive.sha256sum] = "bb7128a3c2febbfee9c03b90d77d498d0ceb237b0789802d60185c71c4bea24f" + +S = "${WORKDIR}/gcr-${PV}" + +PACKAGECONFIG ??= " \ + ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'gtk', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'gtk', '', d)} \ +" +PACKAGECONFIG[gtk] = "-Dgtk=true,-Dgtk=false,gtk+3" +PACKAGECONFIG[ssh_agent] = "-Dssh_agent=true,-Dssh_agent=false,libsecret,openssh" +#'Use systemd socket activation for server programs' +PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/gcr-3 \ + ${systemd_user_unitdir}/gcr-ssh-agent.socket \ + ${systemd_user_unitdir}/gcr-ssh-agent.service \ +" + +# http://errors.yoctoproject.org/Errors/Details/20229/ +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" +ARM_INSTRUCTION_SET:armv6 = "arm" + +EXTRA_OEMESON += "--cross-file ${WORKDIR}/meson-${PN}.cross" +do_write_config:append() { + cat >${WORKDIR}/meson-${PN}.cross <${WORKDIR}/meson-${PN}.cross <${WORKDIR}/meson-${PN}.cross < Date: Fri, 8 Jun 2018 13:55:10 +0200 Subject: [PATCH] Relocate the repository directory for native builds @@ -21,7 +21,7 @@ Signed-off-by: Sascha Silbe 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/girepository/girepository.c b/girepository/girepository.c -index 7d03485..20f4813 100644 +index a0754f4..2d456f9 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -21,6 +21,8 @@ diff --git a/poky/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.72.0.bb b/poky/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.72.0.bb deleted file mode 100644 index d935cbd905..0000000000 --- a/poky/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.72.0.bb +++ /dev/null @@ -1,194 +0,0 @@ -SUMMARY = "Middleware layer between GObject-using C libraries and language bindings" -DESCRIPTION = "GObject Introspection is a project for providing machine \ -readable introspection data of the API of C libraries. This introspection \ -data can be used in several different use cases, for example automatic code \ -generation for bindings, API verification and documentation generation." -HOMEPAGE = "https://wiki.gnome.org/action/show/Projects/GObjectIntrospection" -BUGTRACKER = "https://gitlab.gnome.org/GNOME/gobject-introspection/issues" -SECTION = "libs" -LICENSE = "LGPL-2.0-or-later & GPL-2.0-or-later & MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=c434e8128a68bedd59b80b2ac1eb1c4a \ - file://tools/compiler.c;endline=20;md5=fc5007fc20022720e6c0b0cdde41fabd \ - file://giscanner/sourcescanner.c;endline=22;md5=194d6e0c1d00662f32d030ce44de8d39 \ - file://girepository/giregisteredtypeinfo.c;endline=21;md5=661847611ae6979465415f31a759ba27 \ - " - -SRC_URI = "${GNOME_MIRROR}/${BPN}/${@oe.utils.trim_version("${PV}", 2)}/${BPN}-${PV}.tar.xz \ - file://0001-g-ir-tool-template.in-fix-girdir-path.patch \ - " - -SRC_URI[sha256sum] = "02fe8e590861d88f83060dd39cda5ccaa60b2da1d21d0f95499301b186beaabc" - -SRC_URI:append:class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch" - -inherit meson pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even multilib_script - -GTKDOC_MESON_OPTION = "gtk_doc" - -MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner" - -DEPENDS += " libffi zlib glib-2.0 python3 flex-native bison-native autoconf-archive" - -# target build needs qemu to run temporary introspection binaries created -# on the fly by g-ir-scanner and a native version of itself to run -# native versions of its own tools during build. -DEPENDS:append:class-target = " gobject-introspection-native qemu-native" - -# needed for writing out the qemu wrapper script -export STAGING_DIR_HOST -export B - -PACKAGECONFIG ?= "" -PACKAGECONFIG[doctool] = "-Ddoctool=enabled,-Ddoctool=disabled,python3-mako," - -# Configure target build to use native tools of itself and to use a qemu wrapper -# and optionally to generate introspection data -EXTRA_OEMESON:class-target = " \ - -Dgi_cross_use_prebuilt_gi=true \ - -Dgi_cross_binary_wrapper=${B}/g-ir-scanner-qemuwrapper \ - -Dgi_cross_ldd_wrapper=${B}/g-ir-scanner-lddwrapper \ - -Dgi_cross_pkgconfig_sysroot_path=${PKG_CONFIG_SYSROOT_DIR} \ - ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-Dbuild_introspection_data=true', '-Dbuild_introspection_data=false', d)} \ - ${@'-Dgir_dir_prefix=${libdir}' if d.getVar('MULTILIBS') else ''} \ -" - -do_configure:prepend:class-native() { - # Tweak the native python scripts so that they don't refer to the - # full path of native python binary (the solution is taken from glib-2.0 recipe) - # This removes the risk of exceeding Linux kernel's shebang line limit (128 bytes) - sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in -} - -do_configure:prepend:class-target() { - # Write out a qemu wrapper that will be given to gi-scanner so that it - # can run target helper binaries through that. - qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" - cat > ${B}/g-ir-scanner-qemuwrapper << EOF -#!/bin/sh -# Use a modules directory which doesn't exist so we don't load random things -# which may then get deleted (or their dependencies) and potentially segfault -export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy - -$qemu_binary "\$@" -if [ \$? -ne 0 ]; then - echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help." - echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )" - exit 1 -fi -EOF - chmod +x ${B}/g-ir-scanner-qemuwrapper - - # Write out a wrapper for g-ir-scanner itself, which will be used when building introspection files - # for glib-based packages. This wrapper calls the native version of the scanner, and tells it to use - # a qemu wrapper for running transient target binaries produced by the scanner, and an include directory - # from the target sysroot. - cat > ${B}/g-ir-scanner-wrapper << EOF -#!/bin/sh -# This prevents g-ir-scanner from writing cache data to user's HOME dir -export GI_SCANNER_DISABLE_CACHE=1 - -g-ir-scanner --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH --use-binary-wrapper=${STAGING_BINDIR}/g-ir-scanner-qemuwrapper --use-ldd-wrapper=${STAGING_BINDIR}/g-ir-scanner-lddwrapper --add-include-path=${STAGING_DATADIR}/gir-1.0 --add-include-path=${STAGING_LIBDIR}/gir-1.0 "\$@" -EOF - chmod +x ${B}/g-ir-scanner-wrapper - - # Write out a wrapper for g-ir-compiler, which runs the target version of it through qemu. - # g-ir-compiler writes out the raw content of a C struct to disk, and therefore is architecture dependent. - cat > ${B}/g-ir-compiler-wrapper << EOF -#!/bin/sh -${STAGING_BINDIR}/g-ir-scanner-qemuwrapper ${STAGING_BINDIR}/g-ir-compiler "\$@" -EOF - chmod +x ${B}/g-ir-compiler-wrapper - - # Write out a wrapper to use instead of ldd, which does not work when a binary is built - # for a different architecture - cat > ${B}/g-ir-scanner-lddwrapper << EOF -#!/bin/sh -\$OBJDUMP -p "\$@" -EOF - chmod +x ${B}/g-ir-scanner-lddwrapper - - # Also tweak the target python scripts so that they don't refer to the - # native version of python binary (the solution is taken from glib-2.0 recipe) - sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in -} - -do_compile:prepend() { - # Needed to run g-ir unit tests, which won't be able to find the built libraries otherwise - export GIR_EXTRA_LIBS_PATH=$B/.libs -} - -do_install:prepend() { - # This prevents g-ir-scanner from writing cache data to $HOME - export GI_SCANNER_DISABLE_CACHE=1 -} - -# Our wrappers need to be available system-wide, because they will be used -# to build introspection files for all other gobject-based packages -do_install:append:class-target() { - install -d ${D}${bindir}/ - install ${B}/g-ir-scanner-qemuwrapper ${D}${bindir}/ - install ${B}/g-ir-scanner-wrapper ${D}${bindir}/ - install ${B}/g-ir-compiler-wrapper ${D}${bindir}/ - install ${B}/g-ir-scanner-lddwrapper ${D}${bindir}/ -} - -# we need target versions of introspection tools in sysroot so that they can be run via qemu -# when building introspection files in other packages -SYSROOT_DIRS:append:class-target = " ${bindir}" - -SYSROOT_PREPROCESS_FUNCS:append:class-target = " gi_binaries_sysroot_preprocess" -gi_binaries_sysroot_preprocess() { - # Tweak the binary names in the introspection pkgconfig file, so that it - # picks up our wrappers which do the cross-compile and qemu magic. - sed -i \ - -e "s|g_ir_scanner=.*|g_ir_scanner=${bindir}/g-ir-scanner-wrapper|" \ - -e "s|g_ir_compiler=.*|g_ir_compiler=${bindir}/g-ir-compiler-wrapper|" \ - ${SYSROOT_DESTDIR}${libdir}/pkgconfig/gobject-introspection-1.0.pc -} - -SYSROOT_PREPROCESS_FUNCS:append = " gi_ldsoconf_sysroot_preprocess" -gi_ldsoconf_sysroot_preprocess () { - mkdir -p ${SYSROOT_DESTDIR}${bindir} - dest=${SYSROOT_DESTDIR}${bindir}/postinst-ldsoconf-${PN} - echo "#!/bin/sh" > $dest - echo "mkdir -p ${STAGING_DIR_TARGET}${sysconfdir}" >> $dest - echo "echo ${base_libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest - echo "echo ${libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest - chmod 755 $dest -} - -# Remove wrapper files from the package, only used for cross-compiling -PACKAGE_PREPROCESS_FUNCS += "gi_package_preprocess" -gi_package_preprocess() { - rm -f ${PKGD}${bindir}/g-ir-scanner-qemuwrapper - rm -f ${PKGD}${bindir}/g-ir-scanner-wrapper - rm -f ${PKGD}${bindir}/g-ir-compiler-wrapper - rm -f ${PKGD}${bindir}/g-ir-scanner-lddwrapper -} - -SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir postinst-ldsoconf-${PN}" - -# .typelib files are needed at runtime and so they go to the main package -FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib" - -# .gir files go to dev package, as they're needed for developing (but not for running) -# things that depends on introspection. -FILES:${PN}-dev:append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir" -FILES:${PN}-dev:append = " ${datadir}/gir-*/*.rnc" - -# These are used by gobject-based packages -# to generate transient introspection binaries -FILES:${PN}-dev:append = " ${datadir}/gobject-introspection-1.0/gdump.c \ - ${datadir}/gobject-introspection-1.0/Makefile.introspection" - -# These are used by dependent packages (e.g. pygobject) to build their -# testsuites. -FILES:${PN}-dev:append = " ${datadir}/gobject-introspection-1.0/tests/*.c \ - ${datadir}/gobject-introspection-1.0/tests/*.h" - -FILES:${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/" -FILES:${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a" - -RDEPENDS:${PN} = "python3-pickle python3-xml" - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.74.0.bb b/poky/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.74.0.bb new file mode 100644 index 0000000000..ab9d2d35d9 --- /dev/null +++ b/poky/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.74.0.bb @@ -0,0 +1,194 @@ +SUMMARY = "Middleware layer between GObject-using C libraries and language bindings" +DESCRIPTION = "GObject Introspection is a project for providing machine \ +readable introspection data of the API of C libraries. This introspection \ +data can be used in several different use cases, for example automatic code \ +generation for bindings, API verification and documentation generation." +HOMEPAGE = "https://wiki.gnome.org/action/show/Projects/GObjectIntrospection" +BUGTRACKER = "https://gitlab.gnome.org/GNOME/gobject-introspection/issues" +SECTION = "libs" +LICENSE = "LGPL-2.0-or-later & GPL-2.0-or-later & MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=c434e8128a68bedd59b80b2ac1eb1c4a \ + file://tools/compiler.c;endline=20;md5=fc5007fc20022720e6c0b0cdde41fabd \ + file://giscanner/sourcescanner.c;endline=22;md5=194d6e0c1d00662f32d030ce44de8d39 \ + file://girepository/giregisteredtypeinfo.c;endline=21;md5=661847611ae6979465415f31a759ba27 \ + " + +SRC_URI = "${GNOME_MIRROR}/${BPN}/${@oe.utils.trim_version("${PV}", 2)}/${BPN}-${PV}.tar.xz \ + file://0001-g-ir-tool-template.in-fix-girdir-path.patch \ + " + +SRC_URI[sha256sum] = "347b3a719e68ba4c69ff2d57ee2689233ea8c07fc492205e573386779e42d653" + +SRC_URI:append:class-native = " file://0001-Relocate-the-repository-directory-for-native-builds.patch" + +inherit meson pkgconfig gtk-doc python3native qemu gobject-introspection-data upstream-version-is-even multilib_script + +GTKDOC_MESON_OPTION = "gtk_doc" + +MULTILIB_SCRIPTS = "${PN}:${bindir}/g-ir-annotation-tool ${PN}:${bindir}/g-ir-scanner" + +DEPENDS += " libffi zlib glib-2.0 python3 flex-native bison-native autoconf-archive" + +# target build needs qemu to run temporary introspection binaries created +# on the fly by g-ir-scanner and a native version of itself to run +# native versions of its own tools during build. +DEPENDS:append:class-target = " gobject-introspection-native qemu-native" + +# needed for writing out the qemu wrapper script +export STAGING_DIR_HOST +export B + +PACKAGECONFIG ?= "" +PACKAGECONFIG[doctool] = "-Ddoctool=enabled,-Ddoctool=disabled,python3-mako," + +# Configure target build to use native tools of itself and to use a qemu wrapper +# and optionally to generate introspection data +EXTRA_OEMESON:class-target = " \ + -Dgi_cross_use_prebuilt_gi=true \ + -Dgi_cross_binary_wrapper=${B}/g-ir-scanner-qemuwrapper \ + -Dgi_cross_ldd_wrapper=${B}/g-ir-scanner-lddwrapper \ + -Dgi_cross_pkgconfig_sysroot_path=${PKG_CONFIG_SYSROOT_DIR} \ + ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-Dbuild_introspection_data=true', '-Dbuild_introspection_data=false', d)} \ + ${@'-Dgir_dir_prefix=${libdir}' if d.getVar('MULTILIBS') else ''} \ +" + +do_configure:prepend:class-native() { + # Tweak the native python scripts so that they don't refer to the + # full path of native python binary (the solution is taken from glib-2.0 recipe) + # This removes the risk of exceeding Linux kernel's shebang line limit (128 bytes) + sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in +} + +do_configure:prepend:class-target() { + # Write out a qemu wrapper that will be given to gi-scanner so that it + # can run target helper binaries through that. + qemu_binary="${@qemu_wrapper_cmdline(d, '$STAGING_DIR_HOST', ['\\$GIR_EXTRA_LIBS_PATH','.libs','$STAGING_DIR_HOST/${libdir}','$STAGING_DIR_HOST/${base_libdir}'])}" + cat > ${B}/g-ir-scanner-qemuwrapper << EOF +#!/bin/sh +# Use a modules directory which doesn't exist so we don't load random things +# which may then get deleted (or their dependencies) and potentially segfault +export GIO_MODULE_DIR=${STAGING_LIBDIR}/gio/modules-dummy + +$qemu_binary "\$@" +if [ \$? -ne 0 ]; then + echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the recipe should help." + echo "(typically like this: GIR_EXTRA_LIBS_PATH=\"$""{B}/something/.libs\" )" + exit 1 +fi +EOF + chmod +x ${B}/g-ir-scanner-qemuwrapper + + # Write out a wrapper for g-ir-scanner itself, which will be used when building introspection files + # for glib-based packages. This wrapper calls the native version of the scanner, and tells it to use + # a qemu wrapper for running transient target binaries produced by the scanner, and an include directory + # from the target sysroot. + cat > ${B}/g-ir-scanner-wrapper << EOF +#!/bin/sh +# This prevents g-ir-scanner from writing cache data to user's HOME dir +export GI_SCANNER_DISABLE_CACHE=1 + +g-ir-scanner --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH --use-binary-wrapper=${STAGING_BINDIR}/g-ir-scanner-qemuwrapper --use-ldd-wrapper=${STAGING_BINDIR}/g-ir-scanner-lddwrapper --add-include-path=${STAGING_DATADIR}/gir-1.0 --add-include-path=${STAGING_LIBDIR}/gir-1.0 "\$@" +EOF + chmod +x ${B}/g-ir-scanner-wrapper + + # Write out a wrapper for g-ir-compiler, which runs the target version of it through qemu. + # g-ir-compiler writes out the raw content of a C struct to disk, and therefore is architecture dependent. + cat > ${B}/g-ir-compiler-wrapper << EOF +#!/bin/sh +${STAGING_BINDIR}/g-ir-scanner-qemuwrapper ${STAGING_BINDIR}/g-ir-compiler "\$@" +EOF + chmod +x ${B}/g-ir-compiler-wrapper + + # Write out a wrapper to use instead of ldd, which does not work when a binary is built + # for a different architecture + cat > ${B}/g-ir-scanner-lddwrapper << EOF +#!/bin/sh +\$OBJDUMP -p "\$@" +EOF + chmod +x ${B}/g-ir-scanner-lddwrapper + + # Also tweak the target python scripts so that they don't refer to the + # native version of python binary (the solution is taken from glib-2.0 recipe) + sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/tools/g-ir-tool-template.in +} + +do_compile:prepend() { + # Needed to run g-ir unit tests, which won't be able to find the built libraries otherwise + export GIR_EXTRA_LIBS_PATH=$B/.libs +} + +do_install:prepend() { + # This prevents g-ir-scanner from writing cache data to $HOME + export GI_SCANNER_DISABLE_CACHE=1 +} + +# Our wrappers need to be available system-wide, because they will be used +# to build introspection files for all other gobject-based packages +do_install:append:class-target() { + install -d ${D}${bindir}/ + install ${B}/g-ir-scanner-qemuwrapper ${D}${bindir}/ + install ${B}/g-ir-scanner-wrapper ${D}${bindir}/ + install ${B}/g-ir-compiler-wrapper ${D}${bindir}/ + install ${B}/g-ir-scanner-lddwrapper ${D}${bindir}/ +} + +# we need target versions of introspection tools in sysroot so that they can be run via qemu +# when building introspection files in other packages +SYSROOT_DIRS:append:class-target = " ${bindir}" + +SYSROOT_PREPROCESS_FUNCS:append:class-target = " gi_binaries_sysroot_preprocess" +gi_binaries_sysroot_preprocess() { + # Tweak the binary names in the introspection pkgconfig file, so that it + # picks up our wrappers which do the cross-compile and qemu magic. + sed -i \ + -e "s|g_ir_scanner=.*|g_ir_scanner=${bindir}/g-ir-scanner-wrapper|" \ + -e "s|g_ir_compiler=.*|g_ir_compiler=${bindir}/g-ir-compiler-wrapper|" \ + ${SYSROOT_DESTDIR}${libdir}/pkgconfig/gobject-introspection-1.0.pc +} + +SYSROOT_PREPROCESS_FUNCS:append = " gi_ldsoconf_sysroot_preprocess" +gi_ldsoconf_sysroot_preprocess () { + mkdir -p ${SYSROOT_DESTDIR}${bindir} + dest=${SYSROOT_DESTDIR}${bindir}/postinst-ldsoconf-${PN} + echo "#!/bin/sh" > $dest + echo "mkdir -p ${STAGING_DIR_TARGET}${sysconfdir}" >> $dest + echo "echo ${base_libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest + echo "echo ${libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest + chmod 755 $dest +} + +# Remove wrapper files from the package, only used for cross-compiling +PACKAGE_PREPROCESS_FUNCS += "gi_package_preprocess" +gi_package_preprocess() { + rm -f ${PKGD}${bindir}/g-ir-scanner-qemuwrapper + rm -f ${PKGD}${bindir}/g-ir-scanner-wrapper + rm -f ${PKGD}${bindir}/g-ir-compiler-wrapper + rm -f ${PKGD}${bindir}/g-ir-scanner-lddwrapper +} + +SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir postinst-ldsoconf-${PN}" + +# .typelib files are needed at runtime and so they go to the main package +FILES:${PN}:append = " ${libdir}/girepository-*/*.typelib" + +# .gir files go to dev package, as they're needed for developing (but not for running) +# things that depends on introspection. +FILES:${PN}-dev:append = " ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir" +FILES:${PN}-dev:append = " ${datadir}/gir-*/*.rnc" + +# These are used by gobject-based packages +# to generate transient introspection binaries +FILES:${PN}-dev:append = " ${datadir}/gobject-introspection-1.0/gdump.c \ + ${datadir}/gobject-introspection-1.0/Makefile.introspection" + +# These are used by dependent packages (e.g. pygobject) to build their +# testsuites. +FILES:${PN}-dev:append = " ${datadir}/gobject-introspection-1.0/tests/*.c \ + ${datadir}/gobject-introspection-1.0/tests/*.h" + +FILES:${PN}-dbg += "${libdir}/gobject-introspection/giscanner/.debug/" +FILES:${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a" + +RDEPENDS:${PN} = "python3-pickle python3-xml" + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-gnome/gtk+/gtk+3.inc b/poky/meta/recipes-gnome/gtk+/gtk+3.inc index 7d50d7bd2e..1d726b5696 100644 --- a/poky/meta/recipes-gnome/gtk+/gtk+3.inc +++ b/poky/meta/recipes-gnome/gtk+/gtk+3.inc @@ -6,12 +6,11 @@ HOMEPAGE = "http://www.gtk.org" BUGTRACKER = "https://bugzilla.gnome.org/" SECTION = "libs" -DEPENDS = "glib-2.0 cairo pango atk jpeg libpng gdk-pixbuf \ - gdk-pixbuf-native" +DEPENDS = "glib-2.0 cairo pango atk jpeg libpng gdk-pixbuf gdk-pixbuf-native" LICENSE = "LGPL-2.0-only & LGPL-2.0-or-later & LGPL-2.1-or-later" -inherit autotools gettext pkgconfig gtk-doc update-alternatives gtk-immodules-cache gsettings features_check gobject-introspection +inherit meson gettext pkgconfig gtk-doc update-alternatives gtk-immodules-cache gsettings features_check gobject-introspection BBCLASSEXTEND = "native nativesdk" @@ -22,43 +21,28 @@ UPSTREAM_CHECK_REGEX = "[^\d\.](?P3\.([1-8]?[02468])+(\.\d+)+)\.tar" ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" -# This should be in autotools.bbclass, but until something elses uses it putting -# it here avoids rebuilding everything. -export PKG_CONFIG_FOR_BUILD = "${STAGING_BINDIR_NATIVE}/pkg-config-native" - do_configure:prepend() { - #delete a file that will get confused with generated one in ${B} - rm -f ${S}/gtk/gtktypefuncs.c - # These files are generated by wayland-scanner but will race over modification # time between the copies in the sysroot from wayland-protocols and the copy # in the source tree. Solve the race by deleting so they need to be regenerated. - # 3.24.22 will not be shipping these files so this can be deleted then: - # https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2183 - rm -f ${S}/modules/input/text-input-unstable-v3*.[ch] + rm -f ${S}/modules/input/*-text-input-*.[ch] } -EXTRA_OECONF += " \ - --disable-glibtest \ - --disable-xinerama \ - --enable-modules \ - ${@bb.utils.contains("DISTRO_FEATURES", "x11", "", "--disable-gtk-doc", d)} \ - " +GTKDOC_MESON_OPTION = 'gtk_doc' -do_compile:prepend() { - export GIR_EXTRA_LIBS_PATH="${B}/gdk/.libs" -} +EXTRA_OEMESON = "-Dxinerama=no -Dtests=false" +EXTRA_OEMESON:append:class-native = " -Ddemos=false -Dexamples=false" PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl wayland x11', d)}" PACKAGECONFIG:class-native = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" -PACKAGECONFIG[x11] = "--enable-x11-backend,--disable-x11-backend,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes" +PACKAGECONFIG[x11] = "-Dx11_backend=true,-Dx11_backend=false,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes" # this is provided by oe-core patch that removes epoxy/gl dependency from a X11 build -PACKAGECONFIG[opengl] = "--enable-opengl,--disable-opengl,libepoxy" -PACKAGECONFIG[wayland] = "--enable-wayland-backend,--disable-wayland-backend,wayland wayland-protocols libxkbcommon virtual/egl virtual/libgles2 wayland-native" -PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups" -PACKAGECONFIG[colord] = "--enable-colord,--disable-colord,colord" +PACKAGECONFIG[opengl] = "-Dopengl=true,-Dopengl=false,libepoxy" +PACKAGECONFIG[wayland] = "-Dwayland_backend=true,-Dwayland_backend=false,wayland wayland-protocols libxkbcommon virtual/egl virtual/libgles2 wayland-native" +PACKAGECONFIG[cups] = "-Dprint_backends=cups,-Dprint_backends=file,cups" +PACKAGECONFIG[colord] = "-Dcolord=yes,-Dcolord=no,colord" prepare_gtk_scripts() { mv ${D}${bindir}/gtk-update-icon-cache ${D}${bindir}/gtk-update-icon-cache-3.0 @@ -101,7 +85,8 @@ FILES:${PN}-demo = "${bindir}/gtk3-demo \ FILES:${PN}:append = " ${bindir}/gtk-update-icon-cache-3.0 \ ${bindir}/gtk-query-immodules-3.0 \ ${bindir}/gtk-launch \ - ${datadir}/themes ${sysconfdir} ${datadir}/glib-2.0/schemas/ \ + ${datadir}/themes ${datadir}/gtk-3.0/emoji \ + ${sysconfdir} ${datadir}/glib-2.0/schemas/ \ ${libdir}/gtk-3.0/${LIBV}/engines/libpixmap.so \ ${libdir}/gtk-3.0/modules/*.so" diff --git a/poky/meta/recipes-gnome/gtk+/gtk+3/0001-meson.build-build-introspection-according-to-option-.patch b/poky/meta/recipes-gnome/gtk+/gtk+3/0001-meson.build-build-introspection-according-to-option-.patch new file mode 100644 index 0000000000..11effd421f --- /dev/null +++ b/poky/meta/recipes-gnome/gtk+/gtk+3/0001-meson.build-build-introspection-according-to-option-.patch @@ -0,0 +1,34 @@ +From 6e533d5598ef875f30b84d931aae11b768465869 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Mon, 2 Jan 2023 15:00:02 +0100 +Subject: [PATCH] meson.build: build introspection according to option only + +The way the check is written, if the build is native, then the +introspection option has no effect. + +Particularly yocto project does want to disable introspection in +native builds and enable it in cross builds (both via the option), +and without this patch the former is not possible. + +Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5382] +Signed-off-by: Alexander Kanavin +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index bfc33af0f6..94ffaa7769 100644 +--- a/meson.build ++++ b/meson.build +@@ -854,7 +854,7 @@ endif + + # Introspection + gir = find_program('g-ir-scanner', required : get_option('introspection')) +-build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection')) ++build_gir = gir.found() and get_option('introspection') + + subdir('gdk') + subdir('gtk') +-- +2.30.2 + diff --git a/poky/meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch b/poky/meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch deleted file mode 100644 index 80dc2d7a05..0000000000 --- a/poky/meta/recipes-gnome/gtk+/gtk+3/0002-Do-not-try-to-initialize-GL-without-libGL.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 6575ab0f0e8c1bba033ad1616511e37a2ec995ff Mon Sep 17 00:00:00 2001 -From: Jussi Kukkonen -Date: Fri, 16 Oct 2015 16:35:16 +0300 -Subject: [PATCH] Do not try to initialize GL without libGL - -_gdk_x11_screen_update_visuals_for_gl() will end up calling epoxys -GLX api which will exit() if libGL.so.1 is not present. We do not -want that to happen and we don't want every app to have to set -"GDK_GL=disabled" environment variable: so use #ifdef set based on -opengl distro feature. - -Upstream is not interested in the fix as it is: Either epoxy should be -fixed (to not exit) or GTK+ possibly could do some additional probing -before calling epoxy APIs. - -Upstream-Status: Denied -Signed-off-by: Jussi Kukkonen - ---- - configure.ac | 6 ++++++ - gdk/x11/gdkvisual-x11.c | 5 +++++ - 2 files changed, 11 insertions(+) - -diff --git a/configure.ac b/configure.ac -index e9f5583..bd651bb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -346,6 +346,12 @@ AC_ARG_ENABLE(cloudproviders, - [AS_HELP_STRING([--enable-cloudproviders], - [enable libcloudproviders integration])], - [cloudproviders_set=yes]) -+AC_ARG_ENABLE(glx, -+ [AS_HELP_STRING([--enable-glx], -+ [When enabled Gdk will try to initialize GLX])]) -+AS_IF([test "x$enable_glx" != "xno"], [ -+ AC_DEFINE([HAVE_GLX], [], [GLX will be available at runtime]) -+]) - - AC_ARG_ENABLE(profiler, - [AS_HELP_STRING([--enable-profiler], -diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c -index 81479d8..3c8c5c0 100644 ---- a/gdk/x11/gdkvisual-x11.c -+++ b/gdk/x11/gdkvisual-x11.c -@@ -306,7 +306,12 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen) - /* If GL is available we want to pick better default/rgba visuals, - as we care about glx details such as alpha/depth/stencil depth, - stereo and double buffering */ -+ /* update_visuals_for_gl() will end up calling epoxy GLX api which -+ will exit if libgl is not there: so only do this if we know GL -+ is available */ -+#ifdef HAVE_GLX - _gdk_x11_screen_update_visuals_for_gl (screen); -+#endif - } - - gint diff --git a/poky/meta/recipes-gnome/gtk+/gtk+3/0003-Add-disable-opengl-configure-option.patch b/poky/meta/recipes-gnome/gtk+/gtk+3/0003-Add-disable-opengl-configure-option.patch deleted file mode 100644 index 35cbab8761..0000000000 --- a/poky/meta/recipes-gnome/gtk+/gtk+3/0003-Add-disable-opengl-configure-option.patch +++ /dev/null @@ -1,872 +0,0 @@ -From eef50c94587fc30cd624adb5eb213eb9fa663dc1 Mon Sep 17 00:00:00 2001 -From: Jussi Kukkonen -Date: Tue, 21 Jun 2016 15:11:39 +0300 -Subject: [PATCH] Add --disable-opengl configure option - ---disable-opengl will remove the dependency on libepoxy and on the -OpenGL APIs. This is useful for those who want to keep using gtk+3 -without the "opengl" distro feature. - -GtkGLArea is still part of the API (it just doesn't work) even when -OpenGL is disabled. GdkX11GLContext was removed from the Gtk API -completely: that object exposes GL API elements so it had to be at -the very least modified. - -The patch is _not_ great from a maintenance point of view and -modifying the library API is also a fairly nasty thing to do. -Next long term release (4.0) will require alternative solutions -as it actually will depend on OpenGL. - -Upstream-Status: Inappropriate [Evil eye expected from upstream] -Signed-off-by: Jussi Kukkonen - ---- - configure.ac | 13 ++++- - demos/gtk-demo/glarea.c | 14 ++++++ - docs/tools/Makefile.am | 9 +++- - docs/tools/widgets.c | 4 +- - gdk/Makefile.am | 8 ++- - gdk/gdkdisplay.c | 4 +- - gdk/gdkgl.c | 10 ++++ - gdk/gdkglcontext.c | 6 +++ - gdk/gdkwindow.c | 13 +++++ - gdk/x11/Makefile.am | 30 +++++++++-- - gdk/x11/gdkdisplay-x11.c | 6 ++- - gdk/x11/gdkscreen-x11.c | 5 ++ - gdk/x11/gdkwindow-x11.c | 4 ++ - gdk/x11/gdkx-autocleanups.h | 2 + - gdk/x11/{gdkx.h => gdkx-with-gl-context.h} | 1 - - gdk/x11/gdkx-without-gl-context.h | 58 ++++++++++++++++++++++ - gtk/Makefile.am | 2 +- - gtk/gtkglarea.c | 20 +++++++- - gtk/inspector/general.c | 6 +++ - tests/Makefile.am | 10 ++-- - testsuite/gtk/objects-finalize.c | 2 + - 21 files changed, 208 insertions(+), 19 deletions(-) - rename gdk/x11/{gdkx.h => gdkx-with-gl-context.h} (98%) - create mode 100644 gdk/x11/gdkx-without-gl-context.h - -diff --git a/configure.ac b/configure.ac -index 851bcbf..6cbf6a2 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -346,6 +346,15 @@ AC_ARG_ENABLE(cloudproviders, - [AS_HELP_STRING([--enable-cloudproviders], - [enable libcloudproviders integration])], - [cloudproviders_set=yes]) -+AC_ARG_ENABLE(opengl, -+ [AS_HELP_STRING([--enable-opengl], -+ [When enabled, Gtk+ will use libepoxy and exposes GtkGLArea widget ])]) -+AS_IF([test "x$enable_opengl" != "xno"], [ -+ AC_DEFINE([HAVE_OPENGL], [1], [libepoxy and opengl APIs are available at buildtime]) -+ EPOXY_PACKAGES="epoxy >= epoxy_required_version" -+]) -+AM_CONDITIONAL([HAVE_OPENGL],[test "x$enable_opengl" != "xno"]) -+ - AC_ARG_ENABLE(glx, - [AS_HELP_STRING([--enable-glx], - [When enabled Gdk will try to initialize GLX])]) -@@ -1345,7 +1354,7 @@ CFLAGS="$saved_cflags" - LDFLAGS="$saved_ldflags" - - GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 >= gdk_pixbuf_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version" --GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends epoxy >= epoxy_required_version $CLOUDPROVIDER_PACKAGES $PROFILER_PACKAGES fribidi >= fribidi_required_version" -+GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends $EPOXY_PACKAGES $CLOUDPROVIDER_PACKAGES $PROFILER_PACKAGES fribidi >= fribidi_required_version" - - PKG_CHECK_MODULES(GDK_DEP, $GDK_PACKAGES $GDK_PRIVATE_PACKAGES) - GDK_DEP_LIBS="$GDK_EXTRA_LIBS $GDK_DEP_LIBS $MATH_LIB" -@@ -1379,7 +1388,7 @@ fi - PKG_CHECK_MODULES(ATK, $ATK_PACKAGES) - - GTK_PACKAGES="atk >= atk_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version gdk-pixbuf-2.0 >= gdk_pixbuf_required_version gio-2.0 >= glib_required_version" --GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES epoxy >= epoxy_required_version fribidi >= fribidi_required_version" -+GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES $EPOXY_PACKAGES fribidi >= fribidi_required_version" - if test "x$enable_x11_backend" = xyes -o "x$enable_wayland_backend" = xyes; then - GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2" - fi -diff --git a/demos/gtk-demo/glarea.c b/demos/gtk-demo/glarea.c -index b51e4ae..82409c7 100644 ---- a/demos/gtk-demo/glarea.c -+++ b/demos/gtk-demo/glarea.c -@@ -3,9 +3,12 @@ - * GtkGLArea is a widget that allows custom drawing using OpenGL calls. - */ - -+#include "config.h" - #include - #include -+#if HAVE_OPENGL - #include -+#endif - - static GtkWidget *demo_window = NULL; - -@@ -23,6 +26,8 @@ enum { - /* Rotation angles on each axis */ - static float rotation_angles[N_AXIS] = { 0.0 }; - -+#ifdef HAVE_OPENGL -+ - /* The object we are drawing */ - static const GLfloat vertex_data[] = { - 0.f, 0.5f, 0.f, 1.f, -@@ -215,6 +220,7 @@ compute_mvp (float *res, - static GLuint position_buffer; - static GLuint program; - static GLuint mvp_location; -+#endif - - /* We need to set up our state when we realize the GtkGLArea widget */ - static void -@@ -241,8 +247,10 @@ realize (GtkWidget *widget) - fragment_path = "/glarea/glarea-gl.fs.glsl"; - } - -+#ifdef HAVE_OPENGL - init_buffers (&position_buffer, NULL); - init_shaders (vertex_path, fragment_path, &program, &mvp_location); -+#endif - } - - /* We should tear down the state when unrealizing */ -@@ -254,10 +262,13 @@ unrealize (GtkWidget *widget) - if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL) - return; - -+#ifdef HAVE_OPENGL - glDeleteBuffers (1, &position_buffer); - glDeleteProgram (program); -+#endif - } - -+#ifdef HAVE_OPENGL - static void - draw_triangle (void) - { -@@ -290,6 +301,7 @@ draw_triangle (void) - glBindBuffer (GL_ARRAY_BUFFER, 0); - glUseProgram (0); - } -+#endif - - static gboolean - render (GtkGLArea *area, -@@ -298,6 +310,7 @@ render (GtkGLArea *area, - if (gtk_gl_area_get_error (area) != NULL) - return FALSE; - -+#ifdef HAVE_OPENGL - /* Clear the viewport */ - glClearColor (0.5, 0.5, 0.5, 1.0); - glClear (GL_COLOR_BUFFER_BIT); -@@ -307,6 +320,7 @@ render (GtkGLArea *area, - - /* Flush the contents of the pipeline */ - glFlush (); -+#endif - - return TRUE; - } -diff --git a/docs/tools/Makefile.am b/docs/tools/Makefile.am -index bec43e3..189e8fc 100644 ---- a/docs/tools/Makefile.am -+++ b/docs/tools/Makefile.am -@@ -9,13 +9,18 @@ AM_CPPFLAGS = \ - $(GTK_DEBUG_FLAGS) \ - $(GTK_DEP_CFLAGS) - -+if HAVE_OPENGL -+GEARS_LDADD = $(top_builddir)/tests/gtkgears.o -+endif -+ - DEPS = \ -- $(top_builddir)/gtk/libgtk-3.la -+ $(top_builddir)/gtk/libgtk-3.la \ -+ $(GEARS_LDADD) - - LDADDS = \ - $(top_builddir)/gtk/libgtk-3.la \ - $(top_builddir)/gdk/libgdk-3.la \ -- $(top_builddir)/tests/gtkgears.o \ -+ $(GEARS_LDADD) \ - $(GTK_DEP_LIBS) \ - $(GDK_DEP_LIBS) \ - -lm -diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c -index 932daf1..54239d6 100644 ---- a/docs/tools/widgets.c -+++ b/docs/tools/widgets.c -@@ -1526,9 +1526,11 @@ create_gl_area (void) - widget = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN); - -+#ifdef HAVE_OPENGL - gears = gtk_gears_new (); - gtk_container_add (GTK_CONTAINER (widget), gears); -- -+#endif -+ - info = new_widget_info ("glarea", widget, MEDIUM); - - return info; -diff --git a/gdk/Makefile.am b/gdk/Makefile.am -index 710a548..b45f631 100644 ---- a/gdk/Makefile.am -+++ b/gdk/Makefile.am -@@ -274,7 +274,6 @@ x11_introspection_files = \ - x11/gdkeventsource.c \ - x11/gdkeventtranslator.c \ - x11/gdkgeometry-x11.c \ -- x11/gdkglcontext-x11.c \ - x11/gdkkeys-x11.c \ - x11/gdkmain-x11.c \ - x11/gdkmonitor-x11.c \ -@@ -300,7 +299,6 @@ x11_introspection_files = \ - x11/gdkx11display.h \ - x11/gdkx11displaymanager.h \ - x11/gdkx11dnd.h \ -- x11/gdkx11glcontext.h \ - x11/gdkx11keys.h \ - x11/gdkx11monitor.h \ - x11/gdkx11property.h \ -@@ -310,6 +308,12 @@ x11_introspection_files = \ - x11/gdkx11visual.h \ - x11/gdkx11window.h - -+if HAVE_OPENGL -+x11_introspection_files += \ -+ x11/gdkglcontext-x11.c \ -+ x11/gdkx11glcontext.h -+endif -+ - GdkX11-3.0.gir: libgdk-3.la Gdk-3.0.gir Makefile - GdkX11_3_0_gir_SCANNERFLAGS = \ - --identifier-prefix=Gdk \ -diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c -index 748f548..911ab2a 100644 ---- a/gdk/gdkdisplay.c -+++ b/gdk/gdkdisplay.c -@@ -2420,7 +2420,9 @@ gboolean - gdk_display_make_gl_context_current (GdkDisplay *display, - GdkGLContext *context) - { -- return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context); -+ if (GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current) -+ return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context); -+ return FALSE; - } - - GdkRenderingMode -diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c -index 9690077..55f85ef 100644 ---- a/gdk/gdkgl.c -+++ b/gdk/gdkgl.c -@@ -26,7 +26,9 @@ - # include "win32/gdkwin32.h" - #endif - -+#ifdef HAVE_OPENGL - #include -+#endif - #include - #include - -@@ -40,6 +42,7 @@ gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface, - g_object_ref (window), g_object_unref); - } - -+#ifdef HAVE_OPENGL - static const char * - get_vertex_type_name (int type) - { -@@ -212,6 +215,7 @@ use_texture_rect_program (GdkGLContextPaintData *paint_data) - glUseProgram (paint_data->current_program->program); - } - } -+#endif - - void - gdk_gl_texture_quads (GdkGLContext *paint_context, -@@ -220,6 +224,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context, - GdkTexturedQuad *quads, - gboolean flip_colors) - { -+#ifdef HAVE_OPENGL - GdkGLContextPaintData *paint_data = gdk_gl_context_get_paint_data (paint_context); - GdkGLContextProgram *program; - GdkWindow *window = gdk_gl_context_get_window (paint_context); -@@ -293,6 +298,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context, - - glDisableVertexAttribArray (program->position_location); - glDisableVertexAttribArray (program->uv_location); -+#endif - } - - /* x,y,width,height describes a rectangle in the gl render buffer -@@ -341,6 +347,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr, - int width, - int height) - { -+#ifdef HAVE_OPENGL - GdkGLContext *paint_context; - cairo_surface_t *image; - cairo_matrix_t matrix; -@@ -718,6 +725,7 @@ out: - if (clip_region) - cairo_region_destroy (clip_region); - -+#endif - } - - /* This is always called with the paint context current */ -@@ -725,6 +733,7 @@ void - gdk_gl_texture_from_surface (cairo_surface_t *surface, - cairo_region_t *region) - { -+#ifdef HAVE_OPENGL - GdkGLContext *paint_context; - cairo_surface_t *image; - double device_x_offset, device_y_offset; -@@ -825,4 +834,5 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface, - - glDisable (GL_SCISSOR_TEST); - glDeleteTextures (1, &texture_id); -+#endif - } -diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c -index 3b23639..1f04f8e 100644 ---- a/gdk/gdkglcontext.c -+++ b/gdk/gdkglcontext.c -@@ -85,7 +85,9 @@ - #include "gdkintl.h" - #include "gdk-private.h" - -+#ifdef HAVE_OPENGL - #include -+#endif - - typedef struct { - GdkDisplay *display; -@@ -243,6 +245,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context, - int height, - guint texture_target) - { -+#ifdef HAVE_OPENGL - GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); - - g_return_if_fail (GDK_IS_GL_CONTEXT (context)); -@@ -286,6 +289,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context, - glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (unsigned char*) data + (i * stride)); - } - } -+#endif - } - - static gboolean -@@ -774,6 +778,7 @@ gdk_gl_context_realize (GdkGLContext *context, - static void - gdk_gl_context_check_extensions (GdkGLContext *context) - { -+#ifdef HAVE_OPENGL - GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); - gboolean has_npot, has_texture_rectangle; - -@@ -853,6 +858,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context) - priv->use_texture_rectangle ? "yes" : "no")); - - priv->extensions_checked = TRUE; -+#endif - } - - /** -diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c -index 2de8ba4..1883a79 100644 ---- a/gdk/gdkwindow.c -+++ b/gdk/gdkwindow.c -@@ -45,7 +45,9 @@ - - #include - -+#ifdef HAVE_OPENGL - #include -+#endif - - /* for the use of round() */ - #include "fallback-c89.c" -@@ -2844,6 +2846,13 @@ gdk_window_get_paint_gl_context (GdkWindow *window, - { - GError *internal_error = NULL; - -+#ifndef HAVE_OPENGL -+ g_set_error_literal (error, GDK_GL_ERROR, -+ GDK_GL_ERROR_NOT_AVAILABLE, -+ _("GL support disabled with --disable-opengl")); -+ return NULL; -+#endif -+ - if (_gdk_gl_flags & GDK_GL_DISABLE) - { - g_set_error_literal (error, GDK_GL_ERROR, -@@ -2979,6 +2988,7 @@ gdk_window_begin_paint_internal (GdkWindow *window, - } - else - { -+#ifdef HAVE_OPENGL - gdk_gl_context_make_current (context); - /* With gl we always need a surface to combine the gl - drawing with the native drawing. */ -@@ -2993,6 +3003,7 @@ gdk_window_begin_paint_internal (GdkWindow *window, - glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - glViewport (0, 0, ww, wh); -+#endif - } - } - -@@ -3056,6 +3067,7 @@ gdk_window_end_paint_internal (GdkWindow *window) - - gdk_gl_context_make_current (window->gl_paint_context); - -+#ifdef HAVE_OPENGL - if (!cairo_region_is_empty (opaque_region)) - gdk_gl_texture_from_surface (window->current_paint.surface, - opaque_region); -@@ -3066,6 +3078,7 @@ gdk_window_end_paint_internal (GdkWindow *window) - window->current_paint.need_blend_region); - glDisable(GL_BLEND); - } -+#endif - - cairo_region_destroy (opaque_region); - -diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am -index 32b1f24..6352313 100644 ---- a/gdk/x11/Makefile.am -+++ b/gdk/x11/Makefile.am -@@ -40,8 +40,6 @@ libgdk_x11_la_SOURCES = \ - gdkeventtranslator.c \ - gdkeventtranslator.h \ - gdkgeometry-x11.c \ -- gdkglcontext-x11.c \ -- gdkglcontext-x11.h \ - gdkkeys-x11.c \ - gdkmain-x11.c \ - gdkmonitor-x11.c \ -@@ -56,14 +54,32 @@ libgdk_x11_la_SOURCES = \ - gdkwindow-x11.h \ - gdkxftdefaults.c \ - gdkxid.c \ -- gdkx.h \ - gdkprivate-x11.h \ - xsettings-client.h \ - xsettings-client.c - -+if HAVE_OPENGL -+libgdk_x11_la_SOURCES += \ -+ gdkglcontext-x11.c \ -+ gdkglcontext-x11.h -+endif -+ - libgdkinclude_HEADERS = \ - gdkx.h - -+if HAVE_OPENGL -+GDKX_HEADER = gdkx-with-gl-context.h -+else -+GDKX_HEADER = gdkx-without-gl-context.h -+endif -+ -+BUILT_SOURCES = gdkx.h -+ -+.PHONY: gdkx.h -+gdkx.h: -+ $(AM_V_GEN) cd $(srcdir) \ -+ && (cmp -s $(GDKX_HEADER) gdkx.h || cp $(GDKX_HEADER) gdkx.h ) -+ - libgdkx11include_HEADERS = \ - gdkx-autocleanups.h \ - gdkx11applaunchcontext.h \ -@@ -77,7 +93,6 @@ libgdkx11include_HEADERS = \ - gdkx11display.h \ - gdkx11displaymanager.h \ - gdkx11dnd.h \ -- gdkx11glcontext.h \ - gdkx11keys.h \ - gdkx11monitor.h \ - gdkx11property.h \ -@@ -87,10 +102,17 @@ libgdkx11include_HEADERS = \ - gdkx11visual.h \ - gdkx11window.h - -+if HAVE_OPENGL -+libgdkx11include_HEADERS += gdkx11glcontext.h -+endif -+ - # We need to include all these C files here since the conditionals - # don't seem to be correctly expanded for the dist files. - EXTRA_DIST += \ -+ gdkx.h \ - gdksettings.c \ - meson.build - -+MAINTAINERCLEANFILES = gdkx.h -+ - -include $(top_srcdir)/git.mk -diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c -index 7e08f47..30fd7b6 100644 ---- a/gdk/x11/gdkdisplay-x11.c -+++ b/gdk/x11/gdkdisplay-x11.c -@@ -37,7 +37,9 @@ - #include "gdkdisplay-x11.h" - #include "gdkprivate-x11.h" - #include "gdkscreen-x11.h" -+#ifdef HAVE_OPENGL - #include "gdkglcontext-x11.h" -+#endif - #include "gdk-private.h" - #include "gdkprofilerprivate.h" - -@@ -3191,7 +3193,9 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class) - display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list; - display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target; - -- display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current; -+#ifdef HAVE_OPENGL -+ display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current; -+#endif - - display_class->get_default_seat = gdk_x11_display_get_default_seat; - -diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c -index bb4df05..46f5349 100644 ---- a/gdk/x11/gdkscreen-x11.c -+++ b/gdk/x11/gdkscreen-x11.c -@@ -1827,3 +1827,8 @@ gdk_x11_screen_get_current_desktop (GdkScreen *screen) - { - return get_netwm_cardinal_property (screen, "_NET_CURRENT_DESKTOP"); - } -+ -+#ifndef HAVE_OPENGL -+/* Function from in gdk/x11/gdkglcontext-x11.c */ -+void _gdk_x11_screen_update_visuals_for_gl (GdkScreen *screen) {} -+#endif -diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c -index 721d9bb..8e87acc 100644 ---- a/gdk/x11/gdkwindow-x11.c -+++ b/gdk/x11/gdkwindow-x11.c -@@ -36,7 +36,9 @@ - #include "gdkasync.h" - #include "gdkeventsource.h" - #include "gdkdisplay-x11.h" -+#ifdef HAVE_OPENGL - #include "gdkglcontext-x11.h" -+#endif - #include "gdkprivate-x11.h" - #include "gdk-private.h" - -@@ -5881,7 +5883,9 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass) - impl_class->set_opaque_region = gdk_x11_window_set_opaque_region; - impl_class->set_shadow_width = gdk_x11_window_set_shadow_width; - impl_class->show_window_menu = gdk_x11_window_show_window_menu; -+#ifdef HAVE_OPENGL - impl_class->create_gl_context = gdk_x11_window_create_gl_context; - impl_class->invalidate_for_new_frame = gdk_x11_window_invalidate_for_new_frame; -+#endif - impl_class->get_unscaled_size = gdk_x11_window_get_unscaled_size; - } -diff --git a/gdk/x11/gdkx-autocleanups.h b/gdk/x11/gdkx-autocleanups.h -index edb0ea7..a317d61 100644 ---- a/gdk/x11/gdkx-autocleanups.h -+++ b/gdk/x11/gdkx-autocleanups.h -@@ -30,7 +30,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref) - G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref) - G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DisplayManager, g_object_unref) - G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref) -+#ifdef HAVE_OPENGL - G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref) -+#endif - G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref) - G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref) - G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Visual, g_object_unref) -diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx-with-gl-context.h -similarity index 98% -rename from gdk/x11/gdkx.h -rename to gdk/x11/gdkx-with-gl-context.h -index 1f64bcc..ae05fa6 100644 ---- a/gdk/x11/gdkx.h -+++ b/gdk/x11/gdkx-with-gl-context.h -@@ -45,7 +45,6 @@ - #include - #include - #include --#include - #include - #include - #include -diff --git a/gdk/x11/gdkx-without-gl-context.h b/gdk/x11/gdkx-without-gl-context.h -new file mode 100644 -index 0000000..c9e2617 ---- /dev/null -+++ b/gdk/x11/gdkx-without-gl-context.h -@@ -0,0 +1,58 @@ -+/* GDK - The GIMP Drawing Kit -+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see . -+ */ -+ -+/* -+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS -+ * file for a list of people on the GTK+ Team. See the ChangeLog -+ * files for a list of changes. These files are distributed with -+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. -+ */ -+ -+#ifndef __GDK_X_H__ -+#define __GDK_X_H__ -+ -+#include -+ -+#include -+#include -+ -+#define __GDKX_H_INSIDE__ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#undef __GDKX_H_INSIDE__ -+ -+#endif /* __GDK_X_H__ */ -diff --git a/gtk/Makefile.am b/gtk/Makefile.am -index 074fb35..4fa9eb6 100644 ---- a/gtk/Makefile.am -+++ b/gtk/Makefile.am -@@ -1457,7 +1457,7 @@ gtktypefuncs.inc: stamp-gtktypebuiltins.h stamp-gtkprivatetypebuiltins.h $(top_s - ${CPP} $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \ - $(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \ - sort | uniq | \ -- $(SED) '{ s/^/*tp++ = /; s/$$/();/; s/^.*\(gdk_x11\|gtk_plug_\|gtk_socket_\).*$$/#ifdef GDK_WINDOWING_X11\n&\n#endif/; }' >> xgen-gtf \ -+ $(SED) '{ s/^/*tp++ = /; s/$$/();/; s/^.*\(gdk_x11\|gtk_plug_\|gtk_socket_\).*$$/#ifdef GDK_WINDOWING_X11\n&\n#endif/; s/^.*gdk_x11_gl.*$$/#ifdef HAVE_OPENGL\n&\n#endif/; }' >> xgen-gtf \ - && cp xgen-gtf $@ && rm -f xgen-gtf - $(srcdir)/gtktestutils.c: gtktypefuncs.inc - -diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c -index 802303e..33001cf 100644 ---- a/gtk/gtkglarea.c -+++ b/gtk/gtkglarea.c -@@ -29,7 +29,9 @@ - #include "gtkprivate.h" - #include "gtkrender.h" - -+#ifdef HAVE_OPENGL - #include -+#endif - - /** - * SECTION:gtkglarea -@@ -369,9 +371,12 @@ gtk_gl_area_real_create_context (GtkGLArea *area) - static void - gtk_gl_area_resize (GtkGLArea *area, int width, int height) - { -+#ifdef HAVE_OPENGL - glViewport (0, 0, width, height); -+#endif - } - -+#ifdef HAVE_OPENGL - /* - * Creates all the buffer objects needed for rendering the scene - */ -@@ -483,6 +488,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area) - - priv->needs_render = TRUE; - } -+#endif - - /** - * gtk_gl_area_attach_buffers: -@@ -501,6 +507,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area) - void - gtk_gl_area_attach_buffers (GtkGLArea *area) - { -+#ifdef HAVE_OPENGL - GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); - - g_return_if_fail (GTK_IS_GL_AREA (area)); -@@ -533,11 +540,13 @@ gtk_gl_area_attach_buffers (GtkGLArea *area) - glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, - GL_RENDERBUFFER, priv->depth_stencil_buffer); - } -+#endif - } - - static void - gtk_gl_area_delete_buffers (GtkGLArea *area) - { -+#ifdef HAVE_OPENGL - GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); - - if (priv->context == NULL) -@@ -569,6 +578,7 @@ gtk_gl_area_delete_buffers (GtkGLArea *area) - glDeleteFramebuffers (1, &priv->frame_buffer); - priv->frame_buffer = 0; - } -+#endif - } - - static void -@@ -679,6 +689,7 @@ gtk_gl_area_draw (GtkWidget *widget, - GtkGLArea *area = GTK_GL_AREA (widget); - GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); - gboolean unused; -+#ifdef HAVE_OPENGL - int w, h, scale; - GLenum status; - -@@ -690,7 +701,6 @@ gtk_gl_area_draw (GtkWidget *widget, - gtk_widget_get_allocated_height (widget)); - return FALSE; - } -- - if (priv->context == NULL) - return FALSE; - -@@ -736,6 +746,14 @@ gtk_gl_area_draw (GtkWidget *widget, - } - - return TRUE; -+#else -+ if (priv->error != NULL) -+ gtk_gl_area_draw_error_screen (area, -+ cr, -+ gtk_widget_get_allocated_width (widget), -+ gtk_widget_get_allocated_height (widget)); -+ return FALSE; -+#endif - } - - static gboolean -diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c -index 48237d1..1f9b9be 100644 ---- a/gtk/inspector/general.c -+++ b/gtk/inspector/general.c -@@ -33,8 +33,10 @@ - - #ifdef GDK_WINDOWING_X11 - #include "x11/gdkx.h" -+#ifdef HAVE_OPENGL - #include - #endif -+#endif - - #ifdef GDK_WINDOWING_WIN32 - #include "win32/gdkwin32.h" -@@ -196,6 +198,7 @@ add_label_row (GtkInspectorGeneral *gen, - gtk_size_group_add_widget (GTK_SIZE_GROUP (gen->priv->labels), label); - } - -+#ifdef HAVE_OPENGL - #ifdef GDK_WINDOWING_X11 - static void - append_glx_extension_row (GtkInspectorGeneral *gen, -@@ -205,6 +208,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen, - add_check_row (gen, GTK_LIST_BOX (gen->priv->gl_box), ext, epoxy_has_glx_extension (dpy, 0, ext), 0); - } - #endif -+#endif - - #ifdef GDK_WINDOWING_WAYLAND - static void -@@ -254,6 +258,7 @@ wayland_get_display (struct wl_display *wl_display) - static void - init_gl (GtkInspectorGeneral *gen) - { -+#ifdef HAVE_OPENGL - #ifdef GDK_WINDOWING_X11 - if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) - { -@@ -280,6 +285,7 @@ init_gl (GtkInspectorGeneral *gen) - } - else - #endif -+#endif - #ifdef GDK_WINDOWING_WAYLAND - if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) - { -diff --git a/tests/Makefile.am b/tests/Makefile.am -index f283e89..5e7180e 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -80,8 +80,6 @@ noinst_PROGRAMS = $(TEST_PROGS) \ - testfullscreen \ - testgeometry \ - testgiconpixbuf \ -- testglarea \ -- testglblending \ - testgrid \ - testgtk \ - testheaderbar \ -@@ -172,12 +170,18 @@ noinst_PROGRAMS = $(TEST_PROGS) \ - testactionbar \ - testwindowsize \ - testpopover \ -- gdkgears \ - listmodel \ - testpopup \ - testpopupat \ - $(NULL) - -+if HAVE_OPENGL -+noinst_PROGRAMS += -+ testglarea \ -+ testglblending \ -+ gdkgears -+endif -+ - if USE_WAYLAND - noinst_PROGRAMS += testforeign - endif -diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c -index 24540e3..e0f863a 100644 ---- a/testsuite/gtk/objects-finalize.c -+++ b/testsuite/gtk/objects-finalize.c -@@ -116,7 +116,9 @@ main (int argc, char **argv) - all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_CORE && - all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_XI2 && - all_types[i] != GDK_TYPE_X11_DISPLAY_MANAGER && -+#ifdef HAVE_OPENGL - all_types[i] != GDK_TYPE_X11_GL_CONTEXT && -+#endif - #endif - /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */ - all_types[i] != GDK_TYPE_PIXBUF_LOADER && diff --git a/poky/meta/recipes-gnome/gtk+/gtk+3/link_fribidi.patch b/poky/meta/recipes-gnome/gtk+/gtk+3/link_fribidi.patch deleted file mode 100644 index e4bbd799f1..0000000000 --- a/poky/meta/recipes-gnome/gtk+/gtk+3/link_fribidi.patch +++ /dev/null @@ -1,19 +0,0 @@ -Link with libfribidi, this is to avoid under linking where these functions are -used but the library is not linked in, and they are marked undefined by BFD linker -but gold linker refuses to link - -| ./.libs/libgdk-3.so: error: undefined reference to 'fribidi_get_bidi_type' - -Signed-off-by: Khem Raj -Upstream-Status: Pending - ---- a/gdk/Makefile.am -+++ b/gdk/Makefile.am -@@ -55,6 +55,7 @@ LDADD = \ - -version-info $(LT_VERSION_INFO) \ - -export-dynamic \ - -rpath $(libdir) \ -+ -lfribidi \ - $(no_undefined) - - # diff --git a/poky/meta/recipes-gnome/gtk+/gtk+3/opengl.patch b/poky/meta/recipes-gnome/gtk+/gtk+3/opengl.patch new file mode 100644 index 0000000000..7354265e10 --- /dev/null +++ b/poky/meta/recipes-gnome/gtk+/gtk+3/opengl.patch @@ -0,0 +1,737 @@ +From 4a0716f04fb25b51b08e994bd5a900b2e7f7fed5 Mon Sep 17 00:00:00 2001 +From: Jussi Kukkonen +Date: Fri, 16 Oct 2015 16:35:16 +0300 +Subject: [PATCH] Do not try to initialize GL without libGL + +_gdk_x11_screen_update_visuals_for_gl() will end up calling epoxys +GLX api which will exit() if libGL.so.1 is not present. We do not +want that to happen and we don't want every app to have to set +"GDK_GL=disabled" environment variable: so use #ifdef set based on +opengl distro feature. + +Upstream is not interested in the fix as it is: Either epoxy should be +fixed (to not exit) or GTK+ possibly could do some additional probing +before calling epoxy APIs. + +Upstream-Status: Denied +Signed-off-by: Jussi Kukkonen +--- + demos/gtk-demo/meson.build | 5 ++++- + docs/tools/meson.build | 7 +++++-- + docs/tools/widgets.c | 6 +++++- + gdk/gdkconfig.h.meson | 1 + + gdk/gdkdisplay.c | 4 ++++ + gdk/gdkgl.c | 10 ++++++++++ + gdk/gdkglcontext.c | 6 ++++++ + gdk/gdkwindow.c | 13 +++++++++++++ + gdk/meson.build | 8 +++++++- + gdk/x11/gdkdisplay-x11.c | 6 +++++- + gdk/x11/gdkvisual-x11.c | 5 +++++ + gdk/x11/gdkwindow-x11.c | 4 ++++ + gdk/x11/gdkx-autocleanups.h | 2 ++ + gdk/x11/gdkx.h | 2 ++ + gdk/x11/meson.build | 7 +++++-- + gtk/gtkglarea.c | 19 +++++++++++++++++++ + gtk/inspector/general.c | 6 ++++++ + meson.build | 17 ++++++++++++++--- + meson_options.txt | 2 ++ + tests/meson.build | 9 +++++++-- + testsuite/gtk/objects-finalize.c | 2 ++ + 21 files changed, 128 insertions(+), 13 deletions(-) + +diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build +index 252da16d05..4b57cff6ac 100644 +--- a/demos/gtk-demo/meson.build ++++ b/demos/gtk-demo/meson.build +@@ -28,7 +28,6 @@ demos = files([ + 'fishbowl.c', + 'foreigndrawing.c', + 'gestures.c', +- 'glarea.c', + 'headerbar.c', + 'hypertext.c', + 'iconview.c', +@@ -87,6 +86,10 @@ elif harfbuzz_dep.found() and pangoft_dep.found() + gtkdemo_deps += [harfbuzz_dep, pangoft_dep] + endif + ++if opengl_enabled ++ demos += files('glarea.c') ++endif ++ + if os_unix + demos += files('pagesetup.c') + endif +diff --git a/docs/tools/meson.build b/docs/tools/meson.build +index 05621ee7ed..3d0a333b32 100644 +--- a/docs/tools/meson.build ++++ b/docs/tools/meson.build +@@ -2,10 +2,13 @@ if x11_enabled + doc_shooter_sources = [ + 'shadow.c', + 'shooter.c', +- 'widgets.c', +- '../../tests/gtkgears.c', ++ 'widgets.c' + ] + ++ if opengl_enabled ++ doc_shooter_sources += ['../../tests/gtkgears.c'] ++ endif ++ + doc_shooter = executable('doc-shooter', doc_shooter_sources, + include_directories: [ confinc, gdkinc, gtkinc, testinc, ], + dependencies: libgtk_dep) +diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c +index 932daf1746..348807e133 100644 +--- a/docs/tools/widgets.c ++++ b/docs/tools/widgets.c +@@ -8,7 +8,9 @@ + #include + #include + #include "widgets.h" ++#ifdef HAVE_OPENGL + #include "gtkgears.h" ++#endif + + #define SMALL_WIDTH 240 + #define SMALL_HEIGHT 75 +@@ -1526,9 +1528,11 @@ create_gl_area (void) + widget = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN); + ++#ifdef HAVE_OPENGL + gears = gtk_gears_new (); + gtk_container_add (GTK_CONTAINER (widget), gears); +- ++#endif ++ + info = new_widget_info ("glarea", widget, MEDIUM); + + return info; +diff --git a/gdk/gdkconfig.h.meson b/gdk/gdkconfig.h.meson +index 7db19e0470..088651bafa 100644 +--- a/gdk/gdkconfig.h.meson ++++ b/gdk/gdkconfig.h.meson +@@ -15,6 +15,7 @@ G_BEGIN_DECLS + #mesondefine GDK_WINDOWING_WAYLAND + #mesondefine GDK_WINDOWING_WIN32 + #mesondefine GDK_WINDOWING_QUARTZ ++#mesondefine GDK_WITH_OPENGL + + G_END_DECLS + +diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c +index 748f54860c..04ef2c09d4 100644 +--- a/gdk/gdkdisplay.c ++++ b/gdk/gdkdisplay.c +@@ -2420,7 +2420,11 @@ gboolean + gdk_display_make_gl_context_current (GdkDisplay *display, + GdkGLContext *context) + { ++#ifdef HAVE_OPENGL + return GDK_DISPLAY_GET_CLASS (display)->make_gl_context_current (display, context); ++#else ++ return FALSE; ++#endif + } + + GdkRenderingMode +diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c +index 9690077cc2..55f85ef605 100644 +--- a/gdk/gdkgl.c ++++ b/gdk/gdkgl.c +@@ -26,7 +26,9 @@ + # include "win32/gdkwin32.h" + #endif + ++#ifdef HAVE_OPENGL + #include ++#endif + #include + #include + +@@ -40,6 +42,7 @@ gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface, + g_object_ref (window), g_object_unref); + } + ++#ifdef HAVE_OPENGL + static const char * + get_vertex_type_name (int type) + { +@@ -212,6 +215,7 @@ use_texture_rect_program (GdkGLContextPaintData *paint_data) + glUseProgram (paint_data->current_program->program); + } + } ++#endif + + void + gdk_gl_texture_quads (GdkGLContext *paint_context, +@@ -220,6 +224,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context, + GdkTexturedQuad *quads, + gboolean flip_colors) + { ++#ifdef HAVE_OPENGL + GdkGLContextPaintData *paint_data = gdk_gl_context_get_paint_data (paint_context); + GdkGLContextProgram *program; + GdkWindow *window = gdk_gl_context_get_window (paint_context); +@@ -293,6 +298,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context, + + glDisableVertexAttribArray (program->position_location); + glDisableVertexAttribArray (program->uv_location); ++#endif + } + + /* x,y,width,height describes a rectangle in the gl render buffer +@@ -341,6 +347,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr, + int width, + int height) + { ++#ifdef HAVE_OPENGL + GdkGLContext *paint_context; + cairo_surface_t *image; + cairo_matrix_t matrix; +@@ -718,6 +725,7 @@ out: + if (clip_region) + cairo_region_destroy (clip_region); + ++#endif + } + + /* This is always called with the paint context current */ +@@ -725,6 +733,7 @@ void + gdk_gl_texture_from_surface (cairo_surface_t *surface, + cairo_region_t *region) + { ++#ifdef HAVE_OPENGL + GdkGLContext *paint_context; + cairo_surface_t *image; + double device_x_offset, device_y_offset; +@@ -825,4 +834,5 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface, + + glDisable (GL_SCISSOR_TEST); + glDeleteTextures (1, &texture_id); ++#endif + } +diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c +index 3b23639e1c..1f04f8e0b2 100644 +--- a/gdk/gdkglcontext.c ++++ b/gdk/gdkglcontext.c +@@ -85,7 +85,9 @@ + #include "gdkintl.h" + #include "gdk-private.h" + ++#ifdef HAVE_OPENGL + #include ++#endif + + typedef struct { + GdkDisplay *display; +@@ -243,6 +245,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context, + int height, + guint texture_target) + { ++#ifdef HAVE_OPENGL + GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); + + g_return_if_fail (GDK_IS_GL_CONTEXT (context)); +@@ -286,6 +289,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context, + glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (unsigned char*) data + (i * stride)); + } + } ++#endif + } + + static gboolean +@@ -774,6 +778,7 @@ gdk_gl_context_realize (GdkGLContext *context, + static void + gdk_gl_context_check_extensions (GdkGLContext *context) + { ++#ifdef HAVE_OPENGL + GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); + gboolean has_npot, has_texture_rectangle; + +@@ -853,6 +858,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context) + priv->use_texture_rectangle ? "yes" : "no")); + + priv->extensions_checked = TRUE; ++#endif + } + + /** +diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c +index 727b0cf1f4..d4d91b0d16 100644 +--- a/gdk/gdkwindow.c ++++ b/gdk/gdkwindow.c +@@ -45,7 +45,9 @@ + + #include + ++#ifdef HAVE_OPENGL + #include ++#endif + + /* for the use of round() */ + #include "fallback-c89.c" +@@ -2844,6 +2846,13 @@ gdk_window_get_paint_gl_context (GdkWindow *window, + { + GError *internal_error = NULL; + ++#ifndef HAVE_OPENGL ++ g_set_error_literal (error, GDK_GL_ERROR, ++ GDK_GL_ERROR_NOT_AVAILABLE, ++ _("GL support disabled with --disable-opengl")); ++ return NULL; ++#endif ++ + if (_gdk_gl_flags & GDK_GL_DISABLE) + { + g_set_error_literal (error, GDK_GL_ERROR, +@@ -2979,6 +2988,7 @@ gdk_window_begin_paint_internal (GdkWindow *window, + } + else + { ++#ifdef HAVE_OPENGL + gdk_gl_context_make_current (context); + /* With gl we always need a surface to combine the gl + drawing with the native drawing. */ +@@ -2993,6 +3003,7 @@ gdk_window_begin_paint_internal (GdkWindow *window, + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + glViewport (0, 0, ww, wh); ++#endif + } + } + +@@ -3056,6 +3067,7 @@ gdk_window_end_paint_internal (GdkWindow *window) + + gdk_gl_context_make_current (window->gl_paint_context); + ++#ifdef HAVE_OPENGL + if (!cairo_region_is_empty (opaque_region)) + gdk_gl_texture_from_surface (window->current_paint.surface, + opaque_region); +@@ -3066,6 +3078,7 @@ gdk_window_end_paint_internal (GdkWindow *window) + window->current_paint.need_blend_region); + glDisable(GL_BLEND); + } ++#endif + + cairo_region_destroy (opaque_region); + +diff --git a/gdk/meson.build b/gdk/meson.build +index 4bb1bf2b6c..64172b8d3e 100644 +--- a/gdk/meson.build ++++ b/gdk/meson.build +@@ -56,7 +56,6 @@ gdk_gir_public_headers = files( + 'gdkdrawingcontext.h', + 'gdkevents.h', + 'gdkframetimings.h', +- 'gdkglcontext.h', + 'gdkkeys.h', + 'gdkkeysyms.h', + 'gdkmain.h', +@@ -78,6 +77,12 @@ gdk_gir_public_headers = files( + 'gdkwindow.h', + ) + gdk_nogir_public_headers = [files('gdkkeysyms-compat.h')] ++if opengl_enabled ++gdk_gir_public_headers += files('gdkglcontext.h') ++else ++gdk_nogir_public_headers += files('gdkglcontext.h') ++endif ++ + gdk_public_headers = gdk_gir_public_headers + gdk_nogir_public_headers + install_headers(gdk_public_headers, subdir : 'gtk-3.0/gdk') + +@@ -166,6 +171,7 @@ gdkconfig_cdata.set('GDK_WINDOWING_WAYLAND', wayland_enabled) + gdkconfig_cdata.set('GDK_WINDOWING_WIN32', win32_enabled) + gdkconfig_cdata.set('GDK_WINDOWING_BROADWAY', broadway_enabled) + gdkconfig_cdata.set('GDK_WINDOWING_QUARTZ', quartz_enabled) ++gdkconfig_cdata.set('GDK_WITH_OPENGL', opengl_enabled) + + gdkconfig = configure_file( + input : 'gdkconfig.h.meson', +diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c +index 7e08f472cc..30fd7b6089 100644 +--- a/gdk/x11/gdkdisplay-x11.c ++++ b/gdk/x11/gdkdisplay-x11.c +@@ -37,7 +37,9 @@ + #include "gdkdisplay-x11.h" + #include "gdkprivate-x11.h" + #include "gdkscreen-x11.h" ++#ifdef HAVE_OPENGL + #include "gdkglcontext-x11.h" ++#endif + #include "gdk-private.h" + #include "gdkprofilerprivate.h" + +@@ -3191,7 +3193,9 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class) + display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list; + display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target; + +- display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current; ++#ifdef HAVE_OPENGL ++ display_class->make_gl_context_current = gdk_x11_display_make_gl_context_current; ++#endif + + display_class->get_default_seat = gdk_x11_display_get_default_seat; + +diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c +index 81479d81f4..3c8c5c02ff 100644 +--- a/gdk/x11/gdkvisual-x11.c ++++ b/gdk/x11/gdkvisual-x11.c +@@ -306,7 +306,12 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen) + /* If GL is available we want to pick better default/rgba visuals, + as we care about glx details such as alpha/depth/stencil depth, + stereo and double buffering */ ++ /* update_visuals_for_gl() will end up calling epoxy GLX api which ++ will exit if libgl is not there: so only do this if we know GL ++ is available */ ++#ifdef HAVE_GLX + _gdk_x11_screen_update_visuals_for_gl (screen); ++#endif + } + + gint +diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c +index 194bc82e29..0302bb68d4 100644 +--- a/gdk/x11/gdkwindow-x11.c ++++ b/gdk/x11/gdkwindow-x11.c +@@ -36,7 +36,9 @@ + #include "gdkasync.h" + #include "gdkeventsource.h" + #include "gdkdisplay-x11.h" ++#ifdef HAVE_OPENGL + #include "gdkglcontext-x11.h" ++#endif + #include "gdkprivate-x11.h" + #include "gdk-private.h" + +@@ -5888,7 +5890,9 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass) + impl_class->set_opaque_region = gdk_x11_window_set_opaque_region; + impl_class->set_shadow_width = gdk_x11_window_set_shadow_width; + impl_class->show_window_menu = gdk_x11_window_show_window_menu; ++#ifdef HAVE_OPENGL + impl_class->create_gl_context = gdk_x11_window_create_gl_context; + impl_class->invalidate_for_new_frame = gdk_x11_window_invalidate_for_new_frame; ++#endif + impl_class->get_unscaled_size = gdk_x11_window_get_unscaled_size; + } +diff --git a/gdk/x11/gdkx-autocleanups.h b/gdk/x11/gdkx-autocleanups.h +index edb0ea7dbf..a317d61cca 100644 +--- a/gdk/x11/gdkx-autocleanups.h ++++ b/gdk/x11/gdkx-autocleanups.h +@@ -30,7 +30,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DisplayManager, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref) ++#ifdef HAVE_OPENGL + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref) ++#endif + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Visual, g_object_unref) +diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h +index 1f64bccb6d..4db6c18351 100644 +--- a/gdk/x11/gdkx.h ++++ b/gdk/x11/gdkx.h +@@ -43,7 +43,9 @@ + #include + #include + #include ++#ifdef GDK_WITH_OPENGL + #include ++#endif + #include + #include + #include +diff --git a/gdk/x11/meson.build b/gdk/x11/meson.build +index 754ae0a615..0318c83877 100644 +--- a/gdk/x11/meson.build ++++ b/gdk/x11/meson.build +@@ -14,7 +14,6 @@ gdk_x11_sources = files( + 'gdkeventsource.c', + 'gdkeventtranslator.c', + 'gdkgeometry-x11.c', +- 'gdkglcontext-x11.c', + 'gdkkeys-x11.c', + 'gdkmain-x11.c', + 'gdkproperty-x11.c', +@@ -42,7 +41,6 @@ gdk_x11_public_headers = files( + 'gdkx11display.h', + 'gdkx11displaymanager.h', + 'gdkx11dnd.h', +- 'gdkx11glcontext.h', + 'gdkx11keys.h', + 'gdkx11monitor.h', + 'gdkx11property.h', +@@ -53,6 +51,11 @@ gdk_x11_public_headers = files( + 'gdkx11window.h', + ) + ++if opengl_enabled ++ gdk_x11_sources += files('gdkglcontext-x11.c') ++ gdk_x11_public_headers += files('gdkx11glcontext.h') ++endif ++ + install_headers(gdk_x11_public_headers, subdir: 'gtk-3.0/gdk/x11/') + install_headers('gdkx.h', subdir: 'gtk-3.0/gdk/') + +diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c +index 802303ea9f..6439d7745d 100644 +--- a/gtk/gtkglarea.c ++++ b/gtk/gtkglarea.c +@@ -29,7 +29,9 @@ + #include "gtkprivate.h" + #include "gtkrender.h" + ++#ifdef HAVE_OPENGL + #include ++#endif + + /** + * SECTION:gtkglarea +@@ -369,9 +371,12 @@ gtk_gl_area_real_create_context (GtkGLArea *area) + static void + gtk_gl_area_resize (GtkGLArea *area, int width, int height) + { ++#ifdef HAVE_OPENGL + glViewport (0, 0, width, height); ++#endif + } + ++#ifdef HAVE_OPENGL + /* + * Creates all the buffer objects needed for rendering the scene + */ +@@ -483,6 +488,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area) + + priv->needs_render = TRUE; + } ++#endif + + /** + * gtk_gl_area_attach_buffers: +@@ -501,6 +507,7 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area) + void + gtk_gl_area_attach_buffers (GtkGLArea *area) + { ++#ifdef HAVE_OPENGL + GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); + + g_return_if_fail (GTK_IS_GL_AREA (area)); +@@ -533,11 +540,13 @@ gtk_gl_area_attach_buffers (GtkGLArea *area) + glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, priv->depth_stencil_buffer); + } ++#endif + } + + static void + gtk_gl_area_delete_buffers (GtkGLArea *area) + { ++#ifdef HAVE_OPENGL + GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); + + if (priv->context == NULL) +@@ -569,6 +578,7 @@ gtk_gl_area_delete_buffers (GtkGLArea *area) + glDeleteFramebuffers (1, &priv->frame_buffer); + priv->frame_buffer = 0; + } ++#endif + } + + static void +@@ -679,6 +689,7 @@ gtk_gl_area_draw (GtkWidget *widget, + GtkGLArea *area = GTK_GL_AREA (widget); + GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area); + gboolean unused; ++#ifdef HAVE_OPENGL + int w, h, scale; + GLenum status; + +@@ -736,6 +747,14 @@ gtk_gl_area_draw (GtkWidget *widget, + } + + return TRUE; ++#else ++ if (priv->error != NULL) ++ gtk_gl_area_draw_error_screen (area, ++ cr, ++ gtk_widget_get_allocated_width (widget), ++ gtk_widget_get_allocated_height (widget)); ++ return FALSE; ++#endif + } + + static gboolean +diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c +index 4fd0c3039c..a8e59ed077 100644 +--- a/gtk/inspector/general.c ++++ b/gtk/inspector/general.c +@@ -33,8 +33,10 @@ + + #ifdef GDK_WINDOWING_X11 + #include "x11/gdkx.h" ++#ifdef HAVE_OPENGL + #include + #endif ++#endif + + #ifdef GDK_WINDOWING_WIN32 + #include "win32/gdkwin32.h" +@@ -217,6 +219,7 @@ add_label_row (GtkInspectorGeneral *gen, + gtk_size_group_add_widget (GTK_SIZE_GROUP (gen->priv->labels), label); + } + ++#ifdef HAVE_OPENGL + #ifdef GDK_WINDOWING_X11 + static void + append_glx_extension_row (GtkInspectorGeneral *gen, +@@ -226,6 +229,7 @@ append_glx_extension_row (GtkInspectorGeneral *gen, + add_check_row (gen, GTK_LIST_BOX (gen->priv->gl_box), ext, epoxy_has_glx_extension (dpy, 0, ext), 0); + } + #endif ++#endif + + #ifdef GDK_WINDOWING_WAYLAND + static void +@@ -275,6 +279,7 @@ wayland_get_display (struct wl_display *wl_display) + static void + init_gl (GtkInspectorGeneral *gen) + { ++#ifdef HAVE_OPENGL + #ifdef GDK_WINDOWING_X11 + if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) + { +@@ -301,6 +306,7 @@ init_gl (GtkInspectorGeneral *gen) + } + else + #endif ++#endif + #ifdef GDK_WINDOWING_WAYLAND + if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) + { +diff --git a/meson.build b/meson.build +index aed48fc3f6..bfc33af0f6 100644 +--- a/meson.build ++++ b/meson.build +@@ -137,6 +137,7 @@ wayland_enabled = get_option('wayland_backend') + broadway_enabled = get_option('broadway_backend') + quartz_enabled = get_option('quartz_backend') + win32_enabled = get_option('win32_backend') ++opengl_enabled = get_option('opengl') + + os_unix = false + os_linux = false +@@ -430,7 +431,7 @@ pangocairo_dep = dependency('pangocairo', version: cairo_req, + fallback : ['pango', 'libpangocairo_dep']) + pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req, + fallback : ['gdk-pixbuf', 'gdkpixbuf_dep']) +-epoxy_dep = dependency('epoxy', version: epoxy_req, ++epoxy_dep = dependency('epoxy', version: epoxy_req, required: opengl_enabled, + fallback: ['libepoxy', 'libepoxy_dep']) + atk_dep = dependency('atk', version: atk_req, + fallback : ['atk', 'libatk_dep']) +@@ -476,6 +477,10 @@ if tracker3_enabled + endif + endif + ++if opengl_enabled ++ cdata.set('HAVE_OPENGL', 1) ++endif ++ + if iso_codes_dep.found() + cdata.set_quoted('ISO_CODES_PREFIX', iso_codes_dep.get_variable(pkgconfig: 'prefix')) + else +@@ -912,9 +917,15 @@ else + gio_packages = ['gio-2.0', glib_req] + endif + ++if opengl_enabled ++ epoxy_packages = ['epoxy', epoxy_req] ++else ++ epoxy_packages = [] ++endif ++ + pkgconf.set('GDK_PRIVATE_PACKAGES', + ' '.join(gio_packages + x11_pkgs + wayland_pkgs + cairo_backends + +- ['epoxy', epoxy_req] + cloudproviders_packages + ++ epoxy_packages + cloudproviders_packages + + ['fribidi', fribidi_req])) + + gtk_packages = ' '.join([ +@@ -928,7 +939,7 @@ pkgconf.set('GTK_PACKAGES', gtk_packages) + # Requires.private + pc_gdk_extra_libs += cairo_libs + +-gtk_private_packages = atk_pkgs + wayland_pkgs + ['epoxy', epoxy_req, 'fribidi', fribidi_req] ++gtk_private_packages = atk_pkgs + wayland_pkgs + epoxy_packages + ['fribidi', fribidi_req] + if wayland_enabled or x11_enabled + gtk_private_packages += ['pangoft2'] + endif +diff --git a/meson_options.txt b/meson_options.txt +index 94099aa01e..8bd096896d 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -19,6 +19,8 @@ option('profiler', type: 'boolean', value: false, + description : 'Enable profiler support') + option('tracker3', type: 'boolean', value: false, + description : 'Enable Tracker3 filechooser search') ++option('opengl', type: 'boolean', value: true, ++ description : 'Enable use of GL') + + # Print backends + option('print_backends', type : 'string', value : 'auto', +diff --git a/tests/meson.build b/tests/meson.build +index 586fe2f45e..6ecf317dde 100644 +--- a/tests/meson.build ++++ b/tests/meson.build +@@ -5,7 +5,6 @@ gtk_tests = [ + ['scrolling-performance', ['frame-stats.c', 'variable.c']], + ['blur-performance', ['../gtk/gtkcairoblur.c']], + ['flicker'], +- ['gdkgears', ['gtkgears.c']], + ['listmodel'], + ['motion-compression'], + ['styleexamples'], +@@ -54,7 +53,6 @@ gtk_tests = [ + ['testfullscreen'], + ['testgeometry'], + ['testgiconpixbuf'], +- ['testglblending', ['gtkgears.c']], + ['testgmenu'], + ['testgrid'], + ['testgrouping'], +@@ -137,6 +135,13 @@ if x11_enabled + ] + endif + ++if opengl_enabled ++ gtk_tests += [ ++ ['gdkgears', ['gtkgears.c']], ++ ['testglblending', ['gtkgears.c']], ++ ] ++endif ++ + if os_linux + gtk_tests += [['testfontchooserdialog']] + endif +diff --git a/testsuite/gtk/objects-finalize.c b/testsuite/gtk/objects-finalize.c +index 24540e313f..e0f863ab6a 100644 +--- a/testsuite/gtk/objects-finalize.c ++++ b/testsuite/gtk/objects-finalize.c +@@ -116,7 +116,9 @@ main (int argc, char **argv) + all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_CORE && + all_types[i] != GDK_TYPE_X11_DEVICE_MANAGER_XI2 && + all_types[i] != GDK_TYPE_X11_DISPLAY_MANAGER && ++#ifdef HAVE_OPENGL + all_types[i] != GDK_TYPE_X11_GL_CONTEXT && ++#endif + #endif + /* Not allowed to finalize a GdkPixbufLoader without calling gdk_pixbuf_loader_close() */ + all_types[i] != GDK_TYPE_PIXBUF_LOADER && +-- +2.30.2 + diff --git a/poky/meta/recipes-gnome/gtk+/gtk+3_3.24.34.bb b/poky/meta/recipes-gnome/gtk+/gtk+3_3.24.34.bb deleted file mode 100644 index f862e143d4..0000000000 --- a/poky/meta/recipes-gnome/gtk+/gtk+3_3.24.34.bb +++ /dev/null @@ -1,17 +0,0 @@ -require gtk+3.inc - -MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" - -SRC_URI = "http://ftp.gnome.org/pub/gnome/sources/gtk+/${MAJ_VER}/gtk+-${PV}.tar.xz \ - file://0002-Do-not-try-to-initialize-GL-without-libGL.patch \ - file://0003-Add-disable-opengl-configure-option.patch \ - file://link_fribidi.patch \ - " -SRC_URI[sha256sum] = "dbc69f90ddc821b8d1441f00374dc1da4323a2eafa9078e61edbe5eeefa852ec" - -S = "${WORKDIR}/gtk+-${PV}" - -LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ - file://gtk/gtk.h;endline=25;md5=1d8dc0fccdbfa26287a271dce88af737 \ - file://gdk/gdk.h;endline=25;md5=c920ce39dc88c6f06d3e7c50e08086f2 \ - file://tests/testgtk.c;endline=25;md5=cb732daee1d82af7a2bf953cf3cf26f1" diff --git a/poky/meta/recipes-gnome/gtk+/gtk+3_3.24.36.bb b/poky/meta/recipes-gnome/gtk+/gtk+3_3.24.36.bb new file mode 100644 index 0000000000..41c189d7f1 --- /dev/null +++ b/poky/meta/recipes-gnome/gtk+/gtk+3_3.24.36.bb @@ -0,0 +1,16 @@ +require gtk+3.inc + +MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" + +SRC_URI = "http://ftp.gnome.org/pub/gnome/sources/gtk+/${MAJ_VER}/gtk+-${PV}.tar.xz \ + file://opengl.patch \ + file://0001-meson.build-build-introspection-according-to-option-.patch \ + " +SRC_URI[sha256sum] = "27a6ef157743350c807ffea59baa1d70226dbede82a5e953ffd58ea6059fe691" + +S = "${WORKDIR}/gtk+-${PV}" + +LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ + file://gtk/gtk.h;endline=25;md5=1d8dc0fccdbfa26287a271dce88af737 \ + file://gdk/gdk.h;endline=25;md5=c920ce39dc88c6f06d3e7c50e08086f2 \ + file://tests/testgtk.c;endline=25;md5=cb732daee1d82af7a2bf953cf3cf26f1" diff --git a/poky/meta/recipes-gnome/gtk+/gtk4_4.8.3.bb b/poky/meta/recipes-gnome/gtk+/gtk4_4.8.3.bb new file mode 100644 index 0000000000..6101905128 --- /dev/null +++ b/poky/meta/recipes-gnome/gtk+/gtk4_4.8.3.bb @@ -0,0 +1,128 @@ +SUMMARY = "Multi-platform toolkit for creating GUIs" +DESCRIPTION = "GTK is a multi-platform toolkit for creating graphical user interfaces. Offering a complete \ +set of widgets, GTK is suitable for projects ranging from small one-off projects to complete application suites." +HOMEPAGE = "http://www.gtk.org" +BUGTRACKER = "https://bugzilla.gnome.org/" +SECTION = "libs" + +DEPENDS = " \ + atk \ + cairo \ + fribidi \ + gdk-pixbuf \ + gdk-pixbuf-native \ + gi-docgen \ + glib-2.0 \ + graphene \ + harfbuzz \ + jpeg \ + libepoxy \ + libpng \ + librsvg \ + libxkbcommon \ + pango \ + tiff \ +" + +LICENSE = "LGPL-2.0-only & LGPL-2.0-or-later & LGPL-2.1-or-later" +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ + file://gtk/gtk.h;endline=25;md5=1d8dc0fccdbfa26287a271dce88af737 \ + file://gdk/gdk.h;endline=25;md5=c920ce39dc88c6f06d3e7c50e08086f2 \ + file://tests/testgtk.c;endline=25;md5=49d06770681b8322466b52ed19d29fb2 \ +" + +MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" + +UPSTREAM_CHECK_REGEX = "gtk-(?P\d+\.(\d*[02468])+(\.\d+)+)\.tar.xz" + +SRC_URI = "http://ftp.gnome.org/pub/gnome/sources/gtk/${MAJ_VER}/gtk-${PV}.tar.xz" +SRC_URI[sha256sum] = "b362f968d085b4d3d9340d4d38c706377ded9d5374e694a2b6b7e6292e3cba74" + +S = "${WORKDIR}/gtk-${PV}" + +inherit meson gettext pkgconfig gi-docgen update-alternatives gsettings features_check gobject-introspection + +# TBD: nativesdk +# gobject-introspection.bbclass pins introspection off for nativesk. As long as +# we do not remove this wisdom or hack gtk4, it is not possible to build +# nativesdk-gtk4 +BBCLASSEXTEND = "native" + +GSETTINGS_PACKAGE:class-native = "" + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" +REQUIRED_DISTRO_FEATURES = "opengl" +GTKDOC_MESON_OPTION = "gtk_doc" +GIR_MESON_ENABLE_FLAG = 'enabled' +GIR_MESON_DISABLE_FLAG = 'disabled' + +EXTRA_OEMESON = " -Dbuild-tests=false -Ddemos=false" + +PACKAGECONFIG ??= "gstreamer ${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11 vulkan', d)}" +PACKAGECONFIG:class-native = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" +PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" + +PACKAGECONFIG[x11] = "-Dx11-backend=true,-Dx11-backend=false,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes xinerama" +PACKAGECONFIG[wayland] = "-Dwayland-backend=true,-Dwayland-backend=false,wayland wayland-protocols virtual/egl virtual/libgles2 wayland-native" +PACKAGECONFIG[cups] = "-Dprint-cups=enabled,-Dprint-cups=disabled,cups" +PACKAGECONFIG[colord] = "-Dcolord=enabled,-Dcolord=disabled,colord" +PACKAGECONFIG[iso-codes] = ",,iso-codes,iso-codes" +PACKAGECONFIG[ffmpeg] = "-Dmedia-ffmpeg=enabled,-Dmedia-ffmpeg=disabled,ffmpeg" +# gtk4 wants gstreamer-player-1.0 -> gstreamer1.0-plugins-bad +PACKAGECONFIG[gstreamer] = "-Dmedia-gstreamer=enabled,-Dmedia-gstreamer=disabled,gstreamer1.0-plugins-bad" +PACKAGECONFIG[tracker] = "-Dtracker=enabled,-Dtracker=disabled,tracker,tracker-miners" +PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled, vulkan-loader vulkan-headers shaderc-native" + +LIBV = "4.0.0" + +FILES:${PN}:append = " \ + ${datadir}/glib-2.0/schemas/ \ + ${datadir}/gtk-4.0/emoji/ \ + ${datadir}/metainfo/ \ + ${datadir}/icons/hicolor/*/apps/org.gtk.PrintEditor4*.* \ + ${libdir}/gtk-4.0/${LIBV}/media \ + ${bindir}/gtk4-update-icon-cache \ + ${bindir}/gtk4-launch \ +" + +FILES:${PN}-dev += " \ + ${datadir}/gtk-4.0/gtk4builder.rng \ + ${datadir}/gtk-4.0/include \ + ${datadir}/gtk-4.0/valgrind \ + ${datadir}/gettext/its \ + ${bindir}/gtk4-builder-tool \ + ${bindir}/gtk4-encode-symbolic-svg \ + ${bindir}/gtk4-query-settings \ +" + +GTKBASE_RRECOMMENDS ?= " \ + liberation-fonts \ + gdk-pixbuf-loader-png \ + gdk-pixbuf-loader-jpeg \ + gdk-pixbuf-loader-gif \ + gdk-pixbuf-loader-xpm \ + shared-mime-info \ + adwaita-icon-theme-symbolic \ +" + +GTKBASE_RRECOMMENDS:class-native ?= "" + +GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1" + +RRECOMMENDS:${PN} = "${GTKBASE_RRECOMMENDS}" +RRECOMMENDS:${PN}:libc-glibc = "${GTKGLIBC_RRECOMMENDS}" +RDEPENDS:${PN}-dev += "${@bb.utils.contains("PACKAGECONFIG", "wayland", "wayland-protocols", "", d)}" + +PACKAGES_DYNAMIC += "^gtk4-printbackend-.*" +python populate_packages:prepend () { + import os.path + + gtk_libdir = d.expand('${libdir}/gtk-4.0/${LIBV}') + printmodules_root = os.path.join(gtk_libdir, 'printbackends'); + + do_split_packages(d, printmodules_root, r'^libprintbackend-(.*)\.so$', 'gtk4-printbackend-%s', 'GTK printbackend module for %s') + + if (d.getVar('DEBIAN_NAMES')): + d.setVar(d.expand('PKG:${PN}'), '${MLPREFIX}libgtk-4.0') +} diff --git a/poky/meta/recipes-gnome/libhandy/libhandy_1.6.3.bb b/poky/meta/recipes-gnome/libhandy/libhandy_1.6.3.bb deleted file mode 100644 index 01ca699d04..0000000000 --- a/poky/meta/recipes-gnome/libhandy/libhandy_1.6.3.bb +++ /dev/null @@ -1,27 +0,0 @@ -SUMMARY = "A library full of GTK+ widgets for mobile phones" -DESCRIPTION = "Library with GTK widgets for mobile phones. Libhandy provides \ -GTK widgets and GObjects to ease developing applications for mobile phones. \ -It was developed by Purism (and used by several official GNOME projects) \ -to extend Gtk by providing mobile-friendly widgets and make the creation of \ -responsive apps easier." -HOMEPAGE = "https://gitlab.gnome.org/GNOME/libhandy" -BUGTRACKER = "https://gitlab.gnome.org/GNOME/libhandy/-/issues" -LICENSE = "LGPL-2.1-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" - -SRC_URI = "git://gitlab.gnome.org/GNOME/libhandy.git;protocol=https;branch=libhandy-1-6" -SRCREV = "2885c314c9c84037b6fe55ead6a232e60ebfc9c5" -S = "${WORKDIR}/git" - -UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+\.(\d*[02468])+(\.\d+))" -GIR_MESON_ENABLE_FLAG = 'enabled' -GIR_MESON_DISABLE_FLAG = 'disabled' - -inherit meson gobject-introspection vala gettext gi-docgen features_check pkgconfig - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -DEPENDS += "gtk+3" - -PACKAGES =+ "${PN}-examples" -FILES:${PN}-examples = "${bindir}" diff --git a/poky/meta/recipes-gnome/libhandy/libhandy_1.8.0.bb b/poky/meta/recipes-gnome/libhandy/libhandy_1.8.0.bb new file mode 100644 index 0000000000..2f7d47290c --- /dev/null +++ b/poky/meta/recipes-gnome/libhandy/libhandy_1.8.0.bb @@ -0,0 +1,27 @@ +SUMMARY = "A library full of GTK+ widgets for mobile phones" +DESCRIPTION = "Library with GTK widgets for mobile phones. Libhandy provides \ +GTK widgets and GObjects to ease developing applications for mobile phones. \ +It was developed by Purism (and used by several official GNOME projects) \ +to extend Gtk by providing mobile-friendly widgets and make the creation of \ +responsive apps easier." +HOMEPAGE = "https://gitlab.gnome.org/GNOME/libhandy" +BUGTRACKER = "https://gitlab.gnome.org/GNOME/libhandy/-/issues" +LICENSE = "LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI = "git://gitlab.gnome.org/GNOME/libhandy.git;protocol=https;branch=main" +SRCREV = "fce63fcc85621c33dab85e32b349d707bf6d1552" +S = "${WORKDIR}/git" + +UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+\.(\d*[02468])+(\.\d+))" +GIR_MESON_ENABLE_FLAG = 'enabled' +GIR_MESON_DISABLE_FLAG = 'disabled' + +inherit meson gobject-introspection vala gettext gi-docgen features_check pkgconfig + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" + +DEPENDS += "gtk+3" + +PACKAGES =+ "${PN}-examples" +FILES:${PN}-examples = "${bindir}" diff --git a/poky/meta/recipes-gnome/libportal/libportal_0.6.bb b/poky/meta/recipes-gnome/libportal/libportal_0.6.bb new file mode 100644 index 0000000000..ca58ef4138 --- /dev/null +++ b/poky/meta/recipes-gnome/libportal/libportal_0.6.bb @@ -0,0 +1,20 @@ +SUMMARY = "libportal provides GIO-style async APIs for most Flatpak portals." +DESCRIPTION = "It provides simple asynchronous wrappers for most Flatpak portals \ +with a familiar GObject API along side the D-Bus API" +HOMEPAGE = "https://github.com/flatpak/libportal" +BUGTRACKER = "https://github.com/flatpak/libportal/issues" +LICENSE = "LGPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=3000208d539ec061b899bce1d9ce9404" + +SRC_URI = "git://github.com/flatpak/${BPN}.git;protocol=https;branch=main" +SRCREV = "13df0b887a7eb7b0f9b14069561a41f62e813155" +S = "${WORKDIR}/git" + +inherit meson gi-docgen gobject-introspection vala features_check pkgconfig +GIDOCGEN_MESON_OPTION = 'docs' + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" + +DEPENDS += "glib-2.0 glib-2.0-native gtk+3 gtk4" + +EXTRA_OEMESON = "-Dbackends=gtk3,gtk4" diff --git a/poky/meta/recipes-gnome/librsvg/librsvg_2.54.5.bb b/poky/meta/recipes-gnome/librsvg/librsvg_2.54.5.bb index fc52ae61c5..b2e93a2684 100644 --- a/poky/meta/recipes-gnome/librsvg/librsvg_2.54.5.bb +++ b/poky/meta/recipes-gnome/librsvg/librsvg_2.54.5.bb @@ -42,6 +42,8 @@ do_configure[postfuncs] += "cargo_common_do_configure" inherit rust-target-config +EXTRA_OECONF:class-target = "--enable-vala" + # rust-cross writes the target linker binary into target json definition without any flags. # This breaks here because the linker isn't going to work without at least knowing where # the sysroot is. So copy the json to workdir, and patch in the path to wrapper from rust class diff --git a/poky/meta/recipes-graphics/cairo/cairo/CVE-2019-6461.patch b/poky/meta/recipes-graphics/cairo/cairo/CVE-2019-6461.patch index 5232cf70c6..a2dba6cb20 100644 --- a/poky/meta/recipes-graphics/cairo/cairo/CVE-2019-6461.patch +++ b/poky/meta/recipes-graphics/cairo/cairo/CVE-2019-6461.patch @@ -1,19 +1,20 @@ -There is a potential infinite-loop in function _arc_error_normalized(). +There is an assertion in function _cairo_arc_in_direction(). CVE: CVE-2019-6461 Upstream-Status: Pending Signed-off-by: Ross Burton diff --git a/src/cairo-arc.c b/src/cairo-arc.c -index 390397bae..f9249dbeb 100644 +index 390397bae..1bde774a4 100644 --- a/src/cairo-arc.c +++ b/src/cairo-arc.c -@@ -99,7 +99,7 @@ _arc_max_angle_for_tolerance_normalized (double tolerance) - do { - angle = M_PI / i++; - error = _arc_error_normalized (angle); -- } while (error > tolerance); -+ } while (error > tolerance && error > __DBL_EPSILON__); +@@ -186,7 +186,8 @@ _cairo_arc_in_direction (cairo_t *cr, + if (cairo_status (cr)) + return; - return angle; - } +- assert (angle_max >= angle_min); ++ if (angle_max < angle_min) ++ return; + + if (angle_max - angle_min > 2 * M_PI * MAX_FULL_CIRCLES) { + angle_max = fmod (angle_max - angle_min, 2 * M_PI); diff --git a/poky/meta/recipes-graphics/cairo/cairo/CVE-2019-6462.patch b/poky/meta/recipes-graphics/cairo/cairo/CVE-2019-6462.patch index 4e4598c5b5..7c3209291b 100644 --- a/poky/meta/recipes-graphics/cairo/cairo/CVE-2019-6462.patch +++ b/poky/meta/recipes-graphics/cairo/cairo/CVE-2019-6462.patch @@ -1,20 +1,40 @@ -There is an assertion in function _cairo_arc_in_direction(). - CVE: CVE-2019-6462 -Upstream-Status: Pending -Signed-off-by: Ross Burton +Upstream-Status: Backport +Signed-off-by: Quentin Schulz + +From ab2c5ee21e5f3d3ee4b3f67cfcd5811a4f99c3a0 Mon Sep 17 00:00:00 2001 +From: Heiko Lewin +Date: Sun, 1 Aug 2021 11:16:03 +0000 +Subject: [PATCH] _arc_max_angle_for_tolerance_normalized: fix infinite loop + +--- + src/cairo-arc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cairo-arc.c b/src/cairo-arc.c -index 390397bae..1bde774a4 100644 +index 390397bae..1c891d1a0 100644 --- a/src/cairo-arc.c +++ b/src/cairo-arc.c -@@ -186,7 +186,8 @@ _cairo_arc_in_direction (cairo_t *cr, - if (cairo_status (cr)) - return; +@@ -90,16 +90,18 @@ _arc_max_angle_for_tolerance_normalized (double tolerance) + { M_PI / 11.0, 9.81410988043554039085e-09 }, + }; + int table_size = ARRAY_LENGTH (table); ++ const int max_segments = 1000; /* this value is chosen arbitrarily. this gives an error of about 1.74909e-20 */ -- assert (angle_max >= angle_min); -+ if (angle_max < angle_min) -+ return; + for (i = 0; i < table_size; i++) + if (table[i].error < tolerance) + return table[i].angle; - if (angle_max - angle_min > 2 * M_PI * MAX_FULL_CIRCLES) { - angle_max = fmod (angle_max - angle_min, 2 * M_PI); + ++i; ++ + do { + angle = M_PI / i++; + error = _arc_error_normalized (angle); +- } while (error > tolerance); ++ } while (error > tolerance && i < max_segments); + + return angle; + } +-- +2.38.1 + diff --git a/poky/meta/recipes-graphics/drm/libdrm_2.4.114.bb b/poky/meta/recipes-graphics/drm/libdrm_2.4.114.bb index 16087f97e5..e01b7934b3 100644 --- a/poky/meta/recipes-graphics/drm/libdrm_2.4.114.bb +++ b/poky/meta/recipes-graphics/drm/libdrm_2.4.114.bb @@ -39,7 +39,7 @@ PACKAGECONFIG[manpages] = "-Dman-pages=enabled,-Dman-pages=disabled,libxslt-nati ALLOW_EMPTY:${PN}-drivers = "1" PACKAGES =+ "${PN}-tests ${PN}-drivers ${PN}-radeon ${PN}-nouveau ${PN}-omap \ - ${PN}-intel ${PN}-exynos ${PN}-kms ${PN}-freedreno ${PN}-amdgpu \ + ${PN}-intel ${PN}-exynos ${PN}-freedreno ${PN}-amdgpu \ ${PN}-etnaviv" RRECOMMENDS:${PN}-drivers = "${PN}-radeon ${PN}-nouveau ${PN}-omap ${PN}-intel \ @@ -52,7 +52,6 @@ FILES:${PN}-nouveau = "${libdir}/libdrm_nouveau.so.*" FILES:${PN}-omap = "${libdir}/libdrm_omap.so.*" FILES:${PN}-intel = "${libdir}/libdrm_intel.so.*" FILES:${PN}-exynos = "${libdir}/libdrm_exynos.so.*" -FILES:${PN}-kms = "${libdir}/libkms*.so.*" FILES:${PN}-freedreno = "${libdir}/libdrm_freedreno.so.*" FILES:${PN}-amdgpu = "${libdir}/libdrm_amdgpu.so.* ${datadir}/${PN}/amdgpu.ids" FILES:${PN}-etnaviv = "${libdir}/libdrm_etnaviv.so.*" diff --git a/poky/meta/recipes-graphics/glslang/glslang_1.3.231.1.bb b/poky/meta/recipes-graphics/glslang/glslang_1.3.231.1.bb deleted file mode 100644 index fede2516b1..0000000000 --- a/poky/meta/recipes-graphics/glslang/glslang_1.3.231.1.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "OpenGL / OpenGL ES Reference Compiler" -DESCRIPTION = "Glslang is the official reference compiler front end for the \ -OpenGL ES and OpenGL shading languages. It implements a strict interpretation \ -of the specifications for these languages. It is open and free for anyone to use, \ -either from a command line or programmatically." -SECTION = "graphics" -HOMEPAGE = "https://www.khronos.org/opengles/sdk/tools/Reference-Compiler" -LICENSE = "BSD-3-Clause & BSD-2-Clause & MIT & Apache-2.0 & GPL-3-with-bison-exception" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=2a2b5acd7bc4844964cfda45fe807dc3" - -SRCREV = "5755de46b07e4374c05fb1081f65f7ae1f8cca81" -SRC_URI = "git://github.com/KhronosGroup/glslang.git;protocol=https;branch=master \ - file://0001-generate-glslang-pkg-config.patch" -PE = "1" -UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" -S = "${WORKDIR}/git" - -inherit cmake python3native - -EXTRA_OECMAKE = " \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=ON \ - -DENABLE_PCH=OFF \ - -DENABLE_CTEST=OFF \ - -DBUILD_EXTERNAL=OFF \ -" - -SOLIBSDEV = "glslang.so" -# all the other libraries are unversioned, so pack it on PN -FILES:${PN} += "${libdir}/*.so" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/glslang/glslang_1.3.236.0.bb b/poky/meta/recipes-graphics/glslang/glslang_1.3.236.0.bb new file mode 100644 index 0000000000..99eca6a6c1 --- /dev/null +++ b/poky/meta/recipes-graphics/glslang/glslang_1.3.236.0.bb @@ -0,0 +1,32 @@ +SUMMARY = "OpenGL / OpenGL ES Reference Compiler" +DESCRIPTION = "Glslang is the official reference compiler front end for the \ +OpenGL ES and OpenGL shading languages. It implements a strict interpretation \ +of the specifications for these languages. It is open and free for anyone to use, \ +either from a command line or programmatically." +SECTION = "graphics" +HOMEPAGE = "https://www.khronos.org/opengles/sdk/tools/Reference-Compiler" +LICENSE = "BSD-3-Clause & BSD-2-Clause & MIT & Apache-2.0 & GPL-3-with-bison-exception" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=2a2b5acd7bc4844964cfda45fe807dc3" + +SRCREV = "77551c429f86c0e077f26552b7c1c0f12a9f235e" +SRC_URI = "git://github.com/KhronosGroup/glslang.git;protocol=https;branch=master \ + file://0001-generate-glslang-pkg-config.patch" +PE = "1" +UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" +S = "${WORKDIR}/git" + +inherit cmake python3native + +EXTRA_OECMAKE = " \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DENABLE_PCH=OFF \ + -DENABLE_CTEST=OFF \ + -DBUILD_EXTERNAL=OFF \ +" + +SOLIBSDEV = "glslang.so" +# all the other libraries are unversioned, so pack it on PN +FILES:${PN} += "${libdir}/*.so" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/graphene/graphene_1.10.8.bb b/poky/meta/recipes-graphics/graphene/graphene_1.10.8.bb new file mode 100644 index 0000000000..813ff74adf --- /dev/null +++ b/poky/meta/recipes-graphics/graphene/graphene_1.10.8.bb @@ -0,0 +1,22 @@ +SUMMARY = "A thin layer of graphic data types" +HOMEPAGE = "http://ebassi.github.io/graphene/" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=a7d871d9e23c450c421a85bb2819f648" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gobject-introspection gtk-doc + +SRC_URI[archive.sha256sum] = "a37bb0e78a419dcbeaa9c7027bcff52f5ec2367c25ec859da31dfde2928f279a" + +# gtk4 & mutter 41.0 requires graphene build with introspection +PACKAGECONFIG ?= "introspection" +PACKAGECONFIG[introspection] = "-Dintrospection=enabled,-Dintrospection=disabled," + +GTKDOC_MESON_OPTION = "gtk_doc" + +EXTRA_OEMESON = "-Dinstalled_tests=false" + +FILES:${PN} += "${libdir}/graphene-1.0" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/harfbuzz/harfbuzz_5.3.1.bb b/poky/meta/recipes-graphics/harfbuzz/harfbuzz_5.3.1.bb deleted file mode 100644 index f56403d428..0000000000 --- a/poky/meta/recipes-graphics/harfbuzz/harfbuzz_5.3.1.bb +++ /dev/null @@ -1,45 +0,0 @@ -SUMMARY = "Text shaping library" -DESCRIPTION = "HarfBuzz is an OpenType text shaping engine." -HOMEPAGE = "http://www.freedesktop.org/wiki/Software/HarfBuzz" -BUGTRACKER = "https://bugs.freedesktop.org/enter_bug.cgi?product=HarfBuzz" -SECTION = "libs" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=6ee0f16281694fb6aa689cca1e0fb3da \ - file://src/hb-ucd.cc;beginline=1;endline=15;md5=29d4dcb6410429195df67efe3382d8bc \ - " - -SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BPN}-${PV}.tar.xz" -SRC_URI[sha256sum] = "4a6ce097b75a8121facc4ba83b5b083bfec657f45b003cd5a3424f2ae6b4434d" - -inherit meson pkgconfig lib_package gtk-doc gobject-introspection github-releases - -GIR_MESON_ENABLE_FLAG = 'enabled' -GIR_MESON_DISABLE_FLAG = 'disabled' -GTKDOC_MESON_ENABLE_FLAG = 'enabled' -GTKDOC_MESON_DISABLE_FLAG = 'disabled' - -PACKAGECONFIG ??= "cairo freetype glib icu" -PACKAGECONFIG[cairo] = "-Dcairo=enabled,-Dcairo=disabled,cairo" -PACKAGECONFIG[freetype] = "-Dfreetype=enabled,-Dfreetype=disabled,freetype" -PACKAGECONFIG[glib] = "-Dglib=enabled,-Dglib=disabled,glib-2.0" -PACKAGECONFIG[graphite] = "-Dgraphite=enabled,-Dgraphite=disabled,graphite2" -PACKAGECONFIG[icu] = "-Dicu=enabled,-Dicu=disabled,icu" - -PACKAGES =+ "${PN}-icu ${PN}-icu-dev ${PN}-subset" - -LEAD_SONAME = "libharfbuzz.so" - -do_install:append() { - # If no tools are installed due to PACKAGECONFIG then this directory is - #still installed, so remove it to stop packaging wanings. - rmdir --ignore-fail-on-non-empty ${D}${bindir} -} - -FILES:${PN}-icu = "${libdir}/libharfbuzz-icu.so.*" -FILES:${PN}-icu-dev = "${libdir}/libharfbuzz-icu.la \ - ${libdir}/libharfbuzz-icu.so \ - ${libdir}/pkgconfig/harfbuzz-icu.pc \ -" -FILES:${PN}-subset = "${libdir}/libharfbuzz-subset.so.*" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/harfbuzz/harfbuzz_6.0.0.bb b/poky/meta/recipes-graphics/harfbuzz/harfbuzz_6.0.0.bb new file mode 100644 index 0000000000..ae54bad643 --- /dev/null +++ b/poky/meta/recipes-graphics/harfbuzz/harfbuzz_6.0.0.bb @@ -0,0 +1,45 @@ +SUMMARY = "Text shaping library" +DESCRIPTION = "HarfBuzz is an OpenType text shaping engine." +HOMEPAGE = "http://www.freedesktop.org/wiki/Software/HarfBuzz" +BUGTRACKER = "https://bugs.freedesktop.org/enter_bug.cgi?product=HarfBuzz" +SECTION = "libs" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=6ee0f16281694fb6aa689cca1e0fb3da \ + file://src/hb-ucd.cc;beginline=1;endline=15;md5=29d4dcb6410429195df67efe3382d8bc \ + " + +SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BPN}-${PV}.tar.xz" +SRC_URI[sha256sum] = "1d1010a1751d076d5291e433c138502a794d679a7498d1268ee21e2d4a140eb4" + +inherit meson pkgconfig lib_package gtk-doc gobject-introspection github-releases + +GIR_MESON_ENABLE_FLAG = 'enabled' +GIR_MESON_DISABLE_FLAG = 'disabled' +GTKDOC_MESON_ENABLE_FLAG = 'enabled' +GTKDOC_MESON_DISABLE_FLAG = 'disabled' + +PACKAGECONFIG ??= "cairo freetype glib icu" +PACKAGECONFIG[cairo] = "-Dcairo=enabled,-Dcairo=disabled,cairo" +PACKAGECONFIG[freetype] = "-Dfreetype=enabled,-Dfreetype=disabled,freetype" +PACKAGECONFIG[glib] = "-Dglib=enabled,-Dglib=disabled,glib-2.0" +PACKAGECONFIG[graphite] = "-Dgraphite=enabled,-Dgraphite=disabled,graphite2" +PACKAGECONFIG[icu] = "-Dicu=enabled,-Dicu=disabled,icu" + +PACKAGES =+ "${PN}-icu ${PN}-icu-dev ${PN}-subset" + +LEAD_SONAME = "libharfbuzz.so" + +do_install:append() { + # If no tools are installed due to PACKAGECONFIG then this directory might + # still be installed, so remove it to stop packaging warnings. + [ ! -d ${D}${bindir} ] || rmdir --ignore-fail-on-non-empty ${D}${bindir} +} + +FILES:${PN}-icu = "${libdir}/libharfbuzz-icu.so.*" +FILES:${PN}-icu-dev = "${libdir}/libharfbuzz-icu.la \ + ${libdir}/libharfbuzz-icu.so \ + ${libdir}/pkgconfig/harfbuzz-icu.pc \ +" +FILES:${PN}-subset = "${libdir}/libharfbuzz-subset.so.*" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/kmscube/kmscube_git.bb b/poky/meta/recipes-graphics/kmscube/kmscube_git.bb index 6ed97dfafe..b2c10e09fb 100644 --- a/poky/meta/recipes-graphics/kmscube/kmscube_git.bb +++ b/poky/meta/recipes-graphics/kmscube/kmscube_git.bb @@ -10,7 +10,7 @@ DEPENDS = "virtual/libgles3 virtual/libgles2 virtual/egl libdrm" LIC_FILES_CHKSUM = "file://kmscube.c;beginline=1;endline=23;md5=8b309d4ee67b7315ff7381270dd631fb" -SRCREV = "3bf6ee1a02334386d87cfe356c3bfb0b24e1fed8" +SRCREV = "345111481d654b38a72b5c3629151dc74f7a82bc" SRC_URI = "git://gitlab.freedesktop.org/mesa/kmscube;branch=master;protocol=https" UPSTREAM_CHECK_COMMITS = "1" diff --git a/poky/meta/recipes-graphics/libepoxy/files/0001-dispatch_common.h-define-also-EGL_NO_X11.patch b/poky/meta/recipes-graphics/libepoxy/files/0001-dispatch_common.h-define-also-EGL_NO_X11.patch deleted file mode 100644 index 971a3f54e0..0000000000 --- a/poky/meta/recipes-graphics/libepoxy/files/0001-dispatch_common.h-define-also-EGL_NO_X11.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7211120d1e2f059d900f3379b9790484dbcf7761 Mon Sep 17 00:00:00 2001 -From: Martin Jansa -Date: Fri, 25 Oct 2019 11:09:34 +0000 -Subject: [PATCH] dispatch_common.h: define also EGL_NO_X11 - -MESA_EGL_NO_X11_HEADERS was renamed to EGL_NO_X11 in: -https://github.com/mesa3d/mesa/commit/6202a13b71e18dc31ba7e2f4ea915b67eacc1ddb - -Signed-off-by: Martin Jansa -Upstream-Status: Pending - ---- - src/dispatch_common.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/dispatch_common.h b/src/dispatch_common.h -index a136943..448c9b1 100644 ---- a/src/dispatch_common.h -+++ b/src/dispatch_common.h -@@ -55,6 +55,7 @@ - * as EGL_NO_X11 - */ - # define MESA_EGL_NO_X11_HEADERS 1 -+# define EGL_NO_X11 1 - # endif - #include "epoxy/egl.h" - #endif diff --git a/poky/meta/recipes-graphics/libepoxy/libepoxy_1.5.10.bb b/poky/meta/recipes-graphics/libepoxy/libepoxy_1.5.10.bb index d10134568a..384afa6907 100644 --- a/poky/meta/recipes-graphics/libepoxy/libepoxy_1.5.10.bb +++ b/poky/meta/recipes-graphics/libepoxy/libepoxy_1.5.10.bb @@ -9,9 +9,7 @@ SECTION = "libs" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=58ef4c80d401e07bd9ee8b6b58cf464b" -SRC_URI = "git://github.com/anholt/libepoxy;branch=master;protocol=https \ - file://0001-dispatch_common.h-define-also-EGL_NO_X11.patch \ - " +SRC_URI = "git://github.com/anholt/libepoxy;branch=master;protocol=https" SRCREV = "c84bc9459357a40e46e2fec0408d04fbdde2c973" S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch b/poky/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch deleted file mode 100644 index f34b870e74..0000000000 --- a/poky/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 77093de6a12c24a60fc447698900d18d0a3943af Mon Sep 17 00:00:00 2001 -From: Carlos Rafael Giani -Date: Fri, 18 Mar 2022 12:06:23 +0100 -Subject: [PATCH] Disable libunwind in native OE builds by not looking for - libunwind - -This is a workaround for this build error: - -| -- Checking for one of the modules 'libunwind' -| CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message): -| None of the required 'libunwind' found -| Call Stack (most recent call first): -| CMakeLists.txt:1367 (pkg_search_module) - -By not looking for the libunwind header, the rest of the libunwind -specific bits in the CMake build script are disabled. - -Upstream-Status: Inappropriate [OE specific] - ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7617205..d9b1522 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -952,7 +952,7 @@ if(SDL_LIBC) - check_include_file(sys/types.h HAVE_SYS_TYPES_H) - foreach(_HEADER - stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h float.h -- strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h) -+ strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) - string(TOUPPER "HAVE_${_HEADER}" _UPPER) - string(REPLACE "." "_" _HAVE_H ${_UPPER}) - check_include_file("${_HEADER}" ${_HAVE_H}) diff --git a/poky/meta/recipes-graphics/libsdl2/libsdl2_2.24.2.bb b/poky/meta/recipes-graphics/libsdl2/libsdl2_2.24.2.bb deleted file mode 100644 index ce5a8aa8f2..0000000000 --- a/poky/meta/recipes-graphics/libsdl2/libsdl2_2.24.2.bb +++ /dev/null @@ -1,85 +0,0 @@ -SUMMARY = "Simple DirectMedia Layer" -DESCRIPTION = "Simple DirectMedia Layer is a cross-platform multimedia \ -library designed to provide low level access to audio, keyboard, mouse, \ -joystick, 3D hardware via OpenGL, and 2D video framebuffer." -HOMEPAGE = "http://www.libsdl.org" -BUGTRACKER = "http://bugzilla.libsdl.org/" - -SECTION = "libs" - -LICENSE = "Zlib & BSD-2-Clause" -LIC_FILES_CHKSUM = "\ - file://LICENSE.txt;md5=68a088513da90254b2fbe664f42af315 \ - file://src/hidapi/LICENSE.txt;md5=7c3949a631240cb6c31c50f3eb696077 \ - file://src/hidapi/LICENSE-bsd.txt;md5=b5fa085ce0926bb50d0621620a82361f \ - file://src/video/yuv2rgb/LICENSE;md5=79f8f3418d91531e05f0fc94ca67e071 \ -" - -# arm-neon adds MIT license -LICENSE:append = " ${@bb.utils.contains('PACKAGECONFIG', 'arm-neon', '& MIT', '', d)}" -LIC_FILES_CHKSUM:append = " ${@bb.utils.contains('PACKAGECONFIG', 'arm-neon', 'file://src/video/arm/pixman-arm-neon-asm.h;md5=9a9cc1e51abbf1da58f4d9528ec9d49b;beginline=1;endline=24', '', d)}" - -PROVIDES = "virtual/libsdl2" - -SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \ - " -SRC_URI:append:class-native = " file://0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch" - -S = "${WORKDIR}/SDL2-${PV}" - -SRC_URI[sha256sum] = "b35ef0a802b09d90ed3add0dcac0e95820804202914f5bb7b0feb710f1a1329f" - -inherit cmake lib_package binconfig-disabled pkgconfig upstream-version-is-even - -BINCONFIG = "${bindir}/sdl2-config" - -CVE_PRODUCT = "simple_directmedia_layer sdl" - -EXTRA_OECMAKE = "-DSDL_OSS=OFF -DSDL_ESD=OFF -DSDL_ARTS=OFF \ - -DSDL_DISKAUDIO=OFF -DSDL_NAS=OFF -DSDL_ESD_SHARED=OFF \ - -DSDL_DUMMYVIDEO=OFF \ - -DSDL_RPI=OFF \ - -DSDL_PTHREADS=ON \ - -DSDL_RPATH=OFF \ - -DSDL_SNDIO=OFF \ - -DSDL_X11_XCURSOR=OFF \ - -DSDL_X11_XDBE=OFF \ - -DSDL_X11_XFIXES=OFF \ - -DSDL_X11_XINPUT=OFF \ - -DSDL_X11_XRANDR=OFF \ - -DSDL_X11_XSCRNSAVER=OFF \ - -DSDL_X11_XSHAPE=OFF \ -" - -# opengl packageconfig factored out to make it easy for distros -# and BSP layers to pick either (desktop) opengl, gles2, or no GL -PACKAGECONFIG_GL ?= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl', d)}" - -PACKAGECONFIG:class-native = "x11 ${PACKAGECONFIG_GL}" -PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} ${PACKAGECONFIG_GL}" -PACKAGECONFIG ??= " \ - ${PACKAGECONFIG_GL} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio x11 vulkan', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland gles2', '', d)} \ - ${@bb.utils.contains("TUNE_FEATURES", "neon","arm-neon","",d)} \ -" -PACKAGECONFIG[alsa] = "-DSDL_ALSA=ON,-DSDL_ALSA=OFF,alsa-lib," -PACKAGECONFIG[arm-neon] = "-DSDL_ARMNEON=ON,-DSDL_ARMNEON=OFF" -PACKAGECONFIG[directfb] = "-DSDL_DIRECTFB=ON,-DSDL_DIRECTFB=OFF,directfb,directfb" -PACKAGECONFIG[gles2] = "-DSDL_OPENGLES=ON,-DSDL_OPENGLES=OFF,virtual/libgles2" -PACKAGECONFIG[jack] = "-DSDL_JACK=ON,-DSDL_JACK=OFF,jack" -PACKAGECONFIG[kmsdrm] = "-DSDL_KMSDRM=ON,-DSDL_KMSDRM=OFF,libdrm virtual/libgbm" -# The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers, -# so we'll just use libusb when it's available. -PACKAGECONFIG[libusb] = ",,libusb1" -PACKAGECONFIG[opengl] = "-DSDL_OPENGL=ON,-DSDL_OPENGL=OFF,virtual/egl" -PACKAGECONFIG[pulseaudio] = "-DSDL_PULSEAUDIO=ON,-DSDL_PULSEAUDIO=OFF,pulseaudio" -PACKAGECONFIG[vulkan] = "-DSDL_VULKAN=ON,-DSDL_VULKAN=OFF" -PACKAGECONFIG[wayland] = "-DSDL_WAYLAND=ON,-DSDL_WAYLAND=OFF,wayland-native wayland wayland-protocols libxkbcommon" -PACKAGECONFIG[x11] = "-DSDL_X11=ON,-DSDL_X11=OFF,virtual/libx11 libxext libxrandr libxrender" - -CFLAGS:append:class-native = " -DNO_SHARED_MEMORY" - -FILES:${PN} += "${datadir}/licenses/SDL2/LICENSE.txt" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/libsdl2/libsdl2_2.26.2.bb b/poky/meta/recipes-graphics/libsdl2/libsdl2_2.26.2.bb new file mode 100644 index 0000000000..17fc410f6c --- /dev/null +++ b/poky/meta/recipes-graphics/libsdl2/libsdl2_2.26.2.bb @@ -0,0 +1,85 @@ +SUMMARY = "Simple DirectMedia Layer" +DESCRIPTION = "Simple DirectMedia Layer is a cross-platform multimedia \ +library designed to provide low level access to audio, keyboard, mouse, \ +joystick, 3D hardware via OpenGL, and 2D video framebuffer." +HOMEPAGE = "http://www.libsdl.org" +BUGTRACKER = "http://bugzilla.libsdl.org/" + +SECTION = "libs" + +LICENSE = "Zlib & BSD-2-Clause" +LIC_FILES_CHKSUM = "\ + file://LICENSE.txt;md5=68a088513da90254b2fbe664f42af315 \ + file://src/hidapi/LICENSE.txt;md5=7c3949a631240cb6c31c50f3eb696077 \ + file://src/hidapi/LICENSE-bsd.txt;md5=b5fa085ce0926bb50d0621620a82361f \ + file://src/video/yuv2rgb/LICENSE;md5=79f8f3418d91531e05f0fc94ca67e071 \ +" + +# arm-neon adds MIT license +LICENSE:append = " ${@bb.utils.contains('PACKAGECONFIG', 'arm-neon', '& MIT', '', d)}" +LIC_FILES_CHKSUM:append = " ${@bb.utils.contains('PACKAGECONFIG', 'arm-neon', 'file://src/video/arm/pixman-arm-neon-asm.h;md5=9a9cc1e51abbf1da58f4d9528ec9d49b;beginline=1;endline=24', '', d)}" + +PROVIDES = "virtual/libsdl2" + +SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz" + +S = "${WORKDIR}/SDL2-${PV}" + +SRC_URI[sha256sum] = "95d39bc3de037fbdfa722623737340648de4f180a601b0afad27645d150b99e0" + +inherit cmake lib_package binconfig-disabled pkgconfig upstream-version-is-even + +BINCONFIG = "${bindir}/sdl2-config" + +CVE_PRODUCT = "simple_directmedia_layer sdl" + +EXTRA_OECMAKE = "-DSDL_OSS=OFF -DSDL_ESD=OFF -DSDL_ARTS=OFF \ + -DSDL_DISKAUDIO=OFF -DSDL_NAS=OFF -DSDL_ESD_SHARED=OFF \ + -DSDL_DUMMYVIDEO=OFF \ + -DSDL_RPI=OFF \ + -DSDL_PTHREADS=ON \ + -DSDL_RPATH=OFF \ + -DSDL_SNDIO=OFF \ + -DSDL_X11_XCURSOR=OFF \ + -DSDL_X11_XDBE=OFF \ + -DSDL_X11_XFIXES=OFF \ + -DSDL_X11_XINPUT=OFF \ + -DSDL_X11_XRANDR=OFF \ + -DSDL_X11_XSCRNSAVER=OFF \ + -DSDL_X11_XSHAPE=OFF \ +" + +# opengl packageconfig factored out to make it easy for distros +# and BSP layers to pick either (desktop) opengl, gles2, or no GL +PACKAGECONFIG_GL ?= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl', d)}" + +PACKAGECONFIG:class-native = "x11 ${PACKAGECONFIG_GL}" +PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} ${PACKAGECONFIG_GL}" +PACKAGECONFIG ??= " \ + ${PACKAGECONFIG_GL} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio pipewire x11 vulkan', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland gles2', '', d)} \ + ${@bb.utils.contains("TUNE_FEATURES", "neon","arm-neon","",d)} \ +" +PACKAGECONFIG[alsa] = "-DSDL_ALSA=ON,-DSDL_ALSA=OFF,alsa-lib," +PACKAGECONFIG[arm-neon] = "-DSDL_ARMNEON=ON,-DSDL_ARMNEON=OFF" +PACKAGECONFIG[directfb] = "-DSDL_DIRECTFB=ON,-DSDL_DIRECTFB=OFF,directfb,directfb" +PACKAGECONFIG[gles2] = "-DSDL_OPENGLES=ON,-DSDL_OPENGLES=OFF,virtual/libgles2" +PACKAGECONFIG[jack] = "-DSDL_JACK=ON,-DSDL_JACK=OFF,jack" +PACKAGECONFIG[kmsdrm] = "-DSDL_KMSDRM=ON,-DSDL_KMSDRM=OFF,libdrm virtual/libgbm" +# The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers, +# so we'll just use libusb when it's available. +PACKAGECONFIG[libusb] = ",,libusb1" +PACKAGECONFIG[libdecor] = "-DSDL_WAYLAND_LIBDECOR=ON,-DSDL_WAYLAND_LIBDECOR=OFF,libdecor" +PACKAGECONFIG[opengl] = "-DSDL_OPENGL=ON,-DSDL_OPENGL=OFF,virtual/egl" +PACKAGECONFIG[pipewire] = "-DSDL_PIPEWIRE_SHARED=ON,-DSDL_PIPEWIRE_SHARED=OFF,pipewire" +PACKAGECONFIG[pulseaudio] = "-DSDL_PULSEAUDIO=ON,-DSDL_PULSEAUDIO=OFF,pulseaudio" +PACKAGECONFIG[vulkan] = "-DSDL_VULKAN=ON,-DSDL_VULKAN=OFF" +PACKAGECONFIG[wayland] = "-DSDL_WAYLAND=ON,-DSDL_WAYLAND=OFF,wayland-native wayland wayland-protocols libxkbcommon" +PACKAGECONFIG[x11] = "-DSDL_X11=ON,-DSDL_X11=OFF,virtual/libx11 libxext libxrandr libxrender" + +CFLAGS:append:class-native = " -DNO_SHARED_MEMORY" + +FILES:${PN} += "${datadir}/licenses/SDL2/LICENSE.txt" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/libva/libva-utils_2.16.0.bb b/poky/meta/recipes-graphics/libva/libva-utils_2.16.0.bb deleted file mode 100644 index cdf4d79dc1..0000000000 --- a/poky/meta/recipes-graphics/libva/libva-utils_2.16.0.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "libva-utils is a collection of utilities from libva project" - -DESCRIPTION = "libva-utils is a collection of utilities \ -and examples to exercise VA-API in accordance with the libva \ -project.VA-API is an open-source library and API specification, \ -which provides access to graphics hardware acceleration capabilities \ -for video processing. It consists of a main library and driver-specific \ -acceleration backends for each supported hardware vendor" - -HOMEPAGE = "https://01.org/linuxmedia/vaapi" -BUGTRACKER = "https://github.com/intel/libva-utils/issues" - -SECTION = "x11" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=b148fc8adf19dc9aec17cf9cd29a9a5e" - -SRC_URI = "git://github.com/intel/libva-utils.git;branch=v2.16-branch;protocol=https" -SRCREV = "cdf39e1e3da85a91ef53438c3b6a97e77dda96aa" -S = "${WORKDIR}/git" - -UPSTREAM_CHECK_GITTAGREGEX = "(?P(\d+(\.\d+)+))$" - -DEPENDS = "libva" - -inherit meson pkgconfig features_check - -# depends on libva which requires opengl -REQUIRED_DISTRO_FEATURES = "opengl" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" -PACKAGECONFIG[x11] = "-Dx11=true, -Dx11=false,virtual/libx11 libxext libxfixes" -PACKAGECONFIG[wayland] = "-Dwayland=true, -Dwayland=false,wayland-native wayland" diff --git a/poky/meta/recipes-graphics/libva/libva-utils_2.17.1.bb b/poky/meta/recipes-graphics/libva/libva-utils_2.17.1.bb new file mode 100644 index 0000000000..1e475e804b --- /dev/null +++ b/poky/meta/recipes-graphics/libva/libva-utils_2.17.1.bb @@ -0,0 +1,32 @@ +SUMMARY = "libva-utils is a collection of utilities from libva project" + +DESCRIPTION = "libva-utils is a collection of utilities \ +and examples to exercise VA-API in accordance with the libva \ +project.VA-API is an open-source library and API specification, \ +which provides access to graphics hardware acceleration capabilities \ +for video processing. It consists of a main library and driver-specific \ +acceleration backends for each supported hardware vendor" + +HOMEPAGE = "https://01.org/linuxmedia/vaapi" +BUGTRACKER = "https://github.com/intel/libva-utils/issues" + +SECTION = "x11" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=b148fc8adf19dc9aec17cf9cd29a9a5e" + +SRC_URI = "git://github.com/intel/libva-utils.git;branch=v2.17-branch;protocol=https" +SRCREV = "3a291be22cfe70e41bad8a376fa278efa651fdff" +S = "${WORKDIR}/git" + +UPSTREAM_CHECK_GITTAGREGEX = "(?P(\d+(\.\d+)+))$" + +DEPENDS = "libva" + +inherit meson pkgconfig features_check + +# depends on libva which requires opengl +REQUIRED_DISTRO_FEATURES = "opengl" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" +PACKAGECONFIG[x11] = "-Dx11=true, -Dx11=false,virtual/libx11 libxext libxfixes" +PACKAGECONFIG[wayland] = "-Dwayland=true, -Dwayland=false,wayland-native wayland" diff --git a/poky/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb b/poky/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb index f2bc8f6b5b..c7c7aa7ac3 100644 --- a/poky/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb +++ b/poky/meta/recipes-graphics/mesa/mesa-gl_22.2.3.bb @@ -8,6 +8,6 @@ S = "${WORKDIR}/mesa-${PV}" # At least one DRI rendering engine is required to build mesa. # When no X11 is available, use osmesa for the rendering engine. -PACKAGECONFIG ??= "opengl ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa gallium', d)}" -PACKAGECONFIG:class-target = "opengl ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa gallium', d)}" +PACKAGECONFIG ??= "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa', d)}" +PACKAGECONFIG:class-target = "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'osmesa', d)}" diff --git a/poky/meta/recipes-graphics/mesa/mesa.inc b/poky/meta/recipes-graphics/mesa/mesa.inc index 1949fc15a9..77aa97069a 100644 --- a/poky/meta/recipes-graphics/mesa/mesa.inc +++ b/poky/meta/recipes-graphics/mesa/mesa.inc @@ -32,15 +32,18 @@ UPSTREAM_CHECK_GITTAGREGEX = "mesa-(?P\d+(\.\d+)+)" #because we cannot rely on the fact that all apps will use pkgconfig, #make eglplatform.h independent of MESA_EGL_NO_X11_HEADER do_install:append() { - if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)}; then - sed -i -e 's/^#elif defined(__unix__) && defined(EGL_NO_X11)$/#elif defined(__unix__) \&\& defined(EGL_NO_X11) || ${@bb.utils.contains('PACKAGECONFIG', 'x11', '0', '1', d)}/' ${D}${includedir}/EGL/eglplatform.h - fi + # sed can't find EGL/eglplatform.h as it doesn't get installed when glvnd enabled. + # So, check if EGL/eglplatform.h exists before running sed. + if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)} && [ -f ${D}${includedir}/EGL/eglplatform.h ]; then + sed -i -e 's/^#elif defined(__unix__) && defined(EGL_NO_X11)$/#elif defined(__unix__) \&\& defined(EGL_NO_X11) || ${@bb.utils.contains('PACKAGECONFIG', 'x11', '0', '1', d)}/' ${D}${includedir}/EGL/eglplatform.h + fi } DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native" EXTRANATIVEPATH += "chrpath-native" PROVIDES = " \ ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', 'virtual/libglx', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2 virtual/libgles3', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \ @@ -55,7 +58,7 @@ ANY_OF_DISTRO_FEATURES:class-target = "opengl vulkan" PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}" -MESA_LLVM_RELEASE ?= "${LLVMVERSION}" +MESA_LLVM_RELEASE ?= "" # set the MESA_BUILD_TYPE to either 'release' (default) or 'debug' # by default the upstream mesa sources build a debug release @@ -109,6 +112,7 @@ VULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'broadcom', ',broa PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${@strip_comma('${VULKAN_DRIVERS}')}, -Dvulkan-drivers='',glslang-native vulkan-loader vulkan-headers" PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false" +PACKAGECONFIG[glvnd] = "-Dglvnd=true, -Dglvnd=false, libglvnd" # "gles" requires "opengl" PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2=disabled" @@ -199,6 +203,7 @@ RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'lib PACKAGES =+ "libegl-mesa libegl-mesa-dev \ libosmesa libosmesa-dev \ libgl-mesa libgl-mesa-dev \ + libglx-mesa libglx-mesa-dev \ libglapi libglapi-dev \ libgbm libgbm-dev \ libgles1-mesa libgles1-mesa-dev \ @@ -217,7 +222,7 @@ do_install:append () { rm -f ${D}${libdir}/gallium-pipe/*.la rm -f ${D}${libdir}/gbm/*.la - # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used + # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used chrpath --delete ${D}${libdir}/dri/*_dri.so || true # libwayland-egl has been moved to wayland 1.15+ @@ -235,6 +240,7 @@ python __anonymous() { suffix = "-native" for p in (("egl", "libegl", "libegl1"), ("opengl", "libgl", "libgl1"), + ("glvnd", "libglx",), ("gles", "libgles1", "libglesv1-cm1"), ("gles", "libgles2", "libglesv2-2"), ("gles", "libgles3",), @@ -285,7 +291,7 @@ python mesa_populate_packages() { do_split_packages(d, pipe_drivers_root, r'^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='') } -PACKAGESPLITFUNCS:prepend = "mesa_populate_packages " +PACKAGESPLITFUNCS =+ "mesa_populate_packages" PACKAGES_DYNAMIC += "^mesa-driver-.*" PACKAGES_DYNAMIC:class-native = "^mesa-driver-.*-native" @@ -293,20 +299,22 @@ PACKAGES_DYNAMIC:class-native = "^mesa-driver-.*-native" FILES:mesa-megadriver = "${libdir}/dri/* ${datadir}/drirc.d" FILES:mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan" FILES:${PN}-vdpau-drivers = "${libdir}/vdpau/*.so.*" -FILES:libegl-mesa = "${libdir}/libEGL.so.*" +FILES:libegl-mesa = "${libdir}/libEGL*.so.* ${datadir}/glvnd/egl_vendor.d" FILES:libgbm = "${libdir}/libgbm.so.*" FILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*" FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*" FILES:libgl-mesa = "${libdir}/libGL.so.*" +FILES:libglx-mesa = "${libdir}/libGLX*.so.*" FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd" FILES:libglapi = "${libdir}/libglapi.so.*" FILES:libosmesa = "${libdir}/libOSMesa.so.*" FILES:libxatracker = "${libdir}/libxatracker.so.*" FILES:${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan ${libdir}/vdpau/*.so" -FILES:libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc" +FILES:libegl-mesa-dev = "${libdir}/libEGL*.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc" FILES:libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h" FILES:libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc" +FILES:libglx-mesa-dev = "${libdir}/libGLX*.*" FILES:libglapi-dev = "${libdir}/libglapi.*" FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" diff --git a/poky/meta/recipes-graphics/pango/pango/0001-tests-meson.build-install-nofonts-fonts.conf-as-it-i.patch b/poky/meta/recipes-graphics/pango/pango/0001-tests-meson.build-install-nofonts-fonts.conf-as-it-i.patch deleted file mode 100644 index 8dacd62138..0000000000 --- a/poky/meta/recipes-graphics/pango/pango/0001-tests-meson.build-install-nofonts-fonts.conf-as-it-i.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 13f8ba5d5b699df1f88eeea859406daba6d6941f Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Tue, 8 Nov 2022 18:08:51 +0100 -Subject: [PATCH] tests/meson.build: install nofonts/fonts.conf as it is - required by tests - -Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/pango/-/merge_requests/654] -Signed-off-by: Alexander Kanavin ---- - tests/meson.build | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/tests/meson.build b/tests/meson.build -index 8b4bfa38..6c1c461b 100644 ---- a/tests/meson.build -+++ b/tests/meson.build -@@ -250,6 +250,10 @@ foreach d: test_items_data - installed_test_items_data += d + '.expected' - endforeach - -+installed_test_nofonts_data = [ -+ 'nofonts/fonts.conf', -+] -+ - installed_test_datadir = join_paths(pango_datadir, 'installed-tests', 'pango') - installed_test_bindir = join_paths(pango_libexecdir, 'installed-tests', 'pango') - -@@ -261,6 +265,7 @@ if get_option('install-tests') - install_data(installed_test_breaks_data, install_dir: join_paths(installed_test_bindir, 'breaks')) - install_data(installed_test_items_data, install_dir: join_paths(installed_test_bindir, 'itemize')) - install_data(installed_test_fontsets_data, install_dir: join_paths(installed_test_bindir, 'fontsets')) -+ install_data(installed_test_nofonts_data, install_dir: join_paths(installed_test_bindir, 'nofonts')) - endif - - gen_installed_test = files([ 'gen-installed-test.py' ]) diff --git a/poky/meta/recipes-graphics/pango/pango_1.50.11.bb b/poky/meta/recipes-graphics/pango/pango_1.50.11.bb deleted file mode 100644 index 6f599f5b78..0000000000 --- a/poky/meta/recipes-graphics/pango/pango_1.50.11.bb +++ /dev/null @@ -1,55 +0,0 @@ -SUMMARY = "Framework for layout and rendering of internationalized text" -DESCRIPTION = "Pango is a library for laying out and rendering of text, \ -with an emphasis on internationalization. Pango can be used anywhere \ -that text layout is needed, though most of the work on Pango so far has \ -been done in the context of the GTK+ widget toolkit. Pango forms the \ -core of text and font handling for GTK+-2.x." -HOMEPAGE = "http://www.pango.org/" -BUGTRACKER = "http://bugzilla.gnome.org" -SECTION = "libs" -LICENSE = "LGPL-2.0-or-later" - -LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7" - -GNOMEBASEBUILDCLASS = "meson" - -inherit gnomebase gi-docgen ptest-gnome upstream-version-is-even gobject-introspection - -UPSTREAM_CHECK_REGEX = "pango-(?P\d+\.(?!9\d+)\d+\.\d+)" - -GIR_MESON_ENABLE_FLAG = "enabled" -GIR_MESON_DISABLE_FLAG = "disabled" - -SRC_URI += "file://run-ptest \ - file://0001-Skip-running-test-layout-test.patch \ - file://0001-tests-meson.build-install-nofonts-fonts.conf-as-it-i.patch \ - " - -SRC_URI[archive.sha256sum] = "8800f812d89ee61388188703203f3a7878963c22f8695aaf1fa0a1a1428d17ae" - -DEPENDS = "glib-2.0 glib-2.0-native fontconfig freetype virtual/libiconv cairo harfbuzz fribidi" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} \ - ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" - -PACKAGECONFIG[x11] = ",,virtual/libx11 libxft" -PACKAGECONFIG[tests] = "-Dinstall-tests=true, -Dinstall-tests=false" -PACKAGECONFIG[thai] = ",,libthai" - -GIR_MESON_OPTION = 'introspection' - -do_configure:prepend() { - chmod +x ${S}/tests/*.py -} - -LEAD_SONAME = "libpango-1.0*" - -FILES:${PN} = "${bindir}/* ${libdir}/libpango*${SOLIBS}" - -RDEPENDS:${PN}-ptest += "cantarell-fonts" -RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-en-us" - -RPROVIDES:${PN} += "pango-modules pango-module-indic-lang \ - pango-module-basic-fc pango-module-arabic-lang" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/pango/pango_1.50.12.bb b/poky/meta/recipes-graphics/pango/pango_1.50.12.bb new file mode 100644 index 0000000000..6779f39c4f --- /dev/null +++ b/poky/meta/recipes-graphics/pango/pango_1.50.12.bb @@ -0,0 +1,54 @@ +SUMMARY = "Framework for layout and rendering of internationalized text" +DESCRIPTION = "Pango is a library for laying out and rendering of text, \ +with an emphasis on internationalization. Pango can be used anywhere \ +that text layout is needed, though most of the work on Pango so far has \ +been done in the context of the GTK+ widget toolkit. Pango forms the \ +core of text and font handling for GTK+-2.x." +HOMEPAGE = "http://www.pango.org/" +BUGTRACKER = "http://bugzilla.gnome.org" +SECTION = "libs" +LICENSE = "LGPL-2.0-or-later" + +LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7" + +GNOMEBASEBUILDCLASS = "meson" + +inherit gnomebase gi-docgen ptest-gnome upstream-version-is-even gobject-introspection + +UPSTREAM_CHECK_REGEX = "pango-(?P\d+\.(?!9\d+)\d+\.\d+)" + +GIR_MESON_ENABLE_FLAG = "enabled" +GIR_MESON_DISABLE_FLAG = "disabled" + +SRC_URI += "file://run-ptest \ + file://0001-Skip-running-test-layout-test.patch \ + " + +SRC_URI[archive.sha256sum] = "caef96d27bbe792a6be92727c73468d832b13da57c8071ef79b9df69ee058fe3" + +DEPENDS = "glib-2.0 glib-2.0-native fontconfig freetype virtual/libiconv cairo harfbuzz fribidi" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} \ + ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" + +PACKAGECONFIG[x11] = ",,virtual/libx11 libxft" +PACKAGECONFIG[tests] = "-Dinstall-tests=true, -Dinstall-tests=false" +PACKAGECONFIG[thai] = ",,libthai" + +GIR_MESON_OPTION = 'introspection' + +do_configure:prepend() { + chmod +x ${S}/tests/*.py +} + +LEAD_SONAME = "libpango-1.0*" + +FILES:${PN} = "${bindir}/* ${libdir}/libpango*${SOLIBS}" + +RDEPENDS:${PN}-ptest += "cantarell-fonts" +RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-en-us" + +RPROVIDES:${PN} += "pango-modules pango-module-indic-lang \ + pango-module-basic-fc pango-module-arabic-lang" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/piglit/piglit/0005-cmake-Don-t-enable-GLX-if-tests-are-disabled.patch b/poky/meta/recipes-graphics/piglit/piglit/0005-cmake-Don-t-enable-GLX-if-tests-are-disabled.patch deleted file mode 100644 index ef6fda0f4e..0000000000 --- a/poky/meta/recipes-graphics/piglit/piglit/0005-cmake-Don-t-enable-GLX-if-tests-are-disabled.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 13ff43fe760ac343b33d8e8c84b89886aac07116 Mon Sep 17 00:00:00 2001 -From: Tom Hochstein -Date: Fri, 3 Jun 2022 10:44:29 -0500 -Subject: [PATCH] cmake: Don't enable GLX if tests are disabled - -Allow building for systems that don't support GLX. - -Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/720] -Signed-off-by: Tom Hochstein ---- - CMakeLists.txt | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e1aeb5ddf..85e171aba 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -134,10 +134,7 @@ if(PIGLIT_BUILD_CL_TESTS) - endif(PIGLIT_BUILD_CL_TESTS) - - IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") -- if(X11_FOUND AND OPENGL_gl_LIBRARY) -- # Assume the system has GLX. In the future, systems may exist -- # with libGL and libX11 but no GLX, but that world hasn't -- # arrived yet. -+ if(X11_FOUND AND OPENGL_gl_LIBRARY AND PIGLIT_BUILD_GLX_TESTS) - set(PIGLIT_HAS_GLX True) - add_definitions(-DPIGLIT_HAS_GLX) - endif() --- -2.17.1 - diff --git a/poky/meta/recipes-graphics/piglit/piglit_git.bb b/poky/meta/recipes-graphics/piglit/piglit_git.bb index 8d66df4e09..7858fa0b08 100644 --- a/poky/meta/recipes-graphics/piglit/piglit_git.bb +++ b/poky/meta/recipes-graphics/piglit/piglit_git.bb @@ -10,11 +10,10 @@ SRC_URI = "git://gitlab.freedesktop.org/mesa/piglit.git;protocol=https;branch=ma file://0001-cmake-install-bash-completions-in-the-right-place.patch \ file://0002-cmake-use-proper-WAYLAND_INCLUDE_DIRS-variable.patch \ file://0003-tests-util-piglit-shader.c-do-not-hardcode-build-pat.patch \ - file://0005-cmake-Don-t-enable-GLX-if-tests-are-disabled.patch \ " UPSTREAM_CHECK_COMMITS = "1" -SRCREV = "1cd716180cfb6ef0c1fc54702460ef49e5115791" +SRCREV = "e300648a805d62101de341232d99bfec1cce78c5" # (when PV goes above 1.0 remove the trailing r) PV = "1.0+gitr${SRCPV}" diff --git a/poky/meta/recipes-graphics/shaderc/shaderc_2022.3.bb b/poky/meta/recipes-graphics/shaderc/shaderc_2022.3.bb deleted file mode 100644 index c340646fa7..0000000000 --- a/poky/meta/recipes-graphics/shaderc/shaderc_2022.3.bb +++ /dev/null @@ -1,30 +0,0 @@ -SUMMARY = "A collection of tools, libraries and tests for shader compilation" -DESCRIPTION = "The Shaderc library provides an API for compiling GLSL/HLSL \ -source code to SPIRV modules. It has been shipping in the Android NDK since version r12b." -SECTION = "graphics" -HOMEPAGE = "https://github.com/google/shaderc" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" - -SRCREV = "4bbb646ddb3279c6a27e7aa0eb86c10c8add987b" -SRC_URI = "git://github.com/google/shaderc.git;protocol=https;branch=main \ - file://0001-cmake-disable-building-external-dependencies.patch \ - file://0002-libshaderc_util-fix-glslang-header-file-location.patch \ - file://0001-CMakeLists.txt-drop-OSDependent-OGLCompiler-from-lis.patch \ - " -UPSTREAM_CHECK_GITTAGREGEX = "^v(?P\d+(\.\d+)+)$" -S = "${WORKDIR}/git" - -inherit cmake python3native pkgconfig - -DEPENDS = "spirv-headers spirv-tools glslang" - -EXTRA_OECMAKE = " \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_EXTERNAL=OFF \ - -DSHADERC_SKIP_TESTS=ON \ - -DSHADERC_SKIP_EXAMPLES=ON \ - -DSHADERC_SKIP_COPYRIGHT_CHECK=ON \ -" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/shaderc/shaderc_2022.4.bb b/poky/meta/recipes-graphics/shaderc/shaderc_2022.4.bb new file mode 100644 index 0000000000..0fe6887cbc --- /dev/null +++ b/poky/meta/recipes-graphics/shaderc/shaderc_2022.4.bb @@ -0,0 +1,30 @@ +SUMMARY = "A collection of tools, libraries and tests for shader compilation" +DESCRIPTION = "The Shaderc library provides an API for compiling GLSL/HLSL \ +source code to SPIRV modules. It has been shipping in the Android NDK since version r12b." +SECTION = "graphics" +HOMEPAGE = "https://github.com/google/shaderc" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRCREV = "067e008c80c323b1cd1ab1e547b38f9a5f52269e" +SRC_URI = "git://github.com/google/shaderc.git;protocol=https;branch=main \ + file://0001-cmake-disable-building-external-dependencies.patch \ + file://0002-libshaderc_util-fix-glslang-header-file-location.patch \ + file://0001-CMakeLists.txt-drop-OSDependent-OGLCompiler-from-lis.patch \ + " +UPSTREAM_CHECK_GITTAGREGEX = "^v(?P\d+(\.\d+)+)$" +S = "${WORKDIR}/git" + +inherit cmake python3native pkgconfig + +DEPENDS = "spirv-headers spirv-tools glslang" + +EXTRA_OECMAKE = " \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_EXTERNAL=OFF \ + -DSHADERC_SKIP_TESTS=ON \ + -DSHADERC_SKIP_EXAMPLES=ON \ + -DSHADERC_SKIP_COPYRIGHT_CHECK=ON \ +" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/spir/spirv-headers_1.3.231.1.bb b/poky/meta/recipes-graphics/spir/spirv-headers_1.3.231.1.bb deleted file mode 100644 index fdcc8d523f..0000000000 --- a/poky/meta/recipes-graphics/spir/spirv-headers_1.3.231.1.bb +++ /dev/null @@ -1,18 +0,0 @@ -SUMMARY = "Machine-readable files for the SPIR-V Registry" -DESCRIPTION = "Headers are provided in the include directory, with up-to-date \ -headers in the unified1 subdirectory. Older headers are provided according to \ -their version." -SECTION = "graphics" -HOMEPAGE = "https://www.khronos.org/registry/spir-v" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=c938b85bceb8fb26c1a807f28a52ae2d" - -SRCREV = "85a1ed200d50660786c1a88d9166e871123cce39" -SRC_URI = "git://github.com/KhronosGroup/SPIRV-Headers;protocol=https;branch=master" -PE = "1" -UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" -S = "${WORKDIR}/git" - -inherit cmake - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/spir/spirv-headers_1.3.236.0.bb b/poky/meta/recipes-graphics/spir/spirv-headers_1.3.236.0.bb new file mode 100644 index 0000000000..e35628ecbf --- /dev/null +++ b/poky/meta/recipes-graphics/spir/spirv-headers_1.3.236.0.bb @@ -0,0 +1,18 @@ +SUMMARY = "Machine-readable files for the SPIR-V Registry" +DESCRIPTION = "Headers are provided in the include directory, with up-to-date \ +headers in the unified1 subdirectory. Older headers are provided according to \ +their version." +SECTION = "graphics" +HOMEPAGE = "https://www.khronos.org/registry/spir-v" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=c938b85bceb8fb26c1a807f28a52ae2d" + +SRCREV = "1d31a100405cf8783ca7a31e31cdd727c9fc54c3" +SRC_URI = "git://github.com/KhronosGroup/SPIRV-Headers;protocol=https;branch=master" +PE = "1" +UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" +S = "${WORKDIR}/git" + +inherit cmake + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb b/poky/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb deleted file mode 100644 index e175cde145..0000000000 --- a/poky/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb +++ /dev/null @@ -1,42 +0,0 @@ -SUMMARY = "The SPIR-V Tools project provides an API and commands for \ -processing SPIR-V modules" -DESCRIPTION = "The project includes an assembler, binary module parser, \ -disassembler, validator, and optimizer for SPIR-V." -HOMEPAGE = "https://github.com/KhronosGroup/SPIRV-Tools" -SECTION = "graphics" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" - -SRCREV = "eb0a36633d2acf4de82588504f951ad0f2cecacb" -SRC_URI = "git://github.com/KhronosGroup/SPIRV-Tools.git;branch=master;protocol=https" -PE = "1" -UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" -S = "${WORKDIR}/git" - -inherit cmake python3native - -DEPENDS = "spirv-headers" - -EXTRA_OECMAKE += "\ - -DSPIRV-Headers_SOURCE_DIR=${STAGING_EXECPREFIXDIR} \ - -DSPIRV_TOOLS_BUILD_STATIC=OFF \ - -DBUILD_SHARED_LIBS=ON \ - -DSPIRV_SKIP_TESTS=ON \ -" - -do_install:append:class-target() { - # Properly set _IMPORT_PREFIX in INTERFACE_LINK_LIBRARIES so that dependent - # tools can find the right library - sed -i ${D}${libdir}/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake \ - -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}/lib":' -} - -# all the libraries are unversioned, so don't pack it on PN-dev -SOLIBS = ".so" -FILES_SOLIBSDEV = "" - -PACKAGES =+ "${PN}-lesspipe" -FILES:${PN}-lesspipe = "${base_bindir}/spirv-lesspipe.sh" -RDEPENDS:${PN}-lesspipe += "${PN} bash" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/spir/spirv-tools_1.3.236.0.bb b/poky/meta/recipes-graphics/spir/spirv-tools_1.3.236.0.bb new file mode 100644 index 0000000000..c921bdef72 --- /dev/null +++ b/poky/meta/recipes-graphics/spir/spirv-tools_1.3.236.0.bb @@ -0,0 +1,42 @@ +SUMMARY = "The SPIR-V Tools project provides an API and commands for \ +processing SPIR-V modules" +DESCRIPTION = "The project includes an assembler, binary module parser, \ +disassembler, validator, and optimizer for SPIR-V." +HOMEPAGE = "https://github.com/KhronosGroup/SPIRV-Tools" +SECTION = "graphics" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +SRCREV = "40f5bf59c6acb4754a0bffd3c53a715732883a12" +SRC_URI = "git://github.com/KhronosGroup/SPIRV-Tools.git;branch=master;protocol=https" +PE = "1" +UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" +S = "${WORKDIR}/git" + +inherit cmake python3native + +DEPENDS = "spirv-headers" + +EXTRA_OECMAKE += "\ + -DSPIRV-Headers_SOURCE_DIR=${STAGING_EXECPREFIXDIR} \ + -DSPIRV_TOOLS_BUILD_STATIC=OFF \ + -DBUILD_SHARED_LIBS=ON \ + -DSPIRV_SKIP_TESTS=ON \ +" + +do_install:append:class-target() { + # Properly set _IMPORT_PREFIX in INTERFACE_LINK_LIBRARIES so that dependent + # tools can find the right library + sed -i ${D}${libdir}/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake \ + -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}/lib":' +} + +# all the libraries are unversioned, so don't pack it on PN-dev +SOLIBS = ".so" +FILES_SOLIBSDEV = "" + +PACKAGES =+ "${PN}-lesspipe" +FILES:${PN}-lesspipe = "${base_bindir}/spirv-lesspipe.sh" +RDEPENDS:${PN}-lesspipe += "${PN} bash" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb b/poky/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb deleted file mode 100644 index 3480eb954d..0000000000 --- a/poky/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "VirGL virtual OpenGL renderer" -DESCRIPTION = "Virgil is a research project to investigate the possibility of \ -creating a virtual 3D GPU for use inside qemu virtual machines, that allows \ -the guest operating system to use the capabilities of the host GPU to \ -accelerate 3D rendering." -HOMEPAGE = "https://virgil3d.github.io/" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=c81c08eeefd9418fca8f88309a76db10" - -DEPENDS = "libdrm libepoxy virtual/egl virtual/libgbm" -SRCREV = "0922041ec6730122e0fec11404e6859e2efc4bc0" -SRC_URI = "git://gitlab.freedesktop.org/virgl/virglrenderer.git;branch=master;protocol=https \ - file://0001-meson.build-use-python3-directly-for-python.patch \ - " - -S = "${WORKDIR}/git" - -inherit meson pkgconfig features_check - -PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'venus-experimental', '', d)}" - -PACKAGECONFIG[venus-experimental] = "-Dvenus-experimental=true,-Dvenus-experimental=false,vulkan-loader vulkan-headers" -PACKAGECONFIG[va] = "-Dvideo=true,-Dvideo=false,libva" -PACKAGECONFIG[render-server] = "-Drender-server=true,-Drender-server=false" -PACKAGECONFIG[drm-msm-experimental] = "-Ddrm-msm-experimental=true,-Ddrm-msm-experimental=false" -PACKAGECONFIG[minigbm_allocation] = "-Dminigbm_allocation=true,-Dminigbm_allocation=false" -PACKAGECONFIG[venus-validate] = "-Dvenus-validate=true,-Dvenus-validate=false" -PACKAGECONFIG[tests] = "-Dtests=true,-Dtests=false,libcheck" - -BBCLASSEXTEND = "native nativesdk" - -REQUIRED_DISTRO_FEATURES = "opengl" diff --git a/poky/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.4.bb b/poky/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.4.bb new file mode 100644 index 0000000000..f76e7cb1b9 --- /dev/null +++ b/poky/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.4.bb @@ -0,0 +1,33 @@ +SUMMARY = "VirGL virtual OpenGL renderer" +DESCRIPTION = "Virgil is a research project to investigate the possibility of \ +creating a virtual 3D GPU for use inside qemu virtual machines, that allows \ +the guest operating system to use the capabilities of the host GPU to \ +accelerate 3D rendering." +HOMEPAGE = "https://virgil3d.github.io/" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=c81c08eeefd9418fca8f88309a76db10" + +DEPENDS = "libdrm libepoxy virtual/egl virtual/libgbm" +SRCREV = "88b9fe3bfc64b23a701e4875006dbc0e769f14f6" +SRC_URI = "git://gitlab.freedesktop.org/virgl/virglrenderer.git;branch=master;protocol=https \ + file://0001-meson.build-use-python3-directly-for-python.patch \ + " + +S = "${WORKDIR}/git" + +inherit meson pkgconfig features_check + +PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'venus-experimental', '', d)}" + +PACKAGECONFIG[venus-experimental] = "-Dvenus-experimental=true,-Dvenus-experimental=false,vulkan-loader vulkan-headers" +PACKAGECONFIG[va] = "-Dvideo=true,-Dvideo=false,libva" +PACKAGECONFIG[render-server] = "-Drender-server=true,-Drender-server=false" +PACKAGECONFIG[drm-msm-experimental] = "-Ddrm-msm-experimental=true,-Ddrm-msm-experimental=false" +PACKAGECONFIG[minigbm_allocation] = "-Dminigbm_allocation=true,-Dminigbm_allocation=false" +PACKAGECONFIG[venus-validate] = "-Dvenus-validate=true,-Dvenus-validate=false" +PACKAGECONFIG[tests] = "-Dtests=true,-Dtests=false,libcheck" + +BBCLASSEXTEND = "native nativesdk" + +REQUIRED_DISTRO_FEATURES = "opengl" diff --git a/poky/meta/recipes-graphics/vulkan/vulkan-headers_1.3.231.1.bb b/poky/meta/recipes-graphics/vulkan/vulkan-headers_1.3.231.1.bb deleted file mode 100644 index b41b82af9d..0000000000 --- a/poky/meta/recipes-graphics/vulkan/vulkan-headers_1.3.231.1.bb +++ /dev/null @@ -1,22 +0,0 @@ -SUMMARY = "Vulkan Header files and API registry" -DESCRIPTION = "Vulkan is a 3D graphics and compute API providing cross-platform access \ -to modern GPUs with low overhead and targeting realtime graphics applications such as \ -games and interactive media. This package contains the development headers \ -for packages wanting to make use of Vulkan." -HOMEPAGE = "https://www.khronos.org/vulkan/" -BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-Headers" -SECTION = "libs" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" -SRC_URI = "git://github.com/KhronosGroup/Vulkan-Headers.git;branch=main;protocol=https" - -SRCREV = "98f440ce6868c94f5ec6e198cc1adda4760e8849" - -S = "${WORKDIR}/git" - -inherit cmake - -FILES:${PN} += "${datadir}/vulkan" - -UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" diff --git a/poky/meta/recipes-graphics/vulkan/vulkan-headers_1.3.236.0.bb b/poky/meta/recipes-graphics/vulkan/vulkan-headers_1.3.236.0.bb new file mode 100644 index 0000000000..8716376fc0 --- /dev/null +++ b/poky/meta/recipes-graphics/vulkan/vulkan-headers_1.3.236.0.bb @@ -0,0 +1,22 @@ +SUMMARY = "Vulkan Header files and API registry" +DESCRIPTION = "Vulkan is a 3D graphics and compute API providing cross-platform access \ +to modern GPUs with low overhead and targeting realtime graphics applications such as \ +games and interactive media. This package contains the development headers \ +for packages wanting to make use of Vulkan." +HOMEPAGE = "https://www.khronos.org/vulkan/" +BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-Headers" +SECTION = "libs" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" +SRC_URI = "git://github.com/KhronosGroup/Vulkan-Headers.git;branch=main;protocol=https" + +SRCREV = "b75e5a02b6933caf86c5822d019067b335492c85" + +S = "${WORKDIR}/git" + +inherit cmake + +FILES:${PN} += "${datadir}/vulkan" + +UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" diff --git a/poky/meta/recipes-graphics/vulkan/vulkan-loader_1.3.231.1.bb b/poky/meta/recipes-graphics/vulkan/vulkan-loader_1.3.231.1.bb deleted file mode 100644 index 7aab7446f6..0000000000 --- a/poky/meta/recipes-graphics/vulkan/vulkan-loader_1.3.231.1.bb +++ /dev/null @@ -1,38 +0,0 @@ -SUMMARY = "3D graphics and compute API common loader" -DESCRIPTION = "Vulkan is a new generation graphics and compute API \ -that provides efficient access to modern GPUs. These packages \ -provide only the common vendor-agnostic library loader, headers and \ -the vulkaninfo utility." -HOMEPAGE = "https://www.khronos.org/vulkan/" -BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-Loader" -SECTION = "libs" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=7dbefed23242760aa3475ee42801c5ac" -SRC_URI = "git://github.com/KhronosGroup/Vulkan-Loader.git;branch=sdk-1.3.231;protocol=https" -SRCREV = "eedbf08292a6be19c3527e77ae2df3f209cab285" - -S = "${WORKDIR}/git" - -REQUIRED_DISTRO_FEATURES = "vulkan" - -inherit cmake features_check pkgconfig - -DEPENDS += "vulkan-headers" - -EXTRA_OECMAKE = "\ - -DBUILD_TESTS=OFF \ - -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 \ - -DASSEMBLER_WORKS=FALSE \ - -DVulkanHeaders_INCLUDE_DIR=${STAGING_INCDIR} \ - -DVulkanRegistry_DIR=${RECIPE_SYSROOT}/${datadir} \ - " - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" - -PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr" -PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland" - -RRECOMMENDS:${PN} = "mesa-vulkan-drivers" - -UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" diff --git a/poky/meta/recipes-graphics/vulkan/vulkan-loader_1.3.236.0.bb b/poky/meta/recipes-graphics/vulkan/vulkan-loader_1.3.236.0.bb new file mode 100644 index 0000000000..56f9d765f8 --- /dev/null +++ b/poky/meta/recipes-graphics/vulkan/vulkan-loader_1.3.236.0.bb @@ -0,0 +1,38 @@ +SUMMARY = "3D graphics and compute API common loader" +DESCRIPTION = "Vulkan is a new generation graphics and compute API \ +that provides efficient access to modern GPUs. These packages \ +provide only the common vendor-agnostic library loader, headers and \ +the vulkaninfo utility." +HOMEPAGE = "https://www.khronos.org/vulkan/" +BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-Loader" +SECTION = "libs" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=7dbefed23242760aa3475ee42801c5ac" +SRC_URI = "git://github.com/KhronosGroup/Vulkan-Loader.git;branch=sdk-1.3.236;protocol=https" +SRCREV = "1ee83a25c2c20e2efbfc0ac976c7a3ddb5fc291c" + +S = "${WORKDIR}/git" + +REQUIRED_DISTRO_FEATURES = "vulkan" + +inherit cmake features_check pkgconfig + +DEPENDS += "vulkan-headers" + +EXTRA_OECMAKE = "\ + -DBUILD_TESTS=OFF \ + -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 \ + -DASSEMBLER_WORKS=FALSE \ + -DVulkanHeaders_INCLUDE_DIR=${STAGING_INCDIR} \ + -DVulkanRegistry_DIR=${RECIPE_SYSROOT}/${datadir} \ + " + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" + +PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr" +PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland" + +RRECOMMENDS:${PN} = "mesa-vulkan-drivers" + +UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" diff --git a/poky/meta/recipes-graphics/vulkan/vulkan-samples/0001-Do-not-use-LFS64-functions-on-linux-musl.patch b/poky/meta/recipes-graphics/vulkan/vulkan-samples/0001-Do-not-use-LFS64-functions-on-linux-musl.patch new file mode 100644 index 0000000000..f2bd7e510b --- /dev/null +++ b/poky/meta/recipes-graphics/vulkan/vulkan-samples/0001-Do-not-use-LFS64-functions-on-linux-musl.patch @@ -0,0 +1,37 @@ +From ce7a593e74c8e0c2ece15c73e7614d4f13a19a53 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 30 Dec 2022 13:04:08 -0800 +Subject: [PATCH] Do not use LFS64 functions on linux/musl + +On musl, off_t is 64bit always ( even on 32bit platforms ), therefore using +LFS64 funcitons is not needed on such platforms. Moreover, musl has stopped +providing aliases for these functions [1] which means it wont compile on +newer musl systems. Therefore only use it on 32bit glibc/linux platforms +and exclude musl like cygwin or OSX + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4 + +Upstream-Status: Submitted [https://github.com/gabime/spdlog/pull/2589] +Signed-off-by: Khem Raj +--- + include/spdlog/details/os.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h +index 8e8476f0..be0a67b8 100644 +--- a/include/spdlog/details/os.h ++++ b/include/spdlog/details/os.h +@@ -227,7 +227,9 @@ inline size_t filesize(FILE *f) + #else // unix + int fd = fileno(f); + // 64 bits(but not in osx or cygwin, where fstat64 is deprecated) +-#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__)) && !defined(__CYGWIN__) ++#if !defined(__FreeBSD__) && !defined(__APPLE__) && \ ++ (defined(__linux__) && defined(__GLIBC__)) && \ ++ (defined(__x86_64__) || defined(__ppc64__)) && !defined(__CYGWIN__) + struct stat64 st; + if (::fstat64(fd, &st) == 0) + { +-- +2.39.0 + diff --git a/poky/meta/recipes-graphics/vulkan/vulkan-samples_git.bb b/poky/meta/recipes-graphics/vulkan/vulkan-samples_git.bb index d0b3458e1b..6aabf2e3b8 100644 --- a/poky/meta/recipes-graphics/vulkan/vulkan-samples_git.bb +++ b/poky/meta/recipes-graphics/vulkan/vulkan-samples_git.bb @@ -9,10 +9,11 @@ SRC_URI = "gitsm://github.com/KhronosGroup/Vulkan-Samples.git;branch=master;prot file://0001-CMakeLists.txt-do-not-hardcode-lib-as-installation-t.patch \ file://debugfix.patch \ file://0001-Qualify-move-as-std-move.patch;patchdir=third_party/spirv-cross \ + file://0001-Do-not-use-LFS64-functions-on-linux-musl.patch;patchdir=third_party/spdlog \ " UPSTREAM_CHECK_COMMITS = "1" -SRCREV = "74d45aace02d99d766126711a8aaa0978276ca00" +SRCREV = "8b945bebf8b2fd987dcf0eeca048068adf4ea44d" UPSTREAM_CHECK_GITTAGREGEX = "These are not the releases you're looking for" S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-graphics/vulkan/vulkan-tools_1.3.231.1.bb b/poky/meta/recipes-graphics/vulkan/vulkan-tools_1.3.231.1.bb deleted file mode 100644 index 9066821de0..0000000000 --- a/poky/meta/recipes-graphics/vulkan/vulkan-tools_1.3.231.1.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "Vulkan Utilities and Tools" -DESCRIPTION = "Assist development by enabling developers to verify their applications correct use of the Vulkan API." -HOMEPAGE = "https://www.khronos.org/vulkan/" -BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-Tools" -SECTION = "libs" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" -SRC_URI = "git://github.com/KhronosGroup/Vulkan-Tools.git;branch=sdk-1.3.231;protocol=https" -SRCREV = "8d2d3e22d684540fdc5a76c15e456fc2fd11e4b7" - -S = "${WORKDIR}/git" - -inherit cmake features_check -ANY_OF_DISTRO_FEATURES = "x11 wayland" -REQUIRED_DISTRO_FEATURES = "vulkan" - -DEPENDS += "vulkan-headers vulkan-loader" - -EXTRA_OECMAKE = "\ - -DBUILD_TESTS=OFF \ - -DBUILD_CUBE=OFF \ - -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 \ - " - -# must choose x11 or wayland or both -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" - -PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr" -PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland" - -UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" diff --git a/poky/meta/recipes-graphics/vulkan/vulkan-tools_1.3.236.0.bb b/poky/meta/recipes-graphics/vulkan/vulkan-tools_1.3.236.0.bb new file mode 100644 index 0000000000..a3561bbb5c --- /dev/null +++ b/poky/meta/recipes-graphics/vulkan/vulkan-tools_1.3.236.0.bb @@ -0,0 +1,32 @@ +SUMMARY = "Vulkan Utilities and Tools" +DESCRIPTION = "Assist development by enabling developers to verify their applications correct use of the Vulkan API." +HOMEPAGE = "https://www.khronos.org/vulkan/" +BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-Tools" +SECTION = "libs" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" +SRC_URI = "git://github.com/KhronosGroup/Vulkan-Tools.git;branch=master;protocol=https" +SRCREV = "ce45337c51ed53e6f1b337aa746a5a96c5018f86" + +S = "${WORKDIR}/git" + +inherit cmake features_check +ANY_OF_DISTRO_FEATURES = "x11 wayland" +REQUIRED_DISTRO_FEATURES = "vulkan" + +DEPENDS += "vulkan-headers vulkan-loader" + +EXTRA_OECMAKE = "\ + -DBUILD_TESTS=OFF \ + -DBUILD_CUBE=OFF \ + -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 \ + " + +# must choose x11 or wayland or both +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" + +PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr" +PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland" + +UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P\d+(\.\d+)+)" diff --git a/poky/meta/recipes-graphics/wayland/libinput_1.21.0.bb b/poky/meta/recipes-graphics/wayland/libinput_1.21.0.bb deleted file mode 100644 index cf59bd81c5..0000000000 --- a/poky/meta/recipes-graphics/wayland/libinput_1.21.0.bb +++ /dev/null @@ -1,50 +0,0 @@ -SUMMARY = "Library to handle input devices in Wayland compositors" -DESCRIPTION = "libinput is a library to handle input devices in Wayland \ -compositors and to provide a generic X.Org input driver. It provides \ -device detection, device handling, input device event processing and \ -abstraction so minimize the amount of custom input code compositors need to \ -provide the common set of functionality that users expect." -HOMEPAGE = "http://www.freedesktop.org/wiki/Software/libinput/" -SECTION = "libs" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=bab4ac7dc1c10bc0fb037dc76c46ef8a" - -DEPENDS = "libevdev udev mtdev libcheck" - -SRC_URI = "git://gitlab.freedesktop.org/libinput/libinput.git;protocol=https;branch=main \ - file://run-ptest \ - file://determinism.patch \ - " -SRCREV = "bc363328a704b3c5e0ee2f0fcf088de67c708979" -S = "${WORKDIR}/git" - -UPSTREAM_CHECK_REGEX = "libinput-(?P\d+\.\d+\.(?!9\d+)\d+)" - -inherit meson pkgconfig lib_package ptest - -# Patch out build directory, otherwise it leaks into ptest binary -do_configure:append() { - sed -i -e "s,${WORKDIR},,g" config.h - if [ -e "litest-config.h" ]; then - sed -i -e "s,${WORKDIR},,g" litest-config.h - fi -} - -PACKAGECONFIG ??= "" -PACKAGECONFIG[libwacom] = "-Dlibwacom=true,-Dlibwacom=false,libwacom" -PACKAGECONFIG[gui] = "-Ddebug-gui=true,-Ddebug-gui=false,cairo gtk+3" - -UDEVDIR = "`pkg-config --variable=udevdir udev`" - -EXTRA_OEMESON += "-Dudev-dir=${UDEVDIR} \ - -Ddocumentation=false \ - ${@bb.utils.contains('PTEST_ENABLED', '1', '-Dtests=true -Dinstall-tests=true', '-Dtests=false -Dinstall-tests=false', d)} \ - -Dzshcompletiondir=no" - -# package name changed in 1.8.1 upgrade: make sure package upgrades work -RPROVIDES:${PN} = "libinput" -RREPLACES:${PN} = "libinput" -RCONFLICTS:${PN} = "libinput" - -FILES:${PN}-ptest += "${libexecdir}/libinput/libinput-test-suite" diff --git a/poky/meta/recipes-graphics/wayland/libinput_1.22.0.bb b/poky/meta/recipes-graphics/wayland/libinput_1.22.0.bb new file mode 100644 index 0000000000..5a5fc9f35d --- /dev/null +++ b/poky/meta/recipes-graphics/wayland/libinput_1.22.0.bb @@ -0,0 +1,50 @@ +SUMMARY = "Library to handle input devices in Wayland compositors" +DESCRIPTION = "libinput is a library to handle input devices in Wayland \ +compositors and to provide a generic X.Org input driver. It provides \ +device detection, device handling, input device event processing and \ +abstraction so minimize the amount of custom input code compositors need to \ +provide the common set of functionality that users expect." +HOMEPAGE = "http://www.freedesktop.org/wiki/Software/libinput/" +SECTION = "libs" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=bab4ac7dc1c10bc0fb037dc76c46ef8a" + +DEPENDS = "libevdev udev mtdev libcheck" + +SRC_URI = "git://gitlab.freedesktop.org/libinput/libinput.git;protocol=https;branch=main \ + file://run-ptest \ + file://determinism.patch \ + " +SRCREV = "fc59e574e050c502c9a3adefacf97babf3d09c7a" +S = "${WORKDIR}/git" + +UPSTREAM_CHECK_REGEX = "libinput-(?P\d+\.\d+\.(?!9\d+)\d+)" + +inherit meson pkgconfig lib_package ptest + +# Patch out build directory, otherwise it leaks into ptest binary +do_configure:append() { + sed -i -e "s,${WORKDIR},,g" config.h + if [ -e "litest-config.h" ]; then + sed -i -e "s,${WORKDIR},,g" litest-config.h + fi +} + +PACKAGECONFIG ??= "" +PACKAGECONFIG[libwacom] = "-Dlibwacom=true,-Dlibwacom=false,libwacom" +PACKAGECONFIG[gui] = "-Ddebug-gui=true,-Ddebug-gui=false,cairo gtk+3" + +UDEVDIR = "`pkg-config --variable=udevdir udev`" + +EXTRA_OEMESON += "-Dudev-dir=${UDEVDIR} \ + -Ddocumentation=false \ + ${@bb.utils.contains('PTEST_ENABLED', '1', '-Dtests=true -Dinstall-tests=true', '-Dtests=false -Dinstall-tests=false', d)} \ + -Dzshcompletiondir=no" + +# package name changed in 1.8.1 upgrade: make sure package upgrades work +RPROVIDES:${PN} = "libinput" +RREPLACES:${PN} = "libinput" +RCONFLICTS:${PN} = "libinput" + +FILES:${PN}-ptest += "${libexecdir}/libinput/libinput-test-suite" diff --git a/poky/meta/recipes-graphics/wayland/wayland-protocols_1.28.bb b/poky/meta/recipes-graphics/wayland/wayland-protocols_1.28.bb deleted file mode 100644 index 2366cc7859..0000000000 --- a/poky/meta/recipes-graphics/wayland/wayland-protocols_1.28.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "Collection of additional Wayland protocols" -DESCRIPTION = "Wayland protocols that add functionality not \ -available in the Wayland core protocol. Such protocols either add \ -completely new functionality, or extend the functionality of some other \ -protocol either in Wayland core, or some other protocol in \ -wayland-protocols." -HOMEPAGE = "http://wayland.freedesktop.org" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=c7b12b6702da38ca028ace54aae3d484 \ - file://stable/presentation-time/presentation-time.xml;endline=26;md5=4646cd7d9edc9fa55db941f2d3a7dc53" - -SRC_URI = "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/${PV}/downloads/wayland-protocols-${PV}.tar.xz" -SRC_URI[sha256sum] = "c7659fb6bf14905e68ef605f898de60d1c066bf66dbea92798573dddec1535b6" - -UPSTREAM_CHECK_URI = "https://wayland.freedesktop.org/releases.html" - -inherit meson pkgconfig allarch - -EXTRA_OEMESON += "-Dtests=false" - -PACKAGES = "${PN}" -FILES:${PN} += "${datadir}/pkgconfig/wayland-protocols.pc" - -BBCLASSEXTEND = "native nativesdk" - diff --git a/poky/meta/recipes-graphics/wayland/wayland-protocols_1.31.bb b/poky/meta/recipes-graphics/wayland/wayland-protocols_1.31.bb new file mode 100644 index 0000000000..afde995fd4 --- /dev/null +++ b/poky/meta/recipes-graphics/wayland/wayland-protocols_1.31.bb @@ -0,0 +1,25 @@ +SUMMARY = "Collection of additional Wayland protocols" +DESCRIPTION = "Wayland protocols that add functionality not \ +available in the Wayland core protocol. Such protocols either add \ +completely new functionality, or extend the functionality of some other \ +protocol either in Wayland core, or some other protocol in \ +wayland-protocols." +HOMEPAGE = "http://wayland.freedesktop.org" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=c7b12b6702da38ca028ace54aae3d484 \ + file://stable/presentation-time/presentation-time.xml;endline=26;md5=4646cd7d9edc9fa55db941f2d3a7dc53" + +SRC_URI = "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/releases/${PV}/downloads/wayland-protocols-${PV}.tar.xz" +SRC_URI[sha256sum] = "a07fa722ed87676ec020d867714bc9a2f24c464da73912f39706eeef5219e238" + +UPSTREAM_CHECK_URI = "https://wayland.freedesktop.org/releases.html" + +inherit meson pkgconfig allarch + +EXTRA_OEMESON += "-Dtests=false" + +PACKAGES = "${PN}" +FILES:${PN} += "${datadir}/pkgconfig/wayland-protocols.pc" + +BBCLASSEXTEND = "native nativesdk" + diff --git a/poky/meta/recipes-graphics/wayland/weston_11.0.0.bb b/poky/meta/recipes-graphics/wayland/weston_11.0.0.bb deleted file mode 100644 index ba4f4062d0..0000000000 --- a/poky/meta/recipes-graphics/wayland/weston_11.0.0.bb +++ /dev/null @@ -1,139 +0,0 @@ -SUMMARY = "Weston, a Wayland compositor" -DESCRIPTION = "Weston is the reference implementation of a Wayland compositor" -HOMEPAGE = "http://wayland.freedesktop.org" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \ - file://libweston/compositor.c;endline=27;md5=eb6d5297798cabe2ddc65e2af519bcf0 \ - " - -SRC_URI = "https://gitlab.freedesktop.org/wayland/weston/-/releases/${PV}/downloads/${BPN}-${PV}.tar.xz \ - file://weston.png \ - file://weston.desktop \ - file://xwayland.weston-start \ - file://systemd-notify.weston-start \ - " - -SRC_URI[sha256sum] = "a6138d4dc9554560ac304312df456019f4be025ec79130f05fb5f2e41c091e1d" - -UPSTREAM_CHECK_URI = "https://wayland.freedesktop.org/releases.html" -UPSTREAM_CHECK_REGEX = "weston-(?P\d+\.\d+\.(?!9\d+)\d+)" - -inherit meson pkgconfig useradd - -# depends on virtual/egl -# -require ${THISDIR}/required-distro-features.inc - -DEPENDS = "libxkbcommon gdk-pixbuf pixman cairo glib-2.0" -DEPENDS += "wayland wayland-protocols libinput virtual/egl pango wayland-native" - -LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'lto', '-Wl,-z,undefs', '', d)}" - -WESTON_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:1])}" - -EXTRA_OEMESON += "-Dpipewire=false" - -PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms wayland egl clients', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \ - ${@bb.utils.contains_any('DISTRO_FEATURES', 'wayland x11', '', 'headless', d)} \ - ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'sysvinit', 'launcher-libseat', '', d)} \ - image-jpeg \ - screenshare \ - shell-desktop \ - shell-fullscreen \ - shell-ivi" - -# Can be 'damage', 'im', 'egl', 'shm', 'touch', 'dmabuf-feedback', 'dmabuf-v4l', 'dmabuf-egl' or 'all' -SIMPLECLIENTS ?= "all" - -# -# Compositor choices -# -# Weston on KMS -PACKAGECONFIG[kms] = "-Dbackend-drm=true,-Dbackend-drm=false,drm udev virtual/egl virtual/libgles2 virtual/libgbm mtdev" -# Weston on Wayland (nested Weston) -PACKAGECONFIG[wayland] = "-Dbackend-wayland=true,-Dbackend-wayland=false,virtual/egl virtual/libgles2" -# Weston on X11 -PACKAGECONFIG[x11] = "-Dbackend-x11=true,-Dbackend-x11=false,virtual/libx11 libxcb libxcb libxcursor cairo" -# Headless Weston -PACKAGECONFIG[headless] = "-Dbackend-headless=true,-Dbackend-headless=false" -# Weston on RDP -PACKAGECONFIG[rdp] = "-Dbackend-rdp=true,-Dbackend-rdp=false,freerdp" -# VA-API desktop recorder -PACKAGECONFIG[vaapi] = "-Dbackend-drm-screencast-vaapi=true,-Dbackend-drm-screencast-vaapi=false,libva" -# Weston with EGL support -PACKAGECONFIG[egl] = "-Drenderer-gl=true,-Drenderer-gl=false,virtual/egl" -# Weston with lcms support -PACKAGECONFIG[lcms] = "-Dcolor-management-lcms=true,-Dcolor-management-lcms=false,lcms" -# Weston with webp support -PACKAGECONFIG[webp] = "-Dimage-webp=true,-Dimage-webp=false,libwebp" -# Weston with systemd-login support -PACKAGECONFIG[systemd] = "-Dsystemd=true -Dlauncher-logind=true,-Dsystemd=false -Dlauncher-logind=false,systemd dbus" -# Weston with Xwayland support (requires X11 and Wayland) -PACKAGECONFIG[xwayland] = "-Dxwayland=true,-Dxwayland=false" -# colord CMS support -PACKAGECONFIG[colord] = "-Ddeprecated-color-management-colord=true,-Ddeprecated-color-management-colord=false,colord" -# Clients support -PACKAGECONFIG[clients] = "-Dsimple-clients=${SIMPLECLIENTS} -Ddemo-clients=true,-Dsimple-clients= -Ddemo-clients=false" -# Virtual remote output with GStreamer on DRM backend -PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0 gstreamer1.0-plugins-base" -# Weston with screen-share support -PACKAGECONFIG[screenshare] = "-Dscreenshare=true,-Dscreenshare=false" -# Traditional desktop shell -PACKAGECONFIG[shell-desktop] = "-Dshell-desktop=true,-Dshell-desktop=false" -# Fullscreen shell -PACKAGECONFIG[shell-fullscreen] = "-Dshell-fullscreen=true,-Dshell-fullscreen=false" -# In-Vehicle Infotainment (IVI) shell -PACKAGECONFIG[shell-ivi] = "-Dshell-ivi=true,-Dshell-ivi=false" -# JPEG image loading support -PACKAGECONFIG[image-jpeg] = "-Dimage-jpeg=true,-Dimage-jpeg=false, jpeg" -# support libseat based launch -PACKAGECONFIG[launcher-libseat] = "-Dlauncher-libseat=true,-Dlauncher-libseat=false,seatd" - -do_install:append() { - # Weston doesn't need the .la files to load modules, so wipe them - rm -f ${D}/${libdir}/libweston-${WESTON_MAJOR_VERSION}/*.la - - # If X11, ship a desktop file to launch it - if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then - install -d ${D}${datadir}/applications - install ${WORKDIR}/weston.desktop ${D}${datadir}/applications - - install -d ${D}${datadir}/icons/hicolor/48x48/apps - install ${WORKDIR}/weston.png ${D}${datadir}/icons/hicolor/48x48/apps - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then - install -Dm 644 ${WORKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'yes', 'no', d)}" = "yes" ]; then - install -Dm 644 ${WORKDIR}/systemd-notify.weston-start ${D}${datadir}/weston-start/systemd-notify - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'launch', 'yes', 'no', d)}" = "yes" ]; then - chmod u+s ${D}${bindir}/weston-launch - fi -} - -PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', '${PN}-xwayland', '', d)} \ - libweston-${WESTON_MAJOR_VERSION} ${PN}-examples" - -FILES:${PN}-dev += "${libdir}/${BPN}/libexec_weston.so" -FILES:${PN} = "${bindir}/weston ${bindir}/weston-terminal ${bindir}/weston-info ${bindir}/weston-launch ${bindir}/wcap-decode ${libexecdir} ${libdir}/${BPN}/*.so* ${datadir}" - -FILES:libweston-${WESTON_MAJOR_VERSION} = "${libdir}/lib*${SOLIBS} ${libdir}/libweston-${WESTON_MAJOR_VERSION}/*.so" -SUMMARY:libweston-${WESTON_MAJOR_VERSION} = "Helper library for implementing 'wayland window managers'." - -FILES:${PN}-examples = "${bindir}/*" - -FILES:${PN}-xwayland = "${libdir}/libweston-${WESTON_MAJOR_VERSION}/xwayland.so" -RDEPENDS:${PN}-xwayland += "xwayland" - -RDEPENDS:${PN} += "xkeyboard-config" -RRECOMMENDS:${PN} = "weston-init liberation-fonts" -RRECOMMENDS:${PN}-dev += "wayland-protocols" - -USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM:${PN} = "--system weston-launch" diff --git a/poky/meta/recipes-graphics/wayland/weston_11.0.1.bb b/poky/meta/recipes-graphics/wayland/weston_11.0.1.bb new file mode 100644 index 0000000000..b943842bc4 --- /dev/null +++ b/poky/meta/recipes-graphics/wayland/weston_11.0.1.bb @@ -0,0 +1,139 @@ +SUMMARY = "Weston, a Wayland compositor" +DESCRIPTION = "Weston is the reference implementation of a Wayland compositor" +HOMEPAGE = "http://wayland.freedesktop.org" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \ + file://libweston/compositor.c;endline=27;md5=eb6d5297798cabe2ddc65e2af519bcf0 \ + " + +SRC_URI = "https://gitlab.freedesktop.org/wayland/weston/uploads/f5648c818fba5432edc3ea63c4db4813/${BPN}-${PV}.tar.xz \ + file://weston.png \ + file://weston.desktop \ + file://xwayland.weston-start \ + file://systemd-notify.weston-start \ + " + +SRC_URI[sha256sum] = "a413f68c252957fc3191c3650823ec356ae8c124ccc0cb440da5cdc4e2cb9e57" + +UPSTREAM_CHECK_URI = "https://wayland.freedesktop.org/releases.html" +UPSTREAM_CHECK_REGEX = "weston-(?P\d+\.\d+\.(?!9\d+)\d+)" + +inherit meson pkgconfig useradd + +# depends on virtual/egl +# +require ${THISDIR}/required-distro-features.inc + +DEPENDS = "libxkbcommon gdk-pixbuf pixman cairo glib-2.0" +DEPENDS += "wayland wayland-protocols libinput virtual/egl pango wayland-native" + +LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'lto', '-Wl,-z,undefs', '', d)}" + +WESTON_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:1])}" + +EXTRA_OEMESON += "-Dpipewire=false" + +PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms wayland egl clients', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \ + ${@bb.utils.contains_any('DISTRO_FEATURES', 'wayland x11', '', 'headless', d)} \ + ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'sysvinit', 'launcher-libseat', '', d)} \ + image-jpeg \ + screenshare \ + shell-desktop \ + shell-fullscreen \ + shell-ivi" + +# Can be 'damage', 'im', 'egl', 'shm', 'touch', 'dmabuf-feedback', 'dmabuf-v4l', 'dmabuf-egl' or 'all' +SIMPLECLIENTS ?= "all" + +# +# Compositor choices +# +# Weston on KMS +PACKAGECONFIG[kms] = "-Dbackend-drm=true,-Dbackend-drm=false,drm udev virtual/egl virtual/libgles2 virtual/libgbm mtdev" +# Weston on Wayland (nested Weston) +PACKAGECONFIG[wayland] = "-Dbackend-wayland=true,-Dbackend-wayland=false,virtual/egl virtual/libgles2" +# Weston on X11 +PACKAGECONFIG[x11] = "-Dbackend-x11=true,-Dbackend-x11=false,virtual/libx11 libxcb libxcb libxcursor cairo" +# Headless Weston +PACKAGECONFIG[headless] = "-Dbackend-headless=true,-Dbackend-headless=false" +# Weston on RDP +PACKAGECONFIG[rdp] = "-Dbackend-rdp=true,-Dbackend-rdp=false,freerdp" +# VA-API desktop recorder +PACKAGECONFIG[vaapi] = "-Dbackend-drm-screencast-vaapi=true,-Dbackend-drm-screencast-vaapi=false,libva" +# Weston with EGL support +PACKAGECONFIG[egl] = "-Drenderer-gl=true,-Drenderer-gl=false,virtual/egl" +# Weston with lcms support +PACKAGECONFIG[lcms] = "-Dcolor-management-lcms=true,-Dcolor-management-lcms=false,lcms" +# Weston with webp support +PACKAGECONFIG[webp] = "-Dimage-webp=true,-Dimage-webp=false,libwebp" +# Weston with systemd-login support +PACKAGECONFIG[systemd] = "-Dsystemd=true -Dlauncher-logind=true,-Dsystemd=false -Dlauncher-logind=false,systemd dbus" +# Weston with Xwayland support (requires X11 and Wayland) +PACKAGECONFIG[xwayland] = "-Dxwayland=true,-Dxwayland=false" +# colord CMS support +PACKAGECONFIG[colord] = "-Ddeprecated-color-management-colord=true,-Ddeprecated-color-management-colord=false,colord" +# Clients support +PACKAGECONFIG[clients] = "-Dsimple-clients=${SIMPLECLIENTS} -Ddemo-clients=true,-Dsimple-clients= -Ddemo-clients=false" +# Virtual remote output with GStreamer on DRM backend +PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0 gstreamer1.0-plugins-base" +# Weston with screen-share support +PACKAGECONFIG[screenshare] = "-Dscreenshare=true,-Dscreenshare=false" +# Traditional desktop shell +PACKAGECONFIG[shell-desktop] = "-Dshell-desktop=true,-Dshell-desktop=false" +# Fullscreen shell +PACKAGECONFIG[shell-fullscreen] = "-Dshell-fullscreen=true,-Dshell-fullscreen=false" +# In-Vehicle Infotainment (IVI) shell +PACKAGECONFIG[shell-ivi] = "-Dshell-ivi=true,-Dshell-ivi=false" +# JPEG image loading support +PACKAGECONFIG[image-jpeg] = "-Dimage-jpeg=true,-Dimage-jpeg=false, jpeg" +# support libseat based launch +PACKAGECONFIG[launcher-libseat] = "-Dlauncher-libseat=true,-Dlauncher-libseat=false,seatd" + +do_install:append() { + # Weston doesn't need the .la files to load modules, so wipe them + rm -f ${D}/${libdir}/libweston-${WESTON_MAJOR_VERSION}/*.la + + # If X11, ship a desktop file to launch it + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then + install -d ${D}${datadir}/applications + install ${WORKDIR}/weston.desktop ${D}${datadir}/applications + + install -d ${D}${datadir}/icons/hicolor/48x48/apps + install ${WORKDIR}/weston.png ${D}${datadir}/icons/hicolor/48x48/apps + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then + install -Dm 644 ${WORKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'yes', 'no', d)}" = "yes" ]; then + install -Dm 644 ${WORKDIR}/systemd-notify.weston-start ${D}${datadir}/weston-start/systemd-notify + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'launch', 'yes', 'no', d)}" = "yes" ]; then + chmod u+s ${D}${bindir}/weston-launch + fi +} + +PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', '${PN}-xwayland', '', d)} \ + libweston-${WESTON_MAJOR_VERSION} ${PN}-examples" + +FILES:${PN}-dev += "${libdir}/${BPN}/libexec_weston.so" +FILES:${PN} = "${bindir}/weston ${bindir}/weston-terminal ${bindir}/weston-info ${bindir}/weston-launch ${bindir}/wcap-decode ${libexecdir} ${libdir}/${BPN}/*.so* ${datadir}" + +FILES:libweston-${WESTON_MAJOR_VERSION} = "${libdir}/lib*${SOLIBS} ${libdir}/libweston-${WESTON_MAJOR_VERSION}/*.so" +SUMMARY:libweston-${WESTON_MAJOR_VERSION} = "Helper library for implementing 'wayland window managers'." + +FILES:${PN}-examples = "${bindir}/*" + +FILES:${PN}-xwayland = "${libdir}/libweston-${WESTON_MAJOR_VERSION}/xwayland.so" +RDEPENDS:${PN}-xwayland += "xwayland" + +RDEPENDS:${PN} += "xkeyboard-config" +RRECOMMENDS:${PN} = "weston-init liberation-fonts" +RRECOMMENDS:${PN}-dev += "wayland-protocols" + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM:${PN} = "--system weston-launch" diff --git a/poky/meta/recipes-graphics/xorg-app/xhost_1.0.8.bb b/poky/meta/recipes-graphics/xorg-app/xhost_1.0.8.bb deleted file mode 100644 index 26bec3f0dd..0000000000 --- a/poky/meta/recipes-graphics/xorg-app/xhost_1.0.8.bb +++ /dev/null @@ -1,20 +0,0 @@ -require xorg-app-common.inc - -SUMMARY = "Server access control program for X" - -DESCRIPTION = "The xhost program is used to add and delete host names or \ -user names to the list allowed to make connections to the X server. In \ -the case of hosts, this provides a rudimentary form of privacy control \ -and security. Environments which require more sophisticated measures \ -should implement the user-based mechanism or use the hooks in the \ -protocol for passing other authentication data to the server." - -LIC_FILES_CHKSUM = "file://COPYING;md5=8fbed71dddf48541818cef8079124199" -DEPENDS += "libxmu libxau" -PE = "1" - -SRC_URI[md5sum] = "a48c72954ae6665e0616f6653636da8c" -SRC_URI[sha256sum] = "a2dc3c579e13674947395ef8ccc1b3763f89012a216c2cc6277096489aadc396" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" -PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," diff --git a/poky/meta/recipes-graphics/xorg-app/xhost_1.0.9.bb b/poky/meta/recipes-graphics/xorg-app/xhost_1.0.9.bb new file mode 100644 index 0000000000..d54e6cae65 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-app/xhost_1.0.9.bb @@ -0,0 +1,21 @@ +require xorg-app-common.inc + +SUMMARY = "Server access control program for X" + +DESCRIPTION = "The xhost program is used to add and delete host names or \ +user names to the list allowed to make connections to the X server. In \ +the case of hosts, this provides a rudimentary form of privacy control \ +and security. Environments which require more sophisticated measures \ +should implement the user-based mechanism or use the hooks in the \ +protocol for passing other authentication data to the server." + +LIC_FILES_CHKSUM = "file://COPYING;md5=b1f81049109f21bb3c365d9f42f79f3b" +DEPENDS += "libxmu libxau gettext-native" +PE = "1" + +SRC_URI_EXT = "xz" + +SRC_URI[sha256sum] = "ea86b531462035b19a2e5e01ef3d9a35cca7d984086645e2fc844d8f0e346645" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," diff --git a/poky/meta/recipes-graphics/xorg-app/xinit_1.4.1.bb b/poky/meta/recipes-graphics/xorg-app/xinit_1.4.1.bb deleted file mode 100644 index e6ebf273e8..0000000000 --- a/poky/meta/recipes-graphics/xorg-app/xinit_1.4.1.bb +++ /dev/null @@ -1,25 +0,0 @@ -require xorg-app-common.inc - -SUMMARY = "X Window System initializer" - -DESCRIPTION = "The xinit program is used to start the X Window System \ -server and a first client program on systems that cannot start X \ -directly from /etc/init or in environments that use multiple window \ -systems. When this first client exits, xinit will kill the X server and \ -then terminate." - -LIC_FILES_CHKSUM = "file://COPYING;md5=18f01e7b39807bebe2b8df101a039b68" - -PE = "1" - -SRC_URI += "file://0001-Make-manpage-multilib-identical.patch" - -SRC_URI[md5sum] = "6d506ab2efc17a08e87778654e099d37" -SRC_URI[sha256sum] = "de9b8f617b68a70f6caf87da01fcf0ebd2b75690cdcba9c921d0ef54fa54abb9" - -EXTRA_OECONF = "ac_cv_path_MCOOKIE=${bindir}/mcookie" - -PACKAGECONFIG ??= "rxvt" -PACKAGECONFIG[rxvt] = "--with-xterm=rxvt,,,rxvt-unicode" - -RDEPENDS:${PN} += "util-linux-mcookie" diff --git a/poky/meta/recipes-graphics/xorg-app/xinit_1.4.2.bb b/poky/meta/recipes-graphics/xorg-app/xinit_1.4.2.bb new file mode 100644 index 0000000000..82c0b0d833 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-app/xinit_1.4.2.bb @@ -0,0 +1,26 @@ +require xorg-app-common.inc + +SUMMARY = "X Window System initializer" + +DESCRIPTION = "The xinit program is used to start the X Window System \ +server and a first client program on systems that cannot start X \ +directly from /etc/init or in environments that use multiple window \ +systems. When this first client exits, xinit will kill the X server and \ +then terminate." + +LIC_FILES_CHKSUM = "file://COPYING;md5=18f01e7b39807bebe2b8df101a039b68" + +PE = "1" + +SRC_URI += "file://0001-Make-manpage-multilib-identical.patch" + +SRC_URI_EXT = "xz" + +SRC_URI[sha256sum] = "b7d8dc8d22ef9f15985a10b606ee4f2aad6828befa437359934647e88d331f23" + +EXTRA_OECONF = "ac_cv_path_MCOOKIE=${bindir}/mcookie" + +PACKAGECONFIG ??= "rxvt" +PACKAGECONFIG[rxvt] = "--with-xterm=rxvt,,,rxvt-unicode" + +RDEPENDS:${PN} += "util-linux-mcookie" diff --git a/poky/meta/recipes-graphics/xorg-app/xkbcomp_1.4.5.bb b/poky/meta/recipes-graphics/xorg-app/xkbcomp_1.4.5.bb deleted file mode 100644 index 657ec7580d..0000000000 --- a/poky/meta/recipes-graphics/xorg-app/xkbcomp_1.4.5.bb +++ /dev/null @@ -1,18 +0,0 @@ -require xorg-app-common.inc - -SUMMARY = "A program to compile XKB keyboard description" - -DESCRIPTION = "The xkbcomp keymap compiler converts a description of an \ -XKB keymap into one of several output formats. The most common use for \ -xkbcomp is to create a compiled keymap file (.xkm extension) which can \ -be read directly by XKB-capable X servers or utilities." - -LIC_FILES_CHKSUM = "file://COPYING;md5=be5e191f04d3f2cd80aa83b928ba984c" - -DEPENDS += "libxkbfile" - -BBCLASSEXTEND = "native" - -EXTRA_OECONF += "--disable-selective-werror" - -SRC_URI[sha256sum] = "6851086c4244b6fd0cc562880d8ff193fb2bbf1e141c73632e10731b31d4b05e" diff --git a/poky/meta/recipes-graphics/xorg-app/xkbcomp_1.4.6.bb b/poky/meta/recipes-graphics/xorg-app/xkbcomp_1.4.6.bb new file mode 100644 index 0000000000..44f462f523 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-app/xkbcomp_1.4.6.bb @@ -0,0 +1,19 @@ +require xorg-app-common.inc + +SUMMARY = "A program to compile XKB keyboard description" + +DESCRIPTION = "The xkbcomp keymap compiler converts a description of an \ +XKB keymap into one of several output formats. The most common use for \ +xkbcomp is to create a compiled keymap file (.xkm extension) which can \ +be read directly by XKB-capable X servers or utilities." + +LIC_FILES_CHKSUM = "file://COPYING;md5=be5e191f04d3f2cd80aa83b928ba984c" + +DEPENDS += "libxkbfile" + +BBCLASSEXTEND = "native" + +EXTRA_OECONF += "--disable-selective-werror" + +SRC_URI_EXT = "xz" +SRC_URI[sha256sum] = "fa50d611ef41e034487af7bd8d8c718df53dd18002f591cca16b0384afc58e98" diff --git a/poky/meta/recipes-graphics/xorg-app/xprop_1.2.5.bb b/poky/meta/recipes-graphics/xorg-app/xprop_1.2.5.bb deleted file mode 100644 index b1589a8d75..0000000000 --- a/poky/meta/recipes-graphics/xorg-app/xprop_1.2.5.bb +++ /dev/null @@ -1,17 +0,0 @@ -require xorg-app-common.inc - -SUMMARY = "Utility to display window and font properties of an X server" - -DESCRIPTION = "The xprop utility is for displaying window and font \ -properties in an X server. One window or font is selected using the \ -command line arguments or possibly in the case of a window, by clicking \ -on the desired window. A list of properties is then given, possibly with \ -formatting information." - -LIC_FILES_CHKSUM = "file://COPYING;md5=e226ab8db88ac0bc0391673be40c9f91" - -DEPENDS += "libxmu" - -PE = "1" - -SRC_URI[sha256sum] = "9b92ed0316bf2486121d8bac88bd1878f16b43bd335f18009b1f941f1eca93a1" diff --git a/poky/meta/recipes-graphics/xorg-app/xprop_1.2.6.bb b/poky/meta/recipes-graphics/xorg-app/xprop_1.2.6.bb new file mode 100644 index 0000000000..438a897f1e --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-app/xprop_1.2.6.bb @@ -0,0 +1,18 @@ +require xorg-app-common.inc + +SUMMARY = "Utility to display window and font properties of an X server" + +DESCRIPTION = "The xprop utility is for displaying window and font \ +properties in an X server. One window or font is selected using the \ +command line arguments or possibly in the case of a window, by clicking \ +on the desired window. A list of properties is then given, possibly with \ +formatting information." + +LIC_FILES_CHKSUM = "file://COPYING;md5=e226ab8db88ac0bc0391673be40c9f91" + +DEPENDS += "libxmu" + +PE = "1" + +SRC_URI_EXT = "xz" +SRC_URI[sha256sum] = "580b8525b12ecc0144aa16c88b0aafa76d2e799b44c8c6c50f9ce92788b5586e" diff --git a/poky/meta/recipes-graphics/xorg-app/xrandr_1.5.1.bb b/poky/meta/recipes-graphics/xorg-app/xrandr_1.5.1.bb deleted file mode 100644 index 0e0347f768..0000000000 --- a/poky/meta/recipes-graphics/xorg-app/xrandr_1.5.1.bb +++ /dev/null @@ -1,18 +0,0 @@ -require xorg-app-common.inc - -SUMMARY = "XRandR: X Resize, Rotate and Reflect extension command" - -DESCRIPTION = "Xrandr is used to set the size, orientation and/or \ -reflection of the outputs for a screen. It can also set the screen \ -size." - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=fe1608bdb33cf8c62a4438f7d34679b3" -DEPENDS += "libxrandr libxrender" -PE = "1" - -SRC_URI_EXT = "xz" -SRC_URI[md5sum] = "fe40f7a4fd39dd3a02248d3e0b1972e4" -SRC_URI[sha256sum] = "7bc76daf9d72f8aff885efad04ce06b90488a1a169d118dea8a2b661832e8762" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-app/xrandr_1.5.2.bb b/poky/meta/recipes-graphics/xorg-app/xrandr_1.5.2.bb new file mode 100644 index 0000000000..1e29031849 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-app/xrandr_1.5.2.bb @@ -0,0 +1,17 @@ +require xorg-app-common.inc + +SUMMARY = "XRandR: X Resize, Rotate and Reflect extension command" + +DESCRIPTION = "Xrandr is used to set the size, orientation and/or \ +reflection of the outputs for a screen. It can also set the screen \ +size." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=fe1608bdb33cf8c62a4438f7d34679b3" +DEPENDS += "libxrandr libxrender" +PE = "1" + +SRC_URI_EXT = "xz" +SRC_URI[sha256sum] = "c8bee4790d9058bacc4b6246456c58021db58a87ddda1a9d0139bf5f18f1f240" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-app/xset/disable-xkb.patch b/poky/meta/recipes-graphics/xorg-app/xset/disable-xkb.patch index a97c7b72fa..0bb05a3b88 100644 --- a/poky/meta/recipes-graphics/xorg-app/xset/disable-xkb.patch +++ b/poky/meta/recipes-graphics/xorg-app/xset/disable-xkb.patch @@ -1,14 +1,21 @@ -add "-disable-xkb" option +From 3090dcafac7c8080091b5e3e3720209c65251a1a Mon Sep 17 00:00:00 2001 +From: Richard Purdie +Date: Mon, 22 May 2006 22:15:57 +0000 +Subject: [PATCH] add "-disable-xkb" option Upstream-Status: Pending Rebase for 1.2.1 by: Yu Ke -Index: xset-1.2.3/configure.ac -=================================================================== ---- xset-1.2.3.orig/configure.ac -+++ xset-1.2.3/configure.ac -@@ -53,11 +53,15 @@ PKG_CHECK_MODULES(SET_XEXT, xext, +--- + configure.ac | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/configure.ac b/configure.ac +index e7c2bdf..8e1ed5e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -52,11 +52,15 @@ PKG_CHECK_MODULES(SET_XEXT, xext, AC_CHECK_HEADERS([X11/extensions/dpms.h X11/extensions/MITMisc.h],,,[#include ]) CPPFLAGS="$SAVE_CPPFLAGS"],[echo "not found"]) @@ -22,5 +29,5 @@ Index: xset-1.2.3/configure.ac CPPFLAGS="$SAVE_CPPFLAGS"],[echo "not found"]) +fi - AC_ARG_WITH(xf86misc, AS_HELP_STRING([--without-xf86misc],[Disable xf86misc support.]), - [USE_XF86MISC="$withval"], [USE_XF86MISC="yes"]) + AC_ARG_WITH(xf86misc, AS_HELP_STRING([--with-xf86misc],[Enable xf86misc support.]), + [USE_XF86MISC="$withval"], [USE_XF86MISC="no"]) diff --git a/poky/meta/recipes-graphics/xorg-app/xset_1.2.4.bb b/poky/meta/recipes-graphics/xorg-app/xset_1.2.4.bb deleted file mode 100644 index e21120e788..0000000000 --- a/poky/meta/recipes-graphics/xorg-app/xset_1.2.4.bb +++ /dev/null @@ -1,19 +0,0 @@ -require xorg-app-common.inc - -SUMMARY = "Utility for setting various user preference options of the display" - -DESCRIPTION = "xset is a utility that is used to set various user \ -preference options of the display." - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=bea81cc9827cdf1af0e12c2b8228cf8d" -DEPENDS += "libxext libxmu libxau" -PE = "1" - -SRC_URI += "file://disable-xkb.patch" - -SRC_URI[md5sum] = "70ea7bc7bacf1a124b1692605883f620" -SRC_URI[sha256sum] = "e4fd95280df52a88e9b0abc1fee11dcf0f34fc24041b9f45a247e52df941c957" - -CFLAGS += "-D_GNU_SOURCE" -EXTRA_OECONF = "--disable-xkb --without-fontcache" diff --git a/poky/meta/recipes-graphics/xorg-app/xset_1.2.5.bb b/poky/meta/recipes-graphics/xorg-app/xset_1.2.5.bb new file mode 100644 index 0000000000..398530f342 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-app/xset_1.2.5.bb @@ -0,0 +1,20 @@ +require xorg-app-common.inc + +SUMMARY = "Utility for setting various user preference options of the display" + +DESCRIPTION = "xset is a utility that is used to set various user \ +preference options of the display." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=bea81cc9827cdf1af0e12c2b8228cf8d" +DEPENDS += "libxext libxmu libxau" +PE = "1" + +SRC_URI += "file://disable-xkb.patch" + +SRC_URI_EXT = "xz" + +SRC_URI[sha256sum] = "9f692d55635b3862cd63633b1222a87680ec283c7a8e8ed6dd698a3147f75e2f" + +CFLAGS += "-D_GNU_SOURCE" +EXTRA_OECONF = "--disable-xkb --without-fontcache" diff --git a/poky/meta/recipes-graphics/xorg-app/xvinfo_1.1.4.bb b/poky/meta/recipes-graphics/xorg-app/xvinfo_1.1.4.bb deleted file mode 100644 index a913ae11f3..0000000000 --- a/poky/meta/recipes-graphics/xorg-app/xvinfo_1.1.4.bb +++ /dev/null @@ -1,14 +0,0 @@ -require xorg-app-common.inc - -SUMMARY = "Print out X-Video extension adaptor information" - -DESCRIPTION = "xvinfo prints out the capabilities of any video adaptors \ -associated with the display that are accessible through the X-Video \ -extension." - -LIC_FILES_CHKSUM = "file://COPYING;md5=b664101ad7a1dc758a4c4109bf978e68" -DEPENDS += " libxv" -PE = "1" - -SRC_URI[md5sum] = "b13afec137b9b331814a9824ab03ec80" -SRC_URI[sha256sum] = "0353220d6606077ba42363db65f50410759f9815352f77adc799e2adfa76e73f" diff --git a/poky/meta/recipes-graphics/xorg-app/xvinfo_1.1.5.bb b/poky/meta/recipes-graphics/xorg-app/xvinfo_1.1.5.bb new file mode 100644 index 0000000000..d7e5d917ef --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-app/xvinfo_1.1.5.bb @@ -0,0 +1,14 @@ +require xorg-app-common.inc + +SUMMARY = "Print out X-Video extension adaptor information" + +DESCRIPTION = "xvinfo prints out the capabilities of any video adaptors \ +associated with the display that are accessible through the X-Video \ +extension." + +LIC_FILES_CHKSUM = "file://COPYING;md5=b664101ad7a1dc758a4c4109bf978e68" +DEPENDS += " libxv" +PE = "1" + +SRC_URI_EXT = "xz" +SRC_URI[sha256sum] = "3ede71ecb26d9614ccbc6916720285e95a2c7e0c5e19b8570eaaf72ad7c5c404" diff --git a/poky/meta/recipes-graphics/xorg-driver/xf86-input-mouse_1.9.3.bb b/poky/meta/recipes-graphics/xorg-driver/xf86-input-mouse_1.9.3.bb deleted file mode 100644 index c38dab505b..0000000000 --- a/poky/meta/recipes-graphics/xorg-driver/xf86-input-mouse_1.9.3.bb +++ /dev/null @@ -1,14 +0,0 @@ -require xorg-driver-input.inc - -SUMMARY = "X.Org X server -- mouse input driver" - -DESCRIPTION = "mouse is an Xorg input driver for mice. The driver \ -supports most available mouse types and interfaces. The mouse driver \ -functions as a pointer input device, and may be used as the X server's \ -core pointer. Multiple mice are supported by multiple instances of this \ -driver." - -LIC_FILES_CHKSUM = "file://COPYING;md5=90ea9f90d72b6d9327dede5ffdb2a510" - -SRC_URI[md5sum] = "a2104693bbcfe1413397f7905eecd3dc" -SRC_URI[sha256sum] = "93ecb350604d05be98b7d4e5db3b8155a44890069a7d8d6b800c0bea79c85cc5" diff --git a/poky/meta/recipes-graphics/xorg-driver/xf86-input-mouse_1.9.4.bb b/poky/meta/recipes-graphics/xorg-driver/xf86-input-mouse_1.9.4.bb new file mode 100644 index 0000000000..191987494e --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-driver/xf86-input-mouse_1.9.4.bb @@ -0,0 +1,14 @@ +require xorg-driver-input.inc + +SUMMARY = "X.Org X server -- mouse input driver" + +DESCRIPTION = "mouse is an Xorg input driver for mice. The driver \ +supports most available mouse types and interfaces. The mouse driver \ +functions as a pointer input device, and may be used as the X server's \ +core pointer. Multiple mice are supported by multiple instances of this \ +driver." + +LIC_FILES_CHKSUM = "file://COPYING;md5=90ea9f90d72b6d9327dede5ffdb2a510" + +SRC_URI[sha256sum] = "7f6f8551fc238abdddcf9f38906564c1f8c7dacb0ad947cfc110487aefbd8d4c" +XORG_DRIVER_COMPRESSOR = ".tar.xz" diff --git a/poky/meta/recipes-graphics/xorg-driver/xf86-video-vesa_2.5.0.bb b/poky/meta/recipes-graphics/xorg-driver/xf86-video-vesa_2.5.0.bb deleted file mode 100644 index 05bb905b35..0000000000 --- a/poky/meta/recipes-graphics/xorg-driver/xf86-video-vesa_2.5.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -require xorg-driver-video.inc - -LIC_FILES_CHKSUM = "file://COPYING;md5=a1f0610ebdc6f314a9fa5102a8c5c1b0" - -SUMMARY = "X.Org X server -- Generic Vesa video driver" - -DESCRIPTION = "vesa is an Xorg driver for generic VESA video cards. It \ -can drive most VESA-compatible video cards, but only makes use of the \ -basic standard VESA core that is common to these cards. The driver \ -supports depths 8, 15 16 and 24." - -DEPENDS += "virtual/libx11 xorgproto libpciaccess" - -COMPATIBLE_HOST = '(i.86|x86_64).*-linux' - -RRECOMMENDS:${PN} += "xserver-xorg-module-libint10" - -SRC_URI[sha256sum] = "1f1624f3c73906801ad1bc98335a2cb5676a7a4d18e5374d9a1d18464e54c659" - diff --git a/poky/meta/recipes-graphics/xorg-driver/xf86-video-vesa_2.6.0.bb b/poky/meta/recipes-graphics/xorg-driver/xf86-video-vesa_2.6.0.bb new file mode 100644 index 0000000000..33c2035f6b --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-driver/xf86-video-vesa_2.6.0.bb @@ -0,0 +1,20 @@ +require xorg-driver-video.inc + +LIC_FILES_CHKSUM = "file://COPYING;md5=a1f0610ebdc6f314a9fa5102a8c5c1b0" + +SUMMARY = "X.Org X server -- Generic Vesa video driver" + +DESCRIPTION = "vesa is an Xorg driver for generic VESA video cards. It \ +can drive most VESA-compatible video cards, but only makes use of the \ +basic standard VESA core that is common to these cards. The driver \ +supports depths 8, 15 16 and 24." + +DEPENDS += "virtual/libx11 xorgproto libpciaccess" + +COMPATIBLE_HOST = '(i.86|x86_64).*-linux' + +RRECOMMENDS:${PN} += "xserver-xorg-module-libint10" + +XORG_DRIVER_COMPRESSOR = ".tar.xz" +SRC_URI[sha256sum] = "10082771b1a8f659c60b3d9b70456a4b59948a75b3cade2dfa33b8b05e549bb1" + diff --git a/poky/meta/recipes-graphics/xorg-lib/libdmx_1.1.4.bb b/poky/meta/recipes-graphics/xorg-lib/libdmx_1.1.4.bb index 66172cb30c..3634d53208 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libdmx_1.1.4.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libdmx_1.1.4.bb @@ -15,6 +15,7 @@ DEPENDS += "libxext xorgproto" PE = "1" +XORG_EXT = "tar.bz2" + SRC_URI[md5sum] = "d2f1f0ec68ac3932dd7f1d9aa0a7a11c" SRC_URI[sha256sum] = "253f90005d134fa7a209fbcbc5a3024335367c930adf0f3203e754cf32747243" - diff --git a/poky/meta/recipes-graphics/xorg-lib/libfontenc_1.1.6.bb b/poky/meta/recipes-graphics/xorg-lib/libfontenc_1.1.6.bb deleted file mode 100644 index 8f9602d3ae..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libfontenc_1.1.6.bb +++ /dev/null @@ -1,18 +0,0 @@ -SUMMARY = "X font encoding library" - -DESCRIPTION = "libfontenc is a library which helps font libraries \ -portably determine and deal with different encodings of fonts." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=96254c20ab81c63e65b26f0dbcd4a1c1" - -DEPENDS += "zlib xorgproto font-util" -PE = "1" - -XORG_EXT = "tar.xz" - -SRC_URI[sha256sum] = "ea8606ed5255dda8f570b7d1a74d59ee8d198675b2f114d07807431e6ba1d111" - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-graphics/xorg-lib/libfontenc_1.1.7.bb b/poky/meta/recipes-graphics/xorg-lib/libfontenc_1.1.7.bb new file mode 100644 index 0000000000..056a29af25 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libfontenc_1.1.7.bb @@ -0,0 +1,16 @@ +SUMMARY = "X font encoding library" + +DESCRIPTION = "libfontenc is a library which helps font libraries \ +portably determine and deal with different encodings of fonts." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=96254c20ab81c63e65b26f0dbcd4a1c1" + +DEPENDS += "zlib xorgproto font-util" +PE = "1" + +SRC_URI[sha256sum] = "c0d36991faee06551ddbaf5d99266e97becdc05edfae87a833c3ff7bf73cfec2" + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-graphics/xorg-lib/libice_1.0.10.bb b/poky/meta/recipes-graphics/xorg-lib/libice_1.0.10.bb deleted file mode 100644 index 44339eb27a..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libice_1.0.10.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "ICE: Inter-Client Exchange library" - -DESCRIPTION = "The Inter-Client Exchange (ICE) protocol provides a \ -generic framework for building protocols on top of reliable, byte-stream \ -transport connections. It provides basic mechanisms for setting up and \ -shutting down connections, for performing authentication, for \ -negotiating versions, and for reporting errors. " - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=d162b1b3c6fa812da9d804dcf8584a93" - -DEPENDS += "xorgproto xtrans" -PROVIDES = "ice" - -PE = "1" - -XORG_PN = "libICE" - -BBCLASSEXTEND = "native nativesdk" - -SRC_URI[md5sum] = "76d77499ee7120a56566891ca2c0dbcf" -SRC_URI[sha256sum] = "6f86dce12cf4bcaf5c37dddd8b1b64ed2ddf1ef7b218f22b9942595fb747c348" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" -PACKAGECONFIG[arc4] = "ac_cv_lib_bsd_arc4random_buf=yes,ac_cv_lib_bsd_arc4random_buf=no,libbsd" -PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," diff --git a/poky/meta/recipes-graphics/xorg-lib/libice_1.1.1.bb b/poky/meta/recipes-graphics/xorg-lib/libice_1.1.1.bb new file mode 100644 index 0000000000..d5e3d28e06 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libice_1.1.1.bb @@ -0,0 +1,27 @@ +SUMMARY = "ICE: Inter-Client Exchange library" + +DESCRIPTION = "The Inter-Client Exchange (ICE) protocol provides a \ +generic framework for building protocols on top of reliable, byte-stream \ +transport connections. It provides basic mechanisms for setting up and \ +shutting down connections, for performing authentication, for \ +negotiating versions, and for reporting errors. " + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=d162b1b3c6fa812da9d804dcf8584a93" + +DEPENDS += "xorgproto xtrans" +PROVIDES = "ice" + +PE = "1" + +XORG_PN = "libICE" + +BBCLASSEXTEND = "native nativesdk" + +SRC_URI[sha256sum] = "03e77afaf72942c7ac02ccebb19034e6e20f456dcf8dddadfeb572aa5ad3e451" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" +PACKAGECONFIG[arc4] = "ac_cv_lib_bsd_arc4random_buf=yes,ac_cv_lib_bsd_arc4random_buf=no,libbsd" +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," diff --git a/poky/meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch b/poky/meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch new file mode 100644 index 0000000000..512a473e20 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libpciaccess/0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch @@ -0,0 +1,39 @@ +From d20ff4f2e4feaafa6a6191b9cae3815b85617943 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 11 Nov 2022 11:15:58 -0800 +Subject: [PATCH] linux_sysfs: Use pwrite/pread instead of 64bit versions + +pread64/pwrite64 are aliased to pread/pwrite when largefile support is +enabled e.g. using _FILE_OFFSET_BITS=64 macro + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/merge_requests/26] +Signed-off-by: Khem Raj +--- + src/linux_sysfs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c +index d62f48c..20c800e 100644 +--- a/src/linux_sysfs.c ++++ b/src/linux_sysfs.c +@@ -462,7 +462,7 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data, + + + while ( temp_size > 0 ) { +- const ssize_t bytes = pread64( fd, data_bytes, temp_size, offset ); ++ const ssize_t bytes = pread( fd, data_bytes, temp_size, offset ); + + /* If zero bytes were read, then we assume it's the end of the + * config file. +@@ -522,7 +522,7 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data, + + + while ( temp_size > 0 ) { +- const ssize_t bytes = pwrite64( fd, data_bytes, temp_size, offset ); ++ const ssize_t bytes = pwrite( fd, data_bytes, temp_size, offset ); + + /* If zero bytes were written, then we assume it's the end of the + * config file. +-- +2.38.1 + diff --git a/poky/meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb b/poky/meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb index 06c30384ab..54bdb08976 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libpciaccess_0.17.bb @@ -5,7 +5,8 @@ PCI bus and devices in a platform-independent way." require xorg-lib-common.inc -XORG_EXT = "tar.xz" +SRC_URI += "file://0001-linux_sysfs-Use-pwrite-pread-instead-of-64bit-versio.patch" + SRC_URI[sha256sum] = "74283ba3c974913029e7a547496a29145b07ec51732bbb5b5c58d5025ad95b73" LICENSE = "MIT & MIT" diff --git a/poky/meta/recipes-graphics/xorg-lib/libsm_1.2.3.bb b/poky/meta/recipes-graphics/xorg-lib/libsm_1.2.3.bb deleted file mode 100644 index 90917ef437..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libsm_1.2.3.bb +++ /dev/null @@ -1,31 +0,0 @@ -SUMMARY = "SM: Session Management library" - -DESCRIPTION = "The Session Management Library (SMlib) is a low-level \"C\" \ -language interface to XSMP. The purpose of the X Session Management \ -Protocol (XSMP) is to provide a uniform mechanism for users to save and \ -restore their sessions. A session is a group of clients, each of which \ -has a particular state." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=c0fb37f44e02bdbde80546024400728d" - -DEPENDS += "libice xorgproto xtrans" - -# libSM can work without libuuid, we explicitly disable it to break the following circular dependency -# when DISTRO_FEATURES contains 'systemd' and 'x11'. -# systemd -> dbus -> libsm -> util-linux -> systemd -EXTRA_OECONF += "--without-libuuid" - -PE = "1" - -XORG_PN = "libSM" - -SRC_URI[md5sum] = "87c7fad1c1813517979184c8ccd76628" -SRC_URI[sha256sum] = "2d264499dcb05f56438dee12a1b4b71d76736ce7ba7aa6efbf15ebb113769cbb" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" -PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libsm_1.2.4.bb b/poky/meta/recipes-graphics/xorg-lib/libsm_1.2.4.bb new file mode 100644 index 0000000000..ab030723c6 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libsm_1.2.4.bb @@ -0,0 +1,30 @@ +SUMMARY = "SM: Session Management library" + +DESCRIPTION = "The Session Management Library (SMlib) is a low-level \"C\" \ +language interface to XSMP. The purpose of the X Session Management \ +Protocol (XSMP) is to provide a uniform mechanism for users to save and \ +restore their sessions. A session is a group of clients, each of which \ +has a particular state." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=c0fb37f44e02bdbde80546024400728d" + +DEPENDS += "libice xorgproto xtrans" + +# libSM can work without libuuid, we explicitly disable it to break the following circular dependency +# when DISTRO_FEATURES contains 'systemd' and 'x11'. +# systemd -> dbus -> libsm -> util-linux -> systemd +EXTRA_OECONF += "--without-libuuid" + +PE = "1" + +XORG_PN = "libSM" + +SRC_URI[sha256sum] = "fdcbe51e4d1276b1183da77a8a4e74a137ca203e0bcfb20972dd5f3347e97b84" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data/0001-Drop-x11-dependencies.patch b/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data/0001-Drop-x11-dependencies.patch index 46a53a17f2..61af98d95e 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data/0001-Drop-x11-dependencies.patch +++ b/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data/0001-Drop-x11-dependencies.patch @@ -6,12 +6,16 @@ Subject: [PATCH] Drop x11 dependencies Upstream-Status: Inappropriate [OE-Specific] Signed-off-by: Ming Liu + +Rebase for version 1.8.3. + +Signed-off-by: Kai Kang --- configure.ac | 44 -------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/configure.ac b/configure.ac -index a5fd706..b42488c 100644 +index 33d0102..50e2d93 100644 --- a/configure.ac +++ b/configure.ac @@ -76,27 +76,8 @@ fi @@ -20,7 +24,7 @@ index a5fd706..b42488c 100644 # Checks for pkg-config packages - -# Always required --X11_REQUIRES='xproto >= 7.0.17 xextproto xtrans xcb >= 1.11.1' +-X11_REQUIRES='xproto >= 7.0.25 xextproto xtrans xcb >= 1.11.1' -X11_EXTRA_DEPS="xcb >= 1.11.1" - PKG_PROG_PKG_CONFIG() @@ -42,7 +46,7 @@ index a5fd706..b42488c 100644 # Check for dlopen AC_MSG_CHECKING([if run-time linking is supported]) AC_SEARCH_LIBS(dlopen,[dl svld]) -@@ -237,30 +218,6 @@ AC_SUBST(XTHREAD_CFLAGS) +@@ -255,30 +236,6 @@ AC_SUBST(USE_THREAD_LIBS) AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], ) @@ -73,7 +77,7 @@ index a5fd706..b42488c 100644 AC_ARG_ENABLE(xcms, AS_HELP_STRING([--disable-xcms], [Disable Xlib support for CMS *EXPERIMENTAL*]), -@@ -340,7 +297,6 @@ X11_LIBDIR="${libdir}/X11" +@@ -358,7 +315,6 @@ X11_LIBDIR="${libdir}/X11" AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libX11 library data]) AC_SUBST(X11_LIBDIR) diff --git a/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data_1.6.8.bb b/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data_1.6.8.bb deleted file mode 100644 index b231f8b34d..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data_1.6.8.bb +++ /dev/null @@ -1,36 +0,0 @@ -SUMMARY = "Xlib: Compose data files for libx11" -DESCRIPTION = "This package provides the compose data files for libx11." - -python () { - if bb.utils.contains('DISTRO_FEATURES', 'x11', True, False, d): - raise bb.parse.SkipRecipe("libx11-compose-data is incompatible with x11 distro feature, use libx11 instead.") -} - -require xorg-lib-common.inc - -LICENSE = "MIT & MIT & BSD-1-Clause & HPND & HPND-sell-variant" -LIC_FILES_CHKSUM = "file://COPYING;md5=172255dee66bb0151435b2d5d709fcf7" - -SRC_URI[md5sum] = "c5fa5a86a20e3591bed6c046498d4b8f" -SRC_URI[sha256sum] = "b289a845c189e251e0e884cc0f9269bbe97c238df3741e854ec4c17c21e473d5" - -SRC_URI += "file://0001-Drop-x11-dependencies.patch \ - " - -XORG_PN = "libX11" - -EXTRA_OECONF += "--disable-xkb" - -PACKAGES = "${PN}" - -FILES:${PN} = "${datadir}/X11/locale ${libdir}/X11/locale" - -do_compile() { - oe_runmake -C nls -} - -do_install() { - oe_runmake DESTDIR=${D} -C nls install -} - -REQUIRED_DISTRO_FEATURES = "" diff --git a/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data_1.8.3.bb b/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data_1.8.3.bb new file mode 100644 index 0000000000..e734a215fd --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libx11-compose-data_1.8.3.bb @@ -0,0 +1,35 @@ +SUMMARY = "Xlib: Compose data files for libx11" +DESCRIPTION = "This package provides the compose data files for libx11." + +python () { + if bb.utils.contains('DISTRO_FEATURES', 'x11', True, False, d): + raise bb.parse.SkipRecipe("libx11-compose-data is incompatible with x11 distro feature, use libx11 instead.") +} + +require xorg-lib-common.inc + +LICENSE = "MIT & BSD-1-Clause & HPND & HPND-sell-variant & ISC" +LIC_FILES_CHKSUM = "file://COPYING;md5=1d49cdd2b386c5db11ec636d680b7116" + +XORG_PN = "libX11" + +SRC_URI += "file://0001-Drop-x11-dependencies.patch \ + " + +SRC_URI[sha256sum] = "e31565c84006b6b8e01dc9399c806085739710bc2db2e0930f1511ed9d6585bd" + +REQUIRED_DISTRO_FEATURES = "" + +EXTRA_OECONF += "--disable-xkb" + +do_compile() { + oe_runmake -C nls +} + +do_install() { + oe_runmake DESTDIR=${D} -C nls install +} + +PACKAGES = "${PN}" + +FILES:${PN} = "${datadir}/X11/locale ${libdir}/X11/locale" diff --git a/poky/meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb b/poky/meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb deleted file mode 100644 index 9ff196c897..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libx11_1.8.1.bb +++ /dev/null @@ -1,49 +0,0 @@ -SUMMARY = "Xlib: C Language X Interface library" - -DESCRIPTION = "This package provides a client interface to the X Window \ -System, otherwise known as 'Xlib'. It provides a complete API for the \ -basic functions of the window system." - -require xorg-lib-common.inc - -FILESEXTRAPATHS =. "${FILE_DIRNAME}/libx11:" - -PE = "1" - -# temporarily override SRC_URI which is hard-coded in xorg-lib-common.inc -# since new versions of packages use a new compression format - .tar.gz -SRC_URI = "${XORG_MIRROR}/individual/lib/${XORG_PN}-${PV}.tar.xz" - -SRC_URI += "file://disable_tests.patch \ - file://0001-fix-a-memory-leak-in-XRegisterIMInstantiateCallback.patch \ - " -SRC_URI[sha256sum] = "1bc41aa1bbe01401f330d76dfa19f386b79c51881c7bbfee9eb4e27f22f2d9f7" - -PROVIDES = "virtual/libx11" - -XORG_PN = "libX11" -LICENSE = "MIT & MIT & BSD-1-Clause & HPND & HPND-sell-variant" -LIC_FILES_CHKSUM = "file://COPYING;md5=172255dee66bb0151435b2d5d709fcf7" - -DEPENDS += "xorgproto \ - xtrans \ - libxcb \ - xorgproto-native \ - autoconf-archive \ - " - -EXTRA_OECONF += "--with-keysymdefdir=${STAGING_INCDIR}/X11/ --disable-xf86bigfont" -EXTRA_OEMAKE += 'CWARNFLAGS=""' - -PACKAGECONFIG ??= "xcms" -PACKAGECONFIG[xcms] = "--enable-xcms,--disable-xcms" - -PACKAGES =+ "${PN}-xcb" - -inherit gettext - -FILES:${PN} += "${datadir}/X11/XKeysymDB ${datadir}/X11/XErrorDB ${datadir}/X11/Xcms.txt" -FILES:${PN}-xcb += "${libdir}/libX11-xcb.so.*" -FILES:${PN}-locale += "${datadir}/X11/locale ${libdir}/X11/locale" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libx11_1.8.3.bb b/poky/meta/recipes-graphics/xorg-lib/libx11_1.8.3.bb new file mode 100644 index 0000000000..06519df5da --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libx11_1.8.3.bb @@ -0,0 +1,45 @@ +SUMMARY = "Xlib: C Language X Interface library" + +DESCRIPTION = "This package provides a client interface to the X Window \ +System, otherwise known as 'Xlib'. It provides a complete API for the \ +basic functions of the window system." + +require xorg-lib-common.inc + +LICENSE = "MIT & BSD-1-Clause & HPND & HPND-sell-variant & ISC" +LIC_FILES_CHKSUM = "file://COPYING;md5=1d49cdd2b386c5db11ec636d680b7116" + +DEPENDS += "xorgproto \ + xtrans \ + libxcb \ + xorgproto-native \ + autoconf-archive \ + " + +PROVIDES = "virtual/libx11" + +FILESEXTRAPATHS =. "${FILE_DIRNAME}/libx11:" + +PE = "1" + +XORG_PN = "libX11" + +SRC_URI += "file://disable_tests.patch \ + " +SRC_URI[sha256sum] = "e31565c84006b6b8e01dc9399c806085739710bc2db2e0930f1511ed9d6585bd" + +inherit gettext + +EXTRA_OECONF += "--with-keysymdefdir=${STAGING_INCDIR}/X11/ --disable-xf86bigfont" +EXTRA_OEMAKE += 'CWARNFLAGS=""' + +PACKAGECONFIG ??= "xcms" +PACKAGECONFIG[xcms] = "--enable-xcms,--disable-xcms" + +PACKAGES =+ "${PN}-xcb" + +FILES:${PN} += "${datadir}/X11/XKeysymDB ${datadir}/X11/XErrorDB ${datadir}/X11/Xcms.txt" +FILES:${PN}-xcb += "${libdir}/libX11-xcb.so.*" +FILES:${PN}-locale += "${datadir}/X11/locale ${libdir}/X11/locale" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxau_1.0.10.bb b/poky/meta/recipes-graphics/xorg-lib/libxau_1.0.10.bb deleted file mode 100644 index a62c9f088a..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxau_1.0.10.bb +++ /dev/null @@ -1,24 +0,0 @@ -SUMMARY = "Xau: X Authority Database library" - -DESCRIPTION = "libxau provides the main interfaces to the X11 \ -authorisation handling, which controls authorisation for X connections, \ -both client-side and server-side." - -require xorg-lib-common.inc - -inherit gettext - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=7908e342491198401321cec1956807ec" - -DEPENDS += " xorgproto" -PROVIDES = "xau" - -PE = "1" - -XORG_PN = "libXau" -XORG_EXT = "tar.xz" - -BBCLASSEXTEND = "native nativesdk" - -SRC_URI[sha256sum] = "8be6f292334d2f87e5b919c001e149a9fdc27005d6b3e053862ac6ebbf1a0c0a" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxau_1.0.11.bb b/poky/meta/recipes-graphics/xorg-lib/libxau_1.0.11.bb new file mode 100644 index 0000000000..f1b492c39f --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxau_1.0.11.bb @@ -0,0 +1,23 @@ +SUMMARY = "Xau: X Authority Database library" + +DESCRIPTION = "libxau provides the main interfaces to the X11 \ +authorisation handling, which controls authorisation for X connections, \ +both client-side and server-side." + +require xorg-lib-common.inc + +inherit gettext + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=7908e342491198401321cec1956807ec" + +DEPENDS += " xorgproto" +PROVIDES = "xau" + +PE = "1" + +XORG_PN = "libXau" + +BBCLASSEXTEND = "native nativesdk" + +SRC_URI[sha256sum] = "f3fa3282f5570c3f6bd620244438dbfbdd580fc80f02f549587a0f8ab329bbeb" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxcomposite_0.4.5.bb b/poky/meta/recipes-graphics/xorg-lib/libxcomposite_0.4.5.bb deleted file mode 100644 index c07f31b92d..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxcomposite_0.4.5.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "Xcomposite: X Composite extension library" - -DESCRIPTION = "The composite extension provides three related \ -mechanisms: per-hierarchy storage, automatic shadow update, and external \ -parent. In per-hierarchy storage, the rendering of an entire hierarchy \ -of windows is redirected to off-screen storage. In automatic shadow \ -update, when a hierarchy is rendered off-screen, the X server provides \ -an automatic mechanism for presenting those contents within the parent \ -window. In external parent, a mechanism for providing redirection of \ -compositing transformations through a client." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=3f2907aad541f6f226fbc58cc1b3cdf1" - -DEPENDS += " xorgproto virtual/libx11 libxfixes libxext" -PROVIDES = "xcomposite" -BBCLASSEXTEND = "native nativesdk" - -PE = "1" - -XORG_PN = "libXcomposite" - -SRC_URI += " file://change-include-order.patch" - -SRC_URI[md5sum] = "3fa0841ea89024719b20cd702a9b54e0" -SRC_URI[sha256sum] = "b3218a2c15bab8035d16810df5b8251ffc7132ff3aa70651a1fba0bfe9634e8f" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxcomposite_0.4.6.bb b/poky/meta/recipes-graphics/xorg-lib/libxcomposite_0.4.6.bb new file mode 100644 index 0000000000..77b3db5cf9 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxcomposite_0.4.6.bb @@ -0,0 +1,27 @@ +SUMMARY = "Xcomposite: X Composite extension library" + +DESCRIPTION = "The composite extension provides three related \ +mechanisms: per-hierarchy storage, automatic shadow update, and external \ +parent. In per-hierarchy storage, the rendering of an entire hierarchy \ +of windows is redirected to off-screen storage. In automatic shadow \ +update, when a hierarchy is rendered off-screen, the X server provides \ +an automatic mechanism for presenting those contents within the parent \ +window. In external parent, a mechanism for providing redirection of \ +compositing transformations through a client." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=3f2907aad541f6f226fbc58cc1b3cdf1" + +DEPENDS += " xorgproto virtual/libx11 libxfixes libxext" +PROVIDES = "xcomposite" +BBCLASSEXTEND = "native nativesdk" + +PE = "1" + +XORG_PN = "libXcomposite" + +SRC_URI += " file://change-include-order.patch" + +SRC_URI[sha256sum] = "fe40bcf0ae1a09070eba24088a5eb9810efe57453779ec1e20a55080c6dc2c87" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxdamage_1.1.5.bb b/poky/meta/recipes-graphics/xorg-lib/libxdamage_1.1.5.bb deleted file mode 100644 index b201124d86..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxdamage_1.1.5.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "Xdamage: X Damage extension library" - -DESCRIPTION = "'Damage' is a term that describes changes make to pixel \ -contents of windows and pixmaps. Damage accumulates as drawing occurs \ -in the drawable. Each drawing operation 'damages' one or more \ -rectangular areas within the drawable. The rectangles are guaranteed to \ -include the set of pixels modified by each operation, but may include \ -significantly more than just those pixels. The DAMAGE extension allows \ -applications to either receive the raw rectangles as a stream of events, \ -or to have them partially processed within the X server to reduce the \ -amount of data transmitted as well as reduce the processing latency once \ -the repaint operation has started." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=9fe101f30dd24134cf43146863241868" - -DEPENDS += "virtual/libx11 xorgproto libxfixes" -PROVIDES = "xdamage" - -PE = "1" - -XORG_PN = "libXdamage" - -SRC_URI[md5sum] = "e3f554267a7a04b042dc1f6352bd6d99" -SRC_URI[sha256sum] = "b734068643cac3b5f3d2c8279dd366b5bf28c7219d9e9d8717e1383995e0ea45" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxdamage_1.1.6.bb b/poky/meta/recipes-graphics/xorg-lib/libxdamage_1.1.6.bb new file mode 100644 index 0000000000..279d6c33dc --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxdamage_1.1.6.bb @@ -0,0 +1,28 @@ +SUMMARY = "Xdamage: X Damage extension library" + +DESCRIPTION = "'Damage' is a term that describes changes make to pixel \ +contents of windows and pixmaps. Damage accumulates as drawing occurs \ +in the drawable. Each drawing operation 'damages' one or more \ +rectangular areas within the drawable. The rectangles are guaranteed to \ +include the set of pixels modified by each operation, but may include \ +significantly more than just those pixels. The DAMAGE extension allows \ +applications to either receive the raw rectangles as a stream of events, \ +or to have them partially processed within the X server to reduce the \ +amount of data transmitted as well as reduce the processing latency once \ +the repaint operation has started." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=9fe101f30dd24134cf43146863241868" + +DEPENDS += "virtual/libx11 xorgproto libxfixes" +PROVIDES = "xdamage" + +PE = "1" + +XORG_PN = "libXdamage" + +SRC_URI[sha256sum] = "52733c1f5262fca35f64e7d5060c6fcd81a880ba8e1e65c9621cf0727afb5d11" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxdmcp_1.1.3.bb b/poky/meta/recipes-graphics/xorg-lib/libxdmcp_1.1.3.bb deleted file mode 100644 index 92ec954df2..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxdmcp_1.1.3.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "XDMCP: X Display Manager Control Protocol library" - -DESCRIPTION = "The purpose of the X Display Manager Control Protocol \ -(XDMCP) is to provide a uniform mechanism for an autonomous display to \ -request login service from a remote host. An X terminal (screen, \ -keyboard, mouse, processor, network interface) is a prime example of an \ -autonomous display." - -require xorg-lib-common.inc - -inherit gettext - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=d559fb26e129626022e052a5e6e0e123" - -DEPENDS += "xorgproto" -PROVIDES = "xdmcp" - -PE = "1" - -XORG_PN = "libXdmcp" - -BBCLASSEXTEND = "native nativesdk" - -SRC_URI[md5sum] = "115c5c12ecce0e749cd91d999a5fd160" -SRC_URI[sha256sum] = "20523b44aaa513e17c009e873ad7bbc301507a3224c232610ce2e099011c6529" - -PACKAGECONFIG ??= "" -PACKAGECONFIG[arc4] = "ac_cv_lib_bsd_arc4random_buf=yes,ac_cv_lib_bsd_arc4random_buf=no,libbsd" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxdmcp_1.1.4.bb b/poky/meta/recipes-graphics/xorg-lib/libxdmcp_1.1.4.bb new file mode 100644 index 0000000000..bf5d2d6721 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxdmcp_1.1.4.bb @@ -0,0 +1,28 @@ +SUMMARY = "XDMCP: X Display Manager Control Protocol library" + +DESCRIPTION = "The purpose of the X Display Manager Control Protocol \ +(XDMCP) is to provide a uniform mechanism for an autonomous display to \ +request login service from a remote host. An X terminal (screen, \ +keyboard, mouse, processor, network interface) is a prime example of an \ +autonomous display." + +require xorg-lib-common.inc + +inherit gettext + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=d559fb26e129626022e052a5e6e0e123" + +DEPENDS += "xorgproto" +PROVIDES = "xdmcp" + +PE = "1" + +XORG_PN = "libXdmcp" + +BBCLASSEXTEND = "native nativesdk" + +SRC_URI[sha256sum] = "2dce5cc317f8f0b484ec347d87d81d552cdbebb178bd13c5d8193b6b7cd6ad00" + +PACKAGECONFIG ??= "" +PACKAGECONFIG[arc4] = "ac_cv_lib_bsd_arc4random_buf=yes,ac_cv_lib_bsd_arc4random_buf=no,libbsd" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxext_1.3.5.bb b/poky/meta/recipes-graphics/xorg-lib/libxext_1.3.5.bb index d4d4119485..7d0597ef1d 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxext_1.3.5.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxext_1.3.5.bb @@ -19,7 +19,6 @@ PROVIDES = "xext" PE = "1" XORG_PN = "libXext" -XORG_EXT = "tar.xz" BBCLASSEXTEND = "native nativesdk" SRC_URI[sha256sum] = "db14c0c895c57ea33a8559de8cb2b93dc76c42ea4a39e294d175938a133d7bca" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxfixes_6.0.0.bb b/poky/meta/recipes-graphics/xorg-lib/libxfixes_6.0.0.bb index 3a8543171e..018138f11d 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxfixes_6.0.0.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxfixes_6.0.0.bb @@ -16,5 +16,6 @@ DEPENDS += "virtual/libx11 xorgproto" PE = "1" XORG_PN = "libXfixes" +XORG_EXT = "tar.bz2" BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxfont2_2.0.6.bb b/poky/meta/recipes-graphics/xorg-lib/libxfont2_2.0.6.bb index 59d63e7150..535e7f629e 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxfont2_2.0.6.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxfont2_2.0.6.bb @@ -12,7 +12,6 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=a46c8040f2f737bcd0c435feb2ab1c2c" DEPENDS += "freetype xtrans xorgproto libfontenc zlib" XORG_PN = "libXfont2" -XORG_EXT = "tar.xz" BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxfont_1.5.4.bb b/poky/meta/recipes-graphics/xorg-lib/libxfont_1.5.4.bb index 27e686b087..fa6585d6dc 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxfont_1.5.4.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxfont_1.5.4.bb @@ -15,6 +15,7 @@ PROVIDES = "xfont" PE = "1" XORG_PN = "libXfont" +XORG_EXT = "tar.bz2" BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxft_2.3.6.bb b/poky/meta/recipes-graphics/xorg-lib/libxft_2.3.6.bb deleted file mode 100644 index 23c7ece3ab..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxft_2.3.6.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "XFt: X FreeType libary" - -DESCRIPTION = "Xft was designed to provide good support for scalable \ -fonts, and to do so efficiently. Unlike the core fonts system, it \ -supports features such as anti-aliasing and sub-pixel rasterisation. \ -Perhaps more importantly, it gives applications full control over the \ -way glyphs are rendered, making fine typesetting and WYSIWIG display \ -possible. Finally, it allows applications to use fonts that are not \ -installed system-wide for displaying documents with embedded fonts. Xft \ -is not compatible with the core fonts system: usage of Xft requires \ -fairly extensive changes to toolkits (user-interface libraries)." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=90b90b60eb30f65fc9c2673d7cf59e24" - -DEPENDS += "virtual/libx11 libxrender freetype fontconfig" -PROVIDES = "xft" - -PE = "1" - -XORG_EXT = "tar.xz" -SRC_URI[sha256sum] = "60a6e7319fc938bbb8d098c9bcc86031cc2327b5d086d3335fc5c76323c03022" - -XORG_PN = "libXft" - -BBCLASSEXTEND = "native nativesdk" - -python populate_packages:prepend () { - if d.getVar('DEBIAN_NAMES'): - d.setVar('PKG:${PN}', '${MLPREFIX}libxft2') -} diff --git a/poky/meta/recipes-graphics/xorg-lib/libxft_2.3.7.bb b/poky/meta/recipes-graphics/xorg-lib/libxft_2.3.7.bb new file mode 100644 index 0000000000..ad126d2092 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxft_2.3.7.bb @@ -0,0 +1,32 @@ +SUMMARY = "XFt: X FreeType libary" + +DESCRIPTION = "Xft was designed to provide good support for scalable \ +fonts, and to do so efficiently. Unlike the core fonts system, it \ +supports features such as anti-aliasing and sub-pixel rasterisation. \ +Perhaps more importantly, it gives applications full control over the \ +way glyphs are rendered, making fine typesetting and WYSIWIG display \ +possible. Finally, it allows applications to use fonts that are not \ +installed system-wide for displaying documents with embedded fonts. Xft \ +is not compatible with the core fonts system: usage of Xft requires \ +fairly extensive changes to toolkits (user-interface libraries)." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=90b90b60eb30f65fc9c2673d7cf59e24" + +DEPENDS += "virtual/libx11 libxrender freetype fontconfig" +PROVIDES = "xft" + +PE = "1" + +SRC_URI[sha256sum] = "79f0b37c45007381c371a790c2754644ad955166dbf2a48e3625032e9bdd4f71" + +XORG_PN = "libXft" + +BBCLASSEXTEND = "native nativesdk" + +python populate_packages:prepend () { + if d.getVar('DEBIAN_NAMES'): + d.setVar('PKG:${PN}', '${MLPREFIX}libxft2') +} diff --git a/poky/meta/recipes-graphics/xorg-lib/libxi_1.8.bb b/poky/meta/recipes-graphics/xorg-lib/libxi_1.8.bb index 2aa75148d1..a6cf9b3002 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxi_1.8.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxi_1.8.bb @@ -16,6 +16,7 @@ DEPENDS += "libxext xorgproto libxfixes" PE = "1" XORG_PN = "libXi" +XORG_EXT = "tar.bz2" SRC_URI[sha256sum] = "2ed181446a61c7337576467870bc5336fc9e222a281122d96c4d39a3298bba00" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxinerama_1.1.5.bb b/poky/meta/recipes-graphics/xorg-lib/libxinerama_1.1.5.bb index 966edf6792..421b64e68d 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxinerama_1.1.5.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxinerama_1.1.5.bb @@ -15,7 +15,6 @@ PROVIDES = "xinerama" PE = "1" XORG_PN = "libXinerama" -XORG_EXT = "tar.xz" SRC_URI[sha256sum] = "5094d1f0fcc1828cb1696d0d39d9e866ae32520c54d01f618f1a3c1e30c2085c" BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.4.1.bb b/poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.4.1.bb deleted file mode 100644 index 89093e6786..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.4.1.bb +++ /dev/null @@ -1,36 +0,0 @@ -SUMMARY = "Generic XKB keymap library" -DESCRIPTION = "libxkbcommon is a keymap compiler and support library which \ -processes a reduced subset of keymaps as defined by the XKB specification." -HOMEPAGE = "http://www.xkbcommon.org" -LIC_FILES_CHKSUM = "file://LICENSE;md5=e525ed9809e1f8a07cf4bce8b09e8b87" -LICENSE = "MIT & MIT" - -DEPENDS = "flex-native bison-native" - -SRC_URI = "http://xkbcommon.org/download/${BPN}-${PV}.tar.xz" - -SRC_URI[sha256sum] = "943c07a1e2198026d8102b17270a1f406e4d3d6bbc4ae105b9e1b82d7d136b39" - -UPSTREAM_CHECK_URI = "http://xkbcommon.org/" - -inherit meson pkgconfig - -PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'x11 wayland', d)} xkbregistry" - -PACKAGECONFIG[docs] = "-Denable-docs=true,-Denable-docs=false,doxygen-native" -PACKAGECONFIG[wayland] = "-Denable-wayland=true,-Denable-wayland=false,wayland-native wayland wayland-protocols," -PACKAGECONFIG[x11] = "-Denable-x11=true,-Denable-x11=false,libxcb xkeyboard-config," -PACKAGECONFIG[xkbregistry] = "-Denable-xkbregistry=true,-Denable-xkbregistry=false,libxml2" - -PACKAGE_BEFORE_PN += "xkbcli" -FILES:${PN} = "" -FILES:xkbcli = "${bindir}/xkbcli ${libexecdir}/xkbcommon/xkbcli-*" - -python populate_packages:prepend () { - # Put the libraries into separate packages to avoid dependency creep - do_split_packages(d, d.expand('${libdir}'), r'^(lib.*)\.so\.*', '%s', '%s library', extra_depends='', allow_links=True) -} - -# Fix a following runtime error: -# xkbcommon: ERROR: couldn't find a Compose file for locale "C" -RDEPENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libx11-locale', 'libx11-compose-data', d)}" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.5.0.bb b/poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.5.0.bb new file mode 100644 index 0000000000..01966c8973 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxkbcommon_1.5.0.bb @@ -0,0 +1,38 @@ +SUMMARY = "Generic XKB keymap library" +DESCRIPTION = "libxkbcommon is a keymap compiler and support library which \ +processes a reduced subset of keymaps as defined by the XKB specification." +HOMEPAGE = "http://www.xkbcommon.org" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e525ed9809e1f8a07cf4bce8b09e8b87" +LICENSE = "MIT & MIT" + +DEPENDS = "flex-native bison-native" + +SRC_URI = "http://xkbcommon.org/download/${BPN}-${PV}.tar.xz" + +SRC_URI[sha256sum] = "560f11c4bbbca10f495f3ef7d3a6aa4ca62b4f8fb0b52e7d459d18a26e46e017" + +UPSTREAM_CHECK_URI = "http://xkbcommon.org/" + +inherit meson pkgconfig + +PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'x11 wayland', d)} xkbregistry" + +PACKAGECONFIG[docs] = "-Denable-docs=true,-Denable-docs=false,doxygen-native" +PACKAGECONFIG[wayland] = "-Denable-wayland=true,-Denable-wayland=false,wayland-native wayland wayland-protocols," +PACKAGECONFIG[x11] = "-Denable-x11=true,-Denable-x11=false,libxcb xkeyboard-config," +PACKAGECONFIG[xkbregistry] = "-Denable-xkbregistry=true,-Denable-xkbregistry=false,libxml2" + +PACKAGE_BEFORE_PN += "xkbcli" +FILES:${PN} = "" +FILES:xkbcli = "${bindir}/xkbcli ${libexecdir}/xkbcommon/xkbcli-*" + +python populate_packages:prepend () { + # Put the libraries into separate packages to avoid dependency creep + do_split_packages(d, d.expand('${libdir}'), r'^(lib.*)\.so\.*', '%s', '%s library', extra_depends='', allow_links=True) +} + +# Fix a following runtime error: +# xkbcommon: ERROR: couldn't find a Compose file for locale "C" +RDEPENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libx11-locale', 'libx11-compose-data', d)}" + +BBCLASSEXTEND += "native" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxkbfile_1.1.1.bb b/poky/meta/recipes-graphics/xorg-lib/libxkbfile_1.1.1.bb deleted file mode 100644 index 17ff588fdb..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxkbfile_1.1.1.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "XKB: X Keyboard File manipulation library" - -DESCRIPTION = "libxkbfile provides an interface to read and manipulate \ -description files for XKB, the X11 keyboard configuration extension." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=8be7367f7e5d605a426f76bb37d4d61f" - -DEPENDS += "virtual/libx11 xorgproto" - -PE = "1" - -BBCLASSEXTEND = "native" -XORG_EXT = "tar.xz" -SRC_URI[sha256sum] = "8623dc26e7aac3c5ad8a25e57b566f4324f5619e5db38457f0804ee4ed953443" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxkbfile_1.1.2.bb b/poky/meta/recipes-graphics/xorg-lib/libxkbfile_1.1.2.bb new file mode 100644 index 0000000000..58dec8ae95 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxkbfile_1.1.2.bb @@ -0,0 +1,16 @@ +SUMMARY = "XKB: X Keyboard File manipulation library" + +DESCRIPTION = "libxkbfile provides an interface to read and manipulate \ +description files for XKB, the X11 keyboard configuration extension." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=8be7367f7e5d605a426f76bb37d4d61f" + +DEPENDS += "virtual/libx11 xorgproto" + +PE = "1" + +BBCLASSEXTEND = "native" +SRC_URI[sha256sum] = "b8a3784fac420b201718047cfb6c2d5ee7e8b9481564c2667b4215f6616644b1" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxmu_1.1.4.bb b/poky/meta/recipes-graphics/xorg-lib/libxmu_1.1.4.bb index 22632aa5a7..3aae4030b7 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxmu_1.1.4.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxmu_1.1.4.bb @@ -18,7 +18,6 @@ PROVIDES = "xmu" PE = "1" XORG_PN = "libXmu" -XORG_EXT = "tar.xz" LEAD_SONAME = "libXmu" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxpm_3.5.13.bb b/poky/meta/recipes-graphics/xorg-lib/libxpm_3.5.13.bb deleted file mode 100644 index 4f0a5d7ba0..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxpm_3.5.13.bb +++ /dev/null @@ -1,27 +0,0 @@ -require xorg-lib-common.inc - -# libxpm requires xgettext to build -inherit gettext - -SUMMARY = "Xpm: X Pixmap extension library" - -DESCRIPTION = "libXpm provides support and common operation for the XPM \ -pixmap format, which is commonly used in legacy X applications. XPM is \ -an extension of the monochrome XBM bitmap specificied in the X \ -protocol." - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=51f4270b012ecd4ab1a164f5f4ed6cf7" -DEPENDS += "libxext libsm libxt gettext-native" -PE = "1" - -XORG_PN = "libXpm" - -PACKAGES =+ "sxpm cxpm" -FILES:cxpm = "${bindir}/cxpm" -FILES:sxpm = "${bindir}/sxpm" - -SRC_URI[md5sum] = "6f0ecf8d103d528cfc803aa475137afa" -SRC_URI[sha256sum] = "9cd1da57588b6cb71450eff2273ef6b657537a9ac4d02d0014228845b935ac25" - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxpm_3.5.14.bb b/poky/meta/recipes-graphics/xorg-lib/libxpm_3.5.14.bb new file mode 100644 index 0000000000..2740341807 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxpm_3.5.14.bb @@ -0,0 +1,26 @@ +require xorg-lib-common.inc + +# libxpm requires xgettext to build +inherit gettext + +SUMMARY = "Xpm: X Pixmap extension library" + +DESCRIPTION = "libXpm provides support and common operation for the XPM \ +pixmap format, which is commonly used in legacy X applications. XPM is \ +an extension of the monochrome XBM bitmap specificied in the X \ +protocol." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=51f4270b012ecd4ab1a164f5f4ed6cf7" +DEPENDS += "libxext libsm libxt gettext-native" +PE = "1" + +XORG_PN = "libXpm" + +PACKAGES =+ "sxpm cxpm" +FILES:cxpm = "${bindir}/cxpm" +FILES:sxpm = "${bindir}/sxpm" + +SRC_URI[sha256sum] = "f7eb8f69c039281def8258ae6859adb5f050fbe161ab3d6a2d6ef109a603eac2" + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxrandr_1.5.2.bb b/poky/meta/recipes-graphics/xorg-lib/libxrandr_1.5.2.bb deleted file mode 100644 index 482017d2ae..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxrandr_1.5.2.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "XRandR: X Resize, Rotate and Reflect extension library" - -DESCRIPTION = "The X Resize, Rotate and Reflect Extension, called RandR \ -for short, brings the ability to resize, rotate and reflect the root \ -window of a screen. It is based on the X Resize and Rotate Extension as \ -specified in the Proceedings of the 2001 Usenix Technical Conference \ -[RANDR]." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=c9d1a2118a6cd5727521db8e7a2fee69" - -DEPENDS += "virtual/libx11 xorgproto libxrender libxext" - -PE = "1" - -XORG_PN = "libXrandr" - -BBCLASSEXTEND = "native nativesdk" - -SRC_URI[md5sum] = "18f3b20d522f45e4dadd34afb5bea048" -SRC_URI[sha256sum] = "8aea0ebe403d62330bb741ed595b53741acf45033d3bda1792f1d4cc3daee023" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxrandr_1.5.3.bb b/poky/meta/recipes-graphics/xorg-lib/libxrandr_1.5.3.bb new file mode 100644 index 0000000000..98572bd969 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxrandr_1.5.3.bb @@ -0,0 +1,22 @@ +SUMMARY = "XRandR: X Resize, Rotate and Reflect extension library" + +DESCRIPTION = "The X Resize, Rotate and Reflect Extension, called RandR \ +for short, brings the ability to resize, rotate and reflect the root \ +window of a screen. It is based on the X Resize and Rotate Extension as \ +specified in the Proceedings of the 2001 Usenix Technical Conference \ +[RANDR]." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=c9d1a2118a6cd5727521db8e7a2fee69" + +DEPENDS += "virtual/libx11 xorgproto libxrender libxext" + +PE = "1" + +XORG_PN = "libXrandr" + +BBCLASSEXTEND = "native nativesdk" + +SRC_URI[sha256sum] = "897639014a78e1497704d669c5dd5682d721931a4452c89a7ba62676064eb428" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxrender_0.9.11.bb b/poky/meta/recipes-graphics/xorg-lib/libxrender_0.9.11.bb index 302cc56e86..e138764dff 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxrender_0.9.11.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxrender_0.9.11.bb @@ -18,6 +18,5 @@ PE = "1" XORG_PN = "libXrender" BBCLASSEXTEND = "native nativesdk" -XORG_EXT = "tar.xz" SRC_URI[sha256sum] = "bc53759a3a83d1ff702fb59641b3d2f7c56e05051fa0cfa93501166fa782dc24" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxres_1.2.1.bb b/poky/meta/recipes-graphics/xorg-lib/libxres_1.2.1.bb deleted file mode 100644 index 29a799a328..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxres_1.2.1.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "XRes: X Resource extension library" - -DESCRIPTION = "libXRes provides an X Window System client interface to \ -the Resource extension to the X protocol. The Resource extension allows \ -for X clients to see and monitor the X resource usage of various clients \ -(pixmaps, et al)." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=8c89441a8df261bdc56587465e13c7fa" - -DEPENDS += "libxext xorgproto" - -PE = "1" - -XORG_PN = "libXres" - -SRC_URI[sha256sum] = "b6e6fb1ebb61610e56017edd928fb89a5f53b3f4f990078309877468663b2b11" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxres_1.2.2.bb b/poky/meta/recipes-graphics/xorg-lib/libxres_1.2.2.bb new file mode 100644 index 0000000000..72b28d9107 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxres_1.2.2.bb @@ -0,0 +1,19 @@ +SUMMARY = "XRes: X Resource extension library" + +DESCRIPTION = "libXRes provides an X Window System client interface to \ +the Resource extension to the X protocol. The Resource extension allows \ +for X clients to see and monitor the X resource usage of various clients \ +(pixmaps, et al)." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=8c89441a8df261bdc56587465e13c7fa" + +DEPENDS += "libxext xorgproto" + +PE = "1" + +XORG_PN = "libXres" + +SRC_URI[sha256sum] = "9a7446f3484b9b7538ac5ee30d2c1ce9e5b7fbbaf1440e02f6cca186a1fa745f" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxscrnsaver_1.2.3.bb b/poky/meta/recipes-graphics/xorg-lib/libxscrnsaver_1.2.3.bb deleted file mode 100644 index b52fd00f1a..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxscrnsaver_1.2.3.bb +++ /dev/null @@ -1,23 +0,0 @@ -require xorg-lib-common.inc - -SUMMARY = "Xscrnsaver: X Screen Saver extension library" - -DESCRIPTION = "The X Window System provides support for changing the \ -image on a display screen after a user-settable period of inactivity to \ -avoid burning the cathode ray tube phosphors. However, no interfaces are \ -provided for the user to control the image that is drawn. This extension \ -allows an external \"screen saver\" client to detect when the alternate \ -image is to be displayed and to provide the graphics." - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=21fd154ee757813632ada871a34113fb" - -DEPENDS += "libxext xorgproto" -PROVIDES = "libxss" -RREPLACES:${PN} = "libxss" -PE = "1" - -XORG_PN = "libXScrnSaver" - -SRC_URI[md5sum] = "eeea9d5af3e6c143d0ea1721d27a5e49" -SRC_URI[sha256sum] = "f917075a1b7b5a38d67a8b0238eaab14acd2557679835b154cf2bca576e89bf8" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxscrnsaver_1.2.4.bb b/poky/meta/recipes-graphics/xorg-lib/libxscrnsaver_1.2.4.bb new file mode 100644 index 0000000000..1b407f52f0 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxscrnsaver_1.2.4.bb @@ -0,0 +1,22 @@ +require xorg-lib-common.inc + +SUMMARY = "Xscrnsaver: X Screen Saver extension library" + +DESCRIPTION = "The X Window System provides support for changing the \ +image on a display screen after a user-settable period of inactivity to \ +avoid burning the cathode ray tube phosphors. However, no interfaces are \ +provided for the user to control the image that is drawn. This extension \ +allows an external \"screen saver\" client to detect when the alternate \ +image is to be displayed and to provide the graphics." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=21fd154ee757813632ada871a34113fb" + +DEPENDS += "libxext xorgproto" +PROVIDES = "libxss" +RREPLACES:${PN} = "libxss" +PE = "1" + +XORG_PN = "libXScrnSaver" + +SRC_URI[sha256sum] = "75cd2859f38e207a090cac980d76bc71e9da99d48d09703584e00585abc920fe" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.1.bb b/poky/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.1.bb deleted file mode 100644 index be793882dc..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.1.bb +++ /dev/null @@ -1,21 +0,0 @@ -SUMMARY = "Shared memory 'SyncFence' synchronization primitive" - -DESCRIPTION = "This library offers a CPU-based synchronization primitive compatible \ -with the X SyncFence objects that can be shared between processes \ -using file descriptor passing." - -require xorg-lib-common.inc - -LICENSE = "HPND" -LIC_FILES_CHKSUM = "file://COPYING;md5=47e508ca280fde97906eacb77892c3ac" - -DEPENDS += "virtual/libx11" - -EXTRA_OECONF += "--with-shared-memory-dir=/dev/shm" - -SRC_URI += "file://0001-xshmfence_futex.h-Define-SYS_futex-if-it-does-not-ex.patch" - -XORG_EXT = "tar.xz" -SRC_URI[sha256sum] = "1129f95147f7bfe6052988a087f1b7cb7122283d2c47a7dbf7135ce0df69b4f8" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.2.bb b/poky/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.2.bb new file mode 100644 index 0000000000..0a7da938e1 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxshmfence_1.3.2.bb @@ -0,0 +1,20 @@ +SUMMARY = "Shared memory 'SyncFence' synchronization primitive" + +DESCRIPTION = "This library offers a CPU-based synchronization primitive compatible \ +with the X SyncFence objects that can be shared between processes \ +using file descriptor passing." + +require xorg-lib-common.inc + +LICENSE = "HPND" +LIC_FILES_CHKSUM = "file://COPYING;md5=47e508ca280fde97906eacb77892c3ac" + +DEPENDS += "virtual/libx11" + +EXTRA_OECONF += "--with-shared-memory-dir=/dev/shm" + +SRC_URI += "file://0001-xshmfence_futex.h-Define-SYS_futex-if-it-does-not-ex.patch" + +SRC_URI[sha256sum] = "870df257bc40b126d91b5a8f1da6ca8a524555268c50b59c0acd1a27f361606f" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxt_1.2.1.bb b/poky/meta/recipes-graphics/xorg-lib/libxt_1.2.1.bb index eef561dbba..f56e106ee1 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxt_1.2.1.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxt_1.2.1.bb @@ -21,6 +21,7 @@ PROVIDES = "xt" PE = "1" XORG_PN = "libXt" +XORG_EXT = "tar.bz2" SRC_URI += "file://libxt_fix_for_x32.patch" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxtst_1.2.4.bb b/poky/meta/recipes-graphics/xorg-lib/libxtst_1.2.4.bb index 7ed8f3d89d..db0621ba2e 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxtst_1.2.4.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxtst_1.2.4.bb @@ -15,7 +15,6 @@ PROVIDES = "xtst" PE = "1" XORG_PN = "libXtst" -XORG_EXT = "tar.xz" SRC_URI[sha256sum] = "84f5f30b9254b4ffee14b5b0940e2622153b0d3aed8286a3c5b7eeb340ca33c8" BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/libxv_1.0.11.bb b/poky/meta/recipes-graphics/xorg-lib/libxv_1.0.11.bb deleted file mode 100644 index 3c8bf08153..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/libxv_1.0.11.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "Xv: X Video extension library" - -DESCRIPTION = "libXv provides an X Window System client interface to the \ -X Video extension to the X protocol. The X Video extension allows for \ -accelerated drawing of videos. Hardware adaptors are exposed to \ -clients, which may draw in a number of colourspaces, including YUV." - -require xorg-lib-common.inc - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=827da9afab1f727f2a66574629e0f39c" - -DEPENDS += "libxext xorgproto" - -XORG_PN = "libXv" - -SRC_URI[md5sum] = "210b6ef30dda2256d54763136faa37b9" -SRC_URI[sha256sum] = "d26c13eac99ac4504c532e8e76a1c8e4bd526471eb8a0a4ff2a88db60cb0b088" - diff --git a/poky/meta/recipes-graphics/xorg-lib/libxv_1.0.12.bb b/poky/meta/recipes-graphics/xorg-lib/libxv_1.0.12.bb new file mode 100644 index 0000000000..7f9c5e5cbc --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/libxv_1.0.12.bb @@ -0,0 +1,18 @@ +SUMMARY = "Xv: X Video extension library" + +DESCRIPTION = "libXv provides an X Window System client interface to the \ +X Video extension to the X protocol. The X Video extension allows for \ +accelerated drawing of videos. Hardware adaptors are exposed to \ +clients, which may draw in a number of colourspaces, including YUV." + +require xorg-lib-common.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=827da9afab1f727f2a66574629e0f39c" + +DEPENDS += "libxext xorgproto" + +XORG_PN = "libXv" + +SRC_URI[sha256sum] = "aaf7fa09f689f7a2000fe493c0d64d1487a1210db154053e9e2336b860c63848" + diff --git a/poky/meta/recipes-graphics/xorg-lib/libxxf86vm_1.1.5.bb b/poky/meta/recipes-graphics/xorg-lib/libxxf86vm_1.1.5.bb index a586159ee3..16fd29ebcd 100644 --- a/poky/meta/recipes-graphics/xorg-lib/libxxf86vm_1.1.5.bb +++ b/poky/meta/recipes-graphics/xorg-lib/libxxf86vm_1.1.5.bb @@ -15,7 +15,6 @@ DEPENDS += "libxext xorgproto" PE = "1" XORG_PN = "libXxf86vm" -XORG_EXT = "tar.xz" SRC_URI[sha256sum] = "247fef48b3e0e7e67129e41f1e789e8d006ba47dba1c0cdce684b9b703f888e7" BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-graphics/xorg-lib/xcb-util_0.4.0.bb b/poky/meta/recipes-graphics/xorg-lib/xcb-util_0.4.0.bb deleted file mode 100644 index 6d0af2aa23..0000000000 --- a/poky/meta/recipes-graphics/xorg-lib/xcb-util_0.4.0.bb +++ /dev/null @@ -1,10 +0,0 @@ -require xcb-util.inc - -SRC_URI = "http://xcb.freedesktop.org/dist/${BPN}-${PV}.tar.bz2" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://src/xcb_aux.c;endline=30;md5=ae305b9c2a38f9ba27060191046a6460 \ - file://src/xcb_event.h;endline=27;md5=627be355aee59e1b8ade80d5bd90fad9" - -SRC_URI[md5sum] = "2e97feed81919465a04ccc71e4073313" -SRC_URI[sha256sum] = "46e49469cb3b594af1d33176cd7565def2be3fa8be4371d62271fabb5eae50e9" diff --git a/poky/meta/recipes-graphics/xorg-lib/xcb-util_0.4.1.bb b/poky/meta/recipes-graphics/xorg-lib/xcb-util_0.4.1.bb new file mode 100644 index 0000000000..0da004f907 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-lib/xcb-util_0.4.1.bb @@ -0,0 +1,9 @@ +require xcb-util.inc + +SRC_URI = "http://xcb.freedesktop.org/dist/${BPN}-${PV}.tar.xz" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://src/xcb_aux.c;endline=30;md5=ae305b9c2a38f9ba27060191046a6460 \ + file://src/xcb_event.h;endline=27;md5=627be355aee59e1b8ade80d5bd90fad9" + +SRC_URI[sha256sum] = "5abe3bbbd8e54f0fa3ec945291b7e8fa8cfd3cccc43718f8758430f94126e512" diff --git a/poky/meta/recipes-graphics/xorg-lib/xkeyboard-config_2.37.bb b/poky/meta/recipes-graphics/xorg-lib/xkeyboard-config_2.37.bb index f3d9ac9221..f9322d4866 100644 --- a/poky/meta/recipes-graphics/xorg-lib/xkeyboard-config_2.37.bb +++ b/poky/meta/recipes-graphics/xorg-lib/xkeyboard-config_2.37.bb @@ -28,3 +28,5 @@ do_install:append () { install -d ${D}${datadir}/X11/xkb/compiled cd ${D}${datadir}/X11/xkb/rules && ln -sf base xorg } + +BBCLASSEXTEND += "native" diff --git a/poky/meta/recipes-graphics/xorg-lib/xorg-lib-common.inc b/poky/meta/recipes-graphics/xorg-lib/xorg-lib-common.inc index 68137c4147..15c7ecf782 100644 --- a/poky/meta/recipes-graphics/xorg-lib/xorg-lib-common.inc +++ b/poky/meta/recipes-graphics/xorg-lib/xorg-lib-common.inc @@ -6,7 +6,7 @@ LICENSE = "MIT" DEPENDS = "util-macros" XORG_PN = "${BPN}" -XORG_EXT ?= "tar.bz2" +XORG_EXT ?= "tar.xz" SRC_URI = "${XORG_MIRROR}/individual/lib/${XORG_PN}-${PV}.${XORG_EXT}" diff --git a/poky/meta/recipes-graphics/xorg-lib/xtrans_1.4.0.bb b/poky/meta/recipes-graphics/xorg-lib/xtrans_1.4.0.bb index 83f11769f5..cd5aedb59d 100644 --- a/poky/meta/recipes-graphics/xorg-lib/xtrans_1.4.0.bb +++ b/poky/meta/recipes-graphics/xorg-lib/xtrans_1.4.0.bb @@ -12,6 +12,8 @@ require xorg-lib-common.inc LICENSE = "MIT & MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=49347921d4d5268021a999f250edc9ca" +XORG_EXT = "tar.bz2" + SRC_URI += "file://multilibfix.patch" PE = "1" diff --git a/poky/meta/recipes-graphics/xorg-util/makedepend_1.0.7.bb b/poky/meta/recipes-graphics/xorg-util/makedepend_1.0.7.bb deleted file mode 100644 index 12dea012dc..0000000000 --- a/poky/meta/recipes-graphics/xorg-util/makedepend_1.0.7.bb +++ /dev/null @@ -1,20 +0,0 @@ -require xorg-util-common.inc - -SUMMARY = "create dependencies in makefiles" - -DESCRIPTION = "The makedepend program reads each sourcefile in sequence \ -and parses it like a C-preprocessor, processing \ -all #include, #define, #undef, #ifdef, #ifndef, #endif, #if, #elif \ -and #else directives so that it can correctly tell which #include, \ -directives would be used in a compilation. Any #include, directives \ -can reference files having other #include directives, and parsing will \ -occur in these files as well." - -DEPENDS = "xorgproto util-macros" -PE = "1" - -BBCLASSEXTEND = "native" - -LIC_FILES_CHKSUM = "file://COPYING;md5=43a6eda34b48ee821b3b66f4f753ce4f" - -SRC_URI[sha256sum] = "17c1adf0284aaee473abfff0e8d3e754770615e1275f2a0043b9d97a00ed5cc9" diff --git a/poky/meta/recipes-graphics/xorg-util/makedepend_1.0.8.bb b/poky/meta/recipes-graphics/xorg-util/makedepend_1.0.8.bb new file mode 100644 index 0000000000..ad769de205 --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-util/makedepend_1.0.8.bb @@ -0,0 +1,20 @@ +require xorg-util-common.inc + +SUMMARY = "create dependencies in makefiles" + +DESCRIPTION = "The makedepend program reads each sourcefile in sequence \ +and parses it like a C-preprocessor, processing \ +all #include, #define, #undef, #ifdef, #ifndef, #endif, #if, #elif \ +and #else directives so that it can correctly tell which #include, \ +directives would be used in a compilation. Any #include, directives \ +can reference files having other #include directives, and parsing will \ +occur in these files as well." + +DEPENDS = "xorgproto util-macros" +PE = "1" + +BBCLASSEXTEND = "native" + +LIC_FILES_CHKSUM = "file://COPYING;md5=43a6eda34b48ee821b3b66f4f753ce4f" + +SRC_URI[sha256sum] = "275f0d2b196bfdc740aab9f02bb48cb7a97e4dfea011a7b468ed5648d0019e54" diff --git a/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch b/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch deleted file mode 100644 index 0e61ec5953..0000000000 --- a/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch +++ /dev/null @@ -1,63 +0,0 @@ -CVE: CVE-2022-3551 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 18f91b950e22c2a342a4fbc55e9ddf7534a707d2 Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 13 Jul 2022 11:23:09 +1000 -Subject: [PATCH] xkb: fix some possible memleaks in XkbGetKbdByName - -GetComponentByName returns an allocated string, so let's free that if we -fail somewhere. - -Signed-off-by: Peter Hutterer ---- - xkb/xkb.c | 26 ++++++++++++++++++++------ - 1 file changed, 20 insertions(+), 6 deletions(-) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 4692895db..b79a269e3 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5935,18 +5935,32 @@ ProcXkbGetKbdByName(ClientPtr client) - xkb = dev->key->xkbInfo->desc; - status = Success; - str = (unsigned char *) &stuff[1]; -- if (GetComponentSpec(&str, TRUE, &status)) /* keymap, unsupported */ -- return BadMatch; -+ { -+ char *keymap = GetComponentSpec(&str, TRUE, &status); /* keymap, unsupported */ -+ if (keymap) { -+ free(keymap); -+ return BadMatch; -+ } -+ } - names.keycodes = GetComponentSpec(&str, TRUE, &status); - names.types = GetComponentSpec(&str, TRUE, &status); - names.compat = GetComponentSpec(&str, TRUE, &status); - names.symbols = GetComponentSpec(&str, TRUE, &status); - names.geometry = GetComponentSpec(&str, TRUE, &status); -- if (status != Success) -+ if (status == Success) { -+ len = str - ((unsigned char *) stuff); -+ if ((XkbPaddedSize(len) / 4) != stuff->length) -+ status = BadLength; -+ } -+ -+ if (status != Success) { -+ free(names.keycodes); -+ free(names.types); -+ free(names.compat); -+ free(names.symbols); -+ free(names.geometry); - return status; -- len = str - ((unsigned char *) stuff); -- if ((XkbPaddedSize(len) / 4) != stuff->length) -- return BadLength; -+ } - - CHK_MASK_LEGAL(0x01, stuff->want, XkbGBN_AllComponentsMask); - CHK_MASK_LEGAL(0x02, stuff->need, XkbGBN_AllComponentsMask); --- -2.34.1 - diff --git a/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-xkb-proof-GetCountedString-against-request-length-at.patch b/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-xkb-proof-GetCountedString-against-request-length-at.patch deleted file mode 100644 index 6f862e82f9..0000000000 --- a/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg/0001-xkb-proof-GetCountedString-against-request-length-at.patch +++ /dev/null @@ -1,38 +0,0 @@ -CVE: CVE-2022-3550 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 11beef0b7f1ed290348e45618e5fa0d2bffcb72e Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Tue, 5 Jul 2022 12:06:20 +1000 -Subject: [PATCH] xkb: proof GetCountedString against request length attacks - -GetCountedString did a check for the whole string to be within the -request buffer but not for the initial 2 bytes that contain the length -field. A swapped client could send a malformed request to trigger a -swaps() on those bytes, writing into random memory. - -Signed-off-by: Peter Hutterer ---- - xkb/xkb.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index f42f59ef3..1841cff26 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5137,6 +5137,11 @@ _GetCountedString(char **wire_inout, ClientPtr client, char **str) - CARD16 len; - - wire = *wire_inout; -+ -+ if (client->req_len < -+ bytes_to_int32(wire + 2 - (char *) client->requestBuffer)) -+ return BadValue; -+ - len = *(CARD16 *) wire; - if (client->swapped) { - swaps(&len); --- -2.34.1 - diff --git a/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.4.bb b/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.4.bb deleted file mode 100644 index aba09afec3..0000000000 --- a/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.4.bb +++ /dev/null @@ -1,30 +0,0 @@ -require xserver-xorg.inc - -SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.patch \ - file://0001-Avoid-duplicate-definitions-of-IOPortBase.patch \ - file://0001-xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch \ - file://0001-xkb-proof-GetCountedString-against-request-length-at.patch \ - " -SRC_URI[sha256sum] = "5cc4be8ee47edb58d4a90e603a59d56b40291ad38371b0bd2471fc3cbee1c587" - -# These extensions are now integrated into the server, so declare the migration -# path for in-place upgrades. - -RREPLACES:${PN} = "${PN}-extension-dri \ - ${PN}-extension-dri2 \ - ${PN}-extension-record \ - ${PN}-extension-extmod \ - ${PN}-extension-dbe \ - " -RPROVIDES:${PN} = "${PN}-extension-dri \ - ${PN}-extension-dri2 \ - ${PN}-extension-record \ - ${PN}-extension-extmod \ - ${PN}-extension-dbe \ - " -RCONFLICTS:${PN} = "${PN}-extension-dri \ - ${PN}-extension-dri2 \ - ${PN}-extension-record \ - ${PN}-extension-extmod \ - ${PN}-extension-dbe \ - " diff --git a/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.6.bb b/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.6.bb new file mode 100644 index 0000000000..256903ce5f --- /dev/null +++ b/poky/meta/recipes-graphics/xorg-xserver/xserver-xorg_21.1.6.bb @@ -0,0 +1,28 @@ +require xserver-xorg.inc + +SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.patch \ + file://0001-Avoid-duplicate-definitions-of-IOPortBase.patch \ + " +SRC_URI[sha256sum] = "1eb86ed674d042b6c8b1f9135e59395cbbca35ed551b122f73a7d8bb3bb22484" + +# These extensions are now integrated into the server, so declare the migration +# path for in-place upgrades. + +RREPLACES:${PN} = "${PN}-extension-dri \ + ${PN}-extension-dri2 \ + ${PN}-extension-record \ + ${PN}-extension-extmod \ + ${PN}-extension-dbe \ + " +RPROVIDES:${PN} = "${PN}-extension-dri \ + ${PN}-extension-dri2 \ + ${PN}-extension-record \ + ${PN}-extension-extmod \ + ${PN}-extension-dbe \ + " +RCONFLICTS:${PN} = "${PN}-extension-dri \ + ${PN}-extension-dri2 \ + ${PN}-extension-record \ + ${PN}-extension-extmod \ + ${PN}-extension-dbe \ + " diff --git a/poky/meta/recipes-graphics/xwayland/xwayland_22.1.5.bb b/poky/meta/recipes-graphics/xwayland/xwayland_22.1.5.bb deleted file mode 100644 index c1c5407dee..0000000000 --- a/poky/meta/recipes-graphics/xwayland/xwayland_22.1.5.bb +++ /dev/null @@ -1,45 +0,0 @@ -SUMMARY = "XWayland is an X Server that runs under Wayland." -DESCRIPTION = "XWayland is an X Server running as a Wayland client, \ -and thus is capable of displaying native X11 client applications in a \ -Wayland compositor environment. The goal of XWayland is to facilitate \ -the transition from X Window System to Wayland environments, providing \ -a way to run unported applications in the meantime." -HOMEPAGE = "https://fedoraproject.org/wiki/Changes/XwaylandStandalone" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=5df87950af51ac2c5822094553ea1880" - -SRC_URI = "https://www.x.org/archive/individual/xserver/xwayland-${PV}.tar.xz" -SRC_URI[sha256sum] = "e317ac1f119f8321654921761420901e4abd95585a8c763ce26af3b045ac1672" - -UPSTREAM_CHECK_REGEX = "xwayland-(?P\d+(\.(?!90\d)\d+)+)\.tar" - -inherit meson features_check pkgconfig -REQUIRED_DISTRO_FEATURES = "x11 opengl" - -DEPENDS += "xorgproto xtrans pixman libxkbfile libxfont2 wayland wayland-native wayland-protocols libdrm libepoxy libxcvt" - -OPENGL_PKGCONFIGS = "glx glamor dri3" -PACKAGECONFIG ??= "${XORG_CRYPTO} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '${OPENGL_PKGCONFIGS}', '', d)} \ -" -PACKAGECONFIG[dri3] = "-Ddri3=true,-Ddri3=false" -PACKAGECONFIG[glx] = "-Dglx=true,-Dglx=false,virtual/libgl virtual/libx11" -PACKAGECONFIG[glamor] = "-Dglamor=true,-Dglamor=false,libepoxy virtual/libgbm,libegl" -PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind" -PACKAGECONFIG[xinerama] = "-Dxinerama=true,-Dxinerama=false" - -# Xorg requires a SHA1 implementation, pick one -XORG_CRYPTO ??= "openssl" -PACKAGECONFIG[openssl] = "-Dsha1=libcrypto,,openssl" -PACKAGECONFIG[nettle] = "-Dsha1=libnettle,,nettle" -PACKAGECONFIG[gcrypt] = "-Dsha1=libgcrypt,,libgcrypt" - -do_install:append() { - # remove files not needed and clashing with xserver-xorg - rm -rf ${D}/${libdir}/xorg/ -} - -FILES:${PN} += "${libdir}/xorg/protocol.txt" - -RDEPENDS:${PN} += "xkbcomp" diff --git a/poky/meta/recipes-graphics/xwayland/xwayland_22.1.7.bb b/poky/meta/recipes-graphics/xwayland/xwayland_22.1.7.bb new file mode 100644 index 0000000000..dd32bd0111 --- /dev/null +++ b/poky/meta/recipes-graphics/xwayland/xwayland_22.1.7.bb @@ -0,0 +1,45 @@ +SUMMARY = "XWayland is an X Server that runs under Wayland." +DESCRIPTION = "XWayland is an X Server running as a Wayland client, \ +and thus is capable of displaying native X11 client applications in a \ +Wayland compositor environment. The goal of XWayland is to facilitate \ +the transition from X Window System to Wayland environments, providing \ +a way to run unported applications in the meantime." +HOMEPAGE = "https://fedoraproject.org/wiki/Changes/XwaylandStandalone" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=5df87950af51ac2c5822094553ea1880" + +SRC_URI = "https://www.x.org/archive/individual/xserver/xwayland-${PV}.tar.xz" +SRC_URI[sha256sum] = "d53afac6c71953f5cf66d03d289dacd8961da5bd309c1dff125d5955d9db5f76" + +UPSTREAM_CHECK_REGEX = "xwayland-(?P\d+(\.(?!90\d)\d+)+)\.tar" + +inherit meson features_check pkgconfig +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +DEPENDS += "xorgproto xtrans pixman libxkbfile libxfont2 wayland wayland-native wayland-protocols libdrm libepoxy libxcvt" + +OPENGL_PKGCONFIGS = "glx glamor dri3" +PACKAGECONFIG ??= "${XORG_CRYPTO} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '${OPENGL_PKGCONFIGS}', '', d)} \ +" +PACKAGECONFIG[dri3] = "-Ddri3=true,-Ddri3=false,libxshmfence" +PACKAGECONFIG[glx] = "-Dglx=true,-Dglx=false,virtual/libgl virtual/libx11" +PACKAGECONFIG[glamor] = "-Dglamor=true,-Dglamor=false,libepoxy virtual/libgbm,libegl" +PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind" +PACKAGECONFIG[xinerama] = "-Dxinerama=true,-Dxinerama=false" + +# Xorg requires a SHA1 implementation, pick one +XORG_CRYPTO ??= "openssl" +PACKAGECONFIG[openssl] = "-Dsha1=libcrypto,,openssl" +PACKAGECONFIG[nettle] = "-Dsha1=libnettle,,nettle" +PACKAGECONFIG[gcrypt] = "-Dsha1=libgcrypt,,libgcrypt" + +do_install:append() { + # remove files not needed and clashing with xserver-xorg + rm -rf ${D}/${libdir}/xorg/ +} + +FILES:${PN} += "${libdir}/xorg/protocol.txt" + +RDEPENDS:${PN} += "xkbcomp" diff --git a/poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb b/poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb index 07d7daf5fb..12f1cf516e 100644 --- a/poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb +++ b/poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb @@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "\ DEPENDS = "git-native" -SRCREV = "6a4752ebbe7d242c02b3c74a5772926edd243626" +SRCREV = "2d01f24bc78256c709728eb3f204491bce13e0e5" PV = "0.3+git${SRCPV}" inherit native diff --git a/poky/meta/recipes-kernel/kexec/kexec-tools_2.0.25.bb b/poky/meta/recipes-kernel/kexec/kexec-tools_2.0.25.bb deleted file mode 100644 index 9784404cff..0000000000 --- a/poky/meta/recipes-kernel/kexec/kexec-tools_2.0.25.bb +++ /dev/null @@ -1,86 +0,0 @@ - -SUMMARY = "Kexec fast reboot tools" -DESCRIPTION = "Kexec is a fast reboot feature that lets you reboot to a new Linux kernel" -AUTHOR = "Eric Biederman" -HOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/kexec/" -SECTION = "kernel/userland" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \ - file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09" -DEPENDS = "zlib xz" - -SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz \ - file://kdump \ - file://kdump.conf \ - file://kdump.service \ - file://0001-powerpc-change-the-memory-size-limit.patch \ - file://0002-purgatory-Pass-r-directly-to-linker.patch \ - file://0003-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch \ - file://0005-Disable-PIE-during-link.patch \ - file://0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch \ - " - -SRC_URI[sha256sum] = "4eea6f8641ea3e349653a52c7fd33be1132322a5f3dc9f1a6ade886019767320" - -inherit autotools update-rc.d systemd - -export LDFLAGS = "-L${STAGING_LIBDIR}" -EXTRA_OECONF = " --with-zlib=yes" - -do_compile:prepend() { - # Remove the prepackaged config.h from the source tree as it overrides - # the same file generated by configure and placed in the build tree - rm -f ${S}/include/config.h - - # Remove the '*.d' file to make sure the recompile is OK - for dep in `find ${B} -type f -name '*.d'`; do - dep_no_d="`echo $dep | sed 's#.d$##'`" - # Remove file.d when there is a file.o - if [ -f "$dep_no_d.o" ]; then - rm -f $dep - fi - done -} - -do_install:append () { - install -d ${D}${sysconfdir}/sysconfig - install -m 0644 ${WORKDIR}/kdump.conf ${D}${sysconfdir}/sysconfig - - if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then - install -D -m 0755 ${WORKDIR}/kdump ${D}${sysconfdir}/init.d/kdump - fi - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -D -m 0755 ${WORKDIR}/kdump ${D}${libexecdir}/kdump-helper - install -D -m 0644 ${WORKDIR}/kdump.service ${D}${systemd_system_unitdir}/kdump.service - sed -i -e 's,@LIBEXECDIR@,${libexecdir},g' ${D}${systemd_system_unitdir}/kdump.service - fi -} - -PACKAGES =+ "kexec kdump vmcore-dmesg" - -ALLOW_EMPTY:${PN} = "1" -RRECOMMENDS:${PN} = "kexec kdump vmcore-dmesg" - -FILES:kexec = "${sbindir}/kexec" -FILES:kdump = "${sbindir}/kdump \ - ${sysconfdir}/sysconfig/kdump.conf \ - ${sysconfdir}/init.d/kdump \ - ${libexecdir}/kdump-helper \ - ${systemd_system_unitdir}/kdump.service \ -" - -FILES:vmcore-dmesg = "${sbindir}/vmcore-dmesg" - -INITSCRIPT_PACKAGES = "kdump" -INITSCRIPT_NAME:kdump = "kdump" -INITSCRIPT_PARAMS:kdump = "start 56 2 3 4 5 . stop 56 0 1 6 ." - -SYSTEMD_PACKAGES = "kdump" -SYSTEMD_SERVICE:kdump = "kdump.service" - -SECURITY_PIE_CFLAGS:remove = "-fPIE -pie" - -COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)' - -INSANE_SKIP:${PN} = "arch" diff --git a/poky/meta/recipes-kernel/kexec/kexec-tools_2.0.26.bb b/poky/meta/recipes-kernel/kexec/kexec-tools_2.0.26.bb new file mode 100644 index 0000000000..bc83afb5b6 --- /dev/null +++ b/poky/meta/recipes-kernel/kexec/kexec-tools_2.0.26.bb @@ -0,0 +1,86 @@ + +SUMMARY = "Kexec fast reboot tools" +DESCRIPTION = "Kexec is a fast reboot feature that lets you reboot to a new Linux kernel" +AUTHOR = "Eric Biederman" +HOMEPAGE = "http://kernel.org/pub/linux/utils/kernel/kexec/" +SECTION = "kernel/userland" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a \ + file://kexec/kexec.c;beginline=1;endline=20;md5=af10f6ae4a8715965e648aa687ad3e09" +DEPENDS = "zlib xz" + +SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz \ + file://kdump \ + file://kdump.conf \ + file://kdump.service \ + file://0001-powerpc-change-the-memory-size-limit.patch \ + file://0002-purgatory-Pass-r-directly-to-linker.patch \ + file://0003-kexec-ARM-Fix-add_buffer_phys_virt-align-issue.patch \ + file://0005-Disable-PIE-during-link.patch \ + file://0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch \ + " + +SRC_URI[sha256sum] = "89bdd941542c64fec16311858df304ed3a3908c1a60874d69df5d9bf1611e062" + +inherit autotools update-rc.d systemd + +export LDFLAGS = "-L${STAGING_LIBDIR}" +EXTRA_OECONF = " --with-zlib=yes" + +do_compile:prepend() { + # Remove the prepackaged config.h from the source tree as it overrides + # the same file generated by configure and placed in the build tree + rm -f ${S}/include/config.h + + # Remove the '*.d' file to make sure the recompile is OK + for dep in `find ${B} -type f -name '*.d'`; do + dep_no_d="`echo $dep | sed 's#.d$##'`" + # Remove file.d when there is a file.o + if [ -f "$dep_no_d.o" ]; then + rm -f $dep + fi + done +} + +do_install:append () { + install -d ${D}${sysconfdir}/sysconfig + install -m 0644 ${WORKDIR}/kdump.conf ${D}${sysconfdir}/sysconfig + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -D -m 0755 ${WORKDIR}/kdump ${D}${sysconfdir}/init.d/kdump + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -D -m 0755 ${WORKDIR}/kdump ${D}${libexecdir}/kdump-helper + install -D -m 0644 ${WORKDIR}/kdump.service ${D}${systemd_system_unitdir}/kdump.service + sed -i -e 's,@LIBEXECDIR@,${libexecdir},g' ${D}${systemd_system_unitdir}/kdump.service + fi +} + +PACKAGES =+ "kexec kdump vmcore-dmesg" + +ALLOW_EMPTY:${PN} = "1" +RRECOMMENDS:${PN} = "kexec kdump vmcore-dmesg" + +FILES:kexec = "${sbindir}/kexec" +FILES:kdump = "${sbindir}/kdump \ + ${sysconfdir}/sysconfig/kdump.conf \ + ${sysconfdir}/init.d/kdump \ + ${libexecdir}/kdump-helper \ + ${systemd_system_unitdir}/kdump.service \ +" + +FILES:vmcore-dmesg = "${sbindir}/vmcore-dmesg" + +INITSCRIPT_PACKAGES = "kdump" +INITSCRIPT_NAME:kdump = "kdump" +INITSCRIPT_PARAMS:kdump = "start 56 2 3 4 5 . stop 56 0 1 6 ." + +SYSTEMD_PACKAGES = "kdump" +SYSTEMD_SERVICE:kdump = "kdump.service" + +SECURITY_PIE_CFLAGS:remove = "-fPIE -pie" + +COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|powerpc.*|mips.*)-(linux|freebsd.*)' + +INSANE_SKIP:${PN} = "arch" diff --git a/poky/meta/recipes-kernel/linux-firmware/linux-firmware_20221012.bb b/poky/meta/recipes-kernel/linux-firmware/linux-firmware_20221012.bb deleted file mode 100644 index c7ecee0d9a..0000000000 --- a/poky/meta/recipes-kernel/linux-firmware/linux-firmware_20221012.bb +++ /dev/null @@ -1,1126 +0,0 @@ -SUMMARY = "Firmware files for use with Linux kernel" -HOMEPAGE = "https://www.kernel.org/" -DESCRIPTION = "Linux firmware is a package distributed alongside the Linux kernel \ -that contains firmware binary blobs necessary for partial or full functionality \ -of certain hardware devices." -SECTION = "kernel" - -LICENSE = "\ - Firmware-Abilis \ - & Firmware-adsp_sst \ - & Firmware-agere \ - & Firmware-amdgpu \ - & Firmware-amd-ucode \ - & Firmware-amlogic_vdec \ - & Firmware-atheros_firmware \ - & Firmware-atmel \ - & Firmware-broadcom_bcm43xx \ - & Firmware-ca0132 \ - & Firmware-cavium \ - & Firmware-chelsio_firmware \ - & Firmware-cw1200 \ - & Firmware-cypress \ - & Firmware-dib0700 \ - & Firmware-e100 \ - & Firmware-ene_firmware \ - & Firmware-fw_sst_0f28 \ - & Firmware-go7007 \ - & Firmware-GPLv2 \ - & Firmware-hfi1_firmware \ - & Firmware-i915 \ - & Firmware-ibt_firmware \ - & Firmware-ice \ - & Firmware-it913x \ - & Firmware-iwlwifi_firmware \ - & Firmware-IntcSST2 \ - & Firmware-kaweth \ - & Firmware-Lontium \ - & Firmware-Marvell \ - & Firmware-moxa \ - & Firmware-myri10ge_firmware \ - & Firmware-netronome \ - & Firmware-nvidia \ - & Firmware-OLPC \ - & Firmware-ath9k-htc \ - & Firmware-phanfw \ - & Firmware-qat \ - & Firmware-qcom \ - & Firmware-qla1280 \ - & Firmware-qla2xxx \ - & Firmware-qualcommAthos_ar3k \ - & Firmware-qualcommAthos_ath10k \ - & Firmware-r8a779x_usb3 \ - & Firmware-radeon \ - & Firmware-ralink_a_mediatek_company_firmware \ - & Firmware-ralink-firmware \ - & Firmware-rtlwifi_firmware \ - & Firmware-imx-sdma_firmware \ - & Firmware-siano \ - & Firmware-ti-connectivity \ - & Firmware-ti-keystone \ - & Firmware-ueagle-atm4-firmware \ - & Firmware-via_vt6656 \ - & Firmware-wl1251 \ - & Firmware-xc4000 \ - & Firmware-xc5000 \ - & Firmware-xc5000c \ - & WHENCE \ -" - -LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \ - file://LICENCE.adsp_sst;md5=615c45b91a5a4a9fe046d6ab9a2df728 \ - file://LICENCE.agere;md5=af0133de6b4a9b2522defd5f188afd31 \ - file://LICENSE.amdgpu;md5=44c1166d052226cb2d6c8d7400090203 \ - file://LICENSE.amd-ucode;md5=6ca90c57f7b248de1e25c7f68ffc4698 \ - file://LICENSE.amlogic_vdec;md5=dc44f59bf64a81643e500ad3f39a468a \ - file://LICENCE.atheros_firmware;md5=30a14c7823beedac9fa39c64fdd01a13 \ - file://LICENSE.atmel;md5=aa74ac0c60595dee4d4e239107ea77a3 \ - file://LICENCE.broadcom_bcm43xx;md5=3160c14df7228891b868060e1951dfbc \ - file://LICENCE.ca0132;md5=209b33e66ee5be0461f13d31da392198 \ - file://LICENCE.cadence;md5=009f46816f6956cfb75ede13d3e1cee0 \ - file://LICENCE.cavium;md5=c37aaffb1ebe5939b2580d073a95daea \ - file://LICENCE.chelsio_firmware;md5=819aa8c3fa453f1b258ed8d168a9d903 \ - file://LICENCE.cw1200;md5=f0f770864e7a8444a5c5aa9d12a3a7ed \ - file://LICENCE.cypress;md5=48cd9436c763bf873961f9ed7b5c147b \ - file://LICENSE.dib0700;md5=f7411825c8a555a1a3e5eab9ca773431 \ - file://LICENCE.e100;md5=ec0f84136766df159a3ae6d02acdf5a8 \ - file://LICENCE.ene_firmware;md5=ed67f0f62f8f798130c296720b7d3921 \ - file://LICENCE.fw_sst_0f28;md5=6353931c988ad52818ae733ac61cd293 \ - file://LICENCE.go7007;md5=c0bb9f6aaaba55b0529ee9b30aa66beb \ - file://GPL-2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://LICENSE.hfi1_firmware;md5=5e7b6e586ce7339d12689e49931ad444 \ - file://LICENSE.i915;md5=2b0b2e0d20984affd4490ba2cba02570 \ - file://LICENCE.ibt_firmware;md5=fdbee1ddfe0fb7ab0b2fcd6b454a366b \ - file://LICENSE.ice;md5=742ab4850f2670792940e6d15c974b2f \ - file://LICENCE.IntcSST2;md5=9e7d8bea77612d7cc7d9e9b54b623062 \ - file://LICENCE.it913x;md5=1fbf727bfb6a949810c4dbfa7e6ce4f8 \ - file://LICENCE.iwlwifi_firmware;md5=2ce6786e0fc11ac6e36b54bb9b799f1b \ - file://LICENCE.kaweth;md5=b1d876e562f4b3b8d391ad8395dfe03f \ - file://LICENSE.Lontium;md5=4ec8dc582ff7295f39e2ca6a7b0be2b6 \ - file://LICENCE.Marvell;md5=28b6ed8bd04ba105af6e4dcd6e997772 \ - file://LICENCE.mediatek;md5=7c1976b63217d76ce47d0a11d8a79cf2 \ - file://LICENCE.moxa;md5=1086614767d8ccf744a923289d3d4261 \ - file://LICENCE.myri10ge_firmware;md5=42e32fb89f6b959ca222e25ac8df8fed \ - file://LICENCE.Netronome;md5=4add08f2577086d44447996503cddf5f \ - file://LICENCE.nvidia;md5=4428a922ed3ba2ceec95f076a488ce07 \ - file://LICENCE.NXP;md5=58bb8ba632cd729b9ba6183bc6aed36f \ - file://LICENCE.OLPC;md5=5b917f9d8c061991be4f6f5f108719cd \ - file://LICENCE.open-ath9k-htc-firmware;md5=1b33c9f4d17bc4d457bdb23727046837 \ - file://LICENCE.phanfw;md5=954dcec0e051f9409812b561ea743bfa \ - file://LICENCE.qat_firmware;md5=9e7d8bea77612d7cc7d9e9b54b623062 \ - file://LICENSE.qcom;md5=164e3362a538eb11d3ac51e8e134294b \ - file://LICENCE.qla1280;md5=d6895732e622d950609093223a2c4f5d \ - file://LICENCE.qla2xxx;md5=505855e921b75f1be4a437ad9b79dff0 \ - file://LICENSE.QualcommAtheros_ar3k;md5=b5fe244fb2b532311de1472a3bc06da5 \ - file://LICENSE.QualcommAtheros_ath10k;md5=cb42b686ee5f5cb890275e4321db60a8 \ - file://LICENCE.r8a779x_usb3;md5=4c1671656153025d7076105a5da7e498 \ - file://LICENSE.radeon;md5=68ec28bacb3613200bca44f404c69b16 \ - file://LICENCE.ralink_a_mediatek_company_firmware;md5=728f1a85fd53fd67fa8d7afb080bc435 \ - file://LICENCE.ralink-firmware.txt;md5=ab2c269277c45476fb449673911a2dfd \ - file://LICENCE.rtlwifi_firmware.txt;md5=00d06cfd3eddd5a2698948ead2ad54a5 \ - file://LICENSE.sdma_firmware;md5=51e8c19ecc2270f4b8ea30341ad63ce9 \ - file://LICENCE.siano;md5=4556c1bf830067f12ca151ad953ec2a5 \ - file://LICENCE.ti-connectivity;md5=c5e02be633f1499c109d1652514d85ec \ - file://LICENCE.ti-keystone;md5=3a86335d32864b0bef996bee26cc0f2c \ - file://LICENCE.ueagle-atm4-firmware;md5=4ed7ea6b507ccc583b9d594417714118 \ - file://LICENCE.via_vt6656;md5=e4159694cba42d4377a912e78a6e850f \ - file://LICENCE.wl1251;md5=ad3f81922bb9e197014bb187289d3b5b \ - file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \ - file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \ - file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \ - file://WHENCE;md5=${WHENCE_CHKSUM} \ - " -# WHENCE checksum is defined separately to ease overriding it if -# class-devupstream is selected. -WHENCE_CHKSUM = "d6d9d74a344a78028e6b0f1df80db14b" - -# These are not common licenses, set NO_GENERIC_LICENSE for them -# so that the license files will be copied from fetched source -NO_GENERIC_LICENSE[Firmware-Abilis] = "LICENCE.Abilis" -NO_GENERIC_LICENSE[Firmware-adsp_sst] = "LICENCE.adsp_sst" -NO_GENERIC_LICENSE[Firmware-agere] = "LICENCE.agere" -NO_GENERIC_LICENSE[Firmware-amdgpu] = "LICENSE.amdgpu" -NO_GENERIC_LICENSE[Firmware-amd-ucode] = "LICENSE.amd-ucode" -NO_GENERIC_LICENSE[Firmware-amlogic_vdec] = "LICENSE.amlogic_vdec" -NO_GENERIC_LICENSE[Firmware-atheros_firmware] = "LICENCE.atheros_firmware" -NO_GENERIC_LICENSE[Firmware-atmel] = "LICENSE.atmel" -NO_GENERIC_LICENSE[Firmware-broadcom_bcm43xx] = "LICENCE.broadcom_bcm43xx" -NO_GENERIC_LICENSE[Firmware-ca0132] = "LICENCE.ca0132" -NO_GENERIC_LICENSE[Firmware-cadence] = "LICENCE.cadence" -NO_GENERIC_LICENSE[Firmware-cavium] = "LICENCE.cavium" -NO_GENERIC_LICENSE[Firmware-chelsio_firmware] = "LICENCE.chelsio_firmware" -NO_GENERIC_LICENSE[Firmware-cw1200] = "LICENCE.cw1200" -NO_GENERIC_LICENSE[Firmware-cypress] = "LICENCE.cypress" -NO_GENERIC_LICENSE[Firmware-dib0700] = "LICENSE.dib0700" -NO_GENERIC_LICENSE[Firmware-e100] = "LICENCE.e100" -NO_GENERIC_LICENSE[Firmware-ene_firmware] = "LICENCE.ene_firmware" -NO_GENERIC_LICENSE[Firmware-fw_sst_0f28] = "LICENCE.fw_sst_0f28" -NO_GENERIC_LICENSE[Firmware-go7007] = "LICENCE.go7007" -NO_GENERIC_LICENSE[Firmware-GPLv2] = "GPL-2" -NO_GENERIC_LICENSE[Firmware-hfi1_firmware] = "LICENSE.hfi1_firmware" -NO_GENERIC_LICENSE[Firmware-i915] = "LICENSE.i915" -NO_GENERIC_LICENSE[Firmware-ibt_firmware] = "LICENCE.ibt_firmware" -NO_GENERIC_LICENSE[Firmware-ice] = "LICENSE.ice" -NO_GENERIC_LICENSE[Firmware-IntcSST2] = "LICENCE.IntcSST2" -NO_GENERIC_LICENSE[Firmware-it913x] = "LICENCE.it913x" -NO_GENERIC_LICENSE[Firmware-iwlwifi_firmware] = "LICENCE.iwlwifi_firmware" -NO_GENERIC_LICENSE[Firmware-kaweth] = "LICENCE.kaweth" -NO_GENERIC_LICENSE[Firmware-Lontium] = "LICENSE.Lontium" -NO_GENERIC_LICENSE[Firmware-Marvell] = "LICENCE.Marvell" -NO_GENERIC_LICENSE[Firmware-mediatek] = "LICENCE.mediatek" -NO_GENERIC_LICENSE[Firmware-moxa] = "LICENCE.moxa" -NO_GENERIC_LICENSE[Firmware-myri10ge_firmware] = "LICENCE.myri10ge_firmware" -NO_GENERIC_LICENSE[Firmware-netronome] = "LICENCE.Netronome" -NO_GENERIC_LICENSE[Firmware-nvidia] = "LICENCE.nvidia" -NO_GENERIC_LICENSE[Firmware-OLPC] = "LICENCE.OLPC" -NO_GENERIC_LICENSE[Firmware-ath9k-htc] = "LICENCE.open-ath9k-htc-firmware" -NO_GENERIC_LICENSE[Firmware-phanfw] = "LICENCE.phanfw" -NO_GENERIC_LICENSE[Firmware-qat] = "LICENCE.qat_firmware" -NO_GENERIC_LICENSE[Firmware-qcom] = "LICENSE.qcom" -NO_GENERIC_LICENSE[Firmware-qla1280] = "LICENCE.qla1280" -NO_GENERIC_LICENSE[Firmware-qla2xxx] = "LICENCE.qla2xxx" -NO_GENERIC_LICENSE[Firmware-qualcommAthos_ar3k] = "LICENSE.QualcommAtheros_ar3k" -NO_GENERIC_LICENSE[Firmware-qualcommAthos_ath10k] = "LICENSE.QualcommAtheros_ath10k" -NO_GENERIC_LICENSE[Firmware-r8a779x_usb3] = "LICENCE.r8a779x_usb3" -NO_GENERIC_LICENSE[Firmware-radeon] = "LICENSE.radeon" -NO_GENERIC_LICENSE[Firmware-ralink_a_mediatek_company_firmware] = "LICENCE.ralink_a_mediatek_company_firmware" -NO_GENERIC_LICENSE[Firmware-ralink-firmware] = "LICENCE.ralink-firmware.txt" -NO_GENERIC_LICENSE[Firmware-rtlwifi_firmware] = "LICENCE.rtlwifi_firmware.txt" -NO_GENERIC_LICENSE[Firmware-siano] = "LICENCE.siano" -NO_GENERIC_LICENSE[Firmware-imx-sdma_firmware] = "LICENSE.sdma_firmware" -NO_GENERIC_LICENSE[Firmware-ti-connectivity] = "LICENCE.ti-connectivity" -NO_GENERIC_LICENSE[Firmware-ti-keystone] = "LICENCE.ti-keystone" -NO_GENERIC_LICENSE[Firmware-ueagle-atm4-firmware] = "LICENCE.ueagle-atm4-firmware" -NO_GENERIC_LICENSE[Firmware-via_vt6656] = "LICENCE.via_vt6656" -NO_GENERIC_LICENSE[Firmware-wl1251] = "LICENCE.wl1251" -NO_GENERIC_LICENSE[Firmware-xc4000] = "LICENCE.xc4000" -NO_GENERIC_LICENSE[Firmware-xc5000] = "LICENCE.xc5000" -NO_GENERIC_LICENSE[Firmware-xc5000c] = "LICENCE.xc5000c" -NO_GENERIC_LICENSE[WHENCE] = "WHENCE" - -PE = "1" - -SRC_URI = "\ - ${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz \ -" - -BBCLASSEXTEND = "devupstream:target" -SRC_URI:class-devupstream = "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git;protocol=https;branch=main" -# Pin this to the 20220509 release, override this in local.conf -SRCREV:class-devupstream ?= "b19cbdca78ab2adfd210c91be15a22568e8b8cae" - -SRC_URI[sha256sum] = "e9d174af729511c8cccb60ec4e0b223b3c44b67d813b42d1ab9813acfa667fa5" - -inherit allarch - -CLEANBROKEN = "1" - -do_compile() { - : -} - -do_install() { - oe_runmake 'DESTDIR=${D}' 'FIRMWAREDIR=${nonarch_base_libdir}/firmware' install - cp GPL-2 LICEN[CS]E.* WHENCE ${D}${nonarch_base_libdir}/firmware/ -} - - -PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \ - ${PN}-mt7601u-license ${PN}-mt7601u \ - ${PN}-radeon-license ${PN}-radeon \ - ${PN}-amdgpu-license ${PN}-amdgpu \ - ${PN}-marvell-license ${PN}-pcie8897 ${PN}-pcie8997 \ - ${PN}-sd8686 ${PN}-sd8688 ${PN}-sd8787 ${PN}-sd8797 ${PN}-sd8801 \ - ${PN}-sd8887 ${PN}-sd8897 ${PN}-sd8997 ${PN}-usb8997 \ - ${PN}-ti-connectivity-license ${PN}-wlcommon ${PN}-wl12xx ${PN}-wl18xx \ - ${PN}-vt6656-license ${PN}-vt6656 \ - ${PN}-rs9113 ${PN}-rs9116 \ - ${PN}-rtl-license ${PN}-rtl8188 ${PN}-rtl8192cu ${PN}-rtl8192ce ${PN}-rtl8192su ${PN}-rtl8723 ${PN}-rtl8821 \ - ${PN}-rtl8761 \ - ${PN}-rtl8168 \ - ${PN}-cypress-license \ - ${PN}-broadcom-license \ - ${PN}-bcm-0bb4-0306 \ - ${PN}-bcm43143 \ - ${PN}-bcm43236b \ - ${PN}-bcm43241b0 \ - ${PN}-bcm43241b4 \ - ${PN}-bcm43241b5 \ - ${PN}-bcm43242a \ - ${PN}-bcm4329 \ - ${PN}-bcm4329-fullmac \ - ${PN}-bcm4330 \ - ${PN}-bcm4334 \ - ${PN}-bcm43340 \ - ${PN}-bcm4335 \ - ${PN}-bcm43362 \ - ${PN}-bcm4339 \ - ${PN}-bcm43430 \ - ${PN}-bcm43430a0 \ - ${PN}-bcm43455 \ - ${PN}-bcm4350 \ - ${PN}-bcm4350c2 \ - ${PN}-bcm4354 \ - ${PN}-bcm4356 \ - ${PN}-bcm4356-pcie \ - ${PN}-bcm43569 \ - ${PN}-bcm43570 \ - ${PN}-bcm4358 \ - ${PN}-bcm43602 \ - ${PN}-bcm4366b \ - ${PN}-bcm4366c \ - ${PN}-bcm4371 \ - ${PN}-bcm4373 \ - ${PN}-bcm43xx \ - ${PN}-bcm43xx-hdr \ - ${PN}-atheros-license ${PN}-ar9170 ${PN}-ath6k ${PN}-ath9k ${PN}-ath3k \ - ${PN}-gplv2-license ${PN}-carl9170 \ - ${PN}-ar3k-license ${PN}-ar3k ${PN}-ath10k-license ${PN}-ath10k ${PN}-ath11k ${PN}-qca \ - \ - ${PN}-imx-sdma-license ${PN}-imx-sdma-imx6q ${PN}-imx-sdma-imx7d \ - \ - ${PN}-iwlwifi-license ${PN}-iwlwifi \ - ${PN}-iwlwifi-135-6 \ - ${PN}-iwlwifi-3160-7 ${PN}-iwlwifi-3160-8 ${PN}-iwlwifi-3160-9 \ - ${PN}-iwlwifi-3160-10 ${PN}-iwlwifi-3160-12 ${PN}-iwlwifi-3160-13 \ - ${PN}-iwlwifi-3160-16 ${PN}-iwlwifi-3160-17 \ - ${PN}-iwlwifi-6000-4 ${PN}-iwlwifi-6000g2a-5 ${PN}-iwlwifi-6000g2a-6 \ - ${PN}-iwlwifi-6000g2b-5 ${PN}-iwlwifi-6000g2b-6 \ - ${PN}-iwlwifi-6050-4 ${PN}-iwlwifi-6050-5 \ - ${PN}-iwlwifi-7260 \ - ${PN}-iwlwifi-7265 \ - ${PN}-iwlwifi-7265d ${PN}-iwlwifi-8000c ${PN}-iwlwifi-8265 \ - ${PN}-iwlwifi-9000 \ - ${PN}-iwlwifi-misc \ - ${PN}-ibt-license ${PN}-ibt \ - ${PN}-ibt-11-5 ${PN}-ibt-12-16 ${PN}-ibt-hw-37-7 ${PN}-ibt-hw-37-8 \ - ${PN}-ibt-17 \ - ${PN}-ibt-20 \ - ${PN}-ibt-misc \ - ${PN}-i915-license ${PN}-i915 \ - ${PN}-ice-license ${PN}-ice \ - ${PN}-adsp-sst-license ${PN}-adsp-sst \ - ${PN}-bnx2-mips \ - ${PN}-liquidio \ - ${PN}-nvidia-license \ - ${PN}-nvidia-tegra-k1 ${PN}-nvidia-tegra \ - ${PN}-nvidia-gpu \ - ${PN}-netronome-license ${PN}-netronome \ - ${PN}-qat ${PN}-qat-license \ - ${PN}-qcom-license \ - ${PN}-qcom-venus-1.8 ${PN}-qcom-venus-4.2 ${PN}-qcom-venus-5.2 ${PN}-qcom-venus-5.4 \ - ${PN}-qcom-vpu-1.0 ${PN}-qcom-vpu-2.0 \ - ${PN}-qcom-adreno-a2xx ${PN}-qcom-adreno-a3xx ${PN}-qcom-adreno-a4xx ${PN}-qcom-adreno-a530 \ - ${PN}-qcom-adreno-a630 ${PN}-qcom-adreno-a650 ${PN}-qcom-adreno-a660 \ - ${PN}-qcom-apq8096-audio ${PN}-qcom-apq8096-modem \ - ${PN}-qcom-sc8280xp-lenovo-x13s-compat \ - ${PN}-qcom-sc8280xp-lenovo-x13s-audio \ - ${PN}-qcom-sc8280xp-lenovo-x13s-adreno \ - ${PN}-qcom-sc8280xp-lenovo-x13s-compute \ - ${PN}-qcom-sc8280xp-lenovo-x13s-sensors \ - ${PN}-qcom-sdm845-audio ${PN}-qcom-sdm845-compute ${PN}-qcom-sdm845-modem \ - ${PN}-qcom-sm8250-audio ${PN}-qcom-sm8250-compute \ - ${PN}-amlogic-vdec-license ${PN}-amlogic-vdec \ - ${PN}-lt9611uxc ${PN}-lontium-license \ - ${PN}-whence-license \ - ${PN}-license \ - " - -# For atheros -LICENSE:${PN}-ar9170 = "Firmware-atheros_firmware" -LICENSE:${PN}-ath3k = "Firmware-atheros_firmware" -LICENSE:${PN}-ath6k = "Firmware-atheros_firmware" -LICENSE:${PN}-ath9k = "Firmware-atheros_firmware" -LICENSE:${PN}-atheros-license = "Firmware-atheros_firmware" - -FILES:${PN}-atheros-license = "${nonarch_base_libdir}/firmware/LICENCE.atheros_firmware" -FILES:${PN}-ar9170 = " \ - ${nonarch_base_libdir}/firmware/ar9170*.fw \ -" -FILES:${PN}-ath3k = " \ - ${nonarch_base_libdir}/firmware/ath3k*fw \ -" -FILES:${PN}-ath6k = " \ - ${nonarch_base_libdir}/firmware/ath6k \ -" -FILES:${PN}-ath9k = " \ - ${nonarch_base_libdir}/firmware/ar9271.fw \ - ${nonarch_base_libdir}/firmware/ar7010*.fw \ - ${nonarch_base_libdir}/firmware/htc_9271.fw \ - ${nonarch_base_libdir}/firmware/htc_7010.fw \ - ${nonarch_base_libdir}/firmware/ath9k_htc/htc_7010-1.4.0.fw \ - ${nonarch_base_libdir}/firmware/ath9k_htc/htc_9271-1.4.0.fw \ -" - -RDEPENDS:${PN}-ar9170 += "${PN}-atheros-license" -RDEPENDS:${PN}-ath6k += "${PN}-atheros-license" -RDEPENDS:${PN}-ath9k += "${PN}-atheros-license" - -# For carl9170 -LICENSE:${PN}-carl9170 = "Firmware-GPLv2" -LICENSE:${PN}-gplv2-license = "Firmware-GPLv2" - -FILES:${PN}-gplv2-license = "${nonarch_base_libdir}/firmware/GPL-2" -FILES:${PN}-carl9170 = " \ - ${nonarch_base_libdir}/firmware/carl9170*.fw \ -" - -RDEPENDS:${PN}-carl9170 += "${PN}-gplv2-license" - -# For QualCommAthos -LICENSE:${PN}-ar3k = "Firmware-qualcommAthos_ar3k & Firmware-atheros_firmware" -LICENSE:${PN}-ar3k-license = "Firmware-qualcommAthos_ar3k" -LICENSE:${PN}-ath10k = "Firmware-qualcommAthos_ath10k" -LICENSE:${PN}-ath10k-license = "Firmware-qualcommAthos_ath10k" -LICENSE:${PN}-qca = "Firmware-qualcommAthos_ath10k" - -FILES:${PN}-ar3k-license = "${nonarch_base_libdir}/firmware/LICENSE.QualcommAtheros_ar3k" -FILES:${PN}-ar3k = " \ - ${nonarch_base_libdir}/firmware/ar3k \ -" - -FILES:${PN}-ath10k-license = "${nonarch_base_libdir}/firmware/LICENSE.QualcommAtheros_ath10k" -FILES:${PN}-ath10k = " \ - ${nonarch_base_libdir}/firmware/ath10k \ -" - -FILES:${PN}-ath11k = " \ - ${nonarch_base_libdir}/firmware/ath11k \ -" - -FILES:${PN}-qca = " \ - ${nonarch_base_libdir}/firmware/qca \ -" - -RDEPENDS:${PN}-ar3k += "${PN}-ar3k-license ${PN}-atheros-license" -RDEPENDS:${PN}-ath10k += "${PN}-ath10k-license" -RDEPENDS:${PN}-ath11k += "${PN}-ath10k-license" -RDEPENDS:${PN}-qca += "${PN}-ath10k-license" - -# For ralink -LICENSE:${PN}-ralink = "Firmware-ralink-firmware" -LICENSE:${PN}-ralink-license = "Firmware-ralink-firmware" - -FILES:${PN}-ralink-license = "${nonarch_base_libdir}/firmware/LICENCE.ralink-firmware.txt" -FILES:${PN}-ralink = " \ - ${nonarch_base_libdir}/firmware/rt*.bin \ -" - -RDEPENDS:${PN}-ralink += "${PN}-ralink-license" - -# For mediatek MT7601U -LICENSE:${PN}-mt7601u = "Firmware-ralink_a_mediatek_company_firmware" -LICENSE:${PN}-mt7601u-license = "Firmware-ralink_a_mediatek_company_firmware" - -FILES:${PN}-mt7601u-license = "${nonarch_base_libdir}/firmware/LICENCE.ralink_a_mediatek_company_firmware" -FILES:${PN}-mt7601u = " \ - ${nonarch_base_libdir}/firmware/mt7601u.bin \ -" - -RDEPENDS:${PN}-mt7601u += "${PN}-mt7601u-license" - -# For radeon -LICENSE:${PN}-radeon = "Firmware-radeon" -LICENSE:${PN}-radeon-license = "Firmware-radeon" - -FILES:${PN}-radeon-license = "${nonarch_base_libdir}/firmware/LICENSE.radeon" -FILES:${PN}-radeon = " \ - ${nonarch_base_libdir}/firmware/radeon \ -" - -RDEPENDS:${PN}-radeon += "${PN}-radeon-license" - -# For amdgpu -LICENSE:${PN}-amdgpu = "Firmware-amdgpu" -LICENSE:${PN}-amdgpu-license = "Firmware-amdgpu" - -FILES:${PN}-amdgpu-license = "${nonarch_base_libdir}/firmware/LICENSE.amdgpu" -FILES:${PN}-amdgpu = " \ - ${nonarch_base_libdir}/firmware/amdgpu \ -" - -RDEPENDS:${PN}-amdgpu += "${PN}-amdgpu-license" - -# For lontium -LICENSE:${PN}-lt9611uxc = "Firmware-Lontium" - -FILES:${PN}-lontium-license = "${nonarch_base_libdir}/firmware/LICENSE.Lontium" -FILES:${PN}-lt9611uxc = "${nonarch_base_libdir}/firmware/lt9611uxc_fw.bin" - -# For marvell -LICENSE:${PN}-pcie8897 = "Firmware-Marvell" -LICENSE:${PN}-pcie8997 = "Firmware-Marvell" -LICENSE:${PN}-sd8686 = "Firmware-Marvell" -LICENSE:${PN}-sd8688 = "Firmware-Marvell" -LICENSE:${PN}-sd8787 = "Firmware-Marvell" -LICENSE:${PN}-sd8797 = "Firmware-Marvell" -LICENSE:${PN}-sd8801 = "Firmware-Marvell" -LICENSE:${PN}-sd8887 = "Firmware-Marvell" -LICENSE:${PN}-sd8897 = "Firmware-Marvell" -LICENSE:${PN}-sd8997 = "Firmware-Marvell" -LICENSE:${PN}-usb8997 = "Firmware-Marvell" -LICENSE:${PN}-marvell-license = "Firmware-Marvell" - -FILES:${PN}-marvell-license = "${nonarch_base_libdir}/firmware/LICENCE.Marvell" -FILES:${PN}-pcie8897 = " \ - ${nonarch_base_libdir}/firmware/mrvl/pcie8897_uapsta.bin \ -" -FILES:${PN}-pcie8997 = " \ - ${nonarch_base_libdir}/firmware/mrvl/pcie8997_wlan_v4.bin \ - ${nonarch_base_libdir}/firmware/mrvl/pcieuart8997_combo_v4.bin \ - ${nonarch_base_libdir}/firmware/mrvl/pcieusb8997_combo_v4.bin \ -" -FILES:${PN}-sd8686 = " \ - ${nonarch_base_libdir}/firmware/libertas/sd8686_v9* \ - ${nonarch_base_libdir}/firmware/sd8686* \ -" -FILES:${PN}-sd8688 = " \ - ${nonarch_base_libdir}/firmware/libertas/sd8688* \ - ${nonarch_base_libdir}/firmware/mrvl/sd8688* \ -" -FILES:${PN}-sd8787 = " \ - ${nonarch_base_libdir}/firmware/mrvl/sd8787_uapsta.bin \ -" -FILES:${PN}-sd8797 = " \ - ${nonarch_base_libdir}/firmware/mrvl/sd8797_uapsta.bin \ -" -FILES:${PN}-sd8801 = " \ - ${nonarch_base_libdir}/firmware/mrvl/sd8801_uapsta.bin \ -" -FILES:${PN}-sd8887 = " \ - ${nonarch_base_libdir}/firmware/mrvl/sd8887_uapsta.bin \ -" -FILES:${PN}-sd8897 = " \ - ${nonarch_base_libdir}/firmware/mrvl/sd8897_uapsta.bin \ -" -do_install:append() { - # The kernel 5.6.x driver still uses the old name, provide a symlink for - # older kernels - ln -fs sdsd8997_combo_v4.bin ${D}${nonarch_base_libdir}/firmware/mrvl/sd8997_uapsta.bin -} -FILES:${PN}-sd8997 = " \ - ${nonarch_base_libdir}/firmware/mrvl/sd8997_uapsta.bin \ - ${nonarch_base_libdir}/firmware/mrvl/sdsd8997_combo_v4.bin \ -" -FILES:${PN}-usb8997 = " \ - ${nonarch_base_libdir}/firmware/mrvl/usbusb8997_combo_v4.bin \ -" - -RDEPENDS:${PN}-sd8686 += "${PN}-marvell-license" -RDEPENDS:${PN}-sd8688 += "${PN}-marvell-license" -RDEPENDS:${PN}-sd8787 += "${PN}-marvell-license" -RDEPENDS:${PN}-sd8797 += "${PN}-marvell-license" -RDEPENDS:${PN}-sd8801 += "${PN}-marvell-license" -RDEPENDS:${PN}-sd8887 += "${PN}-marvell-license" -RDEPENDS:${PN}-sd8897 += "${PN}-marvell-license" -RDEPENDS:${PN}-sd8997 += "${PN}-marvell-license" -RDEPENDS:${PN}-usb8997 += "${PN}-marvell-license" - -# For netronome -LICENSE:${PN}-netronome = "Firmware-netronome" - -FILES:${PN}-netronome-license = " \ - ${nonarch_base_libdir}/firmware/LICENCE.Netronome \ -" -FILES:${PN}-netronome = " \ - ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0081*.nffw \ - ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0096*.nffw \ - ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0097*.nffw \ - ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0099*.nffw \ - ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0058-0011_2x40.nffw \ - ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0058-0012_2x40.nffw \ - ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0078-0011_1x100.nffw \ - ${nonarch_base_libdir}/firmware/netronome/bpf \ - ${nonarch_base_libdir}/firmware/netronome/flower \ - ${nonarch_base_libdir}/firmware/netronome/nic \ - ${nonarch_base_libdir}/firmware/netronome/nic-sriov \ -" - -RDEPENDS:${PN}-netronome += "${PN}-netronome-license" - -# For Nvidia -LICENSE:${PN}-nvidia-gpu = "Firmware-nvidia" -LICENSE:${PN}-nvidia-tegra = "Firmware-nvidia" -LICENSE:${PN}-nvidia-tegra-k1 = "Firmware-nvidia" -LICENSE:${PN}-nvidia-license = "Firmware-nvidia" - -FILES:${PN}-nvidia-gpu = "${nonarch_base_libdir}/firmware/nvidia" -FILES:${PN}-nvidia-tegra = " \ - ${nonarch_base_libdir}/firmware/nvidia/tegra* \ - ${nonarch_base_libdir}/firmware/nvidia/gm20b \ - ${nonarch_base_libdir}/firmware/nvidia/gp10b \ -" -FILES:${PN}-nvidia-tegra-k1 = " \ - ${nonarch_base_libdir}/firmware/nvidia/tegra124 \ - ${nonarch_base_libdir}/firmware/nvidia/gk20a \ -" -FILES:${PN}-nvidia-license = "${nonarch_base_libdir}/firmware/LICENCE.nvidia" - -RDEPENDS:${PN}-nvidia-gpu += "${PN}-nvidia-license" -RDEPENDS:${PN}-nvidia-tegra += "${PN}-nvidia-license" -RDEPENDS:${PN}-nvidia-tegra-k1 += "${PN}-nvidia-license" - -# For RSI RS911x WiFi -LICENSE:${PN}-rs9113 = "WHENCE" -LICENSE:${PN}-rs9116 = "WHENCE" - -FILES:${PN}-rs9113 = " ${nonarch_base_libdir}/firmware/rsi/rs9113*.rps " -FILES:${PN}-rs9116 = " ${nonarch_base_libdir}/firmware/rsi/rs9116*.rps " - -RDEPENDS:${PN}-rs9113 += "${PN}-whence-license" -RDEPENDS:${PN}-rs9116 += "${PN}-whence-license" - -# For rtl -LICENSE:${PN}-rtl8188 = "Firmware-rtlwifi_firmware" -LICENSE:${PN}-rtl8192cu = "Firmware-rtlwifi_firmware" -LICENSE:${PN}-rtl8192ce = "Firmware-rtlwifi_firmware" -LICENSE:${PN}-rtl8192su = "Firmware-rtlwifi_firmware" -LICENSE:${PN}-rtl8723 = "Firmware-rtlwifi_firmware" -LICENSE:${PN}-rtl8761 = "Firmware-rtlwifi_firmware" -LICENSE:${PN}-rtl8821 = "Firmware-rtlwifi_firmware" -LICENSE:${PN}-rtl-license = "Firmware-rtlwifi_firmware" -LICENSE:${PN}-rtl8168 = "WHENCE" - -FILES:${PN}-rtl-license = " \ - ${nonarch_base_libdir}/firmware/LICENCE.rtlwifi_firmware.txt \ -" -FILES:${PN}-rtl8188 = " \ - ${nonarch_base_libdir}/firmware/rtlwifi/rtl8188*.bin \ -" -FILES:${PN}-rtl8192cu = " \ - ${nonarch_base_libdir}/firmware/rtlwifi/rtl8192cufw*.bin \ -" -FILES:${PN}-rtl8192ce = " \ - ${nonarch_base_libdir}/firmware/rtlwifi/rtl8192cfw*.bin \ -" -FILES:${PN}-rtl8192su = " \ - ${nonarch_base_libdir}/firmware/rtlwifi/rtl8712u.bin \ -" -FILES:${PN}-rtl8723 = " \ - ${nonarch_base_libdir}/firmware/rtlwifi/rtl8723*.bin \ -" -FILES:${PN}-rtl8821 = " \ - ${nonarch_base_libdir}/firmware/rtlwifi/rtl8821*.bin \ -" -FILES:${PN}-rtl8761 = " \ - ${nonarch_base_libdir}/firmware/rtl_bt/rtl8761*.bin \ -" -FILES:${PN}-rtl8168 = " \ - ${nonarch_base_libdir}/firmware/rtl_nic/rtl8168*.fw \ -" - -RDEPENDS:${PN}-rtl8188 += "${PN}-rtl-license" -RDEPENDS:${PN}-rtl8192ce += "${PN}-rtl-license" -RDEPENDS:${PN}-rtl8192cu += "${PN}-rtl-license" -RDEPENDS:${PN}-rtl8192su = "${PN}-rtl-license" -RDEPENDS:${PN}-rtl8723 += "${PN}-rtl-license" -RDEPENDS:${PN}-rtl8821 += "${PN}-rtl-license" -RDEPENDS:${PN}-rtl8761 += "${PN}-rtl-license" -RDEPENDS:${PN}-rtl8168 += "${PN}-whence-license" - -# For ti-connectivity -LICENSE:${PN}-wlcommon = "Firmware-ti-connectivity" -LICENSE:${PN}-wl12xx = "Firmware-ti-connectivity" -LICENSE:${PN}-wl18xx = "Firmware-ti-connectivity" -LICENSE:${PN}-ti-connectivity-license = "Firmware-ti-connectivity" - -FILES:${PN}-ti-connectivity-license = "${nonarch_base_libdir}/firmware/LICENCE.ti-connectivity" -# wl18xx optionally needs wl1271-nvs.bin (which itself is a symlink to -# wl127x-nvs.bin) - see linux/drivers/net/wireless/ti/wlcore/sdio.c -# and drivers/net/wireless/ti/wlcore/spi.c. -# While they're optional and actually only used to override the MAC -# address on wl18xx, driver loading will delay (by udev timout - 60s) -# if not there. So let's make it available always. Because it's a -# symlink, both need to go to wlcommon. -FILES:${PN}-wlcommon = " \ - ${nonarch_base_libdir}/firmware/ti-connectivity/TI* \ - ${nonarch_base_libdir}/firmware/ti-connectivity/wl127x-nvs.bin \ - ${nonarch_base_libdir}/firmware/ti-connectivity/wl1271-nvs.bin \ -" -FILES:${PN}-wl12xx = " \ - ${nonarch_base_libdir}/firmware/ti-connectivity/wl12* \ -" -FILES:${PN}-wl18xx = " \ - ${nonarch_base_libdir}/firmware/ti-connectivity/wl18* \ -" - -RDEPENDS:${PN}-wl12xx = "${PN}-ti-connectivity-license ${PN}-wlcommon" -RDEPENDS:${PN}-wl18xx = "${PN}-ti-connectivity-license ${PN}-wlcommon" - -# For vt6656 -LICENSE:${PN}-vt6656 = "Firmware-via_vt6656" -LICENSE:${PN}-vt6656-license = "Firmware-via_vt6656" - -FILES:${PN}-vt6656-license = "${nonarch_base_libdir}/firmware/LICENCE.via_vt6656" -FILES:${PN}-vt6656 = " \ - ${nonarch_base_libdir}/firmware/vntwusb.fw \ -" - -RDEPENDS:${PN}-vt6656 = "${PN}-vt6656-license" - -# For broadcom - -# for i in `grep brcm WHENCE | grep ^File | sed 's/File: brcm.//g'`; do pkg=`echo $i | sed 's/-[sp40].*//g; s/\.bin//g; s/brcmfmac/bcm/g; s/_hdr/-hdr/g; s/BCM/bcm-0bb4-0306/g'`; echo -e " \${PN}-$pkg \\"; done | sort -u - -LICENSE:${PN}-broadcom-license = "Firmware-broadcom_bcm43xx" -FILES:${PN}-broadcom-license = "${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx" - -# for i in `grep brcm WHENCE | grep ^File | sed 's/File: brcm.//g'`; do pkg=`echo $i | sed 's/-[sp40].*//g; s/\.bin//g; s/brcmfmac/bcm/g; s/_hdr/-hdr/g; s/BCM/bcm-0bb4-0306/g'`; echo "$i - $pkg"; echo -e "FILES:\${PN}-$pkg = \"\${nonarch_base_libdir}/firmware/brcm/$i\""; done | grep ^FILES - -FILES:${PN}-bcm43xx = "${nonarch_base_libdir}/firmware/brcm/bcm43xx-0.fw" -FILES:${PN}-bcm43xx-hdr = "${nonarch_base_libdir}/firmware/brcm/bcm43xx_hdr-0.fw" -FILES:${PN}-bcm4329-fullmac = "${nonarch_base_libdir}/firmware/brcm/bcm4329-fullmac-4.bin" -FILES:${PN}-bcm43236b = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43236b.bin" -FILES:${PN}-bcm4329 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4329-sdio.bin" -FILES:${PN}-bcm4330 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4330-sdio.*" -FILES:${PN}-bcm4334 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4334-sdio.bin" -FILES:${PN}-bcm4335 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4335-sdio.bin" -FILES:${PN}-bcm4339 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4339-sdio.bin \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac4339-sdio.bin \ -" -FILES:${PN}-bcm43241b0 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b0-sdio.bin" -FILES:${PN}-bcm43241b4 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b4-sdio.bin" -FILES:${PN}-bcm43241b5 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b5-sdio.bin" -FILES:${PN}-bcm43242a = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43242a.bin" -FILES:${PN}-bcm43143 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43143.bin \ - ${nonarch_base_libdir}/firmware/brcm/brcmfmac43143-sdio.bin \ -" -FILES:${PN}-bcm43430a0 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430a0-sdio.*" -FILES:${PN}-bcm43455 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.* \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac43455-sdio.* \ -" -FILES:${PN}-bcm4350c2 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4350c2-pcie.bin" -FILES:${PN}-bcm4350 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4350-pcie.bin" -FILES:${PN}-bcm4356 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-sdio.* \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac4356-sdio.* \ -" -FILES:${PN}-bcm43569 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43569.bin" -FILES:${PN}-bcm43570 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43570-pcie.bin \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac43570-pcie.bin \ -" -FILES:${PN}-bcm4358 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4358-pcie.bin" -FILES:${PN}-bcm43602 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43602-pcie.bin \ - ${nonarch_base_libdir}/firmware/brcm/brcmfmac43602-pcie.ap.bin \ -" -FILES:${PN}-bcm4366b = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4366b-pcie.bin" -FILES:${PN}-bcm4366c = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4366c-pcie.bin" -FILES:${PN}-bcm4371 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4371-pcie.bin" - -# for i in `grep brcm WHENCE | grep ^File | sed 's/File: brcm.//g'`; do pkg=`echo $i | sed 's/-[sp40].*//g; s/\.bin//g; s/brcmfmac/bcm/g; s/_hdr/-hdr/g; s/BCM/bcm-0bb4-0306/g'`; echo -e "LICENSE:\${PN}-$pkg = \"Firmware-broadcom_bcm43xx\"\nRDEPENDS_\${PN}-$pkg += \"\${PN}-broadcom-license\""; done -# Currently 1st one and last 6 have cypress LICENSE - -LICENSE:${PN}-bcm43xx = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43xx += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43xx-hdr = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43xx-hdr += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4329-fullmac = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4329-fullmac += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43236b = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43236b += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4329 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4329 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4330 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4330 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4334 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4334 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4335 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4335 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4339 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4339 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43241b0 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43241b0 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43241b4 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43241b4 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43241b5 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43241b5 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43242a = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43242a += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43143 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43143 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43430a0 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43430a0 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43455 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43455 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4350c2 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4350c2 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4350 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4350 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4356 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4356 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43569 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43569 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43570 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43570 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4358 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4358 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm43602 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm43602 += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4366b = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4366b += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4366c = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4366c += "${PN}-broadcom-license" -LICENSE:${PN}-bcm4371 = "Firmware-broadcom_bcm43xx" -RDEPENDS:${PN}-bcm4371 += "${PN}-broadcom-license" - -# For broadcom cypress - -LICENSE:${PN}-cypress-license = "Firmware-cypress" -FILES:${PN}-cypress-license = "${nonarch_base_libdir}/firmware/LICENCE.cypress" - -FILES:${PN}-bcm-0bb4-0306 = "${nonarch_base_libdir}/firmware/brcm/BCM-0bb4-0306.hcd" -FILES:${PN}-bcm43340 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43340-sdio.* \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac43340-sdio.*" -FILES:${PN}-bcm43362 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43362-sdio.* \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac43362-sdio.*" -FILES:${PN}-bcm43430 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.* \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac43430-sdio.*" -FILES:${PN}-bcm4354 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4354-sdio.bin \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac4354-sdio.bin \ -" -FILES:${PN}-bcm4356-pcie = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-pcie.* \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac4356-pcie.* \ -" -FILES:${PN}-bcm4373 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \ - ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \ - ${nonarch_base_libdir}/firmware/cypress/cyfmac4373-sdio.bin \ - ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.clm_blob \ -" - -LICENSE:${PN}-bcm-0bb4-0306 = "Firmware-cypress" -RDEPENDS:${PN}-bcm-0bb4-0306 += "${PN}-cypress-license" -LICENSE:${PN}-bcm43340 = "Firmware-cypress" -RDEPENDS:${PN}-bcm43340 += "${PN}-cypress-license" -LICENSE:${PN}-bcm43362 = "Firmware-cypress" -RDEPENDS:${PN}-bcm43362 += "${PN}-cypress-license" -LICENSE:${PN}-bcm43430 = "Firmware-cypress" -RDEPENDS:${PN}-bcm43430 += "${PN}-cypress-license" -LICENSE:${PN}-bcm4354 = "Firmware-cypress" -RDEPENDS:${PN}-bcm4354 += "${PN}-cypress-license" -LICENSE:${PN}-bcm4356-pcie = "Firmware-cypress" -RDEPENDS:${PN}-bcm4356-pcie += "${PN}-cypress-license" -LICENSE:${PN}-bcm4373 = "Firmware-cypress" -RDEPENDS:${PN}-bcm4373 += "${PN}-cypress-license" - -# For Broadcom bnx2-mips -# -# which is a separate case to the other Broadcom firmwares since its -# license is contained in the shared WHENCE file. - -LICENSE:${PN}-bnx2-mips = "WHENCE" -LICENSE:${PN}-whence-license = "WHENCE" - -FILES:${PN}-bnx2-mips = "${nonarch_base_libdir}/firmware/bnx2/bnx2-mips-09-6.2.1b.fw" -FILES:${PN}-whence-license = "${nonarch_base_libdir}/firmware/WHENCE" - -RDEPENDS:${PN}-bnx2-mips += "${PN}-whence-license" - -# For imx-sdma -LICENSE:${PN}-imx-sdma-imx6q = "Firmware-imx-sdma_firmware" -LICENSE:${PN}-imx-sdma-imx7d = "Firmware-imx-sdma_firmware" -LICENSE:${PN}-imx-sdma-license = "Firmware-imx-sdma_firmware" - -FILES:${PN}-imx-sdma-imx6q = "${nonarch_base_libdir}/firmware/imx/sdma/sdma-imx6q.bin" - -RPROVIDES:${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q" -RREPLACES:${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q" -RCONFLICTS:${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q" - -FILES:${PN}-imx-sdma-imx7d = "${nonarch_base_libdir}/firmware/imx/sdma/sdma-imx7d.bin" - -FILES:${PN}-imx-sdma-license = "${nonarch_base_libdir}/firmware/LICENSE.sdma_firmware" - -RDEPENDS:${PN}-imx-sdma-imx6q += "${PN}-imx-sdma-license" -RDEPENDS:${PN}-imx-sdma-imx7d += "${PN}-imx-sdma-license" - -# For iwlwifi -LICENSE:${PN}-iwlwifi = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-135-6 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-3160-7 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-3160-8 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-3160-9 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-3160-10 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-3160-12 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-3160-13 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-3160-16 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-3160-17 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-6000-4 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-6000g2a-5 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-6000g2a-6 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-6000g2b-5 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-6000g2b-6 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-6050-4 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-6050-5 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-7260 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-7265 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-7265d = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-8000c = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-8265 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-9000 = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-misc = "Firmware-iwlwifi_firmware" -LICENSE:${PN}-iwlwifi-license = "Firmware-iwlwifi_firmware" - - -FILES:${PN}-iwlwifi-license = "${nonarch_base_libdir}/firmware/LICENCE.iwlwifi_firmware" -FILES:${PN}-iwlwifi-135-6 = "${nonarch_base_libdir}/firmware/iwlwifi-135-6.ucode" -FILES:${PN}-iwlwifi-3160-7 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-7.ucode" -FILES:${PN}-iwlwifi-3160-8 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-8.ucode" -FILES:${PN}-iwlwifi-3160-9 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-9.ucode" -FILES:${PN}-iwlwifi-3160-10 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-10.ucode" -FILES:${PN}-iwlwifi-3160-12 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-12.ucode" -FILES:${PN}-iwlwifi-3160-13 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-13.ucode" -FILES:${PN}-iwlwifi-3160-16 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-16.ucode" -FILES:${PN}-iwlwifi-3160-17 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-17.ucode" -FILES:${PN}-iwlwifi-6000-4 = "${nonarch_base_libdir}/firmware/iwlwifi-6000-4.ucode" -FILES:${PN}-iwlwifi-6000g2a-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2a-5.ucode" -FILES:${PN}-iwlwifi-6000g2a-6 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2a-6.ucode" -FILES:${PN}-iwlwifi-6000g2b-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2b-5.ucode" -FILES:${PN}-iwlwifi-6000g2b-6 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2b-6.ucode" -FILES:${PN}-iwlwifi-6050-4 = "${nonarch_base_libdir}/firmware/iwlwifi-6050-4.ucode" -FILES:${PN}-iwlwifi-6050-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6050-5.ucode" -FILES:${PN}-iwlwifi-7260 = "${nonarch_base_libdir}/firmware/iwlwifi-7260-*.ucode" -FILES:${PN}-iwlwifi-7265 = "${nonarch_base_libdir}/firmware/iwlwifi-7265-*.ucode" -FILES:${PN}-iwlwifi-7265d = "${nonarch_base_libdir}/firmware/iwlwifi-7265D-*.ucode" -FILES:${PN}-iwlwifi-8000c = "${nonarch_base_libdir}/firmware/iwlwifi-8000C-*.ucode" -FILES:${PN}-iwlwifi-8265 = "${nonarch_base_libdir}/firmware/iwlwifi-8265-*.ucode" -FILES:${PN}-iwlwifi-9000 = "${nonarch_base_libdir}/firmware/iwlwifi-9000-*.ucode" -FILES:${PN}-iwlwifi-misc = "${nonarch_base_libdir}/firmware/iwlwifi-*.ucode" - -RDEPENDS:${PN}-iwlwifi-135-6 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-3160-7 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-3160-8 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-3160-9 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-3160-10 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-3160-12 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-3160-13 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-3160-16 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-3160-17 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-6000-4 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-6000g2a-5 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-6000g2a-6 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-6000g2b-5 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-6000g2b-6 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-6050-4 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-6050-5 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-7260 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-7265 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-7265d = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-8000c = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-8265 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-9000 = "${PN}-iwlwifi-license" -RDEPENDS:${PN}-iwlwifi-misc = "${PN}-iwlwifi-license" - -# -iwlwifi-misc is a "catch all" package that includes all the iwlwifi -# firmwares that are not already included in other -iwlwifi- packages. -# -iwlwifi is a virtual package that depends upon all iwlwifi packages. -# These are distinct in order to allow the -misc firmwares to be installed -# without pulling in every other iwlwifi package. -ALLOW_EMPTY:${PN}-iwlwifi = "1" -ALLOW_EMPTY:${PN}-iwlwifi-misc = "1" - -# Handle package updating for the newly merged iwlwifi groupings -RPROVIDES:${PN}-iwlwifi-7265 = "${PN}-iwlwifi-7265-8 ${PN}-iwlwifi-7265-9" -RREPLACES:${PN}-iwlwifi-7265 = "${PN}-iwlwifi-7265-8 ${PN}-iwlwifi-7265-9" -RCONFLICTS:${PN}-iwlwifi-7265 = "${PN}-iwlwifi-7265-8 ${PN}-iwlwifi-7265-9" - -RPROVIDES:${PN}-iwlwifi-7260 = "${PN}-iwlwifi-7260-7 ${PN}-iwlwifi-7260-8 ${PN}-iwlwifi-7260-9" -RREPLACES:${PN}-iwlwifi-7260 = "${PN}-iwlwifi-7260-7 ${PN}-iwlwifi-7260-8 ${PN}-iwlwifi-7260-9" -RCONFLICTS:${PN}-iwlwifi-7260 = "${PN}-iwlwifi-7260-7 ${PN}-iwlwifi-7260-8 ${PN}-iwlwifi-7260-9" - -# For ibt -LICENSE:${PN}-ibt-license = "Firmware-ibt_firmware" -LICENSE:${PN}-ibt-hw-37-7 = "Firmware-ibt_firmware" -LICENSE:${PN}-ibt-hw-37-8 = "Firmware-ibt_firmware" -LICENSE:${PN}-ibt-11-5 = "Firmware-ibt_firmware" -LICENSE:${PN}-ibt-12-16 = "Firmware-ibt_firmware" -LICENSE:${PN}-ibt-17 = "Firmware-ibt_firmware" -LICENSE:${PN}-ibt-20 = "Firmware-ibt_firmware" -LICENSE:${PN}-ibt-misc = "Firmware-ibt_firmware" - -FILES:${PN}-ibt-license = "${nonarch_base_libdir}/firmware/LICENCE.ibt_firmware" -FILES:${PN}-ibt-hw-37-7 = "${nonarch_base_libdir}/firmware/intel/ibt-hw-37.7*.bseq" -FILES:${PN}-ibt-hw-37-8 = "${nonarch_base_libdir}/firmware/intel/ibt-hw-37.8*.bseq" -FILES:${PN}-ibt-11-5 = "${nonarch_base_libdir}/firmware/intel/ibt-11-5.sfi ${nonarch_base_libdir}/firmware/intel/ibt-11-5.ddc" -FILES:${PN}-ibt-12-16 = "${nonarch_base_libdir}/firmware/intel/ibt-12-16.sfi ${nonarch_base_libdir}/firmware/intel/ibt-12-16.ddc" -FILES:${PN}-ibt-17 = "${nonarch_base_libdir}/firmware/intel/ibt-17-*.sfi ${nonarch_base_libdir}/firmware/intel/ibt-17-*.ddc" -FILES:${PN}-ibt-20 = "${nonarch_base_libdir}/firmware/intel/ibt-20-*.sfi ${nonarch_base_libdir}/firmware/intel/ibt-20-*.ddc" -FILES:${PN}-ibt-misc = "${nonarch_base_libdir}/firmware/intel/ibt-*" - -RDEPENDS:${PN}-ibt-hw-37-7 = "${PN}-ibt-license" -RDEPENDS:${PN}-ibt-hw-37.8 = "${PN}-ibt-license" -RDEPENDS:${PN}-ibt-11-5 = "${PN}-ibt-license" -RDEPENDS:${PN}-ibt-12-16 = "${PN}-ibt-license" -RDEPENDS:${PN}-ibt-17 = "${PN}-ibt-license" -RDEPENDS:${PN}-ibt-20 = "${PN}-ibt-license" -RDEPENDS:${PN}-ibt-misc = "${PN}-ibt-license" - -ALLOW_EMPTY:${PN}-ibt= "1" -ALLOW_EMPTY:${PN}-ibt-misc = "1" - -LICENSE:${PN}-i915 = "Firmware-i915" -LICENSE:${PN}-i915-license = "Firmware-i915" -FILES:${PN}-i915-license = "${nonarch_base_libdir}/firmware/LICENSE.i915" -FILES:${PN}-i915 = "${nonarch_base_libdir}/firmware/i915" -RDEPENDS:${PN}-i915 = "${PN}-i915-license" - -LICENSE:${PN}-ice = "Firmware-ice" -LICENSE:${PN}-ice-license = "Firmware-ice" -FILES:${PN}-ice-license = "${nonarch_base_libdir}/firmware/LICENSE.ice" -FILES:${PN}-ice = "${nonarch_base_libdir}/firmware/intel/ice" -RDEPENDS:${PN}-ice = "${PN}-ice-license" - -FILES:${PN}-adsp-sst-license = "${nonarch_base_libdir}/firmware/LICENCE.adsp_sst" -LICENSE:${PN}-adsp-sst = "Firmware-adsp_sst" -LICENSE:${PN}-adsp-sst-license = "Firmware-adsp_sst" -FILES:${PN}-adsp-sst = "${nonarch_base_libdir}/firmware/intel/dsp_fw*" -RDEPENDS:${PN}-adsp-sst = "${PN}-adsp-sst-license" - -# For QAT -LICENSE:${PN}-qat = "Firmware-qat" -LICENSE:${PN}-qat-license = "Firmware-qat" -FILES:${PN}-qat-license = "${nonarch_base_libdir}/firmware/LICENCE.qat_firmware" -FILES:${PN}-qat = "${nonarch_base_libdir}/firmware/qat*.bin" -RDEPENDS:${PN}-qat = "${PN}-qat-license" - -# For QCOM VPU/GPU and SDM845 -LICENSE:${PN}-qcom-license = "Firmware-qcom" -FILES:${PN}-qcom-license = "${nonarch_base_libdir}/firmware/LICENSE.qcom ${nonarch_base_libdir}/firmware/qcom/NOTICE.txt" -FILES:${PN}-qcom-venus-1.8 = "${nonarch_base_libdir}/firmware/qcom/venus-1.8/*" -FILES:${PN}-qcom-venus-4.2 = "${nonarch_base_libdir}/firmware/qcom/venus-4.2/*" -FILES:${PN}-qcom-venus-5.2 = "${nonarch_base_libdir}/firmware/qcom/venus-5.2/*" -FILES:${PN}-qcom-venus-5.4 = "${nonarch_base_libdir}/firmware/qcom/venus-5.4/*" -FILES:${PN}-qcom-vpu-1.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-1.0/*" -FILES:${PN}-qcom-vpu-2.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-2.0/*" -FILES:${PN}-qcom-adreno-a2xx = "${nonarch_base_libdir}/firmware/qcom/leia_*.fw" -FILES:${PN}-qcom-adreno-a3xx = "${nonarch_base_libdir}/firmware/qcom/a3*_*.fw ${nonarch_base_libdir}/firmware/a300_*.fw" -FILES:${PN}-qcom-adreno-a4xx = "${nonarch_base_libdir}/firmware/qcom/a4*_*.fw" -FILES:${PN}-qcom-adreno-a530 = "${nonarch_base_libdir}/firmware/qcom/a530*.*" -FILES:${PN}-qcom-adreno-a630 = "${nonarch_base_libdir}/firmware/qcom/a630*.* ${nonarch_base_libdir}/firmware/qcom/sdm845/a630*.*" -FILES:${PN}-qcom-adreno-a650 = "${nonarch_base_libdir}/firmware/qcom/a650*.* ${nonarch_base_libdir}/firmware/qcom/sm8250/a650*.*" -FILES:${PN}-qcom-adreno-a660 = "${nonarch_base_libdir}/firmware/qcom/a660*.*" -FILES:${PN}-qcom-apq8096-audio = "${nonarch_base_libdir}/firmware/qcom/apq8096/adsp*.*" -FILES:${PN}-qcom-apq8096-modem = "${nonarch_base_libdir}/firmware/qcom/apq8096/mba.mbn ${nonarch_base_libdir}/firmware/qcom/apq8096/modem*.* ${nonarch_base_libdir}/firmware/qcom/apq8096/wlanmdsp.mbn" -FILES:${PN}-qcom-sc8280xp-lenovo-x13s-compat = "${nonarch_base_libdir}/firmware/qcom/LENOVO/21BX" -FILES:${PN}-qcom-sc8280xp-lenovo-x13s-audio = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/*adsp*.* ${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/battmgr.jsn" -FILES:${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/qcdxkmsuc8280.mbn" -FILES:${PN}-qcom-sc8280xp-lenovo-x13s-compute = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/*cdsp*.*" -FILES:${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/*slpi*.*" -FILES:${PN}-qcom-sdm845-audio = "${nonarch_base_libdir}/firmware/qcom/sdm845/adsp*.*" -FILES:${PN}-qcom-sdm845-compute = "${nonarch_base_libdir}/firmware/qcom/sdm845/cdsp*.*" -FILES:${PN}-qcom-sdm845-modem = "${nonarch_base_libdir}/firmware/qcom/sdm845/mba.mbn ${nonarch_base_libdir}/firmware/qcom/sdm845/modem*.* ${nonarch_base_libdir}/firmware/qcom/sdm845/wlanmdsp.mbn" -FILES:${PN}-qcom-sm8250-audio = "${nonarch_base_libdir}/firmware/qcom/sm8250/adsp*.*" -FILES:${PN}-qcom-sm8250-compute = "${nonarch_base_libdir}/firmware/qcom/sm8250/cdsp*.*" -RDEPENDS:${PN}-qcom-venus-1.8 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-venus-4.2 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-venus-5.2 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-venus-5.4 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-vpu-1.0 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-vpu-2.0 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-adreno-a2xx = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-adreno-a3xx = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-adreno-a4xx = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-adreno-a530 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-adreno-a630 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-adreno-a650 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-adreno-a660 = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-apq8096-audio = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-apq8096-modem = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sc8280xp-lenovo-x13s-audio = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sc8280xp-lenovo-x13s-compute = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sdm845-audio = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sdm845-compute = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sdm845-modem = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sm8250-audio = "${PN}-qcom-license" -RDEPENDS:${PN}-qcom-sm8250-compute = "${PN}-qcom-license" - -RRECOMMENDS:${PN}-qcom-sc8280xp-lenovo-x13s-audio = "${PN}-qcom-sc8280xp-lenovo-x13s-compat" -RRECOMMENDS:${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "${PN}-qcom-sc8280xp-lenovo-x13s-compat" -RRECOMMENDS:${PN}-qcom-sc8280xp-lenovo-x13s-compute = "${PN}-qcom-sc8280xp-lenovo-x13s-compat" -RRECOMMENDS:${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "${PN}-qcom-sc8280xp-lenovo-x13s-compat" - -FILES:${PN}-liquidio = "${nonarch_base_libdir}/firmware/liquidio" - -# For Amlogic VDEC -LICENSE:${PN}-amlogic-vdec = "Firmware-amlogic_vdec" -FILES:${PN}-amlogic-vdec-license = "${nonarch_base_libdir}/firmware/LICENSE.amlogic_vdec" -FILES:${PN}-amlogic-vdec = "${nonarch_base_libdir}/firmware/meson/vdec/*" -RDEPENDS:${PN}-amlogic-vdec = "${PN}-amlogic-vdec-license" - -# For other firmwares -# Maybe split out to separate packages when needed. -LICENSE:${PN} = "\ - Firmware-Abilis \ - & Firmware-agere \ - & Firmware-amdgpu \ - & Firmware-amd-ucode \ - & Firmware-amlogic_vdec \ - & Firmware-atmel \ - & Firmware-ca0132 \ - & Firmware-cavium \ - & Firmware-chelsio_firmware \ - & Firmware-cw1200 \ - & Firmware-dib0700 \ - & Firmware-e100 \ - & Firmware-ene_firmware \ - & Firmware-fw_sst_0f28 \ - & Firmware-go7007 \ - & Firmware-hfi1_firmware \ - & Firmware-ibt_firmware \ - & Firmware-it913x \ - & Firmware-IntcSST2 \ - & Firmware-kaweth \ - & Firmware-moxa \ - & Firmware-myri10ge_firmware \ - & Firmware-nvidia \ - & Firmware-OLPC \ - & Firmware-ath9k-htc \ - & Firmware-phanfw \ - & Firmware-qat \ - & Firmware-qcom \ - & Firmware-qla1280 \ - & Firmware-qla2xxx \ - & Firmware-r8a779x_usb3 \ - & Firmware-radeon \ - & Firmware-ralink_a_mediatek_company_firmware \ - & Firmware-ralink-firmware \ - & Firmware-imx-sdma_firmware \ - & Firmware-siano \ - & Firmware-ti-connectivity \ - & Firmware-ti-keystone \ - & Firmware-ueagle-atm4-firmware \ - & Firmware-wl1251 \ - & Firmware-xc4000 \ - & Firmware-xc5000 \ - & Firmware-xc5000c \ - & WHENCE \ -" - -FILES:${PN}-license += "${nonarch_base_libdir}/firmware/LICEN*" -FILES:${PN} += "${nonarch_base_libdir}/firmware/*" -RDEPENDS:${PN} += "${PN}-license" -RDEPENDS:${PN} += "${PN}-whence-license" - -# Make linux-firmware depend on all of the split-out packages. -# Make linux-firmware-iwlwifi depend on all of the split-out iwlwifi packages. -# Make linux-firmware-ibt depend on all of the split-out ibt packages. -python populate_packages:prepend () { - firmware_pkgs = oe.utils.packages_filter_out_system(d) - d.appendVar('RRECOMMENDS:linux-firmware', ' ' + ' '.join(firmware_pkgs)) - - iwlwifi_pkgs = filter(lambda x: x.find('-iwlwifi-') != -1, firmware_pkgs) - d.appendVar('RRECOMMENDS:linux-firmware-iwlwifi', ' ' + ' '.join(iwlwifi_pkgs)) - - ibt_pkgs = filter(lambda x: x.find('-ibt-') != -1, firmware_pkgs) - d.appendVar('RRECOMMENDS:linux-firmware-ibt', ' ' + ' '.join(ibt_pkgs)) -} - -# Firmware files are generally not ran on the CPU, so they can be -# allarch despite being architecture specific -INSANE_SKIP = "arch" - -# Don't warn about already stripped files -INSANE_SKIP:${PN} = "already-stripped" - -# No need to put firmware into the sysroot -SYSROOT_DIRS_IGNORE += "${nonarch_base_libdir}/firmware" diff --git a/poky/meta/recipes-kernel/linux-firmware/linux-firmware_20221214.bb b/poky/meta/recipes-kernel/linux-firmware/linux-firmware_20221214.bb new file mode 100644 index 0000000000..c2354e627f --- /dev/null +++ b/poky/meta/recipes-kernel/linux-firmware/linux-firmware_20221214.bb @@ -0,0 +1,1126 @@ +SUMMARY = "Firmware files for use with Linux kernel" +HOMEPAGE = "https://www.kernel.org/" +DESCRIPTION = "Linux firmware is a package distributed alongside the Linux kernel \ +that contains firmware binary blobs necessary for partial or full functionality \ +of certain hardware devices." +SECTION = "kernel" + +LICENSE = "\ + Firmware-Abilis \ + & Firmware-adsp_sst \ + & Firmware-agere \ + & Firmware-amdgpu \ + & Firmware-amd-ucode \ + & Firmware-amlogic_vdec \ + & Firmware-atheros_firmware \ + & Firmware-atmel \ + & Firmware-broadcom_bcm43xx \ + & Firmware-ca0132 \ + & Firmware-cavium \ + & Firmware-chelsio_firmware \ + & Firmware-cw1200 \ + & Firmware-cypress \ + & Firmware-dib0700 \ + & Firmware-e100 \ + & Firmware-ene_firmware \ + & Firmware-fw_sst_0f28 \ + & Firmware-go7007 \ + & Firmware-GPLv2 \ + & Firmware-hfi1_firmware \ + & Firmware-i915 \ + & Firmware-ibt_firmware \ + & Firmware-ice \ + & Firmware-it913x \ + & Firmware-iwlwifi_firmware \ + & Firmware-IntcSST2 \ + & Firmware-kaweth \ + & Firmware-Lontium \ + & Firmware-Marvell \ + & Firmware-moxa \ + & Firmware-myri10ge_firmware \ + & Firmware-netronome \ + & Firmware-nvidia \ + & Firmware-OLPC \ + & Firmware-ath9k-htc \ + & Firmware-phanfw \ + & Firmware-qat \ + & Firmware-qcom \ + & Firmware-qla1280 \ + & Firmware-qla2xxx \ + & Firmware-qualcommAthos_ar3k \ + & Firmware-qualcommAthos_ath10k \ + & Firmware-r8a779x_usb3 \ + & Firmware-radeon \ + & Firmware-ralink_a_mediatek_company_firmware \ + & Firmware-ralink-firmware \ + & Firmware-rtlwifi_firmware \ + & Firmware-imx-sdma_firmware \ + & Firmware-siano \ + & Firmware-ti-connectivity \ + & Firmware-ti-keystone \ + & Firmware-ueagle-atm4-firmware \ + & Firmware-via_vt6656 \ + & Firmware-wl1251 \ + & Firmware-xc4000 \ + & Firmware-xc5000 \ + & Firmware-xc5000c \ + & WHENCE \ +" + +LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \ + file://LICENCE.adsp_sst;md5=615c45b91a5a4a9fe046d6ab9a2df728 \ + file://LICENCE.agere;md5=af0133de6b4a9b2522defd5f188afd31 \ + file://LICENSE.amdgpu;md5=44c1166d052226cb2d6c8d7400090203 \ + file://LICENSE.amd-ucode;md5=6ca90c57f7b248de1e25c7f68ffc4698 \ + file://LICENSE.amlogic_vdec;md5=dc44f59bf64a81643e500ad3f39a468a \ + file://LICENCE.atheros_firmware;md5=30a14c7823beedac9fa39c64fdd01a13 \ + file://LICENSE.atmel;md5=aa74ac0c60595dee4d4e239107ea77a3 \ + file://LICENCE.broadcom_bcm43xx;md5=3160c14df7228891b868060e1951dfbc \ + file://LICENCE.ca0132;md5=209b33e66ee5be0461f13d31da392198 \ + file://LICENCE.cadence;md5=009f46816f6956cfb75ede13d3e1cee0 \ + file://LICENCE.cavium;md5=c37aaffb1ebe5939b2580d073a95daea \ + file://LICENCE.chelsio_firmware;md5=819aa8c3fa453f1b258ed8d168a9d903 \ + file://LICENCE.cw1200;md5=f0f770864e7a8444a5c5aa9d12a3a7ed \ + file://LICENCE.cypress;md5=48cd9436c763bf873961f9ed7b5c147b \ + file://LICENSE.dib0700;md5=f7411825c8a555a1a3e5eab9ca773431 \ + file://LICENCE.e100;md5=ec0f84136766df159a3ae6d02acdf5a8 \ + file://LICENCE.ene_firmware;md5=ed67f0f62f8f798130c296720b7d3921 \ + file://LICENCE.fw_sst_0f28;md5=6353931c988ad52818ae733ac61cd293 \ + file://LICENCE.go7007;md5=c0bb9f6aaaba55b0529ee9b30aa66beb \ + file://GPL-2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://LICENSE.hfi1_firmware;md5=5e7b6e586ce7339d12689e49931ad444 \ + file://LICENSE.i915;md5=2b0b2e0d20984affd4490ba2cba02570 \ + file://LICENCE.ibt_firmware;md5=fdbee1ddfe0fb7ab0b2fcd6b454a366b \ + file://LICENSE.ice;md5=742ab4850f2670792940e6d15c974b2f \ + file://LICENCE.IntcSST2;md5=9e7d8bea77612d7cc7d9e9b54b623062 \ + file://LICENCE.it913x;md5=1fbf727bfb6a949810c4dbfa7e6ce4f8 \ + file://LICENCE.iwlwifi_firmware;md5=2ce6786e0fc11ac6e36b54bb9b799f1b \ + file://LICENCE.kaweth;md5=b1d876e562f4b3b8d391ad8395dfe03f \ + file://LICENSE.Lontium;md5=4ec8dc582ff7295f39e2ca6a7b0be2b6 \ + file://LICENCE.Marvell;md5=28b6ed8bd04ba105af6e4dcd6e997772 \ + file://LICENCE.mediatek;md5=7c1976b63217d76ce47d0a11d8a79cf2 \ + file://LICENCE.moxa;md5=1086614767d8ccf744a923289d3d4261 \ + file://LICENCE.myri10ge_firmware;md5=42e32fb89f6b959ca222e25ac8df8fed \ + file://LICENCE.Netronome;md5=4add08f2577086d44447996503cddf5f \ + file://LICENCE.nvidia;md5=4428a922ed3ba2ceec95f076a488ce07 \ + file://LICENCE.NXP;md5=58bb8ba632cd729b9ba6183bc6aed36f \ + file://LICENCE.OLPC;md5=5b917f9d8c061991be4f6f5f108719cd \ + file://LICENCE.open-ath9k-htc-firmware;md5=1b33c9f4d17bc4d457bdb23727046837 \ + file://LICENCE.phanfw;md5=954dcec0e051f9409812b561ea743bfa \ + file://LICENCE.qat_firmware;md5=9e7d8bea77612d7cc7d9e9b54b623062 \ + file://LICENSE.qcom;md5=164e3362a538eb11d3ac51e8e134294b \ + file://LICENCE.qla1280;md5=d6895732e622d950609093223a2c4f5d \ + file://LICENCE.qla2xxx;md5=505855e921b75f1be4a437ad9b79dff0 \ + file://LICENSE.QualcommAtheros_ar3k;md5=b5fe244fb2b532311de1472a3bc06da5 \ + file://LICENSE.QualcommAtheros_ath10k;md5=cb42b686ee5f5cb890275e4321db60a8 \ + file://LICENCE.r8a779x_usb3;md5=4c1671656153025d7076105a5da7e498 \ + file://LICENSE.radeon;md5=68ec28bacb3613200bca44f404c69b16 \ + file://LICENCE.ralink_a_mediatek_company_firmware;md5=728f1a85fd53fd67fa8d7afb080bc435 \ + file://LICENCE.ralink-firmware.txt;md5=ab2c269277c45476fb449673911a2dfd \ + file://LICENCE.rtlwifi_firmware.txt;md5=00d06cfd3eddd5a2698948ead2ad54a5 \ + file://LICENSE.sdma_firmware;md5=51e8c19ecc2270f4b8ea30341ad63ce9 \ + file://LICENCE.siano;md5=4556c1bf830067f12ca151ad953ec2a5 \ + file://LICENCE.ti-connectivity;md5=c5e02be633f1499c109d1652514d85ec \ + file://LICENCE.ti-keystone;md5=3a86335d32864b0bef996bee26cc0f2c \ + file://LICENCE.ueagle-atm4-firmware;md5=4ed7ea6b507ccc583b9d594417714118 \ + file://LICENCE.via_vt6656;md5=e4159694cba42d4377a912e78a6e850f \ + file://LICENCE.wl1251;md5=ad3f81922bb9e197014bb187289d3b5b \ + file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \ + file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \ + file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \ + file://WHENCE;md5=${WHENCE_CHKSUM} \ + " +# WHENCE checksum is defined separately to ease overriding it if +# class-devupstream is selected. +WHENCE_CHKSUM = "bf7c716d16e48fe118c6209f99b13253" + +# These are not common licenses, set NO_GENERIC_LICENSE for them +# so that the license files will be copied from fetched source +NO_GENERIC_LICENSE[Firmware-Abilis] = "LICENCE.Abilis" +NO_GENERIC_LICENSE[Firmware-adsp_sst] = "LICENCE.adsp_sst" +NO_GENERIC_LICENSE[Firmware-agere] = "LICENCE.agere" +NO_GENERIC_LICENSE[Firmware-amdgpu] = "LICENSE.amdgpu" +NO_GENERIC_LICENSE[Firmware-amd-ucode] = "LICENSE.amd-ucode" +NO_GENERIC_LICENSE[Firmware-amlogic_vdec] = "LICENSE.amlogic_vdec" +NO_GENERIC_LICENSE[Firmware-atheros_firmware] = "LICENCE.atheros_firmware" +NO_GENERIC_LICENSE[Firmware-atmel] = "LICENSE.atmel" +NO_GENERIC_LICENSE[Firmware-broadcom_bcm43xx] = "LICENCE.broadcom_bcm43xx" +NO_GENERIC_LICENSE[Firmware-ca0132] = "LICENCE.ca0132" +NO_GENERIC_LICENSE[Firmware-cadence] = "LICENCE.cadence" +NO_GENERIC_LICENSE[Firmware-cavium] = "LICENCE.cavium" +NO_GENERIC_LICENSE[Firmware-chelsio_firmware] = "LICENCE.chelsio_firmware" +NO_GENERIC_LICENSE[Firmware-cw1200] = "LICENCE.cw1200" +NO_GENERIC_LICENSE[Firmware-cypress] = "LICENCE.cypress" +NO_GENERIC_LICENSE[Firmware-dib0700] = "LICENSE.dib0700" +NO_GENERIC_LICENSE[Firmware-e100] = "LICENCE.e100" +NO_GENERIC_LICENSE[Firmware-ene_firmware] = "LICENCE.ene_firmware" +NO_GENERIC_LICENSE[Firmware-fw_sst_0f28] = "LICENCE.fw_sst_0f28" +NO_GENERIC_LICENSE[Firmware-go7007] = "LICENCE.go7007" +NO_GENERIC_LICENSE[Firmware-GPLv2] = "GPL-2" +NO_GENERIC_LICENSE[Firmware-hfi1_firmware] = "LICENSE.hfi1_firmware" +NO_GENERIC_LICENSE[Firmware-i915] = "LICENSE.i915" +NO_GENERIC_LICENSE[Firmware-ibt_firmware] = "LICENCE.ibt_firmware" +NO_GENERIC_LICENSE[Firmware-ice] = "LICENSE.ice" +NO_GENERIC_LICENSE[Firmware-IntcSST2] = "LICENCE.IntcSST2" +NO_GENERIC_LICENSE[Firmware-it913x] = "LICENCE.it913x" +NO_GENERIC_LICENSE[Firmware-iwlwifi_firmware] = "LICENCE.iwlwifi_firmware" +NO_GENERIC_LICENSE[Firmware-kaweth] = "LICENCE.kaweth" +NO_GENERIC_LICENSE[Firmware-Lontium] = "LICENSE.Lontium" +NO_GENERIC_LICENSE[Firmware-Marvell] = "LICENCE.Marvell" +NO_GENERIC_LICENSE[Firmware-mediatek] = "LICENCE.mediatek" +NO_GENERIC_LICENSE[Firmware-moxa] = "LICENCE.moxa" +NO_GENERIC_LICENSE[Firmware-myri10ge_firmware] = "LICENCE.myri10ge_firmware" +NO_GENERIC_LICENSE[Firmware-netronome] = "LICENCE.Netronome" +NO_GENERIC_LICENSE[Firmware-nvidia] = "LICENCE.nvidia" +NO_GENERIC_LICENSE[Firmware-OLPC] = "LICENCE.OLPC" +NO_GENERIC_LICENSE[Firmware-ath9k-htc] = "LICENCE.open-ath9k-htc-firmware" +NO_GENERIC_LICENSE[Firmware-phanfw] = "LICENCE.phanfw" +NO_GENERIC_LICENSE[Firmware-qat] = "LICENCE.qat_firmware" +NO_GENERIC_LICENSE[Firmware-qcom] = "LICENSE.qcom" +NO_GENERIC_LICENSE[Firmware-qla1280] = "LICENCE.qla1280" +NO_GENERIC_LICENSE[Firmware-qla2xxx] = "LICENCE.qla2xxx" +NO_GENERIC_LICENSE[Firmware-qualcommAthos_ar3k] = "LICENSE.QualcommAtheros_ar3k" +NO_GENERIC_LICENSE[Firmware-qualcommAthos_ath10k] = "LICENSE.QualcommAtheros_ath10k" +NO_GENERIC_LICENSE[Firmware-r8a779x_usb3] = "LICENCE.r8a779x_usb3" +NO_GENERIC_LICENSE[Firmware-radeon] = "LICENSE.radeon" +NO_GENERIC_LICENSE[Firmware-ralink_a_mediatek_company_firmware] = "LICENCE.ralink_a_mediatek_company_firmware" +NO_GENERIC_LICENSE[Firmware-ralink-firmware] = "LICENCE.ralink-firmware.txt" +NO_GENERIC_LICENSE[Firmware-rtlwifi_firmware] = "LICENCE.rtlwifi_firmware.txt" +NO_GENERIC_LICENSE[Firmware-siano] = "LICENCE.siano" +NO_GENERIC_LICENSE[Firmware-imx-sdma_firmware] = "LICENSE.sdma_firmware" +NO_GENERIC_LICENSE[Firmware-ti-connectivity] = "LICENCE.ti-connectivity" +NO_GENERIC_LICENSE[Firmware-ti-keystone] = "LICENCE.ti-keystone" +NO_GENERIC_LICENSE[Firmware-ueagle-atm4-firmware] = "LICENCE.ueagle-atm4-firmware" +NO_GENERIC_LICENSE[Firmware-via_vt6656] = "LICENCE.via_vt6656" +NO_GENERIC_LICENSE[Firmware-wl1251] = "LICENCE.wl1251" +NO_GENERIC_LICENSE[Firmware-xc4000] = "LICENCE.xc4000" +NO_GENERIC_LICENSE[Firmware-xc5000] = "LICENCE.xc5000" +NO_GENERIC_LICENSE[Firmware-xc5000c] = "LICENCE.xc5000c" +NO_GENERIC_LICENSE[WHENCE] = "WHENCE" + +PE = "1" + +SRC_URI = "\ + ${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz \ +" + +BBCLASSEXTEND = "devupstream:target" +SRC_URI:class-devupstream = "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git;protocol=https;branch=main" +# Pin this to the 20220509 release, override this in local.conf +SRCREV:class-devupstream ?= "b19cbdca78ab2adfd210c91be15a22568e8b8cae" + +SRC_URI[sha256sum] = "e793783e92acbde549965521462d1d1327827360664cf242dbda08f075654331" + +inherit allarch + +CLEANBROKEN = "1" + +do_compile() { + : +} + +do_install() { + oe_runmake 'DESTDIR=${D}' 'FIRMWAREDIR=${nonarch_base_libdir}/firmware' install + cp GPL-2 LICEN[CS]E.* WHENCE ${D}${nonarch_base_libdir}/firmware/ +} + + +PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \ + ${PN}-mt7601u-license ${PN}-mt7601u \ + ${PN}-radeon-license ${PN}-radeon \ + ${PN}-amdgpu-license ${PN}-amdgpu \ + ${PN}-marvell-license ${PN}-pcie8897 ${PN}-pcie8997 \ + ${PN}-sd8686 ${PN}-sd8688 ${PN}-sd8787 ${PN}-sd8797 ${PN}-sd8801 \ + ${PN}-sd8887 ${PN}-sd8897 ${PN}-sd8997 ${PN}-usb8997 \ + ${PN}-ti-connectivity-license ${PN}-wlcommon ${PN}-wl12xx ${PN}-wl18xx \ + ${PN}-vt6656-license ${PN}-vt6656 \ + ${PN}-rs9113 ${PN}-rs9116 \ + ${PN}-rtl-license ${PN}-rtl8188 ${PN}-rtl8192cu ${PN}-rtl8192ce ${PN}-rtl8192su ${PN}-rtl8723 ${PN}-rtl8821 \ + ${PN}-rtl8761 \ + ${PN}-rtl8168 \ + ${PN}-cypress-license \ + ${PN}-broadcom-license \ + ${PN}-bcm-0bb4-0306 \ + ${PN}-bcm43143 \ + ${PN}-bcm43236b \ + ${PN}-bcm43241b0 \ + ${PN}-bcm43241b4 \ + ${PN}-bcm43241b5 \ + ${PN}-bcm43242a \ + ${PN}-bcm4329 \ + ${PN}-bcm4329-fullmac \ + ${PN}-bcm4330 \ + ${PN}-bcm4334 \ + ${PN}-bcm43340 \ + ${PN}-bcm4335 \ + ${PN}-bcm43362 \ + ${PN}-bcm4339 \ + ${PN}-bcm43430 \ + ${PN}-bcm43430a0 \ + ${PN}-bcm43455 \ + ${PN}-bcm4350 \ + ${PN}-bcm4350c2 \ + ${PN}-bcm4354 \ + ${PN}-bcm4356 \ + ${PN}-bcm4356-pcie \ + ${PN}-bcm43569 \ + ${PN}-bcm43570 \ + ${PN}-bcm4358 \ + ${PN}-bcm43602 \ + ${PN}-bcm4366b \ + ${PN}-bcm4366c \ + ${PN}-bcm4371 \ + ${PN}-bcm4373 \ + ${PN}-bcm43xx \ + ${PN}-bcm43xx-hdr \ + ${PN}-atheros-license ${PN}-ar9170 ${PN}-ath6k ${PN}-ath9k ${PN}-ath3k \ + ${PN}-gplv2-license ${PN}-carl9170 \ + ${PN}-ar3k-license ${PN}-ar3k ${PN}-ath10k-license ${PN}-ath10k ${PN}-ath11k ${PN}-qca \ + \ + ${PN}-imx-sdma-license ${PN}-imx-sdma-imx6q ${PN}-imx-sdma-imx7d \ + \ + ${PN}-iwlwifi-license ${PN}-iwlwifi \ + ${PN}-iwlwifi-135-6 \ + ${PN}-iwlwifi-3160-7 ${PN}-iwlwifi-3160-8 ${PN}-iwlwifi-3160-9 \ + ${PN}-iwlwifi-3160-10 ${PN}-iwlwifi-3160-12 ${PN}-iwlwifi-3160-13 \ + ${PN}-iwlwifi-3160-16 ${PN}-iwlwifi-3160-17 \ + ${PN}-iwlwifi-6000-4 ${PN}-iwlwifi-6000g2a-5 ${PN}-iwlwifi-6000g2a-6 \ + ${PN}-iwlwifi-6000g2b-5 ${PN}-iwlwifi-6000g2b-6 \ + ${PN}-iwlwifi-6050-4 ${PN}-iwlwifi-6050-5 \ + ${PN}-iwlwifi-7260 \ + ${PN}-iwlwifi-7265 \ + ${PN}-iwlwifi-7265d ${PN}-iwlwifi-8000c ${PN}-iwlwifi-8265 \ + ${PN}-iwlwifi-9000 \ + ${PN}-iwlwifi-misc \ + ${PN}-ibt-license ${PN}-ibt \ + ${PN}-ibt-11-5 ${PN}-ibt-12-16 ${PN}-ibt-hw-37-7 ${PN}-ibt-hw-37-8 \ + ${PN}-ibt-17 \ + ${PN}-ibt-20 \ + ${PN}-ibt-misc \ + ${PN}-i915-license ${PN}-i915 \ + ${PN}-ice-license ${PN}-ice \ + ${PN}-adsp-sst-license ${PN}-adsp-sst \ + ${PN}-bnx2-mips \ + ${PN}-liquidio \ + ${PN}-nvidia-license \ + ${PN}-nvidia-tegra-k1 ${PN}-nvidia-tegra \ + ${PN}-nvidia-gpu \ + ${PN}-netronome-license ${PN}-netronome \ + ${PN}-qat ${PN}-qat-license \ + ${PN}-qcom-license \ + ${PN}-qcom-venus-1.8 ${PN}-qcom-venus-4.2 ${PN}-qcom-venus-5.2 ${PN}-qcom-venus-5.4 \ + ${PN}-qcom-vpu-1.0 ${PN}-qcom-vpu-2.0 \ + ${PN}-qcom-adreno-a2xx ${PN}-qcom-adreno-a3xx ${PN}-qcom-adreno-a4xx ${PN}-qcom-adreno-a530 \ + ${PN}-qcom-adreno-a630 ${PN}-qcom-adreno-a650 ${PN}-qcom-adreno-a660 \ + ${PN}-qcom-apq8096-audio ${PN}-qcom-apq8096-modem \ + ${PN}-qcom-sc8280xp-lenovo-x13s-compat \ + ${PN}-qcom-sc8280xp-lenovo-x13s-audio \ + ${PN}-qcom-sc8280xp-lenovo-x13s-adreno \ + ${PN}-qcom-sc8280xp-lenovo-x13s-compute \ + ${PN}-qcom-sc8280xp-lenovo-x13s-sensors \ + ${PN}-qcom-sdm845-audio ${PN}-qcom-sdm845-compute ${PN}-qcom-sdm845-modem \ + ${PN}-qcom-sm8250-audio ${PN}-qcom-sm8250-compute \ + ${PN}-amlogic-vdec-license ${PN}-amlogic-vdec \ + ${PN}-lt9611uxc ${PN}-lontium-license \ + ${PN}-whence-license \ + ${PN}-license \ + " + +# For atheros +LICENSE:${PN}-ar9170 = "Firmware-atheros_firmware" +LICENSE:${PN}-ath3k = "Firmware-atheros_firmware" +LICENSE:${PN}-ath6k = "Firmware-atheros_firmware" +LICENSE:${PN}-ath9k = "Firmware-atheros_firmware" +LICENSE:${PN}-atheros-license = "Firmware-atheros_firmware" + +FILES:${PN}-atheros-license = "${nonarch_base_libdir}/firmware/LICENCE.atheros_firmware" +FILES:${PN}-ar9170 = " \ + ${nonarch_base_libdir}/firmware/ar9170*.fw \ +" +FILES:${PN}-ath3k = " \ + ${nonarch_base_libdir}/firmware/ath3k*fw \ +" +FILES:${PN}-ath6k = " \ + ${nonarch_base_libdir}/firmware/ath6k \ +" +FILES:${PN}-ath9k = " \ + ${nonarch_base_libdir}/firmware/ar9271.fw \ + ${nonarch_base_libdir}/firmware/ar7010*.fw \ + ${nonarch_base_libdir}/firmware/htc_9271.fw \ + ${nonarch_base_libdir}/firmware/htc_7010.fw \ + ${nonarch_base_libdir}/firmware/ath9k_htc/htc_7010-1.4.0.fw \ + ${nonarch_base_libdir}/firmware/ath9k_htc/htc_9271-1.4.0.fw \ +" + +RDEPENDS:${PN}-ar9170 += "${PN}-atheros-license" +RDEPENDS:${PN}-ath6k += "${PN}-atheros-license" +RDEPENDS:${PN}-ath9k += "${PN}-atheros-license" + +# For carl9170 +LICENSE:${PN}-carl9170 = "Firmware-GPLv2" +LICENSE:${PN}-gplv2-license = "Firmware-GPLv2" + +FILES:${PN}-gplv2-license = "${nonarch_base_libdir}/firmware/GPL-2" +FILES:${PN}-carl9170 = " \ + ${nonarch_base_libdir}/firmware/carl9170*.fw \ +" + +RDEPENDS:${PN}-carl9170 += "${PN}-gplv2-license" + +# For QualCommAthos +LICENSE:${PN}-ar3k = "Firmware-qualcommAthos_ar3k & Firmware-atheros_firmware" +LICENSE:${PN}-ar3k-license = "Firmware-qualcommAthos_ar3k" +LICENSE:${PN}-ath10k = "Firmware-qualcommAthos_ath10k" +LICENSE:${PN}-ath10k-license = "Firmware-qualcommAthos_ath10k" +LICENSE:${PN}-qca = "Firmware-qualcommAthos_ath10k" + +FILES:${PN}-ar3k-license = "${nonarch_base_libdir}/firmware/LICENSE.QualcommAtheros_ar3k" +FILES:${PN}-ar3k = " \ + ${nonarch_base_libdir}/firmware/ar3k \ +" + +FILES:${PN}-ath10k-license = "${nonarch_base_libdir}/firmware/LICENSE.QualcommAtheros_ath10k" +FILES:${PN}-ath10k = " \ + ${nonarch_base_libdir}/firmware/ath10k \ +" + +FILES:${PN}-ath11k = " \ + ${nonarch_base_libdir}/firmware/ath11k \ +" + +FILES:${PN}-qca = " \ + ${nonarch_base_libdir}/firmware/qca \ +" + +RDEPENDS:${PN}-ar3k += "${PN}-ar3k-license ${PN}-atheros-license" +RDEPENDS:${PN}-ath10k += "${PN}-ath10k-license" +RDEPENDS:${PN}-ath11k += "${PN}-ath10k-license" +RDEPENDS:${PN}-qca += "${PN}-ath10k-license" + +# For ralink +LICENSE:${PN}-ralink = "Firmware-ralink-firmware" +LICENSE:${PN}-ralink-license = "Firmware-ralink-firmware" + +FILES:${PN}-ralink-license = "${nonarch_base_libdir}/firmware/LICENCE.ralink-firmware.txt" +FILES:${PN}-ralink = " \ + ${nonarch_base_libdir}/firmware/rt*.bin \ +" + +RDEPENDS:${PN}-ralink += "${PN}-ralink-license" + +# For mediatek MT7601U +LICENSE:${PN}-mt7601u = "Firmware-ralink_a_mediatek_company_firmware" +LICENSE:${PN}-mt7601u-license = "Firmware-ralink_a_mediatek_company_firmware" + +FILES:${PN}-mt7601u-license = "${nonarch_base_libdir}/firmware/LICENCE.ralink_a_mediatek_company_firmware" +FILES:${PN}-mt7601u = " \ + ${nonarch_base_libdir}/firmware/mt7601u.bin \ +" + +RDEPENDS:${PN}-mt7601u += "${PN}-mt7601u-license" + +# For radeon +LICENSE:${PN}-radeon = "Firmware-radeon" +LICENSE:${PN}-radeon-license = "Firmware-radeon" + +FILES:${PN}-radeon-license = "${nonarch_base_libdir}/firmware/LICENSE.radeon" +FILES:${PN}-radeon = " \ + ${nonarch_base_libdir}/firmware/radeon \ +" + +RDEPENDS:${PN}-radeon += "${PN}-radeon-license" + +# For amdgpu +LICENSE:${PN}-amdgpu = "Firmware-amdgpu" +LICENSE:${PN}-amdgpu-license = "Firmware-amdgpu" + +FILES:${PN}-amdgpu-license = "${nonarch_base_libdir}/firmware/LICENSE.amdgpu" +FILES:${PN}-amdgpu = " \ + ${nonarch_base_libdir}/firmware/amdgpu \ +" + +RDEPENDS:${PN}-amdgpu += "${PN}-amdgpu-license" + +# For lontium +LICENSE:${PN}-lt9611uxc = "Firmware-Lontium" + +FILES:${PN}-lontium-license = "${nonarch_base_libdir}/firmware/LICENSE.Lontium" +FILES:${PN}-lt9611uxc = "${nonarch_base_libdir}/firmware/lt9611uxc_fw.bin" + +# For marvell +LICENSE:${PN}-pcie8897 = "Firmware-Marvell" +LICENSE:${PN}-pcie8997 = "Firmware-Marvell" +LICENSE:${PN}-sd8686 = "Firmware-Marvell" +LICENSE:${PN}-sd8688 = "Firmware-Marvell" +LICENSE:${PN}-sd8787 = "Firmware-Marvell" +LICENSE:${PN}-sd8797 = "Firmware-Marvell" +LICENSE:${PN}-sd8801 = "Firmware-Marvell" +LICENSE:${PN}-sd8887 = "Firmware-Marvell" +LICENSE:${PN}-sd8897 = "Firmware-Marvell" +LICENSE:${PN}-sd8997 = "Firmware-Marvell" +LICENSE:${PN}-usb8997 = "Firmware-Marvell" +LICENSE:${PN}-marvell-license = "Firmware-Marvell" + +FILES:${PN}-marvell-license = "${nonarch_base_libdir}/firmware/LICENCE.Marvell" +FILES:${PN}-pcie8897 = " \ + ${nonarch_base_libdir}/firmware/mrvl/pcie8897_uapsta.bin \ +" +FILES:${PN}-pcie8997 = " \ + ${nonarch_base_libdir}/firmware/mrvl/pcie8997_wlan_v4.bin \ + ${nonarch_base_libdir}/firmware/mrvl/pcieuart8997_combo_v4.bin \ + ${nonarch_base_libdir}/firmware/mrvl/pcieusb8997_combo_v4.bin \ +" +FILES:${PN}-sd8686 = " \ + ${nonarch_base_libdir}/firmware/libertas/sd8686_v9* \ + ${nonarch_base_libdir}/firmware/sd8686* \ +" +FILES:${PN}-sd8688 = " \ + ${nonarch_base_libdir}/firmware/libertas/sd8688* \ + ${nonarch_base_libdir}/firmware/mrvl/sd8688* \ +" +FILES:${PN}-sd8787 = " \ + ${nonarch_base_libdir}/firmware/mrvl/sd8787_uapsta.bin \ +" +FILES:${PN}-sd8797 = " \ + ${nonarch_base_libdir}/firmware/mrvl/sd8797_uapsta.bin \ +" +FILES:${PN}-sd8801 = " \ + ${nonarch_base_libdir}/firmware/mrvl/sd8801_uapsta.bin \ +" +FILES:${PN}-sd8887 = " \ + ${nonarch_base_libdir}/firmware/mrvl/sd8887_uapsta.bin \ +" +FILES:${PN}-sd8897 = " \ + ${nonarch_base_libdir}/firmware/mrvl/sd8897_uapsta.bin \ +" +do_install:append() { + # The kernel 5.6.x driver still uses the old name, provide a symlink for + # older kernels + ln -fs sdsd8997_combo_v4.bin ${D}${nonarch_base_libdir}/firmware/mrvl/sd8997_uapsta.bin +} +FILES:${PN}-sd8997 = " \ + ${nonarch_base_libdir}/firmware/mrvl/sd8997_uapsta.bin \ + ${nonarch_base_libdir}/firmware/mrvl/sdsd8997_combo_v4.bin \ +" +FILES:${PN}-usb8997 = " \ + ${nonarch_base_libdir}/firmware/mrvl/usbusb8997_combo_v4.bin \ +" + +RDEPENDS:${PN}-sd8686 += "${PN}-marvell-license" +RDEPENDS:${PN}-sd8688 += "${PN}-marvell-license" +RDEPENDS:${PN}-sd8787 += "${PN}-marvell-license" +RDEPENDS:${PN}-sd8797 += "${PN}-marvell-license" +RDEPENDS:${PN}-sd8801 += "${PN}-marvell-license" +RDEPENDS:${PN}-sd8887 += "${PN}-marvell-license" +RDEPENDS:${PN}-sd8897 += "${PN}-marvell-license" +RDEPENDS:${PN}-sd8997 += "${PN}-marvell-license" +RDEPENDS:${PN}-usb8997 += "${PN}-marvell-license" + +# For netronome +LICENSE:${PN}-netronome = "Firmware-netronome" + +FILES:${PN}-netronome-license = " \ + ${nonarch_base_libdir}/firmware/LICENCE.Netronome \ +" +FILES:${PN}-netronome = " \ + ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0081*.nffw \ + ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0096*.nffw \ + ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0097*.nffw \ + ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0099*.nffw \ + ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0058-0011_2x40.nffw \ + ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0058-0012_2x40.nffw \ + ${nonarch_base_libdir}/firmware/netronome/nic_AMDA0078-0011_1x100.nffw \ + ${nonarch_base_libdir}/firmware/netronome/bpf \ + ${nonarch_base_libdir}/firmware/netronome/flower \ + ${nonarch_base_libdir}/firmware/netronome/nic \ + ${nonarch_base_libdir}/firmware/netronome/nic-sriov \ +" + +RDEPENDS:${PN}-netronome += "${PN}-netronome-license" + +# For Nvidia +LICENSE:${PN}-nvidia-gpu = "Firmware-nvidia" +LICENSE:${PN}-nvidia-tegra = "Firmware-nvidia" +LICENSE:${PN}-nvidia-tegra-k1 = "Firmware-nvidia" +LICENSE:${PN}-nvidia-license = "Firmware-nvidia" + +FILES:${PN}-nvidia-gpu = "${nonarch_base_libdir}/firmware/nvidia" +FILES:${PN}-nvidia-tegra = " \ + ${nonarch_base_libdir}/firmware/nvidia/tegra* \ + ${nonarch_base_libdir}/firmware/nvidia/gm20b \ + ${nonarch_base_libdir}/firmware/nvidia/gp10b \ +" +FILES:${PN}-nvidia-tegra-k1 = " \ + ${nonarch_base_libdir}/firmware/nvidia/tegra124 \ + ${nonarch_base_libdir}/firmware/nvidia/gk20a \ +" +FILES:${PN}-nvidia-license = "${nonarch_base_libdir}/firmware/LICENCE.nvidia" + +RDEPENDS:${PN}-nvidia-gpu += "${PN}-nvidia-license" +RDEPENDS:${PN}-nvidia-tegra += "${PN}-nvidia-license" +RDEPENDS:${PN}-nvidia-tegra-k1 += "${PN}-nvidia-license" + +# For RSI RS911x WiFi +LICENSE:${PN}-rs9113 = "WHENCE" +LICENSE:${PN}-rs9116 = "WHENCE" + +FILES:${PN}-rs9113 = " ${nonarch_base_libdir}/firmware/rsi/rs9113*.rps " +FILES:${PN}-rs9116 = " ${nonarch_base_libdir}/firmware/rsi/rs9116*.rps " + +RDEPENDS:${PN}-rs9113 += "${PN}-whence-license" +RDEPENDS:${PN}-rs9116 += "${PN}-whence-license" + +# For rtl +LICENSE:${PN}-rtl8188 = "Firmware-rtlwifi_firmware" +LICENSE:${PN}-rtl8192cu = "Firmware-rtlwifi_firmware" +LICENSE:${PN}-rtl8192ce = "Firmware-rtlwifi_firmware" +LICENSE:${PN}-rtl8192su = "Firmware-rtlwifi_firmware" +LICENSE:${PN}-rtl8723 = "Firmware-rtlwifi_firmware" +LICENSE:${PN}-rtl8761 = "Firmware-rtlwifi_firmware" +LICENSE:${PN}-rtl8821 = "Firmware-rtlwifi_firmware" +LICENSE:${PN}-rtl-license = "Firmware-rtlwifi_firmware" +LICENSE:${PN}-rtl8168 = "WHENCE" + +FILES:${PN}-rtl-license = " \ + ${nonarch_base_libdir}/firmware/LICENCE.rtlwifi_firmware.txt \ +" +FILES:${PN}-rtl8188 = " \ + ${nonarch_base_libdir}/firmware/rtlwifi/rtl8188*.bin \ +" +FILES:${PN}-rtl8192cu = " \ + ${nonarch_base_libdir}/firmware/rtlwifi/rtl8192cufw*.bin \ +" +FILES:${PN}-rtl8192ce = " \ + ${nonarch_base_libdir}/firmware/rtlwifi/rtl8192cfw*.bin \ +" +FILES:${PN}-rtl8192su = " \ + ${nonarch_base_libdir}/firmware/rtlwifi/rtl8712u.bin \ +" +FILES:${PN}-rtl8723 = " \ + ${nonarch_base_libdir}/firmware/rtlwifi/rtl8723*.bin \ +" +FILES:${PN}-rtl8821 = " \ + ${nonarch_base_libdir}/firmware/rtlwifi/rtl8821*.bin \ +" +FILES:${PN}-rtl8761 = " \ + ${nonarch_base_libdir}/firmware/rtl_bt/rtl8761*.bin \ +" +FILES:${PN}-rtl8168 = " \ + ${nonarch_base_libdir}/firmware/rtl_nic/rtl8168*.fw \ +" + +RDEPENDS:${PN}-rtl8188 += "${PN}-rtl-license" +RDEPENDS:${PN}-rtl8192ce += "${PN}-rtl-license" +RDEPENDS:${PN}-rtl8192cu += "${PN}-rtl-license" +RDEPENDS:${PN}-rtl8192su = "${PN}-rtl-license" +RDEPENDS:${PN}-rtl8723 += "${PN}-rtl-license" +RDEPENDS:${PN}-rtl8821 += "${PN}-rtl-license" +RDEPENDS:${PN}-rtl8761 += "${PN}-rtl-license" +RDEPENDS:${PN}-rtl8168 += "${PN}-whence-license" + +# For ti-connectivity +LICENSE:${PN}-wlcommon = "Firmware-ti-connectivity" +LICENSE:${PN}-wl12xx = "Firmware-ti-connectivity" +LICENSE:${PN}-wl18xx = "Firmware-ti-connectivity" +LICENSE:${PN}-ti-connectivity-license = "Firmware-ti-connectivity" + +FILES:${PN}-ti-connectivity-license = "${nonarch_base_libdir}/firmware/LICENCE.ti-connectivity" +# wl18xx optionally needs wl1271-nvs.bin (which itself is a symlink to +# wl127x-nvs.bin) - see linux/drivers/net/wireless/ti/wlcore/sdio.c +# and drivers/net/wireless/ti/wlcore/spi.c. +# While they're optional and actually only used to override the MAC +# address on wl18xx, driver loading will delay (by udev timout - 60s) +# if not there. So let's make it available always. Because it's a +# symlink, both need to go to wlcommon. +FILES:${PN}-wlcommon = " \ + ${nonarch_base_libdir}/firmware/ti-connectivity/TI* \ + ${nonarch_base_libdir}/firmware/ti-connectivity/wl127x-nvs.bin \ + ${nonarch_base_libdir}/firmware/ti-connectivity/wl1271-nvs.bin \ +" +FILES:${PN}-wl12xx = " \ + ${nonarch_base_libdir}/firmware/ti-connectivity/wl12* \ +" +FILES:${PN}-wl18xx = " \ + ${nonarch_base_libdir}/firmware/ti-connectivity/wl18* \ +" + +RDEPENDS:${PN}-wl12xx = "${PN}-ti-connectivity-license ${PN}-wlcommon" +RDEPENDS:${PN}-wl18xx = "${PN}-ti-connectivity-license ${PN}-wlcommon" + +# For vt6656 +LICENSE:${PN}-vt6656 = "Firmware-via_vt6656" +LICENSE:${PN}-vt6656-license = "Firmware-via_vt6656" + +FILES:${PN}-vt6656-license = "${nonarch_base_libdir}/firmware/LICENCE.via_vt6656" +FILES:${PN}-vt6656 = " \ + ${nonarch_base_libdir}/firmware/vntwusb.fw \ +" + +RDEPENDS:${PN}-vt6656 = "${PN}-vt6656-license" + +# For broadcom + +# for i in `grep brcm WHENCE | grep ^File | sed 's/File: brcm.//g'`; do pkg=`echo $i | sed 's/-[sp40].*//g; s/\.bin//g; s/brcmfmac/bcm/g; s/_hdr/-hdr/g; s/BCM/bcm-0bb4-0306/g'`; echo -e " \${PN}-$pkg \\"; done | sort -u + +LICENSE:${PN}-broadcom-license = "Firmware-broadcom_bcm43xx" +FILES:${PN}-broadcom-license = "${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx" + +# for i in `grep brcm WHENCE | grep ^File | sed 's/File: brcm.//g'`; do pkg=`echo $i | sed 's/-[sp40].*//g; s/\.bin//g; s/brcmfmac/bcm/g; s/_hdr/-hdr/g; s/BCM/bcm-0bb4-0306/g'`; echo "$i - $pkg"; echo -e "FILES:\${PN}-$pkg = \"\${nonarch_base_libdir}/firmware/brcm/$i\""; done | grep ^FILES + +FILES:${PN}-bcm43xx = "${nonarch_base_libdir}/firmware/brcm/bcm43xx-0.fw" +FILES:${PN}-bcm43xx-hdr = "${nonarch_base_libdir}/firmware/brcm/bcm43xx_hdr-0.fw" +FILES:${PN}-bcm4329-fullmac = "${nonarch_base_libdir}/firmware/brcm/bcm4329-fullmac-4.bin" +FILES:${PN}-bcm43236b = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43236b.bin" +FILES:${PN}-bcm4329 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4329-sdio.bin" +FILES:${PN}-bcm4330 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4330-sdio.*" +FILES:${PN}-bcm4334 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4334-sdio.bin" +FILES:${PN}-bcm4335 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4335-sdio.bin" +FILES:${PN}-bcm4339 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4339-sdio.bin \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac4339-sdio.bin \ +" +FILES:${PN}-bcm43241b0 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b0-sdio.bin" +FILES:${PN}-bcm43241b4 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b4-sdio.bin" +FILES:${PN}-bcm43241b5 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43241b5-sdio.bin" +FILES:${PN}-bcm43242a = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43242a.bin" +FILES:${PN}-bcm43143 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43143.bin \ + ${nonarch_base_libdir}/firmware/brcm/brcmfmac43143-sdio.bin \ +" +FILES:${PN}-bcm43430a0 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430a0-sdio.*" +FILES:${PN}-bcm43455 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.* \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac43455-sdio.* \ +" +FILES:${PN}-bcm4350c2 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4350c2-pcie.bin" +FILES:${PN}-bcm4350 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4350-pcie.bin" +FILES:${PN}-bcm4356 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-sdio.* \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac4356-sdio.* \ +" +FILES:${PN}-bcm43569 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43569.bin" +FILES:${PN}-bcm43570 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43570-pcie.bin \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac43570-pcie.bin \ +" +FILES:${PN}-bcm4358 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4358-pcie.bin" +FILES:${PN}-bcm43602 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43602-pcie.bin \ + ${nonarch_base_libdir}/firmware/brcm/brcmfmac43602-pcie.ap.bin \ +" +FILES:${PN}-bcm4366b = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4366b-pcie.bin" +FILES:${PN}-bcm4366c = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4366c-pcie.bin" +FILES:${PN}-bcm4371 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4371-pcie.bin" + +# for i in `grep brcm WHENCE | grep ^File | sed 's/File: brcm.//g'`; do pkg=`echo $i | sed 's/-[sp40].*//g; s/\.bin//g; s/brcmfmac/bcm/g; s/_hdr/-hdr/g; s/BCM/bcm-0bb4-0306/g'`; echo -e "LICENSE:\${PN}-$pkg = \"Firmware-broadcom_bcm43xx\"\nRDEPENDS_\${PN}-$pkg += \"\${PN}-broadcom-license\""; done +# Currently 1st one and last 6 have cypress LICENSE + +LICENSE:${PN}-bcm43xx = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43xx += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43xx-hdr = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43xx-hdr += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4329-fullmac = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4329-fullmac += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43236b = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43236b += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4329 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4329 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4330 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4330 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4334 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4334 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4335 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4335 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4339 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4339 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43241b0 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43241b0 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43241b4 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43241b4 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43241b5 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43241b5 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43242a = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43242a += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43143 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43143 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43430a0 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43430a0 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43455 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43455 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4350c2 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4350c2 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4350 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4350 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4356 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4356 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43569 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43569 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43570 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43570 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4358 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4358 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm43602 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm43602 += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4366b = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4366b += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4366c = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4366c += "${PN}-broadcom-license" +LICENSE:${PN}-bcm4371 = "Firmware-broadcom_bcm43xx" +RDEPENDS:${PN}-bcm4371 += "${PN}-broadcom-license" + +# For broadcom cypress + +LICENSE:${PN}-cypress-license = "Firmware-cypress" +FILES:${PN}-cypress-license = "${nonarch_base_libdir}/firmware/LICENCE.cypress" + +FILES:${PN}-bcm-0bb4-0306 = "${nonarch_base_libdir}/firmware/brcm/BCM-0bb4-0306.hcd" +FILES:${PN}-bcm43340 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43340-sdio.* \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac43340-sdio.*" +FILES:${PN}-bcm43362 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43362-sdio.* \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac43362-sdio.*" +FILES:${PN}-bcm43430 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.* \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac43430-sdio.*" +FILES:${PN}-bcm4354 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4354-sdio.bin \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac4354-sdio.bin \ +" +FILES:${PN}-bcm4356-pcie = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4356-pcie.* \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac4356-pcie.* \ +" +FILES:${PN}-bcm4373 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.bin \ + ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373.bin \ + ${nonarch_base_libdir}/firmware/cypress/cyfmac4373-sdio.bin \ + ${nonarch_base_libdir}/firmware/brcm/brcmfmac4373-sdio.clm_blob \ +" + +LICENSE:${PN}-bcm-0bb4-0306 = "Firmware-cypress" +RDEPENDS:${PN}-bcm-0bb4-0306 += "${PN}-cypress-license" +LICENSE:${PN}-bcm43340 = "Firmware-cypress" +RDEPENDS:${PN}-bcm43340 += "${PN}-cypress-license" +LICENSE:${PN}-bcm43362 = "Firmware-cypress" +RDEPENDS:${PN}-bcm43362 += "${PN}-cypress-license" +LICENSE:${PN}-bcm43430 = "Firmware-cypress" +RDEPENDS:${PN}-bcm43430 += "${PN}-cypress-license" +LICENSE:${PN}-bcm4354 = "Firmware-cypress" +RDEPENDS:${PN}-bcm4354 += "${PN}-cypress-license" +LICENSE:${PN}-bcm4356-pcie = "Firmware-cypress" +RDEPENDS:${PN}-bcm4356-pcie += "${PN}-cypress-license" +LICENSE:${PN}-bcm4373 = "Firmware-cypress" +RDEPENDS:${PN}-bcm4373 += "${PN}-cypress-license" + +# For Broadcom bnx2-mips +# +# which is a separate case to the other Broadcom firmwares since its +# license is contained in the shared WHENCE file. + +LICENSE:${PN}-bnx2-mips = "WHENCE" +LICENSE:${PN}-whence-license = "WHENCE" + +FILES:${PN}-bnx2-mips = "${nonarch_base_libdir}/firmware/bnx2/bnx2-mips-09-6.2.1b.fw" +FILES:${PN}-whence-license = "${nonarch_base_libdir}/firmware/WHENCE" + +RDEPENDS:${PN}-bnx2-mips += "${PN}-whence-license" + +# For imx-sdma +LICENSE:${PN}-imx-sdma-imx6q = "Firmware-imx-sdma_firmware" +LICENSE:${PN}-imx-sdma-imx7d = "Firmware-imx-sdma_firmware" +LICENSE:${PN}-imx-sdma-license = "Firmware-imx-sdma_firmware" + +FILES:${PN}-imx-sdma-imx6q = "${nonarch_base_libdir}/firmware/imx/sdma/sdma-imx6q.bin" + +RPROVIDES:${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q" +RREPLACES:${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q" +RCONFLICTS:${PN}-imx-sdma-imx6q = "firmware-imx-sdma-imx6q" + +FILES:${PN}-imx-sdma-imx7d = "${nonarch_base_libdir}/firmware/imx/sdma/sdma-imx7d.bin" + +FILES:${PN}-imx-sdma-license = "${nonarch_base_libdir}/firmware/LICENSE.sdma_firmware" + +RDEPENDS:${PN}-imx-sdma-imx6q += "${PN}-imx-sdma-license" +RDEPENDS:${PN}-imx-sdma-imx7d += "${PN}-imx-sdma-license" + +# For iwlwifi +LICENSE:${PN}-iwlwifi = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-135-6 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-3160-7 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-3160-8 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-3160-9 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-3160-10 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-3160-12 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-3160-13 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-3160-16 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-3160-17 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-6000-4 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-6000g2a-5 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-6000g2a-6 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-6000g2b-5 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-6000g2b-6 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-6050-4 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-6050-5 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-7260 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-7265 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-7265d = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-8000c = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-8265 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-9000 = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-misc = "Firmware-iwlwifi_firmware" +LICENSE:${PN}-iwlwifi-license = "Firmware-iwlwifi_firmware" + + +FILES:${PN}-iwlwifi-license = "${nonarch_base_libdir}/firmware/LICENCE.iwlwifi_firmware" +FILES:${PN}-iwlwifi-135-6 = "${nonarch_base_libdir}/firmware/iwlwifi-135-6.ucode" +FILES:${PN}-iwlwifi-3160-7 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-7.ucode" +FILES:${PN}-iwlwifi-3160-8 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-8.ucode" +FILES:${PN}-iwlwifi-3160-9 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-9.ucode" +FILES:${PN}-iwlwifi-3160-10 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-10.ucode" +FILES:${PN}-iwlwifi-3160-12 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-12.ucode" +FILES:${PN}-iwlwifi-3160-13 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-13.ucode" +FILES:${PN}-iwlwifi-3160-16 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-16.ucode" +FILES:${PN}-iwlwifi-3160-17 = "${nonarch_base_libdir}/firmware/iwlwifi-3160-17.ucode" +FILES:${PN}-iwlwifi-6000-4 = "${nonarch_base_libdir}/firmware/iwlwifi-6000-4.ucode" +FILES:${PN}-iwlwifi-6000g2a-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2a-5.ucode" +FILES:${PN}-iwlwifi-6000g2a-6 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2a-6.ucode" +FILES:${PN}-iwlwifi-6000g2b-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2b-5.ucode" +FILES:${PN}-iwlwifi-6000g2b-6 = "${nonarch_base_libdir}/firmware/iwlwifi-6000g2b-6.ucode" +FILES:${PN}-iwlwifi-6050-4 = "${nonarch_base_libdir}/firmware/iwlwifi-6050-4.ucode" +FILES:${PN}-iwlwifi-6050-5 = "${nonarch_base_libdir}/firmware/iwlwifi-6050-5.ucode" +FILES:${PN}-iwlwifi-7260 = "${nonarch_base_libdir}/firmware/iwlwifi-7260-*.ucode" +FILES:${PN}-iwlwifi-7265 = "${nonarch_base_libdir}/firmware/iwlwifi-7265-*.ucode" +FILES:${PN}-iwlwifi-7265d = "${nonarch_base_libdir}/firmware/iwlwifi-7265D-*.ucode" +FILES:${PN}-iwlwifi-8000c = "${nonarch_base_libdir}/firmware/iwlwifi-8000C-*.ucode" +FILES:${PN}-iwlwifi-8265 = "${nonarch_base_libdir}/firmware/iwlwifi-8265-*.ucode" +FILES:${PN}-iwlwifi-9000 = "${nonarch_base_libdir}/firmware/iwlwifi-9000-*.ucode" +FILES:${PN}-iwlwifi-misc = "${nonarch_base_libdir}/firmware/iwlwifi-*.ucode" + +RDEPENDS:${PN}-iwlwifi-135-6 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-3160-7 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-3160-8 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-3160-9 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-3160-10 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-3160-12 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-3160-13 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-3160-16 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-3160-17 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-6000-4 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-6000g2a-5 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-6000g2a-6 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-6000g2b-5 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-6000g2b-6 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-6050-4 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-6050-5 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-7260 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-7265 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-7265d = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-8000c = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-8265 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-9000 = "${PN}-iwlwifi-license" +RDEPENDS:${PN}-iwlwifi-misc = "${PN}-iwlwifi-license" + +# -iwlwifi-misc is a "catch all" package that includes all the iwlwifi +# firmwares that are not already included in other -iwlwifi- packages. +# -iwlwifi is a virtual package that depends upon all iwlwifi packages. +# These are distinct in order to allow the -misc firmwares to be installed +# without pulling in every other iwlwifi package. +ALLOW_EMPTY:${PN}-iwlwifi = "1" +ALLOW_EMPTY:${PN}-iwlwifi-misc = "1" + +# Handle package updating for the newly merged iwlwifi groupings +RPROVIDES:${PN}-iwlwifi-7265 = "${PN}-iwlwifi-7265-8 ${PN}-iwlwifi-7265-9" +RREPLACES:${PN}-iwlwifi-7265 = "${PN}-iwlwifi-7265-8 ${PN}-iwlwifi-7265-9" +RCONFLICTS:${PN}-iwlwifi-7265 = "${PN}-iwlwifi-7265-8 ${PN}-iwlwifi-7265-9" + +RPROVIDES:${PN}-iwlwifi-7260 = "${PN}-iwlwifi-7260-7 ${PN}-iwlwifi-7260-8 ${PN}-iwlwifi-7260-9" +RREPLACES:${PN}-iwlwifi-7260 = "${PN}-iwlwifi-7260-7 ${PN}-iwlwifi-7260-8 ${PN}-iwlwifi-7260-9" +RCONFLICTS:${PN}-iwlwifi-7260 = "${PN}-iwlwifi-7260-7 ${PN}-iwlwifi-7260-8 ${PN}-iwlwifi-7260-9" + +# For ibt +LICENSE:${PN}-ibt-license = "Firmware-ibt_firmware" +LICENSE:${PN}-ibt-hw-37-7 = "Firmware-ibt_firmware" +LICENSE:${PN}-ibt-hw-37-8 = "Firmware-ibt_firmware" +LICENSE:${PN}-ibt-11-5 = "Firmware-ibt_firmware" +LICENSE:${PN}-ibt-12-16 = "Firmware-ibt_firmware" +LICENSE:${PN}-ibt-17 = "Firmware-ibt_firmware" +LICENSE:${PN}-ibt-20 = "Firmware-ibt_firmware" +LICENSE:${PN}-ibt-misc = "Firmware-ibt_firmware" + +FILES:${PN}-ibt-license = "${nonarch_base_libdir}/firmware/LICENCE.ibt_firmware" +FILES:${PN}-ibt-hw-37-7 = "${nonarch_base_libdir}/firmware/intel/ibt-hw-37.7*.bseq" +FILES:${PN}-ibt-hw-37-8 = "${nonarch_base_libdir}/firmware/intel/ibt-hw-37.8*.bseq" +FILES:${PN}-ibt-11-5 = "${nonarch_base_libdir}/firmware/intel/ibt-11-5.sfi ${nonarch_base_libdir}/firmware/intel/ibt-11-5.ddc" +FILES:${PN}-ibt-12-16 = "${nonarch_base_libdir}/firmware/intel/ibt-12-16.sfi ${nonarch_base_libdir}/firmware/intel/ibt-12-16.ddc" +FILES:${PN}-ibt-17 = "${nonarch_base_libdir}/firmware/intel/ibt-17-*.sfi ${nonarch_base_libdir}/firmware/intel/ibt-17-*.ddc" +FILES:${PN}-ibt-20 = "${nonarch_base_libdir}/firmware/intel/ibt-20-*.sfi ${nonarch_base_libdir}/firmware/intel/ibt-20-*.ddc" +FILES:${PN}-ibt-misc = "${nonarch_base_libdir}/firmware/intel/ibt-*" + +RDEPENDS:${PN}-ibt-hw-37-7 = "${PN}-ibt-license" +RDEPENDS:${PN}-ibt-hw-37.8 = "${PN}-ibt-license" +RDEPENDS:${PN}-ibt-11-5 = "${PN}-ibt-license" +RDEPENDS:${PN}-ibt-12-16 = "${PN}-ibt-license" +RDEPENDS:${PN}-ibt-17 = "${PN}-ibt-license" +RDEPENDS:${PN}-ibt-20 = "${PN}-ibt-license" +RDEPENDS:${PN}-ibt-misc = "${PN}-ibt-license" + +ALLOW_EMPTY:${PN}-ibt= "1" +ALLOW_EMPTY:${PN}-ibt-misc = "1" + +LICENSE:${PN}-i915 = "Firmware-i915" +LICENSE:${PN}-i915-license = "Firmware-i915" +FILES:${PN}-i915-license = "${nonarch_base_libdir}/firmware/LICENSE.i915" +FILES:${PN}-i915 = "${nonarch_base_libdir}/firmware/i915" +RDEPENDS:${PN}-i915 = "${PN}-i915-license" + +LICENSE:${PN}-ice = "Firmware-ice" +LICENSE:${PN}-ice-license = "Firmware-ice" +FILES:${PN}-ice-license = "${nonarch_base_libdir}/firmware/LICENSE.ice" +FILES:${PN}-ice = "${nonarch_base_libdir}/firmware/intel/ice" +RDEPENDS:${PN}-ice = "${PN}-ice-license" + +FILES:${PN}-adsp-sst-license = "${nonarch_base_libdir}/firmware/LICENCE.adsp_sst" +LICENSE:${PN}-adsp-sst = "Firmware-adsp_sst" +LICENSE:${PN}-adsp-sst-license = "Firmware-adsp_sst" +FILES:${PN}-adsp-sst = "${nonarch_base_libdir}/firmware/intel/dsp_fw*" +RDEPENDS:${PN}-adsp-sst = "${PN}-adsp-sst-license" + +# For QAT +LICENSE:${PN}-qat = "Firmware-qat" +LICENSE:${PN}-qat-license = "Firmware-qat" +FILES:${PN}-qat-license = "${nonarch_base_libdir}/firmware/LICENCE.qat_firmware" +FILES:${PN}-qat = "${nonarch_base_libdir}/firmware/qat*.bin" +RDEPENDS:${PN}-qat = "${PN}-qat-license" + +# For QCOM VPU/GPU and SDM845 +LICENSE:${PN}-qcom-license = "Firmware-qcom" +FILES:${PN}-qcom-license = "${nonarch_base_libdir}/firmware/LICENSE.qcom ${nonarch_base_libdir}/firmware/qcom/NOTICE.txt" +FILES:${PN}-qcom-venus-1.8 = "${nonarch_base_libdir}/firmware/qcom/venus-1.8/*" +FILES:${PN}-qcom-venus-4.2 = "${nonarch_base_libdir}/firmware/qcom/venus-4.2/*" +FILES:${PN}-qcom-venus-5.2 = "${nonarch_base_libdir}/firmware/qcom/venus-5.2/*" +FILES:${PN}-qcom-venus-5.4 = "${nonarch_base_libdir}/firmware/qcom/venus-5.4/*" +FILES:${PN}-qcom-vpu-1.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-1.0/*" +FILES:${PN}-qcom-vpu-2.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-2.0/*" +FILES:${PN}-qcom-adreno-a2xx = "${nonarch_base_libdir}/firmware/qcom/leia_*.fw" +FILES:${PN}-qcom-adreno-a3xx = "${nonarch_base_libdir}/firmware/qcom/a3*_*.fw ${nonarch_base_libdir}/firmware/a300_*.fw" +FILES:${PN}-qcom-adreno-a4xx = "${nonarch_base_libdir}/firmware/qcom/a4*_*.fw" +FILES:${PN}-qcom-adreno-a530 = "${nonarch_base_libdir}/firmware/qcom/a530*.* ${nonarch_base_libdir}/firmware/qcom/apq8096/a530*.*" +FILES:${PN}-qcom-adreno-a630 = "${nonarch_base_libdir}/firmware/qcom/a630*.* ${nonarch_base_libdir}/firmware/qcom/sdm845/a630*.*" +FILES:${PN}-qcom-adreno-a650 = "${nonarch_base_libdir}/firmware/qcom/a650*.* ${nonarch_base_libdir}/firmware/qcom/sm8250/a650*.*" +FILES:${PN}-qcom-adreno-a660 = "${nonarch_base_libdir}/firmware/qcom/a660*.*" +FILES:${PN}-qcom-apq8096-audio = "${nonarch_base_libdir}/firmware/qcom/apq8096/adsp*.*" +FILES:${PN}-qcom-apq8096-modem = "${nonarch_base_libdir}/firmware/qcom/apq8096/mba.mbn ${nonarch_base_libdir}/firmware/qcom/apq8096/modem*.* ${nonarch_base_libdir}/firmware/qcom/apq8096/wlanmdsp.mbn" +FILES:${PN}-qcom-sc8280xp-lenovo-x13s-compat = "${nonarch_base_libdir}/firmware/qcom/LENOVO/21BX" +FILES:${PN}-qcom-sc8280xp-lenovo-x13s-audio = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/*adsp*.* ${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/battmgr.jsn" +FILES:${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/qcdxkmsuc8280.mbn" +FILES:${PN}-qcom-sc8280xp-lenovo-x13s-compute = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/*cdsp*.*" +FILES:${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/*slpi*.*" +FILES:${PN}-qcom-sdm845-audio = "${nonarch_base_libdir}/firmware/qcom/sdm845/adsp*.*" +FILES:${PN}-qcom-sdm845-compute = "${nonarch_base_libdir}/firmware/qcom/sdm845/cdsp*.*" +FILES:${PN}-qcom-sdm845-modem = "${nonarch_base_libdir}/firmware/qcom/sdm845/mba.mbn ${nonarch_base_libdir}/firmware/qcom/sdm845/modem*.* ${nonarch_base_libdir}/firmware/qcom/sdm845/wlanmdsp.mbn" +FILES:${PN}-qcom-sm8250-audio = "${nonarch_base_libdir}/firmware/qcom/sm8250/adsp*.*" +FILES:${PN}-qcom-sm8250-compute = "${nonarch_base_libdir}/firmware/qcom/sm8250/cdsp*.*" +RDEPENDS:${PN}-qcom-venus-1.8 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-venus-4.2 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-venus-5.2 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-venus-5.4 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-vpu-1.0 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-vpu-2.0 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-adreno-a2xx = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-adreno-a3xx = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-adreno-a4xx = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-adreno-a530 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-adreno-a630 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-adreno-a650 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-adreno-a660 = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-apq8096-audio = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-apq8096-modem = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sc8280xp-lenovo-x13s-audio = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sc8280xp-lenovo-x13s-compute = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sdm845-audio = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sdm845-compute = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sdm845-modem = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sm8250-audio = "${PN}-qcom-license" +RDEPENDS:${PN}-qcom-sm8250-compute = "${PN}-qcom-license" + +RRECOMMENDS:${PN}-qcom-sc8280xp-lenovo-x13s-audio = "${PN}-qcom-sc8280xp-lenovo-x13s-compat" +RRECOMMENDS:${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "${PN}-qcom-sc8280xp-lenovo-x13s-compat" +RRECOMMENDS:${PN}-qcom-sc8280xp-lenovo-x13s-compute = "${PN}-qcom-sc8280xp-lenovo-x13s-compat" +RRECOMMENDS:${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "${PN}-qcom-sc8280xp-lenovo-x13s-compat" + +FILES:${PN}-liquidio = "${nonarch_base_libdir}/firmware/liquidio" + +# For Amlogic VDEC +LICENSE:${PN}-amlogic-vdec = "Firmware-amlogic_vdec" +FILES:${PN}-amlogic-vdec-license = "${nonarch_base_libdir}/firmware/LICENSE.amlogic_vdec" +FILES:${PN}-amlogic-vdec = "${nonarch_base_libdir}/firmware/meson/vdec/*" +RDEPENDS:${PN}-amlogic-vdec = "${PN}-amlogic-vdec-license" + +# For other firmwares +# Maybe split out to separate packages when needed. +LICENSE:${PN} = "\ + Firmware-Abilis \ + & Firmware-agere \ + & Firmware-amdgpu \ + & Firmware-amd-ucode \ + & Firmware-amlogic_vdec \ + & Firmware-atmel \ + & Firmware-ca0132 \ + & Firmware-cavium \ + & Firmware-chelsio_firmware \ + & Firmware-cw1200 \ + & Firmware-dib0700 \ + & Firmware-e100 \ + & Firmware-ene_firmware \ + & Firmware-fw_sst_0f28 \ + & Firmware-go7007 \ + & Firmware-hfi1_firmware \ + & Firmware-ibt_firmware \ + & Firmware-it913x \ + & Firmware-IntcSST2 \ + & Firmware-kaweth \ + & Firmware-moxa \ + & Firmware-myri10ge_firmware \ + & Firmware-nvidia \ + & Firmware-OLPC \ + & Firmware-ath9k-htc \ + & Firmware-phanfw \ + & Firmware-qat \ + & Firmware-qcom \ + & Firmware-qla1280 \ + & Firmware-qla2xxx \ + & Firmware-r8a779x_usb3 \ + & Firmware-radeon \ + & Firmware-ralink_a_mediatek_company_firmware \ + & Firmware-ralink-firmware \ + & Firmware-imx-sdma_firmware \ + & Firmware-siano \ + & Firmware-ti-connectivity \ + & Firmware-ti-keystone \ + & Firmware-ueagle-atm4-firmware \ + & Firmware-wl1251 \ + & Firmware-xc4000 \ + & Firmware-xc5000 \ + & Firmware-xc5000c \ + & WHENCE \ +" + +FILES:${PN}-license += "${nonarch_base_libdir}/firmware/LICEN*" +FILES:${PN} += "${nonarch_base_libdir}/firmware/*" +RDEPENDS:${PN} += "${PN}-license" +RDEPENDS:${PN} += "${PN}-whence-license" + +# Make linux-firmware depend on all of the split-out packages. +# Make linux-firmware-iwlwifi depend on all of the split-out iwlwifi packages. +# Make linux-firmware-ibt depend on all of the split-out ibt packages. +python populate_packages:prepend () { + firmware_pkgs = oe.utils.packages_filter_out_system(d) + d.appendVar('RRECOMMENDS:linux-firmware', ' ' + ' '.join(firmware_pkgs)) + + iwlwifi_pkgs = filter(lambda x: x.find('-iwlwifi-') != -1, firmware_pkgs) + d.appendVar('RRECOMMENDS:linux-firmware-iwlwifi', ' ' + ' '.join(iwlwifi_pkgs)) + + ibt_pkgs = filter(lambda x: x.find('-ibt-') != -1, firmware_pkgs) + d.appendVar('RRECOMMENDS:linux-firmware-ibt', ' ' + ' '.join(ibt_pkgs)) +} + +# Firmware files are generally not ran on the CPU, so they can be +# allarch despite being architecture specific +INSANE_SKIP = "arch" + +# Don't warn about already stripped files +INSANE_SKIP:${PN} = "already-stripped" + +# No need to put firmware into the sysroot +SYSROOT_DIRS_IGNORE += "${nonarch_base_libdir}/firmware" diff --git a/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc b/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc index 71778bb4e3..3a8d32e785 100644 --- a/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc +++ b/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers.inc @@ -44,6 +44,8 @@ python __anonymous () { d.setVar("HEADER_FETCH_VER", "4.x") elif major == "5": d.setVar("HEADER_FETCH_VER", "5.x") + elif major == "6": + d.setVar("HEADER_FETCH_VER", "6.x") else: d.setVar("HEADER_FETCH_VER", "2.6") } diff --git a/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch b/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch deleted file mode 100644 index a5ded602e5..0000000000 --- a/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 694eba7bb974f6b8bd308804cb24350150108b2b Mon Sep 17 00:00:00 2001 -From: He Zhe -Date: Wed, 21 Nov 2018 15:12:43 +0800 -Subject: [PATCH] scripts: Use fixed input and output files instead of pipe for here-doc - -There was a bug of "as" in binutils that when it checks if the input file and -output file are the same one, it would not check if they are on the same block -device. The check is introduced by the following commit in v2.31. - -https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h= -67f846b59b32f3d704c601669409c2584383fea9 - -The here-doc usage in this script creates temporary file in /tmp. When we run in -an environment where /tmp has rarely been used, the newly created temporary file -may have a very low inode number. If the inode number was 6 which is the same as -/dev/null, the as would wrongly think the input file and the output file are the -same and report the following error. - -*** Compiler lacks asm-goto support.. Stop. - -One observed case happened in docker where the /tmp could be so rarely used that -very low number inode may be allocated and triggers the error. - -The fix below for the bug only exists on the master branch of binutils so far -and has not been released from upstream. As the convict is introduced since -v2.31, only v2.31 is affected. - -https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h= -2a50366ded329bfb39d387253450c9d5302c3503 - -When building linux-libc-headers we need to use "as" in binutils which does not -contain the fix for the moment. To work around the error, we create a fixed -temporary file to contain the program being tested. - -This patch also removes ">/dev/null 2>&1" so we will have more direct error -information in case something else wrong happened. - -Upstream-Status: Inappropriate [A work around for binutils v2.31] - -Signed-off-by: He Zhe ---- - scripts/gcc-goto.sh | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh -index 8b980fb22..d256a9438 100755 ---- a/scripts/gcc-goto.sh -+++ b/scripts/gcc-goto.sh -@@ -3,7 +3,7 @@ - # Test for gcc 'asm goto' support - # Copyright (C) 2010, Jason Baron - --cat << "END" | $@ -x c - -fno-PIE -c -o /dev/null -+cat << "END" > ./input - int main(void) - { - #if defined(__arm__) || defined(__aarch64__) -@@ -20,3 +20,6 @@ entry: - return 0; - } - END -+ -+$@ -x c ./input -fno-PIE -c -o ./output -+rm ./input ./output --- -2.19.1 - diff --git a/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_5.19.bb b/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_5.19.bb deleted file mode 100644 index 3557526d14..0000000000 --- a/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_5.19.bb +++ /dev/null @@ -1,20 +0,0 @@ -require linux-libc-headers.inc - -SRC_URI:append:libc-musl = "\ - file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \ - file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \ - file://0001-libc-compat.h-musl-_does_-define-IFF_LOWER_UP-DORMAN.patch \ - file://0001-include-linux-stddef.h-in-swab.h-uapi-header.patch \ - " - -SRC_URI += "\ - file://0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch \ - file://0001-kbuild-install_headers.sh-Strip-_UAPI-from-if-define.patch \ -" - -LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" - -SRC_URI[md5sum] = "f91bfe133d2cb1692f705947282e123a" -SRC_URI[sha256sum] = "ff240c579b9ee1affc318917de07394fc1c3bb49dac25ec1287370c2e15005a8" - - diff --git a/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_6.1.bb b/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_6.1.bb new file mode 100644 index 0000000000..cbdebdc1e8 --- /dev/null +++ b/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_6.1.bb @@ -0,0 +1,18 @@ +require linux-libc-headers.inc + +SRC_URI:append:libc-musl = "\ + file://0001-libc-compat.h-fix-some-issues-arising-from-in6.h.patch \ + file://0003-remove-inclusion-of-sysinfo.h-in-kernel.h.patch \ + file://0001-libc-compat.h-musl-_does_-define-IFF_LOWER_UP-DORMAN.patch \ + file://0001-include-linux-stddef.h-in-swab.h-uapi-header.patch \ + " + +SRC_URI += "\ + file://0001-kbuild-install_headers.sh-Strip-_UAPI-from-if-define.patch \ +" + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + +SRC_URI[sha256sum] = "2ca1f17051a430f6fed1196e4952717507171acfd97d96577212502703b25deb" + + diff --git a/poky/meta/recipes-kernel/linux/kernel-devsrc.bb b/poky/meta/recipes-kernel/linux/kernel-devsrc.bb index 46d706b955..253b8d307d 100644 --- a/poky/meta/recipes-kernel/linux/kernel-devsrc.bb +++ b/poky/meta/recipes-kernel/linux/kernel-devsrc.bb @@ -145,6 +145,9 @@ do_install() { cp -a scripts $kerneldir/build + # for v6.1+ (otherwise we are missing multiple default targets) + cp -a --parents Kbuild $kerneldir/build 2>/dev/null || : + # if our build dir had objtool, it will also be rebuilt on target, so # we copy what is required for that build if [ -f ${B}/tools/objtool/objtool ]; then @@ -171,6 +174,9 @@ do_install() { # arch/arm64/include/asm/opcodes.h references arch/arm cp -a --parents arch/arm/include/asm/opcodes.h $kerneldir/build/ + # v6.1+ + cp -a --parents arch/arm64/kernel/asm-offsets.c $kerneldir/build/ + cp -a --parents arch/arm64/kernel/vdso/*gettimeofday.* $kerneldir/build/ cp -a --parents arch/arm64/kernel/vdso/sigreturn.S $kerneldir/build/ cp -a --parents arch/arm64/kernel/vdso/note.S $kerneldir/build/ @@ -206,6 +212,9 @@ do_install() { cp -a --parents arch/powerpc/kernel/vdso/*.S $kerneldir/build 2>/dev/null || : cp -a --parents arch/powerpc/kernel/vdso/*gettimeofday.* $kerneldir/build 2>/dev/null || : cp -a --parents arch/powerpc/kernel/vdso/gen_vdso*_offsets.sh $kerneldir/build/ 2>/dev/null || : + + # v6,1+ + cp -a --parents arch/powerpc/kernel/asm-offsets.c $kerneldir/build/ 2>/dev/null || : fi if [ "${ARCH}" = "riscv" ]; then cp -a --parents arch/riscv/kernel/vdso/*gettimeofday.* $kerneldir/build/ @@ -234,6 +243,9 @@ do_install() { fi cp -a --parents arch/arm/kernel/module.lds $kerneldir/build/ 2>/dev/null || : + # v6.1+ + cp -a --parents arch/arm/kernel/asm-offsets.c $kerneldir/build/ 2>/dev/null || : + cp -a --parents arch/arm/kernel/signal.h $kerneldir/build/ 2>/dev/null || : fi if [ -d arch/${ARCH}/include ]; then @@ -282,15 +294,24 @@ do_install() { # objtool requires these files cp -a --parents arch/x86/lib/inat.c $kerneldir/build/ 2>/dev/null || : cp -a --parents arch/x86/lib/insn.c $kerneldir/build/ 2>/dev/null || : + + # v6.1+ + cp -a --parents arch/x86/kernel/asm-offsets* $kerneldir/build || : + # for capabilities.h, vmx.h + cp -a --parents arch/x86/kvm/vmx/*.h $kerneldir/build || : + # for lapic.h, hyperv.h .... + cp -a --parents arch/x86/kvm/*.h $kerneldir/build || : fi + # moved from arch/mips to all arches for v6.1+ + cp -a --parents kernel/time/timeconst.bc $kerneldir/build 2>/dev/null || : + cp -a --parents kernel/bounds.c $kerneldir/build 2>/dev/null || : + if [ "${ARCH}" = "mips" ]; then cp -a --parents arch/mips/Kbuild.platforms $kerneldir/build/ cp --parents $(find -type f -name "Platform") $kerneldir/build cp --parents arch/mips/boot/tools/relocs* $kerneldir/build cp -a --parents arch/mips/kernel/asm-offsets.c $kerneldir/build - cp -a --parents kernel/time/timeconst.bc $kerneldir/build - cp -a --parents kernel/bounds.c $kerneldir/build cp -a --parents Kbuild $kerneldir/build cp -a --parents arch/mips/kernel/syscalls/*.sh $kerneldir/build 2>/dev/null || : cp -a --parents arch/mips/kernel/syscalls/*.tbl $kerneldir/build 2>/dev/null || : diff --git a/poky/meta/recipes-kernel/linux/linux-yocto-dev.bb b/poky/meta/recipes-kernel/linux/linux-yocto-dev.bb index aeb04f59e8..8671b3d30d 100644 --- a/poky/meta/recipes-kernel/linux/linux-yocto-dev.bb +++ b/poky/meta/recipes-kernel/linux/linux-yocto-dev.bb @@ -16,7 +16,7 @@ inherit pkgconfig # provide this .inc to set specific revisions include recipes-kernel/linux/linux-yocto-dev-revisions.inc -KBRANCH = "v5.19/standard/base" +KBRANCH = "v6.1/standard/base" KMETA = "kernel-meta" SRC_URI = "git://git.yoctoproject.org/linux-yocto-dev.git;branch=${KBRANCH};name=machine \ @@ -30,7 +30,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto-dev.git;branch=${KBRANCH};name SRCREV_machine ?= '${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-yocto-dev", "${AUTOREV}", "29594404d7fe73cd80eaa4ee8c43dcc53970c60e", d)}' SRCREV_meta ?= '${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-yocto-dev", "${AUTOREV}", "29594404d7fe73cd80eaa4ee8c43dcc53970c60e", d)}' -LINUX_VERSION ?= "5.19+" +LINUX_VERSION ?= "6.1" LINUX_VERSION_EXTENSION ?= "-yoctodev-${LINUX_KERNEL_TYPE}" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto-rt_5.15.bb b/poky/meta/recipes-kernel/linux/linux-yocto-rt_5.15.bb index e573b27c9c..122fc0feac 100644 --- a/poky/meta/recipes-kernel/linux/linux-yocto-rt_5.15.bb +++ b/poky/meta/recipes-kernel/linux/linux-yocto-rt_5.15.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "47b86b149db08838964584baec1b913c5d67c060" -SRCREV_meta ?= "c6aba7f07aae15d63bccf5b072a6e70602c2bcef" +SRCREV_machine ?= "e53e73b907707b92b3433de7c9c776aa504b2d0b" +SRCREV_meta ?= "e77e5259a3d11efe417b164a0f3341c07ba2bc46" SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}" -LINUX_VERSION ?= "5.15.72" +LINUX_VERSION ?= "5.15.84" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto-rt_5.19.bb b/poky/meta/recipes-kernel/linux/linux-yocto-rt_5.19.bb index 87a3aff41a..f4d205e613 100644 --- a/poky/meta/recipes-kernel/linux/linux-yocto-rt_5.19.bb +++ b/poky/meta/recipes-kernel/linux/linux-yocto-rt_5.19.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "92f22179274bd656239b8aa70eb655473abf68f5" -SRCREV_meta ?= "1cd6a86d7aa5d42ce72097d011c907bd4ea354ec" +SRCREV_machine ?= "3101c367eab8952721086b545ad37c301b2a7452" +SRCREV_meta ?= "239a6c0d3c3b046971909f1e066380465b0c331d" SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.19;destsuffix=${KMETA}" -LINUX_VERSION ?= "5.19.14" +LINUX_VERSION ?= "5.19.17" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto-rt_6.1.bb b/poky/meta/recipes-kernel/linux/linux-yocto-rt_6.1.bb new file mode 100644 index 0000000000..3f77474ae5 --- /dev/null +++ b/poky/meta/recipes-kernel/linux/linux-yocto-rt_6.1.bb @@ -0,0 +1,45 @@ +KBRANCH ?= "v6.1/standard/preempt-rt/base" + +require recipes-kernel/linux/linux-yocto.inc + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying +# to build multiple virtual/kernel providers, e.g. as dependency of +# core-image-rt-sdk, core-image-rt. +python () { + if d.getVar("KERNEL_PACKAGE_NAME") == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-yocto-rt": + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") +} + +SRCREV_machine ?= "fd78a53858b7f9195ab53fd98c27736d05bbaf7c" +SRCREV_meta ?= "c56c1ed8bdb0c470069b74090381bfe07341c95a" + +SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \ + git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.1;destsuffix=${KMETA}" + +LINUX_VERSION ?= "6.1.3" + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + +DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" +DEPENDS += "openssl-native util-linux-native" + +PV = "${LINUX_VERSION}+git${SRCPV}" + +KMETA = "kernel-meta" +KCONF_BSP_AUDIT_LEVEL = "1" + +LINUX_KERNEL_TYPE = "preempt-rt" + +COMPATIBLE_MACHINE = "^(qemux86|qemux86-64|qemuarm|qemuarmv5|qemuarm64|qemuppc|qemumips)$" + +KERNEL_DEVICETREE:qemuarmv5 = "versatile-pb.dtb" + +# Functionality flags +KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/taskstats/taskstats.scc" +KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" +KERNEL_FEATURES:append:qemuall=" cfg/virtio.scc features/drm-bochs/drm-bochs.scc" +KERNEL_FEATURES:append:qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc" +KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc" +KERNEL_FEATURES:append = "${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/scsi/scsi-debug.scc", "", d)}" +KERNEL_FEATURES:append = "${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc", "", d)}" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto-tiny_5.15.bb b/poky/meta/recipes-kernel/linux/linux-yocto-tiny_5.15.bb index 693750860d..f060e22e84 100644 --- a/poky/meta/recipes-kernel/linux/linux-yocto-tiny_5.15.bb +++ b/poky/meta/recipes-kernel/linux/linux-yocto-tiny_5.15.bb @@ -5,7 +5,7 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "5.15.72" +LINUX_VERSION ?= "5.15.84" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" @@ -14,8 +14,8 @@ DEPENDS += "openssl-native util-linux-native" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "34404e5be3791dac897da77afa6c7fa00c993f78" -SRCREV_meta ?= "c6aba7f07aae15d63bccf5b072a6e70602c2bcef" +SRCREV_machine ?= "ae2415ee19511e205a983bc8024700c1f794076a" +SRCREV_meta ?= "e77e5259a3d11efe417b164a0f3341c07ba2bc46" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto-tiny_5.19.bb b/poky/meta/recipes-kernel/linux/linux-yocto-tiny_5.19.bb index 0cd8a2bfab..95a8a46bbc 100644 --- a/poky/meta/recipes-kernel/linux/linux-yocto-tiny_5.19.bb +++ b/poky/meta/recipes-kernel/linux/linux-yocto-tiny_5.19.bb @@ -5,7 +5,7 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "5.19.14" +LINUX_VERSION ?= "5.19.17" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" @@ -14,8 +14,8 @@ DEPENDS += "openssl-native util-linux-native" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "23ee2ef634b3fb51be429623fa1927b1d5c3e95c" -SRCREV_meta ?= "1cd6a86d7aa5d42ce72097d011c907bd4ea354ec" +SRCREV_machine ?= "84f2f8e7a625aae0fa9e7027a2e774b99b646cf7" +SRCREV_meta ?= "239a6c0d3c3b046971909f1e066380465b0c331d" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto-tiny_6.1.bb b/poky/meta/recipes-kernel/linux/linux-yocto-tiny_6.1.bb new file mode 100644 index 0000000000..54f0065c73 --- /dev/null +++ b/poky/meta/recipes-kernel/linux/linux-yocto-tiny_6.1.bb @@ -0,0 +1,30 @@ +KBRANCH ?= "v6.1/standard/tiny/base" + +LINUX_KERNEL_TYPE = "tiny" +KCONFIG_MODE = "--allnoconfig" + +require recipes-kernel/linux/linux-yocto.inc + +LINUX_VERSION ?= "6.1.3" +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" + +DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" +DEPENDS += "openssl-native util-linux-native" + +KMETA = "kernel-meta" +KCONF_BSP_AUDIT_LEVEL = "2" + +SRCREV_machine ?= "872afe79c5e568acf5f971952e78caada8424df7" +SRCREV_meta ?= "c56c1ed8bdb0c470069b74090381bfe07341c95a" + +PV = "${LINUX_VERSION}+git${SRCPV}" + +SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \ + git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.1;destsuffix=${KMETA}" + +COMPATIBLE_MACHINE = "^(qemux86|qemux86-64|qemuarm64|qemuarm|qemuarmv5)$" + +# Functionality flags +KERNEL_FEATURES = "" + +KERNEL_DEVICETREE:qemuarmv5 = "versatile-pb.dtb" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto_5.15.bb b/poky/meta/recipes-kernel/linux/linux-yocto_5.15.bb index 792cf41a53..bb48e158ab 100644 --- a/poky/meta/recipes-kernel/linux/linux-yocto_5.15.bb +++ b/poky/meta/recipes-kernel/linux/linux-yocto_5.15.bb @@ -13,24 +13,24 @@ KBRANCH:qemux86 ?= "v5.15/standard/base" KBRANCH:qemux86-64 ?= "v5.15/standard/base" KBRANCH:qemumips64 ?= "v5.15/standard/mti-malta64" -SRCREV_machine:qemuarm ?= "84a35b23cf4c520894d0d1b91628eb019dc7901a" -SRCREV_machine:qemuarm64 ?= "e939c4ebc789805c00a36eaf4a190df6f8f51470" -SRCREV_machine:qemumips ?= "1adf4e5b574a5d23b4724766890ea74101d04abd" -SRCREV_machine:qemuppc ?= "7220def162c7b2d3b4f1c6c86de0ecc19ade7d5f" -SRCREV_machine:qemuriscv64 ?= "0b628306d1f9ea28c0e86369ce9bb87a47893c9c" -SRCREV_machine:qemuriscv32 ?= "0b628306d1f9ea28c0e86369ce9bb87a47893c9c" -SRCREV_machine:qemux86 ?= "0b628306d1f9ea28c0e86369ce9bb87a47893c9c" -SRCREV_machine:qemux86-64 ?= "0b628306d1f9ea28c0e86369ce9bb87a47893c9c" -SRCREV_machine:qemumips64 ?= "3840e1613b7fe9cc68e9cdfcaf7afa5e14fa8344" -SRCREV_machine ?= "0b628306d1f9ea28c0e86369ce9bb87a47893c9c" -SRCREV_meta ?= "c6aba7f07aae15d63bccf5b072a6e70602c2bcef" +SRCREV_machine:qemuarm ?= "8c0f02ba7db6a463ca3aef969441906706edb350" +SRCREV_machine:qemuarm64 ?= "42a14881ba8145b2d1bdfc019c603abe79aeafd4" +SRCREV_machine:qemumips ?= "1ea321a5c9c66edba818ddffcef2aa9910de552e" +SRCREV_machine:qemuppc ?= "14da484e7f2fc95e10abb4db96bc5fd6b444cb60" +SRCREV_machine:qemuriscv64 ?= "f100c753aa1f9638bfd476da0498b09fdee569d6" +SRCREV_machine:qemuriscv32 ?= "f100c753aa1f9638bfd476da0498b09fdee569d6" +SRCREV_machine:qemux86 ?= "f100c753aa1f9638bfd476da0498b09fdee569d6" +SRCREV_machine:qemux86-64 ?= "f100c753aa1f9638bfd476da0498b09fdee569d6" +SRCREV_machine:qemumips64 ?= "8db5fd5c032f44486ef52f34724d0452aa3a6fea" +SRCREV_machine ?= "f100c753aa1f9638bfd476da0498b09fdee569d6" +SRCREV_meta ?= "e77e5259a3d11efe417b164a0f3341c07ba2bc46" # set your preferred provider of linux-yocto to 'linux-yocto-upstream', and you'll # get the /base branch, which is pure upstream -stable, and the same # meta SRCREV as the linux-yocto-standard builds. Select your version using the # normal PREFERRED_VERSION settings. BBCLASSEXTEND = "devupstream:target" -SRCREV_machine:class-devupstream ?= "c68173b2012b8eba332cf9832f0ad23427d795b5" +SRCREV_machine:class-devupstream ?= "d68f50bfb00f6288e812be895ea5c77932a4b9dd" PN:class-devupstream = "linux-yocto-upstream" KBRANCH:class-devupstream = "v5.15/base" @@ -38,7 +38,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.15;destsuffix=${KMETA}" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" -LINUX_VERSION ?= "5.15.72" +LINUX_VERSION ?= "5.15.84" DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" DEPENDS += "openssl-native util-linux-native" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto_5.19.bb b/poky/meta/recipes-kernel/linux/linux-yocto_5.19.bb index a6fcf10579..5baa0c1130 100644 --- a/poky/meta/recipes-kernel/linux/linux-yocto_5.19.bb +++ b/poky/meta/recipes-kernel/linux/linux-yocto_5.19.bb @@ -13,24 +13,24 @@ KBRANCH:qemux86 ?= "v5.19/standard/base" KBRANCH:qemux86-64 ?= "v5.19/standard/base" KBRANCH:qemumips64 ?= "v5.19/standard/mti-malta64" -SRCREV_machine:qemuarm ?= "8150698489c801b7aa4a641d4feec1de1b2ea07c" -SRCREV_machine:qemuarm64 ?= "23ee2ef634b3fb51be429623fa1927b1d5c3e95c" -SRCREV_machine:qemumips ?= "8d7dc30e65155e4a6a217b054cf54252ace8c724" -SRCREV_machine:qemuppc ?= "23ee2ef634b3fb51be429623fa1927b1d5c3e95c" -SRCREV_machine:qemuriscv64 ?= "23ee2ef634b3fb51be429623fa1927b1d5c3e95c" -SRCREV_machine:qemuriscv32 ?= "23ee2ef634b3fb51be429623fa1927b1d5c3e95c" -SRCREV_machine:qemux86 ?= "23ee2ef634b3fb51be429623fa1927b1d5c3e95c" -SRCREV_machine:qemux86-64 ?= "23ee2ef634b3fb51be429623fa1927b1d5c3e95c" -SRCREV_machine:qemumips64 ?= "930822733328e39e8698bfac5a4e4e8d6a25b4d5" -SRCREV_machine ?= "23ee2ef634b3fb51be429623fa1927b1d5c3e95c" -SRCREV_meta ?= "1cd6a86d7aa5d42ce72097d011c907bd4ea354ec" +SRCREV_machine:qemuarm ?= "f30404d233fc4cc461a0800fd635f4e9650a20a5" +SRCREV_machine:qemuarm64 ?= "84f2f8e7a625aae0fa9e7027a2e774b99b646cf7" +SRCREV_machine:qemumips ?= "ceaf2134635845794c24b750f15004096a597256" +SRCREV_machine:qemuppc ?= "84f2f8e7a625aae0fa9e7027a2e774b99b646cf7" +SRCREV_machine:qemuriscv64 ?= "84f2f8e7a625aae0fa9e7027a2e774b99b646cf7" +SRCREV_machine:qemuriscv32 ?= "84f2f8e7a625aae0fa9e7027a2e774b99b646cf7" +SRCREV_machine:qemux86 ?= "84f2f8e7a625aae0fa9e7027a2e774b99b646cf7" +SRCREV_machine:qemux86-64 ?= "84f2f8e7a625aae0fa9e7027a2e774b99b646cf7" +SRCREV_machine:qemumips64 ?= "acf9ebb1e7d1ceb61a89ec33ca4cc3613287630b" +SRCREV_machine ?= "84f2f8e7a625aae0fa9e7027a2e774b99b646cf7" +SRCREV_meta ?= "239a6c0d3c3b046971909f1e066380465b0c331d" # set your preferred provider of linux-yocto to 'linux-yocto-upstream', and you'll # get the /base branch, which is pure upstream -stable, and the same # meta SRCREV as the linux-yocto-standard builds. Select your version using the # normal PREFERRED_VERSION settings. BBCLASSEXTEND = "devupstream:target" -SRCREV_machine:class-devupstream ?= "30c780ac0f9fc09160790cf58f07ef3b92097ceb" +SRCREV_machine:class-devupstream ?= "2b525314c7b57eac29fe8b77a6589428e4a4f6dd" PN:class-devupstream = "linux-yocto-upstream" KBRANCH:class-devupstream = "v5.19/base" @@ -38,7 +38,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.19;destsuffix=${KMETA}" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" -LINUX_VERSION ?= "5.19.14" +LINUX_VERSION ?= "5.19.17" DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" DEPENDS += "openssl-native util-linux-native" diff --git a/poky/meta/recipes-kernel/linux/linux-yocto_6.1.bb b/poky/meta/recipes-kernel/linux/linux-yocto_6.1.bb new file mode 100644 index 0000000000..f357f43f46 --- /dev/null +++ b/poky/meta/recipes-kernel/linux/linux-yocto_6.1.bb @@ -0,0 +1,70 @@ +KBRANCH ?= "v6.1/standard/base" + +require recipes-kernel/linux/linux-yocto.inc + +# board specific branches +KBRANCH:qemuarm ?= "v6.1/standard/arm-versatile-926ejs" +KBRANCH:qemuarm64 ?= "v6.1/standard/qemuarm64" +KBRANCH:qemumips ?= "v6.1/standard/mti-malta32" +KBRANCH:qemuppc ?= "v6.1/standard/qemuppc" +KBRANCH:qemuriscv64 ?= "v6.1/standard/base" +KBRANCH:qemuriscv32 ?= "v6.1/standard/base" +KBRANCH:qemux86 ?= "v6.1/standard/base" +KBRANCH:qemux86-64 ?= "v6.1/standard/base" +KBRANCH:qemumips64 ?= "v6.1/standard/mti-malta64" + +SRCREV_machine:qemuarm ?= "f3fae08180e0e42fe1d84bc27fadfbe712486e7d" +SRCREV_machine:qemuarm64 ?= "872afe79c5e568acf5f971952e78caada8424df7" +SRCREV_machine:qemumips ?= "f33d80dcd64dbdf265f8501370595c9b7672b402" +SRCREV_machine:qemuppc ?= "872afe79c5e568acf5f971952e78caada8424df7" +SRCREV_machine:qemuriscv64 ?= "872afe79c5e568acf5f971952e78caada8424df7" +SRCREV_machine:qemuriscv32 ?= "872afe79c5e568acf5f971952e78caada8424df7" +SRCREV_machine:qemux86 ?= "872afe79c5e568acf5f971952e78caada8424df7" +SRCREV_machine:qemux86-64 ?= "872afe79c5e568acf5f971952e78caada8424df7" +SRCREV_machine:qemumips64 ?= "e01e486b21db695c46c12253b92adc7aa0da6d38" +SRCREV_machine ?= "872afe79c5e568acf5f971952e78caada8424df7" +SRCREV_meta ?= "c56c1ed8bdb0c470069b74090381bfe07341c95a" + +# set your preferred provider of linux-yocto to 'linux-yocto-upstream', and you'll +# get the /base branch, which is pure upstream -stable, and the same +# meta SRCREV as the linux-yocto-standard builds. Select your version using the +# normal PREFERRED_VERSION settings. +BBCLASSEXTEND = "devupstream:target" +SRCREV_machine:class-devupstream ?= "4adc0fbe03a69d3189607bf74e82a79c29c08b4a" +PN:class-devupstream = "linux-yocto-upstream" +KBRANCH:class-devupstream = "v6.1/base" + +SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}; \ + git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.1;destsuffix=${KMETA}" + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" +LINUX_VERSION ?= "6.1.3" + +DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" +DEPENDS += "openssl-native util-linux-native" +DEPENDS += "gmp-native libmpc-native" + +PV = "${LINUX_VERSION}+git${SRCPV}" + +KMETA = "kernel-meta" +KCONF_BSP_AUDIT_LEVEL = "1" + +KERNEL_DEVICETREE:qemuarmv5 = "versatile-pb.dtb" + +COMPATIBLE_MACHINE = "^(qemuarm|qemuarmv5|qemuarm64|qemux86|qemuppc|qemuppc64|qemumips|qemumips64|qemux86-64|qemuriscv64|qemuriscv32)$" + +# Functionality flags +KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc" +KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" +KERNEL_FEATURES:append:qemuall=" cfg/virtio.scc features/drm-bochs/drm-bochs.scc cfg/net/mdio.scc" +KERNEL_FEATURES:append:qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc" +KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc" +KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "", d)}" +KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/scsi/scsi-debug.scc", "", d)}" +KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc", "", d)}" +KERNEL_FEATURES:append:powerpc =" arch/powerpc/powerpc-debug.scc" +KERNEL_FEATURES:append:powerpc64 =" arch/powerpc/powerpc-debug.scc" +KERNEL_FEATURES:append:powerpc64le =" arch/powerpc/powerpc-debug.scc" + +INSANE_SKIP:kernel-vmlinux:qemuppc64 = "textrel" + diff --git a/poky/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch b/poky/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch new file mode 100644 index 0000000000..99402ea5e9 --- /dev/null +++ b/poky/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch @@ -0,0 +1,278 @@ +From b977f96d0a414e76d4c544f65791919dde1bc57e Mon Sep 17 00:00:00 2001 +From: Michael Jeanson +Date: Mon, 17 Oct 2022 13:49:51 -0400 +Subject: [PATCH] fix: mm/slab_common: drop kmem_alloc & avoid dereferencing + fields when not using (v6.1) + +See uptream commit: + + commit 2c1d697fb8ba6d2d44f914d4268ae1ccdf025f1b + Author: Hyeonggon Yoo <42.hyeyoo@gmail.com> + Date: Wed Aug 17 19:18:24 2022 +0900 + + mm/slab_common: drop kmem_alloc & avoid dereferencing fields when not using + + Drop kmem_alloc event class, and define kmalloc and kmem_cache_alloc + using TRACE_EVENT() macro. + + And then this patch does: + - Do not pass pointer to struct kmem_cache to trace_kmalloc. + gfp flag is enough to know if it's accounted or not. + - Avoid dereferencing s->object_size and s->size when not using kmem_cache_alloc event. + - Avoid dereferencing s->name in when not using kmem_cache_free event. + - Adjust s->size to SLOB_UNITS(s->size) * SLOB_UNIT in SLOB + +Upstream-Status: Backport [commit b977f96d0a414e76d4c544f] + +Change-Id: Icd7925731ed4a737699c3746cb7bb7760a4e8009 +Signed-off-by: Michael Jeanson +Signed-off-by: Mathieu Desnoyers +--- + include/instrumentation/events/kmem.h | 156 ++++++++++++++++++-------- + 1 file changed, 111 insertions(+), 45 deletions(-) + +diff --git a/include/instrumentation/events/kmem.h b/include/instrumentation/events/kmem.h +index 219533a1..0f5bd8e6 100644 +--- a/include/instrumentation/events/kmem.h ++++ b/include/instrumentation/events/kmem.h +@@ -10,9 +10,58 @@ + #include + + #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0)) +- + #include <../../mm/slab.h> ++#endif ++ ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,1,0)) ++LTTNG_TRACEPOINT_EVENT_MAP(kmalloc, ++ ++ kmem_kmalloc, ++ ++ TP_PROTO(unsigned long call_site, ++ const void *ptr, ++ size_t bytes_req, ++ size_t bytes_alloc, ++ gfp_t gfp_flags, ++ int node), ++ ++ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node), ++ ++ TP_FIELDS( ++ ctf_integer_hex(unsigned long, call_site, call_site) ++ ctf_integer_hex(const void *, ptr, ptr) ++ ctf_integer(size_t, bytes_req, bytes_req) ++ ctf_integer(size_t, bytes_alloc, bytes_alloc) ++ ctf_integer(gfp_t, gfp_flags, gfp_flags) ++ ctf_integer(int, node, node) ++ ctf_integer(bool, accounted, (IS_ENABLED(CONFIG_MEMCG_KMEM) && ++ (gfp_flags & __GFP_ACCOUNT) ? true : false)) ++ ) ++) ++ ++LTTNG_TRACEPOINT_EVENT(kmem_cache_alloc, ++ ++ TP_PROTO(unsigned long call_site, ++ const void *ptr, ++ struct kmem_cache *s, ++ gfp_t gfp_flags, ++ int node), ++ ++ TP_ARGS(call_site, ptr, s, gfp_flags, node), + ++ TP_FIELDS( ++ ctf_integer_hex(unsigned long, call_site, call_site) ++ ctf_integer_hex(const void *, ptr, ptr) ++ ctf_integer(size_t, bytes_req, s->object_size) ++ ctf_integer(size_t, bytes_alloc, s->size) ++ ctf_integer(gfp_t, gfp_flags, gfp_flags) ++ ctf_integer(int, node, node) ++ ctf_integer(bool, accounted, IS_ENABLED(CONFIG_MEMCG_KMEM) ? ++ ((gfp_flags & __GFP_ACCOUNT) || ++ (s->flags & SLAB_ACCOUNT)) : false) ++ ) ++) ++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0)) + LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, + + TP_PROTO(unsigned long call_site, +@@ -53,18 +102,16 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc, + + TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags) + ) +- +-LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, ++#else ++LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, + + TP_PROTO(unsigned long call_site, + const void *ptr, +- struct kmem_cache *s, + size_t bytes_req, + size_t bytes_alloc, +- gfp_t gfp_flags, +- int node), ++ gfp_t gfp_flags), + +- TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node), ++ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags), + + TP_FIELDS( + ctf_integer_hex(unsigned long, call_site, call_site) +@@ -72,42 +119,40 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, + ctf_integer(size_t, bytes_req, bytes_req) + ctf_integer(size_t, bytes_alloc, bytes_alloc) + ctf_integer(gfp_t, gfp_flags, gfp_flags) +- ctf_integer(int, node, node) +- ctf_integer(bool, accounted, IS_ENABLED(CONFIG_MEMCG_KMEM) ? +- ((gfp_flags & __GFP_ACCOUNT) || +- (s && s->flags & SLAB_ACCOUNT)) : false) + ) + ) + +-LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node, ++LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc, + +- kmem_kmalloc_node, ++ kmem_kmalloc, + + TP_PROTO(unsigned long call_site, const void *ptr, +- struct kmem_cache *s, size_t bytes_req, size_t bytes_alloc, +- gfp_t gfp_flags, int node), ++ size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), + +- TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node) ++ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) + ) + +-LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node, ++LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc, + + TP_PROTO(unsigned long call_site, const void *ptr, +- struct kmem_cache *s, size_t bytes_req, size_t bytes_alloc, +- gfp_t gfp_flags, int node), ++ size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), + +- TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node) ++ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) + ) +-#else +-LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, ++#endif ++ ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,0,0)) ++LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, + + TP_PROTO(unsigned long call_site, + const void *ptr, ++ struct kmem_cache *s, + size_t bytes_req, + size_t bytes_alloc, +- gfp_t gfp_flags), ++ gfp_t gfp_flags, ++ int node), + +- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags), ++ TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node), + + TP_FIELDS( + ctf_integer_hex(unsigned long, call_site, call_site) +@@ -115,27 +160,33 @@ LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, + ctf_integer(size_t, bytes_req, bytes_req) + ctf_integer(size_t, bytes_alloc, bytes_alloc) + ctf_integer(gfp_t, gfp_flags, gfp_flags) ++ ctf_integer(int, node, node) ++ ctf_integer(bool, accounted, IS_ENABLED(CONFIG_MEMCG_KMEM) ? ++ ((gfp_flags & __GFP_ACCOUNT) || ++ (s && s->flags & SLAB_ACCOUNT)) : false) + ) + ) + +-LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc, ++LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node, + +- kmem_kmalloc, ++ kmem_kmalloc_node, + + TP_PROTO(unsigned long call_site, const void *ptr, +- size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), ++ struct kmem_cache *s, size_t bytes_req, size_t bytes_alloc, ++ gfp_t gfp_flags, int node), + +- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) ++ TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node) + ) + +-LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc, ++LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node, + + TP_PROTO(unsigned long call_site, const void *ptr, +- size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), ++ struct kmem_cache *s, size_t bytes_req, size_t bytes_alloc, ++ gfp_t gfp_flags, int node), + +- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) ++ TP_ARGS(call_site, ptr, s, bytes_req, bytes_alloc, gfp_flags, node) + ) +- ++#else + LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, + + TP_PROTO(unsigned long call_site, +@@ -192,19 +243,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(kfree, + ctf_integer_hex(const void *, ptr, ptr) + ) + ) +- +-LTTNG_TRACEPOINT_EVENT(kmem_cache_free, +- +- TP_PROTO(unsigned long call_site, const void *ptr, const char *name), +- +- TP_ARGS(call_site, ptr, name), +- +- TP_FIELDS( +- ctf_integer_hex(unsigned long, call_site, call_site) +- ctf_integer_hex(const void *, ptr, ptr) +- ctf_string(name, name) +- ) +-) + #else + LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free, + +@@ -235,6 +273,34 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free, kmem_cache_free, + ) + #endif + ++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,1,0)) ++LTTNG_TRACEPOINT_EVENT(kmem_cache_free, ++ ++ TP_PROTO(unsigned long call_site, const void *ptr, const struct kmem_cache *s), ++ ++ TP_ARGS(call_site, ptr, s), ++ ++ TP_FIELDS( ++ ctf_integer_hex(unsigned long, call_site, call_site) ++ ctf_integer_hex(const void *, ptr, ptr) ++ ctf_string(name, s->name) ++ ) ++) ++#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,12,0)) ++LTTNG_TRACEPOINT_EVENT(kmem_cache_free, ++ ++ TP_PROTO(unsigned long call_site, const void *ptr, const char *name), ++ ++ TP_ARGS(call_site, ptr, name), ++ ++ TP_FIELDS( ++ ctf_integer_hex(unsigned long, call_site, call_site) ++ ctf_integer_hex(const void *, ptr, ptr) ++ ctf_string(name, name) ++ ) ++) ++#endif ++ + #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,3,0)) + LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free, kmem_mm_page_free, + #else +-- +2.19.1 + diff --git a/poky/meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb b/poky/meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb index 49c584dff4..d444f9ab0c 100644 --- a/poky/meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb +++ b/poky/meta/recipes-kernel/lttng/lttng-modules_2.13.7.bb @@ -11,6 +11,7 @@ include lttng-platforms.inc SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0009-Rename-genhd-wrapper-to-blkdev.patch \ + file://0001-fix-mm-slab_common-drop-kmem_alloc-avoid-dereferenci.patch \ " # Use :append here so that the patch is applied also when using devupstream diff --git a/poky/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch b/poky/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch new file mode 100644 index 0000000000..e3d421f730 --- /dev/null +++ b/poky/meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch @@ -0,0 +1,35 @@ +From cc3e1abaa1e7ad85c6a299fe30a36e0cb732e1c8 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 14:51:20 -0800 +Subject: [PATCH] compat: Define off64_t as off_t on linux + +This helps compile with latest musl, where off64_t is not defined +unless _LARGEFILE64_SOURCE is defined, on glibc _LARGEFILE64_SOURCE is +defined if _GNU_SOURCE is defined, so the problem is only seen with musl + +Upstream-Status: Submitted [https://github.com/lttng/lttng-tools/pull/164] +Signed-off-by: Khem Raj +--- + src/common/compat/fcntl.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h +index 5e566e50..d19a6ece 100644 +--- a/src/common/compat/fcntl.h ++++ b/src/common/compat/fcntl.h +@@ -7,7 +7,6 @@ + + #ifndef _COMPAT_FCNTL_H + #define _COMPAT_FCNTL_H +- + #include + #include + +@@ -22,6 +21,7 @@ typedef off64_t loff_t; + #endif + + #ifdef __linux__ ++typedef off_t off64_t; + extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes, + unsigned int flags); + #define lttng_sync_file_range(fd, offset, nbytes, flags) \ diff --git a/poky/meta/recipes-kernel/lttng/lttng-tools_2.13.8.bb b/poky/meta/recipes-kernel/lttng/lttng-tools_2.13.8.bb index a814eb79f9..e64eeba635 100644 --- a/poky/meta/recipes-kernel/lttng/lttng-tools_2.13.8.bb +++ b/poky/meta/recipes-kernel/lttng/lttng-tools_2.13.8.bb @@ -37,6 +37,7 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \ file://lttng-sessiond.service \ file://determinism.patch \ file://disable-tests.patch \ + file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \ " SRC_URI[sha256sum] = "b1e959579b260790930b20f3c7aa7cefb8a40e0de80d4a777c2bf78c6b353dc1" diff --git a/poky/meta/recipes-kernel/systemtap/systemtap/python-3.11.patch b/poky/meta/recipes-kernel/systemtap/systemtap/python-3.11.patch deleted file mode 100644 index 6e0c97b8d6..0000000000 --- a/poky/meta/recipes-kernel/systemtap/systemtap/python-3.11.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 069e109c95d1afca17cd3781b39f220cf8b39978 Mon Sep 17 00:00:00 2001 -From: Stan Cox -Date: Wed, 13 Jul 2022 09:49:51 -0400 -Subject: [PATCH 1/1] python 3.11 removed direct access to PyFrameObject - members - -Take into account the change in PyFrameObject definition to allow -building systemtap with python 3.11. Additional support for python -3.11 is forthcoming. - -Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=069e109c95d1afca17cd3781b39f220cf8b39978] -Signed-off-by: Alexander Kanavin ---- - python/HelperSDT/_HelperSDT.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/python/HelperSDT/_HelperSDT.c b/python/HelperSDT/_HelperSDT.c -index 967cb6077..4d287132e 100644 ---- a/python/HelperSDT/_HelperSDT.c -+++ b/python/HelperSDT/_HelperSDT.c -@@ -14,7 +14,13 @@ - // PR25841: ensure that the libHelperSDT.so file contains debuginfo - // for the tapset helper functions, so they don't have to look into libpython* - #include -+// python 3.11 removed direct access to PyFrameObject members -+// https://docs.python.org/3.11/whatsnew/3.11.html#c-api-changes -+#if PY_MAJOR_VERSION <= 3 && PY_MINOR_VERSION < 11 - PyFrameObject _dummy_frame; -+#else -+//PyFrameObject *_dummy_frame; -+#endif - #include - PyVarObject _dummy_var; - #include --- -2.31.1 - diff --git a/poky/meta/recipes-kernel/systemtap/systemtap_git.inc b/poky/meta/recipes-kernel/systemtap/systemtap_git.inc index b05a5a2b0d..d309a89496 100644 --- a/poky/meta/recipes-kernel/systemtap/systemtap_git.inc +++ b/poky/meta/recipes-kernel/systemtap/systemtap_git.inc @@ -1,13 +1,12 @@ LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" -SRCREV = "0c335a75a789ff44b514e567d458881e15cc283d" -PV = "4.7" +SRCREV = "b176afb2e49119ef844d193d27b0752a6d84fe8f" +PV = "4.8" SRC_URI = "git://sourceware.org/git/systemtap.git;branch=master \ file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \ file://0001-Install-python-modules-to-correct-library-dir.patch \ file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \ - file://python-3.11.patch \ " COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips|riscv64).*-linux' diff --git a/poky/meta/recipes-multimedia/alsa/alsa-utils/0001-aplay-axfer-Replace-off64_t-with-off_t.patch b/poky/meta/recipes-multimedia/alsa/alsa-utils/0001-aplay-axfer-Replace-off64_t-with-off_t.patch new file mode 100644 index 0000000000..356c5964ae --- /dev/null +++ b/poky/meta/recipes-multimedia/alsa/alsa-utils/0001-aplay-axfer-Replace-off64_t-with-off_t.patch @@ -0,0 +1,272 @@ +From 03553ccc6284a437576349b5a3c2ed0d7d4265e1 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 14:04:10 -0800 +Subject: [PATCH] aplay,axfer: Replace off64_t with off_t + +Also replace lseek64 with lseek. + +_FILE_OFFSET_BITS=64 is passed to needed platforms since configure uses +AC_SYS_LARGEFILE macro. Therefore off_t is already 64-bit and lseek is +same as lseek64. + +Additionally this fixes buils with latest musl where these lfs64 +functions are moved out from _GNU_SOURCE and under _LARGEFILE64_SOURCE +macro alone. This makes the builds fail on 32-bit platforms even though +default off_t on musl is 64-bit always. + +Upstream-Status: Submitted [https://github.com/alsa-project/alsa-utils/pull/183] +Signed-off-by: Khem Raj +--- + aplay/aplay.c | 44 ++++++++++++++++++------------------- + axfer/container-voc.c | 2 +- + axfer/container.c | 6 ++--- + axfer/container.h | 2 +- + axfer/test/container-test.c | 4 ++-- + axfer/test/mapper-test.c | 2 +- + 6 files changed, 30 insertions(+), 30 deletions(-) + +diff --git a/aplay/aplay.c b/aplay/aplay.c +index 6ce7191..bd93be3 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -141,7 +141,7 @@ static long term_c_lflag = -1; + static int dump_hw_params = 0; + + static int fd = -1; +-static off64_t pbrec_count = LLONG_MAX, fdcount; ++static off_t pbrec_count = LLONG_MAX, fdcount; + static int vocmajor, vocminor; + + static char *pidfile_name = NULL; +@@ -2356,7 +2356,7 @@ static void voc_play(int fd, int ofs, char *name) + u_char *data, *buf; + char was_extended = 0, output = 0; + u_short *sp, repeat = 0; +- off64_t filepos = 0; ++ off_t filepos = 0; + + #define COUNT(x) nextblock -= x; in_buffer -= x; data += x + #define COUNT1(x) in_buffer -= x; data += x +@@ -2490,7 +2490,7 @@ static void voc_play(int fd, int ofs, char *name) + d_printf("Repeat loop %d times\n", repeat); + #endif + if (filepos >= 0) { /* if < 0, one seek fails, why test another */ +- if ((filepos = lseek64(fd, 0, 1)) < 0) { ++ if ((filepos = lseek(fd, 0, 1)) < 0) { + error(_("can't play loops; %s isn't seekable\n"), name); + repeat = 0; + } else { +@@ -2512,7 +2512,7 @@ static void voc_play(int fd, int ofs, char *name) + else + d_printf("Neverending loop\n"); + #endif +- lseek64(fd, filepos, 0); ++ lseek(fd, filepos, 0); + in_buffer = 0; /* clear the buffer */ + goto Fill_the_buffer; + } +@@ -2578,9 +2578,9 @@ static void init_raw_data(void) + } + + /* calculate the data count to read from/to dsp */ +-static off64_t calc_count(void) ++static off_t calc_count(void) + { +- off64_t count; ++ off_t count; + + if (timelimit == 0) + if (sampleslimit == 0) +@@ -2589,7 +2589,7 @@ static off64_t calc_count(void) + count = snd_pcm_format_size(hwparams.format, sampleslimit * hwparams.channels); + else { + count = snd_pcm_format_size(hwparams.format, hwparams.rate * hwparams.channels); +- count *= (off64_t)timelimit; ++ count *= (off_t)timelimit; + } + return count < pbrec_count ? count : pbrec_count; + } +@@ -2750,7 +2750,7 @@ static void begin_au(int fd, size_t cnt) + /* closing .VOC */ + static void end_voc(int fd) + { +- off64_t length_seek; ++ off_t length_seek; + VocBlockType bt; + size_t cnt; + char dummy = 0; /* Write a Terminator */ +@@ -2770,15 +2770,15 @@ static void end_voc(int fd) + bt.datalen = (u_char) (cnt & 0xFF); + bt.datalen_m = (u_char) ((cnt & 0xFF00) >> 8); + bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16); +- if (lseek64(fd, length_seek, SEEK_SET) == length_seek) ++ if (lseek(fd, length_seek, SEEK_SET) == length_seek) + xwrite(fd, &bt, sizeof(VocBlockType)); + } + + static void end_wave(int fd) + { /* only close output */ + WaveChunkHeader cd; +- off64_t length_seek; +- off64_t filelen; ++ off_t length_seek; ++ off_t filelen; + u_int rifflen; + + length_seek = sizeof(WaveHeader) + +@@ -2788,20 +2788,20 @@ static void end_wave(int fd) + cd.length = fdcount > 0x7fffffff ? LE_INT(0x7fffffff) : LE_INT(fdcount); + filelen = fdcount + 2*sizeof(WaveChunkHeader) + sizeof(WaveFmtBody) + 4; + rifflen = filelen > 0x7fffffff ? LE_INT(0x7fffffff) : LE_INT(filelen); +- if (lseek64(fd, 4, SEEK_SET) == 4) ++ if (lseek(fd, 4, SEEK_SET) == 4) + xwrite(fd, &rifflen, 4); +- if (lseek64(fd, length_seek, SEEK_SET) == length_seek) ++ if (lseek(fd, length_seek, SEEK_SET) == length_seek) + xwrite(fd, &cd, sizeof(WaveChunkHeader)); + } + + static void end_au(int fd) + { /* only close output */ + AuHeader ah; +- off64_t length_seek; ++ off_t length_seek; + + length_seek = (char *)&ah.data_size - (char *)&ah; + ah.data_size = fdcount > 0xffffffff ? 0xffffffff : BE_INT(fdcount); +- if (lseek64(fd, length_seek, SEEK_SET) == length_seek) ++ if (lseek(fd, length_seek, SEEK_SET) == length_seek) + xwrite(fd, &ah.data_size, sizeof(ah.data_size)); + } + +@@ -2828,11 +2828,11 @@ static void header(int rtype, char *name) + + /* playing raw data */ + +-static void playback_go(int fd, size_t loaded, off64_t count, int rtype, char *name) ++static void playback_go(int fd, size_t loaded, off_t count, int rtype, char *name) + { + int l, r; +- off64_t written = 0; +- off64_t c; ++ off_t written = 0; ++ off_t c; + + header(rtype, name); + set_params(); +@@ -3202,7 +3202,7 @@ static void capture(char *orig_name) + int filecount=0; /* number of files written */ + char *name = orig_name; /* current filename */ + char namebuf[PATH_MAX+2]; +- off64_t count, rest; /* number of bytes to capture */ ++ off_t count, rest; /* number of bytes to capture */ + struct stat statbuf; + + /* get number of bytes to capture */ +@@ -3273,7 +3273,7 @@ static void capture(char *orig_name) + /* capture */ + fdcount = 0; + while (rest > 0 && recycle_capture_file == 0 && !in_aborting) { +- size_t c = (rest <= (off64_t)chunk_bytes) ? ++ size_t c = (rest <= (off_t)chunk_bytes) ? + (size_t)rest : chunk_bytes; + size_t f = c * 8 / bits_per_frame; + size_t read = pcm_read(audiobuf, f); +@@ -3314,7 +3314,7 @@ static void capture(char *orig_name) + } while ((file_type == FORMAT_RAW && !timelimit && !sampleslimit) || count > 0); + } + +-static void playbackv_go(int* fds, unsigned int channels, size_t loaded, off64_t count, int rtype, char **names) ++static void playbackv_go(int* fds, unsigned int channels, size_t loaded, off_t count, int rtype, char **names) + { + int r; + size_t vsize; +@@ -3368,7 +3368,7 @@ static void playbackv_go(int* fds, unsigned int channels, size_t loaded, off64_t + } + } + +-static void capturev_go(int* fds, unsigned int channels, off64_t count, int rtype, char **names) ++static void capturev_go(int* fds, unsigned int channels, off_t count, int rtype, char **names) + { + size_t c; + ssize_t r; +diff --git a/axfer/container-voc.c b/axfer/container-voc.c +index ec0cfff..5941003 100644 +--- a/axfer/container-voc.c ++++ b/axfer/container-voc.c +@@ -775,7 +775,7 @@ static int write_block_terminator(struct container_context *cntr) + static int write_data_size(struct container_context *cntr, uint64_t byte_count) + { + struct builder_state *state = cntr->private_data; +- off64_t offset; ++ off_t offset; + uint8_t size_field[3]; + int err; + +diff --git a/axfer/container.c b/axfer/container.c +index 8c88d5c..379b72f 100644 +--- a/axfer/container.c ++++ b/axfer/container.c +@@ -113,11 +113,11 @@ enum container_format container_format_from_path(const char *path) + return CONTAINER_FORMAT_RAW; + } + +-int container_seek_offset(struct container_context *cntr, off64_t offset) ++int container_seek_offset(struct container_context *cntr, off_t offset) + { +- off64_t pos; ++ off_t pos; + +- pos = lseek64(cntr->fd, offset, SEEK_SET); ++ pos = lseek(cntr->fd, offset, SEEK_SET); + if (pos < 0) + return -errno; + if (pos != offset) +diff --git a/axfer/container.h b/axfer/container.h +index 71017a6..f6ce689 100644 +--- a/axfer/container.h ++++ b/axfer/container.h +@@ -107,7 +107,7 @@ int container_recursive_read(struct container_context *cntr, void *buf, + unsigned int byte_count); + int container_recursive_write(struct container_context *cntr, void *buf, + unsigned int byte_count); +-int container_seek_offset(struct container_context *cntr, off64_t offset); ++int container_seek_offset(struct container_context *cntr, off_t offset); + + extern const struct container_parser container_parser_riff_wave; + extern const struct container_builder container_builder_riff_wave; +diff --git a/axfer/test/container-test.c b/axfer/test/container-test.c +index e5b62dd..45b6c6a 100644 +--- a/axfer/test/container-test.c ++++ b/axfer/test/container-test.c +@@ -153,7 +153,7 @@ static int callback(struct test_generator *gen, snd_pcm_access_t access, + + for (i = 0; i < ARRAY_SIZE(entries); ++i) { + int fd; +- off64_t pos; ++ off_t pos; + + frames_per_second = entries[i]; + +@@ -172,7 +172,7 @@ static int callback(struct test_generator *gen, snd_pcm_access_t access, + frames_per_second, frame_buffer, frame_count, + trial->verbose); + +- pos = lseek64(fd, 0, SEEK_SET); ++ pos = lseek(fd, 0, SEEK_SET); + if (pos < 0) { + err = -errno; + break; +diff --git a/axfer/test/mapper-test.c b/axfer/test/mapper-test.c +index 477871d..6a389e9 100644 +--- a/axfer/test/mapper-test.c ++++ b/axfer/test/mapper-test.c +@@ -257,7 +257,7 @@ static int test_mapper(struct mapper_trial *trial, snd_pcm_access_t access, + goto end; + + for (i = 0; i < cntr_count; ++i) { +- off64_t pos = lseek64(cntr_fds[i], 0, SEEK_SET); ++ off_t pos = lseek(cntr_fds[i], 0, SEEK_SET); + if (pos != 0) { + err = -EIO; + goto end; diff --git a/poky/meta/recipes-multimedia/alsa/alsa-utils_1.2.8.bb b/poky/meta/recipes-multimedia/alsa/alsa-utils_1.2.8.bb index b355deacc8..46d39b0de8 100644 --- a/poky/meta/recipes-multimedia/alsa/alsa-utils_1.2.8.bb +++ b/poky/meta/recipes-multimedia/alsa/alsa-utils_1.2.8.bb @@ -24,7 +24,9 @@ PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev PACKAGECONFIG[manpages] = "--enable-xmlto, --disable-xmlto, xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" # alsa-utils specified in SRC_URI due to alsa-utils-scripts recipe -SRC_URI = "https://www.alsa-project.org/files/pub/utils/alsa-utils-${PV}.tar.bz2" +SRC_URI = "https://www.alsa-project.org/files/pub/utils/alsa-utils-${PV}.tar.bz2 \ + file://0001-aplay-axfer-Replace-off64_t-with-off_t.patch \ + " SRC_URI[sha256sum] = "e140fa604c351f36bd72167c8860c69d81b964ae6ab53992d6434dde38e9333c" # On build machines with python-docutils (not python3-docutils !!) installed diff --git a/poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch b/poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch new file mode 100644 index 0000000000..2775a81cc8 --- /dev/null +++ b/poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch @@ -0,0 +1,89 @@ +From 92f9b28ed84a77138105475beba16c146bdaf984 Mon Sep 17 00:00:00 2001 +From: Paul B Mahol +Date: Sat, 12 Nov 2022 16:12:00 +0100 +Subject: [PATCH] avcodec/rpzaenc: stop accessing out of bounds frame + +Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/92f9b28ed84a77138105475beba16c146bdaf984] + +Signed-off-by: + +--- + libavcodec/rpzaenc.c | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +diff --git a/libavcodec/rpzaenc.c b/libavcodec/rpzaenc.c +index d710eb4f82..4ced9523e2 100644 +--- a/libavcodec/rpzaenc.c ++++ b/libavcodec/rpzaenc.c +@@ -205,7 +205,7 @@ static void get_max_component_diff(const BlockInfo *bi, const uint16_t *block_pt + + // loop thru and compare pixels + for (y = 0; y < bi->block_height; y++) { +- for (x = 0; x < bi->block_width; x++){ ++ for (x = 0; x < bi->block_width; x++) { + // TODO: optimize + min_r = FFMIN(R(block_ptr[x]), min_r); + min_g = FFMIN(G(block_ptr[x]), min_g); +@@ -278,7 +278,7 @@ static int leastsquares(const uint16_t *block_ptr, const BlockInfo *bi, + return -1; + + for (i = 0; i < bi->block_height; i++) { +- for (j = 0; j < bi->block_width; j++){ ++ for (j = 0; j < bi->block_width; j++) { + x = GET_CHAN(block_ptr[j], xchannel); + y = GET_CHAN(block_ptr[j], ychannel); + sumx += x; +@@ -325,7 +325,7 @@ static int calc_lsq_max_fit_error(const uint16_t *block_ptr, const BlockInfo *bi + int max_err = 0; + + for (i = 0; i < bi->block_height; i++) { +- for (j = 0; j < bi->block_width; j++){ ++ for (j = 0; j < bi->block_width; j++) { + int x_inc, lin_y, lin_x; + x = GET_CHAN(block_ptr[j], xchannel); + y = GET_CHAN(block_ptr[j], ychannel); +@@ -420,7 +420,9 @@ static void update_block_in_prev_frame(const uint16_t *src_pixels, + uint16_t *dest_pixels, + const BlockInfo *bi, int block_counter) + { +- for (int y = 0; y < 4; y++) { ++ const int y_size = FFMIN(4, bi->image_height - bi->row * 4); ++ ++ for (int y = 0; y < y_size; y++) { + memcpy(dest_pixels, src_pixels, 8); + dest_pixels += bi->rowstride; + src_pixels += bi->rowstride; +@@ -730,14 +732,15 @@ post_skip : + + if (err > s->sixteen_color_thresh) { // DO SIXTEEN COLOR BLOCK + uint16_t *row_ptr; +- int rgb555; ++ int y_size, rgb555; + + block_offset = get_block_info(&bi, block_counter); + + row_ptr = &src_pixels[block_offset]; ++ y_size = FFMIN(4, bi.image_height - bi.row * 4); + +- for (int y = 0; y < 4; y++) { +- for (int x = 0; x < 4; x++){ ++ for (int y = 0; y < y_size; y++) { ++ for (int x = 0; x < 4; x++) { + rgb555 = row_ptr[x] & ~0x8000; + + put_bits(&s->pb, 16, rgb555); +@@ -745,6 +748,11 @@ post_skip : + row_ptr += bi.rowstride; + } + ++ for (int y = y_size; y < 4; y++) { ++ for (int x = 0; x < 4; x++) ++ put_bits(&s->pb, 16, 0); ++ } ++ + block_counter++; + } else { // FOUR COLOR BLOCK + block_counter += encode_four_color_block(min_color, max_color, +-- +2.34.1 + diff --git a/poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch b/poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch new file mode 100644 index 0000000000..923fc6a9c1 --- /dev/null +++ b/poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch @@ -0,0 +1,108 @@ +From 13c13109759090b7f7182480d075e13b36ed8edd Mon Sep 17 00:00:00 2001 +From: Paul B Mahol +Date: Sat, 12 Nov 2022 15:19:21 +0100 +Subject: [PATCH] avcodec/smcenc: stop accessing out of bounds frame + +Upstream-Status: Backport [https://github.com/FFmpeg/FFmpeg/commit/13c13109759090b7f7182480d075e13b36ed8edd] + +Signed-off-by: + +--- + libavcodec/smcenc.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/smcenc.c b/libavcodec/smcenc.c +index f3d26a4e8d..33549b8ab4 100644 +--- a/libavcodec/smcenc.c ++++ b/libavcodec/smcenc.c +@@ -61,6 +61,7 @@ typedef struct SMCContext { + { \ + row_ptr += stride * 4; \ + pixel_ptr = row_ptr; \ ++ cur_y += 4; \ + } \ + } \ + } +@@ -117,6 +118,7 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame, + const uint8_t *prev_pixels = (const uint8_t *)s->prev_frame->data[0]; + uint8_t *distinct_values = s->distinct_values; + const uint8_t *pixel_ptr, *row_ptr; ++ const int height = frame->height; + const int width = frame->width; + uint8_t block_values[16]; + int block_counter = 0; +@@ -125,13 +127,14 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame, + int color_octet_index = 0; + int color_table_index; /* indexes to color pair, quad, or octet tables */ + int total_blocks; ++ int cur_y = 0; + + memset(s->color_pairs, 0, sizeof(s->color_pairs)); + memset(s->color_quads, 0, sizeof(s->color_quads)); + memset(s->color_octets, 0, sizeof(s->color_octets)); + + /* Number of 4x4 blocks in frame. */ +- total_blocks = ((frame->width + 3) / 4) * ((frame->height + 3) / 4); ++ total_blocks = ((width + 3) / 4) * ((height + 3) / 4); + + pixel_ptr = row_ptr = src_pixels; + +@@ -145,11 +148,13 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame, + int cache_index; + int distinct = 0; + int blocks = 0; ++ int frame_y = cur_y; + + while (prev_pixels && s->key_frame == 0 && block_counter + inter_skip_blocks < total_blocks) { ++ const int y_size = FFMIN(4, height - cur_y); + int compare = 0; + +- for (int y = 0; y < 4; y++) { ++ for (int y = 0; y < y_size; y++) { + const ptrdiff_t offset = pixel_ptr - src_pixels; + const uint8_t *prev_pixel_ptr = prev_pixels + offset; + +@@ -170,8 +175,10 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame, + + pixel_ptr = xpixel_ptr; + row_ptr = xrow_ptr; ++ cur_y = frame_y; + + while (block_counter > 0 && block_counter + intra_skip_blocks < total_blocks) { ++ const int y_size = FFMIN(4, height - cur_y); + const ptrdiff_t offset = pixel_ptr - src_pixels; + const int sy = offset / stride; + const int sx = offset % stride; +@@ -180,7 +187,7 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame, + const uint8_t *old_pixel_ptr = src_pixels + nx + ny * stride; + int compare = 0; + +- for (int y = 0; y < 4; y++) { ++ for (int y = 0; y < y_size; y++) { + compare |= memcmp(old_pixel_ptr + y * stride, pixel_ptr + y * stride, 4); + if (compare) + break; +@@ -197,9 +204,11 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame, + + pixel_ptr = xpixel_ptr; + row_ptr = xrow_ptr; ++ cur_y = frame_y; + + while (block_counter + coded_blocks < total_blocks && coded_blocks < 256) { +- for (int y = 0; y < 4; y++) ++ const int y_size = FFMIN(4, height - cur_y); ++ for (int y = 0; y < y_size; y++) + memcpy(block_values + y * 4, pixel_ptr + y * stride, 4); + + qsort(block_values, 16, sizeof(block_values[0]), smc_cmp_values); +@@ -224,6 +233,7 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame, + + pixel_ptr = xpixel_ptr; + row_ptr = xrow_ptr; ++ cur_y = frame_y; + + blocks = coded_blocks; + distinct = coded_distinct; +-- +2.34.1 + diff --git a/poky/meta/recipes-multimedia/ffmpeg/ffmpeg_5.1.2.bb b/poky/meta/recipes-multimedia/ffmpeg/ffmpeg_5.1.2.bb index a0c98d4ae0..0f67c9e949 100644 --- a/poky/meta/recipes-multimedia/ffmpeg/ffmpeg_5.1.2.bb +++ b/poky/meta/recipes-multimedia/ffmpeg/ffmpeg_5.1.2.bb @@ -22,7 +22,11 @@ LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" -SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz" +SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ + file://0001-avcodec-rpzaenc-stop-accessing-out-of-bounds-frame.patch \ + file://0001-avcodec-smcenc-stop-accessing-out-of-bounds-frame.patch \ + " + SRC_URI[sha256sum] = "619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc" # Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717 @@ -138,6 +142,7 @@ EXTRA_OEMAKE = "V=1" do_configure() { ${S}/configure ${EXTRA_OECONF} + sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} --debug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR},g" ${B}/ffbuild/config.mak } # patch out build host paths for reproducibility diff --git a/poky/meta/recipes-multimedia/flac/flac_1.4.0.bb b/poky/meta/recipes-multimedia/flac/flac_1.4.0.bb deleted file mode 100644 index 360396380d..0000000000 --- a/poky/meta/recipes-multimedia/flac/flac_1.4.0.bb +++ /dev/null @@ -1,43 +0,0 @@ -SUMMARY = "Free Lossless Audio Codec" -DESCRIPTION = "FLAC stands for Free Lossless Audio Codec, a lossless audio compression format." -HOMEPAGE = "https://xiph.org/flac/" -BUGTRACKER = "https://github.com/xiph/flac/issues" -SECTION = "libs" -LICENSE = "GFDL-1.2 & GPL-2.0-or-later & LGPL-2.1-or-later & BSD-3-Clause" -LIC_FILES_CHKSUM = "file://COPYING.FDL;md5=ad1419ecc56e060eccf8184a87c4285f \ - file://src/Makefile.am;beginline=1;endline=17;md5=146d2c8c2fd287545cc1bd81f31e8758 \ - file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://src/flac/main.c;beginline=1;endline=18;md5=893456854ce6bf14a1a7ea77266eebab \ - file://COPYING.LGPL;md5=fbc093901857fcd118f065f900982c24 \ - file://src/plugin_common/all.h;beginline=1;endline=18;md5=73c74192ce89ee6238d15a171e00c971 \ - file://COPYING.Xiph;md5=3d6da238b5b57a0965d6730291119f65 \ - file://include/FLAC/all.h;beginline=65;endline=70;md5=64474f2b22e9e77b28d8b8b25c983a48" - -SRC_URI = "http://downloads.xiph.org/releases/flac/${BP}.tar.xz" -SRC_URI[sha256sum] = "af41c0733c93c237c3e52f64dd87e3b0d9af38259f1c7d11e8cbf583c48c2506" - -CVE_PRODUCT = "libflac flac" - -inherit autotools gettext - -EXTRA_OECONF = "--disable-oggtest \ - --disable-xmms-plugin \ - --without-libiconv-prefix \ - ac_cv_prog_NASM="" \ - " - -PACKAGECONFIG ??= " \ - ${@bb.utils.filter("TUNE_FEATURES", "altivec vsx", d)} \ - ${@bb.utils.contains_any("TUNE_FEATURES", "core2 corei7", "sse", "", d)} \ - ogg \ -" -PACKAGECONFIG[sse] = "--enable-sse,--disable-sse" -PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec" -PACKAGECONFIG[vsx] = "--enable-vsx,--disable-vsx" -PACKAGECONFIG[avx] = "--enable-avx,--disable-avx" -PACKAGECONFIG[ogg] = "--enable-ogg --with-ogg-libraries=${STAGING_LIBDIR} --with-ogg-includes=${STAGING_INCDIR},--disable-ogg,libogg" - -PACKAGES += "libflac libflac++" -FILES:${PN} = "${bindir}/*" -FILES:libflac = "${libdir}/libFLAC.so.*" -FILES:libflac++ = "${libdir}/libFLAC++.so.*" diff --git a/poky/meta/recipes-multimedia/flac/flac_1.4.2.bb b/poky/meta/recipes-multimedia/flac/flac_1.4.2.bb new file mode 100644 index 0000000000..d3ece3f3cf --- /dev/null +++ b/poky/meta/recipes-multimedia/flac/flac_1.4.2.bb @@ -0,0 +1,39 @@ +SUMMARY = "Free Lossless Audio Codec" +DESCRIPTION = "FLAC stands for Free Lossless Audio Codec, a lossless audio compression format." +HOMEPAGE = "https://xiph.org/flac/" +BUGTRACKER = "https://github.com/xiph/flac/issues" +SECTION = "libs" +LICENSE = "GFDL-1.2 & GPL-2.0-or-later & LGPL-2.1-or-later & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://COPYING.FDL;md5=ad1419ecc56e060eccf8184a87c4285f \ + file://src/Makefile.am;beginline=1;endline=17;md5=146d2c8c2fd287545cc1bd81f31e8758 \ + file://COPYING.GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://src/flac/main.c;beginline=1;endline=18;md5=893456854ce6bf14a1a7ea77266eebab \ + file://COPYING.LGPL;md5=fbc093901857fcd118f065f900982c24 \ + file://COPYING.Xiph;md5=3d6da238b5b57a0965d6730291119f65 \ + file://include/FLAC/all.h;beginline=65;endline=70;md5=39aaf5e03c7364363884c8b8ddda8eea" + +SRC_URI = "http://downloads.xiph.org/releases/flac/${BP}.tar.xz" +SRC_URI[sha256sum] = "e322d58a1f48d23d9dd38f432672865f6f79e73a6f9cc5a5f57fcaa83eb5a8e4" + +CVE_PRODUCT = "libflac flac" + +inherit autotools gettext + +EXTRA_OECONF = "--disable-oggtest \ + --without-libiconv-prefix \ + ac_cv_prog_NASM="" \ + " + +PACKAGECONFIG ??= " \ + ${@bb.utils.filter("TUNE_FEATURES", "altivec vsx", d)} \ + ogg \ +" +PACKAGECONFIG[altivec] = "--enable-altivec,--disable-altivec" +PACKAGECONFIG[vsx] = "--enable-vsx,--disable-vsx" +PACKAGECONFIG[avx] = "--enable-avx,--disable-avx" +PACKAGECONFIG[ogg] = "--enable-ogg --with-ogg-libraries=${STAGING_LIBDIR} --with-ogg-includes=${STAGING_INCDIR},--disable-ogg,libogg" + +PACKAGES += "libflac libflac++" +FILES:${PN} = "${bindir}/*" +FILES:libflac = "${libdir}/libFLAC.so.*" +FILES:libflac++ = "${libdir}/libFLAC++.so.*" diff --git a/poky/meta/recipes-multimedia/gstreamer/gst-devtools_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gst-devtools_1.20.4.bb deleted file mode 100644 index 09b6e5a497..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gst-devtools_1.20.4.bb +++ /dev/null @@ -1,52 +0,0 @@ -SUMMARY = "Gstreamer validation tool" -DESCRIPTION = "A Tool to test GStreamer components" -HOMEPAGE = "https://gstreamer.freedesktop.org/documentation/gst-devtools/index.html" -SECTION = "multimedia" - -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://validate/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" - -#S = "${WORKDIR}/gst-devtools-${PV}" - -SRC_URI = "https://gstreamer.freedesktop.org/src/gst-devtools/gst-devtools-${PV}.tar.xz \ - file://0001-connect-has-a-different-signature-on-musl.patch \ - " - -SRC_URI[sha256sum] = "82a293600273f4dd3eed567aae510ca0c7d629c3807788b00e6cdbd1d2459a84" - -DEPENDS = "json-glib glib-2.0 glib-2.0-native gstreamer1.0 gstreamer1.0-plugins-base" -RRECOMMENDS:${PN} = "git" - -FILES:${PN} += "${datadir}/gstreamer-1.0/* ${libdir}/gst-validate-launcher/* ${libdir}/gstreamer-1.0/*" - -inherit meson pkgconfig gettext upstream-version-is-even gobject-introspection - -# TODO: put this in a gettext.bbclass patch -def gettext_oemeson(d): - if d.getVar('USE_NLS') == 'no': - return '-Dnls=disabled' - # Remove the NLS bits if USE_NLS is no or INHIBIT_DEFAULT_DEPS is set - if d.getVar('INHIBIT_DEFAULT_DEPS') and not oe.utils.inherits(d, 'cross-canadian'): - return '-Dnls=disabled' - return '-Dnls=enabled' - -# Build GstValidateVideo -PACKAGECONFIG[cairo] = "-Dcairo=enabled,-Dcairo=disabled,cairo" - -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - -Ddebug_viewer=disabled \ - -Dtests=disabled \ - -Dvalidate=enabled \ - ${@gettext_oemeson(d)} \ -" - -do_install:append () { - for fn in ${bindir}/gst-validate-launcher \ - ${libdir}/gst-validate-launcher/python/launcher/config.py; do - sed -i -e 's,${B},/usr/src/debug/${PN},g' -e 's,${S},/usr/src/debug/${PN},g' ${D}$fn - done -} - -GIR_MESON_ENABLE_FLAG = "enabled" -GIR_MESON_DISABLE_FLAG = "disabled" diff --git a/poky/meta/recipes-multimedia/gstreamer/gst-devtools_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gst-devtools_1.20.5.bb new file mode 100644 index 0000000000..9db31c18e4 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gst-devtools_1.20.5.bb @@ -0,0 +1,52 @@ +SUMMARY = "Gstreamer validation tool" +DESCRIPTION = "A Tool to test GStreamer components" +HOMEPAGE = "https://gstreamer.freedesktop.org/documentation/gst-devtools/index.html" +SECTION = "multimedia" + +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://validate/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343" + +#S = "${WORKDIR}/gst-devtools-${PV}" + +SRC_URI = "https://gstreamer.freedesktop.org/src/gst-devtools/gst-devtools-${PV}.tar.xz \ + file://0001-connect-has-a-different-signature-on-musl.patch \ + " + +SRC_URI[sha256sum] = "5684436121b8bae07fd00b74395f95e44b5f26323dce4fa045fa665676807bba" + +DEPENDS = "json-glib glib-2.0 glib-2.0-native gstreamer1.0 gstreamer1.0-plugins-base" +RRECOMMENDS:${PN} = "git" + +FILES:${PN} += "${datadir}/gstreamer-1.0/* ${libdir}/gst-validate-launcher/* ${libdir}/gstreamer-1.0/*" + +inherit meson pkgconfig gettext upstream-version-is-even gobject-introspection + +# TODO: put this in a gettext.bbclass patch +def gettext_oemeson(d): + if d.getVar('USE_NLS') == 'no': + return '-Dnls=disabled' + # Remove the NLS bits if USE_NLS is no or INHIBIT_DEFAULT_DEPS is set + if d.getVar('INHIBIT_DEFAULT_DEPS') and not oe.utils.inherits(d, 'cross-canadian'): + return '-Dnls=disabled' + return '-Dnls=enabled' + +# Build GstValidateVideo +PACKAGECONFIG[cairo] = "-Dcairo=enabled,-Dcairo=disabled,cairo" + +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + -Ddebug_viewer=disabled \ + -Dtests=disabled \ + -Dvalidate=enabled \ + ${@gettext_oemeson(d)} \ +" + +do_install:append () { + for fn in ${bindir}/gst-validate-launcher \ + ${libdir}/gst-validate-launcher/python/launcher/config.py; do + sed -i -e 's,${B},/usr/src/debug/${PN},g' -e 's,${S},/usr/src/debug/${PN},g' ${D}$fn + done +} + +GIR_MESON_ENABLE_FLAG = "enabled" +GIR_MESON_DISABLE_FLAG = "disabled" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.4.bb deleted file mode 100644 index e23cf2e337..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.4.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "Libav-based GStreamer 1.x plugin" -DESCRIPTION = "Contains a GStreamer plugin for using the encoders, decoders, \ -muxers, and demuxers provided by FFmpeg." -HOMEPAGE = "http://gstreamer.freedesktop.org/" -SECTION = "multimedia" - -# ffmpeg has comercial license flags so add it as we need ffmpeg as a dependency -LICENSE_FLAGS = "commercial" -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770 \ - file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \ - " - -SRC_URI = "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz" -SRC_URI[sha256sum] = "04ccbdd58fb31dd94098da599209834a0e7661638c5703381dd0a862c56fc532" - -S = "${WORKDIR}/gst-libav-${PV}" - -DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base ffmpeg" - -inherit meson pkgconfig upstream-version-is-even - -EXTRA_OEMESON += " \ - -Dtests=disabled \ -" - -FILES:${PN} += "${libdir}/gstreamer-1.0/*.so" -FILES:${PN}-staticdev += "${libdir}/gstreamer-1.0/*.a" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.5.bb new file mode 100644 index 0000000000..e5925c6510 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.20.5.bb @@ -0,0 +1,28 @@ +SUMMARY = "Libav-based GStreamer 1.x plugin" +DESCRIPTION = "Contains a GStreamer plugin for using the encoders, decoders, \ +muxers, and demuxers provided by FFmpeg." +HOMEPAGE = "http://gstreamer.freedesktop.org/" +SECTION = "multimedia" + +# ffmpeg has comercial license flags so add it as we need ffmpeg as a dependency +LICENSE_FLAGS = "commercial" +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770 \ + file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \ + " + +SRC_URI = "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz" +SRC_URI[sha256sum] = "b152e3cc49d014899f53c39d8a6224a44e1399b4cf76aa5f9a903fdf9793c3cc" + +S = "${WORKDIR}/gst-libav-${PV}" + +DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base ffmpeg" + +inherit meson pkgconfig upstream-version-is-even + +EXTRA_OEMESON += " \ + -Dtests=disabled \ +" + +FILES:${PN} += "${libdir}/gstreamer-1.0/*.so" +FILES:${PN}-staticdev += "${libdir}/gstreamer-1.0/*.a" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.4.bb deleted file mode 100644 index 4d63db89a7..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.4.bb +++ /dev/null @@ -1,47 +0,0 @@ -SUMMARY = "OpenMAX IL plugins for GStreamer" -DESCRIPTION = "Wraps available OpenMAX IL components and makes them available as standard GStreamer elements." -HOMEPAGE = "http://gstreamer.freedesktop.org/" -SECTION = "multimedia" - -LICENSE = "LGPL-2.1-or-later" -LICENSE_FLAGS = "commercial" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \ - file://omx/gstomx.h;beginline=1;endline=21;md5=5c8e1fca32704488e76d2ba9ddfa935f" - -SRC_URI = "https://gstreamer.freedesktop.org/src/gst-omx/gst-omx-${PV}.tar.xz" - -SRC_URI[sha256sum] = "70ddd485e2dcab79070164d61ad2ff3a63e15a1d7abf9075d86eb77762b0edfd" - -S = "${WORKDIR}/gst-omx-${PV}" - -DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad virtual/libomxil" - -inherit meson pkgconfig upstream-version-is-even - -GSTREAMER_1_0_OMX_TARGET ?= "bellagio" -GSTREAMER_1_0_OMX_CORE_NAME ?= "${libdir}/libomxil-bellagio.so.0" - -EXTRA_OEMESON += "-Dtarget=${GSTREAMER_1_0_OMX_TARGET}" - -python __anonymous () { - omx_target = d.getVar("GSTREAMER_1_0_OMX_TARGET") - if omx_target in ['generic', 'bellagio']: - # Bellagio headers are incomplete (they are missing the OMX_VERSION_MAJOR,# - # OMX_VERSION_MINOR, OMX_VERSION_REVISION, and OMX_VERSION_STEP macros); - # appending a directory path to gst-omx' internal OpenMAX IL headers fixes this - d.appendVar("CFLAGS", " -I${S}/omx/openmax") - elif omx_target == "rpi": - # Dedicated Raspberry Pi OpenMAX IL support makes this package machine specific - d.setVar("PACKAGE_ARCH", d.getVar("MACHINE_ARCH")) -} - -set_omx_core_name() { - sed -i -e "s;^core-name=.*;core-name=${GSTREAMER_1_0_OMX_CORE_NAME};" "${D}${sysconfdir}/xdg/gstomx.conf" -} -do_install[postfuncs] += " set_omx_core_name " - -FILES:${PN} += "${libdir}/gstreamer-1.0/*.so" -FILES:${PN}-staticdev += "${libdir}/gstreamer-1.0/*.a" - -VIRTUAL-RUNTIME_libomxil ?= "libomxil" -RDEPENDS:${PN} = "${VIRTUAL-RUNTIME_libomxil}" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.5.bb new file mode 100644 index 0000000000..ec5efcd408 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.5.bb @@ -0,0 +1,47 @@ +SUMMARY = "OpenMAX IL plugins for GStreamer" +DESCRIPTION = "Wraps available OpenMAX IL components and makes them available as standard GStreamer elements." +HOMEPAGE = "http://gstreamer.freedesktop.org/" +SECTION = "multimedia" + +LICENSE = "LGPL-2.1-or-later" +LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \ + file://omx/gstomx.h;beginline=1;endline=21;md5=5c8e1fca32704488e76d2ba9ddfa935f" + +SRC_URI = "https://gstreamer.freedesktop.org/src/gst-omx/gst-omx-${PV}.tar.xz" + +SRC_URI[sha256sum] = "bcccbc02548cdc123fd49944dd44a4f1adc5d107e36f010d320eb526e2107806" + +S = "${WORKDIR}/gst-omx-${PV}" + +DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad virtual/libomxil" + +inherit meson pkgconfig upstream-version-is-even + +GSTREAMER_1_0_OMX_TARGET ?= "bellagio" +GSTREAMER_1_0_OMX_CORE_NAME ?= "${libdir}/libomxil-bellagio.so.0" + +EXTRA_OEMESON += "-Dtarget=${GSTREAMER_1_0_OMX_TARGET}" + +python __anonymous () { + omx_target = d.getVar("GSTREAMER_1_0_OMX_TARGET") + if omx_target in ['generic', 'bellagio']: + # Bellagio headers are incomplete (they are missing the OMX_VERSION_MAJOR,# + # OMX_VERSION_MINOR, OMX_VERSION_REVISION, and OMX_VERSION_STEP macros); + # appending a directory path to gst-omx' internal OpenMAX IL headers fixes this + d.appendVar("CFLAGS", " -I${S}/omx/openmax") + elif omx_target == "rpi": + # Dedicated Raspberry Pi OpenMAX IL support makes this package machine specific + d.setVar("PACKAGE_ARCH", d.getVar("MACHINE_ARCH")) +} + +set_omx_core_name() { + sed -i -e "s;^core-name=.*;core-name=${GSTREAMER_1_0_OMX_CORE_NAME};" "${D}${sysconfdir}/xdg/gstomx.conf" +} +do_install[postfuncs] += " set_omx_core_name " + +FILES:${PN} += "${libdir}/gstreamer-1.0/*.so" +FILES:${PN}-staticdev += "${libdir}/gstreamer-1.0/*.a" + +VIRTUAL-RUNTIME_libomxil ?= "libomxil" +RDEPENDS:${PN} = "${VIRTUAL-RUNTIME_libomxil}" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.4.bb deleted file mode 100644 index 0eac1322a3..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.4.bb +++ /dev/null @@ -1,165 +0,0 @@ -require gstreamer1.0-plugins-common.inc -require gstreamer1.0-plugins-license.inc - -DESCRIPTION = "'Bad' GStreamer plugins and helper libraries " -HOMEPAGE = "https://gstreamer.freedesktop.org/" -BUGTRACKER = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues" - -SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-${PV}.tar.xz \ - file://0001-fix-maybe-uninitialized-warnings-when-compiling-with.patch \ - file://0002-avoid-including-sys-poll.h-directly.patch \ - file://0004-opencv-resolve-missing-opencv-data-dir-in-yocto-buil.patch \ - " -SRC_URI[sha256sum] = "a1a3f53b3604d9a04fdd0bf9a1a616c3d2dab5320489e9ecee1178e81e33a16a" - -S = "${WORKDIR}/gst-plugins-bad-${PV}" - -LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" - -DEPENDS += "gstreamer1.0-plugins-base" - -inherit gobject-introspection - -PACKAGECONFIG ??= " \ - ${GSTREAMER_ORC} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan x11', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gl', '', d)} \ - bz2 closedcaption curl dash dtls hls openssl sbc smoothstreaming \ - sndfile ttml uvch264 webp \ - ${@bb.utils.contains('TUNE_FEATURES', 'mx32', '', 'rsvg', d)} \ -" - -PACKAGECONFIG[aom] = "-Daom=enabled,-Daom=disabled,aom" -PACKAGECONFIG[assrender] = "-Dassrender=enabled,-Dassrender=disabled,libass" -PACKAGECONFIG[avtp] = "-Davtp=enabled,-Davtp=disabled,libavtp" -PACKAGECONFIG[bluez] = "-Dbluez=enabled,-Dbluez=disabled,bluez5" -PACKAGECONFIG[bz2] = "-Dbz2=enabled,-Dbz2=disabled,bzip2" -PACKAGECONFIG[closedcaption] = "-Dclosedcaption=enabled,-Dclosedcaption=disabled,pango cairo" -PACKAGECONFIG[curl] = "-Dcurl=enabled,-Dcurl=disabled,curl" -PACKAGECONFIG[dash] = "-Ddash=enabled,-Ddash=disabled,libxml2" -PACKAGECONFIG[dc1394] = "-Ddc1394=enabled,-Ddc1394=disabled,libdc1394" -PACKAGECONFIG[directfb] = "-Ddirectfb=enabled,-Ddirectfb=disabled,directfb" -PACKAGECONFIG[dtls] = "-Ddtls=enabled,-Ddtls=disabled,openssl" -PACKAGECONFIG[faac] = "-Dfaac=enabled,-Dfaac=disabled,faac" -PACKAGECONFIG[faad] = "-Dfaad=enabled,-Dfaad=disabled,faad2" -PACKAGECONFIG[fluidsynth] = "-Dfluidsynth=enabled,-Dfluidsynth=disabled,fluidsynth" -PACKAGECONFIG[hls] = "-Dhls=enabled,-Dhls=disabled," -# Pick atleast one crypto backend below when enabling hls -PACKAGECONFIG[nettle] = "-Dhls-crypto=nettle,,nettle" -PACKAGECONFIG[openssl] = "-Dhls-crypto=openssl,,openssl" -PACKAGECONFIG[gcrypt] = "-Dhls-crypto=libgcrypt,,libgcrypt" -# the gl packageconfig enables OpenGL elements that haven't been ported -# to -base yet. They depend on the gstgl library in -base, so we do -# not add GL dependencies here, since these are taken care of in -base. -PACKAGECONFIG[gl] = "-Dgl=enabled,-Dgl=disabled," -PACKAGECONFIG[kms] = "-Dkms=enabled,-Dkms=disabled,libdrm" -PACKAGECONFIG[libde265] = "-Dlibde265=enabled,-Dlibde265=disabled,libde265" -PACKAGECONFIG[libssh2] = "-Dcurl-ssh2=enabled,-Dcurl-ssh2=disabled,libssh2" -PACKAGECONFIG[lcms2] = "-Dcolormanagement=enabled,-Dcolormanagement=disabled,lcms" -PACKAGECONFIG[modplug] = "-Dmodplug=enabled,-Dmodplug=disabled,libmodplug" -PACKAGECONFIG[msdk] = "-Dmsdk=enabled,-Dmsdk=disabled,intel-mediasdk" -PACKAGECONFIG[neon] = "-Dneon=enabled,-Dneon=disabled,neon" -PACKAGECONFIG[openal] = "-Dopenal=enabled,-Dopenal=disabled,openal-soft" -PACKAGECONFIG[opencv] = "-Dopencv=enabled,-Dopencv=disabled,opencv" -PACKAGECONFIG[openh264] = "-Dopenh264=enabled,-Dopenh264=disabled,openh264" -PACKAGECONFIG[openjpeg] = "-Dopenjpeg=enabled,-Dopenjpeg=disabled,openjpeg" -PACKAGECONFIG[openmpt] = "-Dopenmpt=enabled,-Dopenmpt=disabled,libopenmpt" -# the opus encoder/decoder elements are now in the -base package, -# but the opus parser remains in -bad -PACKAGECONFIG[opusparse] = "-Dopus=enabled,-Dopus=disabled,libopus" -PACKAGECONFIG[resindvd] = "-Dresindvd=enabled,-Dresindvd=disabled,libdvdread libdvdnav" -PACKAGECONFIG[rsvg] = "-Drsvg=enabled,-Drsvg=disabled,librsvg" -PACKAGECONFIG[rtmp] = "-Drtmp=enabled,-Drtmp=disabled,rtmpdump" -PACKAGECONFIG[sbc] = "-Dsbc=enabled,-Dsbc=disabled,sbc" -PACKAGECONFIG[sctp] = "-Dsctp=enabled,-Dsctp=disabled" -PACKAGECONFIG[smoothstreaming] = "-Dsmoothstreaming=enabled,-Dsmoothstreaming=disabled,libxml2" -PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1" -PACKAGECONFIG[srt] = "-Dsrt=enabled,-Dsrt=disabled,srt" -PACKAGECONFIG[srtp] = "-Dsrtp=enabled,-Dsrtp=disabled,libsrtp" -PACKAGECONFIG[tinyalsa] = "-Dtinyalsa=enabled,-Dtinyalsa=disabled,tinyalsa" -PACKAGECONFIG[ttml] = "-Dttml=enabled,-Dttml=disabled,libxml2 pango cairo" -PACKAGECONFIG[uvch264] = "-Duvch264=enabled,-Duvch264=disabled,libusb1 libgudev" -# this enables support for stateless V4L2 mem2mem codecs, which is a newer form of -# V4L2 codec; the V4L2 code in -base supports the older stateful V4L2 mem2mem codecs -PACKAGECONFIG[v4l2codecs] = "-Dv4l2codecs=enabled,-Dv4l2codecs=disabled,libgudev" -PACKAGECONFIG[va] = "-Dva=enabled,-Dva=disabled,libva" -PACKAGECONFIG[voaacenc] = "-Dvoaacenc=enabled,-Dvoaacenc=disabled,vo-aacenc" -PACKAGECONFIG[voamrwbenc] = "-Dvoamrwbenc=enabled,-Dvoamrwbenc=disabled,vo-amrwbenc" -PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled,vulkan-loader shaderc-native" -PACKAGECONFIG[wayland] = "-Dwayland=enabled,-Dwayland=disabled,wayland-native wayland wayland-protocols libdrm" -PACKAGECONFIG[webp] = "-Dwebp=enabled,-Dwebp=disabled,libwebp" -PACKAGECONFIG[webrtc] = "-Dwebrtc=enabled,-Dwebrtc=disabled,libnice" -PACKAGECONFIG[webrtcdsp] = "-Dwebrtcdsp=enabled,-Dwebrtcdsp=disabled,webrtc-audio-processing" -PACKAGECONFIG[zbar] = "-Dzbar=enabled,-Dzbar=disabled,zbar" -PACKAGECONFIG[x11] = "-Dx11=enabled,-Dx11=disabled,libxcb libxkbcommon" -PACKAGECONFIG[x265] = "-Dx265=enabled,-Dx265=disabled,x265" - -GSTREAMER_GPL = "${@bb.utils.filter('PACKAGECONFIG', 'faad resindvd x265', d)}" - -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - -Daes=enabled \ - -Dcodecalpha=enabled \ - -Ddecklink=enabled \ - -Ddvb=enabled \ - -Dfbdev=enabled \ - -Dipcpipeline=enabled \ - -Dshm=enabled \ - -Dtranscode=enabled \ - -Dandroidmedia=disabled \ - -Dapplemedia=disabled \ - -Dasio=disabled \ - -Dbs2b=disabled \ - -Dchromaprint=disabled \ - -Dd3dvideosink=disabled \ - -Dd3d11=disabled \ - -Ddirectsound=disabled \ - -Ddts=disabled \ - -Dfdkaac=disabled \ - -Dflite=disabled \ - -Dgme=disabled \ - -Dgs=disabled \ - -Dgsm=disabled \ - -Diqa=disabled \ - -Dkate=disabled \ - -Dladspa=disabled \ - -Dldac=disabled \ - -Dlv2=disabled \ - -Dmagicleap=disabled \ - -Dmediafoundation=disabled \ - -Dmicrodns=disabled \ - -Dmpeg2enc=disabled \ - -Dmplex=disabled \ - -Dmusepack=disabled \ - -Dnvcodec=disabled \ - -Dopenexr=disabled \ - -Dopenni2=disabled \ - -Dopenaptx=disabled \ - -Dopensles=disabled \ - -Donnx=disabled \ - -Dqroverlay=disabled \ - -Dsoundtouch=disabled \ - -Dspandsp=disabled \ - -Dsvthevcenc=disabled \ - -Dteletext=disabled \ - -Dwasapi=disabled \ - -Dwasapi2=disabled \ - -Dwildmidi=disabled \ - -Dwinks=disabled \ - -Dwinscreencap=disabled \ - -Dwpe=disabled \ - -Dzxing=disabled \ -" - -export OPENCV_PREFIX = "${STAGING_DIR_TARGET}${prefix}" - -ARM_INSTRUCTION_SET:armv4 = "arm" -ARM_INSTRUCTION_SET:armv5 = "arm" - -FILES:${PN}-freeverb += "${datadir}/gstreamer-1.0/presets/GstFreeverb.prs" -FILES:${PN}-opencv += "${datadir}/gst-plugins-bad/1.0/opencv*" -FILES:${PN}-transcode += "${datadir}/gstreamer-1.0/encoding-profiles" -FILES:${PN}-voamrwbenc += "${datadir}/gstreamer-1.0/presets/GstVoAmrwbEnc.prs" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.5.bb new file mode 100644 index 0000000000..2f1793d1ce --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.5.bb @@ -0,0 +1,165 @@ +require gstreamer1.0-plugins-common.inc +require gstreamer1.0-plugins-license.inc + +DESCRIPTION = "'Bad' GStreamer plugins and helper libraries " +HOMEPAGE = "https://gstreamer.freedesktop.org/" +BUGTRACKER = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues" + +SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-${PV}.tar.xz \ + file://0001-fix-maybe-uninitialized-warnings-when-compiling-with.patch \ + file://0002-avoid-including-sys-poll.h-directly.patch \ + file://0004-opencv-resolve-missing-opencv-data-dir-in-yocto-buil.patch \ + " +SRC_URI[sha256sum] = "f431214b0754d7037adcde93c3195106196588973e5b32dcb24938805f866363" + +S = "${WORKDIR}/gst-plugins-bad-${PV}" + +LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" + +DEPENDS += "gstreamer1.0-plugins-base" + +inherit gobject-introspection + +PACKAGECONFIG ??= " \ + ${GSTREAMER_ORC} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan x11', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gl', '', d)} \ + bz2 closedcaption curl dash dtls hls openssl sbc smoothstreaming \ + sndfile ttml uvch264 webp \ + ${@bb.utils.contains('TUNE_FEATURES', 'mx32', '', 'rsvg', d)} \ +" + +PACKAGECONFIG[aom] = "-Daom=enabled,-Daom=disabled,aom" +PACKAGECONFIG[assrender] = "-Dassrender=enabled,-Dassrender=disabled,libass" +PACKAGECONFIG[avtp] = "-Davtp=enabled,-Davtp=disabled,libavtp" +PACKAGECONFIG[bluez] = "-Dbluez=enabled,-Dbluez=disabled,bluez5" +PACKAGECONFIG[bz2] = "-Dbz2=enabled,-Dbz2=disabled,bzip2" +PACKAGECONFIG[closedcaption] = "-Dclosedcaption=enabled,-Dclosedcaption=disabled,pango cairo" +PACKAGECONFIG[curl] = "-Dcurl=enabled,-Dcurl=disabled,curl" +PACKAGECONFIG[dash] = "-Ddash=enabled,-Ddash=disabled,libxml2" +PACKAGECONFIG[dc1394] = "-Ddc1394=enabled,-Ddc1394=disabled,libdc1394" +PACKAGECONFIG[directfb] = "-Ddirectfb=enabled,-Ddirectfb=disabled,directfb" +PACKAGECONFIG[dtls] = "-Ddtls=enabled,-Ddtls=disabled,openssl" +PACKAGECONFIG[faac] = "-Dfaac=enabled,-Dfaac=disabled,faac" +PACKAGECONFIG[faad] = "-Dfaad=enabled,-Dfaad=disabled,faad2" +PACKAGECONFIG[fluidsynth] = "-Dfluidsynth=enabled,-Dfluidsynth=disabled,fluidsynth" +PACKAGECONFIG[hls] = "-Dhls=enabled,-Dhls=disabled," +# Pick atleast one crypto backend below when enabling hls +PACKAGECONFIG[nettle] = "-Dhls-crypto=nettle,,nettle" +PACKAGECONFIG[openssl] = "-Dhls-crypto=openssl,,openssl" +PACKAGECONFIG[gcrypt] = "-Dhls-crypto=libgcrypt,,libgcrypt" +# the gl packageconfig enables OpenGL elements that haven't been ported +# to -base yet. They depend on the gstgl library in -base, so we do +# not add GL dependencies here, since these are taken care of in -base. +PACKAGECONFIG[gl] = "-Dgl=enabled,-Dgl=disabled," +PACKAGECONFIG[kms] = "-Dkms=enabled,-Dkms=disabled,libdrm" +PACKAGECONFIG[libde265] = "-Dlibde265=enabled,-Dlibde265=disabled,libde265" +PACKAGECONFIG[libssh2] = "-Dcurl-ssh2=enabled,-Dcurl-ssh2=disabled,libssh2" +PACKAGECONFIG[lcms2] = "-Dcolormanagement=enabled,-Dcolormanagement=disabled,lcms" +PACKAGECONFIG[modplug] = "-Dmodplug=enabled,-Dmodplug=disabled,libmodplug" +PACKAGECONFIG[msdk] = "-Dmsdk=enabled,-Dmsdk=disabled,intel-mediasdk" +PACKAGECONFIG[neon] = "-Dneon=enabled,-Dneon=disabled,neon" +PACKAGECONFIG[openal] = "-Dopenal=enabled,-Dopenal=disabled,openal-soft" +PACKAGECONFIG[opencv] = "-Dopencv=enabled,-Dopencv=disabled,opencv" +PACKAGECONFIG[openh264] = "-Dopenh264=enabled,-Dopenh264=disabled,openh264" +PACKAGECONFIG[openjpeg] = "-Dopenjpeg=enabled,-Dopenjpeg=disabled,openjpeg" +PACKAGECONFIG[openmpt] = "-Dopenmpt=enabled,-Dopenmpt=disabled,libopenmpt" +# the opus encoder/decoder elements are now in the -base package, +# but the opus parser remains in -bad +PACKAGECONFIG[opusparse] = "-Dopus=enabled,-Dopus=disabled,libopus" +PACKAGECONFIG[resindvd] = "-Dresindvd=enabled,-Dresindvd=disabled,libdvdread libdvdnav" +PACKAGECONFIG[rsvg] = "-Drsvg=enabled,-Drsvg=disabled,librsvg" +PACKAGECONFIG[rtmp] = "-Drtmp=enabled,-Drtmp=disabled,rtmpdump" +PACKAGECONFIG[sbc] = "-Dsbc=enabled,-Dsbc=disabled,sbc" +PACKAGECONFIG[sctp] = "-Dsctp=enabled,-Dsctp=disabled" +PACKAGECONFIG[smoothstreaming] = "-Dsmoothstreaming=enabled,-Dsmoothstreaming=disabled,libxml2" +PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1" +PACKAGECONFIG[srt] = "-Dsrt=enabled,-Dsrt=disabled,srt" +PACKAGECONFIG[srtp] = "-Dsrtp=enabled,-Dsrtp=disabled,libsrtp" +PACKAGECONFIG[tinyalsa] = "-Dtinyalsa=enabled,-Dtinyalsa=disabled,tinyalsa" +PACKAGECONFIG[ttml] = "-Dttml=enabled,-Dttml=disabled,libxml2 pango cairo" +PACKAGECONFIG[uvch264] = "-Duvch264=enabled,-Duvch264=disabled,libusb1 libgudev" +# this enables support for stateless V4L2 mem2mem codecs, which is a newer form of +# V4L2 codec; the V4L2 code in -base supports the older stateful V4L2 mem2mem codecs +PACKAGECONFIG[v4l2codecs] = "-Dv4l2codecs=enabled,-Dv4l2codecs=disabled,libgudev" +PACKAGECONFIG[va] = "-Dva=enabled,-Dva=disabled,libva" +PACKAGECONFIG[voaacenc] = "-Dvoaacenc=enabled,-Dvoaacenc=disabled,vo-aacenc" +PACKAGECONFIG[voamrwbenc] = "-Dvoamrwbenc=enabled,-Dvoamrwbenc=disabled,vo-amrwbenc" +PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled,vulkan-loader shaderc-native" +PACKAGECONFIG[wayland] = "-Dwayland=enabled,-Dwayland=disabled,wayland-native wayland wayland-protocols libdrm" +PACKAGECONFIG[webp] = "-Dwebp=enabled,-Dwebp=disabled,libwebp" +PACKAGECONFIG[webrtc] = "-Dwebrtc=enabled,-Dwebrtc=disabled,libnice" +PACKAGECONFIG[webrtcdsp] = "-Dwebrtcdsp=enabled,-Dwebrtcdsp=disabled,webrtc-audio-processing" +PACKAGECONFIG[zbar] = "-Dzbar=enabled,-Dzbar=disabled,zbar" +PACKAGECONFIG[x11] = "-Dx11=enabled,-Dx11=disabled,libxcb libxkbcommon" +PACKAGECONFIG[x265] = "-Dx265=enabled,-Dx265=disabled,x265" + +GSTREAMER_GPL = "${@bb.utils.filter('PACKAGECONFIG', 'faad resindvd x265', d)}" + +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + -Daes=enabled \ + -Dcodecalpha=enabled \ + -Ddecklink=enabled \ + -Ddvb=enabled \ + -Dfbdev=enabled \ + -Dipcpipeline=enabled \ + -Dshm=enabled \ + -Dtranscode=enabled \ + -Dandroidmedia=disabled \ + -Dapplemedia=disabled \ + -Dasio=disabled \ + -Dbs2b=disabled \ + -Dchromaprint=disabled \ + -Dd3dvideosink=disabled \ + -Dd3d11=disabled \ + -Ddirectsound=disabled \ + -Ddts=disabled \ + -Dfdkaac=disabled \ + -Dflite=disabled \ + -Dgme=disabled \ + -Dgs=disabled \ + -Dgsm=disabled \ + -Diqa=disabled \ + -Dkate=disabled \ + -Dladspa=disabled \ + -Dldac=disabled \ + -Dlv2=disabled \ + -Dmagicleap=disabled \ + -Dmediafoundation=disabled \ + -Dmicrodns=disabled \ + -Dmpeg2enc=disabled \ + -Dmplex=disabled \ + -Dmusepack=disabled \ + -Dnvcodec=disabled \ + -Dopenexr=disabled \ + -Dopenni2=disabled \ + -Dopenaptx=disabled \ + -Dopensles=disabled \ + -Donnx=disabled \ + -Dqroverlay=disabled \ + -Dsoundtouch=disabled \ + -Dspandsp=disabled \ + -Dsvthevcenc=disabled \ + -Dteletext=disabled \ + -Dwasapi=disabled \ + -Dwasapi2=disabled \ + -Dwildmidi=disabled \ + -Dwinks=disabled \ + -Dwinscreencap=disabled \ + -Dwpe=disabled \ + -Dzxing=disabled \ +" + +export OPENCV_PREFIX = "${STAGING_DIR_TARGET}${prefix}" + +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" + +FILES:${PN}-freeverb += "${datadir}/gstreamer-1.0/presets/GstFreeverb.prs" +FILES:${PN}-opencv += "${datadir}/gst-plugins-bad/1.0/opencv*" +FILES:${PN}-transcode += "${datadir}/gstreamer-1.0/encoding-profiles" +FILES:${PN}-voamrwbenc += "${datadir}/gstreamer-1.0/presets/GstVoAmrwbEnc.prs" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.4.bb deleted file mode 100644 index a0f238a59d..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.4.bb +++ /dev/null @@ -1,94 +0,0 @@ -require gstreamer1.0-plugins-common.inc - -DESCRIPTION = "'Base' GStreamer plugins and helper libraries" -HOMEPAGE = "https://gstreamer.freedesktop.org/" -BUGTRACKER = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues" -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770" - -SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-${PV}.tar.xz \ - file://0001-ENGR00312515-get-caps-from-src-pad-when-query-caps.patch \ - file://0003-viv-fb-Make-sure-config.h-is-included.patch \ - file://0002-ssaparse-enhance-SSA-text-lines-parsing.patch \ - " -SRC_URI[sha256sum] = "8d181b7abe4caf23ee9f9ec5b4d3e232640452464e39495bfffb6d776fc97225" - -S = "${WORKDIR}/gst-plugins-base-${PV}" - -DEPENDS += "iso-codes util-linux zlib" - -inherit gobject-introspection - -# opengl packageconfig factored out to make it easy for distros -# and BSP layers to choose OpenGL APIs/platforms/window systems -PACKAGECONFIG_GL ?= "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gles2 egl', '', d)}" - -PACKAGECONFIG ??= " \ - ${GSTREAMER_ORC} \ - ${PACKAGECONFIG_GL} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'alsa x11', d)} \ - jpeg ogg pango png theora vorbis \ - ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} \ -" - -OPENGL_APIS = 'opengl gles2' -OPENGL_PLATFORMS = 'egl' - -X11DEPENDS = "virtual/libx11 libsm libxrender libxv" -X11ENABLEOPTS = "-Dx11=enabled -Dxvideo=enabled -Dxshm=enabled" -X11DISABLEOPTS = "-Dx11=disabled -Dxvideo=disabled -Dxshm=disabled" - -PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib" -PACKAGECONFIG[cdparanoia] = "-Dcdparanoia=enabled,-Dcdparanoia=disabled,cdparanoia" -PACKAGECONFIG[graphene] = "-Dgl-graphene=enabled,-Dgl-graphene=disabled,graphene" -PACKAGECONFIG[jpeg] = "-Dgl-jpeg=enabled,-Dgl-jpeg=disabled,jpeg" -PACKAGECONFIG[ogg] = "-Dogg=enabled,-Dogg=disabled,libogg" -PACKAGECONFIG[opus] = "-Dopus=enabled,-Dopus=disabled,libopus" -PACKAGECONFIG[pango] = "-Dpango=enabled,-Dpango=disabled,pango" -PACKAGECONFIG[png] = "-Dgl-png=enabled,-Dgl-png=disabled,libpng" -# This enables Qt5 QML examples in -base. The Qt5 GStreamer -# qmlglsink and qmlglsrc plugins still exist in -good. -PACKAGECONFIG[qt5] = "-Dqt5=enabled,-Dqt5=disabled,qtbase qtdeclarative qtbase-native" -PACKAGECONFIG[theora] = "-Dtheora=enabled,-Dtheora=disabled,libtheora" -PACKAGECONFIG[tremor] = "-Dtremor=enabled,-Dtremor=disabled,tremor" -PACKAGECONFIG[visual] = "-Dlibvisual=enabled,-Dlibvisual=disabled,libvisual" -PACKAGECONFIG[vorbis] = "-Dvorbis=enabled,-Dvorbis=disabled,libvorbis" -PACKAGECONFIG[x11] = "${X11ENABLEOPTS},${X11DISABLEOPTS},${X11DEPENDS}" - -# OpenGL API packageconfigs -PACKAGECONFIG[opengl] = ",,virtual/libgl libglu" -PACKAGECONFIG[gles2] = ",,virtual/libgles2" - -# OpenGL platform packageconfigs -PACKAGECONFIG[egl] = ",,virtual/egl" - -# OpenGL window systems (except for X11) -PACKAGECONFIG[gbm] = ",,virtual/libgbm libgudev libdrm" -PACKAGECONFIG[wayland] = ",,wayland-native wayland wayland-protocols libdrm" -PACKAGECONFIG[dispmanx] = ",,virtual/libomxil" -PACKAGECONFIG[viv-fb] = ",,virtual/libgles2 virtual/libg2d" - -OPENGL_WINSYS = "${@bb.utils.filter('PACKAGECONFIG', 'x11 gbm wayland dispmanx egl viv-fb', d)}" - -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - ${@get_opengl_cmdline_list('gl_api', d.getVar('OPENGL_APIS'), d)} \ - ${@get_opengl_cmdline_list('gl_platform', d.getVar('OPENGL_PLATFORMS'), d)} \ - ${@get_opengl_cmdline_list('gl_winsys', d.getVar('OPENGL_WINSYS'), d)} \ -" - -FILES:${PN}-dev += "${libdir}/gstreamer-1.0/include/gst/gl/gstglconfig.h" -FILES:${MLPREFIX}libgsttag-1.0 += "${datadir}/gst-plugins-base/1.0/license-translations.dict" - -def get_opengl_cmdline_list(switch_name, options, d): - selected_options = [] - if bb.utils.contains('DISTRO_FEATURES', 'opengl', True, False, d): - for option in options.split(): - if bb.utils.contains('PACKAGECONFIG', option, True, False, d): - selected_options += [option] - if selected_options: - return '-D' + switch_name + '=' + ','.join(selected_options) - else: - return '' - -CVE_PRODUCT += "gst-plugins-base" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.5.bb new file mode 100644 index 0000000000..c37b542c57 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.5.bb @@ -0,0 +1,94 @@ +require gstreamer1.0-plugins-common.inc + +DESCRIPTION = "'Base' GStreamer plugins and helper libraries" +HOMEPAGE = "https://gstreamer.freedesktop.org/" +BUGTRACKER = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues" +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770" + +SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-${PV}.tar.xz \ + file://0001-ENGR00312515-get-caps-from-src-pad-when-query-caps.patch \ + file://0003-viv-fb-Make-sure-config.h-is-included.patch \ + file://0002-ssaparse-enhance-SSA-text-lines-parsing.patch \ + " +SRC_URI[sha256sum] = "11f911ef65f3095d7cf698a1ad1fc5242ac3ad6c9270465fb5c9e7f4f9c19b35" + +S = "${WORKDIR}/gst-plugins-base-${PV}" + +DEPENDS += "iso-codes util-linux zlib" + +inherit gobject-introspection + +# opengl packageconfig factored out to make it easy for distros +# and BSP layers to choose OpenGL APIs/platforms/window systems +PACKAGECONFIG_GL ?= "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gles2 egl', '', d)}" + +PACKAGECONFIG ??= " \ + ${GSTREAMER_ORC} \ + ${PACKAGECONFIG_GL} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'alsa x11', d)} \ + jpeg ogg pango png theora vorbis \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} \ +" + +OPENGL_APIS = 'opengl gles2' +OPENGL_PLATFORMS = 'egl' + +X11DEPENDS = "virtual/libx11 libsm libxrender libxv" +X11ENABLEOPTS = "-Dx11=enabled -Dxvideo=enabled -Dxshm=enabled" +X11DISABLEOPTS = "-Dx11=disabled -Dxvideo=disabled -Dxshm=disabled" + +PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib" +PACKAGECONFIG[cdparanoia] = "-Dcdparanoia=enabled,-Dcdparanoia=disabled,cdparanoia" +PACKAGECONFIG[graphene] = "-Dgl-graphene=enabled,-Dgl-graphene=disabled,graphene" +PACKAGECONFIG[jpeg] = "-Dgl-jpeg=enabled,-Dgl-jpeg=disabled,jpeg" +PACKAGECONFIG[ogg] = "-Dogg=enabled,-Dogg=disabled,libogg" +PACKAGECONFIG[opus] = "-Dopus=enabled,-Dopus=disabled,libopus" +PACKAGECONFIG[pango] = "-Dpango=enabled,-Dpango=disabled,pango" +PACKAGECONFIG[png] = "-Dgl-png=enabled,-Dgl-png=disabled,libpng" +# This enables Qt5 QML examples in -base. The Qt5 GStreamer +# qmlglsink and qmlglsrc plugins still exist in -good. +PACKAGECONFIG[qt5] = "-Dqt5=enabled,-Dqt5=disabled,qtbase qtdeclarative qtbase-native" +PACKAGECONFIG[theora] = "-Dtheora=enabled,-Dtheora=disabled,libtheora" +PACKAGECONFIG[tremor] = "-Dtremor=enabled,-Dtremor=disabled,tremor" +PACKAGECONFIG[visual] = "-Dlibvisual=enabled,-Dlibvisual=disabled,libvisual" +PACKAGECONFIG[vorbis] = "-Dvorbis=enabled,-Dvorbis=disabled,libvorbis" +PACKAGECONFIG[x11] = "${X11ENABLEOPTS},${X11DISABLEOPTS},${X11DEPENDS}" + +# OpenGL API packageconfigs +PACKAGECONFIG[opengl] = ",,virtual/libgl libglu" +PACKAGECONFIG[gles2] = ",,virtual/libgles2" + +# OpenGL platform packageconfigs +PACKAGECONFIG[egl] = ",,virtual/egl" + +# OpenGL window systems (except for X11) +PACKAGECONFIG[gbm] = ",,virtual/libgbm libgudev libdrm" +PACKAGECONFIG[wayland] = ",,wayland-native wayland wayland-protocols libdrm" +PACKAGECONFIG[dispmanx] = ",,virtual/libomxil" +PACKAGECONFIG[viv-fb] = ",,virtual/libgles2 virtual/libg2d" + +OPENGL_WINSYS = "${@bb.utils.filter('PACKAGECONFIG', 'x11 gbm wayland dispmanx egl viv-fb', d)}" + +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + ${@get_opengl_cmdline_list('gl_api', d.getVar('OPENGL_APIS'), d)} \ + ${@get_opengl_cmdline_list('gl_platform', d.getVar('OPENGL_PLATFORMS'), d)} \ + ${@get_opengl_cmdline_list('gl_winsys', d.getVar('OPENGL_WINSYS'), d)} \ +" + +FILES:${PN}-dev += "${libdir}/gstreamer-1.0/include/gst/gl/gstglconfig.h" +FILES:${MLPREFIX}libgsttag-1.0 += "${datadir}/gst-plugins-base/1.0/license-translations.dict" + +def get_opengl_cmdline_list(switch_name, options, d): + selected_options = [] + if bb.utils.contains('DISTRO_FEATURES', 'opengl', True, False, d): + for option in options.split(): + if bb.utils.contains('PACKAGECONFIG', option, True, False, d): + selected_options += [option] + if selected_options: + return '-D' + switch_name + '=' + ','.join(selected_options) + else: + return '' + +CVE_PRODUCT += "gst-plugins-base" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.4.bb deleted file mode 100644 index f690735989..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.4.bb +++ /dev/null @@ -1,85 +0,0 @@ -require gstreamer1.0-plugins-common.inc - -DESCRIPTION = "'Good' GStreamer plugins" -HOMEPAGE = "https://gstreamer.freedesktop.org/" -BUGTRACKER = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues" - -SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-${PV}.tar.xz \ - file://0001-qt-include-ext-qt-gstqtgl.h-instead-of-gst-gl-gstglf.patch \ - " - -SRC_URI[sha256sum] = "b16130fbe632fa8547c2147a0ef575b0140fb521065c5cb121c72ddbd23b64da" - -S = "${WORKDIR}/gst-plugins-good-${PV}" - -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ - file://gst/replaygain/rganalysis.c;beginline=1;endline=23;md5=b60ebefd5b2f5a8e0cab6bfee391a5fe" - -DEPENDS += "gstreamer1.0-plugins-base libcap zlib" -RPROVIDES:${PN}-pulseaudio += "${PN}-pulse" -RPROVIDES:${PN}-soup += "${PN}-souphttpsrc" - -PACKAGECONFIG_SOUP ?= "soup3" - -PACKAGECONFIG ??= " \ - ${GSTREAMER_ORC} \ - ${PACKAGECONFIG_SOUP} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio x11', d)} \ - ${@bb.utils.contains('TUNE_FEATURES', 'm64', 'asm', '', d)} \ - bz2 cairo flac gdk-pixbuf gudev jpeg lame libpng mpg123 speex taglib v4l2 \ -" - -X11DEPENDS = "virtual/libx11 libsm libxrender libxfixes libxdamage" -X11ENABLEOPTS = "-Dximagesrc=enabled -Dximagesrc-xshm=enabled -Dximagesrc-xfixes=enabled -Dximagesrc-xdamage=enabled" -X11DISABLEOPTS = "-Dximagesrc=disabled -Dximagesrc-xshm=disabled -Dximagesrc-xfixes=disabled -Dximagesrc-xdamage=disabled" - -QT5WAYLANDDEPENDS = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "qtwayland", "", d)}" - -PACKAGECONFIG[asm] = "-Dasm=enabled,-Dasm=disabled,nasm-native" -PACKAGECONFIG[bz2] = "-Dbz2=enabled,-Dbz2=disabled,bzip2" -PACKAGECONFIG[cairo] = "-Dcairo=enabled,-Dcairo=disabled,cairo" -PACKAGECONFIG[dv1394] = "-Ddv1394=enabled,-Ddv1394=disabled,libiec61883 libavc1394 libraw1394" -PACKAGECONFIG[flac] = "-Dflac=enabled,-Dflac=disabled,flac" -PACKAGECONFIG[gdk-pixbuf] = "-Dgdk-pixbuf=enabled,-Dgdk-pixbuf=disabled,gdk-pixbuf" -PACKAGECONFIG[gtk] = "-Dgtk3=enabled,-Dgtk3=disabled,gtk+3" -PACKAGECONFIG[gudev] = "-Dv4l2-gudev=enabled,-Dv4l2-gudev=disabled,libgudev" -PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack" -PACKAGECONFIG[jpeg] = "-Djpeg=enabled,-Djpeg=disabled,jpeg" -PACKAGECONFIG[lame] = "-Dlame=enabled,-Dlame=disabled,lame" -PACKAGECONFIG[libpng] = "-Dpng=enabled,-Dpng=disabled,libpng" -PACKAGECONFIG[libv4l2] = "-Dv4l2-libv4l2=enabled,-Dv4l2-libv4l2=disabled,v4l-utils" -PACKAGECONFIG[mpg123] = "-Dmpg123=enabled,-Dmpg123=disabled,mpg123" -PACKAGECONFIG[pulseaudio] = "-Dpulse=enabled,-Dpulse=disabled,pulseaudio" -PACKAGECONFIG[qt5] = "-Dqt5=enabled,-Dqt5=disabled,qtbase qtdeclarative qtbase-native ${QT5WAYLANDDEPENDS}" -# Starting with version 1.20, the GStreamer soup plugin loads libsoup with dlopen() -# instead of linking to it. And instead of using the default libsoup C headers, it -# uses its own stub header. Consequently, objdump will not show the libsoup .so as -# a dependency, and libsoup won't be added to an image. Fix this by setting libsoup -# as RDEPEND. -PACKAGECONFIG[soup2] = "-Dsoup=enabled,,libsoup-2.4,libsoup-2.4,,soup3" -PACKAGECONFIG[soup3] = "-Dsoup=enabled,,libsoup,libsoup,,soup2" -PACKAGECONFIG[speex] = "-Dspeex=enabled,-Dspeex=disabled,speex" -PACKAGECONFIG[rpi] = "-Drpicamsrc=enabled,-Drpicamsrc=disabled,userland" -PACKAGECONFIG[taglib] = "-Dtaglib=enabled,-Dtaglib=disabled,taglib" -PACKAGECONFIG[v4l2] = "-Dv4l2=enabled -Dv4l2-probe=true,-Dv4l2=disabled -Dv4l2-probe=false" -PACKAGECONFIG[vpx] = "-Dvpx=enabled,-Dvpx=disabled,libvpx" -PACKAGECONFIG[wavpack] = "-Dwavpack=enabled,-Dwavpack=disabled,wavpack" -PACKAGECONFIG[x11] = "${X11ENABLEOPTS},${X11DISABLEOPTS},${X11DEPENDS}" - -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - -Daalib=disabled \ - -Ddirectsound=disabled \ - -Ddv=disabled \ - -Dlibcaca=disabled \ - -Doss=enabled \ - -Doss4=disabled \ - -Dosxaudio=disabled \ - -Dosxvideo=disabled \ - -Dshout2=disabled \ - -Dtwolame=disabled \ - -Dwaveform=disabled \ -" - -FILES:${PN}-equalizer += "${datadir}/gstreamer-1.0/presets/*.prs" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.5.bb new file mode 100644 index 0000000000..f7ade89ef8 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.5.bb @@ -0,0 +1,85 @@ +require gstreamer1.0-plugins-common.inc + +DESCRIPTION = "'Good' GStreamer plugins" +HOMEPAGE = "https://gstreamer.freedesktop.org/" +BUGTRACKER = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues" + +SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-${PV}.tar.xz \ + file://0001-qt-include-ext-qt-gstqtgl.h-instead-of-gst-gl-gstglf.patch \ + " + +SRC_URI[sha256sum] = "e83ab4d12ca24959489bbb0ec4fac9b90e32f741d49cda357cb554b2cb8b97f9" + +S = "${WORKDIR}/gst-plugins-good-${PV}" + +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ + file://gst/replaygain/rganalysis.c;beginline=1;endline=23;md5=b60ebefd5b2f5a8e0cab6bfee391a5fe" + +DEPENDS += "gstreamer1.0-plugins-base libcap zlib" +RPROVIDES:${PN}-pulseaudio += "${PN}-pulse" +RPROVIDES:${PN}-soup += "${PN}-souphttpsrc" + +PACKAGECONFIG_SOUP ?= "soup3" + +PACKAGECONFIG ??= " \ + ${GSTREAMER_ORC} \ + ${PACKAGECONFIG_SOUP} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio x11', d)} \ + ${@bb.utils.contains('TUNE_FEATURES', 'm64', 'asm', '', d)} \ + bz2 cairo flac gdk-pixbuf gudev jpeg lame libpng mpg123 speex taglib v4l2 \ +" + +X11DEPENDS = "virtual/libx11 libsm libxrender libxfixes libxdamage" +X11ENABLEOPTS = "-Dximagesrc=enabled -Dximagesrc-xshm=enabled -Dximagesrc-xfixes=enabled -Dximagesrc-xdamage=enabled" +X11DISABLEOPTS = "-Dximagesrc=disabled -Dximagesrc-xshm=disabled -Dximagesrc-xfixes=disabled -Dximagesrc-xdamage=disabled" + +QT5WAYLANDDEPENDS = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "qtwayland", "", d)}" + +PACKAGECONFIG[asm] = "-Dasm=enabled,-Dasm=disabled,nasm-native" +PACKAGECONFIG[bz2] = "-Dbz2=enabled,-Dbz2=disabled,bzip2" +PACKAGECONFIG[cairo] = "-Dcairo=enabled,-Dcairo=disabled,cairo" +PACKAGECONFIG[dv1394] = "-Ddv1394=enabled,-Ddv1394=disabled,libiec61883 libavc1394 libraw1394" +PACKAGECONFIG[flac] = "-Dflac=enabled,-Dflac=disabled,flac" +PACKAGECONFIG[gdk-pixbuf] = "-Dgdk-pixbuf=enabled,-Dgdk-pixbuf=disabled,gdk-pixbuf" +PACKAGECONFIG[gtk] = "-Dgtk3=enabled,-Dgtk3=disabled,gtk+3" +PACKAGECONFIG[gudev] = "-Dv4l2-gudev=enabled,-Dv4l2-gudev=disabled,libgudev" +PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack" +PACKAGECONFIG[jpeg] = "-Djpeg=enabled,-Djpeg=disabled,jpeg" +PACKAGECONFIG[lame] = "-Dlame=enabled,-Dlame=disabled,lame" +PACKAGECONFIG[libpng] = "-Dpng=enabled,-Dpng=disabled,libpng" +PACKAGECONFIG[libv4l2] = "-Dv4l2-libv4l2=enabled,-Dv4l2-libv4l2=disabled,v4l-utils" +PACKAGECONFIG[mpg123] = "-Dmpg123=enabled,-Dmpg123=disabled,mpg123" +PACKAGECONFIG[pulseaudio] = "-Dpulse=enabled,-Dpulse=disabled,pulseaudio" +PACKAGECONFIG[qt5] = "-Dqt5=enabled,-Dqt5=disabled,qtbase qtdeclarative qtbase-native ${QT5WAYLANDDEPENDS}" +# Starting with version 1.20, the GStreamer soup plugin loads libsoup with dlopen() +# instead of linking to it. And instead of using the default libsoup C headers, it +# uses its own stub header. Consequently, objdump will not show the libsoup .so as +# a dependency, and libsoup won't be added to an image. Fix this by setting libsoup +# as RDEPEND. +PACKAGECONFIG[soup2] = "-Dsoup=enabled,,libsoup-2.4,libsoup-2.4,,soup3" +PACKAGECONFIG[soup3] = "-Dsoup=enabled,,libsoup,libsoup,,soup2" +PACKAGECONFIG[speex] = "-Dspeex=enabled,-Dspeex=disabled,speex" +PACKAGECONFIG[rpi] = "-Drpicamsrc=enabled,-Drpicamsrc=disabled,userland" +PACKAGECONFIG[taglib] = "-Dtaglib=enabled,-Dtaglib=disabled,taglib" +PACKAGECONFIG[v4l2] = "-Dv4l2=enabled -Dv4l2-probe=true,-Dv4l2=disabled -Dv4l2-probe=false" +PACKAGECONFIG[vpx] = "-Dvpx=enabled,-Dvpx=disabled,libvpx" +PACKAGECONFIG[wavpack] = "-Dwavpack=enabled,-Dwavpack=disabled,wavpack" +PACKAGECONFIG[x11] = "${X11ENABLEOPTS},${X11DISABLEOPTS},${X11DEPENDS}" + +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + -Daalib=disabled \ + -Ddirectsound=disabled \ + -Ddv=disabled \ + -Dlibcaca=disabled \ + -Doss=enabled \ + -Doss4=disabled \ + -Dosxaudio=disabled \ + -Dosxvideo=disabled \ + -Dshout2=disabled \ + -Dtwolame=disabled \ + -Dwaveform=disabled \ +" + +FILES:${PN}-equalizer += "${datadir}/gstreamer-1.0/presets/*.prs" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-license.inc b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-license.inc index 6638f13540..8b1c001111 100644 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-license.inc +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-license.inc @@ -1,7 +1,7 @@ # This .inc file contains functionality for automatically setting # the the license of all plugins according to the GSTREAMER_GPL. -PACKAGESPLITFUNCS:append = " set_gstreamer_license " +PACKAGESPLITFUNCS += "set_gstreamer_license" python set_gstreamer_license () { import oe.utils diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-packaging.inc b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-packaging.inc index afc7be40c8..d77aeed8a2 100644 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-packaging.inc +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-packaging.inc @@ -9,8 +9,8 @@ # Dynamically generate packages for all enabled plugins PACKAGES_DYNAMIC = "^${PN}-.* ^libgst.*" -PACKAGESPLITFUNCS:prepend = " split_gstreamer10_packages " -PACKAGESPLITFUNCS:append = " set_gstreamer10_metapkg_rdepends " +PACKAGESPLITFUNCS =+ "split_gstreamer10_packages" +PACKAGESPLITFUNCS += "set_gstreamer10_metapkg_rdepends" python split_gstreamer10_packages () { gst_libdir = d.expand('${libdir}/gstreamer-1.0') diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.20.4.bb deleted file mode 100644 index 94b8c8e2cf..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.20.4.bb +++ /dev/null @@ -1,46 +0,0 @@ -require gstreamer1.0-plugins-common.inc -require gstreamer1.0-plugins-license.inc - -DESCRIPTION = "'Ugly GStreamer plugins" -HOMEPAGE = "https://gstreamer.freedesktop.org/" -BUGTRACKER = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/issues" - -LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ - file://tests/check/elements/xingmux.c;beginline=1;endline=21;md5=4c771b8af188724855cb99cadd390068" - -LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later" -LICENSE_FLAGS = "commercial" - -SRC_URI = " \ - https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-${PV}.tar.xz \ - " -SRC_URI[sha256sum] = "5c9ec6bab96517e438b3f9bae0ceb84d3436f3da9bbe180cf4d28e32a7251b59" - -S = "${WORKDIR}/gst-plugins-ugly-${PV}" - -DEPENDS += "gstreamer1.0-plugins-base" - -GST_PLUGIN_SET_HAS_EXAMPLES = "0" - -PACKAGECONFIG ??= " \ - ${GSTREAMER_ORC} \ - a52dec mpeg2dec \ -" - -PACKAGECONFIG[amrnb] = "-Damrnb=enabled,-Damrnb=disabled,opencore-amr" -PACKAGECONFIG[amrwb] = "-Damrwbdec=enabled,-Damrwbdec=disabled,opencore-amr" -PACKAGECONFIG[a52dec] = "-Da52dec=enabled,-Da52dec=disabled,liba52" -PACKAGECONFIG[cdio] = "-Dcdio=enabled,-Dcdio=disabled,libcdio" -PACKAGECONFIG[dvdread] = "-Ddvdread=enabled,-Ddvdread=disabled,libdvdread" -PACKAGECONFIG[mpeg2dec] = "-Dmpeg2dec=enabled,-Dmpeg2dec=disabled,mpeg2dec" -PACKAGECONFIG[x264] = "-Dx264=enabled,-Dx264=disabled,x264" - -GSTREAMER_GPL = "${@bb.utils.filter('PACKAGECONFIG', 'a52dec cdio dvdread mpeg2dec x264', d)}" - -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - -Dsidplay=disabled \ -" - -FILES:${PN}-amrnb += "${datadir}/gstreamer-1.0/presets/GstAmrnbEnc.prs" -FILES:${PN}-x264 += "${datadir}/gstreamer-1.0/presets/GstX264Enc.prs" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.20.5.bb new file mode 100644 index 0000000000..f765e626c9 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.20.5.bb @@ -0,0 +1,46 @@ +require gstreamer1.0-plugins-common.inc +require gstreamer1.0-plugins-license.inc + +DESCRIPTION = "'Ugly GStreamer plugins" +HOMEPAGE = "https://gstreamer.freedesktop.org/" +BUGTRACKER = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/issues" + +LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ + file://tests/check/elements/xingmux.c;beginline=1;endline=21;md5=4c771b8af188724855cb99cadd390068" + +LICENSE = "LGPL-2.1-or-later & GPL-2.0-or-later" +LICENSE_FLAGS = "commercial" + +SRC_URI = " \ + https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-${PV}.tar.xz \ + " +SRC_URI[sha256sum] = "af67d8ba7cab230f64d0594352112c2c443e2aa36a87c35f9f98a43d11430b87" + +S = "${WORKDIR}/gst-plugins-ugly-${PV}" + +DEPENDS += "gstreamer1.0-plugins-base" + +GST_PLUGIN_SET_HAS_EXAMPLES = "0" + +PACKAGECONFIG ??= " \ + ${GSTREAMER_ORC} \ + a52dec mpeg2dec \ +" + +PACKAGECONFIG[amrnb] = "-Damrnb=enabled,-Damrnb=disabled,opencore-amr" +PACKAGECONFIG[amrwb] = "-Damrwbdec=enabled,-Damrwbdec=disabled,opencore-amr" +PACKAGECONFIG[a52dec] = "-Da52dec=enabled,-Da52dec=disabled,liba52" +PACKAGECONFIG[cdio] = "-Dcdio=enabled,-Dcdio=disabled,libcdio" +PACKAGECONFIG[dvdread] = "-Ddvdread=enabled,-Ddvdread=disabled,libdvdread" +PACKAGECONFIG[mpeg2dec] = "-Dmpeg2dec=enabled,-Dmpeg2dec=disabled,mpeg2dec" +PACKAGECONFIG[x264] = "-Dx264=enabled,-Dx264=disabled,x264" + +GSTREAMER_GPL = "${@bb.utils.filter('PACKAGECONFIG', 'a52dec cdio dvdread mpeg2dec x264', d)}" + +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + -Dsidplay=disabled \ +" + +FILES:${PN}-amrnb += "${datadir}/gstreamer-1.0/presets/GstAmrnbEnc.prs" +FILES:${PN}-x264 += "${datadir}/gstreamer-1.0/presets/GstX264Enc.prs" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.4.bb deleted file mode 100644 index b514989864..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.4.bb +++ /dev/null @@ -1,30 +0,0 @@ -SUMMARY = "Python bindings for GStreamer 1.0" -DESCRIPTION = "GStreamer Python binding overrides (complementing the bindings \ -provided by python-gi) " -HOMEPAGE = "http://cgit.freedesktop.org/gstreamer/gst-python/" -SECTION = "multimedia" - -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=c34deae4e395ca07e725ab0076a5f740" - -SRC_URI = "https://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz" -SRC_URI[sha256sum] = "5eb4136d03e2a495f4499c8b2e6d9d3e7b5e73c5a8b8acf9213d57bc6a7bd3c1" - -DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base python3-pygobject" -RDEPENDS:${PN} += "gstreamer1.0 gstreamer1.0-plugins-base python3-pygobject" - -PNREAL = "gst-python" - -S = "${WORKDIR}/${PNREAL}-${PV}" - -EXTRA_OEMESON += "\ - -Dtests=disabled \ - -Dplugin=enabled \ - -Dlibpython-dir=${libdir} \ -" - -# gobject-introspection is mandatory and cannot be configured -REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" -GIR_MESON_OPTION = "" - -inherit meson pkgconfig setuptools3-base upstream-version-is-even gobject-introspection features_check diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.5.bb new file mode 100644 index 0000000000..05e9ace276 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.5.bb @@ -0,0 +1,30 @@ +SUMMARY = "Python bindings for GStreamer 1.0" +DESCRIPTION = "GStreamer Python binding overrides (complementing the bindings \ +provided by python-gi) " +HOMEPAGE = "http://cgit.freedesktop.org/gstreamer/gst-python/" +SECTION = "multimedia" + +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=c34deae4e395ca07e725ab0076a5f740" + +SRC_URI = "https://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz" +SRC_URI[sha256sum] = "27487652318659cfd7dc42784b713c78d29cc7a7df4fb397134c8c125f65e3b2" + +DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base python3-pygobject" +RDEPENDS:${PN} += "gstreamer1.0 gstreamer1.0-plugins-base python3-pygobject" + +PNREAL = "gst-python" + +S = "${WORKDIR}/${PNREAL}-${PV}" + +EXTRA_OEMESON += "\ + -Dtests=disabled \ + -Dplugin=enabled \ + -Dlibpython-dir=${libdir} \ +" + +# gobject-introspection is mandatory and cannot be configured +REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" +GIR_MESON_OPTION = "" + +inherit meson pkgconfig setuptools3-base upstream-version-is-even gobject-introspection features_check diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.20.4.bb deleted file mode 100644 index 4137b4993b..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.20.4.bb +++ /dev/null @@ -1,31 +0,0 @@ -SUMMARY = "A library on top of GStreamer for building an RTSP server" -HOMEPAGE = "http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/" -SECTION = "multimedia" -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770" - -DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base" - -PNREAL = "gst-rtsp-server" - -SRC_URI = "https://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz" - -SRC_URI[sha256sum] = "88d9ef634e59aeb8cc183ad5ae444557c5a88dd49d833b9072bc6e1fae6a3d7d" - -S = "${WORKDIR}/${PNREAL}-${PV}" - -inherit meson pkgconfig upstream-version-is-even gobject-introspection - -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - -Dexamples=disabled \ - -Dtests=disabled \ -" - -GIR_MESON_ENABLE_FLAG = "enabled" -GIR_MESON_DISABLE_FLAG = "disabled" - -# Starting with 1.8.0 gst-rtsp-server includes dependency-less plugins as well -require gstreamer1.0-plugins-packaging.inc - -CVE_PRODUCT += "gst-rtsp-server" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.20.5.bb new file mode 100644 index 0000000000..c9cf42903d --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.20.5.bb @@ -0,0 +1,31 @@ +SUMMARY = "A library on top of GStreamer for building an RTSP server" +HOMEPAGE = "http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/" +SECTION = "multimedia" +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770" + +DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base" + +PNREAL = "gst-rtsp-server" + +SRC_URI = "https://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz" + +SRC_URI[sha256sum] = "ba398a7ddd559cce56ef4b91f448d174e0dccad98a493563d2d59c41a2ef39c5" + +S = "${WORKDIR}/${PNREAL}-${PV}" + +inherit meson pkgconfig upstream-version-is-even gobject-introspection + +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + -Dexamples=disabled \ + -Dtests=disabled \ +" + +GIR_MESON_ENABLE_FLAG = "enabled" +GIR_MESON_DISABLE_FLAG = "disabled" + +# Starting with 1.8.0 gst-rtsp-server includes dependency-less plugins as well +require gstreamer1.0-plugins-packaging.inc + +CVE_PRODUCT += "gst-rtsp-server" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.20.4.bb deleted file mode 100644 index 81ec23d26e..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.20.4.bb +++ /dev/null @@ -1,53 +0,0 @@ -SUMMARY = "VA-API support to GStreamer" -HOMEPAGE = "https://gstreamer.freedesktop.org/" -DESCRIPTION = "gstreamer-vaapi consists of a collection of VA-API \ -based plugins for GStreamer and helper libraries: `vaapidecode', \ -`vaapiconvert', and `vaapisink'." - -REALPN = "gstreamer-vaapi" - -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" - -SRC_URI = "https://gstreamer.freedesktop.org/src/${REALPN}/${REALPN}-${PV}.tar.xz" - -SRC_URI[sha256sum] = "ab12596144c05506e9782374c5d2cdfb3069fca89908d6de360d947bb77fd06a" - -S = "${WORKDIR}/${REALPN}-${PV}" -DEPENDS = "libva gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad" - -inherit meson pkgconfig features_check upstream-version-is-even - -REQUIRED_DISTRO_FEATURES ?= "opengl" - -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - -Dexamples=disabled \ - -Dtests=enabled \ -" - -PACKAGES =+ "${PN}-tests" - -# OpenGL packageconfig factored out to make it easy for distros -# and BSP layers to pick either glx, egl, or no GL. By default, -# try detecting X11 first, and if found (with OpenGL), use GLX, -# otherwise try to check if EGL can be used. -PACKAGECONFIG_GL ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'glx', \ - bb.utils.contains('DISTRO_FEATURES', 'opengl', 'egl', \ - '', d), d)}" - -PACKAGECONFIG ??= "drm encoders \ - ${PACKAGECONFIG_GL} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" - -PACKAGECONFIG[drm] = "-Dwith_drm=yes,-Dwith_drm=no,udev libdrm" -PACKAGECONFIG[egl] = "-Dwith_egl=yes,-Dwith_egl=no,virtual/egl" -PACKAGECONFIG[encoders] = "-Dwith_encoders=yes,-Dwith_encoders=no" -PACKAGECONFIG[glx] = "-Dwith_glx=yes,-Dwith_glx=no,virtual/libgl" -PACKAGECONFIG[wayland] = "-Dwith_wayland=yes,-Dwith_wayland=no,wayland-native wayland wayland-protocols" -PACKAGECONFIG[x11] = "-Dwith_x11=yes,-Dwith_x11=no,virtual/libx11 libxrandr libxrender" - -FILES:${PN} += "${libdir}/gstreamer-*/*.so" -FILES:${PN}-dbg += "${libdir}/gstreamer-*/.debug" -FILES:${PN}-dev += "${libdir}/gstreamer-*/*.a" -FILES:${PN}-tests = "${bindir}/*" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.20.5.bb new file mode 100644 index 0000000000..716f50ebe1 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.20.5.bb @@ -0,0 +1,53 @@ +SUMMARY = "VA-API support to GStreamer" +HOMEPAGE = "https://gstreamer.freedesktop.org/" +DESCRIPTION = "gstreamer-vaapi consists of a collection of VA-API \ +based plugins for GStreamer and helper libraries: `vaapidecode', \ +`vaapiconvert', and `vaapisink'." + +REALPN = "gstreamer-vaapi" + +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI = "https://gstreamer.freedesktop.org/src/${REALPN}/${REALPN}-${PV}.tar.xz" + +SRC_URI[sha256sum] = "510c6fb4ff3f676d7946ce1800e04ccf5aabe5a586d4e164d1961808fab8c94b" + +S = "${WORKDIR}/${REALPN}-${PV}" +DEPENDS = "libva gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad" + +inherit meson pkgconfig features_check upstream-version-is-even + +REQUIRED_DISTRO_FEATURES ?= "opengl" + +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + -Dexamples=disabled \ + -Dtests=enabled \ +" + +PACKAGES =+ "${PN}-tests" + +# OpenGL packageconfig factored out to make it easy for distros +# and BSP layers to pick either glx, egl, or no GL. By default, +# try detecting X11 first, and if found (with OpenGL), use GLX, +# otherwise try to check if EGL can be used. +PACKAGECONFIG_GL ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'glx', \ + bb.utils.contains('DISTRO_FEATURES', 'opengl', 'egl', \ + '', d), d)}" + +PACKAGECONFIG ??= "drm encoders \ + ${PACKAGECONFIG_GL} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}" + +PACKAGECONFIG[drm] = "-Dwith_drm=yes,-Dwith_drm=no,udev libdrm" +PACKAGECONFIG[egl] = "-Dwith_egl=yes,-Dwith_egl=no,virtual/egl" +PACKAGECONFIG[encoders] = "-Dwith_encoders=yes,-Dwith_encoders=no" +PACKAGECONFIG[glx] = "-Dwith_glx=yes,-Dwith_glx=no,virtual/libgl" +PACKAGECONFIG[wayland] = "-Dwith_wayland=yes,-Dwith_wayland=no,wayland-native wayland wayland-protocols" +PACKAGECONFIG[x11] = "-Dwith_x11=yes,-Dwith_x11=no,virtual/libx11 libxrandr libxrender" + +FILES:${PN} += "${libdir}/gstreamer-*/*.so" +FILES:${PN}-dbg += "${libdir}/gstreamer-*/.debug" +FILES:${PN}-dev += "${libdir}/gstreamer-*/*.a" +FILES:${PN}-tests = "${bindir}/*" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-bin-Fix-race-conditions-in-tests.patch b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-bin-Fix-race-conditions-in-tests.patch new file mode 100644 index 0000000000..f1fac2df57 --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-bin-Fix-race-conditions-in-tests.patch @@ -0,0 +1,300 @@ +From e1e2d8d58c1e09e065849cdb1f6466c0537a7c51 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= +Date: Tue, 21 Jun 2022 11:51:35 +0300 +Subject: [PATCH] bin: Fix race conditions in tests + +The latency messages are non-deterministic and can arrive before/after +async-done or during state-changes as they are posted by e.g. sinks from +their streaming thread but bins are finishing asynchronous state changes +from a secondary helper thread. + +To solve this, expect latency messages at any time and assert that we +receive one at some point during the test. + +Part-of: + +Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2643] +Signed-off-by: Jose Quaresma +--- + .../gstreamer/tests/check/gst/gstbin.c | 132 ++++++++++++------ + 1 file changed, 92 insertions(+), 40 deletions(-) + +diff --git a/subprojects/gstreamer/tests/check/gst/gstbin.c b/subprojects/gstreamer/tests/check/gst/gstbin.c +index e366d5fe20f..88ff44db0c3 100644 +--- a/subprojects/gstreamer/tests/check/gst/gstbin.c ++++ b/subprojects/gstreamer/tests/check/gst/gstbin.c +@@ -27,50 +27,95 @@ + #include + + static void +-pop_async_done (GstBus * bus) ++pop_async_done (GstBus * bus, gboolean * had_latency) + { + GstMessage *message; ++ GstMessageType types = GST_MESSAGE_ASYNC_DONE; ++ ++ if (!*had_latency) ++ types |= GST_MESSAGE_LATENCY; + + GST_DEBUG ("popping async-done message"); +- message = gst_bus_poll (bus, GST_MESSAGE_ASYNC_DONE, -1); + +- fail_unless (message && GST_MESSAGE_TYPE (message) +- == GST_MESSAGE_ASYNC_DONE, "did not get GST_MESSAGE_ASYNC_DONE"); ++ do { ++ message = gst_bus_poll (bus, types, -1); + +- gst_message_unref (message); +- GST_DEBUG ("popped message"); ++ fail_unless (message); ++ GST_DEBUG ("popped message %s", ++ gst_message_type_get_name (GST_MESSAGE_TYPE (message))); ++ ++ if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_LATENCY) { ++ fail_unless (*had_latency == FALSE); ++ *had_latency = TRUE; ++ gst_clear_message (&message); ++ types &= ~GST_MESSAGE_LATENCY; ++ continue; ++ } ++ ++ fail_unless (GST_MESSAGE_TYPE (message) ++ == GST_MESSAGE_ASYNC_DONE, "did not get GST_MESSAGE_ASYNC_DONE"); ++ ++ gst_clear_message (&message); ++ break; ++ } while (TRUE); + } + + static void +-pop_latency (GstBus * bus) ++pop_latency (GstBus * bus, gboolean * had_latency) + { + GstMessage *message; + +- GST_DEBUG ("popping async-done message"); ++ if (*had_latency) ++ return; ++ ++ GST_DEBUG ("popping latency message"); + message = gst_bus_poll (bus, GST_MESSAGE_LATENCY, -1); + +- fail_unless (message && GST_MESSAGE_TYPE (message) ++ fail_unless (message); ++ fail_unless (GST_MESSAGE_TYPE (message) + == GST_MESSAGE_LATENCY, "did not get GST_MESSAGE_LATENCY"); + +- gst_message_unref (message); +- GST_DEBUG ("popped message"); ++ GST_DEBUG ("popped message %s", ++ gst_message_type_get_name (GST_MESSAGE_TYPE (message))); ++ gst_clear_message (&message); ++ ++ *had_latency = TRUE; + } + + static void +-pop_state_changed (GstBus * bus, int count) ++pop_state_changed (GstBus * bus, int count, gboolean * had_latency) + { + GstMessage *message; +- ++ GstMessageType types = GST_MESSAGE_STATE_CHANGED; + int i; + ++ if (!*had_latency) ++ types |= GST_MESSAGE_LATENCY; ++ + GST_DEBUG ("popping %d messages", count); + for (i = 0; i < count; ++i) { +- message = gst_bus_poll (bus, GST_MESSAGE_STATE_CHANGED, -1); +- +- fail_unless (message && GST_MESSAGE_TYPE (message) +- == GST_MESSAGE_STATE_CHANGED, "did not get GST_MESSAGE_STATE_CHANGED"); +- +- gst_message_unref (message); ++ do { ++ message = gst_bus_poll (bus, types, -1); ++ ++ fail_unless (message); ++ GST_DEBUG ("popped message %s", ++ gst_message_type_get_name (GST_MESSAGE_TYPE (message))); ++ ++ if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_LATENCY) { ++ fail_unless (*had_latency == FALSE); ++ *had_latency = TRUE; ++ gst_clear_message (&message); ++ types &= ~GST_MESSAGE_LATENCY; ++ continue; ++ } ++ ++ fail_unless (GST_MESSAGE_TYPE (message) ++ == GST_MESSAGE_STATE_CHANGED, ++ "did not get GST_MESSAGE_STATE_CHANGED"); ++ ++ gst_message_unref (message); ++ break; ++ } while (TRUE); + } + GST_DEBUG ("popped %d messages", count); + } +@@ -538,6 +583,7 @@ GST_START_TEST (test_message_state_changed_children) + GstBus *bus; + GstStateChangeReturn ret; + GstState current, pending; ++ gboolean had_latency = FALSE; + + pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); + fail_unless (pipeline != NULL, "Could not create pipeline"); +@@ -576,7 +622,7 @@ GST_START_TEST (test_message_state_changed_children) + ASSERT_OBJECT_REFCOUNT (sink, "sink", 2); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 2); + +- pop_state_changed (bus, 3); ++ pop_state_changed (bus, 3, &had_latency); + fail_if (gst_bus_have_pending (bus), "unexpected pending messages"); + + ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); +@@ -619,9 +665,9 @@ GST_START_TEST (test_message_state_changed_children) + * its state_change message */ + ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "pipeline", 3, 4); + +- pop_state_changed (bus, 3); +- pop_async_done (bus); +- pop_latency (bus); ++ pop_state_changed (bus, 3, &had_latency); ++ pop_async_done (bus, &had_latency); ++ pop_latency (bus, &had_latency); + fail_if ((gst_bus_pop (bus)) != NULL); + + ASSERT_OBJECT_REFCOUNT_BETWEEN (bus, "bus", 2, 3); +@@ -648,7 +694,7 @@ GST_START_TEST (test_message_state_changed_children) + ASSERT_OBJECT_REFCOUNT_BETWEEN (sink, "sink", 2, 4); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3); + +- pop_state_changed (bus, 3); ++ pop_state_changed (bus, 3, &had_latency); + fail_if ((gst_bus_pop (bus)) != NULL); + + ASSERT_OBJECT_REFCOUNT (bus, "bus", 2); +@@ -669,7 +715,7 @@ GST_START_TEST (test_message_state_changed_children) + ASSERT_OBJECT_REFCOUNT_BETWEEN (sink, "sink", 3, 4); + ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 3); + +- pop_state_changed (bus, 6); ++ pop_state_changed (bus, 6, &had_latency); + fail_if ((gst_bus_pop (bus)) != NULL); + + ASSERT_OBJECT_REFCOUNT (src, "src", 1); +@@ -696,6 +742,7 @@ GST_START_TEST (test_watch_for_state_change) + GstElement *src, *sink, *bin; + GstBus *bus; + GstStateChangeReturn ret; ++ gboolean had_latency = FALSE; + + bin = gst_element_factory_make ("bin", NULL); + fail_unless (bin != NULL, "Could not create bin"); +@@ -722,9 +769,9 @@ GST_START_TEST (test_watch_for_state_change) + GST_CLOCK_TIME_NONE); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + +- pop_state_changed (bus, 6); +- pop_async_done (bus); +- pop_latency (bus); ++ pop_state_changed (bus, 6, &had_latency); ++ pop_async_done (bus, &had_latency); ++ pop_latency (bus, &had_latency); + + fail_unless (gst_bus_have_pending (bus) == FALSE, + "Unexpected messages on bus"); +@@ -732,16 +779,17 @@ GST_START_TEST (test_watch_for_state_change) + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS); + +- pop_state_changed (bus, 3); ++ pop_state_changed (bus, 3, &had_latency); + ++ had_latency = FALSE; + /* this one might return either SUCCESS or ASYNC, likely SUCCESS */ + ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); + gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE); + +- pop_state_changed (bus, 3); ++ pop_state_changed (bus, 3, &had_latency); + if (ret == GST_STATE_CHANGE_ASYNC) { +- pop_async_done (bus); +- pop_latency (bus); ++ pop_async_done (bus, &had_latency); ++ pop_latency (bus, &had_latency); + } + + fail_unless (gst_bus_have_pending (bus) == FALSE, +@@ -898,6 +946,7 @@ GST_START_TEST (test_children_state_change_order_flagged_sink) + GstStateChangeReturn ret; + GstState current, pending; + GstBus *bus; ++ gboolean had_latency = FALSE; + + pipeline = gst_pipeline_new (NULL); + fail_unless (pipeline != NULL, "Could not create pipeline"); +@@ -951,10 +1000,11 @@ GST_START_TEST (test_children_state_change_order_flagged_sink) + ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 107); + #else + +- pop_state_changed (bus, 2); /* pop remaining ready => paused messages off the bus */ ++ pop_state_changed (bus, 2, &had_latency); /* pop remaining ready => paused messages off the bus */ + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, + 108); +- pop_async_done (bus); ++ pop_async_done (bus, &had_latency); ++ pop_latency (bus, &had_latency); + #endif + /* PAUSED => PLAYING */ + GST_DEBUG ("popping PAUSED -> PLAYING messages"); +@@ -972,8 +1022,8 @@ GST_START_TEST (test_children_state_change_order_flagged_sink) + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); + + /* TODO: do we need to check downwards state change order as well? */ +- pop_state_changed (bus, 4); /* pop playing => paused messages off the bus */ +- pop_state_changed (bus, 4); /* pop paused => ready messages off the bus */ ++ pop_state_changed (bus, 4, &had_latency); /* pop playing => paused messages off the bus */ ++ pop_state_changed (bus, 4, &had_latency); /* pop paused => ready messages off the bus */ + + while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 1) + THREAD_SWITCH (); +@@ -1002,6 +1052,7 @@ GST_START_TEST (test_children_state_change_order_semi_sink) + GstStateChangeReturn ret; + GstState current, pending; + GstBus *bus; ++ gboolean had_latency = FALSE; + + /* (2) Now again, but check other code path where we don't have + * a proper sink correctly flagged as such, but a 'semi-sink' */ +@@ -1056,10 +1107,11 @@ GST_START_TEST (test_children_state_change_order_semi_sink) + ASSERT_STATE_CHANGE_MSG (bus, src, GST_STATE_READY, GST_STATE_PAUSED, 206); + ASSERT_STATE_CHANGE_MSG (bus, sink, GST_STATE_READY, GST_STATE_PAUSED, 207); + #else +- pop_state_changed (bus, 2); /* pop remaining ready => paused messages off the bus */ ++ pop_state_changed (bus, 2, &had_latency); /* pop remaining ready => paused messages off the bus */ + ASSERT_STATE_CHANGE_MSG (bus, pipeline, GST_STATE_READY, GST_STATE_PAUSED, + 208); +- pop_async_done (bus); ++ pop_async_done (bus, &had_latency); ++ pop_latency (bus, &had_latency); + + /* PAUSED => PLAYING */ + GST_DEBUG ("popping PAUSED -> PLAYING messages"); +@@ -1076,8 +1128,8 @@ GST_START_TEST (test_children_state_change_order_semi_sink) + fail_if (ret != GST_STATE_CHANGE_SUCCESS, "State change to READY failed"); + + /* TODO: do we need to check downwards state change order as well? */ +- pop_state_changed (bus, 4); /* pop playing => paused messages off the bus */ +- pop_state_changed (bus, 4); /* pop paused => ready messages off the bus */ ++ pop_state_changed (bus, 4, &had_latency); /* pop playing => paused messages off the bus */ ++ pop_state_changed (bus, 4, &had_latency); /* pop paused => ready messages off the bus */ + + GST_DEBUG ("waiting for pipeline to reach refcount 1"); + while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 1) +-- +GitLab + diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-tests-remove-gstbin-test_watch_for_state_change-test.patch b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-tests-remove-gstbin-test_watch_for_state_change-test.patch deleted file mode 100644 index f51df6d20b..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0005-tests-remove-gstbin-test_watch_for_state_change-test.patch +++ /dev/null @@ -1,107 +0,0 @@ -From b935abba3d8fa3ea1ce384c08e650afd8c20b78a Mon Sep 17 00:00:00 2001 -From: Claudius Heine -Date: Wed, 2 Feb 2022 13:47:02 +0100 -Subject: [PATCH] tests: remove gstbin:test_watch_for_state_change testcase - -This testcase seems to be flaky, and upstream marked it as such: -https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/778 - -This patch removes the testcase to avoid it interfering with out ptest. - -Signed-off-by: Claudius Heine - -Upstream-Status: Inappropriate [needs proper upstream fix] ---- - tests/check/gst/gstbin.c | 69 ------------------- - 1 file changed, 69 deletions(-) - -diff --git a/tests/check/gst/gstbin.c b/tests/check/gst/gstbin.c -index e366d5fe20..ac29d81474 100644 ---- a/tests/check/gst/gstbin.c -+++ b/tests/check/gst/gstbin.c -@@ -691,74 +691,6 @@ GST_START_TEST (test_message_state_changed_children) - - GST_END_TEST; - --GST_START_TEST (test_watch_for_state_change) --{ -- GstElement *src, *sink, *bin; -- GstBus *bus; -- GstStateChangeReturn ret; -- -- bin = gst_element_factory_make ("bin", NULL); -- fail_unless (bin != NULL, "Could not create bin"); -- -- bus = g_object_new (gst_bus_get_type (), NULL); -- gst_object_ref_sink (bus); -- gst_element_set_bus (GST_ELEMENT_CAST (bin), bus); -- -- src = gst_element_factory_make ("fakesrc", NULL); -- fail_if (src == NULL, "Could not create fakesrc"); -- sink = gst_element_factory_make ("fakesink", NULL); -- fail_if (sink == NULL, "Could not create fakesink"); -- -- gst_bin_add (GST_BIN (bin), sink); -- gst_bin_add (GST_BIN (bin), src); -- -- fail_unless (gst_element_link (src, sink), "could not link src and sink"); -- -- /* change state, spawning two times three messages */ -- ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); -- fail_unless (ret == GST_STATE_CHANGE_ASYNC); -- ret = -- gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, -- GST_CLOCK_TIME_NONE); -- fail_unless (ret == GST_STATE_CHANGE_SUCCESS); -- -- pop_state_changed (bus, 6); -- pop_async_done (bus); -- pop_latency (bus); -- -- fail_unless (gst_bus_have_pending (bus) == FALSE, -- "Unexpected messages on bus"); -- -- ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING); -- fail_unless (ret == GST_STATE_CHANGE_SUCCESS); -- -- pop_state_changed (bus, 3); -- -- /* this one might return either SUCCESS or ASYNC, likely SUCCESS */ -- ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PAUSED); -- gst_element_get_state (GST_ELEMENT (bin), NULL, NULL, GST_CLOCK_TIME_NONE); -- -- pop_state_changed (bus, 3); -- if (ret == GST_STATE_CHANGE_ASYNC) { -- pop_async_done (bus); -- pop_latency (bus); -- } -- -- fail_unless (gst_bus_have_pending (bus) == FALSE, -- "Unexpected messages on bus"); -- -- gst_bus_set_flushing (bus, TRUE); -- -- ret = gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); -- fail_unless (ret == GST_STATE_CHANGE_SUCCESS); -- -- /* clean up */ -- gst_object_unref (bus); -- gst_object_unref (bin); --} -- --GST_END_TEST; -- - GST_START_TEST (test_state_change_error_message) - { - GstElement *src, *sink, *bin; -@@ -1956,7 +1888,6 @@ gst_bin_suite (void) - tcase_add_test (tc_chain, test_message_state_changed); - tcase_add_test (tc_chain, test_message_state_changed_child); - tcase_add_test (tc_chain, test_message_state_changed_children); -- tcase_add_test (tc_chain, test_watch_for_state_change); - tcase_add_test (tc_chain, test_state_change_error_message); - tcase_add_test (tc_chain, test_add_linked); - tcase_add_test (tc_chain, test_add_self); --- -2.33.1 - diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.20.4.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.20.4.bb deleted file mode 100644 index d0ba2919ee..0000000000 --- a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.20.4.bb +++ /dev/null @@ -1,73 +0,0 @@ -SUMMARY = "GStreamer 1.0 multimedia framework" -DESCRIPTION = "GStreamer is a multimedia framework for encoding and decoding video and sound. \ -It supports a wide range of formats including mp3, ogg, avi, mpeg and quicktime." -HOMEPAGE = "http://gstreamer.freedesktop.org/" -BUGTRACKER = "https://bugzilla.gnome.org/enter_bug.cgi?product=Gstreamer" -SECTION = "multimedia" -LICENSE = "LGPL-2.1-or-later" - -DEPENDS = "glib-2.0 glib-2.0-native libxml2 bison-native flex-native" - -inherit meson pkgconfig gettext upstream-version-is-even gobject-introspection ptest-gnome - -LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770 \ - file://gst/gst.h;beginline=1;endline=21;md5=e059138481205ee2c6fc1c079c016d0d" - -S = "${WORKDIR}/gstreamer-${PV}" - -SRC_URI = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.xz \ - file://run-ptest \ - file://0001-tests-respect-the-idententaion-used-in-meson.patch;striplevel=3 \ - file://0002-tests-add-support-for-install-the-tests.patch;striplevel=3 \ - file://0003-tests-use-a-dictionaries-for-environment.patch;striplevel=3 \ - file://0004-tests-add-helper-script-to-run-the-installed_tests.patch;striplevel=3 \ - file://0005-tests-remove-gstbin-test_watch_for_state_change-test.patch \ - " -SRC_URI[sha256sum] = "67c1edf8c3c339cda5dde85f4f7b953bb9607c2d13ae970e2491c5c4c055ef5f" - -PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \ - check \ - debug \ - tools" - -PACKAGECONFIG[debug] = "-Dgst_debug=true,-Dgst_debug=false" -PACKAGECONFIG[tracer-hooks] = "-Dtracer_hooks=true,-Dtracer_hooks=false" -PACKAGECONFIG[coretracers] = "-Dcoretracers=enabled,-Dcoretracers=disabled" -PACKAGECONFIG[check] = "-Dcheck=enabled,-Dcheck=disabled" -PACKAGECONFIG[tests] = "-Dtests=enabled -Dinstalled_tests=true,-Dtests=disabled -Dinstalled_tests=false" -PACKAGECONFIG[unwind] = "-Dlibunwind=enabled,-Dlibunwind=disabled,libunwind" -PACKAGECONFIG[dw] = "-Dlibdw=enabled,-Dlibdw=disabled,elfutils" -PACKAGECONFIG[bash-completion] = "-Dbash-completion=enabled,-Dbash-completion=disabled,bash-completion" -PACKAGECONFIG[tools] = "-Dtools=enabled,-Dtools=disabled" -PACKAGECONFIG[setcap] = "-Dptp-helper-permissions=capabilities,,libcap libcap-native" - -# TODO: put this in a gettext.bbclass patch -def gettext_oemeson(d): - if d.getVar('USE_NLS') == 'no': - return '-Dnls=disabled' - # Remove the NLS bits if USE_NLS is no or INHIBIT_DEFAULT_DEPS is set - if d.getVar('INHIBIT_DEFAULT_DEPS') and not oe.utils.inherits(d, 'cross-canadian'): - return '-Dnls=disabled' - return '-Dnls=enabled' - -EXTRA_OEMESON += " \ - -Ddoc=disabled \ - -Dexamples=disabled \ - -Ddbghelp=disabled \ - ${@gettext_oemeson(d)} \ -" - -GIR_MESON_ENABLE_FLAG = "enabled" -GIR_MESON_DISABLE_FLAG = "disabled" - -PACKAGES += "${PN}-bash-completion" - -# Add the core element plugins to the main package -FILES:${PN} += "${libdir}/gstreamer-1.0/*.so" -FILES:${PN}-dev += "${libdir}/gstreamer-1.0/*.a ${libdir}/gstreamer-1.0/include" -FILES:${PN}-bash-completion += "${datadir}/bash-completion/completions/ ${datadir}/bash-completion/helpers/gst*" -FILES:${PN}-dbg += "${datadir}/gdb ${datadir}/gstreamer-1.0/gdb" - -CVE_PRODUCT = "gstreamer" - -PTEST_BUILD_HOST_FILES = "" diff --git a/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.20.5.bb b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.20.5.bb new file mode 100644 index 0000000000..ce9c1c116f --- /dev/null +++ b/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.20.5.bb @@ -0,0 +1,73 @@ +SUMMARY = "GStreamer 1.0 multimedia framework" +DESCRIPTION = "GStreamer is a multimedia framework for encoding and decoding video and sound. \ +It supports a wide range of formats including mp3, ogg, avi, mpeg and quicktime." +HOMEPAGE = "http://gstreamer.freedesktop.org/" +BUGTRACKER = "https://bugzilla.gnome.org/enter_bug.cgi?product=Gstreamer" +SECTION = "multimedia" +LICENSE = "LGPL-2.1-or-later" + +DEPENDS = "glib-2.0 glib-2.0-native libxml2 bison-native flex-native" + +inherit meson pkgconfig gettext upstream-version-is-even gobject-introspection ptest-gnome + +LIC_FILES_CHKSUM = "file://COPYING;md5=69333daa044cb77e486cc36129f7a770 \ + file://gst/gst.h;beginline=1;endline=21;md5=e059138481205ee2c6fc1c079c016d0d" + +S = "${WORKDIR}/gstreamer-${PV}" + +SRC_URI = "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.xz \ + file://run-ptest \ + file://0001-tests-respect-the-idententaion-used-in-meson.patch;striplevel=3 \ + file://0002-tests-add-support-for-install-the-tests.patch;striplevel=3 \ + file://0003-tests-use-a-dictionaries-for-environment.patch;striplevel=3 \ + file://0004-tests-add-helper-script-to-run-the-installed_tests.patch;striplevel=3 \ + file://0005-bin-Fix-race-conditions-in-tests.patch;striplevel=3 \ + " +SRC_URI[sha256sum] = "5a19083faaf361d21fc391124f78ba6d609be55845a82fa8f658230e5fa03dff" + +PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \ + check \ + debug \ + tools" + +PACKAGECONFIG[debug] = "-Dgst_debug=true,-Dgst_debug=false" +PACKAGECONFIG[tracer-hooks] = "-Dtracer_hooks=true,-Dtracer_hooks=false" +PACKAGECONFIG[coretracers] = "-Dcoretracers=enabled,-Dcoretracers=disabled" +PACKAGECONFIG[check] = "-Dcheck=enabled,-Dcheck=disabled" +PACKAGECONFIG[tests] = "-Dtests=enabled -Dinstalled_tests=true,-Dtests=disabled -Dinstalled_tests=false" +PACKAGECONFIG[unwind] = "-Dlibunwind=enabled,-Dlibunwind=disabled,libunwind" +PACKAGECONFIG[dw] = "-Dlibdw=enabled,-Dlibdw=disabled,elfutils" +PACKAGECONFIG[bash-completion] = "-Dbash-completion=enabled,-Dbash-completion=disabled,bash-completion" +PACKAGECONFIG[tools] = "-Dtools=enabled,-Dtools=disabled" +PACKAGECONFIG[setcap] = "-Dptp-helper-permissions=capabilities,,libcap libcap-native" + +# TODO: put this in a gettext.bbclass patch +def gettext_oemeson(d): + if d.getVar('USE_NLS') == 'no': + return '-Dnls=disabled' + # Remove the NLS bits if USE_NLS is no or INHIBIT_DEFAULT_DEPS is set + if d.getVar('INHIBIT_DEFAULT_DEPS') and not oe.utils.inherits(d, 'cross-canadian'): + return '-Dnls=disabled' + return '-Dnls=enabled' + +EXTRA_OEMESON += " \ + -Ddoc=disabled \ + -Dexamples=disabled \ + -Ddbghelp=disabled \ + ${@gettext_oemeson(d)} \ +" + +GIR_MESON_ENABLE_FLAG = "enabled" +GIR_MESON_DISABLE_FLAG = "disabled" + +PACKAGES += "${PN}-bash-completion" + +# Add the core element plugins to the main package +FILES:${PN} += "${libdir}/gstreamer-1.0/*.so" +FILES:${PN}-dev += "${libdir}/gstreamer-1.0/*.a ${libdir}/gstreamer-1.0/include" +FILES:${PN}-bash-completion += "${datadir}/bash-completion/completions/ ${datadir}/bash-completion/helpers/gst*" +FILES:${PN}-dbg += "${datadir}/gdb ${datadir}/gstreamer-1.0/gdb" + +CVE_PRODUCT = "gstreamer" + +PTEST_BUILD_HOST_FILES = "" diff --git a/poky/meta/recipes-multimedia/libpng/libpng_1.6.38.bb b/poky/meta/recipes-multimedia/libpng/libpng_1.6.38.bb deleted file mode 100644 index dc627203ef..0000000000 --- a/poky/meta/recipes-multimedia/libpng/libpng_1.6.38.bb +++ /dev/null @@ -1,34 +0,0 @@ -SUMMARY = "PNG image format decoding library" -DESCRIPTION = "An open source project to develop and maintain the reference \ -library for use in applications that read, create, and manipulate PNG \ -(Portable Network Graphics) raster image files. " -HOMEPAGE = "http://www.libpng.org/" -SECTION = "libs" -LICENSE = "Libpng" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5c900cc124ba35a274073b5de7639b13" -DEPENDS = "zlib" - -LIBV = "16" - -SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}${LIBV}/${BP}.tar.xz" -SRC_URI[sha256sum] = "b3683e8b8111ebf6f1ac004ebb6b0c975cd310ec469d98364388e9cedbfa68be" - -MIRRORS += "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}${LIBV}/ ${SOURCEFORGE_MIRROR}/${BPN}/${BPN}${LIBV}/older-releases/" - -UPSTREAM_CHECK_URI = "http://libpng.org/pub/png/libpng.html" - -BINCONFIG = "${bindir}/libpng-config ${bindir}/libpng16-config" - -inherit autotools binconfig-disabled pkgconfig - -# Work around missing symbols -EXTRA_OECONF:append:class-target = " ${@bb.utils.contains("TUNE_FEATURES", "neon", "--enable-arm-neon=on", "--enable-arm-neon=off", d)}" - -PACKAGES =+ "${PN}-tools" - -FILES:${PN}-tools = "${bindir}/png-fix-itxt ${bindir}/pngfix ${bindir}/pngcp" - -BBCLASSEXTEND = "native nativesdk" - -# CVE-2019-17371 is actually a memory leak in gif2png 2.x -CVE_CHECK_IGNORE += "CVE-2019-17371" diff --git a/poky/meta/recipes-multimedia/libpng/libpng_1.6.39.bb b/poky/meta/recipes-multimedia/libpng/libpng_1.6.39.bb new file mode 100644 index 0000000000..a6c229f5cf --- /dev/null +++ b/poky/meta/recipes-multimedia/libpng/libpng_1.6.39.bb @@ -0,0 +1,36 @@ +SUMMARY = "PNG image format decoding library" +DESCRIPTION = "An open source project to develop and maintain the reference \ +library for use in applications that read, create, and manipulate PNG \ +(Portable Network Graphics) raster image files. " +HOMEPAGE = "http://www.libpng.org/" +SECTION = "libs" +LICENSE = "Libpng" +LIC_FILES_CHKSUM = "file://LICENSE;md5=5c900cc124ba35a274073b5de7639b13" +DEPENDS = "zlib" + +LIBV = "16" + +SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}${LIBV}/${BP}.tar.xz" +SRC_URI[sha256sum] = "1f4696ce70b4ee5f85f1e1623dc1229b210029fa4b7aee573df3e2ba7b036937" + +MIRRORS += "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}${LIBV}/ ${SOURCEFORGE_MIRROR}/${BPN}/${BPN}${LIBV}/older-releases/" + +UPSTREAM_CHECK_URI = "http://libpng.org/pub/png/libpng.html" + +BINCONFIG = "${bindir}/libpng-config ${bindir}/libpng16-config" + +inherit autotools binconfig-disabled pkgconfig + +# Work around missing symbols +ARMNEON = "${@bb.utils.contains("TUNE_FEATURES", "neon", "--enable-arm-neon=on", "--enable-arm-neon=off", d)}" +ARMNEON:aarch64 = "--enable-hardware-optimizations=on" +EXTRA_OECONF += "${ARMNEON}" + +PACKAGES =+ "${PN}-tools" + +FILES:${PN}-tools = "${bindir}/png-fix-itxt ${bindir}/pngfix ${bindir}/pngcp" + +BBCLASSEXTEND = "native nativesdk" + +# CVE-2019-17371 is actually a memory leak in gif2png 2.x +CVE_CHECK_IGNORE += "CVE-2019-17371" diff --git a/poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.1.0.bb b/poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.1.0.bb deleted file mode 100644 index 1f1a40160d..0000000000 --- a/poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.1.0.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "Audio format Conversion library" -DESCRIPTION = "Library for reading and writing files containing sampled \ -sound (such as MS Windows WAV and the Apple/SGI AIFF format) through \ -one standard library interface." -HOMEPAGE = "https://libsndfile.github.io/libsndfile/" -AUTHOR = "Erik de Castro Lopo" -DEPENDS = "flac libogg libvorbis" -SECTION = "libs/multimedia" -LICENSE = "LGPL-2.1-only" - -SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/libsndfile-${PV}.tar.xz \ - file://noopus.patch \ - " -GITHUB_BASE_URI = "https://github.com/libsndfile/libsndfile/releases/" - -SRC_URI[sha256sum] = "0f98e101c0f7c850a71225fb5feaf33b106227b3d331333ddc9bacee190bcf41" - -LIC_FILES_CHKSUM = "file://COPYING;md5=e77fe93202736b47c07035910f47974a" - -CVE_PRODUCT = "libsndfile" - -S = "${WORKDIR}/libsndfile-${PV}" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'alsa', d)}" -PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" -PACKAGECONFIG[regtest] = "--enable-sqlite,--disable-sqlite,sqlite3" - -inherit autotools lib_package pkgconfig multilib_header github-releases - -do_install:append() { - oe_multilib_header sndfile.h -} diff --git a/poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.2.0.bb b/poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.2.0.bb new file mode 100644 index 0000000000..b8001f4618 --- /dev/null +++ b/poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.2.0.bb @@ -0,0 +1,32 @@ +SUMMARY = "Audio format Conversion library" +DESCRIPTION = "Library for reading and writing files containing sampled \ +sound (such as MS Windows WAV and the Apple/SGI AIFF format) through \ +one standard library interface." +HOMEPAGE = "https://libsndfile.github.io/libsndfile/" +AUTHOR = "Erik de Castro Lopo" +DEPENDS = "flac libogg libvorbis" +SECTION = "libs/multimedia" +LICENSE = "LGPL-2.1-only" + +SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/libsndfile-${PV}.tar.xz \ + file://noopus.patch \ + " +GITHUB_BASE_URI = "https://github.com/libsndfile/libsndfile/releases/" + +SRC_URI[sha256sum] = "0e30e7072f83dc84863e2e55f299175c7e04a5902ae79cfb99d4249ee8f6d60a" + +LIC_FILES_CHKSUM = "file://COPYING;md5=e77fe93202736b47c07035910f47974a" + +CVE_PRODUCT = "libsndfile" + +S = "${WORKDIR}/libsndfile-${PV}" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'alsa', d)}" +PACKAGECONFIG[alsa] = "--enable-alsa,--disable-alsa,alsa-lib" +PACKAGECONFIG[regtest] = "--enable-sqlite,--disable-sqlite,sqlite3" + +inherit autotools lib_package pkgconfig multilib_header github-releases + +do_install:append() { + oe_multilib_header sndfile.h +} diff --git a/poky/meta/recipes-multimedia/libtiff/files/0001-Revised-handling-of-TIFFTAG_INKNAMES-and-related-TIF.patch b/poky/meta/recipes-multimedia/libtiff/files/0001-Revised-handling-of-TIFFTAG_INKNAMES-and-related-TIF.patch deleted file mode 100644 index ce72c86120..0000000000 --- a/poky/meta/recipes-multimedia/libtiff/files/0001-Revised-handling-of-TIFFTAG_INKNAMES-and-related-TIF.patch +++ /dev/null @@ -1,266 +0,0 @@ -CVE: CVE-2022-3599 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From f00484b9519df933723deb38fff943dc291a793d Mon Sep 17 00:00:00 2001 -From: Su_Laus -Date: Tue, 30 Aug 2022 16:56:48 +0200 -Subject: [PATCH] Revised handling of TIFFTAG_INKNAMES and related - TIFFTAG_NUMBEROFINKS value - -In order to solve the buffer overflow issues related to TIFFTAG_INKNAMES and related TIFFTAG_NUMBEROFINKS value, a revised handling of those tags within LibTiff is proposed: - -Behaviour for writing: - `NumberOfInks` MUST fit to the number of inks in the `InkNames` string. - `NumberOfInks` is automatically set when `InkNames` is set. - If `NumberOfInks` is different to the number of inks within `InkNames` string, that will be corrected and a warning is issued. - If `NumberOfInks` is not equal to samplesperpixel only a warning will be issued. - -Behaviour for reading: - When reading `InkNames` from a TIFF file, the `NumberOfInks` will be set automatically to the number of inks in `InkNames` string. - If `NumberOfInks` is different to the number of inks within `InkNames` string, that will be corrected and a warning is issued. - If `NumberOfInks` is not equal to samplesperpixel only a warning will be issued. - -This allows the safe use of the NumberOfInks value to read out the InkNames without buffer overflow - -This MR will close the following issues: #149, #150, #152, #168 (to be checked), #250, #269, #398 and #456. - -It also fixes the old bug at http://bugzilla.maptools.org/show_bug.cgi?id=2599, for which the limitation of `NumberOfInks = SPP` was introduced, which is in my opinion not necessary and does not solve the general issue. ---- - libtiff/tif_dir.c | 119 ++++++++++++++++++++++++----------------- - libtiff/tif_dir.h | 2 + - libtiff/tif_dirinfo.c | 2 +- - libtiff/tif_dirwrite.c | 5 ++ - libtiff/tif_print.c | 4 ++ - 5 files changed, 82 insertions(+), 50 deletions(-) - -diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c -index 793e8a79..816f7756 100644 ---- a/libtiff/tif_dir.c -+++ b/libtiff/tif_dir.c -@@ -136,32 +136,30 @@ setExtraSamples(TIFF* tif, va_list ap, uint32_t* v) - } - - /* -- * Confirm we have "samplesperpixel" ink names separated by \0. Returns -+ * Count ink names separated by \0. Returns - * zero if the ink names are not as expected. - */ --static uint32_t --checkInkNamesString(TIFF* tif, uint32_t slen, const char* s) -+static uint16_t -+countInkNamesString(TIFF *tif, uint32_t slen, const char *s) - { -- TIFFDirectory* td = &tif->tif_dir; -- uint16_t i = td->td_samplesperpixel; -+ uint16_t i = 0; -+ const char *ep = s + slen; -+ const char *cp = s; - - if (slen > 0) { -- const char* ep = s+slen; -- const char* cp = s; -- for (; i > 0; i--) { -+ do { - for (; cp < ep && *cp != '\0'; cp++) {} - if (cp >= ep) - goto bad; - cp++; /* skip \0 */ -- } -- return ((uint32_t)(cp - s)); -+ i++; -+ } while (cp < ep); -+ return (i); - } - bad: - TIFFErrorExt(tif->tif_clientdata, "TIFFSetField", -- "%s: Invalid InkNames value; expecting %"PRIu16" names, found %"PRIu16, -- tif->tif_name, -- td->td_samplesperpixel, -- (uint16_t)(td->td_samplesperpixel-i)); -+ "%s: Invalid InkNames value; no NUL at given buffer end location %"PRIu32", after %"PRIu16" ink", -+ tif->tif_name, slen, i); - return (0); - } - -@@ -478,13 +476,61 @@ _TIFFVSetField(TIFF* tif, uint32_t tag, va_list ap) - _TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6); - break; - case TIFFTAG_INKNAMES: -- v = (uint16_t) va_arg(ap, uint16_vap); -- s = va_arg(ap, char*); -- v = checkInkNamesString(tif, v, s); -- status = v > 0; -- if( v > 0 ) { -- _TIFFsetNString(&td->td_inknames, s, v); -- td->td_inknameslen = v; -+ { -+ v = (uint16_t) va_arg(ap, uint16_vap); -+ s = va_arg(ap, char*); -+ uint16_t ninksinstring; -+ ninksinstring = countInkNamesString(tif, v, s); -+ status = ninksinstring > 0; -+ if(ninksinstring > 0 ) { -+ _TIFFsetNString(&td->td_inknames, s, v); -+ td->td_inknameslen = v; -+ /* Set NumberOfInks to the value ninksinstring */ -+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS)) -+ { -+ if (td->td_numberofinks != ninksinstring) { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Warning %s; Tag %s:\n Value %"PRIu16" of NumberOfInks is different from the number of inks %"PRIu16".\n -> NumberOfInks value adapted to %"PRIu16"", -+ tif->tif_name, fip->field_name, td->td_numberofinks, ninksinstring, ninksinstring); -+ td->td_numberofinks = ninksinstring; -+ } -+ } else { -+ td->td_numberofinks = ninksinstring; -+ TIFFSetFieldBit(tif, FIELD_NUMBEROFINKS); -+ } -+ if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL)) -+ { -+ if (td->td_numberofinks != td->td_samplesperpixel) { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Warning %s; Tag %s:\n Value %"PRIu16" of NumberOfInks is different from the SamplesPerPixel value %"PRIu16"", -+ tif->tif_name, fip->field_name, td->td_numberofinks, td->td_samplesperpixel); -+ } -+ } -+ } -+ } -+ break; -+ case TIFFTAG_NUMBEROFINKS: -+ v = (uint16_t)va_arg(ap, uint16_vap); -+ /* If InkNames already set also NumberOfInks is set accordingly and should be equal */ -+ if (TIFFFieldSet(tif, FIELD_INKNAMES)) -+ { -+ if (v != td->td_numberofinks) { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Error %s; Tag %s:\n It is not possible to set the value %"PRIu32" for NumberOfInks\n which is different from the number of inks in the InkNames tag (%"PRIu16")", -+ tif->tif_name, fip->field_name, v, td->td_numberofinks); -+ /* Do not set / overwrite number of inks already set by InkNames case accordingly. */ -+ status = 0; -+ } -+ } else { -+ td->td_numberofinks = (uint16_t)v; -+ if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL)) -+ { -+ if (td->td_numberofinks != td->td_samplesperpixel) { -+ TIFFErrorExt(tif->tif_clientdata, module, -+ "Warning %s; Tag %s:\n Value %"PRIu32" of NumberOfInks is different from the SamplesPerPixel value %"PRIu16"", -+ tif->tif_name, fip->field_name, v, td->td_samplesperpixel); -+ } -+ } - } - break; - case TIFFTAG_PERSAMPLE: -@@ -986,34 +1032,6 @@ _TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap) - if (fip->field_bit == FIELD_CUSTOM) { - standard_tag = 0; - } -- -- if( standard_tag == TIFFTAG_NUMBEROFINKS ) -- { -- int i; -- for (i = 0; i < td->td_customValueCount; i++) { -- uint16_t val; -- TIFFTagValue *tv = td->td_customValues + i; -- if (tv->info->field_tag != standard_tag) -- continue; -- if( tv->value == NULL ) -- return 0; -- val = *(uint16_t *)tv->value; -- /* Truncate to SamplesPerPixel, since the */ -- /* setting code for INKNAMES assume that there are SamplesPerPixel */ -- /* inknames. */ -- /* Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2599 */ -- if( val > td->td_samplesperpixel ) -- { -- TIFFWarningExt(tif->tif_clientdata,"_TIFFVGetField", -- "Truncating NumberOfInks from %u to %"PRIu16, -- val, td->td_samplesperpixel); -- val = td->td_samplesperpixel; -- } -- *va_arg(ap, uint16_t*) = val; -- return 1; -- } -- return 0; -- } - - switch (standard_tag) { - case TIFFTAG_SUBFILETYPE: -@@ -1195,6 +1213,9 @@ _TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap) - case TIFFTAG_INKNAMES: - *va_arg(ap, const char**) = td->td_inknames; - break; -+ case TIFFTAG_NUMBEROFINKS: -+ *va_arg(ap, uint16_t *) = td->td_numberofinks; -+ break; - default: - { - int i; -diff --git a/libtiff/tif_dir.h b/libtiff/tif_dir.h -index 09065648..0c251c9e 100644 ---- a/libtiff/tif_dir.h -+++ b/libtiff/tif_dir.h -@@ -117,6 +117,7 @@ typedef struct { - /* CMYK parameters */ - int td_inknameslen; - char* td_inknames; -+ uint16_t td_numberofinks; /* number of inks in InkNames string */ - - int td_customValueCount; - TIFFTagValue *td_customValues; -@@ -174,6 +175,7 @@ typedef struct { - #define FIELD_TRANSFERFUNCTION 44 - #define FIELD_INKNAMES 46 - #define FIELD_SUBIFD 49 -+#define FIELD_NUMBEROFINKS 50 - /* FIELD_CUSTOM (see tiffio.h) 65 */ - /* end of support for well-known tags; codec-private tags follow */ - #define FIELD_CODEC 66 /* base of codec-private tags */ -diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c -index 3371cb5c..3b4bcd33 100644 ---- a/libtiff/tif_dirinfo.c -+++ b/libtiff/tif_dirinfo.c -@@ -114,7 +114,7 @@ tiffFields[] = { - { TIFFTAG_SUBIFD, -1, -1, TIFF_IFD8, 0, TIFF_SETGET_C16_IFD8, TIFF_SETGET_UNDEFINED, FIELD_SUBIFD, 1, 1, "SubIFD", (TIFFFieldArray*) &tiffFieldArray }, - { TIFFTAG_INKSET, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "InkSet", NULL }, - { TIFFTAG_INKNAMES, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_C16_ASCII, TIFF_SETGET_UNDEFINED, FIELD_INKNAMES, 1, 1, "InkNames", NULL }, -- { TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "NumberOfInks", NULL }, -+ { TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, 0, TIFF_SETGET_UINT16, TIFF_SETGET_UNDEFINED, FIELD_NUMBEROFINKS, 1, 0, "NumberOfInks", NULL }, - { TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, 0, TIFF_SETGET_UINT16_PAIR, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 0, 0, "DotRange", NULL }, - { TIFFTAG_TARGETPRINTER, -1, -1, TIFF_ASCII, 0, TIFF_SETGET_ASCII, TIFF_SETGET_UNDEFINED, FIELD_CUSTOM, 1, 0, "TargetPrinter", NULL }, - { TIFFTAG_EXTRASAMPLES, -1, -1, TIFF_SHORT, 0, TIFF_SETGET_C16_UINT16, TIFF_SETGET_UNDEFINED, FIELD_EXTRASAMPLES, 0, 1, "ExtraSamples", NULL }, -diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c -index 6c86fdca..062e4610 100644 ---- a/libtiff/tif_dirwrite.c -+++ b/libtiff/tif_dirwrite.c -@@ -626,6 +626,11 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64_t* pdiroff) - if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,TIFFTAG_INKNAMES,tif->tif_dir.td_inknameslen,tif->tif_dir.td_inknames)) - goto bad; - } -+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS)) -+ { -+ if (!TIFFWriteDirectoryTagShort(tif, &ndir, dir, TIFFTAG_NUMBEROFINKS, tif->tif_dir.td_numberofinks)) -+ goto bad; -+ } - if (TIFFFieldSet(tif,FIELD_SUBIFD)) - { - if (!TIFFWriteDirectoryTagSubifd(tif,&ndir,dir)) -diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c -index 16ce5780..a91b9e7b 100644 ---- a/libtiff/tif_print.c -+++ b/libtiff/tif_print.c -@@ -397,6 +397,10 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) - } - fputs("\n", fd); - } -+ if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS)) { -+ fprintf(fd, " NumberOfInks: %d\n", -+ td->td_numberofinks); -+ } - if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) { - fprintf(fd, " Thresholding: "); - switch (td->td_threshholding) { --- -2.34.1 - diff --git a/poky/meta/recipes-multimedia/libtiff/files/0001-fix-the-FPE-in-tiffcrop-415-427-and-428.patch b/poky/meta/recipes-multimedia/libtiff/files/0001-fix-the-FPE-in-tiffcrop-415-427-and-428.patch deleted file mode 100644 index c7c5f616ed..0000000000 --- a/poky/meta/recipes-multimedia/libtiff/files/0001-fix-the-FPE-in-tiffcrop-415-427-and-428.patch +++ /dev/null @@ -1,184 +0,0 @@ -CVE: CVE-2022-2056 CVE-2022-2057 CVE-2022-2058 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 22a205da86ca2d038d0066e1d70752d117258fb4 Mon Sep 17 00:00:00 2001 -From: 4ugustus -Date: Sat, 11 Jun 2022 09:31:43 +0000 -Subject: [PATCH] fix the FPE in tiffcrop (#415, #427, and #428) - ---- - libtiff/tif_aux.c | 9 +++++++ - libtiff/tiffiop.h | 1 + - tools/tiffcrop.c | 62 ++++++++++++++++++++++++++--------------------- - 3 files changed, 44 insertions(+), 28 deletions(-) - -diff --git a/libtiff/tif_aux.c b/libtiff/tif_aux.c -index 140f26c7..5b88c8d0 100644 ---- a/libtiff/tif_aux.c -+++ b/libtiff/tif_aux.c -@@ -402,6 +402,15 @@ float _TIFFClampDoubleToFloat( double val ) - return (float)val; - } - -+uint32_t _TIFFClampDoubleToUInt32(double val) -+{ -+ if( val < 0 ) -+ return 0; -+ if( val > 0xFFFFFFFFU || val != val ) -+ return 0xFFFFFFFFU; -+ return (uint32_t)val; -+} -+ - int _TIFFSeekOK(TIFF* tif, toff_t off) - { - /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */ -diff --git a/libtiff/tiffiop.h b/libtiff/tiffiop.h -index e3af461d..4e8bdac2 100644 ---- a/libtiff/tiffiop.h -+++ b/libtiff/tiffiop.h -@@ -365,6 +365,7 @@ extern double _TIFFUInt64ToDouble(uint64_t); - extern float _TIFFUInt64ToFloat(uint64_t); - - extern float _TIFFClampDoubleToFloat(double); -+extern uint32_t _TIFFClampDoubleToUInt32(double); - - extern tmsize_t - _TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32_t strip, -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index 1f827b2b..90286a5e 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -5268,17 +5268,17 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image, - { - if ((crop->res_unit == RESUNIT_INCH) || (crop->res_unit == RESUNIT_CENTIMETER)) - { -- x1 = (uint32_t) (crop->corners[i].X1 * scale * xres); -- x2 = (uint32_t) (crop->corners[i].X2 * scale * xres); -- y1 = (uint32_t) (crop->corners[i].Y1 * scale * yres); -- y2 = (uint32_t) (crop->corners[i].Y2 * scale * yres); -+ x1 = _TIFFClampDoubleToUInt32(crop->corners[i].X1 * scale * xres); -+ x2 = _TIFFClampDoubleToUInt32(crop->corners[i].X2 * scale * xres); -+ y1 = _TIFFClampDoubleToUInt32(crop->corners[i].Y1 * scale * yres); -+ y2 = _TIFFClampDoubleToUInt32(crop->corners[i].Y2 * scale * yres); - } - else - { -- x1 = (uint32_t) (crop->corners[i].X1); -- x2 = (uint32_t) (crop->corners[i].X2); -- y1 = (uint32_t) (crop->corners[i].Y1); -- y2 = (uint32_t) (crop->corners[i].Y2); -+ x1 = _TIFFClampDoubleToUInt32(crop->corners[i].X1); -+ x2 = _TIFFClampDoubleToUInt32(crop->corners[i].X2); -+ y1 = _TIFFClampDoubleToUInt32(crop->corners[i].Y1); -+ y2 = _TIFFClampDoubleToUInt32(crop->corners[i].Y2); - } - /* a) Region needs to be within image sizes 0.. width-1; 0..length-1 - * b) Corners are expected to be submitted as top-left to bottom-right. -@@ -5357,17 +5357,17 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image, - { - if (crop->res_unit != RESUNIT_INCH && crop->res_unit != RESUNIT_CENTIMETER) - { /* User has specified pixels as reference unit */ -- tmargin = (uint32_t)(crop->margins[0]); -- lmargin = (uint32_t)(crop->margins[1]); -- bmargin = (uint32_t)(crop->margins[2]); -- rmargin = (uint32_t)(crop->margins[3]); -+ tmargin = _TIFFClampDoubleToUInt32(crop->margins[0]); -+ lmargin = _TIFFClampDoubleToUInt32(crop->margins[1]); -+ bmargin = _TIFFClampDoubleToUInt32(crop->margins[2]); -+ rmargin = _TIFFClampDoubleToUInt32(crop->margins[3]); - } - else - { /* inches or centimeters specified */ -- tmargin = (uint32_t)(crop->margins[0] * scale * yres); -- lmargin = (uint32_t)(crop->margins[1] * scale * xres); -- bmargin = (uint32_t)(crop->margins[2] * scale * yres); -- rmargin = (uint32_t)(crop->margins[3] * scale * xres); -+ tmargin = _TIFFClampDoubleToUInt32(crop->margins[0] * scale * yres); -+ lmargin = _TIFFClampDoubleToUInt32(crop->margins[1] * scale * xres); -+ bmargin = _TIFFClampDoubleToUInt32(crop->margins[2] * scale * yres); -+ rmargin = _TIFFClampDoubleToUInt32(crop->margins[3] * scale * xres); - } - - if ((lmargin + rmargin) > image->width) -@@ -5397,24 +5397,24 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image, - if (crop->res_unit != RESUNIT_INCH && crop->res_unit != RESUNIT_CENTIMETER) - { - if (crop->crop_mode & CROP_WIDTH) -- width = (uint32_t)crop->width; -+ width = _TIFFClampDoubleToUInt32(crop->width); - else - width = image->width - lmargin - rmargin; - - if (crop->crop_mode & CROP_LENGTH) -- length = (uint32_t)crop->length; -+ length = _TIFFClampDoubleToUInt32(crop->length); - else - length = image->length - tmargin - bmargin; - } - else - { - if (crop->crop_mode & CROP_WIDTH) -- width = (uint32_t)(crop->width * scale * image->xres); -+ width = _TIFFClampDoubleToUInt32(crop->width * scale * image->xres); - else - width = image->width - lmargin - rmargin; - - if (crop->crop_mode & CROP_LENGTH) -- length = (uint32_t)(crop->length * scale * image->yres); -+ length = _TIFFClampDoubleToUInt32(crop->length * scale * image->yres); - else - length = image->length - tmargin - bmargin; - } -@@ -5868,13 +5868,13 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image, - { - if (page->res_unit == RESUNIT_INCH || page->res_unit == RESUNIT_CENTIMETER) - { /* inches or centimeters specified */ -- hmargin = (uint32_t)(page->hmargin * scale * page->hres * ((image->bps + 7) / 8)); -- vmargin = (uint32_t)(page->vmargin * scale * page->vres * ((image->bps + 7) / 8)); -+ hmargin = _TIFFClampDoubleToUInt32(page->hmargin * scale * page->hres * ((image->bps + 7) / 8)); -+ vmargin = _TIFFClampDoubleToUInt32(page->vmargin * scale * page->vres * ((image->bps + 7) / 8)); - } - else - { /* Otherwise user has specified pixels as reference unit */ -- hmargin = (uint32_t)(page->hmargin * scale * ((image->bps + 7) / 8)); -- vmargin = (uint32_t)(page->vmargin * scale * ((image->bps + 7) / 8)); -+ hmargin = _TIFFClampDoubleToUInt32(page->hmargin * scale * ((image->bps + 7) / 8)); -+ vmargin = _TIFFClampDoubleToUInt32(page->vmargin * scale * ((image->bps + 7) / 8)); - } - - if ((hmargin * 2.0) > (pwidth * page->hres)) -@@ -5912,13 +5912,13 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image, - { - if (page->mode & PAGE_MODE_PAPERSIZE ) - { -- owidth = (uint32_t)((pwidth * page->hres) - (hmargin * 2)); -- olength = (uint32_t)((plength * page->vres) - (vmargin * 2)); -+ owidth = _TIFFClampDoubleToUInt32((pwidth * page->hres) - (hmargin * 2)); -+ olength = _TIFFClampDoubleToUInt32((plength * page->vres) - (vmargin * 2)); - } - else - { -- owidth = (uint32_t)(iwidth - (hmargin * 2 * page->hres)); -- olength = (uint32_t)(ilength - (vmargin * 2 * page->vres)); -+ owidth = _TIFFClampDoubleToUInt32(iwidth - (hmargin * 2 * page->hres)); -+ olength = _TIFFClampDoubleToUInt32(ilength - (vmargin * 2 * page->vres)); - } - } - -@@ -5927,6 +5927,12 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image, - if (olength > ilength) - olength = ilength; - -+ if (owidth == 0 || olength == 0) -+ { -+ TIFFError("computeOutputPixelOffsets", "Integer overflow when calculating the number of pages"); -+ exit(EXIT_FAILURE); -+ } -+ - /* Compute the number of pages required for Portrait or Landscape */ - switch (page->orient) - { --- -2.34.1 - diff --git a/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-S-option-Make-decision-simpler.patch b/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-S-option-Make-decision-simpler.patch deleted file mode 100644 index 02642ecfbc..0000000000 --- a/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-S-option-Make-decision-simpler.patch +++ /dev/null @@ -1,36 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From bad48e90b410df32172006c7876da449ba62cdba Mon Sep 17 00:00:00 2001 -From: Su_Laus -Date: Sat, 20 Aug 2022 23:35:26 +0200 -Subject: [PATCH] tiffcrop -S option: Make decision simpler. - ---- - tools/tiffcrop.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index c3b758ec..8fd856dc 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -2133,11 +2133,11 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32 - } - /*-- Check for not allowed combinations (e.g. -X, -Y and -Z, -z and -S are mutually exclusive) --*/ - char XY, Z, R, S; -- XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)); -- Z = (crop_data->crop_mode & CROP_ZONES); -- R = (crop_data->crop_mode & CROP_REGIONS); -- S = (page->mode & PAGE_MODE_ROWSCOLS); -- if ((XY && Z) || (XY && R) || (XY && S) || (Z && R) || (Z && S) || (R && S)) { -+ XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)) ? 1 : 0; -+ Z = (crop_data->crop_mode & CROP_ZONES) ? 1 : 0; -+ R = (crop_data->crop_mode & CROP_REGIONS) ? 1 : 0; -+ S = (page->mode & PAGE_MODE_ROWSCOLS) ? 1 : 0; -+ if (XY + Z + R + S > 1) { - TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->Exit"); - exit(EXIT_FAILURE); - } --- -2.34.1 - diff --git a/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-disable-incompatibility-of-Z-X-Y-z-options-.patch b/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-disable-incompatibility-of-Z-X-Y-z-options-.patch deleted file mode 100644 index 3e33f4adea..0000000000 --- a/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-disable-incompatibility-of-Z-X-Y-z-options-.patch +++ /dev/null @@ -1,59 +0,0 @@ -CVE: CVE-2022-3597 CVE-2022-3626 CVE-2022-3627 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 4746f16253b784287bc8a5003990c1c3b9a03a62 Mon Sep 17 00:00:00 2001 -From: Su_Laus -Date: Thu, 25 Aug 2022 16:11:41 +0200 -Subject: [PATCH] tiffcrop: disable incompatibility of -Z, -X, -Y, -z options - with any PAGE_MODE_x option (fixes #411 and #413) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -tiffcrop does not support –Z, -z, -X and –Y options together with any other PAGE_MODE_x options like -H, -V, -P, -J, -K or –S. - -Code analysis: - -With the options –Z, -z, the crop.selections are set to a value > 0. Within main(), this triggers the call of processCropSelections(), which copies the sections from the read_buff into seg_buffs[]. -In the following code in main(), the only supported step, where that seg_buffs are further handled are within an if-clause with if (page.mode == PAGE_MODE_NONE) . - -Execution of the else-clause often leads to buffer-overflows. - -Therefore, the above option combination is not supported and will be disabled to prevent those buffer-overflows. - -The MR solves issues #411 and #413. ---- - doc/tools/tiffcrop.rst | 8 ++++++++ - tools/tiffcrop.c | 32 +++++++++++++++++++++++++------- - 2 files changed, 33 insertions(+), 7 deletions(-) - -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index 8fd856dc..41a2ea36 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -2138,9 +2143,20 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32 - R = (crop_data->crop_mode & CROP_REGIONS) ? 1 : 0; - S = (page->mode & PAGE_MODE_ROWSCOLS) ? 1 : 0; - if (XY + Z + R + S > 1) { -- TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->Exit"); -+ TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->exit"); - exit(EXIT_FAILURE); - } -+ -+ /* Check for not allowed combination: -+ * Any of the -X, -Y, -Z and -z options together with other PAGE_MODE_x options -+ * such as -H, -V, -P, -J or -K are not supported and may cause buffer overflows. -+. */ -+ if ((XY + Z + R > 0) && page->mode != PAGE_MODE_NONE) { -+ TIFFError("tiffcrop input error", -+ "Any of the crop options -X, -Y, -Z and -z together with other PAGE_MODE_x options such as - H, -V, -P, -J or -K is not supported and may cause buffer overflows..->exit"); -+ exit(EXIT_FAILURE); -+ } -+ - } /* end process_command_opts */ - - /* Start a new output file if one has not been previously opened or --- -2.34.1 - diff --git a/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-subroutines-require-a-larger-buffer-fixes-2.patch b/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-subroutines-require-a-larger-buffer-fixes-2.patch deleted file mode 100644 index e44b9bc57c..0000000000 --- a/poky/meta/recipes-multimedia/libtiff/files/0001-tiffcrop-subroutines-require-a-larger-buffer-fixes-2.patch +++ /dev/null @@ -1,653 +0,0 @@ -CVE: CVE-2022-3570 CVE-2022-3598 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From afd7086090dafd3949afd172822cbcec4ed17d56 Mon Sep 17 00:00:00 2001 -From: Su Laus -Date: Thu, 13 Oct 2022 14:33:27 +0000 -Subject: [PATCH] tiffcrop subroutines require a larger buffer (fixes #271, - #381, #386, #388, #389, #435) - ---- - tools/tiffcrop.c | 209 ++++++++++++++++++++++++++--------------------- - 1 file changed, 118 insertions(+), 91 deletions(-) - -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index 41a2ea36..deab5feb 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -212,6 +212,10 @@ static char tiffcrop_rev_date[] = "26-08-2022"; - - #define TIFF_DIR_MAX 65534 - -+/* Some conversion subroutines require image buffers, which are at least 3 bytes -+ * larger than the necessary size for the image itself. */ -+#define NUM_BUFF_OVERSIZE_BYTES 3 -+ - /* Offsets into buffer for margins and fixed width and length segments */ - struct offset { - uint32_t tmargin; -@@ -233,7 +237,7 @@ struct offset { - */ - - struct buffinfo { -- uint32_t size; /* size of this buffer */ -+ size_t size; /* size of this buffer */ - unsigned char *buffer; /* address of the allocated buffer */ - }; - -@@ -810,8 +814,8 @@ static int readContigTilesIntoBuffer (TIFF* in, uint8_t* buf, - uint32_t dst_rowsize, shift_width; - uint32_t bytes_per_sample, bytes_per_pixel; - uint32_t trailing_bits, prev_trailing_bits; -- uint32_t tile_rowsize = TIFFTileRowSize(in); -- uint32_t src_offset, dst_offset; -+ tmsize_t tile_rowsize = TIFFTileRowSize(in); -+ tmsize_t src_offset, dst_offset; - uint32_t row_offset, col_offset; - uint8_t *bufp = (uint8_t*) buf; - unsigned char *src = NULL; -@@ -861,7 +865,7 @@ static int readContigTilesIntoBuffer (TIFF* in, uint8_t* buf, - TIFFError("readContigTilesIntoBuffer", "Integer overflow when calculating buffer size."); - exit(EXIT_FAILURE); - } -- tilebuf = limitMalloc(tile_buffsize + 3); -+ tilebuf = limitMalloc(tile_buffsize + NUM_BUFF_OVERSIZE_BYTES); - if (tilebuf == 0) - return 0; - tilebuf[tile_buffsize] = 0; -@@ -1024,7 +1028,7 @@ static int readSeparateTilesIntoBuffer (TIFF* in, uint8_t *obuf, - for (sample = 0; (sample < spp) && (sample < MAX_SAMPLES); sample++) - { - srcbuffs[sample] = NULL; -- tbuff = (unsigned char *)limitMalloc(tilesize + 8); -+ tbuff = (unsigned char *)limitMalloc(tilesize + NUM_BUFF_OVERSIZE_BYTES); - if (!tbuff) - { - TIFFError ("readSeparateTilesIntoBuffer", -@@ -1217,7 +1221,8 @@ writeBufferToSeparateStrips (TIFF* out, uint8_t* buf, - } - rowstripsize = rowsperstrip * bytes_per_sample * (width + 1); - -- obuf = limitMalloc (rowstripsize); -+ /* Add 3 padding bytes for extractContigSamples32bits */ -+ obuf = limitMalloc (rowstripsize + NUM_BUFF_OVERSIZE_BYTES); - if (obuf == NULL) - return 1; - -@@ -1229,7 +1234,7 @@ writeBufferToSeparateStrips (TIFF* out, uint8_t* buf, - - stripsize = TIFFVStripSize(out, nrows); - src = buf + (row * rowsize); -- memset (obuf, '\0', rowstripsize); -+ memset (obuf, '\0',rowstripsize + NUM_BUFF_OVERSIZE_BYTES); - if (extractContigSamplesToBuffer(obuf, src, nrows, width, s, spp, bps, dump)) - { - _TIFFfree(obuf); -@@ -1237,10 +1242,15 @@ writeBufferToSeparateStrips (TIFF* out, uint8_t* buf, - } - if ((dump->outfile != NULL) && (dump->level == 1)) - { -- dump_info(dump->outfile, dump->format,"", -+ if (scanlinesize > 0x0ffffffffULL) { -+ dump_info(dump->infile, dump->format, "loadImage", -+ "Attention: scanlinesize %"PRIu64" is larger than UINT32_MAX.\nFollowing dump might be wrong.", -+ scanlinesize); -+ } -+ dump_info(dump->outfile, dump->format,"", - "Sample %2d, Strip: %2d, bytes: %4d, Row %4d, bytes: %4d, Input offset: %6d", -- s + 1, strip + 1, stripsize, row + 1, scanlinesize, src - buf); -- dump_buffer(dump->outfile, dump->format, nrows, scanlinesize, row, obuf); -+ s + 1, strip + 1, stripsize, row + 1, (uint32_t)scanlinesize, src - buf); -+ dump_buffer(dump->outfile, dump->format, nrows, (uint32_t)scanlinesize, row, obuf); - } - - if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) -@@ -1267,7 +1277,7 @@ static int writeBufferToContigTiles (TIFF* out, uint8_t* buf, uint32_t imageleng - uint32_t tl, tw; - uint32_t row, col, nrow, ncol; - uint32_t src_rowsize, col_offset; -- uint32_t tile_rowsize = TIFFTileRowSize(out); -+ tmsize_t tile_rowsize = TIFFTileRowSize(out); - uint8_t* bufp = (uint8_t*) buf; - tsize_t tile_buffsize = 0; - tsize_t tilesize = TIFFTileSize(out); -@@ -1310,9 +1320,11 @@ static int writeBufferToContigTiles (TIFF* out, uint8_t* buf, uint32_t imageleng - } - src_rowsize = ((imagewidth * spp * bps) + 7U) / 8; - -- tilebuf = limitMalloc(tile_buffsize); -+ /* Add 3 padding bytes for extractContigSamples32bits */ -+ tilebuf = limitMalloc(tile_buffsize + NUM_BUFF_OVERSIZE_BYTES); - if (tilebuf == 0) - return 1; -+ memset(tilebuf, 0, tile_buffsize + NUM_BUFF_OVERSIZE_BYTES); - for (row = 0; row < imagelength; row += tl) - { - nrow = (row + tl > imagelength) ? imagelength - row : tl; -@@ -1358,7 +1370,8 @@ static int writeBufferToSeparateTiles (TIFF* out, uint8_t* buf, uint32_t imagele - uint32_t imagewidth, tsample_t spp, - struct dump_opts * dump) - { -- tdata_t obuf = limitMalloc(TIFFTileSize(out)); -+ /* Add 3 padding bytes for extractContigSamples32bits */ -+ tdata_t obuf = limitMalloc(TIFFTileSize(out) + NUM_BUFF_OVERSIZE_BYTES); - uint32_t tl, tw; - uint32_t row, col, nrow, ncol; - uint32_t src_rowsize, col_offset; -@@ -1368,6 +1381,7 @@ static int writeBufferToSeparateTiles (TIFF* out, uint8_t* buf, uint32_t imagele - - if (obuf == NULL) - return 1; -+ memset(obuf, 0, TIFFTileSize(out) + NUM_BUFF_OVERSIZE_BYTES); - - if( !TIFFGetField(out, TIFFTAG_TILELENGTH, &tl) || - !TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw) || -@@ -1793,14 +1807,14 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32 - - *opt_offset = '\0'; - /* convert option to lowercase */ -- end = strlen (opt_ptr); -+ end = (unsigned int)strlen (opt_ptr); - for (i = 0; i < end; i++) - *(opt_ptr + i) = tolower((int) *(opt_ptr + i)); - /* Look for dump format specification */ - if (strncmp(opt_ptr, "for", 3) == 0) - { - /* convert value to lowercase */ -- end = strlen (opt_offset + 1); -+ end = (unsigned int)strlen (opt_offset + 1); - for (i = 1; i <= end; i++) - *(opt_offset + i) = tolower((int) *(opt_offset + i)); - /* check dump format value */ -@@ -2273,6 +2287,8 @@ main(int argc, char* argv[]) - size_t length; - char temp_filename[PATH_MAX + 16]; /* Extra space keeps the compiler from complaining */ - -+ assert(NUM_BUFF_OVERSIZE_BYTES >= 3); -+ - little_endian = *((unsigned char *)&little_endian) & '1'; - - initImageData(&image); -@@ -3227,13 +3243,13 @@ extractContigSamples32bits (uint8_t *in, uint8_t *out, uint32_t cols, - /* If we have a full buffer's worth, write it out */ - if (ready_bits >= 32) - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -3642,13 +3658,13 @@ extractContigSamplesShifted32bits (uint8_t *in, uint8_t *out, uint32_t cols, - } - else /* If we have a full buffer's worth, write it out */ - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -3825,10 +3841,10 @@ extractContigSamplesToTileBuffer(uint8_t *out, uint8_t *in, uint32_t rows, uint3 - static int readContigStripsIntoBuffer (TIFF* in, uint8_t* buf) - { - uint8_t* bufp = buf; -- int32_t bytes_read = 0; -+ tmsize_t bytes_read = 0; - uint32_t strip, nstrips = TIFFNumberOfStrips(in); -- uint32_t stripsize = TIFFStripSize(in); -- uint32_t rows = 0; -+ tmsize_t stripsize = TIFFStripSize(in); -+ tmsize_t rows = 0; - uint32_t rps = TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps); - tsize_t scanline_size = TIFFScanlineSize(in); - -@@ -3841,11 +3857,11 @@ static int readContigStripsIntoBuffer (TIFF* in, uint8_t* buf) - bytes_read = TIFFReadEncodedStrip (in, strip, bufp, -1); - rows = bytes_read / scanline_size; - if ((strip < (nstrips - 1)) && (bytes_read != (int32_t)stripsize)) -- TIFFError("", "Strip %"PRIu32": read %"PRId32" bytes, strip size %"PRIu32, -+ TIFFError("", "Strip %"PRIu32": read %"PRId64" bytes, strip size %"PRIu64, - strip + 1, bytes_read, stripsize); - - if (bytes_read < 0 && !ignore) { -- TIFFError("", "Error reading strip %"PRIu32" after %"PRIu32" rows", -+ TIFFError("", "Error reading strip %"PRIu32" after %"PRIu64" rows", - strip, rows); - return 0; - } -@@ -4310,13 +4326,13 @@ combineSeparateSamples32bits (uint8_t *in[], uint8_t *out, uint32_t cols, - /* If we have a full buffer's worth, write it out */ - if (ready_bits >= 32) - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -4359,10 +4375,10 @@ combineSeparateSamples32bits (uint8_t *in[], uint8_t *out, uint32_t cols, - "Row %3d, Col %3d, Src byte offset %3d bit offset %2d Dst offset %3d", - row + 1, col + 1, src_byte, src_bit, dst - out); - -- dump_long (dumpfile, format, "Match bits ", matchbits); -+ dump_wide (dumpfile, format, "Match bits ", matchbits); - dump_data (dumpfile, format, "Src bits ", src, 4); -- dump_long (dumpfile, format, "Buff1 bits ", buff1); -- dump_long (dumpfile, format, "Buff2 bits ", buff2); -+ dump_wide (dumpfile, format, "Buff1 bits ", buff1); -+ dump_wide (dumpfile, format, "Buff2 bits ", buff2); - dump_byte (dumpfile, format, "Write bits1", bytebuff1); - dump_byte (dumpfile, format, "Write bits2", bytebuff2); - dump_info (dumpfile, format, "", "Ready bits: %2d", ready_bits); -@@ -4835,13 +4851,13 @@ combineSeparateTileSamples32bits (uint8_t *in[], uint8_t *out, uint32_t cols, - /* If we have a full buffer's worth, write it out */ - if (ready_bits >= 32) - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -4884,10 +4900,10 @@ combineSeparateTileSamples32bits (uint8_t *in[], uint8_t *out, uint32_t cols, - "Row %3d, Col %3d, Src byte offset %3d bit offset %2d Dst offset %3d", - row + 1, col + 1, src_byte, src_bit, dst - out); - -- dump_long (dumpfile, format, "Match bits ", matchbits); -+ dump_wide (dumpfile, format, "Match bits ", matchbits); - dump_data (dumpfile, format, "Src bits ", src, 4); -- dump_long (dumpfile, format, "Buff1 bits ", buff1); -- dump_long (dumpfile, format, "Buff2 bits ", buff2); -+ dump_wide (dumpfile, format, "Buff1 bits ", buff1); -+ dump_wide (dumpfile, format, "Buff2 bits ", buff2); - dump_byte (dumpfile, format, "Write bits1", bytebuff1); - dump_byte (dumpfile, format, "Write bits2", bytebuff2); - dump_info (dumpfile, format, "", "Ready bits: %2d", ready_bits); -@@ -4910,7 +4926,7 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8_t *obuf, uint32_t lengt - { - int i, bytes_per_sample, bytes_per_pixel, shift_width, result = 1; - uint32_t j; -- int32_t bytes_read = 0; -+ tmsize_t bytes_read = 0; - uint16_t bps = 0, planar; - uint32_t nstrips; - uint32_t strips_per_sample; -@@ -4976,7 +4992,7 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8_t *obuf, uint32_t lengt - for (s = 0; (s < spp) && (s < MAX_SAMPLES); s++) - { - srcbuffs[s] = NULL; -- buff = limitMalloc(stripsize + 3); -+ buff = limitMalloc(stripsize + NUM_BUFF_OVERSIZE_BYTES); - if (!buff) - { - TIFFError ("readSeparateStripsIntoBuffer", -@@ -4999,7 +5015,7 @@ static int readSeparateStripsIntoBuffer (TIFF *in, uint8_t *obuf, uint32_t lengt - buff = srcbuffs[s]; - strip = (s * strips_per_sample) + j; - bytes_read = TIFFReadEncodedStrip (in, strip, buff, stripsize); -- rows_this_strip = bytes_read / src_rowsize; -+ rows_this_strip = (uint32_t)(bytes_read / src_rowsize); - if (bytes_read < 0 && !ignore) - { - TIFFError(TIFFFileName(in), -@@ -6062,13 +6078,14 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c - uint16_t input_compression = 0, input_photometric = 0; - uint16_t subsampling_horiz, subsampling_vert; - uint32_t width = 0, length = 0; -- uint32_t stsize = 0, tlsize = 0, buffsize = 0, scanlinesize = 0; -+ tmsize_t stsize = 0, tlsize = 0, buffsize = 0; -+ tmsize_t scanlinesize = 0; - uint32_t tw = 0, tl = 0; /* Tile width and length */ -- uint32_t tile_rowsize = 0; -+ tmsize_t tile_rowsize = 0; - unsigned char *read_buff = NULL; - unsigned char *new_buff = NULL; - int readunit = 0; -- static uint32_t prev_readsize = 0; -+ static tmsize_t prev_readsize = 0; - - TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps); - TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp); -@@ -6325,6 +6342,8 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c - /* The buffsize_check and the possible adaptation of buffsize - * has to account also for padding of each line to a byte boundary. - * This is assumed by mirrorImage() and rotateImage(). -+ * Furthermore, functions like extractContigSamplesShifted32bits() -+ * need a buffer, which is at least 3 bytes larger than the actual image. - * Otherwise buffer-overflow might occur there. - */ - buffsize_check = length * (uint32_t)(((width * spp * bps) + 7) / 8); -@@ -6376,7 +6395,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c - TIFFError("loadImage", "Unable to allocate/reallocate read buffer"); - return (-1); - } -- read_buff = (unsigned char *)limitMalloc(buffsize+3); -+ read_buff = (unsigned char *)limitMalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - { -@@ -6387,11 +6406,11 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c - TIFFError("loadImage", "Unable to allocate/reallocate read buffer"); - return (-1); - } -- new_buff = _TIFFrealloc(read_buff, buffsize+3); -+ new_buff = _TIFFrealloc(read_buff, buffsize + NUM_BUFF_OVERSIZE_BYTES); - if (!new_buff) - { - free (read_buff); -- read_buff = (unsigned char *)limitMalloc(buffsize+3); -+ read_buff = (unsigned char *)limitMalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - read_buff = new_buff; -@@ -6464,8 +6483,13 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c - dump_info (dump->infile, dump->format, "", - "Bits per sample %"PRIu16", Samples per pixel %"PRIu16, bps, spp); - -+ if (scanlinesize > 0x0ffffffffULL) { -+ dump_info(dump->infile, dump->format, "loadImage", -+ "Attention: scanlinesize %"PRIu64" is larger than UINT32_MAX.\nFollowing dump might be wrong.", -+ scanlinesize); -+ } - for (i = 0; i < length; i++) -- dump_buffer(dump->infile, dump->format, 1, scanlinesize, -+ dump_buffer(dump->infile, dump->format, 1, (uint32_t)scanlinesize, - i, read_buff + (i * scanlinesize)); - } - return (0); -@@ -7485,13 +7509,13 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image, - if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) { - TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks); - if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) { -- int inknameslen = strlen(inknames) + 1; -+ int inknameslen = (int)strlen(inknames) + 1; - const char* cp = inknames; - while (ninks > 1) { - cp = strchr(cp, '\0'); - if (cp) { - cp++; -- inknameslen += (strlen(cp) + 1); -+ inknameslen += ((int)strlen(cp) + 1); - } - ninks--; - } -@@ -7554,23 +7578,23 @@ createImageSection(uint32_t sectsize, unsigned char **sect_buff_ptr) - - if (!sect_buff) - { -- sect_buff = (unsigned char *)limitMalloc(sectsize); -+ sect_buff = (unsigned char *)limitMalloc(sectsize + NUM_BUFF_OVERSIZE_BYTES); - if (!sect_buff) - { - TIFFError("createImageSection", "Unable to allocate/reallocate section buffer"); - return (-1); - } -- _TIFFmemset(sect_buff, 0, sectsize); -+ _TIFFmemset(sect_buff, 0, sectsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - { - if (prev_sectsize < sectsize) - { -- new_buff = _TIFFrealloc(sect_buff, sectsize); -+ new_buff = _TIFFrealloc(sect_buff, sectsize + NUM_BUFF_OVERSIZE_BYTES); - if (!new_buff) - { - _TIFFfree (sect_buff); -- sect_buff = (unsigned char *)limitMalloc(sectsize); -+ sect_buff = (unsigned char *)limitMalloc(sectsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - sect_buff = new_buff; -@@ -7580,7 +7604,7 @@ createImageSection(uint32_t sectsize, unsigned char **sect_buff_ptr) - TIFFError("createImageSection", "Unable to allocate/reallocate section buffer"); - return (-1); - } -- _TIFFmemset(sect_buff, 0, sectsize); -+ _TIFFmemset(sect_buff, 0, sectsize + NUM_BUFF_OVERSIZE_BYTES); - } - } - -@@ -7611,17 +7635,17 @@ processCropSelections(struct image_data *image, struct crop_mask *crop, - cropsize = crop->bufftotal; - crop_buff = seg_buffs[0].buffer; - if (!crop_buff) -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - else - { - prev_cropsize = seg_buffs[0].size; - if (prev_cropsize < cropsize) - { -- next_buff = _TIFFrealloc(crop_buff, cropsize); -+ next_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES); - if (! next_buff) - { - _TIFFfree (crop_buff); -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - crop_buff = next_buff; -@@ -7634,7 +7658,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop, - return (-1); - } - -- _TIFFmemset(crop_buff, 0, cropsize); -+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES); - seg_buffs[0].buffer = crop_buff; - seg_buffs[0].size = cropsize; - -@@ -7714,17 +7738,17 @@ processCropSelections(struct image_data *image, struct crop_mask *crop, - cropsize = crop->bufftotal; - crop_buff = seg_buffs[i].buffer; - if (!crop_buff) -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - else - { - prev_cropsize = seg_buffs[0].size; - if (prev_cropsize < cropsize) - { -- next_buff = _TIFFrealloc(crop_buff, cropsize); -+ next_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES); - if (! next_buff) - { - _TIFFfree (crop_buff); -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - crop_buff = next_buff; -@@ -7737,7 +7761,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop, - return (-1); - } - -- _TIFFmemset(crop_buff, 0, cropsize); -+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES); - seg_buffs[i].buffer = crop_buff; - seg_buffs[i].size = cropsize; - -@@ -7853,24 +7877,24 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop, - crop_buff = *crop_buff_ptr; - if (!crop_buff) - { -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - if (!crop_buff) - { - TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer"); - return (-1); - } -- _TIFFmemset(crop_buff, 0, cropsize); -+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES); - prev_cropsize = cropsize; - } - else - { - if (prev_cropsize < cropsize) - { -- new_buff = _TIFFrealloc(crop_buff, cropsize); -+ new_buff = _TIFFrealloc(crop_buff, cropsize + NUM_BUFF_OVERSIZE_BYTES); - if (!new_buff) - { - free (crop_buff); -- crop_buff = (unsigned char *)limitMalloc(cropsize); -+ crop_buff = (unsigned char *)limitMalloc(cropsize + NUM_BUFF_OVERSIZE_BYTES); - } - else - crop_buff = new_buff; -@@ -7879,7 +7903,7 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop, - TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer"); - return (-1); - } -- _TIFFmemset(crop_buff, 0, cropsize); -+ _TIFFmemset(crop_buff, 0, cropsize + NUM_BUFF_OVERSIZE_BYTES); - } - } - -@@ -8177,13 +8201,13 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image, - if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) { - TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks); - if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) { -- int inknameslen = strlen(inknames) + 1; -+ int inknameslen = (int)strlen(inknames) + 1; - const char* cp = inknames; - while (ninks > 1) { - cp = strchr(cp, '\0'); - if (cp) { - cp++; -- inknameslen += (strlen(cp) + 1); -+ inknameslen += ((int)strlen(cp) + 1); - } - ninks--; - } -@@ -8568,13 +8592,13 @@ rotateContigSamples32bits(uint16_t rotation, uint16_t spp, uint16_t bps, uint32_ - } - else /* If we have a full buffer's worth, write it out */ - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -8643,12 +8667,13 @@ rotateImage(uint16_t rotation, struct image_data *image, uint32_t *img_width, - return (-1); - } - -- if (!(rbuff = (unsigned char *)limitMalloc(buffsize))) -+ /* Add 3 padding bytes for extractContigSamplesShifted32bits */ -+ if (!(rbuff = (unsigned char *)limitMalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES))) - { -- TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes", buffsize); -+ TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes", buffsize + NUM_BUFF_OVERSIZE_BYTES); - return (-1); - } -- _TIFFmemset(rbuff, '\0', buffsize); -+ _TIFFmemset(rbuff, '\0', buffsize + NUM_BUFF_OVERSIZE_BYTES); - - ibuff = *ibuff_ptr; - switch (rotation) -@@ -9176,13 +9201,13 @@ reverseSamples32bits (uint16_t spp, uint16_t bps, uint32_t width, - } - else /* If we have a full buffer's worth, write it out */ - { -- bytebuff1 = (buff2 >> 56); -+ bytebuff1 = (uint8_t)(buff2 >> 56); - *dst++ = bytebuff1; -- bytebuff2 = (buff2 >> 48); -+ bytebuff2 = (uint8_t)(buff2 >> 48); - *dst++ = bytebuff2; -- bytebuff3 = (buff2 >> 40); -+ bytebuff3 = (uint8_t)(buff2 >> 40); - *dst++ = bytebuff3; -- bytebuff4 = (buff2 >> 32); -+ bytebuff4 = (uint8_t)(buff2 >> 32); - *dst++ = bytebuff4; - ready_bits -= 32; - -@@ -9273,12 +9298,13 @@ mirrorImage(uint16_t spp, uint16_t bps, uint16_t mirror, uint32_t width, uint32_ - { - case MIRROR_BOTH: - case MIRROR_VERT: -- line_buff = (unsigned char *)limitMalloc(rowsize); -+ line_buff = (unsigned char *)limitMalloc(rowsize + NUM_BUFF_OVERSIZE_BYTES); - if (line_buff == NULL) - { -- TIFFError ("mirrorImage", "Unable to allocate mirror line buffer of %1u bytes", rowsize); -+ TIFFError ("mirrorImage", "Unable to allocate mirror line buffer of %1u bytes", rowsize + NUM_BUFF_OVERSIZE_BYTES); - return (-1); - } -+ _TIFFmemset(line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES); - - dst = ibuff + (rowsize * (length - 1)); - for (row = 0; row < length / 2; row++) -@@ -9310,11 +9336,12 @@ mirrorImage(uint16_t spp, uint16_t bps, uint16_t mirror, uint32_t width, uint32_ - } - else - { /* non 8 bit per sample data */ -- if (!(line_buff = (unsigned char *)limitMalloc(rowsize + 1))) -+ if (!(line_buff = (unsigned char *)limitMalloc(rowsize + NUM_BUFF_OVERSIZE_BYTES))) - { - TIFFError("mirrorImage", "Unable to allocate mirror line buffer"); - return (-1); - } -+ _TIFFmemset(line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES); - bytes_per_sample = (bps + 7) / 8; - bytes_per_pixel = ((bps * spp) + 7) / 8; - if (bytes_per_pixel < (bytes_per_sample + 1)) -@@ -9326,7 +9353,7 @@ mirrorImage(uint16_t spp, uint16_t bps, uint16_t mirror, uint32_t width, uint32_ - { - row_offset = row * rowsize; - src = ibuff + row_offset; -- _TIFFmemset (line_buff, '\0', rowsize); -+ _TIFFmemset (line_buff, '\0', rowsize + NUM_BUFF_OVERSIZE_BYTES); - switch (shift_width) - { - case 1: if (reverseSamples16bits(spp, bps, width, src, line_buff)) --- -2.34.1 - diff --git a/poky/meta/recipes-multimedia/libtiff/files/CVE-2022-2953.patch b/poky/meta/recipes-multimedia/libtiff/files/CVE-2022-2953.patch deleted file mode 100644 index e673945fa3..0000000000 --- a/poky/meta/recipes-multimedia/libtiff/files/CVE-2022-2953.patch +++ /dev/null @@ -1,86 +0,0 @@ -CVE: CVE-2022-2953 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 8fe3735942ea1d90d8cef843b55b3efe8ab6feaf Mon Sep 17 00:00:00 2001 -From: Su_Laus -Date: Mon, 15 Aug 2022 22:11:03 +0200 -Subject: [PATCH] =?UTF-8?q?According=20to=20Richard=20Nolde=20https://gitl?= - =?UTF-8?q?ab.com/libtiff/libtiff/-/issues/401#note=5F877637400=20the=20ti?= - =?UTF-8?q?ffcrop=20option=20=E2=80=9E-S=E2=80=9C=20is=20also=20mutually?= - =?UTF-8?q?=20exclusive=20to=20the=20other=20crop=20options=20(-X|-Y),=20-?= - =?UTF-8?q?Z=20and=20-z.?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is now checked and ends tiffcrop if those arguments are not mutually exclusive. - -This MR will fix the following tiffcrop issues: #349, #414, #422, #423, #424 ---- - tools/tiffcrop.c | 31 ++++++++++++++++--------------- - 1 file changed, 16 insertions(+), 15 deletions(-) - -diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c -index 90286a5e..c3b758ec 100644 ---- a/tools/tiffcrop.c -+++ b/tools/tiffcrop.c -@@ -173,12 +173,12 @@ static char tiffcrop_rev_date[] = "02-09-2022"; - #define ROTATECW_270 32 - #define ROTATE_ANY (ROTATECW_90 | ROTATECW_180 | ROTATECW_270) - --#define CROP_NONE 0 --#define CROP_MARGINS 1 --#define CROP_WIDTH 2 --#define CROP_LENGTH 4 --#define CROP_ZONES 8 --#define CROP_REGIONS 16 -+#define CROP_NONE 0 /* "-S" -> Page_MODE_ROWSCOLS and page->rows/->cols != 0 */ -+#define CROP_MARGINS 1 /* "-m" */ -+#define CROP_WIDTH 2 /* "-X" */ -+#define CROP_LENGTH 4 /* "-Y" */ -+#define CROP_ZONES 8 /* "-Z" */ -+#define CROP_REGIONS 16 /* "-z" */ - #define CROP_ROTATE 32 - #define CROP_MIRROR 64 - #define CROP_INVERT 128 -@@ -316,7 +316,7 @@ struct crop_mask { - #define PAGE_MODE_RESOLUTION 1 - #define PAGE_MODE_PAPERSIZE 2 - #define PAGE_MODE_MARGINS 4 --#define PAGE_MODE_ROWSCOLS 8 -+#define PAGE_MODE_ROWSCOLS 8 /* for -S option */ - - #define INVERT_DATA_ONLY 10 - #define INVERT_DATA_AND_TAG 11 -@@ -781,7 +781,7 @@ static const char usage_info[] = - " The four debug/dump options are independent, though it makes little sense to\n" - " specify a dump file without specifying a detail level.\n" - "\n" --"Note: The (-X|-Y), -Z and -z options are mutually exclusive.\n" -+"Note: The (-X|-Y), -Z, -z and -S options are mutually exclusive.\n" - " In no case should the options be applied to a given selection successively.\n" - "\n" - ; -@@ -2131,13 +2131,14 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32 - /*NOTREACHED*/ - } - } -- /*-- Check for not allowed combinations (e.g. -X, -Y and -Z and -z are mutually exclusive) --*/ -- char XY, Z, R; -+ /*-- Check for not allowed combinations (e.g. -X, -Y and -Z, -z and -S are mutually exclusive) --*/ -+ char XY, Z, R, S; - XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)); - Z = (crop_data->crop_mode & CROP_ZONES); - R = (crop_data->crop_mode & CROP_REGIONS); -- if ((XY && Z) || (XY && R) || (Z && R)) { -- TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z and -z are mutually exclusive.->Exit"); -+ S = (page->mode & PAGE_MODE_ROWSCOLS); -+ if ((XY && Z) || (XY && R) || (XY && S) || (Z && R) || (Z && S) || (R && S)) { -+ TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->Exit"); - exit(EXIT_FAILURE); - } - } /* end process_command_opts */ --- -2.34.1 - diff --git a/poky/meta/recipes-multimedia/libtiff/files/CVE-2022-34526.patch b/poky/meta/recipes-multimedia/libtiff/files/CVE-2022-34526.patch deleted file mode 100644 index 54c3345746..0000000000 --- a/poky/meta/recipes-multimedia/libtiff/files/CVE-2022-34526.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 275735d0354e39c0ac1dc3c0db2120d6f31d1990 Mon Sep 17 00:00:00 2001 -From: Even Rouault -Date: Mon, 27 Jun 2022 16:09:43 +0200 -Subject: [PATCH] _TIFFCheckFieldIsValidForCodec(): return FALSE when passed a - codec-specific tag and the codec is not configured (fixes #433) - -This avoids crashes when querying such tags - -CVE: CVE-2022-34526 -Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/275735d0354e39c0ac1dc3c0db2120d6f31d1990] -Signed-off-by: Khem Raj ---- - libtiff/tif_dirinfo.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c -index c30f569b..3371cb5c 100644 ---- a/libtiff/tif_dirinfo.c -+++ b/libtiff/tif_dirinfo.c -@@ -1191,6 +1191,9 @@ _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag) - default: - return 1; - } -+ if( !TIFFIsCODECConfigured(tif->tif_dir.td_compression) ) { -+ return 0; -+ } - /* Check if codec specific tags are allowed for the current - * compression scheme (codec) */ - switch (tif->tif_dir.td_compression) { --- -GitLab - diff --git a/poky/meta/recipes-multimedia/libtiff/tiff_4.4.0.bb b/poky/meta/recipes-multimedia/libtiff/tiff_4.4.0.bb deleted file mode 100644 index 29cb4111d6..0000000000 --- a/poky/meta/recipes-multimedia/libtiff/tiff_4.4.0.bb +++ /dev/null @@ -1,71 +0,0 @@ -SUMMARY = "Provides support for the Tag Image File Format (TIFF)" -DESCRIPTION = "Library provides support for the Tag Image File Format \ -(TIFF), a widely used format for storing image data. This library \ -provide means to easily access and create TIFF image files." -HOMEPAGE = "http://www.libtiff.org/" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=34da3db46fab7501992f9615d7e158cf" - -CVE_PRODUCT = "libtiff" - -SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \ - file://0001-fix-the-FPE-in-tiffcrop-415-427-and-428.patch \ - file://CVE-2022-34526.patch \ - file://CVE-2022-2953.patch \ - file://0001-Revised-handling-of-TIFFTAG_INKNAMES-and-related-TIF.patch \ - file://0001-tiffcrop-S-option-Make-decision-simpler.patch \ - file://0001-tiffcrop-disable-incompatibility-of-Z-X-Y-z-options-.patch \ - file://0001-tiffcrop-subroutines-require-a-larger-buffer-fixes-2.patch \ - " - -SRC_URI[sha256sum] = "917223b37538959aca3b790d2d73aa6e626b688e02dcda272aec24c2f498abed" - -# exclude betas -UPSTREAM_CHECK_REGEX = "tiff-(?P\d+(\.\d+)+).tar" - -# Tested with check from https://security-tracker.debian.org/tracker/CVE-2015-7313 -# and 4.3.0 doesn't have the issue -CVE_CHECK_IGNORE += "CVE-2015-7313" -# These issues only affect libtiff post-4.3.0 but before 4.4.0, -# caused by 3079627e and fixed by b4e79bfa. -CVE_CHECK_IGNORE += "CVE-2022-1622 CVE-2022-1623" -# Issue is in jbig which we don't enable -CVE_CHECK_IGNORE += "CVE-2022-1210" - -inherit autotools multilib_header - -CACHED_CONFIGUREVARS = "ax_cv_check_gl_libgl=no" - -PACKAGECONFIG ?= "cxx jpeg zlib lzma \ - strip-chopping extrasample-as-alpha check-ycbcr-subsampling" - -PACKAGECONFIG[cxx] = "--enable-cxx,--disable-cxx,," -PACKAGECONFIG[jbig] = "--enable-jbig,--disable-jbig,jbig," -PACKAGECONFIG[jpeg] = "--enable-jpeg,--disable-jpeg,jpeg," -PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib," -PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz," - -# Convert single-strip uncompressed images to multiple strips of specified -# size (default: 8192) to reduce memory usage -PACKAGECONFIG[strip-chopping] = "--enable-strip-chopping,--disable-strip-chopping,," - -# Treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA -PACKAGECONFIG[extrasample-as-alpha] = "--enable-extrasample-as-alpha,--disable-extrasample-as-alpha,," - -# Control picking up YCbCr subsample info. Disable to support files lacking -# the tag -PACKAGECONFIG[check-ycbcr-subsampling] = "--enable-check-ycbcr-subsampling,--disable-check-ycbcr-subsampling,," - -# Support a mechanism allowing reading large strips (usually one strip files) -# in chunks when using TIFFReadScanline. Experimental 4.0+ feature -PACKAGECONFIG[chunky-strip-read] = "--enable-chunky-strip-read,--disable-chunky-strip-read,," - -PACKAGES =+ "tiffxx tiff-utils" -FILES:tiffxx = "${libdir}/libtiffxx.so.*" -FILES:tiff-utils = "${bindir}/*" - -do_install:append() { - oe_multilib_header tiffconf.h -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-multimedia/libtiff/tiff_4.5.0.bb b/poky/meta/recipes-multimedia/libtiff/tiff_4.5.0.bb new file mode 100644 index 0000000000..261cb52081 --- /dev/null +++ b/poky/meta/recipes-multimedia/libtiff/tiff_4.5.0.bb @@ -0,0 +1,64 @@ +SUMMARY = "Provides support for the Tag Image File Format (TIFF)" +DESCRIPTION = "Library provides support for the Tag Image File Format \ +(TIFF), a widely used format for storing image data. This library \ +provide means to easily access and create TIFF image files." +HOMEPAGE = "http://www.libtiff.org/" +LICENSE = "BSD-2-Clause" +LIC_FILES_CHKSUM = "file://LICENSE.md;md5=a3e32d664d6db1386b4689c8121531c3" + +CVE_PRODUCT = "libtiff" + +SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz" + +SRC_URI[sha256sum] = "c7a1d9296649233979fa3eacffef3fa024d73d05d589cb622727b5b08c423464" + +# exclude betas +UPSTREAM_CHECK_REGEX = "tiff-(?P\d+(\.\d+)+).tar" + +# Tested with check from https://security-tracker.debian.org/tracker/CVE-2015-7313 +# and 4.3.0 doesn't have the issue +CVE_CHECK_IGNORE += "CVE-2015-7313" +# These issues only affect libtiff post-4.3.0 but before 4.4.0, +# caused by 3079627e and fixed by b4e79bfa. +CVE_CHECK_IGNORE += "CVE-2022-1622 CVE-2022-1623" +# Issue is in jbig which we don't enable +CVE_CHECK_IGNORE += "CVE-2022-1210" + +inherit autotools multilib_header + +CACHED_CONFIGUREVARS = "ax_cv_check_gl_libgl=no" + +PACKAGECONFIG ?= "cxx jpeg zlib lzma \ + strip-chopping extrasample-as-alpha check-ycbcr-subsampling" + +PACKAGECONFIG[cxx] = "--enable-cxx,--disable-cxx,," +PACKAGECONFIG[jbig] = "--enable-jbig,--disable-jbig,jbig," +PACKAGECONFIG[jpeg] = "--enable-jpeg,--disable-jpeg,jpeg," +PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib," +PACKAGECONFIG[lzma] = "--enable-lzma,--disable-lzma,xz," +PACKAGECONFIG[webp] = "--enable-webp,--disable-webp,libwebp," + +# Convert single-strip uncompressed images to multiple strips of specified +# size (default: 8192) to reduce memory usage +PACKAGECONFIG[strip-chopping] = "--enable-strip-chopping,--disable-strip-chopping,," + +# Treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA +PACKAGECONFIG[extrasample-as-alpha] = "--enable-extrasample-as-alpha,--disable-extrasample-as-alpha,," + +# Control picking up YCbCr subsample info. Disable to support files lacking +# the tag +PACKAGECONFIG[check-ycbcr-subsampling] = "--enable-check-ycbcr-subsampling,--disable-check-ycbcr-subsampling,," + +# Support a mechanism allowing reading large strips (usually one strip files) +# in chunks when using TIFFReadScanline. Experimental 4.0+ feature +PACKAGECONFIG[chunky-strip-read] = "--enable-chunky-strip-read,--disable-chunky-strip-read,," + +PACKAGES =+ "tiffxx tiff-utils" +FILES:tiffxx = "${libdir}/libtiffxx.so.*" +FILES:tiff-utils = "${bindir}/*" + +do_install:append() { + oe_multilib_header tiffconf.h +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-multimedia/mpg123/mpg123_1.31.1.bb b/poky/meta/recipes-multimedia/mpg123/mpg123_1.31.1.bb index 11ff5dea92..a8a2377bd4 100644 --- a/poky/meta/recipes-multimedia/mpg123/mpg123_1.31.1.bb +++ b/poky/meta/recipes-multimedia/mpg123/mpg123_1.31.1.bb @@ -37,6 +37,8 @@ AUDIOMODS += "${@bb.utils.contains('PACKAGECONFIG', 'pulseaudio', 'pulse', '', d EXTRA_OECONF = " \ --enable-shared \ + --enable-largefile \ + --disable-lfs-alias \ --with-audio='${AUDIOMODS}' \ ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-cpu=neon', '', d)} \ ${@bb.utils.contains('TUNE_FEATURES', 'altivec', '--with-cpu=altivec', '', d)} \ diff --git a/poky/meta/recipes-sato/puzzles/puzzles_git.bb b/poky/meta/recipes-sato/puzzles/puzzles_git.bb index 615eb1bb77..c94fef4931 100644 --- a/poky/meta/recipes-sato/puzzles/puzzles_git.bb +++ b/poky/meta/recipes-sato/puzzles/puzzles_git.bb @@ -10,7 +10,7 @@ REQUIRED_DISTRO_FEATURES = "x11" SRC_URI = "git://git.tartarus.org/simon/puzzles.git;branch=main" UPSTREAM_CHECK_COMMITS = "1" -SRCREV = "06f6e878a0b588c513024c3498b68a3c87594ab7" +SRCREV = "14c025d192579961d1ade51f2a322bd765aef0e5" PE = "2" PV = "0.0+git${SRCPV}" diff --git a/poky/meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.30.bb b/poky/meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.30.bb deleted file mode 100644 index 5e3c84194a..0000000000 --- a/poky/meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.30.bb +++ /dev/null @@ -1,8 +0,0 @@ -require rxvt-unicode.inc - -LICENSE = "GPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ - file://src/main.C;beginline=1;endline=31;md5=d3600d7ee1062667fcd1193fbe6485f6" - -SRC_URI[sha256sum] = "fe1c93d12f385876457a989fc3ae05c0915d2692efc59289d0f70fabe5b44d2d" - diff --git a/poky/meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.31.bb b/poky/meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.31.bb new file mode 100644 index 0000000000..c127b9bbe3 --- /dev/null +++ b/poky/meta/recipes-sato/rxvt-unicode/rxvt-unicode_9.31.bb @@ -0,0 +1,8 @@ +require rxvt-unicode.inc + +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ + file://src/main.C;beginline=1;endline=31;md5=d3600d7ee1062667fcd1193fbe6485f6" + +SRC_URI[sha256sum] = "aaa13fcbc149fe0f3f391f933279580f74a96fd312d6ed06b8ff03c2d46672e8" + diff --git a/poky/meta/recipes-sato/webkit/webkitgtk/0001-FindGObjectIntrospection.cmake-prefix-variables-obta.patch b/poky/meta/recipes-sato/webkit/webkitgtk/0001-FindGObjectIntrospection.cmake-prefix-variables-obta.patch index 2379924cc9..8ae39f14e1 100644 --- a/poky/meta/recipes-sato/webkit/webkitgtk/0001-FindGObjectIntrospection.cmake-prefix-variables-obta.patch +++ b/poky/meta/recipes-sato/webkit/webkitgtk/0001-FindGObjectIntrospection.cmake-prefix-variables-obta.patch @@ -1,4 +1,4 @@ -From e0bf97eecfa601e08b9578f00b1000890284241a Mon Sep 17 00:00:00 2001 +From 10cfdcc905915d8814c609008a069102f2bc7e39 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 27 Oct 2015 16:02:19 +0200 Subject: [PATCH] FindGObjectIntrospection.cmake: prefix variables obtained @@ -9,30 +9,21 @@ reasons why this is not approproiate for upstream submission. Upstream-Status: Inappropriate [oe-core specific] Signed-off-by: Alexander Kanavin - --- - Source/cmake/FindGObjectIntrospection.cmake | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) + Source/cmake/FindGI.cmake | 3 +++ + 1 file changed, 3 insertions(+) -diff --git a/Source/cmake/FindGObjectIntrospection.cmake b/Source/cmake/FindGObjectIntrospection.cmake -index be96814a..ae67b593 100644 ---- a/Source/cmake/FindGObjectIntrospection.cmake -+++ b/Source/cmake/FindGObjectIntrospection.cmake -@@ -16,7 +16,6 @@ - # Redistribution and use is allowed according to the terms of the BSD license. +diff --git a/Source/cmake/FindGI.cmake b/Source/cmake/FindGI.cmake +index af039cbb..b3e810cd 100644 +--- a/Source/cmake/FindGI.cmake ++++ b/Source/cmake/FindGI.cmake +@@ -72,6 +72,9 @@ if (PKG_CONFIG_FOUND) + endif () + endif () ++set(_GI_SCANNER_EXE "$ENV{PKG_CONFIG_SYSROOT_DIR}${_GI_SCANNER_EXE}") ++set(_GI_COMPILER_EXE "$ENV{PKG_CONFIG_SYSROOT_DIR}${_GI_COMPILER_EXE}") ++ + find_program(GI_SCANNER_EXE NAMES ${_GI_SCANNER_EXE} g-ir-scanner) + find_program(GI_COMPILER_EXE NAMES ${_GI_COMPILER_EXE} g-ir-compiler) -- - find_package(PkgConfig QUIET) - if (PKG_CONFIG_FOUND) - if (PACKAGE_FIND_VERSION_COUNT GREATER 0) -@@ -30,6 +29,9 @@ if (PKG_CONFIG_FOUND) - pkg_get_variable(INTROSPECTION_GENERATE gobject-introspection-1.0 g_ir_generate) - pkg_get_variable(INTROSPECTION_GIRDIR gobject-introspection-1.0 girdir) - pkg_get_variable(INTROSPECTION_TYPELIBDIR gobject-introspection-1.0 typelibdir) -+ set(INTROSPECTION_SCANNER "$ENV{PKG_CONFIG_SYSROOT_DIR}${INTROSPECTION_SCANNER}") -+ set(INTROSPECTION_COMPILER "$ENV{PKG_CONFIG_SYSROOT_DIR}${INTROSPECTION_COMPILER}") -+ set(INTROSPECTION_GENERATE "$ENV{PKG_CONFIG_SYSROOT_DIR}${INTROSPECTION_GENERATE}") - set(INTROSPECTION_VERSION "${_pc_gir_VERSION}") - if (${INTROSPECTION_VERSION} VERSION_GREATER_EQUAL "1.59.1") - set(INTROSPECTION_HAVE_SOURCES_TOP_DIRS YES) diff --git a/poky/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-without-opengl-or-es.patch b/poky/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-without-opengl-or-es.patch deleted file mode 100644 index 09256951f4..0000000000 --- a/poky/meta/recipes-sato/webkit/webkitgtk/0001-Fix-build-without-opengl-or-es.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 646e347c173dbb9782492ac7cb4f54b65533ba90 Mon Sep 17 00:00:00 2001 -From: Martin Jansa -Date: Sun, 17 Oct 2021 20:49:21 +0000 -Subject: [PATCH] Fix build without opengl-or-es - -* fix build failure when opengl-or-es is disabled: - In file included from /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/webkitgtk/2.34.0-r0/webkitgtk-2.34.0/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:30, - from /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/webkitgtk/2.34.0-r0/build/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-36.cpp:1: - /OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/webkitgtk/2.34.0-r0/webkitgtk-2.34.0/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:41:10: fatal error: WebCore/CoordinatedGraphicsLayer.h: No such file or directory - 41 | #include - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - compilation terminated. - -* the CoordinatedGraphicsLayer.h header installation is controled by - USE_COORDINATED_GRAPHICS in webkitgtk-2.34.0/Source/WebCore/platform/TextureMapper.cmake - but in Source/cmake/OptionsGTK.cmake USE_COORDINATED_GRAPHICS was enabled only inside - if (USE_OPENGL_OR_ES) - -Upstream-Status: Submitted [https://bugs.webkit.org/show_bug.cgi?id=232934] ---- - .../DrawingAreaProxyCoordinatedGraphics.cpp | 2 +- - .../DrawingAreaProxyCoordinatedGraphics.h | 2 +- - .../CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp | 2 +- - .../CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h | 2 +- - .../WebPage/CoordinatedGraphics/LayerTreeHost.cpp | 4 ++-- - .../WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h | 6 +++--- - 6 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp -index 038d9ee2..5e828a10 100644 ---- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp -+++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp -@@ -152,7 +152,7 @@ void DrawingAreaProxyCoordinatedGraphics::setBackingStoreIsDiscardable(bool isBa - #endif - } - --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - void DrawingAreaProxyCoordinatedGraphics::adjustTransientZoom(double scale, FloatPoint origin) - { - send(Messages::DrawingArea::AdjustTransientZoom(scale, origin)); -diff --git a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h -index b23a45ff..cd263402 100644 ---- a/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h -+++ b/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h -@@ -57,7 +57,7 @@ private: - void waitForBackingStoreUpdateOnNextPaint() override; - void setBackingStoreIsDiscardable(bool) override; - --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - void adjustTransientZoom(double scale, WebCore::FloatPoint origin) override; - void commitTransientZoom(double scale, WebCore::FloatPoint origin) override; - #endif -diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp -index 33ac2e1d..42375784 100644 ---- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp -+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp -@@ -486,7 +486,7 @@ void DrawingAreaCoordinatedGraphics::didUpdate() - displayTimerFired(); - } - --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - void DrawingAreaCoordinatedGraphics::adjustTransientZoom(double scale, FloatPoint origin) - { - if (!m_transientZoom) { -diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h -index d8dc6df7..c8322364 100644 ---- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h -+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h -@@ -84,7 +84,7 @@ private: - void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset) override; - void didUpdate() override; - --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - void adjustTransientZoom(double scale, WebCore::FloatPoint origin) override; - void commitTransientZoom(double scale, WebCore::FloatPoint origin) override; - #endif -diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp -index f3304d10..ca0476ff 100644 ---- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp -+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp -@@ -156,7 +156,7 @@ void LayerTreeHost::layerFlushTimerFired() - - bool didSync = m_coordinator.flushPendingLayerChanges(flags); - --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - // If we have an active transient zoom, we want the zoom to win over any changes - // that WebCore makes to the relevant layers, so re-apply our changes after flushing. - if (m_transientZoom) -@@ -453,7 +453,7 @@ void LayerTreeHost::renderNextFrame(bool forceRepaint) - } - } - --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - FloatPoint LayerTreeHost::constrainTransientZoomOrigin(double scale, FloatPoint origin) const - { - FrameView& frameView = *m_webPage.mainFrameView(); -diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h -index 4f727e41..b070266e 100644 ---- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h -+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h -@@ -37,7 +37,7 @@ - #include - #include - #include --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - #include - #endif - -@@ -100,7 +100,7 @@ public: - - WebCore::PlatformDisplayID displayID() const { return m_displayID; } - --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - void adjustTransientZoom(double, WebCore::FloatPoint); - void commitTransientZoom(double, WebCore::FloatPoint); - #endif -@@ -213,7 +213,7 @@ private: - #endif // USE(COORDINATED_GRAPHICS) - WebCore::PlatformDisplayID m_displayID; - --#if PLATFORM(GTK) -+#if PLATFORM(GTK) && USE(COORDINATED_GRAPHICS) - bool m_transientZoom { false }; - double m_transientZoomScale { 1 }; - WebCore::FloatPoint m_transientZoomOrigin; diff --git a/poky/meta/recipes-sato/webkit/webkitgtk/0001-Tweak-gtkdoc-settings-so-that-gtkdoc-generation-work.patch b/poky/meta/recipes-sato/webkit/webkitgtk/0001-Tweak-gtkdoc-settings-so-that-gtkdoc-generation-work.patch deleted file mode 100644 index 866e9d9d09..0000000000 --- a/poky/meta/recipes-sato/webkit/webkitgtk/0001-Tweak-gtkdoc-settings-so-that-gtkdoc-generation-work.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 1c7e7a385387d7febf633bbb6d2b99ece523e719 Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Thu, 11 Aug 2016 17:13:51 +0300 -Subject: [PATCH] Tweak gtkdoc settings so that gtkdoc generation works under - OpenEmbedded build system - -This requires setting a few environment variables so that the transient -binary is build and linked correctly, and disabling the tweaks to RUN -variable from gtkdoc.py script so that our qemu wrapper is taken into use. - -Upstream-Status: Inappropriate [oe-specific] -Signed-off-by: Alexander Kanavin - ---- - Source/cmake/GtkDoc.cmake | 2 +- - Tools/gtkdoc/gtkdoc.py | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/Source/cmake/GtkDoc.cmake b/Source/cmake/GtkDoc.cmake -index 18e86448..102c873a 100644 ---- a/Source/cmake/GtkDoc.cmake -+++ b/Source/cmake/GtkDoc.cmake -@@ -4,7 +4,7 @@ macro(ADD_GTKDOC_GENERATOR _stamp_name _extra_args) - add_custom_command( - OUTPUT "${CMAKE_BINARY_DIR}/${_stamp_name}" - DEPENDS ${DocumentationDependencies} -- COMMAND ${CMAKE_COMMAND} -E env "CC=${CMAKE_C_COMPILER}" "CFLAGS=${CMAKE_C_FLAGS} -Wno-unused-parameter" "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS}" ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/gtkdoc/generate-gtkdoc ${_extra_args} -+ COMMAND ${CMAKE_COMMAND} -E env "CC=${CMAKE_C_COMPILER}" "CFLAGS=${CMAKE_C_FLAGS} -Wno-unused-parameter" "LD=${CMAKE_C_COMPILER}" "LDFLAGS=${CMAKE_C_LINK_FLAGS}" "RUN=${CMAKE_BINARY_DIR}/gtkdoc-qemuwrapper" ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/gtkdoc/generate-gtkdoc ${_extra_args} - COMMAND touch ${_stamp_name} - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" - VERBATIM -diff --git a/Tools/gtkdoc/gtkdoc.py b/Tools/gtkdoc/gtkdoc.py -index 054cafa1..416de7d1 100644 ---- a/Tools/gtkdoc/gtkdoc.py -+++ b/Tools/gtkdoc/gtkdoc.py -@@ -320,9 +320,9 @@ class GTKDoc(object): - additional_ldflags = '%s %s' % (additional_ldflags, arg) - ldflags = ' "-L%s" %s ' % (self.library_path, additional_ldflags) + ldflags - current_ld_library_path = env.get('LD_LIBRARY_PATH') -- if current_ld_library_path: -+ if current_ld_library_path and 'RUN' not in env: - env['LD_LIBRARY_PATH'] = '%s:%s' % (self.library_path, current_ld_library_path) -- else: -+ elif 'RUN' not in env: - env['LD_LIBRARY_PATH'] = self.library_path - - if ldflags: diff --git a/poky/meta/recipes-sato/webkit/webkitgtk/0001-When-building-introspection-files-do-not-quote-CFLAG.patch b/poky/meta/recipes-sato/webkit/webkitgtk/0001-When-building-introspection-files-do-not-quote-CFLAG.patch index 3d02be9894..4ef0dbfe2f 100644 --- a/poky/meta/recipes-sato/webkit/webkitgtk/0001-When-building-introspection-files-do-not-quote-CFLAG.patch +++ b/poky/meta/recipes-sato/webkit/webkitgtk/0001-When-building-introspection-files-do-not-quote-CFLAG.patch @@ -1,9 +1,9 @@ -From 01f5ab0edf3dd8f76d37fd36c2dcd3108be33a7b Mon Sep 17 00:00:00 2001 +From 89ac299e0d9436f1effaa07711458d616574cc8f Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Mon, 4 Apr 2022 21:20:05 +0200 -Subject: [PATCH] When building introspection files, do not quote CFLAGS. +Subject: [PATCH] Propagate CFLAGS to introspection targets -This does not seem to be propagated to the compiler correctly: +Otherwise, important things do not get passed to the compiler in cross compiling with a sysroot scenario: In file included from /srv/work/alex/poky/build-64-alt/tmp/work/core2-64-poky-linux/webkitgtk/2.36.0-r0/recipe-sysroot-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/11.2.0/include-fixed/syslimits.h:7, from /srv/work/alex/poky/build-64-alt/tmp/work/core2-64-poky-linux/webkitgtk/2.36.0-r0/recipe-sysroot-native/usr/lib/x86_64-poky-linux/gcc/x86_64-poky-linux/11.2.0/include-fixed/limits.h:34, @@ -31,48 +31,25 @@ Traceback (most recent call last): raise DistutilsExecError( distutils.errors.DistutilsExecError: command '/srv/work/alex/poky/build-64-alt/tmp/work/core2-64-poky-linux/webkitgtk/2.36.0-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc' failed with exit code 1 -Upstream-Status: Inappropriate [upstream has rewritten the whole thing as of https://github.com/WebKit/WebKit/commit/b0ae032850bb6b2672051bab8032fc9f9ef5eb97] +Upstream-Status: Pending Signed-off-by: Alexander Kanavin ---- - Source/JavaScriptCore/PlatformGTK.cmake | 2 +- - Source/WebKit/PlatformGTK.cmake | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) -diff --git a/Source/JavaScriptCore/PlatformGTK.cmake b/Source/JavaScriptCore/PlatformGTK.cmake -index 1c3c8fb7..efd18807 100644 ---- a/Source/JavaScriptCore/PlatformGTK.cmake -+++ b/Source/JavaScriptCore/PlatformGTK.cmake -@@ -71,7 +71,7 @@ if (ENABLE_INTROSPECTION) - add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir - DEPENDS JavaScriptCore -- COMMAND CC=${CMAKE_C_COMPILER} CFLAGS="-Wno-deprecated-declarations ${CMAKE_C_FLAGS}" LDFLAGS= -+ COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations\ ${CMAKE_C_FLAGS} LDFLAGS= - ${LOADER_LIBRARY_PATH_VAR}="${INTROSPECTION_ADDITIONAL_LIBRARY_PATH}" - ${INTROSPECTION_SCANNER} - --quiet -diff --git a/Source/WebKit/PlatformGTK.cmake b/Source/WebKit/PlatformGTK.cmake -index 48d1820d..ded05035 100644 ---- a/Source/WebKit/PlatformGTK.cmake -+++ b/Source/WebKit/PlatformGTK.cmake -@@ -675,7 +675,7 @@ if (ENABLE_INTROSPECTION) - add_custom_target(WebKit2-${WEBKITGTK_API_VERSION}-gir - DEPENDS WebKit - DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir -- COMMAND CC=${CMAKE_C_COMPILER} CFLAGS="-Wno-deprecated-declarations ${CMAKE_C_FLAGS}" LDFLAGS= -+ COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations\ ${CMAKE_C_FLAGS} LDFLAGS= - ${LOADER_LIBRARY_PATH_VAR}="${INTROSPECTION_ADDITIONAL_LIBRARY_PATH}" - ${INTROSPECTION_SCANNER} - --quiet -@@ -721,7 +721,7 @@ if (ENABLE_INTROSPECTION) - OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.gir - DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir - DEPENDS WebKit2-${WEBKITGTK_API_VERSION}-gir -- COMMAND CC=${CMAKE_C_COMPILER} CFLAGS="-Wno-deprecated-declarations ${CMAKE_C_FLAGS}" -+ COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=-Wno-deprecated-declarations\ ${CMAKE_C_FLAGS} - LDFLAGS="${INTROSPECTION_ADDITIONAL_LDFLAGS}" - ${LOADER_LIBRARY_PATH_VAR}="${INTROSPECTION_ADDITIONAL_LIBRARY_PATH}" - ${INTROSPECTION_SCANNER} --- -2.30.2 +Signed-off-by: Alexander Kanavin +--- + Source/cmake/FindGI.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Source/cmake/FindGI.cmake b/Source/cmake/FindGI.cmake +index b3e810cd..e22a75f7 100644 +--- a/Source/cmake/FindGI.cmake ++++ b/Source/cmake/FindGI.cmake +@@ -340,7 +340,7 @@ function(GI_INTROSPECT namespace nsversion header) + DEPENDS ${gir_deps} ${gir_srcs} + VERBATIM + COMMAND_EXPAND_LISTS +- COMMAND ${CMAKE_COMMAND} -E env "CC=${CMAKE_C_COMPILER}" ++ COMMAND ${CMAKE_COMMAND} -E env "CC=${CMAKE_C_COMPILER}" "CFLAGS=${CMAKE_C_FLAGS}" + "${GI_SCANNER_EXE}" --quiet --warn-all --warn-error --no-libtool + "--output=${gir_path}" + "--library=$" diff --git a/poky/meta/recipes-sato/webkit/webkitgtk/fix-gstreamer-include-paths.patch b/poky/meta/recipes-sato/webkit/webkitgtk/fix-gstreamer-include-paths.patch deleted file mode 100644 index 2c6be87902..0000000000 --- a/poky/meta/recipes-sato/webkit/webkitgtk/fix-gstreamer-include-paths.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 25efd1478b48b5406fdab3b7b9c1f7e0ef95a7ed Mon Sep 17 00:00:00 2001 -From: Pablo Saavedra -Date: Mon, 27 Jun 2022 16:56:04 -0700 -Subject: [PATCH] Fix include gstreamer path on cross compiler toolchains - https://bugs.webkit.org/show_bug.cgi?id=241483 - -Reviewed by Adrian Perez de Castro. - -Set the include paths for the gstreamer components to the full path -using the find_path(). This function relies in CMAKE_FIND_ROOT_PATH to -find the right place where the includes they are. This fixes possible -warnings/errors on cross toolchains using -Wpoison-system-directories -and -Werror=poison-system-directories. - -* Source/cmake/FindGStreamer.cmake: - -Canonical link: https://commits.webkit.org/251895@main - -Upstream-Status: Backport [2.37.1 https://github.com/WebKit/WebKit/commit/25efd1478b48b5406fdab3b7b9c1f7e0ef95a7ed] ---- - Source/cmake/FindGStreamer.cmake | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/Source/cmake/FindGStreamer.cmake b/Source/cmake/FindGStreamer.cmake -index 3216f6974b53..b65a11f30871 100644 ---- a/Source/cmake/FindGStreamer.cmake -+++ b/Source/cmake/FindGStreamer.cmake -@@ -75,12 +75,20 @@ macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _library) - # ${includedir}/gstreamer-1.0 which remains correct. The issue here is that - # we don't rely on the `Cflags`, cmake fails to generate a proper - # `.._INCLUDE_DIRS` variable in this case. So we need to do it here... -+ -+ # Populate the list initially from the _INCLUDE_DIRS result variable. -+ set(${_component_prefix}_INCLUDE_DIRS ${PC_${_component_prefix}_INCLUDE_DIRS}) -+ - set(_include_dir "${PC_${_component_prefix}_INCLUDEDIR}") - string(REGEX MATCH "(.*)/gstreamer-1.0" _dummy "${_include_dir}") -+ - if ("${CMAKE_MATCH_1}" STREQUAL "") -- set(${_component_prefix}_INCLUDE_DIRS "${_include_dir}/gstreamer-1.0;${PC_${_component_prefix}_INCLUDE_DIRS}") -- else () -- set(${_component_prefix}_INCLUDE_DIRS "${PC_${_component_prefix}_INCLUDE_DIRS}") -+ find_path(${_component_prefix}_RESOLVED_INCLUDEDIR NAMES "${_include_dir}/gstreamer-1.0") -+ # Only add the resolved path from `_INCLUDEDIR` if found. -+ if (${_component_prefix}_RESOLVED_INCLUDEDIR) -+ list(APPEND ${_component_prefix}_INCLUDE_DIRS -+ "${${_component_prefix}_RESOLVED_INCLUDEDIR}") -+ endif () - endif () - - find_library(${_component_prefix}_LIBRARIES diff --git a/poky/meta/recipes-sato/webkit/webkitgtk_2.36.7.bb b/poky/meta/recipes-sato/webkit/webkitgtk_2.36.7.bb deleted file mode 100644 index f3e1adee70..0000000000 --- a/poky/meta/recipes-sato/webkit/webkitgtk_2.36.7.bb +++ /dev/null @@ -1,168 +0,0 @@ -SUMMARY = "WebKit web rendering engine for the GTK+ platform" -HOMEPAGE = "https://www.webkitgtk.org/" -BUGTRACKER = "https://bugs.webkit.org/" - -LICENSE = "BSD-2-Clause & LGPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://Source/JavaScriptCore/COPYING.LIB;md5=d0c6d6397a5d84286dda758da57bd691 \ - file://Source/WebCore/LICENSE-APPLE;md5=4646f90082c40bcf298c285f8bab0b12 \ - file://Source/WebCore/LICENSE-LGPL-2;md5=36357ffde2b64ae177b2494445b79d21 \ - file://Source/WebCore/LICENSE-LGPL-2.1;md5=a778a33ef338abbaf8b8a7c36b6eec80 \ - " - -SRC_URI = "https://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \ - file://0001-FindGObjectIntrospection.cmake-prefix-variables-obta.patch \ - file://0001-Tweak-gtkdoc-settings-so-that-gtkdoc-generation-work.patch \ - file://0001-Fix-build-without-opengl-or-es.patch \ - file://reproducibility.patch \ - file://0001-When-building-introspection-files-do-not-quote-CFLAG.patch \ - file://fix-gstreamer-include-paths.patch \ - file://0d3344e17d258106617b0e6d783d073b188a2548.patch \ - " -SRC_URI[sha256sum] = "0c260cf2b32f0481d017670dfed1b61e554967cd067195606c9f9eb5fe731743" - -inherit cmake pkgconfig gobject-introspection perlnative features_check upstream-version-is-even gtk-doc - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" -REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'opengl', '', d)}" - -CVE_PRODUCT = "webkitgtk webkitgtk\+" - -DEPENDS = " \ - ruby-native \ - gperf-native \ - cairo \ - harfbuzz \ - jpeg \ - atk \ - libwebp \ - gtk+3 \ - libxslt \ - libtasn1 \ - libnotify \ - gstreamer1.0 \ - gstreamer1.0-plugins-base \ - " - -PACKAGECONFIG_SOUP ?= "soup3" -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd wayland x11', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'webgl opengl', '', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'webgl gles2', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl-or-es', '', d)} \ - enchant \ - libsecret \ - ${PACKAGECONFIG_SOUP} \ - " - -PACKAGECONFIG[wayland] = "-DENABLE_WAYLAND_TARGET=ON,-DENABLE_WAYLAND_TARGET=OFF,wayland libwpe wpebackend-fdo wayland-native" -PACKAGECONFIG[angle] = "-DUSE_ANGLE_WEBGL=ON,-DUSE_ANGLE_WEBGL=OFF" -PACKAGECONFIG[x11] = "-DENABLE_X11_TARGET=ON,-DENABLE_X11_TARGET=OFF,virtual/libx11 libxcomposite libxdamage libxrender libxt" -PACKAGECONFIG[geoclue] = "-DENABLE_GEOLOCATION=ON,-DENABLE_GEOLOCATION=OFF,geoclue" -PACKAGECONFIG[enchant] = "-DENABLE_SPELLCHECK=ON,-DENABLE_SPELLCHECK=OFF,enchant2" -PACKAGECONFIG[gles2] = "-DENABLE_GLES2=ON,-DENABLE_GLES2=OFF,virtual/libgles2" -PACKAGECONFIG[webgl] = "-DENABLE_WEBGL=ON,-DENABLE_WEBGL=OFF,virtual/egl" -PACKAGECONFIG[opengl] = "-DENABLE_GRAPHICS_CONTEXT_GL=ON,-DENABLE_GRAPHICS_CONTEXT_GL=OFF,virtual/egl" -PACKAGECONFIG[opengl-or-es] = "-DUSE_OPENGL_OR_ES=ON,-DUSE_OPENGL_OR_ES=OFF" -PACKAGECONFIG[libsecret] = "-DUSE_LIBSECRET=ON,-DUSE_LIBSECRET=OFF,libsecret" -PACKAGECONFIG[libhyphen] = "-DUSE_LIBHYPHEN=ON,-DUSE_LIBHYPHEN=OFF,libhyphen" -PACKAGECONFIG[woff2] = "-DUSE_WOFF2=ON,-DUSE_WOFF2=OFF,woff2" -PACKAGECONFIG[openjpeg] = "-DUSE_OPENJPEG=ON,-DUSE_OPENJPEG=OFF,openjpeg" -PACKAGECONFIG[systemd] = "-DUSE_SYSTEMD=ON,-DUSE_SYSTEMD=off,systemd" -PACKAGECONFIG[reduce-size] = "-DCMAKE_BUILD_TYPE=MinSizeRel,-DCMAKE_BUILD_TYPE=Release,," -PACKAGECONFIG[lcms] = "-DUSE_LCMS=ON,-DUSE_LCMS=OFF,lcms" -PACKAGECONFIG[soup2] = "-DUSE_SOUP2=ON,-DUSE_SOUP2=OFF,libsoup-2.4,,,soup3" -PACKAGECONFIG[soup3] = ",,libsoup,,,soup2" -PACKAGECONFIG[journald] = "-DENABLE_JOURNALD_LOG=ON,-DENABLE_JOURNALD_LOG=OFF,systemd" - -# webkitgtk is full of /usr/bin/env python, particular for generating docs -do_configure[postfuncs] += "setup_python_link" -setup_python_link() { - if [ ! -e ${STAGING_BINDIR_NATIVE}/python ]; then - ln -s `which python3` ${STAGING_BINDIR_NATIVE}/python - fi -} - -EXTRA_OECMAKE = " \ - -DPORT=GTK \ - ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DENABLE_INTROSPECTION=ON', '-DENABLE_INTROSPECTION=OFF', d)} \ - ${@bb.utils.contains('GTKDOC_ENABLED', 'True', '-DENABLE_GTKDOC=ON', '-DENABLE_GTKDOC=OFF', d)} \ - -DENABLE_MINIBROWSER=ON \ - -DPYTHON_EXECUTABLE=`which python3` \ - -DENABLE_BUBBLEWRAP_SANDBOX=OFF \ - -DENABLE_GAMEPAD=OFF \ - " - -# Javascript JIT is not supported on ARC -EXTRA_OECMAKE:append:arc = " -DENABLE_JIT=OFF " -# By default 25-bit "medium" calls are used on ARC -# which is not enough for binaries larger than 32 MiB -CFLAGS:append:arc = " -mlong-calls" -CXXFLAGS:append:arc = " -mlong-calls" - -# Needed for non-mesa graphics stacks when x11 is disabled -CXXFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" - -# Javascript JIT is not supported on powerpc -EXTRA_OECMAKE:append:powerpc = " -DENABLE_JIT=OFF " -EXTRA_OECMAKE:append:powerpc64 = " -DENABLE_JIT=OFF " - -# ARM JIT code does not build on ARMv4/5/6 anymore -EXTRA_OECMAKE:append:armv5 = " -DENABLE_JIT=OFF " -EXTRA_OECMAKE:append:armv6 = " -DENABLE_JIT=OFF " -EXTRA_OECMAKE:append:armv4 = " -DENABLE_JIT=OFF " - -EXTRA_OECMAKE:append:mipsarch = " -DUSE_LD_GOLD=OFF " -EXTRA_OECMAKE:append:powerpc = " -DUSE_LD_GOLD=OFF " - -# JIT and gold linker does not work on RISCV -EXTRA_OECMAKE:append:riscv32 = " -DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF" -EXTRA_OECMAKE:append:riscv64 = " -DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF" - -# JIT not supported on MIPS either -EXTRA_OECMAKE:append:mipsarch = " -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON " - -# JIT not supported on X32 -# An attempt was made to upstream JIT support for x32 in -# https://bugs.webkit.org/show_bug.cgi?id=100450, but this was closed as -# unresolved due to limited X32 adoption. -EXTRA_OECMAKE:append:x86-x32 = " -DENABLE_JIT=OFF " - -SECURITY_CFLAGS:remove:aarch64 = "-fpie" -SECURITY_CFLAGS:append:aarch64 = " -fPIE" - -FILES:${PN} += "${libdir}/webkit2gtk-4.*/injected-bundle/libwebkit2gtkinjectedbundle.so" - -RRECOMMENDS:${PN} += "ca-certificates shared-mime-info" - -# http://errors.yoctoproject.org/Errors/Details/20370/ -ARM_INSTRUCTION_SET:armv4 = "arm" -ARM_INSTRUCTION_SET:armv5 = "arm" -ARM_INSTRUCTION_SET:armv6 = "arm" - -# https://bugzilla.yoctoproject.org/show_bug.cgi?id=9474 -# https://bugs.webkit.org/show_bug.cgi?id=159880 -# JSC JIT can build on ARMv7 with -marm, but doesn't work on runtime. -# Upstream only tests regularly the JSC JIT on ARMv7 with Thumb2 (-mthumb). -ARM_INSTRUCTION_SET:armv7a = "thumb" -ARM_INSTRUCTION_SET:armv7r = "thumb" -ARM_INSTRUCTION_SET:armv7ve = "thumb" - -# introspection inside qemu-arm hangs forever on musl/arm builds -# therefore disable GI_DATA -GI_DATA_ENABLED:libc-musl:armv7a = "False" -GI_DATA_ENABLED:libc-musl:armv7ve = "False" - -# Can't be built with ccache -CCACHE_DISABLE = "1" - -PACKAGE_PREPROCESS_FUNCS += "src_package_preprocess" -src_package_preprocess () { - # Trim build paths from comments in generated sources to ensure reproducibility - sed -i -e "s,${WORKDIR},,g" \ - ${B}/JavaScriptCore/DerivedSources/*.h \ - ${B}/JavaScriptCore/DerivedSources/yarr/*.h \ - ${B}/JavaScriptCore/PrivateHeaders/JavaScriptCore/*.h \ - ${B}/WebKit2Gtk/DerivedSources/webkit2/*.cpp \ - ${B}/WebKit2Gtk/DerivedSources/webkit2/*.h - -} - diff --git a/poky/meta/recipes-sato/webkit/webkitgtk_2.38.3.bb b/poky/meta/recipes-sato/webkit/webkitgtk_2.38.3.bb new file mode 100644 index 0000000000..e890079dc5 --- /dev/null +++ b/poky/meta/recipes-sato/webkit/webkitgtk_2.38.3.bb @@ -0,0 +1,165 @@ +SUMMARY = "WebKit web rendering engine for the GTK+ platform" +HOMEPAGE = "https://www.webkitgtk.org/" +BUGTRACKER = "https://bugs.webkit.org/" + +LICENSE = "BSD-2-Clause & LGPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://Source/JavaScriptCore/COPYING.LIB;md5=d0c6d6397a5d84286dda758da57bd691 \ + file://Source/WebCore/LICENSE-APPLE;md5=4646f90082c40bcf298c285f8bab0b12 \ + file://Source/WebCore/LICENSE-LGPL-2;md5=36357ffde2b64ae177b2494445b79d21 \ + file://Source/WebCore/LICENSE-LGPL-2.1;md5=a778a33ef338abbaf8b8a7c36b6eec80 \ + " + +SRC_URI = "https://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \ + file://0001-FindGObjectIntrospection.cmake-prefix-variables-obta.patch \ + file://reproducibility.patch \ + file://0001-When-building-introspection-files-do-not-quote-CFLAG.patch \ + file://0d3344e17d258106617b0e6d783d073b188a2548.patch \ + " +SRC_URI[sha256sum] = "41f001d1ed448c6936b394a9f20e4640eebf83a7f08262df28504f7410604a5a" + +inherit cmake pkgconfig gobject-introspection perlnative features_check upstream-version-is-even gi-docgen + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" +REQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'opengl', '', d)}" + +CVE_PRODUCT = "webkitgtk webkitgtk\+" + +DEPENDS = " \ + ruby-native \ + gperf-native \ + cairo \ + harfbuzz \ + jpeg \ + atk \ + libwebp \ + gtk+3 \ + libxslt \ + libtasn1 \ + libnotify \ + gstreamer1.0 \ + gstreamer1.0-plugins-base \ + " + +PACKAGECONFIG_SOUP ?= "soup3" +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd wayland x11', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'webgl opengl', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'webgl gles2', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl-or-es', '', d)} \ + enchant \ + libsecret \ + ${PACKAGECONFIG_SOUP} \ + " + +PACKAGECONFIG[wayland] = "-DENABLE_WAYLAND_TARGET=ON,-DENABLE_WAYLAND_TARGET=OFF,wayland libwpe wpebackend-fdo wayland-native" +PACKAGECONFIG[angle] = "-DUSE_ANGLE_WEBGL=ON,-DUSE_ANGLE_WEBGL=OFF" +PACKAGECONFIG[x11] = "-DENABLE_X11_TARGET=ON,-DENABLE_X11_TARGET=OFF,virtual/libx11 libxcomposite libxdamage libxrender libxt" +PACKAGECONFIG[geoclue] = "-DENABLE_GEOLOCATION=ON,-DENABLE_GEOLOCATION=OFF,geoclue" +PACKAGECONFIG[enchant] = "-DENABLE_SPELLCHECK=ON,-DENABLE_SPELLCHECK=OFF,enchant2" +PACKAGECONFIG[gles2] = "-DENABLE_GLES2=ON,-DENABLE_GLES2=OFF,virtual/libgles2" +PACKAGECONFIG[webgl] = "-DENABLE_WEBGL=ON,-DENABLE_WEBGL=OFF,virtual/egl" +PACKAGECONFIG[opengl] = "-DENABLE_GRAPHICS_CONTEXT_GL=ON,-DENABLE_GRAPHICS_CONTEXT_GL=OFF,virtual/egl" +PACKAGECONFIG[opengl-or-es] = "-DUSE_OPENGL_OR_ES=ON,-DUSE_OPENGL_OR_ES=OFF" +PACKAGECONFIG[libsecret] = "-DUSE_LIBSECRET=ON,-DUSE_LIBSECRET=OFF,libsecret" +PACKAGECONFIG[libhyphen] = "-DUSE_LIBHYPHEN=ON,-DUSE_LIBHYPHEN=OFF,libhyphen" +PACKAGECONFIG[woff2] = "-DUSE_WOFF2=ON,-DUSE_WOFF2=OFF,woff2" +PACKAGECONFIG[openjpeg] = "-DUSE_OPENJPEG=ON,-DUSE_OPENJPEG=OFF,openjpeg" +PACKAGECONFIG[systemd] = "-DUSE_SYSTEMD=ON,-DUSE_SYSTEMD=off,systemd" +PACKAGECONFIG[reduce-size] = "-DCMAKE_BUILD_TYPE=MinSizeRel,-DCMAKE_BUILD_TYPE=Release,," +PACKAGECONFIG[lcms] = "-DUSE_LCMS=ON,-DUSE_LCMS=OFF,lcms" +PACKAGECONFIG[soup2] = "-DUSE_SOUP2=ON,-DUSE_SOUP2=OFF,libsoup-2.4,,,soup3" +PACKAGECONFIG[soup3] = ",,libsoup,,,soup2" +PACKAGECONFIG[journald] = "-DENABLE_JOURNALD_LOG=ON,-DENABLE_JOURNALD_LOG=OFF,systemd" + +# webkitgtk is full of /usr/bin/env python, particular for generating docs +do_configure[postfuncs] += "setup_python_link" +setup_python_link() { + if [ ! -e ${STAGING_BINDIR_NATIVE}/python ]; then + ln -s `which python3` ${STAGING_BINDIR_NATIVE}/python + fi +} + +EXTRA_OECMAKE = " \ + -DPORT=GTK \ + ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DENABLE_INTROSPECTION=ON', '-DENABLE_INTROSPECTION=OFF', d)} \ + ${@bb.utils.contains('GIDOCGEN_ENABLED', 'True', '-DENABLE_DOCUMENTATION=ON', '-DENABLE_DOCUMENTATION=OFF', d)} \ + -DENABLE_MINIBROWSER=ON \ + -DPYTHON_EXECUTABLE=`which python3` \ + -DENABLE_BUBBLEWRAP_SANDBOX=OFF \ + -DENABLE_GAMEPAD=OFF \ + " + +# Javascript JIT is not supported on ARC +EXTRA_OECMAKE:append:arc = " -DENABLE_JIT=OFF " +# By default 25-bit "medium" calls are used on ARC +# which is not enough for binaries larger than 32 MiB +CFLAGS:append:arc = " -mlong-calls" +CXXFLAGS:append:arc = " -mlong-calls" + +# Needed for non-mesa graphics stacks when x11 is disabled +CXXFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" + +# Javascript JIT is not supported on powerpc +EXTRA_OECMAKE:append:powerpc = " -DENABLE_JIT=OFF " +EXTRA_OECMAKE:append:powerpc64 = " -DENABLE_JIT=OFF " + +# ARM JIT code does not build on ARMv4/5/6 anymore +EXTRA_OECMAKE:append:armv5 = " -DENABLE_JIT=OFF " +EXTRA_OECMAKE:append:armv6 = " -DENABLE_JIT=OFF " +EXTRA_OECMAKE:append:armv4 = " -DENABLE_JIT=OFF " + +EXTRA_OECMAKE:append:mipsarch = " -DUSE_LD_GOLD=OFF " +EXTRA_OECMAKE:append:powerpc = " -DUSE_LD_GOLD=OFF " + +# JIT and gold linker does not work on RISCV +EXTRA_OECMAKE:append:riscv32 = " -DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF" +EXTRA_OECMAKE:append:riscv64 = " -DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF" + +# JIT not supported on MIPS either +EXTRA_OECMAKE:append:mipsarch = " -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON " + +# JIT not supported on X32 +# An attempt was made to upstream JIT support for x32 in +# https://bugs.webkit.org/show_bug.cgi?id=100450, but this was closed as +# unresolved due to limited X32 adoption. +EXTRA_OECMAKE:append:x86-x32 = " -DENABLE_JIT=OFF " + +SECURITY_CFLAGS:remove:aarch64 = "-fpie" +SECURITY_CFLAGS:append:aarch64 = " -fPIE" + +FILES:${PN} += "${libdir}/webkit2gtk-4.*/injected-bundle/libwebkit2gtkinjectedbundle.so" + +RRECOMMENDS:${PN} += "ca-certificates shared-mime-info" + +# http://errors.yoctoproject.org/Errors/Details/20370/ +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" +ARM_INSTRUCTION_SET:armv6 = "arm" + +# https://bugzilla.yoctoproject.org/show_bug.cgi?id=9474 +# https://bugs.webkit.org/show_bug.cgi?id=159880 +# JSC JIT can build on ARMv7 with -marm, but doesn't work on runtime. +# Upstream only tests regularly the JSC JIT on ARMv7 with Thumb2 (-mthumb). +ARM_INSTRUCTION_SET:armv7a = "thumb" +ARM_INSTRUCTION_SET:armv7r = "thumb" +ARM_INSTRUCTION_SET:armv7ve = "thumb" + +# introspection inside qemu-arm hangs forever on musl/arm builds +# therefore disable GI_DATA +GI_DATA_ENABLED:libc-musl:armv7a = "False" +GI_DATA_ENABLED:libc-musl:armv7ve = "False" + +# Can't be built with ccache +CCACHE_DISABLE = "1" + +PACKAGE_PREPROCESS_FUNCS += "src_package_preprocess" +src_package_preprocess () { + # Trim build paths from comments in generated sources to ensure reproducibility + sed -i -e "s,${WORKDIR},,g" \ + ${B}/JavaScriptCore/DerivedSources/*.h \ + ${B}/JavaScriptCore/DerivedSources/yarr/*.h \ + ${B}/JavaScriptCore/PrivateHeaders/JavaScriptCore/*.h \ + ${B}/WebKit2Gtk/DerivedSources/webkit2/*.cpp \ + ${B}/WebKit2Gtk/DerivedSources/webkit2/*.h + +} + diff --git a/poky/meta/recipes-support/atk/at-spi2-atk_2.38.0.bb b/poky/meta/recipes-support/atk/at-spi2-atk_2.38.0.bb deleted file mode 100644 index 87f7b83c7d..0000000000 --- a/poky/meta/recipes-support/atk/at-spi2-atk_2.38.0.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "AT-SPI 2 Toolkit Bridge" -DESCRIPTION = "Contains a library that bridges ATK to At-Spi2 D-Bus service. Toolkit widgets use it to provide their content to screen readers such as Orca." -HOMEPAGE = "https://wiki.linuxfoundation.org/accessibility/d-bus" -BUGTRACKER = "http://bugzilla.gnome.org/" -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" - -SRC_URI[archive.sha256sum] = "cfa008a5af822b36ae6287f18182c40c91dd699c55faa38605881ed175ca464f" - -DEPENDS = "dbus glib-2.0 glib-2.0-native atk at-spi2-core libxml2" - -GNOMEBASEBUILDCLASS = "meson" -inherit gnomebase upstream-version-is-even - -PACKAGES =+ "${PN}-gnome ${PN}-gtk2" - -FILES:${PN}-gnome = "${libdir}/gnome-settings-daemon-3.0/gtk-modules" -FILES:${PN}-gtk2 = "${libdir}/gtk-2.0/modules/libatk-bridge.*" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/atk/at-spi2-core_2.44.1.bb b/poky/meta/recipes-support/atk/at-spi2-core_2.44.1.bb deleted file mode 100644 index 95a6c619f0..0000000000 --- a/poky/meta/recipes-support/atk/at-spi2-core_2.44.1.bb +++ /dev/null @@ -1,39 +0,0 @@ -SUMMARY = "Assistive Technology Service Provider Interface (dbus core)" - -DESCRIPTION = "It provides a Service Provider Interface for the Assistive Technologies available on the GNOME platform and a library against which applications can be linked." - -HOMEPAGE = "https://wiki.linuxfoundation.org/accessibility/d-bus" -BUGTRACKER = "http://bugzilla.gnome.org/" -LICENSE = "LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" - -MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" - -SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz" - -SRC_URI[sha256sum] = "4beb23270ba6cf7caf20b597354d75194d89afb69d2efcf15f4271688ba6f746" - -X11DEPENDS = "virtual/libx11 libxi libxtst" - -DEPENDS = "dbus glib-2.0" -DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)}" - -inherit meson gtk-doc gettext systemd pkgconfig upstream-version-is-even gobject-introspection - -EXTRA_OEMESON = " -Dsystemd_user_dir=${systemd_user_unitdir} \ - -Ddbus_daemon=${bindir}/dbus-daemon \ - ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '-Dx11=yes', '-Dx11=no', d)} \ -" - -GTKDOC_MESON_OPTION = "docs" - -GIR_MESON_OPTION = 'introspection' -GIR_MESON_ENABLE_FLAG = 'yes' -GIR_MESON_DISABLE_FLAG = 'no' - -FILES:${PN} += "${datadir}/dbus-1/services/*.service \ - ${datadir}/dbus-1/accessibility-services/*.service \ - ${datadir}/defaults/at-spi2 \ - ${systemd_user_unitdir}/at-spi-dbus-bus.service \ - " -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/atk/at-spi2-core_2.46.0.bb b/poky/meta/recipes-support/atk/at-spi2-core_2.46.0.bb new file mode 100644 index 0000000000..d9161e1acb --- /dev/null +++ b/poky/meta/recipes-support/atk/at-spi2-core_2.46.0.bb @@ -0,0 +1,45 @@ +SUMMARY = "Assistive Technology Service Provider Interface (dbus core)" + +DESCRIPTION = "It provides a Service Provider Interface for the Assistive Technologies available on the GNOME platform and a library against which applications can be linked." + +HOMEPAGE = "https://wiki.linuxfoundation.org/accessibility/d-bus" +BUGTRACKER = "http://bugzilla.gnome.org/" +LICENSE = "LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" + +MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}" + +SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz" + +SRC_URI[sha256sum] = "aa0c86c79f7a8d67bae49a5b7a5ab08430c608cffe6e33bf47a72f41ab03c3d0" + +DEPENDS = "dbus glib-2.0 libxml2" + +# For backwards compatibility +PROVIDES += "atk at-spi2-atk" +RPROVIDES:${PN} += "atk at-spi2-atk" + +inherit meson gtk-doc gettext systemd pkgconfig upstream-version-is-even gobject-introspection + +EXTRA_OEMESON = " -Dsystemd_user_dir=${systemd_user_unitdir} \ + -Ddbus_daemon=${bindir}/dbus-daemon" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" +PACKAGECONFIG[x11] = "-Dx11=yes,-Dx11=no,virtual/libx11 libxi libxtst" + +GTKDOC_MESON_OPTION = "docs" +# The documentation doesn't build if X11 is disabled. Appears to be fixed post 2.46.0. +EXTRA_OEMESON += "${@bb.utils.contains("DISTRO_FEATURES", "x11", "", "-Ddocs=false", d)}" + +GIR_MESON_OPTION = 'introspection' +GIR_MESON_ENABLE_FLAG = 'yes' +GIR_MESON_DISABLE_FLAG = 'no' + +FILES:${PN} += "${libdir}/gnome-settings-daemon-3.0/gtk-modules/at-spi2-atk.desktop \ + ${libdir}/gtk-2.0/modules/libatk-bridge.so \ + ${datadir}/dbus-1/services/*.service \ + ${datadir}/dbus-1/accessibility-services/*.service \ + ${datadir}/defaults/at-spi2 \ + ${systemd_user_unitdir}/at-spi-dbus-bus.service \ + " +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/atk/atk_2.38.0.bb b/poky/meta/recipes-support/atk/atk_2.38.0.bb deleted file mode 100644 index 62fec9abf8..0000000000 --- a/poky/meta/recipes-support/atk/atk_2.38.0.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "Accessibility toolkit for GNOME" -DESCRIPTION = "Provides application programming interfaces (APIs) for implementing accessibility support in software." -HOMEPAGE = "https://wiki.gnome.org/Accessibility" -BUGTRACKER = "https://gitlab.gnome.org/GNOME/atk/-/issues" -SECTION = "x11/libs" - -LICENSE = "GPL-2.0-or-later & LGPL-2.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \ - file://atk/atkutil.c;endline=18;md5=6fd31cd2fdc9b30f619ca8d819bc12d3 \ - file://atk/atk.h;endline=18;md5=fcd7710187e0eae485e356c30d1b0c3b" - -# Need gettext-native as Meson can't turn off i18n -DEPENDS = "gettext-native glib-2.0" - -GNOMEBASEBUILDCLASS = "meson" -inherit gnomebase gtk-doc gettext upstream-version-is-even gobject-introspection - -SRC_URI[archive.sha256sum] = "ac4de2a4ef4bd5665052952fe169657e65e895c5057dffb3c2a810f6191a0c36" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch b/poky/meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch new file mode 100644 index 0000000000..775675e1f2 --- /dev/null +++ b/poky/meta/recipes-support/attr/acl/0001-chacl-Use-portable-version-of-dirent-and-readdir.patch @@ -0,0 +1,39 @@ +From 1a5671a4eb13b81b98c3e71f00370781563f66d8 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 10 Nov 2022 17:57:24 -0800 +Subject: [PATCH] chacl: Use portable version of dirent and readdir + +Using 64bit versions on 32bit architectures should be enabled with +--enable-largefile, this makes it portable across musl and glibc + +Upstream-Status: Backport [https://git.savannah.nongnu.org/cgit/acl.git/commit/?id=2b42f64737adf6a2ddd491213580d6e9cdd2f5af] +Signed-off-by: Khem Raj +--- + tools/chacl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/chacl.c b/tools/chacl.c +index 525a7ff..8fff875 100644 +--- a/tools/chacl.c ++++ b/tools/chacl.c +@@ -320,7 +320,7 @@ walk_dir(acl_t acl, acl_t dacl, const char *fname) + { + int failed = 0; + DIR *dir; +- struct dirent64 *d; ++ struct dirent *d; + char *name; + + if ((dir = opendir(fname)) == NULL) { +@@ -332,7 +332,7 @@ walk_dir(acl_t acl, acl_t dacl, const char *fname) + return(0); /* got a file, not an error */ + } + +- while ((d = readdir64(dir)) != NULL) { ++ while ((d = readdir(dir)) != NULL) { + /* skip "." and ".." entries */ + if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) + continue; +-- +2.38.1 + diff --git a/poky/meta/recipes-support/attr/acl_2.3.1.bb b/poky/meta/recipes-support/attr/acl_2.3.1.bb index aca04a9aac..5fb8f9ae35 100644 --- a/poky/meta/recipes-support/attr/acl_2.3.1.bb +++ b/poky/meta/recipes-support/attr/acl_2.3.1.bb @@ -19,12 +19,15 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/acl/${BP}.tar.gz \ file://run-ptest \ file://0001-tests-do-not-hardcode-the-build-path-into-a-helper-l.patch \ file://0001-test-patch-out-failing-bits.patch \ + file://0001-chacl-Use-portable-version-of-dirent-and-readdir.patch \ " SRC_URI[sha256sum] = "760c61c68901b37fdd5eefeeaf4c0c7a26bdfdd8ac747a1edff1ce0e243c11af" inherit autotools gettext ptest +EXTRA_OECONF += "--enable-largefile" + PACKAGES =+ "lib${BPN}" FILES:lib${BPN} = "${libdir}/lib*${SOLIBS}" diff --git a/poky/meta/recipes-support/boost/boost-1.80.0.inc b/poky/meta/recipes-support/boost/boost-1.80.0.inc deleted file mode 100644 index 3ee82eb9b2..0000000000 --- a/poky/meta/recipes-support/boost/boost-1.80.0.inc +++ /dev/null @@ -1,20 +0,0 @@ -# The Boost web site provides free peer-reviewed portable -# C++ source libraries. The emphasis is on libraries which -# work well with the C++ Standard Library. The libraries are -# intended to be widely useful, and are in regular use by -# thousands of programmers across a broad spectrum of applications. -HOMEPAGE = "http://www.boost.org/" -LICENSE = "BSL-1.0 & MIT & Python-2.0" -LIC_FILES_CHKSUM = "file://LICENSE_1_0.txt;md5=e4224ccaecb14d942c71d31bef20d78c" - -BOOST_VER = "${@"_".join(d.getVar("PV").split("."))}" -BOOST_MAJ = "${@"_".join(d.getVar("PV").split(".")[0:2])}" -BOOST_P = "boost_${BOOST_VER}" - -SRC_URI = "https://boostorg.jfrog.io/artifactory/main/release/${PV}/source/${BOOST_P}.tar.bz2" -SRC_URI[sha256sum] = "1e19565d82e43bc59209a168f5ac899d3ba471d55c7610c677d4ccf2c9c500c0" - -UPSTREAM_CHECK_URI = "http://www.boost.org/users/download/" -UPSTREAM_CHECK_REGEX = "release/(?P.*)/source/" - -S = "${WORKDIR}/${BOOST_P}" diff --git a/poky/meta/recipes-support/boost/boost-1.81.0.inc b/poky/meta/recipes-support/boost/boost-1.81.0.inc new file mode 100644 index 0000000000..291796c736 --- /dev/null +++ b/poky/meta/recipes-support/boost/boost-1.81.0.inc @@ -0,0 +1,20 @@ +# The Boost web site provides free peer-reviewed portable +# C++ source libraries. The emphasis is on libraries which +# work well with the C++ Standard Library. The libraries are +# intended to be widely useful, and are in regular use by +# thousands of programmers across a broad spectrum of applications. +HOMEPAGE = "http://www.boost.org/" +LICENSE = "BSL-1.0 & MIT & Python-2.0" +LIC_FILES_CHKSUM = "file://LICENSE_1_0.txt;md5=e4224ccaecb14d942c71d31bef20d78c" + +BOOST_VER = "${@"_".join(d.getVar("PV").split("."))}" +BOOST_MAJ = "${@"_".join(d.getVar("PV").split(".")[0:2])}" +BOOST_P = "boost_${BOOST_VER}" + +SRC_URI = "https://boostorg.jfrog.io/artifactory/main/release/${PV}/source/${BOOST_P}.tar.bz2" +SRC_URI[sha256sum] = "71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa" + +UPSTREAM_CHECK_URI = "http://www.boost.org/users/download/" +UPSTREAM_CHECK_REGEX = "release/(?P.*)/source/" + +S = "${WORKDIR}/${BOOST_P}" diff --git a/poky/meta/recipes-support/boost/boost-build-native_1.80.0.bb b/poky/meta/recipes-support/boost/boost-build-native_1.80.0.bb deleted file mode 100644 index 54c0b2064f..0000000000 --- a/poky/meta/recipes-support/boost/boost-build-native_1.80.0.bb +++ /dev/null @@ -1,28 +0,0 @@ -SUMMARY = "Boost.Build" -DESCRIPTION = "B2 makes it easy to build C++ projects, everywhere." -HOMEPAGE = "https://github.com/boostorg/build" -SECTION = "devel" - -LICENSE = "BSL-1.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e4224ccaecb14d942c71d31bef20d78c" - -SRC_URI = "git://github.com/boostorg/build;protocol=https;branch=master" -SRCREV = "405d34a04d29519625c5edfe1f3bac3bc3dc3534" -PE = "1" - -UPSTREAM_CHECK_GITTAGREGEX = "boost-(?P(\d+(\.\d+)+))" - -inherit native - -S = "${WORKDIR}/git" - -do_compile() { - ./bootstrap.sh -} - -do_install() { - HOME=/var/run ./b2 install --prefix=${prefix} staging-prefix=${D}${prefix} -} - -# The build is either release mode (pre-stripped) or debug (-O0). -INSANE_SKIP:${PN} = "already-stripped" diff --git a/poky/meta/recipes-support/boost/boost-build-native_1.81.0.bb b/poky/meta/recipes-support/boost/boost-build-native_1.81.0.bb new file mode 100644 index 0000000000..d01c7658d5 --- /dev/null +++ b/poky/meta/recipes-support/boost/boost-build-native_1.81.0.bb @@ -0,0 +1,28 @@ +SUMMARY = "Boost.Build" +DESCRIPTION = "B2 makes it easy to build C++ projects, everywhere." +HOMEPAGE = "https://github.com/boostorg/build" +SECTION = "devel" + +LICENSE = "BSL-1.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e4224ccaecb14d942c71d31bef20d78c" + +SRC_URI = "git://github.com/boostorg/build;protocol=https;branch=master" +SRCREV = "0271fafc1141c182d4aaa8db8b1c08a109d04c87" +PE = "1" + +UPSTREAM_CHECK_GITTAGREGEX = "boost-(?P(\d+(\.\d+)+))" + +inherit native + +S = "${WORKDIR}/git" + +do_compile() { + ./bootstrap.sh +} + +do_install() { + HOME=/var/run ./b2 install --prefix=${prefix} staging-prefix=${D}${prefix} +} + +# The build is either release mode (pre-stripped) or debug (-O0). +INSANE_SKIP:${PN} = "already-stripped" diff --git a/poky/meta/recipes-support/boost/boost.inc b/poky/meta/recipes-support/boost/boost.inc index 4263e645de..77105aa1fa 100644 --- a/poky/meta/recipes-support/boost/boost.inc +++ b/poky/meta/recipes-support/boost/boost.inc @@ -40,6 +40,7 @@ BOOST_LIBS = "\ thread \ timer \ type_erasure \ + url \ wave \ " diff --git a/poky/meta/recipes-support/boost/boost/0001-The-std-lib-unary-binary_function-base-classes-are-d.patch b/poky/meta/recipes-support/boost/boost/0001-The-std-lib-unary-binary_function-base-classes-are-d.patch deleted file mode 100644 index 49603348ee..0000000000 --- a/poky/meta/recipes-support/boost/boost/0001-The-std-lib-unary-binary_function-base-classes-are-d.patch +++ /dev/null @@ -1,34 +0,0 @@ -From f9b55f5a1fab85bf73c95e6372779d6f50f75e84 Mon Sep 17 00:00:00 2001 -From: jzmaddock -Date: Mon, 11 Jul 2022 18:26:07 +0100 -Subject: [PATCH] The std lib unary/binary_function base classes are - deprecated/removed from libcpp15. Fixes - https://github.com/boostorg/container_hash/issues/24. - -Upstream-Status: Backport [https://github.com/boostorg/config/pull/440/commits/f0af4a9184457939b89110795ae2d293582c5f66] -Signed-off-by: Khem Raj ---- - boost/config/stdlib/libcpp.hpp | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/boost/config/stdlib/libcpp.hpp b/boost/config/stdlib/libcpp.hpp -index bc8536ead..0e9f2445e 100644 ---- a/boost/config/stdlib/libcpp.hpp -+++ b/boost/config/stdlib/libcpp.hpp -@@ -168,4 +168,13 @@ - # define BOOST_NO_CXX14_HDR_SHARED_MUTEX - #endif - -+#if _LIBCPP_VERSION >= 15000 -+// -+// Unary function is now deprecated in C++11 and later: -+// -+#if __cplusplus >= 201103L -+#define BOOST_NO_CXX98_FUNCTION_BASE -+#endif -+#endif -+ - // --- end --- --- -2.37.2 - diff --git a/poky/meta/recipes-support/boost/boost_1.80.0.bb b/poky/meta/recipes-support/boost/boost_1.80.0.bb deleted file mode 100644 index c34ab7d703..0000000000 --- a/poky/meta/recipes-support/boost/boost_1.80.0.bb +++ /dev/null @@ -1,8 +0,0 @@ -require boost-${PV}.inc -require boost.inc - -SRC_URI += "file://boost-math-disable-pch-for-gcc.patch \ - file://0001-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch \ - file://0001-dont-setup-compiler-flags-m32-m64.patch \ - file://0001-The-std-lib-unary-binary_function-base-classes-are-d.patch \ - " diff --git a/poky/meta/recipes-support/boost/boost_1.81.0.bb b/poky/meta/recipes-support/boost/boost_1.81.0.bb new file mode 100644 index 0000000000..4b580d078b --- /dev/null +++ b/poky/meta/recipes-support/boost/boost_1.81.0.bb @@ -0,0 +1,7 @@ +require boost-${PV}.inc +require boost.inc + +SRC_URI += "file://boost-math-disable-pch-for-gcc.patch \ + file://0001-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch \ + file://0001-dont-setup-compiler-flags-m32-m64.patch \ + " diff --git a/poky/meta/recipes-support/curl/curl_7.86.0.bb b/poky/meta/recipes-support/curl/curl_7.86.0.bb deleted file mode 100644 index ec8ce9fd28..0000000000 --- a/poky/meta/recipes-support/curl/curl_7.86.0.bb +++ /dev/null @@ -1,116 +0,0 @@ -SUMMARY = "Command line tool and library for client-side URL transfers" -DESCRIPTION = "It uses URL syntax to transfer data to and from servers. \ -curl is a widely used because of its ability to be flexible and complete \ -complex tasks. For example, you can use curl for things like user authentication, \ -HTTP post, SSL connections, proxy support, FTP uploads, and more!" -HOMEPAGE = "https://curl.se/" -BUGTRACKER = "https://github.com/curl/curl/issues" -SECTION = "console/network" -LICENSE = "MIT-open-group" -LIC_FILES_CHKSUM = "file://COPYING;md5=190c514872597083303371684954f238" - -SRC_URI = " \ - https://curl.se/download/${BP}.tar.xz \ - file://run-ptest \ - file://disable-tests \ -" -SRC_URI[sha256sum] = "2d61116e5f485581f6d59865377df4463f2e788677ac43222b496d4e49fb627b" - -# Curl has used many names over the years... -CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl daniel_stenberg:curl" - -inherit autotools pkgconfig binconfig multilib_header ptest - -# Entropy source for random PACKAGECONFIG option -RANDOM ?= "/dev/urandom" - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} libidn openssl proxy random threaded-resolver verbose zlib" -PACKAGECONFIG:class-native = "ipv6 openssl proxy random threaded-resolver verbose zlib" -PACKAGECONFIG:class-nativesdk = "ipv6 openssl proxy random threaded-resolver verbose zlib" - -# 'ares' and 'threaded-resolver' are mutually exclusive -PACKAGECONFIG[ares] = "--enable-ares,--disable-ares,c-ares,,,threaded-resolver" -PACKAGECONFIG[brotli] = "--with-brotli,--without-brotli,brotli" -PACKAGECONFIG[builtinmanual] = "--enable-manual,--disable-manual" -PACKAGECONFIG[dict] = "--enable-dict,--disable-dict," -PACKAGECONFIG[gnutls] = "--with-gnutls,--without-gnutls,gnutls" -PACKAGECONFIG[gopher] = "--enable-gopher,--disable-gopher," -PACKAGECONFIG[imap] = "--enable-imap,--disable-imap," -PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," -PACKAGECONFIG[krb5] = "--with-gssapi,--without-gssapi,krb5" -PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap," -PACKAGECONFIG[ldaps] = "--enable-ldaps,--disable-ldaps," -PACKAGECONFIG[libgsasl] = "--with-libgsasl,--without-libgsasl,libgsasl" -PACKAGECONFIG[libidn] = "--with-libidn2,--without-libidn2,libidn2" -PACKAGECONFIG[libssh2] = "--with-libssh2,--without-libssh2,libssh2" -PACKAGECONFIG[mbedtls] = "--with-mbedtls=${STAGING_DIR_TARGET},--without-mbedtls,mbedtls" -PACKAGECONFIG[mqtt] = "--enable-mqtt,--disable-mqtt," -PACKAGECONFIG[nghttp2] = "--with-nghttp2,--without-nghttp2,nghttp2" -PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl" -PACKAGECONFIG[pop3] = "--enable-pop3,--disable-pop3," -PACKAGECONFIG[proxy] = "--enable-proxy,--disable-proxy," -PACKAGECONFIG[random] = "--with-random=${RANDOM},--without-random" -PACKAGECONFIG[rtmpdump] = "--with-librtmp,--without-librtmp,rtmpdump" -PACKAGECONFIG[rtsp] = "--enable-rtsp,--disable-rtsp," -PACKAGECONFIG[smb] = "--enable-smb,--disable-smb," -PACKAGECONFIG[smtp] = "--enable-smtp,--disable-smtp," -PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss" -PACKAGECONFIG[telnet] = "--enable-telnet,--disable-telnet," -PACKAGECONFIG[tftp] = "--enable-tftp,--disable-tftp," -PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threaded-resolver,,,,ares" -PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose" -PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib" -PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd" - -EXTRA_OECONF = " \ - --disable-libcurl-option \ - --disable-ntlm-wb \ - --enable-crypto-auth \ - --with-ca-bundle=${sysconfdir}/ssl/certs/ca-certificates.crt \ - --without-libpsl \ - --enable-debug \ - --enable-optimize \ - --disable-curldebug \ - ${@'--without-ssl' if (bb.utils.filter('PACKAGECONFIG', 'gnutls mbedtls nss openssl', d) == '') else ''} \ -" - -do_install:append:class-target() { - # cleanup buildpaths from curl-config - sed -i \ - -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ - -e 's,--with-libtool-sysroot=${STAGING_DIR_TARGET},,g' \ - -e 's|${DEBUG_PREFIX_MAP}||g' \ - -e 's|${@" ".join(d.getVar("DEBUG_PREFIX_MAP").split())}||g' \ - ${D}${bindir}/curl-config -} - -do_compile_ptest() { - oe_runmake test - oe_runmake -C ${B}/tests/server -} - -do_install_ptest() { - cat ${WORKDIR}/disable-tests >> ${S}/tests/data/DISABLED - rm -f ${B}/tests/configurehelp.pm - cp -rf ${B}/tests ${D}${PTEST_PATH} - cp -rf ${S}/tests ${D}${PTEST_PATH} - find ${D}${PTEST_PATH}/ -type f -name Makefile.am -o -name Makefile.in -o -name Makefile -delete - install -d ${D}${PTEST_PATH}/src - ln -sf ${bindir}/curl ${D}${PTEST_PATH}/src/curl - cp -rf ${D}${bindir}/curl-config ${D}${PTEST_PATH} -} - -RDEPENDS:${PN}-ptest += "bash perl-modules perl-module-time-hires perl-module-digest-md5 \ - perl-module-digest perl-module-ipc-open2" - -PACKAGES =+ "lib${BPN}" - -FILES:lib${BPN} = "${libdir}/lib*.so.*" -RRECOMMENDS:lib${BPN} += "ca-certificates" - -FILES:${PN} += "${datadir}/zsh" - -inherit multilib_script -MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/curl-config" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/curl/curl_7.87.0.bb b/poky/meta/recipes-support/curl/curl_7.87.0.bb new file mode 100644 index 0000000000..9956a28422 --- /dev/null +++ b/poky/meta/recipes-support/curl/curl_7.87.0.bb @@ -0,0 +1,116 @@ +SUMMARY = "Command line tool and library for client-side URL transfers" +DESCRIPTION = "It uses URL syntax to transfer data to and from servers. \ +curl is a widely used because of its ability to be flexible and complete \ +complex tasks. For example, you can use curl for things like user authentication, \ +HTTP post, SSL connections, proxy support, FTP uploads, and more!" +HOMEPAGE = "https://curl.se/" +BUGTRACKER = "https://github.com/curl/curl/issues" +SECTION = "console/network" +LICENSE = "curl" +LIC_FILES_CHKSUM = "file://COPYING;md5=190c514872597083303371684954f238" + +SRC_URI = " \ + https://curl.se/download/${BP}.tar.xz \ + file://run-ptest \ + file://disable-tests \ +" +SRC_URI[sha256sum] = "ee5f1a1955b0ed413435ef79db28b834ea5f0fb7c8cfb1ce47175cc3bee08fff" + +# Curl has used many names over the years... +CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl daniel_stenberg:curl" + +inherit autotools pkgconfig binconfig multilib_header ptest + +# Entropy source for random PACKAGECONFIG option +RANDOM ?= "/dev/urandom" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} libidn openssl proxy random threaded-resolver verbose zlib" +PACKAGECONFIG:class-native = "ipv6 openssl proxy random threaded-resolver verbose zlib" +PACKAGECONFIG:class-nativesdk = "ipv6 openssl proxy random threaded-resolver verbose zlib" + +# 'ares' and 'threaded-resolver' are mutually exclusive +PACKAGECONFIG[ares] = "--enable-ares,--disable-ares,c-ares,,,threaded-resolver" +PACKAGECONFIG[brotli] = "--with-brotli,--without-brotli,brotli" +PACKAGECONFIG[builtinmanual] = "--enable-manual,--disable-manual" +# Don't use this in production +PACKAGECONFIG[debug] = "--enable-debug,--disable-debug" +PACKAGECONFIG[dict] = "--enable-dict,--disable-dict," +PACKAGECONFIG[gnutls] = "--with-gnutls,--without-gnutls,gnutls" +PACKAGECONFIG[gopher] = "--enable-gopher,--disable-gopher," +PACKAGECONFIG[imap] = "--enable-imap,--disable-imap," +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," +PACKAGECONFIG[krb5] = "--with-gssapi,--without-gssapi,krb5" +PACKAGECONFIG[ldap] = "--enable-ldap,--disable-ldap," +PACKAGECONFIG[ldaps] = "--enable-ldaps,--disable-ldaps," +PACKAGECONFIG[libgsasl] = "--with-libgsasl,--without-libgsasl,libgsasl" +PACKAGECONFIG[libidn] = "--with-libidn2,--without-libidn2,libidn2" +PACKAGECONFIG[libssh2] = "--with-libssh2,--without-libssh2,libssh2" +PACKAGECONFIG[mbedtls] = "--with-mbedtls=${STAGING_DIR_TARGET},--without-mbedtls,mbedtls" +PACKAGECONFIG[mqtt] = "--enable-mqtt,--disable-mqtt," +PACKAGECONFIG[nghttp2] = "--with-nghttp2,--without-nghttp2,nghttp2" +PACKAGECONFIG[openssl] = "--with-openssl,--without-openssl,openssl" +PACKAGECONFIG[pop3] = "--enable-pop3,--disable-pop3," +PACKAGECONFIG[proxy] = "--enable-proxy,--disable-proxy," +PACKAGECONFIG[random] = "--with-random=${RANDOM},--without-random" +PACKAGECONFIG[rtmpdump] = "--with-librtmp,--without-librtmp,rtmpdump" +PACKAGECONFIG[rtsp] = "--enable-rtsp,--disable-rtsp," +PACKAGECONFIG[smb] = "--enable-smb,--disable-smb," +PACKAGECONFIG[smtp] = "--enable-smtp,--disable-smtp," +PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss" +PACKAGECONFIG[telnet] = "--enable-telnet,--disable-telnet," +PACKAGECONFIG[tftp] = "--enable-tftp,--disable-tftp," +PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threaded-resolver,,,,ares" +PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose" +PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib" +PACKAGECONFIG[zstd] = "--with-zstd,--without-zstd,zstd" + +EXTRA_OECONF = " \ + --disable-libcurl-option \ + --disable-ntlm-wb \ + --enable-crypto-auth \ + --with-ca-bundle=${sysconfdir}/ssl/certs/ca-certificates.crt \ + --without-libpsl \ + --enable-optimize \ + ${@'--without-ssl' if (bb.utils.filter('PACKAGECONFIG', 'gnutls mbedtls nss openssl', d) == '') else ''} \ +" + +do_install:append:class-target() { + # cleanup buildpaths from curl-config + sed -i \ + -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's,--with-libtool-sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's|${@" ".join(d.getVar("DEBUG_PREFIX_MAP").split())}||g' \ + ${D}${bindir}/curl-config +} + +do_compile_ptest() { + oe_runmake test + oe_runmake -C ${B}/tests/server +} + +do_install_ptest() { + cat ${WORKDIR}/disable-tests >> ${S}/tests/data/DISABLED + rm -f ${B}/tests/configurehelp.pm + cp -rf ${B}/tests ${D}${PTEST_PATH} + cp -rf ${S}/tests ${D}${PTEST_PATH} + find ${D}${PTEST_PATH}/ -type f -name Makefile.am -o -name Makefile.in -o -name Makefile -delete + install -d ${D}${PTEST_PATH}/src + ln -sf ${bindir}/curl ${D}${PTEST_PATH}/src/curl + cp -rf ${D}${bindir}/curl-config ${D}${PTEST_PATH} +} + +RDEPENDS:${PN}-ptest += "bash perl-modules perl-module-time-hires perl-module-digest-md5 \ + perl-module-digest perl-module-ipc-open2" + +PACKAGES =+ "lib${BPN}" + +FILES:lib${BPN} = "${libdir}/lib*.so.*" +RRECOMMENDS:lib${BPN} += "ca-certificates" + +FILES:${PN} += "${datadir}/zsh" + +inherit multilib_script +MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/curl-config" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/diffoscope/diffoscope_224.bb b/poky/meta/recipes-support/diffoscope/diffoscope_224.bb deleted file mode 100644 index 5d634b8073..0000000000 --- a/poky/meta/recipes-support/diffoscope/diffoscope_224.bb +++ /dev/null @@ -1,30 +0,0 @@ -SUMMARY = "in-depth comparison of files, archives, and directories" -DESCRIPTION = "Tries to get to the bottom of what makes files or directories \ -different. It will recursively unpack archives of many kinds and transform \ -various binary formats into more human-readable form to compare them. \ -It can compare two tarballs, ISO images, or PDF just as easily." -HOMEPAGE = "https://diffoscope.org/" -BUGTRACKER = "https://salsa.debian.org/reproducible-builds/diffoscope/-/issues" -LICENSE = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -PYPI_PACKAGE = "diffoscope" - -inherit pypi setuptools3 - -SRC_URI[sha256sum] = "1920ebdca40e85f019a84e0220e4a79f00ffdafc0f78e1f1e2219123d5c08dfb" - -RDEPENDS:${PN} += "binutils vim squashfs-tools python3-libarchive-c python3-magic python3-rpm" - -# Dependencies don't build for musl -COMPATIBLE_HOST:libc-musl = 'null' - -do_install:append:class-native() { - create_wrapper ${D}${bindir}/diffoscope \ - MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \ - RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \ - LD_LIBRARY_PATH=${STAGING_LIBDIR_NATIVE} \ - RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} -} - -BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-support/diffoscope/diffoscope_230.bb b/poky/meta/recipes-support/diffoscope/diffoscope_230.bb new file mode 100644 index 0000000000..496ed9e602 --- /dev/null +++ b/poky/meta/recipes-support/diffoscope/diffoscope_230.bb @@ -0,0 +1,30 @@ +SUMMARY = "in-depth comparison of files, archives, and directories" +DESCRIPTION = "Tries to get to the bottom of what makes files or directories \ +different. It will recursively unpack archives of many kinds and transform \ +various binary formats into more human-readable form to compare them. \ +It can compare two tarballs, ISO images, or PDF just as easily." +HOMEPAGE = "https://diffoscope.org/" +BUGTRACKER = "https://salsa.debian.org/reproducible-builds/diffoscope/-/issues" +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +PYPI_PACKAGE = "diffoscope" + +inherit pypi setuptools3 + +SRC_URI[sha256sum] = "a35908c15bb006058f74c2d4f2be3b1ac7cf62c872cfbd2950114a8a705d8108" + +RDEPENDS:${PN} += "binutils vim squashfs-tools python3-libarchive-c python3-magic python3-rpm" + +# Dependencies don't build for musl +COMPATIBLE_HOST:libc-musl = 'null' + +do_install:append:class-native() { + create_wrapper ${D}${bindir}/diffoscope \ + MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \ + RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \ + LD_LIBRARY_PATH=${STAGING_LIBDIR_NATIVE} \ + RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} +} + +BBCLASSEXTEND = "native" diff --git a/poky/meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch b/poky/meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch index c4ede9ea5e..0cd4c45907 100644 --- a/poky/meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch +++ b/poky/meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch @@ -1,4 +1,4 @@ -From 89b98553084fbefe1ef2c7cbff9e72cf43144c49 Mon Sep 17 00:00:00 2001 +From 346a6b17a07b658954db65f814461b59824d9fcd Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Mon, 22 Jan 2018 18:00:21 +0200 Subject: [PATCH] configure.ac: use a custom value for the location of @@ -14,10 +14,10 @@ Signed-off-by: Alexander Kanavin 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index d86c60e..65c22b2 100644 +index 099c6a8..e8cf408 100644 --- a/configure.ac +++ b/configure.ac -@@ -1955,7 +1955,7 @@ AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf", +@@ -1935,7 +1935,7 @@ AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf", AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool]) diff --git a/poky/meta/recipes-support/gnupg/gnupg/0002-use-pkgconfig-instead-of-npth-config.patch b/poky/meta/recipes-support/gnupg/gnupg/0002-use-pkgconfig-instead-of-npth-config.patch index d3790ac782..0e58fd4c4d 100644 --- a/poky/meta/recipes-support/gnupg/gnupg/0002-use-pkgconfig-instead-of-npth-config.patch +++ b/poky/meta/recipes-support/gnupg/gnupg/0002-use-pkgconfig-instead-of-npth-config.patch @@ -1,4 +1,4 @@ -From 15668161c351aee5f29152db2972b1648da11210 Mon Sep 17 00:00:00 2001 +From d9048788d906774b1475c3bb1b17e22455c2add4 Mon Sep 17 00:00:00 2001 From: Saul Wold Date: Wed, 16 Aug 2017 11:16:30 +0800 Subject: [PATCH] use pkgconfig instead of npth config @@ -15,7 +15,7 @@ Signed-off-by: Hongxu Jia 1 file changed, 8 insertions(+), 45 deletions(-) diff --git a/m4/npth.m4 b/m4/npth.m4 -index 06cdaee..4adda01 100644 +index 619ed89..0cb354d 100644 --- a/m4/npth.m4 +++ b/m4/npth.m4 @@ -19,25 +19,10 @@ AC_DEFUN([_AM_PATH_NPTH_CONFIG], @@ -25,7 +25,7 @@ index 06cdaee..4adda01 100644 + AC_PATH_PROG(PKGCONFIG, pkg-config, no) - use_gpgrt_config="" -- if test x"$NPTH_CONFIG" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then +- if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then - if $GPGRT_CONFIG npth --exists; then - NPTH_CONFIG="$GPGRT_CONFIG npth" - AC_MSG_NOTICE([Use gpgrt-config as npth-config]) diff --git a/poky/meta/recipes-support/gnupg/gnupg/relocate.patch b/poky/meta/recipes-support/gnupg/gnupg/relocate.patch index 43999b8a6d..071dd93ff5 100644 --- a/poky/meta/recipes-support/gnupg/gnupg/relocate.patch +++ b/poky/meta/recipes-support/gnupg/gnupg/relocate.patch @@ -1,4 +1,4 @@ -From 89ae4f03307104689e1857d9857d452af6b35ac4 Mon Sep 17 00:00:00 2001 +From b1117adeb476304ce2792814516a5b7cd44d0d38 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Wed, 19 Sep 2018 14:44:40 +0100 Subject: [PATCH] Allow the environment to override where gnupg looks for its @@ -14,10 +14,10 @@ Signed-off-by: Alexander Kanavin 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/homedir.c b/common/homedir.c -index 260aeb2..1aeb08d 100644 +index 67bbde8..7f360ba 100644 --- a/common/homedir.c +++ b/common/homedir.c -@@ -1143,7 +1143,7 @@ gnupg_socketdir (void) +@@ -1171,7 +1171,7 @@ gnupg_socketdir (void) if (!name) { unsigned int dummy; @@ -26,7 +26,7 @@ index 260aeb2..1aeb08d 100644 gpgrt_annotate_leaked_object (name); } -@@ -1175,7 +1175,7 @@ gnupg_sysconfdir (void) +@@ -1203,7 +1203,7 @@ gnupg_sysconfdir (void) if (dir) return dir; else @@ -35,7 +35,7 @@ index 260aeb2..1aeb08d 100644 #endif /*!HAVE_W32_SYSTEM*/ } -@@ -1211,7 +1211,7 @@ gnupg_bindir (void) +@@ -1239,7 +1239,7 @@ gnupg_bindir (void) return name; } else @@ -44,7 +44,7 @@ index 260aeb2..1aeb08d 100644 #endif /*!HAVE_W32_SYSTEM*/ } -@@ -1238,7 +1238,7 @@ gnupg_libexecdir (void) +@@ -1266,7 +1266,7 @@ gnupg_libexecdir (void) return name; } else @@ -53,7 +53,7 @@ index 260aeb2..1aeb08d 100644 #endif /*!HAVE_W32_SYSTEM*/ } -@@ -1268,7 +1268,7 @@ gnupg_libdir (void) +@@ -1296,7 +1296,7 @@ gnupg_libdir (void) return name; } else @@ -62,7 +62,7 @@ index 260aeb2..1aeb08d 100644 #endif /*!HAVE_W32_SYSTEM*/ } -@@ -1299,7 +1299,7 @@ gnupg_datadir (void) +@@ -1327,7 +1327,7 @@ gnupg_datadir (void) return name; } else @@ -71,7 +71,7 @@ index 260aeb2..1aeb08d 100644 #endif /*!HAVE_W32_SYSTEM*/ } -@@ -1331,7 +1331,7 @@ gnupg_localedir (void) +@@ -1359,7 +1359,7 @@ gnupg_localedir (void) return name; } else diff --git a/poky/meta/recipes-support/gnupg/gnupg_2.3.7.bb b/poky/meta/recipes-support/gnupg/gnupg_2.3.7.bb deleted file mode 100644 index da2b1c4deb..0000000000 --- a/poky/meta/recipes-support/gnupg/gnupg_2.3.7.bb +++ /dev/null @@ -1,87 +0,0 @@ -SUMMARY = "GNU Privacy Guard - encryption and signing tools (2.x)" -DESCRIPTION = "A complete and free implementation of the OpenPGP standard \ -as defined by RFC4880 (also known as PGP). GnuPG allows you to encrypt \ -and sign your data and communications; it features a versatile key \ -management system, along with access modules for all kinds of public \ -key directories." -HOMEPAGE = "http://www.gnupg.org/" -LICENSE = "GPL-3.0-only & LGPL-3.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=189af8afca6d6075ba6c9e0aa8077626 \ - file://COPYING.LGPL3;md5=a2b6bf2cb38ee52619e60f30a1fc7257" - -DEPENDS = "npth libassuan libksba zlib bzip2 readline libgcrypt" - -inherit autotools gettext texinfo pkgconfig - -UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html" -SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ - file://0002-use-pkgconfig-instead-of-npth-config.patch \ - file://0004-autogen.sh-fix-find-version-for-beta-checking.patch \ - file://0001-Woverride-init-is-not-needed-with-gcc-9.patch \ - " -SRC_URI:append:class-native = " file://0001-configure.ac-use-a-custom-value-for-the-location-of-.patch \ - file://relocate.patch" -SRC_URI:append:class-nativesdk = " file://relocate.patch" - -SRC_URI[sha256sum] = "ee163a5fb9ec99ffc1b18e65faef8d086800c5713d15a672ab57d3799da83669" - -EXTRA_OECONF = "--disable-ldap \ - --disable-ccid-driver \ - --with-zlib=${STAGING_LIBDIR}/.. \ - --with-bzip2=${STAGING_LIBDIR}/.. \ - --with-readline=${STAGING_LIBDIR}/.. \ - --with-mailprog=${sbindir}/sendmail \ - --enable-gpg-is-gpg2 \ - " - -# A minimal package containing just enough to run gpg+gpgagent (E.g. use gpgme in opkg) -PACKAGES =+ "${PN}-gpg" -FILES:${PN}-gpg = " \ - ${bindir}/gpg \ - ${bindir}/gpg2 \ - ${bindir}/gpg-agent \ -" - -# Normal package (gnupg) should depend on minimal package (gnupg-gpg) -# to ensure all tools are included. This is done only in non-native -# builds. Native builds don't have sub-packages, so appending RDEPENDS -# in this case breaks recipe parsing. -RDEPENDS:${PN} += "${@ "" if ("native" in d.getVar("PN")) else (d.getVar("PN") + "-gpg")}" - -RRECOMMENDS:${PN} = "pinentry" - -do_configure:prepend () { - # Else these could be used in prefernce to those in aclocal-copy - rm -f ${S}/m4/gpg-error.m4 - rm -f ${S}/m4/libassuan.m4 - rm -f ${S}/m4/ksba.m4 - rm -f ${S}/m4/libgcrypt.m4 -} - -do_install:append() { - ln -sf gpg2 ${D}${bindir}/gpg - ln -sf gpgv2 ${D}${bindir}/gpgv -} - -do_install:append:class-native() { - create_wrappers ${STAGING_BINDIR_NATIVE} -} - -do_install:append:class-nativesdk() { - create_wrappers ${SDKPATHNATIVE}${bindir_nativesdk} -} - -create_wrappers() { - for i in gpg2 gpgconf gpg-agent gpg-connect-agent; do - create_wrapper ${D}${bindir}/$i GNUPG_BINDIR=$1 - done -} - -PACKAGECONFIG ??= "gnutls" -PACKAGECONFIG[gnutls] = "--enable-gnutls, --disable-gnutls, gnutls" -PACKAGECONFIG[sqlite3] = "--enable-sqlite, --disable-sqlite, sqlite3" - -BBCLASSEXTEND = "native nativesdk" - -lcl_maybe_fortify:mipsarch = "" - diff --git a/poky/meta/recipes-support/gnupg/gnupg_2.4.0.bb b/poky/meta/recipes-support/gnupg/gnupg_2.4.0.bb new file mode 100644 index 0000000000..900aa8ad73 --- /dev/null +++ b/poky/meta/recipes-support/gnupg/gnupg_2.4.0.bb @@ -0,0 +1,87 @@ +SUMMARY = "GNU Privacy Guard - encryption and signing tools (2.x)" +DESCRIPTION = "A complete and free implementation of the OpenPGP standard \ +as defined by RFC4880 (also known as PGP). GnuPG allows you to encrypt \ +and sign your data and communications; it features a versatile key \ +management system, along with access modules for all kinds of public \ +key directories." +HOMEPAGE = "http://www.gnupg.org/" +LICENSE = "GPL-3.0-only & LGPL-3.0-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=189af8afca6d6075ba6c9e0aa8077626 \ + file://COPYING.LGPL3;md5=a2b6bf2cb38ee52619e60f30a1fc7257" + +DEPENDS = "npth libassuan libksba zlib bzip2 readline libgcrypt" + +inherit autotools gettext texinfo pkgconfig + +UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html" +SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ + file://0002-use-pkgconfig-instead-of-npth-config.patch \ + file://0004-autogen.sh-fix-find-version-for-beta-checking.patch \ + file://0001-Woverride-init-is-not-needed-with-gcc-9.patch \ + " +SRC_URI:append:class-native = " file://0001-configure.ac-use-a-custom-value-for-the-location-of-.patch \ + file://relocate.patch" +SRC_URI:append:class-nativesdk = " file://relocate.patch" + +SRC_URI[sha256sum] = "1d79158dd01d992431dd2e3facb89fdac97127f89784ea2cb610c600fb0c1483" + +EXTRA_OECONF = "--disable-ldap \ + --disable-ccid-driver \ + --with-zlib=${STAGING_LIBDIR}/.. \ + --with-bzip2=${STAGING_LIBDIR}/.. \ + --with-readline=${STAGING_LIBDIR}/.. \ + --with-mailprog=${sbindir}/sendmail \ + --enable-gpg-is-gpg2 \ + " + +# A minimal package containing just enough to run gpg+gpgagent (E.g. use gpgme in opkg) +PACKAGES =+ "${PN}-gpg" +FILES:${PN}-gpg = " \ + ${bindir}/gpg \ + ${bindir}/gpg2 \ + ${bindir}/gpg-agent \ +" + +# Normal package (gnupg) should depend on minimal package (gnupg-gpg) +# to ensure all tools are included. This is done only in non-native +# builds. Native builds don't have sub-packages, so appending RDEPENDS +# in this case breaks recipe parsing. +RDEPENDS:${PN} += "${@ "" if ("native" in d.getVar("PN")) else (d.getVar("PN") + "-gpg")}" + +RRECOMMENDS:${PN} = "pinentry" + +do_configure:prepend () { + # Else these could be used in prefernce to those in aclocal-copy + rm -f ${S}/m4/gpg-error.m4 + rm -f ${S}/m4/libassuan.m4 + rm -f ${S}/m4/ksba.m4 + rm -f ${S}/m4/libgcrypt.m4 +} + +do_install:append() { + ln -sf gpg2 ${D}${bindir}/gpg + ln -sf gpgv2 ${D}${bindir}/gpgv +} + +do_install:append:class-native() { + create_wrappers ${STAGING_BINDIR_NATIVE} +} + +do_install:append:class-nativesdk() { + create_wrappers ${SDKPATHNATIVE}${bindir_nativesdk} +} + +create_wrappers() { + for i in gpg2 gpgconf gpg-agent gpg-connect-agent; do + create_wrapper ${D}${bindir}/$i GNUPG_BINDIR=$1 + done +} + +PACKAGECONFIG ??= "gnutls" +PACKAGECONFIG[gnutls] = "--enable-gnutls, --disable-gnutls, gnutls" +PACKAGECONFIG[sqlite3] = "--enable-sqlite, --disable-sqlite, sqlite3" + +BBCLASSEXTEND = "native nativesdk" + +lcl_maybe_fortify:mipsarch = "" + diff --git a/poky/meta/recipes-support/gpgme/gpgme/0001-posix-io.c-Use-off_t-instead-of-off64_t.patch b/poky/meta/recipes-support/gpgme/gpgme/0001-posix-io.c-Use-off_t-instead-of-off64_t.patch new file mode 100644 index 0000000000..be58c42128 --- /dev/null +++ b/poky/meta/recipes-support/gpgme/gpgme/0001-posix-io.c-Use-off_t-instead-of-off64_t.patch @@ -0,0 +1,42 @@ +From be33cf1812b4c2a3ed85fb2532992bfb2b27b3be Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 08:44:13 -0800 +Subject: [PATCH] posix-io.c: Use off_t instead of off64_t + +configure.ac checks for largefile support via AC_SYS_LARGEFILE already, +therefore use off_t and ino_t instead of 64bit variants. Musl e.g. does +not define them without _LARGEFILE64_SOURCE and error is not seen on +glibc because _GNU_SOURCE defines _LARGEFILE64_SOURCE + +Fixes errors like below on 32-bit musl systems + +../../../../../../../../workspace/sources/gpgme/src/posix-io.c:77:3: error: unknown type name 'ino64_t'; did you mean 'int64_t'? + ino64_t d_ino; + ^~~~~~~ + int64_t + ^ +../../../../../../../../workspace/sources/gpgme/src/posix-io.c:78:3: error: unknown type name 'off64_t'; did you mean 'off_t'? + off64_t d_off; + ^~~~~~~ + +Upstream-Status: Submitted [https://lists.gnupg.org/pipermail/gnupg-devel/2022-December/035222.html] +Signed-off-by: Khem Raj +--- + src/posix-io.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/posix-io.c b/src/posix-io.c +index 0d0a98b..286a626 100644 +--- a/src/posix-io.c ++++ b/src/posix-io.c +@@ -74,8 +74,8 @@ + * define it ourselves. */ + struct linux_dirent64 + { +- ino64_t d_ino; +- off64_t d_off; ++ ino_t d_ino; ++ off_t d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[]; diff --git a/poky/meta/recipes-support/gpgme/gpgme_1.18.0.bb b/poky/meta/recipes-support/gpgme/gpgme_1.18.0.bb index 40c41876fa..7ff4837d6f 100644 --- a/poky/meta/recipes-support/gpgme/gpgme_1.18.0.bb +++ b/poky/meta/recipes-support/gpgme/gpgme_1.18.0.bb @@ -21,6 +21,7 @@ SRC_URI = "${GNUPG_MIRROR}/gpgme/${BP}.tar.bz2 \ file://0007-python-Add-variables-to-tests.patch \ file://0008-do-not-auto-check-var-PYTHON.patch \ file://0001-use-closefrom-on-linux-and-glibc-2.34.patch \ + file://0001-posix-io.c-Use-off_t-instead-of-off64_t.patch \ " SRC_URI[sha256sum] = "361d4eae47ce925dba0ea569af40e7b52c645c4ae2e65e5621bf1b6cdd8b0e9e" diff --git a/poky/meta/recipes-support/icu/icu_71.1.bb b/poky/meta/recipes-support/icu/icu_71.1.bb deleted file mode 100644 index df999dce3b..0000000000 --- a/poky/meta/recipes-support/icu/icu_71.1.bb +++ /dev/null @@ -1,146 +0,0 @@ -SUMMARY = "International Component for Unicode libraries" -DESCRIPTION = "The International Component for Unicode (ICU) is a mature, \ -portable set of C/C++ and Java libraries for Unicode support, software \ -internationalization (I18N) and globalization (G11N), giving applications the \ -same results on all platforms." -HOMEPAGE = "http://site.icu-project.org/" - -LICENSE = "ICU" -DEPENDS = "icu-native autoconf-archive" -DEPENDS:class-native = "autoconf-archive-native" - -CVE_PRODUCT = "international_components_for_unicode" - -S = "${WORKDIR}/icu/source" -SPDX_S = "${WORKDIR}/icu" -STAGING_ICU_DIR_NATIVE = "${STAGING_DATADIR_NATIVE}/${BPN}/${PV}" - -ICU_MAJOR_VER = "${@d.getVar('PV').split('.')[0]}" - -inherit autotools pkgconfig github-releases - -# ICU needs the native build directory as an argument to its --with-cross-build option when -# cross-compiling. Taken the situation that different builds may share a common sstate-cache -# into consideration, the native build directory needs to be staged. -EXTRA_OECONF = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config" -EXTRA_OECONF:class-native = "--disable-icu-config" -EXTRA_OECONF:class-nativesdk = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config" - -EXTRA_OECONF:append:class-target = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' --with-data-packaging=archive', '', d)}" -TARGET_CXXFLAGS:append = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' -DICU_DATA_DIR=\\""${datadir}/${BPN}/${PV}\\""', '', d)}" - -ASNEEDED = "" - -do_compile:prepend:class-target () { - # Make sure certain build host references do not end up being compiled - # in the image. This only affects libicutu and icu-dbg - sed \ - -e 's,DU_BUILD=,DU_BUILD_unused=,g' \ - -e '/^CPPFLAGS.*/ s,--sysroot=${STAGING_DIR_TARGET},,g' \ - -i ${B}/tools/toolutil/Makefile -} - -PREPROCESS_RELOCATE_DIRS = "${datadir}/${BPN}/${PV}" -do_install:append:class-native() { - mkdir -p ${D}/${STAGING_ICU_DIR_NATIVE}/config - cp -r ${B}/config/icucross.mk ${D}/${STAGING_ICU_DIR_NATIVE}/config - cp -r ${B}/config/icucross.inc ${D}/${STAGING_ICU_DIR_NATIVE}/config - cp -r ${B}/lib ${D}/${STAGING_ICU_DIR_NATIVE} - cp -r ${B}/bin ${D}/${STAGING_ICU_DIR_NATIVE} - cp -r ${B}/tools ${D}/${STAGING_ICU_DIR_NATIVE} -} - -do_install:append:class-target() { - # The native pkgdata can not generate the correct data file. - # Use icupkg to re-generate it. - if [ "${SITEINFO_ENDIANNESS}" = "be" ] ; then - rm -f ${D}/${datadir}/${BPN}/${PV}/icudt${ICU_MAJOR_VER}b.dat - icupkg -tb ${S}/data/in/icudt${ICU_MAJOR_VER}l.dat ${D}/${datadir}/${BPN}/${PV}/icudt${ICU_MAJOR_VER}b.dat - fi - - # Remove build host references... - sed -i \ - -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ - -e 's|${DEBUG_PREFIX_MAP}||g' \ - -e 's:${HOSTTOOLS_DIR}/::g' \ - ${D}/${libdir}/${BPN}/${PV}/Makefile.inc \ - ${D}/${libdir}/${BPN}/${PV}/pkgdata.inc -} - -PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio" - -FILES:${PN}-dev += "${libdir}/${BPN}/" - -FILES:libicudata = "${libdir}/libicudata.so.*" -FILES:libicuuc = "${libdir}/libicuuc.so.*" -FILES:libicui18n = "${libdir}/libicui18n.so.*" -FILES:libicutu = "${libdir}/libicutu.so.*" -FILES:libicuio = "${libdir}/libicuio.so.*" - -BBCLASSEXTEND = "native nativesdk" - -LIC_FILES_CHKSUM = "file://../LICENSE;md5=a89d03060ff9c46552434dbd1fe3ed1f" - -def icu_download_version(d): - pvsplit = d.getVar('PV').split('.') - return pvsplit[0] + "_" + pvsplit[1] - -def icu_download_folder(d): - pvsplit = d.getVar('PV').split('.') - return pvsplit[0] + "-" + pvsplit[1] - -ICU_PV = "${@icu_download_version(d)}" -ICU_FOLDER = "${@icu_download_folder(d)}" - -# http://errors.yoctoproject.org/Errors/Details/20486/ -ARM_INSTRUCTION_SET:armv4 = "arm" -ARM_INSTRUCTION_SET:armv5 = "arm" - -BASE_SRC_URI = "${GITHUB_BASE_URI}/download/release-${ICU_FOLDER}/icu4c-${ICU_PV}-src.tgz" -DATA_SRC_URI = "${GITHUB_BASE_URI}/download/release-${ICU_FOLDER}/icu4c-${ICU_PV}-data.zip" -SRC_URI = "${BASE_SRC_URI};name=code \ - ${DATA_SRC_URI};name=data \ - file://filter.json \ - file://fix-install-manx.patch \ - file://0001-icu-Added-armeb-support.patch \ - " - -SRC_URI:append:class-target = "\ - file://0001-Disable-LDFLAGSICUDT-for-Linux.patch \ - " -SRC_URI[code.sha256sum] = "67a7e6e51f61faf1306b6935333e13b2c48abd8da6d2f46ce6adca24b1e21ebf" -SRC_URI[data.sha256sum] = "e3882b4fece6e5e039f22c3189b7ba224180fd26fdbfa9db284617455b93e804" - -UPSTREAM_CHECK_REGEX = "releases/tag/release-(?P(?!.+rc).+)" -GITHUB_BASE_URI = "https://github.com/unicode-org/icu/releases" - -EXTRA_OECONF:append:libc-musl = " ac_cv_func_strtod_l=no" - -PACKAGECONFIG ?= "" -PACKAGECONFIG[make-icudata] = ",,," - -do_make_icudata:class-target () { - ${@bb.utils.contains('PACKAGECONFIG', 'make-icudata', '', 'exit 0', d)} - cd ${S} - rm -rf data - cp -a ${WORKDIR}/data . - AR='${BUILD_AR}' \ - CC='${BUILD_CC}' \ - CPP='${BUILD_CPP}' \ - CXX='${BUILD_CXX}' \ - RANLIB='${BUILD_RANLIB}' \ - CFLAGS='${BUILD_CFLAGS}' \ - CPPFLAGS='${BUILD_CPPFLAGS}' \ - CXXFLAGS='${BUILD_CXXFLAGS}' \ - LDFLAGS='${BUILD_LDFLAGS}' \ - ICU_DATA_FILTER_FILE=${WORKDIR}/filter.json \ - ./runConfigureICU Linux --with-data-packaging=archive - oe_runmake - install -Dm644 ${S}/data/out/icudt${ICU_MAJOR_VER}l.dat ${S}/data/in/icudt${ICU_MAJOR_VER}l.dat -} - -do_make_icudata() { - : -} - -addtask make_icudata before do_configure after do_patch do_prepare_recipe_sysroot diff --git a/poky/meta/recipes-support/icu/icu_72-1.bb b/poky/meta/recipes-support/icu/icu_72-1.bb new file mode 100644 index 0000000000..2b20bdd7b2 --- /dev/null +++ b/poky/meta/recipes-support/icu/icu_72-1.bb @@ -0,0 +1,150 @@ +SUMMARY = "International Component for Unicode libraries" +DESCRIPTION = "The International Component for Unicode (ICU) is a mature, \ +portable set of C/C++ and Java libraries for Unicode support, software \ +internationalization (I18N) and globalization (G11N), giving applications the \ +same results on all platforms." +HOMEPAGE = "http://site.icu-project.org/" + +LICENSE = "ICU" +DEPENDS = "icu-native autoconf-archive" +DEPENDS:class-native = "autoconf-archive-native" + +CVE_PRODUCT = "international_components_for_unicode" + +S = "${WORKDIR}/icu/source" +SPDX_S = "${WORKDIR}/icu" +STAGING_ICU_DIR_NATIVE = "${STAGING_DATADIR_NATIVE}/${BPN}/${PV}" + +ICU_MAJOR_VER = "${@d.getVar('PV').split('-')[0]}" + +inherit autotools pkgconfig github-releases + +# ICU needs the native build directory as an argument to its --with-cross-build option when +# cross-compiling. Taken the situation that different builds may share a common sstate-cache +# into consideration, the native build directory needs to be staged. +EXTRA_OECONF = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config" +EXTRA_OECONF:class-native = "--disable-icu-config" +EXTRA_OECONF:class-nativesdk = "--with-cross-build=${STAGING_ICU_DIR_NATIVE} --disable-icu-config" + +EXTRA_OECONF:append:class-target = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' --with-data-packaging=archive', '', d)}" +TARGET_CXXFLAGS:append = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'be', ' -DICU_DATA_DIR=\\""${datadir}/${BPN}/${PV}\\""', '', d)}" + +ASNEEDED = "" + +do_compile:prepend:class-target () { + # Make sure certain build host references do not end up being compiled + # in the image. This only affects libicutu and icu-dbg + sed \ + -e 's,DU_BUILD=,DU_BUILD_unused=,g' \ + -e '/^CPPFLAGS.*/ s,--sysroot=${STAGING_DIR_TARGET},,g' \ + -i ${B}/tools/toolutil/Makefile +} + +PREPROCESS_RELOCATE_DIRS = "${datadir}/${BPN}/${PV}" +do_install:append:class-native() { + mkdir -p ${D}/${STAGING_ICU_DIR_NATIVE}/config + cp -r ${B}/config/icucross.mk ${D}/${STAGING_ICU_DIR_NATIVE}/config + cp -r ${B}/config/icucross.inc ${D}/${STAGING_ICU_DIR_NATIVE}/config + cp -r ${B}/lib ${D}/${STAGING_ICU_DIR_NATIVE} + cp -r ${B}/bin ${D}/${STAGING_ICU_DIR_NATIVE} + cp -r ${B}/tools ${D}/${STAGING_ICU_DIR_NATIVE} +} + +do_install:append:class-target() { + # The native pkgdata can not generate the correct data file. + # Use icupkg to re-generate it. + if [ "${SITEINFO_ENDIANNESS}" = "be" ] ; then + rm -f ${D}/${datadir}/${BPN}/${@icu_install_folder(d)}/icudt${ICU_MAJOR_VER}b.dat + icupkg -tb ${S}/data/in/icudt${ICU_MAJOR_VER}l.dat ${D}/${datadir}/${BPN}/${@icu_install_folder(d)}/icudt${ICU_MAJOR_VER}b.dat + fi + + # Remove build host references... + sed -i \ + -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's:${HOSTTOOLS_DIR}/::g' \ + ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/Makefile.inc \ + ${D}/${libdir}/${BPN}/${@icu_install_folder(d)}/pkgdata.inc +} + +PACKAGES =+ "libicudata libicuuc libicui18n libicutu libicuio" + +FILES:${PN}-dev += "${libdir}/${BPN}/" + +FILES:libicudata = "${libdir}/libicudata.so.*" +FILES:libicuuc = "${libdir}/libicuuc.so.*" +FILES:libicui18n = "${libdir}/libicui18n.so.*" +FILES:libicutu = "${libdir}/libicutu.so.*" +FILES:libicuio = "${libdir}/libicuio.so.*" + +BBCLASSEXTEND = "native nativesdk" + +LIC_FILES_CHKSUM = "file://../LICENSE;md5=a89d03060ff9c46552434dbd1fe3ed1f" + +def icu_download_version(d): + pvsplit = d.getVar('PV').split('-') + return pvsplit[0] + "_" + pvsplit[1] + +def icu_download_folder(d): + pvsplit = d.getVar('PV').split('-') + return pvsplit[0] + "-" + pvsplit[1] + +def icu_install_folder(d): + pvsplit = d.getVar('PV').split('-') + return pvsplit[0] + "." + pvsplit[1] + +ICU_PV = "${@icu_download_version(d)}" +ICU_FOLDER = "${@icu_download_folder(d)}" + +# http://errors.yoctoproject.org/Errors/Details/20486/ +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" + +BASE_SRC_URI = "${GITHUB_BASE_URI}/download/release-${ICU_FOLDER}/icu4c-${ICU_PV}-src.tgz" +DATA_SRC_URI = "${GITHUB_BASE_URI}/download/release-${ICU_FOLDER}/icu4c-${ICU_PV}-data.zip" +SRC_URI = "${BASE_SRC_URI};name=code \ + ${DATA_SRC_URI};name=data \ + file://filter.json \ + file://fix-install-manx.patch \ + file://0001-icu-Added-armeb-support.patch \ + " + +SRC_URI:append:class-target = "\ + file://0001-Disable-LDFLAGSICUDT-for-Linux.patch \ + " +SRC_URI[code.sha256sum] = "a2d2d38217092a7ed56635e34467f92f976b370e20182ad325edea6681a71d68" +SRC_URI[data.sha256sum] = "ee19f876507d6c23d9e0a2b631096f6b0eaa6fa61728c33a89efdb55e3385dea" + +UPSTREAM_CHECK_REGEX = "releases/tag/release-(?P(?!.+rc).+)" +GITHUB_BASE_URI = "https://github.com/unicode-org/icu/releases" + +EXTRA_OECONF:append:libc-musl = " ac_cv_func_strtod_l=no" + +PACKAGECONFIG ?= "" +PACKAGECONFIG[make-icudata] = ",,," + +do_make_icudata:class-target () { + ${@bb.utils.contains('PACKAGECONFIG', 'make-icudata', '', 'exit 0', d)} + cd ${S} + rm -rf data + cp -a ${WORKDIR}/data . + AR='${BUILD_AR}' \ + CC='${BUILD_CC}' \ + CPP='${BUILD_CPP}' \ + CXX='${BUILD_CXX}' \ + RANLIB='${BUILD_RANLIB}' \ + CFLAGS='${BUILD_CFLAGS}' \ + CPPFLAGS='${BUILD_CPPFLAGS}' \ + CXXFLAGS='${BUILD_CXXFLAGS}' \ + LDFLAGS='${BUILD_LDFLAGS}' \ + ICU_DATA_FILTER_FILE=${WORKDIR}/filter.json \ + ./runConfigureICU Linux --with-data-packaging=archive + oe_runmake + install -Dm644 ${S}/data/out/icudt${ICU_MAJOR_VER}l.dat ${S}/data/in/icudt${ICU_MAJOR_VER}l.dat +} + +do_make_icudata() { + : +} + +addtask make_icudata before do_configure after do_patch do_prepare_recipe_sysroot diff --git a/poky/meta/recipes-support/iso-codes/iso-codes_4.12.0.bb b/poky/meta/recipes-support/iso-codes/iso-codes_4.12.0.bb index ea7c43cdae..1c884a1174 100644 --- a/poky/meta/recipes-support/iso-codes/iso-codes_4.12.0.bb +++ b/poky/meta/recipes-support/iso-codes/iso-codes_4.12.0.bb @@ -20,3 +20,5 @@ S = "${WORKDIR}/git" inherit allarch autotools FILES:${PN} += "${datadir}/xml/" + +BBCLASSEXTEND += "native" diff --git a/poky/meta/recipes-support/libbsd/libbsd/0001-funopen-Replace-off64_t-with-off_t-in-funopen_seek.patch b/poky/meta/recipes-support/libbsd/libbsd/0001-funopen-Replace-off64_t-with-off_t-in-funopen_seek.patch new file mode 100644 index 0000000000..45ecef041b --- /dev/null +++ b/poky/meta/recipes-support/libbsd/libbsd/0001-funopen-Replace-off64_t-with-off_t-in-funopen_seek.patch @@ -0,0 +1,34 @@ +From 9c4e5f8984e46344c9e150764b8aa0a7a70b6cb5 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 09:02:22 -0800 +Subject: [PATCH] funopen: Replace off64_t with off_t in funopen_seek + +AC_SYS_LARGEFILE in configure.ac is setting needed defines to make +64bit off_t on relevant platforms. + +Fixes build on musl + +| ../../../../../../../../workspace/sources/libbsd/src/funopen.c:68:28: error: unknown type name 'off64_t'; did you mean 'off_t'? +| funopen_seek(void *cookie, off64_t *offset, int whence) +| ^~~~~~~ +| off_t + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/libbsd/libbsd/-/merge_requests/24] +Signed-off-by: Khem Raj +--- + src/funopen.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/funopen.c b/src/funopen.c +index 1e6f43a..a9b40e8 100644 +--- a/src/funopen.c ++++ b/src/funopen.c +@@ -65,7 +65,7 @@ funopen_write(void *cookie, const char *buf, size_t size) + } + + static int +-funopen_seek(void *cookie, off64_t *offset, int whence) ++funopen_seek(void *cookie, off_t *offset, int whence) + { + struct funopen_cookie *cookiewrap = cookie; + off_t soff = *offset; diff --git a/poky/meta/recipes-support/libbsd/libbsd_0.11.7.bb b/poky/meta/recipes-support/libbsd/libbsd_0.11.7.bb index 7a1deed1f6..a9f7a00469 100644 --- a/poky/meta/recipes-support/libbsd/libbsd_0.11.7.bb +++ b/poky/meta/recipes-support/libbsd/libbsd_0.11.7.bb @@ -32,7 +32,9 @@ LICENSE:${PN} = "BSD-3-Clause & ISC & PD" LIC_FILES_CHKSUM = "file://COPYING;md5=75e85c5a558f86d10fbd5abc567ea5e6" SECTION = "libs" -SRC_URI = "https://libbsd.freedesktop.org/releases/${BPN}-${PV}.tar.xz" +SRC_URI = "https://libbsd.freedesktop.org/releases/${BPN}-${PV}.tar.xz \ + file://0001-funopen-Replace-off64_t-with-off_t-in-funopen_seek.patch \ + " SRC_URI[sha256sum] = "9baa186059ebbf25c06308e9f991fda31f7183c0f24931826d83aa6abd8a0261" diff --git a/poky/meta/recipes-support/libevent/libevent_2.1.12.bb b/poky/meta/recipes-support/libevent/libevent_2.1.12.bb index 55a65e6c08..25388fb4d7 100644 --- a/poky/meta/recipes-support/libevent/libevent_2.1.12.bb +++ b/poky/meta/recipes-support/libevent/libevent_2.1.12.bb @@ -41,7 +41,7 @@ PACKAGES_DYNAMIC = "^${PN}-.*$" python split_libevent_libs () { do_split_packages(d, '${libdir}', r'^libevent_([a-z]*)-.*\.so\..*', '${PN}-%s', '${SUMMARY} (%s)', prepend=True, allow_links=True) } -PACKAGESPLITFUNCS:prepend = "split_libevent_libs " +PACKAGESPLITFUNCS =+ "split_libevent_libs" BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libgpg-error/libgpg-error/0001-Do-not-fail-when-testing-config-scripts.patch b/poky/meta/recipes-support/libgpg-error/libgpg-error/0001-Do-not-fail-when-testing-config-scripts.patch index a0ab4f23ff..ee3147f3df 100644 --- a/poky/meta/recipes-support/libgpg-error/libgpg-error/0001-Do-not-fail-when-testing-config-scripts.patch +++ b/poky/meta/recipes-support/libgpg-error/libgpg-error/0001-Do-not-fail-when-testing-config-scripts.patch @@ -1,4 +1,4 @@ -From 137805890951b6b585c1d23097e0a51e8c7a8a50 Mon Sep 17 00:00:00 2001 +From a45989a64af20ef6a9f7c1552f19bba116e7cd0a Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Fri, 28 Feb 2020 09:19:56 +0000 Subject: [PATCH] Do not fail when testing config scripts @@ -9,19 +9,19 @@ failure is due to that. Upstream-Status: Inappropriate [oe-core specific] Signed-off-by: Alexander Kanavin + --- src/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am -index 9303954..7630540 100644 +index c61adde..1b8b4ff 100644 --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -344,7 +344,6 @@ gpg-error-config: gpgrt-config gpg-error-config-old +@@ -323,6 +323,5 @@ gpg-error-config: gpgrt-config gpg-error-config-old gpg-error-config-test.sh else \ echo "no"; \ echo "*** Please report to with gpg-error-config-test.log"; \ - exit 1; \ fi cp gpg-error-config-old $@ - diff --git a/poky/meta/recipes-support/libgpg-error/libgpg-error/pkgconfig.patch b/poky/meta/recipes-support/libgpg-error/libgpg-error/pkgconfig.patch index 82bb4cdb47..75c1febc10 100644 --- a/poky/meta/recipes-support/libgpg-error/libgpg-error/pkgconfig.patch +++ b/poky/meta/recipes-support/libgpg-error/libgpg-error/pkgconfig.patch @@ -1,4 +1,4 @@ -From 0214d886d0153f7288f81213c47dc50f3b9fde20 Mon Sep 17 00:00:00 2001 +From e10f93167c76c477a7b97286cfac603795bf28d8 Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Thu, 29 Mar 2018 15:12:17 +0800 Subject: [PATCH] support pkgconfig @@ -14,14 +14,14 @@ Signed-off-by: Armin Kuster Signed-off-by: Zheng Ruoqin --- - src/gpg-error.m4 | 161 +---------------------------------------------- - 1 file changed, 3 insertions(+), 158 deletions(-) + src/gpg-error.m4 | 165 +---------------------------------------------- + 1 file changed, 3 insertions(+), 162 deletions(-) diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 -index 4b5cd40..c9978d6 100644 +index a975e53..af4bf2f 100644 --- a/src/gpg-error.m4 +++ b/src/gpg-error.m4 -@@ -27,158 +27,12 @@ dnl is added to the gpg_config_script_warn variable. +@@ -27,162 +27,12 @@ dnl is added to the gpg_config_script_warn variable. dnl AC_DEFUN([AM_PATH_GPG_ERROR], [ AC_REQUIRE([AC_CANONICAL_HOST]) @@ -118,6 +118,10 @@ index 4b5cd40..c9978d6 100644 - fi - if test -n "$gpgrt_libdir"; then break; fi - done +- if test -z "$libdir_candidates"; then +- # No valid pkgconfig dir in any of the system directories, fallback +- gpgrt_libdir=${possible_libdir1} +- fi - else - # When we cannot determine system libdir-format, use this: - gpgrt_libdir=${possible_libdir1} @@ -183,7 +187,7 @@ index 4b5cd40..c9978d6 100644 fi if test x"$gpg_error_config_host" != xnone ; then if test x"$gpg_error_config_host" != x"$host" ; then -@@ -194,15 +48,6 @@ AC_DEFUN([AM_PATH_GPG_ERROR], +@@ -198,15 +48,6 @@ AC_DEFUN([AM_PATH_GPG_ERROR], fi fi else diff --git a/poky/meta/recipes-support/libgpg-error/libgpg-error_1.45.bb b/poky/meta/recipes-support/libgpg-error/libgpg-error_1.45.bb deleted file mode 100644 index ff3a673df2..0000000000 --- a/poky/meta/recipes-support/libgpg-error/libgpg-error_1.45.bb +++ /dev/null @@ -1,53 +0,0 @@ -SUMMARY = "Small library that defines common error values for all GnuPG components" -DESCRIPTION = "Contains common error codes and error handling functions used by GnuPG, Libgcrypt, GPGME and more packages. " -HOMEPAGE = "http://www.gnupg.org/related_software/libgpg-error/" -BUGTRACKER = "https://bugs.g10code.com/gnupg/index" - -LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ - file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \ - file://src/gpg-error.h.in;beginline=2;endline=18;md5=d82591bc81561f617da71e00ff4a9d79 \ - file://src/init.c;beginline=2;endline=17;md5=f01cdfcf747af5380590cfd9bbfeaaf7 \ - " - - -SECTION = "libs" - -UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html" -SRC_URI = "${GNUPG_MIRROR}/libgpg-error/libgpg-error-${PV}.tar.bz2 \ - file://pkgconfig.patch \ - file://0001-Do-not-fail-when-testing-config-scripts.patch \ - file://run-ptest \ - " - -SRC_URI[sha256sum] = "570f8ee4fb4bff7b7495cff920c275002aea2147e9a1d220c068213267f80a26" - -BINCONFIG = "${bindir}/gpg-error-config" - -inherit autotools binconfig-disabled pkgconfig gettext multilib_header multilib_script ptest - -RDEPENDS:${PN}-ptest:append = " make" - -MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/gpgrt-config" - -CPPFLAGS += "-P" - -do_install:append() { - # we don't have common lisp in OE - rm -rf "${D}${datadir}/common-lisp/" - oe_multilib_header gpg-error.h gpgrt.h -} - -do_compile_ptest() { - oe_runmake -C tests buildtest-TESTS -} - -do_install_ptest() { - install ${B}/tests/t-*[!\.o] ${D}${PTEST_PATH} - install ${B}/tests/Makefile ${D}${PTEST_PATH} -} - -FILES:${PN}-dev += "${bindir}/gpg-error" -FILES:${PN}-doc += "${datadir}/libgpg-error/errorref.txt" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libgpg-error/libgpg-error_1.46.bb b/poky/meta/recipes-support/libgpg-error/libgpg-error_1.46.bb new file mode 100644 index 0000000000..580fe208d4 --- /dev/null +++ b/poky/meta/recipes-support/libgpg-error/libgpg-error_1.46.bb @@ -0,0 +1,53 @@ +SUMMARY = "Small library that defines common error values for all GnuPG components" +DESCRIPTION = "Contains common error codes and error handling functions used by GnuPG, Libgcrypt, GPGME and more packages. " +HOMEPAGE = "http://www.gnupg.org/related_software/libgpg-error/" +BUGTRACKER = "https://bugs.g10code.com/gnupg/index" + +LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ + file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \ + file://src/gpg-error.h.in;beginline=2;endline=18;md5=d82591bc81561f617da71e00ff4a9d79 \ + file://src/init.c;beginline=2;endline=17;md5=f01cdfcf747af5380590cfd9bbfeaaf7 \ + " + + +SECTION = "libs" + +UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html" +SRC_URI = "${GNUPG_MIRROR}/libgpg-error/libgpg-error-${PV}.tar.bz2 \ + file://pkgconfig.patch \ + file://0001-Do-not-fail-when-testing-config-scripts.patch \ + file://run-ptest \ + " + +SRC_URI[sha256sum] = "b7e11a64246bbe5ef37748de43b245abd72cfcd53c9ae5e7fc5ca59f1c81268d" + +BINCONFIG = "${bindir}/gpg-error-config" + +inherit autotools binconfig-disabled pkgconfig gettext multilib_header multilib_script ptest + +RDEPENDS:${PN}-ptest:append = " make" + +MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/gpgrt-config" + +CPPFLAGS += "-P" + +do_install:append() { + # we don't have common lisp in OE + rm -rf "${D}${datadir}/common-lisp/" + oe_multilib_header gpg-error.h gpgrt.h +} + +do_compile_ptest() { + oe_runmake -C tests buildtest-TESTS +} + +do_install_ptest() { + install ${B}/tests/t-*[!\.o] ${D}${PTEST_PATH} + install ${B}/tests/Makefile ${D}${PTEST_PATH} +} + +FILES:${PN}-dev += "${bindir}/gpg-error" +FILES:${PN}-doc += "${datadir}/libgpg-error/errorref.txt" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libksba/libksba/ksba-add-pkgconfig-support.patch b/poky/meta/recipes-support/libksba/libksba/ksba-add-pkgconfig-support.patch index af96bd57cd..bdb80ff34d 100644 --- a/poky/meta/recipes-support/libksba/libksba/ksba-add-pkgconfig-support.patch +++ b/poky/meta/recipes-support/libksba/libksba/ksba-add-pkgconfig-support.patch @@ -1,4 +1,4 @@ -From 6081640895b6d566fa21123e2de7d111eeab5c4c Mon Sep 17 00:00:00 2001 +From ca8174aa81d7bf364b33f7254a9e887735c4996d Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Mon, 3 Dec 2012 18:17:31 +0800 Subject: [PATCH] libksba: add pkgconfig support @@ -16,7 +16,7 @@ Signed-off-by: Chen Qi 1 file changed, 4 insertions(+), 86 deletions(-) diff --git a/src/ksba.m4 b/src/ksba.m4 -index 6b55bb8..6e7336f 100644 +index 452c245..aa96255 100644 --- a/src/ksba.m4 +++ b/src/ksba.m4 @@ -23,37 +23,6 @@ dnl with a changed API. @@ -44,7 +44,7 @@ index 6b55bb8..6e7336f 100644 - fi - - use_gpgrt_config="" -- if test x"$KSBA_CONFIG" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then +- if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then - if $GPGRT_CONFIG ksba --exists; then - KSBA_CONFIG="$GPGRT_CONFIG ksba" - AC_MSG_NOTICE([Use gpgrt-config as ksba-config]) diff --git a/poky/meta/recipes-support/libksba/libksba_1.6.2.bb b/poky/meta/recipes-support/libksba/libksba_1.6.2.bb deleted file mode 100644 index f6ecb9aec4..0000000000 --- a/poky/meta/recipes-support/libksba/libksba_1.6.2.bb +++ /dev/null @@ -1,34 +0,0 @@ -SUMMARY = "Easy API to create and parse X.509 and CMS related objects" -DESCRIPTION = "A library to make the tasks of working with X.509 certificates, \ -CMS data and related objects more easy. It provides a highlevel interface to \ -the implemented protocols and presents the data in a consistent way. The \ -library does not rely on another cryptographic library but provides \ -hooks for easy integration with Libgcrypt. " -HOMEPAGE = "http://www.gnupg.org/related_software/libksba/" -LICENSE = "GPL-3.0-or-later & (GPL-2.0-or-later | LGPL-3.0-or-later)" -LICENSE:${PN} = "GPL-2.0-or-later | LGPL-3.0-or-later" -LICENSE:${PN}-doc = "GPL-3.0-or-later" -LIC_FILES_CHKSUM = "file://COPYING;md5=fd541d83f75d038c4e0617b672ed8bda \ - file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=2f31b266d3440dd7ee50f92cf67d8e6c \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02 \ - " - -DEPENDS = "libgpg-error" - -BINCONFIG = "${bindir}/ksba-config" - -inherit autotools binconfig-disabled pkgconfig texinfo - -UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html" -SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ - file://ksba-add-pkgconfig-support.patch" - -SRC_URI[sha256sum] = "fce01ccac59812bddadffacff017dac2e4762bdb6ebc6ffe06f6ed4f6192c971" - -do_configure:prepend () { - # Else these could be used in preference to those in aclocal-copy - rm -f ${S}/m4/gpg-error.m4 -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libksba/libksba_1.6.3.bb b/poky/meta/recipes-support/libksba/libksba_1.6.3.bb new file mode 100644 index 0000000000..dc39693be4 --- /dev/null +++ b/poky/meta/recipes-support/libksba/libksba_1.6.3.bb @@ -0,0 +1,34 @@ +SUMMARY = "Easy API to create and parse X.509 and CMS related objects" +DESCRIPTION = "A library to make the tasks of working with X.509 certificates, \ +CMS data and related objects more easy. It provides a highlevel interface to \ +the implemented protocols and presents the data in a consistent way. The \ +library does not rely on another cryptographic library but provides \ +hooks for easy integration with Libgcrypt. " +HOMEPAGE = "http://www.gnupg.org/related_software/libksba/" +LICENSE = "GPL-3.0-or-later & (GPL-2.0-or-later | LGPL-3.0-or-later)" +LICENSE:${PN} = "GPL-2.0-or-later | LGPL-3.0-or-later" +LICENSE:${PN}-doc = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=fd541d83f75d038c4e0617b672ed8bda \ + file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=2f31b266d3440dd7ee50f92cf67d8e6c \ + file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02 \ + " + +DEPENDS = "libgpg-error" + +BINCONFIG = "${bindir}/ksba-config" + +inherit autotools binconfig-disabled pkgconfig texinfo + +UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html" +SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ + file://ksba-add-pkgconfig-support.patch" + +SRC_URI[sha256sum] = "3f72c68db30971ebbf14367527719423f0a4d5f8103fc9f4a1c01a9fa440de5c" + +do_configure:prepend () { + # Else these could be used in preference to those in aclocal-copy + rm -f ${S}/m4/gpg-error.m4 +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libmpc/libmpc_1.2.1.bb b/poky/meta/recipes-support/libmpc/libmpc_1.2.1.bb deleted file mode 100644 index 15d382c4ad..0000000000 --- a/poky/meta/recipes-support/libmpc/libmpc_1.2.1.bb +++ /dev/null @@ -1,12 +0,0 @@ -require libmpc.inc - -DEPENDS = "gmp mpfr" - -LIC_FILES_CHKSUM = "file://COPYING.LESSER;md5=e6a600fd5e1d9cbde2d983680233ad02" -SRC_URI = "${GNU_MIRROR}/mpc/mpc-${PV}.tar.gz" - -SRC_URI[sha256sum] = "17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459" - -S = "${WORKDIR}/mpc-${PV}" -BBCLASSEXTEND = "native nativesdk" - diff --git a/poky/meta/recipes-support/libmpc/libmpc_1.3.1.bb b/poky/meta/recipes-support/libmpc/libmpc_1.3.1.bb new file mode 100644 index 0000000000..ed57396c0a --- /dev/null +++ b/poky/meta/recipes-support/libmpc/libmpc_1.3.1.bb @@ -0,0 +1,12 @@ +require libmpc.inc + +DEPENDS = "gmp mpfr" + +LIC_FILES_CHKSUM = "file://COPYING.LESSER;md5=e6a600fd5e1d9cbde2d983680233ad02" +SRC_URI = "${GNU_MIRROR}/mpc/mpc-${PV}.tar.gz" + +SRC_URI[sha256sum] = "ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8" + +S = "${WORKDIR}/mpc-${PV}" +BBCLASSEXTEND = "native nativesdk" + diff --git a/poky/meta/recipes-support/libpcre/libpcre2_10.40.bb b/poky/meta/recipes-support/libpcre/libpcre2_10.40.bb deleted file mode 100644 index 13f7c8305f..0000000000 --- a/poky/meta/recipes-support/libpcre/libpcre2_10.40.bb +++ /dev/null @@ -1,55 +0,0 @@ -DESCRIPTION = "There are two major versions of the PCRE library. The \ -newest version is PCRE2, which is a re-working of the original PCRE \ -library to provide an entirely new API. The original, very widely \ -deployed PCRE library's API and feature are stable, future releases \ - will be for bugfixes only. All new future features will be to PCRE2, \ -not the original PCRE 8.x series." -SUMMARY = "Perl Compatible Regular Expressions version 2" -HOMEPAGE = "http://www.pcre.org" -SECTION = "devel" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENCE;md5=41bfb977e4933c506588724ce69bf5d2" - -SRC_URI = "${GITHUB_BASE_URI}/download/pcre2-${PV}/pcre2-${PV}.tar.bz2" - -GITHUB_BASE_URI = "https://github.com/PhilipHazel/pcre2/releases" -UPSTREAM_CHECK_REGEX = "releases/tag/pcre2-(?P.+)" - -SRC_URI[sha256sum] = "14e4b83c4783933dc17e964318e6324f7cae1bc75d8f3c79bc6969f00c159d68" - -CVE_PRODUCT = "pcre2" - -S = "${WORKDIR}/pcre2-${PV}" - -PROVIDES += "pcre2" -DEPENDS += "bzip2 zlib" - -BINCONFIG = "${bindir}/pcre2-config" - -inherit autotools binconfig-disabled github-releases - -EXTRA_OECONF = "\ - --enable-newline-is-lf \ - --with-link-size=2 \ - --with-match-limit=10000000 \ - --enable-pcre2-16 \ - --enable-pcre2-32 \ -" -CFLAGS += "-D_REENTRANT" -CXXFLAGS:append:powerpc = " -lstdc++" - -PACKAGES =+ "libpcre2-16 libpcre2-32 pcre2grep pcre2grep-doc pcre2test pcre2test-doc" - -SUMMARY:pcre2grep = "grep utility that uses perl 5 compatible regexes" -SUMMARY:pcre2grep-doc = "grep utility that uses perl 5 compatible regexes - docs" -SUMMARY:pcre2test = "program for testing Perl-comatible regular expressions" -SUMMARY:pcre2test-doc = "program for testing Perl-comatible regular expressions - docs" - -FILES:libpcre2-16 = "${libdir}/libpcre2-16.so.*" -FILES:libpcre2-32 = "${libdir}/libpcre2-32.so.*" -FILES:pcre2grep = "${bindir}/pcre2grep" -FILES:pcre2grep-doc = "${mandir}/man1/pcre2grep.1" -FILES:pcre2test = "${bindir}/pcre2test" -FILES:pcre2test-doc = "${mandir}/man1/pcre2test.1" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libpcre/libpcre2_10.42.bb b/poky/meta/recipes-support/libpcre/libpcre2_10.42.bb new file mode 100644 index 0000000000..cd65493c48 --- /dev/null +++ b/poky/meta/recipes-support/libpcre/libpcre2_10.42.bb @@ -0,0 +1,55 @@ +DESCRIPTION = "There are two major versions of the PCRE library. The \ +newest version is PCRE2, which is a re-working of the original PCRE \ +library to provide an entirely new API. The original, very widely \ +deployed PCRE library's API and feature are stable, future releases \ + will be for bugfixes only. All new future features will be to PCRE2, \ +not the original PCRE 8.x series." +SUMMARY = "Perl Compatible Regular Expressions version 2" +HOMEPAGE = "http://www.pcre.org" +SECTION = "devel" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENCE;md5=41bfb977e4933c506588724ce69bf5d2" + +SRC_URI = "${GITHUB_BASE_URI}/download/pcre2-${PV}/pcre2-${PV}.tar.bz2" + +GITHUB_BASE_URI = "https://github.com/PhilipHazel/pcre2/releases" +UPSTREAM_CHECK_REGEX = "releases/tag/pcre2-(?P.+)" + +SRC_URI[sha256sum] = "8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840" + +CVE_PRODUCT = "pcre2" + +S = "${WORKDIR}/pcre2-${PV}" + +PROVIDES += "pcre2" +DEPENDS += "bzip2 zlib" + +BINCONFIG = "${bindir}/pcre2-config" + +inherit autotools binconfig-disabled github-releases + +EXTRA_OECONF = "\ + --enable-newline-is-lf \ + --with-link-size=2 \ + --with-match-limit=10000000 \ + --enable-pcre2-16 \ + --enable-pcre2-32 \ +" +CFLAGS += "-D_REENTRANT" +CXXFLAGS:append:powerpc = " -lstdc++" + +PACKAGES =+ "libpcre2-16 libpcre2-32 pcre2grep pcre2grep-doc pcre2test pcre2test-doc" + +SUMMARY:pcre2grep = "grep utility that uses perl 5 compatible regexes" +SUMMARY:pcre2grep-doc = "grep utility that uses perl 5 compatible regexes - docs" +SUMMARY:pcre2test = "program for testing Perl-comatible regular expressions" +SUMMARY:pcre2test-doc = "program for testing Perl-comatible regular expressions - docs" + +FILES:libpcre2-16 = "${libdir}/libpcre2-16.so.*" +FILES:libpcre2-32 = "${libdir}/libpcre2-32.so.*" +FILES:pcre2grep = "${bindir}/pcre2grep" +FILES:pcre2grep-doc = "${mandir}/man1/pcre2grep.1" +FILES:pcre2test = "${bindir}/pcre2test" +FILES:pcre2test-doc = "${mandir}/man1/pcre2test.1" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libpsl/libpsl_0.21.1.bb b/poky/meta/recipes-support/libpsl/libpsl_0.21.1.bb deleted file mode 100644 index 58f56c145e..0000000000 --- a/poky/meta/recipes-support/libpsl/libpsl_0.21.1.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "Public Suffix List library" -DESCRIPTION = "The libpsl package provides a library for accessing and \ -resolving information from the Public Suffix List (PSL). The PSL is a set of \ -domain names beyond the standard suffixes, such as .com." - -HOMEPAGE = "https://rockdaboot.github.io/libpsl/" -BUGTRACKER = "https://github.com/rockdaboot/libpsl/issues" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;md5=5437030d9e4fbe7267ced058ddb8a7f5 \ - file://COPYING;md5=f41d10997a12da5ee3c24ceeb0148d18" - -SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \ - " -SRC_URI[sha256sum] = "ac6ce1e1fbd4d0254c4ddb9d37f1fa99dec83619c1253328155206b896210d4c" - -GITHUB_BASE_URI = "https://github.com/rockdaboot/libpsl/releases" - -inherit autotools gettext gtk-doc manpages pkgconfig lib_package github-releases - -PACKAGECONFIG ?= "icu" -PACKAGECONFIG[manpages] = "--enable-man,--disable-man,libxslt-native" -PACKAGECONFIG[icu] = "--enable-runtime=libicu --enable-builtin=libicu,,icu" -PACKAGECONFIG[idn2] = "--enable-runtime=libidn2 --enable-builtin=libidn2,,libidn2 libunistring" -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libpsl/libpsl_0.21.2.bb b/poky/meta/recipes-support/libpsl/libpsl_0.21.2.bb new file mode 100644 index 0000000000..3bbbc0e521 --- /dev/null +++ b/poky/meta/recipes-support/libpsl/libpsl_0.21.2.bb @@ -0,0 +1,26 @@ +SUMMARY = "Public Suffix List library" +DESCRIPTION = "The libpsl package provides a library for accessing and \ +resolving information from the Public Suffix List (PSL). The PSL is a set of \ +domain names beyond the standard suffixes, such as .com." + +HOMEPAGE = "https://rockdaboot.github.io/libpsl/" +BUGTRACKER = "https://github.com/rockdaboot/libpsl/issues" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=6f40ab7fcf5ff18f3ff7f4b0860493fa \ + file://COPYING;md5=6f40ab7fcf5ff18f3ff7f4b0860493fa \ + " + +SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \ + " +SRC_URI[sha256sum] = "e35991b6e17001afa2c0ca3b10c357650602b92596209b7492802f3768a6285f" + +GITHUB_BASE_URI = "https://github.com/rockdaboot/libpsl/releases" + +inherit autotools gettext gtk-doc manpages pkgconfig lib_package github-releases + +PACKAGECONFIG ?= "icu" +PACKAGECONFIG[manpages] = "--enable-man,--disable-man,libxslt-native" +PACKAGECONFIG[icu] = "--enable-runtime=libicu --enable-builtin=libicu,,icu" +PACKAGECONFIG[idn2] = "--enable-runtime=libidn2 --enable-builtin=libidn2,,libidn2 libunistring" +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/libseccomp/libseccomp_2.5.4.bb b/poky/meta/recipes-support/libseccomp/libseccomp_2.5.4.bb index e89b8f7f4b..505c21917b 100644 --- a/poky/meta/recipes-support/libseccomp/libseccomp_2.5.4.bb +++ b/poky/meta/recipes-support/libseccomp/libseccomp_2.5.4.bb @@ -1,5 +1,5 @@ SUMMARY = "interface to seccomp filtering mechanism" -DESCRIPTION = "The libseccomp library provides and easy to use, platform independent,interface to the Linux Kernel's syscall filtering mechanism: seccomp." +DESCRIPTION = "The libseccomp library provides an easy to use, platform independent, interface to the Linux Kernel's syscall filtering mechanism: seccomp." HOMEPAGE = "https://github.com/seccomp/libseccomp" SECTION = "security" LICENSE = "LGPL-2.1-only" diff --git a/poky/meta/recipes-support/mpfr/mpfr_4.1.0.bb b/poky/meta/recipes-support/mpfr/mpfr_4.1.0.bb deleted file mode 100644 index 2121dad57c..0000000000 --- a/poky/meta/recipes-support/mpfr/mpfr_4.1.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "C library for multiple-precision floating-point computations with exact rounding" -DESCRIPTION = "The GNU Multiple Precision Floating-Point Reliable Library (GNU MPFR) is a GNU portable C library for arbitrary-precision binary floating-point computation with correct rounding, based on GNU Multi-Precision Library. MPFR's computation is both efficient and has a well-defined semantics: the functions are completely specified on all the possible operands and the results do not depend on the platform." -HOMEPAGE = "https://www.mpfr.org/" -LICENSE = "LGPL-3.0-or-later" -SECTION = "devel" - -inherit autotools texinfo - -LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \ - file://COPYING.LESSER;md5=3000208d539ec061b899bce1d9ce9404 \ - " -DEPENDS = "gmp autoconf-archive" - -SRC_URI = "https://www.mpfr.org/mpfr-${PV}/mpfr-${PV}.tar.xz" -SRC_URI[sha256sum] = "0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f" - -UPSTREAM_CHECK_URI = "http://www.mpfr.org/mpfr-current/" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/mpfr/mpfr_4.2.0.bb b/poky/meta/recipes-support/mpfr/mpfr_4.2.0.bb new file mode 100644 index 0000000000..fead5c3833 --- /dev/null +++ b/poky/meta/recipes-support/mpfr/mpfr_4.2.0.bb @@ -0,0 +1,19 @@ +SUMMARY = "C library for multiple-precision floating-point computations with exact rounding" +DESCRIPTION = "The GNU Multiple Precision Floating-Point Reliable Library (GNU MPFR) is a GNU portable C library for arbitrary-precision binary floating-point computation with correct rounding, based on GNU Multi-Precision Library. MPFR's computation is both efficient and has a well-defined semantics: the functions are completely specified on all the possible operands and the results do not depend on the platform." +HOMEPAGE = "https://www.mpfr.org/" +LICENSE = "LGPL-3.0-or-later" +SECTION = "devel" + +inherit autotools texinfo + +LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \ + file://COPYING.LESSER;md5=3000208d539ec061b899bce1d9ce9404 \ + " +DEPENDS = "gmp autoconf-archive" + +SRC_URI = "https://www.mpfr.org/mpfr-${PV}/mpfr-${PV}.tar.xz" +SRC_URI[sha256sum] = "06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993" + +UPSTREAM_CHECK_URI = "http://www.mpfr.org/mpfr-current/" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/nghttp2/nghttp2_1.50.0.bb b/poky/meta/recipes-support/nghttp2/nghttp2_1.50.0.bb deleted file mode 100644 index 66311b2edf..0000000000 --- a/poky/meta/recipes-support/nghttp2/nghttp2_1.50.0.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "HTTP/2 C Library and tools" -HOMEPAGE = "https://nghttp2.org/" -SECTION = "libs" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=764abdf30b2eadd37ce47dcbce0ea1ec" - -SRC_URI = "\ - ${GITHUB_BASE_URI}/download/v${PV}/nghttp2-${PV}.tar.xz \ - file://0001-fetch-ocsp-response-use-python3.patch \ -" -SRC_URI[sha256sum] = "af24007e34c18c782393a1dc3685f8fd5b50283e90a9191d25488eb50aa2c825" - -inherit cmake manpages python3native github-releases -PACKAGECONFIG[manpages] = "" - -# examples are never installed, and don't need to be built in the -# first place -EXTRA_OECMAKE = "-DENABLE_EXAMPLES=OFF -DENABLE_APP=OFF -DENABLE_HPACK_TOOLS=OFF" - -PACKAGES =+ "lib${BPN} ${PN}-client ${PN}-proxy ${PN}-server" - -RDEPENDS:${PN} = "${PN}-client (>= ${PV}) ${PN}-proxy (>= ${PV}) ${PN}-server (>= ${PV})" -RDEPENDS:${PN}:class-native = "" -RDEPENDS:${PN}-proxy = "openssl python3-core python3-io python3-shell" - -ALLOW_EMPTY:${PN} = "1" -FILES:${PN} = "" -FILES:lib${BPN} = "${libdir}/*${SOLIBS}" -FILES:${PN}-client = "${bindir}/h2load ${bindir}/nghttp" -FILES:${PN}-proxy = "${bindir}/nghttpx ${datadir}/${BPN}/fetch-ocsp-response" -FILES:${PN}-server = "${bindir}/nghttpd" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/nghttp2/nghttp2_1.51.0.bb b/poky/meta/recipes-support/nghttp2/nghttp2_1.51.0.bb new file mode 100644 index 0000000000..fc1a592200 --- /dev/null +++ b/poky/meta/recipes-support/nghttp2/nghttp2_1.51.0.bb @@ -0,0 +1,33 @@ +SUMMARY = "HTTP/2 C Library and tools" +HOMEPAGE = "https://nghttp2.org/" +SECTION = "libs" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=764abdf30b2eadd37ce47dcbce0ea1ec" + +SRC_URI = "\ + ${GITHUB_BASE_URI}/download/v${PV}/nghttp2-${PV}.tar.xz \ + file://0001-fetch-ocsp-response-use-python3.patch \ +" +SRC_URI[sha256sum] = "66aa76d97c143f42295405a31413e5e7d157968dad9f957bb4b015b598882e6b" + +inherit cmake manpages python3native github-releases +PACKAGECONFIG[manpages] = "" + +# examples are never installed, and don't need to be built in the +# first place +EXTRA_OECMAKE = "-DENABLE_EXAMPLES=OFF -DENABLE_APP=OFF -DENABLE_HPACK_TOOLS=OFF" + +PACKAGES =+ "lib${BPN} ${PN}-client ${PN}-proxy ${PN}-server" + +RDEPENDS:${PN} = "${PN}-client (>= ${PV}) ${PN}-proxy (>= ${PV}) ${PN}-server (>= ${PV})" +RDEPENDS:${PN}:class-native = "" +RDEPENDS:${PN}-proxy = "openssl python3-core python3-io python3-shell" + +ALLOW_EMPTY:${PN} = "1" +FILES:${PN} = "" +FILES:lib${BPN} = "${libdir}/*${SOLIBS}" +FILES:${PN}-client = "${bindir}/h2load ${bindir}/nghttp" +FILES:${PN}-proxy = "${bindir}/nghttpx ${datadir}/${BPN}/fetch-ocsp-response" +FILES:${PN}-server = "${bindir}/nghttpd" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch b/poky/meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch new file mode 100644 index 0000000000..152eb2807b --- /dev/null +++ b/poky/meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch @@ -0,0 +1,27 @@ +From 61f910f5d12d6f6a66223b5af6d74e30ace3a2e1 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 12:10:37 -0800 +Subject: [PATCH] configure: Check for largefile support + +This helps in using 64bit versions of off_t related functions + +Upstream-Status: Backport [https://github.com/numactl/numactl/pull/159] +Signed-off-by: Khem Raj +--- + configure.ac | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 8510fc5..d74bc6e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -14,6 +14,9 @@ LT_INIT + + AC_PROG_CC + ++# Check for enabling LFS support ++AC_SYS_LARGEFILE ++ + # Override CFLAGS so that we can specify custom CFLAGS for numademo. + AX_AM_OVERRIDE_VAR([CFLAGS]) + diff --git a/poky/meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch b/poky/meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch new file mode 100644 index 0000000000..03b98e0a2c --- /dev/null +++ b/poky/meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch @@ -0,0 +1,64 @@ +From 8a08d3583d77bebeb1763fb9b378899201ce5afa Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Dec 2022 12:11:13 -0800 +Subject: [PATCH] shm.c: Replace stat64/fstat64/ftruncate64mmap64 with normal functions + +These functions were needed when _FILE_OFFSET_BITS was not 64, using +AC_SYS_LARGEFILE will detect it correctly and make the normal variants +of these functions behave same as their *64 counterparts. + +Upstream-Status: Backport [https://github.com/numactl/numactl/pull/159] +Signed-off-by: Khem Raj +--- + shm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/shm.c b/shm.c +index 20537d9..5d0d1ab 100644 +--- a/shm.c ++++ b/shm.c +@@ -24,8 +24,8 @@ + #include + #include + #include +-#include + #include ++#include + #include + #include + #include +@@ -135,7 +135,7 @@ void attach_sysvshm(char *name, char *opt) + /* Attach a shared memory file. */ + void attach_shared(char *name, char *opt) + { +- struct stat64 st; ++ struct stat st; + + shmfd = open(name, O_RDWR); + if (shmfd < 0) { +@@ -146,14 +146,14 @@ void attach_shared(char *name, char *opt) + if (shmfd < 0) + nerror("cannot create file %s", name); + } +- if (fstat64(shmfd, &st) < 0) ++ if (fstat(shmfd, &st) < 0) + err("shm stat"); + /* the file size must be larger than mmap shmlen + shmoffset, otherwise SIGBUS + * will be caused when we access memory, because mmaped memory is no longer in + * the range of the file laster. + */ + if ((shmlen + shmoffset) > st.st_size) { +- if (ftruncate64(shmfd, shmlen + shmoffset) < 0) { ++ if (ftruncate(shmfd, shmlen + shmoffset) < 0) { + /* XXX: we could do it by hand, but it would it + would be impossible to apply policy then. + need to fix that in the kernel. */ +@@ -168,7 +168,7 @@ void attach_shared(char *name, char *opt) + + /* RED-PEN For shmlen > address space may need to map in pieces. + Left for some poor 32bit soul. */ +- shmptr = mmap64(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset); ++ shmptr = mmap(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset); + if (shmptr == (char*)-1) + err("shm mmap"); + } diff --git a/poky/meta/recipes-support/numactl/numactl_git.bb b/poky/meta/recipes-support/numactl/numactl_git.bb index 23be0a3b4f..0f71258bc3 100644 --- a/poky/meta/recipes-support/numactl/numactl_git.bb +++ b/poky/meta/recipes-support/numactl/numactl_git.bb @@ -18,6 +18,8 @@ SRC_URI = "git://github.com/numactl/numactl;branch=master;protocol=https \ file://Makefile \ file://run-ptest \ file://0001-define-run-test-target.patch \ + file://0001-configure-Check-for-largefile-support.patch \ + file://0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch \ " S = "${WORKDIR}/git" diff --git a/poky/meta/recipes-support/popt/popt/0001-popt-test-output-format-for-ptest.patch b/poky/meta/recipes-support/popt/popt/0001-popt-test-output-format-for-ptest.patch deleted file mode 100644 index 020949cc34..0000000000 --- a/poky/meta/recipes-support/popt/popt/0001-popt-test-output-format-for-ptest.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 330b77081c3a4c7ae76cb08602db385b40fa7ff7 Mon Sep 17 00:00:00 2001 -From: Simone Weiss -Date: Mon, 13 Dec 2021 09:29:53 +0000 -Subject: [PATCH] popt test output format for ptest - -patch test output format to match simple-test as it is used in ptests. - -Upstream-Status: Pending - -Signed-off-by: Simone Weiss -Signed-off-by: David Niederpruem ---- - tests/testit.sh | 20 ++++++++------------ - 1 file changed, 8 insertions(+), 12 deletions(-) - -diff --git a/tests/testit.sh b/tests/testit.sh -index 2a7b4aa..50b42e2 100755 ---- a/tests/testit.sh -+++ b/tests/testit.sh -@@ -5,12 +5,11 @@ run() { - name=$1; shift - answer=$1; shift - -- echo Running test $name. -- - result=`HOME=$builddir $builddir/$prog $*` - if [ "$answer" != "$result" ]; then -- echo "Test \"$prog $*\" failed with: \"$result\" != \"$answer\" " -- exit 2 -+ echo "FAIL: $name" -+ else -+ echo "PASS: $name" - fi - } - -@@ -23,17 +22,17 @@ run_diff() { - out=$builddir/tmp.out - diff_file=$builddir/tmp.diff - -- echo Running test $name. -- - $builddir/$prog $in_file > $out - ret=$? - diff $out $answer_file > $diff_file - diff_ret=$? - - if [ "$diff_ret" != "0" ]; then -- echo "Test \"$name\" failed output is in $out, diff is:" -- cat $diff_file -- exit 2 -+ echo "FAIL: $name" -+ echo "diff is:" -+ cat $diff_file -+ else -+ echo "PASS: $name" - fi - rm $out $diff_file - } -@@ -174,6 +173,3 @@ Help options: - #run_diff test3 "test3 - 51" test3-data/01.input test3-data/01.answer - #run_diff test3 "test3 - 52" test3-data/02.input test3-data/02.answer - #run_diff test3 "test3 - 53" test3-data/03.input test3-data/03.answer -- --echo "" --echo "Passed." --- -2.17.1 - diff --git a/poky/meta/recipes-support/popt/popt_1.18.bb b/poky/meta/recipes-support/popt/popt_1.18.bb deleted file mode 100644 index b465f8817d..0000000000 --- a/poky/meta/recipes-support/popt/popt_1.18.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "Library for parsing command line options" -DESCRIPTION = "Popt is a C library for parsing command line parameters. Popt was heavily influenced by the getopt() and getopt_long() functions, but it improves on them by allowing more powerful argument expansion. Popt can parse arbitrary argv[] style arrays and automatically set variables based on command line arguments." -HOMEPAGE = "https://www.rpm.org/" -SECTION = "libs" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=cb0613c30af2a8249b8dcc67d3edb06d" - -DEPENDS = "virtual/libiconv" - -SRC_URI = "\ - http://ftp.rpm.org/popt/releases/popt-1.x/${BP}.tar.gz \ - file://0001-popt-test-output-format-for-ptest.patch \ - file://run-ptest \ -" -SRC_URI[sha256sum] = "5159bc03a20b28ce363aa96765f37df99ea4d8850b1ece17d1e6ad5c24fdc5d1" - -inherit autotools gettext ptest - -RDEPENDS:${PN}-ptest += "bash" - -do_compile_ptest() { - sed 's#lt-test1#test1#g' ${S}/tests/testit.sh > ${B}/tests/testit.sh -} - -do_install_ptest() { - install ${B}/tests/.libs/test* ${D}/${PTEST_PATH} - install ${B}/tests/.libs/tdict ${D}/${PTEST_PATH} - install ${B}/tests/testit.sh ${D}/${PTEST_PATH} - install ${B}/tests/test-poptrc ${D}/${PTEST_PATH} -} - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/popt/popt_1.19.bb b/poky/meta/recipes-support/popt/popt_1.19.bb new file mode 100644 index 0000000000..b1d8bea790 --- /dev/null +++ b/poky/meta/recipes-support/popt/popt_1.19.bb @@ -0,0 +1,31 @@ +SUMMARY = "Library for parsing command line options" +DESCRIPTION = "Popt is a C library for parsing command line parameters. Popt was heavily influenced by the getopt() and getopt_long() functions, but it improves on them by allowing more powerful argument expansion. Popt can parse arbitrary argv[] style arrays and automatically set variables based on command line arguments." +HOMEPAGE = "https://www.rpm.org/" +SECTION = "libs" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=e0206ac9471d06667e076212db20c5f4" + +DEPENDS = "virtual/libiconv" + +SRC_URI = "http://ftp.rpm.org/popt/releases/popt-1.x/${BP}.tar.gz \ + file://run-ptest \ + " +SRC_URI[sha256sum] = "c25a4838fc8e4c1c8aacb8bd620edb3084a3d63bf8987fdad3ca2758c63240f9" + +inherit autotools gettext ptest + +RDEPENDS:${PN}-ptest += "bash" + +do_compile_ptest() { + sed 's#lt-test1#test1#g' ${S}/tests/testit.sh > ${B}/tests/testit.sh +} + +do_install_ptest() { + install ${B}/tests/.libs/test* ${D}/${PTEST_PATH} + install ${B}/tests/.libs/tdict ${D}/${PTEST_PATH} + install ${B}/tests/testit.sh ${D}/${PTEST_PATH} + install ${B}/tests/test-poptrc ${D}/${PTEST_PATH} +} + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/sqlite/sqlite3_3.39.4.bb b/poky/meta/recipes-support/sqlite/sqlite3_3.39.4.bb deleted file mode 100644 index fefab16e64..0000000000 --- a/poky/meta/recipes-support/sqlite/sqlite3_3.39.4.bb +++ /dev/null @@ -1,14 +0,0 @@ -require sqlite3.inc - -LICENSE = "PD" -LIC_FILES_CHKSUM = "file://sqlite3.h;endline=11;md5=786d3dc581eff03f4fd9e4a77ed00c66" - -SRC_URI = "http://www.sqlite.org/2022/sqlite-autoconf-${SQLITE_PV}.tar.gz" -SRC_URI[sha256sum] = "f31d445b48e67e284cf206717cc170ab63cbe4fd7f79a82793b772285e78fdbb" - -# -19242 is only an issue in specific development branch commits -CVE_CHECK_IGNORE += "CVE-2019-19242" -# This is believed to be iOS specific (https://groups.google.com/g/sqlite-dev/c/U7OjAbZO6LA) -CVE_CHECK_IGNORE += "CVE-2015-3717" -# Issue in an experimental extension we don't have/use. Fixed by https://sqlite.org/src/info/b1e0c22ec981cf5f -CVE_CHECK_IGNORE += "CVE-2021-36690" diff --git a/poky/meta/recipes-support/sqlite/sqlite3_3.40.1.bb b/poky/meta/recipes-support/sqlite/sqlite3_3.40.1.bb new file mode 100644 index 0000000000..c9b6ca1c5f --- /dev/null +++ b/poky/meta/recipes-support/sqlite/sqlite3_3.40.1.bb @@ -0,0 +1,14 @@ +require sqlite3.inc + +LICENSE = "PD" +LIC_FILES_CHKSUM = "file://sqlite3.h;endline=11;md5=786d3dc581eff03f4fd9e4a77ed00c66" + +SRC_URI = "http://www.sqlite.org/2022/sqlite-autoconf-${SQLITE_PV}.tar.gz" +SRC_URI[sha256sum] = "2c5dea207fa508d765af1ef620b637dcb06572afa6f01f0815bd5bbf864b33d9" + +# -19242 is only an issue in specific development branch commits +CVE_CHECK_IGNORE += "CVE-2019-19242" +# This is believed to be iOS specific (https://groups.google.com/g/sqlite-dev/c/U7OjAbZO6LA) +CVE_CHECK_IGNORE += "CVE-2015-3717" +# Issue in an experimental extension we don't have/use. Fixed by https://sqlite.org/src/info/b1e0c22ec981cf5f +CVE_CHECK_IGNORE += "CVE-2021-36690" diff --git a/poky/meta/recipes-support/vim/vim.inc b/poky/meta/recipes-support/vim/vim.inc index 298a111853..d86841efaa 100644 --- a/poky/meta/recipes-support/vim/vim.inc +++ b/poky/meta/recipes-support/vim/vim.inc @@ -20,8 +20,8 @@ SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \ file://no-path-adjust.patch \ " -PV .= ".0820" -SRCREV = "03d6e6f42b0deeb02d52c8a48c14abe431370c1c" +PV .= ".0947" +SRCREV = "cc762a48d42b579fb7bdec2c614636b830342dd5" # Remove when 8.3 is out UPSTREAM_VERSION_UNKNOWN = "1" diff --git a/poky/meta/recipes-support/vte/vte/0001-Makefile.docs-correctly-substitute-gtkdoc-qemu-wrapp.patch b/poky/meta/recipes-support/vte/vte/0001-Makefile.docs-correctly-substitute-gtkdoc-qemu-wrapp.patch deleted file mode 100644 index c69a52e5d0..0000000000 --- a/poky/meta/recipes-support/vte/vte/0001-Makefile.docs-correctly-substitute-gtkdoc-qemu-wrapp.patch +++ /dev/null @@ -1,24 +0,0 @@ -From daa30d0039397a735d49ea535305ed0bc5f9d73b Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Tue, 26 Oct 2021 09:38:42 +0200 -Subject: [PATCH] Makefile.docs: correctly substitute gtkdoc qemu wrapper - -Upstream-Status: Inappropriate [oe-core specific] -Signed-off-by: Alexander Kanavin ---- - doc/reference/Makefile.docs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/doc/reference/Makefile.docs b/doc/reference/Makefile.docs -index b18f0a4..da18440 100644 ---- a/doc/reference/Makefile.docs -+++ b/doc/reference/Makefile.docs -@@ -233,7 +233,7 @@ INSTALL_DATA = $(INSTALL) -m 644 - - GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(CPPFLAGS) $(CFLAGS) - GTKDOC_LD = $(CC) $(GTKDOC_DEPS_LIBS) $(CFLAGS) $(LDFLAGS) --GTKDOC_RUN = -+GTKDOC_RUN = $(top_builddir)/gtkdoc-qemuwrapper - - GTKDOC_CHECK_PATH = gtkdoc-check - GTKDOC_REBASE = gtkdoc-rebase diff --git a/poky/meta/recipes-support/vte/vte_0.68.0.bb b/poky/meta/recipes-support/vte/vte_0.68.0.bb deleted file mode 100644 index fc4324872d..0000000000 --- a/poky/meta/recipes-support/vte/vte_0.68.0.bb +++ /dev/null @@ -1,62 +0,0 @@ -SUMMARY = "Virtual terminal emulator GTK+ widget library" -DESCRIPTION = "VTE provides a virtual terminal widget for GTK applications." -HOMEPAGE = "https://wiki.gnome.org/Apps/Terminal/VTE" -BUGTRACKER = "https://bugzilla.gnome.org/buglist.cgi?product=vte" -LICENSE = "GPL-3.0-only & LGPL-3.0-or-later & MIT" -LICENSE:libvte = "LGPL-3.0-or-later" - -LIC_FILES_CHKSUM = " \ - file://COPYING.GPL3;md5=cc702cf3444d1f19680c794cc61948f9 \ - file://COPYING.LGPL3;md5=b52f2d57d10c4f7ee67a7eb9615d5d24 \ - file://COPYING.XTERM;md5=d7fc3a23c16c039afafe2e042030f057 \ -" - -DEPENDS = "glib-2.0 gtk+3 libpcre2 libxml2-native gperf-native icu" - -GNOMEBASEBUILDCLASS = "meson" -GIR_MESON_OPTION = 'gir' - -inherit gnomebase gtk-doc features_check upstream-version-is-even gobject-introspection - -# vapigen.m4 is required when vala is not present (but the one from vala should be used normally) -SRC_URI += "file://0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch \ - file://0001-Makefile.docs-correctly-substitute-gtkdoc-qemu-wrapp.patch" -SRC_URI[archive.sha256sum] = "13e7d4789ca216a33780030d246c9b13ddbfd04094c6316eea7ff92284dd1749" - -ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" - -# Instead of "inherit vala" we do the relevant settings here so we can -# set DEPENDS based on PACKAGECONFIG. - -# Our patched version of Vala looks in STAGING_DATADIR for .vapi files -export STAGING_DATADIR -# Upstream Vala >= 0.11 looks in XDG_DATA_DIRS for .vapi files -export XDG_DATA_DIRS = "${STAGING_DATADIR}" - -# Help g-ir-scanner find the .so for linking -do_compile:prepend() { - export GIR_EXTRA_LIBS_PATH="${B}/src/.libs" -} - -# Package additional files -FILES:${PN}-dev += "${datadir}/vala/vapi/*" - -PACKAGECONFIG ??= "gnutls" -PACKAGECONFIG[vala] = "-Dvapi=true,-Dvapi=false,vala-native vala" -PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" -PACKAGECONFIG[systemd] = "-D_systemd=true,-D_systemd=false,systemd" -# vala requires gir -PACKAGECONFIG:remove:class-native = "vala" - -CFLAGS += "-D_GNU_SOURCE" - -PACKAGES =+ "libvte ${PN}-prompt" -FILES:libvte = "${libdir}/*.so.* ${libdir}/girepository-1.0/*" -FILES:${PN}-prompt = " \ - ${sysconfdir}/profile.d \ - ${libexecdir}/vte-urlencode-cwd \ -" - -FILES:${PN}-dev += "${datadir}/glade/" - -BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/recipes-support/vte/vte_0.70.2.bb b/poky/meta/recipes-support/vte/vte_0.70.2.bb new file mode 100644 index 0000000000..ec2fb1f522 --- /dev/null +++ b/poky/meta/recipes-support/vte/vte_0.70.2.bb @@ -0,0 +1,54 @@ +SUMMARY = "Virtual terminal emulator GTK+ widget library" +DESCRIPTION = "VTE provides a virtual terminal widget for GTK applications." +HOMEPAGE = "https://wiki.gnome.org/Apps/Terminal/VTE" +BUGTRACKER = "https://bugzilla.gnome.org/buglist.cgi?product=vte" +LICENSE = "GPL-3.0-only & LGPL-3.0-or-later & MIT" +LICENSE:libvte = "LGPL-3.0-or-later" + +LIC_FILES_CHKSUM = " \ + file://COPYING.GPL3;md5=cc702cf3444d1f19680c794cc61948f9 \ + file://COPYING.LGPL3;md5=b52f2d57d10c4f7ee67a7eb9615d5d24 \ + file://COPYING.XTERM;md5=d7fc3a23c16c039afafe2e042030f057 \ +" + +DEPENDS = "glib-2.0 gtk+3 libpcre2 libxml2-native gperf-native icu" + +GNOMEBASEBUILDCLASS = "meson" +GIR_MESON_OPTION = 'gir' +GIDOCGEN_MESON_OPTION = "docs" + +inherit gnomebase gi-docgen features_check upstream-version-is-even gobject-introspection + +# vapigen.m4 is required when vala is not present (but the one from vala should be used normally) +SRC_URI += "file://0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch" +SRC_URI[archive.sha256sum] = "4d15b4380de3f564d57eabd006389c407c705df5b0c70030fdcc24971a334d80" + +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" + +# Help g-ir-scanner find the .so for linking +do_compile:prepend() { + export GIR_EXTRA_LIBS_PATH="${B}/src/.libs" +} + +# Package additional files +FILES:${PN}-dev += "${datadir}/vala/vapi/*" + +PACKAGECONFIG ??= "gnutls" +PACKAGECONFIG[vala] = "-Dvapi=true,-Dvapi=false,vala-native vala" +PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" +PACKAGECONFIG[systemd] = "-D_systemd=true,-D_systemd=false,systemd" +# vala requires gir +PACKAGECONFIG:remove:class-native = "vala" + +CFLAGS += "-D_GNU_SOURCE" + +PACKAGES =+ "libvte ${PN}-prompt" +FILES:libvte = "${libdir}/*.so.* ${libdir}/girepository-1.0/*" +FILES:${PN}-prompt = " \ + ${sysconfdir}/profile.d \ + ${libexecdir}/vte-urlencode-cwd \ +" + +FILES:${PN}-dev += "${datadir}/glade/" + +BBCLASSEXTEND = "native nativesdk" diff --git a/poky/meta/site/common-musl b/poky/meta/site/common-musl index 86aed4a38c..23e50ef749 100644 --- a/poky/meta/site/common-musl +++ b/poky/meta/site/common-musl @@ -15,6 +15,8 @@ ac_cv_func_posix_getgrgid_r=${ac_cv_func_posix_getgrgid_r=yes} ac_cv_func_getaddrinfo=${ac_cv_func_getaddrinfo=yes} ac_cv_func_mmap_fixed_mapped=${ac_cv_func_mmap_fixed_mapped=yes} ac_cv_func_strtod=${ac_cv_func_strtod=yes} +# off_t is always 64bit on musl systems +ac_cv_sys_file_offset_bits=${ac_cv_sys_file_offset_bits=64} # glib glib_cv_strlcpy=${glib_cv_strlcpy=no} diff --git a/poky/meta/site/powerpc32-linux b/poky/meta/site/powerpc32-linux index 501e5b605d..764e97e4c3 100644 --- a/poky/meta/site/powerpc32-linux +++ b/poky/meta/site/powerpc32-linux @@ -195,7 +195,6 @@ liberty_cv_uint64=${liberty_cv_uint64=uint64_t} #samba ac_cv_func_memcmp_working=${ac_cv_func_memcmp_working=yes} -fu_cv_sys_stat_statvfs64=${fu_cv_sys_stat_statvfs64=yes} samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=${samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no} samba_cv_HAVE_BROKEN_GETGROUPS=${samba_cv_HAVE_BROKEN_GETGROUPS=no} samba_cv_HAVE_BROKEN_READDIR=${samba_cv_HAVE_BROKEN_READDIR=yes} diff --git a/poky/scripts/combo-layer b/poky/scripts/combo-layer index 045de65642..7f2020fca7 100755 --- a/poky/scripts/combo-layer +++ b/poky/scripts/combo-layer @@ -21,7 +21,6 @@ import re import copy import pipes import shutil -from collections import OrderedDict from string import Template from functools import reduce @@ -192,6 +191,23 @@ def runcmd(cmd,destdir=None,printerr=True,out=None,env=None): logger.debug("output: %s" % output.replace(chr(0), '\\0')) return output +def action_sync_revs(conf, args): + """ + Update the last_revision config option for each repo with the latest + revision in the remote's branch. Useful if multiple people are using + combo-layer. + """ + repos = get_repos(conf, args[1:]) + + for name in repos: + repo = conf.repos[name] + ldir = repo['local_repo_dir'] + branch = repo.get('branch', "master") + runcmd("git fetch", ldir) + lastrev = runcmd('git rev-parse origin/%s' % branch, ldir).strip() + print("Updating %s to %s" % (name, lastrev)) + conf.update(name, "last_revision", lastrev) + def action_init(conf, args): """ Clone component repositories @@ -508,7 +524,7 @@ def check_patch(patchfile): f.close() if of: of.close() - bb.utils.rename(patchfile + '.tmp', patchfile) + os.rename(of.name, patchfile) def drop_to_shell(workdir=None): if not sys.stdin.isatty(): @@ -1302,6 +1318,7 @@ actions = { "update": action_update, "pull": action_pull, "splitpatch": action_splitpatch, + "sync-revs": action_sync_revs, } def main(): @@ -1312,10 +1329,11 @@ def main(): Create and update a combination layer repository from multiple component repositories. Action: - init initialise the combo layer repo - update [components] get patches from component repos and apply them to the combo repo - pull [components] just pull component repos only - splitpatch [commit] generate commit patch and split per component, default commit is HEAD""") + init initialise the combo layer repo + update [components] get patches from component repos and apply them to the combo repo + pull [components] just pull component repos only + sync-revs [components] update the config file's last_revision for each repository + splitpatch [commit] generate commit patch and split per component, default commit is HEAD""") parser.add_option("-c", "--conf", help = "specify the config file (conf/combo-layer.conf is the default).", action = "store", dest = "conffile", default = "conf/combo-layer.conf") diff --git a/poky/scripts/devtool b/poky/scripts/devtool index 20d785c7f7..3aae7b93b4 100755 --- a/poky/scripts/devtool +++ b/poky/scripts/devtool @@ -137,17 +137,27 @@ def create_workspace(args, config, basepath, workspace): workspacedir = os.path.abspath(args.layerpath) else: workspacedir = os.path.abspath(os.path.join(basepath, 'workspace')) - _create_workspace(workspacedir, config, basepath) + layerseries = None + if args.layerseries: + layerseries = args.layerseries + _create_workspace(workspacedir, config, basepath, layerseries) if not args.create_only: _enable_workspace_layer(workspacedir, config, basepath) -def _create_workspace(workspacedir, config, basepath): +def _create_workspace(workspacedir, config, basepath, layerseries=None): import bb confdir = os.path.join(workspacedir, 'conf') if os.path.exists(os.path.join(confdir, 'layer.conf')): logger.info('Specified workspace already set up, leaving as-is') else: + if not layerseries: + tinfoil = setup_tinfoil(config_only=True, basepath=basepath) + try: + layerseries = tinfoil.config_data.getVar('LAYERSERIES_CORENAMES') + finally: + tinfoil.shutdown() + # Add a config file bb.utils.mkdirhier(confdir) with open(os.path.join(confdir, 'layer.conf'), 'w') as f: @@ -159,7 +169,7 @@ def _create_workspace(workspacedir, config, basepath): f.write('BBFILE_PATTERN_workspacelayer = "^$' + '{LAYERDIR}/"\n') f.write('BBFILE_PATTERN_IGNORE_EMPTY_workspacelayer = "1"\n') f.write('BBFILE_PRIORITY_workspacelayer = "99"\n') - f.write('LAYERSERIES_COMPAT_workspacelayer = "${LAYERSERIES_COMPAT_core}"\n') + f.write('LAYERSERIES_COMPAT_workspacelayer = "%s"\n' % layerseries) # Add a README file with open(os.path.join(workspacedir, 'README'), 'w') as f: f.write('This layer was created by the OpenEmbedded devtool utility in order to\n') @@ -309,6 +319,7 @@ def main(): description='Sets up a new workspace. NOTE: other devtool subcommands will create a workspace automatically as needed, so you only need to use %(prog)s if you want to specify where the workspace should be located.', group='advanced') parser_create_workspace.add_argument('layerpath', nargs='?', help='Path in which the workspace layer should be created') + parser_create_workspace.add_argument('--layerseries', help='Layer series the workspace should be set to be compatible with') parser_create_workspace.add_argument('--create-only', action="store_true", help='Only create the workspace layer, do not alter configuration') parser_create_workspace.set_defaults(func=create_workspace, no_workspace=True) diff --git a/poky/scripts/lib/buildstats.py b/poky/scripts/lib/buildstats.py index c69b5bf4d7..3b76286ba5 100644 --- a/poky/scripts/lib/buildstats.py +++ b/poky/scripts/lib/buildstats.py @@ -8,7 +8,7 @@ import json import logging import os import re -from collections import namedtuple,OrderedDict +from collections import namedtuple from statistics import mean @@ -238,7 +238,7 @@ class BuildStats(dict): subdirs = os.listdir(path) for dirname in subdirs: recipe_dir = os.path.join(path, dirname) - if not os.path.isdir(recipe_dir): + if dirname == "reduced_proc_pressure" or not os.path.isdir(recipe_dir): continue name, epoch, version, revision = cls.split_nevr(dirname) bsrecipe = BSRecipe(name, epoch, version, revision) diff --git a/poky/scripts/lib/checklayer/__init__.py b/poky/scripts/lib/checklayer/__init__.py index aa946f3036..0a0db2f02a 100644 --- a/poky/scripts/lib/checklayer/__init__.py +++ b/poky/scripts/lib/checklayer/__init__.py @@ -16,6 +16,7 @@ class LayerType(Enum): BSP = 0 DISTRO = 1 SOFTWARE = 2 + CORE = 3 ERROR_NO_LAYER_CONF = 98 ERROR_BSP_DISTRO = 99 @@ -43,7 +44,7 @@ def _get_layer_collections(layer_path, lconf=None, data=None): ldata.setVar('LAYERDIR', layer_path) try: - ldata = bb.parse.handle(lconf, ldata, include=True) + ldata = bb.parse.handle(lconf, ldata, include=True, baseconfig=True) except: raise RuntimeError("Parsing of layer.conf from layer: %s failed" % layer_path) ldata.expandVarref('LAYERDIR') @@ -106,7 +107,13 @@ def _detect_layer(layer_path): if distros: is_distro = True - if is_bsp and is_distro: + layer['collections'] = _get_layer_collections(layer['path']) + + if layer_name == "meta" and "core" in layer['collections']: + layer['type'] = LayerType.CORE + layer['conf']['machines'] = machines + layer['conf']['distros'] = distros + elif is_bsp and is_distro: layer['type'] = LayerType.ERROR_BSP_DISTRO elif is_bsp: layer['type'] = LayerType.BSP @@ -117,8 +124,6 @@ def _detect_layer(layer_path): else: layer['type'] = LayerType.SOFTWARE - layer['collections'] = _get_layer_collections(layer['path']) - return layer def detect_layers(layer_directories, no_auto): diff --git a/poky/scripts/lib/checklayer/cases/bsp.py b/poky/scripts/lib/checklayer/cases/bsp.py index a80a5844da..b76163fb56 100644 --- a/poky/scripts/lib/checklayer/cases/bsp.py +++ b/poky/scripts/lib/checklayer/cases/bsp.py @@ -11,7 +11,7 @@ from checklayer.case import OECheckLayerTestCase class BSPCheckLayer(OECheckLayerTestCase): @classmethod def setUpClass(self): - if self.tc.layer['type'] != LayerType.BSP: + if self.tc.layer['type'] not in (LayerType.BSP, LayerType.CORE): raise unittest.SkipTest("BSPCheckLayer: Layer %s isn't BSP one." %\ self.tc.layer['name']) diff --git a/poky/scripts/lib/checklayer/cases/common.py b/poky/scripts/lib/checklayer/cases/common.py index 491a13953c..722d3cf638 100644 --- a/poky/scripts/lib/checklayer/cases/common.py +++ b/poky/scripts/lib/checklayer/cases/common.py @@ -12,6 +12,9 @@ from checklayer.case import OECheckLayerTestCase class CommonCheckLayer(OECheckLayerTestCase): def test_readme(self): + if self.tc.layer['type'] == LayerType.CORE: + raise unittest.SkipTest("Core layer's README is top level") + # The top-level README file may have a suffix (like README.rst or README.txt). readme_files = glob.glob(os.path.join(self.tc.layer['path'], '[Rr][Ee][Aa][Dd][Mm][Ee]*')) self.assertTrue(len(readme_files) > 0, diff --git a/poky/scripts/lib/checklayer/cases/distro.py b/poky/scripts/lib/checklayer/cases/distro.py index f0bee5493c..a35332451c 100644 --- a/poky/scripts/lib/checklayer/cases/distro.py +++ b/poky/scripts/lib/checklayer/cases/distro.py @@ -11,7 +11,7 @@ from checklayer.case import OECheckLayerTestCase class DistroCheckLayer(OECheckLayerTestCase): @classmethod def setUpClass(self): - if self.tc.layer['type'] != LayerType.DISTRO: + if self.tc.layer['type'] not in (LayerType.DISTRO, LayerType.CORE): raise unittest.SkipTest("DistroCheckLayer: Layer %s isn't Distro one." %\ self.tc.layer['name']) diff --git a/poky/scripts/lib/devtool/standard.py b/poky/scripts/lib/devtool/standard.py index e3b74ab8f0..d64e18e179 100644 --- a/poky/scripts/lib/devtool/standard.py +++ b/poky/scripts/lib/devtool/standard.py @@ -765,6 +765,16 @@ def get_staging_kbranch(srcdir): staging_kbranch = "".join(branch.split('\n')[0]) return staging_kbranch +def get_real_srctree(srctree, s, workdir): + # Check that recipe isn't using a shared workdir + s = os.path.abspath(s) + workdir = os.path.abspath(workdir) + if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: + # Handle if S is set to a subdirectory of the source + srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] + srctree = os.path.join(srctree, srcsubdir) + return srctree + def modify(args, config, basepath, workspace): """Entry point for the devtool 'modify' subcommand""" import bb @@ -923,14 +933,7 @@ def modify(args, config, basepath, workspace): # Need to grab this here in case the source is within a subdirectory srctreebase = srctree - - # Check that recipe isn't using a shared workdir - s = os.path.abspath(rd.getVar('S')) - workdir = os.path.abspath(rd.getVar('WORKDIR')) - if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: - # Handle if S is set to a subdirectory of the source - srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] - srctree = os.path.join(srctree, srcsubdir) + srctree = get_real_srctree(srctree, rd.getVar('S'), rd.getVar('WORKDIR')) bb.utils.mkdirhier(os.path.dirname(appendfile)) with open(appendfile, 'w') as f: @@ -1406,6 +1409,18 @@ def _export_local_files(srctree, rd, destdir, srctreebase): updated = OrderedDict() added = OrderedDict() removed = OrderedDict() + + # Get current branch and return early with empty lists + # if on one of the override branches + # (local files are provided only for the main branch and processing + # them against lists from recipe overrides will result in mismatches + # and broken modifications to recipes). + stdout, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', + cwd=srctree) + branchname = stdout.rstrip() + if branchname.startswith(override_branch_prefix): + return (updated, added, removed) + local_files_dir = os.path.join(srctreebase, 'oe-local-files') git_files = _git_ls_tree(srctree) if 'oe-local-files' in git_files: @@ -1635,31 +1650,25 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil tempdir = tempfile.mkdtemp(prefix='devtool') try: local_files_dir = tempfile.mkdtemp(dir=tempdir) - if filter_patches: - upd_f = {} - new_f = {} - del_f = {} - else: - upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) - - remove_files = [] - if not no_remove: - # Get all patches from source tree and check if any should be removed - all_patches_dir = tempfile.mkdtemp(dir=tempdir) - _, _, del_p = _export_patches(srctree, rd, initial_rev, - all_patches_dir) - # Remove deleted local files and patches - remove_files = list(del_f.values()) + list(del_p.values()) + upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) # Get updated patches from source tree patches_dir = tempfile.mkdtemp(dir=tempdir) upd_p, new_p, _ = _export_patches(srctree, rd, update_rev, patches_dir, changed_revs) + # Get all patches from source tree and check if any should be removed + all_patches_dir = tempfile.mkdtemp(dir=tempdir) + _, _, del_p = _export_patches(srctree, rd, initial_rev, + all_patches_dir) logger.debug('Pre-filtering: update: %s, new: %s' % (dict(upd_p), dict(new_p))) if filter_patches: new_p = OrderedDict() upd_p = OrderedDict((k,v) for k,v in upd_p.items() if k in filter_patches) - remove_files = [f for f in remove_files if f in filter_patches] + del_p = OrderedDict((k,v) for k,v in del_p.items() if k in filter_patches) + remove_files = [] + if not no_remove: + # Remove deleted local files and patches + remove_files = list(del_f.values()) + list(del_p.values()) updatefiles = False updaterecipe = False destpath = None diff --git a/poky/scripts/lib/devtool/upgrade.py b/poky/scripts/lib/devtool/upgrade.py index 39a1910a49..967d157077 100644 --- a/poky/scripts/lib/devtool/upgrade.py +++ b/poky/scripts/lib/devtool/upgrade.py @@ -88,7 +88,7 @@ def _rename_recipe_files(oldrecipe, bpn, oldpv, newpv, path): _rename_recipe_dirs(oldpv, newpv, path) return _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path) -def _write_append(rc, srctree, same_dir, no_same_dir, rev, copied, workspace, d): +def _write_append(rc, srctreebase, srctree, same_dir, no_same_dir, rev, copied, workspace, d): """Writes an append file""" if not os.path.exists(rc): raise DevtoolError("bbappend not created because %s does not exist" % rc) @@ -104,6 +104,11 @@ def _write_append(rc, srctree, same_dir, no_same_dir, rev, copied, workspace, d) af = os.path.join(appendpath, '%s.bbappend' % brf) with open(af, 'w') as f: f.write('FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"\n\n') + # Local files can be modified/tracked in separate subdir under srctree + # Mostly useful for packages with S != WORKDIR + f.write('FILESPATH:prepend := "%s:"\n' % + os.path.join(srctreebase, 'oe-local-files')) + f.write('# srctreebase: %s\n' % srctreebase) f.write('inherit externalsrc\n') f.write(('# NOTE: We use pn- overrides here to avoid affecting' 'multiple variants in the case where the recipe uses BBCLASSEXTEND\n')) @@ -524,14 +529,7 @@ def upgrade(args, config, basepath, workspace): else: srctree = standard.get_default_srctree(config, pn) - # Check that recipe isn't using a shared workdir - s = os.path.abspath(rd.getVar('S')) - workdir = os.path.abspath(rd.getVar('WORKDIR')) - srctree_s = srctree - if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: - # Handle if S is set to a subdirectory of the source - srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] - srctree_s = os.path.join(srctree, srcsubdir) + srctree_s = standard.get_real_srctree(srctree, rd.getVar('S'), rd.getVar('WORKDIR')) # try to automatically discover latest version and revision if not provided on command line if not args.version and not args.srcrev: @@ -575,7 +573,7 @@ def upgrade(args, config, basepath, workspace): _upgrade_error(e, recipedir, srctree, args.keep_failure) standard._add_md5(config, pn, os.path.dirname(rf)) - af = _write_append(rf, srctree_s, args.same_dir, args.no_same_dir, rev2, + af = _write_append(rf, srctree, srctree_s, args.same_dir, args.no_same_dir, rev2, copied, config.workspace_path, rd) standard._add_md5(config, pn, af) diff --git a/poky/scripts/runqemu b/poky/scripts/runqemu index a6ea578564..ccc557f308 100755 --- a/poky/scripts/runqemu +++ b/poky/scripts/runqemu @@ -999,7 +999,7 @@ class BaseConfig(object): if self.slirp_enabled: self.nfs_server = '10.0.2.2' else: - self.nfs_server = '192.168.7.1' + self.nfs_server = '192.168.7.@GATEWAY@' # Figure out a new nfs_instance to allow multiple qemus running. ps = subprocess.check_output(("ps", "auxww")).decode('utf-8') @@ -1058,6 +1058,13 @@ class BaseConfig(object): self.nfs_running = True + def setup_cmd(self): + cmd = self.get('QB_SETUP_CMD') + if cmd != '': + logger.info('Running setup command %s' % str(cmd)) + if subprocess.call(cmd, shell=True) != 0: + raise RunQemuError('Failed to run %s' % cmd) + def setup_net_bridge(self): self.set('NETWORK_CMD', '-netdev bridge,br=%s,id=net0,helper=%s -device virtio-net-pci,netdev=net0 ' % ( self.net_bridge, os.path.join(self.bindir_native, 'qemu-oe-bridge-helper'))) @@ -1071,7 +1078,7 @@ class BaseConfig(object): logger.info("Network configuration:%s", netconf) self.kernel_cmdline_script += netconf # Port mapping - hostfwd = ",hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23" + hostfwd = ",hostfwd=tcp:127.0.0.1:2222-:22,hostfwd=tcp:127.0.0.1:2323-:23" qb_slirp_opt_default = "-netdev user,id=net0%s,tftp=%s" % (hostfwd, self.get('DEPLOY_DIR_IMAGE')) qb_slirp_opt = self.get('QB_SLIRP_OPT') or qb_slirp_opt_default # Figure out the port @@ -1187,6 +1194,7 @@ class BaseConfig(object): netconf = " " + self.cmdline_ip_tap netconf = netconf.replace('@CLIENT@', str(client)) netconf = netconf.replace('@GATEWAY@', str(gateway)) + self.nfs_server = self.nfs_server.replace('@GATEWAY@', str(gateway)) logger.info("Network configuration:%s", netconf) self.kernel_cmdline_script += netconf mac = "%s%02x" % (self.mac_tap, client) @@ -1525,6 +1533,13 @@ class BaseConfig(object): else: logger.error("Failed to run qemu: %s", process.stderr.read().decode()) + def cleanup_cmd(self): + cmd = self.get('QB_CLEANUP_CMD') + if cmd != '': + logger.info('Running cleanup command %s' % str(cmd)) + if subprocess.call(cmd, shell=True) != 0: + raise RunQemuError('Failed to run %s' % cmd) + def cleanup(self): if self.cleaned: return @@ -1653,6 +1668,7 @@ def main(): config.setup_network() config.setup_rootfs() config.setup_final() + config.setup_cmd() config.start_qemu() except RunQemuError as err: logger.error(err) @@ -1662,6 +1678,7 @@ def main(): traceback.print_exc() return 1 finally: + config.cleanup_cmd() config.cleanup() # Deliberately ignore the return code of 'tput smam'. subprocess.call(["tput", "smam"]) diff --git a/poky/scripts/runqemu-export-rootfs b/poky/scripts/runqemu-export-rootfs index 384c091713..6a8acd0d5a 100755 --- a/poky/scripts/runqemu-export-rootfs +++ b/poky/scripts/runqemu-export-rootfs @@ -34,16 +34,12 @@ if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then echo "Did you forget to source your build environment setup script?" exit 1 fi -. $SYSROOT_SETUP_SCRIPT meta-ide-support +. $SYSROOT_SETUP_SCRIPT qemu-helper-native if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/unfsd" ]; then echo "Error: Unable to find unfsd binary in $OECORE_NATIVE_SYSROOT/usr/bin/" - if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then - echo "Have you run 'bitbake meta-ide-support'?" - else - echo "This shouldn't happen - something is missing from your toolchain installation" - fi + echo "This shouldn't happen - something is missing from your toolchain installation" exit 1 fi @@ -74,26 +70,11 @@ MOUNTD_PORT=${MOUNTD_PORT:=$[ 3048 + 2 * $NFS_INSTANCE ]} ## For debugging you would additionally add ## --debug all -UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -n $NFSD_PORT -m $MOUNTD_PORT" +UNFSD_OPTS="-p -i $NFSPID -e $EXPORTS -n $NFSD_PORT -m $MOUNTD_PORT" # See how we were called. case "$1" in start) - PORTMAP_RUNNING=`ps -ef | grep portmap | grep -v grep` - RPCBIND_RUNNING=`ps -ef | grep rpcbind | grep -v grep` - if [[ "x$PORTMAP_RUNNING" = "x" && "x$RPCBIND_RUNNING" = "x" ]]; then - echo "=======================================================" - echo "Error: neither rpcbind nor portmap appear to be running" - echo "Please install and start one of these services first" - echo "=======================================================" - echo "Tip: for recent Ubuntu hosts, run:" - echo " sudo apt-get install rpcbind" - echo "Then add OPTIONS=\"-i -w\" to /etc/default/rpcbind and run" - echo " sudo service portmap restart" - - exit 1 - fi - echo "Creating exports file..." echo "$NFS_EXPORT_DIR (rw,no_root_squash,no_all_squash,insecure)" > $EXPORTS diff --git a/poky/scripts/runqemu-extract-sdk b/poky/scripts/runqemu-extract-sdk index 9bc0c07fb8..db05da25f2 100755 --- a/poky/scripts/runqemu-extract-sdk +++ b/poky/scripts/runqemu-extract-sdk @@ -25,7 +25,7 @@ if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then echo "Did you forget to source your build system environment setup script?" exit 1 fi -. $SYSROOT_SETUP_SCRIPT meta-ide-support +. $SYSROOT_SETUP_SCRIPT qemu-helper-native PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr" ROOTFS_TARBALL=$1 diff --git a/poky/scripts/yocto-check-layer b/poky/scripts/yocto-check-layer index 0e5b75b1f7..67cc71950f 100755 --- a/poky/scripts/yocto-check-layer +++ b/poky/scripts/yocto-check-layer @@ -168,14 +168,13 @@ def main(): layers_tested = 0 for layer in layers: - if layer['type'] == LayerType.ERROR_NO_LAYER_CONF or \ - layer['type'] == LayerType.ERROR_BSP_DISTRO: + if layer['type'] in (LayerType.ERROR_NO_LAYER_CONF, LayerType.ERROR_BSP_DISTRO): continue # Reset to a clean backup copy for each run shutil.copyfile(bblayersconf + '.backup', bblayersconf) - if check_bblayers(bblayersconf, layer['path'], logger): + if layer['type'] not in (LayerType.CORE, ) and check_bblayers(bblayersconf, layer['path'], logger): logger.info("%s already in %s. To capture initial signatures, layer under test should not present " "in BBLAYERS. Please remove %s from BBLAYERS." % (layer['name'], bblayersconf, layer['name'])) results[layer['name']] = None -- cgit v1.2.3