visl: Add a tpg_verbose parameter for reference comparison
v5 cover visl: Add a tpg_verbose parameter for reference comparison
When using visl in automated tests, we need to have output frames that can be compared to reference frames or hash of those to validate that the whole pipeline is working properly.
Make sure that a given input stream always outputs the same frames. This is done by removing TPG information like queues status and pointer values.
Introduce the tpg_verbose parameter to allow adding the more verbose information that this patchset removes
This also adds some stable variation in the frames so that different input give more different output.
Changes since v4:
- Remove unnecessary changes in visl_get_ref_frames
- Fix missing space after &&
Changes since v3:
- Fix some more permissions in vidtv
- Rename stable_output to tpg_verbose
- Rebase on media_stage/master to include AV1 support
- Remove code churn in visl_get_ref_frames()
- Remove code duplication in visl_tpg_fill_sequence()
Changes since v2:
- Set parameters permissions to 0444 in visl and vidtv
- Make stable_output true by default
- Keep showing frames timestamps and remove vb2 buffer indexes only in stable output mode
- Make codec_variablility non optional (remove parameter, keep implementation)
- Add details on used variability fields
Changes since v1:
- Fix typo in parameter documentation
Detlev Casanova (4):
media: visl,vidtv: Set parameters permissions to 0444
media: visl: Add a tpg_verbose parameter
doc: visl: Document tpg_verbose parameter
visl: Add codec specific variability on output frames
Documentation/admin-guide/media/visl.rst | 12 +- .../media/test-drivers/vidtv/vidtv_bridge.c | 26 +- drivers/media/test-drivers/visl/visl-core.c | 15 +- drivers/media/test-drivers/visl/visl-dec.c | 301 +++++++++++------- drivers/media/test-drivers/visl/visl.h | 1 + 5 files changed, 217 insertions(+), 138 deletions(-)
Signature · 1 line
2.43.0
PATCH v5 1/4 media: visl,vidtv: Set parameters permissions to 0444
This avoids confusion with default values and lets userspace programs get the modules parameters values at run time.
This can be useful when setting up a test suite.
--- .../media/test-drivers/vidtv/vidtv_bridge.c | 26 +++++++++---------- drivers/media/test-drivers/visl/visl-core.c | 10 +++---- 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_bridge.c +13 -13
@@ -45,28 +45,28 @@#define LNB_HIGH_FREQ 10600000/* transition frequency */ static unsigned int drop_tslock_prob_on_low_snr; -module_param (drop_tslock_prob_on_low_snr, uint,0 ); +module_param (drop_tslock_prob_on_low_snr, uint,0444 );MODULE_PARM_DESC (drop_tslock_prob_on_low_snr,"Probability of losing the TS lock if the signal quality is bad" );static unsigned int recover_tslock_prob_on_good_snr; -module_param (recover_tslock_prob_on_good_snr, uint,0 ); +module_param (recover_tslock_prob_on_good_snr, uint,0444 );MODULE_PARM_DESC (recover_tslock_prob_on_good_snr,"Probability recovering the TS lock when the signal improves" );static unsigned int mock_power_up_delay_msec; -module_param (mock_power_up_delay_msec, uint,0 ); +module_param (mock_power_up_delay_msec, uint,0444 );MODULE_PARM_DESC (mock_power_up_delay_msec,"Simulate a power up delay" );static unsigned int mock_tune_delay_msec; -module_param (mock_tune_delay_msec, uint,0 ); +module_param (mock_tune_delay_msec, uint,0444 );MODULE_PARM_DESC (mock_tune_delay_msec,"Simulate a tune delay" );static unsigned int vidtv_valid_dvb_t_freqs[NUM_VALID_TUNER_FREQS ] = {474000000 }; -module_param_array (vidtv_valid_dvb_t_freqs, uint,NULL ,0 ); +module_param_array (vidtv_valid_dvb_t_freqs, uint,NULL ,0444 );MODULE_PARM_DESC (vidtv_valid_dvb_t_freqs,"Valid DVB-T frequencies to simulate, in Hz" );
@@ -74,19 +74,19 @@ static unsigned int vidtv_valid_dvb_c_freqs[NUM_VALID_TUNER_FREQS] = { 474000000 }; -module_param_array (vidtv_valid_dvb_c_freqs, uint,NULL ,0 ); +module_param_array (vidtv_valid_dvb_c_freqs, uint,NULL ,0444 );MODULE_PARM_DESC (vidtv_valid_dvb_c_freqs,"Valid DVB-C frequencies to simulate, in Hz" );static unsigned int vidtv_valid_dvb_s_freqs[NUM_VALID_TUNER_FREQS ] = {11362000 }; -module_param_array (vidtv_valid_dvb_s_freqs, uint,NULL ,0 ); +module_param_array (vidtv_valid_dvb_s_freqs, uint,NULL ,0444 );MODULE_PARM_DESC (vidtv_valid_dvb_s_freqs,"Valid DVB-S/S2 frequencies to simulate at Ku-Band, in kHz" );static unsigned int max_frequency_shift_hz; -module_param (max_frequency_shift_hz, uint,0 ); +module_param (max_frequency_shift_hz, uint,0444 );MODULE_PARM_DESC (max_frequency_shift_hz,"Maximum shift in HZ allowed when tuning in a channel" );
@@ -96,24 +96,24 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nums);* Influences the signal acquisition time. See ISO/IEC 13818-1 : 2000. p. 113. */ static unsigned int si_period_msec =40 ; -module_param (si_period_msec, uint,0 ); +module_param (si_period_msec, uint,0444 );MODULE_PARM_DESC (si_period_msec,"How often to send SI packets. Default: 40ms" );static unsigned int pcr_period_msec =40 ; -module_param (pcr_period_msec, uint,0 ); +module_param (pcr_period_msec, uint,0444 );MODULE_PARM_DESC (pcr_period_msec,"How often to send PCR packets. Default: 40ms" );static unsigned int mux_rate_kbytes_sec =4096 ; -module_param (mux_rate_kbytes_sec, uint,0 ); +module_param (mux_rate_kbytes_sec, uint,0444 );MODULE_PARM_DESC (mux_rate_kbytes_sec,"Mux rate: will pad stream if below" );static unsigned int pcr_pid =0x200 ; -module_param (pcr_pid, uint,0 ); +module_param (pcr_pid, uint,0444 );MODULE_PARM_DESC (pcr_pid,"PCR PID for all channels: defaults to 0x200" );static unsigned int mux_buf_sz_pkts; -module_param (mux_buf_sz_pkts, uint,0 ); +module_param (mux_buf_sz_pkts, uint,0444 );MODULE_PARM_DESC (mux_buf_sz_pkts,"Size for the internal mux buffer in multiples of 188 bytes" );
drivers/media/test-drivers/visl/visl-core.c +5 -5
@@ -64,27 +64,27 @@ MODULE_PARM_DESC(visl_transtime_ms, " simulated process time in milliseconds.");* particular number of frames */ int visl_dprintk_frame_start =-1 ; -module_param (visl_dprintk_frame_start, int,0 ); +module_param (visl_dprintk_frame_start, int,0444 );MODULE_PARM_DESC (visl_dprintk_frame_start," a frame number to start tracing with dprintk" );unsigned int visl_dprintk_nframes; -module_param (visl_dprintk_nframes, uint,0 ); +module_param (visl_dprintk_nframes, uint,0444 );MODULE_PARM_DESC (visl_dprintk_nframes," the number of frames to trace with dprintk" );bool keep_bitstream_buffers; -module_param (keep_bitstream_buffers, bool, false); +module_param (keep_bitstream_buffers, bool,0444 );MODULE_PARM_DESC (keep_bitstream_buffers," keep bitstream buffers in debugfs after streaming is stopped" );int bitstream_trace_frame_start =-1 ; -module_param (bitstream_trace_frame_start, int,0 ); +module_param (bitstream_trace_frame_start, int,0444 );MODULE_PARM_DESC (bitstream_trace_frame_start," a frame number to start dumping the bitstream through debugfs" );unsigned int bitstream_trace_nframes; -module_param (bitstream_trace_nframes, uint,0 ); +module_param (bitstream_trace_nframes, uint,0444 );MODULE_PARM_DESC (bitstream_trace_nframes," the number of frames to dump the bitstream through debugfs" );
Signature · 1 line
2.43.0
PATCH v5 2/4 media: visl: Add a tpg_verbose parameter
In reply to Detlev CasanovaThe text written on the output frames stable for a given input. Remove the unstable elements like pointers, buffer indexes or queues status so that frames are always identical and can be compared against a reference in automatic tests.
As the unstable information can be relevant when debugging the API, add a tpg_verbose parameter to show them.
--- drivers/media/test-drivers/visl/visl-core.c | 5 + drivers/media/test-drivers/visl/visl-dec.c | 265 +++++++++++--------- drivers/media/test-drivers/visl/visl.h | 1 + 3 files changed, 153 insertions(+), 118 deletions(-)
drivers/media/test-drivers/visl/visl-core.c +5 -0
@@ -88,6 +88,11 @@ module_param(bitstream_trace_nframes, uint, 0444);MODULE_PARM_DESC (bitstream_trace_nframes," the number of frames to dump the bitstream through debugfs" ); +bool tpg_verbose = false; +module_param (tpg_verbose, bool,0644 ); +MODULE_PARM_DESC (tpg_verbose, +" add more verbose information on the generated output frames" ); +static const struct visl_ctrl_desc visl_fwht_ctrl_descs[] = { { .cfg.id =V4L2_CID_STATELESS_FWHT_PARAMS ,
drivers/media/test-drivers/visl/visl-dec.c +147 -118
357 lines not on this page · raw message
drivers/media/test-drivers/visl/visl.h +1 -0
@@ -85,6 +85,7 @@ extern unsigned int visl_dprintk_nframes;extern bool keep_bitstream_buffers;extern int bitstream_trace_frame_start;extern unsigned int bitstream_trace_nframes; +extern bool tpg_verbose; #define frame_dprintk(dev, current, fmt, arg...) \ do { \
Signature · 1 line
2.43.0
PATCH v5 3/4 doc: visl: Document tpg_verbose parameter
In reply to Detlev CasanovaAlso document stable frames and what it means for testing tools.
--- Documentation/admin-guide/media/visl.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
Documentation/admin-guide/media/visl.rst +10 -2
@@ -49,6 +49,10 @@ Module parameters visl_dprintk_frame_start, visl_dprintk_nframes, but controls the dumping of buffer data through debugfs instead. +- tpg_verbose: Write extra information on each output frame to ease debugging + the API. When set to true, the output frames are not stable for a given input + as some information like pointers or queue status will be added to them. + What is the default use case for this driver? ---------------------------------------------
@@ -57,8 +61,12 @@ This assumes that a working client is run against visl and that the ftrace and OUTPUT buffer data is subsequently used to debug a work-in-progress implementation. -Information on reference frames, their timestamps, the status of the OUTPUT and -CAPTURE queues and more can be read directly from the CAPTURE buffers. +Even though no video decoding is actually done, the output frames can be used +against a reference for a given input, except if tpg_verbose is set to true. + +Depending on the tpg_verbose parameter value, information on reference frames, +their timestamps, the status of the OUTPUT and CAPTURE queues and more can be +read directly from the CAPTURE buffers. Supported codecs ----------------
Signature · 1 line
2.43.0
PATCH v5 4/4 visl: Add codec specific variability on output frames
In reply to Detlev CasanovaWhen running tests with different input data, the stable output frames could be too similar and hide possible issues.
This commit adds variation by using some codec specific parameters.
Only HEVC and H.264 support this.
--- drivers/media/test-drivers/visl/visl-dec.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/media/test-drivers/visl/visl-dec.c +36 -0
@@ -295,6 +295,35 @@ static void visl_tpg_fill_sequence(struct visl_ctx *ctx, " top" : " bottom") : "none"); } +static bool visl_tpg_fill_codec_specific(struct visl_ctx *ctx, + struct visl_run *run, + char buf[], size_t bufsz) +{ +/* +* To add variability, we need a value that is stable for a given +* input but is different than already shown fields. +* The pic order count value defines the display order of the frames +* (which can be different than the decoding order that is shown with +* the sequence number). +* Therefore it is stable for a given input and will add a different +* value that is more specific to the way the input is encoded. +*/ +switch (ctx->current_codec) { +case VISL_CODEC_H264 : +scnprintf (buf, bufsz, +"H264: %u" , run->h264.dpram->pic_order_cnt_lsb); +break ; +case VISL_CODEC_HEVC : +scnprintf (buf, bufsz, +"HEVC: %d" , run->hevc.dpram->pic_order_cnt_val); +break ; +default : +return false; + } + +return true; +} +static void visl_tpg_fill (struct visl_ctx *ctx,struct visl_run *run) {u8 *basep[TPG_MAX_PLANES ][2 ];
@@ -327,6 +356,13 @@ static void visl_tpg_fill(struct visl_ctx *ctx, struct visl_run *run)frame_dprintk (ctx->dev, run->dst->sequence,"" ); line++; +if (visl_tpg_fill_codec_specific (ctx, run, buf,TPG_STR_BUF_SZ )) { +tpg_gen_text (&ctx->tpg, basep, line++ * line_height,16 , buf); +frame_dprintk (ctx->dev, run->dst->sequence,"%s\n" , buf); +frame_dprintk (ctx->dev, run->dst->sequence,"" ); + line++; + } +visl_get_ref_frames (ctx, buf,TPG_STR_BUF_SZ , run);while ((line_str =strsep (&tmp,"\n" )) &&strlen (line_str)) {
Signature · 1 line
2.43.0