linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tiffany lin <tiffany.lin@mediatek.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Hans Verkuil <hans.verkuil@cisco.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Pawel Osciak <posciak@chromium.org>,
	Eddie Huang <eddie.huang@mediatek.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	<linux-kernel@vger.kernel.org>, <linux-media@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH] vcodec: mediatek: Add g/s_selection support for V4L2 Encoder
Date: Wed, 20 Jul 2016 00:44:14 +0800	[thread overview]
Message-ID: <1468946654.30095.4.camel@mtksdaap41> (raw)
In-Reply-To: <f2c031e2-82ca-90f4-0900-4dc961a90f58@xs4all.nl>

Hi Hans,

On Mon, 2016-07-18 at 14:44 +0200, Hans Verkuil wrote:
> On 07/18/2016 02:28 PM, tiffany lin wrote:
> > Understood now.
> > 
> > Now I am trying to figure out how to make this function right.
> > Our encoder only support crop range from (0, 0) to (width, height), so
> > if s->r.top and s->r.left not 0, I will return -EINVAL.
> > 
> > 
> > Another thing is that in v4l2-compliance test, it has testLegacyCrop.
> > It looks like we still need to support 
> >  V4L2_SEL_TGT_COMPOSE_DEFAULT:
> >  V4L2_SEL_TGT_COMPOSE_BOUNDS:
> >  V4L2_SEL_TGT_COMPOSE:
> > to pass v4l2 compliance test, Or it will fail in 
> > fail: v4l2-test-formats.cpp(1318): !doioctl(node, VIDIOC_G_SELECTION,
> > &sel)
> > fail: v4l2-test-formats.cpp(1336): testLegacyCrop(node)
> > test Cropping: FAIL
> 
> Against which kernel are you testing? In the current media_tree master
> there is a bug in drivers/media/v4l2-core/v4l2-ioctl.c, v4l_cropcap():
> 
> This code:
> 
> if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_cropcap))
> 
> should be:
> 
> if (WARN_ON(!ops->vidioc_cropcap && !ops->vidioc_g_selection))
> 
> The fix is waiting for a pull from Linus.
> 
> Also update to the latest v4l2-compliance: I've made some changes that
> might affect this. And I added additional checks to verify if all the
> colorspace-related format fields are properly propagated from the
> output format to the capture format.
> 

Sorry, I miss this part.
After update to latest version include this fix, it can pass crop test
without supporting COMPOSE in output queue.
Appreciated for your help

best regards,
Tiffany



> Regards,
> 
> 	Hans
> 
> > 
> > I don't understand the following testing code.
> > 
> >         /*
> >          * If either CROPCAP or G_CROP works, then G_SELECTION should
> >          * work as well.
> >          * If neither CROPCAP nor G_CROP work, then G_SELECTION
> > shouldn't
> >          * work either.
> >          */
> >         if (!doioctl(node, VIDIOC_CROPCAP, &cap)) {
> >                 fail_on_test(doioctl(node, VIDIOC_G_SELECTION, &sel));
> > 
> >                 // Checks for invalid types
> >                 if (cap.type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
> >                         cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
> >                 else
> >                         cap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> >                 fail_on_test(doioctl(node, VIDIOC_CROPCAP, &cap) !=
> > EINVAL);
> >                 cap.type = 0xff;
> >                 fail_on_test(doioctl(node, VIDIOC_CROPCAP, &cap) !=
> > EINVAL);
> >         } else {
> >                 fail_on_test(!doioctl(node, VIDIOC_G_SELECTION, &sel));
> > -> fail here
> >         }
> > 
> > When test OUTPUT queue, it fail because v4l_cropcap will fail when
> > s.target = V4L2_SEL_TGT_COMPOSE_BOUNDS.
> > If VIDIOC_CROPCAP ioctl fail, VIDIOC_G_SELECTION should fail.
> > But VIDIOC_G_SELECTION target on CROP not COMPOSE and it success.
> > 
> > 
> > best regards,
> > Tiffany
> > 
> > 
> > 
> >> Regards,
> >>
> >> 	Hans
> >>
> >>>
> >>>
> >>> static int v4l_g_crop(const struct v4l2_ioctl_ops *ops,
> >>> 				struct file *file, void *fh, void *arg)
> >>> {
> >>> 	struct v4l2_crop *p = arg;
> >>> 	struct v4l2_selection s = {
> >>> 		.type = p->type,
> >>> 	};
> >>> 	int ret;
> >>>
> >>> 	if (ops->vidioc_g_crop)
> >>> 		return ops->vidioc_g_crop(file, fh, p);
> >>> 	/* simulate capture crop using selection api */
> >>>
> >>> 	/* crop means compose for output devices */
> >>> 	if (V4L2_TYPE_IS_OUTPUT(p->type))
> >>> 		s.target = V4L2_SEL_TGT_COMPOSE_ACTIVE;
> >>> 	else
> >>> 		s.target = V4L2_SEL_TGT_CROP_ACTIVE;
> >>>
> >>> 	ret = ops->vidioc_g_selection(file, fh, &s);
> >>>
> >>> 	/* copying results to old structure on success */
> >>> 	if (!ret)
> >>> 		p->c = s.r;
> >>> 	return ret;
> >>> }
> >>>
> >>> static int v4l_s_crop(const struct v4l2_ioctl_ops *ops,
> >>> 				struct file *file, void *fh, void *arg)
> >>> {
> >>> 	struct v4l2_crop *p = arg;
> >>> 	struct v4l2_selection s = {
> >>> 		.type = p->type,
> >>> 		.r = p->c,
> >>> 	};
> >>>
> >>> 	if (ops->vidioc_s_crop)
> >>> 		return ops->vidioc_s_crop(file, fh, p);
> >>> 	/* simulate capture crop using selection api */
> >>>
> >>> 	/* crop means compose for output devices */
> >>> 	if (V4L2_TYPE_IS_OUTPUT(p->type))
> >>> 		s.target = V4L2_SEL_TGT_COMPOSE_ACTIVE;
> >>> 	else
> >>> 		s.target = V4L2_SEL_TGT_CROP_ACTIVE;
> >>>
> >>> 	return ops->vidioc_s_selection(file, fh, &s);
> >>> }
> >>>
> >>>
> >>> best regards,
> >>> Tiffany
> >>>
> >>>
> >>>
> >>>
> >>>> Regards,
> >>>>
> >>>> 	Hans
> >>>>
> >>>>> +
> >>>>> +	return 0;
> >>>>> +}
> >>>>> +
> >>>>>  static int vidioc_venc_qbuf(struct file *file, void *priv,
> >>>>>  			    struct v4l2_buffer *buf)
> >>>>>  {
> >>>>> @@ -688,6 +759,9 @@ const struct v4l2_ioctl_ops mtk_venc_ioctl_ops = {
> >>>>>  
> >>>>>  	.vidioc_create_bufs		= v4l2_m2m_ioctl_create_bufs,
> >>>>>  	.vidioc_prepare_buf		= v4l2_m2m_ioctl_prepare_buf,
> >>>>> +
> >>>>> +	.vidioc_g_selection		= vidioc_venc_g_selection,
> >>>>> +	.vidioc_s_selection		= vidioc_venc_s_selection,
> >>>>>  };
> >>>>>  
> >>>>>  static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
> >>>>>
> >>>
> >>>
> >>> --
> >>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> >>> the body of a message to majordomo@vger.kernel.org
> >>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>>
> > 
> > 

      reply	other threads:[~2016-07-19 16:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30  7:52 [PATCH] vcodec: mediatek: Add g/s_selection support for V4L2 Encoder Tiffany Lin
2016-07-11  4:32 ` Hans Verkuil
2016-07-11  8:09   ` tiffany lin
2016-07-14  6:27   ` tiffany lin
2016-07-15 17:50     ` Hans Verkuil
2016-07-18 12:28       ` tiffany lin
2016-07-18 12:44         ` Hans Verkuil
2016-07-19 16:44           ` tiffany lin [this message]

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=1468946654.30095.4.camel@mtksdaap41 \
    --to=tiffany.lin@mediatek.com \
    --cc=djkurtz@chromium.org \
    --cc=eddie.huang@mediatek.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@osg.samsung.com \
    --cc=posciak@chromium.org \
    --cc=yingjoe.chen@mediatek.com \
    /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).