[{"id":1089,"web_url":"https://patchwork.libcamera.org/comment/1089/","msgid":"<20190321100548.GM4615@pendragon.ideasonboard.com>","date":"2019-03-21T10:05:48","subject":"Re: [libcamera-devel] [PATCH v4 10/31] libcamera: ipu3: Implement\n\tbuffer release","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Mar 20, 2019 at 05:30:34PM +0100, Jacopo Mondi wrote:\n> Release buffers on all video devices in the pipeline.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 30 +++++++++++++++++++++++-----\n>  1 file changed, 25 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 659a7ca4829f..965794494a4e 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -158,6 +158,7 @@ private:\n>  \tvoid registerCameras();\n>  \n>  \tImgUDevice imgus_[IPU3_IMGU_COUNT];\n> +\n\nPlease move this to the appropriate patch if needed, or drop it.\n\n>  \tstd::shared_ptr<MediaDevice> cio2MediaDev_;\n>  \tstd::shared_ptr<MediaDevice> imguMediaDev_;\n>  };\n> @@ -358,13 +359,32 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera, Stream *stream)\n>  int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> +\tV4L2Device *viewfinder = data->imgu->viewfinder;\n> +\tV4L2Device *output = data->imgu->output;\n> +\tV4L2Device *input = data->imgu->input;\n>  \tV4L2Device *cio2 = data->cio2.output;\n> +\tV4L2Device *stat = data->imgu->stat;\n\nI'm really not a big fan of all these local variables, here and in the\nprevious patches :-( Maybe creating helpers in the CIO2Device and\nImgUDevice classes would help.\n\n> +\tint ret;\n>  \n> -\tint ret = cio2->releaseBuffers();\n> -\tif (ret) {\n> -\t\tLOG(IPU3, Error) << \"Failed to release memory\";\n> -\t\treturn ret;\n> -\t}\n> +\tret = output->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU output memory\";\n\nmemory or buffers ? Same below.\n\nApart from that the patch looks good to me.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +\tret = stat->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU stat memory\";\n> +\n> +\tret = viewfinder->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU viewfinder memory\";\n> +\n> +\tret = input->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release ImgU input memory\";\n> +\n> +\tret = cio2->releaseBuffers();\n> +\tif (ret)\n> +\t\tLOG(IPU3, Error) << \"Failed to release CIO2 memory\";\n>  \n>  \treturn 0;\n>  }","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 74EF6600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Mar 2019 11:06:00 +0100 (CET)","from pendragon.ideasonboard.com (30.net042126252.t-com.ne.jp\n\t[42.126.252.30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2852623A;\n\tThu, 21 Mar 2019 11:05:58 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1553162760;\n\tbh=Yy0XdsfoHwt14ITBXVQBesx1z04dwxOpJtoOmM7LzqA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Xay5dBlE/IF83nBsV7fE6k/loquR2fzYEjh3YRnc3ZNh0fyYBwbFIaTChEVt6TQwX\n\tqV48vVOQYiXnb17UNng9p+09Ehh8K6M8nW7SSJXHkwsYoFB8yR/ME75M0eVP3wlxIw\n\t4U+XJfcjNVzBkjKRChLNuhDc79ZcwmD8grOQ8uiQ=","Date":"Thu, 21 Mar 2019 12:05:48 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190321100548.GM4615@pendragon.ideasonboard.com>","References":"<20190320163055.22056-1-jacopo@jmondi.org>\n\t<20190320163055.22056-11-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190320163055.22056-11-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 10/31] libcamera: ipu3: Implement\n\tbuffer release","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Thu, 21 Mar 2019 10:06:00 -0000"}}]