From patchwork Wed Jan 20 08:34:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 10905 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 9053DC0F2A for ; Wed, 20 Jan 2021 08:34:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C4C8568178; Wed, 20 Jan 2021 09:34:57 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="HvgQ1heE"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC81168174 for ; Wed, 20 Jan 2021 09:34:55 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id l12so16981456wry.2 for ; Wed, 20 Jan 2021 00:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8CsZbCNSoM5n/uECUpVfmsDnCu3jKktYa/VPQ0evMBI=; b=HvgQ1heES08ymj40Lr09kpTbmNZ4LyE4QfCwyu3dCvzW369Rtpw0706Rb06siZUTXc U9brRf4OK1cS4EM6IMM3hy8qGjIg/5Sb5kMSQQFaF+tf+qJEKbsqyQwGwSNDGTHTGzWS g+uEXrWumWUBkAMOGpZf29FpiniiE5VvpF8mzKBAqMGOIwYGEYDZ1Sx+1KiBAsGXhRUp oz9PnIMzlmbvNk3uCZHLaOOya1CC23S/9KQ27fQwzgQ8mz1Do4uvUEWv9BFiXQnsBM8T djtnoA+m0c1rj3dwsBH9XzNbkys7osOxptbss7Q12IeQsYitT+iOsGjdxjU/r84Y2mZx lJew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8CsZbCNSoM5n/uECUpVfmsDnCu3jKktYa/VPQ0evMBI=; b=t3TTVqy3FvjXYc9clbXeI8D4lMppLECNwG6X4yPuEiNASsozWwnMUYEacEjhr1HLlf DOWwRZ0OI5gQUMrAtWD6Orzx0WSwjjlk/ng2zX6UrgPhY5gAm2wy3N4P19fefnKgQptO 4AglMW1qxLZOJp/PojPRcTSR8YmUWEJdLMP0mXGysn3MGO14TqgASWZ/FHY+aIaTmSqY 4OUM78qVaD9qMbYzPzcoou/EpmCmIDwZTFQZaEjWXXQuEevmCfaJ3vydDnfGAYfpqnlW JNBmqKxXCPP/0nEGpi1ktKdaEwO0mVWQ7wVJOhlwrgXqxpF+AdwgESmnJNEocYGBmmZ9 DFfA== X-Gm-Message-State: AOAM533vpkyb61S3WWEHyB7iePxMkTZSq6fAyUMwRPvHVluYrE29l29D PoYR3azU75UHEe5JKv/mF9Irv50ACqrWXQ== X-Google-Smtp-Source: ABdhPJyuyR9Dosczh3mi7Mj2Pdc2A+n3hD7RBaO2bCGgt8dBdVIU/VJ3akp0CGTF6k91lPKhcJ9MZQ== X-Received: by 2002:adf:ce90:: with SMTP id r16mr8217214wrn.100.1611131695213; Wed, 20 Jan 2021 00:34:55 -0800 (PST) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id 33sm2809284wrn.35.2021.01.20.00.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 00:34:54 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Jan 2021 08:34:45 +0000 Message-Id: <20210120083449.642418-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210120083449.642418-1-naush@raspberrypi.com> References: <20210120083449.642418-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/5] pipeline: raspberrypi: Refactor stream configuration routine 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Refactor the high/low resolution stream format and output selection routine. This change is in preparation of adding 1/4 resolution output for fast colour denoise. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- .../pipeline/raspberrypi/raspberrypi.cpp | 57 ++++++------------- 1 file changed, 16 insertions(+), 41 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index f121328ee9a9..e03bcb036f9f 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -624,52 +624,27 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) continue; } - if (i == maxIndex) { - /* ISP main output format. */ - V4L2VideoDevice *dev = data->isp_[Isp::Output0].dev(); - V4L2PixelFormat fourcc = dev->toV4L2PixelFormat(cfg.pixelFormat); - format.size = cfg.size; - format.fourcc = fourcc; - - ret = dev->setFormat(&format); - if (ret) - return -EINVAL; - - if (format.size != cfg.size || format.fourcc != fourcc) { - LOG(RPI, Error) - << "Failed to set format on ISP capture0 device: " - << format.toString(); - return -EINVAL; - } - - cfg.setStream(&data->isp_[Isp::Output0]); - data->isp_[Isp::Output0].setExternal(true); - } + /* The largest resolution gets routed to the ISP Output 0 node. */ + RPi::Stream *stream = (i == maxIndex) ? &data->isp_[Isp::Output0] : + &data->isp_[Isp::Output1]; - /* - * ISP second output format. This fallthrough means that if a - * second output stream has not been configured, we simply use - * the Output0 configuration. - */ - V4L2VideoDevice *dev = data->isp_[Isp::Output1].dev(); - format.fourcc = dev->toV4L2PixelFormat(cfg.pixelFormat); + V4L2PixelFormat fourcc = stream->dev()->toV4L2PixelFormat(cfg.pixelFormat); format.size = cfg.size; + format.fourcc = fourcc; - ret = dev->setFormat(&format); - if (ret) { + ret = stream->dev()->setFormat(&format); + if (ret) + return -EINVAL; + + if (format.size != cfg.size || format.fourcc != fourcc) { LOG(RPI, Error) - << "Failed to set format on ISP capture1 device: " - << format.toString(); - return ret; - } - /* - * If we have not yet provided a stream for this config, it - * means this is to be routed from Output1. - */ - if (!cfg.stream()) { - cfg.setStream(&data->isp_[Isp::Output1]); - data->isp_[Isp::Output1].setExternal(true); + << "Failed to set format on " << stream->name() + << " to " << format.toString(); + return -EINVAL; } + + cfg.setStream(stream); + stream->setExternal(true); } /* ISP statistics output format. */