From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 2C4684CD8D for ; Sun, 30 Nov 2025 15:44:23 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'J4UNFFLynpE2YRr8puoIBokR+PV+11+lvdbR44x8HHk=', expected b'd+/NcOgAwQjnpkIGfPnfRvUkwpOmDVk1vswpwRGxPMc=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1764517456; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=J4UNFFLynpE2YRr8puoIBokR+PV+11+lvdbR44x8HHk=; b=n+k8empHYtQAHuKstel0XbENQB8Uy21+t/u5WLqxMCQXOz4Bj75mkPdXC7GTznHeGZX+N 96oLrG3WkCT3KJ3P4sw1IfTz1I+pFSqX1sUT3jsUuagv1Zs9Tt9TFYE7PUzZ7DPHzWujJsR YG38uN/4JWeVfycZdqkP9tuNYtmPkA7UB/DidaoDKBd1CFIMtWBF3gdO0Lx9D7/YTIzieYn MEzdOVBvmOTKezzO3ykwOlNqwxNvsJCLtBhNVDFGacRI9xImbFt9u3hHdJRMHB6XA6a3UmM HnH7Qg8D2F5JWMceInaPLyq07tIzQ61x+KLhkbBPkR+52o74frl+WLnH8rRw== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 719C36902F0; Sun, 30 Nov 2025 17:44:16 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1764517445; b=WG1dAEzyhrMpf0OPNLMm35vJAe96aHZN0bIZMjVEJwxWRLgFToXXI6n0rN2VNqDofOaxe DQ8bOgz4A2qBRJBKhW8V4qgOOUiTQWcpZmTIqIscCQdJ40f0TpK/D1F85KV/fbqxUA3iX2F tAOd9CALqFrBF+FHu1dpOumH7LlJGA2Brv0po4iG44SG/5bgFmuEWe6g/7Q5s9u6+/aj4fn 19NLpy/WTUDY4z2DIKtbTG7SA0ykBtVovC2Q43dvvjCNHKDFpnB+NH0Ch3OEjITYcFnxaZN LHpdyx1PmheKehs/1ehmIOQ+k8i0Z9MK7s8vCA2rY+T62n+0dlx+ngcpF04Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1764517445; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=4j72cKJx+rz2mI1Y+usQACpDdq8XLxXKP1aAt4W9ols=; b=MYDYWScuSj5f0Co2uv16mTO5Pdr4gSfEOncp2fmj3nQ0Q4Cc5eEpXiJ80D0B2A4LRQh79 RsPcRGt7nuqBtsLDY5txNpHfGs0jU3RpwyWcWA/uzt6lrZzzMgwePMHdxP+j0rPlwnJFH4e L+i1XxSLzr2OCGw391DM16zBFt3BWs+DWV1XcXi2WPjNaaomhyRCb/PqC2nR7ugIMrBufqL HWI7nDBJN/OO0ogHjdMlboIGUYZec1/fOQjM97Ays1nDIf06xOsYBMH0+uHdZj3Pbgsmjt3 CARqWt8T3n6isDzcgESJIqdAnJlVJYVX6g9SRopyz7CGg++mofBg0uA9M4eA== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1764517437; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=d+/NcOgAwQjnpkIGfPnfRvUkwpOmDVk1vswpwRGxPMc=; b=aPuet7Wj38R6UzJSFXZgilFXu5A1NJ/GTuh/xd8m4vt+xyOEMgyiz/NR0St9F2I7IvEdC 9e9CbY8ismczVTwboc6sXSR5B+JUbB0TrZWR6ECIBGX7YrQjzxduWPDoS+cHssj0tusqvWd +n8fNa7dBsoVN8BuFn7syggyb8KmnCLXY5xbsiC7G8WSrS5vuZSrMCVXbSZeScfyiDj/KlL tvFJ+wA47OwBEfnHhAAt1Z5+cS++nGRdk3oEOh7KDWIhvxhbh/AESmvAg+gOkUw/1fORSwb 8//zdgqVgDv+mrh+yRkh/5sOKb3jqXGm1sSkqIlxxJXY5TBPhqMxztTvqM7A== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id E26A169027B for ; Sun, 30 Nov 2025 17:43:56 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Sun, 30 Nov 2025 15:43:56 -0000 Message-ID: <176451743711.39.13224691705168851449@2cb04c0e5124> Message-ID-Hash: 4UIMQ6NZ72OH65TAYBRUGVNLKQNK7AYD X-Message-ID-Hash: 4UIMQ6NZ72OH65TAYBRUGVNLKQNK7AYD X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] forgejo: backport CI changes to release/8.0 (PR #21066) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Timo Rothenpieler via ffmpeg-devel Cc: Timo Rothenpieler Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21066 opened by Timo Rothenpieler (BtbN) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21066 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21066.patch >>From 92c8e0c201b06ef17ca19b08e2383514577f4d1a Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler Date: Sun, 30 Nov 2025 16:42:51 +0100 Subject: [PATCH] forgejo: backport CI changes to release/8.0 --- .forgejo/pre-commit/config.yaml | 8 ++ .forgejo/workflows/test.yml | 25 +++- tools/check_arm_indent.sh | 55 ++++++++ tools/indent_arm_assembly.pl | 243 ++++++++++++++++++++++++++++++++ 4 files changed, 327 insertions(+), 4 deletions(-) create mode 100755 tools/check_arm_indent.sh create mode 100755 tools/indent_arm_assembly.pl diff --git a/.forgejo/pre-commit/config.yaml b/.forgejo/pre-commit/config.yaml index 9a7041543f..f1ab7765ef 100644 --- a/.forgejo/pre-commit/config.yaml +++ b/.forgejo/pre-commit/config.yaml @@ -18,6 +18,14 @@ repos: - id: fix-byte-order-marker - id: mixed-line-ending - id: trailing-whitespace +- repo: local + hooks: + - id: aarch64-asm-indent + name: fix aarch64 assembly indentation + files: ^.*/aarch64/.*\.S$ + language: script + entry: ./tools/check_arm_indent.sh --apply + pass_filenames: false - repo: https://github.com/codespell-project/codespell rev: v2.4.1 hooks: diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 56e844ff4b..799d2c356a 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -9,13 +9,28 @@ jobs: strategy: fail-fast: false matrix: - runner: [linux-amd64,linux-aarch64] + runner: [linux-aarch64] + shared: ['static'] + bits: ['64'] + include: + - runner: linux-amd64 + shared: 'static' + bits: '32' + - runner: linux-amd64 + shared: 'shared' + bits: '64' runs-on: ${{ matrix.runner }} steps: - name: Checkout uses: actions/checkout@v4 - name: Configure - run: ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 + run: | + ./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \ + $([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \ + $([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \ + || CFGRES=$? && CFGRES=$? + cat ffbuild/config.log + exit $CFGRES - name: Build run: make -j$(nproc) - name: Restore Cached Fate-Suite @@ -30,7 +45,7 @@ jobs: id: fate run: | make fate-rsync SAMPLES=$PWD/fate-suite - echo "hash=$(find fate-suite -type f | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT + echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT - name: Cache Fate-Suite uses: actions/cache/save@v4 if: ${{ format('fate-suite-{0}', steps.fate.outputs.hash) != steps.cache.outputs.cache-matched-key }} @@ -38,7 +53,7 @@ jobs: path: fate-suite key: fate-suite-${{ steps.fate.outputs.hash }} - name: Run Fate - run: make fate SAMPLES=$PWD/fate-suite -j$(nproc) + run: LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES=$PWD/fate-suite -j$(nproc) compile_only: strategy: fail-fast: false @@ -57,3 +72,5 @@ jobs: --extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS" - name: Build run: make -j$(nproc) + - name: Run Fate + run: make -j$(nproc) fate-build diff --git a/tools/check_arm_indent.sh b/tools/check_arm_indent.sh new file mode 100755 index 0000000000..5becfe0aec --- /dev/null +++ b/tools/check_arm_indent.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# +# Copyright (c) 2025 Martin Storsjo +# All rights reserved. +# +# 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. +# +# 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. + + +cd $(dirname $0)/.. + +if [ "$1" = "--apply" ]; then + apply=1 +fi + +ret=0 + +for i in */aarch64/*.S */aarch64/*/*.S; do + case $i in + libavcodec/aarch64/h264idct_neon.S|libavcodec/aarch64/h26x/epel_neon.S|libavcodec/aarch64/h26x/qpel_neon.S|libavcodec/aarch64/vc1dsp_neon.S) + # Skip files with known (and tolerated) deviations from the tool. + continue + esac + ./tools/indent_arm_assembly.pl < "$i" > tmp.S || ret=$? + if ! git diff --quiet --no-index "$i" tmp.S; then + if [ -n "$apply" ]; then + mv tmp.S "$i" + else + git --no-pager diff --no-index "$i" tmp.S + fi + ret=1 + fi +done + +rm -f tmp.S + +exit $ret diff --git a/tools/indent_arm_assembly.pl b/tools/indent_arm_assembly.pl new file mode 100755 index 0000000000..359c2bcf4f --- /dev/null +++ b/tools/indent_arm_assembly.pl @@ -0,0 +1,243 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2025 Martin Storsjo +# All rights reserved. +# +# 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. +# +# 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. + + +# A script for reformatting ARM/AArch64 assembly according to the following +# style: +# - Instructions start after 8 columns, operands start after 24 columns +# - Vector register layouts and modifiers like "uxtw" are written in lowercase +# - Optionally align operand columns vertically according to their +# maximum width (accommodating for e.g. x0 vs x10, or v0.8b vs v16.16b). +# +# The script can be executed as "indent_arm_assembly.pl file [outfile]". +# If no outfile is specified, the given file is overwritten in place. +# +# Alternatively, the if no file parameters are given, the script reads input +# code on stdin, and outputs the reformatted code on stdout. + +use strict; + +my $indent_operands = 0; +my $instr_indent = 8; +my $operand_indent = 24; +my $match_indent = 0; +my $file; +my $outfile; + +while (@ARGV) { + my $opt = shift; + + if ($opt eq "-operands") { + $indent_operands = 1; + } elsif ($opt eq "-indent") { + $instr_indent = shift; + } elsif ($opt eq "-operand-indent") { + $operand_indent = shift; + } elsif ($opt eq "-match-indent") { + $match_indent = 1; + } else { + if (!$file) { + $file = $opt; + } elsif (!$outfile) { + $outfile = $opt; + } else { + die "Unrecognized parameter $opt\n"; + } + } +} + +if ($operand_indent < $instr_indent) { + die "Can't indent operands to $operand_indent while indenting " . + "instructions to $instr_indent\n"; +} + +# Return a string consisting of n spaces +sub spaces { + my $n = $_[0]; + return " " x $n; +} + +sub indentcolumns { + my $input = $_[0]; + my $chars = $_[1]; + my @operands = split(/,/, $input); + my $num = @operands; + my $ret = ""; + for (my $i = 0; $i < $num; $i++) { + my $cur = $operands[$i]; + # Trim out leading/trailing whitespace + $cur =~ s/^\s+|\s+$//g; + $ret .= $cur; + if ($i + 1 < $num) { + # If we have a following operand, add a comma and whitespace to + # align the next operand. + my $next = $operands[$i+1]; + my $len = length($cur); + if ($len > $chars) { + # If this operand was too wide for the intended column width, + # don't try to realign the line at all, just return the input + # untouched. + return $input; + } + my $pad = $chars - $len; + if ($next =~ /[su]xt[bhw]|[la]s[lr]/) { + # If the next item isn't a regular operand, but a modifier, + # don't try to align that. E.g. "add x0, x0, w1, uxtw #1". + $pad = 0; + } + $ret .= "," . spaces(1 + $pad); + } + } + return $ret; +} + +# Realign the operands part of an instruction line, making each operand +# take up the maximum width for that kind of operand. +sub columns { + my $rest = $_[0]; + if ($rest !~ /,/) { + # No commas, no operands to split and align + return $rest; + } + if ($rest =~ /{|[^\w]\[/) { + # Check for instructions that use register ranges, like {v0.8b,v1.8b} + # or mem address operands, like "ldr x0, [sp]" - we skip trying to + # realign these. + return $rest; + } + if ($rest =~ /v[0-9]+\.[0-9]+[bhsd]/) { + # If we have references to aarch64 style vector registers, like + # v0.8b, then align all operands to the maximum width of such + # operands - v16.16b. + # + # TODO: Ideally, we'd handle mixed operand types individually. + return indentcolumns($rest, 7); + } + # Indent operands according to the maximum width of regular registers, + # like x10. + return indentcolumns($rest, 3); +} + +my $in; +my $out; +my $tempfile; + +if ($file) { + open(INPUT, "$file") or die "Unable to open $file: $!"; + $in = *INPUT; + if ($outfile) { + open(OUTPUT, ">$outfile") or die "Unable to open $outfile: $!"; + } else { + $tempfile = "$file.tmp"; + open(OUTPUT, ">$tempfile") or die "Unable to open $tempfile: $!"; + } + $out = *OUTPUT; +} else { + $in = *STDIN; + $out = *STDOUT; +} + +while (<$in>) { + # Trim off trailing whitespace. + chomp; + if (/^([\.\w\d]+:)?(\s+)([\w\\][\w\\\.]*)(?:(\s+)(.*)|$)/) { + my $label = $1; + my $indent = $2; + my $instr = $3; + my $origspace = $4; + my $rest = $5; + + my $orig_operand_indent = length($label) + length($indent) + + length($instr) + length($origspace); + + if ($indent_operands) { + $rest = columns($rest); + } + + my $size = $instr_indent; + if ($match_indent) { + # Try to check the current attempted indent size and normalize + # to it; match existing ident sizes of 4, 8, 10 and 12 columns. + my $cur_indent = length($label) + length($indent); + if ($cur_indent >= 3 && $cur_indent <= 5) { + $size = 4; + } elsif ($cur_indent >= 7 && $cur_indent <= 9) { + $size = 8; + } elsif ($cur_indent == 10 || $cur_indent == 12) { + $size = $cur_indent; + } + } + if (length($label) >= $size) { + # Not enough space for the label; just add a space between the label + # and the instruction. + $indent = " "; + } else { + $indent = spaces($size - length($label)); + } + + my $instr_end = length($label) + length($indent) + length($instr); + $size = $operand_indent - $instr_end; + if ($match_indent) { + # Check how the operands currently seem to be indented. + my $cur_indent = $orig_operand_indent; + if ($cur_indent >= 11 && $cur_indent <= 13) { + $size = 12; + } elsif ($cur_indent >= 14 && $cur_indent <= 17) { + $size = 16; + } elsif ($cur_indent >= 18 && $cur_indent <= 22) { + $size = 20; + } elsif ($cur_indent >= 23 && $cur_indent <= 27) { + $size = 24; + } + $size -= $instr_end; + } + my $operand_space = " "; + if ($size > 0) { + $operand_space = spaces($size); + } + + # Lowercase the aarch64 vector layout description, .8B -> .8b + $rest =~ s/(\.[84216]*[BHSD])/lc($1)/ge; + # Lowercase modifiers like "uxtw" or "lsl" + $rest =~ s/([SU]XT[BWH]|[LA]S[LR])/lc($1)/ge; + + # Reassemble the line + if ($rest eq "") { + $_ = $label . $indent . $instr; + } else { + $_ = $label . $indent . $instr . $operand_space . $rest; + } + } + print $out $_ . "\n"; +} + +if ($file) { + close(INPUT); + close(OUTPUT); +} +if ($tempfile) { + rename($tempfile, $file); +} -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org