Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1685985pxj; Wed, 19 May 2021 11:27:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynTEuwgJD/uYWLp+h1wxskjOtUByrttJ/5nda3ewPmIkD5AOE5cbLcdePaV7Ix3jsGx+w/ X-Received: by 2002:a5d:8f81:: with SMTP id l1mr820783iol.115.1621448822585; Wed, 19 May 2021 11:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621448822; cv=none; d=google.com; s=arc-20160816; b=IP++OggpwMzXgP2lmjaj2P9QKpgHJVPEgqCeOEkiCvTsSRIIySWq07H2I/iM2NTSuu LY4g2bLSbUSxpZHtg4RjuVS6Ra/vaOhcdUVc2q67H70jaTpMpcK6s0CMpQRNewYR1XqM jHfQSQceUbXljEI/xeiY1/RDa5gIeCCrJSVgABa+tqgqAddAwHvXsuYSOc8qNuwD/nIT eMsw2T68akma9piOTByc1mGYz1CCkVahfX1ywQCiKSzoOSSncBDlu3o3/oRgdU76WvbK A+YekP/mKlZZJLZz9pJTDMvhr96zS5n5/NFxVyXgwa1aLfav+8A7yrMFJCAefousmBX1 owgg== 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:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=qJf1xQ+28NnAlK43hj654qEgRrKzipkMXHBsgZzKcQQ=; b=oJj7ghcLbdDCVe40W4Lj8YLLcQcSOF/wqp9f3EqZPKwTbpFYP12itKc+OGSxU1OT7A 81tNjVs6CNXlLVd0pGm3wPvl7ITIV5lozP2F4Rl9UR6MeDjI+ZKTZeHnigQcDzNkWWNL /YUESSAu3rwQlOjte7CXUIJOMmZJm18xa6PmA1GQbbo1QUj2is/fm0o1kF/jhuOrNoqN /mmwiTKc4ivMKKmdsmc7KucniUZcNSO18wARp4y4YA4k3JIjJO8MubPPnwNO7ChoUzN0 ahnUCV+DKpAhcAA5KFkFCb1d1vX7RvFMzoOdcsVBUc6NN7viZyIIqkXVYPyKbBwqN/px seAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=jl6nkGRn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si393278ilj.12.2021.05.19.11.26.49; Wed, 19 May 2021 11:27:02 -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; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=jl6nkGRn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351091AbhERRTS (ORCPT + 99 others); Tue, 18 May 2021 13:19:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238824AbhERRTS (ORCPT ); Tue, 18 May 2021 13:19:18 -0400 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9948C061573 for ; Tue, 18 May 2021 10:17:59 -0700 (PDT) Received: by mail-qt1-x82e.google.com with SMTP id a10so1240412qtp.7 for ; Tue, 18 May 2021 10:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=qJf1xQ+28NnAlK43hj654qEgRrKzipkMXHBsgZzKcQQ=; b=jl6nkGRna7urQ78bL7v3bD+QWmlbdVa0MQHADOJeyhwz5p+pm3dVfDF4Te1IzBnPL7 nlKlPY7CTKcz+kTFU2RxALOk9jUpTe/G/SvqO+4OskPULcE8x7GgnHABgk9/Rv2fkQlM rwghuG9qsgzsONAauvf0CRd9lzs9dI2raXJgGQDYKIdZXtN3zraMQXoz/Zly0TPeBva+ eTiDhnjBoqmJ2MPmOAkfj3DEVLanSR3mRQiv7URcyEm/vqGpN9Adqqm0zmQdgKWvzbAd NlKOTlxFnfOBEBWDbE6gQwbfKR+L3/XaMIEMDs3Ct3jN/CcqK/lOXtr/fZqK0GPWIwMc /3AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=qJf1xQ+28NnAlK43hj654qEgRrKzipkMXHBsgZzKcQQ=; b=XSiM70brt2fTSx7tMmePdKQOhwYq8VD0wBIBkNMBviO4YkqoxIcdEf4DtKNZV/aczs sffQ2wX1AFTAHFM7HoqoMrqFZ7vo+W30tTbXXgowSMJAH5QC3dxaqaH7bM7Pajc7lTjp C79c2bxH9xA289iK2lVMRrTVjkXA6zcEWti6wu/uBnre2+HfNmicNuOlQN9DReS1RnPF 9Fzqy3B/qhfXKGNmqTP3WEPESYJNeTJJSmzJ4vjgJwWEoqRmTv8hZAcy1zl+4t3ocWzY 65omPlsesD4x1veenDkHEYgS2nHa0Uttb/U4NZaZtB7Ck/mX7zaOyr5LvhHaw4ieZXie vbSA== X-Gm-Message-State: AOAM530QH49N8KgHgWN4IGTrIE7RnHMnfnEyAVx6/kdaOd4O/iZess1H 0Rn5dTBFJvjkuiBv+5CkUBMF2g== X-Received: by 2002:ac8:5846:: with SMTP id h6mr5915303qth.215.1621358278997; Tue, 18 May 2021 10:17:58 -0700 (PDT) Received: from nicolas-tpx395.localdomain (173-246-12-168.qc.cable.ebox.net. [173.246.12.168]) by smtp.gmail.com with ESMTPSA id b3sm11931277qtg.55.2021.05.18.10.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 10:17:58 -0700 (PDT) Message-ID: Subject: Re: [PATCH v10 6/9] media: uapi: Add a control for HANTRO driver From: Nicolas Dufresne To: Ezequiel Garcia , 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: Tue, 18 May 2021 13:17:56 -0400 In-Reply-To: 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> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.1 (3.40.1-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le dimanche 16 mai 2021 à 20:04 -0300, Ezequiel Garcia a écrit : > 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. Can you extend on this, perhaps we need an RFC for this specific mechanism. I don't immediatly see how I could enumerate controls and figure-out which one are needed. Perhaps we need to add new control flags for mandatory control ? This way userspace could detect unsupported HW if it finds a mandatory control that it does not know about ? > > Thanks, > Ezequiel >