From patchwork Thu Nov 18 16:42:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14634 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 46D39BDB1C for ; Thu, 18 Nov 2021 16:43:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EECEC60378; Thu, 18 Nov 2021 17:43:11 +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="SEiecxE/"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D23A660231 for ; Thu, 18 Nov 2021 17:43:10 +0100 (CET) Received: by mail-wr1-x433.google.com with SMTP id u1so12719149wru.13 for ; Thu, 18 Nov 2021 08:43:10 -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=cXVNeGLXDz6JtvQxKGu1TUTRWymUo0eSitm6CGOcfkI=; b=SEiecxE/Rw9nDwpAV7Awd0e5H6AkwVhFZFawFE4fo3xflHUH91SBneN2FSplL6kD+3 DGne+S2yNFl6gJGsTxJlXb233G89HE1Nq7Blv0CgCPbp6dsT9n9vgyoDR8VFTEOQsRAt /6P4RHZdDdMrWnE9sePLuXPqTKghAHoMdod9i8gfibv4D5O+fXzlJ6PA2soHS+WoGr3S NvIzAe2NhP9N0FT/mckJA6MAz5DG77lsN3qpSNUqBmg41J8NzxxTiexfPOvLCrWi036d ikD7F7zMoj7u1mASTBcZzd80MzahiKgd6YWUqk6vAjloKpj5klso9XbujnWaPH2zT7Oe F8Jg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=cXVNeGLXDz6JtvQxKGu1TUTRWymUo0eSitm6CGOcfkI=; b=MnLJRV7xprtzeCoFm3Y5K7tdQAfNN/CVeMpvCrfOuNC6kZ5iCkD3i5afHP0Bio75b1 Z7vSKk5OTHbBa+eaCd52KuCcu62Qn7EYhZa76KjZm0TisTNev3Bdv1Ht5jrv4RzANFo4 mrbiPRHhCwM4Q6Tvg/g6ZQxtYfnOyD4jeuJmc3zGgr1k8KvbW/StdS7pimk/PrDV+acQ rZS8qVk9MhLnfRIOL5yatsrFQ1wjgqKxxIkHXIGdf4ojoWcjoR5B7U/kUVVzF5msp6XU 8Uaq1QD4lTPK407EnVAlU8GwsrWQfh+joDdkxkfXdcdpaYSHrSrmRDwdyoBTi6WAu1al FDlw== X-Gm-Message-State: AOAM531u3nTuT+ikaiaXPZek+X8FTZKO2kMNyIWWignuiqV9VQzDNJjv 7MHbFtATSzdUdHonYQsvoDEDRcCcPWKewBpu X-Google-Smtp-Source: ABdhPJxdnghQUjowsnulE3ES4nKut4RJ/6HoUyiy+UD2iWSdCFYt2wxtyzdQtpIg99Y7C92CbncEow== X-Received: by 2002:a5d:43c5:: with SMTP id v5mr33502486wrr.11.1637253790421; Thu, 18 Nov 2021 08:43:10 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:328d:499d:f54a:e461]) by smtp.gmail.com with ESMTPSA id a1sm496246wri.89.2021.11.18.08.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 08:43:03 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Nov 2021 16:42:13 +0000 Message-Id: <20211118164216.2669449-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211118164216.2669449-1-naush@raspberrypi.com> References: <20211118164216.2669449-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/4] pipeline: raspberrypi: Add const qualifer in isRaw() 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" This function does not modify the pixFmt parameter, so use a const qualifier. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 5e1f227398a9..11d3c2b120dd 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -96,7 +96,7 @@ V4L2DeviceFormat toV4L2DeviceFormat(const V4L2SubdeviceFormat &format, return deviceFormat; } -bool isRaw(PixelFormat &pixFmt) +bool isRaw(const PixelFormat &pixFmt) { /* * The isRaw test might be redundant right now the pipeline handler only From patchwork Thu Nov 18 16:42:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14635 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 DEE58BDB1C for ; Thu, 18 Nov 2021 16:43:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9A6BD60231; Thu, 18 Nov 2021 17:43:18 +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="LS22uVRC"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E469D60231 for ; Thu, 18 Nov 2021 17:43:16 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id r9-20020a7bc089000000b00332f4abf43fso6178159wmh.0 for ; Thu, 18 Nov 2021 08:43:16 -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=xASTrRlxATWNruYLPbJ8vWIhjvUUsiGBYeSYgllvUWY=; b=LS22uVRCVSXjUWCDBqToExFDod3gE7Z5DD5O+0TT2K2XxscI6md7898zf8fuTKGYrB 4UQ95DAgSyRJtsJVcmoNiNFiLvCZv67y/dvPY2FZWjmaEvJxluAqkopSW3li/5DrVJAd VU8xrTMdMEur1aXmUoGGjQ4hrx62nbSFN4GjIB5RMBZb5OXZw3jTaOmSTAVbpRvxyhS3 uJuXMIdKyDXnFb4Z2YZV55B0L3wnbDFSew6+ucQ6++osZY1QHV6pp45dbwRUnlWS+qgP k9pCMQflOLhZMez3S2d2kM4Lp7/3lW0ujDz81+480mKiQE2u20XxbTy7BudfKcy1VVaw I5nQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=xASTrRlxATWNruYLPbJ8vWIhjvUUsiGBYeSYgllvUWY=; b=st9aMm/TWeS7FZFIKvkBxmgBOcvm+7+LQX1RsVt6dBAoBhw2QmBf+iBOty+YzaBgOc tWjakueqDee09GwXtAl6PSFW1L1wSLFpUQIY6yL+8oYVK/Se3rN7xHkwPUdBKRonbtd2 Q2HF3sndyJUUzVcUfvvIkVYOzuBAISJUhDHPbNwRzhHpNXolXsjr7KtLlkRWlRlfpklz iv+0bu4bSaDi5rsL0gCCo6GZQgCc7V0o8aw5H5dzqyRj7sEycd4smV7GEAjYXAjPdFoj S1iDbSeEJy2wFmmGc6q3qQqCgOx9XK/C82DLwCN+8sUvLC7qCuCm93G4px9w8xlJZrv2 ex9Q== X-Gm-Message-State: AOAM531kjHmmbgnSFLvfo9CQxVFRoS7iKcx6ZuxcvCIyE8vq1UvYz3e7 aAKtKSOm5Ix8SM1q9QG8eO19m4DEh6eENZqa X-Google-Smtp-Source: ABdhPJwzhZp7+qUybkZUqtrEmFhrPXbSOZGAJn2nnWAyFSHOeXIepCqGKgenPKo6fhkQl+TUazk91A== X-Received: by 2002:a05:600c:4982:: with SMTP id h2mr11710505wmp.4.1637253796433; Thu, 18 Nov 2021 08:43:16 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:328d:499d:f54a:e461]) by smtp.gmail.com with ESMTPSA id a1sm496246wri.89.2021.11.18.08.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 08:43:11 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Nov 2021 16:42:14 +0000 Message-Id: <20211118164216.2669449-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211118164216.2669449-1-naush@raspberrypi.com> References: <20211118164216.2669449-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/4] pipeline: raspberrypi: Rework the internal buffer allocation scheme 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" For simplicity, the pipeline handler currently look at the maximum number of buffers set in the StreamConfiguration by the user and allocate the same number of internal buffers for all device nodes. This would likely overallocate buffers for some nodes. Rework this logic to try and minimise overallcations without compromising performance. The key change is to mostly decouple the number of internal buffers allocated from number of buffers requested by the user through the StreamConfiguration. For ISP nodes, we only ever need 1 set of internal buffers, as the hardware runs synchronous with the requests and IPA. For Unicam nodes, allocate a minimum for 4 buffers (exported + internal), but also require at least 2 internal buffers to minimise frame drops. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- .../pipeline/raspberrypi/raspberrypi.cpp | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 11d3c2b120dd..4f6c699a4379 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1211,21 +1211,42 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera) int PipelineHandlerRPi::prepareBuffers(Camera *camera) { RPiCameraData *data = cameraData(camera); + unsigned int numRawBuffers = 0; int ret; - /* - * Decide how many internal buffers to allocate. For now, simply look - * at how many external buffers will be provided. We'll need to improve - * this logic. However, we really must have all streams allocate the same - * number of buffers to simplify error handling in queueRequestDevice(). - */ - unsigned int maxBuffers = 0; - for (const Stream *s : camera->streams()) - if (static_cast(s)->isExternal()) - maxBuffers = std::max(maxBuffers, s->configuration().bufferCount); + for (Stream *s : camera->streams()) { + if (isRaw(s->configuration().pixelFormat)) { + numRawBuffers = s->configuration().bufferCount; + break; + } + } + /* Decide how many internal buffers to allocate. */ for (auto const stream : data->streams_) { - ret = stream->prepareBuffers(maxBuffers); + unsigned int numBuffers; + + if (stream == &data->unicam_[Unicam::Image] || + stream == &data->unicam_[Unicam::Embedded]) { + /* + * For Unicam, allocate a minimum of 4 buffers as we want + * to avoid any frame drops. If an application has configured + * a RAW stream, allocate additional buffers to make up the + * minimum, but ensure we have at least 2 sets of internal + * buffers to use to minimise frame drops. + */ + constexpr unsigned int minBuffers = 4; + numBuffers = std::max(2, minBuffers - numRawBuffers); + } else { + /* + * Since the ISP runs synchronous with the IPA and requests, + * we only ever need one set of internal buffers. Any buffers + * the application wants to hold onto will already be exported + * through PipelineHandlerRPi::exportFrameBuffers(). + */ + numBuffers = 1; + } + + ret = stream->prepareBuffers(numBuffers); if (ret < 0) return ret; } From patchwork Thu Nov 18 16:42:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14636 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 4A4F9BDB1C for ; Thu, 18 Nov 2021 16:43:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 012476036F; Thu, 18 Nov 2021 17:43:22 +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="Y5PIHFv6"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C02C160233 for ; Thu, 18 Nov 2021 17:43:19 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id k37-20020a05600c1ca500b00330cb84834fso8151130wms.2 for ; Thu, 18 Nov 2021 08:43:19 -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=Rd0ZYP3R2ExXSyLPu0gR7tKlyuF07AGNiEMxwDJFFy4=; b=Y5PIHFv6Vg4rHZ9oQgNPuNn38s7ZS01Td+8iqx1v+l7Rzd41dZe0A8oEoUYwoR+OfR CYbuuIQzaby4PsfSQCxX0l4EOb8U6i40wtuKgunLmIh03+Ai700lWUrqnbq72ygO3zbk dgxQLUH+3qqVo1LREQIVdFI2r9YgbGKGkHk/lpMuQwtvuH3AeFogElEO6Iit71xW/no4 auuCafkU3b4l/GaRlxY6q1By0ndAs+6sT3sr0WS6uvQ+Vw6fT3VHCA/hIiMRkX7kpEKm b+A5lO6vnks26pr/QuukWBboRkfRCB4tEgNakaWsHc+ccDa334AtT2ie6HkQD4GC1cW2 T0Fw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rd0ZYP3R2ExXSyLPu0gR7tKlyuF07AGNiEMxwDJFFy4=; b=lfkap8RwFVPEKzFXPWP0LCPybMdkI2Zqb/LE1moKOUWqGYLca3Wd7ocgdLxUn11a2c owgoGR/uIOIBv2OcbiVbIcJSAJz2T2J0eUIwBHKPCDpnqpyJF4DFdVv0NZFNFE9sIJb4 rstTL8IeBRD4irTCzCng5VWpPGhiF+5RuXOFsegxJrM2bFdBRh2ZVZ7tTxVWXJoIqQvY lsU/hLRD77DDRUswGtgBUMMLMV7CS0f37tp8QALBpj5jODXpbKj0yicfDiuWLfVn+OKI OFAPV7XVp3XVh+0rpddQLH3F7xVTxPyodnKKBDJXCQ+BGmLYmubnXiouHa6ueYtIuvND 59+w== X-Gm-Message-State: AOAM530++msI+gQORxhK/Wef/r+tSqBxqixosVA5UlvqcdERMXxLB+zy 8l5WYiSJZUiBxs/VLW0NVU76WKNmG4SaCzHq X-Google-Smtp-Source: ABdhPJx5/LQ7rzHxECuU1BF/J0FmzWC4LG6nnVhfOkymWczmuhswXlq5LWHTEachqgK6VIaolPowkg== X-Received: by 2002:a7b:c08a:: with SMTP id r10mr11385519wmh.184.1637253799274; Thu, 18 Nov 2021 08:43:19 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:328d:499d:f54a:e461]) by smtp.gmail.com with ESMTPSA id a1sm496246wri.89.2021.11.18.08.43.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 08:43:16 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Nov 2021 16:42:15 +0000 Message-Id: <20211118164216.2669449-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211118164216.2669449-1-naush@raspberrypi.com> References: <20211118164216.2669449-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/4] pipeline: raspberrypi: Increase the V4L2BufferCache slot allocations 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" If a stream is marked as external, double the number of V4L2BufferCache slots that are allocated. This is to account for additional buffers that may be allocated directly by the application. Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/rpi_stream.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index b3265d0e8aab..bab80d25ad1a 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -107,6 +107,17 @@ int Stream::prepareBuffers(unsigned int count) count = bufferMap_.size(); } + /* + * If this is an external stream, we must allocate slots for buffers that + * might be externally allocated. We have no indication of how many buffers + * may be used, so this might overallocate slots in the buffer cache. + * + * \todo Find a better heuristic, or, even better, an exact solution to + * this issue. + */ + if (isExternal()) + count = count * 2; + return dev_->importBuffers(count); } From patchwork Thu Nov 18 16:42:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14637 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 9C434BDB1C for ; Thu, 18 Nov 2021 16:43:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5BBD060371; Thu, 18 Nov 2021 17:43:24 +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="g0aPQmn3"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F21660231 for ; Thu, 18 Nov 2021 17:43:23 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id a9so12760225wrr.8 for ; Thu, 18 Nov 2021 08:43:23 -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=WSxb4/4PrjoEknlE7tK2I4wOz4SjJt6N50Kw+mOFMJI=; b=g0aPQmn3N2l9BaF9+C0XmH/M1GfZjPt1aRTjLCjtbbkoSxOjCuTja/j5WboTXb2Vpb jZqU7vVwwn7Nr1PqcdqE6bcilDFleXkzk58gK6MjhfNo8fvqgS2vc3AC+7/mM6S7z+ew naky2fzyW3gdSVfabzgPAYor8WCyYCpXYxMsLyAob3po/OWd7WYhlLKAQt7Y2Qxmit3m /vEqM+bsGV6WVkp1vdrnNLTwWdaUzSRzhSJOLyJdnxEraN/B7WAJ+gr1ZZC2T4b7YPAd JwkXoj8ZfkIX2RV9mVMWCMnce8Pk50Q6OGbpVHRRtiMVTMCI6ol7HB5Mu/dPcRuDcWE6 PAKw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=WSxb4/4PrjoEknlE7tK2I4wOz4SjJt6N50Kw+mOFMJI=; b=BYKTDp97iB2t+ucSDfgoHn/VBT36+aoI40Eek+gtpOKwFyQPewTDoZzN25fa/hsj2a pqumADApgPRTxIw1WSSZzHgg2nv13T77h8y2kL0CK2gJO8yfXeJBfTtnIWRusWOqumMx /HHz22UCQGpnoOnaRzcnvcg+kluh6nqsUUM+VRR6ScP8YsKKWxMI0N3hbgM4QzbZVgN1 QKlIsJ0d/52+8I56rPzGOSKpIcxqPLHRcR0TfJGm6JtxuRVEkS3tIyNTGKXCl5wza5bD qOtEhCyI+kDnKTqHXCG5PPqtNJ8TX/bzy8YUx5wxUZKa+3wq6ygUAK0gpnHcNJTOKe9b 7yKg== X-Gm-Message-State: AOAM531afLKMXmMtMLx0shlAvJZ0HWRIhclLSWd6VJpZ8HLnBqB2haCo ffHJnE/x7lCVOEAjqCiUgpRrAn75oPnSG0nx X-Google-Smtp-Source: ABdhPJxpCtfT5R/EWqsENB3O6Njs/DOPhjkJqF1JE+bBu8DSADy58YNfPN6DMOlwBUHGjgGV10Macw== X-Received: by 2002:a5d:6d0b:: with SMTP id e11mr33004751wrq.16.1637253803198; Thu, 18 Nov 2021 08:43:23 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:328d:499d:f54a:e461]) by smtp.gmail.com with ESMTPSA id a1sm496246wri.89.2021.11.18.08.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 08:43:21 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Nov 2021 16:42:16 +0000 Message-Id: <20211118164216.2669449-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211118164216.2669449-1-naush@raspberrypi.com> References: <20211118164216.2669449-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid invalid PixelFormat warning message 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" PixelFormatInfo::info() would log a warning message if the PixelFormat was invalid when called from the isRaw() function. Add a validity test in isRaw() to avoid this warning message. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 4f6c699a4379..ad526a8be6a2 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt) * The isRaw test might be redundant right now the pipeline handler only * supports RAW sensors. Leave it in for now, just as a sanity check. */ + if (!pixFmt.isValid()) + return false; + const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt); if (!info.isValid()) return false;