From patchwork Mon Feb 8 15:07:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11190 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 23D83BD160 for ; Mon, 8 Feb 2021 15:07:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E82E260D26; Mon, 8 Feb 2021 16:07:56 +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="J6TpuUT8"; dkim-atps=neutral Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 413AC60D18 for ; Mon, 8 Feb 2021 16:07:54 +0100 (CET) Received: by mail-wm1-x32d.google.com with SMTP id j21so10820404wmj.0 for ; Mon, 08 Feb 2021 07:07:54 -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=2fyJrzrB4k8ujzQt1Ep5Gso6AESqBPahpZVRJorJDsA=; b=J6TpuUT8650KCIjaIz3YXDxzvf5absJBMrLpP9Y+IaXHljQ6i2ZbhKTEnM2Al5kj0u eGbnWvFN18EfWgdPO0o7Cf28QuV99/CR2Yv2M/7j6cxuO7nK+QozUZSfBiyHmR2LlALr O+iQSCmNVyP9C59J5+vgowUf40YoQLnmh4+1tIa2VUgqxPJ6oWCzCE86BAqRQ+ZMhixv YiHzhIBxmFMQaq5AMQoCb7jE4s5z0ROgGHd2Y0XvsDcTZ4LYe4j4E51PwTpvuyG3Uuc6 KsP7LK4B0fJ3lwdSCgVE5yIyTMmUg2e4NPfNOeLCyMCvzRqOXmnxi/JnkD+ZEXUBlhzw gLkA== 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=2fyJrzrB4k8ujzQt1Ep5Gso6AESqBPahpZVRJorJDsA=; b=SZI1iS1zSbh+zj70yddNOIruDgZ+qfVJZfHrABYquLoSwjKdipn9AARKck3BpKOY8b sxjCbOUFnfSVW/lDG62jpRmHksD9i/AiQE147Z/BDMfhfDVqmJrYN1V10CMQAqukVph2 g4cd4ZeROMreQOaiQBppZW88VogNGBNWXAK6OO3oz9hiuAHIR9doAPDA9coV5tyJyAjT LEdoyTAa745MqzCTweWcV0sXsFjk+BYX8iIW+NJV3GcFHKHNA77xPYTUnBxKa34jl47+ YVn9SUvQEycmQVfC1dLSYmB8U2Tdub+KOSA98QVgsrH/YhYwTQJ/A9XnLpDKHbrhYd5v GV8A== X-Gm-Message-State: AOAM533cAVhT3VB4Zmv7+4hTx4uYvD/ZaJ9ZW1iurCGUGaNz36pBfg57 YAwlyt48abIcacDoYTNinNJAj7LSpUHRuUX8 X-Google-Smtp-Source: ABdhPJySqkdbkBD6NxXrZblI4uBUHBWyTO4IruQuh+53ysyFifIabn+Mzddn5+CnLzr6bo0s7y6/rQ== X-Received: by 2002:a05:600c:4f93:: with SMTP id n19mr14910253wmq.163.1612796864869; Mon, 08 Feb 2021 07:07:44 -0800 (PST) Received: from naush-laptop.pitowers.org (cust51-dsl50.idnet.net. [212.69.50.51]) by smtp.gmail.com with ESMTPSA id a17sm31261389wrx.63.2021.02.08.07.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 07:07:44 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Feb 2021 15:07:33 +0000 Message-Id: <20210208150738.2293520-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208150738.2293520-1-naush@raspberrypi.com> References: <20210208150738.2293520-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 1/6] 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 Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- .../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 0804a4393c19..183a690dbca1 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -623,52 +623,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 requested format on " << stream->name() + << ", returned " << format.toString(); + return -EINVAL; } + + cfg.setStream(stream); + stream->setExternal(true); } /* ISP statistics output format. */