From de096e96aeaf7fb3bfd6e5e8551514d32b316a76 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Mon, 17 Jun 2024 23:49:51 -0400 Subject: [PATCH 1/6] portable: link in rkmpp and rkrga on arm64 --- .../rkmpp/0000-fix-vpx-collisions.patch | 154 ++++++++++++++++++ builder/scripts.d/60-rkmpp.sh | 45 +++++ builder/scripts.d/60-rkrga.sh | 43 +++++ ...ipeline-for-rockchip-rk3588-platform.patch | 4 +- 4 files changed, 244 insertions(+), 2 deletions(-) create mode 100644 builder/patches/rkmpp/0000-fix-vpx-collisions.patch create mode 100644 builder/scripts.d/60-rkmpp.sh create mode 100755 builder/scripts.d/60-rkrga.sh diff --git a/builder/patches/rkmpp/0000-fix-vpx-collisions.patch b/builder/patches/rkmpp/0000-fix-vpx-collisions.patch new file mode 100644 index 00000000000..5c362a05989 --- /dev/null +++ b/builder/patches/rkmpp/0000-fix-vpx-collisions.patch @@ -0,0 +1,154 @@ +From 154a74b0a75eaecd5022cef3cb520ee949b578d9 Mon Sep 17 00:00:00 2001 +From: Brett Jia +Date: Wed, 19 Jun 2024 11:44:23 -0400 +Subject: [PATCH] namespace vars that conflict with vpx + +--- + mpp/hal/rkdec/vp9d/hal_vp9d_com.c | 30 +++++++++++++++--------------- + mpp/hal/rkdec/vp9d/hal_vp9d_com.h | 6 +++--- + 2 files changed, 18 insertions(+), 18 deletions(-) + +diff --git a/mpp/hal/rkdec/vp9d/hal_vp9d_com.c b/mpp/hal/rkdec/vp9d/hal_vp9d_com.c +index c1913893..898970a8 100644 +--- a/mpp/hal/rkdec/vp9d/hal_vp9d_com.c ++++ b/mpp/hal/rkdec/vp9d/hal_vp9d_com.c +@@ -838,7 +838,7 @@ static const RK_U8 vp9_default_coef_probs[4][2][2][6][6][3] = { + } + }; + +-const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = { ++const vp9_prob mpp_vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = { + { + // above = dc + { 137, 30, 42, 148, 151, 207, 70, 52, 91 }, // left = dc +@@ -953,7 +953,7 @@ const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = { + } + }; + +-const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1] = { ++const vp9_prob mpp_vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1] = { + { 144, 11, 54, 157, 195, 130, 46, 58, 108 }, // y = dc + { 118, 15, 123, 148, 131, 101, 44, 93, 131 }, // y = v + { 113, 12, 23, 188, 226, 142, 26, 32, 125 }, // y = h +@@ -966,7 +966,7 @@ const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1] = { + { 102, 19, 66, 162, 182, 122, 35, 59, 128 } // y = tm + }; + +-const vp9_prob vp9_kf_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1] = { ++const vp9_prob mpp_vp9_kf_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1] = { + // 8x8 -> 4x4 + { 158, 97, 94 }, // a/l both not split + { 93, 24, 99 }, // a split, l not split +@@ -1013,8 +1013,8 @@ MPP_RET hal_vp9d_output_probe(void *buf, void *dxva) + memset(buf, 0, 304 * 8); + + if (intraFlag) { +- memcpy(partition_probs, vp9_kf_partition_probs, sizeof(partition_probs)); +- memcpy(uv_mode_prob, vp9_kf_uv_mode_prob, sizeof(uv_mode_prob)); ++ memcpy(partition_probs, mpp_vp9_kf_partition_probs, sizeof(partition_probs)); ++ memcpy(uv_mode_prob, mpp_vp9_kf_uv_mode_prob, sizeof(uv_mode_prob)); + } else { + memcpy(partition_probs, pic_param->prob.partition, sizeof(partition_probs)); + memcpy(uv_mode_prob, pic_param->prob.uv_mode, sizeof(uv_mode_prob)); +@@ -1073,11 +1073,11 @@ MPP_RET hal_vp9d_output_probe(void *buf, void *dxva) + } + + //intra mode prob 80 x 128 bit +- for (i = 0; i < INTRA_MODES; i++) { //vp9_kf_y_mode_prob ++ for (i = 0; i < INTRA_MODES; i++) { //mpp_vp9_kf_y_mode_prob + RK_S32 byte_count = 0; + for (j = 0; j < INTRA_MODES; j++) + for (k = 0; k < INTRA_MODES - 1; k++) { +- mpp_put_bits(&bp, vp9_kf_y_mode_prob[i][j][k], 8); ++ mpp_put_bits(&bp, mpp_vp9_kf_y_mode_prob[i][j][k], 8); + byte_count++; + if (byte_count == 27) { + byte_count = 0; +@@ -1087,7 +1087,7 @@ MPP_RET hal_vp9d_output_probe(void *buf, void *dxva) + } + if (i < 4) { + for (m = 0; m < (i < 3 ? 23 : 21); m++) +- mpp_put_bits(&bp, ((vp9_prob *)(&vp9_kf_uv_mode_prob[0][0]))[i * 23 + m], 8); ++ mpp_put_bits(&bp, ((vp9_prob *)(&mpp_vp9_kf_uv_mode_prob[0][0]))[i * 23 + m], 8); + for (; m < 23; m++) + mpp_put_bits(&bp, 0, 8); + } else { +@@ -1462,7 +1462,7 @@ MPP_RET hal_vp9d_prob_flag_delta(void *buf, void *dxva) + memset(buf, 0, PROB_SIZE); + + if (intraFlag) { +- memcpy(partition_probs, vp9_kf_partition_probs, sizeof(partition_probs)); ++ memcpy(partition_probs, mpp_vp9_kf_partition_probs, sizeof(partition_probs)); + } else { + memcpy(partition_flag, prob_flag->partition, sizeof(partition_flag)); + memcpy(partition_delta, prob_delta->partition, sizeof(partition_delta)); +@@ -1575,11 +1575,11 @@ MPP_RET hal_vp9d_prob_flag_delta(void *buf, void *dxva) + } + + //intra mode prob 80 x 128 bit +- for (i = 0; i < INTRA_MODES; i++) { //vp9_kf_y_mode_prob ++ for (i = 0; i < INTRA_MODES; i++) { //mpp_vp9_kf_y_mode_prob + RK_S32 byte_count = 0; + for (j = 0; j < INTRA_MODES; j++) + for (k = 0; k < INTRA_MODES - 1; k++) { +- mpp_put_bits(&bp, vp9_kf_y_mode_prob[i][j][k], 8); ++ mpp_put_bits(&bp, mpp_vp9_kf_y_mode_prob[i][j][k], 8); + byte_count++; + if (byte_count == 27) { + byte_count = 0; +@@ -1589,7 +1589,7 @@ MPP_RET hal_vp9d_prob_flag_delta(void *buf, void *dxva) + } + if (i < 4) { + for (m = 0; m < (i < 3 ? 23 : 21); m++) +- mpp_put_bits(&bp, ((vp9_prob *)(&vp9_kf_uv_mode_prob[0][0]))[i * 23 + m], 8); ++ mpp_put_bits(&bp, ((vp9_prob *)(&mpp_vp9_kf_uv_mode_prob[0][0]))[i * 23 + m], 8); + for (; m < 23; m++) + mpp_put_bits(&bp, 0, 8); + } else { +@@ -1936,7 +1936,7 @@ MPP_RET hal_vp9d_prob_kf(void *buf) + + for (i = 0; i < 16; i++)//kf_partition_prob + for (j = 0; j < 3; j++) +- mpp_put_bits(&bp, vp9_kf_partition_probs[i][j], 8); ++ mpp_put_bits(&bp, mpp_vp9_kf_partition_probs[i][j], 8); + + //intra mode prob 80 x 128 bit, 10x 8x 128bit + for (i = 0; i < 10; i++) { +@@ -1944,7 +1944,7 @@ MPP_RET hal_vp9d_prob_kf(void *buf) + RK_U8 val = 0; + for (j = 0; j < 10; j++) + for (k = 0; k < 9; k++) { +- mpp_put_bits(&bp, vp9_kf_y_mode_prob[i][j][k], 8); ++ mpp_put_bits(&bp, mpp_vp9_kf_y_mode_prob[i][j][k], 8); + byte_count++; + if (byte_count == 27) { + byte_count = 0; +@@ -1954,7 +1954,7 @@ MPP_RET hal_vp9d_prob_kf(void *buf) + // 6x128 bit, 23x4 bytes + if (i < 4) { + for (m = 0; m < (i < 3 ? 23 : 21); m++) { +- val = ((RK_U8 *)(&vp9_kf_uv_mode_prob[0][0]))[i * 23 + m]; ++ val = ((RK_U8 *)(&mpp_vp9_kf_uv_mode_prob[0][0]))[i * 23 + m]; + mpp_put_bits(&bp, val, 8); + } + for (; m < 23; m++) +diff --git a/mpp/hal/rkdec/vp9d/hal_vp9d_com.h b/mpp/hal/rkdec/vp9d/hal_vp9d_com.h +index 8dee8e56..3c41a935 100644 +--- a/mpp/hal/rkdec/vp9d/hal_vp9d_com.h ++++ b/mpp/hal/rkdec/vp9d/hal_vp9d_com.h +@@ -77,9 +77,9 @@ do{\ + }} while (0) + + +-extern const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1]; +-extern const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1]; +-extern const vp9_prob vp9_kf_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; ++extern const vp9_prob mpp_vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1]; ++extern const vp9_prob mpp_vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1]; ++extern const vp9_prob mpp_vp9_kf_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; + + #ifdef __cplusplus + extern "C" { +-- +2.34.1 + diff --git a/builder/scripts.d/60-rkmpp.sh b/builder/scripts.d/60-rkmpp.sh new file mode 100644 index 00000000000..bbb3dc234e4 --- /dev/null +++ b/builder/scripts.d/60-rkmpp.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +SCRIPT_REPO="https://github.com/nyanmisaka/mpp.git" +SCRIPT_COMMIT="2218dc0fc57062c0d33d06d350aea73d9fef5d57" + +ffbuild_enabled() { + [[ $TARGET == linux* ]] && [[ $TARGET == *arm64 ]] && return 0 + return -1 +} + +ffbuild_dockerstage() { + to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/rkmpp,dst=/patches run_stage /stage.sh" +} + +ffbuild_dockerbuild() { + git clone "$SCRIPT_REPO" mpp + cd mpp + git checkout "$SCRIPT_COMMIT" + + for patch in /patches/*.patch; do + echo "Applying $patch" + patch -p1 < "$patch" + done + + mkdir rkmpp_build + cd rkmpp_build + cmake \ + -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=OFF \ + .. + + make -j$(nproc) + make install + + echo "Libs.private: -lstdc++" >> "$FFBUILD_PREFIX"/lib/pkgconfig/rockchip_mpp.pc +} + +ffbuild_configure() { + echo --enable-rkmpp +} + +ffbuild_unconfigure() { + echo --disable-rkmpp +} diff --git a/builder/scripts.d/60-rkrga.sh b/builder/scripts.d/60-rkrga.sh new file mode 100755 index 00000000000..3af4d5e98d6 --- /dev/null +++ b/builder/scripts.d/60-rkrga.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +SCRIPT_REPO="https://github.com/bjia56/rk-mirrors.git" +SCRIPT_COMMIT="jellyfin-rga-1" +#"a9fc19e6b906d7cecd6bcefbd45e5e151831d33f" + +ffbuild_enabled() { + [[ $TARGET == linux* ]] && [[ $TARGET == *arm64 ]] && return 0 + return -1 +} + +ffbuild_dockerstage() { + to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/rkmpp,dst=/patches run_stage /stage.sh" +} + +ffbuild_dockerbuild() { + git clone "$SCRIPT_REPO" rkrga + cd rkrga + git checkout "$SCRIPT_COMMIT" + cd .. + + meson setup rkrga rkrga_build \ + --cross-file=/cross.meson \ + --prefix=${FFBUILD_PREFIX} \ + --buildtype=release \ + --default-library=static \ + -Dcpp_args=-fpermissive \ + -Dlibdrm=false \ + -Dlibrga_demo=false + + meson configure rkrga_build + ninja -C rkrga_build install + + echo "Libs.private: -lstdc++" >> "$FFBUILD_PREFIX"/lib/pkgconfig/librga.pc +} + +ffbuild_configure() { + echo --enable-rkrga +} + +ffbuild_unconfigure() { + echo --disable-rkrga +} \ No newline at end of file diff --git a/debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch b/debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch index 23701e00ff8..767f7469c03 100644 --- a/debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch +++ b/debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch @@ -140,8 +140,8 @@ Index: jellyfin-ffmpeg/configure { enabled libdrm || die "ERROR: rkmpp requires --enable-libdrm"; } } -+enabled rkrga && require rkrga rga/RgaApi.h c_RkRgaBlit -lrga && -+ { require rkrga rga/im2d.h querystring -lrga && ++enabled rkrga && require_pkg_config rkrga librga rga/RgaApi.h c_RkRgaBlit&& ++ { require_pkg_config rkrga librga rga/im2d.h querystring && + { enabled rkmpp || + die "ERROR: rkrga requires --enable-rkmpp"; } + } From 293227e5d22790531f9091ecc9d2e8dd1b6559b2 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 20 Jun 2024 18:54:56 -0400 Subject: [PATCH 2/6] add patch for rkrga --- builder/patches/rkrga/0000-build-static.patch | 27 +++++++++++++++++++ builder/scripts.d/60-rkrga.sh | 13 ++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 builder/patches/rkrga/0000-build-static.patch diff --git a/builder/patches/rkrga/0000-build-static.patch b/builder/patches/rkrga/0000-build-static.patch new file mode 100644 index 00000000000..611a5e35d96 --- /dev/null +++ b/builder/patches/rkrga/0000-build-static.patch @@ -0,0 +1,27 @@ +From 2a8381af76eab5bec53b74ca72f7855576ba780d Mon Sep 17 00:00:00 2001 +From: Brett Jia +Date: Wed, 19 Jun 2024 21:52:59 -0400 +Subject: [PATCH] switch meson to build static lib + +--- + meson.build | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index be2c2e9bb249..6f774754d628 100644 +--- a/meson.build ++++ b/meson.build +@@ -30,12 +30,11 @@ librga_srcs = [ + + incdir = include_directories('include', 'im2d_api', 'core/hardware', 'core/utils', 'core/3rdparty/libdrm/include/drm') + +-librga = shared_library( ++librga = static_library( + 'rga', + librga_srcs, + dependencies : [libthreads_dep], + include_directories : incdir, +- version : meson.project_version(), + cpp_args : ['-w'], + install : true, + ) \ No newline at end of file diff --git a/builder/scripts.d/60-rkrga.sh b/builder/scripts.d/60-rkrga.sh index 3af4d5e98d6..81ddd46e8c9 100755 --- a/builder/scripts.d/60-rkrga.sh +++ b/builder/scripts.d/60-rkrga.sh @@ -1,8 +1,7 @@ #!/bin/bash -SCRIPT_REPO="https://github.com/bjia56/rk-mirrors.git" -SCRIPT_COMMIT="jellyfin-rga-1" -#"a9fc19e6b906d7cecd6bcefbd45e5e151831d33f" +SCRIPT_REPO="https://github.com/nyanmisaka/rk-mirrors.git" +SCRIPT_COMMIT="a9fc19e6b906d7cecd6bcefbd45e5e151831d33f" ffbuild_enabled() { [[ $TARGET == linux* ]] && [[ $TARGET == *arm64 ]] && return 0 @@ -10,13 +9,19 @@ ffbuild_enabled() { } ffbuild_dockerstage() { - to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/rkmpp,dst=/patches run_stage /stage.sh" + to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/rkrga,dst=/patches run_stage /stage.sh" } ffbuild_dockerbuild() { git clone "$SCRIPT_REPO" rkrga cd rkrga git checkout "$SCRIPT_COMMIT" + + for patch in /patches/*.patch; do + echo "Applying $patch" + patch -p1 < "$patch" + done + cd .. meson setup rkrga rkrga_build \ From 2706c3934c9a88027ef6adf8778b8ab3728df84c Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Fri, 21 Jun 2024 09:49:24 -0400 Subject: [PATCH 3/6] Update debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch Co-authored-by: Nyanmisaka --- ...058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch b/debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch index 767f7469c03..43782ca70c6 100644 --- a/debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch +++ b/debian/patches/0058-add-full-hwa-pipeline-for-rockchip-rk3588-platform.patch @@ -140,7 +140,7 @@ Index: jellyfin-ffmpeg/configure { enabled libdrm || die "ERROR: rkmpp requires --enable-libdrm"; } } -+enabled rkrga && require_pkg_config rkrga librga rga/RgaApi.h c_RkRgaBlit&& ++enabled rkrga && require_pkg_config rkrga librga rga/RgaApi.h c_RkRgaBlit && + { require_pkg_config rkrga librga rga/im2d.h querystring && + { enabled rkmpp || + die "ERROR: rkrga requires --enable-rkmpp"; } From bd2d922e4191dd1a250a98aa02c196691f715437 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Fri, 21 Jun 2024 09:49:48 -0400 Subject: [PATCH 4/6] update rkmpp/rkrga per comments --- builder/patches/rkrga/0000-build-static.patch | 27 ---------- builder/scripts.d/60-rkmpp.sh | 22 ++++----- builder/scripts.d/60-rkrga.sh | 49 ++++++++++--------- 3 files changed, 37 insertions(+), 61 deletions(-) delete mode 100644 builder/patches/rkrga/0000-build-static.patch diff --git a/builder/patches/rkrga/0000-build-static.patch b/builder/patches/rkrga/0000-build-static.patch deleted file mode 100644 index 611a5e35d96..00000000000 --- a/builder/patches/rkrga/0000-build-static.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 2a8381af76eab5bec53b74ca72f7855576ba780d Mon Sep 17 00:00:00 2001 -From: Brett Jia -Date: Wed, 19 Jun 2024 21:52:59 -0400 -Subject: [PATCH] switch meson to build static lib - ---- - meson.build | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/meson.build b/meson.build -index be2c2e9bb249..6f774754d628 100644 ---- a/meson.build -+++ b/meson.build -@@ -30,12 +30,11 @@ librga_srcs = [ - - incdir = include_directories('include', 'im2d_api', 'core/hardware', 'core/utils', 'core/3rdparty/libdrm/include/drm') - --librga = shared_library( -+librga = static_library( - 'rga', - librga_srcs, - dependencies : [libthreads_dep], - include_directories : incdir, -- version : meson.project_version(), - cpp_args : ['-w'], - install : true, - ) \ No newline at end of file diff --git a/builder/scripts.d/60-rkmpp.sh b/builder/scripts.d/60-rkmpp.sh index bbb3dc234e4..da27793a259 100644 --- a/builder/scripts.d/60-rkmpp.sh +++ b/builder/scripts.d/60-rkmpp.sh @@ -13,25 +13,25 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$SCRIPT_REPO" mpp - cd mpp - git checkout "$SCRIPT_COMMIT" + git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" rkmpp + cd rkmpp for patch in /patches/*.patch; do echo "Applying $patch" patch -p1 < "$patch" done - mkdir rkmpp_build - cd rkmpp_build - cmake \ - -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \ + mkdir rkmpp_build && cd rkmpp_build + + cmake -GNinja \ + -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" \ -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=OFF \ - .. + -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \ + -DBUILD_TEST=OFF \ + -DBUILD_SHARED_LIBS=OFF .. - make -j$(nproc) - make install + ninja -j$(nproc) + ninja install echo "Libs.private: -lstdc++" >> "$FFBUILD_PREFIX"/lib/pkgconfig/rockchip_mpp.pc } diff --git a/builder/scripts.d/60-rkrga.sh b/builder/scripts.d/60-rkrga.sh index 81ddd46e8c9..6ad8af59552 100755 --- a/builder/scripts.d/60-rkrga.sh +++ b/builder/scripts.d/60-rkrga.sh @@ -8,33 +8,36 @@ ffbuild_enabled() { return -1 } -ffbuild_dockerstage() { - to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/rkrga,dst=/patches run_stage /stage.sh" -} - ffbuild_dockerbuild() { - git clone "$SCRIPT_REPO" rkrga + git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" rkrga cd rkrga - git checkout "$SCRIPT_COMMIT" - - for patch in /patches/*.patch; do - echo "Applying $patch" - patch -p1 < "$patch" - done - - cd .. - - meson setup rkrga rkrga_build \ - --cross-file=/cross.meson \ - --prefix=${FFBUILD_PREFIX} \ - --buildtype=release \ - --default-library=static \ - -Dcpp_args=-fpermissive \ - -Dlibdrm=false \ + + sed -i 's/shared_library/library/g' meson.build + + mkdir rkrga_build && cd rkrga_build + + local myconf=( + --prefix="$FFBUILD_PREFIX" + --buildtype=release + --default-library=static + -Dcpp_args=-fpermissive + -Dlibdrm=false -Dlibrga_demo=false + ) + + if [[ $TARGET == linux* ]]; then + myconf+=( + --cross-file=/cross.meson + ) + else + echo "Unknown target" + return -1 + fi + + meson "${myconf[@]}" .. - meson configure rkrga_build - ninja -C rkrga_build install + ninja -j$(nproc) + ninja install echo "Libs.private: -lstdc++" >> "$FFBUILD_PREFIX"/lib/pkgconfig/librga.pc } From f4eb628e6feae90e793c538b09fe2377ed3c569f Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Fri, 21 Jun 2024 09:51:03 -0400 Subject: [PATCH 5/6] move to 50- --- builder/scripts.d/{60-rkmpp.sh => 50-rkmpp.sh} | 0 builder/scripts.d/{60-rkrga.sh => 50-rkrga.sh} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename builder/scripts.d/{60-rkmpp.sh => 50-rkmpp.sh} (100%) rename builder/scripts.d/{60-rkrga.sh => 50-rkrga.sh} (100%) mode change 100755 => 100644 diff --git a/builder/scripts.d/60-rkmpp.sh b/builder/scripts.d/50-rkmpp.sh similarity index 100% rename from builder/scripts.d/60-rkmpp.sh rename to builder/scripts.d/50-rkmpp.sh diff --git a/builder/scripts.d/60-rkrga.sh b/builder/scripts.d/50-rkrga.sh old mode 100755 new mode 100644 similarity index 100% rename from builder/scripts.d/60-rkrga.sh rename to builder/scripts.d/50-rkrga.sh From 1f2b02a32f6f2ead72390688f42df8421a20617d Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Wed, 24 Jul 2024 20:12:13 +0800 Subject: [PATCH 6/6] Drop the rkmpp patch Signed-off-by: nyanmisaka --- .../rkmpp/0000-fix-vpx-collisions.patch | 154 ------------------ builder/scripts.d/50-rkmpp.sh | 11 +- 2 files changed, 1 insertion(+), 164 deletions(-) delete mode 100644 builder/patches/rkmpp/0000-fix-vpx-collisions.patch diff --git a/builder/patches/rkmpp/0000-fix-vpx-collisions.patch b/builder/patches/rkmpp/0000-fix-vpx-collisions.patch deleted file mode 100644 index 5c362a05989..00000000000 --- a/builder/patches/rkmpp/0000-fix-vpx-collisions.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 154a74b0a75eaecd5022cef3cb520ee949b578d9 Mon Sep 17 00:00:00 2001 -From: Brett Jia -Date: Wed, 19 Jun 2024 11:44:23 -0400 -Subject: [PATCH] namespace vars that conflict with vpx - ---- - mpp/hal/rkdec/vp9d/hal_vp9d_com.c | 30 +++++++++++++++--------------- - mpp/hal/rkdec/vp9d/hal_vp9d_com.h | 6 +++--- - 2 files changed, 18 insertions(+), 18 deletions(-) - -diff --git a/mpp/hal/rkdec/vp9d/hal_vp9d_com.c b/mpp/hal/rkdec/vp9d/hal_vp9d_com.c -index c1913893..898970a8 100644 ---- a/mpp/hal/rkdec/vp9d/hal_vp9d_com.c -+++ b/mpp/hal/rkdec/vp9d/hal_vp9d_com.c -@@ -838,7 +838,7 @@ static const RK_U8 vp9_default_coef_probs[4][2][2][6][6][3] = { - } - }; - --const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = { -+const vp9_prob mpp_vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = { - { - // above = dc - { 137, 30, 42, 148, 151, 207, 70, 52, 91 }, // left = dc -@@ -953,7 +953,7 @@ const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1] = { - } - }; - --const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1] = { -+const vp9_prob mpp_vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1] = { - { 144, 11, 54, 157, 195, 130, 46, 58, 108 }, // y = dc - { 118, 15, 123, 148, 131, 101, 44, 93, 131 }, // y = v - { 113, 12, 23, 188, 226, 142, 26, 32, 125 }, // y = h -@@ -966,7 +966,7 @@ const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1] = { - { 102, 19, 66, 162, 182, 122, 35, 59, 128 } // y = tm - }; - --const vp9_prob vp9_kf_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1] = { -+const vp9_prob mpp_vp9_kf_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1] = { - // 8x8 -> 4x4 - { 158, 97, 94 }, // a/l both not split - { 93, 24, 99 }, // a split, l not split -@@ -1013,8 +1013,8 @@ MPP_RET hal_vp9d_output_probe(void *buf, void *dxva) - memset(buf, 0, 304 * 8); - - if (intraFlag) { -- memcpy(partition_probs, vp9_kf_partition_probs, sizeof(partition_probs)); -- memcpy(uv_mode_prob, vp9_kf_uv_mode_prob, sizeof(uv_mode_prob)); -+ memcpy(partition_probs, mpp_vp9_kf_partition_probs, sizeof(partition_probs)); -+ memcpy(uv_mode_prob, mpp_vp9_kf_uv_mode_prob, sizeof(uv_mode_prob)); - } else { - memcpy(partition_probs, pic_param->prob.partition, sizeof(partition_probs)); - memcpy(uv_mode_prob, pic_param->prob.uv_mode, sizeof(uv_mode_prob)); -@@ -1073,11 +1073,11 @@ MPP_RET hal_vp9d_output_probe(void *buf, void *dxva) - } - - //intra mode prob 80 x 128 bit -- for (i = 0; i < INTRA_MODES; i++) { //vp9_kf_y_mode_prob -+ for (i = 0; i < INTRA_MODES; i++) { //mpp_vp9_kf_y_mode_prob - RK_S32 byte_count = 0; - for (j = 0; j < INTRA_MODES; j++) - for (k = 0; k < INTRA_MODES - 1; k++) { -- mpp_put_bits(&bp, vp9_kf_y_mode_prob[i][j][k], 8); -+ mpp_put_bits(&bp, mpp_vp9_kf_y_mode_prob[i][j][k], 8); - byte_count++; - if (byte_count == 27) { - byte_count = 0; -@@ -1087,7 +1087,7 @@ MPP_RET hal_vp9d_output_probe(void *buf, void *dxva) - } - if (i < 4) { - for (m = 0; m < (i < 3 ? 23 : 21); m++) -- mpp_put_bits(&bp, ((vp9_prob *)(&vp9_kf_uv_mode_prob[0][0]))[i * 23 + m], 8); -+ mpp_put_bits(&bp, ((vp9_prob *)(&mpp_vp9_kf_uv_mode_prob[0][0]))[i * 23 + m], 8); - for (; m < 23; m++) - mpp_put_bits(&bp, 0, 8); - } else { -@@ -1462,7 +1462,7 @@ MPP_RET hal_vp9d_prob_flag_delta(void *buf, void *dxva) - memset(buf, 0, PROB_SIZE); - - if (intraFlag) { -- memcpy(partition_probs, vp9_kf_partition_probs, sizeof(partition_probs)); -+ memcpy(partition_probs, mpp_vp9_kf_partition_probs, sizeof(partition_probs)); - } else { - memcpy(partition_flag, prob_flag->partition, sizeof(partition_flag)); - memcpy(partition_delta, prob_delta->partition, sizeof(partition_delta)); -@@ -1575,11 +1575,11 @@ MPP_RET hal_vp9d_prob_flag_delta(void *buf, void *dxva) - } - - //intra mode prob 80 x 128 bit -- for (i = 0; i < INTRA_MODES; i++) { //vp9_kf_y_mode_prob -+ for (i = 0; i < INTRA_MODES; i++) { //mpp_vp9_kf_y_mode_prob - RK_S32 byte_count = 0; - for (j = 0; j < INTRA_MODES; j++) - for (k = 0; k < INTRA_MODES - 1; k++) { -- mpp_put_bits(&bp, vp9_kf_y_mode_prob[i][j][k], 8); -+ mpp_put_bits(&bp, mpp_vp9_kf_y_mode_prob[i][j][k], 8); - byte_count++; - if (byte_count == 27) { - byte_count = 0; -@@ -1589,7 +1589,7 @@ MPP_RET hal_vp9d_prob_flag_delta(void *buf, void *dxva) - } - if (i < 4) { - for (m = 0; m < (i < 3 ? 23 : 21); m++) -- mpp_put_bits(&bp, ((vp9_prob *)(&vp9_kf_uv_mode_prob[0][0]))[i * 23 + m], 8); -+ mpp_put_bits(&bp, ((vp9_prob *)(&mpp_vp9_kf_uv_mode_prob[0][0]))[i * 23 + m], 8); - for (; m < 23; m++) - mpp_put_bits(&bp, 0, 8); - } else { -@@ -1936,7 +1936,7 @@ MPP_RET hal_vp9d_prob_kf(void *buf) - - for (i = 0; i < 16; i++)//kf_partition_prob - for (j = 0; j < 3; j++) -- mpp_put_bits(&bp, vp9_kf_partition_probs[i][j], 8); -+ mpp_put_bits(&bp, mpp_vp9_kf_partition_probs[i][j], 8); - - //intra mode prob 80 x 128 bit, 10x 8x 128bit - for (i = 0; i < 10; i++) { -@@ -1944,7 +1944,7 @@ MPP_RET hal_vp9d_prob_kf(void *buf) - RK_U8 val = 0; - for (j = 0; j < 10; j++) - for (k = 0; k < 9; k++) { -- mpp_put_bits(&bp, vp9_kf_y_mode_prob[i][j][k], 8); -+ mpp_put_bits(&bp, mpp_vp9_kf_y_mode_prob[i][j][k], 8); - byte_count++; - if (byte_count == 27) { - byte_count = 0; -@@ -1954,7 +1954,7 @@ MPP_RET hal_vp9d_prob_kf(void *buf) - // 6x128 bit, 23x4 bytes - if (i < 4) { - for (m = 0; m < (i < 3 ? 23 : 21); m++) { -- val = ((RK_U8 *)(&vp9_kf_uv_mode_prob[0][0]))[i * 23 + m]; -+ val = ((RK_U8 *)(&mpp_vp9_kf_uv_mode_prob[0][0]))[i * 23 + m]; - mpp_put_bits(&bp, val, 8); - } - for (; m < 23; m++) -diff --git a/mpp/hal/rkdec/vp9d/hal_vp9d_com.h b/mpp/hal/rkdec/vp9d/hal_vp9d_com.h -index 8dee8e56..3c41a935 100644 ---- a/mpp/hal/rkdec/vp9d/hal_vp9d_com.h -+++ b/mpp/hal/rkdec/vp9d/hal_vp9d_com.h -@@ -77,9 +77,9 @@ do{\ - }} while (0) - - --extern const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1]; --extern const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1]; --extern const vp9_prob vp9_kf_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; -+extern const vp9_prob mpp_vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES][INTRA_MODES - 1]; -+extern const vp9_prob mpp_vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1]; -+extern const vp9_prob mpp_vp9_kf_partition_probs[PARTITION_CONTEXTS][PARTITION_TYPES - 1]; - - #ifdef __cplusplus - extern "C" { --- -2.34.1 - diff --git a/builder/scripts.d/50-rkmpp.sh b/builder/scripts.d/50-rkmpp.sh index da27793a259..c53aed24da1 100644 --- a/builder/scripts.d/50-rkmpp.sh +++ b/builder/scripts.d/50-rkmpp.sh @@ -1,26 +1,17 @@ #!/bin/bash SCRIPT_REPO="https://github.com/nyanmisaka/mpp.git" -SCRIPT_COMMIT="2218dc0fc57062c0d33d06d350aea73d9fef5d57" +SCRIPT_COMMIT="66af270e1e54432d0767cf929a5c4aee2b456d8c" ffbuild_enabled() { [[ $TARGET == linux* ]] && [[ $TARGET == *arm64 ]] && return 0 return -1 } -ffbuild_dockerstage() { - to_df "RUN --mount=src=${SELF},dst=/stage.sh --mount=src=patches/rkmpp,dst=/patches run_stage /stage.sh" -} - ffbuild_dockerbuild() { git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" rkmpp cd rkmpp - for patch in /patches/*.patch; do - echo "Applying $patch" - patch -p1 < "$patch" - done - mkdir rkmpp_build && cd rkmpp_build cmake -GNinja \