Patch Detail
Show a patch.
GET /api/patches/13322/?format=api
{ "id": 13322, "url": "https://patchwork.libcamera.org/api/patches/13322/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13322/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>", "date": "2021-08-11T23:26:25", "name": "[libcamera-devel,v3,14/14] libcamera: pipeline: Cast to derived pipeline handler with helpers", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "92fcc7d5345196b10a08b2ed2b0d600e7e6bf045", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13322/mbox/", "series": [ { "id": 2341, "url": "https://patchwork.libcamera.org/api/series/2341/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2341", "date": "2021-08-11T23:26:11", "name": "libcamera: Replace CameraData with Camera::Private", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2341/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13322/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13322/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 3FF56C3249\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Aug 2021 23:26:47 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D668468889;\n\tThu, 12 Aug 2021 01:26:46 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 89EED6884D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Aug 2021 01:26:37 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 33092268\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Aug 2021 01:26:37 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SOXsT760\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628724397;\n\tbh=v4l0TfJGrIWZzQA8je2kLRBPT8RmYSVNN/nSfIdhqVY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=SOXsT760cMtgZnMCSW70WmNk5hpABy5xOeJOxUeLMxADpx25tiFe4+v1TnsuTBeF4\n\tCqTVuRlOgdcfiunqZ8Jm7ZpHq/WfSn10xTLAvZWr1EicSlzZI4s04DGCTq2g+im+HH\n\td32Wcw1RdwH+3c9P6y4kqTB+zOYqLz/8vt6uj93Q=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 12 Aug 2021 02:26:25 +0300", "Message-Id": "<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210811232625.17280-1-laurent.pinchart@ideasonboard.com>", "References": "<20210811232625.17280-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 14/14] libcamera: pipeline: Cast to\n\tderived pipeline handler with helpers", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Replace manual static casts from the PipelineHandler pointer to a\nderived class pointer with helper functions in the camera data classes.\nThis simplifies code accessing the pipeline from the camera data.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 14 ++++++++------\n src/libcamera/pipeline/simple/simple.cpp | 16 +++++++++-------\n 2 files changed, 17 insertions(+), 13 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 3c37a8ccad8f..2dbd6304acce 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -87,6 +87,7 @@ public:\n \t{\n \t}\n \n+\tPipelineHandlerRkISP1 *pipe();\n \tint loadIPA(unsigned int hwRevision);\n \n \tStream mainPathStream_;\n@@ -304,6 +305,11 @@ RkISP1FrameInfo *RkISP1Frames::find(Request *request)\n \treturn nullptr;\n }\n \n+PipelineHandlerRkISP1 *RkISP1CameraData::pipe()\n+{\n+\treturn static_cast<PipelineHandlerRkISP1 *>(Camera::Private::pipe());\n+}\n+\n int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n {\n \tipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe(), 1, 1);\n@@ -332,8 +338,7 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,\n \t\tbreak;\n \t}\n \tcase ipa::rkisp1::ActionParamFilled: {\n-\t\tPipelineHandlerRkISP1 *pipe =\n-\t\t\tstatic_cast<PipelineHandlerRkISP1 *>(this->pipe());\n+\t\tPipelineHandlerRkISP1 *pipe = RkISP1CameraData::pipe();\n \t\tRkISP1FrameInfo *info = frameInfo_.find(frame);\n \t\tif (!info)\n \t\t\tbreak;\n@@ -360,9 +365,6 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,\n \n void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)\n {\n-\tPipelineHandlerRkISP1 *pipe =\n-\t\tstatic_cast<PipelineHandlerRkISP1 *>(this->pipe());\n-\n \tRkISP1FrameInfo *info = frameInfo_.find(frame);\n \tif (!info)\n \t\treturn;\n@@ -370,7 +372,7 @@ void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &meta\n \tinfo->request->metadata().merge(metadata);\n \tinfo->metadataProcessed = true;\n \n-\tpipe->tryCompleteRequest(info->request);\n+\tpipe()->tryCompleteRequest(info->request);\n }\n \n RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera,\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex ef7687eaf502..8ff954722fed 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -155,6 +155,7 @@ public:\n \t\t\t MediaEntity *sensor);\n \n \tbool isValid() const { return sensor_ != nullptr; }\n+\tSimplePipelineHandler *pipe();\n \n \tint init();\n \tint setupLinks();\n@@ -352,11 +353,14 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n \t\t\t [](const Entity &e) { return e.entity->name(); });\n }\n \n+SimplePipelineHandler *SimpleCameraData::pipe()\n+{\n+\treturn static_cast<SimplePipelineHandler *>(Camera::Private::pipe());\n+}\n+\n int SimpleCameraData::init()\n {\n-\tSimplePipelineHandler *pipe =\n-\t\tstatic_cast<SimplePipelineHandler *>(this->pipe());\n-\tSimpleConverter *converter = pipe->converter();\n+\tSimpleConverter *converter = pipe()->converter();\n \tint ret;\n \n \t/*\n@@ -480,8 +484,7 @@ int SimpleCameraData::setupLinks()\n int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,\n \t\t\t\t V4L2Subdevice::Whence whence)\n {\n-\tSimplePipelineHandler *pipe =\n-\t\tstatic_cast<SimplePipelineHandler *>(this->pipe());\n+\tSimplePipelineHandler *pipe = SimpleCameraData::pipe();\n \tint ret;\n \n \t/*\n@@ -582,8 +585,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \t}\n \n \t/* Adjust the requested streams. */\n-\tSimplePipelineHandler *pipe = static_cast<SimplePipelineHandler *>(data_->pipe());\n-\tSimpleConverter *converter = pipe->converter();\n+\tSimpleConverter *converter = data_->pipe()->converter();\n \n \t/*\n \t * Enable usage of the converter when producing multiple streams, as\n", "prefixes": [ "libcamera-devel", "v3", "14/14" ] }