All of lore.kernel.org
 help / color / mirror / Atom feed
From: Detlev Casanova <detlev.casanova@collabora.com>
To: linux-kernel@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
	Daniel Almeida <daniel.almeida@collabora.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: Re: [PATCH v2 2/5] media: visl: Add a stable_output parameter
Date: Wed, 22 Nov 2023 11:49:21 -0500	[thread overview]
Message-ID: <2913770.e9J7NaK4W3@arisu> (raw)
In-Reply-To: <e8594414-eaea-4022-8835-0c093657b005@xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 9886 bytes --]

On Wednesday, November 22, 2023 11:03:53 A.M. EST Hans Verkuil wrote:
> On 24/10/2023 21:09, Detlev Casanova wrote:
> > This parameter is used to ensure that for a given input, the output
> > frames are always identical so that it can be compared against
> > a reference in automatic tests.
> > 
> > Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
> > Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> > ---
> > 
> >  drivers/media/test-drivers/visl/visl-core.c |   5 +
> >  drivers/media/test-drivers/visl/visl-dec.c  | 125 +++++++++++---------
> >  drivers/media/test-drivers/visl/visl.h      |   1 +
> >  3 files changed, 77 insertions(+), 54 deletions(-)
> > 
> > diff --git a/drivers/media/test-drivers/visl/visl-core.c
> > b/drivers/media/test-drivers/visl/visl-core.c index
> > df6515530fbf..d28d50afec02 100644
> > --- a/drivers/media/test-drivers/visl/visl-core.c
> > +++ b/drivers/media/test-drivers/visl/visl-core.c
> > @@ -88,6 +88,11 @@ module_param(bitstream_trace_nframes, uint, 0);
> > 
> >  MODULE_PARM_DESC(bitstream_trace_nframes,
> >  
> >  		 " the number of frames to dump the bitstream through 
debugfs");
> > 
> > +bool stable_output;
> > +module_param(stable_output, bool, 0644);
> > +MODULE_PARM_DESC(stable_output,
> > +		 " only write stable data for a given input on the 
output frames");
> > +
> > 
> >  static const struct visl_ctrl_desc visl_fwht_ctrl_descs[] = {
> >  
> >  	{
> >  	
> >  		.cfg.id = V4L2_CID_STATELESS_FWHT_PARAMS,
> > 
> > diff --git a/drivers/media/test-drivers/visl/visl-dec.c
> > b/drivers/media/test-drivers/visl/visl-dec.c index
> > 318d675e5668..61cfca49ead9 100644
> > --- a/drivers/media/test-drivers/visl/visl-dec.c
> > +++ b/drivers/media/test-drivers/visl/visl-dec.c
> > @@ -197,19 +197,30 @@ static void visl_tpg_fill_sequence(struct visl_ctx
> > *ctx,> 
> >  {
> >  
> >  	u32 stream_ms;
> > 
> > -	stream_ms = jiffies_to_msecs(get_jiffies_64() -
> > ctx->capture_streamon_jiffies); -
> > -	scnprintf(buf, bufsz,
> > -		  "stream time: %02d:%02d:%02d:%03d sequence:%u 
timestamp:%lld
> > field:%s", -		  (stream_ms / (60 * 60 * 1000)) % 24,
> > -		  (stream_ms / (60 * 1000)) % 60,
> > -		  (stream_ms / 1000) % 60,
> > -		  stream_ms % 1000,
> > -		  run->dst->sequence,
> > -		  run->dst->vb2_buf.timestamp,
> > -		  (run->dst->field == V4L2_FIELD_ALTERNATE) ?
> > -		  (run->dst->field == V4L2_FIELD_TOP ?
> > -		  " top" : " bottom") : "none");
> > +	if (!stable_output) {
> > +		stream_ms = jiffies_to_msecs(get_jiffies_64() -
> > ctx->capture_streamon_jiffies); +
> > +		scnprintf(buf, bufsz,
> > +			  "stream time: %02d:%02d:%02d:%03d 
sequence:%u timestamp:%lld
> > field:%s", +			  (stream_ms / (60 * 60 * 
1000)) % 24,
> > +			  (stream_ms / (60 * 1000)) % 60,
> > +			  (stream_ms / 1000) % 60,
> > +			  stream_ms % 1000,
> 
> How useful is this 'stream time' anyway? I don't think this adds anything
> useful.

I suppose that the more debug information is shown, the better.

> > +			  run->dst->sequence,
> > +			  run->dst->vb2_buf.timestamp,
> > +			  (run->dst->field == V4L2_FIELD_ALTERNATE) ?
> > +			  (run->dst->field == V4L2_FIELD_TOP ?
> > +			  " top" : " bottom") : "none");
> > +	} else {
> > +		scnprintf(buf, bufsz,
> > +			  "sequence:%u timestamp:%lld field:%s",
> > +			  run->dst->sequence,
> > +			  run->dst->vb2_buf.timestamp,
> > +			  (run->dst->field == V4L2_FIELD_ALTERNATE) ?
> > +			  (run->dst->field == V4L2_FIELD_TOP ?
> > +			  " top" : " bottom") : "none");
> > +
> > +	}
> > 
> >  }
> >  
> >  static void visl_tpg_fill(struct visl_ctx *ctx, struct visl_run *run)
> > 
> > @@ -244,15 +255,17 @@ static void visl_tpg_fill(struct visl_ctx *ctx,
> > struct visl_run *run)> 
> >  	frame_dprintk(ctx->dev, run->dst->sequence, "");
> >  	line++;
> > 
> > -	visl_get_ref_frames(ctx, buf, TPG_STR_BUF_SZ, run);
> 
> This function shows both the ts of the ref frames and the buffer
> index. Is it just the buffer index that causes the problem? If so,
> then wouldn't it be better to either never show the buffer index
> or only if !stable_output.

Indeed, the buffer index is the issue, but I did not check if the ref frames ts 
are stable. I'll do some tests with it and keep the ref frames in stable 
output mode if they are stable.

> > +	if (!stable_output) {
> > +		visl_get_ref_frames(ctx, buf, TPG_STR_BUF_SZ, run);
> > 
> > -	while ((line_str = strsep(&tmp, "\n")) && strlen(line_str)) {
> > -		tpg_gen_text(&ctx->tpg, basep, line++ * line_height, 
16, line_str);
> > -		frame_dprintk(ctx->dev, run->dst->sequence, "%s\n", 
line_str);
> > -	}
> > +		while ((line_str = strsep(&tmp, "\n")) && 
strlen(line_str)) {
> > +			tpg_gen_text(&ctx->tpg, basep, line++ * 
line_height, 16, line_str);
> > +			frame_dprintk(ctx->dev, run->dst->sequence, 
"%s\n", line_str);
> > +		}
> > 
> > -	frame_dprintk(ctx->dev, run->dst->sequence, "");
> > -	line++;
> > +		frame_dprintk(ctx->dev, run->dst->sequence, "");
> > +		line++;
> > +	}
> > 
> >  	scnprintf(buf,
> >  	
> >  		  TPG_STR_BUF_SZ,
> > 
> > @@ -280,28 +293,30 @@ static void visl_tpg_fill(struct visl_ctx *ctx,
> > struct visl_run *run)> 
> >  		frame_dprintk(ctx->dev, run->dst->sequence, "%s\n", 
buf);
> >  	
> >  	}
> > 
> > -	line++;
> > -	frame_dprintk(ctx->dev, run->dst->sequence, "");
> > -	scnprintf(buf, TPG_STR_BUF_SZ, "Output queue status:");
> > -	tpg_gen_text(&ctx->tpg, basep, line++ * line_height, 16, buf);
> > -	frame_dprintk(ctx->dev, run->dst->sequence, "%s\n", buf);
> > +	if (!stable_output) {
> > +		line++;
> > +		frame_dprintk(ctx->dev, run->dst->sequence, "");
> > +		scnprintf(buf, TPG_STR_BUF_SZ, "Output queue status:");
> > +		tpg_gen_text(&ctx->tpg, basep, line++ * line_height, 
16, buf);
> > +		frame_dprintk(ctx->dev, run->dst->sequence, "%s\n", 
buf);
> > 
> > -	len = 0;
> > -	for (i = 0; i < out_q->num_buffers; i++) {
> > -		char entry[] = "index: %u, state: %s, request_fd: %d, 
";
> > -		u32 old_len = len;
> > -		char *q_status = visl_get_vb2_state(out_q->bufs[i]-
>state);
> > +		len = 0;
> > +		for (i = 0; i < out_q->num_buffers; i++) {
> > +			char entry[] = "index: %u, state: %s, 
request_fd: %d, ";
> > +			u32 old_len = len;
> > +			char *q_status = visl_get_vb2_state(out_q-
>bufs[i]->state);
> > 
> > -		len += scnprintf(&buf[len], TPG_STR_BUF_SZ - len,
> > -				 entry, i, q_status,
> > -				 to_vb2_v4l2_buffer(out_q-
>bufs[i])->request_fd);
> > +			len += scnprintf(&buf[len], TPG_STR_BUF_SZ - 
len,
> > +					 entry, i, q_status,
> > +					 
to_vb2_v4l2_buffer(out_q->bufs[i])->request_fd);
> > 
> > -		len += visl_fill_bytesused(to_vb2_v4l2_buffer(out_q-
>bufs[i]),
> > -					   &buf[len],
> > -					   TPG_STR_BUF_SZ - 
len);
> > +			len += 
visl_fill_bytesused(to_vb2_v4l2_buffer(out_q->bufs[i]),
> > +						   
&buf[len],
> > +						   
TPG_STR_BUF_SZ - len);
> > 
> > -		tpg_gen_text(&ctx->tpg, basep, line++ * line_height, 
16,
> > &buf[old_len]);
> > -		frame_dprintk(ctx->dev, run->dst->sequence, "%s", 
&buf[old_len]);
> > +			tpg_gen_text(&ctx->tpg, basep, line++ * 
line_height, 16,
> > &buf[old_len]); +			frame_dprintk(ctx->dev, run-
>dst->sequence, "%s",
> > &buf[old_len]); +		}
> > 
> >  	}
> >  	
> >  	line++;
> > 
> > @@ -333,25 +348,27 @@ static void visl_tpg_fill(struct visl_ctx *ctx,
> > struct visl_run *run)> 
> >  		frame_dprintk(ctx->dev, run->dst->sequence, "%s\n", 
buf);
> >  	
> >  	}
> > 
> > -	line++;
> > -	frame_dprintk(ctx->dev, run->dst->sequence, "");
> > -	scnprintf(buf, TPG_STR_BUF_SZ, "Capture queue status:");
> > -	tpg_gen_text(&ctx->tpg, basep, line++ * line_height, 16, buf);
> > -	frame_dprintk(ctx->dev, run->dst->sequence, "%s\n", buf);
> > +	if (!stable_output) {
> > +		line++;
> > +		frame_dprintk(ctx->dev, run->dst->sequence, "");
> > +		scnprintf(buf, TPG_STR_BUF_SZ, "Capture queue 
status:");
> > +		tpg_gen_text(&ctx->tpg, basep, line++ * line_height, 
16, buf);
> > +		frame_dprintk(ctx->dev, run->dst->sequence, "%s\n", 
buf);
> > 
> > -	len = 0;
> > -	for (i = 0; i < cap_q->num_buffers; i++) {
> > -		u32 old_len = len;
> > -		char *q_status = visl_get_vb2_state(cap_q->bufs[i]-
>state);
> > +		len = 0;
> > +		for (i = 0; i < cap_q->num_buffers; i++) {
> > +			u32 old_len = len;
> > +			char *q_status = visl_get_vb2_state(cap_q-
>bufs[i]->state);
> > 
> > -		len += scnprintf(&buf[len], TPG_STR_BUF_SZ - len,
> > -				 "index: %u, status: %s, 
timestamp: %llu, is_held: %d",
> > -				 cap_q->bufs[i]->index, q_status,
> > -				 cap_q->bufs[i]->timestamp,
> > -				 to_vb2_v4l2_buffer(cap_q-
>bufs[i])->is_held);
> > +			len += scnprintf(&buf[len], TPG_STR_BUF_SZ - 
len,
> > +					 "index: %u, status: 
%s, timestamp: %llu, is_held: %d",
> > +					 cap_q->bufs[i]-
>index, q_status,
> > +					 cap_q->bufs[i]-
>timestamp,
> > +					 
to_vb2_v4l2_buffer(cap_q->bufs[i])->is_held);
> > 
> > -		tpg_gen_text(&ctx->tpg, basep, line++ * line_height, 
16,
> > &buf[old_len]);
> > -		frame_dprintk(ctx->dev, run->dst->sequence, "%s", 
&buf[old_len]);
> > +			tpg_gen_text(&ctx->tpg, basep, line++ * 
line_height, 16,
> > &buf[old_len]); +			frame_dprintk(ctx->dev, run-
>dst->sequence, "%s",
> > &buf[old_len]); +		}
> > 
> >  	}
> >  
> >  }
> > 
> > diff --git a/drivers/media/test-drivers/visl/visl.h
> > b/drivers/media/test-drivers/visl/visl.h index 31639f2e593d..5a81b493f121
> > 100644
> > --- a/drivers/media/test-drivers/visl/visl.h
> > +++ b/drivers/media/test-drivers/visl/visl.h
> > @@ -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 stable_output;
> > 
> >  #define frame_dprintk(dev, current, fmt, arg...) \
> >  
> >  	do { \
> 
> Should stable_output perhaps be 1 by default?

In that case, why not use the visl_debug parameter and show the unstable data 
only when it is set to one ?

--
Detlev

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-11-22 16:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 19:09 [PATCH v2 0/5] visl: Adapt output frames for reference comparison Detlev Casanova
2023-10-24 19:09 ` [PATCH v2 1/5] media: visl: Fix params permissions/defaults mismatch Detlev Casanova
2023-11-22 15:56   ` Hans Verkuil
2023-11-22 16:38     ` Detlev Casanova
2023-11-23  8:41       ` Hans Verkuil
2023-10-24 19:09 ` [PATCH v2 2/5] media: visl: Add a stable_output parameter Detlev Casanova
2023-11-22 16:03   ` Hans Verkuil
2023-11-22 16:49     ` Detlev Casanova [this message]
2023-11-23  8:44       ` Hans Verkuil
2023-10-24 19:09 ` [PATCH v2 3/5] doc: visl: Document " Detlev Casanova
2023-10-24 19:09 ` [PATCH v2 4/5] visl: Add a codec specific variability parameter Detlev Casanova
2023-11-22 16:07   ` Hans Verkuil
2023-11-22 16:52     ` Detlev Casanova
2023-10-24 19:09 ` [PATCH v2 5/5] doc: visl: Document codec_variability parameter Detlev Casanova

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2913770.e9J7NaK4W3@arisu \
    --to=detlev.casanova@collabora.com \
    --cc=daniel.almeida@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.