{"id":14448,"url":"https://patchwork.libcamera.org/api/1.1/patches/14448/?format=json","web_url":"https://patchwork.libcamera.org/patch/14448/","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":"<20211102025522.735085-2-hiroh@chromium.org>","date":"2021-11-02T02:55:22","name":"[libcamera-devel,v3,2/2] libcamera: pipeline: ipu3: Apply the requested test pattern mode","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"4246d947adc0d0cbe9f124be9d1210f3632e465b","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/14448/mbox/","series":[{"id":2685,"url":"https://patchwork.libcamera.org/api/1.1/series/2685/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2685","date":"2021-11-02T02:55:21","name":"[libcamera-devel,v3,1/2] libcamera: camera_sensor: Enable to set a test pattern mode","version":3,"mbox":"https://patchwork.libcamera.org/series/2685/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14448/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14448/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 1AE91C324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Nov 2021 02:55:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 294C360159;\n\tTue,  2 Nov 2021 03:55:33 +0100 (CET)","from mail-pf1-x436.google.com (mail-pf1-x436.google.com\n\t[IPv6:2607:f8b0:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0C2C860128\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Nov 2021 03:55:32 +0100 (CET)","by mail-pf1-x436.google.com with SMTP id g11so6808868pfv.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 01 Nov 2021 19:55:31 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:da96:7796:6eb0:5a01])\n\tby smtp.gmail.com with ESMTPSA id\n\tn15sm3589677pfv.216.2021.11.01.19.55.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 01 Nov 2021 19:55:29 -0700 (PDT)"],"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=\"Q5AJ93KS\"; 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=AyPVF5b+teiJdYnh1nhGdlslz3kzCEfGpuvgiTubbJ8=;\n\tb=Q5AJ93KSRO5jm4jYjCfQcQdv6R91Pvv1lCZogXXdtNWh8xEIb1DWLrN0k7ZrIFClZ5\n\tedJrWq0QYhmd3hcxa9HBq1qocWFqaO8hbk6ZFT0ZPG8ZZF9cROIW8SALH+CuQRSU2a9Z\n\tKORej+9YYyQXG12JZ1PcZwFrb7lcz9Mpj9gRk=","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=AyPVF5b+teiJdYnh1nhGdlslz3kzCEfGpuvgiTubbJ8=;\n\tb=vg7Vjd4aNVicekv59Q+EhYc2jUKZPTYCI6nIahNGKbmVJ3A6587d81lcF5RprYQpiL\n\te0tdl995Ie/UR15N7lyH2qhQgPXGw9qNj4mN4R1F/aGCEbD+8ZjPkHzTgV8GMtrf8aKQ\n\t+2Q1VmmU/hFxmFkMAZk2OVU11XD+UOlrC1l9ifvyuQRv+/JJNupgJKCcywWZWtz0fK8X\n\ti0/q8tDAm0jKfBarvrLFesruKZXZpXtM/LN1daLXjZ+HE8hshBBPfRU4vVa7sm6fcJ79\n\tNjja/5kyfV+3dfjM/h8mjHPb1VNVItt2yoL2DZt73i5yNWVJcPjQ4SsGT9PLZaZoNsrp\n\tgygg==","X-Gm-Message-State":"AOAM532S9mb/aidocNB5aWWezUItKfT8npfb+bubNw1XUA+Q7/VoU/CT\n\tDwAvRKkOkl05tKDtf0pVwLyAFEKwRrV1pA==","X-Google-Smtp-Source":"ABdhPJxzvJscO+/wH0bAzp6Hd03+W0oZdIpy6yshMmma0VoLt/eO2ydvJIBzALnYb5gTjbFToVjO0A==","X-Received":"by 2002:aa7:8213:0:b0:47b:fc35:db26 with SMTP id\n\tk19-20020aa78213000000b0047bfc35db26mr33459092pfi.1.1635821730318; \n\tMon, 01 Nov 2021 19:55:30 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  2 Nov 2021 11:55:22 +0900","Message-Id":"<20211102025522.735085-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.33.1.1089.g2158813163f-goog","In-Reply-To":"<20211102025522.735085-1-hiroh@chromium.org>","References":"<20211102025522.735085-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 2/2] libcamera: pipeline: ipu3: Apply\n\tthe requested 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 the 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 | 41 ++++++++++++++++++++++++++--\n 1 file changed, 39 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex eb714aa6..e81ba63c 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@@ -78,6 +79,7 @@ public:\n \tstd::unique_ptr<ipa::ipu3::IPAProxyIPU3> ipa_;\n \n \tstd::queue<Request *> pendingRequests_;\n+\tstd::queue<Request *> processingRequests_;\n \n \tControlInfoMap ipaControls_;\n \n@@ -569,6 +571,8 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \tcio2->sensor()->sensorInfo(&sensorInfo);\n \tdata->cropRegion_ = sensorInfo.analogCrop;\n \n+\tcio2->sensor()->setTestPatternMode(controls::draft::TestPatternModeOff);\n+\n \t/*\n \t * Configure the H/V flip controls based on the combination of\n \t * the sensor and user transform.\n@@ -797,11 +801,13 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \tint ret = 0;\n \n \tdata->cancelPendingRequests();\n+\tdata->processingRequests_ = {};\n \n \tdata->ipa_->stop();\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@@ -852,6 +858,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@@ -1130,8 +1138,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@@ -1422,6 +1430,35 @@ 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/* Assumes applying the test pattern mode affects immediately. */\n+\t\tRequest *request = processingRequests_.front();\n+\t\tprocessingRequests_.pop();\n+\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(testPatternMode);\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","v3","2/2"]}