From patchwork Fri Dec 3 11:32:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15009 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 153BFBF415 for ; Fri, 3 Dec 2021 11:32:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3033E60832; Fri, 3 Dec 2021 12:32:10 +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="OXKkxh96"; 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 1BDF560725 for ; Fri, 3 Dec 2021 12:32:09 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so4600357wmj.5 for ; Fri, 03 Dec 2021 03:32:09 -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=drbl14TmP776mHISQhRttxrZ0MX/2xfGQmpopOm+l1A=; b=OXKkxh96LoVYVLyawwJbCsi/+J9fv/aQDMoTIvATHGK/9gPp90FbPUuy09BseuzhKd iZ1Ci64Y3SHFAGT7Yj/JXXxvRt7EAGs9QZZw+a0+JgTJdbTQLH0ShPERO6UhIihXgpjZ M0Z0yVVepxr4nNppUGDjB42/wv+eS03VCOp5eM2JkV0mujjE2gLBCvzEpigLXVu7rAz1 pBq5fJ6w5uM086Q0qmVTN4hxww9JAl0c9XxRwN6J3VODf7J9vjKnAt+e5I0drL2HSPMc bRdJOVjY+AbAqVDTwEiFDufjHt+YHq4ApiXu0z9q5YF6QGYaN0PpJd40/dsrHIpFowGU 1pWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=drbl14TmP776mHISQhRttxrZ0MX/2xfGQmpopOm+l1A=; b=Rc6N8vjnZccyGSWeGy49DgOET/4YpQgKgfB7MlW56sVxsAcWLm/S0F725hayy44OIM +MJBWlFM2kG6rMXiM+Kauj8ercRvZ2cL5UW4HicCyyKc8RlbkcaIObTRbzaB9hSsT0YM 0QyQy6bEso3Aykzc+Adt/4P/PriM1g9qBokQex1Vq1KZXR0zXhGm72h3E2VmsNl8DsH6 Z3sO6L1dsTUm/duloR1SyGsrWO1/BDc2Gm9lvDgoVinoBZpLThu+fvs3TdX4bxvq3OmH cSJtb40nf3x/HpuF/bBgTTfsbL/46cLDxrWbz1Ulgujypm37ZYrPSRE7oYIXfopPMiUH M3ZQ== X-Gm-Message-State: AOAM532vDomI8gkaoaIpDY+IxF5AOeBfrg19ARDS6DotmaG+n0Vsu1Rw fZGxnsk2rxE7ddJLfTL5s3lsH4mOyEPmNnHc X-Google-Smtp-Source: ABdhPJzQ5awXEC2owmwNMtFmw8yqy0/aNyls+PRgjakL6Voe8COkgLOTInyw1pamS20oir427/Nm6w== X-Received: by 2002:a1c:9dc7:: with SMTP id g190mr14316539wme.130.1638531128172; Fri, 03 Dec 2021 03:32:08 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:f90b:ce61:df54:5de7]) by smtp.gmail.com with ESMTPSA id m125sm4813688wmm.39.2021.12.03.03.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 03:32:07 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Dec 2021 11:32:05 +0000 Message-Id: <20211203113205.2470651-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1] pipeline: raspberrypi: Return the sensor formats from generateConfiguration() 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" Return the available sensor PixelFormats and sizes from generateConfiguration() if the StreamRole is set to StreamRole::Raw. The existing code returns the PixelFormats and sizes for all other StreamRole types. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- .../pipeline/raspberrypi/raspberrypi.cpp | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 5b76916e9e98..cbfb58562626 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -595,12 +595,23 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, return nullptr; } - /* Translate the V4L2PixelFormat to PixelFormat. */ std::map> deviceFormats; - for (const auto &format : fmts) { - PixelFormat pf = format.first.toPixelFormat(); - if (pf.isValid()) - deviceFormats[pf] = format.second; + if (role == StreamRole::Raw) { + /* Translate the MBUS codes to a PixelFormat. */ + for (const auto &format : data->sensorFormats_) { + PixelFormat pf = mbusCodeToPixelFormat(format.first, + BayerFormat::Packing::CSI2); + if (pf.isValid()) + deviceFormats.emplace(std::piecewise_construct, std::forward_as_tuple(pf), + std::forward_as_tuple(format.second.begin(), format.second.end())); + } + } else { + /* Translate the V4L2PixelFormat to PixelFormat. */ + for (const auto &format : fmts) { + PixelFormat pf = format.first.toPixelFormat(); + if (pf.isValid()) + deviceFormats[pf] = format.second; + } } /* Add the stream format based on the device node used for the use case. */