[{"id":2263,"web_url":"https://patchwork.libcamera.org/comment/2263/","msgid":"<20190714104743.GH31102@wyvern>","date":"2019-07-14T10:47:43","subject":"Re: [libcamera-devel] [PATCH v2 09/16] libcamera: Stop using\n\tStream::bufferPool to get the number of buffers","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2019-07-13 20:23:44 +0300, Laurent Pinchart wrote:\n> The cam and qcam applications, as well as the camera capture test case,\n> access the Stream::bufferPool in order to know how many requests to\n> initially queue. As part of an effort to remove access to the buffer\n> pool from applications, use the buffer count from the stream\n> configuration instead.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/cam/capture.cpp      | 6 ++----\n>  src/qcam/main_window.cpp | 3 +--\n>  test/camera/capture.cpp  | 3 +--\n>  3 files changed, 4 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp\n> index 1cf59063c93b..66ec1abaa5ac 100644\n> --- a/src/cam/capture.cpp\n> +++ b/src/cam/capture.cpp\n> @@ -74,10 +74,8 @@ int Capture::capture(EventLoop *loop)\n>  \n>  \t/* Identify the stream with the least number of buffers. */\n>  \tunsigned int nbuffers = UINT_MAX;\n> -\tfor (StreamConfiguration &cfg : *config_) {\n> -\t\tStream *stream = cfg.stream();\n> -\t\tnbuffers = std::min(nbuffers, stream->bufferPool().count());\n> -\t}\n> +\tfor (StreamConfiguration &cfg : *config_)\n> +\t\tnbuffers = std::min(nbuffers, cfg.bufferCount);\n>  \n>  \t/*\n>  \t * TODO: make cam tool smarter to support still capture by for\n> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> index 6ecf30e33bcf..7023e1158fb6 100644\n> --- a/src/qcam/main_window.cpp\n> +++ b/src/qcam/main_window.cpp\n> @@ -140,9 +140,8 @@ int MainWindow::startCapture()\n>  \t\treturn ret;\n>  \t}\n>  \n> -\tBufferPool &pool = stream->bufferPool();\n>  \tstd::vector<Request *> requests;\n> -\tfor (unsigned int i = 0; i < pool.count(); ++i) {\n> +\tfor (unsigned int i = 0; i < cfg.bufferCount; ++i) {\n>  \t\tRequest *request = camera_->createRequest();\n>  \t\tif (!request) {\n>  \t\t\tstd::cerr << \"Can't create request\" << std::endl;\n> diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp\n> index ff1cbd6cbac0..e6bf7a8d9ebb 100644\n> --- a/test/camera/capture.cpp\n> +++ b/test/camera/capture.cpp\n> @@ -80,9 +80,8 @@ protected:\n>  \t\t}\n>  \n>  \t\tStream *stream = cfg.stream();\n> -\t\tBufferPool &pool = stream->bufferPool();\n>  \t\tstd::vector<Request *> requests;\n> -\t\tfor (unsigned int i = 0; i < pool.count(); ++i) {\n> +\t\tfor (unsigned int i = 0; i < cfg.bufferCount; ++i) {\n>  \t\t\tRequest *request = camera_->createRequest();\n>  \t\t\tif (!request) {\n>  \t\t\t\tcout << \"Failed to create request\" << endl;\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-pl1-x641.google.com (mail-pl1-x641.google.com\n\t[IPv6:2607:f8b0:4864:20::641])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 39CF361572\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 14 Jul 2019 12:47:49 +0200 (CEST)","by mail-pl1-x641.google.com with SMTP id ay6so6878274plb.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 14 Jul 2019 03:47:49 -0700 (PDT)","from localhost (softbank126159224182.bbtec.net. [126.159.224.182])\n\tby smtp.gmail.com with ESMTPSA id\n\tl124sm14261750pgl.54.2019.07.14.03.47.46\n\t(version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);\n\tSun, 14 Jul 2019 03:47:47 -0700 (PDT)"],"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\t:user-agent; bh=3YNjotsm7b4nYUdFijCgWLtuTnW0bBpga/fFYtsAqVQ=;\n\tb=nqtsIv5knOKt0iavhTClGk+t+g1IvwWtqHKyxJ2FpSfyckb22OQUOwiSNs+nRYMW/M\n\tDdLBH2H1XXyzjWxhH+qi8z8JytjqnRRlGyTjOt2viGaR92wUSZGlF0UQDvAM0CAFQeMF\n\tPBtjUmTH4xPNhuX+MWD1r/47PrdAMS08X7/2ROea6A8a69boxcw4EepjxVrE378BVCqk\n\t3BvY0J17NhcD1OSf2TxVbb2LF25mOQYMRO61sfhrR7LbUYVl55C29Wug1UV3revU3CiR\n\tnxwq8bj7sPfYMnTY4jBzbarP+ViFSBUXnzW/SDksbulODaSjNjU/CNCzq8LfL9V1naPh\n\tNhMw==","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:user-agent;\n\tbh=3YNjotsm7b4nYUdFijCgWLtuTnW0bBpga/fFYtsAqVQ=;\n\tb=iL8fvnFU9CBaPPTcd1/vWx0VjE1GKFDzGbsaC8pLeadaLGCFnHse0bTqBLiM8YqQwj\n\telB8c6nIb0IqbTpVqGs4IGHgT751w8Nj+oN4w92R4xeT2csSML+yhL+Hmn/k77FI/Lrc\n\tH2GNkWt6kDxu8BSOpKQqdfl/P2B4V0GIYjTywidyaVqheHyqJ3ytMRgsKf3q6qZ1wK7E\n\t21e5Mokafx/A5ZUJSXb7BnoBN6ifnwRMUVo2zi3jJeJw2MqJhgXF4WgpYhhusmI/2iIm\n\tNUROIJZFKw201gnRNkFxgjKuAkV003qtyXp6AZ8NbqVktlX/h1VMDH3kt2THcAh78fBe\n\tUFtw==","X-Gm-Message-State":"APjAAAUwuaaLrQiXBr3xQin6huBMBhrJ+CSOciCHeLg582s52Uc4t5m9\n\tUxVzCFxFzt1y5/U6ssFwm4Y=","X-Google-Smtp-Source":"APXvYqzF8siV6jkZMqSZz35YWUlqhK+wPrQ+DebDSwZFpY5KdPXcSFrN1tYcUO/87E+lMsgN8z52Yg==","X-Received":"by 2002:a17:902:28:: with SMTP id\n\t37mr20595562pla.188.1563101268026; \n\tSun, 14 Jul 2019 03:47:48 -0700 (PDT)","Date":"Sun, 14 Jul 2019 19:47:43 +0900","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190714104743.GH31102@wyvern>","References":"<20190713172351.25452-1-laurent.pinchart@ideasonboard.com>\n\t<20190713172351.25452-10-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190713172351.25452-10-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 09/16] libcamera: Stop using\n\tStream::bufferPool to get the number of buffers","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":"Sun, 14 Jul 2019 10:47:49 -0000"}}]