From patchwork Fri Jan 22 09:25:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 10945 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 C7EC4BD808 for ; Fri, 22 Jan 2021 09:25:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8359D68234; Fri, 22 Jan 2021 10:25:45 +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="BzNDN7Fj"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 189E56822E for ; Fri, 22 Jan 2021 10:25:44 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id i63so3645789wma.4 for ; Fri, 22 Jan 2021 01:25:44 -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=1n89ZRC5Vh+k3ELtf1Atij889tc9bzPmkfqXvkbD0y0=; b=BzNDN7Fj5Oulw9csNipRJaaCVFAi2WdmMwWZZGy7O11rfZ3NC5mG2SMyO8tQb/j1aH VSRhNW5tkcbFf3Pua4Y707AwXBcYZ7/ynbKtN5EBuINSeKi+zGEjRAlP51SekN+ZJeQW 76S+RvOaQxntJFO2vYfR0xlEM2V/bkmsvr7/+CzY1dQsFUuNVRHJ+GXUT9cWAIPkiNfu RciknD/FFmamtUcrraeDe0Yt4O4a/LImhihYp4eFi9g+0tdkhXVO0UK7J9Vb0T9TL1KA ZojbYoiMlw80b4enaeY9kEGJSYuEIV25AdqVWvj8REtqjbii8FrA0upytRuhCFrLWzqs KD5g== 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=1n89ZRC5Vh+k3ELtf1Atij889tc9bzPmkfqXvkbD0y0=; b=FMmEEMJsvJKQZXaQjl23zzdFD5l91gVu9UTwu90Cz7zWSnt2Thkk9lRtnb0qrGbiXL grP93ImFZsIN2vu4Yi9wmxMnKe6fQpt/SFwCP1/vlZhG9aeAsYNIuxEjE4SVNLG7B7nL UP0jdyFZKT4ANYA7zGAQVaYW5qIIkE6/o6nOTvpoZNQVYUkiEUm3Z9dZxCKDnV9lQuk+ EvURdUV7xnNRc3y3aSLOTpzmSjprRMxA1QlGl1d1SiYJsHOGplFz856d4dbIEovtkIhE YE5PGPWG9jXWdmegLaqyNE2xBYcmIlLrd7pIU5bMkvMiPhSRs4g0G0/PrWtMO7IPUnSd w5Wg== X-Gm-Message-State: AOAM530Gt/riw8NwR4fErcrsirWz5/qUS7YiX0yqboNo4uGt62gl4u+K eZ0txdelIOjag5qG6Y1poyWYELf6ysfzag== X-Google-Smtp-Source: ABdhPJxqD1znKl5oKHElBjBqSJtD/wMi9ouq82YQF3OVtl33aR1K2KOq2hf+mNsEnerXjv26u9ctLA== X-Received: by 2002:a05:600c:2255:: with SMTP id a21mr3017444wmm.79.1611307543548; Fri, 22 Jan 2021 01:25:43 -0800 (PST) Received: from naushir-VirtualBox.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id h15sm10664801wru.4.2021.01.22.01.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jan 2021 01:25:42 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 22 Jan 2021 09:25:32 +0000 Message-Id: <20210122092537.708375-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210122092537.708375-1-naush@raspberrypi.com> References: <20210122092537.708375-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 --- .../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..7e92f7669126 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. */