[{"id":4110,"web_url":"https://patchwork.libcamera.org/comment/4110/","msgid":"<39dde9d6-cdc0-00df-9994-b37eeb77268c@linaro.org>","date":"2020-03-19T22:07:06","subject":"Re: [libcamera-devel] [PATCH v2 10/10] libcamera: pipeline: simple:\n\tIntegrate converter support","submitter":{"id":25,"url":"https://patchwork.libcamera.org/api/people/25/","name":"Andrey Konovalov","email":"andrey.konovalov@linaro.org"},"content":"Hi Laurent,\n\nOn 17.03.2020 00:43, Laurent Pinchart wrote:\n> Add support for an optional format converter, supported by the\n> SimpleConverter class. If a converter is available for the pipeline, it\n> will be used to expose additional pixel formats.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>   src/libcamera/pipeline/simple/simple.cpp | 192 ++++++++++++++++++++---\n>   1 file changed, 174 insertions(+), 18 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 2126799c54eb..218b28e70eb2 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n\n<snip>\n\n> +struct SimplePipelineInfo {\n> +\tconst char *driver;\n> +\tconst char *converter;\n> +};\n\n<snip>\n\n> @@ -550,16 +630,21 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)\n>   \n>   bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n>   {\n> -\tstatic const char * const drivers[] = {\n> -\t\t\"imx7-csi\",\n> -\t\t\"sun6i-csi\",\n> +\tstatic const SimplePipelineInfo infos[] = {\n> +\t\t{ \"imx7-csi\", \"pxp\" },\n> +\t\t{ \"sun6i-csi\", nullptr },\n>   \t};\n>   \n> -\tfor (const char *driver : drivers) {\n> -\t\tDeviceMatch dm(driver);\n> +\tMediaDevice *converter;\n> +\n> +\tfor (const SimplePipelineInfo &info : infos) {\n> +\t\tDeviceMatch dm(info.driver);\n>   \t\tmedia_ = acquireMediaDevice(enumerator, dm);\n> -\t\tif (media_)\n> +\t\tif (media_) {\n> +\t\t\tDeviceMatch converterMatch(info.converter);\n\ninfo.converter being equal to nullptr here results in:\n\n   what():  basic_string::_M_construct null not valid\nAborted\n\n- as DeviceMatch constructor accepts const std::string.\n\nMaybe use { \"sun6i-csi\", \"\" } instead of { \"sun6i-csi\", nullptr }?\n\n\nThanks,\nAndrey","headers":{"Return-Path":"<andrey.konovalov@linaro.org>","Received":["from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EB291629AC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 23:07:10 +0100 (CET)","by mail-lj1-x241.google.com with SMTP id g12so4349153ljj.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 15:07:10 -0700 (PDT)","from [192.168.118.216] (37-144-159-139.broadband.corbina.ru.\n\t[37.144.159.139]) by smtp.gmail.com with ESMTPSA id\n\tc4sm488126lfm.37.2020.03.19.15.07.08\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tThu, 19 Mar 2020 15:07:09 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=l1FU5M66L7cVIOSXdE1ZxNEaExiV8E7JPaw/pPyRizI=;\n\tb=HTDdSBMJdv+dT1Wjvg+rn5eu7uR06OfN53V7WEeIC+Tb+DQBRF85qnj6MxW44Lj3Mp\n\tbB6Bp2YuhZZYZc7CZZDd+cvpXnim37GGrGWviMOQdyLCvV3+nZtvVOgNy2NvPpOcd3oT\n\t31/Uku4GE5bgVFgu+6NtWc2eNXFwgi50tlpO1TBjMW2JF77Nq09p34GoOM/UcTkpItas\n\tgaOtirbki5ohVvMMtbboZVBXm5l23GcrS93PMHaVcsRSIOPPjTRsLpfjeOLaQdoJ/gf0\n\t6LZLLg0goJshA9WZRddRGxLB0jOlvJdEWytTbKafJEJAncxPnDixXvtFwp4s3KxcGdsg\n\twDKg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=l1FU5M66L7cVIOSXdE1ZxNEaExiV8E7JPaw/pPyRizI=;\n\tb=LOwmVSX3lHEK2Q7t4QRTKSYxg3/x8wvb/6i9oJKCL+TBBXvZD4LeDDpoF/vdnMv4zd\n\t4z8pyk6FkReG453dMtG7mMHDXBHbpcK4fCuOhIYxTvA/u0oc9XIev6kNG9LBIn+yI8kR\n\trIGyJd8tYhV2qSnv5OskuY/bMSx9beNuMOeJg099xCJ0jjVvftzP8qX2beIJpTQXOdxI\n\trN5cYU/KTVgK7zElDxBbftfZNNrb3BM1b2YAsQM2TkfqiOW2EM3GGpH/eRpLebzanosS\n\tbDyJRA9WPYIbnWektHDDylzzOdL7ywhxgfgXLgycjNvMJGkl/mOihmuU/EjeAkEplisc\n\tR2Bg==","X-Gm-Message-State":"ANhLgQ3+1WjBcrkQaPohC3iANGeb4d2KM7S8e0YNEAmmPg1qrV7DpGJy\n\tHaeZwlzHxLk7t7bl16RsRmZ0ag==","X-Google-Smtp-Source":"ADFU+vsD6bx0FerYT8lRB+E5gp4VxltyJ2sY6X9Ko4cc4XDhtl8w4A6FJz4PUmybfgC7WlEo+v2zww==","X-Received":"by 2002:a2e:9982:: with SMTP id w2mr3368982lji.11.1584655630043; \n\tThu, 19 Mar 2020 15:07:10 -0700 (PDT)","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Martijn Braam <martijn@brixit.nl>, \n\tMickael GUENE <mickael.guene@st.com>,\n\tBenjamin GAIGNARD <benjamin.gaignard@st.com>","References":"<20200316214310.27665-1-laurent.pinchart@ideasonboard.com>\n\t<20200316214310.27665-11-laurent.pinchart@ideasonboard.com>","From":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<39dde9d6-cdc0-00df-9994-b37eeb77268c@linaro.org>","Date":"Fri, 20 Mar 2020 01:07:06 +0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.4.1","MIME-Version":"1.0","In-Reply-To":"<20200316214310.27665-11-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v2 10/10] libcamera: pipeline: simple:\n\tIntegrate converter support","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>","X-List-Received-Date":"Thu, 19 Mar 2020 22:07:11 -0000"}},{"id":4112,"web_url":"https://patchwork.libcamera.org/comment/4112/","msgid":"<20200319235458.GP14585@pendragon.ideasonboard.com>","date":"2020-03-19T23:54:58","subject":"Re: [libcamera-devel] [PATCH v2 10/10] libcamera: pipeline: simple:\n\tIntegrate converter support","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Andrey,\n\nOn Fri, Mar 20, 2020 at 01:07:06AM +0300, Andrey Konovalov wrote:\n> On 17.03.2020 00:43, Laurent Pinchart wrote:\n> > Add support for an optional format converter, supported by the\n> > SimpleConverter class. If a converter is available for the pipeline, it\n> > will be used to expose additional pixel formats.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >   src/libcamera/pipeline/simple/simple.cpp | 192 ++++++++++++++++++++---\n> >   1 file changed, 174 insertions(+), 18 deletions(-)\n> > \n> > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> > index 2126799c54eb..218b28e70eb2 100644\n> > --- a/src/libcamera/pipeline/simple/simple.cpp\n> > +++ b/src/libcamera/pipeline/simple/simple.cpp\n> \n> <snip>\n> \n> > +struct SimplePipelineInfo {\n> > +\tconst char *driver;\n> > +\tconst char *converter;\n> > +};\n> \n> <snip>\n> \n> > @@ -550,16 +630,21 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)\n> >   \n> >   bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n> >   {\n> > -\tstatic const char * const drivers[] = {\n> > -\t\t\"imx7-csi\",\n> > -\t\t\"sun6i-csi\",\n> > +\tstatic const SimplePipelineInfo infos[] = {\n> > +\t\t{ \"imx7-csi\", \"pxp\" },\n> > +\t\t{ \"sun6i-csi\", nullptr },\n> >   \t};\n> >   \n> > -\tfor (const char *driver : drivers) {\n> > -\t\tDeviceMatch dm(driver);\n> > +\tMediaDevice *converter;\n> > +\n> > +\tfor (const SimplePipelineInfo &info : infos) {\n> > +\t\tDeviceMatch dm(info.driver);\n> >   \t\tmedia_ = acquireMediaDevice(enumerator, dm);\n> > -\t\tif (media_)\n> > +\t\tif (media_) {\n> > +\t\t\tDeviceMatch converterMatch(info.converter);\n> \n> info.converter being equal to nullptr here results in:\n> \n>    what():  basic_string::_M_construct null not valid\n> Aborted\n> \n> - as DeviceMatch constructor accepts const std::string.\n> \n> Maybe use { \"sun6i-csi\", \"\" } instead of { \"sun6i-csi\", nullptr }?\n\nOops :-/ We could do that, but while testing I've received a warning\nfrom some versions of gcc that the converter variable could be used\nuninitialized. I think that's a false positive, but reworking the code\nto support nullptr helps fixing that, so I'll go that way.","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 7B1CF60415\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Mar 2020 00:55:04 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D1A63A53;\n\tFri, 20 Mar 2020 00:55:03 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584662104;\n\tbh=C8vewgMyFLoMDQ+Ei4GucWUIaykSY9e2BdALB2m0Zw4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Qe5GCV3QCyXngLYyYu3nglvaWMv265QPdp3z38u8MyVmu5hDyvUHv6AZ7fjq70mED\n\tOBZnQH+pGme8DYRc0XNNgurFSMuTFKoNjG6T8LAPENDhzgocPvs9R15lzwyyCM+VjJ\n\tZLBfJZuCJeKjF8+p+0ubbHzJhrEvIQ3eK/U7Mr/g=","Date":"Fri, 20 Mar 2020 01:54:58 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Andrey Konovalov <andrey.konovalov@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org, Martijn Braam <martijn@brixit.nl>, \n\tMickael GUENE <mickael.guene@st.com>,\n\tBenjamin GAIGNARD <benjamin.gaignard@st.com>","Message-ID":"<20200319235458.GP14585@pendragon.ideasonboard.com>","References":"<20200316214310.27665-1-laurent.pinchart@ideasonboard.com>\n\t<20200316214310.27665-11-laurent.pinchart@ideasonboard.com>\n\t<39dde9d6-cdc0-00df-9994-b37eeb77268c@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<39dde9d6-cdc0-00df-9994-b37eeb77268c@linaro.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 10/10] libcamera: pipeline: simple:\n\tIntegrate converter support","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>","X-List-Received-Date":"Thu, 19 Mar 2020 23:55:04 -0000"}}]