All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Vandana BN <bnvandana@gmail.com>,
	linux-media@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH v9] vivid: Add metadata capture support
Date: Mon, 7 Oct 2019 16:31:44 +0200	[thread overview]
Message-ID: <96d53360-5520-f253-db8e-995bf5920746@xs4all.nl> (raw)
In-Reply-To: <20191004102457.27611-1-bnvandana@gmail.com>

On 10/4/19 12:24 PM, Vandana BN wrote:
> +void vivid_meta_cap_fillbuff(struct vivid_dev *dev,
> +			     struct vivid_buffer *buf, u32 soe)

soe should have been a u64 since f_time is a u64.

> +{
> +	struct vivid_uvc_meta_buf *meta = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
> +	int buf_off = 0;
> +
> +	buf->vb.sequence = dev->meta_cap_seq_count;
> +	if (dev->field_cap == V4L2_FIELD_ALTERNATE)
> +		buf->vb.sequence /= 2;
> +	memset(meta, 1, vb2_plane_size(&buf->vb.vb2_buf, 0));
> +
> +	meta->ns = ktime_get_ns();
> +	meta->sof = buf->vb.sequence * 30;
> +	meta->length = sizeof(*meta) - offsetof(struct vivid_uvc_meta_buf, length);
> +	meta->flags = UVC_STREAM_EOH | UVC_STREAM_EOF;
> +
> +	if ((buf->vb.sequence % 2) == 0)
> +		meta->flags |= UVC_STREAM_FID;
> +
> +	dprintk(dev, 2, "%s ns:%llu sof:%4d len:%u flags: 0x%02x",
> +		__func__, meta->ns, meta->sof, meta->length, meta->flags);
> +	if (dev->meta_pts) {
> +		meta->flags |= UVC_STREAM_PTS;
> +		meta->buf[0] = soe / VIVID_META_CLOCK_UNIT;

Use div_u64() here.

> +		buf_off = 4;
> +		dprintk(dev, 2, " pts: %u\n", *(__u32 *)(meta->buf));
> +	}
> +
> +	if (dev->meta_scr) {
> +		meta->flags |= UVC_STREAM_SCR;
> +		meta->buf[buf_off] = (soe + dev->cap_frame_eof_offset)
> +					/ VIVID_META_CLOCK_UNIT;

Same here (and this is the cause of the kbuild error).

> +
> +		meta->buf[buf_off + 4] = (buf->vb.sequence * 30) % 1000;
> +		dprintk(dev, 2, " stc: %u, sof counter: %u\n",
> +			*(__u32 *)(meta->buf + buf_off),
> +			*(__u16 *)(meta->buf + buf_off + 4));
> +	}
> +	dprintk(dev, 2, "\n");
> +}

Regards,

	Hans

WARNING: multiple messages have this Message-ID (diff)
From: hverkuil at xs4all.nl (Hans Verkuil)
Subject: [Linux-kernel-mentees] [PATCH v9] vivid: Add metadata capture support
Date: Mon, 7 Oct 2019 16:31:44 +0200	[thread overview]
Message-ID: <96d53360-5520-f253-db8e-995bf5920746@xs4all.nl> (raw)
In-Reply-To: <20191004102457.27611-1-bnvandana@gmail.com>

On 10/4/19 12:24 PM, Vandana BN wrote:
> +void vivid_meta_cap_fillbuff(struct vivid_dev *dev,
> +			     struct vivid_buffer *buf, u32 soe)

soe should have been a u64 since f_time is a u64.

> +{
> +	struct vivid_uvc_meta_buf *meta = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
> +	int buf_off = 0;
> +
> +	buf->vb.sequence = dev->meta_cap_seq_count;
> +	if (dev->field_cap == V4L2_FIELD_ALTERNATE)
> +		buf->vb.sequence /= 2;
> +	memset(meta, 1, vb2_plane_size(&buf->vb.vb2_buf, 0));
> +
> +	meta->ns = ktime_get_ns();
> +	meta->sof = buf->vb.sequence * 30;
> +	meta->length = sizeof(*meta) - offsetof(struct vivid_uvc_meta_buf, length);
> +	meta->flags = UVC_STREAM_EOH | UVC_STREAM_EOF;
> +
> +	if ((buf->vb.sequence % 2) == 0)
> +		meta->flags |= UVC_STREAM_FID;
> +
> +	dprintk(dev, 2, "%s ns:%llu sof:%4d len:%u flags: 0x%02x",
> +		__func__, meta->ns, meta->sof, meta->length, meta->flags);
> +	if (dev->meta_pts) {
> +		meta->flags |= UVC_STREAM_PTS;
> +		meta->buf[0] = soe / VIVID_META_CLOCK_UNIT;

Use div_u64() here.

> +		buf_off = 4;
> +		dprintk(dev, 2, " pts: %u\n", *(__u32 *)(meta->buf));
> +	}
> +
> +	if (dev->meta_scr) {
> +		meta->flags |= UVC_STREAM_SCR;
> +		meta->buf[buf_off] = (soe + dev->cap_frame_eof_offset)
> +					/ VIVID_META_CLOCK_UNIT;

Same here (and this is the cause of the kbuild error).

> +
> +		meta->buf[buf_off + 4] = (buf->vb.sequence * 30) % 1000;
> +		dprintk(dev, 2, " stc: %u, sof counter: %u\n",
> +			*(__u32 *)(meta->buf + buf_off),
> +			*(__u16 *)(meta->buf + buf_off + 4));
> +	}
> +	dprintk(dev, 2, "\n");
> +}

Regards,

	Hans

WARNING: multiple messages have this Message-ID (diff)
From: hverkuil@xs4all.nl (Hans Verkuil)
Subject: [Linux-kernel-mentees] [PATCH v9] vivid: Add metadata capture support
Date: Mon, 7 Oct 2019 16:31:44 +0200	[thread overview]
Message-ID: <96d53360-5520-f253-db8e-995bf5920746@xs4all.nl> (raw)
Message-ID: <20191007143144.IALvcJ48pFDaNA89NnmnJq9KSzcwSE0MKSdLrdZSQAk@z> (raw)
In-Reply-To: <20191004102457.27611-1-bnvandana@gmail.com>

On 10/4/19 12:24 PM, Vandana BN wrote:
> +void vivid_meta_cap_fillbuff(struct vivid_dev *dev,
> +			     struct vivid_buffer *buf, u32 soe)

soe should have been a u64 since f_time is a u64.

> +{
> +	struct vivid_uvc_meta_buf *meta = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
> +	int buf_off = 0;
> +
> +	buf->vb.sequence = dev->meta_cap_seq_count;
> +	if (dev->field_cap == V4L2_FIELD_ALTERNATE)
> +		buf->vb.sequence /= 2;
> +	memset(meta, 1, vb2_plane_size(&buf->vb.vb2_buf, 0));
> +
> +	meta->ns = ktime_get_ns();
> +	meta->sof = buf->vb.sequence * 30;
> +	meta->length = sizeof(*meta) - offsetof(struct vivid_uvc_meta_buf, length);
> +	meta->flags = UVC_STREAM_EOH | UVC_STREAM_EOF;
> +
> +	if ((buf->vb.sequence % 2) == 0)
> +		meta->flags |= UVC_STREAM_FID;
> +
> +	dprintk(dev, 2, "%s ns:%llu sof:%4d len:%u flags: 0x%02x",
> +		__func__, meta->ns, meta->sof, meta->length, meta->flags);
> +	if (dev->meta_pts) {
> +		meta->flags |= UVC_STREAM_PTS;
> +		meta->buf[0] = soe / VIVID_META_CLOCK_UNIT;

Use div_u64() here.

> +		buf_off = 4;
> +		dprintk(dev, 2, " pts: %u\n", *(__u32 *)(meta->buf));
> +	}
> +
> +	if (dev->meta_scr) {
> +		meta->flags |= UVC_STREAM_SCR;
> +		meta->buf[buf_off] = (soe + dev->cap_frame_eof_offset)
> +					/ VIVID_META_CLOCK_UNIT;

Same here (and this is the cause of the kbuild error).

> +
> +		meta->buf[buf_off + 4] = (buf->vb.sequence * 30) % 1000;
> +		dprintk(dev, 2, " stc: %u, sof counter: %u\n",
> +			*(__u32 *)(meta->buf + buf_off),
> +			*(__u16 *)(meta->buf + buf_off + 4));
> +	}
> +	dprintk(dev, 2, "\n");
> +}

Regards,

	Hans

  reply	other threads:[~2019-10-07 14:31 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03  9:45 [PATCH v2] vivid: Add metadata capture support Vandana BN
2019-09-03  9:45 ` [Linux-kernel-mentees] " Vandana BN
2019-09-03  9:45 ` bnvandana
2019-09-09  9:52 ` [PATCH v3] " Vandana BN
2019-09-09  9:52   ` [Linux-kernel-mentees] " Vandana BN
2019-09-09  9:52   ` bnvandana
2019-09-11 11:17   ` [PATCH v4] " Vandana BN
2019-09-11 11:17     ` [Linux-kernel-mentees] " Vandana BN
2019-09-11 11:17     ` bnvandana
2019-09-13 12:01     ` Hans Verkuil
2019-09-13 12:01       ` [Linux-kernel-mentees] " Hans Verkuil
2019-09-13 12:01       ` hverkuil
2019-09-16  7:48       ` [PATCH v5] " Vandana BN
2019-09-16  7:48         ` [Linux-kernel-mentees] " Vandana BN
2019-09-16  7:48         ` bnvandana
2019-09-16 11:46         ` Hans Verkuil
2019-09-16 11:46           ` [Linux-kernel-mentees] " Hans Verkuil
2019-09-16 11:46           ` hverkuil
2019-09-16 14:08           ` [PATCH v6] " Vandana BN
2019-09-16 14:08             ` [Linux-kernel-mentees] " Vandana BN
2019-09-16 14:08             ` bnvandana
2019-09-17 11:03             ` Hans Verkuil
2019-09-17 11:03               ` [Linux-kernel-mentees] " Hans Verkuil
2019-09-17 11:03               ` hverkuil
2019-09-25  8:27               ` [PATCH v7 0/2] " Vandana BN
2019-09-25  8:27                 ` [Linux-kernel-mentees] " Vandana BN
2019-09-25  8:27                 ` bnvandana
2019-09-25  8:27                 ` [PATCH v7 1/2] " Vandana BN
2019-09-25  8:27                   ` [Linux-kernel-mentees] " Vandana BN
2019-09-25  8:27                   ` bnvandana
2019-10-03 12:50                   ` Hans Verkuil
2019-10-03 12:50                     ` [Linux-kernel-mentees] " Hans Verkuil
2019-10-03 12:50                     ` hverkuil
2019-10-04  9:44                     ` [PATCH v8] " Vandana BN
2019-10-04  9:44                       ` [Linux-kernel-mentees] " Vandana BN
2019-10-04  9:44                       ` bnvandana
2019-10-04 10:02                       ` Hans Verkuil
2019-10-04 10:02                         ` [Linux-kernel-mentees] " Hans Verkuil
2019-10-04 10:02                         ` hverkuil
2019-10-04 10:24                         ` [PATCH v9] " Vandana BN
2019-10-04 10:24                           ` [Linux-kernel-mentees] " Vandana BN
2019-10-04 10:24                           ` bnvandana
2019-10-07 14:31                           ` Hans Verkuil [this message]
2019-10-07 14:31                             ` Hans Verkuil
2019-10-07 14:31                             ` hverkuil
2019-10-08  7:27                             ` [PATCH v10 0/3] vivid: Metadata support Vandana BN
2019-10-08  7:27                               ` [Linux-kernel-mentees] " Vandana BN
2019-10-08  7:27                               ` bnvandana
2019-10-08  7:27                               ` [PATCH v10 1/3] vivid: Add metadata capture support Vandana BN
2019-10-08  7:27                                 ` [Linux-kernel-mentees] " Vandana BN
2019-10-08  7:27                                 ` bnvandana
2019-10-08  7:27                               ` [PATCH v10 2/3] v4l2-core: Add new metadata format Vandana BN
2019-10-08  7:27                                 ` [Linux-kernel-mentees] " Vandana BN
2019-10-08  7:27                                 ` bnvandana
2019-10-08  7:27                               ` [PATCH v10 3/3] vivid: Add metadata output support Vandana BN
2019-10-08  7:27                                 ` [Linux-kernel-mentees] " Vandana BN
2019-10-08  7:27                                 ` bnvandana
2019-10-15 10:40                               ` [PATCH v11 0/3] vivid: Metadata support Vandana BN
2019-10-15 10:40                                 ` [Linux-kernel-mentees] " Vandana BN
2019-10-15 10:40                                 ` bnvandana
2019-10-15 10:40                                 ` [PATCH v11 1/3] vivid: Add metadata capture support Vandana BN
2019-10-15 10:40                                   ` [Linux-kernel-mentees] " Vandana BN
2019-10-15 10:40                                   ` bnvandana
2019-10-15 10:40                                 ` [PATCH v11 2/3] v4l2-core: Add new metadata format Vandana BN
2019-10-15 10:40                                   ` [Linux-kernel-mentees] " Vandana BN
2019-10-15 10:40                                   ` bnvandana
2019-10-15 10:40                                 ` [PATCH v11 3/3] vivid: Add metadata output support Vandana BN
2019-10-15 10:40                                   ` [Linux-kernel-mentees] " Vandana BN
2019-10-15 10:40                                   ` bnvandana
2019-09-25  8:27                 ` [PATCH v7 2/2] vivid: fixes for v4l2-compliance issues Vandana BN
2019-09-25  8:27                   ` [Linux-kernel-mentees] " Vandana BN
2019-09-25  8:27                   ` bnvandana
2019-10-03 12:54                   ` Hans Verkuil
2019-10-03 12:54                     ` [Linux-kernel-mentees] " Hans Verkuil
2019-10-03 12:54                     ` hverkuil

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=96d53360-5520-f253-db8e-995bf5920746@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=bnvandana@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-media@vger.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.