Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7424751pxb; Thu, 18 Feb 2021 09:41:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/xbwmvAvsw2PuhmD1DuH5YFIKwNKGncVL8ljrlUY7ylnX7fDmJw29wqkwZBuYFBfmpg18 X-Received: by 2002:aa7:c044:: with SMTP id k4mr5260616edo.47.1613670112543; Thu, 18 Feb 2021 09:41:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613670112; cv=none; d=google.com; s=arc-20160816; b=MCcZFUS7HIoyOqx0Xk75K56qmcqoHlZOpS7cBjDF0nH/OMgnyQ8N4QhzLWI3MjNzvl Wc41l4h3yefdwjo+rmZEjOcLN7QI9zGzPzR4WBuztJJmVvyP1SdHu/NPAvuwHeWQYrq3 epSnWFPat18xM5vK1Jxj8dbWZ887sK9Vog2VdTeHYlyeRVn6F4eevc7VZbixNLnloDZa 0/bDnlIHo8T3ubFbI0+A3Of9sEM5jcLCl9J5cV2wTShj2SejtcFO/HiMuKKGxyAs6puL mpbMRUjMPL6pDkVM7mjh/7yJu2Z7gOG8HHHhfqnMXhKtKcRF0+iHkCAxBqec/xO2V12d owgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=mj5Q++uKOPFghmsTRanGU8o2/pz0oS2k6VfvjRdvDgE=; b=C20XtUxs936K2sqqrvQArZgWR+SZjXZvsyUmGFB5zPbbueUkiZVj8glZ83bu/2YdZr QOoqzUYaEFcnIcRAqX6rLSgghMiv36qCkC4X7ebSgCmKhztt+rzyIZrsqsFx3eVv8s/h ZCIVutMCw3u7vmb3bRaAGF1yEZf2DPWGpQLO0Rer8Lq+JVawNRrv0q09v+x3scSMi2j5 XWJkNLRxCsc5TdP4qVcDM2E7lNYtohBm+VA2P/V/sLcX3zbkoDNhHLT/Z2nZJ8vlG9CM 7PBOk3TBfA86SDK2P+7mqDTHmZ0zrhSLKbh5ovYQBLg0LIbNV9RAI3Up58sgTvrkAcgs ccnQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si4017402edd.534.2021.02.18.09.41.06; Thu, 18 Feb 2021 09:41:52 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234473AbhBRRiE (ORCPT + 99 others); Thu, 18 Feb 2021 12:38:04 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40248 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230444AbhBROws (ORCPT ); Thu, 18 Feb 2021 09:52:48 -0500 Received: from [IPv6:2a01:e0a:4cb:a870:851a:1dfb:a143:80e] (unknown [IPv6:2a01:e0a:4cb:a870:851a:1dfb:a143:80e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 786EB1F45CD3; Thu, 18 Feb 2021 14:52:00 +0000 (GMT) Subject: Re: [PATCH v1 11/18] media: hantro: Add helper function for auxiliary buffers allocation To: Ezequiel Garcia , p.zabel@pengutronix.de, mchehab@kernel.org, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, gregkh@linuxfoundation.org, mripard@kernel.org, paul.kocialkowski@bootlin.com, wens@csie.org, jernej.skrabec@siol.net, krzk@kernel.org, shengjiu.wang@nxp.com, adrian.ratiu@collabora.com, aisheng.dong@nxp.com, peng.fan@nxp.com, Anson.Huang@nxp.com, hverkuil-cisco@xs4all.nl Cc: 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 References: <20210217080306.157876-1-benjamin.gaignard@collabora.com> <20210217080306.157876-12-benjamin.gaignard@collabora.com> From: Benjamin Gaignard Message-ID: <9646b54e-786f-1f0b-9110-8e7b9b6cab93@collabora.com> Date: Thu, 18 Feb 2021 15:51:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 17/02/2021 à 21:42, Ezequiel Garcia a écrit : > Hi Benjamin, > > On Wed, 2021-02-17 at 09:02 +0100, Benjamin Gaignard wrote: >> Add helper functions to allocate and free auxiliary buffers. >> These buffers aren't for frames but are needed by the hardware >> to store scaling matrix, tiles size, border filters etc... >> >> Signed-off-by: Benjamin Gaignard >> Signed-off-by: Ezequiel Garcia >> Signed-off-by: Adrian Ratiu >> --- >>  drivers/staging/media/hantro/hantro.h | 24 ++++++++++++++++++++++++ >>  1 file changed, 24 insertions(+) >> >> diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h >> index a9b80b2c9124..7f842edbc341 100644 >> --- a/drivers/staging/media/hantro/hantro.h >> +++ b/drivers/staging/media/hantro/hantro.h >> @@ -446,6 +446,30 @@ hantro_get_dec_buf(struct hantro_ctx *ctx, struct vb2_buffer *vb) >>         return vb2_plane_vaddr(vb, 0); >>  } >> >> +static inline int >> +hantro_aux_buf_alloc(struct hantro_dev *vpu, >> +                    struct hantro_aux_buf *buf, size_t size) >> +{ > Can you add convert the dma_alloc_ calls in the driver, > and squash it in this patch? > > I.e. hantro_h264_dec_init, hantro_vp8_dec_init, etc. Sure I will that in v2. Benjamin > > Thanks! > Ezequiel > >> +       buf->cpu = dma_alloc_coherent(vpu->dev, size, &buf->dma, GFP_KERNEL); >> +       if (!buf->cpu) >> +               return -ENOMEM; >> + >> +       buf->size = size; >> +       return 0; >> +} >> + >> +static inline void >> +hantro_aux_buf_free(struct hantro_dev *vpu, >> +                   struct hantro_aux_buf *buf) >> +{ >> +       if (buf->cpu) >> +               dma_free_coherent(vpu->dev, buf->size, buf->cpu, buf->dma); >> + >> +       buf->cpu = NULL; >> +       buf->dma = 0; >> +       buf->size = 0; >> +} >> + >>  void hantro_postproc_disable(struct hantro_ctx *ctx); >>  void hantro_postproc_enable(struct hantro_ctx *ctx); >>  void hantro_postproc_free(struct hantro_ctx *ctx); > >