From patchwork Tue Jan 26 16:24:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11010 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 4C928C0F2B for ; Tue, 26 Jan 2021 16:24:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1F4D66831C; Tue, 26 Jan 2021 17:24:20 +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="X8EeQbms"; dkim-atps=neutral Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4ACE168312 for ; Tue, 26 Jan 2021 17:24:18 +0100 (CET) Received: by mail-wm1-x331.google.com with SMTP id j18so2961184wmi.3 for ; Tue, 26 Jan 2021 08:24:18 -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=UyFjSnujeS0bFhaSast+12b5DEuvqd6mLGYgdgtqrLs=; b=X8EeQbmstPDazgYMl25LVW5B8LFWsNNmXmhY4eNytAwPgxaFsfudt8OPlL6AgGour6 1lgeKBmN1cAq+GYd94L3q+H5Ue2Mlrix5uI6KzK7PTBkV6tzj9X8MqKUy9Nudf92pOLZ 3DbHsIY3S2Y/2HCTGpi0vM6cjEwYgbozEOaAVXaEVGZs3+s9rI0S+RDBKbZid4KAmrWB BhLvLVZsN+e6Na4jBP90wmxK2LR2fBPWvNGxmRA4KNHjeEYe1lrVgiVpwkpk/qIx1kFe 6/Itfq4tqMSFQIQWDcWRWRbHdldOy8yiFby4nTbzSeC/M5Un6q+x7rgs0u0dF0Edmrwy yg1A== 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=UyFjSnujeS0bFhaSast+12b5DEuvqd6mLGYgdgtqrLs=; b=mQX6v1LbeeNno/uevPsBC8KbDUxdJ4TBs7RhvC7+ZxTEfBwyrTy/1UnF4XZ4AkmLE1 Au5YQrpwUbPu931k1skUXpArck+Sesv4pdYI0sizk33FcMuqHrexhP0siiIzpOx29I8u /nzvIUiXwf4OnbA8lsQlAqUxKJyjmaIo1uCu/NflKGnOHCzvkLEcWG9ARedwjA3DdG46 PkQmPxtPijyO+qkScRl0oMq/zhU4nvq1ixN6TRFavNsvGCyc+ScNqUUh0fv7GGX9Egi2 QB/9OWvAXfLmMOEFsnz/PmN67oWcTuuDHzhMt7bzSWmEj8YGwWcYf+8fnm9An9vJ+Sd2 tvvw== X-Gm-Message-State: AOAM530qtKpEJNJjmmFgDRTryCkdNLqeya2472VZz/76a16aP/+kP0Wj JSC500CSViWBDL8G+4JYv7BFJfoqv0MIFxfV X-Google-Smtp-Source: ABdhPJwYeYmBSxdbo3VDSZ/rKwOVtmI8+WDid0CNYd0ItJHBQbdNXhNpooDmu5wd2iOlwXbRWHWt8A== X-Received: by 2002:a1c:3b02:: with SMTP id i2mr438213wma.141.1611678257693; Tue, 26 Jan 2021 08:24:17 -0800 (PST) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id m18sm8725809wrx.17.2021.01.26.08.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 08:24:17 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Jan 2021 16:24:07 +0000 Message-Id: <20210126162412.824033-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210126162412.824033-1-naush@raspberrypi.com> References: <20210126162412.824033-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 --- .../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 524cc960dd37..d9895c779725 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 get requested format on " << stream->name() + << ", returned " << format.toString(); + return -EINVAL; } + + cfg.setStream(stream); + stream->setExternal(true); } /* ISP statistics output format. */