Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2214280pxb; Wed, 30 Mar 2022 19:33:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7+v0EwD51LkRvBD3R31nkoNcuIg5SBa/6vHjGqdkg8DE86i5NLZezFj0CGSkaarNg8s1u X-Received: by 2002:a05:6a00:1706:b0:4fd:af77:62a1 with SMTP id h6-20020a056a00170600b004fdaf7762a1mr1443782pfc.16.1648694024418; Wed, 30 Mar 2022 19:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648694024; cv=none; d=google.com; s=arc-20160816; b=W+0TkTgnS9mbKXMh/0isw/eJgPCYfHpbtgCtWoeB6J2ugeRBHjAX1x9ODl/mGpfrmy /IsD1/E73rMSzyZVGWqmwbk4wLPIY3SlYCj0gLbJ6IEvmEPEo1rGW9LWhP2aPTslHp2e GAP1FPutq9vhKIOBZTlcnBesGDXVc3H1KCthf9ZEdc4r155o15DOUbQx+GDzjBzjpDpu wbf6vqyJN7uyh77pG6EaksGXM1HPefNCd/jp+0yXBdDFRs59rSpDblEg5IPjTgfk9pR2 bTsTUMt7Sp/fcGAcnohkbRE6mSSJzJITryP/6o7hldspcHEOkaoTKRSHhNll/IUuGT45 HfeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qFC2omcJIoBR2JfItL1+ZXqYeVXv+s1tQSslU9UFcRc=; b=FWeBbyGoLD5Pl13fXeh/4jneHmoDbSjjZcioFO+JN8IKKgVVCRipTLaJ138lYdSc9C ZlcCYO7wOEo09J4UQ0XLfVEJU8sCvLGHdBnUo5EyxMX6KVUg65+81GPOqwmFkRHv5z/G XaRvdISH+h7MYOiBtKJZp37QL53oqahSoDbSI+iDtaqUbn/1cvHZlicpsAprKorXlYKh mzHex3kO6cUcdAVLOUkka6FHzZqLWUQTIlgG3T9bJfz89c+eHHHk7r3gD/7rhkQDmRim 3V9WO7Ia7i9PsitCb+esstEWo9uCmiIioHTtixKgNgsLL5/ulzSQXVYUz9QDQHXSfwdR UPJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WuE4OgVE; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x3-20020a1709027c0300b00153b2d164ccsi20634235pll.212.2022.03.30.19.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 19:33:44 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WuE4OgVE; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AFDE21A3BA; Wed, 30 Mar 2022 19:28:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344808AbiC3MC7 (ORCPT + 99 others); Wed, 30 Mar 2022 08:02:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344345AbiC3Lw6 (ORCPT ); Wed, 30 Mar 2022 07:52:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D282E68D; Wed, 30 Mar 2022 04:48:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 587B4CE1C4F; Wed, 30 Mar 2022 11:48:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3F3CC340EE; Wed, 30 Mar 2022 11:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648640917; bh=FFoYu9xD39rqkIZEOepdvzpRGpwFoRxIoNbHOu8iJoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WuE4OgVEFUv8xnTFhBLPj35WdoY3gC4kmxPzmVq3PjIGVOhxCEmmww679udk3WrjL Y4fRIyDlCHlUV+VwpfSxVmufsUYYDp4Wy7xcdpYy3G+87/Rd3J9B7UwxCSUiA3h8VS 3NRbeil+iSQwmWlakT8Q7iXoslKLOSK044PQ4AxRzLNd0+4pIQVM8EJ2Q8LCW0h/31 luHOhcqJQYtHIPRYYbAUyL+sra6Z7N2VieD5xe90z1mb70AABC4traBsuICbSFutfn yg/lOlxM7g9uBbk4PswRTy7VJsMOQPAEWM9227cHwDSXUW+muOJ0Gukr3Dx+evDEod o9mo+a+2uxQCA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans Verkuil , Corentin Labbe , Mauro Carvalho Chehab , Sasha Levin , gregkh@linuxfoundation.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 5.16 03/59] media: staging: media: zoran: fix various V4L2 compliance errors Date: Wed, 30 Mar 2022 07:47:35 -0400 Message-Id: <20220330114831.1670235-3-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220330114831.1670235-1-sashal@kernel.org> References: <20220330114831.1670235-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil [ Upstream commit 914941827aad5ecddf9bf3a6dee67fbec1af1fff ] This fixes several issues found with 'v4l2-compliance -s': 1) read()/write() is supported, but not reported in the capabilities 2) S_STD(G_STD()) failed: setting the same standard should just return 0. 3) G_PARM failed to set readbuffers. 4) different field values in the format vs. what v4l2_buffer reported. 5) zero the sequence number when starting streaming. 6) drop VB_USERPTR: makes no sense with dma_contig streaming. Signed-off-by: Hans Verkuil Signed-off-by: Corentin Labbe Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/zoran/zoran_card.c | 2 +- drivers/staging/media/zoran/zoran_driver.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 677d3a26cef4..175654d104c5 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -811,7 +811,7 @@ static int zoran_init_video_device(struct zoran *zr, struct video_device *video_ *video_dev = zoran_template; video_dev->v4l2_dev = &zr->v4l2_dev; video_dev->lock = &zr->lock; - video_dev->device_caps = V4L2_CAP_STREAMING | dir; + video_dev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE | dir; strscpy(video_dev->name, ZR_DEVNAME(zr), sizeof(video_dev->name)); /* diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 551db338c7f7..84665637ebb7 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -255,8 +255,6 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability strscpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card)); strscpy(cap->driver, "zoran", sizeof(cap->driver)); snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", pci_name(zr->pci_dev)); - cap->device_caps = zr->video_dev->device_caps; - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; return 0; } @@ -582,6 +580,9 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) struct zoran *zr = video_drvdata(file); int res = 0; + if (zr->norm == std) + return 0; + if (zr->running != ZORAN_MAP_MODE_NONE) return -EBUSY; @@ -739,6 +740,7 @@ static int zoran_g_parm(struct file *file, void *priv, struct v4l2_streamparm *p if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; + parm->parm.capture.readbuffers = 9; return 0; } @@ -869,6 +871,10 @@ int zr_set_buf(struct zoran *zr) vbuf = &buf->vbuf; buf->vbuf.field = V4L2_FIELD_INTERLACED; + if (BUZ_MAX_HEIGHT < (zr->v4l_settings.height * 2)) + buf->vbuf.field = V4L2_FIELD_INTERLACED; + else + buf->vbuf.field = V4L2_FIELD_TOP; vb2_set_plane_payload(&buf->vbuf.vb2_buf, 0, zr->buffer_size); vb2_buffer_done(&buf->vbuf.vb2_buf, VB2_BUF_STATE_DONE); zr->inuse[0] = NULL; @@ -928,6 +934,7 @@ static int zr_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) zr->stat_com[j] = cpu_to_le32(1); zr->inuse[j] = NULL; } + zr->vbseq = 0; if (zr->map_mode != ZORAN_MAP_MODE_RAW) { pci_info(zr->pci_dev, "START JPG\n"); @@ -1018,7 +1025,7 @@ int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir) vq->dev = &zr->pci_dev->dev; vq->type = dir; - vq->io_modes = VB2_USERPTR | VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE; + vq->io_modes = VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE; vq->drv_priv = zr; vq->buf_struct_size = sizeof(struct zr_buffer); vq->ops = &zr_video_qops; -- 2.34.1