[{"id":2604,"web_url":"https://patchwork.libcamera.org/comment/2604/","msgid":"<20190904183437.GH5433@pendragon.ideasonboard.com>","date":"2019-09-04T18:34:37","subject":"Re: [libcamera-devel] [PATCH v2 08/14] libcamera: request: Add\n\tRequestData","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Fri, Aug 30, 2019 at 01:26:47AM +0200, Niklas Söderlund wrote:\n> Add a RequestData pointer to the Request class, this is intended to be\n> used by pipeline handlers while handling the request and is invalid\n> outside the pipeline handler context.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  include/libcamera/request.h |  5 +++++\n>  src/libcamera/request.cpp   | 10 +++++++++-\n>  2 files changed, 14 insertions(+), 1 deletion(-)\n> \n> diff --git a/include/libcamera/request.h b/include/libcamera/request.h\n> index 9edf1cedc054014f..570924c5ef5e2425 100644\n> --- a/include/libcamera/request.h\n> +++ b/include/libcamera/request.h\n> @@ -21,6 +21,9 @@ class Buffer;\n>  class Camera;\n>  class Stream;\n>  \n> +class RequestData\n> +{\n> +};\n\nA forward declaration is enough here, let's not expose this class to\napplications.\n\n>  \n>  class Request\n>  {\n> @@ -46,6 +49,8 @@ public:\n>  \n>  \tbool hasPendingBuffers() const { return !pending_.empty(); }\n>  \n> +\tRequestData *data;\n\nAs a public member ? No way :-)\n\nThis will create issues to access the data pointer from pipeline\nhandlers though, so I wonder if you wouldn't let pipeline handlers\nsubclass Request instead, given that all requests are created by\nCamera::createRequest() that could easily be forwarded to pipeline\nhandlers (with a default implementation in the base PipelineHandler\nclass that creates a Request). Bonus points if you can make the Request\nconstructor private.\n\nFeel free to propose an alternative scheme if you think that the Request\nclass should be final.\n\n> +\n>  private:\n>  \tfriend class Camera;\n>  \tfriend class PipelineHandler;\n> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\n> index ee2158fc7a9cf0b9..b8b4dfb4b7549163 100644\n> --- a/src/libcamera/request.cpp\n> +++ b/src/libcamera/request.cpp\n> @@ -55,7 +55,7 @@ LOG_DEFINE_CATEGORY(Request)\n>   *\n>   */\n>  Request::Request(Camera *camera, uint64_t cookie)\n> -\t: camera_(camera), controls_(camera), cookie_(cookie),\n> +\t: data(nullptr), camera_(camera), controls_(camera), cookie_(cookie),\n>  \t  status_(RequestPending), cancelled_(false)\n>  {\n>  }\n> @@ -178,6 +178,14 @@ Buffer *Request::findBuffer(Stream *stream) const\n>   * otherwise\n>   */\n>  \n> +/**\n> + * \\var Request::data\n> + * \\brief Pipeline handler specific data\n\nMaybe \"Pipeline handler-specific request data\" ?\n\n> + *\n> + * Pipeline handlers may associate private data with with an request that\n\ns/with with/with/\ns/an request/a request/\n\n> + * is valid for the requests lifetime inside the pipeline handler.\n\ns/requests/request's/\n\nThis isn't very clear. I would explicitly state when this member becomes\nand stops being valid, or rather when the pipeline handler can touch it.\nI would also mention that nothing else is allowed to touch this.\n\n> + */\n> +\n>  /**\n>   * \\brief Validate the request and prepare it for the completion handler\n>   *","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A0D5960BB2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Sep 2019 20:34:44 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1008F440;\n\tWed,  4 Sep 2019 20:34:43 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1567622084;\n\tbh=SCPykaQdS0crT7gQqugoeIFIC0WbcruKSBmebfbmuVc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JZDocg7Ys+q2ZW9lNXNZ5Q+62AWXA5xccL9PL2rjr61VZZxu4dEir42YFS7TNYbz2\n\tsG7vi1H0KFkb2E0EnlfvBSyUORo4auvQKpkeX07G9WSb3pPatPQquBkuDPDhxOXTl+\n\t7JyjT+KZMF+IoiZcpLNBU5tB3O/ZOkrLTL3IUsA0=","Date":"Wed, 4 Sep 2019 21:34:37 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190904183437.GH5433@pendragon.ideasonboard.com>","References":"<20190829232653.13214-1-niklas.soderlund@ragnatech.se>\n\t<20190829232653.13214-9-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190829232653.13214-9-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 08/14] libcamera: request: Add\n\tRequestData","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Wed, 04 Sep 2019 18:34:44 -0000"}}]