| Message ID | 20220613082725.16315-1-tommaso.merciai@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBD6ZNPUKRQLBB47JTOKQMGQEMHBKJGA@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id DE7023F1DD for <linux-amarula@patchwork.amarulasolutions.com>; Mon, 13 Jun 2022 10:27:31 +0200 (CEST) Received: by mail-wr1-f72.google.com with SMTP id bw25-20020a0560001f9900b002175d64fd29sf583932wrb.9 for <linux-amarula@patchwork.amarulasolutions.com>; Mon, 13 Jun 2022 01:27:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655108851; cv=pass; d=google.com; s=arc-20160816; b=ImOQNUjcCn7Te210A/i7saeVGCb1a5+3gIQJoXlqETszjvL+HC59iaAb4dwaAM7jhM oN/KuILuSdt4AYn5hzuT2ZyyKG5PrYiCaP7V4Q5uiN2R0h+uFd9pzPBiQrb5rxgW7egd bbvadk+lRjdHQLqr2FbBI9isNn1dvDPs8S9AwAedeafKzR4vFprjVEBicxPJjMgPdea9 VtrkD1or6CMTGz1t7D5PNZDu99Fh22YRePEk0YurD849AXJSO0lBKffFvzI82RNon/VU uaMjcBofuJaGosQQqaSrcsz+fiw1MgcfK0YwVpbb/jxePijBFTNWkY52eXPfsYAcAf78 wbrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=p8hPvBW8g2qN9rVGbFfd6VziM69hEWkiE/Xw+nTP7xc=; b=HyEEsJkG2Fb1lXTqFlzBnevgoIftk5UrJiWvtNr+5gPZ4GKXfkyPhroZHHBdrqbaAo Rs5YYzV8kYLYr0eN6EjMx5TGbVEgUgnjKGjnFzEOdCDx8coFWZ8PFhN+FMWi5Dgg33mv 0hlDvrggxjZn/YhQ/NSPLpJqj07jilXs237q999g2eztp+Z30cwfkL52qh7NGoZLd8rI N0Q+GBf9ptpcHtAhB7sS7VIB/SfUfdJdviHCzQjUb7qyQYbc5k05mVAq6iP9PlviiEsW y0eTxgNeUXC9dZTgVQ3vMjzAbtbDAa7LTx1fA5EebexS6OL27hohk8eoDg85VxD2aPKc GDEg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=W2kTlBXR; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=p8hPvBW8g2qN9rVGbFfd6VziM69hEWkiE/Xw+nTP7xc=; b=HZg2+1gNO3myDQR5gG9GRZvsYAH40pXxZMqAAgGFSwghgO/7ONDy0+XLAiVlG4voWo 8R61pRsuv+kHtTz0jlNyWJEee9Wb0NdZz4faVhMqyCFskNyCrGZ2kJwAeoAB3+kbxEvc 5yD2DWZa1z838S5m8Y5BpdAxPKVVsKUIxteYk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=p8hPvBW8g2qN9rVGbFfd6VziM69hEWkiE/Xw+nTP7xc=; b=CZ8YaQWlXSCDzP8S4fwriGUKtIL8I7KFxky3U2UsmveppKIjlnesJXxyakZbbpCWh0 AHxjLEKPxZCnEOZw4OVz2iWmIBc2pejc5TwV96/vw3Q4rxe7UC6X3KdstZKptXrPX12h 9zJ8PaasseSqIsychTfvxUxbTIAYZySNu0CdD/ayYUHtR/m15Z/uj5i5nDVCl5srrKyZ 7QDWmBFAnn/R/3D71GM0DvPSErWmo+IwUtIOKfhWk6utamGNTW4sLgEHbe4BHv7AEFEO s/LrzyURK1X1RzNDj7wudAAAQuohfHnNpMw9KiReIw85l50IVtsjyu7lc70UI82ac1kD ZCkQ== X-Gm-Message-State: AOAM531Zg278vTXLZp8L9yPsqhjp+j1U6SeHW1UY9twviK5Y4bzXzzli KYRayLps31IYmUDRLWZhQFBOr6/P X-Google-Smtp-Source: ABdhPJyVfU6ZVEwqRV1HiLU7VzQxgrHaacGLoIpSKTd6OQgNMbjKe7mqIxZsnjNi6A1BAod49OcWzQ== X-Received: by 2002:a05:600c:4f84:b0:39c:9897:5295 with SMTP id n4-20020a05600c4f8400b0039c98975295mr972118wmq.158.1655108851378; Mon, 13 Jun 2022 01:27:31 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:648e:0:b0:217:c8b4:52e3 with SMTP id o14-20020a5d648e000000b00217c8b452e3ls1235490wri.1.gmail; Mon, 13 Jun 2022 01:27:30 -0700 (PDT) X-Received: by 2002:adf:f84d:0:b0:213:169f:28cb with SMTP id d13-20020adff84d000000b00213169f28cbmr54806557wrq.539.1655108850268; Mon, 13 Jun 2022 01:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655108850; cv=none; d=google.com; s=arc-20160816; b=femM6phTkh97TNwodU5g7fDjYJtYS40VGSowxOpUNPDxqEauwQNDItUDJD4D3REDIf 3AMO64TVw3T8WS5BDNQh3nnksM6OzHv9rcpq4nLr9gG+1svdP83UT4SfA9UvV+HC0Ejq n/uZrcWcIbeOitO4xfuH3sBK0DJ66dlU9OWHty6S9mtcoSqK6ZIL6XpssvbfkcVIRV4d 2DpdRu3rG1hBvl1e2iJi49/qtrPppnNe8xsJmucUxWcf+44f9S+nT8JhA+lLqzYVID1H AH4bxnLe70EubhTK23wTBTRQBWOibIuZ3JtDBIOKjSl8udaTLICdGgzy4HXqxABi4awC sVew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=p1yJOvY6WAQ9oWgcRPdOk58CJtoW5K1gi9Wd7BSK5/w=; b=bAZmd1H3m56bXnBGfqHo/4U1H62nWOHhuxDZlmnj7wj070cdlyhyCrsU3gDuHhkLcD Ptp1KlWUJNx69RvYEh38IrcZz0Bnti9DLSyisPJG2NIsWGf8CRnJizoSNmoP/8YUKX8d FJT/HqSbc0TONxBi4p4qQC/k9/XKcltK4R2U105huz8NHwkcu8woxLzwSZTyigK7duEU i+JViCnRNSLEvcxerX21OiTOcLDCcj9p5GGERPonUsI3DAH63p5GchEcVf/jK6AFmuKJ PBIRANx0lFvI1AoJZO2sLshmU15TeN+GODDDMacWgffeC7Yttdas9tR6weyD5ZZpS9IX Ih8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=W2kTlBXR; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id n188-20020a1c27c5000000b0039c693a54c3sor1910102wmn.34.2022.06.13.01.27.30 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Mon, 13 Jun 2022 01:27:30 -0700 (PDT) Received-SPF: pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:600c:2241:b0:39c:405f:fba5 with SMTP id a1-20020a05600c224100b0039c405ffba5mr13271409wmm.75.1655108850046; Mon, 13 Jun 2022 01:27:30 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-34.cust.vodafonedsl.it. [188.217.51.34]) by smtp.gmail.com with ESMTPSA id n8-20020a7bc5c8000000b003974860e15esm12417247wmk.40.2022.06.13.01.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jun 2022 01:27:29 -0700 (PDT) From: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> To: Cc: tommaso.merciai@amarulasolutions.com, libcamera-devel@lists.libcamera.org, linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com Subject: [PATCH] Documentation: fix createRequest unique_ptr Date: Mon, 13 Jun 2022 10:27:25 +0200 Message-Id: <20220613082725.16315-1-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Original-Sender: tommaso.merciai@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=W2kTlBXR; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
Documentation: fix createRequest unique_ptr
|
|
Commit Message
Tommaso Merciai
June 13, 2022, 8:27 a.m. UTC
camera->createRequest() function return std::unique_ptr<Request>, then
manipulate Request as std::unique_ptr.
This solve the following error, during compilation:
error: cannot convert ‘std::unique_ptr<libcamera::Request>’ to ‘libcamera::Request*’ in initialization
References:
- https://github.com/kbingham/simple-cam/blob/bb97f3bbd96a9d347e1b7f6cb68d94efaf8db574/simple-cam.cpp#L369
Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
---
Documentation/guides/application-developer.rst | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Comments
Hi Tommaso, Thank you for the patch. On Mon, Jun 13, 2022 at 10:27:25AM +0200, Tommaso Merciai via libcamera-devel wrote: > camera->createRequest() function return std::unique_ptr<Request>, then > manipulate Request as std::unique_ptr. > This solve the following error, during compilation: > > error: cannot convert ‘std::unique_ptr<libcamera::Request>’ to ‘libcamera::Request*’ in initialization > > References: > - https://github.com/kbingham/simple-cam/blob/bb97f3bbd96a9d347e1b7f6cb68d94efaf8db574/simple-cam.cpp#L369 The change in simple-cam was made in commit 94b055c70c09729cab51cc2c74c1a0e3c1a9ae50 Author: Paul Elder <paul.elder@ideasonboard.com> Date: Fri Oct 16 14:51:19 2020 +0900 simple-cam: Reuse Requests Update simple-cam to reuse Request objects, and use the new API with unique pointers. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran@bingham.xyz> which follows the introduction of the Request::reuse() API in libcamera. The application guide should thus be extended accordingly. Kieran, I notice that there are quite a few changes in simple-cam on top of commit 94b055c70c09. Have most of them been taken into account in the application guide, or do we need a larger update ? > Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> > --- > Documentation/guides/application-developer.rst | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst > index 16bea9c4..8d12a208 100644 > --- a/Documentation/guides/application-developer.rst > +++ b/Documentation/guides/application-developer.rst > @@ -308,7 +308,7 @@ the camera. > > Stream *stream = streamConfig.stream(); > const std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator->buffers(stream); > - std::vector<Request *> requests; > + std::vector<std::unique_ptr<Request>> requests; > > Proceed to fill the request vector by creating ``Request`` instances from the > camera device, and associate a buffer for each of them for the ``Stream``. > @@ -316,7 +316,7 @@ camera device, and associate a buffer for each of them for the ``Stream``. > .. code:: cpp > > for (unsigned int i = 0; i < buffers.size(); ++i) { > - Request *request = camera->createRequest(); > + std::unique_ptr<Request> request = camera->createRequest(); > if (!request) > { > std::cerr << "Can't create request" << std::endl; > @@ -332,7 +332,7 @@ camera device, and associate a buffer for each of them for the ``Stream``. > return ret; > } > > - requests.push_back(request); > + requests.push_back(std::move(request)); > } > > .. TODO: Controls > @@ -517,8 +517,8 @@ and queue all the previously created requests. > .. code:: cpp > > camera->start(); > - for (Request *request : requests) > - camera->queueRequest(request); > + for (std::unique_ptr<Request> &request : requests) > + camera->queueRequest(request.get()); > > Start an event loop > ~~~~~~~~~~~~~~~~~~~
Hi Tommaso, Laurent On Mon, Jun 13, 2022 at 12:07:27PM +0300, Laurent Pinchart via libcamera-devel wrote: > Hi Tommaso, > > Thank you for the patch. > > On Mon, Jun 13, 2022 at 10:27:25AM +0200, Tommaso Merciai via libcamera-devel wrote: > > camera->createRequest() function return std::unique_ptr<Request>, then > > manipulate Request as std::unique_ptr. > > This solve the following error, during compilation: > > > > error: cannot convert ‘std::unique_ptr<libcamera::Request>’ to ‘libcamera::Request*’ in initialization > > > > References: > > - https://github.com/kbingham/simple-cam/blob/bb97f3bbd96a9d347e1b7f6cb68d94efaf8db574/simple-cam.cpp#L369 > > The change in simple-cam was made in > > commit 94b055c70c09729cab51cc2c74c1a0e3c1a9ae50 > Author: Paul Elder <paul.elder@ideasonboard.com> > Date: Fri Oct 16 14:51:19 2020 +0900 > > simple-cam: Reuse Requests > > Update simple-cam to reuse Request objects, and use the new API with > unique pointers. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Signed-off-by: Kieran Bingham <kieran@bingham.xyz> > > which follows the introduction of the Request::reuse() API in libcamera. > The application guide should thus be extended accordingly. > > Kieran, I notice that there are quite a few changes in simple-cam on top > of commit 94b055c70c09. Have most of them been taken into account in the > application guide, or do we need a larger update ? > We have more https://patchwork.libcamera.org/project/libcamera/list/?series=3176 But this patch can be collected in the meantime ? Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > > Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com> > > --- > > Documentation/guides/application-developer.rst | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst > > index 16bea9c4..8d12a208 100644 > > --- a/Documentation/guides/application-developer.rst > > +++ b/Documentation/guides/application-developer.rst > > @@ -308,7 +308,7 @@ the camera. > > > > Stream *stream = streamConfig.stream(); > > const std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator->buffers(stream); > > - std::vector<Request *> requests; > > + std::vector<std::unique_ptr<Request>> requests; > > > > Proceed to fill the request vector by creating ``Request`` instances from the > > camera device, and associate a buffer for each of them for the ``Stream``. > > @@ -316,7 +316,7 @@ camera device, and associate a buffer for each of them for the ``Stream``. > > .. code:: cpp > > > > for (unsigned int i = 0; i < buffers.size(); ++i) { > > - Request *request = camera->createRequest(); > > + std::unique_ptr<Request> request = camera->createRequest(); > > if (!request) > > { > > std::cerr << "Can't create request" << std::endl; > > @@ -332,7 +332,7 @@ camera device, and associate a buffer for each of them for the ``Stream``. > > return ret; > > } > > > > - requests.push_back(request); > > + requests.push_back(std::move(request)); > > } > > > > .. TODO: Controls > > @@ -517,8 +517,8 @@ and queue all the previously created requests. > > .. code:: cpp > > > > camera->start(); > > - for (Request *request : requests) > > - camera->queueRequest(request); > > + for (std::unique_ptr<Request> &request : requests) > > + camera->queueRequest(request.get()); > > > > Start an event loop > > ~~~~~~~~~~~~~~~~~~~ > > -- > Regards, > > Laurent Pinchart
diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst index 16bea9c4..8d12a208 100644 --- a/Documentation/guides/application-developer.rst +++ b/Documentation/guides/application-developer.rst @@ -308,7 +308,7 @@ the camera. Stream *stream = streamConfig.stream(); const std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator->buffers(stream); - std::vector<Request *> requests; + std::vector<std::unique_ptr<Request>> requests; Proceed to fill the request vector by creating ``Request`` instances from the camera device, and associate a buffer for each of them for the ``Stream``. @@ -316,7 +316,7 @@ camera device, and associate a buffer for each of them for the ``Stream``. .. code:: cpp for (unsigned int i = 0; i < buffers.size(); ++i) { - Request *request = camera->createRequest(); + std::unique_ptr<Request> request = camera->createRequest(); if (!request) { std::cerr << "Can't create request" << std::endl; @@ -332,7 +332,7 @@ camera device, and associate a buffer for each of them for the ``Stream``. return ret; } - requests.push_back(request); + requests.push_back(std::move(request)); } .. TODO: Controls @@ -517,8 +517,8 @@ and queue all the previously created requests. .. code:: cpp camera->start(); - for (Request *request : requests) - camera->queueRequest(request); + for (std::unique_ptr<Request> &request : requests) + camera->queueRequest(request.get()); Start an event loop ~~~~~~~~~~~~~~~~~~~