Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for gpu_direct in ffmepg ffmpeg plugin #967

Merged
merged 6 commits into from
Sep 10, 2024

Conversation

DawidWesierski4
Copy link
Collaborator

@DawidWesierski4 DawidWesierski4 commented Sep 9, 2024

Add support for gpu_direct in ffmepg ffmpeg plugin
Introduces suport for experimental MTL_GPU_DIRECT
feature to enhance the performance of the FFmpeg
ST20p plugin by enabling direct GPU memory access.

Update ffmpeg README.md
-- include build instructions and description of
the feature

Modify build_ffmpeg_plugin.sh
-- Add support for building with GPU_DIRECT

@DawidWesierski4 DawidWesierski4 force-pushed the support_for_ffmpeg branch 9 times, most recently from bb33c6b to 14f6669 Compare September 10, 2024 09:03
@DawidWesierski4
Copy link
Collaborator Author

few basic tests done

building running on default / GPU enabled mode seems to work fine

[in#0/mtl_st20p @ 0x56812e879dc0] Input file #0 (0):
[in#0/mtl_st20p @ 0x56812e879dc0] Input stream #0:0 (video): 250 packets read (2073600000 bytes); 250 frames decoded; 0 decode errors;
[in#0/mtl_st20p @ 0x56812e879dc0] Total: 250 packets (2073600000 bytes) demuxed
MTL: 2024-09-10 12:03:51, st20p_rx_free(0), start
MTL: 2024-09-10 12:03:51, st20_rx_free(0,0), start
MTL: 2024-09-10 12:03:51, RX_VIDEO_SESSION(0,0:st20p_rx_ffmpeg): fps 1.824542 frames 2 pkts 6367
MTL: 2024-09-10 12:03:51, RX_VIDEO_SESSION(0,0): throughput 6.739931 Mb/s, cpu busy 0.300052
MTL: 2024-09-10 12:03:51, RX_VIDEO_SESSION(0,0): succ burst max 5, avg 1.000629
MTL: 2024-09-10 12:03:51, mt_dev_put_rx_queue(0), q 1
MTL: 2024-09-10 12:03:51, sch_free_quota(0), quota 1620 total now 0
MTL: 2024-09-10 12:03:51, st20_rx_free, succ on sch 0 session 0
MTL: 2024-09-10 12:03:51, st20p_rx_free(0), succ
[mtl_st20p @ 0x56812e879f40] mtl_instance_put, handle 0x3200b80f00 ref cnt 0
[mtl_st20p @ 0x56812e879f40] mtl_instance_put, ref cnt reach zero, uninit mtl device
MTL: 2024-09-10 12:03:51, sch_tasklet_func(0), end with 1 tasklets
MTL: 2024-09-10 12:03:51, mt_sch_put_lcore, succ on manager lcore 36 for lib_sch
MTL: 2024-09-10 12:03:51, sch_stop(0), succ
MTL: 2024-09-10 12:03:51, mt_sch_stop_all, succ
MTL: 2024-09-10 12:03:51, _mt_stop, succ
MTL: 2024-09-10 12:03:51, admin_thread, stop
MTL: 2024-09-10 12:03:51, cni_traffic_thread, stop
MTL: 2024-09-10 12:03:51, mt_dev_put_rx_queue(0), q 0
MTL: 2024-09-10 12:03:51, mt_cni_uinit, succ
MTL: 2024-09-10 12:03:51, sch_free_quota(0), quota 0 total now 0
MTL: 2024-09-10 12:03:51, mt_sch_put(0), ref_cnt now zero
MTL: 2024-09-10 12:03:51, Warn: sch_stop(0), not started
MTL: 2024-09-10 12:03:51, mtl_sch_unregister_tasklet(0), tasklet rvs_pkt_rx(0) unregistered
MTL: 2024-09-10 12:03:51, rvs_mgr_uinit(0), succ
MTL: 2024-09-10 12:03:51, sch_free(0), start to free sch: sch_0
MTL: 2024-09-10 12:03:51, mt_dpdk_flush_tx_queue(0), queue 0 burst_pkts 1024
MTL: 2024-09-10 12:03:51, mt_dev_put_tx_queue(0), q 0
MTL: 2024-09-10 12:03:51, dev_stop_port(0), succ
MTL: 2024-09-10 12:03:51, mt_dev_free, succ
MTL: 2024-09-10 12:03:51, mt_main_free, succ
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q0_MBUF_1
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q1_MBUF_2
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q2_MBUF_3
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q3_MBUF_4
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q4_MBUF_5
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q5_MBUF_6
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q6_MBUF_7
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q7_MBUF_8
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool R_P0Q8_MBUF_9
MTL: 2024-09-10 12:03:51, mt_mempool_free, free mempool T_P0_SYS_0
MTL: 2024-09-10 12:03:51, dev_close_port(0), succ
MTL: 2024-09-10 12:03:51, stat_thread, stop
MTL: 2024-09-10 12:03:51, mt_dev_uinit, succ
MTL: 2024-09-10 12:03:51, mtl_uninit, succ
[mtl_st20p @ 0x56812e879f40] mtl_st20p_read_close(0), frame_counter 250

on GPU enabled mode no obvious errors / framedrops

@DawidWesierski4
Copy link
Collaborator Author

also

MTL: 2024-09-10 12:48:09, rv_alloc_frames rv_framebuffer_in_gpu_direct_vram

frames are allocated in vram

Introduces suport for experimental MTL_GPU_DIRECT
feature to enhance the performance of the FFmpeg
ST20p plugin by enabling direct GPU memory access.

Update ffmpeg README.md
-- include build instructions and description of
the feature

Modify build_ffmpeg_plugin.sh
--  Add support for building with GPU_DIRECT
@tszumski
Copy link
Contributor

There is no information on how to get the appropriate driver and device index

@DawidWesierski4
Copy link
Collaborator Author

There is no information on how to get the appropriate driver and device index

there is no easy way to find this information tbh outside zero level library

Added it as a log for the user to see
If initialization fails there will be a clear log
Driver: 0: Device: 0:

-- fail to initialize

Copy link

@soopel soopel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review completed

@DawidWesierski4 DawidWesierski4 changed the title Support for ffmpeg Add support for gpu_direct in ffmepg ffmpeg plugin Sep 10, 2024
@soopel soopel merged commit 858fbc2 into OpenVisualCloud:main Sep 10, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants