Message ID | 20220613082725.16315-1-tommaso.merciai@amarulasolutions.com |
---|---|
State | Accepted |
Commit | f44ce70d9b8859c319e5c814584684ff61e3b6fa |
Headers | show |
Series |
|
Related | show |
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
Hello, On Thu, Jun 16, 2022 at 12:45:28PM +0200, Jacopo Mondi wrote: > On Mon, Jun 13, 2022 at 12:07:27PM +0300, Laurent Pinchart via libcamera-devel wrote: > > 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 ? Sounds good. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> > > > > 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 > > > ~~~~~~~~~~~~~~~~~~~
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 ~~~~~~~~~~~~~~~~~~~
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(-)