[{"id":32066,"web_url":"https://patchwork.libcamera.org/comment/32066/","msgid":"<Zyz1S+IyqSyUHIOq@linux.intel.com>","date":"2024-11-07T17:13:47","subject":"Re: [PATCH v6 1/3] libcamera: pipeline_handler: Provide\n\tcancelRequest","submitter":{"id":211,"url":"https://patchwork.libcamera.org/api/people/211/","name":"Stanislaw Gruszka","email":"stanislaw.gruszka@linux.intel.com"},"content":"On Wed, Nov 06, 2024 at 09:17:19PM +0100, Milan Zamazal wrote:\n> Let's extract the two occurrences of canceling a request to a common\n> helper.  This is especially useful for the followup patch, which needs\n> to cancel a request from outside.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> Reviewed-by: Hans de Goede <hdegoede@redhat.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nTested-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>\n\n>  include/libcamera/internal/pipeline_handler.h |  1 +\n>  src/libcamera/pipeline_handler.cpp            | 23 +++++++++++++------\n>  2 files changed, 17 insertions(+), 7 deletions(-)\n> \n> diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\n> index 0d3808036..fb28a18d0 100644\n> --- a/include/libcamera/internal/pipeline_handler.h\n> +++ b/include/libcamera/internal/pipeline_handler.h\n> @@ -60,6 +60,7 @@ public:\n>  \n>  \tbool completeBuffer(Request *request, FrameBuffer *buffer);\n>  \tvoid completeRequest(Request *request);\n> +\tvoid cancelRequest(Request *request);\n>  \n>  \tstd::string configurationFile(const std::string &subdir,\n>  \t\t\t\t      const std::string &name) const;\n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index e59404691..4905863c4 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -367,9 +367,7 @@ void PipelineHandler::stop(Camera *camera)\n>  \twhile (!waitingRequests_.empty()) {\n>  \t\tRequest *request = waitingRequests_.front();\n>  \t\twaitingRequests_.pop();\n> -\n> -\t\trequest->_d()->cancel();\n> -\t\tcompleteRequest(request);\n> +\t\tcancelRequest(request);\n>  \t}\n>  \n>  \t/* Make sure no requests are pending. */\n> @@ -470,10 +468,8 @@ void PipelineHandler::doQueueRequest(Request *request)\n>  \t}\n>  \n>  \tint ret = queueRequestDevice(camera, request);\n> -\tif (ret) {\n> -\t\trequest->_d()->cancel();\n> -\t\tcompleteRequest(request);\n> -\t}\n> +\tif (ret)\n> +\t\tcancelRequest(request);\n>  }\n>  \n>  /**\n> @@ -568,6 +564,19 @@ void PipelineHandler::completeRequest(Request *request)\n>  \t}\n>  }\n>  \n> +/**\n> + * \\brief Cancel request and signal its completion\n> + * \\param[in] request The request to cancel\n> + *\n> + * This function cancels and completes the request. The same rules as for\n> + * completeRequest() apply.\n> + */\n> +void PipelineHandler::cancelRequest(Request *request)\n> +{\n> +\trequest->_d()->cancel();\n> +\tcompleteRequest(request);\n> +}\n> +\n>  /**\n>   * \\brief Retrieve the absolute path to a platform configuration file\n>   * \\param[in] subdir The pipeline handler specific subdirectory name\n> -- \n> 2.44.1\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 4BB02C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  7 Nov 2024 17:13:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6507A6547A;\n\tThu,  7 Nov 2024 18:13:56 +0100 (CET)","from mgamail.intel.com (mgamail.intel.com [192.198.163.17])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BB60265474\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  7 Nov 2024 18:13:53 +0100 (CET)","from fmviesa003.fm.intel.com ([10.60.135.143])\n\tby fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n\t07 Nov 2024 09:13:52 -0800","from sgruszka-mobl.ger.corp.intel.com (HELO localhost)\n\t([10.246.8.237]) by fmviesa003-auth.fm.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2024 09:13:50 -0800"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"j/feGWa2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1730999634; x=1762535634;\n\th=date:from:to:cc:subject:message-id:references:\n\tmime-version:in-reply-to;\n\tbh=7dn91rXwxMxiiUJl2gh8JXBJF0uxdPOMvDIgzoXW2Dw=;\n\tb=j/feGWa2EmHsOhN1yQ/8nr77d3/0Tk7jqOLaFhEBw3+dB6TgFciA8cY7\n\tQJhjuSTz9affwTVr4en5Wf49Wof/0P/4/uM3JBJEo9Ey/qbShYjqXib3d\n\tgzkcKi3vQcXYJ9wa7faZJn3B8vR6QnjdPLfI8jkBh6A07L5WBuf8KLQHY\n\tODEmWaVYjV55fX0/Xefuor/7fSvK/u5hkFuWImEx91MGW7Ri9drboq5Y+\n\tawAHYl+oRx6PQwc436L1Rxqru43QsQKygg3FM5k5pGJyTtygGdDQA0rdV\n\tT+k/r+99KJ/b3yz34mVU66BxrTYHpVf54EvkD8yZKfChTmt1nwBN66HCg Q==;","X-CSE-ConnectionGUID":["Ege4eh57QlWndl/9RPoBcQ==","gRb5zPrLSQaP7B08zw/XeQ=="],"X-CSE-MsgGUID":["PUMwlEqzSHOmvsRToZRqaQ==","B/Jz5AJrQ0SZk7cUIKwAog=="],"X-IronPort-AV":["E=McAfee;i=\"6700,10204,11249\"; a=\"30744916\"","E=Sophos;i=\"6.12,135,1728975600\"; d=\"scan'208\";a=\"30744916\"","E=Sophos;i=\"6.12,135,1728975600\"; d=\"scan'208\";a=\"89113048\""],"X-ExtLoop1":"1","Date":"Thu, 7 Nov 2024 18:13:47 +0100","From":"Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org, robert.mader@posteo.de,\n\tkieran.bingham@ideasonboard.com, laurent.pinchart@ideasonboard.com,\n\thdegoede@redhat.com","Subject":"Re: [PATCH v6 1/3] libcamera: pipeline_handler: Provide\n\tcancelRequest","Message-ID":"<Zyz1S+IyqSyUHIOq@linux.intel.com>","References":"<20241106201721.1624461-1-mzamazal@redhat.com>\n\t<20241106201721.1624461-2-mzamazal@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20241106201721.1624461-2-mzamazal@redhat.com>","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>"}}]