From patchwork Thu May 26 08:27:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 16056 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 D527CC326E for ; Thu, 26 May 2022 08:28:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1202B65664; Thu, 26 May 2022 10:28:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653553681; bh=5DWQPKQJNZ3aN5Ll1FqAzZ3Y6qxHFg+oJJ2OYbVcQP0=; 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=Sgt1ccCdXCk14a+sinZjG4i8hbEnVi0wQWzyk4YaI8IlMu6c3WVSlImzDT57/nkbp y133ocxmaiXB6nSZcV9plMHUkPcK1vIVg7naWDAXDoc1W+3EnUj54Lo6vWBr8ncdVY 3Ey31f1SU3eM6REqVChYZergJaYkaSM4W4wNKL86tZVRPTGHz/JUNyM5DzL0VZaYem B1kifyI1wqEDI3i0HHMYjINzA5cgzdsKxVzXqF5AjwiDMfuT9YujmT7jcs/izBCAZX Irh85R0jtBead3BACuOve0K1EgfujFkhYykg9YBYMWQ7bqyw4kwEHTOh3/R7WxWZRe fIpj79FeBmYAw== Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5EAD165673 for ; Thu, 26 May 2022 10:27:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="J4wbGulQ"; dkim-atps=neutral Received: by mail-pf1-x433.google.com with SMTP id c65so566293pfb.1 for ; Thu, 26 May 2022 01:27:58 -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=br19rRUuI9uyuNQeeSthuD63ktHSskA8R1maEa7PYJ4=; b=J4wbGulQGvxghZx3kz5mv5KjT3I3MJC8Xhbz8SxnQOiZQzWBpV8EG/939RmowJ9h41 m0gv8RxS77oiH3ubuhHsl+cGMW6ablVS1ASvEd71x/FazmF8chhU1TGvM8bnquPpAys7 v5HFm0O9A5XAS17jQ47fGdH7ztlRB5VXcWTSU= 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=br19rRUuI9uyuNQeeSthuD63ktHSskA8R1maEa7PYJ4=; b=rfwnUWvk2uCKjAux9aaoYwLw6RNceygEpN7fV+TeGeGibsHbcCwUXLOgZ4eVZxi5zo u3odiHr3G5+LOLKwmWeO2huP5ooiYeLEOVfvn+8oZPyu9kT2PngYMLKOG/1ZyabDpmOE 2KRpQg6hkvYfnClxODvbkrDQ6SmbHaOgyhO7LFlwkh24L3kjo/t/ikNSyFXYIh1ILXj+ 3xeMo0sPaPIThc5QdGQ8+Ofb690jcyrOgSBNwrbbAW1usdF4qdDjCttxnT7UD/mEKFI/ FqEK7VXrxuLvCqfOwXLvwL9DblweSHQJ3RUkHqGBje2IBRAXynpn0LzphkHuBUVRhlMA 1NLw== X-Gm-Message-State: AOAM530fNXlNawPr4Ny3dH6VOOkEp++skCW+56quyPFuGu4+Z7eeHfD9 FF+1uAMr0RFLhpeKL1tU1HNJehW+v5kruOhH X-Google-Smtp-Source: ABdhPJx1LRZX4rvMeyUwyS0su+m0XDZF3zFOVFnTbJyQToijONMaRxO7j270A1Sjm68YYWLN0kcykg== X-Received: by 2002:a63:864a:0:b0:3fa:dca8:ef5e with SMTP id x71-20020a63864a000000b003fadca8ef5emr6279809pgd.38.1653553676574; Thu, 26 May 2022 01:27:56 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (21.160.199.104.bc.googleusercontent.com. [104.199.160.21]) by smtp.gmail.com with ESMTPSA id m2-20020a170902bb8200b0016191b843e2sm834429pls.235.2022.05.26.01.27.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 01:27:55 -0700 (PDT) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Thu, 26 May 2022 08:27:35 +0000 Message-Id: <20220526082737.1081262-8-chenghaoyang@google.com> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog In-Reply-To: <20220526082737.1081262-1-chenghaoyang@google.com> References: <20220526082737.1081262-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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: Harvey 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: "