Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2256640pxj; Sun, 16 May 2021 20:16:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrSvFVEqBDhyeiDGtEZLz1pexZ2zTAuvKX+zdLTcEAzpAh3OAhPWxl18d2MMCtY4DKS6AG X-Received: by 2002:aa7:d0d7:: with SMTP id u23mr10298986edo.147.1621221395847; Sun, 16 May 2021 20:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621221395; cv=none; d=google.com; s=arc-20160816; b=mnqjdu0IIPl2+i8VLXnJhXir0H1pu5wTlnUSROyH0mn1AHcNHTbbQnpjPV0LnYg8rP 9ryRJ//VULg716Bq/ad4GKWzlYbjSz6QhF2+S7XflkDNa0D5WP2yQKfPBbqthlluQw9Q okifx5NTycx2C/56FuidKf23Nj5VU7ZsyF7TuH6isfbGes2BskWDAyRLd9NGXzx0FFuj mwnHW5vbubo67DdkvZEwVydrCFLo9qz0t3t+XiEUNZCfMqQlkn4gGcsNsnFuaS+ziW8s p4GnGqNK+NaEC01ePFLRQUaESIqza+esok/6BbUgcQNiYgPIjCYb/0N800eqZ9BVWX0i ikhw== 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 :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=Mop8VArlmqSWZNL/vireSKstJkBai9BSzTjstpvj53A=; b=OjLhXTsoHCMZft7qgiKWDJa7VNJwUXIc9ZX4HI2G78CSm9pvpYoj73eHAm496UTtjO A6fM6WVWBbUR10PIyDBkPoYFdFsGe5pDtgw/A3OdwHZvWdqmsEhI5r8TpE9ufwI3X3Cq Vf+Av+/SuwNo/tZRfuh6Ir46XoHqNF4DhnW7bp96v4sk1ThrMbzXTKiK6C8adeOFXK7i JzwoHSGmk6fvAUyXAy/8hfG1YT6kBB/s0bPl8b3cHtWdu021K1IjFeHL+2fUXEPrVnjK wMWkT3WSoEt4ZjQjs+simalaP0cI1CL/gro3VRcKf2Z6j0oUeSBrt9AbSdd4947WNZnV 6hYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm2si5226637edb.202.2021.05.16.20.16.01; Sun, 16 May 2021 20:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231735AbhEPXFg (ORCPT + 99 others); Sun, 16 May 2021 19:05:36 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:45132 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbhEPXFf (ORCPT ); Sun, 16 May 2021 19:05:35 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id D03971F40F2E Message-ID: Subject: Re: [PATCH v10 6/9] media: uapi: Add a control for HANTRO driver From: Ezequiel Garcia To: Hans Verkuil , Benjamin Gaignard , p.zabel@pengutronix.de, mchehab@kernel.org, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, lee.jones@linaro.org, gregkh@linuxfoundation.org, mripard@kernel.org, paul.kocialkowski@bootlin.com, wens@csie.org, jernej.skrabec@siol.net, emil.l.velikov@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, kernel@collabora.com, cphealy@gmail.com Date: Sun, 16 May 2021 20:04:05 -0300 In-Reply-To: <815a4bd6-599b-cfb8-9ddc-efa4b7092c23@xs4all.nl> References: <20210420121046.181889-1-benjamin.gaignard@collabora.com> <20210420121046.181889-7-benjamin.gaignard@collabora.com> <1cf94540-7f4d-0179-dd1e-0b82ee30f6d2@collabora.com> <815a4bd6-599b-cfb8-9ddc-efa4b7092c23@xs4all.nl> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.2-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hans, On Thu, 2021-05-06 at 14:50 +0200, Hans Verkuil wrote: > On 05/05/2021 17:20, Benjamin Gaignard wrote: > > > > Le 05/05/2021 à 16:55, Hans Verkuil a écrit : > > > On 20/04/2021 14:10, Benjamin Gaignard wrote: > > > > The HEVC HANTRO driver needs to know the number of bits to skip at > > > > the beginning of the slice header. > > > > That is a hardware specific requirement so create a dedicated control > > > > for this purpose. > > > > > > > > Signed-off-by: Benjamin Gaignard > > > > --- > > > >   .../userspace-api/media/drivers/hantro.rst    | 19 +++++++++++++++++++ > > > >   .../userspace-api/media/drivers/index.rst     |  1 + > > > >   include/media/hevc-ctrls.h                    | 13 +++++++++++++ > > > >   3 files changed, 33 insertions(+) > > > >   create mode 100644 Documentation/userspace-api/media/drivers/hantro.rst > > > > > > > > diff --git a/Documentation/userspace-api/media/drivers/hantro.rst b/Documentation/userspace-api/media/drivers/hantro.rst > > > > new file mode 100644 > > > > index 000000000000..cd9754b4e005 > > > > --- /dev/null > > > > +++ b/Documentation/userspace-api/media/drivers/hantro.rst > > > > @@ -0,0 +1,19 @@ > > > > +.. SPDX-License-Identifier: GPL-2.0 > > > > + > > > > +Hantro video decoder driver > > > > +=========================== > > > > + > > > > +The Hantro video decoder driver implements the following driver-specific controls: > > > > + > > > > +``V4L2_CID_HANTRO_HEVC_SLICE_HEADER_SKIP (integer)`` > > > > +    Specifies to Hantro HEVC video decoder driver the number of data (in bits) to > > > > +    skip in the slice segment header. > > > > +    If non-IDR, the bits to be skipped go from syntax element "pic_output_flag" > > > > +    to before syntax element "slice_temporal_mvp_enabled_flag". > > > > +    If IDR, the skipped bits are just "pic_output_flag" > > > > +    (separate_colour_plane_flag is not supported). > > > I'm not very keen on this. Without this information the video data cannot be > > > decoded, or will it just be suboptimal? > > > > Without that information the video can't be decoded. > > > > > > > > The problem is that a generic decoder would have to know that the HW is a hantro, > > > and then call this control. If they don't (and are testing on non-hantro HW), then > > > it won't work, thus defeating the purpose of the HW independent decoder API. > > > > > > Since hantro is widely used, and if there is no other way to do this beside explitely > > > setting this control, then perhaps this should be part of the standard HEVC API. > > > Non-hantro drivers that do not need this can just skip it. > > > > Even if I put this parameter in decode_params structure that would means that a generic > > userland decoder will have to know how the compute this value for hantro HW since it > > isn't something that could be done on kernel side. > > But since hantro is very common, any userland decoder will need to calculate this anyway. > So perhaps it is better to have this as part of the decode_params? > > I'd like to know what others think about this. > As you know, I'm not a fan of carrying these "unstable" APIs around. I know it's better than nothing, but I feel they create the illusion of the interface being supported in mainline. Since it's unstable, it's difficult for applications to adopt them. As Nicolas mentioned, this means neither FFmpeg nor GStreamer will adopt these APIs, which worries me, as that means we lose two major user bases. My personal take from this, is that we need to find ways to stabilize our stateless codec APIs in less time and perhaps with less effort. IMO, a less stiff interface could help us here, and that's why I think having hardware-specific controls can be useful. Hardware designers can be so creative :) I'm not against introducing this specific parameter in v4l2_ctrl_hevc_codec_params, arguing that Hantro is widely used, but I'd like us to be open to hardware-specific controls as a way to extend the APIs seamlessly. Applications won't have to _know_ what hardware they are running on, they can just use VIDIOC_QUERYCTRL to find out which controls are needed. Thanks, Ezequiel