Skip to content

Commit fcefbb9

Browse files
authored
Fix: Build patched MediaSDK with MTL enabled (#1078)
[FIX] Build patched MediaSDK with MTL enabled: - correct build script in ecosystem subpath - add scripts/common.sh for common functionalities is bash - remove proxy settings specific to one vendor - minor other fixes/adjustments --------- Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com>
1 parent 013e2c6 commit fcefbb9

File tree

10 files changed

+622
-94
lines changed

10 files changed

+622
-94
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ mtl_system_status_*
8686
doc/_build
8787

8888
# Gpu direct files
89+
ecosystem/msdk/_install
8990
gpu_direct/tests/fff.h
9091
gpu_direct/subprojects/*
9192
!gpu_direct/subprojects/gtest.wrap

app/sample/redundant_sample_test.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,30 @@
55

66
set -e
77

8-
TEST_TIME_SEC=15
8+
SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")"
9+
REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../..")"
910

10-
TEST_BIN_PATH=../../build/app
11+
# shellcheck source="script/common.sh"
12+
. "${REPOSITORY_DIR}/script/common.sh"
13+
14+
print_logo_anim
15+
TEST_TIME_SEC="${TEST_TIME_SEC:-15}"
16+
TEST_BIN_PATH="${REPOSITORY_DIR}/build/app"
1117
LOG_LEVEL=notice
1218

1319
name=RxSt20RedundantSample
1420

15-
${TEST_BIN_PATH}/TxSt20PipelineSample >/dev/null --log_level ${LOG_LEVEL} --p_port 0000:af:01.2 --r_port 0000:af:01.3 --p_sip 192.168.77.2 --r_sip 192.168.77.3 --p_tx_ip 239.168.77.20 --r_tx_ip 239.168.77.21 2>&1 &
21+
"${TEST_BIN_PATH}/TxSt20PipelineSample" >/dev/null --log_level "${LOG_LEVEL}" --p_port 0000:af:01.2 --r_port 0000:af:01.3 --p_sip 192.168.77.2 --r_sip 192.168.77.3 --p_tx_ip 239.168.77.20 --r_tx_ip 239.168.77.21 2>&1 &
1622
pid_tx=$!
17-
${TEST_BIN_PATH}/RxSt20RedundantSample --log_level ${LOG_LEVEL} --p_port 0000:af:01.0 --r_port 0000:af:01.1 --p_sip 192.168.77.11 --r_sip 192.168.77.12 --p_rx_ip 239.168.77.20 --r_rx_ip 239.168.77.21 &
23+
"${TEST_BIN_PATH}/RxSt20RedundantSample" --log_level "${LOG_LEVEL}" --p_port 0000:af:01.0 --r_port 0000:af:01.1 --p_sip 192.168.77.11 --r_sip 192.168.77.12 --p_rx_ip 239.168.77.20 --r_rx_ip 239.168.77.21 &
1824
pid_rx=$!
1925

20-
echo "${name}: pid_tx ${pid_tx}, pid_rx ${pid_rx}, wait ${TEST_TIME_SEC}s"
21-
sleep ${TEST_TIME_SEC}
22-
kill -SIGINT ${pid_tx}
23-
kill -SIGINT ${pid_rx}
26+
log_info "${name}: pid_tx ${pid_tx}, pid_rx ${pid_rx}, wait ${TEST_TIME_SEC}s"
27+
sleep "${TEST_TIME_SEC}"
28+
kill -SIGINT "${pid_tx}"
29+
kill -SIGINT "${pid_rx}"
2430

25-
echo "${name}: wait all thread ending"
31+
log_info "${name}: wait all thread ending"
2632
wait
27-
echo "${name}: ****** Done ******"
28-
echo ""
33+
log_success "${name}: ****** Done ******"
34+
log_info ""

app/sample/sample_test.sh

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
#!/bin/bash
22

33
# SPDX-License-Identifier: BSD-3-Clause
4-
# Copyright 2022 Intel Corporation
4+
# Copyright 2022-2025 Intel Corporation
55

6-
set -e
6+
SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")"
7+
REPOSITORY_DIR="$(readlink -f "${SCRIPT_DIR}/../..")"
78

8-
ST_PORT_TX=0000:af:01.1
9-
ST_PORT_RX=0000:af:01.0
10-
ST_SIP_TX=192.168.87.80
11-
ST_SIP_RX=192.168.87.81
12-
ST_TX_IP=239.168.87.20
13-
ST_RX_IP=239.168.87.20
14-
TEST_TIME_SEC=15
9+
# shellcheck source="script/common.sh"
10+
. "${REPOSITORY_DIR}/script/common.sh"
1511

16-
TEST_BIN_PATH=../../build/app
17-
LOG_LEVEL=notice
12+
ST_PORT_TX="${ST_PORT_TX:-'0000:af:01.1'}"
13+
ST_PORT_RX="${ST_PORT_RX:-'0000:af:01.0'}"
14+
ST_SIP_TX="${ST_SIP_TX:-'192.168.87.80'}"
15+
ST_SIP_RX="${ST_SIP_RX:-'192.168.87.81'}"
16+
ST_TX_IP="${ST_TX_IP:-'239.168.87.20'}"
17+
ST_RX_IP="${ST_RX_IP:-'239.168.87.20'}"
18+
TEST_TIME_SEC="${TEST_TIME_SEC:-15}"
1819

19-
export KAHAWAI_CFG_PATH=../../kahawai.json
20+
TEST_BIN_PATH="${TEST_BIN_PATH:-"${REPOSITORY_DIR}/build/app"}"
21+
LOG_LEVEL="${LOG_LEVEL:-notice}"
2022

2123
test_tx_and_rx() {
2224
local name=$1
@@ -30,53 +32,59 @@ test_tx_and_rx() {
3032
if [ -n "$5" ]; then
3133
height=$5
3234
fi
33-
echo "${name}: start ${tx_prog}, width:${width} height:${height}"
35+
log_info "${name}: start ${tx_prog}, width:${width} height:${height}"
3436
"${TEST_BIN_PATH}"/"${tx_prog}" --log_level "${LOG_LEVEL}" --p_port "${ST_PORT_TX}" --p_sip "${ST_SIP_TX}" --p_tx_ip "${ST_TX_IP}" --width "${width}" --height "${height}" &
3537
#${TEST_BIN_PATH}/${tx_prog} > /dev/null --log_level ${LOG_LEVEL} --p_port ${ST_PORT_TX} --p_sip ${ST_SIP_TX} --p_tx_ip ${ST_TX_IP} --width ${width} --height ${height} 2>&1 &
3638
pid_tx=$!
37-
echo "${name}: start ${rx_prog}"
39+
log_info "${name}: start ${rx_prog}"
3840
"${TEST_BIN_PATH}"/"${rx_prog}" --log_level "${LOG_LEVEL}" --p_port "${ST_PORT_RX}" --p_sip "${ST_SIP_RX}" --p_rx_ip "${ST_RX_IP}" --width "${width}" --height "${height}" &
3941
pid_rx=$!
40-
echo "${name}: pid_tx ${pid_tx}, pid_rx ${pid_rx}, wait ${TEST_TIME_SEC}s"
41-
sleep ${TEST_TIME_SEC}
42+
log_info "${name}: pid_tx ${pid_tx}, pid_rx ${pid_rx}, wait ${TEST_TIME_SEC}s"
43+
sleep "${TEST_TIME_SEC}"
4244

43-
echo "${name}: wait all thread ending"
45+
log_info "${name}: wait all thread ending"
4446
kill -SIGINT ${pid_tx}
4547
kill -SIGINT ${pid_rx}
4648
wait ${pid_tx}
47-
echo "${name}: ${tx_prog} exit"
49+
log_info "${name}: ${tx_prog} exit"
4850
wait ${pid_rx}
49-
echo "${name}: ${rx_prog} exit"
50-
echo "${name}: ****** Done ******"
51-
echo ""
51+
log_info "${name}: ${rx_prog} exit"
52+
log_success "${name}: ****** Done ******"
53+
log_info ""
5254
}
5355

54-
# test video
55-
test_tx_and_rx st20 TxVideoSample RxVideoSample
56-
# test st20p
57-
test_tx_and_rx st20p TxSt20PipelineSample RxSt20PipelineSample
58-
# test st22p
59-
test_tx_and_rx st22p TxSt22PipelineSample RxSt22PipelineSample
56+
# Allow sourcing of the script.
57+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
58+
set -e -o pipefail
59+
export KAHAWAI_CFG_PATH="${REPOSITORY_DIR}/kahawai.json"
6060

61-
# test rtp video
62-
test_tx_and_rx st20_rtp TxRtpVideoSample RxRtpVideoSample
63-
# test slice video
64-
test_tx_and_rx st20_slice TxSliceVideoSample RxSliceVideoSample
65-
# test st22
66-
test_tx_and_rx st22 TxSt22VideoSample RxSt22VideoSample
61+
print_logo_anim
62+
# test video
63+
test_tx_and_rx st20 TxVideoSample RxVideoSample
64+
# test st20p
65+
test_tx_and_rx st20p TxSt20PipelineSample RxSt20PipelineSample
66+
# test st22p
67+
test_tx_and_rx st22p TxSt22PipelineSample RxSt22PipelineSample
6768

68-
# test RxSt20TxSt20Fwd
69-
test_tx_and_rx RxSt20TxSt20Fwd TxSt20PipelineSample RxSt20TxSt20Fwd
70-
# test RxSt20pTxSt20pFwd
71-
test_tx_and_rx RxSt20pTxSt20pFwd TxSt20PipelineSample RxSt20pTxSt20pFwd
72-
# test RxSt20pTxSt22pFwd
73-
test_tx_and_rx RxSt20pTxSt22pFwd TxSt20PipelineSample RxSt20pTxSt22pFwd
69+
# test rtp video
70+
test_tx_and_rx st20_rtp TxRtpVideoSample RxRtpVideoSample
71+
# test slice video
72+
test_tx_and_rx st20_slice TxSliceVideoSample RxSliceVideoSample
73+
# test st22
74+
test_tx_and_rx st22 TxSt22VideoSample RxSt22VideoSample
7475

75-
# test TxVideoSplitSample
76-
test_tx_and_rx TxVideoSplitSample TxVideoSplitSample RxSt20PipelineSample
77-
# test RxSt20TxSt20SplitFwd, not enable now
78-
test_tx_and_rx RxSt20TxSt20SplitFwd TxSt20PipelineSample RxSt20TxSt20SplitFwd 3840 2160
76+
# test RxSt20TxSt20Fwd
77+
test_tx_and_rx RxSt20TxSt20Fwd TxSt20PipelineSample RxSt20TxSt20Fwd
78+
# test RxSt20pTxSt20pFwd
79+
test_tx_and_rx RxSt20pTxSt20pFwd TxSt20PipelineSample RxSt20pTxSt20pFwd
80+
# test RxSt20pTxSt22pFwd
81+
test_tx_and_rx RxSt20pTxSt22pFwd TxSt20PipelineSample RxSt20pTxSt22pFwd
7982

80-
echo "****** All test OK ******"
83+
# test TxVideoSplitSample
84+
test_tx_and_rx TxVideoSplitSample TxVideoSplitSample RxSt20PipelineSample
85+
# test RxSt20TxSt20SplitFwd, not enable now
86+
test_tx_and_rx RxSt20TxSt20SplitFwd TxSt20PipelineSample RxSt20TxSt20SplitFwd 3840 2160
8187

82-
unset KAHAWAI_CFG_PATH
88+
log_success "****** All test OK ******"
89+
unset KAHAWAI_CFG_PATH
90+
fi

ecosystem/msdk/build_msdk_mtl.sh

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
#!/bin/bash
22

33
# SPDX-License-Identifier: BSD-3-Clause
4-
# Copyright 2022 Intel Corporation
4+
# Copyright 2022-2025 Intel Corporation
55

6-
# check out msdk code
7-
git clone https://github.com/Intel-Media-SDK/MediaSDK.git
8-
cd MediaSDK || exit
9-
git checkout intel-mediasdk-22.6.4
10-
git switch -c v22.6.4
6+
SCRIPT_DIR="$(readlink -f "$(dirname -- "${BASH_SOURCE[0]}")")"
7+
set -e -o pipefail
118

12-
# apply the patches
13-
git am ../*.patch
9+
mkdir -p "${SCRIPT_DIR}/MediaSDK"
10+
curl -Lf "https://github.com/Intel-Media-SDK/MediaSDK/archive/refs/tags/intel-mediasdk-23.2.2.tar.gz" -o "${SCRIPT_DIR}/intel-mediasdk-22.6.4.tar.gz"
11+
tar -zx --strip-components=1 -C "${SCRIPT_DIR}/MediaSDK" -f "${SCRIPT_DIR}/intel-mediasdk-22.6.4.tar.gz"
12+
rm -f "${SCRIPT_DIR}/intel-mediasdk-22.6.4.tar.gz"
13+
patch -d "${SCRIPT_DIR}/MediaSDK" -p1 -i <(cat "${SCRIPT_DIR}/"*.patch)
1414

15-
# build now
16-
cmake -S . -B build -G Ninja -DENABLE_IMTL=ON
17-
cmake --build build
15+
cmake \
16+
-S "${SCRIPT_DIR}/MediaSDK" \
17+
-B "${SCRIPT_DIR}/build" \
18+
-G Ninja \
19+
-DENABLE_IMTL=ON \
20+
-DCMAKE_INSTALL_PREFIX="${SCRIPT_DIR}/_install"
21+
ninja -C "${SCRIPT_DIR}/build"
22+
ninja -C "${SCRIPT_DIR}/build" install
23+
24+
echo "Use sample applications, found under path:"
25+
echo "LD_LIBRARY_PATH=\"${LD_LIBRARY_PATH}:${SCRIPT_DIR}/_install/lib\""
26+
echo "APPLICATION_PATH=\"${SCRIPT_DIR}/_install/share/mfx/samples/sample_encode\""

gpu_direct/gpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-FileCopyrightText: Copyright (c) 2024 Intel Corporation
33
*/
44

5-
#include "gpu.h"
5+
#include "./gpu.h"
66

77
// Macros for error checking
88
#define ZE_CHECK_ERROR(fn_call) \

gpu_direct/gpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ int gpu_memset(GpuContext* ctx, void* dst, char byte, size_t sz);
4545
void gpu_free_buf(GpuContext* ctx, void* buf);
4646
int free_gpu_context(GpuContext* ctx);
4747

48-
#endif /* GPU */
48+
#endif /* GPU */

0 commit comments

Comments
 (0)