[{"id":4023,"web_url":"https://patchwork.libcamera.org/comment/4023/","msgid":"<20200316132711.GB2260535@oden.dyn.berto.se>","date":"2020-03-16T13:27:11","subject":"Re: [libcamera-devel] [PATCH 2/9] libcamera: v4l2_videodevice:\n\tRename exportBuffers() to allocateBuffers()","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 work.\n\nOn 2020-03-15 01:57:21 +0200, Laurent Pinchart wrote:\n> To prepare for the rework of buffer allocation that will differentiate\n> export and allocation, rename exportBuffers() to allocateBuffers().\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/libcamera/include/v4l2_videodevice.h  |  4 ++--\n>  src/libcamera/pipeline/ipu3/ipu3.cpp      | 12 ++++++------\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp  |  6 +++---\n>  src/libcamera/pipeline/uvcvideo.cpp       |  2 +-\n>  src/libcamera/pipeline/vimc.cpp           |  2 +-\n>  src/libcamera/v4l2_videodevice.cpp        |  4 ++--\n>  test/libtest/buffer_source.cpp            |  4 ++--\n>  test/v4l2_videodevice/buffer_sharing.cpp  |  2 +-\n>  test/v4l2_videodevice/capture_async.cpp   |  6 ++++--\n>  test/v4l2_videodevice/request_buffers.cpp |  2 +-\n>  test/v4l2_videodevice/stream_on_off.cpp   |  2 +-\n>  test/v4l2_videodevice/v4l2_m2mdevice.cpp  |  8 ++++----\n>  12 files changed, 28 insertions(+), 26 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\n> index b2e12608084a..893d28c7db88 100644\n> --- a/src/libcamera/include/v4l2_videodevice.h\n> +++ b/src/libcamera/include/v4l2_videodevice.h\n> @@ -191,8 +191,8 @@ public:\n>  \tint setCrop(Rectangle *rect);\n>  \tint setCompose(Rectangle *rect);\n>  \n> -\tint exportBuffers(unsigned int count,\n> -\t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n> +\tint allocateBuffers(unsigned int count,\n> +\t\t\t    std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n>  \tint importBuffers(unsigned int count);\n>  \tint releaseBuffers();\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 387bb070b505..10a2698bad09 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -622,7 +622,7 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n>  \tV4L2VideoDevice *video = ipu3stream->device_->dev;\n>  \tunsigned int count = stream->configuration().bufferCount;\n>  \n> -\treturn video->exportBuffers(count, buffers);\n> +\treturn video->allocateBuffers(count, buffers);\n>  }\n>  \n>  int PipelineHandlerIPU3::importFrameBuffers(Camera *camera, Stream *stream)\n> @@ -678,7 +678,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n>  \t * the input pool.\n>  \t * \\todo To be revised when we'll actually use the stat node.\n>  \t */\n> -\tret = imgu->stat_.dev->exportBuffers(bufferCount, &imgu->stat_.buffers);\n> +\tret = imgu->stat_.dev->allocateBuffers(bufferCount, &imgu->stat_.buffers);\n>  \tif (ret < 0) {\n>  \t\tLOG(IPU3, Error) << \"Failed to allocate ImgU stat buffers\";\n>  \t\tgoto error;\n> @@ -691,7 +691,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n>  \tif (!outStream->active_) {\n>  \t\tImgUDevice::ImgUOutput *output = outStream->device_;\n>  \n> -\t\tret = output->dev->exportBuffers(bufferCount, &output->buffers);\n> +\t\tret = output->dev->allocateBuffers(bufferCount, &output->buffers);\n>  \t\tif (ret < 0) {\n>  \t\t\tLOG(IPU3, Error) << \"Failed to allocate ImgU \"\n>  \t\t\t\t\t << output->name << \" buffers\";\n> @@ -702,7 +702,7 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n>  \tif (!vfStream->active_) {\n>  \t\tImgUDevice::ImgUOutput *output = vfStream->device_;\n>  \n> -\t\tret = output->dev->exportBuffers(bufferCount, &output->buffers);\n> +\t\tret = output->dev->allocateBuffers(bufferCount, &output->buffers);\n>  \t\tif (ret < 0) {\n>  \t\t\tLOG(IPU3, Error) << \"Failed to allocate ImgU \"\n>  \t\t\t\t\t << output->name << \" buffers\";\n> @@ -1423,9 +1423,9 @@ int CIO2Device::configure(const Size &size,\n>   */\n>  int CIO2Device::allocateBuffers()\n>  {\n> -\tint ret = output_->exportBuffers(CIO2_BUFFER_COUNT, &buffers_);\n> +\tint ret = output_->allocateBuffers(CIO2_BUFFER_COUNT, &buffers_);\n>  \tif (ret < 0)\n> -\t\tLOG(IPU3, Error) << \"Failed to export CIO2 buffers\";\n> +\t\tLOG(IPU3, Error) << \"Failed to allocate CIO2 buffers\";\n>  \n>  \treturn ret;\n>  }\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 13433b216747..f6934324c5a3 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -665,7 +665,7 @@ int PipelineHandlerRkISP1::exportFrameBuffers(Camera *camera, Stream *stream,\n>  \t\t\t\t\t      std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n>  {\n>  \tunsigned int count = stream->configuration().bufferCount;\n> -\treturn video_->exportBuffers(count, buffers);\n> +\treturn video_->allocateBuffers(count, buffers);\n>  }\n>  \n>  int PipelineHandlerRkISP1::importFrameBuffers(Camera *camera, Stream *stream)\n> @@ -689,11 +689,11 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n>  \tfor (const Stream *s : camera->streams())\n>  \t\tmaxBuffers = std::max(maxBuffers, s->configuration().bufferCount);\n>  \n> -\tret = param_->exportBuffers(maxBuffers, &paramBuffers_);\n> +\tret = param_->allocateBuffers(maxBuffers, &paramBuffers_);\n>  \tif (ret < 0)\n>  \t\tgoto error;\n>  \n> -\tret = stat_->exportBuffers(maxBuffers, &statBuffers_);\n> +\tret = stat_->allocateBuffers(maxBuffers, &statBuffers_);\n>  \tif (ret < 0)\n>  \t\tgoto error;\n>  \n> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\n> index 29afb121aa46..d81627c224ea 100644\n> --- a/src/libcamera/pipeline/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo.cpp\n> @@ -199,7 +199,7 @@ int PipelineHandlerUVC::exportFrameBuffers(Camera *camera, Stream *stream,\n>  \tUVCCameraData *data = cameraData(camera);\n>  \tunsigned int count = stream->configuration().bufferCount;\n>  \n> -\treturn data->video_->exportBuffers(count, buffers);\n> +\treturn data->video_->allocateBuffers(count, buffers);\n>  }\n>  \n>  int PipelineHandlerUVC::importFrameBuffers(Camera *camera, Stream *stream)\n> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\n> index 5d3d12fef30b..bb94ef7fd38d 100644\n> --- a/src/libcamera/pipeline/vimc.cpp\n> +++ b/src/libcamera/pipeline/vimc.cpp\n> @@ -265,7 +265,7 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream,\n>  \tVimcCameraData *data = cameraData(camera);\n>  \tunsigned int count = stream->configuration().bufferCount;\n>  \n> -\treturn data->video_->exportBuffers(count, buffers);\n> +\treturn data->video_->allocateBuffers(count, buffers);\n>  }\n>  \n>  int PipelineHandlerVimc::importFrameBuffers(Camera *camera, Stream *stream)\n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index f89bf2ff781e..aea7a4ea3a23 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -1049,8 +1049,8 @@ int V4L2VideoDevice::requestBuffers(unsigned int count)\n>   * \\return The number of allocated buffers on success or a negative error code\n>   * otherwise\n>   */\n> -int V4L2VideoDevice::exportBuffers(unsigned int count,\n> -\t\t\t\t   std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n> +int V4L2VideoDevice::allocateBuffers(unsigned int count,\n> +\t\t\t\t     std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n>  {\n>  \tif (cache_) {\n>  \t\tLOG(V4L2, Error) << \"Buffers already allocated\";\n> diff --git a/test/libtest/buffer_source.cpp b/test/libtest/buffer_source.cpp\n> index 0c33200b47ad..26d2764d5f8f 100644\n> --- a/test/libtest/buffer_source.cpp\n> +++ b/test/libtest/buffer_source.cpp\n> @@ -76,8 +76,8 @@ int BufferSource::allocate(const StreamConfiguration &config)\n>  \t\treturn TestFail;\n>  \t}\n>  \n> -\tif (video->exportBuffers(config.bufferCount, &buffers_) < 0) {\n> -\t\tstd::cout << \"Failed to export buffers\" << std::endl;\n> +\tif (video->allocateBuffers(config.bufferCount, &buffers_) < 0) {\n> +\t\tstd::cout << \"Failed to allocate buffers\" << std::endl;\n>  \t\treturn TestFail;\n>  \t}\n>  \n> diff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp\n> index fefa969a5f39..14d3055ad7d1 100644\n> --- a/test/v4l2_videodevice/buffer_sharing.cpp\n> +++ b/test/v4l2_videodevice/buffer_sharing.cpp\n> @@ -73,7 +73,7 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>  \n> -\t\tret = capture_->exportBuffers(bufferCount, &buffers_);\n> +\t\tret = capture_->allocateBuffers(bufferCount, &buffers_);\n>  \t\tif (ret < 0) {\n>  \t\t\tstd::cout << \"Failed to allocate buffers\" << std::endl;\n>  \t\t\treturn TestFail;\n> diff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp\n> index 6a103a035f3d..b38aabc6263d 100644\n> --- a/test/v4l2_videodevice/capture_async.cpp\n> +++ b/test/v4l2_videodevice/capture_async.cpp\n> @@ -38,9 +38,11 @@ protected:\n>  \t\tTimer timeout;\n>  \t\tint ret;\n>  \n> -\t\tret = capture_->exportBuffers(bufferCount, &buffers_);\n> -\t\tif (ret < 0)\n> +\t\tret = capture_->allocateBuffers(bufferCount, &buffers_);\n> +\t\tif (ret < 0) {\n> +\t\t\tstd::cout << \"Failed to allocate buffers\" << std::endl;\n>  \t\t\treturn TestFail;\n> +\t\t}\n>  \n>  \t\tcapture_->bufferReady.connect(this, &CaptureAsyncTest::receiveBuffer);\n>  \n> diff --git a/test/v4l2_videodevice/request_buffers.cpp b/test/v4l2_videodevice/request_buffers.cpp\n> index 1dd65b05da43..2f8dfe1cafb1 100644\n> --- a/test/v4l2_videodevice/request_buffers.cpp\n> +++ b/test/v4l2_videodevice/request_buffers.cpp\n> @@ -18,7 +18,7 @@ protected:\n>  \t{\n>  \t\tconst unsigned int bufferCount = 8;\n>  \n> -\t\tint ret = capture_->exportBuffers(bufferCount, &buffers_);\n> +\t\tint ret = capture_->allocateBuffers(bufferCount, &buffers_);\n>  \t\tif (ret != bufferCount)\n>  \t\t\treturn TestFail;\n>  \n> diff --git a/test/v4l2_videodevice/stream_on_off.cpp b/test/v4l2_videodevice/stream_on_off.cpp\n> index 552df0963633..ce48310aa2b7 100644\n> --- a/test/v4l2_videodevice/stream_on_off.cpp\n> +++ b/test/v4l2_videodevice/stream_on_off.cpp\n> @@ -17,7 +17,7 @@ protected:\n>  \t{\n>  \t\tconst unsigned int bufferCount = 8;\n>  \n> -\t\tint ret = capture_->exportBuffers(bufferCount, &buffers_);\n> +\t\tint ret = capture_->allocateBuffers(bufferCount, &buffers_);\n>  \t\tif (ret < 0)\n>  \t\t\treturn TestFail;\n>  \n> diff --git a/test/v4l2_videodevice/v4l2_m2mdevice.cpp b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> index 203afc4fc033..d20e5dfc3077 100644\n> --- a/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> +++ b/test/v4l2_videodevice/v4l2_m2mdevice.cpp\n> @@ -112,15 +112,15 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>  \n> -\t\tret = capture->exportBuffers(bufferCount, &captureBuffers_);\n> +\t\tret = capture->allocateBuffers(bufferCount, &captureBuffers_);\n>  \t\tif (ret < 0) {\n> -\t\t\tcerr << \"Failed to export Capture Buffers\" << endl;\n> +\t\t\tcerr << \"Failed to allocate Capture Buffers\" << endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\n>  \n> -\t\tret = output->exportBuffers(bufferCount, &outputBuffers_);\n> +\t\tret = output->allocateBuffers(bufferCount, &outputBuffers_);\n>  \t\tif (ret < 0) {\n> -\t\t\tcerr << \"Failed to export Output Buffers\" << endl;\n> +\t\t\tcerr << \"Failed to allocate Output Buffers\" << endl;\n>  \t\t\treturn TestFail;\n>  \t\t}\n>  \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-lj1-x22b.google.com (mail-lj1-x22b.google.com\n\t[IPv6:2a00:1450:4864:20::22b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B70C6041A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Mar 2020 14:27:13 +0100 (CET)","by mail-lj1-x22b.google.com with SMTP id r7so18628540ljp.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Mar 2020 06:27:13 -0700 (PDT)","from localhost (h-200-138.A463.priv.bahnhof.se. [176.10.200.138])\n\tby smtp.gmail.com with ESMTPSA id\n\tt12sm2530987ljc.69.2020.03.16.06.27.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 16 Mar 2020 06:27:11 -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\tbh=thq4AtrWM5o+RwNxJ2R2WoEBxprsWfjsom2Kb/CdcVg=;\n\tb=licECJJwx04E4BBtp7VoyHJTvqdQl9NgcgS6TnZi4HG38XLPlD+huhy2vs1vxTw8zL\n\thStxht39pZ8w8EQK1gkik8SAMQwes9EkHtuCOXwSjxgZ1NJEmwGCCq5PZj0hjC+OGBUC\n\tcUeVl4jhkJTMi8WsOID8iUgevhNcr/VY3p6n/KTvenzxGEH26uVbgMA/BgQ0PF0XyMlZ\n\t4Aajrcfhrc6UghuWGUy+hKuttHsBZBWDFxZUp+JJWbGO02kfmPIQaJ5lrlwlz0ZdWfnB\n\t9LUfxvw64kaifqP3ZglxyFOq0A6G/DWHoRKI68CbrdROE6RWQKToWJS3qd9U+rBprrJX\n\tjhVw==","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=thq4AtrWM5o+RwNxJ2R2WoEBxprsWfjsom2Kb/CdcVg=;\n\tb=h6B9TKEEzcNRq2vEvyB9aA8DIKrj+icdLzEgrOSRTAoRwr7/nsm1ImvCARCJO0fczm\n\t2Os9s29MrOiuqpsAFKjTC373EpNO0jfoLquw1KBdkus6KJ/+8EEby4vrKIxEa2wqY2n0\n\t3vFdX7J/1umSIbigg8t7MzUYDKyyFZWjmHc/tt9kaV2gBVpAtHA+jZ6NiEKJ6zIIBt49\n\tml7kDLzSfkiA3g0GlBVavUahGjDgtFPUH0iw7igzoReLZxnccRZvzVpQE5PwqvUhSogY\n\tJ6HSZqLc4esgWy2UlarE+8byOgTUgWuR30lBt4hncHZEXEBHohw5gBPyV45IsZsukonU\n\tnrRQ==","X-Gm-Message-State":"ANhLgQ1tgUNTBb3NYuqwaYbWuE8CibIylUadE5xdoCuvAGMeSsKG2zOl\n\tedEKKWu6ml+hdlTCFp+WfWU0rQ==","X-Google-Smtp-Source":"ADFU+vvkos4nYhigE0KYc0iak161tyvWu03Mwzg9EnYVnUaJszqXCOdnSyoRS+DTN7Hgft3VMe7suw==","X-Received":"by 2002:a2e:a58c:: with SMTP id\n\tm12mr14957656ljp.141.1584365232327; \n\tMon, 16 Mar 2020 06:27:12 -0700 (PDT)","Date":"Mon, 16 Mar 2020 14:27:11 +0100","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":"<20200316132711.GB2260535@oden.dyn.berto.se>","References":"<20200314235728.15495-1-laurent.pinchart@ideasonboard.com>\n\t<20200314235728.15495-3-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":"<20200314235728.15495-3-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 2/9] libcamera: v4l2_videodevice:\n\tRename exportBuffers() to allocateBuffers()","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>","X-List-Received-Date":"Mon, 16 Mar 2020 13:27:13 -0000"}}]