[{"id":17693,"web_url":"https://patchwork.libcamera.org/comment/17693/","msgid":"<20210622104319.d5sx3q5i3o2mduyq@uno.localdomain>","date":"2021-06-22T10:43:19","subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Hiro\n\nOn Tue, Jun 22, 2021 at 11:36:53AM +0900, Hirokazu Honda wrote:\n> Apply a camera sensor a requested test pattern mode. The test\n\nApply to the ...\n\n> pattern mode can be specified per frame.\n>\n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> ---\n>  src/libcamera/pipeline/ipu3/cio2.cpp | 15 +++++++++++++++\n>  1 file changed, 15 insertions(+)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n> index 8548f749..9d1ff07d 100644\n> --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n> @@ -12,6 +12,7 @@\n>  #include <libcamera/control_ids.h>\n>  #include <libcamera/formats.h>\n>  #include <libcamera/geometry.h>\n> +#include <libcamera/request.h>\n>  #include <libcamera/stream.h>\n>\n>  #include \"libcamera/internal/camera_sensor.h\"\n> @@ -289,6 +290,20 @@ FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n>  \t\tbuffer->setRequest(request);\n>  \t}\n>\n> +\tif (request->controls().contains(controls::draft::TestPatternMode)) {\n> +\t\tconst uint8_t testPatternMode =\n> +\t\t\tstatic_cast<uint8_t>(request->controls().get(\n> +\t\t\t\tcontrols::draft::TestPatternMode));\n> +\t\tint ret = sensor_->setTestPatternMode(testPatternMode);\n> +\t\tif (ret) {\n> +\t\t\tLOG(IPU3, Error)\n> +\t\t\t\t<< \"Failed to set test pattern mode: \" << ret;\n> +\t\t} else {\n> +\t\t\trequest->metadata().set(controls::draft::TestPatternMode,\n> +\t\t\t\t\t\ttestPatternMode);\n> +\t\t}\n> +\t}\n> +\n\nCorrect me if I'm wrong, but if we have 3 buffers queued to the CIO2,\nwe queue a 4th one with test pattern enabled and we enable it on the\nsensor here, won't the 3 frames that complete before this one contain\nthe test pattern ? Cc-ed Laurent to rope him in for this question.\n\nAlso, can we enable/disable test patter while streaming ? Have you\ntested this ?\n\n>  \tint ret = output_->queueBuffer(buffer);\n>  \tif (ret)\n>  \t\treturn nullptr;\n> --\n> 2.32.0.288.g62a8d224e6-goog\n>","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 9D404C321A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Jun 2021 10:42:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1309560297;\n\tTue, 22 Jun 2021 12:42:32 +0200 (CEST)","from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 93C0160292\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jun 2021 12:42:30 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id CFFFE40006;\n\tTue, 22 Jun 2021 10:42:29 +0000 (UTC)"],"Date":"Tue, 22 Jun 2021 12:43:19 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<20210622104319.d5sx3q5i3o2mduyq@uno.localdomain>","References":"<20210622023654.969162-1-hiroh@chromium.org>\n\t<20210622023654.969162-4-hiroh@chromium.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210622023654.969162-4-hiroh@chromium.org>","Subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","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","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17708,"web_url":"https://patchwork.libcamera.org/comment/17708/","msgid":"<CAO5uPHMngWzu--8Bfrm75zxhVYfaotQJMbjNTAqniTbz6M5dug@mail.gmail.com>","date":"2021-06-23T07:36:07","subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Jacopo,\n\nOn Tue, Jun 22, 2021 at 7:42 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> Hi Hiro\n>\n> On Tue, Jun 22, 2021 at 11:36:53AM +0900, Hirokazu Honda wrote:\n> > Apply a camera sensor a requested test pattern mode. The test\n>\n> Apply to the ...\n>\n> > pattern mode can be specified per frame.\n> >\n> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > ---\n> >  src/libcamera/pipeline/ipu3/cio2.cpp | 15 +++++++++++++++\n> >  1 file changed, 15 insertions(+)\n> >\n> > diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n> > index 8548f749..9d1ff07d 100644\n> > --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n> > @@ -12,6 +12,7 @@\n> >  #include <libcamera/control_ids.h>\n> >  #include <libcamera/formats.h>\n> >  #include <libcamera/geometry.h>\n> > +#include <libcamera/request.h>\n> >  #include <libcamera/stream.h>\n> >\n> >  #include \"libcamera/internal/camera_sensor.h\"\n> > @@ -289,6 +290,20 @@ FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n> >               buffer->setRequest(request);\n> >       }\n> >\n> > +     if (request->controls().contains(controls::draft::TestPatternMode)) {\n> > +             const uint8_t testPatternMode =\n> > +                     static_cast<uint8_t>(request->controls().get(\n> > +                             controls::draft::TestPatternMode));\n> > +             int ret = sensor_->setTestPatternMode(testPatternMode);\n> > +             if (ret) {\n> > +                     LOG(IPU3, Error)\n> > +                             << \"Failed to set test pattern mode: \" << ret;\n> > +             } else {\n> > +                     request->metadata().set(controls::draft::TestPatternMode,\n> > +                                             testPatternMode);\n> > +             }\n> > +     }\n> > +\n>\n> Correct me if I'm wrong, but if we have 3 buffers queued to the CIO2,\n> we queue a 4th one with test pattern enabled and we enable it on the\n> sensor here, won't the 3 frames that complete before this one contain\n> the test pattern ? Cc-ed Laurent to rope him in for this question.\n>\n> Also, can we enable/disable test patter while streaming ? Have you\n> tested this ?\n\nI haven't tested that. We don't have such a test.\nI have the same question. My guess is applying the test pattern mode\non fly affects the preceding queued buffers.\nIn intel HAL implementation, it waits until the preceding queued\nbuffers have been dequeued before applying the test pattern mode.\nWe have to do that in libcamera too.\n\n-Hiro\n\n\n>\n> >       int ret = output_->queueBuffer(buffer);\n> >       if (ret)\n> >               return nullptr;\n> > --\n> > 2.32.0.288.g62a8d224e6-goog\n> >","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 5470FC321B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Jun 2021 07:36:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 90F5C68938;\n\tWed, 23 Jun 2021 09:36:18 +0200 (CEST)","from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com\n\t[IPv6:2a00:1450:4864:20::52d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6CA6968931\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jun 2021 09:36:17 +0200 (CEST)","by mail-ed1-x52d.google.com with SMTP id i24so2094860edx.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jun 2021 00:36:17 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"QoCnp9+4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=73tBjViPIRTpkwjFIJnf98LJcwoj68GXD9lCqdDXLpU=;\n\tb=QoCnp9+4SLybEiYysLX7rLwnML8pneOxQYfkmFNL4a1WPa1SA3tsiRCKIpm8WUGtCq\n\t/X78KNZAw5/t9l+7OMB/KbWbQR5SZTHXKfEN2RDhtA87CpSNpFCRK5r/5Pmm9OJbvElW\n\tu1uKuRxhQ6St/cgSFXseY0qyc0mX6JksHUTW8=","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;\n\tbh=73tBjViPIRTpkwjFIJnf98LJcwoj68GXD9lCqdDXLpU=;\n\tb=C/xP/FceTp8K2goC/q+pepmLY1rjGZaUF7FIJY0VCvbcKng29d4h/UMeS8ObmEzGHj\n\tQj86lGtRh0+MVMg/E1D1EHaVMjADjL5pAlKiNmgNDPhsCni0gbBoCDLztQ7C4t1ZAOMl\n\tSBtCrMiXlp+4xECVea/IpsYcz9ABxGi9iDSmwp/ot8FKnCVHLE9bOPEzuIiRVGnFwZFf\n\tRGsFaQXplBKYawoSBpsS1zVpOUtZF4KSCTl8OXP1+PoLnKtbFKXblrMjbSJ4ba8Xc9n1\n\tA4UqQCCUGCPbUe0dRQAbblAeMZM3S6aFmU+koUs0C4PmTEFYHt9/OKTJmDAtWVPneL2n\n\t2wYg==","X-Gm-Message-State":"AOAM5311JbIfrtHep1UkSoi/Qiqr3hOle87HfW34n0PRzyR/2nW9f8h3\n\tdLYPtZyxDuWJCL4+vROwtReacbIMBJLoAjl9+uGBNA==","X-Google-Smtp-Source":"ABdhPJzz2rFmRZtYXJh2G8apoDCn5qXYR0gfhjDU8ubKs3/TwFNjrK6XTe16p5Xvjb93Dj3UjHmrk6mxTVs8N68Zb+U=","X-Received":"by 2002:a05:6402:524b:: with SMTP id\n\tt11mr10642481edd.327.1624433777136; \n\tWed, 23 Jun 2021 00:36:17 -0700 (PDT)","MIME-Version":"1.0","References":"<20210622023654.969162-1-hiroh@chromium.org>\n\t<20210622023654.969162-4-hiroh@chromium.org>\n\t<20210622104319.d5sx3q5i3o2mduyq@uno.localdomain>","In-Reply-To":"<20210622104319.d5sx3q5i3o2mduyq@uno.localdomain>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Wed, 23 Jun 2021 16:36:07 +0900","Message-ID":"<CAO5uPHMngWzu--8Bfrm75zxhVYfaotQJMbjNTAqniTbz6M5dug@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17715,"web_url":"https://patchwork.libcamera.org/comment/17715/","msgid":"<CAO5uPHPT52XjL-+zmmOVFVT_uR8g7tt6mqJz5qa6=OVw6-amVg@mail.gmail.com>","date":"2021-06-23T08:08:38","subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"+Laurent Pinchart\n\nOn Wed, Jun 23, 2021 at 4:36 PM Hirokazu Honda <hiroh@chromium.org> wrote:\n>\n> Hi Jacopo,\n>\n> On Tue, Jun 22, 2021 at 7:42 PM Jacopo Mondi <jacopo@jmondi.org> wrote:\n> >\n> > Hi Hiro\n> >\n> > On Tue, Jun 22, 2021 at 11:36:53AM +0900, Hirokazu Honda wrote:\n> > > Apply a camera sensor a requested test pattern mode. The test\n> >\n> > Apply to the ...\n> >\n> > > pattern mode can be specified per frame.\n> > >\n> > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > > ---\n> > >  src/libcamera/pipeline/ipu3/cio2.cpp | 15 +++++++++++++++\n> > >  1 file changed, 15 insertions(+)\n> > >\n> > > diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n> > > index 8548f749..9d1ff07d 100644\n> > > --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n> > > +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n> > > @@ -12,6 +12,7 @@\n> > >  #include <libcamera/control_ids.h>\n> > >  #include <libcamera/formats.h>\n> > >  #include <libcamera/geometry.h>\n> > > +#include <libcamera/request.h>\n> > >  #include <libcamera/stream.h>\n> > >\n> > >  #include \"libcamera/internal/camera_sensor.h\"\n> > > @@ -289,6 +290,20 @@ FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n> > >               buffer->setRequest(request);\n> > >       }\n> > >\n> > > +     if (request->controls().contains(controls::draft::TestPatternMode)) {\n> > > +             const uint8_t testPatternMode =\n> > > +                     static_cast<uint8_t>(request->controls().get(\n> > > +                             controls::draft::TestPatternMode));\n> > > +             int ret = sensor_->setTestPatternMode(testPatternMode);\n> > > +             if (ret) {\n> > > +                     LOG(IPU3, Error)\n> > > +                             << \"Failed to set test pattern mode: \" << ret;\n> > > +             } else {\n> > > +                     request->metadata().set(controls::draft::TestPatternMode,\n> > > +                                             testPatternMode);\n> > > +             }\n> > > +     }\n> > > +\n> >\n> > Correct me if I'm wrong, but if we have 3 buffers queued to the CIO2,\n> > we queue a 4th one with test pattern enabled and we enable it on the\n> > sensor here, won't the 3 frames that complete before this one contain\n> > the test pattern ? Cc-ed Laurent to rope him in for this question.\n> >\n> > Also, can we enable/disable test patter while streaming ? Have you\n> > tested this ?\n>\n> I haven't tested that. We don't have such a test.\n> I have the same question. My guess is applying the test pattern mode\n> on fly affects the preceding queued buffers.\n> In intel HAL implementation, it waits until the preceding queued\n> buffers have been dequeued before applying the test pattern mode.\n> We have to do that in libcamera too.\n>\n\nLaurent, what do you think the best to do this?\nI am thinking to wait in each pipeline handler by queueing pending\ncapture requests until that time.\n\n> -Hiro\n>\n>\n> >\n> > >       int ret = output_->queueBuffer(buffer);\n> > >       if (ret)\n> > >               return nullptr;\n> > > --\n> > > 2.32.0.288.g62a8d224e6-goog\n> > >","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 27617C321A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Jun 2021 08:08:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DD72368934;\n\tWed, 23 Jun 2021 10:08:49 +0200 (CEST)","from mail-ej1-x631.google.com (mail-ej1-x631.google.com\n\t[IPv6:2a00:1450:4864:20::631])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CC13268932\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jun 2021 10:08:48 +0200 (CEST)","by mail-ej1-x631.google.com with SMTP id bu12so2732191ejb.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jun 2021 01:08:48 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"GhG1Ge4g\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=9y14aTIkxfVxy4lTIH/FalY73Twy2n7PBpbbVUePN54=;\n\tb=GhG1Ge4gsgqotBBLo4u9DBMfPdAOjxcvMPSU1EUalncdQYIYbby1SvmPU0D9LOCrjT\n\tnsiFZp0awfZeOSgD5awNhZKqBkCc0yIBsc0i2+Oidy7VvD+AIX6uSfKDKTeVXN5I4iln\n\t3liZvSz/y5M6I9kK4NNonbS43F7v8rTX+Rhgc=","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;\n\tbh=9y14aTIkxfVxy4lTIH/FalY73Twy2n7PBpbbVUePN54=;\n\tb=VpesUUbfJHhykfyZs+/d3R9Q/jC4r8Gih/HzOhYazPOoyrrSXbn4ryPY0xHIidBx7Z\n\tfrG8xmayOpd82hIDhgqrEecE3Kn5srOb0eXwQgwiX5jg2jRsueyyYRyHGpACQnQv8b7n\n\tBSGmbVvft8wg9tsQrPRRtFIuVMGGubQLNWkvycqp4HATECyMQNDCwNgXpyERkl0IV2tk\n\tEGKPw+A72OTYYBKb1nmvKbjbnHvnXwggrIgcC568muTLNubQnEJktXVJAO8Xuo6VMFB+\n\tMJnZ+Bw+ahGfRg59/yoHSZ62dlPhxzYWrKyV+6OVvLEzmNt88+EvOlfbb2BE5pqYYoV6\n\tD8HQ==","X-Gm-Message-State":"AOAM531LZKtUkWFiv9SEpiXLtnm0pnSR367ffhDe1XyuN6rjqM6YjzV0\n\ttsodaMflVppigI8W5bobl8K9kq1g32jNk2b7OFHYNg==","X-Google-Smtp-Source":"ABdhPJxZOpasmx6xozGlvT51XUgC4j2FcwLX/HEV6hMYT1Zm7dr14Z8DZ4v0PnLtMEuLDuvmiwLyCoXzn4t8nOm2jVU=","X-Received":"by 2002:a17:906:f8da:: with SMTP id\n\tlh26mr5724357ejb.243.1624435728529; \n\tWed, 23 Jun 2021 01:08:48 -0700 (PDT)","MIME-Version":"1.0","References":"<20210622023654.969162-1-hiroh@chromium.org>\n\t<20210622023654.969162-4-hiroh@chromium.org>\n\t<20210622104319.d5sx3q5i3o2mduyq@uno.localdomain>\n\t<CAO5uPHMngWzu--8Bfrm75zxhVYfaotQJMbjNTAqniTbz6M5dug@mail.gmail.com>","In-Reply-To":"<CAO5uPHMngWzu--8Bfrm75zxhVYfaotQJMbjNTAqniTbz6M5dug@mail.gmail.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Wed, 23 Jun 2021 17:08:38 +0900","Message-ID":"<CAO5uPHPT52XjL-+zmmOVFVT_uR8g7tt6mqJz5qa6=OVw6-amVg@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17720,"web_url":"https://patchwork.libcamera.org/comment/17720/","msgid":"<28f7bf74-2b88-6f2d-0f27-a5caa5b18c3c@ideasonboard.com>","date":"2021-06-23T09:26:27","subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 22/06/2021 11:43, Jacopo Mondi wrote:\n> On Tue, Jun 22, 2021 at 11:36:53AM +0900, Hirokazu Honda wrote:\n>> Apply a camera sensor a requested test pattern mode. The test\n> \n> Apply to the ...\n\n\n\"Apply the requested test pattern mode to the camera sensor.\"","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 26842C321B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Jun 2021 09:26:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6EC3368935;\n\tWed, 23 Jun 2021 11:26:32 +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 A711C68931\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jun 2021 11:26:30 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2BADC9B1;\n\tWed, 23 Jun 2021 11:26:30 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AivI7YxU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624440390;\n\tbh=yXUoZzFGpOHLMmde5tI3ghGp7PXH6m0G6I7r4Tb1aaA=;\n\th=Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=AivI7YxU3m9jGhsKx6cIBjPJ5gxHy496d/GOp8m3UDDZ9F6F1ThGnnJVnaKd+DAUS\n\twCAi1NoTo9WCAAxmhico7lawNdqq+zc/fexTSNWLONNDL6ctL4xl09bVfrRuASrtvd\n\tz5GJXVwhKQyjhaDV2Dq4MykpqAT7tvAhj3yOwe8k=","To":"Jacopo Mondi <jacopo@jmondi.org>, Hirokazu Honda <hiroh@chromium.org>","References":"<20210622023654.969162-1-hiroh@chromium.org>\n\t<20210622023654.969162-4-hiroh@chromium.org>\n\t<20210622104319.d5sx3q5i3o2mduyq@uno.localdomain>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<28f7bf74-2b88-6f2d-0f27-a5caa5b18c3c@ideasonboard.com>","Date":"Wed, 23 Jun 2021 10:26:27 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.8.1","MIME-Version":"1.0","In-Reply-To":"<20210622104319.d5sx3q5i3o2mduyq@uno.localdomain>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","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","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17845,"web_url":"https://patchwork.libcamera.org/comment/17845/","msgid":"<YNlDlrI58kGItULt@pendragon.ideasonboard.com>","date":"2021-06-28T03:35:50","subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Hiro,\n\nOn Wed, Jun 23, 2021 at 05:08:38PM +0900, Hirokazu Honda wrote:\n> On Wed, Jun 23, 2021 at 4:36 PM Hirokazu Honda wrote:\n> > On Tue, Jun 22, 2021 at 7:42 PM Jacopo Mondi wrote:\n> > > On Tue, Jun 22, 2021 at 11:36:53AM +0900, Hirokazu Honda wrote:\n> > > > Apply a camera sensor a requested test pattern mode. The test\n> > >\n> > > Apply to the ...\n> > >\n> > > > pattern mode can be specified per frame.\n> > > >\n> > > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > > > ---\n> > > >  src/libcamera/pipeline/ipu3/cio2.cpp | 15 +++++++++++++++\n> > > >  1 file changed, 15 insertions(+)\n> > > >\n> > > > diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n> > > > index 8548f749..9d1ff07d 100644\n> > > > --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n> > > > +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n> > > > @@ -12,6 +12,7 @@\n> > > >  #include <libcamera/control_ids.h>\n> > > >  #include <libcamera/formats.h>\n> > > >  #include <libcamera/geometry.h>\n> > > > +#include <libcamera/request.h>\n> > > >  #include <libcamera/stream.h>\n> > > >\n> > > >  #include \"libcamera/internal/camera_sensor.h\"\n> > > > @@ -289,6 +290,20 @@ FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n> > > >               buffer->setRequest(request);\n> > > >       }\n> > > >\n> > > > +     if (request->controls().contains(controls::draft::TestPatternMode)) {\n> > > > +             const uint8_t testPatternMode =\n> > > > +                     static_cast<uint8_t>(request->controls().get(\n> > > > +                             controls::draft::TestPatternMode));\n> > > > +             int ret = sensor_->setTestPatternMode(testPatternMode);\n> > > > +             if (ret) {\n> > > > +                     LOG(IPU3, Error)\n> > > > +                             << \"Failed to set test pattern mode: \" << ret;\n> > > > +             } else {\n> > > > +                     request->metadata().set(controls::draft::TestPatternMode,\n> > > > +                                             testPatternMode);\n> > > > +             }\n> > > > +     }\n> > > > +\n> > >\n> > > Correct me if I'm wrong, but if we have 3 buffers queued to the CIO2,\n> > > we queue a 4th one with test pattern enabled and we enable it on the\n> > > sensor here, won't the 3 frames that complete before this one contain\n> > > the test pattern ? Cc-ed Laurent to rope him in for this question.\n> > >\n> > > Also, can we enable/disable test patter while streaming ? Have you\n> > > tested this ?\n> >\n> > I haven't tested that. We don't have such a test.\n> > I have the same question. My guess is applying the test pattern mode\n> > on fly affects the preceding queued buffers.\n> > In intel HAL implementation, it waits until the preceding queued\n> > buffers have been dequeued before applying the test pattern mode.\n> > We have to do that in libcamera too.\n\nYes, this needs to be handled correctly to work in per-frame-control\nmode.\n\n> Laurent, what do you think the best to do this?\n> I am thinking to wait in each pipeline handler by queueing pending\n> capture requests until that time.\n\nImplementing this in the pipeline handler is the way to go. The IPA also\nneeds to implement such a mechanism for most controls. We could handle\nthe test pattern mode the same way by passing it to the IPA that would\npass it back at the right time, but this isn't implemented in the\nopen-source IPU3 IPA yet, and it would likely complicate support of the\nclosed-source IPA. I'm thus thinking it may be better to handle the test\npattern mode in the pipeline handler. The implementation should keep\nrequests in a queue, and apply the correct control value in the handler\nof the CIO2 frameStart signal. I'd do this in ipu3.cpp, not cio2.cpp.\nThe frameStart signal is currently connected to the\nDelayedControls::applyControls() function, you will need to connect it\nto a function of IPU3CameraData, call DelayedControls::applyControls()\nthere, and apply the test pattern control too.\n\n> > > >       int ret = output_->queueBuffer(buffer);\n> > > >       if (ret)\n> > > >               return nullptr;","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 006E7C321A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Jun 2021 03:35:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6BA49684D5;\n\tMon, 28 Jun 2021 05:35:53 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D80F96028C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jun 2021 05:35:51 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 57ECF57E;\n\tMon, 28 Jun 2021 05:35:51 +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=\"rOJSnDiT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624851351;\n\tbh=w0LYk2c9TJaKUPJ5PPm/+EtCJoeGJsLVNVBUd+uM8CA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=rOJSnDiT/NLagPyB7OMcjRyVW4b+NPK0mVCsx5jwmPrvspc7MU9sOmHzRZ9fTYz6a\n\tiADaonot+FyZjM+wWAV8FbNAhLXmHhnmLZ6VfB/QhSrkCRERBtyjFbjy3lpKs7YsBJ\n\t+scD4ZfoYeMsai1v9XPLCRL2JZKz2CBJFA7RQvU8=","Date":"Mon, 28 Jun 2021 06:35:50 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<YNlDlrI58kGItULt@pendragon.ideasonboard.com>","References":"<20210622023654.969162-1-hiroh@chromium.org>\n\t<20210622023654.969162-4-hiroh@chromium.org>\n\t<20210622104319.d5sx3q5i3o2mduyq@uno.localdomain>\n\t<CAO5uPHMngWzu--8Bfrm75zxhVYfaotQJMbjNTAqniTbz6M5dug@mail.gmail.com>\n\t<CAO5uPHPT52XjL-+zmmOVFVT_uR8g7tt6mqJz5qa6=OVw6-amVg@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAO5uPHPT52XjL-+zmmOVFVT_uR8g7tt6mqJz5qa6=OVw6-amVg@mail.gmail.com>","Subject":"Re: [libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a\n\trequested test pattern mode","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]