From f0f3b1920f7b70a9dae4b94a27ee386ce204d9ba Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Wed, 6 Dec 2023 17:25:11 +0800 Subject: [PATCH 01/26] Fix Pinned-Dependencies Issue. (#31) Pinned version for dependencies. Close #30 Signed-off-by: Han Qiang --- .github/workflows/codeql.yml | 2 +- media-proxy/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ee3261e2..13474dcd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -69,7 +69,7 @@ jobs: uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 with: languages: ${{ matrix.language }} - config-file: ./.github/codeql/codeql-config.yml + config-file: ${{github.workspace}}/.github/codeql/codeql-config.yml # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. diff --git a/media-proxy/Dockerfile b/media-proxy/Dockerfile index 8aa5e410..3271a07a 100644 --- a/media-proxy/Dockerfile +++ b/media-proxy/Dockerfile @@ -45,7 +45,7 @@ RUN adduser ${USER} sudo \ && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers # Install Conan using pip3 package installer. -RUN python3 -m pip install --no-cache-dir conan=1.62.0 +RUN python3 -m pip install --no-cache-dir conan==1.62.0 # Build DPDK/IMTL ENV DPDK_VER=23.03 From 0045ca13b71dfa60668e7d9b1337b13f96abca03 Mon Sep 17 00:00:00 2001 From: jenny zhu Date: Wed, 6 Dec 2023 17:29:31 +0800 Subject: [PATCH 02/26] fix proxy context multi-free issue in RxStop Signed-off-by: jenny zhu --- media-proxy/src/proxy_context.cc | 36 +++++++++++------------ media-proxy/src/shm_memif.c | 2 +- media-proxy/src/udp_h264_rx_sample.c | 43 ++++++++++++++-------------- 3 files changed, 41 insertions(+), 40 deletions(-) diff --git a/media-proxy/src/proxy_context.cc b/media-proxy/src/proxy_context.cc index bb7af2dc..d94f7f40 100644 --- a/media-proxy/src/proxy_context.cc +++ b/media-proxy/src/proxy_context.cc @@ -197,8 +197,8 @@ void ProxyContext::ParseStInitParam(const mcm_conn_param* request, struct mtl_in st_param->log_level = MTL_LOG_LEVEL_DEBUG; st_param->priv = NULL; st_param->ptp_get_time_fn = NULL; - st_param->rx_queues_cnt[MTL_PORT_P] = 32; - st_param->tx_queues_cnt[MTL_PORT_P] = 32; + st_param->rx_queues_cnt[MTL_PORT_P] = 128; + st_param->tx_queues_cnt[MTL_PORT_P] = 128; st_param->lcores = NULL; INFO("ProxyContext: ParseStInitParam..."); @@ -1009,40 +1009,40 @@ void ProxyContext::TxStop(const int32_t session_id) void ProxyContext::RxStop(const int32_t session_id) { - auto ctx = std::find_if(mStCtx.begin(), mStCtx.end(), + auto it = std::find_if(mStCtx.begin(), mStCtx.end(), [session_id](auto it) { return it->id == session_id; }); + mtl_session_context_t* ctx = *it; - if (ctx != mStCtx.end()) { + if (it != mStCtx.end()) { INFO("%s, Stop RX session ID: %d", __func__, session_id); - switch ((*ctx)->payload_type) { + switch ((*it)->payload_type) { case PAYLOAD_TYPE_ST22_VIDEO: - mtl_st22p_rx_session_stop((*ctx)->rx_st22p_session); - mtl_st22p_rx_session_destroy(&(*ctx)->rx_st22p_session); + mtl_st22p_rx_session_stop((*it)->rx_st22p_session); + mtl_st22p_rx_session_destroy(&(*it)->rx_st22p_session); break; case PAYLOAD_TYPE_ST30_AUDIO: - mtl_st30_rx_session_stop((*ctx)->rx_st30_session); - mtl_st30_rx_session_destroy(&(*ctx)->rx_st30_session); + mtl_st30_rx_session_stop((*it)->rx_st30_session); + mtl_st30_rx_session_destroy(&(*it)->rx_st30_session); break; case PAYLOAD_TYPE_ST40_ANCILLARY: - mtl_st40_rx_session_stop((*ctx)->rx_st40_session); - mtl_st40_rx_session_destroy(&(*ctx)->rx_st40_session); + mtl_st40_rx_session_stop((*it)->rx_st40_session); + mtl_st40_rx_session_destroy(&(*it)->rx_st40_session); break; case PAYLOAD_TYPE_RTSP_VIDEO: - mtl_rtsp_rx_session_stop((*ctx)->rx_udp_h264_session); - mtl_rtsp_rx_session_destroy(&(*ctx)->rx_udp_h264_session); + mtl_rtsp_rx_session_stop((*it)->rx_udp_h264_session); + mtl_rtsp_rx_session_destroy(&(*it)->rx_udp_h264_session); break; case PAYLOAD_TYPE_ST20_VIDEO: default: - mtl_st20p_rx_session_stop((*ctx)->rx_session); - mtl_st20p_rx_session_destroy(&(*ctx)->rx_session); + mtl_st20p_rx_session_stop((*it)->rx_session); + mtl_st20p_rx_session_destroy(&(*it)->rx_session); break; } - - mStCtx.erase(ctx); - delete (*ctx); + mStCtx.erase(it); + delete (ctx); /* Destroy device if all sessions stoped. */ // if (mStCtx.size() == 0) { diff --git a/media-proxy/src/shm_memif.c b/media-proxy/src/shm_memif.c index 73c9e9bd..bd250d28 100644 --- a/media-proxy/src/shm_memif.c +++ b/media-proxy/src/shm_memif.c @@ -364,7 +364,7 @@ int rx_on_disconnect(memif_conn_handle_t conn, void* priv_data) // mtl_st20p_rx_session_destroy(&rx_ctx); /* stop event polling thread */ - INFO("RX Stop poll event"); + INFO("RX Stop poll event\n"); socket = memif_get_socket_handle(conn); if (socket == NULL) { INFO("Invalide socket handle."); diff --git a/media-proxy/src/udp_h264_rx_sample.c b/media-proxy/src/udp_h264_rx_sample.c index e534067e..d83b2c0f 100644 --- a/media-proxy/src/udp_h264_rx_sample.c +++ b/media-proxy/src/udp_h264_rx_sample.c @@ -107,7 +107,7 @@ int rx_udp_h264_shm_init(rx_udp_h264_session_context_t* rx_ctx, memif_ops_t* mem return 0; } -static void* udp_server_h264(void* arg) +static int udp_server_h264(void* arg) { rx_udp_h264_session_context_t* s = arg; @@ -160,7 +160,7 @@ static void* udp_server_h264(void* arg) free(rtp_header); rtp_header = NULL; } - return NULL; + return 0; } //} else { // INFO("Receive a UDP RTP package\n"); @@ -174,10 +174,10 @@ static void* udp_server_h264(void* arg) // printf("First Mark = %d\n", mark); s->check_first_new_NALU = false; //continue; - return NULL; + return 0; } else { //continue; - return NULL; + return 0; } } // } @@ -188,8 +188,9 @@ static void* udp_server_h264(void* arg) while (memif_alloc != true) { err = memif_buffer_alloc(s->memif_conn, qid, tx_bufs, buf_num, &tx_buf_num, buf_size); if (err != MEMIF_ERR_SUCCESS) { - INFO("Failed to alloc memif buffer: %s", memif_strerror(err)); - continue; + INFO("Failed to alloc memif buffer: %s, err:%d", memif_strerror(err), err); + //continue; + return -1; } else { // INFO("Success to alloc memif buffer\n"); memif_alloc = true; @@ -321,32 +322,32 @@ static void* udp_server_h264(void* arg) } else { INFO("%s, has stopped\n", __func__); } - return NULL; + return 0; } static int media_proxy_mudp_poll(void* priv) { int ret; - rx_udp_h264_session_context_t* ctx = (struct rx_udp_h264_session_context_t*)priv; - //if (ctx->sch_start == true) { - //ret = mudp_poll(&(ctx->udp_pollfd), 1, -1); - //if ( ret > 0 ) { - // INFO("dp_pollfd.revents = %d\n", ctx->udp_pollfd.revents); - // if (ctx->udp_pollfd.revents == 32) udp_server_h264_thread(ctx); - //} + rx_udp_h264_session_context_t* ctx = (rx_udp_h264_session_context_t*)priv; - //} - if (ctx->sch_start == true) udp_server_h264(ctx); - return MTL_TASKLET_ALL_DONE; + if (ctx->sch_start == true) { + int ret = udp_server_h264(ctx); + if (ret == 0) { + return MTL_TASKLET_ALL_DONE; + } else { + INFO("udp_server_h264 has memif error.\n"); + return MTL_TASKLET_ALL_DONE; + } + } } static int udp_poll_tasklet_start(void* priv) { - rx_udp_h264_session_context_t* ctx = (struct rx_udp_h264_session_context_t*)priv; + rx_udp_h264_session_context_t* ctx = (rx_udp_h264_session_context_t*)priv; ctx->sch_start = true; return 0; } static int udp_poll_tasklet_stop(void* priv) { - rx_udp_h264_session_context_t* ctx = (struct rx_udp_h264_session_context_t*)priv; + rx_udp_h264_session_context_t* ctx = (rx_udp_h264_session_context_t*)priv; ctx->sch_start = false; return 0; } @@ -354,7 +355,7 @@ static int udp_poll_tasklet_stop(void* priv) { rx_udp_h264_session_context_t* mtl_udp_h264_rx_session_create(mtl_handle dev_handle, mcm_dp_addr* dp_addr, memif_ops_t* memif_ops, mtl_sch_handle schs[]) { // struct st_sample_context ctx; - rx_udp_h264_session_context_t* ctx; + rx_udp_h264_session_context_t* ctx = NULL; static int idx = 0; int err = 0; int ret = 0; @@ -423,7 +424,7 @@ rx_udp_h264_session_context_t* mtl_udp_h264_rx_session_create(mtl_handle dev_han udp_tasklet = mtl_sch_register_tasklet(schs[i], &(ctx->udp_tasklet_ops)); if (udp_tasklet != NULL) { ctx->udp_tasklet = udp_tasklet; - ctx->udp_pollfd.fd = socket; + ctx->udp_pollfd.fd = ctx->socket; ctx->udp_pollfd.events = POLLIN; ctx->check_first_new_NALU = true; ctx->new_NALU = 0; From 1f2b2e0b525933c4cdebee79203fd4c2a91b7845 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 08:44:53 +0800 Subject: [PATCH 03/26] Bump github/codeql-action from 2.22.8 to 2.22.9 (#34) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.22.8 to 2.22.9. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/407ffafae6a767df3e0230c3df91b6443ae8df75...c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 13474dcd..be04da46 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -66,7 +66,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 + uses: github/codeql-action/init@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9 with: languages: ${{ matrix.language }} config-file: ${{github.workspace}}/.github/codeql/codeql-config.yml @@ -118,6 +118,6 @@ jobs: ./build.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 + uses: github/codeql-action/analyze@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index c386a4be..5aef7349 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -72,6 +72,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8 + uses: github/codeql-action/upload-sarif@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9 with: sarif_file: results.sarif From dd651d94e8e5d8e9b8119fc98f310a919b341251 Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Mon, 11 Dec 2023 22:24:53 +0800 Subject: [PATCH 04/26] Enable Zero Copy for ST22 Stream. (#35) Enable Zero Copy for ST 2110-22 Stream. Signed-off-by: Han Qiang --- media-proxy/imtl.json | 14 ++------ media-proxy/include/mtl.h | 15 +++++++-- media-proxy/src/mtl.c | 50 ++++++++++++++++++++++++++-- media-proxy/src/shm_memif.c | 23 +++++++++++-- media-proxy/src/tcp_controller.cc | 55 ++++++++++++++----------------- 5 files changed, 109 insertions(+), 48 deletions(-) diff --git a/media-proxy/imtl.json b/media-proxy/imtl.json index eadebeb9..23140ffe 100644 --- a/media-proxy/imtl.json +++ b/media-proxy/imtl.json @@ -1,10 +1,5 @@ { "plugins": [ - { - "enabled": 0, - "name": "intopix_jpegxs_cpu", - "path": "/usr/local/lib/x86_64-linux-gnu/libst_plugin_intopix_cpu.so" - }, { "enabled": 0, "name": "st22_ffmpeg", @@ -16,12 +11,12 @@ "path": "/usr/local/lib64/libst_plugin_st22_ffmpeg.so" }, { - "enabled": 0, + "enabled": 1, "name": "st22_sample", "path": "/usr/local/lib/x86_64-linux-gnu/libst_plugin_st22_sample.so" }, { - "enabled": 0, + "enabled": 1, "name": "st22_sample", "path": "/usr/local/lib64/libst_plugin_st22_sample.so" }, @@ -34,11 +29,6 @@ "enabled": 0, "name": "convert_sample", "path": "/usr/local/lib64/libst_plugin_convert_sample.so" - }, - { - "enabled": 1, - "name": "st22_svt_jpeg_xs", - "path": "/usr/local/lib/x86_64-linux-gnu/libst_plugin_st22_svt_jpeg_xs.so" } ] } diff --git a/media-proxy/include/mtl.h b/media-proxy/include/mtl.h index cb6fa4af..990a96eb 100644 --- a/media-proxy/include/mtl.h +++ b/media-proxy/include/mtl.h @@ -147,6 +147,8 @@ typedef struct { bool stop; + int fb_cnt; + uint16_t fb_idx; int fb_send; pthread_cond_t st22p_wake_cond; pthread_mutex_t st22p_wake_mutex; @@ -161,6 +163,15 @@ typedef struct { void* source_begin_malloc; mtl_iova_t source_begin_iova; size_t source_begin_iova_map_sz; + + void* ext_fb_malloc; + uint8_t* ext_fb; + mtl_iova_t ext_fb_iova; + size_t ext_fb_iova_map_sz; + struct st_ext_frame* p_ext_frames; + int ext_idx; + bool ext_fb_in_use[3]; /* assume 3 framebuffer */ + mtl_dma_mem_handle dma_mem; #endif /* memif parameters */ @@ -468,10 +479,10 @@ typedef struct { }; } mtl_session_context_t; -/* Initialize Kahawai library */ +/* Initialize IMTL library */ mtl_handle inst_init(struct mtl_init_params* st_param); -/* Deinitialize Kahawai */ +/* Deinitialize IMTL */ void mtl_deinit(mtl_handle dev_handle); /* TX: Create ST20P session */ diff --git a/media-proxy/src/mtl.c b/media-proxy/src/mtl.c index 7f1b9c26..083179d7 100644 --- a/media-proxy/src/mtl.c +++ b/media-proxy/src/mtl.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include #include #include #include @@ -762,7 +763,7 @@ static void* rx_st40_frame_thread(void* arg) return NULL; } -/* Initiliaze Kahawai library */ +/* Initiliaze IMTL library */ mtl_handle inst_init(struct mtl_init_params* st_param) { mtl_handle dev_handle = NULL; @@ -2328,7 +2329,7 @@ void mtl_st22p_rx_session_destroy(rx_st22p_session_context_t** p_rx_ctx) free(rx_ctx); } -/* Deinitialize Kahawai */ +/* Deinitialize IMTL */ void mtl_deinit(mtl_handle dev_handle) { if (dev_handle) { @@ -2455,6 +2456,8 @@ tx_st22p_session_context_t* mtl_st22p_tx_session_create(mtl_handle dev_handle, s tx_ctx->st = dev_handle; tx_ctx->idx = idx; tx_ctx->stop = false; + tx_ctx->fb_cnt = 3; + tx_ctx->fb_idx = 0; st_pthread_mutex_init(&tx_ctx->st22p_wake_mutex, NULL); st_pthread_cond_init(&tx_ctx->st22p_wake_cond, NULL); @@ -2464,6 +2467,10 @@ tx_st22p_session_context_t* mtl_st22p_tx_session_create(mtl_handle dev_handle, s ops_tx.notify_frame_available = tx_st22p_frame_available; ops_tx.notify_frame_done = tx_st22p_frame_done; +#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) + ops_tx.flags |= ST22P_TX_FLAG_EXT_FRAME; +#endif + /* dump out parameters for debugging. */ st_tx_st22p_debug_dump(ops_tx); @@ -2474,9 +2481,43 @@ tx_st22p_session_context_t* mtl_st22p_tx_session_create(mtl_handle dev_handle, s st_pthread_cond_destroy(&tx_ctx->st22p_wake_cond); return NULL; } + tx_ctx->handle = tx_handle; tx_ctx->frame_size = st22p_tx_frame_size(tx_handle); +#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) + uint8_t planes = st_frame_fmt_planes(ops_tx.input_fmt); + size_t frame_size = tx_ctx->frame_size; + + tx_ctx->p_ext_frames = (struct st_ext_frame*)malloc( + sizeof(*tx_ctx->p_ext_frames) * tx_ctx->fb_cnt); + size_t pg_sz = mtl_page_size(dev_handle); + size_t fb_size = tx_ctx->frame_size * tx_ctx->fb_cnt; + tx_ctx->ext_fb_iova_map_sz = mtl_size_page_align(fb_size, pg_sz); /* align */ + size_t fb_size_malloc = tx_ctx->ext_fb_iova_map_sz + pg_sz; + tx_ctx->ext_fb_malloc = calloc(1, fb_size_malloc); + assert(tx_ctx->ext_fb_malloc != NULL); + tx_ctx->ext_fb = (uint8_t*)MTL_ALIGN((uint64_t)tx_ctx->ext_fb_malloc, pg_sz); + tx_ctx->ext_fb_iova = mtl_dma_map(dev_handle, tx_ctx->ext_fb, tx_ctx->ext_fb_iova_map_sz); + assert(tx_ctx->ext_fb_iova != MTL_BAD_IOVA); + INFO("%s, session %d ext_fb %p\n", __func__, tx_ctx->idx, tx_ctx->ext_fb); + + for (int j = 0; j < tx_ctx->fb_cnt; j++) { + for (uint8_t plane = 0; plane < planes; plane++) { /* assume planes continuous */ + tx_ctx->p_ext_frames[j].linesize[plane] = st_frame_least_linesize(ops_tx.input_fmt, ops_tx.width, plane); + if (plane == 0) { + tx_ctx->p_ext_frames[j].addr[plane] = tx_ctx->ext_fb + j * frame_size; + tx_ctx->p_ext_frames[j].iova[plane] = tx_ctx->ext_fb_iova + j * frame_size; + } else { + tx_ctx->p_ext_frames[j].addr[plane] = (uint8_t*)tx_ctx->p_ext_frames[j].addr[plane - 1] + tx_ctx->p_ext_frames[j].linesize[plane - 1] * ops_tx.height; + tx_ctx->p_ext_frames[j].iova[plane] = tx_ctx->p_ext_frames[j].iova[plane - 1] + tx_ctx->p_ext_frames[j].linesize[plane - 1] * ops_tx.height; + } + } + tx_ctx->p_ext_frames[j].size = frame_size; + tx_ctx->p_ext_frames[j].opaque = NULL; + } +#endif + /* initialize share memory */ ret = tx_st22p_shm_init(tx_ctx, memif_ops); if (ret < 0) { @@ -2540,6 +2581,11 @@ void mtl_st22p_tx_session_destroy(tx_st22p_session_context_t** p_tx_ctx) return; } + if (tx_ctx->ext_fb_malloc) { + free(tx_ctx->ext_fb_malloc); + tx_ctx->ext_fb_malloc = NULL; + } + printf("%s, fb_send %d\n", __func__, tx_ctx->fb_send); if (st22p_tx_free(tx_ctx->handle) < 0) { printf("%s, session free failed\n", __func__); diff --git a/media-proxy/src/shm_memif.c b/media-proxy/src/shm_memif.c index bd250d28..c92d1c30 100644 --- a/media-proxy/src/shm_memif.c +++ b/media-proxy/src/shm_memif.c @@ -652,14 +652,33 @@ int tx_st22p_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) } } while (!frame); - frame->opaque = conn; + /* Send out frame. */ +#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) + struct st_ext_frame ext_frame = { 0 }; + ext_frame.addr[0] = shm_bufs.data; + ext_frame.iova[0] = tx_ctx->source_begin_iova + ((uint8_t*)shm_bufs.data - tx_ctx->source_begin); + ext_frame.linesize[0] = st_frame_least_linesize(frame->fmt, frame->width, 0); + uint8_t planes = st_frame_fmt_planes(frame->fmt); + for (uint8_t plane = 1; plane < planes; plane++) { /* assume planes continous */ + ext_frame.linesize[plane] = st_frame_least_linesize(frame->fmt, frame->width, plane); + ext_frame.addr[plane] = (uint8_t*)ext_frame.addr[plane - 1] + ext_frame.linesize[plane - 1] * frame->height; + ext_frame.iova[plane] = ext_frame.iova[plane - 1] + ext_frame.linesize[plane - 1] * frame->height; + } + ext_frame.size = shm_bufs.len; + ext_frame.opaque = conn; + st22p_tx_put_ext_frame(handle, frame, &ext_frame); +#else /* fill frame data. */ tx_st22p_build_frame(shm_bufs, frame); - /* Send out frame. */ st22p_tx_put_frame(handle, frame); + err = memif_refill_queue(conn, qid, buf_num, 0); + if (err != MEMIF_ERR_SUCCESS) + INFO("memif_refill_queue: %s", memif_strerror(err)); +#endif + // INFO("%s send frame %d", __func__, tx_ctx->fb_send); tx_ctx->fb_send++; diff --git a/media-proxy/src/tcp_controller.cc b/media-proxy/src/tcp_controller.cc index ff386e12..e7f5a361 100644 --- a/media-proxy/src/tcp_controller.cc +++ b/media-proxy/src/tcp_controller.cc @@ -27,7 +27,7 @@ typedef struct _control_context { void* msg_loop(void* ptr) { int ret = 0; - void* buffer = NULL; + char* buffer = NULL; int len = 0; control_context* ctl_ctx = NULL; connection_t* conn = NULL; @@ -69,22 +69,30 @@ void* msg_loop(void* ptr) if (msg.command.data_len > 0) { /* read parameters */ - buffer = (char*)malloc((msg.command.data_len)); + buffer = (char*)malloc(msg.command.data_len); if (buffer == NULL) { - INFO("Outof Memory."); - break; - } - len = msg.command.data_len; - do { - ret = read(conn->sock, buffer, len); - if (ret <= 0) { - break; + INFO("Out of Memory."); + continue; + } else { + int bytesRead = 0; + while (bytesRead < msg.command.data_len) { + int ret = read(conn->sock, buffer + bytesRead, msg.command.data_len - bytesRead); + if (ret <= 0) { + INFO("Failed to read command parameters."); + free(buffer); + buffer = NULL; // Reset the pointer to indicate failure + break; // Exit the loop on failure + } + bytesRead += ret; + } + + if (bytesRead < msg.command.data_len) { + INFO("Failed to read all command parameters."); + // Clean up on failure + free(buffer); + buffer = NULL; + continue; } - len -= ret; - } while (len > 0); - if (len > 0) { - INFO("Fail to read command parameters."); - break; } } @@ -113,23 +121,10 @@ void* msg_loop(void* ptr) } break; case MCM_QUERY_MEMIF_PATH: - /* - len = strlen("/run/mcm/media_proxy_0.sock"); - if (write(conn->sock, &len, sizeof(uint32_t)) <= 0) { - INFO("Fail to return path length."); - } - if (write(conn->sock, "/run/mcm/media_proxy_0.sock", strlen("/run/mcm/media_proxy_0.sock")) <= 0) { - INFO("Fail to return memif socket path."); - } - */ + /* TODO: return memif socket path */ break; case MCM_QUERY_MEMIF_ID: - /* - intf_id = 0; - if (write(conn->sock, &intf_id, sizeof(intf_id)) <= 0) { - INFO("Fail to return memif interface id."); - } - */ + /* TODO: return memdif ID */ break; case MCM_QUERY_MEMIF_PARAM: if (buffer == NULL || msg.command.data_len < 4) { From 9af93447dc70696770a91b04a7f28ee991f77567 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 22:35:14 +0800 Subject: [PATCH 05/26] Bump github/codeql-action from 2.22.9 to 2.22.10 (#40) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.22.9 to 2.22.10. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2...305f6546310b9203e892c28c1484e82977f4f63d) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index be04da46..5e8a25b1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -66,7 +66,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9 + uses: github/codeql-action/init@305f6546310b9203e892c28c1484e82977f4f63d # v2.22.10 with: languages: ${{ matrix.language }} config-file: ${{github.workspace}}/.github/codeql/codeql-config.yml @@ -118,6 +118,6 @@ jobs: ./build.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9 + uses: github/codeql-action/analyze@305f6546310b9203e892c28c1484e82977f4f63d # v2.22.10 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 5aef7349..b35ed799 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -72,6 +72,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9 + uses: github/codeql-action/upload-sarif@305f6546310b9203e892c28c1484e82977f4f63d # v2.22.10 with: sarif_file: results.sarif From a29a16f289013933102ec30d648a4ba842c727d5 Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Thu, 14 Dec 2023 10:28:39 +0800 Subject: [PATCH 06/26] Enable Zero Copy for ST 2110-22 RX. (#39) * Enable Zero Copy for ST2110-22 RX. --------- Signed-off-by: Han Qiang --- media-proxy/include/mtl.h | 17 +++- media-proxy/src/mtl.c | 152 +++++++++++++++++++++++------------- media-proxy/src/shm_memif.c | 24 ++++++ 3 files changed, 139 insertions(+), 54 deletions(-) diff --git a/media-proxy/include/mtl.h b/media-proxy/include/mtl.h index 990a96eb..289d4b0a 100644 --- a/media-proxy/include/mtl.h +++ b/media-proxy/include/mtl.h @@ -204,7 +204,13 @@ typedef struct { pthread_mutex_t st22p_wake_mutex; size_t frame_size; /* Size (Bytes) of single frame. */ + uint16_t fb_idx; uint32_t fb_count; /* Frame buffer count. */ + int fb_cnt; + + uint32_t width; + uint32_t height; + enum st_frame_fmt output_fmt; #if defined(ZERO_COPY) || defined(TX_ZERO_COPY) uint8_t* source_begin; @@ -214,6 +220,16 @@ typedef struct { void* source_begin_malloc; mtl_iova_t source_begin_iova; size_t source_begin_iova_map_sz; + + void* ext_fb_malloc; + uint8_t* ext_fb; + mtl_iova_t ext_fb_iova; + size_t ext_fb_iova_map_sz; + struct st20_ext_frame* ext_frames; + struct st_ext_frame* p_ext_frames; + int ext_idx; + bool ext_fb_in_use[3]; /* assume 3 framebuffer */ + mtl_dma_mem_handle dma_mem; #endif /* share memory arguments */ @@ -235,7 +251,6 @@ typedef struct { void* frames_begin_addr; mtl_iova_t frames_begin_iova; size_t frames_iova_map_sz; - struct st20_ext_frame* ext_frames; } rx_st22p_session_context_t; typedef struct { diff --git a/media-proxy/src/mtl.c b/media-proxy/src/mtl.c index 083179d7..d32f3423 100644 --- a/media-proxy/src/mtl.c +++ b/media-proxy/src/mtl.c @@ -291,6 +291,7 @@ static int rx_st20p_query_ext_frame(void* priv, struct st_ext_frame* ext_frame, memif_buffer_t* rx_bufs = rx_ctx->shm_bufs; if (rx_ctx->shm_ready == 0) { + ERROR("MemIF connection not ready."); return -1; } @@ -310,6 +311,56 @@ static int rx_st20p_query_ext_frame(void* priv, struct st_ext_frame* ext_frame, return 0; } + +static int rx_st22p_query_ext_frame(void* priv, struct st_ext_frame* ext_frame, + struct st22_rx_frame_meta* meta) +{ + rx_st22p_session_context_t * rx_ctx = priv; + int err = 0; + + /* allocate memory */ + uint16_t qid = 0; + uint16_t buf_num = 1; + uint32_t buf_size = rx_ctx->frame_size; + uint16_t rx_buf_num = 0; + int width = rx_ctx->width, height = rx_ctx->height; + memif_buffer_t* rx_bufs = rx_ctx->shm_bufs; + + if (rx_ctx->shm_ready == 0) { + ERROR("MemIF connection not ready."); + return -1; + } + + err = memif_buffer_alloc(rx_ctx->memif_conn, qid, rx_bufs, buf_num, &rx_buf_num, buf_size); + if (err != MEMIF_ERR_SUCCESS) { + INFO("Failed to alloc memif buffer: %s", memif_strerror(err)); + return -1; + } + + uint8_t planes = st_frame_fmt_planes(rx_ctx->output_fmt); + size_t frame_size = rx_ctx->frame_size; + size_t pg_sz = mtl_page_size(rx_ctx->st); + rx_ctx->ext_fb_malloc = rx_bufs->data; + rx_ctx->ext_fb = (uint8_t*)MTL_ALIGN((uint64_t)rx_ctx->ext_fb_malloc, pg_sz); + rx_ctx->ext_fb_iova = rx_ctx->source_begin_iova + ((uint8_t*)rx_bufs->data - rx_ctx->source_begin); + + for (uint8_t plane = 0; plane < planes; plane++) { /* assume planes continuous */ + ext_frame->linesize[plane] = st_frame_least_linesize(rx_ctx->output_fmt, width, plane); + if (plane == 0) { + ext_frame->addr[plane] = rx_bufs->data; + ext_frame->iova[plane] = rx_ctx->ext_fb_iova; + } else { + ext_frame->addr[plane] = (uint8_t*)ext_frame->addr[plane - 1] + ext_frame->linesize[plane - 1] * height; + ext_frame->iova[plane] = ext_frame->iova[plane - 1] + ext_frame->linesize[plane - 1] * height; + } + } + ext_frame->size = frame_size; + + /* save your private data here get it from st_frame.opaque */ + ext_frame->opaque = rx_bufs; + + return 0; +} #endif static int tx_st20p_frame_available(void* priv) @@ -424,7 +475,6 @@ static int tx_st22p_frame_done(void* priv, struct st_frame* frame) return -1; /* not ready */ } - // conn = tx_ctx->memif_conn; conn = (memif_conn_handle_t)frame->opaque; if (conn == NULL) { return -1; @@ -442,11 +492,11 @@ static void rx_st20p_consume_frame(rx_session_context_t* s, struct st_frame* fra { int err = 0; uint16_t qid = 0; - memif_buffer_t* tx_bufs = NULL; + memif_buffer_t* rx_bufs = NULL; uint16_t buf_num = 1; memif_conn_handle_t conn; uint32_t buf_size = s->frame_size; - uint16_t tx_buf_num = 0, tx = 0; + uint16_t rx_buf_num = 0, rx = 0; if (s->shm_ready == 0) { INFO("%s memif not ready\n", __func__); @@ -456,39 +506,25 @@ static void rx_st20p_consume_frame(rx_session_context_t* s, struct st_frame* fra conn = s->memif_conn; #if defined(ZERO_COPY) || defined(RX_ZERO_COPY) - tx_bufs = (memif_buffer_t*)frame->opaque; - tx_buf_num = 1; + rx_bufs = (memif_buffer_t*)frame->opaque; + rx_buf_num = 1; #else /* allocate memory */ - tx_bufs = s->shm_bufs; + rx_bufs = s->shm_bufs; - err = memif_buffer_alloc(s->memif_conn, qid, tx_bufs, buf_num, &tx_buf_num, buf_size); + err = memif_buffer_alloc(s->memif_conn, qid, rx_bufs, buf_num, &rx_buf_num, buf_size); if (err != MEMIF_ERR_SUCCESS) { INFO("Failed to alloc memif buffer: %s", memif_strerror(err)); return; } - /* - printf("RX buf_size: %d request: %d, allocated: %d\n", buf_size, buf_num, tx_buf_num); - - FILE* fp = NULL; - fp = fopen("/tmp/tx.dat", "wb+"); - fwrite(frame->addr, buf_size, tx_buf_num, fp); - fclose(fp); - - for (int i = 0; i < tx_buf_num; i++) { - printf("TX data [%d]: point to %p, next is: %p (%d)\n", - i, tx_bufs->data, tx_bufs->data + buf_size, tx_bufs->flags); - } - */ - - for (int i = 0; i < tx_buf_num; i++) { - mtl_memcpy(tx_bufs->data, frame->addr[0], s->frame_size); + for (int i = 0; i < rx_buf_num; i++) { + mtl_memcpy(rx_bufs->data, frame->addr[0], s->frame_size); } #endif /* Send to microservice application. */ - err = memif_tx_burst(s->memif_conn, qid, tx_bufs, tx_buf_num, &tx); + err = memif_tx_burst(s->memif_conn, qid, rx_bufs, rx_buf_num, &rx); if (err != MEMIF_ERR_SUCCESS) { INFO("memif_tx_burst: %s", memif_strerror(err)); } @@ -500,11 +536,11 @@ static void rx_st22p_consume_frame(rx_st22p_session_context_t* s, struct st_fram { int err = 0; uint16_t qid = 0; - memif_buffer_t* tx_bufs = NULL; + memif_buffer_t* rx_bufs = NULL; uint16_t buf_num = 1; memif_conn_handle_t conn; uint32_t buf_size = s->frame_size; - uint16_t tx_buf_num = 0, tx = 0; + uint16_t rx_buf_num = 0, rx = 0; if (s->shm_ready == 0) { INFO("%s memif not ready\n", __func__); @@ -513,31 +549,36 @@ static void rx_st22p_consume_frame(rx_st22p_session_context_t* s, struct st_fram conn = s->memif_conn; +#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) + rx_bufs = (memif_buffer_t*)frame->opaque; + rx_buf_num = 1; +#else /* allocate memory */ - tx_bufs = s->shm_bufs; + rx_bufs = s->shm_bufs; - err = memif_buffer_alloc(s->memif_conn, qid, tx_bufs, buf_num, &tx_buf_num, buf_size); + err = memif_buffer_alloc(s->memif_conn, qid, rx_bufs, buf_num, &rx_buf_num, buf_size); if (err != MEMIF_ERR_SUCCESS) { INFO("Failed to alloc memif buffer: %s", memif_strerror(err)); return; } // void* testdata = malloc(s->frame_size); - // mtl_memcpy(tx_bufs->data, testdata, s->frame_size); + // mtl_memcpy(rx_bufs->data, testdata, s->frame_size); // mtl_memcpy(testdata, frame->addr, s->frame_size); uint8_t planes = st_frame_fmt_planes(frame->fmt); - uint8_t* dst = tx_bufs->data; + uint8_t* dst = rx_bufs->data; for (uint8_t plane = 0; plane < planes; plane++) { size_t plane_sz = st_frame_plane_size(frame, plane); mtl_memcpy(dst, frame->addr[plane], plane_sz); dst += plane_sz; } +#endif - // mtl_memcpy(tx_bufs->data, frame->addr, s->frame_size); + // mtl_memcpy(rx_bufs->data, frame->addr, s->frame_size); /* Send to microservice application. */ - err = memif_tx_burst(s->memif_conn, qid, tx_bufs, tx_buf_num, &tx); + err = memif_tx_burst(s->memif_conn, qid, rx_bufs, rx_buf_num, &rx); if (err != MEMIF_ERR_SUCCESS) { INFO("memif_tx_burst: %s", memif_strerror(err)); } @@ -697,9 +738,6 @@ static void* rx_st20p_frame_thread(void* arg) st20p_rx_put_frame(handle, frame); } - // printf("%s(%d), stop\n", __func__, s->idx); - s->fb_recv++; - return NULL; } @@ -728,9 +766,6 @@ static void* rx_st22p_frame_thread(void* arg) st22p_rx_put_frame(handle, frame); } - printf("%s(%d), stop\n", __func__, s->idx); - s->fb_recv++; - return NULL; } @@ -972,8 +1007,7 @@ int rx_st22p_shm_init(rx_st22p_session_context_t* rx_ctx, memif_ops_t* memif_ops rx_ctx->shm_ready = 0; rx_ctx->memif_conn_args.socket = rx_ctx->memif_socket; rx_ctx->memif_conn_args.interface_id = memif_ops->interface_id; - // rx_ctx->memif_conn_args.buffer_size = (uint32_t)rx_ctx->frame_size; - rx_ctx->memif_conn_args.buffer_size = 5184000; + rx_ctx->memif_conn_args.buffer_size = (uint32_t)rx_ctx->frame_size; rx_ctx->memif_conn_args.log2_ring_size = 2; memcpy((char*)rx_ctx->memif_conn_args.interface_name, memif_ops->interface_name, sizeof(rx_ctx->memif_conn_args.interface_name)); @@ -1851,6 +1885,8 @@ rx_st22p_session_context_t* mtl_st22p_rx_session_create(mtl_handle dev_handle, s rx_ctx->st = dev_handle; rx_ctx->idx = idx; rx_ctx->stop = false; + rx_ctx->fb_idx = 0; + st_pthread_mutex_init(&rx_ctx->st22p_wake_mutex, NULL); st_pthread_cond_init(&rx_ctx->st22p_wake_cond, NULL); @@ -1859,6 +1895,29 @@ rx_st22p_session_context_t* mtl_st22p_rx_session_create(mtl_handle dev_handle, s ops_rx.priv = rx_ctx; // app handle register to lib ops_rx.notify_frame_available = rx_st22p_frame_available; +#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) + ops_rx.flags |= ST22P_RX_FLAG_EXT_FRAME; + ops_rx.flags |= ST22P_RX_FLAG_RECEIVE_INCOMPLETE_FRAME; + ops_rx.query_ext_frame = rx_st22p_query_ext_frame; +#endif + + /* dump out parameters for debugging. */ + st_rx_st22p_debug_dump(ops_rx); + + st22p_rx_handle rx_handle = st22p_rx_create(dev_handle, &ops_rx); + if (!rx_handle) { + printf("%s, st22p_rx_create fail\n", __func__); + st_pthread_mutex_destroy(&rx_ctx->st22p_wake_mutex); + st_pthread_cond_destroy(&rx_ctx->st22p_wake_cond); + return NULL; + } + rx_ctx->handle = rx_handle; + rx_ctx->frame_size = st22p_rx_frame_size(rx_handle); + rx_ctx->fb_cnt = 3; + rx_ctx->width = ops_rx.width; + rx_ctx->height = ops_rx.height; + rx_ctx->output_fmt = ops_rx.output_fmt; + /* initialize share memory */ ret = rx_st22p_shm_init(rx_ctx, memif_ops); if (ret < 0) { @@ -1875,19 +1934,6 @@ rx_st22p_session_context_t* mtl_st22p_rx_session_create(mtl_handle dev_handle, s // sleep(1); // } - /* dump out parameters for debugging. */ - st_rx_st22p_debug_dump(ops_rx); - - st22p_rx_handle rx_handle = st22p_rx_create(dev_handle, &ops_rx); - if (!rx_handle) { - printf("%s, st22p_rx_create fail\n", __func__); - st_pthread_mutex_destroy(&rx_ctx->st22p_wake_mutex); - st_pthread_cond_destroy(&rx_ctx->st22p_wake_cond); - return NULL; - } - rx_ctx->handle = rx_handle; - rx_ctx->frame_size = st22p_rx_frame_size(rx_handle); - /* Start MTL session thread. */ ret = pthread_create(&rx_ctx->frame_thread, NULL, rx_st22p_frame_thread, rx_ctx); if (ret < 0) { diff --git a/media-proxy/src/shm_memif.c b/media-proxy/src/shm_memif.c index c92d1c30..6522c773 100644 --- a/media-proxy/src/shm_memif.c +++ b/media-proxy/src/shm_memif.c @@ -145,6 +145,7 @@ int rx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data) INFO("RX memif connected!"); +#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) memif_details_t md = { 0 }; ssize_t buflen = 2048; char* buf = (char*)calloc(1, buflen); @@ -157,8 +158,13 @@ int rx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data) } rx_ctx->fb_count = md.rx_queues[0].ring_size; + rx_ctx->source_begin = md.regions[1].addr; + rx_ctx->source_begin_iova = mtl_dma_map(rx_ctx->st, rx_ctx->source_begin, md.regions[1].size); free(buf); +#else + rx_ctx->fb_count = 3; +#endif /* rx buffers */ rx_ctx->shm_bufs = (memif_buffer_t*)malloc(sizeof(memif_buffer_t) * rx_ctx->fb_count); @@ -476,6 +482,24 @@ int tx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data) return err; } +#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) + memif_details_t md = { 0 }; + ssize_t buflen = 2048; + char* buf = (char*)calloc(1, buflen); + + err = memif_get_details(conn, &md, buf, buflen); + if (err != MEMIF_ERR_SUCCESS) { + INFO("%s", memif_strerror(err)); + free(buf); + return err; + } + + tx_ctx->source_begin = md.regions[1].addr; + tx_ctx->source_begin_iova = mtl_dma_map(tx_ctx->st, tx_ctx->source_begin, md.regions[1].size); + + free(buf); +#endif + tx_ctx->shm_ready = 1; print_memif_details(conn); From fc388e232fd851d6978f5869b3c527bf701e8e62 Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Thu, 14 Dec 2023 14:37:01 +0800 Subject: [PATCH 07/26] Enable Trivy Scan in CI. (#38) Signed-off-by: Han Qiang --- .github/workflows/trivy.yml | 27 +++++++++++++++++++++++++++ media-proxy/Dockerfile | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/trivy.yml diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml new file mode 100644 index 00000000..8517851f --- /dev/null +++ b/.github/workflows/trivy.yml @@ -0,0 +1,27 @@ +name: Trivy +on: + push: + branches: + - main + pull_request: +jobs: + scan: + name: Scan + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif' + diff --git a/media-proxy/Dockerfile b/media-proxy/Dockerfile index 3271a07a..955b5e71 100644 --- a/media-proxy/Dockerfile +++ b/media-proxy/Dockerfile @@ -74,7 +74,7 @@ RUN cmake -DgRPC_INSTALL=ON \ -DgRPC_BUILD_TESTS=OFF \ -DCMAKE_INSTALL_PREFIX=${PREFIX_DIR} \ ../.. && \ - make -j && \ + make -j `nproc` && \ make install && \ rm -rf /tmp/* From 7133e57db1f5011a0dfa96536dfe39e0dd88c5b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 22:27:47 +0800 Subject: [PATCH 08/26] Bump actions/checkout from 3 to 4 (#42) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/trivy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 8517851f..9a02985e 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run Trivy vulnerability scanner in repo mode uses: aquasecurity/trivy-action@master From 73a84ab33f513c3573835419214c19ca8c097b3a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 22:28:39 +0800 Subject: [PATCH 09/26] Bump github/codeql-action from 2 to 3 (#43) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](https://github.com/github/codeql-action/compare/v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- .github/workflows/trivy.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5e8a25b1..7a59f783 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -66,7 +66,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@305f6546310b9203e892c28c1484e82977f4f63d # v2.22.10 + uses: github/codeql-action/init@b374143c1149a9115d881581d29b8390bbcbb59c # v3.22.11 with: languages: ${{ matrix.language }} config-file: ${{github.workspace}}/.github/codeql/codeql-config.yml @@ -118,6 +118,6 @@ jobs: ./build.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@305f6546310b9203e892c28c1484e82977f4f63d # v2.22.10 + uses: github/codeql-action/analyze@b374143c1149a9115d881581d29b8390bbcbb59c # v3.22.11 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b35ed799..916c6a68 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -72,6 +72,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@305f6546310b9203e892c28c1484e82977f4f63d # v2.22.10 + uses: github/codeql-action/upload-sarif@b374143c1149a9115d881581d29b8390bbcbb59c # v3.22.11 with: sarif_file: results.sarif diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 9a02985e..8028bc8c 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -21,7 +21,7 @@ jobs: output: 'trivy-results.sarif' - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: 'trivy-results.sarif' From a373a1a81f04a37dc1c16ddf613a79947e88a318 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 23:07:06 +0800 Subject: [PATCH 10/26] Bump actions/upload-artifact from 3.1.3 to 4.0.0 (#44) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.3 to 4.0.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/a8a3f3ad30e3422c9c7b888a15615d19a852ae32...c7d193f32edcb7bfad88892161225aeda64e9392) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 916c6a68..eef83e5b 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -64,7 +64,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 with: name: SARIF file path: results.sarif From 69f576fffaf8953e5dee1990508005f404368067 Mon Sep 17 00:00:00 2001 From: StepSecurity Bot Date: Sat, 16 Dec 2023 19:56:02 -0800 Subject: [PATCH 11/26] [StepSecurity] ci: Harden GitHub Actions (#50) Signed-off-by: StepSecurity Bot --- .github/workflows/trivy.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 8028bc8c..ffed1b5d 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -4,16 +4,27 @@ on: branches: - main pull_request: +permissions: + contents: read + jobs: scan: + permissions: + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results name: Scan runs-on: ubuntu-20.04 steps: + - name: Harden Runner + uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1 + with: + egress-policy: audit + - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Run Trivy vulnerability scanner in repo mode - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@91713af97dc80187565512baba96e4364e983601 # master with: scan-type: 'fs' ignore-unfixed: true @@ -21,7 +32,7 @@ jobs: output: 'trivy-results.sarif' - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@b374143c1149a9115d881581d29b8390bbcbb59c # v3.22.11 with: sarif_file: 'trivy-results.sarif' From 92a30de10659a3a0011650bdbda6fdf338daf6db Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Mon, 18 Dec 2023 11:38:11 +0800 Subject: [PATCH 12/26] Fix issues for ST22 stream. (#41) Signed-off-by: Han Qiang --- media-proxy/include/mtl.h | 7 +- media-proxy/include/shm_memif.h | 13 +- media-proxy/src/mtl.c | 65 ++------ media-proxy/src/proxy_context.cc | 4 +- media-proxy/src/shm_memif.c | 253 ++++++++++++++++++++++++------- 5 files changed, 216 insertions(+), 126 deletions(-) diff --git a/media-proxy/include/mtl.h b/media-proxy/include/mtl.h index 289d4b0a..2d79c799 100644 --- a/media-proxy/include/mtl.h +++ b/media-proxy/include/mtl.h @@ -73,7 +73,6 @@ typedef struct { uint8_t* source_end; uint8_t* frame_cursor; - void* source_begin_malloc; mtl_iova_t source_begin_iova; size_t source_begin_iova_map_sz; #endif @@ -118,7 +117,6 @@ typedef struct { uint8_t* source_end; uint8_t* frame_cursor; - void* source_begin_malloc; mtl_iova_t source_begin_iova; size_t source_begin_iova_map_sz; #endif @@ -160,7 +158,6 @@ typedef struct { uint8_t* source_end; uint8_t* frame_cursor; - void* source_begin_malloc; mtl_iova_t source_begin_iova; size_t source_begin_iova_map_sz; @@ -206,7 +203,6 @@ typedef struct { size_t frame_size; /* Size (Bytes) of single frame. */ uint16_t fb_idx; uint32_t fb_count; /* Frame buffer count. */ - int fb_cnt; uint32_t width; uint32_t height; @@ -217,7 +213,6 @@ typedef struct { uint8_t* source_end; uint8_t* frame_cursor; - void* source_begin_malloc; mtl_iova_t source_begin_iova; size_t source_begin_iova_map_sz; @@ -504,7 +499,7 @@ void mtl_deinit(mtl_handle dev_handle); tx_session_context_t* mtl_st20p_tx_session_create(mtl_handle dev_handle, struct st20p_tx_ops* opts, memif_ops_t* memif_ops); /* RX: Create ST20P session */ -rx_session_context_t* mtl_rx_session_create(mtl_handle dev_handle, struct st20p_rx_ops* opts, memif_ops_t* memif_ops); +rx_session_context_t* mtl_st20p_rx_session_create(mtl_handle dev_handle, struct st20p_rx_ops* opts, memif_ops_t* memif_ops); /* TX: Stop ST20P session */ void mtl_st20p_tx_session_stop(tx_session_context_t* tx_ctx); diff --git a/media-proxy/include/shm_memif.h b/media-proxy/include/shm_memif.h index 12da348c..6ee8e5a0 100644 --- a/media-proxy/include/shm_memif.h +++ b/media-proxy/include/shm_memif.h @@ -42,24 +42,25 @@ typedef struct { /* informs user about connected status. private_ctx is used by user to identify * connection */ -int rx_on_connect(memif_conn_handle_t conn, void* priv_data); +int rx_st20p_on_connect(memif_conn_handle_t conn, void* priv_data); int rx_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid); /* informs user about disconnected status. private_ctx is used by user to * identify connection */ int rx_on_disconnect(memif_conn_handle_t conn, void* priv_data); +int rx_st20p_on_disconnect(memif_conn_handle_t conn, void* priv_data); int rx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data); -int rx_st22p_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid); +int rx_st22p_on_disconnect(memif_conn_handle_t conn, void* priv_data); int rx_st30_on_connect(memif_conn_handle_t conn, void* priv_data); -int rx_st30_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid); int rx_st40_on_connect(memif_conn_handle_t conn, void* priv_data); -int rx_st40_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid); int rx_udp_h264_on_connect(memif_conn_handle_t conn, void* priv_data); -int tx_on_connect(memif_conn_handle_t conn, void* priv_data); +int tx_st20p_on_connect(memif_conn_handle_t conn, void* priv_data); +int tx_st20p_on_disconnect(memif_conn_handle_t conn, void* priv_data); +int tx_st22p_on_disconnect(memif_conn_handle_t conn, void* priv_data); int tx_on_disconnect(memif_conn_handle_t conn, void* priv_data); -int tx_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid); +int tx_st20p_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid); int tx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data); int tx_st22p_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid); int tx_st30_on_connect(memif_conn_handle_t conn, void* priv_data); diff --git a/media-proxy/src/mtl.c b/media-proxy/src/mtl.c index d32f3423..e9ff110e 100644 --- a/media-proxy/src/mtl.c +++ b/media-proxy/src/mtl.c @@ -435,7 +435,6 @@ static int rx_st40_rtp_ready(void* priv) return 0; } -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) static int tx_st20p_frame_done(void* priv, struct st_frame* frame) { int err = 0; @@ -461,7 +460,6 @@ static int tx_st20p_frame_done(void* priv, struct st_frame* frame) return err; } -#endif static int tx_st22p_frame_done(void* priv, struct st_frame* frame) { @@ -873,7 +871,7 @@ static void* rx_memif_event_loop(void* arg) return NULL; } -int rx_shm_init(rx_session_context_t* rx_ctx, memif_ops_t* memif_ops) +int rx_st20p_shm_init(rx_session_context_t* rx_ctx, memif_ops_t* memif_ops) { int ret = 0; memif_ops_t default_memif_ops = { 0 }; @@ -936,7 +934,7 @@ int rx_shm_init(rx_session_context_t* rx_ctx, memif_ops_t* memif_ops) INFO("create memif interface."); ret = memif_create(&rx_ctx->memif_conn, &rx_ctx->memif_conn_args, - rx_on_connect, rx_on_disconnect, rx_on_receive, rx_ctx); + rx_st20p_on_connect, rx_st20p_on_disconnect, rx_on_receive, rx_ctx); if (ret != MEMIF_ERR_SUCCESS) { INFO("memif_create: %s", memif_strerror(ret)); return -1; @@ -1015,7 +1013,7 @@ int rx_st22p_shm_init(rx_st22p_session_context_t* rx_ctx, memif_ops_t* memif_ops INFO("create memif interface."); ret = memif_create(&rx_ctx->memif_conn, &rx_ctx->memif_conn_args, - rx_st22p_on_connect, rx_on_disconnect, rx_st22p_on_receive, rx_ctx); + rx_st22p_on_connect, rx_st22p_on_disconnect, rx_on_receive, rx_ctx); if (ret != MEMIF_ERR_SUCCESS) { INFO("memif_create: %s", memif_strerror(ret)); return -1; @@ -1249,7 +1247,7 @@ int tx_st40_shm_deinit(tx_st40_session_context_t* pctx) return 0; } -int tx_shm_init(tx_session_context_t* tx_ctx, memif_ops_t* memif_ops) +int tx_st20p_shm_init(tx_session_context_t* tx_ctx, memif_ops_t* memif_ops) { int ret = 0; const uint16_t FRAME_COUNT = 4; @@ -1317,7 +1315,7 @@ int tx_shm_init(tx_session_context_t* tx_ctx, memif_ops_t* memif_ops) INFO("Create memif interface."); ret = memif_create(&tx_ctx->memif_conn, &tx_ctx->memif_conn_args, - tx_on_connect, tx_on_disconnect, tx_on_receive, tx_ctx); + tx_st20p_on_connect, tx_st20p_on_disconnect, tx_st20p_on_receive, tx_ctx); if (ret != MEMIF_ERR_SUCCESS) { INFO("memif_create: %s", memif_strerror(ret)); free(tx_ctx->shm_bufs); @@ -1403,7 +1401,7 @@ int tx_st22p_shm_init(tx_st22p_session_context_t* tx_ctx, memif_ops_t* memif_ops INFO("Create memif interface."); ret = memif_create(&tx_ctx->memif_conn, &tx_ctx->memif_conn_args, - tx_st22p_on_connect, tx_on_disconnect, tx_st22p_on_receive, tx_ctx); + tx_st22p_on_connect, tx_st22p_on_disconnect, tx_st22p_on_receive, tx_ctx); if (ret != MEMIF_ERR_SUCCESS) { INFO("memif_create: %s", memif_strerror(ret)); free(tx_ctx->shm_bufs); @@ -1563,7 +1561,7 @@ int rx_st30_shm_init(rx_st30_session_context_t* rx_ctx, memif_ops_t* memif_ops) INFO("Create memif interface."); ret = memif_create(&rx_ctx->memif_conn, &rx_ctx->memif_conn_args, - rx_st30_on_connect, rx_on_disconnect, rx_st30_on_receive, rx_ctx); + rx_st30_on_connect, rx_on_disconnect, rx_on_receive, rx_ctx); if (ret != MEMIF_ERR_SUCCESS) { INFO("memif_create: %s", memif_strerror(ret)); return -1; @@ -1728,7 +1726,7 @@ int rx_st40_shm_init(rx_st40_session_context_t* rx_ctx, memif_ops_t* memif_ops) INFO("Create memif interface."); ret = memif_create(&rx_ctx->memif_conn, &rx_ctx->memif_conn_args, - rx_st40_on_connect, rx_on_disconnect, rx_st40_on_receive, rx_ctx); + rx_st40_on_connect, rx_on_disconnect, rx_on_receive, rx_ctx); if (ret != MEMIF_ERR_SUCCESS) { INFO("memif_create: %s", memif_strerror(ret)); return -1; @@ -1745,7 +1743,7 @@ int rx_st40_shm_init(rx_st40_session_context_t* rx_ctx, memif_ops_t* memif_ops) } /* Create new RX session */ -rx_session_context_t* mtl_rx_session_create(mtl_handle dev_handle, struct st20p_rx_ops* opts, memif_ops_t* memif_ops) +rx_session_context_t* mtl_st20p_rx_session_create(mtl_handle dev_handle, struct st20p_rx_ops* opts, memif_ops_t* memif_ops) { int ret = 0; static int idx = 0; @@ -1802,7 +1800,7 @@ rx_session_context_t* mtl_rx_session_create(mtl_handle dev_handle, struct st20p_ rx_ctx->frame_size = st20_frame_size(ops_rx.transport_fmt, ops_rx.width, ops_rx.height); /* initialize share memory */ - ret = rx_shm_init(rx_ctx, memif_ops); + ret = rx_st20p_shm_init(rx_ctx, memif_ops); if (ret < 0) { printf("%s, fail to initialize share memory.\n", __func__); st_pthread_mutex_destroy(&rx_ctx->wake_mutex); @@ -1913,7 +1911,6 @@ rx_st22p_session_context_t* mtl_st22p_rx_session_create(mtl_handle dev_handle, s } rx_ctx->handle = rx_handle; rx_ctx->frame_size = st22p_rx_frame_size(rx_handle); - rx_ctx->fb_cnt = 3; rx_ctx->width = ops_rx.width; rx_ctx->height = ops_rx.height; rx_ctx->output_fmt = ops_rx.output_fmt; @@ -2442,10 +2439,10 @@ tx_session_context_t* mtl_st20p_tx_session_create(mtl_handle dev_handle, struct ops_tx.priv = tx_ctx; // app handle register to lib ops_tx.notify_frame_available = tx_st20p_frame_available; + ops_tx.notify_frame_done = tx_st20p_frame_done; #if defined(ZERO_COPY) || defined(TX_ZERO_COPY) ops_tx.flags |= ST20P_TX_FLAG_EXT_FRAME; - ops_tx.notify_frame_done = tx_st20p_frame_done; #endif /* dump out parameters for debugging. */ @@ -2462,7 +2459,7 @@ tx_session_context_t* mtl_st20p_tx_session_create(mtl_handle dev_handle, struct tx_ctx->frame_size = st20_frame_size(ops_tx.transport_fmt, ops_tx.width, ops_tx.height); /* initialize share memory */ - ret = tx_shm_init(tx_ctx, memif_ops); + ret = tx_st20p_shm_init(tx_ctx, memif_ops); if (ret < 0) { printf("%s, fail to initialize share memory.\n", __func__); st_pthread_mutex_destroy(&tx_ctx->wake_mutex); @@ -2531,39 +2528,6 @@ tx_st22p_session_context_t* mtl_st22p_tx_session_create(mtl_handle dev_handle, s tx_ctx->handle = tx_handle; tx_ctx->frame_size = st22p_tx_frame_size(tx_handle); -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) - uint8_t planes = st_frame_fmt_planes(ops_tx.input_fmt); - size_t frame_size = tx_ctx->frame_size; - - tx_ctx->p_ext_frames = (struct st_ext_frame*)malloc( - sizeof(*tx_ctx->p_ext_frames) * tx_ctx->fb_cnt); - size_t pg_sz = mtl_page_size(dev_handle); - size_t fb_size = tx_ctx->frame_size * tx_ctx->fb_cnt; - tx_ctx->ext_fb_iova_map_sz = mtl_size_page_align(fb_size, pg_sz); /* align */ - size_t fb_size_malloc = tx_ctx->ext_fb_iova_map_sz + pg_sz; - tx_ctx->ext_fb_malloc = calloc(1, fb_size_malloc); - assert(tx_ctx->ext_fb_malloc != NULL); - tx_ctx->ext_fb = (uint8_t*)MTL_ALIGN((uint64_t)tx_ctx->ext_fb_malloc, pg_sz); - tx_ctx->ext_fb_iova = mtl_dma_map(dev_handle, tx_ctx->ext_fb, tx_ctx->ext_fb_iova_map_sz); - assert(tx_ctx->ext_fb_iova != MTL_BAD_IOVA); - INFO("%s, session %d ext_fb %p\n", __func__, tx_ctx->idx, tx_ctx->ext_fb); - - for (int j = 0; j < tx_ctx->fb_cnt; j++) { - for (uint8_t plane = 0; plane < planes; plane++) { /* assume planes continuous */ - tx_ctx->p_ext_frames[j].linesize[plane] = st_frame_least_linesize(ops_tx.input_fmt, ops_tx.width, plane); - if (plane == 0) { - tx_ctx->p_ext_frames[j].addr[plane] = tx_ctx->ext_fb + j * frame_size; - tx_ctx->p_ext_frames[j].iova[plane] = tx_ctx->ext_fb_iova + j * frame_size; - } else { - tx_ctx->p_ext_frames[j].addr[plane] = (uint8_t*)tx_ctx->p_ext_frames[j].addr[plane - 1] + tx_ctx->p_ext_frames[j].linesize[plane - 1] * ops_tx.height; - tx_ctx->p_ext_frames[j].iova[plane] = tx_ctx->p_ext_frames[j].iova[plane - 1] + tx_ctx->p_ext_frames[j].linesize[plane - 1] * ops_tx.height; - } - } - tx_ctx->p_ext_frames[j].size = frame_size; - tx_ctx->p_ext_frames[j].opaque = NULL; - } -#endif - /* initialize share memory */ ret = tx_st22p_shm_init(tx_ctx, memif_ops); if (ret < 0) { @@ -2627,11 +2591,6 @@ void mtl_st22p_tx_session_destroy(tx_st22p_session_context_t** p_tx_ctx) return; } - if (tx_ctx->ext_fb_malloc) { - free(tx_ctx->ext_fb_malloc); - tx_ctx->ext_fb_malloc = NULL; - } - printf("%s, fb_send %d\n", __func__, tx_ctx->fb_send); if (st22p_tx_free(tx_ctx->handle) < 0) { printf("%s, session free failed\n", __func__); diff --git a/media-proxy/src/proxy_context.cc b/media-proxy/src/proxy_context.cc index d94f7f40..77131816 100644 --- a/media-proxy/src/proxy_context.cc +++ b/media-proxy/src/proxy_context.cc @@ -668,7 +668,7 @@ int ProxyContext::RxStart(const RxControlRequest* request) ParseMemIFParam(request, memif_ops); - rx_ctx = mtl_rx_session_create(mDevHandle, &opts, &memif_ops); + rx_ctx = mtl_st20p_rx_session_create(mDevHandle, &opts, &memif_ops); if (rx_ctx == NULL) { INFO("%s, Fail to create RX session.\n", __func__); return -1; @@ -849,7 +849,7 @@ int ProxyContext::RxStart(const mcm_conn_param* request) struct st20p_rx_ops opts = {}; ParseSt20RxOps(request, &opts); - rx_ctx = mtl_rx_session_create(mDevHandle, &opts, &memif_ops); + rx_ctx = mtl_st20p_rx_session_create(mDevHandle, &opts, &memif_ops); if (rx_ctx == NULL) { INFO("%s, Fail to create RX session.\n", __func__); return -1; diff --git a/media-proxy/src/shm_memif.c b/media-proxy/src/shm_memif.c index 6522c773..aeb4b3bb 100644 --- a/media-proxy/src/shm_memif.c +++ b/media-proxy/src/shm_memif.c @@ -93,7 +93,7 @@ void print_memif_details(memif_conn_handle_t conn) /* informs user about connected status. private_ctx is used by user to identify * connection */ -int rx_on_connect(memif_conn_handle_t conn, void* priv_data) +int rx_st20p_on_connect(memif_conn_handle_t conn, void* priv_data) { rx_session_context_t* rx_ctx = (rx_session_context_t*)priv_data; int err = 0; @@ -114,7 +114,12 @@ int rx_on_connect(memif_conn_handle_t conn, void* priv_data) rx_ctx->fb_count = md.tx_queues[0].ring_size; rx_ctx->source_begin = md.regions[1].addr; + rx_ctx->source_begin_iova_map_sz = md.regions[1].size; rx_ctx->source_begin_iova = mtl_dma_map(rx_ctx->st, rx_ctx->source_begin, md.regions[1].size); + if (rx_ctx->source_begin_iova == MTL_BAD_IOVA) { + ERROR("Fail to map DMA memory address."); + return -1; + } free(buf); #else @@ -159,7 +164,12 @@ int rx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data) rx_ctx->fb_count = md.rx_queues[0].ring_size; rx_ctx->source_begin = md.regions[1].addr; + rx_ctx->source_begin_iova_map_sz = md.regions[1].size; rx_ctx->source_begin_iova = mtl_dma_map(rx_ctx->st, rx_ctx->source_begin, md.regions[1].size); + if (rx_ctx->source_begin_iova == MTL_BAD_IOVA) { + ERROR("Fail to map DMA memory address."); + return -1; + } free(buf); #else @@ -222,28 +232,6 @@ int rx_st30_on_connect(memif_conn_handle_t conn, void* priv_data) return 0; } -int rx_st30_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) -{ - int err = 0; - memif_buffer_t shm_bufs; - uint16_t buf_num = 0; - - /* receive packets from the shared memory */ - err = memif_rx_burst(conn, qid, &shm_bufs, 1, &buf_num); - if (err != MEMIF_ERR_SUCCESS && err != MEMIF_ERR_NOBUF) { - INFO("memif_rx_burst: %s", memif_strerror(err)); - return err; - } - - /* Process on the received buffer. */ - - err = memif_refill_queue(conn, qid, buf_num, 0); - if (err != MEMIF_ERR_SUCCESS) - INFO("memif_refill_queue: %s", memif_strerror(err)); - - return 0; -} - int rx_st40_on_connect(memif_conn_handle_t conn, void* priv_data) { rx_st40_session_context_t* rx_ctx = (rx_st40_session_context_t*)priv_data; @@ -283,28 +271,6 @@ int rx_st40_on_connect(memif_conn_handle_t conn, void* priv_data) return 0; } -int rx_st40_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) -{ - int err = 0; - memif_buffer_t shm_bufs; - uint16_t buf_num = 0; - - /* receive packets from the shared memory */ - err = memif_rx_burst(conn, qid, &shm_bufs, 1, &buf_num); - if (err != MEMIF_ERR_SUCCESS && err != MEMIF_ERR_NOBUF) { - INFO("memif_rx_burst: %s", memif_strerror(err)); - return err; - } - - /* Process on the received buffer. */ - - err = memif_refill_queue(conn, qid, buf_num, 0); - if (err != MEMIF_ERR_SUCCESS) - INFO("memif_refill_queue: %s", memif_strerror(err)); - - return 0; -} - int rx_udp_h264_on_connect(memif_conn_handle_t conn, void* priv_data) { rx_udp_h264_session_context_t* rx_ctx = (rx_udp_h264_session_context_t*)priv_data; @@ -409,29 +375,95 @@ int rx_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) return 0; } -int rx_st22p_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) +/* informs user about disconnected status. private_ctx is used by user to + * identify connection */ +int rx_st20p_on_disconnect(memif_conn_handle_t conn, void* priv_data) { int err = 0; - memif_buffer_t shm_bufs; - uint16_t buf_num = 0; + rx_session_context_t* rx_ctx = priv_data; + memif_socket_handle_t socket; - /* receive packets from the shared memory */ - err = memif_rx_burst(conn, qid, &shm_bufs, 1, &buf_num); - if (err != MEMIF_ERR_SUCCESS && err != MEMIF_ERR_NOBUF) { - INFO("memif_rx_burst: %s", memif_strerror(err)); - return err; + if (conn == NULL) { + return 0; } - /* Process on the received buffer. */ + if (conn == NULL || priv_data == NULL) { + INFO("Invalid Parameters."); + return -1; + } - err = memif_refill_queue(conn, qid, buf_num, 0); - if (err != MEMIF_ERR_SUCCESS) - INFO("memif_refill_queue: %s", memif_strerror(err)); + // release session + if (rx_ctx->shm_ready == 0) { + return 0; + } + rx_ctx->shm_ready = 0; + + // mtl_st20p_rx_session_destroy(&rx_ctx); + +#if defined(ZERO_COPY) + if (mtl_dma_unmap(rx_ctx->st, rx_ctx->source_begin, rx_ctx->source_begin_iova, rx_ctx->source_begin_iova_map_sz) < 0) { + ERROR("Fail to unmap DMA memory address."); + } +#endif + + /* stop event polling thread */ + INFO("RX Stop poll event\n"); + socket = memif_get_socket_handle(conn); + if (socket == NULL) { + INFO("Invalide socket handle."); + return -1; + } + + err = memif_cancel_poll_event(socket); + if (err != MEMIF_ERR_SUCCESS) { + INFO("We are doomed..."); + } + + // free(priv_data); return 0; } -int tx_on_connect(memif_conn_handle_t conn, void* priv_data) +int rx_st22p_on_disconnect(memif_conn_handle_t conn, void* priv_data) +{ + int err = 0; + rx_st22p_session_context_t* rx_ctx = priv_data; + memif_socket_handle_t socket; + + if (conn == NULL || priv_data == NULL) { + INFO("Invalid Parameters."); + return -1; + } + + // release session + if (rx_ctx->shm_ready == 0) { + return 0; + } + rx_ctx->shm_ready = 0; + +#if defined(ZERO_COPY) + if (mtl_dma_unmap(rx_ctx->st, rx_ctx->source_begin, rx_ctx->source_begin_iova, rx_ctx->source_begin_iova_map_sz) < 0) { + ERROR("Fail to unmap DMA memory address."); + } +#endif + + /* stop event polling thread */ + INFO("RX Stop poll event\n"); + socket = memif_get_socket_handle(conn); + if (socket == NULL) { + INFO("Invalide socket handle."); + return -1; + } + + err = memif_cancel_poll_event(socket); + if (err != MEMIF_ERR_SUCCESS) { + INFO("We are doomed..."); + } + + return 0; +} + +int tx_st20p_on_connect(memif_conn_handle_t conn, void* priv_data) { tx_session_context_t* tx_ctx = (tx_session_context_t*)priv_data; int err = 0; @@ -457,7 +489,12 @@ int tx_on_connect(memif_conn_handle_t conn, void* priv_data) } tx_ctx->source_begin = md.regions[1].addr; + tx_ctx->source_begin_iova_map_sz = md.regions[1].size; tx_ctx->source_begin_iova = mtl_dma_map(tx_ctx->st, tx_ctx->source_begin, md.regions[1].size); + if (tx_ctx->source_begin_iova == MTL_BAD_IOVA) { + ERROR("Fail to map DMA memory address."); + return -1; + } free(buf); #endif @@ -495,7 +532,12 @@ int tx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data) } tx_ctx->source_begin = md.regions[1].addr; + tx_ctx->source_begin_iova_map_sz = md.regions[1].size; tx_ctx->source_begin_iova = mtl_dma_map(tx_ctx->st, tx_ctx->source_begin, md.regions[1].size); + if (tx_ctx->source_begin_iova == MTL_BAD_IOVA) { + ERROR("Fail to map DMA memory address."); + return -1; + } free(buf); #endif @@ -547,6 +589,98 @@ int tx_on_disconnect(memif_conn_handle_t conn, void* priv_data) return 0; } +/* informs user about disconnected status. private_ctx is used by user to + * identify connection */ +int tx_st20p_on_disconnect(memif_conn_handle_t conn, void* priv_data) +{ + static int counter = 0; + int err = 0; + tx_session_context_t* tx_ctx = priv_data; + memif_socket_handle_t socket; + + if (conn == NULL || priv_data == NULL) { + INFO("Invalid Parameters."); + return -1; + } + + // release session + if (tx_ctx->shm_ready == 0) { + return 0; + } + tx_ctx->shm_ready = 0; + + // mtl_st20p_tx_session_destroy(&tx_ctx); + +#if defined(ZERO_COPY) + if (mtl_dma_unmap(tx_ctx->st, tx_ctx->source_begin, tx_ctx->source_begin_iova, tx_ctx->source_begin_iova_map_sz) < 0) { + ERROR("Fail to unmap DMA memory address."); + } +#endif + + /* stop event polling thread */ + INFO("TX Stop poll event"); + socket = memif_get_socket_handle(conn); + if (socket == NULL) { + INFO("Invalide socket handle."); + return -1; + } + + err = memif_cancel_poll_event(socket); + if (err != MEMIF_ERR_SUCCESS) { + INFO("We are doomed..."); + } + + // free(priv_data); + + return 0; +} + +/* informs user about disconnected status. private_ctx is used by user to + * identify connection */ +int tx_st22p_on_disconnect(memif_conn_handle_t conn, void* priv_data) +{ + static int counter = 0; + int err = 0; + tx_st22p_session_context_t* tx_ctx = priv_data; + memif_socket_handle_t socket; + + if (conn == NULL || priv_data == NULL) { + INFO("Invalid Parameters."); + return -1; + } + + // release session + if (tx_ctx->shm_ready == 0) { + return 0; + } + tx_ctx->shm_ready = 0; + + // mtl_st22p_tx_session_destroy(&tx_ctx); + +#if defined(ZERO_COPY) + if (mtl_dma_unmap(tx_ctx->st, tx_ctx->source_begin, tx_ctx->source_begin_iova, tx_ctx->source_begin_iova_map_sz) < 0) { + ERROR("Fail to unmap DMA memory address."); + } +#endif + + /* stop event polling thread */ + INFO("TX Stop poll event"); + socket = memif_get_socket_handle(conn); + if (socket == NULL) { + INFO("Invalide socket handle."); + return -1; + } + + err = memif_cancel_poll_event(socket); + if (err != MEMIF_ERR_SUCCESS) { + INFO("We are doomed..."); + } + + // free(priv_data); + + return 0; +} + static void tx_st20p_build_frame(memif_buffer_t shm_bufs, struct st_frame* frame) { mtl_memcpy(frame->addr[0], shm_bufs.data, shm_bufs.len); @@ -578,7 +712,7 @@ static void tx_st40_build_frame(memif_buffer_t shm_bufs, struct st40_frame* dst) dst->data_size = shm_bufs.len; } -int tx_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) +int tx_st20p_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) { int err = 0; tx_session_context_t* tx_ctx = (tx_session_context_t*)priv_data; @@ -630,6 +764,7 @@ int tx_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) #else /* fill frame data. */ tx_st20p_build_frame(shm_bufs, frame); + /* Send out frame. */ st20p_tx_put_frame(handle, frame); err = memif_refill_queue(conn, qid, buf_num, 0); From dac76c0a9e23cb53ce4e50df9ef84dcf3cb5ff07 Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Mon, 18 Dec 2023 12:55:34 +0800 Subject: [PATCH 13/26] Support XDP Backend of IMTL. (#37) Signed-off-by: Han Qiang --- media-proxy/protos/controller.proto | 5 ++++- media-proxy/src/proxy_context.cc | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/media-proxy/protos/controller.proto b/media-proxy/protos/controller.proto index 86be54df..341592fc 100644 --- a/media-proxy/protos/controller.proto +++ b/media-proxy/protos/controller.proto @@ -20,7 +20,10 @@ service Configure { enum StPmdType { ST_PMD_DPDK_USER = 0; ST_PMD_DPDK_AF_XDP = 1; - ST_PMD_TYPE_MAX = 2; + ST_PMD_DPDK_AF_PACKET = 2; + ST_PMD_KERNEL_SOCKET = 3; + ST_PMD_NATIVE_AF_XDP = 4; + ST_PMD_TYPE_MAX = 5; }; enum StLogLevel { diff --git a/media-proxy/src/proxy_context.cc b/media-proxy/src/proxy_context.cc index 77131816..e49e5278 100644 --- a/media-proxy/src/proxy_context.cc +++ b/media-proxy/src/proxy_context.cc @@ -112,6 +112,7 @@ void ProxyContext::ParseStInitParam(const TxControlRequest* request, struct mtl_ st_param->sip_addr[MTL_PORT_P][i] = init.primary_sip_addr(i); } + st_param->pmd[MTL_PORT_P] = mtl_pmd_by_port_name(st_param->port[MTL_PORT_P]); st_param->flags = init.flags(); st_param->log_level = (enum mtl_log_level)init.log_level(); st_param->priv = NULL; @@ -154,6 +155,7 @@ void ProxyContext::ParseStInitParam(const RxControlRequest* request, struct mtl_ st_param->sip_addr[MTL_PORT_P][i] = init.primary_sip_addr(i); } + st_param->pmd[MTL_PORT_P] = mtl_pmd_by_port_name(st_param->port[MTL_PORT_P]); st_param->flags = init.flags(); st_param->log_level = (enum mtl_log_level)init.log_level(); st_param->priv = NULL; @@ -188,6 +190,7 @@ void ProxyContext::ParseStInitParam(const mcm_conn_param* request, struct mtl_in { strncpy(st_param->port[MTL_PORT_P], getDevicePort().c_str(), MTL_PORT_MAX_LEN); inet_pton(AF_INET, getDataPlaneAddress().c_str(), st_param->sip_addr[MTL_PORT_P]); + st_param->pmd[MTL_PORT_P] = mtl_pmd_by_port_name(st_param->port[MTL_PORT_P]); st_param->num_ports = 1; st_param->flags = MTL_FLAG_BIND_NUMA; st_param->flags |= MTL_FLAG_SHARED_RX_QUEUE; From 89f09f9491926022e320968a1699f35d2de4014a Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Mon, 18 Dec 2023 12:57:01 +0800 Subject: [PATCH 14/26] Deploy sample application with K8s. (#36) Signed-off-by: Han Qiang --- deployment/DaemonSet/media-proxy-rx.yaml | 82 +++++++++++++++++++++++ deployment/DaemonSet/media-proxy-tx.yaml | 82 +++++++++++++++++++++++ deployment/DaemonSet/media-proxy.yaml | 11 ++- deployment/Deployments/sample-app-rx.yaml | 48 +++++++++++++ deployment/Deployments/sample-app-tx.yaml | 48 +++++++++++++ deployment/namespace.yaml | 5 ++ deployment/pv.yaml | 16 +++++ deployment/pvc.yaml | 14 ++++ deployment/setup.sh | 73 ++++++++++++++++---- media-proxy/Dockerfile | 18 ++--- sdk/Dockerfile | 74 ++++++++++++++++++++ sdk/samples/recver_app.c | 1 - sdk/samples/sender_app.c | 4 +- 13 files changed, 449 insertions(+), 27 deletions(-) create mode 100644 deployment/DaemonSet/media-proxy-rx.yaml create mode 100644 deployment/DaemonSet/media-proxy-tx.yaml create mode 100644 deployment/Deployments/sample-app-rx.yaml create mode 100644 deployment/Deployments/sample-app-tx.yaml create mode 100644 deployment/namespace.yaml create mode 100644 deployment/pv.yaml create mode 100644 deployment/pvc.yaml create mode 100644 sdk/Dockerfile diff --git a/deployment/DaemonSet/media-proxy-rx.yaml b/deployment/DaemonSet/media-proxy-rx.yaml new file mode 100644 index 00000000..2bfaddb5 --- /dev/null +++ b/deployment/DaemonSet/media-proxy-rx.yaml @@ -0,0 +1,82 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: media-proxy-rx + namespace: mcm + labels: + app: media-proxy-rx +spec: + selector: + matchLabels: + app: media-proxy-rx + template: + metadata: + labels: + app: media-proxy-rx + spec: + nodeSelector: + node-role.kubernetes.io/worker: "true" + mcm-type: rx + containers: + - name: media-proxy-rx + image: mcm/media-proxy:latest + imagePullPolicy: Never + command: [ "media_proxy" ] + args: [ "-d", "0000:31:11.5", "-i", "192.168.96.20" ] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + resources: + limits: + cpu: 2 + memory: 8Gi + hugepages-2Mi: 1Gi + hugepages-1Gi: 2Gi + securityContext: + privileged: true + runAsUser: 0 + runAsGroup: 0 + ports: + - containerPort: 8001 + hostPort: 8001 + protocol: TCP + name: grpc-port + - containerPort: 8002 + hostPort: 8002 + protocol: TCP + name: sdk-port + volumeMounts: + - name: memif-dir # Using hostPath volume + mountPath: /run/mcm # Mount path in the pod + - name: dev-vfio + mountPath: /dev/vfio + - mountPath: /hugepages-2Mi + name: hugepage-2mi + - mountPath: /hugepages-1Gi + name: hugepage-1gi + - mountPath: /dev/shm + name: cache-volume + - name: imtl-mgr # Communicate with IMTL manager + mountPath: /var/run/imtl # Mount path in the pod + volumes: + - name: memif-dir # Using hostPath volume + hostPath: + path: /tmp/mcm/memif + - name: dev-vfio + hostPath: + path: /dev/vfio + - name: hugepage-2mi + emptyDir: + medium: HugePages-2Mi + - name: hugepage-1gi + emptyDir: + medium: HugePages-1Gi + - name: cache-volume + emptyDir: + medium: Memory + sizeLimit: 4Gi + - name: imtl-mgr + persistentVolumeClaim: + claimName: imtl-pvc diff --git a/deployment/DaemonSet/media-proxy-tx.yaml b/deployment/DaemonSet/media-proxy-tx.yaml new file mode 100644 index 00000000..4ecdd72d --- /dev/null +++ b/deployment/DaemonSet/media-proxy-tx.yaml @@ -0,0 +1,82 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: media-proxy-tx + namespace: mcm + labels: + app: media-proxy-tx +spec: + selector: + matchLabels: + app: media-proxy-tx + template: + metadata: + labels: + app: media-proxy-tx + spec: + nodeSelector: + node-role.kubernetes.io/worker: "true" + mcm-type: tx + containers: + - name: media-proxy-tx + image: mcm/media-proxy:latest + imagePullPolicy: Never + command: [ "media_proxy" ] + args: [ "-d", "0000:31:01.5", "-i", "192.168.96.10" ] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + resources: + limits: + cpu: 2 + memory: 8Gi + hugepages-2Mi: 1Gi + hugepages-1Gi: 2Gi + securityContext: + privileged: true + runAsUser: 0 + runAsGroup: 0 + ports: + - containerPort: 8001 + hostPort: 8001 + protocol: TCP + name: grpc-port + - containerPort: 8002 + hostPort: 8002 + protocol: TCP + name: sdk-port + volumeMounts: + - name: memif-dir # Using hostPath volume + mountPath: /run/mcm # Mount path in the pod + - name: dev-vfio + mountPath: /dev/vfio + - mountPath: /hugepages-2Mi + name: hugepage-2mi + - mountPath: /hugepages-1Gi + name: hugepage-1gi + - mountPath: /dev/shm + name: cache-volume + - name: imtl-mgr # Communicate with IMTL manager + mountPath: /var/run/imtl # Mount path in the pod + volumes: + - name: memif-dir # Using hostPath volume + hostPath: + path: /tmp/mcm/memif + - name: dev-vfio + hostPath: + path: /dev/vfio + - name: hugepage-2mi + emptyDir: + medium: HugePages-2Mi + - name: hugepage-1gi + emptyDir: + medium: HugePages-1Gi + - name: cache-volume + emptyDir: + medium: Memory + sizeLimit: 4Gi + - name: imtl-mgr + persistentVolumeClaim: + claimName: imtl-pvc diff --git a/deployment/DaemonSet/media-proxy.yaml b/deployment/DaemonSet/media-proxy.yaml index e850dacf..d1de9494 100644 --- a/deployment/DaemonSet/media-proxy.yaml +++ b/deployment/DaemonSet/media-proxy.yaml @@ -32,7 +32,7 @@ spec: app: media-proxy spec: nodeSelector: - node-role.mcm.intel.com/worker: "true" + node-role.kubernetes.io/worker: "true" containers: - name: media-proxy image: mcm/media-proxy:latest @@ -53,6 +53,15 @@ spec: privileged: true runAsUser: 0 runAsGroup: 0 + ports: + - containerPort : 8001 + hostPort: 8001 + protocol: TCP + name: grpc-port + - containerPort : 8002 + hostPort: 8002 + protocol: TCP + name: sdk-port volumeMounts: - name: memif-socket mountPath: /run/mcm diff --git a/deployment/Deployments/sample-app-rx.yaml b/deployment/Deployments/sample-app-rx.yaml new file mode 100644 index 00000000..6de6b0b1 --- /dev/null +++ b/deployment/Deployments/sample-app-rx.yaml @@ -0,0 +1,48 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: sample-app-rx + namespace: mcm + labels: + app: sample-app-rx +spec: + ttlSecondsAfterFinished: 1 + template: + metadata: + labels: + app: sample-app-rx + spec: + restartPolicy: "Never" + nodeSelector: + node-role.kubernetes.io/worker: "true" + mcm-type: rx + containers: + - name: sample-app-rx + image: mcm/sample-app:latest + imagePullPolicy: Never + workingDir: /opt/mcm/sdk/out/samples + command: ["./recver_app"] + args: ["-w", "1920", "-h", "1080", "-f", "30", "-r", "192.168.96.10", "-p", "10000", "-t", "st20"] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: MCM_MEDIA_PROXY_PORT + value: "8002" + - name: MCM_MEDIA_PROXY_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + volumeMounts: + - name: memif-dir # Using hostPath volume + mountPath: /run/mcm # Mount path in the pod + - name: imtl-mgr # Communicate with IMTL manager + mountPath: /var/run/imtl # Mount path in the pod + volumes: + - name: memif-dir # Using hostPath volume + hostPath: + path: /tmp/mcm/memif + - name: imtl-mgr + persistentVolumeClaim: + claimName: imtl-pvc diff --git a/deployment/Deployments/sample-app-tx.yaml b/deployment/Deployments/sample-app-tx.yaml new file mode 100644 index 00000000..3b7ba148 --- /dev/null +++ b/deployment/Deployments/sample-app-tx.yaml @@ -0,0 +1,48 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: sample-app-tx + namespace: mcm + labels: + app: sample-app-tx +spec: + ttlSecondsAfterFinished: 1 + template: + metadata: + labels: + app: sample-app-tx + spec: + restartPolicy: "Never" + nodeSelector: + node-role.kubernetes.io/worker: "true" + mcm-type: tx + containers: + - name: sample-app-tx + image: mcm/sample-app:latest + imagePullPolicy: Never + workingDir: /opt/mcm/sdk/out/samples + command: ["./sender_app"] + args: ["-w", "1920", "-h", "1080", "-f", "30", "-s", "192.168.96.20", "-p", "10000", "-t", "st20", "-n", "3000"] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: MCM_MEDIA_PROXY_PORT + value: "8002" + - name: MCM_MEDIA_PROXY_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + volumeMounts: + - name: memif-dir # Using hostPath volume + mountPath: /run/mcm # Mount path in the pod + - name: imtl-mgr # Communicate with IMTL manager + mountPath: /var/run/imtl # Mount path in the pod + volumes: + - name: memif-dir # Using hostPath volume + hostPath: + path: /tmp/mcm/memif + - name: imtl-mgr + persistentVolumeClaim: + claimName: imtl-pvc diff --git a/deployment/namespace.yaml b/deployment/namespace.yaml new file mode 100644 index 00000000..da31f1bb --- /dev/null +++ b/deployment/namespace.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: mcm + diff --git a/deployment/pv.yaml b/deployment/pv.yaml new file mode 100644 index 00000000..29e4e24a --- /dev/null +++ b/deployment/pv.yaml @@ -0,0 +1,16 @@ +# pv.yaml +apiVersion: v1 +kind: PersistentVolume +metadata: + name: imtl-pv + namespace: mcm +spec: + capacity: + storage: 1Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: manual + hostPath: + path: "/var/run/imtl" diff --git a/deployment/pvc.yaml b/deployment/pvc.yaml new file mode 100644 index 00000000..caff9d8f --- /dev/null +++ b/deployment/pvc.yaml @@ -0,0 +1,14 @@ +# pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: imtl-pvc + namespace: mcm +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + storageClassName: manual + volumeName: imtl-pv diff --git a/deployment/setup.sh b/deployment/setup.sh index f884d8db..f34526bb 100755 --- a/deployment/setup.sh +++ b/deployment/setup.sh @@ -1,22 +1,67 @@ #!/bin/bash -echo "Create MCM cluster." -minikube start --nodes 3 --namespace mcm --insecure-registry "10.0.0.0/24" +# Function to display execution step log +display_step_info() { + step_num=$((step_num + 1)) + echo -e "\033[1;32m[Step $step_num] $1\033[0m" +} -echo "Enable minikube addons." -minikube addons enable registry -minikube addons enable metrics-server +# Default number of nodes +num_nodes=3 +step_num=0 + +while getopts "n:h" opt; do + case ${opt} in + n) + display_step_info "Setting number of nodes to $OPTARG" + num_nodes=$OPTARG + ;; + h) + echo "Usage: $0 [-n NUM_NODES]" >&2 + exit 0 + ;; + esac +done -echo "Set name for worker nodes." -worker_node_0="minikube-m02" -worker_node_1="minikube-m03" +display_step_info "Starting the Minikube cluster with $num_nodes nodes" +minikube start --nodes $num_nodes --namespace mcm --mount-string="/var/run/imtl:/var/run/imtl" --mount + +# Enable minikube addons +display_step_info "Enabling metrics-server addon" +minikube addons enable metrics-server -echo "Load MCM docker image into cluster." +# Load docker images into cluster +display_step_info "Loading docker images into the cluster" minikube image load mcm/media-proxy:latest +minikube image load mcm/sample-app:latest + +# Create an array for node names +nodearr=() +for ((i=2; i<=$num_nodes; i++)); do + nodearr+=("minikube-m$(printf %02d $i)") +done + +# Iterate through nodearr to label worker nodes +display_step_info "Labeling worker nodes" +for node in "${nodearr[@]}"; do + kubectl label nodes "${node}" node-role.kubernetes.io/worker=true +done + +echo "Set node label to worker nodes." +display_step_info "Adding custom labels to worker nodes" +kubectl label nodes minikube-m02 mcm-type=tx +kubectl label nodes minikube-m03 mcm-type=rx + +# Create the custom namespace +display_step_info "Creating the mcm namespace" +kubectl create -f namespace.yaml -echo "Set node label to MCM worker nodes." -kubectl label nodes ${worker_node_0} node-role.mcm.intel.com/worker=true -kubectl label nodes ${worker_node_1} node-role.mcm.intel.com/worker=true +# Create PVC +display_step_info "Creating the PVC" +kubectl apply -f pv.yaml +kubectl apply -f pvc.yaml -echo "Deploy Media Proxy DaemonSet." -kubectl create -f DaemonSet/media-proxy.yaml +display_step_info "Deploy Media Proxy DaemonSet" +# kubectl apply -f DaemonSet/media-proxy.yaml +kubectl apply -f DaemonSet/media-proxy-rx.yaml +kubectl apply -f DaemonSet/media-proxy-tx.yaml diff --git a/media-proxy/Dockerfile b/media-proxy/Dockerfile index 955b5e71..350e201e 100644 --- a/media-proxy/Dockerfile +++ b/media-proxy/Dockerfile @@ -9,7 +9,7 @@ ENV DEBIAN_FRONTEND noninteractive # Install package dependencies RUN apt-get update --fix-missing \ - # && apt-get full-upgrade -y \ + && apt-get full-upgrade -y \ && apt-get install --no-install-recommends -y apt-utils \ software-properties-common ca-certificates \ libtool autoconf automake pkg-config \ @@ -36,11 +36,10 @@ ARG HOME="/home/${USER}" ENV PATH="${PREFIX_DIR}/bin:$HOME/.local/bin:$HOME/bin:$HOME/usr/bin:$PATH" -ARG MCM_DIR=/opt/mcm/media-communications-mesh -ARG MTL_DIR=/opt/mcm/3rd_party/mtl -ARG DPDK_DIR=/opt/mcm/3rd_party/dpdk +ARG MCM_DIR=/opt/mcm +ARG MTL_DIR=/opt/mtl +ARG DPDK_DIR=/opt/dpdk -RUN mkdir -p /opt/mcm/3rd_party/ RUN adduser ${USER} sudo \ && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers @@ -83,17 +82,20 @@ RUN git clone --depth 1 --branch main https://github.com/OpenVisualCloud/Media-C WORKDIR $MCM_DIR RUN ./build.sh -## Re-build container for optimised runtime environment using clean Ubuntu release +# Re-build container for optimised runtime environment using clean Ubuntu release FROM ubuntu:22.04@sha256:8eab65df33a6de2844c9aefd19efe8ddb87b7df5e9185a4ab73af936225685bb +LABEL maintainer="qiang.han@intel.com" -ARG USER=docker -RUN useradd -l -m -s /bin/bash ${USER} +ENV DEBIAN_FRONTEND noninteractive RUN apt-get update --fix-missing \ && apt-get install -y --no-install-recommends libnuma1 libjson-c5 libpcap0.8 libssl3 libatomic1 libbsd0 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +ARG USER=docker +RUN useradd -l -m -s /bin/bash ${USER} + # Copy required files from build container COPY --from=builder /usr/local /usr/local diff --git a/sdk/Dockerfile b/sdk/Dockerfile new file mode 100644 index 00000000..98d38236 --- /dev/null +++ b/sdk/Dockerfile @@ -0,0 +1,74 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023 Intel Corporation +# +# SPDX-License-Identifier: BSD-3-Clause + +# Use the specific version of ubuntu image +FROM ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e496e5c1f05f as builder + +# Set the maintainer label +LABEL maintainer="qiang.han@intel.com" + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive + +# Update and install package dependencies in a single RUN command to reduce layer size +RUN apt-get update && apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y apt-utils sudo build-essential cmake git ca-certificates curl libbsd-dev && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Create a non-root user +ARG USER=docker +RUN useradd -l -m -s /bin/bash ${USER} + +# Set default environment variables for the user +ARG PREFIX_DIR="/usr/local" +ARG HOME="/home/${USER}" +ENV PATH="${PREFIX_DIR}/bin:$HOME/.local/bin:$HOME/bin:$HOME/usr/bin:$PATH" + +# Set the MCM directory +ARG MCM_DIR=/opt/mcm + +# Clone the MCM repository and build the application +RUN git clone --depth 1 --branch main https://github.com/OpenVisualCloud/Media-Communications-Mesh.git ${MCM_DIR} +WORKDIR $MCM_DIR/sdk +RUN ./build.sh + +## Re-build container for optimised runtime environment using clean Ubuntu release +FROM ubuntu:22.04@sha256:2b7412e6465c3c7fc5bb21d3e6f1917c167358449fecac8176c6e496e5c1f05f + +# Set the maintainer label +LABEL maintainer="qiang.han@intel.com" + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive + +# Update and install package dependencies in a single RUN command to reduce layer size +RUN apt-get update && apt-get full-upgrade -y && \ + apt-get install --no-install-recommends -y libbsd0 && \ + apt-get install --no-install-recommends -y sleepenh net-tools && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ARG USER=docker +RUN useradd -l -m -s /bin/bash ${USER} + +# Set default environment variables for the user +ARG PREFIX_DIR="/usr/local" +ARG HOME="/home/${USER}" +ENV PATH="${PREFIX_DIR}/bin:$HOME/.local/bin:$HOME/bin:$HOME/usr/bin:$PATH" + +# Set the MCM directory +ARG MCM_DIR=/opt/mcm + +# Copy the application build from the builder stage +COPY --from=builder $MCM_DIR/sdk/out/samples /opt/mcm/sdk/out/samples +COPY --from=builder ${PREFIX_DIR} ${PREFIX_DIR} + +RUN ldconfig + +# Set the working directory +WORKDIR /opt/mcm/sdk/out/samples + +# Set the default command to run the application +CMD ["./recver_app"] diff --git a/sdk/samples/recver_app.c b/sdk/samples/recver_app.c index c66cc4b2..79788996 100644 --- a/sdk/samples/recver_app.c +++ b/sdk/samples/recver_app.c @@ -13,7 +13,6 @@ #include #include #include - #include "mcm_dp.h" #define DEFAULT_RECV_IP "127.0.0.1" diff --git a/sdk/samples/sender_app.c b/sdk/samples/sender_app.c index 5bcdab78..d30c422c 100644 --- a/sdk/samples/sender_app.c +++ b/sdk/samples/sender_app.c @@ -15,8 +15,6 @@ #include #include #include -#include - #include "mcm_dp.h" #define DEFAULT_SEND_IP "127.0.0.1" @@ -86,9 +84,9 @@ int read_test_data(FILE* fp, mcm_buffer* buf, uint32_t width, uint32_t height, v int ret = 0; static int frm_idx = 0; int frame_size = width * height * 3 / 2; //TODO: assume NV12 - assert(buf->len >= frame_size); assert(fp != NULL && buf != NULL); + assert(buf->len >= frame_size); if (fread(buf->data, frame_size, 1, fp) < 1) { perror("Error when read frame file"); From d55aedda3e8149103d3c9e849bec3eb4c689d8b9 Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Mon, 18 Dec 2023 15:47:38 +0800 Subject: [PATCH 15/26] Simplify the Macro for the Zero-copy Mode. Signed-off-by: Han Qiang --- .github/workflows/scorecard.yml | 2 +- media-proxy/CMakeLists.txt | 12 +----------- media-proxy/include/mtl.h | 8 ++++---- media-proxy/src/mtl.c | 14 +++++++------- media-proxy/src/shm_memif.c | 12 ++++++------ 5 files changed, 19 insertions(+), 29 deletions(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index eef83e5b..d2291ec4 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -50,7 +50,7 @@ jobs: # - you want to enable the Branch-Protection check on a *public* repository, or # - you are installing Scorecard on a *private* repository # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. - # repo_token: ${{ secrets.SCORECARD_TOKEN }} + repo_token: ${{ secrets.SCORECARD_TOKEN }} # Public repositories: # - Publish results to OpenSSF REST API for easy access by consumers diff --git a/media-proxy/CMakeLists.txt b/media-proxy/CMakeLists.txt index 1189e541..827f6a0a 100644 --- a/media-proxy/CMakeLists.txt +++ b/media-proxy/CMakeLists.txt @@ -36,21 +36,11 @@ else() endif() # Enabled by default -OPTION(ENABLE_ZERO_COPY "Enable zero-copy mode for both RX & TX Pods." ON) +option(ENABLE_ZERO_COPY "Enable zero-copy mode to avoid memory copying between Media Proxy and IMTL" ON) IF(ENABLE_ZERO_COPY) ADD_DEFINITIONS(-DZERO_COPY) ENDIF(ENABLE_ZERO_COPY) -OPTION(ENABLE_TX_ZERO_COPY "Enable zero-copy mode for TX Pod." ON) -IF(ENABLE_TX_ZERO_COPY) - ADD_DEFINITIONS(-DTX_ZERO_COPY) -ENDIF(ENABLE_TX_ZERO_COPY) - -OPTION(ENABLE_RX_ZERO_COPY "Enable zero-copy mode for RX Pod." ON) -IF(ENABLE_RX_ZERO_COPY) - ADD_DEFINITIONS(-DRX_ZERO_COPY) -ENDIF(ENABLE_RX_ZERO_COPY) - set(proto_name controller) set(target media_proxy) set(MTL_LIB mtl) diff --git a/media-proxy/include/mtl.h b/media-proxy/include/mtl.h index 2d79c799..011dd20d 100644 --- a/media-proxy/include/mtl.h +++ b/media-proxy/include/mtl.h @@ -68,7 +68,7 @@ typedef struct { size_t frame_size; /* Size (Bytes) of single frame. */ uint32_t fb_count; /* Frame buffer count. */ -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) uint8_t* source_begin; uint8_t* source_end; uint8_t* frame_cursor; @@ -112,7 +112,7 @@ typedef struct { size_t frame_size; -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) uint8_t* source_begin; uint8_t* source_end; uint8_t* frame_cursor; @@ -153,7 +153,7 @@ typedef struct { size_t frame_size; -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) uint8_t* source_begin; uint8_t* source_end; uint8_t* frame_cursor; @@ -208,7 +208,7 @@ typedef struct { uint32_t height; enum st_frame_fmt output_fmt; -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) uint8_t* source_begin; uint8_t* source_end; uint8_t* frame_cursor; diff --git a/media-proxy/src/mtl.c b/media-proxy/src/mtl.c index e9ff110e..bf7e08a2 100644 --- a/media-proxy/src/mtl.c +++ b/media-proxy/src/mtl.c @@ -276,7 +276,7 @@ static int rx_st22p_frame_available(void* priv) return 0; } -#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) +#if defined(ZERO_COPY) static int rx_st20p_query_ext_frame(void* priv, struct st_ext_frame* ext_frame, struct st20_rx_frame_meta* meta) { @@ -503,7 +503,7 @@ static void rx_st20p_consume_frame(rx_session_context_t* s, struct st_frame* fra conn = s->memif_conn; -#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) +#if defined(ZERO_COPY) rx_bufs = (memif_buffer_t*)frame->opaque; rx_buf_num = 1; #else @@ -547,7 +547,7 @@ static void rx_st22p_consume_frame(rx_st22p_session_context_t* s, struct st_fram conn = s->memif_conn; -#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) +#if defined(ZERO_COPY) rx_bufs = (memif_buffer_t*)frame->opaque; rx_buf_num = 1; #else @@ -1816,7 +1816,7 @@ rx_session_context_t* mtl_st20p_rx_session_create(mtl_handle dev_handle, struct // } fb_cnt = rx_ctx->fb_count; -#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) +#if defined(ZERO_COPY) rx_ctx->ext_frames = (struct st20_ext_frame*)malloc(sizeof(*rx_ctx->ext_frames) * fb_cnt); // for (int i = 0; i < fb_cnt; i++) { // rx_ctx->ext_frames[i].buf_addr = rx_ctx->frames_begin_addr + i * rx_ctx->frame_size; @@ -1893,7 +1893,7 @@ rx_st22p_session_context_t* mtl_st22p_rx_session_create(mtl_handle dev_handle, s ops_rx.priv = rx_ctx; // app handle register to lib ops_rx.notify_frame_available = rx_st22p_frame_available; -#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) +#if defined(ZERO_COPY) ops_rx.flags |= ST22P_RX_FLAG_EXT_FRAME; ops_rx.flags |= ST22P_RX_FLAG_RECEIVE_INCOMPLETE_FRAME; ops_rx.query_ext_frame = rx_st22p_query_ext_frame; @@ -2441,7 +2441,7 @@ tx_session_context_t* mtl_st20p_tx_session_create(mtl_handle dev_handle, struct ops_tx.notify_frame_available = tx_st20p_frame_available; ops_tx.notify_frame_done = tx_st20p_frame_done; -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) ops_tx.flags |= ST20P_TX_FLAG_EXT_FRAME; #endif @@ -2510,7 +2510,7 @@ tx_st22p_session_context_t* mtl_st22p_tx_session_create(mtl_handle dev_handle, s ops_tx.notify_frame_available = tx_st22p_frame_available; ops_tx.notify_frame_done = tx_st22p_frame_done; -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) ops_tx.flags |= ST22P_TX_FLAG_EXT_FRAME; #endif diff --git a/media-proxy/src/shm_memif.c b/media-proxy/src/shm_memif.c index aeb4b3bb..a0f5b0b6 100644 --- a/media-proxy/src/shm_memif.c +++ b/media-proxy/src/shm_memif.c @@ -100,7 +100,7 @@ int rx_st20p_on_connect(memif_conn_handle_t conn, void* priv_data) INFO("RX memif connected!"); -#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) +#if defined(ZERO_COPY) memif_details_t md = { 0 }; ssize_t buflen = 2048; char* buf = (char*)calloc(1, buflen); @@ -150,7 +150,7 @@ int rx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data) INFO("RX memif connected!"); -#if defined(ZERO_COPY) || defined(RX_ZERO_COPY) +#if defined(ZERO_COPY) memif_details_t md = { 0 }; ssize_t buflen = 2048; char* buf = (char*)calloc(1, buflen); @@ -476,7 +476,7 @@ int tx_st20p_on_connect(memif_conn_handle_t conn, void* priv_data) return err; } -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) memif_details_t md = { 0 }; ssize_t buflen = 2048; char* buf = (char*)calloc(1, buflen); @@ -519,7 +519,7 @@ int tx_st22p_on_connect(memif_conn_handle_t conn, void* priv_data) return err; } -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) memif_details_t md = { 0 }; ssize_t buflen = 2048; char* buf = (char*)calloc(1, buflen); @@ -746,7 +746,7 @@ int tx_st20p_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) } while (!frame); /* Send out frame. */ -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) struct st_ext_frame ext_frame = { 0 }; ext_frame.addr[0] = shm_bufs.data; ext_frame.iova[0] = tx_ctx->source_begin_iova + ((uint8_t*)shm_bufs.data - tx_ctx->source_begin); @@ -812,7 +812,7 @@ int tx_st22p_on_receive(memif_conn_handle_t conn, void* priv_data, uint16_t qid) } while (!frame); /* Send out frame. */ -#if defined(ZERO_COPY) || defined(TX_ZERO_COPY) +#if defined(ZERO_COPY) struct st_ext_frame ext_frame = { 0 }; ext_frame.addr[0] = shm_bufs.data; ext_frame.iova[0] = tx_ctx->source_begin_iova + ((uint8_t*)shm_bufs.data - tx_ctx->source_begin); From cabbc3568bf721cc37f6067bb32e737a1dbfbbc7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 23:18:32 +0800 Subject: [PATCH 16/26] Bump ubuntu from `8eab65d` to `6042500` in /media-proxy (#53) Bumps ubuntu from `8eab65d` to `6042500`. --- updated-dependencies: - dependency-name: ubuntu dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- media-proxy/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/media-proxy/Dockerfile b/media-proxy/Dockerfile index 350e201e..ac3d680e 100644 --- a/media-proxy/Dockerfile +++ b/media-proxy/Dockerfile @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-3-Clause -FROM ubuntu:22.04@sha256:8eab65df33a6de2844c9aefd19efe8ddb87b7df5e9185a4ab73af936225685bb as builder +FROM ubuntu:22.04@sha256:6042500cf4b44023ea1894effe7890666b0c5c7871ed83a97c36c76ae560bb9b as builder LABEL maintainer="qiang.han@intel.com" ENV DEBIAN_FRONTEND noninteractive @@ -83,7 +83,7 @@ WORKDIR $MCM_DIR RUN ./build.sh # Re-build container for optimised runtime environment using clean Ubuntu release -FROM ubuntu:22.04@sha256:8eab65df33a6de2844c9aefd19efe8ddb87b7df5e9185a4ab73af936225685bb +FROM ubuntu:22.04@sha256:6042500cf4b44023ea1894effe7890666b0c5c7871ed83a97c36c76ae560bb9b LABEL maintainer="qiang.han@intel.com" ENV DEBIAN_FRONTEND noninteractive From e86850d350d0adbea4681fd337a75a2619008c23 Mon Sep 17 00:00:00 2001 From: Han Qiang Date: Tue, 19 Dec 2023 10:08:39 +0800 Subject: [PATCH 17/26] Add user guide about setup MCM with K8s. (#51) Signed-off-by: Han Qiang --- docs/dp-sdk-api-ref.md | 55 + docs/setup-mcm-with-k8s.md | 91 ++ sdk/Doxyfile | 2658 ++++++++++++++++++++++++++++++++++++ 3 files changed, 2804 insertions(+) create mode 100644 docs/dp-sdk-api-ref.md create mode 100644 docs/setup-mcm-with-k8s.md create mode 100644 sdk/Doxyfile diff --git a/docs/dp-sdk-api-ref.md b/docs/dp-sdk-api-ref.md new file mode 100644 index 00000000..5a4f55d7 --- /dev/null +++ b/docs/dp-sdk-api-ref.md @@ -0,0 +1,55 @@ +# API User Guide for MCM Data Plane SDK + +## mcm_create_connection +### Description +Creates a session for MCM data plane connection. + +### Parameters +- `param`: Parameters for the connect session. + +### Return Value +The context handler of the created connect session (`mcm_conn_context*`). + +## mcm_destroy_connection +### Description +Destroys an MCM DP connection. + +### Parameters +- `pctx`: The context handler of the connection to be destroyed. + +### Return Value +None + +## mcm_dequeue_buffer +### Description +Gets a buffer from the buffer queue. + +- For the TX side, this function is used to allocate a buffer from the buffer queue. +- For the RX side, it is used to read a buffer from the TX side. + +### Parameters +- `pctx`: The context handler of the created connect session. +- `timeout`: Timeout in milliseconds. + - Passive event polling: + - `timeout = 0`: Don't wait for an event, check the event queue if there is an event and return. + - `timeout = -1`: Wait until an event occurs. +- `error_code`: Error code if failed, can be set to NULL if not required. + +### Return Value +Pointer to the `mcm_buffer`. Returns `NULL` if failed. + +## mcm_enqueue_buffer +### Description +Puts a buffer to the buffer queue. + +- For the RX side, this function is used to return a buffer back to the queue. +- For the TX side, it is used to send a buffer to the RX side. + +### Parameters +- `pctx`: The context handler of the created connect session. +- `buf`: Pointer to the `mcm_buffer`. + +### Return Value +Error code if failed. Returns `0` if successful. + +This user guide provides a brief overview of the functions and their usage. You can expand this document by adding more detailed information such as function usage examples, expected behavior, and any specific error handling details. diff --git a/docs/setup-mcm-with-k8s.md b/docs/setup-mcm-with-k8s.md new file mode 100644 index 00000000..840e9360 --- /dev/null +++ b/docs/setup-mcm-with-k8s.md @@ -0,0 +1,91 @@ +# Setting Up MCM Cluster with K8s + +## Prerequisites +To set up your Minikube cluster and deploy resources, please ensure that the following prerequisites are met on your local machine: + +- **Operating System**: [Ubuntu 22.04](https://releases.ubuntu.com/22.04/) +- **Minikube**: Install Minikube using a package manager or by downloading the binary from the [official website](https://minikube.sigs.k8s.io/docs/start/). Ensure you are using a compatible version with Ubuntu 22.04. +- **kubectl**: This command-line tool allows you to interact with the Kubernetes cluster. You can configure it to connect to your Minikube cluster by running `kubectl config use-context minikube`. Verify that you have a version compatible with your Minikube version. +- **Docker**: Ensure that Docker is installed on your machine. You can install Docker from the [official website](https://docs.docker.com/get-docker/). +- **Images**: MCM cluster running depends on server docker images. Please follow below steps to create them. + +Media Proxy: +```bash +cd /media-proxy +docker build -t mcm/media-proxy:latest . +``` + +Sample Applications: +```bash +cd /sdk +docker build -t mcm/sample-app:latest . +``` + +IMTL Manager: +```bash +git clone https://github.com/OpenVisualCloud/Media-Transport-Library.git +cd /mananger +docker build -t mtl-manager:latest . +``` + +- PS: Detail information about the IMTL Manager could refer to the [IMTL document](https://github.com/OpenVisualCloud/Media-Transport-Library/tree/main/manager). + +Once these prerequisites are in place, you can proceed with setting up your Minikube cluster and deploying resources. If you encounter any issues during the process, feel free to ask for assistance. + +## Setup Steps + +### 1. Launch IMTL Manager on the host server. +The IMTL Manager is needed to manage the lcore for MTL instances. It needs to be run on each physical host server of the MCM cluster. +```bash +docker run -d \ + --name mtl-manager \ + --privileged --net=host \ + -v /var/run/imtl:/var/run/imtl \ + mtl-manager:latest +``` + +### 2. Setting Up the Minikube Cluster +Use the following command to set the number of nodes for your Minikube cluster: +```bash +minikube start --nodes $num_nodes --namespace mcm --mount-string="/var/run/imtl:/var/run/imtl" --mount +``` + +### 3. Enabling Addons and Loading Docker Images +Once the Minikube cluster is running, enable the metrics-server addon: +```bash +minikube addons enable metrics-server +``` + +- Load the required Docker images into the Minikube cluster: +```bash +minikube image load mcm/media-proxy:latest +minikube image load mcm/sample-app:latest +``` + + +### 4. Labeling Worker Nodes +After the cluster is set up, label the worker nodes with the following commands: +```bash +kubectl label nodes minikube-m02 mcm-type=tx +kubectl label nodes minikube-m03 mcm-type=rx +``` + +### 5. Creating Resources +Apply the custom namespace and create the Persistent Volume Claim (PVC) using the provided YAML files: +```bash +kubectl create -f namespace.yaml +kubectl apply -f pv.yaml +kubectl apply -f pvc.yaml +``` + +### 6. Deploying DaemonSets +Deploy the Media Proxy DaemonSets for both receiver and transmitter using the provided YAML files: +```bash +kubectl apply -f DaemonSet/media-proxy-rx.yaml +kubectl apply -f DaemonSet/media-proxy-tx.yaml +``` + +## Summary +This user guide outlined the steps to set up a MCM cluster, enable addons, load Docker images, label worker nodes, create resources, and deploy Media Proxy. By following these steps, you can configure a Minikube cluster for your MCM system. + +**Note:** Users can simply run the `deployment/setup.sh` script to execute all the mentioned steps in this user guide. diff --git a/sdk/Doxyfile b/sdk/Doxyfile new file mode 100644 index 00000000..653b66a1 --- /dev/null +++ b/sdk/Doxyfile @@ -0,0 +1,2658 @@ +# Doxyfile 1.9.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "MCM DP SDK" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = docs + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which efficively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = "include/mcm_dp.h" + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), +# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, +# *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f18 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to +# YES then doxygen will add the directory of each input to the include path. +# The default value is: YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: +# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /