{"id":19326,"url":"https://patchwork.libcamera.org/api/patches/19326/?format=json","web_url":"https://patchwork.libcamera.org/patch/19326/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20231214121350.206015-11-hdegoede@redhat.com>","date":"2023-12-14T12:13:48","name":"[libcamera-devel,10/11] libcamera: pipeline: simple: rename converterBuffers_ and related vars","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"16642e803066030722896c4032f4efe90926f50a","submitter":{"id":102,"url":"https://patchwork.libcamera.org/api/people/102/?format=json","name":"Hans de Goede","email":"hdegoede@redhat.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19326/mbox/","series":[{"id":4117,"url":"https://patchwork.libcamera.org/api/series/4117/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4117","date":"2023-12-14T12:13:38","name":"libcamera: introduce Software ISP and Software IPA","version":1,"mbox":"https://patchwork.libcamera.org/series/4117/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19326/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19326/checks/","tags":{},"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 ABABEBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 14 Dec 2023 12:14:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 60B2A62B5F;\n\tThu, 14 Dec 2023 13:14:17 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EEEFC62B5D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Dec 2023 13:14:15 +0100 (CET)","from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n\t[66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-267-bF7tcZpMNT29YZBrCLEZFw-1; Thu, 14 Dec 2023 07:14:09 -0500","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82AC7848C05;\n\tThu, 14 Dec 2023 12:14:07 +0000 (UTC)","from shalem.redhat.com (unknown [10.39.194.72])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 3DDE41121306;\n\tThu, 14 Dec 2023 12:14:06 +0000 (UTC)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1702556057;\n\tbh=l7oD6HIdD77CYGU9uuEocqLbyGC1rf8xx7342r8ozsM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=XZnTP6NeshGUitGKMwg7Dt+O8jH7U0t4I7AyOEGGShKIYsXn/83vaAOZxbFOvEmG/\n\tkQCw+cMA6/J20DENh3v1z6x2aZi/3hTj8Vik42xiebJL+Z06sfah08qzHt1A3I4GHJ\n\toSlrDT3CcWZ4Sm5hU8YYsbwjAcHBTfdJirLBWRlvtYjBLIpthXSwvvVjQHDu5oUs75\n\t7MNqVh19NMskqfjUh/86n2SH0G18IRhoi6SfKvLo/V/+YPas4Guh4b7N8D4nDuKfrq\n\tfsx0aVkxCMZGYZA43wSfx/i+oimZiNTB3RUhtTJfmW5i1wnoWPG1W1HGlTqA/C33R4\n\tLfM0xyv/se7rA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1702556054;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=qbyoho+qdUjOZkq+8rBesVoLNysW7/9t9VBb4248djw=;\n\tb=M99ztEoMEOpZ26xgA91UHTB0qBLc3TGzjqymfqxuAg3SRq5TykSrr628cLdZpbGy7g6MPo\n\tjkKo4jq2vrQT7W06XQNUvQTuO/zGHpekJ+QSHHD55mlJUnSbsvoBBmnLK2P+iDifQBi2W5\n\tojz1Qp7haqpCLV8N4tvOsdCwkyhwsIw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=redhat.com\n\theader.i=@redhat.com header.b=\"M99ztEoM\"; \n\tdkim-atps=neutral","X-MC-Unique":"bF7tcZpMNT29YZBrCLEZFw-1","To":"libcamera-devel@lists.libcamera.org,\n\tAndrey Konovalov <andrey.konovalov@linaro.org>","Date":"Thu, 14 Dec 2023 13:13:48 +0100","Message-ID":"<20231214121350.206015-11-hdegoede@redhat.com>","In-Reply-To":"<20231214121350.206015-1-hdegoede@redhat.com>","References":"<20231214121350.206015-1-hdegoede@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.11.54.3","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain; charset=\"US-ASCII\"; x-default=true","Subject":"[libcamera-devel] [PATCH 10/11] libcamera: pipeline: simple: rename\n\tconverterBuffers_ and related vars","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>","From":"Hans de Goede via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Hans de Goede <hdegoede@redhat.com>","Cc":"Maxime Ripard <mripard@redhat.com>, g.martti@gmail.com,\n\tt.langendam@gmail.com, srinivas.kandagatla@linaro.org,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>, admin@dennisbonke.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Andrey Konovalov <andrey.konovalov@linaro.org>\n\nThe converterBuffers_ and the converterQueue_ are not that specific\nto the Converter, and could be used by another entity doing the format\nconversion.\n\nRename converterBuffers_, converterQueue_, and useConverter_ to\nconversionBuffers_, conversionQueue_ and useConversion_ to\ndisassociate them from the Converter.\n\nSigned-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n---\n src/libcamera/pipeline/simple/simple.cpp | 63 ++++++++++++------------\n 1 file changed, 32 insertions(+), 31 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 911051b2..878794f6 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -269,17 +269,18 @@ public:\n \tstd::vector<Configuration> configs_;\n \tstd::map<PixelFormat, std::vector<const Configuration *>> formats_;\n \n+\tstd::vector<std::unique_ptr<FrameBuffer>> conversionBuffers_;\n+\tstd::queue<std::map<unsigned int, FrameBuffer *>> conversionQueue_;\n+\tbool useConversion_;\n+\n \tstd::unique_ptr<Converter> converter_;\n-\tstd::vector<std::unique_ptr<FrameBuffer>> converterBuffers_;\n-\tbool useConverter_;\n-\tstd::queue<std::map<unsigned int, FrameBuffer *>> converterQueue_;\n \n private:\n \tvoid tryPipeline(unsigned int code, const Size &size);\n \tstatic std::vector<const MediaPad *> routedSourcePads(MediaPad *sink);\n \n-\tvoid converterInputDone(FrameBuffer *buffer);\n-\tvoid converterOutputDone(FrameBuffer *buffer);\n+\tvoid conversionInputDone(FrameBuffer *buffer);\n+\tvoid conversionOutputDone(FrameBuffer *buffer);\n };\n \n class SimpleCameraConfiguration : public CameraConfiguration\n@@ -503,8 +504,8 @@ int SimpleCameraData::init()\n \t\t\t\t<< \"Failed to create converter, disabling format conversion\";\n \t\t\tconverter_.reset();\n \t\t} else {\n-\t\t\tconverter_->inputBufferReady.connect(this, &SimpleCameraData::converterInputDone);\n-\t\t\tconverter_->outputBufferReady.connect(this, &SimpleCameraData::converterOutputDone);\n+\t\t\tconverter_->inputBufferReady.connect(this, &SimpleCameraData::conversionInputDone);\n+\t\t\tconverter_->outputBufferReady.connect(this, &SimpleCameraData::conversionOutputDone);\n \t\t}\n \t}\n \n@@ -740,7 +741,7 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)\n \t * point converting an erroneous buffer.\n \t */\n \tif (buffer->metadata().status != FrameMetadata::FrameSuccess) {\n-\t\tif (!useConverter_) {\n+\t\tif (!useConversion_) {\n \t\t\t/* No conversion, just complete the request. */\n \t\t\tRequest *request = buffer->request();\n \t\t\tpipe->completeBuffer(request, buffer);\n@@ -756,16 +757,16 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)\n \t\tif (buffer->metadata().status != FrameMetadata::FrameCancelled)\n \t\t\tvideo_->queueBuffer(buffer);\n \n-\t\tif (converterQueue_.empty())\n+\t\tif (conversionQueue_.empty())\n \t\t\treturn;\n \n \t\tRequest *request = nullptr;\n-\t\tfor (auto &item : converterQueue_.front()) {\n+\t\tfor (auto &item : conversionQueue_.front()) {\n \t\t\tFrameBuffer *outputBuffer = item.second;\n \t\t\trequest = outputBuffer->request();\n \t\t\tpipe->completeBuffer(request, outputBuffer);\n \t\t}\n-\t\tconverterQueue_.pop();\n+\t\tconversionQueue_.pop();\n \n \t\tif (request)\n \t\t\tpipe->completeRequest(request);\n@@ -782,9 +783,9 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)\n \t */\n \tRequest *request = buffer->request();\n \n-\tif (useConverter_ && !converterQueue_.empty()) {\n+\tif (useConversion_ && !conversionQueue_.empty()) {\n \t\tconst std::map<unsigned int, FrameBuffer *> &outputs =\n-\t\t\tconverterQueue_.front();\n+\t\t\tconversionQueue_.front();\n \t\tif (!outputs.empty()) {\n \t\t\tFrameBuffer *outputBuffer = outputs.begin()->second;\n \t\t\tif (outputBuffer)\n@@ -801,14 +802,14 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)\n \t * conversion is needed. If there's no queued request, just requeue the\n \t * captured buffer for capture.\n \t */\n-\tif (useConverter_) {\n-\t\tif (converterQueue_.empty()) {\n+\tif (useConversion_) {\n+\t\tif (conversionQueue_.empty()) {\n \t\t\tvideo_->queueBuffer(buffer);\n \t\t\treturn;\n \t\t}\n \n-\t\tconverter_->queueBuffers(buffer, converterQueue_.front());\n-\t\tconverterQueue_.pop();\n+\t\tconverter_->queueBuffers(buffer, conversionQueue_.front());\n+\t\tconversionQueue_.pop();\n \t\treturn;\n \t}\n \n@@ -817,13 +818,13 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)\n \tpipe->completeRequest(request);\n }\n \n-void SimpleCameraData::converterInputDone(FrameBuffer *buffer)\n+void SimpleCameraData::conversionInputDone(FrameBuffer *buffer)\n {\n \t/* Queue the input buffer back for capture. */\n \tvideo_->queueBuffer(buffer);\n }\n \n-void SimpleCameraData::converterOutputDone(FrameBuffer *buffer)\n+void SimpleCameraData::conversionOutputDone(FrameBuffer *buffer)\n {\n \tSimplePipelineHandler *pipe = SimpleCameraData::pipe();\n \n@@ -1156,14 +1157,14 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \n \t/* Configure the converter if needed. */\n \tstd::vector<std::reference_wrapper<StreamConfiguration>> outputCfgs;\n-\tdata->useConverter_ = config->needConversion();\n+\tdata->useConversion_ = config->needConversion();\n \n \tfor (unsigned int i = 0; i < config->size(); ++i) {\n \t\tStreamConfiguration &cfg = config->at(i);\n \n \t\tcfg.setStream(&data->streams_[i]);\n \n-\t\tif (data->useConverter_)\n+\t\tif (data->useConversion_)\n \t\t\toutputCfgs.push_back(cfg);\n \t}\n \n@@ -1189,7 +1190,7 @@ int SimplePipelineHandler::exportFrameBuffers(Camera *camera, Stream *stream,\n \t * Export buffers on the converter or capture video node, depending on\n \t * whether the converter is used or not.\n \t */\n-\tif (data->useConverter_)\n+\tif (data->useConversion_)\n \t\treturn data->converter_->exportBuffers(data->streamIndex(stream),\n \t\t\t\t\t\t       count, buffers);\n \telse\n@@ -1210,13 +1211,13 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\treturn -EBUSY;\n \t}\n \n-\tif (data->useConverter_) {\n+\tif (data->useConversion_) {\n \t\t/*\n \t\t * When using the converter allocate a fixed number of internal\n \t\t * buffers.\n \t\t */\n \t\tret = video->allocateBuffers(kNumInternalBuffers,\n-\t\t\t\t\t     &data->converterBuffers_);\n+\t\t\t\t\t     &data->conversionBuffers_);\n \t} else {\n \t\t/* Otherwise, prepare for using buffers from the only stream. */\n \t\tStream *stream = &data->streams_[0];\n@@ -1235,7 +1236,7 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\treturn ret;\n \t}\n \n-\tif (data->useConverter_) {\n+\tif (data->useConversion_) {\n \t\tret = data->converter_->start();\n \t\tif (ret < 0) {\n \t\t\tstop(camera);\n@@ -1243,7 +1244,7 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\t}\n \n \t\t/* Queue all internal buffers for capture. */\n-\t\tfor (std::unique_ptr<FrameBuffer> &buffer : data->converterBuffers_)\n+\t\tfor (std::unique_ptr<FrameBuffer> &buffer : data->conversionBuffers_)\n \t\t\tvideo->queueBuffer(buffer.get());\n \t}\n \n@@ -1255,7 +1256,7 @@ void SimplePipelineHandler::stopDevice(Camera *camera)\n \tSimpleCameraData *data = cameraData(camera);\n \tV4L2VideoDevice *video = data->video_;\n \n-\tif (data->useConverter_)\n+\tif (data->useConversion_)\n \t\tdata->converter_->stop();\n \n \tvideo->streamOff();\n@@ -1263,7 +1264,7 @@ void SimplePipelineHandler::stopDevice(Camera *camera)\n \n \tvideo->bufferReady.disconnect(data, &SimpleCameraData::bufferReady);\n \n-\tdata->converterBuffers_.clear();\n+\tdata->conversionBuffers_.clear();\n \n \treleasePipeline(data);\n }\n@@ -1281,7 +1282,7 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)\n \t\t * queue, it will be handed to the converter in the capture\n \t\t * completion handler.\n \t\t */\n-\t\tif (data->useConverter_) {\n+\t\tif (data->useConversion_) {\n \t\t\tbuffers.emplace(data->streamIndex(stream), buffer);\n \t\t} else {\n \t\t\tret = data->video_->queueBuffer(buffer);\n@@ -1290,8 +1291,8 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)\n \t\t}\n \t}\n \n-\tif (data->useConverter_)\n-\t\tdata->converterQueue_.push(std::move(buffers));\n+\tif (data->useConversion_)\n+\t\tdata->conversionQueue_.push(std::move(buffers));\n \n \treturn 0;\n }\n","prefixes":["libcamera-devel","10/11"]}