[{"id":4307,"web_url":"https://patchwork.libcamera.org/comment/4307/","msgid":"<20200326143409.GR20581@pendragon.ideasonboard.com>","date":"2020-03-26T14:34:09","subject":"Re: [libcamera-devel] [PATCH 7/7] libcamera: ipu3: Add support for\n\ta RAW still capture stream","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 Tue, Mar 24, 2020 at 04:51:45PM +0100, Niklas Söderlund wrote:\n> Allow the RAW buffer cycling between CIO2 and IMGU to be memory copied\n> to a new FrameBuffer in a new RAW stream. This allows users to capture\n> the raw Bayer format coming from the sensor.\n> \n> As the RAW frame is memory copied queueing requests with the\n> StillCaptureRaw stream might impact performance.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n> * Changes from RFC\n> - Add definition for IPU3_MAX_STREAMS.\n> - Deal with all IPU3 Bayer patterns.\n> - Rework size logic.\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 99 +++++++++++++++++++++++++---\n>  1 file changed, 91 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index cc602834f24108a7..c1b143e58d0a536e 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -140,11 +140,12 @@ class IPU3Stream : public Stream\n>  {\n>  public:\n>  \tIPU3Stream()\n> -\t\t: active_(false), device_(nullptr)\n> +\t\t: active_(false), raw_(false), device_(nullptr)\n>  \t{\n>  \t}\n>  \n>  \tbool active_;\n> +\tbool raw_;\n>  \tstd::string name_;\n>  \tImgUDevice::ImgUOutput *device_;\n>  };\n> @@ -166,6 +167,7 @@ public:\n>  \n>  \tIPU3Stream outStream_;\n>  \tIPU3Stream vfStream_;\n> +\tIPU3Stream rawStream_;\n>  };\n>  \n>  class IPU3CameraConfiguration : public CameraConfiguration\n> @@ -180,6 +182,7 @@ public:\n>  \n>  private:\n>  \tstatic constexpr unsigned int IPU3_BUFFER_COUNT = 4;\n> +\tstatic constexpr unsigned int IPU3_MAX_STREAMS = 3;\n>  \n>  \tvoid adjustStream(StreamConfiguration &cfg, bool scale);\n>  \n> @@ -304,8 +307,8 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \t\treturn Invalid;\n>  \n>  \t/* Cap the number of entries to the available streams. */\n> -\tif (config_.size() > 2) {\n> -\t\tconfig_.resize(2);\n> +\tif (config_.size() > IPU3_MAX_STREAMS) {\n> +\t\tconfig_.resize(IPU3_MAX_STREAMS);\n>  \t\tstatus = Adjusted;\n>  \t}\n>  \n> @@ -345,6 +348,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \tstd::set<const IPU3Stream *> availableStreams = {\n>  \t\t&data_->outStream_,\n>  \t\t&data_->vfStream_,\n> +\t\t&data_->rawStream_,\n>  \t};\n>  \n>  \tstreams_.clear();\n> @@ -356,7 +360,9 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \t\tconst Size size = cfg.size;\n>  \t\tconst IPU3Stream *stream;\n>  \n> -\t\tif (cfg.size == sensorFormat_.size)\n> +\t\tif (cfg.pixelFormat.modifiers().count(IPU3_FORMAT_MOD_PACKED))\n> +\t\t\tstream = &data_->rawStream_;\n> +\t\telse if (cfg.size == sensorFormat_.size)\n>  \t\t\tstream = &data_->outStream_;\n>  \t\telse\n>  \t\t\tstream = &data_->vfStream_;\n> @@ -367,8 +373,32 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()\n>  \t\tLOG(IPU3, Debug)\n>  \t\t\t<< \"Assigned '\" << stream->name_ << \"' to stream \" << i;\n>  \n> -\t\tbool scale = stream == &data_->vfStream_;\n> -\t\tadjustStream(config_[i], scale);\n> +\t\tif (stream->raw_) {\n> +\t\t\tunsigned int drmfourcc;\n> +\t\t\tswitch (sensorFormat_.mbus_code) {\n> +\t\t\tcase MEDIA_BUS_FMT_SBGGR10_1X10:\n> +\t\t\t\tdrmfourcc = DRM_FORMAT_SBGGR10;\n> +\t\t\t\tbreak;\n> +\t\t\tcase MEDIA_BUS_FMT_SGBRG10_1X10:\n> +\t\t\t\tdrmfourcc = DRM_FORMAT_SGBRG10;\n> +\t\t\t\tbreak;\n> +\t\t\tcase MEDIA_BUS_FMT_SGRBG10_1X10:\n> +\t\t\t\tdrmfourcc = DRM_FORMAT_SGRBG10;\n> +\t\t\t\tbreak;\n> +\t\t\tcase MEDIA_BUS_FMT_SRGGB10_1X10:\n> +\t\t\t\tdrmfourcc = DRM_FORMAT_SRGGB10;\n> +\t\t\t\tbreak;\n\nPut this in a statically declared std::map<uint32_t, PixelFormat>, it\nwill not only simplify lookup but also allow reuse in\ngenerateConfiguration().\n\n> +\t\t\tdefault:\n> +\t\t\t\treturn Invalid;\n> +\t\t\t}\n> +\t\t\tcfg.pixelFormat = PixelFormat(drmfourcc,\n> +\t\t\t\t\t\t      { IPU3_FORMAT_MOD_PACKED });\n> +\t\t\tcfg.size = sensorFormat_.size;\n> +\t\t\tcfg.bufferCount = IPU3_BUFFER_COUNT;\n\nI would move this line after the else below, and remove the\ncorresponding linve from adjustStream().\n\n> +\t\t} else {\n> +\t\t\tbool scale = stream == &data_->vfStream_;\n> +\t\t\tadjustStream(config_[i], scale);\n> +\t\t}\n>  \n>  \t\tif (cfg.pixelFormat != pixelFormat || cfg.size != size) {\n>  \t\t\tLOG(IPU3, Debug)\n> @@ -397,6 +427,7 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \tstd::set<IPU3Stream *> streams = {\n>  \t\t&data->outStream_,\n>  \t\t&data->vfStream_,\n> +\t\t&data->rawStream_,\n>  \t};\n>  \n>  \tconfig = new IPU3CameraConfiguration(camera, data);\n> @@ -438,6 +469,21 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \n>  \t\t\tbreak;\n>  \n> +\t\tcase StreamRole::StillCaptureRaw: {\n\nAs you don't declare local variables, the { } are not necessary.\n\n> +\t\t\tif (streams.find(&data->rawStream_) == streams.end()) {\n> +\t\t\t\tLOG(IPU3, Error)\n> +\t\t\t\t\t<< \"No stream available for requested role \"\n> +\t\t\t\t\t<< role;\n> +\t\t\t\tbreak;\n> +\t\t\t}\n> +\n> +\t\t\tstream = &data->rawStream_;\n> +\n> +\t\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_SRGGB10, { IPU3_FORMAT_MOD_PACKED });\n\nLine folding ?\n\nYou should look up the DRM format based on the Bayer pattern produced by\nthe sensor, exactly as in validate().\n\n> +\t\t\tcfg.size = data->cio2_.sensor_->resolution();\n> +\t\t\tbreak;\n> +\t\t}\n> +\n>  \t\tcase StreamRole::Viewfinder:\n>  \t\tcase StreamRole::VideoRecording: {\n>  \t\t\t/*\n> @@ -571,6 +617,9 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n>  \t\tstream->active_ = true;\n>  \t\tcfg.setStream(stream);\n>  \n\nI think this is worth a comment to explain why.\n\n\t\t/*\n\t\t * The RAW still capture stream just copies buffers from the\n\t\t * internal queue and doesn't need any specific configuration.\n\t\t */\n\nHow about the interesting corner case of an application requesting the\nraw stream only ? :-) This can be fixed later, but please add a \\todo.\n\n> +\t\tif (stream->raw_)\n> +\t\t\tcontinue;\n> +\n>  \t\tret = imgu->configureOutput(stream->device_, cfg);\n>  \t\tif (ret)\n>  \t\t\treturn ret;\n> @@ -621,9 +670,15 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n>  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> -\tV4L2VideoDevice *video = ipu3stream->device_->dev;\n>  \tunsigned int count = stream->configuration().bufferCount;\n> +\tV4L2VideoDevice *video;\n> +\n> +\tif (ipu3stream->raw_)\n> +\t\tvideo = data->cio2_.output_;\n> +\telse\n> +\t\tvideo = ipu3stream->device_->dev;\n\nI don't like special cases much, but I think it's OK for now, we'll do\nmore refactoring later.\n\n>  \n>  \treturn video->exportBuffers(count, buffers);\n>  }\n> @@ -737,6 +792,10 @@ int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n>  \t\tIPU3Stream *stream = static_cast<IPU3Stream *>(it.first);\n>  \t\tbuffer = it.second;\n>  \n> +\t\t/* Skip raw streams, they are copied from the CIO2 buffer. */\n> +\t\tif (stream->raw_)\n> +\t\t\tcontinue;\n> +\n>  \t\tint ret = stream->device_->dev->queueBuffer(buffer);\n>  \t\tif (ret < 0)\n>  \t\t\terror = ret;\n> @@ -831,6 +890,7 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\tstd::set<Stream *> streams = {\n>  \t\t\t&data->outStream_,\n>  \t\t\t&data->vfStream_,\n> +\t\t\t&data->rawStream_,\n>  \t\t};\n>  \t\tCIO2Device *cio2 = &data->cio2_;\n>  \n> @@ -852,6 +912,8 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\tdata->outStream_.name_ = \"output\";\n>  \t\tdata->vfStream_.device_ = &data->imgu_->viewfinder_;\n>  \t\tdata->vfStream_.name_ = \"viewfinder\";\n> +\t\tdata->rawStream_.raw_ = true;\n> +\t\tdata->rawStream_.name_ = \"raw\";\n>  \n>  \t\t/*\n>  \t\t * Connect video devices' 'bufferReady' signals to their\n> @@ -941,7 +1003,28 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n>  \tif (buffer->metadata().status == FrameMetadata::FrameCancelled)\n>  \t\treturn;\n>  \n> -\timgu_->input_->queueBuffer(buffer);\n> +\tRequest *request = buffer->request();\n> +\tFrameBuffer *raw = request->findBuffer(&rawStream_);\n> +\n> +\tif (!raw) {\n> +\t\t/* No RAW buffers present, just queue to IMGU. */\n> +\t\timgu_->input_->queueBuffer(buffer);\n> +\t\treturn;\n> +\t}\n> +\n> +\t/* RAW buffers present, special care is needed. */\n> +\tif (request->buffers().size() > 1)\n> +\t\timgu_->input_->queueBuffer(buffer);\n> +\n> +\tif (raw->copyFrom(buffer))\n> +\t\tLOG(IPU3, Debug) << \"Memcopy of FrameBuffer Failed\";\n\ns/Memcopy/Copy/ ?\ns/Failed/failed/\n\nPretty nice overall, only small changes needed :-)\n\n> +\n> +\tpipe_->completeBuffer(camera_, request, raw);\n> +\n> +\tif (request->buffers().size() == 1) {\n> +\t\tcio2_.putBuffer(buffer);\n> +\t\tpipe_->completeRequest(camera_, request);\n> +\t}\n>  }\n>  \n>  /* -----------------------------------------------------------------------------","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 87C6960410\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 15:34:13 +0100 (CET)","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 035552DC;\n\tThu, 26 Mar 2020 15:34:12 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"UylF71yr\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1585233253;\n\tbh=7lHNo0R5JfeYR8k1zYxgSVfNMHJR2ZyYjCpvnMYVGrk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UylF71yr93QDrltmg88KqbbPGOBT8rrJQIeNN4Bg6YYHL2OGxhIZpu6zfFWt4S4XP\n\twZBkCfpZhcgUiU/wNu6fcHKySenou3pWFUV+mGf5nmSaDfZRhT0E8TbV1VPyMzN2nK\n\tcZxbZ5Tp5VMrQyzPJQM54fP/J2DzODWRzHp/kKnk=","Date":"Thu, 26 Mar 2020 16:34:09 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200326143409.GR20581@pendragon.ideasonboard.com>","References":"<20200324155145.3896183-1-niklas.soderlund@ragnatech.se>\n\t<20200324155145.3896183-8-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200324155145.3896183-8-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 7/7] libcamera: ipu3: Add support for\n\ta RAW still capture stream","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>","X-List-Received-Date":"Thu, 26 Mar 2020 14:34:13 -0000"}},{"id":4329,"web_url":"https://patchwork.libcamera.org/comment/4329/","msgid":"<20200326224041.GA1827962@oden.dyn.berto.se>","date":"2020-03-26T22:40:41","subject":"Re: [libcamera-devel] [PATCH 7/7] libcamera: ipu3: Add support for\n\ta RAW still capture stream","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-03-26 16:34:09 +0200, Laurent Pinchart wrote:\n> > @@ -571,6 +617,9 @@ int PipelineHandlerIPU3::configure(Camera \n> > *camera, CameraConfiguration *c)\n> >  \t\tstream->active_ = true;\n> >  \t\tcfg.setStream(stream);\n> >  \n> \n> I think this is worth a comment to explain why.\n> \n> \t\t/*\n> \t\t * The RAW still capture stream just copies buffers from the\n> \t\t * internal queue and doesn't need any specific configuration.\n> \t\t */\n> \n> How about the interesting corner case of an application requesting the\n> raw stream only ? :-) This can be fixed later, but please add a \\todo.\n> \n\nIt is already handled in this version, checkout \nIPU3CameraData::cio2BufferReady() :-) All special cases are handled raw \nand raw+other streams are handled. Even raw+other stream with request \ncontaining raw, video or raw+video buffers are ok.\n\n$ cam -c2 -s role=stillraw -C\n[0:04:33.966148860] [1345]  INFO Camera camera_manager.cpp:277 libcamera v0.0.0+1214-5c5a378c-dirty\n[0:04:33.974212620] [1346]  INFO IPU3 ipu3.cpp:949 Registered Camera[0] \"ov13858 2-0010 0\" connected to CSI-2 receiver 0\n[0:04:33.974519559] [1346]  INFO IPU3 ipu3.cpp:949 Registered Camera[1] \"ov5670 4-0036 1\" connected to CSI-2 receiver 1\nUsing camera ov5670 4-0036 1\n[0:04:33.975128859] [1345]  INFO Camera camera.cpp:770 configuring streams: (0) 2592x1944-0x30314142\nCapture until user interrupts by SIGINT\nfps: 0.00 stream0 seq: 000001 bytesused: 6469632\nfps: 31.25 stream0 seq: 000002 bytesused: 6469632\nfps: 30.30 stream0 seq: 000003 bytesused: 6469632\nfps: 32.26 stream0 seq: 000004 bytesused: 6469632\nfps: 32.26 stream0 seq: 000005 bytesused: 6469632\nfps: 29.41 stream0 seq: 000006 bytesused: 6469632\nfps: 28.57 stream0 seq: 000007 bytesused: 6469632\nfps: 30.30 stream0 seq: 000008 bytesused: 6469632\nfps: 32.26 stream0 seq: 000009 bytesused: 6469632\nfps: 30.30 stream0 seq: 000010 bytesused: 6469632\nfps: 30.30 stream0 seq: 000011 bytesused: 6469632\nfps: 31.25 stream0 seq: 000012 bytesused: 6469632\n^CExiting","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x144.google.com (mail-lf1-x144.google.com\n\t[IPv6:2a00:1450:4864:20::144])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 68A6860412\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 23:40:43 +0100 (CET)","by mail-lf1-x144.google.com with SMTP id q5so6264458lfb.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 15:40:43 -0700 (PDT)","from localhost (h-200-138.A463.priv.bahnhof.se. [176.10.200.138])\n\tby smtp.gmail.com with ESMTPSA id\n\tl21sm2406798lfh.63.2020.03.26.15.40.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 26 Mar 2020 15:40:41 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com header.b=\"XAYYviEQ\"; \n\tdkim-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=i/l3PuWVHkkgqqJprFkP8+Hgpx9kqoNER7QvWBpVKyo=;\n\tb=XAYYviEQVhBbplzEdVwA4OM2m/jF6Lv2NE33eqn4WF1bxvxrPcWXyYx7jUm53neYqN\n\tg18g7JKkqJ1lC/N8s6dvGcMgqVAxlQQiPgcLYTksv4mgCWbhejGwcgdr5gMeAwyLzkRq\n\tJ+fVsG6+ziX6dj6eMhNAbmLpuVCdRsKAa2PzSvB++4HDwdq1SUA9DOU++O8GuVHHGqXV\n\t4K4MhlUd0c0fNu/0O+jOTPgxL3E2GvMZJFq1E3asPiva6M/N+1gtfjPScF0lIDXMGU0V\n\tlWpUkfxvaKbpLx93Qd9BxXpdEKhy5bUwLoi0+AHAu1uaBzPmts/TKhLXSgX4uwNFcwtq\n\tIKTA==","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=i/l3PuWVHkkgqqJprFkP8+Hgpx9kqoNER7QvWBpVKyo=;\n\tb=AQts9ZQObmfSr1MeRYpSOzU0ZiI+4e/j6P37/Z09JXXFic69/e2aIzMzCjZyPtAekN\n\tXoGfC7XFYYX2m5GYreA8hgsBVmYK7xr7m1ZDxKovGXBbja26zt56aeWAMSFOd3Mtr90X\n\tZOWupG7J75xn/W51uciBGDrC/OrR6P7unGmCSOYI/d/S2LxyiJ2izTraBr3KsdHqFl2b\n\tQShg2qwWU01C4p3/nhK5aqB1AzSTP0XFKbvHqzrA7Apx1HGoLHG7NKR4GWzAl/e/8O52\n\telPtBYTsa3NNu87pevmJCsbvB2sPOSQhSNXcK2P6jXoeAYwDdkMdaWWQyng2vswdnYoZ\n\tOCTQ==","X-Gm-Message-State":"ANhLgQ2YjcTiu9S4tHDnxIVYcRf00Dl3x4Oj3gLb+jW44mjuIsHnjbEa\n\t0VaosnmcbNhatzSo0t6HlCbMGTzh2yo=","X-Google-Smtp-Source":"ADFU+vtKgigwL1GxeYtRrHdJsizh3kEfjjgBsjUrv67mafkXilARX1JcHcFb2Al/8xzoAyC8nQ3bqQ==","X-Received":"by 2002:a19:74c:: with SMTP id 73mr6831543lfh.56.1585262442397; \n\tThu, 26 Mar 2020 15:40:42 -0700 (PDT)","Date":"Thu, 26 Mar 2020 23:40:41 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200326224041.GA1827962@oden.dyn.berto.se>","References":"<20200324155145.3896183-1-niklas.soderlund@ragnatech.se>\n\t<20200324155145.3896183-8-niklas.soderlund@ragnatech.se>\n\t<20200326143409.GR20581@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200326143409.GR20581@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 7/7] libcamera: ipu3: Add support for\n\ta RAW still capture stream","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>","X-List-Received-Date":"Thu, 26 Mar 2020 22:40:43 -0000"}},{"id":4330,"web_url":"https://patchwork.libcamera.org/comment/4330/","msgid":"<20200326224634.GB31213@pendragon.ideasonboard.com>","date":"2020-03-26T22:46:34","subject":"Re: [libcamera-devel] [PATCH 7/7] libcamera: ipu3: Add support for\n\ta RAW still capture stream","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nOn Thu, Mar 26, 2020 at 11:40:41PM +0100, Niklas Söderlund wrote:\n> On 2020-03-26 16:34:09 +0200, Laurent Pinchart wrote:\n> > > @@ -571,6 +617,9 @@ int PipelineHandlerIPU3::configure(Camera \n> > > *camera, CameraConfiguration *c)\n> > >  \t\tstream->active_ = true;\n> > >  \t\tcfg.setStream(stream);\n> > \n> > I think this is worth a comment to explain why.\n> > \n> > \t\t/*\n> > \t\t * The RAW still capture stream just copies buffers from the\n> > \t\t * internal queue and doesn't need any specific configuration.\n> > \t\t */\n> > \n> > How about the interesting corner case of an application requesting the\n> > raw stream only ? :-) This can be fixed later, but please add a \\todo.\n> \n> It is already handled in this version, checkout \n> IPU3CameraData::cio2BufferReady() :-) All special cases are handled raw \n> and raw+other streams are handled. Even raw+other stream with request \n> containing raw, video or raw+video buffers are ok.\n\nBut don't we still configure the ImgU in configure(), and start it in\nstart() ?\n\n> $ cam -c2 -s role=stillraw -C\n> [0:04:33.966148860] [1345]  INFO Camera camera_manager.cpp:277 libcamera v0.0.0+1214-5c5a378c-dirty\n> [0:04:33.974212620] [1346]  INFO IPU3 ipu3.cpp:949 Registered Camera[0] \"ov13858 2-0010 0\" connected to CSI-2 receiver 0\n> [0:04:33.974519559] [1346]  INFO IPU3 ipu3.cpp:949 Registered Camera[1] \"ov5670 4-0036 1\" connected to CSI-2 receiver 1\n> Using camera ov5670 4-0036 1\n> [0:04:33.975128859] [1345]  INFO Camera camera.cpp:770 configuring streams: (0) 2592x1944-0x30314142\n> Capture until user interrupts by SIGINT\n> fps: 0.00 stream0 seq: 000001 bytesused: 6469632\n> fps: 31.25 stream0 seq: 000002 bytesused: 6469632\n> fps: 30.30 stream0 seq: 000003 bytesused: 6469632\n> fps: 32.26 stream0 seq: 000004 bytesused: 6469632\n> fps: 32.26 stream0 seq: 000005 bytesused: 6469632\n> fps: 29.41 stream0 seq: 000006 bytesused: 6469632\n> fps: 28.57 stream0 seq: 000007 bytesused: 6469632\n> fps: 30.30 stream0 seq: 000008 bytesused: 6469632\n> fps: 32.26 stream0 seq: 000009 bytesused: 6469632\n> fps: 30.30 stream0 seq: 000010 bytesused: 6469632\n> fps: 30.30 stream0 seq: 000011 bytesused: 6469632\n> fps: 31.25 stream0 seq: 000012 bytesused: 6469632\n> ^CExiting","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B6E160412\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 23:46:38 +0100 (CET)","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 0BDED2DC;\n\tThu, 26 Mar 2020 23:46:37 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"K8SnVixF\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1585262798;\n\tbh=ERD0lPoe6fIGozEjP++6yCxnAxw/GlJEbWUVMrEKkVE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=K8SnVixFB7QcE016H0biYVHm9iVVMWWhHUGAeu8FZfS8hK3RExUuwSLjW221c0/mb\n\tzpsYlZ/LwyydQbxM8LPBgqwzWW/UxB/TMXd2SaLB2hvysg8Fhye6a8rrozYP8cdDkt\n\t3yN6mQAkn7MT/BHuukyN+FlvqNnc4xcK+n1GCS6Q=","Date":"Fri, 27 Mar 2020 00:46:34 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200326224634.GB31213@pendragon.ideasonboard.com>","References":"<20200324155145.3896183-1-niklas.soderlund@ragnatech.se>\n\t<20200324155145.3896183-8-niklas.soderlund@ragnatech.se>\n\t<20200326143409.GR20581@pendragon.ideasonboard.com>\n\t<20200326224041.GA1827962@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200326224041.GA1827962@oden.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 7/7] libcamera: ipu3: Add support for\n\ta RAW still capture stream","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>","X-List-Received-Date":"Thu, 26 Mar 2020 22:46:38 -0000"}},{"id":4331,"web_url":"https://patchwork.libcamera.org/comment/4331/","msgid":"<20200326225337.GB1827962@oden.dyn.berto.se>","date":"2020-03-26T22:53:37","subject":"Re: [libcamera-devel] [PATCH 7/7] libcamera: ipu3: Add support for\n\ta RAW still capture stream","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nOn 2020-03-27 00:46:34 +0200, Laurent Pinchart wrote:\n> Hi Niklas,\n> \n> On Thu, Mar 26, 2020 at 11:40:41PM +0100, Niklas Söderlund wrote:\n> > On 2020-03-26 16:34:09 +0200, Laurent Pinchart wrote:\n> > > > @@ -571,6 +617,9 @@ int PipelineHandlerIPU3::configure(Camera \n> > > > *camera, CameraConfiguration *c)\n> > > >  \t\tstream->active_ = true;\n> > > >  \t\tcfg.setStream(stream);\n> > > \n> > > I think this is worth a comment to explain why.\n> > > \n> > > \t\t/*\n> > > \t\t * The RAW still capture stream just copies buffers from the\n> > > \t\t * internal queue and doesn't need any specific configuration.\n> > > \t\t */\n> > > \n> > > How about the interesting corner case of an application requesting the\n> > > raw stream only ? :-) This can be fixed later, but please add a \\todo.\n> > \n> > It is already handled in this version, checkout \n> > IPU3CameraData::cio2BufferReady() :-) All special cases are handled raw \n> > and raw+other streams are handled. Even raw+other stream with request \n> > containing raw, video or raw+video buffers are ok.\n> \n> But don't we still configure the ImgU in configure(), and start it in\n> start() ?\n\nAhh yes I see your point. Yes we do configure it but we never use it if \nwe only have a single raw stream. Point taken will add todo for this.\n\n> \n> > $ cam -c2 -s role=stillraw -C\n> > [0:04:33.966148860] [1345]  INFO Camera camera_manager.cpp:277 libcamera v0.0.0+1214-5c5a378c-dirty\n> > [0:04:33.974212620] [1346]  INFO IPU3 ipu3.cpp:949 Registered Camera[0] \"ov13858 2-0010 0\" connected to CSI-2 receiver 0\n> > [0:04:33.974519559] [1346]  INFO IPU3 ipu3.cpp:949 Registered Camera[1] \"ov5670 4-0036 1\" connected to CSI-2 receiver 1\n> > Using camera ov5670 4-0036 1\n> > [0:04:33.975128859] [1345]  INFO Camera camera.cpp:770 configuring streams: (0) 2592x1944-0x30314142\n> > Capture until user interrupts by SIGINT\n> > fps: 0.00 stream0 seq: 000001 bytesused: 6469632\n> > fps: 31.25 stream0 seq: 000002 bytesused: 6469632\n> > fps: 30.30 stream0 seq: 000003 bytesused: 6469632\n> > fps: 32.26 stream0 seq: 000004 bytesused: 6469632\n> > fps: 32.26 stream0 seq: 000005 bytesused: 6469632\n> > fps: 29.41 stream0 seq: 000006 bytesused: 6469632\n> > fps: 28.57 stream0 seq: 000007 bytesused: 6469632\n> > fps: 30.30 stream0 seq: 000008 bytesused: 6469632\n> > fps: 32.26 stream0 seq: 000009 bytesused: 6469632\n> > fps: 30.30 stream0 seq: 000010 bytesused: 6469632\n> > fps: 30.30 stream0 seq: 000011 bytesused: 6469632\n> > fps: 31.25 stream0 seq: 000012 bytesused: 6469632\n> > ^CExiting\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["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 DD35060412\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 23:53:39 +0100 (CET)","by mail-lf1-x143.google.com with SMTP id n20so6279938lfl.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 15:53:39 -0700 (PDT)","from localhost (h-200-138.A463.priv.bahnhof.se. [176.10.200.138])\n\tby smtp.gmail.com with ESMTPSA id\n\td19sm2034388lji.95.2020.03.26.15.53.38\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 26 Mar 2020 15:53:38 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com header.b=\"Nxjbybo/\"; \n\tdkim-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=a5pb6ON+HXJp58HiULQc5YoGAUqF8sCt7GeizgIqPFY=;\n\tb=Nxjbybo/lHav0p5gRUWVsp29SmUTppNU28edEEpSdwFHPAFD6zljw11UReOoKhbvWF\n\tN6+q+NWe2KfgJYzGBRMD42Jda5bWlni9PoCqKQtFIj/L+nhuM4muAihMwhR3zneuBpTO\n\tEXWPWnUbbBQm2FGrsy17emmVVltog+rvxKrApNRqVMtBNWbp0/MSASbHmjzbhN6vCiWZ\n\tNJ0CNwgxMdE3Nr1zJK8K4OKTqc/6/m7t3QQRQxHf4n8lgnEbW0BM/lWWKfnq0nqjLzbj\n\tmsY6gmViFvyCCbuhDNXUHj1gjEpUMfnlDZz4lSTzh1sCuQRQpu2srKmO3HZm8OzR3ds4\n\tcyyA==","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=a5pb6ON+HXJp58HiULQc5YoGAUqF8sCt7GeizgIqPFY=;\n\tb=Qe1fgjHbTimjLpCzlTrplFIiMgGCZRgcDjyMiZ7kUhNs67Axwxvks02gsGGrHRDQqy\n\tYsc7zjRkgUg26CdjOXSX+BKBW2B43oQHGdowQaMyGd/vpAzbP5KsO1Aj6UJZ3Gni1ApZ\n\tubax4axzjVlX5w9apibHpn44+NYSNzktkIoJi2NKkyPTTI4QUMEvgkQ+RT1rSj5hj+sl\n\tgTNsA9Jq66viJ+X/nNq6ouPcuYDcDXExE5bR6WrjzUoKgll3FQS9qcEO90xDvwBlMAJk\n\tHITZLX9P9sOhwg0ry5OK14tYD4KhWQ+4Xp68LsFdVxHxyl+Xs664X2Cr0pdgwCslkPYi\n\tZjig==","X-Gm-Message-State":"ANhLgQ1kChHDJBRgY4JSpu9TN58OqSEVJkV/FAv7FdweaWk37H9vFC4z\n\tjKOCd1/VfwT6gkuw5DMvpy3ul+CohiY=","X-Google-Smtp-Source":"ADFU+vuccPNdDc9a2cilmrKFDAdEeqgl1J5xX30w6rF32pcxE5jaPVOUl/6PUBPQP564xFsF4UpdKA==","X-Received":"by 2002:a19:5019:: with SMTP id e25mr7241064lfb.68.1585263219166;\n\tThu, 26 Mar 2020 15:53:39 -0700 (PDT)","Date":"Thu, 26 Mar 2020 23:53:37 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200326225337.GB1827962@oden.dyn.berto.se>","References":"<20200324155145.3896183-1-niklas.soderlund@ragnatech.se>\n\t<20200324155145.3896183-8-niklas.soderlund@ragnatech.se>\n\t<20200326143409.GR20581@pendragon.ideasonboard.com>\n\t<20200326224041.GA1827962@oden.dyn.berto.se>\n\t<20200326224634.GB31213@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200326224634.GB31213@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 7/7] libcamera: ipu3: Add support for\n\ta RAW still capture stream","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>","X-List-Received-Date":"Thu, 26 Mar 2020 22:53:40 -0000"}}]