Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3843333ybl; Mon, 3 Feb 2020 07:34:30 -0800 (PST) X-Google-Smtp-Source: APXvYqzEjZfieqKiSI8awCZQOa5fRWnEdrSlZIoF/tR5aNtbbBAEZSinMYUvqCUvzTsf03tRBot8 X-Received: by 2002:aca:3f54:: with SMTP id m81mr14522741oia.73.1580744070535; Mon, 03 Feb 2020 07:34:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580744070; cv=none; d=google.com; s=arc-20160816; b=Xp1x0VYIGO4oF9vM7ezCZA7WKasILba+TAWWuTyGlXJGFgur0181GNaPOyIHQzJR8X NRLlzniKfRo9wtPcAHk2Ei4FNZ38PIXJR9B1kitOwwiV5PZZa9gOmb2zLWU+qMsf8t39 iVhM3HmC5jKDRoL3/JBlRAI1+X2OyYwn1yWhk7IhIfPq7RdK3OHTU5cm/z4UyxuDC6FY cjhn+p5B60RIpCI0Dw+txsz1S8ptQg0GNfF+tJO+0tPX/1FGPS25ocXos0uzoFzvxsY5 SpclET/d4OT9IvwcaC9z0wpK3/KKQ7/GwWTKT6mTtaB5bwnqAPmUEImy4ekQvq5j8Vm1 Yvxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=gZZ8ko4O/jUPA/decaQ2lD3GEYFrqD//5nnLiZlDpbE=; b=mfISa79KS1vrRewf/zUm+NWcnmN8F/fgImhF7z4FutATqHCNSCuXl68qhtOj5Ka92q hr9BC0LK4dONj8Ywztg7INds8rDvRPcW5G501vcBec3bzc9fMPGX3dSFx6YJiUSf9c+d kT+1RgGcd6KR16lxrCDzJtEV4w92l2ICMlY1s0+zB5pvEyKNisqSN+UtssBAwgNkxaT+ Hy+T8PStd+bl5oakLGz9yEo+wkTWk/VpJHCzZGcMagOT4Vb8fISmwnF/vGb6bEUsNlcl LwilHjcZyriuQRowKRoGSkVFSGtzm11AAdMW/tdeY9Gqrl3uFeys3diXlUJagwR/cOY/ b10w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lpwEEmpR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17si9091171otp.244.2020.02.03.07.34.18; Mon, 03 Feb 2020 07:34:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lpwEEmpR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728146AbgBCNtG (ORCPT + 99 others); Mon, 3 Feb 2020 08:49:06 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:41026 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728024AbgBCNtG (ORCPT ); Mon, 3 Feb 2020 08:49:06 -0500 Received: by mail-ed1-f66.google.com with SMTP id c26so15984106eds.8 for ; Mon, 03 Feb 2020 05:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=gZZ8ko4O/jUPA/decaQ2lD3GEYFrqD//5nnLiZlDpbE=; b=lpwEEmpRyeVKSUU/dUAb+BRKkoVZ0LkjrF9vKb50tLhFDu/xYSEMbvb5pLQZmwbFoe lompMw0l8jYOQMkjabLTSFkzQ5JH+C6BD8eJPmRAFHOUuZrBaM/OAFpR5vvfDYh6D+2N iUGmEUqTvePQL0a2jyDwSx5voHvsuewAC2U10= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=gZZ8ko4O/jUPA/decaQ2lD3GEYFrqD//5nnLiZlDpbE=; b=F+eGAC2p8lEdvA45fD3xIEDucpRp35l14oUkVNxYx8ZOqGR586KdCLro3HMv8fTcsr oQjdk7fv7LDUQVp5R8kLY/0q4phDFKbny7k6uo0FcOY8RBEoii3dvUMsv5XJEj85xA43 WUS7XpFUcC6aHbrtKU46ahe5BJLSwjl5npraCQuXZClbyuxMpNikuX8kxBO+JWaSuK8T PV59JbD6ER92iZDworgV4xhXGLoC/xSz3wvr4sU+78YNewEDDK78F11BpdbTANb+0DKR DRpeva6IP9TSmdbAQ0iYn/429ayGpW+zpX53glTgy07PDW5zmDALEbvC4O5XLio3KKx/ x7QA== X-Gm-Message-State: APjAAAV2FzIkY0FxrO3myqQL0sIxjtKJlm+sXOZqFGS5ctjo+5zG+1Vp IqrAAew3kYusFwKutxfRxNM5GkRp5p02dw== X-Received: by 2002:aa7:d956:: with SMTP id l22mr12615788eds.66.1580737743006; Mon, 03 Feb 2020 05:49:03 -0800 (PST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com. [209.85.128.44]) by smtp.gmail.com with ESMTPSA id a10sm686353edt.50.2020.02.03.05.49.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Feb 2020 05:49:01 -0800 (PST) Received: by mail-wm1-f44.google.com with SMTP id a9so17172317wmj.3 for ; Mon, 03 Feb 2020 05:49:00 -0800 (PST) X-Received: by 2002:a05:600c:2215:: with SMTP id z21mr29287067wml.55.1580737740170; Mon, 03 Feb 2020 05:49:00 -0800 (PST) MIME-Version: 1.0 References: <20191122051608.128717-1-hiroh@chromium.org> <767528be59275265072896e5c679e97575615fdd.camel@ndufresne.ca> <8b10414a1c198a6e3bd5e131a72bd6f68466bea5.camel@ndufresne.ca> <8a6a371d-17cd-eb32-779c-0669da5a8d5e@xs4all.nl> In-Reply-To: <8a6a371d-17cd-eb32-779c-0669da5a8d5e@xs4all.nl> From: Tomasz Figa Date: Mon, 3 Feb 2020 22:48:47 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: hantro: Support H264 profile control To: Hans Verkuil Cc: Nicolas Dufresne , Hirokazu Honda , Ezequiel Garcia , Mauro Carvalho Chehab , Greg KH , Linux Media Mailing List , devel@driverdev.osuosl.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 3, 2020 at 9:00 PM Hans Verkuil wrote: > > On 2/3/20 12:13 PM, Tomasz Figa wrote: > > On Sat, Jan 18, 2020 at 10:31 PM Nicolas Dufresne wrote: > >> > >> Le vendredi 10 janvier 2020 =C3=A0 13:31 +0100, Hans Verkuil a =C3=A9c= rit : > >>> On 11/29/19 1:16 AM, Tomasz Figa wrote: > >>>> On Sat, Nov 23, 2019 at 1:52 AM Nicolas Dufresne > >>>> wrote: > >>>>> Le samedi 23 novembre 2019 =C3=A0 01:00 +0900, Tomasz Figa a =C3=A9= crit : > >>>>>> On Sat, Nov 23, 2019 at 12:09 AM Nicolas Dufresne > >>>>>> wrote: > >>>>>>> Le vendredi 22 novembre 2019 =C3=A0 14:16 +0900, Hirokazu Honda a= =C3=A9crit : > >>>>>>>> The Hantro G1 decoder supports H.264 profiles from Baseline to H= igh, > >>>>>>>> with > >>>>>>>> the exception of the Extended profile. > >>>>>>>> > >>>>>>>> Expose the V4L2_CID_MPEG_VIDEO_H264_PROFILE control, so that the > >>>>>>>> applications can query the driver for the list of supported > >>>>>>>> profiles. > >>>>>>> > >>>>>>> Thanks for this patch. Do you think we could also add the LEVEL > >>>>>>> control > >>>>>>> so the profile/level enumeration becomes complete ? > >>>>>>> > >>>>>>> I'm thinking it would be nice if the v4l2 compliance test make su= re > >>>>>>> that codecs do implement these controls (both stateful and statel= ess), > >>>>>>> it's essential for stack with software fallback, or multiple capa= ble > >>>>>>> codec hardware but with different capabilities. > >>>>>>> > >>>>>> > >>>>>> Level is a difficult story, because it also specifies the number o= f > >>>>>> macroblocks per second, but for decoders like this the number of > >>>>>> macroblocks per second it can handle depends on things the driver > >>>>>> might be not aware of - clock frequencies, DDR throughput, system > >>>>>> load, etc. > >>>>>> > >>>>>> My take on this is that the decoder driver should advertise the > >>>>>> highest resolution the decoder can handle due to hardware constrai= nts. > >>>>>> Performance related things depend on the integration details and > >>>>>> should be managed elsewhere. For example Android and Chrome OS man= age > >>>>>> expected decoding performance in per-board configuration files. > >>>>> > >>>>> When you read datasheet, the HW is always rated to maximum level (a= nd > >>>>> it's a range) with the assumption of a single stream. It seems much > >>>>> easier to expose this as-is, statically then to start doing some ma= th > >>>>> with data that isn't fully exposed to the user. This is about filte= ring > >>>>> of multiple CODEC instances, it does not need to be rocket science, > >>>>> specially that the amount of missing data is important (e.g. usage = of > >>>>> tiles, compression, IPP all have an impact on the final performance= ). > >>>>> All we want to know in userspace is if this HW is even possibly cap= able > >>>>> of LEVEL X, and if not, we'll look for another one. > >>>>> > >>>> > >>>> Agreed, one could potentially define it this way, but would it be > >>>> really useful for the userspace and the users? I guess it could enab= le > >>>> slightly faster fallback to software decoding in the extreme case of > >>>> the hardware not supporting the level at all, but I suspect that the > >>>> majority of cases would be the hardware just being unusably slow. > >>>> > >>>> Also, as I mentioned before, we already return the range of supporte= d > >>>> resolutions, which in practice should map to the part of the level > >>>> that may depend on hardware capabilities rather than performance, so > >>>> exposing levels as well would add redundancy to the information > >>>> exposed. > >>> > >>> There is a lot of discussion here, but it all revolves around a poten= tial > >>> LEVEL control. > >>> > >>> So I gather everyone is OK with merging this patch? > >> > >> I'm ok with this. For me, the level reflects the real time performance > >> capability as define in the spec, while the width/height constraints u= sually > >> represent an addressing capabicity, which may or may not operate real-= time. > >> > > > > I'd like to see the level control documentation improved before we > > start adding it to the drivers. I'll be okay with that then as long as > > the values are exposed in a consistent and well defined way. :) > > > > As for this patch, Hans, are you going to apply it? > > It's in a PR for 5.7. I had hoped it would go in for v5.6, but it was > too late for that. Okay, thanks! > > Regards, > > Hans > > > > > Best regards, > > Tomasz > > > >>> > >>> If not, let me know asap. > >>> > >>> Regards, > >>> > >>> Hans > >>> > >>>>>>>> Signed-off-by: Hirokazu Honda > >>>>>>>> --- > >>>>>>>> drivers/staging/media/hantro/hantro_drv.c | 10 ++++++++++ > >>>>>>>> 1 file changed, 10 insertions(+) > >>>>>>>> > >>>>>>>> diff --git a/drivers/staging/media/hantro/hantro_drv.c > >>>>>>>> b/drivers/staging/media/hantro/hantro_drv.c > >>>>>>>> index 6d9d41170832..9387619235d8 100644 > >>>>>>>> --- a/drivers/staging/media/hantro/hantro_drv.c > >>>>>>>> +++ b/drivers/staging/media/hantro/hantro_drv.c > >>>>>>>> @@ -355,6 +355,16 @@ static const struct hantro_ctrl controls[] = =3D { > >>>>>>>> .def =3D > >>>>>>>> V4L2_MPEG_VIDEO_H264_START_CODE_ANNEX_B, > >>>>>>>> .max =3D > >>>>>>>> V4L2_MPEG_VIDEO_H264_START_CODE_ANNEX_B, > >>>>>>>> }, > >>>>>>>> + }, { > >>>>>>>> + .codec =3D HANTRO_H264_DECODER, > >>>>>>>> + .cfg =3D { > >>>>>>>> + .id =3D V4L2_CID_MPEG_VIDEO_H264_PROFILE, > >>>>>>>> + .min =3D V4L2_MPEG_VIDEO_H264_PROFILE_BASE= LINE, > >>>>>>>> + .max =3D V4L2_MPEG_VIDEO_H264_PROFILE_HIGH= , > >>>>>>>> + .menu_skip_mask =3D > >>>>>>>> + BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED)= , > >>>>>>>> + .def =3D V4L2_MPEG_VIDEO_H264_PROFILE_MAIN= , > >>>>>>>> + } > >>>>>>>> }, { > >>>>>>>> }, > >>>>>>>> }; > >> >