[{"id":10893,"web_url":"https://patchwork.libcamera.org/comment/10893/","msgid":"<20200627095132.5ulnfvvkxoq52k3e@uno.localdomain>","date":"2020-06-27T09:51:32","subject":"Re: [libcamera-devel] [PATCH 02/13] libcamera: ipu3: Import instead\n\tof allocate statistic buffers","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Sat, Jun 27, 2020 at 05:00:32AM +0200, Niklas Söderlund wrote:\n> Statistics buffers are not yet used by the IPU3 pipeline, they are never\n> queued to the video device or in any other way consumed. The kernel\n> driver will however not allow video streaming to start if buffers are\n> not either allocated or imported on the video device. Instead of\n> allocating the buffers wasting memory that is never used import buffers.\n>\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 8 +++++---\n>  1 file changed, 5 insertions(+), 3 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index fba45935741e0e4e..405550b1302fb370 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -1135,11 +1135,13 @@ int ImgUDevice::allocateBuffers(IPU3CameraData *data, unsigned int bufferCount)\n>  \t}\n>\n>  \t/*\n> -\t * Use for the stat's internal pool the same number of buffers as for\n> -\t * the input pool.\n> +\t * The kernel fails to start if buffers are not either imported or\n> +\t * allocated for the statisitcs video device. As statistics buffers are\n> +\t * not yet used by the pipeline import buffers to save memory.\n> +\t *\n\nIs this based on practical experience ? The IPU3 driver documentation\nis a bit confusing on which output is required to have buffes queued\nin order for operations to start...\n\n\n>  \t * \\todo To be revised when we'll actually use the stat node.\n>  \t */\n> -\tret = stat_.dev->allocateBuffers(bufferCount, &stat_.buffers);\n> +\tret = stat_.dev->importBuffers(bufferCount);\n>  \tif (ret < 0) {\n>  \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU stat buffers\";\n>  \t\tgoto error;\n> --\n> 2.27.0\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B8F79C2E69\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Jun 2020 09:48:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4248A609D6;\n\tSat, 27 Jun 2020 11:48:03 +0200 (CEST)","from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D4E9C603B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 11:48:01 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 36CDEFF803;\n\tSat, 27 Jun 2020 09:48:00 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Sat, 27 Jun 2020 11:51:32 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200627095132.5ulnfvvkxoq52k3e@uno.localdomain>","References":"<20200627030043.2088585-1-niklas.soderlund@ragnatech.se>\n\t<20200627030043.2088585-3-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200627030043.2088585-3-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH 02/13] libcamera: ipu3: Import instead\n\tof allocate statistic buffers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":10901,"web_url":"https://patchwork.libcamera.org/comment/10901/","msgid":"<20200627102730.GB911447@oden.dyn.berto.se>","date":"2020-06-27T10:27:30","subject":"Re: [libcamera-devel] [PATCH 02/13] libcamera: ipu3: Import instead\n\tof allocate statistic buffers","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your feedback.\n\nOn 2020-06-27 11:51:32 +0200, Jacopo Mondi wrote:\n> Hi Niklas,\n> \n> On Sat, Jun 27, 2020 at 05:00:32AM +0200, Niklas Söderlund wrote:\n> > Statistics buffers are not yet used by the IPU3 pipeline, they are never\n> > queued to the video device or in any other way consumed. The kernel\n> > driver will however not allow video streaming to start if buffers are\n> > not either allocated or imported on the video device. Instead of\n> > allocating the buffers wasting memory that is never used import buffers.\n> >\n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 8 +++++---\n> >  1 file changed, 5 insertions(+), 3 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index fba45935741e0e4e..405550b1302fb370 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -1135,11 +1135,13 @@ int ImgUDevice::allocateBuffers(IPU3CameraData *data, unsigned int bufferCount)\n> >  \t}\n> >\n> >  \t/*\n> > -\t * Use for the stat's internal pool the same number of buffers as for\n> > -\t * the input pool.\n> > +\t * The kernel fails to start if buffers are not either imported or\n> > +\t * allocated for the statisitcs video device. As statistics buffers are\n> > +\t * not yet used by the pipeline import buffers to save memory.\n> > +\t *\n> \n> Is this based on practical experience ? The IPU3 driver documentation\n> is a bit confusing on which output is required to have buffes queued\n> in order for operations to start...\n\nYes the documentation is not very helpful so this is all based on \nexperimentation and reading the code. See the cover letter for how I \nverified it.\n\n> \n> \n> >  \t * \\todo To be revised when we'll actually use the stat node.\n> >  \t */\n> > -\tret = stat_.dev->allocateBuffers(bufferCount, &stat_.buffers);\n> > +\tret = stat_.dev->importBuffers(bufferCount);\n> >  \tif (ret < 0) {\n> >  \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU stat buffers\";\n> >  \t\tgoto error;\n> > --\n> > 2.27.0\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E197FC2E66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Jun 2020 10:27:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 61DCF609D6;\n\tSat, 27 Jun 2020 12:27:35 +0200 (CEST)","from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A7C8609C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 12:27:33 +0200 (CEST)","by mail-lj1-x241.google.com with SMTP id t25so8285182lji.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 03:27:33 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\te20sm51907lja.137.2020.06.27.03.27.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 27 Jun 2020 03:27:31 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"0YIf3pEv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=Lj5LZuUhG/6BZqatZlCNiZVlzbTlbLBTOHqOno5h81M=;\n\tb=0YIf3pEvAuEaG172/NbBRZCUfx7ttqUZSMp1klz2z5TUC4Z/2hmbPHs5an5GVwKYKB\n\t6aiqKcEryZoNvDF+iOuSZG/TqWrIi+JbN1YZR7CITLc955iwKcj7YBJEkUkQNGIaNtEN\n\tqqlnQA0WMjv+v45EusKdP2mU9E74IBzl0W1Nt9eUe+uV4+vqjvv03xHIi4zusuti5hhB\n\tziVax5RfRx6AEVKZEUaPwAmIFshKlxi/7fs0krjh9XUw6p+y0OKohUrxwVm8uWu09+lL\n\tNNLK1yXqVzA58xGRZL511b+PqIxN/bwMPUvpVT04w4pIJxb5FCyKnrCX3EHPw56d8YH/\n\tvKCA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=Lj5LZuUhG/6BZqatZlCNiZVlzbTlbLBTOHqOno5h81M=;\n\tb=OFcajxgau9bO6Lb9HlOtn3C0KHHBVJ+eVpX+LBsPkHcAcOdZI6O8nBHVoMHI9GExHv\n\tWzMRtnX044baG22F8a4igxiExwU/LotNMxRouekQ+U6iS8b4L6FcSkCJWc5wsAFY3Dqf\n\tM/JPDUGi5VS6hIehbHP9SYABIcv8DbnWiJ1KqQYQh/3DGjV0LxERYj6Av/1uRpqCkzbw\n\tkAsx/gkKoWyR0ABwMu6f6nDPr1QZzvqyGFGB0sws/jbWHQMhQoxEJeBimYnfzgCcd3nQ\n\twl2LRPtgb3sJwJfeaGxbZuUTNA069z0/AGxa48V9MoVAJJFc+vaB6uAwcfkrAO0Ha1p2\n\t7OYQ==","X-Gm-Message-State":"AOAM5332h5sXYF6R/ngwHpmysDoBqaZPwtaIkWSHGdkD677q86K03XWT\n\tO3JXO/wtQTko+F+nrok09qHezA==","X-Google-Smtp-Source":"ABdhPJy6UIOsf/wX76wreUOqAcfV6YBm5PmmFcz65ffoqQMBOcRFpi9gamsc2yNvfaseNWeWREe5nw==","X-Received":"by 2002:a2e:854b:: with SMTP id u11mr656261ljj.99.1593253652388; \n\tSat, 27 Jun 2020 03:27:32 -0700 (PDT)","Date":"Sat, 27 Jun 2020 12:27:30 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200627102730.GB911447@oden.dyn.berto.se>","References":"<20200627030043.2088585-1-niklas.soderlund@ragnatech.se>\n\t<20200627030043.2088585-3-niklas.soderlund@ragnatech.se>\n\t<20200627095132.5ulnfvvkxoq52k3e@uno.localdomain>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200627095132.5ulnfvvkxoq52k3e@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 02/13] libcamera: ipu3: Import instead\n\tof allocate statistic buffers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]