[{"id":18726,"web_url":"https://patchwork.libcamera.org/comment/18726/","msgid":"<20210812075656.3eh5de3kbwj6owsw@uno.localdomain>","date":"2021-08-12T07:56:56","subject":"Re: [libcamera-devel] [PATCH v3 14/14] libcamera: pipeline: Cast to\n\tderived pipeline handler with helpers","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Thu, Aug 12, 2021 at 02:26:25AM +0300, Laurent Pinchart wrote:\n> Replace manual static casts from the PipelineHandler pointer to a\n> derived class pointer with helper functions in the camera data classes.\n> This simplifies code accessing the pipeline from the camera data.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThanks\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\n\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(-)\n>\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 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,\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 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> --\n> Regards,\n>\n> Laurent Pinchart\n>","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 954ABBD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 12 Aug 2021 07:56:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 14D366884D;\n\tThu, 12 Aug 2021 09:56:11 +0200 (CEST)","from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3CD1F60264\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Aug 2021 09:56:09 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B9FB34000C;\n\tThu, 12 Aug 2021 07:56:08 +0000 (UTC)"],"Date":"Thu, 12 Aug 2021 09:56:56 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20210812075656.3eh5de3kbwj6owsw@uno.localdomain>","References":"<20210811232625.17280-1-laurent.pinchart@ideasonboard.com>\n\t<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>","Subject":"Re: [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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18832,"web_url":"https://patchwork.libcamera.org/comment/18832/","msgid":"<c90a5b9e-7b0a-da37-7320-c4352901b5b6@ideasonboard.com>","date":"2021-08-16T12:20:21","subject":"Re: [libcamera-devel] [PATCH v3 14/14] libcamera: pipeline: Cast to\n\tderived pipeline handler with helpers","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 12/08/2021 00:26, Laurent Pinchart wrote:\n> Replace manual static casts from the PipelineHandler pointer to a\n> derived class pointer with helper functions in the camera data classes.\n> This simplifies code accessing the pipeline from the camera data.\n\nAnd helps reduce the number of places someone might do casting wrong, so\nI think that's a good idea, and cleaner code.\n\n\n> \n> Signed-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\nI assume the other pipelines are not affected by this ...\n\n\n\n>  2 files changed, 17 insertions(+), 13 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 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\n\nWhy the RkISP1CameraData:: prefix?\n\nIsn't this just pipe(); here?\n\nWe're in RkISP1CameraData::queueFrameAction() right ?\n\nWith that resolved,\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\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,\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 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>","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 B6FA6BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Aug 2021 12:20:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3BC6E68892;\n\tMon, 16 Aug 2021 14:20:26 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C50A568891\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Aug 2021 14:20:24 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 468523E5;\n\tMon, 16 Aug 2021 14:20:24 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YYyTjXEp\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1629116424;\n\tbh=gLE3pDqQij0845x+y4/pS7txdFTAOJ3CZsNaYqAbwR4=;\n\th=To:References:From:Subject:Date:In-Reply-To:From;\n\tb=YYyTjXEpImrxzQF+c5BCeUBYNp8jq2si5w7MZ00BPCyOlapinTGmWMYbmPDc1K78S\n\tsFk//jvMQlJa2JAYIkZxu61cx2SMwkHkgOMAzMhFUa4NRjb2kAMBPNzNlBhD7IOVel\n\tUKfitO/G+oCz9idlTq15vJPzBTj4HfF0ZIfK7pNQ=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210811232625.17280-1-laurent.pinchart@ideasonboard.com>\n\t<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<c90a5b9e-7b0a-da37-7320-c4352901b5b6@ideasonboard.com>","Date":"Mon, 16 Aug 2021 13:20:21 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [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>"}},{"id":18833,"web_url":"https://patchwork.libcamera.org/comment/18833/","msgid":"<YRpZeiQmclhTx0go@pendragon.ideasonboard.com>","date":"2021-08-16T12:26:34","subject":"Re: [libcamera-devel] [PATCH v3 14/14] libcamera: pipeline: Cast to\n\tderived pipeline handler with helpers","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Mon, Aug 16, 2021 at 01:20:21PM +0100, Kieran Bingham wrote:\n> On 12/08/2021 00:26, Laurent Pinchart wrote:\n> > Replace manual static casts from the PipelineHandler pointer to a\n> > derived class pointer with helper functions in the camera data classes.\n> > This simplifies code accessing the pipeline from the camera data.\n> \n> And helps reduce the number of places someone might do casting wrong, so\n> I think that's a good idea, and cleaner code.\n>\n> > \n> > Signed-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> \n> I assume the other pipelines are not affected by this ...\n\nCorrect, none of the other pipeline handler perform such casts at this\npoint.\n\n> >  2 files changed, 17 insertions(+), 13 deletions(-)\n> > \n> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > index 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> \n> \n> Why the RkISP1CameraData:: prefix?\n\nBecause an unqualified 'pipe' refers to the local variable, so\n\n\t\tPipelineHandlerRkISP1 *pipe = pipe();\n\nmakes the compiler complain that 'PipelineHandlerRkISP1 *' has no\noperator() defined. It doesn't resolve 'pipe' to the function, but the\nlocal variable.\n\n> Isn't this just pipe(); here?\n> \n> We're in RkISP1CameraData::queueFrameAction() right ?\n> \n> With that resolved,\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> \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,\n> > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> > index 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","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 A0BA2BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Aug 2021 12:26:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 119D668895;\n\tMon, 16 Aug 2021 14:26:42 +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 CA3616025D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Aug 2021 14:26:40 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3E0C03E5;\n\tMon, 16 Aug 2021 14:26:40 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nF/XyhBb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1629116800;\n\tbh=JiVNY21n2Wx8X+KDDgV38IateRsq6vzkGPjk16F93YE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nF/XyhBb/VPz1ihdLOs3WOodM1YazF/4dMrjTbCo2J+JavgMRy6O25a2PYRYZPjzk\n\tUw6/CwhpFQBDhp7oo/6M4kSPrc5tNXvXQ7McJ/tXxNkBWxU3EeHL/bNvE8vu+PQ37S\n\tbm5z6gH9y7xwAHD3mTKCLo1biCZ054vA1lpbU+zg=","Date":"Mon, 16 Aug 2021 15:26:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YRpZeiQmclhTx0go@pendragon.ideasonboard.com>","References":"<20210811232625.17280-1-laurent.pinchart@ideasonboard.com>\n\t<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>\n\t<c90a5b9e-7b0a-da37-7320-c4352901b5b6@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<c90a5b9e-7b0a-da37-7320-c4352901b5b6@ideasonboard.com>","Subject":"Re: [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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18834,"web_url":"https://patchwork.libcamera.org/comment/18834/","msgid":"<4024dfcd-59f9-6abe-7299-56e69602b1c5@ideasonboard.com>","date":"2021-08-16T12:30:36","subject":"Re: [libcamera-devel] [PATCH v3 14/14] libcamera: pipeline: Cast to\n\tderived pipeline handler with helpers","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 16/08/2021 13:26, Laurent Pinchart wrote:\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>>\n>>\n>> Why the RkISP1CameraData:: prefix?\n> \n> Because an unqualified 'pipe' refers to the local variable, so\n> \n> \t\tPipelineHandlerRkISP1 *pipe = pipe();\n> \n> makes the compiler complain that 'PipelineHandlerRkISP1 *' has no\n> operator() defined. It doesn't resolve 'pipe' to the function, but the\n> local variable.\n\nBut is the local variable needed?\n\nYou could change the two lines :\n\n \t\tpipe->param_->queueBuffer(info->paramBuffer);\n \t\tpipe->stat_->queueBuffer(info->statBuffer);\n\nto\n \t\tpipe()->param_->queueBuffer(info->paramBuffer);\n \t\tpipe()->stat_->queueBuffer(info->statBuffer);\n\n\nWhich would match the usage everywhere else...\n\n\nAnyway, it's a valid construct as you have it - it just looked out of place.\n\nTag still holds however you decide to do this.\n\n\n> \n>> Isn't this just pipe(); here?\n>>\n>> We're in RkISP1CameraData::queueFrameAction() right ?\n>>\n>> With that resolved,\n>>\n>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>","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 A1025BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Aug 2021 12:30:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F37A868894;\n\tMon, 16 Aug 2021 14:30:41 +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 740926025D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Aug 2021 14:30:40 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ED7743E5;\n\tMon, 16 Aug 2021 14:30:39 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"NyTD0s91\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1629117040;\n\tbh=2OzGawmfFoUiaQ7wl5esg7ZJCoU4ujYdZIlr+k1/Wr4=;\n\th=From:Subject:To:Cc:References:Date:In-Reply-To:From;\n\tb=NyTD0s91zOc9jt+GYi2SO5VmslBWHSHGG1bn6Ko84EViJpvpYESWR7umUR+rDIQyJ\n\tRtKYs+75QIdFSXxnvPFdZ4i8XXafCFFibTzNtClczgos3yUoaUWqCgecZUNEgrtn5m\n\tMwRz9ByaEDEV7L+SSiowiUHfB+Lr01tRjYD6p+sI=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20210811232625.17280-1-laurent.pinchart@ideasonboard.com>\n\t<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>\n\t<c90a5b9e-7b0a-da37-7320-c4352901b5b6@ideasonboard.com>\n\t<YRpZeiQmclhTx0go@pendragon.ideasonboard.com>","Message-ID":"<4024dfcd-59f9-6abe-7299-56e69602b1c5@ideasonboard.com>","Date":"Mon, 16 Aug 2021 13:30:36 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<YRpZeiQmclhTx0go@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18835,"web_url":"https://patchwork.libcamera.org/comment/18835/","msgid":"<YRpgLBfQDgWrX7Rg@pendragon.ideasonboard.com>","date":"2021-08-16T12:55:08","subject":"Re: [libcamera-devel] [PATCH v3 14/14] libcamera: pipeline: Cast to\n\tderived pipeline handler with helpers","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Mon, Aug 16, 2021 at 01:30:36PM +0100, Kieran Bingham wrote:\n> On 16/08/2021 13:26, Laurent Pinchart wrote:\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> >>\n> >>\n> >> Why the RkISP1CameraData:: prefix?\n> > \n> > Because an unqualified 'pipe' refers to the local variable, so\n> > \n> > \t\tPipelineHandlerRkISP1 *pipe = pipe();\n> > \n> > makes the compiler complain that 'PipelineHandlerRkISP1 *' has no\n> > operator() defined. It doesn't resolve 'pipe' to the function, but the\n> > local variable.\n> \n> But is the local variable needed?\n> \n> You could change the two lines :\n> \n>  \t\tpipe->param_->queueBuffer(info->paramBuffer);\n>  \t\tpipe->stat_->queueBuffer(info->statBuffer);\n> \n> to\n>  \t\tpipe()->param_->queueBuffer(info->paramBuffer);\n>  \t\tpipe()->stat_->queueBuffer(info->statBuffer);\n> \n> \n> Which would match the usage everywhere else...\n\nYes indeed. I overall tried to use a local variable when pipe() would be\ncalled multiple times, but got lazy in a few places I suppose. I haven't\nremoved existing variables, and was actually thinking about adding more\nin the few places where I haven't yet :-)\n\n> Anyway, it's a valid construct as you have it - it just looked out of place.\n> \n> Tag still holds however you decide to do this.\n> \n> >> Isn't this just pipe(); here?\n> >>\n> >> We're in RkISP1CameraData::queueFrameAction() right ?\n> >>\n> >> With that resolved,\n> >>\n> >> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>","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 4670EBD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Aug 2021 12:55:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 94C4868893;\n\tMon, 16 Aug 2021 14:55:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 251E66025D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Aug 2021 14:55:14 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AE6F83E5;\n\tMon, 16 Aug 2021 14:55:13 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Ohi74iaK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1629118513;\n\tbh=o7RwmrhANltiNAvN5UlGv3btWGYgmDXAQZdetjVH91c=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Ohi74iaK8CJC55d3o+W8TWrvk1Mjk/FjB9DZu5LmX+8XYw+lgAkTfObh7ljDtmDSa\n\tMteICi+5rEj+JO/hxEtbp0a3O0msniiqHFIJpLLstNmi+no/e2AEhX0sZEUOLUrsT/\n\tB8saEJ0XfNh6rH4odR4XHkUdQXJpn+0Ko4vrWNzk=","Date":"Mon, 16 Aug 2021 15:55:08 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YRpgLBfQDgWrX7Rg@pendragon.ideasonboard.com>","References":"<20210811232625.17280-1-laurent.pinchart@ideasonboard.com>\n\t<20210811232625.17280-15-laurent.pinchart@ideasonboard.com>\n\t<c90a5b9e-7b0a-da37-7320-c4352901b5b6@ideasonboard.com>\n\t<YRpZeiQmclhTx0go@pendragon.ideasonboard.com>\n\t<4024dfcd-59f9-6abe-7299-56e69602b1c5@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<4024dfcd-59f9-6abe-7299-56e69602b1c5@ideasonboard.com>","Subject":"Re: [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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]