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.
Add a "stable_output" module parameter to make sure that a given input
stream always outputs the same frames.
This is done by skipping information like queues status and pointer
values.
This also adds some stable variation in the frames so that different
input give more different output.
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 stable_output parameter
doc: visl: Document stable_output parameter
visl: Add codec specific variability on output frames
Documentation/admin-guide/media/visl.rst | 4 +
.../media/test-drivers/vidtv/vidtv_bridge.c | 20 +-
drivers/media/test-drivers/visl/visl-core.c | 15 +-
drivers/media/test-drivers/visl/visl-dec.c | 292 ++++++++++++------
drivers/media/test-drivers/visl/visl.h | 1 +
5 files changed, 221 insertions(+), 111 deletions(-)
--
2.41.0
When 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.
Reviewed-by: Daniel Almeida <[email protected]>
Signed-off-by: Detlev Casanova <[email protected]>
---
drivers/media/test-drivers/visl/visl-dec.c | 36 ++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/drivers/media/test-drivers/visl/visl-dec.c b/drivers/media/test-drivers/visl/visl-dec.c
index a6c878f0813a..60fca1ddadcd 100644
--- a/drivers/media/test-drivers/visl/visl-dec.c
+++ b/drivers/media/test-drivers/visl/visl-dec.c
@@ -272,6 +272,35 @@ static void visl_tpg_fill_sequence(struct visl_ctx *ctx,
}
}
+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];
@@ -304,6 +333,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)) {
--
2.41.0
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.
Reviewed-by: Daniel Almeida <[email protected]>
Signed-off-by: Detlev Casanova <[email protected]>
---
.../media/test-drivers/vidtv/vidtv_bridge.c | 20 +++++++++----------
drivers/media/test-drivers/visl/visl-core.c | 10 +++++-----
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
index 8b04e12af286..5dd7b1b4f7f1 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
@@ -45,21 +45,21 @@
#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] = {
@@ -86,7 +86,7 @@ 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");
diff --git a/drivers/media/test-drivers/visl/visl-core.c b/drivers/media/test-drivers/visl/visl-core.c
index 9970dc739ca5..ef89eead6671 100644
--- a/drivers/media/test-drivers/visl/visl-core.c
+++ b/drivers/media/test-drivers/visl/visl-core.c
@@ -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");
--
2.41.0
Reviewed-by: Daniel Almeida <[email protected]>
Signed-off-by: Detlev Casanova <[email protected]>
---
Documentation/admin-guide/media/visl.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/admin-guide/media/visl.rst b/Documentation/admin-guide/media/visl.rst
index 4328c6c72d30..1a555e42a81a 100644
--- a/Documentation/admin-guide/media/visl.rst
+++ b/Documentation/admin-guide/media/visl.rst
@@ -49,6 +49,10 @@ Module parameters
visl_dprintk_frame_start, visl_dprintk_nframes, but controls the dumping of
buffer data through debugfs instead.
+- stable_output: Limit the information written on each output frame to make
+ sure that, for a given input, the output frames are always exactly the same.
+ This is useful for automated tests to check that output frames are correct.
+
What is the default use case for this driver?
---------------------------------------------
--
2.41.0
On 23/11/2023 20:57, Detlev Casanova wrote:
> 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.
You missed a few more:
$ git grep "module_param.*, 0)" drivers/media/test-drivers/
drivers/media/test-drivers/vidtv/vidtv_bridge.c:module_param_array(vidtv_valid_dvb_t_freqs, uint, NULL, 0);
drivers/media/test-drivers/vidtv/vidtv_bridge.c:module_param_array(vidtv_valid_dvb_c_freqs, uint, NULL, 0);
drivers/media/test-drivers/vidtv/vidtv_bridge.c:module_param_array(vidtv_valid_dvb_s_freqs, uint, NULL, 0);
Regards,
Hans
>
> Reviewed-by: Daniel Almeida <[email protected]>
> Signed-off-by: Detlev Casanova <[email protected]>
> ---
> .../media/test-drivers/vidtv/vidtv_bridge.c | 20 +++++++++----------
> drivers/media/test-drivers/visl/visl-core.c | 10 +++++-----
> 2 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
> index 8b04e12af286..5dd7b1b4f7f1 100644
> --- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
> +++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
> @@ -45,21 +45,21 @@
> #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] = {
> @@ -86,7 +86,7 @@ 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");
>
> diff --git a/drivers/media/test-drivers/visl/visl-core.c b/drivers/media/test-drivers/visl/visl-core.c
> index 9970dc739ca5..ef89eead6671 100644
> --- a/drivers/media/test-drivers/visl/visl-core.c
> +++ b/drivers/media/test-drivers/visl/visl-core.c
> @@ -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");
>