Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1535270ybl; Fri, 10 Jan 2020 21:00:51 -0800 (PST) X-Google-Smtp-Source: APXvYqxgepntCRCAfeY5lKV+eVjFCC1XEx3vnCavUAY5CYfw6MWhwyeuPO/NXv9bWMQ/TScDyJYV X-Received: by 2002:a05:6830:1d7b:: with SMTP id l27mr5268200oti.251.1578718851016; Fri, 10 Jan 2020 21:00:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578718851; cv=none; d=google.com; s=arc-20160816; b=jr2CUae+A9V4duuFhgoiw+aJ5R4K2w0arg/oPCHxBDw3emXcpw0CiaHIegK0Us/LZW YOVVj58O4mH4zySAbZ+RxX2z420yhbTk1t9EB65gld4tEJCFIQKB0yI6kgOCBNqMNuEu AJMWoIfgggr0i2XFnxicxoQ5sSSarLxgsqGKMOVlgtQ6NlFBntuHajQu46i4D+O+jkIR fiwxJGAQAXds2szLAiuP/ePAcDQc0Xx2rDOBR1Qini0u4G1oKuYggMi2ZTbxlyMkf/M3 f6njleiDXQ+LAL/zhH6oNSVaCTAsymZ5ZuCyQl1/63EcQSEumheTdkKBBKl7AYAHVPy5 XCRQ== 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:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=y/ZGV4zqiX/81ftHfNFP5ohl41JDzzDqpuQvfAd0Tnc=; b=pRx1J7ROcyl2XOtCPdz+D9t7V11xNefx4JhZadnUiecbeAMFJEsJ9us9dUBl8PsP2d 83LWagnzlAWSwiMzRcftxjwpSKTzqeeHpraBm69nUSdDE61FM8XqGatcLxiLKKtvUv1I jQgNj2F2jeQVDsaJ5/5z4quGoq1txSlgk876TrTu4TzDeC6Vp9RzcXYB8T7rrrr71UxM VOpw+UvlgYR7fVckZ/Og7a7ADwjGkuzOUQlOuFR97M5kTSFC2t8v2Lsf9tWQOmTSTVa7 B9WPJ5ViT7xDhqnR3518Iv001H4daNWumwKBjFtNmzDo0P/fs+S61jEYx3kT9pawyOUq OZIQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si3247647oto.129.2020.01.10.21.00.38; Fri, 10 Jan 2020 21:00:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728357AbgAKE7c (ORCPT + 99 others); Fri, 10 Jan 2020 23:59:32 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60316 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728328AbgAKE7c (ORCPT ); Fri, 10 Jan 2020 23:59:32 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 4A413292E31 Message-ID: Subject: Re: [PATCH] media: hantro: Support H264 profile control From: Ezequiel Garcia To: Hans Verkuil , Tomasz Figa , Nicolas Dufresne , Hirokazu Honda Cc: Mauro Carvalho Chehab , Greg KH , Linux Media Mailing List , devel@driverdev.osuosl.org, Linux Kernel Mailing List Date: Sat, 11 Jan 2020 01:59:20 -0300 In-Reply-To: References: <20191122051608.128717-1-hiroh@chromium.org> <767528be59275265072896e5c679e97575615fdd.camel@ndufresne.ca> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Hirokazu, Hans, On Fri, 2020-01-10 at 13:31 +0100, Hans Verkuil wrote: > 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 à 01:00 +0900, Tomasz Figa a écrit : > > > > On Sat, Nov 23, 2019 at 12:09 AM Nicolas Dufresne wrote: > > > > > Le vendredi 22 novembre 2019 à 14:16 +0900, Hirokazu Honda a écrit : > > > > > > 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 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 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. > > There is a lot of discussion here, but it all revolves around a potential > LEVEL control. > > So I gather everyone is OK with merging this patch? > I'm fine with this. [..] > > > > > > 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[] = { > > > > > > .def = V4L2_MPEG_VIDEO_H264_START_CODE_ANNEX_B, > > > > > > .max = V4L2_MPEG_VIDEO_H264_START_CODE_ANNEX_B, > > > > > > }, > > > > > > + }, { > > > > > > + .codec = HANTRO_H264_DECODER, > > > > > > + .cfg = { > > > > > > + .id = V4L2_CID_MPEG_VIDEO_H264_PROFILE, > > > > > > + .min = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE, I'd like to see the .def here ^^^ for consistency with the other controls. But I know this is my OCD speaking, so it's fine as-is as well. Reviewed-by: Ezequiel Garcia > > > > > > + .max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, > > > > > > + .menu_skip_mask = > > > > > > + BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED), > > > > > > + .def = V4L2_MPEG_VIDEO_H264_PROFILE_MAIN, Thanks, Eze