From patchwork Wed Jun 29 10:30:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 16433 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 26D33BE173 for ; Wed, 29 Jun 2022 10:30:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CF84F6564F; Wed, 29 Jun 2022 12:30:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656498638; bh=7KqNgvMj8FSraVhSOVEy66P80+zobT6EsrmjhpASRWM=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=FPlfBELtbwKp7MaRNAQeaIdzFQoTTUYirUjuzlsj+forNUCkLUSkdHde+APSlTaw0 9+RkxNj0aNrCYlLQdKOdFetOfqbzMiiF91pJFDcCjlseBV5reuFajm0uJh9hTW1Pyb DmUsXjNsSNOj2IhD/fxPsiG4dcE9BRPNn2okL8hZWrnNFRzQs8ibGbYJCOAGKE8ZWg X7+sq+N68xnUMiN9ZlomBfLkmiCKQC91J+yiJZc+LWDnLolUiI3kKXsu3hTXBwF3L1 vvKKN+kvZkvtG7Go1gCE0CdfCWFoR4fUTID7JDXjhkkizheio/p8EejlzaYnLswTBC Z+2tncWHINTnw== Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2AB2565635 for ; Wed, 29 Jun 2022 12:30:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="B4R3dTX2"; dkim-atps=neutral Received: by mail-pf1-x431.google.com with SMTP id k9so5470397pfg.5 for ; Wed, 29 Jun 2022 03:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w8WHyL8X8fhfTwZq5npRafRg2jbSksvdOtNL7mzbwao=; b=B4R3dTX26CHtDR5Xa/DGfx199aNyvuG4yspDHzjhql43P2+qaoJkuCr9mqrmbbp+jd iMYyjNxO1riqpeMm9Mp1ZzQ58Sw8FCNYJzBee6G7EgJQPVbOva6VnbdQuUPOzsDefGuA qlaRd41Jv3AMD7xB5pbWVUcWrsY26elqULcF8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w8WHyL8X8fhfTwZq5npRafRg2jbSksvdOtNL7mzbwao=; b=7i3w8UXGvnsjpiZE4U9HBQm7cNwlFazHPtDXnLQCsoJWoVvAReuK5fn7RXRTW3NehD jg39NNmf9+25DnjYuPrs/rW8OiU7lH+x6/9WH0hD70rFx1yaS1F/quJ+4roqnHkGzz0T r91WByaVGT5dkXjPJ2t1NeJVMGwTfPXOxnSDJ+z+69Fr5JO40g9eU9kYT/LhJd5J6oQD 95evwRVVMrWoHTP21NFK6FlzwdZMhf7zmUDT4JesSN71nywpdWRXpTHp7g7tni2VenBn wn8uQVprZpLGgc+IWYL91674ARroiI6AZhKGCXWQmS7UfZTVxyPBMxPmE55BtJ//C6dK EmtA== X-Gm-Message-State: AJIora9JJh9a+e/GeKETZAc6QdraD6Ru470jAG2/dRZMyRnTfruVc9f8 2nk+JNHM/2D5biYe5GTMcvGW9X+M8q53w3a0 X-Google-Smtp-Source: AGRyM1v26BGDV8+U4CZDaH4znjvOMv9ScM/Uv7W98WJxNLWJf+pCIm0mxpYIZtThvE9JIEx7uLVU3Q== X-Received: by 2002:a63:924f:0:b0:40c:f2d4:27e8 with SMTP id s15-20020a63924f000000b0040cf2d427e8mr2479173pgn.255.1656498631271; Wed, 29 Jun 2022 03:30:31 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (208.158.221.35.bc.googleusercontent.com. [35.221.158.208]) by smtp.gmail.com with ESMTPSA id jb4-20020a170903258400b00169071538a0sm10946059plb.267.2022.06.29.03.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 03:30:30 -0700 (PDT) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Wed, 29 Jun 2022 10:30:16 +0000 Message-Id: <20220629103018.4025635-8-chenghaoyang@google.com> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220629103018.4025635-1-chenghaoyang@google.com> References: <20220629103018.4025635-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 7/9] ipu3: Assign |outCaptureStream| to StillCapture configuration X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Harvey Yang via libcamera-devel From: Cheng-Hao Yang Reply-To: Harvey Yang Cc: Harvey Yang , Harvey Yang Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When StillCapture and other non-raw configurations are requested, assigns |outCaptureStream| instead of |outStream| to the StillCapture configuration. Signed-off-by: Harvey Yang --- src/libcamera/pipeline/ipu3/ipu3.cpp | 50 +++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index ec9d14d1..e26c2736 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -254,8 +254,10 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() * \todo Clarify the IF and BDS margins requirements. */ unsigned int rawCount = 0; - unsigned int yuvCount = 0; + unsigned int videoCount = 0; + unsigned int stillCount = 0; Size maxYuvSize; + Size maxVideoSize; Size rawSize; for (const StreamConfiguration &cfg : config_) { @@ -264,16 +266,29 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) { rawCount++; rawSize.expandTo(cfg.size); + } else if (cfg.streamRole == StreamRole::StillCapture) { + if (stillCount != 0) + return Invalid; + + stillCount++; + maxYuvSize.expandTo(cfg.size); } else { - yuvCount++; + videoCount++; maxYuvSize.expandTo(cfg.size); + maxVideoSize.expandTo(cfg.size); } } - if (rawCount > 1 || yuvCount > 2) { + if (videoCount == 0 && stillCount == 1) { + stillCount = 0; + videoCount = 1; + maxVideoSize.expandTo(maxYuvSize); + } + + if (rawCount > 1 || videoCount > 2) { LOG(IPU3, Debug) << "Camera configuration not supported"; return Invalid; - } else if (rawCount && !yuvCount) { + } else if (rawCount && !stillCount && !videoCount) { /* * Disallow raw-only camera configuration. Currently, ImgU does * not get configured for raw-only streams and has early return @@ -316,6 +331,9 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() ImgUDevice::Pipe pipe{}; pipe.input = cio2Configuration_.size; + ImgUDevice::Pipe pipe1{}; + pipe1.input = cio2Configuration_.size; + /* * Adjust the configurations if needed and assign streams while * iterating them. @@ -380,18 +398,34 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() cfg->stride = info.stride(cfg->size.width, 0, 1); cfg->frameSize = info.frameSize(cfg->size, 1); + if (stillCount == 1 && cfg->streamRole == StreamRole::StillCapture) { + LOG(IPU3, Debug) << "Assigned " + << cfg->toString() + << " to the imgu1 main output"; + cfg->setStream(const_cast(&data_->outCaptureStream_)); + + pipe1.main = cfg->size; + pipe1.viewfinder = pipe1.main; + + pipeConfig1_ = data_->imgu1_->calculatePipeConfig(&pipe1); + if (pipeConfig1_.isNull()) { + LOG(IPU3, Error) << "Failed to calculate pipe configuration: " + << "unsupported resolutions."; + return Invalid; + } /* * Use the main output stream in case only one stream is * requested or if the current configuration is the one * with the maximum YUV output size. */ - if (mainOutputAvailable && - (originalCfg.size == maxYuvSize || yuvCount == 1)) { + } else if (mainOutputAvailable && + (originalCfg.size == maxVideoSize || + videoCount == 1)) { cfg->setStream(const_cast(&data_->outStream_)); mainOutputAvailable = false; pipe.main = cfg->size; - if (yuvCount == 1) + if (videoCount == 1) pipe.viewfinder = pipe.main; LOG(IPU3, Debug) << "Assigned " << cfg->toString() @@ -415,7 +449,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() } /* Only compute the ImgU configuration if a YUV stream has been requested. */ - if (yuvCount) { + if (videoCount) { pipeConfig0_ = data_->imgu0_->calculatePipeConfig(&pipe); if (pipeConfig0_.isNull()) { LOG(IPU3, Error) << "Failed to calculate pipe configuration: "