Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1776546rdb; Mon, 2 Oct 2023 23:55:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiLMf8cMceu9s2QbJQKy7lUf4s6OuFc76c4p84ihbXkaIszYflcQ0TkSWWVdlmvgbETUvZ X-Received: by 2002:a05:6358:5919:b0:143:8eb4:cf36 with SMTP id g25-20020a056358591900b001438eb4cf36mr10909542rwf.5.1696316143543; Mon, 02 Oct 2023 23:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696316143; cv=none; d=google.com; s=arc-20160816; b=dLM+nSBlcuhkPKJTrnEpog/QBk2CqJ+NUoQLhCueNzz9/XYBukgMvw4+yV3CT2aWgY KJ2+NireSKWPMGTy50tDDJ3i7ky7I+G3vddaj+vonM7iGPgvwL6E1HMfKdMJggr+zM5R 4R+A9aC/0w40bgF8EKXRqmWNbKp1Qa3rZTGyEk2D4KoK3Xp54XdRjW6hRE/XvA/rdfHx GLVgY6qK5Jz4yx1pn2N/ylWYohX+Tabcsxt7Nd+x53QUM45QBbHEu7LOfqdG8cG75wGE xPiP0J8zGomMqstLdTRLzRKSrs7t/2NECr3HgjsMq8yVo8TnTKGL2HiluKqcUwCKH3qI d0uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=okuaHjTxV1fMqabiqdU48jgPQHrYoynpS25zC0HwhTs=; fh=S7jPPuaJzVWSAdVmUQRofdnMqUqPl1b/aMvZIQADj5I=; b=jo5cx42ogFPIYel06paskuuwNSZMYg5WBOGyM6PsXKq2uCFR7GbrPgm3AVQRz0SXyD 3NrbtzMCV0eDxQrH3+tTdJiKeKdLraQBL1qk1kazvChhFT9EBToNLNO4nvkTE2Q14glN c+nUA7dupF4q88VHnLvFhvmZSf4cFdoAQs0nBG4O/zBN9O0TSzK0k74Bp89S8m6ONps+ ChnOiz41TiUB3McMqjApBS3TJoD1c0MwtvcJ1ZJJt84OV3P4wxPWAeVk4Fgr7ofM1ekh uAIQ4rV79tNcECjbgSVF9kJ/Vy+2ctSflKNqnp7TDSOJIKmusqDUFRoYiIZe2UXLupt9 ec/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l5-20020a633e05000000b00565f4166f4bsi771223pga.284.2023.10.02.23.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 23:55:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9FB8B80ADC57; Mon, 2 Oct 2023 23:55:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbjJCGyk (ORCPT + 99 others); Tue, 3 Oct 2023 02:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbjJCGyi (ORCPT ); Tue, 3 Oct 2023 02:54:38 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ED96AC; Mon, 2 Oct 2023 23:54:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 591ECC433C8; Tue, 3 Oct 2023 06:54:30 +0000 (UTC) Message-ID: Date: Tue, 3 Oct 2023 08:54:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v12 5/7] media: chips-media: wave5: Add the v4l2 layer Content-Language: en-US, nl To: Deborah Brouwer Cc: Nicolas Dufresne , Sebastian Fricke , Mauro Carvalho Chehab , Nas Chung , Sascha Hauer , Fabio Estevam , Rob Herring , Shawn Guo , Philipp Zabel , Jackson Lee , Krzysztof Kozlowski , NXP Linux Team , Conor Dooley , Pengutronix Kernel Team , Benjamin Gaignard , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Robert Beckett , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com References: <20230915-wave5_v12_on_media_master-v12-0-92fc66cd685d@collabora.com> <20230915-wave5_v12_on_media_master-v12-5-92fc66cd685d@collabora.com> <7b159731dfbc2ab8243396eaec8f41be10af5160.camel@collabora.com> <6ae8a639-b9f5-4426-be49-5340a8b8b5e9@xs4all.nl> <330a177320fd766af8eddb76f57ea728b2e36afe.camel@collabora.com> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2ov5ihgk/2k2SKa02ookQI3e79laOrbZl5BOXNKR9LguuOZdX4XYR3Zi6/ BsJ7pVC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bLvO572EPfxneY UT7JzDc/5LT9cFFugTMOhq1BG62vUm/F6V91+unyp4dRlyryAeqEuISykhvjZCVHk/woaMZv c1Dm4Uvkv0Ilelt3Pb9J7zhcx6sm5T7v16VceF96jG61bnJ2GFS+QZerZp3PY27XgtPxRxYj AmFUeF486PHx/2Yi4u1rQpIpC5inPxIgR1+ZFvQrAV36SvLFfuMhyCAxV6WBlQc85ArOiQZB Wm7L0repwr7zEJFEkdy8C81WRhMdPvHkAIh3RoY1SGcdB7rB3wCzfYkAuCBqaF7Zgfw8xkad KEiQTexRbM1sc/I8ACpla3N26SfQwrfg6V7TIoweP0RwDrcf5PVvwSWsRQp2LxFCkwnCXOra gYmkrmv0duG1FStpY+IIQn1TOkuXrciTVfZY1cZD0aVxwlxXBnUNZZNslldvXFtndxR0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 02 Oct 2023 23:55:10 -0700 (PDT) Hi Deb, On 03/10/2023 01:51, Deborah Brouwer wrote: > On Wed, Sep 27, 2023 at 09:19:46AM +0200, Hans Verkuil wrote: >> On 27/09/2023 01:29, Nicolas Dufresne wrote: >>> Le vendredi 22 septembre 2023 à 09:33 +0200, Hans Verkuil a écrit : >>>> On 21/09/2023 21:11, Nicolas Dufresne wrote: >>>>> Le mercredi 20 septembre 2023 à 17:13 +0200, Hans Verkuil a écrit : >>>>>> On 15/09/2023 23:11, Sebastian Fricke wrote: >>>>>>> From: Nas Chung >>>>>>> >>>>>>> Add the decoder and encoder implementing the v4l2 >>>>>>> API. This patch also adds the Makefile and the VIDEO_WAVE_VPU config >>>>>>> >>>>>>> Signed-off-by: Sebastian Fricke >>>>>>> Signed-off-by: Nicolas Dufresne >>>>>>> Signed-off-by: Robert Beckett >>>>>>> Signed-off-by: Dafna Hirschfeld >>>>>>> Signed-off-by: Nas Chung >>>>>>> --- >>>>>>> drivers/media/platform/chips-media/Kconfig | 1 + >>>>>>> drivers/media/platform/chips-media/Makefile | 1 + >>>>>>> drivers/media/platform/chips-media/wave5/Kconfig | 12 + >>>>>>> drivers/media/platform/chips-media/wave5/Makefile | 10 + >>>>>>> .../platform/chips-media/wave5/wave5-helper.c | 196 ++ >>>>>>> .../platform/chips-media/wave5/wave5-helper.h | 30 + >>>>>>> .../platform/chips-media/wave5/wave5-vpu-dec.c | 1965 ++++++++++++++++++++ >>>>>>> .../platform/chips-media/wave5/wave5-vpu-enc.c | 1825 ++++++++++++++++++ >>>>>>> .../media/platform/chips-media/wave5/wave5-vpu.c | 331 ++++ >>>>>>> .../media/platform/chips-media/wave5/wave5-vpu.h | 83 + >>>>>>> 10 files changed, 4454 insertions(+) >>>>>>> >>>> >>>> >>>> >>>>>>> +static int wave5_vpu_dec_set_eos_on_firmware(struct vpu_instance *inst) >>>>>>> +{ >>>>>>> + int ret; >>>>>>> + >>>>>>> + ret = wave5_vpu_dec_update_bitstream_buffer(inst, 0); >>>>>>> + if (ret) { >>>>>>> + dev_err(inst->dev->dev, >>>>>>> + "Setting EOS for the bitstream, fail: %d\n", ret); >>>>>> >>>>>> Is this an error due to a driver problem, or because a bad bitstream is >>>>>> fed from userspace? In the first case, dev_err would be right, in the >>>>>> second dev_dbg would be more appropriate. Bad userspace input should not >>>>>> spam the kernel log in general. >>>>> >>>>> Its the first. To set the EOS flag, a command is sent to the firmware. That >>>>> command may never return (timeout) or may report an error. For this specific >>>>> command, if that happens we are likely facing firmware of driver problem (or >>>>> both). >>>> >>>> OK, I'd add that as a comment here as this is unexpected behavior. >>>> >>>>> >>>>>> >>>>>>> + return ret; >>>>>>> + } >>>>>>> + return 0; >>>>>>> +} >>>> >>>> >>>> >>>>>>> +static int wave5_vpu_dec_create_bufs(struct file *file, void *priv, >>>>>>> + struct v4l2_create_buffers *create) >>>>>>> +{ >>>>>>> + struct v4l2_format *f = &create->format; >>>>>>> + >>>>>>> + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) >>>>>>> + return -ENOTTY; >>>>>> >>>>>> Huh? Why is this needed? >>>>> >>>>> Minimally a comment should be added. The why is that we support CREATE_BUF for >>>>> OUTPUT queue (bitstream) but not for CAPTURE queues. This is simply not >>>>> supported by Wave5 firmware. Do you have any suggestion how this asymmetry can >>>>> be implemented better ? >>>> >>>> Certainly not with ENOTTY: the ioctl exists, it is just not supported for >>>> CAPTURE queues. >>>> >>>> How about -EPERM? And document this error as well in the VIDIOC_CREATE_BUFS >>>> documentation. And you want a dev_dbg here too. >>> >>> The suggestion cannot be used since there is documentation for that one already, >>> and it does not match "unsupported". >>> >>> "Permission denied. Can be returned if the device needs write permission, or >>> some special capabilities is needed (e. g. root)" >>> >>> What about using the most logical error code, which name is actually obvious, >>> like ENOTSUP ? >>> >>> #define ENOTSUPP 524 /* Operation is not supported */ >>> >> >> Let's go with EOPNOTSUPP. That seems to be the more commonly used error >> code in drivers. > > Hi Hans, > > Sorry to belabour this issue but when I change the return value > to EOPNOTSUPP, it now causes v4l2-compliance to fail because > v4l2-test-buffers.cpp expects ENOTTY if CREATE_BUFS is not supported. > > We didn't get this warning before because there was a typo in the > buffer check and it was only checking for single-planar buffers. > > How would you prefer to handle this? The options seem like > keep ENOTTY in this driver or > patch v4l2-compliance to warn if it also receives EOPNOTSUPP? You patch v4l2-compliance. It makes sense: we're making a uAPI modification, so that implies changes to v4l2-compliance. So v4l2-compliance needs to understand EOPNOTSUPP for CREATE_BUFS: if it is returned it has to check that it is used correctly: so there has to be at least one buffer type for which CREATE_BUFS actually works. In other words, v4l2-compliance must check that EOPNOTSUPP isn't used as a replacement for ENOTTY. This can be done in testReqBufs(). Regards, Hans