[{"id":25534,"web_url":"https://patchwork.libcamera.org/comment/25534/","msgid":"<20221024085400.GD3874866@pyrite.rasen.tech>","date":"2022-10-24T08:54:00","subject":"Re: [libcamera-devel] [PATCH v3 09/13] pipeline: rkisp1: Pass info\n\tpointer to tryCompleteRequest()","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"On Mon, Oct 24, 2022 at 03:03:52AM +0300, Laurent Pinchart wrote:\n> The tryCompleteRequest() function looks up the RkISP1FrameInfo that alls\n\ns/alls/all/\n\n> but one of its callers already look up. Remove the double look up by\n> passing the info pointer to tryCompleteRequest().\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 23 ++++++++++++++---------\n>  1 file changed, 14 insertions(+), 9 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 50da92d4d6f8..cca89cc13bff 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -168,7 +168,7 @@ private:\n>  \tint initLinks(Camera *camera, const CameraSensor *sensor,\n>  \t\t      const RkISP1CameraConfiguration &config);\n>  \tint createCamera(MediaEntity *sensor);\n> -\tvoid tryCompleteRequest(Request *request);\n> +\tvoid tryCompleteRequest(RkISP1FrameInfo *info);\n>  \tvoid bufferReady(FrameBuffer *buffer);\n>  \tvoid paramReady(FrameBuffer *buffer);\n>  \tvoid statReady(FrameBuffer *buffer);\n> @@ -391,7 +391,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);\n>  }\n>  \n>  RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera,\n> @@ -1123,12 +1123,10 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n>   * Buffer Handling\n>   */\n>  \n> -void PipelineHandlerRkISP1::tryCompleteRequest(Request *request)\n> +void PipelineHandlerRkISP1::tryCompleteRequest(RkISP1FrameInfo *info)\n>  {\n>  \tRkISP1CameraData *data = cameraData(activeCamera_);\n> -\tRkISP1FrameInfo *info = data->frameInfo_.find(request);\n> -\tif (!info)\n> -\t\treturn;\n> +\tRequest *request = info->request;\n>  \n>  \tif (request->hasPendingBuffers())\n>  \t\treturn;\n> @@ -1146,6 +1144,13 @@ void PipelineHandlerRkISP1::tryCompleteRequest(Request *request)\n>  \n>  void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer)\n>  {\n> +\tASSERT(activeCamera_);\n> +\tRkISP1CameraData *data = cameraData(activeCamera_);\n> +\n> +\tRkISP1FrameInfo *info = data->frameInfo_.find(buffer);\n> +\tif (!info)\n> +\t\treturn;\n> +\n>  \tRequest *request = buffer->request();\n>  \n>  \t/*\n> @@ -1158,7 +1163,7 @@ void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer)\n>  \t\t\t\tbuffer->metadata().timestamp);\n>  \n>  \tcompleteBuffer(request, buffer);\n> -\ttryCompleteRequest(request);\n> +\ttryCompleteRequest(info);\n>  }\n>  \n>  void PipelineHandlerRkISP1::paramReady(FrameBuffer *buffer)\n> @@ -1171,7 +1176,7 @@ void PipelineHandlerRkISP1::paramReady(FrameBuffer *buffer)\n>  \t\treturn;\n>  \n>  \tinfo->paramDequeued = true;\n> -\ttryCompleteRequest(info->request);\n> +\ttryCompleteRequest(info);\n>  }\n>  \n>  void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n> @@ -1185,7 +1190,7 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n>  \n>  \tif (buffer->metadata().status == FrameMetadata::FrameCancelled) {\n>  \t\tinfo->metadataProcessed = true;\n> -\t\ttryCompleteRequest(info->request);\n> +\t\ttryCompleteRequest(info);\n>  \t\treturn;\n>  \t}\n>  \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 6CC9FBDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Oct 2022 08:54:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F31C762EFE;\n\tMon, 24 Oct 2022 10:54:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D6F361F4D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Oct 2022 10:54:08 +0200 (CEST)","from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 722BA471;\n\tMon, 24 Oct 2022 10:54:06 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666601649;\n\tbh=zpJqJ6hKh4glIHeCDKzun6REQx7ZybccMsooiM62tEg=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=IczNneAX1oHovA31UuBjat9JF/tOkW85QYr77+a86vo6tLnOtBQSsn8YJVHpAMbwd\n\tWYrS3e+SpcPhijq4C9x6UR31M+L4qodRp2rt8bGq9C9PNXsGpSOpXGMOh3STgrZBDL\n\tD/PFNx9mf4Woc9wPi3aZFWTnM9tfwcIOloGPGzBsNMXvx45Ojmb7bAbuihwnhMmrBG\n\tjanVRPk5oYndQ0+TtxCsWd2O+cl1+aWSmV84RSmr25ZX3ATXYZgriS3S66ZiXXwftj\n\tpvm54RINLdbFEC2LKHsJlkfaQ2BWIPLciBXIuREKQFD5KLHmb+td6mpjrZyqWZ1MRU\n\tVjNLzQVrWTirA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1666601648;\n\tbh=zpJqJ6hKh4glIHeCDKzun6REQx7ZybccMsooiM62tEg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hpqr28LgOWDl/m9WsrRuRZxupfXLPB83wQV8gqW8Vm4K5YgNBUg3BNNil/ta2yBTO\n\tyKLarC1WolLVTjhWNJqqbG4R3rvdPynKBiFT0qVZhAjMDcKHSIUi0UBNC8JM+oOwgS\n\tUFCdxgwspaj3TthjrK6I3po/SRTIh/yeCk5NfF5k="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"hpqr28Lg\"; dkim-atps=neutral","Date":"Mon, 24 Oct 2022 17:54:00 +0900","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20221024085400.GD3874866@pyrite.rasen.tech>","References":"<20221024000356.29521-1-laurent.pinchart@ideasonboard.com>\n\t<20221024000356.29521-10-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20221024000356.29521-10-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 09/13] pipeline: rkisp1: Pass info\n\tpointer to tryCompleteRequest()","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":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"paul.elder@ideasonboard.com","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25605,"web_url":"https://patchwork.libcamera.org/comment/25605/","msgid":"<20221026152044.xo2ngy3m3lotq3x4@uno.localdomain>","date":"2022-10-26T15:20:44","subject":"Re: [libcamera-devel] [PATCH v3 09/13] pipeline: rkisp1: Pass info\n\tpointer to tryCompleteRequest()","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Mon, Oct 24, 2022 at 03:03:52AM +0300, Laurent Pinchart via libcamera-devel wrote:\n> The tryCompleteRequest() function looks up the RkISP1FrameInfo that alls\n> but one of its callers already look up. Remove the double look up by\n> passing the info pointer to tryCompleteRequest().\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 23 ++++++++++++++---------\n>  1 file changed, 14 insertions(+), 9 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 50da92d4d6f8..cca89cc13bff 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -168,7 +168,7 @@ private:\n>  \tint initLinks(Camera *camera, const CameraSensor *sensor,\n>  \t\t      const RkISP1CameraConfiguration &config);\n>  \tint createCamera(MediaEntity *sensor);\n> -\tvoid tryCompleteRequest(Request *request);\n> +\tvoid tryCompleteRequest(RkISP1FrameInfo *info);\n>  \tvoid bufferReady(FrameBuffer *buffer);\n>  \tvoid paramReady(FrameBuffer *buffer);\n>  \tvoid statReady(FrameBuffer *buffer);\n> @@ -391,7 +391,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);\n>  }\n>\n>  RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera,\n> @@ -1123,12 +1123,10 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n>   * Buffer Handling\n>   */\n>\n> -void PipelineHandlerRkISP1::tryCompleteRequest(Request *request)\n> +void PipelineHandlerRkISP1::tryCompleteRequest(RkISP1FrameInfo *info)\n>  {\n>  \tRkISP1CameraData *data = cameraData(activeCamera_);\n> -\tRkISP1FrameInfo *info = data->frameInfo_.find(request);\n> -\tif (!info)\n> -\t\treturn;\n> +\tRequest *request = info->request;\n>\n>  \tif (request->hasPendingBuffers())\n>  \t\treturn;\n> @@ -1146,6 +1144,13 @@ void PipelineHandlerRkISP1::tryCompleteRequest(Request *request)\n>\n>  void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer)\n>  {\n> +\tASSERT(activeCamera_);\n> +\tRkISP1CameraData *data = cameraData(activeCamera_);\n> +\n> +\tRkISP1FrameInfo *info = data->frameInfo_.find(buffer);\n> +\tif (!info)\n> +\t\treturn;\n> +\n>  \tRequest *request = buffer->request();\n>\n>  \t/*\n> @@ -1158,7 +1163,7 @@ void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer)\n>  \t\t\t\tbuffer->metadata().timestamp);\n>\n>  \tcompleteBuffer(request, buffer);\n> -\ttryCompleteRequest(request);\n> +\ttryCompleteRequest(info);\n>  }\n>\n>  void PipelineHandlerRkISP1::paramReady(FrameBuffer *buffer)\n> @@ -1171,7 +1176,7 @@ void PipelineHandlerRkISP1::paramReady(FrameBuffer *buffer)\n>  \t\treturn;\n>\n>  \tinfo->paramDequeued = true;\n> -\ttryCompleteRequest(info->request);\n> +\ttryCompleteRequest(info);\n>  }\n>\n>  void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n> @@ -1185,7 +1190,7 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n>\n>  \tif (buffer->metadata().status == FrameMetadata::FrameCancelled) {\n>  \t\tinfo->metadataProcessed = true;\n> -\t\ttryCompleteRequest(info->request);\n> +\t\ttryCompleteRequest(info);\n>  \t\treturn;\n>  \t}\n>\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 65D6EBDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Oct 2022 15:20:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D503962F5B;\n\tWed, 26 Oct 2022 17:20:48 +0200 (CEST)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0066461F4B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Oct 2022 17:20:46 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 7812E20003;\n\tWed, 26 Oct 2022 15:20:46 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1666797648;\n\tbh=LPfn3MMrlA0t/I4bg02f1Mi24t32FaGcT2FLb0bNA1g=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=rq/CyKUC7rCiRhECbECVP5eTCL67gtnGxbrwZjmB08nbGLdERfS1X6/DIXxIlU4aT\n\tacIcaShrL2bOTk93fS7nAKhytRRZAz/yCSjnlfjh3+vfJTR3heH2rMJiMi8kFAnF0c\n\tTm+mGm+B9ExPuOQkitZ9WtJwBT0hKX0xMzVmjwfSXlYzPB/XPEdfngX6CpAf7lYWjA\n\tQN7FxKsnMZjsGNdN4SSgtr528TxuqHoeErDnZaFvyvdXAvuFw95I8h1ur/TXxF09yN\n\tgYKpNOH0x4IkoQOx6QJgO7LwkCvx9G8acR8fwEkheByDIWyS8XxFwIba+tby2Ila2E\n\tQ9owSbEzr8WsQ==","Date":"Wed, 26 Oct 2022 17:20:44 +0200","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20221026152044.xo2ngy3m3lotq3x4@uno.localdomain>","References":"<20221024000356.29521-1-laurent.pinchart@ideasonboard.com>\n\t<20221024000356.29521-10-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20221024000356.29521-10-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 09/13] pipeline: rkisp1: Pass info\n\tpointer to tryCompleteRequest()","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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]