From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Satendra Singh Thakur <satendra.t@samsung.com>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>,
Seung-Woo Kim <sw0312.kim@samsung.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Geunyoung Kim <nenggun.kim@samsung.com>,
Philippe Ombredanne <pombredanne@nexb.com>,
Inki Dae <inki.dae@samsung.com>,
Thomas Gleixner <tglx@linutronix.de>,
Junghak Sung <jh1009.sung@samsung.com>,
devendra sharma <devendra.sharma9091@gmail.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH 02/11] media: videobuf2: Add new uAPI for DVB streaming I/O
Date: Mon, 8 Jan 2018 12:38:07 -0200 [thread overview]
Message-ID: <20180108123807.489c7b2a@vento.lan> (raw)
In-Reply-To: <10d07ce3-d035-90b9-eac0-6d9786ae72de@xs4all.nl>
Em Mon, 8 Jan 2018 15:26:50 +0100
Hans Verkuil <hverkuil@xs4all.nl> escreveu:
> A quick follow-up:
>
> On 01/08/2018 02:54 PM, Hans Verkuil wrote:
> >> +/*
> >> + * Videobuf operations
> >> + */
> >> +int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int nonblocking)
> >> +{
> >> + struct vb2_queue *q = &ctx->vb_q;
> >> + int ret;
> >> +
> >> + memset(ctx, 0, sizeof(struct dvb_vb2_ctx));
> >> + q->type = DVB_BUF_TYPE_CAPTURE;
> >
> > We don't support DVB_BUF_TYPE_OUTPUT? Shouldn't this information come from the
> > driver?
> >
> >> + /**capture type*/
> >
> > Why /** ?
> >
> >> + q->is_output = 0;
> >
> > Can be dropped unless we support DVB_BUF_TYPE_OUTPUT.
> >
> >> + /**only mmap is supported currently*/
> >
> > /** ?
> >
> >> + q->io_modes = VB2_MMAP;
> >> + q->drv_priv = ctx;
> >> + q->buf_struct_size = sizeof(struct dvb_buffer);
> >> + q->min_buffers_needed = 1;
> >> + q->ops = &dvb_vb2_qops;
> >> + q->mem_ops = &vb2_vmalloc_memops;
> >> + q->buf_ops = &dvb_vb2_buf_ops;
> >> + q->num_buffers = 0;
> >
> > Not needed, is zeroed in the memset above.
> >
> > I'm also missing q->timestamp_flags: should be set to V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC.
>
> Ignore this, see my comments later on.
>
> >
> >> + ret = vb2_core_queue_init(q);
> >> + if (ret) {
> >> + ctx->state = DVB_VB2_STATE_NONE;
> >> + dprintk(1, "[%s] errno=%d\n", ctx->name, ret);
> >> + return ret;
> >> + }
> >> +
> >> + mutex_init(&ctx->mutex);
> >> + spin_lock_init(&ctx->slock);
> >> + INIT_LIST_HEAD(&ctx->dvb_q);
> >> +
> >> + strncpy(ctx->name, name, DVB_VB2_NAME_MAX);
> >
> > I believe strlcpy is recommended.
> >
> >> + ctx->nonblocking = nonblocking;
> >> + ctx->state = DVB_VB2_STATE_INIT;
> >> +
> >> + dprintk(3, "[%s]\n", ctx->name);
> >> +
> >> + return 0;
> >> +}
>
> <snip>
>
> >> diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
> >> index c10f1324b4ca..e212aa18ad78 100644
> >> --- a/include/uapi/linux/dvb/dmx.h
> >> +++ b/include/uapi/linux/dvb/dmx.h
> >> @@ -211,6 +211,64 @@ struct dmx_stc {
> >> __u64 stc;
> >> };
> >>
> >> +/**
> >> + * struct dmx_buffer - dmx buffer info
> >> + *
> >> + * @index: id number of the buffer
> >> + * @bytesused: number of bytes occupied by data in the buffer (payload);
> >> + * @offset: for buffers with memory == DMX_MEMORY_MMAP;
> >> + * offset from the start of the device memory for this plane,
> >> + * (or a "cookie" that should be passed to mmap() as offset)
> >
> > Since we only support MMAP this is always a 'cookie' in practice. So I think this
> > should just be:
> >
> > A "cookie" that should be passed to mmap() as offset.
> >
> >> + * @length: size in bytes of the buffer
> >> + *
> >> + * Contains data exchanged by application and driver using one of the streaming
> >> + * I/O methods.
> >> + */
> >> +struct dmx_buffer {
> >> + __u32 index;
> >> + __u32 bytesused;
> >> + __u32 offset;
> >
> > I suggest making this a __u64: that way we can handle pointers as well in
> > the future if we need them (as we do for the USERPTR case for V4L2).
> >
> > Should this also be wrapped in a union? Useful when adding dmabuf support in the
> > future.
> >
> > Do you think there is any use-case for multiplanar formats in the future?
> > With perhaps meta data in a separate plane? Having to add support for this later
> > has proven to be very painful, so we need to be as certain as possible that
> > this isn't going to happen. Otherwise it's better to prepare for this right now.
> >
> >> + __u32 length;
> >> + __u32 reserved[4];
> >
> > I do believe you need a memory field as well. It's only MMAP today, but in
> > the future DMABUF will most likely be supported as well and you need to be
> > able to tell what memory mode is being used.
> >
> >> +};
>
> There is no 'flags' field here. But without that you cannot check the buffer
> states, esp. the ERROR state. Or can that never happen?
On DVB, there is a protocol stack there that allows checking errors,
either MPEG-TS (current standards) or IP/MMT - for the new, yet to be
implemented ATSC version 3 standard.
Even if we add an error state, userspace will just ignore, as it will
need to verify the packet CRC checks.
> Would a timestamp field be useful, if only for debugging?
I don't see how a timestamp will help here for debugging. Probably,
adding event trace points would work better, but we have those
already at vb2-core.
Anyway, as this is kAPI only, we can add it later as needed.
Thanks,
Mauro
next prev parent reply other threads:[~2018-01-08 14:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 16:17 [PATCH 00/11] dvb: add support for memory mapped I/O Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 01/11] media: vb2-core: Fix a bug about unnecessary calls to queue cancel and free Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 02/11] media: videobuf2: Add new uAPI for DVB streaming I/O Mauro Carvalho Chehab
2018-01-08 13:54 ` Hans Verkuil
2018-01-08 14:26 ` Hans Verkuil
2018-01-08 14:38 ` Mauro Carvalho Chehab [this message]
2018-01-08 14:27 ` Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 03/11] media: vb2-core: add pr_fmt() macro Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 04/11] media: vb2-core: add a new warning about pending buffers Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 05/11] media: dvb_vb2: fix a warning about streamoff logic Mauro Carvalho Chehab
2017-12-22 15:48 ` Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 06/11] media: move videobuf2 to drivers/media/common Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 07/11] media: dvb uAPI docs: document demux mmap/munmap syscalls Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 08/11] media: dvb uAPI docs: document mmap-related ioctls Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 09/11] media: dvb-core: get rid of mmap reserved field Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 10/11] fs: compat_ioctl: add new DVB demux ioctls Mauro Carvalho Chehab
2017-12-21 16:18 ` [PATCH 11/11] media: dvb_vb2: add SPDX headers Mauro Carvalho Chehab
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=20180108123807.489c7b2a@vento.lan \
--to=mchehab@s-opensource.com \
--cc=corbet@lwn.net \
--cc=devendra.sharma9091@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil@xs4all.nl \
--cc=inki.dae@samsung.com \
--cc=jh1009.sung@samsung.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=nenggun.kim@samsung.com \
--cc=pombredanne@nexb.com \
--cc=sakari.ailus@linux.intel.com \
--cc=satendra.t@samsung.com \
--cc=sw0312.kim@samsung.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).