[{"id":21012,"web_url":"https://patchwork.libcamera.org/comment/21012/","msgid":"<YZavq7C8shHThsnG@pendragon.ideasonboard.com>","date":"2021-11-18T19:55:23","subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Thu, Nov 18, 2021 at 04:42:16PM +0000, Naushir Patuck wrote:\n> PixelFormatInfo::info() would log a warning message if the PixelFormat was\n> invalid when called from the isRaw() function. Add a validity test in isRaw()\n> to avoid this warning message.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 4f6c699a4379..ad526a8be6a2 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt)\n>  \t * The isRaw test might be redundant right now the pipeline handler only\n>  \t * supports RAW sensors. Leave it in for now, just as a sanity check.\n>  \t */\n> +\tif (!pixFmt.isValid())\n> +\t\treturn false;\n> +\n\nThis will only catch some of the issues, as PixelFormat::isValid()\nreturns false only when the fourcc is zero, while\nPixelFormatInfo::info() will warn for every unknown format.\n\nHow did you trigger this issue ?\n\n>  \tconst PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n>  \tif (!info.isValid())\n>  \t\treturn false;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A1842BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Nov 2021 19:55:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0AAAE60233;\n\tThu, 18 Nov 2021 20:55:48 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7238260231\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Nov 2021 20:55:46 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E457BE7;\n\tThu, 18 Nov 2021 20:55:45 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"WhVgIHCS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637265346;\n\tbh=uaCPGRGnVkHFH4vJqsf1MHsmuTp+2YBKnld24kV0wY4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=WhVgIHCSVO0wNlF4htGc0Tx39Y2uSblDt8GXWNJYUZqbGJvsbF8vo16ESmc04fSDb\n\t9cP/OYo7vsa2ba/p3ZgJingcure7WNAd2+1OvrwOCQvMIngXvbRKJf77SLE+4IU2vs\n\tRYuDmSMBbuHMa0/ymqu0zVqVaAT4Q4roliyGbC0Q=","Date":"Thu, 18 Nov 2021 21:55:23 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YZavq7C8shHThsnG@pendragon.ideasonboard.com>","References":"<20211118164216.2669449-1-naush@raspberrypi.com>\n\t<20211118164216.2669449-5-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211118164216.2669449-5-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21017,"web_url":"https://patchwork.libcamera.org/comment/21017/","msgid":"<CAEmqJPqeGhAyGK9dDqODzzJy6jp2MsJL5HuWXeq0AJ3MejT9PA@mail.gmail.com>","date":"2021-11-19T08:38:00","subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\nThanks for your feedback.\n\nOn Thu, 18 Nov 2021 at 19:55, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> Thank you for the patch.\n>\n> On Thu, Nov 18, 2021 at 04:42:16PM +0000, Naushir Patuck wrote:\n> > PixelFormatInfo::info() would log a warning message if the PixelFormat\n> was\n> > invalid when called from the isRaw() function. Add a validity test in\n> isRaw()\n> > to avoid this warning message.\n> >\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > ---\n> >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++\n> >  1 file changed, 3 insertions(+)\n> >\n> > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > index 4f6c699a4379..ad526a8be6a2 100644\n> > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > @@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt)\n> >        * The isRaw test might be redundant right now the pipeline\n> handler only\n> >        * supports RAW sensors. Leave it in for now, just as a sanity\n> check.\n> >        */\n> > +     if (!pixFmt.isValid())\n> > +             return false;\n> > +\n>\n> This will only catch some of the issues, as PixelFormat::isValid()\n> returns false only when the fourcc is zero, while\n> PixelFormatInfo::info() will warn for every unknown format.\n>\n> How did you trigger this issue ?\n>\n\nWith the change in patch 3/4, we check if a raw stream is requested\nand use the buffer count value to make up at least 2 internal buffers\nfor unicam.  If no RAW stream is present, the pixelformat is invalid\n(fourcc == 0).\nThis is the bit of code that triggers it:\n\nfor (Stream *s : camera->streams()) {\n    if (isRaw(s->configuration().pixelFormat)) {\n        numRawBuffers = s->configuration().bufferCount;\n        break;\n    }\n}\n\nThis change may not pick up all invalid formats where fourcc !=0, but should\nbe sufficient for this particular usage.\n\nRegards,\nNaush\n\n\n\n>\n> >       const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n> >       if (!info.isValid())\n> >               return false;\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 825E8BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 19 Nov 2021 08:38:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9FD0760378;\n\tFri, 19 Nov 2021 09:38:20 +0100 (CET)","from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com\n\t[IPv6:2607:f8b0:4864:20::82d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B71876022F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Nov 2021 09:38:18 +0100 (CET)","by mail-qt1-x82d.google.com with SMTP id m25so8799782qtq.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Nov 2021 00:38:18 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"VzHPFPof\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=2bDOCmHEebk84XXctDh2orWjiV3oq6vpi2BsncP/F5c=;\n\tb=VzHPFPof+UnoJRxyCxAP5ptvv04EzpTLF1ByvdT7GxmTtMcvKqrGOZDy3wdZNCIlS+\n\t5ZR0xUCjujdzzY28aDeCDfu0A+a0+ad8LqeUOnbqTLioeFqg0Lf5Ege8eNeWl3kGj0kp\n\t8N6qXzZQ3jKr8AM/w+LfiL1tyWwPOmsI2FiYRVvOwaK6nf0atskpXcAIJftoNoXmvowH\n\t+tA71krcrFR54sEklBnqKzrwWC3KOB2VHZGAqguzgK4WlF5Eo9fHPu40somkDUehDo7t\n\t86cZnLqyYw2gMTH1H4WmPA/IaNkUhdW+zCoVKPVeA15sANV/30w0qXvK9g6jbZZ5qHGO\n\tefdg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=2bDOCmHEebk84XXctDh2orWjiV3oq6vpi2BsncP/F5c=;\n\tb=Tw5Ia57Knv+F/49tFkZ6zN+FfZxnmJ4xW2/mRQQDy2AOzka/PfBat9IgyVVIPbz2/V\n\tOnlOX4ZxlD2Mqs1GfhvduI7GjsNnnDttK92GleEx3Mfhe6d/1QpodCiRFrFv9YH0hykv\n\tzM/rPX8nBLee6oHgLa7JUW/p82iU0Ntt9TSyqRqJ5PK0P1aYx0kr9zWm/yehaXDrPgdw\n\twlfGDnMH8TjXHj+DIwc1T/sYD7qPXv+os1dUsX4m9JNbOnKmukyXm48IYi3R/7Szyh5O\n\t4gP/SVXQMZzncrBMarfDVAnlqOvuro1biTRfk9eCSOu8n8yqmol7/9X69D2rVHL/Xe/C\n\t61YQ==","X-Gm-Message-State":"AOAM530WtvneSSCtLSV0EUTlKHfkbzX5X893l5bV5XSWazvtD/K2DO5J\n\tgIF7l6rVMIZT4oe4zrQdBqQafBvztuVrbZYFZ/nKRS59tQ24B/mn","X-Google-Smtp-Source":"ABdhPJzDoS536KLEJWTfPK5AK+l67F3Redya84vETG5o2/lBgwdprFR1QsNa1GaYiZIa8KDmd9HZj6NoF4ZHP9hD+kk=","X-Received":"by 2002:a05:622a:1cd:: with SMTP id\n\tt13mr4389597qtw.31.1637311096046; \n\tFri, 19 Nov 2021 00:38:16 -0800 (PST)","MIME-Version":"1.0","References":"<20211118164216.2669449-1-naush@raspberrypi.com>\n\t<20211118164216.2669449-5-naush@raspberrypi.com>\n\t<YZavq7C8shHThsnG@pendragon.ideasonboard.com>","In-Reply-To":"<YZavq7C8shHThsnG@pendragon.ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Fri, 19 Nov 2021 08:38:00 +0000","Message-ID":"<CAEmqJPqeGhAyGK9dDqODzzJy6jp2MsJL5HuWXeq0AJ3MejT9PA@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"0000000000004459fc05d1203296\"","Subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21033,"web_url":"https://patchwork.libcamera.org/comment/21033/","msgid":"<YZeUxYjkmhbrsIj5@pendragon.ideasonboard.com>","date":"2021-11-19T12:12:53","subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nOn Fri, Nov 19, 2021 at 08:38:00AM +0000, Naushir Patuck wrote:\n> On Thu, 18 Nov 2021 at 19:55, Laurent Pinchart wrote:\n> > On Thu, Nov 18, 2021 at 04:42:16PM +0000, Naushir Patuck wrote:\n> > > PixelFormatInfo::info() would log a warning message if the PixelFormat was\n> > > invalid when called from the isRaw() function. Add a validity test in isRaw()\n> > > to avoid this warning message.\n> > >\n> > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > ---\n> > >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++\n> > >  1 file changed, 3 insertions(+)\n> > >\n> > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > index 4f6c699a4379..ad526a8be6a2 100644\n> > > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > @@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt)\n> > >        * The isRaw test might be redundant right now the pipeline handler only\n> > >        * supports RAW sensors. Leave it in for now, just as a sanity check.\n> > >        */\n> > > +     if (!pixFmt.isValid())\n> > > +             return false;\n> > > +\n> >\n> > This will only catch some of the issues, as PixelFormat::isValid()\n> > returns false only when the fourcc is zero, while\n> > PixelFormatInfo::info() will warn for every unknown format.\n> >\n> > How did you trigger this issue ?\n> \n> With the change in patch 3/4, we check if a raw stream is requested\n\nI assume you meant in 2/4.\n\n> and use the buffer count value to make up at least 2 internal buffers\n> for unicam.  If no RAW stream is present, the pixelformat is invalid\n> (fourcc == 0).\n> This is the bit of code that triggers it:\n> \n> for (Stream *s : camera->streams()) {\n>     if (isRaw(s->configuration().pixelFormat)) {\n>         numRawBuffers = s->configuration().bufferCount;\n>         break;\n>     }\n> }\n\nAh yes, I had misread the code and thought this was looping over the\nconfiguration, not over the stream. It makes sense now.\n\nI think there's one issue though. Camera::configure() stores the\nconfiguration of each stream in Stream::configuration_, which is\naccessible through Stream::configuration(), but it won't reset the\nconfiguration of other streams. If you configure the camera with a raw\nstream, and then reconfigure it with a YUV stream only, the above loop\nwill find a raw stream.\n\nThis issue isn't introduced by your patch series, but I believe it\naffects it. Would you be able to test that ?\n\n> This change may not pick up all invalid formats where fourcc !=0, but should\n> be sufficient for this particular usage.\n> \n> > >       const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n> > >       if (!info.isValid())\n> > >               return false;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C9DE5BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 19 Nov 2021 12:13:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 02E3F60378;\n\tFri, 19 Nov 2021 13:13:18 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B712160233\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Nov 2021 13:13:16 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 31F761959;\n\tFri, 19 Nov 2021 13:13:16 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"g5y0lHcE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637323996;\n\tbh=coBMOVpU+xetEc6gUiGt5/qN40/6X1BvlHkhA8sO06A=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=g5y0lHcE6GmzKvpWOXGB10s5loM0BDap9fev/hbB/UrinfDOaciFlky7Qi/f3Eyq3\n\tC8JuvGan9MwgYdimFnEylu5kgchAuKj/QmmlP1ZkEFf5CPIH/NnOtt/9mSPOqyab5X\n\tTEO+q+gPThj6qA8yl8LWgnr94x2rUHW8fhzQFVF0=","Date":"Fri, 19 Nov 2021 14:12:53 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YZeUxYjkmhbrsIj5@pendragon.ideasonboard.com>","References":"<20211118164216.2669449-1-naush@raspberrypi.com>\n\t<20211118164216.2669449-5-naush@raspberrypi.com>\n\t<YZavq7C8shHThsnG@pendragon.ideasonboard.com>\n\t<CAEmqJPqeGhAyGK9dDqODzzJy6jp2MsJL5HuWXeq0AJ3MejT9PA@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAEmqJPqeGhAyGK9dDqODzzJy6jp2MsJL5HuWXeq0AJ3MejT9PA@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21034,"web_url":"https://patchwork.libcamera.org/comment/21034/","msgid":"<YZeU2BCI+j2HsE3d@pendragon.ideasonboard.com>","date":"2021-11-19T12:13:12","subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Nov 19, 2021 at 02:12:55PM +0200, Laurent Pinchart wrote:\n> Hi Naush,\n> \n> On Fri, Nov 19, 2021 at 08:38:00AM +0000, Naushir Patuck wrote:\n> > On Thu, 18 Nov 2021 at 19:55, Laurent Pinchart wrote:\n> > > On Thu, Nov 18, 2021 at 04:42:16PM +0000, Naushir Patuck wrote:\n> > > > PixelFormatInfo::info() would log a warning message if the PixelFormat was\n> > > > invalid when called from the isRaw() function. Add a validity test in isRaw()\n> > > > to avoid this warning message.\n> > > >\n> > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > ---\n> > > >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++\n> > > >  1 file changed, 3 insertions(+)\n> > > >\n> > > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > index 4f6c699a4379..ad526a8be6a2 100644\n> > > > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > @@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt)\n> > > >        * The isRaw test might be redundant right now the pipeline handler only\n> > > >        * supports RAW sensors. Leave it in for now, just as a sanity check.\n> > > >        */\n> > > > +     if (!pixFmt.isValid())\n> > > > +             return false;\n> > > > +\n> > >\n> > > This will only catch some of the issues, as PixelFormat::isValid()\n> > > returns false only when the fourcc is zero, while\n> > > PixelFormatInfo::info() will warn for every unknown format.\n> > >\n> > > How did you trigger this issue ?\n> > \n> > With the change in patch 3/4, we check if a raw stream is requested\n> \n> I assume you meant in 2/4.\n> \n> > and use the buffer count value to make up at least 2 internal buffers\n> > for unicam.  If no RAW stream is present, the pixelformat is invalid\n> > (fourcc == 0).\n> > This is the bit of code that triggers it:\n> > \n> > for (Stream *s : camera->streams()) {\n> >     if (isRaw(s->configuration().pixelFormat)) {\n> >         numRawBuffers = s->configuration().bufferCount;\n> >         break;\n> >     }\n> > }\n> \n> Ah yes, I had misread the code and thought this was looping over the\n> configuration, not over the stream. It makes sense now.\n> \n> I think there's one issue though. Camera::configure() stores the\n> configuration of each stream in Stream::configuration_, which is\n> accessible through Stream::configuration(), but it won't reset the\n> configuration of other streams. If you configure the camera with a raw\n> stream, and then reconfigure it with a YUV stream only, the above loop\n> will find a raw stream.\n> \n> This issue isn't introduced by your patch series, but I believe it\n> affects it. Would you be able to test that ?\n\nAnd for this patch,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> > This change may not pick up all invalid formats where fourcc !=0, but should\n> > be sufficient for this particular usage.\n> > \n> > > >       const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n> > > >       if (!info.isValid())\n> > > >               return false;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id BE895BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 19 Nov 2021 12:13:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7B72760378;\n\tFri, 19 Nov 2021 13:13:36 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A95760233\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Nov 2021 13:13:35 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F0B161959;\n\tFri, 19 Nov 2021 13:13:34 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"QvDhOuPc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637324015;\n\tbh=Db0A8JAGBNSRL5Z3TMcMlQHHJ6Y8oFZEsf6X52wXy7g=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QvDhOuPc8iitZzEvKA8e3Jd03K/f9TfvSXtuAtJUCCENUg2w2sPTsyNLY+EU3EgXe\n\tB49GjVmPJ47z9FcqaMwFozzDm3x65CP+PWMJwkYVU/pEyQQhV6ERnWv/8StMlnvumf\n\tOMYvpCym2Zl0uMNPdqHgb+uWLbsCC1stNUix+QW4=","Date":"Fri, 19 Nov 2021 14:13:12 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YZeU2BCI+j2HsE3d@pendragon.ideasonboard.com>","References":"<20211118164216.2669449-1-naush@raspberrypi.com>\n\t<20211118164216.2669449-5-naush@raspberrypi.com>\n\t<YZavq7C8shHThsnG@pendragon.ideasonboard.com>\n\t<CAEmqJPqeGhAyGK9dDqODzzJy6jp2MsJL5HuWXeq0AJ3MejT9PA@mail.gmail.com>\n\t<YZeUxYjkmhbrsIj5@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<YZeUxYjkmhbrsIj5@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21059,"web_url":"https://patchwork.libcamera.org/comment/21059/","msgid":"<CAEmqJPon9xDLCPrnT2cejEcNYg+DZDP0iLNZ+X13yjXke+u+jg@mail.gmail.com>","date":"2021-11-19T16:12:58","subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Laurent,\n\n\nOn Fri, 19 Nov 2021 at 12:13, Laurent Pinchart <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Naush,\n>\n> On Fri, Nov 19, 2021 at 08:38:00AM +0000, Naushir Patuck wrote:\n> > On Thu, 18 Nov 2021 at 19:55, Laurent Pinchart wrote:\n> > > On Thu, Nov 18, 2021 at 04:42:16PM +0000, Naushir Patuck wrote:\n> > > > PixelFormatInfo::info() would log a warning message if the\n> PixelFormat was\n> > > > invalid when called from the isRaw() function. Add a validity test\n> in isRaw()\n> > > > to avoid this warning message.\n> > > >\n> > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > ---\n> > > >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++\n> > > >  1 file changed, 3 insertions(+)\n> > > >\n> > > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > index 4f6c699a4379..ad526a8be6a2 100644\n> > > > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > @@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt)\n> > > >        * The isRaw test might be redundant right now the pipeline\n> handler only\n> > > >        * supports RAW sensors. Leave it in for now, just as a sanity\n> check.\n> > > >        */\n> > > > +     if (!pixFmt.isValid())\n> > > > +             return false;\n> > > > +\n> > >\n> > > This will only catch some of the issues, as PixelFormat::isValid()\n> > > returns false only when the fourcc is zero, while\n> > > PixelFormatInfo::info() will warn for every unknown format.\n> > >\n> > > How did you trigger this issue ?\n> >\n> > With the change in patch 3/4, we check if a raw stream is requested\n>\n> I assume you meant in 2/4.\n>\n> > and use the buffer count value to make up at least 2 internal buffers\n> > for unicam.  If no RAW stream is present, the pixelformat is invalid\n> > (fourcc == 0).\n> > This is the bit of code that triggers it:\n> >\n> > for (Stream *s : camera->streams()) {\n> >     if (isRaw(s->configuration().pixelFormat)) {\n> >         numRawBuffers = s->configuration().bufferCount;\n> >         break;\n> >     }\n> > }\n>\n> Ah yes, I had misread the code and thought this was looping over the\n> configuration, not over the stream. It makes sense now.\n>\n> I think there's one issue though. Camera::configure() stores the\n> configuration of each stream in Stream::configuration_, which is\n> accessible through Stream::configuration(), but it won't reset the\n> configuration of other streams. If you configure the camera with a raw\n> stream, and then reconfigure it with a YUV stream only, the above loop\n> will find a raw stream.\n>\n> This issue isn't introduced by your patch series, but I believe it\n> affects it. Would you be able to test that ?\n>\n\nSure, I'll give this a run next week to confirm the behavior..\n\nRegards,\nNaush\n\n\n>\n> > This change may not pick up all invalid formats where fourcc !=0, but\n> should\n> > be sufficient for this particular usage.\n> >\n> > > >       const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n> > > >       if (!info.isValid())\n> > > >               return false;\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7713BBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 19 Nov 2021 16:13:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7329C60378;\n\tFri, 19 Nov 2021 17:13:17 +0100 (CET)","from mail-lf1-x130.google.com (mail-lf1-x130.google.com\n\t[IPv6:2a00:1450:4864:20::130])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5986E600B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Nov 2021 17:13:15 +0100 (CET)","by mail-lf1-x130.google.com with SMTP id y26so45469539lfa.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Nov 2021 08:13:15 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"DqMN9Vx8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=gcwCVK6DgOed18joirl63rKzyCir6gUnhFEoE+nnrNg=;\n\tb=DqMN9Vx89PN4q0sz+vrOeXkLCl4jA6dnHWm144bfVQyLOf82H9dkvspBWxXuEdAM7r\n\tg/fXixBVVgTCfpQHwl8Qk4cO/+JfnuT5bJbhriLAlWmR5v3hIIRyE08WnePnu04cpswA\n\trpdMy/30OoaD9xG2vGUUFxoNfaZ5RJ7KubNxkTpCTq9P5+0gR3Z5uJvzmTk4H4tBNqIE\n\tY5lYzPVsa4W6aCW6EV3R9V0/QY6Ekd94lm834OWoOuoGZOHi3p7+YYjTQQRp1Jg38bvj\n\tzHzsWJiYK3LA7sMRFJlPV+KK8gTUVfwUNd62KDKZim+FEb+RVL0iijLfPWEi88GliYDW\n\tAH0w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=gcwCVK6DgOed18joirl63rKzyCir6gUnhFEoE+nnrNg=;\n\tb=dYXXcNxF7hSewNYGCattNjn4MtgZBfJgenWwM8oAuXgClVelNwQbpr/FJ6k7FsCLXO\n\tnxhkPji+8hGXtAeGBfl4KEQn1VjpHxgYKdaaRCESNi0ubwY9MWRKWkeo2x3xOnol0zok\n\tlslz9FSK3wtMvB4OMjbdFshPhTSVeWlnUqIfhlwa3D2GwkVz/3bBR2JJe4xM3rTHdhu0\n\tVu/8P98ur+5oxIpWpqH88V+jtdhISQBhQYkHRkzqb5SZ1U+m3lCEbEqcSf5AelsWI39w\n\tW2Cael8miYqTfHqgS2AgVNSZ5/rtZ924ZsS5s/2bK0FpdDdVwAz3aMf3zKVNHBzYevZQ\n\tqZ7w==","X-Gm-Message-State":"AOAM5324TG2HhhXJ7x03G/8NxROx38+vbTQ9CLu8lcNazQiL6kqc/ATC\n\tpwT2HtQR7UANvwmi/l+glCX7N7jSzxGBQboVBqQmh1IP1sh8ZA==","X-Google-Smtp-Source":"ABdhPJwdr5zqVF/aijlm4B9GbybLeGIS0DvaV0/xrLAtUbI/R22HwWAafHwFr/QJsOa6YqERPnLjLvDGjDlsG5eX6TE=","X-Received":"by 2002:ac2:5932:: with SMTP id\n\tv18mr33075455lfi.611.1637338394368; \n\tFri, 19 Nov 2021 08:13:14 -0800 (PST)","MIME-Version":"1.0","References":"<20211118164216.2669449-1-naush@raspberrypi.com>\n\t<20211118164216.2669449-5-naush@raspberrypi.com>\n\t<YZavq7C8shHThsnG@pendragon.ideasonboard.com>\n\t<CAEmqJPqeGhAyGK9dDqODzzJy6jp2MsJL5HuWXeq0AJ3MejT9PA@mail.gmail.com>\n\t<YZeUxYjkmhbrsIj5@pendragon.ideasonboard.com>","In-Reply-To":"<YZeUxYjkmhbrsIj5@pendragon.ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Fri, 19 Nov 2021 16:12:58 +0000","Message-ID":"<CAEmqJPon9xDLCPrnT2cejEcNYg+DZDP0iLNZ+X13yjXke+u+jg@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"0000000000005fb65c05d1268dcb\"","Subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21124,"web_url":"https://patchwork.libcamera.org/comment/21124/","msgid":"<163766992724.3059017.3784186610433650505@Monstersaurus>","date":"2021-11-23T12:18:47","subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck (2021-11-19 16:12:58)\n> Hi Laurent,\n> \n> \n> On Fri, 19 Nov 2021 at 12:13, Laurent Pinchart <\n> laurent.pinchart@ideasonboard.com> wrote:\n> \n> > Hi Naush,\n> >\n> > On Fri, Nov 19, 2021 at 08:38:00AM +0000, Naushir Patuck wrote:\n> > > On Thu, 18 Nov 2021 at 19:55, Laurent Pinchart wrote:\n> > > > On Thu, Nov 18, 2021 at 04:42:16PM +0000, Naushir Patuck wrote:\n> > > > > PixelFormatInfo::info() would log a warning message if the\n> > PixelFormat was\n> > > > > invalid when called from the isRaw() function. Add a validity test\n> > in isRaw()\n> > > > > to avoid this warning message.\n> > > > >\n> > > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > > ---\n> > > > >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++\n> > > > >  1 file changed, 3 insertions(+)\n> > > > >\n> > > > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > > index 4f6c699a4379..ad526a8be6a2 100644\n> > > > > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > > @@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt)\n> > > > >        * The isRaw test might be redundant right now the pipeline\n> > handler only\n> > > > >        * supports RAW sensors. Leave it in for now, just as a sanity\n> > check.\n> > > > >        */\n> > > > > +     if (!pixFmt.isValid())\n> > > > > +             return false;\n> > > > > +\n> > > >\n> > > > This will only catch some of the issues, as PixelFormat::isValid()\n> > > > returns false only when the fourcc is zero, while\n> > > > PixelFormatInfo::info() will warn for every unknown format.\n> > > >\n> > > > How did you trigger this issue ?\n> > >\n> > > With the change in patch 3/4, we check if a raw stream is requested\n> >\n> > I assume you meant in 2/4.\n> >\n> > > and use the buffer count value to make up at least 2 internal buffers\n> > > for unicam.  If no RAW stream is present, the pixelformat is invalid\n> > > (fourcc == 0).\n> > > This is the bit of code that triggers it:\n> > >\n> > > for (Stream *s : camera->streams()) {\n> > >     if (isRaw(s->configuration().pixelFormat)) {\n> > >         numRawBuffers = s->configuration().bufferCount;\n> > >         break;\n> > >     }\n> > > }\n> >\n> > Ah yes, I had misread the code and thought this was looping over the\n> > configuration, not over the stream. It makes sense now.\n> >\n> > I think there's one issue though. Camera::configure() stores the\n> > configuration of each stream in Stream::configuration_, which is\n> > accessible through Stream::configuration(), but it won't reset the\n> > configuration of other streams. If you configure the camera with a raw\n> > stream, and then reconfigure it with a YUV stream only, the above loop\n> > will find a raw stream.\n> >\n> > This issue isn't introduced by your patch series, but I believe it\n> > affects it. Would you be able to test that ?\n> >\n> \n> Sure, I'll give this a run next week to confirm the behavior..\n> \n> Regards,\n> Naush\n> \n\nWere there any issues to worry about here?\n\nAs far as I can tell - the patch itself is still sane. If the format is\ninvalid, it is ... not a raw format...\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\nIf you're happy, I'll run the integration tests and merge this series.\n\n--\nKieran\n\n\n> \n> >\n> > > This change may not pick up all invalid formats where fourcc !=0, but\n> > should\n> > > be sufficient for this particular usage.\n> > >\n> > > > >       const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);\n> > > > >       if (!info.isValid())\n> > > > >               return false;\n> >\n> > --\n> > Regards,\n> >\n> > Laurent Pinchart\n> >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 8A4F0BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 12:18:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BEC1860230;\n\tTue, 23 Nov 2021 13:18:51 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0835460121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 13:18:50 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 91A25A1B;\n\tTue, 23 Nov 2021 13:18:49 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"m/s3MfGx\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637669929;\n\tbh=G6BEGWC6h6/M+3sNOBwrpOtNkz8/9AC5P3ficzmHhEg=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=m/s3MfGxet6EL2lkKs4I3AlOS6x04hAlzU4lEnbUviqwyOa3nsrI5AbSItaEDLaz3\n\tDg30GjQbo52N85c4PGfi4F0CIWUG1kkXh0V3MSlT6pIUfZMJH2jPCw+CVW/FD52w46\n\tgCI08FkgrTTXgDy9z7M8LQXG1xf2OdJqRYKNir6I=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<CAEmqJPon9xDLCPrnT2cejEcNYg+DZDP0iLNZ+X13yjXke+u+jg@mail.gmail.com>","References":"<20211118164216.2669449-1-naush@raspberrypi.com>\n\t<20211118164216.2669449-5-naush@raspberrypi.com>\n\t<YZavq7C8shHThsnG@pendragon.ideasonboard.com>\n\t<CAEmqJPqeGhAyGK9dDqODzzJy6jp2MsJL5HuWXeq0AJ3MejT9PA@mail.gmail.com>\n\t<YZeUxYjkmhbrsIj5@pendragon.ideasonboard.com>\n\t<CAEmqJPon9xDLCPrnT2cejEcNYg+DZDP0iLNZ+X13yjXke+u+jg@mail.gmail.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Date":"Tue, 23 Nov 2021 12:18:47 +0000","Message-ID":"<163766992724.3059017.3784186610433650505@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21126,"web_url":"https://patchwork.libcamera.org/comment/21126/","msgid":"<CAEmqJPrkcA+EgX+cGVahBrWTvviPX_uUKzFNj8i=DXgBt_bN6g@mail.gmail.com>","date":"2021-11-23T12:46:40","subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Kieran,\n\nOn Tue, 23 Nov 2021 at 12:18, Kieran Bingham <\nkieran.bingham@ideasonboard.com> wrote:\n\n> Quoting Naushir Patuck (2021-11-19 16:12:58)\n> > Hi Laurent,\n> >\n> >\n> > On Fri, 19 Nov 2021 at 12:13, Laurent Pinchart <\n> > laurent.pinchart@ideasonboard.com> wrote:\n> >\n> > > Hi Naush,\n> > >\n> > > On Fri, Nov 19, 2021 at 08:38:00AM +0000, Naushir Patuck wrote:\n> > > > On Thu, 18 Nov 2021 at 19:55, Laurent Pinchart wrote:\n> > > > > On Thu, Nov 18, 2021 at 04:42:16PM +0000, Naushir Patuck wrote:\n> > > > > > PixelFormatInfo::info() would log a warning message if the\n> > > PixelFormat was\n> > > > > > invalid when called from the isRaw() function. Add a validity\n> test\n> > > in isRaw()\n> > > > > > to avoid this warning message.\n> > > > > >\n> > > > > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > > > > > ---\n> > > > > >  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 +++\n> > > > > >  1 file changed, 3 insertions(+)\n> > > > > >\n> > > > > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > > b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > > > index 4f6c699a4379..ad526a8be6a2 100644\n> > > > > > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > > > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> > > > > > @@ -102,6 +102,9 @@ bool isRaw(const PixelFormat &pixFmt)\n> > > > > >        * The isRaw test might be redundant right now the pipeline\n> > > handler only\n> > > > > >        * supports RAW sensors. Leave it in for now, just as a\n> sanity\n> > > check.\n> > > > > >        */\n> > > > > > +     if (!pixFmt.isValid())\n> > > > > > +             return false;\n> > > > > > +\n> > > > >\n> > > > > This will only catch some of the issues, as PixelFormat::isValid()\n> > > > > returns false only when the fourcc is zero, while\n> > > > > PixelFormatInfo::info() will warn for every unknown format.\n> > > > >\n> > > > > How did you trigger this issue ?\n> > > >\n> > > > With the change in patch 3/4, we check if a raw stream is requested\n> > >\n> > > I assume you meant in 2/4.\n> > >\n> > > > and use the buffer count value to make up at least 2 internal buffers\n> > > > for unicam.  If no RAW stream is present, the pixelformat is invalid\n> > > > (fourcc == 0).\n> > > > This is the bit of code that triggers it:\n> > > >\n> > > > for (Stream *s : camera->streams()) {\n> > > >     if (isRaw(s->configuration().pixelFormat)) {\n> > > >         numRawBuffers = s->configuration().bufferCount;\n> > > >         break;\n> > > >     }\n> > > > }\n> > >\n> > > Ah yes, I had misread the code and thought this was looping over the\n> > > configuration, not over the stream. It makes sense now.\n> > >\n> > > I think there's one issue though. Camera::configure() stores the\n> > > configuration of each stream in Stream::configuration_, which is\n> > > accessible through Stream::configuration(), but it won't reset the\n> > > configuration of other streams. If you configure the camera with a raw\n> > > stream, and then reconfigure it with a YUV stream only, the above loop\n> > > will find a raw stream.\n> > >\n> > > This issue isn't introduced by your patch series, but I believe it\n> > > affects it. Would you be able to test that ?\n> > >\n> >\n> > Sure, I'll give this a run next week to confirm the behavior..\n> >\n> > Regards,\n> > Naush\n> >\n>\n> Were there any issues to worry about here?\n>\n\nI still need to investigate the behavior, but that will be separate\nto the changes in this patch.\n\n\n>\n> As far as I can tell - the patch itself is still sane. If the format is\n> invalid, it is ... not a raw format...\n>\n\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n>\n> If you're happy, I'll run the integration tests and merge this series.\n>\n\nI'm happy to get this merged now, thanks!\n\nNaush\n\n\n>\n> --\n> Kieran\n>\n>\n> >\n> > >\n> > > > This change may not pick up all invalid formats where fourcc !=0, but\n> > > should\n> > > > be sufficient for this particular usage.\n> > > >\n> > > > > >       const PixelFormatInfo &info =\n> PixelFormatInfo::info(pixFmt);\n> > > > > >       if (!info.isValid())\n> > > > > >               return false;\n> > >\n> > > --\n> > > Regards,\n> > >\n> > > Laurent Pinchart\n> > >\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 850E4BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 12:46:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EE6676033C;\n\tTue, 23 Nov 2021 13:46:58 +0100 (CET)","from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com\n\t[IPv6:2a00:1450:4864:20::22c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 88E8260121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 13:46:57 +0100 (CET)","by mail-lj1-x22c.google.com with SMTP id i63so10901044lji.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 04:46:57 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"qIQmrAWi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=bKBFeu/M3rqAXvX8l630rplts5DL+HWoDGei8X/xVJs=;\n\tb=qIQmrAWiQrIgFtbnopVizVMTSUwdpBS4iwo71eZYFVpk5uTQlcaZB+8dMYJbm3NY2F\n\tP4bI+d5xqJSvXPaigjy6RvJyFa5/OzJHAdWOYnNcINplIe62JPHOdDl+6w89fxlbaxbF\n\tcKO7F4i38x4NDF0EbNM2iydDlvq2LnqtFN86Bl0ghrUGaKXf6j1rbcm61InZg+bKCQnm\n\to34WZTOLILl48+VMufokCP9fn0jHDUL6Hb6CI9qk2jfC6xSVm6O58plVZNMSF0zmWbHt\n\tkPDcm9FuQD8hKuv7LEsB9x7HeoyrTacavHJnzctxr/mf1QgHO2B26cKesRYZMtaaJUQ1\n\tpajQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=bKBFeu/M3rqAXvX8l630rplts5DL+HWoDGei8X/xVJs=;\n\tb=jBGWzJpeDsb/WpDodRvX0uL+4Ikfjc4V8O+a2Cep5mC2XOKyxymmj1pICrCjFCsdDV\n\tHLZ7UPPnpSgKdBX74V8PG5L0o9SDEPm+PLnjnp9+9cPoKuWhnNcg0/l72Q40bVxIX+AG\n\tEwj792micAlXujthZsdzulgAIEdliWjY4ASv112nFObPpNHnmV5kCxDREtg/8z8UF7aC\n\tSkQxFdJX2CJgvNwLgKajrRsM74DcDC1OsqjK1xlKe97lrdhHpm5OvWQFyCsOThirqDav\n\tnMPWWxViZuUh98DzBR8DOcXHhBSfRxdnGC+z1CYcrNmYfGw0kGJFIweehw4iAzShWUD7\n\tJCdA==","X-Gm-Message-State":"AOAM533DoY3qiNG5gBg3UsYYkbfaVLYy43aSwEvhBNeziAeu5/pdOWg3\n\tyY5XE/TiT/8WpK+4WFf3pdHQNXQEWn205NI/QRbLtBhPF/MCLQ==","X-Google-Smtp-Source":"ABdhPJz1brtmMJLwYXIM5JMG4quIB5rWfXaZL3528U3kCKWfzMrsInsAjnbFRCzqGjXtM96yf38jCjiJIt/puDOJ3vI=","X-Received":"by 2002:a2e:908b:: with SMTP id\n\tl11mr5002838ljg.208.1637671616770; \n\tTue, 23 Nov 2021 04:46:56 -0800 (PST)","MIME-Version":"1.0","References":"<20211118164216.2669449-1-naush@raspberrypi.com>\n\t<20211118164216.2669449-5-naush@raspberrypi.com>\n\t<YZavq7C8shHThsnG@pendragon.ideasonboard.com>\n\t<CAEmqJPqeGhAyGK9dDqODzzJy6jp2MsJL5HuWXeq0AJ3MejT9PA@mail.gmail.com>\n\t<YZeUxYjkmhbrsIj5@pendragon.ideasonboard.com>\n\t<CAEmqJPon9xDLCPrnT2cejEcNYg+DZDP0iLNZ+X13yjXke+u+jg@mail.gmail.com>\n\t<163766992724.3059017.3784186610433650505@Monstersaurus>","In-Reply-To":"<163766992724.3059017.3784186610433650505@Monstersaurus>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Tue, 23 Nov 2021 12:46:40 +0000","Message-ID":"<CAEmqJPrkcA+EgX+cGVahBrWTvviPX_uUKzFNj8i=DXgBt_bN6g@mail.gmail.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000fa06b905d1742271\"","Subject":"Re: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Avoid\n\tinvalid PixelFormat warning message","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]