[{"id":10966,"web_url":"https://patchwork.libcamera.org/comment/10966/","msgid":"<20200629143255.GE1852218@oden.dyn.berto.se>","date":"2020-06-29T14:32:55","subject":"Re: [libcamera-devel] [PATCH v1 5/9] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData","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 work.\n\nOn 2020-06-29 02:19:30 +0300, Laurent Pinchart wrote:\n> The PipelineHandlerRPi::configureIPA() function accesses plenty of\n> member data from the RPiCameraData class and no member from the\n> PipelineHandlerRPi class. Move it to RPiCameraData where it logically\n> belongs.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 117 +++++++++---------\n>  1 file changed, 58 insertions(+), 59 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 3b5cdf1e1849..0f9237a7f346 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -311,6 +311,8 @@ public:\n>  \tvoid frameStarted(uint32_t sequence);\n>  \n>  \tint loadIPA();\n> +\tint configureIPA();\n> +\n>  \tvoid queueFrameAction(unsigned int frame, const IPAOperationData &action);\n>  \n>  \t/* bufferComplete signal handlers. */\n> @@ -396,8 +398,6 @@ private:\n>  \t\treturn static_cast<RPiCameraData *>(PipelineHandler::cameraData(camera));\n>  \t}\n>  \n> -\tint configureIPA(Camera *camera);\n> -\n>  \tint queueAllBuffers(Camera *camera);\n>  \tint prepareBuffers(Camera *camera);\n>  \tvoid freeBuffers(Camera *camera);\n> @@ -752,7 +752,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \tcrop.y = (sensorFormat.size.height - crop.height) >> 1;\n>  \tdata->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop);\n>  \n> -\tret = configureIPA(camera);\n> +\tret = data->configureIPA();\n>  \tif (ret)\n>  \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n>  \n> @@ -968,62 +968,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n>  \treturn true;\n>  }\n>  \n> -int PipelineHandlerRPi::configureIPA(Camera *camera)\n> -{\n> -\tstd::map<unsigned int, IPAStream> streamConfig;\n> -\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n> -\tRPiCameraData *data = cameraData(camera);\n> -\n> -\t/* Get the device format to pass to the IPA. */\n> -\tV4L2DeviceFormat sensorFormat;\n> -\tdata->unicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n> -\t/* Inform IPA of stream configuration and sensor controls. */\n> -\tunsigned int i = 0;\n> -\tfor (auto const &stream : data->isp_) {\n> -\t\tif (stream.isExternal()) {\n> -\t\t\tstreamConfig[i] = {\n> -\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n> -\t\t\t\t.size = stream.configuration().size\n> -\t\t\t};\n> -\t\t}\n> -\t}\n> -\tentityControls.emplace(0, data->unicam_[Unicam::Image].dev()->controls());\n> -\tentityControls.emplace(1, data->isp_[Isp::Input].dev()->controls());\n> -\n> -\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n> -\tif (!data->lsTable_) {\n> -\t\tdata->lsTable_ = data->vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n> -\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(data->lsTable_);\n> -\n> -\t\tif (!data->lsTable_)\n> -\t\t\treturn -ENOMEM;\n> -\n> -\t\t/*\n> -\t\t * The vcsm allocation will always be in the memory region\n> -\t\t * < 32-bits to allow Videocore to access the memory.\n> -\t\t */\n> -\t\tIPAOperationData op;\n> -\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n> -\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n> -\t\t\t    data->vcsm_.getVCHandle(data->lsTable_) };\n> -\t\tdata->ipa_->processEvent(op);\n> -\t}\n> -\n> -\tCameraSensorInfo sensorInfo = {};\n> -\tint ret = data->sensor_->sensorInfo(&sensorInfo);\n> -\tif (ret) {\n> -\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n> -\t\treturn ret;\n> -\t}\n> -\n> -\t/* Ready the IPA - it must know about the sensor resolution. */\n> -\tIPAOperationData ipaConfig;\n> -\tdata->ipa_->configure(sensorInfo, streamConfig, entityControls,\n> -\t\t\t      ipaConfig, nullptr);\n> -\n> -\treturn 0;\n> -}\n> -\n>  int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n>  {\n>  \tRPiCameraData *data = cameraData(camera);\n> @@ -1161,6 +1105,61 @@ int RPiCameraData::loadIPA()\n>  \treturn ipa_->start();\n>  }\n>  \n> +int RPiCameraData::configureIPA()\n> +{\n> +\tstd::map<unsigned int, IPAStream> streamConfig;\n> +\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n> +\n> +\t/* Get the device format to pass to the IPA. */\n> +\tV4L2DeviceFormat sensorFormat;\n> +\tunicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n> +\t/* Inform IPA of stream configuration and sensor controls. */\n> +\tunsigned int i = 0;\n> +\tfor (auto const &stream : isp_) {\n> +\t\tif (stream.isExternal()) {\n> +\t\t\tstreamConfig[i] = {\n> +\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n> +\t\t\t\t.size = stream.configuration().size\n> +\t\t\t};\n> +\t\t}\n> +\t}\n> +\tentityControls.emplace(0, unicam_[Unicam::Image].dev()->controls());\n> +\tentityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n> +\n> +\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n> +\tif (!lsTable_) {\n> +\t\tlsTable_ = vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n> +\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(lsTable_);\n> +\n> +\t\tif (!lsTable_)\n> +\t\t\treturn -ENOMEM;\n> +\n> +\t\t/*\n> +\t\t * The vcsm allocation will always be in the memory region\n> +\t\t * < 32-bits to allow Videocore to access the memory.\n> +\t\t */\n> +\t\tIPAOperationData op;\n> +\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n> +\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n> +\t\t\t    vcsm_.getVCHandle(lsTable_) };\n> +\t\tipa_->processEvent(op);\n> +\t}\n> +\n> +\tCameraSensorInfo sensorInfo = {};\n> +\tint ret = sensor_->sensorInfo(&sensorInfo);\n> +\tif (ret) {\n> +\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n> +\t\treturn ret;\n> +\t}\n> +\n> +\t/* Ready the IPA - it must know about the sensor resolution. */\n> +\tIPAOperationData ipaConfig;\n> +\tipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,\n> +\t\t\tnullptr);\n> +\n> +\treturn 0;\n> +}\n> +\n>  void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData &action)\n>  {\n>  \t/*\n> -- \n> Regards,\n> \n> Laurent Pinchart\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 E82D4BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2020 14:32:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B3B44609DD;\n\tMon, 29 Jun 2020 16:32:58 +0200 (CEST)","from mail-lj1-x243.google.com (mail-lj1-x243.google.com\n\t[IPv6:2a00:1450:4864:20::243])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D2576603BB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2020 16:32:56 +0200 (CEST)","by mail-lj1-x243.google.com with SMTP id 9so18276440ljv.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2020 07:32:56 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\te29sm8054032lfc.51.2020.06.29.07.32.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Jun 2020 07:32:55 -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=\"1UcOLQyr\"; 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=hYGIA+SLxseQFGw9wkiKcg54hP2TdvBjSjGvtWEwvDI=;\n\tb=1UcOLQyrOithuQKw6FBRPRdXWtc0qjlXMIBkGivjzt9APkyjsScPO7/fx1yfPdW610\n\tS34MH34xKelz/lOCg1/KGJJee4CWccKqHMcmJnn70Sn1Of4zeLwMINDriGpRZEY400HJ\n\tDrh+MYr1HSFcPDUIiTvGqbQ1cY+1Z4WwCiHJuKlWiAwsWZTSsIwKH3JFfcuLJqk+I+qj\n\ttp0bavRGoWLQBZTdpCQ+T5aS88YQUnDOOpvZrVmr1Z418jBZwn/a5nwG4KKa4eaSzHFD\n\tNnoUaw9By3MayaYd7wM98iVarDniYrA833NBDKBXbtauMfzRHZ5zBx2uNfj5eqgegvDm\n\t2iUA==","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=hYGIA+SLxseQFGw9wkiKcg54hP2TdvBjSjGvtWEwvDI=;\n\tb=kqO5BtTPl/veulxFaWtQEaAHhlu89rejdoLwekRgzu7EO21RDFfxmeC+YTx2GmQjOu\n\t/fpN+C8OSmvXM0cz8rrMJyF8qCnHdJ38dTbqW8ZwRkuqf9l0Kj9Qu+ZHf/iLvPTt3D4N\n\tG5kk9qWKLeUcRy/zKnzgg3LDUAghLwC+ldpruEN6SLW+AfA8Yq2k/ZNxz0cIjB9gYkQW\n\tSJKZkmMN3c1uLxXWY9NXLBbHDap6O95z/fIADRjttmJtdYwofdonKTEL9rEstdPP/YVU\n\tR7p8mMRcX90o3RCm3w0z07xyNB8bmI45h1cOBGggFgVKCrfGqN4JY2Tsko7fDBuNazD6\n\too6w==","X-Gm-Message-State":"AOAM532GwZmDCi9VmM4K+G0I912PJz/Eltw1lKInP6rzkKxxhUILLr47\n\tb75GQGKBKbVEAvCMQPMr5r9hBvWlVJg=","X-Google-Smtp-Source":"ABdhPJwBsXE91+ibhd92qvKr6oF2mHkHAQpJX+fgeXzpTHhJiT1mhbR4+MGQUPvhSMYkS9KTqBP1Hw==","X-Received":"by 2002:a05:651c:1193:: with SMTP id\n\tw19mr8416272ljo.121.1593441176195; \n\tMon, 29 Jun 2020 07:32:56 -0700 (PDT)","Date":"Mon, 29 Jun 2020 16:32:55 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20200629143255.GE1852218@oden.dyn.berto.se>","References":"<20200628231934.29025-1-laurent.pinchart@ideasonboard.com>\n\t<20200628231934.29025-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200628231934.29025-6-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v1 5/9] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData","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":10975,"web_url":"https://patchwork.libcamera.org/comment/10975/","msgid":"<CAEmqJPrzAZzqOgt1H7TXk_Df6XOCqxUGCKkFcuOc=_kHetoZ0Q@mail.gmail.com>","date":"2020-06-29T16:58:31","subject":"Re: [libcamera-devel] [PATCH v1 5/9] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\nThank you for the patch.\n\nOn Mon, 29 Jun 2020 at 15:33, Niklas Söderlund\n<niklas.soderlund@ragnatech.se> wrote:\n>\n> Hi Laurent,\n>\n> Thanks for your work.\n>\n> On 2020-06-29 02:19:30 +0300, Laurent Pinchart wrote:\n> > The PipelineHandlerRPi::configureIPA() function accesses plenty of\n> > member data from the RPiCameraData class and no member from the\n> > PipelineHandlerRPi class. Move it to RPiCameraData where it logically\n> > belongs.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n>\n> > ---\n> >  .../pipeline/raspberrypi/raspberrypi.cpp      | 117 +++++++++---------\n> >  1 file changed, 58 insertions(+), 59 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > index 3b5cdf1e1849..0f9237a7f346 100644\n> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > @@ -311,6 +311,8 @@ public:\n> >       void frameStarted(uint32_t sequence);\n> >\n> >       int loadIPA();\n> > +     int configureIPA();\n> > +\n> >       void queueFrameAction(unsigned int frame, const IPAOperationData &action);\n> >\n> >       /* bufferComplete signal handlers. */\n> > @@ -396,8 +398,6 @@ private:\n> >               return static_cast<RPiCameraData *>(PipelineHandler::cameraData(camera));\n> >       }\n> >\n> > -     int configureIPA(Camera *camera);\n> > -\n> >       int queueAllBuffers(Camera *camera);\n> >       int prepareBuffers(Camera *camera);\n> >       void freeBuffers(Camera *camera);\n> > @@ -752,7 +752,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n> >       crop.y = (sensorFormat.size.height - crop.height) >> 1;\n> >       data->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop);\n> >\n> > -     ret = configureIPA(camera);\n> > +     ret = data->configureIPA();\n> >       if (ret)\n> >               LOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n> >\n> > @@ -968,62 +968,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n> >       return true;\n> >  }\n> >\n> > -int PipelineHandlerRPi::configureIPA(Camera *camera)\n> > -{\n> > -     std::map<unsigned int, IPAStream> streamConfig;\n> > -     std::map<unsigned int, const ControlInfoMap &> entityControls;\n> > -     RPiCameraData *data = cameraData(camera);\n> > -\n> > -     /* Get the device format to pass to the IPA. */\n> > -     V4L2DeviceFormat sensorFormat;\n> > -     data->unicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n> > -     /* Inform IPA of stream configuration and sensor controls. */\n> > -     unsigned int i = 0;\n> > -     for (auto const &stream : data->isp_) {\n> > -             if (stream.isExternal()) {\n> > -                     streamConfig[i] = {\n> > -                             .pixelFormat = stream.configuration().pixelFormat,\n> > -                             .size = stream.configuration().size\n> > -                     };\n> > -             }\n> > -     }\n> > -     entityControls.emplace(0, data->unicam_[Unicam::Image].dev()->controls());\n> > -     entityControls.emplace(1, data->isp_[Isp::Input].dev()->controls());\n> > -\n> > -     /* Allocate the lens shading table via vcsm and pass to the IPA. */\n> > -     if (!data->lsTable_) {\n> > -             data->lsTable_ = data->vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n> > -             uintptr_t ptr = reinterpret_cast<uintptr_t>(data->lsTable_);\n> > -\n> > -             if (!data->lsTable_)\n> > -                     return -ENOMEM;\n> > -\n> > -             /*\n> > -              * The vcsm allocation will always be in the memory region\n> > -              * < 32-bits to allow Videocore to access the memory.\n> > -              */\n> > -             IPAOperationData op;\n> > -             op.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n> > -             op.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n> > -                         data->vcsm_.getVCHandle(data->lsTable_) };\n> > -             data->ipa_->processEvent(op);\n> > -     }\n> > -\n> > -     CameraSensorInfo sensorInfo = {};\n> > -     int ret = data->sensor_->sensorInfo(&sensorInfo);\n> > -     if (ret) {\n> > -             LOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n> > -             return ret;\n> > -     }\n> > -\n> > -     /* Ready the IPA - it must know about the sensor resolution. */\n> > -     IPAOperationData ipaConfig;\n> > -     data->ipa_->configure(sensorInfo, streamConfig, entityControls,\n> > -                           ipaConfig, nullptr);\n> > -\n> > -     return 0;\n> > -}\n> > -\n> >  int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n> >  {\n> >       RPiCameraData *data = cameraData(camera);\n> > @@ -1161,6 +1105,61 @@ int RPiCameraData::loadIPA()\n> >       return ipa_->start();\n> >  }\n> >\n> > +int RPiCameraData::configureIPA()\n> > +{\n> > +     std::map<unsigned int, IPAStream> streamConfig;\n> > +     std::map<unsigned int, const ControlInfoMap &> entityControls;\n> > +\n> > +     /* Get the device format to pass to the IPA. */\n> > +     V4L2DeviceFormat sensorFormat;\n> > +     unicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n> > +     /* Inform IPA of stream configuration and sensor controls. */\n> > +     unsigned int i = 0;\n> > +     for (auto const &stream : isp_) {\n> > +             if (stream.isExternal()) {\n> > +                     streamConfig[i] = {\n> > +                             .pixelFormat = stream.configuration().pixelFormat,\n> > +                             .size = stream.configuration().size\n> > +                     };\n> > +             }\n> > +     }\n> > +     entityControls.emplace(0, unicam_[Unicam::Image].dev()->controls());\n> > +     entityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n> > +\n> > +     /* Allocate the lens shading table via vcsm and pass to the IPA. */\n> > +     if (!lsTable_) {\n> > +             lsTable_ = vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n> > +             uintptr_t ptr = reinterpret_cast<uintptr_t>(lsTable_);\n> > +\n> > +             if (!lsTable_)\n> > +                     return -ENOMEM;\n> > +\n> > +             /*\n> > +              * The vcsm allocation will always be in the memory region\n> > +              * < 32-bits to allow Videocore to access the memory.\n> > +              */\n> > +             IPAOperationData op;\n> > +             op.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n> > +             op.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n> > +                         vcsm_.getVCHandle(lsTable_) };\n> > +             ipa_->processEvent(op);\n> > +     }\n> > +\n> > +     CameraSensorInfo sensorInfo = {};\n> > +     int ret = sensor_->sensorInfo(&sensorInfo);\n> > +     if (ret) {\n> > +             LOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n> > +             return ret;\n> > +     }\n> > +\n> > +     /* Ready the IPA - it must know about the sensor resolution. */\n> > +     IPAOperationData ipaConfig;\n> > +     ipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,\n> > +                     nullptr);\n> > +\n> > +     return 0;\n> > +}\n> > +\n> >  void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData &action)\n> >  {\n> >       /*\n> > --\n> > Regards,\n> >\n> > Laurent Pinchart\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel\n>\n> --\n> Regards,\n> Niklas Söderlund\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 2404ABFFE2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2020 16:58:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E20D9609DD;\n\tMon, 29 Jun 2020 18:58:49 +0200 (CEST)","from mail-lf1-x142.google.com (mail-lf1-x142.google.com\n\t[IPv6:2a00:1450:4864:20::142])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B989F603B2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2020 18:58:48 +0200 (CEST)","by mail-lf1-x142.google.com with SMTP id d21so9482681lfb.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2020 09:58:48 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"lxE+uYAQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=kcs+7eLUM4vgUlECgfwUC3OsX1shv2UyjDhkHGNz4KA=;\n\tb=lxE+uYAQzvtf1XO/hKLhLHOg1TZXBVwyp5BscADUFXdThKFHwtwCE8rVtqt561I2O4\n\tPzNoyUTvz54QbxUIdWNErWnNcURTrJYsQkxRpZjfMA+muZ7jQi1Lrf5Nw/DFlluwl44f\n\t8ANV/+yCt7/90ncH9fBZ5niIkGrF5+vdH6gjULSbEZ4JQSwV8qgtvF2hSmUf6hTXA6fu\n\t41/x+LFNAi+hvNcRlMsoo0OUJJ/erwb0Ou7CnNee2EDFquZk7eR4egtLMTVAY6fnRpV7\n\tVjZspaSe8Nlg78/xXHBFUtLZaYHEpnFv1MhTzSapRAo23ePLjdRwx7vqRU7jecDG4kmv\n\tSAQg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=kcs+7eLUM4vgUlECgfwUC3OsX1shv2UyjDhkHGNz4KA=;\n\tb=h5uN6x48AcnoceoISqQAIobZul7aqGMzlqWekDMwo9yFyLpRQg5QYrI5v19uaDRqGP\n\t9FhmWilIBlCmF6+SsssLsFh2QFgWHjfTgLLvRZG3A3M5GmwdGanciLJfHXjNJ78yHYDv\n\tyUEMIhzduoJ78xChFiWG37z6DT1eU4qR/VT3TocqRetzTlFJ1B24zjKEhsL+Aaa+6pm2\n\tNjpj9mAwNiXCcpb7uutmwO6mx4q2pGA1SltuMCef0EM6CqO/cOMl35PJHQtf9kx+gBYR\n\t7XGvxwrN5jsvOdoJob6hRATVYGV9qyJQYteOq7MLGHCc8oyJTHE3F4pjJ7P0bc5yJURN\n\tI+XQ==","X-Gm-Message-State":"AOAM533Ooq7fSwXabKaxdy7/ZN5wlpVeQota6DPxTeNiUxArbGT/7xKU\n\t02ZvtOnrzOiC9efurZLt1pGRh4ujrtmws7LtjkxvwYKIuUQ=","X-Google-Smtp-Source":"ABdhPJwTURFEcyLHQWYKEKiwtsce551SRmtvXRpSKqoOV8j90p6D+2WKIhVc58vB4PKELtd+zrgTE5FXakx1LkRBs5Q=","X-Received":"by 2002:a05:6512:3f1:: with SMTP id\n\tn17mr9750156lfq.125.1593449928145; \n\tMon, 29 Jun 2020 09:58:48 -0700 (PDT)","MIME-Version":"1.0","References":"<20200628231934.29025-1-laurent.pinchart@ideasonboard.com>\n\t<20200628231934.29025-6-laurent.pinchart@ideasonboard.com>\n\t<20200629143255.GE1852218@oden.dyn.berto.se>","In-Reply-To":"<20200629143255.GE1852218@oden.dyn.berto.se>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Mon, 29 Jun 2020 17:58:31 +0100","Message-ID":"<CAEmqJPrzAZzqOgt1H7TXk_Df6XOCqxUGCKkFcuOc=_kHetoZ0Q@mail.gmail.com>","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH v1 5/9] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData","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":11008,"web_url":"https://patchwork.libcamera.org/comment/11008/","msgid":"<20200630103837.hby2tmv7ioix7baw@uno.localdomain>","date":"2020-06-30T10:38:37","subject":"Re: [libcamera-devel] [PATCH v1 5/9] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Mon, Jun 29, 2020 at 02:19:30AM +0300, Laurent Pinchart wrote:\n> The PipelineHandlerRPi::configureIPA() function accesses plenty of\n> member data from the RPiCameraData class and no member from the\n> PipelineHandlerRPi class. Move it to RPiCameraData where it logically\n> belongs.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 117 +++++++++---------\n>  1 file changed, 58 insertions(+), 59 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 3b5cdf1e1849..0f9237a7f346 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -311,6 +311,8 @@ public:\n>  \tvoid frameStarted(uint32_t sequence);\n>\n>  \tint loadIPA();\n> +\tint configureIPA();\n> +\n>  \tvoid queueFrameAction(unsigned int frame, const IPAOperationData &action);\n>\n>  \t/* bufferComplete signal handlers. */\n> @@ -396,8 +398,6 @@ private:\n>  \t\treturn static_cast<RPiCameraData *>(PipelineHandler::cameraData(camera));\n>  \t}\n>\n> -\tint configureIPA(Camera *camera);\n> -\n>  \tint queueAllBuffers(Camera *camera);\n>  \tint prepareBuffers(Camera *camera);\n>  \tvoid freeBuffers(Camera *camera);\n> @@ -752,7 +752,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \tcrop.y = (sensorFormat.size.height - crop.height) >> 1;\n>  \tdata->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop);\n>\n> -\tret = configureIPA(camera);\n> +\tret = data->configureIPA();\n>  \tif (ret)\n>  \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n>\n> @@ -968,62 +968,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n>  \treturn true;\n>  }\n>\n> -int PipelineHandlerRPi::configureIPA(Camera *camera)\n> -{\n> -\tstd::map<unsigned int, IPAStream> streamConfig;\n> -\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n> -\tRPiCameraData *data = cameraData(camera);\n> -\n> -\t/* Get the device format to pass to the IPA. */\n> -\tV4L2DeviceFormat sensorFormat;\n> -\tdata->unicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n> -\t/* Inform IPA of stream configuration and sensor controls. */\n> -\tunsigned int i = 0;\n> -\tfor (auto const &stream : data->isp_) {\n> -\t\tif (stream.isExternal()) {\n> -\t\t\tstreamConfig[i] = {\n> -\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n> -\t\t\t\t.size = stream.configuration().size\n> -\t\t\t};\n> -\t\t}\n> -\t}\n> -\tentityControls.emplace(0, data->unicam_[Unicam::Image].dev()->controls());\n> -\tentityControls.emplace(1, data->isp_[Isp::Input].dev()->controls());\n> -\n> -\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n> -\tif (!data->lsTable_) {\n> -\t\tdata->lsTable_ = data->vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n> -\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(data->lsTable_);\n> -\n> -\t\tif (!data->lsTable_)\n> -\t\t\treturn -ENOMEM;\n> -\n> -\t\t/*\n> -\t\t * The vcsm allocation will always be in the memory region\n> -\t\t * < 32-bits to allow Videocore to access the memory.\n> -\t\t */\n> -\t\tIPAOperationData op;\n> -\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n> -\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n> -\t\t\t    data->vcsm_.getVCHandle(data->lsTable_) };\n> -\t\tdata->ipa_->processEvent(op);\n> -\t}\n> -\n> -\tCameraSensorInfo sensorInfo = {};\n> -\tint ret = data->sensor_->sensorInfo(&sensorInfo);\n> -\tif (ret) {\n> -\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n> -\t\treturn ret;\n> -\t}\n> -\n> -\t/* Ready the IPA - it must know about the sensor resolution. */\n> -\tIPAOperationData ipaConfig;\n> -\tdata->ipa_->configure(sensorInfo, streamConfig, entityControls,\n> -\t\t\t      ipaConfig, nullptr);\n> -\n> -\treturn 0;\n> -}\n> -\n>  int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n>  {\n>  \tRPiCameraData *data = cameraData(camera);\n> @@ -1161,6 +1105,61 @@ int RPiCameraData::loadIPA()\n>  \treturn ipa_->start();\n>  }\n>\n> +int RPiCameraData::configureIPA()\n> +{\n> +\tstd::map<unsigned int, IPAStream> streamConfig;\n> +\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n> +\n> +\t/* Get the device format to pass to the IPA. */\n> +\tV4L2DeviceFormat sensorFormat;\n> +\tunicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n> +\t/* Inform IPA of stream configuration and sensor controls. */\n> +\tunsigned int i = 0;\n> +\tfor (auto const &stream : isp_) {\n> +\t\tif (stream.isExternal()) {\n> +\t\t\tstreamConfig[i] = {\n> +\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n> +\t\t\t\t.size = stream.configuration().size\n> +\t\t\t};\n> +\t\t}\n> +\t}\n> +\tentityControls.emplace(0, unicam_[Unicam::Image].dev()->controls());\n> +\tentityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n> +\n> +\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n> +\tif (!lsTable_) {\n> +\t\tlsTable_ = vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n> +\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(lsTable_);\n> +\n> +\t\tif (!lsTable_)\n> +\t\t\treturn -ENOMEM;\n> +\n> +\t\t/*\n> +\t\t * The vcsm allocation will always be in the memory region\n> +\t\t * < 32-bits to allow Videocore to access the memory.\n> +\t\t */\n> +\t\tIPAOperationData op;\n> +\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n> +\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n> +\t\t\t    vcsm_.getVCHandle(lsTable_) };\n> +\t\tipa_->processEvent(op);\n> +\t}\n> +\n> +\tCameraSensorInfo sensorInfo = {};\n> +\tint ret = sensor_->sensorInfo(&sensorInfo);\n> +\tif (ret) {\n> +\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n> +\t\treturn ret;\n> +\t}\n> +\n> +\t/* Ready the IPA - it must know about the sensor resolution. */\n\n\"Ready the IPA\" ? I didn't get what you mean :)\n\nnit apart\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> +\tIPAOperationData ipaConfig;\n> +\tipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,\n> +\t\t\tnullptr);\n> +\n> +\treturn 0;\n> +}\n> +\n>  void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData &action)\n>  {\n>  \t/*\n> --\n> Regards,\n>\n> Laurent Pinchart\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 04818BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Jun 2020 10:35:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 909F560C57;\n\tTue, 30 Jun 2020 12:35:09 +0200 (CEST)","from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A249609C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Jun 2020 12:35:09 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 8B096C0002;\n\tTue, 30 Jun 2020 10:35:08 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Tue, 30 Jun 2020 12:38:37 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20200630103837.hby2tmv7ioix7baw@uno.localdomain>","References":"<20200628231934.29025-1-laurent.pinchart@ideasonboard.com>\n\t<20200628231934.29025-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200628231934.29025-6-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v1 5/9] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData","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=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11082,"web_url":"https://patchwork.libcamera.org/comment/11082/","msgid":"<20200702210711.GQ12562@pendragon.ideasonboard.com>","date":"2020-07-02T21:07:11","subject":"Re: [libcamera-devel] [PATCH v1 5/9] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Tue, Jun 30, 2020 at 12:38:37PM +0200, Jacopo Mondi wrote:\n> On Mon, Jun 29, 2020 at 02:19:30AM +0300, Laurent Pinchart wrote:\n> > The PipelineHandlerRPi::configureIPA() function accesses plenty of\n> > member data from the RPiCameraData class and no member from the\n> > PipelineHandlerRPi class. Move it to RPiCameraData where it logically\n> > belongs.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  .../pipeline/raspberrypi/raspberrypi.cpp      | 117 +++++++++---------\n> >  1 file changed, 58 insertions(+), 59 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > index 3b5cdf1e1849..0f9237a7f346 100644\n> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > @@ -311,6 +311,8 @@ public:\n> >  \tvoid frameStarted(uint32_t sequence);\n> >\n> >  \tint loadIPA();\n> > +\tint configureIPA();\n> > +\n> >  \tvoid queueFrameAction(unsigned int frame, const IPAOperationData &action);\n> >\n> >  \t/* bufferComplete signal handlers. */\n> > @@ -396,8 +398,6 @@ private:\n> >  \t\treturn static_cast<RPiCameraData *>(PipelineHandler::cameraData(camera));\n> >  \t}\n> >\n> > -\tint configureIPA(Camera *camera);\n> > -\n> >  \tint queueAllBuffers(Camera *camera);\n> >  \tint prepareBuffers(Camera *camera);\n> >  \tvoid freeBuffers(Camera *camera);\n> > @@ -752,7 +752,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n> >  \tcrop.y = (sensorFormat.size.height - crop.height) >> 1;\n> >  \tdata->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop);\n> >\n> > -\tret = configureIPA(camera);\n> > +\tret = data->configureIPA();\n> >  \tif (ret)\n> >  \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n> >\n> > @@ -968,62 +968,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n> >  \treturn true;\n> >  }\n> >\n> > -int PipelineHandlerRPi::configureIPA(Camera *camera)\n> > -{\n> > -\tstd::map<unsigned int, IPAStream> streamConfig;\n> > -\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n> > -\tRPiCameraData *data = cameraData(camera);\n> > -\n> > -\t/* Get the device format to pass to the IPA. */\n> > -\tV4L2DeviceFormat sensorFormat;\n> > -\tdata->unicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n> > -\t/* Inform IPA of stream configuration and sensor controls. */\n> > -\tunsigned int i = 0;\n> > -\tfor (auto const &stream : data->isp_) {\n> > -\t\tif (stream.isExternal()) {\n> > -\t\t\tstreamConfig[i] = {\n> > -\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n> > -\t\t\t\t.size = stream.configuration().size\n> > -\t\t\t};\n> > -\t\t}\n> > -\t}\n> > -\tentityControls.emplace(0, data->unicam_[Unicam::Image].dev()->controls());\n> > -\tentityControls.emplace(1, data->isp_[Isp::Input].dev()->controls());\n> > -\n> > -\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n> > -\tif (!data->lsTable_) {\n> > -\t\tdata->lsTable_ = data->vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n> > -\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(data->lsTable_);\n> > -\n> > -\t\tif (!data->lsTable_)\n> > -\t\t\treturn -ENOMEM;\n> > -\n> > -\t\t/*\n> > -\t\t * The vcsm allocation will always be in the memory region\n> > -\t\t * < 32-bits to allow Videocore to access the memory.\n> > -\t\t */\n> > -\t\tIPAOperationData op;\n> > -\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n> > -\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n> > -\t\t\t    data->vcsm_.getVCHandle(data->lsTable_) };\n> > -\t\tdata->ipa_->processEvent(op);\n> > -\t}\n> > -\n> > -\tCameraSensorInfo sensorInfo = {};\n> > -\tint ret = data->sensor_->sensorInfo(&sensorInfo);\n> > -\tif (ret) {\n> > -\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n> > -\t\treturn ret;\n> > -\t}\n> > -\n> > -\t/* Ready the IPA - it must know about the sensor resolution. */\n> > -\tIPAOperationData ipaConfig;\n> > -\tdata->ipa_->configure(sensorInfo, streamConfig, entityControls,\n> > -\t\t\t      ipaConfig, nullptr);\n> > -\n> > -\treturn 0;\n> > -}\n> > -\n> >  int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n> >  {\n> >  \tRPiCameraData *data = cameraData(camera);\n> > @@ -1161,6 +1105,61 @@ int RPiCameraData::loadIPA()\n> >  \treturn ipa_->start();\n> >  }\n> >\n> > +int RPiCameraData::configureIPA()\n> > +{\n> > +\tstd::map<unsigned int, IPAStream> streamConfig;\n> > +\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n> > +\n> > +\t/* Get the device format to pass to the IPA. */\n> > +\tV4L2DeviceFormat sensorFormat;\n> > +\tunicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n> > +\t/* Inform IPA of stream configuration and sensor controls. */\n> > +\tunsigned int i = 0;\n> > +\tfor (auto const &stream : isp_) {\n> > +\t\tif (stream.isExternal()) {\n> > +\t\t\tstreamConfig[i] = {\n> > +\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n> > +\t\t\t\t.size = stream.configuration().size\n> > +\t\t\t};\n> > +\t\t}\n> > +\t}\n> > +\tentityControls.emplace(0, unicam_[Unicam::Image].dev()->controls());\n> > +\tentityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n> > +\n> > +\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n> > +\tif (!lsTable_) {\n> > +\t\tlsTable_ = vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n> > +\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(lsTable_);\n> > +\n> > +\t\tif (!lsTable_)\n> > +\t\t\treturn -ENOMEM;\n> > +\n> > +\t\t/*\n> > +\t\t * The vcsm allocation will always be in the memory region\n> > +\t\t * < 32-bits to allow Videocore to access the memory.\n> > +\t\t */\n> > +\t\tIPAOperationData op;\n> > +\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n> > +\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n> > +\t\t\t    vcsm_.getVCHandle(lsTable_) };\n> > +\t\tipa_->processEvent(op);\n> > +\t}\n> > +\n> > +\tCameraSensorInfo sensorInfo = {};\n> > +\tint ret = sensor_->sensorInfo(&sensorInfo);\n> > +\tif (ret) {\n> > +\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n> > +\t\treturn ret;\n> > +\t}\n> > +\n> > +\t/* Ready the IPA - it must know about the sensor resolution. */\n> \n> \"Ready the IPA\" ? I didn't get what you mean :)\n\nI didn't mean anything, this patch only moves code :-) But I think it\nmeans https://en.wiktionary.org/wiki/ready#Verb.\n\nWe can update the comment, but I wouldn't do so in this patch.\n\n> nit apart\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> > +\tIPAOperationData ipaConfig;\n> > +\tipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,\n> > +\t\t\tnullptr);\n> > +\n> > +\treturn 0;\n> > +}\n> > +\n> >  void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData &action)\n> >  {\n> >  \t/*","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 01A7FBFFE2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Jul 2020 21:07:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6242A60C56;\n\tThu,  2 Jul 2020 23:07:16 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3DA8C603B4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jul 2020 23:07:15 +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 9C2839CB;\n\tThu,  2 Jul 2020 23:07:14 +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=\"NooV50l8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593724034;\n\tbh=Y0XSI4SxO1QR7xKcD71eJVCMh3QcwY2vlaBdOyXXDgw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=NooV50l8PVbX0Ly1/ylC5Rd0kF8oDc4YLAJY/guOIXmaOFWCiKz+st2L8CW/UYhjZ\n\tFJ9D3L03Yv3k2guFJoHlzoyzVSJoF5dX4q9pqMO6ZcvYQfjaSNBcuQMv18vMgNnwWH\n\tiXP/DVnvwOVQvNGaK3pbS1iZcMVMMjuDjJPkx0DE=","Date":"Fri, 3 Jul 2020 00:07:11 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200702210711.GQ12562@pendragon.ideasonboard.com>","References":"<20200628231934.29025-1-laurent.pinchart@ideasonboard.com>\n\t<20200628231934.29025-6-laurent.pinchart@ideasonboard.com>\n\t<20200630103837.hby2tmv7ioix7baw@uno.localdomain>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200630103837.hby2tmv7ioix7baw@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH v1 5/9] libcamera: pipeline:\n\traspberrypi: Move configureIPA() to RPiCameraData","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=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]