Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6786597pxb; Wed, 17 Feb 2021 13:28:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxk5haGVHsEWEVO/a4XZB5X4P4IcE1cUvIOg64VxEP5yfyYRy1sZg1L6+YoLF5RhfHp+eED X-Received: by 2002:a17:906:6b1b:: with SMTP id q27mr859316ejr.508.1613597296401; Wed, 17 Feb 2021 13:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613597296; cv=none; d=google.com; s=arc-20160816; b=KcdmQUkMjQkGwJ1+GYPPToglU/y46l9Qq9Y8KpwTiVcMuwFTWW7UReEG6vaOnzFOeB AkTmgLnEw9+fshMijZdt6EABdLJUtpsqn1WumCcbjQFUAZaBCr341fEyb9qFxR5u5Rft YYdvop3h3A0YtOD1ksO/15sZiVtT+gzqYfMzs5WbQpgoT7J9Voqhac0jE9C3eS62ASFi TKF5iEp80tL7l2hqshQgymA/X9yVa7f8IW59ZK5bjwQX2gEV06qSb0AZ8nYwrYHFV9cY QDlMz0sZB9O3YVv7juV0JvWhkrfPPOPxrxxTB9fnLhuGOEYMwQf8wOQjAZZi+ZuRNUoc FFCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=HO41xBWRPrQwx+0jQE816pOTsUOYGmkdeL7vzTiOJmw=; b=ch3six6PbOLQhSfBgJOLl4prGHiRVUXA0nURawbFBDdPoP7Mm+E+A29KHvWZDY0b45 CmgwoNCPaPBYEKkth9+WVQg0yU652xESLPt9MXACVfYY8HiWsaJim8yytmECpoJ+riOn l6xI0LDdBK9VOjkP+7B0XOBJnqKpOeulS59J1+TsbYbBNgjRqoA8nlzYsGE89BaDtoXI nNT7iUoCXf+hAaprzQmUXRTrnBJ/cZZOKdD97fG3O6JxOdRBIdItrFrGSClQhbChjJdB iH9S8V/s7+Hq+0IuBFfK6nRsJYAthyiH6Wbyu8OuRCUZsrjfgdamXsLhjhAVnr2vIuyr TxrA== 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 b7si2339947ejz.39.2021.02.17.13.27.51; Wed, 17 Feb 2021 13:28:16 -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 S234553AbhBQUnS (ORCPT + 99 others); Wed, 17 Feb 2021 15:43:18 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59748 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231483AbhBQUnQ (ORCPT ); Wed, 17 Feb 2021 15:43:16 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id EC2C61F450C4 Message-ID: Subject: Re: [PATCH v1 11/18] media: hantro: Add helper function for auxiliary buffers allocation From: Ezequiel Garcia To: Benjamin Gaignard , 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 Date: Wed, 17 Feb 2021 17:42:21 -0300 In-Reply-To: <20210217080306.157876-12-benjamin.gaignard@collabora.com> References: <20210217080306.157876-1-benjamin.gaignard@collabora.com> <20210217080306.157876-12-benjamin.gaignard@collabora.com> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.2-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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);