{"id":14730,"url":"https://patchwork.libcamera.org/api/1.1/patches/14730/?format=json","web_url":"https://patchwork.libcamera.org/patch/14730/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20211123190812.69805-4-hiroh@chromium.org>","date":"2021-11-23T19:08:12","name":"[libcamera-devel,v7,3/3] libcamera: pipeline: ipu3: Apply a requested test pattern mode","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"4a4b3f82a3d77f2af97cfc0c3f64084209f6af3f","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14730/mbox/","series":[{"id":2748,"url":"https://patchwork.libcamera.org/api/1.1/series/2748/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2748","date":"2021-11-23T19:08:09","name":"Enable to apply test pattern mode in IPU3","version":7,"mbox":"https://patchwork.libcamera.org/series/2748/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14730/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14730/checks/","tags":{},"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 DF52EBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 19:08:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9C5CE60230;\n\tTue, 23 Nov 2021 20:08:28 +0100 (CET)","from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com\n\t[IPv6:2607:f8b0:4864:20::102b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B4C0D60121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 20:08:26 +0100 (CET)","by mail-pj1-x102b.google.com with SMTP id\n\tw33-20020a17090a6ba400b001a722a06212so2732491pjj.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 11:08:26 -0800 (PST)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:cc8f:f5a6:5a9f:7275])\n\tby smtp.gmail.com with ESMTPSA id\n\tt4sm14550916pfq.163.2021.11.23.11.08.23\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 23 Nov 2021 11:08:24 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"e5s5yaVj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=NAGwrqk/6sxLdYfulrdkK4538cN3U1ACtQJMMm76BKM=;\n\tb=e5s5yaVjR9BQNRCsVz09r1DbU5cvZekHsVSCFnhvZjHC+Vq1zUUed0zHkg+qOeJ9DK\n\tdrlG1Owch40bodxIl9haPKUrYrz7Oycioh+oeKAyodHw7DtNbdpAcsYuHhHiUXVOGzQb\n\t4BuipZ/8CASQJNAc9GV4pK9+wCQ4HluNKk2bQ=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=NAGwrqk/6sxLdYfulrdkK4538cN3U1ACtQJMMm76BKM=;\n\tb=JTM9AcJqODMBRiZK0fzO3lyL5a+U5iLMcOtQglKiCpX1kTzW/kSp7B/720GdmmSUmP\n\t/UiyAFMlZxGYMY+C98iI+qAJMJOYgJV0oRaQV1ePasXG3f5MPF7uHYpf0rcv/cdSC2XP\n\tG2zaxaaQZIVtycv+1cqSUl05PrDSfFkgN9uIqMDxDxxSK5k1Fv5jrWb5QUwjh6F39B71\n\txOg3B62KSCscq7hQ/XT+I4Za1aAWQLoKc+/Z1oxO+7rMbc62H8DVbMJ4HCrrXaS1xmQq\n\tS/egwRHhG0DCNUeCbdoLBaVYSeu0+4MCxJBNW63C5kGcOzYDylsV9mo9unTYWeDp8ApX\n\tfsIQ==","X-Gm-Message-State":"AOAM530kp7UUa88OggUb4F031dtBtNGGcD/4//8bS7hJiNLKab08UzpU\n\tsBKLjSEOA8x0tYX8f3BKkzdEkD01QvstFA==","X-Google-Smtp-Source":"ABdhPJy+F6U8LOZ5fyoSWUYJWXwY3XRbNd8zsHrmOZGNAVLTOADW1SVpfO92IobzRiUTFGND9w7Uxw==","X-Received":"by 2002:a17:90b:30c4:: with SMTP id\n\thi4mr5981503pjb.12.1637694504636; \n\tTue, 23 Nov 2021 11:08:24 -0800 (PST)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 24 Nov 2021 04:08:12 +0900","Message-Id":"<20211123190812.69805-4-hiroh@chromium.org>","X-Mailer":"git-send-email 2.34.0.rc2.393.gf8c9666880-goog","In-Reply-To":"<20211123190812.69805-1-hiroh@chromium.org>","References":"<20211123190812.69805-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v7 3/3] libcamera: pipeline: 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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This enables ipu3 pipeline handler to apply a test pattern mode\nper frame.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 45 ++++++++++++++++++++++++++--\n 1 file changed, 43 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 25490dcf..a15c6466 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -59,6 +59,7 @@ public:\n \tvoid statBufferReady(FrameBuffer *buffer);\n \tvoid queuePendingRequests();\n \tvoid cancelPendingRequests();\n+\tvoid frameStart(uint32_t sequence);\n \n \tCIO2Device cio2_;\n \tImgUDevice *imgu_;\n@@ -76,7 +77,10 @@ public:\n \n \tstd::unique_ptr<ipa::ipu3::IPAProxyIPU3> ipa_;\n \n+\t/* Requests before queueing cio2 device. */\n \tstd::queue<Request *> pendingRequests_;\n+\t/* Requests queued in cio2 device and before passing imgu device. */\n+\tstd::queue<Request *> processingRequests_;\n \n \tControlInfoMap ipaControls_;\n \n@@ -803,6 +807,7 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \n \tret |= data->imgu_->stop();\n \tret |= data->cio2_.stop();\n+\n \tif (ret)\n \t\tLOG(IPU3, Warning) << \"Failed to stop camera \" << camera->id();\n \n@@ -823,6 +828,8 @@ void IPU3CameraData::cancelPendingRequests()\n \t\tpipe()->completeRequest(request);\n \t\tpendingRequests_.pop();\n \t}\n+\n+\tprocessingRequests_ = {};\n }\n \n void IPU3CameraData::queuePendingRequests()\n@@ -853,6 +860,8 @@ void IPU3CameraData::queuePendingRequests()\n \n \t\tinfo->rawBuffer = rawBuffer;\n \n+\t\tprocessingRequests_.push(request);\n+\n \t\tipa::ipu3::IPU3Event ev;\n \t\tev.op = ipa::ipu3::EventProcessControls;\n \t\tev.frame = info->id;\n@@ -1121,8 +1130,8 @@ int PipelineHandlerIPU3::registerCameras()\n \t\tdata->delayedCtrls_ =\n \t\t\tstd::make_unique<DelayedControls>(cio2->sensor()->device(),\n \t\t\t\t\t\t\t  params);\n-\t\tdata->cio2_.frameStart().connect(data->delayedCtrls_.get(),\n-\t\t\t\t\t\t &DelayedControls::applyControls);\n+\t\tdata->cio2_.frameStart().connect(data.get(),\n+\t\t\t\t\t\t &IPU3CameraData::frameStart);\n \n \t\t/* Convert the sensor rotation to a transformation */\n \t\tint32_t rotation = 0;\n@@ -1414,6 +1423,38 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)\n \tipa_->processEvent(ev);\n }\n \n+void IPU3CameraData::frameStart(uint32_t sequence)\n+{\n+\tif (!processingRequests_.empty()) {\n+\t\t/* Handle controls which are to be set ready for the next frame to start. */\n+\t\tRequest *request = processingRequests_.front();\n+\t\tprocessingRequests_.pop();\n+\n+\t\t/* Assumes applying the test pattern mode affects immediately. */\n+\t\tif (request->controls().contains(controls::draft::TestPatternMode)) {\n+\t\t\tconst int32_t testPatternMode = request->controls().get(\n+\t\t\t\tcontrols::draft::TestPatternMode);\n+\n+\t\t\tLOG(IPU3, Debug) << \"Apply test pattern mode: \"\n+\t\t\t\t\t << testPatternMode;\n+\n+\t\t\tint ret = cio2_.sensor()->setTestPatternMode(\n+\t\t\t\tstatic_cast<controls::draft::TestPatternModeEnum>(\n+\t\t\t\t\ttestPatternMode));\n+\t\t\tif (ret) {\n+\t\t\t\tLOG(IPU3, Error) << \"Failed to set test pattern mode: \"\n+\t\t\t\t\t\t << ret;\n+\t\t\t} else {\n+\t\t\t\trequest->metadata().set(controls::draft::TestPatternMode,\n+\t\t\t\t\t\t\ttestPatternMode);\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* Controls that don't affect immediately are applied in delayedCtrls. */\n+\tdelayedCtrls_->applyControls(sequence);\n+}\n+\n REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3)\n \n } /* namespace libcamera */\n","prefixes":["libcamera-devel","v7","3/3"]}