Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1855180ybl; Thu, 5 Dec 2019 08:05:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzrax/1Iof1DjVj/RxuSz9TWe/VWL3leX1NkgSeaTyUpbxka/QayyttP++jMI2f5SnFj8/L X-Received: by 2002:aca:5083:: with SMTP id e125mr7942498oib.96.1575561906038; Thu, 05 Dec 2019 08:05:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575561906; cv=none; d=google.com; s=arc-20160816; b=HhYCe4ItsZrbXtGR2bGpk9ddMrGR72VZeZNPs11sh8+2iN4tIFppO/O1/neWDx0ZW/ SyoPiWbfhGWj2s4qkybAMSfxBl2xZv14Y0d3Mx73OGRNlUMKsEuQ/xDU3sk0LTycMD8B WsnWzxLzXRq5WkTXQUyhI7ajFxZPZNYHwbmao6vebabvpY36opt+04cC5OLY52hlVsG+ 3Lcwo+AWiTkqxf0ccucct+T35qG6VmvhV+0pGelO65Cl5QnhrUytOA86WQ/8d7qxUeBQ 4BiK8Mkt0J3wEFz2TEiBbN7J6+mht+Cu24yGegOt2olmYvcu27nIgXijbNh8xbzLchpK qh0g== 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=/QaDBvI+ZfF4XKEVNPXNpMcq3koiVnGcZ7noEKrwVrs=; b=oUaDWdYZ6xSwOLPJH1ViGTD6p8LYj1iF5ZCqGBXsHn3bzL8YEYfXTP6IGmfZ4CnlQ6 k1sHSspW3cZ950I5eb0uw7KJ4esFvQSISECiqDxuHgpa3Kkkgv8fcUoz8hAwIpaYHmC1 L5Oq2UA9hir9Mf1IEmvIPXlu8Adosi3wFbpwx5LV4llUMoJ+N+apwYvgKMDXsheIY75v hPXU5JS/VouqlppK5gynqc4ZyYK55ErE0SccvGXfUR4zlvLlONYG/CX1iVAhre1fvYhj nv3hf1ebR0i3rsbElnzCzcGvjaqWqdoyHp7GL5oVw1vDpkZyqVEm8ZcE9AtfMrKMLSVh lFhg== 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 x8si5353566oto.259.2019.12.05.08.04.41; Thu, 05 Dec 2019 08:05:06 -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 S1729910AbfLEQDG (ORCPT + 99 others); Thu, 5 Dec 2019 11:03:06 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:51578 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbfLEQDF (ORCPT ); Thu, 5 Dec 2019 11:03:05 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 6395D2923CC Message-ID: <9dc26a0a51fe60206265cc1495b63e1f1d5e661d.camel@collabora.com> Subject: Re: [PATCH v3 2/3] media: hantro: Support color conversion via post-processing From: Ezequiel Garcia To: Philipp Zabel , linux-media@vger.kernel.org Cc: kernel@collabora.com, Tomasz Figa , linux-rockchip@lists.infradead.org, Heiko Stuebner , Jonas Karlman , Boris Brezillon , Chris Healy , linux-kernel@vger.kernel.org Date: Thu, 05 Dec 2019 13:02:54 -0300 In-Reply-To: <2d2524129c6287c13e9d83d1d885046483e75117.camel@pengutronix.de> References: <20191113175603.24742-1-ezequiel@collabora.com> <20191113175603.24742-3-ezequiel@collabora.com> <1e1c7a0e3d25187723ccac1a8360b5aae9aed8cd.camel@pengutronix.de> <88a48cb78843458b55896eeb3af2f46488d42744.camel@collabora.com> <2d2524129c6287c13e9d83d1d885046483e75117.camel@pengutronix.de> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-12-05 at 15:46 +0100, Philipp Zabel wrote: > On Thu, 2019-12-05 at 11:33 -0300, Ezequiel Garcia wrote: > > Hello Philipp, > > > > On Fri, 2019-11-15 at 12:44 -0300, Ezequiel Garcia wrote: > > > Hello Philipp, > > > > > > Thanks for reviewing. > > > > > > On Thu, 2019-11-14 at 10:48 +0100, Philipp Zabel wrote: > > > > Hi Ezequiel, > > > > > > > > On Wed, 2019-11-13 at 14:56 -0300, Ezequiel Garcia wrote: > > > > > The Hantro G1 decoder is able to enable a post-processor > > > > > on the decoding pipeline, which can be used to perform > > > > > scaling and color conversion. > > > > > > > > > > The post-processor is integrated to the decoder, and it's > > > > > possible to use it in a way that is completely transparent > > > > > to the user. > > > > > > > > > > This commit enables color conversion via post-processing, > > > > > which means the driver now exposes YUV packed, in addition to NV12. > > > > > > > > > > Signed-off-by: Ezequiel Garcia > > > > > --- > > > > > drivers/staging/media/hantro/Makefile | 1 + > > > > > drivers/staging/media/hantro/hantro.h | 64 +++++++- > > > > > drivers/staging/media/hantro/hantro_drv.c | 8 +- > > > > > .../staging/media/hantro/hantro_g1_h264_dec.c | 2 +- > > > > > .../media/hantro/hantro_g1_mpeg2_dec.c | 2 +- > > > > > drivers/staging/media/hantro/hantro_g1_regs.h | 53 +++++++ > > > > > .../staging/media/hantro/hantro_g1_vp8_dec.c | 2 +- > > > > > drivers/staging/media/hantro/hantro_h264.c | 6 +- > > > > > drivers/staging/media/hantro/hantro_hw.h | 13 ++ > > > > > .../staging/media/hantro/hantro_postproc.c | 141 ++++++++++++++++++ > > > > > drivers/staging/media/hantro/hantro_v4l2.c | 52 ++++++- > > > > > drivers/staging/media/hantro/rk3288_vpu_hw.c | 10 ++ > > > > > 12 files changed, 343 insertions(+), 11 deletions(-) > > > > > create mode 100644 drivers/staging/media/hantro/hantro_postproc.c > > > > > > > > > > > > [..] > > > > > pix_mp->plane_fmt[0].sizeimage += > > > > > 128 * DIV_ROUND_UP(pix_mp->width, 16) * > > > > > DIV_ROUND_UP(pix_mp->height, 16); > > > > > @@ -611,10 +643,23 @@ static int hantro_start_streaming(struct vb2_queue *q, unsigned int count) > > > > > > > > > > vpu_debug(4, "Codec mode = %d\n", codec_mode); > > > > > ctx->codec_ops = &ctx->dev->variant->codec_ops[codec_mode]; > > > > > - if (ctx->codec_ops->init) > > > > > + if (ctx->codec_ops->init) { > > > > > ret = ctx->codec_ops->init(ctx); > > > > > + if (ret) > > > > > + return ret; > > > > > + } > > > > > + > > > > > + if (hantro_needs_postproc(ctx)) { > > > > > + ret = hantro_postproc_alloc(ctx); > > > > > > > > Why is this done in start_streaming? Wouldn't capture side REQBUFS be a > > > > better place for this? > > > > > > > > > > Yes, makes sense as well. > > > > > > > This didn't work so well, so I have decided to leave it as-is in the > > just submitted v4 series. > > > > The vb2 framework provides two mechanism for drivers to allocate > > buffers, REQBUFS and CREATEBUFS, so the bounce buffer allocation > > has to be hooked on both of them. > > That is a good point, now that we don't allocate VB2_MAX_FRAME bounce > buffers at start_streaming time anymore, what happens if additional > capture buffers are created with CREATEBUFS while streaming? > If I understand vb2 logic correctly, then I do not think anything will happen, because the newly created buffers won't be queued. Regards, Ezequiel