Skip to content

Implement FlexConnect and add tests (VPAC VISS+MSC) GStreamer plugin#378

Open
PrathamTI wants to merge 1 commit intodevelopfrom
flexconnect
Open

Implement FlexConnect and add tests (VPAC VISS+MSC) GStreamer plugin#378
PrathamTI wants to merge 1 commit intodevelopfrom
flexconnect

Conversation

@PrathamTI
Copy link
Collaborator

@PrathamTI PrathamTI commented Dec 24, 2025

Implement FlexConnect hardware-accelerated ISP pipeline combining VISS and MSC in a single
GStreamer element for TI AM62A and compatible platforms.

This implementation is based on the official TI FlexConnect kernel node enabled in TI Processor
SDK RTOS[0].

Current Implementation:

  1. Single output stream support - FlexConnect can take raw Bayer camera input and produce one processed output stream (e.g., 1920x1080 NV12 or GRAY8)

  2. Two output formats supported - NV12: Standard color format (YUV 4:2:0) for display/encode - GRAY8: 8-bit grayscale for computer vision applications

  3. Mutliple camera suppor - Flexconnect is supported on multiple camera (e.g IMX219, IMX390, etc)

Test Suite:
Comprehensive test suite added for FlexConnect plugin validation:

  1. test_target
    - Validates target property with supported values (VPAC_FC)
  2. test_foreach_format
    - Tests all supported Bayer input formats (bggr, gbrg, grbg, rggb)
    - Validates format conversion to NV12 output
  3. test_resolutions_with_downscale_fail
    - Validates FC correctly rejects downscaling attempts
    - Tests hardware limitation (output must be >= input dimensions)
  4. test_resolutions_with_upscale_fail
    - Validates FC correctly rejects odd output dimensions
    - Tests NV12 format constraint (requires even width/height)
  5. test_input_format_fail
    - Tests invalid Bayer input format rejection
    - Validates caps negotiation failure during state change
  6. test_output_format_fail
    - Tests invalid output format rejection for all valid input formats
    - Validates proper format validation behavior

TODO:

  1. Multiple output stream support
  2. Add support for TIVX_VPAC_FC_MSC_CMD_SET_CROP_PARAMS control command.

[0] https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/tiovx/docs/user_guide/hwa__vpac__fc_8h_source.html

@PrathamTI PrathamTI changed the base branch from main to develop December 24, 2025 11:48
@cshilwant
Copy link
Member

@PrathamTI For SITSW-8156, are you planning to add tests for this new plugin via [0]?

[0] - https://github.com/TexasInstruments/edgeai-gst-plugins/tree/main/tests/check

@cshilwant
Copy link
Member

In commit message,

  1. Mutliple camera suppor --> 3. Mutliple camera support

@PrathamTI
Copy link
Collaborator Author

@PrathamTI For SITSW-8156, are you planning to add tests for this new plugin via [0]?

[0] - https://github.com/TexasInstruments/edgeai-gst-plugins/tree/main/tests/check

Yes, planning on adding tests after the bug is resolved

@cshilwant
Copy link
Member

Yes, planning on adding tests after the bug is resolved

@PrathamTI Bisecting the color artifacts issue in imaging and resolving the crop params control command bug might take some time.

However, I noticed that the tests under edgeai-gst-plugins/tests/check use fakesink, which actually unblocks us for adding tests...since the color artifacts we're observing are specific to kmssink. Given this, the bug shouldn't block us from adding tests under edgeai-gst-plugins/tree/main/tests/check & close SITSW-8156

Adding unit tests for tiovxfcvissmsc now would help us validate the pipeline behavior for each RC through automation. Without these tests in place, we'd need to perform manual validation for every RC going forward (something we can avoid by adding automated unit tests now)

If you don't have the implementation ready yet, you can check out gsttiovxisp.c to get started. We should also evaluate how many positive and negative tests from tiovxisp can be reused for tiovxfcvissmsc and then identify what additional tests specific to tiovxfcvissmsc need to be added.

@PrathamTI
Copy link
Collaborator Author

Yes, planning on adding tests after the bug is resolved

@PrathamTI Bisecting the color artifacts issue in imaging and resolving the crop params control command bug might take some time.

However, I noticed that the tests under edgeai-gst-plugins/tests/check use fakesink, which actually unblocks us for adding tests...since the color artifacts we're observing are specific to kmssink. Given this, the bug shouldn't block us from adding tests under edgeai-gst-plugins/tree/main/tests/check & close SITSW-8156

Adding unit tests for tiovxfcvissmsc now would help us validate the pipeline behavior for each RC through automation. Without these tests in place, we'd need to perform manual validation for every RC going forward (something we can avoid by adding automated unit tests now)

If you don't have the implementation ready yet, you can check out gsttiovxisp.c to get started. We should also evaluate how many positive and negative tests from tiovxisp can be reused for tiovxfcvissmsc and then identify what additional tests specific to tiovxfcvissmsc need to be added.

Good Idea
I'll work on this after this sprint

@PrathamTI PrathamTI changed the title Implement FlexConnect (VPAC VISS+MSC) GStreamer plugin Implement FlexConnect and add tests (VPAC VISS+MSC) GStreamer plugin Jan 13, 2026
@PrathamTI PrathamTI marked this pull request as ready for review January 13, 2026 09:45
@@ -0,0 +1,2716 @@
/*
* Copyright (c) [2025] Texas Instruments Incorporated

Choose a reason for hiding this comment

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

Update copyright year

{
GstTIOVXFC *self = NULL;
vx_status status = VX_FAILURE;
gboolean ret = FALSE;

Choose a reason for hiding this comment

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

do you really need ret, can you use status ?

gst_tivox_fc_compute_src_dimension (GstTIOVXSimo * simo,
const GValue * dimension, GValue * out_value, guint roi_len)
{
static const gint scale = 4;

Choose a reason for hiding this comment

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

what is 4, better to use #define or add comment

}

out_max = dim_max;
out_min = 1.0 * dim_min / scale + 0.5;

Choose a reason for hiding this comment

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

again here, 0.5, 1.0 ?
add some comments

gst_tivox_fc_compute_sink_dimension (GstTIOVXSimo * simo,
const GValue * dimension, GValue * out_value, guint roi_len)
{
static const gint scale = 4;

Choose a reason for hiding this comment

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

ditto

}
else
{

Choose a reason for hiding this comment

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

extra line

GST_ERROR_OBJECT (self, "Unable to call analog gain ioctl: %d",
ret_val);
}
close_fd:

Choose a reason for hiding this comment

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

syntax

GST_DEBUG_OBJECT (self, "Configuring IR/Bayer operation based on output format");

/* Detect if input is Bayer format for GRAY8 output decision */
is_bayer_input = FALSE;

Choose a reason for hiding this comment

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

it is already initialize as FALSE, why again ?


/* Configure MSC outputs - route IR output to MSC output 0 */
GST_DEBUG_OBJECT (self, "Configuring MSC outputs for IR");
for (int i = 6; i <= 10; i++) {

Choose a reason for hiding this comment

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

6/10 ? add comment

GST_DEBUG_OBJECT (self, "Module init succeeded");
ret = TRUE;

out:

Choose a reason for hiding this comment

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

cleanup of resources ?

*
* DISCLAIMER.
*
* THIS SOFTWARE IS PROVItivx_vpac_fc_viss_msc_params_tDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS

Choose a reason for hiding this comment

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

tivx_vpac_fc_viss_msc_params_t is i guess mistakenly pasted here. Correct the same

@Akshay-Abdar
Copy link

Akshay-Abdar commented Jan 13, 2026

Update the copyright year from [2022-2026] is the year range i suppose for the file ext/tiovx/gsttiovx.c as there are few updates.

}

GST_DEBUG_OBJECT(self, "Setting up VISS-MSC input mapping");
flexconnect->fc_params.msc_in_thread_viss_out_map[0] = TIVX_VPAC_FC_VISS_OUT2;
Copy link
Collaborator

@sinha-shreyash sinha-shreyash Jan 14, 2026

Choose a reason for hiding this comment

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

any reason behind not using TIVX_VPAC_FC_VISS_OUT0/1 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As defined in [0], for VPAC3 or VPAC3L devices msc_in_thread_viss_out_map should be mapped to TIVX_VPAC_FC_VISS_OUT2.

[0] https://git.ti.com/cgit/processor-sdk/imaging/tree/kernels/hwa/test/test_vpac_fc.c?h=safety_next#n345

Copy link
Collaborator

Choose a reason for hiding this comment

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

In https://bitbucket.itg.ti.com/projects/PROCESSOR-SDK-VISION/repos/edgeai-tiovx-modules/pull-requests/69/diff#src%2Ftiovx_fc_module.c?t=88, you have mapped msc_in_thread_viss_out_map to TIVX_VPAC_FC_VISS_OUT0 and 1 and rest to invalid. Is it a delta or is there any reason behind this ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For TIOVX module params initialisation, Imaging kernel has enabled TIVX_VPAC_FC_VISS_OUT0 and TIVX_VPAC_FC_VISS_OUT1 [0] so followed the same in tiovx_fc_module.c and the gstreamer implementation was based on [1] test case so the mapping of TIVX_VPAC_FC_VISS_OUT2 and TIVX_VPAC_FC_VISS_OUT3 was required.

[0] https://git.ti.com/cgit/processor-sdk/imaging/tree/kernels/hwa/host/vx_vpac_fc_host.c?h=REL.PSDK.ANALYTICS.11.02.00.06#n1108

[1] https://git.ti.com/cgit/processor-sdk/imaging/tree/kernels/hwa/test/test_vpac_fc.c?h=safety_next#n221

@@ -0,0 +1,88 @@
/*
* Copyright (c) [2025] Texas Instruments Incorporated

Choose a reason for hiding this comment

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

change copyright year

Copy link

@v-singh1 v-singh1 left a comment

Choose a reason for hiding this comment

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

change copyright year in ext/tiovx/gsttiovxfc.h

Implement FlexConnect hardware-accelerated ISP
pipeline combining VISS and MSC in a single
GStreamer element for TI AM62A and compatible
platforms.

This implementation is based on the official TI
FlexConnect kernel node enabled in TI Processor
SDK RTOS[0].

Current Implementation:

 1. Single output stream support
       - FlexConnect can take raw Bayer camera input
	 and produce one processed output stream
	 (e.g., 1920x1080 NV12 or GRAY8)

 2. Two output formats supported
       - NV12: Standard color format (YUV 4:2:0) for display/encode
       - GRAY8: 8-bit grayscale for computer vision applications

 3. Mutliple camera support
      - Flexconnect is supported on multiple camera (e.g IMX219,
	IMX390, etc)

Test Suite:

  Comprehensive test suite added for FlexConnect plugin validation:

   1. test_target
        - Validates target property with supported values (VPAC_FC)

   2. test_foreach_format
        - Tests all supported Bayer input formats (bggr, gbrg, grbg, rggb)
        - Validates format conversion to NV12 output

   3. test_resolutions_with_downscale_fail
        - Validates FC correctly rejects downscaling attempts
        - Tests hardware limitation (output must be >= input dimensions)

   4. test_resolutions_with_upscale_fail
        - Validates FC correctly rejects odd output dimensions
        - Tests NV12 format constraint (requires even width/height)

   5. test_input_format_fail
        - Tests invalid Bayer input format rejection
        - Validates caps negotiation failure during state change

   6. test_output_format_fail
        - Tests invalid output format rejection for all valid input formats
        - Validates proper format validation behavior
TODO:

1. Multiple output stream support
2. Add support for TIVX_VPAC_FC_MSC_CMD_SET_CROP_PARAMS
   control command.

[0] https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/tiovx/docs/user_guide/hwa__vpac__fc_8h_source.html

Signed-off-by: Pratham Deshmukh <p-deshmukh@ti.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants