Patch Detail
Show a patch.
GET /api/1.1/patches/9167/?format=api
{ "id": 9167, "url": "https://patchwork.libcamera.org/api/1.1/patches/9167/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9167/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200804095850.275499-3-naush@raspberrypi.com>", "date": "2020-08-04T09:58:40", "name": "[libcamera-devel,v6,02/12] libcamera: pipeline: ipa: raspberrypi: Rework drop frame signalling", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "a6189547834e2d5c7cf55a53f11f17bdfbf3ecb7", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9167/mbox/", "series": [ { "id": 1187, "url": "https://patchwork.libcamera.org/api/1.1/series/1187/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1187", "date": "2020-08-04T09:58:38", "name": "Zero-copy RAW stream work", "version": 6, "mbox": "https://patchwork.libcamera.org/series/1187/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9167/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9167/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 64BA3BD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 4 Aug 2020 09:59:00 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AEC3260543;\n\tTue, 4 Aug 2020 11:58:59 +0200 (CEST)", "from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A00B6042B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 4 Aug 2020 11:58:58 +0200 (CEST)", "by mail-wm1-x32f.google.com with SMTP id 184so2300472wmb.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 04 Aug 2020 02:58:58 -0700 (PDT)", "from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\t32sm34047234wrh.18.2020.08.04.02.58.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 04 Aug 2020 02:58:56 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"GGScWJet\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=T6gOmPnyM8lbTRfP3cyq3DCmCB/koQWeu23FNz57wTQ=;\n\tb=GGScWJetbBN6UkxNm7X8tYm3UO5uDT8BcoZBi1nKHieP5/60tV2LGH7V+f/8fsn9Lc\n\tDC8uzumPRagfem1RpZscWqARLblRIeDULygJO6d8bv+ybGxP+Yu/FAKaz19riZV2LIb6\n\tKrMEhFc6O4GjtzNHQgnvT6LwZCw/KLGwWUxocNcdxWjk47VMwuGhf6ympqU9GOSJN81m\n\triiH9lFaPKqoni9WRbix1/2e+bdz29bKvgYrdflmtgk5GiNUTzoqyXEMXpjs3xLBWKeo\n\twK+LJkhsnQ9UHgWs9zfVz8NskMTPM5w/VeZTBBZSHhYjdyfsb/8iK0qctv2D5RIi7PII\n\trHsw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=T6gOmPnyM8lbTRfP3cyq3DCmCB/koQWeu23FNz57wTQ=;\n\tb=Y4r+XzwZDjpd+VOmaE8rEhHCzDK2/7s5vmr9Jfw1w6DoF3UmEEbYb0tcLavzODEO0K\n\txcRxGQMY0ILOZ1MeaxjulIjA9B0jaRvPLeXtuZCAxmLEQL+Y8Q4KCuLxCLPQWBcaZUVH\n\t7+vuIDR9vdf1IgXS9a05MCrvZvj6EPqGB9AH1hbUy+3aXJL6k17jbwa5jxvkPySHf7lz\n\tzw2uQjSkT9VG7qrSXm43UejFeCUleLzs0C8sjf3BN2z/UWoy+D4UoHuvZDp5Aovra3bJ\n\tsBmjm7jdDN4fDrc74IR2WoFb8Go4YsOxBE3zHTuYry+PVSNRnGY8LCUUnSY582XYnMAr\n\tyY9A==", "X-Gm-Message-State": "AOAM531Sap/obbNEU7t0Ci5+4t+aSfM+AjgfIYEy4hcFNlPWQ1xjWOKP\n\ttV8wbK4cPPHqdoOwhuQzXLviSNDCyI2Y7w==", "X-Google-Smtp-Source": "ABdhPJxrvhLT+NdnQp8sJrhehysZXlX8poT18uS3lq1D2XLEK6PJZtPN53mwqkjpAn4b2hP0MTCFBA==", "X-Received": "by 2002:a05:600c:2209:: with SMTP id\n\tz9mr3260562wml.70.1596535137630; \n\tTue, 04 Aug 2020 02:58:57 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 4 Aug 2020 10:58:40 +0100", "Message-Id": "<20200804095850.275499-3-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20200804095850.275499-1-naush@raspberrypi.com>", "References": "<20200804095850.275499-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v6 02/12] libcamera: pipeline: ipa:\n\traspberrypi: Rework drop frame signalling", "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>", "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>" }, "content": "The IPA now signals up front how many frames it wants the pipeline\nhandler to drop. This makes it easier to handle up-coming changes to the\nbuffer handling for import/export buffers.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nTested-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.h | 2 +-\n src/ipa/raspberrypi/raspberrypi.cpp | 20 +++++------\n .../pipeline/raspberrypi/raspberrypi.cpp | 36 +++++++++++--------\n 3 files changed, 33 insertions(+), 25 deletions(-)", "diff": "diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex ca62990e..262fc6f3 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -14,6 +14,7 @@ enum RPiConfigParameters {\n \tRPI_IPA_CONFIG_LS_TABLE = (1 << 0),\n \tRPI_IPA_CONFIG_STAGGERED_WRITE = (1 << 1),\n \tRPI_IPA_CONFIG_SENSOR = (1 << 2),\n+\tRPI_IPA_CONFIG_DROP_FRAMES = (1 << 3),\n };\n \n enum RPiOperations {\n@@ -21,7 +22,6 @@ enum RPiOperations {\n \tRPI_IPA_ACTION_V4L2_SET_ISP,\n \tRPI_IPA_ACTION_STATS_METADATA_COMPLETE,\n \tRPI_IPA_ACTION_RUN_ISP,\n-\tRPI_IPA_ACTION_RUN_ISP_AND_DROP_FRAME,\n \tRPI_IPA_ACTION_EMBEDDED_COMPLETE,\n \tRPI_IPA_EVENT_SIGNAL_STAT_READY,\n \tRPI_IPA_EVENT_SIGNAL_ISP_PREPARE,\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 37472087..cd49de80 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -65,8 +65,8 @@ class IPARPi : public IPAInterface\n public:\n \tIPARPi()\n \t\t: lastMode_({}), controller_(), controllerInit_(false),\n-\t\t frame_count_(0), check_count_(0), hide_count_(0),\n-\t\t mistrust_count_(0), lsTable_(nullptr)\n+\t\t frame_count_(0), check_count_(0), mistrust_count_(0),\n+\t\t lsTable_(nullptr)\n \t{\n \t}\n \n@@ -137,8 +137,6 @@ private:\n \tuint64_t frame_count_;\n \t/* For checking the sequencing of Prepare/Process calls. */\n \tuint64_t check_count_;\n-\t/* How many frames the pipeline handler should hide, or \"drop\". */\n-\tunsigned int hide_count_;\n \t/* How many frames we should avoid running control algos on. */\n \tunsigned int mistrust_count_;\n \t/* LS table allocation passed in from the pipeline handler. */\n@@ -242,14 +240,18 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t */\n \tframe_count_ = 0;\n \tcheck_count_ = 0;\n+\tunsigned int drop_frame = 0;\n \tif (controllerInit_) {\n-\t\thide_count_ = helper_->HideFramesModeSwitch();\n+\t\tdrop_frame = helper_->HideFramesModeSwitch();\n \t\tmistrust_count_ = helper_->MistrustFramesModeSwitch();\n \t} else {\n-\t\thide_count_ = helper_->HideFramesStartup();\n+\t\tdrop_frame = helper_->HideFramesStartup();\n \t\tmistrust_count_ = helper_->MistrustFramesStartup();\n \t}\n \n+\tresult->data.push_back(drop_frame);\n+\tresult->operation |= RPI_IPA_CONFIG_DROP_FRAMES;\n+\n \tstruct AgcStatus agcStatus;\n \t/* These zero values mean not program anything (unless overwritten). */\n \tagcStatus.shutter_time = 0.0;\n@@ -366,13 +368,11 @@ void IPARPi::processEvent(const IPAOperationData &event)\n \t\t * they are \"unreliable\".\n \t\t */\n \t\tprepareISP(embeddedbufferId);\n+\t\tframe_count_++;\n \n \t\t/* Ready to push the input buffer into the ISP. */\n \t\tIPAOperationData op;\n-\t\tif (++frame_count_ > hide_count_)\n-\t\t\top.operation = RPI_IPA_ACTION_RUN_ISP;\n-\t\telse\n-\t\t\top.operation = RPI_IPA_ACTION_RUN_ISP_AND_DROP_FRAME;\n+\t\top.operation = RPI_IPA_ACTION_RUN_ISP;\n \t\top.data = { bayerbufferId & RPiIpaMask::ID };\n \t\tqueueFrameAction.emit(0, op);\n \t\tbreak;\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 90331ede..8fb9df72 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -132,7 +132,7 @@ class RPiCameraData : public CameraData\n public:\n \tRPiCameraData(PipelineHandler *pipe)\n \t\t: CameraData(pipe), sensor_(nullptr), state_(State::Stopped),\n-\t\t dropFrame_(false), ispOutputCount_(0)\n+\t\t dropFrameCount_(0), ispOutputCount_(0)\n \t{\n \t}\n \n@@ -180,14 +180,15 @@ public:\n \tstd::queue<FrameBuffer *> embeddedQueue_;\n \tstd::deque<Request *> requestQueue_;\n \n+\tunsigned int dropFrameCount_;\n+\n private:\n \tvoid checkRequestCompleted();\n \tvoid tryRunPipeline();\n \tvoid tryFlushQueues();\n \tFrameBuffer *updateQueue(std::queue<FrameBuffer *> &q, uint64_t timestamp, V4L2VideoDevice *dev);\n \n-\tbool dropFrame_;\n-\tint ispOutputCount_;\n+\tunsigned int ispOutputCount_;\n };\n \n class RPiCameraConfiguration : public CameraConfiguration\n@@ -998,6 +999,7 @@ int RPiCameraData::configureIPA()\n \tipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,\n \t\t\t&result);\n \n+\tunsigned int resultIdx = 0;\n \tif (result.operation & RPI_IPA_CONFIG_STAGGERED_WRITE) {\n \t\t/*\n \t\t * Setup our staggered control writer with the sensor default\n@@ -1005,9 +1007,9 @@ int RPiCameraData::configureIPA()\n \t\t */\n \t\tif (!staggeredCtrl_) {\n \t\t\tstaggeredCtrl_.init(unicam_[Unicam::Image].dev(),\n-\t\t\t\t\t { { V4L2_CID_ANALOGUE_GAIN, result.data[0] },\n-\t\t\t\t\t { V4L2_CID_EXPOSURE, result.data[1] } });\n-\t\t\tsensorMetadata_ = result.data[2];\n+\t\t\t\t\t { { V4L2_CID_ANALOGUE_GAIN, result.data[resultIdx++] },\n+\t\t\t\t\t { V4L2_CID_EXPOSURE, result.data[resultIdx++] } });\n+\t\t\tsensorMetadata_ = result.data[resultIdx++];\n \t\t}\n \n \t\t/* Configure the H/V flip controls based on the sensor rotation. */\n@@ -1024,6 +1026,11 @@ int RPiCameraData::configureIPA()\n \t\t\tLOG(RPI, Error) << \"V4L2 staggered set failed\";\n \t}\n \n+\tif (result.operation & RPI_IPA_CONFIG_DROP_FRAMES) {\n+\t\t/* Configure the number of dropped frames required on startup. */\n+\t\tdropFrameCount_ = result.data[resultIdx++];\n+\t}\n+\n \treturn 0;\n }\n \n@@ -1074,7 +1081,6 @@ void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData\n \t\tbreak;\n \t}\n \n-\tcase RPI_IPA_ACTION_RUN_ISP_AND_DROP_FRAME:\n \tcase RPI_IPA_ACTION_RUN_ISP: {\n \t\tunsigned int bufferId = action.data[0];\n \t\tFrameBuffer *buffer = unicam_[Unicam::Image].getBuffers()->at(bufferId).get();\n@@ -1083,7 +1089,6 @@ void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData\n \t\t\t\t<< \", timestamp: \" << buffer->metadata().timestamp;\n \n \t\tisp_[Isp::Input].dev()->queueBuffer(buffer);\n-\t\tdropFrame_ = (action.operation == RPI_IPA_ACTION_RUN_ISP_AND_DROP_FRAME) ? true : false;\n \t\tispOutputCount_ = 0;\n \t\tbreak;\n \t}\n@@ -1249,7 +1254,7 @@ void RPiCameraData::clearIncompleteRequests()\n void RPiCameraData::handleStreamBuffer(FrameBuffer *buffer, const RPi::RPiStream *stream)\n {\n \tif (stream->isExternal()) {\n-\t\tif (!dropFrame_) {\n+\t\tif (!dropFrameCount_) {\n \t\t\tRequest *request = buffer->request();\n \t\t\tpipe_->completeBuffer(camera_, request, buffer);\n \t\t}\n@@ -1261,7 +1266,7 @@ void RPiCameraData::handleStreamBuffer(FrameBuffer *buffer, const RPi::RPiStream\n \t\t * simply memcpy to the Request buffer and requeue back to the\n \t\t * device.\n \t\t */\n-\t\tif (stream == &unicam_[Unicam::Image] && !dropFrame_) {\n+\t\tif (stream == &unicam_[Unicam::Image] && !dropFrameCount_) {\n \t\t\tconst Stream *rawStream = static_cast<const Stream *>(&isp_[Isp::Input]);\n \t\t\tRequest *request = requestQueue_.front();\n \t\t\tFrameBuffer *raw = request->findBuffer(const_cast<Stream *>(rawStream));\n@@ -1306,7 +1311,7 @@ void RPiCameraData::checkRequestCompleted()\n \t * If we are dropping this frame, do not touch the request, simply\n \t * change the state to IDLE when ready.\n \t */\n-\tif (!dropFrame_) {\n+\tif (!dropFrameCount_) {\n \t\tRequest *request = requestQueue_.front();\n \t\tif (request->hasPendingBuffers())\n \t\t\treturn;\n@@ -1325,10 +1330,13 @@ void RPiCameraData::checkRequestCompleted()\n \t * frame.\n \t */\n \tif (state_ == State::IpaComplete &&\n-\t ((ispOutputCount_ == 3 && dropFrame_) || requestCompleted)) {\n+\t ((ispOutputCount_ == 3 && dropFrameCount_) || requestCompleted)) {\n \t\tstate_ = State::Idle;\n-\t\tif (dropFrame_)\n-\t\t\tLOG(RPI, Info) << \"Dropping frame at the request of the IPA\";\n+\t\tif (dropFrameCount_) {\n+\t\t\tdropFrameCount_--;\n+\t\t\tLOG(RPI, Info) << \"Dropping frame at the request of the IPA (\"\n+\t\t\t\t << dropFrameCount_ << \" left)\";\n+\t\t}\n \t}\n }\n \n", "prefixes": [ "libcamera-devel", "v6", "02/12" ] }