From patchwork Fri Jan 22 13:14:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 10958 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 75424BD808 for ; Fri, 22 Jan 2021 13:14:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3C36C6827B; Fri, 22 Jan 2021 14:14: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="AUtk3XPv"; 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 0E9096826A for ; Fri, 22 Jan 2021 14:14:56 +0100 (CET) Received: by mail-wm1-x32d.google.com with SMTP id c124so4271362wma.5 for ; Fri, 22 Jan 2021 05:14:56 -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:mime-version :content-transfer-encoding; bh=dWRbgbE+HncN05cFEYdg9lbeQWBZhpOTBcbxiMPzCu8=; b=AUtk3XPv/065qGvPxz8xQlLQ5mmzoYIIYIoDsHzTuv3I2NOzfTZk5qZQrHb5yNqdiv nQ+b5PX3JJ8FGFteqBRINtpoPf1Vs2DEMuwWwPpBl6HuHHnbw/PTRydPTYF35/1msD3e tkuBYWGgso6rBp78DHoGEFF0+4RKGaMc47yjVPp5+K/B++vRNhGUcz8cPZiu46ZtN+QS V8rxMS7vqgeGRnvyn2M2BLBwgfrGhje/h7pamVsfIuGow5c3UCAwWLWSZ0QZ9HybZYIH BVtpoicIeZc/1HTAIeyipwEeBd8jnLDRVFytWm8ldpXXj/watVgVxlazJ9r0tMg4R/Pl rtJw== 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:mime-version :content-transfer-encoding; bh=dWRbgbE+HncN05cFEYdg9lbeQWBZhpOTBcbxiMPzCu8=; b=UpR6+HEY1QCfpusggRia9EGtM3C0Q3ZR+EzdL+mAFXaWQm5WWQPNLCHBa+3NwTtym0 xCFOUp2YG8ih2Knt5x52tCut/GEEZ0//zcBll+Nuh8ystcPyEFcFR/Sejd2/Jzaawygk dK1T+VxE17apXrJ6OorCQ9GaAcLDQOao/1TWgOYhOUJ4KGEpy6ycIQHk0ZFo7SzVWoxx 4uxeZT2UZFDRQdqa3Ln5n5qvV4WLnDBqrjWQdurHz3fAdbx9EYBRbLZ8+YvOY+rDk3Vk dPVXIVpBz6wDzY9CJeOcebq32OCHtDmtJealH3LiRdNNOmg0raG1dF2nssF8HvC/UM7V f5AA== X-Gm-Message-State: AOAM530gpteSg2qJC7kO1mSitdQ2zZtVAl7WEd5Rs2RANiPQPWS7g2ev CKjed+sI6Orglftk1rRiCz0YugibR6gU4w== X-Google-Smtp-Source: ABdhPJxGdTjhZPzIbLZbBl3kIYvbVA94V+gb2Oizaf0ka4C+0KRmjalfop2A+Nfjq7gcuOFxbuHqQA== X-Received: by 2002:a7b:cf3a:: with SMTP id m26mr3991369wmg.55.1611321295485; Fri, 22 Jan 2021 05:14:55 -0800 (PST) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id i8sm7228870wry.90.2021.01.22.05.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jan 2021 05:14:54 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 22 Jan 2021 13:14:46 +0000 Message-Id: <20210122131451.726584-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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. */