Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7380445ybc; Thu, 28 Nov 2019 16:22:37 -0800 (PST) X-Google-Smtp-Source: APXvYqw+a8h03F/C+09kV45If7tToHnuKpwlD1honTNnAILaFoW20KgRHcvIDSRqgygdmPchGEyG X-Received: by 2002:a50:a9e3:: with SMTP id n90mr41159793edc.52.1574986956885; Thu, 28 Nov 2019 16:22:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574986956; cv=none; d=google.com; s=arc-20160816; b=cq0vm0nXV6qgAp0cZE12jh1/ioYydgd50I3STFWssqtsvoHz1ICDe0pCYJt9RaeO+N fjMF35qBw+iQm39mgft9MQqf1q+tghV8CKwle5Rw1nrmIopztglyjTHu31dQlNUW2SBj /u8HGMPQkW4LQWcISQx/6ZQ6HyKtdcg8Z6+rmUCM0FlQWq7FAl+1CKznyIomZHMzAT/m Nw9YM+b5pc74qWR4DgkjEA7tlmPCneYZgjXD6eqLf2z19F85e5aODpf/VnFQNPKaps6Y 7I4F7CevJ23SrSD2nvr6wNDCXfe0Hs8/18WLW6GOOfiFz33r96PGSXqea5saXvRL54vH XOZg== 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=hKdxAEvC9giOVo+5fI8UhBseDYEwGbYsXK3mw9tmIQY=; b=0pxm52bZHRGw21Y49jtz1JobHs2HavIsE8QU5Lmi1El1YwWaI6RYi7CfLuJaQrmjB6 8yTm22z/LYYBWe1BZQATYbWnZt3HKOHwXbhrG/rnzdqakfeH+EzmkIK/sI39ll6hVJgj 08tS+7qL3oo3HfW6vAVKWFWBSWr90VENBbAJ8wT/dHHbGdlM4ncUCUp+d9tZUH8Lw5Ul a99EwgJRYyWZa8ze4yPSzU2qwF2NDIOb82MswAb6cJWOyo9LBjpxe9DCMyMrxUp5nT3a OKdu6alxCA/IM09sP3SI2KbAwc9KcHGe7y36j6wq0Dw+6vbD999GOcL9v6yiRY4d6fgD l1OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hVlmWmpz; 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 24si15096740eje.293.2019.11.28.16.22.01; Thu, 28 Nov 2019 16:22:36 -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=hVlmWmpz; 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 S1726653AbfK2ARN (ORCPT + 99 others); Thu, 28 Nov 2019 19:17:13 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:45396 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbfK2ARM (ORCPT ); Thu, 28 Nov 2019 19:17:12 -0500 Received: by mail-ed1-f68.google.com with SMTP id b5so24228894eds.12 for ; Thu, 28 Nov 2019 16:17:11 -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=hKdxAEvC9giOVo+5fI8UhBseDYEwGbYsXK3mw9tmIQY=; b=hVlmWmpzm8h9AJJ3dV8J/Vq5S3tr8XdfS5TULH7gtd+QDlFhFvJl5GIs3pVRxbpuAr vb1xpQaVDVwJEn8ubFxWrx0Sy+N9ZDlY0LzWfmLkB4krIK6/YmWQQ+vvqvlvkaGE6nAX DPJPCbcwVfWu0Kox3IVCt7MSklSiOlMkMdfDc= 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=hKdxAEvC9giOVo+5fI8UhBseDYEwGbYsXK3mw9tmIQY=; b=F7ZYe5JJ26aRmH9RE+bmPJbwYX6uF9u9KtxfSubLBiHgxyUtp/e6yCxAfa2+N+4f+B iFx6Wxmd0p8Oie0yF50ldsvW1CRCwDMjHX/Q+i55zoU636BIyvzOPewylayDoOzE+9Up ZBAMSn8xFqTjxp90BzdIULfwSin1FFlN2pd9tgaQJjN3Yz10sBVSY9EH68BtsyhFW1XM 5q2eoc7gH7PjatC+GYAHYOu9rb0+g5OF/Q+ZJS0lptJ66/GbMoqFoFQz3QUUnF0erB+U lUd9DoMmTm9+CFMSFxjX0CDunvwWCMBUCLFNeAmhL7q7CXvGOWMAI6GB+94jd3xx5EQG l6QA== X-Gm-Message-State: APjAAAUoR/ix/ifzDN6Pob7Fqqv09icNFId905U6ykvYf/VqKeqfCCI0 cQtP99rqne8LS/5VXC4KA8Yme5bLlfZbpA== X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr1067477edy.290.1574986630191; Thu, 28 Nov 2019 16:17:10 -0800 (PST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com. [209.85.128.41]) by smtp.gmail.com with ESMTPSA id i7sm886939edr.28.2019.11.28.16.17.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Nov 2019 16:17:09 -0800 (PST) Received: by mail-wm1-f41.google.com with SMTP id y23so3958296wma.0 for ; Thu, 28 Nov 2019 16:17:09 -0800 (PST) X-Received: by 2002:a1c:3c42:: with SMTP id j63mr12611006wma.90.1574986628632; Thu, 28 Nov 2019 16:17:08 -0800 (PST) MIME-Version: 1.0 References: <20191122051608.128717-1-hiroh@chromium.org> <767528be59275265072896e5c679e97575615fdd.camel@ndufresne.ca> In-Reply-To: From: Tomasz Figa Date: Fri, 29 Nov 2019 09:16:57 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: hantro: Support H264 profile control To: Nicolas Dufresne Cc: 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 Sat, Nov 23, 2019 at 1:52 AM Nicolas Dufresne wro= te: > > Le samedi 23 novembre 2019 =C3=A0 01:00 +0900, Tomasz Figa a =C3=A9crit : > > 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 High= , 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 profile= s. > > > > > > Thanks for this patch. Do you think we could also add the LEVEL contr= ol > > > so the profile/level enumeration becomes complete ? > > > > > > I'm thinking it would be nice if the v4l2 compliance test make sure > > > that codecs do implement these controls (both stateful and stateless)= , > > > it's essential for stack with software fallback, or multiple capable > > > codec hardware but with different capabilities. > > > > > > > Level is a difficult story, because it also specifies the number of > > 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 constraints. > > Performance related things depend on the integration details and > > should be managed elsewhere. For example Android and Chrome OS manage > > expected decoding performance in per-board configuration files. > > When you read datasheet, the HW is always rated to maximum level (and > 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 math > with data that isn't fully exposed to the user. This is about filtering > 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 capable > 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 enable 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 supported 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. > > > > > > 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/st= aging/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_ANNE= X_B, > > > > .max =3D V4L2_MPEG_VIDEO_H264_START_CODE_ANNE= X_B, > > > > }, > > > > + }, { > > > > + .codec =3D HANTRO_H264_DECODER, > > > > + .cfg =3D { > > > > + .id =3D V4L2_CID_MPEG_VIDEO_H264_PROFILE, > > > > + .min =3D V4L2_MPEG_VIDEO_H264_PROFILE_BASELIN= E, > > > > + .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, > > > > + } > > > > }, { > > > > }, > > > > };