[{"id":10897,"web_url":"https://patchwork.libcamera.org/comment/10897/","msgid":"<20200627100616.dnk56mfbztk6uxqc@uno.localdomain>","date":"2020-06-27T10:06:16","subject":"Re: [libcamera-devel] [PATCH 09/13] libcamera: ipu3: Do not\n\tduplicate data in IPU3Stream","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"On Sat, Jun 27, 2020 at 05:00:39AM +0200, Niklas Söderlund wrote:\n> Do not keep the duplicated ImgUDevice::ImgUOutput information in both\n> the stream and camera data classes. Remove it from the stream and only\n> access it from the camera data class.\n>\n> Which stream is which can instead be checked by comparing it to the\n> known streams in camera data. This match how streams are checked in\n> other parts of the code making the driver more coherent.\n\n\nnot a driver :)\n\n>\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 31 +++++++++++++++-------------\n>  1 file changed, 17 insertions(+), 14 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index ae7a01b81dacf498..1f320dc166767bab 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -35,13 +35,11 @@ class IPU3Stream : public Stream\n>  {\n>  public:\n>  \tIPU3Stream()\n> -\t\t: active_(false), raw_(false), device_(nullptr)\n> +\t\t: active_(false)\n>  \t{\n>  \t}\n>\n>  \tbool active_;\n> -\tbool raw_;\n> -\tImgUDevice::ImgUOutput *device_;\n>  };\n>\n>  class IPU3CameraData : public CameraData\n> @@ -276,7 +274,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \t\tconst StreamConfiguration oldCfg = cfg;\n>  \t\tconst IPU3Stream *stream = streams_[i];\n>\n> -\t\tif (stream->raw_) {\n> +\t\tif (stream == &data_->rawStream_) {\n>  \t\t\tcfg = cio2Configuration_;\n>  \t\t} else {\n>  \t\t\tbool scale = stream == &data_->vfStream_;\n> @@ -572,13 +570,16 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n>  \t\t\t\t\t    std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tIPU3Stream *ipu3stream = static_cast<IPU3Stream *>(stream);\n>  \tunsigned int count = stream->configuration().bufferCount;\n>\n> -\tif (ipu3stream->raw_)\n> +\tif (stream == &data->outStream_)\n> +\t\treturn data->imgu_->output_.dev->exportBuffers(count, buffers);\n> +\telse if (stream == &data->vfStream_)\n> +\t\treturn data->imgu_->viewfinder_.dev->exportBuffers(count, buffers);\n> +\telse if (stream == &data->rawStream_)\n>  \t\treturn data->cio2_.exportBuffers(count, buffers);\n>\n> -\treturn ipu3stream->device_->dev->exportBuffers(count, buffers);\n> +\treturn -EINVAL;\n>  }\n>\n>  /**\n> @@ -685,11 +686,16 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n>  \t/* Queue all buffers from the request aimed for the ImgU. */\n>  \tfor (auto it : request->buffers()) {\n>  \t\tIPU3Stream *stream = static_cast<IPU3Stream *>(it.first);\n> -\t\tif (stream->raw_)\n> -\t\t\tcontinue;\n> -\n>  \t\tFrameBuffer *buffer = it.second;\n> -\t\tint ret = stream->device_->dev->queueBuffer(buffer);\n> +\t\tint ret;\n> +\n> +\t\tif (stream == &data->outStream_)\n> +\t\t\tret = data->imgu_->output_.dev->queueBuffer(buffer);\n> +\t\telse if (stream == &data->vfStream_)\n> +\t\t\tret = data->imgu_->viewfinder_.dev->queueBuffer(buffer);\n> +\t\telse\n> +\t\t\tcontinue;\n> +\n\nI would keep the previous code flow. Up to you\n\n                if (stream == &data->rawStream_)\n                        continue;\n\n                int ret = 0;\n\t\tif (stream == &data->outStream_)\n\t\t\tret = data->imgu_->output_.dev->queueBuffer(buffer);\n\t\telse if (stream == &data->vfStream_)\n\t\t\tret = data->imgu_->viewfinder_.dev->queueBuffer(buffer);\n\n>  \t\tif (ret < 0)\n>  \t\t\terror = ret;\n>  \t}\n> @@ -801,9 +807,6 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\t * second.\n>  \t\t */\n>  \t\tdata->imgu_ = numCameras ? &imgu1_ : &imgu0_;\n> -\t\tdata->outStream_.device_ = &data->imgu_->output_;\n> -\t\tdata->vfStream_.device_ = &data->imgu_->viewfinder_;\n> -\t\tdata->rawStream_.raw_ = true;\n>\n>  \t\t/*\n>  \t\t * Connect video devices' 'bufferReady' signals to their\n> --\n> 2.27.0\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 2B8E0C2E66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Jun 2020 10:02:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C54A3609C5;\n\tSat, 27 Jun 2020 12:02:46 +0200 (CEST)","from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5ABB8609C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 12:02:45 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id A68191C0006;\n\tSat, 27 Jun 2020 10:02:44 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Sat, 27 Jun 2020 12:06:16 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200627100616.dnk56mfbztk6uxqc@uno.localdomain>","References":"<20200627030043.2088585-1-niklas.soderlund@ragnatech.se>\n\t<20200627030043.2088585-10-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200627030043.2088585-10-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH 09/13] libcamera: ipu3: Do not\n\tduplicate data in IPU3Stream","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":10911,"web_url":"https://patchwork.libcamera.org/comment/10911/","msgid":"<20200627163636.GH5966@pendragon.ideasonboard.com>","date":"2020-06-27T16:36:36","subject":"Re: [libcamera-devel] [PATCH 09/13] libcamera: ipu3: Do not\n\tduplicate data in IPU3Stream","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 Sat, Jun 27, 2020 at 05:00:39AM +0200, Niklas Söderlund wrote:\n> Do not keep the duplicated ImgUDevice::ImgUOutput information in both\n> the stream and camera data classes. Remove it from the stream and only\n> access it from the camera data class.\n> \n> Which stream is which can instead be checked by comparing it to the\n> known streams in camera data. This match how streams are checked in\n> other parts of the code making the driver more coherent.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 31 +++++++++++++++-------------\n>  1 file changed, 17 insertions(+), 14 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index ae7a01b81dacf498..1f320dc166767bab 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -35,13 +35,11 @@ class IPU3Stream : public Stream\n>  {\n>  public:\n>  \tIPU3Stream()\n> -\t\t: active_(false), raw_(false), device_(nullptr)\n> +\t\t: active_(false)\n>  \t{\n>  \t}\n>  \n>  \tbool active_;\n> -\tbool raw_;\n> -\tImgUDevice::ImgUOutput *device_;\n\nI would have preferred to add an enum to identify the stream type and\nstore it in IPU3Stream. This would allow using switch...case below. I\nunderstand from patch 11/13 that you want to remove the IPU3Stream\nclass, and I wonder if it wouldn't be best to keep it with an enum id,\nas it could be useful for later. Up to you.\n\n>  };\n>  \n>  class IPU3CameraData : public CameraData\n> @@ -276,7 +274,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \t\tconst StreamConfiguration oldCfg = cfg;\n>  \t\tconst IPU3Stream *stream = streams_[i];\n>  \n> -\t\tif (stream->raw_) {\n> +\t\tif (stream == &data_->rawStream_) {\n>  \t\t\tcfg = cio2Configuration_;\n>  \t\t} else {\n>  \t\t\tbool scale = stream == &data_->vfStream_;\n> @@ -572,13 +570,16 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n>  \t\t\t\t\t    std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tIPU3Stream *ipu3stream = static_cast<IPU3Stream *>(stream);\n>  \tunsigned int count = stream->configuration().bufferCount;\n>  \n> -\tif (ipu3stream->raw_)\n> +\tif (stream == &data->outStream_)\n> +\t\treturn data->imgu_->output_.dev->exportBuffers(count, buffers);\n> +\telse if (stream == &data->vfStream_)\n> +\t\treturn data->imgu_->viewfinder_.dev->exportBuffers(count, buffers);\n> +\telse if (stream == &data->rawStream_)\n>  \t\treturn data->cio2_.exportBuffers(count, buffers);\n>  \n> -\treturn ipu3stream->device_->dev->exportBuffers(count, buffers);\n> +\treturn -EINVAL;\n>  }\n>  \n>  /**\n> @@ -685,11 +686,16 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n>  \t/* Queue all buffers from the request aimed for the ImgU. */\n>  \tfor (auto it : request->buffers()) {\n>  \t\tIPU3Stream *stream = static_cast<IPU3Stream *>(it.first);\n> -\t\tif (stream->raw_)\n> -\t\t\tcontinue;\n> -\n>  \t\tFrameBuffer *buffer = it.second;\n> -\t\tint ret = stream->device_->dev->queueBuffer(buffer);\n> +\t\tint ret;\n> +\n> +\t\tif (stream == &data->outStream_)\n> +\t\t\tret = data->imgu_->output_.dev->queueBuffer(buffer);\n> +\t\telse if (stream == &data->vfStream_)\n> +\t\t\tret = data->imgu_->viewfinder_.dev->queueBuffer(buffer);\n> +\t\telse\n> +\t\t\tcontinue;\n> +\n>  \t\tif (ret < 0)\n>  \t\t\terror = ret;\n>  \t}\n> @@ -801,9 +807,6 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\t * second.\n>  \t\t */\n>  \t\tdata->imgu_ = numCameras ? &imgu1_ : &imgu0_;\n> -\t\tdata->outStream_.device_ = &data->imgu_->output_;\n> -\t\tdata->vfStream_.device_ = &data->imgu_->viewfinder_;\n> -\t\tdata->rawStream_.raw_ = true;\n>  \n>  \t\t/*\n>  \t\t * Connect video devices' 'bufferReady' signals to their","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 CC041C2E69\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Jun 2020 16:36:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 557B1609C8;\n\tSat, 27 Jun 2020 18:36:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8BCE6603B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 18:36:41 +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 DFC08576;\n\tSat, 27 Jun 2020 18:36:40 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OTN52D7E\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593275801;\n\tbh=6SmJHq6aPgPK+NwKF5+nVa/9t79/bHVCm+A+IPgsjfc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OTN52D7EVz4bLryRkvCQzWyycFNh9nlBG7UpnM1LVgumMAr1wDQFqoXcHsM+D4cqm\n\tlHroJbRd5+DqnCifPhIiZZ8YCG9OOSbeqzJCTrll5mMzsXn+puVZIyJcTbatbtvr8a\n\tOvN8Mdl6u1YGuqpVWvZBOZ3mxa28TE9tLHODW9Zg=","Date":"Sat, 27 Jun 2020 19:36:36 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200627163636.GH5966@pendragon.ideasonboard.com>","References":"<20200627030043.2088585-1-niklas.soderlund@ragnatech.se>\n\t<20200627030043.2088585-10-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200627030043.2088585-10-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH 09/13] libcamera: ipu3: Do not\n\tduplicate data in IPU3Stream","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":10917,"web_url":"https://patchwork.libcamera.org/comment/10917/","msgid":"<20200627224630.GB1105424@oden.dyn.berto.se>","date":"2020-06-27T22:46:30","subject":"Re: [libcamera-devel] [PATCH 09/13] libcamera: ipu3: Do not\n\tduplicate data in IPU3Stream","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your feedback.\n\nOn 2020-06-27 12:06:16 +0200, Jacopo Mondi wrote:\n> \n> On Sat, Jun 27, 2020 at 05:00:39AM +0200, Niklas Söderlund wrote:\n> > Do not keep the duplicated ImgUDevice::ImgUOutput information in both\n> > the stream and camera data classes. Remove it from the stream and only\n> > access it from the camera data class.\n> >\n> > Which stream is which can instead be checked by comparing it to the\n> > known streams in camera data. This match how streams are checked in\n> > other parts of the code making the driver more coherent.\n> \n> \n> not a driver :)\n\nwops :-)\n\n> \n> >\n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 31 +++++++++++++++-------------\n> >  1 file changed, 17 insertions(+), 14 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index ae7a01b81dacf498..1f320dc166767bab 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -35,13 +35,11 @@ class IPU3Stream : public Stream\n> >  {\n> >  public:\n> >  \tIPU3Stream()\n> > -\t\t: active_(false), raw_(false), device_(nullptr)\n> > +\t\t: active_(false)\n> >  \t{\n> >  \t}\n> >\n> >  \tbool active_;\n> > -\tbool raw_;\n> > -\tImgUDevice::ImgUOutput *device_;\n> >  };\n> >\n> >  class IPU3CameraData : public CameraData\n> > @@ -276,7 +274,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n> >  \t\tconst StreamConfiguration oldCfg = cfg;\n> >  \t\tconst IPU3Stream *stream = streams_[i];\n> >\n> > -\t\tif (stream->raw_) {\n> > +\t\tif (stream == &data_->rawStream_) {\n> >  \t\t\tcfg = cio2Configuration_;\n> >  \t\t} else {\n> >  \t\t\tbool scale = stream == &data_->vfStream_;\n> > @@ -572,13 +570,16 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n> >  \t\t\t\t\t    std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n> >  {\n> >  \tIPU3CameraData *data = cameraData(camera);\n> > -\tIPU3Stream *ipu3stream = static_cast<IPU3Stream *>(stream);\n> >  \tunsigned int count = stream->configuration().bufferCount;\n> >\n> > -\tif (ipu3stream->raw_)\n> > +\tif (stream == &data->outStream_)\n> > +\t\treturn data->imgu_->output_.dev->exportBuffers(count, buffers);\n> > +\telse if (stream == &data->vfStream_)\n> > +\t\treturn data->imgu_->viewfinder_.dev->exportBuffers(count, buffers);\n> > +\telse if (stream == &data->rawStream_)\n> >  \t\treturn data->cio2_.exportBuffers(count, buffers);\n> >\n> > -\treturn ipu3stream->device_->dev->exportBuffers(count, buffers);\n> > +\treturn -EINVAL;\n> >  }\n> >\n> >  /**\n> > @@ -685,11 +686,16 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n> >  \t/* Queue all buffers from the request aimed for the ImgU. */\n> >  \tfor (auto it : request->buffers()) {\n> >  \t\tIPU3Stream *stream = static_cast<IPU3Stream *>(it.first);\n> > -\t\tif (stream->raw_)\n> > -\t\t\tcontinue;\n> > -\n> >  \t\tFrameBuffer *buffer = it.second;\n> > -\t\tint ret = stream->device_->dev->queueBuffer(buffer);\n> > +\t\tint ret;\n> > +\n> > +\t\tif (stream == &data->outStream_)\n> > +\t\t\tret = data->imgu_->output_.dev->queueBuffer(buffer);\n> > +\t\telse if (stream == &data->vfStream_)\n> > +\t\t\tret = data->imgu_->viewfinder_.dev->queueBuffer(buffer);\n> > +\t\telse\n> > +\t\t\tcontinue;\n> > +\n> \n> I would keep the previous code flow. Up to you\n> \n>                 if (stream == &data->rawStream_)\n>                         continue;\n> \n>                 int ret = 0;\n> \t\tif (stream == &data->outStream_)\n> \t\t\tret = data->imgu_->output_.dev->queueBuffer(buffer);\n> \t\telse if (stream == &data->vfStream_)\n> \t\t\tret = data->imgu_->viewfinder_.dev->queueBuffer(buffer);\n\nI have no strong preference so I will go with your suggestion in v2.\n\n> \n> >  \t\tif (ret < 0)\n> >  \t\t\terror = ret;\n> >  \t}\n> > @@ -801,9 +807,6 @@ int PipelineHandlerIPU3::registerCameras()\n> >  \t\t * second.\n> >  \t\t */\n> >  \t\tdata->imgu_ = numCameras ? &imgu1_ : &imgu0_;\n> > -\t\tdata->outStream_.device_ = &data->imgu_->output_;\n> > -\t\tdata->vfStream_.device_ = &data->imgu_->viewfinder_;\n> > -\t\tdata->rawStream_.raw_ = true;\n> >\n> >  \t\t/*\n> >  \t\t * Connect video devices' 'bufferReady' signals to their\n> > --\n> > 2.27.0\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel","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 4FD19C2E69\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Jun 2020 22:46:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C5863609C8;\n\tSun, 28 Jun 2020 00:46:33 +0200 (CEST)","from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0CDCE609A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 28 Jun 2020 00:46:32 +0200 (CEST)","by mail-lj1-x241.google.com with SMTP id s1so14008255ljo.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 15:46:31 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tq11sm7724204lfe.34.2020.06.27.15.46.30\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 27 Jun 2020 15:46:30 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"C6W4QWDM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=PzYRQ/qZ1d8FXcgS0H5hP/aZqulsykj/D6oubabKj50=;\n\tb=C6W4QWDMQFnzlF4CGVUrESNV08F6Fs6qIfpa/sClZXgkz2qYG/HwdKUpaX58apZunz\n\t+IeSb79yUIHiHu11Vf8qwfrTlmLxVa1Khb84pFystiYmPUctlOb3/a7ER6cykvwNbMtL\n\trQLUijHZtBZErn83wKfe9GirRy7dH3g7EG5xjSb9zr+qkMOuyPhNwsDE4AXLvxrgQi3B\n\td1xHRSynyr3dXMq5BGt8+zTWwaAVEzWe1ngcf1VxX1BUPwcIhU5XfZgdv0RoVKTe+YqZ\n\trAhZ+qs/tCeMkYU5ZUBBjGuQedaea1a6kmgozDkhh6O5uqP5B4abk/C6Es888jLPcx6/\n\tTB3A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=PzYRQ/qZ1d8FXcgS0H5hP/aZqulsykj/D6oubabKj50=;\n\tb=WTfkutX3CEhDnSlOZgGyiBbHDVWFKel8FrSQV9jl3TXZ3F3m+QQ2gbOUThw0bHMjeJ\n\tRGAX1JOSTCaqQFqEmDQTytvozC4GK7RO2qnTTO2i8ZPBVOgJZMFhjC7tEUvxp2rJyBSj\n\tSRcv6tCmDOofzEu3EZBbnEt2LH8NcazGlfC4t5RoZnZ8q/7P1K+BsYYM+hULSFi///or\n\t/puRG/Nz8GX8mbGS0TbKK3WBI/tSa/ep/r5Jt60GI2T0rnnp9bLc2lh0QnamyFG4/Cr2\n\tic3XHygkjirCt30aqBX5y9gNilDPsvrf6O1LKUWQYaqpkQGIVOtKLUiqQHXyBppsP+oG\n\t6JSA==","X-Gm-Message-State":"AOAM531q3g0WNSm3SHGkz8TyVeLUCAZpcRs71G/eZ/tdxC/sc65hUwzE\n\tnFoGF2HGTWpbxVr+7GeQM/SYUpSlfX4=","X-Google-Smtp-Source":"ABdhPJxfKedglvfgqhmQqfe7VJ4Vm57dgmV0X8fCZmzhuAUIZeBGrMXoPSyBqtfPGu0AfsEHiI+RdA==","X-Received":"by 2002:a2e:58f:: with SMTP id 137mr4697906ljf.49.1593297991331; \n\tSat, 27 Jun 2020 15:46:31 -0700 (PDT)","Date":"Sun, 28 Jun 2020 00:46:30 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200627224630.GB1105424@oden.dyn.berto.se>","References":"<20200627030043.2088585-1-niklas.soderlund@ragnatech.se>\n\t<20200627030043.2088585-10-niklas.soderlund@ragnatech.se>\n\t<20200627100616.dnk56mfbztk6uxqc@uno.localdomain>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200627100616.dnk56mfbztk6uxqc@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH 09/13] libcamera: ipu3: Do not\n\tduplicate data in IPU3Stream","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":10918,"web_url":"https://patchwork.libcamera.org/comment/10918/","msgid":"<20200627225207.GC1105424@oden.dyn.berto.se>","date":"2020-06-27T22:52:07","subject":"Re: [libcamera-devel] [PATCH 09/13] libcamera: ipu3: Do not\n\tduplicate data in IPU3Stream","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your feedback.\n\nOn 2020-06-27 19:36:36 +0300, Laurent Pinchart wrote:\n> Hi Niklas,\n> \n> Thank you for the patch.\n> \n> On Sat, Jun 27, 2020 at 05:00:39AM +0200, Niklas Söderlund wrote:\n> > Do not keep the duplicated ImgUDevice::ImgUOutput information in both\n> > the stream and camera data classes. Remove it from the stream and only\n> > access it from the camera data class.\n> > \n> > Which stream is which can instead be checked by comparing it to the\n> > known streams in camera data. This match how streams are checked in\n> > other parts of the code making the driver more coherent.\n> > \n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 31 +++++++++++++++-------------\n> >  1 file changed, 17 insertions(+), 14 deletions(-)\n> > \n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index ae7a01b81dacf498..1f320dc166767bab 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -35,13 +35,11 @@ class IPU3Stream : public Stream\n> >  {\n> >  public:\n> >  \tIPU3Stream()\n> > -\t\t: active_(false), raw_(false), device_(nullptr)\n> > +\t\t: active_(false)\n> >  \t{\n> >  \t}\n> >  \n> >  \tbool active_;\n> > -\tbool raw_;\n> > -\tImgUDevice::ImgUOutput *device_;\n> \n> I would have preferred to add an enum to identify the stream type and\n> store it in IPU3Stream. This would allow using switch...case below. I\n> understand from patch 11/13 that you want to remove the IPU3Stream\n> class, and I wonder if it wouldn't be best to keep it with an enum id,\n> as it could be useful for later. Up to you.\n\nI think I would like to keep the change as it is unless someone have \nstrong feelings opposing it. Keeping IPU3Stream just for the numerical \nid feels a bit bloated. But if we going forward need to again subclass \nStream for some reason I might be persuaded. For now lets keep it simple \nso we can add complexity in later patches with added functionality more \neasily :-)\n\n> \n> >  };\n> >  \n> >  class IPU3CameraData : public CameraData\n> > @@ -276,7 +274,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n> >  \t\tconst StreamConfiguration oldCfg = cfg;\n> >  \t\tconst IPU3Stream *stream = streams_[i];\n> >  \n> > -\t\tif (stream->raw_) {\n> > +\t\tif (stream == &data_->rawStream_) {\n> >  \t\t\tcfg = cio2Configuration_;\n> >  \t\t} else {\n> >  \t\t\tbool scale = stream == &data_->vfStream_;\n> > @@ -572,13 +570,16 @@ int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n> >  \t\t\t\t\t    std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n> >  {\n> >  \tIPU3CameraData *data = cameraData(camera);\n> > -\tIPU3Stream *ipu3stream = static_cast<IPU3Stream *>(stream);\n> >  \tunsigned int count = stream->configuration().bufferCount;\n> >  \n> > -\tif (ipu3stream->raw_)\n> > +\tif (stream == &data->outStream_)\n> > +\t\treturn data->imgu_->output_.dev->exportBuffers(count, buffers);\n> > +\telse if (stream == &data->vfStream_)\n> > +\t\treturn data->imgu_->viewfinder_.dev->exportBuffers(count, buffers);\n> > +\telse if (stream == &data->rawStream_)\n> >  \t\treturn data->cio2_.exportBuffers(count, buffers);\n> >  \n> > -\treturn ipu3stream->device_->dev->exportBuffers(count, buffers);\n> > +\treturn -EINVAL;\n> >  }\n> >  \n> >  /**\n> > @@ -685,11 +686,16 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n> >  \t/* Queue all buffers from the request aimed for the ImgU. */\n> >  \tfor (auto it : request->buffers()) {\n> >  \t\tIPU3Stream *stream = static_cast<IPU3Stream *>(it.first);\n> > -\t\tif (stream->raw_)\n> > -\t\t\tcontinue;\n> > -\n> >  \t\tFrameBuffer *buffer = it.second;\n> > -\t\tint ret = stream->device_->dev->queueBuffer(buffer);\n> > +\t\tint ret;\n> > +\n> > +\t\tif (stream == &data->outStream_)\n> > +\t\t\tret = data->imgu_->output_.dev->queueBuffer(buffer);\n> > +\t\telse if (stream == &data->vfStream_)\n> > +\t\t\tret = data->imgu_->viewfinder_.dev->queueBuffer(buffer);\n> > +\t\telse\n> > +\t\t\tcontinue;\n> > +\n> >  \t\tif (ret < 0)\n> >  \t\t\terror = ret;\n> >  \t}\n> > @@ -801,9 +807,6 @@ int PipelineHandlerIPU3::registerCameras()\n> >  \t\t * second.\n> >  \t\t */\n> >  \t\tdata->imgu_ = numCameras ? &imgu1_ : &imgu0_;\n> > -\t\tdata->outStream_.device_ = &data->imgu_->output_;\n> > -\t\tdata->vfStream_.device_ = &data->imgu_->viewfinder_;\n> > -\t\tdata->rawStream_.raw_ = true;\n> >  \n> >  \t\t/*\n> >  \t\t * Connect video devices' 'bufferReady' signals to their\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 46454C2E66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Jun 2020 22:52:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AD1BC609D6;\n\tSun, 28 Jun 2020 00:52:10 +0200 (CEST)","from mail-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E96D5609A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 28 Jun 2020 00:52:08 +0200 (CEST)","by mail-lf1-x143.google.com with SMTP id m26so6990442lfo.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Jun 2020 15:52:08 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tm13sm6292822ljj.20.2020.06.27.15.52.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 27 Jun 2020 15:52:07 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"lbTndpd6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=amIOE29ZTF9kIxP3IPAGUFcVxSYwhwrrYvO4eQI3qLU=;\n\tb=lbTndpd6U5avnPq3Yf657hEBgQWjE/8AXWXqgQXIG8GMCezj+Q1gxeoaErd8JuoVvF\n\tXjem7w+SgKhiACfLbiHBUhnHwwq+xAwLQQHKdaN1gEn9mYVObEOPRjSiv+y6m0leJyWl\n\tSaymROd6LPmYgdrdbcnW4iUPObibRGyDH9C8QAemlTNYKCex9MYEU+q1Ot3rcxgIJBXZ\n\twmFwJTfpQcuVEYsw2pJUTcMC/LFMTIL6k/O0u5mpgOsOvzYuv64YBEZ8QyRA/VW8cAR5\n\tm5HO5mgd79dX2v84X2UNsnLHRUHzWsWf1P9vAfBqVdV0wnx0kbyT3RBMGoorD7lbKVmL\n\tTueQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=amIOE29ZTF9kIxP3IPAGUFcVxSYwhwrrYvO4eQI3qLU=;\n\tb=qU3yrPzcygZFksTe/7FmUJrW/EOfcWZq//51/Z67ExV0fb5YhxLIDA1yg0UkFCxzcz\n\tSqIowoUO0pfCJNLB+yvemxkhFKiGzCMvUz7yXli63/gXwMBpEj4Dc25dNfniXgxP65Nj\n\tDoX8gwBmN9J2XENjx5d8zSKsxf+CfCo/DQfIAW0Ezhe431LOW5I6ZxhFyBiNoWMUPXfO\n\tgug5LgaCHJkzGY4xRZgS5UlO7a3bVoCCsqpUs5muWcKdKnIjpTzq0zEwjrCrATMNuhej\n\thOm3i48RhHo3hoRz5J6RWHgGCrVT5J0/bKgYZ4UsmjNjS0YtzdXFpeUviNnk3REzSCHr\n\tdagA==","X-Gm-Message-State":"AOAM530t//D3dLW/8+0u1MksCBcLIkxqhfYy5KrDa9uJWHn5H5JTlzpz\n\tpwq8UvYAcVIPJig5UdZAAny2tQ==","X-Google-Smtp-Source":"ABdhPJz+YJcBQe3lJlswxMI+6ts7Ah3328LB8S0GOdNi9MIoDk47BQouYAEKZvi04YPMAOC5CXrhbw==","X-Received":"by 2002:a05:6512:60b:: with SMTP id\n\tb11mr5584883lfe.116.1593298328170; \n\tSat, 27 Jun 2020 15:52:08 -0700 (PDT)","Date":"Sun, 28 Jun 2020 00:52:07 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20200627225207.GC1105424@oden.dyn.berto.se>","References":"<20200627030043.2088585-1-niklas.soderlund@ragnatech.se>\n\t<20200627030043.2088585-10-niklas.soderlund@ragnatech.se>\n\t<20200627163636.GH5966@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200627163636.GH5966@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 09/13] libcamera: ipu3: Do not\n\tduplicate data in IPU3Stream","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]