Skip to content

Commit

Permalink
Fix libnvmedia libraries dlopen() dependency on nvsci
Browse files Browse the repository at this point in the history
Also adds a test to multimedia-test that reproduces the failure when
this fix is not applied.

Failing test:

> Opening in BLOCKING MODE
> NvMMLiteOpen : Block : BlockType = 4
> ===== NVMEDIA: NVENC =====
> NvMMLiteBlockCreate : Block : BlockType = 4
> 875967048
> 842091865
> H264: Profile = 100, Level = 50
> NVMEDIA: Need to set EMC bandwidth : 846000
> NVMEDIA: Need to set EMC bandwidth : 846000
> NVMEDIA_ENC: bBlitMode is set to TRUE
> NvVideoEncTransferOutputBufferToBlock: DoWork failed line# 679
> NvVideoEnc: NvVideoEncTransferOutputBufferToBlock TransferBufferToBlock failed Line=690
> Could not read complete frame from input file

Succeeding test:

> Opening in BLOCKING MODE
> NvMMLiteOpen : Block : BlockType = 4
> ===== NVMEDIA: NVENC =====
> NvMMLiteBlockCreate : Block : BlockType = 4
> 875967048
> 842091865
> H264: Profile = 100, Level = 50
> NVMEDIA: Need to set EMC bandwidth : 846000
> NVMEDIA: Need to set EMC bandwidth : 846000
> NVMEDIA_ENC: bBlitMode is set to TRUE
> Could not read complete frame from input file
> Could not read complete frame from input file
> File read complete.
> App run was successful
  • Loading branch information
danielfullmer committed Jan 31, 2024
1 parent afd953e commit 2e2ee00
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkgs/l4t/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ let
# libnvos.so here instead.
#
# We append a postFixupHook since we need to have this happen after
# autoPatchelfHook, which itself also runs as a postFixupHook
# autoPatchelfHook, which itself also runs as a postFixupHook.
# TODO: Use runtimeDependencies instead
preFixup = ''
postFixupHooks+=('
patchelf --add-rpath /run/opengl-driver/lib $out/lib/libnvos.so
Expand Down Expand Up @@ -252,6 +253,15 @@ let
ln -sf ../../../libv4l2_nvcuvidvideocodec.so lib/libv4l/plugins/nv/libv4l2_nvcuvidvideocodec.so
ln -sf ../../../libv4l2_nvvideocodec.so lib/libv4l/plugins/nv/libv4l2_nvvideocodec.so
'';

# We append a postFixupHook since we need to have this happen after
# autoPatchelfHook, which itself also runs as a postFixupHook.
# TODO: Use runtimeDependencies instead
preFixup = ''
postFixupHooks+=('
patchelf --add-rpath ${lib.getLib l4t-nvsci}/lib $out/lib/libnvmedia*.so
')
'';
};

l4t-nvfancontrol = buildFromDeb {
Expand Down
3 changes: 3 additions & 0 deletions pkgs/samples/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ let
echo " * Running video_decode"
${multimedia-samples}/bin/video_decode H264 --disable-rendering ${multimedia-samples}/data/Video/sample_outdoor_car_1080p_10fps.h264
echo
echo " * Running video_cuda_enc"
${multimedia-samples}/bin/video_cuda_enc ${multimedia-samples}/data/Video/sample_outdoor_car_1080p_10fps.h264 1920 1080 H264 "$WORKDIR"/test.h264
echo
echo " * Running video_convert"
${multimedia-samples}/bin/video_convert "$WORKDIR"/nvidia-logo.yuv 1920 1080 YUV420 "$WORKDIR"/test.yuv 1920 1080 YUYV
echo
Expand Down

0 comments on commit 2e2ee00

Please sign in to comment.