From patchwork Tue Nov 6 13:18:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 15362 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1TVj3O-0002kg-Cl for patchwork@linuxtv.org; Tue, 06 Nov 2012 14:19:13 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp for id 1TVj3N-0000se-Ij; Tue, 06 Nov 2012 14:18:54 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751764Ab2KFNSv (ORCPT ); Tue, 6 Nov 2012 08:18:51 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:58011 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751410Ab2KFNSv (ORCPT ); Tue, 6 Nov 2012 08:18:51 -0500 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3Xwrtd0FdHz4KKBG; Tue, 6 Nov 2012 14:18:49 +0100 (CET) X-Auth-Info: pFYTdgImOurTX2RviYb3XzdEY/X0sWj8XAMq/SX4Qkk= Received: from wker (p4FDE7A36.dip.t-dialin.net [79.222.122.54]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3Xwrtc5nZRzbbgf; Tue, 6 Nov 2012 14:18:48 +0100 (CET) Date: Tue, 6 Nov 2012 14:18:45 +0100 From: Anatolij Gustschin To: Guennadi Liakhovetski Cc: linux-media@vger.kernel.org Subject: Re: [PATCH] OV5642: fix VIDIOC_S_GROP ioctl Message-ID: <20121106141845.4641954a@wker> In-Reply-To: References: <1352157290-13201-1-git-send-email-agust@denx.de> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.0; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.11.6.131219 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MIME_LOWER_CASE 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, INVALID_MSGID_NO_FQDN 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_NO_WWW 0, __URI_NS ' On Tue, 6 Nov 2012 12:45:51 +0100 (CET) Guennadi Liakhovetski wrote: > On Tue, 6 Nov 2012, Anatolij Gustschin wrote: > > > VIDIOC_S_GROP ioctl doesn't work, soc-camera driver reports: > > > > soc-camera-pdrv soc-camera-pdrv.0: S_CROP denied: getting current crop failed > > > > The issue is caused by checking for V4L2_BUF_TYPE_VIDEO_CAPTURE type > > in driver's g_crop callback. This check should be in s_crop instead, > > g_crop should just set the type field to V4L2_BUF_TYPE_VIDEO_CAPTURE > > as other drivers do. Move the V4L2_BUF_TYPE_VIDEO_CAPTURE type check > > to s_crop callback. > > I'm not sure this is correct: > > http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-crop.html > > Or is the .g_crop() subdev operation using a different semantics? Where is > that documented? I do not know if it is documented somewhere. But it seems natural to me that a sensor driver sets the type field to V4L2_BUF_TYPE_VIDEO_CAPTURE in its .g_crop(). A sensor is a capture device, not an output or overlay device. And this ioctl is a query operation. OTOH I'm fine with this type checking in .g_crop() and it can help to discover bugs in user space apps. The VIDIOC_G_CROP documentation states that the type field needs to be set to the respective buffer type when querying, so the check in .g_crop() is perfectly valid. But then I need following patch to fix the observed issue: What do you think? And the type field should be checked in .s_crop() anyway, I think. Thanks, Anatolij --- 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 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -902,6 +902,8 @@ static int soc_camera_s_crop(struct file *file, void *fh, dev_dbg(icd->pdev, "S_CROP(%ux%u@%u:%u)\n", rect->width, rect->height, rect->left, rect->top); + current_crop.type = a->type; + /* If get_crop fails, we'll let host and / or client drivers decide */ ret = ici->ops->get_crop(icd, ¤t_crop);