Skip to content

Commit

Permalink
tx/pipeline: add flush for st22p and st30 also (#877)
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Du <frank.du@intel.com>
  • Loading branch information
frankdjx authored May 29, 2024
1 parent 5d8ad61 commit 2f1c2a3
Show file tree
Hide file tree
Showing 32 changed files with 138 additions and 181 deletions.
10 changes: 3 additions & 7 deletions app/sample/experimental/rx_st20_redundant_combined_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ static void* rx_video_frame_thread(void* arg) {

int main(int argc, char** argv) {
struct st_sample_context ctx;
int ret;
int ret = -EIO;

/* init sample(st) dev */
memset(&ctx, 0, sizeof(ctx));
sample_parse_args(&ctx, argc, argv, true, false, false);
ctx.param.num_ports = 2; /* force to 2 */

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -201,9 +203,6 @@ int main(int argc, char** argv) {
}
}

// start dev
ret = mtl_start(ctx.st);

// rx run
sart_time_ns = mtl_ptp_read_time(ctx.st);
while (!ctx.exit) {
Expand Down Expand Up @@ -232,9 +231,6 @@ int main(int argc, char** argv) {
info("%s(%d), received frames %d\n", __func__, i, app[i]->fb_rec);
}

// stop rx
ret = mtl_stop(ctx.st);

// check result
for (int i = 0; i < session_num; i++) {
if (app[i]->fb_rec <= 0) {
Expand Down
8 changes: 2 additions & 6 deletions app/sample/ext_frame/rx_st20_pipeline_dyn_ext_frame_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ int main(int argc, char** argv) {
ret = rx_sample_parse_args(&ctx, argc, argv);
if (ret < 0) return ret;

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -247,9 +249,6 @@ int main(int argc, char** argv) {
}
}

// start rx
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -266,9 +265,6 @@ int main(int argc, char** argv) {
rx_st20p_close_source(app[i]);
}

// stop rx
ret = mtl_stop(ctx.st);

// check result
for (int i = 0; i < session_num; i++) {
if (app[i]->fb_recv <= 0) {
Expand Down
8 changes: 2 additions & 6 deletions app/sample/ext_frame/rx_st20p_hdr_split_gpu_direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ int main(int argc, char** argv) {
ctx.param.nb_rx_hdr_split_queues = ctx.sessions;
}

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -282,9 +284,6 @@ int main(int argc, char** argv) {
}
}

// start rx
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -301,9 +300,6 @@ int main(int argc, char** argv) {
rx_st20p_close_source(app[i]);
}

// stop rx
ret = mtl_stop(ctx.st);

// check result
for (int i = 0; i < session_num; i++) {
if (app[i]->fb_recv <= 0) {
Expand Down
8 changes: 2 additions & 6 deletions app/sample/ext_frame/tx_st20_pipeline_ext_frame_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ int main(int argc, char** argv) {
ret = tx_sample_parse_args(&ctx, argc, argv);
if (ret < 0) return ret;

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -257,9 +259,6 @@ int main(int argc, char** argv) {
}
}

// start tx
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -276,9 +275,6 @@ int main(int argc, char** argv) {
tx_st20p_close_source(app[i]);
}

// stop tx
ret = mtl_stop(ctx.st);

// check result
for (int i = 0; i < session_num; i++) {
if (app[i]->fb_send <= 0) {
Expand Down
8 changes: 2 additions & 6 deletions app/sample/ext_frame/tx_video_split_sample.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ int main(int argc, char** argv) {
ctx.sessions = session_num;
sample_tx_queue_cnt_set(&ctx, session_num);

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -194,16 +196,10 @@ int main(int argc, char** argv) {
app[2]->fb_offset = app[0]->frame_size * 2;
app[3]->fb_offset = app[2]->fb_offset + app[1]->fb_offset;

// start tx
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}

// stop tx
ret = mtl_stop(ctx.st);

// check result
for (int i = 0; i < session_num; i++) {
if (app[i]->fb_send <= 0) {
Expand Down
9 changes: 3 additions & 6 deletions app/sample/fwd/rx_st20_tx_st20_split_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static int split_fwd_sample_free_app(struct split_fwd_sample_ctx* app) {
int main(int argc, char** argv) {
int session_num = 4;
struct st_sample_context ctx;
int ret;
int ret = -EIO;

/* init sample(st) dev */
memset(&ctx, 0, sizeof(ctx));
Expand All @@ -202,6 +202,8 @@ int main(int argc, char** argv) {
struct st20_pgroup st20_pg;
st20_get_pgroup(ctx.fmt, &st20_pg);

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -287,15 +289,10 @@ int main(int argc, char** argv) {

app.ready = true;

// start dev
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}

// stop dev
ret = mtl_stop(ctx.st);
info("%s, fb_fwd %d\n", __func__, app.fb_fwd);
app.ready = false;

Expand Down
8 changes: 2 additions & 6 deletions app/sample/fwd/rx_st20p_tx_st20p_downsample_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ int main(int argc, char** argv) {
ret = fwd_sample_parse_args(&ctx, argc, argv);
if (ret < 0) return ret;

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -197,9 +199,6 @@ int main(int argc, char** argv) {

app.ready = true;

// start dev
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -212,9 +211,6 @@ int main(int argc, char** argv) {
pthread_join(app.fwd_thread, NULL);
info("%s, fb_fwd %d\n", __func__, app.fb_fwd);

// stop dev
ret = mtl_stop(ctx.st);

// check result
if (app.fb_fwd <= 0) {
err("%s, error, no fwd frames %d\n", __func__, app.fb_fwd);
Expand Down
7 changes: 2 additions & 5 deletions app/sample/fwd/rx_st20p_tx_st20p_downsample_merge_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ int main(int argc, char** argv) {
ctx.param.flags |=
MTL_FLAG_RX_SEPARATE_VIDEO_LCORE; /* use separate lcores for tx and rx */

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -267,9 +269,6 @@ int main(int argc, char** argv) {

app.ready = true;

// start dev
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -287,8 +286,6 @@ int main(int argc, char** argv) {
}
pthread_join(app.fwd_thread, NULL);

// stop dev
ret = mtl_stop(ctx.st);
for (int i = 0; i < 4; i++) {
info("%s, rx[%d] fb_received %d\n", __func__, i, app.rx[i].fb_rcv);
}
Expand Down
8 changes: 2 additions & 6 deletions app/sample/fwd/rx_st20p_tx_st20p_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ int main(int argc, char** argv) {
ret = fwd_sample_parse_args(&ctx, argc, argv);
if (ret < 0) return ret;

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -339,9 +341,6 @@ int main(int argc, char** argv) {

app.ready = true;

// start dev
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -354,9 +353,6 @@ int main(int argc, char** argv) {
pthread_join(app.fwd_thread, NULL);
info("%s, fb_fwd %d\n", __func__, app.fb_fwd);

// stop dev
ret = mtl_stop(ctx.st);

// check result
if (app.fb_fwd <= 0) {
err("%s, error, no fwd frames %d\n", __func__, app.fb_fwd);
Expand Down
7 changes: 2 additions & 5 deletions app/sample/fwd/rx_st20p_tx_st20p_merge_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ int main(int argc, char** argv) {
ctx.param.flags |=
MTL_FLAG_RX_SEPARATE_VIDEO_LCORE; /* use separate lcores for tx and rx */

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -269,9 +271,6 @@ int main(int argc, char** argv) {

app.ready = true;

// start dev
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -289,8 +288,6 @@ int main(int argc, char** argv) {
}
pthread_join(app.fwd_thread, NULL);

// stop dev
ret = mtl_stop(ctx.st);
for (int i = 0; i < 4; i++) {
info("%s, rx[%d] fb_received %d\n", __func__, i, app.rx[i].fb_rcv);
}
Expand Down
7 changes: 2 additions & 5 deletions app/sample/fwd/rx_st20p_tx_st20p_split_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ int main(int argc, char** argv) {
ctx.param.flags |=
MTL_FLAG_RX_SEPARATE_VIDEO_LCORE; /* use separate lcores for tx and rx */

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -227,9 +229,6 @@ int main(int argc, char** argv) {

app.ready = true;

// start dev
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -247,8 +246,6 @@ int main(int argc, char** argv) {
}
pthread_join(app.fwd_thread, NULL);

// stop dev
ret = mtl_stop(ctx.st);
info("%s, fb_fwd %d\n", __func__, app.fb_fwd);
app.ready = false;

Expand Down
8 changes: 2 additions & 6 deletions app/sample/fwd/rx_st20p_tx_st22p_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ int main(int argc, char** argv) {
ret = fwd_sample_parse_args(&ctx, argc, argv);
if (ret < 0) return ret;

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -252,9 +254,6 @@ int main(int argc, char** argv) {

app.ready = true;

// start dev
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -267,9 +266,6 @@ int main(int argc, char** argv) {
pthread_join(app.fwd_thread, NULL);
info("%s, fb_fwd %d\n", __func__, app.fb_fwd);

// stop dev
ret = mtl_stop(ctx.st);

// check result
if (app.fb_fwd <= 0) {
err("%s, error, no fwd frames %d\n", __func__, app.fb_fwd);
Expand Down
8 changes: 2 additions & 6 deletions app/sample/legacy/rx_st20_tx_st20_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ int main(int argc, char** argv) {
ret = fwd_sample_parse_args(&ctx, argc, argv);
if (ret < 0) return ret;

/* enable auto start/stop */
ctx.param.flags |= MTL_FLAG_DEV_AUTO_START_STOP;
ctx.st = mtl_init(&ctx.param);
if (!ctx.st) {
err("%s: mtl_init fail\n", __func__);
Expand Down Expand Up @@ -400,9 +402,6 @@ int main(int argc, char** argv) {

app.ready = true;

// start dev
ret = mtl_start(ctx.st);

while (!ctx.exit) {
sleep(1);
}
Expand All @@ -415,9 +414,6 @@ int main(int argc, char** argv) {
pthread_join(app.fwd_thread, NULL);
info("%s, fb_fwd %d\n", __func__, app.fb_fwd);

// stop dev
ret = mtl_stop(ctx.st);

// check result
if (app.fb_fwd <= 0) {
err("%s, error, no fwd frames %d\n", __func__, app.fb_fwd);
Expand Down
Loading

0 comments on commit 2f1c2a3

Please sign in to comment.